diff --git a/.cargo/config.toml b/.cargo/config.toml index 5b529c3dccd..18bc8e4064b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,13 @@ +# TODO: We shouldn't go with tokio_unstable to production + [target.aarch64-unknown-linux-musl] -rustflags = [ "-C", "target-feature=-crt-static" ] +rustflags = ["-C", "target-feature=-crt-static", "--cfg", "tokio_unstable"] [target.x86_64-unknown-linux-musl] -rustflags = [ "-C", "target-feature=-crt-static" ] +rustflags = ["-C", "target-feature=-crt-static", "--cfg", "tokio_unstable"] [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" + +[build] +rustflags = ["--cfg", "tokio_unstable"] diff --git a/.dockerignore b/.dockerignore index 2d179b88e94..d93249fec2a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -23,6 +23,7 @@ packages/*/dist packages/*/wasm packages/*/lib/wasm packages/*/node_modules +packages/*/.env !packages/platform-test-suite/test diff --git a/.github/actions/docker/action.yaml b/.github/actions/docker/action.yaml index 60417a519f1..d41ebf4dcfc 100644 --- a/.github/actions/docker/action.yaml +++ b/.github/actions/docker/action.yaml @@ -37,6 +37,12 @@ inputs: region: description: S3 bucket region required: true + aws_access_key_id: + description: AWS access key ID + required: true + aws_secret_access_key: + description: AWS secret access key + required: true outputs: digest: value: ${{ steps.docker_build.outputs.digest }} @@ -102,6 +108,8 @@ runs: SCCACHE_BUCKET=${{ inputs.bucket }} SCCACHE_REGION=${{ inputs.region }} SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache + AWS_ACCESS_KEY_ID=${{ inputs.aws_access_key_id }} + AWS_SECRET_ACCESS_KEY=${{ inputs.aws_secret_access_key }} cache-from: ${{ steps.layer_cache_settings.outputs.cache_from }} cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }} outputs: type=image,name=${{ inputs.image_org }}/${{ inputs.image_name }},push-by-digest=${{ inputs.push_tags != 'true' }},name-canonical=true,push=true diff --git a/.github/actions/javy/action.yaml b/.github/actions/javy/action.yaml new file mode 100644 index 00000000000..668dc24445a --- /dev/null +++ b/.github/actions/javy/action.yaml @@ -0,0 +1,37 @@ +--- +name: "Setup Javy" +description: "Setup Javy binaries" +inputs: + version: + description: Javy version to use + required: false + default: "1.4.0" +runs: + using: composite + steps: + - name: Install Javy + shell: bash + run: | + set -e + + case "${{ runner.arch }}" in + "ARM64") + JAVY_ARCH="arm-linux" + ;; + "X64") + JAVY_ARCH="x86_64-linux" + ;; + *) + echo "Unsupported architecture: ${{ runner.arch }}" + exit 1 + ;; + esac + + curl -Ls "https://github.com/bytecodealliance/javy/releases/download/v${{ inputs.version }}/javy-${JAVY_ARCH}-v${{ inputs.version }}.gz" | gunzip > javy + + chmod +x javy + sudo mv javy /usr/local/bin/javy + + - name: Verify Javy installation + shell: bash + run: javy --version diff --git a/.github/actions/local-network/action.yaml b/.github/actions/local-network/action.yaml index 6292d742040..3c6c4681174 100644 --- a/.github/actions/local-network/action.yaml +++ b/.github/actions/local-network/action.yaml @@ -97,3 +97,5 @@ runs: - name: Start local network shell: bash run: yarn start + env: + DEBUG: 1 diff --git a/.github/actions/nodejs/action.yaml b/.github/actions/nodejs/action.yaml index 8bba2f1d714..7cb41d5955e 100644 --- a/.github/actions/nodejs/action.yaml +++ b/.github/actions/nodejs/action.yaml @@ -5,7 +5,7 @@ runs: using: composite steps: - name: Setup Node.JS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "20" diff --git a/.github/actions/rust/action.yaml b/.github/actions/rust/action.yaml index b01cd0a5dc8..01239962fc1 100644 --- a/.github/actions/rust/action.yaml +++ b/.github/actions/rust/action.yaml @@ -5,7 +5,7 @@ inputs: toolchain: description: Rust toolchain to use, stable / nightly / beta, or exact version # The same as in /README.md - default: "stable" + default: "1.76" target: description: Target Rust platform required: false @@ -49,13 +49,26 @@ runs: esac # TODO: Move to AMI and build every day + - name: Check if protoc is installed + id: check-protoc + shell: bash + run: | + if command -v protoc >/dev/null 2>&1; then + echo "protoc is already installed." + echo "protoc_installed=true" >> $GITHUB_OUTPUT + else + echo "protoc is not installed." + echo "protoc_installed=false" >> $GITHUB_OUTPUT + fi + - name: Install protoc + if: steps.check-protoc.outputs.protoc_installed == 'false' id: deps-protoc shell: bash run: | curl -Lo /tmp/protoc.zip \ - "https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-${{ steps.protoc_arch.outputs.arch }}.zip" - unzip /tmp/protoc.zip -d ${HOME}/.local + "https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-${{ steps.protoc_arch.outputs.arch }}.zip" + unzip -o /tmp/protoc.zip -d ${HOME}/.local echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV export PATH="${PATH}:${HOME}/.local/bin" diff --git a/.github/package-filters/js-packages.yml b/.github/package-filters/js-packages.yml index b9e3618155c..d158bb39f67 100644 --- a/.github/package-filters/js-packages.yml +++ b/.github/package-filters/js-packages.yml @@ -71,7 +71,12 @@ dash: &dash dashmate: - .github/workflows/tests* - packages/dashmate/** - - *dash + - *dashpay-contract + - *masternode-reward-shares-contract + - *dpns-contract + - *withdrawals-contract + - *wallet-lib + - *dapi-client '@dashevo/platform-test-suite': - .github/workflows/tests* diff --git a/.github/package-filters/rs-packages.yml b/.github/package-filters/rs-packages.yml index f23238f9afa..f50dea216d3 100644 --- a/.github/package-filters/rs-packages.yml +++ b/.github/package-filters/rs-packages.yml @@ -14,6 +14,10 @@ dpns-contract: &dpns-contract - .github/workflows/tests* - packages/dpns-contract/** +json-schema-compatibility-validator: &json-schema-compatibility-validator + - .github/workflows/tests* + - packages/rs-json-schema-compatibility-validator/** + dpp: &dpp - .github/workflows/tests* - packages/rs-dpp/** @@ -21,6 +25,7 @@ dpp: &dpp - *masternode-reward-shares-contract - *dpns-contract - *withdrawals-contract + - *json-schema-compatibility-validator - packages/rs-platform-serialization/** - packages/rs-platform-serialization-derive/** - packages/rs-platform-value/** @@ -54,7 +59,7 @@ rs-dapi-client: &dapi_client - packages/rs-dapi-client/** - *dapi_grpc -rs-sdk: +dash-sdk: - .github/workflows/tests* - packages/rs-drive-proof-verifier/** - packages/rs-sdk/** diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7238fbec4ec..12f512b7208 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,7 @@ name: Publish docs via GitHub Pages on: push: branches: - - master + - v1.0-dev jobs: build: diff --git a/.github/workflows/release-docker-image.yml b/.github/workflows/release-docker-image.yml index 9b52826c1e4..a8ed8273ca9 100644 --- a/.github/workflows/release-docker-image.yml +++ b/.github/workflows/release-docker-image.yml @@ -25,7 +25,7 @@ jobs: build-image: name: Build ${{ matrix.platform }} image runs-on: ${{ matrix.runner }} - timeout-minutes: 20 + timeout-minutes: 25 strategy: matrix: include: @@ -42,7 +42,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Build and push by digest uses: ./.github/actions/docker @@ -56,10 +58,13 @@ jobs: cargo_profile: release dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} - region: ${{ vars.AWS_REGION }} + region: ${{ secrets.AWS_REGION }} + aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Export digest run: | + rm -rf ${{ env.DIGEST_DIR_PATH }} mkdir -p ${{ env.DIGEST_DIR_PATH }} digest="${{ steps.docker_build.outputs.digest }}" touch "${{ env.DIGEST_DIR_PATH }}/${digest#sha256:}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c967db8f347..036e6ac49c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Retrieve JS build artifacts uses: strophy/actions-cache@opendal-update @@ -69,7 +71,7 @@ jobs: CARGO_BUILD_PROFILE: release RUSTC_WRAPPER: sccache SCCACHE_BUCKET: multi-runner-cache-x1xibo9c - SCCACHE_REGION: ${{ vars.AWS_REGION }} + SCCACHE_REGION: ${{ secrets.AWS_REGION }} SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32 if: ${{ steps.cache.outputs.cache-hit != 'true' }} @@ -135,7 +137,7 @@ jobs: image_name: drive target: drive-abci - release-drive-dapi: + release-dapi-image: name: Release DAPI image secrets: inherit uses: ./.github/workflows/release-docker-image.yml @@ -193,8 +195,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Retrieve JS build artifacts uses: strophy/actions-cache@opendal-update diff --git a/.github/workflows/tests-build-image.yml b/.github/workflows/tests-build-image.yml index 0281094014d..f8b7c830f42 100644 --- a/.github/workflows/tests-build-image.yml +++ b/.github/workflows/tests-build-image.yml @@ -17,7 +17,7 @@ on: jobs: build-image: name: Build ${{ inputs.name }} image - runs-on: [ "self-hosted", "linux", "arm64", "ubuntu-platform-4x" ] + runs-on: ["self-hosted", "linux", "arm64", "ubuntu-platform"] steps: - name: Check out repo uses: actions/checkout@v4 @@ -27,20 +27,24 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Login to ECR - run: aws ecr get-login-password --region ${{ vars.AWS_REGION }} | docker login --username AWS --password-stdin ${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com + run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com shell: bash - name: Build and push by SHA uses: ./.github/actions/docker with: image_name: ${{ inputs.image_name }} - image_org: ${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com + image_org: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com target: ${{ inputs.target }} platform: linux/arm64 push_tags: true dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} - region: ${{ vars.AWS_REGION }} + region: ${{ secrets.AWS_REGION }} + aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/tests-build-js.yml b/.github/workflows/tests-build-js.yml index ea2b0182d95..a367af55fc8 100644 --- a/.github/workflows/tests-build-js.yml +++ b/.github/workflows/tests-build-js.yml @@ -4,12 +4,14 @@ on: jobs: build-js: name: Build JS - runs-on: [ "self-hosted", "linux", "arm64", "ubuntu-platform-4x" ] + runs-on: ["self-hosted", "linux", "arm64", "ubuntu-platform"] steps: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} # TODO: Use upload artifacts action instead - name: Cache build artifacts @@ -50,7 +52,7 @@ jobs: env: RUSTC_WRAPPER: sccache SCCACHE_BUCKET: multi-runner-cache-x1xibo9c - SCCACHE_REGION: ${{ vars.AWS_REGION }} + SCCACHE_REGION: ${{ secrets.AWS_REGION }} SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32 - name: Ignore only already cached artifacts diff --git a/.github/workflows/tests-codeql.yml b/.github/workflows/tests-codeql.yml index db4b9cc2c5b..d00a66c8dfd 100644 --- a/.github/workflows/tests-codeql.yml +++ b/.github/workflows/tests-codeql.yml @@ -23,8 +23,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Setup Node.JS uses: ./.github/actions/nodejs diff --git a/.github/workflows/tests-dashmate.yml b/.github/workflows/tests-dashmate.yml index 99bed1134b1..369c72e06a1 100644 --- a/.github/workflows/tests-dashmate.yml +++ b/.github/workflows/tests-dashmate.yml @@ -35,7 +35,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Setup Node.JS uses: ./.github/actions/nodejs @@ -49,13 +51,15 @@ jobs: key: build-js-artifacts/${{ github.sha }} - name: Unpack JS build artifacts archive - run: tar -xf build-js-artifacts-${{ github.sha }}.tar + run: tar -xvf build-js-artifacts-${{ github.sha }}.tar - name: Replace with pre-built images run: | + set -x + # Login to ECR - DOCKER_HUB_ORG="${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com" - aws ecr get-login-password --region ${{ vars.AWS_REGION }} | docker login --username AWS --password-stdin $DOCKER_HUB_ORG + DOCKER_HUB_ORG="${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com" + aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin $DOCKER_HUB_ORG SHA_TAG=sha-${{ github.sha }} @@ -99,6 +103,7 @@ jobs: - name: Run tests with cache run: yarn workspace dashmate run mocha ${{ inputs.test-pattern }} env: + DEBUG: 1 DASHMATE_E2E_TESTS_SKIP_IMAGE_BUILD: true DASHMATE_E2E_TESTS_LOCAL_HOMEDIR: /home/ubuntu/.dashmate if: steps.local-network-data.outputs.cache-hit == 'true' @@ -106,6 +111,7 @@ jobs: - name: Run tests without cache run: yarn workspace dashmate run mocha ${{ inputs.test-pattern }} env: + DEBUG: 1 DASHMATE_E2E_TESTS_SKIP_IMAGE_BUILD: true if: steps.local-network-data.outputs.cache-hit != 'true' diff --git a/.github/workflows/tests-js-package.yml b/.github/workflows/tests-js-package.yml index 3a4969b71ea..ef508ec0738 100644 --- a/.github/workflows/tests-js-package.yml +++ b/.github/workflows/tests-js-package.yml @@ -28,8 +28,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Setup Node.JS uses: ./.github/actions/nodejs @@ -64,8 +65,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Setup Node.JS uses: ./.github/actions/nodejs diff --git a/.github/workflows/tests-packges-functional.yml b/.github/workflows/tests-packges-functional.yml index 3d06f756e92..57f735f0d5e 100644 --- a/.github/workflows/tests-packges-functional.yml +++ b/.github/workflows/tests-packges-functional.yml @@ -8,7 +8,7 @@ jobs: timeout-minutes: 15 env: CHROME_BIN: /usr/bin/brave-browser - ECR_HOST: ${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com + ECR_HOST: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com steps: - name: Check out repo uses: actions/checkout@v4 @@ -24,10 +24,12 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Login to ECR - run: aws ecr get-login-password --region ${{ vars.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_HOST }} + run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_HOST }} - name: Start local network uses: ./.github/actions/local-network diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index bd574fdffbc..e666491ebcf 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -33,8 +33,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Setup Rust uses: ./.github/actions/rust @@ -47,7 +48,7 @@ jobs: env: RUSTC_WRAPPER: sccache SCCACHE_BUCKET: multi-runner-cache-x1xibo9c - SCCACHE_REGION: ${{ vars.AWS_REGION }} + SCCACHE_REGION: ${{ secrets.AWS_REGION }} SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu formatting: @@ -65,7 +66,7 @@ jobs: cache: false - name: Check formatting - run: exit `cargo fmt --check --package=${{ inputs.package }} | wc -l` + run: cargo fmt --check --package=${{ inputs.package }} unused_deps: name: Unused dependencies @@ -81,8 +82,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Setup Rust uses: ./.github/actions/rust @@ -98,7 +100,7 @@ jobs: env: RUSTC_WRAPPER: sccache SCCACHE_BUCKET: multi-runner-cache-x1xibo9c - SCCACHE_REGION: ${{ vars.AWS_REGION }} + SCCACHE_REGION: ${{ secrets.AWS_REGION }} SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu with: args: ${{ steps.crate_info.outputs.cargo_manifest_dir }} @@ -106,6 +108,10 @@ jobs: detect_structure_changes: name: Detect immutable structure changes runs-on: ubuntu-22.04 + # FIXME: as we use `gh pr view` below, this check can only + # run on pull requests. We should find a way to run it + # when manual triggers are used. + if: github.event_name == 'pull_request' steps: - name: Checkout base commit uses: actions/checkout@v4 @@ -163,7 +169,7 @@ jobs: test: name: Tests runs-on: ${{ fromJSON(inputs.test-runner) }} - timeout-minutes: 20 + timeout-minutes: 25 steps: - name: Check out repo uses: actions/checkout@v4 @@ -171,7 +177,9 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-region: ${{ secrets.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Setup Rust uses: ./.github/actions/rust @@ -181,7 +189,7 @@ jobs: env: RUSTC_WRAPPER: sccache SCCACHE_BUCKET: multi-runner-cache-x1xibo9c - SCCACHE_REGION: ${{ vars.AWS_REGION }} + SCCACHE_REGION: ${{ secrets.AWS_REGION }} SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu check_each_feature: @@ -196,12 +204,14 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-region: ${{ secrets.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Setup Rust uses: ./.github/actions/rust - - name: Get crate ${{ inputs.package }} info + - name: Get crate ${{ runner.arch }} info id: crate_info uses: ./.github/actions/crate_info with: @@ -211,13 +221,14 @@ jobs: env: RUSTC_WRAPPER: sccache SCCACHE_BUCKET: multi-runner-cache-x1xibo9c - SCCACHE_REGION: ${{ vars.AWS_REGION }} + SCCACHE_REGION: ${{ secrets.AWS_REGION }} SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu run: | echo Verify all features disabled set -ex features="${{ steps.crate_info.outputs.features }}" fails="" + RUSTFLAGS="-D warnings" cargo check --no-default-features --package "${{ inputs.package }}" --locked for feature in $features ; do echo " ============== Verify feature $feature ==============" diff --git a/.github/workflows/tests-test-suite.yml b/.github/workflows/tests-test-suite.yml index 0baab8f6f09..f1d0ac16212 100644 --- a/.github/workflows/tests-test-suite.yml +++ b/.github/workflows/tests-test-suite.yml @@ -26,7 +26,7 @@ jobs: timeout-minutes: 15 env: CHROME_BIN: /usr/bin/brave-browser - ECR_HOST: ${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com + ECR_HOST: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com steps: - name: Check out repo uses: actions/checkout@v4 @@ -42,10 +42,12 @@ jobs: - name: Configure AWS credentials and bucket region uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: ${{ vars.AWS_REGION }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} - name: Login to ECR - run: aws ecr get-login-password --region ${{ vars.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_HOST }} + run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_HOST }} - name: Start local network uses: ./.github/actions/local-network diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dd65706849b..c823d0cd061 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] branches: - master - - v[0-9]+\.[0-9]+-dev + - 'v[0-9]+\.[0-9]+-dev' push: branches: - master @@ -83,11 +83,13 @@ jobs: uses: ./.github/workflows/tests-rs-package.yml with: package: ${{ matrix.rs-package }} - # Run drive and drive-abci linter on self-hosted 2x - lint-runner: ${{ contains(fromJSON('["drive-abci", "drive"]'), matrix.rs-package) && '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' || '"ubuntu-22.04"' }} + # lint-runner: ${{ contains(fromJSON('["drive-abci", "drive"]'), matrix.rs-package) && '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' || '"ubuntu-22.04"' }} + # FIXME: Clippy fails on github hosted runners, most likely due to RAM usage. Using self-hosted runners for now. + lint-runner: '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' # Run drive tests on self-hosted 4x - test-runner: ${{ contains(fromJSON('["drive-abci"]'), matrix.rs-package) && '[ "self-hosted", "linux", "arm64", "ubuntu-platform-4x" ]' || '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' }} - check-each-feature: ${{ contains(fromJSON('["rs-sdk","rs-dapi-client","dapi-grpc","dpp","drive-abci"]'), matrix.rs-package) }} + test-runner: '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' + check-each-feature: ${{ contains(fromJSON('["dash-sdk","rs-dapi-client","dapi-grpc","dpp","drive-abci"]'), matrix.rs-package) }} + rs-crates-security: name: Rust crates security audit if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} @@ -126,9 +128,9 @@ jobs: uses: actions/checkout@v4 - name: Setup Node.JS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: "18" + node-version: "20" - name: Enable corepack run: corepack enable diff --git a/.pnp.cjs b/.pnp.cjs index 7cdca897026..be7f91a39fb 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -141,8 +141,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@ampproject-remapping-npm-2.2.1-3da3d624be-e15fecbf3b.zip/node_modules/@ampproject/remapping/",\ "packageDependencies": [\ ["@ampproject/remapping", "npm:2.2.1"],\ - ["@jridgewell/gen-mapping", "npm:0.3.2"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ + ["@jridgewell/gen-mapping", "npm:0.3.3"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"]\ ],\ "linkType": "HARD"\ }]\ @@ -189,7 +189,7 @@ const RAW_RUNTIME_STATE = ["commander", "npm:4.1.1"],\ ["convert-source-map", "npm:2.0.0"],\ ["fs-readdir-recursive", "npm:1.1.0"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["make-dir", "npm:2.1.0"],\ ["slash", "npm:2.0.0"]\ ],\ @@ -201,14 +201,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/code-frame", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip/node_modules/@babel/code-frame/",\ - "packageDependencies": [\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/highlight", "npm:7.16.10"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.13", {\ "packageLocation": "./.yarn/cache/@babel-code-frame-npm-7.22.13-2782581d20-bf6ae6ba3a.zip/node_modules/@babel/code-frame/",\ "packageDependencies": [\ @@ -260,10 +252,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:7.23.3", {\ - "packageLocation": "./.yarn/__virtual__/@babel-eslint-parser-virtual-fb9593e0e4/0/cache/@babel-eslint-parser-npm-7.23.3-4d4192b444-bc487f67aa.zip/node_modules/@babel/eslint-parser/",\ + ["virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3", {\ + "packageLocation": "./.yarn/__virtual__/@babel-eslint-parser-virtual-6366d88438/0/cache/@babel-eslint-parser-npm-7.23.3-4d4192b444-bc487f67aa.zip/node_modules/@babel/eslint-parser/",\ "packageDependencies": [\ - ["@babel/eslint-parser", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:7.23.3"],\ + ["@babel/eslint-parser", "virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3"],\ ["@babel/core", "npm:7.23.3"],\ ["@nicolo-ribaudo/eslint-scope-5-internals", "npm:5.1.1-v1"],\ ["@types/babel__core", null],\ @@ -282,16 +274,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/generator", [\ - ["npm:7.17.3", {\ - "packageLocation": "./.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip/node_modules/@babel/generator/",\ - "packageDependencies": [\ - ["@babel/generator", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"],\ - ["jsesc", "npm:2.5.2"],\ - ["source-map", "npm:0.5.7"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-generator-npm-7.23.3-a2ca9dda65-0f815d275c.zip/node_modules/@babel/generator/",\ "packageDependencies": [\ @@ -412,7 +394,7 @@ const RAW_RUNTIME_STATE = ["@types/babel__core", null],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ ["lodash.debounce", "npm:4.0.8"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "packagePeers": [\ "@babel/core",\ @@ -422,14 +404,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-environment-visitor", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip/node_modules/@babel/helper-environment-visitor/",\ - "packageDependencies": [\ - ["@babel/helper-environment-visitor", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.20", {\ "packageLocation": "./.yarn/cache/@babel-helper-environment-visitor-npm-7.22.20-260909e014-d80ee98ff6.zip/node_modules/@babel/helper-environment-visitor/",\ "packageDependencies": [\ @@ -439,16 +413,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-function-name", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip/node_modules/@babel/helper-function-name/",\ - "packageDependencies": [\ - ["@babel/helper-function-name", "npm:7.16.7"],\ - ["@babel/helper-get-function-arity", "npm:7.16.7"],\ - ["@babel/template", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.0", {\ "packageLocation": "./.yarn/cache/@babel-helper-function-name-npm-7.23.0-ce38271242-7b2ae024cd.zip/node_modules/@babel/helper-function-name/",\ "packageDependencies": [\ @@ -459,25 +423,7 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["@babel/helper-get-function-arity", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip/node_modules/@babel/helper-get-function-arity/",\ - "packageDependencies": [\ - ["@babel/helper-get-function-arity", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@babel/helper-hoist-variables", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip/node_modules/@babel/helper-hoist-variables/",\ - "packageDependencies": [\ - ["@babel/helper-hoist-variables", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.5", {\ "packageLocation": "./.yarn/cache/@babel-helper-hoist-variables-npm-7.22.5-6db3192347-394ca191b4.zip/node_modules/@babel/helper-hoist-variables/",\ "packageDependencies": [\ @@ -545,13 +491,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-plugin-utils", [\ - ["npm:7.14.5", {\ - "packageLocation": "./.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip/node_modules/@babel/helper-plugin-utils/",\ - "packageDependencies": [\ - ["@babel/helper-plugin-utils", "npm:7.14.5"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.5", {\ "packageLocation": "./.yarn/cache/@babel-helper-plugin-utils-npm-7.22.5-192e38e1de-ab220db218.zip/node_modules/@babel/helper-plugin-utils/",\ "packageDependencies": [\ @@ -631,14 +570,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-split-export-declaration", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip/node_modules/@babel/helper-split-export-declaration/",\ - "packageDependencies": [\ - ["@babel/helper-split-export-declaration", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.6", {\ "packageLocation": "./.yarn/cache/@babel-helper-split-export-declaration-npm-7.22.6-e723505aef-e141cace58.zip/node_modules/@babel/helper-split-export-declaration/",\ "packageDependencies": [\ @@ -658,13 +589,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-validator-identifier", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip/node_modules/@babel/helper-validator-identifier/",\ - "packageDependencies": [\ - ["@babel/helper-validator-identifier", "npm:7.16.7"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.20", {\ "packageLocation": "./.yarn/cache/@babel-helper-validator-identifier-npm-7.22.20-18305bb306-df882d2675.zip/node_modules/@babel/helper-validator-identifier/",\ "packageDependencies": [\ @@ -707,16 +631,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/highlight", [\ - ["npm:7.16.10", {\ - "packageLocation": "./.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip/node_modules/@babel/highlight/",\ - "packageDependencies": [\ - ["@babel/highlight", "npm:7.16.10"],\ - ["@babel/helper-validator-identifier", "npm:7.16.7"],\ - ["chalk", "npm:2.4.2"],\ - ["js-tokens", "npm:4.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.20", {\ "packageLocation": "./.yarn/cache/@babel-highlight-npm-7.22.20-5de7aba88d-1aabc95b2c.zip/node_modules/@babel/highlight/",\ "packageDependencies": [\ @@ -729,19 +643,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/parser", [\ - ["npm:7.17.3", {\ - "packageLocation": "./.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip/node_modules/@babel/parser/",\ - "packageDependencies": [\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-parser-npm-7.23.3-8d3a021e39-284c22ec1d.zip/node_modules/@babel/parser/",\ "packageDependencies": [\ ["@babel/parser", "npm:7.23.3"],\ - ["@babel/types", "npm:7.17.0"]\ + ["@babel/types", "npm:7.23.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -853,7 +759,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-async-generators", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -876,7 +782,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-class-properties", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.12.13"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -899,7 +805,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-class-static-block", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.14.5"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -922,7 +828,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-dynamic-import", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -945,7 +851,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-export-namespace-from", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1014,7 +920,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-import-meta", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.10.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1037,7 +943,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-json-strings", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1060,7 +966,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-logical-assignment-operators", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.10.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1083,7 +989,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-nullish-coalescing-operator", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1106,7 +1012,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-numeric-separator", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.10.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1129,7 +1035,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-object-rest-spread", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1152,7 +1058,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-optional-catch-binding", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1175,7 +1081,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-optional-chaining", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1198,7 +1104,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-private-property-in-object", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.14.5"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1221,7 +1127,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-top-level-await", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.14.5"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -2526,8 +2432,8 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/preset-modules", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:0.1.6-no-external-plugins"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ - ["@babel/types", "npm:7.17.0"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ + ["@babel/types", "npm:7.23.3"],\ ["@types/babel__core", null],\ ["esutils", "npm:2.0.3"]\ ],\ @@ -2558,16 +2464,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/template", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip/node_modules/@babel/template/",\ - "packageDependencies": [\ - ["@babel/template", "npm:7.16.7"],\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.15", {\ "packageLocation": "./.yarn/cache/@babel-template-npm-7.22.15-0b464facb4-21e768e4ee.zip/node_modules/@babel/template/",\ "packageDependencies": [\ @@ -2580,23 +2476,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/traverse", [\ - ["npm:7.17.3", {\ - "packageLocation": "./.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip/node_modules/@babel/traverse/",\ - "packageDependencies": [\ - ["@babel/traverse", "npm:7.17.3"],\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/generator", "npm:7.17.3"],\ - ["@babel/helper-environment-visitor", "npm:7.16.7"],\ - ["@babel/helper-function-name", "npm:7.16.7"],\ - ["@babel/helper-hoist-variables", "npm:7.16.7"],\ - ["@babel/helper-split-export-declaration", "npm:7.16.7"],\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"],\ - ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["globals", "npm:11.12.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-traverse-npm-7.23.3-a268f4c943-522ef8eefe.zip/node_modules/@babel/traverse/",\ "packageDependencies": [\ @@ -2616,15 +2495,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/types", [\ - ["npm:7.17.0", {\ - "packageLocation": "./.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip/node_modules/@babel/types/",\ - "packageDependencies": [\ - ["@babel/types", "npm:7.17.0"],\ - ["@babel/helper-validator-identifier", "npm:7.16.7"],\ - ["to-fast-properties", "npm:2.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-types-npm-7.23.3-77a779c6d4-05ec1527d0.zip/node_modules/@babel/types/",\ "packageDependencies": [\ @@ -2654,24 +2524,7 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["@cspotcode/source-map-consumer", [\ - ["npm:0.8.0", {\ - "packageLocation": "./.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip/node_modules/@cspotcode/source-map-consumer/",\ - "packageDependencies": [\ - ["@cspotcode/source-map-consumer", "npm:0.8.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@cspotcode/source-map-support", [\ - ["npm:0.7.0", {\ - "packageLocation": "./.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip/node_modules/@cspotcode/source-map-support/",\ - "packageDependencies": [\ - ["@cspotcode/source-map-support", "npm:0.7.0"],\ - ["@cspotcode/source-map-consumer", "npm:0.8.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.8.1", {\ "packageLocation": "./.yarn/cache/@cspotcode-source-map-support-npm-0.8.1-964f2de99d-b6e38a1712.zip/node_modules/@cspotcode/source-map-support/",\ "packageDependencies": [\ @@ -2698,7 +2551,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./packages/bench-suite/",\ "packageDependencies": [\ ["@dashevo/bench-suite", "workspace:packages/bench-suite"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ @@ -2731,17 +2584,19 @@ const RAW_RUNTIME_STATE = "packageLocation": "./packages/dapi/",\ "packageDependencies": [\ ["@dashevo/dapi", "workspace:packages/dapi"],\ + ["@babel/core", "npm:7.23.3"],\ + ["@babel/eslint-parser", "virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3"],\ ["@dashevo/bls", "npm:1.2.9"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ ["@dashevo/dapi-grpc", "workspace:packages/dapi-grpc"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ - ["@dashevo/dashd-rpc", "npm:18.2.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ + ["@dashevo/dashd-rpc", "npm:19.0.0"],\ ["@dashevo/dp-services-ctl", "https://github.com/dashevo/js-dp-services-ctl.git#commit=3976076b0018c5b4632ceda4c752fc597f27a640"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ ["@grpc/grpc-js", "npm:1.4.4"],\ ["@pshenmic/zeromq", "npm:6.0.0-beta.22"],\ - ["ajv", "npm:8.8.1"],\ + ["ajv", "npm:8.12.0"],\ ["bs58", "npm:4.0.1"],\ ["cbor", "npm:8.1.0"],\ ["chai", "npm:4.3.10"],\ @@ -2766,7 +2621,7 @@ const RAW_RUNTIME_STATE = ["sinon", "npm:17.0.1"],\ ["sinon-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:3.7.0"],\ ["swagger-jsdoc", "npm:3.7.0"],\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "linkType": "SOFT"\ }]\ @@ -2779,7 +2634,7 @@ const RAW_RUNTIME_STATE = ["@babel/core", "npm:7.23.3"],\ ["@dashevo/dapi-grpc", "workspace:packages/dapi-grpc"],\ ["@dashevo/dash-spv", "workspace:packages/dash-spv"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ ["assert-browserify", "npm:2.0.0"],\ @@ -2800,7 +2655,7 @@ const RAW_RUNTIME_STATE = ["eslint-plugin-jsdoc", "virtual:8f25fc90e0fb5fd89843707863857591fa8c52f9f33eadced4bf404b1871d91959f7bb86948ae0e1b53ee94d491ef8fde9c0b58b39c9490c0d0fa6c931945f97#npm:46.9.0"],\ ["events", "npm:3.3.0"],\ ["google-protobuf", "npm:3.19.1"],\ - ["karma", "npm:6.4.1"],\ + ["karma", "npm:6.4.3"],\ ["karma-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:0.1.0"],\ ["karma-chrome-launcher", "npm:3.1.0"],\ ["karma-firefox-launcher", "npm:2.1.2"],\ @@ -2871,7 +2726,7 @@ const RAW_RUNTIME_STATE = ["@dashevo/dash-spv", "workspace:packages/dash-spv"],\ ["@dashevo/dark-gravity-wave", "npm:1.1.1"],\ ["@dashevo/dash-util", "npm:2.0.3"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["chai", "npm:4.3.10"],\ ["eslint", "npm:8.53.0"],\ ["eslint-config-airbnb-base", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:15.0.0"],\ @@ -2898,10 +2753,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@dashevo/dashcore-lib", [\ - ["npm:0.21.0", {\ - "packageLocation": "./.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip/node_modules/@dashevo/dashcore-lib/",\ + ["npm:0.21.3", {\ + "packageLocation": "./.yarn/cache/@dashevo-dashcore-lib-npm-0.21.3-8c8abba924-28e2731ac6.zip/node_modules/@dashevo/dashcore-lib/",\ "packageDependencies": [\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["@dashevo/bls", "npm:1.2.9"],\ ["@dashevo/x11-hash-js", "npm:1.0.2"],\ ["@types/node", "npm:12.20.37"],\ @@ -2919,10 +2774,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@dashevo/dashd-rpc", [\ - ["npm:18.2.0", {\ - "packageLocation": "./.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip/node_modules/@dashevo/dashd-rpc/",\ + ["npm:19.0.0", {\ + "packageLocation": "./.yarn/cache/@dashevo-dashd-rpc-npm-19.0.0-54bb2a5dfc-2eab84af3e.zip/node_modules/@dashevo/dashd-rpc/",\ "packageDependencies": [\ - ["@dashevo/dashd-rpc", "npm:18.2.0"],\ + ["@dashevo/dashd-rpc", "npm:19.0.0"],\ ["async", "npm:3.2.4"],\ ["bluebird", "npm:3.7.2"]\ ],\ @@ -3084,13 +2939,14 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@dashevo/platform-test-suite", "workspace:packages/platform-test-suite"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@dashevo/feature-flags-contract", "workspace:packages/feature-flags-contract"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/masternode-reward-shares-contract", "workspace:packages/masternode-reward-shares-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ + ["@dashevo/withdrawals-contract", "workspace:packages/withdrawals-contract"],\ ["assert", "npm:2.0.0"],\ ["assert-browserify", "npm:2.0.0"],\ ["browserify-zlib", "npm:0.2.0"],\ @@ -3106,10 +2962,10 @@ const RAW_RUNTIME_STATE = ["eslint-config-airbnb-base", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:15.0.0"],\ ["eslint-plugin-import", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:2.29.0"],\ ["events", "npm:3.3.0"],\ - ["glob", "npm:10.3.4"],\ + ["glob", "npm:10.4.1"],\ ["https-browserify", "npm:1.0.0"],\ ["js-merkle", "npm:0.1.5"],\ - ["karma", "npm:6.4.1"],\ + ["karma", "npm:6.4.3"],\ ["karma-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:0.1.0"],\ ["karma-chrome-launcher", "npm:3.1.0"],\ ["karma-firefox-launcher", "npm:2.1.2"],\ @@ -3125,6 +2981,7 @@ const RAW_RUNTIME_STATE = ["path-browserify", "npm:1.0.1"],\ ["process", "npm:0.11.10"],\ ["semver", "npm:7.5.3"],\ + ["setimmediate", "npm:1.0.5"],\ ["sinon", "npm:17.0.1"],\ ["sinon-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:3.7.0"],\ ["stream-browserify", "npm:3.0.0"],\ @@ -3135,7 +2992,7 @@ const RAW_RUNTIME_STATE = ["utf-8-validate", "npm:5.0.9"],\ ["util", "npm:0.12.4"],\ ["webpack", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:5.76.1"],\ - ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:7.5.5"]\ + ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:8.17.1"]\ ],\ "linkType": "SOFT"\ }]\ @@ -3159,9 +3016,9 @@ const RAW_RUNTIME_STATE = ["@types/node", "npm:13.13.52"],\ ["chalk", "npm:3.0.0"],\ ["escodegen", "npm:2.0.0"],\ - ["espree", "npm:9.1.0"],\ + ["espree", "npm:9.6.1"],\ ["estraverse", "npm:5.3.0"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["long", "npm:4.0.0"],\ ["minimist", "npm:1.2.6"],\ ["semver", "npm:7.5.3"],\ @@ -3177,7 +3034,7 @@ const RAW_RUNTIME_STATE = ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ ["@dashevo/dash-spv", "workspace:packages/dash-spv"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ ["@yarnpkg/pnpify", "npm:4.0.0-rc.42"],\ @@ -3196,7 +3053,7 @@ const RAW_RUNTIME_STATE = ["eslint-plugin-import", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:2.29.0"],\ ["events", "npm:3.3.0"],\ ["https-browserify", "npm:1.0.0"],\ - ["karma", "npm:6.4.1"],\ + ["karma", "npm:6.4.3"],\ ["karma-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:0.1.0"],\ ["karma-chrome-launcher", "npm:3.1.0"],\ ["karma-firefox-launcher", "npm:2.1.2"],\ @@ -3239,12 +3096,12 @@ const RAW_RUNTIME_STATE = ["@babel/core", "npm:7.23.3"],\ ["@babel/preset-env", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:7.23.3"],\ ["@dashevo/bls", "npm:1.2.9"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@types/bs58", "npm:4.0.1"],\ ["@types/node", "npm:14.17.34"],\ ["@yarnpkg/pnpify", "npm:4.0.0-rc.42"],\ - ["ajv", "npm:8.8.1"],\ + ["ajv", "npm:8.12.0"],\ ["assert", "npm:2.0.0"],\ ["bs58", "npm:4.0.1"],\ ["buffer", "npm:6.0.3"],\ @@ -3261,7 +3118,7 @@ const RAW_RUNTIME_STATE = ["fast-json-patch", "npm:3.1.1"],\ ["https-browserify", "npm:1.0.0"],\ ["json-schema-diff-validator", "npm:0.4.1"],\ - ["karma", "npm:6.4.1"],\ + ["karma", "npm:6.4.3"],\ ["karma-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:0.1.0"],\ ["karma-chrome-launcher", "npm:3.1.0"],\ ["karma-firefox-launcher", "npm:2.1.2"],\ @@ -3339,13 +3196,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@eslint-community/eslint-utils", [\ - ["npm:4.2.0", {\ - "packageLocation": "./.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip/node_modules/@eslint-community/eslint-utils/",\ - "packageDependencies": [\ - ["@eslint-community/eslint-utils", "npm:4.2.0"]\ - ],\ - "linkType": "SOFT"\ - }],\ ["npm:4.4.0", {\ "packageLocation": "./.yarn/cache/@eslint-community-eslint-utils-npm-4.4.0-d1791bd5a3-8d70bcdcd8.zip/node_modules/@eslint-community/eslint-utils/",\ "packageDependencies": [\ @@ -3353,13 +3203,13 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0", {\ - "packageLocation": "./.yarn/__virtual__/@eslint-community-eslint-utils-virtual-1e8778691e/0/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip/node_modules/@eslint-community/eslint-utils/",\ + ["virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0", {\ + "packageLocation": "./.yarn/__virtual__/@eslint-community-eslint-utils-virtual-4b69618f4d/0/cache/@eslint-community-eslint-utils-npm-4.4.0-d1791bd5a3-8d70bcdcd8.zip/node_modules/@eslint-community/eslint-utils/",\ "packageDependencies": [\ - ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0"],\ + ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0"],\ ["@types/eslint", null],\ ["eslint", "npm:8.53.0"],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ + ["eslint-visitor-keys", "npm:3.4.3"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -3373,7 +3223,7 @@ const RAW_RUNTIME_STATE = ["@eslint-community/eslint-utils", "virtual:b13453c6e327a35c05e8ce1283d4970e5e4619ba21a2fa8909367ea67136c23860ec34186acaf505374401498c777e7891702b73bbd3697c54d0993c3fd435cd#npm:4.4.0"],\ ["@types/eslint", null],\ ["eslint", null],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ + ["eslint-visitor-keys", "npm:3.4.3"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -3389,13 +3239,6 @@ const RAW_RUNTIME_STATE = ["@eslint-community/regexpp", "npm:4.10.0"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:4.4.0", {\ - "packageLocation": "./.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip/node_modules/@eslint-community/regexpp/",\ - "packageDependencies": [\ - ["@eslint-community/regexpp", "npm:4.4.0"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["@eslint/eslintrc", [\ @@ -3431,7 +3274,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@grpc/grpc-js", "npm:1.4.4"],\ ["@grpc/proto-loader", "npm:0.6.13"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -3597,35 +3440,18 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@jridgewell/gen-mapping", [\ - ["npm:0.3.2", {\ - "packageLocation": "./.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip/node_modules/@jridgewell/gen-mapping/",\ - "packageDependencies": [\ - ["@jridgewell/gen-mapping", "npm:0.3.2"],\ - ["@jridgewell/set-array", "npm:1.1.2"],\ - ["@jridgewell/sourcemap-codec", "npm:1.4.14"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.3.3", {\ "packageLocation": "./.yarn/cache/@jridgewell-gen-mapping-npm-0.3.3-1815eba94c-072ace159c.zip/node_modules/@jridgewell/gen-mapping/",\ "packageDependencies": [\ ["@jridgewell/gen-mapping", "npm:0.3.3"],\ ["@jridgewell/set-array", "npm:1.1.2"],\ ["@jridgewell/sourcemap-codec", "npm:1.4.14"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ + ["@jridgewell/trace-mapping", "npm:0.3.18"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["@jridgewell/resolve-uri", [\ - ["npm:3.0.8", {\ - "packageLocation": "./.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip/node_modules/@jridgewell/resolve-uri/",\ - "packageDependencies": [\ - ["@jridgewell/resolve-uri", "npm:3.0.8"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.1.0", {\ "packageLocation": "./.yarn/cache/@jridgewell-resolve-uri-npm-3.1.0-6ff2351e61-320ceb37af.zip/node_modules/@jridgewell/resolve-uri/",\ "packageDependencies": [\ @@ -3648,8 +3474,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@jridgewell-source-map-npm-0.3.2-6fd1f37b22-1aaa42075b.zip/node_modules/@jridgewell/source-map/",\ "packageDependencies": [\ ["@jridgewell/source-map", "npm:0.3.2"],\ - ["@jridgewell/gen-mapping", "npm:0.3.2"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ + ["@jridgewell/gen-mapping", "npm:0.3.3"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"]\ ],\ "linkType": "HARD"\ }]\ @@ -3664,15 +3490,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@jridgewell/trace-mapping", [\ - ["npm:0.3.15", {\ - "packageLocation": "./.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip/node_modules/@jridgewell/trace-mapping/",\ - "packageDependencies": [\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ - ["@jridgewell/resolve-uri", "npm:3.0.8"],\ - ["@jridgewell/sourcemap-codec", "npm:1.4.14"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.3.18", {\ "packageLocation": "./.yarn/cache/@jridgewell-trace-mapping-npm-0.3.18-cd96571385-f4fabdddf8.zip/node_modules/@jridgewell/trace-mapping/",\ "packageDependencies": [\ @@ -3686,7 +3503,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@jridgewell-trace-mapping-npm-0.3.9-91625cd7fb-83deafb8e7.zip/node_modules/@jridgewell/trace-mapping/",\ "packageDependencies": [\ ["@jridgewell/trace-mapping", "npm:0.3.9"],\ - ["@jridgewell/resolve-uri", "npm:3.0.8"],\ + ["@jridgewell/resolve-uri", "npm:3.1.0"],\ ["@jridgewell/sourcemap-codec", "npm:1.4.14"]\ ],\ "linkType": "HARD"\ @@ -3883,8 +3700,8 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@npmcli/map-workspaces", "npm:2.0.1"],\ ["@npmcli/name-from-folder", "npm:1.0.1"],\ - ["glob", "npm:7.2.0"],\ - ["minimatch", "npm:5.0.0"],\ + ["glob", "npm:7.2.3"],\ + ["minimatch", "npm:5.1.6"],\ ["read-package-json-fast", "npm:2.0.3"]\ ],\ "linkType": "HARD"\ @@ -4005,7 +3822,7 @@ const RAW_RUNTIME_STATE = ["clean-stack", "npm:3.0.1"],\ ["cli-progress", "npm:3.12.0"],\ ["debug", "virtual:87db25c7c5e6b25bbc12571091cdabc648b79d427ab445d1714ccfdcdfb3265c9de6561ca760cc3de470037cbedf3af4be56ba3b684b3a1c01d4c9c2fd55a741#npm:4.3.4"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["get-package-type", "npm:0.1.0"],\ ["globby", "npm:11.1.0"],\ ["hyperlinker", "npm:1.0.0"],\ @@ -4019,7 +3836,7 @@ const RAW_RUNTIME_STATE = ["string-width", "npm:4.2.3"],\ ["strip-ansi", "npm:6.0.1"],\ ["supports-color", "npm:8.1.1"],\ - ["supports-hyperlinks", "npm:2.2.0"],\ + ["supports-hyperlinks", "npm:2.3.0"],\ ["ts-node", "virtual:ea55642553292d92df3b95679ce7d915309f63e183de810f329a0681dbf96348ae483bd374f89b77a6617494a51dc04338bed5fc7e9ba4255333eb598d1d96a6#npm:10.9.1"],\ ["tslib", "npm:2.6.2"],\ ["widest-line", "npm:3.1.0"],\ @@ -4039,7 +3856,7 @@ const RAW_RUNTIME_STATE = ["clean-stack", "npm:3.0.1"],\ ["cli-progress", "npm:3.12.0"],\ ["debug", "virtual:87db25c7c5e6b25bbc12571091cdabc648b79d427ab445d1714ccfdcdfb3265c9de6561ca760cc3de470037cbedf3af4be56ba3b684b3a1c01d4c9c2fd55a741#npm:4.3.4"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["get-package-type", "npm:0.1.0"],\ ["globby", "npm:11.1.0"],\ ["hyperlinker", "npm:1.0.0"],\ @@ -4053,13 +3870,48 @@ const RAW_RUNTIME_STATE = ["string-width", "npm:4.2.3"],\ ["strip-ansi", "npm:6.0.1"],\ ["supports-color", "npm:8.1.1"],\ - ["supports-hyperlinks", "npm:2.2.0"],\ + ["supports-hyperlinks", "npm:2.3.0"],\ ["tsconfck", "virtual:8f21c98bfcc042ba60b788a91928a322c2913836408eca0abbbf7e052098181701b9cf262c158a547725d8391dd3ff1a933d413944d0ea9e7f920b175a28a2e9#npm:3.0.0"],\ ["widest-line", "npm:3.1.0"],\ ["wordwrap", "npm:1.0.0"],\ ["wrap-ansi", "npm:7.0.0"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:3.26.5", {\ + "packageLocation": "./.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip/node_modules/@oclif/core/",\ + "packageDependencies": [\ + ["@oclif/core", "npm:3.26.5"],\ + ["@types/cli-progress", "npm:3.11.5"],\ + ["ansi-escapes", "npm:4.3.2"],\ + ["ansi-styles", "npm:4.3.0"],\ + ["cardinal", "npm:2.1.1"],\ + ["chalk", "npm:4.1.2"],\ + ["clean-stack", "npm:3.0.1"],\ + ["cli-progress", "npm:3.12.0"],\ + ["color", "npm:4.2.3"],\ + ["debug", "virtual:87db25c7c5e6b25bbc12571091cdabc648b79d427ab445d1714ccfdcdfb3265c9de6561ca760cc3de470037cbedf3af4be56ba3b684b3a1c01d4c9c2fd55a741#npm:4.3.4"],\ + ["ejs", "npm:3.1.10"],\ + ["get-package-type", "npm:0.1.0"],\ + ["globby", "npm:11.1.0"],\ + ["hyperlinker", "npm:1.0.0"],\ + ["indent-string", "npm:4.0.0"],\ + ["is-wsl", "npm:2.2.0"],\ + ["js-yaml", "npm:3.14.1"],\ + ["minimatch", "npm:9.0.4"],\ + ["natural-orderby", "npm:2.0.3"],\ + ["object-treeify", "npm:1.1.33"],\ + ["password-prompt", "npm:1.1.3"],\ + ["slice-ansi", "npm:4.0.0"],\ + ["string-width", "npm:4.2.3"],\ + ["strip-ansi", "npm:6.0.1"],\ + ["supports-color", "npm:8.1.1"],\ + ["supports-hyperlinks", "npm:2.3.0"],\ + ["widest-line", "npm:3.1.0"],\ + ["wordwrap", "npm:1.0.0"],\ + ["wrap-ansi", "npm:7.0.0"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["@oclif/plugin-help", [\ @@ -4668,7 +4520,7 @@ const RAW_RUNTIME_STATE = ["@types/cacheable-request", "npm:6.0.3"],\ ["@types/http-cache-semantics", "npm:4.0.4"],\ ["@types/keyv", "npm:3.1.4"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["@types/responselike", "npm:1.0.3"]\ ],\ "linkType": "HARD"\ @@ -4698,7 +4550,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-cli-progress-npm-3.11.5-180614d1b0-cb19187637.zip/node_modules/@types/cli-progress/",\ "packageDependencies": [\ ["@types/cli-progress", "npm:3.11.5"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -4708,7 +4560,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-connect-npm-3.4.35-7337eee0a3-fe81351470.zip/node_modules/@types/connect/",\ "packageDependencies": [\ ["@types/connect", "npm:3.4.35"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -4757,7 +4609,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@types/eslint", "npm:7.29.0"],\ ["@types/estree", "npm:0.0.51"],\ - ["@types/json-schema", "npm:7.0.11"]\ + ["@types/json-schema", "npm:7.0.15"]\ ],\ "linkType": "HARD"\ }],\ @@ -4766,7 +4618,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@types/eslint", "npm:8.2.0"],\ ["@types/estree", "npm:0.0.51"],\ - ["@types/json-schema", "npm:7.0.11"]\ + ["@types/json-schema", "npm:7.0.15"]\ ],\ "linkType": "HARD"\ }]\ @@ -4810,13 +4662,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@types/json-schema", [\ - ["npm:7.0.11", {\ - "packageLocation": "./.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip/node_modules/@types/json-schema/",\ - "packageDependencies": [\ - ["@types/json-schema", "npm:7.0.11"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.0.15", {\ "packageLocation": "./.yarn/cache/@types-json-schema-npm-7.0.15-fd16381786-1a3c3e0623.zip/node_modules/@types/json-schema/",\ "packageDependencies": [\ @@ -4830,7 +4675,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-keyv-npm-3.1.4-a8082ea56b-e009a2bfb5.zip/node_modules/@types/keyv/",\ "packageDependencies": [\ ["@types/keyv", "npm:3.1.4"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -4907,13 +4752,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:17.0.21", {\ - "packageLocation": "./.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip/node_modules/@types/node/",\ - "packageDependencies": [\ - ["@types/node", "npm:17.0.21"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:18.16.1", {\ "packageLocation": "./.yarn/cache/@types-node-npm-18.16.1-b36b37400b-d77a82fa40.zip/node_modules/@types/node/",\ "packageDependencies": [\ @@ -4936,19 +4774,12 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-responselike-npm-1.0.3-de0150f03d-6ac4b35723.zip/node_modules/@types/responselike/",\ "packageDependencies": [\ ["@types/responselike", "npm:1.0.3"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["@types/semver", [\ - ["npm:7.3.13", {\ - "packageLocation": "./.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip/node_modules/@types/semver/",\ - "packageDependencies": [\ - ["@types/semver", "npm:7.3.13"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.5.5", {\ "packageLocation": "./.yarn/cache/@types-semver-npm-7.5.5-a3c0668cf4-1b0be2c4d8.zip/node_modules/@types/semver/",\ "packageDependencies": [\ @@ -5010,7 +4841,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@types/vinyl", "npm:2.0.6"],\ ["@types/expect", "npm:1.20.4"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -5020,7 +4851,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-ws-npm-7.4.7-d0c95c0958-5236b6c548.zip/node_modules/@types/ws/",\ "packageDependencies": [\ ["@types/ws", "npm:7.4.7"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -5037,7 +4868,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/@typescript-eslint-eslint-plugin-virtual-0e22d802b6/0/cache/@typescript-eslint-eslint-plugin-npm-5.55.0-16386bf9af-05f921647a.zip/node_modules/@typescript-eslint/eslint-plugin/",\ "packageDependencies": [\ ["@typescript-eslint/eslint-plugin", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ - ["@eslint-community/regexpp", "npm:4.4.0"],\ + ["@eslint-community/regexpp", "npm:4.10.0"],\ ["@types/eslint", null],\ ["@types/typescript", null],\ ["@types/typescript-eslint__parser", null],\ @@ -5276,10 +5107,10 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/@typescript-eslint-utils-virtual-67e332304c/0/cache/@typescript-eslint-utils-npm-5.55.0-6a927fceb5-121c5fc48c.zip/node_modules/@typescript-eslint/utils/",\ "packageDependencies": [\ ["@typescript-eslint/utils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0"],\ - ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0"],\ + ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0"],\ ["@types/eslint", null],\ - ["@types/json-schema", "npm:7.0.11"],\ - ["@types/semver", "npm:7.3.13"],\ + ["@types/json-schema", "npm:7.0.15"],\ + ["@types/semver", "npm:7.5.5"],\ ["@typescript-eslint/scope-manager", "npm:5.55.0"],\ ["@typescript-eslint/types", "npm:5.55.0"],\ ["@typescript-eslint/typescript-estree", "virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:5.55.0"],\ @@ -5300,7 +5131,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@typescript-eslint/visitor-keys", "npm:5.55.0"],\ ["@typescript-eslint/types", "npm:5.55.0"],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ + ["eslint-visitor-keys", "npm:3.4.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -5746,7 +5577,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@yarnpkg/core", "npm:4.0.0-rc.42"],\ ["@arcanis/slice-ansi", "npm:1.1.1"],\ - ["@types/semver", "npm:7.3.13"],\ + ["@types/semver", "npm:7.5.5"],\ ["@types/treeify", "npm:1.0.0"],\ ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ ["@yarnpkg/libzip", "virtual:029d9f8b24f020bba83fc356b24f5023723ab955d802aced5e68f959eb98132b3549d03ae8c2d3187401d54ad86e275e1bf34740160f82184df9a09fcbeda7b4#npm:3.0.0-rc.42"],\ @@ -5765,10 +5596,10 @@ const RAW_RUNTIME_STATE = ["p-limit", "npm:2.3.0"],\ ["semver", "npm:7.5.3"],\ ["strip-ansi", "npm:6.0.1"],\ - ["tar", "npm:6.1.13"],\ + ["tar", "npm:6.2.1"],\ ["tinylogic", "npm:2.0.0"],\ ["treeify", "npm:1.1.0"],\ - ["tslib", "npm:2.5.0"],\ + ["tslib", "npm:2.6.2"],\ ["tunnel", "npm:0.0.6"]\ ],\ "linkType": "HARD"\ @@ -5779,7 +5610,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@yarnpkg-fslib-npm-3.0.0-rc.42-de16b926e6-a4e4b8453c.zip/node_modules/@yarnpkg/fslib/",\ "packageDependencies": [\ ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5799,7 +5630,7 @@ const RAW_RUNTIME_STATE = ["@types/emscripten", "npm:1.39.6"],\ ["@types/yarnpkg__fslib", null],\ ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "packagePeers": [\ "@types/yarnpkg__fslib",\ @@ -5826,7 +5657,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@yarnpkg/parsers", "npm:3.0.0-rc.42"],\ ["js-yaml", "npm:3.14.1"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5851,7 +5682,7 @@ const RAW_RUNTIME_STATE = ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ ["@yarnpkg/nm", "npm:4.0.0-rc.42"],\ ["clipanion", "virtual:ba24742e5bfaec41d1d0434e6865c2744ffb69a716f18fa84bd7d44084043647838926c96a391f66b9946857565b9825479e97ad07079ef40683084ce389d203#npm:3.2.0"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5868,7 +5699,7 @@ const RAW_RUNTIME_STATE = ["cross-spawn", "npm:7.0.3"],\ ["fast-glob", "npm:3.2.12"],\ ["micromatch", "npm:4.0.4"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5942,13 +5773,6 @@ const RAW_RUNTIME_STATE = ["acorn", "npm:8.11.2"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:8.8.2", {\ - "packageLocation": "./.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip/node_modules/acorn/",\ - "packageDependencies": [\ - ["acorn", "npm:8.8.2"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["acorn-import-assertions", [\ @@ -5964,7 +5788,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ ["@types/acorn", null],\ - ["acorn", "npm:8.8.2"]\ + ["acorn", "npm:8.11.2"]\ ],\ "packagePeers": [\ "@types/acorn",\ @@ -5993,19 +5817,6 @@ const RAW_RUNTIME_STATE = "acorn"\ ],\ "linkType": "HARD"\ - }],\ - ["virtual:fd2253859039a15030fecf2d1545fcad47d7bd43468b9166c71fdd4e35b538414e653775f5401c948ed8db3eb1925f84c66c161d39a27b19ee73fef5e721329e#npm:5.3.2", {\ - "packageLocation": "./.yarn/__virtual__/acorn-jsx-virtual-0c3ff7dbc9/0/cache/acorn-jsx-npm-5.3.2-d7594599ea-d4371eaef7.zip/node_modules/acorn-jsx/",\ - "packageDependencies": [\ - ["acorn-jsx", "virtual:fd2253859039a15030fecf2d1545fcad47d7bd43468b9166c71fdd4e35b538414e653775f5401c948ed8db3eb1925f84c66c161d39a27b19ee73fef5e721329e#npm:5.3.2"],\ - ["@types/acorn", null],\ - ["acorn", "npm:8.8.2"]\ - ],\ - "packagePeers": [\ - "@types/acorn",\ - "acorn"\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["acorn-walk", [\ @@ -6045,16 +5856,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["agentkeepalive", [\ - ["npm:4.2.0", {\ - "packageLocation": "./.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip/node_modules/agentkeepalive/",\ - "packageDependencies": [\ - ["agentkeepalive", "npm:4.2.0"],\ - ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["depd", "npm:1.1.2"],\ - ["humanize-ms", "npm:1.2.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:4.3.0", {\ "packageLocation": "./.yarn/cache/agentkeepalive-npm-4.3.0-ac3d8e6807-f791317eb4.zip/node_modules/agentkeepalive/",\ "packageDependencies": [\ @@ -6108,17 +5909,6 @@ const RAW_RUNTIME_STATE = ["uri-js", "npm:4.4.1"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:8.8.1", {\ - "packageLocation": "./.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip/node_modules/ajv/",\ - "packageDependencies": [\ - ["ajv", "npm:8.8.1"],\ - ["fast-deep-equal", "npm:3.1.3"],\ - ["json-schema-traverse", "npm:1.0.0"],\ - ["require-from-string", "npm:2.0.2"],\ - ["uri-js", "npm:4.4.1"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["ajv-formats", [\ @@ -6129,19 +5919,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:2.1.1", {\ - "packageLocation": "./.yarn/__virtual__/ajv-formats-virtual-26e397430a/0/cache/ajv-formats-npm-2.1.1-3cec02eae9-70c263ded2.zip/node_modules/ajv-formats/",\ - "packageDependencies": [\ - ["ajv-formats", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:2.1.1"],\ - ["@types/ajv", null],\ - ["ajv", "npm:8.8.1"]\ - ],\ - "packagePeers": [\ - "@types/ajv",\ - "ajv"\ - ],\ - "linkType": "HARD"\ - }],\ ["virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:2.1.1", {\ "packageLocation": "./.yarn/__virtual__/ajv-formats-virtual-39fabfe016/0/cache/ajv-formats-npm-2.1.1-3cec02eae9-70c263ded2.zip/node_modules/ajv-formats/",\ "packageDependencies": [\ @@ -6339,7 +6116,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["are-we-there-yet", "npm:2.0.0"],\ ["delegates", "npm:1.0.0"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -6375,7 +6152,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array-buffer-byte-length-npm-1.0.0-331671f28a-044e101ce1.zip/node_modules/array-buffer-byte-length/",\ "packageDependencies": [\ ["array-buffer-byte-length", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["is-array-buffer", "npm:3.0.2"]\ ],\ "linkType": "HARD"\ @@ -6404,7 +6181,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array-includes-npm-3.1.7-d32a5ee179-856a8be5d1.zip/node_modules/array-includes/",\ "packageDependencies": [\ ["array-includes", "npm:3.1.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["get-intrinsic", "npm:1.2.2"],\ @@ -6427,7 +6204,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array.prototype.findlastindex-npm-1.2.3-2a36f4417b-063cbab8ee.zip/node_modules/array.prototype.findlastindex/",\ "packageDependencies": [\ ["array.prototype.findlastindex", "npm:1.2.3"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["es-shim-unscopables", "npm:1.0.2"],\ @@ -6441,7 +6218,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array.prototype.flat-npm-1.3.2-350729f7f4-d9d2f6f275.zip/node_modules/array.prototype.flat/",\ "packageDependencies": [\ ["array.prototype.flat", "npm:1.3.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["es-shim-unscopables", "npm:1.0.2"]\ @@ -6454,7 +6231,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array.prototype.flatmap-npm-1.3.2-5c6a4af226-33f2000668.zip/node_modules/array.prototype.flatmap/",\ "packageDependencies": [\ ["array.prototype.flatmap", "npm:1.3.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["es-shim-unscopables", "npm:1.0.2"]\ @@ -6468,7 +6245,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["arraybuffer.prototype.slice", "npm:1.0.2"],\ ["array-buffer-byte-length", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["get-intrinsic", "npm:1.2.2"],\ @@ -6620,7 +6397,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["awilix", "npm:4.3.4"],\ ["camel-case", "npm:4.1.2"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -6656,14 +6433,14 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/babel-eslint-virtual-ff1372ed3f/0/cache/babel-eslint-npm-10.1.0-6a6d2b1533-dc5dd948f8.zip/node_modules/babel-eslint/",\ "packageDependencies": [\ ["babel-eslint", "virtual:27dae49067a60fa65fec6e1c3adad1497d0dda3f71eda711624109131ff3b7d1061a20f55e89b5a0a219da1f7a0a1a0a76bc414d36870315bd60acf5bdcb7f55#npm:10.1.0"],\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/traverse", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"],\ + ["@babel/code-frame", "npm:7.22.13"],\ + ["@babel/parser", "npm:7.23.3"],\ + ["@babel/traverse", "npm:7.23.3"],\ + ["@babel/types", "npm:7.23.3"],\ ["@types/eslint", null],\ ["eslint", "npm:8.53.0"],\ ["eslint-visitor-keys", "npm:1.3.0"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -6906,7 +6683,7 @@ const RAW_RUNTIME_STATE = ["bl", "npm:4.1.0"],\ ["buffer", "npm:5.7.1"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -7093,18 +6870,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["browserslist", [\ - ["npm:4.18.1", {\ - "packageLocation": "./.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip/node_modules/browserslist/",\ - "packageDependencies": [\ - ["browserslist", "npm:4.18.1"],\ - ["caniuse-lite", "npm:1.0.30001282"],\ - ["electron-to-chromium", "npm:1.3.903"],\ - ["escalade", "npm:3.1.1"],\ - ["node-releases", "npm:2.0.1"],\ - ["picocolors", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:4.22.1", {\ "packageLocation": "./.yarn/cache/browserslist-npm-4.22.1-cccae6d74e-4a515168e0.zip/node_modules/browserslist/",\ "packageDependencies": [\ @@ -7255,7 +7020,7 @@ const RAW_RUNTIME_STATE = ["cacache", "npm:18.0.0"],\ ["@npmcli/fs", "npm:3.1.0"],\ ["fs-minipass", "npm:3.0.3"],\ - ["glob", "npm:10.3.10"],\ + ["glob", "npm:10.4.1"],\ ["lru-cache", "npm:10.0.2"],\ ["minipass", "npm:7.0.4"],\ ["minipass-collect", "npm:1.0.2"],\ @@ -7263,7 +7028,7 @@ const RAW_RUNTIME_STATE = ["minipass-pipeline", "npm:1.2.4"],\ ["p-map", "npm:4.0.0"],\ ["ssri", "npm:10.0.5"],\ - ["tar", "npm:6.1.13"],\ + ["tar", "npm:6.2.1"],\ ["unique-filename", "npm:3.0.0"]\ ],\ "linkType": "HARD"\ @@ -7329,15 +7094,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["call-bind", [\ - ["npm:1.0.2", {\ - "packageLocation": "./.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip/node_modules/call-bind/",\ - "packageDependencies": [\ - ["call-bind", "npm:1.0.2"],\ - ["function-bind", "npm:1.1.1"],\ - ["get-intrinsic", "npm:1.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.5", {\ "packageLocation": "./.yarn/cache/call-bind-npm-1.0.5-65600fae47-246d44db6e.zip/node_modules/call-bind/",\ "packageDependencies": [\ @@ -7373,7 +7129,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["camel-case", "npm:4.1.2"],\ ["pascal-case", "npm:3.1.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -7407,13 +7163,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["caniuse-lite", [\ - ["npm:1.0.30001282", {\ - "packageLocation": "./.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip/node_modules/caniuse-lite/",\ - "packageDependencies": [\ - ["caniuse-lite", "npm:1.0.30001282"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.30001561", {\ "packageLocation": "./.yarn/cache/caniuse-lite-npm-1.0.30001561-b213ca8bce-94cfc8454c.zip/node_modules/caniuse-lite/",\ "packageDependencies": [\ @@ -7428,7 +7177,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["capital-case", "npm:1.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"],\ + ["tslib", "npm:2.6.2"],\ ["upper-case-first", "npm:2.0.2"]\ ],\ "linkType": "HARD"\ @@ -7485,7 +7234,7 @@ const RAW_RUNTIME_STATE = ["chai-as-promised", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:7.1.1"],\ ["@types/chai", "npm:4.2.22"],\ ["chai", "npm:4.3.10"],\ - ["check-error", "npm:1.0.2"]\ + ["check-error", "npm:1.0.3"]\ ],\ "packagePeers": [\ "@types/chai",\ @@ -7499,7 +7248,7 @@ const RAW_RUNTIME_STATE = ["chai-as-promised", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:7.1.1"],\ ["@types/chai", null],\ ["chai", "npm:4.3.10"],\ - ["check-error", "npm:1.0.2"]\ + ["check-error", "npm:1.0.3"]\ ],\ "packagePeers": [\ "@types/chai",\ @@ -7615,7 +7364,7 @@ const RAW_RUNTIME_STATE = ["path-case", "npm:3.0.4"],\ ["sentence-case", "npm:3.0.4"],\ ["snake-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -7630,13 +7379,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["check-error", [\ - ["npm:1.0.2", {\ - "packageLocation": "./.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip/node_modules/check-error/",\ - "packageDependencies": [\ - ["check-error", "npm:1.0.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.3", {\ "packageLocation": "./.yarn/cache/check-error-npm-1.0.3-137994eabc-e2131025cf.zip/node_modules/check-error/",\ "packageDependencies": [\ @@ -7931,6 +7673,15 @@ const RAW_RUNTIME_STATE = ["color-string", "npm:1.6.0"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:4.2.3", {\ + "packageLocation": "./.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip/node_modules/color/",\ + "packageDependencies": [\ + ["color", "npm:4.2.3"],\ + ["color-convert", "npm:2.0.1"],\ + ["color-string", "npm:1.9.1"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["color-convert", [\ @@ -7976,6 +7727,15 @@ const RAW_RUNTIME_STATE = ["simple-swizzle", "npm:0.2.2"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.9.1", {\ + "packageLocation": "./.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip/node_modules/color-string/",\ + "packageDependencies": [\ + ["color-string", "npm:1.9.1"],\ + ["color-name", "npm:1.1.4"],\ + ["simple-swizzle", "npm:0.2.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["color-support", [\ @@ -7988,13 +7748,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["colorette", [\ - ["npm:2.0.19", {\ - "packageLocation": "./.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip/node_modules/colorette/",\ - "packageDependencies": [\ - ["colorette", "npm:2.0.19"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.0.20", {\ "packageLocation": "./.yarn/cache/colorette-npm-2.0.20-692d428726-0b8de48bfa.zip/node_modules/colorette/",\ "packageDependencies": [\ @@ -8186,7 +7939,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["constant-case", "npm:3.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"],\ + ["tslib", "npm:2.6.2"],\ ["upper-case", "npm:2.0.2"]\ ],\ "linkType": "HARD"\ @@ -8625,13 +8378,14 @@ const RAW_RUNTIME_STATE = ["@dashevo/bls", "npm:1.2.9"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ ["@dashevo/dapi-grpc", "workspace:packages/dapi-grpc"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ ["@dashevo/dashpay-contract", "workspace:packages/dashpay-contract"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/masternode-reward-shares-contract", "workspace:packages/masternode-reward-shares-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ + ["@dashevo/withdrawals-contract", "workspace:packages/withdrawals-contract"],\ ["@types/chai", "npm:4.2.22"],\ ["@types/dirty-chai", "npm:2.0.2"],\ ["@types/mocha", "npm:8.2.3"],\ @@ -8657,7 +8411,7 @@ const RAW_RUNTIME_STATE = ["eslint-plugin-import", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.29.0"],\ ["events", "npm:3.3.0"],\ ["https-browserify", "npm:1.0.0"],\ - ["karma", "npm:6.4.1"],\ + ["karma", "npm:6.4.3"],\ ["karma-chai", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:0.1.0"],\ ["karma-chrome-launcher", "npm:3.1.0"],\ ["karma-firefox-launcher", "npm:2.1.2"],\ @@ -8682,7 +8436,7 @@ const RAW_RUNTIME_STATE = ["ts-loader", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:9.5.0"],\ ["ts-mocha", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.0.0"],\ ["ts-mock-imports", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:1.3.8"],\ - ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.4.0"],\ + ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.9.1"],\ ["tsd", "npm:0.28.1"],\ ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=3bd3d3"],\ ["url", "npm:0.11.3"],\ @@ -8700,28 +8454,27 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["dashmate", "workspace:packages/dashmate"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/eslint-parser", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:7.23.3"],\ + ["@babel/eslint-parser", "virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3"],\ ["@dashevo/bls", "npm:1.2.9"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ - ["@dashevo/dashd-rpc", "npm:18.2.0"],\ - ["@dashevo/dashpay-contract", "workspace:packages/dashpay-contract"],\ + ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ + ["@dashevo/dashcore-lib", "npm:0.21.3"],\ + ["@dashevo/dashd-rpc", "npm:19.0.0"],\ ["@dashevo/docker-compose", "npm:0.24.4"],\ - ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ - ["@dashevo/feature-flags-contract", "workspace:packages/feature-flags-contract"],\ - ["@dashevo/masternode-reward-shares-contract", "workspace:packages/masternode-reward-shares-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/withdrawals-contract", "workspace:packages/withdrawals-contract"],\ - ["@oclif/core", "npm:3.10.8"],\ + ["@oclif/core", "npm:3.26.5"],\ ["@oclif/plugin-help", "npm:6.0.5"],\ - ["ajv", "npm:8.8.1"],\ - ["ajv-formats", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:2.1.1"],\ + ["ajv", "npm:8.12.0"],\ + ["ajv-formats", "virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:2.1.1"],\ ["awilix", "npm:4.3.4"],\ ["begoo", "npm:2.0.2"],\ + ["bs58", "npm:4.0.1"],\ ["chai", "npm:4.3.10"],\ ["chai-as-promised", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:7.1.1"],\ ["chalk", "npm:4.1.2"],\ ["cron", "npm:2.1.0"],\ ["dirty-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:2.0.1"],\ + ["diskusage", "npm:1.2.0"],\ ["dockerode", "npm:3.3.5"],\ ["dot", "npm:1.1.3"],\ ["dotenv", "npm:8.6.0"],\ @@ -8729,7 +8482,7 @@ const RAW_RUNTIME_STATE = ["eslint", "npm:8.53.0"],\ ["eslint-config-airbnb-base", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:15.0.0"],\ ["eslint-plugin-import", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:2.29.0"],\ - ["glob", "npm:10.3.4"],\ + ["glob", "npm:10.4.1"],\ ["globby", "npm:11.1.0"],\ ["hasbin", "npm:1.2.3"],\ ["is-wsl", "npm:2.2.0"],\ @@ -8751,6 +8504,7 @@ const RAW_RUNTIME_STATE = ["semver", "npm:7.5.3"],\ ["sinon", "npm:17.0.1"],\ ["sinon-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:3.7.0"],\ + ["systeminformation", "npm:5.22.11"],\ ["table", "npm:6.8.1"],\ ["wrap-ansi", "npm:7.0.0"]\ ],\ @@ -8811,6 +8565,13 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ + ["npm:4.3.5", {\ + "packageLocation": "./.yarn/cache/debug-npm-4.3.5-b5001f59b7-cb6eab424c.zip/node_modules/debug/",\ + "packageDependencies": [\ + ["debug", "npm:4.3.5"]\ + ],\ + "linkType": "SOFT"\ + }],\ ["virtual:2a426afc4b2eef43db12a540d29c2b5476640459bfcd5c24f86bb401cf8cce97e63bd81794d206a5643057e7f662643afd5ce3dfc4d4bfd8e706006c6309c5fa#npm:3.2.7", {\ "packageLocation": "./.yarn/__virtual__/debug-virtual-d2345003b7/0/cache/debug-npm-3.2.7-754e818c7a-d86fd7be2b.zip/node_modules/debug/",\ "packageDependencies": [\ @@ -8867,6 +8628,20 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ + ["virtual:7a0505537f63825f62aaaf982168c2b7c1e816756656d44af98202b8d07990e163024e7dadf5587aa11d691887401ca8792ff06467da4d479c747705c9e87544#npm:4.3.5", {\ + "packageLocation": "./.yarn/__virtual__/debug-virtual-e443f3d004/0/cache/debug-npm-4.3.5-b5001f59b7-cb6eab424c.zip/node_modules/debug/",\ + "packageDependencies": [\ + ["debug", "virtual:7a0505537f63825f62aaaf982168c2b7c1e816756656d44af98202b8d07990e163024e7dadf5587aa11d691887401ca8792ff06467da4d479c747705c9e87544#npm:4.3.5"],\ + ["@types/supports-color", null],\ + ["ms", "npm:2.1.2"],\ + ["supports-color", null]\ + ],\ + "packagePeers": [\ + "@types/supports-color",\ + "supports-color"\ + ],\ + "linkType": "HARD"\ + }],\ ["virtual:87db25c7c5e6b25bbc12571091cdabc648b79d427ab445d1714ccfdcdfb3265c9de6561ca760cc3de470037cbedf3af4be56ba3b684b3a1c01d4c9c2fd55a741#npm:4.3.4", {\ "packageLocation": "./.yarn/__virtual__/debug-virtual-762d08cbe9/0/cache/debug-npm-4.3.4-4513954577-0073c3bcbd.zip/node_modules/debug/",\ "packageDependencies": [\ @@ -9032,15 +8807,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["define-properties", [\ - ["npm:1.2.0", {\ - "packageLocation": "./.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip/node_modules/define-properties/",\ - "packageDependencies": [\ - ["define-properties", "npm:1.2.0"],\ - ["has-property-descriptors", "npm:1.0.0"],\ - ["object-keys", "npm:1.1.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.2.1", {\ "packageLocation": "./.yarn/cache/define-properties-npm-1.2.1-8a4d42413b-b4ccd00597.zip/node_modules/define-properties/",\ "packageDependencies": [\ @@ -9231,6 +8997,18 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["diskusage", [\ + ["npm:1.2.0", {\ + "packageLocation": "./.yarn/unplugged/diskusage-npm-1.2.0-3d0577ad86/node_modules/diskusage/",\ + "packageDependencies": [\ + ["diskusage", "npm:1.2.0"],\ + ["es6-promise", "npm:4.2.8"],\ + ["nan", "npm:2.20.0"],\ + ["node-gyp", "npm:10.0.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["dns-packet", [\ ["npm:5.4.0", {\ "packageLocation": "./.yarn/cache/dns-packet-npm-5.4.0-4d0332a163-6a3827d59a.zip/node_modules/dns-packet/",\ @@ -9257,7 +9035,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["docker-modem", "npm:3.0.8"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["split-ca", "npm:1.0.1"],\ ["ssh2", "npm:1.11.0"]\ ],\ @@ -9322,7 +9100,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["dot-case", "npm:3.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -9384,23 +9162,16 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["ejs", [\ - ["npm:3.1.8", {\ - "packageLocation": "./.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip/node_modules/ejs/",\ + ["npm:3.1.10", {\ + "packageLocation": "./.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip/node_modules/ejs/",\ "packageDependencies": [\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["jake", "npm:10.8.5"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["electron-to-chromium", [\ - ["npm:1.3.903", {\ - "packageLocation": "./.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip/node_modules/electron-to-chromium/",\ - "packageDependencies": [\ - ["electron-to-chromium", "npm:1.3.903"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.4.581", {\ "packageLocation": "./.yarn/cache/electron-to-chromium-npm-1.4.581-a32b5f3c64-a40ea2863c.zip/node_modules/electron-to-chromium/",\ "packageDependencies": [\ @@ -9486,14 +9257,14 @@ const RAW_RUNTIME_STATE = ["engine.io", "npm:6.4.2"],\ ["@types/cookie", "npm:0.4.1"],\ ["@types/cors", "npm:2.8.12"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["accepts", "npm:1.3.7"],\ ["base64id", "npm:2.0.0"],\ ["cookie", "npm:0.4.1"],\ ["cors", "npm:2.8.5"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ ["engine.io-parser", "npm:5.0.4"],\ - ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.11.0"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -9508,15 +9279,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["enhanced-resolve", [\ - ["npm:5.12.0", {\ - "packageLocation": "./.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip/node_modules/enhanced-resolve/",\ - "packageDependencies": [\ - ["enhanced-resolve", "npm:5.12.0"],\ - ["graceful-fs", "npm:4.2.10"],\ - ["tapable", "npm:2.2.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:5.15.0", {\ "packageLocation": "./.yarn/cache/enhanced-resolve-npm-5.15.0-16eb7ddef9-180c3f2706.zip/node_modules/enhanced-resolve/",\ "packageDependencies": [\ @@ -9603,47 +9365,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["es-abstract", [\ - ["npm:1.21.2", {\ - "packageLocation": "./.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip/node_modules/es-abstract/",\ - "packageDependencies": [\ - ["es-abstract", "npm:1.21.2"],\ - ["array-buffer-byte-length", "npm:1.0.0"],\ - ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["es-set-tostringtag", "npm:2.0.1"],\ - ["es-to-primitive", "npm:1.2.1"],\ - ["function.prototype.name", "npm:1.1.5"],\ - ["get-intrinsic", "npm:1.2.0"],\ - ["get-symbol-description", "npm:1.0.0"],\ - ["globalthis", "npm:1.0.3"],\ - ["gopd", "npm:1.0.1"],\ - ["has", "npm:1.0.3"],\ - ["has-property-descriptors", "npm:1.0.0"],\ - ["has-proto", "npm:1.0.1"],\ - ["has-symbols", "npm:1.0.3"],\ - ["internal-slot", "npm:1.0.5"],\ - ["is-array-buffer", "npm:3.0.2"],\ - ["is-callable", "npm:1.2.7"],\ - ["is-negative-zero", "npm:2.0.2"],\ - ["is-regex", "npm:1.1.4"],\ - ["is-shared-array-buffer", "npm:1.0.2"],\ - ["is-string", "npm:1.0.7"],\ - ["is-typed-array", "npm:1.1.10"],\ - ["is-weakref", "npm:1.0.2"],\ - ["object-inspect", "npm:1.12.3"],\ - ["object-keys", "npm:1.1.1"],\ - ["object.assign", "npm:4.1.4"],\ - ["regexp.prototype.flags", "npm:1.4.3"],\ - ["safe-regex-test", "npm:1.0.0"],\ - ["string.prototype.trim", "npm:1.2.7"],\ - ["string.prototype.trimend", "npm:1.0.6"],\ - ["string.prototype.trimstart", "npm:1.0.6"],\ - ["typed-array-length", "npm:1.0.4"],\ - ["unbox-primitive", "npm:1.0.2"],\ - ["which-typed-array", "npm:1.1.9"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.22.3", {\ "packageLocation": "./.yarn/cache/es-abstract-npm-1.22.3-15a58832e5-e1ea9738ec.zip/node_modules/es-abstract/",\ "packageDependencies": [\ @@ -9705,7 +9426,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/es-set-tostringtag-npm-2.0.1-c87b5de872-ec416a1294.zip/node_modules/es-set-tostringtag/",\ "packageDependencies": [\ ["es-set-tostringtag", "npm:2.0.1"],\ - ["get-intrinsic", "npm:1.2.0"],\ + ["get-intrinsic", "npm:1.2.2"],\ ["has", "npm:1.0.3"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ @@ -9840,7 +9561,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/eslint-npm-8.53.0-2fc5c501d2-e305a71ce2.zip/node_modules/eslint/",\ "packageDependencies": [\ ["eslint", "npm:8.53.0"],\ - ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0"],\ + ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0"],\ ["@eslint-community/regexpp", "npm:4.10.0"],\ ["@eslint/eslintrc", "npm:2.1.3"],\ ["@eslint/js", "npm:8.53.0"],\ @@ -10259,13 +9980,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:3.3.0", {\ - "packageLocation": "./.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip/node_modules/eslint-visitor-keys/",\ - "packageDependencies": [\ - ["eslint-visitor-keys", "npm:3.3.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.4.3", {\ "packageLocation": "./.yarn/cache/eslint-visitor-keys-npm-3.4.3-a356ac7e46-3f357c554a.zip/node_modules/eslint-visitor-keys/",\ "packageDependencies": [\ @@ -10275,16 +9989,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["espree", [\ - ["npm:9.1.0", {\ - "packageLocation": "./.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip/node_modules/espree/",\ - "packageDependencies": [\ - ["espree", "npm:9.1.0"],\ - ["acorn", "npm:8.8.2"],\ - ["acorn-jsx", "virtual:fd2253859039a15030fecf2d1545fcad47d7bd43468b9166c71fdd4e35b538414e653775f5401c948ed8db3eb1925f84c66c161d39a27b19ee73fef5e721329e#npm:5.3.2"],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:9.6.1", {\ "packageLocation": "./.yarn/cache/espree-npm-9.6.1-a50722a5a9-255ab260f0.zip/node_modules/espree/",\ "packageDependencies": [\ @@ -10472,18 +10176,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["fast-glob", [\ - ["npm:3.2.11", {\ - "packageLocation": "./.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip/node_modules/fast-glob/",\ - "packageDependencies": [\ - ["fast-glob", "npm:3.2.11"],\ - ["@nodelib/fs.stat", "npm:2.0.5"],\ - ["@nodelib/fs.walk", "npm:1.2.8"],\ - ["glob-parent", "npm:5.1.2"],\ - ["merge2", "npm:1.4.1"],\ - ["micromatch", "npm:4.0.4"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.2.12", {\ "packageLocation": "./.yarn/cache/fast-glob-npm-3.2.12-162763bbae-641e748664.zip/node_modules/fast-glob/",\ "packageDependencies": [\ @@ -10771,17 +10463,17 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["follow-redirects", [\ - ["npm:1.15.2", {\ - "packageLocation": "./.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip/node_modules/follow-redirects/",\ + ["npm:1.15.6", {\ + "packageLocation": "./.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip/node_modules/follow-redirects/",\ "packageDependencies": [\ - ["follow-redirects", "npm:1.15.2"]\ + ["follow-redirects", "npm:1.15.6"]\ ],\ "linkType": "SOFT"\ }],\ - ["virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.2", {\ - "packageLocation": "./.yarn/__virtual__/follow-redirects-virtual-2696a91c1b/0/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip/node_modules/follow-redirects/",\ + ["virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.6", {\ + "packageLocation": "./.yarn/__virtual__/follow-redirects-virtual-23ff1601e1/0/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip/node_modules/follow-redirects/",\ "packageDependencies": [\ - ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.2"],\ + ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.6"],\ ["@types/debug", null],\ ["debug", null]\ ],\ @@ -10926,13 +10618,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["function-bind", [\ - ["npm:1.1.1", {\ - "packageLocation": "./.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip/node_modules/function-bind/",\ - "packageDependencies": [\ - ["function-bind", "npm:1.1.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.1.2", {\ "packageLocation": "./.yarn/cache/function-bind-npm-1.1.2-7a55be9b03-185e20d20f.zip/node_modules/function-bind/",\ "packageDependencies": [\ @@ -10942,22 +10627,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["function.prototype.name", [\ - ["npm:1.1.5", {\ - "packageLocation": "./.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip/node_modules/function.prototype.name/",\ - "packageDependencies": [\ - ["function.prototype.name", "npm:1.1.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"],\ - ["functions-have-names", "npm:1.2.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.1.6", {\ "packageLocation": "./.yarn/cache/function.prototype.name-npm-1.1.6-fd3a6a5cdd-4d40be44d4.zip/node_modules/function.prototype.name/",\ "packageDependencies": [\ ["function.prototype.name", "npm:1.1.6"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["functions-have-names", "npm:1.2.3"]\ @@ -11029,16 +10703,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["get-intrinsic", [\ - ["npm:1.2.0", {\ - "packageLocation": "./.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip/node_modules/get-intrinsic/",\ - "packageDependencies": [\ - ["get-intrinsic", "npm:1.2.0"],\ - ["function-bind", "npm:1.1.1"],\ - ["has", "npm:1.0.3"],\ - ["has-symbols", "npm:1.0.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.2.2", {\ "packageLocation": "./.yarn/cache/get-intrinsic-npm-1.2.2-3f446d8847-aa96db4f80.zip/node_modules/get-intrinsic/",\ "packageDependencies": [\ @@ -11104,8 +10768,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/get-symbol-description-npm-1.0.0-9c95a4bc1f-7e5f298afe.zip/node_modules/get-symbol-description/",\ "packageDependencies": [\ ["get-symbol-description", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"]\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11176,27 +10840,15 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["glob", [\ - ["npm:10.3.10", {\ - "packageLocation": "./.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip/node_modules/glob/",\ - "packageDependencies": [\ - ["glob", "npm:10.3.10"],\ - ["foreground-child", "npm:3.1.1"],\ - ["jackspeak", "npm:2.3.6"],\ - ["minimatch", "npm:9.0.3"],\ - ["minipass", "npm:7.0.3"],\ - ["path-scurry", "npm:1.10.1"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:10.3.4", {\ - "packageLocation": "./.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip/node_modules/glob/",\ + ["npm:10.4.1", {\ + "packageLocation": "./.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip/node_modules/glob/",\ "packageDependencies": [\ - ["glob", "npm:10.3.4"],\ + ["glob", "npm:10.4.1"],\ ["foreground-child", "npm:3.1.1"],\ - ["jackspeak", "npm:2.3.3"],\ - ["minimatch", "npm:9.0.3"],\ - ["minipass", "npm:7.0.3"],\ - ["path-scurry", "npm:1.10.1"]\ + ["jackspeak", "npm:3.1.2"],\ + ["minimatch", "npm:9.0.4"],\ + ["minipass", "npm:7.1.2"],\ + ["path-scurry", "npm:1.11.1"]\ ],\ "linkType": "HARD"\ }],\ @@ -11226,6 +10878,19 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ + ["npm:7.2.3", {\ + "packageLocation": "./.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip/node_modules/glob/",\ + "packageDependencies": [\ + ["glob", "npm:7.2.3"],\ + ["fs.realpath", "npm:1.0.0"],\ + ["inflight", "npm:1.0.6"],\ + ["inherits", "npm:2.0.4"],\ + ["minimatch", "npm:3.1.2"],\ + ["once", "npm:1.4.0"],\ + ["path-is-absolute", "npm:1.0.1"]\ + ],\ + "linkType": "HARD"\ + }],\ ["npm:8.1.0", {\ "packageLocation": "./.yarn/cache/glob-npm-8.1.0-65f64af8b1-9aab1c75eb.zip/node_modules/glob/",\ "packageDependencies": [\ @@ -11288,7 +10953,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/globalthis-npm-1.0.3-96cd56020d-45ae2f3b40.zip/node_modules/globalthis/",\ "packageDependencies": [\ ["globalthis", "npm:1.0.3"],\ - ["define-properties", "npm:1.2.0"]\ + ["define-properties", "npm:1.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -11300,7 +10965,7 @@ const RAW_RUNTIME_STATE = ["globby", "npm:11.1.0"],\ ["array-union", "npm:2.1.0"],\ ["dir-glob", "npm:3.0.1"],\ - ["fast-glob", "npm:3.2.11"],\ + ["fast-glob", "npm:3.2.12"],\ ["ignore", "npm:5.2.0"],\ ["merge2", "npm:1.4.1"],\ ["slash", "npm:3.0.0"]\ @@ -11331,7 +10996,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/gopd-npm-1.0.1-10c1d0b534-5fbc7ad57b.zip/node_modules/gopd/",\ "packageDependencies": [\ ["gopd", "npm:1.0.1"],\ - ["get-intrinsic", "npm:1.2.0"]\ + ["get-intrinsic", "npm:1.2.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11447,7 +11112,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/has-npm-1.0.3-b7f00631c1-a449f3185b.zip/node_modules/has/",\ "packageDependencies": [\ ["has", "npm:1.0.3"],\ - ["function-bind", "npm:1.1.1"]\ + ["function-bind", "npm:1.1.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11482,7 +11147,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/has-property-descriptors-npm-1.0.0-56289b918d-a6d3f0a266.zip/node_modules/has-property-descriptors/",\ "packageDependencies": [\ ["has-property-descriptors", "npm:1.0.0"],\ - ["get-intrinsic", "npm:1.2.0"]\ + ["get-intrinsic", "npm:1.2.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11540,7 +11205,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["hash-base", "npm:3.1.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["safe-buffer", "npm:5.2.1"]\ ],\ "linkType": "HARD"\ @@ -11593,7 +11258,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["header-case", "npm:2.0.4"],\ ["capital-case", "npm:1.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11604,7 +11269,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["help-me", "npm:4.2.0"],\ ["glob", "npm:8.1.0"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11699,7 +11364,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["http-proxy", "npm:1.18.1"],\ ["eventemitter3", "npm:4.0.7"],\ - ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.2"],\ + ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.6"],\ ["requires-port", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12010,7 +11675,7 @@ const RAW_RUNTIME_STATE = ["mute-stream", "npm:0.0.8"],\ ["ora", "npm:5.4.1"],\ ["run-async", "npm:2.4.1"],\ - ["rxjs", "npm:7.8.0"],\ + ["rxjs", "npm:7.8.1"],\ ["string-width", "npm:4.2.3"],\ ["strip-ansi", "npm:6.0.1"],\ ["through", "npm:2.3.8"]\ @@ -12023,7 +11688,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/internal-slot-npm-1.0.5-a2241f3e66-e2eb5b348e.zip/node_modules/internal-slot/",\ "packageDependencies": [\ ["internal-slot", "npm:1.0.5"],\ - ["get-intrinsic", "npm:1.2.0"],\ + ["get-intrinsic", "npm:1.2.2"],\ ["has", "npm:1.0.3"],\ ["side-channel", "npm:1.0.4"]\ ],\ @@ -12046,18 +11711,13 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["ip", [\ - ["npm:1.1.5", {\ - "packageLocation": "./.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip/node_modules/ip/",\ + ["ip-address", [\ + ["npm:9.0.5", {\ + "packageLocation": "./.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip/node_modules/ip-address/",\ "packageDependencies": [\ - ["ip", "npm:1.1.5"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.0.0", {\ - "packageLocation": "./.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip/node_modules/ip/",\ - "packageDependencies": [\ - ["ip", "npm:2.0.0"]\ + ["ip-address", "npm:9.0.5"],\ + ["jsbn", "npm:1.1.0"],\ + ["sprintf-js", "npm:1.1.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -12085,7 +11745,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-arguments-npm-1.1.1-eff4f6d4d7-a170c7e260.zip/node_modules/is-arguments/",\ "packageDependencies": [\ ["is-arguments", "npm:1.1.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12096,9 +11756,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-array-buffer-npm-3.0.2-0dec897785-dcac9dda66.zip/node_modules/is-array-buffer/",\ "packageDependencies": [\ ["is-array-buffer", "npm:3.0.2"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"],\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -12144,7 +11804,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-boolean-object-npm-1.1.2-ecbd575e6a-ba794223b5.zip/node_modules/is-boolean-object/",\ "packageDependencies": [\ ["is-boolean-object", "npm:1.1.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12177,14 +11837,6 @@ const RAW_RUNTIME_STATE = ["hasown", "npm:2.0.0"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:2.8.1", {\ - "packageLocation": "./.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip/node_modules/is-core-module/",\ - "packageDependencies": [\ - ["is-core-module", "npm:2.8.1"],\ - ["has", "npm:1.0.3"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["is-date-object", [\ @@ -12277,8 +11929,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-nan-npm-1.3.2-a087d31a28-1f784d3472.zip/node_modules/is-nan/",\ "packageDependencies": [\ ["is-nan", "npm:1.3.2"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"]\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -12367,7 +12019,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-regex-npm-1.1.4-cca193ef11-36d9174d16.zip/node_modules/is-regex/",\ "packageDependencies": [\ ["is-regex", "npm:1.1.4"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12397,7 +12049,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-shared-array-buffer-npm-1.0.2-32e4181fcd-23d82259d6.zip/node_modules/is-shared-array-buffer/",\ "packageDependencies": [\ ["is-shared-array-buffer", "npm:1.0.2"],\ - ["call-bind", "npm:1.0.2"]\ + ["call-bind", "npm:1.0.5"]\ ],\ "linkType": "HARD"\ }]\ @@ -12442,18 +12094,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["is-typed-array", [\ - ["npm:1.1.10", {\ - "packageLocation": "./.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip/node_modules/is-typed-array/",\ - "packageDependencies": [\ - ["is-typed-array", "npm:1.1.10"],\ - ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["for-each", "npm:0.3.3"],\ - ["gopd", "npm:1.0.1"],\ - ["has-tostringtag", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.1.12", {\ "packageLocation": "./.yarn/cache/is-typed-array-npm-1.1.12-6135c91b1a-d953adfd3c.zip/node_modules/is-typed-array/",\ "packageDependencies": [\ @@ -12495,7 +12135,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-weakref-npm-1.0.2-ff80e8c314-0023fd0e4b.zip/node_modules/is-weakref/",\ "packageDependencies": [\ ["is-weakref", "npm:1.0.2"],\ - ["call-bind", "npm:1.0.2"]\ + ["call-bind", "npm:1.0.5"]\ ],\ "linkType": "HARD"\ }]\ @@ -12596,7 +12236,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["isomorphic-ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:4.0.1"],\ ["@types/ws", "npm:7.4.7"],\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "packagePeers": [\ "@types/ws",\ @@ -12606,13 +12246,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["istanbul-lib-coverage", [\ - ["npm:3.2.0", {\ - "packageLocation": "./.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip/node_modules/istanbul-lib-coverage/",\ - "packageDependencies": [\ - ["istanbul-lib-coverage", "npm:3.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.2.2", {\ "packageLocation": "./.yarn/cache/istanbul-lib-coverage-npm-3.2.2-5c0526e059-40bbdd1e93.zip/node_modules/istanbul-lib-coverage/",\ "packageDependencies": [\ @@ -12638,7 +12271,7 @@ const RAW_RUNTIME_STATE = ["istanbul-lib-instrument", "npm:4.0.3"],\ ["@babel/core", "npm:7.23.3"],\ ["@istanbuljs/schema", "npm:0.1.3"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["semver", "npm:7.5.3"]\ ],\ "linkType": "HARD"\ @@ -12664,7 +12297,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/istanbul-lib-report-npm-3.0.0-660f97340a-06b37952e9.zip/node_modules/istanbul-lib-report/",\ "packageDependencies": [\ ["istanbul-lib-report", "npm:3.0.0"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["make-dir", "npm:3.1.0"],\ ["supports-color", "npm:7.2.0"]\ ],\ @@ -12677,7 +12310,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["istanbul-lib-source-maps", "npm:4.0.1"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["source-map", "npm:0.6.1"]\ ],\ "linkType": "HARD"\ @@ -12695,19 +12328,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["jackspeak", [\ - ["npm:2.3.3", {\ - "packageLocation": "./.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip/node_modules/jackspeak/",\ - "packageDependencies": [\ - ["jackspeak", "npm:2.3.3"],\ - ["@isaacs/cliui", "npm:8.0.2"],\ - ["@pkgjs/parseargs", "npm:0.11.0"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.3.6", {\ - "packageLocation": "./.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip/node_modules/jackspeak/",\ + ["npm:3.1.2", {\ + "packageLocation": "./.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip/node_modules/jackspeak/",\ "packageDependencies": [\ - ["jackspeak", "npm:2.3.6"],\ + ["jackspeak", "npm:3.1.2"],\ ["@isaacs/cliui", "npm:8.0.2"],\ ["@pkgjs/parseargs", "npm:0.11.0"]\ ],\ @@ -12767,7 +12391,7 @@ const RAW_RUNTIME_STATE = ["isomorphic-ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:4.0.1"],\ ["json-stringify-safe", "npm:5.0.1"],\ ["uuid", "npm:8.3.2"],\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -12799,7 +12423,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/jest-worker-npm-27.5.1-1c110b5894-06c6e2a845.zip/node_modules/jest-worker/",\ "packageDependencies": [\ ["jest-worker", "npm:27.5.1"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["merge-stream", "npm:2.0.0"],\ ["supports-color", "npm:8.1.1"]\ ],\ @@ -12870,6 +12494,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["jsbn", [\ + ["npm:1.1.0", {\ + "packageLocation": "./.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip/node_modules/jsbn/",\ + "packageDependencies": [\ + ["jsbn", "npm:1.1.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["jsdoc-type-pratt-parser", [\ ["npm:4.0.0", {\ "packageLocation": "./.yarn/cache/jsdoc-type-pratt-parser-npm-4.0.0-7b035921c4-a225ab874e.zip/node_modules/jsdoc-type-pratt-parser/",\ @@ -13006,14 +12639,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["json5", [\ - ["npm:2.2.0", {\ - "packageLocation": "./.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip/node_modules/json5/",\ - "packageDependencies": [\ - ["json5", "npm:2.2.0"],\ - ["minimist", "npm:1.2.6"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.2.3", {\ "packageLocation": "./.yarn/cache/json5-npm-2.2.3-9962c55073-1db67b853f.zip/node_modules/json5/",\ "packageDependencies": [\ @@ -13069,10 +12694,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["karma", [\ - ["npm:6.4.1", {\ - "packageLocation": "./.yarn/cache/karma-npm-6.4.1-5443d36ee9-24faabfaf0.zip/node_modules/karma/",\ + ["npm:6.4.3", {\ + "packageLocation": "./.yarn/cache/karma-npm-6.4.3-c1db2b322c-7fc194f5d4.zip/node_modules/karma/",\ "packageDependencies": [\ - ["karma", "npm:6.4.1"],\ + ["karma", "npm:6.4.3"],\ ["@colors/colors", "npm:1.5.0"],\ ["body-parser", "npm:1.19.0"],\ ["braces", "npm:3.0.2"],\ @@ -13080,7 +12705,7 @@ const RAW_RUNTIME_STATE = ["connect", "npm:3.7.0"],\ ["di", "npm:0.0.1"],\ ["dom-serialize", "npm:2.2.1"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["graceful-fs", "npm:4.2.10"],\ ["http-proxy", "npm:1.18.1"],\ ["isbinaryfile", "npm:4.0.10"],\ @@ -13092,7 +12717,7 @@ const RAW_RUNTIME_STATE = ["qjobs", "npm:1.2.0"],\ ["range-parser", "npm:1.2.1"],\ ["rimraf", "npm:3.0.2"],\ - ["socket.io", "npm:4.5.2"],\ + ["socket.io", "npm:4.7.5"],\ ["source-map", "npm:0.6.1"],\ ["tmp", "npm:0.2.1"],\ ["ua-parser-js", "npm:1.0.33"],\ @@ -13116,7 +12741,7 @@ const RAW_RUNTIME_STATE = ["@types/chai", "npm:4.2.22"],\ ["@types/karma", null],\ ["chai", "npm:4.3.10"],\ - ["karma", "npm:6.4.1"]\ + ["karma", "npm:6.4.3"]\ ],\ "packagePeers": [\ "@types/chai",\ @@ -13133,7 +12758,7 @@ const RAW_RUNTIME_STATE = ["@types/chai", null],\ ["@types/karma", null],\ ["chai", "npm:4.3.10"],\ - ["karma", "npm:6.4.1"]\ + ["karma", "npm:6.4.3"]\ ],\ "packagePeers": [\ "@types/chai",\ @@ -13190,7 +12815,7 @@ const RAW_RUNTIME_STATE = ["karma-mocha-reporter", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:2.2.5"],\ ["@types/karma", null],\ ["chalk", "npm:2.4.2"],\ - ["karma", "npm:6.4.1"],\ + ["karma", "npm:6.4.3"],\ ["log-symbols", "npm:2.2.0"],\ ["strip-ansi", "npm:4.0.0"]\ ],\ @@ -13224,7 +12849,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13240,7 +12865,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:45f214395bc38640da4dc5e940482d5df0572c5384e0262802601d1973e71077ec8bbd76b77eafa4c0550b706b664abd84d63fd67a5897139f0b2675530fc84f#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:45f214395bc38640da4dc5e940482d5df0572c5384e0262802601d1973e71077ec8bbd76b77eafa4c0550b706b664abd84d63fd67a5897139f0b2675530fc84f#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13256,7 +12881,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:8f25fc90e0fb5fd89843707863857591fa8c52f9f33eadced4bf404b1871d91959f7bb86948ae0e1b53ee94d491ef8fde9c0b58b39c9490c0d0fa6c931945f97#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:8f25fc90e0fb5fd89843707863857591fa8c52f9f33eadced4bf404b1871d91959f7bb86948ae0e1b53ee94d491ef8fde9c0b58b39c9490c0d0fa6c931945f97#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13272,7 +12897,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13288,7 +12913,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13353,7 +12978,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["level-iterator-stream", "npm:4.0.2"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["xtend", "npm:4.0.2"]\ ],\ "linkType": "HARD"\ @@ -13436,7 +13061,7 @@ const RAW_RUNTIME_STATE = ["listr2", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:5.0.7"],\ ["@types/enquirer", null],\ ["cli-truncate", "npm:2.1.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["enquirer", "https://github.com/dashpay/enquirer.git#commit=86aaef0b1c82dfaa3436775e6b37de310eeb94f5"],\ ["log-update", "npm:4.0.0"],\ ["p-map", "npm:4.0.0"],\ @@ -13743,7 +13368,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/lower-case-npm-2.0.2-151055f1c2-83a0a5f159.zip/node_modules/lower-case/",\ "packageDependencies": [\ ["lower-case", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -13765,13 +13390,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["lru-cache", [\ - ["npm:10.0.1", {\ - "packageLocation": "./.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip/node_modules/lru-cache/",\ - "packageDependencies": [\ - ["lru-cache", "npm:10.0.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:10.0.2", {\ "packageLocation": "./.yarn/cache/lru-cache-npm-10.0.2-fcff47e16f-a675b71a19.zip/node_modules/lru-cache/",\ "packageDependencies": [\ @@ -13780,6 +13398,13 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ + ["npm:10.2.2", {\ + "packageLocation": "./.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip/node_modules/lru-cache/",\ + "packageDependencies": [\ + ["lru-cache", "npm:10.2.2"]\ + ],\ + "linkType": "HARD"\ + }],\ ["npm:5.1.1", {\ "packageLocation": "./.yarn/cache/lru-cache-npm-5.1.1-f475882a51-951d2673dc.zip/node_modules/lru-cache/",\ "packageDependencies": [\ @@ -13802,13 +13427,6 @@ const RAW_RUNTIME_STATE = ["lru-cache", "npm:7.18.3"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:7.3.1", {\ - "packageLocation": "./.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip/node_modules/lru-cache/",\ - "packageDependencies": [\ - ["lru-cache", "npm:7.3.1"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["ltgt", [\ @@ -13862,13 +13480,13 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/make-fetch-happen-npm-10.0.3-e552879254-a9afbe3902.zip/node_modules/make-fetch-happen/",\ "packageDependencies": [\ ["make-fetch-happen", "npm:10.0.3"],\ - ["agentkeepalive", "npm:4.2.0"],\ + ["agentkeepalive", "npm:4.3.0"],\ ["cacache", "npm:18.0.0"],\ ["http-cache-semantics", "npm:4.1.1"],\ ["http-proxy-agent", "npm:5.0.0"],\ ["https-proxy-agent", "npm:5.0.0"],\ ["is-lambda", "npm:1.0.1"],\ - ["lru-cache", "npm:7.3.1"],\ + ["lru-cache", "npm:7.18.3"],\ ["minipass", "npm:3.1.6"],\ ["minipass-collect", "npm:1.0.2"],\ ["minipass-fetch", "npm:1.4.1"],\ @@ -13991,13 +13609,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["mem-fs-editor", [\ - ["npm:9.4.0", {\ - "packageLocation": "./.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip/node_modules/mem-fs-editor/",\ - "packageDependencies": [\ - ["mem-fs-editor", "npm:9.4.0"]\ - ],\ - "linkType": "SOFT"\ - }],\ ["npm:9.7.0", {\ "packageLocation": "./.yarn/cache/mem-fs-editor-npm-9.7.0-d55ddaa593-656275560f.zip/node_modules/mem-fs-editor/",\ "packageDependencies": [\ @@ -14005,19 +13616,19 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.4.0", {\ - "packageLocation": "./.yarn/__virtual__/mem-fs-editor-virtual-b8ccd1d842/0/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip/node_modules/mem-fs-editor/",\ + ["virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.7.0", {\ + "packageLocation": "./.yarn/__virtual__/mem-fs-editor-virtual-c18f617f6d/0/cache/mem-fs-editor-npm-9.7.0-d55ddaa593-656275560f.zip/node_modules/mem-fs-editor/",\ "packageDependencies": [\ - ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.4.0"],\ + ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.7.0"],\ ["@types/mem-fs", null],\ ["binaryextensions", "npm:4.18.0"],\ ["commondir", "npm:1.0.1"],\ ["deep-extend", "npm:0.6.0"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["globby", "npm:11.1.0"],\ - ["isbinaryfile", "npm:4.0.10"],\ + ["isbinaryfile", "npm:5.0.0"],\ ["mem-fs", "npm:2.2.1"],\ - ["minimatch", "npm:3.1.2"],\ + ["minimatch", "npm:7.4.6"],\ ["multimatch", "npm:5.0.0"],\ ["normalize-path", "npm:3.0.0"],\ ["textextensions", "npm:5.14.0"]\ @@ -14036,7 +13647,7 @@ const RAW_RUNTIME_STATE = ["binaryextensions", "npm:4.18.0"],\ ["commondir", "npm:1.0.1"],\ ["deep-extend", "npm:0.6.0"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["globby", "npm:11.1.0"],\ ["isbinaryfile", "npm:5.0.0"],\ ["mem-fs", null],\ @@ -14278,14 +13889,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:5.0.0", {\ - "packageLocation": "./.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip/node_modules/minimatch/",\ - "packageDependencies": [\ - ["minimatch", "npm:5.0.0"],\ - ["brace-expansion", "npm:2.0.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:5.0.1", {\ "packageLocation": "./.yarn/cache/minimatch-npm-5.0.1-612724f6f0-2656580f18.zip/node_modules/minimatch/",\ "packageDependencies": [\ @@ -14317,6 +13920,14 @@ const RAW_RUNTIME_STATE = ["brace-expansion", "npm:2.0.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:9.0.4", {\ + "packageLocation": "./.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip/node_modules/minimatch/",\ + "packageDependencies": [\ + ["minimatch", "npm:9.0.4"],\ + ["brace-expansion", "npm:2.0.1"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["minimist", [\ @@ -14349,13 +13960,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:4.2.8", {\ - "packageLocation": "./.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip/node_modules/minipass/",\ - "packageDependencies": [\ - ["minipass", "npm:4.2.8"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:5.0.0", {\ "packageLocation": "./.yarn/cache/minipass-npm-5.0.0-c64fb63c92-61682162d2.zip/node_modules/minipass/",\ "packageDependencies": [\ @@ -14363,17 +13967,17 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:7.0.3", {\ - "packageLocation": "./.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip/node_modules/minipass/",\ + ["npm:7.0.4", {\ + "packageLocation": "./.yarn/cache/minipass-npm-7.0.4-eacb4e042e-e864bd02ce.zip/node_modules/minipass/",\ "packageDependencies": [\ - ["minipass", "npm:7.0.3"]\ + ["minipass", "npm:7.0.4"]\ ],\ "linkType": "HARD"\ }],\ - ["npm:7.0.4", {\ - "packageLocation": "./.yarn/cache/minipass-npm-7.0.4-eacb4e042e-e864bd02ce.zip/node_modules/minipass/",\ + ["npm:7.1.2", {\ + "packageLocation": "./.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip/node_modules/minipass/",\ "packageDependencies": [\ - ["minipass", "npm:7.0.4"]\ + ["minipass", "npm:7.1.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -14700,6 +14304,14 @@ const RAW_RUNTIME_STATE = ["node-gyp", "npm:10.0.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:2.20.0", {\ + "packageLocation": "./.yarn/unplugged/nan-npm-2.20.0-5b5be83e88/node_modules/nan/",\ + "packageDependencies": [\ + ["nan", "npm:2.20.0"],\ + ["node-gyp", "npm:10.0.1"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["nanoid", [\ @@ -14808,7 +14420,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["no-case", "npm:3.0.4"],\ ["lower-case", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -14871,13 +14483,13 @@ const RAW_RUNTIME_STATE = ["node-gyp", "npm:10.0.1"],\ ["env-paths", "npm:2.2.1"],\ ["exponential-backoff", "npm:3.1.1"],\ - ["glob", "npm:10.3.10"],\ + ["glob", "npm:10.4.1"],\ ["graceful-fs", "npm:4.2.10"],\ ["make-fetch-happen", "npm:13.0.0"],\ ["nopt", "npm:7.2.0"],\ ["proc-log", "npm:3.0.0"],\ ["semver", "npm:7.5.3"],\ - ["tar", "npm:6.1.11"],\ + ["tar", "npm:6.2.1"],\ ["which", "npm:4.0.0"]\ ],\ "linkType": "HARD"\ @@ -14912,13 +14524,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["node-releases", [\ - ["npm:2.0.1", {\ - "packageLocation": "./.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip/node_modules/node-releases/",\ - "packageDependencies": [\ - ["node-releases", "npm:2.0.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.0.13", {\ "packageLocation": "./.yarn/cache/node-releases-npm-2.0.13-1f2e177887-c9bb813aab.zip/node_modules/node-releases/",\ "packageDependencies": [\ @@ -14993,7 +14598,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["normalize-package-data", "npm:2.5.0"],\ ["hosted-git-info", "npm:2.8.9"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"],\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"],\ ["semver", "npm:7.5.3"],\ ["validate-npm-package-license", "npm:3.0.4"]\ ],\ @@ -15004,7 +14609,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["normalize-package-data", "npm:3.0.3"],\ ["hosted-git-info", "npm:4.0.2"],\ - ["is-core-module", "npm:2.8.1"],\ + ["is-core-module", "npm:2.13.1"],\ ["semver", "npm:7.5.3"],\ ["validate-npm-package-license", "npm:3.0.4"]\ ],\ @@ -15015,7 +14620,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["normalize-package-data", "npm:5.0.0"],\ ["hosted-git-info", "npm:6.1.1"],\ - ["is-core-module", "npm:2.8.1"],\ + ["is-core-module", "npm:2.13.1"],\ ["semver", "npm:7.5.3"],\ ["validate-npm-package-license", "npm:3.0.4"]\ ],\ @@ -15127,7 +14732,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/npm-packlist-npm-3.0.0-9671ff7386-6fda68f084.zip/node_modules/npm-packlist/",\ "packageDependencies": [\ ["npm-packlist", "npm:3.0.0"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["ignore-walk", "npm:4.0.1"],\ ["npm-bundled", "npm:1.1.2"],\ ["npm-normalize-package-bin", "npm:1.0.1"]\ @@ -15233,8 +14838,8 @@ const RAW_RUNTIME_STATE = ["find-up", "npm:4.1.0"],\ ["foreground-child", "npm:2.0.0"],\ ["get-package-type", "npm:0.1.0"],\ - ["glob", "npm:7.2.0"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["glob", "npm:7.2.3"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["istanbul-lib-hook", "npm:3.0.0"],\ ["istanbul-lib-instrument", "npm:4.0.3"],\ ["istanbul-lib-processinfo", "npm:2.0.3"],\ @@ -15265,13 +14870,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["object-inspect", [\ - ["npm:1.12.3", {\ - "packageLocation": "./.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip/node_modules/object-inspect/",\ - "packageDependencies": [\ - ["object-inspect", "npm:1.12.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.13.1", {\ "packageLocation": "./.yarn/cache/object-inspect-npm-1.13.1-fd038a2f0a-92f4989ed8.zip/node_modules/object-inspect/",\ "packageDependencies": [\ @@ -15285,8 +14883,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object-is-npm-1.1.5-48a862602b-75365aff5d.zip/node_modules/object-is/",\ "packageDependencies": [\ ["object-is", "npm:1.1.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"]\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -15314,8 +14912,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.assign-npm-4.1.4-fb3deb1c3a-fd82d45289.zip/node_modules/object.assign/",\ "packageDependencies": [\ ["object.assign", "npm:4.1.4"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"],\ ["has-symbols", "npm:1.0.3"],\ ["object-keys", "npm:1.1.1"]\ ],\ @@ -15327,9 +14925,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.entries-npm-1.1.6-5f9ba14b46-08a09ff839.zip/node_modules/object.entries/",\ "packageDependencies": [\ ["object.entries", "npm:1.1.6"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"],\ + ["es-abstract", "npm:1.22.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -15339,7 +14937,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.fromentries-npm-2.0.7-2e38392540-1bfbe42a51.zip/node_modules/object.fromentries/",\ "packageDependencies": [\ ["object.fromentries", "npm:2.0.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -15351,7 +14949,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.groupby-npm-1.0.1-fc268391fe-b7123d9140.zip/node_modules/object.groupby/",\ "packageDependencies": [\ ["object.groupby", "npm:1.0.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["get-intrinsic", "npm:1.2.2"]\ @@ -15364,7 +14962,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.values-npm-1.1.7-deae619f88-20ab42c0bb.zip/node_modules/object.values/",\ "packageDependencies": [\ ["object.values", "npm:1.1.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -15743,7 +15341,7 @@ const RAW_RUNTIME_STATE = ["read-package-json-fast", "npm:2.0.3"],\ ["rimraf", "npm:3.0.2"],\ ["ssri", "npm:8.0.1"],\ - ["tar", "npm:6.1.11"]\ + ["tar", "npm:6.2.1"]\ ],\ "linkType": "HARD"\ }],\ @@ -15768,7 +15366,7 @@ const RAW_RUNTIME_STATE = ["read-package-json-fast", "npm:3.0.2"],\ ["sigstore", "npm:1.9.0"],\ ["ssri", "npm:10.0.5"],\ - ["tar", "npm:6.1.13"]\ + ["tar", "npm:6.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -15797,7 +15395,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["param-case", "npm:3.0.4"],\ ["dot-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -15852,7 +15450,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/parse-json-npm-5.2.0-00a63b1199-62085b17d6.zip/node_modules/parse-json/",\ "packageDependencies": [\ ["parse-json", "npm:5.2.0"],\ - ["@babel/code-frame", "npm:7.16.7"],\ + ["@babel/code-frame", "npm:7.22.13"],\ ["error-ex", "npm:1.3.2"],\ ["json-parse-even-better-errors", "npm:2.3.1"],\ ["lines-and-columns", "npm:1.1.6"]\ @@ -15884,7 +15482,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["pascal-case", "npm:3.1.2"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -15898,6 +15496,15 @@ const RAW_RUNTIME_STATE = ["cross-spawn", "npm:6.0.5"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.1.3", {\ + "packageLocation": "./.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip/node_modules/password-prompt/",\ + "packageDependencies": [\ + ["password-prompt", "npm:1.1.3"],\ + ["ansi-escapes", "npm:4.3.2"],\ + ["cross-spawn", "npm:7.0.3"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["path-browserify", [\ @@ -15915,7 +15522,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["path-case", "npm:3.0.4"],\ ["dot-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -15978,12 +15585,12 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["path-scurry", [\ - ["npm:1.10.1", {\ - "packageLocation": "./.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip/node_modules/path-scurry/",\ + ["npm:1.11.1", {\ + "packageLocation": "./.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip/node_modules/path-scurry/",\ "packageDependencies": [\ - ["path-scurry", "npm:1.10.1"],\ - ["lru-cache", "npm:10.0.1"],\ - ["minipass", "npm:7.0.3"]\ + ["path-scurry", "npm:1.11.1"],\ + ["lru-cache", "npm:10.2.2"],\ + ["minipass", "npm:7.1.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -16371,7 +15978,7 @@ const RAW_RUNTIME_STATE = ["@protobufjs/pool", "npm:1.1.0"],\ ["@protobufjs/utf8", "npm:1.1.0"],\ ["@types/long", "npm:4.0.1"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["long", "npm:4.0.0"]\ ],\ "linkType": "HARD"\ @@ -16603,7 +16210,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/read-package-json-npm-6.0.4-bf5c705b94-2c72fc8674.zip/node_modules/read-package-json/",\ "packageDependencies": [\ ["read-package-json", "npm:6.0.4"],\ - ["glob", "npm:10.3.10"],\ + ["glob", "npm:10.4.1"],\ ["json-parse-even-better-errors", "npm:3.0.0"],\ ["normalize-package-data", "npm:5.0.0"],\ ["npm-normalize-package-bin", "npm:3.0.1"]\ @@ -16701,16 +16308,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:3.6.0", {\ - "packageLocation": "./.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip/node_modules/readable-stream/",\ - "packageDependencies": [\ - ["readable-stream", "npm:3.6.0"],\ - ["inherits", "npm:2.0.4"],\ - ["string_decoder", "npm:1.3.0"],\ - ["util-deprecate", "npm:1.0.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.6.2", {\ "packageLocation": "./.yarn/cache/readable-stream-npm-3.6.2-d2a6069158-d9e3e53193.zip/node_modules/readable-stream/",\ "packageDependencies": [\ @@ -16771,7 +16368,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rechoir-npm-0.6.2-0df5f171ec-fe76bf9c21.zip/node_modules/rechoir/",\ "packageDependencies": [\ ["rechoir", "npm:0.6.2"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "linkType": "HARD"\ }],\ @@ -16779,7 +16376,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rechoir-npm-0.7.1-0c7e5c1201-2a04aab4e2.zip/node_modules/rechoir/",\ "packageDependencies": [\ ["rechoir", "npm:0.7.1"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "linkType": "HARD"\ }]\ @@ -16844,21 +16441,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["regexp.prototype.flags", [\ - ["npm:1.4.3", {\ - "packageLocation": "./.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip/node_modules/regexp.prototype.flags/",\ - "packageDependencies": [\ - ["regexp.prototype.flags", "npm:1.4.3"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["functions-have-names", "npm:1.2.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.5.1", {\ "packageLocation": "./.yarn/cache/regexp.prototype.flags-npm-1.5.1-b8faeee306-3fa5610b8e.zip/node_modules/regexp.prototype.flags/",\ "packageDependencies": [\ ["regexp.prototype.flags", "npm:1.5.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["set-function-name", "npm:2.0.1"]\ ],\ @@ -16973,16 +16560,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["resolve", [\ - ["patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d", {\ - "packageLocation": "./.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip/node_modules/resolve/",\ - "packageDependencies": [\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"],\ - ["is-core-module", "npm:2.8.1"],\ - ["path-parse", "npm:1.0.7"],\ - ["supports-preserve-symlinks-flag", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d", {\ "packageLocation": "./.yarn/cache/resolve-patch-4254c24959-f345cd37f5.zip/node_modules/resolve/",\ "packageDependencies": [\ @@ -17097,7 +16674,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rimraf-npm-2.7.1-9a71f3cc37-4586c296c7.zip/node_modules/rimraf/",\ "packageDependencies": [\ ["rimraf", "npm:2.7.1"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -17105,7 +16682,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rimraf-npm-3.0.2-2cb7dac69a-063ffaccaa.zip/node_modules/rimraf/",\ "packageDependencies": [\ ["rimraf", "npm:3.0.2"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -17149,19 +16726,11 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:7.8.0", {\ - "packageLocation": "./.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip/node_modules/rxjs/",\ - "packageDependencies": [\ - ["rxjs", "npm:7.8.0"],\ - ["tslib", "npm:2.4.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.8.1", {\ "packageLocation": "./.yarn/cache/rxjs-npm-7.8.1-41c443a75b-b10cac1a52.zip/node_modules/rxjs/",\ "packageDependencies": [\ ["rxjs", "npm:7.8.1"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -17171,7 +16740,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/safe-array-concat-npm-1.0.1-8a42907bbf-44f073d85c.zip/node_modules/safe-array-concat/",\ "packageDependencies": [\ ["safe-array-concat", "npm:1.0.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["get-intrinsic", "npm:1.2.2"],\ ["has-symbols", "npm:1.0.3"],\ ["isarray", "npm:2.0.5"]\ @@ -17200,8 +16769,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/safe-regex-test-npm-1.0.0-e94a09b84e-c7248dfa07.zip/node_modules/safe-regex-test/",\ "packageDependencies": [\ ["safe-regex-test", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"],\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"],\ ["is-regex", "npm:1.1.4"]\ ],\ "linkType": "HARD"\ @@ -17263,7 +16832,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/schema-utils-npm-3.1.1-8704647575-cfcf991f10.zip/node_modules/schema-utils/",\ "packageDependencies": [\ ["schema-utils", "npm:3.1.1"],\ - ["@types/json-schema", "npm:7.0.11"],\ + ["@types/json-schema", "npm:7.0.15"],\ ["ajv", "npm:6.12.6"],\ ["ajv-keywords", "virtual:8704647575acf2f5b19fccfcb0acebacd9c94259ebe9afcfaf4c053812fd896f10775930ee5a5949e20833a61503d2cd22aa259cbe69729f6a192de4bf43dc00#npm:3.5.2"]\ ],\ @@ -17273,7 +16842,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/schema-utils-npm-4.2.0-e822c5b02e-808784735e.zip/node_modules/schema-utils/",\ "packageDependencies": [\ ["schema-utils", "npm:4.2.0"],\ - ["@types/json-schema", "npm:7.0.11"],\ + ["@types/json-schema", "npm:7.0.15"],\ ["ajv", "npm:8.12.0"],\ ["ajv-formats", "virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:2.1.1"],\ ["ajv-keywords", "virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:5.1.0"]\ @@ -17324,7 +16893,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["sentence-case", "npm:3.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"],\ + ["tslib", "npm:2.6.2"],\ ["upper-case-first", "npm:2.0.2"]\ ],\ "linkType": "HARD"\ @@ -17452,7 +17021,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/shelljs-npm-0.8.5-44be43f84a-f2178274b9.zip/node_modules/shelljs/",\ "packageDependencies": [\ ["shelljs", "npm:0.8.5"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["interpret", "npm:1.4.0"],\ ["rechoir", "npm:0.6.2"]\ ],\ @@ -17548,9 +17117,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/side-channel-npm-1.0.4-e1f38b9e06-c4998d9fc5.zip/node_modules/side-channel/",\ "packageDependencies": [\ ["side-channel", "npm:1.0.4"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"],\ - ["object-inspect", "npm:1.12.3"]\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"],\ + ["object-inspect", "npm:1.13.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -17737,31 +17306,34 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["snake-case", "npm:3.0.4"],\ ["dot-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["socket.io", [\ - ["npm:4.5.2", {\ - "packageLocation": "./.yarn/cache/socket.io-npm-4.5.2-11f9913f37-872605db0f.zip/node_modules/socket.io/",\ + ["npm:4.7.5", {\ + "packageLocation": "./.yarn/cache/socket.io-npm-4.7.5-7db6120b90-911528f5bf.zip/node_modules/socket.io/",\ "packageDependencies": [\ - ["socket.io", "npm:4.5.2"],\ + ["socket.io", "npm:4.7.5"],\ ["accepts", "npm:1.3.7"],\ ["base64id", "npm:2.0.0"],\ + ["cors", "npm:2.8.5"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ ["engine.io", "npm:6.4.2"],\ - ["socket.io-adapter", "npm:2.4.0"],\ + ["socket.io-adapter", "npm:2.5.5"],\ ["socket.io-parser", "npm:4.2.3"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["socket.io-adapter", [\ - ["npm:2.4.0", {\ - "packageLocation": "./.yarn/cache/socket.io-adapter-npm-2.4.0-36a74a6ea1-e10c8c36a1.zip/node_modules/socket.io-adapter/",\ + ["npm:2.5.5", {\ + "packageLocation": "./.yarn/cache/socket.io-adapter-npm-2.5.5-7a0505537f-e364733a4c.zip/node_modules/socket.io-adapter/",\ "packageDependencies": [\ - ["socket.io-adapter", "npm:2.4.0"]\ + ["socket.io-adapter", "npm:2.5.5"],\ + ["debug", "virtual:7a0505537f63825f62aaaf982168c2b7c1e816756656d44af98202b8d07990e163024e7dadf5587aa11d691887401ca8792ff06467da4d479c747705c9e87544#npm:4.3.5"],\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -17778,20 +17350,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["socks", [\ - ["npm:2.6.1", {\ - "packageLocation": "./.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip/node_modules/socks/",\ - "packageDependencies": [\ - ["socks", "npm:2.6.1"],\ - ["ip", "npm:1.1.5"],\ - ["smart-buffer", "npm:4.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.7.1", {\ - "packageLocation": "./.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip/node_modules/socks/",\ + ["npm:2.8.3", {\ + "packageLocation": "./.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip/node_modules/socks/",\ "packageDependencies": [\ - ["socks", "npm:2.7.1"],\ - ["ip", "npm:2.0.0"],\ + ["socks", "npm:2.8.3"],\ + ["ip-address", "npm:9.0.5"],\ ["smart-buffer", "npm:4.2.0"]\ ],\ "linkType": "HARD"\ @@ -17804,7 +17367,7 @@ const RAW_RUNTIME_STATE = ["socks-proxy-agent", "npm:6.1.1"],\ ["agent-base", "npm:6.0.2"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["socks", "npm:2.6.1"]\ + ["socks", "npm:2.8.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -17814,7 +17377,7 @@ const RAW_RUNTIME_STATE = ["socks-proxy-agent", "npm:7.0.0"],\ ["agent-base", "npm:6.0.2"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["socks", "npm:2.7.1"]\ + ["socks", "npm:2.8.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -17824,7 +17387,7 @@ const RAW_RUNTIME_STATE = ["socks-proxy-agent", "npm:8.0.2"],\ ["agent-base", "npm:7.1.0"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["socks", "npm:2.7.1"]\ + ["socks", "npm:2.8.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -17850,13 +17413,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["source-map", [\ - ["npm:0.5.7", {\ - "packageLocation": "./.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip/node_modules/source-map/",\ - "packageDependencies": [\ - ["source-map", "npm:0.5.7"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.6.1", {\ "packageLocation": "./.yarn/cache/source-map-npm-0.6.1-1a3621db16-59ef7462f1.zip/node_modules/source-map/",\ "packageDependencies": [\ @@ -17972,7 +17528,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/split2-npm-3.2.2-4ccd21b4f7-a426e1e671.zip/node_modules/split2/",\ "packageDependencies": [\ ["split2", "npm:3.2.2"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }],\ @@ -17991,6 +17547,13 @@ const RAW_RUNTIME_STATE = ["sprintf-js", "npm:1.0.3"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.1.3", {\ + "packageLocation": "./.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip/node_modules/sprintf-js/",\ + "packageDependencies": [\ + ["sprintf-js", "npm:1.1.3"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["ssh2", [\ @@ -18048,7 +17611,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["stream-browserify", "npm:3.0.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -18060,7 +17623,7 @@ const RAW_RUNTIME_STATE = ["stream-http", "npm:3.2.0"],\ ["builtin-status-codes", "npm:3.0.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["xtend", "npm:4.0.2"]\ ],\ "linkType": "HARD"\ @@ -18101,21 +17664,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["string.prototype.trim", [\ - ["npm:1.2.7", {\ - "packageLocation": "./.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip/node_modules/string.prototype.trim/",\ - "packageDependencies": [\ - ["string.prototype.trim", "npm:1.2.7"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.2.8", {\ "packageLocation": "./.yarn/cache/string.prototype.trim-npm-1.2.8-7ed4517ce8-9301f6cb2b.zip/node_modules/string.prototype.trim/",\ "packageDependencies": [\ ["string.prototype.trim", "npm:1.2.8"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -18123,21 +17676,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["string.prototype.trimend", [\ - ["npm:1.0.6", {\ - "packageLocation": "./.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip/node_modules/string.prototype.trimend/",\ - "packageDependencies": [\ - ["string.prototype.trimend", "npm:1.0.6"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.7", {\ "packageLocation": "./.yarn/cache/string.prototype.trimend-npm-1.0.7-159b9dcfbc-3f0d3397ab.zip/node_modules/string.prototype.trimend/",\ "packageDependencies": [\ ["string.prototype.trimend", "npm:1.0.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -18145,21 +17688,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["string.prototype.trimstart", [\ - ["npm:1.0.6", {\ - "packageLocation": "./.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip/node_modules/string.prototype.trimstart/",\ - "packageDependencies": [\ - ["string.prototype.trimstart", "npm:1.0.6"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.7", {\ "packageLocation": "./.yarn/cache/string.prototype.trimstart-npm-1.0.7-ae2f803b78-6e594d3a61.zip/node_modules/string.prototype.trimstart/",\ "packageDependencies": [\ ["string.prototype.trimstart", "npm:1.0.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -18317,15 +17850,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["supports-hyperlinks", [\ - ["npm:2.2.0", {\ - "packageLocation": "./.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip/node_modules/supports-hyperlinks/",\ - "packageDependencies": [\ - ["supports-hyperlinks", "npm:2.2.0"],\ - ["has-flag", "npm:4.0.0"],\ - ["supports-color", "npm:7.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.3.0", {\ "packageLocation": "./.yarn/cache/supports-hyperlinks-npm-2.3.0-d19176eba2-3e7df6e9ea.zip/node_modules/supports-hyperlinks/",\ "packageDependencies": [\ @@ -18384,12 +17908,21 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["systeminformation", [\ + ["npm:5.22.11", {\ + "packageLocation": "./.yarn/unplugged/systeminformation-npm-5.22.11-e704a1605b/node_modules/systeminformation/",\ + "packageDependencies": [\ + ["systeminformation", "npm:5.22.11"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["table", [\ ["npm:6.8.1", {\ "packageLocation": "./.yarn/cache/table-npm-6.8.1-83abb79e20-512c4f2bfb.zip/node_modules/table/",\ "packageDependencies": [\ ["table", "npm:6.8.1"],\ - ["ajv", "npm:8.8.1"],\ + ["ajv", "npm:8.12.0"],\ ["lodash.truncate", "npm:4.4.2"],\ ["slice-ansi", "npm:4.0.0"],\ ["string-width", "npm:4.2.3"],\ @@ -18419,26 +17952,13 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["tar", [\ - ["npm:6.1.11", {\ - "packageLocation": "./.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip/node_modules/tar/",\ - "packageDependencies": [\ - ["tar", "npm:6.1.11"],\ - ["chownr", "npm:2.0.0"],\ - ["fs-minipass", "npm:2.1.0"],\ - ["minipass", "npm:3.1.6"],\ - ["minizlib", "npm:2.1.2"],\ - ["mkdirp", "npm:1.0.4"],\ - ["yallist", "npm:4.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:6.1.13", {\ - "packageLocation": "./.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip/node_modules/tar/",\ + ["npm:6.2.1", {\ + "packageLocation": "./.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip/node_modules/tar/",\ "packageDependencies": [\ - ["tar", "npm:6.1.13"],\ + ["tar", "npm:6.2.1"],\ ["chownr", "npm:2.0.0"],\ ["fs-minipass", "npm:2.1.0"],\ - ["minipass", "npm:4.2.8"],\ + ["minipass", "npm:5.0.0"],\ ["minizlib", "npm:2.1.2"],\ ["mkdirp", "npm:1.0.4"],\ ["yallist", "npm:4.0.0"]\ @@ -18468,7 +17988,7 @@ const RAW_RUNTIME_STATE = ["end-of-stream", "npm:1.4.4"],\ ["fs-constants", "npm:1.0.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -18499,7 +18019,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["terser", "npm:5.14.2"],\ ["@jridgewell/source-map", "npm:0.3.2"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["commander", "npm:2.20.3"],\ ["source-map-support", "npm:0.5.21"]\ ],\ @@ -18518,7 +18038,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-7b10d7bddb/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:2a3d558ccb76dd3ab11b6ed4ba45a56a4c8ede48a0f5bce78e9f369869629c0ab3fdd420246c54134f91e3f10302373527dda29ebc24d5a11b3ceb41128ccfad#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18548,7 +18068,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-520d9753e1/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:42f4a899ff66a92a935fae1e8403ae89d87f8a151c8c0f294f5e2ee8bca90964f194c289f6f47a8333ea1d64884bb4ea4c5aea65e0aa5a8603494f665e284ad3#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18578,7 +18098,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-00677cea6c/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18608,7 +18128,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-65e4fce360/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18638,7 +18158,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-9f9f9cad8b/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:d33ae3339557a5a7f9578102570f67e936a4c1af78c1322b63541bc89dc24f419318f0ddd4e3241021a7e0be1ce717f7ffe8cc168317f38d8d886f6915b6482d#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18671,7 +18191,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["test-exclude", "npm:6.0.0"],\ ["@istanbuljs/schema", "npm:0.1.3"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"]\ ],\ "linkType": "HARD"\ @@ -18746,7 +18266,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/through2-npm-4.0.2-da7b2da443-72c246233d.zip/node_modules/through2/",\ "packageDependencies": [\ ["through2", "npm:4.0.2"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -19005,13 +18525,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["ts-node", [\ - ["npm:10.4.0", {\ - "packageLocation": "./.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip/node_modules/ts-node/",\ - "packageDependencies": [\ - ["ts-node", "npm:10.4.0"]\ - ],\ - "linkType": "SOFT"\ - }],\ ["npm:10.9.1", {\ "packageLocation": "./.yarn/cache/ts-node-npm-10.9.1-6c268be7f4-bee56d4dc9.zip/node_modules/ts-node/",\ "packageDependencies": [\ @@ -19035,11 +18548,11 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.4.0", {\ - "packageLocation": "./.yarn/__virtual__/ts-node-virtual-065e96423f/0/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip/node_modules/ts-node/",\ + ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.9.1", {\ + "packageLocation": "./.yarn/__virtual__/ts-node-virtual-b591c0cf5f/0/cache/ts-node-npm-10.9.1-6c268be7f4-bee56d4dc9.zip/node_modules/ts-node/",\ "packageDependencies": [\ - ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.4.0"],\ - ["@cspotcode/source-map-support", "npm:0.7.0"],\ + ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.9.1"],\ + ["@cspotcode/source-map-support", "npm:0.8.1"],\ ["@swc/core", null],\ ["@swc/wasm", null],\ ["@tsconfig/node10", "npm:1.0.8"],\ @@ -19050,13 +18563,14 @@ const RAW_RUNTIME_STATE = ["@types/swc__core", null],\ ["@types/swc__wasm", null],\ ["@types/typescript", null],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-walk", "npm:8.2.0"],\ ["arg", "npm:4.1.3"],\ ["create-require", "npm:1.1.1"],\ ["diff", "npm:4.0.2"],\ ["make-error", "npm:1.3.6"],\ ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=3bd3d3"],\ + ["v8-compile-cache-lib", "npm:3.0.1"],\ ["yn", "npm:3.1.1"]\ ],\ "packagePeers": [\ @@ -19085,7 +18599,7 @@ const RAW_RUNTIME_STATE = ["@types/swc__core", null],\ ["@types/swc__wasm", null],\ ["@types/typescript", null],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-walk", "npm:8.2.0"],\ ["arg", "npm:4.1.3"],\ ["create-require", "npm:1.1.1"],\ @@ -19171,20 +18685,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:2.4.1", {\ - "packageLocation": "./.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip/node_modules/tslib/",\ - "packageDependencies": [\ - ["tslib", "npm:2.4.1"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.5.0", {\ - "packageLocation": "./.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip/node_modules/tslib/",\ - "packageDependencies": [\ - ["tslib", "npm:2.5.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.6.2", {\ "packageLocation": "./.yarn/cache/tslib-npm-2.6.2-4fc8c068d9-bd26c22d36.zip/node_modules/tslib/",\ "packageDependencies": [\ @@ -19359,9 +18859,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/typed-array-buffer-npm-1.0.0-95cb610310-3e0281c79b.zip/node_modules/typed-array-buffer/",\ "packageDependencies": [\ ["typed-array-buffer", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["get-intrinsic", "npm:1.2.2"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19371,10 +18871,10 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/typed-array-byte-length-npm-1.0.0-94d79975ca-6f376bf5d9.zip/node_modules/typed-array-byte-length/",\ "packageDependencies": [\ ["typed-array-byte-length", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["for-each", "npm:0.3.3"],\ ["has-proto", "npm:1.0.1"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19385,10 +18885,10 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["typed-array-byte-offset", "npm:1.0.0"],\ ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["for-each", "npm:0.3.3"],\ ["has-proto", "npm:1.0.1"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19398,9 +18898,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/typed-array-length-npm-1.0.4-92771b81fc-0444658acc.zip/node_modules/typed-array-length/",\ "packageDependencies": [\ ["typed-array-length", "npm:1.0.4"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["for-each", "npm:0.3.3"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19459,10 +18959,10 @@ const RAW_RUNTIME_STATE = ["ansi-split", "npm:1.0.1"],\ ["chalk", "npm:4.1.2"],\ ["cross-spawn", "npm:7.0.3"],\ - ["fast-glob", "npm:3.2.11"],\ + ["fast-glob", "npm:3.2.12"],\ ["globrex", "npm:0.1.2"],\ ["ignore", "npm:5.2.0"],\ - ["json5", "npm:2.2.0"],\ + ["json5", "npm:2.2.3"],\ ["micro-memoize", "npm:4.0.9"],\ ["npm-run-path", "npm:4.0.1"],\ ["pid-cwd", "npm:1.2.0"],\ @@ -19483,7 +18983,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/unbox-primitive-npm-1.0.2-cb56a05066-06e1ee41c1.zip/node_modules/unbox-primitive/",\ "packageDependencies": [\ ["unbox-primitive", "npm:1.0.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-bigints", "npm:1.0.2"],\ ["has-symbols", "npm:1.0.3"],\ ["which-boxed-primitive", "npm:1.0.2"]\ @@ -19632,7 +19132,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/upper-case-npm-2.0.2-6cf3bda96c-508723a2b0.zip/node_modules/upper-case/",\ "packageDependencies": [\ ["upper-case", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -19642,7 +19142,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/upper-case-first-npm-2.0.2-8e0c5a851a-4487db4701.zip/node_modules/upper-case-first/",\ "packageDependencies": [\ ["upper-case-first", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -19696,9 +19196,9 @@ const RAW_RUNTIME_STATE = ["inherits", "npm:2.0.4"],\ ["is-arguments", "npm:1.1.1"],\ ["is-generator-function", "npm:1.0.10"],\ - ["is-typed-array", "npm:1.1.10"],\ + ["is-typed-array", "npm:1.1.12"],\ ["safe-buffer", "npm:5.2.1"],\ - ["which-typed-array", "npm:1.1.9"]\ + ["which-typed-array", "npm:1.1.13"]\ ],\ "linkType": "HARD"\ }]\ @@ -19913,11 +19413,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -19950,11 +19450,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -19987,11 +19487,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -20024,11 +19524,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -20061,11 +19561,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -20112,7 +19612,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:0249f7ceb5542d6b732af2b44f9fcd16c60be8b8440f0f3abc6a5de67aabcff731bc3bc83f3067ab2f9037661176f001f89208fcea9e8962835fd43d0aabe88a#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:0249f7ceb5542d6b732af2b44f9fcd16c60be8b8440f0f3abc6a5de67aabcff731bc3bc83f3067ab2f9037661176f001f89208fcea9e8962835fd43d0aabe88a#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20153,7 +19653,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:b37ef7cf98ceabe8c7b789a7db3f0a5f3444d083afa5f0e3ab570292e74eff241f890fadbf245a134b2ebfcba326b1782124a4dd4f16ca7cdb6091dd9a987c04#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:b37ef7cf98ceabe8c7b789a7db3f0a5f3444d083afa5f0e3ab570292e74eff241f890fadbf245a134b2ebfcba326b1782124a4dd4f16ca7cdb6091dd9a987c04#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20194,7 +19694,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:7fc88da9d00679384dc013444a3b1ed8ef8395fcad9d046790a1851d5db985e5ee052061731f87c5475e4bf20a92d69ea1a1a287c0d76d7b1a6bf97010c63532#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:7fc88da9d00679384dc013444a3b1ed8ef8395fcad9d046790a1851d5db985e5ee052061731f87c5475e4bf20a92d69ea1a1a287c0d76d7b1a6bf97010c63532#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20235,7 +19735,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:16885aa8448c33477ea2cd730ac3a5bbbcb89a3f570f5364364e7dc5830b16f19367cec64b723cc62ddb3078b4ee0f0ce5d244584279bc98369c8ee9e5959a27#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:16885aa8448c33477ea2cd730ac3a5bbbcb89a3f570f5364364e7dc5830b16f19367cec64b723cc62ddb3078b4ee0f0ce5d244584279bc98369c8ee9e5959a27#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20381,19 +19881,6 @@ const RAW_RUNTIME_STATE = ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:1.1.9", {\ - "packageLocation": "./.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip/node_modules/which-typed-array/",\ - "packageDependencies": [\ - ["which-typed-array", "npm:1.1.9"],\ - ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["for-each", "npm:0.3.3"],\ - ["gopd", "npm:1.0.1"],\ - ["has-tostringtag", "npm:1.0.0"],\ - ["is-typed-array", "npm:1.1.10"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["wide-align", [\ @@ -20435,7 +19922,7 @@ const RAW_RUNTIME_STATE = ["is-stream", "npm:2.0.1"],\ ["logform", "npm:2.3.0"],\ ["one-time", "npm:1.0.0"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["stack-trace", "npm:0.0.10"],\ ["triple-beam", "npm:1.3.0"],\ ["winston-transport", "npm:4.4.0"]\ @@ -20553,24 +20040,17 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["ws", [\ - ["npm:7.5.5", {\ - "packageLocation": "./.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip/node_modules/ws/",\ - "packageDependencies": [\ - ["ws", "npm:7.5.5"]\ - ],\ - "linkType": "SOFT"\ - }],\ - ["npm:8.11.0", {\ - "packageLocation": "./.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip/node_modules/ws/",\ + ["npm:8.17.1", {\ + "packageLocation": "./.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "npm:8.11.0"]\ + ["ws", "npm:8.17.1"]\ ],\ "linkType": "SOFT"\ }],\ - ["virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:7.5.5", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-49f0813c39/0/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip/node_modules/ws/",\ + ["virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:8.17.1", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-9c0ceafc6c/0/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:7.5.5"],\ + ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:8.17.1"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", "npm:4.0.6"],\ @@ -20584,27 +20064,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-90d8bcd261/0/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip/node_modules/ws/",\ + ["virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-59f3d5fa16/0/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"],\ - ["@types/bufferutil", null],\ - ["@types/utf-8-validate", null],\ - ["bufferutil", null],\ - ["utf-8-validate", null]\ - ],\ - "packagePeers": [\ - "@types/bufferutil",\ - "@types/utf-8-validate",\ - "bufferutil",\ - "utf-8-validate"\ - ],\ - "linkType": "HARD"\ - }],\ - ["virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.11.0", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-110db35f33/0/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip/node_modules/ws/",\ - "packageDependencies": [\ - ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.11.0"],\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", null],\ @@ -20695,7 +20158,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["yamljs", "npm:0.3.0"],\ ["argparse", "npm:1.0.10"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -20786,7 +20249,7 @@ const RAW_RUNTIME_STATE = ["commander", "npm:7.1.0"],\ ["dateformat", "npm:4.6.3"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["diff", "npm:5.0.0"],\ + ["diff", "npm:5.1.0"],\ ["error", "npm:10.4.0"],\ ["escape-string-regexp", "npm:4.0.0"],\ ["execa", "npm:5.1.1"],\ @@ -20799,7 +20262,7 @@ const RAW_RUNTIME_STATE = ["lodash", "npm:4.17.21"],\ ["log-symbols", "npm:4.1.0"],\ ["mem-fs", "npm:2.2.1"],\ - ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.4.0"],\ + ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.7.0"],\ ["minimatch", "npm:3.1.2"],\ ["npmlog", "npm:5.0.1"],\ ["p-queue", "npm:6.6.2"],\ diff --git a/.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip b/.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip deleted file mode 100644 index 1c98cc9480c..00000000000 Binary files a/.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip and /dev/null differ diff --git a/.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip b/.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip deleted file mode 100644 index 1f810427fa2..00000000000 Binary files a/.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip b/.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip deleted file mode 100644 index 525f2b2fcf8..00000000000 Binary files a/.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip b/.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip deleted file mode 100644 index bd14dd9b60b..00000000000 Binary files a/.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip b/.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip deleted file mode 100644 index cf5b13d58cf..00000000000 Binary files a/.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip b/.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip deleted file mode 100644 index 81cfcbbfad0..00000000000 Binary files a/.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip b/.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip deleted file mode 100644 index 47da224221a..00000000000 Binary files a/.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip b/.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip deleted file mode 100644 index 5249cf09fe3..00000000000 Binary files a/.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip b/.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip deleted file mode 100644 index e3f61150a17..00000000000 Binary files a/.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip and /dev/null differ diff --git a/.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip b/.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip deleted file mode 100644 index 18595b7127d..00000000000 Binary files a/.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip and /dev/null differ diff --git a/.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip b/.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip deleted file mode 100644 index 3ea658b71a8..00000000000 Binary files a/.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip and /dev/null differ diff --git a/.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip b/.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip deleted file mode 100644 index 5a706bc905a..00000000000 Binary files a/.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip and /dev/null differ diff --git a/.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip b/.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip deleted file mode 100644 index f435a79f837..00000000000 Binary files a/.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip and /dev/null differ diff --git a/.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip b/.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip deleted file mode 100644 index d6067f111a6..00000000000 Binary files a/.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip and /dev/null differ diff --git a/.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip b/.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip deleted file mode 100644 index b80c61c493f..00000000000 Binary files a/.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip and /dev/null differ diff --git a/.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip b/.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip deleted file mode 100644 index ae1e68e422f..00000000000 Binary files a/.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip and /dev/null differ diff --git a/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip b/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip deleted file mode 100644 index 81560d8bc59..00000000000 Binary files a/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip and /dev/null differ diff --git a/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.3-8c8abba924-28e2731ac6.zip b/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.3-8c8abba924-28e2731ac6.zip new file mode 100644 index 00000000000..f9ac0cfb726 Binary files /dev/null and b/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.3-8c8abba924-28e2731ac6.zip differ diff --git a/.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip b/.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip deleted file mode 100644 index 29aee764371..00000000000 Binary files a/.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip and /dev/null differ diff --git a/.yarn/cache/@dashevo-dashd-rpc-npm-19.0.0-54bb2a5dfc-2eab84af3e.zip b/.yarn/cache/@dashevo-dashd-rpc-npm-19.0.0-54bb2a5dfc-2eab84af3e.zip new file mode 100644 index 00000000000..6ad3f917538 Binary files /dev/null and b/.yarn/cache/@dashevo-dashd-rpc-npm-19.0.0-54bb2a5dfc-2eab84af3e.zip differ diff --git a/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip b/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip deleted file mode 100644 index cd12dbed623..00000000000 Binary files a/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip and /dev/null differ diff --git a/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip b/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip deleted file mode 100644 index c8e3d8abb9b..00000000000 Binary files a/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip and /dev/null differ diff --git a/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip b/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip deleted file mode 100644 index e4905c2164c..00000000000 Binary files a/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip and /dev/null differ diff --git a/.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip b/.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip deleted file mode 100644 index 02ccaf6eac4..00000000000 Binary files a/.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip and /dev/null differ diff --git a/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip b/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip deleted file mode 100644 index 6cf18d7286f..00000000000 Binary files a/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip and /dev/null differ diff --git a/.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip b/.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip new file mode 100644 index 00000000000..abfc68a753a Binary files /dev/null and b/.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip differ diff --git a/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip b/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip deleted file mode 100644 index f28a98d38cc..00000000000 Binary files a/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip and /dev/null differ diff --git a/.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip b/.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip deleted file mode 100644 index 672e0a48150..00000000000 Binary files a/.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip and /dev/null differ diff --git a/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip b/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip deleted file mode 100644 index 6d63bba22be..00000000000 Binary files a/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip and /dev/null differ diff --git a/.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip b/.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip deleted file mode 100644 index c79441c782e..00000000000 Binary files a/.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip and /dev/null differ diff --git a/.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip b/.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip deleted file mode 100644 index 90ae9925e30..00000000000 Binary files a/.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip and /dev/null differ diff --git a/.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip b/.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip deleted file mode 100644 index 9fb342a58b2..00000000000 Binary files a/.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip and /dev/null differ diff --git a/.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip b/.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip deleted file mode 100644 index e00bb3f3422..00000000000 Binary files a/.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip and /dev/null differ diff --git a/.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip b/.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip deleted file mode 100644 index 81779aadc49..00000000000 Binary files a/.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip and /dev/null differ diff --git a/.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip b/.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip deleted file mode 100644 index 8b2227c6b3c..00000000000 Binary files a/.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip and /dev/null differ diff --git a/.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip b/.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip deleted file mode 100644 index 358cbb7a5fc..00000000000 Binary files a/.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip and /dev/null differ diff --git a/.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip b/.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip new file mode 100644 index 00000000000..3f65ebe0c16 Binary files /dev/null and b/.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip differ diff --git a/.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip b/.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip new file mode 100644 index 00000000000..7cb3fbdc1b7 Binary files /dev/null and b/.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip differ diff --git a/.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip b/.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip deleted file mode 100644 index be43f7c11a2..00000000000 Binary files a/.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip and /dev/null differ diff --git a/.yarn/cache/debug-npm-4.3.5-b5001f59b7-cb6eab424c.zip b/.yarn/cache/debug-npm-4.3.5-b5001f59b7-cb6eab424c.zip new file mode 100644 index 00000000000..c621a4c78dd Binary files /dev/null and b/.yarn/cache/debug-npm-4.3.5-b5001f59b7-cb6eab424c.zip differ diff --git a/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip b/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip deleted file mode 100644 index bcbfcf6e68f..00000000000 Binary files a/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip and /dev/null differ diff --git a/.yarn/cache/diskusage-npm-1.2.0-3d0577ad86-cf37552dd9.zip b/.yarn/cache/diskusage-npm-1.2.0-3d0577ad86-cf37552dd9.zip new file mode 100644 index 00000000000..2c353fe061f Binary files /dev/null and b/.yarn/cache/diskusage-npm-1.2.0-3d0577ad86-cf37552dd9.zip differ diff --git a/.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip b/.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip new file mode 100644 index 00000000000..da09b74bcf7 Binary files /dev/null and b/.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip differ diff --git a/.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip b/.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip deleted file mode 100644 index 368ffb9272a..00000000000 Binary files a/.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip and /dev/null differ diff --git a/.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip b/.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip deleted file mode 100644 index 215be7ad47c..00000000000 Binary files a/.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip and /dev/null differ diff --git a/.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip b/.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip deleted file mode 100644 index 661b9e4ef1b..00000000000 Binary files a/.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip and /dev/null differ diff --git a/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip b/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip deleted file mode 100644 index 1735b16d38c..00000000000 Binary files a/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip and /dev/null differ diff --git a/.yarn/cache/eslint-import-resolver-node-npm-0.3.6-d9426786c6-c35c6edb7e.zip b/.yarn/cache/eslint-import-resolver-node-npm-0.3.6-d9426786c6-c35c6edb7e.zip deleted file mode 100644 index 90681030d34..00000000000 Binary files a/.yarn/cache/eslint-import-resolver-node-npm-0.3.6-d9426786c6-c35c6edb7e.zip and /dev/null differ diff --git a/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip b/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip deleted file mode 100644 index 2a0d03ccb0a..00000000000 Binary files a/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip and /dev/null differ diff --git a/.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip b/.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip deleted file mode 100644 index cd75e37be85..00000000000 Binary files a/.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip and /dev/null differ diff --git a/.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip b/.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip deleted file mode 100644 index 105b1dfab13..00000000000 Binary files a/.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip and /dev/null differ diff --git a/.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip b/.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip deleted file mode 100644 index 9aa62ac845d..00000000000 Binary files a/.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip and /dev/null differ diff --git a/.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip b/.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip new file mode 100644 index 00000000000..d64f38e50a7 Binary files /dev/null and b/.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip differ diff --git a/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip b/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip deleted file mode 100644 index b10b9658cff..00000000000 Binary files a/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip and /dev/null differ diff --git a/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip b/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip deleted file mode 100644 index 46ce2d234f8..00000000000 Binary files a/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip and /dev/null differ diff --git a/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip b/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip deleted file mode 100644 index f716bea6182..00000000000 Binary files a/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip and /dev/null differ diff --git a/.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip b/.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip deleted file mode 100644 index 5c0f342c115..00000000000 Binary files a/.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip and /dev/null differ diff --git a/.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip b/.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip deleted file mode 100644 index 26849fc8f32..00000000000 Binary files a/.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip and /dev/null differ diff --git a/.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip b/.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip new file mode 100644 index 00000000000..8d44135f2f9 Binary files /dev/null and b/.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip differ diff --git a/.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip b/.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip new file mode 100644 index 00000000000..711edd7c1e0 Binary files /dev/null and b/.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip differ diff --git a/.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip b/.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip new file mode 100644 index 00000000000..f29f3f6f189 Binary files /dev/null and b/.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip differ diff --git a/.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip b/.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip deleted file mode 100644 index fa0bbc93c13..00000000000 Binary files a/.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip and /dev/null differ diff --git a/.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip b/.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip deleted file mode 100644 index c751a851ab9..00000000000 Binary files a/.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip and /dev/null differ diff --git a/.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip b/.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip deleted file mode 100644 index 77d6a993276..00000000000 Binary files a/.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip and /dev/null differ diff --git a/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip b/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip deleted file mode 100644 index 305419609d8..00000000000 Binary files a/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip and /dev/null differ diff --git a/.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip b/.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip deleted file mode 100644 index 1c849581e6a..00000000000 Binary files a/.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip and /dev/null differ diff --git a/.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip b/.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip deleted file mode 100644 index eacd30ac5d4..00000000000 Binary files a/.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip and /dev/null differ diff --git a/.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip b/.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip deleted file mode 100644 index 91909eb58a6..00000000000 Binary files a/.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip and /dev/null differ diff --git a/.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip b/.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip new file mode 100644 index 00000000000..8b9ff400e38 Binary files /dev/null and b/.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip differ diff --git a/.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip b/.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip new file mode 100644 index 00000000000..4e18b228c5f Binary files /dev/null and b/.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip differ diff --git a/.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip b/.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip deleted file mode 100644 index 9642fe2201b..00000000000 Binary files a/.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip and /dev/null differ diff --git a/.yarn/cache/karma-npm-6.4.1-5443d36ee9-24faabfaf0.zip b/.yarn/cache/karma-npm-6.4.1-5443d36ee9-24faabfaf0.zip deleted file mode 100644 index 755877b272e..00000000000 Binary files a/.yarn/cache/karma-npm-6.4.1-5443d36ee9-24faabfaf0.zip and /dev/null differ diff --git a/.yarn/cache/karma-npm-6.4.3-c1db2b322c-7fc194f5d4.zip b/.yarn/cache/karma-npm-6.4.3-c1db2b322c-7fc194f5d4.zip new file mode 100644 index 00000000000..601d8fc02b8 Binary files /dev/null and b/.yarn/cache/karma-npm-6.4.3-c1db2b322c-7fc194f5d4.zip differ diff --git a/.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip b/.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip deleted file mode 100644 index 5759347ee25..00000000000 Binary files a/.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip and /dev/null differ diff --git a/.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip b/.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip new file mode 100644 index 00000000000..7e71190c37e Binary files /dev/null and b/.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip differ diff --git a/.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip b/.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip deleted file mode 100644 index cd127a2e1b9..00000000000 Binary files a/.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip and /dev/null differ diff --git a/.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip b/.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip deleted file mode 100644 index da9d0e2dbc6..00000000000 Binary files a/.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip and /dev/null differ diff --git a/.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip b/.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip deleted file mode 100644 index db3898f3278..00000000000 Binary files a/.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip and /dev/null differ diff --git a/.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip b/.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip new file mode 100644 index 00000000000..61a88c7c69d Binary files /dev/null and b/.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip differ diff --git a/.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip b/.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip deleted file mode 100644 index 7ce99cd2f47..00000000000 Binary files a/.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip and /dev/null differ diff --git a/.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip b/.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip deleted file mode 100644 index 3a742326aa5..00000000000 Binary files a/.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip and /dev/null differ diff --git a/.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip b/.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip new file mode 100644 index 00000000000..4c88fb60ce3 Binary files /dev/null and b/.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip differ diff --git a/.yarn/cache/nan-npm-2.20.0-5b5be83e88-5f16e4c995.zip b/.yarn/cache/nan-npm-2.20.0-5b5be83e88-5f16e4c995.zip new file mode 100644 index 00000000000..080a5ceb714 Binary files /dev/null and b/.yarn/cache/nan-npm-2.20.0-5b5be83e88-5f16e4c995.zip differ diff --git a/.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip b/.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip deleted file mode 100644 index f80933576c9..00000000000 Binary files a/.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip and /dev/null differ diff --git a/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip b/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip deleted file mode 100644 index fae851e6bd2..00000000000 Binary files a/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip and /dev/null differ diff --git a/.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip b/.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip new file mode 100644 index 00000000000..11d8442b2b5 Binary files /dev/null and b/.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip differ diff --git a/.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip b/.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip deleted file mode 100644 index 10a74fec69a..00000000000 Binary files a/.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip and /dev/null differ diff --git a/.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip b/.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip new file mode 100644 index 00000000000..40cc3d66f37 Binary files /dev/null and b/.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip differ diff --git a/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip b/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip deleted file mode 100644 index 57b8b2b964e..00000000000 Binary files a/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip and /dev/null differ diff --git a/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip b/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip deleted file mode 100644 index f841d7b38ca..00000000000 Binary files a/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip and /dev/null differ diff --git a/.yarn/cache/resolve-npm-1.22.0-f641ddcc95-b2f7405d30.zip b/.yarn/cache/resolve-npm-1.22.0-f641ddcc95-b2f7405d30.zip deleted file mode 100644 index 0e9cb9ba4b9..00000000000 Binary files a/.yarn/cache/resolve-npm-1.22.0-f641ddcc95-b2f7405d30.zip and /dev/null differ diff --git a/.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip b/.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip deleted file mode 100644 index 3883e5aa27d..00000000000 Binary files a/.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip and /dev/null differ diff --git a/.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip b/.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip deleted file mode 100644 index e62f91d938a..00000000000 Binary files a/.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip and /dev/null differ diff --git a/.yarn/cache/socket.io-adapter-npm-2.4.0-36a74a6ea1-e10c8c36a1.zip b/.yarn/cache/socket.io-adapter-npm-2.4.0-36a74a6ea1-e10c8c36a1.zip deleted file mode 100644 index 898ffcf179c..00000000000 Binary files a/.yarn/cache/socket.io-adapter-npm-2.4.0-36a74a6ea1-e10c8c36a1.zip and /dev/null differ diff --git a/.yarn/cache/socket.io-adapter-npm-2.5.5-7a0505537f-e364733a4c.zip b/.yarn/cache/socket.io-adapter-npm-2.5.5-7a0505537f-e364733a4c.zip new file mode 100644 index 00000000000..8645bbec5e0 Binary files /dev/null and b/.yarn/cache/socket.io-adapter-npm-2.5.5-7a0505537f-e364733a4c.zip differ diff --git a/.yarn/cache/socket.io-npm-4.5.2-11f9913f37-872605db0f.zip b/.yarn/cache/socket.io-npm-4.5.2-11f9913f37-872605db0f.zip deleted file mode 100644 index d53d3f6ddd7..00000000000 Binary files a/.yarn/cache/socket.io-npm-4.5.2-11f9913f37-872605db0f.zip and /dev/null differ diff --git a/.yarn/cache/socket.io-npm-4.7.5-7db6120b90-911528f5bf.zip b/.yarn/cache/socket.io-npm-4.7.5-7db6120b90-911528f5bf.zip new file mode 100644 index 00000000000..7fad0bb2ff8 Binary files /dev/null and b/.yarn/cache/socket.io-npm-4.7.5-7db6120b90-911528f5bf.zip differ diff --git a/.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip b/.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip deleted file mode 100644 index 8327fc3d21a..00000000000 Binary files a/.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip and /dev/null differ diff --git a/.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip b/.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip deleted file mode 100644 index 51cba2db5b1..00000000000 Binary files a/.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip and /dev/null differ diff --git a/.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip b/.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip new file mode 100644 index 00000000000..95c8964f1f7 Binary files /dev/null and b/.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip differ diff --git a/.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip b/.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip deleted file mode 100644 index e3bc38bd01e..00000000000 Binary files a/.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip and /dev/null differ diff --git a/.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip b/.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip new file mode 100644 index 00000000000..3e6b96b97df Binary files /dev/null and b/.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip differ diff --git a/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip b/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip deleted file mode 100644 index 843c03ebe9d..00000000000 Binary files a/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip and /dev/null differ diff --git a/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip b/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip deleted file mode 100644 index c8b07fbc771..00000000000 Binary files a/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip and /dev/null differ diff --git a/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip b/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip deleted file mode 100644 index 0fb7c079b82..00000000000 Binary files a/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip and /dev/null differ diff --git a/.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip b/.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip deleted file mode 100644 index ae491693d14..00000000000 Binary files a/.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip and /dev/null differ diff --git a/.yarn/cache/systeminformation-npm-5.22.11-e704a1605b-315cd3f2cc.zip b/.yarn/cache/systeminformation-npm-5.22.11-e704a1605b-315cd3f2cc.zip new file mode 100644 index 00000000000..0160773949a Binary files /dev/null and b/.yarn/cache/systeminformation-npm-5.22.11-e704a1605b-315cd3f2cc.zip differ diff --git a/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip b/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip deleted file mode 100644 index d7f57a7b2f8..00000000000 Binary files a/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip and /dev/null differ diff --git a/.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip b/.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip deleted file mode 100644 index 2ff4ab17413..00000000000 Binary files a/.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip and /dev/null differ diff --git a/.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip b/.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip new file mode 100644 index 00000000000..066f404767f Binary files /dev/null and b/.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip differ diff --git a/.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip b/.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip deleted file mode 100644 index 097601aaa45..00000000000 Binary files a/.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip and /dev/null differ diff --git a/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip b/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip deleted file mode 100644 index d6f40b2d786..00000000000 Binary files a/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip and /dev/null differ diff --git a/.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip b/.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip deleted file mode 100644 index 11112dd8937..00000000000 Binary files a/.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip and /dev/null differ diff --git a/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip b/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip deleted file mode 100644 index ef1370d4989..00000000000 Binary files a/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip and /dev/null differ diff --git a/.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip b/.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip deleted file mode 100644 index ce54109cc3a..00000000000 Binary files a/.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip and /dev/null differ diff --git a/.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip b/.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip deleted file mode 100644 index 337545a406a..00000000000 Binary files a/.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip and /dev/null differ diff --git a/.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip b/.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip new file mode 100644 index 00000000000..cd6b6f229ef Binary files /dev/null and b/.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip differ diff --git a/.yarnrc.yml b/.yarnrc.yml index 4f2712be643..f352a8cdaa3 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -6,6 +6,16 @@ enableGlobalCache: false npmPublishRegistry: "https://registry.npmjs.org" +npmAuditExcludePackages: + - rimraf # TODO: Update karma + - glob # TODO: Update karma + - inflight # TODO: Update karma + - braces # TODO: Update karma + - "@grpc/grpc-js" # TODO: Remove when gRPC stack is updated + - "@humanwhocodes/config-array" # TODO: Update eslint + - "@humanwhocodes/object-schema" # TODO: Update eslint + - elliptic # TODO: Update elliptic when fix for 1098397 is released + packageExtensions: "@dashevo/protobufjs@*": dependencies: diff --git a/CHANGELOG.md b/CHANGELOG.md index 70524e911c0..7a720210b67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,808 @@ +## [1.1.0-dev.1](https://github.com/dashpay/platform/compare/v1.0.2...v1.1.0-dev.1) (2024-08-13) + + +### ⚠ BREAKING CHANGES + +* masternode reward payouts are changed so previously created state won't be compatible (#2032) +* previously created networks won't be supported since genesis configuration is changed (#2042) +* added genesis core height in misc tree so previously created state won't be compatible (#2038) + +### Features + +* configure wait for ST result timeout ([#2045](https://github.com/dashpay/platform/issues/2045)) +* **dashmate:** configure tenderdash connections ([#2048](https://github.com/dashpay/platform/issues/2048)) +* **drive-abci:** skip state transition txs if time limit is reached on prepare_proposal ([#2041](https://github.com/dashpay/platform/issues/2041)) +* **platform:** store/fetch genesis core height in misc tree ([#2038](https://github.com/dashpay/platform/issues/2038)) +* **platform:** total credits on platform query and fix for reward distribution ([#2032](https://github.com/dashpay/platform/issues/2032)) + + +### Miscellaneous Chores + +* **dashmate:** update consensus params ([#2042](https://github.com/dashpay/platform/issues/2042)) +* **dashmate:** update tenderdash seed ([#2040](https://github.com/dashpay/platform/issues/2040)) +* ignore security vulnerability 1098397 ([#2044](https://github.com/dashpay/platform/issues/2044)) + +### [1.0.2](https://github.com/dashpay/platform/compare/v1.0.1...v1.0.2) (2024-07-31) + + +### Features + +* **dashmate:** a flag to keep data on reset ([#2026](https://github.com/dashpay/platform/issues/2026)) + + +### Bug Fixes + +* **dashmate:** status command shows tenderdash error before activation ([#2028](https://github.com/dashpay/platform/issues/2028)) +* **dashmate:** unnecessary core indexes are required ([#2025](https://github.com/dashpay/platform/issues/2025)) + +### [1.0.1](https://github.com/dashpay/platform/compare/v1.0.0...v1.0.1) (2024-07-29) + + +### Miscellaneous Chores + +* bump dash-spv version to 2.0.0 + +## [1.0.0](https://github.com/dashpay/platform/compare/v1.0.0-rc.2...v1.0.0) (2024-07-29) + + +### Features + +* sdk to return proofs if requested ([#2014](https://github.com/dashpay/platform/issues/2014)) + + +### Bug Fixes + +* **dashmate:** imported node is not starting ([#2009](https://github.com/dashpay/platform/issues/2009)) +* **dashmate:** remove `dash-cli` from protx registration instructions ([#2018](https://github.com/dashpay/platform/issues/2018)) +* epoch protocol version setting ([#2013](https://github.com/dashpay/platform/issues/2013)) + + +### Build System + +* update tenderdash to 1.1.0 ([#2017](https://github.com/dashpay/platform/issues/2017)) + + +### Miscellaneous Chores + +* **dashmate:** configure mainnet ([#2016](https://github.com/dashpay/platform/issues/2016)) +* update to GroveDB Version 1.0.0 ([#2015](https://github.com/dashpay/platform/issues/2015)) + +## [1.0.0-rc.2](https://github.com/dashpay/platform/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2024-07-25) + + +### ⚠ BREAKING CHANGES + +* **platform:** genesis state from core block time (#2003) + +### Features + +* specify transition names within documents batch ([#2007](https://github.com/dashpay/platform/issues/2007)) + + +### Bug Fixes + +* dpns js sdk fix for identity record rename ([#2001](https://github.com/dashpay/platform/issues/2001)) +* **platform:** core info is lost between genesis and first block ([#2004](https://github.com/dashpay/platform/issues/2004)) +* **platform:** genesis state from core block time ([#2003](https://github.com/dashpay/platform/issues/2003)) +* sdk should ignore transient fields when verifying proofs ([#2000](https://github.com/dashpay/platform/issues/2000)) +* **strategy-tests:** document delete transitions were not selecting identity correctly +* two error messages had typos ([#2005](https://github.com/dashpay/platform/issues/2005)) + + +### Miscellaneous Chores + +* **dashmate:** update genesis config to the latest testnet ([#1998](https://github.com/dashpay/platform/issues/1998)) + + +### Build System + +* update to tenderdash 1.1.0-dev.3, rs-tenderdash-abci 1.1.0-dev.1 ([#2008](https://github.com/dashpay/platform/issues/2008)) + +## [1.0.0-rc.1](https://github.com/dashpay/platform/compare/v1.0.0-beta.4...v1.0.0-rc.1) (2024-07-24) + + +### ⚠ BREAKING CHANGES + +* **platform:** system data contracts should not have an owner (#1992) +* **platform:** transient properties (#1990) +* **platform:** document types should not have a contested unique index with a unique index (#1984) +* **platform:** add hyphen to match for contested documents on Dashpay (#1982) + +### Features + +* **drive:** added config for grovedb verify on startup ([#1975](https://github.com/dashpay/platform/issues/1975)) +* **platform:** system data contracts should not have an owner ([#1992](https://github.com/dashpay/platform/issues/1992)) +* **platform:** transient properties ([#1990](https://github.com/dashpay/platform/issues/1990)) +* use all eligible identities and slightly more robust checking + + +### Bug Fixes + +* **dapi:** can't parse masternode list diff ([#1988](https://github.com/dashpay/platform/issues/1988)) +* **drive:** unknown mn_rr fork height ([#1994](https://github.com/dashpay/platform/issues/1994)) +* improve efficiency of identity random sampling +* only clone the eligible identities +* **platform:** add hyphen to match for contested documents on Dashpay ([#1982](https://github.com/dashpay/platform/issues/1982)) +* **platform:** document types should not have a contested unique index with a unique index ([#1984](https://github.com/dashpay/platform/issues/1984)) +* select random identities for strategy documents +* spent asset lock estimated fees, and misc ([#1993](https://github.com/dashpay/platform/issues/1993)) +* **strategy-tests:** key ids for new identities with extra keys were not calculated properly ([#1991](https://github.com/dashpay/platform/issues/1991)) +* **strategy-tests:** transfer keys were being disabled ([#1995](https://github.com/dashpay/platform/issues/1995)) +* voting test + + +### Miscellaneous Chores + +* chose capable identities for random documents +* **dapi:** enable logger for reconnectable stream ([#1986](https://github.com/dashpay/platform/issues/1986)) + + +### Build System + +* update tenderdash to 1.1.0-dev.1 ([#1985](https://github.com/dashpay/platform/issues/1985)) +* update tenderdash to 1.1.0-dev.2 ([#1996](https://github.com/dashpay/platform/issues/1996)) + +## [1.0.0-beta.4](https://github.com/dashpay/platform/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2024-07-19) + + +### ⚠ BREAKING CHANGES + +* **drive:** don't use `0.0.0.0` as default listen IP (#1976) + +### Bug Fixes + +* **dashmate:** configure devnet quorums ([#1979](https://github.com/dashpay/platform/issues/1979)) +* **drive:** drive and tenderdash are constantly restarting ([#1978](https://github.com/dashpay/platform/issues/1978)) +* expected service to be a string with ip address and port ([#1980](https://github.com/dashpay/platform/issues/1980)) + + +### Code Refactoring + +* **drive:** don't use private bound for public trait ([#1974](https://github.com/dashpay/platform/issues/1974)) + + +### Miscellaneous Chores + +* **drive:** don't use `0.0.0.0` as default listen IP ([#1976](https://github.com/dashpay/platform/issues/1976)) + +## [1.0.0-beta.3](https://github.com/dashpay/platform/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2024-07-17) + + +### ⚠ BREAKING CHANGES + +* **platform:** updated fees (#1971) +* **platform:** max field size and some clean up of versioning (#1970) + +### Features + +* **dpp:** decomposed integer types for document type properties ([#1968](https://github.com/dashpay/platform/issues/1968)) +* **platform:** max field size and some clean up of versioning ([#1970](https://github.com/dashpay/platform/issues/1970)) + + +### Continuous Integration + +* fix release docker images ([#1969](https://github.com/dashpay/platform/issues/1969)) + + +### Miscellaneous Chores + +* activate platform on EHF fork ([#1972](https://github.com/dashpay/platform/issues/1972)) +* add comments to the platform.proto file ([#1641](https://github.com/dashpay/platform/issues/1641)) +* **platform:** updated fees ([#1971](https://github.com/dashpay/platform/issues/1971)) + +## [1.0.0-beta.2](https://github.com/dashpay/platform/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2024-07-16) + + +### Continuous Integration + +* fix docker build for release ([#1965](https://github.com/dashpay/platform/issues/1965)) + +## [1.0.0-beta.1](https://github.com/dashpay/platform/compare/v1.0.0-dev.16...v1.0.0-beta.1) (2024-07-16) + + +### ⚠ BREAKING CHANGES + +* **platform:** disable credit withdrawals in V1 (#1961) +* **drive-abci:** rotate quorums when all quorums members have had a chance to propose a block (#1942) +* allowed to make required fields optional (#1919) +* **dpp:** data contract validation issues (#1851) +* **platform:** proofs v1 support (#1934) +* **dpp:** do not allow `dependentSchemas` (#1888) +* **sdk:** impl Fetch/FetchMany for masternode voting endpoints (#1864) + +### Features + +* contender serialization ([#1882](https://github.com/dashpay/platform/issues/1882)) +* **dashmate:** import existing Core data ([#1915](https://github.com/dashpay/platform/issues/1915)) +* **dashmate:** verify system requirements ([#1914](https://github.com/dashpay/platform/issues/1914)) +* **drive-abci:** rotate quorums when all quorums members have had a chance to propose a block ([#1942](https://github.com/dashpay/platform/issues/1942)) +* **drive:** platform version patching and state migrations ([#1941](https://github.com/dashpay/platform/issues/1941)) +* integrate grovedb visualizer ([#1933](https://github.com/dashpay/platform/issues/1933)) +* **platform:** proofs v1 support ([#1934](https://github.com/dashpay/platform/issues/1934)) +* **platform:** update to versioned grove db ([#1943](https://github.com/dashpay/platform/issues/1943)) +* remove votes of removed masternodes when collateral is moved ([#1894](https://github.com/dashpay/platform/issues/1894)) +* **sdk:** impl Fetch/FetchMany for masternode voting endpoints ([#1864](https://github.com/dashpay/platform/issues/1864)) +* **sdk:** support mocking of error responses ([#1926](https://github.com/dashpay/platform/issues/1926)) +* versioning of action conversion ([#1957](https://github.com/dashpay/platform/issues/1957)) + + +### Bug Fixes + +* Abstain and Lock trees for votes are now always first and fixed some limits ([#1921](https://github.com/dashpay/platform/issues/1921)) +* added description keyword to schema for contested index +* allowed to make required fields optional ([#1919](https://github.com/dashpay/platform/issues/1919)) +* build broken after merge of contested unique indexes validation ([#1892](https://github.com/dashpay/platform/issues/1892)) +* cleanup fix and remove identitiesIdsOnly Vote State query ([#1890](https://github.com/dashpay/platform/issues/1890)) +* contested document resolution fixes 2 and improvement to masternode vote ([#1904](https://github.com/dashpay/platform/issues/1904)) +* contested resources query fixes ([#1896](https://github.com/dashpay/platform/issues/1896)) +* contested unique indexes can only be on non mutable document types ([#1891](https://github.com/dashpay/platform/issues/1891)) +* **dashmate:** cannot read properties of null (reading '1') ([#1939](https://github.com/dashpay/platform/issues/1939)) +* **dashmate:** restart platform waits for DKG ([#1944](https://github.com/dashpay/platform/issues/1944)) +* **dpp:** data contract validation issues ([#1851](https://github.com/dashpay/platform/issues/1851)) +* **dpp:** document factory wouldn't allow delete transitions for immutable document types ([#1956](https://github.com/dashpay/platform/issues/1956)) +* **drive:** add validation that an identity can not apply to be a contender in a contest twice. ([#1923](https://github.com/dashpay/platform/issues/1923)) +* **drive:** contested document resolution with masternode voting batch empty fix ([#1880](https://github.com/dashpay/platform/issues/1880)) +* **drive:** panic if PlatformState has serialisation error ([#1945](https://github.com/dashpay/platform/issues/1945)) +* **drive:** valid instant lock signatures marked as invalid ([#1946](https://github.com/dashpay/platform/issues/1946)) +* duplicate fields defined in DPNS contract +* final clean up and fixing of contested resource voting PR +* fixed voting strategy tests and cleanup +* import fix for drive refactoring ([#1959](https://github.com/dashpay/platform/issues/1959)) +* incorrect proofs are returned for various state transitions ([#1912](https://github.com/dashpay/platform/issues/1912)) +* merkle root hash verification failed on devnet ([#1929](https://github.com/dashpay/platform/issues/1929)) +* minor issues detected by github actions ([#1928](https://github.com/dashpay/platform/issues/1928)) +* **sdk:** panic GrpcContextProvider on async call inside sync code ([#1870](https://github.com/dashpay/platform/issues/1870)) +* **sdk:** state transition broadcast missing contract provider ([#1913](https://github.com/dashpay/platform/issues/1913)) +* small fix fixing compilation +* small fix for test: test_document_creation_on_contested_unique_index +* some document error messages didnt specify the corresponding property ([#1873](https://github.com/dashpay/platform/issues/1873)) +* sum tree verification with specialized balances ([#1899](https://github.com/dashpay/platform/issues/1899)) +* voting proofs work as intended and various fixes ([#1910](https://github.com/dashpay/platform/issues/1910)) + + +### Build System + +* update rs-tenderdash-abci to 1.0.0-dev.1 ([#1909](https://github.com/dashpay/platform/issues/1909)) +* upgrade rs-tenderdash-abci to v1.0.0 and tenderdash to v1.0.0 ([#1918](https://github.com/dashpay/platform/issues/1918)) +* use ubuntu-platform github runner hardware for all github actions ([#1920](https://github.com/dashpay/platform/issues/1920)) + + +### Styles + +* **drive:** update formatting + + +### Tests + +* fix documentTransition.hasPrefundedBalance is not a function ([#1931](https://github.com/dashpay/platform/issues/1931)) +* **sdk:** disable failing tests for bugs scheduled for future ([#1930](https://github.com/dashpay/platform/issues/1930)) +* **sdk:** increase test coverage of masternode voting ([#1906](https://github.com/dashpay/platform/issues/1906)) +* **sdk:** masternode voting SDK tests ([#1893](https://github.com/dashpay/platform/issues/1893)) +* **sdk:** regenerate test vectors for masternode voting ([#1927](https://github.com/dashpay/platform/issues/1927)) +* temporary skip withdrawal tests + + +### Code Refactoring + +* changed Epoch serialization to make it slightly more efficient ([#1953](https://github.com/dashpay/platform/issues/1953)) +* cleanup of warnings and fix tests +* extract document faker to crate ([#1887](https://github.com/dashpay/platform/issues/1887)) +* fees to use version system ([#1911](https://github.com/dashpay/platform/issues/1911)) +* final drive refactoring ([#1958](https://github.com/dashpay/platform/issues/1958)) +* move rs-random-document to separate crate ([#1952](https://github.com/dashpay/platform/issues/1952)) +* multiplier to version system and tests for refunds ([#1950](https://github.com/dashpay/platform/issues/1950)) +* rename DriveQuery to DriveDocumentQuery ([#1954](https://github.com/dashpay/platform/issues/1954)) +* use library for feature version ([#1938](https://github.com/dashpay/platform/issues/1938)) + + +### Continuous Integration + +* explicitly authenticate AWS ([#1960](https://github.com/dashpay/platform/issues/1960)) + + +### Miscellaneous Chores + +* autogenerated grpc code +* better logging for devnet upgrade protocol test ([#1925](https://github.com/dashpay/platform/issues/1925)) +* **dashmate:** core RPC platform services authentication ([#1883](https://github.com/dashpay/platform/issues/1883)) +* **dashmate:** enable Core RPC whitelists ([#1962](https://github.com/dashpay/platform/issues/1962)) +* **dashmate:** provide debug information if version check fails ([#1936](https://github.com/dashpay/platform/issues/1936)) +* **dpp:** do not allow `dependentSchemas` ([#1888](https://github.com/dashpay/platform/issues/1888)) +* **drive:** additional logging and minor refactoring ([#1947](https://github.com/dashpay/platform/issues/1947)) +* **platform:** disable credit withdrawals in V1 ([#1961](https://github.com/dashpay/platform/issues/1961)) +* removed unused dpp code on state transition actions (old duplicate) ([#1955](https://github.com/dashpay/platform/issues/1955)) +* renamed back vote_choices to votes on places where it had been incorrectly changed +* revisit system data contracts ([#1889](https://github.com/dashpay/platform/issues/1889)) +* temp squash of masternode voting into higher branch ([#1877](https://github.com/dashpay/platform/issues/1877)) +* update Cargo lock +* update masternode voting tests after merging in v1 +* update to latest GroveDB (Proofs v1) +* update to latest grovedb 1.0.0-rc.2 ([#1948](https://github.com/dashpay/platform/issues/1948)) +* validate that contested index is unique ([#1881](https://github.com/dashpay/platform/issues/1881)) + + +### Documentation + +* add llvm to README.md ([#1908](https://github.com/dashpay/platform/issues/1908)) +* badge link for CI was broken in README.md ([#1932](https://github.com/dashpay/platform/issues/1932)) +* update readme to add cmake ([#1837](https://github.com/dashpay/platform/issues/1837)) + +## [1.0.0-dev.16](https://github.com/dashpay/platform/compare/v1.0.0-dev.15...v1.0.0-dev.16) (2024-06-29) + + +### ⚠ BREAKING CHANGES + +* **drive:** verify instant lock signatures with Drive (#1875) +* **dapi:** replace `getMnListDiff` with a streaming endpoint (#1859) +* **dapi:** disable unnecessary for v1 endpoints (#1857) +* **sdk:** dapi-grpc generated files overwritten on conflicting features (#1854) + +### Features + +* **dapi:** introduce `getBestBlockHeight` endpoint ([#1863](https://github.com/dashpay/platform/issues/1863)) +* **dpp:** random documents based on JSON schema ([#1710](https://github.com/dashpay/platform/issues/1710)) +* make data contract factory and json schema validator public + + +### Bug Fixes + +* **dashmate:** background SSL renewal stuck on error ([#1897](https://github.com/dashpay/platform/issues/1897)) +* **dashmate:** failed to read docker data on update ([#1903](https://github.com/dashpay/platform/issues/1903)) +* **sdk:** dapi-grpc generated files overwritten on conflicting features ([#1854](https://github.com/dashpay/platform/issues/1854)) +* **sdk:** invalid error returned when identity create fails ([#1856](https://github.com/dashpay/platform/issues/1856)) +* security vulnerabilities in NPM deps ([#1860](https://github.com/dashpay/platform/issues/1860)) +* validator field didn't need to be public for JsonSchemaValidator + + +### Performance Improvements + +* **dapi:** cache `getBestBlockHash` endpoint ([#1867](https://github.com/dashpay/platform/issues/1867)) +* **dapi:** cache `getBlockchainStatus` endpoint ([#1866](https://github.com/dashpay/platform/issues/1866)) +* **dapi:** get many transactions at once ([#1858](https://github.com/dashpay/platform/issues/1858)) +* **dapi:** replace `getMnListDiff` with a streaming endpoint ([#1859](https://github.com/dashpay/platform/issues/1859)) +* **dapi:** use cached core height in streaming endpoints ([#1865](https://github.com/dashpay/platform/issues/1865)) +* **drive:** verify instant lock signatures with Drive ([#1875](https://github.com/dashpay/platform/issues/1875)) + + +### Miscellaneous Chores + +* **dapi:** disable unnecessary for v1 endpoints ([#1857](https://github.com/dashpay/platform/issues/1857)) +* mute NPM audit warnings ([#1879](https://github.com/dashpay/platform/issues/1879)) +* update Karma to recent version ([#1901](https://github.com/dashpay/platform/issues/1901)) +* update websocket client ([#1895](https://github.com/dashpay/platform/issues/1895)) + + +### Code Refactoring + +* **dpp:** change String and ByteArray DocumentPropertyType sizes to structs ([#1874](https://github.com/dashpay/platform/issues/1874)) +* **drive:** encapsulate chain lock validation quorum logic ([#1868](https://github.com/dashpay/platform/issues/1868)) + +## [1.0.0-dev.15](https://github.com/dashpay/platform/compare/v1.0.0-dev.14...v1.0.0-dev.15) (2024-05-22) + + +### Miscellaneous Chores + +* **drive:** state transition observability ([#1846](https://github.com/dashpay/platform/issues/1846)) + +## [1.0.0-dev.14](https://github.com/dashpay/platform/compare/v1.0.0-dev.13...v1.0.0-dev.14) (2024-05-17) + + +### ⚠ BREAKING CHANGES + +* Data Contract Create and Update transitions validation logic is changed so previously created block chain data might not be valid anymore (#1835) + +### Features + +* **dashmate:** check for DKG before stopping node ([#1683](https://github.com/dashpay/platform/issues/1683)) + + +### Bug Fixes + +* data contract transition validation issues ([#1835](https://github.com/dashpay/platform/issues/1835)) + + +### Code Refactoring + +* rename `DataContractConfig.validate_config_update` ([#1843](https://github.com/dashpay/platform/issues/1843)) +* rename `validate` to `full_validation` ([#1845](https://github.com/dashpay/platform/issues/1845)) + +## [1.0.0-dev.13](https://github.com/dashpay/platform/compare/v1.0.0-dev.12...v1.0.0-dev.13) (2024-05-09) + + +### ⚠ BREAKING CHANGES + +* **sdk:** don't return Arc in SdkBuilder (#1838) +* **platform:** document creation/update/deletion does not refetch contract (#1840) + +### Features + +* **dashmate:** handle docker pull error on images update ([#1685](https://github.com/dashpay/platform/issues/1685)) +* make document tranfers public +* make start identities number u16 +* make purchase document public +* make sdk document purchases public ([#1832](https://github.com/dashpay/platform/issues/1832)) +* make sdk files public +* put index serialization behind feature +* serialize for indexes and change error messages to strings +* use all current identities for strategy test state transitions ([#1820](https://github.com/dashpay/platform/issues/1820)) + + +### Bug Fixes + +* **platform:** npm audit security fix ([#1836](https://github.com/dashpay/platform/issues/1836)) + + +### Code Refactoring + +* **platform:** document creation/update/deletion does not refetch contract ([#1840](https://github.com/dashpay/platform/issues/1840)) +* **sdk:** don't return Arc in SdkBuilder ([#1838](https://github.com/dashpay/platform/issues/1838)) + + +### Miscellaneous Chores + +* observability and security for HTTP gateway ([#1825](https://github.com/dashpay/platform/issues/1825)) + +## [1.0.0-dev.12](https://github.com/dashpay/platform/compare/v1.0.0-dev.11...v1.0.0-dev.12) (2024-04-29) + + +### ⚠ BREAKING CHANGES + +* Removed `getIdentities` and `getIdentitiesByPublicKeyHashes` endpoints in favor of `getIdentitiesContractKeys` (#1766) +* **platform:** basic nft support (#1829) +* **dapi:** `getStatus` is removed in favor of `getMasternodeStatus` and `getBlockchainStatus` (#1812) +* **platform:** documents serialization format is changed that makes previously created block chain data invalid (#1826) + +### Features + +* **dapi:** split getStatus into two endpoints ([#1812](https://github.com/dashpay/platform/issues/1812)) +* **drive-abci:** configure dir to store rejected txs ([#1823](https://github.com/dashpay/platform/issues/1823)) +* getIdentitiesContractKeys endpoint ([#1766](https://github.com/dashpay/platform/issues/1766)) +* **platform:** ability to transfer documents ([#1826](https://github.com/dashpay/platform/issues/1826)) +* **platform:** basic nft support ([#1829](https://github.com/dashpay/platform/issues/1829)) +* **sdk:** add query for data contract history ([#1787](https://github.com/dashpay/platform/issues/1787)) +* **wallet-lib:** optional sync of the account ([#1830](https://github.com/dashpay/platform/issues/1830)) + + +### Bug Fixes + +* add tls-webpki-roots to support tls on mobile (Android, iOS) ([#1828](https://github.com/dashpay/platform/issues/1828)) + + +### Miscellaneous Chores + +* **dapi:** update autogenerated clients ([#1827](https://github.com/dashpay/platform/issues/1827)) +* **dashmate:** limit concurrent state transition checks ([#1824](https://github.com/dashpay/platform/issues/1824)) + +## [1.0.0-dev.10](https://github.com/dashpay/platform/compare/v1.0.0-dev.9...v1.0.0-dev.10) (2024-04-04) + + +### ⚠ BREAKING CHANGES + +There are multiple breaking changes that make previously created state invalid: +* **drive:** addition key-value in epoch trees (#1778) +* **platform:** processing costs were updated for some state transitions (#1805, #1800) +* **drive:** now we count and persist a version proposal vote on the epoch change (#1769) +* **drive:** protocol version for the first block of an epoch might be different (#1769) +* **platform:** ST validation was changed, as well as some constants (#1796, #1795) +* **dpp:** document type name must be 1 to 64 alphanumeric chars and "_", or "-" (#1798) +* **platform:** max state transition is 20 kB (#1792) + +### Features + +* **dpp:** validate document type name ([#1798](https://github.com/dashpay/platform/issues/1798)) +* **drive-abci:** better processing costs of state transitions (no schema processing improvements) ([#1800](https://github.com/dashpay/platform/issues/1800)) +* **drive:** provide protocol version in epoch info query ([#1778](https://github.com/dashpay/platform/issues/1778)) +* pass asset lock vector rather than callback in strategies +* **platform:** improved state processing fees ([#1805](https://github.com/dashpay/platform/issues/1805)) +* **platform:** mitigate issues of asset lock based transitions ([#1796](https://github.com/dashpay/platform/issues/1796)) +* **platform:** various document validation improvements ([#1795](https://github.com/dashpay/platform/issues/1795)) +* **strategy-tests:** add extra_keys field for StartIdentities and use random identities for transfers ([#1794](https://github.com/dashpay/platform/issues/1794)) + + +### Bug Fixes + +* **drive:** no longer build full grovedb when using verify feature ([#1804](https://github.com/dashpay/platform/issues/1804)) +* **drive:** versioning issues on epoch change ([#1769](https://github.com/dashpay/platform/issues/1769)) +* **platform:** max state transition size ([#1792](https://github.com/dashpay/platform/issues/1792)) +* **sdk:** not bumping nonce on contract creation ([#1801](https://github.com/dashpay/platform/issues/1801)) +* state transition already in chain error on low credit transfer amount ([#1797](https://github.com/dashpay/platform/issues/1797)) +* **strategy-tests:** default identity nonce and document op contract id ([#1777](https://github.com/dashpay/platform/issues/1777)) + + +### Performance Improvements + +* **platform:** use inline on versioned functions ([#1793](https://github.com/dashpay/platform/issues/1793)) + + +### Tests + +* added a test registering many random contracts in strategy tests ([#1791](https://github.com/dashpay/platform/issues/1791)) + + +### Miscellaneous Chores + +* **sdk:** export various libraries in rs-sdk ([#1802](https://github.com/dashpay/platform/issues/1802)) + +## [1.0.0-dev.9](https://github.com/dashpay/platform/compare/v1.0.0-dev.8...v1.0.0-dev.9) (2024-03-19) + + +### ⚠ BREAKING CHANGES + +* **sdk:** don't allow duplicate mock expectations (#1788) +* created_at and updated_at from block time (#1780) +* created_at_block_height and variants (#1784) + + +### Features + +* created_at and updated_at from block time ([#1780](https://github.com/dashpay/platform/issues/1780)) +* created_at_block_height and variants ([#1784](https://github.com/dashpay/platform/issues/1784)) + + +### Bug Fixes + +* **drive:** internal error on querying proofs ([#1747](https://github.com/dashpay/platform/issues/1747)) +* identity add keys in strategy tests ([#1727](https://github.com/dashpay/platform/issues/1727)) +* **sdk:** don't allow duplicate mock expectations ([#1788](https://github.com/dashpay/platform/issues/1788)) +* query retry on race condition ([#1776](https://github.com/dashpay/platform/issues/1776)) +* identity state transition validation fixes ([#1786](https://github.com/dashpay/platform/issues/1786)) + + +### Code Refactoring + +* make strategy start identities a new struct ([#1764](https://github.com/dashpay/platform/issues/1764)) +* updated descriptions and function names in strategy tests plus readme file ([#1785](https://github.com/dashpay/platform/issues/1785)) + + +### Miscellaneous Chores + +* **dashmate:** readme fixes ([#1624](https://github.com/dashpay/platform/issues/1624)) +* fix npm audit for follow-redirects package ([#1781](https://github.com/dashpay/platform/issues/1781)) +* **dapi:** use broadcast_tx instead of deprecated broadcast_tx_sync ([#1775](https://github.com/dashpay/platform/issues/1775)) + + +### Build System + +* rs-tenderdash-abci 0.14.0-dev.9 ([#1782](https://github.com/dashpay/platform/issues/1782)) + + +### Continuous Integration + +* enforce warnings as errors ([#1783](https://github.com/dashpay/platform/issues/1783)) +* update doc build branch in action config ([#1748](https://github.com/dashpay/platform/issues/1748)) + +## [1.0.0-dev.8](https://github.com/dashpay/platform/compare/v1.0.0-dev.7...v1.0.0-dev.8) (2024-03-14) + + +### ⚠ BREAKING CHANGES + +* **platform:** identity update can not disable a key it is also adding (#1772) +* **platform:** key disabled at based on state transition block time (#1771) +* **platform:** data contract validation improvements (#1768) +* update tenderdash to 0.14-dev.4 (#1770) +* **platform:** advanced data contract structure validation position (#1763) + +### Features + +* **platform:** identity update can not disable a key it is also adding ([#1772](https://github.com/dashpay/platform/issues/1772)) +* **platform:** key disabled at based on state transition block time ([#1771](https://github.com/dashpay/platform/issues/1771)) + + +### Bug Fixes + +* **platform:** advanced data contract structure validation position ([#1763](https://github.com/dashpay/platform/issues/1763)) +* **platform:** data contract validation improvements ([#1768](https://github.com/dashpay/platform/issues/1768)) +* **platform:** wrong state used to get current validator set ([#1773](https://github.com/dashpay/platform/issues/1773)) +* remove unnecessary clone +* update strategy test document transitions with initial contract ids + + +### Code Refactoring + +* **drive:** relax versioning of calls with fees ([#1762](https://github.com/dashpay/platform/issues/1762)) +* drop unused includes; use calculate_sign_hash ([#1767](https://github.com/dashpay/platform/issues/1767)) +* resolve various warnings during build or by clippy ([#1761](https://github.com/dashpay/platform/issues/1761)) +* strategy test start identities ([#1749](https://github.com/dashpay/platform/issues/1749)) + + +### Miscellaneous Chores + +* **dashmate:** upgrade to Core 20.1 ([#1760](https://github.com/dashpay/platform/issues/1760)) +* update tenderdash to 0.14-dev.4 ([#1770](https://github.com/dashpay/platform/issues/1770)) + +## [1.0.0-dev.7](https://github.com/dashpay/platform/compare/v1.0.0-dev.6...v1.0.0-dev.7) (2024-03-08) + + +### ⚠ BREAKING CHANGES + +* **platform:** addded fee increase field to state transitions (#1750) + +### Features + +* enable random contract creation in strategies ([#1729](https://github.com/dashpay/platform/issues/1729)) +* **platform:** state transition fee increase and priorities ([#1750](https://github.com/dashpay/platform/issues/1750)) + + +### Bug Fixes + +* **drive:** inconsistent platform state and version during ABCI calls ([#1733](https://github.com/dashpay/platform/issues/1733)) +* **drive:** internal error on querying specific identity keys ([#1728](https://github.com/dashpay/platform/issues/1728)) +* resolve strategy-tests test failures ([#1743](https://github.com/dashpay/platform/issues/1743)) + + +### Documentation + +* update and expand mkdocs redirects ([#1740](https://github.com/dashpay/platform/issues/1740)) + + +### Code Refactoring + +* **drive:** expose more groveDB internals ([#1739](https://github.com/dashpay/platform/issues/1739)) +* reduce cargo clippy warnings ([#1738](https://github.com/dashpay/platform/issues/1738)) +* reduce cargo clippy warnings ([#1741](https://github.com/dashpay/platform/issues/1741)) +* reduce cargo clippy warnings in rs-dpp ([#1742](https://github.com/dashpay/platform/issues/1742)) +* resolve a few clippy warnings in dapi-grpc, rs-drive-proof-verifier, rs-platform-serialization, rs-platform-serialization-derive, rs-platform-value, rs-sdk, strategy-tests ([#1756](https://github.com/dashpay/platform/issues/1756)) +* resolve a few clippy warnings in rs-platform-serializaation and rs-platform-value ([#1744](https://github.com/dashpay/platform/issues/1744)) +* resolve clippy warnings in rs-dpp ([#1754](https://github.com/dashpay/platform/issues/1754)) +* resolve clippy warnings in rs-drive ([#1752](https://github.com/dashpay/platform/issues/1752)) +* resolve clippy warnings in rs-drive-abci ([#1755](https://github.com/dashpay/platform/issues/1755)) +* resolve clippy warnings in wasm-dpp ([#1753](https://github.com/dashpay/platform/issues/1753)) + + +### Miscellaneous Chores + +* fmt ([#1751](https://github.com/dashpay/platform/issues/1751)) +* update testnet genesis and core nightly ([#1758](https://github.com/dashpay/platform/issues/1758)) + +## [1.0.0-dev.6](https://github.com/dashpay/platform/compare/v1.0.0-dev.5...v1.0.0-dev.6) (2024-03-05) + + +### ⚠ BREAKING CHANGES + +* **platform:** identity nonce for Data Contract Create (#1724) + +### Features + +* add ContractUpdate to used_contract_ids function +* **platform:** identity nonce for Data Contract Create ([#1724](https://github.com/dashpay/platform/issues/1724)) +* **sdk:** add fetch_current_with_metadata to ExtendedEpochInfo ([#1708](https://github.com/dashpay/platform/issues/1708)) +* **sdk:** fetch with metadata ([#1707](https://github.com/dashpay/platform/issues/1707)) +* **sdk:** re-fetch nonce on interval ([#1706](https://github.com/dashpay/platform/issues/1706)) + + +### Bug Fixes + +* **drive-abci:** reject reward shares operations ([#1722](https://github.com/dashpay/platform/issues/1722)) +* make strategy tests compatible with all networks and platform tui ([#1705](https://github.com/dashpay/platform/issues/1705)) +* **sdk:** nonce manager caching bug ([#1711](https://github.com/dashpay/platform/issues/1711)) +* **test-suite:** masternode identities ([#1709](https://github.com/dashpay/platform/issues/1709)) + + +### Performance Improvements + +* query and check tx parallel processing ([#1694](https://github.com/dashpay/platform/issues/1694)) + + +### Miscellaneous Chores + +* fix npm audit warning ([#1723](https://github.com/dashpay/platform/issues/1723)) + + +### Tests + +* **test-suite:** restore dpns tests ([#1725](https://github.com/dashpay/platform/issues/1725)) +* **test-suite:** withdrawals identityRecent index ([#1716](https://github.com/dashpay/platform/issues/1716)) + +## [1.0.0-dev.5](https://github.com/dashpay/platform/compare/v1.0.0-dev.4...v1.0.0-dev.5) (2024-02-20) + +### ⚠ BREAKING CHANGES + +* Identity nonce and identity contract nonces to prevent replay attacks (#1681) +* Improved check tx verification (#1681) +* Do not allow creating data contracts without documents (#1675) + +### Features + +* State transitions support in rust sdk (#1596) +* Mempool uniqueness by state transition identifiers (#1681) +* Remove ability to verify proofs from drive-abci in order to have a smaller package size and to reduce potential issues (#1699) +* Tenderdash mempool cache size config option (#1702) + +### Bug Fixes + +* Remove min core fee per byte check (#1690) +* Fix proof balance and revision proofs for IdentityTopUp (#1678) +* NPM IP package vulnerable to SSRF attacks (#1703) +* Fix for contract proofs (#1699) + +### Miscellaneous Chores +* Autogenerated clippy refactoring and fixes for rust version 1.76 (#1691) +* Bump protoc to 25.2 (#1692) + +## [1.0.0-dev.4](https://github.com/dashpay/platform/compare/v1.0.0-dev.3...v1.0.0-dev.4) (2024-02-07) + + +### ⚠ BREAKING CHANGES + +* The state now contains information about chain lock quorums (#1621) +* Minimal asset lock amount is introduced that makes previous data invalid (#1667) +* The initial state is changed (#1601) + + +### Features + +* chainlock optimized verification ([#1621](https://github.com/dashpay/platform/issues/1621)) +* **drive:** validate asset lock proof minimal value ([#1667](https://github.com/dashpay/platform/issues/1667)) +* **drive:** withdrawals finalization ([#1601](https://github.com/dashpay/platform/issues/1601)) + + +### Bug Fixes + +* **dashmate:** service status when tenderdash is syncing ([#1682](https://github.com/dashpay/platform/issues/1682)) +* **drive:** invalid protocol version is using to deserialize state ([#1679](https://github.com/dashpay/platform/issues/1679)) + + +### Miscellaneous Chores + +* **dashmate:** update to core v20.1.0-devpr5806.a1814ce2 ([#1665](https://github.com/dashpay/platform/issues/1665)) +* system data contracts versioning ([#1676](https://github.com/dashpay/platform/issues/1676)) +* update rs-tenderdash-abci to v0.14.0-dev.6 and tenderdash to v0.14.0-dev.2 ([#1686](https://github.com/dashpay/platform/issues/1686)) + +## [1.0.0-dev.3](https://github.com/dashpay/platform/compare/v1.0.0-dev.2...v1.0.0-dev.3) (2024-01-16) + + +### Bug Fixes + +* **dapi:** internal errors if broadcasting failed ([#1673](https://github.com/dashpay/platform/issues/1673)) + +## [1.0.0-dev.2](https://github.com/dashpay/platform/compare/v1.0.0-dev.1...v1.0.0-dev.2) (2024-01-12) + + +### ⚠ BREAKING CHANGES + +* **dashmate:** adjust consensus params and enable re-check (#1669) +* **drive-abci:** internal error if vote extension block is already committed (#1663) + +### Bug Fixes + +* broadcasting already invalidated transitions ([#1668](https://github.com/dashpay/platform/issues/1668)) +* **dashmate:** dapi kills host machine on container stop ([#1670](https://github.com/dashpay/platform/issues/1670)) +* **drive-abci:** internal error if vote extension block is already committed ([#1663](https://github.com/dashpay/platform/issues/1663)) + + +### Miscellaneous Chores + +* **dashmate:** adjust consensus params and enable re-check ([#1669](https://github.com/dashpay/platform/issues/1669)) +* **drive-abci:** fix state transition logging ([#1664](https://github.com/dashpay/platform/issues/1664)) +* various logging improvements ([#1666](https://github.com/dashpay/platform/issues/1666)) + +## [1.0.0-dev.1](https://github.com/dashpay/platform/compare/v0.25.21...v1.0.0-dev.1) (2024-01-11) + + +### ⚠ BREAKING CHANGES + +* invalid state transitions now included into blocks that makes previous chain data invalid. (#1657) +* credit transfer state transition requires revision. (#1634) +* calculated fee amounts are changed (#1656) + +### Features + +* **drive-abci:** include invalid state transitions into block ([#1657](https://github.com/dashpay/platform/issues/1657)) +* **drive-abci:** processing fees for signature verification ([#1656](https://github.com/dashpay/platform/issues/1656)) +* **drive-abci:** remove unnecessary validation from check tx and re-check ([#1647](https://github.com/dashpay/platform/issues/1647)) +* **sdk:** rs-sdk fetch current epoch ([#1604](https://github.com/dashpay/platform/issues/1604)) + + +### Bug Fixes + +* **platform:** credit transfer replay attack ([#1634](https://github.com/dashpay/platform/issues/1634)) +* **dapi**: internal error when mempool is full ([#1661](https://github.com/dashpay/platform/issues/1661)) + + +### Miscellaneous Chores + +* automatic clippy fixes ([#1528](https://github.com/dashpay/platform/issues/1528), [#1602](https://github.com/dashpay/platform/issues/1602)) + ### [0.25.21](https://github.com/dashpay/platform/compare/v0.25.20...v0.25.21) (2023-12-28) diff --git a/CODEOWNERS b/CODEOWNERS index 6bf6cba8c96..0af1265884e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @shumkov @antouhou @QuantumExplorer \ No newline at end of file +* @shumkov @QuantumExplorer \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f142933a6f7..c62a1878c17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -17,39 +17,63 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", - "serde", "version_check", ] [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom", "once_cell", + "serde", "version_check", "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -67,47 +91,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -115,21 +140,42 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arbitrary" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-io" @@ -179,20 +225,26 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -206,9 +258,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" @@ -217,13 +269,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper 0.1.2", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core 0.4.3", + "axum-macros", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", + "hyper-util", "itoa", "matchit", "memchr", @@ -232,10 +314,15 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", "tower", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -247,8 +334,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -256,12 +343,45 @@ dependencies = [ ] [[package]] -name = "backon" +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-macros" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1a6197b2120bb2185a267f6515038558b019e92b832bb0320e96d66268dcf9" +checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" dependencies = [ - "fastrand 1.9.0", + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.75", +] + +[[package]] +name = "backon" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d67782c3f868daa71d3533538e98a8e13713231969def7536e8039606fc46bf0" +dependencies = [ + "fastrand 2.1.0", "futures-core", "pin-project", "tokio", @@ -269,15 +389,15 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -290,15 +410,15 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.20.0" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.21.5" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -312,15 +432,6 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bincode" version = "2.0.0-rc.3" @@ -353,16 +464,46 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "prettyplease 0.2.15", + "prettyplease 0.2.20", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.41", + "syn 2.0.75", "which", ] +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "lazy_static", + "lazycell", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.75", +] + +[[package]] +name = "bip37-bloom-filter" +version = "0.1.0" +source = "git+https://github.com/dashpay/rs-bip37-bloom-filter?branch=develop#352fa2312fd6e0f47bf4cba3a67bfd78c3ba763b" +dependencies = [ + "bitvec", + "murmur3", + "thiserror", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -401,9 +542,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -419,15 +560,15 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.0" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", - "constant_time_eq", + "constant_time_eq 0.3.0", ] [[package]] @@ -442,9 +583,9 @@ dependencies = [ [[package]] name = "bls-dash-sys" version = "1.2.5" -source = "git+https://github.com/dashpay/bls-signatures?branch=develop#3540b8bbed47e04ed6f02eea2141bd62dae0c411" +source = "git+https://github.com/dashpay/bls-signatures?tag=v1.3.1#1c2fc79c19dc8041610c005e68d58bfb4bc32721" dependencies = [ - "bindgen", + "bindgen 0.65.1", "cc", "glob", ] @@ -452,7 +593,7 @@ dependencies = [ [[package]] name = "bls-signatures" version = "1.2.5" -source = "git+https://github.com/dashpay/bls-signatures?branch=develop#3540b8bbed47e04ed6f02eea2141bd62dae0c411" +source = "git+https://github.com/dashpay/bls-signatures?tag=v1.3.1#1c2fc79c19dc8041610c005e68d58bfb4bc32721" dependencies = [ "bls-dash-sys", "hex", @@ -462,9 +603,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.2.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9897ef0f1bd2362169de6d7e436ea2237dc1085d7d1e4db75f4be34d86f309d1" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" dependencies = [ "borsh-derive", "cfg_aliases", @@ -472,15 +613,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.2.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478b41ff04256c5c8330f3dfdaaae2a5cc976a8e75088bafa4625b0d0208de8c" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" dependencies = [ "once_cell", - "proc-macro-crate 2.0.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", "syn_derive", ] @@ -492,24 +633,24 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bs58" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ "tinyvec", ] [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytecheck" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -518,9 +659,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ "proc-macro2", "quote", @@ -529,9 +670,9 @@ dependencies = [ [[package]] name = "bytecount" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" +checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "byteorder" @@ -541,13 +682,23 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" dependencies = [ "serde", ] +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + [[package]] name = "bzip2-sys" version = "0.1.11+1.0.8" @@ -561,18 +712,18 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.6" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -598,12 +749,13 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.83" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -623,15 +775,22 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "check-features" +version = "1.1.0-dev.1" +dependencies = [ + "toml", +] [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -639,7 +798,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -666,11 +825,21 @@ dependencies = [ "half", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -690,9 +859,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -700,9 +869,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -712,46 +881,82 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "colored" -version = "1.9.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "concurrent-queue" -version = "2.4.0" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console-api" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd326812b3fd01da5bb1af7d340d0d555fd3d4b641e7f1dfcf5962a902952787" +dependencies = [ + "futures-core", + "prost 0.12.6", + "prost-types 0.12.6", + "tonic 0.10.2", + "tracing-core", +] + +[[package]] +name = "console-subscriber" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +checksum = "7481d4c57092cd1c19dd541b92bdce883de840df30aa5d03fd48a3935c01842e" dependencies = [ + "console-api", + "crossbeam-channel", "crossbeam-utils", + "futures-task", + "hdrhistogram", + "humantime", + "prost-types 0.12.6", + "serde", + "serde_json", + "thread_local", + "tokio", + "tokio-stream", + "tonic 0.10.2", + "tracing", + "tracing-core", + "tracing-subscriber", ] [[package]] @@ -760,6 +965,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "constant_time_eq" version = "0.3.0" @@ -784,24 +995,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -817,7 +1028,7 @@ dependencies = [ "clap 2.34.0", "criterion-plot", "csv", - "itertools", + "itertools 0.10.5", "lazy_static", "num-traits", "oorandom", @@ -839,50 +1050,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -917,16 +1120,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest", "fiat-crypto", - "platforms", "rustc_version", "subtle", "zeroize", @@ -940,38 +1142,40 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "dapi-grpc" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "dapi-grpc-macros", + "futures-core", "platform-version", - "prost 0.11.9", + "prost 0.12.6", "serde", "serde_bytes", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", - "tonic", - "tonic-build", + "serde_json", + "tenderdash-proto", + "tonic 0.11.0", + "tonic-build 0.9.2", ] [[package]] name = "dapi-grpc-macros" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "dapi-grpc", - "heck", + "heck 0.5.0", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "darling" -version = "0.20.3" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -979,33 +1183,72 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.41", + "syn 2.0.75", +] + +[[package]] +name = "dash-sdk" +version = "1.1.0-dev.1" +dependencies = [ + "arc-swap", + "async-trait", + "base64 0.22.1", + "bip37-bloom-filter", + "chrono", + "ciborium", + "clap 4.5.16", + "dapi-grpc", + "dapi-grpc-macros", + "dashcore-rpc", + "data-contracts", + "derive_more", + "dotenvy", + "dpp", + "drive", + "drive-proof-verifier", + "envy", + "futures", + "hex", + "http 0.2.12", + "lru", + "pollster", + "rs-dapi-client", + "sanitize-filename", + "serde", + "serde_json", + "test-case 3.3.1", + "thiserror", + "tokio", + "tokio-test", + "tokio-util", + "tracing", + "tracing-subscriber", ] [[package]] name = "dashcore" version = "0.30.0" -source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e76256edc5ca491163d9050ead0e0f50d5" +source = "git+https://github.com/dashpay/rust-dashcore?branch=master#a29315dbe56729be1be963fb6f7b60a22288663f" dependencies = [ "anyhow", "bech32", @@ -1021,16 +1264,16 @@ dependencies = [ [[package]] name = "dashcore-private" version = "0.1.0" -source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e76256edc5ca491163d9050ead0e0f50d5" +source = "git+https://github.com/dashpay/rust-dashcore?branch=master#a29315dbe56729be1be963fb6f7b60a22288663f" [[package]] name = "dashcore-rpc" -version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#016e3af953fe92e0e58a8fe2b3958334e318b6c0" +version = "0.15.2" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.4#bd6efdb850151f1dcd8e3f38d4796d18c5be518c" dependencies = [ "dashcore-private", "dashcore-rpc-json", - "env_logger 0.10.1", + "env_logger 0.10.2", "hex", "jsonrpc", "log", @@ -1040,10 +1283,10 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" -version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#016e3af953fe92e0e58a8fe2b3958334e318b6c0" +version = "0.15.2" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.4#bd6efdb850151f1dcd8e3f38d4796d18c5be518c" dependencies = [ - "bincode 2.0.0-rc.3", + "bincode", "dashcore", "hex", "serde", @@ -1055,7 +1298,7 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.12.0" -source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e76256edc5ca491163d9050ead0e0f50d5" +source = "git+https://github.com/dashpay/rust-dashcore?branch=master#a29315dbe56729be1be963fb6f7b60a22288663f" dependencies = [ "dashcore-private", "rs-x11-hash", @@ -1065,22 +1308,26 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] name = "data-contracts" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "dashpay-contract", "dpns-contract", "feature-flags-contract", "masternode-reward-shares-contract", "platform-value", + "platform-version", "serde_json", + "thiserror", "withdrawals-contract", ] @@ -1097,9 +1344,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -1107,25 +1354,36 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", ] [[package]] -name = "derive_more" -version = "0.99.17" +name = "derive_arbitrary" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", - "syn 1.0.109", + "syn 2.0.75", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.75", ] [[package]] @@ -1148,6 +1406,18 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] @@ -1164,20 +1434,23 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] name = "dpp" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "anyhow", + "assert_matches", "async-trait", - "base64 0.20.0", - "bincode 2.0.0-rc.3", + "base64 0.22.1", + "bincode", "bls-signatures", "bs58 0.4.0", "byteorder", @@ -1188,20 +1461,19 @@ dependencies = [ "derive_more", "dpp", "ed25519-dalek", - "enum-map", "env_logger 0.9.3", "getrandom", "hex", - "indexmap 2.1.0", - "integer-encoding 4.0.0", - "itertools", - "json-patch", - "jsonptr", + "indexmap 2.4.0", + "integer-encoding", + "itertools 0.12.1", + "json-schema-compatibility-validator", "jsonschema", "lazy_static", "log", "nohash-hasher", "num_enum", + "once_cell", "platform-serialization", "platform-serialization-derive", "platform-value", @@ -1216,18 +1488,20 @@ dependencies = [ "serde_json", "serde_repr", "sha2", - "test-case", + "strum 0.25.0", + "test-case 2.2.2", "thiserror", "tokio", ] [[package]] name = "drive" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ - "anyhow", - "base64 0.21.5", - "bs58 0.5.0", + "arc-swap", + "base64 0.22.1", + "bincode", + "bs58 0.5.1", "byteorder", "chrono", "ciborium", @@ -1239,13 +1513,16 @@ dependencies = [ "grovedb-costs", "grovedb-path", "grovedb-storage", + "grovedb-version", "hex", - "indexmap 1.9.3", - "integer-encoding 4.0.0", + "indexmap 2.4.0", + "integer-encoding", "intmap", - "itertools", + "itertools 0.11.0", "moka", "nohash-hasher", + "once_cell", + "parking_lot", "platform-version", "rand", "serde", @@ -1258,16 +1535,18 @@ dependencies = [ [[package]] name = "drive-abci" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ + "arc-swap", + "assert_matches", + "async-trait", "atty", - "base64 0.20.0", - "bincode 2.0.0-rc.3", - "bs58 0.4.0", - "bytes", + "base64 0.22.1", + "bincode", "chrono", "ciborium", - "clap 4.4.11", + "clap 4.5.16", + "console-subscriber", "dapi-grpc", "dashcore-rpc", "delegate", @@ -1275,18 +1554,19 @@ dependencies = [ "dotenvy", "dpp", "drive", + "drive-abci", "envy", "file-rotate", "hex", - "indexmap 1.9.3", - "integer-encoding 4.0.0", - "itertools", + "indexmap 2.4.0", + "integer-encoding", + "itertools 0.10.5", "lazy_static", "metrics", "metrics-exporter-prometheus", "mockall", "platform-version", - "prost 0.11.9", + "prost 0.12.6", "rand", "regex", "reopen", @@ -1295,12 +1575,10 @@ dependencies = [ "rust_decimal_macros", "serde", "serde_json", - "serde_with 3.4.0", - "sha2", "simple-signer", "strategy-tests", "tempfile", - "tenderdash-abci 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", + "tenderdash-abci", "thiserror", "tokio", "tokio-util", @@ -1312,16 +1590,19 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ + "bincode", "dapi-grpc", + "derive_more", "dpp", "drive", "hex", - "lazy_static", + "platform-serialization", + "platform-serialization-derive", "serde", "serde_json", - "tenderdash-abci 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "tenderdash-abci", "thiserror", "tracing", ] @@ -1359,9 +1640,9 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", @@ -1374,9 +1655,18 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "encoding_rs" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] [[package]] name = "enum-map" @@ -1395,7 +1685,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] @@ -1413,9 +1703,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -1441,9 +1731,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1488,12 +1778,13 @@ dependencies = [ [[package]] name = "fancy-regex" -version = "0.7.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" +checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" dependencies = [ "bit-set", - "regex", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -1507,29 +1798,31 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "feature-flags-contract" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "file-rotate" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf221ceec4517f3cb764dae3541b2bd87666fc8832e51322fbb97250b468c71" +checksum = "7a3ed82142801f5b1363f7d463963d114db80f467e860b1cd82228eaebc627a0" dependencies = [ "chrono", "flate2", @@ -1543,12 +1836,12 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -1575,6 +1868,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1586,9 +1894,9 @@ dependencies = [ [[package]] name = "fraction" -version = "0.9.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba3510011eee8825018be07f08d9643421de007eaf62a3bde58d89b058abfa7" +checksum = "0f158e3ff0a1b334408dc9fb811cd99b446986f4d8b741bb08f9df1604085ae7" dependencies = [ "lazy_static", "num", @@ -1614,9 +1922,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1629,9 +1937,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1639,15 +1947,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1656,9 +1964,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -1677,32 +1985,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1728,9 +2036,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -1741,9 +2049,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -1753,41 +2061,53 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "grovedb" -version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" dependencies = [ - "bincode 1.3.3", + "axum 0.7.5", + "bincode", + "bitvec", + "blake3", + "derive_more", "grovedb-costs", "grovedb-merk", "grovedb-path", "grovedb-storage", + "grovedb-version", "grovedb-visualize", + "grovedbg-types", "hex", - "indexmap 1.9.3", - "integer-encoding 3.0.4", + "hex-literal", + "indexmap 2.4.0", + "integer-encoding", "intmap", - "itertools", + "itertools 0.12.1", "nohash-hasher", - "serde", + "reqwest", + "sha2", "tempfile", "thiserror", + "tokio", + "tower-http", + "zip-extensions", ] [[package]] name = "grovedb-costs" -version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" dependencies = [ - "integer-encoding 3.0.4", + "integer-encoding", "intmap", "thiserror", ] [[package]] name = "grovedb-merk" -version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" dependencies = [ + "bincode", "blake3", "byteorder", "colored", @@ -1796,11 +2116,11 @@ dependencies = [ "grovedb-costs", "grovedb-path", "grovedb-storage", + "grovedb-version", "grovedb-visualize", "hex", - "indexmap 1.9.3", - "integer-encoding 3.0.4", - "jemallocator", + "indexmap 2.4.0", + "integer-encoding", "num_cpus", "rand", "thiserror", @@ -1809,50 +2129,87 @@ dependencies = [ [[package]] name = "grovedb-path" -version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" [[package]] name = "grovedb-storage" -version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" dependencies = [ "blake3", "grovedb-costs", "grovedb-path", "grovedb-visualize", "hex", - "integer-encoding 3.0.4", + "integer-encoding", "lazy_static", "num_cpus", "rocksdb", - "strum", + "strum 0.26.3", "tempfile", "thiserror", ] +[[package]] +name = "grovedb-version" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" +dependencies = [ + "thiserror", + "versioned-feature-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "grovedb-visualize" -version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" dependencies = [ "hex", - "itertools", + "itertools 0.12.1", +] + +[[package]] +name = "grovedbg-types" +version = "1.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=2c14841e95b4222d489f0655c85238bc05267b91#2c14841e95b4222d489f0655c85238bc05267b91" +dependencies = [ + "serde", + "serde_with 3.9.0", ] [[package]] name = "h2" -version = "0.3.22" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", - "indexmap 2.1.0", + "http 0.2.12", + "indexmap 2.4.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.4.0", "slab", "tokio", "tokio-util", @@ -1861,9 +2218,9 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" [[package]] name = "hashbrown" @@ -1871,23 +2228,31 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] name = "hashbrown" -version = "0.13.1" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", + "allocator-api2", ] [[package]] -name = "hashbrown" -version = "0.14.3" +name = "hdrhistogram" +version = "7.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d" +dependencies = [ + "base64 0.21.7", + "byteorder", + "flate2", + "nom", + "num-traits", +] [[package]] name = "heck" @@ -1895,6 +2260,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1906,9 +2277,15 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -1919,12 +2296,27 @@ dependencies = [ "serde", ] +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + [[package]] name = "hex_lit" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.9" @@ -1936,9 +2328,20 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1952,15 +2355,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] +[[package]] +name = "http-range-header" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a" + +[[package]] +name = "http-serde" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f560b665ad9f1572cfcaf034f7fb84338a7ce945216d64a90fd81f046a3caee" +dependencies = [ + "http 0.2.12", + "serde", +] + [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1976,45 +2418,119 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.7", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.4.1", + "hyper-util", + "rustls 0.23.12", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.30", "pin-project-lite", "tokio", "tokio-io-timeout", ] +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.4.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.4.1", + "pin-project-lite", + "socket2 0.5.7", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2062,35 +2578,38 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] [[package]] -name = "instant" -version = "0.1.12" +name = "inout" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "cfg-if", + "generic-array", ] [[package]] -name = "integer-encoding" -version = "3.0.4" +name = "instant" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] [[package]] name = "integer-encoding" -version = "4.0.0" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924df4f0e24e2e7f9cdd90babb0b96f93b20f3ecfa949ea9e6613756b8c8e1bf" +checksum = "0d762194228a2f1c11063e46e32e5acb96e66e906382b9eb5441f2e0504bbd5a" [[package]] name = "intmap" @@ -2107,7 +2626,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] @@ -2120,20 +2639,26 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi 0.3.3", - "rustix 0.38.28", - "windows-sys 0.48.0", + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "iso8601" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b94fbeb759754d87e1daea745bc8efd3037cd16980331fe1d1524c9a79ce96" +checksum = "924e5d73ea28f59011fec52a0d12185d496a9b075d360657aed2a5707f701153" dependencies = [ "nom", ] @@ -2148,36 +2673,34 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "1.0.10" +name = "itertools" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] [[package]] -name = "jemalloc-sys" -version = "0.5.4+5.3.0-patched" +name = "itertools" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac6c1946e1cea1788cbfde01c993b52a10e2da07f4bac608228d1bed20bfebf2" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ - "cc", - "libc", + "either", ] [[package]] -name = "jemallocator" -version = "0.5.4" +name = "itoa" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0de374a9f8e63150e6f5e8a60cc14c668226d7a347d8aee1a45766e3c4dd3bc" -dependencies = [ - "jemalloc-sys", - "libc", -] +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -2193,25 +2716,25 @@ dependencies = [ [[package]] name = "json-patch" -version = "0.2.7" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3fa5a61630976fc4c353c70297f2e93f1930e3ccee574d59d618ccbd5154ce" +checksum = "ec9ad60d674508f3ca8f380a928cfe7b096bc729c4e2dbfe3852bc45da3ab30b" dependencies = [ "serde", "serde_json", - "treediff 3.0.2", + "thiserror", ] [[package]] -name = "jsonptr" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e7a1ae7fc3e87c05f7a3de7e51083f62cdafcd9fed52cffebca22819a8f799" +name = "json-schema-compatibility-validator" +version = "1.1.0-dev.1" dependencies = [ - "serde", + "assert_matches", + "json-patch", + "json-schema-compatibility-validator", + "once_cell", "serde_json", - "uniresid", - "url", + "thiserror", ] [[package]] @@ -2227,20 +2750,21 @@ dependencies = [ [[package]] name = "jsonschema" -version = "0.15.0" -source = "git+https://github.com/fominok/jsonschema-rs?branch=feat-unevaluated-properties#18f61ab46b4a06fb313fadadffd669058bddeafd" +version = "0.18.0" +source = "git+https://github.com/dashpay/jsonschema-rs?branch=configure_regexp#7b00a2442ce44772e278b468bc4c2adc5e252226" dependencies = [ - "ahash 0.7.7", + "ahash 0.8.11", "anyhow", - "base64 0.13.1", + "base64 0.22.1", "bytecount", "fancy-regex", "fraction", + "getrandom", "iso8601", "itoa", - "lazy_static", "memchr", "num-cmp", + "once_cell", "parking_lot", "percent-encoding", "regex", @@ -2248,14 +2772,14 @@ dependencies = [ "serde_json", "time", "url", - "uuid 0.8.2", + "uuid", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lazycell" @@ -2265,33 +2789,33 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "lhash" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6df04c84bd3f83849dd23c51be4cbb22a02d80ebdea22741558fe30127d837ae" +checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "winapi", + "windows-targets 0.52.6", ] [[package]] name = "librocksdb-sys" -version = "0.11.0+8.1.1" +version = "0.16.0+8.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" dependencies = [ - "bindgen", + "bindgen 0.69.4", "bzip2-sys", "cc", "glob", @@ -2303,9 +2827,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" dependencies = [ "cc", "pkg-config", @@ -2320,31 +2844,46 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", ] +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "lru" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +dependencies = [ + "hashbrown 0.14.5", +] [[package]] name = "lz4-sys" -version = "1.9.4" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" dependencies = [ "cc", "libc", @@ -2352,19 +2891,21 @@ dependencies = [ [[package]] name = "mach2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" dependencies = [ "libc", ] [[package]] name = "masternode-reward-shares-contract" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] @@ -2384,71 +2925,53 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "memoffset" -version = "0.9.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "metrics" -version = "0.21.1" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" +checksum = "2be3cbd384d4e955b231c895ce10685e3d8260c5ccffae898c96c723b0772835" dependencies = [ - "ahash 0.8.6", - "metrics-macros", + "ahash 0.8.11", "portable-atomic", ] [[package]] name = "metrics-exporter-prometheus" -version = "0.12.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" +checksum = "5d58e362dc7206e9456ddbcdbd53c71ba441020e62104703075a69151e38d85f" dependencies = [ - "base64 0.21.5", - "hyper", - "indexmap 1.9.3", + "base64 0.22.1", + "http-body-util", + "hyper 1.4.1", + "hyper-tls", + "hyper-util", + "indexmap 2.4.0", "ipnet", "metrics", "metrics-util", - "quanta", + "quanta 0.12.3", "thiserror", "tokio", "tracing", ] -[[package]] -name = "metrics-macros" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", -] - [[package]] name = "metrics-util" -version = "0.15.1" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de2ed6e491ed114b40b732e4d1659a9d53992ebd87490c44a6ffe23739d973e" +checksum = "8b07a5eb561b8cbc16be2d216faf7757f9baf3bfb94dbb0fae3df8387a5bb47f" dependencies = [ "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.13.1", + "hashbrown 0.14.5", "metrics", "num_cpus", - "quanta", + "quanta 0.12.3", "sketches-ddsketch", ] @@ -2458,6 +2981,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2466,22 +2999,32 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" -version = "0.8.10" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2525,7 +3068,7 @@ dependencies = [ "futures-util", "once_cell", "parking_lot", - "quanta", + "quanta 0.11.1", "rustc_version", "scheduled-thread-pool", "skeptic", @@ -2533,7 +3076,7 @@ dependencies = [ "tagptr", "thiserror", "triomphe", - "uuid 1.6.1", + "uuid", ] [[package]] @@ -2542,6 +3085,35 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + +[[package]] +name = "murmur3" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252111cf132ba0929b6f8e030cac2a24b507f3a4d6db6fb2896f27b354c714b" + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -2576,9 +3148,9 @@ dependencies = [ [[package]] name = "num" -version = "0.2.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -2590,11 +3162,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -2607,40 +3178,44 @@ checksum = "63335b2e2c34fae2fb0aa2cecfd9f0832a1e24b3b32ecec612c3426d46dc8aaa" [[package]] name = "num-complex" -version = "0.2.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ - "autocfg", "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -2649,11 +3224,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -2661,9 +3235,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -2674,7 +3248,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "libc", ] @@ -2701,9 +3275,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -2716,9 +3290,35 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" -version = "11.1.3" +version = "11.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" + +[[package]] +name = "openssl" +version = "0.10.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] [[package]] name = "openssl-probe" @@ -2726,6 +3326,18 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "overload" version = "0.1.1" @@ -2740,9 +3352,9 @@ checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -2750,22 +3362,45 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash", + "sha2", +] [[package]] name = "peeking_take_while" @@ -2781,39 +3416,39 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.4.0", ] [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2833,38 +3468,38 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platform-serialization" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ - "bincode 2.0.0-rc.3", + "bincode", "platform-version", ] [[package]] name = "platform-serialization-derive" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", "virtue 0.0.14", ] [[package]] name = "platform-value" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ - "base64 0.13.1", - "bincode 2.0.0-rc.3", - "bs58 0.4.0", + "base64 0.22.1", + "bincode", + "bs58 0.5.1", "ciborium", "hex", - "indexmap 2.1.0", + "indexmap 2.4.0", "lazy_static", "platform-serialization", "platform-version", @@ -2873,44 +3508,42 @@ dependencies = [ "serde", "serde_json", "thiserror", - "treediff 4.0.2", + "treediff", ] [[package]] name = "platform-value-convertible" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "platform-version" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ + "bincode", + "grovedb-version", + "once_cell", "thiserror", + "versioned-feature-core 1.0.0 (git+https://github.com/dashpay/versioned-feature-core)", ] [[package]] name = "platform-versioning" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] -[[package]] -name = "platforms" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" - [[package]] name = "plotters" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" dependencies = [ "num-traits", "plotters-backend", @@ -2921,15 +3554,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" [[package]] name = "plotters-svg" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" dependencies = [ "plotters-backend", ] @@ -2950,11 +3583,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "pollster" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" + [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" [[package]] name = "powerfmt" @@ -2964,9 +3603,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "predicates" @@ -2976,7 +3618,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -2984,15 +3626,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" +checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" [[package]] name = "predicates-tree" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" dependencies = [ "predicates-core", "termtree", @@ -3020,12 +3662,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] @@ -3040,12 +3682,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.21.1", ] [[package]] @@ -3074,9 +3715,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -3093,12 +3734,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive 0.12.3", + "prost-derive 0.12.6", ] [[package]] @@ -3108,11 +3749,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", - "heck", - "itertools", + "heck 0.4.1", + "itertools 0.10.5", "lazy_static", "log", - "multimap", + "multimap 0.8.3", "petgraph", "prettyplease 0.1.25", "prost 0.11.9", @@ -3125,24 +3766,23 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck", - "itertools", + "heck 0.5.0", + "itertools 0.12.1", "log", - "multimap", + "multimap 0.10.0", "once_cell", "petgraph", - "prettyplease 0.2.15", - "prost 0.12.3", - "prost-types 0.12.3", + "prettyplease 0.2.20", + "prost 0.12.6", + "prost-types 0.12.6", "regex", - "syn 2.0.41", + "syn 2.0.75", "tempfile", - "which", ] [[package]] @@ -3152,7 +3792,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", @@ -3160,15 +3800,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] @@ -3182,11 +3822,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ - "prost 0.12.3", + "prost 0.12.6", ] [[package]] @@ -3211,11 +3851,11 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.9.3" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "memchr", "unicase", ] @@ -3230,7 +3870,22 @@ dependencies = [ "libc", "mach2", "once_cell", - "raw-cpuid", + "raw-cpuid 10.7.0", + "wasi", + "web-sys", + "winapi", +] + +[[package]] +name = "quanta" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid 11.1.0", "wasi", "web-sys", "winapi", @@ -3238,9 +3893,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -3290,11 +3945,20 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "raw-cpuid" +version = "11.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb9ee317cfe3fbd54b36a511efc1edd42e216903c9cd575e686dd68a2ba90d8d" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "rayon" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -3302,9 +3966,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -3312,23 +3976,23 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -3342,13 +4006,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.4", ] [[package]] @@ -3359,15 +4023,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rend" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" dependencies = [ "bytecheck", ] @@ -3382,24 +4046,69 @@ dependencies = [ ] [[package]] -name = "ring" -version = "0.17.7" +name = "reqwest" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ - "cc", - "getrandom", - "libc", - "spin", + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "rkyv" -version = "0.7.43" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -3410,14 +4119,14 @@ dependencies = [ "rkyv_derive", "seahash", "tinyvec", - "uuid 1.6.1", + "uuid", ] [[package]] name = "rkyv_derive" -version = "0.7.43" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", @@ -3426,9 +4135,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7" dependencies = [ "libc", "librocksdb-sys", @@ -3436,53 +4145,22 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "backon", "chrono", "dapi-grpc", "futures", "hex", - "http", + "http-serde", + "lru", "rand", "serde", "serde_json", "sha2", "thiserror", "tokio", - "tonic", - "tracing", -] - -[[package]] -name = "rs-sdk" -version = "0.25.21" -dependencies = [ - "async-trait", - "base64 0.21.5", - "bincode 2.0.0-rc.3", - "ciborium", - "dapi-grpc", - "dashcore-rpc", - "data-contracts", - "derive_more", - "dotenvy", - "dpp", - "drive", - "drive-abci", - "drive-proof-verifier", - "envy", - "futures", - "hex", - "http", - "rs-dapi-client", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-test", "tracing", - "tracing-subscriber", ] [[package]] @@ -3491,16 +4169,16 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94ea852806513d6f5fd7750423300375bc8481a18ed033756c1a836257893a30" dependencies = [ - "bindgen", + "bindgen 0.65.1", "cc", "libc", ] [[package]] name = "rust_decimal" -version = "1.33.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06676aec5ccb8fc1da723cc8c0f9a46549f21ebb8753d3915c6c41db1e7f1dc4" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" dependencies = [ "arrayvec", "borsh", @@ -3514,9 +4192,9 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.33.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e43721f4ef7060ebc2c3ede757733209564ca8207f47674181bcd425dd76945" +checksum = "da991f231869f34268415a49724c6578e740ad697ba0999199d6f22b3949332c" dependencies = [ "quote", "rust_decimal", @@ -3524,9 +4202,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" @@ -3559,71 +4237,97 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys 0.4.14", "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.10" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", ] [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" dependencies = [ "openssl-probe", "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64 0.21.5", + "base64 0.22.1", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" + [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -3634,13 +4338,23 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "sanitize-filename" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ed72fbaf78e6f2d41744923916966c4fbe3d7c74e3037a8ee482f1115572603" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3658,16 +4372,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "seahash" version = "4.1.0" @@ -3697,11 +4401,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -3710,9 +4414,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -3720,18 +4424,18 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.193" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] @@ -3748,9 +4452,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.12" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ "serde", ] @@ -3767,36 +4471,68 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.4.0", "itoa", + "memchr", "ryu", "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + [[package]] name = "serde_repr" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", +] + +[[package]] +name = "serde_spanned" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", ] [[package]] @@ -3817,16 +4553,19 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ - "base64 0.21.5", + "base64 0.22.1", "chrono", "hex", + "indexmap 1.9.3", + "indexmap 2.4.0", "serde", + "serde_derive", "serde_json", - "serde_with_macros 3.4.0", + "serde_with_macros 3.9.0", "time", ] @@ -3839,19 +4578,30 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", ] [[package]] @@ -3876,15 +4626,15 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -3898,6 +4648,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "simdutf8" version = "0.1.4" @@ -3906,10 +4662,10 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ - "anyhow", - "bincode 2.0.0-rc.3", + "base64 0.22.1", + "bincode", "dashcore-rpc", "dpp", ] @@ -3931,9 +4687,9 @@ dependencies = [ [[package]] name = "sketches-ddsketch" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" +checksum = "85636c14b73d81f541e525f585c0a2109e6744e1565b5c1668e31c70c10ed65c" [[package]] name = "slab" @@ -3946,9 +4702,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -3962,12 +4718,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3988,61 +4744,87 @@ dependencies = [ [[package]] name = "sqlparser" -version = "0.13.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9907f54bd0f7b6ce72c2be1e570a614819ee08e3deb66d90480df341d8a12a8" +checksum = "0272b7bb0a225320170c99901b4b5fb3a4384e255a7f2cc228f61e2ba3893e75" dependencies = [ "log", ] [[package]] name = "strategy-tests" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ - "bincode 2.0.0-rc.3", + "bincode", "dpp", "drive", + "futures", "hex", + "platform-serialization", "platform-serialization-derive", "platform-version", "rand", "rocksdb", + "serde_json", "simple-signer", + "tracing", ] [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros 0.25.3", +] [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros", + "strum_macros 0.26.4", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.75", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.75", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "subtle-encoding" @@ -4066,9 +4848,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -4084,7 +4866,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] @@ -4093,6 +4875,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.12.6" @@ -4105,6 +4896,27 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "system-configuration" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tagptr" version = "0.2.0" @@ -4119,81 +4931,43 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", - "fastrand 2.0.1", - "redox_syscall", - "rustix 0.38.28", - "windows-sys 0.48.0", -] - -[[package]] -name = "tenderdash-abci" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" -dependencies = [ - "bytes", - "futures", - "hex", - "lhash", - "prost 0.12.3", - "semver", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", - "thiserror", - "tokio", - "tokio-util", - "tracing", - "tracing-subscriber", - "url", - "uuid 1.6.1", + "fastrand 2.1.0", + "once_cell", + "rustix 0.38.34", + "windows-sys 0.59.0", ] [[package]] name = "tenderdash-abci" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" +version = "1.1.0" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.1.0#03b741f3f24281ec6990c6c343079076c549b0f8" dependencies = [ "bytes", "futures", "hex", "lhash", - "prost 0.12.3", + "prost 0.12.6", "semver", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "serde_json", + "tenderdash-proto", "thiserror", "tokio", "tokio-util", "tracing", "tracing-subscriber", "url", - "uuid 1.6.1", + "uuid", ] [[package]] name = "tenderdash-proto" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" -dependencies = [ - "bytes", - "chrono", - "derive_more", - "flex-error", - "num-derive", - "num-traits", - "prost 0.12.3", - "serde", - "subtle-encoding", - "tenderdash-proto-compiler 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", - "time", -] - -[[package]] -name = "tenderdash-proto" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" +version = "1.1.0" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.1.0#03b741f3f24281ec6990c6c343079076c549b0f8" dependencies = [ "bytes", "chrono", @@ -4201,46 +4975,34 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.12.3", + "prost 0.12.6", "serde", "subtle-encoding", - "tenderdash-proto-compiler 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "tenderdash-proto-compiler", "time", + "tonic 0.11.0", ] [[package]] name = "tenderdash-proto-compiler" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" -dependencies = [ - "fs_extra", - "prost-build 0.12.3", - "regex", - "tempfile", - "ureq", - "walkdir", - "zip", -] - -[[package]] -name = "tenderdash-proto-compiler" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" +version = "1.1.0" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.1.0#03b741f3f24281ec6990c6c343079076c549b0f8" dependencies = [ "fs_extra", - "prost-build 0.12.3", + "prost-build 0.12.6", "regex", "tempfile", + "tonic-build 0.11.0", "ureq", "walkdir", - "zip", + "zip 2.2.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -4257,7 +5019,28 @@ version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21d6cf5a7dffb3f9dceec8e6b8ca528d9bd71d36c9f074defb548ce161f598c0" dependencies = [ - "test-case-macros", + "test-case-macros 2.2.2", +] + +[[package]] +name = "test-case" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8" +dependencies = [ + "test-case-macros 3.3.1", +] + +[[package]] +name = "test-case-core" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] @@ -4273,6 +5056,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "test-case-macros" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", + "test-case-core", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -4284,29 +5079,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.51" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.51" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -4314,12 +5109,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -4334,10 +5130,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -4353,9 +5150,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -4368,21 +5165,21 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2 0.5.7", "tokio-macros", - "windows-sys 0.48.0", + "tracing", + "windows-sys 0.52.0", ] [[package]] @@ -4397,30 +5194,52 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", ] [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls", + "rustls 0.23.12", + "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -4429,9 +5248,9 @@ dependencies = [ [[package]] name = "tokio-test" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b3cbabd3ae862100094ae433e1def582cf86451b4e9bf83aa7ac1d8a7d719" +checksum = "2468baabc3311435b55dd935f702f42cd1b8abb7e754fb7dfb16bd36aa88f9f7" dependencies = [ "async-stream", "bytes", @@ -4442,23 +5261,37 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -4466,52 +5299,92 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.4.0", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap 2.4.0", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.4.0", + "serde", + "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.18", ] [[package]] name = "tonic" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ "async-stream", "async-trait", - "axum", - "base64 0.21.5", + "axum 0.6.20", + "base64 0.21.7", "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.11.9", + "prost 0.12.6", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum 0.6.20", + "base64 0.21.7", + "bytes", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost 0.12.6", "rustls-native-certs", "rustls-pemfile", + "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.25.0", "tokio-stream", "tower", "tower-layer", "tower-service", "tracing", + "webpki-roots", ] [[package]] @@ -4527,15 +5400,27 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "tonic-build" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +dependencies = [ + "prettyplease 0.2.20", + "proc-macro2", + "prost-build 0.12.6", + "quote", + "syn 2.0.75", +] + [[package]] name = "tower" version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +source = "git+https://github.com/QuantumExplorer/tower?branch=fix/indexMap2OnV0413#5286f8c605d10f48d51254f2434c5ab3fc5d7779" dependencies = [ "futures-core", "futures-util", - "indexmap 1.9.3", + "indexmap 2.4.0", "pin-project", "pin-project-lite", "rand", @@ -4547,17 +5432,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags 2.6.0", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-layer" version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +source = "git+https://github.com/QuantumExplorer/tower?branch=fix/indexMap2OnV0413#5286f8c605d10f48d51254f2434c5ab3fc5d7779" [[package]] name = "tower-service" version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +source = "git+https://github.com/QuantumExplorer/tower?branch=fix/indexMap2OnV0413#5286f8c605d10f48d51254f2434c5ab3fc5d7779" [[package]] name = "tracing" @@ -4565,6 +5473,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4578,7 +5487,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] @@ -4635,24 +5544,15 @@ dependencies = [ [[package]] name = "treediff" -version = "3.0.2" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "761e8d5ad7ce14bb82b7e61ccc0ca961005a275a060b9644a2431aa11553c2ff" -dependencies = [ - "serde_json", -] - -[[package]] -name = "treediff" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" +checksum = "e2ce481b2b7c2534fe7b5242cccebf37f9084392665c6a3783c414a1bada5432" [[package]] name = "triomphe" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" [[package]] name = "try-lock" @@ -4677,9 +5577,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -4689,36 +5589,24 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "uniresid" -version = "0.1.5" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "995a4007fbec4f43386ea1b1d81d42d986a0c9616378e9aa4a96f45ea661e1b0" -dependencies = [ - "once_cell", - "serde", - "thiserror", - "url", -] +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "untrusted" @@ -4728,25 +5616,25 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.1" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" +checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" dependencies = [ - "base64 0.21.5", + "base64 0.22.1", "flate2", "log", "once_cell", - "rustls", - "rustls-webpki", + "rustls 0.23.12", + "rustls-pki-types", "url", "webpki-roots", ] [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -4755,21 +5643,15 @@ dependencies = [ [[package]] name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "uuid" -version = "0.8.2" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.6.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", "rand", @@ -4789,9 +5671,20 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "versioned-feature-core" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "898c0ad500fdb1914df465a2c729fce33646ef65dfbbbd16a6d8050e0d2404df" + +[[package]] +name = "versioned-feature-core" +version = "1.0.0" +source = "git+https://github.com/dashpay/versioned-feature-core#560157096c8405a46ce0f21a2e7e1bd11d6625b4" [[package]] name = "virtue" @@ -4807,15 +5700,15 @@ checksum = "b522f715ead3537dc57c9907899a08e461a8f1e87fc8414a4a89bbd9854289ff" [[package]] name = "waker-fn" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -4857,7 +5750,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -4891,7 +5784,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4904,16 +5797,18 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "anyhow", "async-trait", + "bincode", "dpp", "hex", - "itertools", + "itertools 0.10.5", "js-sys", "log", "num_enum", + "paste", "serde", "serde-wasm-bindgen", "serde_json", @@ -4947,9 +5842,12 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +dependencies = [ + "rustls-pki-types", +] [[package]] name = "which" @@ -4960,7 +5858,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.28", + "rustix 0.38.34", ] [[package]] @@ -4981,11 +5879,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -4996,11 +5894,41 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", ] [[package]] @@ -5018,7 +5946,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -5038,17 +5975,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -5059,9 +5997,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -5071,9 +6009,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -5083,9 +6021,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -5095,9 +6039,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -5107,9 +6051,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -5119,9 +6063,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -5131,28 +6075,39 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] [[package]] name = "winnow" -version = "0.5.28" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] [[package]] name = "withdrawals-contract" -version = "0.25.21" +version = "1.1.0-dev.1" dependencies = [ "num_enum", "platform-value", + "platform-version", "serde", "serde_json", "serde_repr", + "thiserror", ] [[package]] @@ -5172,29 +6127,30 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.31" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.31" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.75", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] name = "zip" @@ -5202,17 +6158,84 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" dependencies = [ + "aes", "byteorder", + "bzip2", + "constant_time_eq 0.1.5", "crc32fast", "crossbeam-utils", "flate2", + "hmac", + "pbkdf2", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zip" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" +dependencies = [ + "arbitrary", + "crc32fast", + "crossbeam-utils", + "displaydoc", + "flate2", + "indexmap 2.4.0", + "memchr", + "thiserror", + "zopfli", +] + +[[package]] +name = "zip-extensions" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecf62554c4ff96bce01a7ef123d160c3ffe9180638820f8b4d545c65b221b8c" +dependencies = [ + "zip 0.6.6", +] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 8fe09c67d2b..bdf98a874fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,7 @@ [workspace] +resolver = "2" + members = [ "packages/dapi-grpc", "packages/rs-dapi-grpc-macros", @@ -24,4 +26,11 @@ members = [ "packages/rs-sdk", "packages/strategy-tests", "packages/simple-signer", + "packages/rs-json-schema-compatibility-validator", + "packages/check-features", ] + +[patch.crates-io] +tower-service = { git = "https://github.com/QuantumExplorer/tower", branch = "fix/indexMap2OnV0413" } +tower-layer = { git = "https://github.com/QuantumExplorer/tower", branch = "fix/indexMap2OnV0413" } +tower = { git = "https://github.com/QuantumExplorer/tower", branch = "fix/indexMap2OnV0413" } diff --git a/Dockerfile b/Dockerfile index 25ab93f4373..67c1c96a7e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ # The following build arguments can be provided using --build-arg: # - CARGO_BUILD_PROFILE - set to `release` to build final binary, without debugging information # - NODE_ENV - node.js environment name to use to build the library -# - RUSTC_WRAPPER - set to `sccache` to enable sccache support and make the following variables avaialable: +# - RUSTC_WRAPPER - set to `sccache` to enable sccache support and make the following variables available: # - SCCACHE_GHA_ENABLED, ACTIONS_CACHE_URL, ACTIONS_RUNTIME_TOKEN - store sccache caches inside github actions # - SCCACHE_MEMCACHED - set to memcache server URI (eg. tcp://172.17.0.1:11211) to enable sccache memcached backend # - ALPINE_VERSION - use different version of Alpine base image; requires also rust:apline... @@ -30,7 +30,7 @@ # SCCACHE_SERVER_PORT port to avoid conflicts in case of parallel compilation ARG ALPINE_VERSION=3.18 - +ARG PROTOC_VERSION=25.2 ARG RUSTC_WRAPPER # @@ -73,13 +73,14 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --profile minimal \ -y \ # Rust version the same as in /README.md - --default-toolchain stable \ + --default-toolchain 1.76 \ --target wasm32-unknown-unknown # Install protoc - protobuf compiler # The one shipped with Alpine does not work +ARG PROTOC_VERSION RUN if [[ "$TARGETARCH" == "arm64" ]] ; then export PROTOC_ARCH=aarch_64; else export PROTOC_ARCH=x86_64; fi; \ - curl -Ls https://github.com/protocolbuffers/protobuf/releases/download/v22.4/protoc-22.4-linux-${PROTOC_ARCH}.zip \ + curl -Ls https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip \ -o /tmp/protoc.zip && \ unzip -qd /opt/protoc /tmp/protoc.zip && \ rm /tmp/protoc.zip && \ @@ -137,8 +138,11 @@ ENV SCCACHE_REGION=${SCCACHE_REGION} ARG CARGO_INCREMENTAL=false ENV CARGO_INCREMENTAL=${CARGO_INCREMENTAL} +ARG AWS_ACCESS_KEY_ID +ARG AWS_SECRET_ACCESS_KEY + # -# DEPS: FULL DEPENCIES LIST +# DEPS: FULL DEPENDENCIES LIST # # This is separate from `deps` to use sccache for caching FROM deps-${RUSTC_WRAPPER:-base} AS deps @@ -173,6 +177,9 @@ WORKDIR /platform COPY . . +# Workaround: as we cache dapi-grpc, its build.rs is not rerun, so we need to touch it +RUN touch /platform/packages/dapi-grpc/build.rs + # # STAGE: BUILD RS-DRIVE-ABCI # @@ -193,7 +200,8 @@ RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOM if [[ -z "${SCCACHE_MEMCACHED}" ]] ; then unset SCCACHE_MEMCACHED ; fi ; \ cargo build \ --profile "$CARGO_BUILD_PROFILE" \ - --package drive-abci && \ + --package drive-abci \ + --locked && \ cp /platform/target/*/drive-abci /artifacts/ && \ if [[ "${RUSTC_WRAPPER}" == "sccache" ]] ; then sccache --show-stats; fi @@ -231,12 +239,14 @@ LABEL description="Drive ABCI Rust" RUN apk add --no-cache libgcc libstdc++ ENV DB_PATH=/var/lib/dash/rs-drive-abci/db +ENV REJECTIONS_PATH=/var/log/dash/rejected RUN mkdir -p /var/log/dash \ - /var/lib/dash/rs-drive-abci/db + /var/lib/dash/rs-drive-abci/db \ + ${REJECTIONS_PATH} COPY --from=build-drive-abci /artifacts/drive-abci /usr/bin/drive-abci -COPY --from=build-drive-abci /platform/packages/rs-drive-abci/.env.example /var/lib/dash/rs-drive-abci/.env +COPY --from=build-drive-abci /platform/packages/rs-drive-abci/.env.mainnet /var/lib/dash/rs-drive-abci/.env # Create a volume VOLUME /var/lib/dash/rs-drive-abci/db @@ -264,6 +274,7 @@ CMD ["start"] # ABCI interface EXPOSE 26658 +EXPOSE 26659 # Prometheus port EXPOSE 29090 @@ -295,7 +306,6 @@ COPY --from=build-dashmate-helper /platform/package.json /platform/yarn.lock /pl COPY --from=build-dashmate-helper /platform/packages/dashmate packages/dashmate COPY --from=build-dashmate-helper /platform/packages/dashpay-contract packages/dashpay-contract COPY --from=build-dashmate-helper /platform/packages/wallet-lib packages/wallet-lib -COPY --from=build-dashmate-helper /platform/packages/js-dash-sdk packages/js-dash-sdk COPY --from=build-dashmate-helper /platform/packages/js-dapi-client packages/js-dapi-client COPY --from=build-dashmate-helper /platform/packages/js-grpc-common packages/js-grpc-common COPY --from=build-dashmate-helper /platform/packages/dapi-grpc packages/dapi-grpc @@ -392,9 +402,6 @@ LABEL description="DAPI Node.JS" # Install ZMQ shared library RUN apk add --no-cache zeromq-dev -# Install pm2 -RUN npm install -g pm2 - WORKDIR /platform/packages/dapi COPY --from=build-dapi /platform/.yarn /platform/.yarn @@ -411,5 +418,3 @@ RUN cp /platform/packages/dapi/.env.example /platform/packages/dapi/.env EXPOSE 2500 2501 2510 USER node - -ENTRYPOINT ["yarn", "node", "/usr/local/bin/pm2-runtime", "pm2.yml"] diff --git a/README.md b/README.md index dfcebf86e09..d4853d7f891 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

- GitHub CI Status + GitHub CI Status Devs Chat General Chat Follow on Twitter @@ -53,23 +53,20 @@ this repository may be used on the following networks: - Install prerequisites: - [node.js](https://nodejs.org/) v20 - [docker](https://docs.docker.com/get-docker/) v20.10+ - - [rust](https://www.rust-lang.org/tools/install) v1.73+, with wasm32 target (`rustup target add wasm32-unknown-unknown`) + - [rust](https://www.rust-lang.org/tools/install) v1.76+, with wasm32 target (`rustup target add wasm32-unknown-unknown`) + - [protoc - protobuf compiler](https://github.com/protocolbuffers/protobuf/releases) v25.2+ + - if needed, set PROTOC environment variable to location of `protoc` binary - [wasm-bingen toolchain](https://rustwasm.github.io/wasm-bindgen/): - **IMPORTANT (OSX only)**: built-in `llvm` on OSX does not work, needs to be installed from brew: - `brew install llvm` - LLVM installed from brew is keg only, and path to it must be provided in the profile file, in terminal run `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc` or `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile` depending on your default shell. You can find your default shell with `echo $SHELL` - - Reload your shell with `source ~/.zshrc` or `source ~/.bash_profile` - - install `protoc` - protobuf compiler: - - on debian/ubuntu: `apt install -y protobuf-compiler` - - on Mac: `brew install protobuf` - - on other systems, install most recent version from [Protocol Buffers releases page](https://github.com/protocolbuffers/protobuf/releases) (tested with protobuf 22.4) - - if needed, set PROTOC environment variable to location of `protoc` binary + - Reload your shell with `source ~/.zshrc` or `source ~/.bash_profile` - `cargo install wasm-bindgen-cli@0.2.85` - *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file* - *Depending on system, additional packages may need to be installed as a prerequisite for wasm-bindgen-cli. If anything is missing, installation will error and prompt what packages are missing (i.e. clang, llvm, libssl-dev)* - - essential build tools - example for Debian/Ubuntu: `apt install -y build-essential libssl-dev pkg-config clang` + - essential build tools - example for Debian/Ubuntu: `apt install -y build-essential libssl-dev pkg-config clang cmake llvm` - Run `corepack enable` to enable [corepack](https://nodejs.org/dist/latest/docs/api/corepack.html) and install yarn - Run `yarn setup` to install dependencies and configure and build all packages - Run `yarn start` to start the local dev environment built from the sources diff --git a/mkdocs.yml b/mkdocs.yml index 64637fd664d..b1142098254 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,41 +2,60 @@ site_name: Dash Platform plugins: - redirects: redirect_maps: - 'SDK/README.md': 'https://dashplatform.readme.io/docs/dash-sdk-overview' - 'SDK/Overview.md': 'https://dashplatform.readme.io/docs/dash-sdk-overview' - 'SDK/examples/fetch-an-identity-from-its-name.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-fetch-an-identity-from-its-name' - 'SDK/examples/generate-a-new-mnemonic.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-generate-a-new-mnemonic' - 'SDK/examples/pay-to-another-address.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-paying-to-another-address' - 'SDK/examples/receive-money-and-check-balance.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance' - 'SDK/examples/sign-and-verify-messages.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-sign-and-verify-messages' - 'SDK/examples/use-different-account.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account' - 'SDK/getting-started/about-schemas.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-about-schemas' - 'SDK/getting-started/core-concepts.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-core-concepts' - 'SDK/getting-started/dash-platform-applications.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-dash-platform-applications' - 'SDK/getting-started/multiple-apps.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-working-with-multiple-apps' - 'SDK/getting-started/quickstart.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-quick-start' - 'SDK/getting-started/with-typescript.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-with-typescript' - 'SDK/platform/about-platform.md': 'https://dashplatform.readme.io/docs/dash-sdk-platform' - 'SDK/platform/contracts/about-contracts.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts' - 'SDK/platform/contracts/create.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-create' - 'SDK/platform/contracts/get.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-get' - 'SDK/platform/contracts/publish.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-publish' - 'SDK/platform/contracts/update.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-update' - 'SDK/platform/documents/about-documents.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents' - 'SDK/platform/documents/broadcast.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents-broadcast' - 'SDK/platform/documents/create.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents-create' - 'SDK/platform/documents/get.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents-get' - 'SDK/platform/identities/about-identity.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities' - 'SDK/platform/identities/get.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities-get' - 'SDK/platform/identities/register.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities-register' - 'SDK/platform/identities/topUp.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities-topup' - 'SDK/platform/names/about-dpns.md': 'https://dashplatform.readme.io/docs/dash-sdk-names' - 'SDK/platform/names/register.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-register' - 'SDK/platform/names/resolve.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-resolve' - 'SDK/platform/names/resolveByRecord.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-resolvebyrecord' - 'SDK/platform/names/search.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-search' - 'SDK/usage/dapi.md': 'https://dashplatform.readme.io/docs/dash-sdk-usage-dapi' - 'SDK/usage/dashcorelib-primitives.md': 'https://dashplatform.readme.io/docs/dash-sdk-usage-dashcore-lib-primitives' - 'SDK/wallet/about-wallet-lib.md': 'https://dashplatform.readme.io/docs/dash-sdk-wallet' - 'SDK/wallet/accounts.md': 'https://dashplatform.readme.io/docs/dash-sdk-wallet-accounts' - 'SDK/wallet/signing-encrypt.md': 'https://dashplatform.readme.io/docs/dash-sdk-wallet-signing-encrypt' + 'SDK/README.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/overview.html' + 'SDK/Overview.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/overview.html' + 'SDK/examples/fetch-an-identity-from-its-name.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/fetch-an-identity-from-its-name.html' + 'SDK/examples/generate-a-new-mnemonic.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/generate-a-new-mnemonic.html' + 'SDK/examples/pay-to-another-address.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/paying-to-another-address.html' + 'SDK/examples/receive-money-and-check-balance.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/receive-money-and-check-balance.html' + 'SDK/examples/sign-and-verify-messages.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/sign-and-verify-messages.html' + 'SDK/examples/use-different-account.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/use-different-account.html' + 'SDK/getting-started/about-schemas.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/about-schemas.html' + 'SDK/getting-started/core-concepts.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/core-concepts.html' + 'SDK/getting-started/dash-platform-applications.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/dash-platform-applications.html' + 'SDK/getting-started/multiple-apps.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/working-with-multiple-apps.html' + 'SDK/getting-started/quickstart.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/quick-start.html' + 'SDK/getting-started/with-typescript.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/with-typescript.html' + 'SDK/platform/about-platform.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/platform.html' + 'SDK/platform/contracts/about-contracts.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/contracts.html' + 'SDK/platform/contracts/create.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/create.html' + 'SDK/platform/contracts/get.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/get.html' + 'SDK/platform/contracts/publish.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/publish.html' + 'SDK/platform/contracts/update.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/update.html' + 'SDK/platform/documents/about-documents.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/documents.html' + 'SDK/platform/documents/broadcast.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/broadcast.html' + 'SDK/platform/documents/create.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/create.html' + 'SDK/platform/documents/get.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/get.html' + 'SDK/platform/identities/about-identity.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/identities.html' + 'SDK/platform/identities/get.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/get.html' + 'SDK/platform/identities/register.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/register.html' + 'SDK/platform/identities/topUp.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/register.html' + 'SDK/platform/names/about-dpns.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/names.html' + 'SDK/platform/names/register.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/register.html' + 'SDK/platform/names/resolve.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/resolve.html' + 'SDK/platform/names/resolveByRecord.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/resolvebyrecord.html' + 'SDK/platform/names/search.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/search.html' + 'SDK/usage/dapi.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/usage/dapi.html#' + 'SDK/usage/dashcorelib-primitives.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/usage/dashcore-lib-primitives.html' + 'SDK/wallet/about-wallet-lib.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/wallet/wallet.html' + 'SDK/wallet/accounts.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/wallet/accounts.html' + 'SDK/wallet/signing-encrypt.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/wallet/signing-encrypt.html' + 'DAPI-Client/README.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/overview.html' + 'DAPI-Client/getting-started/quickstart.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/quick-start.html' + 'DAPI-Client/usage/application/DAPIClient.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/dapiclient.html' + 'DAPI-Client/usage/application/core/broadcastTransaction.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/broadcasttransaction.html' + 'DAPI-Client/usage/application/core/getBestBlockHash.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getbestblockhash.html' + 'DAPI-Client/usage/application/core/getBlockByHash.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getblockbyhash.html' + 'DAPI-Client/usage/application/core/getBlockByHeight.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getblockbyheight.html' + 'DAPI-Client/usage/application/core/getBlockHash.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getblockhash.html' + 'DAPI-Client/usage/application/core/getStatus.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getstatus.html' + 'DAPI-Client/usage/application/core/getTransaction.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/gettransaction.html' + 'DAPI-Client/usage/application/core/subscribeToTransactionsWithProofs.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/subscribetotransactionswithproofs.html' + 'DAPI-Client/usage/application/core/subscribeToMasternodeList.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/subscribetomasternodelist.html' + 'DAPI-Client/usage/application/core/subscribeToBlockHeadersWithChainLocks.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/subscribetoblockheaderswithchainlocks.html' + 'DAPI-Client/usage/application/platform/broadcastStateTransition.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/broadcaststatetransition.html' + 'DAPI-Client/usage/application/getDataContract.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getdatacontract.html' + 'DAPI-Client/usage/application/getDocuments.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getdocuments.html' + 'DAPI-Client/usage/application/getIdentity.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getidentity.html' + 'DAPI-Client/usage/application/getIdentityByFirstPublicKey.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getidentitybyfirstpublickey.html' + 'DAPI-Client/usage/application/getIdentityIdByFirstPublicKey.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getidentityidbyfirstpublickey.html' diff --git a/package.json b/package.json index cc263f63a6b..d07fdcc1c71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "0.25.21", + "version": "1.1.0-dev.1", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", @@ -69,8 +69,8 @@ "resolutions": { "elliptic": "^6.5.4", "bn.js": "4.12.0", - "ejs": "^3.1.7", "fast-json-patch": "^3.1.1", + "node-tar": "^6.2.1", "oclif@3.4.2": "patch:oclif@npm:3.4.2#.yarn/patches/oclif-npm-3.4.2-a655d32eed.patch", "qs": "^6.7.3", "engine.io": "^6.4.2", @@ -84,10 +84,14 @@ "browserify-sign": "4.2.2", "istanbul-lib-processinfo": "2.0.3", "@babel/core": "7.23.3", + "tar": "^6.2.1", "tsconfig-paths": "4.2.0", "ansi-regex": "5.0.1", "cacache": "18.0.0", - "node-gyp": "10.0.1" + "node-gyp": "10.0.1", + "follow-redirects": "^1.15.5", + "socks": "^2.8.1", + "ws": "^8.17.1" }, "dependencies": { "node-gyp": "^10.0.1" diff --git a/packages/bench-suite/benchmarks/basicValidation.js b/packages/bench-suite/benchmarks/basicValidation.js index cc1eb900d57..40c0944241c 100644 --- a/packages/bench-suite/benchmarks/basicValidation.js +++ b/packages/bench-suite/benchmarks/basicValidation.js @@ -1,6 +1,6 @@ const { PrivateKey } = require('@dashevo/dashcore-lib'); -const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/dpns-contract-documents'); +const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/v1/dpns-contract-documents.json'); // const { DashPlatformProtocol, Identity, Identifier, default: loadWasmDpp } = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); diff --git a/packages/bench-suite/benchmarks/documents/dpns.js b/packages/bench-suite/benchmarks/documents/dpns.js index 605862943ca..a1062007b1b 100644 --- a/packages/bench-suite/benchmarks/documents/dpns.js +++ b/packages/bench-suite/benchmarks/documents/dpns.js @@ -1,6 +1,6 @@ const crypto = require('crypto'); -const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/dpns-contract-documents'); +const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/v1/dpns-contract-documents.json'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 1fb2397a82e..ed536f8cd49 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,14 +1,14 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", "lint": "" }, "dependencies": { - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.3", "@dashevo/dpns-contract": "workspace:*", "@dashevo/wallet-lib": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", diff --git a/packages/check-features/Cargo.toml b/packages/check-features/Cargo.toml new file mode 100644 index 00000000000..5df36ccaf8c --- /dev/null +++ b/packages/check-features/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "check-features" +version = "1.1.0-dev.1" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +toml = "0.8.12" diff --git a/packages/check-features/src/main.rs b/packages/check-features/src/main.rs new file mode 100644 index 00000000000..c8a876a1f32 --- /dev/null +++ b/packages/check-features/src/main.rs @@ -0,0 +1,139 @@ +use std::fs; +use std::process::Command; +use toml::Value; + +fn main() { + let crates = [ + ("rs-sdk", vec![]), + ("rs-drive-abci", vec![]), + ("rs-dpp", vec![]), + ("rs-drive", vec![]), + ("rs-drive-proof-verifier", vec![]), + ]; + + for (specific_crate, to_ignore) in crates { + check_crate(specific_crate, to_ignore) + } +} + +fn check_crate(crate_name: &str, to_ignore: Vec<&str>) { + // Construct the path to the Cargo.toml file for each crate + let cargo_toml_path = format!("packages/{}/Cargo.toml", crate_name); + + // Read and parse the Cargo.toml file + let cargo_toml_content = fs::read_to_string(cargo_toml_path) + .unwrap_or_else(|_| panic!("Failed to read Cargo.toml for {}", crate_name)); + + let cargo_toml: Value = cargo_toml_content + .parse() + .expect("Failed to parse Cargo.toml"); + + let features = cargo_toml + .get("features") + .expect("No features in Cargo.toml"); + + let name = cargo_toml + .get("package") + .expect("No package in Cargo.toml") + .get("name") + .expect("expected name in Cargo.toml"); + + println!("Checking crate {} with default features", crate_name); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Feature check failed in crate {} with default features", + crate_name + ); + println!("cargo check -p {}", name); + std::process::exit(1); + } + + println!("Checking crate {} with no default features", crate_name); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .arg("--no-default-features") + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Check failed in crate {} with no default features", + crate_name + ); + println!("cargo check -p {} --no-default-features", name); + std::process::exit(1); + } + + for (feature, _) in features.as_table().unwrap().iter() { + // Skip special feature groups + if feature == "default" + || feature.ends_with("features") + || to_ignore.contains(&feature.as_str()) + { + continue; + } + + println!( + "Checking feature: {} in crate {} with default features", + feature, crate_name + ); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .arg("--features") + .arg(feature) + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Feature check failed for feature: {} in crate {} with default features", + feature, crate_name + ); + println!("cargo check -p {} --features {}", name, feature); + std::process::exit(1); + } + + println!( + "Checking feature: {} in crate {} with no default features", + feature, crate_name + ); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .arg("--features") + .arg(feature) + .arg("--no-default-features") + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Feature check failed for feature: {} in crate {} with no default features", + feature, crate_name + ); + println!( + "cargo check -p {} --features {} --no-default-features", + name, feature + ); + std::process::exit(1); + } + } + + println!("All features checked successfully on {}", crate_name); +} diff --git a/packages/dapi-grpc/.gitignore b/packages/dapi-grpc/.gitignore new file mode 100644 index 00000000000..e8aa2e11061 --- /dev/null +++ b/packages/dapi-grpc/.gitignore @@ -0,0 +1,2 @@ +src/core/*/ +src/platform/*/ diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 7160550b714..c70258a333d 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,36 +1,50 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "0.25.21" +version = "1.1.0-dev.1" authors = [ - "Samuel Westrich ", - "Igor Markin ", - "Łukasz Klimek ", - "Anton Suprunchuk ", - "Ivan Shumkov ", + "Samuel Westrich ", + "Igor Markin ", + "Łukasz Klimek ", + "Anton Suprunchuk ", + "Ivan Shumkov ", ] edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [features] -default = ["core", "platform", "client", "serde"] +default = ["core", "platform", "client"] core = [] platform = [] # Re-export Dash Platform protobuf types as `dapi_grpc::platform::proto` +# Note: client needs tls and tls-roots to connect to testnet which uses TLS. tenderdash-proto = [] -client = ["tonic/channel", "tonic/tls", "tonic/tls-roots", "platform"] +client = [ + "tonic/channel", + "tonic/transport", + "tonic/tls", + "tonic/tls-roots", + "tonic/tls-webpki-roots", + "platform", +] +server = ["tonic/channel", "tonic/transport", "platform"] serde = ["dep:serde", "dep:serde_bytes"] +mocks = ["serde", "dep:serde_json"] [dependencies] -prost = { version = "0.11.9" } -tonic = { version = "0.9.2", features = [ - "codegen", - "prost", +prost = { version = "0.12.3" } +futures-core = "0.3.30" +tonic = { version = "0.11", features = [ + "codegen", + "prost", ], default-features = false } -serde = { version = "1.0.171", optional = true, features = ["derive"] } +serde = { version = "1.0.197", optional = true, features = ["derive"] } serde_bytes = { version = "0.11.12", optional = true } -tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci" } +serde_json = { version = "1.0", optional = true } +tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "1.1.0", tag = "v1.1.0", default-features = false, features = [ + "grpc", +] } dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" } platform-version = { path = "../rs-platform-version" } @@ -49,4 +63,9 @@ name = "platform_example" path = "clients/platform/v0/rust/platform_example.rs" [package.metadata.cargo-machete] -ignored = ["platform-version", "serde_bytes"] +ignored = [ + "platform-version", + "serde_bytes", + "futures-core", + "dapi-grpc-macros", +] diff --git a/packages/dapi-grpc/build.rs b/packages/dapi-grpc/build.rs index 713494f292e..0b613a8c12a 100644 --- a/packages/dapi-grpc/build.rs +++ b/packages/dapi-grpc/build.rs @@ -1,12 +1,36 @@ use std::{ + collections::HashSet, fs::{create_dir_all, remove_dir_all}, path::PathBuf, + process::exit, }; use tonic_build::Builder; +const SERDE_WITH_BYTES: &str = r#"#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]"#; +const SERDE_WITH_BASE64: &str = + r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::vec_base64string"))]"#; +const SERDE_WITH_STRING: &str = + r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::from_to_string"))]"#; + fn main() { - generate().expect("failed to compile protobuf definitions"); + let core = MappingConfig::new( + PathBuf::from("protos/core/v0/core.proto"), + PathBuf::from("src/core"), + ); + + configure_core(core) + .generate() + .expect("generate core proto"); + + let platform = MappingConfig::new( + PathBuf::from("protos/platform/v0/platform.proto"), + PathBuf::from("src/platform"), + ); + + configure_platform(platform) + .generate() + .expect("generate platform proto"); println!("cargo:rerun-if-changed=./protos"); println!("cargo:rerun-if-env-changed=CARGO_FEATURE_SERDE"); @@ -18,29 +42,20 @@ struct MappingConfig { builder: Builder, proto_includes: Vec, } -/// Generate Rust definitions from Protobuf definitions -pub fn generate() -> Result<(), std::io::Error> { - let core = MappingConfig::new( - PathBuf::from("protos/core/v0/core.proto"), - PathBuf::from("src/core/proto"), - ); - core.generate().unwrap(); - - let mut platform = MappingConfig::new( - PathBuf::from("protos/platform/v0/platform.proto"), - PathBuf::from("src/platform/proto"), - ); +fn configure_platform(mut platform: MappingConfig) -> MappingConfig { // Derive features for versioned messages // // "GetConsensusParamsRequest" is excluded as this message does not support proofs - const VERSIONED_REQUESTS: [&str; 15] = [ + const VERSIONED_REQUESTS: [&str; 26] = [ "GetDataContractHistoryRequest", "GetDataContractRequest", "GetDataContractsRequest", "GetDocumentsRequest", "GetIdentitiesByPublicKeyHashesRequest", "GetIdentitiesRequest", + "GetIdentityNonceRequest", + "GetIdentityContractNonceRequest", "GetIdentityBalanceAndRevisionRequest", "GetIdentityBalanceRequest", "GetIdentityByPublicKeyHashRequest", @@ -50,10 +65,19 @@ pub fn generate() -> Result<(), std::io::Error> { "WaitForStateTransitionResultRequest", "GetProtocolVersionUpgradeStateRequest", "GetProtocolVersionUpgradeVoteStatusRequest", + "GetPathElementsRequest", + "GetIdentitiesContractKeysRequest", + "GetPrefundedSpecializedBalanceRequest", + "GetContestedResourcesRequest", + "GetContestedResourceVoteStateRequest", + "GetContestedResourceVotersForIdentityRequest", + "GetContestedResourceIdentityVotesRequest", + "GetVotePollsByEndDateRequest", + "GetTotalCreditsInPlatformRequest", ]; // "GetConsensusParamsResponse" is excluded as this message does not support proofs - const VERSIONED_RESPONSES: [&str; 16] = [ + const VERSIONED_RESPONSES: [&str; 27] = [ "GetDataContractHistoryResponse", "GetDataContractResponse", "GetDataContractsResponse", @@ -62,6 +86,8 @@ pub fn generate() -> Result<(), std::io::Error> { "GetIdentitiesResponse", "GetIdentityBalanceAndRevisionResponse", "GetIdentityBalanceResponse", + "GetIdentityNonceResponse", + "GetIdentityContractNonceResponse", "GetIdentityByPublicKeyHashResponse", "GetIdentityKeysResponse", "GetIdentityResponse", @@ -70,8 +96,20 @@ pub fn generate() -> Result<(), std::io::Error> { "GetEpochsInfoResponse", "GetProtocolVersionUpgradeStateResponse", "GetProtocolVersionUpgradeVoteStatusResponse", + "GetPathElementsResponse", + "GetIdentitiesContractKeysResponse", + "GetPrefundedSpecializedBalanceResponse", + "GetContestedResourcesResponse", + "GetContestedResourceVoteStateResponse", + "GetContestedResourceVotersForIdentityResponse", + "GetContestedResourceIdentityVotesResponse", + "GetVotePollsByEndDateResponse", + "GetTotalCreditsInPlatformResponse", ]; + check_unique(&VERSIONED_REQUESTS).expect("VERSIONED_REQUESTS"); + check_unique(&VERSIONED_RESPONSES).expect("VERSIONED_RESPONSES"); + // Derive VersionedGrpcMessage on requests for msg in VERSIONED_REQUESTS { platform = platform @@ -92,66 +130,113 @@ pub fn generate() -> Result<(), std::io::Error> { .message_attribute(msg, r#"#[grpc_versions(0)]"#); } - #[cfg(feature = "serde")] + // All messages can be mocked. + let platform = platform.message_attribute(".", r#"#[derive( ::dapi_grpc_macros::Mockable)]"#); + let platform = platform .type_attribute( ".", - r#"#[derive(::serde::Serialize, ::serde::Deserialize)]"#, - ) - .type_attribute(".", r#"#[serde(rename_all = "snake_case")]"#) - .field_attribute("id", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("identity_id", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute( - "ids", - r#"#[serde(with = "crate::deserialization::vec_base64string")]"#, - ) - .field_attribute( - "ResponseMetadata.height", - r#"#[serde(with = "crate::deserialization::from_to_string")]"#, + r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#, ) - .field_attribute( - "ResponseMetadata.time_ms", - r#"#[serde(with = "crate::deserialization::from_to_string")]"#, - ) - .field_attribute( - "start_at_ms", - r#"#[serde(with = "crate::deserialization::from_to_string")]"#, - ) - .field_attribute("public_key_hash", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute( - "public_key_hashes", - r#"#[serde(with = "crate::deserialization::vec_base64string")]"#, + .type_attribute( + ".", + r#"#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]"#, ) + .field_attribute("id", SERDE_WITH_BYTES) + .field_attribute("identity_id", SERDE_WITH_BYTES) + .field_attribute("ids", SERDE_WITH_BASE64) + .field_attribute("ResponseMetadata.height", SERDE_WITH_STRING) + .field_attribute("ResponseMetadata.time_ms", SERDE_WITH_STRING) + .field_attribute("start_at_ms", SERDE_WITH_STRING) + .field_attribute("public_key_hash", SERDE_WITH_BYTES) + .field_attribute("public_key_hashes", SERDE_WITH_BASE64) // Get documents fields - .field_attribute("data_contract_id", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("where", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("order_by", r#"#[serde(with = "serde_bytes")]"#) + .field_attribute("data_contract_id", SERDE_WITH_BYTES) + .field_attribute("where", SERDE_WITH_BYTES) + .field_attribute("order_by", SERDE_WITH_BYTES) // Proof fields - .field_attribute("Proof.grovedb_proof", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("Proof.quorum_hash", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("Proof.signature", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("Proof.block_id_hash", r#"#[serde(with = "serde_bytes")]"#); + .field_attribute("Proof.grovedb_proof", SERDE_WITH_BYTES) + .field_attribute("Proof.quorum_hash", SERDE_WITH_BYTES) + .field_attribute("Proof.signature", SERDE_WITH_BYTES) + .field_attribute("Proof.block_id_hash", SERDE_WITH_BYTES); + + #[allow(clippy::let_and_return)] + platform +} - platform.generate().unwrap(); +/// Check for duplicate messages in the list. +fn check_unique(messages: &[&'static str]) -> Result<(), String> { + let mut hashset: HashSet<&'static str> = HashSet::new(); + let mut duplicates = String::new(); - Ok(()) + for value in messages { + if !hashset.insert(*value) { + duplicates.push_str(value); + duplicates.push_str(", "); + } + } + + if duplicates.is_empty() { + Ok(()) + } else { + Err(format!( + "Duplicate messages found: {}", + duplicates.trim_end_matches(", ") + )) + } +} + +fn configure_core(core: MappingConfig) -> MappingConfig { + // All messages can be mocked. + let core = core.message_attribute(".", r#"#[derive(::dapi_grpc_macros::Mockable)]"#); + + // Serde support + let core = core.type_attribute( + ".", + r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#, + ); + + #[allow(clippy::let_and_return)] + core } impl MappingConfig { + /// Create a new MappingConfig instance. + /// + /// ## Arguments + /// + /// * `protobuf_file` - Path to the protobuf file to use as input. + /// * `out_dir` - Output directory where subdirectories for generated files will be created. + /// Depending on the features, either `client`, `server` or `client_server` subdirectory + /// will be created inside `out_dir`. fn new(protobuf_file: PathBuf, out_dir: PathBuf) -> Self { let protobuf_file = abs_path(&protobuf_file); - let out_dir = abs_path(&out_dir); + + let build_server = cfg!(feature = "server"); + let build_client = cfg!(feature = "client"); + + // Depending on the features, we need to build the server, client or both. + // We save these artifacts in separate directories to avoid overwriting the generated files + // when another crate requires different features. + let out_dir_suffix = match (build_server, build_client) { + (true, true) => "client_server", + (true, false) => "server", + (false, true) => "client", + (false, false) => { + println!("WARNING: At least one of the features 'server' or 'client' must be enabled; dapi-grpc will not generate any files."); + exit(0) + } + }; + + let out_dir = abs_path(&out_dir.join(out_dir_suffix)); let builder = tonic_build::configure() - .build_server(false) + .build_server(build_server) + .build_client(build_client) + .build_transport(build_server || build_client) .out_dir(out_dir.clone()) .protoc_arg("--experimental_allow_proto3_optional"); - #[cfg(feature = "client")] - let builder = builder.build_client(true).build_transport(true); - #[cfg(not(feature = "client"))] - let builder = builder.build_client(false).build_transport(false); - Self { protobuf_file, out_dir, diff --git a/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java b/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java index 13210195573..029ad20c799 100644 --- a/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java +++ b/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java @@ -15,35 +15,66 @@ private CoreGrpc() {} public static final String SERVICE_NAME = "org.dash.platform.dapi.v0.Core"; // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getGetStatusMethod; + private static volatile io.grpc.MethodDescriptor getGetBlockchainStatusMethod; @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "getStatus", - requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest.class, - responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse.class, + fullMethodName = SERVICE_NAME + '/' + "getBlockchainStatus", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetStatusMethod() { - io.grpc.MethodDescriptor getGetStatusMethod; - if ((getGetStatusMethod = CoreGrpc.getGetStatusMethod) == null) { + public static io.grpc.MethodDescriptor getGetBlockchainStatusMethod() { + io.grpc.MethodDescriptor getGetBlockchainStatusMethod; + if ((getGetBlockchainStatusMethod = CoreGrpc.getGetBlockchainStatusMethod) == null) { synchronized (CoreGrpc.class) { - if ((getGetStatusMethod = CoreGrpc.getGetStatusMethod) == null) { - CoreGrpc.getGetStatusMethod = getGetStatusMethod = - io.grpc.MethodDescriptor.newBuilder() + if ((getGetBlockchainStatusMethod = CoreGrpc.getGetBlockchainStatusMethod) == null) { + CoreGrpc.getGetBlockchainStatusMethod = getGetBlockchainStatusMethod = + io.grpc.MethodDescriptor.newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getStatus")) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getBlockchainStatus")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest.getDefaultInstance())) + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse.getDefaultInstance())) - .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getStatus")) + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getBlockchainStatus")) .build(); } } } - return getGetStatusMethod; + return getGetBlockchainStatusMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetMasternodeStatusMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getMasternodeStatus", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetMasternodeStatusMethod() { + io.grpc.MethodDescriptor getGetMasternodeStatusMethod; + if ((getGetMasternodeStatusMethod = CoreGrpc.getGetMasternodeStatusMethod) == null) { + synchronized (CoreGrpc.class) { + if ((getGetMasternodeStatusMethod = CoreGrpc.getGetMasternodeStatusMethod) == null) { + CoreGrpc.getGetMasternodeStatusMethod = getGetMasternodeStatusMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getMasternodeStatus")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getMasternodeStatus")) + .build(); + } + } + } + return getGetMasternodeStatusMethod; } private static volatile io.grpc.MethodDescriptor getGetBlockMethod() { return getGetBlockMethod; } + private static volatile io.grpc.MethodDescriptor getGetBestBlockHeightMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getBestBlockHeight", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetBestBlockHeightMethod() { + io.grpc.MethodDescriptor getGetBestBlockHeightMethod; + if ((getGetBestBlockHeightMethod = CoreGrpc.getGetBestBlockHeightMethod) == null) { + synchronized (CoreGrpc.class) { + if ((getGetBestBlockHeightMethod = CoreGrpc.getGetBestBlockHeightMethod) == null) { + CoreGrpc.getGetBestBlockHeightMethod = getGetBestBlockHeightMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getBestBlockHeight")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getBestBlockHeight")) + .build(); + } + } + } + return getGetBestBlockHeightMethod; + } + private static volatile io.grpc.MethodDescriptor getBroadcastTransactionMethod; @@ -232,6 +294,37 @@ org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsResponse> getSubs return getSubscribeToTransactionsWithProofsMethod; } + private static volatile io.grpc.MethodDescriptor getSubscribeToMasternodeListMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "subscribeToMasternodeList", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getSubscribeToMasternodeListMethod() { + io.grpc.MethodDescriptor getSubscribeToMasternodeListMethod; + if ((getSubscribeToMasternodeListMethod = CoreGrpc.getSubscribeToMasternodeListMethod) == null) { + synchronized (CoreGrpc.class) { + if ((getSubscribeToMasternodeListMethod = CoreGrpc.getSubscribeToMasternodeListMethod) == null) { + CoreGrpc.getSubscribeToMasternodeListMethod = getSubscribeToMasternodeListMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "subscribeToMasternodeList")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("subscribeToMasternodeList")) + .build(); + } + } + } + return getSubscribeToMasternodeListMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -282,9 +375,16 @@ public static abstract class CoreImplBase implements io.grpc.BindableService { /** */ - public void getStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetStatusMethod(), responseObserver); + public void getBlockchainStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetBlockchainStatusMethod(), responseObserver); + } + + /** + */ + public void getMasternodeStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetMasternodeStatusMethod(), responseObserver); } /** @@ -294,6 +394,13 @@ public void getBlock(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest re io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetBlockMethod(), responseObserver); } + /** + */ + public void getBestBlockHeight(org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetBestBlockHeightMethod(), responseObserver); + } + /** */ public void broadcastTransaction(org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest request, @@ -329,15 +436,29 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSubscribeToTransactionsWithProofsMethod(), responseObserver); } + /** + */ + public void subscribeToMasternodeList(org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSubscribeToMasternodeListMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( - getGetStatusMethod(), + getGetBlockchainStatusMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest, + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse>( + this, METHODID_GET_BLOCKCHAIN_STATUS))) + .addMethod( + getGetMasternodeStatusMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( new MethodHandlers< - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest, - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse>( - this, METHODID_GET_STATUS))) + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest, + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse>( + this, METHODID_GET_MASTERNODE_STATUS))) .addMethod( getGetBlockMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -345,6 +466,13 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest, org.dash.platform.dapi.v0.CoreOuterClass.GetBlockResponse>( this, METHODID_GET_BLOCK))) + .addMethod( + getGetBestBlockHeightMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest, + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse>( + this, METHODID_GET_BEST_BLOCK_HEIGHT))) .addMethod( getBroadcastTransactionMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -380,6 +508,13 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsRequest, org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsResponse>( this, METHODID_SUBSCRIBE_TO_TRANSACTIONS_WITH_PROOFS))) + .addMethod( + getSubscribeToMasternodeListMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest, + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListResponse>( + this, METHODID_SUBSCRIBE_TO_MASTERNODE_LIST))) .build(); } } @@ -400,10 +535,18 @@ protected CoreStub build( /** */ - public void getStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request, - io.grpc.stub.StreamObserver responseObserver) { + public void getBlockchainStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetStatusMethod(), getCallOptions()), request, responseObserver); + getChannel().newCall(getGetBlockchainStatusMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getMasternodeStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetMasternodeStatusMethod(), getCallOptions()), request, responseObserver); } /** @@ -414,6 +557,14 @@ public void getBlock(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest re getChannel().newCall(getGetBlockMethod(), getCallOptions()), request, responseObserver); } + /** + */ + public void getBestBlockHeight(org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetBestBlockHeightMethod(), getCallOptions()), request, responseObserver); + } + /** */ public void broadcastTransaction(org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest request, @@ -453,6 +604,14 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute io.grpc.stub.ClientCalls.asyncServerStreamingCall( getChannel().newCall(getSubscribeToTransactionsWithProofsMethod(), getCallOptions()), request, responseObserver); } + + /** + */ + public void subscribeToMasternodeList(org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getSubscribeToMasternodeListMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -471,9 +630,16 @@ protected CoreBlockingStub build( /** */ - public org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse getStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request) { + public org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse getBlockchainStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request) { return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetStatusMethod(), getCallOptions(), request); + getChannel(), getGetBlockchainStatusMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse getMasternodeStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetMasternodeStatusMethod(), getCallOptions(), request); } /** @@ -483,6 +649,13 @@ public org.dash.platform.dapi.v0.CoreOuterClass.GetBlockResponse getBlock(org.da getChannel(), getGetBlockMethod(), getCallOptions(), request); } + /** + */ + public org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse getBestBlockHeight(org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetBestBlockHeightMethod(), getCallOptions(), request); + } + /** */ public org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionResponse broadcastTransaction(org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest request) { @@ -519,6 +692,14 @@ public java.util.Iterator subscribeToMasternodeList( + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getSubscribeToMasternodeListMethod(), getCallOptions(), request); + } } /** @@ -537,10 +718,18 @@ protected CoreFutureStub build( /** */ - public com.google.common.util.concurrent.ListenableFuture getStatus( - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request) { + public com.google.common.util.concurrent.ListenableFuture getBlockchainStatus( + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request) { return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetStatusMethod(), getCallOptions()), request); + getChannel().newCall(getGetBlockchainStatusMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getMasternodeStatus( + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetMasternodeStatusMethod(), getCallOptions()), request); } /** @@ -551,6 +740,14 @@ public com.google.common.util.concurrent.ListenableFuture getBestBlockHeight( + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetBestBlockHeightMethod(), getCallOptions()), request); + } + /** */ public com.google.common.util.concurrent.ListenableFuture broadcastTransaction( @@ -576,13 +773,16 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -601,14 +801,22 @@ private static final class MethodHandlers implements @java.lang.SuppressWarnings("unchecked") public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { switch (methodId) { - case METHODID_GET_STATUS: - serviceImpl.getStatus((org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); + case METHODID_GET_BLOCKCHAIN_STATUS: + serviceImpl.getBlockchainStatus((org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_MASTERNODE_STATUS: + serviceImpl.getMasternodeStatus((org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); break; case METHODID_GET_BLOCK: serviceImpl.getBlock((org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_BEST_BLOCK_HEIGHT: + serviceImpl.getBestBlockHeight((org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; case METHODID_BROADCAST_TRANSACTION: serviceImpl.broadcastTransaction((org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -629,6 +837,10 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.subscribeToTransactionsWithProofs((org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_SUBSCRIBE_TO_MASTERNODE_LIST: + serviceImpl.subscribeToMasternodeList((org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -690,13 +902,16 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { if (result == null) { serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) .setSchemaDescriptor(new CoreFileDescriptorSupplier()) - .addMethod(getGetStatusMethod()) + .addMethod(getGetBlockchainStatusMethod()) + .addMethod(getGetMasternodeStatusMethod()) .addMethod(getGetBlockMethod()) + .addMethod(getGetBestBlockHeightMethod()) .addMethod(getBroadcastTransactionMethod()) .addMethod(getGetTransactionMethod()) .addMethod(getGetEstimatedTransactionFeeMethod()) .addMethod(getSubscribeToBlockHeadersWithChainLocksMethod()) .addMethod(getSubscribeToTransactionsWithProofsMethod()) + .addMethod(getSubscribeToMasternodeListMethod()) .build(); } } diff --git a/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js b/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js index 8cdd7f3086a..1fa77f20f2e 100644 --- a/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js +++ b/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js @@ -24,10 +24,14 @@ const { platform: { dapi: { v0: { - GetStatusRequest: PBJSGetStatusRequest, - GetStatusResponse: PBJSGetStatusResponse, + GetBlockchainStatusRequest: PBJSGetBlockchainStatusRequest, + GetBlockchainStatusResponse: PBJSGetBlockchainStatusResponse, + GetMasternodeStatusRequest: PBJSGetMasternodeStatusRequest, + GetMasternodeStatusResponse: PBJSGetMasternodeStatusResponse, GetBlockRequest: PBJSGetBlockRequest, GetBlockResponse: PBJSGetBlockResponse, + GetBestBlockHeightRequest: PBJSGetBestBlockHeightRequest, + GetBestBlockHeightResponse: PBJSGetBestBlockHeightResponse, BroadcastTransactionRequest: PBJSBroadcastTransactionRequest, BroadcastTransactionResponse: PBJSBroadcastTransactionResponse, GetTransactionRequest: PBJSGetTransactionRequest, @@ -38,6 +42,8 @@ const { GetEstimatedTransactionFeeResponse: PBJSGetEstimatedTransactionFeeResponse, TransactionsWithProofsRequest: PBJSTransactionsWithProofsRequest, TransactionsWithProofsResponse: PBJSTransactionsWithProofsResponse, + MasternodeListRequest: PBJSMasternodeListRequest, + MasternodeListResponse: PBJSMasternodeListResponse, }, }, }, @@ -46,13 +52,16 @@ const { } = require('./core_pbjs'); const { - GetStatusResponse: ProtocGetStatusResponse, + GetBlockchainStatusResponse: ProtocGetBlockchainStatusResponse, + GetMasternodeStatusResponse: ProtocGetMasternodeStatusResponse, GetBlockResponse: ProtocGetBlockResponse, + GetBestBlockHeightResponse: ProtocGetBestBlockHeightResponse, BroadcastTransactionResponse: ProtocBroadcastTransactionResponse, GetTransactionResponse: ProtocGetTransactionResponse, BlockHeadersWithChainLocksResponse: ProtocBlockHeadersWithChainLocksResponse, GetEstimatedTransactionFeeResponse: ProtocGetEstimatedTransactionFeeResponse, TransactionsWithProofsResponse: ProtocTransactionsWithProofsResponse, + MasternodeListResponse: ProtocMasternodeListResponse, } = require('./core_protoc'); const getCoreDefinition = require('../../../../lib/getCoreDefinition'); @@ -79,14 +88,22 @@ class CorePromiseClient { this.client = new CoreNodeJSClient(strippedHostname, credentials, options); - this.client.getStatus = promisify( - this.client.getStatus.bind(this.client), + this.client.getBlockchainStatus = promisify( + this.client.getBlockchainStatus.bind(this.client), + ); + + this.client.getMasternodeStatus = promisify( + this.client.getMasternodeStatus.bind(this.client), ); this.client.getBlock = promisify( this.client.getBlock.bind(this.client), ); + this.client.getBestBlockHeight = promisify( + this.client.getBestBlockHeight.bind(this.client), + ); + this.client.broadcastTransaction = promisify( this.client.broadcastTransaction.bind(this.client), ); @@ -101,28 +118,28 @@ class CorePromiseClient { } /** - * @param {!GetStatusRequest} getStatusRequest + * @param {!GetBlockchainStatusRequest} getBlockchainStatusRequest * @param {?Object} metadata * @param {CallOptions} [options={}] - * @return {Promise} + * @return {Promise} */ - getStatus(getStatusRequest, metadata = {}, options = {}) { + getBlockchainStatus(getBlockchainStatusRequest, metadata = {}, options = {}) { if (!isObject(metadata)) { throw new Error('metadata must be an object'); } - return this.client.getStatus( - getStatusRequest, + return this.client.getBlockchainStatus( + getBlockchainStatusRequest, convertObjectToMetadata(metadata), { interceptors: [ jsonToProtobufInterceptorFactory( jsonToProtobufFactory( - ProtocGetStatusResponse, - PBJSGetStatusResponse, + ProtocGetBlockchainStatusResponse, + PBJSGetBlockchainStatusResponse, ), protobufToJsonFactory( - PBJSGetStatusRequest, + PBJSGetBlockchainStatusRequest, ), ), ], @@ -162,6 +179,68 @@ class CorePromiseClient { ); } + /** + * @param {!GetBestBlockHeightRequest} getBestBlockHeightRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @return {Promise} + */ + getBestBlockHeight(getBestBlockHeightRequest, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getBestBlockHeight( + getBestBlockHeightRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetBestBlockHeightResponse, + PBJSGetBestBlockHeightResponse, + ), + protobufToJsonFactory( + PBJSGetBestBlockHeightRequest, + ), + ), + ], + ...options, + }, + ); + } + + /** + * @param {!GetMasternodeStatusRequest} getMasternodeStatusRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @return {Promise} + */ + getMasternodeStatus(getMasternodeStatusRequest, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getMasternodeStatus( + getMasternodeStatusRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetMasternodeStatusResponse, + PBJSGetMasternodeStatusResponse, + ), + protobufToJsonFactory( + PBJSGetMasternodeStatusRequest, + ), + ), + ], + ...options, + }, + ); + } + /** * @param {!BroadcastTransactionRequest} broadcastTransactionRequest * @param {?Object} metadata @@ -322,6 +401,38 @@ class CorePromiseClient { }, ); } + + /** + * @param {MasternodeListRequest} masternodeListRequest The request proto + * @param {?Object} metadata User defined call metadata + * @param {CallOptions} [options={}] + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ + subscribeToMasternodeList(masternodeListRequest, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.subscribeToMasternodeList( + masternodeListRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocMasternodeListResponse, + PBJSMasternodeListResponse, + ), + protobufToJsonFactory( + PBJSMasternodeListRequest, + ), + ), + ], + ...options, + }, + ); + } } module.exports = CorePromiseClient; diff --git a/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js b/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js index cd62cc98c1b..20266d4be7c 100644 --- a/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js +++ b/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js @@ -87,35 +87,68 @@ $root.org = (function() { }; /** - * Callback as used by {@link org.dash.platform.dapi.v0.Core#getStatus}. + * Callback as used by {@link org.dash.platform.dapi.v0.Core#getBlockchainStatus}. * @memberof org.dash.platform.dapi.v0.Core - * @typedef getStatusCallback + * @typedef getBlockchainStatusCallback * @type {function} * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetStatusResponse} [response] GetStatusResponse + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} [response] GetBlockchainStatusResponse */ /** - * Calls getStatus. - * @function getStatus + * Calls getBlockchainStatus. + * @function getBlockchainStatus * @memberof org.dash.platform.dapi.v0.Core * @instance - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} request GetStatusRequest message or plain object - * @param {org.dash.platform.dapi.v0.Core.getStatusCallback} callback Node-style callback called with the error, if any, and GetStatusResponse + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} request GetBlockchainStatusRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.getBlockchainStatusCallback} callback Node-style callback called with the error, if any, and GetBlockchainStatusResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(Core.prototype.getStatus = function getStatus(request, callback) { - return this.rpcCall(getStatus, $root.org.dash.platform.dapi.v0.GetStatusRequest, $root.org.dash.platform.dapi.v0.GetStatusResponse, request, callback); - }, "name", { value: "getStatus" }); + Object.defineProperty(Core.prototype.getBlockchainStatus = function getBlockchainStatus(request, callback) { + return this.rpcCall(getBlockchainStatus, $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest, $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse, request, callback); + }, "name", { value: "getBlockchainStatus" }); /** - * Calls getStatus. - * @function getStatus + * Calls getBlockchainStatus. + * @function getBlockchainStatus * @memberof org.dash.platform.dapi.v0.Core * @instance - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} request GetStatusRequest message or plain object - * @returns {Promise} Promise + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} request GetBlockchainStatusRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Core#getMasternodeStatus}. + * @memberof org.dash.platform.dapi.v0.Core + * @typedef getMasternodeStatusCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} [response] GetMasternodeStatusResponse + */ + + /** + * Calls getMasternodeStatus. + * @function getMasternodeStatus + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} request GetMasternodeStatusRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.getMasternodeStatusCallback} callback Node-style callback called with the error, if any, and GetMasternodeStatusResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Core.prototype.getMasternodeStatus = function getMasternodeStatus(request, callback) { + return this.rpcCall(getMasternodeStatus, $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest, $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse, request, callback); + }, "name", { value: "getMasternodeStatus" }); + + /** + * Calls getMasternodeStatus. + * @function getMasternodeStatus + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} request GetMasternodeStatusRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ @@ -152,6 +185,39 @@ $root.org = (function() { * @variation 2 */ + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Core#getBestBlockHeight}. + * @memberof org.dash.platform.dapi.v0.Core + * @typedef getBestBlockHeightCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} [response] GetBestBlockHeightResponse + */ + + /** + * Calls getBestBlockHeight. + * @function getBestBlockHeight + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} request GetBestBlockHeightRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.getBestBlockHeightCallback} callback Node-style callback called with the error, if any, and GetBestBlockHeightResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Core.prototype.getBestBlockHeight = function getBestBlockHeight(request, callback) { + return this.rpcCall(getBestBlockHeight, $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest, $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse, request, callback); + }, "name", { value: "getBestBlockHeight" }); + + /** + * Calls getBestBlockHeight. + * @function getBestBlockHeight + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} request GetBestBlockHeightRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link org.dash.platform.dapi.v0.Core#broadcastTransaction}. * @memberof org.dash.platform.dapi.v0.Core @@ -317,26 +383,59 @@ $root.org = (function() { * @variation 2 */ + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Core#subscribeToMasternodeList}. + * @memberof org.dash.platform.dapi.v0.Core + * @typedef subscribeToMasternodeListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.MasternodeListResponse} [response] MasternodeListResponse + */ + + /** + * Calls subscribeToMasternodeList. + * @function subscribeToMasternodeList + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} request MasternodeListRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.subscribeToMasternodeListCallback} callback Node-style callback called with the error, if any, and MasternodeListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Core.prototype.subscribeToMasternodeList = function subscribeToMasternodeList(request, callback) { + return this.rpcCall(subscribeToMasternodeList, $root.org.dash.platform.dapi.v0.MasternodeListRequest, $root.org.dash.platform.dapi.v0.MasternodeListResponse, request, callback); + }, "name", { value: "subscribeToMasternodeList" }); + + /** + * Calls subscribeToMasternodeList. + * @function subscribeToMasternodeList + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} request MasternodeListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return Core; })(); - v0.GetStatusRequest = (function() { + v0.GetBlockchainStatusRequest = (function() { /** - * Properties of a GetStatusRequest. + * Properties of a GetBlockchainStatusRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetStatusRequest + * @interface IGetBlockchainStatusRequest */ /** - * Constructs a new GetStatusRequest. + * Constructs a new GetBlockchainStatusRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetStatusRequest. - * @implements IGetStatusRequest + * @classdesc Represents a GetBlockchainStatusRequest. + * @implements IGetBlockchainStatusRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetStatusRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest=} [properties] Properties to set */ - function GetStatusRequest(properties) { + function GetBlockchainStatusRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -344,60 +443,60 @@ $root.org = (function() { } /** - * Creates a new GetStatusRequest instance using the specified properties. + * Creates a new GetBlockchainStatusRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetStatusRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest instance + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest instance */ - GetStatusRequest.create = function create(properties) { - return new GetStatusRequest(properties); + GetBlockchainStatusRequest.create = function create(properties) { + return new GetBlockchainStatusRequest(properties); }; /** - * Encodes the specified GetStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusRequest.verify|verify} messages. + * Encodes the specified GetBlockchainStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} message GetStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} message GetBlockchainStatusRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusRequest.encode = function encode(message, writer) { + GetBlockchainStatusRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified GetStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusRequest.verify|verify} messages. + * Encodes the specified GetBlockchainStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} message GetStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} message GetBlockchainStatusRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetBlockchainStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetStatusRequest message from the specified reader or buffer. + * Decodes a GetBlockchainStatusRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusRequest.decode = function decode(reader, length) { + GetBlockchainStatusRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -410,100 +509,99 @@ $root.org = (function() { }; /** - * Decodes a GetStatusRequest message from the specified reader or buffer, length delimited. + * Decodes a GetBlockchainStatusRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusRequest.decodeDelimited = function decodeDelimited(reader) { + GetBlockchainStatusRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetStatusRequest message. + * Verifies a GetBlockchainStatusRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetStatusRequest.verify = function verify(message) { + GetBlockchainStatusRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a GetStatusRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetBlockchainStatusRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest */ - GetStatusRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusRequest) + GetBlockchainStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest) return object; - return new $root.org.dash.platform.dapi.v0.GetStatusRequest(); + return new $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest(); }; /** - * Creates a plain object from a GetStatusRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetBlockchainStatusRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.GetStatusRequest} message GetStatusRequest + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} message GetBlockchainStatusRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetStatusRequest.toObject = function toObject() { + GetBlockchainStatusRequest.toObject = function toObject() { return {}; }; /** - * Converts this GetStatusRequest to JSON. + * Converts this GetBlockchainStatusRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @instance * @returns {Object.} JSON object */ - GetStatusRequest.prototype.toJSON = function toJSON() { + GetBlockchainStatusRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetStatusRequest; + return GetBlockchainStatusRequest; })(); - v0.GetStatusResponse = (function() { + v0.GetBlockchainStatusResponse = (function() { /** - * Properties of a GetStatusResponse. + * Properties of a GetBlockchainStatusResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetStatusResponse - * @property {org.dash.platform.dapi.v0.GetStatusResponse.IVersion|null} [version] GetStatusResponse version - * @property {org.dash.platform.dapi.v0.GetStatusResponse.ITime|null} [time] GetStatusResponse time - * @property {org.dash.platform.dapi.v0.GetStatusResponse.Status|null} [status] GetStatusResponse status - * @property {number|null} [syncProgress] GetStatusResponse syncProgress - * @property {org.dash.platform.dapi.v0.GetStatusResponse.IChain|null} [chain] GetStatusResponse chain - * @property {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode|null} [masternode] GetStatusResponse masternode - * @property {org.dash.platform.dapi.v0.GetStatusResponse.INetwork|null} [network] GetStatusResponse network + * @interface IGetBlockchainStatusResponse + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion|null} [version] GetBlockchainStatusResponse version + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime|null} [time] GetBlockchainStatusResponse time + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status|null} [status] GetBlockchainStatusResponse status + * @property {number|null} [syncProgress] GetBlockchainStatusResponse syncProgress + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain|null} [chain] GetBlockchainStatusResponse chain + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork|null} [network] GetBlockchainStatusResponse network */ /** - * Constructs a new GetStatusResponse. + * Constructs a new GetBlockchainStatusResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetStatusResponse. - * @implements IGetStatusResponse + * @classdesc Represents a GetBlockchainStatusResponse. + * @implements IGetBlockchainStatusResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetStatusResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse=} [properties] Properties to set */ - function GetStatusResponse(properties) { + function GetBlockchainStatusResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -511,138 +609,128 @@ $root.org = (function() { } /** - * GetStatusResponse version. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.IVersion|null|undefined} version - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse version. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion|null|undefined} version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.version = null; + GetBlockchainStatusResponse.prototype.version = null; /** - * GetStatusResponse time. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.ITime|null|undefined} time - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse time. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime|null|undefined} time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.time = null; + GetBlockchainStatusResponse.prototype.time = null; /** - * GetStatusResponse status. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.Status} status - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse status. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} status + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.status = 0; + GetBlockchainStatusResponse.prototype.status = 0; /** - * GetStatusResponse syncProgress. + * GetBlockchainStatusResponse syncProgress. * @member {number} syncProgress - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @instance - */ - GetStatusResponse.prototype.syncProgress = 0; - - /** - * GetStatusResponse chain. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.IChain|null|undefined} chain - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.chain = null; + GetBlockchainStatusResponse.prototype.syncProgress = 0; /** - * GetStatusResponse masternode. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode|null|undefined} masternode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse chain. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain|null|undefined} chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.masternode = null; + GetBlockchainStatusResponse.prototype.chain = null; /** - * GetStatusResponse network. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.INetwork|null|undefined} network - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse network. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork|null|undefined} network + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.network = null; + GetBlockchainStatusResponse.prototype.network = null; /** - * Creates a new GetStatusResponse instance using the specified properties. + * Creates a new GetBlockchainStatusResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetStatusResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse instance + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse instance */ - GetStatusResponse.create = function create(properties) { - return new GetStatusResponse(properties); + GetBlockchainStatusResponse.create = function create(properties) { + return new GetBlockchainStatusResponse(properties); }; /** - * Encodes the specified GetStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.verify|verify} messages. + * Encodes the specified GetBlockchainStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetStatusResponse} message GetStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse} message GetBlockchainStatusResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusResponse.encode = function encode(message, writer) { + GetBlockchainStatusResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.version != null && Object.hasOwnProperty.call(message, "version")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.status != null && Object.hasOwnProperty.call(message, "status")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); if (message.syncProgress != null && Object.hasOwnProperty.call(message, "syncProgress")) writer.uint32(/* id 4, wireType 1 =*/33).double(message.syncProgress); if (message.chain != null && Object.hasOwnProperty.call(message, "chain")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.encode(message.chain, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.masternode != null && Object.hasOwnProperty.call(message, "masternode")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.encode(message.masternode, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.encode(message.chain, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.network != null && Object.hasOwnProperty.call(message, "network")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.encode(message.network, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.encode(message.network, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.verify|verify} messages. + * Encodes the specified GetBlockchainStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetStatusResponse} message GetStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse} message GetBlockchainStatusResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetBlockchainStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetStatusResponse message from the specified reader or buffer. + * Decodes a GetBlockchainStatusResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusResponse.decode = function decode(reader, length) { + GetBlockchainStatusResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.version = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.decode(reader, reader.uint32()); + message.version = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.decode(reader, reader.uint32()); break; case 2: - message.time = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.decode(reader, reader.uint32()); + message.time = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.decode(reader, reader.uint32()); break; case 3: message.status = reader.int32(); @@ -651,13 +739,10 @@ $root.org = (function() { message.syncProgress = reader.double(); break; case 5: - message.chain = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.decode(reader, reader.uint32()); - break; - case 6: - message.masternode = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.decode(reader, reader.uint32()); + message.chain = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.decode(reader, reader.uint32()); break; case 7: - message.network = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.decode(reader, reader.uint32()); + message.network = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -668,39 +753,39 @@ $root.org = (function() { }; /** - * Decodes a GetStatusResponse message from the specified reader or buffer, length delimited. + * Decodes a GetBlockchainStatusResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusResponse.decodeDelimited = function decodeDelimited(reader) { + GetBlockchainStatusResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetStatusResponse message. + * Verifies a GetBlockchainStatusResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetStatusResponse.verify = function verify(message) { + GetBlockchainStatusResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.version != null && message.hasOwnProperty("version")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.verify(message.version); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.verify(message.version); if (error) return "version." + error; } if (message.time != null && message.hasOwnProperty("time")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.verify(message.time); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.verify(message.time); if (error) return "time." + error; } @@ -718,17 +803,12 @@ $root.org = (function() { if (typeof message.syncProgress !== "number") return "syncProgress: number expected"; if (message.chain != null && message.hasOwnProperty("chain")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.verify(message.chain); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.verify(message.chain); if (error) return "chain." + error; } - if (message.masternode != null && message.hasOwnProperty("masternode")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.verify(message.masternode); - if (error) - return "masternode." + error; - } if (message.network != null && message.hasOwnProperty("network")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.verify(message.network); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.verify(message.network); if (error) return "network." + error; } @@ -736,26 +816,26 @@ $root.org = (function() { }; /** - * Creates a GetStatusResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetBlockchainStatusResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse */ - GetStatusResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse) + GetBlockchainStatusResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse(); if (object.version != null) { if (typeof object.version !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.version: object expected"); - message.version = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.fromObject(object.version); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.version: object expected"); + message.version = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.fromObject(object.version); } if (object.time != null) { if (typeof object.time !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.time: object expected"); - message.time = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.fromObject(object.time); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.time: object expected"); + message.time = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.fromObject(object.time); } switch (object.status) { case "NOT_STARTED": @@ -779,32 +859,27 @@ $root.org = (function() { message.syncProgress = Number(object.syncProgress); if (object.chain != null) { if (typeof object.chain !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.chain: object expected"); - message.chain = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.fromObject(object.chain); - } - if (object.masternode != null) { - if (typeof object.masternode !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.masternode: object expected"); - message.masternode = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.fromObject(object.masternode); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.chain: object expected"); + message.chain = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.fromObject(object.chain); } if (object.network != null) { if (typeof object.network !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.network: object expected"); - message.network = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.fromObject(object.network); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.network: object expected"); + message.network = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.fromObject(object.network); } return message; }; /** - * Creates a plain object from a GetStatusResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetBlockchainStatusResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse} message GetStatusResponse + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} message GetBlockchainStatusResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetStatusResponse.toObject = function toObject(message, options) { + GetBlockchainStatusResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -814,42 +889,39 @@ $root.org = (function() { object.status = options.enums === String ? "NOT_STARTED" : 0; object.syncProgress = 0; object.chain = null; - object.masternode = null; object.network = null; } if (message.version != null && message.hasOwnProperty("version")) - object.version = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(message.version, options); + object.version = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(message.version, options); if (message.time != null && message.hasOwnProperty("time")) - object.time = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(message.time, options); + object.time = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(message.time, options); if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetStatusResponse.Status[message.status] : message.status; + object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status[message.status] : message.status; if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) object.syncProgress = options.json && !isFinite(message.syncProgress) ? String(message.syncProgress) : message.syncProgress; if (message.chain != null && message.hasOwnProperty("chain")) - object.chain = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(message.chain, options); - if (message.masternode != null && message.hasOwnProperty("masternode")) - object.masternode = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(message.masternode, options); + object.chain = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(message.chain, options); if (message.network != null && message.hasOwnProperty("network")) - object.network = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(message.network, options); + object.network = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(message.network, options); return object; }; /** - * Converts this GetStatusResponse to JSON. + * Converts this GetBlockchainStatusResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance * @returns {Object.} JSON object */ - GetStatusResponse.prototype.toJSON = function toJSON() { + GetBlockchainStatusResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetStatusResponse.Version = (function() { + GetBlockchainStatusResponse.Version = (function() { /** * Properties of a Version. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @interface IVersion * @property {number|null} [protocol] Version protocol * @property {number|null} [software] Version software @@ -858,11 +930,11 @@ $root.org = (function() { /** * Constructs a new Version. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @classdesc Represents a Version. * @implements IVersion * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion=} [properties] Properties to set */ function Version(properties) { if (properties) @@ -874,7 +946,7 @@ $root.org = (function() { /** * Version protocol. * @member {number} protocol - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance */ Version.prototype.protocol = 0; @@ -882,7 +954,7 @@ $root.org = (function() { /** * Version software. * @member {number} software - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance */ Version.prototype.software = 0; @@ -890,7 +962,7 @@ $root.org = (function() { /** * Version agent. * @member {string} agent - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance */ Version.prototype.agent = ""; @@ -898,21 +970,21 @@ $root.org = (function() { /** * Creates a new Version instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version instance */ Version.create = function create(properties) { return new Version(properties); }; /** - * Encodes the specified Version message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Version.verify|verify} messages. + * Encodes the specified Version message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion} message Version message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion} message Version message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -929,11 +1001,11 @@ $root.org = (function() { }; /** - * Encodes the specified Version message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Version.verify|verify} messages. + * Encodes the specified Version message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion} message Version message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion} message Version message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -944,18 +1016,18 @@ $root.org = (function() { /** * Decodes a Version message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Version.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Version(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -979,10 +1051,10 @@ $root.org = (function() { /** * Decodes a Version message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -995,7 +1067,7 @@ $root.org = (function() { /** * Verifies a Version message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1018,15 +1090,15 @@ $root.org = (function() { /** * Creates a Version message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version */ Version.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Version) + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Version(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version(); if (object.protocol != null) message.protocol = object.protocol >>> 0; if (object.software != null) @@ -1039,9 +1111,9 @@ $root.org = (function() { /** * Creates a plain object from a Version message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Version} message Version + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} message Version * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1066,7 +1138,7 @@ $root.org = (function() { /** * Converts this Version to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance * @returns {Object.} JSON object */ @@ -1077,11 +1149,11 @@ $root.org = (function() { return Version; })(); - GetStatusResponse.Time = (function() { + GetBlockchainStatusResponse.Time = (function() { /** * Properties of a Time. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @interface ITime * @property {number|null} [now] Time now * @property {number|null} [offset] Time offset @@ -1090,11 +1162,11 @@ $root.org = (function() { /** * Constructs a new Time. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @classdesc Represents a Time. * @implements ITime * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime=} [properties] Properties to set */ function Time(properties) { if (properties) @@ -1106,7 +1178,7 @@ $root.org = (function() { /** * Time now. * @member {number} now - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance */ Time.prototype.now = 0; @@ -1114,7 +1186,7 @@ $root.org = (function() { /** * Time offset. * @member {number} offset - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance */ Time.prototype.offset = 0; @@ -1122,7 +1194,7 @@ $root.org = (function() { /** * Time median. * @member {number} median - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance */ Time.prototype.median = 0; @@ -1130,21 +1202,21 @@ $root.org = (function() { /** * Creates a new Time instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time instance */ Time.create = function create(properties) { return new Time(properties); }; /** - * Encodes the specified Time message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Time.verify|verify} messages. + * Encodes the specified Time message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime} message Time message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime} message Time message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1161,11 +1233,11 @@ $root.org = (function() { }; /** - * Encodes the specified Time message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Time.verify|verify} messages. + * Encodes the specified Time message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime} message Time message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime} message Time message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1176,18 +1248,18 @@ $root.org = (function() { /** * Decodes a Time message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Time.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Time(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -1211,10 +1283,10 @@ $root.org = (function() { /** * Decodes a Time message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -1227,7 +1299,7 @@ $root.org = (function() { /** * Verifies a Time message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1250,15 +1322,15 @@ $root.org = (function() { /** * Creates a Time message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time */ Time.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Time) + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Time(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time(); if (object.now != null) message.now = object.now >>> 0; if (object.offset != null) @@ -1271,9 +1343,9 @@ $root.org = (function() { /** * Creates a plain object from a Time message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Time} message Time + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} message Time * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1298,7 +1370,7 @@ $root.org = (function() { /** * Converts this Time to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance * @returns {Object.} JSON object */ @@ -1311,14 +1383,14 @@ $root.org = (function() { /** * Status enum. - * @name org.dash.platform.dapi.v0.GetStatusResponse.Status + * @name org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status * @enum {number} * @property {number} NOT_STARTED=0 NOT_STARTED value * @property {number} SYNCING=1 SYNCING value * @property {number} READY=2 READY value * @property {number} ERROR=3 ERROR value */ - GetStatusResponse.Status = (function() { + GetBlockchainStatusResponse.Status = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "NOT_STARTED"] = 0; values[valuesById[1] = "SYNCING"] = 1; @@ -1327,11 +1399,11 @@ $root.org = (function() { return values; })(); - GetStatusResponse.Chain = (function() { + GetBlockchainStatusResponse.Chain = (function() { /** * Properties of a Chain. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @interface IChain * @property {string|null} [name] Chain name * @property {number|null} [headersCount] Chain headersCount @@ -1345,11 +1417,11 @@ $root.org = (function() { /** * Constructs a new Chain. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @classdesc Represents a Chain. * @implements IChain * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain=} [properties] Properties to set */ function Chain(properties) { if (properties) @@ -1361,7 +1433,7 @@ $root.org = (function() { /** * Chain name. * @member {string} name - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.name = ""; @@ -1369,7 +1441,7 @@ $root.org = (function() { /** * Chain headersCount. * @member {number} headersCount - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.headersCount = 0; @@ -1377,7 +1449,7 @@ $root.org = (function() { /** * Chain blocksCount. * @member {number} blocksCount - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.blocksCount = 0; @@ -1385,7 +1457,7 @@ $root.org = (function() { /** * Chain bestBlockHash. * @member {Uint8Array} bestBlockHash - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.bestBlockHash = $util.newBuffer([]); @@ -1393,7 +1465,7 @@ $root.org = (function() { /** * Chain difficulty. * @member {number} difficulty - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.difficulty = 0; @@ -1401,7 +1473,7 @@ $root.org = (function() { /** * Chain chainWork. * @member {Uint8Array} chainWork - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.chainWork = $util.newBuffer([]); @@ -1409,7 +1481,7 @@ $root.org = (function() { /** * Chain isSynced. * @member {boolean} isSynced - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.isSynced = false; @@ -1417,7 +1489,7 @@ $root.org = (function() { /** * Chain syncProgress. * @member {number} syncProgress - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.syncProgress = 0; @@ -1425,21 +1497,21 @@ $root.org = (function() { /** * Creates a new Chain instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain instance */ Chain.create = function create(properties) { return new Chain(properties); }; /** - * Encodes the specified Chain message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Chain.verify|verify} messages. + * Encodes the specified Chain message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain} message Chain message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain} message Chain message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1466,11 +1538,11 @@ $root.org = (function() { }; /** - * Encodes the specified Chain message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Chain.verify|verify} messages. + * Encodes the specified Chain message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain} message Chain message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain} message Chain message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1481,18 +1553,18 @@ $root.org = (function() { /** * Decodes a Chain message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Chain.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -1531,10 +1603,10 @@ $root.org = (function() { /** * Decodes a Chain message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -1547,7 +1619,7 @@ $root.org = (function() { /** * Verifies a Chain message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1585,15 +1657,15 @@ $root.org = (function() { /** * Creates a Chain message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain */ Chain.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain) + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain(); if (object.name != null) message.name = String(object.name); if (object.headersCount != null) @@ -1622,9 +1694,9 @@ $root.org = (function() { /** * Creates a plain object from a Chain message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Chain} message Chain + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} message Chain * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1676,7 +1748,7 @@ $root.org = (function() { /** * Converts this Chain to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance * @returns {Object.} JSON object */ @@ -1687,28 +1759,25 @@ $root.org = (function() { return Chain; })(); - GetStatusResponse.Masternode = (function() { + GetBlockchainStatusResponse.NetworkFee = (function() { /** - * Properties of a Masternode. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @interface IMasternode - * @property {org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status|null} [status] Masternode status - * @property {Uint8Array|null} [proTxHash] Masternode proTxHash - * @property {number|null} [posePenalty] Masternode posePenalty - * @property {boolean|null} [isSynced] Masternode isSynced - * @property {number|null} [syncProgress] Masternode syncProgress + * Properties of a NetworkFee. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @interface INetworkFee + * @property {number|null} [relay] NetworkFee relay + * @property {number|null} [incremental] NetworkFee incremental */ /** - * Constructs a new Masternode. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @classdesc Represents a Masternode. - * @implements IMasternode + * Constructs a new NetworkFee. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @classdesc Represents a NetworkFee. + * @implements INetworkFee * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee=} [properties] Properties to set */ - function Masternode(properties) { + function NetworkFee(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1716,127 +1785,88 @@ $root.org = (function() { } /** - * Masternode status. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} status - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode - * @instance - */ - Masternode.prototype.status = 0; - - /** - * Masternode proTxHash. - * @member {Uint8Array} proTxHash - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode - * @instance - */ - Masternode.prototype.proTxHash = $util.newBuffer([]); - - /** - * Masternode posePenalty. - * @member {number} posePenalty - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode - * @instance - */ - Masternode.prototype.posePenalty = 0; - - /** - * Masternode isSynced. - * @member {boolean} isSynced - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * NetworkFee relay. + * @member {number} relay + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @instance */ - Masternode.prototype.isSynced = false; + NetworkFee.prototype.relay = 0; /** - * Masternode syncProgress. - * @member {number} syncProgress - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * NetworkFee incremental. + * @member {number} incremental + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @instance */ - Masternode.prototype.syncProgress = 0; + NetworkFee.prototype.incremental = 0; /** - * Creates a new Masternode instance using the specified properties. + * Creates a new NetworkFee instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee instance */ - Masternode.create = function create(properties) { - return new Masternode(properties); + NetworkFee.create = function create(properties) { + return new NetworkFee(properties); }; /** - * Encodes the specified Masternode message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Masternode.verify|verify} messages. + * Encodes the specified NetworkFee message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode} message Masternode message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee} message NetworkFee message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Masternode.encode = function encode(message, writer) { + NetworkFee.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.status); - if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proTxHash); - if (message.posePenalty != null && Object.hasOwnProperty.call(message, "posePenalty")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.posePenalty); - if (message.isSynced != null && Object.hasOwnProperty.call(message, "isSynced")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isSynced); - if (message.syncProgress != null && Object.hasOwnProperty.call(message, "syncProgress")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.syncProgress); + if (message.relay != null && Object.hasOwnProperty.call(message, "relay")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.relay); + if (message.incremental != null && Object.hasOwnProperty.call(message, "incremental")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.incremental); return writer; }; /** - * Encodes the specified Masternode message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Masternode.verify|verify} messages. + * Encodes the specified NetworkFee message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode} message Masternode message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee} message NetworkFee message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Masternode.encodeDelimited = function encodeDelimited(message, writer) { + NetworkFee.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Masternode message from the specified reader or buffer. + * Decodes a NetworkFee message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Masternode.decode = function decode(reader, length) { + NetworkFee.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.status = reader.int32(); + message.relay = reader.double(); break; case 2: - message.proTxHash = reader.bytes(); - break; - case 3: - message.posePenalty = reader.uint32(); - break; - case 4: - message.isSynced = reader.bool(); - break; - case 5: - message.syncProgress = reader.double(); + message.incremental = reader.double(); break; default: reader.skipType(tag & 7); @@ -1847,219 +1877,117 @@ $root.org = (function() { }; /** - * Decodes a Masternode message from the specified reader or buffer, length delimited. + * Decodes a NetworkFee message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Masternode.decodeDelimited = function decodeDelimited(reader) { + NetworkFee.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Masternode message. + * Verifies a NetworkFee message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Masternode.verify = function verify(message) { + NetworkFee.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) - return "proTxHash: buffer expected"; - if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) - if (!$util.isInteger(message.posePenalty)) - return "posePenalty: integer expected"; - if (message.isSynced != null && message.hasOwnProperty("isSynced")) - if (typeof message.isSynced !== "boolean") - return "isSynced: boolean expected"; - if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) - if (typeof message.syncProgress !== "number") - return "syncProgress: number expected"; + if (message.relay != null && message.hasOwnProperty("relay")) + if (typeof message.relay !== "number") + return "relay: number expected"; + if (message.incremental != null && message.hasOwnProperty("incremental")) + if (typeof message.incremental !== "number") + return "incremental: number expected"; return null; }; /** - * Creates a Masternode message from a plain object. Also converts values to their respective internal types. + * Creates a NetworkFee message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee */ - Masternode.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode) + NetworkFee.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode(); - switch (object.status) { - case "UNKNOWN": - case 0: - message.status = 0; - break; - case "WAITING_FOR_PROTX": - case 1: - message.status = 1; - break; - case "POSE_BANNED": - case 2: - message.status = 2; - break; - case "REMOVED": - case 3: - message.status = 3; - break; - case "OPERATOR_KEY_CHANGED": - case 4: - message.status = 4; - break; - case "PROTX_IP_CHANGED": - case 5: - message.status = 5; - break; - case "READY": - case 6: - message.status = 6; - break; - case "ERROR": - case 7: - message.status = 7; - break; - } - if (object.proTxHash != null) - if (typeof object.proTxHash === "string") - $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); - else if (object.proTxHash.length >= 0) - message.proTxHash = object.proTxHash; - if (object.posePenalty != null) - message.posePenalty = object.posePenalty >>> 0; - if (object.isSynced != null) - message.isSynced = Boolean(object.isSynced); - if (object.syncProgress != null) - message.syncProgress = Number(object.syncProgress); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee(); + if (object.relay != null) + message.relay = Number(object.relay); + if (object.incremental != null) + message.incremental = Number(object.incremental); return message; }; /** - * Creates a plain object from a Masternode message. Also converts values to other types if specified. + * Creates a plain object from a NetworkFee message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} message Masternode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} message NetworkFee * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Masternode.toObject = function toObject(message, options) { + NetworkFee.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.status = options.enums === String ? "UNKNOWN" : 0; - if (options.bytes === String) - object.proTxHash = ""; - else { - object.proTxHash = []; - if (options.bytes !== Array) - object.proTxHash = $util.newBuffer(object.proTxHash); - } - object.posePenalty = 0; - object.isSynced = false; - object.syncProgress = 0; + object.relay = 0; + object.incremental = 0; } - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status[message.status] : message.status; - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; - if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) - object.posePenalty = message.posePenalty; - if (message.isSynced != null && message.hasOwnProperty("isSynced")) - object.isSynced = message.isSynced; - if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) - object.syncProgress = options.json && !isFinite(message.syncProgress) ? String(message.syncProgress) : message.syncProgress; + if (message.relay != null && message.hasOwnProperty("relay")) + object.relay = options.json && !isFinite(message.relay) ? String(message.relay) : message.relay; + if (message.incremental != null && message.hasOwnProperty("incremental")) + object.incremental = options.json && !isFinite(message.incremental) ? String(message.incremental) : message.incremental; return object; }; /** - * Converts this Masternode to JSON. + * Converts this NetworkFee to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @instance * @returns {Object.} JSON object */ - Masternode.prototype.toJSON = function toJSON() { + NetworkFee.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Status enum. - * @name org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status - * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} WAITING_FOR_PROTX=1 WAITING_FOR_PROTX value - * @property {number} POSE_BANNED=2 POSE_BANNED value - * @property {number} REMOVED=3 REMOVED value - * @property {number} OPERATOR_KEY_CHANGED=4 OPERATOR_KEY_CHANGED value - * @property {number} PROTX_IP_CHANGED=5 PROTX_IP_CHANGED value - * @property {number} READY=6 READY value - * @property {number} ERROR=7 ERROR value - */ - Masternode.Status = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "WAITING_FOR_PROTX"] = 1; - values[valuesById[2] = "POSE_BANNED"] = 2; - values[valuesById[3] = "REMOVED"] = 3; - values[valuesById[4] = "OPERATOR_KEY_CHANGED"] = 4; - values[valuesById[5] = "PROTX_IP_CHANGED"] = 5; - values[valuesById[6] = "READY"] = 6; - values[valuesById[7] = "ERROR"] = 7; - return values; - })(); - - return Masternode; + return NetworkFee; })(); - GetStatusResponse.NetworkFee = (function() { + GetBlockchainStatusResponse.Network = (function() { /** - * Properties of a NetworkFee. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @interface INetworkFee - * @property {number|null} [relay] NetworkFee relay - * @property {number|null} [incremental] NetworkFee incremental + * Properties of a Network. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @interface INetwork + * @property {number|null} [peersCount] Network peersCount + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee|null} [fee] Network fee */ /** - * Constructs a new NetworkFee. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @classdesc Represents a NetworkFee. - * @implements INetworkFee + * Constructs a new Network. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @classdesc Represents a Network. + * @implements INetwork * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork=} [properties] Properties to set */ - function NetworkFee(properties) { + function Network(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2067,88 +1995,88 @@ $root.org = (function() { } /** - * NetworkFee relay. - * @member {number} relay - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * Network peersCount. + * @member {number} peersCount + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @instance */ - NetworkFee.prototype.relay = 0; + Network.prototype.peersCount = 0; /** - * NetworkFee incremental. - * @member {number} incremental - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * Network fee. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee|null|undefined} fee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @instance */ - NetworkFee.prototype.incremental = 0; + Network.prototype.fee = null; /** - * Creates a new NetworkFee instance using the specified properties. + * Creates a new Network instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network instance */ - NetworkFee.create = function create(properties) { - return new NetworkFee(properties); + Network.create = function create(properties) { + return new Network(properties); }; /** - * Encodes the specified NetworkFee message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.verify|verify} messages. + * Encodes the specified Network message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee} message NetworkFee message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork} message Network message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NetworkFee.encode = function encode(message, writer) { + Network.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.relay != null && Object.hasOwnProperty.call(message, "relay")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.relay); - if (message.incremental != null && Object.hasOwnProperty.call(message, "incremental")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.incremental); + if (message.peersCount != null && Object.hasOwnProperty.call(message, "peersCount")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.peersCount); + if (message.fee != null && Object.hasOwnProperty.call(message, "fee")) + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.encode(message.fee, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified NetworkFee message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.verify|verify} messages. + * Encodes the specified Network message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee} message NetworkFee message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork} message Network message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NetworkFee.encodeDelimited = function encodeDelimited(message, writer) { + Network.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NetworkFee message from the specified reader or buffer. + * Decodes a Network message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NetworkFee.decode = function decode(reader, length) { + Network.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.relay = reader.double(); + message.peersCount = reader.uint32(); break; case 2: - message.incremental = reader.double(); + message.fee = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2159,335 +2087,1066 @@ $root.org = (function() { }; /** - * Decodes a NetworkFee message from the specified reader or buffer, length delimited. + * Decodes a Network message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NetworkFee.decodeDelimited = function decodeDelimited(reader) { + Network.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NetworkFee message. + * Verifies a Network message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NetworkFee.verify = function verify(message) { + Network.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.relay != null && message.hasOwnProperty("relay")) - if (typeof message.relay !== "number") - return "relay: number expected"; - if (message.incremental != null && message.hasOwnProperty("incremental")) - if (typeof message.incremental !== "number") - return "incremental: number expected"; + if (message.peersCount != null && message.hasOwnProperty("peersCount")) + if (!$util.isInteger(message.peersCount)) + return "peersCount: integer expected"; + if (message.fee != null && message.hasOwnProperty("fee")) { + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.verify(message.fee); + if (error) + return "fee." + error; + } return null; }; /** - * Creates a NetworkFee message from a plain object. Also converts values to their respective internal types. + * Creates a Network message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network */ - NetworkFee.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee) + Network.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee(); - if (object.relay != null) - message.relay = Number(object.relay); - if (object.incremental != null) - message.incremental = Number(object.incremental); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network(); + if (object.peersCount != null) + message.peersCount = object.peersCount >>> 0; + if (object.fee != null) { + if (typeof object.fee !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.fee: object expected"); + message.fee = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.fromObject(object.fee); + } return message; }; /** - * Creates a plain object from a NetworkFee message. Also converts values to other types if specified. + * Creates a plain object from a Network message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} message NetworkFee + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} message Network * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NetworkFee.toObject = function toObject(message, options) { + Network.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.relay = 0; - object.incremental = 0; + object.peersCount = 0; + object.fee = null; } - if (message.relay != null && message.hasOwnProperty("relay")) - object.relay = options.json && !isFinite(message.relay) ? String(message.relay) : message.relay; - if (message.incremental != null && message.hasOwnProperty("incremental")) - object.incremental = options.json && !isFinite(message.incremental) ? String(message.incremental) : message.incremental; + if (message.peersCount != null && message.hasOwnProperty("peersCount")) + object.peersCount = message.peersCount; + if (message.fee != null && message.hasOwnProperty("fee")) + object.fee = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(message.fee, options); return object; }; /** - * Converts this NetworkFee to JSON. + * Converts this Network to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @instance * @returns {Object.} JSON object */ - NetworkFee.prototype.toJSON = function toJSON() { + Network.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NetworkFee; + return Network; })(); - GetStatusResponse.Network = (function() { - - /** - * Properties of a Network. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @interface INetwork - * @property {number|null} [peersCount] Network peersCount - * @property {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee|null} [fee] Network fee - */ + return GetBlockchainStatusResponse; + })(); - /** - * Constructs a new Network. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @classdesc Represents a Network. - * @implements INetwork - * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork=} [properties] Properties to set - */ - function Network(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v0.GetMasternodeStatusRequest = (function() { - /** - * Network peersCount. - * @member {number} peersCount - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @instance - */ - Network.prototype.peersCount = 0; + /** + * Properties of a GetMasternodeStatusRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetMasternodeStatusRequest + */ - /** - * Network fee. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee|null|undefined} fee - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @instance - */ - Network.prototype.fee = null; + /** + * Constructs a new GetMasternodeStatusRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetMasternodeStatusRequest. + * @implements IGetMasternodeStatusRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest=} [properties] Properties to set + */ + function GetMasternodeStatusRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new Network instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network instance - */ - Network.create = function create(properties) { - return new Network(properties); - }; + /** + * Creates a new GetMasternodeStatusRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest instance + */ + GetMasternodeStatusRequest.create = function create(properties) { + return new GetMasternodeStatusRequest(properties); + }; - /** - * Encodes the specified Network message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Network.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork} message Network message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Network.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.peersCount != null && Object.hasOwnProperty.call(message, "peersCount")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.peersCount); - if (message.fee != null && Object.hasOwnProperty.call(message, "fee")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.encode(message.fee, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified GetMasternodeStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} message GetMasternodeStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Encodes the specified Network message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Network.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork} message Network message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Network.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified GetMasternodeStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} message GetMasternodeStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a Network message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Network.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Network(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.peersCount = reader.uint32(); - break; - case 2: - message.fee = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a GetMasternodeStatusRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a Network message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Network.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a Network message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Network.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.peersCount != null && message.hasOwnProperty("peersCount")) - if (!$util.isInteger(message.peersCount)) - return "peersCount: integer expected"; - if (message.fee != null && message.hasOwnProperty("fee")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.verify(message.fee); - if (error) - return "fee." + error; - } - return null; - }; + /** + * Decodes a GetMasternodeStatusRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a Network message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network - */ - Network.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Network) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Network(); - if (object.peersCount != null) - message.peersCount = object.peersCount >>> 0; - if (object.fee != null) { - if (typeof object.fee !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.Network.fee: object expected"); - message.fee = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.fromObject(object.fee); - } - return message; - }; + /** + * Verifies a GetMasternodeStatusRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMasternodeStatusRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Creates a plain object from a Network message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Network} message Network - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Network.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.peersCount = 0; - object.fee = null; + /** + * Creates a GetMasternodeStatusRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest + */ + GetMasternodeStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest) + return object; + return new $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest(); + }; + + /** + * Creates a plain object from a GetMasternodeStatusRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} message GetMasternodeStatusRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMasternodeStatusRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this GetMasternodeStatusRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @instance + * @returns {Object.} JSON object + */ + GetMasternodeStatusRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetMasternodeStatusRequest; + })(); + + v0.GetMasternodeStatusResponse = (function() { + + /** + * Properties of a GetMasternodeStatusResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetMasternodeStatusResponse + * @property {org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status|null} [status] GetMasternodeStatusResponse status + * @property {Uint8Array|null} [proTxHash] GetMasternodeStatusResponse proTxHash + * @property {number|null} [posePenalty] GetMasternodeStatusResponse posePenalty + * @property {boolean|null} [isSynced] GetMasternodeStatusResponse isSynced + * @property {number|null} [syncProgress] GetMasternodeStatusResponse syncProgress + */ + + /** + * Constructs a new GetMasternodeStatusResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetMasternodeStatusResponse. + * @implements IGetMasternodeStatusResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse=} [properties] Properties to set + */ + function GetMasternodeStatusResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetMasternodeStatusResponse status. + * @member {org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} status + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.status = 0; + + /** + * GetMasternodeStatusResponse proTxHash. + * @member {Uint8Array} proTxHash + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.proTxHash = $util.newBuffer([]); + + /** + * GetMasternodeStatusResponse posePenalty. + * @member {number} posePenalty + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.posePenalty = 0; + + /** + * GetMasternodeStatusResponse isSynced. + * @member {boolean} isSynced + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.isSynced = false; + + /** + * GetMasternodeStatusResponse syncProgress. + * @member {number} syncProgress + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.syncProgress = 0; + + /** + * Creates a new GetMasternodeStatusResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse instance + */ + GetMasternodeStatusResponse.create = function create(properties) { + return new GetMasternodeStatusResponse(properties); + }; + + /** + * Encodes the specified GetMasternodeStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse} message GetMasternodeStatusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.status); + if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proTxHash); + if (message.posePenalty != null && Object.hasOwnProperty.call(message, "posePenalty")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.posePenalty); + if (message.isSynced != null && Object.hasOwnProperty.call(message, "isSynced")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isSynced); + if (message.syncProgress != null && Object.hasOwnProperty.call(message, "syncProgress")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.syncProgress); + return writer; + }; + + /** + * Encodes the specified GetMasternodeStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse} message GetMasternodeStatusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetMasternodeStatusResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.int32(); + break; + case 2: + message.proTxHash = reader.bytes(); + break; + case 3: + message.posePenalty = reader.uint32(); + break; + case 4: + message.isSynced = reader.bool(); + break; + case 5: + message.syncProgress = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetMasternodeStatusResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetMasternodeStatusResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMasternodeStatusResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) + return "proTxHash: buffer expected"; + if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) + if (!$util.isInteger(message.posePenalty)) + return "posePenalty: integer expected"; + if (message.isSynced != null && message.hasOwnProperty("isSynced")) + if (typeof message.isSynced !== "boolean") + return "isSynced: boolean expected"; + if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) + if (typeof message.syncProgress !== "number") + return "syncProgress: number expected"; + return null; + }; + + /** + * Creates a GetMasternodeStatusResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse + */ + GetMasternodeStatusResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse(); + switch (object.status) { + case "UNKNOWN": + case 0: + message.status = 0; + break; + case "WAITING_FOR_PROTX": + case 1: + message.status = 1; + break; + case "POSE_BANNED": + case 2: + message.status = 2; + break; + case "REMOVED": + case 3: + message.status = 3; + break; + case "OPERATOR_KEY_CHANGED": + case 4: + message.status = 4; + break; + case "PROTX_IP_CHANGED": + case 5: + message.status = 5; + break; + case "READY": + case 6: + message.status = 6; + break; + case "ERROR": + case 7: + message.status = 7; + break; + } + if (object.proTxHash != null) + if (typeof object.proTxHash === "string") + $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); + else if (object.proTxHash.length >= 0) + message.proTxHash = object.proTxHash; + if (object.posePenalty != null) + message.posePenalty = object.posePenalty >>> 0; + if (object.isSynced != null) + message.isSynced = Boolean(object.isSynced); + if (object.syncProgress != null) + message.syncProgress = Number(object.syncProgress); + return message; + }; + + /** + * Creates a plain object from a GetMasternodeStatusResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} message GetMasternodeStatusResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMasternodeStatusResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.status = options.enums === String ? "UNKNOWN" : 0; + if (options.bytes === String) + object.proTxHash = ""; + else { + object.proTxHash = []; + if (options.bytes !== Array) + object.proTxHash = $util.newBuffer(object.proTxHash); + } + object.posePenalty = 0; + object.isSynced = false; + object.syncProgress = 0; + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status[message.status] : message.status; + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; + if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) + object.posePenalty = message.posePenalty; + if (message.isSynced != null && message.hasOwnProperty("isSynced")) + object.isSynced = message.isSynced; + if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) + object.syncProgress = options.json && !isFinite(message.syncProgress) ? String(message.syncProgress) : message.syncProgress; + return object; + }; + + /** + * Converts this GetMasternodeStatusResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + * @returns {Object.} JSON object + */ + GetMasternodeStatusResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Status enum. + * @name org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} WAITING_FOR_PROTX=1 WAITING_FOR_PROTX value + * @property {number} POSE_BANNED=2 POSE_BANNED value + * @property {number} REMOVED=3 REMOVED value + * @property {number} OPERATOR_KEY_CHANGED=4 OPERATOR_KEY_CHANGED value + * @property {number} PROTX_IP_CHANGED=5 PROTX_IP_CHANGED value + * @property {number} READY=6 READY value + * @property {number} ERROR=7 ERROR value + */ + GetMasternodeStatusResponse.Status = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "WAITING_FOR_PROTX"] = 1; + values[valuesById[2] = "POSE_BANNED"] = 2; + values[valuesById[3] = "REMOVED"] = 3; + values[valuesById[4] = "OPERATOR_KEY_CHANGED"] = 4; + values[valuesById[5] = "PROTX_IP_CHANGED"] = 5; + values[valuesById[6] = "READY"] = 6; + values[valuesById[7] = "ERROR"] = 7; + return values; + })(); + + return GetMasternodeStatusResponse; + })(); + + v0.GetBlockRequest = (function() { + + /** + * Properties of a GetBlockRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetBlockRequest + * @property {number|null} [height] GetBlockRequest height + * @property {string|null} [hash] GetBlockRequest hash + */ + + /** + * Constructs a new GetBlockRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetBlockRequest. + * @implements IGetBlockRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set + */ + function GetBlockRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBlockRequest height. + * @member {number} height + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + */ + GetBlockRequest.prototype.height = 0; + + /** + * GetBlockRequest hash. + * @member {string} hash + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + */ + GetBlockRequest.prototype.hash = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetBlockRequest block. + * @member {"height"|"hash"|undefined} block + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + */ + Object.defineProperty(GetBlockRequest.prototype, "block", { + get: $util.oneOfGetter($oneOfFields = ["height", "hash"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetBlockRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest instance + */ + GetBlockRequest.create = function create(properties) { + return new GetBlockRequest(properties); + }; + + /** + * Encodes the specified GetBlockRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.height); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.hash); + return writer; + }; + + /** + * Encodes the specified GetBlockRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBlockRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint32(); + break; + case 2: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.peersCount != null && message.hasOwnProperty("peersCount")) - object.peersCount = message.peersCount; - if (message.fee != null && message.hasOwnProperty("fee")) - object.fee = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(message.fee, options); + } + return message; + }; + + /** + * Decodes a GetBlockRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBlockRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBlockRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.height != null && message.hasOwnProperty("height")) { + properties.block = 1; + if (!$util.isInteger(message.height)) + return "height: integer expected"; + } + if (message.hash != null && message.hasOwnProperty("hash")) { + if (properties.block === 1) + return "block: multiple values"; + properties.block = 1; + if (!$util.isString(message.hash)) + return "hash: string expected"; + } + return null; + }; + + /** + * Creates a GetBlockRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + */ + GetBlockRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); + if (object.height != null) + message.height = object.height >>> 0; + if (object.hash != null) + message.hash = String(object.hash); + return message; + }; + + /** + * Creates a plain object from a GetBlockRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.GetBlockRequest} message GetBlockRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBlockRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.height != null && message.hasOwnProperty("height")) { + object.height = message.height; + if (options.oneofs) + object.block = "height"; + } + if (message.hash != null && message.hasOwnProperty("hash")) { + object.hash = message.hash; + if (options.oneofs) + object.block = "hash"; + } + return object; + }; + + /** + * Converts this GetBlockRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + * @returns {Object.} JSON object + */ + GetBlockRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetBlockRequest; + })(); + + v0.GetBlockResponse = (function() { + + /** + * Properties of a GetBlockResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetBlockResponse + * @property {Uint8Array|null} [block] GetBlockResponse block + */ + + /** + * Constructs a new GetBlockResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetBlockResponse. + * @implements IGetBlockResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set + */ + function GetBlockResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBlockResponse block. + * @member {Uint8Array} block + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @instance + */ + GetBlockResponse.prototype.block = $util.newBuffer([]); + + /** + * Creates a new GetBlockResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse instance + */ + GetBlockResponse.create = function create(properties) { + return new GetBlockResponse(properties); + }; + + /** + * Encodes the specified GetBlockResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.block); + return writer; + }; + + /** + * Encodes the specified GetBlockResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBlockResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBlockResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBlockResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBlockResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block != null && message.hasOwnProperty("block")) + if (!(message.block && typeof message.block.length === "number" || $util.isString(message.block))) + return "block: buffer expected"; + return null; + }; + + /** + * Creates a GetBlockResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + */ + GetBlockResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockResponse) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); + if (object.block != null) + if (typeof object.block === "string") + $util.base64.decode(object.block, message.block = $util.newBuffer($util.base64.length(object.block)), 0); + else if (object.block.length >= 0) + message.block = object.block; + return message; + }; - /** - * Converts this Network to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @instance - * @returns {Object.} JSON object - */ - Network.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetBlockResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.GetBlockResponse} message GetBlockResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBlockResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.block = ""; + else { + object.block = []; + if (options.bytes !== Array) + object.block = $util.newBuffer(object.block); + } + if (message.block != null && message.hasOwnProperty("block")) + object.block = options.bytes === String ? $util.base64.encode(message.block, 0, message.block.length) : options.bytes === Array ? Array.prototype.slice.call(message.block) : message.block; + return object; + }; - return Network; - })(); + /** + * Converts this GetBlockResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @instance + * @returns {Object.} JSON object + */ + GetBlockResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GetStatusResponse; + return GetBlockResponse; })(); - v0.GetBlockRequest = (function() { + v0.GetBestBlockHeightRequest = (function() { /** - * Properties of a GetBlockRequest. + * Properties of a GetBestBlockHeightRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetBlockRequest - * @property {number|null} [height] GetBlockRequest height - * @property {string|null} [hash] GetBlockRequest hash + * @interface IGetBestBlockHeightRequest */ /** - * Constructs a new GetBlockRequest. + * Constructs a new GetBestBlockHeightRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetBlockRequest. - * @implements IGetBlockRequest + * @classdesc Represents a GetBestBlockHeightRequest. + * @implements IGetBestBlockHeightRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest=} [properties] Properties to set */ - function GetBlockRequest(properties) { + function GetBestBlockHeightRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2495,103 +3154,63 @@ $root.org = (function() { } /** - * GetBlockRequest height. - * @member {number} height - * @memberof org.dash.platform.dapi.v0.GetBlockRequest - * @instance - */ - GetBlockRequest.prototype.height = 0; - - /** - * GetBlockRequest hash. - * @member {string} hash - * @memberof org.dash.platform.dapi.v0.GetBlockRequest - * @instance - */ - GetBlockRequest.prototype.hash = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * GetBlockRequest block. - * @member {"height"|"hash"|undefined} block - * @memberof org.dash.platform.dapi.v0.GetBlockRequest - * @instance - */ - Object.defineProperty(GetBlockRequest.prototype, "block", { - get: $util.oneOfGetter($oneOfFields = ["height", "hash"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new GetBlockRequest instance using the specified properties. + * Creates a new GetBestBlockHeightRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest instance */ - GetBlockRequest.create = function create(properties) { - return new GetBlockRequest(properties); + GetBestBlockHeightRequest.create = function create(properties) { + return new GetBestBlockHeightRequest(properties); }; /** - * Encodes the specified GetBlockRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * Encodes the specified GetBestBlockHeightRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} message GetBestBlockHeightRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockRequest.encode = function encode(message, writer) { + GetBestBlockHeightRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.height); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.hash); return writer; }; /** - * Encodes the specified GetBlockRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * Encodes the specified GetBestBlockHeightRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} message GetBestBlockHeightRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetBestBlockHeightRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetBlockRequest message from the specified reader or buffer. + * Decodes a GetBestBlockHeightRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockRequest.decode = function decode(reader, length) { + GetBestBlockHeightRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.height = reader.uint32(); - break; - case 2: - message.hash = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -2601,125 +3220,94 @@ $root.org = (function() { }; /** - * Decodes a GetBlockRequest message from the specified reader or buffer, length delimited. + * Decodes a GetBestBlockHeightRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockRequest.decodeDelimited = function decodeDelimited(reader) { + GetBestBlockHeightRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetBlockRequest message. + * Verifies a GetBestBlockHeightRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetBlockRequest.verify = function verify(message) { + GetBestBlockHeightRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.height != null && message.hasOwnProperty("height")) { - properties.block = 1; - if (!$util.isInteger(message.height)) - return "height: integer expected"; - } - if (message.hash != null && message.hasOwnProperty("hash")) { - if (properties.block === 1) - return "block: multiple values"; - properties.block = 1; - if (!$util.isString(message.hash)) - return "hash: string expected"; - } return null; }; /** - * Creates a GetBlockRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetBestBlockHeightRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest */ - GetBlockRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockRequest) + GetBestBlockHeightRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); - if (object.height != null) - message.height = object.height >>> 0; - if (object.hash != null) - message.hash = String(object.hash); - return message; + return new $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest(); }; /** - * Creates a plain object from a GetBlockRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetBestBlockHeightRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.GetBlockRequest} message GetBlockRequest + * @param {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} message GetBestBlockHeightRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetBlockRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.height != null && message.hasOwnProperty("height")) { - object.height = message.height; - if (options.oneofs) - object.block = "height"; - } - if (message.hash != null && message.hasOwnProperty("hash")) { - object.hash = message.hash; - if (options.oneofs) - object.block = "hash"; - } - return object; + GetBestBlockHeightRequest.toObject = function toObject() { + return {}; }; /** - * Converts this GetBlockRequest to JSON. + * Converts this GetBestBlockHeightRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @instance * @returns {Object.} JSON object */ - GetBlockRequest.prototype.toJSON = function toJSON() { + GetBestBlockHeightRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetBlockRequest; + return GetBestBlockHeightRequest; })(); - v0.GetBlockResponse = (function() { + v0.GetBestBlockHeightResponse = (function() { /** - * Properties of a GetBlockResponse. + * Properties of a GetBestBlockHeightResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetBlockResponse - * @property {Uint8Array|null} [block] GetBlockResponse block + * @interface IGetBestBlockHeightResponse + * @property {number|null} [height] GetBestBlockHeightResponse height */ /** - * Constructs a new GetBlockResponse. + * Constructs a new GetBestBlockHeightResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetBlockResponse. - * @implements IGetBlockResponse + * @classdesc Represents a GetBestBlockHeightResponse. + * @implements IGetBestBlockHeightResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse=} [properties] Properties to set */ - function GetBlockResponse(properties) { + function GetBestBlockHeightResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2727,75 +3315,75 @@ $root.org = (function() { } /** - * GetBlockResponse block. - * @member {Uint8Array} block - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * GetBestBlockHeightResponse height. + * @member {number} height + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @instance */ - GetBlockResponse.prototype.block = $util.newBuffer([]); + GetBestBlockHeightResponse.prototype.height = 0; /** - * Creates a new GetBlockResponse instance using the specified properties. + * Creates a new GetBestBlockHeightResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse instance */ - GetBlockResponse.create = function create(properties) { - return new GetBlockResponse(properties); + GetBestBlockHeightResponse.create = function create(properties) { + return new GetBestBlockHeightResponse(properties); }; /** - * Encodes the specified GetBlockResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * Encodes the specified GetBestBlockHeightResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse} message GetBestBlockHeightResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockResponse.encode = function encode(message, writer) { + GetBestBlockHeightResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.block); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.height); return writer; }; /** - * Encodes the specified GetBlockResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * Encodes the specified GetBestBlockHeightResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse} message GetBestBlockHeightResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetBestBlockHeightResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetBlockResponse message from the specified reader or buffer. + * Decodes a GetBestBlockHeightResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockResponse.decode = function decode(reader, length) { + GetBestBlockHeightResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.block = reader.bytes(); + message.height = reader.uint32(); break; default: reader.skipType(tag & 7); @@ -2806,96 +3394,87 @@ $root.org = (function() { }; /** - * Decodes a GetBlockResponse message from the specified reader or buffer, length delimited. + * Decodes a GetBestBlockHeightResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockResponse.decodeDelimited = function decodeDelimited(reader) { + GetBestBlockHeightResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetBlockResponse message. + * Verifies a GetBestBlockHeightResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetBlockResponse.verify = function verify(message) { + GetBestBlockHeightResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.block != null && message.hasOwnProperty("block")) - if (!(message.block && typeof message.block.length === "number" || $util.isString(message.block))) - return "block: buffer expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; return null; }; /** - * Creates a GetBlockResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetBestBlockHeightResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse */ - GetBlockResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockResponse) + GetBestBlockHeightResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); - if (object.block != null) - if (typeof object.block === "string") - $util.base64.decode(object.block, message.block = $util.newBuffer($util.base64.length(object.block)), 0); - else if (object.block.length >= 0) - message.block = object.block; + var message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse(); + if (object.height != null) + message.height = object.height >>> 0; return message; }; /** - * Creates a plain object from a GetBlockResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetBestBlockHeightResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.GetBlockResponse} message GetBlockResponse + * @param {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} message GetBestBlockHeightResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetBlockResponse.toObject = function toObject(message, options) { + GetBestBlockHeightResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - if (options.bytes === String) - object.block = ""; - else { - object.block = []; - if (options.bytes !== Array) - object.block = $util.newBuffer(object.block); - } - if (message.block != null && message.hasOwnProperty("block")) - object.block = options.bytes === String ? $util.base64.encode(message.block, 0, message.block.length) : options.bytes === Array ? Array.prototype.slice.call(message.block) : message.block; + object.height = 0; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; return object; }; /** - * Converts this GetBlockResponse to JSON. + * Converts this GetBestBlockHeightResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @instance * @returns {Object.} JSON object */ - GetBlockResponse.prototype.toJSON = function toJSON() { + GetBestBlockHeightResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetBlockResponse; + return GetBestBlockHeightResponse; })(); v0.BroadcastTransactionRequest = (function() { @@ -6170,6 +6749,362 @@ $root.org = (function() { return InstantSendLockMessages; })(); + v0.MasternodeListRequest = (function() { + + /** + * Properties of a MasternodeListRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IMasternodeListRequest + */ + + /** + * Constructs a new MasternodeListRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a MasternodeListRequest. + * @implements IMasternodeListRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest=} [properties] Properties to set + */ + function MasternodeListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new MasternodeListRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest instance + */ + MasternodeListRequest.create = function create(properties) { + return new MasternodeListRequest(properties); + }; + + /** + * Encodes the specified MasternodeListRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} message MasternodeListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MasternodeListRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} message MasternodeListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MasternodeListRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.MasternodeListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MasternodeListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MasternodeListRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MasternodeListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MasternodeListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest + */ + MasternodeListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.MasternodeListRequest) + return object; + return new $root.org.dash.platform.dapi.v0.MasternodeListRequest(); + }; + + /** + * Creates a plain object from a MasternodeListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.MasternodeListRequest} message MasternodeListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MasternodeListRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MasternodeListRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @instance + * @returns {Object.} JSON object + */ + MasternodeListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MasternodeListRequest; + })(); + + v0.MasternodeListResponse = (function() { + + /** + * Properties of a MasternodeListResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IMasternodeListResponse + * @property {Uint8Array|null} [masternodeListDiff] MasternodeListResponse masternodeListDiff + */ + + /** + * Constructs a new MasternodeListResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a MasternodeListResponse. + * @implements IMasternodeListResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse=} [properties] Properties to set + */ + function MasternodeListResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MasternodeListResponse masternodeListDiff. + * @member {Uint8Array} masternodeListDiff + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @instance + */ + MasternodeListResponse.prototype.masternodeListDiff = $util.newBuffer([]); + + /** + * Creates a new MasternodeListResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse instance + */ + MasternodeListResponse.create = function create(properties) { + return new MasternodeListResponse(properties); + }; + + /** + * Encodes the specified MasternodeListResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse} message MasternodeListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.masternodeListDiff != null && Object.hasOwnProperty.call(message, "masternodeListDiff")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.masternodeListDiff); + return writer; + }; + + /** + * Encodes the specified MasternodeListResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse} message MasternodeListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MasternodeListResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.MasternodeListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.masternodeListDiff = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MasternodeListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MasternodeListResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MasternodeListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.masternodeListDiff != null && message.hasOwnProperty("masternodeListDiff")) + if (!(message.masternodeListDiff && typeof message.masternodeListDiff.length === "number" || $util.isString(message.masternodeListDiff))) + return "masternodeListDiff: buffer expected"; + return null; + }; + + /** + * Creates a MasternodeListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse + */ + MasternodeListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.MasternodeListResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.MasternodeListResponse(); + if (object.masternodeListDiff != null) + if (typeof object.masternodeListDiff === "string") + $util.base64.decode(object.masternodeListDiff, message.masternodeListDiff = $util.newBuffer($util.base64.length(object.masternodeListDiff)), 0); + else if (object.masternodeListDiff.length >= 0) + message.masternodeListDiff = object.masternodeListDiff; + return message; + }; + + /** + * Creates a plain object from a MasternodeListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.MasternodeListResponse} message MasternodeListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MasternodeListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.masternodeListDiff = ""; + else { + object.masternodeListDiff = []; + if (options.bytes !== Array) + object.masternodeListDiff = $util.newBuffer(object.masternodeListDiff); + } + if (message.masternodeListDiff != null && message.hasOwnProperty("masternodeListDiff")) + object.masternodeListDiff = options.bytes === String ? $util.base64.encode(message.masternodeListDiff, 0, message.masternodeListDiff.length) : options.bytes === Array ? Array.prototype.slice.call(message.masternodeListDiff) : message.masternodeListDiff; + return object; + }; + + /** + * Converts this MasternodeListResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @instance + * @returns {Object.} JSON object + */ + MasternodeListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MasternodeListResponse; + })(); + return v0; })(); diff --git a/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js b/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js index ae974b2f814..5bf2a3edaeb 100644 --- a/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js +++ b/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js @@ -23,24 +23,29 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.BloomFilter', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest.BlockCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Network', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Time', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Version', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.InstantSendLockMessages', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.RawTransactions', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest.FromBlockCase', null, { proto }); @@ -56,16 +61,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRespons * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusRequest = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusRequest'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -77,16 +82,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -98,16 +103,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Version'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version'; } /** * Generated by JsPbCodeGenerator. @@ -119,16 +124,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Time'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time'; } /** * Generated by JsPbCodeGenerator. @@ -140,16 +145,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain'; } /** * Generated by JsPbCodeGenerator. @@ -161,16 +166,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee'; } /** * Generated by JsPbCodeGenerator. @@ -182,16 +187,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network'; } /** * Generated by JsPbCodeGenerator. @@ -203,16 +208,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Network'; + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -256,6 +282,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetBlockResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -550,6 +618,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.displayName = 'proto.org.dash.platform.dapi.v0.InstantSendLockMessages'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListRequest.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListResponse.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListResponse'; +} @@ -566,8 +676,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject(opt_includeInstance, this); }; @@ -576,11 +686,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -596,23 +706,23 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusRequest; - return proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -632,9 +742,9 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -642,11 +752,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -667,8 +777,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject(opt_includeInstance, this); }; @@ -677,19 +787,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function( * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(includeInstance, f), - time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(includeInstance, f), + version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(includeInstance, f), + time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(includeInstance, f), status: jspb.Message.getFieldWithDefault(msg, 3, 0), syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0), - chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(includeInstance, f), - masternode: (f = msg.getMasternode()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(includeInstance, f), - network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(includeInstance, f) + chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(includeInstance, f), + network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(includeInstance, f) }; if (includeInstance) { @@ -703,23 +812,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeIns /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -727,17 +836,17 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader); msg.setVersion(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader); msg.setTime(value); break; case 3: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (reader.readEnum()); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (reader.readEnum()); msg.setStatus(value); break; case 4: @@ -745,18 +854,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = msg.setSyncProgress(value); break; case 5: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader); msg.setChain(value); break; - case 6: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader); - msg.setMasternode(value); - break; case 7: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader); msg.setNetwork(value); break; default: @@ -772,9 +876,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -782,18 +886,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = fu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getVersion(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter ); } f = message.getTime(); @@ -801,7 +905,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter ); } f = message.getStatus(); @@ -823,15 +927,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 5, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter - ); - } - f = message.getMasternode(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter ); } f = message.getNetwork(); @@ -839,7 +935,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 7, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter ); } }; @@ -848,7 +944,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Status = { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status = { NOT_STARTED: 0, SYNCING: 1, READY: 2, @@ -871,8 +967,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(opt_includeInstance, this); }; @@ -881,11 +977,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject = function(includeInstance, msg) { var f, obj = { protocol: jspb.Message.getFieldWithDefault(msg, 1, 0), software: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -903,23 +999,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -951,9 +1047,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -961,11 +1057,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getProtocol(); if (f !== 0) { @@ -995,16 +1091,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWrite * optional uint32 protocol = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getProtocol = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getProtocol = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setProtocol = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1013,16 +1109,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol * optional uint32 software = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getSoftware = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getSoftware = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setSoftware = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1031,16 +1127,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware * optional string agent = 3; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getAgent = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getAgent = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setAgent = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setAgent = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; @@ -1061,8 +1157,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(opt_includeInstance, this); }; @@ -1071,11 +1167,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject = function(includeInstance, msg) { var f, obj = { now: jspb.Message.getFieldWithDefault(msg, 1, 0), offset: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1093,23 +1189,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1141,9 +1237,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1151,11 +1247,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNow(); if (f !== 0) { @@ -1185,16 +1281,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = * optional uint32 now = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getNow = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getNow = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setNow = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1203,16 +1299,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = functi * optional int32 offset = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getOffset = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getOffset = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setOffset = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1221,16 +1317,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = fun * optional uint32 median = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getMedian = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getMedian = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setMedian = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setMedian = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1251,8 +1347,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(opt_includeInstance, this); }; @@ -1261,11 +1357,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), headersCount: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1288,23 +1384,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1356,9 +1452,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1366,11 +1462,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { @@ -1435,16 +1531,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter * optional string name = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getName = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setName = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -1453,16 +1549,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = func * optional uint32 headers_count = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getHeadersCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getHeadersCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setHeadersCount = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1471,16 +1567,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCoun * optional uint32 blocks_count = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBlocksCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBlocksCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBlocksCount = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1489,7 +1585,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount * optional bytes best_block_hash = 4; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -1499,7 +1595,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getBestBlockHash())); }; @@ -1512,7 +1608,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getBestBlockHash())); }; @@ -1520,9 +1616,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHash = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBestBlockHash = function(value) { return jspb.Message.setProto3BytesField(this, 4, value); }; @@ -1531,16 +1627,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHa * optional double difficulty = 5; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getDifficulty = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getDifficulty = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setDifficulty = function(value) { return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -1549,7 +1645,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty * optional bytes chain_work = 6; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; @@ -1559,7 +1655,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = * This is a type-conversion wrapper around `getChainWork()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getChainWork())); }; @@ -1572,7 +1668,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a * This is a type-conversion wrapper around `getChainWork()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getChainWork())); }; @@ -1580,9 +1676,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setChainWork = function(value) { return jspb.Message.setProto3BytesField(this, 6, value); }; @@ -1591,16 +1687,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = * optional bool is_synced = 7; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getIsSynced = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getIsSynced = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setIsSynced = function(value) { return jspb.Message.setProto3BooleanField(this, 7, value); }; @@ -1609,16 +1705,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = * optional double sync_progress = 8; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getSyncProgress = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getSyncProgress = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setSyncProgress = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setSyncProgress = function(value) { return jspb.Message.setProto3FloatField(this, 8, value); }; @@ -1639,8 +1735,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(opt_includeInstance, this); }; @@ -1649,17 +1745,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { var f, obj = { - status: jspb.Message.getFieldWithDefault(msg, 1, 0), - proTxHash: msg.getProTxHash_asB64(), - posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), - isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), - syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), + incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) }; if (includeInstance) { @@ -1673,23 +1766,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1697,24 +1790,12 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (reader.readEnum()); - msg.setStatus(value); + var value = /** @type {number} */ (reader.readDouble()); + msg.setRelay(value); break; case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPosePenalty(value); - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIsSynced(value); - break; - case 5: var value = /** @type {number} */ (reader.readDouble()); - msg.setSyncProgress(value); + msg.setIncremental(value); break; default: reader.skipField(); @@ -1729,9 +1810,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1739,44 +1820,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStatus(); + f = message.getRelay(); if (f !== 0.0) { - writer.writeEnum( + writer.writeDouble( 1, f ); } - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } - f = message.getPosePenalty(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getIsSynced(); - if (f) { - writer.writeBool( - 4, - f - ); - } - f = message.getSyncProgress(); + f = message.getIncremental(); if (f !== 0.0) { writer.writeDouble( - 5, + 2, f ); } @@ -1784,130 +1844,38 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWr /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status = { - UNKNOWN: 0, - WAITING_FOR_PROTX: 1, - POSE_BANNED: 2, - REMOVED: 3, - OPERATOR_KEY_CHANGED: 4, - PROTX_IP_CHANGED: 5, - READY: 6, - ERROR: 7 -}; - -/** - * optional Status status = 1; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -/** - * optional uint32 pose_penalty = 3; + * optional double relay = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getPosePenalty = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getRelay = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setPosePenalty = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional bool is_synced = 4; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getIsSynced = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setIsSynced = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setRelay = function(value) { + return jspb.Message.setProto3FloatField(this, 1, value); }; /** - * optional double sync_progress = 5; + * optional double incremental = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getIncremental = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setIncremental = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); }; @@ -1927,8 +1895,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(opt_includeInstance, this); }; @@ -1937,14 +1905,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject = function(includeInstance, msg) { var f, obj = { - relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), - incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) + peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), + fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(includeInstance, f) }; if (includeInstance) { @@ -1958,23 +1926,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1982,12 +1950,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readDouble()); - msg.setRelay(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setPeersCount(value); break; case 2: - var value = /** @type {number} */ (reader.readDouble()); - msg.setIncremental(value); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader); + msg.setFee(value); break; default: reader.skipField(); @@ -2002,9 +1971,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2012,234 +1981,220 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getRelay(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getPeersCount(); + if (f !== 0) { + writer.writeUint32( 1, f ); } - f = message.getIncremental(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getFee(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter ); } }; /** - * optional double relay = 1; + * optional uint32 peers_count = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getRelay = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getPeersCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setRelay = function(value) { - return jspb.Message.setProto3FloatField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setPeersCount = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional double incremental = 2; - * @return {number} + * optional NetworkFee fee = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getIncremental = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getFee = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, 2)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setFee = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setIncremental = function(value) { - return jspb.Message.setProto3FloatField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.clearFee = function() { + return this.setFee(undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.hasFee = function() { + return jspb.Message.getField(this, 2) != null; +}; +/** + * optional Version version = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getVersion = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, 1)); +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearVersion = function() { + return this.setVersion(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject = function(includeInstance, msg) { - var f, obj = { - peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), - fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(includeInstance, f) - }; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasVersion = function() { + return jspb.Message.getField(this, 1) != null; +}; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + +/** + * optional Time time = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getTime = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, 2)); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearTime = function() { + return this.setTime(undefined); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPeersCount(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader); - msg.setFee(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasTime = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional Status status = 3; + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPeersCount(); - if (f !== 0) { - writer.writeUint32( - 1, - f - ); - } - f = message.getFee(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); }; /** - * optional uint32 peers_count = 1; + * optional double sync_progress = 4; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getPeersCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setPeersCount = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 4, value); }; /** - * optional NetworkFee fee = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * optional Chain chain = 5; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getFee = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, 2)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getChain = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, 5)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setFee = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setChain = function(value) { + return jspb.Message.setWrapperField(this, 5, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = function() { - return this.setFee(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearChain = function() { + return this.setChain(undefined); }; @@ -2247,36 +2202,36 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.hasFee = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasChain = function() { + return jspb.Message.getField(this, 5) != null; }; /** - * optional Version version = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * optional Network network = 7; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getVersion = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, 1)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getNetwork = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, 7)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setVersion = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setNetwork = function(value) { + return jspb.Message.setWrapperField(this, 7, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = function() { - return this.setVersion(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearNetwork = function() { + return this.setNetwork(undefined); }; @@ -2284,192 +2239,397 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = funct * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasVersion = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasNetwork = function() { + return jspb.Message.getField(this, 7) != null; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional Time time = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getTime = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, 2)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject(opt_includeInstance, this); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setTime = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearTime = function() { - return this.setTime(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasTime = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional Status status = 3; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional double sync_progress = 4; - * @return {number} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject(opt_includeInstance, this); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject = function(includeInstance, msg) { + var f, obj = { + status: jspb.Message.getFieldWithDefault(msg, 1, 0), + proTxHash: msg.getProTxHash_asB64(), + posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), + isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), + syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional Chain chain = 5; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getChain = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, 5)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setChain = function(value) { - return jspb.Message.setWrapperField(this, 5, value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (reader.readEnum()); + msg.setStatus(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProTxHash(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPosePenalty(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsSynced(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setSyncProgress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearChain = function() { - return this.setChain(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasChain = function() { - return jspb.Message.getField(this, 5) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStatus(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPosePenalty(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getIsSynced(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getSyncProgress(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status = { + UNKNOWN: 0, + WAITING_FOR_PROTX: 1, + POSE_BANNED: 2, + REMOVED: 3, + OPERATOR_KEY_CHANGED: 4, + PROTX_IP_CHANGED: 5, + READY: 6, + ERROR: 7 +}; + +/** + * optional Status status = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional Masternode masternode = 6; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getMasternode = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, 6)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setMasternode = function(value) { - return jspb.Message.setWrapperField(this, 6, value); + * optional bytes pro_tx_hash = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * This is a type-conversion wrapper around `getProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProTxHash())); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional uint32 pose_penalty = 3; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearMasternode = function() { - return this.setMasternode(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getPosePenalty = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasMasternode = function() { - return jspb.Message.getField(this, 6) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setPosePenalty = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * optional Network network = 7; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * optional bool is_synced = 4; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getNetwork = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, 7)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getIsSynced = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setNetwork = function(value) { - return jspb.Message.setWrapperField(this, 7, value); + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setIsSynced = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional double sync_progress = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearNetwork = function() { - return this.setNetwork(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasNetwork = function() { - return jspb.Message.getField(this, 7) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -2783,7 +2943,262 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.deserializeBinaryFromReader = f */ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes block = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes block = 1; + * This is a type-conversion wrapper around `getBlock()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBlock())); +}; + + +/** + * optional bytes block = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBlock()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBlock())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2791,15 +3206,15 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeUint32( 1, f ); @@ -2808,44 +3223,20 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = funct /** - * optional bytes block = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes block = 1; - * This is a type-conversion wrapper around `getBlock()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBlock())); -}; - - -/** - * optional bytes block = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBlock()` - * @return {!Uint8Array} + * optional uint32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBlock())); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; @@ -5878,4 +6269,259 @@ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.prototype.clearMessagesL }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListRequest; + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject = function(includeInstance, msg) { + var f, obj = { + masternodeListDiff: msg.getMasternodeListDiff_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListResponse; + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMasternodeListDiff(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMasternodeListDiff_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes masternode_list_diff = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMasternodeListDiff())); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMasternodeListDiff())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} returns this + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.setMasternodeListDiff = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h index 7a4dec55e5b..a9fc68a2b30 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h @@ -29,66 +29,65 @@ CF_EXTERN_C_BEGIN @class BlockHeaders; @class BloomFilter; -@class GetStatusResponse_Chain; -@class GetStatusResponse_Masternode; -@class GetStatusResponse_Network; -@class GetStatusResponse_NetworkFee; -@class GetStatusResponse_Time; -@class GetStatusResponse_Version; +@class GetBlockchainStatusResponse_Chain; +@class GetBlockchainStatusResponse_Network; +@class GetBlockchainStatusResponse_NetworkFee; +@class GetBlockchainStatusResponse_Time; +@class GetBlockchainStatusResponse_Version; @class InstantSendLockMessages; @class RawTransactions; NS_ASSUME_NONNULL_BEGIN -#pragma mark - Enum GetStatusResponse_Status +#pragma mark - Enum GetBlockchainStatusResponse_Status -typedef GPB_ENUM(GetStatusResponse_Status) { +typedef GPB_ENUM(GetBlockchainStatusResponse_Status) { /** * Value used if any message's field encounters a value that is not defined * by this enum. The message will also have C functions to get/set the rawValue * of the field. **/ - GetStatusResponse_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - GetStatusResponse_Status_NotStarted = 0, - GetStatusResponse_Status_Syncing = 1, - GetStatusResponse_Status_Ready = 2, - GetStatusResponse_Status_Error = 3, + GetBlockchainStatusResponse_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetBlockchainStatusResponse_Status_NotStarted = 0, + GetBlockchainStatusResponse_Status_Syncing = 1, + GetBlockchainStatusResponse_Status_Ready = 2, + GetBlockchainStatusResponse_Status_Error = 3, }; -GPBEnumDescriptor *GetStatusResponse_Status_EnumDescriptor(void); +GPBEnumDescriptor *GetBlockchainStatusResponse_Status_EnumDescriptor(void); /** * Checks to see if the given value is defined by the enum or was not known at * the time this source was generated. **/ -BOOL GetStatusResponse_Status_IsValidValue(int32_t value); +BOOL GetBlockchainStatusResponse_Status_IsValidValue(int32_t value); -#pragma mark - Enum GetStatusResponse_Masternode_Status +#pragma mark - Enum GetMasternodeStatusResponse_Status -typedef GPB_ENUM(GetStatusResponse_Masternode_Status) { +typedef GPB_ENUM(GetMasternodeStatusResponse_Status) { /** * Value used if any message's field encounters a value that is not defined * by this enum. The message will also have C functions to get/set the rawValue * of the field. **/ - GetStatusResponse_Masternode_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - GetStatusResponse_Masternode_Status_Unknown = 0, - GetStatusResponse_Masternode_Status_WaitingForProtx = 1, - GetStatusResponse_Masternode_Status_PoseBanned = 2, - GetStatusResponse_Masternode_Status_Removed = 3, - GetStatusResponse_Masternode_Status_OperatorKeyChanged = 4, - GetStatusResponse_Masternode_Status_ProtxIpChanged = 5, - GetStatusResponse_Masternode_Status_Ready = 6, - GetStatusResponse_Masternode_Status_Error = 7, + GetMasternodeStatusResponse_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetMasternodeStatusResponse_Status_Unknown = 0, + GetMasternodeStatusResponse_Status_WaitingForProtx = 1, + GetMasternodeStatusResponse_Status_PoseBanned = 2, + GetMasternodeStatusResponse_Status_Removed = 3, + GetMasternodeStatusResponse_Status_OperatorKeyChanged = 4, + GetMasternodeStatusResponse_Status_ProtxIpChanged = 5, + GetMasternodeStatusResponse_Status_Ready = 6, + GetMasternodeStatusResponse_Status_Error = 7, }; -GPBEnumDescriptor *GetStatusResponse_Masternode_Status_EnumDescriptor(void); +GPBEnumDescriptor *GetMasternodeStatusResponse_Status_EnumDescriptor(void); /** * Checks to see if the given value is defined by the enum or was not known at * the time this source was generated. **/ -BOOL GetStatusResponse_Masternode_Status_IsValidValue(int32_t value); +BOOL GetMasternodeStatusResponse_Status_IsValidValue(int32_t value); #pragma mark - CoreRoot @@ -105,73 +104,68 @@ BOOL GetStatusResponse_Masternode_Status_IsValidValue(int32_t value); GPB_FINAL @interface CoreRoot : GPBRootObject @end -#pragma mark - GetStatusRequest +#pragma mark - GetBlockchainStatusRequest -GPB_FINAL @interface GetStatusRequest : GPBMessage +GPB_FINAL @interface GetBlockchainStatusRequest : GPBMessage @end -#pragma mark - GetStatusResponse +#pragma mark - GetBlockchainStatusResponse -typedef GPB_ENUM(GetStatusResponse_FieldNumber) { - GetStatusResponse_FieldNumber_Version = 1, - GetStatusResponse_FieldNumber_Time = 2, - GetStatusResponse_FieldNumber_Status = 3, - GetStatusResponse_FieldNumber_SyncProgress = 4, - GetStatusResponse_FieldNumber_Chain = 5, - GetStatusResponse_FieldNumber_Masternode = 6, - GetStatusResponse_FieldNumber_Network = 7, +typedef GPB_ENUM(GetBlockchainStatusResponse_FieldNumber) { + GetBlockchainStatusResponse_FieldNumber_Version = 1, + GetBlockchainStatusResponse_FieldNumber_Time = 2, + GetBlockchainStatusResponse_FieldNumber_Status = 3, + GetBlockchainStatusResponse_FieldNumber_SyncProgress = 4, + GetBlockchainStatusResponse_FieldNumber_Chain = 5, + GetBlockchainStatusResponse_FieldNumber_Network = 7, }; -GPB_FINAL @interface GetStatusResponse : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse : GPBMessage -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Version *version; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Version *version; /** Test to see if @c version has been set. */ @property(nonatomic, readwrite) BOOL hasVersion; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Time *time; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Time *time; /** Test to see if @c time has been set. */ @property(nonatomic, readwrite) BOOL hasTime; -@property(nonatomic, readwrite) GetStatusResponse_Status status; +@property(nonatomic, readwrite) GetBlockchainStatusResponse_Status status; @property(nonatomic, readwrite) double syncProgress; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Chain *chain; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Chain *chain; /** Test to see if @c chain has been set. */ @property(nonatomic, readwrite) BOOL hasChain; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Masternode *masternode; -/** Test to see if @c masternode has been set. */ -@property(nonatomic, readwrite) BOOL hasMasternode; - -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Network *network; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Network *network; /** Test to see if @c network has been set. */ @property(nonatomic, readwrite) BOOL hasNetwork; @end /** - * Fetches the raw value of a @c GetStatusResponse's @c status property, even + * Fetches the raw value of a @c GetBlockchainStatusResponse's @c status property, even * if the value was not defined by the enum at the time the code was generated. **/ -int32_t GetStatusResponse_Status_RawValue(GetStatusResponse *message); +int32_t GetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message); /** - * Sets the raw value of an @c GetStatusResponse's @c status property, allowing + * Sets the raw value of an @c GetBlockchainStatusResponse's @c status property, allowing * it to be set to a value that was not defined by the enum at the time the code * was generated. **/ -void SetGetStatusResponse_Status_RawValue(GetStatusResponse *message, int32_t value); +void SetGetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message, int32_t value); -#pragma mark - GetStatusResponse_Version +#pragma mark - GetBlockchainStatusResponse_Version -typedef GPB_ENUM(GetStatusResponse_Version_FieldNumber) { - GetStatusResponse_Version_FieldNumber_Protocol = 1, - GetStatusResponse_Version_FieldNumber_Software = 2, - GetStatusResponse_Version_FieldNumber_Agent = 3, +typedef GPB_ENUM(GetBlockchainStatusResponse_Version_FieldNumber) { + GetBlockchainStatusResponse_Version_FieldNumber_Protocol = 1, + GetBlockchainStatusResponse_Version_FieldNumber_Software = 2, + GetBlockchainStatusResponse_Version_FieldNumber_Agent = 3, }; -GPB_FINAL @interface GetStatusResponse_Version : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_Version : GPBMessage @property(nonatomic, readwrite) uint32_t protocol; @@ -181,15 +175,15 @@ GPB_FINAL @interface GetStatusResponse_Version : GPBMessage @end -#pragma mark - GetStatusResponse_Time +#pragma mark - GetBlockchainStatusResponse_Time -typedef GPB_ENUM(GetStatusResponse_Time_FieldNumber) { - GetStatusResponse_Time_FieldNumber_Now = 1, - GetStatusResponse_Time_FieldNumber_Offset = 2, - GetStatusResponse_Time_FieldNumber_Median = 3, +typedef GPB_ENUM(GetBlockchainStatusResponse_Time_FieldNumber) { + GetBlockchainStatusResponse_Time_FieldNumber_Now = 1, + GetBlockchainStatusResponse_Time_FieldNumber_Offset = 2, + GetBlockchainStatusResponse_Time_FieldNumber_Median = 3, }; -GPB_FINAL @interface GetStatusResponse_Time : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_Time : GPBMessage @property(nonatomic, readwrite) uint32_t now; @@ -199,20 +193,20 @@ GPB_FINAL @interface GetStatusResponse_Time : GPBMessage @end -#pragma mark - GetStatusResponse_Chain - -typedef GPB_ENUM(GetStatusResponse_Chain_FieldNumber) { - GetStatusResponse_Chain_FieldNumber_Name = 1, - GetStatusResponse_Chain_FieldNumber_HeadersCount = 2, - GetStatusResponse_Chain_FieldNumber_BlocksCount = 3, - GetStatusResponse_Chain_FieldNumber_BestBlockHash = 4, - GetStatusResponse_Chain_FieldNumber_Difficulty = 5, - GetStatusResponse_Chain_FieldNumber_ChainWork = 6, - GetStatusResponse_Chain_FieldNumber_IsSynced = 7, - GetStatusResponse_Chain_FieldNumber_SyncProgress = 8, +#pragma mark - GetBlockchainStatusResponse_Chain + +typedef GPB_ENUM(GetBlockchainStatusResponse_Chain_FieldNumber) { + GetBlockchainStatusResponse_Chain_FieldNumber_Name = 1, + GetBlockchainStatusResponse_Chain_FieldNumber_HeadersCount = 2, + GetBlockchainStatusResponse_Chain_FieldNumber_BlocksCount = 3, + GetBlockchainStatusResponse_Chain_FieldNumber_BestBlockHash = 4, + GetBlockchainStatusResponse_Chain_FieldNumber_Difficulty = 5, + GetBlockchainStatusResponse_Chain_FieldNumber_ChainWork = 6, + GetBlockchainStatusResponse_Chain_FieldNumber_IsSynced = 7, + GetBlockchainStatusResponse_Chain_FieldNumber_SyncProgress = 8, }; -GPB_FINAL @interface GetStatusResponse_Chain : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_Chain : GPBMessage @property(nonatomic, readwrite, copy, null_resettable) NSString *name; @@ -232,74 +226,80 @@ GPB_FINAL @interface GetStatusResponse_Chain : GPBMessage @end -#pragma mark - GetStatusResponse_Masternode +#pragma mark - GetBlockchainStatusResponse_NetworkFee -typedef GPB_ENUM(GetStatusResponse_Masternode_FieldNumber) { - GetStatusResponse_Masternode_FieldNumber_Status = 1, - GetStatusResponse_Masternode_FieldNumber_ProTxHash = 2, - GetStatusResponse_Masternode_FieldNumber_PosePenalty = 3, - GetStatusResponse_Masternode_FieldNumber_IsSynced = 4, - GetStatusResponse_Masternode_FieldNumber_SyncProgress = 5, +typedef GPB_ENUM(GetBlockchainStatusResponse_NetworkFee_FieldNumber) { + GetBlockchainStatusResponse_NetworkFee_FieldNumber_Relay = 1, + GetBlockchainStatusResponse_NetworkFee_FieldNumber_Incremental = 2, }; -GPB_FINAL @interface GetStatusResponse_Masternode : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_NetworkFee : GPBMessage -@property(nonatomic, readwrite) GetStatusResponse_Masternode_Status status; +@property(nonatomic, readwrite) double relay; -@property(nonatomic, readwrite, copy, null_resettable) NSData *proTxHash; +@property(nonatomic, readwrite) double incremental; -@property(nonatomic, readwrite) uint32_t posePenalty; +@end -@property(nonatomic, readwrite) BOOL isSynced; +#pragma mark - GetBlockchainStatusResponse_Network -@property(nonatomic, readwrite) double syncProgress; - -@end +typedef GPB_ENUM(GetBlockchainStatusResponse_Network_FieldNumber) { + GetBlockchainStatusResponse_Network_FieldNumber_PeersCount = 1, + GetBlockchainStatusResponse_Network_FieldNumber_Fee = 2, +}; -/** - * Fetches the raw value of a @c GetStatusResponse_Masternode's @c status property, even - * if the value was not defined by the enum at the time the code was generated. - **/ -int32_t GetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message); -/** - * Sets the raw value of an @c GetStatusResponse_Masternode's @c status property, allowing - * it to be set to a value that was not defined by the enum at the time the code - * was generated. - **/ -void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message, int32_t value); +GPB_FINAL @interface GetBlockchainStatusResponse_Network : GPBMessage -#pragma mark - GetStatusResponse_NetworkFee +@property(nonatomic, readwrite) uint32_t peersCount; -typedef GPB_ENUM(GetStatusResponse_NetworkFee_FieldNumber) { - GetStatusResponse_NetworkFee_FieldNumber_Relay = 1, - GetStatusResponse_NetworkFee_FieldNumber_Incremental = 2, -}; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_NetworkFee *fee; +/** Test to see if @c fee has been set. */ +@property(nonatomic, readwrite) BOOL hasFee; -GPB_FINAL @interface GetStatusResponse_NetworkFee : GPBMessage +@end -@property(nonatomic, readwrite) double relay; +#pragma mark - GetMasternodeStatusRequest -@property(nonatomic, readwrite) double incremental; +GPB_FINAL @interface GetMasternodeStatusRequest : GPBMessage @end -#pragma mark - GetStatusResponse_Network +#pragma mark - GetMasternodeStatusResponse -typedef GPB_ENUM(GetStatusResponse_Network_FieldNumber) { - GetStatusResponse_Network_FieldNumber_PeersCount = 1, - GetStatusResponse_Network_FieldNumber_Fee = 2, +typedef GPB_ENUM(GetMasternodeStatusResponse_FieldNumber) { + GetMasternodeStatusResponse_FieldNumber_Status = 1, + GetMasternodeStatusResponse_FieldNumber_ProTxHash = 2, + GetMasternodeStatusResponse_FieldNumber_PosePenalty = 3, + GetMasternodeStatusResponse_FieldNumber_IsSynced = 4, + GetMasternodeStatusResponse_FieldNumber_SyncProgress = 5, }; -GPB_FINAL @interface GetStatusResponse_Network : GPBMessage +GPB_FINAL @interface GetMasternodeStatusResponse : GPBMessage -@property(nonatomic, readwrite) uint32_t peersCount; +@property(nonatomic, readwrite) GetMasternodeStatusResponse_Status status; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_NetworkFee *fee; -/** Test to see if @c fee has been set. */ -@property(nonatomic, readwrite) BOOL hasFee; +@property(nonatomic, readwrite, copy, null_resettable) NSData *proTxHash; + +@property(nonatomic, readwrite) uint32_t posePenalty; + +@property(nonatomic, readwrite) BOOL isSynced; + +@property(nonatomic, readwrite) double syncProgress; @end +/** + * Fetches the raw value of a @c GetMasternodeStatusResponse's @c status property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message); +/** + * Sets the raw value of an @c GetMasternodeStatusResponse's @c status property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message, int32_t value); + #pragma mark - GetBlockRequest typedef GPB_ENUM(GetBlockRequest_FieldNumber) { @@ -340,6 +340,24 @@ GPB_FINAL @interface GetBlockResponse : GPBMessage @end +#pragma mark - GetBestBlockHeightRequest + +GPB_FINAL @interface GetBestBlockHeightRequest : GPBMessage + +@end + +#pragma mark - GetBestBlockHeightResponse + +typedef GPB_ENUM(GetBestBlockHeightResponse_FieldNumber) { + GetBestBlockHeightResponse_FieldNumber_Height = 1, +}; + +GPB_FINAL @interface GetBestBlockHeightResponse : GPBMessage + +@property(nonatomic, readwrite) uint32_t height; + +@end + #pragma mark - BroadcastTransactionRequest typedef GPB_ENUM(BroadcastTransactionRequest_FieldNumber) { @@ -626,6 +644,24 @@ GPB_FINAL @interface InstantSendLockMessages : GPBMessage @end +#pragma mark - MasternodeListRequest + +GPB_FINAL @interface MasternodeListRequest : GPBMessage + +@end + +#pragma mark - MasternodeListResponse + +typedef GPB_ENUM(MasternodeListResponse_FieldNumber) { + MasternodeListResponse_FieldNumber_MasternodeListDiff = 1, +}; + +GPB_FINAL @interface MasternodeListResponse : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *masternodeListDiff; + +@end + NS_ASSUME_NONNULL_END CF_EXTERN_C_END diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m index 86ff51575a1..9a928f3742a 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m @@ -29,13 +29,12 @@ // We don't use [Foo class] because it is not a static value. GPBObjCClassDeclaration(BlockHeaders); GPBObjCClassDeclaration(BloomFilter); -GPBObjCClassDeclaration(GetStatusResponse); -GPBObjCClassDeclaration(GetStatusResponse_Chain); -GPBObjCClassDeclaration(GetStatusResponse_Masternode); -GPBObjCClassDeclaration(GetStatusResponse_Network); -GPBObjCClassDeclaration(GetStatusResponse_NetworkFee); -GPBObjCClassDeclaration(GetStatusResponse_Time); -GPBObjCClassDeclaration(GetStatusResponse_Version); +GPBObjCClassDeclaration(GetBlockchainStatusResponse); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Chain); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Network); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_NetworkFee); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Time); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Version); GPBObjCClassDeclaration(InstantSendLockMessages); GPBObjCClassDeclaration(RawTransactions); @@ -62,14 +61,14 @@ @implementation CoreRoot return descriptor; } -#pragma mark - GetStatusRequest +#pragma mark - GetBlockchainStatusRequest -@implementation GetStatusRequest +@implementation GetBlockchainStatusRequest -typedef struct GetStatusRequest__storage_ { +typedef struct GetBlockchainStatusRequest__storage_ { uint32_t _has_storage_[1]; -} GetStatusRequest__storage_; +} GetBlockchainStatusRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -77,12 +76,12 @@ + (GPBDescriptor *)descriptor { static GPBDescriptor *descriptor = nil; if (!descriptor) { GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusRequest class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusRequest class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:NULL fieldCount:0 - storageSize:sizeof(GetStatusRequest__storage_) + storageSize:sizeof(GetBlockchainStatusRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); @@ -94,28 +93,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse +#pragma mark - GetBlockchainStatusResponse -@implementation GetStatusResponse +@implementation GetBlockchainStatusResponse @dynamic hasVersion, version; @dynamic hasTime, time; @dynamic status; @dynamic syncProgress; @dynamic hasChain, chain; -@dynamic hasMasternode, masternode; @dynamic hasNetwork, network; -typedef struct GetStatusResponse__storage_ { +typedef struct GetBlockchainStatusResponse__storage_ { uint32_t _has_storage_[1]; - GetStatusResponse_Status status; - GetStatusResponse_Version *version; - GetStatusResponse_Time *time; - GetStatusResponse_Chain *chain; - GetStatusResponse_Masternode *masternode; - GetStatusResponse_Network *network; + GetBlockchainStatusResponse_Status status; + GetBlockchainStatusResponse_Version *version; + GetBlockchainStatusResponse_Time *time; + GetBlockchainStatusResponse_Chain *chain; + GetBlockchainStatusResponse_Network *network; double syncProgress; -} GetStatusResponse__storage_; +} GetBlockchainStatusResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -125,75 +122,66 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "version", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Version), - .number = GetStatusResponse_FieldNumber_Version, + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Version), + .number = GetBlockchainStatusResponse_FieldNumber_Version, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, version), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, version), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "time", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Time), - .number = GetStatusResponse_FieldNumber_Time, + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Time), + .number = GetBlockchainStatusResponse_FieldNumber_Time, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, time), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, time), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "status", - .dataTypeSpecific.enumDescFunc = GetStatusResponse_Status_EnumDescriptor, - .number = GetStatusResponse_FieldNumber_Status, + .dataTypeSpecific.enumDescFunc = GetBlockchainStatusResponse_Status_EnumDescriptor, + .number = GetBlockchainStatusResponse_FieldNumber_Status, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, status), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, status), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeEnum, }, { .name = "syncProgress", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_FieldNumber_SyncProgress, + .number = GetBlockchainStatusResponse_FieldNumber_SyncProgress, .hasIndex = 3, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, syncProgress), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, syncProgress), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, { .name = "chain", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Chain), - .number = GetStatusResponse_FieldNumber_Chain, + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Chain), + .number = GetBlockchainStatusResponse_FieldNumber_Chain, .hasIndex = 4, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, chain), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "masternode", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Masternode), - .number = GetStatusResponse_FieldNumber_Masternode, - .hasIndex = 5, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, masternode), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, chain), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "network", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Network), - .number = GetStatusResponse_FieldNumber_Network, - .hasIndex = 6, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, network), + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Network), + .number = GetBlockchainStatusResponse_FieldNumber_Network, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, network), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse__storage_) + storageSize:sizeof(GetBlockchainStatusResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); @@ -205,37 +193,37 @@ + (GPBDescriptor *)descriptor { @end -int32_t GetStatusResponse_Status_RawValue(GetStatusResponse *message) { - GPBDescriptor *descriptor = [GetStatusResponse descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_FieldNumber_Status]; +int32_t GetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message) { + GPBDescriptor *descriptor = [GetBlockchainStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetBlockchainStatusResponse_FieldNumber_Status]; return GPBGetMessageRawEnumField(message, field); } -void SetGetStatusResponse_Status_RawValue(GetStatusResponse *message, int32_t value) { - GPBDescriptor *descriptor = [GetStatusResponse descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_FieldNumber_Status]; +void SetGetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message, int32_t value) { + GPBDescriptor *descriptor = [GetBlockchainStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetBlockchainStatusResponse_FieldNumber_Status]; GPBSetMessageRawEnumField(message, field, value); } -#pragma mark - Enum GetStatusResponse_Status +#pragma mark - Enum GetBlockchainStatusResponse_Status -GPBEnumDescriptor *GetStatusResponse_Status_EnumDescriptor(void) { +GPBEnumDescriptor *GetBlockchainStatusResponse_Status_EnumDescriptor(void) { static _Atomic(GPBEnumDescriptor*) descriptor = nil; if (!descriptor) { static const char *valueNames = "NotStarted\000Syncing\000Ready\000Error\000"; static const int32_t values[] = { - GetStatusResponse_Status_NotStarted, - GetStatusResponse_Status_Syncing, - GetStatusResponse_Status_Ready, - GetStatusResponse_Status_Error, + GetBlockchainStatusResponse_Status_NotStarted, + GetBlockchainStatusResponse_Status_Syncing, + GetBlockchainStatusResponse_Status_Ready, + GetBlockchainStatusResponse_Status_Error, }; GPBEnumDescriptor *worker = - [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetStatusResponse_Status) + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetBlockchainStatusResponse_Status) valueNames:valueNames values:values count:(uint32_t)(sizeof(values) / sizeof(int32_t)) - enumVerifier:GetStatusResponse_Status_IsValidValue]; + enumVerifier:GetBlockchainStatusResponse_Status_IsValidValue]; GPBEnumDescriptor *expected = nil; if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { [worker release]; @@ -244,32 +232,32 @@ void SetGetStatusResponse_Status_RawValue(GetStatusResponse *message, int32_t va return descriptor; } -BOOL GetStatusResponse_Status_IsValidValue(int32_t value__) { +BOOL GetBlockchainStatusResponse_Status_IsValidValue(int32_t value__) { switch (value__) { - case GetStatusResponse_Status_NotStarted: - case GetStatusResponse_Status_Syncing: - case GetStatusResponse_Status_Ready: - case GetStatusResponse_Status_Error: + case GetBlockchainStatusResponse_Status_NotStarted: + case GetBlockchainStatusResponse_Status_Syncing: + case GetBlockchainStatusResponse_Status_Ready: + case GetBlockchainStatusResponse_Status_Error: return YES; default: return NO; } } -#pragma mark - GetStatusResponse_Version +#pragma mark - GetBlockchainStatusResponse_Version -@implementation GetStatusResponse_Version +@implementation GetBlockchainStatusResponse_Version @dynamic protocol; @dynamic software; @dynamic agent; -typedef struct GetStatusResponse_Version__storage_ { +typedef struct GetBlockchainStatusResponse_Version__storage_ { uint32_t _has_storage_[1]; uint32_t protocol; uint32_t software; NSString *agent; -} GetStatusResponse_Version__storage_; +} GetBlockchainStatusResponse_Version__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -280,40 +268,40 @@ + (GPBDescriptor *)descriptor { { .name = "protocol", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Version_FieldNumber_Protocol, + .number = GetBlockchainStatusResponse_Version_FieldNumber_Protocol, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Version__storage_, protocol), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Version__storage_, protocol), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "software", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Version_FieldNumber_Software, + .number = GetBlockchainStatusResponse_Version_FieldNumber_Software, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Version__storage_, software), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Version__storage_, software), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "agent", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Version_FieldNumber_Agent, + .number = GetBlockchainStatusResponse_Version_FieldNumber_Agent, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Version__storage_, agent), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Version__storage_, agent), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeString, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Version class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Version class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Version__storage_) + storageSize:sizeof(GetBlockchainStatusResponse_Version__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -324,20 +312,20 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Time +#pragma mark - GetBlockchainStatusResponse_Time -@implementation GetStatusResponse_Time +@implementation GetBlockchainStatusResponse_Time @dynamic now; @dynamic offset; @dynamic median; -typedef struct GetStatusResponse_Time__storage_ { +typedef struct GetBlockchainStatusResponse_Time__storage_ { uint32_t _has_storage_[1]; uint32_t now; int32_t offset; uint32_t median; -} GetStatusResponse_Time__storage_; +} GetBlockchainStatusResponse_Time__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -348,40 +336,40 @@ + (GPBDescriptor *)descriptor { { .name = "now", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Time_FieldNumber_Now, + .number = GetBlockchainStatusResponse_Time_FieldNumber_Now, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Time__storage_, now), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Time__storage_, now), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "offset", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Time_FieldNumber_Offset, + .number = GetBlockchainStatusResponse_Time_FieldNumber_Offset, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Time__storage_, offset), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Time__storage_, offset), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeInt32, }, { .name = "median", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Time_FieldNumber_Median, + .number = GetBlockchainStatusResponse_Time_FieldNumber_Median, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Time__storage_, median), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Time__storage_, median), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Time class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Time class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Time__storage_) + storageSize:sizeof(GetBlockchainStatusResponse_Time__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -392,9 +380,9 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Chain +#pragma mark - GetBlockchainStatusResponse_Chain -@implementation GetStatusResponse_Chain +@implementation GetBlockchainStatusResponse_Chain @dynamic name; @dynamic headersCount; @@ -405,7 +393,7 @@ @implementation GetStatusResponse_Chain @dynamic isSynced; @dynamic syncProgress; -typedef struct GetStatusResponse_Chain__storage_ { +typedef struct GetBlockchainStatusResponse_Chain__storage_ { uint32_t _has_storage_[1]; uint32_t headersCount; uint32_t blocksCount; @@ -414,7 +402,7 @@ @implementation GetStatusResponse_Chain NSData *chainWork; double difficulty; double syncProgress; -} GetStatusResponse_Chain__storage_; +} GetBlockchainStatusResponse_Chain__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -425,61 +413,61 @@ + (GPBDescriptor *)descriptor { { .name = "name", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_Name, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_Name, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, name), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, name), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeString, }, { .name = "headersCount", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_HeadersCount, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_HeadersCount, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, headersCount), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, headersCount), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "blocksCount", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_BlocksCount, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_BlocksCount, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, blocksCount), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, blocksCount), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "bestBlockHash", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_BestBlockHash, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_BestBlockHash, .hasIndex = 3, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, bestBlockHash), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, bestBlockHash), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { .name = "difficulty", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_Difficulty, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_Difficulty, .hasIndex = 4, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, difficulty), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, difficulty), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, { .name = "chainWork", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_ChainWork, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_ChainWork, .hasIndex = 5, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, chainWork), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, chainWork), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { .name = "isSynced", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_IsSynced, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_IsSynced, .hasIndex = 6, .offset = 7, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), @@ -488,22 +476,79 @@ + (GPBDescriptor *)descriptor { { .name = "syncProgress", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_SyncProgress, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_SyncProgress, .hasIndex = 8, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, syncProgress), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, syncProgress), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeDouble, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Chain class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetBlockchainStatusResponse_Chain__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetBlockchainStatusResponse_NetworkFee + +@implementation GetBlockchainStatusResponse_NetworkFee + +@dynamic relay; +@dynamic incremental; + +typedef struct GetBlockchainStatusResponse_NetworkFee__storage_ { + uint32_t _has_storage_[1]; + double relay; + double incremental; +} GetBlockchainStatusResponse_NetworkFee__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "relay", + .dataTypeSpecific.clazz = Nil, + .number = GetBlockchainStatusResponse_NetworkFee_FieldNumber_Relay, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_NetworkFee__storage_, relay), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeDouble, + }, + { + .name = "incremental", + .dataTypeSpecific.clazz = Nil, + .number = GetBlockchainStatusResponse_NetworkFee_FieldNumber_Incremental, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_NetworkFee__storage_, incremental), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Chain class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_NetworkFee class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Chain__storage_) + storageSize:sizeof(GetBlockchainStatusResponse_NetworkFee__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -514,9 +559,98 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Masternode +#pragma mark - GetBlockchainStatusResponse_Network + +@implementation GetBlockchainStatusResponse_Network + +@dynamic peersCount; +@dynamic hasFee, fee; -@implementation GetStatusResponse_Masternode +typedef struct GetBlockchainStatusResponse_Network__storage_ { + uint32_t _has_storage_[1]; + uint32_t peersCount; + GetBlockchainStatusResponse_NetworkFee *fee; +} GetBlockchainStatusResponse_Network__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "peersCount", + .dataTypeSpecific.clazz = Nil, + .number = GetBlockchainStatusResponse_Network_FieldNumber_PeersCount, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Network__storage_, peersCount), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "fee", + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_NetworkFee), + .number = GetBlockchainStatusResponse_Network_FieldNumber_Fee, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Network__storage_, fee), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Network class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetBlockchainStatusResponse_Network__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetMasternodeStatusRequest + +@implementation GetMasternodeStatusRequest + + +typedef struct GetMasternodeStatusRequest__storage_ { + uint32_t _has_storage_[1]; +} GetMasternodeStatusRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetMasternodeStatusRequest class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:NULL + fieldCount:0 + storageSize:sizeof(GetMasternodeStatusRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetMasternodeStatusResponse + +@implementation GetMasternodeStatusResponse @dynamic status; @dynamic proTxHash; @@ -524,13 +658,13 @@ @implementation GetStatusResponse_Masternode @dynamic isSynced; @dynamic syncProgress; -typedef struct GetStatusResponse_Masternode__storage_ { +typedef struct GetMasternodeStatusResponse__storage_ { uint32_t _has_storage_[1]; - GetStatusResponse_Masternode_Status status; + GetMasternodeStatusResponse_Status status; uint32_t posePenalty; NSData *proTxHash; double syncProgress; -} GetStatusResponse_Masternode__storage_; +} GetMasternodeStatusResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -540,35 +674,35 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "status", - .dataTypeSpecific.enumDescFunc = GetStatusResponse_Masternode_Status_EnumDescriptor, - .number = GetStatusResponse_Masternode_FieldNumber_Status, + .dataTypeSpecific.enumDescFunc = GetMasternodeStatusResponse_Status_EnumDescriptor, + .number = GetMasternodeStatusResponse_FieldNumber_Status, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, status), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, status), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeEnum, }, { .name = "proTxHash", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_ProTxHash, + .number = GetMasternodeStatusResponse_FieldNumber_ProTxHash, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, proTxHash), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, proTxHash), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { .name = "posePenalty", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_PosePenalty, + .number = GetMasternodeStatusResponse_FieldNumber_PosePenalty, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, posePenalty), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, posePenalty), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "isSynced", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_IsSynced, + .number = GetMasternodeStatusResponse_FieldNumber_IsSynced, .hasIndex = 3, .offset = 4, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), @@ -577,22 +711,21 @@ + (GPBDescriptor *)descriptor { { .name = "syncProgress", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_SyncProgress, + .number = GetMasternodeStatusResponse_FieldNumber_SyncProgress, .hasIndex = 5, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, syncProgress), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, syncProgress), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Masternode class] + [GPBDescriptor allocDescriptorForClass:[GetMasternodeStatusResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Masternode__storage_) + storageSize:sizeof(GetMasternodeStatusResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -603,21 +736,21 @@ + (GPBDescriptor *)descriptor { @end -int32_t GetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message) { - GPBDescriptor *descriptor = [GetStatusResponse_Masternode descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_Masternode_FieldNumber_Status]; +int32_t GetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message) { + GPBDescriptor *descriptor = [GetMasternodeStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetMasternodeStatusResponse_FieldNumber_Status]; return GPBGetMessageRawEnumField(message, field); } -void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message, int32_t value) { - GPBDescriptor *descriptor = [GetStatusResponse_Masternode descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_Masternode_FieldNumber_Status]; +void SetGetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message, int32_t value) { + GPBDescriptor *descriptor = [GetMasternodeStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetMasternodeStatusResponse_FieldNumber_Status]; GPBSetMessageRawEnumField(message, field, value); } -#pragma mark - Enum GetStatusResponse_Masternode_Status +#pragma mark - Enum GetMasternodeStatusResponse_Status -GPBEnumDescriptor *GetStatusResponse_Masternode_Status_EnumDescriptor(void) { +GPBEnumDescriptor *GetMasternodeStatusResponse_Status_EnumDescriptor(void) { static _Atomic(GPBEnumDescriptor*) descriptor = nil; if (!descriptor) { static const char *valueNames = @@ -625,21 +758,21 @@ void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternod "ed\000OperatorKeyChanged\000ProtxIpChanged\000Rea" "dy\000Error\000"; static const int32_t values[] = { - GetStatusResponse_Masternode_Status_Unknown, - GetStatusResponse_Masternode_Status_WaitingForProtx, - GetStatusResponse_Masternode_Status_PoseBanned, - GetStatusResponse_Masternode_Status_Removed, - GetStatusResponse_Masternode_Status_OperatorKeyChanged, - GetStatusResponse_Masternode_Status_ProtxIpChanged, - GetStatusResponse_Masternode_Status_Ready, - GetStatusResponse_Masternode_Status_Error, + GetMasternodeStatusResponse_Status_Unknown, + GetMasternodeStatusResponse_Status_WaitingForProtx, + GetMasternodeStatusResponse_Status_PoseBanned, + GetMasternodeStatusResponse_Status_Removed, + GetMasternodeStatusResponse_Status_OperatorKeyChanged, + GetMasternodeStatusResponse_Status_ProtxIpChanged, + GetMasternodeStatusResponse_Status_Ready, + GetMasternodeStatusResponse_Status_Error, }; GPBEnumDescriptor *worker = - [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetStatusResponse_Masternode_Status) + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetMasternodeStatusResponse_Status) valueNames:valueNames values:values count:(uint32_t)(sizeof(values) / sizeof(int32_t)) - enumVerifier:GetStatusResponse_Masternode_Status_IsValidValue]; + enumVerifier:GetMasternodeStatusResponse_Status_IsValidValue]; GPBEnumDescriptor *expected = nil; if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { [worker release]; @@ -648,34 +781,35 @@ void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternod return descriptor; } -BOOL GetStatusResponse_Masternode_Status_IsValidValue(int32_t value__) { +BOOL GetMasternodeStatusResponse_Status_IsValidValue(int32_t value__) { switch (value__) { - case GetStatusResponse_Masternode_Status_Unknown: - case GetStatusResponse_Masternode_Status_WaitingForProtx: - case GetStatusResponse_Masternode_Status_PoseBanned: - case GetStatusResponse_Masternode_Status_Removed: - case GetStatusResponse_Masternode_Status_OperatorKeyChanged: - case GetStatusResponse_Masternode_Status_ProtxIpChanged: - case GetStatusResponse_Masternode_Status_Ready: - case GetStatusResponse_Masternode_Status_Error: + case GetMasternodeStatusResponse_Status_Unknown: + case GetMasternodeStatusResponse_Status_WaitingForProtx: + case GetMasternodeStatusResponse_Status_PoseBanned: + case GetMasternodeStatusResponse_Status_Removed: + case GetMasternodeStatusResponse_Status_OperatorKeyChanged: + case GetMasternodeStatusResponse_Status_ProtxIpChanged: + case GetMasternodeStatusResponse_Status_Ready: + case GetMasternodeStatusResponse_Status_Error: return YES; default: return NO; } } -#pragma mark - GetStatusResponse_NetworkFee +#pragma mark - GetBlockRequest -@implementation GetStatusResponse_NetworkFee +@implementation GetBlockRequest -@dynamic relay; -@dynamic incremental; +@dynamic blockOneOfCase; +@dynamic height; +@dynamic hash_p; -typedef struct GetStatusResponse_NetworkFee__storage_ { - uint32_t _has_storage_[1]; - double relay; - double incremental; -} GetStatusResponse_NetworkFee__storage_; +typedef struct GetBlockRequest__storage_ { + uint32_t _has_storage_[2]; + uint32_t height; + NSString *hash_p; +} GetBlockRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -684,33 +818,38 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "relay", + .name = "height", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_NetworkFee_FieldNumber_Relay, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_NetworkFee__storage_, relay), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeDouble, + .number = GetBlockRequest_FieldNumber_Height, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetBlockRequest__storage_, height), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, }, { - .name = "incremental", + .name = "hash_p", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_NetworkFee_FieldNumber_Incremental, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_NetworkFee__storage_, incremental), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeDouble, + .number = GetBlockRequest_FieldNumber_Hash_p, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetBlockRequest__storage_, hash_p), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_NetworkFee class] + [GPBDescriptor allocDescriptorForClass:[GetBlockRequest class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_NetworkFee__storage_) + storageSize:sizeof(GetBlockRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + static const char *oneofs[] = { + "block", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -721,18 +860,21 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Network +void GetBlockRequest_ClearBlockOneOfCase(GetBlockRequest *message) { + GPBDescriptor *descriptor = [GetBlockRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetBlockResponse -@implementation GetStatusResponse_Network +@implementation GetBlockResponse -@dynamic peersCount; -@dynamic hasFee, fee; +@dynamic block; -typedef struct GetStatusResponse_Network__storage_ { +typedef struct GetBlockResponse__storage_ { uint32_t _has_storage_[1]; - uint32_t peersCount; - GetStatusResponse_NetworkFee *fee; -} GetStatusResponse_Network__storage_; + NSData *block; +} GetBlockResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -741,33 +883,23 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "peersCount", + .name = "block", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Network_FieldNumber_PeersCount, + .number = GetBlockResponse_FieldNumber_Block, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Network__storage_, peersCount), + .offset = (uint32_t)offsetof(GetBlockResponse__storage_, block), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, - }, - { - .name = "fee", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_NetworkFee), - .number = GetStatusResponse_Network_FieldNumber_Fee, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Network__storage_, fee), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Network class] + [GPBDescriptor allocDescriptorForClass:[GetBlockResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Network__storage_) + storageSize:sizeof(GetBlockResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -778,59 +910,28 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetBlockRequest +#pragma mark - GetBestBlockHeightRequest -@implementation GetBlockRequest +@implementation GetBestBlockHeightRequest -@dynamic blockOneOfCase; -@dynamic height; -@dynamic hash_p; -typedef struct GetBlockRequest__storage_ { - uint32_t _has_storage_[2]; - uint32_t height; - NSString *hash_p; -} GetBlockRequest__storage_; +typedef struct GetBestBlockHeightRequest__storage_ { + uint32_t _has_storage_[1]; +} GetBestBlockHeightRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { static GPBDescriptor *descriptor = nil; if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "height", - .dataTypeSpecific.clazz = Nil, - .number = GetBlockRequest_FieldNumber_Height, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetBlockRequest__storage_, height), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeUInt32, - }, - { - .name = "hash_p", - .dataTypeSpecific.clazz = Nil, - .number = GetBlockRequest_FieldNumber_Hash_p, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetBlockRequest__storage_, hash_p), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeString, - }, - }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetBlockRequest class] + [GPBDescriptor allocDescriptorForClass:[GetBestBlockHeightRequest class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetBlockRequest__storage_) + fields:NULL + fieldCount:0 + storageSize:sizeof(GetBestBlockHeightRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "block", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -841,21 +942,16 @@ + (GPBDescriptor *)descriptor { @end -void GetBlockRequest_ClearBlockOneOfCase(GetBlockRequest *message) { - GPBDescriptor *descriptor = [GetBlockRequest descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetBlockResponse +#pragma mark - GetBestBlockHeightResponse -@implementation GetBlockResponse +@implementation GetBestBlockHeightResponse -@dynamic block; +@dynamic height; -typedef struct GetBlockResponse__storage_ { +typedef struct GetBestBlockHeightResponse__storage_ { uint32_t _has_storage_[1]; - NSData *block; -} GetBlockResponse__storage_; + uint32_t height; +} GetBestBlockHeightResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -864,22 +960,22 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "block", + .name = "height", .dataTypeSpecific.clazz = Nil, - .number = GetBlockResponse_FieldNumber_Block, + .number = GetBestBlockHeightResponse_FieldNumber_Height, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetBlockResponse__storage_, block), + .offset = (uint32_t)offsetof(GetBestBlockHeightResponse__storage_, height), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .dataType = GPBDataTypeUInt32, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetBlockResponse class] + [GPBDescriptor allocDescriptorForClass:[GetBestBlockHeightResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetBlockResponse__storage_) + storageSize:sizeof(GetBestBlockHeightResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); @@ -1773,6 +1869,83 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - MasternodeListRequest + +@implementation MasternodeListRequest + + +typedef struct MasternodeListRequest__storage_ { + uint32_t _has_storage_[1]; +} MasternodeListRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[MasternodeListRequest class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:NULL + fieldCount:0 + storageSize:sizeof(MasternodeListRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - MasternodeListResponse + +@implementation MasternodeListResponse + +@dynamic masternodeListDiff; + +typedef struct MasternodeListResponse__storage_ { + uint32_t _has_storage_[1]; + NSData *masternodeListDiff; +} MasternodeListResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "masternodeListDiff", + .dataTypeSpecific.clazz = Nil, + .number = MasternodeListResponse_FieldNumber_MasternodeListDiff, + .hasIndex = 0, + .offset = (uint32_t)offsetof(MasternodeListResponse__storage_, masternodeListDiff), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[MasternodeListResponse class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(MasternodeListResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma clang diagnostic pop diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h index a5016dbd657..96b789ae4b2 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h @@ -18,14 +18,20 @@ @class BlockHeadersWithChainLocksResponse; @class BroadcastTransactionRequest; @class BroadcastTransactionResponse; +@class GetBestBlockHeightRequest; +@class GetBestBlockHeightResponse; @class GetBlockRequest; @class GetBlockResponse; +@class GetBlockchainStatusRequest; +@class GetBlockchainStatusResponse; @class GetEstimatedTransactionFeeRequest; @class GetEstimatedTransactionFeeResponse; -@class GetStatusRequest; -@class GetStatusResponse; +@class GetMasternodeStatusRequest; +@class GetMasternodeStatusResponse; @class GetTransactionRequest; @class GetTransactionResponse; +@class MasternodeListRequest; +@class MasternodeListResponse; @class TransactionsWithProofsRequest; @class TransactionsWithProofsResponse; @@ -43,14 +49,22 @@ NS_ASSUME_NONNULL_BEGIN @protocol Core2 -#pragma mark getStatus(GetStatusRequest) returns (GetStatusResponse) +#pragma mark getBlockchainStatus(GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse) -- (GRPCUnaryProtoCall *)getStatusWithMessage:(GetStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +- (GRPCUnaryProtoCall *)getBlockchainStatusWithMessage:(GetBlockchainStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getMasternodeStatus(GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse) + +- (GRPCUnaryProtoCall *)getMasternodeStatusWithMessage:(GetMasternodeStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; #pragma mark getBlock(GetBlockRequest) returns (GetBlockResponse) - (GRPCUnaryProtoCall *)getBlockWithMessage:(GetBlockRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark getBestBlockHeight(GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse) + +- (GRPCUnaryProtoCall *)getBestBlockHeightWithMessage:(GetBestBlockHeightRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + #pragma mark broadcastTransaction(BroadcastTransactionRequest) returns (BroadcastTransactionResponse) - (GRPCUnaryProtoCall *)broadcastTransactionWithMessage:(BroadcastTransactionRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; @@ -71,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)subscribeToTransactionsWithProofsWithMessage:(TransactionsWithProofsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark subscribeToMasternodeList(MasternodeListRequest) returns (stream MasternodeListResponse) + +- (GRPCUnaryProtoCall *)subscribeToMasternodeListWithMessage:(MasternodeListRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + @end /** @@ -79,11 +97,18 @@ NS_ASSUME_NONNULL_BEGIN */ @protocol Core -#pragma mark getStatus(GetStatusRequest) returns (GetStatusResponse) +#pragma mark getBlockchainStatus(GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse) + +- (void)getBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler; + -- (void)getStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler; +#pragma mark getMasternodeStatus(GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse) -- (GRPCProtoCall *)RPCTogetStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler; +- (void)getMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler; #pragma mark getBlock(GetBlockRequest) returns (GetBlockResponse) @@ -93,6 +118,13 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetBlockWithRequest:(GetBlockRequest *)request handler:(void(^)(GetBlockResponse *_Nullable response, NSError *_Nullable error))handler; +#pragma mark getBestBlockHeight(GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse) + +- (void)getBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler; + + #pragma mark broadcastTransaction(BroadcastTransactionRequest) returns (BroadcastTransactionResponse) - (void)broadcastTransactionWithRequest:(BroadcastTransactionRequest *)request handler:(void(^)(BroadcastTransactionResponse *_Nullable response, NSError *_Nullable error))handler; @@ -128,6 +160,13 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTosubscribeToTransactionsWithProofsWithRequest:(TransactionsWithProofsRequest *)request eventHandler:(void(^)(BOOL done, TransactionsWithProofsResponse *_Nullable response, NSError *_Nullable error))eventHandler; +#pragma mark subscribeToMasternodeList(MasternodeListRequest) returns (stream MasternodeListResponse) + +- (void)subscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler; + +- (GRPCProtoCall *)RPCTosubscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler; + + @end diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m index 2c16c550ac9..2eb5f351c16 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m @@ -55,24 +55,44 @@ + (instancetype)serviceWithHost:(NSString *)host callOptions:(GRPCCallOptions *_ #pragma mark - Method Implementations -#pragma mark getStatus(GetStatusRequest) returns (GetStatusResponse) +#pragma mark getBlockchainStatus(GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse) -- (void)getStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetStatusWithRequest:request handler:handler] start]; +- (void)getBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetBlockchainStatusWithRequest:request handler:handler] start]; } // Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getStatus" +- (GRPCProtoCall *)RPCTogetBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getBlockchainStatus" requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetStatusResponse class] + responseClass:[GetBlockchainStatusResponse class] responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; } -- (GRPCUnaryProtoCall *)getStatusWithMessage:(GetStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getStatus" +- (GRPCUnaryProtoCall *)getBlockchainStatusWithMessage:(GetBlockchainStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getBlockchainStatus" message:message responseHandler:handler callOptions:callOptions - responseClass:[GetStatusResponse class]]; + responseClass:[GetBlockchainStatusResponse class]]; +} + +#pragma mark getMasternodeStatus(GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse) + +- (void)getMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetMasternodeStatusWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getMasternodeStatus" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetMasternodeStatusResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getMasternodeStatusWithMessage:(GetMasternodeStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getMasternodeStatus" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetMasternodeStatusResponse class]]; } #pragma mark getBlock(GetBlockRequest) returns (GetBlockResponse) @@ -95,6 +115,26 @@ - (GRPCUnaryProtoCall *)getBlockWithMessage:(GetBlockRequest *)message responseH responseClass:[GetBlockResponse class]]; } +#pragma mark getBestBlockHeight(GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse) + +- (void)getBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetBestBlockHeightWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getBestBlockHeight" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetBestBlockHeightResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getBestBlockHeightWithMessage:(GetBestBlockHeightRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getBestBlockHeight" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetBestBlockHeightResponse class]]; +} + #pragma mark broadcastTransaction(BroadcastTransactionRequest) returns (BroadcastTransactionResponse) - (void)broadcastTransactionWithRequest:(BroadcastTransactionRequest *)request handler:(void(^)(BroadcastTransactionResponse *_Nullable response, NSError *_Nullable error))handler{ @@ -195,5 +235,25 @@ - (GRPCUnaryProtoCall *)subscribeToTransactionsWithProofsWithMessage:(Transactio responseClass:[TransactionsWithProofsResponse class]]; } +#pragma mark subscribeToMasternodeList(MasternodeListRequest) returns (stream MasternodeListResponse) + +- (void)subscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler{ + [[self RPCTosubscribeToMasternodeListWithRequest:request eventHandler:eventHandler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTosubscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler{ + return [self RPCToMethod:@"subscribeToMasternodeList" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[MasternodeListResponse class] + responsesWriteable:[GRXWriteable writeableWithEventHandler:eventHandler]]; +} +- (GRPCUnaryProtoCall *)subscribeToMasternodeListWithMessage:(MasternodeListRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"subscribeToMasternodeList" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[MasternodeListResponse class]]; +} + @end #endif diff --git a/packages/dapi-grpc/clients/core/v0/python/core_pb2.py b/packages/dapi-grpc/clients/core/v0/python/core_pb2.py index cc79763de81..7a3ce10c143 100644 --- a/packages/dapi-grpc/clients/core/v0/python/core_pb2.py +++ b/packages/dapi-grpc/clients/core/v0/python/core_pb2.py @@ -19,105 +19,105 @@ syntax='proto3', serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\ncore.proto\x12\x19org.dash.platform.dapi.v0\"\x12\n\x10GetStatusRequest\"\x8e\n\n\x11GetStatusResponse\x12\x45\n\x07version\x18\x01 \x01(\x0b\x32\x34.org.dash.platform.dapi.v0.GetStatusResponse.Version\x12?\n\x04time\x18\x02 \x01(\x0b\x32\x31.org.dash.platform.dapi.v0.GetStatusResponse.Time\x12\x43\n\x06status\x18\x03 \x01(\x0e\x32\x33.org.dash.platform.dapi.v0.GetStatusResponse.Status\x12\x15\n\rsync_progress\x18\x04 \x01(\x01\x12\x41\n\x05\x63hain\x18\x05 \x01(\x0b\x32\x32.org.dash.platform.dapi.v0.GetStatusResponse.Chain\x12K\n\nmasternode\x18\x06 \x01(\x0b\x32\x37.org.dash.platform.dapi.v0.GetStatusResponse.Masternode\x12\x45\n\x07network\x18\x07 \x01(\x0b\x32\x34.org.dash.platform.dapi.v0.GetStatusResponse.Network\x1a<\n\x07Version\x12\x10\n\x08protocol\x18\x01 \x01(\r\x12\x10\n\x08software\x18\x02 \x01(\r\x12\r\n\x05\x61gent\x18\x03 \x01(\t\x1a\x33\n\x04Time\x12\x0b\n\x03now\x18\x01 \x01(\r\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x0e\n\x06median\x18\x03 \x01(\r\x1a\xad\x01\n\x05\x43hain\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x15\n\rheaders_count\x18\x02 \x01(\r\x12\x14\n\x0c\x62locks_count\x18\x03 \x01(\r\x12\x17\n\x0f\x62\x65st_block_hash\x18\x04 \x01(\x0c\x12\x12\n\ndifficulty\x18\x05 \x01(\x01\x12\x12\n\nchain_work\x18\x06 \x01(\x0c\x12\x11\n\tis_synced\x18\x07 \x01(\x08\x12\x15\n\rsync_progress\x18\x08 \x01(\x01\x1a\xc4\x02\n\nMasternode\x12N\n\x06status\x18\x01 \x01(\x0e\x32>.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status\x12\x13\n\x0bpro_tx_hash\x18\x02 \x01(\x0c\x12\x14\n\x0cpose_penalty\x18\x03 \x01(\r\x12\x11\n\tis_synced\x18\x04 \x01(\x08\x12\x15\n\rsync_progress\x18\x05 \x01(\x01\"\x90\x01\n\x06Status\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x15\n\x11WAITING_FOR_PROTX\x10\x01\x12\x0f\n\x0bPOSE_BANNED\x10\x02\x12\x0b\n\x07REMOVED\x10\x03\x12\x18\n\x14OPERATOR_KEY_CHANGED\x10\x04\x12\x14\n\x10PROTX_IP_CHANGED\x10\x05\x12\t\n\x05READY\x10\x06\x12\t\n\x05\x45RROR\x10\x07\x1a\x30\n\nNetworkFee\x12\r\n\x05relay\x18\x01 \x01(\x01\x12\x13\n\x0bincremental\x18\x02 \x01(\x01\x1a\x64\n\x07Network\x12\x13\n\x0bpeers_count\x18\x01 \x01(\r\x12\x44\n\x03\x66\x65\x65\x18\x02 \x01(\x0b\x32\x37.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee\"<\n\x06Status\x12\x0f\n\x0bNOT_STARTED\x10\x00\x12\x0b\n\x07SYNCING\x10\x01\x12\t\n\x05READY\x10\x02\x12\t\n\x05\x45RROR\x10\x03\"<\n\x0fGetBlockRequest\x12\x10\n\x06height\x18\x01 \x01(\rH\x00\x12\x0e\n\x04hash\x18\x02 \x01(\tH\x00\x42\x07\n\x05\x62lock\"!\n\x10GetBlockResponse\x12\r\n\x05\x62lock\x18\x01 \x01(\x0c\"b\n\x1b\x42roadcastTransactionRequest\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x17\n\x0f\x61llow_high_fees\x18\x02 \x01(\x08\x12\x15\n\rbypass_limits\x18\x03 \x01(\x08\"6\n\x1c\x42roadcastTransactionResponse\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\"#\n\x15GetTransactionRequest\x12\n\n\x02id\x18\x01 \x01(\t\"\x9c\x01\n\x16GetTransactionResponse\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x12\n\nblock_hash\x18\x02 \x01(\x0c\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x15\n\rconfirmations\x18\x04 \x01(\r\x12\x19\n\x11is_instant_locked\x18\x05 \x01(\x08\x12\x17\n\x0fis_chain_locked\x18\x06 \x01(\x08\"x\n!BlockHeadersWithChainLocksRequest\x12\x19\n\x0f\x66rom_block_hash\x18\x01 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x02 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\rB\x0c\n\nfrom_block\"\x89\x01\n\"BlockHeadersWithChainLocksResponse\x12@\n\rblock_headers\x18\x01 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.BlockHeadersH\x00\x12\x14\n\nchain_lock\x18\x02 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\x1f\n\x0c\x42lockHeaders\x12\x0f\n\x07headers\x18\x01 \x03(\x0c\"3\n!GetEstimatedTransactionFeeRequest\x12\x0e\n\x06\x62locks\x18\x01 \x01(\r\"1\n\"GetEstimatedTransactionFeeResponse\x12\x0b\n\x03\x66\x65\x65\x18\x01 \x01(\x01\"\xd3\x01\n\x1dTransactionsWithProofsRequest\x12<\n\x0c\x62loom_filter\x18\x01 \x01(\x0b\x32&.org.dash.platform.dapi.v0.BloomFilter\x12\x19\n\x0f\x66rom_block_hash\x18\x02 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x03 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x04 \x01(\r\x12\x1f\n\x17send_transaction_hashes\x18\x05 \x01(\x08\x42\x0c\n\nfrom_block\"U\n\x0b\x42loomFilter\x12\x0e\n\x06v_data\x18\x01 \x01(\x0c\x12\x14\n\x0cn_hash_funcs\x18\x02 \x01(\r\x12\x0f\n\x07n_tweak\x18\x03 \x01(\r\x12\x0f\n\x07n_flags\x18\x04 \x01(\r\"\xeb\x01\n\x1eTransactionsWithProofsResponse\x12\x46\n\x10raw_transactions\x18\x01 \x01(\x0b\x32*.org.dash.platform.dapi.v0.RawTransactionsH\x00\x12X\n\x1ainstant_send_lock_messages\x18\x02 \x01(\x0b\x32\x32.org.dash.platform.dapi.v0.InstantSendLockMessagesH\x00\x12\x1a\n\x10raw_merkle_block\x18\x03 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\'\n\x0fRawTransactions\x12\x14\n\x0ctransactions\x18\x01 \x03(\x0c\"+\n\x17InstantSendLockMessages\x12\x10\n\x08messages\x18\x01 \x03(\x0c\x32\xb6\x07\n\x04\x43ore\x12\x66\n\tgetStatus\x12+.org.dash.platform.dapi.v0.GetStatusRequest\x1a,.org.dash.platform.dapi.v0.GetStatusResponse\x12\x63\n\x08getBlock\x12*.org.dash.platform.dapi.v0.GetBlockRequest\x1a+.org.dash.platform.dapi.v0.GetBlockResponse\x12\x87\x01\n\x14\x62roadcastTransaction\x12\x36.org.dash.platform.dapi.v0.BroadcastTransactionRequest\x1a\x37.org.dash.platform.dapi.v0.BroadcastTransactionResponse\x12u\n\x0egetTransaction\x12\x30.org.dash.platform.dapi.v0.GetTransactionRequest\x1a\x31.org.dash.platform.dapi.v0.GetTransactionResponse\x12\x99\x01\n\x1agetEstimatedTransactionFee\x12<.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest\x1a=.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse\x12\xa6\x01\n%subscribeToBlockHeadersWithChainLocks\x12<.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRequest\x1a=.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksResponse0\x01\x12\x9a\x01\n!subscribeToTransactionsWithProofs\x12\x38.org.dash.platform.dapi.v0.TransactionsWithProofsRequest\x1a\x39.org.dash.platform.dapi.v0.TransactionsWithProofsResponse0\x01\x62\x06proto3' + serialized_pb=b'\n\ncore.proto\x12\x19org.dash.platform.dapi.v0\"\x1c\n\x1aGetBlockchainStatusRequest\"\xc0\x07\n\x1bGetBlockchainStatusResponse\x12O\n\x07version\x18\x01 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version\x12I\n\x04time\x18\x02 \x01(\x0b\x32;.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time\x12M\n\x06status\x18\x03 \x01(\x0e\x32=.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status\x12\x15\n\rsync_progress\x18\x04 \x01(\x01\x12K\n\x05\x63hain\x18\x05 \x01(\x0b\x32<.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain\x12O\n\x07network\x18\x07 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network\x1a<\n\x07Version\x12\x10\n\x08protocol\x18\x01 \x01(\r\x12\x10\n\x08software\x18\x02 \x01(\r\x12\r\n\x05\x61gent\x18\x03 \x01(\t\x1a\x33\n\x04Time\x12\x0b\n\x03now\x18\x01 \x01(\r\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x0e\n\x06median\x18\x03 \x01(\r\x1a\xad\x01\n\x05\x43hain\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x15\n\rheaders_count\x18\x02 \x01(\r\x12\x14\n\x0c\x62locks_count\x18\x03 \x01(\r\x12\x17\n\x0f\x62\x65st_block_hash\x18\x04 \x01(\x0c\x12\x12\n\ndifficulty\x18\x05 \x01(\x01\x12\x12\n\nchain_work\x18\x06 \x01(\x0c\x12\x11\n\tis_synced\x18\x07 \x01(\x08\x12\x15\n\rsync_progress\x18\x08 \x01(\x01\x1a\x30\n\nNetworkFee\x12\r\n\x05relay\x18\x01 \x01(\x01\x12\x13\n\x0bincremental\x18\x02 \x01(\x01\x1an\n\x07Network\x12\x13\n\x0bpeers_count\x18\x01 \x01(\r\x12N\n\x03\x66\x65\x65\x18\x02 \x01(\x0b\x32\x41.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee\"<\n\x06Status\x12\x0f\n\x0bNOT_STARTED\x10\x00\x12\x0b\n\x07SYNCING\x10\x01\x12\t\n\x05READY\x10\x02\x12\t\n\x05\x45RROR\x10\x03\"\x1c\n\x1aGetMasternodeStatusRequest\"\xd4\x02\n\x1bGetMasternodeStatusResponse\x12M\n\x06status\x18\x01 \x01(\x0e\x32=.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status\x12\x13\n\x0bpro_tx_hash\x18\x02 \x01(\x0c\x12\x14\n\x0cpose_penalty\x18\x03 \x01(\r\x12\x11\n\tis_synced\x18\x04 \x01(\x08\x12\x15\n\rsync_progress\x18\x05 \x01(\x01\"\x90\x01\n\x06Status\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x15\n\x11WAITING_FOR_PROTX\x10\x01\x12\x0f\n\x0bPOSE_BANNED\x10\x02\x12\x0b\n\x07REMOVED\x10\x03\x12\x18\n\x14OPERATOR_KEY_CHANGED\x10\x04\x12\x14\n\x10PROTX_IP_CHANGED\x10\x05\x12\t\n\x05READY\x10\x06\x12\t\n\x05\x45RROR\x10\x07\"<\n\x0fGetBlockRequest\x12\x10\n\x06height\x18\x01 \x01(\rH\x00\x12\x0e\n\x04hash\x18\x02 \x01(\tH\x00\x42\x07\n\x05\x62lock\"!\n\x10GetBlockResponse\x12\r\n\x05\x62lock\x18\x01 \x01(\x0c\"\x1b\n\x19GetBestBlockHeightRequest\",\n\x1aGetBestBlockHeightResponse\x12\x0e\n\x06height\x18\x01 \x01(\r\"b\n\x1b\x42roadcastTransactionRequest\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x17\n\x0f\x61llow_high_fees\x18\x02 \x01(\x08\x12\x15\n\rbypass_limits\x18\x03 \x01(\x08\"6\n\x1c\x42roadcastTransactionResponse\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\"#\n\x15GetTransactionRequest\x12\n\n\x02id\x18\x01 \x01(\t\"\x9c\x01\n\x16GetTransactionResponse\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x12\n\nblock_hash\x18\x02 \x01(\x0c\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x15\n\rconfirmations\x18\x04 \x01(\r\x12\x19\n\x11is_instant_locked\x18\x05 \x01(\x08\x12\x17\n\x0fis_chain_locked\x18\x06 \x01(\x08\"x\n!BlockHeadersWithChainLocksRequest\x12\x19\n\x0f\x66rom_block_hash\x18\x01 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x02 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\rB\x0c\n\nfrom_block\"\x89\x01\n\"BlockHeadersWithChainLocksResponse\x12@\n\rblock_headers\x18\x01 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.BlockHeadersH\x00\x12\x14\n\nchain_lock\x18\x02 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\x1f\n\x0c\x42lockHeaders\x12\x0f\n\x07headers\x18\x01 \x03(\x0c\"3\n!GetEstimatedTransactionFeeRequest\x12\x0e\n\x06\x62locks\x18\x01 \x01(\r\"1\n\"GetEstimatedTransactionFeeResponse\x12\x0b\n\x03\x66\x65\x65\x18\x01 \x01(\x01\"\xd3\x01\n\x1dTransactionsWithProofsRequest\x12<\n\x0c\x62loom_filter\x18\x01 \x01(\x0b\x32&.org.dash.platform.dapi.v0.BloomFilter\x12\x19\n\x0f\x66rom_block_hash\x18\x02 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x03 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x04 \x01(\r\x12\x1f\n\x17send_transaction_hashes\x18\x05 \x01(\x08\x42\x0c\n\nfrom_block\"U\n\x0b\x42loomFilter\x12\x0e\n\x06v_data\x18\x01 \x01(\x0c\x12\x14\n\x0cn_hash_funcs\x18\x02 \x01(\r\x12\x0f\n\x07n_tweak\x18\x03 \x01(\r\x12\x0f\n\x07n_flags\x18\x04 \x01(\r\"\xeb\x01\n\x1eTransactionsWithProofsResponse\x12\x46\n\x10raw_transactions\x18\x01 \x01(\x0b\x32*.org.dash.platform.dapi.v0.RawTransactionsH\x00\x12X\n\x1ainstant_send_lock_messages\x18\x02 \x01(\x0b\x32\x32.org.dash.platform.dapi.v0.InstantSendLockMessagesH\x00\x12\x1a\n\x10raw_merkle_block\x18\x03 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\'\n\x0fRawTransactions\x12\x14\n\x0ctransactions\x18\x01 \x03(\x0c\"+\n\x17InstantSendLockMessages\x12\x10\n\x08messages\x18\x01 \x03(\x0c\"\x17\n\x15MasternodeListRequest\"6\n\x16MasternodeListResponse\x12\x1c\n\x14masternode_list_diff\x18\x01 \x01(\x0c\x32\xe5\n\n\x04\x43ore\x12\x84\x01\n\x13getBlockchainStatus\x12\x35.org.dash.platform.dapi.v0.GetBlockchainStatusRequest\x1a\x36.org.dash.platform.dapi.v0.GetBlockchainStatusResponse\x12\x84\x01\n\x13getMasternodeStatus\x12\x35.org.dash.platform.dapi.v0.GetMasternodeStatusRequest\x1a\x36.org.dash.platform.dapi.v0.GetMasternodeStatusResponse\x12\x63\n\x08getBlock\x12*.org.dash.platform.dapi.v0.GetBlockRequest\x1a+.org.dash.platform.dapi.v0.GetBlockResponse\x12\x81\x01\n\x12getBestBlockHeight\x12\x34.org.dash.platform.dapi.v0.GetBestBlockHeightRequest\x1a\x35.org.dash.platform.dapi.v0.GetBestBlockHeightResponse\x12\x87\x01\n\x14\x62roadcastTransaction\x12\x36.org.dash.platform.dapi.v0.BroadcastTransactionRequest\x1a\x37.org.dash.platform.dapi.v0.BroadcastTransactionResponse\x12u\n\x0egetTransaction\x12\x30.org.dash.platform.dapi.v0.GetTransactionRequest\x1a\x31.org.dash.platform.dapi.v0.GetTransactionResponse\x12\x99\x01\n\x1agetEstimatedTransactionFee\x12<.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest\x1a=.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse\x12\xa6\x01\n%subscribeToBlockHeadersWithChainLocks\x12<.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRequest\x1a=.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksResponse0\x01\x12\x9a\x01\n!subscribeToTransactionsWithProofs\x12\x38.org.dash.platform.dapi.v0.TransactionsWithProofsRequest\x1a\x39.org.dash.platform.dapi.v0.TransactionsWithProofsResponse0\x01\x12\x82\x01\n\x19subscribeToMasternodeList\x12\x30.org.dash.platform.dapi.v0.MasternodeListRequest\x1a\x31.org.dash.platform.dapi.v0.MasternodeListResponse0\x01\x62\x06proto3' ) -_GETSTATUSRESPONSE_MASTERNODE_STATUS = _descriptor.EnumDescriptor( +_GETBLOCKCHAINSTATUSRESPONSE_STATUS = _descriptor.EnumDescriptor( name='Status', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status', filename=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( - name='UNKNOWN', index=0, number=0, + name='NOT_STARTED', index=0, number=0, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='WAITING_FOR_PROTX', index=1, number=1, + name='SYNCING', index=1, number=1, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='POSE_BANNED', index=2, number=2, + name='READY', index=2, number=2, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='REMOVED', index=3, number=3, + name='ERROR', index=3, number=3, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=972, + serialized_end=1032, +) +_sym_db.RegisterEnumDescriptor(_GETBLOCKCHAINSTATUSRESPONSE_STATUS) + +_GETMASTERNODESTATUSRESPONSE_STATUS = _descriptor.EnumDescriptor( + name='Status', + full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ _descriptor.EnumValueDescriptor( - name='OPERATOR_KEY_CHANGED', index=4, number=4, + name='UNKNOWN', index=0, number=0, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='PROTX_IP_CHANGED', index=5, number=5, + name='WAITING_FOR_PROTX', index=1, number=1, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='READY', index=6, number=6, + name='POSE_BANNED', index=2, number=2, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='ERROR', index=7, number=7, + name='REMOVED', index=3, number=3, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=998, - serialized_end=1142, -) -_sym_db.RegisterEnumDescriptor(_GETSTATUSRESPONSE_MASTERNODE_STATUS) - -_GETSTATUSRESPONSE_STATUS = _descriptor.EnumDescriptor( - name='Status', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Status', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ _descriptor.EnumValueDescriptor( - name='NOT_STARTED', index=0, number=0, + name='OPERATOR_KEY_CHANGED', index=4, number=4, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='SYNCING', index=1, number=1, + name='PROTX_IP_CHANGED', index=5, number=5, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='READY', index=2, number=2, + name='READY', index=6, number=6, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='ERROR', index=3, number=3, + name='ERROR', index=7, number=7, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), ], containing_type=None, serialized_options=None, - serialized_start=1296, - serialized_end=1356, + serialized_start=1261, + serialized_end=1405, ) -_sym_db.RegisterEnumDescriptor(_GETSTATUSRESPONSE_STATUS) +_sym_db.RegisterEnumDescriptor(_GETMASTERNODESTATUSRESPONSE_STATUS) -_GETSTATUSREQUEST = _descriptor.Descriptor( - name='GetStatusRequest', - full_name='org.dash.platform.dapi.v0.GetStatusRequest', +_GETBLOCKCHAINSTATUSREQUEST = _descriptor.Descriptor( + name='GetBlockchainStatusRequest', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusRequest', filename=None, file=DESCRIPTOR, containing_type=None, @@ -136,34 +136,34 @@ oneofs=[ ], serialized_start=41, - serialized_end=59, + serialized_end=69, ) -_GETSTATUSRESPONSE_VERSION = _descriptor.Descriptor( +_GETBLOCKCHAINSTATUSRESPONSE_VERSION = _descriptor.Descriptor( name='Version', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='protocol', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version.protocol', index=0, + name='protocol', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.protocol', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='software', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version.software', index=1, + name='software', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.software', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='agent', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version.agent', index=2, + name='agent', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.agent', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, @@ -181,34 +181,34 @@ extension_ranges=[], oneofs=[ ], - serialized_start=526, - serialized_end=586, + serialized_start=519, + serialized_end=579, ) -_GETSTATUSRESPONSE_TIME = _descriptor.Descriptor( +_GETBLOCKCHAINSTATUSRESPONSE_TIME = _descriptor.Descriptor( name='Time', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='now', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time.now', index=0, + name='now', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.now', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='offset', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time.offset', index=1, + name='offset', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.offset', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='median', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time.median', index=2, + name='median', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.median', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, @@ -226,69 +226,69 @@ extension_ranges=[], oneofs=[ ], - serialized_start=588, - serialized_end=639, + serialized_start=581, + serialized_end=632, ) -_GETSTATUSRESPONSE_CHAIN = _descriptor.Descriptor( +_GETBLOCKCHAINSTATUSRESPONSE_CHAIN = _descriptor.Descriptor( name='Chain', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='name', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.name', index=0, + name='name', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='headers_count', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.headers_count', index=1, + name='headers_count', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.headers_count', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='blocks_count', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.blocks_count', index=2, + name='blocks_count', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.blocks_count', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='best_block_hash', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.best_block_hash', index=3, + name='best_block_hash', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.best_block_hash', index=3, number=4, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='difficulty', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.difficulty', index=4, + name='difficulty', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.difficulty', index=4, number=5, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='chain_work', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.chain_work', index=5, + name='chain_work', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.chain_work', index=5, number=6, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='is_synced', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.is_synced', index=6, + name='is_synced', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.is_synced', index=6, number=7, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='sync_progress', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.sync_progress', index=7, + name='sync_progress', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.sync_progress', index=7, number=8, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, @@ -306,49 +306,28 @@ extension_ranges=[], oneofs=[ ], - serialized_start=642, - serialized_end=815, + serialized_start=635, + serialized_end=808, ) -_GETSTATUSRESPONSE_MASTERNODE = _descriptor.Descriptor( - name='Masternode', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode', +_GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE = _descriptor.Descriptor( + name='NetworkFee', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='status', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.status', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='pro_tx_hash', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.pro_tx_hash', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='pose_penalty', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.pose_penalty', index=2, - number=3, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='is_synced', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.is_synced', index=3, - number=4, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='relay', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.relay', index=0, + number=1, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='sync_progress', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.sync_progress', index=4, - number=5, type=1, cpp_type=5, label=1, + name='incremental', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.incremental', index=1, + number=2, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -358,7 +337,6 @@ ], nested_types=[], enum_types=[ - _GETSTATUSRESPONSE_MASTERNODE_STATUS, ], serialized_options=None, is_extendable=False, @@ -366,29 +344,29 @@ extension_ranges=[], oneofs=[ ], - serialized_start=818, - serialized_end=1142, + serialized_start=810, + serialized_end=858, ) -_GETSTATUSRESPONSE_NETWORKFEE = _descriptor.Descriptor( - name='NetworkFee', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee', +_GETBLOCKCHAINSTATUSRESPONSE_NETWORK = _descriptor.Descriptor( + name='Network', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='relay', full_name='org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.relay', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), + name='peers_count', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.peers_count', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='incremental', full_name='org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.incremental', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), + name='fee', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.fee', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -404,32 +382,86 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1144, - serialized_end=1192, + serialized_start=860, + serialized_end=970, ) -_GETSTATUSRESPONSE_NETWORK = _descriptor.Descriptor( - name='Network', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Network', +_GETBLOCKCHAINSTATUSRESPONSE = _descriptor.Descriptor( + name='GetBlockchainStatusResponse', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='peers_count', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Network.peers_count', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, + name='version', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.version', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='fee', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Network.fee', index=1, + name='time', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.time', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='status', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.status', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sync_progress', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.sync_progress', index=3, + number=4, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='chain', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.chain', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='network', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.network', index=5, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETBLOCKCHAINSTATUSRESPONSE_VERSION, _GETBLOCKCHAINSTATUSRESPONSE_TIME, _GETBLOCKCHAINSTATUSRESPONSE_CHAIN, _GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE, _GETBLOCKCHAINSTATUSRESPONSE_NETWORK, ], + enum_types=[ + _GETBLOCKCHAINSTATUSRESPONSE_STATUS, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=72, + serialized_end=1032, +) + + +_GETMASTERNODESTATUSREQUEST = _descriptor.Descriptor( + name='GetMasternodeStatusRequest', + full_name='org.dash.platform.dapi.v0.GetMasternodeStatusRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ ], extensions=[ ], @@ -442,73 +474,60 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1194, - serialized_end=1294, + serialized_start=1034, + serialized_end=1062, ) -_GETSTATUSRESPONSE = _descriptor.Descriptor( - name='GetStatusResponse', - full_name='org.dash.platform.dapi.v0.GetStatusResponse', + +_GETMASTERNODESTATUSRESPONSE = _descriptor.Descriptor( + name='GetMasternodeStatusResponse', + full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetStatusResponse.version', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time', full_name='org.dash.platform.dapi.v0.GetStatusResponse.time', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='status', full_name='org.dash.platform.dapi.v0.GetStatusResponse.status', index=2, - number=3, type=14, cpp_type=8, label=1, + name='status', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.status', index=0, + number=1, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='sync_progress', full_name='org.dash.platform.dapi.v0.GetStatusResponse.sync_progress', index=3, - number=4, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), + name='pro_tx_hash', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.pro_tx_hash', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='chain', full_name='org.dash.platform.dapi.v0.GetStatusResponse.chain', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='pose_penalty', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.pose_penalty', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='masternode', full_name='org.dash.platform.dapi.v0.GetStatusResponse.masternode', index=5, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='is_synced', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.is_synced', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='network', full_name='org.dash.platform.dapi.v0.GetStatusResponse.network', index=6, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='sync_progress', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.sync_progress', index=4, + number=5, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETSTATUSRESPONSE_VERSION, _GETSTATUSRESPONSE_TIME, _GETSTATUSRESPONSE_CHAIN, _GETSTATUSRESPONSE_MASTERNODE, _GETSTATUSRESPONSE_NETWORKFEE, _GETSTATUSRESPONSE_NETWORK, ], + nested_types=[], enum_types=[ - _GETSTATUSRESPONSE_STATUS, + _GETMASTERNODESTATUSRESPONSE_STATUS, ], serialized_options=None, is_extendable=False, @@ -516,8 +535,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=62, - serialized_end=1356, + serialized_start=1065, + serialized_end=1405, ) @@ -560,8 +579,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1358, - serialized_end=1418, + serialized_start=1407, + serialized_end=1467, ) @@ -592,8 +611,65 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1420, - serialized_end=1453, + serialized_start=1469, + serialized_end=1502, +) + + +_GETBESTBLOCKHEIGHTREQUEST = _descriptor.Descriptor( + name='GetBestBlockHeightRequest', + full_name='org.dash.platform.dapi.v0.GetBestBlockHeightRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1504, + serialized_end=1531, +) + + +_GETBESTBLOCKHEIGHTRESPONSE = _descriptor.Descriptor( + name='GetBestBlockHeightResponse', + full_name='org.dash.platform.dapi.v0.GetBestBlockHeightResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='height', full_name='org.dash.platform.dapi.v0.GetBestBlockHeightResponse.height', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1533, + serialized_end=1577, ) @@ -638,8 +714,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1455, - serialized_end=1553, + serialized_start=1579, + serialized_end=1677, ) @@ -670,8 +746,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1555, - serialized_end=1609, + serialized_start=1679, + serialized_end=1733, ) @@ -702,8 +778,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1611, - serialized_end=1646, + serialized_start=1735, + serialized_end=1770, ) @@ -769,8 +845,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1649, - serialized_end=1805, + serialized_start=1773, + serialized_end=1929, ) @@ -820,8 +896,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1807, - serialized_end=1927, + serialized_start=1931, + serialized_end=2051, ) @@ -864,8 +940,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1930, - serialized_end=2067, + serialized_start=2054, + serialized_end=2191, ) @@ -896,8 +972,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2069, - serialized_end=2100, + serialized_start=2193, + serialized_end=2224, ) @@ -928,8 +1004,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2102, - serialized_end=2153, + serialized_start=2226, + serialized_end=2277, ) @@ -960,8 +1036,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2155, - serialized_end=2204, + serialized_start=2279, + serialized_end=2328, ) @@ -1025,8 +1101,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2207, - serialized_end=2418, + serialized_start=2331, + serialized_end=2542, ) @@ -1078,8 +1154,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2420, - serialized_end=2505, + serialized_start=2544, + serialized_end=2629, ) @@ -1129,8 +1205,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2508, - serialized_end=2743, + serialized_start=2632, + serialized_end=2867, ) @@ -1161,8 +1237,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2745, - serialized_end=2784, + serialized_start=2869, + serialized_end=2908, ) @@ -1193,26 +1269,81 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2786, - serialized_end=2829, + serialized_start=2910, + serialized_end=2953, +) + + +_MASTERNODELISTREQUEST = _descriptor.Descriptor( + name='MasternodeListRequest', + full_name='org.dash.platform.dapi.v0.MasternodeListRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2955, + serialized_end=2978, ) -_GETSTATUSRESPONSE_VERSION.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_TIME.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_CHAIN.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_MASTERNODE.fields_by_name['status'].enum_type = _GETSTATUSRESPONSE_MASTERNODE_STATUS -_GETSTATUSRESPONSE_MASTERNODE.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_MASTERNODE_STATUS.containing_type = _GETSTATUSRESPONSE_MASTERNODE -_GETSTATUSRESPONSE_NETWORKFEE.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_NETWORK.fields_by_name['fee'].message_type = _GETSTATUSRESPONSE_NETWORKFEE -_GETSTATUSRESPONSE_NETWORK.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE.fields_by_name['version'].message_type = _GETSTATUSRESPONSE_VERSION -_GETSTATUSRESPONSE.fields_by_name['time'].message_type = _GETSTATUSRESPONSE_TIME -_GETSTATUSRESPONSE.fields_by_name['status'].enum_type = _GETSTATUSRESPONSE_STATUS -_GETSTATUSRESPONSE.fields_by_name['chain'].message_type = _GETSTATUSRESPONSE_CHAIN -_GETSTATUSRESPONSE.fields_by_name['masternode'].message_type = _GETSTATUSRESPONSE_MASTERNODE -_GETSTATUSRESPONSE.fields_by_name['network'].message_type = _GETSTATUSRESPONSE_NETWORK -_GETSTATUSRESPONSE_STATUS.containing_type = _GETSTATUSRESPONSE + +_MASTERNODELISTRESPONSE = _descriptor.Descriptor( + name='MasternodeListResponse', + full_name='org.dash.platform.dapi.v0.MasternodeListResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='masternode_list_diff', full_name='org.dash.platform.dapi.v0.MasternodeListResponse.masternode_list_diff', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2980, + serialized_end=3034, +) + +_GETBLOCKCHAINSTATUSRESPONSE_VERSION.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_TIME.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_CHAIN.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_NETWORK.fields_by_name['fee'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE +_GETBLOCKCHAINSTATUSRESPONSE_NETWORK.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['version'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_VERSION +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['time'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_TIME +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['status'].enum_type = _GETBLOCKCHAINSTATUSRESPONSE_STATUS +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['chain'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_CHAIN +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['network'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_NETWORK +_GETBLOCKCHAINSTATUSRESPONSE_STATUS.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETMASTERNODESTATUSRESPONSE.fields_by_name['status'].enum_type = _GETMASTERNODESTATUSRESPONSE_STATUS +_GETMASTERNODESTATUSRESPONSE_STATUS.containing_type = _GETMASTERNODESTATUSRESPONSE _GETBLOCKREQUEST.oneofs_by_name['block'].fields.append( _GETBLOCKREQUEST.fields_by_name['height']) _GETBLOCKREQUEST.fields_by_name['height'].containing_oneof = _GETBLOCKREQUEST.oneofs_by_name['block'] @@ -1250,10 +1381,14 @@ _TRANSACTIONSWITHPROOFSRESPONSE.oneofs_by_name['responses'].fields.append( _TRANSACTIONSWITHPROOFSRESPONSE.fields_by_name['raw_merkle_block']) _TRANSACTIONSWITHPROOFSRESPONSE.fields_by_name['raw_merkle_block'].containing_oneof = _TRANSACTIONSWITHPROOFSRESPONSE.oneofs_by_name['responses'] -DESCRIPTOR.message_types_by_name['GetStatusRequest'] = _GETSTATUSREQUEST -DESCRIPTOR.message_types_by_name['GetStatusResponse'] = _GETSTATUSRESPONSE +DESCRIPTOR.message_types_by_name['GetBlockchainStatusRequest'] = _GETBLOCKCHAINSTATUSREQUEST +DESCRIPTOR.message_types_by_name['GetBlockchainStatusResponse'] = _GETBLOCKCHAINSTATUSRESPONSE +DESCRIPTOR.message_types_by_name['GetMasternodeStatusRequest'] = _GETMASTERNODESTATUSREQUEST +DESCRIPTOR.message_types_by_name['GetMasternodeStatusResponse'] = _GETMASTERNODESTATUSRESPONSE DESCRIPTOR.message_types_by_name['GetBlockRequest'] = _GETBLOCKREQUEST DESCRIPTOR.message_types_by_name['GetBlockResponse'] = _GETBLOCKRESPONSE +DESCRIPTOR.message_types_by_name['GetBestBlockHeightRequest'] = _GETBESTBLOCKHEIGHTREQUEST +DESCRIPTOR.message_types_by_name['GetBestBlockHeightResponse'] = _GETBESTBLOCKHEIGHTRESPONSE DESCRIPTOR.message_types_by_name['BroadcastTransactionRequest'] = _BROADCASTTRANSACTIONREQUEST DESCRIPTOR.message_types_by_name['BroadcastTransactionResponse'] = _BROADCASTTRANSACTIONRESPONSE DESCRIPTOR.message_types_by_name['GetTransactionRequest'] = _GETTRANSACTIONREQUEST @@ -1268,69 +1403,77 @@ DESCRIPTOR.message_types_by_name['TransactionsWithProofsResponse'] = _TRANSACTIONSWITHPROOFSRESPONSE DESCRIPTOR.message_types_by_name['RawTransactions'] = _RAWTRANSACTIONS DESCRIPTOR.message_types_by_name['InstantSendLockMessages'] = _INSTANTSENDLOCKMESSAGES +DESCRIPTOR.message_types_by_name['MasternodeListRequest'] = _MASTERNODELISTREQUEST +DESCRIPTOR.message_types_by_name['MasternodeListResponse'] = _MASTERNODELISTRESPONSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) -GetStatusRequest = _reflection.GeneratedProtocolMessageType('GetStatusRequest', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSREQUEST, +GetBlockchainStatusRequest = _reflection.GeneratedProtocolMessageType('GetBlockchainStatusRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSREQUEST, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusRequest) }) -_sym_db.RegisterMessage(GetStatusRequest) +_sym_db.RegisterMessage(GetBlockchainStatusRequest) -GetStatusResponse = _reflection.GeneratedProtocolMessageType('GetStatusResponse', (_message.Message,), { +GetBlockchainStatusResponse = _reflection.GeneratedProtocolMessageType('GetBlockchainStatusResponse', (_message.Message,), { 'Version' : _reflection.GeneratedProtocolMessageType('Version', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_VERSION, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_VERSION, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Version) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version) }) , 'Time' : _reflection.GeneratedProtocolMessageType('Time', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_TIME, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_TIME, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Time) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time) }) , 'Chain' : _reflection.GeneratedProtocolMessageType('Chain', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_CHAIN, - '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Chain) - }) - , - - 'Masternode' : _reflection.GeneratedProtocolMessageType('Masternode', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_MASTERNODE, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_CHAIN, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Masternode) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain) }) , 'NetworkFee' : _reflection.GeneratedProtocolMessageType('NetworkFee', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_NETWORKFEE, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee) }) , 'Network' : _reflection.GeneratedProtocolMessageType('Network', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_NETWORK, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_NETWORK, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Network) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network) }) , - 'DESCRIPTOR' : _GETSTATUSRESPONSE, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse) }) -_sym_db.RegisterMessage(GetStatusResponse) -_sym_db.RegisterMessage(GetStatusResponse.Version) -_sym_db.RegisterMessage(GetStatusResponse.Time) -_sym_db.RegisterMessage(GetStatusResponse.Chain) -_sym_db.RegisterMessage(GetStatusResponse.Masternode) -_sym_db.RegisterMessage(GetStatusResponse.NetworkFee) -_sym_db.RegisterMessage(GetStatusResponse.Network) +_sym_db.RegisterMessage(GetBlockchainStatusResponse) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Version) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Time) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Chain) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.NetworkFee) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Network) + +GetMasternodeStatusRequest = _reflection.GeneratedProtocolMessageType('GetMasternodeStatusRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETMASTERNODESTATUSREQUEST, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetMasternodeStatusRequest) + }) +_sym_db.RegisterMessage(GetMasternodeStatusRequest) + +GetMasternodeStatusResponse = _reflection.GeneratedProtocolMessageType('GetMasternodeStatusResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETMASTERNODESTATUSRESPONSE, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetMasternodeStatusResponse) + }) +_sym_db.RegisterMessage(GetMasternodeStatusResponse) GetBlockRequest = _reflection.GeneratedProtocolMessageType('GetBlockRequest', (_message.Message,), { 'DESCRIPTOR' : _GETBLOCKREQUEST, @@ -1346,6 +1489,20 @@ }) _sym_db.RegisterMessage(GetBlockResponse) +GetBestBlockHeightRequest = _reflection.GeneratedProtocolMessageType('GetBestBlockHeightRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETBESTBLOCKHEIGHTREQUEST, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBestBlockHeightRequest) + }) +_sym_db.RegisterMessage(GetBestBlockHeightRequest) + +GetBestBlockHeightResponse = _reflection.GeneratedProtocolMessageType('GetBestBlockHeightResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETBESTBLOCKHEIGHTRESPONSE, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBestBlockHeightResponse) + }) +_sym_db.RegisterMessage(GetBestBlockHeightResponse) + BroadcastTransactionRequest = _reflection.GeneratedProtocolMessageType('BroadcastTransactionRequest', (_message.Message,), { 'DESCRIPTOR' : _BROADCASTTRANSACTIONREQUEST, '__module__' : 'core_pb2' @@ -1444,6 +1601,20 @@ }) _sym_db.RegisterMessage(InstantSendLockMessages) +MasternodeListRequest = _reflection.GeneratedProtocolMessageType('MasternodeListRequest', (_message.Message,), { + 'DESCRIPTOR' : _MASTERNODELISTREQUEST, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.MasternodeListRequest) + }) +_sym_db.RegisterMessage(MasternodeListRequest) + +MasternodeListResponse = _reflection.GeneratedProtocolMessageType('MasternodeListResponse', (_message.Message,), { + 'DESCRIPTOR' : _MASTERNODELISTRESPONSE, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.MasternodeListResponse) + }) +_sym_db.RegisterMessage(MasternodeListResponse) + _CORE = _descriptor.ServiceDescriptor( @@ -1453,33 +1624,53 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=2832, - serialized_end=3782, + serialized_start=3037, + serialized_end=4418, methods=[ _descriptor.MethodDescriptor( - name='getStatus', - full_name='org.dash.platform.dapi.v0.Core.getStatus', + name='getBlockchainStatus', + full_name='org.dash.platform.dapi.v0.Core.getBlockchainStatus', index=0, containing_service=None, - input_type=_GETSTATUSREQUEST, - output_type=_GETSTATUSRESPONSE, + input_type=_GETBLOCKCHAINSTATUSREQUEST, + output_type=_GETBLOCKCHAINSTATUSRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getMasternodeStatus', + full_name='org.dash.platform.dapi.v0.Core.getMasternodeStatus', + index=1, + containing_service=None, + input_type=_GETMASTERNODESTATUSREQUEST, + output_type=_GETMASTERNODESTATUSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='getBlock', full_name='org.dash.platform.dapi.v0.Core.getBlock', - index=1, + index=2, containing_service=None, input_type=_GETBLOCKREQUEST, output_type=_GETBLOCKRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='getBestBlockHeight', + full_name='org.dash.platform.dapi.v0.Core.getBestBlockHeight', + index=3, + containing_service=None, + input_type=_GETBESTBLOCKHEIGHTREQUEST, + output_type=_GETBESTBLOCKHEIGHTRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), _descriptor.MethodDescriptor( name='broadcastTransaction', full_name='org.dash.platform.dapi.v0.Core.broadcastTransaction', - index=2, + index=4, containing_service=None, input_type=_BROADCASTTRANSACTIONREQUEST, output_type=_BROADCASTTRANSACTIONRESPONSE, @@ -1489,7 +1680,7 @@ _descriptor.MethodDescriptor( name='getTransaction', full_name='org.dash.platform.dapi.v0.Core.getTransaction', - index=3, + index=5, containing_service=None, input_type=_GETTRANSACTIONREQUEST, output_type=_GETTRANSACTIONRESPONSE, @@ -1499,7 +1690,7 @@ _descriptor.MethodDescriptor( name='getEstimatedTransactionFee', full_name='org.dash.platform.dapi.v0.Core.getEstimatedTransactionFee', - index=4, + index=6, containing_service=None, input_type=_GETESTIMATEDTRANSACTIONFEEREQUEST, output_type=_GETESTIMATEDTRANSACTIONFEERESPONSE, @@ -1509,7 +1700,7 @@ _descriptor.MethodDescriptor( name='subscribeToBlockHeadersWithChainLocks', full_name='org.dash.platform.dapi.v0.Core.subscribeToBlockHeadersWithChainLocks', - index=5, + index=7, containing_service=None, input_type=_BLOCKHEADERSWITHCHAINLOCKSREQUEST, output_type=_BLOCKHEADERSWITHCHAINLOCKSRESPONSE, @@ -1519,13 +1710,23 @@ _descriptor.MethodDescriptor( name='subscribeToTransactionsWithProofs', full_name='org.dash.platform.dapi.v0.Core.subscribeToTransactionsWithProofs', - index=6, + index=8, containing_service=None, input_type=_TRANSACTIONSWITHPROOFSREQUEST, output_type=_TRANSACTIONSWITHPROOFSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='subscribeToMasternodeList', + full_name='org.dash.platform.dapi.v0.Core.subscribeToMasternodeList', + index=9, + containing_service=None, + input_type=_MASTERNODELISTREQUEST, + output_type=_MASTERNODELISTRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), ]) _sym_db.RegisterServiceDescriptor(_CORE) diff --git a/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py b/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py index e8a4eec3513..1ec1d99748b 100644 --- a/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py +++ b/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py @@ -14,16 +14,26 @@ def __init__(self, channel): Args: channel: A grpc.Channel. """ - self.getStatus = channel.unary_unary( - '/org.dash.platform.dapi.v0.Core/getStatus', - request_serializer=core__pb2.GetStatusRequest.SerializeToString, - response_deserializer=core__pb2.GetStatusResponse.FromString, + self.getBlockchainStatus = channel.unary_unary( + '/org.dash.platform.dapi.v0.Core/getBlockchainStatus', + request_serializer=core__pb2.GetBlockchainStatusRequest.SerializeToString, + response_deserializer=core__pb2.GetBlockchainStatusResponse.FromString, + ) + self.getMasternodeStatus = channel.unary_unary( + '/org.dash.platform.dapi.v0.Core/getMasternodeStatus', + request_serializer=core__pb2.GetMasternodeStatusRequest.SerializeToString, + response_deserializer=core__pb2.GetMasternodeStatusResponse.FromString, ) self.getBlock = channel.unary_unary( '/org.dash.platform.dapi.v0.Core/getBlock', request_serializer=core__pb2.GetBlockRequest.SerializeToString, response_deserializer=core__pb2.GetBlockResponse.FromString, ) + self.getBestBlockHeight = channel.unary_unary( + '/org.dash.platform.dapi.v0.Core/getBestBlockHeight', + request_serializer=core__pb2.GetBestBlockHeightRequest.SerializeToString, + response_deserializer=core__pb2.GetBestBlockHeightResponse.FromString, + ) self.broadcastTransaction = channel.unary_unary( '/org.dash.platform.dapi.v0.Core/broadcastTransaction', request_serializer=core__pb2.BroadcastTransactionRequest.SerializeToString, @@ -49,12 +59,23 @@ def __init__(self, channel): request_serializer=core__pb2.TransactionsWithProofsRequest.SerializeToString, response_deserializer=core__pb2.TransactionsWithProofsResponse.FromString, ) + self.subscribeToMasternodeList = channel.unary_stream( + '/org.dash.platform.dapi.v0.Core/subscribeToMasternodeList', + request_serializer=core__pb2.MasternodeListRequest.SerializeToString, + response_deserializer=core__pb2.MasternodeListResponse.FromString, + ) class CoreServicer(object): """Missing associated documentation comment in .proto file.""" - def getStatus(self, request, context): + def getBlockchainStatus(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getMasternodeStatus(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') @@ -66,6 +87,12 @@ def getBlock(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def getBestBlockHeight(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def broadcastTransaction(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -96,19 +123,35 @@ def subscribeToTransactionsWithProofs(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def subscribeToMasternodeList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def add_CoreServicer_to_server(servicer, server): rpc_method_handlers = { - 'getStatus': grpc.unary_unary_rpc_method_handler( - servicer.getStatus, - request_deserializer=core__pb2.GetStatusRequest.FromString, - response_serializer=core__pb2.GetStatusResponse.SerializeToString, + 'getBlockchainStatus': grpc.unary_unary_rpc_method_handler( + servicer.getBlockchainStatus, + request_deserializer=core__pb2.GetBlockchainStatusRequest.FromString, + response_serializer=core__pb2.GetBlockchainStatusResponse.SerializeToString, + ), + 'getMasternodeStatus': grpc.unary_unary_rpc_method_handler( + servicer.getMasternodeStatus, + request_deserializer=core__pb2.GetMasternodeStatusRequest.FromString, + response_serializer=core__pb2.GetMasternodeStatusResponse.SerializeToString, ), 'getBlock': grpc.unary_unary_rpc_method_handler( servicer.getBlock, request_deserializer=core__pb2.GetBlockRequest.FromString, response_serializer=core__pb2.GetBlockResponse.SerializeToString, ), + 'getBestBlockHeight': grpc.unary_unary_rpc_method_handler( + servicer.getBestBlockHeight, + request_deserializer=core__pb2.GetBestBlockHeightRequest.FromString, + response_serializer=core__pb2.GetBestBlockHeightResponse.SerializeToString, + ), 'broadcastTransaction': grpc.unary_unary_rpc_method_handler( servicer.broadcastTransaction, request_deserializer=core__pb2.BroadcastTransactionRequest.FromString, @@ -134,6 +177,11 @@ def add_CoreServicer_to_server(servicer, server): request_deserializer=core__pb2.TransactionsWithProofsRequest.FromString, response_serializer=core__pb2.TransactionsWithProofsResponse.SerializeToString, ), + 'subscribeToMasternodeList': grpc.unary_stream_rpc_method_handler( + servicer.subscribeToMasternodeList, + request_deserializer=core__pb2.MasternodeListRequest.FromString, + response_serializer=core__pb2.MasternodeListResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( 'org.dash.platform.dapi.v0.Core', rpc_method_handlers) @@ -145,7 +193,24 @@ class Core(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def getStatus(request, + def getBlockchainStatus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getBlockchainStatus', + core__pb2.GetBlockchainStatusRequest.SerializeToString, + core__pb2.GetBlockchainStatusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getMasternodeStatus(request, target, options=(), channel_credentials=None, @@ -155,9 +220,9 @@ def getStatus(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getStatus', - core__pb2.GetStatusRequest.SerializeToString, - core__pb2.GetStatusResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getMasternodeStatus', + core__pb2.GetMasternodeStatusRequest.SerializeToString, + core__pb2.GetMasternodeStatusResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -178,6 +243,23 @@ def getBlock(request, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod + def getBestBlockHeight(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getBestBlockHeight', + core__pb2.GetBestBlockHeightRequest.SerializeToString, + core__pb2.GetBestBlockHeightResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod def broadcastTransaction(request, target, @@ -262,3 +344,20 @@ def subscribeToTransactionsWithProofs(request, core__pb2.TransactionsWithProofsResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def subscribeToMasternodeList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/org.dash.platform.dapi.v0.Core/subscribeToMasternodeList', + core__pb2.MasternodeListRequest.SerializeToString, + core__pb2.MasternodeListResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/packages/dapi-grpc/clients/core/v0/rust/core_example.rs b/packages/dapi-grpc/clients/core/v0/rust/core_example.rs index 8acc5f5030c..e33cf000143 100644 --- a/packages/dapi-grpc/clients/core/v0/rust/core_example.rs +++ b/packages/dapi-grpc/clients/core/v0/rust/core_example.rs @@ -1,5 +1,5 @@ use dapi_grpc::core::v0 as core; -use prost::Message; +use dapi_grpc::Message; fn main() { let request = core::GetBlockRequest { diff --git a/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js b/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js index eecb1ced181..3f1549d8058 100644 --- a/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js +++ b/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js @@ -52,15 +52,29 @@ class CorePromiseClient { } /** - * @param {!GetStatusRequest} getStatusRequest + * @param {!GetBlockchainStatusRequest} getBlockchainStatusRequest * @param {?Object} metadata - * @return {Promise} + * @return {Promise} */ - getStatus(getStatusRequest, metadata = {}) { + getBlockchainStatus(getBlockchainStatusRequest, metadata = {}) { return promisify( - this.client.getStatus.bind(this.client), + this.client.getBlockchainStatus.bind(this.client), )( - getStatusRequest, + getBlockchainStatusRequest, + metadata, + ); + } + + /** + * @param {!GetMasternodeStatusRequest} getMasternodeStatusRequest + * @param {?Object} metadata + * @return {Promise} + */ + getMasternodeStatus(getMasternodeStatusRequest, metadata = {}) { + return promisify( + this.client.getMasternodeStatus.bind(this.client), + )( + getMasternodeStatusRequest, metadata, ); } @@ -79,6 +93,20 @@ class CorePromiseClient { ); } + /** + * @param {!GetBestBlockHeightRequest} getBestBlockHeightRequest + * @param {?Object} metadata + * @return {Promise} + */ + getBestBlockHeight(getBestBlockHeightRequest, metadata = {}) { + return promisify( + this.client.getBestBlockHeight.bind(this.client), + )( + getBestBlockHeightRequest, + metadata, + ); + } + /** * @param {!BroadcastTransactionRequest} broadcastTransactionRequest * @param {?Object} metadata @@ -154,6 +182,22 @@ class CorePromiseClient { rewireStream(stream); return stream; } + + /** + * @param {MasternodeListRequest} masternodeListRequest The request proto + * @param {?Object} metadata User defined call metadata + * @return {!grpc.web.ClientReadableStream|undefined} + */ + subscribeToMasternodeList(masternodeListRequest, metadata = {}) { + const stream = this.client.subscribeToMasternodeList( + masternodeListRequest, + metadata + ) + + rewireStream(stream); + + return stream; + } } module.exports = CorePromiseClient; diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts b/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts index b96051c0b3a..4c5b85cc11b 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts @@ -3,73 +3,67 @@ import * as jspb from "google-protobuf"; -export class GetStatusRequest extends jspb.Message { +export class GetBlockchainStatusRequest extends jspb.Message { serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetStatusRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetStatusRequest): GetStatusRequest.AsObject; + toObject(includeInstance?: boolean): GetBlockchainStatusRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetBlockchainStatusRequest): GetBlockchainStatusRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetStatusRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetStatusRequest; - static deserializeBinaryFromReader(message: GetStatusRequest, reader: jspb.BinaryReader): GetStatusRequest; + static serializeBinaryToWriter(message: GetBlockchainStatusRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBlockchainStatusRequest; + static deserializeBinaryFromReader(message: GetBlockchainStatusRequest, reader: jspb.BinaryReader): GetBlockchainStatusRequest; } -export namespace GetStatusRequest { +export namespace GetBlockchainStatusRequest { export type AsObject = { } } -export class GetStatusResponse extends jspb.Message { +export class GetBlockchainStatusResponse extends jspb.Message { hasVersion(): boolean; clearVersion(): void; - getVersion(): GetStatusResponse.Version | undefined; - setVersion(value?: GetStatusResponse.Version): void; + getVersion(): GetBlockchainStatusResponse.Version | undefined; + setVersion(value?: GetBlockchainStatusResponse.Version): void; hasTime(): boolean; clearTime(): void; - getTime(): GetStatusResponse.Time | undefined; - setTime(value?: GetStatusResponse.Time): void; + getTime(): GetBlockchainStatusResponse.Time | undefined; + setTime(value?: GetBlockchainStatusResponse.Time): void; - getStatus(): GetStatusResponse.StatusMap[keyof GetStatusResponse.StatusMap]; - setStatus(value: GetStatusResponse.StatusMap[keyof GetStatusResponse.StatusMap]): void; + getStatus(): GetBlockchainStatusResponse.StatusMap[keyof GetBlockchainStatusResponse.StatusMap]; + setStatus(value: GetBlockchainStatusResponse.StatusMap[keyof GetBlockchainStatusResponse.StatusMap]): void; getSyncProgress(): number; setSyncProgress(value: number): void; hasChain(): boolean; clearChain(): void; - getChain(): GetStatusResponse.Chain | undefined; - setChain(value?: GetStatusResponse.Chain): void; - - hasMasternode(): boolean; - clearMasternode(): void; - getMasternode(): GetStatusResponse.Masternode | undefined; - setMasternode(value?: GetStatusResponse.Masternode): void; + getChain(): GetBlockchainStatusResponse.Chain | undefined; + setChain(value?: GetBlockchainStatusResponse.Chain): void; hasNetwork(): boolean; clearNetwork(): void; - getNetwork(): GetStatusResponse.Network | undefined; - setNetwork(value?: GetStatusResponse.Network): void; + getNetwork(): GetBlockchainStatusResponse.Network | undefined; + setNetwork(value?: GetBlockchainStatusResponse.Network): void; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetStatusResponse.AsObject; - static toObject(includeInstance: boolean, msg: GetStatusResponse): GetStatusResponse.AsObject; + toObject(includeInstance?: boolean): GetBlockchainStatusResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetBlockchainStatusResponse): GetBlockchainStatusResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetStatusResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetStatusResponse; - static deserializeBinaryFromReader(message: GetStatusResponse, reader: jspb.BinaryReader): GetStatusResponse; + static serializeBinaryToWriter(message: GetBlockchainStatusResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBlockchainStatusResponse; + static deserializeBinaryFromReader(message: GetBlockchainStatusResponse, reader: jspb.BinaryReader): GetBlockchainStatusResponse; } -export namespace GetStatusResponse { +export namespace GetBlockchainStatusResponse { export type AsObject = { - version?: GetStatusResponse.Version.AsObject, - time?: GetStatusResponse.Time.AsObject, - status: GetStatusResponse.StatusMap[keyof GetStatusResponse.StatusMap], + version?: GetBlockchainStatusResponse.Version.AsObject, + time?: GetBlockchainStatusResponse.Time.AsObject, + status: GetBlockchainStatusResponse.StatusMap[keyof GetBlockchainStatusResponse.StatusMap], syncProgress: number, - chain?: GetStatusResponse.Chain.AsObject, - masternode?: GetStatusResponse.Masternode.AsObject, - network?: GetStatusResponse.Network.AsObject, + chain?: GetBlockchainStatusResponse.Chain.AsObject, + network?: GetBlockchainStatusResponse.Network.AsObject, } export class Version extends jspb.Message { @@ -180,57 +174,6 @@ export namespace GetStatusResponse { } } - export class Masternode extends jspb.Message { - getStatus(): GetStatusResponse.Masternode.StatusMap[keyof GetStatusResponse.Masternode.StatusMap]; - setStatus(value: GetStatusResponse.Masternode.StatusMap[keyof GetStatusResponse.Masternode.StatusMap]): void; - - getProTxHash(): Uint8Array | string; - getProTxHash_asU8(): Uint8Array; - getProTxHash_asB64(): string; - setProTxHash(value: Uint8Array | string): void; - - getPosePenalty(): number; - setPosePenalty(value: number): void; - - getIsSynced(): boolean; - setIsSynced(value: boolean): void; - - getSyncProgress(): number; - setSyncProgress(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Masternode.AsObject; - static toObject(includeInstance: boolean, msg: Masternode): Masternode.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Masternode, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Masternode; - static deserializeBinaryFromReader(message: Masternode, reader: jspb.BinaryReader): Masternode; - } - - export namespace Masternode { - export type AsObject = { - status: GetStatusResponse.Masternode.StatusMap[keyof GetStatusResponse.Masternode.StatusMap], - proTxHash: Uint8Array | string, - posePenalty: number, - isSynced: boolean, - syncProgress: number, - } - - export interface StatusMap { - UNKNOWN: 0; - WAITING_FOR_PROTX: 1; - POSE_BANNED: 2; - REMOVED: 3; - OPERATOR_KEY_CHANGED: 4; - PROTX_IP_CHANGED: 5; - READY: 6; - ERROR: 7; - } - - export const Status: StatusMap; - } - export class NetworkFee extends jspb.Message { getRelay(): number; setRelay(value: number): void; @@ -261,8 +204,8 @@ export namespace GetStatusResponse { hasFee(): boolean; clearFee(): void; - getFee(): GetStatusResponse.NetworkFee | undefined; - setFee(value?: GetStatusResponse.NetworkFee): void; + getFee(): GetBlockchainStatusResponse.NetworkFee | undefined; + setFee(value?: GetBlockchainStatusResponse.NetworkFee): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Network.AsObject; @@ -277,7 +220,7 @@ export namespace GetStatusResponse { export namespace Network { export type AsObject = { peersCount: number, - fee?: GetStatusResponse.NetworkFee.AsObject, + fee?: GetBlockchainStatusResponse.NetworkFee.AsObject, } } @@ -291,6 +234,73 @@ export namespace GetStatusResponse { export const Status: StatusMap; } +export class GetMasternodeStatusRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetMasternodeStatusRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetMasternodeStatusRequest): GetMasternodeStatusRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetMasternodeStatusRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetMasternodeStatusRequest; + static deserializeBinaryFromReader(message: GetMasternodeStatusRequest, reader: jspb.BinaryReader): GetMasternodeStatusRequest; +} + +export namespace GetMasternodeStatusRequest { + export type AsObject = { + } +} + +export class GetMasternodeStatusResponse extends jspb.Message { + getStatus(): GetMasternodeStatusResponse.StatusMap[keyof GetMasternodeStatusResponse.StatusMap]; + setStatus(value: GetMasternodeStatusResponse.StatusMap[keyof GetMasternodeStatusResponse.StatusMap]): void; + + getProTxHash(): Uint8Array | string; + getProTxHash_asU8(): Uint8Array; + getProTxHash_asB64(): string; + setProTxHash(value: Uint8Array | string): void; + + getPosePenalty(): number; + setPosePenalty(value: number): void; + + getIsSynced(): boolean; + setIsSynced(value: boolean): void; + + getSyncProgress(): number; + setSyncProgress(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetMasternodeStatusResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetMasternodeStatusResponse): GetMasternodeStatusResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetMasternodeStatusResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetMasternodeStatusResponse; + static deserializeBinaryFromReader(message: GetMasternodeStatusResponse, reader: jspb.BinaryReader): GetMasternodeStatusResponse; +} + +export namespace GetMasternodeStatusResponse { + export type AsObject = { + status: GetMasternodeStatusResponse.StatusMap[keyof GetMasternodeStatusResponse.StatusMap], + proTxHash: Uint8Array | string, + posePenalty: number, + isSynced: boolean, + syncProgress: number, + } + + export interface StatusMap { + UNKNOWN: 0; + WAITING_FOR_PROTX: 1; + POSE_BANNED: 2; + REMOVED: 3; + OPERATOR_KEY_CHANGED: 4; + PROTX_IP_CHANGED: 5; + READY: 6; + ERROR: 7; + } + + export const Status: StatusMap; +} + export class GetBlockRequest extends jspb.Message { hasHeight(): boolean; clearHeight(): void; @@ -348,6 +358,42 @@ export namespace GetBlockResponse { } } +export class GetBestBlockHeightRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBestBlockHeightRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetBestBlockHeightRequest): GetBestBlockHeightRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBestBlockHeightRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBestBlockHeightRequest; + static deserializeBinaryFromReader(message: GetBestBlockHeightRequest, reader: jspb.BinaryReader): GetBestBlockHeightRequest; +} + +export namespace GetBestBlockHeightRequest { + export type AsObject = { + } +} + +export class GetBestBlockHeightResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBestBlockHeightResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetBestBlockHeightResponse): GetBestBlockHeightResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBestBlockHeightResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBestBlockHeightResponse; + static deserializeBinaryFromReader(message: GetBestBlockHeightResponse, reader: jspb.BinaryReader): GetBestBlockHeightResponse; +} + +export namespace GetBestBlockHeightResponse { + export type AsObject = { + height: number, + } +} + export class BroadcastTransactionRequest extends jspb.Message { getTransaction(): Uint8Array | string; getTransaction_asU8(): Uint8Array; @@ -781,3 +827,41 @@ export namespace InstantSendLockMessages { } } +export class MasternodeListRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MasternodeListRequest.AsObject; + static toObject(includeInstance: boolean, msg: MasternodeListRequest): MasternodeListRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MasternodeListRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MasternodeListRequest; + static deserializeBinaryFromReader(message: MasternodeListRequest, reader: jspb.BinaryReader): MasternodeListRequest; +} + +export namespace MasternodeListRequest { + export type AsObject = { + } +} + +export class MasternodeListResponse extends jspb.Message { + getMasternodeListDiff(): Uint8Array | string; + getMasternodeListDiff_asU8(): Uint8Array; + getMasternodeListDiff_asB64(): string; + setMasternodeListDiff(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MasternodeListResponse.AsObject; + static toObject(includeInstance: boolean, msg: MasternodeListResponse): MasternodeListResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MasternodeListResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MasternodeListResponse; + static deserializeBinaryFromReader(message: MasternodeListResponse, reader: jspb.BinaryReader): MasternodeListResponse; +} + +export namespace MasternodeListResponse { + export type AsObject = { + masternodeListDiff: Uint8Array | string, + } +} + diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb.js b/packages/dapi-grpc/clients/core/v0/web/core_pb.js index ae974b2f814..5bf2a3edaeb 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb.js +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb.js @@ -23,24 +23,29 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.BloomFilter', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest.BlockCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Network', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Time', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Version', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.InstantSendLockMessages', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.RawTransactions', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest.FromBlockCase', null, { proto }); @@ -56,16 +61,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRespons * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusRequest = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusRequest'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -77,16 +82,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -98,16 +103,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Version'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version'; } /** * Generated by JsPbCodeGenerator. @@ -119,16 +124,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Time'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time'; } /** * Generated by JsPbCodeGenerator. @@ -140,16 +145,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain'; } /** * Generated by JsPbCodeGenerator. @@ -161,16 +166,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee'; } /** * Generated by JsPbCodeGenerator. @@ -182,16 +187,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network'; } /** * Generated by JsPbCodeGenerator. @@ -203,16 +208,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Network'; + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -256,6 +282,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetBlockResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -550,6 +618,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.displayName = 'proto.org.dash.platform.dapi.v0.InstantSendLockMessages'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListRequest.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListResponse.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListResponse'; +} @@ -566,8 +676,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject(opt_includeInstance, this); }; @@ -576,11 +686,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -596,23 +706,23 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusRequest; - return proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -632,9 +742,9 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -642,11 +752,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -667,8 +777,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject(opt_includeInstance, this); }; @@ -677,19 +787,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function( * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(includeInstance, f), - time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(includeInstance, f), + version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(includeInstance, f), + time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(includeInstance, f), status: jspb.Message.getFieldWithDefault(msg, 3, 0), syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0), - chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(includeInstance, f), - masternode: (f = msg.getMasternode()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(includeInstance, f), - network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(includeInstance, f) + chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(includeInstance, f), + network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(includeInstance, f) }; if (includeInstance) { @@ -703,23 +812,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeIns /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -727,17 +836,17 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader); msg.setVersion(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader); msg.setTime(value); break; case 3: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (reader.readEnum()); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (reader.readEnum()); msg.setStatus(value); break; case 4: @@ -745,18 +854,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = msg.setSyncProgress(value); break; case 5: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader); msg.setChain(value); break; - case 6: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader); - msg.setMasternode(value); - break; case 7: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader); msg.setNetwork(value); break; default: @@ -772,9 +876,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -782,18 +886,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = fu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getVersion(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter ); } f = message.getTime(); @@ -801,7 +905,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter ); } f = message.getStatus(); @@ -823,15 +927,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 5, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter - ); - } - f = message.getMasternode(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter ); } f = message.getNetwork(); @@ -839,7 +935,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 7, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter ); } }; @@ -848,7 +944,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Status = { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status = { NOT_STARTED: 0, SYNCING: 1, READY: 2, @@ -871,8 +967,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(opt_includeInstance, this); }; @@ -881,11 +977,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject = function(includeInstance, msg) { var f, obj = { protocol: jspb.Message.getFieldWithDefault(msg, 1, 0), software: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -903,23 +999,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -951,9 +1047,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -961,11 +1057,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getProtocol(); if (f !== 0) { @@ -995,16 +1091,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWrite * optional uint32 protocol = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getProtocol = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getProtocol = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setProtocol = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1013,16 +1109,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol * optional uint32 software = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getSoftware = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getSoftware = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setSoftware = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1031,16 +1127,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware * optional string agent = 3; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getAgent = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getAgent = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setAgent = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setAgent = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; @@ -1061,8 +1157,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(opt_includeInstance, this); }; @@ -1071,11 +1167,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject = function(includeInstance, msg) { var f, obj = { now: jspb.Message.getFieldWithDefault(msg, 1, 0), offset: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1093,23 +1189,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1141,9 +1237,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1151,11 +1247,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNow(); if (f !== 0) { @@ -1185,16 +1281,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = * optional uint32 now = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getNow = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getNow = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setNow = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1203,16 +1299,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = functi * optional int32 offset = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getOffset = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getOffset = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setOffset = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1221,16 +1317,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = fun * optional uint32 median = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getMedian = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getMedian = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setMedian = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setMedian = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1251,8 +1347,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(opt_includeInstance, this); }; @@ -1261,11 +1357,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), headersCount: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1288,23 +1384,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1356,9 +1452,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1366,11 +1462,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { @@ -1435,16 +1531,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter * optional string name = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getName = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setName = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -1453,16 +1549,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = func * optional uint32 headers_count = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getHeadersCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getHeadersCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setHeadersCount = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1471,16 +1567,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCoun * optional uint32 blocks_count = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBlocksCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBlocksCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBlocksCount = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1489,7 +1585,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount * optional bytes best_block_hash = 4; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -1499,7 +1595,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getBestBlockHash())); }; @@ -1512,7 +1608,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getBestBlockHash())); }; @@ -1520,9 +1616,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHash = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBestBlockHash = function(value) { return jspb.Message.setProto3BytesField(this, 4, value); }; @@ -1531,16 +1627,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHa * optional double difficulty = 5; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getDifficulty = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getDifficulty = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setDifficulty = function(value) { return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -1549,7 +1645,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty * optional bytes chain_work = 6; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; @@ -1559,7 +1655,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = * This is a type-conversion wrapper around `getChainWork()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getChainWork())); }; @@ -1572,7 +1668,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a * This is a type-conversion wrapper around `getChainWork()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getChainWork())); }; @@ -1580,9 +1676,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setChainWork = function(value) { return jspb.Message.setProto3BytesField(this, 6, value); }; @@ -1591,16 +1687,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = * optional bool is_synced = 7; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getIsSynced = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getIsSynced = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setIsSynced = function(value) { return jspb.Message.setProto3BooleanField(this, 7, value); }; @@ -1609,16 +1705,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = * optional double sync_progress = 8; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getSyncProgress = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getSyncProgress = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setSyncProgress = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setSyncProgress = function(value) { return jspb.Message.setProto3FloatField(this, 8, value); }; @@ -1639,8 +1735,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(opt_includeInstance, this); }; @@ -1649,17 +1745,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { var f, obj = { - status: jspb.Message.getFieldWithDefault(msg, 1, 0), - proTxHash: msg.getProTxHash_asB64(), - posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), - isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), - syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), + incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) }; if (includeInstance) { @@ -1673,23 +1766,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1697,24 +1790,12 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (reader.readEnum()); - msg.setStatus(value); + var value = /** @type {number} */ (reader.readDouble()); + msg.setRelay(value); break; case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPosePenalty(value); - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIsSynced(value); - break; - case 5: var value = /** @type {number} */ (reader.readDouble()); - msg.setSyncProgress(value); + msg.setIncremental(value); break; default: reader.skipField(); @@ -1729,9 +1810,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1739,44 +1820,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStatus(); + f = message.getRelay(); if (f !== 0.0) { - writer.writeEnum( + writer.writeDouble( 1, f ); } - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } - f = message.getPosePenalty(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getIsSynced(); - if (f) { - writer.writeBool( - 4, - f - ); - } - f = message.getSyncProgress(); + f = message.getIncremental(); if (f !== 0.0) { writer.writeDouble( - 5, + 2, f ); } @@ -1784,130 +1844,38 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWr /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status = { - UNKNOWN: 0, - WAITING_FOR_PROTX: 1, - POSE_BANNED: 2, - REMOVED: 3, - OPERATOR_KEY_CHANGED: 4, - PROTX_IP_CHANGED: 5, - READY: 6, - ERROR: 7 -}; - -/** - * optional Status status = 1; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -/** - * optional uint32 pose_penalty = 3; + * optional double relay = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getPosePenalty = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getRelay = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setPosePenalty = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional bool is_synced = 4; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getIsSynced = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setIsSynced = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setRelay = function(value) { + return jspb.Message.setProto3FloatField(this, 1, value); }; /** - * optional double sync_progress = 5; + * optional double incremental = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getIncremental = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setIncremental = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); }; @@ -1927,8 +1895,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(opt_includeInstance, this); }; @@ -1937,14 +1905,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject = function(includeInstance, msg) { var f, obj = { - relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), - incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) + peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), + fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(includeInstance, f) }; if (includeInstance) { @@ -1958,23 +1926,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1982,12 +1950,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readDouble()); - msg.setRelay(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setPeersCount(value); break; case 2: - var value = /** @type {number} */ (reader.readDouble()); - msg.setIncremental(value); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader); + msg.setFee(value); break; default: reader.skipField(); @@ -2002,9 +1971,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2012,234 +1981,220 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getRelay(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getPeersCount(); + if (f !== 0) { + writer.writeUint32( 1, f ); } - f = message.getIncremental(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getFee(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter ); } }; /** - * optional double relay = 1; + * optional uint32 peers_count = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getRelay = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getPeersCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setRelay = function(value) { - return jspb.Message.setProto3FloatField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setPeersCount = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional double incremental = 2; - * @return {number} + * optional NetworkFee fee = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getIncremental = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getFee = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, 2)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setFee = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setIncremental = function(value) { - return jspb.Message.setProto3FloatField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.clearFee = function() { + return this.setFee(undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.hasFee = function() { + return jspb.Message.getField(this, 2) != null; +}; +/** + * optional Version version = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getVersion = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, 1)); +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearVersion = function() { + return this.setVersion(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject = function(includeInstance, msg) { - var f, obj = { - peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), - fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(includeInstance, f) - }; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasVersion = function() { + return jspb.Message.getField(this, 1) != null; +}; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + +/** + * optional Time time = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getTime = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, 2)); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearTime = function() { + return this.setTime(undefined); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPeersCount(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader); - msg.setFee(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasTime = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional Status status = 3; + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPeersCount(); - if (f !== 0) { - writer.writeUint32( - 1, - f - ); - } - f = message.getFee(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); }; /** - * optional uint32 peers_count = 1; + * optional double sync_progress = 4; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getPeersCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setPeersCount = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 4, value); }; /** - * optional NetworkFee fee = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * optional Chain chain = 5; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getFee = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, 2)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getChain = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, 5)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setFee = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setChain = function(value) { + return jspb.Message.setWrapperField(this, 5, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = function() { - return this.setFee(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearChain = function() { + return this.setChain(undefined); }; @@ -2247,36 +2202,36 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.hasFee = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasChain = function() { + return jspb.Message.getField(this, 5) != null; }; /** - * optional Version version = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * optional Network network = 7; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getVersion = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, 1)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getNetwork = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, 7)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setVersion = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setNetwork = function(value) { + return jspb.Message.setWrapperField(this, 7, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = function() { - return this.setVersion(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearNetwork = function() { + return this.setNetwork(undefined); }; @@ -2284,192 +2239,397 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = funct * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasVersion = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasNetwork = function() { + return jspb.Message.getField(this, 7) != null; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional Time time = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getTime = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, 2)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject(opt_includeInstance, this); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setTime = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearTime = function() { - return this.setTime(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasTime = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional Status status = 3; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional double sync_progress = 4; - * @return {number} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject(opt_includeInstance, this); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject = function(includeInstance, msg) { + var f, obj = { + status: jspb.Message.getFieldWithDefault(msg, 1, 0), + proTxHash: msg.getProTxHash_asB64(), + posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), + isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), + syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional Chain chain = 5; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getChain = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, 5)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setChain = function(value) { - return jspb.Message.setWrapperField(this, 5, value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (reader.readEnum()); + msg.setStatus(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProTxHash(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPosePenalty(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsSynced(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setSyncProgress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearChain = function() { - return this.setChain(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasChain = function() { - return jspb.Message.getField(this, 5) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStatus(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPosePenalty(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getIsSynced(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getSyncProgress(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status = { + UNKNOWN: 0, + WAITING_FOR_PROTX: 1, + POSE_BANNED: 2, + REMOVED: 3, + OPERATOR_KEY_CHANGED: 4, + PROTX_IP_CHANGED: 5, + READY: 6, + ERROR: 7 +}; + +/** + * optional Status status = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional Masternode masternode = 6; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getMasternode = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, 6)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setMasternode = function(value) { - return jspb.Message.setWrapperField(this, 6, value); + * optional bytes pro_tx_hash = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * This is a type-conversion wrapper around `getProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProTxHash())); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional uint32 pose_penalty = 3; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearMasternode = function() { - return this.setMasternode(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getPosePenalty = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasMasternode = function() { - return jspb.Message.getField(this, 6) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setPosePenalty = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * optional Network network = 7; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * optional bool is_synced = 4; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getNetwork = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, 7)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getIsSynced = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setNetwork = function(value) { - return jspb.Message.setWrapperField(this, 7, value); + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setIsSynced = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional double sync_progress = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearNetwork = function() { - return this.setNetwork(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasNetwork = function() { - return jspb.Message.getField(this, 7) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -2783,7 +2943,262 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.deserializeBinaryFromReader = f */ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes block = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes block = 1; + * This is a type-conversion wrapper around `getBlock()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBlock())); +}; + + +/** + * optional bytes block = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBlock()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBlock())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2791,15 +3206,15 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeUint32( 1, f ); @@ -2808,44 +3223,20 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = funct /** - * optional bytes block = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes block = 1; - * This is a type-conversion wrapper around `getBlock()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBlock())); -}; - - -/** - * optional bytes block = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBlock()` - * @return {!Uint8Array} + * optional uint32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBlock())); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; @@ -5878,4 +6269,259 @@ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.prototype.clearMessagesL }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListRequest; + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject = function(includeInstance, msg) { + var f, obj = { + masternodeListDiff: msg.getMasternodeListDiff_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListResponse; + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMasternodeListDiff(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMasternodeListDiff_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes masternode_list_diff = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMasternodeListDiff())); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMasternodeListDiff())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} returns this + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.setMasternodeListDiff = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts index 9b635554bac..4181c8f8526 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts @@ -4,13 +4,22 @@ import * as core_pb from "./core_pb"; import {grpc} from "@improbable-eng/grpc-web"; -type CoregetStatus = { +type CoregetBlockchainStatus = { readonly methodName: string; readonly service: typeof Core; readonly requestStream: false; readonly responseStream: false; - readonly requestType: typeof core_pb.GetStatusRequest; - readonly responseType: typeof core_pb.GetStatusResponse; + readonly requestType: typeof core_pb.GetBlockchainStatusRequest; + readonly responseType: typeof core_pb.GetBlockchainStatusResponse; +}; + +type CoregetMasternodeStatus = { + readonly methodName: string; + readonly service: typeof Core; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof core_pb.GetMasternodeStatusRequest; + readonly responseType: typeof core_pb.GetMasternodeStatusResponse; }; type CoregetBlock = { @@ -22,6 +31,15 @@ type CoregetBlock = { readonly responseType: typeof core_pb.GetBlockResponse; }; +type CoregetBestBlockHeight = { + readonly methodName: string; + readonly service: typeof Core; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof core_pb.GetBestBlockHeightRequest; + readonly responseType: typeof core_pb.GetBestBlockHeightResponse; +}; + type CorebroadcastTransaction = { readonly methodName: string; readonly service: typeof Core; @@ -67,15 +85,27 @@ type CoresubscribeToTransactionsWithProofs = { readonly responseType: typeof core_pb.TransactionsWithProofsResponse; }; +type CoresubscribeToMasternodeList = { + readonly methodName: string; + readonly service: typeof Core; + readonly requestStream: false; + readonly responseStream: true; + readonly requestType: typeof core_pb.MasternodeListRequest; + readonly responseType: typeof core_pb.MasternodeListResponse; +}; + export class Core { static readonly serviceName: string; - static readonly getStatus: CoregetStatus; + static readonly getBlockchainStatus: CoregetBlockchainStatus; + static readonly getMasternodeStatus: CoregetMasternodeStatus; static readonly getBlock: CoregetBlock; + static readonly getBestBlockHeight: CoregetBestBlockHeight; static readonly broadcastTransaction: CorebroadcastTransaction; static readonly getTransaction: CoregetTransaction; static readonly getEstimatedTransactionFee: CoregetEstimatedTransactionFee; static readonly subscribeToBlockHeadersWithChainLocks: CoresubscribeToBlockHeadersWithChainLocks; static readonly subscribeToTransactionsWithProofs: CoresubscribeToTransactionsWithProofs; + static readonly subscribeToMasternodeList: CoresubscribeToMasternodeList; } export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } @@ -110,14 +140,23 @@ export class CoreClient { readonly serviceHost: string; constructor(serviceHost: string, options?: grpc.RpcOptions); - getStatus( - requestMessage: core_pb.GetStatusRequest, + getBlockchainStatus( + requestMessage: core_pb.GetBlockchainStatusRequest, metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: core_pb.GetStatusResponse|null) => void + callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockchainStatusResponse|null) => void ): UnaryResponse; - getStatus( - requestMessage: core_pb.GetStatusRequest, - callback: (error: ServiceError|null, responseMessage: core_pb.GetStatusResponse|null) => void + getBlockchainStatus( + requestMessage: core_pb.GetBlockchainStatusRequest, + callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockchainStatusResponse|null) => void + ): UnaryResponse; + getMasternodeStatus( + requestMessage: core_pb.GetMasternodeStatusRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: core_pb.GetMasternodeStatusResponse|null) => void + ): UnaryResponse; + getMasternodeStatus( + requestMessage: core_pb.GetMasternodeStatusRequest, + callback: (error: ServiceError|null, responseMessage: core_pb.GetMasternodeStatusResponse|null) => void ): UnaryResponse; getBlock( requestMessage: core_pb.GetBlockRequest, @@ -128,6 +167,15 @@ export class CoreClient { requestMessage: core_pb.GetBlockRequest, callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockResponse|null) => void ): UnaryResponse; + getBestBlockHeight( + requestMessage: core_pb.GetBestBlockHeightRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: core_pb.GetBestBlockHeightResponse|null) => void + ): UnaryResponse; + getBestBlockHeight( + requestMessage: core_pb.GetBestBlockHeightRequest, + callback: (error: ServiceError|null, responseMessage: core_pb.GetBestBlockHeightResponse|null) => void + ): UnaryResponse; broadcastTransaction( requestMessage: core_pb.BroadcastTransactionRequest, metadata: grpc.Metadata, @@ -157,5 +205,6 @@ export class CoreClient { ): UnaryResponse; subscribeToBlockHeadersWithChainLocks(requestMessage: core_pb.BlockHeadersWithChainLocksRequest, metadata?: grpc.Metadata): ResponseStream; subscribeToTransactionsWithProofs(requestMessage: core_pb.TransactionsWithProofsRequest, metadata?: grpc.Metadata): ResponseStream; + subscribeToMasternodeList(requestMessage: core_pb.MasternodeListRequest, metadata?: grpc.Metadata): ResponseStream; } diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js index 7eeda0af881..b810654314a 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js @@ -10,13 +10,22 @@ var Core = (function () { return Core; }()); -Core.getStatus = { - methodName: "getStatus", +Core.getBlockchainStatus = { + methodName: "getBlockchainStatus", service: Core, requestStream: false, responseStream: false, - requestType: core_pb.GetStatusRequest, - responseType: core_pb.GetStatusResponse + requestType: core_pb.GetBlockchainStatusRequest, + responseType: core_pb.GetBlockchainStatusResponse +}; + +Core.getMasternodeStatus = { + methodName: "getMasternodeStatus", + service: Core, + requestStream: false, + responseStream: false, + requestType: core_pb.GetMasternodeStatusRequest, + responseType: core_pb.GetMasternodeStatusResponse }; Core.getBlock = { @@ -28,6 +37,15 @@ Core.getBlock = { responseType: core_pb.GetBlockResponse }; +Core.getBestBlockHeight = { + methodName: "getBestBlockHeight", + service: Core, + requestStream: false, + responseStream: false, + requestType: core_pb.GetBestBlockHeightRequest, + responseType: core_pb.GetBestBlockHeightResponse +}; + Core.broadcastTransaction = { methodName: "broadcastTransaction", service: Core, @@ -73,6 +91,15 @@ Core.subscribeToTransactionsWithProofs = { responseType: core_pb.TransactionsWithProofsResponse }; +Core.subscribeToMasternodeList = { + methodName: "subscribeToMasternodeList", + service: Core, + requestStream: false, + responseStream: true, + requestType: core_pb.MasternodeListRequest, + responseType: core_pb.MasternodeListResponse +}; + exports.Core = Core; function CoreClient(serviceHost, options) { @@ -80,11 +107,42 @@ function CoreClient(serviceHost, options) { this.options = options || {}; } -CoreClient.prototype.getStatus = function getStatus(requestMessage, metadata, callback) { +CoreClient.prototype.getBlockchainStatus = function getBlockchainStatus(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Core.getStatus, { + var client = grpc.unary(Core.getBlockchainStatus, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +CoreClient.prototype.getMasternodeStatus = function getMasternodeStatus(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Core.getMasternodeStatus, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -142,6 +200,37 @@ CoreClient.prototype.getBlock = function getBlock(requestMessage, metadata, call }; }; +CoreClient.prototype.getBestBlockHeight = function getBestBlockHeight(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Core.getBestBlockHeight, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + CoreClient.prototype.broadcastTransaction = function broadcastTransaction(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; @@ -313,5 +402,44 @@ CoreClient.prototype.subscribeToTransactionsWithProofs = function subscribeToTra }; }; +CoreClient.prototype.subscribeToMasternodeList = function subscribeToMasternodeList(requestMessage, metadata) { + var listeners = { + data: [], + end: [], + status: [] + }; + var client = grpc.invoke(Core.subscribeToMasternodeList, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onMessage: function (responseMessage) { + listeners.data.forEach(function (handler) { + handler(responseMessage); + }); + }, + onEnd: function (status, statusMessage, trailers) { + listeners.status.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners.end.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners = null; + } + }); + return { + on: function (type, handler) { + listeners[type].push(handler); + return this; + }, + cancel: function () { + listeners = null; + client.close(); + } + }; +}; + exports.CoreClient = CoreClient; diff --git a/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java b/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java index a27ed63482d..908976e2506 100644 --- a/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java +++ b/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java @@ -77,37 +77,6 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityResponse> getGetIdentity return getGetIdentityMethod; } - private static volatile io.grpc.MethodDescriptor getGetIdentitiesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "getIdentities", - requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest.class, - responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetIdentitiesMethod() { - io.grpc.MethodDescriptor getGetIdentitiesMethod; - if ((getGetIdentitiesMethod = PlatformGrpc.getGetIdentitiesMethod) == null) { - synchronized (PlatformGrpc.class) { - if ((getGetIdentitiesMethod = PlatformGrpc.getGetIdentitiesMethod) == null) { - PlatformGrpc.getGetIdentitiesMethod = getGetIdentitiesMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentities")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse.getDefaultInstance())) - .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentities")) - .build(); - } - } - } - return getGetIdentitiesMethod; - } - private static volatile io.grpc.MethodDescriptor getGetIdentityKeysMethod; @@ -139,6 +108,99 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse> getGetIden return getGetIdentityKeysMethod; } + private static volatile io.grpc.MethodDescriptor getGetIdentitiesContractKeysMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getIdentitiesContractKeys", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetIdentitiesContractKeysMethod() { + io.grpc.MethodDescriptor getGetIdentitiesContractKeysMethod; + if ((getGetIdentitiesContractKeysMethod = PlatformGrpc.getGetIdentitiesContractKeysMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetIdentitiesContractKeysMethod = PlatformGrpc.getGetIdentitiesContractKeysMethod) == null) { + PlatformGrpc.getGetIdentitiesContractKeysMethod = getGetIdentitiesContractKeysMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentitiesContractKeys")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentitiesContractKeys")) + .build(); + } + } + } + return getGetIdentitiesContractKeysMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetIdentityNonceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getIdentityNonce", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetIdentityNonceMethod() { + io.grpc.MethodDescriptor getGetIdentityNonceMethod; + if ((getGetIdentityNonceMethod = PlatformGrpc.getGetIdentityNonceMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetIdentityNonceMethod = PlatformGrpc.getGetIdentityNonceMethod) == null) { + PlatformGrpc.getGetIdentityNonceMethod = getGetIdentityNonceMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentityNonce")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentityNonce")) + .build(); + } + } + } + return getGetIdentityNonceMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetIdentityContractNonceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getIdentityContractNonce", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetIdentityContractNonceMethod() { + io.grpc.MethodDescriptor getGetIdentityContractNonceMethod; + if ((getGetIdentityContractNonceMethod = PlatformGrpc.getGetIdentityContractNonceMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetIdentityContractNonceMethod = PlatformGrpc.getGetIdentityContractNonceMethod) == null) { + PlatformGrpc.getGetIdentityContractNonceMethod = getGetIdentityContractNonceMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentityContractNonce")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentityContractNonce")) + .build(); + } + } + } + return getGetIdentityContractNonceMethod; + } + private static volatile io.grpc.MethodDescriptor getGetIdentityBalanceMethod; @@ -356,37 +418,6 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsResponse> getGetDocumen return getGetDocumentsMethod; } - private static volatile io.grpc.MethodDescriptor getGetIdentitiesByPublicKeyHashesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "getIdentitiesByPublicKeyHashes", - requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest.class, - responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetIdentitiesByPublicKeyHashesMethod() { - io.grpc.MethodDescriptor getGetIdentitiesByPublicKeyHashesMethod; - if ((getGetIdentitiesByPublicKeyHashesMethod = PlatformGrpc.getGetIdentitiesByPublicKeyHashesMethod) == null) { - synchronized (PlatformGrpc.class) { - if ((getGetIdentitiesByPublicKeyHashesMethod = PlatformGrpc.getGetIdentitiesByPublicKeyHashesMethod) == null) { - PlatformGrpc.getGetIdentitiesByPublicKeyHashesMethod = getGetIdentitiesByPublicKeyHashesMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentitiesByPublicKeyHashes")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse.getDefaultInstance())) - .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentitiesByPublicKeyHashes")) - .build(); - } - } - } - return getGetIdentitiesByPublicKeyHashesMethod; - } - private static volatile io.grpc.MethodDescriptor getGetIdentityByPublicKeyHashMethod; @@ -573,6 +604,254 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoResponse> getGetEpochs return getGetEpochsInfoMethod; } + private static volatile io.grpc.MethodDescriptor getGetContestedResourcesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getContestedResources", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetContestedResourcesMethod() { + io.grpc.MethodDescriptor getGetContestedResourcesMethod; + if ((getGetContestedResourcesMethod = PlatformGrpc.getGetContestedResourcesMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetContestedResourcesMethod = PlatformGrpc.getGetContestedResourcesMethod) == null) { + PlatformGrpc.getGetContestedResourcesMethod = getGetContestedResourcesMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getContestedResources")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getContestedResources")) + .build(); + } + } + } + return getGetContestedResourcesMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetContestedResourceVoteStateMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getContestedResourceVoteState", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetContestedResourceVoteStateMethod() { + io.grpc.MethodDescriptor getGetContestedResourceVoteStateMethod; + if ((getGetContestedResourceVoteStateMethod = PlatformGrpc.getGetContestedResourceVoteStateMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetContestedResourceVoteStateMethod = PlatformGrpc.getGetContestedResourceVoteStateMethod) == null) { + PlatformGrpc.getGetContestedResourceVoteStateMethod = getGetContestedResourceVoteStateMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getContestedResourceVoteState")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getContestedResourceVoteState")) + .build(); + } + } + } + return getGetContestedResourceVoteStateMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetContestedResourceVotersForIdentityMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getContestedResourceVotersForIdentity", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetContestedResourceVotersForIdentityMethod() { + io.grpc.MethodDescriptor getGetContestedResourceVotersForIdentityMethod; + if ((getGetContestedResourceVotersForIdentityMethod = PlatformGrpc.getGetContestedResourceVotersForIdentityMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetContestedResourceVotersForIdentityMethod = PlatformGrpc.getGetContestedResourceVotersForIdentityMethod) == null) { + PlatformGrpc.getGetContestedResourceVotersForIdentityMethod = getGetContestedResourceVotersForIdentityMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getContestedResourceVotersForIdentity")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getContestedResourceVotersForIdentity")) + .build(); + } + } + } + return getGetContestedResourceVotersForIdentityMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetContestedResourceIdentityVotesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getContestedResourceIdentityVotes", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetContestedResourceIdentityVotesMethod() { + io.grpc.MethodDescriptor getGetContestedResourceIdentityVotesMethod; + if ((getGetContestedResourceIdentityVotesMethod = PlatformGrpc.getGetContestedResourceIdentityVotesMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetContestedResourceIdentityVotesMethod = PlatformGrpc.getGetContestedResourceIdentityVotesMethod) == null) { + PlatformGrpc.getGetContestedResourceIdentityVotesMethod = getGetContestedResourceIdentityVotesMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getContestedResourceIdentityVotes")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getContestedResourceIdentityVotes")) + .build(); + } + } + } + return getGetContestedResourceIdentityVotesMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetVotePollsByEndDateMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getVotePollsByEndDate", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetVotePollsByEndDateMethod() { + io.grpc.MethodDescriptor getGetVotePollsByEndDateMethod; + if ((getGetVotePollsByEndDateMethod = PlatformGrpc.getGetVotePollsByEndDateMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetVotePollsByEndDateMethod = PlatformGrpc.getGetVotePollsByEndDateMethod) == null) { + PlatformGrpc.getGetVotePollsByEndDateMethod = getGetVotePollsByEndDateMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getVotePollsByEndDate")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getVotePollsByEndDate")) + .build(); + } + } + } + return getGetVotePollsByEndDateMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetPrefundedSpecializedBalanceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getPrefundedSpecializedBalance", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetPrefundedSpecializedBalanceMethod() { + io.grpc.MethodDescriptor getGetPrefundedSpecializedBalanceMethod; + if ((getGetPrefundedSpecializedBalanceMethod = PlatformGrpc.getGetPrefundedSpecializedBalanceMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetPrefundedSpecializedBalanceMethod = PlatformGrpc.getGetPrefundedSpecializedBalanceMethod) == null) { + PlatformGrpc.getGetPrefundedSpecializedBalanceMethod = getGetPrefundedSpecializedBalanceMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getPrefundedSpecializedBalance")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getPrefundedSpecializedBalance")) + .build(); + } + } + } + return getGetPrefundedSpecializedBalanceMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetTotalCreditsInPlatformMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getTotalCreditsInPlatform", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetTotalCreditsInPlatformMethod() { + io.grpc.MethodDescriptor getGetTotalCreditsInPlatformMethod; + if ((getGetTotalCreditsInPlatformMethod = PlatformGrpc.getGetTotalCreditsInPlatformMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetTotalCreditsInPlatformMethod = PlatformGrpc.getGetTotalCreditsInPlatformMethod) == null) { + PlatformGrpc.getGetTotalCreditsInPlatformMethod = getGetTotalCreditsInPlatformMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getTotalCreditsInPlatform")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getTotalCreditsInPlatform")) + .build(); + } + } + } + return getGetTotalCreditsInPlatformMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetPathElementsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getPathElements", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetPathElementsMethod() { + io.grpc.MethodDescriptor getGetPathElementsMethod; + if ((getGetPathElementsMethod = PlatformGrpc.getGetPathElementsMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetPathElementsMethod = PlatformGrpc.getGetPathElementsMethod) == null) { + PlatformGrpc.getGetPathElementsMethod = getGetPathElementsMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getPathElements")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getPathElements")) + .build(); + } + } + } + return getGetPathElementsMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -637,16 +916,30 @@ public void getIdentity(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentity /** */ - public void getIdentities(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentitiesMethod(), responseObserver); + public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityKeysMethod(), responseObserver); } /** */ - public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityKeysMethod(), responseObserver); + public void getIdentitiesContractKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentitiesContractKeysMethod(), responseObserver); + } + + /** + */ + public void getIdentityNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityNonceMethod(), responseObserver); + } + + /** + */ + public void getIdentityContractNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityContractNonceMethod(), responseObserver); } /** @@ -698,13 +991,6 @@ public void getDocuments(org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumen io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetDocumentsMethod(), responseObserver); } - /** - */ - public void getIdentitiesByPublicKeyHashes(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentitiesByPublicKeyHashesMethod(), responseObserver); - } - /** */ public void getIdentityByPublicKeyHash(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest request, @@ -747,6 +1033,77 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetEpochsInfoMethod(), responseObserver); } + /** + *

+     * What votes are currently happening for a specific contested index
+     * 
+ */ + public void getContestedResources(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetContestedResourcesMethod(), responseObserver); + } + + /** + *
+     * What's the state of a contested resource vote? (ie who is winning?)
+     * 
+ */ + public void getContestedResourceVoteState(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetContestedResourceVoteStateMethod(), responseObserver); + } + + /** + *
+     * Who voted for a contested resource to go to a specific identity?
+     * 
+ */ + public void getContestedResourceVotersForIdentity(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetContestedResourceVotersForIdentityMethod(), responseObserver); + } + + /** + *
+     * How did an identity vote?
+     * 
+ */ + public void getContestedResourceIdentityVotes(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetContestedResourceIdentityVotesMethod(), responseObserver); + } + + /** + *
+     * What vote polls will end soon?
+     * 
+ */ + public void getVotePollsByEndDate(org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetVotePollsByEndDateMethod(), responseObserver); + } + + /** + */ + public void getPrefundedSpecializedBalance(org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPrefundedSpecializedBalanceMethod(), responseObserver); + } + + /** + */ + public void getTotalCreditsInPlatform(org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTotalCreditsInPlatformMethod(), responseObserver); + } + + /** + */ + public void getPathElements(org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPathElementsMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( @@ -763,13 +1120,6 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityResponse>( this, METHODID_GET_IDENTITY))) - .addMethod( - getGetIdentitiesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest, - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse>( - this, METHODID_GET_IDENTITIES))) .addMethod( getGetIdentityKeysMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -777,6 +1127,27 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse>( this, METHODID_GET_IDENTITY_KEYS))) + .addMethod( + getGetIdentitiesContractKeysMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse>( + this, METHODID_GET_IDENTITIES_CONTRACT_KEYS))) + .addMethod( + getGetIdentityNonceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse>( + this, METHODID_GET_IDENTITY_NONCE))) + .addMethod( + getGetIdentityContractNonceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse>( + this, METHODID_GET_IDENTITY_CONTRACT_NONCE))) .addMethod( getGetIdentityBalanceMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -826,13 +1197,6 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsResponse>( this, METHODID_GET_DOCUMENTS))) - .addMethod( - getGetIdentitiesByPublicKeyHashesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest, - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse>( - this, METHODID_GET_IDENTITIES_BY_PUBLIC_KEY_HASHES))) .addMethod( getGetIdentityByPublicKeyHashMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -875,6 +1239,62 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoResponse>( this, METHODID_GET_EPOCHS_INFO))) + .addMethod( + getGetContestedResourcesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesResponse>( + this, METHODID_GET_CONTESTED_RESOURCES))) + .addMethod( + getGetContestedResourceVoteStateMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateResponse>( + this, METHODID_GET_CONTESTED_RESOURCE_VOTE_STATE))) + .addMethod( + getGetContestedResourceVotersForIdentityMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityResponse>( + this, METHODID_GET_CONTESTED_RESOURCE_VOTERS_FOR_IDENTITY))) + .addMethod( + getGetContestedResourceIdentityVotesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesResponse>( + this, METHODID_GET_CONTESTED_RESOURCE_IDENTITY_VOTES))) + .addMethod( + getGetVotePollsByEndDateMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateResponse>( + this, METHODID_GET_VOTE_POLLS_BY_END_DATE))) + .addMethod( + getGetPrefundedSpecializedBalanceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceResponse>( + this, METHODID_GET_PREFUNDED_SPECIALIZED_BALANCE))) + .addMethod( + getGetTotalCreditsInPlatformMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformResponse>( + this, METHODID_GET_TOTAL_CREDITS_IN_PLATFORM))) + .addMethod( + getGetPathElementsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse>( + this, METHODID_GET_PATH_ELEMENTS))) .build(); } } @@ -911,18 +1331,34 @@ public void getIdentity(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentity /** */ - public void getIdentities(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request, - io.grpc.stub.StreamObserver responseObserver) { + public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIdentitiesMethod(), getCallOptions()), request, responseObserver); + getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request, responseObserver); } /** */ - public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, - io.grpc.stub.StreamObserver responseObserver) { + public void getIdentitiesContractKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request, responseObserver); + getChannel().newCall(getGetIdentitiesContractKeysMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getIdentityNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIdentityNonceMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getIdentityContractNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIdentityContractNonceMethod(), getCallOptions()), request, responseObserver); } /** @@ -981,14 +1417,6 @@ public void getDocuments(org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumen getChannel().newCall(getGetDocumentsMethod(), getCallOptions()), request, responseObserver); } - /** - */ - public void getIdentitiesByPublicKeyHashes(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIdentitiesByPublicKeyHashesMethod(), getCallOptions()), request, responseObserver); - } - /** */ public void getIdentityByPublicKeyHash(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest request, @@ -1036,6 +1464,85 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getGetEpochsInfoMethod(), getCallOptions()), request, responseObserver); } + + /** + *
+     * What votes are currently happening for a specific contested index
+     * 
+ */ + public void getContestedResources(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetContestedResourcesMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * What's the state of a contested resource vote? (ie who is winning?)
+     * 
+ */ + public void getContestedResourceVoteState(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetContestedResourceVoteStateMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Who voted for a contested resource to go to a specific identity?
+     * 
+ */ + public void getContestedResourceVotersForIdentity(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetContestedResourceVotersForIdentityMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * How did an identity vote?
+     * 
+ */ + public void getContestedResourceIdentityVotes(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetContestedResourceIdentityVotesMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * What vote polls will end soon?
+     * 
+ */ + public void getVotePollsByEndDate(org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetVotePollsByEndDateMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getPrefundedSpecializedBalance(org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetPrefundedSpecializedBalanceMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getTotalCreditsInPlatform(org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTotalCreditsInPlatformMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getPathElements(org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetPathElementsMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -1068,16 +1575,30 @@ public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityResponse getIdent /** */ - public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse getIdentities(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request) { + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetIdentitiesMethod(), getCallOptions(), request); + getChannel(), getGetIdentityKeysMethod(), getCallOptions(), request); } /** */ - public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse getIdentitiesContractKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request) { return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetIdentityKeysMethod(), getCallOptions(), request); + getChannel(), getGetIdentitiesContractKeysMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse getIdentityNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIdentityNonceMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse getIdentityContractNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIdentityContractNonceMethod(), getCallOptions(), request); } /** @@ -1129,13 +1650,6 @@ public org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsResponse getDocu getChannel(), getGetDocumentsMethod(), getCallOptions(), request); } - /** - */ - public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse getIdentitiesByPublicKeyHashes(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetIdentitiesByPublicKeyHashesMethod(), getCallOptions(), request); - } - /** */ public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashResponse getIdentityByPublicKeyHash(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest request) { @@ -1177,6 +1691,77 @@ public org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoResponse getEpo return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getGetEpochsInfoMethod(), getCallOptions(), request); } + + /** + *
+     * What votes are currently happening for a specific contested index
+     * 
+ */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesResponse getContestedResources(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetContestedResourcesMethod(), getCallOptions(), request); + } + + /** + *
+     * What's the state of a contested resource vote? (ie who is winning?)
+     * 
+ */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateResponse getContestedResourceVoteState(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetContestedResourceVoteStateMethod(), getCallOptions(), request); + } + + /** + *
+     * Who voted for a contested resource to go to a specific identity?
+     * 
+ */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityResponse getContestedResourceVotersForIdentity(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetContestedResourceVotersForIdentityMethod(), getCallOptions(), request); + } + + /** + *
+     * How did an identity vote?
+     * 
+ */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesResponse getContestedResourceIdentityVotes(org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetContestedResourceIdentityVotesMethod(), getCallOptions(), request); + } + + /** + *
+     * What vote polls will end soon?
+     * 
+ */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateResponse getVotePollsByEndDate(org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetVotePollsByEndDateMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceResponse getPrefundedSpecializedBalance(org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetPrefundedSpecializedBalanceMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformResponse getTotalCreditsInPlatform(org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTotalCreditsInPlatformMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse getPathElements(org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetPathElementsMethod(), getCallOptions(), request); + } } /** @@ -1211,18 +1796,34 @@ public com.google.common.util.concurrent.ListenableFuture getIdentities( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request) { + public com.google.common.util.concurrent.ListenableFuture getIdentityKeys( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetIdentitiesMethod(), getCallOptions()), request); + getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request); } /** */ - public com.google.common.util.concurrent.ListenableFuture getIdentityKeys( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { + public com.google.common.util.concurrent.ListenableFuture getIdentitiesContractKeys( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request) { return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request); + getChannel().newCall(getGetIdentitiesContractKeysMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getIdentityNonce( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetIdentityNonceMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getIdentityContractNonce( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetIdentityContractNonceMethod(), getCallOptions()), request); } /** @@ -1281,14 +1882,6 @@ public com.google.common.util.concurrent.ListenableFuture getIdentitiesByPublicKeyHashes( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetIdentitiesByPublicKeyHashesMethod(), getCallOptions()), request); - } - /** */ public com.google.common.util.concurrent.ListenableFuture getIdentityByPublicKeyHash( @@ -1336,26 +1929,114 @@ public com.google.common.util.concurrent.ListenableFuture + * What votes are currently happening for a specific contested index + * + */ + public com.google.common.util.concurrent.ListenableFuture getContestedResources( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetContestedResourcesMethod(), getCallOptions()), request); + } + + /** + *
+     * What's the state of a contested resource vote? (ie who is winning?)
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getContestedResourceVoteState( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetContestedResourceVoteStateMethod(), getCallOptions()), request); + } + + /** + *
+     * Who voted for a contested resource to go to a specific identity?
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getContestedResourceVotersForIdentity( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetContestedResourceVotersForIdentityMethod(), getCallOptions()), request); + } + + /** + *
+     * How did an identity vote?
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getContestedResourceIdentityVotes( + org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetContestedResourceIdentityVotesMethod(), getCallOptions()), request); + } + + /** + *
+     * What vote polls will end soon?
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getVotePollsByEndDate( + org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetVotePollsByEndDateMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getPrefundedSpecializedBalance( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetPrefundedSpecializedBalanceMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getTotalCreditsInPlatform( + org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTotalCreditsInPlatformMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getPathElements( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetPathElementsMethod(), getCallOptions()), request); + } } private static final int METHODID_BROADCAST_STATE_TRANSITION = 0; private static final int METHODID_GET_IDENTITY = 1; - private static final int METHODID_GET_IDENTITIES = 2; - private static final int METHODID_GET_IDENTITY_KEYS = 3; - private static final int METHODID_GET_IDENTITY_BALANCE = 4; - private static final int METHODID_GET_IDENTITY_BALANCE_AND_REVISION = 5; - private static final int METHODID_GET_PROOFS = 6; - private static final int METHODID_GET_DATA_CONTRACT = 7; - private static final int METHODID_GET_DATA_CONTRACT_HISTORY = 8; - private static final int METHODID_GET_DATA_CONTRACTS = 9; - private static final int METHODID_GET_DOCUMENTS = 10; - private static final int METHODID_GET_IDENTITIES_BY_PUBLIC_KEY_HASHES = 11; - private static final int METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH = 12; - private static final int METHODID_WAIT_FOR_STATE_TRANSITION_RESULT = 13; - private static final int METHODID_GET_CONSENSUS_PARAMS = 14; - private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_STATE = 15; - private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_VOTE_STATUS = 16; - private static final int METHODID_GET_EPOCHS_INFO = 17; + private static final int METHODID_GET_IDENTITY_KEYS = 2; + private static final int METHODID_GET_IDENTITIES_CONTRACT_KEYS = 3; + private static final int METHODID_GET_IDENTITY_NONCE = 4; + private static final int METHODID_GET_IDENTITY_CONTRACT_NONCE = 5; + private static final int METHODID_GET_IDENTITY_BALANCE = 6; + private static final int METHODID_GET_IDENTITY_BALANCE_AND_REVISION = 7; + private static final int METHODID_GET_PROOFS = 8; + private static final int METHODID_GET_DATA_CONTRACT = 9; + private static final int METHODID_GET_DATA_CONTRACT_HISTORY = 10; + private static final int METHODID_GET_DATA_CONTRACTS = 11; + private static final int METHODID_GET_DOCUMENTS = 12; + private static final int METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH = 13; + private static final int METHODID_WAIT_FOR_STATE_TRANSITION_RESULT = 14; + private static final int METHODID_GET_CONSENSUS_PARAMS = 15; + private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_STATE = 16; + private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_VOTE_STATUS = 17; + private static final int METHODID_GET_EPOCHS_INFO = 18; + private static final int METHODID_GET_CONTESTED_RESOURCES = 19; + private static final int METHODID_GET_CONTESTED_RESOURCE_VOTE_STATE = 20; + private static final int METHODID_GET_CONTESTED_RESOURCE_VOTERS_FOR_IDENTITY = 21; + private static final int METHODID_GET_CONTESTED_RESOURCE_IDENTITY_VOTES = 22; + private static final int METHODID_GET_VOTE_POLLS_BY_END_DATE = 23; + private static final int METHODID_GET_PREFUNDED_SPECIALIZED_BALANCE = 24; + private static final int METHODID_GET_TOTAL_CREDITS_IN_PLATFORM = 25; + private static final int METHODID_GET_PATH_ELEMENTS = 26; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1382,14 +2063,22 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.getIdentity((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; - case METHODID_GET_IDENTITIES: - serviceImpl.getIdentities((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; case METHODID_GET_IDENTITY_KEYS: serviceImpl.getIdentityKeys((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_IDENTITIES_CONTRACT_KEYS: + serviceImpl.getIdentitiesContractKeys((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_IDENTITY_NONCE: + serviceImpl.getIdentityNonce((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_IDENTITY_CONTRACT_NONCE: + serviceImpl.getIdentityContractNonce((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; case METHODID_GET_IDENTITY_BALANCE: serviceImpl.getIdentityBalance((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -1418,10 +2107,6 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.getDocuments((org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; - case METHODID_GET_IDENTITIES_BY_PUBLIC_KEY_HASHES: - serviceImpl.getIdentitiesByPublicKeyHashes((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; case METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH: serviceImpl.getIdentityByPublicKeyHash((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -1446,6 +2131,38 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.getEpochsInfo((org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_CONTESTED_RESOURCES: + serviceImpl.getContestedResources((org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourcesRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_CONTESTED_RESOURCE_VOTE_STATE: + serviceImpl.getContestedResourceVoteState((org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVoteStateRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_CONTESTED_RESOURCE_VOTERS_FOR_IDENTITY: + serviceImpl.getContestedResourceVotersForIdentity((org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceVotersForIdentityRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_CONTESTED_RESOURCE_IDENTITY_VOTES: + serviceImpl.getContestedResourceIdentityVotes((org.dash.platform.dapi.v0.PlatformOuterClass.GetContestedResourceIdentityVotesRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_VOTE_POLLS_BY_END_DATE: + serviceImpl.getVotePollsByEndDate((org.dash.platform.dapi.v0.PlatformOuterClass.GetVotePollsByEndDateRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_PREFUNDED_SPECIALIZED_BALANCE: + serviceImpl.getPrefundedSpecializedBalance((org.dash.platform.dapi.v0.PlatformOuterClass.GetPrefundedSpecializedBalanceRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_TOTAL_CREDITS_IN_PLATFORM: + serviceImpl.getTotalCreditsInPlatform((org.dash.platform.dapi.v0.PlatformOuterClass.GetTotalCreditsInPlatformRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_PATH_ELEMENTS: + serviceImpl.getPathElements((org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -1509,8 +2226,10 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .setSchemaDescriptor(new PlatformFileDescriptorSupplier()) .addMethod(getBroadcastStateTransitionMethod()) .addMethod(getGetIdentityMethod()) - .addMethod(getGetIdentitiesMethod()) .addMethod(getGetIdentityKeysMethod()) + .addMethod(getGetIdentitiesContractKeysMethod()) + .addMethod(getGetIdentityNonceMethod()) + .addMethod(getGetIdentityContractNonceMethod()) .addMethod(getGetIdentityBalanceMethod()) .addMethod(getGetIdentityBalanceAndRevisionMethod()) .addMethod(getGetProofsMethod()) @@ -1518,13 +2237,20 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getGetDataContractHistoryMethod()) .addMethod(getGetDataContractsMethod()) .addMethod(getGetDocumentsMethod()) - .addMethod(getGetIdentitiesByPublicKeyHashesMethod()) .addMethod(getGetIdentityByPublicKeyHashMethod()) .addMethod(getWaitForStateTransitionResultMethod()) .addMethod(getGetConsensusParamsMethod()) .addMethod(getGetProtocolVersionUpgradeStateMethod()) .addMethod(getGetProtocolVersionUpgradeVoteStatusMethod()) .addMethod(getGetEpochsInfoMethod()) + .addMethod(getGetContestedResourcesMethod()) + .addMethod(getGetContestedResourceVoteStateMethod()) + .addMethod(getGetContestedResourceVotersForIdentityMethod()) + .addMethod(getGetContestedResourceIdentityVotesMethod()) + .addMethod(getGetVotePollsByEndDateMethod()) + .addMethod(getGetPrefundedSpecializedBalanceMethod()) + .addMethod(getGetTotalCreditsInPlatformMethod()) + .addMethod(getGetPathElementsMethod()) .build(); } } diff --git a/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js b/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js index 6f38579c6c5..e7606a52bcb 100644 --- a/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js +++ b/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js @@ -28,14 +28,16 @@ const { BroadcastStateTransitionResponse: PBJSBroadcastStateTransitionResponse, GetIdentityRequest: PBJSGetIdentityRequest, GetIdentityResponse: PBJSGetIdentityResponse, + GetIdentitiesContractKeysRequest: PBJSGetIdentitiesContractKeysRequest, + GetIdentitiesContractKeysResponse: PBJSGetIdentitiesContractKeysResponse, GetDataContractRequest: PBJSGetDataContractRequest, GetDataContractResponse: PBJSGetDataContractResponse, GetDataContractHistoryRequest: PBJSGetDataContractHistoryRequest, GetDataContractHistoryResponse: PBJSGetDataContractHistoryResponse, GetDocumentsRequest: PBJSGetDocumentsRequest, GetDocumentsResponse: PBJSGetDocumentsResponse, - GetIdentitiesByPublicKeyHashesRequest: PBJSGetIdentitiesByPublicKeyHashesRequest, - GetIdentitiesByPublicKeyHashesResponse: PBJSGetIdentitiesByPublicKeyHashesResponse, + GetIdentityByPublicKeyHashRequest: PBJSGetIdentityByPublicKeyHashRequest, + GetIdentityByPublicKeyHashResponse: PBJSGetIdentityByPublicKeyHashResponse, WaitForStateTransitionResultRequest: PBJSWaitForStateTransitionResultRequest, WaitForStateTransitionResultResponse: PBJSWaitForStateTransitionResultResponse, GetConsensusParamsRequest: PBJSGetConsensusParamsRequest, @@ -48,6 +50,16 @@ const { PBJSGetProtocolVersionUpgradeVoteStatusResponse, GetProtocolVersionUpgradeStateRequest: PBJSGetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeStateResponse: PBJSGetProtocolVersionUpgradeStateResponse, + GetProofsRequest: PBJSGetProofsRequest, + GetProofsResponse: PBJSGetProofsResponse, + GetIdentityContractNonceRequest: PBJSGetIdentityContractNonceRequest, + GetIdentityContractNonceResponse: PBJSGetIdentityContractNonceResponse, + GetIdentityNonceRequest: PBJSGetIdentityNonceRequest, + GetIdentityNonceResponse: PBJSGetIdentityNonceResponse, + GetIdentityKeysRequest: PBJSGetIdentityKeysRequest, + GetIdentityKeysResponse: PBJSGetIdentityKeysResponse, + GetTotalCreditsInPlatformRequest: PBJSGetTotalCreditsInPlatformRequest, + GetTotalCreditsInPlatformResponse: PBJSGetTotalCreditsInPlatformResponse, }, }, }, @@ -58,15 +70,21 @@ const { const { BroadcastStateTransitionResponse: ProtocBroadcastStateTransitionResponse, GetIdentityResponse: ProtocGetIdentityResponse, + GetIdentitiesContractKeysResponse: ProtocGetIdentitiesContractKeysResponse, GetDataContractResponse: ProtocGetDataContractResponse, GetDataContractHistoryResponse: ProtocGetDataContractHistoryResponse, GetDocumentsResponse: ProtocGetDocumentsResponse, - GetIdentitiesByPublicKeyHashesResponse: ProtocGetIdentitiesByPublicKeyHashesResponse, + GetIdentityByPublicKeyHashResponse: ProtocGetIdentityByPublicKeyHashResponse, WaitForStateTransitionResultResponse: ProtocWaitForStateTransitionResultResponse, GetConsensusParamsResponse: ProtocGetConsensusParamsResponse, GetEpochsInfoResponse: ProtocGetEpochsInfoResponse, GetProtocolVersionUpgradeVoteStatusResponse: ProtocGetProtocolVersionUpgradeVoteStatusResponse, GetProtocolVersionUpgradeStateResponse: ProtocGetProtocolVersionUpgradeStateResponse, + GetProofsResponse: ProtocGetProofsResponse, + GetIdentityContractNonceResponse: ProtocGetIdentityContractNonceResponse, + GetIdentityNonceResponse: ProtocGetIdentityNonceResponse, + GetIdentityKeysResponse: ProtocGetIdentityKeysResponse, + GetTotalCreditsInPlatformResponse: ProtocGetTotalCreditsInPlatformResponse, } = require('./platform_protoc'); const getPlatformDefinition = require('../../../../lib/getPlatformDefinition'); @@ -101,6 +119,10 @@ class PlatformPromiseClient { this.client.getIdentity.bind(this.client), ); + this.client.getIdentitiesContractKeys = promisify( + this.client.getIdentitiesContractKeys.bind(this.client), + ); + this.client.getDataContract = promisify( this.client.getDataContract.bind(this.client), ); @@ -113,8 +135,8 @@ class PlatformPromiseClient { this.client.getDocuments.bind(this.client), ); - this.client.getIdentitiesByPublicKeyHashes = promisify( - this.client.getIdentitiesByPublicKeyHashes.bind(this.client), + this.client.getIdentityByPublicKeyHash = promisify( + this.client.getIdentityByPublicKeyHash.bind(this.client), ); this.client.waitForStateTransitionResult = promisify( @@ -137,6 +159,26 @@ class PlatformPromiseClient { this.client.getProtocolVersionUpgradeState.bind(this.client), ); + this.client.getProofs = promisify( + this.client.getProofs.bind(this.client), + ); + + this.client.getIdentityContractNonce = promisify( + this.client.getIdentityContractNonce.bind(this.client), + ); + + this.client.getIdentityNonce = promisify( + this.client.getIdentityNonce.bind(this.client), + ); + + this.client.getIdentityKeys = promisify( + this.client.getIdentityKeys.bind(this.client), + ); + + this.client.getTotalCreditsInPlatform = promisify( + this.client.getTotalCreditsInPlatform.bind(this.client), + ); + this.protocolVersion = undefined; } @@ -202,6 +244,40 @@ class PlatformPromiseClient { ); } + /** + * @param {!GetIdentitiesContractKeysRequest} getIdentitiesContractKeysRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @returns {Promise} + */ + getIdentitiesContractKeys( + getIdentitiesContractKeysRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + return this.client.getIdentitiesContractKeys( + getIdentitiesContractKeysRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentitiesContractKeysResponse, + PBJSGetIdentitiesContractKeysResponse, + ), + protobufToJsonFactory( + PBJSGetIdentitiesContractKeysRequest, + ), + ), + ], + ...options, + }, + ); + } + /** * * @param {!GetDataContractRequest} getDataContractRequest @@ -299,13 +375,13 @@ class PlatformPromiseClient { } /** - * @param {!GetIdentitiesByPublicKeyHashesRequest} getIdentitiesByPublicKeyHashesRequest + * @param {!GetIdentityByPublicKeyHashRequest} getIdentityByPublicKeyHashRequest * @param {?Object} metadata * @param {CallOptions} [options={}] - * @returns {Promise} + * @returns {Promise} */ - getIdentitiesByPublicKeyHashes( - getIdentitiesByPublicKeyHashesRequest, + getIdentityByPublicKeyHash( + getIdentityByPublicKeyHashRequest, metadata = {}, options = {}, ) { @@ -313,18 +389,18 @@ class PlatformPromiseClient { throw new Error('metadata must be an object'); } - return this.client.getIdentitiesByPublicKeyHashes( - getIdentitiesByPublicKeyHashesRequest, + return this.client.getIdentityByPublicKeyHash( + getIdentityByPublicKeyHashRequest, convertObjectToMetadata(metadata), { interceptors: [ jsonToProtobufInterceptorFactory( jsonToProtobufFactory( - ProtocGetIdentitiesByPublicKeyHashesResponse, - PBJSGetIdentitiesByPublicKeyHashesResponse, + ProtocGetIdentityByPublicKeyHashResponse, + PBJSGetIdentityByPublicKeyHashResponse, ), protobufToJsonFactory( - PBJSGetIdentitiesByPublicKeyHashesRequest, + PBJSGetIdentityByPublicKeyHashRequest, ), ), ], @@ -496,6 +572,160 @@ class PlatformPromiseClient { ); } + /** + * + * @param {!GetProofsRequest} request + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @returns {Promise} + */ + getProofs(request, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getProofs( + request, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetProofsResponse, + PBJSGetProofsResponse, + ), + protobufToJsonFactory( + PBJSGetProofsRequest, + ), + ), + ], + ...options, + }, + ); + } + + /** + * @param {!PBJSGetIdentityContractNonceRequest} getIdentityContractNonceRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @return {Promise} + */ + getIdentityContractNonce( + getIdentityContractNonceRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getIdentityContractNonce( + getIdentityContractNonceRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentityContractNonceResponse, + PBJSGetIdentityContractNonceResponse, + ), + protobufToJsonFactory( + PBJSGetIdentityContractNonceRequest, + ), + ), + ], + ...options, + }, + ); + } + + getIdentityNonce( + getIdentityNonceRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getIdentityNonce( + getIdentityNonceRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentityNonceResponse, + PBJSGetIdentityNonceResponse, + ), + protobufToJsonFactory( + PBJSGetIdentityNonceRequest, + ), + ), + ], + ...options, + }, + ); + } + + getIdentityKeys( + getIdentityKeysRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getIdentityKeys( + getIdentityKeysRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentityKeysResponse, + PBJSGetIdentityKeysResponse, + ), + protobufToJsonFactory( + PBJSGetIdentityKeysRequest, + ), + ), + ], + ...options, + }, + ); + } + + getTotalCreditsInPlatform( + getTotalCreditsInPlatformRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getTotalCreditsInPlatform( + getTotalCreditsInPlatformRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetTotalCreditsInPlatformResponse, + PBJSGetTotalCreditsInPlatformResponse, + ), + protobufToJsonFactory( + PBJSGetTotalCreditsInPlatformRequest, + ), + ), + ], + ...options, + }, + ); + } + /** * @param {string} protocolVersion */ diff --git a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js index f1dafcc9299..d01a3839fe1 100644 --- a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js +++ b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js @@ -153,68 +153,134 @@ $root.org = (function() { */ /** - * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentities}. + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityKeys}. * @memberof org.dash.platform.dapi.v0.Platform - * @typedef getIdentitiesCallback + * @typedef getIdentityKeysCallback * @type {function} * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse} [response] GetIdentitiesResponse + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse} [response] GetIdentityKeysResponse */ /** - * Calls getIdentities. - * @function getIdentities + * Calls getIdentityKeys. + * @function getIdentityKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} request GetIdentitiesRequest message or plain object - * @param {org.dash.platform.dapi.v0.Platform.getIdentitiesCallback} callback Node-style callback called with the error, if any, and GetIdentitiesResponse + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentityKeysCallback} callback Node-style callback called with the error, if any, and GetIdentityKeysResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(Platform.prototype.getIdentities = function getIdentities(request, callback) { - return this.rpcCall(getIdentities, $root.org.dash.platform.dapi.v0.GetIdentitiesRequest, $root.org.dash.platform.dapi.v0.GetIdentitiesResponse, request, callback); - }, "name", { value: "getIdentities" }); + Object.defineProperty(Platform.prototype.getIdentityKeys = function getIdentityKeys(request, callback) { + return this.rpcCall(getIdentityKeys, $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest, $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse, request, callback); + }, "name", { value: "getIdentityKeys" }); /** - * Calls getIdentities. - * @function getIdentities + * Calls getIdentityKeys. + * @function getIdentityKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} request GetIdentitiesRequest message or plain object - * @returns {Promise} Promise + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityKeys}. + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentitiesContractKeys}. * @memberof org.dash.platform.dapi.v0.Platform - * @typedef getIdentityKeysCallback + * @typedef getIdentitiesContractKeysCallback * @type {function} * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse} [response] GetIdentityKeysResponse + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} [response] GetIdentitiesContractKeysResponse */ /** - * Calls getIdentityKeys. - * @function getIdentityKeys + * Calls getIdentitiesContractKeys. + * @function getIdentitiesContractKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object - * @param {org.dash.platform.dapi.v0.Platform.getIdentityKeysCallback} callback Node-style callback called with the error, if any, and GetIdentityKeysResponse + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} request GetIdentitiesContractKeysRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentitiesContractKeysCallback} callback Node-style callback called with the error, if any, and GetIdentitiesContractKeysResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(Platform.prototype.getIdentityKeys = function getIdentityKeys(request, callback) { - return this.rpcCall(getIdentityKeys, $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest, $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse, request, callback); - }, "name", { value: "getIdentityKeys" }); + Object.defineProperty(Platform.prototype.getIdentitiesContractKeys = function getIdentitiesContractKeys(request, callback) { + return this.rpcCall(getIdentitiesContractKeys, $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest, $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse, request, callback); + }, "name", { value: "getIdentitiesContractKeys" }); /** - * Calls getIdentityKeys. - * @function getIdentityKeys + * Calls getIdentitiesContractKeys. + * @function getIdentitiesContractKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object - * @returns {Promise} Promise + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} request GetIdentitiesContractKeysRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityNonce}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getIdentityNonceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse} [response] GetIdentityNonceResponse + */ + + /** + * Calls getIdentityNonce. + * @function getIdentityNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} request GetIdentityNonceRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentityNonceCallback} callback Node-style callback called with the error, if any, and GetIdentityNonceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getIdentityNonce = function getIdentityNonce(request, callback) { + return this.rpcCall(getIdentityNonce, $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest, $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse, request, callback); + }, "name", { value: "getIdentityNonce" }); + + /** + * Calls getIdentityNonce. + * @function getIdentityNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} request GetIdentityNonceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityContractNonce}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getIdentityContractNonceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} [response] GetIdentityContractNonceResponse + */ + + /** + * Calls getIdentityContractNonce. + * @function getIdentityContractNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} request GetIdentityContractNonceRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentityContractNonceCallback} callback Node-style callback called with the error, if any, and GetIdentityContractNonceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getIdentityContractNonce = function getIdentityContractNonce(request, callback) { + return this.rpcCall(getIdentityContractNonce, $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest, $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse, request, callback); + }, "name", { value: "getIdentityContractNonce" }); + + /** + * Calls getIdentityContractNonce. + * @function getIdentityContractNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} request GetIdentityContractNonceRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ @@ -449,39 +515,6 @@ $root.org = (function() { * @variation 2 */ - /** - * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentitiesByPublicKeyHashes}. - * @memberof org.dash.platform.dapi.v0.Platform - * @typedef getIdentitiesByPublicKeyHashesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} [response] GetIdentitiesByPublicKeyHashesResponse - */ - - /** - * Calls getIdentitiesByPublicKeyHashes. - * @function getIdentitiesByPublicKeyHashes - * @memberof org.dash.platform.dapi.v0.Platform - * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} request GetIdentitiesByPublicKeyHashesRequest message or plain object - * @param {org.dash.platform.dapi.v0.Platform.getIdentitiesByPublicKeyHashesCallback} callback Node-style callback called with the error, if any, and GetIdentitiesByPublicKeyHashesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Platform.prototype.getIdentitiesByPublicKeyHashes = function getIdentitiesByPublicKeyHashes(request, callback) { - return this.rpcCall(getIdentitiesByPublicKeyHashes, $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest, $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse, request, callback); - }, "name", { value: "getIdentitiesByPublicKeyHashes" }); - - /** - * Calls getIdentitiesByPublicKeyHashes. - * @function getIdentitiesByPublicKeyHashes - * @memberof org.dash.platform.dapi.v0.Platform - * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} request GetIdentitiesByPublicKeyHashesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - /** * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityByPublicKeyHash}. * @memberof org.dash.platform.dapi.v0.Platform @@ -680,6 +713,270 @@ $root.org = (function() { * @variation 2 */ + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getContestedResources}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getContestedResourcesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse} [response] GetContestedResourcesResponse + */ + + /** + * Calls getContestedResources. + * @function getContestedResources + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesRequest} request GetContestedResourcesRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getContestedResourcesCallback} callback Node-style callback called with the error, if any, and GetContestedResourcesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getContestedResources = function getContestedResources(request, callback) { + return this.rpcCall(getContestedResources, $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest, $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse, request, callback); + }, "name", { value: "getContestedResources" }); + + /** + * Calls getContestedResources. + * @function getContestedResources + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesRequest} request GetContestedResourcesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getContestedResourceVoteState}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getContestedResourceVoteStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} [response] GetContestedResourceVoteStateResponse + */ + + /** + * Calls getContestedResourceVoteState. + * @function getContestedResourceVoteState + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateRequest} request GetContestedResourceVoteStateRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getContestedResourceVoteStateCallback} callback Node-style callback called with the error, if any, and GetContestedResourceVoteStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getContestedResourceVoteState = function getContestedResourceVoteState(request, callback) { + return this.rpcCall(getContestedResourceVoteState, $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest, $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse, request, callback); + }, "name", { value: "getContestedResourceVoteState" }); + + /** + * Calls getContestedResourceVoteState. + * @function getContestedResourceVoteState + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateRequest} request GetContestedResourceVoteStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getContestedResourceVotersForIdentity}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getContestedResourceVotersForIdentityCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} [response] GetContestedResourceVotersForIdentityResponse + */ + + /** + * Calls getContestedResourceVotersForIdentity. + * @function getContestedResourceVotersForIdentity + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityRequest} request GetContestedResourceVotersForIdentityRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getContestedResourceVotersForIdentityCallback} callback Node-style callback called with the error, if any, and GetContestedResourceVotersForIdentityResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getContestedResourceVotersForIdentity = function getContestedResourceVotersForIdentity(request, callback) { + return this.rpcCall(getContestedResourceVotersForIdentity, $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest, $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse, request, callback); + }, "name", { value: "getContestedResourceVotersForIdentity" }); + + /** + * Calls getContestedResourceVotersForIdentity. + * @function getContestedResourceVotersForIdentity + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityRequest} request GetContestedResourceVotersForIdentityRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getContestedResourceIdentityVotes}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getContestedResourceIdentityVotesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} [response] GetContestedResourceIdentityVotesResponse + */ + + /** + * Calls getContestedResourceIdentityVotes. + * @function getContestedResourceIdentityVotes + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesRequest} request GetContestedResourceIdentityVotesRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getContestedResourceIdentityVotesCallback} callback Node-style callback called with the error, if any, and GetContestedResourceIdentityVotesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getContestedResourceIdentityVotes = function getContestedResourceIdentityVotes(request, callback) { + return this.rpcCall(getContestedResourceIdentityVotes, $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest, $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse, request, callback); + }, "name", { value: "getContestedResourceIdentityVotes" }); + + /** + * Calls getContestedResourceIdentityVotes. + * @function getContestedResourceIdentityVotes + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesRequest} request GetContestedResourceIdentityVotesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getVotePollsByEndDate}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getVotePollsByEndDateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} [response] GetVotePollsByEndDateResponse + */ + + /** + * Calls getVotePollsByEndDate. + * @function getVotePollsByEndDate + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateRequest} request GetVotePollsByEndDateRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getVotePollsByEndDateCallback} callback Node-style callback called with the error, if any, and GetVotePollsByEndDateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getVotePollsByEndDate = function getVotePollsByEndDate(request, callback) { + return this.rpcCall(getVotePollsByEndDate, $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest, $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse, request, callback); + }, "name", { value: "getVotePollsByEndDate" }); + + /** + * Calls getVotePollsByEndDate. + * @function getVotePollsByEndDate + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateRequest} request GetVotePollsByEndDateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getPrefundedSpecializedBalance}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getPrefundedSpecializedBalanceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} [response] GetPrefundedSpecializedBalanceResponse + */ + + /** + * Calls getPrefundedSpecializedBalance. + * @function getPrefundedSpecializedBalance + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceRequest} request GetPrefundedSpecializedBalanceRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getPrefundedSpecializedBalanceCallback} callback Node-style callback called with the error, if any, and GetPrefundedSpecializedBalanceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getPrefundedSpecializedBalance = function getPrefundedSpecializedBalance(request, callback) { + return this.rpcCall(getPrefundedSpecializedBalance, $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest, $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse, request, callback); + }, "name", { value: "getPrefundedSpecializedBalance" }); + + /** + * Calls getPrefundedSpecializedBalance. + * @function getPrefundedSpecializedBalance + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceRequest} request GetPrefundedSpecializedBalanceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getTotalCreditsInPlatform}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getTotalCreditsInPlatformCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} [response] GetTotalCreditsInPlatformResponse + */ + + /** + * Calls getTotalCreditsInPlatform. + * @function getTotalCreditsInPlatform + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformRequest} request GetTotalCreditsInPlatformRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getTotalCreditsInPlatformCallback} callback Node-style callback called with the error, if any, and GetTotalCreditsInPlatformResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getTotalCreditsInPlatform = function getTotalCreditsInPlatform(request, callback) { + return this.rpcCall(getTotalCreditsInPlatform, $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest, $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse, request, callback); + }, "name", { value: "getTotalCreditsInPlatform" }); + + /** + * Calls getTotalCreditsInPlatform. + * @function getTotalCreditsInPlatform + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformRequest} request GetTotalCreditsInPlatformRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getPathElements}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getPathElementsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse} [response] GetPathElementsResponse + */ + + /** + * Calls getPathElements. + * @function getPathElements + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} request GetPathElementsRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getPathElementsCallback} callback Node-style callback called with the error, if any, and GetPathElementsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getPathElements = function getPathElements(request, callback) { + return this.rpcCall(getPathElements, $root.org.dash.platform.dapi.v0.GetPathElementsRequest, $root.org.dash.platform.dapi.v0.GetPathElementsResponse, request, callback); + }, "name", { value: "getPathElements" }); + + /** + * Calls getPathElements. + * @function getPathElements + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} request GetPathElementsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return Platform; })(); @@ -1584,6 +1881,26 @@ $root.org = (function() { return StateTransitionBroadcastError; })(); + /** + * KeyPurpose enum. + * @name org.dash.platform.dapi.v0.KeyPurpose + * @enum {number} + * @property {number} AUTHENTICATION=0 AUTHENTICATION value + * @property {number} ENCRYPTION=1 ENCRYPTION value + * @property {number} DECRYPTION=2 DECRYPTION value + * @property {number} TRANSFER=3 TRANSFER value + * @property {number} VOTING=5 VOTING value + */ + v0.KeyPurpose = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTHENTICATION"] = 0; + values[valuesById[1] = "ENCRYPTION"] = 1; + values[valuesById[2] = "DECRYPTION"] = 2; + values[valuesById[3] = "TRANSFER"] = 3; + values[valuesById[5] = "VOTING"] = 5; + return values; + })(); + v0.BroadcastStateTransitionRequest = (function() { /** @@ -2370,24 +2687,24 @@ $root.org = (function() { return GetIdentityRequest; })(); - v0.GetIdentityBalanceRequest = (function() { + v0.GetIdentityNonceRequest = (function() { /** - * Properties of a GetIdentityBalanceRequest. + * Properties of a GetIdentityNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityBalanceRequest - * @property {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null} [v0] GetIdentityBalanceRequest v0 + * @interface IGetIdentityNonceRequest + * @property {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0|null} [v0] GetIdentityNonceRequest v0 */ /** - * Constructs a new GetIdentityBalanceRequest. + * Constructs a new GetIdentityNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityBalanceRequest. - * @implements IGetIdentityBalanceRequest + * @classdesc Represents a GetIdentityNonceRequest. + * @implements IGetIdentityNonceRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest=} [properties] Properties to set */ - function GetIdentityBalanceRequest(properties) { + function GetIdentityNonceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2395,89 +2712,89 @@ $root.org = (function() { } /** - * GetIdentityBalanceRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * GetIdentityNonceRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @instance */ - GetIdentityBalanceRequest.prototype.v0 = null; + GetIdentityNonceRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceRequest version. + * GetIdentityNonceRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @instance */ - Object.defineProperty(GetIdentityBalanceRequest.prototype, "version", { + Object.defineProperty(GetIdentityNonceRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceRequest instance using the specified properties. + * Creates a new GetIdentityNonceRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest instance */ - GetIdentityBalanceRequest.create = function create(properties) { - return new GetIdentityBalanceRequest(properties); + GetIdentityNonceRequest.create = function create(properties) { + return new GetIdentityNonceRequest(properties); }; /** - * Encodes the specified GetIdentityBalanceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} message GetIdentityNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequest.encode = function encode(message, writer) { + GetIdentityNonceRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityBalanceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} message GetIdentityNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityNonceRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer. + * Decodes a GetIdentityNonceRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequest.decode = function decode(reader, length) { + GetIdentityNonceRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2488,37 +2805,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityNonceRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentityNonceRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceRequest message. + * Verifies a GetIdentityNonceRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceRequest.verify = function verify(message) { + GetIdentityNonceRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -2527,40 +2844,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityNonceRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest */ - GetIdentityBalanceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest) + GetIdentityNonceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityNonceRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message GetIdentityBalanceRequest + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest} message GetIdentityNonceRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceRequest.toObject = function toObject(message, options) { + GetIdentityNonceRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -2568,35 +2885,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceRequest to JSON. + * Converts this GetIdentityNonceRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceRequest.prototype.toJSON = function toJSON() { + GetIdentityNonceRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = (function() { + GetIdentityNonceRequest.GetIdentityNonceRequestV0 = (function() { /** - * Properties of a GetIdentityBalanceRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest - * @interface IGetIdentityBalanceRequestV0 - * @property {Uint8Array|null} [id] GetIdentityBalanceRequestV0 id - * @property {boolean|null} [prove] GetIdentityBalanceRequestV0 prove + * Properties of a GetIdentityNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest + * @interface IGetIdentityNonceRequestV0 + * @property {Uint8Array|null} [identityId] GetIdentityNonceRequestV0 identityId + * @property {boolean|null} [prove] GetIdentityNonceRequestV0 prove */ /** - * Constructs a new GetIdentityBalanceRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest - * @classdesc Represents a GetIdentityBalanceRequestV0. - * @implements IGetIdentityBalanceRequestV0 + * Constructs a new GetIdentityNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest + * @classdesc Represents a GetIdentityNonceRequestV0. + * @implements IGetIdentityNonceRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0=} [properties] Properties to set */ - function GetIdentityBalanceRequestV0(properties) { + function GetIdentityNonceRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2604,85 +2921,85 @@ $root.org = (function() { } /** - * GetIdentityBalanceRequestV0 id. - * @member {Uint8Array} id - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * GetIdentityNonceRequestV0 identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @instance */ - GetIdentityBalanceRequestV0.prototype.id = $util.newBuffer([]); + GetIdentityNonceRequestV0.prototype.identityId = $util.newBuffer([]); /** - * GetIdentityBalanceRequestV0 prove. + * GetIdentityNonceRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @instance */ - GetIdentityBalanceRequestV0.prototype.prove = false; + GetIdentityNonceRequestV0.prototype.prove = false; /** - * Creates a new GetIdentityBalanceRequestV0 instance using the specified properties. + * Creates a new GetIdentityNonceRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 instance */ - GetIdentityBalanceRequestV0.create = function create(properties) { - return new GetIdentityBalanceRequestV0(properties); + GetIdentityNonceRequestV0.create = function create(properties) { + return new GetIdentityNonceRequestV0(properties); }; /** - * Encodes the specified GetIdentityBalanceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0} message GetIdentityNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequestV0.encode = function encode(message, writer) { + GetIdentityNonceRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentityBalanceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0} message GetIdentityNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityNonceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentityNonceRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequestV0.decode = function decode(reader, length) { + GetIdentityNonceRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.bytes(); + message.identityId = reader.bytes(); break; case 2: message.prove = reader.bool(); @@ -2696,35 +3013,35 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityNonceRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityNonceRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceRequestV0 message. + * Verifies a GetIdentityNonceRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceRequestV0.verify = function verify(message) { + GetIdentityNonceRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) - return "id: buffer expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -2732,92 +3049,92 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityNonceRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 */ - GetIdentityBalanceRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0) + GetIdentityNonceRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); - if (object.id != null) - if (typeof object.id === "string") - $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); - else if (object.id.length >= 0) - message.id = object.id; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityBalanceRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityNonceRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} message GetIdentityNonceRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceRequestV0.toObject = function toObject(message, options) { + GetIdentityNonceRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) - object.id = ""; + object.identityId = ""; else { - object.id = []; + object.identityId = []; if (options.bytes !== Array) - object.id = $util.newBuffer(object.id); + object.identityId = $util.newBuffer(object.identityId); } object.prove = false; } - if (message.id != null && message.hasOwnProperty("id")) - object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetIdentityBalanceRequestV0 to JSON. + * Converts this GetIdentityNonceRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceRequestV0.prototype.toJSON = function toJSON() { + GetIdentityNonceRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityBalanceRequestV0; + return GetIdentityNonceRequestV0; })(); - return GetIdentityBalanceRequest; + return GetIdentityNonceRequest; })(); - v0.GetIdentityBalanceAndRevisionRequest = (function() { + v0.GetIdentityContractNonceRequest = (function() { /** - * Properties of a GetIdentityBalanceAndRevisionRequest. + * Properties of a GetIdentityContractNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityBalanceAndRevisionRequest - * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null} [v0] GetIdentityBalanceAndRevisionRequest v0 + * @interface IGetIdentityContractNonceRequest + * @property {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0|null} [v0] GetIdentityContractNonceRequest v0 */ /** - * Constructs a new GetIdentityBalanceAndRevisionRequest. + * Constructs a new GetIdentityContractNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityBalanceAndRevisionRequest. - * @implements IGetIdentityBalanceAndRevisionRequest + * @classdesc Represents a GetIdentityContractNonceRequest. + * @implements IGetIdentityContractNonceRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest=} [properties] Properties to set */ - function GetIdentityBalanceAndRevisionRequest(properties) { + function GetIdentityContractNonceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2825,89 +3142,89 @@ $root.org = (function() { } /** - * GetIdentityBalanceAndRevisionRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * GetIdentityContractNonceRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @instance */ - GetIdentityBalanceAndRevisionRequest.prototype.v0 = null; + GetIdentityContractNonceRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceAndRevisionRequest version. + * GetIdentityContractNonceRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @instance */ - Object.defineProperty(GetIdentityBalanceAndRevisionRequest.prototype, "version", { + Object.defineProperty(GetIdentityContractNonceRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceAndRevisionRequest instance using the specified properties. + * Creates a new GetIdentityContractNonceRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest instance */ - GetIdentityBalanceAndRevisionRequest.create = function create(properties) { - return new GetIdentityBalanceAndRevisionRequest(properties); + GetIdentityContractNonceRequest.create = function create(properties) { + return new GetIdentityContractNonceRequest(properties); }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} message GetIdentityContractNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequest.encode = function encode(message, writer) { + GetIdentityContractNonceRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} message GetIdentityContractNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityContractNonceRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer. + * Decodes a GetIdentityContractNonceRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequest.decode = function decode(reader, length) { + GetIdentityContractNonceRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2918,37 +3235,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityContractNonceRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentityContractNonceRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceAndRevisionRequest message. + * Verifies a GetIdentityContractNonceRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceAndRevisionRequest.verify = function verify(message) { + GetIdentityContractNonceRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -2957,40 +3274,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceAndRevisionRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityContractNonceRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest */ - GetIdentityBalanceAndRevisionRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest) + GetIdentityContractNonceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceAndRevisionRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityContractNonceRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} message GetIdentityContractNonceRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceAndRevisionRequest.toObject = function toObject(message, options) { + GetIdentityContractNonceRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -2998,35 +3315,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceAndRevisionRequest to JSON. + * Converts this GetIdentityContractNonceRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceAndRevisionRequest.prototype.toJSON = function toJSON() { + GetIdentityContractNonceRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = (function() { + GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 = (function() { /** - * Properties of a GetIdentityBalanceAndRevisionRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest - * @interface IGetIdentityBalanceAndRevisionRequestV0 - * @property {Uint8Array|null} [id] GetIdentityBalanceAndRevisionRequestV0 id - * @property {boolean|null} [prove] GetIdentityBalanceAndRevisionRequestV0 prove + * Properties of a GetIdentityContractNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest + * @interface IGetIdentityContractNonceRequestV0 + * @property {Uint8Array|null} [identityId] GetIdentityContractNonceRequestV0 identityId + * @property {Uint8Array|null} [contractId] GetIdentityContractNonceRequestV0 contractId + * @property {boolean|null} [prove] GetIdentityContractNonceRequestV0 prove */ /** - * Constructs a new GetIdentityBalanceAndRevisionRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest - * @classdesc Represents a GetIdentityBalanceAndRevisionRequestV0. - * @implements IGetIdentityBalanceAndRevisionRequestV0 + * Constructs a new GetIdentityContractNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest + * @classdesc Represents a GetIdentityContractNonceRequestV0. + * @implements IGetIdentityContractNonceRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0=} [properties] Properties to set */ - function GetIdentityBalanceAndRevisionRequestV0(properties) { + function GetIdentityContractNonceRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3034,87 +3352,100 @@ $root.org = (function() { } /** - * GetIdentityBalanceAndRevisionRequestV0 id. - * @member {Uint8Array} id - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * GetIdentityContractNonceRequestV0 identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @instance */ - GetIdentityBalanceAndRevisionRequestV0.prototype.id = $util.newBuffer([]); + GetIdentityContractNonceRequestV0.prototype.identityId = $util.newBuffer([]); /** - * GetIdentityBalanceAndRevisionRequestV0 prove. + * GetIdentityContractNonceRequestV0 contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 + * @instance + */ + GetIdentityContractNonceRequestV0.prototype.contractId = $util.newBuffer([]); + + /** + * GetIdentityContractNonceRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @instance */ - GetIdentityBalanceAndRevisionRequestV0.prototype.prove = false; + GetIdentityContractNonceRequestV0.prototype.prove = false; /** - * Creates a new GetIdentityBalanceAndRevisionRequestV0 instance using the specified properties. + * Creates a new GetIdentityContractNonceRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 instance */ - GetIdentityBalanceAndRevisionRequestV0.create = function create(properties) { - return new GetIdentityBalanceAndRevisionRequestV0(properties); + GetIdentityContractNonceRequestV0.create = function create(properties) { + return new GetIdentityContractNonceRequestV0(properties); }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0} message GetIdentityContractNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequestV0.encode = function encode(message, writer) { + GetIdentityContractNonceRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.contractId); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0} message GetIdentityContractNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityContractNonceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentityContractNonceRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequestV0.decode = function decode(reader, length) { + GetIdentityContractNonceRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.bytes(); + message.identityId = reader.bytes(); break; case 2: + message.contractId = reader.bytes(); + break; + case 3: message.prove = reader.bool(); break; default: @@ -3126,35 +3457,38 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityContractNonceRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityContractNonceRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceAndRevisionRequestV0 message. + * Verifies a GetIdentityContractNonceRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceAndRevisionRequestV0.verify = function verify(message) { + GetIdentityContractNonceRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) - return "id: buffer expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -3162,92 +3496,106 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceAndRevisionRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityContractNonceRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 */ - GetIdentityBalanceAndRevisionRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0) + GetIdentityContractNonceRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); - if (object.id != null) - if (typeof object.id === "string") - $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); - else if (object.id.length >= 0) - message.id = object.id; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityBalanceAndRevisionRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityContractNonceRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} message GetIdentityContractNonceRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceAndRevisionRequestV0.toObject = function toObject(message, options) { + GetIdentityContractNonceRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) - object.id = ""; + object.identityId = ""; else { - object.id = []; + object.identityId = []; if (options.bytes !== Array) - object.id = $util.newBuffer(object.id); + object.identityId = $util.newBuffer(object.identityId); + } + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); } object.prove = false; } - if (message.id != null && message.hasOwnProperty("id")) - object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetIdentityBalanceAndRevisionRequestV0 to JSON. + * Converts this GetIdentityContractNonceRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceAndRevisionRequestV0.prototype.toJSON = function toJSON() { + GetIdentityContractNonceRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityBalanceAndRevisionRequestV0; + return GetIdentityContractNonceRequestV0; })(); - return GetIdentityBalanceAndRevisionRequest; + return GetIdentityContractNonceRequest; })(); - v0.GetIdentityResponse = (function() { + v0.GetIdentityBalanceRequest = (function() { /** - * Properties of a GetIdentityResponse. + * Properties of a GetIdentityBalanceRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityResponse - * @property {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null} [v0] GetIdentityResponse v0 + * @interface IGetIdentityBalanceRequest + * @property {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null} [v0] GetIdentityBalanceRequest v0 */ /** - * Constructs a new GetIdentityResponse. + * Constructs a new GetIdentityBalanceRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityResponse. - * @implements IGetIdentityResponse + * @classdesc Represents a GetIdentityBalanceRequest. + * @implements IGetIdentityBalanceRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set */ - function GetIdentityResponse(properties) { + function GetIdentityBalanceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3255,89 +3603,89 @@ $root.org = (function() { } /** - * GetIdentityResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * GetIdentityBalanceRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @instance */ - GetIdentityResponse.prototype.v0 = null; + GetIdentityBalanceRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityResponse version. + * GetIdentityBalanceRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @instance */ - Object.defineProperty(GetIdentityResponse.prototype, "version", { + Object.defineProperty(GetIdentityBalanceRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityResponse instance using the specified properties. + * Creates a new GetIdentityBalanceRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse instance + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest instance */ - GetIdentityResponse.create = function create(properties) { - return new GetIdentityResponse(properties); + GetIdentityBalanceRequest.create = function create(properties) { + return new GetIdentityBalanceRequest(properties); }; /** - * Encodes the specified GetIdentityResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponse.encode = function encode(message, writer) { + GetIdentityBalanceRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityResponse message from the specified reader or buffer. + * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponse.decode = function decode(reader, length) { + GetIdentityBalanceRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -3348,37 +3696,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityResponse message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponse.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityResponse message. + * Verifies a GetIdentityBalanceRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityResponse.verify = function verify(message) { + GetIdentityBalanceRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -3387,40 +3735,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest */ - GetIdentityResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse) + GetIdentityBalanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse} message GetIdentityResponse + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message GetIdentityBalanceRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityResponse.toObject = function toObject(message, options) { + GetIdentityBalanceRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -3428,36 +3776,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentityResponse to JSON. + * Converts this GetIdentityBalanceRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @instance * @returns {Object.} JSON object */ - GetIdentityResponse.prototype.toJSON = function toJSON() { + GetIdentityBalanceRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityResponse.GetIdentityResponseV0 = (function() { + GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = (function() { /** - * Properties of a GetIdentityResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse - * @interface IGetIdentityResponseV0 - * @property {Uint8Array|null} [identity] GetIdentityResponseV0 identity - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityResponseV0 metadata + * Properties of a GetIdentityBalanceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @interface IGetIdentityBalanceRequestV0 + * @property {Uint8Array|null} [id] GetIdentityBalanceRequestV0 id + * @property {boolean|null} [prove] GetIdentityBalanceRequestV0 prove */ /** - * Constructs a new GetIdentityResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse - * @classdesc Represents a GetIdentityResponseV0. - * @implements IGetIdentityResponseV0 + * Constructs a new GetIdentityBalanceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @classdesc Represents a GetIdentityBalanceRequestV0. + * @implements IGetIdentityBalanceRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set */ - function GetIdentityResponseV0(properties) { + function GetIdentityBalanceRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3465,115 +3812,88 @@ $root.org = (function() { } /** - * GetIdentityResponseV0 identity. - * @member {Uint8Array} identity - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 - * @instance - */ - GetIdentityResponseV0.prototype.identity = $util.newBuffer([]); - - /** - * GetIdentityResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 - * @instance - */ - GetIdentityResponseV0.prototype.proof = null; - - /** - * GetIdentityResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * GetIdentityBalanceRequestV0 id. + * @member {Uint8Array} id + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @instance */ - GetIdentityResponseV0.prototype.metadata = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + GetIdentityBalanceRequestV0.prototype.id = $util.newBuffer([]); /** - * GetIdentityResponseV0 result. - * @member {"identity"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * GetIdentityBalanceRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @instance */ - Object.defineProperty(GetIdentityResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetIdentityBalanceRequestV0.prototype.prove = false; /** - * Creates a new GetIdentityResponseV0 instance using the specified properties. + * Creates a new GetIdentityBalanceRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 instance */ - GetIdentityResponseV0.create = function create(properties) { - return new GetIdentityResponseV0(properties); + GetIdentityBalanceRequestV0.create = function create(properties) { + return new GetIdentityBalanceRequestV0(properties); }; /** - * Encodes the specified GetIdentityResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponseV0.encode = function encode(message, writer) { + GetIdentityBalanceRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentityResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityResponseV0 message from the specified reader or buffer. + * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponseV0.decode = function decode(reader, length) { + GetIdentityBalanceRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identity = reader.bytes(); + message.id = reader.bytes(); break; case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -3584,151 +3904,128 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityResponseV0 message. + * Verifies a GetIdentityBalanceRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityResponseV0.verify = function verify(message) { + GetIdentityBalanceRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.identity != null && message.hasOwnProperty("identity")) { - properties.result = 1; - if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) - return "identity: buffer expected"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetIdentityResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 */ - GetIdentityResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0) + GetIdentityBalanceRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); - if (object.identity != null) - if (typeof object.identity === "string") - $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); - else if (object.identity.length >= 0) - message.identity = object.identity; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length >= 0) + message.id = object.id; + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message GetIdentityResponseV0 + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityResponseV0.toObject = function toObject(message, options) { + GetIdentityBalanceRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.metadata = null; - if (message.identity != null && message.hasOwnProperty("identity")) { - object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; - if (options.oneofs) - object.result = "identity"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; + if (options.defaults) { + if (options.bytes === String) + object.id = ""; + else { + object.id = []; + if (options.bytes !== Array) + object.id = $util.newBuffer(object.id); + } + object.prove = false; } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetIdentityResponseV0 to JSON. + * Converts this GetIdentityBalanceRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentityResponseV0.prototype.toJSON = function toJSON() { + GetIdentityBalanceRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityResponseV0; + return GetIdentityBalanceRequestV0; })(); - return GetIdentityResponse; + return GetIdentityBalanceRequest; })(); - v0.GetIdentitiesRequest = (function() { + v0.GetIdentityBalanceAndRevisionRequest = (function() { /** - * Properties of a GetIdentitiesRequest. + * Properties of a GetIdentityBalanceAndRevisionRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesRequest - * @property {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0|null} [v0] GetIdentitiesRequest v0 + * @interface IGetIdentityBalanceAndRevisionRequest + * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null} [v0] GetIdentityBalanceAndRevisionRequest v0 */ /** - * Constructs a new GetIdentitiesRequest. + * Constructs a new GetIdentityBalanceAndRevisionRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesRequest. - * @implements IGetIdentitiesRequest + * @classdesc Represents a GetIdentityBalanceAndRevisionRequest. + * @implements IGetIdentityBalanceAndRevisionRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set */ - function GetIdentitiesRequest(properties) { + function GetIdentityBalanceAndRevisionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3736,89 +4033,89 @@ $root.org = (function() { } /** - * GetIdentitiesRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * GetIdentityBalanceAndRevisionRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @instance */ - GetIdentitiesRequest.prototype.v0 = null; + GetIdentityBalanceAndRevisionRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesRequest version. + * GetIdentityBalanceAndRevisionRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @instance */ - Object.defineProperty(GetIdentitiesRequest.prototype, "version", { + Object.defineProperty(GetIdentityBalanceAndRevisionRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesRequest instance using the specified properties. + * Creates a new GetIdentityBalanceAndRevisionRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest instance */ - GetIdentitiesRequest.create = function create(properties) { - return new GetIdentitiesRequest(properties); + GetIdentityBalanceAndRevisionRequest.create = function create(properties) { + return new GetIdentityBalanceAndRevisionRequest(properties); }; /** - * Encodes the specified GetIdentitiesRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} message GetIdentitiesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequest.encode = function encode(message, writer) { + GetIdentityBalanceAndRevisionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} message GetIdentitiesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceAndRevisionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesRequest message from the specified reader or buffer. + * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequest.decode = function decode(reader, length) { + GetIdentityBalanceAndRevisionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -3829,37 +4126,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceAndRevisionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesRequest message. + * Verifies a GetIdentityBalanceAndRevisionRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesRequest.verify = function verify(message) { + GetIdentityBalanceAndRevisionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -3868,40 +4165,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceAndRevisionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest */ - GetIdentitiesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesRequest) + GetIdentityBalanceAndRevisionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceAndRevisionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest} message GetIdentitiesRequest + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesRequest.toObject = function toObject(message, options) { + GetIdentityBalanceAndRevisionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -3909,36 +4206,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesRequest to JSON. + * Converts this GetIdentityBalanceAndRevisionRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @instance * @returns {Object.} JSON object */ - GetIdentitiesRequest.prototype.toJSON = function toJSON() { + GetIdentityBalanceAndRevisionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesRequest.GetIdentitiesRequestV0 = (function() { + GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = (function() { /** - * Properties of a GetIdentitiesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest - * @interface IGetIdentitiesRequestV0 - * @property {Array.|null} [ids] GetIdentitiesRequestV0 ids - * @property {boolean|null} [prove] GetIdentitiesRequestV0 prove + * Properties of a GetIdentityBalanceAndRevisionRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @interface IGetIdentityBalanceAndRevisionRequestV0 + * @property {Uint8Array|null} [id] GetIdentityBalanceAndRevisionRequestV0 id + * @property {boolean|null} [prove] GetIdentityBalanceAndRevisionRequestV0 prove */ /** - * Constructs a new GetIdentitiesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest - * @classdesc Represents a GetIdentitiesRequestV0. - * @implements IGetIdentitiesRequestV0 + * Constructs a new GetIdentityBalanceAndRevisionRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @classdesc Represents a GetIdentityBalanceAndRevisionRequestV0. + * @implements IGetIdentityBalanceAndRevisionRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set */ - function GetIdentitiesRequestV0(properties) { - this.ids = []; + function GetIdentityBalanceAndRevisionRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3946,88 +4242,85 @@ $root.org = (function() { } /** - * GetIdentitiesRequestV0 ids. - * @member {Array.} ids - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * GetIdentityBalanceAndRevisionRequestV0 id. + * @member {Uint8Array} id + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @instance */ - GetIdentitiesRequestV0.prototype.ids = $util.emptyArray; + GetIdentityBalanceAndRevisionRequestV0.prototype.id = $util.newBuffer([]); /** - * GetIdentitiesRequestV0 prove. + * GetIdentityBalanceAndRevisionRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @instance */ - GetIdentitiesRequestV0.prototype.prove = false; + GetIdentityBalanceAndRevisionRequestV0.prototype.prove = false; /** - * Creates a new GetIdentitiesRequestV0 instance using the specified properties. + * Creates a new GetIdentityBalanceAndRevisionRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 instance */ - GetIdentitiesRequestV0.create = function create(properties) { - return new GetIdentitiesRequestV0(properties); + GetIdentityBalanceAndRevisionRequestV0.create = function create(properties) { + return new GetIdentityBalanceAndRevisionRequestV0(properties); }; /** - * Encodes the specified GetIdentitiesRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0} message GetIdentitiesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequestV0.encode = function encode(message, writer) { + GetIdentityBalanceAndRevisionRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ids != null && message.ids.length) - for (var i = 0; i < message.ids.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ids[i]); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentitiesRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0} message GetIdentitiesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceAndRevisionRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequestV0.decode = function decode(reader, length) { + GetIdentityBalanceAndRevisionRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.ids && message.ids.length)) - message.ids = []; - message.ids.push(reader.bytes()); + message.id = reader.bytes(); break; case 2: message.prove = reader.bool(); @@ -4041,39 +4334,35 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceAndRevisionRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesRequestV0 message. + * Verifies a GetIdentityBalanceAndRevisionRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesRequestV0.verify = function verify(message) { + GetIdentityBalanceAndRevisionRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ids != null && message.hasOwnProperty("ids")) { - if (!Array.isArray(message.ids)) - return "ids: array expected"; - for (var i = 0; i < message.ids.length; ++i) - if (!(message.ids[i] && typeof message.ids[i].length === "number" || $util.isString(message.ids[i]))) - return "ids: buffer[] expected"; - } + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -4081,94 +4370,92 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceAndRevisionRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 */ - GetIdentitiesRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0) + GetIdentityBalanceAndRevisionRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0(); - if (object.ids) { - if (!Array.isArray(object.ids)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.ids: array expected"); - message.ids = []; - for (var i = 0; i < object.ids.length; ++i) - if (typeof object.ids[i] === "string") - $util.base64.decode(object.ids[i], message.ids[i] = $util.newBuffer($util.base64.length(object.ids[i])), 0); - else if (object.ids[i].length >= 0) - message.ids[i] = object.ids[i]; - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length >= 0) + message.id = object.id; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentitiesRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceAndRevisionRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} message GetIdentitiesRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesRequestV0.toObject = function toObject(message, options) { + GetIdentityBalanceAndRevisionRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.ids = []; - if (options.defaults) + if (options.defaults) { + if (options.bytes === String) + object.id = ""; + else { + object.id = []; + if (options.bytes !== Array) + object.id = $util.newBuffer(object.id); + } object.prove = false; - if (message.ids && message.ids.length) { - object.ids = []; - for (var j = 0; j < message.ids.length; ++j) - object.ids[j] = options.bytes === String ? $util.base64.encode(message.ids[j], 0, message.ids[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.ids[j]) : message.ids[j]; } + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetIdentitiesRequestV0 to JSON. + * Converts this GetIdentityBalanceAndRevisionRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentitiesRequestV0.prototype.toJSON = function toJSON() { + GetIdentityBalanceAndRevisionRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentitiesRequestV0; + return GetIdentityBalanceAndRevisionRequestV0; })(); - return GetIdentitiesRequest; + return GetIdentityBalanceAndRevisionRequest; })(); - v0.GetIdentitiesResponse = (function() { + v0.GetIdentityResponse = (function() { /** - * Properties of a GetIdentitiesResponse. + * Properties of a GetIdentityResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesResponse - * @property {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0|null} [v0] GetIdentitiesResponse v0 + * @interface IGetIdentityResponse + * @property {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null} [v0] GetIdentityResponse v0 */ /** - * Constructs a new GetIdentitiesResponse. + * Constructs a new GetIdentityResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesResponse. - * @implements IGetIdentitiesResponse + * @classdesc Represents a GetIdentityResponse. + * @implements IGetIdentityResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set */ - function GetIdentitiesResponse(properties) { + function GetIdentityResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4176,89 +4463,89 @@ $root.org = (function() { } /** - * GetIdentitiesResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * GetIdentityResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @instance */ - GetIdentitiesResponse.prototype.v0 = null; + GetIdentityResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesResponse version. + * GetIdentityResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @instance */ - Object.defineProperty(GetIdentitiesResponse.prototype, "version", { + Object.defineProperty(GetIdentityResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesResponse instance using the specified properties. + * Creates a new GetIdentityResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse instance + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse instance */ - GetIdentitiesResponse.create = function create(properties) { - return new GetIdentitiesResponse(properties); + GetIdentityResponse.create = function create(properties) { + return new GetIdentityResponse(properties); }; /** - * Encodes the specified GetIdentitiesResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.verify|verify} messages. + * Encodes the specified GetIdentityResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse} message GetIdentitiesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponse.encode = function encode(message, writer) { + GetIdentityResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.verify|verify} messages. + * Encodes the specified GetIdentityResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse} message GetIdentitiesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesResponse message from the specified reader or buffer. + * Decodes a GetIdentityResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponse.decode = function decode(reader, length) { + GetIdentityResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -4269,37 +4556,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesResponse message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponse.decodeDelimited = function decodeDelimited(reader) { + GetIdentityResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesResponse message. + * Verifies a GetIdentityResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesResponse.verify = function verify(message) { + GetIdentityResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -4308,40 +4595,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse */ - GetIdentitiesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse) + GetIdentityResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse} message GetIdentitiesResponse + * @param {org.dash.platform.dapi.v0.GetIdentityResponse} message GetIdentityResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesResponse.toObject = function toObject(message, options) { + GetIdentityResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -4349,34 +4636,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesResponse to JSON. + * Converts this GetIdentityResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @instance * @returns {Object.} JSON object */ - GetIdentitiesResponse.prototype.toJSON = function toJSON() { + GetIdentityResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesResponse.IdentityValue = (function() { + GetIdentityResponse.GetIdentityResponseV0 = (function() { /** - * Properties of an IdentityValue. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IIdentityValue - * @property {Uint8Array|null} [value] IdentityValue value + * Properties of a GetIdentityResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @interface IGetIdentityResponseV0 + * @property {Uint8Array|null} [identity] GetIdentityResponseV0 identity + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityResponseV0 metadata */ /** - * Constructs a new IdentityValue. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents an IdentityValue. - * @implements IIdentityValue + * Constructs a new GetIdentityResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @classdesc Represents a GetIdentityResponseV0. + * @implements IGetIdentityResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set */ - function IdentityValue(properties) { + function GetIdentityResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4384,75 +4673,115 @@ $root.org = (function() { } /** - * IdentityValue value. - * @member {Uint8Array} value - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * GetIdentityResponseV0 identity. + * @member {Uint8Array} identity + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @instance + */ + GetIdentityResponseV0.prototype.identity = $util.newBuffer([]); + + /** + * GetIdentityResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @instance + */ + GetIdentityResponseV0.prototype.proof = null; + + /** + * GetIdentityResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @instance + */ + GetIdentityResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityResponseV0 result. + * @member {"identity"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @instance */ - IdentityValue.prototype.value = $util.newBuffer([]); + Object.defineProperty(GetIdentityResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new IdentityValue instance using the specified properties. + * Creates a new GetIdentityResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue instance + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 instance */ - IdentityValue.create = function create(properties) { - return new IdentityValue(properties); + GetIdentityResponseV0.create = function create(properties) { + return new GetIdentityResponseV0(properties); }; /** - * Encodes the specified IdentityValue message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.verify|verify} messages. + * Encodes the specified GetIdentityResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue} message IdentityValue message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentityValue.encode = function encode(message, writer) { + GetIdentityResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified IdentityValue message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.verify|verify} messages. + * Encodes the specified GetIdentityResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue} message IdentityValue message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentityValue.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an IdentityValue message from the specified reader or buffer. + * Decodes a GetIdentityResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityValue.decode = function decode(reader, length) { + GetIdentityResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.value = reader.bytes(); + message.identity = reader.bytes(); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -4463,117 +4792,361 @@ $root.org = (function() { }; /** - * Decodes an IdentityValue message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityValue.decodeDelimited = function decodeDelimited(reader) { + GetIdentityResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IdentityValue message. + * Verifies a GetIdentityResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IdentityValue.verify = function verify(message) { + GetIdentityResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; + var properties = {}; + if (message.identity != null && message.hasOwnProperty("identity")) { + properties.result = 1; + if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) + return "identity: buffer expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } return null; }; /** - * Creates an IdentityValue message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 */ - IdentityValue.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue) + GetIdentityResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue(); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length >= 0) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from an IdentityValue message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} message IdentityValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IdentityValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); + if (object.identity != null) + if (typeof object.identity === "string") + $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); + else if (object.identity.length >= 0) + message.identity = object.identity; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message GetIdentityResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.identity != null && message.hasOwnProperty("identity")) { + object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; + if (options.oneofs) + object.result = "identity"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this IdentityValue to JSON. + * Converts this GetIdentityResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @instance * @returns {Object.} JSON object */ - IdentityValue.prototype.toJSON = function toJSON() { + GetIdentityResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return IdentityValue; + return GetIdentityResponseV0; })(); - GetIdentitiesResponse.IdentityEntry = (function() { + return GetIdentityResponse; + })(); + + v0.GetIdentityNonceResponse = (function() { + + /** + * Properties of a GetIdentityNonceResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityNonceResponse + * @property {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0|null} [v0] GetIdentityNonceResponse v0 + */ + + /** + * Constructs a new GetIdentityNonceResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityNonceResponse. + * @implements IGetIdentityNonceResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse=} [properties] Properties to set + */ + function GetIdentityNonceResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityNonceResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @instance + */ + GetIdentityNonceResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityNonceResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @instance + */ + Object.defineProperty(GetIdentityNonceResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentityNonceResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse instance + */ + GetIdentityNonceResponse.create = function create(properties) { + return new GetIdentityNonceResponse(properties); + }; + + /** + * Encodes the specified GetIdentityNonceResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse} message GetIdentityNonceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityNonceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentityNonceResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse} message GetIdentityNonceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityNonceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityNonceResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityNonceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityNonceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityNonceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityNonceResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityNonceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetIdentityNonceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse + */ + GetIdentityNonceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityNonceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse} message GetIdentityNonceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityNonceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetIdentityNonceResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @instance + * @returns {Object.} JSON object + */ + GetIdentityNonceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetIdentityNonceResponse.GetIdentityNonceResponseV0 = (function() { /** - * Properties of an IdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IIdentityEntry - * @property {Uint8Array|null} [key] IdentityEntry key - * @property {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue|null} [value] IdentityEntry value + * Properties of a GetIdentityNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @interface IGetIdentityNonceResponseV0 + * @property {number|Long|null} [identityNonce] GetIdentityNonceResponseV0 identityNonce + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityNonceResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityNonceResponseV0 metadata */ /** - * Constructs a new IdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents an IdentityEntry. - * @implements IIdentityEntry + * Constructs a new GetIdentityNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @classdesc Represents a GetIdentityNonceResponseV0. + * @implements IGetIdentityNonceResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0=} [properties] Properties to set */ - function IdentityEntry(properties) { + function GetIdentityNonceResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4581,88 +5154,115 @@ $root.org = (function() { } /** - * IdentityEntry key. - * @member {Uint8Array} key - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * GetIdentityNonceResponseV0 identityNonce. + * @member {number|Long} identityNonce + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 + * @instance + */ + GetIdentityNonceResponseV0.prototype.identityNonce = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * GetIdentityNonceResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 + * @instance + */ + GetIdentityNonceResponseV0.prototype.proof = null; + + /** + * GetIdentityNonceResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance */ - IdentityEntry.prototype.key = $util.newBuffer([]); + GetIdentityNonceResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * IdentityEntry value. - * @member {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue|null|undefined} value - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * GetIdentityNonceResponseV0 result. + * @member {"identityNonce"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance */ - IdentityEntry.prototype.value = null; + Object.defineProperty(GetIdentityNonceResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identityNonce", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new IdentityEntry instance using the specified properties. + * Creates a new GetIdentityNonceResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry instance + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 instance */ - IdentityEntry.create = function create(properties) { - return new IdentityEntry(properties); + GetIdentityNonceResponseV0.create = function create(properties) { + return new GetIdentityNonceResponseV0(properties); }; /** - * Encodes the specified IdentityEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.verify|verify} messages. + * Encodes the specified GetIdentityNonceResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry} message IdentityEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0} message GetIdentityNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentityEntry.encode = function encode(message, writer) { + GetIdentityNonceResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identityNonce != null && Object.hasOwnProperty.call(message, "identityNonce")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.identityNonce); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified IdentityEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.verify|verify} messages. + * Encodes the specified GetIdentityNonceResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry} message IdentityEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0} message GetIdentityNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentityEntry.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityNonceResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an IdentityEntry message from the specified reader or buffer. + * Decodes a GetIdentityNonceResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityEntry.decode = function decode(reader, length) { + GetIdentityNonceResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.key = reader.bytes(); + message.identityNonce = reader.uint64(); break; case 2: - message.value = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.decode(reader, reader.uint32()); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -4673,340 +5273,368 @@ $root.org = (function() { }; /** - * Decodes an IdentityEntry message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityNonceResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityEntry.decodeDelimited = function decodeDelimited(reader) { + GetIdentityNonceResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IdentityEntry message. + * Verifies a GetIdentityNonceResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IdentityEntry.verify = function verify(message) { + GetIdentityNonceResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.verify(message.value); + var properties = {}; + if (message.identityNonce != null && message.hasOwnProperty("identityNonce")) { + properties.result = 1; + if (!$util.isInteger(message.identityNonce) && !(message.identityNonce && $util.isInteger(message.identityNonce.low) && $util.isInteger(message.identityNonce.high))) + return "identityNonce: integer|Long expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); if (error) - return "value." + error; + return "metadata." + error; } return null; }; /** - * Creates an IdentityEntry message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityNonceResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 */ - IdentityEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry) + GetIdentityNonceResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length >= 0) - message.key = object.key; - if (object.value != null) { - if (typeof object.value !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.value: object expected"); - message.value = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.fromObject(object.value); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0(); + if (object.identityNonce != null) + if ($util.Long) + (message.identityNonce = $util.Long.fromValue(object.identityNonce)).unsigned = true; + else if (typeof object.identityNonce === "string") + message.identityNonce = parseInt(object.identityNonce, 10); + else if (typeof object.identityNonce === "number") + message.identityNonce = object.identityNonce; + else if (typeof object.identityNonce === "object") + message.identityNonce = new $util.LongBits(object.identityNonce.low >>> 0, object.identityNonce.high >>> 0).toNumber(true); + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from an IdentityEntry message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityNonceResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} message IdentityEntry + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} message GetIdentityNonceResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IdentityEntry.toObject = function toObject(message, options) { + GetIdentityNonceResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - object.value = null; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(message.value, options); + if (options.defaults) + object.metadata = null; + if (message.identityNonce != null && message.hasOwnProperty("identityNonce")) { + if (typeof message.identityNonce === "number") + object.identityNonce = options.longs === String ? String(message.identityNonce) : message.identityNonce; + else + object.identityNonce = options.longs === String ? $util.Long.prototype.toString.call(message.identityNonce) : options.longs === Number ? new $util.LongBits(message.identityNonce.low >>> 0, message.identityNonce.high >>> 0).toNumber(true) : message.identityNonce; + if (options.oneofs) + object.result = "identityNonce"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this IdentityEntry to JSON. + * Converts this GetIdentityNonceResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance * @returns {Object.} JSON object */ - IdentityEntry.prototype.toJSON = function toJSON() { + GetIdentityNonceResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return IdentityEntry; + return GetIdentityNonceResponseV0; })(); - GetIdentitiesResponse.Identities = (function() { + return GetIdentityNonceResponse; + })(); - /** - * Properties of an Identities. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IIdentities - * @property {Array.|null} [identityEntries] Identities identityEntries - */ + v0.GetIdentityContractNonceResponse = (function() { - /** - * Constructs a new Identities. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents an Identities. - * @implements IIdentities - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities=} [properties] Properties to set - */ - function Identities(properties) { - this.identityEntries = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a GetIdentityContractNonceResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityContractNonceResponse + * @property {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0|null} [v0] GetIdentityContractNonceResponse v0 + */ - /** - * Identities identityEntries. - * @member {Array.} identityEntries - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @instance - */ - Identities.prototype.identityEntries = $util.emptyArray; + /** + * Constructs a new GetIdentityContractNonceResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityContractNonceResponse. + * @implements IGetIdentityContractNonceResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse=} [properties] Properties to set + */ + function GetIdentityContractNonceResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new Identities instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities instance - */ - Identities.create = function create(properties) { - return new Identities(properties); - }; + /** + * GetIdentityContractNonceResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @instance + */ + GetIdentityContractNonceResponse.prototype.v0 = null; - /** - * Encodes the specified Identities message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities} message Identities message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Identities.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identityEntries != null && message.identityEntries.length) - for (var i = 0; i < message.identityEntries.length; ++i) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.encode(message.identityEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Encodes the specified Identities message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities} message Identities message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Identities.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * GetIdentityContractNonceResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @instance + */ + Object.defineProperty(GetIdentityContractNonceResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Decodes an Identities message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Identities.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.identityEntries && message.identityEntries.length)) - message.identityEntries = []; - message.identityEntries.push($root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new GetIdentityContractNonceResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse instance + */ + GetIdentityContractNonceResponse.create = function create(properties) { + return new GetIdentityContractNonceResponse(properties); + }; - /** - * Decodes an Identities message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Identities.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified GetIdentityContractNonceResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse} message GetIdentityContractNonceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityContractNonceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Verifies an Identities message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Identities.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.identityEntries != null && message.hasOwnProperty("identityEntries")) { - if (!Array.isArray(message.identityEntries)) - return "identityEntries: array expected"; - for (var i = 0; i < message.identityEntries.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.verify(message.identityEntries[i]); - if (error) - return "identityEntries." + error; - } - } - return null; - }; + /** + * Encodes the specified GetIdentityContractNonceResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse} message GetIdentityContractNonceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityContractNonceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates an Identities message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities - */ - Identities.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities(); - if (object.identityEntries) { - if (!Array.isArray(object.identityEntries)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.identityEntries: array expected"); - message.identityEntries = []; - for (var i = 0; i < object.identityEntries.length; ++i) { - if (typeof object.identityEntries[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.identityEntries: object expected"); - message.identityEntries[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.fromObject(object.identityEntries[i]); - } + /** + * Decodes a GetIdentityContractNonceResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityContractNonceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from an Identities message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} message Identities - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Identities.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.identityEntries = []; - if (message.identityEntries && message.identityEntries.length) { - object.identityEntries = []; - for (var j = 0; j < message.identityEntries.length; ++j) - object.identityEntries[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject(message.identityEntries[j], options); + /** + * Decodes a GetIdentityContractNonceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityContractNonceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityContractNonceResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityContractNonceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.verify(message.v0); + if (error) + return "v0." + error; } + } + return null; + }; + + /** + * Creates a GetIdentityContractNonceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse + */ + GetIdentityContractNonceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.fromObject(object.v0); + } + return message; + }; - /** - * Converts this Identities to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @instance - * @returns {Object.} JSON object - */ - Identities.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetIdentityContractNonceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} message GetIdentityContractNonceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityContractNonceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; - return Identities; - })(); + /** + * Converts this GetIdentityContractNonceResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @instance + * @returns {Object.} JSON object + */ + GetIdentityContractNonceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetIdentitiesResponse.GetIdentitiesResponseV0 = (function() { + GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 = (function() { /** - * Properties of a GetIdentitiesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IGetIdentitiesResponseV0 - * @property {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities|null} [identities] GetIdentitiesResponseV0 identities - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentitiesResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentitiesResponseV0 metadata + * Properties of a GetIdentityContractNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @interface IGetIdentityContractNonceResponseV0 + * @property {number|Long|null} [identityContractNonce] GetIdentityContractNonceResponseV0 identityContractNonce + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityContractNonceResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityContractNonceResponseV0 metadata */ /** - * Constructs a new GetIdentitiesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents a GetIdentitiesResponseV0. - * @implements IGetIdentitiesResponseV0 + * Constructs a new GetIdentityContractNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @classdesc Represents a GetIdentityContractNonceResponseV0. + * @implements IGetIdentityContractNonceResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0=} [properties] Properties to set */ - function GetIdentitiesResponseV0(properties) { + function GetIdentityContractNonceResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5014,69 +5642,69 @@ $root.org = (function() { } /** - * GetIdentitiesResponseV0 identities. - * @member {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities|null|undefined} identities - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * GetIdentityContractNonceResponseV0 identityContractNonce. + * @member {number|Long} identityContractNonce + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - GetIdentitiesResponseV0.prototype.identities = null; + GetIdentityContractNonceResponseV0.prototype.identityContractNonce = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * GetIdentitiesResponseV0 proof. + * GetIdentityContractNonceResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - GetIdentitiesResponseV0.prototype.proof = null; + GetIdentityContractNonceResponseV0.prototype.proof = null; /** - * GetIdentitiesResponseV0 metadata. + * GetIdentityContractNonceResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - GetIdentitiesResponseV0.prototype.metadata = null; + GetIdentityContractNonceResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesResponseV0 result. - * @member {"identities"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * GetIdentityContractNonceResponseV0 result. + * @member {"identityContractNonce"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - Object.defineProperty(GetIdentitiesResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identities", "proof"]), + Object.defineProperty(GetIdentityContractNonceResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identityContractNonce", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesResponseV0 instance using the specified properties. + * Creates a new GetIdentityContractNonceResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 instance */ - GetIdentitiesResponseV0.create = function create(properties) { - return new GetIdentitiesResponseV0(properties); + GetIdentityContractNonceResponseV0.create = function create(properties) { + return new GetIdentityContractNonceResponseV0(properties); }; /** - * Encodes the specified GetIdentitiesResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0} message GetIdentitiesResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0} message GetIdentityContractNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponseV0.encode = function encode(message, writer) { + GetIdentityContractNonceResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identities != null && Object.hasOwnProperty.call(message, "identities")) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.encode(message.identities, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.identityContractNonce != null && Object.hasOwnProperty.call(message, "identityContractNonce")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.identityContractNonce); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -5085,38 +5713,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetIdentitiesResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0} message GetIdentitiesResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0} message GetIdentityContractNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityContractNonceResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesResponseV0 message from the specified reader or buffer. + * Decodes a GetIdentityContractNonceResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponseV0.decode = function decode(reader, length) { + GetIdentityContractNonceResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.decode(reader, reader.uint32()); + message.identityContractNonce = reader.uint64(); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -5133,40 +5761,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityContractNonceResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityContractNonceResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesResponseV0 message. + * Verifies a GetIdentityContractNonceResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesResponseV0.verify = function verify(message) { + GetIdentityContractNonceResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.identities != null && message.hasOwnProperty("identities")) { + if (message.identityContractNonce != null && message.hasOwnProperty("identityContractNonce")) { properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.verify(message.identities); - if (error) - return "identities." + error; - } + if (!$util.isInteger(message.identityContractNonce) && !(message.identityContractNonce && $util.isInteger(message.identityContractNonce.low) && $util.isInteger(message.identityContractNonce.high))) + return "identityContractNonce: integer|Long expected"; } if (message.proof != null && message.hasOwnProperty("proof")) { if (properties.result === 1) @@ -5187,54 +5812,61 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityContractNonceResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 */ - GetIdentitiesResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0) + GetIdentityContractNonceResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0(); - if (object.identities != null) { - if (typeof object.identities !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.identities: object expected"); - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.fromObject(object.identities); - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0(); + if (object.identityContractNonce != null) + if ($util.Long) + (message.identityContractNonce = $util.Long.fromValue(object.identityContractNonce)).unsigned = true; + else if (typeof object.identityContractNonce === "string") + message.identityContractNonce = parseInt(object.identityContractNonce, 10); + else if (typeof object.identityContractNonce === "number") + message.identityContractNonce = object.identityContractNonce; + else if (typeof object.identityContractNonce === "object") + message.identityContractNonce = new $util.LongBits(object.identityContractNonce.low >>> 0, object.identityContractNonce.high >>> 0).toNumber(true); if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetIdentitiesResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityContractNonceResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} message GetIdentitiesResponseV0 + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} message GetIdentityContractNonceResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesResponseV0.toObject = function toObject(message, options) { + GetIdentityContractNonceResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; - if (message.identities != null && message.hasOwnProperty("identities")) { - object.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(message.identities, options); + if (message.identityContractNonce != null && message.hasOwnProperty("identityContractNonce")) { + if (typeof message.identityContractNonce === "number") + object.identityContractNonce = options.longs === String ? String(message.identityContractNonce) : message.identityContractNonce; + else + object.identityContractNonce = options.longs === String ? $util.Long.prototype.toString.call(message.identityContractNonce) : options.longs === Number ? new $util.LongBits(message.identityContractNonce.low >>> 0, message.identityContractNonce.high >>> 0).toNumber(true) : message.identityContractNonce; if (options.oneofs) - object.result = "identities"; + object.result = "identityContractNonce"; } if (message.proof != null && message.hasOwnProperty("proof")) { object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); @@ -5247,20 +5879,20 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesResponseV0 to JSON. + * Converts this GetIdentityContractNonceResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance * @returns {Object.} JSON object */ - GetIdentitiesResponseV0.prototype.toJSON = function toJSON() { + GetIdentityContractNonceResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentitiesResponseV0; + return GetIdentityContractNonceResponseV0; })(); - return GetIdentitiesResponse; + return GetIdentityContractNonceResponse; })(); v0.GetIdentityBalanceResponse = (function() { @@ -8810,24 +9442,24 @@ $root.org = (function() { return GetIdentityKeysResponse; })(); - v0.GetProofsRequest = (function() { + v0.GetIdentitiesContractKeysRequest = (function() { /** - * Properties of a GetProofsRequest. + * Properties of a GetIdentitiesContractKeysRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProofsRequest - * @property {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0|null} [v0] GetProofsRequest v0 + * @interface IGetIdentitiesContractKeysRequest + * @property {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0|null} [v0] GetIdentitiesContractKeysRequest v0 */ /** - * Constructs a new GetProofsRequest. + * Constructs a new GetIdentitiesContractKeysRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProofsRequest. - * @implements IGetProofsRequest + * @classdesc Represents a GetIdentitiesContractKeysRequest. + * @implements IGetIdentitiesContractKeysRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetProofsRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest=} [properties] Properties to set */ - function GetProofsRequest(properties) { + function GetIdentitiesContractKeysRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -8835,89 +9467,89 @@ $root.org = (function() { } /** - * GetProofsRequest v0. - * @member {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * GetIdentitiesContractKeysRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @instance */ - GetProofsRequest.prototype.v0 = null; + GetIdentitiesContractKeysRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProofsRequest version. + * GetIdentitiesContractKeysRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @instance */ - Object.defineProperty(GetProofsRequest.prototype, "version", { + Object.defineProperty(GetIdentitiesContractKeysRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProofsRequest instance using the specified properties. + * Creates a new GetIdentitiesContractKeysRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProofsRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest instance */ - GetProofsRequest.create = function create(properties) { - return new GetProofsRequest(properties); + GetIdentitiesContractKeysRequest.create = function create(properties) { + return new GetIdentitiesContractKeysRequest(properties); }; /** - * Encodes the specified GetProofsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProofsRequest} message GetProofsRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} message GetIdentitiesContractKeysRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsRequest.encode = function encode(message, writer) { + GetIdentitiesContractKeysRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProofsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProofsRequest} message GetProofsRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} message GetIdentitiesContractKeysRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentitiesContractKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProofsRequest message from the specified reader or buffer. + * Decodes a GetIdentitiesContractKeysRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsRequest.decode = function decode(reader, length) { + GetIdentitiesContractKeysRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -8928,37 +9560,37 @@ $root.org = (function() { }; /** - * Decodes a GetProofsRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentitiesContractKeysRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentitiesContractKeysRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProofsRequest message. + * Verifies a GetIdentitiesContractKeysRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProofsRequest.verify = function verify(message) { + GetIdentitiesContractKeysRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -8967,40 +9599,40 @@ $root.org = (function() { }; /** - * Creates a GetProofsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentitiesContractKeysRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest */ - GetProofsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest) + GetIdentitiesContractKeysRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProofsRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentitiesContractKeysRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest} message GetProofsRequest + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} message GetIdentitiesContractKeysRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProofsRequest.toObject = function toObject(message, options) { + GetIdentitiesContractKeysRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -9008,39 +9640,40 @@ $root.org = (function() { }; /** - * Converts this GetProofsRequest to JSON. + * Converts this GetIdentitiesContractKeysRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @instance * @returns {Object.} JSON object */ - GetProofsRequest.prototype.toJSON = function toJSON() { + GetIdentitiesContractKeysRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProofsRequest.GetProofsRequestV0 = (function() { + GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 = (function() { /** - * Properties of a GetProofsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest - * @interface IGetProofsRequestV0 - * @property {Array.|null} [identities] GetProofsRequestV0 identities - * @property {Array.|null} [contracts] GetProofsRequestV0 contracts - * @property {Array.|null} [documents] GetProofsRequestV0 documents + * Properties of a GetIdentitiesContractKeysRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest + * @interface IGetIdentitiesContractKeysRequestV0 + * @property {Array.|null} [identitiesIds] GetIdentitiesContractKeysRequestV0 identitiesIds + * @property {Uint8Array|null} [contractId] GetIdentitiesContractKeysRequestV0 contractId + * @property {string|null} [documentTypeName] GetIdentitiesContractKeysRequestV0 documentTypeName + * @property {Array.|null} [purposes] GetIdentitiesContractKeysRequestV0 purposes + * @property {boolean|null} [prove] GetIdentitiesContractKeysRequestV0 prove */ /** - * Constructs a new GetProofsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest - * @classdesc Represents a GetProofsRequestV0. - * @implements IGetProofsRequestV0 + * Constructs a new GetIdentitiesContractKeysRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest + * @classdesc Represents a GetIdentitiesContractKeysRequestV0. + * @implements IGetIdentitiesContractKeysRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0=} [properties] Properties to set */ - function GetProofsRequestV0(properties) { - this.identities = []; - this.contracts = []; - this.documents = []; + function GetIdentitiesContractKeysRequestV0(properties) { + this.identitiesIds = []; + this.purposes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9048,110 +9681,141 @@ $root.org = (function() { } /** - * GetProofsRequestV0 identities. - * @member {Array.} identities - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * GetIdentitiesContractKeysRequestV0 identitiesIds. + * @member {Array.} identitiesIds + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @instance */ - GetProofsRequestV0.prototype.identities = $util.emptyArray; + GetIdentitiesContractKeysRequestV0.prototype.identitiesIds = $util.emptyArray; /** - * GetProofsRequestV0 contracts. - * @member {Array.} contracts - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * GetIdentitiesContractKeysRequestV0 contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @instance */ - GetProofsRequestV0.prototype.contracts = $util.emptyArray; + GetIdentitiesContractKeysRequestV0.prototype.contractId = $util.newBuffer([]); /** - * GetProofsRequestV0 documents. - * @member {Array.} documents - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * GetIdentitiesContractKeysRequestV0 documentTypeName. + * @member {string} documentTypeName + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @instance */ - GetProofsRequestV0.prototype.documents = $util.emptyArray; + GetIdentitiesContractKeysRequestV0.prototype.documentTypeName = ""; /** - * Creates a new GetProofsRequestV0 instance using the specified properties. + * GetIdentitiesContractKeysRequestV0 purposes. + * @member {Array.} purposes + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + */ + GetIdentitiesContractKeysRequestV0.prototype.purposes = $util.emptyArray; + + /** + * GetIdentitiesContractKeysRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + */ + GetIdentitiesContractKeysRequestV0.prototype.prove = false; + + /** + * Creates a new GetIdentitiesContractKeysRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 instance */ - GetProofsRequestV0.create = function create(properties) { - return new GetProofsRequestV0(properties); + GetIdentitiesContractKeysRequestV0.create = function create(properties) { + return new GetIdentitiesContractKeysRequestV0(properties); }; /** - * Encodes the specified GetProofsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0} message GetProofsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0} message GetIdentitiesContractKeysRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsRequestV0.encode = function encode(message, writer) { + GetIdentitiesContractKeysRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identities != null && message.identities.length) - for (var i = 0; i < message.identities.length; ++i) - $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.encode(message.identities[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.contracts != null && message.contracts.length) - for (var i = 0; i < message.contracts.length; ++i) - $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.encode(message.contracts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.documents != null && message.documents.length) - for (var i = 0; i < message.documents.length; ++i) - $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.encode(message.documents[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.identitiesIds != null && message.identitiesIds.length) + for (var i = 0; i < message.identitiesIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identitiesIds[i]); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.contractId); + if (message.documentTypeName != null && Object.hasOwnProperty.call(message, "documentTypeName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentTypeName); + if (message.purposes != null && message.purposes.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.purposes.length; ++i) + writer.int32(message.purposes[i]); + writer.ldelim(); + } + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.prove); return writer; }; /** - * Encodes the specified GetProofsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0} message GetProofsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0} message GetIdentitiesContractKeysRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentitiesContractKeysRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProofsRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentitiesContractKeysRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsRequestV0.decode = function decode(reader, length) { + GetIdentitiesContractKeysRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.identities && message.identities.length)) - message.identities = []; - message.identities.push($root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.decode(reader, reader.uint32())); + if (!(message.identitiesIds && message.identitiesIds.length)) + message.identitiesIds = []; + message.identitiesIds.push(reader.bytes()); break; case 2: - if (!(message.contracts && message.contracts.length)) - message.contracts = []; - message.contracts.push($root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.decode(reader, reader.uint32())); + message.contractId = reader.bytes(); break; case 3: - if (!(message.documents && message.documents.length)) - message.documents = []; - message.documents.push($root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.decode(reader, reader.uint32())); + message.documentTypeName = reader.string(); + break; + case 4: + if (!(message.purposes && message.purposes.length)) + message.purposes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.purposes.push(reader.int32()); + } else + message.purposes.push(reader.int32()); + break; + case 5: + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -9162,534 +9826,783 @@ $root.org = (function() { }; /** - * Decodes a GetProofsRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentitiesContractKeysRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentitiesContractKeysRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProofsRequestV0 message. + * Verifies a GetIdentitiesContractKeysRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProofsRequestV0.verify = function verify(message) { + GetIdentitiesContractKeysRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.identities != null && message.hasOwnProperty("identities")) { - if (!Array.isArray(message.identities)) - return "identities: array expected"; - for (var i = 0; i < message.identities.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.verify(message.identities[i]); - if (error) - return "identities." + error; - } - } - if (message.contracts != null && message.hasOwnProperty("contracts")) { - if (!Array.isArray(message.contracts)) - return "contracts: array expected"; - for (var i = 0; i < message.contracts.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.verify(message.contracts[i]); - if (error) - return "contracts." + error; - } - } - if (message.documents != null && message.hasOwnProperty("documents")) { - if (!Array.isArray(message.documents)) - return "documents: array expected"; - for (var i = 0; i < message.documents.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.verify(message.documents[i]); - if (error) - return "documents." + error; - } + if (message.identitiesIds != null && message.hasOwnProperty("identitiesIds")) { + if (!Array.isArray(message.identitiesIds)) + return "identitiesIds: array expected"; + for (var i = 0; i < message.identitiesIds.length; ++i) + if (!(message.identitiesIds[i] && typeof message.identitiesIds[i].length === "number" || $util.isString(message.identitiesIds[i]))) + return "identitiesIds: buffer[] expected"; + } + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + if (!$util.isString(message.documentTypeName)) + return "documentTypeName: string expected"; + if (message.purposes != null && message.hasOwnProperty("purposes")) { + if (!Array.isArray(message.purposes)) + return "purposes: array expected"; + for (var i = 0; i < message.purposes.length; ++i) + switch (message.purposes[i]) { + default: + return "purposes: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 5: + break; + } } + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetProofsRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentitiesContractKeysRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 */ - GetProofsRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0) + GetIdentitiesContractKeysRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0(); - if (object.identities) { - if (!Array.isArray(object.identities)) - throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.identities: array expected"); - message.identities = []; - for (var i = 0; i < object.identities.length; ++i) { - if (typeof object.identities[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.identities: object expected"); - message.identities[i] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.fromObject(object.identities[i]); - } - } - if (object.contracts) { - if (!Array.isArray(object.contracts)) - throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.contracts: array expected"); - message.contracts = []; - for (var i = 0; i < object.contracts.length; ++i) { - if (typeof object.contracts[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.contracts: object expected"); - message.contracts[i] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.fromObject(object.contracts[i]); - } - } - if (object.documents) { - if (!Array.isArray(object.documents)) - throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.documents: array expected"); - message.documents = []; - for (var i = 0; i < object.documents.length; ++i) { - if (typeof object.documents[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.documents: object expected"); - message.documents[i] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.fromObject(object.documents[i]); - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0(); + if (object.identitiesIds) { + if (!Array.isArray(object.identitiesIds)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.identitiesIds: array expected"); + message.identitiesIds = []; + for (var i = 0; i < object.identitiesIds.length; ++i) + if (typeof object.identitiesIds[i] === "string") + $util.base64.decode(object.identitiesIds[i], message.identitiesIds[i] = $util.newBuffer($util.base64.length(object.identitiesIds[i])), 0); + else if (object.identitiesIds[i].length >= 0) + message.identitiesIds[i] = object.identitiesIds[i]; + } + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentTypeName != null) + message.documentTypeName = String(object.documentTypeName); + if (object.purposes) { + if (!Array.isArray(object.purposes)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.purposes: array expected"); + message.purposes = []; + for (var i = 0; i < object.purposes.length; ++i) + switch (object.purposes[i]) { + default: + case "AUTHENTICATION": + case 0: + message.purposes[i] = 0; + break; + case "ENCRYPTION": + case 1: + message.purposes[i] = 1; + break; + case "DECRYPTION": + case 2: + message.purposes[i] = 2; + break; + case "TRANSFER": + case 3: + message.purposes[i] = 3; + break; + case "VOTING": + case 5: + message.purposes[i] = 5; + break; + } } + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetProofsRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentitiesContractKeysRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} message GetProofsRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} message GetIdentitiesContractKeysRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProofsRequestV0.toObject = function toObject(message, options) { + GetIdentitiesContractKeysRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { - object.identities = []; - object.contracts = []; - object.documents = []; - } - if (message.identities && message.identities.length) { - object.identities = []; - for (var j = 0; j < message.identities.length; ++j) - object.identities[j] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject(message.identities[j], options); + object.identitiesIds = []; + object.purposes = []; } - if (message.contracts && message.contracts.length) { - object.contracts = []; - for (var j = 0; j < message.contracts.length; ++j) - object.contracts[j] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject(message.contracts[j], options); + if (options.defaults) { + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + object.documentTypeName = ""; + object.prove = false; } - if (message.documents && message.documents.length) { - object.documents = []; - for (var j = 0; j < message.documents.length; ++j) - object.documents[j] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject(message.documents[j], options); + if (message.identitiesIds && message.identitiesIds.length) { + object.identitiesIds = []; + for (var j = 0; j < message.identitiesIds.length; ++j) + object.identitiesIds[j] = options.bytes === String ? $util.base64.encode(message.identitiesIds[j], 0, message.identitiesIds[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.identitiesIds[j]) : message.identitiesIds[j]; } + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + object.documentTypeName = message.documentTypeName; + if (message.purposes && message.purposes.length) { + object.purposes = []; + for (var j = 0; j < message.purposes.length; ++j) + object.purposes[j] = options.enums === String ? $root.org.dash.platform.dapi.v0.KeyPurpose[message.purposes[j]] : message.purposes[j]; + } + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetProofsRequestV0 to JSON. + * Converts this GetIdentitiesContractKeysRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 * @instance * @returns {Object.} JSON object */ - GetProofsRequestV0.prototype.toJSON = function toJSON() { + GetIdentitiesContractKeysRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProofsRequestV0.DocumentRequest = (function() { + return GetIdentitiesContractKeysRequestV0; + })(); - /** - * Properties of a DocumentRequest. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 - * @interface IDocumentRequest - * @property {Uint8Array|null} [contractId] DocumentRequest contractId - * @property {string|null} [documentType] DocumentRequest documentType - * @property {boolean|null} [documentTypeKeepsHistory] DocumentRequest documentTypeKeepsHistory - * @property {Uint8Array|null} [documentId] DocumentRequest documentId - */ + return GetIdentitiesContractKeysRequest; + })(); - /** - * Constructs a new DocumentRequest. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 - * @classdesc Represents a DocumentRequest. - * @implements IDocumentRequest - * @constructor - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest=} [properties] Properties to set - */ - function DocumentRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v0.GetIdentitiesContractKeysResponse = (function() { - /** - * DocumentRequest contractId. - * @member {Uint8Array} contractId - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @instance - */ - DocumentRequest.prototype.contractId = $util.newBuffer([]); + /** + * Properties of a GetIdentitiesContractKeysResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentitiesContractKeysResponse + * @property {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0|null} [v0] GetIdentitiesContractKeysResponse v0 + */ - /** - * DocumentRequest documentType. - * @member {string} documentType - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @instance - */ - DocumentRequest.prototype.documentType = ""; + /** + * Constructs a new GetIdentitiesContractKeysResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentitiesContractKeysResponse. + * @implements IGetIdentitiesContractKeysResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse=} [properties] Properties to set + */ + function GetIdentitiesContractKeysResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * DocumentRequest documentTypeKeepsHistory. - * @member {boolean} documentTypeKeepsHistory - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @instance - */ - DocumentRequest.prototype.documentTypeKeepsHistory = false; + /** + * GetIdentitiesContractKeysResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @instance + */ + GetIdentitiesContractKeysResponse.prototype.v0 = null; - /** - * DocumentRequest documentId. - * @member {Uint8Array} documentId - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @instance - */ - DocumentRequest.prototype.documentId = $util.newBuffer([]); + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Creates a new DocumentRequest instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest instance - */ - DocumentRequest.create = function create(properties) { - return new DocumentRequest(properties); - }; + /** + * GetIdentitiesContractKeysResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @instance + */ + Object.defineProperty(GetIdentitiesContractKeysResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Encodes the specified DocumentRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest} message DocumentRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DocumentRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); - if (message.documentType != null && Object.hasOwnProperty.call(message, "documentType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentType); - if (message.documentTypeKeepsHistory != null && Object.hasOwnProperty.call(message, "documentTypeKeepsHistory")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.documentTypeKeepsHistory); - if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.documentId); - return writer; - }; + /** + * Creates a new GetIdentitiesContractKeysResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse instance + */ + GetIdentitiesContractKeysResponse.create = function create(properties) { + return new GetIdentitiesContractKeysResponse(properties); + }; - /** - * Encodes the specified DocumentRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest} message DocumentRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified GetIdentitiesContractKeysResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse} message GetIdentitiesContractKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentitiesContractKeysResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Decodes a DocumentRequest message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DocumentRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.contractId = reader.bytes(); - break; - case 2: - message.documentType = reader.string(); - break; - case 3: - message.documentTypeKeepsHistory = reader.bool(); - break; - case 4: - message.documentId = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified GetIdentitiesContractKeysResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse} message GetIdentitiesContractKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentitiesContractKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a DocumentRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DocumentRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a GetIdentitiesContractKeysResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentitiesContractKeysResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Verifies a DocumentRequest message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DocumentRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.contractId != null && message.hasOwnProperty("contractId")) - if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) - return "contractId: buffer expected"; - if (message.documentType != null && message.hasOwnProperty("documentType")) - if (!$util.isString(message.documentType)) - return "documentType: string expected"; - if (message.documentTypeKeepsHistory != null && message.hasOwnProperty("documentTypeKeepsHistory")) - if (typeof message.documentTypeKeepsHistory !== "boolean") - return "documentTypeKeepsHistory: boolean expected"; - if (message.documentId != null && message.hasOwnProperty("documentId")) - if (!(message.documentId && typeof message.documentId.length === "number" || $util.isString(message.documentId))) - return "documentId: buffer expected"; - return null; - }; - - /** - * Creates a DocumentRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest - */ - DocumentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest(); - if (object.contractId != null) - if (typeof object.contractId === "string") - $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); - else if (object.contractId.length >= 0) - message.contractId = object.contractId; - if (object.documentType != null) - message.documentType = String(object.documentType); - if (object.documentTypeKeepsHistory != null) - message.documentTypeKeepsHistory = Boolean(object.documentTypeKeepsHistory); - if (object.documentId != null) - if (typeof object.documentId === "string") - $util.base64.decode(object.documentId, message.documentId = $util.newBuffer($util.base64.length(object.documentId)), 0); - else if (object.documentId.length >= 0) - message.documentId = object.documentId; - return message; - }; + /** + * Decodes a GetIdentitiesContractKeysResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentitiesContractKeysResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a DocumentRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} message DocumentRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DocumentRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.contractId = ""; - else { - object.contractId = []; - if (options.bytes !== Array) - object.contractId = $util.newBuffer(object.contractId); - } - object.documentType = ""; - object.documentTypeKeepsHistory = false; - if (options.bytes === String) - object.documentId = ""; - else { - object.documentId = []; - if (options.bytes !== Array) - object.documentId = $util.newBuffer(object.documentId); - } - } - if (message.contractId != null && message.hasOwnProperty("contractId")) - object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; - if (message.documentType != null && message.hasOwnProperty("documentType")) - object.documentType = message.documentType; - if (message.documentTypeKeepsHistory != null && message.hasOwnProperty("documentTypeKeepsHistory")) - object.documentTypeKeepsHistory = message.documentTypeKeepsHistory; - if (message.documentId != null && message.hasOwnProperty("documentId")) - object.documentId = options.bytes === String ? $util.base64.encode(message.documentId, 0, message.documentId.length) : options.bytes === Array ? Array.prototype.slice.call(message.documentId) : message.documentId; - return object; - }; + /** + * Verifies a GetIdentitiesContractKeysResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentitiesContractKeysResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; - /** - * Converts this DocumentRequest to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest - * @instance - * @returns {Object.} JSON object - */ - DocumentRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a GetIdentitiesContractKeysResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse + */ + GetIdentitiesContractKeysResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.fromObject(object.v0); + } + return message; + }; - return DocumentRequest; - })(); + /** + * Creates a plain object from a GetIdentitiesContractKeysResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} message GetIdentitiesContractKeysResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentitiesContractKeysResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; - GetProofsRequestV0.IdentityRequest = (function() { + /** + * Converts this GetIdentitiesContractKeysResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @instance + * @returns {Object.} JSON object + */ + GetIdentitiesContractKeysResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of an IdentityRequest. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 - * @interface IIdentityRequest - * @property {Uint8Array|null} [identityId] IdentityRequest identityId - * @property {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type|null} [requestType] IdentityRequest requestType - */ + GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 = (function() { - /** - * Constructs a new IdentityRequest. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 - * @classdesc Represents an IdentityRequest. - * @implements IIdentityRequest - * @constructor - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest=} [properties] Properties to set - */ - function IdentityRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a GetIdentitiesContractKeysResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @interface IGetIdentitiesContractKeysResponseV0 + * @property {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys|null} [identitiesKeys] GetIdentitiesContractKeysResponseV0 identitiesKeys + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentitiesContractKeysResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentitiesContractKeysResponseV0 metadata + */ - /** - * IdentityRequest identityId. - * @member {Uint8Array} identityId - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest - * @instance - */ - IdentityRequest.prototype.identityId = $util.newBuffer([]); + /** + * Constructs a new GetIdentitiesContractKeysResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @classdesc Represents a GetIdentitiesContractKeysResponseV0. + * @implements IGetIdentitiesContractKeysResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0=} [properties] Properties to set + */ + function GetIdentitiesContractKeysResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * IdentityRequest requestType. - * @member {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} requestType - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest - * @instance - */ - IdentityRequest.prototype.requestType = 0; + /** + * GetIdentitiesContractKeysResponseV0 identitiesKeys. + * @member {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys|null|undefined} identitiesKeys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @instance + */ + GetIdentitiesContractKeysResponseV0.prototype.identitiesKeys = null; - /** - * Creates a new IdentityRequest instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest - * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest instance - */ - IdentityRequest.create = function create(properties) { - return new IdentityRequest(properties); - }; + /** + * GetIdentitiesContractKeysResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @instance + */ + GetIdentitiesContractKeysResponseV0.prototype.proof = null; - /** - * Encodes the specified IdentityRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest - * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest} message IdentityRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentityRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); - if (message.requestType != null && Object.hasOwnProperty.call(message, "requestType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.requestType); - return writer; - }; + /** + * GetIdentitiesContractKeysResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @instance + */ + GetIdentitiesContractKeysResponseV0.prototype.metadata = null; - /** - * Encodes the specified IdentityRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest - * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest} message IdentityRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentityRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Decodes an IdentityRequest message from the specified reader or buffer. + /** + * GetIdentitiesContractKeysResponseV0 result. + * @member {"identitiesKeys"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @instance + */ + Object.defineProperty(GetIdentitiesContractKeysResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identitiesKeys", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentitiesContractKeysResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 instance + */ + GetIdentitiesContractKeysResponseV0.create = function create(properties) { + return new GetIdentitiesContractKeysResponseV0(properties); + }; + + /** + * Encodes the specified GetIdentitiesContractKeysResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0} message GetIdentitiesContractKeysResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentitiesContractKeysResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identitiesKeys != null && Object.hasOwnProperty.call(message, "identitiesKeys")) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.encode(message.identitiesKeys, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentitiesContractKeysResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0} message GetIdentitiesContractKeysResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentitiesContractKeysResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentitiesContractKeysResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentitiesContractKeysResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identitiesKeys = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentitiesContractKeysResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentitiesContractKeysResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentitiesContractKeysResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentitiesContractKeysResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.identitiesKeys != null && message.hasOwnProperty("identitiesKeys")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.verify(message.identitiesKeys); + if (error) + return "identitiesKeys." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetIdentitiesContractKeysResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 + */ + GetIdentitiesContractKeysResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0(); + if (object.identitiesKeys != null) { + if (typeof object.identitiesKeys !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.identitiesKeys: object expected"); + message.identitiesKeys = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.fromObject(object.identitiesKeys); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentitiesContractKeysResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} message GetIdentitiesContractKeysResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentitiesContractKeysResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.identitiesKeys != null && message.hasOwnProperty("identitiesKeys")) { + object.identitiesKeys = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(message.identitiesKeys, options); + if (options.oneofs) + object.result = "identitiesKeys"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetIdentitiesContractKeysResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetIdentitiesContractKeysResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetIdentitiesContractKeysResponseV0.PurposeKeys = (function() { + + /** + * Properties of a PurposeKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @interface IPurposeKeys + * @property {org.dash.platform.dapi.v0.KeyPurpose|null} [purpose] PurposeKeys purpose + * @property {Array.|null} [keysBytes] PurposeKeys keysBytes + */ + + /** + * Constructs a new PurposeKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @classdesc Represents a PurposeKeys. + * @implements IPurposeKeys + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys=} [properties] Properties to set + */ + function PurposeKeys(properties) { + this.keysBytes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurposeKeys purpose. + * @member {org.dash.platform.dapi.v0.KeyPurpose} purpose + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @instance + */ + PurposeKeys.prototype.purpose = 0; + + /** + * PurposeKeys keysBytes. + * @member {Array.} keysBytes + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @instance + */ + PurposeKeys.prototype.keysBytes = $util.emptyArray; + + /** + * Creates a new PurposeKeys instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys instance + */ + PurposeKeys.create = function create(properties) { + return new PurposeKeys(properties); + }; + + /** + * Encodes the specified PurposeKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys} message PurposeKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurposeKeys.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purpose != null && Object.hasOwnProperty.call(message, "purpose")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.purpose); + if (message.keysBytes != null && message.keysBytes.length) + for (var i = 0; i < message.keysBytes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.keysBytes[i]); + return writer; + }; + + /** + * Encodes the specified PurposeKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys} message PurposeKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurposeKeys.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurposeKeys message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityRequest.decode = function decode(reader, length) { + PurposeKeys.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identityId = reader.bytes(); + message.purpose = reader.int32(); break; case 2: - message.requestType = reader.int32(); + if (!(message.keysBytes && message.keysBytes.length)) + message.keysBytes = []; + message.keysBytes.push(reader.bytes()); break; default: reader.skipType(tag & 7); @@ -9700,159 +10613,161 @@ $root.org = (function() { }; /** - * Decodes an IdentityRequest message from the specified reader or buffer, length delimited. + * Decodes a PurposeKeys message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityRequest.decodeDelimited = function decodeDelimited(reader) { + PurposeKeys.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IdentityRequest message. + * Verifies a PurposeKeys message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IdentityRequest.verify = function verify(message) { + PurposeKeys.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.identityId != null && message.hasOwnProperty("identityId")) - if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) - return "identityId: buffer expected"; - if (message.requestType != null && message.hasOwnProperty("requestType")) - switch (message.requestType) { + if (message.purpose != null && message.hasOwnProperty("purpose")) + switch (message.purpose) { default: - return "requestType: enum value expected"; + return "purpose: enum value expected"; case 0: case 1: case 2: + case 3: + case 5: break; } + if (message.keysBytes != null && message.hasOwnProperty("keysBytes")) { + if (!Array.isArray(message.keysBytes)) + return "keysBytes: array expected"; + for (var i = 0; i < message.keysBytes.length; ++i) + if (!(message.keysBytes[i] && typeof message.keysBytes[i].length === "number" || $util.isString(message.keysBytes[i]))) + return "keysBytes: buffer[] expected"; + } return null; }; /** - * Creates an IdentityRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurposeKeys message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys */ - IdentityRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest) + PurposeKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest(); - if (object.identityId != null) - if (typeof object.identityId === "string") - $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); - else if (object.identityId.length >= 0) - message.identityId = object.identityId; - switch (object.requestType) { - case "FULL_IDENTITY": + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys(); + switch (object.purpose) { + case "AUTHENTICATION": case 0: - message.requestType = 0; + message.purpose = 0; break; - case "BALANCE": + case "ENCRYPTION": case 1: - message.requestType = 1; + message.purpose = 1; break; - case "KEYS": + case "DECRYPTION": case 2: - message.requestType = 2; + message.purpose = 2; + break; + case "TRANSFER": + case 3: + message.purpose = 3; + break; + case "VOTING": + case 5: + message.purpose = 5; break; } + if (object.keysBytes) { + if (!Array.isArray(object.keysBytes)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.keysBytes: array expected"); + message.keysBytes = []; + for (var i = 0; i < object.keysBytes.length; ++i) + if (typeof object.keysBytes[i] === "string") + $util.base64.decode(object.keysBytes[i], message.keysBytes[i] = $util.newBuffer($util.base64.length(object.keysBytes[i])), 0); + else if (object.keysBytes[i].length >= 0) + message.keysBytes[i] = object.keysBytes[i]; + } return message; }; /** - * Creates a plain object from an IdentityRequest message. Also converts values to other types if specified. + * Creates a plain object from a PurposeKeys message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} message IdentityRequest + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} message PurposeKeys * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IdentityRequest.toObject = function toObject(message, options) { + PurposeKeys.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.identityId = ""; - else { - object.identityId = []; - if (options.bytes !== Array) - object.identityId = $util.newBuffer(object.identityId); - } - object.requestType = options.enums === String ? "FULL_IDENTITY" : 0; + if (options.arrays || options.defaults) + object.keysBytes = []; + if (options.defaults) + object.purpose = options.enums === String ? "AUTHENTICATION" : 0; + if (message.purpose != null && message.hasOwnProperty("purpose")) + object.purpose = options.enums === String ? $root.org.dash.platform.dapi.v0.KeyPurpose[message.purpose] : message.purpose; + if (message.keysBytes && message.keysBytes.length) { + object.keysBytes = []; + for (var j = 0; j < message.keysBytes.length; ++j) + object.keysBytes[j] = options.bytes === String ? $util.base64.encode(message.keysBytes[j], 0, message.keysBytes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.keysBytes[j]) : message.keysBytes[j]; } - if (message.identityId != null && message.hasOwnProperty("identityId")) - object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; - if (message.requestType != null && message.hasOwnProperty("requestType")) - object.requestType = options.enums === String ? $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type[message.requestType] : message.requestType; return object; }; /** - * Converts this IdentityRequest to JSON. + * Converts this PurposeKeys to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys * @instance * @returns {Object.} JSON object */ - IdentityRequest.prototype.toJSON = function toJSON() { + PurposeKeys.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type - * @enum {number} - * @property {number} FULL_IDENTITY=0 FULL_IDENTITY value - * @property {number} BALANCE=1 BALANCE value - * @property {number} KEYS=2 KEYS value - */ - IdentityRequest.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FULL_IDENTITY"] = 0; - values[valuesById[1] = "BALANCE"] = 1; - values[valuesById[2] = "KEYS"] = 2; - return values; - })(); - - return IdentityRequest; + return PurposeKeys; })(); - GetProofsRequestV0.ContractRequest = (function() { + GetIdentitiesContractKeysResponseV0.IdentityKeys = (function() { /** - * Properties of a ContractRequest. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 - * @interface IContractRequest - * @property {Uint8Array|null} [contractId] ContractRequest contractId + * Properties of an IdentityKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @interface IIdentityKeys + * @property {Uint8Array|null} [identityId] IdentityKeys identityId + * @property {Array.|null} [keys] IdentityKeys keys */ /** - * Constructs a new ContractRequest. - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 - * @classdesc Represents a ContractRequest. - * @implements IContractRequest + * Constructs a new IdentityKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @classdesc Represents an IdentityKeys. + * @implements IIdentityKeys * @constructor - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys=} [properties] Properties to set */ - function ContractRequest(properties) { + function IdentityKeys(properties) { + this.keys = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9860,75 +10775,91 @@ $root.org = (function() { } /** - * ContractRequest contractId. - * @member {Uint8Array} contractId - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * IdentityKeys identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @instance */ - ContractRequest.prototype.contractId = $util.newBuffer([]); + IdentityKeys.prototype.identityId = $util.newBuffer([]); /** - * Creates a new ContractRequest instance using the specified properties. + * IdentityKeys keys. + * @member {Array.} keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @instance + */ + IdentityKeys.prototype.keys = $util.emptyArray; + + /** + * Creates a new IdentityKeys instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest instance + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys instance */ - ContractRequest.create = function create(properties) { - return new ContractRequest(properties); + IdentityKeys.create = function create(properties) { + return new IdentityKeys(properties); }; /** - * Encodes the specified ContractRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.verify|verify} messages. + * Encodes the specified IdentityKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest} message ContractRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys} message IdentityKeys message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ContractRequest.encode = function encode(message, writer) { + IdentityKeys.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.encode(message.keys[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ContractRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.verify|verify} messages. + * Encodes the specified IdentityKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest} message ContractRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys} message IdentityKeys message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ContractRequest.encodeDelimited = function encodeDelimited(message, writer) { + IdentityKeys.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ContractRequest message from the specified reader or buffer. + * Decodes an IdentityKeys message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ContractRequest.decode = function decode(reader, length) { + IdentityKeys.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.contractId = reader.bytes(); + message.identityId = reader.bytes(); + break; + case 2: + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push($root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -9939,212 +10870,446 @@ $root.org = (function() { }; /** - * Decodes a ContractRequest message from the specified reader or buffer, length delimited. + * Decodes an IdentityKeys message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ContractRequest.decodeDelimited = function decodeDelimited(reader) { + IdentityKeys.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ContractRequest message. + * Verifies an IdentityKeys message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ContractRequest.verify = function verify(message) { + IdentityKeys.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.contractId != null && message.hasOwnProperty("contractId")) - if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) - return "contractId: buffer expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.verify(message.keys[i]); + if (error) + return "keys." + error; + } + } return null; }; /** - * Creates a ContractRequest message from a plain object. Also converts values to their respective internal types. + * Creates an IdentityKeys message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys */ - ContractRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest) + IdentityKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest(); - if (object.contractId != null) - if (typeof object.contractId === "string") - $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); - else if (object.contractId.length >= 0) - message.contractId = object.contractId; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) { + if (typeof object.keys[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.keys: object expected"); + message.keys[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.fromObject(object.keys[i]); + } + } return message; }; /** - * Creates a plain object from a ContractRequest message. Also converts values to other types if specified. + * Creates a plain object from an IdentityKeys message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @static - * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} message ContractRequest + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} message IdentityKeys * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ContractRequest.toObject = function toObject(message, options) { + IdentityKeys.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.keys = []; if (options.defaults) if (options.bytes === String) - object.contractId = ""; + object.identityId = ""; else { - object.contractId = []; + object.identityId = []; if (options.bytes !== Array) - object.contractId = $util.newBuffer(object.contractId); + object.identityId = $util.newBuffer(object.identityId); } - if (message.contractId != null && message.hasOwnProperty("contractId")) - object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject(message.keys[j], options); + } return object; }; /** - * Converts this ContractRequest to JSON. + * Converts this IdentityKeys to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys * @instance * @returns {Object.} JSON object */ - ContractRequest.prototype.toJSON = function toJSON() { + IdentityKeys.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ContractRequest; + return IdentityKeys; })(); - return GetProofsRequestV0; - })(); - - return GetProofsRequest; - })(); - - v0.GetProofsResponse = (function() { + GetIdentitiesContractKeysResponseV0.IdentitiesKeys = (function() { - /** - * Properties of a GetProofsResponse. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetProofsResponse - * @property {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0|null} [v0] GetProofsResponse v0 - */ + /** + * Properties of an IdentitiesKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @interface IIdentitiesKeys + * @property {Array.|null} [entries] IdentitiesKeys entries + */ - /** - * Constructs a new GetProofsResponse. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProofsResponse. - * @implements IGetProofsResponse - * @constructor - * @param {org.dash.platform.dapi.v0.IGetProofsResponse=} [properties] Properties to set - */ - function GetProofsResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new IdentitiesKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @classdesc Represents an IdentitiesKeys. + * @implements IIdentitiesKeys + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys=} [properties] Properties to set + */ + function IdentitiesKeys(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * GetProofsResponse v0. - * @member {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProofsResponse - * @instance - */ - GetProofsResponse.prototype.v0 = null; + /** + * IdentitiesKeys entries. + * @member {Array.} entries + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @instance + */ + IdentitiesKeys.prototype.entries = $util.emptyArray; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Creates a new IdentitiesKeys instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys instance + */ + IdentitiesKeys.create = function create(properties) { + return new IdentitiesKeys(properties); + }; - /** - * GetProofsResponse version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProofsResponse - * @instance - */ - Object.defineProperty(GetProofsResponse.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Encodes the specified IdentitiesKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys} message IdentitiesKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentitiesKeys.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Creates a new GetProofsResponse instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetProofsResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetProofsResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse instance - */ - GetProofsResponse.create = function create(properties) { - return new GetProofsResponse(properties); - }; + /** + * Encodes the specified IdentitiesKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys} message IdentitiesKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentitiesKeys.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified GetProofsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.verify|verify} messages. + /** + * Decodes an IdentitiesKeys message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentitiesKeys.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentitiesKeys message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentitiesKeys.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentitiesKeys message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentitiesKeys.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates an IdentitiesKeys message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys + */ + IdentitiesKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.entries: object expected"); + message.entries[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an IdentitiesKeys message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} message IdentitiesKeys + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentitiesKeys.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this IdentitiesKeys to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys + * @instance + * @returns {Object.} JSON object + */ + IdentitiesKeys.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IdentitiesKeys; + })(); + + return GetIdentitiesContractKeysResponseV0; + })(); + + return GetIdentitiesContractKeysResponse; + })(); + + v0.GetProofsRequest = (function() { + + /** + * Properties of a GetProofsRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetProofsRequest + * @property {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0|null} [v0] GetProofsRequest v0 + */ + + /** + * Constructs a new GetProofsRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetProofsRequest. + * @implements IGetProofsRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetProofsRequest=} [properties] Properties to set + */ + function GetProofsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProofsRequest v0. + * @member {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @instance + */ + GetProofsRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProofsRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @instance + */ + Object.defineProperty(GetProofsRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProofsRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetProofsRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest instance + */ + GetProofsRequest.create = function create(properties) { + return new GetProofsRequest(properties); + }; + + /** + * Encodes the specified GetProofsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProofsResponse} message GetProofsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProofsRequest} message GetProofsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsResponse.encode = function encode(message, writer) { + GetProofsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProofsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.verify|verify} messages. + * Encodes the specified GetProofsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProofsResponse} message GetProofsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProofsRequest} message GetProofsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetProofsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProofsResponse message from the specified reader or buffer. + * Decodes a GetProofsRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse + * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsResponse.decode = function decode(reader, length) { + GetProofsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -10155,37 +11320,37 @@ $root.org = (function() { }; /** - * Decodes a GetProofsResponse message from the specified reader or buffer, length delimited. + * Decodes a GetProofsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse + * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsResponse.decodeDelimited = function decodeDelimited(reader) { + GetProofsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProofsResponse message. + * Verifies a GetProofsRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProofsResponse.verify = function verify(message) { + GetProofsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -10194,40 +11359,40 @@ $root.org = (function() { }; /** - * Creates a GetProofsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetProofsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse + * @returns {org.dash.platform.dapi.v0.GetProofsRequest} GetProofsRequest */ - GetProofsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsResponse) + GetProofsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProofsResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProofsResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProofsResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetProofsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @static - * @param {org.dash.platform.dapi.v0.GetProofsResponse} message GetProofsResponse + * @param {org.dash.platform.dapi.v0.GetProofsRequest} message GetProofsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProofsResponse.toObject = function toObject(message, options) { + GetProofsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -10235,35 +11400,41 @@ $root.org = (function() { }; /** - * Converts this GetProofsResponse to JSON. + * Converts this GetProofsRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @memberof org.dash.platform.dapi.v0.GetProofsRequest * @instance * @returns {Object.} JSON object */ - GetProofsResponse.prototype.toJSON = function toJSON() { + GetProofsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProofsResponse.GetProofsResponseV0 = (function() { + GetProofsRequest.GetProofsRequestV0 = (function() { /** - * Properties of a GetProofsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProofsResponse - * @interface IGetProofsResponseV0 - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProofsResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProofsResponseV0 metadata + * Properties of a GetProofsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @interface IGetProofsRequestV0 + * @property {Array.|null} [identities] GetProofsRequestV0 identities + * @property {Array.|null} [contracts] GetProofsRequestV0 contracts + * @property {Array.|null} [documents] GetProofsRequestV0 documents + * @property {Array.|null} [votes] GetProofsRequestV0 votes */ /** - * Constructs a new GetProofsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProofsResponse - * @classdesc Represents a GetProofsResponseV0. - * @implements IGetProofsResponseV0 + * Constructs a new GetProofsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest + * @classdesc Represents a GetProofsRequestV0. + * @implements IGetProofsRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0=} [properties] Properties to set */ - function GetProofsResponseV0(properties) { + function GetProofsRequestV0(properties) { + this.identities = []; + this.contracts = []; + this.documents = []; + this.votes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10271,102 +11442,126 @@ $root.org = (function() { } /** - * GetProofsResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 - * @instance + * GetProofsRequestV0 identities. + * @member {Array.} identities + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @instance */ - GetProofsResponseV0.prototype.proof = null; + GetProofsRequestV0.prototype.identities = $util.emptyArray; /** - * GetProofsResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * GetProofsRequestV0 contracts. + * @member {Array.} contracts + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @instance */ - GetProofsResponseV0.prototype.metadata = null; + GetProofsRequestV0.prototype.contracts = $util.emptyArray; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * GetProofsRequestV0 documents. + * @member {Array.} documents + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @instance + */ + GetProofsRequestV0.prototype.documents = $util.emptyArray; /** - * GetProofsResponseV0 result. - * @member {"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * GetProofsRequestV0 votes. + * @member {Array.} votes + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @instance */ - Object.defineProperty(GetProofsResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetProofsRequestV0.prototype.votes = $util.emptyArray; /** - * Creates a new GetProofsResponseV0 instance using the specified properties. + * Creates a new GetProofsRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 instance */ - GetProofsResponseV0.create = function create(properties) { - return new GetProofsResponseV0(properties); + GetProofsRequestV0.create = function create(properties) { + return new GetProofsRequestV0(properties); }; /** - * Encodes the specified GetProofsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.verify|verify} messages. + * Encodes the specified GetProofsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0} message GetProofsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0} message GetProofsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsResponseV0.encode = function encode(message, writer) { + GetProofsRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identities != null && message.identities.length) + for (var i = 0; i < message.identities.length; ++i) + $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.encode(message.identities[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.contracts != null && message.contracts.length) + for (var i = 0; i < message.contracts.length; ++i) + $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.encode(message.contracts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.encode(message.documents[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.votes != null && message.votes.length) + for (var i = 0; i < message.votes.length; ++i) + $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.encode(message.votes[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProofsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.verify|verify} messages. + * Encodes the specified GetProofsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0} message GetProofsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProofsRequest.IGetProofsRequestV0} message GetProofsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProofsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetProofsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProofsResponseV0 message from the specified reader or buffer. + * Decodes a GetProofsRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsResponseV0.decode = function decode(reader, length) { + GetProofsRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + if (!(message.identities && message.identities.length)) + message.identities = []; + message.identities.push($root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.decode(reader, reader.uint32())); break; case 2: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + if (!(message.contracts && message.contracts.length)) + message.contracts = []; + message.contracts.push($root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.votes && message.votes.length)) + message.votes = []; + message.votes.push($root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -10377,1045 +11572,1512 @@ $root.org = (function() { }; /** - * Decodes a GetProofsResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetProofsRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProofsResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetProofsRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProofsResponseV0 message. + * Verifies a GetProofsRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProofsResponseV0.verify = function verify(message) { + GetProofsRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.proof != null && message.hasOwnProperty("proof")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (message.identities != null && message.hasOwnProperty("identities")) { + if (!Array.isArray(message.identities)) + return "identities: array expected"; + for (var i = 0; i < message.identities.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.verify(message.identities[i]); if (error) - return "proof." + error; + return "identities." + error; } } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; + if (message.contracts != null && message.hasOwnProperty("contracts")) { + if (!Array.isArray(message.contracts)) + return "contracts: array expected"; + for (var i = 0; i < message.contracts.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.verify(message.contracts[i]); + if (error) + return "contracts." + error; + } + } + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.verify(message.documents[i]); + if (error) + return "documents." + error; + } + } + if (message.votes != null && message.hasOwnProperty("votes")) { + if (!Array.isArray(message.votes)) + return "votes: array expected"; + for (var i = 0; i < message.votes.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.verify(message.votes[i]); + if (error) + return "votes." + error; + } } return null; }; /** - * Creates a GetProofsResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetProofsRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} GetProofsRequestV0 */ - GetProofsResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0) + GetProofsRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0(); - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0(); + if (object.identities) { + if (!Array.isArray(object.identities)) + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.identities: array expected"); + message.identities = []; + for (var i = 0; i < object.identities.length; ++i) { + if (typeof object.identities[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.identities: object expected"); + message.identities[i] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.fromObject(object.identities[i]); + } } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + if (object.contracts) { + if (!Array.isArray(object.contracts)) + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.contracts: array expected"); + message.contracts = []; + for (var i = 0; i < object.contracts.length; ++i) { + if (typeof object.contracts[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.contracts: object expected"); + message.contracts[i] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.fromObject(object.contracts[i]); + } + } + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) { + if (typeof object.documents[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.documents: object expected"); + message.documents[i] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.fromObject(object.documents[i]); + } + } + if (object.votes) { + if (!Array.isArray(object.votes)) + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.votes: array expected"); + message.votes = []; + for (var i = 0; i < object.votes.length; ++i) { + if (typeof object.votes[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.votes: object expected"); + message.votes[i] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.fromObject(object.votes[i]); + } } return message; }; /** - * Creates a plain object from a GetProofsResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetProofsRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} message GetProofsResponseV0 + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} message GetProofsRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProofsResponseV0.toObject = function toObject(message, options) { + GetProofsRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.metadata = null; - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; + if (options.arrays || options.defaults) { + object.identities = []; + object.contracts = []; + object.documents = []; + object.votes = []; + } + if (message.identities && message.identities.length) { + object.identities = []; + for (var j = 0; j < message.identities.length; ++j) + object.identities[j] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject(message.identities[j], options); + } + if (message.contracts && message.contracts.length) { + object.contracts = []; + for (var j = 0; j < message.contracts.length; ++j) + object.contracts[j] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject(message.contracts[j], options); + } + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject(message.documents[j], options); + } + if (message.votes && message.votes.length) { + object.votes = []; + for (var j = 0; j < message.votes.length; ++j) + object.votes[j] = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.toObject(message.votes[j], options); } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this GetProofsResponseV0 to JSON. + * Converts this GetProofsRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 * @instance * @returns {Object.} JSON object */ - GetProofsResponseV0.prototype.toJSON = function toJSON() { + GetProofsRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProofsResponseV0; - })(); - - return GetProofsResponse; - })(); + GetProofsRequestV0.DocumentRequest = (function() { - v0.GetDataContractRequest = (function() { + /** + * Properties of a DocumentRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @interface IDocumentRequest + * @property {Uint8Array|null} [contractId] DocumentRequest contractId + * @property {string|null} [documentType] DocumentRequest documentType + * @property {boolean|null} [documentTypeKeepsHistory] DocumentRequest documentTypeKeepsHistory + * @property {Uint8Array|null} [documentId] DocumentRequest documentId + * @property {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus|null} [documentContestedStatus] DocumentRequest documentContestedStatus + */ - /** - * Properties of a GetDataContractRequest. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetDataContractRequest - * @property {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0|null} [v0] GetDataContractRequest v0 - */ + /** + * Constructs a new DocumentRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @classdesc Represents a DocumentRequest. + * @implements IDocumentRequest + * @constructor + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest=} [properties] Properties to set + */ + function DocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new GetDataContractRequest. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDataContractRequest. - * @implements IGetDataContractRequest - * @constructor - * @param {org.dash.platform.dapi.v0.IGetDataContractRequest=} [properties] Properties to set - */ - function GetDataContractRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * DocumentRequest contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @instance + */ + DocumentRequest.prototype.contractId = $util.newBuffer([]); - /** - * GetDataContractRequest v0. - * @member {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @instance - */ - GetDataContractRequest.prototype.v0 = null; + /** + * DocumentRequest documentType. + * @member {string} documentType + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @instance + */ + DocumentRequest.prototype.documentType = ""; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * DocumentRequest documentTypeKeepsHistory. + * @member {boolean} documentTypeKeepsHistory + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @instance + */ + DocumentRequest.prototype.documentTypeKeepsHistory = false; - /** - * GetDataContractRequest version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @instance - */ - Object.defineProperty(GetDataContractRequest.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * DocumentRequest documentId. + * @member {Uint8Array} documentId + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @instance + */ + DocumentRequest.prototype.documentId = $util.newBuffer([]); - /** - * Creates a new GetDataContractRequest instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest instance - */ - GetDataContractRequest.create = function create(properties) { - return new GetDataContractRequest(properties); - }; + /** + * DocumentRequest documentContestedStatus. + * @member {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} documentContestedStatus + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @instance + */ + DocumentRequest.prototype.documentContestedStatus = 0; - /** - * Encodes the specified GetDataContractRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractRequest} message GetDataContractRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Creates a new DocumentRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest instance + */ + DocumentRequest.create = function create(properties) { + return new DocumentRequest(properties); + }; - /** - * Encodes the specified GetDataContractRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractRequest} message GetDataContractRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified DocumentRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest} message DocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + if (message.documentType != null && Object.hasOwnProperty.call(message, "documentType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentType); + if (message.documentTypeKeepsHistory != null && Object.hasOwnProperty.call(message, "documentTypeKeepsHistory")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.documentTypeKeepsHistory); + if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.documentId); + if (message.documentContestedStatus != null && Object.hasOwnProperty.call(message, "documentContestedStatus")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.documentContestedStatus); + return writer; + }; - /** - * Decodes a GetDataContractRequest message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified DocumentRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IDocumentRequest} message DocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a GetDataContractRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a DocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractId = reader.bytes(); + break; + case 2: + message.documentType = reader.string(); + break; + case 3: + message.documentTypeKeepsHistory = reader.bool(); + break; + case 4: + message.documentId = reader.bytes(); + break; + case 5: + message.documentContestedStatus = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Verifies a GetDataContractRequest message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetDataContractRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.verify(message.v0); - if (error) - return "v0." + error; - } - } - return null; - }; + /** + * Decodes a DocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a GetDataContractRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest - */ - GetDataContractRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractRequest) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.fromObject(object.v0); - } - return message; - }; + /** + * Verifies a DocumentRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentType != null && message.hasOwnProperty("documentType")) + if (!$util.isString(message.documentType)) + return "documentType: string expected"; + if (message.documentTypeKeepsHistory != null && message.hasOwnProperty("documentTypeKeepsHistory")) + if (typeof message.documentTypeKeepsHistory !== "boolean") + return "documentTypeKeepsHistory: boolean expected"; + if (message.documentId != null && message.hasOwnProperty("documentId")) + if (!(message.documentId && typeof message.documentId.length === "number" || $util.isString(message.documentId))) + return "documentId: buffer expected"; + if (message.documentContestedStatus != null && message.hasOwnProperty("documentContestedStatus")) + switch (message.documentContestedStatus) { + default: + return "documentContestedStatus: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; - /** - * Creates a plain object from a GetDataContractRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractRequest} message GetDataContractRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDataContractRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Creates a DocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} DocumentRequest + */ + DocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest(); + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentType != null) + message.documentType = String(object.documentType); + if (object.documentTypeKeepsHistory != null) + message.documentTypeKeepsHistory = Boolean(object.documentTypeKeepsHistory); + if (object.documentId != null) + if (typeof object.documentId === "string") + $util.base64.decode(object.documentId, message.documentId = $util.newBuffer($util.base64.length(object.documentId)), 0); + else if (object.documentId.length >= 0) + message.documentId = object.documentId; + switch (object.documentContestedStatus) { + case "NOT_CONTESTED": + case 0: + message.documentContestedStatus = 0; + break; + case "MAYBE_CONTESTED": + case 1: + message.documentContestedStatus = 1; + break; + case "CONTESTED": + case 2: + message.documentContestedStatus = 2; + break; + } + return message; + }; - /** - * Converts this GetDataContractRequest to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @instance - * @returns {Object.} JSON object - */ - GetDataContractRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a DocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} message DocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + object.documentType = ""; + object.documentTypeKeepsHistory = false; + if (options.bytes === String) + object.documentId = ""; + else { + object.documentId = []; + if (options.bytes !== Array) + object.documentId = $util.newBuffer(object.documentId); + } + object.documentContestedStatus = options.enums === String ? "NOT_CONTESTED" : 0; + } + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentType != null && message.hasOwnProperty("documentType")) + object.documentType = message.documentType; + if (message.documentTypeKeepsHistory != null && message.hasOwnProperty("documentTypeKeepsHistory")) + object.documentTypeKeepsHistory = message.documentTypeKeepsHistory; + if (message.documentId != null && message.hasOwnProperty("documentId")) + object.documentId = options.bytes === String ? $util.base64.encode(message.documentId, 0, message.documentId.length) : options.bytes === Array ? Array.prototype.slice.call(message.documentId) : message.documentId; + if (message.documentContestedStatus != null && message.hasOwnProperty("documentContestedStatus")) + object.documentContestedStatus = options.enums === String ? $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus[message.documentContestedStatus] : message.documentContestedStatus; + return object; + }; - GetDataContractRequest.GetDataContractRequestV0 = (function() { + /** + * Converts this DocumentRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest + * @instance + * @returns {Object.} JSON object + */ + DocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a GetDataContractRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @interface IGetDataContractRequestV0 - * @property {Uint8Array|null} [id] GetDataContractRequestV0 id - * @property {boolean|null} [prove] GetDataContractRequestV0 prove - */ + /** + * DocumentContestedStatus enum. + * @name org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus + * @enum {number} + * @property {number} NOT_CONTESTED=0 NOT_CONTESTED value + * @property {number} MAYBE_CONTESTED=1 MAYBE_CONTESTED value + * @property {number} CONTESTED=2 CONTESTED value + */ + DocumentRequest.DocumentContestedStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NOT_CONTESTED"] = 0; + values[valuesById[1] = "MAYBE_CONTESTED"] = 1; + values[valuesById[2] = "CONTESTED"] = 2; + return values; + })(); - /** - * Constructs a new GetDataContractRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest - * @classdesc Represents a GetDataContractRequestV0. - * @implements IGetDataContractRequestV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0=} [properties] Properties to set - */ - function GetDataContractRequestV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return DocumentRequest; + })(); - /** - * GetDataContractRequestV0 id. - * @member {Uint8Array} id - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @instance - */ - GetDataContractRequestV0.prototype.id = $util.newBuffer([]); + GetProofsRequestV0.IdentityRequest = (function() { - /** - * GetDataContractRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @instance - */ - GetDataContractRequestV0.prototype.prove = false; + /** + * Properties of an IdentityRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @interface IIdentityRequest + * @property {Uint8Array|null} [identityId] IdentityRequest identityId + * @property {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type|null} [requestType] IdentityRequest requestType + */ - /** - * Creates a new GetDataContractRequestV0 instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 instance - */ - GetDataContractRequestV0.create = function create(properties) { - return new GetDataContractRequestV0(properties); - }; + /** + * Constructs a new IdentityRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @classdesc Represents an IdentityRequest. + * @implements IIdentityRequest + * @constructor + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest=} [properties] Properties to set + */ + function IdentityRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified GetDataContractRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0} message GetDataContractRequestV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractRequestV0.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); - return writer; - }; + /** + * IdentityRequest identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @instance + */ + IdentityRequest.prototype.identityId = $util.newBuffer([]); - /** - * Encodes the specified GetDataContractRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0} message GetDataContractRequestV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractRequestV0.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * IdentityRequest requestType. + * @member {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} requestType + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @instance + */ + IdentityRequest.prototype.requestType = 0; - /** - * Decodes a GetDataContractRequestV0 message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractRequestV0.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + /** + * Creates a new IdentityRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest instance + */ + IdentityRequest.create = function create(properties) { + return new IdentityRequest(properties); + }; + + /** + * Encodes the specified IdentityRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest} message IdentityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentityRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); + if (message.requestType != null && Object.hasOwnProperty.call(message, "requestType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.requestType); + return writer; + }; + + /** + * Encodes the specified IdentityRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IIdentityRequest} message IdentityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentityRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IdentityRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentityRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identityId = reader.bytes(); + break; + case 2: + message.requestType = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentityRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentityRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentityRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentityRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; + if (message.requestType != null && message.hasOwnProperty("requestType")) + switch (message.requestType) { + default: + return "requestType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates an IdentityRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} IdentityRequest + */ + IdentityRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; + switch (object.requestType) { + case "FULL_IDENTITY": + case 0: + message.requestType = 0; + break; + case "BALANCE": case 1: - message.id = reader.bytes(); + message.requestType = 1; break; + case "KEYS": case 2: - message.prove = reader.bool(); + message.requestType = 2; break; - default: - reader.skipType(tag & 7); + case "REVISION": + case 3: + message.requestType = 3; break; } - } - return message; - }; - - /** - * Decodes a GetDataContractRequestV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractRequestV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a GetDataContractRequestV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetDataContractRequestV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) - return "id: buffer expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; - return null; - }; - - /** - * Creates a GetDataContractRequestV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 - */ - GetDataContractRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0(); - if (object.id != null) - if (typeof object.id === "string") - $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); - else if (object.id.length >= 0) - message.id = object.id; - if (object.prove != null) - message.prove = Boolean(object.prove); - return message; - }; - - /** - * Creates a plain object from a GetDataContractRequestV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} message GetDataContractRequestV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDataContractRequestV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.id = ""; - else { - object.id = []; - if (options.bytes !== Array) - object.id = $util.newBuffer(object.id); + /** + * Creates a plain object from an IdentityRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} message IdentityRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentityRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.identityId = ""; + else { + object.identityId = []; + if (options.bytes !== Array) + object.identityId = $util.newBuffer(object.identityId); + } + object.requestType = options.enums === String ? "FULL_IDENTITY" : 0; } - object.prove = false; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; - return object; - }; + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.requestType != null && message.hasOwnProperty("requestType")) + object.requestType = options.enums === String ? $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type[message.requestType] : message.requestType; + return object; + }; - /** - * Converts this GetDataContractRequestV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 - * @instance - * @returns {Object.} JSON object - */ - GetDataContractRequestV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this IdentityRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest + * @instance + * @returns {Object.} JSON object + */ + IdentityRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GetDataContractRequestV0; - })(); + /** + * Type enum. + * @name org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type + * @enum {number} + * @property {number} FULL_IDENTITY=0 FULL_IDENTITY value + * @property {number} BALANCE=1 BALANCE value + * @property {number} KEYS=2 KEYS value + * @property {number} REVISION=3 REVISION value + */ + IdentityRequest.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FULL_IDENTITY"] = 0; + values[valuesById[1] = "BALANCE"] = 1; + values[valuesById[2] = "KEYS"] = 2; + values[valuesById[3] = "REVISION"] = 3; + return values; + })(); - return GetDataContractRequest; - })(); + return IdentityRequest; + })(); - v0.GetDataContractResponse = (function() { + GetProofsRequestV0.ContractRequest = (function() { - /** - * Properties of a GetDataContractResponse. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetDataContractResponse - * @property {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0|null} [v0] GetDataContractResponse v0 - */ + /** + * Properties of a ContractRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @interface IContractRequest + * @property {Uint8Array|null} [contractId] ContractRequest contractId + */ - /** - * Constructs a new GetDataContractResponse. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDataContractResponse. - * @implements IGetDataContractResponse - * @constructor - * @param {org.dash.platform.dapi.v0.IGetDataContractResponse=} [properties] Properties to set - */ - function GetDataContractResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new ContractRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @classdesc Represents a ContractRequest. + * @implements IContractRequest + * @constructor + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest=} [properties] Properties to set + */ + function ContractRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * GetDataContractResponse v0. - * @member {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @instance - */ - GetDataContractResponse.prototype.v0 = null; + /** + * ContractRequest contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @instance + */ + ContractRequest.prototype.contractId = $util.newBuffer([]); - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Creates a new ContractRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest instance + */ + ContractRequest.create = function create(properties) { + return new ContractRequest(properties); + }; - /** - * GetDataContractResponse version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @instance - */ - Object.defineProperty(GetDataContractResponse.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Encodes the specified ContractRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest} message ContractRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContractRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + return writer; + }; - /** - * Creates a new GetDataContractResponse instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse instance - */ - GetDataContractResponse.create = function create(properties) { - return new GetDataContractResponse(properties); - }; + /** + * Encodes the specified ContractRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IContractRequest} message ContractRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContractRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified GetDataContractResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractResponse} message GetDataContractResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetDataContractResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractResponse} message GetDataContractResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a ContractRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContractRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractId = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Decodes a GetDataContractResponse message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Decodes a ContractRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContractRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a GetDataContractResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Verifies a ContractRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContractRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + return null; + }; - /** - * Verifies a GetDataContractResponse message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetDataContractResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.verify(message.v0); - if (error) - return "v0." + error; - } - } - return null; - }; + /** + * Creates a ContractRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} ContractRequest + */ + ContractRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest(); + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + return message; + }; - /** - * Creates a GetDataContractResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse - */ - GetDataContractResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractResponse) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.fromObject(object.v0); - } - return message; - }; + /** + * Creates a plain object from a ContractRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} message ContractRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContractRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + return object; + }; - /** - * Creates a plain object from a GetDataContractResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractResponse} message GetDataContractResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDataContractResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Converts this ContractRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest + * @instance + * @returns {Object.} JSON object + */ + ContractRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetDataContractResponse to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @instance - * @returns {Object.} JSON object - */ - GetDataContractResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return ContractRequest; + })(); - GetDataContractResponse.GetDataContractResponseV0 = (function() { + GetProofsRequestV0.VoteStatusRequest = (function() { - /** - * Properties of a GetDataContractResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @interface IGetDataContractResponseV0 - * @property {Uint8Array|null} [dataContract] GetDataContractResponseV0 dataContract - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDataContractResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDataContractResponseV0 metadata - */ + /** + * Properties of a VoteStatusRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @interface IVoteStatusRequest + * @property {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.IContestedResourceVoteStatusRequest|null} [contestedResourceVoteStatusRequest] VoteStatusRequest contestedResourceVoteStatusRequest + */ - /** - * Constructs a new GetDataContractResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse - * @classdesc Represents a GetDataContractResponseV0. - * @implements IGetDataContractResponseV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0=} [properties] Properties to set - */ - function GetDataContractResponseV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new VoteStatusRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0 + * @classdesc Represents a VoteStatusRequest. + * @implements IVoteStatusRequest + * @constructor + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IVoteStatusRequest=} [properties] Properties to set + */ + function VoteStatusRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * GetDataContractResponseV0 dataContract. - * @member {Uint8Array} dataContract - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @instance - */ - GetDataContractResponseV0.prototype.dataContract = $util.newBuffer([]); + /** + * VoteStatusRequest contestedResourceVoteStatusRequest. + * @member {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.IContestedResourceVoteStatusRequest|null|undefined} contestedResourceVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @instance + */ + VoteStatusRequest.prototype.contestedResourceVoteStatusRequest = null; - /** - * GetDataContractResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @instance - */ - GetDataContractResponseV0.prototype.proof = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * GetDataContractResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @instance - */ - GetDataContractResponseV0.prototype.metadata = null; + /** + * VoteStatusRequest requestType. + * @member {"contestedResourceVoteStatusRequest"|undefined} requestType + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @instance + */ + Object.defineProperty(VoteStatusRequest.prototype, "requestType", { + get: $util.oneOfGetter($oneOfFields = ["contestedResourceVoteStatusRequest"]), + set: $util.oneOfSetter($oneOfFields) + }); - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Creates a new VoteStatusRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IVoteStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} VoteStatusRequest instance + */ + VoteStatusRequest.create = function create(properties) { + return new VoteStatusRequest(properties); + }; - /** - * GetDataContractResponseV0 result. - * @member {"dataContract"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @instance - */ - Object.defineProperty(GetDataContractResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["dataContract", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Encodes the specified VoteStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IVoteStatusRequest} message VoteStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoteStatusRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contestedResourceVoteStatusRequest != null && Object.hasOwnProperty.call(message, "contestedResourceVoteStatusRequest")) + $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.encode(message.contestedResourceVoteStatusRequest, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Creates a new GetDataContractResponseV0 instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 instance - */ - GetDataContractResponseV0.create = function create(properties) { - return new GetDataContractResponseV0(properties); - }; + /** + * Encodes the specified VoteStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IVoteStatusRequest} message VoteStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoteStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified GetDataContractResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0} message GetDataContractResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractResponseV0.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataContract != null && Object.hasOwnProperty.call(message, "dataContract")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.dataContract); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * Decodes a VoteStatusRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} VoteStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoteStatusRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contestedResourceVoteStatusRequest = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified GetDataContractResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0} message GetDataContractResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractResponseV0.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a VoteStatusRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} VoteStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoteStatusRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a GetDataContractResponseV0 message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractResponseV0.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.dataContract = reader.bytes(); - break; - case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Verifies a VoteStatusRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VoteStatusRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.contestedResourceVoteStatusRequest != null && message.hasOwnProperty("contestedResourceVoteStatusRequest")) { + properties.requestType = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.verify(message.contestedResourceVoteStatusRequest); + if (error) + return "contestedResourceVoteStatusRequest." + error; + } } - } - return message; - }; + return null; + }; - /** - * Decodes a GetDataContractResponseV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a VoteStatusRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} VoteStatusRequest + */ + VoteStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest(); + if (object.contestedResourceVoteStatusRequest != null) { + if (typeof object.contestedResourceVoteStatusRequest !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.contestedResourceVoteStatusRequest: object expected"); + message.contestedResourceVoteStatusRequest = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.fromObject(object.contestedResourceVoteStatusRequest); + } + return message; + }; - /** - * Verifies a GetDataContractResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetDataContractResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.dataContract != null && message.hasOwnProperty("dataContract")) { - properties.result = 1; - if (!(message.dataContract && typeof message.dataContract.length === "number" || $util.isString(message.dataContract))) - return "dataContract: buffer expected"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; + /** + * Creates a plain object from a VoteStatusRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} message VoteStatusRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VoteStatusRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.contestedResourceVoteStatusRequest != null && message.hasOwnProperty("contestedResourceVoteStatusRequest")) { + object.contestedResourceVoteStatusRequest = $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.toObject(message.contestedResourceVoteStatusRequest, options); + if (options.oneofs) + object.requestType = "contestedResourceVoteStatusRequest"; } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; - - /** - * Creates a GetDataContractResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 - */ - GetDataContractResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0(); - if (object.dataContract != null) - if (typeof object.dataContract === "string") - $util.base64.decode(object.dataContract, message.dataContract = $util.newBuffer($util.base64.length(object.dataContract)), 0); - else if (object.dataContract.length >= 0) - message.dataContract = object.dataContract; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } - return message; - }; + }; - /** - * Creates a plain object from a GetDataContractResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} message GetDataContractResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDataContractResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.dataContract != null && message.hasOwnProperty("dataContract")) { - object.dataContract = options.bytes === String ? $util.base64.encode(message.dataContract, 0, message.dataContract.length) : options.bytes === Array ? Array.prototype.slice.call(message.dataContract) : message.dataContract; - if (options.oneofs) - object.result = "dataContract"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; - }; + /** + * Converts this VoteStatusRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @instance + * @returns {Object.} JSON object + */ + VoteStatusRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetDataContractResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 - * @instance - * @returns {Object.} JSON object - */ - GetDataContractResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + VoteStatusRequest.ContestedResourceVoteStatusRequest = (function() { + + /** + * Properties of a ContestedResourceVoteStatusRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @interface IContestedResourceVoteStatusRequest + * @property {Uint8Array|null} [contractId] ContestedResourceVoteStatusRequest contractId + * @property {string|null} [documentTypeName] ContestedResourceVoteStatusRequest documentTypeName + * @property {string|null} [indexName] ContestedResourceVoteStatusRequest indexName + * @property {Array.|null} [indexValues] ContestedResourceVoteStatusRequest indexValues + * @property {Uint8Array|null} [voterIdentifier] ContestedResourceVoteStatusRequest voterIdentifier + */ + + /** + * Constructs a new ContestedResourceVoteStatusRequest. + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest + * @classdesc Represents a ContestedResourceVoteStatusRequest. + * @implements IContestedResourceVoteStatusRequest + * @constructor + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.IContestedResourceVoteStatusRequest=} [properties] Properties to set + */ + function ContestedResourceVoteStatusRequest(properties) { + this.indexValues = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - return GetDataContractResponseV0; + /** + * ContestedResourceVoteStatusRequest contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @instance + */ + ContestedResourceVoteStatusRequest.prototype.contractId = $util.newBuffer([]); + + /** + * ContestedResourceVoteStatusRequest documentTypeName. + * @member {string} documentTypeName + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @instance + */ + ContestedResourceVoteStatusRequest.prototype.documentTypeName = ""; + + /** + * ContestedResourceVoteStatusRequest indexName. + * @member {string} indexName + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @instance + */ + ContestedResourceVoteStatusRequest.prototype.indexName = ""; + + /** + * ContestedResourceVoteStatusRequest indexValues. + * @member {Array.} indexValues + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @instance + */ + ContestedResourceVoteStatusRequest.prototype.indexValues = $util.emptyArray; + + /** + * ContestedResourceVoteStatusRequest voterIdentifier. + * @member {Uint8Array} voterIdentifier + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @instance + */ + ContestedResourceVoteStatusRequest.prototype.voterIdentifier = $util.newBuffer([]); + + /** + * Creates a new ContestedResourceVoteStatusRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.IContestedResourceVoteStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} ContestedResourceVoteStatusRequest instance + */ + ContestedResourceVoteStatusRequest.create = function create(properties) { + return new ContestedResourceVoteStatusRequest(properties); + }; + + /** + * Encodes the specified ContestedResourceVoteStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.IContestedResourceVoteStatusRequest} message ContestedResourceVoteStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceVoteStatusRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + if (message.documentTypeName != null && Object.hasOwnProperty.call(message, "documentTypeName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentTypeName); + if (message.indexName != null && Object.hasOwnProperty.call(message, "indexName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.indexName); + if (message.indexValues != null && message.indexValues.length) + for (var i = 0; i < message.indexValues.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.indexValues[i]); + if (message.voterIdentifier != null && Object.hasOwnProperty.call(message, "voterIdentifier")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.voterIdentifier); + return writer; + }; + + /** + * Encodes the specified ContestedResourceVoteStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.IContestedResourceVoteStatusRequest} message ContestedResourceVoteStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceVoteStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContestedResourceVoteStatusRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} ContestedResourceVoteStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceVoteStatusRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractId = reader.bytes(); + break; + case 2: + message.documentTypeName = reader.string(); + break; + case 3: + message.indexName = reader.string(); + break; + case 4: + if (!(message.indexValues && message.indexValues.length)) + message.indexValues = []; + message.indexValues.push(reader.bytes()); + break; + case 5: + message.voterIdentifier = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContestedResourceVoteStatusRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} ContestedResourceVoteStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceVoteStatusRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContestedResourceVoteStatusRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContestedResourceVoteStatusRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + if (!$util.isString(message.documentTypeName)) + return "documentTypeName: string expected"; + if (message.indexName != null && message.hasOwnProperty("indexName")) + if (!$util.isString(message.indexName)) + return "indexName: string expected"; + if (message.indexValues != null && message.hasOwnProperty("indexValues")) { + if (!Array.isArray(message.indexValues)) + return "indexValues: array expected"; + for (var i = 0; i < message.indexValues.length; ++i) + if (!(message.indexValues[i] && typeof message.indexValues[i].length === "number" || $util.isString(message.indexValues[i]))) + return "indexValues: buffer[] expected"; + } + if (message.voterIdentifier != null && message.hasOwnProperty("voterIdentifier")) + if (!(message.voterIdentifier && typeof message.voterIdentifier.length === "number" || $util.isString(message.voterIdentifier))) + return "voterIdentifier: buffer expected"; + return null; + }; + + /** + * Creates a ContestedResourceVoteStatusRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} ContestedResourceVoteStatusRequest + */ + ContestedResourceVoteStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest(); + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentTypeName != null) + message.documentTypeName = String(object.documentTypeName); + if (object.indexName != null) + message.indexName = String(object.indexName); + if (object.indexValues) { + if (!Array.isArray(object.indexValues)) + throw TypeError(".org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.indexValues: array expected"); + message.indexValues = []; + for (var i = 0; i < object.indexValues.length; ++i) + if (typeof object.indexValues[i] === "string") + $util.base64.decode(object.indexValues[i], message.indexValues[i] = $util.newBuffer($util.base64.length(object.indexValues[i])), 0); + else if (object.indexValues[i].length >= 0) + message.indexValues[i] = object.indexValues[i]; + } + if (object.voterIdentifier != null) + if (typeof object.voterIdentifier === "string") + $util.base64.decode(object.voterIdentifier, message.voterIdentifier = $util.newBuffer($util.base64.length(object.voterIdentifier)), 0); + else if (object.voterIdentifier.length >= 0) + message.voterIdentifier = object.voterIdentifier; + return message; + }; + + /** + * Creates a plain object from a ContestedResourceVoteStatusRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} message ContestedResourceVoteStatusRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContestedResourceVoteStatusRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.indexValues = []; + if (options.defaults) { + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + object.documentTypeName = ""; + object.indexName = ""; + if (options.bytes === String) + object.voterIdentifier = ""; + else { + object.voterIdentifier = []; + if (options.bytes !== Array) + object.voterIdentifier = $util.newBuffer(object.voterIdentifier); + } + } + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + object.documentTypeName = message.documentTypeName; + if (message.indexName != null && message.hasOwnProperty("indexName")) + object.indexName = message.indexName; + if (message.indexValues && message.indexValues.length) { + object.indexValues = []; + for (var j = 0; j < message.indexValues.length; ++j) + object.indexValues[j] = options.bytes === String ? $util.base64.encode(message.indexValues[j], 0, message.indexValues[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.indexValues[j]) : message.indexValues[j]; + } + if (message.voterIdentifier != null && message.hasOwnProperty("voterIdentifier")) + object.voterIdentifier = options.bytes === String ? $util.base64.encode(message.voterIdentifier, 0, message.voterIdentifier.length) : options.bytes === Array ? Array.prototype.slice.call(message.voterIdentifier) : message.voterIdentifier; + return object; + }; + + /** + * Converts this ContestedResourceVoteStatusRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest + * @instance + * @returns {Object.} JSON object + */ + ContestedResourceVoteStatusRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ContestedResourceVoteStatusRequest; + })(); + + return VoteStatusRequest; + })(); + + return GetProofsRequestV0; })(); - return GetDataContractResponse; + return GetProofsRequest; })(); - v0.GetDataContractsRequest = (function() { + v0.GetProofsResponse = (function() { /** - * Properties of a GetDataContractsRequest. + * Properties of a GetProofsResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetDataContractsRequest - * @property {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0|null} [v0] GetDataContractsRequest v0 + * @interface IGetProofsResponse + * @property {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0|null} [v0] GetProofsResponse v0 */ /** - * Constructs a new GetDataContractsRequest. + * Constructs a new GetProofsResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDataContractsRequest. - * @implements IGetDataContractsRequest + * @classdesc Represents a GetProofsResponse. + * @implements IGetProofsResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetProofsResponse=} [properties] Properties to set */ - function GetDataContractsRequest(properties) { + function GetProofsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11423,89 +13085,89 @@ $root.org = (function() { } /** - * GetDataContractsRequest v0. - * @member {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * GetProofsResponse v0. + * @member {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @instance */ - GetDataContractsRequest.prototype.v0 = null; + GetProofsResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetDataContractsRequest version. + * GetProofsResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @instance */ - Object.defineProperty(GetDataContractsRequest.prototype, "version", { + Object.defineProperty(GetProofsResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetDataContractsRequest instance using the specified properties. + * Creates a new GetProofsResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest instance + * @param {org.dash.platform.dapi.v0.IGetProofsResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse instance */ - GetDataContractsRequest.create = function create(properties) { - return new GetDataContractsRequest(properties); + GetProofsResponse.create = function create(properties) { + return new GetProofsResponse(properties); }; /** - * Encodes the specified GetDataContractsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.verify|verify} messages. + * Encodes the specified GetProofsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest} message GetDataContractsRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProofsResponse} message GetProofsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsRequest.encode = function encode(message, writer) { + GetProofsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDataContractsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.verify|verify} messages. + * Encodes the specified GetProofsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest} message GetDataContractsRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProofsResponse} message GetProofsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetProofsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDataContractsRequest message from the specified reader or buffer. + * Decodes a GetProofsResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest + * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsRequest.decode = function decode(reader, length) { + GetProofsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -11516,37 +13178,37 @@ $root.org = (function() { }; /** - * Decodes a GetDataContractsRequest message from the specified reader or buffer, length delimited. + * Decodes a GetProofsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest + * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsRequest.decodeDelimited = function decodeDelimited(reader) { + GetProofsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDataContractsRequest message. + * Verifies a GetProofsResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDataContractsRequest.verify = function verify(message) { + GetProofsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -11555,40 +13217,40 @@ $root.org = (function() { }; /** - * Creates a GetDataContractsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetProofsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest + * @returns {org.dash.platform.dapi.v0.GetProofsResponse} GetProofsResponse */ - GetDataContractsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsRequest) + GetProofsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetProofsResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetProofsResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetDataContractsRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetProofsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsRequest} message GetDataContractsRequest + * @param {org.dash.platform.dapi.v0.GetProofsResponse} message GetProofsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDataContractsRequest.toObject = function toObject(message, options) { + GetProofsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -11596,36 +13258,35 @@ $root.org = (function() { }; /** - * Converts this GetDataContractsRequest to JSON. + * Converts this GetProofsResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @memberof org.dash.platform.dapi.v0.GetProofsResponse * @instance * @returns {Object.} JSON object */ - GetDataContractsRequest.prototype.toJSON = function toJSON() { + GetProofsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetDataContractsRequest.GetDataContractsRequestV0 = (function() { + GetProofsResponse.GetProofsResponseV0 = (function() { /** - * Properties of a GetDataContractsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest - * @interface IGetDataContractsRequestV0 - * @property {Array.|null} [ids] GetDataContractsRequestV0 ids - * @property {boolean|null} [prove] GetDataContractsRequestV0 prove + * Properties of a GetProofsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @interface IGetProofsResponseV0 + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProofsResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProofsResponseV0 metadata */ /** - * Constructs a new GetDataContractsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest - * @classdesc Represents a GetDataContractsRequestV0. - * @implements IGetDataContractsRequestV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0=} [properties] Properties to set + * Constructs a new GetProofsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProofsResponse + * @classdesc Represents a GetProofsResponseV0. + * @implements IGetProofsResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0=} [properties] Properties to set */ - function GetDataContractsRequestV0(properties) { - this.ids = []; + function GetProofsResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11633,91 +13294,102 @@ $root.org = (function() { } /** - * GetDataContractsRequestV0 ids. - * @member {Array.} ids - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * GetProofsResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @instance */ - GetDataContractsRequestV0.prototype.ids = $util.emptyArray; + GetProofsResponseV0.prototype.proof = null; /** - * GetDataContractsRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * GetProofsResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @instance */ - GetDataContractsRequestV0.prototype.prove = false; + GetProofsResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new GetDataContractsRequestV0 instance using the specified properties. + * GetProofsResponseV0 result. + * @member {"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 + * @instance + */ + Object.defineProperty(GetProofsResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProofsResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 instance */ - GetDataContractsRequestV0.create = function create(properties) { - return new GetDataContractsRequestV0(properties); + GetProofsResponseV0.create = function create(properties) { + return new GetProofsResponseV0(properties); }; /** - * Encodes the specified GetDataContractsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.verify|verify} messages. + * Encodes the specified GetProofsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0} message GetDataContractsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0} message GetProofsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsRequestV0.encode = function encode(message, writer) { + GetProofsResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ids != null && message.ids.length) - for (var i = 0; i < message.ids.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ids[i]); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDataContractsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.verify|verify} messages. + * Encodes the specified GetProofsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0} message GetDataContractsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProofsResponse.IGetProofsResponseV0} message GetProofsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetProofsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDataContractsRequestV0 message from the specified reader or buffer. + * Decodes a GetProofsResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsRequestV0.decode = function decode(reader, length) { + GetProofsResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.ids && message.ids.length)) - message.ids = []; - message.ids.push(reader.bytes()); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); break; case 2: - message.prove = reader.bool(); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -11728,134 +13400,134 @@ $root.org = (function() { }; /** - * Decodes a GetDataContractsRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetProofsResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetProofsResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDataContractsRequestV0 message. + * Verifies a GetProofsResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDataContractsRequestV0.verify = function verify(message) { + GetProofsResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ids != null && message.hasOwnProperty("ids")) { - if (!Array.isArray(message.ids)) - return "ids: array expected"; - for (var i = 0; i < message.ids.length; ++i) - if (!(message.ids[i] && typeof message.ids[i].length === "number" || $util.isString(message.ids[i]))) - return "ids: buffer[] expected"; + var properties = {}; + if (message.proof != null && message.hasOwnProperty("proof")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; } - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; return null; }; /** - * Creates a GetDataContractsRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetProofsResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} GetProofsResponseV0 */ - GetDataContractsRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0) + GetProofsResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0(); - if (object.ids) { - if (!Array.isArray(object.ids)) - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.ids: array expected"); - message.ids = []; - for (var i = 0; i < object.ids.length; ++i) - if (typeof object.ids[i] === "string") - $util.base64.decode(object.ids[i], message.ids[i] = $util.newBuffer($util.base64.length(object.ids[i])), 0); - else if (object.ids[i].length >= 0) - message.ids[i] = object.ids[i]; + var message = new $root.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0(); + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } - if (object.prove != null) - message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetDataContractsRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetProofsResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} message GetDataContractsRequestV0 + * @param {org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} message GetProofsResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDataContractsRequestV0.toObject = function toObject(message, options) { + GetProofsResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.ids = []; if (options.defaults) - object.prove = false; - if (message.ids && message.ids.length) { - object.ids = []; - for (var j = 0; j < message.ids.length; ++j) - object.ids[j] = options.bytes === String ? $util.base64.encode(message.ids[j], 0, message.ids[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.ids[j]) : message.ids[j]; + object.metadata = null; + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; } - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this GetDataContractsRequestV0 to JSON. + * Converts this GetProofsResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0 * @instance * @returns {Object.} JSON object */ - GetDataContractsRequestV0.prototype.toJSON = function toJSON() { + GetProofsResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetDataContractsRequestV0; + return GetProofsResponseV0; })(); - return GetDataContractsRequest; + return GetProofsResponse; })(); - v0.GetDataContractsResponse = (function() { + v0.GetDataContractRequest = (function() { /** - * Properties of a GetDataContractsResponse. + * Properties of a GetDataContractRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetDataContractsResponse - * @property {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0|null} [v0] GetDataContractsResponse v0 + * @interface IGetDataContractRequest + * @property {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0|null} [v0] GetDataContractRequest v0 */ /** - * Constructs a new GetDataContractsResponse. + * Constructs a new GetDataContractRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDataContractsResponse. - * @implements IGetDataContractsResponse + * @classdesc Represents a GetDataContractRequest. + * @implements IGetDataContractRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetDataContractRequest=} [properties] Properties to set */ - function GetDataContractsResponse(properties) { + function GetDataContractRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11863,89 +13535,89 @@ $root.org = (function() { } /** - * GetDataContractsResponse v0. - * @member {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * GetDataContractRequest v0. + * @member {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @instance */ - GetDataContractsResponse.prototype.v0 = null; + GetDataContractRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetDataContractsResponse version. + * GetDataContractRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @instance */ - Object.defineProperty(GetDataContractsResponse.prototype, "version", { + Object.defineProperty(GetDataContractRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetDataContractsResponse instance using the specified properties. + * Creates a new GetDataContractRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse instance + * @param {org.dash.platform.dapi.v0.IGetDataContractRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest instance */ - GetDataContractsResponse.create = function create(properties) { - return new GetDataContractsResponse(properties); + GetDataContractRequest.create = function create(properties) { + return new GetDataContractRequest(properties); }; /** - * Encodes the specified GetDataContractsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.verify|verify} messages. + * Encodes the specified GetDataContractRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse} message GetDataContractsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetDataContractRequest} message GetDataContractRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsResponse.encode = function encode(message, writer) { + GetDataContractRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDataContractsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.verify|verify} messages. + * Encodes the specified GetDataContractRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse} message GetDataContractsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetDataContractRequest} message GetDataContractRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDataContractsResponse message from the specified reader or buffer. + * Decodes a GetDataContractRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsResponse.decode = function decode(reader, length) { + GetDataContractRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -11956,37 +13628,37 @@ $root.org = (function() { }; /** - * Decodes a GetDataContractsResponse message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsResponse.decodeDelimited = function decodeDelimited(reader) { + GetDataContractRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDataContractsResponse message. + * Verifies a GetDataContractRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDataContractsResponse.verify = function verify(message) { + GetDataContractRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -11995,40 +13667,40 @@ $root.org = (function() { }; /** - * Creates a GetDataContractsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetDataContractRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest} GetDataContractRequest */ - GetDataContractsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse) + GetDataContractRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetDataContractsResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetDataContractRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse} message GetDataContractsResponse + * @param {org.dash.platform.dapi.v0.GetDataContractRequest} message GetDataContractRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDataContractsResponse.toObject = function toObject(message, options) { + GetDataContractRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -12036,35 +13708,35 @@ $root.org = (function() { }; /** - * Converts this GetDataContractsResponse to JSON. + * Converts this GetDataContractRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest * @instance * @returns {Object.} JSON object */ - GetDataContractsResponse.prototype.toJSON = function toJSON() { + GetDataContractRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetDataContractsResponse.DataContractEntry = (function() { + GetDataContractRequest.GetDataContractRequestV0 = (function() { /** - * Properties of a DataContractEntry. - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse - * @interface IDataContractEntry - * @property {Uint8Array|null} [identifier] DataContractEntry identifier - * @property {google.protobuf.IBytesValue|null} [dataContract] DataContractEntry dataContract + * Properties of a GetDataContractRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest + * @interface IGetDataContractRequestV0 + * @property {Uint8Array|null} [id] GetDataContractRequestV0 id + * @property {boolean|null} [prove] GetDataContractRequestV0 prove */ /** - * Constructs a new DataContractEntry. - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse - * @classdesc Represents a DataContractEntry. - * @implements IDataContractEntry + * Constructs a new GetDataContractRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest + * @classdesc Represents a GetDataContractRequestV0. + * @implements IGetDataContractRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0=} [properties] Properties to set */ - function DataContractEntry(properties) { + function GetDataContractRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12072,88 +13744,88 @@ $root.org = (function() { } /** - * DataContractEntry identifier. - * @member {Uint8Array} identifier - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * GetDataContractRequestV0 id. + * @member {Uint8Array} id + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @instance */ - DataContractEntry.prototype.identifier = $util.newBuffer([]); + GetDataContractRequestV0.prototype.id = $util.newBuffer([]); /** - * DataContractEntry dataContract. - * @member {google.protobuf.IBytesValue|null|undefined} dataContract - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * GetDataContractRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @instance */ - DataContractEntry.prototype.dataContract = null; + GetDataContractRequestV0.prototype.prove = false; /** - * Creates a new DataContractEntry instance using the specified properties. + * Creates a new GetDataContractRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry instance + * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 instance */ - DataContractEntry.create = function create(properties) { - return new DataContractEntry(properties); + GetDataContractRequestV0.create = function create(properties) { + return new GetDataContractRequestV0(properties); }; /** - * Encodes the specified DataContractEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.verify|verify} messages. + * Encodes the specified GetDataContractRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry} message DataContractEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0} message GetDataContractRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DataContractEntry.encode = function encode(message, writer) { + GetDataContractRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identifier != null && Object.hasOwnProperty.call(message, "identifier")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identifier); - if (message.dataContract != null && Object.hasOwnProperty.call(message, "dataContract")) - $root.google.protobuf.BytesValue.encode(message.dataContract, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified DataContractEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.verify|verify} messages. + * Encodes the specified GetDataContractRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry} message DataContractEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractRequest.IGetDataContractRequestV0} message GetDataContractRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DataContractEntry.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DataContractEntry message from the specified reader or buffer. + * Decodes a GetDataContractRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DataContractEntry.decode = function decode(reader, length) { + GetDataContractRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identifier = reader.bytes(); + message.id = reader.bytes(); break; case 2: - message.dataContract = $root.google.protobuf.BytesValue.decode(reader, reader.uint32()); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -12164,131 +13836,338 @@ $root.org = (function() { }; /** - * Decodes a DataContractEntry message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DataContractEntry.decodeDelimited = function decodeDelimited(reader) { + GetDataContractRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DataContractEntry message. + * Verifies a GetDataContractRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DataContractEntry.verify = function verify(message) { + GetDataContractRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.identifier != null && message.hasOwnProperty("identifier")) - if (!(message.identifier && typeof message.identifier.length === "number" || $util.isString(message.identifier))) - return "identifier: buffer expected"; - if (message.dataContract != null && message.hasOwnProperty("dataContract")) { - var error = $root.google.protobuf.BytesValue.verify(message.dataContract); - if (error) - return "dataContract." + error; - } + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a DataContractEntry message from a plain object. Also converts values to their respective internal types. + * Creates a GetDataContractRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry + * @returns {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} GetDataContractRequestV0 */ - DataContractEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry) + GetDataContractRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry(); - if (object.identifier != null) - if (typeof object.identifier === "string") - $util.base64.decode(object.identifier, message.identifier = $util.newBuffer($util.base64.length(object.identifier)), 0); - else if (object.identifier.length >= 0) - message.identifier = object.identifier; - if (object.dataContract != null) { - if (typeof object.dataContract !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.dataContract: object expected"); - message.dataContract = $root.google.protobuf.BytesValue.fromObject(object.dataContract); - } + var message = new $root.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length >= 0) + message.id = object.id; + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a DataContractEntry message. Also converts values to other types if specified. + * Creates a plain object from a GetDataContractRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} message DataContractEntry + * @param {org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} message GetDataContractRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DataContractEntry.toObject = function toObject(message, options) { + GetDataContractRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) - object.identifier = ""; + object.id = ""; else { - object.identifier = []; + object.id = []; if (options.bytes !== Array) - object.identifier = $util.newBuffer(object.identifier); + object.id = $util.newBuffer(object.id); } - object.dataContract = null; + object.prove = false; } - if (message.identifier != null && message.hasOwnProperty("identifier")) - object.identifier = options.bytes === String ? $util.base64.encode(message.identifier, 0, message.identifier.length) : options.bytes === Array ? Array.prototype.slice.call(message.identifier) : message.identifier; - if (message.dataContract != null && message.hasOwnProperty("dataContract")) - object.dataContract = $root.google.protobuf.BytesValue.toObject(message.dataContract, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this DataContractEntry to JSON. + * Converts this GetDataContractRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry + * @memberof org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0 * @instance * @returns {Object.} JSON object */ - DataContractEntry.prototype.toJSON = function toJSON() { + GetDataContractRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DataContractEntry; + return GetDataContractRequestV0; })(); - GetDataContractsResponse.DataContracts = (function() { + return GetDataContractRequest; + })(); - /** - * Properties of a DataContracts. - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse - * @interface IDataContracts - * @property {Array.|null} [dataContractEntries] DataContracts dataContractEntries - */ + v0.GetDataContractResponse = (function() { - /** - * Constructs a new DataContracts. - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse - * @classdesc Represents a DataContracts. - * @implements IDataContracts - * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts=} [properties] Properties to set + /** + * Properties of a GetDataContractResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetDataContractResponse + * @property {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0|null} [v0] GetDataContractResponse v0 + */ + + /** + * Constructs a new GetDataContractResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetDataContractResponse. + * @implements IGetDataContractResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetDataContractResponse=} [properties] Properties to set + */ + function GetDataContractResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDataContractResponse v0. + * @member {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @instance + */ + GetDataContractResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDataContractResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @instance + */ + Object.defineProperty(GetDataContractResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDataContractResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse instance + */ + GetDataContractResponse.create = function create(properties) { + return new GetDataContractResponse(properties); + }; + + /** + * Encodes the specified GetDataContractResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractResponse} message GetDataContractResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetDataContractResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractResponse} message GetDataContractResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDataContractResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDataContractResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDataContractResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDataContractResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetDataContractResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse} GetDataContractResponse + */ + GetDataContractResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetDataContractResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractResponse} message GetDataContractResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDataContractResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetDataContractResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @instance + * @returns {Object.} JSON object + */ + GetDataContractResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetDataContractResponse.GetDataContractResponseV0 = (function() { + + /** + * Properties of a GetDataContractResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @interface IGetDataContractResponseV0 + * @property {Uint8Array|null} [dataContract] GetDataContractResponseV0 dataContract + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDataContractResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDataContractResponseV0 metadata */ - function DataContracts(properties) { - this.dataContractEntries = []; + + /** + * Constructs a new GetDataContractResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse + * @classdesc Represents a GetDataContractResponseV0. + * @implements IGetDataContractResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0=} [properties] Properties to set + */ + function GetDataContractResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12296,78 +14175,115 @@ $root.org = (function() { } /** - * DataContracts dataContractEntries. - * @member {Array.} dataContractEntries - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * GetDataContractResponseV0 dataContract. + * @member {Uint8Array} dataContract + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @instance */ - DataContracts.prototype.dataContractEntries = $util.emptyArray; + GetDataContractResponseV0.prototype.dataContract = $util.newBuffer([]); /** - * Creates a new DataContracts instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts instance + * GetDataContractResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 + * @instance */ - DataContracts.create = function create(properties) { - return new DataContracts(properties); - }; + GetDataContractResponseV0.prototype.proof = null; /** - * Encodes the specified DataContracts message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts} message DataContracts message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to + * GetDataContractResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 + * @instance + */ + GetDataContractResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDataContractResponseV0 result. + * @member {"dataContract"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 + * @instance + */ + Object.defineProperty(GetDataContractResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["dataContract", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDataContractResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 instance + */ + GetDataContractResponseV0.create = function create(properties) { + return new GetDataContractResponseV0(properties); + }; + + /** + * Encodes the specified GetDataContractResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0} message GetDataContractResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DataContracts.encode = function encode(message, writer) { + GetDataContractResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dataContractEntries != null && message.dataContractEntries.length) - for (var i = 0; i < message.dataContractEntries.length; ++i) - $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.encode(message.dataContractEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.dataContract != null && Object.hasOwnProperty.call(message, "dataContract")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.dataContract); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified DataContracts message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.verify|verify} messages. + * Encodes the specified GetDataContractResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts} message DataContracts message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractResponse.IGetDataContractResponseV0} message GetDataContractResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DataContracts.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DataContracts message from the specified reader or buffer. + * Decodes a GetDataContractResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DataContracts.decode = function decode(reader, length) { + GetDataContractResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.dataContractEntries && message.dataContractEntries.length)) - message.dataContractEntries = []; - message.dataContractEntries.push($root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.decode(reader, reader.uint32())); + message.dataContract = reader.bytes(); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -12378,242 +14294,453 @@ $root.org = (function() { }; /** - * Decodes a DataContracts message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DataContracts.decodeDelimited = function decodeDelimited(reader) { + GetDataContractResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DataContracts message. + * Verifies a GetDataContractResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DataContracts.verify = function verify(message) { + GetDataContractResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.dataContractEntries != null && message.hasOwnProperty("dataContractEntries")) { - if (!Array.isArray(message.dataContractEntries)) - return "dataContractEntries: array expected"; - for (var i = 0; i < message.dataContractEntries.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.verify(message.dataContractEntries[i]); + var properties = {}; + if (message.dataContract != null && message.hasOwnProperty("dataContract")) { + properties.result = 1; + if (!(message.dataContract && typeof message.dataContract.length === "number" || $util.isString(message.dataContract))) + return "dataContract: buffer expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); if (error) - return "dataContractEntries." + error; + return "proof." + error; } } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } return null; }; /** - * Creates a DataContracts message from a plain object. Also converts values to their respective internal types. + * Creates a GetDataContractResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts + * @returns {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} GetDataContractResponseV0 */ - DataContracts.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts) + GetDataContractResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts(); - if (object.dataContractEntries) { - if (!Array.isArray(object.dataContractEntries)) - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.dataContractEntries: array expected"); - message.dataContractEntries = []; - for (var i = 0; i < object.dataContractEntries.length; ++i) { - if (typeof object.dataContractEntries[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.dataContractEntries: object expected"); - message.dataContractEntries[i] = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.fromObject(object.dataContractEntries[i]); - } + var message = new $root.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0(); + if (object.dataContract != null) + if (typeof object.dataContract === "string") + $util.base64.decode(object.dataContract, message.dataContract = $util.newBuffer($util.base64.length(object.dataContract)), 0); + else if (object.dataContract.length >= 0) + message.dataContract = object.dataContract; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a DataContracts message. Also converts values to other types if specified. + * Creates a plain object from a GetDataContractResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} message DataContracts + * @param {org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} message GetDataContractResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DataContracts.toObject = function toObject(message, options) { + GetDataContractResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.dataContractEntries = []; - if (message.dataContractEntries && message.dataContractEntries.length) { - object.dataContractEntries = []; - for (var j = 0; j < message.dataContractEntries.length; ++j) - object.dataContractEntries[j] = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject(message.dataContractEntries[j], options); + if (options.defaults) + object.metadata = null; + if (message.dataContract != null && message.hasOwnProperty("dataContract")) { + object.dataContract = options.bytes === String ? $util.base64.encode(message.dataContract, 0, message.dataContract.length) : options.bytes === Array ? Array.prototype.slice.call(message.dataContract) : message.dataContract; + if (options.oneofs) + object.result = "dataContract"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this DataContracts to JSON. + * Converts this GetDataContractResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0 * @instance * @returns {Object.} JSON object */ - DataContracts.prototype.toJSON = function toJSON() { + GetDataContractResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DataContracts; + return GetDataContractResponseV0; })(); - GetDataContractsResponse.GetDataContractsResponseV0 = (function() { + return GetDataContractResponse; + })(); - /** - * Properties of a GetDataContractsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse - * @interface IGetDataContractsResponseV0 - * @property {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts|null} [dataContracts] GetDataContractsResponseV0 dataContracts - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDataContractsResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDataContractsResponseV0 metadata - */ + v0.GetDataContractsRequest = (function() { - /** - * Constructs a new GetDataContractsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse - * @classdesc Represents a GetDataContractsResponseV0. - * @implements IGetDataContractsResponseV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0=} [properties] Properties to set - */ - function GetDataContractsResponseV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a GetDataContractsRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetDataContractsRequest + * @property {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0|null} [v0] GetDataContractsRequest v0 + */ - /** - * GetDataContractsResponseV0 dataContracts. - * @member {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts|null|undefined} dataContracts - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 - * @instance - */ - GetDataContractsResponseV0.prototype.dataContracts = null; + /** + * Constructs a new GetDataContractsRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetDataContractsRequest. + * @implements IGetDataContractsRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest=} [properties] Properties to set + */ + function GetDataContractsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * GetDataContractsResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 - * @instance - */ - GetDataContractsResponseV0.prototype.proof = null; + /** + * GetDataContractsRequest v0. + * @member {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @instance + */ + GetDataContractsRequest.prototype.v0 = null; - /** - * GetDataContractsResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 - * @instance + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDataContractsRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @instance + */ + Object.defineProperty(GetDataContractsRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDataContractsRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest instance + */ + GetDataContractsRequest.create = function create(properties) { + return new GetDataContractsRequest(properties); + }; + + /** + * Encodes the specified GetDataContractsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest} message GetDataContractsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetDataContractsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractsRequest} message GetDataContractsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDataContractsRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDataContractsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDataContractsRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDataContractsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetDataContractsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest} GetDataContractsRequest + */ + GetDataContractsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetDataContractsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractsRequest} message GetDataContractsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDataContractsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetDataContractsRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @instance + * @returns {Object.} JSON object + */ + GetDataContractsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetDataContractsRequest.GetDataContractsRequestV0 = (function() { + + /** + * Properties of a GetDataContractsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @interface IGetDataContractsRequestV0 + * @property {Array.|null} [ids] GetDataContractsRequestV0 ids + * @property {boolean|null} [prove] GetDataContractsRequestV0 prove */ - GetDataContractsResponseV0.prototype.metadata = null; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Constructs a new GetDataContractsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest + * @classdesc Represents a GetDataContractsRequestV0. + * @implements IGetDataContractsRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0=} [properties] Properties to set + */ + function GetDataContractsRequestV0(properties) { + this.ids = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * GetDataContractsResponseV0 result. - * @member {"dataContracts"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * GetDataContractsRequestV0 ids. + * @member {Array.} ids + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @instance */ - Object.defineProperty(GetDataContractsResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["dataContracts", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetDataContractsRequestV0.prototype.ids = $util.emptyArray; /** - * Creates a new GetDataContractsResponseV0 instance using the specified properties. + * GetDataContractsRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 + * @instance + */ + GetDataContractsRequestV0.prototype.prove = false; + + /** + * Creates a new GetDataContractsRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 instance */ - GetDataContractsResponseV0.create = function create(properties) { - return new GetDataContractsResponseV0(properties); + GetDataContractsRequestV0.create = function create(properties) { + return new GetDataContractsRequestV0(properties); }; /** - * Encodes the specified GetDataContractsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.verify|verify} messages. + * Encodes the specified GetDataContractsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0} message GetDataContractsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0} message GetDataContractsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsResponseV0.encode = function encode(message, writer) { + GetDataContractsRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dataContracts != null && Object.hasOwnProperty.call(message, "dataContracts")) - $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.encode(message.dataContracts, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.ids != null && message.ids.length) + for (var i = 0; i < message.ids.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ids[i]); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetDataContractsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.verify|verify} messages. + * Encodes the specified GetDataContractsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0} message GetDataContractsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.IGetDataContractsRequestV0} message GetDataContractsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDataContractsResponseV0 message from the specified reader or buffer. + * Decodes a GetDataContractsRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsResponseV0.decode = function decode(reader, length) { + GetDataContractsRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dataContracts = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.decode(reader, reader.uint32()); + if (!(message.ids && message.ids.length)) + message.ids = []; + message.ids.push(reader.bytes()); break; case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -12624,154 +14751,134 @@ $root.org = (function() { }; /** - * Decodes a GetDataContractsResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractsRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractsResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetDataContractsRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDataContractsResponseV0 message. + * Verifies a GetDataContractsRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDataContractsResponseV0.verify = function verify(message) { + GetDataContractsRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.dataContracts != null && message.hasOwnProperty("dataContracts")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.verify(message.dataContracts); - if (error) - return "dataContracts." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; + if (message.ids != null && message.hasOwnProperty("ids")) { + if (!Array.isArray(message.ids)) + return "ids: array expected"; + for (var i = 0; i < message.ids.length; ++i) + if (!(message.ids[i] && typeof message.ids[i].length === "number" || $util.isString(message.ids[i]))) + return "ids: buffer[] expected"; } + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetDataContractsResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetDataContractsRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} GetDataContractsRequestV0 */ - GetDataContractsResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0) + GetDataContractsRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0(); - if (object.dataContracts != null) { - if (typeof object.dataContracts !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.dataContracts: object expected"); - message.dataContracts = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.fromObject(object.dataContracts); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + var message = new $root.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0(); + if (object.ids) { + if (!Array.isArray(object.ids)) + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.ids: array expected"); + message.ids = []; + for (var i = 0; i < object.ids.length; ++i) + if (typeof object.ids[i] === "string") + $util.base64.decode(object.ids[i], message.ids[i] = $util.newBuffer($util.base64.length(object.ids[i])), 0); + else if (object.ids[i].length >= 0) + message.ids[i] = object.ids[i]; } + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetDataContractsResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetDataContractsRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} message GetDataContractsResponseV0 + * @param {org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} message GetDataContractsRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDataContractsResponseV0.toObject = function toObject(message, options) { + GetDataContractsRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.ids = []; if (options.defaults) - object.metadata = null; - if (message.dataContracts != null && message.hasOwnProperty("dataContracts")) { - object.dataContracts = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(message.dataContracts, options); - if (options.oneofs) - object.result = "dataContracts"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; + object.prove = false; + if (message.ids && message.ids.length) { + object.ids = []; + for (var j = 0; j < message.ids.length; ++j) + object.ids[j] = options.bytes === String ? $util.base64.encode(message.ids[j], 0, message.ids[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.ids[j]) : message.ids[j]; } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetDataContractsResponseV0 to JSON. + * Converts this GetDataContractsRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0 * @instance * @returns {Object.} JSON object */ - GetDataContractsResponseV0.prototype.toJSON = function toJSON() { + GetDataContractsRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetDataContractsResponseV0; + return GetDataContractsRequestV0; })(); - return GetDataContractsResponse; + return GetDataContractsRequest; })(); - v0.GetDataContractHistoryRequest = (function() { + v0.GetDataContractsResponse = (function() { /** - * Properties of a GetDataContractHistoryRequest. + * Properties of a GetDataContractsResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetDataContractHistoryRequest - * @property {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0|null} [v0] GetDataContractHistoryRequest v0 + * @interface IGetDataContractsResponse + * @property {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0|null} [v0] GetDataContractsResponse v0 */ /** - * Constructs a new GetDataContractHistoryRequest. + * Constructs a new GetDataContractsResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDataContractHistoryRequest. - * @implements IGetDataContractHistoryRequest + * @classdesc Represents a GetDataContractsResponse. + * @implements IGetDataContractsResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse=} [properties] Properties to set */ - function GetDataContractHistoryRequest(properties) { + function GetDataContractsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12779,89 +14886,89 @@ $root.org = (function() { } /** - * GetDataContractHistoryRequest v0. - * @member {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * GetDataContractsResponse v0. + * @member {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @instance */ - GetDataContractHistoryRequest.prototype.v0 = null; + GetDataContractsResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetDataContractHistoryRequest version. + * GetDataContractsResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @instance */ - Object.defineProperty(GetDataContractHistoryRequest.prototype, "version", { + Object.defineProperty(GetDataContractsResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetDataContractHistoryRequest instance using the specified properties. + * Creates a new GetDataContractsResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest instance + * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse instance */ - GetDataContractHistoryRequest.create = function create(properties) { - return new GetDataContractHistoryRequest(properties); + GetDataContractsResponse.create = function create(properties) { + return new GetDataContractsResponse(properties); }; /** - * Encodes the specified GetDataContractHistoryRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.verify|verify} messages. + * Encodes the specified GetDataContractsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest} message GetDataContractHistoryRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse} message GetDataContractsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractHistoryRequest.encode = function encode(message, writer) { + GetDataContractsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDataContractHistoryRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.verify|verify} messages. + * Encodes the specified GetDataContractsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest} message GetDataContractHistoryRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetDataContractsResponse} message GetDataContractsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractHistoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDataContractHistoryRequest message from the specified reader or buffer. + * Decodes a GetDataContractsResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractHistoryRequest.decode = function decode(reader, length) { + GetDataContractsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -12872,37 +14979,37 @@ $root.org = (function() { }; /** - * Decodes a GetDataContractHistoryRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractHistoryRequest.decodeDelimited = function decodeDelimited(reader) { + GetDataContractsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDataContractHistoryRequest message. + * Verifies a GetDataContractsResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDataContractHistoryRequest.verify = function verify(message) { + GetDataContractsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -12911,40 +15018,40 @@ $root.org = (function() { }; /** - * Creates a GetDataContractHistoryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDataContractsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse} GetDataContractsResponse */ - GetDataContractHistoryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest) + GetDataContractsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetDataContractHistoryRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetDataContractsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} message GetDataContractHistoryRequest + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse} message GetDataContractsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDataContractHistoryRequest.toObject = function toObject(message, options) { + GetDataContractsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -12952,38 +15059,35 @@ $root.org = (function() { }; /** - * Converts this GetDataContractHistoryRequest to JSON. + * Converts this GetDataContractsResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse * @instance * @returns {Object.} JSON object */ - GetDataContractHistoryRequest.prototype.toJSON = function toJSON() { + GetDataContractsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 = (function() { + GetDataContractsResponse.DataContractEntry = (function() { /** - * Properties of a GetDataContractHistoryRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest - * @interface IGetDataContractHistoryRequestV0 - * @property {Uint8Array|null} [id] GetDataContractHistoryRequestV0 id - * @property {google.protobuf.IUInt32Value|null} [limit] GetDataContractHistoryRequestV0 limit - * @property {google.protobuf.IUInt32Value|null} [offset] GetDataContractHistoryRequestV0 offset - * @property {number|Long|null} [startAtMs] GetDataContractHistoryRequestV0 startAtMs - * @property {boolean|null} [prove] GetDataContractHistoryRequestV0 prove + * Properties of a DataContractEntry. + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @interface IDataContractEntry + * @property {Uint8Array|null} [identifier] DataContractEntry identifier + * @property {google.protobuf.IBytesValue|null} [dataContract] DataContractEntry dataContract */ /** - * Constructs a new GetDataContractHistoryRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest - * @classdesc Represents a GetDataContractHistoryRequestV0. - * @implements IGetDataContractHistoryRequestV0 + * Constructs a new DataContractEntry. + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @classdesc Represents a DataContractEntry. + * @implements IDataContractEntry * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry=} [properties] Properties to set */ - function GetDataContractHistoryRequestV0(properties) { + function DataContractEntry(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12991,127 +15095,88 @@ $root.org = (function() { } /** - * GetDataContractHistoryRequestV0 id. - * @member {Uint8Array} id - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 - * @instance - */ - GetDataContractHistoryRequestV0.prototype.id = $util.newBuffer([]); - - /** - * GetDataContractHistoryRequestV0 limit. - * @member {google.protobuf.IUInt32Value|null|undefined} limit - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 - * @instance - */ - GetDataContractHistoryRequestV0.prototype.limit = null; - - /** - * GetDataContractHistoryRequestV0 offset. - * @member {google.protobuf.IUInt32Value|null|undefined} offset - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 - * @instance - */ - GetDataContractHistoryRequestV0.prototype.offset = null; - - /** - * GetDataContractHistoryRequestV0 startAtMs. - * @member {number|Long} startAtMs - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * DataContractEntry identifier. + * @member {Uint8Array} identifier + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @instance */ - GetDataContractHistoryRequestV0.prototype.startAtMs = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + DataContractEntry.prototype.identifier = $util.newBuffer([]); /** - * GetDataContractHistoryRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * DataContractEntry dataContract. + * @member {google.protobuf.IBytesValue|null|undefined} dataContract + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @instance */ - GetDataContractHistoryRequestV0.prototype.prove = false; + DataContractEntry.prototype.dataContract = null; /** - * Creates a new GetDataContractHistoryRequestV0 instance using the specified properties. + * Creates a new DataContractEntry instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry instance */ - GetDataContractHistoryRequestV0.create = function create(properties) { - return new GetDataContractHistoryRequestV0(properties); + DataContractEntry.create = function create(properties) { + return new DataContractEntry(properties); }; /** - * Encodes the specified GetDataContractHistoryRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.verify|verify} messages. + * Encodes the specified DataContractEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0} message GetDataContractHistoryRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry} message DataContractEntry message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractHistoryRequestV0.encode = function encode(message, writer) { + DataContractEntry.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - $root.google.protobuf.UInt32Value.encode(message.limit, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - $root.google.protobuf.UInt32Value.encode(message.offset, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.startAtMs != null && Object.hasOwnProperty.call(message, "startAtMs")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.startAtMs); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.prove); + if (message.identifier != null && Object.hasOwnProperty.call(message, "identifier")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identifier); + if (message.dataContract != null && Object.hasOwnProperty.call(message, "dataContract")) + $root.google.protobuf.BytesValue.encode(message.dataContract, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDataContractHistoryRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.verify|verify} messages. + * Encodes the specified DataContractEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0} message GetDataContractHistoryRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContractEntry} message DataContractEntry message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractHistoryRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + DataContractEntry.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDataContractHistoryRequestV0 message from the specified reader or buffer. + * Decodes a DataContractEntry message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractHistoryRequestV0.decode = function decode(reader, length) { + DataContractEntry.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.bytes(); + message.identifier = reader.bytes(); break; case 2: - message.limit = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); - break; - case 3: - message.offset = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); - break; - case 4: - message.startAtMs = reader.uint64(); - break; - case 5: - message.prove = reader.bool(); + message.dataContract = $root.google.protobuf.BytesValue.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -13122,386 +15187,340 @@ $root.org = (function() { }; /** - * Decodes a GetDataContractHistoryRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a DataContractEntry message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractHistoryRequestV0.decodeDelimited = function decodeDelimited(reader) { + DataContractEntry.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDataContractHistoryRequestV0 message. + * Verifies a DataContractEntry message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDataContractHistoryRequestV0.verify = function verify(message) { + DataContractEntry.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) - return "id: buffer expected"; - if (message.limit != null && message.hasOwnProperty("limit")) { - var error = $root.google.protobuf.UInt32Value.verify(message.limit); - if (error) - return "limit." + error; - } - if (message.offset != null && message.hasOwnProperty("offset")) { - var error = $root.google.protobuf.UInt32Value.verify(message.offset); + if (message.identifier != null && message.hasOwnProperty("identifier")) + if (!(message.identifier && typeof message.identifier.length === "number" || $util.isString(message.identifier))) + return "identifier: buffer expected"; + if (message.dataContract != null && message.hasOwnProperty("dataContract")) { + var error = $root.google.protobuf.BytesValue.verify(message.dataContract); if (error) - return "offset." + error; + return "dataContract." + error; } - if (message.startAtMs != null && message.hasOwnProperty("startAtMs")) - if (!$util.isInteger(message.startAtMs) && !(message.startAtMs && $util.isInteger(message.startAtMs.low) && $util.isInteger(message.startAtMs.high))) - return "startAtMs: integer|Long expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; return null; }; /** - * Creates a GetDataContractHistoryRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a DataContractEntry message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} DataContractEntry */ - GetDataContractHistoryRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0) + DataContractEntry.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0(); - if (object.id != null) - if (typeof object.id === "string") - $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); - else if (object.id.length >= 0) - message.id = object.id; - if (object.limit != null) { - if (typeof object.limit !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.limit: object expected"); - message.limit = $root.google.protobuf.UInt32Value.fromObject(object.limit); - } - if (object.offset != null) { - if (typeof object.offset !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.offset: object expected"); - message.offset = $root.google.protobuf.UInt32Value.fromObject(object.offset); + var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry(); + if (object.identifier != null) + if (typeof object.identifier === "string") + $util.base64.decode(object.identifier, message.identifier = $util.newBuffer($util.base64.length(object.identifier)), 0); + else if (object.identifier.length >= 0) + message.identifier = object.identifier; + if (object.dataContract != null) { + if (typeof object.dataContract !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.dataContract: object expected"); + message.dataContract = $root.google.protobuf.BytesValue.fromObject(object.dataContract); } - if (object.startAtMs != null) - if ($util.Long) - (message.startAtMs = $util.Long.fromValue(object.startAtMs)).unsigned = true; - else if (typeof object.startAtMs === "string") - message.startAtMs = parseInt(object.startAtMs, 10); - else if (typeof object.startAtMs === "number") - message.startAtMs = object.startAtMs; - else if (typeof object.startAtMs === "object") - message.startAtMs = new $util.LongBits(object.startAtMs.low >>> 0, object.startAtMs.high >>> 0).toNumber(true); - if (object.prove != null) - message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetDataContractHistoryRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a DataContractEntry message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} message GetDataContractHistoryRequestV0 + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} message DataContractEntry * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDataContractHistoryRequestV0.toObject = function toObject(message, options) { + DataContractEntry.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) - object.id = ""; + object.identifier = ""; else { - object.id = []; + object.identifier = []; if (options.bytes !== Array) - object.id = $util.newBuffer(object.id); + object.identifier = $util.newBuffer(object.identifier); } - object.limit = null; - object.offset = null; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.startAtMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.startAtMs = options.longs === String ? "0" : 0; - object.prove = false; + object.dataContract = null; } - if (message.id != null && message.hasOwnProperty("id")) - object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = $root.google.protobuf.UInt32Value.toObject(message.limit, options); - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = $root.google.protobuf.UInt32Value.toObject(message.offset, options); - if (message.startAtMs != null && message.hasOwnProperty("startAtMs")) - if (typeof message.startAtMs === "number") - object.startAtMs = options.longs === String ? String(message.startAtMs) : message.startAtMs; - else - object.startAtMs = options.longs === String ? $util.Long.prototype.toString.call(message.startAtMs) : options.longs === Number ? new $util.LongBits(message.startAtMs.low >>> 0, message.startAtMs.high >>> 0).toNumber(true) : message.startAtMs; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; + if (message.identifier != null && message.hasOwnProperty("identifier")) + object.identifier = options.bytes === String ? $util.base64.encode(message.identifier, 0, message.identifier.length) : options.bytes === Array ? Array.prototype.slice.call(message.identifier) : message.identifier; + if (message.dataContract != null && message.hasOwnProperty("dataContract")) + object.dataContract = $root.google.protobuf.BytesValue.toObject(message.dataContract, options); return object; }; /** - * Converts this GetDataContractHistoryRequestV0 to JSON. + * Converts this DataContractEntry to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry * @instance * @returns {Object.} JSON object */ - GetDataContractHistoryRequestV0.prototype.toJSON = function toJSON() { + DataContractEntry.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetDataContractHistoryRequestV0; + return DataContractEntry; })(); - return GetDataContractHistoryRequest; - })(); + GetDataContractsResponse.DataContracts = (function() { - v0.GetDataContractHistoryResponse = (function() { + /** + * Properties of a DataContracts. + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @interface IDataContracts + * @property {Array.|null} [dataContractEntries] DataContracts dataContractEntries + */ - /** - * Properties of a GetDataContractHistoryResponse. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetDataContractHistoryResponse - * @property {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0|null} [v0] GetDataContractHistoryResponse v0 - */ + /** + * Constructs a new DataContracts. + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @classdesc Represents a DataContracts. + * @implements IDataContracts + * @constructor + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts=} [properties] Properties to set + */ + function DataContracts(properties) { + this.dataContractEntries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new GetDataContractHistoryResponse. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDataContractHistoryResponse. - * @implements IGetDataContractHistoryResponse - * @constructor - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse=} [properties] Properties to set - */ - function GetDataContractHistoryResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * DataContracts dataContractEntries. + * @member {Array.} dataContractEntries + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @instance + */ + DataContracts.prototype.dataContractEntries = $util.emptyArray; - /** - * GetDataContractHistoryResponse v0. - * @member {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @instance - */ - GetDataContractHistoryResponse.prototype.v0 = null; + /** + * Creates a new DataContracts instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts instance + */ + DataContracts.create = function create(properties) { + return new DataContracts(properties); + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Encodes the specified DataContracts message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts} message DataContracts message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataContracts.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataContractEntries != null && message.dataContractEntries.length) + for (var i = 0; i < message.dataContractEntries.length; ++i) + $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.encode(message.dataContractEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * GetDataContractHistoryResponse version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @instance - */ - Object.defineProperty(GetDataContractHistoryResponse.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Encodes the specified DataContracts message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts} message DataContracts message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataContracts.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new GetDataContractHistoryResponse instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse instance - */ - GetDataContractHistoryResponse.create = function create(properties) { - return new GetDataContractHistoryResponse(properties); - }; + /** + * Decodes a DataContracts message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataContracts.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.dataContractEntries && message.dataContractEntries.length)) + message.dataContractEntries = []; + message.dataContractEntries.push($root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified GetDataContractHistoryResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse} message GetDataContractHistoryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractHistoryResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Decodes a DataContracts message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataContracts.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified GetDataContractHistoryResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse} message GetDataContractHistoryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDataContractHistoryResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Verifies a DataContracts message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DataContracts.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataContractEntries != null && message.hasOwnProperty("dataContractEntries")) { + if (!Array.isArray(message.dataContractEntries)) + return "dataContractEntries: array expected"; + for (var i = 0; i < message.dataContractEntries.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.verify(message.dataContractEntries[i]); + if (error) + return "dataContractEntries." + error; + } + } + return null; + }; - /** - * Decodes a GetDataContractHistoryResponse message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractHistoryResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Creates a DataContracts message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} DataContracts + */ + DataContracts.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts(); + if (object.dataContractEntries) { + if (!Array.isArray(object.dataContractEntries)) + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.dataContractEntries: array expected"); + message.dataContractEntries = []; + for (var i = 0; i < object.dataContractEntries.length; ++i) { + if (typeof object.dataContractEntries[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.dataContractEntries: object expected"); + message.dataContractEntries[i] = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.fromObject(object.dataContractEntries[i]); + } } - } - return message; - }; - - /** - * Decodes a GetDataContractHistoryResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDataContractHistoryResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a GetDataContractHistoryResponse message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetDataContractHistoryResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.verify(message.v0); - if (error) - return "v0." + error; + /** + * Creates a plain object from a DataContracts message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} message DataContracts + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DataContracts.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.dataContractEntries = []; + if (message.dataContractEntries && message.dataContractEntries.length) { + object.dataContractEntries = []; + for (var j = 0; j < message.dataContractEntries.length; ++j) + object.dataContractEntries[j] = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject(message.dataContractEntries[j], options); } - } - return null; - }; - - /** - * Creates a GetDataContractHistoryResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse - */ - GetDataContractHistoryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.fromObject(object.v0); - } - return message; - }; + }; - /** - * Creates a plain object from a GetDataContractHistoryResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} message GetDataContractHistoryResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDataContractHistoryResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Converts this DataContracts to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts + * @instance + * @returns {Object.} JSON object + */ + DataContracts.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetDataContractHistoryResponse to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @instance - * @returns {Object.} JSON object - */ - GetDataContractHistoryResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return DataContracts; + })(); - GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 = (function() { + GetDataContractsResponse.GetDataContractsResponseV0 = (function() { /** - * Properties of a GetDataContractHistoryResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @interface IGetDataContractHistoryResponseV0 - * @property {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory|null} [dataContractHistory] GetDataContractHistoryResponseV0 dataContractHistory - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDataContractHistoryResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDataContractHistoryResponseV0 metadata + * Properties of a GetDataContractsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @interface IGetDataContractsResponseV0 + * @property {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts|null} [dataContracts] GetDataContractsResponseV0 dataContracts + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDataContractsResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDataContractsResponseV0 metadata */ /** - * Constructs a new GetDataContractHistoryResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse - * @classdesc Represents a GetDataContractHistoryResponseV0. - * @implements IGetDataContractHistoryResponseV0 + * Constructs a new GetDataContractsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse + * @classdesc Represents a GetDataContractsResponseV0. + * @implements IGetDataContractsResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0=} [properties] Properties to set */ - function GetDataContractHistoryResponseV0(properties) { + function GetDataContractsResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13509,69 +15528,69 @@ $root.org = (function() { } /** - * GetDataContractHistoryResponseV0 dataContractHistory. - * @member {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory|null|undefined} dataContractHistory - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * GetDataContractsResponseV0 dataContracts. + * @member {org.dash.platform.dapi.v0.GetDataContractsResponse.IDataContracts|null|undefined} dataContracts + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @instance */ - GetDataContractHistoryResponseV0.prototype.dataContractHistory = null; + GetDataContractsResponseV0.prototype.dataContracts = null; /** - * GetDataContractHistoryResponseV0 proof. + * GetDataContractsResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @instance */ - GetDataContractHistoryResponseV0.prototype.proof = null; + GetDataContractsResponseV0.prototype.proof = null; /** - * GetDataContractHistoryResponseV0 metadata. + * GetDataContractsResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @instance */ - GetDataContractHistoryResponseV0.prototype.metadata = null; + GetDataContractsResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetDataContractHistoryResponseV0 result. - * @member {"dataContractHistory"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * GetDataContractsResponseV0 result. + * @member {"dataContracts"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @instance */ - Object.defineProperty(GetDataContractHistoryResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["dataContractHistory", "proof"]), + Object.defineProperty(GetDataContractsResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["dataContracts", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetDataContractHistoryResponseV0 instance using the specified properties. + * Creates a new GetDataContractsResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 instance */ - GetDataContractHistoryResponseV0.create = function create(properties) { - return new GetDataContractHistoryResponseV0(properties); + GetDataContractsResponseV0.create = function create(properties) { + return new GetDataContractsResponseV0(properties); }; /** - * Encodes the specified GetDataContractHistoryResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.verify|verify} messages. + * Encodes the specified GetDataContractsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0} message GetDataContractHistoryResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0} message GetDataContractsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractHistoryResponseV0.encode = function encode(message, writer) { + GetDataContractsResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dataContractHistory != null && Object.hasOwnProperty.call(message, "dataContractHistory")) - $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.encode(message.dataContractHistory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.dataContracts != null && Object.hasOwnProperty.call(message, "dataContracts")) + $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.encode(message.dataContracts, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -13580,38 +15599,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetDataContractHistoryResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.verify|verify} messages. + * Encodes the specified GetDataContractsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0} message GetDataContractHistoryResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.IGetDataContractsResponseV0} message GetDataContractsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDataContractHistoryResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDataContractHistoryResponseV0 message from the specified reader or buffer. + * Decodes a GetDataContractsResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractHistoryResponseV0.decode = function decode(reader, length) { + GetDataContractsResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dataContractHistory = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.decode(reader, reader.uint32()); + message.dataContracts = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.decode(reader, reader.uint32()); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -13628,39 +15647,39 @@ $root.org = (function() { }; /** - * Decodes a GetDataContractHistoryResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractsResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDataContractHistoryResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetDataContractsResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDataContractHistoryResponseV0 message. + * Verifies a GetDataContractsResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDataContractHistoryResponseV0.verify = function verify(message) { + GetDataContractsResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.dataContractHistory != null && message.hasOwnProperty("dataContractHistory")) { + if (message.dataContracts != null && message.hasOwnProperty("dataContracts")) { properties.result = 1; { - var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.verify(message.dataContractHistory); + var error = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.verify(message.dataContracts); if (error) - return "dataContractHistory." + error; + return "dataContracts." + error; } } if (message.proof != null && message.hasOwnProperty("proof")) { @@ -13682,54 +15701,54 @@ $root.org = (function() { }; /** - * Creates a GetDataContractHistoryResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetDataContractsResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} GetDataContractsResponseV0 */ - GetDataContractHistoryResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0) + GetDataContractsResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0(); - if (object.dataContractHistory != null) { - if (typeof object.dataContractHistory !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.dataContractHistory: object expected"); - message.dataContractHistory = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.fromObject(object.dataContractHistory); + var message = new $root.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0(); + if (object.dataContracts != null) { + if (typeof object.dataContracts !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.dataContracts: object expected"); + message.dataContracts = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.fromObject(object.dataContracts); } if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetDataContractHistoryResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetDataContractsResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} message GetDataContractHistoryResponseV0 + * @param {org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} message GetDataContractsResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDataContractHistoryResponseV0.toObject = function toObject(message, options) { + GetDataContractsResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; - if (message.dataContractHistory != null && message.hasOwnProperty("dataContractHistory")) { - object.dataContractHistory = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(message.dataContractHistory, options); + if (message.dataContracts != null && message.hasOwnProperty("dataContracts")) { + object.dataContracts = $root.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(message.dataContracts, options); if (options.oneofs) - object.result = "dataContractHistory"; + object.result = "dataContracts"; } if (message.proof != null && message.hasOwnProperty("proof")) { object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); @@ -13742,481 +15761,560 @@ $root.org = (function() { }; /** - * Converts this GetDataContractHistoryResponseV0 to JSON. + * Converts this GetDataContractsResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0 * @instance * @returns {Object.} JSON object */ - GetDataContractHistoryResponseV0.prototype.toJSON = function toJSON() { + GetDataContractsResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetDataContractHistoryResponseV0.DataContractHistoryEntry = (function() { + return GetDataContractsResponseV0; + })(); - /** - * Properties of a DataContractHistoryEntry. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 - * @interface IDataContractHistoryEntry - * @property {number|Long|null} [date] DataContractHistoryEntry date - * @property {Uint8Array|null} [value] DataContractHistoryEntry value - */ + return GetDataContractsResponse; + })(); - /** - * Constructs a new DataContractHistoryEntry. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 - * @classdesc Represents a DataContractHistoryEntry. - * @implements IDataContractHistoryEntry - * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry=} [properties] Properties to set - */ - function DataContractHistoryEntry(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v0.GetDataContractHistoryRequest = (function() { - /** - * DataContractHistoryEntry date. - * @member {number|Long} date - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @instance - */ - DataContractHistoryEntry.prototype.date = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + /** + * Properties of a GetDataContractHistoryRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetDataContractHistoryRequest + * @property {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0|null} [v0] GetDataContractHistoryRequest v0 + */ - /** - * DataContractHistoryEntry value. - * @member {Uint8Array} value - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @instance - */ - DataContractHistoryEntry.prototype.value = $util.newBuffer([]); + /** + * Constructs a new GetDataContractHistoryRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetDataContractHistoryRequest. + * @implements IGetDataContractHistoryRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest=} [properties] Properties to set + */ + function GetDataContractHistoryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new DataContractHistoryEntry instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry instance - */ - DataContractHistoryEntry.create = function create(properties) { - return new DataContractHistoryEntry(properties); - }; + /** + * GetDataContractHistoryRequest v0. + * @member {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @instance + */ + GetDataContractHistoryRequest.prototype.v0 = null; - /** - * Encodes the specified DataContractHistoryEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry} message DataContractHistoryEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataContractHistoryEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.date != null && Object.hasOwnProperty.call(message, "date")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.date); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - return writer; - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Encodes the specified DataContractHistoryEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry} message DataContractHistoryEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataContractHistoryEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * GetDataContractHistoryRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @instance + */ + Object.defineProperty(GetDataContractHistoryRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Decodes a DataContractHistoryEntry message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataContractHistoryEntry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.date = reader.uint64(); - break; - case 2: - message.value = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new GetDataContractHistoryRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest instance + */ + GetDataContractHistoryRequest.create = function create(properties) { + return new GetDataContractHistoryRequest(properties); + }; - /** - * Decodes a DataContractHistoryEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataContractHistoryEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified GetDataContractHistoryRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest} message GetDataContractHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractHistoryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Verifies a DataContractHistoryEntry message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DataContractHistoryEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.date != null && message.hasOwnProperty("date")) - if (!$util.isInteger(message.date) && !(message.date && $util.isInteger(message.date.low) && $util.isInteger(message.date.high))) - return "date: integer|Long expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates a DataContractHistoryEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry - */ - DataContractHistoryEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry(); - if (object.date != null) - if ($util.Long) - (message.date = $util.Long.fromValue(object.date)).unsigned = true; - else if (typeof object.date === "string") - message.date = parseInt(object.date, 10); - else if (typeof object.date === "number") - message.date = object.date; - else if (typeof object.date === "object") - message.date = new $util.LongBits(object.date.low >>> 0, object.date.high >>> 0).toNumber(true); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length >= 0) - message.value = object.value; - return message; - }; + /** + * Encodes the specified GetDataContractHistoryRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryRequest} message GetDataContractHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractHistoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a plain object from a DataContractHistoryEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} message DataContractHistoryEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DataContractHistoryEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.date = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.date = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - } - if (message.date != null && message.hasOwnProperty("date")) - if (typeof message.date === "number") - object.date = options.longs === String ? String(message.date) : message.date; - else - object.date = options.longs === String ? $util.Long.prototype.toString.call(message.date) : options.longs === Number ? new $util.LongBits(message.date.low >>> 0, message.date.high >>> 0).toNumber(true) : message.date; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; + /** + * Decodes a GetDataContractHistoryRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractHistoryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Converts this DataContractHistoryEntry to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry - * @instance - * @returns {Object.} JSON object - */ - DataContractHistoryEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Decodes a GetDataContractHistoryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractHistoryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - return DataContractHistoryEntry; - })(); + /** + * Verifies a GetDataContractHistoryRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDataContractHistoryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; - GetDataContractHistoryResponseV0.DataContractHistory = (function() { + /** + * Creates a GetDataContractHistoryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} GetDataContractHistoryRequest + */ + GetDataContractHistoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.fromObject(object.v0); + } + return message; + }; - /** - * Properties of a DataContractHistory. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 - * @interface IDataContractHistory - * @property {Array.|null} [dataContractEntries] DataContractHistory dataContractEntries - */ + /** + * Creates a plain object from a GetDataContractHistoryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest} message GetDataContractHistoryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDataContractHistoryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; - /** - * Constructs a new DataContractHistory. - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 - * @classdesc Represents a DataContractHistory. - * @implements IDataContractHistory - * @constructor - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory=} [properties] Properties to set - */ - function DataContractHistory(properties) { - this.dataContractEntries = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Converts this GetDataContractHistoryRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @instance + * @returns {Object.} JSON object + */ + GetDataContractHistoryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * DataContractHistory dataContractEntries. - * @member {Array.} dataContractEntries - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @instance - */ - DataContractHistory.prototype.dataContractEntries = $util.emptyArray; + GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 = (function() { - /** - * Creates a new DataContractHistory instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory instance - */ - DataContractHistory.create = function create(properties) { - return new DataContractHistory(properties); - }; - - /** - * Encodes the specified DataContractHistory message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory} message DataContractHistory message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataContractHistory.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataContractEntries != null && message.dataContractEntries.length) - for (var i = 0; i < message.dataContractEntries.length; ++i) - $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.encode(message.dataContractEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DataContractHistory message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory} message DataContractHistory message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataContractHistory.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a GetDataContractHistoryRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @interface IGetDataContractHistoryRequestV0 + * @property {Uint8Array|null} [id] GetDataContractHistoryRequestV0 id + * @property {google.protobuf.IUInt32Value|null} [limit] GetDataContractHistoryRequestV0 limit + * @property {google.protobuf.IUInt32Value|null} [offset] GetDataContractHistoryRequestV0 offset + * @property {number|Long|null} [startAtMs] GetDataContractHistoryRequestV0 startAtMs + * @property {boolean|null} [prove] GetDataContractHistoryRequestV0 prove + */ - /** - * Decodes a DataContractHistory message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataContractHistory.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.dataContractEntries && message.dataContractEntries.length)) - message.dataContractEntries = []; - message.dataContractEntries.push($root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Constructs a new GetDataContractHistoryRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest + * @classdesc Represents a GetDataContractHistoryRequestV0. + * @implements IGetDataContractHistoryRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0=} [properties] Properties to set + */ + function GetDataContractHistoryRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes a DataContractHistory message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataContractHistory.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * GetDataContractHistoryRequestV0 id. + * @member {Uint8Array} id + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @instance + */ + GetDataContractHistoryRequestV0.prototype.id = $util.newBuffer([]); - /** - * Verifies a DataContractHistory message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DataContractHistory.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataContractEntries != null && message.hasOwnProperty("dataContractEntries")) { - if (!Array.isArray(message.dataContractEntries)) - return "dataContractEntries: array expected"; - for (var i = 0; i < message.dataContractEntries.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.verify(message.dataContractEntries[i]); - if (error) - return "dataContractEntries." + error; - } - } - return null; - }; + /** + * GetDataContractHistoryRequestV0 limit. + * @member {google.protobuf.IUInt32Value|null|undefined} limit + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @instance + */ + GetDataContractHistoryRequestV0.prototype.limit = null; - /** - * Creates a DataContractHistory message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory - */ - DataContractHistory.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory(); - if (object.dataContractEntries) { - if (!Array.isArray(object.dataContractEntries)) - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.dataContractEntries: array expected"); - message.dataContractEntries = []; - for (var i = 0; i < object.dataContractEntries.length; ++i) { - if (typeof object.dataContractEntries[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.dataContractEntries: object expected"); - message.dataContractEntries[i] = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.fromObject(object.dataContractEntries[i]); - } - } - return message; - }; + /** + * GetDataContractHistoryRequestV0 offset. + * @member {google.protobuf.IUInt32Value|null|undefined} offset + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @instance + */ + GetDataContractHistoryRequestV0.prototype.offset = null; - /** - * Creates a plain object from a DataContractHistory message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @static - * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} message DataContractHistory - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DataContractHistory.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dataContractEntries = []; - if (message.dataContractEntries && message.dataContractEntries.length) { - object.dataContractEntries = []; - for (var j = 0; j < message.dataContractEntries.length; ++j) - object.dataContractEntries[j] = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject(message.dataContractEntries[j], options); - } - return object; - }; + /** + * GetDataContractHistoryRequestV0 startAtMs. + * @member {number|Long} startAtMs + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @instance + */ + GetDataContractHistoryRequestV0.prototype.startAtMs = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - /** - * Converts this DataContractHistory to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory - * @instance - * @returns {Object.} JSON object - */ - DataContractHistory.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * GetDataContractHistoryRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @instance + */ + GetDataContractHistoryRequestV0.prototype.prove = false; - return DataContractHistory; - })(); + /** + * Creates a new GetDataContractHistoryRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 instance + */ + GetDataContractHistoryRequestV0.create = function create(properties) { + return new GetDataContractHistoryRequestV0(properties); + }; - return GetDataContractHistoryResponseV0; - })(); + /** + * Encodes the specified GetDataContractHistoryRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0} message GetDataContractHistoryRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractHistoryRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + $root.google.protobuf.UInt32Value.encode(message.limit, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + $root.google.protobuf.UInt32Value.encode(message.offset, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.startAtMs != null && Object.hasOwnProperty.call(message, "startAtMs")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.startAtMs); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.prove); + return writer; + }; - return GetDataContractHistoryResponse; + /** + * Encodes the specified GetDataContractHistoryRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.IGetDataContractHistoryRequestV0} message GetDataContractHistoryRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDataContractHistoryRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDataContractHistoryRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractHistoryRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.bytes(); + break; + case 2: + message.limit = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + break; + case 3: + message.offset = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + break; + case 4: + message.startAtMs = reader.uint64(); + break; + case 5: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDataContractHistoryRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDataContractHistoryRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDataContractHistoryRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDataContractHistoryRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; + if (message.limit != null && message.hasOwnProperty("limit")) { + var error = $root.google.protobuf.UInt32Value.verify(message.limit); + if (error) + return "limit." + error; + } + if (message.offset != null && message.hasOwnProperty("offset")) { + var error = $root.google.protobuf.UInt32Value.verify(message.offset); + if (error) + return "offset." + error; + } + if (message.startAtMs != null && message.hasOwnProperty("startAtMs")) + if (!$util.isInteger(message.startAtMs) && !(message.startAtMs && $util.isInteger(message.startAtMs.low) && $util.isInteger(message.startAtMs.high))) + return "startAtMs: integer|Long expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetDataContractHistoryRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} GetDataContractHistoryRequestV0 + */ + GetDataContractHistoryRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length >= 0) + message.id = object.id; + if (object.limit != null) { + if (typeof object.limit !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.limit: object expected"); + message.limit = $root.google.protobuf.UInt32Value.fromObject(object.limit); + } + if (object.offset != null) { + if (typeof object.offset !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.offset: object expected"); + message.offset = $root.google.protobuf.UInt32Value.fromObject(object.offset); + } + if (object.startAtMs != null) + if ($util.Long) + (message.startAtMs = $util.Long.fromValue(object.startAtMs)).unsigned = true; + else if (typeof object.startAtMs === "string") + message.startAtMs = parseInt(object.startAtMs, 10); + else if (typeof object.startAtMs === "number") + message.startAtMs = object.startAtMs; + else if (typeof object.startAtMs === "object") + message.startAtMs = new $util.LongBits(object.startAtMs.low >>> 0, object.startAtMs.high >>> 0).toNumber(true); + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetDataContractHistoryRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} message GetDataContractHistoryRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDataContractHistoryRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.id = ""; + else { + object.id = []; + if (options.bytes !== Array) + object.id = $util.newBuffer(object.id); + } + object.limit = null; + object.offset = null; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.startAtMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startAtMs = options.longs === String ? "0" : 0; + object.prove = false; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = $root.google.protobuf.UInt32Value.toObject(message.limit, options); + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = $root.google.protobuf.UInt32Value.toObject(message.offset, options); + if (message.startAtMs != null && message.hasOwnProperty("startAtMs")) + if (typeof message.startAtMs === "number") + object.startAtMs = options.longs === String ? String(message.startAtMs) : message.startAtMs; + else + object.startAtMs = options.longs === String ? $util.Long.prototype.toString.call(message.startAtMs) : options.longs === Number ? new $util.LongBits(message.startAtMs.low >>> 0, message.startAtMs.high >>> 0).toNumber(true) : message.startAtMs; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetDataContractHistoryRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetDataContractHistoryRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetDataContractHistoryRequestV0; + })(); + + return GetDataContractHistoryRequest; })(); - v0.GetDocumentsRequest = (function() { + v0.GetDataContractHistoryResponse = (function() { /** - * Properties of a GetDocumentsRequest. + * Properties of a GetDataContractHistoryResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetDocumentsRequest - * @property {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0|null} [v0] GetDocumentsRequest v0 + * @interface IGetDataContractHistoryResponse + * @property {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0|null} [v0] GetDataContractHistoryResponse v0 */ /** - * Constructs a new GetDocumentsRequest. + * Constructs a new GetDataContractHistoryResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDocumentsRequest. - * @implements IGetDocumentsRequest + * @classdesc Represents a GetDataContractHistoryResponse. + * @implements IGetDataContractHistoryResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse=} [properties] Properties to set */ - function GetDocumentsRequest(properties) { + function GetDataContractHistoryResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14224,89 +16322,89 @@ $root.org = (function() { } /** - * GetDocumentsRequest v0. - * @member {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * GetDataContractHistoryResponse v0. + * @member {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @instance */ - GetDocumentsRequest.prototype.v0 = null; + GetDataContractHistoryResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetDocumentsRequest version. + * GetDataContractHistoryResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @instance */ - Object.defineProperty(GetDocumentsRequest.prototype, "version", { + Object.defineProperty(GetDataContractHistoryResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetDocumentsRequest instance using the specified properties. + * Creates a new GetDataContractHistoryResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest instance + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse instance */ - GetDocumentsRequest.create = function create(properties) { - return new GetDocumentsRequest(properties); + GetDataContractHistoryResponse.create = function create(properties) { + return new GetDataContractHistoryResponse(properties); }; /** - * Encodes the specified GetDocumentsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.verify|verify} messages. + * Encodes the specified GetDataContractHistoryResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest} message GetDocumentsRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse} message GetDataContractHistoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsRequest.encode = function encode(message, writer) { + GetDataContractHistoryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDocumentsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.verify|verify} messages. + * Encodes the specified GetDataContractHistoryResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static - * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest} message GetDocumentsRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetDataContractHistoryResponse} message GetDataContractHistoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractHistoryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDocumentsRequest message from the specified reader or buffer. + * Decodes a GetDataContractHistoryResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsRequest.decode = function decode(reader, length) { + GetDataContractHistoryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -14317,37 +16415,37 @@ $root.org = (function() { }; /** - * Decodes a GetDocumentsRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractHistoryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + GetDataContractHistoryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDocumentsRequest message. + * Verifies a GetDataContractHistoryResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDocumentsRequest.verify = function verify(message) { + GetDataContractHistoryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -14356,40 +16454,40 @@ $root.org = (function() { }; /** - * Creates a GetDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDataContractHistoryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} GetDataContractHistoryResponse */ - GetDocumentsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsRequest) + GetDataContractHistoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetDocumentsRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetDataContractHistoryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsRequest} message GetDocumentsRequest + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse} message GetDataContractHistoryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDocumentsRequest.toObject = function toObject(message, options) { + GetDataContractHistoryResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -14397,41 +16495,36 @@ $root.org = (function() { }; /** - * Converts this GetDocumentsRequest to JSON. + * Converts this GetDataContractHistoryResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse * @instance * @returns {Object.} JSON object */ - GetDocumentsRequest.prototype.toJSON = function toJSON() { + GetDataContractHistoryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetDocumentsRequest.GetDocumentsRequestV0 = (function() { + GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 = (function() { /** - * Properties of a GetDocumentsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest - * @interface IGetDocumentsRequestV0 - * @property {Uint8Array|null} [dataContractId] GetDocumentsRequestV0 dataContractId - * @property {string|null} [documentType] GetDocumentsRequestV0 documentType - * @property {Uint8Array|null} [where] GetDocumentsRequestV0 where - * @property {Uint8Array|null} [orderBy] GetDocumentsRequestV0 orderBy - * @property {number|null} [limit] GetDocumentsRequestV0 limit - * @property {Uint8Array|null} [startAfter] GetDocumentsRequestV0 startAfter - * @property {Uint8Array|null} [startAt] GetDocumentsRequestV0 startAt - * @property {boolean|null} [prove] GetDocumentsRequestV0 prove + * Properties of a GetDataContractHistoryResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse + * @interface IGetDataContractHistoryResponseV0 + * @property {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory|null} [dataContractHistory] GetDataContractHistoryResponseV0 dataContractHistory + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDataContractHistoryResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDataContractHistoryResponseV0 metadata */ /** - * Constructs a new GetDocumentsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest - * @classdesc Represents a GetDocumentsRequestV0. - * @implements IGetDocumentsRequestV0 + * Constructs a new GetDataContractHistoryResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse + * @classdesc Represents a GetDataContractHistoryResponseV0. + * @implements IGetDataContractHistoryResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0=} [properties] Properties to set */ - function GetDocumentsRequestV0(properties) { + function GetDataContractHistoryResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14439,183 +16532,118 @@ $root.org = (function() { } /** - * GetDocumentsRequestV0 dataContractId. - * @member {Uint8Array} dataContractId - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @instance - */ - GetDocumentsRequestV0.prototype.dataContractId = $util.newBuffer([]); - - /** - * GetDocumentsRequestV0 documentType. - * @member {string} documentType - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @instance - */ - GetDocumentsRequestV0.prototype.documentType = ""; - - /** - * GetDocumentsRequestV0 where. - * @member {Uint8Array} where - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @instance - */ - GetDocumentsRequestV0.prototype.where = $util.newBuffer([]); - - /** - * GetDocumentsRequestV0 orderBy. - * @member {Uint8Array} orderBy - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @instance - */ - GetDocumentsRequestV0.prototype.orderBy = $util.newBuffer([]); - - /** - * GetDocumentsRequestV0 limit. - * @member {number} limit - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @instance - */ - GetDocumentsRequestV0.prototype.limit = 0; - - /** - * GetDocumentsRequestV0 startAfter. - * @member {Uint8Array} startAfter - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * GetDataContractHistoryResponseV0 dataContractHistory. + * @member {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory|null|undefined} dataContractHistory + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @instance */ - GetDocumentsRequestV0.prototype.startAfter = $util.newBuffer([]); + GetDataContractHistoryResponseV0.prototype.dataContractHistory = null; /** - * GetDocumentsRequestV0 startAt. - * @member {Uint8Array} startAt - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * GetDataContractHistoryResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @instance */ - GetDocumentsRequestV0.prototype.startAt = $util.newBuffer([]); + GetDataContractHistoryResponseV0.prototype.proof = null; /** - * GetDocumentsRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * GetDataContractHistoryResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @instance */ - GetDocumentsRequestV0.prototype.prove = false; + GetDataContractHistoryResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetDocumentsRequestV0 start. - * @member {"startAfter"|"startAt"|undefined} start - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * GetDataContractHistoryResponseV0 result. + * @member {"dataContractHistory"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @instance */ - Object.defineProperty(GetDocumentsRequestV0.prototype, "start", { - get: $util.oneOfGetter($oneOfFields = ["startAfter", "startAt"]), + Object.defineProperty(GetDataContractHistoryResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["dataContractHistory", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetDocumentsRequestV0 instance using the specified properties. + * Creates a new GetDataContractHistoryResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 instance */ - GetDocumentsRequestV0.create = function create(properties) { - return new GetDocumentsRequestV0(properties); + GetDataContractHistoryResponseV0.create = function create(properties) { + return new GetDataContractHistoryResponseV0(properties); }; /** - * Encodes the specified GetDocumentsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.verify|verify} messages. + * Encodes the specified GetDataContractHistoryResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0} message GetDocumentsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0} message GetDataContractHistoryResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsRequestV0.encode = function encode(message, writer) { + GetDataContractHistoryResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dataContractId != null && Object.hasOwnProperty.call(message, "dataContractId")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.dataContractId); - if (message.documentType != null && Object.hasOwnProperty.call(message, "documentType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentType); - if (message.where != null && Object.hasOwnProperty.call(message, "where")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.where); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.orderBy); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.limit); - if (message.startAfter != null && Object.hasOwnProperty.call(message, "startAfter")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.startAfter); - if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.startAt); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 8, wireType 0 =*/64).bool(message.prove); + if (message.dataContractHistory != null && Object.hasOwnProperty.call(message, "dataContractHistory")) + $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.encode(message.dataContractHistory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDocumentsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.verify|verify} messages. + * Encodes the specified GetDataContractHistoryResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0} message GetDocumentsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.IGetDataContractHistoryResponseV0} message GetDataContractHistoryResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetDataContractHistoryResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDocumentsRequestV0 message from the specified reader or buffer. + * Decodes a GetDataContractHistoryResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsRequestV0.decode = function decode(reader, length) { + GetDataContractHistoryResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dataContractId = reader.bytes(); + message.dataContractHistory = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.decode(reader, reader.uint32()); break; case 2: - message.documentType = reader.string(); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); break; case 3: - message.where = reader.bytes(); - break; - case 4: - message.orderBy = reader.bytes(); - break; - case 5: - message.limit = reader.uint32(); - break; - case 6: - message.startAfter = reader.bytes(); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; - case 7: - message.startAt = reader.bytes(); - break; - case 8: - message.prove = reader.bool(); - break; - default: - reader.skipType(tag & 7); + default: + reader.skipType(tag & 7); break; } } @@ -14623,211 +16651,9188 @@ $root.org = (function() { }; /** - * Decodes a GetDocumentsRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetDataContractHistoryResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetDataContractHistoryResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDocumentsRequestV0 message. + * Verifies a GetDataContractHistoryResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDocumentsRequestV0.verify = function verify(message) { + GetDataContractHistoryResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.dataContractId != null && message.hasOwnProperty("dataContractId")) - if (!(message.dataContractId && typeof message.dataContractId.length === "number" || $util.isString(message.dataContractId))) - return "dataContractId: buffer expected"; - if (message.documentType != null && message.hasOwnProperty("documentType")) - if (!$util.isString(message.documentType)) - return "documentType: string expected"; - if (message.where != null && message.hasOwnProperty("where")) - if (!(message.where && typeof message.where.length === "number" || $util.isString(message.where))) - return "where: buffer expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!(message.orderBy && typeof message.orderBy.length === "number" || $util.isString(message.orderBy))) - return "orderBy: buffer expected"; - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit)) - return "limit: integer expected"; - if (message.startAfter != null && message.hasOwnProperty("startAfter")) { - properties.start = 1; - if (!(message.startAfter && typeof message.startAfter.length === "number" || $util.isString(message.startAfter))) - return "startAfter: buffer expected"; + if (message.dataContractHistory != null && message.hasOwnProperty("dataContractHistory")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.verify(message.dataContractHistory); + if (error) + return "dataContractHistory." + error; + } } - if (message.startAt != null && message.hasOwnProperty("startAt")) { - if (properties.start === 1) - return "start: multiple values"; - properties.start = 1; - if (!(message.startAt && typeof message.startAt.length === "number" || $util.isString(message.startAt))) - return "startAt: buffer expected"; + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; } - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; return null; }; - /** - * Creates a GetDocumentsRequestV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 - */ - GetDocumentsRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0(); - if (object.dataContractId != null) - if (typeof object.dataContractId === "string") - $util.base64.decode(object.dataContractId, message.dataContractId = $util.newBuffer($util.base64.length(object.dataContractId)), 0); - else if (object.dataContractId.length >= 0) - message.dataContractId = object.dataContractId; - if (object.documentType != null) - message.documentType = String(object.documentType); - if (object.where != null) - if (typeof object.where === "string") - $util.base64.decode(object.where, message.where = $util.newBuffer($util.base64.length(object.where)), 0); - else if (object.where.length >= 0) - message.where = object.where; - if (object.orderBy != null) - if (typeof object.orderBy === "string") - $util.base64.decode(object.orderBy, message.orderBy = $util.newBuffer($util.base64.length(object.orderBy)), 0); - else if (object.orderBy.length >= 0) - message.orderBy = object.orderBy; - if (object.limit != null) - message.limit = object.limit >>> 0; - if (object.startAfter != null) - if (typeof object.startAfter === "string") - $util.base64.decode(object.startAfter, message.startAfter = $util.newBuffer($util.base64.length(object.startAfter)), 0); - else if (object.startAfter.length >= 0) - message.startAfter = object.startAfter; - if (object.startAt != null) - if (typeof object.startAt === "string") - $util.base64.decode(object.startAt, message.startAt = $util.newBuffer($util.base64.length(object.startAt)), 0); - else if (object.startAt.length >= 0) - message.startAt = object.startAt; - if (object.prove != null) - message.prove = Boolean(object.prove); - return message; - }; + /** + * Creates a GetDataContractHistoryResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} GetDataContractHistoryResponseV0 + */ + GetDataContractHistoryResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0(); + if (object.dataContractHistory != null) { + if (typeof object.dataContractHistory !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.dataContractHistory: object expected"); + message.dataContractHistory = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.fromObject(object.dataContractHistory); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetDataContractHistoryResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} message GetDataContractHistoryResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDataContractHistoryResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.dataContractHistory != null && message.hasOwnProperty("dataContractHistory")) { + object.dataContractHistory = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(message.dataContractHistory, options); + if (options.oneofs) + object.result = "dataContractHistory"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetDataContractHistoryResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetDataContractHistoryResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetDataContractHistoryResponseV0.DataContractHistoryEntry = (function() { + + /** + * Properties of a DataContractHistoryEntry. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @interface IDataContractHistoryEntry + * @property {number|Long|null} [date] DataContractHistoryEntry date + * @property {Uint8Array|null} [value] DataContractHistoryEntry value + */ + + /** + * Constructs a new DataContractHistoryEntry. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @classdesc Represents a DataContractHistoryEntry. + * @implements IDataContractHistoryEntry + * @constructor + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry=} [properties] Properties to set + */ + function DataContractHistoryEntry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DataContractHistoryEntry date. + * @member {number|Long} date + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @instance + */ + DataContractHistoryEntry.prototype.date = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * DataContractHistoryEntry value. + * @member {Uint8Array} value + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @instance + */ + DataContractHistoryEntry.prototype.value = $util.newBuffer([]); + + /** + * Creates a new DataContractHistoryEntry instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry instance + */ + DataContractHistoryEntry.create = function create(properties) { + return new DataContractHistoryEntry(properties); + }; + + /** + * Encodes the specified DataContractHistoryEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry} message DataContractHistoryEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataContractHistoryEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.date != null && Object.hasOwnProperty.call(message, "date")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.date); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified DataContractHistoryEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistoryEntry} message DataContractHistoryEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataContractHistoryEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DataContractHistoryEntry message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataContractHistoryEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.date = reader.uint64(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DataContractHistoryEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataContractHistoryEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DataContractHistoryEntry message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DataContractHistoryEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.date != null && message.hasOwnProperty("date")) + if (!$util.isInteger(message.date) && !(message.date && $util.isInteger(message.date.low) && $util.isInteger(message.date.high))) + return "date: integer|Long expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a DataContractHistoryEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} DataContractHistoryEntry + */ + DataContractHistoryEntry.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry(); + if (object.date != null) + if ($util.Long) + (message.date = $util.Long.fromValue(object.date)).unsigned = true; + else if (typeof object.date === "string") + message.date = parseInt(object.date, 10); + else if (typeof object.date === "number") + message.date = object.date; + else if (typeof object.date === "object") + message.date = new $util.LongBits(object.date.low >>> 0, object.date.high >>> 0).toNumber(true); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a DataContractHistoryEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} message DataContractHistoryEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DataContractHistoryEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.date = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.date = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.date != null && message.hasOwnProperty("date")) + if (typeof message.date === "number") + object.date = options.longs === String ? String(message.date) : message.date; + else + object.date = options.longs === String ? $util.Long.prototype.toString.call(message.date) : options.longs === Number ? new $util.LongBits(message.date.low >>> 0, message.date.high >>> 0).toNumber(true) : message.date; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this DataContractHistoryEntry to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry + * @instance + * @returns {Object.} JSON object + */ + DataContractHistoryEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DataContractHistoryEntry; + })(); + + GetDataContractHistoryResponseV0.DataContractHistory = (function() { + + /** + * Properties of a DataContractHistory. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @interface IDataContractHistory + * @property {Array.|null} [dataContractEntries] DataContractHistory dataContractEntries + */ + + /** + * Constructs a new DataContractHistory. + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0 + * @classdesc Represents a DataContractHistory. + * @implements IDataContractHistory + * @constructor + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory=} [properties] Properties to set + */ + function DataContractHistory(properties) { + this.dataContractEntries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DataContractHistory dataContractEntries. + * @member {Array.} dataContractEntries + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @instance + */ + DataContractHistory.prototype.dataContractEntries = $util.emptyArray; + + /** + * Creates a new DataContractHistory instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory instance + */ + DataContractHistory.create = function create(properties) { + return new DataContractHistory(properties); + }; + + /** + * Encodes the specified DataContractHistory message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory} message DataContractHistory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataContractHistory.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataContractEntries != null && message.dataContractEntries.length) + for (var i = 0; i < message.dataContractEntries.length; ++i) + $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.encode(message.dataContractEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DataContractHistory message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.IDataContractHistory} message DataContractHistory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataContractHistory.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DataContractHistory message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataContractHistory.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.dataContractEntries && message.dataContractEntries.length)) + message.dataContractEntries = []; + message.dataContractEntries.push($root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DataContractHistory message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataContractHistory.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DataContractHistory message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DataContractHistory.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataContractEntries != null && message.hasOwnProperty("dataContractEntries")) { + if (!Array.isArray(message.dataContractEntries)) + return "dataContractEntries: array expected"; + for (var i = 0; i < message.dataContractEntries.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.verify(message.dataContractEntries[i]); + if (error) + return "dataContractEntries." + error; + } + } + return null; + }; + + /** + * Creates a DataContractHistory message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} DataContractHistory + */ + DataContractHistory.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory(); + if (object.dataContractEntries) { + if (!Array.isArray(object.dataContractEntries)) + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.dataContractEntries: array expected"); + message.dataContractEntries = []; + for (var i = 0; i < object.dataContractEntries.length; ++i) { + if (typeof object.dataContractEntries[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.dataContractEntries: object expected"); + message.dataContractEntries[i] = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.fromObject(object.dataContractEntries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DataContractHistory message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @static + * @param {org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} message DataContractHistory + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DataContractHistory.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.dataContractEntries = []; + if (message.dataContractEntries && message.dataContractEntries.length) { + object.dataContractEntries = []; + for (var j = 0; j < message.dataContractEntries.length; ++j) + object.dataContractEntries[j] = $root.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject(message.dataContractEntries[j], options); + } + return object; + }; + + /** + * Converts this DataContractHistory to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory + * @instance + * @returns {Object.} JSON object + */ + DataContractHistory.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DataContractHistory; + })(); + + return GetDataContractHistoryResponseV0; + })(); + + return GetDataContractHistoryResponse; + })(); + + v0.GetDocumentsRequest = (function() { + + /** + * Properties of a GetDocumentsRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetDocumentsRequest + * @property {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0|null} [v0] GetDocumentsRequest v0 + */ + + /** + * Constructs a new GetDocumentsRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetDocumentsRequest. + * @implements IGetDocumentsRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest=} [properties] Properties to set + */ + function GetDocumentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentsRequest v0. + * @member {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @instance + */ + GetDocumentsRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDocumentsRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @instance + */ + Object.defineProperty(GetDocumentsRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDocumentsRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest instance + */ + GetDocumentsRequest.create = function create(properties) { + return new GetDocumentsRequest(properties); + }; + + /** + * Encodes the specified GetDocumentsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest} message GetDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetDocumentsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetDocumentsRequest} message GetDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentsRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest} GetDocumentsRequest + */ + GetDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsRequest} message GetDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetDocumentsRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + GetDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetDocumentsRequest.GetDocumentsRequestV0 = (function() { + + /** + * Properties of a GetDocumentsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @interface IGetDocumentsRequestV0 + * @property {Uint8Array|null} [dataContractId] GetDocumentsRequestV0 dataContractId + * @property {string|null} [documentType] GetDocumentsRequestV0 documentType + * @property {Uint8Array|null} [where] GetDocumentsRequestV0 where + * @property {Uint8Array|null} [orderBy] GetDocumentsRequestV0 orderBy + * @property {number|null} [limit] GetDocumentsRequestV0 limit + * @property {Uint8Array|null} [startAfter] GetDocumentsRequestV0 startAfter + * @property {Uint8Array|null} [startAt] GetDocumentsRequestV0 startAt + * @property {boolean|null} [prove] GetDocumentsRequestV0 prove + */ + + /** + * Constructs a new GetDocumentsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest + * @classdesc Represents a GetDocumentsRequestV0. + * @implements IGetDocumentsRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0=} [properties] Properties to set + */ + function GetDocumentsRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentsRequestV0 dataContractId. + * @member {Uint8Array} dataContractId + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.dataContractId = $util.newBuffer([]); + + /** + * GetDocumentsRequestV0 documentType. + * @member {string} documentType + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.documentType = ""; + + /** + * GetDocumentsRequestV0 where. + * @member {Uint8Array} where + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.where = $util.newBuffer([]); + + /** + * GetDocumentsRequestV0 orderBy. + * @member {Uint8Array} orderBy + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.orderBy = $util.newBuffer([]); + + /** + * GetDocumentsRequestV0 limit. + * @member {number} limit + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.limit = 0; + + /** + * GetDocumentsRequestV0 startAfter. + * @member {Uint8Array} startAfter + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.startAfter = $util.newBuffer([]); + + /** + * GetDocumentsRequestV0 startAt. + * @member {Uint8Array} startAt + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.startAt = $util.newBuffer([]); + + /** + * GetDocumentsRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + GetDocumentsRequestV0.prototype.prove = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDocumentsRequestV0 start. + * @member {"startAfter"|"startAt"|undefined} start + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + */ + Object.defineProperty(GetDocumentsRequestV0.prototype, "start", { + get: $util.oneOfGetter($oneOfFields = ["startAfter", "startAt"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDocumentsRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 instance + */ + GetDocumentsRequestV0.create = function create(properties) { + return new GetDocumentsRequestV0(properties); + }; + + /** + * Encodes the specified GetDocumentsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0} message GetDocumentsRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataContractId != null && Object.hasOwnProperty.call(message, "dataContractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.dataContractId); + if (message.documentType != null && Object.hasOwnProperty.call(message, "documentType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentType); + if (message.where != null && Object.hasOwnProperty.call(message, "where")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.where); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.orderBy); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.limit); + if (message.startAfter != null && Object.hasOwnProperty.call(message, "startAfter")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.startAfter); + if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.startAt); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetDocumentsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.IGetDocumentsRequestV0} message GetDocumentsRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDocumentsRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dataContractId = reader.bytes(); + break; + case 2: + message.documentType = reader.string(); + break; + case 3: + message.where = reader.bytes(); + break; + case 4: + message.orderBy = reader.bytes(); + break; + case 5: + message.limit = reader.uint32(); + break; + case 6: + message.startAfter = reader.bytes(); + break; + case 7: + message.startAt = reader.bytes(); + break; + case 8: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDocumentsRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentsRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentsRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.dataContractId != null && message.hasOwnProperty("dataContractId")) + if (!(message.dataContractId && typeof message.dataContractId.length === "number" || $util.isString(message.dataContractId))) + return "dataContractId: buffer expected"; + if (message.documentType != null && message.hasOwnProperty("documentType")) + if (!$util.isString(message.documentType)) + return "documentType: string expected"; + if (message.where != null && message.hasOwnProperty("where")) + if (!(message.where && typeof message.where.length === "number" || $util.isString(message.where))) + return "where: buffer expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!(message.orderBy && typeof message.orderBy.length === "number" || $util.isString(message.orderBy))) + return "orderBy: buffer expected"; + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.startAfter != null && message.hasOwnProperty("startAfter")) { + properties.start = 1; + if (!(message.startAfter && typeof message.startAfter.length === "number" || $util.isString(message.startAfter))) + return "startAfter: buffer expected"; + } + if (message.startAt != null && message.hasOwnProperty("startAt")) { + if (properties.start === 1) + return "start: multiple values"; + properties.start = 1; + if (!(message.startAt && typeof message.startAt.length === "number" || $util.isString(message.startAt))) + return "startAt: buffer expected"; + } + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetDocumentsRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} GetDocumentsRequestV0 + */ + GetDocumentsRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0(); + if (object.dataContractId != null) + if (typeof object.dataContractId === "string") + $util.base64.decode(object.dataContractId, message.dataContractId = $util.newBuffer($util.base64.length(object.dataContractId)), 0); + else if (object.dataContractId.length >= 0) + message.dataContractId = object.dataContractId; + if (object.documentType != null) + message.documentType = String(object.documentType); + if (object.where != null) + if (typeof object.where === "string") + $util.base64.decode(object.where, message.where = $util.newBuffer($util.base64.length(object.where)), 0); + else if (object.where.length >= 0) + message.where = object.where; + if (object.orderBy != null) + if (typeof object.orderBy === "string") + $util.base64.decode(object.orderBy, message.orderBy = $util.newBuffer($util.base64.length(object.orderBy)), 0); + else if (object.orderBy.length >= 0) + message.orderBy = object.orderBy; + if (object.limit != null) + message.limit = object.limit >>> 0; + if (object.startAfter != null) + if (typeof object.startAfter === "string") + $util.base64.decode(object.startAfter, message.startAfter = $util.newBuffer($util.base64.length(object.startAfter)), 0); + else if (object.startAfter.length >= 0) + message.startAfter = object.startAfter; + if (object.startAt != null) + if (typeof object.startAt === "string") + $util.base64.decode(object.startAt, message.startAt = $util.newBuffer($util.base64.length(object.startAt)), 0); + else if (object.startAt.length >= 0) + message.startAt = object.startAt; + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetDocumentsRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} message GetDocumentsRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentsRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.dataContractId = ""; + else { + object.dataContractId = []; + if (options.bytes !== Array) + object.dataContractId = $util.newBuffer(object.dataContractId); + } + object.documentType = ""; + if (options.bytes === String) + object.where = ""; + else { + object.where = []; + if (options.bytes !== Array) + object.where = $util.newBuffer(object.where); + } + if (options.bytes === String) + object.orderBy = ""; + else { + object.orderBy = []; + if (options.bytes !== Array) + object.orderBy = $util.newBuffer(object.orderBy); + } + object.limit = 0; + object.prove = false; + } + if (message.dataContractId != null && message.hasOwnProperty("dataContractId")) + object.dataContractId = options.bytes === String ? $util.base64.encode(message.dataContractId, 0, message.dataContractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.dataContractId) : message.dataContractId; + if (message.documentType != null && message.hasOwnProperty("documentType")) + object.documentType = message.documentType; + if (message.where != null && message.hasOwnProperty("where")) + object.where = options.bytes === String ? $util.base64.encode(message.where, 0, message.where.length) : options.bytes === Array ? Array.prototype.slice.call(message.where) : message.where; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = options.bytes === String ? $util.base64.encode(message.orderBy, 0, message.orderBy.length) : options.bytes === Array ? Array.prototype.slice.call(message.orderBy) : message.orderBy; + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.startAfter != null && message.hasOwnProperty("startAfter")) { + object.startAfter = options.bytes === String ? $util.base64.encode(message.startAfter, 0, message.startAfter.length) : options.bytes === Array ? Array.prototype.slice.call(message.startAfter) : message.startAfter; + if (options.oneofs) + object.start = "startAfter"; + } + if (message.startAt != null && message.hasOwnProperty("startAt")) { + object.startAt = options.bytes === String ? $util.base64.encode(message.startAt, 0, message.startAt.length) : options.bytes === Array ? Array.prototype.slice.call(message.startAt) : message.startAt; + if (options.oneofs) + object.start = "startAt"; + } + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetDocumentsRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetDocumentsRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetDocumentsRequestV0; + })(); + + return GetDocumentsRequest; + })(); + + v0.GetDocumentsResponse = (function() { + + /** + * Properties of a GetDocumentsResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetDocumentsResponse + * @property {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0|null} [v0] GetDocumentsResponse v0 + */ + + /** + * Constructs a new GetDocumentsResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetDocumentsResponse. + * @implements IGetDocumentsResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse=} [properties] Properties to set + */ + function GetDocumentsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentsResponse v0. + * @member {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @instance + */ + GetDocumentsResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDocumentsResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @instance + */ + Object.defineProperty(GetDocumentsResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDocumentsResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse instance + */ + GetDocumentsResponse.create = function create(properties) { + return new GetDocumentsResponse(properties); + }; + + /** + * Encodes the specified GetDocumentsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse} message GetDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetDocumentsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse} message GetDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentsResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse + */ + GetDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse} message GetDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetDocumentsResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + GetDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetDocumentsResponse.GetDocumentsResponseV0 = (function() { + + /** + * Properties of a GetDocumentsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @interface IGetDocumentsResponseV0 + * @property {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments|null} [documents] GetDocumentsResponseV0 documents + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDocumentsResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDocumentsResponseV0 metadata + */ + + /** + * Constructs a new GetDocumentsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @classdesc Represents a GetDocumentsResponseV0. + * @implements IGetDocumentsResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0=} [properties] Properties to set + */ + function GetDocumentsResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentsResponseV0 documents. + * @member {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments|null|undefined} documents + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @instance + */ + GetDocumentsResponseV0.prototype.documents = null; + + /** + * GetDocumentsResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @instance + */ + GetDocumentsResponseV0.prototype.proof = null; + + /** + * GetDocumentsResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @instance + */ + GetDocumentsResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDocumentsResponseV0 result. + * @member {"documents"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @instance + */ + Object.defineProperty(GetDocumentsResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["documents", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDocumentsResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 instance + */ + GetDocumentsResponseV0.create = function create(properties) { + return new GetDocumentsResponseV0(properties); + }; + + /** + * Encodes the specified GetDocumentsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0} message GetDocumentsResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) + $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.encode(message.documents, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetDocumentsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0} message GetDocumentsResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDocumentsResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.documents = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDocumentsResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentsResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentsResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentsResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.documents != null && message.hasOwnProperty("documents")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.verify(message.documents); + if (error) + return "documents." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetDocumentsResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 + */ + GetDocumentsResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0(); + if (object.documents != null) { + if (typeof object.documents !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.documents: object expected"); + message.documents = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.fromObject(object.documents); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetDocumentsResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} message GetDocumentsResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentsResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.documents != null && message.hasOwnProperty("documents")) { + object.documents = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(message.documents, options); + if (options.oneofs) + object.result = "documents"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetDocumentsResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetDocumentsResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetDocumentsResponseV0.Documents = (function() { + + /** + * Properties of a Documents. + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @interface IDocuments + * @property {Array.|null} [documents] Documents documents + */ + + /** + * Constructs a new Documents. + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @classdesc Represents a Documents. + * @implements IDocuments + * @constructor + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments=} [properties] Properties to set + */ + function Documents(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Documents documents. + * @member {Array.} documents + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @instance + */ + Documents.prototype.documents = $util.emptyArray; + + /** + * Creates a new Documents instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents instance + */ + Documents.create = function create(properties) { + return new Documents(properties); + }; + + /** + * Encodes the specified Documents message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments} message Documents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Documents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.documents[i]); + return writer; + }; + + /** + * Encodes the specified Documents message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments} message Documents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Documents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Documents message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Documents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Documents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Documents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Documents message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Documents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) + if (!(message.documents[i] && typeof message.documents[i].length === "number" || $util.isString(message.documents[i]))) + return "documents: buffer[] expected"; + } + return null; + }; + + /** + * Creates a Documents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents + */ + Documents.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) + if (typeof object.documents[i] === "string") + $util.base64.decode(object.documents[i], message.documents[i] = $util.newBuffer($util.base64.length(object.documents[i])), 0); + else if (object.documents[i].length >= 0) + message.documents[i] = object.documents[i]; + } + return message; + }; + + /** + * Creates a plain object from a Documents message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @static + * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} message Documents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Documents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = options.bytes === String ? $util.base64.encode(message.documents[j], 0, message.documents[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.documents[j]) : message.documents[j]; + } + return object; + }; + + /** + * Converts this Documents to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @instance + * @returns {Object.} JSON object + */ + Documents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Documents; + })(); + + return GetDocumentsResponseV0; + })(); + + return GetDocumentsResponse; + })(); + + v0.GetIdentityByPublicKeyHashRequest = (function() { + + /** + * Properties of a GetIdentityByPublicKeyHashRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityByPublicKeyHashRequest + * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null} [v0] GetIdentityByPublicKeyHashRequest v0 + */ + + /** + * Constructs a new GetIdentityByPublicKeyHashRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityByPublicKeyHashRequest. + * @implements IGetIdentityByPublicKeyHashRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set + */ + function GetIdentityByPublicKeyHashRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityByPublicKeyHashRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @instance + */ + GetIdentityByPublicKeyHashRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityByPublicKeyHashRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @instance + */ + Object.defineProperty(GetIdentityByPublicKeyHashRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentityByPublicKeyHashRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest instance + */ + GetIdentityByPublicKeyHashRequest.create = function create(properties) { + return new GetIdentityByPublicKeyHashRequest(properties); + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityByPublicKeyHashRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityByPublicKeyHashRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetIdentityByPublicKeyHashRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + */ + GetIdentityByPublicKeyHashRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityByPublicKeyHashRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityByPublicKeyHashRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetIdentityByPublicKeyHashRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @instance + * @returns {Object.} JSON object + */ + GetIdentityByPublicKeyHashRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = (function() { + + /** + * Properties of a GetIdentityByPublicKeyHashRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @interface IGetIdentityByPublicKeyHashRequestV0 + * @property {Uint8Array|null} [publicKeyHash] GetIdentityByPublicKeyHashRequestV0 publicKeyHash + * @property {boolean|null} [prove] GetIdentityByPublicKeyHashRequestV0 prove + */ + + /** + * Constructs a new GetIdentityByPublicKeyHashRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @classdesc Represents a GetIdentityByPublicKeyHashRequestV0. + * @implements IGetIdentityByPublicKeyHashRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set + */ + function GetIdentityByPublicKeyHashRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityByPublicKeyHashRequestV0 publicKeyHash. + * @member {Uint8Array} publicKeyHash + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @instance + */ + GetIdentityByPublicKeyHashRequestV0.prototype.publicKeyHash = $util.newBuffer([]); + + /** + * GetIdentityByPublicKeyHashRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @instance + */ + GetIdentityByPublicKeyHashRequestV0.prototype.prove = false; + + /** + * Creates a new GetIdentityByPublicKeyHashRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 instance + */ + GetIdentityByPublicKeyHashRequestV0.create = function create(properties) { + return new GetIdentityByPublicKeyHashRequestV0(properties); + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.publicKeyHash != null && Object.hasOwnProperty.call(message, "publicKeyHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHash); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKeyHash = reader.bytes(); + break; + case 2: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityByPublicKeyHashRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityByPublicKeyHashRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) + if (!(message.publicKeyHash && typeof message.publicKeyHash.length === "number" || $util.isString(message.publicKeyHash))) + return "publicKeyHash: buffer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetIdentityByPublicKeyHashRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + */ + GetIdentityByPublicKeyHashRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); + if (object.publicKeyHash != null) + if (typeof object.publicKeyHash === "string") + $util.base64.decode(object.publicKeyHash, message.publicKeyHash = $util.newBuffer($util.base64.length(object.publicKeyHash)), 0); + else if (object.publicKeyHash.length >= 0) + message.publicKeyHash = object.publicKeyHash; + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetIdentityByPublicKeyHashRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityByPublicKeyHashRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.publicKeyHash = ""; + else { + object.publicKeyHash = []; + if (options.bytes !== Array) + object.publicKeyHash = $util.newBuffer(object.publicKeyHash); + } + object.prove = false; + } + if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) + object.publicKeyHash = options.bytes === String ? $util.base64.encode(message.publicKeyHash, 0, message.publicKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHash) : message.publicKeyHash; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetIdentityByPublicKeyHashRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetIdentityByPublicKeyHashRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetIdentityByPublicKeyHashRequestV0; + })(); + + return GetIdentityByPublicKeyHashRequest; + })(); + + v0.GetIdentityByPublicKeyHashResponse = (function() { + + /** + * Properties of a GetIdentityByPublicKeyHashResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityByPublicKeyHashResponse + * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null} [v0] GetIdentityByPublicKeyHashResponse v0 + */ + + /** + * Constructs a new GetIdentityByPublicKeyHashResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityByPublicKeyHashResponse. + * @implements IGetIdentityByPublicKeyHashResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set + */ + function GetIdentityByPublicKeyHashResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityByPublicKeyHashResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @instance + */ + GetIdentityByPublicKeyHashResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityByPublicKeyHashResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @instance + */ + Object.defineProperty(GetIdentityByPublicKeyHashResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentityByPublicKeyHashResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse instance + */ + GetIdentityByPublicKeyHashResponse.create = function create(properties) { + return new GetIdentityByPublicKeyHashResponse(properties); + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityByPublicKeyHashResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityByPublicKeyHashResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetIdentityByPublicKeyHashResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse + */ + GetIdentityByPublicKeyHashResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityByPublicKeyHashResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityByPublicKeyHashResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetIdentityByPublicKeyHashResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @instance + * @returns {Object.} JSON object + */ + GetIdentityByPublicKeyHashResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = (function() { + + /** + * Properties of a GetIdentityByPublicKeyHashResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @interface IGetIdentityByPublicKeyHashResponseV0 + * @property {Uint8Array|null} [identity] GetIdentityByPublicKeyHashResponseV0 identity + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityByPublicKeyHashResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityByPublicKeyHashResponseV0 metadata + */ + + /** + * Constructs a new GetIdentityByPublicKeyHashResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @classdesc Represents a GetIdentityByPublicKeyHashResponseV0. + * @implements IGetIdentityByPublicKeyHashResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set + */ + function GetIdentityByPublicKeyHashResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityByPublicKeyHashResponseV0 identity. + * @member {Uint8Array} identity + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @instance + */ + GetIdentityByPublicKeyHashResponseV0.prototype.identity = $util.newBuffer([]); + + /** + * GetIdentityByPublicKeyHashResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @instance + */ + GetIdentityByPublicKeyHashResponseV0.prototype.proof = null; + + /** + * GetIdentityByPublicKeyHashResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @instance + */ + GetIdentityByPublicKeyHashResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityByPublicKeyHashResponseV0 result. + * @member {"identity"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @instance + */ + Object.defineProperty(GetIdentityByPublicKeyHashResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentityByPublicKeyHashResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 instance + */ + GetIdentityByPublicKeyHashResponseV0.create = function create(properties) { + return new GetIdentityByPublicKeyHashResponseV0(properties); + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityByPublicKeyHashResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identity = reader.bytes(); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityByPublicKeyHashResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityByPublicKeyHashResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityByPublicKeyHashResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.identity != null && message.hasOwnProperty("identity")) { + properties.result = 1; + if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) + return "identity: buffer expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetIdentityByPublicKeyHashResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 + */ + GetIdentityByPublicKeyHashResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); + if (object.identity != null) + if (typeof object.identity === "string") + $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); + else if (object.identity.length >= 0) + message.identity = object.identity; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityByPublicKeyHashResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityByPublicKeyHashResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.identity != null && message.hasOwnProperty("identity")) { + object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; + if (options.oneofs) + object.result = "identity"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetIdentityByPublicKeyHashResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetIdentityByPublicKeyHashResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetIdentityByPublicKeyHashResponseV0; + })(); + + return GetIdentityByPublicKeyHashResponse; + })(); + + v0.WaitForStateTransitionResultRequest = (function() { + + /** + * Properties of a WaitForStateTransitionResultRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IWaitForStateTransitionResultRequest + * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null} [v0] WaitForStateTransitionResultRequest v0 + */ + + /** + * Constructs a new WaitForStateTransitionResultRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a WaitForStateTransitionResultRequest. + * @implements IWaitForStateTransitionResultRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set + */ + function WaitForStateTransitionResultRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitForStateTransitionResultRequest v0. + * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @instance + */ + WaitForStateTransitionResultRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * WaitForStateTransitionResultRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @instance + */ + Object.defineProperty(WaitForStateTransitionResultRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new WaitForStateTransitionResultRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest instance + */ + WaitForStateTransitionResultRequest.create = function create(properties) { + return new WaitForStateTransitionResultRequest(properties); + }; + + /** + * Encodes the specified WaitForStateTransitionResultRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitForStateTransitionResultRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitForStateTransitionResultRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitForStateTransitionResultRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a WaitForStateTransitionResultRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + */ + WaitForStateTransitionResultRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a WaitForStateTransitionResultRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitForStateTransitionResultRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this WaitForStateTransitionResultRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @instance + * @returns {Object.} JSON object + */ + WaitForStateTransitionResultRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = (function() { + + /** + * Properties of a WaitForStateTransitionResultRequestV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @interface IWaitForStateTransitionResultRequestV0 + * @property {Uint8Array|null} [stateTransitionHash] WaitForStateTransitionResultRequestV0 stateTransitionHash + * @property {boolean|null} [prove] WaitForStateTransitionResultRequestV0 prove + */ + + /** + * Constructs a new WaitForStateTransitionResultRequestV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @classdesc Represents a WaitForStateTransitionResultRequestV0. + * @implements IWaitForStateTransitionResultRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set + */ + function WaitForStateTransitionResultRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitForStateTransitionResultRequestV0 stateTransitionHash. + * @member {Uint8Array} stateTransitionHash + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @instance + */ + WaitForStateTransitionResultRequestV0.prototype.stateTransitionHash = $util.newBuffer([]); + + /** + * WaitForStateTransitionResultRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @instance + */ + WaitForStateTransitionResultRequestV0.prototype.prove = false; + + /** + * Creates a new WaitForStateTransitionResultRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 instance + */ + WaitForStateTransitionResultRequestV0.create = function create(properties) { + return new WaitForStateTransitionResultRequestV0(properties); + }; + + /** + * Encodes the specified WaitForStateTransitionResultRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.stateTransitionHash != null && Object.hasOwnProperty.call(message, "stateTransitionHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.stateTransitionHash); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified WaitForStateTransitionResultRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stateTransitionHash = reader.bytes(); + break; + case 2: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitForStateTransitionResultRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitForStateTransitionResultRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) + if (!(message.stateTransitionHash && typeof message.stateTransitionHash.length === "number" || $util.isString(message.stateTransitionHash))) + return "stateTransitionHash: buffer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a WaitForStateTransitionResultRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + */ + WaitForStateTransitionResultRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); + if (object.stateTransitionHash != null) + if (typeof object.stateTransitionHash === "string") + $util.base64.decode(object.stateTransitionHash, message.stateTransitionHash = $util.newBuffer($util.base64.length(object.stateTransitionHash)), 0); + else if (object.stateTransitionHash.length >= 0) + message.stateTransitionHash = object.stateTransitionHash; + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a WaitForStateTransitionResultRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitForStateTransitionResultRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.stateTransitionHash = ""; + else { + object.stateTransitionHash = []; + if (options.bytes !== Array) + object.stateTransitionHash = $util.newBuffer(object.stateTransitionHash); + } + object.prove = false; + } + if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) + object.stateTransitionHash = options.bytes === String ? $util.base64.encode(message.stateTransitionHash, 0, message.stateTransitionHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.stateTransitionHash) : message.stateTransitionHash; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this WaitForStateTransitionResultRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @instance + * @returns {Object.} JSON object + */ + WaitForStateTransitionResultRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WaitForStateTransitionResultRequestV0; + })(); + + return WaitForStateTransitionResultRequest; + })(); + + v0.WaitForStateTransitionResultResponse = (function() { + + /** + * Properties of a WaitForStateTransitionResultResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IWaitForStateTransitionResultResponse + * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null} [v0] WaitForStateTransitionResultResponse v0 + */ + + /** + * Constructs a new WaitForStateTransitionResultResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a WaitForStateTransitionResultResponse. + * @implements IWaitForStateTransitionResultResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set + */ + function WaitForStateTransitionResultResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitForStateTransitionResultResponse v0. + * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @instance + */ + WaitForStateTransitionResultResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * WaitForStateTransitionResultResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @instance + */ + Object.defineProperty(WaitForStateTransitionResultResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new WaitForStateTransitionResultResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse instance + */ + WaitForStateTransitionResultResponse.create = function create(properties) { + return new WaitForStateTransitionResultResponse(properties); + }; + + /** + * Encodes the specified WaitForStateTransitionResultResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitForStateTransitionResultResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitForStateTransitionResultResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitForStateTransitionResultResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a WaitForStateTransitionResultResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse + */ + WaitForStateTransitionResultResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a WaitForStateTransitionResultResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitForStateTransitionResultResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this WaitForStateTransitionResultResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @instance + * @returns {Object.} JSON object + */ + WaitForStateTransitionResultResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = (function() { + + /** + * Properties of a WaitForStateTransitionResultResponseV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @interface IWaitForStateTransitionResultResponseV0 + * @property {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null} [error] WaitForStateTransitionResultResponseV0 error + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] WaitForStateTransitionResultResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] WaitForStateTransitionResultResponseV0 metadata + */ + + /** + * Constructs a new WaitForStateTransitionResultResponseV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @classdesc Represents a WaitForStateTransitionResultResponseV0. + * @implements IWaitForStateTransitionResultResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set + */ + function WaitForStateTransitionResultResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitForStateTransitionResultResponseV0 error. + * @member {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null|undefined} error + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @instance + */ + WaitForStateTransitionResultResponseV0.prototype.error = null; + + /** + * WaitForStateTransitionResultResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @instance + */ + WaitForStateTransitionResultResponseV0.prototype.proof = null; + + /** + * WaitForStateTransitionResultResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @instance + */ + WaitForStateTransitionResultResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * WaitForStateTransitionResultResponseV0 result. + * @member {"error"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @instance + */ + Object.defineProperty(WaitForStateTransitionResultResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new WaitForStateTransitionResultResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 instance + */ + WaitForStateTransitionResultResponseV0.create = function create(properties) { + return new WaitForStateTransitionResultResponseV0(properties); + }; + + /** + * Encodes the specified WaitForStateTransitionResultResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.encode(message.error, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitForStateTransitionResultResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitForStateTransitionResultResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitForStateTransitionResultResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a WaitForStateTransitionResultResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + */ + WaitForStateTransitionResultResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.error: object expected"); + message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.fromObject(object.error); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a WaitForStateTransitionResultResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitForStateTransitionResultResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this WaitForStateTransitionResultResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @instance + * @returns {Object.} JSON object + */ + WaitForStateTransitionResultResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WaitForStateTransitionResultResponseV0; + })(); + + return WaitForStateTransitionResultResponse; + })(); + + v0.GetConsensusParamsRequest = (function() { + + /** + * Properties of a GetConsensusParamsRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetConsensusParamsRequest + * @property {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null} [v0] GetConsensusParamsRequest v0 + */ + + /** + * Constructs a new GetConsensusParamsRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetConsensusParamsRequest. + * @implements IGetConsensusParamsRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set + */ + function GetConsensusParamsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConsensusParamsRequest v0. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @instance + */ + GetConsensusParamsRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetConsensusParamsRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @instance + */ + Object.defineProperty(GetConsensusParamsRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetConsensusParamsRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest instance + */ + GetConsensusParamsRequest.create = function create(properties) { + return new GetConsensusParamsRequest(properties); + }; + + /** + * Encodes the specified GetConsensusParamsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetConsensusParamsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConsensusParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetConsensusParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConsensusParamsRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConsensusParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetConsensusParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest + */ + GetConsensusParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetConsensusParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest} message GetConsensusParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConsensusParamsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetConsensusParamsRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @instance + * @returns {Object.} JSON object + */ + GetConsensusParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetConsensusParamsRequest.GetConsensusParamsRequestV0 = (function() { + + /** + * Properties of a GetConsensusParamsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @interface IGetConsensusParamsRequestV0 + * @property {number|null} [height] GetConsensusParamsRequestV0 height + * @property {boolean|null} [prove] GetConsensusParamsRequestV0 prove + */ + + /** + * Constructs a new GetConsensusParamsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @classdesc Represents a GetConsensusParamsRequestV0. + * @implements IGetConsensusParamsRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set + */ + function GetConsensusParamsRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConsensusParamsRequestV0 height. + * @member {number} height + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @instance + */ + GetConsensusParamsRequestV0.prototype.height = 0; + + /** + * GetConsensusParamsRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @instance + */ + GetConsensusParamsRequestV0.prototype.prove = false; + + /** + * Creates a new GetConsensusParamsRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 instance + */ + GetConsensusParamsRequestV0.create = function create(properties) { + return new GetConsensusParamsRequestV0(properties); + }; + + /** + * Encodes the specified GetConsensusParamsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.height); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetConsensusParamsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int32(); + break; + case 2: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConsensusParamsRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConsensusParamsRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetConsensusParamsRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 + */ + GetConsensusParamsRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); + if (object.height != null) + message.height = object.height | 0; + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetConsensusParamsRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConsensusParamsRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.height = 0; + object.prove = false; + } + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetConsensusParamsRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetConsensusParamsRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetConsensusParamsRequestV0; + })(); + + return GetConsensusParamsRequest; + })(); + + v0.GetConsensusParamsResponse = (function() { + + /** + * Properties of a GetConsensusParamsResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetConsensusParamsResponse + * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null} [v0] GetConsensusParamsResponse v0 + */ + + /** + * Constructs a new GetConsensusParamsResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetConsensusParamsResponse. + * @implements IGetConsensusParamsResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set + */ + function GetConsensusParamsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConsensusParamsResponse v0. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @instance + */ + GetConsensusParamsResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetConsensusParamsResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @instance + */ + Object.defineProperty(GetConsensusParamsResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetConsensusParamsResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse instance + */ + GetConsensusParamsResponse.create = function create(properties) { + return new GetConsensusParamsResponse(properties); + }; + + /** + * Encodes the specified GetConsensusParamsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetConsensusParamsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConsensusParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetConsensusParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConsensusParamsResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConsensusParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetConsensusParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + */ + GetConsensusParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetConsensusParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse} message GetConsensusParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConsensusParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetConsensusParamsResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @instance + * @returns {Object.} JSON object + */ + GetConsensusParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetConsensusParamsResponse.ConsensusParamsBlock = (function() { + + /** + * Properties of a ConsensusParamsBlock. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @interface IConsensusParamsBlock + * @property {string|null} [maxBytes] ConsensusParamsBlock maxBytes + * @property {string|null} [maxGas] ConsensusParamsBlock maxGas + * @property {string|null} [timeIotaMs] ConsensusParamsBlock timeIotaMs + */ + + /** + * Constructs a new ConsensusParamsBlock. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @classdesc Represents a ConsensusParamsBlock. + * @implements IConsensusParamsBlock + * @constructor + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set + */ + function ConsensusParamsBlock(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusParamsBlock maxBytes. + * @member {string} maxBytes + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @instance + */ + ConsensusParamsBlock.prototype.maxBytes = ""; + + /** + * ConsensusParamsBlock maxGas. + * @member {string} maxGas + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @instance + */ + ConsensusParamsBlock.prototype.maxGas = ""; + + /** + * ConsensusParamsBlock timeIotaMs. + * @member {string} timeIotaMs + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @instance + */ + ConsensusParamsBlock.prototype.timeIotaMs = ""; + + /** + * Creates a new ConsensusParamsBlock instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock instance + */ + ConsensusParamsBlock.create = function create(properties) { + return new ConsensusParamsBlock(properties); + }; + + /** + * Encodes the specified ConsensusParamsBlock message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParamsBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxBytes); + if (message.maxGas != null && Object.hasOwnProperty.call(message, "maxGas")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxGas); + if (message.timeIotaMs != null && Object.hasOwnProperty.call(message, "timeIotaMs")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.timeIotaMs); + return writer; + }; + + /** + * Encodes the specified ConsensusParamsBlock message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParamsBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusParamsBlock message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParamsBlock.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxBytes = reader.string(); + break; + case 2: + message.maxGas = reader.string(); + break; + case 3: + message.timeIotaMs = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusParamsBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParamsBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusParamsBlock message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusParamsBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + if (!$util.isString(message.maxBytes)) + return "maxBytes: string expected"; + if (message.maxGas != null && message.hasOwnProperty("maxGas")) + if (!$util.isString(message.maxGas)) + return "maxGas: string expected"; + if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) + if (!$util.isString(message.timeIotaMs)) + return "timeIotaMs: string expected"; + return null; + }; + + /** + * Creates a ConsensusParamsBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + */ + ConsensusParamsBlock.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); + if (object.maxBytes != null) + message.maxBytes = String(object.maxBytes); + if (object.maxGas != null) + message.maxGas = String(object.maxGas); + if (object.timeIotaMs != null) + message.timeIotaMs = String(object.timeIotaMs); + return message; + }; + + /** + * Creates a plain object from a ConsensusParamsBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message ConsensusParamsBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusParamsBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.maxBytes = ""; + object.maxGas = ""; + object.timeIotaMs = ""; + } + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + object.maxBytes = message.maxBytes; + if (message.maxGas != null && message.hasOwnProperty("maxGas")) + object.maxGas = message.maxGas; + if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) + object.timeIotaMs = message.timeIotaMs; + return object; + }; + + /** + * Converts this ConsensusParamsBlock to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @instance + * @returns {Object.} JSON object + */ + ConsensusParamsBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusParamsBlock; + })(); + + GetConsensusParamsResponse.ConsensusParamsEvidence = (function() { + + /** + * Properties of a ConsensusParamsEvidence. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @interface IConsensusParamsEvidence + * @property {string|null} [maxAgeNumBlocks] ConsensusParamsEvidence maxAgeNumBlocks + * @property {string|null} [maxAgeDuration] ConsensusParamsEvidence maxAgeDuration + * @property {string|null} [maxBytes] ConsensusParamsEvidence maxBytes + */ + + /** + * Constructs a new ConsensusParamsEvidence. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @classdesc Represents a ConsensusParamsEvidence. + * @implements IConsensusParamsEvidence + * @constructor + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set + */ + function ConsensusParamsEvidence(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusParamsEvidence maxAgeNumBlocks. + * @member {string} maxAgeNumBlocks + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @instance + */ + ConsensusParamsEvidence.prototype.maxAgeNumBlocks = ""; + + /** + * ConsensusParamsEvidence maxAgeDuration. + * @member {string} maxAgeDuration + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @instance + */ + ConsensusParamsEvidence.prototype.maxAgeDuration = ""; + + /** + * ConsensusParamsEvidence maxBytes. + * @member {string} maxBytes + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @instance + */ + ConsensusParamsEvidence.prototype.maxBytes = ""; + + /** + * Creates a new ConsensusParamsEvidence instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence instance + */ + ConsensusParamsEvidence.create = function create(properties) { + return new ConsensusParamsEvidence(properties); + }; + + /** + * Encodes the specified ConsensusParamsEvidence message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParamsEvidence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.maxAgeNumBlocks != null && Object.hasOwnProperty.call(message, "maxAgeNumBlocks")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxAgeNumBlocks); + if (message.maxAgeDuration != null && Object.hasOwnProperty.call(message, "maxAgeDuration")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxAgeDuration); + if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.maxBytes); + return writer; + }; + + /** + * Encodes the specified ConsensusParamsEvidence message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParamsEvidence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusParamsEvidence message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParamsEvidence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxAgeNumBlocks = reader.string(); + break; + case 2: + message.maxAgeDuration = reader.string(); + break; + case 3: + message.maxBytes = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusParamsEvidence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParamsEvidence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusParamsEvidence message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusParamsEvidence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) + if (!$util.isString(message.maxAgeNumBlocks)) + return "maxAgeNumBlocks: string expected"; + if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) + if (!$util.isString(message.maxAgeDuration)) + return "maxAgeDuration: string expected"; + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + if (!$util.isString(message.maxBytes)) + return "maxBytes: string expected"; + return null; + }; + + /** + * Creates a ConsensusParamsEvidence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence + */ + ConsensusParamsEvidence.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); + if (object.maxAgeNumBlocks != null) + message.maxAgeNumBlocks = String(object.maxAgeNumBlocks); + if (object.maxAgeDuration != null) + message.maxAgeDuration = String(object.maxAgeDuration); + if (object.maxBytes != null) + message.maxBytes = String(object.maxBytes); + return message; + }; + + /** + * Creates a plain object from a ConsensusParamsEvidence message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message ConsensusParamsEvidence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusParamsEvidence.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.maxAgeNumBlocks = ""; + object.maxAgeDuration = ""; + object.maxBytes = ""; + } + if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) + object.maxAgeNumBlocks = message.maxAgeNumBlocks; + if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) + object.maxAgeDuration = message.maxAgeDuration; + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + object.maxBytes = message.maxBytes; + return object; + }; + + /** + * Converts this ConsensusParamsEvidence to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @instance + * @returns {Object.} JSON object + */ + ConsensusParamsEvidence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusParamsEvidence; + })(); + + GetConsensusParamsResponse.GetConsensusParamsResponseV0 = (function() { + + /** + * Properties of a GetConsensusParamsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @interface IGetConsensusParamsResponseV0 + * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null} [block] GetConsensusParamsResponseV0 block + * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null} [evidence] GetConsensusParamsResponseV0 evidence + */ + + /** + * Constructs a new GetConsensusParamsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @classdesc Represents a GetConsensusParamsResponseV0. + * @implements IGetConsensusParamsResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set + */ + function GetConsensusParamsResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConsensusParamsResponseV0 block. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null|undefined} block + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @instance + */ + GetConsensusParamsResponseV0.prototype.block = null; + + /** + * GetConsensusParamsResponseV0 evidence. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null|undefined} evidence + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @instance + */ + GetConsensusParamsResponseV0.prototype.evidence = null; + + /** + * Creates a new GetConsensusParamsResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 instance + */ + GetConsensusParamsResponseV0.create = function create(properties) { + return new GetConsensusParamsResponseV0(properties); + }; + + /** + * Encodes the specified GetConsensusParamsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) + $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetConsensusParamsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConsensusParamsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.decode(reader, reader.uint32()); + break; + case 2: + message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConsensusParamsResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConsensusParamsResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConsensusParamsResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block != null && message.hasOwnProperty("block")) { + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify(message.block); + if (error) + return "block." + error; + } + if (message.evidence != null && message.hasOwnProperty("evidence")) { + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify(message.evidence); + if (error) + return "evidence." + error; + } + return null; + }; + + /** + * Creates a GetConsensusParamsResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 + */ + GetConsensusParamsResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); + if (object.block != null) { + if (typeof object.block !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.block: object expected"); + message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.fromObject(object.block); + } + if (object.evidence != null) { + if (typeof object.evidence !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.evidence: object expected"); + message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.fromObject(object.evidence); + } + return message; + }; + + /** + * Creates a plain object from a GetConsensusParamsResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConsensusParamsResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.block = null; + object.evidence = null; + } + if (message.block != null && message.hasOwnProperty("block")) + object.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(message.block, options); + if (message.evidence != null && message.hasOwnProperty("evidence")) + object.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(message.evidence, options); + return object; + }; + + /** + * Converts this GetConsensusParamsResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetConsensusParamsResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetConsensusParamsResponseV0; + })(); + + return GetConsensusParamsResponse; + })(); + + v0.GetProtocolVersionUpgradeStateRequest = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeStateRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetProtocolVersionUpgradeStateRequest + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null} [v0] GetProtocolVersionUpgradeStateRequest v0 + */ + + /** + * Constructs a new GetProtocolVersionUpgradeStateRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetProtocolVersionUpgradeStateRequest. + * @implements IGetProtocolVersionUpgradeStateRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeStateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeStateRequest v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @instance + */ + GetProtocolVersionUpgradeStateRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProtocolVersionUpgradeStateRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeStateRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeStateRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest instance + */ + GetProtocolVersionUpgradeStateRequest.create = function create(properties) { + return new GetProtocolVersionUpgradeStateRequest(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeStateRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + */ + GetProtocolVersionUpgradeStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeStateRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeStateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @interface IGetProtocolVersionUpgradeStateRequestV0 + * @property {boolean|null} [prove] GetProtocolVersionUpgradeStateRequestV0 prove + */ + + /** + * Constructs a new GetProtocolVersionUpgradeStateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @classdesc Represents a GetProtocolVersionUpgradeStateRequestV0. + * @implements IGetProtocolVersionUpgradeStateRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeStateRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeStateRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @instance + */ + GetProtocolVersionUpgradeStateRequestV0.prototype.prove = false; + + /** + * Creates a new GetProtocolVersionUpgradeStateRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 instance + */ + GetProtocolVersionUpgradeStateRequestV0.create = function create(properties) { + return new GetProtocolVersionUpgradeStateRequestV0(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeStateRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeStateRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeStateRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + */ + GetProtocolVersionUpgradeStateRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeStateRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeStateRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.prove = false; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeStateRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeStateRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProtocolVersionUpgradeStateRequestV0; + })(); + + return GetProtocolVersionUpgradeStateRequest; + })(); + + v0.GetProtocolVersionUpgradeStateResponse = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeStateResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetProtocolVersionUpgradeStateResponse + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null} [v0] GetProtocolVersionUpgradeStateResponse v0 + */ + + /** + * Constructs a new GetProtocolVersionUpgradeStateResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetProtocolVersionUpgradeStateResponse. + * @implements IGetProtocolVersionUpgradeStateResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeStateResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeStateResponse v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @instance + */ + GetProtocolVersionUpgradeStateResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProtocolVersionUpgradeStateResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeStateResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeStateResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse instance + */ + GetProtocolVersionUpgradeStateResponse.create = function create(properties) { + return new GetProtocolVersionUpgradeStateResponse(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeStateResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + */ + GetProtocolVersionUpgradeStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeStateResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeStateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @interface IGetProtocolVersionUpgradeStateResponseV0 + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null} [versions] GetProtocolVersionUpgradeStateResponseV0 versions + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeStateResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeStateResponseV0 metadata + */ + + /** + * Constructs a new GetProtocolVersionUpgradeStateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @classdesc Represents a GetProtocolVersionUpgradeStateResponseV0. + * @implements IGetProtocolVersionUpgradeStateResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeStateResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeStateResponseV0 versions. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null|undefined} versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @instance + */ + GetProtocolVersionUpgradeStateResponseV0.prototype.versions = null; + + /** + * GetProtocolVersionUpgradeStateResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @instance + */ + GetProtocolVersionUpgradeStateResponseV0.prototype.proof = null; + + /** + * GetProtocolVersionUpgradeStateResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @instance + */ + GetProtocolVersionUpgradeStateResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProtocolVersionUpgradeStateResponseV0 result. + * @member {"versions"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeStateResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["versions", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeStateResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 instance + */ + GetProtocolVersionUpgradeStateResponseV0.create = function create(properties) { + return new GetProtocolVersionUpgradeStateResponseV0(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versions != null && Object.hasOwnProperty.call(message, "versions")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeStateResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeStateResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.versions != null && message.hasOwnProperty("versions")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify(message.versions); + if (error) + return "versions." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeStateResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + */ + GetProtocolVersionUpgradeStateResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); + if (object.versions != null) { + if (typeof object.versions !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.versions: object expected"); + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.fromObject(object.versions); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeStateResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeStateResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.versions != null && message.hasOwnProperty("versions")) { + object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(message.versions, options); + if (options.oneofs) + object.result = "versions"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeStateResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeStateResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetProtocolVersionUpgradeStateResponseV0.Versions = (function() { + + /** + * Properties of a Versions. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @interface IVersions + * @property {Array.|null} [versions] Versions versions + */ + + /** + * Constructs a new Versions. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @classdesc Represents a Versions. + * @implements IVersions + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set + */ + function Versions(properties) { + this.versions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Versions versions. + * @member {Array.} versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @instance + */ + Versions.prototype.versions = $util.emptyArray; + + /** + * Creates a new Versions instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions instance + */ + Versions.create = function create(properties) { + return new Versions(properties); + }; + + /** + * Encodes the specified Versions message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Versions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.encode(message.versions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Versions message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Versions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Versions message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Versions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Versions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Versions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Versions message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Versions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + return null; + }; + + /** + * Creates a Versions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + */ + Versions.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: object expected"); + message.versions[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.fromObject(object.versions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Versions message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message Versions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Versions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(message.versions[j], options); + } + return object; + }; + + /** + * Converts this Versions to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @instance + * @returns {Object.} JSON object + */ + Versions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Versions; + })(); + + GetProtocolVersionUpgradeStateResponseV0.VersionEntry = (function() { + + /** + * Properties of a VersionEntry. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @interface IVersionEntry + * @property {number|null} [versionNumber] VersionEntry versionNumber + * @property {number|null} [voteCount] VersionEntry voteCount + */ + + /** + * Constructs a new VersionEntry. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @classdesc Represents a VersionEntry. + * @implements IVersionEntry + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set + */ + function VersionEntry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VersionEntry versionNumber. + * @member {number} versionNumber + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @instance + */ + VersionEntry.prototype.versionNumber = 0; + + /** + * VersionEntry voteCount. + * @member {number} voteCount + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @instance + */ + VersionEntry.prototype.voteCount = 0; + + /** + * Creates a new VersionEntry instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry instance + */ + VersionEntry.create = function create(properties) { + return new VersionEntry(properties); + }; + + /** + * Encodes the specified VersionEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versionNumber != null && Object.hasOwnProperty.call(message, "versionNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.versionNumber); + if (message.voteCount != null && Object.hasOwnProperty.call(message, "voteCount")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.voteCount); + return writer; + }; + + /** + * Encodes the specified VersionEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VersionEntry message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.versionNumber = reader.uint32(); + break; + case 2: + message.voteCount = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VersionEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VersionEntry message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VersionEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + if (!$util.isInteger(message.versionNumber)) + return "versionNumber: integer expected"; + if (message.voteCount != null && message.hasOwnProperty("voteCount")) + if (!$util.isInteger(message.voteCount)) + return "voteCount: integer expected"; + return null; + }; + + /** + * Creates a VersionEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + */ + VersionEntry.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); + if (object.versionNumber != null) + message.versionNumber = object.versionNumber >>> 0; + if (object.voteCount != null) + message.voteCount = object.voteCount >>> 0; + return message; + }; + + /** + * Creates a plain object from a VersionEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message VersionEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VersionEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.versionNumber = 0; + object.voteCount = 0; + } + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + object.versionNumber = message.versionNumber; + if (message.voteCount != null && message.hasOwnProperty("voteCount")) + object.voteCount = message.voteCount; + return object; + }; + + /** + * Converts this VersionEntry to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @instance + * @returns {Object.} JSON object + */ + VersionEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VersionEntry; + })(); + + return GetProtocolVersionUpgradeStateResponseV0; + })(); + + return GetProtocolVersionUpgradeStateResponse; + })(); + + v0.GetProtocolVersionUpgradeVoteStatusRequest = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeVoteStatusRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetProtocolVersionUpgradeVoteStatusRequest + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null} [v0] GetProtocolVersionUpgradeVoteStatusRequest v0 + */ + + /** + * Constructs a new GetProtocolVersionUpgradeVoteStatusRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequest. + * @implements IGetProtocolVersionUpgradeVoteStatusRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeVoteStatusRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeVoteStatusRequest v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @instance + */ + GetProtocolVersionUpgradeVoteStatusRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProtocolVersionUpgradeVoteStatusRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeVoteStatusRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeVoteStatusRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest instance + */ + GetProtocolVersionUpgradeVoteStatusRequest.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusRequest(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeVoteStatusRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeVoteStatusRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeVoteStatusRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + */ + GetProtocolVersionUpgradeVoteStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeVoteStatusRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeVoteStatusRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeVoteStatusRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeVoteStatusRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @interface IGetProtocolVersionUpgradeVoteStatusRequestV0 + * @property {Uint8Array|null} [startProTxHash] GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash + * @property {number|null} [count] GetProtocolVersionUpgradeVoteStatusRequestV0 count + * @property {boolean|null} [prove] GetProtocolVersionUpgradeVoteStatusRequestV0 prove + */ + + /** + * Constructs a new GetProtocolVersionUpgradeVoteStatusRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequestV0. + * @implements IGetProtocolVersionUpgradeVoteStatusRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeVoteStatusRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash. + * @member {Uint8Array} startProTxHash + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.startProTxHash = $util.newBuffer([]); + + /** + * GetProtocolVersionUpgradeVoteStatusRequestV0 count. + * @member {number} count + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.count = 0; + + /** + * GetProtocolVersionUpgradeVoteStatusRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.prove = false; + + /** + * Creates a new GetProtocolVersionUpgradeVoteStatusRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 instance + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusRequestV0(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startProTxHash != null && Object.hasOwnProperty.call(message, "startProTxHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startProTxHash); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.count); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startProTxHash = reader.bytes(); + break; + case 2: + message.count = reader.uint32(); + break; + case 3: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeVoteStatusRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) + if (!(message.startProTxHash && typeof message.startProTxHash.length === "number" || $util.isString(message.startProTxHash))) + return "startProTxHash: buffer expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeVoteStatusRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); + if (object.startProTxHash != null) + if (typeof object.startProTxHash === "string") + $util.base64.decode(object.startProTxHash, message.startProTxHash = $util.newBuffer($util.base64.length(object.startProTxHash)), 0); + else if (object.startProTxHash.length >= 0) + message.startProTxHash = object.startProTxHash; + if (object.count != null) + message.count = object.count >>> 0; + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.startProTxHash = ""; + else { + object.startProTxHash = []; + if (options.bytes !== Array) + object.startProTxHash = $util.newBuffer(object.startProTxHash); + } + object.count = 0; + object.prove = false; + } + if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) + object.startProTxHash = options.bytes === String ? $util.base64.encode(message.startProTxHash, 0, message.startProTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.startProTxHash) : message.startProTxHash; + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeVoteStatusRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProtocolVersionUpgradeVoteStatusRequestV0; + })(); + + return GetProtocolVersionUpgradeVoteStatusRequest; + })(); + + v0.GetProtocolVersionUpgradeVoteStatusResponse = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeVoteStatusResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetProtocolVersionUpgradeVoteStatusResponse + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null} [v0] GetProtocolVersionUpgradeVoteStatusResponse v0 + */ + + /** + * Constructs a new GetProtocolVersionUpgradeVoteStatusResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponse. + * @implements IGetProtocolVersionUpgradeVoteStatusResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeVoteStatusResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeVoteStatusResponse v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @instance + */ + GetProtocolVersionUpgradeVoteStatusResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProtocolVersionUpgradeVoteStatusResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeVoteStatusResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse instance + */ + GetProtocolVersionUpgradeVoteStatusResponse.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusResponse(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeVoteStatusResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeVoteStatusResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeVoteStatusResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + */ + GetProtocolVersionUpgradeVoteStatusResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeVoteStatusResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeVoteStatusResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeVoteStatusResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeVoteStatusResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @interface IGetProtocolVersionUpgradeVoteStatusResponseV0 + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null} [versions] GetProtocolVersionUpgradeVoteStatusResponseV0 versions + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeVoteStatusResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeVoteStatusResponseV0 metadata + */ + + /** + * Constructs a new GetProtocolVersionUpgradeVoteStatusResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponseV0. + * @implements IGetProtocolVersionUpgradeVoteStatusResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeVoteStatusResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeVoteStatusResponseV0 versions. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null|undefined} versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.versions = null; + + /** + * GetProtocolVersionUpgradeVoteStatusResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.proof = null; + + /** + * GetProtocolVersionUpgradeVoteStatusResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProtocolVersionUpgradeVoteStatusResponseV0 result. + * @member {"versions"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["versions", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeVoteStatusResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 instance + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusResponseV0(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versions != null && Object.hasOwnProperty.call(message, "versions")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProtocolVersionUpgradeVoteStatusResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.versions != null && message.hasOwnProperty("versions")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify(message.versions); + if (error) + return "versions." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeVoteStatusResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); + if (object.versions != null) { + if (typeof object.versions !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.versions: object expected"); + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.fromObject(object.versions); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.versions != null && message.hasOwnProperty("versions")) { + object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(message.versions, options); + if (options.oneofs) + object.result = "versions"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeVoteStatusResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = (function() { + + /** + * Properties of a VersionSignals. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @interface IVersionSignals + * @property {Array.|null} [versionSignals] VersionSignals versionSignals + */ + + /** + * Constructs a new VersionSignals. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @classdesc Represents a VersionSignals. + * @implements IVersionSignals + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set + */ + function VersionSignals(properties) { + this.versionSignals = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VersionSignals versionSignals. + * @member {Array.} versionSignals + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @instance + */ + VersionSignals.prototype.versionSignals = $util.emptyArray; + + /** + * Creates a new VersionSignals instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals instance + */ + VersionSignals.create = function create(properties) { + return new VersionSignals(properties); + }; + + /** + * Encodes the specified VersionSignals message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionSignals.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versionSignals != null && message.versionSignals.length) + for (var i = 0; i < message.versionSignals.length; ++i) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.encode(message.versionSignals[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified VersionSignals message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionSignals.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VersionSignals message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionSignals.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.versionSignals && message.versionSignals.length)) + message.versionSignals = []; + message.versionSignals.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VersionSignals message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionSignals.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VersionSignals message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VersionSignals.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versionSignals != null && message.hasOwnProperty("versionSignals")) { + if (!Array.isArray(message.versionSignals)) + return "versionSignals: array expected"; + for (var i = 0; i < message.versionSignals.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify(message.versionSignals[i]); + if (error) + return "versionSignals." + error; + } + } + return null; + }; + + /** + * Creates a VersionSignals message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals + */ + VersionSignals.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); + if (object.versionSignals) { + if (!Array.isArray(object.versionSignals)) + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: array expected"); + message.versionSignals = []; + for (var i = 0; i < object.versionSignals.length; ++i) { + if (typeof object.versionSignals[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: object expected"); + message.versionSignals[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.fromObject(object.versionSignals[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a VersionSignals message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message VersionSignals + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VersionSignals.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versionSignals = []; + if (message.versionSignals && message.versionSignals.length) { + object.versionSignals = []; + for (var j = 0; j < message.versionSignals.length; ++j) + object.versionSignals[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(message.versionSignals[j], options); + } + return object; + }; + + /** + * Converts this VersionSignals to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @instance + * @returns {Object.} JSON object + */ + VersionSignals.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VersionSignals; + })(); + + GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = (function() { + + /** + * Properties of a VersionSignal. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @interface IVersionSignal + * @property {Uint8Array|null} [proTxHash] VersionSignal proTxHash + * @property {number|null} [version] VersionSignal version + */ + + /** + * Constructs a new VersionSignal. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @classdesc Represents a VersionSignal. + * @implements IVersionSignal + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set + */ + function VersionSignal(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VersionSignal proTxHash. + * @member {Uint8Array} proTxHash + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @instance + */ + VersionSignal.prototype.proTxHash = $util.newBuffer([]); + + /** + * VersionSignal version. + * @member {number} version + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @instance + */ + VersionSignal.prototype.version = 0; + + /** + * Creates a new VersionSignal instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal instance + */ + VersionSignal.create = function create(properties) { + return new VersionSignal(properties); + }; + + /** + * Encodes the specified VersionSignal message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionSignal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.proTxHash); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.version); + return writer; + }; + + /** + * Encodes the specified VersionSignal message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionSignal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VersionSignal message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionSignal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proTxHash = reader.bytes(); + break; + case 2: + message.version = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VersionSignal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionSignal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VersionSignal message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VersionSignal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) + return "proTxHash: buffer expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version)) + return "version: integer expected"; + return null; + }; + + /** + * Creates a VersionSignal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal + */ + VersionSignal.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); + if (object.proTxHash != null) + if (typeof object.proTxHash === "string") + $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); + else if (object.proTxHash.length >= 0) + message.proTxHash = object.proTxHash; + if (object.version != null) + message.version = object.version >>> 0; + return message; + }; + + /** + * Creates a plain object from a VersionSignal message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message VersionSignal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VersionSignal.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.proTxHash = ""; + else { + object.proTxHash = []; + if (options.bytes !== Array) + object.proTxHash = $util.newBuffer(object.proTxHash); + } + object.version = 0; + } + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this VersionSignal to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @instance + * @returns {Object.} JSON object + */ + VersionSignal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VersionSignal; + })(); + + return GetProtocolVersionUpgradeVoteStatusResponseV0; + })(); + + return GetProtocolVersionUpgradeVoteStatusResponse; + })(); + + v0.GetEpochsInfoRequest = (function() { + + /** + * Properties of a GetEpochsInfoRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetEpochsInfoRequest + * @property {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null} [v0] GetEpochsInfoRequest v0 + */ + + /** + * Constructs a new GetEpochsInfoRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetEpochsInfoRequest. + * @implements IGetEpochsInfoRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set + */ + function GetEpochsInfoRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEpochsInfoRequest v0. + * @member {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @instance + */ + GetEpochsInfoRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetEpochsInfoRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @instance + */ + Object.defineProperty(GetEpochsInfoRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetEpochsInfoRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest instance + */ + GetEpochsInfoRequest.create = function create(properties) { + return new GetEpochsInfoRequest(properties); + }; + + /** + * Encodes the specified GetEpochsInfoRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetEpochsInfoRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEpochsInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEpochsInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEpochsInfoRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEpochsInfoRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetEpochsInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + */ + GetEpochsInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetEpochsInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest} message GetEpochsInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEpochsInfoRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetEpochsInfoRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @instance + * @returns {Object.} JSON object + */ + GetEpochsInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetEpochsInfoRequest.GetEpochsInfoRequestV0 = (function() { + + /** + * Properties of a GetEpochsInfoRequestV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @interface IGetEpochsInfoRequestV0 + * @property {google.protobuf.IUInt32Value|null} [startEpoch] GetEpochsInfoRequestV0 startEpoch + * @property {number|null} [count] GetEpochsInfoRequestV0 count + * @property {boolean|null} [ascending] GetEpochsInfoRequestV0 ascending + * @property {boolean|null} [prove] GetEpochsInfoRequestV0 prove + */ + + /** + * Constructs a new GetEpochsInfoRequestV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @classdesc Represents a GetEpochsInfoRequestV0. + * @implements IGetEpochsInfoRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set + */ + function GetEpochsInfoRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEpochsInfoRequestV0 startEpoch. + * @member {google.protobuf.IUInt32Value|null|undefined} startEpoch + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @instance + */ + GetEpochsInfoRequestV0.prototype.startEpoch = null; + + /** + * GetEpochsInfoRequestV0 count. + * @member {number} count + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @instance + */ + GetEpochsInfoRequestV0.prototype.count = 0; + + /** + * GetEpochsInfoRequestV0 ascending. + * @member {boolean} ascending + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @instance + */ + GetEpochsInfoRequestV0.prototype.ascending = false; + + /** + * GetEpochsInfoRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @instance + */ + GetEpochsInfoRequestV0.prototype.prove = false; + + /** + * Creates a new GetEpochsInfoRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 instance + */ + GetEpochsInfoRequestV0.create = function create(properties) { + return new GetEpochsInfoRequestV0(properties); + }; + + /** + * Encodes the specified GetEpochsInfoRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startEpoch != null && Object.hasOwnProperty.call(message, "startEpoch")) + $root.google.protobuf.UInt32Value.encode(message.startEpoch, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.count); + if (message.ascending != null && Object.hasOwnProperty.call(message, "ascending")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.ascending); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetEpochsInfoRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startEpoch = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + break; + case 2: + message.count = reader.uint32(); + break; + case 3: + message.ascending = reader.bool(); + break; + case 4: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEpochsInfoRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEpochsInfoRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) { + var error = $root.google.protobuf.UInt32Value.verify(message.startEpoch); + if (error) + return "startEpoch." + error; + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + if (message.ascending != null && message.hasOwnProperty("ascending")) + if (typeof message.ascending !== "boolean") + return "ascending: boolean expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetEpochsInfoRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + */ + GetEpochsInfoRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); + if (object.startEpoch != null) { + if (typeof object.startEpoch !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.startEpoch: object expected"); + message.startEpoch = $root.google.protobuf.UInt32Value.fromObject(object.startEpoch); + } + if (object.count != null) + message.count = object.count >>> 0; + if (object.ascending != null) + message.ascending = Boolean(object.ascending); + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetEpochsInfoRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEpochsInfoRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startEpoch = null; + object.count = 0; + object.ascending = false; + object.prove = false; + } + if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) + object.startEpoch = $root.google.protobuf.UInt32Value.toObject(message.startEpoch, options); + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; + if (message.ascending != null && message.hasOwnProperty("ascending")) + object.ascending = message.ascending; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetEpochsInfoRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetEpochsInfoRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetEpochsInfoRequestV0; + })(); + + return GetEpochsInfoRequest; + })(); + + v0.GetEpochsInfoResponse = (function() { + + /** + * Properties of a GetEpochsInfoResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetEpochsInfoResponse + * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null} [v0] GetEpochsInfoResponse v0 + */ + + /** + * Constructs a new GetEpochsInfoResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetEpochsInfoResponse. + * @implements IGetEpochsInfoResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set + */ + function GetEpochsInfoResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEpochsInfoResponse v0. + * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @instance + */ + GetEpochsInfoResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetEpochsInfoResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @instance + */ + Object.defineProperty(GetEpochsInfoResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetEpochsInfoResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse instance + */ + GetEpochsInfoResponse.create = function create(properties) { + return new GetEpochsInfoResponse(properties); + }; + + /** + * Encodes the specified GetEpochsInfoResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetEpochsInfoResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEpochsInfoResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEpochsInfoResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEpochsInfoResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEpochsInfoResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetEpochsInfoResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + */ + GetEpochsInfoResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetEpochsInfoResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse} message GetEpochsInfoResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEpochsInfoResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetEpochsInfoResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @instance + * @returns {Object.} JSON object + */ + GetEpochsInfoResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetEpochsInfoResponse.GetEpochsInfoResponseV0 = (function() { + + /** + * Properties of a GetEpochsInfoResponseV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @interface IGetEpochsInfoResponseV0 + * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null} [epochs] GetEpochsInfoResponseV0 epochs + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetEpochsInfoResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetEpochsInfoResponseV0 metadata + */ + + /** + * Constructs a new GetEpochsInfoResponseV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @classdesc Represents a GetEpochsInfoResponseV0. + * @implements IGetEpochsInfoResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set + */ + function GetEpochsInfoResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEpochsInfoResponseV0 epochs. + * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null|undefined} epochs + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @instance + */ + GetEpochsInfoResponseV0.prototype.epochs = null; + + /** + * GetEpochsInfoResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @instance + */ + GetEpochsInfoResponseV0.prototype.proof = null; + + /** + * GetEpochsInfoResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @instance + */ + GetEpochsInfoResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetEpochsInfoResponseV0 result. + * @member {"epochs"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @instance + */ + Object.defineProperty(GetEpochsInfoResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["epochs", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetEpochsInfoResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 instance + */ + GetEpochsInfoResponseV0.create = function create(properties) { + return new GetEpochsInfoResponseV0(properties); + }; + + /** + * Encodes the specified GetEpochsInfoResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.epochs != null && Object.hasOwnProperty.call(message, "epochs")) + $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.encode(message.epochs, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetEpochsInfoResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEpochsInfoResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEpochsInfoResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEpochsInfoResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEpochsInfoResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.epochs != null && message.hasOwnProperty("epochs")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify(message.epochs); + if (error) + return "epochs." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetEpochsInfoResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 + */ + GetEpochsInfoResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); + if (object.epochs != null) { + if (typeof object.epochs !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.epochs: object expected"); + message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.fromObject(object.epochs); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetEpochsInfoResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEpochsInfoResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.epochs != null && message.hasOwnProperty("epochs")) { + object.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(message.epochs, options); + if (options.oneofs) + object.result = "epochs"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetEpochsInfoResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetEpochsInfoResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetEpochsInfoResponseV0.EpochInfos = (function() { + + /** + * Properties of an EpochInfos. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @interface IEpochInfos + * @property {Array.|null} [epochInfos] EpochInfos epochInfos + */ + + /** + * Constructs a new EpochInfos. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @classdesc Represents an EpochInfos. + * @implements IEpochInfos + * @constructor + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set + */ + function EpochInfos(properties) { + this.epochInfos = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EpochInfos epochInfos. + * @member {Array.} epochInfos + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @instance + */ + EpochInfos.prototype.epochInfos = $util.emptyArray; + + /** + * Creates a new EpochInfos instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos instance + */ + EpochInfos.create = function create(properties) { + return new EpochInfos(properties); + }; + + /** + * Encodes the specified EpochInfos message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EpochInfos.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.epochInfos != null && message.epochInfos.length) + for (var i = 0; i < message.epochInfos.length; ++i) + $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.encode(message.epochInfos[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EpochInfos message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EpochInfos.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EpochInfos message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EpochInfos.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.epochInfos && message.epochInfos.length)) + message.epochInfos = []; + message.epochInfos.push($root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EpochInfos message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EpochInfos.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EpochInfos message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EpochInfos.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.epochInfos != null && message.hasOwnProperty("epochInfos")) { + if (!Array.isArray(message.epochInfos)) + return "epochInfos: array expected"; + for (var i = 0; i < message.epochInfos.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify(message.epochInfos[i]); + if (error) + return "epochInfos." + error; + } + } + return null; + }; + + /** + * Creates an EpochInfos message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos + */ + EpochInfos.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); + if (object.epochInfos) { + if (!Array.isArray(object.epochInfos)) + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: array expected"); + message.epochInfos = []; + for (var i = 0; i < object.epochInfos.length; ++i) { + if (typeof object.epochInfos[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: object expected"); + message.epochInfos[i] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.fromObject(object.epochInfos[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EpochInfos message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message EpochInfos + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EpochInfos.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.epochInfos = []; + if (message.epochInfos && message.epochInfos.length) { + object.epochInfos = []; + for (var j = 0; j < message.epochInfos.length; ++j) + object.epochInfos[j] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(message.epochInfos[j], options); + } + return object; + }; + + /** + * Converts this EpochInfos to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos + * @instance + * @returns {Object.} JSON object + */ + EpochInfos.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EpochInfos; + })(); + + GetEpochsInfoResponseV0.EpochInfo = (function() { + + /** + * Properties of an EpochInfo. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @interface IEpochInfo + * @property {number|null} [number] EpochInfo number + * @property {number|Long|null} [firstBlockHeight] EpochInfo firstBlockHeight + * @property {number|null} [firstCoreBlockHeight] EpochInfo firstCoreBlockHeight + * @property {number|Long|null} [startTime] EpochInfo startTime + * @property {number|null} [feeMultiplier] EpochInfo feeMultiplier + * @property {number|null} [protocolVersion] EpochInfo protocolVersion + */ + + /** + * Constructs a new EpochInfo. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @classdesc Represents an EpochInfo. + * @implements IEpochInfo + * @constructor + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set + */ + function EpochInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EpochInfo number. + * @member {number} number + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.number = 0; + + /** + * EpochInfo firstBlockHeight. + * @member {number|Long} firstBlockHeight + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.firstBlockHeight = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * EpochInfo firstCoreBlockHeight. + * @member {number} firstCoreBlockHeight + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.firstCoreBlockHeight = 0; + + /** + * EpochInfo startTime. + * @member {number|Long} startTime + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.startTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * EpochInfo feeMultiplier. + * @member {number} feeMultiplier + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.feeMultiplier = 0; + + /** + * EpochInfo protocolVersion. + * @member {number} protocolVersion + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.protocolVersion = 0; + + /** + * Creates a new EpochInfo instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo instance + */ + EpochInfo.create = function create(properties) { + return new EpochInfo(properties); + }; + + /** + * Encodes the specified EpochInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EpochInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.number); + if (message.firstBlockHeight != null && Object.hasOwnProperty.call(message, "firstBlockHeight")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.firstBlockHeight); + if (message.firstCoreBlockHeight != null && Object.hasOwnProperty.call(message, "firstCoreBlockHeight")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.firstCoreBlockHeight); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.startTime); + if (message.feeMultiplier != null && Object.hasOwnProperty.call(message, "feeMultiplier")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.feeMultiplier); + if (message.protocolVersion != null && Object.hasOwnProperty.call(message, "protocolVersion")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.protocolVersion); + return writer; + }; + + /** + * Encodes the specified EpochInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EpochInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EpochInfo message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EpochInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.number = reader.uint32(); + break; + case 2: + message.firstBlockHeight = reader.uint64(); + break; + case 3: + message.firstCoreBlockHeight = reader.uint32(); + break; + case 4: + message.startTime = reader.uint64(); + break; + case 5: + message.feeMultiplier = reader.double(); + break; + case 6: + message.protocolVersion = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EpochInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EpochInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EpochInfo message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EpochInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) + if (!$util.isInteger(message.firstBlockHeight) && !(message.firstBlockHeight && $util.isInteger(message.firstBlockHeight.low) && $util.isInteger(message.firstBlockHeight.high))) + return "firstBlockHeight: integer|Long expected"; + if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) + if (!$util.isInteger(message.firstCoreBlockHeight)) + return "firstCoreBlockHeight: integer expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) + if (!$util.isInteger(message.startTime) && !(message.startTime && $util.isInteger(message.startTime.low) && $util.isInteger(message.startTime.high))) + return "startTime: integer|Long expected"; + if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) + if (typeof message.feeMultiplier !== "number") + return "feeMultiplier: number expected"; + if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) + if (!$util.isInteger(message.protocolVersion)) + return "protocolVersion: integer expected"; + return null; + }; + + /** + * Creates an EpochInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + */ + EpochInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); + if (object.number != null) + message.number = object.number >>> 0; + if (object.firstBlockHeight != null) + if ($util.Long) + (message.firstBlockHeight = $util.Long.fromValue(object.firstBlockHeight)).unsigned = true; + else if (typeof object.firstBlockHeight === "string") + message.firstBlockHeight = parseInt(object.firstBlockHeight, 10); + else if (typeof object.firstBlockHeight === "number") + message.firstBlockHeight = object.firstBlockHeight; + else if (typeof object.firstBlockHeight === "object") + message.firstBlockHeight = new $util.LongBits(object.firstBlockHeight.low >>> 0, object.firstBlockHeight.high >>> 0).toNumber(true); + if (object.firstCoreBlockHeight != null) + message.firstCoreBlockHeight = object.firstCoreBlockHeight >>> 0; + if (object.startTime != null) + if ($util.Long) + (message.startTime = $util.Long.fromValue(object.startTime)).unsigned = true; + else if (typeof object.startTime === "string") + message.startTime = parseInt(object.startTime, 10); + else if (typeof object.startTime === "number") + message.startTime = object.startTime; + else if (typeof object.startTime === "object") + message.startTime = new $util.LongBits(object.startTime.low >>> 0, object.startTime.high >>> 0).toNumber(true); + if (object.feeMultiplier != null) + message.feeMultiplier = Number(object.feeMultiplier); + if (object.protocolVersion != null) + message.protocolVersion = object.protocolVersion >>> 0; + return message; + }; - /** - * Creates a plain object from a GetDocumentsRequestV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} message GetDocumentsRequestV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDocumentsRequestV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.dataContractId = ""; - else { - object.dataContractId = []; - if (options.bytes !== Array) - object.dataContractId = $util.newBuffer(object.dataContractId); - } - object.documentType = ""; - if (options.bytes === String) - object.where = ""; - else { - object.where = []; - if (options.bytes !== Array) - object.where = $util.newBuffer(object.where); - } - if (options.bytes === String) - object.orderBy = ""; - else { - object.orderBy = []; - if (options.bytes !== Array) - object.orderBy = $util.newBuffer(object.orderBy); + /** + * Creates a plain object from an EpochInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @static + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message EpochInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EpochInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.number = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.firstBlockHeight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.firstBlockHeight = options.longs === String ? "0" : 0; + object.firstCoreBlockHeight = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.startTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startTime = options.longs === String ? "0" : 0; + object.feeMultiplier = 0; + object.protocolVersion = 0; } - object.limit = 0; - object.prove = false; - } - if (message.dataContractId != null && message.hasOwnProperty("dataContractId")) - object.dataContractId = options.bytes === String ? $util.base64.encode(message.dataContractId, 0, message.dataContractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.dataContractId) : message.dataContractId; - if (message.documentType != null && message.hasOwnProperty("documentType")) - object.documentType = message.documentType; - if (message.where != null && message.hasOwnProperty("where")) - object.where = options.bytes === String ? $util.base64.encode(message.where, 0, message.where.length) : options.bytes === Array ? Array.prototype.slice.call(message.where) : message.where; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = options.bytes === String ? $util.base64.encode(message.orderBy, 0, message.orderBy.length) : options.bytes === Array ? Array.prototype.slice.call(message.orderBy) : message.orderBy; - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = message.limit; - if (message.startAfter != null && message.hasOwnProperty("startAfter")) { - object.startAfter = options.bytes === String ? $util.base64.encode(message.startAfter, 0, message.startAfter.length) : options.bytes === Array ? Array.prototype.slice.call(message.startAfter) : message.startAfter; - if (options.oneofs) - object.start = "startAfter"; - } - if (message.startAt != null && message.hasOwnProperty("startAt")) { - object.startAt = options.bytes === String ? $util.base64.encode(message.startAt, 0, message.startAt.length) : options.bytes === Array ? Array.prototype.slice.call(message.startAt) : message.startAt; - if (options.oneofs) - object.start = "startAt"; - } - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; - return object; - }; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) + if (typeof message.firstBlockHeight === "number") + object.firstBlockHeight = options.longs === String ? String(message.firstBlockHeight) : message.firstBlockHeight; + else + object.firstBlockHeight = options.longs === String ? $util.Long.prototype.toString.call(message.firstBlockHeight) : options.longs === Number ? new $util.LongBits(message.firstBlockHeight.low >>> 0, message.firstBlockHeight.high >>> 0).toNumber(true) : message.firstBlockHeight; + if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) + object.firstCoreBlockHeight = message.firstCoreBlockHeight; + if (message.startTime != null && message.hasOwnProperty("startTime")) + if (typeof message.startTime === "number") + object.startTime = options.longs === String ? String(message.startTime) : message.startTime; + else + object.startTime = options.longs === String ? $util.Long.prototype.toString.call(message.startTime) : options.longs === Number ? new $util.LongBits(message.startTime.low >>> 0, message.startTime.high >>> 0).toNumber(true) : message.startTime; + if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) + object.feeMultiplier = options.json && !isFinite(message.feeMultiplier) ? String(message.feeMultiplier) : message.feeMultiplier; + if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) + object.protocolVersion = message.protocolVersion; + return object; + }; - /** - * Converts this GetDocumentsRequestV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0 - * @instance - * @returns {Object.} JSON object - */ - GetDocumentsRequestV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this EpochInfo to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + * @returns {Object.} JSON object + */ + EpochInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GetDocumentsRequestV0; + return EpochInfo; + })(); + + return GetEpochsInfoResponseV0; })(); - return GetDocumentsRequest; + return GetEpochsInfoResponse; })(); - v0.GetDocumentsResponse = (function() { + v0.GetContestedResourcesRequest = (function() { /** - * Properties of a GetDocumentsResponse. + * Properties of a GetContestedResourcesRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetDocumentsResponse - * @property {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0|null} [v0] GetDocumentsResponse v0 + * @interface IGetContestedResourcesRequest + * @property {org.dash.platform.dapi.v0.GetContestedResourcesRequest.IGetContestedResourcesRequestV0|null} [v0] GetContestedResourcesRequest v0 */ /** - * Constructs a new GetDocumentsResponse. + * Constructs a new GetContestedResourcesRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetDocumentsResponse. - * @implements IGetDocumentsResponse + * @classdesc Represents a GetContestedResourcesRequest. + * @implements IGetContestedResourcesRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesRequest=} [properties] Properties to set */ - function GetDocumentsResponse(properties) { + function GetContestedResourcesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14835,89 +25840,89 @@ $root.org = (function() { } /** - * GetDocumentsResponse v0. - * @member {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * GetContestedResourcesRequest v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourcesRequest.IGetContestedResourcesRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @instance */ - GetDocumentsResponse.prototype.v0 = null; + GetContestedResourcesRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetDocumentsResponse version. + * GetContestedResourcesRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @instance */ - Object.defineProperty(GetDocumentsResponse.prototype, "version", { + Object.defineProperty(GetContestedResourcesRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetDocumentsResponse instance using the specified properties. + * Creates a new GetContestedResourcesRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse instance + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest} GetContestedResourcesRequest instance */ - GetDocumentsResponse.create = function create(properties) { - return new GetDocumentsResponse(properties); + GetContestedResourcesRequest.create = function create(properties) { + return new GetContestedResourcesRequest(properties); }; /** - * Encodes the specified GetDocumentsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.verify|verify} messages. + * Encodes the specified GetContestedResourcesRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @static - * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse} message GetDocumentsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesRequest} message GetContestedResourcesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsResponse.encode = function encode(message, writer) { + GetContestedResourcesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDocumentsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.verify|verify} messages. + * Encodes the specified GetContestedResourcesRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @static - * @param {org.dash.platform.dapi.v0.IGetDocumentsResponse} message GetDocumentsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesRequest} message GetContestedResourcesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourcesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDocumentsResponse message from the specified reader or buffer. + * Decodes a GetContestedResourcesRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest} GetContestedResourcesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsResponse.decode = function decode(reader, length) { + GetContestedResourcesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -14928,37 +25933,37 @@ $root.org = (function() { }; /** - * Decodes a GetDocumentsResponse message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourcesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest} GetContestedResourcesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourcesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDocumentsResponse message. + * Verifies a GetContestedResourcesRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDocumentsResponse.verify = function verify(message) { + GetContestedResourcesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -14967,40 +25972,40 @@ $root.org = (function() { }; /** - * Creates a GetDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourcesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse} GetDocumentsResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest} GetContestedResourcesRequest */ - GetDocumentsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsResponse) + GetContestedResourcesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetDocumentsResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourcesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse} message GetDocumentsResponse + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest} message GetContestedResourcesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDocumentsResponse.toObject = function toObject(message, options) { + GetContestedResourcesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -15008,36 +26013,44 @@ $root.org = (function() { }; /** - * Converts this GetDocumentsResponse to JSON. + * Converts this GetContestedResourcesRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest * @instance * @returns {Object.} JSON object */ - GetDocumentsResponse.prototype.toJSON = function toJSON() { + GetContestedResourcesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetDocumentsResponse.GetDocumentsResponseV0 = (function() { + GetContestedResourcesRequest.GetContestedResourcesRequestV0 = (function() { /** - * Properties of a GetDocumentsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse - * @interface IGetDocumentsResponseV0 - * @property {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments|null} [documents] GetDocumentsResponseV0 documents - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetDocumentsResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetDocumentsResponseV0 metadata + * Properties of a GetContestedResourcesRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest + * @interface IGetContestedResourcesRequestV0 + * @property {Uint8Array|null} [contractId] GetContestedResourcesRequestV0 contractId + * @property {string|null} [documentTypeName] GetContestedResourcesRequestV0 documentTypeName + * @property {string|null} [indexName] GetContestedResourcesRequestV0 indexName + * @property {Array.|null} [startIndexValues] GetContestedResourcesRequestV0 startIndexValues + * @property {Array.|null} [endIndexValues] GetContestedResourcesRequestV0 endIndexValues + * @property {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.IStartAtValueInfo|null} [startAtValueInfo] GetContestedResourcesRequestV0 startAtValueInfo + * @property {number|null} [count] GetContestedResourcesRequestV0 count + * @property {boolean|null} [orderAscending] GetContestedResourcesRequestV0 orderAscending + * @property {boolean|null} [prove] GetContestedResourcesRequestV0 prove */ /** - * Constructs a new GetDocumentsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse - * @classdesc Represents a GetDocumentsResponseV0. - * @implements IGetDocumentsResponseV0 + * Constructs a new GetContestedResourcesRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest + * @classdesc Represents a GetContestedResourcesRequestV0. + * @implements IGetContestedResourcesRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.IGetContestedResourcesRequestV0=} [properties] Properties to set */ - function GetDocumentsResponseV0(properties) { + function GetContestedResourcesRequestV0(properties) { + this.startIndexValues = []; + this.endIndexValues = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15045,115 +26058,185 @@ $root.org = (function() { } /** - * GetDocumentsResponseV0 documents. - * @member {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments|null|undefined} documents - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * GetContestedResourcesRequestV0 contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @instance */ - GetDocumentsResponseV0.prototype.documents = null; + GetContestedResourcesRequestV0.prototype.contractId = $util.newBuffer([]); /** - * GetDocumentsResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * GetContestedResourcesRequestV0 documentTypeName. + * @member {string} documentTypeName + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @instance */ - GetDocumentsResponseV0.prototype.proof = null; + GetContestedResourcesRequestV0.prototype.documentTypeName = ""; /** - * GetDocumentsResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * GetContestedResourcesRequestV0 indexName. + * @member {string} indexName + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @instance */ - GetDocumentsResponseV0.prototype.metadata = null; + GetContestedResourcesRequestV0.prototype.indexName = ""; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * GetContestedResourcesRequestV0 startIndexValues. + * @member {Array.} startIndexValues + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 + * @instance + */ + GetContestedResourcesRequestV0.prototype.startIndexValues = $util.emptyArray; /** - * GetDocumentsResponseV0 result. - * @member {"documents"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * GetContestedResourcesRequestV0 endIndexValues. + * @member {Array.} endIndexValues + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @instance */ - Object.defineProperty(GetDocumentsResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["documents", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetContestedResourcesRequestV0.prototype.endIndexValues = $util.emptyArray; /** - * Creates a new GetDocumentsResponseV0 instance using the specified properties. + * GetContestedResourcesRequestV0 startAtValueInfo. + * @member {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.IStartAtValueInfo|null|undefined} startAtValueInfo + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 + * @instance + */ + GetContestedResourcesRequestV0.prototype.startAtValueInfo = null; + + /** + * GetContestedResourcesRequestV0 count. + * @member {number} count + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 + * @instance + */ + GetContestedResourcesRequestV0.prototype.count = 0; + + /** + * GetContestedResourcesRequestV0 orderAscending. + * @member {boolean} orderAscending + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 + * @instance + */ + GetContestedResourcesRequestV0.prototype.orderAscending = false; + + /** + * GetContestedResourcesRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 + * @instance + */ + GetContestedResourcesRequestV0.prototype.prove = false; + + /** + * Creates a new GetContestedResourcesRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.IGetContestedResourcesRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} GetContestedResourcesRequestV0 instance */ - GetDocumentsResponseV0.create = function create(properties) { - return new GetDocumentsResponseV0(properties); + GetContestedResourcesRequestV0.create = function create(properties) { + return new GetContestedResourcesRequestV0(properties); }; /** - * Encodes the specified GetDocumentsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourcesRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0} message GetDocumentsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.IGetContestedResourcesRequestV0} message GetContestedResourcesRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsResponseV0.encode = function encode(message, writer) { + GetContestedResourcesRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) - $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.encode(message.documents, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + if (message.documentTypeName != null && Object.hasOwnProperty.call(message, "documentTypeName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentTypeName); + if (message.indexName != null && Object.hasOwnProperty.call(message, "indexName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.indexName); + if (message.startIndexValues != null && message.startIndexValues.length) + for (var i = 0; i < message.startIndexValues.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.startIndexValues[i]); + if (message.endIndexValues != null && message.endIndexValues.length) + for (var i = 0; i < message.endIndexValues.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.endIndexValues[i]); + if (message.startAtValueInfo != null && Object.hasOwnProperty.call(message, "startAtValueInfo")) + $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.encode(message.startAtValueInfo, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.count); + if (message.orderAscending != null && Object.hasOwnProperty.call(message, "orderAscending")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.orderAscending); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.prove); return writer; }; /** - * Encodes the specified GetDocumentsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourcesRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.IGetDocumentsResponseV0} message GetDocumentsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.IGetContestedResourcesRequestV0} message GetContestedResourcesRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDocumentsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourcesRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDocumentsResponseV0 message from the specified reader or buffer. + * Decodes a GetContestedResourcesRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} GetContestedResourcesRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsResponseV0.decode = function decode(reader, length) { + GetContestedResourcesRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.documents = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.decode(reader, reader.uint32()); + message.contractId = reader.bytes(); break; case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + message.documentTypeName = reader.string(); break; case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.indexName = reader.string(); + break; + case 4: + if (!(message.startIndexValues && message.startIndexValues.length)) + message.startIndexValues = []; + message.startIndexValues.push(reader.bytes()); + break; + case 5: + if (!(message.endIndexValues && message.endIndexValues.length)) + message.endIndexValues = []; + message.endIndexValues.push(reader.bytes()); + break; + case 6: + message.startAtValueInfo = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.decode(reader, reader.uint32()); + break; + case 7: + message.count = reader.uint32(); + break; + case 8: + message.orderAscending = reader.bool(); + break; + case 9: + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -15164,149 +26247,216 @@ $root.org = (function() { }; /** - * Decodes a GetDocumentsResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourcesRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} GetContestedResourcesRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDocumentsResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourcesRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDocumentsResponseV0 message. + * Verifies a GetContestedResourcesRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDocumentsResponseV0.verify = function verify(message) { + GetContestedResourcesRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.documents != null && message.hasOwnProperty("documents")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.verify(message.documents); - if (error) - return "documents." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + if (!$util.isString(message.documentTypeName)) + return "documentTypeName: string expected"; + if (message.indexName != null && message.hasOwnProperty("indexName")) + if (!$util.isString(message.indexName)) + return "indexName: string expected"; + if (message.startIndexValues != null && message.hasOwnProperty("startIndexValues")) { + if (!Array.isArray(message.startIndexValues)) + return "startIndexValues: array expected"; + for (var i = 0; i < message.startIndexValues.length; ++i) + if (!(message.startIndexValues[i] && typeof message.startIndexValues[i].length === "number" || $util.isString(message.startIndexValues[i]))) + return "startIndexValues: buffer[] expected"; + } + if (message.endIndexValues != null && message.hasOwnProperty("endIndexValues")) { + if (!Array.isArray(message.endIndexValues)) + return "endIndexValues: array expected"; + for (var i = 0; i < message.endIndexValues.length; ++i) + if (!(message.endIndexValues[i] && typeof message.endIndexValues[i].length === "number" || $util.isString(message.endIndexValues[i]))) + return "endIndexValues: buffer[] expected"; + } + if (message.startAtValueInfo != null && message.hasOwnProperty("startAtValueInfo")) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.verify(message.startAtValueInfo); if (error) - return "metadata." + error; + return "startAtValueInfo." + error; } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + if (message.orderAscending != null && message.hasOwnProperty("orderAscending")) + if (typeof message.orderAscending !== "boolean") + return "orderAscending: boolean expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetDocumentsResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourcesRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} GetDocumentsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} GetContestedResourcesRequestV0 */ - GetDocumentsResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0) + GetContestedResourcesRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0(); - if (object.documents != null) { - if (typeof object.documents !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.documents: object expected"); - message.documents = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.fromObject(object.documents); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0(); + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentTypeName != null) + message.documentTypeName = String(object.documentTypeName); + if (object.indexName != null) + message.indexName = String(object.indexName); + if (object.startIndexValues) { + if (!Array.isArray(object.startIndexValues)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.startIndexValues: array expected"); + message.startIndexValues = []; + for (var i = 0; i < object.startIndexValues.length; ++i) + if (typeof object.startIndexValues[i] === "string") + $util.base64.decode(object.startIndexValues[i], message.startIndexValues[i] = $util.newBuffer($util.base64.length(object.startIndexValues[i])), 0); + else if (object.startIndexValues[i].length >= 0) + message.startIndexValues[i] = object.startIndexValues[i]; + } + if (object.endIndexValues) { + if (!Array.isArray(object.endIndexValues)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.endIndexValues: array expected"); + message.endIndexValues = []; + for (var i = 0; i < object.endIndexValues.length; ++i) + if (typeof object.endIndexValues[i] === "string") + $util.base64.decode(object.endIndexValues[i], message.endIndexValues[i] = $util.newBuffer($util.base64.length(object.endIndexValues[i])), 0); + else if (object.endIndexValues[i].length >= 0) + message.endIndexValues[i] = object.endIndexValues[i]; + } + if (object.startAtValueInfo != null) { + if (typeof object.startAtValueInfo !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.startAtValueInfo: object expected"); + message.startAtValueInfo = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.fromObject(object.startAtValueInfo); } + if (object.count != null) + message.count = object.count >>> 0; + if (object.orderAscending != null) + message.orderAscending = Boolean(object.orderAscending); + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetDocumentsResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourcesRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} message GetDocumentsResponseV0 + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} message GetContestedResourcesRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDocumentsResponseV0.toObject = function toObject(message, options) { + GetContestedResourcesRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.metadata = null; - if (message.documents != null && message.hasOwnProperty("documents")) { - object.documents = $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(message.documents, options); - if (options.oneofs) - object.result = "documents"; + if (options.arrays || options.defaults) { + object.startIndexValues = []; + object.endIndexValues = []; } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; + if (options.defaults) { + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + object.documentTypeName = ""; + object.indexName = ""; + object.startAtValueInfo = null; + object.count = 0; + object.orderAscending = false; + object.prove = false; } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + object.documentTypeName = message.documentTypeName; + if (message.indexName != null && message.hasOwnProperty("indexName")) + object.indexName = message.indexName; + if (message.startIndexValues && message.startIndexValues.length) { + object.startIndexValues = []; + for (var j = 0; j < message.startIndexValues.length; ++j) + object.startIndexValues[j] = options.bytes === String ? $util.base64.encode(message.startIndexValues[j], 0, message.startIndexValues[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.startIndexValues[j]) : message.startIndexValues[j]; + } + if (message.endIndexValues && message.endIndexValues.length) { + object.endIndexValues = []; + for (var j = 0; j < message.endIndexValues.length; ++j) + object.endIndexValues[j] = options.bytes === String ? $util.base64.encode(message.endIndexValues[j], 0, message.endIndexValues[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.endIndexValues[j]) : message.endIndexValues[j]; + } + if (message.startAtValueInfo != null && message.hasOwnProperty("startAtValueInfo")) + object.startAtValueInfo = $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.toObject(message.startAtValueInfo, options); + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; + if (message.orderAscending != null && message.hasOwnProperty("orderAscending")) + object.orderAscending = message.orderAscending; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetDocumentsResponseV0 to JSON. + * Converts this GetContestedResourcesRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 * @instance * @returns {Object.} JSON object */ - GetDocumentsResponseV0.prototype.toJSON = function toJSON() { + GetContestedResourcesRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetDocumentsResponseV0.Documents = (function() { + GetContestedResourcesRequestV0.StartAtValueInfo = (function() { /** - * Properties of a Documents. - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 - * @interface IDocuments - * @property {Array.|null} [documents] Documents documents + * Properties of a StartAtValueInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 + * @interface IStartAtValueInfo + * @property {Uint8Array|null} [startValue] StartAtValueInfo startValue + * @property {boolean|null} [startValueIncluded] StartAtValueInfo startValueIncluded */ /** - * Constructs a new Documents. - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0 - * @classdesc Represents a Documents. - * @implements IDocuments + * Constructs a new StartAtValueInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 + * @classdesc Represents a StartAtValueInfo. + * @implements IStartAtValueInfo * @constructor - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.IStartAtValueInfo=} [properties] Properties to set */ - function Documents(properties) { - this.documents = []; + function StartAtValueInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15314,78 +26464,88 @@ $root.org = (function() { } /** - * Documents documents. - * @member {Array.} documents - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * StartAtValueInfo startValue. + * @member {Uint8Array} startValue + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @instance */ - Documents.prototype.documents = $util.emptyArray; + StartAtValueInfo.prototype.startValue = $util.newBuffer([]); /** - * Creates a new Documents instance using the specified properties. + * StartAtValueInfo startValueIncluded. + * @member {boolean} startValueIncluded + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo + * @instance + */ + StartAtValueInfo.prototype.startValueIncluded = false; + + /** + * Creates a new StartAtValueInfo instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents instance + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.IStartAtValueInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} StartAtValueInfo instance */ - Documents.create = function create(properties) { - return new Documents(properties); + StartAtValueInfo.create = function create(properties) { + return new StartAtValueInfo(properties); }; /** - * Encodes the specified Documents message. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.verify|verify} messages. + * Encodes the specified StartAtValueInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments} message Documents message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.IStartAtValueInfo} message StartAtValueInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Documents.encode = function encode(message, writer) { + StartAtValueInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.documents != null && message.documents.length) - for (var i = 0; i < message.documents.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.documents[i]); + if (message.startValue != null && Object.hasOwnProperty.call(message, "startValue")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startValue); + if (message.startValueIncluded != null && Object.hasOwnProperty.call(message, "startValueIncluded")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.startValueIncluded); return writer; }; /** - * Encodes the specified Documents message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.verify|verify} messages. + * Encodes the specified StartAtValueInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.IDocuments} message Documents message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.IStartAtValueInfo} message StartAtValueInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Documents.encodeDelimited = function encodeDelimited(message, writer) { + StartAtValueInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Documents message from the specified reader or buffer. + * Decodes a StartAtValueInfo message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} StartAtValueInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Documents.decode = function decode(reader, length) { + StartAtValueInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.documents && message.documents.length)) - message.documents = []; - message.documents.push(reader.bytes()); + message.startValue = reader.bytes(); + break; + case 2: + message.startValueIncluded = reader.bool(); break; default: reader.skipType(tag & 7); @@ -15396,128 +26556,131 @@ $root.org = (function() { }; /** - * Decodes a Documents message from the specified reader or buffer, length delimited. + * Decodes a StartAtValueInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} StartAtValueInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Documents.decodeDelimited = function decodeDelimited(reader) { + StartAtValueInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Documents message. + * Verifies a StartAtValueInfo message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Documents.verify = function verify(message) { + StartAtValueInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.documents != null && message.hasOwnProperty("documents")) { - if (!Array.isArray(message.documents)) - return "documents: array expected"; - for (var i = 0; i < message.documents.length; ++i) - if (!(message.documents[i] && typeof message.documents[i].length === "number" || $util.isString(message.documents[i]))) - return "documents: buffer[] expected"; - } + if (message.startValue != null && message.hasOwnProperty("startValue")) + if (!(message.startValue && typeof message.startValue.length === "number" || $util.isString(message.startValue))) + return "startValue: buffer expected"; + if (message.startValueIncluded != null && message.hasOwnProperty("startValueIncluded")) + if (typeof message.startValueIncluded !== "boolean") + return "startValueIncluded: boolean expected"; return null; }; /** - * Creates a Documents message from a plain object. Also converts values to their respective internal types. + * Creates a StartAtValueInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} Documents + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} StartAtValueInfo */ - Documents.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents) + StartAtValueInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo) return object; - var message = new $root.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents(); - if (object.documents) { - if (!Array.isArray(object.documents)) - throw TypeError(".org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.documents: array expected"); - message.documents = []; - for (var i = 0; i < object.documents.length; ++i) - if (typeof object.documents[i] === "string") - $util.base64.decode(object.documents[i], message.documents[i] = $util.newBuffer($util.base64.length(object.documents[i])), 0); - else if (object.documents[i].length >= 0) - message.documents[i] = object.documents[i]; - } + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo(); + if (object.startValue != null) + if (typeof object.startValue === "string") + $util.base64.decode(object.startValue, message.startValue = $util.newBuffer($util.base64.length(object.startValue)), 0); + else if (object.startValue.length >= 0) + message.startValue = object.startValue; + if (object.startValueIncluded != null) + message.startValueIncluded = Boolean(object.startValueIncluded); return message; }; /** - * Creates a plain object from a Documents message. Also converts values to other types if specified. + * Creates a plain object from a StartAtValueInfo message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @static - * @param {org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} message Documents + * @param {org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} message StartAtValueInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Documents.toObject = function toObject(message, options) { + StartAtValueInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.documents = []; - if (message.documents && message.documents.length) { - object.documents = []; - for (var j = 0; j < message.documents.length; ++j) - object.documents[j] = options.bytes === String ? $util.base64.encode(message.documents[j], 0, message.documents[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.documents[j]) : message.documents[j]; + if (options.defaults) { + if (options.bytes === String) + object.startValue = ""; + else { + object.startValue = []; + if (options.bytes !== Array) + object.startValue = $util.newBuffer(object.startValue); + } + object.startValueIncluded = false; } + if (message.startValue != null && message.hasOwnProperty("startValue")) + object.startValue = options.bytes === String ? $util.base64.encode(message.startValue, 0, message.startValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.startValue) : message.startValue; + if (message.startValueIncluded != null && message.hasOwnProperty("startValueIncluded")) + object.startValueIncluded = message.startValueIncluded; return object; }; /** - * Converts this Documents to JSON. + * Converts this StartAtValueInfo to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo * @instance * @returns {Object.} JSON object */ - Documents.prototype.toJSON = function toJSON() { + StartAtValueInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Documents; + return StartAtValueInfo; })(); - return GetDocumentsResponseV0; + return GetContestedResourcesRequestV0; })(); - return GetDocumentsResponse; + return GetContestedResourcesRequest; })(); - v0.GetIdentitiesByPublicKeyHashesRequest = (function() { + v0.GetContestedResourcesResponse = (function() { /** - * Properties of a GetIdentitiesByPublicKeyHashesRequest. + * Properties of a GetContestedResourcesResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesByPublicKeyHashesRequest - * @property {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0|null} [v0] GetIdentitiesByPublicKeyHashesRequest v0 + * @interface IGetContestedResourcesResponse + * @property {org.dash.platform.dapi.v0.GetContestedResourcesResponse.IGetContestedResourcesResponseV0|null} [v0] GetContestedResourcesResponse v0 */ /** - * Constructs a new GetIdentitiesByPublicKeyHashesRequest. + * Constructs a new GetContestedResourcesResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesByPublicKeyHashesRequest. - * @implements IGetIdentitiesByPublicKeyHashesRequest + * @classdesc Represents a GetContestedResourcesResponse. + * @implements IGetContestedResourcesResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesResponse=} [properties] Properties to set */ - function GetIdentitiesByPublicKeyHashesRequest(properties) { + function GetContestedResourcesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15525,89 +26688,89 @@ $root.org = (function() { } /** - * GetIdentitiesByPublicKeyHashesRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * GetContestedResourcesResponse v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourcesResponse.IGetContestedResourcesResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @instance */ - GetIdentitiesByPublicKeyHashesRequest.prototype.v0 = null; + GetContestedResourcesResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesByPublicKeyHashesRequest version. + * GetContestedResourcesResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @instance */ - Object.defineProperty(GetIdentitiesByPublicKeyHashesRequest.prototype, "version", { + Object.defineProperty(GetContestedResourcesResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesByPublicKeyHashesRequest instance using the specified properties. + * Creates a new GetContestedResourcesResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse} GetContestedResourcesResponse instance */ - GetIdentitiesByPublicKeyHashesRequest.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesRequest(properties); + GetContestedResourcesResponse.create = function create(properties) { + return new GetContestedResourcesResponse(properties); }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.verify|verify} messages. + * Encodes the specified GetContestedResourcesResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} message GetIdentitiesByPublicKeyHashesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesResponse} message GetContestedResourcesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequest.encode = function encode(message, writer) { + GetContestedResourcesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.verify|verify} messages. + * Encodes the specified GetContestedResourcesResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} message GetIdentitiesByPublicKeyHashesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourcesResponse} message GetContestedResourcesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourcesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesByPublicKeyHashesRequest message from the specified reader or buffer. + * Decodes a GetContestedResourcesResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse} GetContestedResourcesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesRequest.decode = function decode(reader, length) { + GetContestedResourcesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -15618,37 +26781,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesByPublicKeyHashesRequest message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourcesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse} GetContestedResourcesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesRequest.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourcesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesByPublicKeyHashesRequest message. + * Verifies a GetContestedResourcesResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesByPublicKeyHashesRequest.verify = function verify(message) { + GetContestedResourcesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -15657,40 +26820,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesByPublicKeyHashesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourcesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse} GetContestedResourcesResponse */ - GetIdentitiesByPublicKeyHashesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest) + GetContestedResourcesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourcesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} message GetIdentitiesByPublicKeyHashesRequest + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse} message GetContestedResourcesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesByPublicKeyHashesRequest.toObject = function toObject(message, options) { + GetContestedResourcesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -15698,36 +26861,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesByPublicKeyHashesRequest to JSON. + * Converts this GetContestedResourcesResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse * @instance * @returns {Object.} JSON object */ - GetIdentitiesByPublicKeyHashesRequest.prototype.toJSON = function toJSON() { + GetContestedResourcesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 = (function() { + GetContestedResourcesResponse.GetContestedResourcesResponseV0 = (function() { /** - * Properties of a GetIdentitiesByPublicKeyHashesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest - * @interface IGetIdentitiesByPublicKeyHashesRequestV0 - * @property {Array.|null} [publicKeyHashes] GetIdentitiesByPublicKeyHashesRequestV0 publicKeyHashes - * @property {boolean|null} [prove] GetIdentitiesByPublicKeyHashesRequestV0 prove + * Properties of a GetContestedResourcesResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse + * @interface IGetContestedResourcesResponseV0 + * @property {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.IContestedResourceValues|null} [contestedResourceValues] GetContestedResourcesResponseV0 contestedResourceValues + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetContestedResourcesResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetContestedResourcesResponseV0 metadata */ /** - * Constructs a new GetIdentitiesByPublicKeyHashesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest - * @classdesc Represents a GetIdentitiesByPublicKeyHashesRequestV0. - * @implements IGetIdentitiesByPublicKeyHashesRequestV0 + * Constructs a new GetContestedResourcesResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse + * @classdesc Represents a GetContestedResourcesResponseV0. + * @implements IGetContestedResourcesResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.IGetContestedResourcesResponseV0=} [properties] Properties to set */ - function GetIdentitiesByPublicKeyHashesRequestV0(properties) { - this.publicKeyHashes = []; + function GetContestedResourcesResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15735,91 +26898,115 @@ $root.org = (function() { } /** - * GetIdentitiesByPublicKeyHashesRequestV0 publicKeyHashes. - * @member {Array.} publicKeyHashes - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * GetContestedResourcesResponseV0 contestedResourceValues. + * @member {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.IContestedResourceValues|null|undefined} contestedResourceValues + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 * @instance */ - GetIdentitiesByPublicKeyHashesRequestV0.prototype.publicKeyHashes = $util.emptyArray; + GetContestedResourcesResponseV0.prototype.contestedResourceValues = null; /** - * GetIdentitiesByPublicKeyHashesRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * GetContestedResourcesResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @instance + */ + GetContestedResourcesResponseV0.prototype.proof = null; + + /** + * GetContestedResourcesResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @instance + */ + GetContestedResourcesResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetContestedResourcesResponseV0 result. + * @member {"contestedResourceValues"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 * @instance */ - GetIdentitiesByPublicKeyHashesRequestV0.prototype.prove = false; + Object.defineProperty(GetContestedResourcesResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["contestedResourceValues", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new GetIdentitiesByPublicKeyHashesRequestV0 instance using the specified properties. + * Creates a new GetContestedResourcesResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.IGetContestedResourcesResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} GetContestedResourcesResponseV0 instance */ - GetIdentitiesByPublicKeyHashesRequestV0.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesRequestV0(properties); + GetContestedResourcesResponseV0.create = function create(properties) { + return new GetContestedResourcesResponseV0(properties); }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.verify|verify} messages. + * Encodes the specified GetContestedResourcesResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0} message GetIdentitiesByPublicKeyHashesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.IGetContestedResourcesResponseV0} message GetContestedResourcesResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequestV0.encode = function encode(message, writer) { + GetContestedResourcesResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.publicKeyHashes != null && message.publicKeyHashes.length) - for (var i = 0; i < message.publicKeyHashes.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHashes[i]); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + if (message.contestedResourceValues != null && Object.hasOwnProperty.call(message, "contestedResourceValues")) + $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.encode(message.contestedResourceValues, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.verify|verify} messages. + * Encodes the specified GetContestedResourcesResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0} message GetIdentitiesByPublicKeyHashesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.IGetContestedResourcesResponseV0} message GetContestedResourcesResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourcesResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesByPublicKeyHashesRequestV0 message from the specified reader or buffer. + * Decodes a GetContestedResourcesResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} GetContestedResourcesResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesRequestV0.decode = function decode(reader, length) { + GetContestedResourcesResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.publicKeyHashes && message.publicKeyHashes.length)) - message.publicKeyHashes = []; - message.publicKeyHashes.push(reader.bytes()); + message.contestedResourceValues = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.decode(reader, reader.uint32()); break; case 2: - message.prove = reader.bool(); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -15829,135 +27016,361 @@ $root.org = (function() { return message; }; - /** - * Decodes a GetIdentitiesByPublicKeyHashesRequestV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentitiesByPublicKeyHashesRequestV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a GetContestedResourcesResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} GetContestedResourcesResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetContestedResourcesResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetContestedResourcesResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetContestedResourcesResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.contestedResourceValues != null && message.hasOwnProperty("contestedResourceValues")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.verify(message.contestedResourceValues); + if (error) + return "contestedResourceValues." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetContestedResourcesResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} GetContestedResourcesResponseV0 + */ + GetContestedResourcesResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0(); + if (object.contestedResourceValues != null) { + if (typeof object.contestedResourceValues !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.contestedResourceValues: object expected"); + message.contestedResourceValues = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.fromObject(object.contestedResourceValues); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetContestedResourcesResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} message GetContestedResourcesResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetContestedResourcesResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.contestedResourceValues != null && message.hasOwnProperty("contestedResourceValues")) { + object.contestedResourceValues = $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.toObject(message.contestedResourceValues, options); + if (options.oneofs) + object.result = "contestedResourceValues"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetContestedResourcesResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetContestedResourcesResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetContestedResourcesResponseV0.ContestedResourceValues = (function() { + + /** + * Properties of a ContestedResourceValues. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @interface IContestedResourceValues + * @property {Array.|null} [contestedResourceValues] ContestedResourceValues contestedResourceValues + */ + + /** + * Constructs a new ContestedResourceValues. + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 + * @classdesc Represents a ContestedResourceValues. + * @implements IContestedResourceValues + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.IContestedResourceValues=} [properties] Properties to set + */ + function ContestedResourceValues(properties) { + this.contestedResourceValues = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContestedResourceValues contestedResourceValues. + * @member {Array.} contestedResourceValues + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @instance + */ + ContestedResourceValues.prototype.contestedResourceValues = $util.emptyArray; + + /** + * Creates a new ContestedResourceValues instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.IContestedResourceValues=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} ContestedResourceValues instance + */ + ContestedResourceValues.create = function create(properties) { + return new ContestedResourceValues(properties); + }; + + /** + * Encodes the specified ContestedResourceValues message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.IContestedResourceValues} message ContestedResourceValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceValues.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contestedResourceValues != null && message.contestedResourceValues.length) + for (var i = 0; i < message.contestedResourceValues.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contestedResourceValues[i]); + return writer; + }; + + /** + * Encodes the specified ContestedResourceValues message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.IContestedResourceValues} message ContestedResourceValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceValues.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContestedResourceValues message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} ContestedResourceValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceValues.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.contestedResourceValues && message.contestedResourceValues.length)) + message.contestedResourceValues = []; + message.contestedResourceValues.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContestedResourceValues message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} ContestedResourceValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceValues.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a GetIdentitiesByPublicKeyHashesRequestV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetIdentitiesByPublicKeyHashesRequestV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.publicKeyHashes != null && message.hasOwnProperty("publicKeyHashes")) { - if (!Array.isArray(message.publicKeyHashes)) - return "publicKeyHashes: array expected"; - for (var i = 0; i < message.publicKeyHashes.length; ++i) - if (!(message.publicKeyHashes[i] && typeof message.publicKeyHashes[i].length === "number" || $util.isString(message.publicKeyHashes[i]))) - return "publicKeyHashes: buffer[] expected"; - } - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; - return null; - }; + /** + * Verifies a ContestedResourceValues message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContestedResourceValues.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contestedResourceValues != null && message.hasOwnProperty("contestedResourceValues")) { + if (!Array.isArray(message.contestedResourceValues)) + return "contestedResourceValues: array expected"; + for (var i = 0; i < message.contestedResourceValues.length; ++i) + if (!(message.contestedResourceValues[i] && typeof message.contestedResourceValues[i].length === "number" || $util.isString(message.contestedResourceValues[i]))) + return "contestedResourceValues: buffer[] expected"; + } + return null; + }; - /** - * Creates a GetIdentitiesByPublicKeyHashesRequestV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 - */ - GetIdentitiesByPublicKeyHashesRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0) + /** + * Creates a ContestedResourceValues message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} ContestedResourceValues + */ + ContestedResourceValues.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues(); + if (object.contestedResourceValues) { + if (!Array.isArray(object.contestedResourceValues)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.contestedResourceValues: array expected"); + message.contestedResourceValues = []; + for (var i = 0; i < object.contestedResourceValues.length; ++i) + if (typeof object.contestedResourceValues[i] === "string") + $util.base64.decode(object.contestedResourceValues[i], message.contestedResourceValues[i] = $util.newBuffer($util.base64.length(object.contestedResourceValues[i])), 0); + else if (object.contestedResourceValues[i].length >= 0) + message.contestedResourceValues[i] = object.contestedResourceValues[i]; + } + return message; + }; + + /** + * Creates a plain object from a ContestedResourceValues message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} message ContestedResourceValues + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContestedResourceValues.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contestedResourceValues = []; + if (message.contestedResourceValues && message.contestedResourceValues.length) { + object.contestedResourceValues = []; + for (var j = 0; j < message.contestedResourceValues.length; ++j) + object.contestedResourceValues[j] = options.bytes === String ? $util.base64.encode(message.contestedResourceValues[j], 0, message.contestedResourceValues[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.contestedResourceValues[j]) : message.contestedResourceValues[j]; + } return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0(); - if (object.publicKeyHashes) { - if (!Array.isArray(object.publicKeyHashes)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.publicKeyHashes: array expected"); - message.publicKeyHashes = []; - for (var i = 0; i < object.publicKeyHashes.length; ++i) - if (typeof object.publicKeyHashes[i] === "string") - $util.base64.decode(object.publicKeyHashes[i], message.publicKeyHashes[i] = $util.newBuffer($util.base64.length(object.publicKeyHashes[i])), 0); - else if (object.publicKeyHashes[i].length >= 0) - message.publicKeyHashes[i] = object.publicKeyHashes[i]; - } - if (object.prove != null) - message.prove = Boolean(object.prove); - return message; - }; + }; - /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesRequestV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} message GetIdentitiesByPublicKeyHashesRequestV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetIdentitiesByPublicKeyHashesRequestV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.publicKeyHashes = []; - if (options.defaults) - object.prove = false; - if (message.publicKeyHashes && message.publicKeyHashes.length) { - object.publicKeyHashes = []; - for (var j = 0; j < message.publicKeyHashes.length; ++j) - object.publicKeyHashes[j] = options.bytes === String ? $util.base64.encode(message.publicKeyHashes[j], 0, message.publicKeyHashes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHashes[j]) : message.publicKeyHashes[j]; - } - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; - return object; - }; + /** + * Converts this ContestedResourceValues to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues + * @instance + * @returns {Object.} JSON object + */ + ContestedResourceValues.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetIdentitiesByPublicKeyHashesRequestV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 - * @instance - * @returns {Object.} JSON object - */ - GetIdentitiesByPublicKeyHashesRequestV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return ContestedResourceValues; + })(); - return GetIdentitiesByPublicKeyHashesRequestV0; + return GetContestedResourcesResponseV0; })(); - return GetIdentitiesByPublicKeyHashesRequest; + return GetContestedResourcesResponse; })(); - v0.GetIdentitiesByPublicKeyHashesResponse = (function() { + v0.GetVotePollsByEndDateRequest = (function() { /** - * Properties of a GetIdentitiesByPublicKeyHashesResponse. + * Properties of a GetVotePollsByEndDateRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesByPublicKeyHashesResponse - * @property {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0|null} [v0] GetIdentitiesByPublicKeyHashesResponse v0 + * @interface IGetVotePollsByEndDateRequest + * @property {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.IGetVotePollsByEndDateRequestV0|null} [v0] GetVotePollsByEndDateRequest v0 */ /** - * Constructs a new GetIdentitiesByPublicKeyHashesResponse. + * Constructs a new GetVotePollsByEndDateRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesByPublicKeyHashesResponse. - * @implements IGetIdentitiesByPublicKeyHashesResponse + * @classdesc Represents a GetVotePollsByEndDateRequest. + * @implements IGetVotePollsByEndDateRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateRequest=} [properties] Properties to set */ - function GetIdentitiesByPublicKeyHashesResponse(properties) { + function GetVotePollsByEndDateRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15965,89 +27378,89 @@ $root.org = (function() { } /** - * GetIdentitiesByPublicKeyHashesResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * GetVotePollsByEndDateRequest v0. + * @member {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.IGetVotePollsByEndDateRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @instance */ - GetIdentitiesByPublicKeyHashesResponse.prototype.v0 = null; + GetVotePollsByEndDateRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesByPublicKeyHashesResponse version. + * GetVotePollsByEndDateRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @instance */ - Object.defineProperty(GetIdentitiesByPublicKeyHashesResponse.prototype, "version", { + Object.defineProperty(GetVotePollsByEndDateRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesByPublicKeyHashesResponse instance using the specified properties. + * Creates a new GetVotePollsByEndDateRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse instance + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} GetVotePollsByEndDateRequest instance */ - GetIdentitiesByPublicKeyHashesResponse.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesResponse(properties); + GetVotePollsByEndDateRequest.create = function create(properties) { + return new GetVotePollsByEndDateRequest(properties); }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse} message GetIdentitiesByPublicKeyHashesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateRequest} message GetVotePollsByEndDateRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesResponse.encode = function encode(message, writer) { + GetVotePollsByEndDateRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse} message GetIdentitiesByPublicKeyHashesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateRequest} message GetVotePollsByEndDateRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetVotePollsByEndDateRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesByPublicKeyHashesResponse message from the specified reader or buffer. + * Decodes a GetVotePollsByEndDateRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} GetVotePollsByEndDateRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesResponse.decode = function decode(reader, length) { + GetVotePollsByEndDateRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -16058,37 +27471,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesByPublicKeyHashesResponse message from the specified reader or buffer, length delimited. + * Decodes a GetVotePollsByEndDateRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} GetVotePollsByEndDateRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesResponse.decodeDelimited = function decodeDelimited(reader) { + GetVotePollsByEndDateRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesByPublicKeyHashesResponse message. + * Verifies a GetVotePollsByEndDateRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesByPublicKeyHashesResponse.verify = function verify(message) { + GetVotePollsByEndDateRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -16097,40 +27510,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesByPublicKeyHashesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetVotePollsByEndDateRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} GetVotePollsByEndDateRequest */ - GetIdentitiesByPublicKeyHashesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse) + GetVotePollsByEndDateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetVotePollsByEndDateRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} message GetIdentitiesByPublicKeyHashesResponse + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} message GetVotePollsByEndDateRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesByPublicKeyHashesResponse.toObject = function toObject(message, options) { + GetVotePollsByEndDateRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -16138,35 +27551,39 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesByPublicKeyHashesResponse to JSON. + * Converts this GetVotePollsByEndDateRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest * @instance * @returns {Object.} JSON object */ - GetIdentitiesByPublicKeyHashesResponse.prototype.toJSON = function toJSON() { + GetVotePollsByEndDateRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry = (function() { + GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 = (function() { /** - * Properties of a PublicKeyHashIdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @interface IPublicKeyHashIdentityEntry - * @property {Uint8Array|null} [publicKeyHash] PublicKeyHashIdentityEntry publicKeyHash - * @property {google.protobuf.IBytesValue|null} [value] PublicKeyHashIdentityEntry value + * Properties of a GetVotePollsByEndDateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest + * @interface IGetVotePollsByEndDateRequestV0 + * @property {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IStartAtTimeInfo|null} [startTimeInfo] GetVotePollsByEndDateRequestV0 startTimeInfo + * @property {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IEndAtTimeInfo|null} [endTimeInfo] GetVotePollsByEndDateRequestV0 endTimeInfo + * @property {number|null} [limit] GetVotePollsByEndDateRequestV0 limit + * @property {number|null} [offset] GetVotePollsByEndDateRequestV0 offset + * @property {boolean|null} [ascending] GetVotePollsByEndDateRequestV0 ascending + * @property {boolean|null} [prove] GetVotePollsByEndDateRequestV0 prove */ /** - * Constructs a new PublicKeyHashIdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @classdesc Represents a PublicKeyHashIdentityEntry. - * @implements IPublicKeyHashIdentityEntry + * Constructs a new GetVotePollsByEndDateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest + * @classdesc Represents a GetVotePollsByEndDateRequestV0. + * @implements IGetVotePollsByEndDateRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.IGetVotePollsByEndDateRequestV0=} [properties] Properties to set */ - function PublicKeyHashIdentityEntry(properties) { + function GetVotePollsByEndDateRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16174,302 +27591,140 @@ $root.org = (function() { } /** - * PublicKeyHashIdentityEntry publicKeyHash. - * @member {Uint8Array} publicKeyHash - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry + * GetVotePollsByEndDateRequestV0 startTimeInfo. + * @member {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IStartAtTimeInfo|null|undefined} startTimeInfo + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @instance */ - PublicKeyHashIdentityEntry.prototype.publicKeyHash = $util.newBuffer([]); + GetVotePollsByEndDateRequestV0.prototype.startTimeInfo = null; /** - * PublicKeyHashIdentityEntry value. - * @member {google.protobuf.IBytesValue|null|undefined} value - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry + * GetVotePollsByEndDateRequestV0 endTimeInfo. + * @member {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IEndAtTimeInfo|null|undefined} endTimeInfo + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @instance */ - PublicKeyHashIdentityEntry.prototype.value = null; - - /** - * Creates a new PublicKeyHashIdentityEntry instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry instance - */ - PublicKeyHashIdentityEntry.create = function create(properties) { - return new PublicKeyHashIdentityEntry(properties); - }; - - /** - * Encodes the specified PublicKeyHashIdentityEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry} message PublicKeyHashIdentityEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PublicKeyHashIdentityEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.publicKeyHash != null && Object.hasOwnProperty.call(message, "publicKeyHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHash); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - $root.google.protobuf.BytesValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PublicKeyHashIdentityEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry} message PublicKeyHashIdentityEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PublicKeyHashIdentityEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PublicKeyHashIdentityEntry message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PublicKeyHashIdentityEntry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.publicKeyHash = reader.bytes(); - break; - case 2: - message.value = $root.google.protobuf.BytesValue.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PublicKeyHashIdentityEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PublicKeyHashIdentityEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PublicKeyHashIdentityEntry message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PublicKeyHashIdentityEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - if (!(message.publicKeyHash && typeof message.publicKeyHash.length === "number" || $util.isString(message.publicKeyHash))) - return "publicKeyHash: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) { - var error = $root.google.protobuf.BytesValue.verify(message.value); - if (error) - return "value." + error; - } - return null; - }; - - /** - * Creates a PublicKeyHashIdentityEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry - */ - PublicKeyHashIdentityEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry(); - if (object.publicKeyHash != null) - if (typeof object.publicKeyHash === "string") - $util.base64.decode(object.publicKeyHash, message.publicKeyHash = $util.newBuffer($util.base64.length(object.publicKeyHash)), 0); - else if (object.publicKeyHash.length >= 0) - message.publicKeyHash = object.publicKeyHash; - if (object.value != null) { - if (typeof object.value !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.value: object expected"); - message.value = $root.google.protobuf.BytesValue.fromObject(object.value); - } - return message; - }; - - /** - * Creates a plain object from a PublicKeyHashIdentityEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} message PublicKeyHashIdentityEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PublicKeyHashIdentityEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.publicKeyHash = ""; - else { - object.publicKeyHash = []; - if (options.bytes !== Array) - object.publicKeyHash = $util.newBuffer(object.publicKeyHash); - } - object.value = null; - } - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - object.publicKeyHash = options.bytes === String ? $util.base64.encode(message.publicKeyHash, 0, message.publicKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHash) : message.publicKeyHash; - if (message.value != null && message.hasOwnProperty("value")) - object.value = $root.google.protobuf.BytesValue.toObject(message.value, options); - return object; - }; + GetVotePollsByEndDateRequestV0.prototype.endTimeInfo = null; /** - * Converts this PublicKeyHashIdentityEntry to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry + * GetVotePollsByEndDateRequestV0 limit. + * @member {number} limit + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @instance - * @returns {Object.} JSON object */ - PublicKeyHashIdentityEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PublicKeyHashIdentityEntry; - })(); - - GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes = (function() { + GetVotePollsByEndDateRequestV0.prototype.limit = 0; /** - * Properties of an IdentitiesByPublicKeyHashes. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @interface IIdentitiesByPublicKeyHashes - * @property {Array.|null} [identityEntries] IdentitiesByPublicKeyHashes identityEntries + * GetVotePollsByEndDateRequestV0 offset. + * @member {number} offset + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 + * @instance */ + GetVotePollsByEndDateRequestV0.prototype.offset = 0; /** - * Constructs a new IdentitiesByPublicKeyHashes. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @classdesc Represents an IdentitiesByPublicKeyHashes. - * @implements IIdentitiesByPublicKeyHashes - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes=} [properties] Properties to set + * GetVotePollsByEndDateRequestV0 ascending. + * @member {boolean} ascending + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 + * @instance */ - function IdentitiesByPublicKeyHashes(properties) { - this.identityEntries = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + GetVotePollsByEndDateRequestV0.prototype.ascending = false; /** - * IdentitiesByPublicKeyHashes identityEntries. - * @member {Array.} identityEntries - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * GetVotePollsByEndDateRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @instance */ - IdentitiesByPublicKeyHashes.prototype.identityEntries = $util.emptyArray; + GetVotePollsByEndDateRequestV0.prototype.prove = false; /** - * Creates a new IdentitiesByPublicKeyHashes instance using the specified properties. + * Creates a new GetVotePollsByEndDateRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes instance + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.IGetVotePollsByEndDateRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} GetVotePollsByEndDateRequestV0 instance */ - IdentitiesByPublicKeyHashes.create = function create(properties) { - return new IdentitiesByPublicKeyHashes(properties); + GetVotePollsByEndDateRequestV0.create = function create(properties) { + return new GetVotePollsByEndDateRequestV0(properties); }; /** - * Encodes the specified IdentitiesByPublicKeyHashes message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes} message IdentitiesByPublicKeyHashes message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.IGetVotePollsByEndDateRequestV0} message GetVotePollsByEndDateRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentitiesByPublicKeyHashes.encode = function encode(message, writer) { + GetVotePollsByEndDateRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identityEntries != null && message.identityEntries.length) - for (var i = 0; i < message.identityEntries.length; ++i) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.encode(message.identityEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.startTimeInfo != null && Object.hasOwnProperty.call(message, "startTimeInfo")) + $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.encode(message.startTimeInfo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTimeInfo != null && Object.hasOwnProperty.call(message, "endTimeInfo")) + $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.encode(message.endTimeInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.limit); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.offset); + if (message.ascending != null && Object.hasOwnProperty.call(message, "ascending")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.ascending); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.prove); return writer; }; /** - * Encodes the specified IdentitiesByPublicKeyHashes message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes} message IdentitiesByPublicKeyHashes message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.IGetVotePollsByEndDateRequestV0} message GetVotePollsByEndDateRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentitiesByPublicKeyHashes.encodeDelimited = function encodeDelimited(message, writer) { + GetVotePollsByEndDateRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an IdentitiesByPublicKeyHashes message from the specified reader or buffer. + * Decodes a GetVotePollsByEndDateRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} GetVotePollsByEndDateRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentitiesByPublicKeyHashes.decode = function decode(reader, length) { + GetVotePollsByEndDateRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.identityEntries && message.identityEntries.length)) - message.identityEntries = []; - message.identityEntries.push($root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.decode(reader, reader.uint32())); + message.startTimeInfo = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.decode(reader, reader.uint32()); + break; + case 2: + message.endTimeInfo = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.limit = reader.uint32(); + break; + case 4: + message.offset = reader.uint32(); + break; + case 5: + message.ascending = reader.bool(); + break; + case 6: + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -16480,400 +27735,609 @@ $root.org = (function() { }; /** - * Decodes an IdentitiesByPublicKeyHashes message from the specified reader or buffer, length delimited. + * Decodes a GetVotePollsByEndDateRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} GetVotePollsByEndDateRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentitiesByPublicKeyHashes.decodeDelimited = function decodeDelimited(reader) { + GetVotePollsByEndDateRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IdentitiesByPublicKeyHashes message. + * Verifies a GetVotePollsByEndDateRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IdentitiesByPublicKeyHashes.verify = function verify(message) { + GetVotePollsByEndDateRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.identityEntries != null && message.hasOwnProperty("identityEntries")) { - if (!Array.isArray(message.identityEntries)) - return "identityEntries: array expected"; - for (var i = 0; i < message.identityEntries.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.verify(message.identityEntries[i]); - if (error) - return "identityEntries." + error; - } + if (message.startTimeInfo != null && message.hasOwnProperty("startTimeInfo")) { + var error = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.verify(message.startTimeInfo); + if (error) + return "startTimeInfo." + error; } + if (message.endTimeInfo != null && message.hasOwnProperty("endTimeInfo")) { + var error = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.verify(message.endTimeInfo); + if (error) + return "endTimeInfo." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.ascending != null && message.hasOwnProperty("ascending")) + if (typeof message.ascending !== "boolean") + return "ascending: boolean expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates an IdentitiesByPublicKeyHashes message from a plain object. Also converts values to their respective internal types. + * Creates a GetVotePollsByEndDateRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} GetVotePollsByEndDateRequestV0 */ - IdentitiesByPublicKeyHashes.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes) + GetVotePollsByEndDateRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes(); - if (object.identityEntries) { - if (!Array.isArray(object.identityEntries)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.identityEntries: array expected"); - message.identityEntries = []; - for (var i = 0; i < object.identityEntries.length; ++i) { - if (typeof object.identityEntries[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.identityEntries: object expected"); - message.identityEntries[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.fromObject(object.identityEntries[i]); - } + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0(); + if (object.startTimeInfo != null) { + if (typeof object.startTimeInfo !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.startTimeInfo: object expected"); + message.startTimeInfo = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.fromObject(object.startTimeInfo); + } + if (object.endTimeInfo != null) { + if (typeof object.endTimeInfo !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.endTimeInfo: object expected"); + message.endTimeInfo = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.fromObject(object.endTimeInfo); } + if (object.limit != null) + message.limit = object.limit >>> 0; + if (object.offset != null) + message.offset = object.offset >>> 0; + if (object.ascending != null) + message.ascending = Boolean(object.ascending); + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from an IdentitiesByPublicKeyHashes message. Also converts values to other types if specified. + * Creates a plain object from a GetVotePollsByEndDateRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} message IdentitiesByPublicKeyHashes + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} message GetVotePollsByEndDateRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IdentitiesByPublicKeyHashes.toObject = function toObject(message, options) { + GetVotePollsByEndDateRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.identityEntries = []; - if (message.identityEntries && message.identityEntries.length) { - object.identityEntries = []; - for (var j = 0; j < message.identityEntries.length; ++j) - object.identityEntries[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject(message.identityEntries[j], options); + if (options.defaults) { + object.startTimeInfo = null; + object.endTimeInfo = null; + object.limit = 0; + object.offset = 0; + object.ascending = false; + object.prove = false; } + if (message.startTimeInfo != null && message.hasOwnProperty("startTimeInfo")) + object.startTimeInfo = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.toObject(message.startTimeInfo, options); + if (message.endTimeInfo != null && message.hasOwnProperty("endTimeInfo")) + object.endTimeInfo = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.toObject(message.endTimeInfo, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.ascending != null && message.hasOwnProperty("ascending")) + object.ascending = message.ascending; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this IdentitiesByPublicKeyHashes to JSON. + * Converts this GetVotePollsByEndDateRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 * @instance * @returns {Object.} JSON object */ - IdentitiesByPublicKeyHashes.prototype.toJSON = function toJSON() { + GetVotePollsByEndDateRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return IdentitiesByPublicKeyHashes; - })(); + GetVotePollsByEndDateRequestV0.StartAtTimeInfo = (function() { - GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 = (function() { + /** + * Properties of a StartAtTimeInfo. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 + * @interface IStartAtTimeInfo + * @property {number|Long|null} [startTimeMs] StartAtTimeInfo startTimeMs + * @property {boolean|null} [startTimeIncluded] StartAtTimeInfo startTimeIncluded + */ - /** - * Properties of a GetIdentitiesByPublicKeyHashesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @interface IGetIdentitiesByPublicKeyHashesResponseV0 - * @property {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes|null} [identities] GetIdentitiesByPublicKeyHashesResponseV0 identities - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentitiesByPublicKeyHashesResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentitiesByPublicKeyHashesResponseV0 metadata - */ + /** + * Constructs a new StartAtTimeInfo. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 + * @classdesc Represents a StartAtTimeInfo. + * @implements IStartAtTimeInfo + * @constructor + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IStartAtTimeInfo=} [properties] Properties to set + */ + function StartAtTimeInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new GetIdentitiesByPublicKeyHashesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @classdesc Represents a GetIdentitiesByPublicKeyHashesResponseV0. - * @implements IGetIdentitiesByPublicKeyHashesResponseV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0=} [properties] Properties to set - */ - function GetIdentitiesByPublicKeyHashesResponseV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * StartAtTimeInfo startTimeMs. + * @member {number|Long} startTimeMs + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @instance + */ + StartAtTimeInfo.prototype.startTimeMs = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - /** - * GetIdentitiesByPublicKeyHashesResponseV0 identities. - * @member {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes|null|undefined} identities - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @instance - */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.identities = null; + /** + * StartAtTimeInfo startTimeIncluded. + * @member {boolean} startTimeIncluded + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @instance + */ + StartAtTimeInfo.prototype.startTimeIncluded = false; - /** - * GetIdentitiesByPublicKeyHashesResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @instance - */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.proof = null; + /** + * Creates a new StartAtTimeInfo instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IStartAtTimeInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} StartAtTimeInfo instance + */ + StartAtTimeInfo.create = function create(properties) { + return new StartAtTimeInfo(properties); + }; - /** - * GetIdentitiesByPublicKeyHashesResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @instance - */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.metadata = null; + /** + * Encodes the specified StartAtTimeInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IStartAtTimeInfo} message StartAtTimeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtTimeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTimeMs != null && Object.hasOwnProperty.call(message, "startTimeMs")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.startTimeMs); + if (message.startTimeIncluded != null && Object.hasOwnProperty.call(message, "startTimeIncluded")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.startTimeIncluded); + return writer; + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Encodes the specified StartAtTimeInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IStartAtTimeInfo} message StartAtTimeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtTimeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * GetIdentitiesByPublicKeyHashesResponseV0 result. - * @member {"identities"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @instance - */ - Object.defineProperty(GetIdentitiesByPublicKeyHashesResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identities", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Decodes a StartAtTimeInfo message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} StartAtTimeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtTimeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startTimeMs = reader.uint64(); + break; + case 2: + message.startTimeIncluded = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new GetIdentitiesByPublicKeyHashesResponseV0 instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 instance - */ - GetIdentitiesByPublicKeyHashesResponseV0.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesResponseV0(properties); - }; + /** + * Decodes a StartAtTimeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} StartAtTimeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtTimeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0} message GetIdentitiesByPublicKeyHashesResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentitiesByPublicKeyHashesResponseV0.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identities != null && Object.hasOwnProperty.call(message, "identities")) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.encode(message.identities, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * Verifies a StartAtTimeInfo message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StartAtTimeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTimeMs != null && message.hasOwnProperty("startTimeMs")) + if (!$util.isInteger(message.startTimeMs) && !(message.startTimeMs && $util.isInteger(message.startTimeMs.low) && $util.isInteger(message.startTimeMs.high))) + return "startTimeMs: integer|Long expected"; + if (message.startTimeIncluded != null && message.hasOwnProperty("startTimeIncluded")) + if (typeof message.startTimeIncluded !== "boolean") + return "startTimeIncluded: boolean expected"; + return null; + }; + + /** + * Creates a StartAtTimeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} StartAtTimeInfo + */ + StartAtTimeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo(); + if (object.startTimeMs != null) + if ($util.Long) + (message.startTimeMs = $util.Long.fromValue(object.startTimeMs)).unsigned = true; + else if (typeof object.startTimeMs === "string") + message.startTimeMs = parseInt(object.startTimeMs, 10); + else if (typeof object.startTimeMs === "number") + message.startTimeMs = object.startTimeMs; + else if (typeof object.startTimeMs === "object") + message.startTimeMs = new $util.LongBits(object.startTimeMs.low >>> 0, object.startTimeMs.high >>> 0).toNumber(true); + if (object.startTimeIncluded != null) + message.startTimeIncluded = Boolean(object.startTimeIncluded); + return message; + }; + + /** + * Creates a plain object from a StartAtTimeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} message StartAtTimeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StartAtTimeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.startTimeMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startTimeMs = options.longs === String ? "0" : 0; + object.startTimeIncluded = false; + } + if (message.startTimeMs != null && message.hasOwnProperty("startTimeMs")) + if (typeof message.startTimeMs === "number") + object.startTimeMs = options.longs === String ? String(message.startTimeMs) : message.startTimeMs; + else + object.startTimeMs = options.longs === String ? $util.Long.prototype.toString.call(message.startTimeMs) : options.longs === Number ? new $util.LongBits(message.startTimeMs.low >>> 0, message.startTimeMs.high >>> 0).toNumber(true) : message.startTimeMs; + if (message.startTimeIncluded != null && message.hasOwnProperty("startTimeIncluded")) + object.startTimeIncluded = message.startTimeIncluded; + return object; + }; + + /** + * Converts this StartAtTimeInfo to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo + * @instance + * @returns {Object.} JSON object + */ + StartAtTimeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StartAtTimeInfo; + })(); + + GetVotePollsByEndDateRequestV0.EndAtTimeInfo = (function() { + + /** + * Properties of an EndAtTimeInfo. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 + * @interface IEndAtTimeInfo + * @property {number|Long|null} [endTimeMs] EndAtTimeInfo endTimeMs + * @property {boolean|null} [endTimeIncluded] EndAtTimeInfo endTimeIncluded + */ + + /** + * Constructs a new EndAtTimeInfo. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 + * @classdesc Represents an EndAtTimeInfo. + * @implements IEndAtTimeInfo + * @constructor + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IEndAtTimeInfo=} [properties] Properties to set + */ + function EndAtTimeInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EndAtTimeInfo endTimeMs. + * @member {number|Long} endTimeMs + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @instance + */ + EndAtTimeInfo.prototype.endTimeMs = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * EndAtTimeInfo endTimeIncluded. + * @member {boolean} endTimeIncluded + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @instance + */ + EndAtTimeInfo.prototype.endTimeIncluded = false; + + /** + * Creates a new EndAtTimeInfo instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IEndAtTimeInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} EndAtTimeInfo instance + */ + EndAtTimeInfo.create = function create(properties) { + return new EndAtTimeInfo(properties); + }; + + /** + * Encodes the specified EndAtTimeInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IEndAtTimeInfo} message EndAtTimeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndAtTimeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endTimeMs != null && Object.hasOwnProperty.call(message, "endTimeMs")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.endTimeMs); + if (message.endTimeIncluded != null && Object.hasOwnProperty.call(message, "endTimeIncluded")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.endTimeIncluded); + return writer; + }; - /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0} message GetIdentitiesByPublicKeyHashesResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentitiesByPublicKeyHashesResponseV0.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified EndAtTimeInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.IEndAtTimeInfo} message EndAtTimeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndAtTimeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a GetIdentitiesByPublicKeyHashesResponseV0 message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentitiesByPublicKeyHashesResponseV0.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.decode(reader, reader.uint32()); - break; - case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes an EndAtTimeInfo message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} EndAtTimeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndAtTimeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.endTimeMs = reader.uint64(); + break; + case 2: + message.endTimeIncluded = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a GetIdentitiesByPublicKeyHashesResponseV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentitiesByPublicKeyHashesResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an EndAtTimeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} EndAtTimeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndAtTimeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a GetIdentitiesByPublicKeyHashesResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetIdentitiesByPublicKeyHashesResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.identities != null && message.hasOwnProperty("identities")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.verify(message.identities); - if (error) - return "identities." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; + /** + * Verifies an EndAtTimeInfo message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EndAtTimeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endTimeMs != null && message.hasOwnProperty("endTimeMs")) + if (!$util.isInteger(message.endTimeMs) && !(message.endTimeMs && $util.isInteger(message.endTimeMs.low) && $util.isInteger(message.endTimeMs.high))) + return "endTimeMs: integer|Long expected"; + if (message.endTimeIncluded != null && message.hasOwnProperty("endTimeIncluded")) + if (typeof message.endTimeIncluded !== "boolean") + return "endTimeIncluded: boolean expected"; + return null; + }; - /** - * Creates a GetIdentitiesByPublicKeyHashesResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 - */ - GetIdentitiesByPublicKeyHashesResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0) + /** + * Creates an EndAtTimeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} EndAtTimeInfo + */ + EndAtTimeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo(); + if (object.endTimeMs != null) + if ($util.Long) + (message.endTimeMs = $util.Long.fromValue(object.endTimeMs)).unsigned = true; + else if (typeof object.endTimeMs === "string") + message.endTimeMs = parseInt(object.endTimeMs, 10); + else if (typeof object.endTimeMs === "number") + message.endTimeMs = object.endTimeMs; + else if (typeof object.endTimeMs === "object") + message.endTimeMs = new $util.LongBits(object.endTimeMs.low >>> 0, object.endTimeMs.high >>> 0).toNumber(true); + if (object.endTimeIncluded != null) + message.endTimeIncluded = Boolean(object.endTimeIncluded); + return message; + }; + + /** + * Creates a plain object from an EndAtTimeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} message EndAtTimeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EndAtTimeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.endTimeMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.endTimeMs = options.longs === String ? "0" : 0; + object.endTimeIncluded = false; + } + if (message.endTimeMs != null && message.hasOwnProperty("endTimeMs")) + if (typeof message.endTimeMs === "number") + object.endTimeMs = options.longs === String ? String(message.endTimeMs) : message.endTimeMs; + else + object.endTimeMs = options.longs === String ? $util.Long.prototype.toString.call(message.endTimeMs) : options.longs === Number ? new $util.LongBits(message.endTimeMs.low >>> 0, message.endTimeMs.high >>> 0).toNumber(true) : message.endTimeMs; + if (message.endTimeIncluded != null && message.hasOwnProperty("endTimeIncluded")) + object.endTimeIncluded = message.endTimeIncluded; return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0(); - if (object.identities != null) { - if (typeof object.identities !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.identities: object expected"); - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.fromObject(object.identities); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } - return message; - }; + }; - /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} message GetIdentitiesByPublicKeyHashesResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetIdentitiesByPublicKeyHashesResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.identities != null && message.hasOwnProperty("identities")) { - object.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(message.identities, options); - if (options.oneofs) - object.result = "identities"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; - }; + /** + * Converts this EndAtTimeInfo to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo + * @instance + * @returns {Object.} JSON object + */ + EndAtTimeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetIdentitiesByPublicKeyHashesResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @instance - * @returns {Object.} JSON object - */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return EndAtTimeInfo; + })(); - return GetIdentitiesByPublicKeyHashesResponseV0; + return GetVotePollsByEndDateRequestV0; })(); - return GetIdentitiesByPublicKeyHashesResponse; + return GetVotePollsByEndDateRequest; })(); - v0.GetIdentityByPublicKeyHashRequest = (function() { + v0.GetVotePollsByEndDateResponse = (function() { /** - * Properties of a GetIdentityByPublicKeyHashRequest. + * Properties of a GetVotePollsByEndDateResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityByPublicKeyHashRequest - * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null} [v0] GetIdentityByPublicKeyHashRequest v0 + * @interface IGetVotePollsByEndDateResponse + * @property {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.IGetVotePollsByEndDateResponseV0|null} [v0] GetVotePollsByEndDateResponse v0 */ /** - * Constructs a new GetIdentityByPublicKeyHashRequest. + * Constructs a new GetVotePollsByEndDateResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityByPublicKeyHashRequest. - * @implements IGetIdentityByPublicKeyHashRequest + * @classdesc Represents a GetVotePollsByEndDateResponse. + * @implements IGetVotePollsByEndDateResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateResponse=} [properties] Properties to set */ - function GetIdentityByPublicKeyHashRequest(properties) { + function GetVotePollsByEndDateResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16881,89 +28345,89 @@ $root.org = (function() { } /** - * GetIdentityByPublicKeyHashRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * GetVotePollsByEndDateResponse v0. + * @member {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.IGetVotePollsByEndDateResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @instance */ - GetIdentityByPublicKeyHashRequest.prototype.v0 = null; + GetVotePollsByEndDateResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityByPublicKeyHashRequest version. + * GetVotePollsByEndDateResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @instance */ - Object.defineProperty(GetIdentityByPublicKeyHashRequest.prototype, "version", { + Object.defineProperty(GetVotePollsByEndDateResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityByPublicKeyHashRequest instance using the specified properties. + * Creates a new GetVotePollsByEndDateResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest instance + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} GetVotePollsByEndDateResponse instance */ - GetIdentityByPublicKeyHashRequest.create = function create(properties) { - return new GetIdentityByPublicKeyHashRequest(properties); + GetVotePollsByEndDateResponse.create = function create(properties) { + return new GetVotePollsByEndDateResponse(properties); }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateResponse} message GetVotePollsByEndDateResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequest.encode = function encode(message, writer) { + GetVotePollsByEndDateResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetVotePollsByEndDateResponse} message GetVotePollsByEndDateResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetVotePollsByEndDateResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer. + * Decodes a GetVotePollsByEndDateResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} GetVotePollsByEndDateResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequest.decode = function decode(reader, length) { + GetVotePollsByEndDateResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -16974,37 +28438,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer, length delimited. + * Decodes a GetVotePollsByEndDateResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} GetVotePollsByEndDateResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequest.decodeDelimited = function decodeDelimited(reader) { + GetVotePollsByEndDateResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityByPublicKeyHashRequest message. + * Verifies a GetVotePollsByEndDateResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityByPublicKeyHashRequest.verify = function verify(message) { + GetVotePollsByEndDateResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -17013,40 +28477,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityByPublicKeyHashRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetVotePollsByEndDateResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} GetVotePollsByEndDateResponse */ - GetIdentityByPublicKeyHashRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest) + GetVotePollsByEndDateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityByPublicKeyHashRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetVotePollsByEndDateResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} message GetVotePollsByEndDateResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityByPublicKeyHashRequest.toObject = function toObject(message, options) { + GetVotePollsByEndDateResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -17054,35 +28518,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentityByPublicKeyHashRequest to JSON. + * Converts this GetVotePollsByEndDateResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse * @instance * @returns {Object.} JSON object */ - GetIdentityByPublicKeyHashRequest.prototype.toJSON = function toJSON() { + GetVotePollsByEndDateResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = (function() { + GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 = (function() { /** - * Properties of a GetIdentityByPublicKeyHashRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest - * @interface IGetIdentityByPublicKeyHashRequestV0 - * @property {Uint8Array|null} [publicKeyHash] GetIdentityByPublicKeyHashRequestV0 publicKeyHash - * @property {boolean|null} [prove] GetIdentityByPublicKeyHashRequestV0 prove + * Properties of a GetVotePollsByEndDateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse + * @interface IGetVotePollsByEndDateResponseV0 + * @property {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamps|null} [votePollsByTimestamps] GetVotePollsByEndDateResponseV0 votePollsByTimestamps + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetVotePollsByEndDateResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetVotePollsByEndDateResponseV0 metadata */ /** - * Constructs a new GetIdentityByPublicKeyHashRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest - * @classdesc Represents a GetIdentityByPublicKeyHashRequestV0. - * @implements IGetIdentityByPublicKeyHashRequestV0 + * Constructs a new GetVotePollsByEndDateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse + * @classdesc Represents a GetVotePollsByEndDateResponseV0. + * @implements IGetVotePollsByEndDateResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.IGetVotePollsByEndDateResponseV0=} [properties] Properties to set */ - function GetIdentityByPublicKeyHashRequestV0(properties) { + function GetVotePollsByEndDateResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17090,88 +28555,115 @@ $root.org = (function() { } /** - * GetIdentityByPublicKeyHashRequestV0 publicKeyHash. - * @member {Uint8Array} publicKeyHash - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * GetVotePollsByEndDateResponseV0 votePollsByTimestamps. + * @member {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamps|null|undefined} votePollsByTimestamps + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @instance */ - GetIdentityByPublicKeyHashRequestV0.prototype.publicKeyHash = $util.newBuffer([]); + GetVotePollsByEndDateResponseV0.prototype.votePollsByTimestamps = null; /** - * GetIdentityByPublicKeyHashRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * GetVotePollsByEndDateResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @instance */ - GetIdentityByPublicKeyHashRequestV0.prototype.prove = false; + GetVotePollsByEndDateResponseV0.prototype.proof = null; /** - * Creates a new GetIdentityByPublicKeyHashRequestV0 instance using the specified properties. + * GetVotePollsByEndDateResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 + * @instance + */ + GetVotePollsByEndDateResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetVotePollsByEndDateResponseV0 result. + * @member {"votePollsByTimestamps"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 + * @instance + */ + Object.defineProperty(GetVotePollsByEndDateResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["votePollsByTimestamps", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetVotePollsByEndDateResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.IGetVotePollsByEndDateResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} GetVotePollsByEndDateResponseV0 instance */ - GetIdentityByPublicKeyHashRequestV0.create = function create(properties) { - return new GetIdentityByPublicKeyHashRequestV0(properties); + GetVotePollsByEndDateResponseV0.create = function create(properties) { + return new GetVotePollsByEndDateResponseV0(properties); }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.IGetVotePollsByEndDateResponseV0} message GetVotePollsByEndDateResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequestV0.encode = function encode(message, writer) { + GetVotePollsByEndDateResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.publicKeyHash != null && Object.hasOwnProperty.call(message, "publicKeyHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHash); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + if (message.votePollsByTimestamps != null && Object.hasOwnProperty.call(message, "votePollsByTimestamps")) + $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.encode(message.votePollsByTimestamps, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. + * Encodes the specified GetVotePollsByEndDateResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.IGetVotePollsByEndDateResponseV0} message GetVotePollsByEndDateResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetVotePollsByEndDateResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer. + * Decodes a GetVotePollsByEndDateResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} GetVotePollsByEndDateResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequestV0.decode = function decode(reader, length) { + GetVotePollsByEndDateResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.publicKeyHash = reader.bytes(); + message.votePollsByTimestamps = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.decode(reader, reader.uint32()); break; case 2: - message.prove = reader.bool(); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -17182,609 +28674,628 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetVotePollsByEndDateResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} GetVotePollsByEndDateResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetVotePollsByEndDateResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityByPublicKeyHashRequestV0 message. + * Verifies a GetVotePollsByEndDateResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityByPublicKeyHashRequestV0.verify = function verify(message) { + GetVotePollsByEndDateResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - if (!(message.publicKeyHash && typeof message.publicKeyHash.length === "number" || $util.isString(message.publicKeyHash))) - return "publicKeyHash: buffer expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; + var properties = {}; + if (message.votePollsByTimestamps != null && message.hasOwnProperty("votePollsByTimestamps")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.verify(message.votePollsByTimestamps); + if (error) + return "votePollsByTimestamps." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } return null; }; /** - * Creates a GetIdentityByPublicKeyHashRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetVotePollsByEndDateResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} GetVotePollsByEndDateResponseV0 */ - GetIdentityByPublicKeyHashRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) + GetVotePollsByEndDateResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); - if (object.publicKeyHash != null) - if (typeof object.publicKeyHash === "string") - $util.base64.decode(object.publicKeyHash, message.publicKeyHash = $util.newBuffer($util.base64.length(object.publicKeyHash)), 0); - else if (object.publicKeyHash.length >= 0) - message.publicKeyHash = object.publicKeyHash; - if (object.prove != null) - message.prove = Boolean(object.prove); + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0(); + if (object.votePollsByTimestamps != null) { + if (typeof object.votePollsByTimestamps !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.votePollsByTimestamps: object expected"); + message.votePollsByTimestamps = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.fromObject(object.votePollsByTimestamps); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } return message; }; /** - * Creates a plain object from a GetIdentityByPublicKeyHashRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetVotePollsByEndDateResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} message GetVotePollsByEndDateResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityByPublicKeyHashRequestV0.toObject = function toObject(message, options) { + GetVotePollsByEndDateResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.publicKeyHash = ""; - else { - object.publicKeyHash = []; - if (options.bytes !== Array) - object.publicKeyHash = $util.newBuffer(object.publicKeyHash); - } - object.prove = false; + if (options.defaults) + object.metadata = null; + if (message.votePollsByTimestamps != null && message.hasOwnProperty("votePollsByTimestamps")) { + object.votePollsByTimestamps = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.toObject(message.votePollsByTimestamps, options); + if (options.oneofs) + object.result = "votePollsByTimestamps"; } - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - object.publicKeyHash = options.bytes === String ? $util.base64.encode(message.publicKeyHash, 0, message.publicKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHash) : message.publicKeyHash; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this GetIdentityByPublicKeyHashRequestV0 to JSON. + * Converts this GetVotePollsByEndDateResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 - * @instance - * @returns {Object.} JSON object - */ - GetIdentityByPublicKeyHashRequestV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetIdentityByPublicKeyHashRequestV0; - })(); - - return GetIdentityByPublicKeyHashRequest; - })(); - - v0.GetIdentityByPublicKeyHashResponse = (function() { - - /** - * Properties of a GetIdentityByPublicKeyHashResponse. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityByPublicKeyHashResponse - * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null} [v0] GetIdentityByPublicKeyHashResponse v0 - */ - - /** - * Constructs a new GetIdentityByPublicKeyHashResponse. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityByPublicKeyHashResponse. - * @implements IGetIdentityByPublicKeyHashResponse - * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set - */ - function GetIdentityByPublicKeyHashResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetIdentityByPublicKeyHashResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @instance - */ - GetIdentityByPublicKeyHashResponse.prototype.v0 = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * GetIdentityByPublicKeyHashResponse version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @instance - */ - Object.defineProperty(GetIdentityByPublicKeyHashResponse.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new GetIdentityByPublicKeyHashResponse instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse instance - */ - GetIdentityByPublicKeyHashResponse.create = function create(properties) { - return new GetIdentityByPublicKeyHashResponse(properties); - }; - - /** - * Encodes the specified GetIdentityByPublicKeyHashResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityByPublicKeyHashResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetVotePollsByEndDateResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified GetIdentityByPublicKeyHashResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityByPublicKeyHashResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp = (function() { - /** - * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityByPublicKeyHashResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Properties of a SerializedVotePollsByTimestamp. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 + * @interface ISerializedVotePollsByTimestamp + * @property {number|Long|null} [timestamp] SerializedVotePollsByTimestamp timestamp + * @property {Array.|null} [serializedVotePolls] SerializedVotePollsByTimestamp serializedVotePolls + */ + + /** + * Constructs a new SerializedVotePollsByTimestamp. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 + * @classdesc Represents a SerializedVotePollsByTimestamp. + * @implements ISerializedVotePollsByTimestamp + * @constructor + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamp=} [properties] Properties to set + */ + function SerializedVotePollsByTimestamp(properties) { + this.serializedVotePolls = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - } - return message; - }; - /** - * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityByPublicKeyHashResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * SerializedVotePollsByTimestamp timestamp. + * @member {number|Long} timestamp + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @instance + */ + SerializedVotePollsByTimestamp.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - /** - * Verifies a GetIdentityByPublicKeyHashResponse message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetIdentityByPublicKeyHashResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify(message.v0); - if (error) - return "v0." + error; - } - } - return null; - }; + /** + * SerializedVotePollsByTimestamp serializedVotePolls. + * @member {Array.} serializedVotePolls + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @instance + */ + SerializedVotePollsByTimestamp.prototype.serializedVotePolls = $util.emptyArray; - /** - * Creates a GetIdentityByPublicKeyHashResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse - */ - GetIdentityByPublicKeyHashResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.fromObject(object.v0); - } - return message; - }; + /** + * Creates a new SerializedVotePollsByTimestamp instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamp=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} SerializedVotePollsByTimestamp instance + */ + SerializedVotePollsByTimestamp.create = function create(properties) { + return new SerializedVotePollsByTimestamp(properties); + }; - /** - * Creates a plain object from a GetIdentityByPublicKeyHashResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetIdentityByPublicKeyHashResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Encodes the specified SerializedVotePollsByTimestamp message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamp} message SerializedVotePollsByTimestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SerializedVotePollsByTimestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.timestamp); + if (message.serializedVotePolls != null && message.serializedVotePolls.length) + for (var i = 0; i < message.serializedVotePolls.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.serializedVotePolls[i]); + return writer; + }; - /** - * Converts this GetIdentityByPublicKeyHashResponse to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @instance - * @returns {Object.} JSON object - */ - GetIdentityByPublicKeyHashResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified SerializedVotePollsByTimestamp message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamp} message SerializedVotePollsByTimestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SerializedVotePollsByTimestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = (function() { + /** + * Decodes a SerializedVotePollsByTimestamp message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} SerializedVotePollsByTimestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SerializedVotePollsByTimestamp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timestamp = reader.uint64(); + break; + case 2: + if (!(message.serializedVotePolls && message.serializedVotePolls.length)) + message.serializedVotePolls = []; + message.serializedVotePolls.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Properties of a GetIdentityByPublicKeyHashResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @interface IGetIdentityByPublicKeyHashResponseV0 - * @property {Uint8Array|null} [identity] GetIdentityByPublicKeyHashResponseV0 identity - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityByPublicKeyHashResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityByPublicKeyHashResponseV0 metadata - */ + /** + * Decodes a SerializedVotePollsByTimestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} SerializedVotePollsByTimestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SerializedVotePollsByTimestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SerializedVotePollsByTimestamp message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SerializedVotePollsByTimestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + if (message.serializedVotePolls != null && message.hasOwnProperty("serializedVotePolls")) { + if (!Array.isArray(message.serializedVotePolls)) + return "serializedVotePolls: array expected"; + for (var i = 0; i < message.serializedVotePolls.length; ++i) + if (!(message.serializedVotePolls[i] && typeof message.serializedVotePolls[i].length === "number" || $util.isString(message.serializedVotePolls[i]))) + return "serializedVotePolls: buffer[] expected"; + } + return null; + }; + + /** + * Creates a SerializedVotePollsByTimestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} SerializedVotePollsByTimestamp + */ + SerializedVotePollsByTimestamp.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp(); + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + if (object.serializedVotePolls) { + if (!Array.isArray(object.serializedVotePolls)) + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serializedVotePolls: array expected"); + message.serializedVotePolls = []; + for (var i = 0; i < object.serializedVotePolls.length; ++i) + if (typeof object.serializedVotePolls[i] === "string") + $util.base64.decode(object.serializedVotePolls[i], message.serializedVotePolls[i] = $util.newBuffer($util.base64.length(object.serializedVotePolls[i])), 0); + else if (object.serializedVotePolls[i].length >= 0) + message.serializedVotePolls[i] = object.serializedVotePolls[i]; + } + return message; + }; + + /** + * Creates a plain object from a SerializedVotePollsByTimestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} message SerializedVotePollsByTimestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SerializedVotePollsByTimestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.serializedVotePolls = []; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + if (message.serializedVotePolls && message.serializedVotePolls.length) { + object.serializedVotePolls = []; + for (var j = 0; j < message.serializedVotePolls.length; ++j) + object.serializedVotePolls[j] = options.bytes === String ? $util.base64.encode(message.serializedVotePolls[j], 0, message.serializedVotePolls[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.serializedVotePolls[j]) : message.serializedVotePolls[j]; + } + return object; + }; + + /** + * Converts this SerializedVotePollsByTimestamp to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp + * @instance + * @returns {Object.} JSON object + */ + SerializedVotePollsByTimestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Constructs a new GetIdentityByPublicKeyHashResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @classdesc Represents a GetIdentityByPublicKeyHashResponseV0. - * @implements IGetIdentityByPublicKeyHashResponseV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set - */ - function GetIdentityByPublicKeyHashResponseV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return SerializedVotePollsByTimestamp; + })(); - /** - * GetIdentityByPublicKeyHashResponseV0 identity. - * @member {Uint8Array} identity - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @instance - */ - GetIdentityByPublicKeyHashResponseV0.prototype.identity = $util.newBuffer([]); + GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps = (function() { - /** - * GetIdentityByPublicKeyHashResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @instance - */ - GetIdentityByPublicKeyHashResponseV0.prototype.proof = null; + /** + * Properties of a SerializedVotePollsByTimestamps. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 + * @interface ISerializedVotePollsByTimestamps + * @property {Array.|null} [votePollsByTimestamps] SerializedVotePollsByTimestamps votePollsByTimestamps + * @property {boolean|null} [finishedResults] SerializedVotePollsByTimestamps finishedResults + */ - /** - * GetIdentityByPublicKeyHashResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @instance - */ - GetIdentityByPublicKeyHashResponseV0.prototype.metadata = null; + /** + * Constructs a new SerializedVotePollsByTimestamps. + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 + * @classdesc Represents a SerializedVotePollsByTimestamps. + * @implements ISerializedVotePollsByTimestamps + * @constructor + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamps=} [properties] Properties to set + */ + function SerializedVotePollsByTimestamps(properties) { + this.votePollsByTimestamps = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * SerializedVotePollsByTimestamps votePollsByTimestamps. + * @member {Array.} votePollsByTimestamps + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @instance + */ + SerializedVotePollsByTimestamps.prototype.votePollsByTimestamps = $util.emptyArray; - /** - * GetIdentityByPublicKeyHashResponseV0 result. - * @member {"identity"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @instance - */ - Object.defineProperty(GetIdentityByPublicKeyHashResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * SerializedVotePollsByTimestamps finishedResults. + * @member {boolean} finishedResults + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @instance + */ + SerializedVotePollsByTimestamps.prototype.finishedResults = false; - /** - * Creates a new GetIdentityByPublicKeyHashResponseV0 instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 instance - */ - GetIdentityByPublicKeyHashResponseV0.create = function create(properties) { - return new GetIdentityByPublicKeyHashResponseV0(properties); - }; + /** + * Creates a new SerializedVotePollsByTimestamps instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamps=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} SerializedVotePollsByTimestamps instance + */ + SerializedVotePollsByTimestamps.create = function create(properties) { + return new SerializedVotePollsByTimestamps(properties); + }; - /** - * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityByPublicKeyHashResponseV0.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified SerializedVotePollsByTimestamps message. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamps} message SerializedVotePollsByTimestamps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SerializedVotePollsByTimestamps.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.votePollsByTimestamps != null && message.votePollsByTimestamps.length) + for (var i = 0; i < message.votePollsByTimestamps.length; ++i) + $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.encode(message.votePollsByTimestamps[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.finishedResults != null && Object.hasOwnProperty.call(message, "finishedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.finishedResults); + return writer; + }; - /** - * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityByPublicKeyHashResponseV0.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified SerializedVotePollsByTimestamps message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ISerializedVotePollsByTimestamps} message SerializedVotePollsByTimestamps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SerializedVotePollsByTimestamps.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityByPublicKeyHashResponseV0.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.identity = reader.bytes(); - break; - case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a SerializedVotePollsByTimestamps message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} SerializedVotePollsByTimestamps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SerializedVotePollsByTimestamps.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.votePollsByTimestamps && message.votePollsByTimestamps.length)) + message.votePollsByTimestamps = []; + message.votePollsByTimestamps.push($root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.decode(reader, reader.uint32())); + break; + case 2: + message.finishedResults = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityByPublicKeyHashResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a SerializedVotePollsByTimestamps message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} SerializedVotePollsByTimestamps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SerializedVotePollsByTimestamps.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a GetIdentityByPublicKeyHashResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetIdentityByPublicKeyHashResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.identity != null && message.hasOwnProperty("identity")) { - properties.result = 1; - if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) - return "identity: buffer expected"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; + /** + * Verifies a SerializedVotePollsByTimestamps message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SerializedVotePollsByTimestamps.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.votePollsByTimestamps != null && message.hasOwnProperty("votePollsByTimestamps")) { + if (!Array.isArray(message.votePollsByTimestamps)) + return "votePollsByTimestamps: array expected"; + for (var i = 0; i < message.votePollsByTimestamps.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.verify(message.votePollsByTimestamps[i]); + if (error) + return "votePollsByTimestamps." + error; + } + } + if (message.finishedResults != null && message.hasOwnProperty("finishedResults")) + if (typeof message.finishedResults !== "boolean") + return "finishedResults: boolean expected"; + return null; + }; + + /** + * Creates a SerializedVotePollsByTimestamps message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} SerializedVotePollsByTimestamps + */ + SerializedVotePollsByTimestamps.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps(); + if (object.votePollsByTimestamps) { + if (!Array.isArray(object.votePollsByTimestamps)) + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.votePollsByTimestamps: array expected"); + message.votePollsByTimestamps = []; + for (var i = 0; i < object.votePollsByTimestamps.length; ++i) { + if (typeof object.votePollsByTimestamps[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.votePollsByTimestamps: object expected"); + message.votePollsByTimestamps[i] = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.fromObject(object.votePollsByTimestamps[i]); + } } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; + if (object.finishedResults != null) + message.finishedResults = Boolean(object.finishedResults); + return message; + }; - /** - * Creates a GetIdentityByPublicKeyHashResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 - */ - GetIdentityByPublicKeyHashResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) + /** + * Creates a plain object from a SerializedVotePollsByTimestamps message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @static + * @param {org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} message SerializedVotePollsByTimestamps + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SerializedVotePollsByTimestamps.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.votePollsByTimestamps = []; + if (options.defaults) + object.finishedResults = false; + if (message.votePollsByTimestamps && message.votePollsByTimestamps.length) { + object.votePollsByTimestamps = []; + for (var j = 0; j < message.votePollsByTimestamps.length; ++j) + object.votePollsByTimestamps[j] = $root.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.toObject(message.votePollsByTimestamps[j], options); + } + if (message.finishedResults != null && message.hasOwnProperty("finishedResults")) + object.finishedResults = message.finishedResults; return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); - if (object.identity != null) - if (typeof object.identity === "string") - $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); - else if (object.identity.length >= 0) - message.identity = object.identity; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } - return message; - }; + }; - /** - * Creates a plain object from a GetIdentityByPublicKeyHashResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetIdentityByPublicKeyHashResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.identity != null && message.hasOwnProperty("identity")) { - object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; - if (options.oneofs) - object.result = "identity"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; - }; + /** + * Converts this SerializedVotePollsByTimestamps to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps + * @instance + * @returns {Object.} JSON object + */ + SerializedVotePollsByTimestamps.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetIdentityByPublicKeyHashResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @instance - * @returns {Object.} JSON object - */ - GetIdentityByPublicKeyHashResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return SerializedVotePollsByTimestamps; + })(); - return GetIdentityByPublicKeyHashResponseV0; + return GetVotePollsByEndDateResponseV0; })(); - return GetIdentityByPublicKeyHashResponse; + return GetVotePollsByEndDateResponse; })(); - v0.WaitForStateTransitionResultRequest = (function() { + v0.GetContestedResourceVoteStateRequest = (function() { /** - * Properties of a WaitForStateTransitionResultRequest. + * Properties of a GetContestedResourceVoteStateRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IWaitForStateTransitionResultRequest - * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null} [v0] WaitForStateTransitionResultRequest v0 + * @interface IGetContestedResourceVoteStateRequest + * @property {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.IGetContestedResourceVoteStateRequestV0|null} [v0] GetContestedResourceVoteStateRequest v0 */ /** - * Constructs a new WaitForStateTransitionResultRequest. + * Constructs a new GetContestedResourceVoteStateRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a WaitForStateTransitionResultRequest. - * @implements IWaitForStateTransitionResultRequest + * @classdesc Represents a GetContestedResourceVoteStateRequest. + * @implements IGetContestedResourceVoteStateRequest * @constructor - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateRequest=} [properties] Properties to set */ - function WaitForStateTransitionResultRequest(properties) { + function GetContestedResourceVoteStateRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17792,89 +29303,89 @@ $root.org = (function() { } /** - * WaitForStateTransitionResultRequest v0. - * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * GetContestedResourceVoteStateRequest v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.IGetContestedResourceVoteStateRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @instance */ - WaitForStateTransitionResultRequest.prototype.v0 = null; + GetContestedResourceVoteStateRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * WaitForStateTransitionResultRequest version. + * GetContestedResourceVoteStateRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @instance */ - Object.defineProperty(WaitForStateTransitionResultRequest.prototype, "version", { + Object.defineProperty(GetContestedResourceVoteStateRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new WaitForStateTransitionResultRequest instance using the specified properties. + * Creates a new GetContestedResourceVoteStateRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} GetContestedResourceVoteStateRequest instance */ - WaitForStateTransitionResultRequest.create = function create(properties) { - return new WaitForStateTransitionResultRequest(properties); + GetContestedResourceVoteStateRequest.create = function create(properties) { + return new GetContestedResourceVoteStateRequest(properties); }; /** - * Encodes the specified WaitForStateTransitionResultRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateRequest} message GetContestedResourceVoteStateRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequest.encode = function encode(message, writer) { + GetContestedResourceVoteStateRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified WaitForStateTransitionResultRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateRequest} message GetContestedResourceVoteStateRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceVoteStateRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer. + * Decodes a GetContestedResourceVoteStateRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} GetContestedResourceVoteStateRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequest.decode = function decode(reader, length) { + GetContestedResourceVoteStateRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -17885,37 +29396,37 @@ $root.org = (function() { }; /** - * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceVoteStateRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} GetContestedResourceVoteStateRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequest.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceVoteStateRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WaitForStateTransitionResultRequest message. + * Verifies a GetContestedResourceVoteStateRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WaitForStateTransitionResultRequest.verify = function verify(message) { + GetContestedResourceVoteStateRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -17924,40 +29435,40 @@ $root.org = (function() { }; /** - * Creates a WaitForStateTransitionResultRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceVoteStateRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} GetContestedResourceVoteStateRequest */ - WaitForStateTransitionResultRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest) + GetContestedResourceVoteStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a WaitForStateTransitionResultRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceVoteStateRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} message GetContestedResourceVoteStateRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WaitForStateTransitionResultRequest.toObject = function toObject(message, options) { + GetContestedResourceVoteStateRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -17965,35 +29476,43 @@ $root.org = (function() { }; /** - * Converts this WaitForStateTransitionResultRequest to JSON. + * Converts this GetContestedResourceVoteStateRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest * @instance * @returns {Object.} JSON object */ - WaitForStateTransitionResultRequest.prototype.toJSON = function toJSON() { + GetContestedResourceVoteStateRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = (function() { + GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 = (function() { /** - * Properties of a WaitForStateTransitionResultRequestV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest - * @interface IWaitForStateTransitionResultRequestV0 - * @property {Uint8Array|null} [stateTransitionHash] WaitForStateTransitionResultRequestV0 stateTransitionHash - * @property {boolean|null} [prove] WaitForStateTransitionResultRequestV0 prove + * Properties of a GetContestedResourceVoteStateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest + * @interface IGetContestedResourceVoteStateRequestV0 + * @property {Uint8Array|null} [contractId] GetContestedResourceVoteStateRequestV0 contractId + * @property {string|null} [documentTypeName] GetContestedResourceVoteStateRequestV0 documentTypeName + * @property {string|null} [indexName] GetContestedResourceVoteStateRequestV0 indexName + * @property {Array.|null} [indexValues] GetContestedResourceVoteStateRequestV0 indexValues + * @property {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType|null} [resultType] GetContestedResourceVoteStateRequestV0 resultType + * @property {boolean|null} [allowIncludeLockedAndAbstainingVoteTally] GetContestedResourceVoteStateRequestV0 allowIncludeLockedAndAbstainingVoteTally + * @property {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.IStartAtIdentifierInfo|null} [startAtIdentifierInfo] GetContestedResourceVoteStateRequestV0 startAtIdentifierInfo + * @property {number|null} [count] GetContestedResourceVoteStateRequestV0 count + * @property {boolean|null} [prove] GetContestedResourceVoteStateRequestV0 prove */ /** - * Constructs a new WaitForStateTransitionResultRequestV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest - * @classdesc Represents a WaitForStateTransitionResultRequestV0. - * @implements IWaitForStateTransitionResultRequestV0 + * Constructs a new GetContestedResourceVoteStateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest + * @classdesc Represents a GetContestedResourceVoteStateRequestV0. + * @implements IGetContestedResourceVoteStateRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.IGetContestedResourceVoteStateRequestV0=} [properties] Properties to set */ - function WaitForStateTransitionResultRequestV0(properties) { + function GetContestedResourceVoteStateRequestV0(properties) { + this.indexValues = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18001,87 +29520,181 @@ $root.org = (function() { } /** - * WaitForStateTransitionResultRequestV0 stateTransitionHash. - * @member {Uint8Array} stateTransitionHash - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * GetContestedResourceVoteStateRequestV0 contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @instance */ - WaitForStateTransitionResultRequestV0.prototype.stateTransitionHash = $util.newBuffer([]); + GetContestedResourceVoteStateRequestV0.prototype.contractId = $util.newBuffer([]); /** - * WaitForStateTransitionResultRequestV0 prove. + * GetContestedResourceVoteStateRequestV0 documentTypeName. + * @member {string} documentTypeName + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @instance + */ + GetContestedResourceVoteStateRequestV0.prototype.documentTypeName = ""; + + /** + * GetContestedResourceVoteStateRequestV0 indexName. + * @member {string} indexName + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @instance + */ + GetContestedResourceVoteStateRequestV0.prototype.indexName = ""; + + /** + * GetContestedResourceVoteStateRequestV0 indexValues. + * @member {Array.} indexValues + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @instance + */ + GetContestedResourceVoteStateRequestV0.prototype.indexValues = $util.emptyArray; + + /** + * GetContestedResourceVoteStateRequestV0 resultType. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} resultType + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @instance + */ + GetContestedResourceVoteStateRequestV0.prototype.resultType = 0; + + /** + * GetContestedResourceVoteStateRequestV0 allowIncludeLockedAndAbstainingVoteTally. + * @member {boolean} allowIncludeLockedAndAbstainingVoteTally + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @instance + */ + GetContestedResourceVoteStateRequestV0.prototype.allowIncludeLockedAndAbstainingVoteTally = false; + + /** + * GetContestedResourceVoteStateRequestV0 startAtIdentifierInfo. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.IStartAtIdentifierInfo|null|undefined} startAtIdentifierInfo + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @instance + */ + GetContestedResourceVoteStateRequestV0.prototype.startAtIdentifierInfo = null; + + /** + * GetContestedResourceVoteStateRequestV0 count. + * @member {number} count + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @instance + */ + GetContestedResourceVoteStateRequestV0.prototype.count = 0; + + /** + * GetContestedResourceVoteStateRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @instance */ - WaitForStateTransitionResultRequestV0.prototype.prove = false; + GetContestedResourceVoteStateRequestV0.prototype.prove = false; /** - * Creates a new WaitForStateTransitionResultRequestV0 instance using the specified properties. + * Creates a new GetContestedResourceVoteStateRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.IGetContestedResourceVoteStateRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} GetContestedResourceVoteStateRequestV0 instance */ - WaitForStateTransitionResultRequestV0.create = function create(properties) { - return new WaitForStateTransitionResultRequestV0(properties); + GetContestedResourceVoteStateRequestV0.create = function create(properties) { + return new GetContestedResourceVoteStateRequestV0(properties); }; /** - * Encodes the specified WaitForStateTransitionResultRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.IGetContestedResourceVoteStateRequestV0} message GetContestedResourceVoteStateRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequestV0.encode = function encode(message, writer) { + GetContestedResourceVoteStateRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.stateTransitionHash != null && Object.hasOwnProperty.call(message, "stateTransitionHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.stateTransitionHash); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + if (message.documentTypeName != null && Object.hasOwnProperty.call(message, "documentTypeName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentTypeName); + if (message.indexName != null && Object.hasOwnProperty.call(message, "indexName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.indexName); + if (message.indexValues != null && message.indexValues.length) + for (var i = 0; i < message.indexValues.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.indexValues[i]); + if (message.resultType != null && Object.hasOwnProperty.call(message, "resultType")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.resultType); + if (message.allowIncludeLockedAndAbstainingVoteTally != null && Object.hasOwnProperty.call(message, "allowIncludeLockedAndAbstainingVoteTally")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowIncludeLockedAndAbstainingVoteTally); + if (message.startAtIdentifierInfo != null && Object.hasOwnProperty.call(message, "startAtIdentifierInfo")) + $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.encode(message.startAtIdentifierInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 8, wireType 0 =*/64).uint32(message.count); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.prove); return writer; }; /** - * Encodes the specified WaitForStateTransitionResultRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.IGetContestedResourceVoteStateRequestV0} message GetContestedResourceVoteStateRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceVoteStateRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer. + * Decodes a GetContestedResourceVoteStateRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} GetContestedResourceVoteStateRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequestV0.decode = function decode(reader, length) { + GetContestedResourceVoteStateRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.stateTransitionHash = reader.bytes(); + message.contractId = reader.bytes(); + break; + case 2: + message.documentTypeName = reader.string(); + break; + case 3: + message.indexName = reader.string(); + break; + case 4: + if (!(message.indexValues && message.indexValues.length)) + message.indexValues = []; + message.indexValues.push(reader.bytes()); + break; + case 5: + message.resultType = reader.int32(); + break; + case 6: + message.allowIncludeLockedAndAbstainingVoteTally = reader.bool(); + break; + case 7: + message.startAtIdentifierInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.decode(reader, reader.uint32()); + break; + case 8: + message.count = reader.uint32(); break; - case 2: + case 9: message.prove = reader.bool(); break; default: @@ -18093,35 +29706,68 @@ $root.org = (function() { }; /** - * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceVoteStateRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} GetContestedResourceVoteStateRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceVoteStateRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WaitForStateTransitionResultRequestV0 message. + * Verifies a GetContestedResourceVoteStateRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WaitForStateTransitionResultRequestV0.verify = function verify(message) { + GetContestedResourceVoteStateRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) - if (!(message.stateTransitionHash && typeof message.stateTransitionHash.length === "number" || $util.isString(message.stateTransitionHash))) - return "stateTransitionHash: buffer expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + if (!$util.isString(message.documentTypeName)) + return "documentTypeName: string expected"; + if (message.indexName != null && message.hasOwnProperty("indexName")) + if (!$util.isString(message.indexName)) + return "indexName: string expected"; + if (message.indexValues != null && message.hasOwnProperty("indexValues")) { + if (!Array.isArray(message.indexValues)) + return "indexValues: array expected"; + for (var i = 0; i < message.indexValues.length; ++i) + if (!(message.indexValues[i] && typeof message.indexValues[i].length === "number" || $util.isString(message.indexValues[i]))) + return "indexValues: buffer[] expected"; + } + if (message.resultType != null && message.hasOwnProperty("resultType")) + switch (message.resultType) { + default: + return "resultType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.allowIncludeLockedAndAbstainingVoteTally != null && message.hasOwnProperty("allowIncludeLockedAndAbstainingVoteTally")) + if (typeof message.allowIncludeLockedAndAbstainingVoteTally !== "boolean") + return "allowIncludeLockedAndAbstainingVoteTally: boolean expected"; + if (message.startAtIdentifierInfo != null && message.hasOwnProperty("startAtIdentifierInfo")) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.verify(message.startAtIdentifierInfo); + if (error) + return "startAtIdentifierInfo." + error; + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -18129,92 +29775,389 @@ $root.org = (function() { }; /** - * Creates a WaitForStateTransitionResultRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceVoteStateRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} GetContestedResourceVoteStateRequestV0 */ - WaitForStateTransitionResultRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) + GetContestedResourceVoteStateRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); - if (object.stateTransitionHash != null) - if (typeof object.stateTransitionHash === "string") - $util.base64.decode(object.stateTransitionHash, message.stateTransitionHash = $util.newBuffer($util.base64.length(object.stateTransitionHash)), 0); - else if (object.stateTransitionHash.length >= 0) - message.stateTransitionHash = object.stateTransitionHash; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0(); + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentTypeName != null) + message.documentTypeName = String(object.documentTypeName); + if (object.indexName != null) + message.indexName = String(object.indexName); + if (object.indexValues) { + if (!Array.isArray(object.indexValues)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.indexValues: array expected"); + message.indexValues = []; + for (var i = 0; i < object.indexValues.length; ++i) + if (typeof object.indexValues[i] === "string") + $util.base64.decode(object.indexValues[i], message.indexValues[i] = $util.newBuffer($util.base64.length(object.indexValues[i])), 0); + else if (object.indexValues[i].length >= 0) + message.indexValues[i] = object.indexValues[i]; + } + switch (object.resultType) { + case "DOCUMENTS": + case 0: + message.resultType = 0; + break; + case "VOTE_TALLY": + case 1: + message.resultType = 1; + break; + case "DOCUMENTS_AND_VOTE_TALLY": + case 2: + message.resultType = 2; + break; + } + if (object.allowIncludeLockedAndAbstainingVoteTally != null) + message.allowIncludeLockedAndAbstainingVoteTally = Boolean(object.allowIncludeLockedAndAbstainingVoteTally); + if (object.startAtIdentifierInfo != null) { + if (typeof object.startAtIdentifierInfo !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.startAtIdentifierInfo: object expected"); + message.startAtIdentifierInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.fromObject(object.startAtIdentifierInfo); + } + if (object.count != null) + message.count = object.count >>> 0; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a WaitForStateTransitionResultRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceVoteStateRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} message GetContestedResourceVoteStateRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WaitForStateTransitionResultRequestV0.toObject = function toObject(message, options) { + GetContestedResourceVoteStateRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.indexValues = []; if (options.defaults) { if (options.bytes === String) - object.stateTransitionHash = ""; + object.contractId = ""; else { - object.stateTransitionHash = []; + object.contractId = []; if (options.bytes !== Array) - object.stateTransitionHash = $util.newBuffer(object.stateTransitionHash); + object.contractId = $util.newBuffer(object.contractId); } + object.documentTypeName = ""; + object.indexName = ""; + object.resultType = options.enums === String ? "DOCUMENTS" : 0; + object.allowIncludeLockedAndAbstainingVoteTally = false; + object.startAtIdentifierInfo = null; + object.count = 0; object.prove = false; } - if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) - object.stateTransitionHash = options.bytes === String ? $util.base64.encode(message.stateTransitionHash, 0, message.stateTransitionHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.stateTransitionHash) : message.stateTransitionHash; + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + object.documentTypeName = message.documentTypeName; + if (message.indexName != null && message.hasOwnProperty("indexName")) + object.indexName = message.indexName; + if (message.indexValues && message.indexValues.length) { + object.indexValues = []; + for (var j = 0; j < message.indexValues.length; ++j) + object.indexValues[j] = options.bytes === String ? $util.base64.encode(message.indexValues[j], 0, message.indexValues[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.indexValues[j]) : message.indexValues[j]; + } + if (message.resultType != null && message.hasOwnProperty("resultType")) + object.resultType = options.enums === String ? $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType[message.resultType] : message.resultType; + if (message.allowIncludeLockedAndAbstainingVoteTally != null && message.hasOwnProperty("allowIncludeLockedAndAbstainingVoteTally")) + object.allowIncludeLockedAndAbstainingVoteTally = message.allowIncludeLockedAndAbstainingVoteTally; + if (message.startAtIdentifierInfo != null && message.hasOwnProperty("startAtIdentifierInfo")) + object.startAtIdentifierInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.toObject(message.startAtIdentifierInfo, options); + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this WaitForStateTransitionResultRequestV0 to JSON. + * Converts this GetContestedResourceVoteStateRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 * @instance * @returns {Object.} JSON object */ - WaitForStateTransitionResultRequestV0.prototype.toJSON = function toJSON() { + GetContestedResourceVoteStateRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WaitForStateTransitionResultRequestV0; + GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo = (function() { + + /** + * Properties of a StartAtIdentifierInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @interface IStartAtIdentifierInfo + * @property {Uint8Array|null} [startIdentifier] StartAtIdentifierInfo startIdentifier + * @property {boolean|null} [startIdentifierIncluded] StartAtIdentifierInfo startIdentifierIncluded + */ + + /** + * Constructs a new StartAtIdentifierInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 + * @classdesc Represents a StartAtIdentifierInfo. + * @implements IStartAtIdentifierInfo + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.IStartAtIdentifierInfo=} [properties] Properties to set + */ + function StartAtIdentifierInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StartAtIdentifierInfo startIdentifier. + * @member {Uint8Array} startIdentifier + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @instance + */ + StartAtIdentifierInfo.prototype.startIdentifier = $util.newBuffer([]); + + /** + * StartAtIdentifierInfo startIdentifierIncluded. + * @member {boolean} startIdentifierIncluded + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @instance + */ + StartAtIdentifierInfo.prototype.startIdentifierIncluded = false; + + /** + * Creates a new StartAtIdentifierInfo instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.IStartAtIdentifierInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo instance + */ + StartAtIdentifierInfo.create = function create(properties) { + return new StartAtIdentifierInfo(properties); + }; + + /** + * Encodes the specified StartAtIdentifierInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.IStartAtIdentifierInfo} message StartAtIdentifierInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtIdentifierInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startIdentifier != null && Object.hasOwnProperty.call(message, "startIdentifier")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startIdentifier); + if (message.startIdentifierIncluded != null && Object.hasOwnProperty.call(message, "startIdentifierIncluded")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.startIdentifierIncluded); + return writer; + }; + + /** + * Encodes the specified StartAtIdentifierInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.IStartAtIdentifierInfo} message StartAtIdentifierInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtIdentifierInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StartAtIdentifierInfo message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtIdentifierInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startIdentifier = reader.bytes(); + break; + case 2: + message.startIdentifierIncluded = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StartAtIdentifierInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtIdentifierInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StartAtIdentifierInfo message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StartAtIdentifierInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startIdentifier != null && message.hasOwnProperty("startIdentifier")) + if (!(message.startIdentifier && typeof message.startIdentifier.length === "number" || $util.isString(message.startIdentifier))) + return "startIdentifier: buffer expected"; + if (message.startIdentifierIncluded != null && message.hasOwnProperty("startIdentifierIncluded")) + if (typeof message.startIdentifierIncluded !== "boolean") + return "startIdentifierIncluded: boolean expected"; + return null; + }; + + /** + * Creates a StartAtIdentifierInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo + */ + StartAtIdentifierInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo(); + if (object.startIdentifier != null) + if (typeof object.startIdentifier === "string") + $util.base64.decode(object.startIdentifier, message.startIdentifier = $util.newBuffer($util.base64.length(object.startIdentifier)), 0); + else if (object.startIdentifier.length >= 0) + message.startIdentifier = object.startIdentifier; + if (object.startIdentifierIncluded != null) + message.startIdentifierIncluded = Boolean(object.startIdentifierIncluded); + return message; + }; + + /** + * Creates a plain object from a StartAtIdentifierInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} message StartAtIdentifierInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StartAtIdentifierInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.startIdentifier = ""; + else { + object.startIdentifier = []; + if (options.bytes !== Array) + object.startIdentifier = $util.newBuffer(object.startIdentifier); + } + object.startIdentifierIncluded = false; + } + if (message.startIdentifier != null && message.hasOwnProperty("startIdentifier")) + object.startIdentifier = options.bytes === String ? $util.base64.encode(message.startIdentifier, 0, message.startIdentifier.length) : options.bytes === Array ? Array.prototype.slice.call(message.startIdentifier) : message.startIdentifier; + if (message.startIdentifierIncluded != null && message.hasOwnProperty("startIdentifierIncluded")) + object.startIdentifierIncluded = message.startIdentifierIncluded; + return object; + }; + + /** + * Converts this StartAtIdentifierInfo to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo + * @instance + * @returns {Object.} JSON object + */ + StartAtIdentifierInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StartAtIdentifierInfo; + })(); + + /** + * ResultType enum. + * @name org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType + * @enum {number} + * @property {number} DOCUMENTS=0 DOCUMENTS value + * @property {number} VOTE_TALLY=1 VOTE_TALLY value + * @property {number} DOCUMENTS_AND_VOTE_TALLY=2 DOCUMENTS_AND_VOTE_TALLY value + */ + GetContestedResourceVoteStateRequestV0.ResultType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DOCUMENTS"] = 0; + values[valuesById[1] = "VOTE_TALLY"] = 1; + values[valuesById[2] = "DOCUMENTS_AND_VOTE_TALLY"] = 2; + return values; + })(); + + return GetContestedResourceVoteStateRequestV0; })(); - return WaitForStateTransitionResultRequest; + return GetContestedResourceVoteStateRequest; })(); - v0.WaitForStateTransitionResultResponse = (function() { + v0.GetContestedResourceVoteStateResponse = (function() { /** - * Properties of a WaitForStateTransitionResultResponse. + * Properties of a GetContestedResourceVoteStateResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IWaitForStateTransitionResultResponse - * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null} [v0] WaitForStateTransitionResultResponse v0 + * @interface IGetContestedResourceVoteStateResponse + * @property {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.IGetContestedResourceVoteStateResponseV0|null} [v0] GetContestedResourceVoteStateResponse v0 */ /** - * Constructs a new WaitForStateTransitionResultResponse. + * Constructs a new GetContestedResourceVoteStateResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a WaitForStateTransitionResultResponse. - * @implements IWaitForStateTransitionResultResponse + * @classdesc Represents a GetContestedResourceVoteStateResponse. + * @implements IGetContestedResourceVoteStateResponse * @constructor - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateResponse=} [properties] Properties to set */ - function WaitForStateTransitionResultResponse(properties) { + function GetContestedResourceVoteStateResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18222,89 +30165,89 @@ $root.org = (function() { } /** - * WaitForStateTransitionResultResponse v0. - * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * GetContestedResourceVoteStateResponse v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.IGetContestedResourceVoteStateResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @instance */ - WaitForStateTransitionResultResponse.prototype.v0 = null; + GetContestedResourceVoteStateResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * WaitForStateTransitionResultResponse version. + * GetContestedResourceVoteStateResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @instance */ - Object.defineProperty(WaitForStateTransitionResultResponse.prototype, "version", { + Object.defineProperty(GetContestedResourceVoteStateResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new WaitForStateTransitionResultResponse instance using the specified properties. + * Creates a new GetContestedResourceVoteStateResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} GetContestedResourceVoteStateResponse instance */ - WaitForStateTransitionResultResponse.create = function create(properties) { - return new WaitForStateTransitionResultResponse(properties); + GetContestedResourceVoteStateResponse.create = function create(properties) { + return new GetContestedResourceVoteStateResponse(properties); }; /** - * Encodes the specified WaitForStateTransitionResultResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateResponse} message GetContestedResourceVoteStateResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultResponse.encode = function encode(message, writer) { + GetContestedResourceVoteStateResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified WaitForStateTransitionResultResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVoteStateResponse} message GetContestedResourceVoteStateResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceVoteStateResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer. + * Decodes a GetContestedResourceVoteStateResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} GetContestedResourceVoteStateResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultResponse.decode = function decode(reader, length) { + GetContestedResourceVoteStateResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -18315,37 +30258,37 @@ $root.org = (function() { }; /** - * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceVoteStateResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} GetContestedResourceVoteStateResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultResponse.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceVoteStateResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WaitForStateTransitionResultResponse message. + * Verifies a GetContestedResourceVoteStateResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WaitForStateTransitionResultResponse.verify = function verify(message) { + GetContestedResourceVoteStateResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -18354,40 +30297,40 @@ $root.org = (function() { }; /** - * Creates a WaitForStateTransitionResultResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceVoteStateResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} GetContestedResourceVoteStateResponse */ - WaitForStateTransitionResultResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse) + GetContestedResourceVoteStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a WaitForStateTransitionResultResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceVoteStateResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} message GetContestedResourceVoteStateResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WaitForStateTransitionResultResponse.toObject = function toObject(message, options) { + GetContestedResourceVoteStateResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -18395,36 +30338,36 @@ $root.org = (function() { }; /** - * Converts this WaitForStateTransitionResultResponse to JSON. + * Converts this GetContestedResourceVoteStateResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse * @instance * @returns {Object.} JSON object */ - WaitForStateTransitionResultResponse.prototype.toJSON = function toJSON() { + GetContestedResourceVoteStateResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = (function() { + GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 = (function() { /** - * Properties of a WaitForStateTransitionResultResponseV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @interface IWaitForStateTransitionResultResponseV0 - * @property {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null} [error] WaitForStateTransitionResultResponseV0 error - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] WaitForStateTransitionResultResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] WaitForStateTransitionResultResponseV0 metadata + * Properties of a GetContestedResourceVoteStateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse + * @interface IGetContestedResourceVoteStateResponseV0 + * @property {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContestedResourceContenders|null} [contestedResourceContenders] GetContestedResourceVoteStateResponseV0 contestedResourceContenders + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetContestedResourceVoteStateResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetContestedResourceVoteStateResponseV0 metadata */ /** - * Constructs a new WaitForStateTransitionResultResponseV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @classdesc Represents a WaitForStateTransitionResultResponseV0. - * @implements IWaitForStateTransitionResultResponseV0 + * Constructs a new GetContestedResourceVoteStateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse + * @classdesc Represents a GetContestedResourceVoteStateResponseV0. + * @implements IGetContestedResourceVoteStateResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.IGetContestedResourceVoteStateResponseV0=} [properties] Properties to set */ - function WaitForStateTransitionResultResponseV0(properties) { + function GetContestedResourceVoteStateResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18432,69 +30375,69 @@ $root.org = (function() { } /** - * WaitForStateTransitionResultResponseV0 error. - * @member {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null|undefined} error - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * GetContestedResourceVoteStateResponseV0 contestedResourceContenders. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContestedResourceContenders|null|undefined} contestedResourceContenders + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @instance */ - WaitForStateTransitionResultResponseV0.prototype.error = null; + GetContestedResourceVoteStateResponseV0.prototype.contestedResourceContenders = null; /** - * WaitForStateTransitionResultResponseV0 proof. + * GetContestedResourceVoteStateResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @instance */ - WaitForStateTransitionResultResponseV0.prototype.proof = null; + GetContestedResourceVoteStateResponseV0.prototype.proof = null; /** - * WaitForStateTransitionResultResponseV0 metadata. + * GetContestedResourceVoteStateResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @instance */ - WaitForStateTransitionResultResponseV0.prototype.metadata = null; + GetContestedResourceVoteStateResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * WaitForStateTransitionResultResponseV0 result. - * @member {"error"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * GetContestedResourceVoteStateResponseV0 result. + * @member {"contestedResourceContenders"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @instance */ - Object.defineProperty(WaitForStateTransitionResultResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["error", "proof"]), + Object.defineProperty(GetContestedResourceVoteStateResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["contestedResourceContenders", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new WaitForStateTransitionResultResponseV0 instance using the specified properties. + * Creates a new GetContestedResourceVoteStateResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.IGetContestedResourceVoteStateResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} GetContestedResourceVoteStateResponseV0 instance */ - WaitForStateTransitionResultResponseV0.create = function create(properties) { - return new WaitForStateTransitionResultResponseV0(properties); + GetContestedResourceVoteStateResponseV0.create = function create(properties) { + return new GetContestedResourceVoteStateResponseV0(properties); }; /** - * Encodes the specified WaitForStateTransitionResultResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.IGetContestedResourceVoteStateResponseV0} message GetContestedResourceVoteStateResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultResponseV0.encode = function encode(message, writer) { + GetContestedResourceVoteStateResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.encode(message.error, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.contestedResourceContenders != null && Object.hasOwnProperty.call(message, "contestedResourceContenders")) + $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.encode(message.contestedResourceContenders, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -18503,38 +30446,38 @@ $root.org = (function() { }; /** - * Encodes the specified WaitForStateTransitionResultResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourceVoteStateResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.IGetContestedResourceVoteStateResponseV0} message GetContestedResourceVoteStateResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceVoteStateResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer. + * Decodes a GetContestedResourceVoteStateResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} GetContestedResourceVoteStateResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultResponseV0.decode = function decode(reader, length) { + GetContestedResourceVoteStateResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.decode(reader, reader.uint32()); + message.contestedResourceContenders = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.decode(reader, reader.uint32()); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -18551,39 +30494,39 @@ $root.org = (function() { }; /** - * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceVoteStateResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} GetContestedResourceVoteStateResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceVoteStateResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WaitForStateTransitionResultResponseV0 message. + * Verifies a GetContestedResourceVoteStateResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WaitForStateTransitionResultResponseV0.verify = function verify(message) { + GetContestedResourceVoteStateResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.error != null && message.hasOwnProperty("error")) { + if (message.contestedResourceContenders != null && message.hasOwnProperty("contestedResourceContenders")) { properties.result = 1; { - var error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.verify(message.error); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.verify(message.contestedResourceContenders); if (error) - return "error." + error; + return "contestedResourceContenders." + error; } } if (message.proof != null && message.hasOwnProperty("proof")) { @@ -18605,54 +30548,54 @@ $root.org = (function() { }; /** - * Creates a WaitForStateTransitionResultResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceVoteStateResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} GetContestedResourceVoteStateResponseV0 */ - WaitForStateTransitionResultResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) + GetContestedResourceVoteStateResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.error: object expected"); - message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.fromObject(object.error); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0(); + if (object.contestedResourceContenders != null) { + if (typeof object.contestedResourceContenders !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.contestedResourceContenders: object expected"); + message.contestedResourceContenders = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.fromObject(object.contestedResourceContenders); } if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a WaitForStateTransitionResultResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceVoteStateResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} message GetContestedResourceVoteStateResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WaitForStateTransitionResultResponseV0.toObject = function toObject(message, options) { + GetContestedResourceVoteStateResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; - if (message.error != null && message.hasOwnProperty("error")) { - object.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(message.error, options); + if (message.contestedResourceContenders != null && message.hasOwnProperty("contestedResourceContenders")) { + object.contestedResourceContenders = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.toObject(message.contestedResourceContenders, options); if (options.oneofs) - object.result = "error"; + object.result = "contestedResourceContenders"; } if (message.proof != null && message.hasOwnProperty("proof")) { object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); @@ -18665,461 +30608,940 @@ $root.org = (function() { }; /** - * Converts this WaitForStateTransitionResultResponseV0 to JSON. + * Converts this GetContestedResourceVoteStateResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 * @instance * @returns {Object.} JSON object */ - WaitForStateTransitionResultResponseV0.prototype.toJSON = function toJSON() { + GetContestedResourceVoteStateResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WaitForStateTransitionResultResponseV0; - })(); + GetContestedResourceVoteStateResponseV0.FinishedVoteInfo = (function() { + + /** + * Properties of a FinishedVoteInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 + * @interface IFinishedVoteInfo + * @property {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome|null} [finishedVoteOutcome] FinishedVoteInfo finishedVoteOutcome + * @property {Uint8Array|null} [wonByIdentityId] FinishedVoteInfo wonByIdentityId + * @property {number|Long|null} [finishedAtBlockHeight] FinishedVoteInfo finishedAtBlockHeight + * @property {number|null} [finishedAtCoreBlockHeight] FinishedVoteInfo finishedAtCoreBlockHeight + * @property {number|Long|null} [finishedAtBlockTimeMs] FinishedVoteInfo finishedAtBlockTimeMs + * @property {number|null} [finishedAtEpoch] FinishedVoteInfo finishedAtEpoch + */ + + /** + * Constructs a new FinishedVoteInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 + * @classdesc Represents a FinishedVoteInfo. + * @implements IFinishedVoteInfo + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IFinishedVoteInfo=} [properties] Properties to set + */ + function FinishedVoteInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FinishedVoteInfo finishedVoteOutcome. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} finishedVoteOutcome + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @instance + */ + FinishedVoteInfo.prototype.finishedVoteOutcome = 0; + + /** + * FinishedVoteInfo wonByIdentityId. + * @member {Uint8Array} wonByIdentityId + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @instance + */ + FinishedVoteInfo.prototype.wonByIdentityId = $util.newBuffer([]); + + /** + * FinishedVoteInfo finishedAtBlockHeight. + * @member {number|Long} finishedAtBlockHeight + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @instance + */ + FinishedVoteInfo.prototype.finishedAtBlockHeight = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * FinishedVoteInfo finishedAtCoreBlockHeight. + * @member {number} finishedAtCoreBlockHeight + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @instance + */ + FinishedVoteInfo.prototype.finishedAtCoreBlockHeight = 0; + + /** + * FinishedVoteInfo finishedAtBlockTimeMs. + * @member {number|Long} finishedAtBlockTimeMs + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @instance + */ + FinishedVoteInfo.prototype.finishedAtBlockTimeMs = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * FinishedVoteInfo finishedAtEpoch. + * @member {number} finishedAtEpoch + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @instance + */ + FinishedVoteInfo.prototype.finishedAtEpoch = 0; + + /** + * Creates a new FinishedVoteInfo instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IFinishedVoteInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} FinishedVoteInfo instance + */ + FinishedVoteInfo.create = function create(properties) { + return new FinishedVoteInfo(properties); + }; + + /** + * Encodes the specified FinishedVoteInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IFinishedVoteInfo} message FinishedVoteInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FinishedVoteInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.finishedVoteOutcome != null && Object.hasOwnProperty.call(message, "finishedVoteOutcome")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.finishedVoteOutcome); + if (message.wonByIdentityId != null && Object.hasOwnProperty.call(message, "wonByIdentityId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.wonByIdentityId); + if (message.finishedAtBlockHeight != null && Object.hasOwnProperty.call(message, "finishedAtBlockHeight")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.finishedAtBlockHeight); + if (message.finishedAtCoreBlockHeight != null && Object.hasOwnProperty.call(message, "finishedAtCoreBlockHeight")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.finishedAtCoreBlockHeight); + if (message.finishedAtBlockTimeMs != null && Object.hasOwnProperty.call(message, "finishedAtBlockTimeMs")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.finishedAtBlockTimeMs); + if (message.finishedAtEpoch != null && Object.hasOwnProperty.call(message, "finishedAtEpoch")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.finishedAtEpoch); + return writer; + }; + + /** + * Encodes the specified FinishedVoteInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IFinishedVoteInfo} message FinishedVoteInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FinishedVoteInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FinishedVoteInfo message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} FinishedVoteInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FinishedVoteInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.finishedVoteOutcome = reader.int32(); + break; + case 2: + message.wonByIdentityId = reader.bytes(); + break; + case 3: + message.finishedAtBlockHeight = reader.uint64(); + break; + case 4: + message.finishedAtCoreBlockHeight = reader.uint32(); + break; + case 5: + message.finishedAtBlockTimeMs = reader.uint64(); + break; + case 6: + message.finishedAtEpoch = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FinishedVoteInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} FinishedVoteInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FinishedVoteInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FinishedVoteInfo message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FinishedVoteInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.finishedVoteOutcome != null && message.hasOwnProperty("finishedVoteOutcome")) + switch (message.finishedVoteOutcome) { + default: + return "finishedVoteOutcome: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.wonByIdentityId != null && message.hasOwnProperty("wonByIdentityId")) + if (!(message.wonByIdentityId && typeof message.wonByIdentityId.length === "number" || $util.isString(message.wonByIdentityId))) + return "wonByIdentityId: buffer expected"; + if (message.finishedAtBlockHeight != null && message.hasOwnProperty("finishedAtBlockHeight")) + if (!$util.isInteger(message.finishedAtBlockHeight) && !(message.finishedAtBlockHeight && $util.isInteger(message.finishedAtBlockHeight.low) && $util.isInteger(message.finishedAtBlockHeight.high))) + return "finishedAtBlockHeight: integer|Long expected"; + if (message.finishedAtCoreBlockHeight != null && message.hasOwnProperty("finishedAtCoreBlockHeight")) + if (!$util.isInteger(message.finishedAtCoreBlockHeight)) + return "finishedAtCoreBlockHeight: integer expected"; + if (message.finishedAtBlockTimeMs != null && message.hasOwnProperty("finishedAtBlockTimeMs")) + if (!$util.isInteger(message.finishedAtBlockTimeMs) && !(message.finishedAtBlockTimeMs && $util.isInteger(message.finishedAtBlockTimeMs.low) && $util.isInteger(message.finishedAtBlockTimeMs.high))) + return "finishedAtBlockTimeMs: integer|Long expected"; + if (message.finishedAtEpoch != null && message.hasOwnProperty("finishedAtEpoch")) + if (!$util.isInteger(message.finishedAtEpoch)) + return "finishedAtEpoch: integer expected"; + return null; + }; + + /** + * Creates a FinishedVoteInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} FinishedVoteInfo + */ + FinishedVoteInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo(); + switch (object.finishedVoteOutcome) { + case "TOWARDS_IDENTITY": + case 0: + message.finishedVoteOutcome = 0; + break; + case "LOCKED": + case 1: + message.finishedVoteOutcome = 1; + break; + case "NO_PREVIOUS_WINNER": + case 2: + message.finishedVoteOutcome = 2; + break; + } + if (object.wonByIdentityId != null) + if (typeof object.wonByIdentityId === "string") + $util.base64.decode(object.wonByIdentityId, message.wonByIdentityId = $util.newBuffer($util.base64.length(object.wonByIdentityId)), 0); + else if (object.wonByIdentityId.length >= 0) + message.wonByIdentityId = object.wonByIdentityId; + if (object.finishedAtBlockHeight != null) + if ($util.Long) + (message.finishedAtBlockHeight = $util.Long.fromValue(object.finishedAtBlockHeight)).unsigned = true; + else if (typeof object.finishedAtBlockHeight === "string") + message.finishedAtBlockHeight = parseInt(object.finishedAtBlockHeight, 10); + else if (typeof object.finishedAtBlockHeight === "number") + message.finishedAtBlockHeight = object.finishedAtBlockHeight; + else if (typeof object.finishedAtBlockHeight === "object") + message.finishedAtBlockHeight = new $util.LongBits(object.finishedAtBlockHeight.low >>> 0, object.finishedAtBlockHeight.high >>> 0).toNumber(true); + if (object.finishedAtCoreBlockHeight != null) + message.finishedAtCoreBlockHeight = object.finishedAtCoreBlockHeight >>> 0; + if (object.finishedAtBlockTimeMs != null) + if ($util.Long) + (message.finishedAtBlockTimeMs = $util.Long.fromValue(object.finishedAtBlockTimeMs)).unsigned = true; + else if (typeof object.finishedAtBlockTimeMs === "string") + message.finishedAtBlockTimeMs = parseInt(object.finishedAtBlockTimeMs, 10); + else if (typeof object.finishedAtBlockTimeMs === "number") + message.finishedAtBlockTimeMs = object.finishedAtBlockTimeMs; + else if (typeof object.finishedAtBlockTimeMs === "object") + message.finishedAtBlockTimeMs = new $util.LongBits(object.finishedAtBlockTimeMs.low >>> 0, object.finishedAtBlockTimeMs.high >>> 0).toNumber(true); + if (object.finishedAtEpoch != null) + message.finishedAtEpoch = object.finishedAtEpoch >>> 0; + return message; + }; + + /** + * Creates a plain object from a FinishedVoteInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} message FinishedVoteInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FinishedVoteInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.finishedVoteOutcome = options.enums === String ? "TOWARDS_IDENTITY" : 0; + if (options.bytes === String) + object.wonByIdentityId = ""; + else { + object.wonByIdentityId = []; + if (options.bytes !== Array) + object.wonByIdentityId = $util.newBuffer(object.wonByIdentityId); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.finishedAtBlockHeight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.finishedAtBlockHeight = options.longs === String ? "0" : 0; + object.finishedAtCoreBlockHeight = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.finishedAtBlockTimeMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.finishedAtBlockTimeMs = options.longs === String ? "0" : 0; + object.finishedAtEpoch = 0; + } + if (message.finishedVoteOutcome != null && message.hasOwnProperty("finishedVoteOutcome")) + object.finishedVoteOutcome = options.enums === String ? $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome[message.finishedVoteOutcome] : message.finishedVoteOutcome; + if (message.wonByIdentityId != null && message.hasOwnProperty("wonByIdentityId")) + object.wonByIdentityId = options.bytes === String ? $util.base64.encode(message.wonByIdentityId, 0, message.wonByIdentityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.wonByIdentityId) : message.wonByIdentityId; + if (message.finishedAtBlockHeight != null && message.hasOwnProperty("finishedAtBlockHeight")) + if (typeof message.finishedAtBlockHeight === "number") + object.finishedAtBlockHeight = options.longs === String ? String(message.finishedAtBlockHeight) : message.finishedAtBlockHeight; + else + object.finishedAtBlockHeight = options.longs === String ? $util.Long.prototype.toString.call(message.finishedAtBlockHeight) : options.longs === Number ? new $util.LongBits(message.finishedAtBlockHeight.low >>> 0, message.finishedAtBlockHeight.high >>> 0).toNumber(true) : message.finishedAtBlockHeight; + if (message.finishedAtCoreBlockHeight != null && message.hasOwnProperty("finishedAtCoreBlockHeight")) + object.finishedAtCoreBlockHeight = message.finishedAtCoreBlockHeight; + if (message.finishedAtBlockTimeMs != null && message.hasOwnProperty("finishedAtBlockTimeMs")) + if (typeof message.finishedAtBlockTimeMs === "number") + object.finishedAtBlockTimeMs = options.longs === String ? String(message.finishedAtBlockTimeMs) : message.finishedAtBlockTimeMs; + else + object.finishedAtBlockTimeMs = options.longs === String ? $util.Long.prototype.toString.call(message.finishedAtBlockTimeMs) : options.longs === Number ? new $util.LongBits(message.finishedAtBlockTimeMs.low >>> 0, message.finishedAtBlockTimeMs.high >>> 0).toNumber(true) : message.finishedAtBlockTimeMs; + if (message.finishedAtEpoch != null && message.hasOwnProperty("finishedAtEpoch")) + object.finishedAtEpoch = message.finishedAtEpoch; + return object; + }; + + /** + * Converts this FinishedVoteInfo to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo + * @instance + * @returns {Object.} JSON object + */ + FinishedVoteInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * FinishedVoteOutcome enum. + * @name org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome + * @enum {number} + * @property {number} TOWARDS_IDENTITY=0 TOWARDS_IDENTITY value + * @property {number} LOCKED=1 LOCKED value + * @property {number} NO_PREVIOUS_WINNER=2 NO_PREVIOUS_WINNER value + */ + FinishedVoteInfo.FinishedVoteOutcome = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TOWARDS_IDENTITY"] = 0; + values[valuesById[1] = "LOCKED"] = 1; + values[valuesById[2] = "NO_PREVIOUS_WINNER"] = 2; + return values; + })(); - return WaitForStateTransitionResultResponse; - })(); + return FinishedVoteInfo; + })(); - v0.GetConsensusParamsRequest = (function() { + GetContestedResourceVoteStateResponseV0.ContestedResourceContenders = (function() { - /** - * Properties of a GetConsensusParamsRequest. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetConsensusParamsRequest - * @property {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null} [v0] GetConsensusParamsRequest v0 - */ + /** + * Properties of a ContestedResourceContenders. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 + * @interface IContestedResourceContenders + * @property {Array.|null} [contenders] ContestedResourceContenders contenders + * @property {number|null} [abstainVoteTally] ContestedResourceContenders abstainVoteTally + * @property {number|null} [lockVoteTally] ContestedResourceContenders lockVoteTally + * @property {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IFinishedVoteInfo|null} [finishedVoteInfo] ContestedResourceContenders finishedVoteInfo + */ - /** - * Constructs a new GetConsensusParamsRequest. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetConsensusParamsRequest. - * @implements IGetConsensusParamsRequest - * @constructor - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set - */ - function GetConsensusParamsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new ContestedResourceContenders. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 + * @classdesc Represents a ContestedResourceContenders. + * @implements IContestedResourceContenders + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContestedResourceContenders=} [properties] Properties to set + */ + function ContestedResourceContenders(properties) { + this.contenders = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * GetConsensusParamsRequest v0. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @instance - */ - GetConsensusParamsRequest.prototype.v0 = null; + /** + * ContestedResourceContenders contenders. + * @member {Array.} contenders + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @instance + */ + ContestedResourceContenders.prototype.contenders = $util.emptyArray; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * ContestedResourceContenders abstainVoteTally. + * @member {number} abstainVoteTally + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @instance + */ + ContestedResourceContenders.prototype.abstainVoteTally = 0; - /** - * GetConsensusParamsRequest version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @instance - */ - Object.defineProperty(GetConsensusParamsRequest.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * ContestedResourceContenders lockVoteTally. + * @member {number} lockVoteTally + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @instance + */ + ContestedResourceContenders.prototype.lockVoteTally = 0; - /** - * Creates a new GetConsensusParamsRequest instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest instance - */ - GetConsensusParamsRequest.create = function create(properties) { - return new GetConsensusParamsRequest(properties); - }; + /** + * ContestedResourceContenders finishedVoteInfo. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IFinishedVoteInfo|null|undefined} finishedVoteInfo + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @instance + */ + ContestedResourceContenders.prototype.finishedVoteInfo = null; - /** - * Encodes the specified GetConsensusParamsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Creates a new ContestedResourceContenders instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContestedResourceContenders=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} ContestedResourceContenders instance + */ + ContestedResourceContenders.create = function create(properties) { + return new ContestedResourceContenders(properties); + }; - /** - * Encodes the specified GetConsensusParamsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ContestedResourceContenders message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContestedResourceContenders} message ContestedResourceContenders message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceContenders.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contenders != null && message.contenders.length) + for (var i = 0; i < message.contenders.length; ++i) + $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.encode(message.contenders[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.abstainVoteTally != null && Object.hasOwnProperty.call(message, "abstainVoteTally")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.abstainVoteTally); + if (message.lockVoteTally != null && Object.hasOwnProperty.call(message, "lockVoteTally")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.lockVoteTally); + if (message.finishedVoteInfo != null && Object.hasOwnProperty.call(message, "finishedVoteInfo")) + $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.encode(message.finishedVoteInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; - /** - * Decodes a GetConsensusParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified ContestedResourceContenders message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContestedResourceContenders} message ContestedResourceContenders message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceContenders.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a GetConsensusParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ContestedResourceContenders message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} ContestedResourceContenders + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceContenders.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.contenders && message.contenders.length)) + message.contenders = []; + message.contenders.push($root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.decode(reader, reader.uint32())); + break; + case 2: + message.abstainVoteTally = reader.uint32(); + break; + case 3: + message.lockVoteTally = reader.uint32(); + break; + case 4: + message.finishedVoteInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Verifies a GetConsensusParamsRequest message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetConsensusParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify(message.v0); - if (error) - return "v0." + error; - } - } - return null; - }; + /** + * Decodes a ContestedResourceContenders message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} ContestedResourceContenders + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceContenders.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContestedResourceContenders message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContestedResourceContenders.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contenders != null && message.hasOwnProperty("contenders")) { + if (!Array.isArray(message.contenders)) + return "contenders: array expected"; + for (var i = 0; i < message.contenders.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.verify(message.contenders[i]); + if (error) + return "contenders." + error; + } + } + if (message.abstainVoteTally != null && message.hasOwnProperty("abstainVoteTally")) + if (!$util.isInteger(message.abstainVoteTally)) + return "abstainVoteTally: integer expected"; + if (message.lockVoteTally != null && message.hasOwnProperty("lockVoteTally")) + if (!$util.isInteger(message.lockVoteTally)) + return "lockVoteTally: integer expected"; + if (message.finishedVoteInfo != null && message.hasOwnProperty("finishedVoteInfo")) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.verify(message.finishedVoteInfo); + if (error) + return "finishedVoteInfo." + error; + } + return null; + }; - /** - * Creates a GetConsensusParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest - */ - GetConsensusParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.fromObject(object.v0); - } - return message; - }; + /** + * Creates a ContestedResourceContenders message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} ContestedResourceContenders + */ + ContestedResourceContenders.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders(); + if (object.contenders) { + if (!Array.isArray(object.contenders)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.contenders: array expected"); + message.contenders = []; + for (var i = 0; i < object.contenders.length; ++i) { + if (typeof object.contenders[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.contenders: object expected"); + message.contenders[i] = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.fromObject(object.contenders[i]); + } + } + if (object.abstainVoteTally != null) + message.abstainVoteTally = object.abstainVoteTally >>> 0; + if (object.lockVoteTally != null) + message.lockVoteTally = object.lockVoteTally >>> 0; + if (object.finishedVoteInfo != null) { + if (typeof object.finishedVoteInfo !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.finishedVoteInfo: object expected"); + message.finishedVoteInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.fromObject(object.finishedVoteInfo); + } + return message; + }; - /** - * Creates a plain object from a GetConsensusParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest} message GetConsensusParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetConsensusParamsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Creates a plain object from a ContestedResourceContenders message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} message ContestedResourceContenders + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContestedResourceContenders.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contenders = []; + if (options.defaults) { + object.abstainVoteTally = 0; + object.lockVoteTally = 0; + object.finishedVoteInfo = null; + } + if (message.contenders && message.contenders.length) { + object.contenders = []; + for (var j = 0; j < message.contenders.length; ++j) + object.contenders[j] = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.toObject(message.contenders[j], options); + } + if (message.abstainVoteTally != null && message.hasOwnProperty("abstainVoteTally")) + object.abstainVoteTally = message.abstainVoteTally; + if (message.lockVoteTally != null && message.hasOwnProperty("lockVoteTally")) + object.lockVoteTally = message.lockVoteTally; + if (message.finishedVoteInfo != null && message.hasOwnProperty("finishedVoteInfo")) + object.finishedVoteInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.toObject(message.finishedVoteInfo, options); + return object; + }; - /** - * Converts this GetConsensusParamsRequest to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @instance - * @returns {Object.} JSON object - */ - GetConsensusParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this ContestedResourceContenders to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders + * @instance + * @returns {Object.} JSON object + */ + ContestedResourceContenders.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetConsensusParamsRequest.GetConsensusParamsRequestV0 = (function() { + return ContestedResourceContenders; + })(); - /** - * Properties of a GetConsensusParamsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @interface IGetConsensusParamsRequestV0 - * @property {number|null} [height] GetConsensusParamsRequestV0 height - * @property {boolean|null} [prove] GetConsensusParamsRequestV0 prove - */ + GetContestedResourceVoteStateResponseV0.Contender = (function() { - /** - * Constructs a new GetConsensusParamsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @classdesc Represents a GetConsensusParamsRequestV0. - * @implements IGetConsensusParamsRequestV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set - */ - function GetConsensusParamsRequestV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a Contender. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 + * @interface IContender + * @property {Uint8Array|null} [identifier] Contender identifier + * @property {number|null} [voteCount] Contender voteCount + * @property {Uint8Array|null} [document] Contender document + */ - /** - * GetConsensusParamsRequestV0 height. - * @member {number} height - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @instance - */ - GetConsensusParamsRequestV0.prototype.height = 0; + /** + * Constructs a new Contender. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 + * @classdesc Represents a Contender. + * @implements IContender + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContender=} [properties] Properties to set + */ + function Contender(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * GetConsensusParamsRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @instance - */ - GetConsensusParamsRequestV0.prototype.prove = false; + /** + * Contender identifier. + * @member {Uint8Array} identifier + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @instance + */ + Contender.prototype.identifier = $util.newBuffer([]); - /** - * Creates a new GetConsensusParamsRequestV0 instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 instance - */ - GetConsensusParamsRequestV0.create = function create(properties) { - return new GetConsensusParamsRequestV0(properties); - }; + /** + * Contender voteCount. + * @member {number} voteCount + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @instance + */ + Contender.prototype.voteCount = 0; - /** - * Encodes the specified GetConsensusParamsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsRequestV0.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.height); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); - return writer; - }; + /** + * Contender document. + * @member {Uint8Array} document + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @instance + */ + Contender.prototype.document = $util.newBuffer([]); - /** - * Encodes the specified GetConsensusParamsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new Contender instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContender=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} Contender instance + */ + Contender.create = function create(properties) { + return new Contender(properties); + }; - /** - * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsRequestV0.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int32(); - break; - case 2: - message.prove = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Encodes the specified Contender message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContender} message Contender message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Contender.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identifier != null && Object.hasOwnProperty.call(message, "identifier")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identifier); + if (message.voteCount != null && Object.hasOwnProperty.call(message, "voteCount")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.voteCount); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.document); + return writer; + }; + + /** + * Encodes the specified Contender message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.IContender} message Contender message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Contender.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Contender message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} Contender + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Contender.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.bytes(); + break; + case 2: + message.voteCount = reader.uint32(); + break; + case 3: + message.document = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsRequestV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Contender message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} Contender + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Contender.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a GetConsensusParamsRequestV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetConsensusParamsRequestV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; - return null; - }; + /** + * Verifies a Contender message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Contender.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identifier != null && message.hasOwnProperty("identifier")) + if (!(message.identifier && typeof message.identifier.length === "number" || $util.isString(message.identifier))) + return "identifier: buffer expected"; + if (message.voteCount != null && message.hasOwnProperty("voteCount")) + if (!$util.isInteger(message.voteCount)) + return "voteCount: integer expected"; + if (message.document != null && message.hasOwnProperty("document")) + if (!(message.document && typeof message.document.length === "number" || $util.isString(message.document))) + return "document: buffer expected"; + return null; + }; - /** - * Creates a GetConsensusParamsRequestV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 - */ - GetConsensusParamsRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0) + /** + * Creates a Contender message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} Contender + */ + Contender.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender(); + if (object.identifier != null) + if (typeof object.identifier === "string") + $util.base64.decode(object.identifier, message.identifier = $util.newBuffer($util.base64.length(object.identifier)), 0); + else if (object.identifier.length >= 0) + message.identifier = object.identifier; + if (object.voteCount != null) + message.voteCount = object.voteCount >>> 0; + if (object.document != null) + if (typeof object.document === "string") + $util.base64.decode(object.document, message.document = $util.newBuffer($util.base64.length(object.document)), 0); + else if (object.document.length >= 0) + message.document = object.document; + return message; + }; + + /** + * Creates a plain object from a Contender message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} message Contender + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Contender.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.identifier = ""; + else { + object.identifier = []; + if (options.bytes !== Array) + object.identifier = $util.newBuffer(object.identifier); + } + object.voteCount = 0; + if (options.bytes === String) + object.document = ""; + else { + object.document = []; + if (options.bytes !== Array) + object.document = $util.newBuffer(object.document); + } + } + if (message.identifier != null && message.hasOwnProperty("identifier")) + object.identifier = options.bytes === String ? $util.base64.encode(message.identifier, 0, message.identifier.length) : options.bytes === Array ? Array.prototype.slice.call(message.identifier) : message.identifier; + if (message.voteCount != null && message.hasOwnProperty("voteCount")) + object.voteCount = message.voteCount; + if (message.document != null && message.hasOwnProperty("document")) + object.document = options.bytes === String ? $util.base64.encode(message.document, 0, message.document.length) : options.bytes === Array ? Array.prototype.slice.call(message.document) : message.document; return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); - if (object.height != null) - message.height = object.height | 0; - if (object.prove != null) - message.prove = Boolean(object.prove); - return message; - }; + }; - /** - * Creates a plain object from a GetConsensusParamsRequestV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetConsensusParamsRequestV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.height = 0; - object.prove = false; - } - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; - return object; - }; + /** + * Converts this Contender to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender + * @instance + * @returns {Object.} JSON object + */ + Contender.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetConsensusParamsRequestV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 - * @instance - * @returns {Object.} JSON object - */ - GetConsensusParamsRequestV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return Contender; + })(); - return GetConsensusParamsRequestV0; + return GetContestedResourceVoteStateResponseV0; })(); - return GetConsensusParamsRequest; + return GetContestedResourceVoteStateResponse; })(); - v0.GetConsensusParamsResponse = (function() { + v0.GetContestedResourceVotersForIdentityRequest = (function() { /** - * Properties of a GetConsensusParamsResponse. + * Properties of a GetContestedResourceVotersForIdentityRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetConsensusParamsResponse - * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null} [v0] GetConsensusParamsResponse v0 + * @interface IGetContestedResourceVotersForIdentityRequest + * @property {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.IGetContestedResourceVotersForIdentityRequestV0|null} [v0] GetContestedResourceVotersForIdentityRequest v0 */ /** - * Constructs a new GetConsensusParamsResponse. + * Constructs a new GetContestedResourceVotersForIdentityRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetConsensusParamsResponse. - * @implements IGetConsensusParamsResponse + * @classdesc Represents a GetContestedResourceVotersForIdentityRequest. + * @implements IGetContestedResourceVotersForIdentityRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityRequest=} [properties] Properties to set */ - function GetConsensusParamsResponse(properties) { + function GetContestedResourceVotersForIdentityRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19127,89 +31549,89 @@ $root.org = (function() { } /** - * GetConsensusParamsResponse v0. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * GetContestedResourceVotersForIdentityRequest v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.IGetContestedResourceVotersForIdentityRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @instance */ - GetConsensusParamsResponse.prototype.v0 = null; + GetContestedResourceVotersForIdentityRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetConsensusParamsResponse version. + * GetContestedResourceVotersForIdentityRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @instance */ - Object.defineProperty(GetConsensusParamsResponse.prototype, "version", { + Object.defineProperty(GetContestedResourceVotersForIdentityRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetConsensusParamsResponse instance using the specified properties. + * Creates a new GetContestedResourceVotersForIdentityRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} GetContestedResourceVotersForIdentityRequest instance */ - GetConsensusParamsResponse.create = function create(properties) { - return new GetConsensusParamsResponse(properties); + GetContestedResourceVotersForIdentityRequest.create = function create(properties) { + return new GetContestedResourceVotersForIdentityRequest(properties); }; /** - * Encodes the specified GetConsensusParamsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. + * Encodes the specified GetContestedResourceVotersForIdentityRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityRequest} message GetContestedResourceVotersForIdentityRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsResponse.encode = function encode(message, writer) { + GetContestedResourceVotersForIdentityRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetConsensusParamsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. + * Encodes the specified GetContestedResourceVotersForIdentityRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityRequest} message GetContestedResourceVotersForIdentityRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceVotersForIdentityRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetConsensusParamsResponse message from the specified reader or buffer. + * Decodes a GetContestedResourceVotersForIdentityRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} GetContestedResourceVotersForIdentityRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsResponse.decode = function decode(reader, length) { + GetContestedResourceVotersForIdentityRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -19220,37 +31642,37 @@ $root.org = (function() { }; /** - * Decodes a GetConsensusParamsResponse message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceVotersForIdentityRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} GetContestedResourceVotersForIdentityRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsResponse.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceVotersForIdentityRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetConsensusParamsResponse message. + * Verifies a GetContestedResourceVotersForIdentityRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetConsensusParamsResponse.verify = function verify(message) { + GetContestedResourceVotersForIdentityRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -19259,40 +31681,40 @@ $root.org = (function() { }; /** - * Creates a GetConsensusParamsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceVotersForIdentityRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} GetContestedResourceVotersForIdentityRequest */ - GetConsensusParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse) + GetContestedResourceVotersForIdentityRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetConsensusParamsResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceVotersForIdentityRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse} message GetConsensusParamsResponse + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} message GetContestedResourceVotersForIdentityRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetConsensusParamsResponse.toObject = function toObject(message, options) { + GetContestedResourceVotersForIdentityRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -19300,138 +31722,226 @@ $root.org = (function() { }; /** - * Converts this GetConsensusParamsResponse to JSON. + * Converts this GetContestedResourceVotersForIdentityRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest * @instance * @returns {Object.} JSON object */ - GetConsensusParamsResponse.prototype.toJSON = function toJSON() { + GetContestedResourceVotersForIdentityRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetConsensusParamsResponse.ConsensusParamsBlock = (function() { + GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 = (function() { /** - * Properties of a ConsensusParamsBlock. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @interface IConsensusParamsBlock - * @property {string|null} [maxBytes] ConsensusParamsBlock maxBytes - * @property {string|null} [maxGas] ConsensusParamsBlock maxGas - * @property {string|null} [timeIotaMs] ConsensusParamsBlock timeIotaMs + * Properties of a GetContestedResourceVotersForIdentityRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest + * @interface IGetContestedResourceVotersForIdentityRequestV0 + * @property {Uint8Array|null} [contractId] GetContestedResourceVotersForIdentityRequestV0 contractId + * @property {string|null} [documentTypeName] GetContestedResourceVotersForIdentityRequestV0 documentTypeName + * @property {string|null} [indexName] GetContestedResourceVotersForIdentityRequestV0 indexName + * @property {Array.|null} [indexValues] GetContestedResourceVotersForIdentityRequestV0 indexValues + * @property {Uint8Array|null} [contestantId] GetContestedResourceVotersForIdentityRequestV0 contestantId + * @property {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.IStartAtIdentifierInfo|null} [startAtIdentifierInfo] GetContestedResourceVotersForIdentityRequestV0 startAtIdentifierInfo + * @property {number|null} [count] GetContestedResourceVotersForIdentityRequestV0 count + * @property {boolean|null} [orderAscending] GetContestedResourceVotersForIdentityRequestV0 orderAscending + * @property {boolean|null} [prove] GetContestedResourceVotersForIdentityRequestV0 prove + */ + + /** + * Constructs a new GetContestedResourceVotersForIdentityRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest + * @classdesc Represents a GetContestedResourceVotersForIdentityRequestV0. + * @implements IGetContestedResourceVotersForIdentityRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.IGetContestedResourceVotersForIdentityRequestV0=} [properties] Properties to set + */ + function GetContestedResourceVotersForIdentityRequestV0(properties) { + this.indexValues = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetContestedResourceVotersForIdentityRequestV0 contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @instance + */ + GetContestedResourceVotersForIdentityRequestV0.prototype.contractId = $util.newBuffer([]); + + /** + * GetContestedResourceVotersForIdentityRequestV0 documentTypeName. + * @member {string} documentTypeName + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @instance + */ + GetContestedResourceVotersForIdentityRequestV0.prototype.documentTypeName = ""; + + /** + * GetContestedResourceVotersForIdentityRequestV0 indexName. + * @member {string} indexName + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @instance + */ + GetContestedResourceVotersForIdentityRequestV0.prototype.indexName = ""; + + /** + * GetContestedResourceVotersForIdentityRequestV0 indexValues. + * @member {Array.} indexValues + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @instance + */ + GetContestedResourceVotersForIdentityRequestV0.prototype.indexValues = $util.emptyArray; + + /** + * GetContestedResourceVotersForIdentityRequestV0 contestantId. + * @member {Uint8Array} contestantId + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @instance */ + GetContestedResourceVotersForIdentityRequestV0.prototype.contestantId = $util.newBuffer([]); /** - * Constructs a new ConsensusParamsBlock. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @classdesc Represents a ConsensusParamsBlock. - * @implements IConsensusParamsBlock - * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set + * GetContestedResourceVotersForIdentityRequestV0 startAtIdentifierInfo. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.IStartAtIdentifierInfo|null|undefined} startAtIdentifierInfo + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @instance */ - function ConsensusParamsBlock(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + GetContestedResourceVotersForIdentityRequestV0.prototype.startAtIdentifierInfo = null; /** - * ConsensusParamsBlock maxBytes. - * @member {string} maxBytes - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * GetContestedResourceVotersForIdentityRequestV0 count. + * @member {number} count + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @instance */ - ConsensusParamsBlock.prototype.maxBytes = ""; + GetContestedResourceVotersForIdentityRequestV0.prototype.count = 0; /** - * ConsensusParamsBlock maxGas. - * @member {string} maxGas - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * GetContestedResourceVotersForIdentityRequestV0 orderAscending. + * @member {boolean} orderAscending + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @instance */ - ConsensusParamsBlock.prototype.maxGas = ""; + GetContestedResourceVotersForIdentityRequestV0.prototype.orderAscending = false; /** - * ConsensusParamsBlock timeIotaMs. - * @member {string} timeIotaMs - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * GetContestedResourceVotersForIdentityRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @instance */ - ConsensusParamsBlock.prototype.timeIotaMs = ""; + GetContestedResourceVotersForIdentityRequestV0.prototype.prove = false; /** - * Creates a new ConsensusParamsBlock instance using the specified properties. + * Creates a new GetContestedResourceVotersForIdentityRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock instance + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.IGetContestedResourceVotersForIdentityRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} GetContestedResourceVotersForIdentityRequestV0 instance */ - ConsensusParamsBlock.create = function create(properties) { - return new ConsensusParamsBlock(properties); + GetContestedResourceVotersForIdentityRequestV0.create = function create(properties) { + return new GetContestedResourceVotersForIdentityRequestV0(properties); }; /** - * Encodes the specified ConsensusParamsBlock message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. + * Encodes the specified GetContestedResourceVotersForIdentityRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.IGetContestedResourceVotersForIdentityRequestV0} message GetContestedResourceVotersForIdentityRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConsensusParamsBlock.encode = function encode(message, writer) { + GetContestedResourceVotersForIdentityRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxBytes); - if (message.maxGas != null && Object.hasOwnProperty.call(message, "maxGas")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxGas); - if (message.timeIotaMs != null && Object.hasOwnProperty.call(message, "timeIotaMs")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.timeIotaMs); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + if (message.documentTypeName != null && Object.hasOwnProperty.call(message, "documentTypeName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentTypeName); + if (message.indexName != null && Object.hasOwnProperty.call(message, "indexName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.indexName); + if (message.indexValues != null && message.indexValues.length) + for (var i = 0; i < message.indexValues.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.indexValues[i]); + if (message.contestantId != null && Object.hasOwnProperty.call(message, "contestantId")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.contestantId); + if (message.startAtIdentifierInfo != null && Object.hasOwnProperty.call(message, "startAtIdentifierInfo")) + $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.encode(message.startAtIdentifierInfo, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.count); + if (message.orderAscending != null && Object.hasOwnProperty.call(message, "orderAscending")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.orderAscending); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.prove); return writer; }; /** - * Encodes the specified ConsensusParamsBlock message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. + * Encodes the specified GetContestedResourceVotersForIdentityRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.IGetContestedResourceVotersForIdentityRequestV0} message GetContestedResourceVotersForIdentityRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConsensusParamsBlock.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceVotersForIdentityRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ConsensusParamsBlock message from the specified reader or buffer. + * Decodes a GetContestedResourceVotersForIdentityRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} GetContestedResourceVotersForIdentityRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ConsensusParamsBlock.decode = function decode(reader, length) { + GetContestedResourceVotersForIdentityRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.maxBytes = reader.string(); + message.contractId = reader.bytes(); break; case 2: - message.maxGas = reader.string(); + message.documentTypeName = reader.string(); break; case 3: - message.timeIotaMs = reader.string(); + message.indexName = reader.string(); + break; + case 4: + if (!(message.indexValues && message.indexValues.length)) + message.indexValues = []; + message.indexValues.push(reader.bytes()); + break; + case 5: + message.contestantId = reader.bytes(); + break; + case 6: + message.startAtIdentifierInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.decode(reader, reader.uint32()); + break; + case 7: + message.count = reader.uint32(); + break; + case 8: + message.orderAscending = reader.bool(); + break; + case 9: + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -19442,357 +31952,643 @@ $root.org = (function() { }; /** - * Decodes a ConsensusParamsBlock message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceVotersForIdentityRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} GetContestedResourceVotersForIdentityRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ConsensusParamsBlock.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceVotersForIdentityRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ConsensusParamsBlock message. + * Verifies a GetContestedResourceVotersForIdentityRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ConsensusParamsBlock.verify = function verify(message) { + GetContestedResourceVotersForIdentityRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - if (!$util.isString(message.maxBytes)) - return "maxBytes: string expected"; - if (message.maxGas != null && message.hasOwnProperty("maxGas")) - if (!$util.isString(message.maxGas)) - return "maxGas: string expected"; - if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) - if (!$util.isString(message.timeIotaMs)) - return "timeIotaMs: string expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + if (!$util.isString(message.documentTypeName)) + return "documentTypeName: string expected"; + if (message.indexName != null && message.hasOwnProperty("indexName")) + if (!$util.isString(message.indexName)) + return "indexName: string expected"; + if (message.indexValues != null && message.hasOwnProperty("indexValues")) { + if (!Array.isArray(message.indexValues)) + return "indexValues: array expected"; + for (var i = 0; i < message.indexValues.length; ++i) + if (!(message.indexValues[i] && typeof message.indexValues[i].length === "number" || $util.isString(message.indexValues[i]))) + return "indexValues: buffer[] expected"; + } + if (message.contestantId != null && message.hasOwnProperty("contestantId")) + if (!(message.contestantId && typeof message.contestantId.length === "number" || $util.isString(message.contestantId))) + return "contestantId: buffer expected"; + if (message.startAtIdentifierInfo != null && message.hasOwnProperty("startAtIdentifierInfo")) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.verify(message.startAtIdentifierInfo); + if (error) + return "startAtIdentifierInfo." + error; + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + if (message.orderAscending != null && message.hasOwnProperty("orderAscending")) + if (typeof message.orderAscending !== "boolean") + return "orderAscending: boolean expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a ConsensusParamsBlock message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceVotersForIdentityRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} GetContestedResourceVotersForIdentityRequestV0 */ - ConsensusParamsBlock.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock) + GetContestedResourceVotersForIdentityRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); - if (object.maxBytes != null) - message.maxBytes = String(object.maxBytes); - if (object.maxGas != null) - message.maxGas = String(object.maxGas); - if (object.timeIotaMs != null) - message.timeIotaMs = String(object.timeIotaMs); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0(); + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentTypeName != null) + message.documentTypeName = String(object.documentTypeName); + if (object.indexName != null) + message.indexName = String(object.indexName); + if (object.indexValues) { + if (!Array.isArray(object.indexValues)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.indexValues: array expected"); + message.indexValues = []; + for (var i = 0; i < object.indexValues.length; ++i) + if (typeof object.indexValues[i] === "string") + $util.base64.decode(object.indexValues[i], message.indexValues[i] = $util.newBuffer($util.base64.length(object.indexValues[i])), 0); + else if (object.indexValues[i].length >= 0) + message.indexValues[i] = object.indexValues[i]; + } + if (object.contestantId != null) + if (typeof object.contestantId === "string") + $util.base64.decode(object.contestantId, message.contestantId = $util.newBuffer($util.base64.length(object.contestantId)), 0); + else if (object.contestantId.length >= 0) + message.contestantId = object.contestantId; + if (object.startAtIdentifierInfo != null) { + if (typeof object.startAtIdentifierInfo !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.startAtIdentifierInfo: object expected"); + message.startAtIdentifierInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.fromObject(object.startAtIdentifierInfo); + } + if (object.count != null) + message.count = object.count >>> 0; + if (object.orderAscending != null) + message.orderAscending = Boolean(object.orderAscending); + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a ConsensusParamsBlock message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceVotersForIdentityRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message ConsensusParamsBlock + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} message GetContestedResourceVotersForIdentityRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ConsensusParamsBlock.toObject = function toObject(message, options) { + GetContestedResourceVotersForIdentityRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.indexValues = []; if (options.defaults) { - object.maxBytes = ""; - object.maxGas = ""; - object.timeIotaMs = ""; + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + object.documentTypeName = ""; + object.indexName = ""; + if (options.bytes === String) + object.contestantId = ""; + else { + object.contestantId = []; + if (options.bytes !== Array) + object.contestantId = $util.newBuffer(object.contestantId); + } + object.startAtIdentifierInfo = null; + object.count = 0; + object.orderAscending = false; + object.prove = false; } - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - object.maxBytes = message.maxBytes; - if (message.maxGas != null && message.hasOwnProperty("maxGas")) - object.maxGas = message.maxGas; - if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) - object.timeIotaMs = message.timeIotaMs; + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + object.documentTypeName = message.documentTypeName; + if (message.indexName != null && message.hasOwnProperty("indexName")) + object.indexName = message.indexName; + if (message.indexValues && message.indexValues.length) { + object.indexValues = []; + for (var j = 0; j < message.indexValues.length; ++j) + object.indexValues[j] = options.bytes === String ? $util.base64.encode(message.indexValues[j], 0, message.indexValues[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.indexValues[j]) : message.indexValues[j]; + } + if (message.contestantId != null && message.hasOwnProperty("contestantId")) + object.contestantId = options.bytes === String ? $util.base64.encode(message.contestantId, 0, message.contestantId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contestantId) : message.contestantId; + if (message.startAtIdentifierInfo != null && message.hasOwnProperty("startAtIdentifierInfo")) + object.startAtIdentifierInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.toObject(message.startAtIdentifierInfo, options); + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; + if (message.orderAscending != null && message.hasOwnProperty("orderAscending")) + object.orderAscending = message.orderAscending; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; - /** - * Converts this ConsensusParamsBlock to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock - * @instance - * @returns {Object.} JSON object - */ - ConsensusParamsBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this GetContestedResourceVotersForIdentityRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetContestedResourceVotersForIdentityRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo = (function() { + + /** + * Properties of a StartAtIdentifierInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @interface IStartAtIdentifierInfo + * @property {Uint8Array|null} [startIdentifier] StartAtIdentifierInfo startIdentifier + * @property {boolean|null} [startIdentifierIncluded] StartAtIdentifierInfo startIdentifierIncluded + */ + + /** + * Constructs a new StartAtIdentifierInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 + * @classdesc Represents a StartAtIdentifierInfo. + * @implements IStartAtIdentifierInfo + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.IStartAtIdentifierInfo=} [properties] Properties to set + */ + function StartAtIdentifierInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StartAtIdentifierInfo startIdentifier. + * @member {Uint8Array} startIdentifier + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @instance + */ + StartAtIdentifierInfo.prototype.startIdentifier = $util.newBuffer([]); + + /** + * StartAtIdentifierInfo startIdentifierIncluded. + * @member {boolean} startIdentifierIncluded + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @instance + */ + StartAtIdentifierInfo.prototype.startIdentifierIncluded = false; + + /** + * Creates a new StartAtIdentifierInfo instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.IStartAtIdentifierInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo instance + */ + StartAtIdentifierInfo.create = function create(properties) { + return new StartAtIdentifierInfo(properties); + }; + + /** + * Encodes the specified StartAtIdentifierInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.IStartAtIdentifierInfo} message StartAtIdentifierInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtIdentifierInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startIdentifier != null && Object.hasOwnProperty.call(message, "startIdentifier")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startIdentifier); + if (message.startIdentifierIncluded != null && Object.hasOwnProperty.call(message, "startIdentifierIncluded")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.startIdentifierIncluded); + return writer; + }; + + /** + * Encodes the specified StartAtIdentifierInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.IStartAtIdentifierInfo} message StartAtIdentifierInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtIdentifierInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StartAtIdentifierInfo message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtIdentifierInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startIdentifier = reader.bytes(); + break; + case 2: + message.startIdentifierIncluded = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StartAtIdentifierInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtIdentifierInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StartAtIdentifierInfo message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StartAtIdentifierInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startIdentifier != null && message.hasOwnProperty("startIdentifier")) + if (!(message.startIdentifier && typeof message.startIdentifier.length === "number" || $util.isString(message.startIdentifier))) + return "startIdentifier: buffer expected"; + if (message.startIdentifierIncluded != null && message.hasOwnProperty("startIdentifierIncluded")) + if (typeof message.startIdentifierIncluded !== "boolean") + return "startIdentifierIncluded: boolean expected"; + return null; + }; + + /** + * Creates a StartAtIdentifierInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} StartAtIdentifierInfo + */ + StartAtIdentifierInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo(); + if (object.startIdentifier != null) + if (typeof object.startIdentifier === "string") + $util.base64.decode(object.startIdentifier, message.startIdentifier = $util.newBuffer($util.base64.length(object.startIdentifier)), 0); + else if (object.startIdentifier.length >= 0) + message.startIdentifier = object.startIdentifier; + if (object.startIdentifierIncluded != null) + message.startIdentifierIncluded = Boolean(object.startIdentifierIncluded); + return message; + }; + + /** + * Creates a plain object from a StartAtIdentifierInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} message StartAtIdentifierInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StartAtIdentifierInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.startIdentifier = ""; + else { + object.startIdentifier = []; + if (options.bytes !== Array) + object.startIdentifier = $util.newBuffer(object.startIdentifier); + } + object.startIdentifierIncluded = false; + } + if (message.startIdentifier != null && message.hasOwnProperty("startIdentifier")) + object.startIdentifier = options.bytes === String ? $util.base64.encode(message.startIdentifier, 0, message.startIdentifier.length) : options.bytes === Array ? Array.prototype.slice.call(message.startIdentifier) : message.startIdentifier; + if (message.startIdentifierIncluded != null && message.hasOwnProperty("startIdentifierIncluded")) + object.startIdentifierIncluded = message.startIdentifierIncluded; + return object; + }; + + /** + * Converts this StartAtIdentifierInfo to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo + * @instance + * @returns {Object.} JSON object + */ + StartAtIdentifierInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return ConsensusParamsBlock; - })(); + return StartAtIdentifierInfo; + })(); - GetConsensusParamsResponse.ConsensusParamsEvidence = (function() { + return GetContestedResourceVotersForIdentityRequestV0; + })(); - /** - * Properties of a ConsensusParamsEvidence. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @interface IConsensusParamsEvidence - * @property {string|null} [maxAgeNumBlocks] ConsensusParamsEvidence maxAgeNumBlocks - * @property {string|null} [maxAgeDuration] ConsensusParamsEvidence maxAgeDuration - * @property {string|null} [maxBytes] ConsensusParamsEvidence maxBytes - */ + return GetContestedResourceVotersForIdentityRequest; + })(); - /** - * Constructs a new ConsensusParamsEvidence. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @classdesc Represents a ConsensusParamsEvidence. - * @implements IConsensusParamsEvidence - * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set - */ - function ConsensusParamsEvidence(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v0.GetContestedResourceVotersForIdentityResponse = (function() { - /** - * ConsensusParamsEvidence maxAgeNumBlocks. - * @member {string} maxAgeNumBlocks - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @instance - */ - ConsensusParamsEvidence.prototype.maxAgeNumBlocks = ""; + /** + * Properties of a GetContestedResourceVotersForIdentityResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetContestedResourceVotersForIdentityResponse + * @property {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.IGetContestedResourceVotersForIdentityResponseV0|null} [v0] GetContestedResourceVotersForIdentityResponse v0 + */ - /** - * ConsensusParamsEvidence maxAgeDuration. - * @member {string} maxAgeDuration - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @instance - */ - ConsensusParamsEvidence.prototype.maxAgeDuration = ""; + /** + * Constructs a new GetContestedResourceVotersForIdentityResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetContestedResourceVotersForIdentityResponse. + * @implements IGetContestedResourceVotersForIdentityResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityResponse=} [properties] Properties to set + */ + function GetContestedResourceVotersForIdentityResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ConsensusParamsEvidence maxBytes. - * @member {string} maxBytes - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @instance - */ - ConsensusParamsEvidence.prototype.maxBytes = ""; + /** + * GetContestedResourceVotersForIdentityResponse v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.IGetContestedResourceVotersForIdentityResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @instance + */ + GetContestedResourceVotersForIdentityResponse.prototype.v0 = null; - /** - * Creates a new ConsensusParamsEvidence instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence instance - */ - ConsensusParamsEvidence.create = function create(properties) { - return new ConsensusParamsEvidence(properties); - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Encodes the specified ConsensusParamsEvidence message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusParamsEvidence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.maxAgeNumBlocks != null && Object.hasOwnProperty.call(message, "maxAgeNumBlocks")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxAgeNumBlocks); - if (message.maxAgeDuration != null && Object.hasOwnProperty.call(message, "maxAgeDuration")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxAgeDuration); - if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.maxBytes); - return writer; - }; + /** + * GetContestedResourceVotersForIdentityResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @instance + */ + Object.defineProperty(GetContestedResourceVotersForIdentityResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Encodes the specified ConsensusParamsEvidence message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusParamsEvidence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new GetContestedResourceVotersForIdentityResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} GetContestedResourceVotersForIdentityResponse instance + */ + GetContestedResourceVotersForIdentityResponse.create = function create(properties) { + return new GetContestedResourceVotersForIdentityResponse(properties); + }; - /** - * Decodes a ConsensusParamsEvidence message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusParamsEvidence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.maxAgeNumBlocks = reader.string(); - break; - case 2: - message.maxAgeDuration = reader.string(); - break; - case 3: - message.maxBytes = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified GetContestedResourceVotersForIdentityResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityResponse} message GetContestedResourceVotersForIdentityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetContestedResourceVotersForIdentityResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Decodes a ConsensusParamsEvidence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusParamsEvidence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified GetContestedResourceVotersForIdentityResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetContestedResourceVotersForIdentityResponse} message GetContestedResourceVotersForIdentityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetContestedResourceVotersForIdentityResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a ConsensusParamsEvidence message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConsensusParamsEvidence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) - if (!$util.isString(message.maxAgeNumBlocks)) - return "maxAgeNumBlocks: string expected"; - if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) - if (!$util.isString(message.maxAgeDuration)) - return "maxAgeDuration: string expected"; - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - if (!$util.isString(message.maxBytes)) - return "maxBytes: string expected"; - return null; - }; + /** + * Decodes a GetContestedResourceVotersForIdentityResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} GetContestedResourceVotersForIdentityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetContestedResourceVotersForIdentityResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a ConsensusParamsEvidence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence - */ - ConsensusParamsEvidence.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); - if (object.maxAgeNumBlocks != null) - message.maxAgeNumBlocks = String(object.maxAgeNumBlocks); - if (object.maxAgeDuration != null) - message.maxAgeDuration = String(object.maxAgeDuration); - if (object.maxBytes != null) - message.maxBytes = String(object.maxBytes); - return message; - }; + /** + * Decodes a GetContestedResourceVotersForIdentityResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} GetContestedResourceVotersForIdentityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetContestedResourceVotersForIdentityResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a ConsensusParamsEvidence message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message ConsensusParamsEvidence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusParamsEvidence.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.maxAgeNumBlocks = ""; - object.maxAgeDuration = ""; - object.maxBytes = ""; + /** + * Verifies a GetContestedResourceVotersForIdentityResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetContestedResourceVotersForIdentityResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.verify(message.v0); + if (error) + return "v0." + error; } - if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) - object.maxAgeNumBlocks = message.maxAgeNumBlocks; - if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) - object.maxAgeDuration = message.maxAgeDuration; - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - object.maxBytes = message.maxBytes; + } + return null; + }; + + /** + * Creates a GetContestedResourceVotersForIdentityResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} GetContestedResourceVotersForIdentityResponse + */ + GetContestedResourceVotersForIdentityResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.fromObject(object.v0); + } + return message; + }; - /** - * Converts this ConsensusParamsEvidence to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @instance - * @returns {Object.} JSON object - */ - ConsensusParamsEvidence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetContestedResourceVotersForIdentityResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} message GetContestedResourceVotersForIdentityResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetContestedResourceVotersForIdentityResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; - return ConsensusParamsEvidence; - })(); + /** + * Converts this GetContestedResourceVotersForIdentityResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @instance + * @returns {Object.} JSON object + */ + GetContestedResourceVotersForIdentityResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetConsensusParamsResponse.GetConsensusParamsResponseV0 = (function() { + GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 = (function() { /** - * Properties of a GetConsensusParamsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @interface IGetConsensusParamsResponseV0 - * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null} [block] GetConsensusParamsResponseV0 block - * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null} [evidence] GetConsensusParamsResponseV0 evidence + * Properties of a GetContestedResourceVotersForIdentityResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @interface IGetContestedResourceVotersForIdentityResponseV0 + * @property {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.IContestedResourceVoters|null} [contestedResourceVoters] GetContestedResourceVotersForIdentityResponseV0 contestedResourceVoters + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetContestedResourceVotersForIdentityResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetContestedResourceVotersForIdentityResponseV0 metadata */ /** - * Constructs a new GetConsensusParamsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @classdesc Represents a GetConsensusParamsResponseV0. - * @implements IGetConsensusParamsResponseV0 + * Constructs a new GetContestedResourceVotersForIdentityResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse + * @classdesc Represents a GetContestedResourceVotersForIdentityResponseV0. + * @implements IGetContestedResourceVotersForIdentityResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.IGetContestedResourceVotersForIdentityResponseV0=} [properties] Properties to set */ - function GetConsensusParamsResponseV0(properties) { + function GetContestedResourceVotersForIdentityResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19800,88 +32596,115 @@ $root.org = (function() { } /** - * GetConsensusParamsResponseV0 block. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null|undefined} block - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * GetContestedResourceVotersForIdentityResponseV0 contestedResourceVoters. + * @member {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.IContestedResourceVoters|null|undefined} contestedResourceVoters + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @instance */ - GetConsensusParamsResponseV0.prototype.block = null; + GetContestedResourceVotersForIdentityResponseV0.prototype.contestedResourceVoters = null; /** - * GetConsensusParamsResponseV0 evidence. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null|undefined} evidence - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * GetContestedResourceVotersForIdentityResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @instance */ - GetConsensusParamsResponseV0.prototype.evidence = null; + GetContestedResourceVotersForIdentityResponseV0.prototype.proof = null; /** - * Creates a new GetConsensusParamsResponseV0 instance using the specified properties. + * GetContestedResourceVotersForIdentityResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 + * @instance + */ + GetContestedResourceVotersForIdentityResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetContestedResourceVotersForIdentityResponseV0 result. + * @member {"contestedResourceVoters"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 + * @instance + */ + Object.defineProperty(GetContestedResourceVotersForIdentityResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["contestedResourceVoters", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetContestedResourceVotersForIdentityResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.IGetContestedResourceVotersForIdentityResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} GetContestedResourceVotersForIdentityResponseV0 instance */ - GetConsensusParamsResponseV0.create = function create(properties) { - return new GetConsensusParamsResponseV0(properties); + GetContestedResourceVotersForIdentityResponseV0.create = function create(properties) { + return new GetContestedResourceVotersForIdentityResponseV0(properties); }; /** - * Encodes the specified GetConsensusParamsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourceVotersForIdentityResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.IGetContestedResourceVotersForIdentityResponseV0} message GetContestedResourceVotersForIdentityResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsResponseV0.encode = function encode(message, writer) { + GetContestedResourceVotersForIdentityResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.contestedResourceVoters != null && Object.hasOwnProperty.call(message, "contestedResourceVoters")) + $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.encode(message.contestedResourceVoters, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetConsensusParamsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourceVotersForIdentityResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.IGetContestedResourceVotersForIdentityResponseV0} message GetContestedResourceVotersForIdentityResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceVotersForIdentityResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer. + * Decodes a GetContestedResourceVotersForIdentityResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} GetContestedResourceVotersForIdentityResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsResponseV0.decode = function decode(reader, length) { + GetContestedResourceVotersForIdentityResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.decode(reader, reader.uint32()); + message.contestedResourceVoters = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.decode(reader, reader.uint32()); break; case 2: - message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.decode(reader, reader.uint32()); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -19892,129 +32715,383 @@ $root.org = (function() { }; /** - * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceVotersForIdentityResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} GetContestedResourceVotersForIdentityResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceVotersForIdentityResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetConsensusParamsResponseV0 message. + * Verifies a GetContestedResourceVotersForIdentityResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetConsensusParamsResponseV0.verify = function verify(message) { + GetContestedResourceVotersForIdentityResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.block != null && message.hasOwnProperty("block")) { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify(message.block); - if (error) - return "block." + error; + var properties = {}; + if (message.contestedResourceVoters != null && message.hasOwnProperty("contestedResourceVoters")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.verify(message.contestedResourceVoters); + if (error) + return "contestedResourceVoters." + error; + } } - if (message.evidence != null && message.hasOwnProperty("evidence")) { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify(message.evidence); + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); if (error) - return "evidence." + error; + return "metadata." + error; } return null; }; /** - * Creates a GetConsensusParamsResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceVotersForIdentityResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} GetContestedResourceVotersForIdentityResponseV0 */ - GetConsensusParamsResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0) + GetContestedResourceVotersForIdentityResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); - if (object.block != null) { - if (typeof object.block !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.block: object expected"); - message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.fromObject(object.block); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0(); + if (object.contestedResourceVoters != null) { + if (typeof object.contestedResourceVoters !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.contestedResourceVoters: object expected"); + message.contestedResourceVoters = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.fromObject(object.contestedResourceVoters); } - if (object.evidence != null) { - if (typeof object.evidence !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.evidence: object expected"); - message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.fromObject(object.evidence); + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetConsensusParamsResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceVotersForIdentityResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} message GetContestedResourceVotersForIdentityResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetConsensusParamsResponseV0.toObject = function toObject(message, options) { + GetContestedResourceVotersForIdentityResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; - var object = {}; - if (options.defaults) { - object.block = null; - object.evidence = null; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.contestedResourceVoters != null && message.hasOwnProperty("contestedResourceVoters")) { + object.contestedResourceVoters = $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.toObject(message.contestedResourceVoters, options); + if (options.oneofs) + object.result = "contestedResourceVoters"; } - if (message.block != null && message.hasOwnProperty("block")) - object.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(message.block, options); - if (message.evidence != null && message.hasOwnProperty("evidence")) - object.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(message.evidence, options); + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this GetConsensusParamsResponseV0 to JSON. + * Converts this GetContestedResourceVotersForIdentityResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 * @instance * @returns {Object.} JSON object */ - GetConsensusParamsResponseV0.prototype.toJSON = function toJSON() { + GetContestedResourceVotersForIdentityResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetConsensusParamsResponseV0; + GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters = (function() { + + /** + * Properties of a ContestedResourceVoters. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 + * @interface IContestedResourceVoters + * @property {Array.|null} [voters] ContestedResourceVoters voters + * @property {boolean|null} [finishedResults] ContestedResourceVoters finishedResults + */ + + /** + * Constructs a new ContestedResourceVoters. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 + * @classdesc Represents a ContestedResourceVoters. + * @implements IContestedResourceVoters + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.IContestedResourceVoters=} [properties] Properties to set + */ + function ContestedResourceVoters(properties) { + this.voters = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContestedResourceVoters voters. + * @member {Array.} voters + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @instance + */ + ContestedResourceVoters.prototype.voters = $util.emptyArray; + + /** + * ContestedResourceVoters finishedResults. + * @member {boolean} finishedResults + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @instance + */ + ContestedResourceVoters.prototype.finishedResults = false; + + /** + * Creates a new ContestedResourceVoters instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.IContestedResourceVoters=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} ContestedResourceVoters instance + */ + ContestedResourceVoters.create = function create(properties) { + return new ContestedResourceVoters(properties); + }; + + /** + * Encodes the specified ContestedResourceVoters message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.IContestedResourceVoters} message ContestedResourceVoters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceVoters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.voters != null && message.voters.length) + for (var i = 0; i < message.voters.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.voters[i]); + if (message.finishedResults != null && Object.hasOwnProperty.call(message, "finishedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.finishedResults); + return writer; + }; + + /** + * Encodes the specified ContestedResourceVoters message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.IContestedResourceVoters} message ContestedResourceVoters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceVoters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContestedResourceVoters message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} ContestedResourceVoters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceVoters.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.voters && message.voters.length)) + message.voters = []; + message.voters.push(reader.bytes()); + break; + case 2: + message.finishedResults = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContestedResourceVoters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} ContestedResourceVoters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceVoters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContestedResourceVoters message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContestedResourceVoters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.voters != null && message.hasOwnProperty("voters")) { + if (!Array.isArray(message.voters)) + return "voters: array expected"; + for (var i = 0; i < message.voters.length; ++i) + if (!(message.voters[i] && typeof message.voters[i].length === "number" || $util.isString(message.voters[i]))) + return "voters: buffer[] expected"; + } + if (message.finishedResults != null && message.hasOwnProperty("finishedResults")) + if (typeof message.finishedResults !== "boolean") + return "finishedResults: boolean expected"; + return null; + }; + + /** + * Creates a ContestedResourceVoters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} ContestedResourceVoters + */ + ContestedResourceVoters.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters(); + if (object.voters) { + if (!Array.isArray(object.voters)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.voters: array expected"); + message.voters = []; + for (var i = 0; i < object.voters.length; ++i) + if (typeof object.voters[i] === "string") + $util.base64.decode(object.voters[i], message.voters[i] = $util.newBuffer($util.base64.length(object.voters[i])), 0); + else if (object.voters[i].length >= 0) + message.voters[i] = object.voters[i]; + } + if (object.finishedResults != null) + message.finishedResults = Boolean(object.finishedResults); + return message; + }; + + /** + * Creates a plain object from a ContestedResourceVoters message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} message ContestedResourceVoters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContestedResourceVoters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.voters = []; + if (options.defaults) + object.finishedResults = false; + if (message.voters && message.voters.length) { + object.voters = []; + for (var j = 0; j < message.voters.length; ++j) + object.voters[j] = options.bytes === String ? $util.base64.encode(message.voters[j], 0, message.voters[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.voters[j]) : message.voters[j]; + } + if (message.finishedResults != null && message.hasOwnProperty("finishedResults")) + object.finishedResults = message.finishedResults; + return object; + }; + + /** + * Converts this ContestedResourceVoters to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters + * @instance + * @returns {Object.} JSON object + */ + ContestedResourceVoters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ContestedResourceVoters; + })(); + + return GetContestedResourceVotersForIdentityResponseV0; })(); - return GetConsensusParamsResponse; + return GetContestedResourceVotersForIdentityResponse; })(); - v0.GetProtocolVersionUpgradeStateRequest = (function() { + v0.GetContestedResourceIdentityVotesRequest = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateRequest. + * Properties of a GetContestedResourceIdentityVotesRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeStateRequest - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null} [v0] GetProtocolVersionUpgradeStateRequest v0 + * @interface IGetContestedResourceIdentityVotesRequest + * @property {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.IGetContestedResourceIdentityVotesRequestV0|null} [v0] GetContestedResourceIdentityVotesRequest v0 */ /** - * Constructs a new GetProtocolVersionUpgradeStateRequest. + * Constructs a new GetContestedResourceIdentityVotesRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeStateRequest. - * @implements IGetProtocolVersionUpgradeStateRequest + * @classdesc Represents a GetContestedResourceIdentityVotesRequest. + * @implements IGetContestedResourceIdentityVotesRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesRequest=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateRequest(properties) { + function GetContestedResourceIdentityVotesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20022,89 +33099,89 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeStateRequest v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * GetContestedResourceIdentityVotesRequest v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.IGetContestedResourceIdentityVotesRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @instance */ - GetProtocolVersionUpgradeStateRequest.prototype.v0 = null; + GetContestedResourceIdentityVotesRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeStateRequest version. + * GetContestedResourceIdentityVotesRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeStateRequest.prototype, "version", { + Object.defineProperty(GetContestedResourceIdentityVotesRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeStateRequest instance using the specified properties. + * Creates a new GetContestedResourceIdentityVotesRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest instance + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} GetContestedResourceIdentityVotesRequest instance */ - GetProtocolVersionUpgradeStateRequest.create = function create(properties) { - return new GetProtocolVersionUpgradeStateRequest(properties); + GetContestedResourceIdentityVotesRequest.create = function create(properties) { + return new GetContestedResourceIdentityVotesRequest(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesRequest} message GetContestedResourceIdentityVotesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequest.encode = function encode(message, writer) { + GetContestedResourceIdentityVotesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesRequest} message GetContestedResourceIdentityVotesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceIdentityVotesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer. + * Decodes a GetContestedResourceIdentityVotesRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} GetContestedResourceIdentityVotesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequest.decode = function decode(reader, length) { + GetContestedResourceIdentityVotesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -20115,37 +33192,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceIdentityVotesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} GetContestedResourceIdentityVotesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequest.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceIdentityVotesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateRequest message. + * Verifies a GetContestedResourceIdentityVotesRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateRequest.verify = function verify(message) { + GetContestedResourceIdentityVotesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -20154,40 +33231,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceIdentityVotesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} GetContestedResourceIdentityVotesRequest */ - GetProtocolVersionUpgradeStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest) + GetContestedResourceIdentityVotesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeStateRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceIdentityVotesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} message GetContestedResourceIdentityVotesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeStateRequest.toObject = function toObject(message, options) { + GetContestedResourceIdentityVotesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -20195,34 +33272,39 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeStateRequest to JSON. + * Converts this GetContestedResourceIdentityVotesRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeStateRequest.prototype.toJSON = function toJSON() { + GetContestedResourceIdentityVotesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = (function() { + GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest - * @interface IGetProtocolVersionUpgradeStateRequestV0 - * @property {boolean|null} [prove] GetProtocolVersionUpgradeStateRequestV0 prove + * Properties of a GetContestedResourceIdentityVotesRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest + * @interface IGetContestedResourceIdentityVotesRequestV0 + * @property {Uint8Array|null} [identityId] GetContestedResourceIdentityVotesRequestV0 identityId + * @property {google.protobuf.IUInt32Value|null} [limit] GetContestedResourceIdentityVotesRequestV0 limit + * @property {google.protobuf.IUInt32Value|null} [offset] GetContestedResourceIdentityVotesRequestV0 offset + * @property {boolean|null} [orderAscending] GetContestedResourceIdentityVotesRequestV0 orderAscending + * @property {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.IStartAtVotePollIdInfo|null} [startAtVotePollIdInfo] GetContestedResourceIdentityVotesRequestV0 startAtVotePollIdInfo + * @property {boolean|null} [prove] GetContestedResourceIdentityVotesRequestV0 prove */ /** - * Constructs a new GetProtocolVersionUpgradeStateRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest - * @classdesc Represents a GetProtocolVersionUpgradeStateRequestV0. - * @implements IGetProtocolVersionUpgradeStateRequestV0 + * Constructs a new GetContestedResourceIdentityVotesRequestV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest + * @classdesc Represents a GetContestedResourceIdentityVotesRequestV0. + * @implements IGetContestedResourceIdentityVotesRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.IGetContestedResourceIdentityVotesRequestV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateRequestV0(properties) { + function GetContestedResourceIdentityVotesRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20230,74 +33312,139 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeStateRequestV0 prove. + * GetContestedResourceIdentityVotesRequestV0 identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 + * @instance + */ + GetContestedResourceIdentityVotesRequestV0.prototype.identityId = $util.newBuffer([]); + + /** + * GetContestedResourceIdentityVotesRequestV0 limit. + * @member {google.protobuf.IUInt32Value|null|undefined} limit + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 + * @instance + */ + GetContestedResourceIdentityVotesRequestV0.prototype.limit = null; + + /** + * GetContestedResourceIdentityVotesRequestV0 offset. + * @member {google.protobuf.IUInt32Value|null|undefined} offset + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 + * @instance + */ + GetContestedResourceIdentityVotesRequestV0.prototype.offset = null; + + /** + * GetContestedResourceIdentityVotesRequestV0 orderAscending. + * @member {boolean} orderAscending + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 + * @instance + */ + GetContestedResourceIdentityVotesRequestV0.prototype.orderAscending = false; + + /** + * GetContestedResourceIdentityVotesRequestV0 startAtVotePollIdInfo. + * @member {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.IStartAtVotePollIdInfo|null|undefined} startAtVotePollIdInfo + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 + * @instance + */ + GetContestedResourceIdentityVotesRequestV0.prototype.startAtVotePollIdInfo = null; + + /** + * GetContestedResourceIdentityVotesRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @instance */ - GetProtocolVersionUpgradeStateRequestV0.prototype.prove = false; + GetContestedResourceIdentityVotesRequestV0.prototype.prove = false; /** - * Creates a new GetProtocolVersionUpgradeStateRequestV0 instance using the specified properties. + * Creates a new GetContestedResourceIdentityVotesRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 instance - */ - GetProtocolVersionUpgradeStateRequestV0.create = function create(properties) { - return new GetProtocolVersionUpgradeStateRequestV0(properties); + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.IGetContestedResourceIdentityVotesRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} GetContestedResourceIdentityVotesRequestV0 instance + */ + GetContestedResourceIdentityVotesRequestV0.create = function create(properties) { + return new GetContestedResourceIdentityVotesRequestV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.IGetContestedResourceIdentityVotesRequestV0} message GetContestedResourceIdentityVotesRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequestV0.encode = function encode(message, writer) { + GetContestedResourceIdentityVotesRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + $root.google.protobuf.UInt32Value.encode(message.limit, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + $root.google.protobuf.UInt32Value.encode(message.offset, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.orderAscending != null && Object.hasOwnProperty.call(message, "orderAscending")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.orderAscending); + if (message.startAtVotePollIdInfo != null && Object.hasOwnProperty.call(message, "startAtVotePollIdInfo")) + $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.encode(message.startAtVotePollIdInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.prove); + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.prove); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.IGetContestedResourceIdentityVotesRequestV0} message GetContestedResourceIdentityVotesRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceIdentityVotesRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer. + * Decodes a GetContestedResourceIdentityVotesRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} GetContestedResourceIdentityVotesRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequestV0.decode = function decode(reader, length) { + GetContestedResourceIdentityVotesRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: + message.identityId = reader.bytes(); + break; + case 2: + message.limit = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + break; + case 3: + message.offset = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + break; + case 4: + message.orderAscending = reader.bool(); + break; + case 5: + message.startAtVotePollIdInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.decode(reader, reader.uint32()); + break; + case 6: message.prove = reader.bool(); break; default: @@ -20309,32 +33456,53 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceIdentityVotesRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} GetContestedResourceIdentityVotesRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceIdentityVotesRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateRequestV0 message. + * Verifies a GetContestedResourceIdentityVotesRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateRequestV0.verify = function verify(message) { + GetContestedResourceIdentityVotesRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; + if (message.limit != null && message.hasOwnProperty("limit")) { + var error = $root.google.protobuf.UInt32Value.verify(message.limit); + if (error) + return "limit." + error; + } + if (message.offset != null && message.hasOwnProperty("offset")) { + var error = $root.google.protobuf.UInt32Value.verify(message.offset); + if (error) + return "offset." + error; + } + if (message.orderAscending != null && message.hasOwnProperty("orderAscending")) + if (typeof message.orderAscending !== "boolean") + return "orderAscending: boolean expected"; + if (message.startAtVotePollIdInfo != null && message.hasOwnProperty("startAtVotePollIdInfo")) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.verify(message.startAtVotePollIdInfo); + if (error) + return "startAtVotePollIdInfo." + error; + } if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -20342,77 +33510,340 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceIdentityVotesRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} GetContestedResourceIdentityVotesRequestV0 */ - GetProtocolVersionUpgradeStateRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) + GetContestedResourceIdentityVotesRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; + if (object.limit != null) { + if (typeof object.limit !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.limit: object expected"); + message.limit = $root.google.protobuf.UInt32Value.fromObject(object.limit); + } + if (object.offset != null) { + if (typeof object.offset !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.offset: object expected"); + message.offset = $root.google.protobuf.UInt32Value.fromObject(object.offset); + } + if (object.orderAscending != null) + message.orderAscending = Boolean(object.orderAscending); + if (object.startAtVotePollIdInfo != null) { + if (typeof object.startAtVotePollIdInfo !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.startAtVotePollIdInfo: object expected"); + message.startAtVotePollIdInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.fromObject(object.startAtVotePollIdInfo); + } if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeStateRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceIdentityVotesRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} message GetContestedResourceIdentityVotesRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeStateRequestV0.toObject = function toObject(message, options) { + GetContestedResourceIdentityVotesRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { + if (options.bytes === String) + object.identityId = ""; + else { + object.identityId = []; + if (options.bytes !== Array) + object.identityId = $util.newBuffer(object.identityId); + } + object.limit = null; + object.offset = null; + object.orderAscending = false; + object.startAtVotePollIdInfo = null; object.prove = false; + } + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = $root.google.protobuf.UInt32Value.toObject(message.limit, options); + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = $root.google.protobuf.UInt32Value.toObject(message.offset, options); + if (message.orderAscending != null && message.hasOwnProperty("orderAscending")) + object.orderAscending = message.orderAscending; + if (message.startAtVotePollIdInfo != null && message.hasOwnProperty("startAtVotePollIdInfo")) + object.startAtVotePollIdInfo = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.toObject(message.startAtVotePollIdInfo, options); if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetProtocolVersionUpgradeStateRequestV0 to JSON. + * Converts this GetContestedResourceIdentityVotesRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeStateRequestV0.prototype.toJSON = function toJSON() { + GetContestedResourceIdentityVotesRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProtocolVersionUpgradeStateRequestV0; + GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo = (function() { + + /** + * Properties of a StartAtVotePollIdInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 + * @interface IStartAtVotePollIdInfo + * @property {Uint8Array|null} [startAtPollIdentifier] StartAtVotePollIdInfo startAtPollIdentifier + * @property {boolean|null} [startPollIdentifierIncluded] StartAtVotePollIdInfo startPollIdentifierIncluded + */ + + /** + * Constructs a new StartAtVotePollIdInfo. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 + * @classdesc Represents a StartAtVotePollIdInfo. + * @implements IStartAtVotePollIdInfo + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.IStartAtVotePollIdInfo=} [properties] Properties to set + */ + function StartAtVotePollIdInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StartAtVotePollIdInfo startAtPollIdentifier. + * @member {Uint8Array} startAtPollIdentifier + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @instance + */ + StartAtVotePollIdInfo.prototype.startAtPollIdentifier = $util.newBuffer([]); + + /** + * StartAtVotePollIdInfo startPollIdentifierIncluded. + * @member {boolean} startPollIdentifierIncluded + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @instance + */ + StartAtVotePollIdInfo.prototype.startPollIdentifierIncluded = false; + + /** + * Creates a new StartAtVotePollIdInfo instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.IStartAtVotePollIdInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} StartAtVotePollIdInfo instance + */ + StartAtVotePollIdInfo.create = function create(properties) { + return new StartAtVotePollIdInfo(properties); + }; + + /** + * Encodes the specified StartAtVotePollIdInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.IStartAtVotePollIdInfo} message StartAtVotePollIdInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtVotePollIdInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startAtPollIdentifier != null && Object.hasOwnProperty.call(message, "startAtPollIdentifier")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startAtPollIdentifier); + if (message.startPollIdentifierIncluded != null && Object.hasOwnProperty.call(message, "startPollIdentifierIncluded")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.startPollIdentifierIncluded); + return writer; + }; + + /** + * Encodes the specified StartAtVotePollIdInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.IStartAtVotePollIdInfo} message StartAtVotePollIdInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartAtVotePollIdInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StartAtVotePollIdInfo message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} StartAtVotePollIdInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtVotePollIdInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startAtPollIdentifier = reader.bytes(); + break; + case 2: + message.startPollIdentifierIncluded = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StartAtVotePollIdInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} StartAtVotePollIdInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartAtVotePollIdInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StartAtVotePollIdInfo message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StartAtVotePollIdInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startAtPollIdentifier != null && message.hasOwnProperty("startAtPollIdentifier")) + if (!(message.startAtPollIdentifier && typeof message.startAtPollIdentifier.length === "number" || $util.isString(message.startAtPollIdentifier))) + return "startAtPollIdentifier: buffer expected"; + if (message.startPollIdentifierIncluded != null && message.hasOwnProperty("startPollIdentifierIncluded")) + if (typeof message.startPollIdentifierIncluded !== "boolean") + return "startPollIdentifierIncluded: boolean expected"; + return null; + }; + + /** + * Creates a StartAtVotePollIdInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} StartAtVotePollIdInfo + */ + StartAtVotePollIdInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo(); + if (object.startAtPollIdentifier != null) + if (typeof object.startAtPollIdentifier === "string") + $util.base64.decode(object.startAtPollIdentifier, message.startAtPollIdentifier = $util.newBuffer($util.base64.length(object.startAtPollIdentifier)), 0); + else if (object.startAtPollIdentifier.length >= 0) + message.startAtPollIdentifier = object.startAtPollIdentifier; + if (object.startPollIdentifierIncluded != null) + message.startPollIdentifierIncluded = Boolean(object.startPollIdentifierIncluded); + return message; + }; + + /** + * Creates a plain object from a StartAtVotePollIdInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} message StartAtVotePollIdInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StartAtVotePollIdInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.startAtPollIdentifier = ""; + else { + object.startAtPollIdentifier = []; + if (options.bytes !== Array) + object.startAtPollIdentifier = $util.newBuffer(object.startAtPollIdentifier); + } + object.startPollIdentifierIncluded = false; + } + if (message.startAtPollIdentifier != null && message.hasOwnProperty("startAtPollIdentifier")) + object.startAtPollIdentifier = options.bytes === String ? $util.base64.encode(message.startAtPollIdentifier, 0, message.startAtPollIdentifier.length) : options.bytes === Array ? Array.prototype.slice.call(message.startAtPollIdentifier) : message.startAtPollIdentifier; + if (message.startPollIdentifierIncluded != null && message.hasOwnProperty("startPollIdentifierIncluded")) + object.startPollIdentifierIncluded = message.startPollIdentifierIncluded; + return object; + }; + + /** + * Converts this StartAtVotePollIdInfo to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo + * @instance + * @returns {Object.} JSON object + */ + StartAtVotePollIdInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StartAtVotePollIdInfo; + })(); + + return GetContestedResourceIdentityVotesRequestV0; })(); - return GetProtocolVersionUpgradeStateRequest; + return GetContestedResourceIdentityVotesRequest; })(); - v0.GetProtocolVersionUpgradeStateResponse = (function() { + v0.GetContestedResourceIdentityVotesResponse = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateResponse. + * Properties of a GetContestedResourceIdentityVotesResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeStateResponse - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null} [v0] GetProtocolVersionUpgradeStateResponse v0 + * @interface IGetContestedResourceIdentityVotesResponse + * @property {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.IGetContestedResourceIdentityVotesResponseV0|null} [v0] GetContestedResourceIdentityVotesResponse v0 */ /** - * Constructs a new GetProtocolVersionUpgradeStateResponse. + * Constructs a new GetContestedResourceIdentityVotesResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeStateResponse. - * @implements IGetProtocolVersionUpgradeStateResponse + * @classdesc Represents a GetContestedResourceIdentityVotesResponse. + * @implements IGetContestedResourceIdentityVotesResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesResponse=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateResponse(properties) { + function GetContestedResourceIdentityVotesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20420,89 +33851,89 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeStateResponse v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * GetContestedResourceIdentityVotesResponse v0. + * @member {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.IGetContestedResourceIdentityVotesResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @instance */ - GetProtocolVersionUpgradeStateResponse.prototype.v0 = null; + GetContestedResourceIdentityVotesResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeStateResponse version. + * GetContestedResourceIdentityVotesResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeStateResponse.prototype, "version", { + Object.defineProperty(GetContestedResourceIdentityVotesResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeStateResponse instance using the specified properties. + * Creates a new GetContestedResourceIdentityVotesResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse instance + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} GetContestedResourceIdentityVotesResponse instance */ - GetProtocolVersionUpgradeStateResponse.create = function create(properties) { - return new GetProtocolVersionUpgradeStateResponse(properties); + GetContestedResourceIdentityVotesResponse.create = function create(properties) { + return new GetContestedResourceIdentityVotesResponse(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesResponse} message GetContestedResourceIdentityVotesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponse.encode = function encode(message, writer) { + GetContestedResourceIdentityVotesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetContestedResourceIdentityVotesResponse} message GetContestedResourceIdentityVotesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceIdentityVotesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer. + * Decodes a GetContestedResourceIdentityVotesResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} GetContestedResourceIdentityVotesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponse.decode = function decode(reader, length) { + GetContestedResourceIdentityVotesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -20513,37 +33944,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceIdentityVotesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} GetContestedResourceIdentityVotesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponse.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceIdentityVotesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateResponse message. + * Verifies a GetContestedResourceIdentityVotesResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateResponse.verify = function verify(message) { + GetContestedResourceIdentityVotesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -20552,40 +33983,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceIdentityVotesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} GetContestedResourceIdentityVotesResponse */ - GetProtocolVersionUpgradeStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse) + GetContestedResourceIdentityVotesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeStateResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetContestedResourceIdentityVotesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} message GetContestedResourceIdentityVotesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeStateResponse.toObject = function toObject(message, options) { + GetContestedResourceIdentityVotesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -20593,36 +34024,36 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeStateResponse to JSON. + * Converts this GetContestedResourceIdentityVotesResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeStateResponse.prototype.toJSON = function toJSON() { + GetContestedResourceIdentityVotesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = (function() { + GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse - * @interface IGetProtocolVersionUpgradeStateResponseV0 - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null} [versions] GetProtocolVersionUpgradeStateResponseV0 versions - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeStateResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeStateResponseV0 metadata + * Properties of a GetContestedResourceIdentityVotesResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse + * @interface IGetContestedResourceIdentityVotesResponseV0 + * @property {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVotes|null} [votes] GetContestedResourceIdentityVotesResponseV0 votes + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetContestedResourceIdentityVotesResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetContestedResourceIdentityVotesResponseV0 metadata */ /** - * Constructs a new GetProtocolVersionUpgradeStateResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse - * @classdesc Represents a GetProtocolVersionUpgradeStateResponseV0. - * @implements IGetProtocolVersionUpgradeStateResponseV0 + * Constructs a new GetContestedResourceIdentityVotesResponseV0. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse + * @classdesc Represents a GetContestedResourceIdentityVotesResponseV0. + * @implements IGetContestedResourceIdentityVotesResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.IGetContestedResourceIdentityVotesResponseV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateResponseV0(properties) { + function GetContestedResourceIdentityVotesResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20630,69 +34061,69 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeStateResponseV0 versions. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null|undefined} versions - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * GetContestedResourceIdentityVotesResponseV0 votes. + * @member {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVotes|null|undefined} votes + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @instance */ - GetProtocolVersionUpgradeStateResponseV0.prototype.versions = null; + GetContestedResourceIdentityVotesResponseV0.prototype.votes = null; /** - * GetProtocolVersionUpgradeStateResponseV0 proof. + * GetContestedResourceIdentityVotesResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @instance */ - GetProtocolVersionUpgradeStateResponseV0.prototype.proof = null; + GetContestedResourceIdentityVotesResponseV0.prototype.proof = null; /** - * GetProtocolVersionUpgradeStateResponseV0 metadata. + * GetContestedResourceIdentityVotesResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @instance */ - GetProtocolVersionUpgradeStateResponseV0.prototype.metadata = null; + GetContestedResourceIdentityVotesResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeStateResponseV0 result. - * @member {"versions"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * GetContestedResourceIdentityVotesResponseV0 result. + * @member {"votes"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeStateResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["versions", "proof"]), + Object.defineProperty(GetContestedResourceIdentityVotesResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["votes", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeStateResponseV0 instance using the specified properties. + * Creates a new GetContestedResourceIdentityVotesResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.IGetContestedResourceIdentityVotesResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} GetContestedResourceIdentityVotesResponseV0 instance */ - GetProtocolVersionUpgradeStateResponseV0.create = function create(properties) { - return new GetProtocolVersionUpgradeStateResponseV0(properties); + GetContestedResourceIdentityVotesResponseV0.create = function create(properties) { + return new GetContestedResourceIdentityVotesResponseV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.IGetContestedResourceIdentityVotesResponseV0} message GetContestedResourceIdentityVotesResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponseV0.encode = function encode(message, writer) { + GetContestedResourceIdentityVotesResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.versions != null && Object.hasOwnProperty.call(message, "versions")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.votes != null && Object.hasOwnProperty.call(message, "votes")) + $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.encode(message.votes, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -20701,38 +34132,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. + * Encodes the specified GetContestedResourceIdentityVotesResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.IGetContestedResourceIdentityVotesResponseV0} message GetContestedResourceIdentityVotesResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetContestedResourceIdentityVotesResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer. + * Decodes a GetContestedResourceIdentityVotesResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} GetContestedResourceIdentityVotesResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponseV0.decode = function decode(reader, length) { + GetContestedResourceIdentityVotesResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.decode(reader, reader.uint32()); + message.votes = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.decode(reader, reader.uint32()); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -20749,39 +34180,39 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetContestedResourceIdentityVotesResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} GetContestedResourceIdentityVotesResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetContestedResourceIdentityVotesResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateResponseV0 message. + * Verifies a GetContestedResourceIdentityVotesResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateResponseV0.verify = function verify(message) { + GetContestedResourceIdentityVotesResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.versions != null && message.hasOwnProperty("versions")) { + if (message.votes != null && message.hasOwnProperty("votes")) { properties.result = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify(message.versions); + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.verify(message.votes); if (error) - return "versions." + error; + return "votes." + error; } } if (message.proof != null && message.hasOwnProperty("proof")) { @@ -20803,95 +34234,326 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetContestedResourceIdentityVotesResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} GetContestedResourceIdentityVotesResponseV0 */ - GetProtocolVersionUpgradeStateResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) + GetContestedResourceIdentityVotesResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0(); + if (object.votes != null) { + if (typeof object.votes !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.votes: object expected"); + message.votes = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.fromObject(object.votes); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetContestedResourceIdentityVotesResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} message GetContestedResourceIdentityVotesResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetContestedResourceIdentityVotesResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.votes != null && message.hasOwnProperty("votes")) { + object.votes = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.toObject(message.votes, options); + if (options.oneofs) + object.result = "votes"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetContestedResourceIdentityVotesResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetContestedResourceIdentityVotesResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes = (function() { + + /** + * Properties of a ContestedResourceIdentityVotes. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @interface IContestedResourceIdentityVotes + * @property {Array.|null} [contestedResourceIdentityVotes] ContestedResourceIdentityVotes contestedResourceIdentityVotes + * @property {boolean|null} [finishedResults] ContestedResourceIdentityVotes finishedResults + */ + + /** + * Constructs a new ContestedResourceIdentityVotes. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @classdesc Represents a ContestedResourceIdentityVotes. + * @implements IContestedResourceIdentityVotes + * @constructor + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVotes=} [properties] Properties to set + */ + function ContestedResourceIdentityVotes(properties) { + this.contestedResourceIdentityVotes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContestedResourceIdentityVotes contestedResourceIdentityVotes. + * @member {Array.} contestedResourceIdentityVotes + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @instance + */ + ContestedResourceIdentityVotes.prototype.contestedResourceIdentityVotes = $util.emptyArray; + + /** + * ContestedResourceIdentityVotes finishedResults. + * @member {boolean} finishedResults + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @instance + */ + ContestedResourceIdentityVotes.prototype.finishedResults = false; + + /** + * Creates a new ContestedResourceIdentityVotes instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVotes=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} ContestedResourceIdentityVotes instance + */ + ContestedResourceIdentityVotes.create = function create(properties) { + return new ContestedResourceIdentityVotes(properties); + }; + + /** + * Encodes the specified ContestedResourceIdentityVotes message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVotes} message ContestedResourceIdentityVotes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceIdentityVotes.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contestedResourceIdentityVotes != null && message.contestedResourceIdentityVotes.length) + for (var i = 0; i < message.contestedResourceIdentityVotes.length; ++i) + $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.encode(message.contestedResourceIdentityVotes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.finishedResults != null && Object.hasOwnProperty.call(message, "finishedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.finishedResults); + return writer; + }; + + /** + * Encodes the specified ContestedResourceIdentityVotes message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVotes} message ContestedResourceIdentityVotes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContestedResourceIdentityVotes.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContestedResourceIdentityVotes message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} ContestedResourceIdentityVotes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceIdentityVotes.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.contestedResourceIdentityVotes && message.contestedResourceIdentityVotes.length)) + message.contestedResourceIdentityVotes = []; + message.contestedResourceIdentityVotes.push($root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.decode(reader, reader.uint32())); + break; + case 2: + message.finishedResults = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContestedResourceIdentityVotes message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} ContestedResourceIdentityVotes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceIdentityVotes.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContestedResourceIdentityVotes message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContestedResourceIdentityVotes.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contestedResourceIdentityVotes != null && message.hasOwnProperty("contestedResourceIdentityVotes")) { + if (!Array.isArray(message.contestedResourceIdentityVotes)) + return "contestedResourceIdentityVotes: array expected"; + for (var i = 0; i < message.contestedResourceIdentityVotes.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.verify(message.contestedResourceIdentityVotes[i]); + if (error) + return "contestedResourceIdentityVotes." + error; + } + } + if (message.finishedResults != null && message.hasOwnProperty("finishedResults")) + if (typeof message.finishedResults !== "boolean") + return "finishedResults: boolean expected"; + return null; + }; + + /** + * Creates a ContestedResourceIdentityVotes message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} ContestedResourceIdentityVotes + */ + ContestedResourceIdentityVotes.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes(); + if (object.contestedResourceIdentityVotes) { + if (!Array.isArray(object.contestedResourceIdentityVotes)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.contestedResourceIdentityVotes: array expected"); + message.contestedResourceIdentityVotes = []; + for (var i = 0; i < object.contestedResourceIdentityVotes.length; ++i) { + if (typeof object.contestedResourceIdentityVotes[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.contestedResourceIdentityVotes: object expected"); + message.contestedResourceIdentityVotes[i] = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.fromObject(object.contestedResourceIdentityVotes[i]); + } + } + if (object.finishedResults != null) + message.finishedResults = Boolean(object.finishedResults); + return message; + }; + + /** + * Creates a plain object from a ContestedResourceIdentityVotes message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} message ContestedResourceIdentityVotes + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContestedResourceIdentityVotes.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contestedResourceIdentityVotes = []; + if (options.defaults) + object.finishedResults = false; + if (message.contestedResourceIdentityVotes && message.contestedResourceIdentityVotes.length) { + object.contestedResourceIdentityVotes = []; + for (var j = 0; j < message.contestedResourceIdentityVotes.length; ++j) + object.contestedResourceIdentityVotes[j] = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.toObject(message.contestedResourceIdentityVotes[j], options); + } + if (message.finishedResults != null && message.hasOwnProperty("finishedResults")) + object.finishedResults = message.finishedResults; return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); - if (object.versions != null) { - if (typeof object.versions !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.versions: object expected"); - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.fromObject(object.versions); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } - return message; - }; + }; - /** - * Creates a plain object from a GetProtocolVersionUpgradeStateResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProtocolVersionUpgradeStateResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.versions != null && message.hasOwnProperty("versions")) { - object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(message.versions, options); - if (options.oneofs) - object.result = "versions"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; - }; + /** + * Converts this ContestedResourceIdentityVotes to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes + * @instance + * @returns {Object.} JSON object + */ + ContestedResourceIdentityVotes.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetProtocolVersionUpgradeStateResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @instance - * @returns {Object.} JSON object - */ - GetProtocolVersionUpgradeStateResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return ContestedResourceIdentityVotes; + })(); - GetProtocolVersionUpgradeStateResponseV0.Versions = (function() { + GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice = (function() { /** - * Properties of a Versions. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @interface IVersions - * @property {Array.|null} [versions] Versions versions + * Properties of a ResourceVoteChoice. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @interface IResourceVoteChoice + * @property {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType|null} [voteChoiceType] ResourceVoteChoice voteChoiceType + * @property {Uint8Array|null} [identityId] ResourceVoteChoice identityId */ /** - * Constructs a new Versions. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @classdesc Represents a Versions. - * @implements IVersions + * Constructs a new ResourceVoteChoice. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @classdesc Represents a ResourceVoteChoice. + * @implements IResourceVoteChoice * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IResourceVoteChoice=} [properties] Properties to set */ - function Versions(properties) { - this.versions = []; + function ResourceVoteChoice(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20899,78 +34561,88 @@ $root.org = (function() { } /** - * Versions versions. - * @member {Array.} versions - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * ResourceVoteChoice voteChoiceType. + * @member {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} voteChoiceType + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @instance */ - Versions.prototype.versions = $util.emptyArray; + ResourceVoteChoice.prototype.voteChoiceType = 0; /** - * Creates a new Versions instance using the specified properties. + * ResourceVoteChoice identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice + * @instance + */ + ResourceVoteChoice.prototype.identityId = $util.newBuffer([]); + + /** + * Creates a new ResourceVoteChoice instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions instance + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IResourceVoteChoice=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} ResourceVoteChoice instance */ - Versions.create = function create(properties) { - return new Versions(properties); + ResourceVoteChoice.create = function create(properties) { + return new ResourceVoteChoice(properties); }; /** - * Encodes the specified Versions message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * Encodes the specified ResourceVoteChoice message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IResourceVoteChoice} message ResourceVoteChoice message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Versions.encode = function encode(message, writer) { + ResourceVoteChoice.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.versions != null && message.versions.length) - for (var i = 0; i < message.versions.length; ++i) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.encode(message.versions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.voteChoiceType != null && Object.hasOwnProperty.call(message, "voteChoiceType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.voteChoiceType); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.identityId); return writer; }; /** - * Encodes the specified Versions message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * Encodes the specified ResourceVoteChoice message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IResourceVoteChoice} message ResourceVoteChoice message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Versions.encodeDelimited = function encodeDelimited(message, writer) { + ResourceVoteChoice.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Versions message from the specified reader or buffer. + * Decodes a ResourceVoteChoice message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} ResourceVoteChoice * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Versions.decode = function decode(reader, length) { + ResourceVoteChoice.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.decode(reader, reader.uint32())); + message.voteChoiceType = reader.int32(); + break; + case 2: + message.identityId = reader.bytes(); break; default: reader.skipType(tag & 7); @@ -20981,125 +34653,163 @@ $root.org = (function() { }; /** - * Decodes a Versions message from the specified reader or buffer, length delimited. + * Decodes a ResourceVoteChoice message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} ResourceVoteChoice * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Versions.decodeDelimited = function decodeDelimited(reader) { + ResourceVoteChoice.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Versions message. + * Verifies a ResourceVoteChoice message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Versions.verify = function verify(message) { + ResourceVoteChoice.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.versions != null && message.hasOwnProperty("versions")) { - if (!Array.isArray(message.versions)) - return "versions: array expected"; - for (var i = 0; i < message.versions.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify(message.versions[i]); - if (error) - return "versions." + error; + if (message.voteChoiceType != null && message.hasOwnProperty("voteChoiceType")) + switch (message.voteChoiceType) { + default: + return "voteChoiceType: enum value expected"; + case 0: + case 1: + case 2: + break; } - } + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; return null; }; /** - * Creates a Versions message from a plain object. Also converts values to their respective internal types. + * Creates a ResourceVoteChoice message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} ResourceVoteChoice */ - Versions.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) + ResourceVoteChoice.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); - if (object.versions) { - if (!Array.isArray(object.versions)) - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: array expected"); - message.versions = []; - for (var i = 0; i < object.versions.length; ++i) { - if (typeof object.versions[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: object expected"); - message.versions[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.fromObject(object.versions[i]); - } + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice(); + switch (object.voteChoiceType) { + case "TOWARDS_IDENTITY": + case 0: + message.voteChoiceType = 0; + break; + case "ABSTAIN": + case 1: + message.voteChoiceType = 1; + break; + case "LOCK": + case 2: + message.voteChoiceType = 2; + break; } + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; return message; }; /** - * Creates a plain object from a Versions message. Also converts values to other types if specified. + * Creates a plain object from a ResourceVoteChoice message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message Versions + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} message ResourceVoteChoice * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Versions.toObject = function toObject(message, options) { + ResourceVoteChoice.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.versions = []; - if (message.versions && message.versions.length) { - object.versions = []; - for (var j = 0; j < message.versions.length; ++j) - object.versions[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(message.versions[j], options); + if (options.defaults) { + object.voteChoiceType = options.enums === String ? "TOWARDS_IDENTITY" : 0; + if (options.bytes === String) + object.identityId = ""; + else { + object.identityId = []; + if (options.bytes !== Array) + object.identityId = $util.newBuffer(object.identityId); + } } + if (message.voteChoiceType != null && message.hasOwnProperty("voteChoiceType")) + object.voteChoiceType = options.enums === String ? $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType[message.voteChoiceType] : message.voteChoiceType; + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; return object; }; /** - * Converts this Versions to JSON. + * Converts this ResourceVoteChoice to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice * @instance * @returns {Object.} JSON object */ - Versions.prototype.toJSON = function toJSON() { + ResourceVoteChoice.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Versions; + /** + * VoteChoiceType enum. + * @name org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType + * @enum {number} + * @property {number} TOWARDS_IDENTITY=0 TOWARDS_IDENTITY value + * @property {number} ABSTAIN=1 ABSTAIN value + * @property {number} LOCK=2 LOCK value + */ + ResourceVoteChoice.VoteChoiceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TOWARDS_IDENTITY"] = 0; + values[valuesById[1] = "ABSTAIN"] = 1; + values[valuesById[2] = "LOCK"] = 2; + return values; + })(); + + return ResourceVoteChoice; })(); - GetProtocolVersionUpgradeStateResponseV0.VersionEntry = (function() { + GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote = (function() { /** - * Properties of a VersionEntry. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @interface IVersionEntry - * @property {number|null} [versionNumber] VersionEntry versionNumber - * @property {number|null} [voteCount] VersionEntry voteCount + * Properties of a ContestedResourceIdentityVote. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @interface IContestedResourceIdentityVote + * @property {Uint8Array|null} [contractId] ContestedResourceIdentityVote contractId + * @property {string|null} [documentTypeName] ContestedResourceIdentityVote documentTypeName + * @property {Array.|null} [serializedIndexStorageValues] ContestedResourceIdentityVote serializedIndexStorageValues + * @property {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IResourceVoteChoice|null} [voteChoice] ContestedResourceIdentityVote voteChoice */ /** - * Constructs a new VersionEntry. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @classdesc Represents a VersionEntry. - * @implements IVersionEntry + * Constructs a new ContestedResourceIdentityVote. + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 + * @classdesc Represents a ContestedResourceIdentityVote. + * @implements IContestedResourceIdentityVote * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVote=} [properties] Properties to set */ - function VersionEntry(properties) { + function ContestedResourceIdentityVote(properties) { + this.serializedIndexStorageValues = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21107,88 +34817,117 @@ $root.org = (function() { } /** - * VersionEntry versionNumber. - * @member {number} versionNumber - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * ContestedResourceIdentityVote contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote * @instance */ - VersionEntry.prototype.versionNumber = 0; + ContestedResourceIdentityVote.prototype.contractId = $util.newBuffer([]); /** - * VersionEntry voteCount. - * @member {number} voteCount - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * ContestedResourceIdentityVote documentTypeName. + * @member {string} documentTypeName + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote * @instance */ - VersionEntry.prototype.voteCount = 0; + ContestedResourceIdentityVote.prototype.documentTypeName = ""; /** - * Creates a new VersionEntry instance using the specified properties. + * ContestedResourceIdentityVote serializedIndexStorageValues. + * @member {Array.} serializedIndexStorageValues + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote + * @instance + */ + ContestedResourceIdentityVote.prototype.serializedIndexStorageValues = $util.emptyArray; + + /** + * ContestedResourceIdentityVote voteChoice. + * @member {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IResourceVoteChoice|null|undefined} voteChoice + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote + * @instance + */ + ContestedResourceIdentityVote.prototype.voteChoice = null; + + /** + * Creates a new ContestedResourceIdentityVote instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry instance + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVote=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} ContestedResourceIdentityVote instance */ - VersionEntry.create = function create(properties) { - return new VersionEntry(properties); + ContestedResourceIdentityVote.create = function create(properties) { + return new ContestedResourceIdentityVote(properties); }; /** - * Encodes the specified VersionEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * Encodes the specified ContestedResourceIdentityVote message. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVote} message ContestedResourceIdentityVote message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionEntry.encode = function encode(message, writer) { + ContestedResourceIdentityVote.encode = function encode(message, writer) { if (!writer) - writer = $Writer.create(); - if (message.versionNumber != null && Object.hasOwnProperty.call(message, "versionNumber")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.versionNumber); - if (message.voteCount != null && Object.hasOwnProperty.call(message, "voteCount")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.voteCount); + writer = $Writer.create(); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.contractId); + if (message.documentTypeName != null && Object.hasOwnProperty.call(message, "documentTypeName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documentTypeName); + if (message.serializedIndexStorageValues != null && message.serializedIndexStorageValues.length) + for (var i = 0; i < message.serializedIndexStorageValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.serializedIndexStorageValues[i]); + if (message.voteChoice != null && Object.hasOwnProperty.call(message, "voteChoice")) + $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.encode(message.voteChoice, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified VersionEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * Encodes the specified ContestedResourceIdentityVote message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.IContestedResourceIdentityVote} message ContestedResourceIdentityVote message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionEntry.encodeDelimited = function encodeDelimited(message, writer) { + ContestedResourceIdentityVote.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a VersionEntry message from the specified reader or buffer. + * Decodes a ContestedResourceIdentityVote message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} ContestedResourceIdentityVote * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VersionEntry.decode = function decode(reader, length) { + ContestedResourceIdentityVote.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.versionNumber = reader.uint32(); + message.contractId = reader.bytes(); break; case 2: - message.voteCount = reader.uint32(); + message.documentTypeName = reader.string(); + break; + case 3: + if (!(message.serializedIndexStorageValues && message.serializedIndexStorageValues.length)) + message.serializedIndexStorageValues = []; + message.serializedIndexStorageValues.push(reader.bytes()); + break; + case 4: + message.voteChoice = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -21198,123 +34937,599 @@ $root.org = (function() { return message; }; - /** - * Decodes a VersionEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ContestedResourceIdentityVote message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} ContestedResourceIdentityVote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContestedResourceIdentityVote.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContestedResourceIdentityVote message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContestedResourceIdentityVote.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + if (!$util.isString(message.documentTypeName)) + return "documentTypeName: string expected"; + if (message.serializedIndexStorageValues != null && message.hasOwnProperty("serializedIndexStorageValues")) { + if (!Array.isArray(message.serializedIndexStorageValues)) + return "serializedIndexStorageValues: array expected"; + for (var i = 0; i < message.serializedIndexStorageValues.length; ++i) + if (!(message.serializedIndexStorageValues[i] && typeof message.serializedIndexStorageValues[i].length === "number" || $util.isString(message.serializedIndexStorageValues[i]))) + return "serializedIndexStorageValues: buffer[] expected"; + } + if (message.voteChoice != null && message.hasOwnProperty("voteChoice")) { + var error = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.verify(message.voteChoice); + if (error) + return "voteChoice." + error; + } + return null; + }; + + /** + * Creates a ContestedResourceIdentityVote message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} ContestedResourceIdentityVote + */ + ContestedResourceIdentityVote.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote(); + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentTypeName != null) + message.documentTypeName = String(object.documentTypeName); + if (object.serializedIndexStorageValues) { + if (!Array.isArray(object.serializedIndexStorageValues)) + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serializedIndexStorageValues: array expected"); + message.serializedIndexStorageValues = []; + for (var i = 0; i < object.serializedIndexStorageValues.length; ++i) + if (typeof object.serializedIndexStorageValues[i] === "string") + $util.base64.decode(object.serializedIndexStorageValues[i], message.serializedIndexStorageValues[i] = $util.newBuffer($util.base64.length(object.serializedIndexStorageValues[i])), 0); + else if (object.serializedIndexStorageValues[i].length >= 0) + message.serializedIndexStorageValues[i] = object.serializedIndexStorageValues[i]; + } + if (object.voteChoice != null) { + if (typeof object.voteChoice !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.voteChoice: object expected"); + message.voteChoice = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.fromObject(object.voteChoice); + } + return message; + }; + + /** + * Creates a plain object from a ContestedResourceIdentityVote message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote + * @static + * @param {org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} message ContestedResourceIdentityVote + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContestedResourceIdentityVote.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.serializedIndexStorageValues = []; + if (options.defaults) { + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + object.documentTypeName = ""; + object.voteChoice = null; + } + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + object.documentTypeName = message.documentTypeName; + if (message.serializedIndexStorageValues && message.serializedIndexStorageValues.length) { + object.serializedIndexStorageValues = []; + for (var j = 0; j < message.serializedIndexStorageValues.length; ++j) + object.serializedIndexStorageValues[j] = options.bytes === String ? $util.base64.encode(message.serializedIndexStorageValues[j], 0, message.serializedIndexStorageValues[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.serializedIndexStorageValues[j]) : message.serializedIndexStorageValues[j]; + } + if (message.voteChoice != null && message.hasOwnProperty("voteChoice")) + object.voteChoice = $root.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.toObject(message.voteChoice, options); + return object; + }; + + /** + * Converts this ContestedResourceIdentityVote to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote + * @instance + * @returns {Object.} JSON object + */ + ContestedResourceIdentityVote.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ContestedResourceIdentityVote; + })(); + + return GetContestedResourceIdentityVotesResponseV0; + })(); + + return GetContestedResourceIdentityVotesResponse; + })(); + + v0.GetPrefundedSpecializedBalanceRequest = (function() { + + /** + * Properties of a GetPrefundedSpecializedBalanceRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetPrefundedSpecializedBalanceRequest + * @property {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.IGetPrefundedSpecializedBalanceRequestV0|null} [v0] GetPrefundedSpecializedBalanceRequest v0 + */ + + /** + * Constructs a new GetPrefundedSpecializedBalanceRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetPrefundedSpecializedBalanceRequest. + * @implements IGetPrefundedSpecializedBalanceRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceRequest=} [properties] Properties to set + */ + function GetPrefundedSpecializedBalanceRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetPrefundedSpecializedBalanceRequest v0. + * @member {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.IGetPrefundedSpecializedBalanceRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @instance + */ + GetPrefundedSpecializedBalanceRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetPrefundedSpecializedBalanceRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @instance + */ + Object.defineProperty(GetPrefundedSpecializedBalanceRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetPrefundedSpecializedBalanceRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} GetPrefundedSpecializedBalanceRequest instance + */ + GetPrefundedSpecializedBalanceRequest.create = function create(properties) { + return new GetPrefundedSpecializedBalanceRequest(properties); + }; + + /** + * Encodes the specified GetPrefundedSpecializedBalanceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceRequest} message GetPrefundedSpecializedBalanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPrefundedSpecializedBalanceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetPrefundedSpecializedBalanceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceRequest} message GetPrefundedSpecializedBalanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPrefundedSpecializedBalanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetPrefundedSpecializedBalanceRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} GetPrefundedSpecializedBalanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPrefundedSpecializedBalanceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetPrefundedSpecializedBalanceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} GetPrefundedSpecializedBalanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPrefundedSpecializedBalanceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetPrefundedSpecializedBalanceRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetPrefundedSpecializedBalanceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetPrefundedSpecializedBalanceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} GetPrefundedSpecializedBalanceRequest + */ + GetPrefundedSpecializedBalanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetPrefundedSpecializedBalanceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @static + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} message GetPrefundedSpecializedBalanceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPrefundedSpecializedBalanceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetPrefundedSpecializedBalanceRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @instance + * @returns {Object.} JSON object + */ + GetPrefundedSpecializedBalanceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 = (function() { + + /** + * Properties of a GetPrefundedSpecializedBalanceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @interface IGetPrefundedSpecializedBalanceRequestV0 + * @property {Uint8Array|null} [id] GetPrefundedSpecializedBalanceRequestV0 id + * @property {boolean|null} [prove] GetPrefundedSpecializedBalanceRequestV0 prove + */ + + /** + * Constructs a new GetPrefundedSpecializedBalanceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest + * @classdesc Represents a GetPrefundedSpecializedBalanceRequestV0. + * @implements IGetPrefundedSpecializedBalanceRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.IGetPrefundedSpecializedBalanceRequestV0=} [properties] Properties to set + */ + function GetPrefundedSpecializedBalanceRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetPrefundedSpecializedBalanceRequestV0 id. + * @member {Uint8Array} id + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @instance + */ + GetPrefundedSpecializedBalanceRequestV0.prototype.id = $util.newBuffer([]); - /** - * Verifies a VersionEntry message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VersionEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) - if (!$util.isInteger(message.versionNumber)) - return "versionNumber: integer expected"; - if (message.voteCount != null && message.hasOwnProperty("voteCount")) - if (!$util.isInteger(message.voteCount)) - return "voteCount: integer expected"; - return null; - }; + /** + * GetPrefundedSpecializedBalanceRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @instance + */ + GetPrefundedSpecializedBalanceRequestV0.prototype.prove = false; - /** - * Creates a VersionEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry - */ - VersionEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); - if (object.versionNumber != null) - message.versionNumber = object.versionNumber >>> 0; - if (object.voteCount != null) - message.voteCount = object.voteCount >>> 0; - return message; - }; + /** + * Creates a new GetPrefundedSpecializedBalanceRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.IGetPrefundedSpecializedBalanceRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} GetPrefundedSpecializedBalanceRequestV0 instance + */ + GetPrefundedSpecializedBalanceRequestV0.create = function create(properties) { + return new GetPrefundedSpecializedBalanceRequestV0(properties); + }; - /** - * Creates a plain object from a VersionEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message VersionEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VersionEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.versionNumber = 0; - object.voteCount = 0; + /** + * Encodes the specified GetPrefundedSpecializedBalanceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.IGetPrefundedSpecializedBalanceRequestV0} message GetPrefundedSpecializedBalanceRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPrefundedSpecializedBalanceRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetPrefundedSpecializedBalanceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.IGetPrefundedSpecializedBalanceRequestV0} message GetPrefundedSpecializedBalanceRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPrefundedSpecializedBalanceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetPrefundedSpecializedBalanceRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} GetPrefundedSpecializedBalanceRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPrefundedSpecializedBalanceRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.bytes(); + break; + case 2: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) - object.versionNumber = message.versionNumber; - if (message.voteCount != null && message.hasOwnProperty("voteCount")) - object.voteCount = message.voteCount; + } + return message; + }; + + /** + * Decodes a GetPrefundedSpecializedBalanceRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} GetPrefundedSpecializedBalanceRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPrefundedSpecializedBalanceRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetPrefundedSpecializedBalanceRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetPrefundedSpecializedBalanceRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetPrefundedSpecializedBalanceRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} GetPrefundedSpecializedBalanceRequestV0 + */ + GetPrefundedSpecializedBalanceRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length >= 0) + message.id = object.id; + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; - /** - * Converts this VersionEntry to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry - * @instance - * @returns {Object.} JSON object - */ - VersionEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetPrefundedSpecializedBalanceRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} message GetPrefundedSpecializedBalanceRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPrefundedSpecializedBalanceRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.id = ""; + else { + object.id = []; + if (options.bytes !== Array) + object.id = $util.newBuffer(object.id); + } + object.prove = false; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; - return VersionEntry; - })(); + /** + * Converts this GetPrefundedSpecializedBalanceRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetPrefundedSpecializedBalanceRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GetProtocolVersionUpgradeStateResponseV0; + return GetPrefundedSpecializedBalanceRequestV0; })(); - return GetProtocolVersionUpgradeStateResponse; + return GetPrefundedSpecializedBalanceRequest; })(); - v0.GetProtocolVersionUpgradeVoteStatusRequest = (function() { + v0.GetPrefundedSpecializedBalanceResponse = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusRequest. + * Properties of a GetPrefundedSpecializedBalanceResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeVoteStatusRequest - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null} [v0] GetProtocolVersionUpgradeVoteStatusRequest v0 + * @interface IGetPrefundedSpecializedBalanceResponse + * @property {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.IGetPrefundedSpecializedBalanceResponseV0|null} [v0] GetPrefundedSpecializedBalanceResponse v0 */ /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusRequest. + * Constructs a new GetPrefundedSpecializedBalanceResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequest. - * @implements IGetProtocolVersionUpgradeVoteStatusRequest + * @classdesc Represents a GetPrefundedSpecializedBalanceResponse. + * @implements IGetPrefundedSpecializedBalanceResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceResponse=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusRequest(properties) { + function GetPrefundedSpecializedBalanceResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21322,89 +35537,89 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusRequest v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * GetPrefundedSpecializedBalanceResponse v0. + * @member {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.IGetPrefundedSpecializedBalanceResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @instance */ - GetProtocolVersionUpgradeVoteStatusRequest.prototype.v0 = null; + GetPrefundedSpecializedBalanceResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeVoteStatusRequest version. + * GetPrefundedSpecializedBalanceResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeVoteStatusRequest.prototype, "version", { + Object.defineProperty(GetPrefundedSpecializedBalanceResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeVoteStatusRequest instance using the specified properties. + * Creates a new GetPrefundedSpecializedBalanceResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest instance + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} GetPrefundedSpecializedBalanceResponse instance */ - GetProtocolVersionUpgradeVoteStatusRequest.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusRequest(properties); + GetPrefundedSpecializedBalanceResponse.create = function create(properties) { + return new GetPrefundedSpecializedBalanceResponse(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. + * Encodes the specified GetPrefundedSpecializedBalanceResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceResponse} message GetPrefundedSpecializedBalanceResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequest.encode = function encode(message, writer) { + GetPrefundedSpecializedBalanceResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. + * Encodes the specified GetPrefundedSpecializedBalanceResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPrefundedSpecializedBalanceResponse} message GetPrefundedSpecializedBalanceResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetPrefundedSpecializedBalanceResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer. + * Decodes a GetPrefundedSpecializedBalanceResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} GetPrefundedSpecializedBalanceResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequest.decode = function decode(reader, length) { + GetPrefundedSpecializedBalanceResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -21415,37 +35630,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer, length delimited. + * Decodes a GetPrefundedSpecializedBalanceResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} GetPrefundedSpecializedBalanceResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequest.decodeDelimited = function decodeDelimited(reader) { + GetPrefundedSpecializedBalanceResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusRequest message. + * Verifies a GetPrefundedSpecializedBalanceResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusRequest.verify = function verify(message) { + GetPrefundedSpecializedBalanceResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -21454,40 +35669,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetPrefundedSpecializedBalanceResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} GetPrefundedSpecializedBalanceResponse */ - GetProtocolVersionUpgradeVoteStatusRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest) + GetPrefundedSpecializedBalanceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetPrefundedSpecializedBalanceResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} message GetPrefundedSpecializedBalanceResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusRequest.toObject = function toObject(message, options) { + GetPrefundedSpecializedBalanceResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -21495,36 +35710,36 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusRequest to JSON. + * Converts this GetPrefundedSpecializedBalanceResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusRequest.prototype.toJSON = function toJSON() { + GetPrefundedSpecializedBalanceResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = (function() { + GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest - * @interface IGetProtocolVersionUpgradeVoteStatusRequestV0 - * @property {Uint8Array|null} [startProTxHash] GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash - * @property {number|null} [count] GetProtocolVersionUpgradeVoteStatusRequestV0 count - * @property {boolean|null} [prove] GetProtocolVersionUpgradeVoteStatusRequestV0 prove + * Properties of a GetPrefundedSpecializedBalanceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse + * @interface IGetPrefundedSpecializedBalanceResponseV0 + * @property {number|Long|null} [balance] GetPrefundedSpecializedBalanceResponseV0 balance + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetPrefundedSpecializedBalanceResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetPrefundedSpecializedBalanceResponseV0 metadata */ /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequestV0. - * @implements IGetProtocolVersionUpgradeVoteStatusRequestV0 + * Constructs a new GetPrefundedSpecializedBalanceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse + * @classdesc Represents a GetPrefundedSpecializedBalanceResponseV0. + * @implements IGetPrefundedSpecializedBalanceResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.IGetPrefundedSpecializedBalanceResponseV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusRequestV0(properties) { + function GetPrefundedSpecializedBalanceResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21532,101 +35747,115 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash. - * @member {Uint8Array} startProTxHash - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * GetPrefundedSpecializedBalanceResponseV0 balance. + * @member {number|Long} balance + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.startProTxHash = $util.newBuffer([]); + GetPrefundedSpecializedBalanceResponseV0.prototype.balance = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * GetProtocolVersionUpgradeVoteStatusRequestV0 count. - * @member {number} count - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * GetPrefundedSpecializedBalanceResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.count = 0; + GetPrefundedSpecializedBalanceResponseV0.prototype.proof = null; /** - * GetProtocolVersionUpgradeVoteStatusRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * GetPrefundedSpecializedBalanceResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.prove = false; + GetPrefundedSpecializedBalanceResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new GetProtocolVersionUpgradeVoteStatusRequestV0 instance using the specified properties. + * GetPrefundedSpecializedBalanceResponseV0 result. + * @member {"balance"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 + * @instance + */ + Object.defineProperty(GetPrefundedSpecializedBalanceResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["balance", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetPrefundedSpecializedBalanceResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.IGetPrefundedSpecializedBalanceResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} GetPrefundedSpecializedBalanceResponseV0 instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusRequestV0(properties); + GetPrefundedSpecializedBalanceResponseV0.create = function create(properties) { + return new GetPrefundedSpecializedBalanceResponseV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. + * Encodes the specified GetPrefundedSpecializedBalanceResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.IGetPrefundedSpecializedBalanceResponseV0} message GetPrefundedSpecializedBalanceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequestV0.encode = function encode(message, writer) { + GetPrefundedSpecializedBalanceResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startProTxHash != null && Object.hasOwnProperty.call(message, "startProTxHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startProTxHash); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.count); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); + if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.balance); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. + * Encodes the specified GetPrefundedSpecializedBalanceResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.IGetPrefundedSpecializedBalanceResponseV0} message GetPrefundedSpecializedBalanceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetPrefundedSpecializedBalanceResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer. + * Decodes a GetPrefundedSpecializedBalanceResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} GetPrefundedSpecializedBalanceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequestV0.decode = function decode(reader, length) { + GetPrefundedSpecializedBalanceResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.startProTxHash = reader.bytes(); + message.balance = reader.uint64(); break; case 2: - message.count = reader.uint32(); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); break; case 3: - message.prove = reader.bool(); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -21637,136 +35866,158 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetPrefundedSpecializedBalanceResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} GetPrefundedSpecializedBalanceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetPrefundedSpecializedBalanceResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusRequestV0 message. + * Verifies a GetPrefundedSpecializedBalanceResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusRequestV0.verify = function verify(message) { + GetPrefundedSpecializedBalanceResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) - if (!(message.startProTxHash && typeof message.startProTxHash.length === "number" || $util.isString(message.startProTxHash))) - return "startProTxHash: buffer expected"; - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count)) - return "count: integer expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; + var properties = {}; + if (message.balance != null && message.hasOwnProperty("balance")) { + properties.result = 1; + if (!$util.isInteger(message.balance) && !(message.balance && $util.isInteger(message.balance.low) && $util.isInteger(message.balance.high))) + return "balance: integer|Long expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } return null; }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetPrefundedSpecializedBalanceResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} GetPrefundedSpecializedBalanceResponseV0 */ - GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) + GetPrefundedSpecializedBalanceResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); - if (object.startProTxHash != null) - if (typeof object.startProTxHash === "string") - $util.base64.decode(object.startProTxHash, message.startProTxHash = $util.newBuffer($util.base64.length(object.startProTxHash)), 0); - else if (object.startProTxHash.length >= 0) - message.startProTxHash = object.startProTxHash; - if (object.count != null) - message.count = object.count >>> 0; - if (object.prove != null) - message.prove = Boolean(object.prove); + var message = new $root.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0(); + if (object.balance != null) + if ($util.Long) + (message.balance = $util.Long.fromValue(object.balance)).unsigned = true; + else if (typeof object.balance === "string") + message.balance = parseInt(object.balance, 10); + else if (typeof object.balance === "number") + message.balance = object.balance; + else if (typeof object.balance === "object") + message.balance = new $util.LongBits(object.balance.low >>> 0, object.balance.high >>> 0).toNumber(true); + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetPrefundedSpecializedBalanceResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 + * @param {org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} message GetPrefundedSpecializedBalanceResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function toObject(message, options) { + GetPrefundedSpecializedBalanceResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.startProTxHash = ""; - else { - object.startProTxHash = []; - if (options.bytes !== Array) - object.startProTxHash = $util.newBuffer(object.startProTxHash); - } - object.count = 0; - object.prove = false; + if (options.defaults) + object.metadata = null; + if (message.balance != null && message.hasOwnProperty("balance")) { + if (typeof message.balance === "number") + object.balance = options.longs === String ? String(message.balance) : message.balance; + else + object.balance = options.longs === String ? $util.Long.prototype.toString.call(message.balance) : options.longs === Number ? new $util.LongBits(message.balance.low >>> 0, message.balance.high >>> 0).toNumber(true) : message.balance; + if (options.oneofs) + object.result = "balance"; } - if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) - object.startProTxHash = options.bytes === String ? $util.base64.encode(message.startProTxHash, 0, message.startProTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.startProTxHash) : message.startProTxHash; - if (message.count != null && message.hasOwnProperty("count")) - object.count = message.count; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusRequestV0 to JSON. + * Converts this GetPrefundedSpecializedBalanceResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toJSON = function toJSON() { + GetPrefundedSpecializedBalanceResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProtocolVersionUpgradeVoteStatusRequestV0; + return GetPrefundedSpecializedBalanceResponseV0; })(); - return GetProtocolVersionUpgradeVoteStatusRequest; + return GetPrefundedSpecializedBalanceResponse; })(); - v0.GetProtocolVersionUpgradeVoteStatusResponse = (function() { + v0.GetTotalCreditsInPlatformRequest = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusResponse. + * Properties of a GetTotalCreditsInPlatformRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeVoteStatusResponse - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null} [v0] GetProtocolVersionUpgradeVoteStatusResponse v0 + * @interface IGetTotalCreditsInPlatformRequest + * @property {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.IGetTotalCreditsInPlatformRequestV0|null} [v0] GetTotalCreditsInPlatformRequest v0 */ /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusResponse. + * Constructs a new GetTotalCreditsInPlatformRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponse. - * @implements IGetProtocolVersionUpgradeVoteStatusResponse + * @classdesc Represents a GetTotalCreditsInPlatformRequest. + * @implements IGetTotalCreditsInPlatformRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformRequest=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusResponse(properties) { + function GetTotalCreditsInPlatformRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21774,89 +36025,89 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusResponse v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * GetTotalCreditsInPlatformRequest v0. + * @member {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.IGetTotalCreditsInPlatformRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @instance */ - GetProtocolVersionUpgradeVoteStatusResponse.prototype.v0 = null; + GetTotalCreditsInPlatformRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeVoteStatusResponse version. + * GetTotalCreditsInPlatformRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponse.prototype, "version", { + Object.defineProperty(GetTotalCreditsInPlatformRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeVoteStatusResponse instance using the specified properties. + * Creates a new GetTotalCreditsInPlatformRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse instance + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} GetTotalCreditsInPlatformRequest instance */ - GetProtocolVersionUpgradeVoteStatusResponse.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusResponse(properties); + GetTotalCreditsInPlatformRequest.create = function create(properties) { + return new GetTotalCreditsInPlatformRequest(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. + * Encodes the specified GetTotalCreditsInPlatformRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformRequest} message GetTotalCreditsInPlatformRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponse.encode = function encode(message, writer) { + GetTotalCreditsInPlatformRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. + * Encodes the specified GetTotalCreditsInPlatformRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformRequest} message GetTotalCreditsInPlatformRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetTotalCreditsInPlatformRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer. + * Decodes a GetTotalCreditsInPlatformRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} GetTotalCreditsInPlatformRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponse.decode = function decode(reader, length) { + GetTotalCreditsInPlatformRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -21867,37 +36118,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer, length delimited. + * Decodes a GetTotalCreditsInPlatformRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} GetTotalCreditsInPlatformRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponse.decodeDelimited = function decodeDelimited(reader) { + GetTotalCreditsInPlatformRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusResponse message. + * Verifies a GetTotalCreditsInPlatformRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusResponse.verify = function verify(message) { + GetTotalCreditsInPlatformRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -21906,40 +36157,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetTotalCreditsInPlatformRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} GetTotalCreditsInPlatformRequest */ - GetProtocolVersionUpgradeVoteStatusResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse) + GetTotalCreditsInPlatformRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetTotalCreditsInPlatformRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} message GetTotalCreditsInPlatformRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusResponse.toObject = function toObject(message, options) { + GetTotalCreditsInPlatformRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -21947,36 +36198,34 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusResponse to JSON. + * Converts this GetTotalCreditsInPlatformRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusResponse.prototype.toJSON = function toJSON() { + GetTotalCreditsInPlatformRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = (function() { + GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse - * @interface IGetProtocolVersionUpgradeVoteStatusResponseV0 - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null} [versions] GetProtocolVersionUpgradeVoteStatusResponseV0 versions - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeVoteStatusResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeVoteStatusResponseV0 metadata + * Properties of a GetTotalCreditsInPlatformRequestV0. + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest + * @interface IGetTotalCreditsInPlatformRequestV0 + * @property {boolean|null} [prove] GetTotalCreditsInPlatformRequestV0 prove */ /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponseV0. - * @implements IGetProtocolVersionUpgradeVoteStatusResponseV0 + * Constructs a new GetTotalCreditsInPlatformRequestV0. + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest + * @classdesc Represents a GetTotalCreditsInPlatformRequestV0. + * @implements IGetTotalCreditsInPlatformRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.IGetTotalCreditsInPlatformRequestV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusResponseV0(properties) { + function GetTotalCreditsInPlatformRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21984,115 +36233,75 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 versions. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null|undefined} versions - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @instance - */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.versions = null; - - /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @instance - */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.proof = null; - - /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @instance - */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.metadata = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 result. - * @member {"versions"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * GetTotalCreditsInPlatformRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["versions", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetTotalCreditsInPlatformRequestV0.prototype.prove = false; /** - * Creates a new GetProtocolVersionUpgradeVoteStatusResponseV0 instance using the specified properties. + * Creates a new GetTotalCreditsInPlatformRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.IGetTotalCreditsInPlatformRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} GetTotalCreditsInPlatformRequestV0 instance */ - GetProtocolVersionUpgradeVoteStatusResponseV0.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusResponseV0(properties); + GetTotalCreditsInPlatformRequestV0.create = function create(properties) { + return new GetTotalCreditsInPlatformRequestV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. + * Encodes the specified GetTotalCreditsInPlatformRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.IGetTotalCreditsInPlatformRequestV0} message GetTotalCreditsInPlatformRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponseV0.encode = function encode(message, writer) { + GetTotalCreditsInPlatformRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.versions != null && Object.hasOwnProperty.call(message, "versions")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.prove); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. + * Encodes the specified GetTotalCreditsInPlatformRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.IGetTotalCreditsInPlatformRequestV0} message GetTotalCreditsInPlatformRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetTotalCreditsInPlatformRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer. + * Decodes a GetTotalCreditsInPlatformRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} GetTotalCreditsInPlatformRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponseV0.decode = function decode(reader, length) { + GetTotalCreditsInPlatformRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.decode(reader, reader.uint32()); - break; - case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -22103,581 +36312,598 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetTotalCreditsInPlatformRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} GetTotalCreditsInPlatformRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetTotalCreditsInPlatformRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusResponseV0 message. + * Verifies a GetTotalCreditsInPlatformRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusResponseV0.verify = function verify(message) { + GetTotalCreditsInPlatformRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.versions != null && message.hasOwnProperty("versions")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify(message.versions); - if (error) - return "versions." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetTotalCreditsInPlatformRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} GetTotalCreditsInPlatformRequestV0 */ - GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) + GetTotalCreditsInPlatformRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); - if (object.versions != null) { - if (typeof object.versions !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.versions: object expected"); - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.fromObject(object.versions); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } + var message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0(); + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetTotalCreditsInPlatformRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} message GetTotalCreditsInPlatformRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function toObject(message, options) { + GetTotalCreditsInPlatformRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.metadata = null; - if (message.versions != null && message.hasOwnProperty("versions")) { - object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(message.versions, options); - if (options.oneofs) - object.result = "versions"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + object.prove = false; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusResponseV0 to JSON. + * Converts this GetTotalCreditsInPlatformRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toJSON = function toJSON() { + GetTotalCreditsInPlatformRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = (function() { + return GetTotalCreditsInPlatformRequestV0; + })(); - /** - * Properties of a VersionSignals. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @interface IVersionSignals - * @property {Array.|null} [versionSignals] VersionSignals versionSignals - */ + return GetTotalCreditsInPlatformRequest; + })(); - /** - * Constructs a new VersionSignals. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @classdesc Represents a VersionSignals. - * @implements IVersionSignals - * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set - */ - function VersionSignals(properties) { - this.versionSignals = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v0.GetTotalCreditsInPlatformResponse = (function() { - /** - * VersionSignals versionSignals. - * @member {Array.} versionSignals - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @instance - */ - VersionSignals.prototype.versionSignals = $util.emptyArray; + /** + * Properties of a GetTotalCreditsInPlatformResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetTotalCreditsInPlatformResponse + * @property {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.IGetTotalCreditsInPlatformResponseV0|null} [v0] GetTotalCreditsInPlatformResponse v0 + */ - /** - * Creates a new VersionSignals instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals instance - */ - VersionSignals.create = function create(properties) { - return new VersionSignals(properties); - }; + /** + * Constructs a new GetTotalCreditsInPlatformResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetTotalCreditsInPlatformResponse. + * @implements IGetTotalCreditsInPlatformResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformResponse=} [properties] Properties to set + */ + function GetTotalCreditsInPlatformResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetTotalCreditsInPlatformResponse v0. + * @member {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.IGetTotalCreditsInPlatformResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @instance + */ + GetTotalCreditsInPlatformResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetTotalCreditsInPlatformResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @instance + */ + Object.defineProperty(GetTotalCreditsInPlatformResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Encodes the specified VersionSignals message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionSignals.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.versionSignals != null && message.versionSignals.length) - for (var i = 0; i < message.versionSignals.length; ++i) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.encode(message.versionSignals[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Creates a new GetTotalCreditsInPlatformResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} GetTotalCreditsInPlatformResponse instance + */ + GetTotalCreditsInPlatformResponse.create = function create(properties) { + return new GetTotalCreditsInPlatformResponse(properties); + }; - /** - * Encodes the specified VersionSignals message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionSignals.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified GetTotalCreditsInPlatformResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformResponse} message GetTotalCreditsInPlatformResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTotalCreditsInPlatformResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Decodes a VersionSignals message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionSignals.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.versionSignals && message.versionSignals.length)) - message.versionSignals = []; - message.versionSignals.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified GetTotalCreditsInPlatformResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetTotalCreditsInPlatformResponse} message GetTotalCreditsInPlatformResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTotalCreditsInPlatformResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a VersionSignals message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionSignals.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a GetTotalCreditsInPlatformResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} GetTotalCreditsInPlatformResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTotalCreditsInPlatformResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Verifies a VersionSignals message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VersionSignals.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.versionSignals != null && message.hasOwnProperty("versionSignals")) { - if (!Array.isArray(message.versionSignals)) - return "versionSignals: array expected"; - for (var i = 0; i < message.versionSignals.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify(message.versionSignals[i]); - if (error) - return "versionSignals." + error; - } - } - return null; - }; + /** + * Decodes a GetTotalCreditsInPlatformResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} GetTotalCreditsInPlatformResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTotalCreditsInPlatformResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a VersionSignals message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals - */ - VersionSignals.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); - if (object.versionSignals) { - if (!Array.isArray(object.versionSignals)) - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: array expected"); - message.versionSignals = []; - for (var i = 0; i < object.versionSignals.length; ++i) { - if (typeof object.versionSignals[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: object expected"); - message.versionSignals[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.fromObject(object.versionSignals[i]); - } - } - return message; - }; + /** + * Verifies a GetTotalCreditsInPlatformResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTotalCreditsInPlatformResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; - /** - * Creates a plain object from a VersionSignals message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message VersionSignals - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VersionSignals.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.versionSignals = []; - if (message.versionSignals && message.versionSignals.length) { - object.versionSignals = []; - for (var j = 0; j < message.versionSignals.length; ++j) - object.versionSignals[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(message.versionSignals[j], options); - } - return object; - }; + /** + * Creates a GetTotalCreditsInPlatformResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} GetTotalCreditsInPlatformResponse + */ + GetTotalCreditsInPlatformResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.fromObject(object.v0); + } + return message; + }; - /** - * Converts this VersionSignals to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals - * @instance - * @returns {Object.} JSON object - */ - VersionSignals.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetTotalCreditsInPlatformResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @static + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} message GetTotalCreditsInPlatformResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTotalCreditsInPlatformResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; - return VersionSignals; - })(); + /** + * Converts this GetTotalCreditsInPlatformResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @instance + * @returns {Object.} JSON object + */ + GetTotalCreditsInPlatformResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = (function() { + GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 = (function() { - /** - * Properties of a VersionSignal. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @interface IVersionSignal - * @property {Uint8Array|null} [proTxHash] VersionSignal proTxHash - * @property {number|null} [version] VersionSignal version - */ + /** + * Properties of a GetTotalCreditsInPlatformResponseV0. + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @interface IGetTotalCreditsInPlatformResponseV0 + * @property {number|Long|null} [credits] GetTotalCreditsInPlatformResponseV0 credits + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetTotalCreditsInPlatformResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetTotalCreditsInPlatformResponseV0 metadata + */ - /** - * Constructs a new VersionSignal. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @classdesc Represents a VersionSignal. - * @implements IVersionSignal - * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set - */ - function VersionSignal(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new GetTotalCreditsInPlatformResponseV0. + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse + * @classdesc Represents a GetTotalCreditsInPlatformResponseV0. + * @implements IGetTotalCreditsInPlatformResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.IGetTotalCreditsInPlatformResponseV0=} [properties] Properties to set + */ + function GetTotalCreditsInPlatformResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * VersionSignal proTxHash. - * @member {Uint8Array} proTxHash - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @instance - */ - VersionSignal.prototype.proTxHash = $util.newBuffer([]); + /** + * GetTotalCreditsInPlatformResponseV0 credits. + * @member {number|Long} credits + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @instance + */ + GetTotalCreditsInPlatformResponseV0.prototype.credits = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - /** - * VersionSignal version. - * @member {number} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @instance - */ - VersionSignal.prototype.version = 0; + /** + * GetTotalCreditsInPlatformResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @instance + */ + GetTotalCreditsInPlatformResponseV0.prototype.proof = null; - /** - * Creates a new VersionSignal instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal instance - */ - VersionSignal.create = function create(properties) { - return new VersionSignal(properties); - }; + /** + * GetTotalCreditsInPlatformResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @instance + */ + GetTotalCreditsInPlatformResponseV0.prototype.metadata = null; - /** - * Encodes the specified VersionSignal message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionSignal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.proTxHash); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.version); - return writer; - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Encodes the specified VersionSignal message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionSignal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * GetTotalCreditsInPlatformResponseV0 result. + * @member {"credits"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @instance + */ + Object.defineProperty(GetTotalCreditsInPlatformResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["credits", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Decodes a VersionSignal message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionSignal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proTxHash = reader.bytes(); - break; - case 2: - message.version = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new GetTotalCreditsInPlatformResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.IGetTotalCreditsInPlatformResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} GetTotalCreditsInPlatformResponseV0 instance + */ + GetTotalCreditsInPlatformResponseV0.create = function create(properties) { + return new GetTotalCreditsInPlatformResponseV0(properties); + }; - /** - * Decodes a VersionSignal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionSignal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified GetTotalCreditsInPlatformResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.IGetTotalCreditsInPlatformResponseV0} message GetTotalCreditsInPlatformResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTotalCreditsInPlatformResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.credits != null && Object.hasOwnProperty.call(message, "credits")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.credits); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; - /** - * Verifies a VersionSignal message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VersionSignal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) - return "proTxHash: buffer expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isInteger(message.version)) - return "version: integer expected"; - return null; - }; + /** + * Encodes the specified GetTotalCreditsInPlatformResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.IGetTotalCreditsInPlatformResponseV0} message GetTotalCreditsInPlatformResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTotalCreditsInPlatformResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a VersionSignal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal - */ - VersionSignal.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); - if (object.proTxHash != null) - if (typeof object.proTxHash === "string") - $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); - else if (object.proTxHash.length >= 0) - message.proTxHash = object.proTxHash; - if (object.version != null) - message.version = object.version >>> 0; - return message; - }; + /** + * Decodes a GetTotalCreditsInPlatformResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} GetTotalCreditsInPlatformResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTotalCreditsInPlatformResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.credits = reader.uint64(); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a plain object from a VersionSignal message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message VersionSignal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VersionSignal.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.proTxHash = ""; - else { - object.proTxHash = []; - if (options.bytes !== Array) - object.proTxHash = $util.newBuffer(object.proTxHash); - } - object.version = 0; + /** + * Decodes a GetTotalCreditsInPlatformResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} GetTotalCreditsInPlatformResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTotalCreditsInPlatformResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTotalCreditsInPlatformResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTotalCreditsInPlatformResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.credits != null && message.hasOwnProperty("credits")) { + properties.result = 1; + if (!$util.isInteger(message.credits) && !(message.credits && $util.isInteger(message.credits.low) && $util.isInteger(message.credits.high))) + return "credits: integer|Long expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; } - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetTotalCreditsInPlatformResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} GetTotalCreditsInPlatformResponseV0 + */ + GetTotalCreditsInPlatformResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0(); + if (object.credits != null) + if ($util.Long) + (message.credits = $util.Long.fromValue(object.credits)).unsigned = true; + else if (typeof object.credits === "string") + message.credits = parseInt(object.credits, 10); + else if (typeof object.credits === "number") + message.credits = object.credits; + else if (typeof object.credits === "object") + message.credits = new $util.LongBits(object.credits.low >>> 0, object.credits.high >>> 0).toNumber(true); + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; - /** - * Converts this VersionSignal to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal - * @instance - * @returns {Object.} JSON object - */ - VersionSignal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetTotalCreditsInPlatformResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} message GetTotalCreditsInPlatformResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTotalCreditsInPlatformResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.credits != null && message.hasOwnProperty("credits")) { + if (typeof message.credits === "number") + object.credits = options.longs === String ? String(message.credits) : message.credits; + else + object.credits = options.longs === String ? $util.Long.prototype.toString.call(message.credits) : options.longs === Number ? new $util.LongBits(message.credits.low >>> 0, message.credits.high >>> 0).toNumber(true) : message.credits; + if (options.oneofs) + object.result = "credits"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; - return VersionSignal; - })(); + /** + * Converts this GetTotalCreditsInPlatformResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetTotalCreditsInPlatformResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GetProtocolVersionUpgradeVoteStatusResponseV0; + return GetTotalCreditsInPlatformResponseV0; })(); - return GetProtocolVersionUpgradeVoteStatusResponse; + return GetTotalCreditsInPlatformResponse; })(); - v0.GetEpochsInfoRequest = (function() { + v0.GetPathElementsRequest = (function() { /** - * Properties of a GetEpochsInfoRequest. + * Properties of a GetPathElementsRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetEpochsInfoRequest - * @property {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null} [v0] GetEpochsInfoRequest v0 + * @interface IGetPathElementsRequest + * @property {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0|null} [v0] GetPathElementsRequest v0 */ /** - * Constructs a new GetEpochsInfoRequest. + * Constructs a new GetPathElementsRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetEpochsInfoRequest. - * @implements IGetEpochsInfoRequest + * @classdesc Represents a GetPathElementsRequest. + * @implements IGetPathElementsRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest=} [properties] Properties to set */ - function GetEpochsInfoRequest(properties) { + function GetPathElementsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22685,89 +36911,89 @@ $root.org = (function() { } /** - * GetEpochsInfoRequest v0. - * @member {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * GetPathElementsRequest v0. + * @member {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @instance */ - GetEpochsInfoRequest.prototype.v0 = null; + GetPathElementsRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetEpochsInfoRequest version. + * GetPathElementsRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @instance */ - Object.defineProperty(GetEpochsInfoRequest.prototype, "version", { + Object.defineProperty(GetPathElementsRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetEpochsInfoRequest instance using the specified properties. + * Creates a new GetPathElementsRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest instance */ - GetEpochsInfoRequest.create = function create(properties) { - return new GetEpochsInfoRequest(properties); + GetPathElementsRequest.create = function create(properties) { + return new GetPathElementsRequest(properties); }; /** - * Encodes the specified GetEpochsInfoRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. + * Encodes the specified GetPathElementsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} message GetPathElementsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequest.encode = function encode(message, writer) { + GetPathElementsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetEpochsInfoRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. + * Encodes the specified GetPathElementsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} message GetPathElementsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoRequest message from the specified reader or buffer. + * Decodes a GetPathElementsRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequest.decode = function decode(reader, length) { + GetPathElementsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -22778,37 +37004,37 @@ $root.org = (function() { }; /** - * Decodes a GetEpochsInfoRequest message from the specified reader or buffer, length delimited. + * Decodes a GetPathElementsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequest.decodeDelimited = function decodeDelimited(reader) { + GetPathElementsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetEpochsInfoRequest message. + * Verifies a GetPathElementsRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoRequest.verify = function verify(message) { + GetPathElementsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -22817,40 +37043,40 @@ $root.org = (function() { }; /** - * Creates a GetEpochsInfoRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetPathElementsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest */ - GetEpochsInfoRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest) + GetPathElementsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetEpochsInfoRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetPathElementsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest} message GetEpochsInfoRequest + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest} message GetPathElementsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetEpochsInfoRequest.toObject = function toObject(message, options) { + GetPathElementsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -22858,37 +37084,38 @@ $root.org = (function() { }; /** - * Converts this GetEpochsInfoRequest to JSON. + * Converts this GetPathElementsRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @instance * @returns {Object.} JSON object */ - GetEpochsInfoRequest.prototype.toJSON = function toJSON() { + GetPathElementsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetEpochsInfoRequest.GetEpochsInfoRequestV0 = (function() { + GetPathElementsRequest.GetPathElementsRequestV0 = (function() { /** - * Properties of a GetEpochsInfoRequestV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest - * @interface IGetEpochsInfoRequestV0 - * @property {google.protobuf.IUInt32Value|null} [startEpoch] GetEpochsInfoRequestV0 startEpoch - * @property {number|null} [count] GetEpochsInfoRequestV0 count - * @property {boolean|null} [ascending] GetEpochsInfoRequestV0 ascending - * @property {boolean|null} [prove] GetEpochsInfoRequestV0 prove + * Properties of a GetPathElementsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest + * @interface IGetPathElementsRequestV0 + * @property {Array.|null} [path] GetPathElementsRequestV0 path + * @property {Array.|null} [keys] GetPathElementsRequestV0 keys + * @property {boolean|null} [prove] GetPathElementsRequestV0 prove */ /** - * Constructs a new GetEpochsInfoRequestV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest - * @classdesc Represents a GetEpochsInfoRequestV0. - * @implements IGetEpochsInfoRequestV0 + * Constructs a new GetPathElementsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest + * @classdesc Represents a GetPathElementsRequestV0. + * @implements IGetPathElementsRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0=} [properties] Properties to set */ - function GetEpochsInfoRequestV0(properties) { + function GetPathElementsRequestV0(properties) { + this.path = []; + this.keys = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22896,113 +37123,106 @@ $root.org = (function() { } /** - * GetEpochsInfoRequestV0 startEpoch. - * @member {google.protobuf.IUInt32Value|null|undefined} startEpoch - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 - * @instance - */ - GetEpochsInfoRequestV0.prototype.startEpoch = null; - - /** - * GetEpochsInfoRequestV0 count. - * @member {number} count - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * GetPathElementsRequestV0 path. + * @member {Array.} path + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance */ - GetEpochsInfoRequestV0.prototype.count = 0; + GetPathElementsRequestV0.prototype.path = $util.emptyArray; /** - * GetEpochsInfoRequestV0 ascending. - * @member {boolean} ascending - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * GetPathElementsRequestV0 keys. + * @member {Array.} keys + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance */ - GetEpochsInfoRequestV0.prototype.ascending = false; + GetPathElementsRequestV0.prototype.keys = $util.emptyArray; /** - * GetEpochsInfoRequestV0 prove. + * GetPathElementsRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance */ - GetEpochsInfoRequestV0.prototype.prove = false; + GetPathElementsRequestV0.prototype.prove = false; /** - * Creates a new GetEpochsInfoRequestV0 instance using the specified properties. + * Creates a new GetPathElementsRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 instance */ - GetEpochsInfoRequestV0.create = function create(properties) { - return new GetEpochsInfoRequestV0(properties); + GetPathElementsRequestV0.create = function create(properties) { + return new GetPathElementsRequestV0(properties); }; /** - * Encodes the specified GetEpochsInfoRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. + * Encodes the specified GetPathElementsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0} message GetPathElementsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequestV0.encode = function encode(message, writer) { + GetPathElementsRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startEpoch != null && Object.hasOwnProperty.call(message, "startEpoch")) - $root.google.protobuf.UInt32Value.encode(message.startEpoch, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.count); - if (message.ascending != null && Object.hasOwnProperty.call(message, "ascending")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.ascending); + if (message.path != null && message.path.length) + for (var i = 0; i < message.path.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path[i]); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.keys[i]); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.prove); + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); return writer; }; /** - * Encodes the specified GetEpochsInfoRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. + * Encodes the specified GetPathElementsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0} message GetPathElementsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer. + * Decodes a GetPathElementsRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequestV0.decode = function decode(reader, length) { + GetPathElementsRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.startEpoch = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + if (!(message.path && message.path.length)) + message.path = []; + message.path.push(reader.bytes()); break; case 2: - message.count = reader.uint32(); + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push(reader.bytes()); break; case 3: - message.ascending = reader.bool(); - break; - case 4: message.prove = reader.bool(); break; default: @@ -23014,43 +37234,46 @@ $root.org = (function() { }; /** - * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetPathElementsRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetPathElementsRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetEpochsInfoRequestV0 message. + * Verifies a GetPathElementsRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoRequestV0.verify = function verify(message) { + GetPathElementsRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) { - var error = $root.google.protobuf.UInt32Value.verify(message.startEpoch); - if (error) - return "startEpoch." + error; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!(message.path[i] && typeof message.path[i].length === "number" || $util.isString(message.path[i]))) + return "path: buffer[] expected"; + } + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) + if (!(message.keys[i] && typeof message.keys[i].length === "number" || $util.isString(message.keys[i]))) + return "keys: buffer[] expected"; } - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count)) - return "count: integer expected"; - if (message.ascending != null && message.hasOwnProperty("ascending")) - if (typeof message.ascending !== "boolean") - return "ascending: boolean expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -23058,96 +37281,111 @@ $root.org = (function() { }; /** - * Creates a GetEpochsInfoRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetPathElementsRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 */ - GetEpochsInfoRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0) + GetPathElementsRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); - if (object.startEpoch != null) { - if (typeof object.startEpoch !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.startEpoch: object expected"); - message.startEpoch = $root.google.protobuf.UInt32Value.fromObject(object.startEpoch); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + if (typeof object.path[i] === "string") + $util.base64.decode(object.path[i], message.path[i] = $util.newBuffer($util.base64.length(object.path[i])), 0); + else if (object.path[i].length >= 0) + message.path[i] = object.path[i]; + } + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) + if (typeof object.keys[i] === "string") + $util.base64.decode(object.keys[i], message.keys[i] = $util.newBuffer($util.base64.length(object.keys[i])), 0); + else if (object.keys[i].length >= 0) + message.keys[i] = object.keys[i]; } - if (object.count != null) - message.count = object.count >>> 0; - if (object.ascending != null) - message.ascending = Boolean(object.ascending); if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetEpochsInfoRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetPathElementsRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} message GetPathElementsRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetEpochsInfoRequestV0.toObject = function toObject(message, options) { + GetPathElementsRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.startEpoch = null; - object.count = 0; - object.ascending = false; + if (options.arrays || options.defaults) { + object.path = []; + object.keys = []; + } + if (options.defaults) object.prove = false; + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = options.bytes === String ? $util.base64.encode(message.path[j], 0, message.path[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.path[j]) : message.path[j]; + } + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = options.bytes === String ? $util.base64.encode(message.keys[j], 0, message.keys[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.keys[j]) : message.keys[j]; } - if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) - object.startEpoch = $root.google.protobuf.UInt32Value.toObject(message.startEpoch, options); - if (message.count != null && message.hasOwnProperty("count")) - object.count = message.count; - if (message.ascending != null && message.hasOwnProperty("ascending")) - object.ascending = message.ascending; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetEpochsInfoRequestV0 to JSON. + * Converts this GetPathElementsRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance * @returns {Object.} JSON object */ - GetEpochsInfoRequestV0.prototype.toJSON = function toJSON() { + GetPathElementsRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetEpochsInfoRequestV0; + return GetPathElementsRequestV0; })(); - return GetEpochsInfoRequest; + return GetPathElementsRequest; })(); - v0.GetEpochsInfoResponse = (function() { + v0.GetPathElementsResponse = (function() { /** - * Properties of a GetEpochsInfoResponse. + * Properties of a GetPathElementsResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetEpochsInfoResponse - * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null} [v0] GetEpochsInfoResponse v0 + * @interface IGetPathElementsResponse + * @property {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0|null} [v0] GetPathElementsResponse v0 */ /** - * Constructs a new GetEpochsInfoResponse. + * Constructs a new GetPathElementsResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetEpochsInfoResponse. - * @implements IGetEpochsInfoResponse + * @classdesc Represents a GetPathElementsResponse. + * @implements IGetPathElementsResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse=} [properties] Properties to set */ - function GetEpochsInfoResponse(properties) { + function GetPathElementsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23155,89 +37393,89 @@ $root.org = (function() { } /** - * GetEpochsInfoResponse v0. - * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * GetPathElementsResponse v0. + * @member {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @instance */ - GetEpochsInfoResponse.prototype.v0 = null; + GetPathElementsResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetEpochsInfoResponse version. + * GetPathElementsResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @instance */ - Object.defineProperty(GetEpochsInfoResponse.prototype, "version", { + Object.defineProperty(GetPathElementsResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetEpochsInfoResponse instance using the specified properties. + * Creates a new GetPathElementsResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse instance */ - GetEpochsInfoResponse.create = function create(properties) { - return new GetEpochsInfoResponse(properties); + GetPathElementsResponse.create = function create(properties) { + return new GetPathElementsResponse(properties); }; /** - * Encodes the specified GetEpochsInfoResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. + * Encodes the specified GetPathElementsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse} message GetPathElementsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponse.encode = function encode(message, writer) { + GetPathElementsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetEpochsInfoResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. + * Encodes the specified GetPathElementsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse} message GetPathElementsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoResponse message from the specified reader or buffer. + * Decodes a GetPathElementsResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponse.decode = function decode(reader, length) { + GetPathElementsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23248,37 +37486,37 @@ $root.org = (function() { }; /** - * Decodes a GetEpochsInfoResponse message from the specified reader or buffer, length delimited. + * Decodes a GetPathElementsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponse.decodeDelimited = function decodeDelimited(reader) { + GetPathElementsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetEpochsInfoResponse message. + * Verifies a GetPathElementsResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoResponse.verify = function verify(message) { + GetPathElementsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -23287,40 +37525,40 @@ $root.org = (function() { }; /** - * Creates a GetEpochsInfoResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetPathElementsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse */ - GetEpochsInfoResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse) + GetPathElementsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetEpochsInfoResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetPathElementsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse} message GetEpochsInfoResponse + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse} message GetPathElementsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetEpochsInfoResponse.toObject = function toObject(message, options) { + GetPathElementsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -23328,36 +37566,36 @@ $root.org = (function() { }; /** - * Converts this GetEpochsInfoResponse to JSON. + * Converts this GetPathElementsResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @instance * @returns {Object.} JSON object */ - GetEpochsInfoResponse.prototype.toJSON = function toJSON() { + GetPathElementsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetEpochsInfoResponse.GetEpochsInfoResponseV0 = (function() { + GetPathElementsResponse.GetPathElementsResponseV0 = (function() { /** - * Properties of a GetEpochsInfoResponseV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse - * @interface IGetEpochsInfoResponseV0 - * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null} [epochs] GetEpochsInfoResponseV0 epochs - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetEpochsInfoResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetEpochsInfoResponseV0 metadata + * Properties of a GetPathElementsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse + * @interface IGetPathElementsResponseV0 + * @property {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements|null} [elements] GetPathElementsResponseV0 elements + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetPathElementsResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetPathElementsResponseV0 metadata */ /** - * Constructs a new GetEpochsInfoResponseV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse - * @classdesc Represents a GetEpochsInfoResponseV0. - * @implements IGetEpochsInfoResponseV0 + * Constructs a new GetPathElementsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse + * @classdesc Represents a GetPathElementsResponseV0. + * @implements IGetPathElementsResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0=} [properties] Properties to set */ - function GetEpochsInfoResponseV0(properties) { + function GetPathElementsResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23365,69 +37603,69 @@ $root.org = (function() { } /** - * GetEpochsInfoResponseV0 epochs. - * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null|undefined} epochs - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * GetPathElementsResponseV0 elements. + * @member {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements|null|undefined} elements + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - GetEpochsInfoResponseV0.prototype.epochs = null; + GetPathElementsResponseV0.prototype.elements = null; /** - * GetEpochsInfoResponseV0 proof. + * GetPathElementsResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - GetEpochsInfoResponseV0.prototype.proof = null; + GetPathElementsResponseV0.prototype.proof = null; /** - * GetEpochsInfoResponseV0 metadata. + * GetPathElementsResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - GetEpochsInfoResponseV0.prototype.metadata = null; + GetPathElementsResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetEpochsInfoResponseV0 result. - * @member {"epochs"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * GetPathElementsResponseV0 result. + * @member {"elements"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - Object.defineProperty(GetEpochsInfoResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["epochs", "proof"]), + Object.defineProperty(GetPathElementsResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["elements", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetEpochsInfoResponseV0 instance using the specified properties. + * Creates a new GetPathElementsResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 instance */ - GetEpochsInfoResponseV0.create = function create(properties) { - return new GetEpochsInfoResponseV0(properties); + GetPathElementsResponseV0.create = function create(properties) { + return new GetPathElementsResponseV0(properties); }; /** - * Encodes the specified GetEpochsInfoResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. + * Encodes the specified GetPathElementsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0} message GetPathElementsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponseV0.encode = function encode(message, writer) { + GetPathElementsResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.epochs != null && Object.hasOwnProperty.call(message, "epochs")) - $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.encode(message.epochs, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.elements != null && Object.hasOwnProperty.call(message, "elements")) + $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.encode(message.elements, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -23436,408 +37674,197 @@ $root.org = (function() { }; /** - * Encodes the specified GetEpochsInfoResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. + * Encodes the specified GetPathElementsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0} message GetPathElementsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer. + * Decodes a GetPathElementsResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponseV0.decode = function decode(reader, length) { + GetPathElementsResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.decode(reader, reader.uint32()); + message.elements = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.decode(reader, reader.uint32()); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetEpochsInfoResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetEpochsInfoResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetEpochsInfoResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.epochs != null && message.hasOwnProperty("epochs")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify(message.epochs); - if (error) - return "epochs." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; - - /** - * Creates a GetEpochsInfoResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 - */ - GetEpochsInfoResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); - if (object.epochs != null) { - if (typeof object.epochs !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.epochs: object expected"); - message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.fromObject(object.epochs); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } } return message; }; /** - * Creates a plain object from a GetEpochsInfoResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * Decodes a GetPathElementsResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.epochs != null && message.hasOwnProperty("epochs")) { - object.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(message.epochs, options); - if (options.oneofs) - object.result = "epochs"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; + GetPathElementsResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); }; /** - * Converts this GetEpochsInfoResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @instance - * @returns {Object.} JSON object + * Verifies a GetPathElementsResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - GetEpochsInfoResponseV0.EpochInfos = (function() { - - /** - * Properties of an EpochInfos. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @interface IEpochInfos - * @property {Array.|null} [epochInfos] EpochInfos epochInfos - */ - - /** - * Constructs a new EpochInfos. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @classdesc Represents an EpochInfos. - * @implements IEpochInfos - * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set - */ - function EpochInfos(properties) { - this.epochInfos = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EpochInfos epochInfos. - * @member {Array.} epochInfos - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @instance - */ - EpochInfos.prototype.epochInfos = $util.emptyArray; - - /** - * Creates a new EpochInfos instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos instance - */ - EpochInfos.create = function create(properties) { - return new EpochInfos(properties); - }; - - /** - * Encodes the specified EpochInfos message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EpochInfos.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.epochInfos != null && message.epochInfos.length) - for (var i = 0; i < message.epochInfos.length; ++i) - $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.encode(message.epochInfos[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EpochInfos message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EpochInfos.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EpochInfos message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EpochInfos.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.epochInfos && message.epochInfos.length)) - message.epochInfos = []; - message.epochInfos.push($root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EpochInfos message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EpochInfos.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EpochInfos message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EpochInfos.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.epochInfos != null && message.hasOwnProperty("epochInfos")) { - if (!Array.isArray(message.epochInfos)) - return "epochInfos: array expected"; - for (var i = 0; i < message.epochInfos.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify(message.epochInfos[i]); - if (error) - return "epochInfos." + error; - } - } - return null; - }; - - /** - * Creates an EpochInfos message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos - */ - EpochInfos.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); - if (object.epochInfos) { - if (!Array.isArray(object.epochInfos)) - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: array expected"); - message.epochInfos = []; - for (var i = 0; i < object.epochInfos.length; ++i) { - if (typeof object.epochInfos[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: object expected"); - message.epochInfos[i] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.fromObject(object.epochInfos[i]); - } + GetPathElementsResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.elements != null && message.hasOwnProperty("elements")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.verify(message.elements); + if (error) + return "elements." + error; } - return message; - }; - - /** - * Creates a plain object from an EpochInfos message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message EpochInfos - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EpochInfos.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.epochInfos = []; - if (message.epochInfos && message.epochInfos.length) { - object.epochInfos = []; - for (var j = 0; j < message.epochInfos.length; ++j) - object.epochInfos[j] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(message.epochInfos[j], options); + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetPathElementsResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 + */ + GetPathElementsResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0(); + if (object.elements != null) { + if (typeof object.elements !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.elements: object expected"); + message.elements = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.fromObject(object.elements); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; - /** - * Converts this EpochInfos to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @instance - * @returns {Object.} JSON object - */ - EpochInfos.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetPathElementsResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} message GetPathElementsResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPathElementsResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.elements != null && message.hasOwnProperty("elements")) { + object.elements = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(message.elements, options); + if (options.oneofs) + object.result = "elements"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; - return EpochInfos; - })(); + /** + * Converts this GetPathElementsResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetPathElementsResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetEpochsInfoResponseV0.EpochInfo = (function() { + GetPathElementsResponseV0.Elements = (function() { /** - * Properties of an EpochInfo. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @interface IEpochInfo - * @property {number|null} [number] EpochInfo number - * @property {number|Long|null} [firstBlockHeight] EpochInfo firstBlockHeight - * @property {number|null} [firstCoreBlockHeight] EpochInfo firstCoreBlockHeight - * @property {number|Long|null} [startTime] EpochInfo startTime - * @property {number|null} [feeMultiplier] EpochInfo feeMultiplier + * Properties of an Elements. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @interface IElements + * @property {Array.|null} [elements] Elements elements */ /** - * Constructs a new EpochInfo. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @classdesc Represents an EpochInfo. - * @implements IEpochInfo + * Constructs a new Elements. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @classdesc Represents an Elements. + * @implements IElements * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements=} [properties] Properties to set */ - function EpochInfo(properties) { + function Elements(properties) { + this.elements = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23845,127 +37872,78 @@ $root.org = (function() { } /** - * EpochInfo number. - * @member {number} number - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.number = 0; - - /** - * EpochInfo firstBlockHeight. - * @member {number|Long} firstBlockHeight - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.firstBlockHeight = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * EpochInfo firstCoreBlockHeight. - * @member {number} firstCoreBlockHeight - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.firstCoreBlockHeight = 0; - - /** - * EpochInfo startTime. - * @member {number|Long} startTime - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.startTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * EpochInfo feeMultiplier. - * @member {number} feeMultiplier - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * Elements elements. + * @member {Array.} elements + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @instance */ - EpochInfo.prototype.feeMultiplier = 0; + Elements.prototype.elements = $util.emptyArray; /** - * Creates a new EpochInfo instance using the specified properties. + * Creates a new Elements instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo instance + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements instance */ - EpochInfo.create = function create(properties) { - return new EpochInfo(properties); + Elements.create = function create(properties) { + return new Elements(properties); }; /** - * Encodes the specified EpochInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. + * Encodes the specified Elements message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements} message Elements message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EpochInfo.encode = function encode(message, writer) { + Elements.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.number); - if (message.firstBlockHeight != null && Object.hasOwnProperty.call(message, "firstBlockHeight")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.firstBlockHeight); - if (message.firstCoreBlockHeight != null && Object.hasOwnProperty.call(message, "firstCoreBlockHeight")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.firstCoreBlockHeight); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.startTime); - if (message.feeMultiplier != null && Object.hasOwnProperty.call(message, "feeMultiplier")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.feeMultiplier); + if (message.elements != null && message.elements.length) + for (var i = 0; i < message.elements.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.elements[i]); return writer; }; /** - * Encodes the specified EpochInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. + * Encodes the specified Elements message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements} message Elements message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EpochInfo.encodeDelimited = function encodeDelimited(message, writer) { + Elements.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EpochInfo message from the specified reader or buffer. + * Decodes an Elements message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EpochInfo.decode = function decode(reader, length) { + Elements.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.number = reader.uint32(); - break; - case 2: - message.firstBlockHeight = reader.uint64(); - break; - case 3: - message.firstCoreBlockHeight = reader.uint32(); - break; - case 4: - message.startTime = reader.uint64(); - break; - case 5: - message.feeMultiplier = reader.double(); + if (!(message.elements && message.elements.length)) + message.elements = []; + message.elements.push(reader.bytes()); break; default: reader.skipType(tag & 7); @@ -23976,154 +37954,108 @@ $root.org = (function() { }; /** - * Decodes an EpochInfo message from the specified reader or buffer, length delimited. + * Decodes an Elements message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EpochInfo.decodeDelimited = function decodeDelimited(reader) { + Elements.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EpochInfo message. + * Verifies an Elements message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EpochInfo.verify = function verify(message) { + Elements.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) - if (!$util.isInteger(message.firstBlockHeight) && !(message.firstBlockHeight && $util.isInteger(message.firstBlockHeight.low) && $util.isInteger(message.firstBlockHeight.high))) - return "firstBlockHeight: integer|Long expected"; - if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) - if (!$util.isInteger(message.firstCoreBlockHeight)) - return "firstCoreBlockHeight: integer expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) - if (!$util.isInteger(message.startTime) && !(message.startTime && $util.isInteger(message.startTime.low) && $util.isInteger(message.startTime.high))) - return "startTime: integer|Long expected"; - if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) - if (typeof message.feeMultiplier !== "number") - return "feeMultiplier: number expected"; + if (message.elements != null && message.hasOwnProperty("elements")) { + if (!Array.isArray(message.elements)) + return "elements: array expected"; + for (var i = 0; i < message.elements.length; ++i) + if (!(message.elements[i] && typeof message.elements[i].length === "number" || $util.isString(message.elements[i]))) + return "elements: buffer[] expected"; + } return null; }; /** - * Creates an EpochInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Elements message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements */ - EpochInfo.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) + Elements.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); - if (object.number != null) - message.number = object.number >>> 0; - if (object.firstBlockHeight != null) - if ($util.Long) - (message.firstBlockHeight = $util.Long.fromValue(object.firstBlockHeight)).unsigned = true; - else if (typeof object.firstBlockHeight === "string") - message.firstBlockHeight = parseInt(object.firstBlockHeight, 10); - else if (typeof object.firstBlockHeight === "number") - message.firstBlockHeight = object.firstBlockHeight; - else if (typeof object.firstBlockHeight === "object") - message.firstBlockHeight = new $util.LongBits(object.firstBlockHeight.low >>> 0, object.firstBlockHeight.high >>> 0).toNumber(true); - if (object.firstCoreBlockHeight != null) - message.firstCoreBlockHeight = object.firstCoreBlockHeight >>> 0; - if (object.startTime != null) - if ($util.Long) - (message.startTime = $util.Long.fromValue(object.startTime)).unsigned = true; - else if (typeof object.startTime === "string") - message.startTime = parseInt(object.startTime, 10); - else if (typeof object.startTime === "number") - message.startTime = object.startTime; - else if (typeof object.startTime === "object") - message.startTime = new $util.LongBits(object.startTime.low >>> 0, object.startTime.high >>> 0).toNumber(true); - if (object.feeMultiplier != null) - message.feeMultiplier = Number(object.feeMultiplier); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements(); + if (object.elements) { + if (!Array.isArray(object.elements)) + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.elements: array expected"); + message.elements = []; + for (var i = 0; i < object.elements.length; ++i) + if (typeof object.elements[i] === "string") + $util.base64.decode(object.elements[i], message.elements[i] = $util.newBuffer($util.base64.length(object.elements[i])), 0); + else if (object.elements[i].length >= 0) + message.elements[i] = object.elements[i]; + } return message; }; /** - * Creates a plain object from an EpochInfo message. Also converts values to other types if specified. + * Creates a plain object from an Elements message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message EpochInfo + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} message Elements * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EpochInfo.toObject = function toObject(message, options) { + Elements.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.number = 0; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.firstBlockHeight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.firstBlockHeight = options.longs === String ? "0" : 0; - object.firstCoreBlockHeight = 0; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.startTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.startTime = options.longs === String ? "0" : 0; - object.feeMultiplier = 0; + if (options.arrays || options.defaults) + object.elements = []; + if (message.elements && message.elements.length) { + object.elements = []; + for (var j = 0; j < message.elements.length; ++j) + object.elements[j] = options.bytes === String ? $util.base64.encode(message.elements[j], 0, message.elements[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.elements[j]) : message.elements[j]; } - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) - if (typeof message.firstBlockHeight === "number") - object.firstBlockHeight = options.longs === String ? String(message.firstBlockHeight) : message.firstBlockHeight; - else - object.firstBlockHeight = options.longs === String ? $util.Long.prototype.toString.call(message.firstBlockHeight) : options.longs === Number ? new $util.LongBits(message.firstBlockHeight.low >>> 0, message.firstBlockHeight.high >>> 0).toNumber(true) : message.firstBlockHeight; - if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) - object.firstCoreBlockHeight = message.firstCoreBlockHeight; - if (message.startTime != null && message.hasOwnProperty("startTime")) - if (typeof message.startTime === "number") - object.startTime = options.longs === String ? String(message.startTime) : message.startTime; - else - object.startTime = options.longs === String ? $util.Long.prototype.toString.call(message.startTime) : options.longs === Number ? new $util.LongBits(message.startTime.low >>> 0, message.startTime.high >>> 0).toNumber(true) : message.startTime; - if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) - object.feeMultiplier = options.json && !isFinite(message.feeMultiplier) ? String(message.feeMultiplier) : message.feeMultiplier; return object; }; /** - * Converts this EpochInfo to JSON. + * Converts this Elements to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @instance * @returns {Object.} JSON object */ - EpochInfo.prototype.toJSON = function toJSON() { + Elements.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EpochInfo; + return Elements; })(); - return GetEpochsInfoResponseV0; + return GetPathElementsResponseV0; })(); - return GetEpochsInfoResponse; + return GetPathElementsResponse; })(); return v0; diff --git a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js index 9d6d3e76cfa..be474b049e7 100644 --- a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js +++ b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js @@ -32,6 +32,49 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.Co goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase', null, { proto }); @@ -75,25 +118,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpoc goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase', null, { proto }); @@ -116,6 +150,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase', null, { proto }); @@ -124,6 +165,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetId goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase', null, { proto }); @@ -131,12 +179,31 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse', null, { goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0', null, { proto }); @@ -160,6 +227,25 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVote goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyPurpose', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.Proof', null, { proto }); @@ -333,16 +419,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -354,16 +440,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -375,16 +461,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -396,16 +482,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -417,16 +503,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -438,16 +524,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -459,16 +545,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; } /** * Generated by JsPbCodeGenerator. @@ -480,16 +566,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -501,16 +587,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; } /** * Generated by JsPbCodeGenerator. @@ -522,16 +608,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -543,16 +629,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -564,16 +671,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse'; } /** * Generated by JsPbCodeGenerator. @@ -585,16 +692,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -911,6 +1018,153 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1016,6 +1270,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1509,16 +1805,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1530,16 +1826,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1551,16 +1847,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1572,16 +1868,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1593,16 +1889,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1614,16 +1910,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1635,16 +1931,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1656,16 +1952,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1677,16 +1973,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1698,16 +1994,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1719,16 +2015,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1740,16 +2036,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; } /** * Generated by JsPbCodeGenerator. @@ -1761,16 +2057,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; } /** * Generated by JsPbCodeGenerator. @@ -1782,16 +2078,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1803,16 +2099,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1824,16 +2120,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1845,16 +2141,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1866,16 +2162,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1887,16 +2183,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; } /** * Generated by JsPbCodeGenerator. @@ -1908,16 +2204,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; } /** * Generated by JsPbCodeGenerator. @@ -1929,16 +2225,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1950,16 +2246,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1971,16 +2267,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1992,16 +2288,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2013,16 +2309,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; } /** * Generated by JsPbCodeGenerator. @@ -2034,16 +2330,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; } /** * Generated by JsPbCodeGenerator. @@ -2055,16 +2351,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2076,16 +2372,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2097,16 +2393,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2118,16 +2414,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2139,16 +2435,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; } /** * Generated by JsPbCodeGenerator. @@ -2160,16 +2456,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; } /** * Generated by JsPbCodeGenerator. @@ -2181,16 +2477,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2202,16 +2498,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2223,16 +2519,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo'; } /** * Generated by JsPbCodeGenerator. @@ -2244,16 +2540,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2265,16 +2561,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2286,50 +2582,953 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues'; } - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.org.dash.platform.dapi.v0.Proof.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.Proof.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_); }; - - +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest'; +} /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.org.dash.platform.dapi.v0.Proof.toObject = function(includeInstance, msg) { - var f, obj = { - grovedbProof: msg.getGrovedbProof_asB64(), +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.Proof.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.Proof.toObject = function(includeInstance, msg) { + var f, obj = { + grovedbProof: msg.getGrovedbProof_asB64(), quorumHash: msg.getQuorumHash_asB64(), signature: msg.getSignature_asB64(), round: jspb.Message.getFieldWithDefault(msg, 4, 0), @@ -2348,23 +3547,10682 @@ proto.org.dash.platform.dapi.v0.Proof.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.Proof} + * @return {!proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.Proof.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.Proof; + return proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setGrovedbProof(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setQuorumHash(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSignature(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint32()); + msg.setRound(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBlockIdHash(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setQuorumType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.Proof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGrovedbProof_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getQuorumHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getSignature_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeUint32( + 4, + f + ); + } + f = message.getBlockIdHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getQuorumType(); + if (f !== 0) { + writer.writeUint32( + 6, + f + ); + } +}; + + +/** + * optional bytes grovedb_proof = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes grovedb_proof = 1; + * This is a type-conversion wrapper around `getGrovedbProof()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getGrovedbProof())); +}; + + +/** + * optional bytes grovedb_proof = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getGrovedbProof()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getGrovedbProof())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setGrovedbProof = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes quorum_hash = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes quorum_hash = 2; + * This is a type-conversion wrapper around `getQuorumHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getQuorumHash())); +}; + + +/** + * optional bytes quorum_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getQuorumHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getQuorumHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes signature = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes signature = 3; + * This is a type-conversion wrapper around `getSignature()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSignature())); +}; + + +/** + * optional bytes signature = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSignature()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSignature())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setSignature = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional uint32 round = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional bytes block_id_hash = 5; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes block_id_hash = 5; + * This is a type-conversion wrapper around `getBlockIdHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBlockIdHash())); +}; + + +/** + * optional bytes block_id_hash = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBlockIdHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBlockIdHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setBlockIdHash = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional uint32 quorum_type = 6; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumType = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumType = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + coreChainLockedHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), + epoch: jspb.Message.getFieldWithDefault(msg, 3, 0), + timeMs: jspb.Message.getFieldWithDefault(msg, 4, 0), + protocolVersion: jspb.Message.getFieldWithDefault(msg, 5, 0), + chainId: jspb.Message.getFieldWithDefault(msg, 6, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + return proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCoreChainLockedHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setEpoch(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setTimeMs(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setProtocolVersion(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getCoreChainLockedHeight(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getEpoch(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getTimeMs(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getProtocolVersion(); + if (f !== 0) { + writer.writeUint32( + 5, + f + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 core_chain_locked_height = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getCoreChainLockedHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setCoreChainLockedHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 epoch = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getEpoch = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setEpoch = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 time_ms = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional uint32 protocol_version = 5; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getProtocolVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setProtocolVersion = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional string chain_id = 6; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + message: jspb.Message.getFieldWithDefault(msg, 2, ""), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; + return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCode(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional uint32 code = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string message = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bytes data = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject = function(includeInstance, msg) { + var f, obj = { + stateTransition: msg.getStateTransition_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest; + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStateTransition(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStateTransition_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes state_transition = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes state_transition = 1; + * This is a type-conversion wrapper around `getStateTransition()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStateTransition())); +}; + + +/** + * optional bytes state_transition = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStateTransition()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStateTransition())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} returns this + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.setStateTransition = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse; + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + contractId: msg.getContractId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 3, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes contract_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bool prove = 3; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional GetIdentityContractNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityBalanceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentity(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes identity = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentity())); +}; + + +/** + * optional bytes identity = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentity()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentity())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY_NONCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIdentityNonce(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 identity_nonce = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getIdentityNonce = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setIdentityNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearIdentityNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasIdentityNonce = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY_CONTRACT_NONCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityContractNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIdentityContractNonce(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 identity_contract_nonce = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getIdentityContractNonce = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setIdentityContractNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearIdentityContractNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasIdentityContractNonce = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityContractNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 balance = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityBalanceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE_AND_REVISION: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); + msg.setBalanceAndRevision(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBalanceAndRevision(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { + var f, obj = { + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + revision: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setRevision(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBalance(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getRevision(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint64 balance = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 revision = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional BalanceAndRevision balance_and_revision = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { + return this.setBalanceAndRevision(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { + REQUEST_NOT_SET: 0, + ALL_KEYS: 1, + SPECIFIC_KEYS: 2, + SEARCH_KEY: 3 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { + var f, obj = { + allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), + specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), + searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; + return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.AllKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); + msg.setAllKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); + msg.setSpecificKeys(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.SearchKey; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); + msg.setSearchKey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAllKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter + ); + } + f = message.getSpecificKeys(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter + ); + } + f = message.getSearchKey(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter + ); + } +}; + + +/** + * optional AllKeys all_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { + return this.setAllKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional SpecificKeys specific_keys = 2; + * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { + return this.setSpecificKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional SearchKey search_key = 3; + * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { + return this.setSearchKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.AllKeys; + return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { + var f, obj = { + keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; + return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); + for (var i = 0; i < values.length; i++) { + msg.addKeyIds(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyIdsList(); + if (f.length > 0) { + writer.writePackedUint32( + 1, + f + ); + } +}; + + +/** + * repeated uint32 key_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { + return this.setKeyIdsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { + var f, obj = { + purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SearchKey; + return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getPurposeMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPurposeMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); + } +}; + + +/** + * map purpose_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + proto.org.dash.platform.dapi.v0.SecurityLevelMap)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { + this.getPurposeMapMap().clear(); + return this;}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { + var f, obj = { + securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getSecurityLevelMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSecurityLevelMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { + CURRENT_KEY_OF_KIND_REQUEST: 0, + ALL_KEYS_OF_KIND_REQUEST: 1 +}; + +/** + * map security_level_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { + this.getSecurityLevelMapMap().clear(); + return this;}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); + msg.setRequestType(value); + break; + case 3: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); + break; + case 4: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getRequestType(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter + ); + } + f = message.getLimit(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOffset(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional KeyRequestType request_type = 2; + * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { + return this.setRequestType(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.UInt32Value limit = 3; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional google.protobuf.UInt32Value offset = 4; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentityKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + KEYS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); + msg.setKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { + var f, obj = { + keysBytesList: msg.getKeysBytesList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } +}; + + +/** + * repeated bytes keys_bytes = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes keys_bytes = 1; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + +/** + * optional Keys keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { + return this.setKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_ = [1,4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesIdsList: msg.getIdentitiesIdsList_asB64(), + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 3, ""), + purposesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIdentitiesIds(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 4: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); + for (var i = 0; i < values.length; i++) { + msg.addPurposes(values[i]); + } + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesIdsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = message.getPurposesList(); + if (f.length > 0) { + writer.writePackedEnum( + 4, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * repeated bytes identities_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes identities_ids = 1; + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIdentitiesIdsList())); +}; + + +/** + * repeated bytes identities_ids = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIdentitiesIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setIdentitiesIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addIdentitiesIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearIdentitiesIdsList = function() { + return this.setIdentitiesIdsList([]); +}; + + +/** + * optional bytes contract_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional string document_type_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearDocumentTypeName = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.hasDocumentTypeName = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated KeyPurpose purposes = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getPurposesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setPurposesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addPurposes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearPurposesList = function() { + return this.setPurposesList([]); +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentitiesContractKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITIES_KEYS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesKeys: (f = msg.getIdentitiesKeys()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader); + msg.setIdentitiesKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject = function(includeInstance, msg) { + var f, obj = { + purpose: jspb.Message.getFieldWithDefault(msg, 1, 0), + keysBytesList: msg.getKeysBytesList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (reader.readEnum()); + msg.setPurpose(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPurpose(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, + f + ); + } +}; + + +/** + * optional KeyPurpose purpose = 1; + * @return {!proto.org.dash.platform.dapi.v0.KeyPurpose} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getPurpose = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setPurpose = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * repeated bytes keys_bytes = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * repeated bytes keys_bytes = 2; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + keysList: jspb.Message.toObjectList(msg.getKeysList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader); + msg.addKeys(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getKeysList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * repeated PurposeKeys keys = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getKeysList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setKeysList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.addKeys = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.clearKeysList = function() { + return this.setKeysList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject = function(includeInstance, msg) { + var f, obj = { + entriesList: jspb.Message.toObjectList(msg.getEntriesList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader); + msg.addEntries(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntriesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated IdentityKeys entries = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.getEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.setEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.addEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.clearEntriesList = function() { + return this.setEntriesList([]); +}; + + +/** + * optional IdentitiesKeys identities_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getIdentitiesKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setIdentitiesKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearIdentitiesKeys = function() { + return this.setIdentitiesKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasIdentitiesKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentitiesContractKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.repeatedFields_ = [1,2,3,4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesList: jspb.Message.toObjectList(msg.getIdentitiesList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject, includeInstance), + contractsList: jspb.Message.toObjectList(msg.getContractsList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject, includeInstance), + documentsList: jspb.Message.toObjectList(msg.getDocumentsList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject, includeInstance), + votesList: jspb.Message.toObjectList(msg.getVotesList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader); + msg.addIdentities(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader); + msg.addContracts(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader); + msg.addDocuments(value); + break; + case 4: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinaryFromReader); + msg.addVotes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter + ); + } + f = message.getContractsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter + ); + } + f = message.getDocumentsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter + ); + } + f = message.getVotesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64(), + documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), + documentTypeKeepsHistory: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + documentId: msg.getDocumentId_asB64(), + documentContestedStatus: jspb.Message.getFieldWithDefault(msg, 5, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentType(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDocumentTypeKeepsHistory(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setDocumentId(value); + break; + case 5: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} */ (reader.readEnum()); + msg.setDocumentContestedStatus(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentType(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getDocumentTypeKeepsHistory(); + if (f) { + writer.writeBool( + 3, + f + ); + } + f = message.getDocumentId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getDocumentContestedStatus(); + if (f !== 0.0) { + writer.writeEnum( + 5, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus = { + NOT_CONTESTED: 0, + MAYBE_CONTESTED: 1, + CONTESTED: 2 +}; + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentType = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bool document_type_keeps_history = 3; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentTypeKeepsHistory = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentTypeKeepsHistory = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bytes document_id = 4; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes document_id = 4; + * This is a type-conversion wrapper around `getDocumentId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getDocumentId())); +}; + + +/** + * optional bytes document_id = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDocumentId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getDocumentId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentId = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional DocumentContestedStatus document_contested_status = 5; + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentContestedStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentContestedStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + requestType: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (reader.readEnum()); + msg.setRequestType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getRequestType(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type = { + FULL_IDENTITY: 0, + BALANCE: 1, + KEYS: 2, + REVISION: 3 +}; + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional Type request_type = 2; + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getRequestType = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setRequestType = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase = { + REQUEST_TYPE_NOT_SET: 0, + CONTESTED_RESOURCE_VOTE_STATUS_REQUEST: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.getRequestTypeCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contestedResourceVoteStatusRequest: (f = msg.getContestedResourceVoteStatusRequest()) && proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinaryFromReader); + msg.setContestedResourceVoteStatusRequest(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContestedResourceVoteStatusRequest(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + indexValuesList: msg.getIndexValuesList_asB64(), + voterIdentifier: msg.getVoterIdentifier_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIndexValues(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setVoterIdentifier(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getVoterIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string index_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated bytes index_values = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * repeated bytes index_values = 4; + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIndexValuesList())); +}; + + +/** + * repeated bytes index_values = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIndexValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.addIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.clearIndexValuesList = function() { + return this.setIndexValuesList([]); +}; + + +/** + * optional bytes voter_identifier = 5; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getVoterIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes voter_identifier = 5; + * This is a type-conversion wrapper around `getVoterIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getVoterIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getVoterIdentifier())); +}; + + +/** + * optional bytes voter_identifier = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getVoterIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getVoterIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getVoterIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setVoterIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional ContestedResourceVoteStatusRequest contested_resource_vote_status_request = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.getContestedResourceVoteStatusRequest = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.setContestedResourceVoteStatusRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.clearContestedResourceVoteStatusRequest = function() { + return this.setContestedResourceVoteStatusRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.hasContestedResourceVoteStatusRequest = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated IdentityRequest identities = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getIdentitiesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setIdentitiesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addIdentities = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearIdentitiesList = function() { + return this.setIdentitiesList([]); +}; + + +/** + * repeated ContractRequest contracts = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getContractsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setContractsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addContracts = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearContractsList = function() { + return this.setContractsList([]); +}; + + +/** + * repeated DocumentRequest documents = 3; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getDocumentsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setDocumentsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addDocuments = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearDocumentsList = function() { + return this.setDocumentsList([]); +}; + + +/** + * repeated VoteStatusRequest votes = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getVotesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setVotesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addVotes = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearVotesList = function() { + return this.setVotesList([]); +}; + + +/** + * optional GetProofsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} */ -proto.org.dash.platform.dapi.v0.Proof.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.Proof; - return proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse; + return proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.Proof} + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} */ -proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2372,28 +14230,154 @@ proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setGrovedbProof(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setQuorumHash(value); + var value = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setSignature(value); + default: + reader.skipField(); break; - case 4: - var value = /** @type {number} */ (reader.readUint32()); - msg.setRound(value); + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + PROOF: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; + return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { break; - case 5: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setBlockIdHash(value); + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; - case 6: - var value = /** @type {number} */ (reader.readUint32()); - msg.setQuorumType(value); + case 2: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -2408,9 +14392,9 @@ proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2418,258 +14402,278 @@ proto.org.dash.platform.dapi.v0.Proof.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.Proof} message + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getGrovedbProof_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getQuorumHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 2, - f - ); - } - f = message.getSignature_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f - ); - } - f = message.getRound(); - if (f !== 0) { - writer.writeUint32( - 4, - f - ); - } - f = message.getBlockIdHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 5, - f - ); - } - f = message.getQuorumType(); - if (f !== 0) { - writer.writeUint32( - 6, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes grovedb_proof = 1; - * @return {string} + * optional Proof proof = 1; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 1)); }; /** - * optional bytes grovedb_proof = 1; - * This is a type-conversion wrapper around `getGrovedbProof()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getGrovedbProof())); + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0], value); }; /** - * optional bytes grovedb_proof = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getGrovedbProof()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getGrovedbProof())); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setGrovedbProof = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional bytes quorum_hash = 2; - * @return {string} + * optional ResponseMetadata metadata = 2; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 2)); }; /** - * optional bytes quorum_hash = 2; - * This is a type-conversion wrapper around `getQuorumHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getQuorumHash())); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** - * optional bytes quorum_hash = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getQuorumHash()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getQuorumHash())); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional bytes signature = 3; - * @return {string} + * optional GetProofsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0, 1)); }; /** - * optional bytes signature = 3; - * This is a type-conversion wrapper around `getSignature()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getSignature())); + * @param {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0], value); }; /** - * optional bytes signature = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getSignature()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getSignature())); +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setSignature = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * optional uint32 round = 4; - * @return {number} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getRound = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; +proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_ = [[1]]; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * @return {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setRound = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional bytes block_id_hash = 5; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject(opt_includeInstance, this); }; /** - * optional bytes block_id_hash = 5; - * This is a type-conversion wrapper around `getBlockIdHash()` - * @return {string} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBlockIdHash())); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional bytes block_id_hash = 5; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBlockIdHash()` - * @return {!Uint8Array} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBlockIdHash())); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest; + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader(msg, reader); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setBlockIdHash = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional uint32 quorum_type = 6; - * @return {number} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumType = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumType = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter + ); + } }; @@ -2689,8 +14693,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(opt_includeInstance, this); }; @@ -2699,18 +14703,14 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - height: jspb.Message.getFieldWithDefault(msg, 1, 0), - coreChainLockedHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), - epoch: jspb.Message.getFieldWithDefault(msg, 3, 0), - timeMs: jspb.Message.getFieldWithDefault(msg, 4, 0), - protocolVersion: jspb.Message.getFieldWithDefault(msg, 5, 0), - chainId: jspb.Message.getFieldWithDefault(msg, 6, "") + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -2724,23 +14724,23 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - return proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2748,28 +14748,12 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = f var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setHeight(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCoreChainLockedHeight(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setEpoch(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setTimeMs(value); - break; - case 5: - var value = /** @type {number} */ (reader.readUint32()); - msg.setProtocolVersion(value); - break; - case 6: - var value = /** @type {string} */ (reader.readString()); - msg.setChainId(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -2784,9 +14768,9 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2794,168 +14778,154 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getHeight(); - if (f !== 0) { - writer.writeUint64( + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getCoreChainLockedHeight(); - if (f !== 0) { - writer.writeUint32( + f = message.getProve(); + if (f) { + writer.writeBool( 2, f ); } - f = message.getEpoch(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getTimeMs(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getProtocolVersion(); - if (f !== 0) { - writer.writeUint32( - 5, - f - ); - } - f = message.getChainId(); - if (f.length > 0) { - writer.writeString( - 6, - f - ); - } }; /** - * optional uint64 height = 1; - * @return {number} + * optional bytes id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setHeight = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); }; /** - * optional uint32 core_chain_locked_height = 2; - * @return {number} + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getCoreChainLockedHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setCoreChainLockedHeight = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional uint32 epoch = 3; - * @return {number} + * optional bool prove = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getEpoch = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setEpoch = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional uint64 time_ms = 4; - * @return {number} + * optional GetDataContractRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getTimeMs = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0, 1)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setTimeMs = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * optional uint32 protocol_version = 5; - * @return {number} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getProtocolVersion = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setProtocolVersion = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - +proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_ = [[1]]; /** - * optional string chain_id = 6; - * @return {string} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getChainId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setChainId = function(value) { - return jspb.Message.setProto3StringField(this, 6, value); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -2969,8 +14939,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject(opt_includeInstance, this); }; @@ -2979,15 +14949,13 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject = function(includeInstance, msg) { var f, obj = { - code: jspb.Message.getFieldWithDefault(msg, 1, 0), - message: jspb.Message.getFieldWithDefault(msg, 2, ""), - data: msg.getData_asB64() + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3001,23 +14969,23 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject = functio /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; - return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse; + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3025,16 +14993,9 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryF var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCode(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMessage(value); - break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setData(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -3049,9 +15010,9 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryF * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3059,117 +15020,52 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.serializ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getCode(); - if (f !== 0) { - writer.writeUint32( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getMessage(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getData_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f + f, + proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter ); } }; -/** - * optional uint32 code = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getCode = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setCode = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional string message = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setMessage = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional bytes data = 3; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - /** - * optional bytes data = 3; - * This is a type-conversion wrapper around `getData()` - * @return {string} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getData())); -}; - +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_ = [[1,2]]; /** - * optional bytes data = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getData()` - * @return {!Uint8Array} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getData())); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + DATA_CONTRACT: 1, + PROOF: 2 }; - /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setData = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -3183,8 +15079,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(opt_includeInstance, this); }; @@ -3193,13 +15089,15 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.toObje * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - stateTransition: msg.getStateTransition_asB64() + dataContract: msg.getDataContract_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -3213,23 +15111,23 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject = funct /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest; - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3238,7 +15136,17 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinar switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStateTransition(value); + msg.setDataContract(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -3253,9 +15161,9 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinar * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3263,162 +15171,206 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.serial /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStateTransition_asU8(); - if (f.length > 0) { + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { writer.writeBytes( 1, f ); } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; /** - * optional bytes state_transition = 1; + * optional bytes data_contract = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes state_transition = 1; - * This is a type-conversion wrapper around `getStateTransition()` + * optional bytes data_contract = 1; + * This is a type-conversion wrapper around `getDataContract()` * @return {string} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStateTransition())); + this.getDataContract())); }; /** - * optional bytes state_transition = 1; + * optional bytes data_contract = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStateTransition()` + * This is a type-conversion wrapper around `getDataContract()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStateTransition())); + this.getDataContract())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.setStateTransition = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setDataContract = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); }; +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearDataContract = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], undefined); +}; + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasDataContract = function() { + return jspb.Message.getField(this, 1) != null; +}; -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject = function(includeInstance, msg) { - var f, obj = { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; - }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse; - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional GetDataContractResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; @@ -3431,21 +15383,21 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinary * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0])); }; @@ -3463,8 +15415,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject(opt_includeInstance, this); }; @@ -3473,13 +15425,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.toObject = function * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3493,23 +15445,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject = function(includeIn /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest; + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3517,8 +15469,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -3534,9 +15486,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3544,24 +15496,31 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.serializeBinary = f /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3577,8 +15536,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(opt_includeInstance, this); }; @@ -3587,13 +15546,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototyp * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), + idsList: msg.getIdsList_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -3608,23 +15567,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3633,7 +15592,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserial switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.addIds(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -3652,9 +15611,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserial * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3662,15 +15621,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototyp /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdsList_asU8(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedBytes( 1, f ); @@ -3686,44 +15645,63 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializ /** - * optional bytes id = 1; - * @return {string} + * repeated bytes ids = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` - * @return {string} + * repeated bytes ids = 1; + * This is a type-conversion wrapper around `getIdsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIdsList())); }; /** - * optional bytes id = 1; + * repeated bytes ids = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` - * @return {!Uint8Array} + * This is a type-conversion wrapper around `getIdsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.addIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.clearIdsList = function() { + return this.setIdsList([]); }; @@ -3731,44 +15709,44 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototyp * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + * optional GetDataContractsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -3777,7 +15755,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.clearV0 = function( * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -3791,21 +15769,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0])); }; @@ -3823,8 +15801,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject(opt_includeInstance, this); }; @@ -3833,13 +15811,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3853,23 +15831,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3877,8 +15855,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -3894,9 +15872,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3904,18 +15882,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter ); } }; @@ -3937,8 +15915,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject(opt_includeInstance, this); }; @@ -3947,14 +15925,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + identifier: msg.getIdentifier_asB64(), + dataContract: (f = msg.getDataContract()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) }; if (includeInstance) { @@ -3968,23 +15946,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3993,11 +15971,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setIdentifier(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new google_protobuf_wrappers_pb.BytesValue; + reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); + msg.setDataContract(value); break; default: reader.skipField(); @@ -4012,9 +15991,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4022,114 +16001,97 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdentifier_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getDataContract(); + if (f != null) { + writer.writeMessage( 2, - f + f, + google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter ); } }; /** - * optional bytes id = 1; + * optional bytes identifier = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes identifier = 1; + * This is a type-conversion wrapper around `getIdentifier()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getIdentifier())); }; /** - * optional bytes id = 1; + * optional bytes identifier = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getIdentifier()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getIdentifier())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setIdentifier = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetIdentityBalanceRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * optional google.protobuf.BytesValue data_contract = 2; + * @return {?proto.google.protobuf.BytesValue} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getDataContract = function() { + return /** @type{?proto.google.protobuf.BytesValue} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @param {?proto.google.protobuf.BytesValue|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setDataContract = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.clearDataContract = function() { + return this.setDataContract(undefined); }; @@ -4137,36 +16099,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.hasDataContract = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} + * List of repeated fields within this message type. + * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.repeatedFields_ = [1]; @@ -4183,8 +16127,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(opt_includeInstance, this); }; @@ -4193,13 +16137,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) + dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject, includeInstance) }; if (includeInstance) { @@ -4213,23 +16158,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4237,9 +16182,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader); + msg.addDataContractEntries(value); break; default: reader.skipField(); @@ -4254,9 +16199,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4264,23 +16209,87 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getDataContractEntriesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter ); } }; +/** + * repeated DataContractEntry data_contract_entries = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.getDataContractEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.setDataContractEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.addDataContractEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.clearDataContractEntriesList = function() { + return this.setDataContractEntriesList([]); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + DATA_CONTRACTS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0])); +}; @@ -4297,8 +16306,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(opt_includeInstance, this); }; @@ -4307,14 +16316,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + dataContracts: (f = msg.getDataContracts()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -4328,23 +16338,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4352,12 +16362,19 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader); + msg.setDataContracts(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -4369,126 +16386,187 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDataContracts(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DataContracts data_contracts = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getDataContracts = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setDataContracts = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearDataContracts = function() { + return this.setDataContracts(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getProve(); - if (f) { - writer.writeBool( - 2, - f - ); - } +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasDataContracts = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional bytes id = 1; - * @return {string} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` - * @return {string} + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * optional bytes id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` - * @return {!Uint8Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * optional bool prove = 2; - * @return {boolean} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * optional GetDataContractsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4497,7 +16575,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4511,21 +16589,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0])); }; @@ -4543,8 +16621,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject(opt_includeInstance, this); }; @@ -4553,13 +16631,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = functio * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -4573,23 +16651,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeI /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4597,8 +16675,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -4614,9 +16692,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4624,50 +16702,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -4683,8 +16735,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(opt_includeInstance, this); }; @@ -4693,15 +16745,17 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + id: msg.getId_asB64(), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + startAtMs: jspb.Message.getFieldWithDefault(msg, 4, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) }; if (includeInstance) { @@ -4715,23 +16769,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObje /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4740,17 +16794,25 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + msg.setId(value); break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + case 2: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartAtMs(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -4765,9 +16827,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4775,86 +16837,119 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { + f = message.getId_asU8(); + if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProof(); + f = message.getLimit(); if (f != null) { writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter ); } - f = message.getMetadata(); + f = message.getOffset(); if (f != null) { writer.writeMessage( 3, f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getStartAtMs(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f ); } }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); + this.getId())); }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` + * This is a type-conversion wrapper around `getId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); + this.getId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * optional google.protobuf.UInt32Value limit = 2; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 2)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); }; @@ -4862,36 +16957,36 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional google.protobuf.UInt32Value offset = 3; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); }; @@ -4899,72 +16994,71 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional uint64 start_at_ms = 4; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getStartAtMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setStartAtMs = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * optional bool prove = 5; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); }; /** - * optional GetIdentityResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * optional GetDataContractHistoryRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4973,7 +17067,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4987,21 +17081,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0])); }; @@ -5019,8 +17113,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject(opt_includeInstance, this); }; @@ -5029,13 +17123,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5049,23 +17143,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5073,8 +17167,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -5090,9 +17184,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5100,18 +17194,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter ); } }; @@ -5119,11 +17213,30 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter = f /** - * List of repeated fields within this message type. - * @private {!Array} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + DATA_CONTRACT_HISTORY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0])); +}; @@ -5140,8 +17253,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(opt_includeInstance, this); }; @@ -5150,14 +17263,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - idsList: msg.getIdsList_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + dataContractHistory: (f = msg.getDataContractHistory()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -5171,23 +17285,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5195,12 +17309,19 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addIds(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader); + msg.setDataContractHistory(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -5215,9 +17336,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5225,170 +17346,39 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdsList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( + f = message.getDataContractHistory(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * repeated bytes ids = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); -}; - - -/** - * repeated bytes ids = 1; - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getIdsList())); -}; - - -/** - * repeated bytes ids = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getIdsList())); -}; - - -/** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.addIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.clearIdsList = function() { - return this.setIdsList([]); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetIdentitiesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0])); -}; @@ -5405,8 +17395,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject(opt_includeInstance, this); }; @@ -5415,13 +17405,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(includeInstance, f) + date: jspb.Message.getFieldWithDefault(msg, 1, 0), + value: msg.getValue_asB64() }; if (includeInstance) { @@ -5435,23 +17426,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5459,9 +17450,12 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setDate(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); break; default: reader.skipField(); @@ -5476,9 +17470,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5486,24 +17480,97 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDate(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional uint64 date = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getDate = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setDate = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes value = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes value = 2; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes value = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5519,8 +17586,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(opt_includeInstance, this); }; @@ -5529,13 +17596,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject = function(includeInstance, msg) { var f, obj = { - value: msg.getValue_asB64() + dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject, includeInstance) }; if (includeInstance) { @@ -5549,23 +17617,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5573,8 +17641,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader); + msg.addDataContractEntries(value); break; default: reader.skipField(); @@ -5589,9 +17658,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5599,67 +17668,237 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getValue_asU8(); + f = message.getDataContractEntriesList(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter ); } }; /** - * optional bytes value = 1; - * @return {string} + * repeated DataContractHistoryEntry data_contract_entries = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.getDataContractEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, 1)); }; /** - * optional bytes value = 1; - * This is a type-conversion wrapper around `getValue()` - * @return {string} + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.setDataContractEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.addDataContractEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, opt_index); }; /** - * optional bytes value = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.clearDataContractEntriesList = function() { + return this.setDataContractEntriesList([]); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} returns this + * optional DataContractHistory data_contract_history = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getDataContractHistory = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setDataContractHistory = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearDataContractHistory = function() { + return this.setDataContractHistory(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasDataContractHistory = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetDataContractHistoryResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -5673,8 +17912,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject(opt_includeInstance, this); }; @@ -5683,14 +17922,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject = function(includeInstance, msg) { var f, obj = { - key: msg.getKey_asB64(), - value: (f = msg.getValue()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5704,23 +17942,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest; + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5728,13 +17966,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setKey(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader); - msg.setValue(value); + var value = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -5749,9 +17983,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5759,119 +17993,52 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKey_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getValue(); + f = message.getV0(); if (f != null) { writer.writeMessage( - 2, + 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter ); } }; -/** - * optional bytes key = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes key = 1; - * This is a type-conversion wrapper around `getKey()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getKey())); -}; - - -/** - * optional bytes key = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKey()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getKey())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setKey = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - /** - * optional IdentityValue value = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getValue = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_ = [[6,7]]; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase = { + START_NOT_SET: 0, + START_AFTER: 6, + START_AT: 7 }; - /** - * Returns whether this field is set. - * @return {boolean} + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.hasValue = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0])); }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_ = [1]; - - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -5885,8 +18052,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(opt_includeInstance, this); }; @@ -5895,14 +18062,20 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObj * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject, includeInstance) + dataContractId: msg.getDataContractId_asB64(), + documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), + where: msg.getWhere_asB64(), + orderBy: msg.getOrderBy_asB64(), + limit: jspb.Message.getFieldWithDefault(msg, 5, 0), + startAfter: msg.getStartAfter_asB64(), + startAt: msg.getStartAt_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 8, false) }; if (includeInstance) { @@ -5916,23 +18089,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = func /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5940,9 +18113,36 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setDataContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentType(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setWhere(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOrderBy(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLimit(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartAfter(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartAt(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -5954,267 +18154,294 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDataContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentType(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getWhere_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getOrderBy_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getLimit(); + if (f !== 0) { + writer.writeUint32( + 5, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeBytes( + 6, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeBytes( + 7, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 8, + f + ); + } +}; + + +/** + * optional bytes data_contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes data_contract_id = 1; + * This is a type-conversion wrapper around `getDataContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getDataContractId())); +}; + + +/** + * optional bytes data_contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDataContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getDataContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDataContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional string document_type = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentityEntriesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDocumentType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * repeated IdentityEntry identity_entries = 1; - * @return {!Array} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDocumentType = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.setIdentityEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); + * optional bytes where = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * optional bytes where = 3; + * This is a type-conversion wrapper around `getWhere()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getWhere())); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this + * optional bytes where = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getWhere()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getWhere())); }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setWhere = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + /** - * @enum {number} + * optional bytes order_by = 4; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITIES: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} + * optional bytes order_by = 4; + * This is a type-conversion wrapper around `getOrderBy()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOrderBy())); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional bytes order_by = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOrderBy()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOrderBy())); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject = function(includeInstance, msg) { - var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setOrderBy = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * optional uint32 limit = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getLimit = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader); - msg.setIdentities(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional bytes start_after = 6; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional bytes start_after = 6; + * This is a type-conversion wrapper around `getStartAfter()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentities(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartAfter())); }; /** - * optional Identities identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * optional bytes start_after = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartAfter()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartAfter())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAfter = function(value) { + return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAfter = function() { + return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); }; @@ -6222,109 +18449,113 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasIdentities = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAfter = function() { + return jspb.Message.getField(this, 6) != null; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional bytes start_at = 7; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); + * optional bytes start_at = 7; + * This is a type-conversion wrapper around `getStartAt()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartAt())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * optional bytes start_at = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartAt()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartAt())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAt = function(value) { + return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAt = function() { + return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAt = function() { + return jspb.Message.getField(this, 7) != null; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * optional bool prove = 8; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 8, value); }; /** - * optional GetIdentitiesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * optional GetDocumentsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -6333,7 +18564,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6347,21 +18578,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0])); }; @@ -6379,8 +18610,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject(opt_includeInstance, this); }; @@ -6389,13 +18620,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -6409,23 +18640,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(i /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse; + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6433,8 +18664,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -6450,9 +18681,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6460,18 +18691,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter ); } }; @@ -6486,22 +18717,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWrit * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase = { RESULT_NOT_SET: 0, - BALANCE: 1, + DOCUMENTS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0])); }; @@ -6519,8 +18750,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(opt_includeInstance, this); }; @@ -6529,13 +18760,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + documents: (f = msg.getDocuments()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -6551,23 +18782,170 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader); + msg.setDocuments(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDocuments(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject = function(includeInstance, msg) { + var f, obj = { + documentsList: msg.getDocumentsList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6575,18 +18953,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addDocuments(value); break; default: reader.skipField(); @@ -6601,9 +18969,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6611,136 +18979,108 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeUint64( + f = message.getDocumentsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - -/** - * optional uint64 balance = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * repeated bytes documents = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * repeated bytes documents = 1; + * This is a type-conversion wrapper around `getDocumentsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getDocumentsList())); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes documents = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDocumentsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getDocumentsList())); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.setDocumentsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.addDocuments = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.clearDocumentsList = function() { + return this.setDocumentsList([]); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional Documents documents = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getDocuments = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setDocuments = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearDocuments = function() { + return this.setDocuments(undefined); }; @@ -6748,36 +19088,36 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasDocuments = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional GetIdentityBalanceResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -6785,147 +19125,82 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + * optional GetDocumentsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0, 1)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; @@ -6938,22 +19213,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeB * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - BALANCE_AND_REVISION: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); }; @@ -6971,8 +19245,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); }; @@ -6981,15 +19255,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { var f, obj = { - balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7003,23 +19275,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7027,19 +19299,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); - msg.setBalanceAndRevision(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -7054,9 +19316,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7064,34 +19326,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBalanceAndRevision(); + f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter ); } }; @@ -7113,8 +19359,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); }; @@ -7123,14 +19369,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), - revision: jspb.Message.getFieldWithDefault(msg, 2, 0) + publicKeyHash: msg.getPublicKeyHash_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -7144,23 +19390,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7168,12 +19414,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPublicKeyHash(value); break; case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setRevision(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -7188,9 +19434,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7198,22 +19444,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBalance(); - if (f !== 0) { - writer.writeUint64( + f = message.getPublicKeyHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getRevision(); - if (f !== 0) { - writer.writeUint64( + f = message.getProve(); + if (f) { + writer.writeBool( 2, f ); @@ -7222,103 +19468,90 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** - * optional uint64 balance = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 revision = 2; - * @return {number} + * optional bytes public_key_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this + * optional bytes public_key_hash = 1; + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublicKeyHash())); }; /** - * optional BalanceAndRevision balance_and_revision = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * optional bytes public_key_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublicKeyHash())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * optional bool prove = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { - return this.setBalanceAndRevision(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; @@ -7326,82 +19559,147 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); }; /** - * Returns whether this field is set. - * @return {boolean} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter + ); + } }; @@ -7414,23 +19712,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { - REQUEST_NOT_SET: 0, - ALL_KEYS: 1, - SPECIFIC_KEYS: 2, - SEARCH_KEY: 3 +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); }; @@ -7448,8 +19745,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); }; @@ -7458,15 +19755,15 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), - specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), - searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -7480,23 +19777,23 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstan /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; - return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7504,19 +19801,18 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.AllKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); - msg.setAllKeys(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); - msg.setSpecificKeys(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentity(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.SearchKey; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); - msg.setSearchKey(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -7531,9 +19827,9 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7541,64 +19837,86 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = funct /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAllKeys(); + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); if (f != null) { - writer.writeMessage( + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter + f ); } - f = message.getSpecificKeys(); + f = message.getProof(); if (f != null) { writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getSearchKey(); + f = message.getMetadata(); if (f != null) { writer.writeMessage( 3, f, - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional AllKeys all_keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.AllKeys} + * optional bytes identity = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentity())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * optional bytes identity = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentity()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { - return this.setAllKeys(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentity())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); }; @@ -7606,36 +19924,36 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { return jspb.Message.getField(this, 1) != null; }; /** - * optional SpecificKeys specific_keys = 2; - * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { - return this.setSpecificKeys(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -7643,36 +19961,36 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = fun * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional SearchKey search_key = 3; - * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { - return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { - return this.setSearchKey(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; @@ -7680,11 +19998,73 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; +/** + * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +}; @@ -7701,8 +20081,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); }; @@ -7711,13 +20091,13 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { var f, obj = { - + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7731,29 +20111,34 @@ proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.AllKeys; - return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; default: reader.skipField(); break; @@ -7767,9 +20152,9 @@ proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7777,22 +20162,23 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter + ); + } +}; + + @@ -7809,8 +20195,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); }; @@ -7819,13 +20205,14 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_i * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + stateTransitionHash: msg.getStateTransitionHash_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -7839,23 +20226,23 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; - return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7863,10 +20250,12 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct var field = reader.getFieldNumber(); switch (field) { case 1: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); - for (var i = 0; i < values.length; i++) { - msg.addKeyIds(values[i]); - } + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStateTransitionHash(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -7881,9 +20270,9 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7891,60 +20280,152 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = functio /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeyIdsList(); + f = message.getStateTransitionHash_asU8(); if (f.length > 0) { - writer.writePackedUint32( + writer.writeBytes( 1, f ); } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } }; /** - * repeated uint32 key_ids = 1; - * @return {!Array} + * optional bytes state_transition_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * optional bytes state_transition_hash = 1; + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStateTransitionHash())); }; /** - * @param {number} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * optional bytes state_transition_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStateTransitionHash())); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { - return this.setKeyIdsList([]); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional WaitForStateTransitionResultRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -7960,8 +20441,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); }; @@ -7970,13 +20451,13 @@ proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_incl * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { var f, obj = { - purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7990,23 +20471,23 @@ proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, m /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SearchKey; - return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8014,10 +20495,9 @@ proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function var field = reader.getFieldNumber(); switch (field) { case 1: - var value = msg.getPurposeMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); - }); + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -8032,9 +20512,9 @@ proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8042,41 +20522,49 @@ proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPurposeMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter + ); } }; + /** - * map purpose_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - proto.org.dash.platform.dapi.v0.SecurityLevelMap)); -}; - +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; /** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { - this.getPurposeMapMap().clear(); - return this;}; - +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + ERROR: 1, + PROOF: 2 +}; +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); +}; @@ -8093,8 +20581,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); }; @@ -8103,13 +20591,15 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] + error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -8123,23 +20613,23 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8147,10 +20637,19 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = f var field = reader.getFieldNumber(); switch (field) { case 1: - var value = msg.getSecurityLevelMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); - }); + var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); + msg.setError(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -8165,9 +20664,9 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8175,47 +20674,185 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getSecurityLevelMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); + f = message.getError(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); } }; /** - * @enum {number} + * optional StateTransitionBroadcastError error = 1; + * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { - CURRENT_KEY_OF_KIND_REQUEST: 0, - ALL_KEYS_OF_KIND_REQUEST: 1 +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); }; + /** - * map security_level_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - null)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { + return this.setError(undefined); }; /** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { - this.getSecurityLevelMapMap().clear(); - return this;}; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional WaitForStateTransitionResultResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; @@ -8227,21 +20864,21 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMap * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); }; @@ -8259,8 +20896,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); }; @@ -8269,13 +20906,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -8289,23 +20926,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8313,8 +20950,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -8330,9 +20967,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8340,18 +20977,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter ); } }; @@ -8373,8 +21010,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); }; @@ -8383,17 +21020,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identityId: msg.getIdentityId_asB64(), - requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), - limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -8407,23 +21041,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8431,25 +21065,10 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentityId(value); + var value = /** @type {number} */ (reader.readInt32()); + msg.setHeight(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); - msg.setRequestType(value); - break; - case 3: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setLimit(value); - break; - case 4: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setOffset(value); - break; - case 5: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -8466,9 +21085,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8476,47 +21095,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeInt32( 1, f ); } - f = message.getRequestType(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter - ); - } - f = message.getLimit(); - if (f != null) { - writer.writeMessage( - 3, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getOffset(); - if (f != null) { - writer.writeMessage( - 4, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } f = message.getProve(); if (f) { writer.writeBool( - 5, + 2, f ); } @@ -8524,200 +21119,65 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** - * optional bytes identity_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identity_id = 1; - * This is a type-conversion wrapper around `getIdentityId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentityId())); -}; - - -/** - * optional bytes identity_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentityId()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentityId())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional KeyRequestType request_type = 2; - * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { - return this.setRequestType(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional google.protobuf.UInt32Value limit = 3; - * @return {?proto.google.protobuf.UInt32Value} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); -}; - - -/** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { - return this.setLimit(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional google.protobuf.UInt32Value offset = 4; - * @return {?proto.google.protobuf.UInt32Value} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); -}; - - -/** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * optional int32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { - return this.setOffset(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { - return jspb.Message.getField(this, 4) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional bool prove = 5; + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityKeysRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * optional GetConsensusParamsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -8726,7 +21186,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = funct * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -8740,21 +21200,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = functio * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); }; @@ -8772,8 +21232,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); }; @@ -8782,13 +21242,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -8802,23 +21262,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8826,8 +21286,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -8843,9 +21303,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8853,50 +21313,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - KEYS: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -8912,8 +21346,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); }; @@ -8922,15 +21356,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { var f, obj = { - keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), + timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -8944,23 +21378,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8968,19 +21402,16 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); - msg.setKeys(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxGas(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {string} */ (reader.readString()); + msg.setTimeIotaMs(value); break; default: reader.skipField(); @@ -8995,9 +21426,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9005,46 +21436,90 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeys(); - if (f != null) { - writer.writeMessage( + f = message.getMaxBytes(); + if (f.length > 0) { + writer.writeString( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getMaxGas(); + if (f.length > 0) { + writer.writeString( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( + f = message.getTimeIotaMs(); + if (f.length > 0) { + writer.writeString( 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; +/** + * optional string max_bytes = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string max_gas = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string time_iota_ms = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + @@ -9061,8 +21536,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); }; @@ -9071,13 +21546,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { var f, obj = { - keysBytesList: msg.getKeysBytesList_asB64() + maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), + maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -9091,23 +21568,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9115,8 +21592,16 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addKeysBytes(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeNumBlocks(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeDuration(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; default: reader.skipField(); @@ -9131,9 +21616,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9141,145 +21626,243 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeysBytesList_asU8(); + f = message.getMaxAgeNumBlocks(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeString( 1, f ); } + f = message.getMaxAgeDuration(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getMaxBytes(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } }; /** - * repeated bytes keys_bytes = 1; - * @return {!Array} + * optional string max_age_num_blocks = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * repeated bytes keys_bytes = 1; - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); }; /** - * repeated bytes keys_bytes = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * optional string max_age_duration = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * optional string max_bytes = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { - return this.setKeysBytesList([]); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional Keys keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), + evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { - return this.setKeys(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); + msg.setBlock(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); + msg.setEvidence(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter + ); + } + f = message.getEvidence(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter + ); + } +}; + + +/** + * optional ConsensusParamsBlock block = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { + return this.setBlock(undefined); }; @@ -9287,36 +21870,36 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional ConsensusParamsEvidence evidence = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { + return this.setEvidence(undefined); }; @@ -9324,35 +21907,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional GetIdentityKeysResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * optional GetConsensusParamsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -9361,7 +21944,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -9375,21 +21958,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = functi * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); }; @@ -9407,8 +21990,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); }; @@ -9417,13 +22000,13 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -9437,23 +22020,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9461,8 +22044,8 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = f var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -9478,9 +22061,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9488,31 +22071,24 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.repeatedFields_ = [1,2,3]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -9528,8 +22104,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); }; @@ -9538,18 +22114,13 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identitiesList: jspb.Message.toObjectList(msg.getIdentitiesList(), - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject, includeInstance), - contractsList: jspb.Message.toObjectList(msg.getContractsList(), - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject, includeInstance), - documentsList: jspb.Message.toObjectList(msg.getDocumentsList(), - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject, includeInstance) + prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) }; if (includeInstance) { @@ -9563,23 +22134,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9587,19 +22158,8 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader); - msg.addIdentities(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader); - msg.addContracts(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader); - msg.addDocuments(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -9611,55 +22171,118 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeB /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProve(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool prove = 1; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + +/** + * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentitiesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter - ); - } - f = message.getContractsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter - ); - } - f = message.getDocumentsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -9673,8 +22296,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); }; @@ -9683,16 +22306,13 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { var f, obj = { - contractId: msg.getContractId_asB64(), - documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), - documentTypeKeepsHistory: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), - documentId: msg.getDocumentId_asB64() + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -9706,23 +22326,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9730,20 +22350,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setContractId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentType(value); - break; - case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setDocumentTypeKeepsHistory(value); - break; - case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setDocumentId(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -9758,9 +22367,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9768,163 +22377,198 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getContractId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getDocumentType(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getDocumentTypeKeepsHistory(); - if (f) { - writer.writeBool( - 3, - f - ); - } - f = message.getDocumentId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter ); } }; -/** - * optional bytes contract_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - /** - * optional bytes contract_id = 1; - * This is a type-conversion wrapper around `getContractId()` - * @return {string} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getContractId())); -}; - +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; /** - * optional bytes contract_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getContractId()` - * @return {!Uint8Array} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getContractId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VERSIONS: 1, + PROOF: 2 }; - /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setContractId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional string document_type = 2; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentType = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentType = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional bool document_type_keeps_history = 3; - * @return {boolean} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentTypeKeepsHistory = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentTypeKeepsHistory = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); + msg.setVersions(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional bytes document_id = 4; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * optional bytes document_id = 4; - * This is a type-conversion wrapper around `getDocumentId()` - * @return {string} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getDocumentId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVersions(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; -/** - * optional bytes document_id = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDocumentId()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getDocumentId())); -}; - /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); -}; - - +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; @@ -9941,8 +22585,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); }; @@ -9951,14 +22595,14 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { var f, obj = { - identityId: msg.getIdentityId_asB64(), - requestType: jspb.Message.getFieldWithDefault(msg, 2, 0) + versionsList: jspb.Message.toObjectList(msg.getVersionsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) }; if (includeInstance) { @@ -9972,23 +22616,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9996,12 +22640,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentityId(value); - break; - case 2: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (reader.readEnum()); - msg.setRequestType(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); + msg.addVersions(value); break; default: reader.skipField(); @@ -10016,9 +22657,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10026,95 +22667,58 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityId_asU8(); + f = message.getVersionsList(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedMessage( 1, - f - ); - } - f = message.getRequestType(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter ); } }; /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type = { - FULL_IDENTITY: 0, - BALANCE: 1, - KEYS: 2 -}; - -/** - * optional bytes identity_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identity_id = 1; - * This is a type-conversion wrapper around `getIdentityId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentityId())); -}; - - -/** - * optional bytes identity_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentityId()` - * @return {!Uint8Array} + * repeated VersionEntry versions = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentityId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setIdentityId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * optional Type request_type = 2; - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getRequestType = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setRequestType = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { + return this.setVersionsList([]); }; @@ -10134,8 +22738,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); }; @@ -10144,13 +22748,14 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { var f, obj = { - contractId: msg.getContractId_asB64() + versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), + voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -10164,23 +22769,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10188,8 +22793,12 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setContractId(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVersionNumber(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setVoteCount(value); break; default: reader.skipField(); @@ -10204,9 +22813,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10214,202 +22823,200 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getContractId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getVersionNumber(); + if (f !== 0) { + writer.writeUint32( 1, f ); } + f = message.getVoteCount(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } }; /** - * optional bytes contract_id = 1; - * @return {string} + * optional uint32 version_number = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional bytes contract_id = 1; - * This is a type-conversion wrapper around `getContractId()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getContractId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional bytes contract_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getContractId()` - * @return {!Uint8Array} + * optional uint32 vote_count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getContractId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.setContractId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * repeated IdentityRequest identities = 1; - * @return {!Array} + * optional Versions versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getIdentitiesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setIdentitiesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addIdentities = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { + return this.setVersions(undefined); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearIdentitiesList = function() { - return this.setIdentitiesList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * repeated ContractRequest contracts = 2; - * @return {!Array} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getContractsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, 2)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setContractsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addContracts = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearContractsList = function() { - return this.setContractsList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * repeated DocumentRequest documents = 3; - * @return {!Array} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getDocumentsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, 3)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setDocumentsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addDocuments = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearDocumentsList = function() { - return this.setDocumentsList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProofsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -10418,7 +23025,7 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.clearV0 = function() * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -10432,21 +23039,21 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.hasV0 = function() { * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); }; @@ -10464,8 +23071,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); }; @@ -10474,13 +23081,13 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.toObject = function( * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -10494,23 +23101,23 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject = function(includeIns /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse; - return proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10518,8 +23125,8 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -10535,9 +23142,9 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10545,49 +23152,24 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.serializeBinary = fu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - PROOF: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -10603,8 +23185,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); }; @@ -10613,14 +23195,15 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + startProTxHash: msg.getStartProTxHash_asB64(), + count: jspb.Message.getFieldWithDefault(msg, 2, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -10634,23 +23217,23 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; - return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10658,14 +23241,16 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartProTxHash(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -10680,9 +23265,9 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10690,129 +23275,138 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getStartProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( + f = message.getCount(); + if (f !== 0) { + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 3, + f ); } }; /** - * optional Proof proof = 1; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional bytes start_pro_tx_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0], value); + * optional bytes start_pro_tx_hash = 1; + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartProTxHash())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this + * optional bytes start_pro_tx_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartProTxHash())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional ResponseMetadata metadata = 2; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional uint32 count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 2)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this + * optional bool prove = 3; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetProofsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -10821,7 +23415,7 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.clearV0 = function() * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -10835,21 +23429,21 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.hasV0 = function() { * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); }; @@ -10867,8 +23461,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); }; @@ -10877,13 +23471,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -10897,23 +23491,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest; - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10921,8 +23515,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromRead var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -10938,9 +23532,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10948,24 +23542,50 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VERSIONS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -10981,8 +23601,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); }; @@ -10991,14 +23611,15 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -11012,23 +23633,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11036,12 +23657,19 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); + msg.setVersions(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -11056,9 +23684,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11066,151 +23694,46 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getVersions(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } -}; - - -/** - * optional bytes id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); -}; - - -/** - * optional bytes id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetDataContractRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; }; /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} + * List of repeated fields within this message type. + * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; @@ -11227,8 +23750,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); }; @@ -11237,13 +23760,14 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(includeInstance, f) + versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) }; if (includeInstance) { @@ -11257,23 +23781,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse; - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11281,9 +23805,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); + msg.addVersionSignals(value); break; default: reader.skipField(); @@ -11298,9 +23822,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11308,52 +23832,64 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getVersionSignalsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter ); } }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * repeated VersionSignal version_signals = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); +}; + /** - * @enum {number} + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - DATA_CONTRACT: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { + return this.setVersionSignalsList([]); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -11367,8 +23903,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); }; @@ -11377,15 +23913,14 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { var f, obj = { - dataContract: msg.getDataContract_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + proTxHash: msg.getProTxHash_asB64(), + version: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -11399,23 +23934,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11424,17 +23959,11 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setDataContract(value); + msg.setProTxHash(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVersion(value); break; default: reader.skipField(); @@ -11449,9 +23978,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11459,86 +23988,114 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { + f = message.getProTxHash_asU8(); + if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getVersion(); + if (f !== 0) { + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional bytes data_contract = 1; + * optional bytes pro_tx_hash = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes data_contract = 1; - * This is a type-conversion wrapper around `getDataContract()` + * optional bytes pro_tx_hash = 1; + * This is a type-conversion wrapper around `getProTxHash()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getDataContract())); + this.getProTxHash())); }; /** - * optional bytes data_contract = 1; + * optional bytes pro_tx_hash = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDataContract()` + * This is a type-conversion wrapper around `getProTxHash()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getDataContract())); + this.getProTxHash())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setDataContract = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * optional uint32 version = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearDataContract = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional VersionSignals versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { + return this.setVersions(undefined); }; @@ -11546,7 +24103,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasDataContract = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { return jspb.Message.getField(this, 1) != null; }; @@ -11555,7 +24112,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -11563,18 +24120,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -11583,7 +24140,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -11592,7 +24149,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -11600,18 +24157,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -11620,35 +24177,35 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDataContractResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} + * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -11657,7 +24214,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -11671,21 +24228,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.hasV0 = functi * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); }; @@ -11703,8 +24260,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); }; @@ -11713,13 +24270,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -11733,23 +24290,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest; - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11757,8 +24314,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -11774,9 +24331,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11784,32 +24341,25 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.repeatedFields_ = [1]; - - + if (jspb.Message.GENERATE_TO_OBJECT) { /** @@ -11824,8 +24374,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); }; @@ -11834,14 +24384,16 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - idsList: msg.getIdsList_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 2, 0), + ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) }; if (includeInstance) { @@ -11855,23 +24407,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11879,10 +24431,19 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addIds(value); + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setStartEpoch(value); break; case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAscending(value); + break; + case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -11899,9 +24460,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11909,23 +24470,38 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdsList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( + f = message.getStartEpoch(); + if (f != null) { + writer.writeMessage( 1, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getCount(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getAscending(); + if (f) { + writer.writeBool( + 3, f ); } f = message.getProve(); if (f) { writer.writeBool( - 2, + 4, f ); } @@ -11933,108 +24509,120 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV /** - * repeated bytes ids = 1; - * @return {!Array} + * optional google.protobuf.UInt32Value start_epoch = 1; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); }; /** - * repeated bytes ids = 1; - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { + return this.setStartEpoch(undefined); }; /** - * repeated bytes ids = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * optional uint32 count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.addIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * optional bool ascending = 3; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.clearIdsList = function() { - return this.setIdsList([]); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** - * optional bool prove = 2; + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bool prove = 4; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * optional GetDataContractsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} + * optional GetEpochsInfoRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -12043,7 +24631,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -12057,21 +24645,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.hasV0 = functi * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); }; @@ -12089,8 +24677,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); }; @@ -12099,13 +24687,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.toObject = fu * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -12119,23 +24707,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject = function(inc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12143,8 +24731,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromRe var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -12160,9 +24748,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromRe * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12170,24 +24758,50 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.serializeBina /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + EPOCHS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -12203,8 +24817,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); }; @@ -12213,14 +24827,15 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.proto * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - identifier: msg.getIdentifier_asB64(), - dataContract: (f = msg.getDataContract()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) + epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -12234,23 +24849,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObj /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12258,13 +24873,19 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deser var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentifier(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); + msg.setEpochs(value); break; case 2: - var value = new google_protobuf_wrappers_pb.BytesValue; - reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); - msg.setDataContract(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -12279,9 +24900,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deser * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12289,106 +24910,36 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.proto /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentifier_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getEpochs(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter ); } - f = message.getDataContract(); + f = message.getProof(); if (f != null) { writer.writeMessage( 2, f, - google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } -}; - - -/** - * optional bytes identifier = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identifier = 1; - * This is a type-conversion wrapper around `getIdentifier()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentifier())); -}; - - -/** - * optional bytes identifier = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentifier()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentifier())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setIdentifier = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional google.protobuf.BytesValue data_contract = 2; - * @return {?proto.google.protobuf.BytesValue} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getDataContract = function() { - return /** @type{?proto.google.protobuf.BytesValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); -}; - - -/** - * @param {?proto.google.protobuf.BytesValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setDataContract = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.clearDataContract = function() { - return this.setDataContract(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.hasDataContract = function() { - return jspb.Message.getField(this, 2) != null; }; @@ -12398,7 +24949,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.proto * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; @@ -12415,8 +24966,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); }; @@ -12425,14 +24976,14 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { var f, obj = { - dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject, includeInstance) + epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) }; if (includeInstance) { @@ -12446,23 +24997,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12470,9 +25021,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader); - msg.addDataContractEntries(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); + msg.addEpochInfos(value); break; default: reader.skipField(); @@ -12487,9 +25038,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12497,90 +25048,64 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractEntriesList(); + f = message.getEpochInfosList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter ); } }; /** - * repeated DataContractEntry data_contract_entries = 1; - * @return {!Array} + * repeated EpochInfo epoch_infos = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.getDataContractEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.setDataContractEntriesList = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.addDataContractEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.clearDataContractEntriesList = function() { - return this.setDataContractEntriesList([]); -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - DATA_CONTRACTS: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { + return this.setEpochInfosList([]); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -12594,8 +25119,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); }; @@ -12604,15 +25129,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { var f, obj = { - dataContracts: (f = msg.getDataContracts()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + number: jspb.Message.getFieldWithDefault(msg, 1, 0), + firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), + firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), + startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), + feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0), + protocolVersion: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -12626,23 +25154,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12650,19 +25178,28 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader); - msg.setDataContracts(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setNumber(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setFirstBlockHeight(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setFirstCoreBlockHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartTime(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setFeeMultiplier(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setProtocolVersion(value); break; default: reader.skipField(); @@ -12677,9 +25214,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12687,64 +25224,190 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContracts(); - if (f != null) { - writer.writeMessage( + f = message.getNumber(); + if (f !== 0) { + writer.writeUint32( 1, - f, - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getFirstBlockHeight(); + if (f !== 0) { + writer.writeUint64( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( + f = message.getFirstCoreBlockHeight(); + if (f !== 0) { + writer.writeUint32( 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f + ); + } + f = message.getStartTime(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getFeeMultiplier(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } + f = message.getProtocolVersion(); + if (f !== 0) { + writer.writeUint32( + 6, + f ); } }; /** - * optional DataContracts data_contracts = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + * optional uint32 number = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getDataContracts = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 first_block_height = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 first_core_block_height = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 start_time = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional double fee_multiplier = 5; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); +}; + + +/** + * optional uint32 protocol_version = 6; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getProtocolVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setProtocolVersion = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * optional EpochInfos epochs = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setDataContracts = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearDataContracts = function() { - return this.setDataContracts(undefined); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { + return this.setEpochs(undefined); }; @@ -12752,7 +25415,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasDataContracts = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { return jspb.Message.getField(this, 1) != null; }; @@ -12761,7 +25424,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -12769,18 +25432,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -12789,7 +25452,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -12798,7 +25461,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -12806,18 +25469,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -12826,35 +25489,35 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDataContractsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} + * optional GetEpochsInfoResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -12863,7 +25526,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.clearV0 = fun * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -12877,21 +25540,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.hasV0 = funct * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_[0])); }; @@ -12909,8 +25572,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.toObject(opt_includeInstance, this); }; @@ -12919,13 +25582,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -12939,23 +25602,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject = functio /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12963,8 +25626,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryF var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -12980,9 +25643,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryF * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12990,24 +25653,31 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.serializ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.repeatedFields_ = [4,5]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -13023,8 +25693,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.toObject(opt_includeInstance, this); }; @@ -13033,17 +25703,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - startAtMs: jspb.Message.getFieldWithDefault(msg, 4, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + startIndexValuesList: msg.getStartIndexValuesList_asB64(), + endIndexValuesList: msg.getEndIndexValuesList_asB64(), + startAtValueInfo: (f = msg.getStartAtValueInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 7, 0), + orderAscending: jspb.Message.getBooleanFieldWithDefault(msg, 8, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 9, false) }; if (includeInstance) { @@ -13057,23 +25731,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13082,25 +25756,214 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setContractId(value); break; case 2: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setLimit(value); + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); break; case 3: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setOffset(value); + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); break; case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setStartAtMs(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addStartIndexValues(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addEndIndexValues(value); + break; + case 6: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinaryFromReader); + msg.setStartAtValueInfo(value); + break; + case 7: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOrderAscending(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getStartIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getEndIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 5, + f + ); + } + f = message.getStartAtValueInfo(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeUint32( + 7, + f + ); + } + f = message.getOrderAscending(); + if (f) { + writer.writeBool( + 8, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 9, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.toObject = function(includeInstance, msg) { + var f, obj = { + startValue: msg.getStartValue_asB64(), + startValueIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartValue(value); break; - case 5: + case 2: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setStartValueIncluded(value); break; default: reader.skipField(); @@ -13115,9 +25978,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13125,46 +25988,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getStartValue_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getLimit(); - if (f != null) { - writer.writeMessage( - 2, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getOffset(); - if (f != null) { - writer.writeMessage( - 3, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getStartAtMs(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getProve(); + f = message.getStartValueIncluded(); if (f) { writer.writeBool( - 5, + 2, f ); } @@ -13172,109 +26012,290 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis /** - * optional bytes id = 1; + * optional bytes start_value = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValue = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes start_value = 1; + * This is a type-conversion wrapper around `getStartValue()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValue_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getStartValue())); }; /** - * optional bytes id = 1; + * optional bytes start_value = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getStartValue()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValue_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getStartValue())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.setStartValue = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional google.protobuf.UInt32Value limit = 2; - * @return {?proto.google.protobuf.UInt32Value} + * optional bool start_value_included = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getLimit = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValueIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.setStartValueIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * optional bytes contract_id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearLimit = function() { - return this.setLimit(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasLimit = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); }; /** - * optional google.protobuf.UInt32Value offset = 3; - * @return {?proto.google.protobuf.UInt32Value} + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getOffset = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string index_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated bytes start_index_values = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * repeated bytes start_index_values = 4; + * This is a type-conversion wrapper around `getStartIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getStartIndexValuesList())); +}; + + +/** + * repeated bytes start_index_values = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getStartIndexValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setStartIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.addStartIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearStartIndexValuesList = function() { + return this.setStartIndexValuesList([]); +}; + + +/** + * repeated bytes end_index_values = 5; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getEndIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * repeated bytes end_index_values = 5; + * This is a type-conversion wrapper around `getEndIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getEndIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getEndIndexValuesList())); +}; + + +/** + * repeated bytes end_index_values = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getEndIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getEndIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getEndIndexValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setEndIndexValuesList = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.addEndIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearEndIndexValuesList = function() { + return this.setEndIndexValuesList([]); +}; + + +/** + * optional StartAtValueInfo start_at_value_info = 6; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartAtValueInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo, 6)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setOffset = function(value) { - return jspb.Message.setWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setStartAtValueInfo = function(value) { + return jspb.Message.setWrapperField(this, 6, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearOffset = function() { - return this.setOffset(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearStartAtValueInfo = function() { + return this.setStartAtValueInfo(undefined); }; @@ -13282,71 +26303,107 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasOffset = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.hasStartAtValueInfo = function() { + return jspb.Message.getField(this, 6) != null; }; /** - * optional uint64 start_at_ms = 4; + * optional uint32 count = 7; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getStartAtMs = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setStartAtMs = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setCount = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearCount = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.hasCount = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional bool order_ascending = 8; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getOrderAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setOrderAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 8, value); }; /** - * optional bool prove = 5; + * optional bool prove = 9; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 9, value); }; /** - * optional GetDataContractHistoryRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} + * optional GetContestedResourcesRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -13355,7 +26412,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.clearV0 * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -13369,21 +26426,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.hasV0 = * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_[0])); }; @@ -13401,8 +26458,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.toObject(opt_includeInstance, this); }; @@ -13411,13 +26468,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.toObjec * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -13431,23 +26488,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject = functi /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13455,8 +26512,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -13472,9 +26529,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13482,18 +26539,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.seriali /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.serializeBinaryToWriter ); } }; @@ -13508,22 +26565,22 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryTo * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase = { RESULT_NOT_SET: 0, - DATA_CONTRACT_HISTORY: 1, + CONTESTED_RESOURCE_VALUES: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_[0])); }; @@ -13541,8 +26598,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.toObject(opt_includeInstance, this); }; @@ -13551,13 +26608,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - dataContractHistory: (f = msg.getDataContractHistory()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(includeInstance, f), + contestedResourceValues: (f = msg.getContestedResourceValues()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -13573,23 +26630,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13597,9 +26654,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader); - msg.setDataContractHistory(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinaryFromReader); + msg.setContestedResourceValues(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -13624,9 +26681,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13634,18 +26691,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractHistory(); + f = message.getContestedResourceValues(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.serializeBinaryToWriter ); } f = message.getProof(); @@ -13661,193 +26718,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi writer.writeMessage( 3, f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject = function(includeInstance, msg) { - var f, obj = { - date: jspb.Message.getFieldWithDefault(msg, 1, 0), - value: msg.getValue_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setDate(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getDate(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getValue_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } -}; - - -/** - * optional uint64 date = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getDate = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setDate = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional bytes value = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes value = 2; - * This is a type-conversion wrapper around `getValue()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); -}; - - -/** - * optional bytes value = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; @@ -13857,7 +26730,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.repeatedFields_ = [1]; @@ -13874,8 +26747,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.toObject(opt_includeInstance, this); }; @@ -13884,14 +26757,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.toObject = function(includeInstance, msg) { var f, obj = { - dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject, includeInstance) + contestedResourceValuesList: msg.getContestedResourceValuesList_asB64() }; if (includeInstance) { @@ -13905,23 +26777,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13929,9 +26801,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader); - msg.addDataContractEntries(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addContestedResourceValues(value); break; default: reader.skipField(); @@ -13946,9 +26817,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13956,86 +26827,108 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractEntriesList(); + f = message.getContestedResourceValuesList_asU8(); if (f.length > 0) { - writer.writeRepeatedMessage( + writer.writeRepeatedBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter + f ); } }; /** - * repeated DataContractHistoryEntry data_contract_entries = 1; - * @return {!Array} + * repeated bytes contested_resource_values = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.getDataContractEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.getContestedResourceValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.setDataContractEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); + * repeated bytes contested_resource_values = 1; + * This is a type-conversion wrapper around `getContestedResourceValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.getContestedResourceValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getContestedResourceValuesList())); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry=} opt_value + * repeated bytes contested_resource_values = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContestedResourceValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.getContestedResourceValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getContestedResourceValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.setContestedResourceValuesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.addDataContractEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.addContestedResourceValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.clearDataContractEntriesList = function() { - return this.setDataContractEntriesList([]); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.clearContestedResourceValuesList = function() { + return this.setContestedResourceValuesList([]); }; /** - * optional DataContractHistory data_contract_history = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} + * optional ContestedResourceValues contested_resource_values = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getDataContractHistory = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getContestedResourceValues = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setDataContractHistory = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.setContestedResourceValues = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearDataContractHistory = function() { - return this.setDataContractHistory(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.clearContestedResourceValues = function() { + return this.setContestedResourceValues(undefined); }; @@ -14043,7 +26936,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasDataContractHistory = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.hasContestedResourceValues = function() { return jspb.Message.getField(this, 1) != null; }; @@ -14052,7 +26945,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -14060,18 +26953,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -14080,7 +26973,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -14089,7 +26982,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -14097,18 +26990,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -14117,76 +27010,366 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDataContractHistoryResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + * optional GetContestedResourcesResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0, 1)); -}; - +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + startTimeInfo: (f = msg.getStartTimeInfo()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.toObject(includeInstance, f), + endTimeInfo: (f = msg.getEndTimeInfo()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.toObject(includeInstance, f), + limit: jspb.Message.getFieldWithDefault(msg, 3, 0), + offset: jspb.Message.getFieldWithDefault(msg, 4, 0), + ascending: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) + }; -/** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0], value); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinaryFromReader); + msg.setStartTimeInfo(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinaryFromReader); + msg.setEndTimeInfo(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLimit(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint32()); + msg.setOffset(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAscending(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_ = [[1]]; - /** - * @enum {number} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStartTimeInfo(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.serializeBinaryToWriter + ); + } + f = message.getEndTimeInfo(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint32( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeUint32( + 4, + f + ); + } + f = message.getAscending(); + if (f) { + writer.writeBool( + 5, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 6, + f + ); + } }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -14200,8 +27383,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.toObject(opt_includeInstance, this); }; @@ -14210,13 +27393,14 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.toObject = functio * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(includeInstance, f) + startTimeMs: jspb.Message.getFieldWithDefault(msg, 1, 0), + startTimeIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -14230,23 +27414,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject = function(includeI /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest; - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -14254,9 +27438,12 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartTimeMs(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setStartTimeIncluded(value); break; default: reader.skipField(); @@ -14271,9 +27458,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -14281,52 +27468,68 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getStartTimeMs(); + if (f !== 0) { + writer.writeUint64( 1, - f, - proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter + f + ); + } + f = message.getStartTimeIncluded(); + if (f) { + writer.writeBool( + 2, + f ); } }; +/** + * optional uint64 start_time_ms = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.getStartTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_ = [[6,7]]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.setStartTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + /** - * @enum {number} + * optional bool start_time_included = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase = { - START_NOT_SET: 0, - START_AFTER: 6, - START_AT: 7 +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.getStartTimeIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.setStartTimeIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -14340,8 +27543,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.toObject(opt_includeInstance, this); }; @@ -14350,20 +27553,14 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.protot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.toObject = function(includeInstance, msg) { var f, obj = { - dataContractId: msg.getDataContractId_asB64(), - documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), - where: msg.getWhere_asB64(), - orderBy: msg.getOrderBy_asB64(), - limit: jspb.Message.getFieldWithDefault(msg, 5, 0), - startAfter: msg.getStartAfter_asB64(), - startAt: msg.getStartAt_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 8, false) + endTimeMs: jspb.Message.getFieldWithDefault(msg, 1, 0), + endTimeIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -14377,23 +27574,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObje /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -14401,36 +27598,12 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deseri var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setDataContractId(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setEndTimeMs(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentType(value); - break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setWhere(value); - break; - case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setOrderBy(value); - break; - case 5: - var value = /** @type {number} */ (reader.readUint32()); - msg.setLimit(value); - break; - case 6: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartAfter(value); - break; - case 7: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartAt(value); - break; - case 8: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setEndTimeIncluded(value); break; default: reader.skipField(); @@ -14445,9 +27618,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deseri * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -14455,65 +27628,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.protot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getDocumentType(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getWhere_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f - ); - } - f = message.getOrderBy_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f - ); - } - f = message.getLimit(); + f = message.getEndTimeMs(); if (f !== 0) { - writer.writeUint32( - 5, - f - ); - } - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); - if (f != null) { - writer.writeBytes( - 6, - f - ); - } - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 7)); - if (f != null) { - writer.writeBytes( - 7, + writer.writeUint64( + 1, f ); } - f = message.getProve(); + f = message.getEndTimeIncluded(); if (f) { writer.writeBool( - 8, + 2, f ); } @@ -14521,215 +27652,139 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serial /** - * optional bytes data_contract_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes data_contract_id = 1; - * This is a type-conversion wrapper around `getDataContractId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getDataContractId())); -}; - - -/** - * optional bytes data_contract_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDataContractId()` - * @return {!Uint8Array} + * optional uint64 end_time_ms = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getDataContractId())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.getEndTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDataContractId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.setEndTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional string document_type = 2; - * @return {string} + * optional bool end_time_included = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDocumentType = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.getEndTimeIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDocumentType = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.setEndTimeIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional bytes where = 3; - * @return {string} + * optional StartAtTimeInfo start_time_info = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getStartTimeInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo, 1)); }; /** - * optional bytes where = 3; - * This is a type-conversion wrapper around `getWhere()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getWhere())); + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setStartTimeInfo = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** - * optional bytes where = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getWhere()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getWhere())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearStartTimeInfo = function() { + return this.setStartTimeInfo(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setWhere = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasStartTimeInfo = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional bytes order_by = 4; - * @return {string} + * optional EndAtTimeInfo end_time_info = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getEndTimeInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo, 2)); }; /** - * optional bytes order_by = 4; - * This is a type-conversion wrapper around `getOrderBy()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getOrderBy())); + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setEndTimeInfo = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** - * optional bytes order_by = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getOrderBy()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getOrderBy())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearEndTimeInfo = function() { + return this.setEndTimeInfo(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setOrderBy = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasEndTimeInfo = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional uint32 limit = 5; + * optional uint32 limit = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getLimit = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getLimit = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional bytes start_after = 6; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); -}; - - -/** - * optional bytes start_after = 6; - * This is a type-conversion wrapper around `getStartAfter()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartAfter())); -}; - - -/** - * optional bytes start_after = 6; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartAfter()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartAfter())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAfter = function(value) { - return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setField(this, 3, value); }; /** * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAfter = function() { - return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearLimit = function() { + return jspb.Message.setField(this, 3, undefined); }; @@ -14737,113 +27792,107 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.protot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAfter = function() { - return jspb.Message.getField(this, 6) != null; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional bytes start_at = 7; - * @return {string} + * optional uint32 offset = 4; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getOffset = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** - * optional bytes start_at = 7; - * This is a type-conversion wrapper around `getStartAt()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartAt())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setField(this, 4, value); }; /** - * optional bytes start_at = 7; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartAt()` - * @return {!Uint8Array} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartAt())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearOffset = function() { + return jspb.Message.setField(this, 4, undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAt = function(value) { - return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 4) != null; }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * optional bool ascending = 5; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAt = function() { - return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAt = function() { - return jspb.Message.getField(this, 7) != null; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); }; /** - * optional bool prove = 8; + * optional bool prove = 6; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 8, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); }; /** - * optional GetDocumentsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} + * optional GetVotePollsByEndDateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -14852,7 +27901,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.clearV0 = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -14866,21 +27915,21 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_[0])); }; @@ -14898,8 +27947,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.toObject(opt_includeInstance, this); }; @@ -14908,13 +27957,13 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -14928,23 +27977,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse; - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -14952,8 +28001,8 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -14969,9 +28018,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -14979,18 +28028,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.serializeBinaryToWriter ); } }; @@ -15005,22 +28054,22 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter = f * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase = { RESULT_NOT_SET: 0, - DOCUMENTS: 1, + VOTE_POLLS_BY_TIMESTAMPS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_[0])); }; @@ -15038,8 +28087,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.toObject(opt_includeInstance, this); }; @@ -15048,13 +28097,13 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - documents: (f = msg.getDocuments()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(includeInstance, f), + votePollsByTimestamps: (f = msg.getVotePollsByTimestamps()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -15070,23 +28119,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15094,9 +28143,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader); - msg.setDocuments(value); + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinaryFromReader); + msg.setVotePollsByTimestamps(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -15121,9 +28170,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15131,18 +28180,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDocuments(); + f = message.getVotePollsByTimestamps(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.serializeBinaryToWriter ); } f = message.getProof(); @@ -15170,7 +28219,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.seri * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.repeatedFields_ = [2]; @@ -15187,8 +28236,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.toObject(opt_includeInstance, this); }; @@ -15197,13 +28246,14 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.toObject = function(includeInstance, msg) { var f, obj = { - documentsList: msg.getDocumentsList_asB64() + timestamp: jspb.Message.getFieldWithDefault(msg, 1, 0), + serializedVotePollsList: msg.getSerializedVotePollsList_asB64() }; if (includeInstance) { @@ -15217,23 +28267,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15241,8 +28291,12 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu var field = reader.getFieldNumber(); switch (field) { case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setTimestamp(value); + break; + case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addDocuments(value); + msg.addSerializedVotePolls(value); break; default: reader.skipField(); @@ -15257,9 +28311,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15267,16 +28321,236 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDocumentsList_asU8(); + f = message.getTimestamp(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getSerializedVotePollsList_asU8(); if (f.length > 0) { writer.writeRepeatedBytes( + 2, + f + ); + } +}; + + +/** + * optional uint64 timestamp = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getTimestamp = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.setTimestamp = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated bytes serialized_vote_polls = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getSerializedVotePollsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * repeated bytes serialized_vote_polls = 2; + * This is a type-conversion wrapper around `getSerializedVotePollsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getSerializedVotePollsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getSerializedVotePollsList())); +}; + + +/** + * repeated bytes serialized_vote_polls = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSerializedVotePollsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getSerializedVotePollsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getSerializedVotePollsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.setSerializedVotePollsList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.addSerializedVotePolls = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.clearSerializedVotePollsList = function() { + return this.setSerializedVotePollsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.toObject = function(includeInstance, msg) { + var f, obj = { + votePollsByTimestampsList: jspb.Message.toObjectList(msg.getVotePollsByTimestampsList(), + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.toObject, includeInstance), + finishedResults: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinaryFromReader); + msg.addVotePollsByTimestamps(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFinishedResults(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVotePollsByTimestampsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serializeBinaryToWriter + ); + } + f = message.getFinishedResults(); + if (f) { + writer.writeBool( + 2, f ); } @@ -15284,91 +28558,86 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu /** - * repeated bytes documents = 1; - * @return {!Array} + * repeated SerializedVotePollsByTimestamp vote_polls_by_timestamps = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.getVotePollsByTimestampsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp, 1)); }; /** - * repeated bytes documents = 1; - * This is a type-conversion wrapper around `getDocumentsList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getDocumentsList())); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} returns this +*/ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.setVotePollsByTimestampsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * repeated bytes documents = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDocumentsList()` - * @return {!Array} + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getDocumentsList())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.addVotePollsByTimestamps = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp, opt_index); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.setDocumentsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.clearVotePollsByTimestampsList = function() { + return this.setVotePollsByTimestampsList([]); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this + * optional bool finished_results = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.addDocuments = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.getFinishedResults = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.clearDocumentsList = function() { - return this.setDocumentsList([]); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.setFinishedResults = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional Documents documents = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} + * optional SerializedVotePollsByTimestamps vote_polls_by_timestamps = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getDocuments = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getVotePollsByTimestamps = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setDocuments = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.setVotePollsByTimestamps = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearDocuments = function() { - return this.setDocuments(undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.clearVotePollsByTimestamps = function() { + return this.setVotePollsByTimestamps(undefined); }; @@ -15376,7 +28645,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasDocuments = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.hasVotePollsByTimestamps = function() { return jspb.Message.getField(this, 1) != null; }; @@ -15385,7 +28654,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -15393,18 +28662,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -15413,7 +28682,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -15422,7 +28691,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -15430,18 +28699,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -15450,35 +28719,35 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDocumentsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + * optional GetVotePollsByEndDateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -15487,7 +28756,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -15501,21 +28770,21 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_[0])); }; @@ -15533,8 +28802,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.toObject(opt_includeInstance, this); }; @@ -15543,13 +28812,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -15563,23 +28832,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15587,8 +28856,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -15604,9 +28873,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15614,30 +28883,249 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + indexValuesList: msg.getIndexValuesList_asB64(), + resultType: jspb.Message.getFieldWithDefault(msg, 5, 0), + allowIncludeLockedAndAbstainingVoteTally: jspb.Message.getBooleanFieldWithDefault(msg, 6, false), + startAtIdentifierInfo: (f = msg.getStartAtIdentifierInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 8, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 9, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIndexValues(value); + break; + case 5: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} */ (reader.readEnum()); + msg.setResultType(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAllowIncludeLockedAndAbstainingVoteTally(value); + break; + case 7: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader); + msg.setStartAtIdentifierInfo(value); + break; + case 8: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getResultType(); + if (f !== 0.0) { + writer.writeEnum( + 5, + f + ); + } + f = message.getAllowIncludeLockedAndAbstainingVoteTally(); + if (f) { + writer.writeBool( + 6, + f + ); + } + f = message.getStartAtIdentifierInfo(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeUint32( + 8, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 9, + f ); } }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType = { + DOCUMENTS: 0, + VOTE_TALLY: 1, + DOCUMENTS_AND_VOTE_TALLY: 2 +}; + @@ -15654,8 +29142,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.toObject(opt_includeInstance, this); }; @@ -15664,14 +29152,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHashesList: msg.getPublicKeyHashesList_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + startIdentifier: msg.getStartIdentifier_asB64(), + startIdentifierIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -15685,23 +29173,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15710,11 +29198,11 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addPublicKeyHashes(value); + msg.setStartIdentifier(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setStartIdentifierIncluded(value); break; default: reader.skipField(); @@ -15729,9 +29217,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15739,20 +29227,20 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHashesList_asU8(); + f = message.getStartIdentifier_asU8(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeBytes( 1, f ); } - f = message.getProve(); + f = message.getStartIdentifierIncluded(); if (f) { writer.writeBool( 2, @@ -15763,118 +29251,504 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** - * repeated bytes public_key_hashes = 1; + * optional bytes start_identifier = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_identifier = 1; + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartIdentifier())); +}; + + +/** + * optional bytes start_identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool start_identifier_included = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifierIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifierIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string index_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated bytes index_values = 4; * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); }; /** - * repeated bytes public_key_hashes = 1; - * This is a type-conversion wrapper around `getPublicKeyHashesList()` + * repeated bytes index_values = 4; + * This is a type-conversion wrapper around `getIndexValuesList()` * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexValuesList_asB64 = function() { return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getPublicKeyHashesList())); + this.getIndexValuesList())); }; /** - * repeated bytes public_key_hashes = 1; + * repeated bytes index_values = 4; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHashesList()` + * This is a type-conversion wrapper around `getIndexValuesList()` * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexValuesList_asU8 = function() { return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getPublicKeyHashesList())); + this.getIndexValuesList())); }; /** * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setPublicKeyHashesList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); }; /** * @param {!(string|Uint8Array)} value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.addPublicKeyHashes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.addIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.clearIndexValuesList = function() { + return this.setIndexValuesList([]); +}; + + +/** + * optional ResultType result_type = 5; + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getResultType = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setResultType = function(value) { + return jspb.Message.setProto3EnumField(this, 5, value); +}; + + +/** + * optional bool allow_include_locked_and_abstaining_vote_tally = 6; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getAllowIncludeLockedAndAbstainingVoteTally = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setAllowIncludeLockedAndAbstainingVoteTally = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); +}; + + +/** + * optional StartAtIdentifierInfo start_at_identifier_info = 7; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getStartAtIdentifierInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo, 7)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setStartAtIdentifierInfo = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.clearStartAtIdentifierInfo = function() { + return this.setStartAtIdentifierInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.hasStartAtIdentifierInfo = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional uint32 count = 8; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setCount = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.clearCount = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.hasCount = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional bool prove = 9; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 9, value); +}; + + +/** + * optional GetContestedResourceVoteStateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.clearPublicKeyHashesList = function() { - return this.setPublicKeyHashesList([]); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional bool prove = 2; - * @return {boolean} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.toObject(opt_includeInstance, this); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional GetIdentitiesByPublicKeyHashesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0], value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.serializeBinaryToWriter + ); + } }; @@ -15887,21 +29761,22 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + CONTESTED_RESOURCE_CONTENDERS: 1, + PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_[0])); }; @@ -15919,8 +29794,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.toObject(opt_includeInstance, this); }; @@ -15929,13 +29804,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(includeInstance, f) + contestedResourceContenders: (f = msg.getContestedResourceContenders()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -15949,23 +29826,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15973,9 +29850,19 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinaryFromReader); + msg.setContestedResourceContenders(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -15990,9 +29877,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16000,18 +29887,34 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getContestedResourceContenders(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; @@ -16033,8 +29936,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.toObject(opt_includeInstance, this); }; @@ -16043,14 +29946,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - value: (f = msg.getValue()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) + finishedVoteOutcome: jspb.Message.getFieldWithDefault(msg, 1, 0), + wonByIdentityId: msg.getWonByIdentityId_asB64(), + finishedAtBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), + finishedAtCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 4, 0), + finishedAtBlockTimeMs: jspb.Message.getFieldWithDefault(msg, 5, 0), + finishedAtEpoch: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -16064,23 +29971,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16088,13 +29995,28 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} */ (reader.readEnum()); + msg.setFinishedVoteOutcome(value); break; case 2: - var value = new google_protobuf_wrappers_pb.BytesValue; - reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); - msg.setValue(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setWonByIdentityId(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFinishedAtBlockHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFinishedAtCoreBlockHeight(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFinishedAtBlockTimeMs(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFinishedAtEpoch(value); break; default: reader.skipField(); @@ -16109,9 +30031,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16119,106 +30041,213 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getFinishedVoteOutcome(); + if (f !== 0.0) { + writer.writeEnum( 1, f ); } - f = message.getValue(); + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); if (f != null) { - writer.writeMessage( + writer.writeBytes( 2, - f, - google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter + f + ); + } + f = message.getFinishedAtBlockHeight(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getFinishedAtCoreBlockHeight(); + if (f !== 0) { + writer.writeUint32( + 4, + f + ); + } + f = message.getFinishedAtBlockTimeMs(); + if (f !== 0) { + writer.writeUint64( + 5, + f + ); + } + f = message.getFinishedAtEpoch(); + if (f !== 0) { + writer.writeUint32( + 6, + f ); } }; /** - * optional bytes public_key_hash = 1; + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome = { + TOWARDS_IDENTITY: 0, + LOCKED: 1, + NO_PREVIOUS_WINNER: 2 +}; + +/** + * optional FinishedVoteOutcome finished_vote_outcome = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedVoteOutcome = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedVoteOutcome = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional bytes won_by_identity_id = 2; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getWonByIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` + * optional bytes won_by_identity_id = 2; + * This is a type-conversion wrapper around `getWonByIdentityId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getWonByIdentityId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); + this.getWonByIdentityId())); }; /** - * optional bytes public_key_hash = 1; + * optional bytes won_by_identity_id = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` + * This is a type-conversion wrapper around `getWonByIdentityId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getWonByIdentityId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); + this.getWonByIdentityId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setWonByIdentityId = function(value) { + return jspb.Message.setField(this, 2, value); }; /** - * optional google.protobuf.BytesValue value = 2; - * @return {?proto.google.protobuf.BytesValue} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getValue = function() { - return /** @type{?proto.google.protobuf.BytesValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.clearWonByIdentityId = function() { + return jspb.Message.setField(this, 2, undefined); }; /** - * @param {?proto.google.protobuf.BytesValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.hasWonByIdentityId = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * optional uint64 finished_at_block_height = 3; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.hasValue = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint32 finished_at_core_block_height = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtCoreBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtCoreBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional uint64 finished_at_block_time_ms = 5; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtBlockTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtBlockTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional uint32 finished_at_epoch = 6; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtEpoch = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtEpoch = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); }; @@ -16228,7 +30257,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.repeatedFields_ = [1]; @@ -16245,8 +30274,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.toObject(opt_includeInstance, this); }; @@ -16255,14 +30284,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject, includeInstance) + contendersList: jspb.Message.toObjectList(msg.getContendersList(), + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.toObject, includeInstance), + abstainVoteTally: jspb.Message.getFieldWithDefault(msg, 2, 0), + lockVoteTally: jspb.Message.getFieldWithDefault(msg, 3, 0), + finishedVoteInfo: (f = msg.getFinishedVoteInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.toObject(includeInstance, f) }; if (includeInstance) { @@ -16276,23 +30308,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16300,9 +30332,22 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinaryFromReader); + msg.addContenders(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbstainVoteTally(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLockVoteTally(value); + break; + case 4: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinaryFromReader); + msg.setFinishedVoteInfo(value); break; default: reader.skipField(); @@ -16317,9 +30362,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16327,90 +30372,195 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityEntriesList(); + f = message.getContendersList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeUint32( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint32( + 3, + f + ); + } + f = message.getFinishedVoteInfo(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.serializeBinaryToWriter ); } }; /** - * repeated PublicKeyHashIdentityEntry identity_entries = 1; - * @return {!Array} + * repeated Contender contenders = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getContendersList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.setIdentityEntriesList = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setContendersList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.addContenders = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearContendersList = function() { + return this.setContendersList([]); }; +/** + * optional uint32 abstain_vote_tally = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getAbstainVoteTally = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setAbstainVoteTally = function(value) { + return jspb.Message.setField(this, 2, value); +}; + /** - * @enum {number} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITIES: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearAbstainVoteTally = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.hasAbstainVoteTally = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint32 lock_vote_tally = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getLockVoteTally = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setLockVoteTally = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearLockVoteTally = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.hasLockVoteTally = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional FinishedVoteInfo finished_vote_info = 4; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getFinishedVoteInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo, 4)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setFinishedVoteInfo = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearFinishedVoteInfo = function() { + return this.setFinishedVoteInfo(undefined); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.hasFinishedVoteInfo = function() { + return jspb.Message.getField(this, 4) != null; }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -16424,8 +30574,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.toObject(opt_includeInstance, this); }; @@ -16434,15 +30584,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.toObject = function(includeInstance, msg) { var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + identifier: msg.getIdentifier_asB64(), + voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0), + document: msg.getDocument_asB64() }; if (includeInstance) { @@ -16456,23 +30606,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16480,19 +30630,16 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader); - msg.setIdentities(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentifier(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVoteCount(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setDocument(value); break; default: reader.skipField(); @@ -16507,9 +30654,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16517,101 +30664,102 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentities(); - if (f != null) { - writer.writeMessage( + f = message.getIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter + f ); } - f = message.getProof(); + f = /** @type {number} */ (jspb.Message.getField(message, 2)); if (f != null) { - writer.writeMessage( + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 3)); if (f != null) { - writer.writeMessage( + writer.writeBytes( 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional IdentitiesByPublicKeyHashes identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * optional bytes identifier = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); + * optional bytes identifier = 1; + * This is a type-conversion wrapper around `getIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentifier())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * optional bytes identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentifier()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentifier())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasIdentities = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.setIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional uint32 vote_count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getVoteCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.setVoteCount = function(value) { + return jspb.Message.setField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.clearVoteCount = function() { + return jspb.Message.setField(this, 2, undefined); }; @@ -16619,36 +30767,59 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.hasVoteCount = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional bytes document = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getDocument = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * optional bytes document = 3; + * This is a type-conversion wrapper around `getDocument()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getDocument_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getDocument())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * optional bytes document = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDocument()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getDocument_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getDocument())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.setDocument = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.clearDocument = function() { + return jspb.Message.setField(this, 3, undefined); }; @@ -16656,36 +30827,36 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.hasDocument = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentitiesByPublicKeyHashesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * optional ContestedResourceContenders contested_resource_contenders = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getContestedResourceContenders = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.setContestedResourceContenders = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.clearContestedResourceContenders = function() { + return this.setContestedResourceContenders(undefined); }; @@ -16693,151 +30864,148 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.hasContestedResourceContenders = function() { return jspb.Message.getField(this, 1) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_[0], value); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * optional GetContestedResourceVoteStateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0, 1)); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -16853,8 +31021,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.toObject(opt_includeInstance, this); }; @@ -16863,14 +31031,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -16884,23 +31051,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16908,12 +31075,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -16928,9 +31092,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16938,151 +31102,30 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getProve(); - if (f) { - writer.writeBool( - 2, - f - ); - } -}; - - -/** - * optional bytes public_key_hash = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); -}; - - -/** - * optional bytes public_key_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.serializeBinaryToWriter + ); + } }; + + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.repeatedFields_ = [4]; @@ -17099,8 +31142,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.toObject(opt_includeInstance, this); }; @@ -17109,13 +31152,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toO * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + indexValuesList: msg.getIndexValuesList_asB64(), + contestantId: msg.getContestantId_asB64(), + startAtIdentifierInfo: (f = msg.getStartAtIdentifierInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 7, 0), + orderAscending: jspb.Message.getBooleanFieldWithDefault(msg, 8, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 9, false) }; if (includeInstance) { @@ -17129,23 +31180,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = fu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17153,9 +31204,41 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIndexValues(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContestantId(value); + break; + case 6: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader); + msg.setStartAtIdentifierInfo(value); + break; + case 7: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOrderAscending(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -17170,9 +31253,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17180,50 +31263,80 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.ser /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getContestantId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getStartAtIdentifierInfo(); if (f != null) { writer.writeMessage( - 1, + 6, f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeUint32( + 7, + f + ); + } + f = message.getOrderAscending(); + if (f) { + writer.writeBool( + 8, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 9, + f ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17239,8 +31352,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.toObject(opt_includeInstance, this); }; @@ -17249,15 +31362,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + startIdentifier: msg.getStartIdentifier_asB64(), + startIdentifierIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -17271,23 +31383,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17296,17 +31408,11 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + msg.setStartIdentifier(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setStartIdentifierIncluded(value); break; default: reader.skipField(); @@ -17318,210 +31424,308 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** - * Serializes the message to binary data (in protobuf wire format). + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStartIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getStartIdentifierIncluded(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes start_identifier = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_identifier = 1; + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartIdentifier())); +}; + + +/** + * optional bytes start_identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool start_identifier_included = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifierIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifierIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeBytes( - 1, - f - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bytes identity = 1; + * optional string document_type_name = 2; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` - * @return {string} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * optional bytes identity = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` - * @return {!Uint8Array} + * optional string index_name = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * repeated bytes index_values = 4; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes index_values = 4; + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIndexValuesList())); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * repeated bytes index_values = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIndexValuesList())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.addIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.clearIndexValuesList = function() { + return this.setIndexValuesList([]); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional bytes contestant_id = 5; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContestantId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * optional bytes contestant_id = 5; + * This is a type-conversion wrapper around `getContestantId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContestantId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContestantId())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * optional bytes contestant_id = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContestantId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContestantId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContestantId())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setContestantId = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); }; /** - * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * optional StartAtIdentifierInfo start_at_identifier_info = 6; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getStartAtIdentifierInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo, 6)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setStartAtIdentifierInfo = function(value) { + return jspb.Message.setWrapperField(this, 6, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.clearStartAtIdentifierInfo = function() { + return this.setStartAtIdentifierInfo(undefined); }; @@ -17529,151 +31733,146 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.cle * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.hasStartAtIdentifierInfo = function() { + return jspb.Message.getField(this, 6) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * optional uint32 count = 7; + * @return {number} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + /** - * @enum {number} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setCount = function(value) { + return jspb.Message.setField(this, 7, value); }; + /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.clearCount = function() { + return jspb.Message.setField(this, 7, undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.hasCount = function() { + return jspb.Message.getField(this, 7) != null; +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional bool order_ascending = 8; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getOrderAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) - }; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setOrderAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 8, value); +}; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + +/** + * optional bool prove = 9; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 9, value); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * optional GetContestedResourceVotersForIdentityRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0, 1)); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17689,8 +31888,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.toObject(opt_includeInstance, this); }; @@ -17699,14 +31898,13 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.toObject = function(includeInstance, msg) { var f, obj = { - stateTransitionHash: msg.getStateTransitionHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -17720,23 +31918,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17744,12 +31942,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStateTransitionHash(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -17764,9 +31959,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17774,126 +31969,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStateTransitionHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getProve(); - if (f) { - writer.writeBool( - 2, - f + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.serializeBinaryToWriter ); } }; -/** - * optional bytes state_transition_hash = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes state_transition_hash = 1; - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStateTransitionHash())); -}; - - -/** - * optional bytes state_transition_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStateTransitionHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional WaitForStateTransitionResultRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - /** * Oneof group definitions for this message. Each group defines the field @@ -17903,21 +31995,22 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.ha * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + CONTESTED_RESOURCE_VOTERS: 1, + PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_[0])); }; @@ -17935,8 +32028,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.toObject(opt_includeInstance, this); }; @@ -17945,13 +32038,15 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) + contestedResourceVoters: (f = msg.getContestedResourceVoters()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -17965,23 +32060,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17989,9 +32084,19 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinaryFromReader); + msg.setContestedResourceVoters(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -18006,9 +32111,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18016,49 +32121,46 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getContestedResourceVoters(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - ERROR: 1, - PROOF: 2 -}; + + /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.repeatedFields_ = [1]; @@ -18075,8 +32177,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.toObject(opt_includeInstance, this); }; @@ -18085,15 +32187,14 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.toObject = function(includeInstance, msg) { var f, obj = { - error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + votersList: msg.getVotersList_asB64(), + finishedResults: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -18107,23 +32208,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18131,19 +32232,12 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); - msg.setError(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addVoters(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFinishedResults(value); break; default: reader.skipField(); @@ -18158,9 +32252,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18168,64 +32262,133 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getError(); - if (f != null) { - writer.writeMessage( + f = message.getVotersList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, - f, - proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getFinishedResults(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional StateTransitionBroadcastError error = 1; - * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * repeated bytes voters = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getVotersList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * repeated bytes voters = 1; + * This is a type-conversion wrapper around `getVotersList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getVotersList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getVotersList())); +}; + + +/** + * repeated bytes voters = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getVotersList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getVotersList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getVotersList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.setVotersList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.addVoters = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.clearVotersList = function() { + return this.setVotersList([]); +}; + + +/** + * optional bool finished_results = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getFinishedResults = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.setFinishedResults = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional ContestedResourceVoters contested_resource_voters = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getContestedResourceVoters = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.setContestedResourceVoters = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { - return this.setError(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.clearContestedResourceVoters = function() { + return this.setContestedResourceVoters(undefined); }; @@ -18233,7 +32396,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.hasContestedResourceVoters = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18242,7 +32405,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -18250,18 +32413,18 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -18270,7 +32433,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -18279,7 +32442,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -18287,18 +32450,18 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -18307,35 +32470,35 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional WaitForStateTransitionResultResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * optional GetContestedResourceVotersForIdentityResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -18344,7 +32507,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18358,25 +32521,139 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.serializeBinaryToWriter + ); + } }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -18390,8 +32667,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.toObject(opt_includeInstance, this); }; @@ -18400,13 +32677,18 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) + identityId: msg.getIdentityId_asB64(), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + orderAscending: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), + startAtVotePollIdInfo: (f = msg.getStartAtVotePollIdInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.toObject(includeInstance, f), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) }; if (includeInstance) { @@ -18420,23 +32702,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18444,9 +32726,31 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); + break; + case 3: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOrderAscending(value); + break; + case 5: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinaryFromReader); + msg.setStartAtVotePollIdInfo(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -18461,9 +32765,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18471,18 +32775,55 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getLimit(); if (f != null) { writer.writeMessage( - 1, + 2, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOffset(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOrderAscending(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getStartAtVotePollIdInfo(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.serializeBinaryToWriter + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 6, + f ); } }; @@ -18504,8 +32845,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.toObject(opt_includeInstance, this); }; @@ -18514,14 +32855,14 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.toObject = function(includeInstance, msg) { var f, obj = { - height: jspb.Message.getFieldWithDefault(msg, 1, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + startAtPollIdentifier: msg.getStartAtPollIdentifier_asB64(), + startPollIdentifierIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -18535,23 +32876,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18559,12 +32900,12 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setHeight(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartAtPollIdentifier(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setStartPollIdentifierIncluded(value); break; default: reader.skipField(); @@ -18579,9 +32920,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18589,20 +32930,20 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getHeight(); - if (f !== 0) { - writer.writeInt32( + f = message.getStartAtPollIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getProve(); + f = message.getStartPollIdentifierIncluded(); if (f) { writer.writeBool( 2, @@ -18613,66 +32954,224 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** - * optional int32 height = 1; - * @return {number} + * optional bytes start_at_poll_identifier = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartAtPollIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_at_poll_identifier = 1; + * This is a type-conversion wrapper around `getStartAtPollIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartAtPollIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartAtPollIdentifier())); +}; + + +/** + * optional bytes start_at_poll_identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartAtPollIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartAtPollIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartAtPollIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.setStartAtPollIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool start_poll_identifier_included = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartPollIdentifierIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.setStartPollIdentifierIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional google.protobuf.UInt32Value limit = 2; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 2)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.UInt32Value offset = 3; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional bool prove = 2; + * optional bool order_ascending = 4; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getOrderAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setOrderAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * optional GetConsensusParamsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * optional StartAtVotePollIdInfo start_at_vote_poll_id_info = 5; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getStartAtVotePollIdInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo, 5)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setStartAtVotePollIdInfo = function(value) { + return jspb.Message.setWrapperField(this, 5, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.clearStartAtVotePollIdInfo = function() { + return this.setStartAtVotePollIdInfo(undefined); }; @@ -18680,153 +33179,94 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.hasStartAtVotePollIdInfo = function() { + return jspb.Message.getField(this, 5) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * optional bool prove = 6; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + /** - * @enum {number} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} + * optional GetContestedResourceIdentityVotesRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0, 1)); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_[0], value); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_ = [[1]]; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -18840,8 +33280,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.toObject(opt_includeInstance, this); }; @@ -18850,15 +33290,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.toObject = function(includeInstance, msg) { var f, obj = { - maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), - timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -18872,23 +33310,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18896,16 +33334,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxGas(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setTimeIotaMs(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -18920,9 +33351,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18930,93 +33361,52 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getMaxGas(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getTimeIotaMs(); - if (f.length > 0) { - writer.writeString( - 3, - f + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.serializeBinaryToWriter ); } }; -/** - * optional string max_bytes = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_gas = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_ = [[1,2]]; /** - * optional string time_iota_ms = 3; - * @return {string} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VOTES: 1, + PROOF: 2 }; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -19030,8 +33420,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.toObject(opt_includeInstance, this); }; @@ -19040,15 +33430,15 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), - maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") + votes: (f = msg.getVotes()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -19062,23 +33452,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19086,16 +33476,19 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeNumBlocks(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinaryFromReader); + msg.setVotes(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeDuration(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -19110,9 +33503,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19120,90 +33513,46 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxAgeNumBlocks(); - if (f.length > 0) { - writer.writeString( + f = message.getVotes(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.serializeBinaryToWriter ); } - f = message.getMaxAgeDuration(); - if (f.length > 0) { - writer.writeString( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 3, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * optional string max_age_num_blocks = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_age_duration = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string max_bytes = 3; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.repeatedFields_ = [1]; @@ -19220,8 +33569,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.toObject(opt_includeInstance, this); }; @@ -19230,14 +33579,15 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.toObject = function(includeInstance, msg) { var f, obj = { - block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), - evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) + contestedResourceIdentityVotesList: jspb.Message.toObjectList(msg.getContestedResourceIdentityVotesList(), + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.toObject, includeInstance), + finishedResults: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -19251,23 +33601,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19275,14 +33625,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); - msg.setBlock(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinaryFromReader); + msg.addContestedResourceIdentityVotes(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); - msg.setEvidence(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFinishedResults(value); break; default: reader.skipField(); @@ -19297,9 +33646,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19307,170 +33656,89 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock(); - if (f != null) { - writer.writeMessage( + f = message.getContestedResourceIdentityVotesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serializeBinaryToWriter ); } - f = message.getEvidence(); - if (f != null) { - writer.writeMessage( + f = message.getFinishedResults(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter + f ); } }; /** - * optional ConsensusParamsBlock block = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { - return this.setBlock(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional ConsensusParamsEvidence evidence = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { - return this.setEvidence(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional GetConsensusParamsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * repeated ContestedResourceIdentityVote contested_resource_identity_votes = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.getContestedResourceIdentityVotesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.setContestedResourceIdentityVotesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.addContestedResourceIdentityVotes = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.clearContestedResourceIdentityVotesList = function() { + return this.setContestedResourceIdentityVotesList([]); }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; - /** - * @enum {number} + * optional bool finished_results = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.getFinishedResults = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.setFinishedResults = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -19484,8 +33752,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.toObject(opt_includeInstance, this); }; @@ -19494,13 +33762,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) + voteChoiceType: jspb.Message.getFieldWithDefault(msg, 1, 0), + identityId: msg.getIdentityId_asB64() }; if (includeInstance) { @@ -19514,23 +33783,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19538,9 +33807,12 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} */ (reader.readEnum()); + msg.setVoteChoiceType(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); break; default: reader.skipField(); @@ -19555,9 +33827,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19565,23 +33837,123 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getVoteChoiceType(); + if (f !== 0.0) { + writer.writeEnum( 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f ); } }; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType = { + TOWARDS_IDENTITY: 0, + ABSTAIN: 1, + LOCK: 2 +}; + +/** + * optional VoteChoiceType vote_choice_type = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getVoteChoiceType = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.setVoteChoiceType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional bytes identity_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes identity_id = 2; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.setIdentityId = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.clearIdentityId = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.hasIdentityId = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.repeatedFields_ = [3]; @@ -19598,8 +33970,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.toObject(opt_includeInstance, this); }; @@ -19608,13 +33980,16 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.toObject = function(includeInstance, msg) { var f, obj = { - prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + serializedIndexStorageValuesList: msg.getSerializedIndexStorageValuesList_asB64(), + voteChoice: (f = msg.getVoteChoice()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.toObject(includeInstance, f) }; if (includeInstance) { @@ -19628,23 +34003,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19652,8 +34027,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addSerializedIndexStorageValues(value); + break; + case 4: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinaryFromReader); + msg.setVoteChoice(value); break; default: reader.skipField(); @@ -19668,9 +34056,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19678,65 +34066,190 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getSerializedIndexStorageValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 3, + f + ); + } + f = message.getVoteChoice(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.serializeBinaryToWriter + ); + } }; /** - * optional bool prove = 1; - * @return {boolean} + * optional bytes contract_id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * repeated bytes serialized_index_storage_values = 3; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getSerializedIndexStorageValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * repeated bytes serialized_index_storage_values = 3; + * This is a type-conversion wrapper around `getSerializedIndexStorageValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getSerializedIndexStorageValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getSerializedIndexStorageValuesList())); +}; + + +/** + * repeated bytes serialized_index_storage_values = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSerializedIndexStorageValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getSerializedIndexStorageValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getSerializedIndexStorageValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setSerializedIndexStorageValuesList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.addSerializedIndexStorageValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.clearSerializedIndexStorageValuesList = function() { + return this.setSerializedIndexStorageValuesList([]); }; /** - * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * optional ResourceVoteChoice vote_choice = 4; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getVoteChoice = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice, 4)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setVoteChoice = function(value) { + return jspb.Message.setWrapperField(this, 4, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.clearVoteChoice = function() { + return this.setVoteChoice(undefined); }; @@ -19744,325 +34257,184 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.hasVoteChoice = function() { + return jspb.Message.getField(this, 4) != null; }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; - /** - * @enum {number} + * optional ContestedResourceIdentityVotes votes = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getVotes = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes, 1)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.setVotes = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_[0], value); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.clearVotes = function() { + return this.setVotes(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.hasVotes = function() { + return jspb.Message.getField(this, 1) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; - /** - * @enum {number} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - VERSIONS: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { - var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * optional GetContestedResourceIdentityVotesResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0, 1)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); - msg.setVersions(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getVersions(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * List of repeated fields within this message type. - * @private {!Array} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_[0])); +}; @@ -20079,8 +34451,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.toObject(opt_includeInstance, this); }; @@ -20089,14 +34461,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.toObject = function(includeInstance, msg) { var f, obj = { - versionsList: jspb.Message.toObjectList(msg.getVersionsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20110,23 +34481,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20134,9 +34505,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); - msg.addVersions(value); + var value = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -20151,9 +34522,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20161,61 +34532,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.serializeBinaryToWriter ); } }; -/** - * repeated VersionEntry versions = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { - return this.setVersionsList([]); -}; - - @@ -20232,8 +34565,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.toObject(opt_includeInstance, this); }; @@ -20242,14 +34575,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), - voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -20263,23 +34596,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20287,12 +34620,12 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVersionNumber(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVoteCount(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -20307,9 +34640,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20317,200 +34650,113 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getVoteCount(); - if (f !== 0) { - writer.writeUint32( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f - ); - } -}; - - -/** - * optional uint32 version_number = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint32 vote_count = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional Versions versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { - return this.setVersions(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); + f + ); + } }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * optional bytes id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * optional bool prove = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * optional GetPrefundedSpecializedBalanceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20519,7 +34765,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20533,21 +34779,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_[0])); }; @@ -20565,8 +34811,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.toObject(opt_includeInstance, this); }; @@ -20575,13 +34821,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20595,23 +34841,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObj /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20619,8 +34865,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -20636,9 +34882,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20646,24 +34892,50 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -20679,8 +34951,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.toObject(opt_includeInstance, this); }; @@ -20689,15 +34961,15 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - startProTxHash: msg.getStartProTxHash_asB64(), - count: jspb.Message.getFieldWithDefault(msg, 2, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -20711,23 +34983,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20735,16 +35007,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartProTxHash(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCount(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -20759,9 +35033,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20769,138 +35043,172 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( 1, f ); } - f = message.getCount(); - if (f !== 0) { - writer.writeUint32( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 3, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes start_pro_tx_hash = 1; - * @return {string} + * optional uint64 balance = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional bytes start_pro_tx_hash = 1; - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartProTxHash())); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.setBalance = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0], value); }; /** - * optional bytes start_pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {!Uint8Array} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartProTxHash())); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.clearBalance = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0], undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.hasBalance = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional uint32 count = 2; - * @return {number} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * optional bool prove = 3; + * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetPrefundedSpecializedBalanceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20909,7 +35217,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20923,21 +35231,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_[0])); }; @@ -20955,8 +35263,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.toObject(opt_includeInstance, this); }; @@ -20965,13 +35273,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20985,23 +35293,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21009,8 +35317,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21026,9 +35334,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21036,50 +35344,24 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - VERSIONS: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -21095,8 +35377,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.toObject(opt_includeInstance, this); }; @@ -21105,15 +35387,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) }; if (includeInstance) { @@ -21127,23 +35407,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21151,19 +35431,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); - msg.setVersions(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -21178,9 +35447,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21188,46 +35457,102 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersions(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; +/** + * optional bool prove = 1; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + +/** + * optional GetTotalCreditsInPlatformRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_[0])); +}; @@ -21244,8 +35569,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.toObject(opt_includeInstance, this); }; @@ -21254,14 +35579,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.toObject = function(includeInstance, msg) { var f, obj = { - versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -21275,23 +35599,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21299,9 +35623,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); - msg.addVersionSignals(value); + var value = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -21316,9 +35640,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21326,64 +35650,52 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionSignalsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.serializeBinaryToWriter ); } }; -/** - * repeated VersionSignal version_signals = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); -}; - /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_ = [[1,2]]; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + CREDITS: 1, + PROOF: 2 }; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this + * @return {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { - return this.setVersionSignalsList([]); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -21397,8 +35709,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.toObject(opt_includeInstance, this); }; @@ -21407,14 +35719,15 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - proTxHash: msg.getProTxHash_asB64(), - version: jspb.Message.getFieldWithDefault(msg, 2, 0) + credits: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -21428,23 +35741,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21452,12 +35765,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setCredits(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVersion(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -21472,9 +35791,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21482,114 +35801,62 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( 1, f ); } - f = message.getVersion(); - if (f !== 0) { - writer.writeUint32( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes pro_tx_hash = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes pro_tx_hash = 1; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); -}; - - -/** - * optional bytes pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional uint32 version = 2; + * optional uint64 credits = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getCredits = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional VersionSignals versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.setCredits = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { - return this.setVersions(undefined); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.clearCredits = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0], undefined); }; @@ -21597,7 +35864,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.hasCredits = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21606,7 +35873,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -21614,18 +35881,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -21634,7 +35901,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -21643,7 +35910,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -21651,18 +35918,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -21671,35 +35938,35 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * optional GetTotalCreditsInPlatformResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -21708,7 +35975,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21722,21 +35989,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0])); }; @@ -21754,8 +36021,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject(opt_includeInstance, this); }; @@ -21764,13 +36031,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -21784,23 +36051,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21808,8 +36075,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21825,9 +36092,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21835,24 +36102,31 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_ = [1,2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -21868,8 +36142,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(opt_includeInstance, this); }; @@ -21878,16 +36152,15 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - count: jspb.Message.getFieldWithDefault(msg, 2, 0), - ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) + pathList: msg.getPathList_asB64(), + keysList: msg.getKeysList_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -21901,23 +36174,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21925,19 +36198,14 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setStartEpoch(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addPath(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCount(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeys(value); break; case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setAscending(value); - break; - case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -21954,9 +36222,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21964,38 +36232,30 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartEpoch(); - if (f != null) { - writer.writeMessage( + f = message.getPathList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getCount(); - if (f !== 0) { - writer.writeUint32( - 2, f ); } - f = message.getAscending(); - if (f) { - writer.writeBool( - 3, + f = message.getKeysList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, f ); } f = message.getProve(); if (f) { writer.writeBool( - 4, + 3, f ); } @@ -22003,120 +36263,169 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.seri /** - * optional google.protobuf.UInt32Value start_epoch = 1; - * @return {?proto.google.protobuf.UInt32Value} + * repeated bytes path = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes path = 1; + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getPathList())); +}; + + +/** + * repeated bytes path = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getPathList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setPathList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addPath = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { - return jspb.Message.setWrapperField(this, 1, value); + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearPathList = function() { + return this.setPathList([]); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * repeated bytes keys = 2; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { - return this.setStartEpoch(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes keys = 2; + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysList())); }; /** - * optional uint32 count = 2; - * @return {number} + * repeated bytes keys = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setKeysList = function(value) { + return jspb.Message.setField(this, 2, value || []); }; /** - * optional bool ascending = 3; - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addKeys = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearKeysList = function() { + return this.setKeysList([]); }; /** - * optional bool prove = 4; + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetEpochsInfoRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * optional GetPathElementsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22125,7 +36434,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22139,21 +36448,21 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0])); }; @@ -22171,8 +36480,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject(opt_includeInstance, this); }; @@ -22181,13 +36490,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -22201,23 +36510,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22225,8 +36534,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -22242,9 +36551,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22252,18 +36561,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter ); } }; @@ -22278,22 +36587,22 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase = { RESULT_NOT_SET: 0, - EPOCHS: 1, + ELEMENTS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0])); }; @@ -22311,8 +36620,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(opt_includeInstance, this); }; @@ -22321,13 +36630,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), + elements: (f = msg.getElements()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -22343,23 +36652,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.to /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22367,157 +36676,19 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.de var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); - msg.setEpochs(value); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader); + msg.setElements(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); msg.setProof(value); break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getEpochs(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { - var f, obj = { - epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); - msg.addEpochInfos(value); + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -22532,9 +36703,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22542,61 +36713,46 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getEpochInfosList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getElements(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * repeated EpochInfo epoch_infos = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); -}; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { - return this.setEpochInfosList([]); -}; - - +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_ = [1]; @@ -22613,8 +36769,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(opt_includeInstance, this); }; @@ -22623,17 +36779,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject = function(includeInstance, msg) { var f, obj = { - number: jspb.Message.getFieldWithDefault(msg, 1, 0), - firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), - firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), - startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), - feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + elementsList: msg.getElementsList_asB64() }; if (includeInstance) { @@ -22647,23 +36799,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22671,24 +36823,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setNumber(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setFirstBlockHeight(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setFirstCoreBlockHeight(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setStartTime(value); - break; - case 5: - var value = /** @type {number} */ (reader.readDouble()); - msg.setFeeMultiplier(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addElements(value); break; default: reader.skipField(); @@ -22703,9 +36839,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22713,165 +36849,108 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getElementsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, f ); } - f = message.getFirstBlockHeight(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getFirstCoreBlockHeight(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getStartTime(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getFeeMultiplier(); - if (f !== 0.0) { - writer.writeDouble( - 5, - f - ); - } -}; - - -/** - * optional uint32 number = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 first_block_height = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional uint32 first_core_block_height = 3; - * @return {number} + * repeated bytes elements = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * repeated bytes elements = 1; + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getElementsList())); }; /** - * optional uint64 start_time = 4; - * @return {number} + * repeated bytes elements = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getElementsList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.setElementsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** - * optional double fee_multiplier = 5; - * @return {number} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.addElements = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.clearElementsList = function() { + return this.setElementsList([]); }; /** - * optional EpochInfos epochs = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} + * optional Elements elements = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getElements = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setElements = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { - return this.setEpochs(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearElements = function() { + return this.setElements(undefined); }; @@ -22879,7 +36958,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasElements = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22888,7 +36967,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -22896,18 +36975,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -22916,7 +36995,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -22925,7 +37004,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -22933,18 +37012,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -22953,35 +37032,35 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetEpochsInfoResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * optional GetPathElementsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22990,9 +37069,20 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.KeyPurpose = { + AUTHENTICATION: 0, + ENCRYPTION: 1, + DECRYPTION: 2, + TRANSFER: 3, + VOTING: 5 +}; + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h index 6939dd72dc5..371160b0306 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h @@ -34,6 +34,26 @@ CF_EXTERN_C_BEGIN @class GetConsensusParamsResponse_ConsensusParamsBlock; @class GetConsensusParamsResponse_ConsensusParamsEvidence; @class GetConsensusParamsResponse_GetConsensusParamsResponseV0; +@class GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0; +@class GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo; +@class GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0; +@class GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote; +@class GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes; +@class GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice; +@class GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0; +@class GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo; +@class GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0; +@class GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender; +@class GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders; +@class GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo; +@class GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0; +@class GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo; +@class GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0; +@class GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters; +@class GetContestedResourcesRequest_GetContestedResourcesRequestV0; +@class GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo; +@class GetContestedResourcesResponse_GetContestedResourcesResponseV0; +@class GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues; @class GetDataContractHistoryRequest_GetDataContractHistoryRequestV0; @class GetDataContractHistoryResponse_GetDataContractHistoryResponseV0; @class GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory; @@ -51,15 +71,11 @@ CF_EXTERN_C_BEGIN @class GetEpochsInfoResponse_GetEpochsInfoResponseV0; @class GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo; @class GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos; -@class GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0; -@class GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0; -@class GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes; -@class GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry; -@class GetIdentitiesRequest_GetIdentitiesRequestV0; -@class GetIdentitiesResponse_GetIdentitiesResponseV0; -@class GetIdentitiesResponse_Identities; -@class GetIdentitiesResponse_IdentityEntry; -@class GetIdentitiesResponse_IdentityValue; +@class GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys; @class GetIdentityBalanceAndRevisionRequest_GetIdentityBalanceAndRevisionRequestV0; @class GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevisionResponseV0; @class GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevisionResponseV0_BalanceAndRevision; @@ -67,15 +83,26 @@ CF_EXTERN_C_BEGIN @class GetIdentityBalanceResponse_GetIdentityBalanceResponseV0; @class GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0; @class GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0; +@class GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0; +@class GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0; @class GetIdentityKeysRequest_GetIdentityKeysRequestV0; @class GetIdentityKeysResponse_GetIdentityKeysResponseV0; @class GetIdentityKeysResponse_GetIdentityKeysResponseV0_Keys; +@class GetIdentityNonceRequest_GetIdentityNonceRequestV0; +@class GetIdentityNonceResponse_GetIdentityNonceResponseV0; @class GetIdentityRequest_GetIdentityRequestV0; @class GetIdentityResponse_GetIdentityResponseV0; +@class GetPathElementsRequest_GetPathElementsRequestV0; +@class GetPathElementsResponse_GetPathElementsResponseV0; +@class GetPathElementsResponse_GetPathElementsResponseV0_Elements; +@class GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0; +@class GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0; @class GetProofsRequest_GetProofsRequestV0; @class GetProofsRequest_GetProofsRequestV0_ContractRequest; @class GetProofsRequest_GetProofsRequestV0_DocumentRequest; @class GetProofsRequest_GetProofsRequestV0_IdentityRequest; +@class GetProofsRequest_GetProofsRequestV0_VoteStatusRequest; +@class GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest; @class GetProofsResponse_GetProofsResponseV0; @class GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0; @class GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0; @@ -85,6 +112,14 @@ CF_EXTERN_C_BEGIN @class GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0; @class GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal; @class GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals; +@class GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0; +@class GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0; +@class GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0; +@class GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo; +@class GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo; +@class GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0; +@class GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp; +@class GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps; @class KeyRequestType; @class Proof; @class ResponseMetadata; @@ -97,6 +132,30 @@ CF_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN +#pragma mark - Enum KeyPurpose + +typedef GPB_ENUM(KeyPurpose) { + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + KeyPurpose_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + KeyPurpose_Authentication = 0, + KeyPurpose_Encryption = 1, + KeyPurpose_Decryption = 2, + KeyPurpose_Transfer = 3, + KeyPurpose_Voting = 5, +}; + +GPBEnumDescriptor *KeyPurpose_EnumDescriptor(void); + +/** + * Checks to see if the given value is defined by the enum or was not known at + * the time this source was generated. + **/ +BOOL KeyPurpose_IsValidValue(int32_t value); + #pragma mark - Enum SecurityLevelMap_KeyKindRequestType typedef GPB_ENUM(SecurityLevelMap_KeyKindRequestType) { @@ -106,7 +165,10 @@ typedef GPB_ENUM(SecurityLevelMap_KeyKindRequestType) { * of the field. **/ SecurityLevelMap_KeyKindRequestType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + /** Request the current key of a particular kind */ SecurityLevelMap_KeyKindRequestType_CurrentKeyOfKindRequest = 0, + + /** Request all keys of a particular kind */ SecurityLevelMap_KeyKindRequestType_AllKeysOfKindRequest = 1, }; @@ -118,6 +180,28 @@ GPBEnumDescriptor *SecurityLevelMap_KeyKindRequestType_EnumDescriptor(void); **/ BOOL SecurityLevelMap_KeyKindRequestType_IsValidValue(int32_t value); +#pragma mark - Enum GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus) { + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_NotContested = 0, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_MaybeContested = 1, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_Contested = 2, +}; + +GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_EnumDescriptor(void); + +/** + * Checks to see if the given value is defined by the enum or was not known at + * the time this source was generated. + **/ +BOOL GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_IsValidValue(int32_t value); + #pragma mark - Enum GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type) { @@ -127,9 +211,17 @@ typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type) { * of the field. **/ GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + /** Request for the full identity */ GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity = 0, + + /** Request for the identity's balance */ GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance = 1, + + /** Request for the identity's keys */ GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys = 2, + + /** Request for the identity's revision */ + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Revision = 3, }; GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor(void); @@ -140,6 +232,72 @@ GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Enum **/ BOOL GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue(int32_t value); +#pragma mark - Enum GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType + +typedef GPB_ENUM(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType) { + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_Documents = 0, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_VoteTally = 1, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_DocumentsAndVoteTally = 2, +}; + +GPBEnumDescriptor *GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_EnumDescriptor(void); + +/** + * Checks to see if the given value is defined by the enum or was not known at + * the time this source was generated. + **/ +BOOL GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_IsValidValue(int32_t value); + +#pragma mark - Enum GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome) { + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_TowardsIdentity = 0, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_Locked = 1, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_NoPreviousWinner = 2, +}; + +GPBEnumDescriptor *GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_EnumDescriptor(void); + +/** + * Checks to see if the given value is defined by the enum or was not known at + * the time this source was generated. + **/ +BOOL GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_IsValidValue(int32_t value); + +#pragma mark - Enum GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType) { + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_TowardsIdentity = 0, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_Abstain = 1, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_Lock = 2, +}; + +GPBEnumDescriptor *GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_EnumDescriptor(void); + +/** + * Checks to see if the given value is defined by the enum or was not known at + * the time this source was generated. + **/ +BOOL GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_IsValidValue(int32_t value); + #pragma mark - PlatformRoot /** @@ -166,18 +324,27 @@ typedef GPB_ENUM(Proof_FieldNumber) { Proof_FieldNumber_QuorumType = 6, }; +/** + * Proof message includes cryptographic proofs for validating responses + **/ GPB_FINAL @interface Proof : GPBMessage +/** GroveDB proof for the data */ @property(nonatomic, readwrite, copy, null_resettable) NSData *grovedbProof; +/** Hash of the quorum validating the data */ @property(nonatomic, readwrite, copy, null_resettable) NSData *quorumHash; +/** Signature proving data authenticity */ @property(nonatomic, readwrite, copy, null_resettable) NSData *signature; +/** Consensus round number */ @property(nonatomic, readwrite) uint32_t round; +/** Hash of the block ID */ @property(nonatomic, readwrite, copy, null_resettable) NSData *blockIdHash; +/** Type of the quorum */ @property(nonatomic, readwrite) uint32_t quorumType; @end @@ -193,18 +360,27 @@ typedef GPB_ENUM(ResponseMetadata_FieldNumber) { ResponseMetadata_FieldNumber_ChainId = 6, }; +/** + * ResponseMetadata provides metadata about the blockchain state at the time of response + **/ GPB_FINAL @interface ResponseMetadata : GPBMessage +/** Current blockchain height */ @property(nonatomic, readwrite) uint64_t height; +/** Latest known core height in consensus */ @property(nonatomic, readwrite) uint32_t coreChainLockedHeight; +/** Current epoch number */ @property(nonatomic, readwrite) uint32_t epoch; +/** Timestamp in milliseconds */ @property(nonatomic, readwrite) uint64_t timeMs; +/** Protocol version */ @property(nonatomic, readwrite) uint32_t protocolVersion; +/** Identifier of the blockchain */ @property(nonatomic, readwrite, copy, null_resettable) NSString *chainId; @end @@ -278,8 +454,91 @@ typedef GPB_ENUM(GetIdentityRequest_GetIdentityRequestV0_FieldNumber) { GPB_FINAL @interface GetIdentityRequest_GetIdentityRequestV0 : GPBMessage +/** The ID of the identity being requested */ @property(nonatomic, readwrite, copy, null_resettable) NSData *id_p; +/** Flag to request a proof as the response */ +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetIdentityNonceRequest + +typedef GPB_ENUM(GetIdentityNonceRequest_FieldNumber) { + GetIdentityNonceRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetIdentityNonceRequest_Version_OneOfCase) { + GetIdentityNonceRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityNonceRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetIdentityNonceRequest : GPBMessage + +@property(nonatomic, readonly) GetIdentityNonceRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityNonceRequest_GetIdentityNonceRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentityNonceRequest_ClearVersionOneOfCase(GetIdentityNonceRequest *message); + +#pragma mark - GetIdentityNonceRequest_GetIdentityNonceRequestV0 + +typedef GPB_ENUM(GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber) { + GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_IdentityId = 1, + GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_Prove = 2, +}; + +GPB_FINAL @interface GetIdentityNonceRequest_GetIdentityNonceRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetIdentityContractNonceRequest + +typedef GPB_ENUM(GetIdentityContractNonceRequest_FieldNumber) { + GetIdentityContractNonceRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetIdentityContractNonceRequest_Version_OneOfCase) { + GetIdentityContractNonceRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityContractNonceRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetIdentityContractNonceRequest : GPBMessage + +@property(nonatomic, readonly) GetIdentityContractNonceRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentityContractNonceRequest_ClearVersionOneOfCase(GetIdentityContractNonceRequest *message); + +#pragma mark - GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 + +typedef GPB_ENUM(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber) { + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_IdentityId = 1, + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_ContractId = 2, + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_Prove = 3, +}; + +GPB_FINAL @interface GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + @property(nonatomic, readwrite) BOOL prove; @end @@ -317,8 +576,10 @@ typedef GPB_ENUM(GetIdentityBalanceRequest_GetIdentityBalanceRequestV0_FieldNumb GPB_FINAL @interface GetIdentityBalanceRequest_GetIdentityBalanceRequestV0 : GPBMessage +/** ID of the identity whose balance is requested */ @property(nonatomic, readwrite, copy, null_resettable) NSData *id_p; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -356,8 +617,10 @@ typedef GPB_ENUM(GetIdentityBalanceAndRevisionRequest_GetIdentityBalanceAndRevis GPB_FINAL @interface GetIdentityBalanceAndRevisionRequest_GetIdentityBalanceAndRevisionRequestV0 : GPBMessage +/** ID of the identity for balance and revision */ @property(nonatomic, readwrite, copy, null_resettable) NSData *id_p; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -404,10 +667,13 @@ GPB_FINAL @interface GetIdentityResponse_GetIdentityResponseV0 : GPBMessage @property(nonatomic, readonly) GetIdentityResponse_GetIdentityResponseV0_Result_OneOfCase resultOneOfCase; +/** The requested identity data */ @property(nonatomic, readwrite, copy, null_resettable) NSData *identity; +/** Proof of the identity data, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -419,133 +685,106 @@ GPB_FINAL @interface GetIdentityResponse_GetIdentityResponseV0 : GPBMessage **/ void GetIdentityResponse_GetIdentityResponseV0_ClearResultOneOfCase(GetIdentityResponse_GetIdentityResponseV0 *message); -#pragma mark - GetIdentitiesRequest +#pragma mark - GetIdentityNonceResponse -typedef GPB_ENUM(GetIdentitiesRequest_FieldNumber) { - GetIdentitiesRequest_FieldNumber_V0 = 1, +typedef GPB_ENUM(GetIdentityNonceResponse_FieldNumber) { + GetIdentityNonceResponse_FieldNumber_V0 = 1, }; -typedef GPB_ENUM(GetIdentitiesRequest_Version_OneOfCase) { - GetIdentitiesRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesRequest_Version_OneOfCase_V0 = 1, +typedef GPB_ENUM(GetIdentityNonceResponse_Version_OneOfCase) { + GetIdentityNonceResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityNonceResponse_Version_OneOfCase_V0 = 1, }; -GPB_FINAL @interface GetIdentitiesRequest : GPBMessage +GPB_FINAL @interface GetIdentityNonceResponse : GPBMessage -@property(nonatomic, readonly) GetIdentitiesRequest_Version_OneOfCase versionOneOfCase; +@property(nonatomic, readonly) GetIdentityNonceResponse_Version_OneOfCase versionOneOfCase; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesRequest_GetIdentitiesRequestV0 *v0; +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityNonceResponse_GetIdentityNonceResponseV0 *v0; @end /** * Clears whatever value was set for the oneof 'version'. **/ -void GetIdentitiesRequest_ClearVersionOneOfCase(GetIdentitiesRequest *message); +void GetIdentityNonceResponse_ClearVersionOneOfCase(GetIdentityNonceResponse *message); -#pragma mark - GetIdentitiesRequest_GetIdentitiesRequestV0 +#pragma mark - GetIdentityNonceResponse_GetIdentityNonceResponseV0 -typedef GPB_ENUM(GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber) { - GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_IdsArray = 1, - GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_Prove = 2, +typedef GPB_ENUM(GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber) { + GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_IdentityNonce = 1, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Proof = 2, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Metadata = 3, }; -GPB_FINAL @interface GetIdentitiesRequest_GetIdentitiesRequestV0 : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *idsArray; -/** The number of items in @c idsArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger idsArray_Count; - -@property(nonatomic, readwrite) BOOL prove; - -@end - -#pragma mark - GetIdentitiesResponse - -typedef GPB_ENUM(GetIdentitiesResponse_FieldNumber) { - GetIdentitiesResponse_FieldNumber_V0 = 1, +typedef GPB_ENUM(GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase) { + GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase_IdentityNonce = 1, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase_Proof = 2, }; -typedef GPB_ENUM(GetIdentitiesResponse_Version_OneOfCase) { - GetIdentitiesResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesResponse_Version_OneOfCase_V0 = 1, -}; +GPB_FINAL @interface GetIdentityNonceResponse_GetIdentityNonceResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase resultOneOfCase; -GPB_FINAL @interface GetIdentitiesResponse : GPBMessage +@property(nonatomic, readwrite) uint64_t identityNonce; -@property(nonatomic, readonly) GetIdentitiesResponse_Version_OneOfCase versionOneOfCase; +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesResponse_GetIdentitiesResponseV0 *v0; +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; @end /** - * Clears whatever value was set for the oneof 'version'. + * Clears whatever value was set for the oneof 'result'. **/ -void GetIdentitiesResponse_ClearVersionOneOfCase(GetIdentitiesResponse *message); +void GetIdentityNonceResponse_GetIdentityNonceResponseV0_ClearResultOneOfCase(GetIdentityNonceResponse_GetIdentityNonceResponseV0 *message); -#pragma mark - GetIdentitiesResponse_IdentityValue +#pragma mark - GetIdentityContractNonceResponse -typedef GPB_ENUM(GetIdentitiesResponse_IdentityValue_FieldNumber) { - GetIdentitiesResponse_IdentityValue_FieldNumber_Value = 1, +typedef GPB_ENUM(GetIdentityContractNonceResponse_FieldNumber) { + GetIdentityContractNonceResponse_FieldNumber_V0 = 1, }; -GPB_FINAL @interface GetIdentitiesResponse_IdentityValue : GPBMessage - -@property(nonatomic, readwrite, copy, null_resettable) NSData *value; - -@end - -#pragma mark - GetIdentitiesResponse_IdentityEntry - -typedef GPB_ENUM(GetIdentitiesResponse_IdentityEntry_FieldNumber) { - GetIdentitiesResponse_IdentityEntry_FieldNumber_Key = 1, - GetIdentitiesResponse_IdentityEntry_FieldNumber_Value = 2, +typedef GPB_ENUM(GetIdentityContractNonceResponse_Version_OneOfCase) { + GetIdentityContractNonceResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityContractNonceResponse_Version_OneOfCase_V0 = 1, }; -GPB_FINAL @interface GetIdentitiesResponse_IdentityEntry : GPBMessage +GPB_FINAL @interface GetIdentityContractNonceResponse : GPBMessage -@property(nonatomic, readwrite, copy, null_resettable) NSData *key; +@property(nonatomic, readonly) GetIdentityContractNonceResponse_Version_OneOfCase versionOneOfCase; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesResponse_IdentityValue *value; -/** Test to see if @c value has been set. */ -@property(nonatomic, readwrite) BOOL hasValue; +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *v0; @end -#pragma mark - GetIdentitiesResponse_Identities - -typedef GPB_ENUM(GetIdentitiesResponse_Identities_FieldNumber) { - GetIdentitiesResponse_Identities_FieldNumber_IdentityEntriesArray = 1, -}; - -GPB_FINAL @interface GetIdentitiesResponse_Identities : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identityEntriesArray; -/** The number of items in @c identityEntriesArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger identityEntriesArray_Count; - -@end +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentityContractNonceResponse_ClearVersionOneOfCase(GetIdentityContractNonceResponse *message); -#pragma mark - GetIdentitiesResponse_GetIdentitiesResponseV0 +#pragma mark - GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 -typedef GPB_ENUM(GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber) { - GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Identities = 1, - GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Proof = 2, - GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Metadata = 3, +typedef GPB_ENUM(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber) { + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_IdentityContractNonce = 1, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Proof = 2, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Metadata = 3, }; -typedef GPB_ENUM(GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase) { - GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase_Identities = 1, - GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase_Proof = 2, +typedef GPB_ENUM(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase) { + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase_IdentityContractNonce = 1, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase_Proof = 2, }; -GPB_FINAL @interface GetIdentitiesResponse_GetIdentitiesResponseV0 : GPBMessage +GPB_FINAL @interface GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 : GPBMessage -@property(nonatomic, readonly) GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase resultOneOfCase; +@property(nonatomic, readonly) GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase resultOneOfCase; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesResponse_Identities *identities; +@property(nonatomic, readwrite) uint64_t identityContractNonce; @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; @@ -558,7 +797,7 @@ GPB_FINAL @interface GetIdentitiesResponse_GetIdentitiesResponseV0 : GPBMessage /** * Clears whatever value was set for the oneof 'result'. **/ -void GetIdentitiesResponse_GetIdentitiesResponseV0_ClearResultOneOfCase(GetIdentitiesResponse_GetIdentitiesResponseV0 *message); +void GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_ClearResultOneOfCase(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *message); #pragma mark - GetIdentityBalanceResponse @@ -602,10 +841,13 @@ GPB_FINAL @interface GetIdentityBalanceResponse_GetIdentityBalanceResponseV0 : G @property(nonatomic, readonly) GetIdentityBalanceResponse_GetIdentityBalanceResponseV0_Result_OneOfCase resultOneOfCase; +/** The balance of the requested identity */ @property(nonatomic, readwrite) uint64_t balance; +/** Proof of the balance, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -659,10 +901,13 @@ GPB_FINAL @interface GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAnd @property(nonatomic, readonly) GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevisionResponseV0_Result_OneOfCase resultOneOfCase; +/** The balance and revision data */ @property(nonatomic, readwrite, strong, null_resettable) GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevisionResponseV0_BalanceAndRevision *balanceAndRevision; +/** Proof of the data, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -683,8 +928,10 @@ typedef GPB_ENUM(GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevi GPB_FINAL @interface GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevisionResponseV0_BalanceAndRevision : GPBMessage +/** Balance of the identity */ @property(nonatomic, readwrite) uint64_t balance; +/** Revision number of the identity */ @property(nonatomic, readwrite) uint64_t revision; @end @@ -708,10 +955,13 @@ GPB_FINAL @interface KeyRequestType : GPBMessage @property(nonatomic, readonly) KeyRequestType_Request_OneOfCase requestOneOfCase; +/** Request for all keys */ @property(nonatomic, readwrite, strong, null_resettable) AllKeys *allKeys; +/** Request for specific keys by their IDs */ @property(nonatomic, readwrite, strong, null_resettable) SpecificKeys *specificKeys; +/** Request for keys based on a search criteria */ @property(nonatomic, readwrite, strong, null_resettable) SearchKey *searchKey; @end @@ -723,6 +973,9 @@ void KeyRequestType_ClearRequestOneOfCase(KeyRequestType *message); #pragma mark - AllKeys +/** + * AllKeys is an empty message used to signify a request for all keys + **/ GPB_FINAL @interface AllKeys : GPBMessage @end @@ -733,8 +986,12 @@ typedef GPB_ENUM(SpecificKeys_FieldNumber) { SpecificKeys_FieldNumber_KeyIdsArray = 1, }; +/** + * SpecificKeys is used to request specific keys by their IDs + **/ GPB_FINAL @interface SpecificKeys : GPBMessage +/** List of key IDs */ @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Array *keyIdsArray; /** The number of items in @c keyIdsArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger keyIdsArray_Count; @@ -747,8 +1004,12 @@ typedef GPB_ENUM(SearchKey_FieldNumber) { SearchKey_FieldNumber_PurposeMap = 1, }; +/** + * SearchKey represents a request to search for keys based on specific criteria + **/ GPB_FINAL @interface SearchKey : GPBMessage +/** Map of purposes to their security level maps */ @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32ObjectDictionary *purposeMap; /** The number of items in @c purposeMap without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger purposeMap_Count; @@ -761,8 +1022,12 @@ typedef GPB_ENUM(SecurityLevelMap_FieldNumber) { SecurityLevelMap_FieldNumber_SecurityLevelMap = 1, }; +/** + * SecurityLevelMap maps security levels to a request type for key retrieval + **/ GPB_FINAL @interface SecurityLevelMap : GPBMessage +/** Maps security levels to key request types */ // |securityLevelMap| values are |SecurityLevelMap_KeyKindRequestType| @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32EnumDictionary *securityLevelMap; /** The number of items in @c securityLevelMap without causing the array to be created. */ @@ -806,20 +1071,25 @@ typedef GPB_ENUM(GetIdentityKeysRequest_GetIdentityKeysRequestV0_FieldNumber) { GPB_FINAL @interface GetIdentityKeysRequest_GetIdentityKeysRequestV0 : GPBMessage +/** ID of the identity for key retrieval */ @property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; +/** Type of key request: all, specific, or search */ @property(nonatomic, readwrite, strong, null_resettable) KeyRequestType *requestType; /** Test to see if @c requestType has been set. */ @property(nonatomic, readwrite) BOOL hasRequestType; +/** Limit on the number of keys to be returned */ @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Value *limit; /** Test to see if @c limit has been set. */ @property(nonatomic, readwrite) BOOL hasLimit; +/** Offset for pagination through the keys */ @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Value *offset; /** Test to see if @c offset has been set. */ @property(nonatomic, readwrite) BOOL hasOffset; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -866,10 +1136,13 @@ GPB_FINAL @interface GetIdentityKeysResponse_GetIdentityKeysResponseV0 : GPBMess @property(nonatomic, readonly) GetIdentityKeysResponse_GetIdentityKeysResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual key data */ @property(nonatomic, readwrite, strong, null_resettable) GetIdentityKeysResponse_GetIdentityKeysResponseV0_Keys *keys; +/** Proof of the keys data, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -895,117 +1168,377 @@ GPB_FINAL @interface GetIdentityKeysResponse_GetIdentityKeysResponseV0_Keys : GP @end -#pragma mark - GetProofsRequest +#pragma mark - GetIdentitiesContractKeysRequest -typedef GPB_ENUM(GetProofsRequest_FieldNumber) { - GetProofsRequest_FieldNumber_V0 = 1, +typedef GPB_ENUM(GetIdentitiesContractKeysRequest_FieldNumber) { + GetIdentitiesContractKeysRequest_FieldNumber_V0 = 1, }; -typedef GPB_ENUM(GetProofsRequest_Version_OneOfCase) { - GetProofsRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetProofsRequest_Version_OneOfCase_V0 = 1, +typedef GPB_ENUM(GetIdentitiesContractKeysRequest_Version_OneOfCase) { + GetIdentitiesContractKeysRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentitiesContractKeysRequest_Version_OneOfCase_V0 = 1, }; -GPB_FINAL @interface GetProofsRequest : GPBMessage +GPB_FINAL @interface GetIdentitiesContractKeysRequest : GPBMessage -@property(nonatomic, readonly) GetProofsRequest_Version_OneOfCase versionOneOfCase; +@property(nonatomic, readonly) GetIdentitiesContractKeysRequest_Version_OneOfCase versionOneOfCase; -@property(nonatomic, readwrite, strong, null_resettable) GetProofsRequest_GetProofsRequestV0 *v0; +@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 *v0; @end /** * Clears whatever value was set for the oneof 'version'. **/ -void GetProofsRequest_ClearVersionOneOfCase(GetProofsRequest *message); +void GetIdentitiesContractKeysRequest_ClearVersionOneOfCase(GetIdentitiesContractKeysRequest *message); -#pragma mark - GetProofsRequest_GetProofsRequestV0 +#pragma mark - GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 -typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_FieldNumber) { - GetProofsRequest_GetProofsRequestV0_FieldNumber_IdentitiesArray = 1, - GetProofsRequest_GetProofsRequestV0_FieldNumber_ContractsArray = 2, - GetProofsRequest_GetProofsRequestV0_FieldNumber_DocumentsArray = 3, +typedef GPB_ENUM(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber) { + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_IdentitiesIdsArray = 1, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_ContractId = 2, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_DocumentTypeName = 3, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_PurposesArray = 4, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_Prove = 5, }; -GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0 : GPBMessage +GPB_FINAL @interface GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 : GPBMessage -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identitiesArray; -/** The number of items in @c identitiesArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger identitiesArray_Count; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identitiesIdsArray; +/** The number of items in @c identitiesIdsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger identitiesIdsArray_Count; -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *contractsArray; -/** The number of items in @c contractsArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger contractsArray_Count; +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *documentsArray; -/** The number of items in @c documentsArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger documentsArray_Count; +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentTypeName; +/** Test to see if @c documentTypeName has been set. */ +@property(nonatomic, readwrite) BOOL hasDocumentTypeName; + +// |purposesArray| contains |KeyPurpose| +@property(nonatomic, readwrite, strong, null_resettable) GPBEnumArray *purposesArray; +/** The number of items in @c purposesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger purposesArray_Count; + +@property(nonatomic, readwrite) BOOL prove; @end -#pragma mark - GetProofsRequest_GetProofsRequestV0_DocumentRequest +#pragma mark - GetIdentitiesContractKeysResponse -typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber) { - GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_ContractId = 1, - GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentType = 2, - GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentTypeKeepsHistory = 3, - GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentId = 4, +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_FieldNumber) { + GetIdentitiesContractKeysResponse_FieldNumber_V0 = 1, }; -GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_DocumentRequest : GPBMessage +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_Version_OneOfCase) { + GetIdentitiesContractKeysResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentitiesContractKeysResponse_Version_OneOfCase_V0 = 1, +}; -@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; +GPB_FINAL @interface GetIdentitiesContractKeysResponse : GPBMessage -@property(nonatomic, readwrite, copy, null_resettable) NSString *documentType; +@property(nonatomic, readonly) GetIdentitiesContractKeysResponse_Version_OneOfCase versionOneOfCase; -@property(nonatomic, readwrite) BOOL documentTypeKeepsHistory; +@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *v0; -@property(nonatomic, readwrite, copy, null_resettable) NSData *documentId; +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentitiesContractKeysResponse_ClearVersionOneOfCase(GetIdentitiesContractKeysResponse *message); + +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_IdentitiesKeys = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Proof = 2, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase_IdentitiesKeys = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys *identitiesKeys; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; @end -#pragma mark - GetProofsRequest_GetProofsRequestV0_IdentityRequest +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_ClearResultOneOfCase(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *message); -typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber) { - GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_IdentityId = 1, - GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType = 2, +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_KeysBytesArray = 2, }; -GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_IdentityRequest : GPBMessage +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys : GPBMessage -@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; +@property(nonatomic, readwrite) KeyPurpose purpose; -@property(nonatomic, readwrite) GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type requestType; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysBytesArray; +/** The number of items in @c keysBytesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger keysBytesArray_Count; @end /** - * Fetches the raw value of a @c GetProofsRequest_GetProofsRequestV0_IdentityRequest's @c requestType property, even + * Fetches the raw value of a @c GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys's @c purpose property, even * if the value was not defined by the enum at the time the code was generated. **/ -int32_t GetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message); +int32_t GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message); /** - * Sets the raw value of an @c GetProofsRequest_GetProofsRequestV0_IdentityRequest's @c requestType property, allowing + * Sets the raw value of an @c GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys's @c purpose property, allowing * it to be set to a value that was not defined by the enum at the time the code * was generated. **/ -void SetGetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message, int32_t value); +void SetGetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message, int32_t value); -#pragma mark - GetProofsRequest_GetProofsRequestV0_ContractRequest +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys -typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber) { - GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber_ContractId = 1, +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_IdentityId = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_KeysArray = 2, }; -GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_ContractRequest : GPBMessage +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys : GPBMessage -@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysArray; +/** The number of items in @c keysArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger keysArray_Count; @end -#pragma mark - GetProofsResponse +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys -typedef GPB_ENUM(GetProofsResponse_FieldNumber) { +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys_FieldNumber_EntriesArray = 1, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *entriesArray; +/** The number of items in @c entriesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger entriesArray_Count; + +@end + +#pragma mark - GetProofsRequest + +typedef GPB_ENUM(GetProofsRequest_FieldNumber) { + GetProofsRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetProofsRequest_Version_OneOfCase) { + GetProofsRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetProofsRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetProofsRequest : GPBMessage + +@property(nonatomic, readonly) GetProofsRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetProofsRequest_GetProofsRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetProofsRequest_ClearVersionOneOfCase(GetProofsRequest *message); + +#pragma mark - GetProofsRequest_GetProofsRequestV0 + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_FieldNumber) { + GetProofsRequest_GetProofsRequestV0_FieldNumber_IdentitiesArray = 1, + GetProofsRequest_GetProofsRequestV0_FieldNumber_ContractsArray = 2, + GetProofsRequest_GetProofsRequestV0_FieldNumber_DocumentsArray = 3, + GetProofsRequest_GetProofsRequestV0_FieldNumber_VotesArray = 4, +}; + +GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0 : GPBMessage + +/** List of identity requests */ +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identitiesArray; +/** The number of items in @c identitiesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger identitiesArray_Count; + +/** List of contract requests */ +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *contractsArray; +/** The number of items in @c contractsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger contractsArray_Count; + +/** List of document requests */ +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *documentsArray; +/** The number of items in @c documentsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger documentsArray_Count; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *votesArray; +/** The number of items in @c votesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger votesArray_Count; + +@end + +#pragma mark - GetProofsRequest_GetProofsRequestV0_DocumentRequest + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber) { + GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_ContractId = 1, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentType = 2, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentTypeKeepsHistory = 3, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentId = 4, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentContestedStatus = 5, +}; + +/** + * DocumentRequest specifies a request for a document proof + **/ +GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_DocumentRequest : GPBMessage + +/** ID of the contract the document belongs to */ +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +/** Type of document being requested */ +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentType; + +/** Indicates if the document type keeps a history of changes */ +@property(nonatomic, readwrite) BOOL documentTypeKeepsHistory; + +/** ID of the specific document being requested */ +@property(nonatomic, readwrite, copy, null_resettable) NSData *documentId; + +@property(nonatomic, readwrite) GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus documentContestedStatus; + +@end + +/** + * Fetches the raw value of a @c GetProofsRequest_GetProofsRequestV0_DocumentRequest's @c documentContestedStatus property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_RawValue(GetProofsRequest_GetProofsRequestV0_DocumentRequest *message); +/** + * Sets the raw value of an @c GetProofsRequest_GetProofsRequestV0_DocumentRequest's @c documentContestedStatus property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_RawValue(GetProofsRequest_GetProofsRequestV0_DocumentRequest *message, int32_t value); + +#pragma mark - GetProofsRequest_GetProofsRequestV0_IdentityRequest + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber) { + GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_IdentityId = 1, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType = 2, +}; + +/** + * IdentityRequest specifies a request for an identity proof + **/ +GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_IdentityRequest : GPBMessage + +/** ID of the identity for which the proof is requested */ +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +/** Type of identity request */ +@property(nonatomic, readwrite) GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type requestType; + +@end + +/** + * Fetches the raw value of a @c GetProofsRequest_GetProofsRequestV0_IdentityRequest's @c requestType property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message); +/** + * Sets the raw value of an @c GetProofsRequest_GetProofsRequestV0_IdentityRequest's @c requestType property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message, int32_t value); + +#pragma mark - GetProofsRequest_GetProofsRequestV0_ContractRequest + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber) { + GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber_ContractId = 1, +}; + +/** + * ContractRequest specifies a request for a data contract proof. + **/ +GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_ContractRequest : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@end + +#pragma mark - GetProofsRequest_GetProofsRequestV0_VoteStatusRequest + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_FieldNumber) { + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_FieldNumber_ContestedResourceVoteStatusRequest = 1, +}; + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_RequestType_OneOfCase) { + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_RequestType_OneOfCase_GPBUnsetOneOfCase = 0, + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_RequestType_OneOfCase_ContestedResourceVoteStatusRequest = 1, +}; + +GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_VoteStatusRequest : GPBMessage + +@property(nonatomic, readonly) GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_RequestType_OneOfCase requestTypeOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest *contestedResourceVoteStatusRequest; + +@end + +/** + * Clears whatever value was set for the oneof 'requestType'. + **/ +void GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ClearRequestTypeOneOfCase(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest *message); + +#pragma mark - GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest + +typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber) { + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_ContractId = 1, + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_DocumentTypeName = 2, + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_IndexName = 3, + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_IndexValuesArray = 4, + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_VoterIdentifier = 5, +}; + +GPB_FINAL @interface GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentTypeName; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *indexName; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *indexValuesArray; +/** The number of items in @c indexValuesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger indexValuesArray_Count; + +@property(nonatomic, readwrite, copy, null_resettable) NSData *voterIdentifier; + +@end + +#pragma mark - GetProofsResponse + +typedef GPB_ENUM(GetProofsResponse_FieldNumber) { GetProofsResponse_FieldNumber_V0 = 1, }; @@ -1043,8 +1576,10 @@ GPB_FINAL @interface GetProofsResponse_GetProofsResponseV0 : GPBMessage @property(nonatomic, readonly) GetProofsResponse_GetProofsResponseV0_Result_OneOfCase resultOneOfCase; +/** Cryptographic proof for the requested data */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -1089,8 +1624,10 @@ typedef GPB_ENUM(GetDataContractRequest_GetDataContractRequestV0_FieldNumber) { GPB_FINAL @interface GetDataContractRequest_GetDataContractRequestV0 : GPBMessage +/** The ID of the data contract being requested */ @property(nonatomic, readwrite, copy, null_resettable) NSData *id_p; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -1137,10 +1674,13 @@ GPB_FINAL @interface GetDataContractResponse_GetDataContractResponseV0 : GPBMess @property(nonatomic, readonly) GetDataContractResponse_GetDataContractResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual data contract in binary form */ @property(nonatomic, readwrite, copy, null_resettable) NSData *dataContract; +/** Cryptographic proof of the data contract, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -1185,10 +1725,12 @@ typedef GPB_ENUM(GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber) GPB_FINAL @interface GetDataContractsRequest_GetDataContractsRequestV0 : GPBMessage +/** A list of unique IDs for the data contracts being requested */ @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *idsArray; /** The number of items in @c idsArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger idsArray_Count; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -1226,8 +1768,10 @@ typedef GPB_ENUM(GetDataContractsResponse_DataContractEntry_FieldNumber) { GPB_FINAL @interface GetDataContractsResponse_DataContractEntry : GPBMessage +/** The unique identifier of the data contract */ @property(nonatomic, readwrite, copy, null_resettable) NSData *identifier; +/** The actual data contract content */ @property(nonatomic, readwrite, strong, null_resettable) GPBBytesValue *dataContract; /** Test to see if @c dataContract has been set. */ @property(nonatomic, readwrite) BOOL hasDataContract; @@ -1240,8 +1784,12 @@ typedef GPB_ENUM(GetDataContractsResponse_DataContracts_FieldNumber) { GetDataContractsResponse_DataContracts_FieldNumber_DataContractEntriesArray = 1, }; +/** + * DataContracts is a collection of data contract entries. + **/ GPB_FINAL @interface GetDataContractsResponse_DataContracts : GPBMessage +/** A list of data contract entries */ @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *dataContractEntriesArray; /** The number of items in @c dataContractEntriesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger dataContractEntriesArray_Count; @@ -1266,10 +1814,13 @@ GPB_FINAL @interface GetDataContractsResponse_GetDataContractsResponseV0 : GPBMe @property(nonatomic, readonly) GetDataContractsResponse_GetDataContractsResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual data contracts requested */ @property(nonatomic, readwrite, strong, null_resettable) GetDataContractsResponse_DataContracts *dataContracts; +/** Cryptographic proof for the data contracts, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -1317,18 +1868,23 @@ typedef GPB_ENUM(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_F GPB_FINAL @interface GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 : GPBMessage +/** The unique ID of the data contract */ @property(nonatomic, readwrite, copy, null_resettable) NSData *id_p; +/** The maximum number of history entries to return */ @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Value *limit; /** Test to see if @c limit has been set. */ @property(nonatomic, readwrite) BOOL hasLimit; +/** The offset for pagination through the contract history */ @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Value *offset; /** Test to see if @c offset has been set. */ @property(nonatomic, readwrite) BOOL hasOffset; +/** Only return results starting at this time in milliseconds */ @property(nonatomic, readwrite) uint64_t startAtMs; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -1375,10 +1931,13 @@ GPB_FINAL @interface GetDataContractHistoryResponse_GetDataContractHistoryRespon @property(nonatomic, readonly) GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual history of the data contract */ @property(nonatomic, readwrite, strong, null_resettable) GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory *dataContractHistory; +/** Cryptographic proof of the data contract history, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -1397,10 +1956,15 @@ typedef GPB_ENUM(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Value = 2, }; +/** + * Represents a single entry in the data contract's history + **/ GPB_FINAL @interface GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry : GPBMessage +/** The date of the history entry */ @property(nonatomic, readwrite) uint64_t date; +/** The value of the data contract at this point in history */ @property(nonatomic, readwrite, copy, null_resettable) NSData *value; @end @@ -1411,8 +1975,12 @@ typedef GPB_ENUM(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory_FieldNumber_DataContractEntriesArray = 1, }; +/** + * Collection of data contract history entries + **/ GPB_FINAL @interface GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory : GPBMessage +/** List of history entries */ @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *dataContractEntriesArray; /** The number of items in @c dataContractEntriesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger dataContractEntriesArray_Count; @@ -1464,22 +2032,31 @@ typedef GPB_ENUM(GetDocumentsRequest_GetDocumentsRequestV0_Start_OneOfCase) { GPB_FINAL @interface GetDocumentsRequest_GetDocumentsRequestV0 : GPBMessage +/** The ID of the data contract containing the documents */ @property(nonatomic, readwrite, copy, null_resettable) NSData *dataContractId; +/** The type of document being requested */ @property(nonatomic, readwrite, copy, null_resettable) NSString *documentType; +/** Conditions to be met by the requested documents */ @property(nonatomic, readwrite, copy, null_resettable) NSData *where; +/** Ordering criteria for the documents */ @property(nonatomic, readwrite, copy, null_resettable) NSData *orderBy; +/** Maximum number of documents to return */ @property(nonatomic, readwrite) uint32_t limit; +/** Specifies the starting point for the document retrieval */ @property(nonatomic, readonly) GetDocumentsRequest_GetDocumentsRequestV0_Start_OneOfCase startOneOfCase; +/** Start retrieval after this document */ @property(nonatomic, readwrite, copy, null_resettable) NSData *startAfter; +/** Start retrieval at this document */ @property(nonatomic, readwrite, copy, null_resettable) NSData *startAt; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -1531,10 +2108,13 @@ GPB_FINAL @interface GetDocumentsResponse_GetDocumentsResponseV0 : GPBMessage @property(nonatomic, readonly) GetDocumentsResponse_GetDocumentsResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual documents requested */ @property(nonatomic, readwrite, strong, null_resettable) GetDocumentsResponse_GetDocumentsResponseV0_Documents *documents; +/** Cryptographic proof of the documents, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -1552,143 +2132,18 @@ typedef GPB_ENUM(GetDocumentsResponse_GetDocumentsResponseV0_Documents_FieldNumb GetDocumentsResponse_GetDocumentsResponseV0_Documents_FieldNumber_DocumentsArray = 1, }; +/** + * Represents a collection of documents + **/ GPB_FINAL @interface GetDocumentsResponse_GetDocumentsResponseV0_Documents : GPBMessage +/** The actual documents in binary form */ @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *documentsArray; /** The number of items in @c documentsArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger documentsArray_Count; @end -#pragma mark - GetIdentitiesByPublicKeyHashesRequest - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesRequest_FieldNumber) { - GetIdentitiesByPublicKeyHashesRequest_FieldNumber_V0 = 1, -}; - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase) { - GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase_V0 = 1, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesRequest : GPBMessage - -@property(nonatomic, readonly) GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase versionOneOfCase; - -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 *v0; - -@end - -/** - * Clears whatever value was set for the oneof 'version'. - **/ -void GetIdentitiesByPublicKeyHashesRequest_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesRequest *message); - -#pragma mark - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber) { - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_PublicKeyHashesArray = 1, - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_Prove = 2, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *publicKeyHashesArray; -/** The number of items in @c publicKeyHashesArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger publicKeyHashesArray_Count; - -@property(nonatomic, readwrite) BOOL prove; - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_FieldNumber_V0 = 1, -}; - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase) { - GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase_V0 = 1, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse : GPBMessage - -@property(nonatomic, readonly) GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase versionOneOfCase; - -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *v0; - -@end - -/** - * Clears whatever value was set for the oneof 'version'. - **/ -void GetIdentitiesByPublicKeyHashesResponse_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesResponse *message); - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_PublicKeyHash = 1, - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_Value = 2, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry : GPBMessage - -@property(nonatomic, readwrite, copy, null_resettable) NSData *publicKeyHash; - -@property(nonatomic, readwrite, strong, null_resettable) GPBBytesValue *value; -/** Test to see if @c value has been set. */ -@property(nonatomic, readwrite) BOOL hasValue; - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes_FieldNumber_IdentityEntriesArray = 1, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identityEntriesArray; -/** The number of items in @c identityEntriesArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger identityEntriesArray_Count; - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Identities = 1, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Proof = 2, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Metadata = 3, -}; - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase) { - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase_Identities = 1, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase_Proof = 2, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 : GPBMessage - -@property(nonatomic, readonly) GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase resultOneOfCase; - -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes *identities; - -@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; - -@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; -/** Test to see if @c metadata has been set. */ -@property(nonatomic, readwrite) BOOL hasMetadata; - -@end - -/** - * Clears whatever value was set for the oneof 'result'. - **/ -void GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_ClearResultOneOfCase(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *message); - #pragma mark - GetIdentityByPublicKeyHashRequest typedef GPB_ENUM(GetIdentityByPublicKeyHashRequest_FieldNumber) { @@ -1722,8 +2177,10 @@ typedef GPB_ENUM(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashReq GPB_FINAL @interface GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 : GPBMessage +/** The public key hash of the identity being requested */ @property(nonatomic, readwrite, copy, null_resettable) NSData *publicKeyHash; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -1770,10 +2227,13 @@ GPB_FINAL @interface GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHa @property(nonatomic, readonly) GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual identity data corresponding to the requested public key hash */ @property(nonatomic, readwrite, copy, null_resettable) NSData *identity; +/** Cryptographic proof for the identity data, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -1818,8 +2278,10 @@ typedef GPB_ENUM(WaitForStateTransitionResultRequest_WaitForStateTransitionResul GPB_FINAL @interface WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 : GPBMessage +/** The hash of the state transition to wait for */ @property(nonatomic, readwrite, copy, null_resettable) NSData *stateTransitionHash; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -1866,10 +2328,13 @@ GPB_FINAL @interface WaitForStateTransitionResultResponse_WaitForStateTransition @property(nonatomic, readonly) WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_Result_OneOfCase resultOneOfCase; +/** Any error that occurred during the state transition broadcast */ @property(nonatomic, readwrite, strong, null_resettable) StateTransitionBroadcastError *error; +/** Cryptographic proof for the state transition, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -1914,8 +2379,10 @@ typedef GPB_ENUM(GetConsensusParamsRequest_GetConsensusParamsRequestV0_FieldNumb GPB_FINAL @interface GetConsensusParamsRequest_GetConsensusParamsRequestV0 : GPBMessage +/** The blockchain height at which to get the consensus parameters */ @property(nonatomic, readwrite) int32_t height; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -1954,10 +2421,13 @@ typedef GPB_ENUM(GetConsensusParamsResponse_ConsensusParamsBlock_FieldNumber) { GPB_FINAL @interface GetConsensusParamsResponse_ConsensusParamsBlock : GPBMessage +/** The maximum size of a block in bytes */ @property(nonatomic, readwrite, copy, null_resettable) NSString *maxBytes; +/** The maximum gas allowed in a block */ @property(nonatomic, readwrite, copy, null_resettable) NSString *maxGas; +/** The minimum time increment between consecutive blocks, in milliseconds */ @property(nonatomic, readwrite, copy, null_resettable) NSString *timeIotaMs; @end @@ -1972,10 +2442,13 @@ typedef GPB_ENUM(GetConsensusParamsResponse_ConsensusParamsEvidence_FieldNumber) GPB_FINAL @interface GetConsensusParamsResponse_ConsensusParamsEvidence : GPBMessage +/** The maximum age of evidence, in number of blocks */ @property(nonatomic, readwrite, copy, null_resettable) NSString *maxAgeNumBlocks; +/** The maximum age of evidence, as a duration */ @property(nonatomic, readwrite, copy, null_resettable) NSString *maxAgeDuration; +/** The maximum size of evidence in bytes */ @property(nonatomic, readwrite, copy, null_resettable) NSString *maxBytes; @end @@ -1989,10 +2462,12 @@ typedef GPB_ENUM(GetConsensusParamsResponse_GetConsensusParamsResponseV0_FieldNu GPB_FINAL @interface GetConsensusParamsResponse_GetConsensusParamsResponseV0 : GPBMessage +/** Consensus parameters related to block creation and validation */ @property(nonatomic, readwrite, strong, null_resettable) GetConsensusParamsResponse_ConsensusParamsBlock *block; /** Test to see if @c block has been set. */ @property(nonatomic, readwrite) BOOL hasBlock; +/** Consensus parameters related to evidence */ @property(nonatomic, readwrite, strong, null_resettable) GetConsensusParamsResponse_ConsensusParamsEvidence *evidence; /** Test to see if @c evidence has been set. */ @property(nonatomic, readwrite) BOOL hasEvidence; @@ -2031,6 +2506,7 @@ typedef GPB_ENUM(GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgrade GPB_FINAL @interface GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 : GPBMessage +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -2077,10 +2553,13 @@ GPB_FINAL @interface GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUp @property(nonatomic, readonly) GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual protocol version information */ @property(nonatomic, readwrite, strong, null_resettable) GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions *versions; +/** Cryptographic proof of the protocol version information, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -2098,8 +2577,12 @@ typedef GPB_ENUM(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgrad GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions_FieldNumber_VersionsArray = 1, }; +/** + * Versions holds a collection of version entries + **/ GPB_FINAL @interface GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions : GPBMessage +/** List of protocol version entries */ @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *versionsArray; /** The number of items in @c versionsArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger versionsArray_Count; @@ -2113,10 +2596,15 @@ typedef GPB_ENUM(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgrad GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry_FieldNumber_VoteCount = 2, }; +/** + * VersionEntry represents a single entry of a protocol version + **/ GPB_FINAL @interface GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry : GPBMessage +/** The protocol version number */ @property(nonatomic, readwrite) uint32_t versionNumber; +/** The vote count for this protocol version */ @property(nonatomic, readwrite) uint32_t voteCount; @end @@ -2155,10 +2643,13 @@ typedef GPB_ENUM(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUp GPB_FINAL @interface GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 : GPBMessage +/** The starting masternode provider transaction hash to filter the votes by */ @property(nonatomic, readwrite, copy, null_resettable) NSData *startProTxHash; +/** The number of vote entries to retrieve */ @property(nonatomic, readwrite) uint32_t count; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -2205,10 +2696,13 @@ GPB_FINAL @interface GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVers @property(nonatomic, readonly) GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual version signal information */ @property(nonatomic, readwrite, strong, null_resettable) GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals *versions; +/** Cryptographic proof of the version signal information, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -2226,8 +2720,12 @@ typedef GPB_ENUM(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionU GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals_FieldNumber_VersionSignalsArray = 1, }; +/** + * VersionSignals holds a collection of version signal entries + **/ GPB_FINAL @interface GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals : GPBMessage +/** List of version signal entries */ @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *versionSignalsArray; /** The number of items in @c versionSignalsArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger versionSignalsArray_Count; @@ -2241,10 +2739,15 @@ typedef GPB_ENUM(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionU GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal_FieldNumber_Version = 2, }; +/** + * VersionSignal represents a single voting signal for a protocol version + **/ GPB_FINAL @interface GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal : GPBMessage +/** The masternode provider transaction hash associated with the vote */ @property(nonatomic, readwrite, copy, null_resettable) NSData *proTxHash; +/** The protocol version number that is being voted on */ @property(nonatomic, readwrite) uint32_t version; @end @@ -2284,14 +2787,18 @@ typedef GPB_ENUM(GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber) { GPB_FINAL @interface GetEpochsInfoRequest_GetEpochsInfoRequestV0 : GPBMessage +/** The starting epoch for the request */ @property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Value *startEpoch; /** Test to see if @c startEpoch has been set. */ @property(nonatomic, readwrite) BOOL hasStartEpoch; +/** The number of epochs to retrieve information for */ @property(nonatomic, readwrite) uint32_t count; +/** Flag indicating if the epochs should be listed in ascending order */ @property(nonatomic, readwrite) BOOL ascending; +/** Flag to request a proof as the response */ @property(nonatomic, readwrite) BOOL prove; @end @@ -2338,10 +2845,13 @@ GPB_FINAL @interface GetEpochsInfoResponse_GetEpochsInfoResponseV0 : GPBMessage @property(nonatomic, readonly) GetEpochsInfoResponse_GetEpochsInfoResponseV0_Result_OneOfCase resultOneOfCase; +/** The actual information about the requested epochs */ @property(nonatomic, readwrite, strong, null_resettable) GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos *epochs; +/** Cryptographic proof of the epoch information, if requested */ @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; +/** Metadata about the blockchain state */ @property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; /** Test to see if @c metadata has been set. */ @property(nonatomic, readwrite) BOOL hasMetadata; @@ -2359,8 +2869,12 @@ typedef GPB_ENUM(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos_FieldN GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos_FieldNumber_EpochInfosArray = 1, }; +/** + * EpochInfos holds a collection of epoch information entries + **/ GPB_FINAL @interface GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos : GPBMessage +/** List of information for each requested epoch */ @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *epochInfosArray; /** The number of items in @c epochInfosArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger epochInfosArray_Count; @@ -2375,20 +2889,1271 @@ typedef GPB_ENUM(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNu GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FirstCoreBlockHeight = 3, GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_StartTime = 4, GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FeeMultiplier = 5, + GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_ProtocolVersion = 6, }; +/** + * EpochInfo represents information about a single epoch + **/ GPB_FINAL @interface GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo : GPBMessage +/** The number of the epoch */ @property(nonatomic, readwrite) uint32_t number; +/** The height of the first block in this epoch */ @property(nonatomic, readwrite) uint64_t firstBlockHeight; +/** The height of the first Core block in this epoch */ @property(nonatomic, readwrite) uint32_t firstCoreBlockHeight; +/** The start time of the epoch */ @property(nonatomic, readwrite) uint64_t startTime; +/** The fee multiplier applicable in this epoch */ @property(nonatomic, readwrite) double feeMultiplier; +@property(nonatomic, readwrite) uint32_t protocolVersion; + +@end + +#pragma mark - GetContestedResourcesRequest + +typedef GPB_ENUM(GetContestedResourcesRequest_FieldNumber) { + GetContestedResourcesRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourcesRequest_Version_OneOfCase) { + GetContestedResourcesRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourcesRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetContestedResourcesRequest : GPBMessage + +@property(nonatomic, readonly) GetContestedResourcesRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourcesRequest_GetContestedResourcesRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourcesRequest_ClearVersionOneOfCase(GetContestedResourcesRequest *message); + +#pragma mark - GetContestedResourcesRequest_GetContestedResourcesRequestV0 + +typedef GPB_ENUM(GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber) { + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_ContractId = 1, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_DocumentTypeName = 2, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_IndexName = 3, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_StartIndexValuesArray = 4, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_EndIndexValuesArray = 5, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_StartAtValueInfo = 6, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_Count = 7, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_OrderAscending = 8, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_Prove = 9, +}; + +GPB_FINAL @interface GetContestedResourcesRequest_GetContestedResourcesRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentTypeName; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *indexName; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *startIndexValuesArray; +/** The number of items in @c startIndexValuesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger startIndexValuesArray_Count; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *endIndexValuesArray; +/** The number of items in @c endIndexValuesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger endIndexValuesArray_Count; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo *startAtValueInfo; +/** Test to see if @c startAtValueInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasStartAtValueInfo; + +@property(nonatomic, readwrite) uint32_t count; + +@property(nonatomic, readwrite) BOOL hasCount; +@property(nonatomic, readwrite) BOOL orderAscending; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo + +typedef GPB_ENUM(GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo_FieldNumber) { + GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo_FieldNumber_StartValue = 1, + GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo_FieldNumber_StartValueIncluded = 2, +}; + +GPB_FINAL @interface GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *startValue; + +@property(nonatomic, readwrite) BOOL startValueIncluded; + +@end + +#pragma mark - GetContestedResourcesResponse + +typedef GPB_ENUM(GetContestedResourcesResponse_FieldNumber) { + GetContestedResourcesResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourcesResponse_Version_OneOfCase) { + GetContestedResourcesResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourcesResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetContestedResourcesResponse : GPBMessage + +@property(nonatomic, readonly) GetContestedResourcesResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourcesResponse_GetContestedResourcesResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourcesResponse_ClearVersionOneOfCase(GetContestedResourcesResponse *message); + +#pragma mark - GetContestedResourcesResponse_GetContestedResourcesResponseV0 + +typedef GPB_ENUM(GetContestedResourcesResponse_GetContestedResourcesResponseV0_FieldNumber) { + GetContestedResourcesResponse_GetContestedResourcesResponseV0_FieldNumber_ContestedResourceValues = 1, + GetContestedResourcesResponse_GetContestedResourcesResponseV0_FieldNumber_Proof = 2, + GetContestedResourcesResponse_GetContestedResourcesResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetContestedResourcesResponse_GetContestedResourcesResponseV0_Result_OneOfCase) { + GetContestedResourcesResponse_GetContestedResourcesResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourcesResponse_GetContestedResourcesResponseV0_Result_OneOfCase_ContestedResourceValues = 1, + GetContestedResourcesResponse_GetContestedResourcesResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetContestedResourcesResponse_GetContestedResourcesResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetContestedResourcesResponse_GetContestedResourcesResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues *contestedResourceValues; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetContestedResourcesResponse_GetContestedResourcesResponseV0_ClearResultOneOfCase(GetContestedResourcesResponse_GetContestedResourcesResponseV0 *message); + +#pragma mark - GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues + +typedef GPB_ENUM(GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues_FieldNumber) { + GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues_FieldNumber_ContestedResourceValuesArray = 1, +}; + +GPB_FINAL @interface GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *contestedResourceValuesArray; +/** The number of items in @c contestedResourceValuesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger contestedResourceValuesArray_Count; + +@end + +#pragma mark - GetVotePollsByEndDateRequest + +typedef GPB_ENUM(GetVotePollsByEndDateRequest_FieldNumber) { + GetVotePollsByEndDateRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetVotePollsByEndDateRequest_Version_OneOfCase) { + GetVotePollsByEndDateRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetVotePollsByEndDateRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetVotePollsByEndDateRequest : GPBMessage + +@property(nonatomic, readonly) GetVotePollsByEndDateRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetVotePollsByEndDateRequest_ClearVersionOneOfCase(GetVotePollsByEndDateRequest *message); + +#pragma mark - GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0 + +typedef GPB_ENUM(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber) { + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_StartTimeInfo = 1, + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_EndTimeInfo = 2, + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Limit = 3, + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Offset = 4, + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Ascending = 5, + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Prove = 6, +}; + +GPB_FINAL @interface GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0 : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo *startTimeInfo; +/** Test to see if @c startTimeInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasStartTimeInfo; + +@property(nonatomic, readwrite, strong, null_resettable) GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo *endTimeInfo; +/** Test to see if @c endTimeInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasEndTimeInfo; + +@property(nonatomic, readwrite) uint32_t limit; + +@property(nonatomic, readwrite) BOOL hasLimit; +@property(nonatomic, readwrite) uint32_t offset; + +@property(nonatomic, readwrite) BOOL hasOffset; +@property(nonatomic, readwrite) BOOL ascending; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo + +typedef GPB_ENUM(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo_FieldNumber) { + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo_FieldNumber_StartTimeMs = 1, + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo_FieldNumber_StartTimeIncluded = 2, +}; + +GPB_FINAL @interface GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo : GPBMessage + +@property(nonatomic, readwrite) uint64_t startTimeMs; + +@property(nonatomic, readwrite) BOOL startTimeIncluded; + +@end + +#pragma mark - GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo + +typedef GPB_ENUM(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo_FieldNumber) { + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo_FieldNumber_EndTimeMs = 1, + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo_FieldNumber_EndTimeIncluded = 2, +}; + +GPB_FINAL @interface GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo : GPBMessage + +@property(nonatomic, readwrite) uint64_t endTimeMs; + +@property(nonatomic, readwrite) BOOL endTimeIncluded; + +@end + +#pragma mark - GetVotePollsByEndDateResponse + +typedef GPB_ENUM(GetVotePollsByEndDateResponse_FieldNumber) { + GetVotePollsByEndDateResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetVotePollsByEndDateResponse_Version_OneOfCase) { + GetVotePollsByEndDateResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetVotePollsByEndDateResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetVotePollsByEndDateResponse : GPBMessage + +@property(nonatomic, readonly) GetVotePollsByEndDateResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetVotePollsByEndDateResponse_ClearVersionOneOfCase(GetVotePollsByEndDateResponse *message); + +#pragma mark - GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 + +typedef GPB_ENUM(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_FieldNumber) { + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_FieldNumber_VotePollsByTimestamps = 1, + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_FieldNumber_Proof = 2, + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_Result_OneOfCase) { + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_Result_OneOfCase_VotePollsByTimestamps = 1, + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps *votePollsByTimestamps; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_ClearResultOneOfCase(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 *message); + +#pragma mark - GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp + +typedef GPB_ENUM(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp_FieldNumber) { + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp_FieldNumber_Timestamp = 1, + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp_FieldNumber_SerializedVotePollsArray = 2, +}; + +GPB_FINAL @interface GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp : GPBMessage + +@property(nonatomic, readwrite) uint64_t timestamp; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *serializedVotePollsArray; +/** The number of items in @c serializedVotePollsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger serializedVotePollsArray_Count; + +@end + +#pragma mark - GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps + +typedef GPB_ENUM(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps_FieldNumber) { + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps_FieldNumber_VotePollsByTimestampsArray = 1, + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps_FieldNumber_FinishedResults = 2, +}; + +GPB_FINAL @interface GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *votePollsByTimestampsArray; +/** The number of items in @c votePollsByTimestampsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger votePollsByTimestampsArray_Count; + +@property(nonatomic, readwrite) BOOL finishedResults; + +@end + +#pragma mark - GetContestedResourceVoteStateRequest + +typedef GPB_ENUM(GetContestedResourceVoteStateRequest_FieldNumber) { + GetContestedResourceVoteStateRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourceVoteStateRequest_Version_OneOfCase) { + GetContestedResourceVoteStateRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceVoteStateRequest_Version_OneOfCase_V0 = 1, +}; + +/** + * What's the state of a contested resource vote? (ie who is winning?) + **/ +GPB_FINAL @interface GetContestedResourceVoteStateRequest : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceVoteStateRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourceVoteStateRequest_ClearVersionOneOfCase(GetContestedResourceVoteStateRequest *message); + +#pragma mark - GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 + +typedef GPB_ENUM(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber) { + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_ContractId = 1, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_DocumentTypeName = 2, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_IndexName = 3, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_IndexValuesArray = 4, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_ResultType = 5, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_AllowIncludeLockedAndAbstainingVoteTally = 6, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_StartAtIdentifierInfo = 7, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_Count = 8, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_Prove = 9, +}; + +GPB_FINAL @interface GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentTypeName; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *indexName; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *indexValuesArray; +/** The number of items in @c indexValuesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger indexValuesArray_Count; + +@property(nonatomic, readwrite) GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType resultType; + +@property(nonatomic, readwrite) BOOL allowIncludeLockedAndAbstainingVoteTally; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo *startAtIdentifierInfo; +/** Test to see if @c startAtIdentifierInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasStartAtIdentifierInfo; + +@property(nonatomic, readwrite) uint32_t count; + +@property(nonatomic, readwrite) BOOL hasCount; +@property(nonatomic, readwrite) BOOL prove; + +@end + +/** + * Fetches the raw value of a @c GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0's @c resultType property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_RawValue(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 *message); +/** + * Sets the raw value of an @c GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0's @c resultType property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_RawValue(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 *message, int32_t value); + +#pragma mark - GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo + +typedef GPB_ENUM(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo_FieldNumber) { + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifier = 1, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifierIncluded = 2, +}; + +GPB_FINAL @interface GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *startIdentifier; + +@property(nonatomic, readwrite) BOOL startIdentifierIncluded; + +@end + +#pragma mark - GetContestedResourceVoteStateResponse + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_FieldNumber) { + GetContestedResourceVoteStateResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_Version_OneOfCase) { + GetContestedResourceVoteStateResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceVoteStateResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetContestedResourceVoteStateResponse : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceVoteStateResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourceVoteStateResponse_ClearVersionOneOfCase(GetContestedResourceVoteStateResponse *message); + +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FieldNumber) { + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FieldNumber_ContestedResourceContenders = 1, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FieldNumber_Proof = 2, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Result_OneOfCase) { + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Result_OneOfCase_ContestedResourceContenders = 1, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders *contestedResourceContenders; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ClearResultOneOfCase(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 *message); + +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber) { + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedVoteOutcome = 1, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_WonByIdentityId = 2, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtBlockHeight = 3, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtCoreBlockHeight = 4, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtBlockTimeMs = 5, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtEpoch = 6, +}; + +GPB_FINAL @interface GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo : GPBMessage + +@property(nonatomic, readwrite) GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome finishedVoteOutcome; + +/** Only used when vote_choice_type is TOWARDS_IDENTITY */ +@property(nonatomic, readwrite, copy, null_resettable) NSData *wonByIdentityId; +/** Test to see if @c wonByIdentityId has been set. */ +@property(nonatomic, readwrite) BOOL hasWonByIdentityId; + +@property(nonatomic, readwrite) uint64_t finishedAtBlockHeight; + +@property(nonatomic, readwrite) uint32_t finishedAtCoreBlockHeight; + +@property(nonatomic, readwrite) uint64_t finishedAtBlockTimeMs; + +@property(nonatomic, readwrite) uint32_t finishedAtEpoch; + +@end + +/** + * Fetches the raw value of a @c GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo's @c finishedVoteOutcome property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_RawValue(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo *message); +/** + * Sets the raw value of an @c GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo's @c finishedVoteOutcome property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_RawValue(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo *message, int32_t value); + +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber) { + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_ContendersArray = 1, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_AbstainVoteTally = 2, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_LockVoteTally = 3, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_FinishedVoteInfo = 4, +}; + +GPB_FINAL @interface GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *contendersArray; +/** The number of items in @c contendersArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger contendersArray_Count; + +@property(nonatomic, readwrite) uint32_t abstainVoteTally; + +@property(nonatomic, readwrite) BOOL hasAbstainVoteTally; +@property(nonatomic, readwrite) uint32_t lockVoteTally; + +@property(nonatomic, readwrite) BOOL hasLockVoteTally; +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo *finishedVoteInfo; +/** Test to see if @c finishedVoteInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasFinishedVoteInfo; + +@end + +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender + +typedef GPB_ENUM(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender_FieldNumber) { + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender_FieldNumber_Identifier = 1, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender_FieldNumber_VoteCount = 2, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender_FieldNumber_Document = 3, +}; + +GPB_FINAL @interface GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *identifier; + +@property(nonatomic, readwrite) uint32_t voteCount; + +@property(nonatomic, readwrite) BOOL hasVoteCount; +@property(nonatomic, readwrite, copy, null_resettable) NSData *document; +/** Test to see if @c document has been set. */ +@property(nonatomic, readwrite) BOOL hasDocument; + +@end + +#pragma mark - GetContestedResourceVotersForIdentityRequest + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityRequest_FieldNumber) { + GetContestedResourceVotersForIdentityRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityRequest_Version_OneOfCase) { + GetContestedResourceVotersForIdentityRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceVotersForIdentityRequest_Version_OneOfCase_V0 = 1, +}; + +/** + * Who voted for a contested resource to go to a specific identity? + **/ +GPB_FINAL @interface GetContestedResourceVotersForIdentityRequest : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceVotersForIdentityRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourceVotersForIdentityRequest_ClearVersionOneOfCase(GetContestedResourceVotersForIdentityRequest *message); + +#pragma mark - GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0 + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber) { + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_ContractId = 1, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_DocumentTypeName = 2, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_IndexName = 3, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_IndexValuesArray = 4, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_ContestantId = 5, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_StartAtIdentifierInfo = 6, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_Count = 7, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_OrderAscending = 8, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_Prove = 9, +}; + +GPB_FINAL @interface GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentTypeName; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *indexName; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *indexValuesArray; +/** The number of items in @c indexValuesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger indexValuesArray_Count; + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contestantId; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo *startAtIdentifierInfo; +/** Test to see if @c startAtIdentifierInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasStartAtIdentifierInfo; + +@property(nonatomic, readwrite) uint32_t count; + +@property(nonatomic, readwrite) BOOL hasCount; +@property(nonatomic, readwrite) BOOL orderAscending; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo_FieldNumber) { + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifier = 1, + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifierIncluded = 2, +}; + +GPB_FINAL @interface GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *startIdentifier; + +@property(nonatomic, readwrite) BOOL startIdentifierIncluded; + +@end + +#pragma mark - GetContestedResourceVotersForIdentityResponse + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityResponse_FieldNumber) { + GetContestedResourceVotersForIdentityResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityResponse_Version_OneOfCase) { + GetContestedResourceVotersForIdentityResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceVotersForIdentityResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetContestedResourceVotersForIdentityResponse : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceVotersForIdentityResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourceVotersForIdentityResponse_ClearVersionOneOfCase(GetContestedResourceVotersForIdentityResponse *message); + +#pragma mark - GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_FieldNumber) { + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_FieldNumber_ContestedResourceVoters = 1, + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_FieldNumber_Proof = 2, + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_Result_OneOfCase) { + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_Result_OneOfCase_ContestedResourceVoters = 1, + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters *contestedResourceVoters; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ClearResultOneOfCase(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 *message); + +#pragma mark - GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters + +typedef GPB_ENUM(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters_FieldNumber) { + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters_FieldNumber_VotersArray = 1, + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters_FieldNumber_FinishedResults = 2, +}; + +GPB_FINAL @interface GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *votersArray; +/** The number of items in @c votersArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger votersArray_Count; + +@property(nonatomic, readwrite) BOOL finishedResults; + +@end + +#pragma mark - GetContestedResourceIdentityVotesRequest + +typedef GPB_ENUM(GetContestedResourceIdentityVotesRequest_FieldNumber) { + GetContestedResourceIdentityVotesRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourceIdentityVotesRequest_Version_OneOfCase) { + GetContestedResourceIdentityVotesRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceIdentityVotesRequest_Version_OneOfCase_V0 = 1, +}; + +/** + * How did an identity vote? + **/ +GPB_FINAL @interface GetContestedResourceIdentityVotesRequest : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceIdentityVotesRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourceIdentityVotesRequest_ClearVersionOneOfCase(GetContestedResourceIdentityVotesRequest *message); + +#pragma mark - GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0 + +typedef GPB_ENUM(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber) { + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_IdentityId = 1, + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_Limit = 2, + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_Offset = 3, + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_OrderAscending = 4, + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_StartAtVotePollIdInfo = 5, + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_Prove = 6, +}; + +GPB_FINAL @interface GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +@property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Value *limit; +/** Test to see if @c limit has been set. */ +@property(nonatomic, readwrite) BOOL hasLimit; + +@property(nonatomic, readwrite, strong, null_resettable) GPBUInt32Value *offset; +/** Test to see if @c offset has been set. */ +@property(nonatomic, readwrite) BOOL hasOffset; + +@property(nonatomic, readwrite) BOOL orderAscending; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo *startAtVotePollIdInfo; +/** Test to see if @c startAtVotePollIdInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasStartAtVotePollIdInfo; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo + +typedef GPB_ENUM(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo_FieldNumber) { + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo_FieldNumber_StartAtPollIdentifier = 1, + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo_FieldNumber_StartPollIdentifierIncluded = 2, +}; + +GPB_FINAL @interface GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *startAtPollIdentifier; + +@property(nonatomic, readwrite) BOOL startPollIdentifierIncluded; + +@end + +#pragma mark - GetContestedResourceIdentityVotesResponse + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_FieldNumber) { + GetContestedResourceIdentityVotesResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_Version_OneOfCase) { + GetContestedResourceIdentityVotesResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceIdentityVotesResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetContestedResourceIdentityVotesResponse : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceIdentityVotesResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetContestedResourceIdentityVotesResponse_ClearVersionOneOfCase(GetContestedResourceIdentityVotesResponse *message); + +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_FieldNumber) { + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_FieldNumber_Votes = 1, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_FieldNumber_Proof = 2, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_Result_OneOfCase) { + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_Result_OneOfCase_Votes = 1, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes *votes; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ClearResultOneOfCase(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 *message); + +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes_FieldNumber) { + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes_FieldNumber_ContestedResourceIdentityVotesArray = 1, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes_FieldNumber_FinishedResults = 2, +}; + +GPB_FINAL @interface GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *contestedResourceIdentityVotesArray; +/** The number of items in @c contestedResourceIdentityVotesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger contestedResourceIdentityVotesArray_Count; + +@property(nonatomic, readwrite) BOOL finishedResults; + +@end + +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_FieldNumber) { + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_FieldNumber_VoteChoiceType = 1, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_FieldNumber_IdentityId = 2, +}; + +GPB_FINAL @interface GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice : GPBMessage + +@property(nonatomic, readwrite) GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType voteChoiceType; + +/** Only used when vote_choice_type is TOWARDS_IDENTITY */ +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; +/** Test to see if @c identityId has been set. */ +@property(nonatomic, readwrite) BOOL hasIdentityId; + +@end + +/** + * Fetches the raw value of a @c GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice's @c voteChoiceType property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_RawValue(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice *message); +/** + * Sets the raw value of an @c GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice's @c voteChoiceType property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_RawValue(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice *message, int32_t value); + +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote + +typedef GPB_ENUM(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber) { + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_ContractId = 1, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_DocumentTypeName = 2, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_SerializedIndexStorageValuesArray = 3, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_VoteChoice = 4, +}; + +GPB_FINAL @interface GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentTypeName; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *serializedIndexStorageValuesArray; +/** The number of items in @c serializedIndexStorageValuesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger serializedIndexStorageValuesArray_Count; + +@property(nonatomic, readwrite, strong, null_resettable) GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice *voteChoice; +/** Test to see if @c voteChoice has been set. */ +@property(nonatomic, readwrite) BOOL hasVoteChoice; + +@end + +#pragma mark - GetPrefundedSpecializedBalanceRequest + +typedef GPB_ENUM(GetPrefundedSpecializedBalanceRequest_FieldNumber) { + GetPrefundedSpecializedBalanceRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetPrefundedSpecializedBalanceRequest_Version_OneOfCase) { + GetPrefundedSpecializedBalanceRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetPrefundedSpecializedBalanceRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetPrefundedSpecializedBalanceRequest : GPBMessage + +@property(nonatomic, readonly) GetPrefundedSpecializedBalanceRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetPrefundedSpecializedBalanceRequest_ClearVersionOneOfCase(GetPrefundedSpecializedBalanceRequest *message); + +#pragma mark - GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0 + +typedef GPB_ENUM(GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0_FieldNumber) { + GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0_FieldNumber_Id_p = 1, + GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0_FieldNumber_Prove = 2, +}; + +GPB_FINAL @interface GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *id_p; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetPrefundedSpecializedBalanceResponse + +typedef GPB_ENUM(GetPrefundedSpecializedBalanceResponse_FieldNumber) { + GetPrefundedSpecializedBalanceResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetPrefundedSpecializedBalanceResponse_Version_OneOfCase) { + GetPrefundedSpecializedBalanceResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetPrefundedSpecializedBalanceResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetPrefundedSpecializedBalanceResponse : GPBMessage + +@property(nonatomic, readonly) GetPrefundedSpecializedBalanceResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetPrefundedSpecializedBalanceResponse_ClearVersionOneOfCase(GetPrefundedSpecializedBalanceResponse *message); + +#pragma mark - GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 + +typedef GPB_ENUM(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_FieldNumber) { + GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_FieldNumber_Balance = 1, + GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_FieldNumber_Proof = 2, + GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_Result_OneOfCase) { + GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_Result_OneOfCase_Balance = 1, + GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite) uint64_t balance; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_ClearResultOneOfCase(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 *message); + +#pragma mark - GetTotalCreditsInPlatformRequest + +typedef GPB_ENUM(GetTotalCreditsInPlatformRequest_FieldNumber) { + GetTotalCreditsInPlatformRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetTotalCreditsInPlatformRequest_Version_OneOfCase) { + GetTotalCreditsInPlatformRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetTotalCreditsInPlatformRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetTotalCreditsInPlatformRequest : GPBMessage + +@property(nonatomic, readonly) GetTotalCreditsInPlatformRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetTotalCreditsInPlatformRequest_ClearVersionOneOfCase(GetTotalCreditsInPlatformRequest *message); + +#pragma mark - GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0 + +typedef GPB_ENUM(GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0_FieldNumber) { + GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0_FieldNumber_Prove = 1, +}; + +GPB_FINAL @interface GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0 : GPBMessage + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetTotalCreditsInPlatformResponse + +typedef GPB_ENUM(GetTotalCreditsInPlatformResponse_FieldNumber) { + GetTotalCreditsInPlatformResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetTotalCreditsInPlatformResponse_Version_OneOfCase) { + GetTotalCreditsInPlatformResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetTotalCreditsInPlatformResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetTotalCreditsInPlatformResponse : GPBMessage + +@property(nonatomic, readonly) GetTotalCreditsInPlatformResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetTotalCreditsInPlatformResponse_ClearVersionOneOfCase(GetTotalCreditsInPlatformResponse *message); + +#pragma mark - GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 + +typedef GPB_ENUM(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_FieldNumber) { + GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_FieldNumber_Credits = 1, + GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_FieldNumber_Proof = 2, + GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_Result_OneOfCase) { + GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_Result_OneOfCase_Credits = 1, + GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite) uint64_t credits; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_ClearResultOneOfCase(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 *message); + +#pragma mark - GetPathElementsRequest + +typedef GPB_ENUM(GetPathElementsRequest_FieldNumber) { + GetPathElementsRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetPathElementsRequest_Version_OneOfCase) { + GetPathElementsRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetPathElementsRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetPathElementsRequest : GPBMessage + +@property(nonatomic, readonly) GetPathElementsRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPathElementsRequest_GetPathElementsRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetPathElementsRequest_ClearVersionOneOfCase(GetPathElementsRequest *message); + +#pragma mark - GetPathElementsRequest_GetPathElementsRequestV0 + +typedef GPB_ENUM(GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber) { + GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_PathArray = 1, + GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_KeysArray = 2, + GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_Prove = 3, +}; + +GPB_FINAL @interface GetPathElementsRequest_GetPathElementsRequestV0 : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *pathArray; +/** The number of items in @c pathArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger pathArray_Count; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysArray; +/** The number of items in @c keysArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger keysArray_Count; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetPathElementsResponse + +typedef GPB_ENUM(GetPathElementsResponse_FieldNumber) { + GetPathElementsResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetPathElementsResponse_Version_OneOfCase) { + GetPathElementsResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetPathElementsResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetPathElementsResponse : GPBMessage + +@property(nonatomic, readonly) GetPathElementsResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPathElementsResponse_GetPathElementsResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetPathElementsResponse_ClearVersionOneOfCase(GetPathElementsResponse *message); + +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0 + +typedef GPB_ENUM(GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber) { + GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Elements = 1, + GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Proof = 2, + GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase) { + GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase_Elements = 1, + GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetPathElementsResponse_GetPathElementsResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPathElementsResponse_GetPathElementsResponseV0_Elements *elements; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetPathElementsResponse_GetPathElementsResponseV0_ClearResultOneOfCase(GetPathElementsResponse_GetPathElementsResponseV0 *message); + +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0_Elements + +typedef GPB_ENUM(GetPathElementsResponse_GetPathElementsResponseV0_Elements_FieldNumber) { + GetPathElementsResponse_GetPathElementsResponseV0_Elements_FieldNumber_ElementsArray = 1, +}; + +GPB_FINAL @interface GetPathElementsResponse_GetPathElementsResponseV0_Elements : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *elementsArray; +/** The number of items in @c elementsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger elementsArray_Count; + @end NS_ASSUME_NONNULL_END diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m index e5ece015ecf..2ff171f5a56 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m @@ -36,6 +36,34 @@ GPBObjCClassDeclaration(GetConsensusParamsResponse_ConsensusParamsBlock); GPBObjCClassDeclaration(GetConsensusParamsResponse_ConsensusParamsEvidence); GPBObjCClassDeclaration(GetConsensusParamsResponse_GetConsensusParamsResponseV0); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesRequest); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesResponse); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes); +GPBObjCClassDeclaration(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice); +GPBObjCClassDeclaration(GetContestedResourceVoteStateRequest); +GPBObjCClassDeclaration(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0); +GPBObjCClassDeclaration(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo); +GPBObjCClassDeclaration(GetContestedResourceVoteStateResponse); +GPBObjCClassDeclaration(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0); +GPBObjCClassDeclaration(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender); +GPBObjCClassDeclaration(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders); +GPBObjCClassDeclaration(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo); +GPBObjCClassDeclaration(GetContestedResourceVotersForIdentityRequest); +GPBObjCClassDeclaration(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0); +GPBObjCClassDeclaration(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo); +GPBObjCClassDeclaration(GetContestedResourceVotersForIdentityResponse); +GPBObjCClassDeclaration(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0); +GPBObjCClassDeclaration(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters); +GPBObjCClassDeclaration(GetContestedResourcesRequest); +GPBObjCClassDeclaration(GetContestedResourcesRequest_GetContestedResourcesRequestV0); +GPBObjCClassDeclaration(GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo); +GPBObjCClassDeclaration(GetContestedResourcesResponse); +GPBObjCClassDeclaration(GetContestedResourcesResponse_GetContestedResourcesResponseV0); +GPBObjCClassDeclaration(GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues); GPBObjCClassDeclaration(GetDataContractHistoryRequest); GPBObjCClassDeclaration(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0); GPBObjCClassDeclaration(GetDataContractHistoryResponse); @@ -63,19 +91,13 @@ GPBObjCClassDeclaration(GetEpochsInfoResponse_GetEpochsInfoResponseV0); GPBObjCClassDeclaration(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo); GPBObjCClassDeclaration(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesRequest); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry); -GPBObjCClassDeclaration(GetIdentitiesRequest); -GPBObjCClassDeclaration(GetIdentitiesRequest_GetIdentitiesRequestV0); -GPBObjCClassDeclaration(GetIdentitiesResponse); -GPBObjCClassDeclaration(GetIdentitiesResponse_GetIdentitiesResponseV0); -GPBObjCClassDeclaration(GetIdentitiesResponse_Identities); -GPBObjCClassDeclaration(GetIdentitiesResponse_IdentityEntry); -GPBObjCClassDeclaration(GetIdentitiesResponse_IdentityValue); +GPBObjCClassDeclaration(GetIdentitiesContractKeysRequest); +GPBObjCClassDeclaration(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys); GPBObjCClassDeclaration(GetIdentityBalanceAndRevisionRequest); GPBObjCClassDeclaration(GetIdentityBalanceAndRevisionRequest_GetIdentityBalanceAndRevisionRequestV0); GPBObjCClassDeclaration(GetIdentityBalanceAndRevisionResponse); @@ -89,20 +111,39 @@ GPBObjCClassDeclaration(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0); GPBObjCClassDeclaration(GetIdentityByPublicKeyHashResponse); GPBObjCClassDeclaration(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0); +GPBObjCClassDeclaration(GetIdentityContractNonceRequest); +GPBObjCClassDeclaration(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0); +GPBObjCClassDeclaration(GetIdentityContractNonceResponse); +GPBObjCClassDeclaration(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0); GPBObjCClassDeclaration(GetIdentityKeysRequest); GPBObjCClassDeclaration(GetIdentityKeysRequest_GetIdentityKeysRequestV0); GPBObjCClassDeclaration(GetIdentityKeysResponse); GPBObjCClassDeclaration(GetIdentityKeysResponse_GetIdentityKeysResponseV0); GPBObjCClassDeclaration(GetIdentityKeysResponse_GetIdentityKeysResponseV0_Keys); +GPBObjCClassDeclaration(GetIdentityNonceRequest); +GPBObjCClassDeclaration(GetIdentityNonceRequest_GetIdentityNonceRequestV0); +GPBObjCClassDeclaration(GetIdentityNonceResponse); +GPBObjCClassDeclaration(GetIdentityNonceResponse_GetIdentityNonceResponseV0); GPBObjCClassDeclaration(GetIdentityRequest); GPBObjCClassDeclaration(GetIdentityRequest_GetIdentityRequestV0); GPBObjCClassDeclaration(GetIdentityResponse); GPBObjCClassDeclaration(GetIdentityResponse_GetIdentityResponseV0); +GPBObjCClassDeclaration(GetPathElementsRequest); +GPBObjCClassDeclaration(GetPathElementsRequest_GetPathElementsRequestV0); +GPBObjCClassDeclaration(GetPathElementsResponse); +GPBObjCClassDeclaration(GetPathElementsResponse_GetPathElementsResponseV0); +GPBObjCClassDeclaration(GetPathElementsResponse_GetPathElementsResponseV0_Elements); +GPBObjCClassDeclaration(GetPrefundedSpecializedBalanceRequest); +GPBObjCClassDeclaration(GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0); +GPBObjCClassDeclaration(GetPrefundedSpecializedBalanceResponse); +GPBObjCClassDeclaration(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0); GPBObjCClassDeclaration(GetProofsRequest); GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0); GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0_ContractRequest); GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0_DocumentRequest); GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0_IdentityRequest); +GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest); +GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest); GPBObjCClassDeclaration(GetProofsResponse); GPBObjCClassDeclaration(GetProofsResponse_GetProofsResponseV0); GPBObjCClassDeclaration(GetProtocolVersionUpgradeStateRequest); @@ -117,6 +158,18 @@ GPBObjCClassDeclaration(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0); GPBObjCClassDeclaration(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal); GPBObjCClassDeclaration(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals); +GPBObjCClassDeclaration(GetTotalCreditsInPlatformRequest); +GPBObjCClassDeclaration(GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0); +GPBObjCClassDeclaration(GetTotalCreditsInPlatformResponse); +GPBObjCClassDeclaration(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0); +GPBObjCClassDeclaration(GetVotePollsByEndDateRequest); +GPBObjCClassDeclaration(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0); +GPBObjCClassDeclaration(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo); +GPBObjCClassDeclaration(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo); +GPBObjCClassDeclaration(GetVotePollsByEndDateResponse); +GPBObjCClassDeclaration(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0); +GPBObjCClassDeclaration(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp); +GPBObjCClassDeclaration(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps); GPBObjCClassDeclaration(KeyRequestType); GPBObjCClassDeclaration(Proof); GPBObjCClassDeclaration(ResponseMetadata); @@ -152,6 +205,48 @@ @implementation PlatformRoot return descriptor; } +#pragma mark - Enum KeyPurpose + +GPBEnumDescriptor *KeyPurpose_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + static const char *valueNames = + "Authentication\000Encryption\000Decryption\000Tra" + "nsfer\000Voting\000"; + static const int32_t values[] = { + KeyPurpose_Authentication, + KeyPurpose_Encryption, + KeyPurpose_Decryption, + KeyPurpose_Transfer, + KeyPurpose_Voting, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(KeyPurpose) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:KeyPurpose_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL KeyPurpose_IsValidValue(int32_t value__) { + switch (value__) { + case KeyPurpose_Authentication: + case KeyPurpose_Encryption: + case KeyPurpose_Decryption: + case KeyPurpose_Transfer: + case KeyPurpose_Voting: + return YES; + default: + return NO; + } +} + #pragma mark - Proof @implementation Proof @@ -609,6 +704,243 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - GetIdentityNonceRequest + +@implementation GetIdentityNonceRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetIdentityNonceRequest__storage_ { + uint32_t _has_storage_[2]; + GetIdentityNonceRequest_GetIdentityNonceRequestV0 *v0; +} GetIdentityNonceRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityNonceRequest_GetIdentityNonceRequestV0), + .number = GetIdentityNonceRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityNonceRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityNonceRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetIdentityNonceRequest_ClearVersionOneOfCase(GetIdentityNonceRequest *message) { + GPBDescriptor *descriptor = [GetIdentityNonceRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityNonceRequest_GetIdentityNonceRequestV0 + +@implementation GetIdentityNonceRequest_GetIdentityNonceRequestV0 + +@dynamic identityId; +@dynamic prove; + +typedef struct GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *identityId; +} GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_Prove, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceRequest_GetIdentityNonceRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityNonceRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetIdentityContractNonceRequest + +@implementation GetIdentityContractNonceRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetIdentityContractNonceRequest__storage_ { + uint32_t _has_storage_[2]; + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 *v0; +} GetIdentityContractNonceRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0), + .number = GetIdentityContractNonceRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityContractNonceRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityContractNonceRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetIdentityContractNonceRequest_ClearVersionOneOfCase(GetIdentityContractNonceRequest *message) { + GPBDescriptor *descriptor = [GetIdentityContractNonceRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 + +@implementation GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 + +@dynamic identityId; +@dynamic contractId; +@dynamic prove; + +typedef struct GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *identityId; + NSData *contractId; +} GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_ContractId, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_Prove, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityContractNonceRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma mark - GetIdentityBalanceRequest @implementation GetIdentityBalanceRequest @@ -972,17 +1304,17 @@ void GetIdentityResponse_GetIdentityResponseV0_ClearResultOneOfCase(GetIdentityR GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesRequest +#pragma mark - GetIdentityNonceResponse -@implementation GetIdentitiesRequest +@implementation GetIdentityNonceResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetIdentitiesRequest__storage_ { +typedef struct GetIdentityNonceResponse__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesRequest_GetIdentitiesRequestV0 *v0; -} GetIdentitiesRequest__storage_; + GetIdentityNonceResponse_GetIdentityNonceResponseV0 *v0; +} GetIdentityNonceResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -992,21 +1324,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesRequest_GetIdentitiesRequestV0), - .number = GetIdentitiesRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityNonceResponse_GetIdentityNonceResponseV0), + .number = GetIdentityNonceResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetIdentityNonceResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesRequest__storage_) + storageSize:sizeof(GetIdentityNonceResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -1024,22 +1356,26 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesRequest_ClearVersionOneOfCase(GetIdentitiesRequest *message) { - GPBDescriptor *descriptor = [GetIdentitiesRequest descriptor]; +void GetIdentityNonceResponse_ClearVersionOneOfCase(GetIdentityNonceResponse *message) { + GPBDescriptor *descriptor = [GetIdentityNonceResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesRequest_GetIdentitiesRequestV0 +#pragma mark - GetIdentityNonceResponse_GetIdentityNonceResponseV0 -@implementation GetIdentitiesRequest_GetIdentitiesRequestV0 +@implementation GetIdentityNonceResponse_GetIdentityNonceResponseV0 -@dynamic idsArray, idsArray_Count; -@dynamic prove; +@dynamic resultOneOfCase; +@dynamic identityNonce; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetIdentitiesRequest_GetIdentitiesRequestV0__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *idsArray; -} GetIdentitiesRequest_GetIdentitiesRequestV0__storage_; +typedef struct GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_ { + uint32_t _has_storage_[2]; + Proof *proof; + ResponseMetadata *metadata; + uint64_t identityNonce; +} GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -1048,33 +1384,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "idsArray", + .name = "identityNonce", .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_IdsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesRequest_GetIdentitiesRequestV0__storage_, idsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, + .number = GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_IdentityNonce, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_, identityNonce), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt64, }, { - .name = "prove", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_Prove, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = 1, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, + .offset = (uint32_t)offsetof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesRequest_GetIdentitiesRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceResponse_GetIdentityNonceResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesRequest_GetIdentitiesRequestV0__storage_) + storageSize:sizeof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesRequest)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityNonceResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -1085,17 +1436,22 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesResponse - -@implementation GetIdentitiesResponse +void GetIdentityNonceResponse_GetIdentityNonceResponseV0_ClearResultOneOfCase(GetIdentityNonceResponse_GetIdentityNonceResponseV0 *message) { + GPBDescriptor *descriptor = [GetIdentityNonceResponse_GetIdentityNonceResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityContractNonceResponse + +@implementation GetIdentityContractNonceResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetIdentitiesResponse__storage_ { +typedef struct GetIdentityContractNonceResponse__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesResponse_GetIdentitiesResponseV0 *v0; -} GetIdentitiesResponse__storage_; + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *v0; +} GetIdentityContractNonceResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -1105,21 +1461,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_GetIdentitiesResponseV0), - .number = GetIdentitiesResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0), + .number = GetIdentityContractNonceResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse__storage_) + storageSize:sizeof(GetIdentityContractNonceResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -1137,175 +1493,26 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesResponse_ClearVersionOneOfCase(GetIdentitiesResponse *message) { - GPBDescriptor *descriptor = [GetIdentitiesResponse descriptor]; +void GetIdentityContractNonceResponse_ClearVersionOneOfCase(GetIdentityContractNonceResponse *message) { + GPBDescriptor *descriptor = [GetIdentityContractNonceResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesResponse_IdentityValue - -@implementation GetIdentitiesResponse_IdentityValue - -@dynamic value; - -typedef struct GetIdentitiesResponse_IdentityValue__storage_ { - uint32_t _has_storage_[1]; - NSData *value; -} GetIdentitiesResponse_IdentityValue__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "value", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesResponse_IdentityValue_FieldNumber_Value, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_IdentityValue__storage_, value), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_IdentityValue class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_IdentityValue__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesResponse_IdentityEntry - -@implementation GetIdentitiesResponse_IdentityEntry - -@dynamic key; -@dynamic hasValue, value; - -typedef struct GetIdentitiesResponse_IdentityEntry__storage_ { - uint32_t _has_storage_[1]; - NSData *key; - GetIdentitiesResponse_IdentityValue *value; -} GetIdentitiesResponse_IdentityEntry__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "key", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesResponse_IdentityEntry_FieldNumber_Key, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_IdentityEntry__storage_, key), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - { - .name = "value", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_IdentityValue), - .number = GetIdentitiesResponse_IdentityEntry_FieldNumber_Value, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_IdentityEntry__storage_, value), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_IdentityEntry class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_IdentityEntry__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesResponse_Identities - -@implementation GetIdentitiesResponse_Identities - -@dynamic identityEntriesArray, identityEntriesArray_Count; - -typedef struct GetIdentitiesResponse_Identities__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *identityEntriesArray; -} GetIdentitiesResponse_Identities__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "identityEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_IdentityEntry), - .number = GetIdentitiesResponse_Identities_FieldNumber_IdentityEntriesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_Identities__storage_, identityEntriesArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_Identities class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_Identities__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesResponse_GetIdentitiesResponseV0 +#pragma mark - GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 -@implementation GetIdentitiesResponse_GetIdentitiesResponseV0 +@implementation GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 @dynamic resultOneOfCase; -@dynamic identities; +@dynamic identityContractNonce; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetIdentitiesResponse_GetIdentitiesResponseV0__storage_ { +typedef struct GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesResponse_Identities *identities; Proof *proof; ResponseMetadata *metadata; -} GetIdentitiesResponse_GetIdentitiesResponseV0__storage_; + uint64_t identityContractNonce; +} GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -1314,40 +1521,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identities", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_Identities), - .number = GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Identities, + .name = "identityContractNonce", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_IdentityContractNonce, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_, identities), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_, identityContractNonce), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeUInt64, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Proof, + .number = GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Metadata, + .number = GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_GetIdentitiesResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_) + storageSize:sizeof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -1355,7 +1562,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityContractNonceResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -1366,8 +1573,8 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesResponse_GetIdentitiesResponseV0_ClearResultOneOfCase(GetIdentitiesResponse_GetIdentitiesResponseV0 *message) { - GPBDescriptor *descriptor = [GetIdentitiesResponse_GetIdentitiesResponseV0 descriptor]; +void GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_ClearResultOneOfCase(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *message) { + GPBDescriptor *descriptor = [GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } @@ -2313,17 +2520,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsRequest +#pragma mark - GetIdentitiesContractKeysRequest -@implementation GetProofsRequest +@implementation GetIdentitiesContractKeysRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetProofsRequest__storage_ { +typedef struct GetIdentitiesContractKeysRequest__storage_ { uint32_t _has_storage_[2]; - GetProofsRequest_GetProofsRequestV0 *v0; -} GetProofsRequest__storage_; + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 *v0; +} GetIdentitiesContractKeysRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2333,21 +2540,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0), - .number = GetProofsRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0), + .number = GetIdentitiesContractKeysRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProofsRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -2365,25 +2572,28 @@ + (GPBDescriptor *)descriptor { @end -void GetProofsRequest_ClearVersionOneOfCase(GetProofsRequest *message) { - GPBDescriptor *descriptor = [GetProofsRequest descriptor]; +void GetIdentitiesContractKeysRequest_ClearVersionOneOfCase(GetIdentitiesContractKeysRequest *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetProofsRequest_GetProofsRequestV0 +#pragma mark - GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 -@implementation GetProofsRequest_GetProofsRequestV0 +@implementation GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 -@dynamic identitiesArray, identitiesArray_Count; -@dynamic contractsArray, contractsArray_Count; -@dynamic documentsArray, documentsArray_Count; +@dynamic identitiesIdsArray, identitiesIdsArray_Count; +@dynamic contractId; +@dynamic hasDocumentTypeName, documentTypeName; +@dynamic purposesArray, purposesArray_Count; +@dynamic prove; -typedef struct GetProofsRequest_GetProofsRequestV0__storage_ { +typedef struct GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *identitiesArray; - NSMutableArray *contractsArray; - NSMutableArray *documentsArray; -} GetProofsRequest_GetProofsRequestV0__storage_; + NSMutableArray *identitiesIdsArray; + NSData *contractId; + NSString *documentTypeName; + GPBEnumArray *purposesArray; +} GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2392,42 +2602,60 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identitiesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_IdentityRequest), - .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_IdentitiesArray, + .name = "identitiesIdsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_IdentitiesIdsArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, identitiesArray), + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, identitiesIdsArray), .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, }, { - .name = "contractsArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_ContractRequest), - .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_ContractsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, contractsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_ContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, }, { - .name = "documentsArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_DocumentRequest), - .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_DocumentsArray, + .name = "documentTypeName", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_DocumentTypeName, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, documentTypeName), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "purposesArray", + .dataTypeSpecific.enumDescFunc = KeyPurpose_EnumDescriptor, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_PurposesArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, documentsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, purposesArray), + .flags = (GPBFieldFlags)(GPBFieldRepeated | GPBFieldPacked | GPBFieldHasEnumDescriptor), + .dataType = GPBDataTypeEnum, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_Prove, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0__storage_) + storageSize:sizeof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2438,21 +2666,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsRequest_GetProofsRequestV0_DocumentRequest +#pragma mark - GetIdentitiesContractKeysResponse -@implementation GetProofsRequest_GetProofsRequestV0_DocumentRequest +@implementation GetIdentitiesContractKeysResponse -@dynamic contractId; -@dynamic documentType; -@dynamic documentTypeKeepsHistory; -@dynamic documentId; +@dynamic versionOneOfCase; +@dynamic v0; -typedef struct GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_ { - uint32_t _has_storage_[1]; - NSData *contractId; - NSString *documentType; - NSData *documentId; -} GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_; +typedef struct GetIdentitiesContractKeysResponse__storage_ { + uint32_t _has_storage_[2]; + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *v0; +} GetIdentitiesContractKeysResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2461,51 +2685,29 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "contractId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_ContractId, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, contractId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - { - .name = "documentType", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentType, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentType), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, - }, - { - .name = "documentTypeKeepsHistory", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentTypeKeepsHistory, - .hasIndex = 2, - .offset = 3, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, - }, - { - .name = "documentId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentId, - .hasIndex = 4, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0), + .number = GetIdentitiesContractKeysResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_DocumentRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2516,18 +2718,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsRequest_GetProofsRequestV0_IdentityRequest - -@implementation GetProofsRequest_GetProofsRequestV0_IdentityRequest +void GetIdentitiesContractKeysResponse_ClearVersionOneOfCase(GetIdentitiesContractKeysResponse *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 -@dynamic identityId; -@dynamic requestType; +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 -typedef struct GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_ { - uint32_t _has_storage_[1]; - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type requestType; - NSData *identityId; -} GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_; +@dynamic resultOneOfCase; +@dynamic identitiesKeys; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys *identitiesKeys; + Proof *proof; + ResponseMetadata *metadata; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2536,33 +2746,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identityId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_IdentityId, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, identityId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .name = "identitiesKeys", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_IdentitiesKeys, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_, identitiesKeys), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "requestType", - .dataTypeSpecific.enumDescFunc = GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor, - .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, requestType), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeEnum, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_IdentityRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2573,65 +2798,23 @@ + (GPBDescriptor *)descriptor { @end -int32_t GetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message) { - GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; - return GPBGetMessageRawEnumField(message, field); -} - -void SetGetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message, int32_t value) { - GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; - GPBSetMessageRawEnumField(message, field, value); -} - -#pragma mark - Enum GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type - -GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor(void) { - static _Atomic(GPBEnumDescriptor*) descriptor = nil; - if (!descriptor) { - static const char *valueNames = - "FullIdentity\000Balance\000Keys\000"; - static const int32_t values[] = { - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity, - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance, - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys, - }; - GPBEnumDescriptor *worker = - [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type) - valueNames:valueNames - values:values - count:(uint32_t)(sizeof(values) / sizeof(int32_t)) - enumVerifier:GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue]; - GPBEnumDescriptor *expected = nil; - if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { - [worker release]; - } - } - return descriptor; -} - -BOOL GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue(int32_t value__) { - switch (value__) { - case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity: - case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance: - case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys: - return YES; - default: - return NO; - } +void GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_ClearResultOneOfCase(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); } +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys -#pragma mark - GetProofsRequest_GetProofsRequestV0_ContractRequest - -@implementation GetProofsRequest_GetProofsRequestV0_ContractRequest +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys -@dynamic contractId; +@dynamic purpose; +@dynamic keysBytesArray, keysBytesArray_Count; -typedef struct GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_ { +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_ { uint32_t _has_storage_[1]; - NSData *contractId; -} GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_; + KeyPurpose purpose; + NSMutableArray *keysBytesArray; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2640,24 +2823,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "contractId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber_ContractId, + .name = "purpose", + .dataTypeSpecific.enumDescFunc = KeyPurpose_EnumDescriptor, + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_, contractId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_, purpose), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, + }, + { + .name = "keysBytesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_KeysBytesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_, keysBytesArray), + .flags = GPBFieldRepeated, .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_ContractRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2668,17 +2860,30 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsResponse +int32_t GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose]; + return GPBGetMessageRawEnumField(message, field); +} -@implementation GetProofsResponse +void SetGetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message, int32_t value) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose]; + GPBSetMessageRawEnumField(message, field, value); +} -@dynamic versionOneOfCase; -@dynamic v0; +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys -typedef struct GetProofsResponse__storage_ { - uint32_t _has_storage_[2]; - GetProofsResponse_GetProofsResponseV0 *v0; -} GetProofsResponse__storage_; +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys + +@dynamic identityId; +@dynamic keysArray, keysArray_Count; + +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_ { + uint32_t _has_storage_[1]; + NSData *identityId; + NSMutableArray *keysArray; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2687,29 +2892,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsResponse_GetProofsResponseV0), - .number = GetProofsResponse_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProofsResponse__storage_, v0), - .flags = GPBFieldOptional, + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "keysArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_KeysArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_, keysArray), + .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsResponse class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsResponse__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2720,24 +2929,16 @@ + (GPBDescriptor *)descriptor { @end -void GetProofsResponse_ClearVersionOneOfCase(GetProofsResponse *message) { - GPBDescriptor *descriptor = [GetProofsResponse descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetProofsResponse_GetProofsResponseV0 +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys -@implementation GetProofsResponse_GetProofsResponseV0 +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys -@dynamic resultOneOfCase; -@dynamic proof; -@dynamic hasMetadata, metadata; +@dynamic entriesArray, entriesArray_Count; -typedef struct GetProofsResponse_GetProofsResponseV0__storage_ { - uint32_t _has_storage_[2]; - Proof *proof; - ResponseMetadata *metadata; -} GetProofsResponse_GetProofsResponseV0__storage_; +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *entriesArray; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2746,39 +2947,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, metadata), - .flags = GPBFieldOptional, + .name = "entriesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys_FieldNumber_EntriesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_, entriesArray), + .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsResponse_GetProofsResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsResponse_GetProofsResponseV0__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2789,22 +2975,17 @@ + (GPBDescriptor *)descriptor { @end -void GetProofsResponse_GetProofsResponseV0_ClearResultOneOfCase(GetProofsResponse_GetProofsResponseV0 *message) { - GPBDescriptor *descriptor = [GetProofsResponse_GetProofsResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDataContractRequest +#pragma mark - GetProofsRequest -@implementation GetDataContractRequest +@implementation GetProofsRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractRequest__storage_ { +typedef struct GetProofsRequest__storage_ { uint32_t _has_storage_[2]; - GetDataContractRequest_GetDataContractRequestV0 *v0; -} GetDataContractRequest__storage_; + GetProofsRequest_GetProofsRequestV0 *v0; +} GetProofsRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2814,21 +2995,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractRequest_GetDataContractRequestV0), - .number = GetDataContractRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0), + .number = GetProofsRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetProofsRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest class] + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractRequest__storage_) + storageSize:sizeof(GetProofsRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -2846,22 +3027,27 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractRequest_ClearVersionOneOfCase(GetDataContractRequest *message) { - GPBDescriptor *descriptor = [GetDataContractRequest descriptor]; +void GetProofsRequest_ClearVersionOneOfCase(GetProofsRequest *message) { + GPBDescriptor *descriptor = [GetProofsRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractRequest_GetDataContractRequestV0 +#pragma mark - GetProofsRequest_GetProofsRequestV0 -@implementation GetDataContractRequest_GetDataContractRequestV0 +@implementation GetProofsRequest_GetProofsRequestV0 -@dynamic id_p; -@dynamic prove; +@dynamic identitiesArray, identitiesArray_Count; +@dynamic contractsArray, contractsArray_Count; +@dynamic documentsArray, documentsArray_Count; +@dynamic votesArray, votesArray_Count; -typedef struct GetDataContractRequest_GetDataContractRequestV0__storage_ { +typedef struct GetProofsRequest_GetProofsRequestV0__storage_ { uint32_t _has_storage_[1]; - NSData *id_p; -} GetDataContractRequest_GetDataContractRequestV0__storage_; + NSMutableArray *identitiesArray; + NSMutableArray *contractsArray; + NSMutableArray *documentsArray; + NSMutableArray *votesArray; +} GetProofsRequest_GetProofsRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2870,33 +3056,3309 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "id_p", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Id_p, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractRequest_GetDataContractRequestV0__storage_, id_p), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .name = "identitiesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_IdentityRequest), + .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_IdentitiesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, identitiesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "contractsArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_ContractRequest), + .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_ContractsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, contractsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "documentsArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_DocumentRequest), + .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_DocumentsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, documentsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "votesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest), + .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_VotesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, votesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProofsRequest_GetProofsRequestV0_DocumentRequest + +@implementation GetProofsRequest_GetProofsRequestV0_DocumentRequest + +@dynamic contractId; +@dynamic documentType; +@dynamic documentTypeKeepsHistory; +@dynamic documentId; +@dynamic documentContestedStatus; + +typedef struct GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_ { + uint32_t _has_storage_[1]; + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus documentContestedStatus; + NSData *contractId; + NSString *documentType; + NSData *documentId; +} GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_ContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "documentType", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentType, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "documentTypeKeepsHistory", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentTypeKeepsHistory, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + { + .name = "documentId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentId, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "documentContestedStatus", + .dataTypeSpecific.enumDescFunc = GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_EnumDescriptor, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentContestedStatus, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentContestedStatus), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_DocumentRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +int32_t GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_RawValue(GetProofsRequest_GetProofsRequestV0_DocumentRequest *message) { + GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_DocumentRequest descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentContestedStatus]; + return GPBGetMessageRawEnumField(message, field); +} + +void SetGetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_RawValue(GetProofsRequest_GetProofsRequestV0_DocumentRequest *message, int32_t value) { + GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_DocumentRequest descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentContestedStatus]; + GPBSetMessageRawEnumField(message, field, value); +} + +#pragma mark - Enum GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus + +GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + static const char *valueNames = + "NotContested\000MaybeContested\000Contested\000"; + static const int32_t values[] = { + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_NotContested, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_MaybeContested, + GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_Contested, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_IsValidValue(int32_t value__) { + switch (value__) { + case GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_NotContested: + case GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_MaybeContested: + case GetProofsRequest_GetProofsRequestV0_DocumentRequest_DocumentContestedStatus_Contested: + return YES; + default: + return NO; + } +} + +#pragma mark - GetProofsRequest_GetProofsRequestV0_IdentityRequest + +@implementation GetProofsRequest_GetProofsRequestV0_IdentityRequest + +@dynamic identityId; +@dynamic requestType; + +typedef struct GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_ { + uint32_t _has_storage_[1]; + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type requestType; + NSData *identityId; +} GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "requestType", + .dataTypeSpecific.enumDescFunc = GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor, + .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, requestType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_IdentityRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +int32_t GetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message) { + GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; + return GPBGetMessageRawEnumField(message, field); +} + +void SetGetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message, int32_t value) { + GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; + GPBSetMessageRawEnumField(message, field, value); +} + +#pragma mark - Enum GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type + +GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + static const char *valueNames = + "FullIdentity\000Balance\000Keys\000Revision\000"; + static const int32_t values[] = { + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Revision, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue(int32_t value__) { + switch (value__) { + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity: + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance: + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys: + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Revision: + return YES; + default: + return NO; + } +} + +#pragma mark - GetProofsRequest_GetProofsRequestV0_ContractRequest + +@implementation GetProofsRequest_GetProofsRequestV0_ContractRequest + +@dynamic contractId; + +typedef struct GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_ { + uint32_t _has_storage_[1]; + NSData *contractId; +} GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber_ContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_ContractRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProofsRequest_GetProofsRequestV0_VoteStatusRequest + +@implementation GetProofsRequest_GetProofsRequestV0_VoteStatusRequest + +@dynamic requestTypeOneOfCase; +@dynamic contestedResourceVoteStatusRequest; + +typedef struct GetProofsRequest_GetProofsRequestV0_VoteStatusRequest__storage_ { + uint32_t _has_storage_[2]; + GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest *contestedResourceVoteStatusRequest; +} GetProofsRequest_GetProofsRequestV0_VoteStatusRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "contestedResourceVoteStatusRequest", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest), + .number = GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_FieldNumber_ContestedResourceVoteStatusRequest, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest__storage_, contestedResourceVoteStatusRequest), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_VoteStatusRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "requestType", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ClearRequestTypeOneOfCase(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest *message) { + GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_VoteStatusRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest + +@implementation GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest + +@dynamic contractId; +@dynamic documentTypeName; +@dynamic indexName; +@dynamic indexValuesArray, indexValuesArray_Count; +@dynamic voterIdentifier; + +typedef struct GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_ { + uint32_t _has_storage_[1]; + NSData *contractId; + NSString *documentTypeName; + NSString *indexName; + NSMutableArray *indexValuesArray; + NSData *voterIdentifier; +} GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_ContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "documentTypeName", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_DocumentTypeName, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_, documentTypeName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "indexName", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_IndexName, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_, indexName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "indexValuesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_IndexValuesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_, indexValuesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "voterIdentifier", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest_FieldNumber_VoterIdentifier, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_, voterIdentifier), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest_ContestedResourceVoteStatusRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0_VoteStatusRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProofsResponse + +@implementation GetProofsResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetProofsResponse__storage_ { + uint32_t _has_storage_[2]; + GetProofsResponse_GetProofsResponseV0 *v0; +} GetProofsResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsResponse_GetProofsResponseV0), + .number = GetProofsResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProofsResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProofsResponse_ClearVersionOneOfCase(GetProofsResponse *message) { + GPBDescriptor *descriptor = [GetProofsResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetProofsResponse_GetProofsResponseV0 + +@implementation GetProofsResponse_GetProofsResponseV0 + +@dynamic resultOneOfCase; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetProofsResponse_GetProofsResponseV0__storage_ { + uint32_t _has_storage_[2]; + Proof *proof; + ResponseMetadata *metadata; +} GetProofsResponse_GetProofsResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsResponse_GetProofsResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsResponse_GetProofsResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProofsResponse_GetProofsResponseV0_ClearResultOneOfCase(GetProofsResponse_GetProofsResponseV0 *message) { + GPBDescriptor *descriptor = [GetProofsResponse_GetProofsResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractRequest + +@implementation GetDataContractRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDataContractRequest__storage_ { + uint32_t _has_storage_[2]; + GetDataContractRequest_GetDataContractRequestV0 *v0; +} GetDataContractRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractRequest_GetDataContractRequestV0), + .number = GetDataContractRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractRequest_ClearVersionOneOfCase(GetDataContractRequest *message) { + GPBDescriptor *descriptor = [GetDataContractRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractRequest_GetDataContractRequestV0 + +@implementation GetDataContractRequest_GetDataContractRequestV0 + +@dynamic id_p; +@dynamic prove; + +typedef struct GetDataContractRequest_GetDataContractRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *id_p; +} GetDataContractRequest_GetDataContractRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "id_p", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Id_p, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractRequest_GetDataContractRequestV0__storage_, id_p), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Prove, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest_GetDataContractRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractRequest_GetDataContractRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetDataContractResponse + +@implementation GetDataContractResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDataContractResponse__storage_ { + uint32_t _has_storage_[2]; + GetDataContractResponse_GetDataContractResponseV0 *v0; +} GetDataContractResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractResponse_GetDataContractResponseV0), + .number = GetDataContractResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractResponse_ClearVersionOneOfCase(GetDataContractResponse *message) { + GPBDescriptor *descriptor = [GetDataContractResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractResponse_GetDataContractResponseV0 + +@implementation GetDataContractResponse_GetDataContractResponseV0 + +@dynamic resultOneOfCase; +@dynamic dataContract; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetDataContractResponse_GetDataContractResponseV0__storage_ { + uint32_t _has_storage_[2]; + NSData *dataContract; + Proof *proof; + ResponseMetadata *metadata; +} GetDataContractResponse_GetDataContractResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "dataContract", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_DataContract, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, dataContract), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeBytes, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse_GetDataContractResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractResponse_GetDataContractResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractResponse_GetDataContractResponseV0_ClearResultOneOfCase(GetDataContractResponse_GetDataContractResponseV0 *message) { + GPBDescriptor *descriptor = [GetDataContractResponse_GetDataContractResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractsRequest + +@implementation GetDataContractsRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDataContractsRequest__storage_ { + uint32_t _has_storage_[2]; + GetDataContractsRequest_GetDataContractsRequestV0 *v0; +} GetDataContractsRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsRequest_GetDataContractsRequestV0), + .number = GetDataContractsRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractsRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractsRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractsRequest_ClearVersionOneOfCase(GetDataContractsRequest *message) { + GPBDescriptor *descriptor = [GetDataContractsRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractsRequest_GetDataContractsRequestV0 + +@implementation GetDataContractsRequest_GetDataContractsRequestV0 + +@dynamic idsArray, idsArray_Count; +@dynamic prove; + +typedef struct GetDataContractsRequest_GetDataContractsRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *idsArray; +} GetDataContractsRequest_GetDataContractsRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "idsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_IdsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetDataContractsRequest_GetDataContractsRequestV0__storage_, idsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_Prove, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest_GetDataContractsRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractsRequest_GetDataContractsRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetDataContractsResponse + +@implementation GetDataContractsResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDataContractsResponse__storage_ { + uint32_t _has_storage_[2]; + GetDataContractsResponse_GetDataContractsResponseV0 *v0; +} GetDataContractsResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_GetDataContractsResponseV0), + .number = GetDataContractsResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractsResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractsResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractsResponse_ClearVersionOneOfCase(GetDataContractsResponse *message) { + GPBDescriptor *descriptor = [GetDataContractsResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractsResponse_DataContractEntry + +@implementation GetDataContractsResponse_DataContractEntry + +@dynamic identifier; +@dynamic hasDataContract, dataContract; + +typedef struct GetDataContractsResponse_DataContractEntry__storage_ { + uint32_t _has_storage_[1]; + NSData *identifier; + GPBBytesValue *dataContract; +} GetDataContractsResponse_DataContractEntry__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "identifier", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractsResponse_DataContractEntry_FieldNumber_Identifier, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, identifier), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "dataContract", + .dataTypeSpecific.clazz = GPBObjCClass(GPBBytesValue), + .number = GetDataContractsResponse_DataContractEntry_FieldNumber_DataContract, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, dataContract), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContractEntry class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractsResponse_DataContractEntry__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetDataContractsResponse_DataContracts + +@implementation GetDataContractsResponse_DataContracts + +@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; + +typedef struct GetDataContractsResponse_DataContracts__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *dataContractEntriesArray; +} GetDataContractsResponse_DataContracts__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "dataContractEntriesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContractEntry), + .number = GetDataContractsResponse_DataContracts_FieldNumber_DataContractEntriesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContracts__storage_, dataContractEntriesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContracts class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractsResponse_DataContracts__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetDataContractsResponse_GetDataContractsResponseV0 + +@implementation GetDataContractsResponse_GetDataContractsResponseV0 + +@dynamic resultOneOfCase; +@dynamic dataContracts; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetDataContractsResponse_GetDataContractsResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetDataContractsResponse_DataContracts *dataContracts; + Proof *proof; + ResponseMetadata *metadata; +} GetDataContractsResponse_GetDataContractsResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "dataContracts", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContracts), + .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_DataContracts, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, dataContracts), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_GetDataContractsResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractsResponse_GetDataContractsResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractsResponse_GetDataContractsResponseV0_ClearResultOneOfCase(GetDataContractsResponse_GetDataContractsResponseV0 *message) { + GPBDescriptor *descriptor = [GetDataContractsResponse_GetDataContractsResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractHistoryRequest + +@implementation GetDataContractHistoryRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDataContractHistoryRequest__storage_ { + uint32_t _has_storage_[2]; + GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 *v0; +} GetDataContractHistoryRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0), + .number = GetDataContractHistoryRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractHistoryRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractHistoryRequest_ClearVersionOneOfCase(GetDataContractHistoryRequest *message) { + GPBDescriptor *descriptor = [GetDataContractHistoryRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 + +@implementation GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 + +@dynamic id_p; +@dynamic hasLimit, limit; +@dynamic hasOffset, offset; +@dynamic startAtMs; +@dynamic prove; + +typedef struct GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *id_p; + GPBUInt32Value *limit; + GPBUInt32Value *offset; + uint64_t startAtMs; +} GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "id_p", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Id_p, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, id_p), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "limit", + .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Limit, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, limit), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "offset", + .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Offset, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, offset), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "startAtMs", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_StartAtMs, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, startAtMs), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Prove, + .hasIndex = 4, + .offset = 5, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetDataContractHistoryResponse + +@implementation GetDataContractHistoryResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDataContractHistoryResponse__storage_ { + uint32_t _has_storage_[2]; + GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *v0; +} GetDataContractHistoryResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0), + .number = GetDataContractHistoryResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractHistoryResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractHistoryResponse_ClearVersionOneOfCase(GetDataContractHistoryResponse *message) { + GPBDescriptor *descriptor = [GetDataContractHistoryResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 + +@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 + +@dynamic resultOneOfCase; +@dynamic dataContractHistory; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory *dataContractHistory; + Proof *proof; + ResponseMetadata *metadata; +} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "dataContractHistory", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory), + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_DataContractHistory, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, dataContractHistory), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_ClearResultOneOfCase(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *message) { + GPBDescriptor *descriptor = [GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry + +@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry + +@dynamic date; +@dynamic value; + +typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_ { + uint32_t _has_storage_[1]; + NSData *value; + uint64_t date; +} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "date", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Date, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, date), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, + }, + { + .name = "value", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Value, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, value), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory + +@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory + +@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; + +typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *dataContractEntriesArray; +} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "dataContractEntriesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry), + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory_FieldNumber_DataContractEntriesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_, dataContractEntriesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetDocumentsRequest + +@implementation GetDocumentsRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDocumentsRequest__storage_ { + uint32_t _has_storage_[2]; + GetDocumentsRequest_GetDocumentsRequestV0 *v0; +} GetDocumentsRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsRequest_GetDocumentsRequestV0), + .number = GetDocumentsRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDocumentsRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDocumentsRequest_ClearVersionOneOfCase(GetDocumentsRequest *message) { + GPBDescriptor *descriptor = [GetDocumentsRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDocumentsRequest_GetDocumentsRequestV0 + +@implementation GetDocumentsRequest_GetDocumentsRequestV0 + +@dynamic startOneOfCase; +@dynamic dataContractId; +@dynamic documentType; +@dynamic where; +@dynamic orderBy; +@dynamic limit; +@dynamic startAfter; +@dynamic startAt; +@dynamic prove; + +typedef struct GetDocumentsRequest_GetDocumentsRequestV0__storage_ { + uint32_t _has_storage_[2]; + uint32_t limit; + NSData *dataContractId; + NSString *documentType; + NSData *where; + NSData *orderBy; + NSData *startAfter; + NSData *startAt; +} GetDocumentsRequest_GetDocumentsRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "dataContractId", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DataContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, dataContractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "documentType", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DocumentType, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, documentType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "where", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Where, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, where), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "orderBy", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_OrderBy, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, orderBy), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "limit", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Limit, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, limit), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "startAfter", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAfter, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAfter), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeBytes, + }, + { + .name = "startAt", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAt, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAt), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Prove, + .hasIndex = 5, + .offset = 6, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest_GetDocumentsRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDocumentsRequest_GetDocumentsRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "start", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDocumentsRequest_GetDocumentsRequestV0_ClearStartOneOfCase(GetDocumentsRequest_GetDocumentsRequestV0 *message) { + GPBDescriptor *descriptor = [GetDocumentsRequest_GetDocumentsRequestV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDocumentsResponse + +@implementation GetDocumentsResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetDocumentsResponse__storage_ { + uint32_t _has_storage_[2]; + GetDocumentsResponse_GetDocumentsResponseV0 *v0; +} GetDocumentsResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0), + .number = GetDocumentsResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDocumentsResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDocumentsResponse_ClearVersionOneOfCase(GetDocumentsResponse *message) { + GPBDescriptor *descriptor = [GetDocumentsResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0 + +@implementation GetDocumentsResponse_GetDocumentsResponseV0 + +@dynamic resultOneOfCase; +@dynamic documents; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetDocumentsResponse_GetDocumentsResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetDocumentsResponse_GetDocumentsResponseV0_Documents *documents; + Proof *proof; + ResponseMetadata *metadata; +} GetDocumentsResponse_GetDocumentsResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "documents", + .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0_Documents), + .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Documents, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, documents), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDocumentsResponse_GetDocumentsResponseV0_ClearResultOneOfCase(GetDocumentsResponse_GetDocumentsResponseV0 *message) { + GPBDescriptor *descriptor = [GetDocumentsResponse_GetDocumentsResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0_Documents + +@implementation GetDocumentsResponse_GetDocumentsResponseV0_Documents + +@dynamic documentsArray, documentsArray_Count; + +typedef struct GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *documentsArray; +} GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "documentsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsResponse_GetDocumentsResponseV0_Documents_FieldNumber_DocumentsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_, documentsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0_Documents class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetIdentityByPublicKeyHashRequest + +@implementation GetIdentityByPublicKeyHashRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetIdentityByPublicKeyHashRequest__storage_ { + uint32_t _has_storage_[2]; + GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 *v0; +} GetIdentityByPublicKeyHashRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0), + .number = GetIdentityByPublicKeyHashRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityByPublicKeyHashRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetIdentityByPublicKeyHashRequest_ClearVersionOneOfCase(GetIdentityByPublicKeyHashRequest *message) { + GPBDescriptor *descriptor = [GetIdentityByPublicKeyHashRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 + +@implementation GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 + +@dynamic publicKeyHash; +@dynamic prove; + +typedef struct GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *publicKeyHash; +} GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "publicKeyHash", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0_FieldNumber_PublicKeyHash, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_, publicKeyHash), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0_FieldNumber_Prove, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityByPublicKeyHashRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetIdentityByPublicKeyHashResponse + +@implementation GetIdentityByPublicKeyHashResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetIdentityByPublicKeyHashResponse__storage_ { + uint32_t _has_storage_[2]; + GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 *v0; +} GetIdentityByPublicKeyHashResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0), + .number = GetIdentityByPublicKeyHashResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityByPublicKeyHashResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetIdentityByPublicKeyHashResponse_ClearVersionOneOfCase(GetIdentityByPublicKeyHashResponse *message) { + GPBDescriptor *descriptor = [GetIdentityByPublicKeyHashResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 + +@implementation GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 + +@dynamic resultOneOfCase; +@dynamic identity; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_ { + uint32_t _has_storage_[2]; + NSData *identity; + Proof *proof; + ResponseMetadata *metadata; +} GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "identity", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_FieldNumber_Identity, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_, identity), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeBytes, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityByPublicKeyHashResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_ClearResultOneOfCase(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 *message) { + GPBDescriptor *descriptor = [GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - WaitForStateTransitionResultRequest + +@implementation WaitForStateTransitionResultRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct WaitForStateTransitionResultRequest__storage_ { + uint32_t _has_storage_[2]; + WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 *v0; +} WaitForStateTransitionResultRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0), + .number = WaitForStateTransitionResultRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(WaitForStateTransitionResultRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(WaitForStateTransitionResultRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void WaitForStateTransitionResultRequest_ClearVersionOneOfCase(WaitForStateTransitionResultRequest *message) { + GPBDescriptor *descriptor = [WaitForStateTransitionResultRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 + +@implementation WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 + +@dynamic stateTransitionHash; +@dynamic prove; + +typedef struct WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *stateTransitionHash; +} WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "stateTransitionHash", + .dataTypeSpecific.clazz = Nil, + .number = WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0_FieldNumber_StateTransitionHash, + .hasIndex = 0, + .offset = (uint32_t)offsetof(WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_, stateTransitionHash), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0_FieldNumber_Prove, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(WaitForStateTransitionResultRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - WaitForStateTransitionResultResponse + +@implementation WaitForStateTransitionResultResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct WaitForStateTransitionResultResponse__storage_ { + uint32_t _has_storage_[2]; + WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 *v0; +} WaitForStateTransitionResultResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0), + .number = WaitForStateTransitionResultResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(WaitForStateTransitionResultResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void WaitForStateTransitionResultResponse_ClearVersionOneOfCase(WaitForStateTransitionResultResponse *message) { + GPBDescriptor *descriptor = [WaitForStateTransitionResultResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 + +@implementation WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 + +@dynamic resultOneOfCase; +@dynamic error; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_ { + uint32_t _has_storage_[2]; + StateTransitionBroadcastError *error; + Proof *proof; + ResponseMetadata *metadata; +} WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "error", + .dataTypeSpecific.clazz = GPBObjCClass(StateTransitionBroadcastError), + .number = WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_FieldNumber_Error, + .hasIndex = -1, + .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_, error), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(WaitForStateTransitionResultResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_ClearResultOneOfCase(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 *message) { + GPBDescriptor *descriptor = [WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetConsensusParamsRequest + +@implementation GetConsensusParamsRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetConsensusParamsRequest__storage_ { + uint32_t _has_storage_[2]; + GetConsensusParamsRequest_GetConsensusParamsRequestV0 *v0; +} GetConsensusParamsRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsRequest_GetConsensusParamsRequestV0), + .number = GetConsensusParamsRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetConsensusParamsRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetConsensusParamsRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetConsensusParamsRequest_ClearVersionOneOfCase(GetConsensusParamsRequest *message) { + GPBDescriptor *descriptor = [GetConsensusParamsRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetConsensusParamsRequest_GetConsensusParamsRequestV0 + +@implementation GetConsensusParamsRequest_GetConsensusParamsRequestV0 + +@dynamic height; +@dynamic prove; + +typedef struct GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_ { + uint32_t _has_storage_[1]; + int32_t height; +} GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "height", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsRequest_GetConsensusParamsRequestV0_FieldNumber_Height, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_, height), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeInt32, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsRequest_GetConsensusParamsRequestV0_FieldNumber_Prove, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsRequest_GetConsensusParamsRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetConsensusParamsResponse + +@implementation GetConsensusParamsResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetConsensusParamsResponse__storage_ { + uint32_t _has_storage_[2]; + GetConsensusParamsResponse_GetConsensusParamsResponseV0 *v0; +} GetConsensusParamsResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsResponse_GetConsensusParamsResponseV0), + .number = GetConsensusParamsResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetConsensusParamsResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetConsensusParamsResponse_ClearVersionOneOfCase(GetConsensusParamsResponse *message) { + GPBDescriptor *descriptor = [GetConsensusParamsResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetConsensusParamsResponse_ConsensusParamsBlock + +@implementation GetConsensusParamsResponse_ConsensusParamsBlock + +@dynamic maxBytes; +@dynamic maxGas; +@dynamic timeIotaMs; + +typedef struct GetConsensusParamsResponse_ConsensusParamsBlock__storage_ { + uint32_t _has_storage_[1]; + NSString *maxBytes; + NSString *maxGas; + NSString *timeIotaMs; +} GetConsensusParamsResponse_ConsensusParamsBlock__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "maxBytes", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsResponse_ConsensusParamsBlock_FieldNumber_MaxBytes, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_, maxBytes), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "maxGas", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsResponse_ConsensusParamsBlock_FieldNumber_MaxGas, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_, maxGas), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "timeIotaMs", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsResponse_ConsensusParamsBlock_FieldNumber_TimeIotaMs, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_, timeIotaMs), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse_ConsensusParamsBlock class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetConsensusParamsResponse_ConsensusParamsEvidence + +@implementation GetConsensusParamsResponse_ConsensusParamsEvidence + +@dynamic maxAgeNumBlocks; +@dynamic maxAgeDuration; +@dynamic maxBytes; + +typedef struct GetConsensusParamsResponse_ConsensusParamsEvidence__storage_ { + uint32_t _has_storage_[1]; + NSString *maxAgeNumBlocks; + NSString *maxAgeDuration; + NSString *maxBytes; +} GetConsensusParamsResponse_ConsensusParamsEvidence__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "maxAgeNumBlocks", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsResponse_ConsensusParamsEvidence_FieldNumber_MaxAgeNumBlocks, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_, maxAgeNumBlocks), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "maxAgeDuration", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsResponse_ConsensusParamsEvidence_FieldNumber_MaxAgeDuration, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_, maxAgeDuration), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "maxBytes", + .dataTypeSpecific.clazz = Nil, + .number = GetConsensusParamsResponse_ConsensusParamsEvidence_FieldNumber_MaxBytes, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_, maxBytes), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse_ConsensusParamsEvidence class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetConsensusParamsResponse_GetConsensusParamsResponseV0 + +@implementation GetConsensusParamsResponse_GetConsensusParamsResponseV0 + +@dynamic hasBlock, block; +@dynamic hasEvidence, evidence; + +typedef struct GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_ { + uint32_t _has_storage_[1]; + GetConsensusParamsResponse_ConsensusParamsBlock *block; + GetConsensusParamsResponse_ConsensusParamsEvidence *evidence; +} GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "block", + .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsResponse_ConsensusParamsBlock), + .number = GetConsensusParamsResponse_GetConsensusParamsResponseV0_FieldNumber_Block, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_, block), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "evidence", + .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsResponse_ConsensusParamsEvidence), + .number = GetConsensusParamsResponse_GetConsensusParamsResponseV0_FieldNumber_Evidence, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_, evidence), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse_GetConsensusParamsResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProtocolVersionUpgradeStateRequest + +@implementation GetProtocolVersionUpgradeStateRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetProtocolVersionUpgradeStateRequest__storage_ { + uint32_t _has_storage_[2]; + GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 *v0; +} GetProtocolVersionUpgradeStateRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0), + .number = GetProtocolVersionUpgradeStateRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeStateRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProtocolVersionUpgradeStateRequest_ClearVersionOneOfCase(GetProtocolVersionUpgradeStateRequest *message) { + GPBDescriptor *descriptor = [GetProtocolVersionUpgradeStateRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 + +@implementation GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 + +@dynamic prove; + +typedef struct GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0__storage_ { + uint32_t _has_storage_[1]; +} GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0_FieldNumber_Prove, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProtocolVersionUpgradeStateResponse + +@implementation GetProtocolVersionUpgradeStateResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetProtocolVersionUpgradeStateResponse__storage_ { + uint32_t _has_storage_[2]; + GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 *v0; +} GetProtocolVersionUpgradeStateResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0), + .number = GetProtocolVersionUpgradeStateResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeStateResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProtocolVersionUpgradeStateResponse_ClearVersionOneOfCase(GetProtocolVersionUpgradeStateResponse *message) { + GPBDescriptor *descriptor = [GetProtocolVersionUpgradeStateResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 + +@implementation GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 + +@dynamic resultOneOfCase; +@dynamic versions; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions *versions; + Proof *proof; + ResponseMetadata *metadata; +} GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "versions", + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions), + .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_FieldNumber_Versions, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_, versions), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_ClearResultOneOfCase(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 *message) { + GPBDescriptor *descriptor = [GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions + +@implementation GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions + +@dynamic versionsArray, versionsArray_Count; + +typedef struct GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *versionsArray; +} GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "versionsArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry), + .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions_FieldNumber_VersionsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_, versionsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry + +@implementation GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry + +@dynamic versionNumber; +@dynamic voteCount; + +typedef struct GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_ { + uint32_t _has_storage_[1]; + uint32_t versionNumber; + uint32_t voteCount; +} GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "versionNumber", + .dataTypeSpecific.clazz = Nil, + .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry_FieldNumber_VersionNumber, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_, versionNumber), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "voteCount", + .dataTypeSpecific.clazz = Nil, + .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry_FieldNumber_VoteCount, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_, voteCount), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProtocolVersionUpgradeVoteStatusRequest + +@implementation GetProtocolVersionUpgradeVoteStatusRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetProtocolVersionUpgradeVoteStatusRequest__storage_ { + uint32_t _has_storage_[2]; + GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 *v0; +} GetProtocolVersionUpgradeVoteStatusRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0), + .number = GetProtocolVersionUpgradeVoteStatusRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProtocolVersionUpgradeVoteStatusRequest_ClearVersionOneOfCase(GetProtocolVersionUpgradeVoteStatusRequest *message) { + GPBDescriptor *descriptor = [GetProtocolVersionUpgradeVoteStatusRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 + +@implementation GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 + +@dynamic startProTxHash; +@dynamic count; +@dynamic prove; + +typedef struct GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_ { + uint32_t _has_storage_[1]; + uint32_t count; + NSData *startProTxHash; +} GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "startProTxHash", + .dataTypeSpecific.clazz = Nil, + .number = GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0_FieldNumber_StartProTxHash, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_, startProTxHash), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "prove", + .name = "count", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Prove, + .number = GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0_FieldNumber_Count, .hasIndex = 1, - .offset = 2, // Stored in _has_storage_ to save space. + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_, count), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0_FieldNumber_Prove, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest_GetDataContractRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractRequest_GetDataContractRequestV0__storage_) + storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2907,17 +6369,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractResponse +#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse -@implementation GetDataContractResponse +@implementation GetProtocolVersionUpgradeVoteStatusResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractResponse__storage_ { +typedef struct GetProtocolVersionUpgradeVoteStatusResponse__storage_ { uint32_t _has_storage_[2]; - GetDataContractResponse_GetDataContractResponseV0 *v0; -} GetDataContractResponse__storage_; + GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 *v0; +} GetProtocolVersionUpgradeVoteStatusResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2927,21 +6389,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractResponse_GetDataContractResponseV0), - .number = GetDataContractResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0), + .number = GetProtocolVersionUpgradeVoteStatusResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse class] + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractResponse__storage_) + storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -2959,26 +6421,149 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractResponse_ClearVersionOneOfCase(GetDataContractResponse *message) { - GPBDescriptor *descriptor = [GetDataContractResponse descriptor]; +void GetProtocolVersionUpgradeVoteStatusResponse_ClearVersionOneOfCase(GetProtocolVersionUpgradeVoteStatusResponse *message) { + GPBDescriptor *descriptor = [GetProtocolVersionUpgradeVoteStatusResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractResponse_GetDataContractResponseV0 +#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 -@implementation GetDataContractResponse_GetDataContractResponseV0 +@implementation GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 @dynamic resultOneOfCase; -@dynamic dataContract; +@dynamic versions; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetDataContractResponse_GetDataContractResponseV0__storage_ { - uint32_t _has_storage_[2]; - NSData *dataContract; - Proof *proof; - ResponseMetadata *metadata; -} GetDataContractResponse_GetDataContractResponseV0__storage_; +typedef struct GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals *versions; + Proof *proof; + ResponseMetadata *metadata; +} GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "versions", + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals), + .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_FieldNumber_Versions, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_, versions), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_ClearResultOneOfCase(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 *message) { + GPBDescriptor *descriptor = [GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals + +@implementation GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals + +@dynamic versionSignalsArray, versionSignalsArray_Count; + +typedef struct GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *versionSignalsArray; +} GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "versionSignalsArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal), + .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals_FieldNumber_VersionSignalsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_, versionSignalsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal + +@implementation GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal + +@dynamic proTxHash; +@dynamic version; + +typedef struct GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_ { + uint32_t _has_storage_[1]; + uint32_t version; + NSData *proTxHash; +} GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2987,48 +6572,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContract", + .name = "proTxHash", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_DataContract, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, dataContract), - .flags = GPBFieldOptional, + .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal_FieldNumber_ProTxHash, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_, proTxHash), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, metadata), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "version", + .dataTypeSpecific.clazz = Nil, + .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal_FieldNumber_Version, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_, version), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse_GetDataContractResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractResponse_GetDataContractResponseV0__storage_) + storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3039,22 +6609,17 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractResponse_GetDataContractResponseV0_ClearResultOneOfCase(GetDataContractResponse_GetDataContractResponseV0 *message) { - GPBDescriptor *descriptor = [GetDataContractResponse_GetDataContractResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDataContractsRequest +#pragma mark - GetEpochsInfoRequest -@implementation GetDataContractsRequest +@implementation GetEpochsInfoRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractsRequest__storage_ { +typedef struct GetEpochsInfoRequest__storage_ { uint32_t _has_storage_[2]; - GetDataContractsRequest_GetDataContractsRequestV0 *v0; -} GetDataContractsRequest__storage_; + GetEpochsInfoRequest_GetEpochsInfoRequestV0 *v0; +} GetEpochsInfoRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3064,21 +6629,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsRequest_GetDataContractsRequestV0), - .number = GetDataContractsRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoRequest_GetEpochsInfoRequestV0), + .number = GetEpochsInfoRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetEpochsInfoRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest class] + [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsRequest__storage_) + storageSize:sizeof(GetEpochsInfoRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3096,22 +6661,25 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractsRequest_ClearVersionOneOfCase(GetDataContractsRequest *message) { - GPBDescriptor *descriptor = [GetDataContractsRequest descriptor]; +void GetEpochsInfoRequest_ClearVersionOneOfCase(GetEpochsInfoRequest *message) { + GPBDescriptor *descriptor = [GetEpochsInfoRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractsRequest_GetDataContractsRequestV0 +#pragma mark - GetEpochsInfoRequest_GetEpochsInfoRequestV0 -@implementation GetDataContractsRequest_GetDataContractsRequestV0 +@implementation GetEpochsInfoRequest_GetEpochsInfoRequestV0 -@dynamic idsArray, idsArray_Count; +@dynamic hasStartEpoch, startEpoch; +@dynamic count; +@dynamic ascending; @dynamic prove; -typedef struct GetDataContractsRequest_GetDataContractsRequestV0__storage_ { +typedef struct GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *idsArray; -} GetDataContractsRequest_GetDataContractsRequestV0__storage_; + uint32_t count; + GPBUInt32Value *startEpoch; +} GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3120,33 +6688,51 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "idsArray", + .name = "startEpoch", + .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), + .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_StartEpoch, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_, startEpoch), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "count", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_IdsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDataContractsRequest_GetDataContractsRequestV0__storage_, idsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, + .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_Count, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_, count), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "ascending", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_Ascending, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_Prove, - .hasIndex = 0, - .offset = 1, // Stored in _has_storage_ to save space. + .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_Prove, + .hasIndex = 4, + .offset = 5, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest_GetDataContractsRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoRequest_GetEpochsInfoRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsRequest_GetDataContractsRequestV0__storage_) + storageSize:sizeof(GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3157,17 +6743,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractsResponse +#pragma mark - GetEpochsInfoResponse -@implementation GetDataContractsResponse +@implementation GetEpochsInfoResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractsResponse__storage_ { +typedef struct GetEpochsInfoResponse__storage_ { uint32_t _has_storage_[2]; - GetDataContractsResponse_GetDataContractsResponseV0 *v0; -} GetDataContractsResponse__storage_; + GetEpochsInfoResponse_GetEpochsInfoResponseV0 *v0; +} GetEpochsInfoResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3177,21 +6763,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_GetDataContractsResponseV0), - .number = GetDataContractsResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0), + .number = GetEpochsInfoResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetEpochsInfoResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse class] + [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse__storage_) + storageSize:sizeof(GetEpochsInfoResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3209,23 +6795,26 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractsResponse_ClearVersionOneOfCase(GetDataContractsResponse *message) { - GPBDescriptor *descriptor = [GetDataContractsResponse descriptor]; +void GetEpochsInfoResponse_ClearVersionOneOfCase(GetEpochsInfoResponse *message) { + GPBDescriptor *descriptor = [GetEpochsInfoResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractsResponse_DataContractEntry +#pragma mark - GetEpochsInfoResponse_GetEpochsInfoResponseV0 -@implementation GetDataContractsResponse_DataContractEntry +@implementation GetEpochsInfoResponse_GetEpochsInfoResponseV0 -@dynamic identifier; -@dynamic hasDataContract, dataContract; +@dynamic resultOneOfCase; +@dynamic epochs; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetDataContractsResponse_DataContractEntry__storage_ { - uint32_t _has_storage_[1]; - NSData *identifier; - GPBBytesValue *dataContract; -} GetDataContractsResponse_DataContractEntry__storage_; +typedef struct GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos *epochs; + Proof *proof; + ResponseMetadata *metadata; +} GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3234,33 +6823,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identifier", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractsResponse_DataContractEntry_FieldNumber_Identifier, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, identifier), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .name = "epochs", + .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos), + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_FieldNumber_Epochs, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_, epochs), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "dataContract", - .dataTypeSpecific.clazz = GPBObjCClass(GPBBytesValue), - .number = GetDataContractsResponse_DataContractEntry_FieldNumber_DataContract, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, dataContract), + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContractEntry class] + [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse_GetEpochsInfoResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse_DataContractEntry__storage_) + storageSize:sizeof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3271,16 +6875,21 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractsResponse_DataContracts +void GetEpochsInfoResponse_GetEpochsInfoResponseV0_ClearResultOneOfCase(GetEpochsInfoResponse_GetEpochsInfoResponseV0 *message) { + GPBDescriptor *descriptor = [GetEpochsInfoResponse_GetEpochsInfoResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos -@implementation GetDataContractsResponse_DataContracts +@implementation GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos -@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; +@dynamic epochInfosArray, epochInfosArray_Count; -typedef struct GetDataContractsResponse_DataContracts__storage_ { +typedef struct GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *dataContractEntriesArray; -} GetDataContractsResponse_DataContracts__storage_; + NSMutableArray *epochInfosArray; +} GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3289,24 +6898,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContractEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContractEntry), - .number = GetDataContractsResponse_DataContracts_FieldNumber_DataContractEntriesArray, + .name = "epochInfosArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo), + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos_FieldNumber_EpochInfosArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContracts__storage_, dataContractEntriesArray), + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_, epochInfosArray), .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContracts class] + [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse_DataContracts__storage_) + storageSize:sizeof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3317,21 +6926,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractsResponse_GetDataContractsResponseV0 +#pragma mark - GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo -@implementation GetDataContractsResponse_GetDataContractsResponseV0 +@implementation GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo -@dynamic resultOneOfCase; -@dynamic dataContracts; -@dynamic proof; -@dynamic hasMetadata, metadata; +@dynamic number; +@dynamic firstBlockHeight; +@dynamic firstCoreBlockHeight; +@dynamic startTime; +@dynamic feeMultiplier; +@dynamic protocolVersion; -typedef struct GetDataContractsResponse_GetDataContractsResponseV0__storage_ { - uint32_t _has_storage_[2]; - GetDataContractsResponse_DataContracts *dataContracts; - Proof *proof; - ResponseMetadata *metadata; -} GetDataContractsResponse_GetDataContractsResponseV0__storage_; +typedef struct GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_ { + uint32_t _has_storage_[1]; + uint32_t number; + uint32_t firstCoreBlockHeight; + uint32_t protocolVersion; + uint64_t firstBlockHeight; + uint64_t startTime; + double feeMultiplier; +} GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3340,48 +6954,69 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContracts", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContracts), - .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_DataContracts, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, dataContracts), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "number", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_Number, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, number), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, }, { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "firstBlockHeight", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FirstBlockHeight, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, firstBlockHeight), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, }, { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, metadata), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "firstCoreBlockHeight", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FirstCoreBlockHeight, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, firstCoreBlockHeight), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "startTime", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_StartTime, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, startTime), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, + }, + { + .name = "feeMultiplier", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FeeMultiplier, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, feeMultiplier), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeDouble, + }, + { + .name = "protocolVersion", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_ProtocolVersion, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, protocolVersion), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_GetDataContractsResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse_GetDataContractsResponseV0__storage_) + storageSize:sizeof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3392,22 +7027,17 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractsResponse_GetDataContractsResponseV0_ClearResultOneOfCase(GetDataContractsResponse_GetDataContractsResponseV0 *message) { - GPBDescriptor *descriptor = [GetDataContractsResponse_GetDataContractsResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDataContractHistoryRequest +#pragma mark - GetContestedResourcesRequest -@implementation GetDataContractHistoryRequest +@implementation GetContestedResourcesRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractHistoryRequest__storage_ { +typedef struct GetContestedResourcesRequest__storage_ { uint32_t _has_storage_[2]; - GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 *v0; -} GetDataContractHistoryRequest__storage_; + GetContestedResourcesRequest_GetContestedResourcesRequestV0 *v0; +} GetContestedResourcesRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3417,21 +7047,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0), - .number = GetDataContractHistoryRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourcesRequest_GetContestedResourcesRequestV0), + .number = GetContestedResourcesRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetContestedResourcesRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourcesRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryRequest__storage_) + storageSize:sizeof(GetContestedResourcesRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3449,28 +7079,35 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractHistoryRequest_ClearVersionOneOfCase(GetDataContractHistoryRequest *message) { - GPBDescriptor *descriptor = [GetDataContractHistoryRequest descriptor]; +void GetContestedResourcesRequest_ClearVersionOneOfCase(GetContestedResourcesRequest *message) { + GPBDescriptor *descriptor = [GetContestedResourcesRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 +#pragma mark - GetContestedResourcesRequest_GetContestedResourcesRequestV0 -@implementation GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 +@implementation GetContestedResourcesRequest_GetContestedResourcesRequestV0 -@dynamic id_p; -@dynamic hasLimit, limit; -@dynamic hasOffset, offset; -@dynamic startAtMs; +@dynamic contractId; +@dynamic documentTypeName; +@dynamic indexName; +@dynamic startIndexValuesArray, startIndexValuesArray_Count; +@dynamic endIndexValuesArray, endIndexValuesArray_Count; +@dynamic hasStartAtValueInfo, startAtValueInfo; +@dynamic hasCount, count; +@dynamic orderAscending; @dynamic prove; -typedef struct GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_ { +typedef struct GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_ { uint32_t _has_storage_[1]; - NSData *id_p; - GPBUInt32Value *limit; - GPBUInt32Value *offset; - uint64_t startAtMs; -} GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_; + uint32_t count; + NSData *contractId; + NSString *documentTypeName; + NSString *indexName; + NSMutableArray *startIndexValuesArray; + NSMutableArray *endIndexValuesArray; + GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo *startAtValueInfo; +} GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3479,60 +7116,96 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "id_p", + .name = "contractId", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Id_p, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_ContractId, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, id_p), + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_, contractId), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "limit", - .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Limit, + .name = "documentTypeName", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_DocumentTypeName, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, limit), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_, documentTypeName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, }, { - .name = "offset", - .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Offset, + .name = "indexName", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_IndexName, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, offset), + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_, indexName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "startIndexValuesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_StartIndexValuesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_, startIndexValuesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "endIndexValuesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_EndIndexValuesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_, endIndexValuesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "startAtValueInfo", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo), + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_StartAtValueInfo, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_, startAtValueInfo), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { - .name = "startAtMs", + .name = "count", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_StartAtMs, - .hasIndex = 3, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, startAtMs), + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_Count, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_, count), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "orderAscending", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_OrderAscending, + .hasIndex = 5, + .offset = 6, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt64, + .dataType = GPBDataTypeBool, }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Prove, - .hasIndex = 4, - .offset = 5, // Stored in _has_storage_ to save space. + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_FieldNumber_Prove, + .hasIndex = 7, + .offset = 8, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourcesRequest_GetContestedResourcesRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_) + storageSize:sizeof(GetContestedResourcesRequest_GetContestedResourcesRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourcesRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3543,17 +7216,73 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractHistoryResponse +#pragma mark - GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo -@implementation GetDataContractHistoryResponse +@implementation GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo + +@dynamic startValue; +@dynamic startValueIncluded; + +typedef struct GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo__storage_ { + uint32_t _has_storage_[1]; + NSData *startValue; +} GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "startValue", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo_FieldNumber_StartValue, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo__storage_, startValue), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "startValueIncluded", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo_FieldNumber_StartValueIncluded, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetContestedResourcesRequest_GetContestedResourcesRequestV0_StartAtValueInfo__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourcesRequest_GetContestedResourcesRequestV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetContestedResourcesResponse + +@implementation GetContestedResourcesResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractHistoryResponse__storage_ { +typedef struct GetContestedResourcesResponse__storage_ { uint32_t _has_storage_[2]; - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *v0; -} GetDataContractHistoryResponse__storage_; + GetContestedResourcesResponse_GetContestedResourcesResponseV0 *v0; +} GetContestedResourcesResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3563,21 +7292,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0), - .number = GetDataContractHistoryResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourcesResponse_GetContestedResourcesResponseV0), + .number = GetContestedResourcesResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetContestedResourcesResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourcesResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse__storage_) + storageSize:sizeof(GetContestedResourcesResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3595,26 +7324,26 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractHistoryResponse_ClearVersionOneOfCase(GetDataContractHistoryResponse *message) { - GPBDescriptor *descriptor = [GetDataContractHistoryResponse descriptor]; +void GetContestedResourcesResponse_ClearVersionOneOfCase(GetContestedResourcesResponse *message) { + GPBDescriptor *descriptor = [GetContestedResourcesResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 +#pragma mark - GetContestedResourcesResponse_GetContestedResourcesResponseV0 -@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 +@implementation GetContestedResourcesResponse_GetContestedResourcesResponseV0 @dynamic resultOneOfCase; -@dynamic dataContractHistory; +@dynamic contestedResourceValues; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_ { +typedef struct GetContestedResourcesResponse_GetContestedResourcesResponseV0__storage_ { uint32_t _has_storage_[2]; - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory *dataContractHistory; + GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues *contestedResourceValues; Proof *proof; ResponseMetadata *metadata; -} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_; +} GetContestedResourcesResponse_GetContestedResourcesResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3623,40 +7352,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContractHistory", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_DataContractHistory, + .name = "contestedResourceValues", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues), + .number = GetContestedResourcesResponse_GetContestedResourcesResponseV0_FieldNumber_ContestedResourceValues, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, dataContractHistory), + .offset = (uint32_t)offsetof(GetContestedResourcesResponse_GetContestedResourcesResponseV0__storage_, contestedResourceValues), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Proof, + .number = GetContestedResourcesResponse_GetContestedResourcesResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetContestedResourcesResponse_GetContestedResourcesResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Metadata, + .number = GetContestedResourcesResponse_GetContestedResourcesResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetContestedResourcesResponse_GetContestedResourcesResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourcesResponse_GetContestedResourcesResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_) + storageSize:sizeof(GetContestedResourcesResponse_GetContestedResourcesResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -3664,7 +7393,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourcesResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3675,23 +7404,21 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_ClearResultOneOfCase(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *message) { - GPBDescriptor *descriptor = [GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 descriptor]; +void GetContestedResourcesResponse_GetContestedResourcesResponseV0_ClearResultOneOfCase(GetContestedResourcesResponse_GetContestedResourcesResponseV0 *message) { + GPBDescriptor *descriptor = [GetContestedResourcesResponse_GetContestedResourcesResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry +#pragma mark - GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues -@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry +@implementation GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues -@dynamic date; -@dynamic value; +@dynamic contestedResourceValuesArray, contestedResourceValuesArray_Count; -typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_ { +typedef struct GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues__storage_ { uint32_t _has_storage_[1]; - NSData *value; - uint64_t date; -} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_; + NSMutableArray *contestedResourceValuesArray; +} GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3700,79 +7427,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "date", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Date, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, date), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt64, - }, - { - .name = "value", + .name = "contestedResourceValuesArray", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Value, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, value), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory - -@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory - -@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; - -typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *dataContractEntriesArray; -} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "dataContractEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory_FieldNumber_DataContractEntriesArray, + .number = GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues_FieldNumber_ContestedResourceValuesArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_, dataContractEntriesArray), + .offset = (uint32_t)offsetof(GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues__storage_, contestedResourceValuesArray), .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_) + storageSize:sizeof(GetContestedResourcesResponse_GetContestedResourcesResponseV0_ContestedResourceValues__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourcesResponse_GetContestedResourcesResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3783,17 +7455,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDocumentsRequest +#pragma mark - GetVotePollsByEndDateRequest -@implementation GetDocumentsRequest +@implementation GetVotePollsByEndDateRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDocumentsRequest__storage_ { +typedef struct GetVotePollsByEndDateRequest__storage_ { uint32_t _has_storage_[2]; - GetDocumentsRequest_GetDocumentsRequestV0 *v0; -} GetDocumentsRequest__storage_; + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0 *v0; +} GetVotePollsByEndDateRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3803,21 +7475,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsRequest_GetDocumentsRequestV0), - .number = GetDocumentsRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0), + .number = GetVotePollsByEndDateRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetVotePollsByEndDateRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsRequest__storage_) + storageSize:sizeof(GetVotePollsByEndDateRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3835,35 +7507,29 @@ + (GPBDescriptor *)descriptor { @end -void GetDocumentsRequest_ClearVersionOneOfCase(GetDocumentsRequest *message) { - GPBDescriptor *descriptor = [GetDocumentsRequest descriptor]; +void GetVotePollsByEndDateRequest_ClearVersionOneOfCase(GetVotePollsByEndDateRequest *message) { + GPBDescriptor *descriptor = [GetVotePollsByEndDateRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDocumentsRequest_GetDocumentsRequestV0 +#pragma mark - GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0 -@implementation GetDocumentsRequest_GetDocumentsRequestV0 +@implementation GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0 -@dynamic startOneOfCase; -@dynamic dataContractId; -@dynamic documentType; -@dynamic where; -@dynamic orderBy; -@dynamic limit; -@dynamic startAfter; -@dynamic startAt; +@dynamic hasStartTimeInfo, startTimeInfo; +@dynamic hasEndTimeInfo, endTimeInfo; +@dynamic hasLimit, limit; +@dynamic hasOffset, offset; +@dynamic ascending; @dynamic prove; -typedef struct GetDocumentsRequest_GetDocumentsRequestV0__storage_ { - uint32_t _has_storage_[2]; +typedef struct GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0__storage_ { + uint32_t _has_storage_[1]; uint32_t limit; - NSData *dataContractId; - NSString *documentType; - NSData *where; - NSData *orderBy; - NSData *startAfter; - NSData *startAt; -} GetDocumentsRequest_GetDocumentsRequestV0__storage_; + uint32_t offset; + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo *startTimeInfo; + GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo *endTimeInfo; +} GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3872,150 +7538,69 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContractId", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DataContractId, + .name = "startTimeInfo", + .dataTypeSpecific.clazz = GPBObjCClass(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo), + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_StartTimeInfo, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, dataContractId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0__storage_, startTimeInfo), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "documentType", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DocumentType, + .name = "endTimeInfo", + .dataTypeSpecific.clazz = GPBObjCClass(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo), + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_EndTimeInfo, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, documentType), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0__storage_, endTimeInfo), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "where", + .name = "limit", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Where, + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Limit, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, where), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0__storage_, limit), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, }, { - .name = "orderBy", + .name = "offset", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_OrderBy, + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Offset, .hasIndex = 3, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, orderBy), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0__storage_, offset), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, }, { - .name = "limit", + .name = "ascending", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Limit, + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Ascending, .hasIndex = 4, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, limit), + .offset = 5, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, - }, - { - .name = "startAfter", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAfter, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAfter), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeBytes, - }, - { - .name = "startAt", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAt, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAt), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeBytes, + .dataType = GPBDataTypeBool, }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Prove, - .hasIndex = 5, - .offset = 6, // Stored in _has_storage_ to save space. + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_FieldNumber_Prove, + .hasIndex = 6, + .offset = 7, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest_GetDocumentsRequestV0 class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsRequest_GetDocumentsRequestV0__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "start", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsRequest)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -void GetDocumentsRequest_GetDocumentsRequestV0_ClearStartOneOfCase(GetDocumentsRequest_GetDocumentsRequestV0 *message) { - GPBDescriptor *descriptor = [GetDocumentsRequest_GetDocumentsRequestV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDocumentsResponse - -@implementation GetDocumentsResponse - -@dynamic versionOneOfCase; -@dynamic v0; - -typedef struct GetDocumentsResponse__storage_ { - uint32_t _has_storage_[2]; - GetDocumentsResponse_GetDocumentsResponseV0 *v0; -} GetDocumentsResponse__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0), - .number = GetDocumentsResponse_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsResponse__storage_, v0), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsResponse__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + storageSize:sizeof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetVotePollsByEndDateRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4026,26 +7611,17 @@ + (GPBDescriptor *)descriptor { @end -void GetDocumentsResponse_ClearVersionOneOfCase(GetDocumentsResponse *message) { - GPBDescriptor *descriptor = [GetDocumentsResponse descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0 +#pragma mark - GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo -@implementation GetDocumentsResponse_GetDocumentsResponseV0 +@implementation GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo -@dynamic resultOneOfCase; -@dynamic documents; -@dynamic proof; -@dynamic hasMetadata, metadata; +@dynamic startTimeMs; +@dynamic startTimeIncluded; -typedef struct GetDocumentsResponse_GetDocumentsResponseV0__storage_ { - uint32_t _has_storage_[2]; - GetDocumentsResponse_GetDocumentsResponseV0_Documents *documents; - Proof *proof; - ResponseMetadata *metadata; -} GetDocumentsResponse_GetDocumentsResponseV0__storage_; +typedef struct GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo__storage_ { + uint32_t _has_storage_[1]; + uint64_t startTimeMs; +} GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4054,48 +7630,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "documents", - .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0_Documents), - .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Documents, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, documents), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "startTimeMs", + .dataTypeSpecific.clazz = Nil, + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo_FieldNumber_StartTimeMs, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo__storage_, startTimeMs), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, }, { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, metadata), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "startTimeIncluded", + .dataTypeSpecific.clazz = Nil, + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo_FieldNumber_StartTimeIncluded, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0__storage_) + storageSize:sizeof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_StartAtTimeInfo__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4106,21 +7667,17 @@ + (GPBDescriptor *)descriptor { @end -void GetDocumentsResponse_GetDocumentsResponseV0_ClearResultOneOfCase(GetDocumentsResponse_GetDocumentsResponseV0 *message) { - GPBDescriptor *descriptor = [GetDocumentsResponse_GetDocumentsResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0_Documents +#pragma mark - GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo -@implementation GetDocumentsResponse_GetDocumentsResponseV0_Documents +@implementation GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo -@dynamic documentsArray, documentsArray_Count; +@dynamic endTimeMs; +@dynamic endTimeIncluded; -typedef struct GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_ { +typedef struct GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *documentsArray; -} GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_; + uint64_t endTimeMs; +} GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4129,24 +7686,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "documentsArray", + .name = "endTimeMs", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsResponse_GetDocumentsResponseV0_Documents_FieldNumber_DocumentsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_, documentsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo_FieldNumber_EndTimeMs, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo__storage_, endTimeMs), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, + }, + { + .name = "endTimeIncluded", + .dataTypeSpecific.clazz = Nil, + .number = GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo_FieldNumber_EndTimeIncluded, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0_Documents class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_) + storageSize:sizeof(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0_EndAtTimeInfo__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetVotePollsByEndDateRequest_GetVotePollsByEndDateRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4157,17 +7723,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesByPublicKeyHashesRequest +#pragma mark - GetVotePollsByEndDateResponse -@implementation GetIdentitiesByPublicKeyHashesRequest +@implementation GetVotePollsByEndDateResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetIdentitiesByPublicKeyHashesRequest__storage_ { +typedef struct GetVotePollsByEndDateResponse__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 *v0; -} GetIdentitiesByPublicKeyHashesRequest__storage_; + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 *v0; +} GetVotePollsByEndDateResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4177,21 +7743,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0), - .number = GetIdentitiesByPublicKeyHashesRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0), + .number = GetVotePollsByEndDateResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetVotePollsByEndDateResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesRequest class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesRequest__storage_) + storageSize:sizeof(GetVotePollsByEndDateResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -4209,22 +7775,26 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesByPublicKeyHashesRequest_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesRequest *message) { - GPBDescriptor *descriptor = [GetIdentitiesByPublicKeyHashesRequest descriptor]; +void GetVotePollsByEndDateResponse_ClearVersionOneOfCase(GetVotePollsByEndDateResponse *message) { + GPBDescriptor *descriptor = [GetVotePollsByEndDateResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 +#pragma mark - GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 -@implementation GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 +@implementation GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 -@dynamic publicKeyHashesArray, publicKeyHashesArray_Count; -@dynamic prove; +@dynamic resultOneOfCase; +@dynamic votePollsByTimestamps; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *publicKeyHashesArray; -} GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_; +typedef struct GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps *votePollsByTimestamps; + Proof *proof; + ResponseMetadata *metadata; +} GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4233,85 +7803,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "publicKeyHashesArray", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_PublicKeyHashesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_, publicKeyHashesArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, + .name = "votePollsByTimestamps", + .dataTypeSpecific.clazz = GPBObjCClass(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps), + .number = GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_FieldNumber_VotePollsByTimestamps, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0__storage_, votePollsByTimestamps), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "prove", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_Prove, - .hasIndex = 0, - .offset = 1, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesRequest)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse - -@implementation GetIdentitiesByPublicKeyHashesResponse - -@dynamic versionOneOfCase; -@dynamic v0; - -typedef struct GetIdentitiesByPublicKeyHashesResponse__storage_ { - uint32_t _has_storage_[2]; - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *v0; -} GetIdentitiesByPublicKeyHashesResponse__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0), - .number = GetIdentitiesByPublicKeyHashesResponse_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse__storage_, v0), + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse__storage_) + storageSize:sizeof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { - "version", + "result", }; [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetVotePollsByEndDateResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4322,23 +7855,23 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesByPublicKeyHashesResponse_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesResponse *message) { - GPBDescriptor *descriptor = [GetIdentitiesByPublicKeyHashesResponse descriptor]; +void GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_ClearResultOneOfCase(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 *message) { + GPBDescriptor *descriptor = [GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry +#pragma mark - GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp -@implementation GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry +@implementation GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp -@dynamic publicKeyHash; -@dynamic hasValue, value; +@dynamic timestamp; +@dynamic serializedVotePollsArray, serializedVotePollsArray_Count; -typedef struct GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_ { +typedef struct GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp__storage_ { uint32_t _has_storage_[1]; - NSData *publicKeyHash; - GPBBytesValue *value; -} GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_; + NSMutableArray *serializedVotePollsArray; + uint64_t timestamp; +} GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4347,33 +7880,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "publicKeyHash", + .name = "timestamp", .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_PublicKeyHash, + .number = GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp_FieldNumber_Timestamp, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_, publicKeyHash), + .offset = (uint32_t)offsetof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp__storage_, timestamp), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .dataType = GPBDataTypeUInt64, }, { - .name = "value", - .dataTypeSpecific.clazz = GPBObjCClass(GPBBytesValue), - .number = GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_Value, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_, value), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "serializedVotePollsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp_FieldNumber_SerializedVotePollsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp__storage_, serializedVotePollsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_) + storageSize:sizeof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4384,16 +7917,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes +#pragma mark - GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps -@implementation GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes +@implementation GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps -@dynamic identityEntriesArray, identityEntriesArray_Count; +@dynamic votePollsByTimestampsArray, votePollsByTimestampsArray_Count; +@dynamic finishedResults; -typedef struct GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_ { +typedef struct GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *identityEntriesArray; -} GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_; + NSMutableArray *votePollsByTimestampsArray; +} GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4402,24 +7936,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identityEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry), - .number = GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes_FieldNumber_IdentityEntriesArray, + .name = "votePollsByTimestampsArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamp), + .number = GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps_FieldNumber_VotePollsByTimestampsArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_, identityEntriesArray), + .offset = (uint32_t)offsetof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps__storage_, votePollsByTimestampsArray), .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, + { + .name = "finishedResults", + .dataTypeSpecific.clazz = Nil, + .number = GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps_FieldNumber_FinishedResults, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes class] + [GPBDescriptor allocDescriptorForClass:[GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_) + storageSize:sizeof(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0_SerializedVotePollsByTimestamps__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetVotePollsByEndDateResponse_GetVotePollsByEndDateResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4430,21 +7973,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 +#pragma mark - GetContestedResourceVoteStateRequest -@implementation GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 +@implementation GetContestedResourceVoteStateRequest -@dynamic resultOneOfCase; -@dynamic identities; -@dynamic proof; -@dynamic hasMetadata, metadata; +@dynamic versionOneOfCase; +@dynamic v0; -typedef struct GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_ { +typedef struct GetContestedResourceVoteStateRequest__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes *identities; - Proof *proof; - ResponseMetadata *metadata; -} GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_; + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 *v0; +} GetContestedResourceVoteStateRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4453,48 +7992,29 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identities", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes), - .number = GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Identities, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_, identities), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Proof, + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0), + .number = GetContestedResourceVoteStateRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_) + storageSize:sizeof(GetContestedResourceVoteStateRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { - "result", + "version", }; [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4505,22 +8025,35 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_ClearResultOneOfCase(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *message) { - GPBDescriptor *descriptor = [GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 descriptor]; +void GetContestedResourceVoteStateRequest_ClearVersionOneOfCase(GetContestedResourceVoteStateRequest *message) { + GPBDescriptor *descriptor = [GetContestedResourceVoteStateRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentityByPublicKeyHashRequest +#pragma mark - GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 -@implementation GetIdentityByPublicKeyHashRequest +@implementation GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 -@dynamic versionOneOfCase; -@dynamic v0; +@dynamic contractId; +@dynamic documentTypeName; +@dynamic indexName; +@dynamic indexValuesArray, indexValuesArray_Count; +@dynamic resultType; +@dynamic allowIncludeLockedAndAbstainingVoteTally; +@dynamic hasStartAtIdentifierInfo, startAtIdentifierInfo; +@dynamic hasCount, count; +@dynamic prove; -typedef struct GetIdentityByPublicKeyHashRequest__storage_ { - uint32_t _has_storage_[2]; - GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 *v0; -} GetIdentityByPublicKeyHashRequest__storage_; +typedef struct GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_ { + uint32_t _has_storage_[1]; + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType resultType; + uint32_t count; + NSData *contractId; + NSString *documentTypeName; + NSString *indexName; + NSMutableArray *indexValuesArray; + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo *startAtIdentifierInfo; +} GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4529,29 +8062,96 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0), - .number = GetIdentityByPublicKeyHashRequest_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashRequest__storage_, v0), + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_ContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "documentTypeName", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_DocumentTypeName, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_, documentTypeName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "indexName", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_IndexName, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_, indexName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "indexValuesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_IndexValuesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_, indexValuesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "resultType", + .dataTypeSpecific.enumDescFunc = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_EnumDescriptor, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_ResultType, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_, resultType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, + }, + { + .name = "allowIncludeLockedAndAbstainingVoteTally", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_AllowIncludeLockedAndAbstainingVoteTally, + .hasIndex = 4, + .offset = 5, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + { + .name = "startAtIdentifierInfo", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo), + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_StartAtIdentifierInfo, + .hasIndex = 6, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_, startAtIdentifierInfo), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "count", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_Count, + .hasIndex = 7, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_, count), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_Prove, + .hasIndex = 8, + .offset = 9, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashRequest class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentityByPublicKeyHashRequest__storage_) + storageSize:sizeof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVoteStateRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4562,22 +8162,67 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentityByPublicKeyHashRequest_ClearVersionOneOfCase(GetIdentityByPublicKeyHashRequest *message) { - GPBDescriptor *descriptor = [GetIdentityByPublicKeyHashRequest descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); +int32_t GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_RawValue(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 *message) { + GPBDescriptor *descriptor = [GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_ResultType]; + return GPBGetMessageRawEnumField(message, field); } -#pragma mark - GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 -@implementation GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 +void SetGetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_RawValue(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 *message, int32_t value) { + GPBDescriptor *descriptor = [GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0 descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_FieldNumber_ResultType]; + GPBSetMessageRawEnumField(message, field, value); +} -@dynamic publicKeyHash; -@dynamic prove; +#pragma mark - Enum GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType -typedef struct GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_ { +GPBEnumDescriptor *GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + static const char *valueNames = + "Documents\000VoteTally\000DocumentsAndVoteTall" + "y\000"; + static const int32_t values[] = { + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_Documents, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_VoteTally, + GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_DocumentsAndVoteTally, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_IsValidValue(int32_t value__) { + switch (value__) { + case GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_Documents: + case GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_VoteTally: + case GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_ResultType_DocumentsAndVoteTally: + return YES; + default: + return NO; + } +} + +#pragma mark - GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo + +@implementation GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo + +@dynamic startIdentifier; +@dynamic startIdentifierIncluded; + +typedef struct GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo__storage_ { uint32_t _has_storage_[1]; - NSData *publicKeyHash; -} GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_; + NSData *startIdentifier; +} GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4586,18 +8231,18 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "publicKeyHash", + .name = "startIdentifier", .dataTypeSpecific.clazz = Nil, - .number = GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0_FieldNumber_PublicKeyHash, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifier, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_, publicKeyHash), + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo__storage_, startIdentifier), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "prove", + .name = "startIdentifierIncluded", .dataTypeSpecific.clazz = Nil, - .number = GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0_FieldNumber_Prove, + .number = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifierIncluded, .hasIndex = 1, .offset = 2, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), @@ -4605,14 +8250,14 @@ + (GPBDescriptor *)descriptor { }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0__storage_) + storageSize:sizeof(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityByPublicKeyHashRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4623,17 +8268,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentityByPublicKeyHashResponse +#pragma mark - GetContestedResourceVoteStateResponse -@implementation GetIdentityByPublicKeyHashResponse +@implementation GetContestedResourceVoteStateResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetIdentityByPublicKeyHashResponse__storage_ { +typedef struct GetContestedResourceVoteStateResponse__storage_ { uint32_t _has_storage_[2]; - GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 *v0; -} GetIdentityByPublicKeyHashResponse__storage_; + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 *v0; +} GetContestedResourceVoteStateResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4643,21 +8288,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0), - .number = GetIdentityByPublicKeyHashResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0), + .number = GetContestedResourceVoteStateResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashResponse class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentityByPublicKeyHashResponse__storage_) + storageSize:sizeof(GetContestedResourceVoteStateResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -4675,26 +8320,26 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentityByPublicKeyHashResponse_ClearVersionOneOfCase(GetIdentityByPublicKeyHashResponse *message) { - GPBDescriptor *descriptor = [GetIdentityByPublicKeyHashResponse descriptor]; +void GetContestedResourceVoteStateResponse_ClearVersionOneOfCase(GetContestedResourceVoteStateResponse *message) { + GPBDescriptor *descriptor = [GetContestedResourceVoteStateResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 -@implementation GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 +@implementation GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 @dynamic resultOneOfCase; -@dynamic identity; +@dynamic contestedResourceContenders; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_ { +typedef struct GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0__storage_ { uint32_t _has_storage_[2]; - NSData *identity; + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders *contestedResourceContenders; Proof *proof; ResponseMetadata *metadata; -} GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_; +} GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4703,40 +8348,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identity", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_FieldNumber_Identity, + .name = "contestedResourceContenders", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders), + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FieldNumber_ContestedResourceContenders, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_, identity), + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0__storage_, contestedResourceContenders), .flags = GPBFieldOptional, - .dataType = GPBDataTypeBytes, + .dataType = GPBDataTypeMessage, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_FieldNumber_Proof, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_FieldNumber_Metadata, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0__storage_) + storageSize:sizeof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -4744,7 +8389,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityByPublicKeyHashResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVoteStateResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4755,22 +8400,31 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0_ClearResultOneOfCase(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 *message) { - GPBDescriptor *descriptor = [GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0 descriptor]; +void GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ClearResultOneOfCase(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 *message) { + GPBDescriptor *descriptor = [GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - WaitForStateTransitionResultRequest +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo -@implementation WaitForStateTransitionResultRequest +@implementation GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo -@dynamic versionOneOfCase; -@dynamic v0; +@dynamic finishedVoteOutcome; +@dynamic hasWonByIdentityId, wonByIdentityId; +@dynamic finishedAtBlockHeight; +@dynamic finishedAtCoreBlockHeight; +@dynamic finishedAtBlockTimeMs; +@dynamic finishedAtEpoch; -typedef struct WaitForStateTransitionResultRequest__storage_ { - uint32_t _has_storage_[2]; - WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 *v0; -} WaitForStateTransitionResultRequest__storage_; +typedef struct GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_ { + uint32_t _has_storage_[1]; + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome finishedVoteOutcome; + uint32_t finishedAtCoreBlockHeight; + uint32_t finishedAtEpoch; + NSData *wonByIdentityId; + uint64_t finishedAtBlockHeight; + uint64_t finishedAtBlockTimeMs; +} GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4779,29 +8433,69 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0), - .number = WaitForStateTransitionResultRequest_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(WaitForStateTransitionResultRequest__storage_, v0), + .name = "finishedVoteOutcome", + .dataTypeSpecific.enumDescFunc = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_EnumDescriptor, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedVoteOutcome, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_, finishedVoteOutcome), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, + }, + { + .name = "wonByIdentityId", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_WonByIdentityId, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_, wonByIdentityId), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, + }, + { + .name = "finishedAtBlockHeight", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtBlockHeight, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_, finishedAtBlockHeight), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, + }, + { + .name = "finishedAtCoreBlockHeight", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtCoreBlockHeight, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_, finishedAtCoreBlockHeight), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "finishedAtBlockTimeMs", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtBlockTimeMs, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_, finishedAtBlockTimeMs), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, + }, + { + .name = "finishedAtEpoch", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedAtEpoch, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_, finishedAtEpoch), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultRequest class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(WaitForStateTransitionResultRequest__storage_) + storageSize:sizeof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4812,78 +8506,71 @@ + (GPBDescriptor *)descriptor { @end -void WaitForStateTransitionResultRequest_ClearVersionOneOfCase(WaitForStateTransitionResultRequest *message) { - GPBDescriptor *descriptor = [WaitForStateTransitionResultRequest descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); +int32_t GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_RawValue(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo *message) { + GPBDescriptor *descriptor = [GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedVoteOutcome]; + return GPBGetMessageRawEnumField(message, field); } -#pragma mark - WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 - -@implementation WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 -@dynamic stateTransitionHash; -@dynamic prove; +void SetGetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_RawValue(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo *message, int32_t value) { + GPBDescriptor *descriptor = [GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FieldNumber_FinishedVoteOutcome]; + GPBSetMessageRawEnumField(message, field, value); +} -typedef struct WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_ { - uint32_t _has_storage_[1]; - NSData *stateTransitionHash; -} WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_; +#pragma mark - Enum GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; +GPBEnumDescriptor *GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "stateTransitionHash", - .dataTypeSpecific.clazz = Nil, - .number = WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0_FieldNumber_StateTransitionHash, - .hasIndex = 0, - .offset = (uint32_t)offsetof(WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_, stateTransitionHash), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - { - .name = "prove", - .dataTypeSpecific.clazz = Nil, - .number = WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0_FieldNumber_Prove, - .hasIndex = 1, - .offset = 2, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, - }, + static const char *valueNames = + "TowardsIdentity\000Locked\000NoPreviousWinner\000"; + static const int32_t values[] = { + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_TowardsIdentity, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_Locked, + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_NoPreviousWinner, }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(WaitForStateTransitionResultRequest)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } } return descriptor; } -@end +BOOL GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_IsValidValue(int32_t value__) { + switch (value__) { + case GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_TowardsIdentity: + case GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_Locked: + case GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo_FinishedVoteOutcome_NoPreviousWinner: + return YES; + default: + return NO; + } +} -#pragma mark - WaitForStateTransitionResultResponse +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders -@implementation WaitForStateTransitionResultResponse +@implementation GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders -@dynamic versionOneOfCase; -@dynamic v0; +@dynamic contendersArray, contendersArray_Count; +@dynamic hasAbstainVoteTally, abstainVoteTally; +@dynamic hasLockVoteTally, lockVoteTally; +@dynamic hasFinishedVoteInfo, finishedVoteInfo; -typedef struct WaitForStateTransitionResultResponse__storage_ { - uint32_t _has_storage_[2]; - WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 *v0; -} WaitForStateTransitionResultResponse__storage_; +typedef struct GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders__storage_ { + uint32_t _has_storage_[1]; + uint32_t abstainVoteTally; + uint32_t lockVoteTally; + NSMutableArray *contendersArray; + GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo *finishedVoteInfo; +} GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4892,29 +8579,51 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0), - .number = WaitForStateTransitionResultResponse_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse__storage_, v0), + .name = "contendersArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender), + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_ContendersArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders__storage_, contendersArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "abstainVoteTally", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_AbstainVoteTally, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders__storage_, abstainVoteTally), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "lockVoteTally", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_LockVoteTally, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders__storage_, lockVoteTally), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "finishedVoteInfo", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_FinishedVoteInfo), + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders_FieldNumber_FinishedVoteInfo, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders__storage_, finishedVoteInfo), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultResponse class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(WaitForStateTransitionResultResponse__storage_) + storageSize:sizeof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_ContestedResourceContenders__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4925,26 +8634,20 @@ + (GPBDescriptor *)descriptor { @end -void WaitForStateTransitionResultResponse_ClearVersionOneOfCase(WaitForStateTransitionResultResponse *message) { - GPBDescriptor *descriptor = [WaitForStateTransitionResultResponse descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 +#pragma mark - GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender -@implementation WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 +@implementation GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender -@dynamic resultOneOfCase; -@dynamic error; -@dynamic proof; -@dynamic hasMetadata, metadata; +@dynamic identifier; +@dynamic hasVoteCount, voteCount; +@dynamic hasDocument, document; -typedef struct WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_ { - uint32_t _has_storage_[2]; - StateTransitionBroadcastError *error; - Proof *proof; - ResponseMetadata *metadata; -} WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_; +typedef struct GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender__storage_ { + uint32_t _has_storage_[1]; + uint32_t voteCount; + NSData *identifier; + NSData *document; +} GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4953,48 +8656,42 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "error", - .dataTypeSpecific.clazz = GPBObjCClass(StateTransitionBroadcastError), - .number = WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_FieldNumber_Error, - .hasIndex = -1, - .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_, error), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "identifier", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender_FieldNumber_Identifier, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender__storage_, identifier), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, }, { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_, proof), + .name = "voteCount", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender_FieldNumber_VoteCount, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender__storage_, voteCount), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeUInt32, }, { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_, metadata), + .name = "document", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender_FieldNumber_Document, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender__storage_, document), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0__storage_) + storageSize:sizeof(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0_Contender__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(WaitForStateTransitionResultResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVoteStateResponse_GetContestedResourceVoteStateResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5005,22 +8702,17 @@ + (GPBDescriptor *)descriptor { @end -void WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0_ClearResultOneOfCase(WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 *message) { - GPBDescriptor *descriptor = [WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetConsensusParamsRequest +#pragma mark - GetContestedResourceVotersForIdentityRequest -@implementation GetConsensusParamsRequest +@implementation GetContestedResourceVotersForIdentityRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetConsensusParamsRequest__storage_ { +typedef struct GetContestedResourceVotersForIdentityRequest__storage_ { uint32_t _has_storage_[2]; - GetConsensusParamsRequest_GetConsensusParamsRequestV0 *v0; -} GetConsensusParamsRequest__storage_; + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0 *v0; +} GetContestedResourceVotersForIdentityRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5030,21 +8722,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsRequest_GetConsensusParamsRequestV0), - .number = GetConsensusParamsRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0), + .number = GetContestedResourceVotersForIdentityRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetConsensusParamsRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsRequest class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVotersForIdentityRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetConsensusParamsRequest__storage_) + storageSize:sizeof(GetContestedResourceVotersForIdentityRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -5062,22 +8754,35 @@ + (GPBDescriptor *)descriptor { @end -void GetConsensusParamsRequest_ClearVersionOneOfCase(GetConsensusParamsRequest *message) { - GPBDescriptor *descriptor = [GetConsensusParamsRequest descriptor]; +void GetContestedResourceVotersForIdentityRequest_ClearVersionOneOfCase(GetContestedResourceVotersForIdentityRequest *message) { + GPBDescriptor *descriptor = [GetContestedResourceVotersForIdentityRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetConsensusParamsRequest_GetConsensusParamsRequestV0 +#pragma mark - GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0 -@implementation GetConsensusParamsRequest_GetConsensusParamsRequestV0 +@implementation GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0 -@dynamic height; +@dynamic contractId; +@dynamic documentTypeName; +@dynamic indexName; +@dynamic indexValuesArray, indexValuesArray_Count; +@dynamic contestantId; +@dynamic hasStartAtIdentifierInfo, startAtIdentifierInfo; +@dynamic hasCount, count; +@dynamic orderAscending; @dynamic prove; -typedef struct GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_ { +typedef struct GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_ { uint32_t _has_storage_[1]; - int32_t height; -} GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_; + uint32_t count; + NSData *contractId; + NSString *documentTypeName; + NSString *indexName; + NSMutableArray *indexValuesArray; + NSData *contestantId; + GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo *startAtIdentifierInfo; +} GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5086,18 +8791,137 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "height", + .name = "contractId", .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsRequest_GetConsensusParamsRequestV0_FieldNumber_Height, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_ContractId, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_, height), + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_, contractId), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeInt32, + .dataType = GPBDataTypeBytes, + }, + { + .name = "documentTypeName", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_DocumentTypeName, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_, documentTypeName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "indexName", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_IndexName, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_, indexName), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "indexValuesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_IndexValuesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_, indexValuesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "contestantId", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_ContestantId, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_, contestantId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "startAtIdentifierInfo", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo), + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_StartAtIdentifierInfo, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_, startAtIdentifierInfo), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "count", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_Count, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_, count), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "orderAscending", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_OrderAscending, + .hasIndex = 6, + .offset = 7, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsRequest_GetConsensusParamsRequestV0_FieldNumber_Prove, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_FieldNumber_Prove, + .hasIndex = 8, + .offset = 9, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVotersForIdentityRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo + +@implementation GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo + +@dynamic startIdentifier; +@dynamic startIdentifierIncluded; + +typedef struct GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo__storage_ { + uint32_t _has_storage_[1]; + NSData *startIdentifier; +} GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "startIdentifier", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifier, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo__storage_, startIdentifier), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "startIdentifierIncluded", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo_FieldNumber_StartIdentifierIncluded, .hasIndex = 1, .offset = 2, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), @@ -5105,14 +8929,14 @@ + (GPBDescriptor *)descriptor { }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsRequest_GetConsensusParamsRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetConsensusParamsRequest_GetConsensusParamsRequestV0__storage_) + storageSize:sizeof(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0_StartAtIdentifierInfo__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVotersForIdentityRequest_GetContestedResourceVotersForIdentityRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5123,17 +8947,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetConsensusParamsResponse +#pragma mark - GetContestedResourceVotersForIdentityResponse -@implementation GetConsensusParamsResponse +@implementation GetContestedResourceVotersForIdentityResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetConsensusParamsResponse__storage_ { +typedef struct GetContestedResourceVotersForIdentityResponse__storage_ { uint32_t _has_storage_[2]; - GetConsensusParamsResponse_GetConsensusParamsResponseV0 *v0; -} GetConsensusParamsResponse__storage_; + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 *v0; +} GetContestedResourceVotersForIdentityResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5143,21 +8967,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsResponse_GetConsensusParamsResponseV0), - .number = GetConsensusParamsResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0), + .number = GetContestedResourceVotersForIdentityResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVotersForIdentityResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetConsensusParamsResponse__storage_) + storageSize:sizeof(GetContestedResourceVotersForIdentityResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -5175,25 +8999,26 @@ + (GPBDescriptor *)descriptor { @end -void GetConsensusParamsResponse_ClearVersionOneOfCase(GetConsensusParamsResponse *message) { - GPBDescriptor *descriptor = [GetConsensusParamsResponse descriptor]; +void GetContestedResourceVotersForIdentityResponse_ClearVersionOneOfCase(GetContestedResourceVotersForIdentityResponse *message) { + GPBDescriptor *descriptor = [GetContestedResourceVotersForIdentityResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetConsensusParamsResponse_ConsensusParamsBlock +#pragma mark - GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 -@implementation GetConsensusParamsResponse_ConsensusParamsBlock +@implementation GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 -@dynamic maxBytes; -@dynamic maxGas; -@dynamic timeIotaMs; +@dynamic resultOneOfCase; +@dynamic contestedResourceVoters; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetConsensusParamsResponse_ConsensusParamsBlock__storage_ { - uint32_t _has_storage_[1]; - NSString *maxBytes; - NSString *maxGas; - NSString *timeIotaMs; -} GetConsensusParamsResponse_ConsensusParamsBlock__storage_; +typedef struct GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters *contestedResourceVoters; + Proof *proof; + ResponseMetadata *metadata; +} GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5202,42 +9027,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "maxBytes", - .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsResponse_ConsensusParamsBlock_FieldNumber_MaxBytes, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_, maxBytes), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, + .name = "contestedResourceVoters", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters), + .number = GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_FieldNumber_ContestedResourceVoters, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0__storage_, contestedResourceVoters), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "maxGas", - .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsResponse_ConsensusParamsBlock_FieldNumber_MaxGas, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_, maxGas), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "timeIotaMs", - .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsResponse_ConsensusParamsBlock_FieldNumber_TimeIotaMs, - .hasIndex = 2, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_, timeIotaMs), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse_ConsensusParamsBlock class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetConsensusParamsResponse_ConsensusParamsBlock__storage_) + storageSize:sizeof(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsResponse)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVotersForIdentityResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5248,20 +9079,22 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetConsensusParamsResponse_ConsensusParamsEvidence +void GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ClearResultOneOfCase(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 *message) { + GPBDescriptor *descriptor = [GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters -@implementation GetConsensusParamsResponse_ConsensusParamsEvidence +@implementation GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters -@dynamic maxAgeNumBlocks; -@dynamic maxAgeDuration; -@dynamic maxBytes; +@dynamic votersArray, votersArray_Count; +@dynamic finishedResults; -typedef struct GetConsensusParamsResponse_ConsensusParamsEvidence__storage_ { +typedef struct GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters__storage_ { uint32_t _has_storage_[1]; - NSString *maxAgeNumBlocks; - NSString *maxAgeDuration; - NSString *maxBytes; -} GetConsensusParamsResponse_ConsensusParamsEvidence__storage_; + NSMutableArray *votersArray; +} GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5270,42 +9103,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "maxAgeNumBlocks", - .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsResponse_ConsensusParamsEvidence_FieldNumber_MaxAgeNumBlocks, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_, maxAgeNumBlocks), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, - }, - { - .name = "maxAgeDuration", + .name = "votersArray", .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsResponse_ConsensusParamsEvidence_FieldNumber_MaxAgeDuration, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_, maxAgeDuration), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, + .number = GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters_FieldNumber_VotersArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters__storage_, votersArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, }, { - .name = "maxBytes", + .name = "finishedResults", .dataTypeSpecific.clazz = Nil, - .number = GetConsensusParamsResponse_ConsensusParamsEvidence_FieldNumber_MaxBytes, - .hasIndex = 2, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_, maxBytes), + .number = GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters_FieldNumber_FinishedResults, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse_ConsensusParamsEvidence class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetConsensusParamsResponse_ConsensusParamsEvidence__storage_) + storageSize:sizeof(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0_ContestedResourceVoters__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceVotersForIdentityResponse_GetContestedResourceVotersForIdentityResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5316,18 +9140,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetConsensusParamsResponse_GetConsensusParamsResponseV0 +#pragma mark - GetContestedResourceIdentityVotesRequest -@implementation GetConsensusParamsResponse_GetConsensusParamsResponseV0 +@implementation GetContestedResourceIdentityVotesRequest -@dynamic hasBlock, block; -@dynamic hasEvidence, evidence; +@dynamic versionOneOfCase; +@dynamic v0; -typedef struct GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_ { - uint32_t _has_storage_[1]; - GetConsensusParamsResponse_ConsensusParamsBlock *block; - GetConsensusParamsResponse_ConsensusParamsEvidence *evidence; -} GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_; +typedef struct GetContestedResourceIdentityVotesRequest__storage_ { + uint32_t _has_storage_[2]; + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0 *v0; +} GetContestedResourceIdentityVotesRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5336,33 +9159,29 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "block", - .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsResponse_ConsensusParamsBlock), - .number = GetConsensusParamsResponse_GetConsensusParamsResponseV0_FieldNumber_Block, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_, block), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "evidence", - .dataTypeSpecific.clazz = GPBObjCClass(GetConsensusParamsResponse_ConsensusParamsEvidence), - .number = GetConsensusParamsResponse_GetConsensusParamsResponseV0_FieldNumber_Evidence, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_, evidence), + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0), + .number = GetContestedResourceIdentityVotesRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetConsensusParamsResponse_GetConsensusParamsResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetConsensusParamsResponse_GetConsensusParamsResponseV0__storage_) + storageSize:sizeof(GetContestedResourceIdentityVotesRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetConsensusParamsResponse)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5373,17 +9192,29 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProtocolVersionUpgradeStateRequest +void GetContestedResourceIdentityVotesRequest_ClearVersionOneOfCase(GetContestedResourceIdentityVotesRequest *message) { + GPBDescriptor *descriptor = [GetContestedResourceIdentityVotesRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0 -@implementation GetProtocolVersionUpgradeStateRequest +@implementation GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0 -@dynamic versionOneOfCase; -@dynamic v0; +@dynamic identityId; +@dynamic hasLimit, limit; +@dynamic hasOffset, offset; +@dynamic orderAscending; +@dynamic hasStartAtVotePollIdInfo, startAtVotePollIdInfo; +@dynamic prove; -typedef struct GetProtocolVersionUpgradeStateRequest__storage_ { - uint32_t _has_storage_[2]; - GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 *v0; -} GetProtocolVersionUpgradeStateRequest__storage_; +typedef struct GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *identityId; + GPBUInt32Value *limit; + GPBUInt32Value *offset; + GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo *startAtVotePollIdInfo; +} GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5392,29 +9223,69 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0), - .number = GetProtocolVersionUpgradeStateRequest_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateRequest__storage_, v0), + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "limit", + .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_Limit, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0__storage_, limit), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "offset", + .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_Offset, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0__storage_, offset), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "orderAscending", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_OrderAscending, + .hasIndex = 3, + .offset = 4, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + { + .name = "startAtVotePollIdInfo", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo), + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_StartAtVotePollIdInfo, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0__storage_, startAtVotePollIdInfo), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_FieldNumber_Prove, + .hasIndex = 6, + .offset = 7, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateRequest class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeStateRequest__storage_) + storageSize:sizeof(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceIdentityVotesRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5425,20 +9296,17 @@ + (GPBDescriptor *)descriptor { @end -void GetProtocolVersionUpgradeStateRequest_ClearVersionOneOfCase(GetProtocolVersionUpgradeStateRequest *message) { - GPBDescriptor *descriptor = [GetProtocolVersionUpgradeStateRequest descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 +#pragma mark - GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo -@implementation GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 +@implementation GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo -@dynamic prove; +@dynamic startAtPollIdentifier; +@dynamic startPollIdentifierIncluded; -typedef struct GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0__storage_ { +typedef struct GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo__storage_ { uint32_t _has_storage_[1]; -} GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0__storage_; + NSData *startAtPollIdentifier; +} GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5447,24 +9315,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "prove", + .name = "startAtPollIdentifier", .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0_FieldNumber_Prove, + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo_FieldNumber_StartAtPollIdentifier, .hasIndex = 0, - .offset = 1, // Stored in _has_storage_ to save space. + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo__storage_, startAtPollIdentifier), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "startPollIdentifierIncluded", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo_FieldNumber_StartPollIdentifierIncluded, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeStateRequest_GetProtocolVersionUpgradeStateRequestV0__storage_) + storageSize:sizeof(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0_StartAtVotePollIdInfo__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceIdentityVotesRequest_GetContestedResourceIdentityVotesRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5475,17 +9352,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProtocolVersionUpgradeStateResponse +#pragma mark - GetContestedResourceIdentityVotesResponse -@implementation GetProtocolVersionUpgradeStateResponse +@implementation GetContestedResourceIdentityVotesResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetProtocolVersionUpgradeStateResponse__storage_ { +typedef struct GetContestedResourceIdentityVotesResponse__storage_ { uint32_t _has_storage_[2]; - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 *v0; -} GetProtocolVersionUpgradeStateResponse__storage_; + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 *v0; +} GetContestedResourceIdentityVotesResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5495,21 +9372,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0), - .number = GetProtocolVersionUpgradeStateResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0), + .number = GetContestedResourceIdentityVotesResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeStateResponse__storage_) + storageSize:sizeof(GetContestedResourceIdentityVotesResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -5527,26 +9404,26 @@ + (GPBDescriptor *)descriptor { @end -void GetProtocolVersionUpgradeStateResponse_ClearVersionOneOfCase(GetProtocolVersionUpgradeStateResponse *message) { - GPBDescriptor *descriptor = [GetProtocolVersionUpgradeStateResponse descriptor]; +void GetContestedResourceIdentityVotesResponse_ClearVersionOneOfCase(GetContestedResourceIdentityVotesResponse *message) { + GPBDescriptor *descriptor = [GetContestedResourceIdentityVotesResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 -@implementation GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 +@implementation GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 @dynamic resultOneOfCase; -@dynamic versions; +@dynamic votes; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_ { +typedef struct GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0__storage_ { uint32_t _has_storage_[2]; - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions *versions; + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes *votes; Proof *proof; ResponseMetadata *metadata; -} GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_; +} GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5555,40 +9432,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "versions", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions), - .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_FieldNumber_Versions, + .name = "votes", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes), + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_FieldNumber_Votes, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_, versions), + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0__storage_, votes), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_FieldNumber_Proof, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_FieldNumber_Metadata, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0__storage_) + storageSize:sizeof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -5596,7 +9473,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceIdentityVotesResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5607,21 +9484,22 @@ + (GPBDescriptor *)descriptor { @end -void GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_ClearResultOneOfCase(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 *message) { - GPBDescriptor *descriptor = [GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0 descriptor]; +void GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ClearResultOneOfCase(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 *message) { + GPBDescriptor *descriptor = [GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes -@implementation GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions +@implementation GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes -@dynamic versionsArray, versionsArray_Count; +@dynamic contestedResourceIdentityVotesArray, contestedResourceIdentityVotesArray_Count; +@dynamic finishedResults; -typedef struct GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_ { +typedef struct GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *versionsArray; -} GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_; + NSMutableArray *contestedResourceIdentityVotesArray; +} GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5630,24 +9508,90 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "versionsArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry), - .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions_FieldNumber_VersionsArray, + .name = "contestedResourceIdentityVotesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote), + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes_FieldNumber_ContestedResourceIdentityVotesArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_, versionsArray), + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes__storage_, contestedResourceIdentityVotesArray), .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, + { + .name = "finishedResults", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes_FieldNumber_FinishedResults, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVotes__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice + +@implementation GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice + +@dynamic voteChoiceType; +@dynamic hasIdentityId, identityId; + +typedef struct GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice__storage_ { + uint32_t _has_storage_[1]; + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType voteChoiceType; + NSData *identityId; +} GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "voteChoiceType", + .dataTypeSpecific.enumDescFunc = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_EnumDescriptor, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_FieldNumber_VoteChoiceType, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice__storage_, voteChoiceType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, + }, + { + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_FieldNumber_IdentityId, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice__storage_, identityId), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeBytes, + }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_Versions__storage_) + storageSize:sizeof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5658,18 +9602,71 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry +int32_t GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_RawValue(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice *message) { + GPBDescriptor *descriptor = [GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_FieldNumber_VoteChoiceType]; + return GPBGetMessageRawEnumField(message, field); +} -@implementation GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry +void SetGetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_RawValue(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice *message, int32_t value) { + GPBDescriptor *descriptor = [GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_FieldNumber_VoteChoiceType]; + GPBSetMessageRawEnumField(message, field, value); +} -@dynamic versionNumber; -@dynamic voteCount; +#pragma mark - Enum GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType -typedef struct GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_ { +GPBEnumDescriptor *GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + static const char *valueNames = + "TowardsIdentity\000Abstain\000Lock\000"; + static const int32_t values[] = { + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_TowardsIdentity, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_Abstain, + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_Lock, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_IsValidValue(int32_t value__) { + switch (value__) { + case GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_TowardsIdentity: + case GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_Abstain: + case GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice_VoteChoiceType_Lock: + return YES; + default: + return NO; + } +} + +#pragma mark - GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote + +@implementation GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote + +@dynamic contractId; +@dynamic documentTypeName; +@dynamic serializedIndexStorageValuesArray, serializedIndexStorageValuesArray_Count; +@dynamic hasVoteChoice, voteChoice; + +typedef struct GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote__storage_ { uint32_t _has_storage_[1]; - uint32_t versionNumber; - uint32_t voteCount; -} GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_; + NSData *contractId; + NSString *documentTypeName; + NSMutableArray *serializedIndexStorageValuesArray; + GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice *voteChoice; +} GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5678,33 +9675,51 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "versionNumber", + .name = "contractId", .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry_FieldNumber_VersionNumber, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_ContractId, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_, versionNumber), + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote__storage_, contractId), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, + .dataType = GPBDataTypeBytes, }, { - .name = "voteCount", + .name = "documentTypeName", .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry_FieldNumber_VoteCount, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_DocumentTypeName, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_, voteCount), + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote__storage_, documentTypeName), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, + .dataType = GPBDataTypeString, + }, + { + .name = "serializedIndexStorageValuesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_SerializedIndexStorageValuesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote__storage_, serializedIndexStorageValuesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "voteChoice", + .dataTypeSpecific.clazz = GPBObjCClass(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ResourceVoteChoice), + .number = GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote_FieldNumber_VoteChoice, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote__storage_, voteChoice), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry class] + [GPBDescriptor allocDescriptorForClass:[GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0_VersionEntry__storage_) + storageSize:sizeof(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0_ContestedResourceIdentityVote__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeStateResponse_GetProtocolVersionUpgradeStateResponseV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetContestedResourceIdentityVotesResponse_GetContestedResourceIdentityVotesResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5715,17 +9730,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProtocolVersionUpgradeVoteStatusRequest +#pragma mark - GetPrefundedSpecializedBalanceRequest -@implementation GetProtocolVersionUpgradeVoteStatusRequest +@implementation GetPrefundedSpecializedBalanceRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetProtocolVersionUpgradeVoteStatusRequest__storage_ { +typedef struct GetPrefundedSpecializedBalanceRequest__storage_ { uint32_t _has_storage_[2]; - GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 *v0; -} GetProtocolVersionUpgradeVoteStatusRequest__storage_; + GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0 *v0; +} GetPrefundedSpecializedBalanceRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5735,21 +9750,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0), - .number = GetProtocolVersionUpgradeVoteStatusRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0), + .number = GetPrefundedSpecializedBalanceRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetPrefundedSpecializedBalanceRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusRequest class] + [GPBDescriptor allocDescriptorForClass:[GetPrefundedSpecializedBalanceRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusRequest__storage_) + storageSize:sizeof(GetPrefundedSpecializedBalanceRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -5767,24 +9782,22 @@ + (GPBDescriptor *)descriptor { @end -void GetProtocolVersionUpgradeVoteStatusRequest_ClearVersionOneOfCase(GetProtocolVersionUpgradeVoteStatusRequest *message) { - GPBDescriptor *descriptor = [GetProtocolVersionUpgradeVoteStatusRequest descriptor]; +void GetPrefundedSpecializedBalanceRequest_ClearVersionOneOfCase(GetPrefundedSpecializedBalanceRequest *message) { + GPBDescriptor *descriptor = [GetPrefundedSpecializedBalanceRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 +#pragma mark - GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0 -@implementation GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 +@implementation GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0 -@dynamic startProTxHash; -@dynamic count; +@dynamic id_p; @dynamic prove; -typedef struct GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_ { +typedef struct GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0__storage_ { uint32_t _has_storage_[1]; - uint32_t count; - NSData *startProTxHash; -} GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_; + NSData *id_p; +} GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5793,42 +9806,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "startProTxHash", + .name = "id_p", .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0_FieldNumber_StartProTxHash, + .number = GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0_FieldNumber_Id_p, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_, startProTxHash), + .offset = (uint32_t)offsetof(GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0__storage_, id_p), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, - { - .name = "count", - .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0_FieldNumber_Count, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_, count), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, - }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0_FieldNumber_Prove, - .hasIndex = 2, - .offset = 3, // Stored in _has_storage_ to save space. + .number = GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0_FieldNumber_Prove, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusRequest_GetProtocolVersionUpgradeVoteStatusRequestV0__storage_) + storageSize:sizeof(GetPrefundedSpecializedBalanceRequest_GetPrefundedSpecializedBalanceRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPrefundedSpecializedBalanceRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5839,17 +9843,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse +#pragma mark - GetPrefundedSpecializedBalanceResponse -@implementation GetProtocolVersionUpgradeVoteStatusResponse +@implementation GetPrefundedSpecializedBalanceResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetProtocolVersionUpgradeVoteStatusResponse__storage_ { +typedef struct GetPrefundedSpecializedBalanceResponse__storage_ { uint32_t _has_storage_[2]; - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 *v0; -} GetProtocolVersionUpgradeVoteStatusResponse__storage_; + GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 *v0; +} GetPrefundedSpecializedBalanceResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5859,21 +9863,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0), - .number = GetProtocolVersionUpgradeVoteStatusResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0), + .number = GetPrefundedSpecializedBalanceResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetPrefundedSpecializedBalanceResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse class] + [GPBDescriptor allocDescriptorForClass:[GetPrefundedSpecializedBalanceResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse__storage_) + storageSize:sizeof(GetPrefundedSpecializedBalanceResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -5891,26 +9895,26 @@ + (GPBDescriptor *)descriptor { @end -void GetProtocolVersionUpgradeVoteStatusResponse_ClearVersionOneOfCase(GetProtocolVersionUpgradeVoteStatusResponse *message) { - GPBDescriptor *descriptor = [GetProtocolVersionUpgradeVoteStatusResponse descriptor]; +void GetPrefundedSpecializedBalanceResponse_ClearVersionOneOfCase(GetPrefundedSpecializedBalanceResponse *message) { + GPBDescriptor *descriptor = [GetPrefundedSpecializedBalanceResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 +#pragma mark - GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 -@implementation GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 +@implementation GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 @dynamic resultOneOfCase; -@dynamic versions; +@dynamic balance; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_ { +typedef struct GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0__storage_ { uint32_t _has_storage_[2]; - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals *versions; Proof *proof; ResponseMetadata *metadata; -} GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_; + uint64_t balance; +} GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5919,40 +9923,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "versions", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals), - .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_FieldNumber_Versions, + .name = "balance", + .dataTypeSpecific.clazz = Nil, + .number = GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_FieldNumber_Balance, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_, versions), + .offset = (uint32_t)offsetof(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0__storage_, balance), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeUInt64, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_FieldNumber_Proof, + .number = GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_FieldNumber_Metadata, + .number = GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0__storage_) + storageSize:sizeof(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -5960,7 +9964,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPrefundedSpecializedBalanceResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -5971,21 +9975,77 @@ + (GPBDescriptor *)descriptor { @end -void GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_ClearResultOneOfCase(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 *message) { - GPBDescriptor *descriptor = [GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0 descriptor]; +void GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0_ClearResultOneOfCase(GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 *message) { + GPBDescriptor *descriptor = [GetPrefundedSpecializedBalanceResponse_GetPrefundedSpecializedBalanceResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals +#pragma mark - GetTotalCreditsInPlatformRequest -@implementation GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals +@implementation GetTotalCreditsInPlatformRequest -@dynamic versionSignalsArray, versionSignalsArray_Count; +@dynamic versionOneOfCase; +@dynamic v0; -typedef struct GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_ { +typedef struct GetTotalCreditsInPlatformRequest__storage_ { + uint32_t _has_storage_[2]; + GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0 *v0; +} GetTotalCreditsInPlatformRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0), + .number = GetTotalCreditsInPlatformRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetTotalCreditsInPlatformRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetTotalCreditsInPlatformRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetTotalCreditsInPlatformRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetTotalCreditsInPlatformRequest_ClearVersionOneOfCase(GetTotalCreditsInPlatformRequest *message) { + GPBDescriptor *descriptor = [GetTotalCreditsInPlatformRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0 + +@implementation GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0 + +@dynamic prove; + +typedef struct GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *versionSignalsArray; -} GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_; +} GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -5994,24 +10054,76 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "versionSignalsArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal), - .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals_FieldNumber_VersionSignalsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_, versionSignalsArray), - .flags = GPBFieldRepeated, + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0_FieldNumber_Prove, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetTotalCreditsInPlatformRequest_GetTotalCreditsInPlatformRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetTotalCreditsInPlatformRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetTotalCreditsInPlatformResponse + +@implementation GetTotalCreditsInPlatformResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetTotalCreditsInPlatformResponse__storage_ { + uint32_t _has_storage_[2]; + GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 *v0; +} GetTotalCreditsInPlatformResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0), + .number = GetTotalCreditsInPlatformResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetTotalCreditsInPlatformResponse__storage_, v0), + .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals class] + [GPBDescriptor allocDescriptorForClass:[GetTotalCreditsInPlatformResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignals__storage_) + storageSize:sizeof(GetTotalCreditsInPlatformResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -6022,18 +10134,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal +void GetTotalCreditsInPlatformResponse_ClearVersionOneOfCase(GetTotalCreditsInPlatformResponse *message) { + GPBDescriptor *descriptor = [GetTotalCreditsInPlatformResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 -@implementation GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal +@implementation GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 -@dynamic proTxHash; -@dynamic version; +@dynamic resultOneOfCase; +@dynamic credits; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_ { - uint32_t _has_storage_[1]; - uint32_t version; - NSData *proTxHash; -} GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_; +typedef struct GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0__storage_ { + uint32_t _has_storage_[2]; + Proof *proof; + ResponseMetadata *metadata; + uint64_t credits; +} GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -6042,33 +10162,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "proTxHash", + .name = "credits", .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal_FieldNumber_ProTxHash, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_, proTxHash), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .number = GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_FieldNumber_Credits, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0__storage_, credits), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt64, }, { - .name = "version", - .dataTypeSpecific.clazz = Nil, - .number = GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal_FieldNumber_Version, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_, version), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal class] + [GPBDescriptor allocDescriptorForClass:[GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0_VersionSignal__storage_) + storageSize:sizeof(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProtocolVersionUpgradeVoteStatusResponse_GetProtocolVersionUpgradeVoteStatusResponseV0)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetTotalCreditsInPlatformResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -6079,17 +10214,22 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetEpochsInfoRequest +void GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0_ClearResultOneOfCase(GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 *message) { + GPBDescriptor *descriptor = [GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetPathElementsRequest -@implementation GetEpochsInfoRequest +@implementation GetPathElementsRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetEpochsInfoRequest__storage_ { +typedef struct GetPathElementsRequest__storage_ { uint32_t _has_storage_[2]; - GetEpochsInfoRequest_GetEpochsInfoRequestV0 *v0; -} GetEpochsInfoRequest__storage_; + GetPathElementsRequest_GetPathElementsRequestV0 *v0; +} GetPathElementsRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -6099,21 +10239,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoRequest_GetEpochsInfoRequestV0), - .number = GetEpochsInfoRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetPathElementsRequest_GetPathElementsRequestV0), + .number = GetPathElementsRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetEpochsInfoRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetPathElementsRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoRequest class] + [GPBDescriptor allocDescriptorForClass:[GetPathElementsRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetEpochsInfoRequest__storage_) + storageSize:sizeof(GetPathElementsRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -6131,25 +10271,24 @@ + (GPBDescriptor *)descriptor { @end -void GetEpochsInfoRequest_ClearVersionOneOfCase(GetEpochsInfoRequest *message) { - GPBDescriptor *descriptor = [GetEpochsInfoRequest descriptor]; +void GetPathElementsRequest_ClearVersionOneOfCase(GetPathElementsRequest *message) { + GPBDescriptor *descriptor = [GetPathElementsRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetEpochsInfoRequest_GetEpochsInfoRequestV0 +#pragma mark - GetPathElementsRequest_GetPathElementsRequestV0 -@implementation GetEpochsInfoRequest_GetEpochsInfoRequestV0 +@implementation GetPathElementsRequest_GetPathElementsRequestV0 -@dynamic hasStartEpoch, startEpoch; -@dynamic count; -@dynamic ascending; +@dynamic pathArray, pathArray_Count; +@dynamic keysArray, keysArray_Count; @dynamic prove; -typedef struct GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_ { +typedef struct GetPathElementsRequest_GetPathElementsRequestV0__storage_ { uint32_t _has_storage_[1]; - uint32_t count; - GPBUInt32Value *startEpoch; -} GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_; + NSMutableArray *pathArray; + NSMutableArray *keysArray; +} GetPathElementsRequest_GetPathElementsRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -6158,51 +10297,42 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "startEpoch", - .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), - .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_StartEpoch, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_, startEpoch), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "count", + .name = "pathArray", .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_Count, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_, count), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, + .number = GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_PathArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetPathElementsRequest_GetPathElementsRequestV0__storage_, pathArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, }, { - .name = "ascending", + .name = "keysArray", .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_Ascending, - .hasIndex = 2, - .offset = 3, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, + .number = GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_KeysArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetPathElementsRequest_GetPathElementsRequestV0__storage_, keysArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoRequest_GetEpochsInfoRequestV0_FieldNumber_Prove, - .hasIndex = 4, - .offset = 5, // Stored in _has_storage_ to save space. + .number = GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_Prove, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoRequest_GetEpochsInfoRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetPathElementsRequest_GetPathElementsRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetEpochsInfoRequest_GetEpochsInfoRequestV0__storage_) + storageSize:sizeof(GetPathElementsRequest_GetPathElementsRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPathElementsRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -6213,17 +10343,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetEpochsInfoResponse +#pragma mark - GetPathElementsResponse -@implementation GetEpochsInfoResponse +@implementation GetPathElementsResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetEpochsInfoResponse__storage_ { +typedef struct GetPathElementsResponse__storage_ { uint32_t _has_storage_[2]; - GetEpochsInfoResponse_GetEpochsInfoResponseV0 *v0; -} GetEpochsInfoResponse__storage_; + GetPathElementsResponse_GetPathElementsResponseV0 *v0; +} GetPathElementsResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -6233,21 +10363,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0), - .number = GetEpochsInfoResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetPathElementsResponse_GetPathElementsResponseV0), + .number = GetPathElementsResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetPathElementsResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse class] + [GPBDescriptor allocDescriptorForClass:[GetPathElementsResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetEpochsInfoResponse__storage_) + storageSize:sizeof(GetPathElementsResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -6265,26 +10395,26 @@ + (GPBDescriptor *)descriptor { @end -void GetEpochsInfoResponse_ClearVersionOneOfCase(GetEpochsInfoResponse *message) { - GPBDescriptor *descriptor = [GetEpochsInfoResponse descriptor]; +void GetPathElementsResponse_ClearVersionOneOfCase(GetPathElementsResponse *message) { + GPBDescriptor *descriptor = [GetPathElementsResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetEpochsInfoResponse_GetEpochsInfoResponseV0 +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0 -@implementation GetEpochsInfoResponse_GetEpochsInfoResponseV0 +@implementation GetPathElementsResponse_GetPathElementsResponseV0 @dynamic resultOneOfCase; -@dynamic epochs; +@dynamic elements; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_ { +typedef struct GetPathElementsResponse_GetPathElementsResponseV0__storage_ { uint32_t _has_storage_[2]; - GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos *epochs; + GetPathElementsResponse_GetPathElementsResponseV0_Elements *elements; Proof *proof; ResponseMetadata *metadata; -} GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_; +} GetPathElementsResponse_GetPathElementsResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -6293,40 +10423,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "epochs", - .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos), - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_FieldNumber_Epochs, + .name = "elements", + .dataTypeSpecific.clazz = GPBObjCClass(GetPathElementsResponse_GetPathElementsResponseV0_Elements), + .number = GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Elements, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_, epochs), + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0__storage_, elements), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_FieldNumber_Proof, + .number = GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_FieldNumber_Metadata, + .number = GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse_GetEpochsInfoResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetPathElementsResponse_GetPathElementsResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetEpochsInfoResponse_GetEpochsInfoResponseV0__storage_) + storageSize:sizeof(GetPathElementsResponse_GetPathElementsResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -6334,7 +10464,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPathElementsResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -6345,21 +10475,21 @@ + (GPBDescriptor *)descriptor { @end -void GetEpochsInfoResponse_GetEpochsInfoResponseV0_ClearResultOneOfCase(GetEpochsInfoResponse_GetEpochsInfoResponseV0 *message) { - GPBDescriptor *descriptor = [GetEpochsInfoResponse_GetEpochsInfoResponseV0 descriptor]; +void GetPathElementsResponse_GetPathElementsResponseV0_ClearResultOneOfCase(GetPathElementsResponse_GetPathElementsResponseV0 *message) { + GPBDescriptor *descriptor = [GetPathElementsResponse_GetPathElementsResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0_Elements -@implementation GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos +@implementation GetPathElementsResponse_GetPathElementsResponseV0_Elements -@dynamic epochInfosArray, epochInfosArray_Count; +@dynamic elementsArray, elementsArray_Count; -typedef struct GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_ { +typedef struct GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *epochInfosArray; -} GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_; + NSMutableArray *elementsArray; +} GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -6368,114 +10498,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "epochInfosArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo), - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos_FieldNumber_EpochInfosArray, + .name = "elementsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetPathElementsResponse_GetPathElementsResponseV0_Elements_FieldNumber_ElementsArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_, epochInfosArray), + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_, elementsArray), .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo - -@implementation GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo - -@dynamic number; -@dynamic firstBlockHeight; -@dynamic firstCoreBlockHeight; -@dynamic startTime; -@dynamic feeMultiplier; - -typedef struct GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_ { - uint32_t _has_storage_[1]; - uint32_t number; - uint32_t firstCoreBlockHeight; - uint64_t firstBlockHeight; - uint64_t startTime; - double feeMultiplier; -} GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "number", - .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_Number, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, number), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, - }, - { - .name = "firstBlockHeight", - .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FirstBlockHeight, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, firstBlockHeight), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt64, - }, - { - .name = "firstCoreBlockHeight", - .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FirstCoreBlockHeight, - .hasIndex = 2, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, firstCoreBlockHeight), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, - }, - { - .name = "startTime", - .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_StartTime, - .hasIndex = 3, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, startTime), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt64, - }, - { - .name = "feeMultiplier", - .dataTypeSpecific.clazz = Nil, - .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FeeMultiplier, - .hasIndex = 4, - .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, feeMultiplier), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeDouble, + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo class] + [GPBDescriptor allocDescriptorForClass:[GetPathElementsResponse_GetPathElementsResponseV0_Elements class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_) + storageSize:sizeof(GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetEpochsInfoResponse_GetEpochsInfoResponseV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPathElementsResponse_GetPathElementsResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h index 062e8b49445..dede490b71e 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h @@ -18,6 +18,14 @@ @class BroadcastStateTransitionResponse; @class GetConsensusParamsRequest; @class GetConsensusParamsResponse; +@class GetContestedResourceIdentityVotesRequest; +@class GetContestedResourceIdentityVotesResponse; +@class GetContestedResourceVoteStateRequest; +@class GetContestedResourceVoteStateResponse; +@class GetContestedResourceVotersForIdentityRequest; +@class GetContestedResourceVotersForIdentityResponse; +@class GetContestedResourcesRequest; +@class GetContestedResourcesResponse; @class GetDataContractHistoryRequest; @class GetDataContractHistoryResponse; @class GetDataContractRequest; @@ -28,26 +36,36 @@ @class GetDocumentsResponse; @class GetEpochsInfoRequest; @class GetEpochsInfoResponse; -@class GetIdentitiesByPublicKeyHashesRequest; -@class GetIdentitiesByPublicKeyHashesResponse; -@class GetIdentitiesRequest; -@class GetIdentitiesResponse; +@class GetIdentitiesContractKeysRequest; +@class GetIdentitiesContractKeysResponse; @class GetIdentityBalanceAndRevisionRequest; @class GetIdentityBalanceAndRevisionResponse; @class GetIdentityBalanceRequest; @class GetIdentityBalanceResponse; @class GetIdentityByPublicKeyHashRequest; @class GetIdentityByPublicKeyHashResponse; +@class GetIdentityContractNonceRequest; +@class GetIdentityContractNonceResponse; @class GetIdentityKeysRequest; @class GetIdentityKeysResponse; +@class GetIdentityNonceRequest; +@class GetIdentityNonceResponse; @class GetIdentityRequest; @class GetIdentityResponse; +@class GetPathElementsRequest; +@class GetPathElementsResponse; +@class GetPrefundedSpecializedBalanceRequest; +@class GetPrefundedSpecializedBalanceResponse; @class GetProofsRequest; @class GetProofsResponse; @class GetProtocolVersionUpgradeStateRequest; @class GetProtocolVersionUpgradeStateResponse; @class GetProtocolVersionUpgradeVoteStatusRequest; @class GetProtocolVersionUpgradeVoteStatusResponse; +@class GetTotalCreditsInPlatformRequest; +@class GetTotalCreditsInPlatformResponse; +@class GetVotePollsByEndDateRequest; +@class GetVotePollsByEndDateResponse; @class WaitForStateTransitionResultRequest; @class WaitForStateTransitionResultResponse; @@ -88,14 +106,22 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)getIdentityWithMessage:(GetIdentityRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; -#pragma mark getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse) - -- (GRPCUnaryProtoCall *)getIdentitiesWithMessage:(GetIdentitiesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; - #pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) - (GRPCUnaryProtoCall *)getIdentityKeysWithMessage:(GetIdentityKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse) + +- (GRPCUnaryProtoCall *)getIdentitiesContractKeysWithMessage:(GetIdentitiesContractKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse) + +- (GRPCUnaryProtoCall *)getIdentityNonceWithMessage:(GetIdentityNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse) + +- (GRPCUnaryProtoCall *)getIdentityContractNonceWithMessage:(GetIdentityContractNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + #pragma mark getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse) - (GRPCUnaryProtoCall *)getIdentityBalanceWithMessage:(GetIdentityBalanceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; @@ -124,10 +150,6 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)getDocumentsWithMessage:(GetDocumentsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; -#pragma mark getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse) - -- (GRPCUnaryProtoCall *)getIdentitiesByPublicKeyHashesWithMessage:(GetIdentitiesByPublicKeyHashesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; - #pragma mark getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse) - (GRPCUnaryProtoCall *)getIdentityByPublicKeyHashWithMessage:(GetIdentityByPublicKeyHashRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; @@ -152,6 +174,53 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)getEpochsInfoWithMessage:(GetEpochsInfoRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark getContestedResources(GetContestedResourcesRequest) returns (GetContestedResourcesResponse) + +/** + * What votes are currently happening for a specific contested index + */ +- (GRPCUnaryProtoCall *)getContestedResourcesWithMessage:(GetContestedResourcesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse) + +/** + * What's the state of a contested resource vote? (ie who is winning?) + */ +- (GRPCUnaryProtoCall *)getContestedResourceVoteStateWithMessage:(GetContestedResourceVoteStateRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getContestedResourceVotersForIdentity(GetContestedResourceVotersForIdentityRequest) returns (GetContestedResourceVotersForIdentityResponse) + +/** + * Who voted for a contested resource to go to a specific identity? + */ +- (GRPCUnaryProtoCall *)getContestedResourceVotersForIdentityWithMessage:(GetContestedResourceVotersForIdentityRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getContestedResourceIdentityVotes(GetContestedResourceIdentityVotesRequest) returns (GetContestedResourceIdentityVotesResponse) + +/** + * How did an identity vote? + */ +- (GRPCUnaryProtoCall *)getContestedResourceIdentityVotesWithMessage:(GetContestedResourceIdentityVotesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getVotePollsByEndDate(GetVotePollsByEndDateRequest) returns (GetVotePollsByEndDateResponse) + +/** + * What vote polls will end soon? + */ +- (GRPCUnaryProtoCall *)getVotePollsByEndDateWithMessage:(GetVotePollsByEndDateRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse) + +- (GRPCUnaryProtoCall *)getPrefundedSpecializedBalanceWithMessage:(GetPrefundedSpecializedBalanceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getTotalCreditsInPlatform(GetTotalCreditsInPlatformRequest) returns (GetTotalCreditsInPlatformResponse) + +- (GRPCUnaryProtoCall *)getTotalCreditsInPlatformWithMessage:(GetTotalCreditsInPlatformRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse) + +- (GRPCUnaryProtoCall *)getPathElementsWithMessage:(GetPathElementsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + @end /** @@ -174,18 +243,32 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetIdentityWithRequest:(GetIdentityRequest *)request handler:(void(^)(GetIdentityResponse *_Nullable response, NSError *_Nullable error))handler; -#pragma mark getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse) +#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) -- (void)getIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler; +- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; -- (GRPCProtoCall *)RPCTogetIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler; +- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; -#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) +#pragma mark getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse) -- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; +- (void)getIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse) + +- (void)getIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler; -- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; + +#pragma mark getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse) + +- (void)getIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler; #pragma mark getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse) @@ -237,13 +320,6 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetDocumentsWithRequest:(GetDocumentsRequest *)request handler:(void(^)(GetDocumentsResponse *_Nullable response, NSError *_Nullable error))handler; -#pragma mark getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse) - -- (void)getIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler; - -- (GRPCProtoCall *)RPCTogetIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler; - - #pragma mark getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse) - (void)getIdentityByPublicKeyHashWithRequest:(GetIdentityByPublicKeyHashRequest *)request handler:(void(^)(GetIdentityByPublicKeyHashResponse *_Nullable response, NSError *_Nullable error))handler; @@ -286,6 +362,112 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetEpochsInfoWithRequest:(GetEpochsInfoRequest *)request handler:(void(^)(GetEpochsInfoResponse *_Nullable response, NSError *_Nullable error))handler; +#pragma mark getContestedResources(GetContestedResourcesRequest) returns (GetContestedResourcesResponse) + +/** + * What votes are currently happening for a specific contested index + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourcesWithRequest:(GetContestedResourcesRequest *)request handler:(void(^)(GetContestedResourcesResponse *_Nullable response, NSError *_Nullable error))handler; + +/** + * What votes are currently happening for a specific contested index + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourcesWithRequest:(GetContestedResourcesRequest *)request handler:(void(^)(GetContestedResourcesResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse) + +/** + * What's the state of a contested resource vote? (ie who is winning?) + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourceVoteStateWithRequest:(GetContestedResourceVoteStateRequest *)request handler:(void(^)(GetContestedResourceVoteStateResponse *_Nullable response, NSError *_Nullable error))handler; + +/** + * What's the state of a contested resource vote? (ie who is winning?) + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourceVoteStateWithRequest:(GetContestedResourceVoteStateRequest *)request handler:(void(^)(GetContestedResourceVoteStateResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getContestedResourceVotersForIdentity(GetContestedResourceVotersForIdentityRequest) returns (GetContestedResourceVotersForIdentityResponse) + +/** + * Who voted for a contested resource to go to a specific identity? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourceVotersForIdentityWithRequest:(GetContestedResourceVotersForIdentityRequest *)request handler:(void(^)(GetContestedResourceVotersForIdentityResponse *_Nullable response, NSError *_Nullable error))handler; + +/** + * Who voted for a contested resource to go to a specific identity? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourceVotersForIdentityWithRequest:(GetContestedResourceVotersForIdentityRequest *)request handler:(void(^)(GetContestedResourceVotersForIdentityResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getContestedResourceIdentityVotes(GetContestedResourceIdentityVotesRequest) returns (GetContestedResourceIdentityVotesResponse) + +/** + * How did an identity vote? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourceIdentityVotesWithRequest:(GetContestedResourceIdentityVotesRequest *)request handler:(void(^)(GetContestedResourceIdentityVotesResponse *_Nullable response, NSError *_Nullable error))handler; + +/** + * How did an identity vote? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourceIdentityVotesWithRequest:(GetContestedResourceIdentityVotesRequest *)request handler:(void(^)(GetContestedResourceIdentityVotesResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getVotePollsByEndDate(GetVotePollsByEndDateRequest) returns (GetVotePollsByEndDateResponse) + +/** + * What vote polls will end soon? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getVotePollsByEndDateWithRequest:(GetVotePollsByEndDateRequest *)request handler:(void(^)(GetVotePollsByEndDateResponse *_Nullable response, NSError *_Nullable error))handler; + +/** + * What vote polls will end soon? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetVotePollsByEndDateWithRequest:(GetVotePollsByEndDateRequest *)request handler:(void(^)(GetVotePollsByEndDateResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse) + +- (void)getPrefundedSpecializedBalanceWithRequest:(GetPrefundedSpecializedBalanceRequest *)request handler:(void(^)(GetPrefundedSpecializedBalanceResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetPrefundedSpecializedBalanceWithRequest:(GetPrefundedSpecializedBalanceRequest *)request handler:(void(^)(GetPrefundedSpecializedBalanceResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getTotalCreditsInPlatform(GetTotalCreditsInPlatformRequest) returns (GetTotalCreditsInPlatformResponse) + +- (void)getTotalCreditsInPlatformWithRequest:(GetTotalCreditsInPlatformRequest *)request handler:(void(^)(GetTotalCreditsInPlatformResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetTotalCreditsInPlatformWithRequest:(GetTotalCreditsInPlatformRequest *)request handler:(void(^)(GetTotalCreditsInPlatformResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse) + +- (void)getPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler; + + @end diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m index 4d4611e93d2..24fe99cc69b 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m @@ -110,44 +110,84 @@ - (GRPCUnaryProtoCall *)getIdentityWithMessage:(GetIdentityRequest *)message res responseClass:[GetIdentityResponse class]]; } -#pragma mark getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse) +#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) -- (void)getIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetIdentitiesWithRequest:request handler:handler] start]; +- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentityKeysWithRequest:request handler:handler] start]; } // Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getIdentities" +- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentityKeys" requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetIdentitiesResponse class] + responseClass:[GetIdentityKeysResponse class] responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; } -- (GRPCUnaryProtoCall *)getIdentitiesWithMessage:(GetIdentitiesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getIdentities" +- (GRPCUnaryProtoCall *)getIdentityKeysWithMessage:(GetIdentityKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentityKeys" message:message responseHandler:handler callOptions:callOptions - responseClass:[GetIdentitiesResponse class]]; + responseClass:[GetIdentityKeysResponse class]]; } -#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) +#pragma mark getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse) -- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetIdentityKeysWithRequest:request handler:handler] start]; +- (void)getIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentitiesContractKeysWithRequest:request handler:handler] start]; } // Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getIdentityKeys" +- (GRPCProtoCall *)RPCTogetIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentitiesContractKeys" requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetIdentityKeysResponse class] + responseClass:[GetIdentitiesContractKeysResponse class] responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; } -- (GRPCUnaryProtoCall *)getIdentityKeysWithMessage:(GetIdentityKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getIdentityKeys" +- (GRPCUnaryProtoCall *)getIdentitiesContractKeysWithMessage:(GetIdentitiesContractKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentitiesContractKeys" message:message responseHandler:handler callOptions:callOptions - responseClass:[GetIdentityKeysResponse class]]; + responseClass:[GetIdentitiesContractKeysResponse class]]; +} + +#pragma mark getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse) + +- (void)getIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentityNonceWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentityNonce" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetIdentityNonceResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getIdentityNonceWithMessage:(GetIdentityNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentityNonce" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetIdentityNonceResponse class]]; +} + +#pragma mark getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse) + +- (void)getIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentityContractNonceWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentityContractNonce" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetIdentityContractNonceResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getIdentityContractNonceWithMessage:(GetIdentityContractNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentityContractNonce" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetIdentityContractNonceResponse class]]; } #pragma mark getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse) @@ -290,26 +330,6 @@ - (GRPCUnaryProtoCall *)getDocumentsWithMessage:(GetDocumentsRequest *)message r responseClass:[GetDocumentsResponse class]]; } -#pragma mark getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse) - -- (void)getIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetIdentitiesByPublicKeyHashesWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getIdentitiesByPublicKeyHashes" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetIdentitiesByPublicKeyHashesResponse class] - responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; -} -- (GRPCUnaryProtoCall *)getIdentitiesByPublicKeyHashesWithMessage:(GetIdentitiesByPublicKeyHashesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getIdentitiesByPublicKeyHashes" - message:message - responseHandler:handler - callOptions:callOptions - responseClass:[GetIdentitiesByPublicKeyHashesResponse class]]; -} - #pragma mark getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse) - (void)getIdentityByPublicKeyHashWithRequest:(GetIdentityByPublicKeyHashRequest *)request handler:(void(^)(GetIdentityByPublicKeyHashResponse *_Nullable response, NSError *_Nullable error))handler{ @@ -430,5 +450,230 @@ - (GRPCUnaryProtoCall *)getEpochsInfoWithMessage:(GetEpochsInfoRequest *)message responseClass:[GetEpochsInfoResponse class]]; } +#pragma mark getContestedResources(GetContestedResourcesRequest) returns (GetContestedResourcesResponse) + +/** + * What votes are currently happening for a specific contested index + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourcesWithRequest:(GetContestedResourcesRequest *)request handler:(void(^)(GetContestedResourcesResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetContestedResourcesWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +/** + * What votes are currently happening for a specific contested index + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourcesWithRequest:(GetContestedResourcesRequest *)request handler:(void(^)(GetContestedResourcesResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getContestedResources" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetContestedResourcesResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +/** + * What votes are currently happening for a specific contested index + */ +- (GRPCUnaryProtoCall *)getContestedResourcesWithMessage:(GetContestedResourcesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getContestedResources" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetContestedResourcesResponse class]]; +} + +#pragma mark getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse) + +/** + * What's the state of a contested resource vote? (ie who is winning?) + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourceVoteStateWithRequest:(GetContestedResourceVoteStateRequest *)request handler:(void(^)(GetContestedResourceVoteStateResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetContestedResourceVoteStateWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +/** + * What's the state of a contested resource vote? (ie who is winning?) + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourceVoteStateWithRequest:(GetContestedResourceVoteStateRequest *)request handler:(void(^)(GetContestedResourceVoteStateResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getContestedResourceVoteState" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetContestedResourceVoteStateResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +/** + * What's the state of a contested resource vote? (ie who is winning?) + */ +- (GRPCUnaryProtoCall *)getContestedResourceVoteStateWithMessage:(GetContestedResourceVoteStateRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getContestedResourceVoteState" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetContestedResourceVoteStateResponse class]]; +} + +#pragma mark getContestedResourceVotersForIdentity(GetContestedResourceVotersForIdentityRequest) returns (GetContestedResourceVotersForIdentityResponse) + +/** + * Who voted for a contested resource to go to a specific identity? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourceVotersForIdentityWithRequest:(GetContestedResourceVotersForIdentityRequest *)request handler:(void(^)(GetContestedResourceVotersForIdentityResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetContestedResourceVotersForIdentityWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +/** + * Who voted for a contested resource to go to a specific identity? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourceVotersForIdentityWithRequest:(GetContestedResourceVotersForIdentityRequest *)request handler:(void(^)(GetContestedResourceVotersForIdentityResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getContestedResourceVotersForIdentity" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetContestedResourceVotersForIdentityResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +/** + * Who voted for a contested resource to go to a specific identity? + */ +- (GRPCUnaryProtoCall *)getContestedResourceVotersForIdentityWithMessage:(GetContestedResourceVotersForIdentityRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getContestedResourceVotersForIdentity" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetContestedResourceVotersForIdentityResponse class]]; +} + +#pragma mark getContestedResourceIdentityVotes(GetContestedResourceIdentityVotesRequest) returns (GetContestedResourceIdentityVotesResponse) + +/** + * How did an identity vote? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getContestedResourceIdentityVotesWithRequest:(GetContestedResourceIdentityVotesRequest *)request handler:(void(^)(GetContestedResourceIdentityVotesResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetContestedResourceIdentityVotesWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +/** + * How did an identity vote? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetContestedResourceIdentityVotesWithRequest:(GetContestedResourceIdentityVotesRequest *)request handler:(void(^)(GetContestedResourceIdentityVotesResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getContestedResourceIdentityVotes" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetContestedResourceIdentityVotesResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +/** + * How did an identity vote? + */ +- (GRPCUnaryProtoCall *)getContestedResourceIdentityVotesWithMessage:(GetContestedResourceIdentityVotesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getContestedResourceIdentityVotes" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetContestedResourceIdentityVotesResponse class]]; +} + +#pragma mark getVotePollsByEndDate(GetVotePollsByEndDateRequest) returns (GetVotePollsByEndDateResponse) + +/** + * What vote polls will end soon? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (void)getVotePollsByEndDateWithRequest:(GetVotePollsByEndDateRequest *)request handler:(void(^)(GetVotePollsByEndDateResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetVotePollsByEndDateWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +/** + * What vote polls will end soon? + * + * This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended. + */ +- (GRPCProtoCall *)RPCTogetVotePollsByEndDateWithRequest:(GetVotePollsByEndDateRequest *)request handler:(void(^)(GetVotePollsByEndDateResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getVotePollsByEndDate" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetVotePollsByEndDateResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +/** + * What vote polls will end soon? + */ +- (GRPCUnaryProtoCall *)getVotePollsByEndDateWithMessage:(GetVotePollsByEndDateRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getVotePollsByEndDate" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetVotePollsByEndDateResponse class]]; +} + +#pragma mark getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse) + +- (void)getPrefundedSpecializedBalanceWithRequest:(GetPrefundedSpecializedBalanceRequest *)request handler:(void(^)(GetPrefundedSpecializedBalanceResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetPrefundedSpecializedBalanceWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetPrefundedSpecializedBalanceWithRequest:(GetPrefundedSpecializedBalanceRequest *)request handler:(void(^)(GetPrefundedSpecializedBalanceResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getPrefundedSpecializedBalance" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetPrefundedSpecializedBalanceResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getPrefundedSpecializedBalanceWithMessage:(GetPrefundedSpecializedBalanceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getPrefundedSpecializedBalance" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetPrefundedSpecializedBalanceResponse class]]; +} + +#pragma mark getTotalCreditsInPlatform(GetTotalCreditsInPlatformRequest) returns (GetTotalCreditsInPlatformResponse) + +- (void)getTotalCreditsInPlatformWithRequest:(GetTotalCreditsInPlatformRequest *)request handler:(void(^)(GetTotalCreditsInPlatformResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetTotalCreditsInPlatformWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetTotalCreditsInPlatformWithRequest:(GetTotalCreditsInPlatformRequest *)request handler:(void(^)(GetTotalCreditsInPlatformResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getTotalCreditsInPlatform" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetTotalCreditsInPlatformResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getTotalCreditsInPlatformWithMessage:(GetTotalCreditsInPlatformRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getTotalCreditsInPlatform" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetTotalCreditsInPlatformResponse class]]; +} + +#pragma mark getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse) + +- (void)getPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetPathElementsWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getPathElements" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetPathElementsResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getPathElementsWithMessage:(GetPathElementsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getPathElements" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetPathElementsResponse class]]; +} + @end #endif diff --git a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py index 36cc42d1234..f27a2073789 100644 --- a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py +++ b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py @@ -2,6 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: platform.proto """Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -22,10 +23,56 @@ syntax='proto3', serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x0eplatform.proto\x12\x19org.dash.platform.dapi.v0\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x01\n\x05Proof\x12\x15\n\rgrovedb_proof\x18\x01 \x01(\x0c\x12\x13\n\x0bquorum_hash\x18\x02 \x01(\x0c\x12\x11\n\tsignature\x18\x03 \x01(\x0c\x12\r\n\x05round\x18\x04 \x01(\r\x12\x15\n\rblock_id_hash\x18\x05 \x01(\x0c\x12\x13\n\x0bquorum_type\x18\x06 \x01(\r\"\x90\x01\n\x10ResponseMetadata\x12\x0e\n\x06height\x18\x01 \x01(\x04\x12 \n\x18\x63ore_chain_locked_height\x18\x02 \x01(\r\x12\r\n\x05\x65poch\x18\x03 \x01(\r\x12\x0f\n\x07time_ms\x18\x04 \x01(\x04\x12\x18\n\x10protocol_version\x18\x05 \x01(\r\x12\x10\n\x08\x63hain_id\x18\x06 \x01(\t\"L\n\x1dStateTransitionBroadcastError\x12\x0c\n\x04\x63ode\x18\x01 \x01(\r\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\";\n\x1f\x42roadcastStateTransitionRequest\x12\x18\n\x10state_transition\x18\x01 \x01(\x0c\"\"\n BroadcastStateTransitionResponse\"\xa4\x01\n\x12GetIdentityRequest\x12P\n\x02v0\x18\x01 \x01(\x0b\x32\x42.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0H\x00\x1a\x31\n\x14GetIdentityRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xc0\x01\n\x19GetIdentityBalanceRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0H\x00\x1a\x38\n\x1bGetIdentityBalanceRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xec\x01\n$GetIdentityBalanceAndRevisionRequest\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0H\x00\x1a\x43\n&GetIdentityBalanceAndRevisionRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9e\x02\n\x13GetIdentityResponse\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0H\x00\x1a\xa7\x01\n\x15GetIdentityResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xad\x01\n\x14GetIdentitiesRequest\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0H\x00\x1a\x34\n\x16GetIdentitiesRequestV0\x12\x0b\n\x03ids\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xda\x04\n\x15GetIdentitiesResponse\x12V\n\x02v0\x18\x01 \x01(\x0b\x32H.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0H\x00\x1a\x1e\n\rIdentityValue\x12\r\n\x05value\x18\x01 \x01(\x0c\x1ak\n\rIdentityEntry\x12\x0b\n\x03key\x18\x01 \x01(\x0c\x12M\n\x05value\x18\x02 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue\x1a\x66\n\nIdentities\x12X\n\x10identity_entries\x18\x01 \x03(\x0b\x32>.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry\x1a\xe8\x01\n\x17GetIdentitiesResponseV0\x12Q\n\nidentities\x18\x01 \x01(\x0b\x32;.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentitiesH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x02\n\x1aGetIdentityBalanceResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0H\x00\x1a\xad\x01\n\x1cGetIdentityBalanceResponseV0\x12\x11\n\x07\x62\x61lance\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xa9\x04\n%GetIdentityBalanceAndRevisionResponse\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0H\x00\x1a\xfc\x02\n\'GetIdentityBalanceAndRevisionResponseV0\x12\x9b\x01\n\x14\x62\x61lance_and_revision\x18\x01 \x01(\x0b\x32{.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevisionH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x12\x42\x61lanceAndRevision\x12\x0f\n\x07\x62\x61lance\x18\x01 \x01(\x04\x12\x10\n\x08revision\x18\x02 \x01(\x04\x42\x08\n\x06resultB\t\n\x07version\"\xd1\x01\n\x0eKeyRequestType\x12\x36\n\x08\x61ll_keys\x18\x01 \x01(\x0b\x32\".org.dash.platform.dapi.v0.AllKeysH\x00\x12@\n\rspecific_keys\x18\x02 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.SpecificKeysH\x00\x12:\n\nsearch_key\x18\x03 \x01(\x0b\x32$.org.dash.platform.dapi.v0.SearchKeyH\x00\x42\t\n\x07request\"\t\n\x07\x41llKeys\"\x1f\n\x0cSpecificKeys\x12\x0f\n\x07key_ids\x18\x01 \x03(\r\"\xb6\x01\n\tSearchKey\x12I\n\x0bpurpose_map\x18\x01 \x03(\x0b\x32\x34.org.dash.platform.dapi.v0.SearchKey.PurposeMapEntry\x1a^\n\x0fPurposeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12:\n\x05value\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.SecurityLevelMap:\x02\x38\x01\"\xbf\x02\n\x10SecurityLevelMap\x12]\n\x12security_level_map\x18\x01 \x03(\x0b\x32\x41.org.dash.platform.dapi.v0.SecurityLevelMap.SecurityLevelMapEntry\x1aw\n\x15SecurityLevelMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12M\n\x05value\x18\x02 \x01(\x0e\x32>.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType:\x02\x38\x01\"S\n\x12KeyKindRequestType\x12\x1f\n\x1b\x43URRENT_KEY_OF_KIND_REQUEST\x10\x00\x12\x1c\n\x18\x41LL_KEYS_OF_KIND_REQUEST\x10\x01\"\xda\x02\n\x16GetIdentityKeysRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0H\x00\x1a\xda\x01\n\x18GetIdentityKeysRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12?\n\x0crequest_type\x18\x02 \x01(\x0b\x32).org.dash.platform.dapi.v0.KeyRequestType\x12+\n\x05limit\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x04 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\x99\x03\n\x17GetIdentityKeysResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0H\x00\x1a\x96\x02\n\x19GetIdentityKeysResponseV0\x12\x61\n\x04keys\x18\x01 \x01(\x0b\x32Q.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.KeysH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1a\n\x04Keys\x12\x12\n\nkeys_bytes\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\x93\x06\n\x10GetProofsRequest\x12L\n\x02v0\x18\x01 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0H\x00\x1a\xa5\x05\n\x12GetProofsRequestV0\x12\x62\n\nidentities\x18\x01 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest\x12\x61\n\tcontracts\x18\x02 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest\x12\x61\n\tdocuments\x18\x03 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest\x1aw\n\x0f\x44ocumentRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12#\n\x1b\x64ocument_type_keeps_history\x18\x03 \x01(\x08\x12\x13\n\x0b\x64ocument_id\x18\x04 \x01(\x0c\x1a\xc3\x01\n\x0fIdentityRequest\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12i\n\x0crequest_type\x18\x02 \x01(\x0e\x32S.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type\"0\n\x04Type\x12\x11\n\rFULL_IDENTITY\x10\x00\x12\x0b\n\x07\x42\x41LANCE\x10\x01\x12\x08\n\x04KEYS\x10\x02\x1a&\n\x0f\x43ontractRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x42\t\n\x07version\"\x82\x02\n\x11GetProofsResponse\x12N\n\x02v0\x18\x01 \x01(\x0b\x32@.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0H\x00\x1a\x91\x01\n\x13GetProofsResponseV0\x12\x31\n\x05proof\x18\x01 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb4\x01\n\x16GetDataContractRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0H\x00\x1a\x35\n\x18GetDataContractRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xb3\x02\n\x17GetDataContractResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0H\x00\x1a\xb0\x01\n\x19GetDataContractResponseV0\x12\x17\n\rdata_contract\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x01\n\x17GetDataContractsRequest\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0H\x00\x1a\x37\n\x19GetDataContractsRequestV0\x12\x0b\n\x03ids\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xcf\x04\n\x18GetDataContractsResponse\x12\\\n\x02v0\x18\x01 \x01(\x0b\x32N.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0H\x00\x1a[\n\x11\x44\x61taContractEntry\x12\x12\n\nidentifier\x18\x01 \x01(\x0c\x12\x32\n\rdata_contract\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.BytesValue\x1au\n\rDataContracts\x12\x64\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32\x45.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry\x1a\xf5\x01\n\x1aGetDataContractsResponseV0\x12[\n\x0e\x64\x61ta_contracts\x18\x01 \x01(\x0b\x32\x41.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc1\x02\n\x1dGetDataContractHistoryRequest\x12\x66\n\x02v0\x18\x01 \x01(\x0b\x32X.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0H\x00\x1a\xac\x01\n\x1fGetDataContractHistoryRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12+\n\x05limit\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\x13\n\x0bstart_at_ms\x18\x04 \x01(\x04\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\xae\x05\n\x1eGetDataContractHistoryResponse\x12h\n\x02v0\x18\x01 \x01(\x0b\x32Z.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0H\x00\x1a\x96\x04\n GetDataContractHistoryResponseV0\x12\x8f\x01\n\x15\x64\x61ta_contract_history\x18\x01 \x01(\x0b\x32n.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x18\x44\x61taContractHistoryEntry\x12\x0c\n\x04\x64\x61te\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x0c\x1a\xaa\x01\n\x13\x44\x61taContractHistory\x12\x92\x01\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32s.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntryB\x08\n\x06resultB\t\n\x07version\"\xb2\x02\n\x13GetDocumentsRequest\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0H\x00\x1a\xbb\x01\n\x15GetDocumentsRequestV0\x12\x18\n\x10\x64\x61ta_contract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12\r\n\x05where\x18\x03 \x01(\x0c\x12\x10\n\x08order_by\x18\x04 \x01(\x0c\x12\r\n\x05limit\x18\x05 \x01(\r\x12\x15\n\x0bstart_after\x18\x06 \x01(\x0cH\x00\x12\x12\n\x08start_at\x18\x07 \x01(\x0cH\x00\x12\r\n\x05prove\x18\x08 \x01(\x08\x42\x07\n\x05startB\t\n\x07version\"\x95\x03\n\x14GetDocumentsResponse\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0H\x00\x1a\x9b\x02\n\x16GetDocumentsResponseV0\x12\x65\n\tdocuments\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.DocumentsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1e\n\tDocuments\x12\x11\n\tdocuments\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\xff\x01\n%GetIdentitiesByPublicKeyHashesRequest\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0H\x00\x1aS\n\'GetIdentitiesByPublicKeyHashesRequestV0\x12\x19\n\x11public_key_hashes\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xc6\x05\n&GetIdentitiesByPublicKeyHashesResponse\x12x\n\x02v0\x18\x01 \x01(\x0b\x32j.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0H\x00\x1a\x61\n\x1aPublicKeyHashIdentityEntry\x12\x17\n\x0fpublic_key_hash\x18\x01 \x01(\x0c\x12*\n\x05value\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.BytesValue\x1a\x95\x01\n\x1bIdentitiesByPublicKeyHashes\x12v\n\x10identity_entries\x18\x01 \x03(\x0b\x32\\.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry\x1a\x9b\x02\n(GetIdentitiesByPublicKeyHashesResponseV0\x12s\n\nidentities\x18\x01 \x01(\x0b\x32].org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashesH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xed\x01\n!GetIdentityByPublicKeyHashRequest\x12n\n\x02v0\x18\x01 \x01(\x0b\x32`.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0H\x00\x1aM\n#GetIdentityByPublicKeyHashRequestV0\x12\x17\n\x0fpublic_key_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xda\x02\n\"GetIdentityByPublicKeyHashResponse\x12p\n\x02v0\x18\x01 \x01(\x0b\x32\x62.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0H\x00\x1a\xb6\x01\n$GetIdentityByPublicKeyHashResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xfb\x01\n#WaitForStateTransitionResultRequest\x12r\n\x02v0\x18\x01 \x01(\x0b\x32\x64.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0H\x00\x1aU\n%WaitForStateTransitionResultRequestV0\x12\x1d\n\x15state_transition_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x99\x03\n$WaitForStateTransitionResultResponse\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0H\x00\x1a\xef\x01\n&WaitForStateTransitionResultResponseV0\x12I\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x38.org.dash.platform.dapi.v0.StateTransitionBroadcastErrorH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc4\x01\n\x19GetConsensusParamsRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0H\x00\x1a<\n\x1bGetConsensusParamsRequestV0\x12\x0e\n\x06height\x18\x01 \x01(\x05\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9c\x04\n\x1aGetConsensusParamsResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0H\x00\x1aP\n\x14\x43onsensusParamsBlock\x12\x11\n\tmax_bytes\x18\x01 \x01(\t\x12\x0f\n\x07max_gas\x18\x02 \x01(\t\x12\x14\n\x0ctime_iota_ms\x18\x03 \x01(\t\x1a\x62\n\x17\x43onsensusParamsEvidence\x12\x1a\n\x12max_age_num_blocks\x18\x01 \x01(\t\x12\x18\n\x10max_age_duration\x18\x02 \x01(\t\x12\x11\n\tmax_bytes\x18\x03 \x01(\t\x1a\xda\x01\n\x1cGetConsensusParamsResponseV0\x12Y\n\x05\x62lock\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock\x12_\n\x08\x65vidence\x18\x02 \x01(\x0b\x32M.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidenceB\t\n\x07version\"\xe4\x01\n%GetProtocolVersionUpgradeStateRequest\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0H\x00\x1a\x38\n\'GetProtocolVersionUpgradeStateRequestV0\x12\r\n\x05prove\x18\x01 \x01(\x08\x42\t\n\x07version\"\xb5\x05\n&GetProtocolVersionUpgradeStateResponse\x12x\n\x02v0\x18\x01 \x01(\x0b\x32j.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0H\x00\x1a\x85\x04\n(GetProtocolVersionUpgradeStateResponseV0\x12\x87\x01\n\x08versions\x18\x01 \x01(\x0b\x32s.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x96\x01\n\x08Versions\x12\x89\x01\n\x08versions\x18\x01 \x03(\x0b\x32w.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry\x1a:\n\x0cVersionEntry\x12\x16\n\x0eversion_number\x18\x01 \x01(\r\x12\x12\n\nvote_count\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xa3\x02\n*GetProtocolVersionUpgradeVoteStatusRequest\x12\x80\x01\n\x02v0\x18\x01 \x01(\x0b\x32r.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0H\x00\x1ag\n,GetProtocolVersionUpgradeVoteStatusRequestV0\x12\x19\n\x11start_pro_tx_hash\x18\x01 \x01(\x0c\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xef\x05\n+GetProtocolVersionUpgradeVoteStatusResponse\x12\x82\x01\n\x02v0\x18\x01 \x01(\x0b\x32t.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0H\x00\x1a\xaf\x04\n-GetProtocolVersionUpgradeVoteStatusResponseV0\x12\x98\x01\n\x08versions\x18\x01 \x01(\x0b\x32\x83\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignalsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\xaf\x01\n\x0eVersionSignals\x12\x9c\x01\n\x0fversion_signals\x18\x01 \x03(\x0b\x32\x82\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal\x1a\x35\n\rVersionSignal\x12\x13\n\x0bpro_tx_hash\x18\x01 \x01(\x0c\x12\x0f\n\x07version\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xf5\x01\n\x14GetEpochsInfoRequest\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0H\x00\x1a|\n\x16GetEpochsInfoRequestV0\x12\x31\n\x0bstart_epoch\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\x11\n\tascending\x18\x03 \x01(\x08\x12\r\n\x05prove\x18\x04 \x01(\x08\x42\t\n\x07version\"\xf7\x04\n\x15GetEpochsInfoResponse\x12V\n\x02v0\x18\x01 \x01(\x0b\x32H.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0H\x00\x1a\xfa\x03\n\x17GetEpochsInfoResponseV0\x12\x65\n\x06\x65pochs\x18\x01 \x01(\x0b\x32S.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfosH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1au\n\nEpochInfos\x12g\n\x0b\x65poch_infos\x18\x01 \x03(\x0b\x32R.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo\x1a\x84\x01\n\tEpochInfo\x12\x0e\n\x06number\x18\x01 \x01(\r\x12\x1a\n\x12\x66irst_block_height\x18\x02 \x01(\x04\x12\x1f\n\x17\x66irst_core_block_height\x18\x03 \x01(\r\x12\x12\n\nstart_time\x18\x04 \x01(\x04\x12\x16\n\x0e\x66\x65\x65_multiplier\x18\x05 \x01(\x01\x42\x08\n\x06resultB\t\n\x07version2\xc2\x13\n\x08Platform\x12\x93\x01\n\x18\x62roadcastStateTransition\x12:.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest\x1a;.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse\x12l\n\x0bgetIdentity\x12-.org.dash.platform.dapi.v0.GetIdentityRequest\x1a..org.dash.platform.dapi.v0.GetIdentityResponse\x12r\n\rgetIdentities\x12/.org.dash.platform.dapi.v0.GetIdentitiesRequest\x1a\x30.org.dash.platform.dapi.v0.GetIdentitiesResponse\x12x\n\x0fgetIdentityKeys\x12\x31.org.dash.platform.dapi.v0.GetIdentityKeysRequest\x1a\x32.org.dash.platform.dapi.v0.GetIdentityKeysResponse\x12\x81\x01\n\x12getIdentityBalance\x12\x34.org.dash.platform.dapi.v0.GetIdentityBalanceRequest\x1a\x35.org.dash.platform.dapi.v0.GetIdentityBalanceResponse\x12\xa2\x01\n\x1dgetIdentityBalanceAndRevision\x12?.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest\x1a@.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse\x12\x66\n\tgetProofs\x12+.org.dash.platform.dapi.v0.GetProofsRequest\x1a,.org.dash.platform.dapi.v0.GetProofsResponse\x12x\n\x0fgetDataContract\x12\x31.org.dash.platform.dapi.v0.GetDataContractRequest\x1a\x32.org.dash.platform.dapi.v0.GetDataContractResponse\x12\x8d\x01\n\x16getDataContractHistory\x12\x38.org.dash.platform.dapi.v0.GetDataContractHistoryRequest\x1a\x39.org.dash.platform.dapi.v0.GetDataContractHistoryResponse\x12{\n\x10getDataContracts\x12\x32.org.dash.platform.dapi.v0.GetDataContractsRequest\x1a\x33.org.dash.platform.dapi.v0.GetDataContractsResponse\x12o\n\x0cgetDocuments\x12..org.dash.platform.dapi.v0.GetDocumentsRequest\x1a/.org.dash.platform.dapi.v0.GetDocumentsResponse\x12\xa5\x01\n\x1egetIdentitiesByPublicKeyHashes\x12@.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest\x1a\x41.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse\x12\x99\x01\n\x1agetIdentityByPublicKeyHash\x12<.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest\x1a=.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse\x12\x9f\x01\n\x1cwaitForStateTransitionResult\x12>.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest\x1a?.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse\x12\x81\x01\n\x12getConsensusParams\x12\x34.org.dash.platform.dapi.v0.GetConsensusParamsRequest\x1a\x35.org.dash.platform.dapi.v0.GetConsensusParamsResponse\x12\xa5\x01\n\x1egetProtocolVersionUpgradeState\x12@.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest\x1a\x41.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse\x12\xb4\x01\n#getProtocolVersionUpgradeVoteStatus\x12\x45.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest\x1a\x46.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse\x12r\n\rgetEpochsInfo\x12/.org.dash.platform.dapi.v0.GetEpochsInfoRequest\x1a\x30.org.dash.platform.dapi.v0.GetEpochsInfoResponseb\x06proto3' + serialized_pb=b'\n\x0eplatform.proto\x12\x19org.dash.platform.dapi.v0\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x01\n\x05Proof\x12\x15\n\rgrovedb_proof\x18\x01 \x01(\x0c\x12\x13\n\x0bquorum_hash\x18\x02 \x01(\x0c\x12\x11\n\tsignature\x18\x03 \x01(\x0c\x12\r\n\x05round\x18\x04 \x01(\r\x12\x15\n\rblock_id_hash\x18\x05 \x01(\x0c\x12\x13\n\x0bquorum_type\x18\x06 \x01(\r\"\x90\x01\n\x10ResponseMetadata\x12\x0e\n\x06height\x18\x01 \x01(\x04\x12 \n\x18\x63ore_chain_locked_height\x18\x02 \x01(\r\x12\r\n\x05\x65poch\x18\x03 \x01(\r\x12\x0f\n\x07time_ms\x18\x04 \x01(\x04\x12\x18\n\x10protocol_version\x18\x05 \x01(\r\x12\x10\n\x08\x63hain_id\x18\x06 \x01(\t\"L\n\x1dStateTransitionBroadcastError\x12\x0c\n\x04\x63ode\x18\x01 \x01(\r\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\";\n\x1f\x42roadcastStateTransitionRequest\x12\x18\n\x10state_transition\x18\x01 \x01(\x0c\"\"\n BroadcastStateTransitionResponse\"\xa4\x01\n\x12GetIdentityRequest\x12P\n\x02v0\x18\x01 \x01(\x0b\x32\x42.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0H\x00\x1a\x31\n\x14GetIdentityRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xc1\x01\n\x17GetIdentityNonceRequest\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0H\x00\x1a?\n\x19GetIdentityNonceRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xf6\x01\n\x1fGetIdentityContractNonceRequest\x12j\n\x02v0\x18\x01 \x01(\x0b\x32\\.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0H\x00\x1a\\\n!GetIdentityContractNonceRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12\x13\n\x0b\x63ontract_id\x18\x02 \x01(\x0c\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xc0\x01\n\x19GetIdentityBalanceRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0H\x00\x1a\x38\n\x1bGetIdentityBalanceRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xec\x01\n$GetIdentityBalanceAndRevisionRequest\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0H\x00\x1a\x43\n&GetIdentityBalanceAndRevisionRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9e\x02\n\x13GetIdentityResponse\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0H\x00\x1a\xa7\x01\n\x15GetIdentityResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb8\x02\n\x18GetIdentityNonceResponse\x12\\\n\x02v0\x18\x01 \x01(\x0b\x32N.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0H\x00\x1a\xb2\x01\n\x1aGetIdentityNonceResponseV0\x12\x18\n\x0eidentity_nonce\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xe1\x02\n GetIdentityContractNonceResponse\x12l\n\x02v0\x18\x01 \x01(\x0b\x32^.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0H\x00\x1a\xc3\x01\n\"GetIdentityContractNonceResponseV0\x12!\n\x17identity_contract_nonce\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x02\n\x1aGetIdentityBalanceResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0H\x00\x1a\xad\x01\n\x1cGetIdentityBalanceResponseV0\x12\x11\n\x07\x62\x61lance\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xa9\x04\n%GetIdentityBalanceAndRevisionResponse\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0H\x00\x1a\xfc\x02\n\'GetIdentityBalanceAndRevisionResponseV0\x12\x9b\x01\n\x14\x62\x61lance_and_revision\x18\x01 \x01(\x0b\x32{.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevisionH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x12\x42\x61lanceAndRevision\x12\x0f\n\x07\x62\x61lance\x18\x01 \x01(\x04\x12\x10\n\x08revision\x18\x02 \x01(\x04\x42\x08\n\x06resultB\t\n\x07version\"\xd1\x01\n\x0eKeyRequestType\x12\x36\n\x08\x61ll_keys\x18\x01 \x01(\x0b\x32\".org.dash.platform.dapi.v0.AllKeysH\x00\x12@\n\rspecific_keys\x18\x02 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.SpecificKeysH\x00\x12:\n\nsearch_key\x18\x03 \x01(\x0b\x32$.org.dash.platform.dapi.v0.SearchKeyH\x00\x42\t\n\x07request\"\t\n\x07\x41llKeys\"\x1f\n\x0cSpecificKeys\x12\x0f\n\x07key_ids\x18\x01 \x03(\r\"\xb6\x01\n\tSearchKey\x12I\n\x0bpurpose_map\x18\x01 \x03(\x0b\x32\x34.org.dash.platform.dapi.v0.SearchKey.PurposeMapEntry\x1a^\n\x0fPurposeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12:\n\x05value\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.SecurityLevelMap:\x02\x38\x01\"\xbf\x02\n\x10SecurityLevelMap\x12]\n\x12security_level_map\x18\x01 \x03(\x0b\x32\x41.org.dash.platform.dapi.v0.SecurityLevelMap.SecurityLevelMapEntry\x1aw\n\x15SecurityLevelMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12M\n\x05value\x18\x02 \x01(\x0e\x32>.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType:\x02\x38\x01\"S\n\x12KeyKindRequestType\x12\x1f\n\x1b\x43URRENT_KEY_OF_KIND_REQUEST\x10\x00\x12\x1c\n\x18\x41LL_KEYS_OF_KIND_REQUEST\x10\x01\"\xda\x02\n\x16GetIdentityKeysRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0H\x00\x1a\xda\x01\n\x18GetIdentityKeysRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12?\n\x0crequest_type\x18\x02 \x01(\x0b\x32).org.dash.platform.dapi.v0.KeyRequestType\x12+\n\x05limit\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x04 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\x99\x03\n\x17GetIdentityKeysResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0H\x00\x1a\x96\x02\n\x19GetIdentityKeysResponseV0\x12\x61\n\x04keys\x18\x01 \x01(\x0b\x32Q.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.KeysH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1a\n\x04Keys\x12\x12\n\nkeys_bytes\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\xef\x02\n GetIdentitiesContractKeysRequest\x12l\n\x02v0\x18\x01 \x01(\x0b\x32^.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0H\x00\x1a\xd1\x01\n\"GetIdentitiesContractKeysRequestV0\x12\x16\n\x0eidentities_ids\x18\x01 \x03(\x0c\x12\x13\n\x0b\x63ontract_id\x18\x02 \x01(\x0c\x12\x1f\n\x12\x64ocument_type_name\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x37\n\x08purposes\x18\x04 \x03(\x0e\x32%.org.dash.platform.dapi.v0.KeyPurpose\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\x15\n\x13_document_type_nameB\t\n\x07version\"\xdf\x06\n!GetIdentitiesContractKeysResponse\x12n\n\x02v0\x18\x01 \x01(\x0b\x32`.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0H\x00\x1a\xbe\x05\n#GetIdentitiesContractKeysResponseV0\x12\x8a\x01\n\x0fidentities_keys\x18\x01 \x01(\x0b\x32o.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeysH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1aY\n\x0bPurposeKeys\x12\x36\n\x07purpose\x18\x01 \x01(\x0e\x32%.org.dash.platform.dapi.v0.KeyPurpose\x12\x12\n\nkeys_bytes\x18\x02 \x03(\x0c\x1a\x9f\x01\n\x0cIdentityKeys\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12z\n\x04keys\x18\x02 \x03(\x0b\x32l.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys\x1a\x90\x01\n\x0eIdentitiesKeys\x12~\n\x07\x65ntries\x18\x01 \x03(\x0b\x32m.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeysB\x08\n\x06resultB\t\n\x07version\"\xcb\x0b\n\x10GetProofsRequest\x12L\n\x02v0\x18\x01 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0H\x00\x1a\xdd\n\n\x12GetProofsRequestV0\x12\x62\n\nidentities\x18\x01 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest\x12\x61\n\tcontracts\x18\x02 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest\x12\x61\n\tdocuments\x18\x03 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest\x12_\n\x05votes\x18\x04 \x03(\x0b\x32P.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest\x1a\xd5\x02\n\x0f\x44ocumentRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12#\n\x1b\x64ocument_type_keeps_history\x18\x03 \x01(\x08\x12\x13\n\x0b\x64ocument_id\x18\x04 \x01(\x0c\x12\x89\x01\n\x19\x64ocument_contested_status\x18\x05 \x01(\x0e\x32\x66.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus\"P\n\x17\x44ocumentContestedStatus\x12\x11\n\rNOT_CONTESTED\x10\x00\x12\x13\n\x0fMAYBE_CONTESTED\x10\x01\x12\r\n\tCONTESTED\x10\x02\x1a\xd1\x01\n\x0fIdentityRequest\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12i\n\x0crequest_type\x18\x02 \x01(\x0e\x32S.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type\">\n\x04Type\x12\x11\n\rFULL_IDENTITY\x10\x00\x12\x0b\n\x07\x42\x41LANCE\x10\x01\x12\x08\n\x04KEYS\x10\x02\x12\x0c\n\x08REVISION\x10\x03\x1a&\n\x0f\x43ontractRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x1a\xe7\x02\n\x11VoteStatusRequest\x12\xa5\x01\n&contested_resource_vote_status_request\x18\x01 \x01(\x0b\x32s.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequestH\x00\x1a\x99\x01\n\"ContestedResourceVoteStatusRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x1a\n\x12\x64ocument_type_name\x18\x02 \x01(\t\x12\x12\n\nindex_name\x18\x03 \x01(\t\x12\x14\n\x0cindex_values\x18\x04 \x03(\x0c\x12\x18\n\x10voter_identifier\x18\x05 \x01(\x0c\x42\x0e\n\x0crequest_typeB\t\n\x07version\"\x82\x02\n\x11GetProofsResponse\x12N\n\x02v0\x18\x01 \x01(\x0b\x32@.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0H\x00\x1a\x91\x01\n\x13GetProofsResponseV0\x12\x31\n\x05proof\x18\x01 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb4\x01\n\x16GetDataContractRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0H\x00\x1a\x35\n\x18GetDataContractRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xb3\x02\n\x17GetDataContractResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0H\x00\x1a\xb0\x01\n\x19GetDataContractResponseV0\x12\x17\n\rdata_contract\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x01\n\x17GetDataContractsRequest\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0H\x00\x1a\x37\n\x19GetDataContractsRequestV0\x12\x0b\n\x03ids\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xcf\x04\n\x18GetDataContractsResponse\x12\\\n\x02v0\x18\x01 \x01(\x0b\x32N.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0H\x00\x1a[\n\x11\x44\x61taContractEntry\x12\x12\n\nidentifier\x18\x01 \x01(\x0c\x12\x32\n\rdata_contract\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.BytesValue\x1au\n\rDataContracts\x12\x64\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32\x45.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry\x1a\xf5\x01\n\x1aGetDataContractsResponseV0\x12[\n\x0e\x64\x61ta_contracts\x18\x01 \x01(\x0b\x32\x41.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc1\x02\n\x1dGetDataContractHistoryRequest\x12\x66\n\x02v0\x18\x01 \x01(\x0b\x32X.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0H\x00\x1a\xac\x01\n\x1fGetDataContractHistoryRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12+\n\x05limit\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\x13\n\x0bstart_at_ms\x18\x04 \x01(\x04\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\xae\x05\n\x1eGetDataContractHistoryResponse\x12h\n\x02v0\x18\x01 \x01(\x0b\x32Z.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0H\x00\x1a\x96\x04\n GetDataContractHistoryResponseV0\x12\x8f\x01\n\x15\x64\x61ta_contract_history\x18\x01 \x01(\x0b\x32n.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x18\x44\x61taContractHistoryEntry\x12\x0c\n\x04\x64\x61te\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x0c\x1a\xaa\x01\n\x13\x44\x61taContractHistory\x12\x92\x01\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32s.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntryB\x08\n\x06resultB\t\n\x07version\"\xb2\x02\n\x13GetDocumentsRequest\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0H\x00\x1a\xbb\x01\n\x15GetDocumentsRequestV0\x12\x18\n\x10\x64\x61ta_contract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12\r\n\x05where\x18\x03 \x01(\x0c\x12\x10\n\x08order_by\x18\x04 \x01(\x0c\x12\r\n\x05limit\x18\x05 \x01(\r\x12\x15\n\x0bstart_after\x18\x06 \x01(\x0cH\x00\x12\x12\n\x08start_at\x18\x07 \x01(\x0cH\x00\x12\r\n\x05prove\x18\x08 \x01(\x08\x42\x07\n\x05startB\t\n\x07version\"\x95\x03\n\x14GetDocumentsResponse\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0H\x00\x1a\x9b\x02\n\x16GetDocumentsResponseV0\x12\x65\n\tdocuments\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.DocumentsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1e\n\tDocuments\x12\x11\n\tdocuments\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\xed\x01\n!GetIdentityByPublicKeyHashRequest\x12n\n\x02v0\x18\x01 \x01(\x0b\x32`.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0H\x00\x1aM\n#GetIdentityByPublicKeyHashRequestV0\x12\x17\n\x0fpublic_key_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xda\x02\n\"GetIdentityByPublicKeyHashResponse\x12p\n\x02v0\x18\x01 \x01(\x0b\x32\x62.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0H\x00\x1a\xb6\x01\n$GetIdentityByPublicKeyHashResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xfb\x01\n#WaitForStateTransitionResultRequest\x12r\n\x02v0\x18\x01 \x01(\x0b\x32\x64.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0H\x00\x1aU\n%WaitForStateTransitionResultRequestV0\x12\x1d\n\x15state_transition_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x99\x03\n$WaitForStateTransitionResultResponse\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0H\x00\x1a\xef\x01\n&WaitForStateTransitionResultResponseV0\x12I\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x38.org.dash.platform.dapi.v0.StateTransitionBroadcastErrorH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc4\x01\n\x19GetConsensusParamsRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0H\x00\x1a<\n\x1bGetConsensusParamsRequestV0\x12\x0e\n\x06height\x18\x01 \x01(\x05\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9c\x04\n\x1aGetConsensusParamsResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0H\x00\x1aP\n\x14\x43onsensusParamsBlock\x12\x11\n\tmax_bytes\x18\x01 \x01(\t\x12\x0f\n\x07max_gas\x18\x02 \x01(\t\x12\x14\n\x0ctime_iota_ms\x18\x03 \x01(\t\x1a\x62\n\x17\x43onsensusParamsEvidence\x12\x1a\n\x12max_age_num_blocks\x18\x01 \x01(\t\x12\x18\n\x10max_age_duration\x18\x02 \x01(\t\x12\x11\n\tmax_bytes\x18\x03 \x01(\t\x1a\xda\x01\n\x1cGetConsensusParamsResponseV0\x12Y\n\x05\x62lock\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock\x12_\n\x08\x65vidence\x18\x02 \x01(\x0b\x32M.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidenceB\t\n\x07version\"\xe4\x01\n%GetProtocolVersionUpgradeStateRequest\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0H\x00\x1a\x38\n\'GetProtocolVersionUpgradeStateRequestV0\x12\r\n\x05prove\x18\x01 \x01(\x08\x42\t\n\x07version\"\xb5\x05\n&GetProtocolVersionUpgradeStateResponse\x12x\n\x02v0\x18\x01 \x01(\x0b\x32j.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0H\x00\x1a\x85\x04\n(GetProtocolVersionUpgradeStateResponseV0\x12\x87\x01\n\x08versions\x18\x01 \x01(\x0b\x32s.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x96\x01\n\x08Versions\x12\x89\x01\n\x08versions\x18\x01 \x03(\x0b\x32w.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry\x1a:\n\x0cVersionEntry\x12\x16\n\x0eversion_number\x18\x01 \x01(\r\x12\x12\n\nvote_count\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xa3\x02\n*GetProtocolVersionUpgradeVoteStatusRequest\x12\x80\x01\n\x02v0\x18\x01 \x01(\x0b\x32r.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0H\x00\x1ag\n,GetProtocolVersionUpgradeVoteStatusRequestV0\x12\x19\n\x11start_pro_tx_hash\x18\x01 \x01(\x0c\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xef\x05\n+GetProtocolVersionUpgradeVoteStatusResponse\x12\x82\x01\n\x02v0\x18\x01 \x01(\x0b\x32t.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0H\x00\x1a\xaf\x04\n-GetProtocolVersionUpgradeVoteStatusResponseV0\x12\x98\x01\n\x08versions\x18\x01 \x01(\x0b\x32\x83\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignalsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\xaf\x01\n\x0eVersionSignals\x12\x9c\x01\n\x0fversion_signals\x18\x01 \x03(\x0b\x32\x82\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal\x1a\x35\n\rVersionSignal\x12\x13\n\x0bpro_tx_hash\x18\x01 \x01(\x0c\x12\x0f\n\x07version\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xf5\x01\n\x14GetEpochsInfoRequest\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0H\x00\x1a|\n\x16GetEpochsInfoRequestV0\x12\x31\n\x0bstart_epoch\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\x11\n\tascending\x18\x03 \x01(\x08\x12\r\n\x05prove\x18\x04 \x01(\x08\x42\t\n\x07version\"\x91\x05\n\x15GetEpochsInfoResponse\x12V\n\x02v0\x18\x01 \x01(\x0b\x32H.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0H\x00\x1a\x94\x04\n\x17GetEpochsInfoResponseV0\x12\x65\n\x06\x65pochs\x18\x01 \x01(\x0b\x32S.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfosH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1au\n\nEpochInfos\x12g\n\x0b\x65poch_infos\x18\x01 \x03(\x0b\x32R.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo\x1a\x9e\x01\n\tEpochInfo\x12\x0e\n\x06number\x18\x01 \x01(\r\x12\x1a\n\x12\x66irst_block_height\x18\x02 \x01(\x04\x12\x1f\n\x17\x66irst_core_block_height\x18\x03 \x01(\r\x12\x12\n\nstart_time\x18\x04 \x01(\x04\x12\x16\n\x0e\x66\x65\x65_multiplier\x18\x05 \x01(\x01\x12\x18\n\x10protocol_version\x18\x06 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xde\x04\n\x1cGetContestedResourcesRequest\x12\x64\n\x02v0\x18\x01 \x01(\x0b\x32V.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0H\x00\x1a\xcc\x03\n\x1eGetContestedResourcesRequestV0\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x1a\n\x12\x64ocument_type_name\x18\x02 \x01(\t\x12\x12\n\nindex_name\x18\x03 \x01(\t\x12\x1a\n\x12start_index_values\x18\x04 \x03(\x0c\x12\x18\n\x10\x65nd_index_values\x18\x05 \x03(\x0c\x12\x89\x01\n\x13start_at_value_info\x18\x06 \x01(\x0b\x32g.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfoH\x00\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x07 \x01(\rH\x01\x88\x01\x01\x12\x17\n\x0forder_ascending\x18\x08 \x01(\x08\x12\r\n\x05prove\x18\t \x01(\x08\x1a\x45\n\x10StartAtValueInfo\x12\x13\n\x0bstart_value\x18\x01 \x01(\x0c\x12\x1c\n\x14start_value_included\x18\x02 \x01(\x08\x42\x16\n\x14_start_at_value_infoB\x08\n\x06_countB\t\n\x07version\"\x88\x04\n\x1dGetContestedResourcesResponse\x12\x66\n\x02v0\x18\x01 \x01(\x0b\x32X.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0H\x00\x1a\xf3\x02\n\x1fGetContestedResourcesResponseV0\x12\x95\x01\n\x19\x63ontested_resource_values\x18\x01 \x01(\x0b\x32p.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValuesH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a<\n\x17\x43ontestedResourceValues\x12!\n\x19\x63ontested_resource_values\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\xca\x05\n\x1cGetVotePollsByEndDateRequest\x12\x64\n\x02v0\x18\x01 \x01(\x0b\x32V.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0H\x00\x1a\xb8\x04\n\x1eGetVotePollsByEndDateRequestV0\x12\x84\x01\n\x0fstart_time_info\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfoH\x00\x88\x01\x01\x12\x80\x01\n\rend_time_info\x18\x02 \x01(\x0b\x32\x64.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfoH\x01\x88\x01\x01\x12\x12\n\x05limit\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x13\n\x06offset\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x11\n\tascending\x18\x05 \x01(\x08\x12\r\n\x05prove\x18\x06 \x01(\x08\x1a\x45\n\x0fStartAtTimeInfo\x12\x15\n\rstart_time_ms\x18\x01 \x01(\x04\x12\x1b\n\x13start_time_included\x18\x02 \x01(\x08\x1a?\n\rEndAtTimeInfo\x12\x13\n\x0b\x65nd_time_ms\x18\x01 \x01(\x04\x12\x19\n\x11\x65nd_time_included\x18\x02 \x01(\x08\x42\x12\n\x10_start_time_infoB\x10\n\x0e_end_time_infoB\x08\n\x06_limitB\t\n\x07_offsetB\t\n\x07version\"\xff\x05\n\x1dGetVotePollsByEndDateResponse\x12\x66\n\x02v0\x18\x01 \x01(\x0b\x32X.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0H\x00\x1a\xea\x04\n\x1fGetVotePollsByEndDateResponseV0\x12\x9c\x01\n\x18vote_polls_by_timestamps\x18\x01 \x01(\x0b\x32x.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestampsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1aR\n\x1eSerializedVotePollsByTimestamp\x12\x11\n\ttimestamp\x18\x01 \x01(\x04\x12\x1d\n\x15serialized_vote_polls\x18\x02 \x03(\x0c\x1a\xd7\x01\n\x1fSerializedVotePollsByTimestamps\x12\x99\x01\n\x18vote_polls_by_timestamps\x18\x01 \x03(\x0b\x32w.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp\x12\x18\n\x10\x66inished_results\x18\x02 \x01(\x08\x42\x08\n\x06resultB\t\n\x07version\"\xff\x06\n$GetContestedResourceVoteStateRequest\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0H\x00\x1a\xd5\x05\n&GetContestedResourceVoteStateRequestV0\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x1a\n\x12\x64ocument_type_name\x18\x02 \x01(\t\x12\x12\n\nindex_name\x18\x03 \x01(\t\x12\x14\n\x0cindex_values\x18\x04 \x03(\x0c\x12\x86\x01\n\x0bresult_type\x18\x05 \x01(\x0e\x32q.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType\x12\x36\n.allow_include_locked_and_abstaining_vote_tally\x18\x06 \x01(\x08\x12\xa3\x01\n\x18start_at_identifier_info\x18\x07 \x01(\x0b\x32|.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfoH\x00\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x08 \x01(\rH\x01\x88\x01\x01\x12\r\n\x05prove\x18\t \x01(\x08\x1aT\n\x15StartAtIdentifierInfo\x12\x18\n\x10start_identifier\x18\x01 \x01(\x0c\x12!\n\x19start_identifier_included\x18\x02 \x01(\x08\"I\n\nResultType\x12\r\n\tDOCUMENTS\x10\x00\x12\x0e\n\nVOTE_TALLY\x10\x01\x12\x1c\n\x18\x44OCUMENTS_AND_VOTE_TALLY\x10\x02\x42\x1b\n\x19_start_at_identifier_infoB\x08\n\x06_countB\t\n\x07version\"\x8c\x0c\n%GetContestedResourceVoteStateResponse\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0H\x00\x1a\xdf\n\n\'GetContestedResourceVoteStateResponseV0\x12\xae\x01\n\x1d\x63ontested_resource_contenders\x18\x01 \x01(\x0b\x32\x84\x01.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContendersH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\xd2\x03\n\x10\x46inishedVoteInfo\x12\xad\x01\n\x15\x66inished_vote_outcome\x18\x01 \x01(\x0e\x32\x8d\x01.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome\x12\x1f\n\x12won_by_identity_id\x18\x02 \x01(\x0cH\x00\x88\x01\x01\x12 \n\x18\x66inished_at_block_height\x18\x03 \x01(\x04\x12%\n\x1d\x66inished_at_core_block_height\x18\x04 \x01(\r\x12!\n\x19\x66inished_at_block_time_ms\x18\x05 \x01(\x04\x12\x19\n\x11\x66inished_at_epoch\x18\x06 \x01(\r\"O\n\x13\x46inishedVoteOutcome\x12\x14\n\x10TOWARDS_IDENTITY\x10\x00\x12\n\n\x06LOCKED\x10\x01\x12\x16\n\x12NO_PREVIOUS_WINNER\x10\x02\x42\x15\n\x13_won_by_identity_id\x1a\xc4\x03\n\x1b\x43ontestedResourceContenders\x12\x86\x01\n\ncontenders\x18\x01 \x03(\x0b\x32r.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender\x12\x1f\n\x12\x61\x62stain_vote_tally\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1c\n\x0flock_vote_tally\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x9a\x01\n\x12\x66inished_vote_info\x18\x04 \x01(\x0b\x32y.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfoH\x02\x88\x01\x01\x42\x15\n\x13_abstain_vote_tallyB\x12\n\x10_lock_vote_tallyB\x15\n\x13_finished_vote_info\x1ak\n\tContender\x12\x12\n\nidentifier\x18\x01 \x01(\x0c\x12\x17\n\nvote_count\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x15\n\x08\x64ocument\x18\x03 \x01(\x0cH\x01\x88\x01\x01\x42\r\n\x0b_vote_countB\x0b\n\t_documentB\x08\n\x06resultB\t\n\x07version\"\xd5\x05\n,GetContestedResourceVotersForIdentityRequest\x12\x84\x01\n\x02v0\x18\x01 \x01(\x0b\x32v.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0H\x00\x1a\x92\x04\n.GetContestedResourceVotersForIdentityRequestV0\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x1a\n\x12\x64ocument_type_name\x18\x02 \x01(\t\x12\x12\n\nindex_name\x18\x03 \x01(\t\x12\x14\n\x0cindex_values\x18\x04 \x03(\x0c\x12\x15\n\rcontestant_id\x18\x05 \x01(\x0c\x12\xb4\x01\n\x18start_at_identifier_info\x18\x06 \x01(\x0b\x32\x8c\x01.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfoH\x00\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x07 \x01(\rH\x01\x88\x01\x01\x12\x17\n\x0forder_ascending\x18\x08 \x01(\x08\x12\r\n\x05prove\x18\t \x01(\x08\x1aT\n\x15StartAtIdentifierInfo\x12\x18\n\x10start_identifier\x18\x01 \x01(\x0c\x12!\n\x19start_identifier_included\x18\x02 \x01(\x08\x42\x1b\n\x19_start_at_identifier_infoB\x08\n\x06_countB\t\n\x07version\"\xf1\x04\n-GetContestedResourceVotersForIdentityResponse\x12\x86\x01\n\x02v0\x18\x01 \x01(\x0b\x32x.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0H\x00\x1a\xab\x03\n/GetContestedResourceVotersForIdentityResponseV0\x12\xb6\x01\n\x19\x63ontested_resource_voters\x18\x01 \x01(\x0b\x32\x90\x01.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVotersH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x43\n\x17\x43ontestedResourceVoters\x12\x0e\n\x06voters\x18\x01 \x03(\x0c\x12\x18\n\x10\x66inished_results\x18\x02 \x01(\x08\x42\x08\n\x06resultB\t\n\x07version\"\xad\x05\n(GetContestedResourceIdentityVotesRequest\x12|\n\x02v0\x18\x01 \x01(\x0b\x32n.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0H\x00\x1a\xf7\x03\n*GetContestedResourceIdentityVotesRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12+\n\x05limit\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\x17\n\x0forder_ascending\x18\x04 \x01(\x08\x12\xae\x01\n\x1astart_at_vote_poll_id_info\x18\x05 \x01(\x0b\x32\x84\x01.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfoH\x00\x88\x01\x01\x12\r\n\x05prove\x18\x06 \x01(\x08\x1a\x61\n\x15StartAtVotePollIdInfo\x12 \n\x18start_at_poll_identifier\x18\x01 \x01(\x0c\x12&\n\x1estart_poll_identifier_included\x18\x02 \x01(\x08\x42\x1d\n\x1b_start_at_vote_poll_id_infoB\t\n\x07version\"\xc8\n\n)GetContestedResourceIdentityVotesResponse\x12~\n\x02v0\x18\x01 \x01(\x0b\x32p.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0H\x00\x1a\x8f\t\n+GetContestedResourceIdentityVotesResponseV0\x12\xa1\x01\n\x05votes\x18\x01 \x01(\x0b\x32\x8f\x01.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotesH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\xf7\x01\n\x1e\x43ontestedResourceIdentityVotes\x12\xba\x01\n!contested_resource_identity_votes\x18\x01 \x03(\x0b\x32\x8e\x01.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote\x12\x18\n\x10\x66inished_results\x18\x02 \x01(\x08\x1a\xad\x02\n\x12ResourceVoteChoice\x12\xad\x01\n\x10vote_choice_type\x18\x01 \x01(\x0e\x32\x92\x01.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType\x12\x18\n\x0bidentity_id\x18\x02 \x01(\x0cH\x00\x88\x01\x01\"=\n\x0eVoteChoiceType\x12\x14\n\x10TOWARDS_IDENTITY\x10\x00\x12\x0b\n\x07\x41\x42STAIN\x10\x01\x12\x08\n\x04LOCK\x10\x02\x42\x0e\n\x0c_identity_id\x1a\x95\x02\n\x1d\x43ontestedResourceIdentityVote\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x1a\n\x12\x64ocument_type_name\x18\x02 \x01(\t\x12\'\n\x1fserialized_index_storage_values\x18\x03 \x03(\x0c\x12\x99\x01\n\x0bvote_choice\x18\x04 \x01(\x0b\x32\x83\x01.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoiceB\x08\n\x06resultB\t\n\x07version\"\xf0\x01\n%GetPrefundedSpecializedBalanceRequest\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0H\x00\x1a\x44\n\'GetPrefundedSpecializedBalanceRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xe9\x02\n&GetPrefundedSpecializedBalanceResponse\x12x\n\x02v0\x18\x01 \x01(\x0b\x32j.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0H\x00\x1a\xb9\x01\n(GetPrefundedSpecializedBalanceResponseV0\x12\x11\n\x07\x62\x61lance\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xd0\x01\n GetTotalCreditsInPlatformRequest\x12l\n\x02v0\x18\x01 \x01(\x0b\x32^.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0H\x00\x1a\x33\n\"GetTotalCreditsInPlatformRequestV0\x12\r\n\x05prove\x18\x01 \x01(\x08\x42\t\n\x07version\"\xd5\x02\n!GetTotalCreditsInPlatformResponse\x12n\n\x02v0\x18\x01 \x01(\x0b\x32`.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0H\x00\x1a\xb4\x01\n#GetTotalCreditsInPlatformResponseV0\x12\x11\n\x07\x63redits\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc4\x01\n\x16GetPathElementsRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0H\x00\x1a\x45\n\x18GetPathElementsRequestV0\x12\x0c\n\x04path\x18\x01 \x03(\x0c\x12\x0c\n\x04keys\x18\x02 \x03(\x0c\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xa3\x03\n\x17GetPathElementsResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0H\x00\x1a\xa0\x02\n\x19GetPathElementsResponseV0\x12i\n\x08\x65lements\x18\x01 \x01(\x0b\x32U.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ElementsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1c\n\x08\x45lements\x12\x10\n\x08\x65lements\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version*Z\n\nKeyPurpose\x12\x12\n\x0e\x41UTHENTICATION\x10\x00\x12\x0e\n\nENCRYPTION\x10\x01\x12\x0e\n\nDECRYPTION\x10\x02\x12\x0c\n\x08TRANSFER\x10\x03\x12\n\n\x06VOTING\x10\x05\x32\xba\x1e\n\x08Platform\x12\x93\x01\n\x18\x62roadcastStateTransition\x12:.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest\x1a;.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse\x12l\n\x0bgetIdentity\x12-.org.dash.platform.dapi.v0.GetIdentityRequest\x1a..org.dash.platform.dapi.v0.GetIdentityResponse\x12x\n\x0fgetIdentityKeys\x12\x31.org.dash.platform.dapi.v0.GetIdentityKeysRequest\x1a\x32.org.dash.platform.dapi.v0.GetIdentityKeysResponse\x12\x96\x01\n\x19getIdentitiesContractKeys\x12;.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest\x1a<.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse\x12{\n\x10getIdentityNonce\x12\x32.org.dash.platform.dapi.v0.GetIdentityNonceRequest\x1a\x33.org.dash.platform.dapi.v0.GetIdentityNonceResponse\x12\x93\x01\n\x18getIdentityContractNonce\x12:.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest\x1a;.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse\x12\x81\x01\n\x12getIdentityBalance\x12\x34.org.dash.platform.dapi.v0.GetIdentityBalanceRequest\x1a\x35.org.dash.platform.dapi.v0.GetIdentityBalanceResponse\x12\xa2\x01\n\x1dgetIdentityBalanceAndRevision\x12?.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest\x1a@.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse\x12\x66\n\tgetProofs\x12+.org.dash.platform.dapi.v0.GetProofsRequest\x1a,.org.dash.platform.dapi.v0.GetProofsResponse\x12x\n\x0fgetDataContract\x12\x31.org.dash.platform.dapi.v0.GetDataContractRequest\x1a\x32.org.dash.platform.dapi.v0.GetDataContractResponse\x12\x8d\x01\n\x16getDataContractHistory\x12\x38.org.dash.platform.dapi.v0.GetDataContractHistoryRequest\x1a\x39.org.dash.platform.dapi.v0.GetDataContractHistoryResponse\x12{\n\x10getDataContracts\x12\x32.org.dash.platform.dapi.v0.GetDataContractsRequest\x1a\x33.org.dash.platform.dapi.v0.GetDataContractsResponse\x12o\n\x0cgetDocuments\x12..org.dash.platform.dapi.v0.GetDocumentsRequest\x1a/.org.dash.platform.dapi.v0.GetDocumentsResponse\x12\x99\x01\n\x1agetIdentityByPublicKeyHash\x12<.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest\x1a=.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse\x12\x9f\x01\n\x1cwaitForStateTransitionResult\x12>.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest\x1a?.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse\x12\x81\x01\n\x12getConsensusParams\x12\x34.org.dash.platform.dapi.v0.GetConsensusParamsRequest\x1a\x35.org.dash.platform.dapi.v0.GetConsensusParamsResponse\x12\xa5\x01\n\x1egetProtocolVersionUpgradeState\x12@.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest\x1a\x41.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse\x12\xb4\x01\n#getProtocolVersionUpgradeVoteStatus\x12\x45.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest\x1a\x46.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse\x12r\n\rgetEpochsInfo\x12/.org.dash.platform.dapi.v0.GetEpochsInfoRequest\x1a\x30.org.dash.platform.dapi.v0.GetEpochsInfoResponse\x12\x8a\x01\n\x15getContestedResources\x12\x37.org.dash.platform.dapi.v0.GetContestedResourcesRequest\x1a\x38.org.dash.platform.dapi.v0.GetContestedResourcesResponse\x12\xa2\x01\n\x1dgetContestedResourceVoteState\x12?.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest\x1a@.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse\x12\xba\x01\n%getContestedResourceVotersForIdentity\x12G.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest\x1aH.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse\x12\xae\x01\n!getContestedResourceIdentityVotes\x12\x43.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest\x1a\x44.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse\x12\x8a\x01\n\x15getVotePollsByEndDate\x12\x37.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest\x1a\x38.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse\x12\xa5\x01\n\x1egetPrefundedSpecializedBalance\x12@.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest\x1a\x41.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse\x12\x96\x01\n\x19getTotalCreditsInPlatform\x12;.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest\x1a<.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse\x12x\n\x0fgetPathElements\x12\x31.org.dash.platform.dapi.v0.GetPathElementsRequest\x1a\x32.org.dash.platform.dapi.v0.GetPathElementsResponseb\x06proto3' , dependencies=[google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR,google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) +_KEYPURPOSE = _descriptor.EnumDescriptor( + name='KeyPurpose', + full_name='org.dash.platform.dapi.v0.KeyPurpose', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='AUTHENTICATION', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ENCRYPTION', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DECRYPTION', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='TRANSFER', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='VOTING', index=4, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=26114, + serialized_end=26204, +) +_sym_db.RegisterEnumDescriptor(_KEYPURPOSE) + +KeyPurpose = enum_type_wrapper.EnumTypeWrapper(_KEYPURPOSE) +AUTHENTICATION = 0 +ENCRYPTION = 1 +DECRYPTION = 2 +TRANSFER = 3 +VOTING = 5 _SECURITYLEVELMAP_KEYKINDREQUESTTYPE = _descriptor.EnumDescriptor( @@ -48,11 +95,41 @@ ], containing_type=None, serialized_options=None, - serialized_start=3815, - serialized_end=3898, + serialized_start=4150, + serialized_end=4233, ) _sym_db.RegisterEnumDescriptor(_SECURITYLEVELMAP_KEYKINDREQUESTTYPE) +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST_DOCUMENTCONTESTEDSTATUS = _descriptor.EnumDescriptor( + name='DocumentContestedStatus', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='NOT_CONTESTED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='MAYBE_CONTESTED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONTESTED', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=7011, + serialized_end=7091, +) +_sym_db.RegisterEnumDescriptor(_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST_DOCUMENTCONTESTEDSTATUS) + _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE = _descriptor.EnumDescriptor( name='Type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type', @@ -75,14 +152,109 @@ serialized_options=None, type=None, create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='REVISION', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), ], containing_type=None, serialized_options=None, - serialized_start=5350, - serialized_end=5398, + serialized_start=7241, + serialized_end=7303, ) _sym_db.RegisterEnumDescriptor(_GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE) +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_RESULTTYPE = _descriptor.EnumDescriptor( + name='ResultType', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DOCUMENTS', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='VOTE_TALLY', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DOCUMENTS_AND_VOTE_TALLY', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=19256, + serialized_end=19329, +) +_sym_db.RegisterEnumDescriptor(_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_RESULTTYPE) + +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO_FINISHEDVOTEOUTCOME = _descriptor.EnumDescriptor( + name='FinishedVoteOutcome', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='TOWARDS_IDENTITY', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='LOCKED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='NO_PREVIOUS_WINNER', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=20243, + serialized_end=20322, +) +_sym_db.RegisterEnumDescriptor(_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO_FINISHEDVOTEOUTCOME) + +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE_VOTECHOICETYPE = _descriptor.EnumDescriptor( + name='VoteChoiceType', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='TOWARDS_IDENTITY', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ABSTAIN', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='LOCK', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=23951, + serialized_end=24012, +) +_sym_db.RegisterEnumDescriptor(_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE_VOTECHOICETYPE) + _PROOF = _descriptor.Descriptor( name='Proof', @@ -396,23 +568,23 @@ ) -_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0 = _descriptor.Descriptor( - name='GetIdentityBalanceRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0', +_GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityNonceRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.id', index=0, + name='identity_id', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.identity_id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prove', index=1, + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prove', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, @@ -430,20 +602,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=887, - serialized_end=943, + serialized_start=881, + serialized_end=944, ) -_GETIDENTITYBALANCEREQUEST = _descriptor.Descriptor( - name='GetIdentityBalanceRequest', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest', +_GETIDENTITYNONCEREQUEST = _descriptor.Descriptor( + name='GetIdentityNonceRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -452,7 +624,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0, ], + nested_types=[_GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -461,34 +633,41 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], serialized_start=762, - serialized_end=954, + serialized_end=955, ) -_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0 = _descriptor.Descriptor( - name='GetIdentityBalanceAndRevisionRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', +_GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityContractNonceRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.id', index=0, + name='identity_id', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.identity_id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prove', index=1, - number=2, type=8, cpp_type=7, label=1, + name='contract_id', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.contract_id', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prove', index=2, + number=3, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -505,20 +684,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1115, - serialized_end=1182, + serialized_start=1101, + serialized_end=1193, ) -_GETIDENTITYBALANCEANDREVISIONREQUEST = _descriptor.Descriptor( - name='GetIdentityBalanceAndRevisionRequest', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', +_GETIDENTITYCONTRACTNONCEREQUEST = _descriptor.Descriptor( + name='GetIdentityContractNonceRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -527,7 +706,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0, ], + nested_types=[_GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -536,42 +715,35 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=957, - serialized_end=1193, + serialized_start=958, + serialized_end=1204, ) -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0 = _descriptor.Descriptor( - name='GetIdentityResponseV0', - full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', +_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityBalanceRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identity', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.identity', index=0, + name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prove', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -586,26 +758,21 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.result', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=1304, - serialized_end=1471, + serialized_start=1332, + serialized_end=1388, ) -_GETIDENTITYRESPONSE = _descriptor.Descriptor( - name='GetIdentityResponse', - full_name='org.dash.platform.dapi.v0.GetIdentityResponse', +_GETIDENTITYBALANCEREQUEST = _descriptor.Descriptor( + name='GetIdentityBalanceRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -614,7 +781,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0, ], + nested_types=[_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -623,33 +790,33 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1196, - serialized_end=1482, + serialized_start=1207, + serialized_end=1399, ) -_GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0 = _descriptor.Descriptor( - name='GetIdentitiesRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0', +_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityBalanceAndRevisionRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='ids', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.ids', index=0, - number=1, type=12, cpp_type=9, label=3, - has_default_value=False, default_value=[], + name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prove', index=1, + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prove', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, @@ -667,20 +834,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1595, - serialized_end=1647, + serialized_start=1560, + serialized_end=1627, ) -_GETIDENTITIESREQUEST = _descriptor.Descriptor( - name='GetIdentitiesRequest', - full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest', +_GETIDENTITYBALANCEANDREVISIONREQUEST = _descriptor.Descriptor( + name='GetIdentityBalanceAndRevisionRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -689,7 +856,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0, ], + nested_types=[_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -698,65 +865,41 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1485, - serialized_end=1658, + serialized_start=1402, + serialized_end=1638, ) -_GETIDENTITIESRESPONSE_IDENTITYVALUE = _descriptor.Descriptor( - name='IdentityValue', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue', +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0 = _descriptor.Descriptor( + name='GetIdentityResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='value', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.value', index=0, + name='identity', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.identity', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1774, - serialized_end=1804, -) - -_GETIDENTITIESRESPONSE_IDENTITYENTRY = _descriptor.Descriptor( - name='IdentityEntry', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ _descriptor.FieldDescriptor( - name='key', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.key', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='value', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.value', index=1, - number=2, type=11, cpp_type=10, label=1, + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -772,30 +915,35 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=1806, - serialized_end=1913, + serialized_start=1749, + serialized_end=1916, ) -_GETIDENTITIESRESPONSE_IDENTITIES = _descriptor.Descriptor( - name='Identities', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities', +_GETIDENTITYRESPONSE = _descriptor.Descriptor( + name='GetIdentityResponse', + full_name='org.dash.platform.dapi.v0.GetIdentityResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identity_entries', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.identity_entries', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -803,35 +951,128 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=1915, - serialized_end=2017, + serialized_start=1641, + serialized_end=1927, ) -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0 = _descriptor.Descriptor( - name='GetIdentitiesResponseV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0', + +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0 = _descriptor.Descriptor( + name='GetIdentityNonceResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identities', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.identities', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='identity_nonce', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.identity_nonce', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=2053, + serialized_end=2231, +) + +_GETIDENTITYNONCERESPONSE = _descriptor.Descriptor( + name='GetIdentityNonceResponse', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=1930, + serialized_end=2242, +) + + +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0 = _descriptor.Descriptor( + name='GetIdentityContractNonceResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='identity_contract_nonce', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.identity_contract_nonce', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.proof', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.metadata', index=2, + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.metadata', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -849,25 +1090,25 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.result', + name='result', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.result', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2020, - serialized_end=2252, + serialized_start=2392, + serialized_end=2587, ) -_GETIDENTITIESRESPONSE = _descriptor.Descriptor( - name='GetIdentitiesResponse', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse', +_GETIDENTITYCONTRACTNONCERESPONSE = _descriptor.Descriptor( + name='GetIdentityContractNonceResponse', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -876,7 +1117,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITIESRESPONSE_IDENTITYVALUE, _GETIDENTITIESRESPONSE_IDENTITYENTRY, _GETIDENTITIESRESPONSE_IDENTITIES, _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0, ], + nested_types=[_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -885,13 +1126,13 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1661, - serialized_end=2263, + serialized_start=2245, + serialized_end=2598, ) @@ -941,8 +1182,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2395, - serialized_end=2568, + serialized_start=2730, + serialized_end=2903, ) _GETIDENTITYBALANCERESPONSE = _descriptor.Descriptor( @@ -977,8 +1218,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2266, - serialized_end=2579, + serialized_start=2601, + serialized_end=2914, ) @@ -1016,8 +1257,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3059, - serialized_end=3114, + serialized_start=3394, + serialized_end=3449, ) _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0 = _descriptor.Descriptor( @@ -1066,8 +1307,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2744, - serialized_end=3124, + serialized_start=3079, + serialized_end=3459, ) _GETIDENTITYBALANCEANDREVISIONRESPONSE = _descriptor.Descriptor( @@ -1102,8 +1343,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2582, - serialized_end=3135, + serialized_start=2917, + serialized_end=3470, ) @@ -1153,8 +1394,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=3138, - serialized_end=3347, + serialized_start=3473, + serialized_end=3682, ) @@ -1178,8 +1419,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3349, - serialized_end=3358, + serialized_start=3684, + serialized_end=3693, ) @@ -1210,8 +1451,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3360, - serialized_end=3391, + serialized_start=3695, + serialized_end=3726, ) @@ -1249,8 +1490,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3482, - serialized_end=3576, + serialized_start=3817, + serialized_end=3911, ) _SEARCHKEY = _descriptor.Descriptor( @@ -1280,8 +1521,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3394, - serialized_end=3576, + serialized_start=3729, + serialized_end=3911, ) @@ -1319,8 +1560,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3694, - serialized_end=3813, + serialized_start=4029, + serialized_end=4148, ) _SECURITYLEVELMAP = _descriptor.Descriptor( @@ -1351,8 +1592,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3579, - serialized_end=3898, + serialized_start=3914, + serialized_end=4233, ) @@ -1411,8 +1652,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=4018, - serialized_end=4236, + serialized_start=4353, + serialized_end=4571, ) _GETIDENTITYKEYSREQUEST = _descriptor.Descriptor( @@ -1447,8 +1688,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=3901, - serialized_end=4247, + serialized_start=4236, + serialized_end=4582, ) @@ -1479,8 +1720,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=4612, - serialized_end=4638, + serialized_start=4947, + serialized_end=4973, ) _GETIDENTITYKEYSRESPONSE_GETIDENTITYKEYSRESPONSEV0 = _descriptor.Descriptor( @@ -1529,8 +1770,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=4370, - serialized_end=4648, + serialized_start=4705, + serialized_end=4983, ) _GETIDENTITYKEYSRESPONSE = _descriptor.Descriptor( @@ -1565,44 +1806,51 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=4250, - serialized_end=4659, + serialized_start=4585, + serialized_end=4994, ) -_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST = _descriptor.Descriptor( - name='DocumentRequest', - full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest', +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0 = _descriptor.Descriptor( + name='GetIdentitiesContractKeysRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='contract_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.contract_id', index=0, - number=1, type=12, cpp_type=9, label=1, + name='identities_ids', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.identities_ids', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.contract_id', index=1, + number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='document_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type', index=1, - number=2, type=9, cpp_type=9, label=1, + name='document_type_name', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.document_type_name', index=2, + number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='document_type_keeps_history', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type_keeps_history', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='purposes', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.purposes', index=3, + number=4, type=14, cpp_type=8, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='document_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_id', index=3, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prove', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -1617,62 +1865,72 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='_document_type_name', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0._document_type_name', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=5081, - serialized_end=5200, + serialized_start=5144, + serialized_end=5353, ) -_GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST = _descriptor.Descriptor( - name='IdentityRequest', - full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest', +_GETIDENTITIESCONTRACTKEYSREQUEST = _descriptor.Descriptor( + name='GetIdentitiesContractKeysRequest', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identity_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.identity_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='request_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.request_type', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0, ], enum_types=[ - _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=5203, - serialized_end=5398, + serialized_start=4997, + serialized_end=5364, ) -_GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST = _descriptor.Descriptor( - name='ContractRequest', - full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest', + +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS = _descriptor.Descriptor( + name='PurposeKeys', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='contract_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.contract_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='purpose', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.purpose', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='keys_bytes', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.keys_bytes', index=1, + number=2, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -1688,43 +1946,36 @@ extension_ranges=[], oneofs=[ ], - serialized_start=5400, - serialized_end=5438, + serialized_start=5811, + serialized_end=5900, ) -_GETPROOFSREQUEST_GETPROOFSREQUESTV0 = _descriptor.Descriptor( - name='GetProofsRequestV0', - full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0', +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS = _descriptor.Descriptor( + name='IdentityKeys', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identities', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.identities', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], + name='identity_id', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.identity_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='contracts', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.contracts', index=1, + name='keys', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.keys', index=1, number=2, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='documents', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.documents', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST, _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST, _GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST, ], + nested_types=[], enum_types=[ ], serialized_options=None, @@ -1733,29 +1984,29 @@ extension_ranges=[], oneofs=[ ], - serialized_start=4761, - serialized_end=5438, + serialized_start=5903, + serialized_end=6062, ) -_GETPROOFSREQUEST = _descriptor.Descriptor( - name='GetProofsRequest', - full_name='org.dash.platform.dapi.v0.GetProofsRequest', +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS = _descriptor.Descriptor( + name='IdentitiesKeys', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetProofsRequest.v0', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='entries', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.entries', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETPROOFSREQUEST_GETPROOFSREQUESTV0, ], + nested_types=[], enum_types=[ ], serialized_options=None, @@ -1763,43 +2014,44 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetProofsRequest.version', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=4662, - serialized_end=5449, + serialized_start=6065, + serialized_end=6209, ) - -_GETPROOFSRESPONSE_GETPROOFSRESPONSEV0 = _descriptor.Descriptor( - name='GetProofsResponseV0', - full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0', +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 = _descriptor.Descriptor( + name='GetIdentitiesContractKeysResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.proof', index=0, + name='identities_keys', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.identities_keys', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.metadata', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS, _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS, _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS, ], enum_types=[ ], serialized_options=None, @@ -1808,25 +2060,25 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.result', + name='result', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.result', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=5554, - serialized_end=5699, + serialized_start=5517, + serialized_end=6219, ) -_GETPROOFSRESPONSE = _descriptor.Descriptor( - name='GetProofsResponse', - full_name='org.dash.platform.dapi.v0.GetProofsResponse', +_GETIDENTITIESCONTRACTKEYSRESPONSE = _descriptor.Descriptor( + name='GetIdentitiesContractKeysResponse', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetProofsResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -1835,7 +2087,7 @@ ], extensions=[ ], - nested_types=[_GETPROOFSRESPONSE_GETPROOFSRESPONSEV0, ], + nested_types=[_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -1844,43 +2096,65 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetProofsResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=5452, - serialized_end=5710, + serialized_start=5367, + serialized_end=6230, ) -_GETDATACONTRACTREQUEST_GETDATACONTRACTREQUESTV0 = _descriptor.Descriptor( - name='GetDataContractRequestV0', - full_name='org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0', +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST = _descriptor.Descriptor( + name='DocumentRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='id', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.id', index=0, + name='contract_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.contract_id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prove', index=1, - number=2, type=8, cpp_type=7, label=1, + name='document_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type_keeps_history', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type_keeps_history', index=2, + number=3, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_id', index=3, + number=4, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_contested_status', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_contested_status', index=4, + number=5, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ + _GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST_DOCUMENTCONTESTEDSTATUS, ], serialized_options=None, is_extendable=False, @@ -1888,73 +2162,120 @@ extension_ranges=[], oneofs=[ ], - serialized_start=5829, - serialized_end=5882, + serialized_start=6750, + serialized_end=7091, ) -_GETDATACONTRACTREQUEST = _descriptor.Descriptor( - name='GetDataContractRequest', - full_name='org.dash.platform.dapi.v0.GetDataContractRequest', +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST = _descriptor.Descriptor( + name='IdentityRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.v0', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='identity_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.identity_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='request_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.request_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETDATACONTRACTREQUEST_GETDATACONTRACTREQUESTV0, ], + nested_types=[], enum_types=[ + _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.version', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=5713, - serialized_end=5893, + serialized_start=7094, + serialized_end=7303, ) - -_GETDATACONTRACTRESPONSE_GETDATACONTRACTRESPONSEV0 = _descriptor.Descriptor( - name='GetDataContractResponseV0', - full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0', +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST = _descriptor.Descriptor( + name='ContractRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='data_contract', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.data_contract', index=0, + name='contract_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.contract_id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.proof', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7305, + serialized_end=7343, +) + +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST_CONTESTEDRESOURCEVOTESTATUSREQUEST = _descriptor.Descriptor( + name='ContestedResourceVoteStatusRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.contract_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.metadata', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='document_type_name', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.document_type_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_name', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.index_name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_values', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.index_values', index=3, + number=4, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='voter_identifier', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.voter_identifier', index=4, + number=5, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -1969,26 +2290,21 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.result', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=6016, - serialized_end=6192, + serialized_start=7536, + serialized_end=7689, ) -_GETDATACONTRACTRESPONSE = _descriptor.Descriptor( - name='GetDataContractResponse', - full_name='org.dash.platform.dapi.v0.GetDataContractResponse', +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST = _descriptor.Descriptor( + name='VoteStatusRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.v0', index=0, + name='contested_resource_vote_status_request', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.contested_resource_vote_status_request', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -1997,7 +2313,7 @@ ], extensions=[ ], - nested_types=[_GETDATACONTRACTRESPONSE_GETDATACONTRACTRESPONSEV0, ], + nested_types=[_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST_CONTESTEDRESOURCEVOTESTATUSREQUEST, ], enum_types=[ ], serialized_options=None, @@ -2006,42 +2322,55 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.version', + name='request_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.request_type', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=5896, - serialized_end=6203, + serialized_start=7346, + serialized_end=7705, ) - -_GETDATACONTRACTSREQUEST_GETDATACONTRACTSREQUESTV0 = _descriptor.Descriptor( - name='GetDataContractsRequestV0', - full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0', +_GETPROOFSREQUEST_GETPROOFSREQUESTV0 = _descriptor.Descriptor( + name='GetProofsRequestV0', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='ids', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.ids', index=0, - number=1, type=12, cpp_type=9, label=3, + name='identities', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.identities', index=0, + number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prove', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='contracts', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.contracts', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='documents', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.documents', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='votes', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.votes', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST, _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST, _GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST, _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST, ], enum_types=[ ], serialized_options=None, @@ -2050,20 +2379,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=6325, - serialized_end=6380, + serialized_start=6332, + serialized_end=7705, ) -_GETDATACONTRACTSREQUEST = _descriptor.Descriptor( - name='GetDataContractsRequest', - full_name='org.dash.platform.dapi.v0.GetDataContractsRequest', +_GETPROOFSREQUEST = _descriptor.Descriptor( + name='GetProofsRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetProofsRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2072,7 +2401,7 @@ ], extensions=[ ], - nested_types=[_GETDATACONTRACTSREQUEST_GETDATACONTRACTSREQUESTV0, ], + nested_types=[_GETPROOFSREQUEST_GETPROOFSREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -2081,33 +2410,33 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetProofsRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6206, - serialized_end=6391, + serialized_start=6233, + serialized_end=7716, ) -_GETDATACONTRACTSRESPONSE_DATACONTRACTENTRY = _descriptor.Descriptor( - name='DataContractEntry', - full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry', +_GETPROOFSRESPONSE_GETPROOFSRESPONSEV0 = _descriptor.Descriptor( + name='GetProofsResponseV0', + full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identifier', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.identifier', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='proof', full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.proof', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='data_contract', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.data_contract', index=1, + name='metadata', full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.metadata', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2124,30 +2453,35 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=6516, - serialized_end=6607, + serialized_start=7821, + serialized_end=7966, ) -_GETDATACONTRACTSRESPONSE_DATACONTRACTS = _descriptor.Descriptor( - name='DataContracts', - full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts', +_GETPROOFSRESPONSE = _descriptor.Descriptor( + name='GetProofsResponse', + full_name='org.dash.platform.dapi.v0.GetProofsResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='data_contract_entries', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.data_contract_entries', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], + name='v0', full_name='org.dash.platform.dapi.v0.GetProofsResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETPROOFSRESPONSE_GETPROOFSRESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -2155,37 +2489,36 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetProofsResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=6609, - serialized_end=6726, + serialized_start=7719, + serialized_end=7977, ) -_GETDATACONTRACTSRESPONSE_GETDATACONTRACTSRESPONSEV0 = _descriptor.Descriptor( - name='GetDataContractsResponseV0', - full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0', + +_GETDATACONTRACTREQUEST_GETDATACONTRACTREQUESTV0 = _descriptor.Descriptor( + name='GetDataContractRequestV0', + full_name='org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='data_contracts', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.data_contracts', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.proof', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='id', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.metadata', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='prove', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prove', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -2200,26 +2533,21 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.result', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=6729, - serialized_end=6974, + serialized_start=8096, + serialized_end=8149, ) -_GETDATACONTRACTSRESPONSE = _descriptor.Descriptor( - name='GetDataContractsResponse', - full_name='org.dash.platform.dapi.v0.GetDataContractsResponse', +_GETDATACONTRACTREQUEST = _descriptor.Descriptor( + name='GetDataContractRequest', + full_name='org.dash.platform.dapi.v0.GetDataContractRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2228,7 +2556,7 @@ ], extensions=[ ], - nested_types=[_GETDATACONTRACTSRESPONSE_DATACONTRACTENTRY, _GETDATACONTRACTSRESPONSE_DATACONTRACTS, _GETDATACONTRACTSRESPONSE_GETDATACONTRACTSRESPONSEV0, ], + nested_types=[_GETDATACONTRACTREQUEST_GETDATACONTRACTREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -2237,59 +2565,45 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetDataContractRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6394, - serialized_end=6985, + serialized_start=7980, + serialized_end=8160, ) -_GETDATACONTRACTHISTORYREQUEST_GETDATACONTRACTHISTORYREQUESTV0 = _descriptor.Descriptor( - name='GetDataContractHistoryRequestV0', - full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0', +_GETDATACONTRACTRESPONSE_GETDATACONTRACTRESPONSEV0 = _descriptor.Descriptor( + name='GetDataContractResponseV0', + full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='id', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.id', index=0, + name='data_contract', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.data_contract', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='limit', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.limit', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='offset', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.offset', index=2, + name='metadata', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.metadata', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_at_ms', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.start_at_ms', index=3, - number=4, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prove', index=4, - number=5, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -2301,21 +2615,26 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=7126, - serialized_end=7298, + serialized_start=8283, + serialized_end=8459, ) -_GETDATACONTRACTHISTORYREQUEST = _descriptor.Descriptor( - name='GetDataContractHistoryRequest', - full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest', +_GETDATACONTRACTRESPONSE = _descriptor.Descriptor( + name='GetDataContractResponse', + full_name='org.dash.platform.dapi.v0.GetDataContractResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2324,7 +2643,7 @@ ], extensions=[ ], - nested_types=[_GETDATACONTRACTHISTORYREQUEST_GETDATACONTRACTHISTORYREQUESTV0, ], + nested_types=[_GETDATACONTRACTRESPONSE_GETDATACONTRACTRESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -2333,35 +2652,35 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetDataContractResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6988, - serialized_end=7309, + serialized_start=8163, + serialized_end=8470, ) -_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORYENTRY = _descriptor.Descriptor( - name='DataContractHistoryEntry', - full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry', +_GETDATACONTRACTSREQUEST_GETDATACONTRACTSREQUESTV0 = _descriptor.Descriptor( + name='GetDataContractsRequestV0', + full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='date', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.date', index=0, - number=1, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, + name='ids', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.ids', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='value', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.value', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='prove', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prove', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -2377,29 +2696,29 @@ extension_ranges=[], oneofs=[ ], - serialized_start=7749, - serialized_end=7804, + serialized_start=8592, + serialized_end=8647, ) -_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORY = _descriptor.Descriptor( - name='DataContractHistory', - full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory', +_GETDATACONTRACTSREQUEST = _descriptor.Descriptor( + name='GetDataContractsRequest', + full_name='org.dash.platform.dapi.v0.GetDataContractsRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='data_contract_entries', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.data_contract_entries', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], + name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETDATACONTRACTSREQUEST_GETDATACONTRACTSREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -2407,44 +2726,43 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetDataContractsRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=7807, - serialized_end=7977, + serialized_start=8473, + serialized_end=8658, ) -_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0 = _descriptor.Descriptor( - name='GetDataContractHistoryResponseV0', - full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0', + +_GETDATACONTRACTSRESPONSE_DATACONTRACTENTRY = _descriptor.Descriptor( + name='DataContractEntry', + full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='data_contract_history', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.data_contract_history', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='identifier', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.identifier', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.proof', index=1, + name='data_contract', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.data_contract', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.metadata', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORYENTRY, _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORY, ], + nested_types=[], enum_types=[ ], serialized_options=None, @@ -2452,35 +2770,30 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.result', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=7453, - serialized_end=7987, + serialized_start=8783, + serialized_end=8874, ) -_GETDATACONTRACTHISTORYRESPONSE = _descriptor.Descriptor( - name='GetDataContractHistoryResponse', - full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse', +_GETDATACONTRACTSRESPONSE_DATACONTRACTS = _descriptor.Descriptor( + name='DataContracts', + full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.v0', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='data_contract_entries', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.data_contract_entries', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0, ], + nested_types=[], enum_types=[ ], serialized_options=None, @@ -2488,78 +2801,37 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.version', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=7312, - serialized_end=7998, + serialized_start=8876, + serialized_end=8993, ) - -_GETDOCUMENTSREQUEST_GETDOCUMENTSREQUESTV0 = _descriptor.Descriptor( - name='GetDocumentsRequestV0', - full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0', +_GETDATACONTRACTSRESPONSE_GETDATACONTRACTSRESPONSEV0 = _descriptor.Descriptor( + name='GetDataContractsResponseV0', + full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='data_contract_id', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.data_contract_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='document_type', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.document_type', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='where', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.where', index=2, - number=3, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='order_by', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.order_by', index=3, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='limit', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.limit', index=4, - number=5, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_after', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.start_after', index=5, - number=6, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='data_contracts', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.data_contracts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='start_at', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.start_at', index=6, - number=7, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='proof', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prove', index=7, - number=8, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='metadata', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -2575,25 +2847,25 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='start', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.start', + name='result', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.result', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8109, - serialized_end=8296, + serialized_start=8996, + serialized_end=9241, ) -_GETDOCUMENTSREQUEST = _descriptor.Descriptor( - name='GetDocumentsRequest', - full_name='org.dash.platform.dapi.v0.GetDocumentsRequest', +_GETDATACONTRACTSRESPONSE = _descriptor.Descriptor( + name='GetDataContractsResponse', + full_name='org.dash.platform.dapi.v0.GetDataContractsResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2602,7 +2874,7 @@ ], extensions=[ ], - nested_types=[_GETDOCUMENTSREQUEST_GETDOCUMENTSREQUESTV0, ], + nested_types=[_GETDATACONTRACTSRESPONSE_DATACONTRACTENTRY, _GETDATACONTRACTSRESPONSE_DATACONTRACTS, _GETDATACONTRACTSRESPONSE_GETDATACONTRACTSRESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -2611,80 +2883,63 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetDataContractsResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8001, - serialized_end=8307, + serialized_start=8661, + serialized_end=9252, ) -_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0_DOCUMENTS = _descriptor.Descriptor( - name='Documents', - full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents', +_GETDATACONTRACTHISTORYREQUEST_GETDATACONTRACTHISTORYREQUESTV0 = _descriptor.Descriptor( + name='GetDataContractHistoryRequestV0', + full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='documents', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.documents', index=0, - number=1, type=12, cpp_type=9, label=3, - has_default_value=False, default_value=[], + name='id', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=8664, - serialized_end=8694, -) - -_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0 = _descriptor.Descriptor( - name='GetDocumentsResponseV0', - full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ _descriptor.FieldDescriptor( - name='documents', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.documents', index=0, - number=1, type=11, cpp_type=10, label=1, + name='limit', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.limit', index=1, + number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.proof', index=1, - number=2, type=11, cpp_type=10, label=1, + name='offset', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.offset', index=2, + number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.metadata', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='start_at_ms', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.start_at_ms', index=3, + number=4, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prove', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0_DOCUMENTS, ], + nested_types=[], enum_types=[ ], serialized_options=None, @@ -2692,26 +2947,21 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.result', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=8421, - serialized_end=8704, + serialized_start=9393, + serialized_end=9565, ) -_GETDOCUMENTSRESPONSE = _descriptor.Descriptor( - name='GetDocumentsResponse', - full_name='org.dash.platform.dapi.v0.GetDocumentsResponse', +_GETDATACONTRACTHISTORYREQUEST = _descriptor.Descriptor( + name='GetDataContractHistoryRequest', + full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2720,7 +2970,7 @@ ], extensions=[ ], - nested_types=[_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0, ], + nested_types=[_GETDATACONTRACTHISTORYREQUEST_GETDATACONTRACTHISTORYREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -2729,35 +2979,35 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8310, - serialized_end=8715, + serialized_start=9255, + serialized_end=9576, ) -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0 = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0', +_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORYENTRY = _descriptor.Descriptor( + name='DataContractHistoryEntry', + full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='public_key_hashes', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.public_key_hashes', index=0, - number=1, type=12, cpp_type=9, label=3, - has_default_value=False, default_value=[], + name='date', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.date', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prove', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='value', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.value', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -2773,29 +3023,29 @@ extension_ranges=[], oneofs=[ ], - serialized_start=8879, - serialized_end=8962, + serialized_start=10016, + serialized_end=10071, ) -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesRequest', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', +_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORY = _descriptor.Descriptor( + name='DataContractHistory', + full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.v0', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='data_contract_entries', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.data_contract_entries', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0, ], + nested_types=[], enum_types=[ ], serialized_options=None, @@ -2803,43 +3053,44 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.version', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=8718, - serialized_end=8973, + serialized_start=10074, + serialized_end=10244, ) - -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY = _descriptor.Descriptor( - name='PublicKeyHashIdentityEntry', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry', +_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0 = _descriptor.Descriptor( + name='GetDataContractHistoryResponseV0', + full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='public_key_hash', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.public_key_hash', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='data_contract_history', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.data_contract_history', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='value', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.value', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORYENTRY, _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORY, ], enum_types=[ ], serialized_options=None, @@ -2847,22 +3098,186 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=9140, - serialized_end=9237, + serialized_start=9720, + serialized_end=10254, ) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES = _descriptor.Descriptor( - name='IdentitiesByPublicKeyHashes', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes', +_GETDATACONTRACTHISTORYRESPONSE = _descriptor.Descriptor( + name='GetDataContractHistoryResponse', + full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identity_entries', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.identity_entries', index=0, - number=1, type=11, cpp_type=10, label=3, + name='v0', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetDataContractHistoryResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=9579, + serialized_end=10265, +) + + +_GETDOCUMENTSREQUEST_GETDOCUMENTSREQUESTV0 = _descriptor.Descriptor( + name='GetDocumentsRequestV0', + full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='data_contract_id', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.data_contract_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.document_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='where', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.where', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='order_by', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.order_by', index=3, + number=4, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='limit', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.limit', index=4, + number=5, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_after', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.start_after', index=5, + number=6, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_at', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.start_at', index=6, + number=7, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prove', index=7, + number=8, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='start', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.start', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=10376, + serialized_end=10563, +) + +_GETDOCUMENTSREQUEST = _descriptor.Descriptor( + name='GetDocumentsRequest', + full_name='org.dash.platform.dapi.v0.GetDocumentsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETDOCUMENTSREQUEST_GETDOCUMENTSREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetDocumentsRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=10268, + serialized_end=10574, +) + + +_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0_DOCUMENTS = _descriptor.Descriptor( + name='Documents', + full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='documents', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.documents', index=0, + number=1, type=12, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -2879,34 +3294,34 @@ extension_ranges=[], oneofs=[ ], - serialized_start=9240, - serialized_end=9389, + serialized_start=10931, + serialized_end=10961, ) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0 = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesResponseV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0', +_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0 = _descriptor.Descriptor( + name='GetDocumentsResponseV0', + full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identities', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.identities', index=0, + name='documents', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.documents', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.proof', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.metadata', index=2, + name='metadata', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.metadata', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2915,7 +3330,7 @@ ], extensions=[ ], - nested_types=[], + nested_types=[_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0_DOCUMENTS, ], enum_types=[ ], serialized_options=None, @@ -2924,25 +3339,25 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.result', + name='result', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.result', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=9392, - serialized_end=9675, + serialized_start=10688, + serialized_end=10971, ) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesResponse', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', +_GETDOCUMENTSRESPONSE = _descriptor.Descriptor( + name='GetDocumentsResponse', + full_name='org.dash.platform.dapi.v0.GetDocumentsResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -2951,7 +3366,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY, _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES, _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0, ], + nested_types=[_GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -2960,13 +3375,13 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetDocumentsResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8976, - serialized_end=9686, + serialized_start=10577, + serialized_end=10982, ) @@ -3004,8 +3419,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=9838, - serialized_end=9915, + serialized_start=11134, + serialized_end=11211, ) _GETIDENTITYBYPUBLICKEYHASHREQUEST = _descriptor.Descriptor( @@ -3040,8 +3455,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=9689, - serialized_end=9926, + serialized_start=10985, + serialized_end=11222, ) @@ -3091,8 +3506,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10082, - serialized_end=10264, + serialized_start=11378, + serialized_end=11560, ) _GETIDENTITYBYPUBLICKEYHASHRESPONSE = _descriptor.Descriptor( @@ -3127,8 +3542,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=9929, - serialized_end=10275, + serialized_start=11225, + serialized_end=11571, ) @@ -3166,8 +3581,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=10433, - serialized_end=10518, + serialized_start=11729, + serialized_end=11814, ) _WAITFORSTATETRANSITIONRESULTREQUEST = _descriptor.Descriptor( @@ -3202,8 +3617,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10278, - serialized_end=10529, + serialized_start=11574, + serialized_end=11825, ) @@ -3253,8 +3668,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10691, - serialized_end=10930, + serialized_start=11987, + serialized_end=12226, ) _WAITFORSTATETRANSITIONRESULTRESPONSE = _descriptor.Descriptor( @@ -3289,8 +3704,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10532, - serialized_end=10941, + serialized_start=11828, + serialized_end=12237, ) @@ -3328,8 +3743,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11069, - serialized_end=11129, + serialized_start=12365, + serialized_end=12425, ) _GETCONSENSUSPARAMSREQUEST = _descriptor.Descriptor( @@ -3364,8 +3779,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10944, - serialized_end=11140, + serialized_start=12240, + serialized_end=12436, ) @@ -3410,8 +3825,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11271, - serialized_end=11351, + serialized_start=12567, + serialized_end=12647, ) _GETCONSENSUSPARAMSRESPONSE_CONSENSUSPARAMSEVIDENCE = _descriptor.Descriptor( @@ -3455,8 +3870,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11353, - serialized_end=11451, + serialized_start=12649, + serialized_end=12747, ) _GETCONSENSUSPARAMSRESPONSE_GETCONSENSUSPARAMSRESPONSEV0 = _descriptor.Descriptor( @@ -3493,8 +3908,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11454, - serialized_end=11672, + serialized_start=12750, + serialized_end=12968, ) _GETCONSENSUSPARAMSRESPONSE = _descriptor.Descriptor( @@ -3529,8 +3944,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=11143, - serialized_end=11683, + serialized_start=12439, + serialized_end=12979, ) @@ -3561,8 +3976,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11847, - serialized_end=11903, + serialized_start=13143, + serialized_end=13199, ) _GETPROTOCOLVERSIONUPGRADESTATEREQUEST = _descriptor.Descriptor( @@ -3597,8 +4012,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=11686, - serialized_end=11914, + serialized_start=12982, + serialized_end=13210, ) @@ -3629,8 +4044,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=12379, - serialized_end=12529, + serialized_start=13675, + serialized_end=13825, ) _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0_VERSIONENTRY = _descriptor.Descriptor( @@ -3667,8 +4082,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=12531, - serialized_end=12589, + serialized_start=13827, + serialized_end=13885, ) _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0 = _descriptor.Descriptor( @@ -3717,8 +4132,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=12082, - serialized_end=12599, + serialized_start=13378, + serialized_end=13895, ) _GETPROTOCOLVERSIONUPGRADESTATERESPONSE = _descriptor.Descriptor( @@ -3753,8 +4168,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=11917, - serialized_end=12610, + serialized_start=13213, + serialized_end=13906, ) @@ -3799,8 +4214,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=12790, - serialized_end=12893, + serialized_start=14086, + serialized_end=14189, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST = _descriptor.Descriptor( @@ -3835,8 +4250,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=12613, - serialized_end=12904, + serialized_start=13909, + serialized_end=14200, ) @@ -3867,8 +4282,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=13407, - serialized_end=13582, + serialized_start=14703, + serialized_end=14878, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0_VERSIONSIGNAL = _descriptor.Descriptor( @@ -3905,8 +4320,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=13584, - serialized_end=13637, + serialized_start=14880, + serialized_end=14933, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0 = _descriptor.Descriptor( @@ -3955,8 +4370,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=13088, - serialized_end=13647, + serialized_start=14384, + serialized_end=14943, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE = _descriptor.Descriptor( @@ -3991,8 +4406,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=12907, - serialized_end=13658, + serialized_start=14203, + serialized_end=14954, ) @@ -4044,8 +4459,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=13771, - serialized_end=13895, + serialized_start=15067, + serialized_end=15191, ) _GETEPOCHSINFOREQUEST = _descriptor.Descriptor( @@ -4080,8 +4495,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=13661, - serialized_end=13906, + serialized_start=14957, + serialized_end=15202, ) @@ -4112,8 +4527,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=14267, - serialized_end=14384, + serialized_start=15563, + serialized_end=15680, ) _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFO = _descriptor.Descriptor( @@ -4159,6 +4574,13 @@ message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='protocol_version', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.protocol_version', index=5, + number=6, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -4171,8 +4593,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=14387, - serialized_end=14519, + serialized_start=15683, + serialized_end=15841, ) _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0 = _descriptor.Descriptor( @@ -4221,8 +4643,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=14023, - serialized_end=14529, + serialized_start=15319, + serialized_end=15851, ) _GETEPOCHSINFORESPONSE = _descriptor.Descriptor( @@ -4257,107 +4679,2406 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=13909, - serialized_end=14540, + serialized_start=15205, + serialized_end=15862, ) -_GETIDENTITYREQUEST_GETIDENTITYREQUESTV0.containing_type = _GETIDENTITYREQUEST -_GETIDENTITYREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYREQUEST_GETIDENTITYREQUESTV0 -_GETIDENTITYREQUEST.oneofs_by_name['version'].fields.append( - _GETIDENTITYREQUEST.fields_by_name['v0']) -_GETIDENTITYREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYREQUEST.oneofs_by_name['version'] -_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0.containing_type = _GETIDENTITYBALANCEREQUEST -_GETIDENTITYBALANCEREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0 -_GETIDENTITYBALANCEREQUEST.oneofs_by_name['version'].fields.append( - _GETIDENTITYBALANCEREQUEST.fields_by_name['v0']) -_GETIDENTITYBALANCEREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCEREQUEST.oneofs_by_name['version'] -_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0.containing_type = _GETIDENTITYBALANCEANDREVISIONREQUEST -_GETIDENTITYBALANCEANDREVISIONREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0 -_GETIDENTITYBALANCEANDREVISIONREQUEST.oneofs_by_name['version'].fields.append( - _GETIDENTITYBALANCEANDREVISIONREQUEST.fields_by_name['v0']) -_GETIDENTITYBALANCEANDREVISIONREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONREQUEST.oneofs_by_name['version'] -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['proof'].message_type = _PROOF -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.containing_type = _GETIDENTITYRESPONSE -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['identity']) -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['identity'].containing_oneof = _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['proof']) -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITYRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0 -_GETIDENTITYRESPONSE.oneofs_by_name['version'].fields.append( - _GETIDENTITYRESPONSE.fields_by_name['v0']) -_GETIDENTITYRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYRESPONSE.oneofs_by_name['version'] -_GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0.containing_type = _GETIDENTITIESREQUEST -_GETIDENTITIESREQUEST.fields_by_name['v0'].message_type = _GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0 -_GETIDENTITIESREQUEST.oneofs_by_name['version'].fields.append( - _GETIDENTITIESREQUEST.fields_by_name['v0']) -_GETIDENTITIESREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITIESREQUEST.oneofs_by_name['version'] -_GETIDENTITIESRESPONSE_IDENTITYVALUE.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_IDENTITYENTRY.fields_by_name['value'].message_type = _GETIDENTITIESRESPONSE_IDENTITYVALUE -_GETIDENTITIESRESPONSE_IDENTITYENTRY.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_IDENTITIES.fields_by_name['identity_entries'].message_type = _GETIDENTITIESRESPONSE_IDENTITYENTRY -_GETIDENTITIESRESPONSE_IDENTITIES.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['identities'].message_type = _GETIDENTITIESRESPONSE_IDENTITIES -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['proof'].message_type = _PROOF -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['identities']) -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['identities'].containing_oneof = _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['proof']) -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0 -_GETIDENTITIESRESPONSE.oneofs_by_name['version'].fields.append( - _GETIDENTITIESRESPONSE.fields_by_name['v0']) -_GETIDENTITIESRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITIESRESPONSE.oneofs_by_name['version'] -_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF -_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA -_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.containing_type = _GETIDENTITYBALANCERESPONSE -_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['balance']) -_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['balance'].containing_oneof = _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'] -_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['proof']) -_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'] -_GETIDENTITYBALANCERESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0 -_GETIDENTITYBALANCERESPONSE.oneofs_by_name['version'].fields.append( - _GETIDENTITYBALANCERESPONSE.fields_by_name['v0']) -_GETIDENTITYBALANCERESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCERESPONSE.oneofs_by_name['version'] -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0_BALANCEANDREVISION.containing_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0 -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['balance_and_revision'].message_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0_BALANCEANDREVISION -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['proof'].message_type = _PROOF -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.containing_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['balance_and_revision']) -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['balance_and_revision'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['proof']) -_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITYBALANCEANDREVISIONRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0 -_GETIDENTITYBALANCEANDREVISIONRESPONSE.oneofs_by_name['version'].fields.append( - _GETIDENTITYBALANCEANDREVISIONRESPONSE.fields_by_name['v0']) -_GETIDENTITYBALANCEANDREVISIONRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONRESPONSE.oneofs_by_name['version'] -_KEYREQUESTTYPE.fields_by_name['all_keys'].message_type = _ALLKEYS -_KEYREQUESTTYPE.fields_by_name['specific_keys'].message_type = _SPECIFICKEYS -_KEYREQUESTTYPE.fields_by_name['search_key'].message_type = _SEARCHKEY -_KEYREQUESTTYPE.oneofs_by_name['request'].fields.append( - _KEYREQUESTTYPE.fields_by_name['all_keys']) -_KEYREQUESTTYPE.fields_by_name['all_keys'].containing_oneof = _KEYREQUESTTYPE.oneofs_by_name['request'] -_KEYREQUESTTYPE.oneofs_by_name['request'].fields.append( - _KEYREQUESTTYPE.fields_by_name['specific_keys']) -_KEYREQUESTTYPE.fields_by_name['specific_keys'].containing_oneof = _KEYREQUESTTYPE.oneofs_by_name['request'] -_KEYREQUESTTYPE.oneofs_by_name['request'].fields.append( - _KEYREQUESTTYPE.fields_by_name['search_key']) -_KEYREQUESTTYPE.fields_by_name['search_key'].containing_oneof = _KEYREQUESTTYPE.oneofs_by_name['request'] -_SEARCHKEY_PURPOSEMAPENTRY.fields_by_name['value'].message_type = _SECURITYLEVELMAP -_SEARCHKEY_PURPOSEMAPENTRY.containing_type = _SEARCHKEY -_SEARCHKEY.fields_by_name['purpose_map'].message_type = _SEARCHKEY_PURPOSEMAPENTRY -_SECURITYLEVELMAP_SECURITYLEVELMAPENTRY.fields_by_name['value'].enum_type = _SECURITYLEVELMAP_KEYKINDREQUESTTYPE -_SECURITYLEVELMAP_SECURITYLEVELMAPENTRY.containing_type = _SECURITYLEVELMAP + +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0_STARTATVALUEINFO = _descriptor.Descriptor( + name='StartAtValueInfo', + full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='start_value', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.start_value', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_value_included', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.start_value_included', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=16357, + serialized_end=16426, +) + +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0 = _descriptor.Descriptor( + name='GetContestedResourcesRequestV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.contract_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type_name', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.document_type_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_name', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.index_name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_index_values', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.start_index_values', index=3, + number=4, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='end_index_values', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.end_index_values', index=4, + number=5, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_at_value_info', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.start_at_value_info', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='count', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.count', index=6, + number=7, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='order_ascending', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.order_ascending', index=7, + number=8, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prove', index=8, + number=9, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0_STARTATVALUEINFO, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_start_at_value_info', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0._start_at_value_info', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_count', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0._count', + index=1, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=16000, + serialized_end=16460, +) + +_GETCONTESTEDRESOURCESREQUEST = _descriptor.Descriptor( + name='GetContestedResourcesRequest', + full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourcesRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=15865, + serialized_end=16471, +) + + +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0_CONTESTEDRESOURCEVALUES = _descriptor.Descriptor( + name='ContestedResourceValues', + full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contested_resource_values', full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.contested_resource_values', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=16913, + serialized_end=16973, +) + +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0 = _descriptor.Descriptor( + name='GetContestedResourcesResponseV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contested_resource_values', full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.contested_resource_values', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0_CONTESTEDRESOURCEVALUES, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=16612, + serialized_end=16983, +) + +_GETCONTESTEDRESOURCESRESPONSE = _descriptor.Descriptor( + name='GetContestedResourcesResponse', + full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourcesResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=16474, + serialized_end=16994, +) + + +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_STARTATTIMEINFO = _descriptor.Descriptor( + name='StartAtTimeInfo', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='start_time_ms', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.start_time_ms', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_time_included', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.start_time_included', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=17507, + serialized_end=17576, +) + +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_ENDATTIMEINFO = _descriptor.Descriptor( + name='EndAtTimeInfo', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='end_time_ms', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.end_time_ms', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='end_time_included', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.end_time_included', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=17578, + serialized_end=17641, +) + +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0 = _descriptor.Descriptor( + name='GetVotePollsByEndDateRequestV0', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='start_time_info', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.start_time_info', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='end_time_info', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.end_time_info', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='limit', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.limit', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='offset', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.offset', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='ascending', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.ascending', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prove', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_STARTATTIMEINFO, _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_ENDATTIMEINFO, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_start_time_info', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0._start_time_info', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_end_time_info', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0._end_time_info', + index=1, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_limit', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0._limit', + index=2, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_offset', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0._offset', + index=3, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=17132, + serialized_end=17700, +) + +_GETVOTEPOLLSBYENDDATEREQUEST = _descriptor.Descriptor( + name='GetVotePollsByEndDateRequest', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=16997, + serialized_end=17711, +) + + +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMP = _descriptor.Descriptor( + name='SerializedVotePollsByTimestamp', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='timestamp', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.timestamp', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='serialized_vote_polls', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serialized_vote_polls', index=1, + number=2, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=18160, + serialized_end=18242, +) + +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMPS = _descriptor.Descriptor( + name='SerializedVotePollsByTimestamps', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='vote_polls_by_timestamps', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.vote_polls_by_timestamps', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_results', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.finished_results', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=18245, + serialized_end=18460, +) + +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0 = _descriptor.Descriptor( + name='GetVotePollsByEndDateResponseV0', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='vote_polls_by_timestamps', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.vote_polls_by_timestamps', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMP, _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMPS, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=17852, + serialized_end=18470, +) + +_GETVOTEPOLLSBYENDDATERESPONSE = _descriptor.Descriptor( + name='GetVotePollsByEndDateResponse', + full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=17714, + serialized_end=18481, +) + + +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_STARTATIDENTIFIERINFO = _descriptor.Descriptor( + name='StartAtIdentifierInfo', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='start_identifier', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.start_identifier', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_identifier_included', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.start_identifier_included', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=19170, + serialized_end=19254, +) + +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0 = _descriptor.Descriptor( + name='GetContestedResourceVoteStateRequestV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.contract_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type_name', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.document_type_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_name', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.index_name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_values', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.index_values', index=3, + number=4, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='result_type', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.result_type', index=4, + number=5, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='allow_include_locked_and_abstaining_vote_tally', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.allow_include_locked_and_abstaining_vote_tally', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_at_identifier_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.start_at_identifier_info', index=6, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='count', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.count', index=7, + number=8, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prove', index=8, + number=9, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_STARTATIDENTIFIERINFO, ], + enum_types=[ + _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_RESULTTYPE, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_start_at_identifier_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0._start_at_identifier_info', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_count', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0._count', + index=1, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=18643, + serialized_end=19368, +) + +_GETCONTESTEDRESOURCEVOTESTATEREQUEST = _descriptor.Descriptor( + name='GetContestedResourceVoteStateRequest', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=18484, + serialized_end=19379, +) + + +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO = _descriptor.Descriptor( + name='FinishedVoteInfo', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='finished_vote_outcome', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.finished_vote_outcome', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='won_by_identity_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.won_by_identity_id', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_at_block_height', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.finished_at_block_height', index=2, + number=3, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_at_core_block_height', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.finished_at_core_block_height', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_at_block_time_ms', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.finished_at_block_time_ms', index=4, + number=5, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_at_epoch', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.finished_at_epoch', index=5, + number=6, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO_FINISHEDVOTEOUTCOME, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_won_by_identity_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo._won_by_identity_id', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=19879, + serialized_end=20345, +) + +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS = _descriptor.Descriptor( + name='ContestedResourceContenders', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contenders', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.contenders', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='abstain_vote_tally', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.abstain_vote_tally', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='lock_vote_tally', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.lock_vote_tally', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_vote_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.finished_vote_info', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_abstain_vote_tally', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders._abstain_vote_tally', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_lock_vote_tally', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders._lock_vote_tally', + index=1, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_finished_vote_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders._finished_vote_info', + index=2, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=20348, + serialized_end=20800, +) + +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER = _descriptor.Descriptor( + name='Contender', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='identifier', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.identifier', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='vote_count', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.vote_count', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.document', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_vote_count', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender._vote_count', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_document', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender._document', + index=1, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=20802, + serialized_end=20909, +) + +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0 = _descriptor.Descriptor( + name='GetContestedResourceVoteStateResponseV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contested_resource_contenders', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.contested_resource_contenders', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO, _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS, _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=19544, + serialized_end=20919, +) + +_GETCONTESTEDRESOURCEVOTESTATERESPONSE = _descriptor.Descriptor( + name='GetContestedResourceVoteStateResponse', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=19382, + serialized_end=20930, +) + + +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0_STARTATIDENTIFIERINFO = _descriptor.Descriptor( + name='StartAtIdentifierInfo', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='start_identifier', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.start_identifier', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_identifier_included', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.start_identifier_included', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=19170, + serialized_end=19254, +) + +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0 = _descriptor.Descriptor( + name='GetContestedResourceVotersForIdentityRequestV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.contract_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type_name', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.document_type_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_name', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.index_name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_values', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.index_values', index=3, + number=4, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='contestant_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.contestant_id', index=4, + number=5, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_at_identifier_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.start_at_identifier_info', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='count', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.count', index=6, + number=7, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='order_ascending', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.order_ascending', index=7, + number=8, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prove', index=8, + number=9, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0_STARTATIDENTIFIERINFO, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_start_at_identifier_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0._start_at_identifier_info', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + _descriptor.OneofDescriptor( + name='_count', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0._count', + index=1, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=21117, + serialized_end=21647, +) + +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST = _descriptor.Descriptor( + name='GetContestedResourceVotersForIdentityRequest', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=20933, + serialized_end=21658, +) + + +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0_CONTESTEDRESOURCEVOTERS = _descriptor.Descriptor( + name='ContestedResourceVoters', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='voters', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.voters', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_results', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.finished_results', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=22198, + serialized_end=22265, +) + +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0 = _descriptor.Descriptor( + name='GetContestedResourceVotersForIdentityResponseV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contested_resource_voters', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.contested_resource_voters', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0_CONTESTEDRESOURCEVOTERS, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=21848, + serialized_end=22275, +) + +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE = _descriptor.Descriptor( + name='GetContestedResourceVotersForIdentityResponse', + full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=21661, + serialized_end=22286, +) + + +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0_STARTATVOTEPOLLIDINFO = _descriptor.Descriptor( + name='StartAtVotePollIdInfo', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='start_at_poll_identifier', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.start_at_poll_identifier', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_poll_identifier_included', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.start_poll_identifier_included', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=22835, + serialized_end=22932, +) + +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0 = _descriptor.Descriptor( + name='GetContestedResourceIdentityVotesRequestV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='identity_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.identity_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='limit', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.limit', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='offset', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.offset', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='order_ascending', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.order_ascending', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_at_vote_poll_id_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.start_at_vote_poll_id_info', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prove', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0_STARTATVOTEPOLLIDINFO, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_start_at_vote_poll_id_info', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0._start_at_vote_poll_id_info', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=22460, + serialized_end=22963, +) + +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST = _descriptor.Descriptor( + name='GetContestedResourceIdentityVotesRequest', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=22289, + serialized_end=22974, +) + + +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTES = _descriptor.Descriptor( + name='ContestedResourceIdentityVotes', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contested_resource_identity_votes', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.contested_resource_identity_votes', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='finished_results', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.finished_results', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=23477, + serialized_end=23724, +) + +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE = _descriptor.Descriptor( + name='ResourceVoteChoice', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='vote_choice_type', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.vote_choice_type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='identity_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.identity_id', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE_VOTECHOICETYPE, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_identity_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice._identity_id', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=23727, + serialized_end=24028, +) + +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTE = _descriptor.Descriptor( + name='ContestedResourceIdentityVote', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.contract_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type_name', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.document_type_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='serialized_index_storage_values', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serialized_index_storage_values', index=2, + number=3, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='vote_choice', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.vote_choice', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=24031, + serialized_end=24308, +) + +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0 = _descriptor.Descriptor( + name='GetContestedResourceIdentityVotesResponseV0', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='votes', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.votes', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTES, _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE, _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTE, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=23151, + serialized_end=24318, +) + +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE = _descriptor.Descriptor( + name='GetContestedResourceIdentityVotesResponse', + full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=22977, + serialized_end=24329, +) + + +_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST_GETPREFUNDEDSPECIALIZEDBALANCEREQUESTV0 = _descriptor.Descriptor( + name='GetPrefundedSpecializedBalanceRequestV0', + full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prove', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=24493, + serialized_end=24561, +) + +_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST = _descriptor.Descriptor( + name='GetPrefundedSpecializedBalanceRequest', + full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST_GETPREFUNDEDSPECIALIZEDBALANCEREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=24332, + serialized_end=24572, +) + + +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0 = _descriptor.Descriptor( + name='GetPrefundedSpecializedBalanceResponseV0', + full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='balance', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.balance', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=24740, + serialized_end=24925, +) + +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE = _descriptor.Descriptor( + name='GetPrefundedSpecializedBalanceResponse', + full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=24575, + serialized_end=24936, +) + + +_GETTOTALCREDITSINPLATFORMREQUEST_GETTOTALCREDITSINPLATFORMREQUESTV0 = _descriptor.Descriptor( + name='GetTotalCreditsInPlatformRequestV0', + full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prove', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=25085, + serialized_end=25136, +) + +_GETTOTALCREDITSINPLATFORMREQUEST = _descriptor.Descriptor( + name='GetTotalCreditsInPlatformRequest', + full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETTOTALCREDITSINPLATFORMREQUEST_GETTOTALCREDITSINPLATFORMREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=24939, + serialized_end=25147, +) + + +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0 = _descriptor.Descriptor( + name='GetTotalCreditsInPlatformResponseV0', + full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='credits', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.credits', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=25300, + serialized_end=25480, +) + +_GETTOTALCREDITSINPLATFORMRESPONSE = _descriptor.Descriptor( + name='GetTotalCreditsInPlatformResponse', + full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=25150, + serialized_end=25491, +) + + +_GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0 = _descriptor.Descriptor( + name='GetPathElementsRequestV0', + full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='path', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.path', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='keys', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.keys', index=1, + number=2, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prove', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=25610, + serialized_end=25679, +) + +_GETPATHELEMENTSREQUEST = _descriptor.Descriptor( + name='GetPathElementsRequest', + full_name='org.dash.platform.dapi.v0.GetPathElementsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=25494, + serialized_end=25690, +) + + +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS = _descriptor.Descriptor( + name='Elements', + full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='elements', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.elements', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=26063, + serialized_end=26091, +) + +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0 = _descriptor.Descriptor( + name='GetPathElementsResponseV0', + full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='elements', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.elements', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=25813, + serialized_end=26101, +) + +_GETPATHELEMENTSRESPONSE = _descriptor.Descriptor( + name='GetPathElementsResponse', + full_name='org.dash.platform.dapi.v0.GetPathElementsResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=25693, + serialized_end=26112, +) + +_GETIDENTITYREQUEST_GETIDENTITYREQUESTV0.containing_type = _GETIDENTITYREQUEST +_GETIDENTITYREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYREQUEST_GETIDENTITYREQUESTV0 +_GETIDENTITYREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITYREQUEST.fields_by_name['v0']) +_GETIDENTITYREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYREQUEST.oneofs_by_name['version'] +_GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0.containing_type = _GETIDENTITYNONCEREQUEST +_GETIDENTITYNONCEREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0 +_GETIDENTITYNONCEREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITYNONCEREQUEST.fields_by_name['v0']) +_GETIDENTITYNONCEREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYNONCEREQUEST.oneofs_by_name['version'] +_GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0.containing_type = _GETIDENTITYCONTRACTNONCEREQUEST +_GETIDENTITYCONTRACTNONCEREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0 +_GETIDENTITYCONTRACTNONCEREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITYCONTRACTNONCEREQUEST.fields_by_name['v0']) +_GETIDENTITYCONTRACTNONCEREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYCONTRACTNONCEREQUEST.oneofs_by_name['version'] +_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0.containing_type = _GETIDENTITYBALANCEREQUEST +_GETIDENTITYBALANCEREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0 +_GETIDENTITYBALANCEREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITYBALANCEREQUEST.fields_by_name['v0']) +_GETIDENTITYBALANCEREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCEREQUEST.oneofs_by_name['version'] +_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0.containing_type = _GETIDENTITYBALANCEANDREVISIONREQUEST +_GETIDENTITYBALANCEANDREVISIONREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0 +_GETIDENTITYBALANCEANDREVISIONREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITYBALANCEANDREVISIONREQUEST.fields_by_name['v0']) +_GETIDENTITYBALANCEANDREVISIONREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONREQUEST.oneofs_by_name['version'] +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.containing_type = _GETIDENTITYRESPONSE +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['identity']) +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['identity'].containing_oneof = _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['proof']) +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0 +_GETIDENTITYRESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITYRESPONSE.fields_by_name['v0']) +_GETIDENTITYRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYRESPONSE.oneofs_by_name['version'] +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.containing_type = _GETIDENTITYNONCERESPONSE +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['identity_nonce']) +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['identity_nonce'].containing_oneof = _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['proof']) +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYNONCERESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0 +_GETIDENTITYNONCERESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITYNONCERESPONSE.fields_by_name['v0']) +_GETIDENTITYNONCERESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYNONCERESPONSE.oneofs_by_name['version'] +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.containing_type = _GETIDENTITYCONTRACTNONCERESPONSE +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['identity_contract_nonce']) +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['identity_contract_nonce'].containing_oneof = _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['proof']) +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYCONTRACTNONCERESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0 +_GETIDENTITYCONTRACTNONCERESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITYCONTRACTNONCERESPONSE.fields_by_name['v0']) +_GETIDENTITYCONTRACTNONCERESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYCONTRACTNONCERESPONSE.oneofs_by_name['version'] +_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.containing_type = _GETIDENTITYBALANCERESPONSE +_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['balance']) +_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['balance'].containing_oneof = _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['proof']) +_GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYBALANCERESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0 +_GETIDENTITYBALANCERESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITYBALANCERESPONSE.fields_by_name['v0']) +_GETIDENTITYBALANCERESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCERESPONSE.oneofs_by_name['version'] +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0_BALANCEANDREVISION.containing_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0 +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['balance_and_revision'].message_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0_BALANCEANDREVISION +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.containing_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['balance_and_revision']) +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['balance_and_revision'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['proof']) +_GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYBALANCEANDREVISIONRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0 +_GETIDENTITYBALANCEANDREVISIONRESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITYBALANCEANDREVISIONRESPONSE.fields_by_name['v0']) +_GETIDENTITYBALANCEANDREVISIONRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYBALANCEANDREVISIONRESPONSE.oneofs_by_name['version'] +_KEYREQUESTTYPE.fields_by_name['all_keys'].message_type = _ALLKEYS +_KEYREQUESTTYPE.fields_by_name['specific_keys'].message_type = _SPECIFICKEYS +_KEYREQUESTTYPE.fields_by_name['search_key'].message_type = _SEARCHKEY +_KEYREQUESTTYPE.oneofs_by_name['request'].fields.append( + _KEYREQUESTTYPE.fields_by_name['all_keys']) +_KEYREQUESTTYPE.fields_by_name['all_keys'].containing_oneof = _KEYREQUESTTYPE.oneofs_by_name['request'] +_KEYREQUESTTYPE.oneofs_by_name['request'].fields.append( + _KEYREQUESTTYPE.fields_by_name['specific_keys']) +_KEYREQUESTTYPE.fields_by_name['specific_keys'].containing_oneof = _KEYREQUESTTYPE.oneofs_by_name['request'] +_KEYREQUESTTYPE.oneofs_by_name['request'].fields.append( + _KEYREQUESTTYPE.fields_by_name['search_key']) +_KEYREQUESTTYPE.fields_by_name['search_key'].containing_oneof = _KEYREQUESTTYPE.oneofs_by_name['request'] +_SEARCHKEY_PURPOSEMAPENTRY.fields_by_name['value'].message_type = _SECURITYLEVELMAP +_SEARCHKEY_PURPOSEMAPENTRY.containing_type = _SEARCHKEY +_SEARCHKEY.fields_by_name['purpose_map'].message_type = _SEARCHKEY_PURPOSEMAPENTRY +_SECURITYLEVELMAP_SECURITYLEVELMAPENTRY.fields_by_name['value'].enum_type = _SECURITYLEVELMAP_KEYKINDREQUESTTYPE +_SECURITYLEVELMAP_SECURITYLEVELMAPENTRY.containing_type = _SECURITYLEVELMAP _SECURITYLEVELMAP.fields_by_name['security_level_map'].message_type = _SECURITYLEVELMAP_SECURITYLEVELMAPENTRY _SECURITYLEVELMAP_KEYKINDREQUESTTYPE.containing_type = _SECURITYLEVELMAP _GETIDENTITYKEYSREQUEST_GETIDENTITYKEYSREQUESTV0.fields_by_name['request_type'].message_type = _KEYREQUESTTYPE @@ -4383,14 +7104,52 @@ _GETIDENTITYKEYSRESPONSE.oneofs_by_name['version'].fields.append( _GETIDENTITYKEYSRESPONSE.fields_by_name['v0']) _GETIDENTITYKEYSRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYKEYSRESPONSE.oneofs_by_name['version'] +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.fields_by_name['purposes'].enum_type = _KEYPURPOSE +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.containing_type = _GETIDENTITIESCONTRACTKEYSREQUEST +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.oneofs_by_name['_document_type_name'].fields.append( + _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.fields_by_name['document_type_name']) +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.fields_by_name['document_type_name'].containing_oneof = _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.oneofs_by_name['_document_type_name'] +_GETIDENTITIESCONTRACTKEYSREQUEST.fields_by_name['v0'].message_type = _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0 +_GETIDENTITIESCONTRACTKEYSREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITIESCONTRACTKEYSREQUEST.fields_by_name['v0']) +_GETIDENTITIESCONTRACTKEYSREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITIESCONTRACTKEYSREQUEST.oneofs_by_name['version'] +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS.fields_by_name['purpose'].enum_type = _KEYPURPOSE +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS.fields_by_name['keys'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS.fields_by_name['entries'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['identities_keys'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['identities_keys']) +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['identities_keys'].containing_oneof = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['proof']) +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITIESCONTRACTKEYSRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITIESCONTRACTKEYSRESPONSE.fields_by_name['v0']) +_GETIDENTITIESCONTRACTKEYSRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITIESCONTRACTKEYSRESPONSE.oneofs_by_name['version'] +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST.fields_by_name['document_contested_status'].enum_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST_DOCUMENTCONTESTEDSTATUS _GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0 +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST_DOCUMENTCONTESTEDSTATUS.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST.fields_by_name['request_type'].enum_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0 _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST _GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0 +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST_CONTESTEDRESOURCEVOTESTATUSREQUEST.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST.fields_by_name['contested_resource_vote_status_request'].message_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST_CONTESTEDRESOURCEVOTESTATUSREQUEST +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0 +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST.oneofs_by_name['request_type'].fields.append( + _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST.fields_by_name['contested_resource_vote_status_request']) +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST.fields_by_name['contested_resource_vote_status_request'].containing_oneof = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST.oneofs_by_name['request_type'] _GETPROOFSREQUEST_GETPROOFSREQUESTV0.fields_by_name['identities'].message_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST _GETPROOFSREQUEST_GETPROOFSREQUESTV0.fields_by_name['contracts'].message_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST _GETPROOFSREQUEST_GETPROOFSREQUESTV0.fields_by_name['documents'].message_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST +_GETPROOFSREQUEST_GETPROOFSREQUESTV0.fields_by_name['votes'].message_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST _GETPROOFSREQUEST_GETPROOFSREQUESTV0.containing_type = _GETPROOFSREQUEST _GETPROOFSREQUEST.fields_by_name['v0'].message_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0 _GETPROOFSREQUEST.oneofs_by_name['version'].fields.append( @@ -4497,29 +7256,6 @@ _GETDOCUMENTSRESPONSE.oneofs_by_name['version'].fields.append( _GETDOCUMENTSRESPONSE.fields_by_name['v0']) _GETDOCUMENTSRESPONSE.fields_by_name['v0'].containing_oneof = _GETDOCUMENTSRESPONSE.oneofs_by_name['version'] -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST.fields_by_name['v0'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0 -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST.oneofs_by_name['version'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESREQUEST.fields_by_name['v0']) -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST.oneofs_by_name['version'] -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY.fields_by_name['value'].message_type = google_dot_protobuf_dot_wrappers__pb2._BYTESVALUE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES.fields_by_name['identity_entries'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['identities'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['proof'].message_type = _PROOF -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['identities']) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['identities'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['proof']) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0 -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.oneofs_by_name['version'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.fields_by_name['v0']) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.oneofs_by_name['version'] _GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0.containing_type = _GETIDENTITYBYPUBLICKEYHASHREQUEST _GETIDENTITYBYPUBLICKEYHASHREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0 _GETIDENTITYBYPUBLICKEYHASHREQUEST.oneofs_by_name['version'].fields.append( @@ -4638,17 +7374,259 @@ _GETEPOCHSINFORESPONSE.oneofs_by_name['version'].fields.append( _GETEPOCHSINFORESPONSE.fields_by_name['v0']) _GETEPOCHSINFORESPONSE.fields_by_name['v0'].containing_oneof = _GETEPOCHSINFORESPONSE.oneofs_by_name['version'] +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0_STARTATVALUEINFO.containing_type = _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0 +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.fields_by_name['start_at_value_info'].message_type = _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0_STARTATVALUEINFO +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.containing_type = _GETCONTESTEDRESOURCESREQUEST +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.oneofs_by_name['_start_at_value_info'].fields.append( + _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.fields_by_name['start_at_value_info']) +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.fields_by_name['start_at_value_info'].containing_oneof = _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.oneofs_by_name['_start_at_value_info'] +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.oneofs_by_name['_count'].fields.append( + _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.fields_by_name['count']) +_GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.fields_by_name['count'].containing_oneof = _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0.oneofs_by_name['_count'] +_GETCONTESTEDRESOURCESREQUEST.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0 +_GETCONTESTEDRESOURCESREQUEST.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCESREQUEST.fields_by_name['v0']) +_GETCONTESTEDRESOURCESREQUEST.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCESREQUEST.oneofs_by_name['version'] +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0_CONTESTEDRESOURCEVALUES.containing_type = _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0 +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.fields_by_name['contested_resource_values'].message_type = _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0_CONTESTEDRESOURCEVALUES +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.containing_type = _GETCONTESTEDRESOURCESRESPONSE +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.fields_by_name['contested_resource_values']) +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.fields_by_name['contested_resource_values'].containing_oneof = _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.fields_by_name['proof']) +_GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCESRESPONSE.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0 +_GETCONTESTEDRESOURCESRESPONSE.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCESRESPONSE.fields_by_name['v0']) +_GETCONTESTEDRESOURCESRESPONSE.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCESRESPONSE.oneofs_by_name['version'] +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_STARTATTIMEINFO.containing_type = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0 +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_ENDATTIMEINFO.containing_type = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0 +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['start_time_info'].message_type = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_STARTATTIMEINFO +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['end_time_info'].message_type = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_ENDATTIMEINFO +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.containing_type = _GETVOTEPOLLSBYENDDATEREQUEST +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_start_time_info'].fields.append( + _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['start_time_info']) +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['start_time_info'].containing_oneof = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_start_time_info'] +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_end_time_info'].fields.append( + _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['end_time_info']) +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['end_time_info'].containing_oneof = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_end_time_info'] +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_limit'].fields.append( + _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['limit']) +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['limit'].containing_oneof = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_limit'] +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_offset'].fields.append( + _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['offset']) +_GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.fields_by_name['offset'].containing_oneof = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0.oneofs_by_name['_offset'] +_GETVOTEPOLLSBYENDDATEREQUEST.fields_by_name['v0'].message_type = _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0 +_GETVOTEPOLLSBYENDDATEREQUEST.oneofs_by_name['version'].fields.append( + _GETVOTEPOLLSBYENDDATEREQUEST.fields_by_name['v0']) +_GETVOTEPOLLSBYENDDATEREQUEST.fields_by_name['v0'].containing_oneof = _GETVOTEPOLLSBYENDDATEREQUEST.oneofs_by_name['version'] +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMP.containing_type = _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0 +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMPS.fields_by_name['vote_polls_by_timestamps'].message_type = _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMP +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMPS.containing_type = _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0 +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.fields_by_name['vote_polls_by_timestamps'].message_type = _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMPS +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.containing_type = _GETVOTEPOLLSBYENDDATERESPONSE +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.fields_by_name['vote_polls_by_timestamps']) +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.fields_by_name['vote_polls_by_timestamps'].containing_oneof = _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.oneofs_by_name['result'] +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.fields_by_name['proof']) +_GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0.oneofs_by_name['result'] +_GETVOTEPOLLSBYENDDATERESPONSE.fields_by_name['v0'].message_type = _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0 +_GETVOTEPOLLSBYENDDATERESPONSE.oneofs_by_name['version'].fields.append( + _GETVOTEPOLLSBYENDDATERESPONSE.fields_by_name['v0']) +_GETVOTEPOLLSBYENDDATERESPONSE.fields_by_name['v0'].containing_oneof = _GETVOTEPOLLSBYENDDATERESPONSE.oneofs_by_name['version'] +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_STARTATIDENTIFIERINFO.containing_type = _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0 +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.fields_by_name['result_type'].enum_type = _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_RESULTTYPE +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.fields_by_name['start_at_identifier_info'].message_type = _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_STARTATIDENTIFIERINFO +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.containing_type = _GETCONTESTEDRESOURCEVOTESTATEREQUEST +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_RESULTTYPE.containing_type = _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0 +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.oneofs_by_name['_start_at_identifier_info'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.fields_by_name['start_at_identifier_info']) +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.fields_by_name['start_at_identifier_info'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.oneofs_by_name['_start_at_identifier_info'] +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.oneofs_by_name['_count'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.fields_by_name['count']) +_GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.fields_by_name['count'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0.oneofs_by_name['_count'] +_GETCONTESTEDRESOURCEVOTESTATEREQUEST.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0 +_GETCONTESTEDRESOURCEVOTESTATEREQUEST.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATEREQUEST.fields_by_name['v0']) +_GETCONTESTEDRESOURCEVOTESTATEREQUEST.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATEREQUEST.oneofs_by_name['version'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO.fields_by_name['finished_vote_outcome'].enum_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO_FINISHEDVOTEOUTCOME +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO.containing_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0 +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO_FINISHEDVOTEOUTCOME.containing_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO.oneofs_by_name['_won_by_identity_id'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO.fields_by_name['won_by_identity_id']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO.fields_by_name['won_by_identity_id'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO.oneofs_by_name['_won_by_identity_id'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['contenders'].message_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['finished_vote_info'].message_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.containing_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0 +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.oneofs_by_name['_abstain_vote_tally'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['abstain_vote_tally']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['abstain_vote_tally'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.oneofs_by_name['_abstain_vote_tally'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.oneofs_by_name['_lock_vote_tally'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['lock_vote_tally']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['lock_vote_tally'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.oneofs_by_name['_lock_vote_tally'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.oneofs_by_name['_finished_vote_info'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['finished_vote_info']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.fields_by_name['finished_vote_info'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS.oneofs_by_name['_finished_vote_info'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.containing_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0 +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.oneofs_by_name['_vote_count'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.fields_by_name['vote_count']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.fields_by_name['vote_count'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.oneofs_by_name['_vote_count'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.oneofs_by_name['_document'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.fields_by_name['document']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.fields_by_name['document'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER.oneofs_by_name['_document'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.fields_by_name['contested_resource_contenders'].message_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.containing_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.fields_by_name['contested_resource_contenders']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.fields_by_name['contested_resource_contenders'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.fields_by_name['proof']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCEVOTESTATERESPONSE.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0 +_GETCONTESTEDRESOURCEVOTESTATERESPONSE.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCEVOTESTATERESPONSE.fields_by_name['v0']) +_GETCONTESTEDRESOURCEVOTESTATERESPONSE.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCEVOTESTATERESPONSE.oneofs_by_name['version'] +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0_STARTATIDENTIFIERINFO.containing_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0 +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.fields_by_name['start_at_identifier_info'].message_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0_STARTATIDENTIFIERINFO +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.containing_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.oneofs_by_name['_start_at_identifier_info'].fields.append( + _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.fields_by_name['start_at_identifier_info']) +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.fields_by_name['start_at_identifier_info'].containing_oneof = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.oneofs_by_name['_start_at_identifier_info'] +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.oneofs_by_name['_count'].fields.append( + _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.fields_by_name['count']) +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.fields_by_name['count'].containing_oneof = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0.oneofs_by_name['_count'] +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0 +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST.fields_by_name['v0']) +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST.oneofs_by_name['version'] +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0_CONTESTEDRESOURCEVOTERS.containing_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0 +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.fields_by_name['contested_resource_voters'].message_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0_CONTESTEDRESOURCEVOTERS +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.containing_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.fields_by_name['contested_resource_voters']) +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.fields_by_name['contested_resource_voters'].containing_oneof = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.fields_by_name['proof']) +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0 +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE.fields_by_name['v0']) +_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE.oneofs_by_name['version'] +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0_STARTATVOTEPOLLIDINFO.containing_type = _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0 +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.fields_by_name['limit'].message_type = google_dot_protobuf_dot_wrappers__pb2._UINT32VALUE +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.fields_by_name['offset'].message_type = google_dot_protobuf_dot_wrappers__pb2._UINT32VALUE +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.fields_by_name['start_at_vote_poll_id_info'].message_type = _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0_STARTATVOTEPOLLIDINFO +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.containing_type = _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.oneofs_by_name['_start_at_vote_poll_id_info'].fields.append( + _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.fields_by_name['start_at_vote_poll_id_info']) +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.fields_by_name['start_at_vote_poll_id_info'].containing_oneof = _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0.oneofs_by_name['_start_at_vote_poll_id_info'] +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0 +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST.fields_by_name['v0']) +_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST.oneofs_by_name['version'] +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTES.fields_by_name['contested_resource_identity_votes'].message_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTE +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTES.containing_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0 +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE.fields_by_name['vote_choice_type'].enum_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE_VOTECHOICETYPE +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE.containing_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0 +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE_VOTECHOICETYPE.containing_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE.oneofs_by_name['_identity_id'].fields.append( + _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE.fields_by_name['identity_id']) +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE.fields_by_name['identity_id'].containing_oneof = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE.oneofs_by_name['_identity_id'] +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTE.fields_by_name['vote_choice'].message_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTE.containing_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0 +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.fields_by_name['votes'].message_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTES +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.containing_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.fields_by_name['votes']) +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.fields_by_name['votes'].containing_oneof = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.fields_by_name['proof']) +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0.oneofs_by_name['result'] +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE.fields_by_name['v0'].message_type = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0 +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE.oneofs_by_name['version'].fields.append( + _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE.fields_by_name['v0']) +_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE.fields_by_name['v0'].containing_oneof = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE.oneofs_by_name['version'] +_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST_GETPREFUNDEDSPECIALIZEDBALANCEREQUESTV0.containing_type = _GETPREFUNDEDSPECIALIZEDBALANCEREQUEST +_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST.fields_by_name['v0'].message_type = _GETPREFUNDEDSPECIALIZEDBALANCEREQUEST_GETPREFUNDEDSPECIALIZEDBALANCEREQUESTV0 +_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST.oneofs_by_name['version'].fields.append( + _GETPREFUNDEDSPECIALIZEDBALANCEREQUEST.fields_by_name['v0']) +_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST.fields_by_name['v0'].containing_oneof = _GETPREFUNDEDSPECIALIZEDBALANCEREQUEST.oneofs_by_name['version'] +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.containing_type = _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.fields_by_name['balance']) +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.fields_by_name['balance'].containing_oneof = _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.oneofs_by_name['result'] +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.fields_by_name['proof']) +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0.oneofs_by_name['result'] +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE.fields_by_name['v0'].message_type = _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0 +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE.oneofs_by_name['version'].fields.append( + _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE.fields_by_name['v0']) +_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE.fields_by_name['v0'].containing_oneof = _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE.oneofs_by_name['version'] +_GETTOTALCREDITSINPLATFORMREQUEST_GETTOTALCREDITSINPLATFORMREQUESTV0.containing_type = _GETTOTALCREDITSINPLATFORMREQUEST +_GETTOTALCREDITSINPLATFORMREQUEST.fields_by_name['v0'].message_type = _GETTOTALCREDITSINPLATFORMREQUEST_GETTOTALCREDITSINPLATFORMREQUESTV0 +_GETTOTALCREDITSINPLATFORMREQUEST.oneofs_by_name['version'].fields.append( + _GETTOTALCREDITSINPLATFORMREQUEST.fields_by_name['v0']) +_GETTOTALCREDITSINPLATFORMREQUEST.fields_by_name['v0'].containing_oneof = _GETTOTALCREDITSINPLATFORMREQUEST.oneofs_by_name['version'] +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.containing_type = _GETTOTALCREDITSINPLATFORMRESPONSE +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.fields_by_name['credits']) +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.fields_by_name['credits'].containing_oneof = _GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.oneofs_by_name['result'] +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.fields_by_name['proof']) +_GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0.oneofs_by_name['result'] +_GETTOTALCREDITSINPLATFORMRESPONSE.fields_by_name['v0'].message_type = _GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0 +_GETTOTALCREDITSINPLATFORMRESPONSE.oneofs_by_name['version'].fields.append( + _GETTOTALCREDITSINPLATFORMRESPONSE.fields_by_name['v0']) +_GETTOTALCREDITSINPLATFORMRESPONSE.fields_by_name['v0'].containing_oneof = _GETTOTALCREDITSINPLATFORMRESPONSE.oneofs_by_name['version'] +_GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0.containing_type = _GETPATHELEMENTSREQUEST +_GETPATHELEMENTSREQUEST.fields_by_name['v0'].message_type = _GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0 +_GETPATHELEMENTSREQUEST.oneofs_by_name['version'].fields.append( + _GETPATHELEMENTSREQUEST.fields_by_name['v0']) +_GETPATHELEMENTSREQUEST.fields_by_name['v0'].containing_oneof = _GETPATHELEMENTSREQUEST.oneofs_by_name['version'] +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS.containing_type = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0 +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['elements'].message_type = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.containing_type = _GETPATHELEMENTSRESPONSE +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['elements']) +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['elements'].containing_oneof = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'] +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['proof']) +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'] +_GETPATHELEMENTSRESPONSE.fields_by_name['v0'].message_type = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0 +_GETPATHELEMENTSRESPONSE.oneofs_by_name['version'].fields.append( + _GETPATHELEMENTSRESPONSE.fields_by_name['v0']) +_GETPATHELEMENTSRESPONSE.fields_by_name['v0'].containing_oneof = _GETPATHELEMENTSRESPONSE.oneofs_by_name['version'] DESCRIPTOR.message_types_by_name['Proof'] = _PROOF DESCRIPTOR.message_types_by_name['ResponseMetadata'] = _RESPONSEMETADATA DESCRIPTOR.message_types_by_name['StateTransitionBroadcastError'] = _STATETRANSITIONBROADCASTERROR DESCRIPTOR.message_types_by_name['BroadcastStateTransitionRequest'] = _BROADCASTSTATETRANSITIONREQUEST DESCRIPTOR.message_types_by_name['BroadcastStateTransitionResponse'] = _BROADCASTSTATETRANSITIONRESPONSE DESCRIPTOR.message_types_by_name['GetIdentityRequest'] = _GETIDENTITYREQUEST +DESCRIPTOR.message_types_by_name['GetIdentityNonceRequest'] = _GETIDENTITYNONCEREQUEST +DESCRIPTOR.message_types_by_name['GetIdentityContractNonceRequest'] = _GETIDENTITYCONTRACTNONCEREQUEST DESCRIPTOR.message_types_by_name['GetIdentityBalanceRequest'] = _GETIDENTITYBALANCEREQUEST DESCRIPTOR.message_types_by_name['GetIdentityBalanceAndRevisionRequest'] = _GETIDENTITYBALANCEANDREVISIONREQUEST DESCRIPTOR.message_types_by_name['GetIdentityResponse'] = _GETIDENTITYRESPONSE -DESCRIPTOR.message_types_by_name['GetIdentitiesRequest'] = _GETIDENTITIESREQUEST -DESCRIPTOR.message_types_by_name['GetIdentitiesResponse'] = _GETIDENTITIESRESPONSE +DESCRIPTOR.message_types_by_name['GetIdentityNonceResponse'] = _GETIDENTITYNONCERESPONSE +DESCRIPTOR.message_types_by_name['GetIdentityContractNonceResponse'] = _GETIDENTITYCONTRACTNONCERESPONSE DESCRIPTOR.message_types_by_name['GetIdentityBalanceResponse'] = _GETIDENTITYBALANCERESPONSE DESCRIPTOR.message_types_by_name['GetIdentityBalanceAndRevisionResponse'] = _GETIDENTITYBALANCEANDREVISIONRESPONSE DESCRIPTOR.message_types_by_name['KeyRequestType'] = _KEYREQUESTTYPE @@ -4658,6 +7636,8 @@ DESCRIPTOR.message_types_by_name['SecurityLevelMap'] = _SECURITYLEVELMAP DESCRIPTOR.message_types_by_name['GetIdentityKeysRequest'] = _GETIDENTITYKEYSREQUEST DESCRIPTOR.message_types_by_name['GetIdentityKeysResponse'] = _GETIDENTITYKEYSRESPONSE +DESCRIPTOR.message_types_by_name['GetIdentitiesContractKeysRequest'] = _GETIDENTITIESCONTRACTKEYSREQUEST +DESCRIPTOR.message_types_by_name['GetIdentitiesContractKeysResponse'] = _GETIDENTITIESCONTRACTKEYSRESPONSE DESCRIPTOR.message_types_by_name['GetProofsRequest'] = _GETPROOFSREQUEST DESCRIPTOR.message_types_by_name['GetProofsResponse'] = _GETPROOFSRESPONSE DESCRIPTOR.message_types_by_name['GetDataContractRequest'] = _GETDATACONTRACTREQUEST @@ -4668,8 +7648,6 @@ DESCRIPTOR.message_types_by_name['GetDataContractHistoryResponse'] = _GETDATACONTRACTHISTORYRESPONSE DESCRIPTOR.message_types_by_name['GetDocumentsRequest'] = _GETDOCUMENTSREQUEST DESCRIPTOR.message_types_by_name['GetDocumentsResponse'] = _GETDOCUMENTSRESPONSE -DESCRIPTOR.message_types_by_name['GetIdentitiesByPublicKeyHashesRequest'] = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST -DESCRIPTOR.message_types_by_name['GetIdentitiesByPublicKeyHashesResponse'] = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE DESCRIPTOR.message_types_by_name['GetIdentityByPublicKeyHashRequest'] = _GETIDENTITYBYPUBLICKEYHASHREQUEST DESCRIPTOR.message_types_by_name['GetIdentityByPublicKeyHashResponse'] = _GETIDENTITYBYPUBLICKEYHASHRESPONSE DESCRIPTOR.message_types_by_name['WaitForStateTransitionResultRequest'] = _WAITFORSTATETRANSITIONRESULTREQUEST @@ -4682,6 +7660,23 @@ DESCRIPTOR.message_types_by_name['GetProtocolVersionUpgradeVoteStatusResponse'] = _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE DESCRIPTOR.message_types_by_name['GetEpochsInfoRequest'] = _GETEPOCHSINFOREQUEST DESCRIPTOR.message_types_by_name['GetEpochsInfoResponse'] = _GETEPOCHSINFORESPONSE +DESCRIPTOR.message_types_by_name['GetContestedResourcesRequest'] = _GETCONTESTEDRESOURCESREQUEST +DESCRIPTOR.message_types_by_name['GetContestedResourcesResponse'] = _GETCONTESTEDRESOURCESRESPONSE +DESCRIPTOR.message_types_by_name['GetVotePollsByEndDateRequest'] = _GETVOTEPOLLSBYENDDATEREQUEST +DESCRIPTOR.message_types_by_name['GetVotePollsByEndDateResponse'] = _GETVOTEPOLLSBYENDDATERESPONSE +DESCRIPTOR.message_types_by_name['GetContestedResourceVoteStateRequest'] = _GETCONTESTEDRESOURCEVOTESTATEREQUEST +DESCRIPTOR.message_types_by_name['GetContestedResourceVoteStateResponse'] = _GETCONTESTEDRESOURCEVOTESTATERESPONSE +DESCRIPTOR.message_types_by_name['GetContestedResourceVotersForIdentityRequest'] = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST +DESCRIPTOR.message_types_by_name['GetContestedResourceVotersForIdentityResponse'] = _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE +DESCRIPTOR.message_types_by_name['GetContestedResourceIdentityVotesRequest'] = _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST +DESCRIPTOR.message_types_by_name['GetContestedResourceIdentityVotesResponse'] = _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE +DESCRIPTOR.message_types_by_name['GetPrefundedSpecializedBalanceRequest'] = _GETPREFUNDEDSPECIALIZEDBALANCEREQUEST +DESCRIPTOR.message_types_by_name['GetPrefundedSpecializedBalanceResponse'] = _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE +DESCRIPTOR.message_types_by_name['GetTotalCreditsInPlatformRequest'] = _GETTOTALCREDITSINPLATFORMREQUEST +DESCRIPTOR.message_types_by_name['GetTotalCreditsInPlatformResponse'] = _GETTOTALCREDITSINPLATFORMRESPONSE +DESCRIPTOR.message_types_by_name['GetPathElementsRequest'] = _GETPATHELEMENTSREQUEST +DESCRIPTOR.message_types_by_name['GetPathElementsResponse'] = _GETPATHELEMENTSRESPONSE +DESCRIPTOR.enum_types_by_name['KeyPurpose'] = _KEYPURPOSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) Proof = _reflection.GeneratedProtocolMessageType('Proof', (_message.Message,), { @@ -4734,6 +7729,36 @@ _sym_db.RegisterMessage(GetIdentityRequest) _sym_db.RegisterMessage(GetIdentityRequest.GetIdentityRequestV0) +GetIdentityNonceRequest = _reflection.GeneratedProtocolMessageType('GetIdentityNonceRequest', (_message.Message,), { + + 'GetIdentityNonceRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityNonceRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITYNONCEREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceRequest) + }) +_sym_db.RegisterMessage(GetIdentityNonceRequest) +_sym_db.RegisterMessage(GetIdentityNonceRequest.GetIdentityNonceRequestV0) + +GetIdentityContractNonceRequest = _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceRequest', (_message.Message,), { + + 'GetIdentityContractNonceRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCEREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceRequest) + }) +_sym_db.RegisterMessage(GetIdentityContractNonceRequest) +_sym_db.RegisterMessage(GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0) + GetIdentityBalanceRequest = _reflection.GeneratedProtocolMessageType('GetIdentityBalanceRequest', (_message.Message,), { 'GetIdentityBalanceRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityBalanceRequestV0', (_message.Message,), { @@ -4779,59 +7804,35 @@ _sym_db.RegisterMessage(GetIdentityResponse) _sym_db.RegisterMessage(GetIdentityResponse.GetIdentityResponseV0) -GetIdentitiesRequest = _reflection.GeneratedProtocolMessageType('GetIdentitiesRequest', (_message.Message,), { +GetIdentityNonceResponse = _reflection.GeneratedProtocolMessageType('GetIdentityNonceResponse', (_message.Message,), { - 'GetIdentitiesRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0, + 'GetIdentityNonceResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentityNonceResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0) }) , - 'DESCRIPTOR' : _GETIDENTITIESREQUEST, + 'DESCRIPTOR' : _GETIDENTITYNONCERESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceResponse) }) -_sym_db.RegisterMessage(GetIdentitiesRequest) -_sym_db.RegisterMessage(GetIdentitiesRequest.GetIdentitiesRequestV0) - -GetIdentitiesResponse = _reflection.GeneratedProtocolMessageType('GetIdentitiesResponse', (_message.Message,), { - - 'IdentityValue' : _reflection.GeneratedProtocolMessageType('IdentityValue', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_IDENTITYVALUE, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue) - }) - , - - 'IdentityEntry' : _reflection.GeneratedProtocolMessageType('IdentityEntry', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_IDENTITYENTRY, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry) - }) - , +_sym_db.RegisterMessage(GetIdentityNonceResponse) +_sym_db.RegisterMessage(GetIdentityNonceResponse.GetIdentityNonceResponseV0) - 'Identities' : _reflection.GeneratedProtocolMessageType('Identities', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_IDENTITIES, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities) - }) - , +GetIdentityContractNonceResponse = _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceResponse', (_message.Message,), { - 'GetIdentitiesResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0, + 'GetIdentityContractNonceResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0) }) , - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE, + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCERESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceResponse) }) -_sym_db.RegisterMessage(GetIdentitiesResponse) -_sym_db.RegisterMessage(GetIdentitiesResponse.IdentityValue) -_sym_db.RegisterMessage(GetIdentitiesResponse.IdentityEntry) -_sym_db.RegisterMessage(GetIdentitiesResponse.Identities) -_sym_db.RegisterMessage(GetIdentitiesResponse.GetIdentitiesResponseV0) +_sym_db.RegisterMessage(GetIdentityContractNonceResponse) +_sym_db.RegisterMessage(GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0) GetIdentityBalanceResponse = _reflection.GeneratedProtocolMessageType('GetIdentityBalanceResponse', (_message.Message,), { @@ -4960,6 +7961,60 @@ _sym_db.RegisterMessage(GetIdentityKeysResponse.GetIdentityKeysResponseV0) _sym_db.RegisterMessage(GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys) +GetIdentitiesContractKeysRequest = _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysRequest', (_message.Message,), { + + 'GetIdentitiesContractKeysRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest) + }) +_sym_db.RegisterMessage(GetIdentitiesContractKeysRequest) +_sym_db.RegisterMessage(GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0) + +GetIdentitiesContractKeysResponse = _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysResponse', (_message.Message,), { + + 'GetIdentitiesContractKeysResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysResponseV0', (_message.Message,), { + + 'PurposeKeys' : _reflection.GeneratedProtocolMessageType('PurposeKeys', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys) + }) + , + + 'IdentityKeys' : _reflection.GeneratedProtocolMessageType('IdentityKeys', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys) + }) + , + + 'IdentitiesKeys' : _reflection.GeneratedProtocolMessageType('IdentitiesKeys', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys) + }) + , + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse) + }) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys) + GetProofsRequest = _reflection.GeneratedProtocolMessageType('GetProofsRequest', (_message.Message,), { 'GetProofsRequestV0' : _reflection.GeneratedProtocolMessageType('GetProofsRequestV0', (_message.Message,), { @@ -4984,6 +8039,20 @@ # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest) }) , + + 'VoteStatusRequest' : _reflection.GeneratedProtocolMessageType('VoteStatusRequest', (_message.Message,), { + + 'ContestedResourceVoteStatusRequest' : _reflection.GeneratedProtocolMessageType('ContestedResourceVoteStatusRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST_CONTESTEDRESOURCEVOTESTATUSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest) + }) + , + 'DESCRIPTOR' : _GETPROOFSREQUEST_GETPROOFSREQUESTV0_VOTESTATUSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest) + }) + , 'DESCRIPTOR' : _GETPROOFSREQUEST_GETPROOFSREQUESTV0, '__module__' : 'platform_pb2' # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0) @@ -4998,6 +8067,8 @@ _sym_db.RegisterMessage(GetProofsRequest.GetProofsRequestV0.DocumentRequest) _sym_db.RegisterMessage(GetProofsRequest.GetProofsRequestV0.IdentityRequest) _sym_db.RegisterMessage(GetProofsRequest.GetProofsRequestV0.ContractRequest) +_sym_db.RegisterMessage(GetProofsRequest.GetProofsRequestV0.VoteStatusRequest) +_sym_db.RegisterMessage(GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest) GetProofsResponse = _reflection.GeneratedProtocolMessageType('GetProofsResponse', (_message.Message,), { @@ -5016,453 +8087,783 @@ GetDataContractRequest = _reflection.GeneratedProtocolMessageType('GetDataContractRequest', (_message.Message,), { - 'GetDataContractRequestV0' : _reflection.GeneratedProtocolMessageType('GetDataContractRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTREQUEST_GETDATACONTRACTREQUESTV0, + 'GetDataContractRequestV0' : _reflection.GeneratedProtocolMessageType('GetDataContractRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTREQUEST_GETDATACONTRACTREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0) + }) + , + 'DESCRIPTOR' : _GETDATACONTRACTREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractRequest) + }) +_sym_db.RegisterMessage(GetDataContractRequest) +_sym_db.RegisterMessage(GetDataContractRequest.GetDataContractRequestV0) + +GetDataContractResponse = _reflection.GeneratedProtocolMessageType('GetDataContractResponse', (_message.Message,), { + + 'GetDataContractResponseV0' : _reflection.GeneratedProtocolMessageType('GetDataContractResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTRESPONSE_GETDATACONTRACTRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0) + }) + , + 'DESCRIPTOR' : _GETDATACONTRACTRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractResponse) + }) +_sym_db.RegisterMessage(GetDataContractResponse) +_sym_db.RegisterMessage(GetDataContractResponse.GetDataContractResponseV0) + +GetDataContractsRequest = _reflection.GeneratedProtocolMessageType('GetDataContractsRequest', (_message.Message,), { + + 'GetDataContractsRequestV0' : _reflection.GeneratedProtocolMessageType('GetDataContractsRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTSREQUEST_GETDATACONTRACTSREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0) + }) + , + 'DESCRIPTOR' : _GETDATACONTRACTSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsRequest) + }) +_sym_db.RegisterMessage(GetDataContractsRequest) +_sym_db.RegisterMessage(GetDataContractsRequest.GetDataContractsRequestV0) + +GetDataContractsResponse = _reflection.GeneratedProtocolMessageType('GetDataContractsResponse', (_message.Message,), { + + 'DataContractEntry' : _reflection.GeneratedProtocolMessageType('DataContractEntry', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE_DATACONTRACTENTRY, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry) + }) + , + + 'DataContracts' : _reflection.GeneratedProtocolMessageType('DataContracts', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE_DATACONTRACTS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts) + }) + , + + 'GetDataContractsResponseV0' : _reflection.GeneratedProtocolMessageType('GetDataContractsResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE_GETDATACONTRACTSRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0) + }) + , + 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse) + }) +_sym_db.RegisterMessage(GetDataContractsResponse) +_sym_db.RegisterMessage(GetDataContractsResponse.DataContractEntry) +_sym_db.RegisterMessage(GetDataContractsResponse.DataContracts) +_sym_db.RegisterMessage(GetDataContractsResponse.GetDataContractsResponseV0) + +GetDataContractHistoryRequest = _reflection.GeneratedProtocolMessageType('GetDataContractHistoryRequest', (_message.Message,), { + + 'GetDataContractHistoryRequestV0' : _reflection.GeneratedProtocolMessageType('GetDataContractHistoryRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTHISTORYREQUEST_GETDATACONTRACTHISTORYREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0) + }) + , + 'DESCRIPTOR' : _GETDATACONTRACTHISTORYREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryRequest) + }) +_sym_db.RegisterMessage(GetDataContractHistoryRequest) +_sym_db.RegisterMessage(GetDataContractHistoryRequest.GetDataContractHistoryRequestV0) + +GetDataContractHistoryResponse = _reflection.GeneratedProtocolMessageType('GetDataContractHistoryResponse', (_message.Message,), { + + 'GetDataContractHistoryResponseV0' : _reflection.GeneratedProtocolMessageType('GetDataContractHistoryResponseV0', (_message.Message,), { + + 'DataContractHistoryEntry' : _reflection.GeneratedProtocolMessageType('DataContractHistoryEntry', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORYENTRY, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry) + }) + , + + 'DataContractHistory' : _reflection.GeneratedProtocolMessageType('DataContractHistory', (_message.Message,), { + 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORY, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory) + }) + , + 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0) + }) + , + 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse) + }) +_sym_db.RegisterMessage(GetDataContractHistoryResponse) +_sym_db.RegisterMessage(GetDataContractHistoryResponse.GetDataContractHistoryResponseV0) +_sym_db.RegisterMessage(GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry) +_sym_db.RegisterMessage(GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory) + +GetDocumentsRequest = _reflection.GeneratedProtocolMessageType('GetDocumentsRequest', (_message.Message,), { + + 'GetDocumentsRequestV0' : _reflection.GeneratedProtocolMessageType('GetDocumentsRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETDOCUMENTSREQUEST_GETDOCUMENTSREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0) + }) + , + 'DESCRIPTOR' : _GETDOCUMENTSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsRequest) + }) +_sym_db.RegisterMessage(GetDocumentsRequest) +_sym_db.RegisterMessage(GetDocumentsRequest.GetDocumentsRequestV0) + +GetDocumentsResponse = _reflection.GeneratedProtocolMessageType('GetDocumentsResponse', (_message.Message,), { + + 'GetDocumentsResponseV0' : _reflection.GeneratedProtocolMessageType('GetDocumentsResponseV0', (_message.Message,), { + + 'Documents' : _reflection.GeneratedProtocolMessageType('Documents', (_message.Message,), { + 'DESCRIPTOR' : _GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0_DOCUMENTS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents) + }) + , + 'DESCRIPTOR' : _GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0) + }) + , + 'DESCRIPTOR' : _GETDOCUMENTSRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsResponse) + }) +_sym_db.RegisterMessage(GetDocumentsResponse) +_sym_db.RegisterMessage(GetDocumentsResponse.GetDocumentsResponseV0) +_sym_db.RegisterMessage(GetDocumentsResponse.GetDocumentsResponseV0.Documents) + +GetIdentityByPublicKeyHashRequest = _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashRequest', (_message.Message,), { + + 'GetIdentityByPublicKeyHashRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest) + }) +_sym_db.RegisterMessage(GetIdentityByPublicKeyHashRequest) +_sym_db.RegisterMessage(GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) + +GetIdentityByPublicKeyHashResponse = _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashResponse', (_message.Message,), { + + 'GetIdentityByPublicKeyHashResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHRESPONSE_GETIDENTITYBYPUBLICKEYHASHRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse) + }) +_sym_db.RegisterMessage(GetIdentityByPublicKeyHashResponse) +_sym_db.RegisterMessage(GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) + +WaitForStateTransitionResultRequest = _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultRequest', (_message.Message,), { + + 'WaitForStateTransitionResultRequestV0' : _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTREQUEST_WAITFORSTATETRANSITIONRESULTREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) }) , - 'DESCRIPTOR' : _GETDATACONTRACTREQUEST, + 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest) }) -_sym_db.RegisterMessage(GetDataContractRequest) -_sym_db.RegisterMessage(GetDataContractRequest.GetDataContractRequestV0) +_sym_db.RegisterMessage(WaitForStateTransitionResultRequest) +_sym_db.RegisterMessage(WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) -GetDataContractResponse = _reflection.GeneratedProtocolMessageType('GetDataContractResponse', (_message.Message,), { +WaitForStateTransitionResultResponse = _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultResponse', (_message.Message,), { - 'GetDataContractResponseV0' : _reflection.GeneratedProtocolMessageType('GetDataContractResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTRESPONSE_GETDATACONTRACTRESPONSEV0, + 'WaitForStateTransitionResultResponseV0' : _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTRESPONSE_WAITFORSTATETRANSITIONRESULTRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) }) , - 'DESCRIPTOR' : _GETDATACONTRACTRESPONSE, + 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse) }) -_sym_db.RegisterMessage(GetDataContractResponse) -_sym_db.RegisterMessage(GetDataContractResponse.GetDataContractResponseV0) +_sym_db.RegisterMessage(WaitForStateTransitionResultResponse) +_sym_db.RegisterMessage(WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) -GetDataContractsRequest = _reflection.GeneratedProtocolMessageType('GetDataContractsRequest', (_message.Message,), { +GetConsensusParamsRequest = _reflection.GeneratedProtocolMessageType('GetConsensusParamsRequest', (_message.Message,), { - 'GetDataContractsRequestV0' : _reflection.GeneratedProtocolMessageType('GetDataContractsRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTSREQUEST_GETDATACONTRACTSREQUESTV0, + 'GetConsensusParamsRequestV0' : _reflection.GeneratedProtocolMessageType('GetConsensusParamsRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETCONSENSUSPARAMSREQUEST_GETCONSENSUSPARAMSREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0) }) , - 'DESCRIPTOR' : _GETDATACONTRACTSREQUEST, + 'DESCRIPTOR' : _GETCONSENSUSPARAMSREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsRequest) }) -_sym_db.RegisterMessage(GetDataContractsRequest) -_sym_db.RegisterMessage(GetDataContractsRequest.GetDataContractsRequestV0) +_sym_db.RegisterMessage(GetConsensusParamsRequest) +_sym_db.RegisterMessage(GetConsensusParamsRequest.GetConsensusParamsRequestV0) -GetDataContractsResponse = _reflection.GeneratedProtocolMessageType('GetDataContractsResponse', (_message.Message,), { +GetConsensusParamsResponse = _reflection.GeneratedProtocolMessageType('GetConsensusParamsResponse', (_message.Message,), { - 'DataContractEntry' : _reflection.GeneratedProtocolMessageType('DataContractEntry', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE_DATACONTRACTENTRY, + 'ConsensusParamsBlock' : _reflection.GeneratedProtocolMessageType('ConsensusParamsBlock', (_message.Message,), { + 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE_CONSENSUSPARAMSBLOCK, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock) }) , - 'DataContracts' : _reflection.GeneratedProtocolMessageType('DataContracts', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE_DATACONTRACTS, + 'ConsensusParamsEvidence' : _reflection.GeneratedProtocolMessageType('ConsensusParamsEvidence', (_message.Message,), { + 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE_CONSENSUSPARAMSEVIDENCE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence) }) , - 'GetDataContractsResponseV0' : _reflection.GeneratedProtocolMessageType('GetDataContractsResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE_GETDATACONTRACTSRESPONSEV0, + 'GetConsensusParamsResponseV0' : _reflection.GeneratedProtocolMessageType('GetConsensusParamsResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE_GETCONSENSUSPARAMSRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0) }) , - 'DESCRIPTOR' : _GETDATACONTRACTSRESPONSE, + 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractsResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse) }) -_sym_db.RegisterMessage(GetDataContractsResponse) -_sym_db.RegisterMessage(GetDataContractsResponse.DataContractEntry) -_sym_db.RegisterMessage(GetDataContractsResponse.DataContracts) -_sym_db.RegisterMessage(GetDataContractsResponse.GetDataContractsResponseV0) +_sym_db.RegisterMessage(GetConsensusParamsResponse) +_sym_db.RegisterMessage(GetConsensusParamsResponse.ConsensusParamsBlock) +_sym_db.RegisterMessage(GetConsensusParamsResponse.ConsensusParamsEvidence) +_sym_db.RegisterMessage(GetConsensusParamsResponse.GetConsensusParamsResponseV0) -GetDataContractHistoryRequest = _reflection.GeneratedProtocolMessageType('GetDataContractHistoryRequest', (_message.Message,), { +GetProtocolVersionUpgradeStateRequest = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateRequest', (_message.Message,), { - 'GetDataContractHistoryRequestV0' : _reflection.GeneratedProtocolMessageType('GetDataContractHistoryRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTHISTORYREQUEST_GETDATACONTRACTHISTORYREQUESTV0, + 'GetProtocolVersionUpgradeStateRequestV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATEREQUEST_GETPROTOCOLVERSIONUPGRADESTATEREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) }) , - 'DESCRIPTOR' : _GETDATACONTRACTHISTORYREQUEST, + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATEREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest) }) -_sym_db.RegisterMessage(GetDataContractHistoryRequest) -_sym_db.RegisterMessage(GetDataContractHistoryRequest.GetDataContractHistoryRequestV0) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateRequest) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) -GetDataContractHistoryResponse = _reflection.GeneratedProtocolMessageType('GetDataContractHistoryResponse', (_message.Message,), { +GetProtocolVersionUpgradeStateResponse = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateResponse', (_message.Message,), { - 'GetDataContractHistoryResponseV0' : _reflection.GeneratedProtocolMessageType('GetDataContractHistoryResponseV0', (_message.Message,), { + 'GetProtocolVersionUpgradeStateResponseV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateResponseV0', (_message.Message,), { - 'DataContractHistoryEntry' : _reflection.GeneratedProtocolMessageType('DataContractHistoryEntry', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORYENTRY, + 'Versions' : _reflection.GeneratedProtocolMessageType('Versions', (_message.Message,), { + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0_VERSIONS, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) }) , - 'DataContractHistory' : _reflection.GeneratedProtocolMessageType('DataContractHistory', (_message.Message,), { - 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORY, + 'VersionEntry' : _reflection.GeneratedProtocolMessageType('VersionEntry', (_message.Message,), { + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0_VERSIONENTRY, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) }) , - 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0, + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) }) , - 'DESCRIPTOR' : _GETDATACONTRACTHISTORYRESPONSE, + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDataContractHistoryResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse) }) -_sym_db.RegisterMessage(GetDataContractHistoryResponse) -_sym_db.RegisterMessage(GetDataContractHistoryResponse.GetDataContractHistoryResponseV0) -_sym_db.RegisterMessage(GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry) -_sym_db.RegisterMessage(GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) -GetDocumentsRequest = _reflection.GeneratedProtocolMessageType('GetDocumentsRequest', (_message.Message,), { +GetProtocolVersionUpgradeVoteStatusRequest = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusRequest', (_message.Message,), { - 'GetDocumentsRequestV0' : _reflection.GeneratedProtocolMessageType('GetDocumentsRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETDOCUMENTSREQUEST_GETDOCUMENTSREQUESTV0, + 'GetProtocolVersionUpgradeVoteStatusRequestV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST_GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) }) , - 'DESCRIPTOR' : _GETDOCUMENTSREQUEST, + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest) }) -_sym_db.RegisterMessage(GetDocumentsRequest) -_sym_db.RegisterMessage(GetDocumentsRequest.GetDocumentsRequestV0) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusRequest) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) -GetDocumentsResponse = _reflection.GeneratedProtocolMessageType('GetDocumentsResponse', (_message.Message,), { +GetProtocolVersionUpgradeVoteStatusResponse = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusResponse', (_message.Message,), { - 'GetDocumentsResponseV0' : _reflection.GeneratedProtocolMessageType('GetDocumentsResponseV0', (_message.Message,), { + 'GetProtocolVersionUpgradeVoteStatusResponseV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusResponseV0', (_message.Message,), { - 'Documents' : _reflection.GeneratedProtocolMessageType('Documents', (_message.Message,), { - 'DESCRIPTOR' : _GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0_DOCUMENTS, + 'VersionSignals' : _reflection.GeneratedProtocolMessageType('VersionSignals', (_message.Message,), { + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0_VERSIONSIGNALS, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) }) , - 'DESCRIPTOR' : _GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0, + + 'VersionSignal' : _reflection.GeneratedProtocolMessageType('VersionSignal', (_message.Message,), { + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0_VERSIONSIGNAL, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) + }) + , + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) }) , - 'DESCRIPTOR' : _GETDOCUMENTSRESPONSE, + 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetDocumentsResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse) }) -_sym_db.RegisterMessage(GetDocumentsResponse) -_sym_db.RegisterMessage(GetDocumentsResponse.GetDocumentsResponseV0) -_sym_db.RegisterMessage(GetDocumentsResponse.GetDocumentsResponseV0.Documents) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) +_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) -GetIdentitiesByPublicKeyHashesRequest = _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesRequest', (_message.Message,), { +GetEpochsInfoRequest = _reflection.GeneratedProtocolMessageType('GetEpochsInfoRequest', (_message.Message,), { - 'GetIdentitiesByPublicKeyHashesRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0, + 'GetEpochsInfoRequestV0' : _reflection.GeneratedProtocolMessageType('GetEpochsInfoRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETEPOCHSINFOREQUEST_GETEPOCHSINFOREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0) }) , - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESREQUEST, + 'DESCRIPTOR' : _GETEPOCHSINFOREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoRequest) }) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesRequest) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0) +_sym_db.RegisterMessage(GetEpochsInfoRequest) +_sym_db.RegisterMessage(GetEpochsInfoRequest.GetEpochsInfoRequestV0) + +GetEpochsInfoResponse = _reflection.GeneratedProtocolMessageType('GetEpochsInfoResponse', (_message.Message,), { -GetIdentitiesByPublicKeyHashesResponse = _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesResponse', (_message.Message,), { + 'GetEpochsInfoResponseV0' : _reflection.GeneratedProtocolMessageType('GetEpochsInfoResponseV0', (_message.Message,), { - 'PublicKeyHashIdentityEntry' : _reflection.GeneratedProtocolMessageType('PublicKeyHashIdentityEntry', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry) - }) - , + 'EpochInfos' : _reflection.GeneratedProtocolMessageType('EpochInfos', (_message.Message,), { + 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFOS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) + }) + , - 'IdentitiesByPublicKeyHashes' : _reflection.GeneratedProtocolMessageType('IdentitiesByPublicKeyHashes', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES, + 'EpochInfo' : _reflection.GeneratedProtocolMessageType('EpochInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) + }) + , + 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0) }) , + 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse) + }) +_sym_db.RegisterMessage(GetEpochsInfoResponse) +_sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0) +_sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) +_sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) + +GetContestedResourcesRequest = _reflection.GeneratedProtocolMessageType('GetContestedResourcesRequest', (_message.Message,), { - 'GetIdentitiesByPublicKeyHashesResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0, + 'GetContestedResourcesRequestV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourcesRequestV0', (_message.Message,), { + + 'StartAtValueInfo' : _reflection.GeneratedProtocolMessageType('StartAtValueInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0_STARTATVALUEINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCESREQUEST_GETCONTESTEDRESOURCESREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0) }) , - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE, + 'DESCRIPTOR' : _GETCONTESTEDRESOURCESREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourcesRequest) }) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0) +_sym_db.RegisterMessage(GetContestedResourcesRequest) +_sym_db.RegisterMessage(GetContestedResourcesRequest.GetContestedResourcesRequestV0) +_sym_db.RegisterMessage(GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo) -GetIdentityByPublicKeyHashRequest = _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashRequest', (_message.Message,), { +GetContestedResourcesResponse = _reflection.GeneratedProtocolMessageType('GetContestedResourcesResponse', (_message.Message,), { - 'GetIdentityByPublicKeyHashRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0, + 'GetContestedResourcesResponseV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourcesResponseV0', (_message.Message,), { + + 'ContestedResourceValues' : _reflection.GeneratedProtocolMessageType('ContestedResourceValues', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0_CONTESTEDRESOURCEVALUES, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCESRESPONSE_GETCONTESTEDRESOURCESRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0) }) , - 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHREQUEST, + 'DESCRIPTOR' : _GETCONTESTEDRESOURCESRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourcesResponse) }) -_sym_db.RegisterMessage(GetIdentityByPublicKeyHashRequest) -_sym_db.RegisterMessage(GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) +_sym_db.RegisterMessage(GetContestedResourcesResponse) +_sym_db.RegisterMessage(GetContestedResourcesResponse.GetContestedResourcesResponseV0) +_sym_db.RegisterMessage(GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues) -GetIdentityByPublicKeyHashResponse = _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashResponse', (_message.Message,), { +GetVotePollsByEndDateRequest = _reflection.GeneratedProtocolMessageType('GetVotePollsByEndDateRequest', (_message.Message,), { - 'GetIdentityByPublicKeyHashResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHRESPONSE_GETIDENTITYBYPUBLICKEYHASHRESPONSEV0, + 'GetVotePollsByEndDateRequestV0' : _reflection.GeneratedProtocolMessageType('GetVotePollsByEndDateRequestV0', (_message.Message,), { + + 'StartAtTimeInfo' : _reflection.GeneratedProtocolMessageType('StartAtTimeInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_STARTATTIMEINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo) + }) + , + + 'EndAtTimeInfo' : _reflection.GeneratedProtocolMessageType('EndAtTimeInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0_ENDATTIMEINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo) + }) + , + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATEREQUEST_GETVOTEPOLLSBYENDDATEREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0) }) , - 'DESCRIPTOR' : _GETIDENTITYBYPUBLICKEYHASHRESPONSE, + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATEREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest) }) -_sym_db.RegisterMessage(GetIdentityByPublicKeyHashResponse) -_sym_db.RegisterMessage(GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) +_sym_db.RegisterMessage(GetVotePollsByEndDateRequest) +_sym_db.RegisterMessage(GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0) +_sym_db.RegisterMessage(GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo) +_sym_db.RegisterMessage(GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo) -WaitForStateTransitionResultRequest = _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultRequest', (_message.Message,), { +GetVotePollsByEndDateResponse = _reflection.GeneratedProtocolMessageType('GetVotePollsByEndDateResponse', (_message.Message,), { - 'WaitForStateTransitionResultRequestV0' : _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTREQUEST_WAITFORSTATETRANSITIONRESULTREQUESTV0, + 'GetVotePollsByEndDateResponseV0' : _reflection.GeneratedProtocolMessageType('GetVotePollsByEndDateResponseV0', (_message.Message,), { + + 'SerializedVotePollsByTimestamp' : _reflection.GeneratedProtocolMessageType('SerializedVotePollsByTimestamp', (_message.Message,), { + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMP, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp) + }) + , + + 'SerializedVotePollsByTimestamps' : _reflection.GeneratedProtocolMessageType('SerializedVotePollsByTimestamps', (_message.Message,), { + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0_SERIALIZEDVOTEPOLLSBYTIMESTAMPS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps) + }) + , + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATERESPONSE_GETVOTEPOLLSBYENDDATERESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0) }) , - 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTREQUEST, + 'DESCRIPTOR' : _GETVOTEPOLLSBYENDDATERESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse) }) -_sym_db.RegisterMessage(WaitForStateTransitionResultRequest) -_sym_db.RegisterMessage(WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) +_sym_db.RegisterMessage(GetVotePollsByEndDateResponse) +_sym_db.RegisterMessage(GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0) +_sym_db.RegisterMessage(GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp) +_sym_db.RegisterMessage(GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps) -WaitForStateTransitionResultResponse = _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultResponse', (_message.Message,), { +GetContestedResourceVoteStateRequest = _reflection.GeneratedProtocolMessageType('GetContestedResourceVoteStateRequest', (_message.Message,), { - 'WaitForStateTransitionResultResponseV0' : _reflection.GeneratedProtocolMessageType('WaitForStateTransitionResultResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTRESPONSE_WAITFORSTATETRANSITIONRESULTRESPONSEV0, + 'GetContestedResourceVoteStateRequestV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourceVoteStateRequestV0', (_message.Message,), { + + 'StartAtIdentifierInfo' : _reflection.GeneratedProtocolMessageType('StartAtIdentifierInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0_STARTATIDENTIFIERINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATEREQUEST_GETCONTESTEDRESOURCEVOTESTATEREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0) }) , - 'DESCRIPTOR' : _WAITFORSTATETRANSITIONRESULTRESPONSE, + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATEREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest) }) -_sym_db.RegisterMessage(WaitForStateTransitionResultResponse) -_sym_db.RegisterMessage(WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) +_sym_db.RegisterMessage(GetContestedResourceVoteStateRequest) +_sym_db.RegisterMessage(GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0) +_sym_db.RegisterMessage(GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo) -GetConsensusParamsRequest = _reflection.GeneratedProtocolMessageType('GetConsensusParamsRequest', (_message.Message,), { +GetContestedResourceVoteStateResponse = _reflection.GeneratedProtocolMessageType('GetContestedResourceVoteStateResponse', (_message.Message,), { - 'GetConsensusParamsRequestV0' : _reflection.GeneratedProtocolMessageType('GetConsensusParamsRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETCONSENSUSPARAMSREQUEST_GETCONSENSUSPARAMSREQUESTV0, + 'GetContestedResourceVoteStateResponseV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourceVoteStateResponseV0', (_message.Message,), { + + 'FinishedVoteInfo' : _reflection.GeneratedProtocolMessageType('FinishedVoteInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_FINISHEDVOTEINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo) + }) + , + + 'ContestedResourceContenders' : _reflection.GeneratedProtocolMessageType('ContestedResourceContenders', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTESTEDRESOURCECONTENDERS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders) + }) + , + + 'Contender' : _reflection.GeneratedProtocolMessageType('Contender', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0_CONTENDER, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATERESPONSE_GETCONTESTEDRESOURCEVOTESTATERESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0) }) , - 'DESCRIPTOR' : _GETCONSENSUSPARAMSREQUEST, + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTESTATERESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse) }) -_sym_db.RegisterMessage(GetConsensusParamsRequest) -_sym_db.RegisterMessage(GetConsensusParamsRequest.GetConsensusParamsRequestV0) +_sym_db.RegisterMessage(GetContestedResourceVoteStateResponse) +_sym_db.RegisterMessage(GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0) +_sym_db.RegisterMessage(GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo) +_sym_db.RegisterMessage(GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders) +_sym_db.RegisterMessage(GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender) -GetConsensusParamsResponse = _reflection.GeneratedProtocolMessageType('GetConsensusParamsResponse', (_message.Message,), { +GetContestedResourceVotersForIdentityRequest = _reflection.GeneratedProtocolMessageType('GetContestedResourceVotersForIdentityRequest', (_message.Message,), { - 'ConsensusParamsBlock' : _reflection.GeneratedProtocolMessageType('ConsensusParamsBlock', (_message.Message,), { - 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE_CONSENSUSPARAMSBLOCK, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock) - }) - , + 'GetContestedResourceVotersForIdentityRequestV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourceVotersForIdentityRequestV0', (_message.Message,), { - 'ConsensusParamsEvidence' : _reflection.GeneratedProtocolMessageType('ConsensusParamsEvidence', (_message.Message,), { - 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE_CONSENSUSPARAMSEVIDENCE, + 'StartAtIdentifierInfo' : _reflection.GeneratedProtocolMessageType('StartAtIdentifierInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0_STARTATIDENTIFIERINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0) }) , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest) + }) +_sym_db.RegisterMessage(GetContestedResourceVotersForIdentityRequest) +_sym_db.RegisterMessage(GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0) +_sym_db.RegisterMessage(GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo) - 'GetConsensusParamsResponseV0' : _reflection.GeneratedProtocolMessageType('GetConsensusParamsResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE_GETCONSENSUSPARAMSRESPONSEV0, +GetContestedResourceVotersForIdentityResponse = _reflection.GeneratedProtocolMessageType('GetContestedResourceVotersForIdentityResponse', (_message.Message,), { + + 'GetContestedResourceVotersForIdentityResponseV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourceVotersForIdentityResponseV0', (_message.Message,), { + + 'ContestedResourceVoters' : _reflection.GeneratedProtocolMessageType('ContestedResourceVoters', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0_CONTESTEDRESOURCEVOTERS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0) }) , - 'DESCRIPTOR' : _GETCONSENSUSPARAMSRESPONSE, + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetConsensusParamsResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse) }) -_sym_db.RegisterMessage(GetConsensusParamsResponse) -_sym_db.RegisterMessage(GetConsensusParamsResponse.ConsensusParamsBlock) -_sym_db.RegisterMessage(GetConsensusParamsResponse.ConsensusParamsEvidence) -_sym_db.RegisterMessage(GetConsensusParamsResponse.GetConsensusParamsResponseV0) +_sym_db.RegisterMessage(GetContestedResourceVotersForIdentityResponse) +_sym_db.RegisterMessage(GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0) +_sym_db.RegisterMessage(GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters) -GetProtocolVersionUpgradeStateRequest = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateRequest', (_message.Message,), { +GetContestedResourceIdentityVotesRequest = _reflection.GeneratedProtocolMessageType('GetContestedResourceIdentityVotesRequest', (_message.Message,), { - 'GetProtocolVersionUpgradeStateRequestV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATEREQUEST_GETPROTOCOLVERSIONUPGRADESTATEREQUESTV0, + 'GetContestedResourceIdentityVotesRequestV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourceIdentityVotesRequestV0', (_message.Message,), { + + 'StartAtVotePollIdInfo' : _reflection.GeneratedProtocolMessageType('StartAtVotePollIdInfo', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0_STARTATVOTEPOLLIDINFO, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST_GETCONTESTEDRESOURCEIDENTITYVOTESREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0) }) , - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATEREQUEST, + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest) }) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateRequest) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesRequest) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo) -GetProtocolVersionUpgradeStateResponse = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateResponse', (_message.Message,), { +GetContestedResourceIdentityVotesResponse = _reflection.GeneratedProtocolMessageType('GetContestedResourceIdentityVotesResponse', (_message.Message,), { - 'GetProtocolVersionUpgradeStateResponseV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeStateResponseV0', (_message.Message,), { + 'GetContestedResourceIdentityVotesResponseV0' : _reflection.GeneratedProtocolMessageType('GetContestedResourceIdentityVotesResponseV0', (_message.Message,), { - 'Versions' : _reflection.GeneratedProtocolMessageType('Versions', (_message.Message,), { - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0_VERSIONS, + 'ContestedResourceIdentityVotes' : _reflection.GeneratedProtocolMessageType('ContestedResourceIdentityVotes', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTES, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes) }) , - 'VersionEntry' : _reflection.GeneratedProtocolMessageType('VersionEntry', (_message.Message,), { - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0_VERSIONENTRY, + 'ResourceVoteChoice' : _reflection.GeneratedProtocolMessageType('ResourceVoteChoice', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_RESOURCEVOTECHOICE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice) }) , - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0, + + 'ContestedResourceIdentityVote' : _reflection.GeneratedProtocolMessageType('ContestedResourceIdentityVote', (_message.Message,), { + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0_CONTESTEDRESOURCEIDENTITYVOTE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote) + }) + , + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0) }) , - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADESTATERESPONSE, + 'DESCRIPTOR' : _GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse) }) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesResponse) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice) +_sym_db.RegisterMessage(GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote) -GetProtocolVersionUpgradeVoteStatusRequest = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusRequest', (_message.Message,), { +GetPrefundedSpecializedBalanceRequest = _reflection.GeneratedProtocolMessageType('GetPrefundedSpecializedBalanceRequest', (_message.Message,), { - 'GetProtocolVersionUpgradeVoteStatusRequestV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST_GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUESTV0, + 'GetPrefundedSpecializedBalanceRequestV0' : _reflection.GeneratedProtocolMessageType('GetPrefundedSpecializedBalanceRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETPREFUNDEDSPECIALIZEDBALANCEREQUEST_GETPREFUNDEDSPECIALIZEDBALANCEREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0) }) , - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST, + 'DESCRIPTOR' : _GETPREFUNDEDSPECIALIZEDBALANCEREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest) }) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusRequest) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) +_sym_db.RegisterMessage(GetPrefundedSpecializedBalanceRequest) +_sym_db.RegisterMessage(GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0) -GetProtocolVersionUpgradeVoteStatusResponse = _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusResponse', (_message.Message,), { +GetPrefundedSpecializedBalanceResponse = _reflection.GeneratedProtocolMessageType('GetPrefundedSpecializedBalanceResponse', (_message.Message,), { - 'GetProtocolVersionUpgradeVoteStatusResponseV0' : _reflection.GeneratedProtocolMessageType('GetProtocolVersionUpgradeVoteStatusResponseV0', (_message.Message,), { + 'GetPrefundedSpecializedBalanceResponseV0' : _reflection.GeneratedProtocolMessageType('GetPrefundedSpecializedBalanceResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE_GETPREFUNDEDSPECIALIZEDBALANCERESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0) + }) + , + 'DESCRIPTOR' : _GETPREFUNDEDSPECIALIZEDBALANCERESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse) + }) +_sym_db.RegisterMessage(GetPrefundedSpecializedBalanceResponse) +_sym_db.RegisterMessage(GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0) - 'VersionSignals' : _reflection.GeneratedProtocolMessageType('VersionSignals', (_message.Message,), { - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0_VERSIONSIGNALS, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) - }) - , +GetTotalCreditsInPlatformRequest = _reflection.GeneratedProtocolMessageType('GetTotalCreditsInPlatformRequest', (_message.Message,), { - 'VersionSignal' : _reflection.GeneratedProtocolMessageType('VersionSignal', (_message.Message,), { - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0_VERSIONSIGNAL, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) - }) - , - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0, + 'GetTotalCreditsInPlatformRequestV0' : _reflection.GeneratedProtocolMessageType('GetTotalCreditsInPlatformRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETTOTALCREDITSINPLATFORMREQUEST_GETTOTALCREDITSINPLATFORMREQUESTV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0) }) , - 'DESCRIPTOR' : _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE, + 'DESCRIPTOR' : _GETTOTALCREDITSINPLATFORMREQUEST, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest) }) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) -_sym_db.RegisterMessage(GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) +_sym_db.RegisterMessage(GetTotalCreditsInPlatformRequest) +_sym_db.RegisterMessage(GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0) -GetEpochsInfoRequest = _reflection.GeneratedProtocolMessageType('GetEpochsInfoRequest', (_message.Message,), { +GetTotalCreditsInPlatformResponse = _reflection.GeneratedProtocolMessageType('GetTotalCreditsInPlatformResponse', (_message.Message,), { - 'GetEpochsInfoRequestV0' : _reflection.GeneratedProtocolMessageType('GetEpochsInfoRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETEPOCHSINFOREQUEST_GETEPOCHSINFOREQUESTV0, + 'GetTotalCreditsInPlatformResponseV0' : _reflection.GeneratedProtocolMessageType('GetTotalCreditsInPlatformResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETTOTALCREDITSINPLATFORMRESPONSE_GETTOTALCREDITSINPLATFORMRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0) }) , - 'DESCRIPTOR' : _GETEPOCHSINFOREQUEST, + 'DESCRIPTOR' : _GETTOTALCREDITSINPLATFORMRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse) }) -_sym_db.RegisterMessage(GetEpochsInfoRequest) -_sym_db.RegisterMessage(GetEpochsInfoRequest.GetEpochsInfoRequestV0) +_sym_db.RegisterMessage(GetTotalCreditsInPlatformResponse) +_sym_db.RegisterMessage(GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0) -GetEpochsInfoResponse = _reflection.GeneratedProtocolMessageType('GetEpochsInfoResponse', (_message.Message,), { +GetPathElementsRequest = _reflection.GeneratedProtocolMessageType('GetPathElementsRequest', (_message.Message,), { - 'GetEpochsInfoResponseV0' : _reflection.GeneratedProtocolMessageType('GetEpochsInfoResponseV0', (_message.Message,), { + 'GetPathElementsRequestV0' : _reflection.GeneratedProtocolMessageType('GetPathElementsRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0) + }) + , + 'DESCRIPTOR' : _GETPATHELEMENTSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsRequest) + }) +_sym_db.RegisterMessage(GetPathElementsRequest) +_sym_db.RegisterMessage(GetPathElementsRequest.GetPathElementsRequestV0) - 'EpochInfos' : _reflection.GeneratedProtocolMessageType('EpochInfos', (_message.Message,), { - 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFOS, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) - }) - , +GetPathElementsResponse = _reflection.GeneratedProtocolMessageType('GetPathElementsResponse', (_message.Message,), { - 'EpochInfo' : _reflection.GeneratedProtocolMessageType('EpochInfo', (_message.Message,), { - 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFO, + 'GetPathElementsResponseV0' : _reflection.GeneratedProtocolMessageType('GetPathElementsResponseV0', (_message.Message,), { + + 'Elements' : _reflection.GeneratedProtocolMessageType('Elements', (_message.Message,), { + 'DESCRIPTOR' : _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements) }) , - 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0, + 'DESCRIPTOR' : _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0) }) , - 'DESCRIPTOR' : _GETEPOCHSINFORESPONSE, + 'DESCRIPTOR' : _GETPATHELEMENTSRESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetEpochsInfoResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsResponse) }) -_sym_db.RegisterMessage(GetEpochsInfoResponse) -_sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0) -_sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) -_sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) +_sym_db.RegisterMessage(GetPathElementsResponse) +_sym_db.RegisterMessage(GetPathElementsResponse.GetPathElementsResponseV0) +_sym_db.RegisterMessage(GetPathElementsResponse.GetPathElementsResponseV0.Elements) _SEARCHKEY_PURPOSEMAPENTRY._options = None @@ -5475,8 +8876,8 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=14543, - serialized_end=17041, + serialized_start=26207, + serialized_end=30105, methods=[ _descriptor.MethodDescriptor( name='broadcastStateTransition', @@ -5499,29 +8900,49 @@ create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( - name='getIdentities', - full_name='org.dash.platform.dapi.v0.Platform.getIdentities', + name='getIdentityKeys', + full_name='org.dash.platform.dapi.v0.Platform.getIdentityKeys', index=2, containing_service=None, - input_type=_GETIDENTITIESREQUEST, - output_type=_GETIDENTITIESRESPONSE, + input_type=_GETIDENTITYKEYSREQUEST, + output_type=_GETIDENTITYKEYSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( - name='getIdentityKeys', - full_name='org.dash.platform.dapi.v0.Platform.getIdentityKeys', + name='getIdentitiesContractKeys', + full_name='org.dash.platform.dapi.v0.Platform.getIdentitiesContractKeys', index=3, containing_service=None, - input_type=_GETIDENTITYKEYSREQUEST, - output_type=_GETIDENTITYKEYSRESPONSE, + input_type=_GETIDENTITIESCONTRACTKEYSREQUEST, + output_type=_GETIDENTITIESCONTRACTKEYSRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getIdentityNonce', + full_name='org.dash.platform.dapi.v0.Platform.getIdentityNonce', + index=4, + containing_service=None, + input_type=_GETIDENTITYNONCEREQUEST, + output_type=_GETIDENTITYNONCERESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getIdentityContractNonce', + full_name='org.dash.platform.dapi.v0.Platform.getIdentityContractNonce', + index=5, + containing_service=None, + input_type=_GETIDENTITYCONTRACTNONCEREQUEST, + output_type=_GETIDENTITYCONTRACTNONCERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='getIdentityBalance', full_name='org.dash.platform.dapi.v0.Platform.getIdentityBalance', - index=4, + index=6, containing_service=None, input_type=_GETIDENTITYBALANCEREQUEST, output_type=_GETIDENTITYBALANCERESPONSE, @@ -5531,7 +8952,7 @@ _descriptor.MethodDescriptor( name='getIdentityBalanceAndRevision', full_name='org.dash.platform.dapi.v0.Platform.getIdentityBalanceAndRevision', - index=5, + index=7, containing_service=None, input_type=_GETIDENTITYBALANCEANDREVISIONREQUEST, output_type=_GETIDENTITYBALANCEANDREVISIONRESPONSE, @@ -5541,7 +8962,7 @@ _descriptor.MethodDescriptor( name='getProofs', full_name='org.dash.platform.dapi.v0.Platform.getProofs', - index=6, + index=8, containing_service=None, input_type=_GETPROOFSREQUEST, output_type=_GETPROOFSRESPONSE, @@ -5551,7 +8972,7 @@ _descriptor.MethodDescriptor( name='getDataContract', full_name='org.dash.platform.dapi.v0.Platform.getDataContract', - index=7, + index=9, containing_service=None, input_type=_GETDATACONTRACTREQUEST, output_type=_GETDATACONTRACTRESPONSE, @@ -5561,7 +8982,7 @@ _descriptor.MethodDescriptor( name='getDataContractHistory', full_name='org.dash.platform.dapi.v0.Platform.getDataContractHistory', - index=8, + index=10, containing_service=None, input_type=_GETDATACONTRACTHISTORYREQUEST, output_type=_GETDATACONTRACTHISTORYRESPONSE, @@ -5571,7 +8992,7 @@ _descriptor.MethodDescriptor( name='getDataContracts', full_name='org.dash.platform.dapi.v0.Platform.getDataContracts', - index=9, + index=11, containing_service=None, input_type=_GETDATACONTRACTSREQUEST, output_type=_GETDATACONTRACTSRESPONSE, @@ -5581,27 +9002,17 @@ _descriptor.MethodDescriptor( name='getDocuments', full_name='org.dash.platform.dapi.v0.Platform.getDocuments', - index=10, + index=12, containing_service=None, input_type=_GETDOCUMENTSREQUEST, output_type=_GETDOCUMENTSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), - _descriptor.MethodDescriptor( - name='getIdentitiesByPublicKeyHashes', - full_name='org.dash.platform.dapi.v0.Platform.getIdentitiesByPublicKeyHashes', - index=11, - containing_service=None, - input_type=_GETIDENTITIESBYPUBLICKEYHASHESREQUEST, - output_type=_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), _descriptor.MethodDescriptor( name='getIdentityByPublicKeyHash', full_name='org.dash.platform.dapi.v0.Platform.getIdentityByPublicKeyHash', - index=12, + index=13, containing_service=None, input_type=_GETIDENTITYBYPUBLICKEYHASHREQUEST, output_type=_GETIDENTITYBYPUBLICKEYHASHRESPONSE, @@ -5611,7 +9022,7 @@ _descriptor.MethodDescriptor( name='waitForStateTransitionResult', full_name='org.dash.platform.dapi.v0.Platform.waitForStateTransitionResult', - index=13, + index=14, containing_service=None, input_type=_WAITFORSTATETRANSITIONRESULTREQUEST, output_type=_WAITFORSTATETRANSITIONRESULTRESPONSE, @@ -5621,7 +9032,7 @@ _descriptor.MethodDescriptor( name='getConsensusParams', full_name='org.dash.platform.dapi.v0.Platform.getConsensusParams', - index=14, + index=15, containing_service=None, input_type=_GETCONSENSUSPARAMSREQUEST, output_type=_GETCONSENSUSPARAMSRESPONSE, @@ -5631,7 +9042,7 @@ _descriptor.MethodDescriptor( name='getProtocolVersionUpgradeState', full_name='org.dash.platform.dapi.v0.Platform.getProtocolVersionUpgradeState', - index=15, + index=16, containing_service=None, input_type=_GETPROTOCOLVERSIONUPGRADESTATEREQUEST, output_type=_GETPROTOCOLVERSIONUPGRADESTATERESPONSE, @@ -5641,7 +9052,7 @@ _descriptor.MethodDescriptor( name='getProtocolVersionUpgradeVoteStatus', full_name='org.dash.platform.dapi.v0.Platform.getProtocolVersionUpgradeVoteStatus', - index=16, + index=17, containing_service=None, input_type=_GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST, output_type=_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE, @@ -5651,13 +9062,93 @@ _descriptor.MethodDescriptor( name='getEpochsInfo', full_name='org.dash.platform.dapi.v0.Platform.getEpochsInfo', - index=17, + index=18, containing_service=None, input_type=_GETEPOCHSINFOREQUEST, output_type=_GETEPOCHSINFORESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='getContestedResources', + full_name='org.dash.platform.dapi.v0.Platform.getContestedResources', + index=19, + containing_service=None, + input_type=_GETCONTESTEDRESOURCESREQUEST, + output_type=_GETCONTESTEDRESOURCESRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getContestedResourceVoteState', + full_name='org.dash.platform.dapi.v0.Platform.getContestedResourceVoteState', + index=20, + containing_service=None, + input_type=_GETCONTESTEDRESOURCEVOTESTATEREQUEST, + output_type=_GETCONTESTEDRESOURCEVOTESTATERESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getContestedResourceVotersForIdentity', + full_name='org.dash.platform.dapi.v0.Platform.getContestedResourceVotersForIdentity', + index=21, + containing_service=None, + input_type=_GETCONTESTEDRESOURCEVOTERSFORIDENTITYREQUEST, + output_type=_GETCONTESTEDRESOURCEVOTERSFORIDENTITYRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getContestedResourceIdentityVotes', + full_name='org.dash.platform.dapi.v0.Platform.getContestedResourceIdentityVotes', + index=22, + containing_service=None, + input_type=_GETCONTESTEDRESOURCEIDENTITYVOTESREQUEST, + output_type=_GETCONTESTEDRESOURCEIDENTITYVOTESRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getVotePollsByEndDate', + full_name='org.dash.platform.dapi.v0.Platform.getVotePollsByEndDate', + index=23, + containing_service=None, + input_type=_GETVOTEPOLLSBYENDDATEREQUEST, + output_type=_GETVOTEPOLLSBYENDDATERESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getPrefundedSpecializedBalance', + full_name='org.dash.platform.dapi.v0.Platform.getPrefundedSpecializedBalance', + index=24, + containing_service=None, + input_type=_GETPREFUNDEDSPECIALIZEDBALANCEREQUEST, + output_type=_GETPREFUNDEDSPECIALIZEDBALANCERESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getTotalCreditsInPlatform', + full_name='org.dash.platform.dapi.v0.Platform.getTotalCreditsInPlatform', + index=25, + containing_service=None, + input_type=_GETTOTALCREDITSINPLATFORMREQUEST, + output_type=_GETTOTALCREDITSINPLATFORMRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getPathElements', + full_name='org.dash.platform.dapi.v0.Platform.getPathElements', + index=26, + containing_service=None, + input_type=_GETPATHELEMENTSREQUEST, + output_type=_GETPATHELEMENTSRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), ]) _sym_db.RegisterServiceDescriptor(_PLATFORM) diff --git a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py index a28f5122e3f..83189ff09ff 100644 --- a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py +++ b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py @@ -24,16 +24,26 @@ def __init__(self, channel): request_serializer=platform__pb2.GetIdentityRequest.SerializeToString, response_deserializer=platform__pb2.GetIdentityResponse.FromString, ) - self.getIdentities = channel.unary_unary( - '/org.dash.platform.dapi.v0.Platform/getIdentities', - request_serializer=platform__pb2.GetIdentitiesRequest.SerializeToString, - response_deserializer=platform__pb2.GetIdentitiesResponse.FromString, - ) self.getIdentityKeys = channel.unary_unary( '/org.dash.platform.dapi.v0.Platform/getIdentityKeys', request_serializer=platform__pb2.GetIdentityKeysRequest.SerializeToString, response_deserializer=platform__pb2.GetIdentityKeysResponse.FromString, ) + self.getIdentitiesContractKeys = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getIdentitiesContractKeys', + request_serializer=platform__pb2.GetIdentitiesContractKeysRequest.SerializeToString, + response_deserializer=platform__pb2.GetIdentitiesContractKeysResponse.FromString, + ) + self.getIdentityNonce = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getIdentityNonce', + request_serializer=platform__pb2.GetIdentityNonceRequest.SerializeToString, + response_deserializer=platform__pb2.GetIdentityNonceResponse.FromString, + ) + self.getIdentityContractNonce = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getIdentityContractNonce', + request_serializer=platform__pb2.GetIdentityContractNonceRequest.SerializeToString, + response_deserializer=platform__pb2.GetIdentityContractNonceResponse.FromString, + ) self.getIdentityBalance = channel.unary_unary( '/org.dash.platform.dapi.v0.Platform/getIdentityBalance', request_serializer=platform__pb2.GetIdentityBalanceRequest.SerializeToString, @@ -69,11 +79,6 @@ def __init__(self, channel): request_serializer=platform__pb2.GetDocumentsRequest.SerializeToString, response_deserializer=platform__pb2.GetDocumentsResponse.FromString, ) - self.getIdentitiesByPublicKeyHashes = channel.unary_unary( - '/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes', - request_serializer=platform__pb2.GetIdentitiesByPublicKeyHashesRequest.SerializeToString, - response_deserializer=platform__pb2.GetIdentitiesByPublicKeyHashesResponse.FromString, - ) self.getIdentityByPublicKeyHash = channel.unary_unary( '/org.dash.platform.dapi.v0.Platform/getIdentityByPublicKeyHash', request_serializer=platform__pb2.GetIdentityByPublicKeyHashRequest.SerializeToString, @@ -104,6 +109,46 @@ def __init__(self, channel): request_serializer=platform__pb2.GetEpochsInfoRequest.SerializeToString, response_deserializer=platform__pb2.GetEpochsInfoResponse.FromString, ) + self.getContestedResources = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getContestedResources', + request_serializer=platform__pb2.GetContestedResourcesRequest.SerializeToString, + response_deserializer=platform__pb2.GetContestedResourcesResponse.FromString, + ) + self.getContestedResourceVoteState = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getContestedResourceVoteState', + request_serializer=platform__pb2.GetContestedResourceVoteStateRequest.SerializeToString, + response_deserializer=platform__pb2.GetContestedResourceVoteStateResponse.FromString, + ) + self.getContestedResourceVotersForIdentity = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getContestedResourceVotersForIdentity', + request_serializer=platform__pb2.GetContestedResourceVotersForIdentityRequest.SerializeToString, + response_deserializer=platform__pb2.GetContestedResourceVotersForIdentityResponse.FromString, + ) + self.getContestedResourceIdentityVotes = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getContestedResourceIdentityVotes', + request_serializer=platform__pb2.GetContestedResourceIdentityVotesRequest.SerializeToString, + response_deserializer=platform__pb2.GetContestedResourceIdentityVotesResponse.FromString, + ) + self.getVotePollsByEndDate = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getVotePollsByEndDate', + request_serializer=platform__pb2.GetVotePollsByEndDateRequest.SerializeToString, + response_deserializer=platform__pb2.GetVotePollsByEndDateResponse.FromString, + ) + self.getPrefundedSpecializedBalance = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getPrefundedSpecializedBalance', + request_serializer=platform__pb2.GetPrefundedSpecializedBalanceRequest.SerializeToString, + response_deserializer=platform__pb2.GetPrefundedSpecializedBalanceResponse.FromString, + ) + self.getTotalCreditsInPlatform = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getTotalCreditsInPlatform', + request_serializer=platform__pb2.GetTotalCreditsInPlatformRequest.SerializeToString, + response_deserializer=platform__pb2.GetTotalCreditsInPlatformResponse.FromString, + ) + self.getPathElements = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getPathElements', + request_serializer=platform__pb2.GetPathElementsRequest.SerializeToString, + response_deserializer=platform__pb2.GetPathElementsResponse.FromString, + ) class PlatformServicer(object): @@ -121,13 +166,25 @@ def getIdentity(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def getIdentities(self, request, context): + def getIdentityKeys(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def getIdentityKeys(self, request, context): + def getIdentitiesContractKeys(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getIdentityNonce(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getIdentityContractNonce(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') @@ -175,12 +232,6 @@ def getDocuments(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def getIdentitiesByPublicKeyHashes(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - def getIdentityByPublicKeyHash(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -217,6 +268,59 @@ def getEpochsInfo(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def getContestedResources(self, request, context): + """What votes are currently happening for a specific contested index + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getContestedResourceVoteState(self, request, context): + """What's the state of a contested resource vote? (ie who is winning?) + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getContestedResourceVotersForIdentity(self, request, context): + """Who voted for a contested resource to go to a specific identity? + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getContestedResourceIdentityVotes(self, request, context): + """How did an identity vote? + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getVotePollsByEndDate(self, request, context): + """What vote polls will end soon? + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getPrefundedSpecializedBalance(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getTotalCreditsInPlatform(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getPathElements(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def add_PlatformServicer_to_server(servicer, server): rpc_method_handlers = { @@ -230,16 +334,26 @@ def add_PlatformServicer_to_server(servicer, server): request_deserializer=platform__pb2.GetIdentityRequest.FromString, response_serializer=platform__pb2.GetIdentityResponse.SerializeToString, ), - 'getIdentities': grpc.unary_unary_rpc_method_handler( - servicer.getIdentities, - request_deserializer=platform__pb2.GetIdentitiesRequest.FromString, - response_serializer=platform__pb2.GetIdentitiesResponse.SerializeToString, - ), 'getIdentityKeys': grpc.unary_unary_rpc_method_handler( servicer.getIdentityKeys, request_deserializer=platform__pb2.GetIdentityKeysRequest.FromString, response_serializer=platform__pb2.GetIdentityKeysResponse.SerializeToString, ), + 'getIdentitiesContractKeys': grpc.unary_unary_rpc_method_handler( + servicer.getIdentitiesContractKeys, + request_deserializer=platform__pb2.GetIdentitiesContractKeysRequest.FromString, + response_serializer=platform__pb2.GetIdentitiesContractKeysResponse.SerializeToString, + ), + 'getIdentityNonce': grpc.unary_unary_rpc_method_handler( + servicer.getIdentityNonce, + request_deserializer=platform__pb2.GetIdentityNonceRequest.FromString, + response_serializer=platform__pb2.GetIdentityNonceResponse.SerializeToString, + ), + 'getIdentityContractNonce': grpc.unary_unary_rpc_method_handler( + servicer.getIdentityContractNonce, + request_deserializer=platform__pb2.GetIdentityContractNonceRequest.FromString, + response_serializer=platform__pb2.GetIdentityContractNonceResponse.SerializeToString, + ), 'getIdentityBalance': grpc.unary_unary_rpc_method_handler( servicer.getIdentityBalance, request_deserializer=platform__pb2.GetIdentityBalanceRequest.FromString, @@ -275,11 +389,6 @@ def add_PlatformServicer_to_server(servicer, server): request_deserializer=platform__pb2.GetDocumentsRequest.FromString, response_serializer=platform__pb2.GetDocumentsResponse.SerializeToString, ), - 'getIdentitiesByPublicKeyHashes': grpc.unary_unary_rpc_method_handler( - servicer.getIdentitiesByPublicKeyHashes, - request_deserializer=platform__pb2.GetIdentitiesByPublicKeyHashesRequest.FromString, - response_serializer=platform__pb2.GetIdentitiesByPublicKeyHashesResponse.SerializeToString, - ), 'getIdentityByPublicKeyHash': grpc.unary_unary_rpc_method_handler( servicer.getIdentityByPublicKeyHash, request_deserializer=platform__pb2.GetIdentityByPublicKeyHashRequest.FromString, @@ -310,6 +419,46 @@ def add_PlatformServicer_to_server(servicer, server): request_deserializer=platform__pb2.GetEpochsInfoRequest.FromString, response_serializer=platform__pb2.GetEpochsInfoResponse.SerializeToString, ), + 'getContestedResources': grpc.unary_unary_rpc_method_handler( + servicer.getContestedResources, + request_deserializer=platform__pb2.GetContestedResourcesRequest.FromString, + response_serializer=platform__pb2.GetContestedResourcesResponse.SerializeToString, + ), + 'getContestedResourceVoteState': grpc.unary_unary_rpc_method_handler( + servicer.getContestedResourceVoteState, + request_deserializer=platform__pb2.GetContestedResourceVoteStateRequest.FromString, + response_serializer=platform__pb2.GetContestedResourceVoteStateResponse.SerializeToString, + ), + 'getContestedResourceVotersForIdentity': grpc.unary_unary_rpc_method_handler( + servicer.getContestedResourceVotersForIdentity, + request_deserializer=platform__pb2.GetContestedResourceVotersForIdentityRequest.FromString, + response_serializer=platform__pb2.GetContestedResourceVotersForIdentityResponse.SerializeToString, + ), + 'getContestedResourceIdentityVotes': grpc.unary_unary_rpc_method_handler( + servicer.getContestedResourceIdentityVotes, + request_deserializer=platform__pb2.GetContestedResourceIdentityVotesRequest.FromString, + response_serializer=platform__pb2.GetContestedResourceIdentityVotesResponse.SerializeToString, + ), + 'getVotePollsByEndDate': grpc.unary_unary_rpc_method_handler( + servicer.getVotePollsByEndDate, + request_deserializer=platform__pb2.GetVotePollsByEndDateRequest.FromString, + response_serializer=platform__pb2.GetVotePollsByEndDateResponse.SerializeToString, + ), + 'getPrefundedSpecializedBalance': grpc.unary_unary_rpc_method_handler( + servicer.getPrefundedSpecializedBalance, + request_deserializer=platform__pb2.GetPrefundedSpecializedBalanceRequest.FromString, + response_serializer=platform__pb2.GetPrefundedSpecializedBalanceResponse.SerializeToString, + ), + 'getTotalCreditsInPlatform': grpc.unary_unary_rpc_method_handler( + servicer.getTotalCreditsInPlatform, + request_deserializer=platform__pb2.GetTotalCreditsInPlatformRequest.FromString, + response_serializer=platform__pb2.GetTotalCreditsInPlatformResponse.SerializeToString, + ), + 'getPathElements': grpc.unary_unary_rpc_method_handler( + servicer.getPathElements, + request_deserializer=platform__pb2.GetPathElementsRequest.FromString, + response_serializer=platform__pb2.GetPathElementsResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( 'org.dash.platform.dapi.v0.Platform', rpc_method_handlers) @@ -355,7 +504,7 @@ def getIdentity(request, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def getIdentities(request, + def getIdentityKeys(request, target, options=(), channel_credentials=None, @@ -365,14 +514,14 @@ def getIdentities(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentities', - platform__pb2.GetIdentitiesRequest.SerializeToString, - platform__pb2.GetIdentitiesResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityKeys', + platform__pb2.GetIdentityKeysRequest.SerializeToString, + platform__pb2.GetIdentityKeysResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def getIdentityKeys(request, + def getIdentitiesContractKeys(request, target, options=(), channel_credentials=None, @@ -382,9 +531,43 @@ def getIdentityKeys(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityKeys', - platform__pb2.GetIdentityKeysRequest.SerializeToString, - platform__pb2.GetIdentityKeysResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentitiesContractKeys', + platform__pb2.GetIdentitiesContractKeysRequest.SerializeToString, + platform__pb2.GetIdentitiesContractKeysResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getIdentityNonce(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityNonce', + platform__pb2.GetIdentityNonceRequest.SerializeToString, + platform__pb2.GetIdentityNonceResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getIdentityContractNonce(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityContractNonce', + platform__pb2.GetIdentityContractNonceRequest.SerializeToString, + platform__pb2.GetIdentityContractNonceResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -507,23 +690,6 @@ def getDocuments(request, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - @staticmethod - def getIdentitiesByPublicKeyHashes(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes', - platform__pb2.GetIdentitiesByPublicKeyHashesRequest.SerializeToString, - platform__pb2.GetIdentitiesByPublicKeyHashesResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - @staticmethod def getIdentityByPublicKeyHash(request, target, @@ -625,3 +791,139 @@ def getEpochsInfo(request, platform__pb2.GetEpochsInfoResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getContestedResources(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getContestedResources', + platform__pb2.GetContestedResourcesRequest.SerializeToString, + platform__pb2.GetContestedResourcesResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getContestedResourceVoteState(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getContestedResourceVoteState', + platform__pb2.GetContestedResourceVoteStateRequest.SerializeToString, + platform__pb2.GetContestedResourceVoteStateResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getContestedResourceVotersForIdentity(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getContestedResourceVotersForIdentity', + platform__pb2.GetContestedResourceVotersForIdentityRequest.SerializeToString, + platform__pb2.GetContestedResourceVotersForIdentityResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getContestedResourceIdentityVotes(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getContestedResourceIdentityVotes', + platform__pb2.GetContestedResourceIdentityVotesRequest.SerializeToString, + platform__pb2.GetContestedResourceIdentityVotesResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getVotePollsByEndDate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getVotePollsByEndDate', + platform__pb2.GetVotePollsByEndDateRequest.SerializeToString, + platform__pb2.GetVotePollsByEndDateResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getPrefundedSpecializedBalance(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getPrefundedSpecializedBalance', + platform__pb2.GetPrefundedSpecializedBalanceRequest.SerializeToString, + platform__pb2.GetPrefundedSpecializedBalanceResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getTotalCreditsInPlatform(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getTotalCreditsInPlatform', + platform__pb2.GetTotalCreditsInPlatformRequest.SerializeToString, + platform__pb2.GetTotalCreditsInPlatformResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getPathElements(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getPathElements', + platform__pb2.GetPathElementsRequest.SerializeToString, + platform__pb2.GetPathElementsResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs b/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs index 84b1ab6c009..855bec65b37 100644 --- a/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs +++ b/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs @@ -1,6 +1,6 @@ use dapi_grpc::platform::v0 as platform; use dapi_grpc::platform::v0::get_consensus_params_request::GetConsensusParamsRequestV0; -use prost::Message; +use dapi_grpc::Message; fn main() { let request = platform::GetConsensusParamsRequest { diff --git a/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js b/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js index fdb3f86fae4..9805cd84ffb 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js +++ b/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js @@ -7,8 +7,8 @@ class PlatformPromiseClient { * @param {?Object} credentials * @param {?Object} options */ - constructor(hostname, credentials , options = {}) { - this.client = new PlatformClient(hostname, options) + constructor(hostname, credentials, options = {}) { + this.client = new PlatformClient(hostname, options); this.protocolVersion = undefined; } @@ -41,6 +41,20 @@ class PlatformPromiseClient { ); } + /** + * @param {!GetIdentitiesContractKeysRequest} getIdentitiesContractKeysRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentitiesContractKeys(getIdentitiesContractKeysRequest, metadata = {}) { + return promisify( + this.client.getIdentitiesContractKeys.bind(this.client), + )( + getIdentitiesContractKeysRequest, + metadata, + ); + } + /** * * @param {!GetDataContractRequest} getDataContractRequest @@ -87,17 +101,17 @@ class PlatformPromiseClient { } /** - * @param {!GetIdentitiesByPublicKeyHashesRequest} getIdentitiesByPublicKeyHashesRequest + * @param {!GetIdentityByPublicKeyHash} getIdentityByPublicKeyHashRequest * @param {?Object} metadata - * @returns {Promise} + * @returns {Promise} */ - getIdentitiesByPublicKeyHashes( - getIdentitiesByPublicKeyHashesRequest, metadata = {} + getIdentityByPublicKeyHash( + getIdentityByPublicKeyHashRequest, metadata = {} ) { return promisify( - this.client.getIdentitiesByPublicKeyHashes.bind(this.client), + this.client.getIdentityByPublicKeyHash.bind(this.client), )( - getIdentitiesByPublicKeyHashesRequest, + getIdentityByPublicKeyHashRequest, metadata, ); } @@ -176,6 +190,48 @@ class PlatformPromiseClient { ); } + /** + * @param {!GetIdentityContractNonceRequest} getIdentityContractNonceRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentityContractNonce(getIdentityContractNonceRequest, metadata = {}) { + return promisify( + this.client.getIdentityContractNonce.bind(this.client), + )( + getIdentityContractNonceRequest, + metadata, + ); + } + + /** + * @param {!GetIdentityNonceRequest} getIdentityNonceRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentityNonce(getIdentityNonceRequest, metadata = {}) { + return promisify( + this.client.getIdentityNonce.bind(this.client), + )( + getIdentityNonceRequest, + metadata, + ); + } + + /** + * @param {!GetIdentityKeysRequest} getIdentityKeysRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentityKeys(getIdentityKeysRequest, metadata = {}) { + return promisify( + this.client.getIdentityKeys.bind(this.client), + )( + getIdentityKeysRequest, + metadata, + ); + } + /** * @param {string} protocolVersion */ diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts index 9ff5ae3c997..e4c266bee1d 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts @@ -216,6 +216,120 @@ export namespace GetIdentityRequest { } } +export class GetIdentityNonceRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentityNonceRequest.GetIdentityNonceRequestV0 | undefined; + setV0(value?: GetIdentityNonceRequest.GetIdentityNonceRequestV0): void; + + getVersionCase(): GetIdentityNonceRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityNonceRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceRequest): GetIdentityNonceRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityNonceRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceRequest; + static deserializeBinaryFromReader(message: GetIdentityNonceRequest, reader: jspb.BinaryReader): GetIdentityNonceRequest; +} + +export namespace GetIdentityNonceRequest { + export type AsObject = { + v0?: GetIdentityNonceRequest.GetIdentityNonceRequestV0.AsObject, + } + + export class GetIdentityNonceRequestV0 extends jspb.Message { + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityNonceRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceRequestV0): GetIdentityNonceRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityNonceRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceRequestV0; + static deserializeBinaryFromReader(message: GetIdentityNonceRequestV0, reader: jspb.BinaryReader): GetIdentityNonceRequestV0; + } + + export namespace GetIdentityNonceRequestV0 { + export type AsObject = { + identityId: Uint8Array | string, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetIdentityContractNonceRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 | undefined; + setV0(value?: GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0): void; + + getVersionCase(): GetIdentityContractNonceRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityContractNonceRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceRequest): GetIdentityContractNonceRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityContractNonceRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceRequest; + static deserializeBinaryFromReader(message: GetIdentityContractNonceRequest, reader: jspb.BinaryReader): GetIdentityContractNonceRequest; +} + +export namespace GetIdentityContractNonceRequest { + export type AsObject = { + v0?: GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.AsObject, + } + + export class GetIdentityContractNonceRequestV0 extends jspb.Message { + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityContractNonceRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceRequestV0): GetIdentityContractNonceRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityContractNonceRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceRequestV0; + static deserializeBinaryFromReader(message: GetIdentityContractNonceRequestV0, reader: jspb.BinaryReader): GetIdentityContractNonceRequestV0; + } + + export namespace GetIdentityContractNonceRequestV0 { + export type AsObject = { + identityId: Uint8Array | string, + contractId: Uint8Array | string, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + export class GetIdentityBalanceRequest extends jspb.Message { hasV0(): boolean; clearV0(): void; @@ -395,53 +509,66 @@ export namespace GetIdentityResponse { } } -export class GetIdentitiesRequest extends jspb.Message { +export class GetIdentityNonceResponse extends jspb.Message { hasV0(): boolean; clearV0(): void; - getV0(): GetIdentitiesRequest.GetIdentitiesRequestV0 | undefined; - setV0(value?: GetIdentitiesRequest.GetIdentitiesRequestV0): void; + getV0(): GetIdentityNonceResponse.GetIdentityNonceResponseV0 | undefined; + setV0(value?: GetIdentityNonceResponse.GetIdentityNonceResponseV0): void; - getVersionCase(): GetIdentitiesRequest.VersionCase; + getVersionCase(): GetIdentityNonceResponse.VersionCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesRequest): GetIdentitiesRequest.AsObject; + toObject(includeInstance?: boolean): GetIdentityNonceResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceResponse): GetIdentityNonceResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesRequest; - static deserializeBinaryFromReader(message: GetIdentitiesRequest, reader: jspb.BinaryReader): GetIdentitiesRequest; + static serializeBinaryToWriter(message: GetIdentityNonceResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceResponse; + static deserializeBinaryFromReader(message: GetIdentityNonceResponse, reader: jspb.BinaryReader): GetIdentityNonceResponse; } -export namespace GetIdentitiesRequest { +export namespace GetIdentityNonceResponse { export type AsObject = { - v0?: GetIdentitiesRequest.GetIdentitiesRequestV0.AsObject, + v0?: GetIdentityNonceResponse.GetIdentityNonceResponseV0.AsObject, } - export class GetIdentitiesRequestV0 extends jspb.Message { - clearIdsList(): void; - getIdsList(): Array; - getIdsList_asU8(): Array; - getIdsList_asB64(): Array; - setIdsList(value: Array): void; - addIds(value: Uint8Array | string, index?: number): Uint8Array | string; + export class GetIdentityNonceResponseV0 extends jspb.Message { + hasIdentityNonce(): boolean; + clearIdentityNonce(): void; + getIdentityNonce(): number; + setIdentityNonce(value: number): void; - getProve(): boolean; - setProve(value: boolean): void; + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + getResultCase(): GetIdentityNonceResponseV0.ResultCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesRequestV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesRequestV0): GetIdentitiesRequestV0.AsObject; + toObject(includeInstance?: boolean): GetIdentityNonceResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceResponseV0): GetIdentityNonceResponseV0.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesRequestV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesRequestV0; - static deserializeBinaryFromReader(message: GetIdentitiesRequestV0, reader: jspb.BinaryReader): GetIdentitiesRequestV0; + static serializeBinaryToWriter(message: GetIdentityNonceResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceResponseV0; + static deserializeBinaryFromReader(message: GetIdentityNonceResponseV0, reader: jspb.BinaryReader): GetIdentityNonceResponseV0; } - export namespace GetIdentitiesRequestV0 { + export namespace GetIdentityNonceResponseV0 { export type AsObject = { - idsList: Array, - prove: boolean, + identityNonce: number, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + IDENTITY_NONCE = 1, + PROOF = 2, } } @@ -451,105 +578,33 @@ export namespace GetIdentitiesRequest { } } -export class GetIdentitiesResponse extends jspb.Message { +export class GetIdentityContractNonceResponse extends jspb.Message { hasV0(): boolean; clearV0(): void; - getV0(): GetIdentitiesResponse.GetIdentitiesResponseV0 | undefined; - setV0(value?: GetIdentitiesResponse.GetIdentitiesResponseV0): void; + getV0(): GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 | undefined; + setV0(value?: GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0): void; - getVersionCase(): GetIdentitiesResponse.VersionCase; + getVersionCase(): GetIdentityContractNonceResponse.VersionCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesResponse.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesResponse): GetIdentitiesResponse.AsObject; + toObject(includeInstance?: boolean): GetIdentityContractNonceResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceResponse): GetIdentityContractNonceResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesResponse; - static deserializeBinaryFromReader(message: GetIdentitiesResponse, reader: jspb.BinaryReader): GetIdentitiesResponse; + static serializeBinaryToWriter(message: GetIdentityContractNonceResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceResponse; + static deserializeBinaryFromReader(message: GetIdentityContractNonceResponse, reader: jspb.BinaryReader): GetIdentityContractNonceResponse; } -export namespace GetIdentitiesResponse { +export namespace GetIdentityContractNonceResponse { export type AsObject = { - v0?: GetIdentitiesResponse.GetIdentitiesResponseV0.AsObject, - } - - export class IdentityValue extends jspb.Message { - getValue(): Uint8Array | string; - getValue_asU8(): Uint8Array; - getValue_asB64(): string; - setValue(value: Uint8Array | string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): IdentityValue.AsObject; - static toObject(includeInstance: boolean, msg: IdentityValue): IdentityValue.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: IdentityValue, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): IdentityValue; - static deserializeBinaryFromReader(message: IdentityValue, reader: jspb.BinaryReader): IdentityValue; - } - - export namespace IdentityValue { - export type AsObject = { - value: Uint8Array | string, - } - } - - export class IdentityEntry extends jspb.Message { - getKey(): Uint8Array | string; - getKey_asU8(): Uint8Array; - getKey_asB64(): string; - setKey(value: Uint8Array | string): void; - - hasValue(): boolean; - clearValue(): void; - getValue(): GetIdentitiesResponse.IdentityValue | undefined; - setValue(value?: GetIdentitiesResponse.IdentityValue): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): IdentityEntry.AsObject; - static toObject(includeInstance: boolean, msg: IdentityEntry): IdentityEntry.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: IdentityEntry, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): IdentityEntry; - static deserializeBinaryFromReader(message: IdentityEntry, reader: jspb.BinaryReader): IdentityEntry; - } - - export namespace IdentityEntry { - export type AsObject = { - key: Uint8Array | string, - value?: GetIdentitiesResponse.IdentityValue.AsObject, - } - } - - export class Identities extends jspb.Message { - clearIdentityEntriesList(): void; - getIdentityEntriesList(): Array; - setIdentityEntriesList(value: Array): void; - addIdentityEntries(value?: GetIdentitiesResponse.IdentityEntry, index?: number): GetIdentitiesResponse.IdentityEntry; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Identities.AsObject; - static toObject(includeInstance: boolean, msg: Identities): Identities.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Identities, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Identities; - static deserializeBinaryFromReader(message: Identities, reader: jspb.BinaryReader): Identities; - } - - export namespace Identities { - export type AsObject = { - identityEntriesList: Array, - } + v0?: GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.AsObject, } - export class GetIdentitiesResponseV0 extends jspb.Message { - hasIdentities(): boolean; - clearIdentities(): void; - getIdentities(): GetIdentitiesResponse.Identities | undefined; - setIdentities(value?: GetIdentitiesResponse.Identities): void; + export class GetIdentityContractNonceResponseV0 extends jspb.Message { + hasIdentityContractNonce(): boolean; + clearIdentityContractNonce(): void; + getIdentityContractNonce(): number; + setIdentityContractNonce(value: number): void; hasProof(): boolean; clearProof(): void; @@ -561,27 +616,27 @@ export namespace GetIdentitiesResponse { getMetadata(): ResponseMetadata | undefined; setMetadata(value?: ResponseMetadata): void; - getResultCase(): GetIdentitiesResponseV0.ResultCase; + getResultCase(): GetIdentityContractNonceResponseV0.ResultCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesResponseV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesResponseV0): GetIdentitiesResponseV0.AsObject; + toObject(includeInstance?: boolean): GetIdentityContractNonceResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceResponseV0): GetIdentityContractNonceResponseV0.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesResponseV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesResponseV0; - static deserializeBinaryFromReader(message: GetIdentitiesResponseV0, reader: jspb.BinaryReader): GetIdentitiesResponseV0; + static serializeBinaryToWriter(message: GetIdentityContractNonceResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceResponseV0; + static deserializeBinaryFromReader(message: GetIdentityContractNonceResponseV0, reader: jspb.BinaryReader): GetIdentityContractNonceResponseV0; } - export namespace GetIdentitiesResponseV0 { + export namespace GetIdentityContractNonceResponseV0 { export type AsObject = { - identities?: GetIdentitiesResponse.Identities.AsObject, + identityContractNonce: number, proof?: Proof.AsObject, metadata?: ResponseMetadata.AsObject, } export enum ResultCase { RESULT_NOT_SET = 0, - IDENTITIES = 1, + IDENTITY_CONTRACT_NONCE = 1, PROOF = 2, } } @@ -1044,6 +1099,227 @@ export namespace GetIdentityKeysResponse { } } +export class GetIdentitiesContractKeysRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 | undefined; + setV0(value?: GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0): void; + + getVersionCase(): GetIdentitiesContractKeysRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysRequest): GetIdentitiesContractKeysRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysRequest; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysRequest, reader: jspb.BinaryReader): GetIdentitiesContractKeysRequest; +} + +export namespace GetIdentitiesContractKeysRequest { + export type AsObject = { + v0?: GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.AsObject, + } + + export class GetIdentitiesContractKeysRequestV0 extends jspb.Message { + clearIdentitiesIdsList(): void; + getIdentitiesIdsList(): Array; + getIdentitiesIdsList_asU8(): Array; + getIdentitiesIdsList_asB64(): Array; + setIdentitiesIdsList(value: Array): void; + addIdentitiesIds(value: Uint8Array | string, index?: number): Uint8Array | string; + + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + hasDocumentTypeName(): boolean; + clearDocumentTypeName(): void; + getDocumentTypeName(): string; + setDocumentTypeName(value: string): void; + + clearPurposesList(): void; + getPurposesList(): Array; + setPurposesList(value: Array): void; + addPurposes(value: KeyPurposeMap[keyof KeyPurposeMap], index?: number): KeyPurposeMap[keyof KeyPurposeMap]; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysRequestV0): GetIdentitiesContractKeysRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysRequestV0; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysRequestV0, reader: jspb.BinaryReader): GetIdentitiesContractKeysRequestV0; + } + + export namespace GetIdentitiesContractKeysRequestV0 { + export type AsObject = { + identitiesIdsList: Array, + contractId: Uint8Array | string, + documentTypeName: string, + purposesList: Array, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetIdentitiesContractKeysResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 | undefined; + setV0(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0): void; + + getVersionCase(): GetIdentitiesContractKeysResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysResponse): GetIdentitiesContractKeysResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysResponse; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysResponse, reader: jspb.BinaryReader): GetIdentitiesContractKeysResponse; +} + +export namespace GetIdentitiesContractKeysResponse { + export type AsObject = { + v0?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.AsObject, + } + + export class GetIdentitiesContractKeysResponseV0 extends jspb.Message { + hasIdentitiesKeys(): boolean; + clearIdentitiesKeys(): void; + getIdentitiesKeys(): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys | undefined; + setIdentitiesKeys(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetIdentitiesContractKeysResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysResponseV0): GetIdentitiesContractKeysResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysResponseV0; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysResponseV0, reader: jspb.BinaryReader): GetIdentitiesContractKeysResponseV0; + } + + export namespace GetIdentitiesContractKeysResponseV0 { + export type AsObject = { + identitiesKeys?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class PurposeKeys extends jspb.Message { + getPurpose(): KeyPurposeMap[keyof KeyPurposeMap]; + setPurpose(value: KeyPurposeMap[keyof KeyPurposeMap]): void; + + clearKeysBytesList(): void; + getKeysBytesList(): Array; + getKeysBytesList_asU8(): Array; + getKeysBytesList_asB64(): Array; + setKeysBytesList(value: Array): void; + addKeysBytes(value: Uint8Array | string, index?: number): Uint8Array | string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PurposeKeys.AsObject; + static toObject(includeInstance: boolean, msg: PurposeKeys): PurposeKeys.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PurposeKeys, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PurposeKeys; + static deserializeBinaryFromReader(message: PurposeKeys, reader: jspb.BinaryReader): PurposeKeys; + } + + export namespace PurposeKeys { + export type AsObject = { + purpose: KeyPurposeMap[keyof KeyPurposeMap], + keysBytesList: Array, + } + } + + export class IdentityKeys extends jspb.Message { + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + clearKeysList(): void; + getKeysList(): Array; + setKeysList(value: Array): void; + addKeys(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, index?: number): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): IdentityKeys.AsObject; + static toObject(includeInstance: boolean, msg: IdentityKeys): IdentityKeys.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: IdentityKeys, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): IdentityKeys; + static deserializeBinaryFromReader(message: IdentityKeys, reader: jspb.BinaryReader): IdentityKeys; + } + + export namespace IdentityKeys { + export type AsObject = { + identityId: Uint8Array | string, + keysList: Array, + } + } + + export class IdentitiesKeys extends jspb.Message { + clearEntriesList(): void; + getEntriesList(): Array; + setEntriesList(value: Array): void; + addEntries(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, index?: number): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): IdentitiesKeys.AsObject; + static toObject(includeInstance: boolean, msg: IdentitiesKeys): IdentitiesKeys.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: IdentitiesKeys, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): IdentitiesKeys; + static deserializeBinaryFromReader(message: IdentitiesKeys, reader: jspb.BinaryReader): IdentitiesKeys; + } + + export namespace IdentitiesKeys { + export type AsObject = { + entriesList: Array, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + IDENTITIES_KEYS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + export class GetProofsRequest extends jspb.Message { hasV0(): boolean; clearV0(): void; @@ -1082,6 +1358,11 @@ export namespace GetProofsRequest { setDocumentsList(value: Array): void; addDocuments(value?: GetProofsRequest.GetProofsRequestV0.DocumentRequest, index?: number): GetProofsRequest.GetProofsRequestV0.DocumentRequest; + clearVotesList(): void; + getVotesList(): Array; + setVotesList(value: Array): void; + addVotes(value?: GetProofsRequest.GetProofsRequestV0.VoteStatusRequest, index?: number): GetProofsRequest.GetProofsRequestV0.VoteStatusRequest; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetProofsRequestV0.AsObject; static toObject(includeInstance: boolean, msg: GetProofsRequestV0): GetProofsRequestV0.AsObject; @@ -1097,6 +1378,7 @@ export namespace GetProofsRequest { identitiesList: Array, contractsList: Array, documentsList: Array, + votesList: Array, } export class DocumentRequest extends jspb.Message { @@ -1116,6 +1398,9 @@ export namespace GetProofsRequest { getDocumentId_asB64(): string; setDocumentId(value: Uint8Array | string): void; + getDocumentContestedStatus(): GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatusMap[keyof GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatusMap]; + setDocumentContestedStatus(value: GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatusMap[keyof GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatusMap]): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): DocumentRequest.AsObject; static toObject(includeInstance: boolean, msg: DocumentRequest): DocumentRequest.AsObject; @@ -1132,10 +1417,19 @@ export namespace GetProofsRequest { documentType: string, documentTypeKeepsHistory: boolean, documentId: Uint8Array | string, + documentContestedStatus: GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatusMap[keyof GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatusMap], } - } - export class IdentityRequest extends jspb.Message { + export interface DocumentContestedStatusMap { + NOT_CONTESTED: 0; + MAYBE_CONTESTED: 1; + CONTESTED: 2; + } + + export const DocumentContestedStatus: DocumentContestedStatusMap; + } + + export class IdentityRequest extends jspb.Message { getIdentityId(): Uint8Array | string; getIdentityId_asU8(): Uint8Array; getIdentityId_asB64(): string; @@ -1164,6 +1458,7 @@ export namespace GetProofsRequest { FULL_IDENTITY: 0; BALANCE: 1; KEYS: 2; + REVISION: 3; } export const Type: TypeMap; @@ -1190,6 +1485,78 @@ export namespace GetProofsRequest { contractId: Uint8Array | string, } } + + export class VoteStatusRequest extends jspb.Message { + hasContestedResourceVoteStatusRequest(): boolean; + clearContestedResourceVoteStatusRequest(): void; + getContestedResourceVoteStatusRequest(): GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest | undefined; + setContestedResourceVoteStatusRequest(value?: GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest): void; + + getRequestTypeCase(): VoteStatusRequest.RequestTypeCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): VoteStatusRequest.AsObject; + static toObject(includeInstance: boolean, msg: VoteStatusRequest): VoteStatusRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: VoteStatusRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): VoteStatusRequest; + static deserializeBinaryFromReader(message: VoteStatusRequest, reader: jspb.BinaryReader): VoteStatusRequest; + } + + export namespace VoteStatusRequest { + export type AsObject = { + contestedResourceVoteStatusRequest?: GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.AsObject, + } + + export class ContestedResourceVoteStatusRequest extends jspb.Message { + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + getDocumentTypeName(): string; + setDocumentTypeName(value: string): void; + + getIndexName(): string; + setIndexName(value: string): void; + + clearIndexValuesList(): void; + getIndexValuesList(): Array; + getIndexValuesList_asU8(): Array; + getIndexValuesList_asB64(): Array; + setIndexValuesList(value: Array): void; + addIndexValues(value: Uint8Array | string, index?: number): Uint8Array | string; + + getVoterIdentifier(): Uint8Array | string; + getVoterIdentifier_asU8(): Uint8Array; + getVoterIdentifier_asB64(): string; + setVoterIdentifier(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContestedResourceVoteStatusRequest.AsObject; + static toObject(includeInstance: boolean, msg: ContestedResourceVoteStatusRequest): ContestedResourceVoteStatusRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContestedResourceVoteStatusRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContestedResourceVoteStatusRequest; + static deserializeBinaryFromReader(message: ContestedResourceVoteStatusRequest, reader: jspb.BinaryReader): ContestedResourceVoteStatusRequest; + } + + export namespace ContestedResourceVoteStatusRequest { + export type AsObject = { + contractId: Uint8Array | string, + documentTypeName: string, + indexName: string, + indexValuesList: Array, + voterIdentifier: Uint8Array | string, + } + } + + export enum RequestTypeCase { + REQUEST_TYPE_NOT_SET = 0, + CONTESTED_RESOURCE_VOTE_STATUS_REQUEST = 1, + } + } } export enum VersionCase { @@ -1937,181 +2304,6 @@ export namespace GetDocumentsResponse { } } -export class GetIdentitiesByPublicKeyHashesRequest extends jspb.Message { - hasV0(): boolean; - clearV0(): void; - getV0(): GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 | undefined; - setV0(value?: GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0): void; - - getVersionCase(): GetIdentitiesByPublicKeyHashesRequest.VersionCase; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesRequest): GetIdentitiesByPublicKeyHashesRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesRequest; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesRequest, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesRequest; -} - -export namespace GetIdentitiesByPublicKeyHashesRequest { - export type AsObject = { - v0?: GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.AsObject, - } - - export class GetIdentitiesByPublicKeyHashesRequestV0 extends jspb.Message { - clearPublicKeyHashesList(): void; - getPublicKeyHashesList(): Array; - getPublicKeyHashesList_asU8(): Array; - getPublicKeyHashesList_asB64(): Array; - setPublicKeyHashesList(value: Array): void; - addPublicKeyHashes(value: Uint8Array | string, index?: number): Uint8Array | string; - - getProve(): boolean; - setProve(value: boolean): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesRequestV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesRequestV0): GetIdentitiesByPublicKeyHashesRequestV0.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesRequestV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesRequestV0; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesRequestV0, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesRequestV0; - } - - export namespace GetIdentitiesByPublicKeyHashesRequestV0 { - export type AsObject = { - publicKeyHashesList: Array, - prove: boolean, - } - } - - export enum VersionCase { - VERSION_NOT_SET = 0, - V0 = 1, - } -} - -export class GetIdentitiesByPublicKeyHashesResponse extends jspb.Message { - hasV0(): boolean; - clearV0(): void; - getV0(): GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 | undefined; - setV0(value?: GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0): void; - - getVersionCase(): GetIdentitiesByPublicKeyHashesResponse.VersionCase; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesResponse.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesResponse): GetIdentitiesByPublicKeyHashesResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesResponse; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesResponse, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesResponse; -} - -export namespace GetIdentitiesByPublicKeyHashesResponse { - export type AsObject = { - v0?: GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.AsObject, - } - - export class PublicKeyHashIdentityEntry extends jspb.Message { - getPublicKeyHash(): Uint8Array | string; - getPublicKeyHash_asU8(): Uint8Array; - getPublicKeyHash_asB64(): string; - setPublicKeyHash(value: Uint8Array | string): void; - - hasValue(): boolean; - clearValue(): void; - getValue(): google_protobuf_wrappers_pb.BytesValue | undefined; - setValue(value?: google_protobuf_wrappers_pb.BytesValue): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PublicKeyHashIdentityEntry.AsObject; - static toObject(includeInstance: boolean, msg: PublicKeyHashIdentityEntry): PublicKeyHashIdentityEntry.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PublicKeyHashIdentityEntry, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PublicKeyHashIdentityEntry; - static deserializeBinaryFromReader(message: PublicKeyHashIdentityEntry, reader: jspb.BinaryReader): PublicKeyHashIdentityEntry; - } - - export namespace PublicKeyHashIdentityEntry { - export type AsObject = { - publicKeyHash: Uint8Array | string, - value?: google_protobuf_wrappers_pb.BytesValue.AsObject, - } - } - - export class IdentitiesByPublicKeyHashes extends jspb.Message { - clearIdentityEntriesList(): void; - getIdentityEntriesList(): Array; - setIdentityEntriesList(value: Array): void; - addIdentityEntries(value?: GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, index?: number): GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): IdentitiesByPublicKeyHashes.AsObject; - static toObject(includeInstance: boolean, msg: IdentitiesByPublicKeyHashes): IdentitiesByPublicKeyHashes.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: IdentitiesByPublicKeyHashes, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): IdentitiesByPublicKeyHashes; - static deserializeBinaryFromReader(message: IdentitiesByPublicKeyHashes, reader: jspb.BinaryReader): IdentitiesByPublicKeyHashes; - } - - export namespace IdentitiesByPublicKeyHashes { - export type AsObject = { - identityEntriesList: Array, - } - } - - export class GetIdentitiesByPublicKeyHashesResponseV0 extends jspb.Message { - hasIdentities(): boolean; - clearIdentities(): void; - getIdentities(): GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes | undefined; - setIdentities(value?: GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes): void; - - hasProof(): boolean; - clearProof(): void; - getProof(): Proof | undefined; - setProof(value?: Proof): void; - - hasMetadata(): boolean; - clearMetadata(): void; - getMetadata(): ResponseMetadata | undefined; - setMetadata(value?: ResponseMetadata): void; - - getResultCase(): GetIdentitiesByPublicKeyHashesResponseV0.ResultCase; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesResponseV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesResponseV0): GetIdentitiesByPublicKeyHashesResponseV0.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesResponseV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesResponseV0; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesResponseV0, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesResponseV0; - } - - export namespace GetIdentitiesByPublicKeyHashesResponseV0 { - export type AsObject = { - identities?: GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.AsObject, - proof?: Proof.AsObject, - metadata?: ResponseMetadata.AsObject, - } - - export enum ResultCase { - RESULT_NOT_SET = 0, - IDENTITIES = 1, - PROOF = 2, - } - } - - export enum VersionCase { - VERSION_NOT_SET = 0, - V0 = 1, - } -} - export class GetIdentityByPublicKeyHashRequest extends jspb.Message { hasV0(): boolean; clearV0(): void; @@ -3018,6 +3210,9 @@ export namespace GetEpochsInfoResponse { getFeeMultiplier(): number; setFeeMultiplier(value: number): void; + getProtocolVersion(): number; + setProtocolVersion(value: number): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): EpochInfo.AsObject; static toObject(includeInstance: boolean, msg: EpochInfo): EpochInfo.AsObject; @@ -3035,6 +3230,7 @@ export namespace GetEpochsInfoResponse { firstCoreBlockHeight: number, startTime: number, feeMultiplier: number, + protocolVersion: number, } } @@ -3051,3 +3247,1679 @@ export namespace GetEpochsInfoResponse { } } +export class GetContestedResourcesRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourcesRequest.GetContestedResourcesRequestV0 | undefined; + setV0(value?: GetContestedResourcesRequest.GetContestedResourcesRequestV0): void; + + getVersionCase(): GetContestedResourcesRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourcesRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourcesRequest): GetContestedResourcesRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourcesRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourcesRequest; + static deserializeBinaryFromReader(message: GetContestedResourcesRequest, reader: jspb.BinaryReader): GetContestedResourcesRequest; +} + +export namespace GetContestedResourcesRequest { + export type AsObject = { + v0?: GetContestedResourcesRequest.GetContestedResourcesRequestV0.AsObject, + } + + export class GetContestedResourcesRequestV0 extends jspb.Message { + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + getDocumentTypeName(): string; + setDocumentTypeName(value: string): void; + + getIndexName(): string; + setIndexName(value: string): void; + + clearStartIndexValuesList(): void; + getStartIndexValuesList(): Array; + getStartIndexValuesList_asU8(): Array; + getStartIndexValuesList_asB64(): Array; + setStartIndexValuesList(value: Array): void; + addStartIndexValues(value: Uint8Array | string, index?: number): Uint8Array | string; + + clearEndIndexValuesList(): void; + getEndIndexValuesList(): Array; + getEndIndexValuesList_asU8(): Array; + getEndIndexValuesList_asB64(): Array; + setEndIndexValuesList(value: Array): void; + addEndIndexValues(value: Uint8Array | string, index?: number): Uint8Array | string; + + hasStartAtValueInfo(): boolean; + clearStartAtValueInfo(): void; + getStartAtValueInfo(): GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo | undefined; + setStartAtValueInfo(value?: GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo): void; + + hasCount(): boolean; + clearCount(): void; + getCount(): number; + setCount(value: number): void; + + getOrderAscending(): boolean; + setOrderAscending(value: boolean): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourcesRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourcesRequestV0): GetContestedResourcesRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourcesRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourcesRequestV0; + static deserializeBinaryFromReader(message: GetContestedResourcesRequestV0, reader: jspb.BinaryReader): GetContestedResourcesRequestV0; + } + + export namespace GetContestedResourcesRequestV0 { + export type AsObject = { + contractId: Uint8Array | string, + documentTypeName: string, + indexName: string, + startIndexValuesList: Array, + endIndexValuesList: Array, + startAtValueInfo?: GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.AsObject, + count: number, + orderAscending: boolean, + prove: boolean, + } + + export class StartAtValueInfo extends jspb.Message { + getStartValue(): Uint8Array | string; + getStartValue_asU8(): Uint8Array; + getStartValue_asB64(): string; + setStartValue(value: Uint8Array | string): void; + + getStartValueIncluded(): boolean; + setStartValueIncluded(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StartAtValueInfo.AsObject; + static toObject(includeInstance: boolean, msg: StartAtValueInfo): StartAtValueInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StartAtValueInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StartAtValueInfo; + static deserializeBinaryFromReader(message: StartAtValueInfo, reader: jspb.BinaryReader): StartAtValueInfo; + } + + export namespace StartAtValueInfo { + export type AsObject = { + startValue: Uint8Array | string, + startValueIncluded: boolean, + } + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetContestedResourcesResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourcesResponse.GetContestedResourcesResponseV0 | undefined; + setV0(value?: GetContestedResourcesResponse.GetContestedResourcesResponseV0): void; + + getVersionCase(): GetContestedResourcesResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourcesResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourcesResponse): GetContestedResourcesResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourcesResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourcesResponse; + static deserializeBinaryFromReader(message: GetContestedResourcesResponse, reader: jspb.BinaryReader): GetContestedResourcesResponse; +} + +export namespace GetContestedResourcesResponse { + export type AsObject = { + v0?: GetContestedResourcesResponse.GetContestedResourcesResponseV0.AsObject, + } + + export class GetContestedResourcesResponseV0 extends jspb.Message { + hasContestedResourceValues(): boolean; + clearContestedResourceValues(): void; + getContestedResourceValues(): GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues | undefined; + setContestedResourceValues(value?: GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetContestedResourcesResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourcesResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourcesResponseV0): GetContestedResourcesResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourcesResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourcesResponseV0; + static deserializeBinaryFromReader(message: GetContestedResourcesResponseV0, reader: jspb.BinaryReader): GetContestedResourcesResponseV0; + } + + export namespace GetContestedResourcesResponseV0 { + export type AsObject = { + contestedResourceValues?: GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class ContestedResourceValues extends jspb.Message { + clearContestedResourceValuesList(): void; + getContestedResourceValuesList(): Array; + getContestedResourceValuesList_asU8(): Array; + getContestedResourceValuesList_asB64(): Array; + setContestedResourceValuesList(value: Array): void; + addContestedResourceValues(value: Uint8Array | string, index?: number): Uint8Array | string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContestedResourceValues.AsObject; + static toObject(includeInstance: boolean, msg: ContestedResourceValues): ContestedResourceValues.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContestedResourceValues, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContestedResourceValues; + static deserializeBinaryFromReader(message: ContestedResourceValues, reader: jspb.BinaryReader): ContestedResourceValues; + } + + export namespace ContestedResourceValues { + export type AsObject = { + contestedResourceValuesList: Array, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + CONTESTED_RESOURCE_VALUES = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetVotePollsByEndDateRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 | undefined; + setV0(value?: GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0): void; + + getVersionCase(): GetVotePollsByEndDateRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetVotePollsByEndDateRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetVotePollsByEndDateRequest): GetVotePollsByEndDateRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetVotePollsByEndDateRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetVotePollsByEndDateRequest; + static deserializeBinaryFromReader(message: GetVotePollsByEndDateRequest, reader: jspb.BinaryReader): GetVotePollsByEndDateRequest; +} + +export namespace GetVotePollsByEndDateRequest { + export type AsObject = { + v0?: GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.AsObject, + } + + export class GetVotePollsByEndDateRequestV0 extends jspb.Message { + hasStartTimeInfo(): boolean; + clearStartTimeInfo(): void; + getStartTimeInfo(): GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo | undefined; + setStartTimeInfo(value?: GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo): void; + + hasEndTimeInfo(): boolean; + clearEndTimeInfo(): void; + getEndTimeInfo(): GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo | undefined; + setEndTimeInfo(value?: GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo): void; + + hasLimit(): boolean; + clearLimit(): void; + getLimit(): number; + setLimit(value: number): void; + + hasOffset(): boolean; + clearOffset(): void; + getOffset(): number; + setOffset(value: number): void; + + getAscending(): boolean; + setAscending(value: boolean): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetVotePollsByEndDateRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetVotePollsByEndDateRequestV0): GetVotePollsByEndDateRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetVotePollsByEndDateRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetVotePollsByEndDateRequestV0; + static deserializeBinaryFromReader(message: GetVotePollsByEndDateRequestV0, reader: jspb.BinaryReader): GetVotePollsByEndDateRequestV0; + } + + export namespace GetVotePollsByEndDateRequestV0 { + export type AsObject = { + startTimeInfo?: GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.AsObject, + endTimeInfo?: GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.AsObject, + limit: number, + offset: number, + ascending: boolean, + prove: boolean, + } + + export class StartAtTimeInfo extends jspb.Message { + getStartTimeMs(): number; + setStartTimeMs(value: number): void; + + getStartTimeIncluded(): boolean; + setStartTimeIncluded(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StartAtTimeInfo.AsObject; + static toObject(includeInstance: boolean, msg: StartAtTimeInfo): StartAtTimeInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StartAtTimeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StartAtTimeInfo; + static deserializeBinaryFromReader(message: StartAtTimeInfo, reader: jspb.BinaryReader): StartAtTimeInfo; + } + + export namespace StartAtTimeInfo { + export type AsObject = { + startTimeMs: number, + startTimeIncluded: boolean, + } + } + + export class EndAtTimeInfo extends jspb.Message { + getEndTimeMs(): number; + setEndTimeMs(value: number): void; + + getEndTimeIncluded(): boolean; + setEndTimeIncluded(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EndAtTimeInfo.AsObject; + static toObject(includeInstance: boolean, msg: EndAtTimeInfo): EndAtTimeInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EndAtTimeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EndAtTimeInfo; + static deserializeBinaryFromReader(message: EndAtTimeInfo, reader: jspb.BinaryReader): EndAtTimeInfo; + } + + export namespace EndAtTimeInfo { + export type AsObject = { + endTimeMs: number, + endTimeIncluded: boolean, + } + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetVotePollsByEndDateResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 | undefined; + setV0(value?: GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0): void; + + getVersionCase(): GetVotePollsByEndDateResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetVotePollsByEndDateResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetVotePollsByEndDateResponse): GetVotePollsByEndDateResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetVotePollsByEndDateResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetVotePollsByEndDateResponse; + static deserializeBinaryFromReader(message: GetVotePollsByEndDateResponse, reader: jspb.BinaryReader): GetVotePollsByEndDateResponse; +} + +export namespace GetVotePollsByEndDateResponse { + export type AsObject = { + v0?: GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.AsObject, + } + + export class GetVotePollsByEndDateResponseV0 extends jspb.Message { + hasVotePollsByTimestamps(): boolean; + clearVotePollsByTimestamps(): void; + getVotePollsByTimestamps(): GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps | undefined; + setVotePollsByTimestamps(value?: GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetVotePollsByEndDateResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetVotePollsByEndDateResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetVotePollsByEndDateResponseV0): GetVotePollsByEndDateResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetVotePollsByEndDateResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetVotePollsByEndDateResponseV0; + static deserializeBinaryFromReader(message: GetVotePollsByEndDateResponseV0, reader: jspb.BinaryReader): GetVotePollsByEndDateResponseV0; + } + + export namespace GetVotePollsByEndDateResponseV0 { + export type AsObject = { + votePollsByTimestamps?: GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class SerializedVotePollsByTimestamp extends jspb.Message { + getTimestamp(): number; + setTimestamp(value: number): void; + + clearSerializedVotePollsList(): void; + getSerializedVotePollsList(): Array; + getSerializedVotePollsList_asU8(): Array; + getSerializedVotePollsList_asB64(): Array; + setSerializedVotePollsList(value: Array): void; + addSerializedVotePolls(value: Uint8Array | string, index?: number): Uint8Array | string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SerializedVotePollsByTimestamp.AsObject; + static toObject(includeInstance: boolean, msg: SerializedVotePollsByTimestamp): SerializedVotePollsByTimestamp.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SerializedVotePollsByTimestamp, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SerializedVotePollsByTimestamp; + static deserializeBinaryFromReader(message: SerializedVotePollsByTimestamp, reader: jspb.BinaryReader): SerializedVotePollsByTimestamp; + } + + export namespace SerializedVotePollsByTimestamp { + export type AsObject = { + timestamp: number, + serializedVotePollsList: Array, + } + } + + export class SerializedVotePollsByTimestamps extends jspb.Message { + clearVotePollsByTimestampsList(): void; + getVotePollsByTimestampsList(): Array; + setVotePollsByTimestampsList(value: Array): void; + addVotePollsByTimestamps(value?: GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp, index?: number): GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp; + + getFinishedResults(): boolean; + setFinishedResults(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SerializedVotePollsByTimestamps.AsObject; + static toObject(includeInstance: boolean, msg: SerializedVotePollsByTimestamps): SerializedVotePollsByTimestamps.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SerializedVotePollsByTimestamps, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SerializedVotePollsByTimestamps; + static deserializeBinaryFromReader(message: SerializedVotePollsByTimestamps, reader: jspb.BinaryReader): SerializedVotePollsByTimestamps; + } + + export namespace SerializedVotePollsByTimestamps { + export type AsObject = { + votePollsByTimestampsList: Array, + finishedResults: boolean, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + VOTE_POLLS_BY_TIMESTAMPS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetContestedResourceVoteStateRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 | undefined; + setV0(value?: GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0): void; + + getVersionCase(): GetContestedResourceVoteStateRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVoteStateRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVoteStateRequest): GetContestedResourceVoteStateRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVoteStateRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVoteStateRequest; + static deserializeBinaryFromReader(message: GetContestedResourceVoteStateRequest, reader: jspb.BinaryReader): GetContestedResourceVoteStateRequest; +} + +export namespace GetContestedResourceVoteStateRequest { + export type AsObject = { + v0?: GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.AsObject, + } + + export class GetContestedResourceVoteStateRequestV0 extends jspb.Message { + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + getDocumentTypeName(): string; + setDocumentTypeName(value: string): void; + + getIndexName(): string; + setIndexName(value: string): void; + + clearIndexValuesList(): void; + getIndexValuesList(): Array; + getIndexValuesList_asU8(): Array; + getIndexValuesList_asB64(): Array; + setIndexValuesList(value: Array): void; + addIndexValues(value: Uint8Array | string, index?: number): Uint8Array | string; + + getResultType(): GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultTypeMap[keyof GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultTypeMap]; + setResultType(value: GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultTypeMap[keyof GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultTypeMap]): void; + + getAllowIncludeLockedAndAbstainingVoteTally(): boolean; + setAllowIncludeLockedAndAbstainingVoteTally(value: boolean): void; + + hasStartAtIdentifierInfo(): boolean; + clearStartAtIdentifierInfo(): void; + getStartAtIdentifierInfo(): GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo | undefined; + setStartAtIdentifierInfo(value?: GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo): void; + + hasCount(): boolean; + clearCount(): void; + getCount(): number; + setCount(value: number): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVoteStateRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVoteStateRequestV0): GetContestedResourceVoteStateRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVoteStateRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVoteStateRequestV0; + static deserializeBinaryFromReader(message: GetContestedResourceVoteStateRequestV0, reader: jspb.BinaryReader): GetContestedResourceVoteStateRequestV0; + } + + export namespace GetContestedResourceVoteStateRequestV0 { + export type AsObject = { + contractId: Uint8Array | string, + documentTypeName: string, + indexName: string, + indexValuesList: Array, + resultType: GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultTypeMap[keyof GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultTypeMap], + allowIncludeLockedAndAbstainingVoteTally: boolean, + startAtIdentifierInfo?: GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.AsObject, + count: number, + prove: boolean, + } + + export class StartAtIdentifierInfo extends jspb.Message { + getStartIdentifier(): Uint8Array | string; + getStartIdentifier_asU8(): Uint8Array; + getStartIdentifier_asB64(): string; + setStartIdentifier(value: Uint8Array | string): void; + + getStartIdentifierIncluded(): boolean; + setStartIdentifierIncluded(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StartAtIdentifierInfo.AsObject; + static toObject(includeInstance: boolean, msg: StartAtIdentifierInfo): StartAtIdentifierInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StartAtIdentifierInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StartAtIdentifierInfo; + static deserializeBinaryFromReader(message: StartAtIdentifierInfo, reader: jspb.BinaryReader): StartAtIdentifierInfo; + } + + export namespace StartAtIdentifierInfo { + export type AsObject = { + startIdentifier: Uint8Array | string, + startIdentifierIncluded: boolean, + } + } + + export interface ResultTypeMap { + DOCUMENTS: 0; + VOTE_TALLY: 1; + DOCUMENTS_AND_VOTE_TALLY: 2; + } + + export const ResultType: ResultTypeMap; + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetContestedResourceVoteStateResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 | undefined; + setV0(value?: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0): void; + + getVersionCase(): GetContestedResourceVoteStateResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVoteStateResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVoteStateResponse): GetContestedResourceVoteStateResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVoteStateResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVoteStateResponse; + static deserializeBinaryFromReader(message: GetContestedResourceVoteStateResponse, reader: jspb.BinaryReader): GetContestedResourceVoteStateResponse; +} + +export namespace GetContestedResourceVoteStateResponse { + export type AsObject = { + v0?: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.AsObject, + } + + export class GetContestedResourceVoteStateResponseV0 extends jspb.Message { + hasContestedResourceContenders(): boolean; + clearContestedResourceContenders(): void; + getContestedResourceContenders(): GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders | undefined; + setContestedResourceContenders(value?: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetContestedResourceVoteStateResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVoteStateResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVoteStateResponseV0): GetContestedResourceVoteStateResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVoteStateResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVoteStateResponseV0; + static deserializeBinaryFromReader(message: GetContestedResourceVoteStateResponseV0, reader: jspb.BinaryReader): GetContestedResourceVoteStateResponseV0; + } + + export namespace GetContestedResourceVoteStateResponseV0 { + export type AsObject = { + contestedResourceContenders?: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class FinishedVoteInfo extends jspb.Message { + getFinishedVoteOutcome(): GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcomeMap[keyof GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcomeMap]; + setFinishedVoteOutcome(value: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcomeMap[keyof GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcomeMap]): void; + + hasWonByIdentityId(): boolean; + clearWonByIdentityId(): void; + getWonByIdentityId(): Uint8Array | string; + getWonByIdentityId_asU8(): Uint8Array; + getWonByIdentityId_asB64(): string; + setWonByIdentityId(value: Uint8Array | string): void; + + getFinishedAtBlockHeight(): number; + setFinishedAtBlockHeight(value: number): void; + + getFinishedAtCoreBlockHeight(): number; + setFinishedAtCoreBlockHeight(value: number): void; + + getFinishedAtBlockTimeMs(): number; + setFinishedAtBlockTimeMs(value: number): void; + + getFinishedAtEpoch(): number; + setFinishedAtEpoch(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FinishedVoteInfo.AsObject; + static toObject(includeInstance: boolean, msg: FinishedVoteInfo): FinishedVoteInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FinishedVoteInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FinishedVoteInfo; + static deserializeBinaryFromReader(message: FinishedVoteInfo, reader: jspb.BinaryReader): FinishedVoteInfo; + } + + export namespace FinishedVoteInfo { + export type AsObject = { + finishedVoteOutcome: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcomeMap[keyof GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcomeMap], + wonByIdentityId: Uint8Array | string, + finishedAtBlockHeight: number, + finishedAtCoreBlockHeight: number, + finishedAtBlockTimeMs: number, + finishedAtEpoch: number, + } + + export interface FinishedVoteOutcomeMap { + TOWARDS_IDENTITY: 0; + LOCKED: 1; + NO_PREVIOUS_WINNER: 2; + } + + export const FinishedVoteOutcome: FinishedVoteOutcomeMap; + } + + export class ContestedResourceContenders extends jspb.Message { + clearContendersList(): void; + getContendersList(): Array; + setContendersList(value: Array): void; + addContenders(value?: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender, index?: number): GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender; + + hasAbstainVoteTally(): boolean; + clearAbstainVoteTally(): void; + getAbstainVoteTally(): number; + setAbstainVoteTally(value: number): void; + + hasLockVoteTally(): boolean; + clearLockVoteTally(): void; + getLockVoteTally(): number; + setLockVoteTally(value: number): void; + + hasFinishedVoteInfo(): boolean; + clearFinishedVoteInfo(): void; + getFinishedVoteInfo(): GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo | undefined; + setFinishedVoteInfo(value?: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContestedResourceContenders.AsObject; + static toObject(includeInstance: boolean, msg: ContestedResourceContenders): ContestedResourceContenders.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContestedResourceContenders, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContestedResourceContenders; + static deserializeBinaryFromReader(message: ContestedResourceContenders, reader: jspb.BinaryReader): ContestedResourceContenders; + } + + export namespace ContestedResourceContenders { + export type AsObject = { + contendersList: Array, + abstainVoteTally: number, + lockVoteTally: number, + finishedVoteInfo?: GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.AsObject, + } + } + + export class Contender extends jspb.Message { + getIdentifier(): Uint8Array | string; + getIdentifier_asU8(): Uint8Array; + getIdentifier_asB64(): string; + setIdentifier(value: Uint8Array | string): void; + + hasVoteCount(): boolean; + clearVoteCount(): void; + getVoteCount(): number; + setVoteCount(value: number): void; + + hasDocument(): boolean; + clearDocument(): void; + getDocument(): Uint8Array | string; + getDocument_asU8(): Uint8Array; + getDocument_asB64(): string; + setDocument(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Contender.AsObject; + static toObject(includeInstance: boolean, msg: Contender): Contender.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Contender, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Contender; + static deserializeBinaryFromReader(message: Contender, reader: jspb.BinaryReader): Contender; + } + + export namespace Contender { + export type AsObject = { + identifier: Uint8Array | string, + voteCount: number, + document: Uint8Array | string, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + CONTESTED_RESOURCE_CONTENDERS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetContestedResourceVotersForIdentityRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 | undefined; + setV0(value?: GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0): void; + + getVersionCase(): GetContestedResourceVotersForIdentityRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVotersForIdentityRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVotersForIdentityRequest): GetContestedResourceVotersForIdentityRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVotersForIdentityRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVotersForIdentityRequest; + static deserializeBinaryFromReader(message: GetContestedResourceVotersForIdentityRequest, reader: jspb.BinaryReader): GetContestedResourceVotersForIdentityRequest; +} + +export namespace GetContestedResourceVotersForIdentityRequest { + export type AsObject = { + v0?: GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.AsObject, + } + + export class GetContestedResourceVotersForIdentityRequestV0 extends jspb.Message { + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + getDocumentTypeName(): string; + setDocumentTypeName(value: string): void; + + getIndexName(): string; + setIndexName(value: string): void; + + clearIndexValuesList(): void; + getIndexValuesList(): Array; + getIndexValuesList_asU8(): Array; + getIndexValuesList_asB64(): Array; + setIndexValuesList(value: Array): void; + addIndexValues(value: Uint8Array | string, index?: number): Uint8Array | string; + + getContestantId(): Uint8Array | string; + getContestantId_asU8(): Uint8Array; + getContestantId_asB64(): string; + setContestantId(value: Uint8Array | string): void; + + hasStartAtIdentifierInfo(): boolean; + clearStartAtIdentifierInfo(): void; + getStartAtIdentifierInfo(): GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo | undefined; + setStartAtIdentifierInfo(value?: GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo): void; + + hasCount(): boolean; + clearCount(): void; + getCount(): number; + setCount(value: number): void; + + getOrderAscending(): boolean; + setOrderAscending(value: boolean): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVotersForIdentityRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVotersForIdentityRequestV0): GetContestedResourceVotersForIdentityRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVotersForIdentityRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVotersForIdentityRequestV0; + static deserializeBinaryFromReader(message: GetContestedResourceVotersForIdentityRequestV0, reader: jspb.BinaryReader): GetContestedResourceVotersForIdentityRequestV0; + } + + export namespace GetContestedResourceVotersForIdentityRequestV0 { + export type AsObject = { + contractId: Uint8Array | string, + documentTypeName: string, + indexName: string, + indexValuesList: Array, + contestantId: Uint8Array | string, + startAtIdentifierInfo?: GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.AsObject, + count: number, + orderAscending: boolean, + prove: boolean, + } + + export class StartAtIdentifierInfo extends jspb.Message { + getStartIdentifier(): Uint8Array | string; + getStartIdentifier_asU8(): Uint8Array; + getStartIdentifier_asB64(): string; + setStartIdentifier(value: Uint8Array | string): void; + + getStartIdentifierIncluded(): boolean; + setStartIdentifierIncluded(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StartAtIdentifierInfo.AsObject; + static toObject(includeInstance: boolean, msg: StartAtIdentifierInfo): StartAtIdentifierInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StartAtIdentifierInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StartAtIdentifierInfo; + static deserializeBinaryFromReader(message: StartAtIdentifierInfo, reader: jspb.BinaryReader): StartAtIdentifierInfo; + } + + export namespace StartAtIdentifierInfo { + export type AsObject = { + startIdentifier: Uint8Array | string, + startIdentifierIncluded: boolean, + } + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetContestedResourceVotersForIdentityResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 | undefined; + setV0(value?: GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0): void; + + getVersionCase(): GetContestedResourceVotersForIdentityResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVotersForIdentityResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVotersForIdentityResponse): GetContestedResourceVotersForIdentityResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVotersForIdentityResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVotersForIdentityResponse; + static deserializeBinaryFromReader(message: GetContestedResourceVotersForIdentityResponse, reader: jspb.BinaryReader): GetContestedResourceVotersForIdentityResponse; +} + +export namespace GetContestedResourceVotersForIdentityResponse { + export type AsObject = { + v0?: GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.AsObject, + } + + export class GetContestedResourceVotersForIdentityResponseV0 extends jspb.Message { + hasContestedResourceVoters(): boolean; + clearContestedResourceVoters(): void; + getContestedResourceVoters(): GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters | undefined; + setContestedResourceVoters(value?: GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetContestedResourceVotersForIdentityResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceVotersForIdentityResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceVotersForIdentityResponseV0): GetContestedResourceVotersForIdentityResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceVotersForIdentityResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceVotersForIdentityResponseV0; + static deserializeBinaryFromReader(message: GetContestedResourceVotersForIdentityResponseV0, reader: jspb.BinaryReader): GetContestedResourceVotersForIdentityResponseV0; + } + + export namespace GetContestedResourceVotersForIdentityResponseV0 { + export type AsObject = { + contestedResourceVoters?: GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class ContestedResourceVoters extends jspb.Message { + clearVotersList(): void; + getVotersList(): Array; + getVotersList_asU8(): Array; + getVotersList_asB64(): Array; + setVotersList(value: Array): void; + addVoters(value: Uint8Array | string, index?: number): Uint8Array | string; + + getFinishedResults(): boolean; + setFinishedResults(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContestedResourceVoters.AsObject; + static toObject(includeInstance: boolean, msg: ContestedResourceVoters): ContestedResourceVoters.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContestedResourceVoters, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContestedResourceVoters; + static deserializeBinaryFromReader(message: ContestedResourceVoters, reader: jspb.BinaryReader): ContestedResourceVoters; + } + + export namespace ContestedResourceVoters { + export type AsObject = { + votersList: Array, + finishedResults: boolean, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + CONTESTED_RESOURCE_VOTERS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetContestedResourceIdentityVotesRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 | undefined; + setV0(value?: GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0): void; + + getVersionCase(): GetContestedResourceIdentityVotesRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceIdentityVotesRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceIdentityVotesRequest): GetContestedResourceIdentityVotesRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceIdentityVotesRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceIdentityVotesRequest; + static deserializeBinaryFromReader(message: GetContestedResourceIdentityVotesRequest, reader: jspb.BinaryReader): GetContestedResourceIdentityVotesRequest; +} + +export namespace GetContestedResourceIdentityVotesRequest { + export type AsObject = { + v0?: GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.AsObject, + } + + export class GetContestedResourceIdentityVotesRequestV0 extends jspb.Message { + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + hasLimit(): boolean; + clearLimit(): void; + getLimit(): google_protobuf_wrappers_pb.UInt32Value | undefined; + setLimit(value?: google_protobuf_wrappers_pb.UInt32Value): void; + + hasOffset(): boolean; + clearOffset(): void; + getOffset(): google_protobuf_wrappers_pb.UInt32Value | undefined; + setOffset(value?: google_protobuf_wrappers_pb.UInt32Value): void; + + getOrderAscending(): boolean; + setOrderAscending(value: boolean): void; + + hasStartAtVotePollIdInfo(): boolean; + clearStartAtVotePollIdInfo(): void; + getStartAtVotePollIdInfo(): GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo | undefined; + setStartAtVotePollIdInfo(value?: GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceIdentityVotesRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceIdentityVotesRequestV0): GetContestedResourceIdentityVotesRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceIdentityVotesRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceIdentityVotesRequestV0; + static deserializeBinaryFromReader(message: GetContestedResourceIdentityVotesRequestV0, reader: jspb.BinaryReader): GetContestedResourceIdentityVotesRequestV0; + } + + export namespace GetContestedResourceIdentityVotesRequestV0 { + export type AsObject = { + identityId: Uint8Array | string, + limit?: google_protobuf_wrappers_pb.UInt32Value.AsObject, + offset?: google_protobuf_wrappers_pb.UInt32Value.AsObject, + orderAscending: boolean, + startAtVotePollIdInfo?: GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.AsObject, + prove: boolean, + } + + export class StartAtVotePollIdInfo extends jspb.Message { + getStartAtPollIdentifier(): Uint8Array | string; + getStartAtPollIdentifier_asU8(): Uint8Array; + getStartAtPollIdentifier_asB64(): string; + setStartAtPollIdentifier(value: Uint8Array | string): void; + + getStartPollIdentifierIncluded(): boolean; + setStartPollIdentifierIncluded(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StartAtVotePollIdInfo.AsObject; + static toObject(includeInstance: boolean, msg: StartAtVotePollIdInfo): StartAtVotePollIdInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StartAtVotePollIdInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StartAtVotePollIdInfo; + static deserializeBinaryFromReader(message: StartAtVotePollIdInfo, reader: jspb.BinaryReader): StartAtVotePollIdInfo; + } + + export namespace StartAtVotePollIdInfo { + export type AsObject = { + startAtPollIdentifier: Uint8Array | string, + startPollIdentifierIncluded: boolean, + } + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetContestedResourceIdentityVotesResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 | undefined; + setV0(value?: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0): void; + + getVersionCase(): GetContestedResourceIdentityVotesResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceIdentityVotesResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceIdentityVotesResponse): GetContestedResourceIdentityVotesResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceIdentityVotesResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceIdentityVotesResponse; + static deserializeBinaryFromReader(message: GetContestedResourceIdentityVotesResponse, reader: jspb.BinaryReader): GetContestedResourceIdentityVotesResponse; +} + +export namespace GetContestedResourceIdentityVotesResponse { + export type AsObject = { + v0?: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.AsObject, + } + + export class GetContestedResourceIdentityVotesResponseV0 extends jspb.Message { + hasVotes(): boolean; + clearVotes(): void; + getVotes(): GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes | undefined; + setVotes(value?: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetContestedResourceIdentityVotesResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetContestedResourceIdentityVotesResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetContestedResourceIdentityVotesResponseV0): GetContestedResourceIdentityVotesResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetContestedResourceIdentityVotesResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetContestedResourceIdentityVotesResponseV0; + static deserializeBinaryFromReader(message: GetContestedResourceIdentityVotesResponseV0, reader: jspb.BinaryReader): GetContestedResourceIdentityVotesResponseV0; + } + + export namespace GetContestedResourceIdentityVotesResponseV0 { + export type AsObject = { + votes?: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class ContestedResourceIdentityVotes extends jspb.Message { + clearContestedResourceIdentityVotesList(): void; + getContestedResourceIdentityVotesList(): Array; + setContestedResourceIdentityVotesList(value: Array): void; + addContestedResourceIdentityVotes(value?: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote, index?: number): GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote; + + getFinishedResults(): boolean; + setFinishedResults(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContestedResourceIdentityVotes.AsObject; + static toObject(includeInstance: boolean, msg: ContestedResourceIdentityVotes): ContestedResourceIdentityVotes.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContestedResourceIdentityVotes, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContestedResourceIdentityVotes; + static deserializeBinaryFromReader(message: ContestedResourceIdentityVotes, reader: jspb.BinaryReader): ContestedResourceIdentityVotes; + } + + export namespace ContestedResourceIdentityVotes { + export type AsObject = { + contestedResourceIdentityVotesList: Array, + finishedResults: boolean, + } + } + + export class ResourceVoteChoice extends jspb.Message { + getVoteChoiceType(): GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceTypeMap[keyof GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceTypeMap]; + setVoteChoiceType(value: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceTypeMap[keyof GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceTypeMap]): void; + + hasIdentityId(): boolean; + clearIdentityId(): void; + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResourceVoteChoice.AsObject; + static toObject(includeInstance: boolean, msg: ResourceVoteChoice): ResourceVoteChoice.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResourceVoteChoice, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResourceVoteChoice; + static deserializeBinaryFromReader(message: ResourceVoteChoice, reader: jspb.BinaryReader): ResourceVoteChoice; + } + + export namespace ResourceVoteChoice { + export type AsObject = { + voteChoiceType: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceTypeMap[keyof GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceTypeMap], + identityId: Uint8Array | string, + } + + export interface VoteChoiceTypeMap { + TOWARDS_IDENTITY: 0; + ABSTAIN: 1; + LOCK: 2; + } + + export const VoteChoiceType: VoteChoiceTypeMap; + } + + export class ContestedResourceIdentityVote extends jspb.Message { + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + getDocumentTypeName(): string; + setDocumentTypeName(value: string): void; + + clearSerializedIndexStorageValuesList(): void; + getSerializedIndexStorageValuesList(): Array; + getSerializedIndexStorageValuesList_asU8(): Array; + getSerializedIndexStorageValuesList_asB64(): Array; + setSerializedIndexStorageValuesList(value: Array): void; + addSerializedIndexStorageValues(value: Uint8Array | string, index?: number): Uint8Array | string; + + hasVoteChoice(): boolean; + clearVoteChoice(): void; + getVoteChoice(): GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice | undefined; + setVoteChoice(value?: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContestedResourceIdentityVote.AsObject; + static toObject(includeInstance: boolean, msg: ContestedResourceIdentityVote): ContestedResourceIdentityVote.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContestedResourceIdentityVote, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContestedResourceIdentityVote; + static deserializeBinaryFromReader(message: ContestedResourceIdentityVote, reader: jspb.BinaryReader): ContestedResourceIdentityVote; + } + + export namespace ContestedResourceIdentityVote { + export type AsObject = { + contractId: Uint8Array | string, + documentTypeName: string, + serializedIndexStorageValuesList: Array, + voteChoice?: GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.AsObject, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + VOTES = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetPrefundedSpecializedBalanceRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 | undefined; + setV0(value?: GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0): void; + + getVersionCase(): GetPrefundedSpecializedBalanceRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPrefundedSpecializedBalanceRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetPrefundedSpecializedBalanceRequest): GetPrefundedSpecializedBalanceRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPrefundedSpecializedBalanceRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPrefundedSpecializedBalanceRequest; + static deserializeBinaryFromReader(message: GetPrefundedSpecializedBalanceRequest, reader: jspb.BinaryReader): GetPrefundedSpecializedBalanceRequest; +} + +export namespace GetPrefundedSpecializedBalanceRequest { + export type AsObject = { + v0?: GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.AsObject, + } + + export class GetPrefundedSpecializedBalanceRequestV0 extends jspb.Message { + getId(): Uint8Array | string; + getId_asU8(): Uint8Array; + getId_asB64(): string; + setId(value: Uint8Array | string): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPrefundedSpecializedBalanceRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetPrefundedSpecializedBalanceRequestV0): GetPrefundedSpecializedBalanceRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPrefundedSpecializedBalanceRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPrefundedSpecializedBalanceRequestV0; + static deserializeBinaryFromReader(message: GetPrefundedSpecializedBalanceRequestV0, reader: jspb.BinaryReader): GetPrefundedSpecializedBalanceRequestV0; + } + + export namespace GetPrefundedSpecializedBalanceRequestV0 { + export type AsObject = { + id: Uint8Array | string, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetPrefundedSpecializedBalanceResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 | undefined; + setV0(value?: GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0): void; + + getVersionCase(): GetPrefundedSpecializedBalanceResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPrefundedSpecializedBalanceResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetPrefundedSpecializedBalanceResponse): GetPrefundedSpecializedBalanceResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPrefundedSpecializedBalanceResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPrefundedSpecializedBalanceResponse; + static deserializeBinaryFromReader(message: GetPrefundedSpecializedBalanceResponse, reader: jspb.BinaryReader): GetPrefundedSpecializedBalanceResponse; +} + +export namespace GetPrefundedSpecializedBalanceResponse { + export type AsObject = { + v0?: GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.AsObject, + } + + export class GetPrefundedSpecializedBalanceResponseV0 extends jspb.Message { + hasBalance(): boolean; + clearBalance(): void; + getBalance(): number; + setBalance(value: number): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetPrefundedSpecializedBalanceResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPrefundedSpecializedBalanceResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetPrefundedSpecializedBalanceResponseV0): GetPrefundedSpecializedBalanceResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPrefundedSpecializedBalanceResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPrefundedSpecializedBalanceResponseV0; + static deserializeBinaryFromReader(message: GetPrefundedSpecializedBalanceResponseV0, reader: jspb.BinaryReader): GetPrefundedSpecializedBalanceResponseV0; + } + + export namespace GetPrefundedSpecializedBalanceResponseV0 { + export type AsObject = { + balance: number, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + BALANCE = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetTotalCreditsInPlatformRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 | undefined; + setV0(value?: GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0): void; + + getVersionCase(): GetTotalCreditsInPlatformRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetTotalCreditsInPlatformRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetTotalCreditsInPlatformRequest): GetTotalCreditsInPlatformRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetTotalCreditsInPlatformRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetTotalCreditsInPlatformRequest; + static deserializeBinaryFromReader(message: GetTotalCreditsInPlatformRequest, reader: jspb.BinaryReader): GetTotalCreditsInPlatformRequest; +} + +export namespace GetTotalCreditsInPlatformRequest { + export type AsObject = { + v0?: GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.AsObject, + } + + export class GetTotalCreditsInPlatformRequestV0 extends jspb.Message { + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetTotalCreditsInPlatformRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetTotalCreditsInPlatformRequestV0): GetTotalCreditsInPlatformRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetTotalCreditsInPlatformRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetTotalCreditsInPlatformRequestV0; + static deserializeBinaryFromReader(message: GetTotalCreditsInPlatformRequestV0, reader: jspb.BinaryReader): GetTotalCreditsInPlatformRequestV0; + } + + export namespace GetTotalCreditsInPlatformRequestV0 { + export type AsObject = { + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetTotalCreditsInPlatformResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 | undefined; + setV0(value?: GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0): void; + + getVersionCase(): GetTotalCreditsInPlatformResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetTotalCreditsInPlatformResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetTotalCreditsInPlatformResponse): GetTotalCreditsInPlatformResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetTotalCreditsInPlatformResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetTotalCreditsInPlatformResponse; + static deserializeBinaryFromReader(message: GetTotalCreditsInPlatformResponse, reader: jspb.BinaryReader): GetTotalCreditsInPlatformResponse; +} + +export namespace GetTotalCreditsInPlatformResponse { + export type AsObject = { + v0?: GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.AsObject, + } + + export class GetTotalCreditsInPlatformResponseV0 extends jspb.Message { + hasCredits(): boolean; + clearCredits(): void; + getCredits(): number; + setCredits(value: number): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetTotalCreditsInPlatformResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetTotalCreditsInPlatformResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetTotalCreditsInPlatformResponseV0): GetTotalCreditsInPlatformResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetTotalCreditsInPlatformResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetTotalCreditsInPlatformResponseV0; + static deserializeBinaryFromReader(message: GetTotalCreditsInPlatformResponseV0, reader: jspb.BinaryReader): GetTotalCreditsInPlatformResponseV0; + } + + export namespace GetTotalCreditsInPlatformResponseV0 { + export type AsObject = { + credits: number, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + CREDITS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetPathElementsRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetPathElementsRequest.GetPathElementsRequestV0 | undefined; + setV0(value?: GetPathElementsRequest.GetPathElementsRequestV0): void; + + getVersionCase(): GetPathElementsRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsRequest): GetPathElementsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsRequest; + static deserializeBinaryFromReader(message: GetPathElementsRequest, reader: jspb.BinaryReader): GetPathElementsRequest; +} + +export namespace GetPathElementsRequest { + export type AsObject = { + v0?: GetPathElementsRequest.GetPathElementsRequestV0.AsObject, + } + + export class GetPathElementsRequestV0 extends jspb.Message { + clearPathList(): void; + getPathList(): Array; + getPathList_asU8(): Array; + getPathList_asB64(): Array; + setPathList(value: Array): void; + addPath(value: Uint8Array | string, index?: number): Uint8Array | string; + + clearKeysList(): void; + getKeysList(): Array; + getKeysList_asU8(): Array; + getKeysList_asB64(): Array; + setKeysList(value: Array): void; + addKeys(value: Uint8Array | string, index?: number): Uint8Array | string; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsRequestV0): GetPathElementsRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsRequestV0; + static deserializeBinaryFromReader(message: GetPathElementsRequestV0, reader: jspb.BinaryReader): GetPathElementsRequestV0; + } + + export namespace GetPathElementsRequestV0 { + export type AsObject = { + pathList: Array, + keysList: Array, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetPathElementsResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetPathElementsResponse.GetPathElementsResponseV0 | undefined; + setV0(value?: GetPathElementsResponse.GetPathElementsResponseV0): void; + + getVersionCase(): GetPathElementsResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsResponse): GetPathElementsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsResponse; + static deserializeBinaryFromReader(message: GetPathElementsResponse, reader: jspb.BinaryReader): GetPathElementsResponse; +} + +export namespace GetPathElementsResponse { + export type AsObject = { + v0?: GetPathElementsResponse.GetPathElementsResponseV0.AsObject, + } + + export class GetPathElementsResponseV0 extends jspb.Message { + hasElements(): boolean; + clearElements(): void; + getElements(): GetPathElementsResponse.GetPathElementsResponseV0.Elements | undefined; + setElements(value?: GetPathElementsResponse.GetPathElementsResponseV0.Elements): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetPathElementsResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsResponseV0): GetPathElementsResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsResponseV0; + static deserializeBinaryFromReader(message: GetPathElementsResponseV0, reader: jspb.BinaryReader): GetPathElementsResponseV0; + } + + export namespace GetPathElementsResponseV0 { + export type AsObject = { + elements?: GetPathElementsResponse.GetPathElementsResponseV0.Elements.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class Elements extends jspb.Message { + clearElementsList(): void; + getElementsList(): Array; + getElementsList_asU8(): Array; + getElementsList_asB64(): Array; + setElementsList(value: Array): void; + addElements(value: Uint8Array | string, index?: number): Uint8Array | string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Elements.AsObject; + static toObject(includeInstance: boolean, msg: Elements): Elements.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Elements, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Elements; + static deserializeBinaryFromReader(message: Elements, reader: jspb.BinaryReader): Elements; + } + + export namespace Elements { + export type AsObject = { + elementsList: Array, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + ELEMENTS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export interface KeyPurposeMap { + AUTHENTICATION: 0; + ENCRYPTION: 1; + DECRYPTION: 2; + TRANSFER: 3; + VOTING: 5; +} + +export const KeyPurpose: KeyPurposeMap; + diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js index 9d6d3e76cfa..be474b049e7 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js @@ -32,6 +32,49 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.Co goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase', null, { proto }); @@ -75,25 +118,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpoc goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase', null, { proto }); @@ -116,6 +150,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase', null, { proto }); @@ -124,6 +165,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetId goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase', null, { proto }); @@ -131,12 +179,31 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse', null, { goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0', null, { proto }); @@ -160,6 +227,25 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVote goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyPurpose', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.Proof', null, { proto }); @@ -333,16 +419,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -354,16 +440,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -375,16 +461,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -396,16 +482,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -417,16 +503,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -438,16 +524,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -459,16 +545,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; } /** * Generated by JsPbCodeGenerator. @@ -480,16 +566,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -501,16 +587,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; } /** * Generated by JsPbCodeGenerator. @@ -522,16 +608,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -543,16 +629,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -564,16 +671,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse'; } /** * Generated by JsPbCodeGenerator. @@ -585,16 +692,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -911,6 +1018,153 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1016,6 +1270,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1509,16 +1805,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1530,16 +1826,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1551,16 +1847,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1572,16 +1868,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1593,16 +1889,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1614,16 +1910,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1635,16 +1931,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1656,16 +1952,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1677,16 +1973,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1698,16 +1994,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1719,16 +2015,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1740,16 +2036,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; } /** * Generated by JsPbCodeGenerator. @@ -1761,16 +2057,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; } /** * Generated by JsPbCodeGenerator. @@ -1782,16 +2078,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1803,16 +2099,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1824,16 +2120,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1845,16 +2141,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1866,16 +2162,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1887,16 +2183,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; } /** * Generated by JsPbCodeGenerator. @@ -1908,16 +2204,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; } /** * Generated by JsPbCodeGenerator. @@ -1929,16 +2225,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1950,16 +2246,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1971,16 +2267,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1992,16 +2288,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2013,16 +2309,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; } /** * Generated by JsPbCodeGenerator. @@ -2034,16 +2330,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; } /** * Generated by JsPbCodeGenerator. @@ -2055,16 +2351,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2076,16 +2372,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2097,16 +2393,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2118,16 +2414,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2139,16 +2435,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; } /** * Generated by JsPbCodeGenerator. @@ -2160,16 +2456,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; } /** * Generated by JsPbCodeGenerator. @@ -2181,16 +2477,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2202,16 +2498,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2223,16 +2519,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo'; } /** * Generated by JsPbCodeGenerator. @@ -2244,16 +2540,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2265,16 +2561,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2286,50 +2582,953 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues'; } - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.org.dash.platform.dapi.v0.Proof.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.Proof.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_); }; - - +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest'; +} /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.org.dash.platform.dapi.v0.Proof.toObject = function(includeInstance, msg) { - var f, obj = { - grovedbProof: msg.getGrovedbProof_asB64(), +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.displayName = 'proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.displayName = 'proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.Proof.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.Proof.toObject = function(includeInstance, msg) { + var f, obj = { + grovedbProof: msg.getGrovedbProof_asB64(), quorumHash: msg.getQuorumHash_asB64(), signature: msg.getSignature_asB64(), round: jspb.Message.getFieldWithDefault(msg, 4, 0), @@ -2348,23 +3547,10682 @@ proto.org.dash.platform.dapi.v0.Proof.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.Proof} + * @return {!proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.Proof.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.Proof; + return proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setGrovedbProof(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setQuorumHash(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSignature(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint32()); + msg.setRound(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBlockIdHash(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setQuorumType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.Proof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGrovedbProof_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getQuorumHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getSignature_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeUint32( + 4, + f + ); + } + f = message.getBlockIdHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getQuorumType(); + if (f !== 0) { + writer.writeUint32( + 6, + f + ); + } +}; + + +/** + * optional bytes grovedb_proof = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes grovedb_proof = 1; + * This is a type-conversion wrapper around `getGrovedbProof()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getGrovedbProof())); +}; + + +/** + * optional bytes grovedb_proof = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getGrovedbProof()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getGrovedbProof())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setGrovedbProof = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes quorum_hash = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes quorum_hash = 2; + * This is a type-conversion wrapper around `getQuorumHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getQuorumHash())); +}; + + +/** + * optional bytes quorum_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getQuorumHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getQuorumHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes signature = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes signature = 3; + * This is a type-conversion wrapper around `getSignature()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSignature())); +}; + + +/** + * optional bytes signature = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSignature()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSignature())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setSignature = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional uint32 round = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional bytes block_id_hash = 5; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes block_id_hash = 5; + * This is a type-conversion wrapper around `getBlockIdHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBlockIdHash())); +}; + + +/** + * optional bytes block_id_hash = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBlockIdHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBlockIdHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setBlockIdHash = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional uint32 quorum_type = 6; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumType = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + */ +proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumType = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + coreChainLockedHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), + epoch: jspb.Message.getFieldWithDefault(msg, 3, 0), + timeMs: jspb.Message.getFieldWithDefault(msg, 4, 0), + protocolVersion: jspb.Message.getFieldWithDefault(msg, 5, 0), + chainId: jspb.Message.getFieldWithDefault(msg, 6, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + return proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCoreChainLockedHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setEpoch(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setTimeMs(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setProtocolVersion(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getCoreChainLockedHeight(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getEpoch(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getTimeMs(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getProtocolVersion(); + if (f !== 0) { + writer.writeUint32( + 5, + f + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 core_chain_locked_height = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getCoreChainLockedHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setCoreChainLockedHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 epoch = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getEpoch = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setEpoch = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 time_ms = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional uint32 protocol_version = 5; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getProtocolVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setProtocolVersion = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional string chain_id = 6; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + */ +proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + message: jspb.Message.getFieldWithDefault(msg, 2, ""), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; + return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCode(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional uint32 code = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string message = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bytes data = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + */ +proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject = function(includeInstance, msg) { + var f, obj = { + stateTransition: msg.getStateTransition_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest; + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStateTransition(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStateTransition_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes state_transition = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes state_transition = 1; + * This is a type-conversion wrapper around `getStateTransition()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStateTransition())); +}; + + +/** + * optional bytes state_transition = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStateTransition()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStateTransition())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} returns this + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.setStateTransition = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse; + return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + contractId: msg.getContractId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 3, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes contract_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bool prove = 3; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional GetIdentityContractNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityBalanceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentity(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes identity = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentity())); +}; + + +/** + * optional bytes identity = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentity()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentity())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY_NONCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIdentityNonce(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 identity_nonce = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getIdentityNonce = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setIdentityNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearIdentityNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasIdentityNonce = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY_CONTRACT_NONCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityContractNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIdentityContractNonce(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 identity_contract_nonce = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getIdentityContractNonce = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setIdentityContractNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearIdentityContractNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasIdentityContractNonce = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityContractNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 balance = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityBalanceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE_AND_REVISION: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); + msg.setBalanceAndRevision(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBalanceAndRevision(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { + var f, obj = { + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + revision: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setRevision(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBalance(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getRevision(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint64 balance = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 revision = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional BalanceAndRevision balance_and_revision = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { + return this.setBalanceAndRevision(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { + REQUEST_NOT_SET: 0, + ALL_KEYS: 1, + SPECIFIC_KEYS: 2, + SEARCH_KEY: 3 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { + var f, obj = { + allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), + specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), + searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; + return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.AllKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); + msg.setAllKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); + msg.setSpecificKeys(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.SearchKey; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); + msg.setSearchKey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAllKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter + ); + } + f = message.getSpecificKeys(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter + ); + } + f = message.getSearchKey(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter + ); + } +}; + + +/** + * optional AllKeys all_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { + return this.setAllKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional SpecificKeys specific_keys = 2; + * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { + return this.setSpecificKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional SearchKey search_key = 3; + * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { + return this.setSearchKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.AllKeys; + return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { + var f, obj = { + keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; + return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); + for (var i = 0; i < values.length; i++) { + msg.addKeyIds(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyIdsList(); + if (f.length > 0) { + writer.writePackedUint32( + 1, + f + ); + } +}; + + +/** + * repeated uint32 key_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { + return this.setKeyIdsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { + var f, obj = { + purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SearchKey; + return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getPurposeMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPurposeMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); + } +}; + + +/** + * map purpose_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + proto.org.dash.platform.dapi.v0.SecurityLevelMap)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { + this.getPurposeMapMap().clear(); + return this;}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { + var f, obj = { + securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getSecurityLevelMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSecurityLevelMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { + CURRENT_KEY_OF_KIND_REQUEST: 0, + ALL_KEYS_OF_KIND_REQUEST: 1 +}; + +/** + * map security_level_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { + this.getSecurityLevelMapMap().clear(); + return this;}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); + msg.setRequestType(value); + break; + case 3: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); + break; + case 4: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getRequestType(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter + ); + } + f = message.getLimit(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOffset(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional KeyRequestType request_type = 2; + * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { + return this.setRequestType(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.UInt32Value limit = 3; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional google.protobuf.UInt32Value offset = 4; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentityKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + KEYS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); + msg.setKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { + var f, obj = { + keysBytesList: msg.getKeysBytesList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } +}; + + +/** + * repeated bytes keys_bytes = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes keys_bytes = 1; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + +/** + * optional Keys keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { + return this.setKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_ = [1,4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesIdsList: msg.getIdentitiesIdsList_asB64(), + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 3, ""), + purposesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIdentitiesIds(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 4: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); + for (var i = 0; i < values.length; i++) { + msg.addPurposes(values[i]); + } + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesIdsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = message.getPurposesList(); + if (f.length > 0) { + writer.writePackedEnum( + 4, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * repeated bytes identities_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes identities_ids = 1; + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIdentitiesIdsList())); +}; + + +/** + * repeated bytes identities_ids = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIdentitiesIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setIdentitiesIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addIdentitiesIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearIdentitiesIdsList = function() { + return this.setIdentitiesIdsList([]); +}; + + +/** + * optional bytes contract_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional string document_type_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearDocumentTypeName = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.hasDocumentTypeName = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated KeyPurpose purposes = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getPurposesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setPurposesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addPurposes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearPurposesList = function() { + return this.setPurposesList([]); +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentitiesContractKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITIES_KEYS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesKeys: (f = msg.getIdentitiesKeys()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader); + msg.setIdentitiesKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject = function(includeInstance, msg) { + var f, obj = { + purpose: jspb.Message.getFieldWithDefault(msg, 1, 0), + keysBytesList: msg.getKeysBytesList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (reader.readEnum()); + msg.setPurpose(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPurpose(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, + f + ); + } +}; + + +/** + * optional KeyPurpose purpose = 1; + * @return {!proto.org.dash.platform.dapi.v0.KeyPurpose} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getPurpose = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setPurpose = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * repeated bytes keys_bytes = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * repeated bytes keys_bytes = 2; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + keysList: jspb.Message.toObjectList(msg.getKeysList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader); + msg.addKeys(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getKeysList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * repeated PurposeKeys keys = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getKeysList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setKeysList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.addKeys = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.clearKeysList = function() { + return this.setKeysList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject = function(includeInstance, msg) { + var f, obj = { + entriesList: jspb.Message.toObjectList(msg.getEntriesList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader); + msg.addEntries(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntriesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated IdentityKeys entries = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.getEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.setEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.addEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.clearEntriesList = function() { + return this.setEntriesList([]); +}; + + +/** + * optional IdentitiesKeys identities_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getIdentitiesKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setIdentitiesKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearIdentitiesKeys = function() { + return this.setIdentitiesKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasIdentitiesKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentitiesContractKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.repeatedFields_ = [1,2,3,4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesList: jspb.Message.toObjectList(msg.getIdentitiesList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject, includeInstance), + contractsList: jspb.Message.toObjectList(msg.getContractsList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject, includeInstance), + documentsList: jspb.Message.toObjectList(msg.getDocumentsList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject, includeInstance), + votesList: jspb.Message.toObjectList(msg.getVotesList(), + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader); + msg.addIdentities(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader); + msg.addContracts(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader); + msg.addDocuments(value); + break; + case 4: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinaryFromReader); + msg.addVotes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter + ); + } + f = message.getContractsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter + ); + } + f = message.getDocumentsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter + ); + } + f = message.getVotesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64(), + documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), + documentTypeKeepsHistory: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + documentId: msg.getDocumentId_asB64(), + documentContestedStatus: jspb.Message.getFieldWithDefault(msg, 5, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentType(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDocumentTypeKeepsHistory(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setDocumentId(value); + break; + case 5: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} */ (reader.readEnum()); + msg.setDocumentContestedStatus(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentType(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getDocumentTypeKeepsHistory(); + if (f) { + writer.writeBool( + 3, + f + ); + } + f = message.getDocumentId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getDocumentContestedStatus(); + if (f !== 0.0) { + writer.writeEnum( + 5, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus = { + NOT_CONTESTED: 0, + MAYBE_CONTESTED: 1, + CONTESTED: 2 +}; + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentType = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bool document_type_keeps_history = 3; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentTypeKeepsHistory = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentTypeKeepsHistory = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bytes document_id = 4; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes document_id = 4; + * This is a type-conversion wrapper around `getDocumentId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getDocumentId())); +}; + + +/** + * optional bytes document_id = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDocumentId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getDocumentId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentId = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional DocumentContestedStatus document_contested_status = 5; + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentContestedStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.DocumentContestedStatus} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentContestedStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + requestType: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (reader.readEnum()); + msg.setRequestType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getRequestType(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type = { + FULL_IDENTITY: 0, + BALANCE: 1, + KEYS: 2, + REVISION: 3 +}; + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional Type request_type = 2; + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getRequestType = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setRequestType = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase = { + REQUEST_TYPE_NOT_SET: 0, + CONTESTED_RESOURCE_VOTE_STATUS_REQUEST: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.getRequestTypeCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.RequestTypeCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contestedResourceVoteStatusRequest: (f = msg.getContestedResourceVoteStatusRequest()) && proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinaryFromReader); + msg.setContestedResourceVoteStatusRequest(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContestedResourceVoteStatusRequest(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + indexValuesList: msg.getIndexValuesList_asB64(), + voterIdentifier: msg.getVoterIdentifier_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIndexValues(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setVoterIdentifier(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getVoterIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string index_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated bytes index_values = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * repeated bytes index_values = 4; + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIndexValuesList())); +}; + + +/** + * repeated bytes index_values = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIndexValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.addIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.clearIndexValuesList = function() { + return this.setIndexValuesList([]); +}; + + +/** + * optional bytes voter_identifier = 5; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getVoterIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes voter_identifier = 5; + * This is a type-conversion wrapper around `getVoterIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getVoterIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getVoterIdentifier())); +}; + + +/** + * optional bytes voter_identifier = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getVoterIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.getVoterIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getVoterIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest.prototype.setVoterIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional ContestedResourceVoteStatusRequest contested_resource_vote_status_request = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.getContestedResourceVoteStatusRequest = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.ContestedResourceVoteStatusRequest|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.setContestedResourceVoteStatusRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.clearContestedResourceVoteStatusRequest = function() { + return this.setContestedResourceVoteStatusRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest.prototype.hasContestedResourceVoteStatusRequest = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated IdentityRequest identities = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getIdentitiesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setIdentitiesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addIdentities = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearIdentitiesList = function() { + return this.setIdentitiesList([]); +}; + + +/** + * repeated ContractRequest contracts = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getContractsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setContractsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addContracts = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearContractsList = function() { + return this.setContractsList([]); +}; + + +/** + * repeated DocumentRequest documents = 3; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getDocumentsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setDocumentsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addDocuments = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearDocumentsList = function() { + return this.setDocumentsList([]); +}; + + +/** + * repeated VoteStatusRequest votes = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getVotesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setVotesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addVotes = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.VoteStatusRequest, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearVotesList = function() { + return this.setVotesList([]); +}; + + +/** + * optional GetProofsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} */ -proto.org.dash.platform.dapi.v0.Proof.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.Proof; - return proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse; + return proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.Proof} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.Proof} + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} */ -proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2372,28 +14230,154 @@ proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setGrovedbProof(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setQuorumHash(value); + var value = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setSignature(value); + default: + reader.skipField(); break; - case 4: - var value = /** @type {number} */ (reader.readUint32()); - msg.setRound(value); + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + PROOF: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; + return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { break; - case 5: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setBlockIdHash(value); + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; - case 6: - var value = /** @type {number} */ (reader.readUint32()); - msg.setQuorumType(value); + case 2: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -2408,9 +14392,9 @@ proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2418,258 +14402,278 @@ proto.org.dash.platform.dapi.v0.Proof.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.Proof} message + * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getGrovedbProof_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getQuorumHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 2, - f - ); - } - f = message.getSignature_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f - ); - } - f = message.getRound(); - if (f !== 0) { - writer.writeUint32( - 4, - f - ); - } - f = message.getBlockIdHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 5, - f - ); - } - f = message.getQuorumType(); - if (f !== 0) { - writer.writeUint32( - 6, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes grovedb_proof = 1; - * @return {string} + * optional Proof proof = 1; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 1)); }; /** - * optional bytes grovedb_proof = 1; - * This is a type-conversion wrapper around `getGrovedbProof()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getGrovedbProof())); + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0], value); }; /** - * optional bytes grovedb_proof = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getGrovedbProof()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getGrovedbProof_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getGrovedbProof())); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setGrovedbProof = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional bytes quorum_hash = 2; - * @return {string} + * optional ResponseMetadata metadata = 2; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 2)); }; /** - * optional bytes quorum_hash = 2; - * This is a type-conversion wrapper around `getQuorumHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getQuorumHash())); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** - * optional bytes quorum_hash = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getQuorumHash()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getQuorumHash())); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional bytes signature = 3; - * @return {string} + * optional GetProofsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0, 1)); }; /** - * optional bytes signature = 3; - * This is a type-conversion wrapper around `getSignature()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getSignature())); + * @param {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0], value); }; /** - * optional bytes signature = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getSignature()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getSignature_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getSignature())); +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setSignature = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * optional uint32 round = 4; - * @return {number} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getRound = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; +proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_ = [[1]]; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * @return {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setRound = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional bytes block_id_hash = 5; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject(opt_includeInstance, this); }; /** - * optional bytes block_id_hash = 5; - * This is a type-conversion wrapper around `getBlockIdHash()` - * @return {string} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBlockIdHash())); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional bytes block_id_hash = 5; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBlockIdHash()` - * @return {!Uint8Array} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getBlockIdHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBlockIdHash())); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest; + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader(msg, reader); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setBlockIdHash = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional uint32 quorum_type = 6; - * @return {number} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumType = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumType = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter + ); + } }; @@ -2689,8 +14693,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(opt_includeInstance, this); }; @@ -2699,18 +14703,14 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - height: jspb.Message.getFieldWithDefault(msg, 1, 0), - coreChainLockedHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), - epoch: jspb.Message.getFieldWithDefault(msg, 3, 0), - timeMs: jspb.Message.getFieldWithDefault(msg, 4, 0), - protocolVersion: jspb.Message.getFieldWithDefault(msg, 5, 0), - chainId: jspb.Message.getFieldWithDefault(msg, 6, "") + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -2724,23 +14724,23 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - return proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; + return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2748,28 +14748,12 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = f var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setHeight(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCoreChainLockedHeight(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setEpoch(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setTimeMs(value); - break; - case 5: - var value = /** @type {number} */ (reader.readUint32()); - msg.setProtocolVersion(value); - break; - case 6: - var value = /** @type {string} */ (reader.readString()); - msg.setChainId(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -2784,9 +14768,9 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2794,168 +14778,154 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.ResponseMetadata} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getHeight(); - if (f !== 0) { - writer.writeUint64( + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getCoreChainLockedHeight(); - if (f !== 0) { - writer.writeUint32( + f = message.getProve(); + if (f) { + writer.writeBool( 2, f ); } - f = message.getEpoch(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getTimeMs(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getProtocolVersion(); - if (f !== 0) { - writer.writeUint32( - 5, - f - ); - } - f = message.getChainId(); - if (f.length > 0) { - writer.writeString( - 6, - f - ); - } }; /** - * optional uint64 height = 1; - * @return {number} + * optional bytes id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setHeight = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); }; /** - * optional uint32 core_chain_locked_height = 2; - * @return {number} + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getCoreChainLockedHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setCoreChainLockedHeight = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional uint32 epoch = 3; - * @return {number} + * optional bool prove = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getEpoch = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setEpoch = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional uint64 time_ms = 4; - * @return {number} + * optional GetDataContractRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getTimeMs = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0, 1)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setTimeMs = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * optional uint32 protocol_version = 5; - * @return {number} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getProtocolVersion = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setProtocolVersion = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - +proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_ = [[1]]; /** - * optional string chain_id = 6; - * @return {string} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getChainId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this + * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setChainId = function(value) { - return jspb.Message.setProto3StringField(this, 6, value); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -2969,8 +14939,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject(opt_includeInstance, this); }; @@ -2979,15 +14949,13 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject = function(includeInstance, msg) { var f, obj = { - code: jspb.Message.getFieldWithDefault(msg, 1, 0), - message: jspb.Message.getFieldWithDefault(msg, 2, ""), - data: msg.getData_asB64() + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3001,23 +14969,23 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject = functio /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; - return proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse; + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3025,16 +14993,9 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryF var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCode(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMessage(value); - break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setData(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -3049,9 +15010,9 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryF * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3059,117 +15020,52 @@ proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.serializ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getCode(); - if (f !== 0) { - writer.writeUint32( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getMessage(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getData_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f + f, + proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter ); } }; -/** - * optional uint32 code = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getCode = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setCode = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional string message = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setMessage = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional bytes data = 3; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - /** - * optional bytes data = 3; - * This is a type-conversion wrapper around `getData()` - * @return {string} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getData())); -}; - +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_ = [[1,2]]; /** - * optional bytes data = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getData()` - * @return {!Uint8Array} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.getData_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getData())); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + DATA_CONTRACT: 1, + PROOF: 2 }; - /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} returns this + * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.prototype.setData = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -3183,8 +15079,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(opt_includeInstance, this); }; @@ -3193,13 +15089,15 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.toObje * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - stateTransition: msg.getStateTransition_asB64() + dataContract: msg.getDataContract_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -3213,23 +15111,23 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.toObject = funct /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest; - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; + return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3238,7 +15136,17 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinar switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStateTransition(value); + msg.setDataContract(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -3253,9 +15161,9 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.deserializeBinar * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3263,162 +15171,206 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.serial /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStateTransition_asU8(); - if (f.length > 0) { + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { writer.writeBytes( 1, f ); } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; /** - * optional bytes state_transition = 1; + * optional bytes data_contract = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes state_transition = 1; - * This is a type-conversion wrapper around `getStateTransition()` + * optional bytes data_contract = 1; + * This is a type-conversion wrapper around `getDataContract()` * @return {string} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStateTransition())); + this.getDataContract())); }; /** - * optional bytes state_transition = 1; + * optional bytes data_contract = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStateTransition()` + * This is a type-conversion wrapper around `getDataContract()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.getStateTransition_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStateTransition())); + this.getDataContract())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest.prototype.setStateTransition = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setDataContract = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); }; +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearDataContract = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], undefined); +}; + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasDataContract = function() { + return jspb.Message.getField(this, 1) != null; +}; -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.toObject = function(includeInstance, msg) { - var f, obj = { +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; - }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse; - return proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional GetDataContractResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ -proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; @@ -3431,21 +15383,21 @@ proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse.serializeBinary * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0])); }; @@ -3463,8 +15415,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject(opt_includeInstance, this); }; @@ -3473,13 +15425,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.toObject = function * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3493,23 +15445,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.toObject = function(includeIn /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest; + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3517,8 +15469,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -3534,9 +15486,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3544,24 +15496,31 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.serializeBinary = f /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3577,8 +15536,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(opt_includeInstance, this); }; @@ -3587,13 +15546,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototyp * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), + idsList: msg.getIdsList_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -3608,23 +15567,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; + return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3633,7 +15592,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserial switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.addIds(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -3652,9 +15611,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.deserial * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3662,15 +15621,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototyp /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdsList_asU8(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedBytes( 1, f ); @@ -3686,44 +15645,63 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.serializ /** - * optional bytes id = 1; - * @return {string} + * repeated bytes ids = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` - * @return {string} + * repeated bytes ids = 1; + * This is a type-conversion wrapper around `getIdsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIdsList())); }; /** - * optional bytes id = 1; + * repeated bytes ids = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` - * @return {!Uint8Array} + * This is a type-conversion wrapper around `getIdsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.addIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.clearIdsList = function() { + return this.setIdsList([]); }; @@ -3731,44 +15709,44 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototyp * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} + * optional GetDataContractsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -3777,7 +15755,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.clearV0 = function( * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -3791,21 +15769,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0])); }; @@ -3823,8 +15801,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject(opt_includeInstance, this); }; @@ -3833,13 +15811,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3853,23 +15831,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3877,8 +15855,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -3894,9 +15872,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3904,18 +15882,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter ); } }; @@ -3937,8 +15915,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject(opt_includeInstance, this); }; @@ -3947,14 +15925,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + identifier: msg.getIdentifier_asB64(), + dataContract: (f = msg.getDataContract()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) }; if (includeInstance) { @@ -3968,23 +15946,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3993,11 +15971,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setIdentifier(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new google_protobuf_wrappers_pb.BytesValue; + reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); + msg.setDataContract(value); break; default: reader.skipField(); @@ -4012,9 +15991,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4022,114 +16001,97 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdentifier_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getDataContract(); + if (f != null) { + writer.writeMessage( 2, - f + f, + google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter ); } }; /** - * optional bytes id = 1; + * optional bytes identifier = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes identifier = 1; + * This is a type-conversion wrapper around `getIdentifier()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getIdentifier())); }; /** - * optional bytes id = 1; + * optional bytes identifier = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getIdentifier()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getIdentifier())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setIdentifier = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetIdentityBalanceRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * optional google.protobuf.BytesValue data_contract = 2; + * @return {?proto.google.protobuf.BytesValue} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getDataContract = function() { + return /** @type{?proto.google.protobuf.BytesValue} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @param {?proto.google.protobuf.BytesValue|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setDataContract = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.clearDataContract = function() { + return this.setDataContract(undefined); }; @@ -4137,36 +16099,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.hasDataContract = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} + * List of repeated fields within this message type. + * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.repeatedFields_ = [1]; @@ -4183,8 +16127,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(opt_includeInstance, this); }; @@ -4193,13 +16137,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) + dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject, includeInstance) }; if (includeInstance) { @@ -4213,23 +16158,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4237,9 +16182,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader); + msg.addDataContractEntries(value); break; default: reader.skipField(); @@ -4254,9 +16199,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4264,23 +16209,87 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getDataContractEntriesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter ); } }; +/** + * repeated DataContractEntry data_contract_entries = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.getDataContractEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.setDataContractEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.addDataContractEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.clearDataContractEntriesList = function() { + return this.setDataContractEntriesList([]); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + DATA_CONTRACTS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0])); +}; @@ -4297,8 +16306,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(opt_includeInstance, this); }; @@ -4307,14 +16316,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + dataContracts: (f = msg.getDataContracts()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -4328,23 +16338,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; + return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4352,12 +16362,19 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader); + msg.setDataContracts(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -4369,126 +16386,187 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDataContracts(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DataContracts data_contracts = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + */ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getDataContracts = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setDataContracts = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearDataContracts = function() { + return this.setDataContracts(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getProve(); - if (f) { - writer.writeBool( - 2, - f - ); - } +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasDataContracts = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional bytes id = 1; - * @return {string} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` - * @return {string} + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * optional bytes id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` - * @return {!Uint8Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * optional bool prove = 2; - * @return {boolean} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * optional GetDataContractsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4497,7 +16575,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4511,21 +16589,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0])); }; @@ -4543,8 +16621,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject(opt_includeInstance, this); }; @@ -4553,13 +16631,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = functio * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -4573,23 +16651,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeI /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4597,8 +16675,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -4614,9 +16692,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4624,50 +16702,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -4683,8 +16735,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(opt_includeInstance, this); }; @@ -4693,15 +16745,17 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + id: msg.getId_asB64(), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + startAtMs: jspb.Message.getFieldWithDefault(msg, 4, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) }; if (includeInstance) { @@ -4715,23 +16769,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObje /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4740,17 +16794,25 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + msg.setId(value); break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + case 2: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartAtMs(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -4765,9 +16827,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4775,86 +16837,119 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { + f = message.getId_asU8(); + if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProof(); + f = message.getLimit(); if (f != null) { writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter ); } - f = message.getMetadata(); + f = message.getOffset(); if (f != null) { writer.writeMessage( 3, f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getStartAtMs(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f ); } }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); + this.getId())); }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` + * This is a type-conversion wrapper around `getId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); + this.getId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * optional google.protobuf.UInt32Value limit = 2; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 2)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); }; @@ -4862,36 +16957,36 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional google.protobuf.UInt32Value offset = 3; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); }; @@ -4899,72 +16994,71 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional uint64 start_at_ms = 4; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getStartAtMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setStartAtMs = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * optional bool prove = 5; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); }; /** - * optional GetIdentityResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * optional GetDataContractHistoryRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4973,7 +17067,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4987,21 +17081,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0])); }; @@ -5019,8 +17113,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject(opt_includeInstance, this); }; @@ -5029,13 +17123,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5049,23 +17143,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5073,8 +17167,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -5090,9 +17184,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5100,18 +17194,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter ); } }; @@ -5119,11 +17213,30 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter = f /** - * List of repeated fields within this message type. - * @private {!Array} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + DATA_CONTRACT_HISTORY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0])); +}; @@ -5140,8 +17253,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(opt_includeInstance, this); }; @@ -5150,14 +17263,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - idsList: msg.getIdsList_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + dataContractHistory: (f = msg.getDataContractHistory()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -5171,23 +17285,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5195,12 +17309,19 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addIds(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader); + msg.setDataContractHistory(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -5215,9 +17336,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5225,170 +17346,39 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdsList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( + f = message.getDataContractHistory(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * repeated bytes ids = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); -}; - - -/** - * repeated bytes ids = 1; - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getIdsList())); -}; - - -/** - * repeated bytes ids = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getIdsList())); -}; - - -/** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.addIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.clearIdsList = function() { - return this.setIdsList([]); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetIdentitiesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0])); -}; @@ -5405,8 +17395,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject(opt_includeInstance, this); }; @@ -5415,13 +17405,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(includeInstance, f) + date: jspb.Message.getFieldWithDefault(msg, 1, 0), + value: msg.getValue_asB64() }; if (includeInstance) { @@ -5435,23 +17426,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5459,9 +17450,12 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setDate(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); break; default: reader.skipField(); @@ -5476,9 +17470,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5486,24 +17480,97 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDate(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional uint64 date = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getDate = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setDate = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes value = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes value = 2; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes value = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5519,8 +17586,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(opt_includeInstance, this); }; @@ -5529,13 +17596,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject = function(includeInstance, msg) { var f, obj = { - value: msg.getValue_asB64() + dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject, includeInstance) }; if (includeInstance) { @@ -5549,23 +17617,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; + return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5573,8 +17641,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); + var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader); + msg.addDataContractEntries(value); break; default: reader.skipField(); @@ -5589,9 +17658,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5599,67 +17668,237 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} message + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getValue_asU8(); + f = message.getDataContractEntriesList(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter ); } }; /** - * optional bytes value = 1; - * @return {string} + * repeated DataContractHistoryEntry data_contract_entries = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.getDataContractEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, 1)); }; /** - * optional bytes value = 1; - * This is a type-conversion wrapper around `getValue()` - * @return {string} + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.setDataContractEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.addDataContractEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, opt_index); }; /** - * optional bytes value = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.clearDataContractEntriesList = function() { + return this.setDataContractEntriesList([]); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} returns this + * optional DataContractHistory data_contract_history = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getDataContractHistory = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setDataContractHistory = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearDataContractHistory = function() { + return this.setDataContractHistory(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasDataContractHistory = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetDataContractHistoryResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -5673,8 +17912,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject(opt_includeInstance, this); }; @@ -5683,14 +17922,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject = function(includeInstance, msg) { var f, obj = { - key: msg.getKey_asB64(), - value: (f = msg.getValue()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5704,23 +17942,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest; + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5728,13 +17966,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setKey(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader); - msg.setValue(value); + var value = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -5749,9 +17983,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5759,119 +17993,52 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKey_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getValue(); + f = message.getV0(); if (f != null) { writer.writeMessage( - 2, + 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter ); } }; -/** - * optional bytes key = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes key = 1; - * This is a type-conversion wrapper around `getKey()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getKey())); -}; - - -/** - * optional bytes key = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKey()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getKey())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setKey = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - /** - * optional IdentityValue value = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getValue = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_ = [[6,7]]; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase = { + START_NOT_SET: 0, + START_AFTER: 6, + START_AT: 7 }; - /** - * Returns whether this field is set. - * @return {boolean} + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.hasValue = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0])); }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_ = [1]; - - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -5885,8 +18052,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(opt_includeInstance, this); }; @@ -5895,14 +18062,20 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObj * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject, includeInstance) + dataContractId: msg.getDataContractId_asB64(), + documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), + where: msg.getWhere_asB64(), + orderBy: msg.getOrderBy_asB64(), + limit: jspb.Message.getFieldWithDefault(msg, 5, 0), + startAfter: msg.getStartAfter_asB64(), + startAt: msg.getStartAt_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 8, false) }; if (includeInstance) { @@ -5916,23 +18089,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = func /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; + return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5940,9 +18113,36 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setDataContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentType(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setWhere(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOrderBy(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLimit(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartAfter(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartAt(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -5954,267 +18154,294 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDataContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentType(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getWhere_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getOrderBy_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getLimit(); + if (f !== 0) { + writer.writeUint32( + 5, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeBytes( + 6, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeBytes( + 7, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 8, + f + ); + } +}; + + +/** + * optional bytes data_contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes data_contract_id = 1; + * This is a type-conversion wrapper around `getDataContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getDataContractId())); +}; + + +/** + * optional bytes data_contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDataContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getDataContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDataContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional string document_type = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentityEntriesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDocumentType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * repeated IdentityEntry identity_entries = 1; - * @return {!Array} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDocumentType = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.setIdentityEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); + * optional bytes where = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * optional bytes where = 3; + * This is a type-conversion wrapper around `getWhere()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getWhere())); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this + * optional bytes where = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getWhere()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getWhere())); }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setWhere = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + /** - * @enum {number} + * optional bytes order_by = 4; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITIES: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} + * optional bytes order_by = 4; + * This is a type-conversion wrapper around `getOrderBy()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOrderBy())); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional bytes order_by = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOrderBy()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOrderBy())); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject = function(includeInstance, msg) { - var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setOrderBy = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * optional uint32 limit = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getLimit = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader); - msg.setIdentities(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional bytes start_after = 6; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional bytes start_after = 6; + * This is a type-conversion wrapper around `getStartAfter()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentities(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartAfter())); }; /** - * optional Identities identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * optional bytes start_after = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartAfter()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartAfter())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAfter = function(value) { + return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAfter = function() { + return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); }; @@ -6222,109 +18449,113 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasIdentities = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAfter = function() { + return jspb.Message.getField(this, 6) != null; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional bytes start_at = 7; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); + * optional bytes start_at = 7; + * This is a type-conversion wrapper around `getStartAt()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartAt())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * optional bytes start_at = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartAt()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartAt())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAt = function(value) { + return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAt = function() { + return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAt = function() { + return jspb.Message.getField(this, 7) != null; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * optional bool prove = 8; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 8, value); }; /** - * optional GetIdentitiesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * optional GetDocumentsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -6333,7 +18564,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6347,21 +18578,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0])); }; @@ -6379,8 +18610,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject(opt_includeInstance, this); }; @@ -6389,13 +18620,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -6409,23 +18640,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(i /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse; + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6433,8 +18664,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -6450,9 +18681,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6460,18 +18691,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter ); } }; @@ -6486,22 +18717,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWrit * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase = { RESULT_NOT_SET: 0, - BALANCE: 1, + DOCUMENTS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0])); }; @@ -6519,8 +18750,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(opt_includeInstance, this); }; @@ -6529,13 +18760,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + documents: (f = msg.getDocuments()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -6551,23 +18782,170 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader); + msg.setDocuments(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDocuments(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject = function(includeInstance, msg) { + var f, obj = { + documentsList: msg.getDocumentsList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; + return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6575,18 +18953,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addDocuments(value); break; default: reader.skipField(); @@ -6601,9 +18969,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6611,136 +18979,108 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeUint64( + f = message.getDocumentsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - -/** - * optional uint64 balance = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * repeated bytes documents = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * repeated bytes documents = 1; + * This is a type-conversion wrapper around `getDocumentsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getDocumentsList())); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes documents = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDocumentsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getDocumentsList())); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.setDocumentsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.addDocuments = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.clearDocumentsList = function() { + return this.setDocumentsList([]); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional Documents documents = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getDocuments = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setDocuments = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearDocuments = function() { + return this.setDocuments(undefined); }; @@ -6748,36 +19088,36 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasDocuments = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional GetIdentityBalanceResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -6785,147 +19125,82 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + * optional GetDocumentsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0, 1)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; @@ -6938,22 +19213,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeB * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - BALANCE_AND_REVISION: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); }; @@ -6971,8 +19245,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); }; @@ -6981,15 +19255,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { var f, obj = { - balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7003,23 +19275,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7027,19 +19299,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); - msg.setBalanceAndRevision(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -7054,9 +19316,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7064,34 +19326,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBalanceAndRevision(); + f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter ); } }; @@ -7113,8 +19359,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); }; @@ -7123,14 +19369,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), - revision: jspb.Message.getFieldWithDefault(msg, 2, 0) + publicKeyHash: msg.getPublicKeyHash_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -7144,23 +19390,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7168,12 +19414,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPublicKeyHash(value); break; case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setRevision(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -7188,9 +19434,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7198,22 +19444,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBalance(); - if (f !== 0) { - writer.writeUint64( + f = message.getPublicKeyHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getRevision(); - if (f !== 0) { - writer.writeUint64( + f = message.getProve(); + if (f) { + writer.writeBool( 2, f ); @@ -7222,103 +19468,90 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** - * optional uint64 balance = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 revision = 2; - * @return {number} + * optional bytes public_key_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this + * optional bytes public_key_hash = 1; + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublicKeyHash())); }; /** - * optional BalanceAndRevision balance_and_revision = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * optional bytes public_key_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublicKeyHash())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * optional bool prove = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { - return this.setBalanceAndRevision(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; @@ -7326,82 +19559,147 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); }; /** - * Returns whether this field is set. - * @return {boolean} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter + ); + } }; @@ -7414,23 +19712,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { - REQUEST_NOT_SET: 0, - ALL_KEYS: 1, - SPECIFIC_KEYS: 2, - SEARCH_KEY: 3 +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); }; @@ -7448,8 +19745,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); }; @@ -7458,15 +19755,15 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), - specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), - searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -7480,23 +19777,23 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstan /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; - return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7504,19 +19801,18 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.AllKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); - msg.setAllKeys(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); - msg.setSpecificKeys(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentity(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.SearchKey; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); - msg.setSearchKey(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -7531,9 +19827,9 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7541,64 +19837,86 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = funct /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAllKeys(); + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); if (f != null) { - writer.writeMessage( + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter + f ); } - f = message.getSpecificKeys(); + f = message.getProof(); if (f != null) { writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getSearchKey(); + f = message.getMetadata(); if (f != null) { writer.writeMessage( 3, f, - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional AllKeys all_keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.AllKeys} + * optional bytes identity = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentity())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * optional bytes identity = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentity()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { - return this.setAllKeys(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentity())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); }; @@ -7606,36 +19924,36 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { return jspb.Message.getField(this, 1) != null; }; /** - * optional SpecificKeys specific_keys = 2; - * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { - return this.setSpecificKeys(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -7643,36 +19961,36 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = fun * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional SearchKey search_key = 3; - * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { - return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { - return this.setSearchKey(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; @@ -7680,11 +19998,73 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; +/** + * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +}; @@ -7701,8 +20081,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); }; @@ -7711,13 +20091,13 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { var f, obj = { - + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7731,29 +20111,34 @@ proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.AllKeys; - return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; default: reader.skipField(); break; @@ -7767,9 +20152,9 @@ proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7777,22 +20162,23 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter + ); + } +}; + + @@ -7809,8 +20195,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); }; @@ -7819,13 +20205,14 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_i * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + stateTransitionHash: msg.getStateTransitionHash_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -7839,23 +20226,23 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; - return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7863,10 +20250,12 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct var field = reader.getFieldNumber(); switch (field) { case 1: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); - for (var i = 0; i < values.length; i++) { - msg.addKeyIds(values[i]); - } + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStateTransitionHash(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -7881,9 +20270,9 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7891,60 +20280,152 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = functio /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeyIdsList(); + f = message.getStateTransitionHash_asU8(); if (f.length > 0) { - writer.writePackedUint32( + writer.writeBytes( 1, f ); } + f = message.getProve(); + if (f) { + writer.writeBool( + 2, + f + ); + } }; /** - * repeated uint32 key_ids = 1; - * @return {!Array} + * optional bytes state_transition_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * optional bytes state_transition_hash = 1; + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStateTransitionHash())); }; /** - * @param {number} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * optional bytes state_transition_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStateTransitionHash())); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { - return this.setKeyIdsList([]); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool prove = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional WaitForStateTransitionResultRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -7960,8 +20441,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); }; @@ -7970,13 +20451,13 @@ proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_incl * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { var f, obj = { - purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7990,23 +20471,23 @@ proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, m /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SearchKey; - return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8014,10 +20495,9 @@ proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function var field = reader.getFieldNumber(); switch (field) { case 1: - var value = msg.getPurposeMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); - }); + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -8032,9 +20512,9 @@ proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8042,41 +20522,49 @@ proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPurposeMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter + ); } }; + /** - * map purpose_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - proto.org.dash.platform.dapi.v0.SecurityLevelMap)); -}; - +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; /** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { - this.getPurposeMapMap().clear(); - return this;}; - +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + ERROR: 1, + PROOF: 2 +}; +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); +}; @@ -8093,8 +20581,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); }; @@ -8103,13 +20591,15 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] + error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -8123,23 +20613,23 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8147,10 +20637,19 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = f var field = reader.getFieldNumber(); switch (field) { case 1: - var value = msg.getSecurityLevelMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); - }); + var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); + msg.setError(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -8165,9 +20664,9 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8175,47 +20674,185 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getSecurityLevelMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); + f = message.getError(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); } }; /** - * @enum {number} + * optional StateTransitionBroadcastError error = 1; + * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { - CURRENT_KEY_OF_KIND_REQUEST: 0, - ALL_KEYS_OF_KIND_REQUEST: 1 +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); }; + /** - * map security_level_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - null)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { + return this.setError(undefined); }; /** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { - this.getSecurityLevelMapMap().clear(); - return this;}; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional WaitForStateTransitionResultResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; @@ -8227,21 +20864,21 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMap * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); }; @@ -8259,8 +20896,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); }; @@ -8269,13 +20906,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -8289,23 +20926,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8313,8 +20950,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -8330,9 +20967,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8340,18 +20977,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter ); } }; @@ -8373,8 +21010,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); }; @@ -8383,17 +21020,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identityId: msg.getIdentityId_asB64(), - requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), - limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -8407,23 +21041,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8431,25 +21065,10 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentityId(value); + var value = /** @type {number} */ (reader.readInt32()); + msg.setHeight(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); - msg.setRequestType(value); - break; - case 3: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setLimit(value); - break; - case 4: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setOffset(value); - break; - case 5: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -8466,9 +21085,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8476,47 +21095,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeInt32( 1, f ); } - f = message.getRequestType(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter - ); - } - f = message.getLimit(); - if (f != null) { - writer.writeMessage( - 3, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getOffset(); - if (f != null) { - writer.writeMessage( - 4, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } f = message.getProve(); if (f) { writer.writeBool( - 5, + 2, f ); } @@ -8524,200 +21119,65 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** - * optional bytes identity_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identity_id = 1; - * This is a type-conversion wrapper around `getIdentityId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentityId())); -}; - - -/** - * optional bytes identity_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentityId()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentityId())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional KeyRequestType request_type = 2; - * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { - return this.setRequestType(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional google.protobuf.UInt32Value limit = 3; - * @return {?proto.google.protobuf.UInt32Value} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); -}; - - -/** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { - return this.setLimit(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional google.protobuf.UInt32Value offset = 4; - * @return {?proto.google.protobuf.UInt32Value} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); -}; - - -/** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * optional int32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { - return this.setOffset(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { - return jspb.Message.getField(this, 4) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional bool prove = 5; + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityKeysRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * optional GetConsensusParamsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -8726,7 +21186,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = funct * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -8740,21 +21200,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = functio * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); }; @@ -8772,8 +21232,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); }; @@ -8782,13 +21242,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -8802,23 +21262,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8826,8 +21286,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -8843,9 +21303,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8853,50 +21313,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - KEYS: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -8912,8 +21346,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); }; @@ -8922,15 +21356,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { var f, obj = { - keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), + timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -8944,23 +21378,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8968,19 +21402,16 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); - msg.setKeys(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxGas(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {string} */ (reader.readString()); + msg.setTimeIotaMs(value); break; default: reader.skipField(); @@ -8995,9 +21426,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9005,46 +21436,90 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeys(); - if (f != null) { - writer.writeMessage( + f = message.getMaxBytes(); + if (f.length > 0) { + writer.writeString( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getMaxGas(); + if (f.length > 0) { + writer.writeString( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( + f = message.getTimeIotaMs(); + if (f.length > 0) { + writer.writeString( 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; +/** + * optional string max_bytes = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string max_gas = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string time_iota_ms = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + @@ -9061,8 +21536,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); }; @@ -9071,13 +21546,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { var f, obj = { - keysBytesList: msg.getKeysBytesList_asB64() + maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), + maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -9091,23 +21568,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9115,8 +21592,16 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addKeysBytes(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeNumBlocks(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeDuration(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; default: reader.skipField(); @@ -9131,9 +21616,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9141,145 +21626,243 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeysBytesList_asU8(); + f = message.getMaxAgeNumBlocks(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeString( 1, f ); } + f = message.getMaxAgeDuration(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getMaxBytes(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } }; /** - * repeated bytes keys_bytes = 1; - * @return {!Array} + * optional string max_age_num_blocks = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * repeated bytes keys_bytes = 1; - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); }; /** - * repeated bytes keys_bytes = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * optional string max_age_duration = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * optional string max_bytes = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { - return this.setKeysBytesList([]); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional Keys keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), + evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { - return this.setKeys(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); + msg.setBlock(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); + msg.setEvidence(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter + ); + } + f = message.getEvidence(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter + ); + } +}; + + +/** + * optional ConsensusParamsBlock block = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { + return this.setBlock(undefined); }; @@ -9287,36 +21870,36 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional ConsensusParamsEvidence evidence = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { + return this.setEvidence(undefined); }; @@ -9324,35 +21907,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional GetIdentityKeysResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * optional GetConsensusParamsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -9361,7 +21944,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -9375,21 +21958,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = functi * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProofsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); }; @@ -9407,8 +21990,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); }; @@ -9417,13 +22000,13 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -9437,23 +22020,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9461,8 +22044,8 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = f var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -9478,9 +22061,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9488,31 +22071,24 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.repeatedFields_ = [1,2,3]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -9528,8 +22104,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); }; @@ -9538,18 +22114,13 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identitiesList: jspb.Message.toObjectList(msg.getIdentitiesList(), - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject, includeInstance), - contractsList: jspb.Message.toObjectList(msg.getContractsList(), - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject, includeInstance), - documentsList: jspb.Message.toObjectList(msg.getDocumentsList(), - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject, includeInstance) + prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) }; if (includeInstance) { @@ -9563,23 +22134,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9587,19 +22158,8 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader); - msg.addIdentities(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader); - msg.addContracts(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader); - msg.addDocuments(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -9611,55 +22171,118 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.deserializeB /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProve(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool prove = 1; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + +/** + * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentitiesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter - ); - } - f = message.getContractsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter - ); - } - f = message.getDocumentsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -9673,8 +22296,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); }; @@ -9683,16 +22306,13 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { var f, obj = { - contractId: msg.getContractId_asB64(), - documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), - documentTypeKeepsHistory: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), - documentId: msg.getDocumentId_asB64() + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -9706,23 +22326,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9730,20 +22350,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setContractId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentType(value); - break; - case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setDocumentTypeKeepsHistory(value); - break; - case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setDocumentId(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -9758,9 +22367,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9768,163 +22377,198 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getContractId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getDocumentType(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getDocumentTypeKeepsHistory(); - if (f) { - writer.writeBool( - 3, - f - ); - } - f = message.getDocumentId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter ); } }; -/** - * optional bytes contract_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - /** - * optional bytes contract_id = 1; - * This is a type-conversion wrapper around `getContractId()` - * @return {string} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getContractId())); -}; - +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; /** - * optional bytes contract_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getContractId()` - * @return {!Uint8Array} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getContractId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getContractId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VERSIONS: 1, + PROOF: 2 }; - /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setContractId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional string document_type = 2; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentType = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentType = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional bool document_type_keeps_history = 3; - * @return {boolean} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentTypeKeepsHistory = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentTypeKeepsHistory = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); + msg.setVersions(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional bytes document_id = 4; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * optional bytes document_id = 4; - * This is a type-conversion wrapper around `getDocumentId()` - * @return {string} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getDocumentId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVersions(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; -/** - * optional bytes document_id = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDocumentId()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.getDocumentId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getDocumentId())); -}; - /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); -}; - - +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; @@ -9941,8 +22585,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); }; @@ -9951,14 +22595,14 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { var f, obj = { - identityId: msg.getIdentityId_asB64(), - requestType: jspb.Message.getFieldWithDefault(msg, 2, 0) + versionsList: jspb.Message.toObjectList(msg.getVersionsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) }; if (includeInstance) { @@ -9972,23 +22616,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9996,12 +22640,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentityId(value); - break; - case 2: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (reader.readEnum()); - msg.setRequestType(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); + msg.addVersions(value); break; default: reader.skipField(); @@ -10016,9 +22657,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10026,95 +22667,58 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityId_asU8(); + f = message.getVersionsList(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedMessage( 1, - f - ); - } - f = message.getRequestType(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter ); } }; /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type = { - FULL_IDENTITY: 0, - BALANCE: 1, - KEYS: 2 -}; - -/** - * optional bytes identity_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identity_id = 1; - * This is a type-conversion wrapper around `getIdentityId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentityId())); -}; - - -/** - * optional bytes identity_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentityId()` - * @return {!Uint8Array} + * repeated VersionEntry versions = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getIdentityId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentityId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setIdentityId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * optional Type request_type = 2; - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.getRequestType = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.prototype.setRequestType = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { + return this.setVersionsList([]); }; @@ -10134,8 +22738,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); }; @@ -10144,13 +22748,14 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { var f, obj = { - contractId: msg.getContractId_asB64() + versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), + voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -10164,23 +22769,23 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest; - return proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10188,8 +22793,12 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setContractId(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVersionNumber(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setVoteCount(value); break; default: reader.skipField(); @@ -10204,9 +22813,9 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10214,202 +22823,200 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getContractId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getVersionNumber(); + if (f !== 0) { + writer.writeUint32( 1, f ); } + f = message.getVoteCount(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } }; /** - * optional bytes contract_id = 1; - * @return {string} + * optional uint32 version_number = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional bytes contract_id = 1; - * This is a type-conversion wrapper around `getContractId()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getContractId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional bytes contract_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getContractId()` - * @return {!Uint8Array} + * optional uint32 vote_count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.getContractId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getContractId())); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest.prototype.setContractId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * repeated IdentityRequest identities = 1; - * @return {!Array} + * optional Versions versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getIdentitiesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setIdentitiesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addIdentities = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { + return this.setVersions(undefined); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearIdentitiesList = function() { - return this.setIdentitiesList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * repeated ContractRequest contracts = 2; - * @return {!Array} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getContractsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, 2)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setContractsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addContracts = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearContractsList = function() { - return this.setContractsList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * repeated DocumentRequest documents = 3; - * @return {!Array} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.getDocumentsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, 3)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.setDocumentsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.addDocuments = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.prototype.clearDocumentsList = function() { - return this.setDocumentsList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProofsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} + * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -10418,7 +23025,7 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.clearV0 = function() * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -10432,21 +23039,21 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.prototype.hasV0 = function() { * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); }; @@ -10464,8 +23071,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); }; @@ -10474,13 +23081,13 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.toObject = function( * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -10494,23 +23101,23 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.toObject = function(includeIns /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse; - return proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10518,8 +23125,8 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -10535,9 +23142,9 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10545,49 +23152,24 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.serializeBinary = fu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - PROOF: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -10603,8 +23185,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); }; @@ -10613,14 +23195,15 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + startProTxHash: msg.getStartProTxHash_asB64(), + count: jspb.Message.getFieldWithDefault(msg, 2, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -10634,23 +23217,23 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0; - return proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10658,14 +23241,16 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartProTxHash(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -10680,9 +23265,9 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10690,129 +23275,138 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getStartProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( + f = message.getCount(); + if (f !== 0) { + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 3, + f ); } }; /** - * optional Proof proof = 1; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional bytes start_pro_tx_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.oneofGroups_[0], value); + * optional bytes start_pro_tx_hash = 1; + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartProTxHash())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this + * optional bytes start_pro_tx_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartProTxHash())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional ResponseMetadata metadata = 2; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional uint32 count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 2)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} returns this + * optional bool prove = 3; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetProofsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} + * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProofsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProofsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -10821,7 +23415,7 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.clearV0 = function() * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -10835,21 +23429,21 @@ proto.org.dash.platform.dapi.v0.GetProofsResponse.prototype.hasV0 = function() { * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); }; @@ -10867,8 +23461,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); }; @@ -10877,13 +23471,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -10897,23 +23491,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest; - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10921,8 +23515,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromRead var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -10938,9 +23532,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10948,24 +23542,50 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VERSIONS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -10981,8 +23601,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); }; @@ -10991,14 +23611,15 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -11012,23 +23633,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0; - return proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11036,12 +23657,19 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); + msg.setVersions(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -11056,9 +23684,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11066,151 +23694,46 @@ proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getVersions(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } -}; - - -/** - * optional bytes id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); -}; - - -/** - * optional bytes id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetDataContractRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetDataContractRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; }; /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} + * List of repeated fields within this message type. + * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; @@ -11227,8 +23750,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); }; @@ -11237,13 +23760,14 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(includeInstance, f) + versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) }; if (includeInstance) { @@ -11257,23 +23781,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse; - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11281,9 +23805,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); + msg.addVersionSignals(value); break; default: reader.skipField(); @@ -11298,9 +23822,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11308,52 +23832,64 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getVersionSignalsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter ); } }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * repeated VersionSignal version_signals = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); +}; + /** - * @enum {number} + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - DATA_CONTRACT: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { + return this.setVersionSignalsList([]); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -11367,8 +23903,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); }; @@ -11377,15 +23913,14 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { var f, obj = { - dataContract: msg.getDataContract_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + proTxHash: msg.getProTxHash_asB64(), + version: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -11399,23 +23934,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0; - return proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11424,17 +23959,11 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setDataContract(value); + msg.setProTxHash(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVersion(value); break; default: reader.skipField(); @@ -11449,9 +23978,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11459,86 +23988,114 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { + f = message.getProTxHash_asU8(); + if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getVersion(); + if (f !== 0) { + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional bytes data_contract = 1; + * optional bytes pro_tx_hash = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes data_contract = 1; - * This is a type-conversion wrapper around `getDataContract()` + * optional bytes pro_tx_hash = 1; + * This is a type-conversion wrapper around `getProTxHash()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getDataContract())); + this.getProTxHash())); }; /** - * optional bytes data_contract = 1; + * optional bytes pro_tx_hash = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDataContract()` + * This is a type-conversion wrapper around `getProTxHash()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getDataContract_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getDataContract())); + this.getProTxHash())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setDataContract = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * optional uint32 version = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearDataContract = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional VersionSignals versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { + return this.setVersions(undefined); }; @@ -11546,7 +24103,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasDataContract = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { return jspb.Message.getField(this, 1) != null; }; @@ -11555,7 +24112,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -11563,18 +24120,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -11583,7 +24140,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -11592,7 +24149,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -11600,18 +24157,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -11620,35 +24177,35 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDataContractResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} + * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -11657,7 +24214,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -11671,21 +24228,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractResponse.prototype.hasV0 = functi * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); }; @@ -11703,8 +24260,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); }; @@ -11713,13 +24270,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -11733,23 +24290,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest; - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11757,8 +24314,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -11774,9 +24331,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11784,32 +24341,25 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.repeatedFields_ = [1]; - - + if (jspb.Message.GENERATE_TO_OBJECT) { /** @@ -11824,8 +24374,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); }; @@ -11834,14 +24384,16 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - idsList: msg.getIdsList_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 2, 0), + ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) }; if (includeInstance) { @@ -11855,23 +24407,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0; - return proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11879,10 +24431,19 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addIds(value); + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setStartEpoch(value); break; case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAscending(value); + break; + case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -11899,9 +24460,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11909,23 +24470,38 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdsList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( + f = message.getStartEpoch(); + if (f != null) { + writer.writeMessage( 1, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getCount(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getAscending(); + if (f) { + writer.writeBool( + 3, f ); } f = message.getProve(); if (f) { writer.writeBool( - 2, + 4, f ); } @@ -11933,108 +24509,120 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV /** - * repeated bytes ids = 1; - * @return {!Array} + * optional google.protobuf.UInt32Value start_epoch = 1; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); }; /** - * repeated bytes ids = 1; - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { + return this.setStartEpoch(undefined); }; /** - * repeated bytes ids = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * optional uint32 count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.addIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * optional bool ascending = 3; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.clearIdsList = function() { - return this.setIdsList([]); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** - * optional bool prove = 2; + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bool prove = 4; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * optional GetDataContractsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} + * optional GetEpochsInfoRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -12043,7 +24631,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -12057,21 +24645,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractsRequest.prototype.hasV0 = functi * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); }; @@ -12089,8 +24677,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); }; @@ -12099,13 +24687,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.toObject = fu * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -12119,23 +24707,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.toObject = function(inc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12143,8 +24731,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromRe var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -12160,9 +24748,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.deserializeBinaryFromRe * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12170,24 +24758,50 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.serializeBina /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + EPOCHS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -12203,8 +24817,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); }; @@ -12213,14 +24827,15 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.proto * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - identifier: msg.getIdentifier_asB64(), - dataContract: (f = msg.getDataContract()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) + epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -12234,23 +24849,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObj /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12258,13 +24873,19 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deser var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentifier(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); + msg.setEpochs(value); break; case 2: - var value = new google_protobuf_wrappers_pb.BytesValue; - reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); - msg.setDataContract(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -12279,9 +24900,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deser * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12289,106 +24910,36 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.proto /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentifier_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getEpochs(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter ); } - f = message.getDataContract(); + f = message.getProof(); if (f != null) { writer.writeMessage( 2, f, - google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } -}; - - -/** - * optional bytes identifier = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identifier = 1; - * This is a type-conversion wrapper around `getIdentifier()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentifier())); -}; - - -/** - * optional bytes identifier = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentifier()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getIdentifier_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentifier())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setIdentifier = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional google.protobuf.BytesValue data_contract = 2; - * @return {?proto.google.protobuf.BytesValue} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.getDataContract = function() { - return /** @type{?proto.google.protobuf.BytesValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); -}; - - -/** - * @param {?proto.google.protobuf.BytesValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.setDataContract = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.clearDataContract = function() { - return this.setDataContract(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.prototype.hasDataContract = function() { - return jspb.Message.getField(this, 2) != null; }; @@ -12398,7 +24949,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.proto * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; @@ -12415,8 +24966,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); }; @@ -12425,14 +24976,14 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { var f, obj = { - dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.toObject, includeInstance) + epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) }; if (includeInstance) { @@ -12446,23 +24997,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12470,9 +25021,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.deserializeBinaryFromReader); - msg.addDataContractEntries(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); + msg.addEpochInfos(value); break; default: reader.skipField(); @@ -12487,9 +25038,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12497,90 +25048,64 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractEntriesList(); + f = message.getEpochInfosList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter ); } }; /** - * repeated DataContractEntry data_contract_entries = 1; - * @return {!Array} + * repeated EpochInfo epoch_infos = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.getDataContractEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.setDataContractEntriesList = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.addDataContractEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.prototype.clearDataContractEntriesList = function() { - return this.setDataContractEntriesList([]); -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - DATA_CONTRACTS: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { + return this.setEpochInfosList([]); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -12594,8 +25119,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); }; @@ -12604,15 +25129,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { var f, obj = { - dataContracts: (f = msg.getDataContracts()) && proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + number: jspb.Message.getFieldWithDefault(msg, 1, 0), + firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), + firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), + startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), + feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0), + protocolVersion: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -12626,23 +25154,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0; - return proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12650,19 +25178,28 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.deserializeBinaryFromReader); - msg.setDataContracts(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setNumber(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setFirstBlockHeight(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setFirstCoreBlockHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartTime(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setFeeMultiplier(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setProtocolVersion(value); break; default: reader.skipField(); @@ -12677,9 +25214,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12687,64 +25224,190 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContracts(); - if (f != null) { - writer.writeMessage( + f = message.getNumber(); + if (f !== 0) { + writer.writeUint32( 1, - f, - proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getFirstBlockHeight(); + if (f !== 0) { + writer.writeUint64( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( + f = message.getFirstCoreBlockHeight(); + if (f !== 0) { + writer.writeUint32( 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f + ); + } + f = message.getStartTime(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getFeeMultiplier(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } + f = message.getProtocolVersion(); + if (f !== 0) { + writer.writeUint32( + 6, + f ); } }; /** - * optional DataContracts data_contracts = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} + * optional uint32 number = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getDataContracts = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContracts|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 first_block_height = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 first_core_block_height = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 start_time = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional double fee_multiplier = 5; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); +}; + + +/** + * optional uint32 protocol_version = 6; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getProtocolVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setProtocolVersion = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * optional EpochInfos epochs = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setDataContracts = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearDataContracts = function() { - return this.setDataContracts(undefined); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { + return this.setEpochs(undefined); }; @@ -12752,7 +25415,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasDataContracts = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { return jspb.Message.getField(this, 1) != null; }; @@ -12761,7 +25424,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -12769,18 +25432,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -12789,7 +25452,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -12798,7 +25461,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -12806,18 +25469,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -12826,35 +25489,35 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsRespons * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDataContractsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} + * optional GetEpochsInfoResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -12863,7 +25526,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.clearV0 = fun * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -12877,21 +25540,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractsResponse.prototype.hasV0 = funct * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_[0])); }; @@ -12909,8 +25572,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.toObject(opt_includeInstance, this); }; @@ -12919,13 +25582,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -12939,23 +25602,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.toObject = functio /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -12963,8 +25626,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryF var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -12980,9 +25643,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.deserializeBinaryF * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -12990,24 +25653,31 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.serializ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.repeatedFields_ = [4,5]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -13023,8 +25693,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.toObject(opt_includeInstance, this); }; @@ -13033,17 +25703,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - startAtMs: jspb.Message.getFieldWithDefault(msg, 4, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + startIndexValuesList: msg.getStartIndexValuesList_asB64(), + endIndexValuesList: msg.getEndIndexValuesList_asB64(), + startAtValueInfo: (f = msg.getStartAtValueInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 7, 0), + orderAscending: jspb.Message.getBooleanFieldWithDefault(msg, 8, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 9, false) }; if (includeInstance) { @@ -13057,23 +25731,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13082,25 +25756,214 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setContractId(value); break; case 2: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setLimit(value); + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); break; case 3: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setOffset(value); + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); break; case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setStartAtMs(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addStartIndexValues(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addEndIndexValues(value); + break; + case 6: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinaryFromReader); + msg.setStartAtValueInfo(value); + break; + case 7: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOrderAscending(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getStartIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getEndIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 5, + f + ); + } + f = message.getStartAtValueInfo(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeUint32( + 7, + f + ); + } + f = message.getOrderAscending(); + if (f) { + writer.writeBool( + 8, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 9, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.toObject = function(includeInstance, msg) { + var f, obj = { + startValue: msg.getStartValue_asB64(), + startValueIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartValue(value); break; - case 5: + case 2: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setStartValueIncluded(value); break; default: reader.skipField(); @@ -13115,9 +25978,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13125,46 +25988,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getStartValue_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getLimit(); - if (f != null) { - writer.writeMessage( - 2, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getOffset(); - if (f != null) { - writer.writeMessage( - 3, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getStartAtMs(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getProve(); + f = message.getStartValueIncluded(); if (f) { writer.writeBool( - 5, + 2, f ); } @@ -13172,109 +26012,290 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis /** - * optional bytes id = 1; + * optional bytes start_value = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValue = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes start_value = 1; + * This is a type-conversion wrapper around `getStartValue()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValue_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getStartValue())); }; /** - * optional bytes id = 1; + * optional bytes start_value = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getStartValue()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValue_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getStartValue())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.setStartValue = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional google.protobuf.UInt32Value limit = 2; - * @return {?proto.google.protobuf.UInt32Value} + * optional bool start_value_included = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getLimit = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.getStartValueIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo.prototype.setStartValueIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * optional bytes contract_id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearLimit = function() { - return this.setLimit(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasLimit = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); }; /** - * optional google.protobuf.UInt32Value offset = 3; - * @return {?proto.google.protobuf.UInt32Value} + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getOffset = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string index_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated bytes start_index_values = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * repeated bytes start_index_values = 4; + * This is a type-conversion wrapper around `getStartIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getStartIndexValuesList())); +}; + + +/** + * repeated bytes start_index_values = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getStartIndexValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setStartIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.addStartIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearStartIndexValuesList = function() { + return this.setStartIndexValuesList([]); +}; + + +/** + * repeated bytes end_index_values = 5; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getEndIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * repeated bytes end_index_values = 5; + * This is a type-conversion wrapper around `getEndIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getEndIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getEndIndexValuesList())); +}; + + +/** + * repeated bytes end_index_values = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getEndIndexValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getEndIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getEndIndexValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setEndIndexValuesList = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.addEndIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearEndIndexValuesList = function() { + return this.setEndIndexValuesList([]); +}; + + +/** + * optional StartAtValueInfo start_at_value_info = 6; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getStartAtValueInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo, 6)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.StartAtValueInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setOffset = function(value) { - return jspb.Message.setWrapperField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setStartAtValueInfo = function(value) { + return jspb.Message.setWrapperField(this, 6, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.clearOffset = function() { - return this.setOffset(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearStartAtValueInfo = function() { + return this.setStartAtValueInfo(undefined); }; @@ -13282,71 +26303,107 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHis * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.hasOffset = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.hasStartAtValueInfo = function() { + return jspb.Message.getField(this, 6) != null; }; /** - * optional uint64 start_at_ms = 4; + * optional uint32 count = 7; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getStartAtMs = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setStartAtMs = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setCount = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.clearCount = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.hasCount = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional bool order_ascending = 8; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getOrderAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setOrderAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 8, value); }; /** - * optional bool prove = 5; + * optional bool prove = 9; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 9, value); }; /** - * optional GetDataContractHistoryRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} + * optional GetContestedResourcesRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.GetContestedResourcesRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -13355,7 +26412,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.clearV0 * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -13369,21 +26426,21 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.prototype.hasV0 = * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_[0])); }; @@ -13401,8 +26458,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.toObject(opt_includeInstance, this); }; @@ -13411,13 +26468,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.toObjec * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -13431,23 +26488,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.toObject = functi /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13455,8 +26512,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -13472,9 +26529,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.deserializeBinary * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13482,18 +26539,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.seriali /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.serializeBinaryToWriter ); } }; @@ -13508,22 +26565,22 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.serializeBinaryTo * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase = { RESULT_NOT_SET: 0, - DATA_CONTRACT_HISTORY: 1, + CONTESTED_RESOURCE_VALUES: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_[0])); }; @@ -13541,8 +26598,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.toObject(opt_includeInstance, this); }; @@ -13551,13 +26608,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - dataContractHistory: (f = msg.getDataContractHistory()) && proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(includeInstance, f), + contestedResourceValues: (f = msg.getContestedResourceValues()) && proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -13573,23 +26630,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13597,9 +26654,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader); - msg.setDataContractHistory(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinaryFromReader); + msg.setContestedResourceValues(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -13624,9 +26681,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13634,18 +26691,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractHistory(); + f = message.getContestedResourceValues(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.serializeBinaryToWriter ); } f = message.getProof(); @@ -13661,193 +26718,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi writer.writeMessage( 3, f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject = function(includeInstance, msg) { - var f, obj = { - date: jspb.Message.getFieldWithDefault(msg, 1, 0), - value: msg.getValue_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setDate(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getDate(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getValue_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } -}; - - -/** - * optional uint64 date = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getDate = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setDate = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional bytes value = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes value = 2; - * This is a type-conversion wrapper around `getValue()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); -}; - - -/** - * optional bytes value = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; @@ -13857,7 +26730,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.repeatedFields_ = [1]; @@ -13874,8 +26747,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.toObject(opt_includeInstance, this); }; @@ -13884,14 +26757,13 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.toObject = function(includeInstance, msg) { var f, obj = { - dataContractEntriesList: jspb.Message.toObjectList(msg.getDataContractEntriesList(), - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.toObject, includeInstance) + contestedResourceValuesList: msg.getContestedResourceValuesList_asB64() }; if (includeInstance) { @@ -13905,23 +26777,23 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory; - return proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues; + return proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -13929,9 +26801,8 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.deserializeBinaryFromReader); - msg.addDataContractEntries(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addContestedResourceValues(value); break; default: reader.skipField(); @@ -13946,9 +26817,9 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -13956,86 +26827,108 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractEntriesList(); + f = message.getContestedResourceValuesList_asU8(); if (f.length > 0) { - writer.writeRepeatedMessage( + writer.writeRepeatedBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry.serializeBinaryToWriter + f ); } }; /** - * repeated DataContractHistoryEntry data_contract_entries = 1; - * @return {!Array} + * repeated bytes contested_resource_values = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.getDataContractEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.getContestedResourceValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.setDataContractEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); + * repeated bytes contested_resource_values = 1; + * This is a type-conversion wrapper around `getContestedResourceValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.getContestedResourceValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getContestedResourceValuesList())); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry=} opt_value + * repeated bytes contested_resource_values = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContestedResourceValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.getContestedResourceValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getContestedResourceValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.setContestedResourceValuesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.addDataContractEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.addContestedResourceValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory.prototype.clearDataContractEntriesList = function() { - return this.setDataContractEntriesList([]); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues.prototype.clearContestedResourceValuesList = function() { + return this.setContestedResourceValuesList([]); }; /** - * optional DataContractHistory data_contract_history = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} + * optional ContestedResourceValues contested_resource_values = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getDataContractHistory = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getContestedResourceValues = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistory|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.ContestedResourceValues|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setDataContractHistory = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.setContestedResourceValues = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearDataContractHistory = function() { - return this.setDataContractHistory(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.clearContestedResourceValues = function() { + return this.setContestedResourceValues(undefined); }; @@ -14043,7 +26936,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasDataContractHistory = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.hasContestedResourceValues = function() { return jspb.Message.getField(this, 1) != null; }; @@ -14052,7 +26945,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -14060,18 +26953,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -14080,7 +26973,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -14089,7 +26982,7 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -14097,18 +26990,18 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -14117,76 +27010,366 @@ proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDataContractHistoryResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} + * optional GetContestedResourcesResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.GetContestedResourcesResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourcesResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0, 1)); -}; - +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + startTimeInfo: (f = msg.getStartTimeInfo()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.toObject(includeInstance, f), + endTimeInfo: (f = msg.getEndTimeInfo()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.toObject(includeInstance, f), + limit: jspb.Message.getFieldWithDefault(msg, 3, 0), + offset: jspb.Message.getFieldWithDefault(msg, 4, 0), + ascending: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) + }; -/** - * @param {?proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.oneofGroups_[0], value); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinaryFromReader); + msg.setStartTimeInfo(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinaryFromReader); + msg.setEndTimeInfo(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLimit(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint32()); + msg.setOffset(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAscending(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_ = [[1]]; - /** - * @enum {number} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStartTimeInfo(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.serializeBinaryToWriter + ); + } + f = message.getEndTimeInfo(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint32( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeUint32( + 4, + f + ); + } + f = message.getAscending(); + if (f) { + writer.writeBool( + 5, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 6, + f + ); + } }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -14200,8 +27383,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.toObject(opt_includeInstance, this); }; @@ -14210,13 +27393,14 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.toObject = functio * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(includeInstance, f) + startTimeMs: jspb.Message.getFieldWithDefault(msg, 1, 0), + startTimeIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -14230,23 +27414,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.toObject = function(includeI /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest; - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -14254,9 +27438,12 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartTimeMs(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setStartTimeIncluded(value); break; default: reader.skipField(); @@ -14271,9 +27458,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -14281,52 +27468,68 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getStartTimeMs(); + if (f !== 0) { + writer.writeUint64( 1, - f, - proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter + f + ); + } + f = message.getStartTimeIncluded(); + if (f) { + writer.writeBool( + 2, + f ); } }; +/** + * optional uint64 start_time_ms = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.getStartTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_ = [[6,7]]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.setStartTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + /** - * @enum {number} + * optional bool start_time_included = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase = { - START_NOT_SET: 0, - START_AFTER: 6, - START_AT: 7 +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.getStartTimeIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.StartCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo.prototype.setStartTimeIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -14340,8 +27543,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.toObject(opt_includeInstance, this); }; @@ -14350,20 +27553,14 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.protot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.toObject = function(includeInstance, msg) { var f, obj = { - dataContractId: msg.getDataContractId_asB64(), - documentType: jspb.Message.getFieldWithDefault(msg, 2, ""), - where: msg.getWhere_asB64(), - orderBy: msg.getOrderBy_asB64(), - limit: jspb.Message.getFieldWithDefault(msg, 5, 0), - startAfter: msg.getStartAfter_asB64(), - startAt: msg.getStartAt_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 8, false) + endTimeMs: jspb.Message.getFieldWithDefault(msg, 1, 0), + endTimeIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -14377,23 +27574,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.toObje /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0; - return proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -14401,36 +27598,12 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deseri var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setDataContractId(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setEndTimeMs(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentType(value); - break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setWhere(value); - break; - case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setOrderBy(value); - break; - case 5: - var value = /** @type {number} */ (reader.readUint32()); - msg.setLimit(value); - break; - case 6: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartAfter(value); - break; - case 7: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartAt(value); - break; - case 8: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setEndTimeIncluded(value); break; default: reader.skipField(); @@ -14445,9 +27618,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.deseri * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -14455,65 +27628,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.protot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDataContractId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getDocumentType(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getWhere_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f - ); - } - f = message.getOrderBy_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f - ); - } - f = message.getLimit(); + f = message.getEndTimeMs(); if (f !== 0) { - writer.writeUint32( - 5, - f - ); - } - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); - if (f != null) { - writer.writeBytes( - 6, - f - ); - } - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 7)); - if (f != null) { - writer.writeBytes( - 7, + writer.writeUint64( + 1, f ); } - f = message.getProve(); + f = message.getEndTimeIncluded(); if (f) { writer.writeBool( - 8, + 2, f ); } @@ -14521,215 +27652,139 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.serial /** - * optional bytes data_contract_id = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes data_contract_id = 1; - * This is a type-conversion wrapper around `getDataContractId()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getDataContractId())); -}; - - -/** - * optional bytes data_contract_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDataContractId()` - * @return {!Uint8Array} + * optional uint64 end_time_ms = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDataContractId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getDataContractId())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.getEndTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDataContractId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.setEndTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional string document_type = 2; - * @return {string} + * optional bool end_time_included = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getDocumentType = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.getEndTimeIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setDocumentType = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo.prototype.setEndTimeIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional bytes where = 3; - * @return {string} + * optional StartAtTimeInfo start_time_info = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getStartTimeInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo, 1)); }; /** - * optional bytes where = 3; - * This is a type-conversion wrapper around `getWhere()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getWhere())); + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.StartAtTimeInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setStartTimeInfo = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** - * optional bytes where = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getWhere()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getWhere_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getWhere())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearStartTimeInfo = function() { + return this.setStartTimeInfo(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setWhere = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasStartTimeInfo = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional bytes order_by = 4; - * @return {string} + * optional EndAtTimeInfo end_time_info = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getEndTimeInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo, 2)); }; /** - * optional bytes order_by = 4; - * This is a type-conversion wrapper around `getOrderBy()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getOrderBy())); + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.EndAtTimeInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setEndTimeInfo = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** - * optional bytes order_by = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getOrderBy()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getOrderBy_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getOrderBy())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearEndTimeInfo = function() { + return this.setEndTimeInfo(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setOrderBy = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasEndTimeInfo = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional uint32 limit = 5; + * optional uint32 limit = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getLimit = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getLimit = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional bytes start_after = 6; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); -}; - - -/** - * optional bytes start_after = 6; - * This is a type-conversion wrapper around `getStartAfter()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartAfter())); -}; - - -/** - * optional bytes start_after = 6; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartAfter()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAfter_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartAfter())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAfter = function(value) { - return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setField(this, 3, value); }; /** * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAfter = function() { - return jspb.Message.setOneofField(this, 6, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearLimit = function() { + return jspb.Message.setField(this, 3, undefined); }; @@ -14737,113 +27792,107 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.protot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAfter = function() { - return jspb.Message.getField(this, 6) != null; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional bytes start_at = 7; - * @return {string} + * optional uint32 offset = 4; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getOffset = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** - * optional bytes start_at = 7; - * This is a type-conversion wrapper around `getStartAt()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartAt())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setField(this, 4, value); }; /** - * optional bytes start_at = 7; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartAt()` - * @return {!Uint8Array} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getStartAt_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartAt())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.clearOffset = function() { + return jspb.Message.setField(this, 4, undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setStartAt = function(value) { - return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 4) != null; }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * optional bool ascending = 5; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.clearStartAt = function() { - return jspb.Message.setOneofField(this, 7, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.hasStartAt = function() { - return jspb.Message.getField(this, 7) != null; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); }; /** - * optional bool prove = 8; + * optional bool prove = 6; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 8, value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); }; /** - * optional GetDocumentsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} + * optional GetVotePollsByEndDateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.GetVotePollsByEndDateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -14852,7 +27901,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.clearV0 = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -14866,21 +27915,21 @@ proto.org.dash.platform.dapi.v0.GetDocumentsRequest.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_[0])); }; @@ -14898,8 +27947,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.toObject(opt_includeInstance, this); }; @@ -14908,13 +27957,13 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -14928,23 +27977,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse; - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -14952,8 +28001,8 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -14969,9 +28018,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -14979,18 +28028,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.serializeBinaryToWriter ); } }; @@ -15005,22 +28054,22 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.serializeBinaryToWriter = f * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase = { RESULT_NOT_SET: 0, - DOCUMENTS: 1, + VOTE_POLLS_BY_TIMESTAMPS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_[0])); }; @@ -15038,8 +28087,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.toObject(opt_includeInstance, this); }; @@ -15048,13 +28097,13 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - documents: (f = msg.getDocuments()) && proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(includeInstance, f), + votePollsByTimestamps: (f = msg.getVotePollsByTimestamps()) && proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -15070,23 +28119,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0; - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15094,9 +28143,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader); - msg.setDocuments(value); + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinaryFromReader); + msg.setVotePollsByTimestamps(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -15121,9 +28170,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15131,18 +28180,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDocuments(); + f = message.getVotePollsByTimestamps(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.serializeBinaryToWriter ); } f = message.getProof(); @@ -15170,7 +28219,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.seri * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.repeatedFields_ = [2]; @@ -15187,8 +28236,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.toObject(opt_includeInstance, this); }; @@ -15197,13 +28246,14 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.toObject = function(includeInstance, msg) { var f, obj = { - documentsList: msg.getDocumentsList_asB64() + timestamp: jspb.Message.getFieldWithDefault(msg, 1, 0), + serializedVotePollsList: msg.getSerializedVotePollsList_asB64() }; if (includeInstance) { @@ -15217,23 +28267,23 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents; - return proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15241,8 +28291,12 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu var field = reader.getFieldNumber(); switch (field) { case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setTimestamp(value); + break; + case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addDocuments(value); + msg.addSerializedVotePolls(value); break; default: reader.skipField(); @@ -15257,9 +28311,9 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15267,16 +28321,236 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} message + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getDocumentsList_asU8(); + f = message.getTimestamp(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getSerializedVotePollsList_asU8(); if (f.length > 0) { writer.writeRepeatedBytes( + 2, + f + ); + } +}; + + +/** + * optional uint64 timestamp = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getTimestamp = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.setTimestamp = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated bytes serialized_vote_polls = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getSerializedVotePollsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * repeated bytes serialized_vote_polls = 2; + * This is a type-conversion wrapper around `getSerializedVotePollsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getSerializedVotePollsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getSerializedVotePollsList())); +}; + + +/** + * repeated bytes serialized_vote_polls = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSerializedVotePollsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.getSerializedVotePollsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getSerializedVotePollsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.setSerializedVotePollsList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.addSerializedVotePolls = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} returns this + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.prototype.clearSerializedVotePollsList = function() { + return this.setSerializedVotePollsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.toObject = function(includeInstance, msg) { + var f, obj = { + votePollsByTimestampsList: jspb.Message.toObjectList(msg.getVotePollsByTimestampsList(), + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.toObject, includeInstance), + finishedResults: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps; + return proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.deserializeBinaryFromReader); + msg.addVotePollsByTimestamps(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFinishedResults(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVotePollsByTimestampsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, + f, + proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp.serializeBinaryToWriter + ); + } + f = message.getFinishedResults(); + if (f) { + writer.writeBool( + 2, f ); } @@ -15284,91 +28558,86 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Docu /** - * repeated bytes documents = 1; - * @return {!Array} + * repeated SerializedVotePollsByTimestamp vote_polls_by_timestamps = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.getVotePollsByTimestampsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp, 1)); }; /** - * repeated bytes documents = 1; - * This is a type-conversion wrapper around `getDocumentsList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getDocumentsList())); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} returns this +*/ +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.setVotePollsByTimestampsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * repeated bytes documents = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getDocumentsList()` - * @return {!Array} + * @param {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.getDocumentsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getDocumentsList())); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.addVotePollsByTimestamps = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamp, opt_index); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.setDocumentsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.clearVotePollsByTimestampsList = function() { + return this.setVotePollsByTimestampsList([]); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this + * optional bool finished_results = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.addDocuments = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.getFinishedResults = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents.prototype.clearDocumentsList = function() { - return this.setDocumentsList([]); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps.prototype.setFinishedResults = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional Documents documents = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} + * optional SerializedVotePollsByTimestamps vote_polls_by_timestamps = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getDocuments = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getVotePollsByTimestamps = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.Documents|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.SerializedVotePollsByTimestamps|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setDocuments = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.setVotePollsByTimestamps = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearDocuments = function() { - return this.setDocuments(undefined); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.clearVotePollsByTimestamps = function() { + return this.setVotePollsByTimestamps(undefined); }; @@ -15376,7 +28645,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasDocuments = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.hasVotePollsByTimestamps = function() { return jspb.Message.getField(this, 1) != null; }; @@ -15385,7 +28654,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -15393,18 +28662,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -15413,7 +28682,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -15422,7 +28691,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -15430,18 +28699,18 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -15450,35 +28719,35 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetDocumentsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} + * optional GetVotePollsByEndDateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.GetVotePollsByEndDateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetDocumentsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetDocumentsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -15487,7 +28756,7 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetVotePollsByEndDateResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -15501,21 +28770,21 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_[0])); }; @@ -15533,8 +28802,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.toObject(opt_includeInstance, this); }; @@ -15543,13 +28812,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -15563,23 +28832,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15587,8 +28856,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -15604,9 +28873,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15614,30 +28883,249 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + indexValuesList: msg.getIndexValuesList_asB64(), + resultType: jspb.Message.getFieldWithDefault(msg, 5, 0), + allowIncludeLockedAndAbstainingVoteTally: jspb.Message.getBooleanFieldWithDefault(msg, 6, false), + startAtIdentifierInfo: (f = msg.getStartAtIdentifierInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 8, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 9, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIndexValues(value); + break; + case 5: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} */ (reader.readEnum()); + msg.setResultType(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAllowIncludeLockedAndAbstainingVoteTally(value); + break; + case 7: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader); + msg.setStartAtIdentifierInfo(value); + break; + case 8: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getResultType(); + if (f !== 0.0) { + writer.writeEnum( + 5, + f + ); + } + f = message.getAllowIncludeLockedAndAbstainingVoteTally(); + if (f) { + writer.writeBool( + 6, + f + ); + } + f = message.getStartAtIdentifierInfo(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeUint32( + 8, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 9, + f ); } }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType = { + DOCUMENTS: 0, + VOTE_TALLY: 1, + DOCUMENTS_AND_VOTE_TALLY: 2 +}; + @@ -15654,8 +29142,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.toObject(opt_includeInstance, this); }; @@ -15664,14 +29152,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHashesList: msg.getPublicKeyHashesList_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + startIdentifier: msg.getStartIdentifier_asB64(), + startIdentifierIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -15685,23 +29173,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15710,11 +29198,11 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addPublicKeyHashes(value); + msg.setStartIdentifier(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setStartIdentifierIncluded(value); break; default: reader.skipField(); @@ -15729,9 +29217,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15739,20 +29227,20 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHashesList_asU8(); + f = message.getStartIdentifier_asU8(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeBytes( 1, f ); } - f = message.getProve(); + f = message.getStartIdentifierIncluded(); if (f) { writer.writeBool( 2, @@ -15763,118 +29251,504 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** - * repeated bytes public_key_hashes = 1; + * optional bytes start_identifier = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_identifier = 1; + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartIdentifier())); +}; + + +/** + * optional bytes start_identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool start_identifier_included = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifierIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifierIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string index_name = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated bytes index_values = 4; * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); }; /** - * repeated bytes public_key_hashes = 1; - * This is a type-conversion wrapper around `getPublicKeyHashesList()` + * repeated bytes index_values = 4; + * This is a type-conversion wrapper around `getIndexValuesList()` * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexValuesList_asB64 = function() { return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getPublicKeyHashesList())); + this.getIndexValuesList())); }; /** - * repeated bytes public_key_hashes = 1; + * repeated bytes index_values = 4; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHashesList()` + * This is a type-conversion wrapper around `getIndexValuesList()` * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getIndexValuesList_asU8 = function() { return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getPublicKeyHashesList())); + this.getIndexValuesList())); }; /** * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setPublicKeyHashesList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); }; /** * @param {!(string|Uint8Array)} value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.addPublicKeyHashes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.addIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.clearIndexValuesList = function() { + return this.setIndexValuesList([]); +}; + + +/** + * optional ResultType result_type = 5; + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getResultType = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.ResultType} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setResultType = function(value) { + return jspb.Message.setProto3EnumField(this, 5, value); +}; + + +/** + * optional bool allow_include_locked_and_abstaining_vote_tally = 6; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getAllowIncludeLockedAndAbstainingVoteTally = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setAllowIncludeLockedAndAbstainingVoteTally = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); +}; + + +/** + * optional StartAtIdentifierInfo start_at_identifier_info = 7; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getStartAtIdentifierInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo, 7)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.StartAtIdentifierInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setStartAtIdentifierInfo = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.clearStartAtIdentifierInfo = function() { + return this.setStartAtIdentifierInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.hasStartAtIdentifierInfo = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional uint32 count = 8; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setCount = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.clearCount = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.hasCount = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional bool prove = 9; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 9, value); +}; + + +/** + * optional GetContestedResourceVoteStateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.GetContestedResourceVoteStateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.clearPublicKeyHashesList = function() { - return this.setPublicKeyHashesList([]); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional bool prove = 2; - * @return {boolean} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.toObject(opt_includeInstance, this); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional GetIdentitiesByPublicKeyHashesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0], value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.serializeBinaryToWriter + ); + } }; @@ -15887,21 +29761,22 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + CONTESTED_RESOURCE_CONTENDERS: 1, + PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_[0])); }; @@ -15919,8 +29794,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.toObject(opt_includeInstance, this); }; @@ -15929,13 +29804,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(includeInstance, f) + contestedResourceContenders: (f = msg.getContestedResourceContenders()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -15949,23 +29826,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15973,9 +29850,19 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinaryFromReader); + msg.setContestedResourceContenders(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -15990,9 +29877,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16000,18 +29887,34 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getContestedResourceContenders(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; @@ -16033,8 +29936,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.toObject(opt_includeInstance, this); }; @@ -16043,14 +29946,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - value: (f = msg.getValue()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) + finishedVoteOutcome: jspb.Message.getFieldWithDefault(msg, 1, 0), + wonByIdentityId: msg.getWonByIdentityId_asB64(), + finishedAtBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), + finishedAtCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 4, 0), + finishedAtBlockTimeMs: jspb.Message.getFieldWithDefault(msg, 5, 0), + finishedAtEpoch: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -16064,23 +29971,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16088,13 +29995,28 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} */ (reader.readEnum()); + msg.setFinishedVoteOutcome(value); break; case 2: - var value = new google_protobuf_wrappers_pb.BytesValue; - reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); - msg.setValue(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setWonByIdentityId(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFinishedAtBlockHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFinishedAtCoreBlockHeight(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFinishedAtBlockTimeMs(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFinishedAtEpoch(value); break; default: reader.skipField(); @@ -16109,9 +30031,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16119,106 +30041,213 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getFinishedVoteOutcome(); + if (f !== 0.0) { + writer.writeEnum( 1, f ); } - f = message.getValue(); + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); if (f != null) { - writer.writeMessage( + writer.writeBytes( 2, - f, - google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter + f + ); + } + f = message.getFinishedAtBlockHeight(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getFinishedAtCoreBlockHeight(); + if (f !== 0) { + writer.writeUint32( + 4, + f + ); + } + f = message.getFinishedAtBlockTimeMs(); + if (f !== 0) { + writer.writeUint64( + 5, + f + ); + } + f = message.getFinishedAtEpoch(); + if (f !== 0) { + writer.writeUint32( + 6, + f ); } }; /** - * optional bytes public_key_hash = 1; + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome = { + TOWARDS_IDENTITY: 0, + LOCKED: 1, + NO_PREVIOUS_WINNER: 2 +}; + +/** + * optional FinishedVoteOutcome finished_vote_outcome = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedVoteOutcome = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.FinishedVoteOutcome} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedVoteOutcome = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional bytes won_by_identity_id = 2; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getWonByIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` + * optional bytes won_by_identity_id = 2; + * This is a type-conversion wrapper around `getWonByIdentityId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getWonByIdentityId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); + this.getWonByIdentityId())); }; /** - * optional bytes public_key_hash = 1; + * optional bytes won_by_identity_id = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` + * This is a type-conversion wrapper around `getWonByIdentityId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getWonByIdentityId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); + this.getWonByIdentityId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setWonByIdentityId = function(value) { + return jspb.Message.setField(this, 2, value); }; /** - * optional google.protobuf.BytesValue value = 2; - * @return {?proto.google.protobuf.BytesValue} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getValue = function() { - return /** @type{?proto.google.protobuf.BytesValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.clearWonByIdentityId = function() { + return jspb.Message.setField(this, 2, undefined); }; /** - * @param {?proto.google.protobuf.BytesValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.hasWonByIdentityId = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * optional uint64 finished_at_block_height = 3; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.hasValue = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint32 finished_at_core_block_height = 4; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtCoreBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtCoreBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional uint64 finished_at_block_time_ms = 5; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtBlockTimeMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtBlockTimeMs = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional uint32 finished_at_epoch = 6; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.getFinishedAtEpoch = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.prototype.setFinishedAtEpoch = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); }; @@ -16228,7 +30257,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.repeatedFields_ = [1]; @@ -16245,8 +30274,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.toObject(opt_includeInstance, this); }; @@ -16255,14 +30284,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject, includeInstance) + contendersList: jspb.Message.toObjectList(msg.getContendersList(), + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.toObject, includeInstance), + abstainVoteTally: jspb.Message.getFieldWithDefault(msg, 2, 0), + lockVoteTally: jspb.Message.getFieldWithDefault(msg, 3, 0), + finishedVoteInfo: (f = msg.getFinishedVoteInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.toObject(includeInstance, f) }; if (includeInstance) { @@ -16276,23 +30308,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16300,9 +30332,22 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinaryFromReader); + msg.addContenders(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbstainVoteTally(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLockVoteTally(value); + break; + case 4: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.deserializeBinaryFromReader); + msg.setFinishedVoteInfo(value); break; default: reader.skipField(); @@ -16317,9 +30362,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16327,90 +30372,195 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityEntriesList(); + f = message.getContendersList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeUint32( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint32( + 3, + f + ); + } + f = message.getFinishedVoteInfo(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo.serializeBinaryToWriter ); } }; /** - * repeated PublicKeyHashIdentityEntry identity_entries = 1; - * @return {!Array} + * repeated Contender contenders = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getContendersList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.setIdentityEntriesList = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setContendersList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.addContenders = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearContendersList = function() { + return this.setContendersList([]); }; +/** + * optional uint32 abstain_vote_tally = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getAbstainVoteTally = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setAbstainVoteTally = function(value) { + return jspb.Message.setField(this, 2, value); +}; + /** - * @enum {number} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITIES: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearAbstainVoteTally = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.hasAbstainVoteTally = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint32 lock_vote_tally = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getLockVoteTally = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setLockVoteTally = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearLockVoteTally = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.hasLockVoteTally = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional FinishedVoteInfo finished_vote_info = 4; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.getFinishedVoteInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo, 4)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.FinishedVoteInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.setFinishedVoteInfo = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.clearFinishedVoteInfo = function() { + return this.setFinishedVoteInfo(undefined); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders.prototype.hasFinishedVoteInfo = function() { + return jspb.Message.getField(this, 4) != null; }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -16424,8 +30574,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.toObject(opt_includeInstance, this); }; @@ -16434,15 +30584,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.toObject = function(includeInstance, msg) { var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + identifier: msg.getIdentifier_asB64(), + voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0), + document: msg.getDocument_asB64() }; if (includeInstance) { @@ -16456,23 +30606,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16480,19 +30630,16 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader); - msg.setIdentities(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentifier(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVoteCount(value); break; case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setDocument(value); break; default: reader.skipField(); @@ -16507,9 +30654,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16517,101 +30664,102 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentities(); - if (f != null) { - writer.writeMessage( + f = message.getIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter + f ); } - f = message.getProof(); + f = /** @type {number} */ (jspb.Message.getField(message, 2)); if (f != null) { - writer.writeMessage( + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + f ); } - f = message.getMetadata(); + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 3)); if (f != null) { - writer.writeMessage( + writer.writeBytes( 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional IdentitiesByPublicKeyHashes identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * optional bytes identifier = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); + * optional bytes identifier = 1; + * This is a type-conversion wrapper around `getIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentifier())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * optional bytes identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentifier()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentifier())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasIdentities = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.setIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional uint32 vote_count = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getVoteCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.setVoteCount = function(value) { + return jspb.Message.setField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.clearVoteCount = function() { + return jspb.Message.setField(this, 2, undefined); }; @@ -16619,36 +30767,59 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.hasVoteCount = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional bytes document = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getDocument = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * optional bytes document = 3; + * This is a type-conversion wrapper around `getDocument()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getDocument_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getDocument())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * optional bytes document = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDocument()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.getDocument_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getDocument())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.setDocument = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.clearDocument = function() { + return jspb.Message.setField(this, 3, undefined); }; @@ -16656,36 +30827,36 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.Contender.prototype.hasDocument = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentitiesByPublicKeyHashesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * optional ContestedResourceContenders contested_resource_contenders = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getContestedResourceContenders = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.ContestedResourceContenders|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.setContestedResourceContenders = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.clearContestedResourceContenders = function() { + return this.setContestedResourceContenders(undefined); }; @@ -16693,151 +30864,148 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.hasContestedResourceContenders = function() { return jspb.Message.getField(this, 1) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.oneofGroups_[0], value); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * optional GetContestedResourceVoteStateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0, 1)); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.GetContestedResourceVoteStateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceVoteStateResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -16853,8 +31021,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.toObject(opt_includeInstance, this); }; @@ -16863,14 +31031,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -16884,23 +31051,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16908,12 +31075,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -16928,9 +31092,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16938,151 +31102,30 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getProve(); - if (f) { - writer.writeBool( - 2, - f - ); - } -}; - - -/** - * optional bytes public_key_hash = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); -}; - - -/** - * optional bytes public_key_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.serializeBinaryToWriter + ); + } }; + + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.repeatedFields_ = [4]; @@ -17099,8 +31142,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.toObject(opt_includeInstance, this); }; @@ -17109,13 +31152,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toO * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + indexName: jspb.Message.getFieldWithDefault(msg, 3, ""), + indexValuesList: msg.getIndexValuesList_asB64(), + contestantId: msg.getContestantId_asB64(), + startAtIdentifierInfo: (f = msg.getStartAtIdentifierInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.toObject(includeInstance, f), + count: jspb.Message.getFieldWithDefault(msg, 7, 0), + orderAscending: jspb.Message.getBooleanFieldWithDefault(msg, 8, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 9, false) }; if (includeInstance) { @@ -17129,23 +31180,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = fu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17153,9 +31204,41 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setIndexName(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addIndexValues(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContestantId(value); + break; + case 6: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader); + msg.setStartAtIdentifierInfo(value); + break; + case 7: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOrderAscending(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -17170,9 +31253,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17180,50 +31263,80 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.ser /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIndexName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getIndexValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } + f = message.getContestantId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getStartAtIdentifierInfo(); if (f != null) { writer.writeMessage( - 1, + 6, f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeUint32( + 7, + f + ); + } + f = message.getOrderAscending(); + if (f) { + writer.writeBool( + 8, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 9, + f ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17239,8 +31352,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.toObject(opt_includeInstance, this); }; @@ -17249,15 +31362,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + startIdentifier: msg.getStartIdentifier_asB64(), + startIdentifierIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -17271,23 +31383,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17296,17 +31408,11 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + msg.setStartIdentifier(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setStartIdentifierIncluded(value); break; default: reader.skipField(); @@ -17318,210 +31424,308 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** - * Serializes the message to binary data (in protobuf wire format). + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStartIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getStartIdentifierIncluded(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes start_identifier = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_identifier = 1; + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartIdentifier())); +}; + + +/** + * optional bytes start_identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool start_identifier_included = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.getStartIdentifierIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo.prototype.setStartIdentifierIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional bytes contract_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeBytes( - 1, - f - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bytes identity = 1; + * optional string document_type_name = 2; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` - * @return {string} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * optional bytes identity = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` - * @return {!Uint8Array} + * optional string index_name = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setIndexName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; /** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * repeated bytes index_values = 4; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes index_values = 4; + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIndexValuesList())); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * repeated bytes index_values = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIndexValuesList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getIndexValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIndexValuesList())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setIndexValuesList = function(value) { + return jspb.Message.setField(this, 4, value || []); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.addIndexValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.clearIndexValuesList = function() { + return this.setIndexValuesList([]); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional bytes contestant_id = 5; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContestantId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * optional bytes contestant_id = 5; + * This is a type-conversion wrapper around `getContestantId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContestantId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContestantId())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * optional bytes contestant_id = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContestantId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getContestantId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContestantId())); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setContestantId = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); }; /** - * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * optional StartAtIdentifierInfo start_at_identifier_info = 6; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getStartAtIdentifierInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo, 6)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.StartAtIdentifierInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setStartAtIdentifierInfo = function(value) { + return jspb.Message.setWrapperField(this, 6, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.clearStartAtIdentifierInfo = function() { + return this.setStartAtIdentifierInfo(undefined); }; @@ -17529,151 +31733,146 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.cle * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.hasStartAtIdentifierInfo = function() { + return jspb.Message.getField(this, 6) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * optional uint32 count = 7; + * @return {number} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + /** - * @enum {number} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setCount = function(value) { + return jspb.Message.setField(this, 7, value); }; + /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.clearCount = function() { + return jspb.Message.setField(this, 7, undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.hasCount = function() { + return jspb.Message.getField(this, 7) != null; +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional bool order_ascending = 8; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getOrderAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) - }; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setOrderAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 8, value); +}; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + +/** + * optional bool prove = 9; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 9, value); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * optional GetContestedResourceVotersForIdentityRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0, 1)); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.GetContestedResourceVotersForIdentityRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17689,8 +31888,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.toObject(opt_includeInstance, this); }; @@ -17699,14 +31898,13 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.toObject = function(includeInstance, msg) { var f, obj = { - stateTransitionHash: msg.getStateTransitionHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -17720,23 +31918,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17744,12 +31942,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStateTransitionHash(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -17764,9 +31959,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17774,126 +31969,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStateTransitionHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getProve(); - if (f) { - writer.writeBool( - 2, - f + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.serializeBinaryToWriter ); } }; -/** - * optional bytes state_transition_hash = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes state_transition_hash = 1; - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStateTransitionHash())); -}; - - -/** - * optional bytes state_transition_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStateTransitionHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; - - -/** - * optional WaitForStateTransitionResultRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { - return this.setV0(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - /** * Oneof group definitions for this message. Each group defines the field @@ -17903,21 +31995,22 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.ha * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + CONTESTED_RESOURCE_VOTERS: 1, + PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_[0])); }; @@ -17935,8 +32028,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.toObject(opt_includeInstance, this); }; @@ -17945,13 +32038,15 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) + contestedResourceVoters: (f = msg.getContestedResourceVoters()) && proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -17965,23 +32060,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17989,9 +32084,19 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinaryFromReader); + msg.setContestedResourceVoters(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -18006,9 +32111,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18016,49 +32121,46 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getContestedResourceVoters(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - ERROR: 1, - PROOF: 2 -}; + + /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.repeatedFields_ = [1]; @@ -18075,8 +32177,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.toObject(opt_includeInstance, this); }; @@ -18085,15 +32187,14 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.toObject = function(includeInstance, msg) { var f, obj = { - error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + votersList: msg.getVotersList_asB64(), + finishedResults: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -18107,23 +32208,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters; + return proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18131,19 +32232,12 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); - msg.setError(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addVoters(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFinishedResults(value); break; default: reader.skipField(); @@ -18158,9 +32252,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18168,64 +32262,133 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getError(); - if (f != null) { - writer.writeMessage( + f = message.getVotersList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, - f, - proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getFinishedResults(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional StateTransitionBroadcastError error = 1; - * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * repeated bytes voters = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getVotersList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * repeated bytes voters = 1; + * This is a type-conversion wrapper around `getVotersList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getVotersList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getVotersList())); +}; + + +/** + * repeated bytes voters = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getVotersList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getVotersList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getVotersList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.setVotersList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.addVoters = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.clearVotersList = function() { + return this.setVotersList([]); +}; + + +/** + * optional bool finished_results = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.getFinishedResults = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters.prototype.setFinishedResults = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional ContestedResourceVoters contested_resource_voters = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getContestedResourceVoters = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.ContestedResourceVoters|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.setContestedResourceVoters = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { - return this.setError(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.clearContestedResourceVoters = function() { + return this.setContestedResourceVoters(undefined); }; @@ -18233,7 +32396,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.hasContestedResourceVoters = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18242,7 +32405,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -18250,18 +32413,18 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -18270,7 +32433,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -18279,7 +32442,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -18287,18 +32450,18 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -18307,35 +32470,35 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional WaitForStateTransitionResultResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * optional GetContestedResourceVotersForIdentityResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.GetContestedResourceVotersForIdentityResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -18344,7 +32507,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceVotersForIdentityResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18358,25 +32521,139 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.serializeBinaryToWriter + ); + } }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -18390,8 +32667,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.toObject(opt_includeInstance, this); }; @@ -18400,13 +32677,18 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) + identityId: msg.getIdentityId_asB64(), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + orderAscending: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), + startAtVotePollIdInfo: (f = msg.getStartAtVotePollIdInfo()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.toObject(includeInstance, f), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) }; if (includeInstance) { @@ -18420,23 +32702,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18444,9 +32726,31 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); + break; + case 3: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOrderAscending(value); + break; + case 5: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinaryFromReader); + msg.setStartAtVotePollIdInfo(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -18461,9 +32765,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18471,18 +32775,55 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getLimit(); if (f != null) { writer.writeMessage( - 1, + 2, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOffset(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOrderAscending(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getStartAtVotePollIdInfo(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.serializeBinaryToWriter + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 6, + f ); } }; @@ -18504,8 +32845,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.toObject(opt_includeInstance, this); }; @@ -18514,14 +32855,14 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.toObject = function(includeInstance, msg) { var f, obj = { - height: jspb.Message.getFieldWithDefault(msg, 1, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + startAtPollIdentifier: msg.getStartAtPollIdentifier_asB64(), + startPollIdentifierIncluded: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -18535,23 +32876,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18559,12 +32900,12 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setHeight(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartAtPollIdentifier(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + msg.setStartPollIdentifierIncluded(value); break; default: reader.skipField(); @@ -18579,9 +32920,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18589,20 +32930,20 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getHeight(); - if (f !== 0) { - writer.writeInt32( + f = message.getStartAtPollIdentifier_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getProve(); + f = message.getStartPollIdentifierIncluded(); if (f) { writer.writeBool( 2, @@ -18613,66 +32954,224 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** - * optional int32 height = 1; - * @return {number} + * optional bytes start_at_poll_identifier = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartAtPollIdentifier = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_at_poll_identifier = 1; + * This is a type-conversion wrapper around `getStartAtPollIdentifier()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartAtPollIdentifier_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartAtPollIdentifier())); +}; + + +/** + * optional bytes start_at_poll_identifier = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartAtPollIdentifier()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartAtPollIdentifier_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartAtPollIdentifier())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.setStartAtPollIdentifier = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool start_poll_identifier_included = 2; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.getStartPollIdentifierIncluded = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo.prototype.setStartPollIdentifierIncluded = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional google.protobuf.UInt32Value limit = 2; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 2)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.UInt32Value offset = 3; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional bool prove = 2; + * optional bool order_ascending = 4; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getOrderAscending = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setOrderAscending = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * optional GetConsensusParamsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * optional StartAtVotePollIdInfo start_at_vote_poll_id_info = 5; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getStartAtVotePollIdInfo = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo, 5)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.StartAtVotePollIdInfo|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setStartAtVotePollIdInfo = function(value) { + return jspb.Message.setWrapperField(this, 5, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.clearStartAtVotePollIdInfo = function() { + return this.setStartAtVotePollIdInfo(undefined); }; @@ -18680,153 +33179,94 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.hasStartAtVotePollIdInfo = function() { + return jspb.Message.getField(this, 5) != null; }; - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * optional bool prove = 6; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + /** - * @enum {number} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} + * optional GetContestedResourceIdentityVotesRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0, 1)); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.GetContestedResourceIdentityVotesRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.oneofGroups_[0], value); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; + /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_ = [[1]]; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; - /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -18840,8 +33280,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.toObject(opt_includeInstance, this); }; @@ -18850,15 +33290,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.toObject = function(includeInstance, msg) { var f, obj = { - maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), - timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -18872,23 +33310,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18896,16 +33334,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxGas(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setTimeIotaMs(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -18920,9 +33351,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18930,93 +33361,52 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getMaxGas(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getTimeIotaMs(); - if (f.length > 0) { - writer.writeString( - 3, - f + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.serializeBinaryToWriter ); } }; -/** - * optional string max_bytes = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_gas = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_ = [[1,2]]; /** - * optional string time_iota_ms = 3; - * @return {string} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VOTES: 1, + PROOF: 2 }; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + * @return {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -19030,8 +33420,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.toObject(opt_includeInstance, this); }; @@ -19040,15 +33430,15 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), - maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") + votes: (f = msg.getVotes()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -19062,23 +33452,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19086,16 +33476,19 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeNumBlocks(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinaryFromReader); + msg.setVotes(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeDuration(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -19110,9 +33503,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19120,90 +33513,46 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxAgeNumBlocks(); - if (f.length > 0) { - writer.writeString( + f = message.getVotes(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.serializeBinaryToWriter ); } - f = message.getMaxAgeDuration(); - if (f.length > 0) { - writer.writeString( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 3, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * optional string max_age_num_blocks = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_age_duration = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string max_bytes = 3; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.repeatedFields_ = [1]; @@ -19220,8 +33569,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.toObject(opt_includeInstance, this); }; @@ -19230,14 +33579,15 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.toObject = function(includeInstance, msg) { var f, obj = { - block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), - evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) + contestedResourceIdentityVotesList: jspb.Message.toObjectList(msg.getContestedResourceIdentityVotesList(), + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.toObject, includeInstance), + finishedResults: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -19251,23 +33601,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19275,14 +33625,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); - msg.setBlock(value); + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinaryFromReader); + msg.addContestedResourceIdentityVotes(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); - msg.setEvidence(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFinishedResults(value); break; default: reader.skipField(); @@ -19297,9 +33646,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19307,170 +33656,89 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock(); - if (f != null) { - writer.writeMessage( + f = message.getContestedResourceIdentityVotesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serializeBinaryToWriter ); } - f = message.getEvidence(); - if (f != null) { - writer.writeMessage( + f = message.getFinishedResults(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter + f ); } }; /** - * optional ConsensusParamsBlock block = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { - return this.setBlock(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional ConsensusParamsEvidence evidence = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { - return this.setEvidence(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional GetConsensusParamsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * repeated ContestedResourceIdentityVote contested_resource_identity_votes = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.getContestedResourceIdentityVotesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.setContestedResourceIdentityVotesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.addContestedResourceIdentityVotes = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.clearContestedResourceIdentityVotesList = function() { + return this.setContestedResourceIdentityVotesList([]); }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; - /** - * @enum {number} + * optional bool finished_results = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.getFinishedResults = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes.prototype.setFinishedResults = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -19484,8 +33752,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.toObject(opt_includeInstance, this); }; @@ -19494,13 +33762,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) + voteChoiceType: jspb.Message.getFieldWithDefault(msg, 1, 0), + identityId: msg.getIdentityId_asB64() }; if (includeInstance) { @@ -19514,23 +33783,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19538,9 +33807,12 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} */ (reader.readEnum()); + msg.setVoteChoiceType(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); break; default: reader.skipField(); @@ -19555,9 +33827,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19565,23 +33837,123 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getVoteChoiceType(); + if (f !== 0.0) { + writer.writeEnum( 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f ); } }; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType = { + TOWARDS_IDENTITY: 0, + ABSTAIN: 1, + LOCK: 2 +}; + +/** + * optional VoteChoiceType vote_choice_type = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getVoteChoiceType = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.VoteChoiceType} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.setVoteChoiceType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional bytes identity_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes identity_id = 2; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.setIdentityId = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.clearIdentityId = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.prototype.hasIdentityId = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.repeatedFields_ = [3]; @@ -19598,8 +33970,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.toObject(opt_includeInstance, this); }; @@ -19608,13 +33980,16 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.toObject = function(includeInstance, msg) { var f, obj = { - prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 2, ""), + serializedIndexStorageValuesList: msg.getSerializedIndexStorageValuesList_asB64(), + voteChoice: (f = msg.getVoteChoice()) && proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.toObject(includeInstance, f) }; if (includeInstance) { @@ -19628,23 +34003,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote; + return proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19652,8 +34027,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addSerializedIndexStorageValues(value); + break; + case 4: + var value = new proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.deserializeBinaryFromReader); + msg.setVoteChoice(value); break; default: reader.skipField(); @@ -19668,9 +34056,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19678,65 +34066,190 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } + f = message.getDocumentTypeName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getSerializedIndexStorageValuesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 3, + f + ); + } + f = message.getVoteChoice(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice.serializeBinaryToWriter + ); + } }; /** - * optional bool prove = 1; - * @return {boolean} + * optional bytes contract_id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes contract_id = 1; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string document_type_name = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * repeated bytes serialized_index_storage_values = 3; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getSerializedIndexStorageValuesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * repeated bytes serialized_index_storage_values = 3; + * This is a type-conversion wrapper around `getSerializedIndexStorageValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getSerializedIndexStorageValuesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getSerializedIndexStorageValuesList())); +}; + + +/** + * repeated bytes serialized_index_storage_values = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSerializedIndexStorageValuesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getSerializedIndexStorageValuesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getSerializedIndexStorageValuesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setSerializedIndexStorageValuesList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.addSerializedIndexStorageValues = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.clearSerializedIndexStorageValuesList = function() { + return this.setSerializedIndexStorageValuesList([]); }; /** - * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * optional ResourceVoteChoice vote_choice = 4; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.getVoteChoice = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice, 4)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ResourceVoteChoice|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.setVoteChoice = function(value) { + return jspb.Message.setWrapperField(this, 4, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.clearVoteChoice = function() { + return this.setVoteChoice(undefined); }; @@ -19744,325 +34257,184 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVote.prototype.hasVoteChoice = function() { + return jspb.Message.getField(this, 4) != null; }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; - /** - * @enum {number} + * optional ContestedResourceIdentityVotes votes = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getVotes = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes, 1)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.ContestedResourceIdentityVotes|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.setVotes = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_[0], value); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.clearVotes = function() { + return this.setVotes(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { - var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.hasVotes = function() { + return jspb.Message.getField(this, 1) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); - msg.setV0(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; - /** - * @enum {number} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - VERSIONS: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { - var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * optional GetContestedResourceIdentityVotesResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0, 1)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); - msg.setVersions(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.GetContestedResourceIdentityVotesResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getVersions(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetContestedResourceIdentityVotesResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * List of repeated fields within this message type. - * @private {!Array} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_[0])); +}; @@ -20079,8 +34451,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.toObject(opt_includeInstance, this); }; @@ -20089,14 +34461,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.toObject = function(includeInstance, msg) { var f, obj = { - versionsList: jspb.Message.toObjectList(msg.getVersionsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20110,23 +34481,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20134,9 +34505,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); - msg.addVersions(value); + var value = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -20151,9 +34522,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20161,61 +34532,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.serializeBinaryToWriter ); } }; -/** - * repeated VersionEntry versions = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { - return this.setVersionsList([]); -}; - - @@ -20232,8 +34565,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.toObject(opt_includeInstance, this); }; @@ -20242,14 +34575,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), - voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -20263,23 +34596,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20287,12 +34620,12 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVersionNumber(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVoteCount(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -20307,9 +34640,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20317,200 +34650,113 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getVoteCount(); - if (f !== 0) { - writer.writeUint32( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f - ); - } -}; - - -/** - * optional uint32 version_number = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint32 vote_count = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional Versions versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { - return this.setVersions(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); + f + ); + } }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * optional bytes id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); }; /** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * optional bool prove = 2; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * optional GetPrefundedSpecializedBalanceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.GetPrefundedSpecializedBalanceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20519,7 +34765,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20533,21 +34779,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_[0])); }; @@ -20565,8 +34811,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.toObject(opt_includeInstance, this); }; @@ -20575,13 +34821,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20595,23 +34841,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObj /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20619,8 +34865,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -20636,9 +34882,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20646,24 +34892,50 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -20679,8 +34951,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.toObject(opt_includeInstance, this); }; @@ -20689,15 +34961,15 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - startProTxHash: msg.getStartProTxHash_asB64(), - count: jspb.Message.getFieldWithDefault(msg, 2, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -20711,23 +34983,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0; + return proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20735,16 +35007,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartProTxHash(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCount(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -20759,9 +35033,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20769,138 +35043,172 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( 1, f ); } - f = message.getCount(); - if (f !== 0) { - writer.writeUint32( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 3, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes start_pro_tx_hash = 1; - * @return {string} + * optional uint64 balance = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional bytes start_pro_tx_hash = 1; - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartProTxHash())); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.setBalance = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0], value); }; /** - * optional bytes start_pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {!Uint8Array} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartProTxHash())); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.clearBalance = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0], undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.hasBalance = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * optional uint32 count = 2; - * @return {number} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * optional bool prove = 3; + * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetPrefundedSpecializedBalanceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.GetPrefundedSpecializedBalanceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20909,7 +35217,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPrefundedSpecializedBalanceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20923,21 +35231,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_[0])); }; @@ -20955,8 +35263,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.toObject(opt_includeInstance, this); }; @@ -20965,13 +35273,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20985,23 +35293,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21009,8 +35317,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21026,9 +35334,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21036,50 +35344,24 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - VERSIONS: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -21095,8 +35377,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.toObject(opt_includeInstance, this); }; @@ -21105,15 +35387,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) }; if (includeInstance) { @@ -21127,23 +35407,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21151,19 +35431,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); - msg.setVersions(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -21178,9 +35447,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21188,46 +35457,102 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersions(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 1, - f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; +/** + * optional bool prove = 1; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + +/** + * optional GetTotalCreditsInPlatformRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.GetTotalCreditsInPlatformRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_[0])); +}; @@ -21244,8 +35569,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.toObject(opt_includeInstance, this); }; @@ -21254,14 +35579,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.toObject = function(includeInstance, msg) { var f, obj = { - versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -21275,23 +35599,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21299,9 +35623,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); - msg.addVersionSignals(value); + var value = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -21316,9 +35640,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21326,64 +35650,52 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionSignalsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.serializeBinaryToWriter ); } }; -/** - * repeated VersionSignal version_signals = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); -}; - /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_ = [[1,2]]; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + CREDITS: 1, + PROOF: 2 }; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this + * @return {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { - return this.setVersionSignalsList([]); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -21397,8 +35709,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.toObject(opt_includeInstance, this); }; @@ -21407,14 +35719,15 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - proTxHash: msg.getProTxHash_asB64(), - version: jspb.Message.getFieldWithDefault(msg, 2, 0) + credits: jspb.Message.getFieldWithDefault(msg, 1, 0), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -21428,23 +35741,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0; + return proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21452,12 +35765,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setCredits(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVersion(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -21472,9 +35791,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21482,114 +35801,62 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message + * @param {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( 1, f ); } - f = message.getVersion(); - if (f !== 0) { - writer.writeUint32( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes pro_tx_hash = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes pro_tx_hash = 1; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); -}; - - -/** - * optional bytes pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional uint32 version = 2; + * optional uint64 credits = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getCredits = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional VersionSignals versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.setCredits = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { - return this.setVersions(undefined); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.clearCredits = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0], undefined); }; @@ -21597,7 +35864,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.hasCredits = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21606,7 +35873,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -21614,18 +35881,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -21634,7 +35901,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -21643,7 +35910,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -21651,18 +35918,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -21671,35 +35938,35 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * optional GetTotalCreditsInPlatformResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.GetTotalCreditsInPlatformResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -21708,7 +35975,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetTotalCreditsInPlatformResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21722,21 +35989,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0])); }; @@ -21754,8 +36021,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject(opt_includeInstance, this); }; @@ -21764,13 +36031,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -21784,23 +36051,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21808,8 +36075,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21825,9 +36092,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21835,24 +36102,31 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_ = [1,2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -21868,8 +36142,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(opt_includeInstance, this); }; @@ -21878,16 +36152,15 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - count: jspb.Message.getFieldWithDefault(msg, 2, 0), - ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) + pathList: msg.getPathList_asB64(), + keysList: msg.getKeysList_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -21901,23 +36174,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21925,19 +36198,14 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setStartEpoch(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addPath(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCount(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeys(value); break; case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setAscending(value); - break; - case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -21954,9 +36222,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21964,38 +36232,30 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartEpoch(); - if (f != null) { - writer.writeMessage( + f = message.getPathList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getCount(); - if (f !== 0) { - writer.writeUint32( - 2, f ); } - f = message.getAscending(); - if (f) { - writer.writeBool( - 3, + f = message.getKeysList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, f ); } f = message.getProve(); if (f) { writer.writeBool( - 4, + 3, f ); } @@ -22003,120 +36263,169 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.seri /** - * optional google.protobuf.UInt32Value start_epoch = 1; - * @return {?proto.google.protobuf.UInt32Value} + * repeated bytes path = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes path = 1; + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getPathList())); +}; + + +/** + * repeated bytes path = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getPathList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setPathList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addPath = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { - return jspb.Message.setWrapperField(this, 1, value); + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearPathList = function() { + return this.setPathList([]); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * repeated bytes keys = 2; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { - return this.setStartEpoch(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes keys = 2; + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysList())); }; /** - * optional uint32 count = 2; - * @return {number} + * repeated bytes keys = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setKeysList = function(value) { + return jspb.Message.setField(this, 2, value || []); }; /** - * optional bool ascending = 3; - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addKeys = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearKeysList = function() { + return this.setKeysList([]); }; /** - * optional bool prove = 4; + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetEpochsInfoRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * optional GetPathElementsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22125,7 +36434,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22139,21 +36448,21 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0])); }; @@ -22171,8 +36480,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject(opt_includeInstance, this); }; @@ -22181,13 +36490,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -22201,23 +36510,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22225,8 +36534,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -22242,9 +36551,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22252,18 +36561,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter ); } }; @@ -22278,22 +36587,22 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase = { RESULT_NOT_SET: 0, - EPOCHS: 1, + ELEMENTS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0])); }; @@ -22311,8 +36620,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(opt_includeInstance, this); }; @@ -22321,13 +36630,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), + elements: (f = msg.getElements()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -22343,23 +36652,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.to /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22367,157 +36676,19 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.de var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); - msg.setEpochs(value); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader); + msg.setElements(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); msg.setProof(value); break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getEpochs(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { - var f, obj = { - epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); - msg.addEpochInfos(value); + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -22532,9 +36703,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22542,61 +36713,46 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getEpochInfosList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getElements(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * repeated EpochInfo epoch_infos = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); -}; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { - return this.setEpochInfosList([]); -}; - - +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_ = [1]; @@ -22613,8 +36769,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(opt_includeInstance, this); }; @@ -22623,17 +36779,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject = function(includeInstance, msg) { var f, obj = { - number: jspb.Message.getFieldWithDefault(msg, 1, 0), - firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), - firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), - startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), - feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + elementsList: msg.getElementsList_asB64() }; if (includeInstance) { @@ -22647,23 +36799,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22671,24 +36823,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setNumber(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setFirstBlockHeight(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setFirstCoreBlockHeight(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setStartTime(value); - break; - case 5: - var value = /** @type {number} */ (reader.readDouble()); - msg.setFeeMultiplier(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addElements(value); break; default: reader.skipField(); @@ -22703,9 +36839,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22713,165 +36849,108 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getElementsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, f ); } - f = message.getFirstBlockHeight(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getFirstCoreBlockHeight(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getStartTime(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getFeeMultiplier(); - if (f !== 0.0) { - writer.writeDouble( - 5, - f - ); - } -}; - - -/** - * optional uint32 number = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 first_block_height = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional uint32 first_core_block_height = 3; - * @return {number} + * repeated bytes elements = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * repeated bytes elements = 1; + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getElementsList())); }; /** - * optional uint64 start_time = 4; - * @return {number} + * repeated bytes elements = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getElementsList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.setElementsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** - * optional double fee_multiplier = 5; - * @return {number} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.addElements = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.clearElementsList = function() { + return this.setElementsList([]); }; /** - * optional EpochInfos epochs = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} + * optional Elements elements = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getElements = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setElements = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { - return this.setEpochs(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearElements = function() { + return this.setElements(undefined); }; @@ -22879,7 +36958,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasElements = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22888,7 +36967,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -22896,18 +36975,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -22916,7 +36995,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -22925,7 +37004,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -22933,18 +37012,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -22953,35 +37032,35 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetEpochsInfoResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * optional GetPathElementsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22990,9 +37069,20 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.KeyPurpose = { + AUTHENTICATION: 0, + ENCRYPTION: 1, + DECRYPTION: 2, + TRANSFER: 3, + VOTING: 5 +}; + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts index eb5810b9258..5b55cb4a71e 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts @@ -22,22 +22,40 @@ type PlatformgetIdentity = { readonly responseType: typeof platform_pb.GetIdentityResponse; }; -type PlatformgetIdentities = { +type PlatformgetIdentityKeys = { readonly methodName: string; readonly service: typeof Platform; readonly requestStream: false; readonly responseStream: false; - readonly requestType: typeof platform_pb.GetIdentitiesRequest; - readonly responseType: typeof platform_pb.GetIdentitiesResponse; + readonly requestType: typeof platform_pb.GetIdentityKeysRequest; + readonly responseType: typeof platform_pb.GetIdentityKeysResponse; }; -type PlatformgetIdentityKeys = { +type PlatformgetIdentitiesContractKeys = { readonly methodName: string; readonly service: typeof Platform; readonly requestStream: false; readonly responseStream: false; - readonly requestType: typeof platform_pb.GetIdentityKeysRequest; - readonly responseType: typeof platform_pb.GetIdentityKeysResponse; + readonly requestType: typeof platform_pb.GetIdentitiesContractKeysRequest; + readonly responseType: typeof platform_pb.GetIdentitiesContractKeysResponse; +}; + +type PlatformgetIdentityNonce = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetIdentityNonceRequest; + readonly responseType: typeof platform_pb.GetIdentityNonceResponse; +}; + +type PlatformgetIdentityContractNonce = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetIdentityContractNonceRequest; + readonly responseType: typeof platform_pb.GetIdentityContractNonceResponse; }; type PlatformgetIdentityBalance = { @@ -103,15 +121,6 @@ type PlatformgetDocuments = { readonly responseType: typeof platform_pb.GetDocumentsResponse; }; -type PlatformgetIdentitiesByPublicKeyHashes = { - readonly methodName: string; - readonly service: typeof Platform; - readonly requestStream: false; - readonly responseStream: false; - readonly requestType: typeof platform_pb.GetIdentitiesByPublicKeyHashesRequest; - readonly responseType: typeof platform_pb.GetIdentitiesByPublicKeyHashesResponse; -}; - type PlatformgetIdentityByPublicKeyHash = { readonly methodName: string; readonly service: typeof Platform; @@ -166,12 +175,86 @@ type PlatformgetEpochsInfo = { readonly responseType: typeof platform_pb.GetEpochsInfoResponse; }; +type PlatformgetContestedResources = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetContestedResourcesRequest; + readonly responseType: typeof platform_pb.GetContestedResourcesResponse; +}; + +type PlatformgetContestedResourceVoteState = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetContestedResourceVoteStateRequest; + readonly responseType: typeof platform_pb.GetContestedResourceVoteStateResponse; +}; + +type PlatformgetContestedResourceVotersForIdentity = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetContestedResourceVotersForIdentityRequest; + readonly responseType: typeof platform_pb.GetContestedResourceVotersForIdentityResponse; +}; + +type PlatformgetContestedResourceIdentityVotes = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetContestedResourceIdentityVotesRequest; + readonly responseType: typeof platform_pb.GetContestedResourceIdentityVotesResponse; +}; + +type PlatformgetVotePollsByEndDate = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetVotePollsByEndDateRequest; + readonly responseType: typeof platform_pb.GetVotePollsByEndDateResponse; +}; + +type PlatformgetPrefundedSpecializedBalance = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetPrefundedSpecializedBalanceRequest; + readonly responseType: typeof platform_pb.GetPrefundedSpecializedBalanceResponse; +}; + +type PlatformgetTotalCreditsInPlatform = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetTotalCreditsInPlatformRequest; + readonly responseType: typeof platform_pb.GetTotalCreditsInPlatformResponse; +}; + +type PlatformgetPathElements = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetPathElementsRequest; + readonly responseType: typeof platform_pb.GetPathElementsResponse; +}; + export class Platform { static readonly serviceName: string; static readonly broadcastStateTransition: PlatformbroadcastStateTransition; static readonly getIdentity: PlatformgetIdentity; - static readonly getIdentities: PlatformgetIdentities; static readonly getIdentityKeys: PlatformgetIdentityKeys; + static readonly getIdentitiesContractKeys: PlatformgetIdentitiesContractKeys; + static readonly getIdentityNonce: PlatformgetIdentityNonce; + static readonly getIdentityContractNonce: PlatformgetIdentityContractNonce; static readonly getIdentityBalance: PlatformgetIdentityBalance; static readonly getIdentityBalanceAndRevision: PlatformgetIdentityBalanceAndRevision; static readonly getProofs: PlatformgetProofs; @@ -179,13 +262,20 @@ export class Platform { static readonly getDataContractHistory: PlatformgetDataContractHistory; static readonly getDataContracts: PlatformgetDataContracts; static readonly getDocuments: PlatformgetDocuments; - static readonly getIdentitiesByPublicKeyHashes: PlatformgetIdentitiesByPublicKeyHashes; static readonly getIdentityByPublicKeyHash: PlatformgetIdentityByPublicKeyHash; static readonly waitForStateTransitionResult: PlatformwaitForStateTransitionResult; static readonly getConsensusParams: PlatformgetConsensusParams; static readonly getProtocolVersionUpgradeState: PlatformgetProtocolVersionUpgradeState; static readonly getProtocolVersionUpgradeVoteStatus: PlatformgetProtocolVersionUpgradeVoteStatus; static readonly getEpochsInfo: PlatformgetEpochsInfo; + static readonly getContestedResources: PlatformgetContestedResources; + static readonly getContestedResourceVoteState: PlatformgetContestedResourceVoteState; + static readonly getContestedResourceVotersForIdentity: PlatformgetContestedResourceVotersForIdentity; + static readonly getContestedResourceIdentityVotes: PlatformgetContestedResourceIdentityVotes; + static readonly getVotePollsByEndDate: PlatformgetVotePollsByEndDate; + static readonly getPrefundedSpecializedBalance: PlatformgetPrefundedSpecializedBalance; + static readonly getTotalCreditsInPlatform: PlatformgetTotalCreditsInPlatform; + static readonly getPathElements: PlatformgetPathElements; } export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } @@ -238,15 +328,6 @@ export class PlatformClient { requestMessage: platform_pb.GetIdentityRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityResponse|null) => void ): UnaryResponse; - getIdentities( - requestMessage: platform_pb.GetIdentitiesRequest, - metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesResponse|null) => void - ): UnaryResponse; - getIdentities( - requestMessage: platform_pb.GetIdentitiesRequest, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesResponse|null) => void - ): UnaryResponse; getIdentityKeys( requestMessage: platform_pb.GetIdentityKeysRequest, metadata: grpc.Metadata, @@ -256,6 +337,33 @@ export class PlatformClient { requestMessage: platform_pb.GetIdentityKeysRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityKeysResponse|null) => void ): UnaryResponse; + getIdentitiesContractKeys( + requestMessage: platform_pb.GetIdentitiesContractKeysRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesContractKeysResponse|null) => void + ): UnaryResponse; + getIdentitiesContractKeys( + requestMessage: platform_pb.GetIdentitiesContractKeysRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesContractKeysResponse|null) => void + ): UnaryResponse; + getIdentityNonce( + requestMessage: platform_pb.GetIdentityNonceRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityNonceResponse|null) => void + ): UnaryResponse; + getIdentityNonce( + requestMessage: platform_pb.GetIdentityNonceRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityNonceResponse|null) => void + ): UnaryResponse; + getIdentityContractNonce( + requestMessage: platform_pb.GetIdentityContractNonceRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityContractNonceResponse|null) => void + ): UnaryResponse; + getIdentityContractNonce( + requestMessage: platform_pb.GetIdentityContractNonceRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityContractNonceResponse|null) => void + ): UnaryResponse; getIdentityBalance( requestMessage: platform_pb.GetIdentityBalanceRequest, metadata: grpc.Metadata, @@ -319,15 +427,6 @@ export class PlatformClient { requestMessage: platform_pb.GetDocumentsRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetDocumentsResponse|null) => void ): UnaryResponse; - getIdentitiesByPublicKeyHashes( - requestMessage: platform_pb.GetIdentitiesByPublicKeyHashesRequest, - metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesByPublicKeyHashesResponse|null) => void - ): UnaryResponse; - getIdentitiesByPublicKeyHashes( - requestMessage: platform_pb.GetIdentitiesByPublicKeyHashesRequest, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesByPublicKeyHashesResponse|null) => void - ): UnaryResponse; getIdentityByPublicKeyHash( requestMessage: platform_pb.GetIdentityByPublicKeyHashRequest, metadata: grpc.Metadata, @@ -382,5 +481,77 @@ export class PlatformClient { requestMessage: platform_pb.GetEpochsInfoRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetEpochsInfoResponse|null) => void ): UnaryResponse; + getContestedResources( + requestMessage: platform_pb.GetContestedResourcesRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourcesResponse|null) => void + ): UnaryResponse; + getContestedResources( + requestMessage: platform_pb.GetContestedResourcesRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourcesResponse|null) => void + ): UnaryResponse; + getContestedResourceVoteState( + requestMessage: platform_pb.GetContestedResourceVoteStateRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourceVoteStateResponse|null) => void + ): UnaryResponse; + getContestedResourceVoteState( + requestMessage: platform_pb.GetContestedResourceVoteStateRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourceVoteStateResponse|null) => void + ): UnaryResponse; + getContestedResourceVotersForIdentity( + requestMessage: platform_pb.GetContestedResourceVotersForIdentityRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourceVotersForIdentityResponse|null) => void + ): UnaryResponse; + getContestedResourceVotersForIdentity( + requestMessage: platform_pb.GetContestedResourceVotersForIdentityRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourceVotersForIdentityResponse|null) => void + ): UnaryResponse; + getContestedResourceIdentityVotes( + requestMessage: platform_pb.GetContestedResourceIdentityVotesRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourceIdentityVotesResponse|null) => void + ): UnaryResponse; + getContestedResourceIdentityVotes( + requestMessage: platform_pb.GetContestedResourceIdentityVotesRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetContestedResourceIdentityVotesResponse|null) => void + ): UnaryResponse; + getVotePollsByEndDate( + requestMessage: platform_pb.GetVotePollsByEndDateRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetVotePollsByEndDateResponse|null) => void + ): UnaryResponse; + getVotePollsByEndDate( + requestMessage: platform_pb.GetVotePollsByEndDateRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetVotePollsByEndDateResponse|null) => void + ): UnaryResponse; + getPrefundedSpecializedBalance( + requestMessage: platform_pb.GetPrefundedSpecializedBalanceRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetPrefundedSpecializedBalanceResponse|null) => void + ): UnaryResponse; + getPrefundedSpecializedBalance( + requestMessage: platform_pb.GetPrefundedSpecializedBalanceRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetPrefundedSpecializedBalanceResponse|null) => void + ): UnaryResponse; + getTotalCreditsInPlatform( + requestMessage: platform_pb.GetTotalCreditsInPlatformRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetTotalCreditsInPlatformResponse|null) => void + ): UnaryResponse; + getTotalCreditsInPlatform( + requestMessage: platform_pb.GetTotalCreditsInPlatformRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetTotalCreditsInPlatformResponse|null) => void + ): UnaryResponse; + getPathElements( + requestMessage: platform_pb.GetPathElementsRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetPathElementsResponse|null) => void + ): UnaryResponse; + getPathElements( + requestMessage: platform_pb.GetPathElementsRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetPathElementsResponse|null) => void + ): UnaryResponse; } diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js index f0857a73bce..a6774546d2a 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js @@ -28,22 +28,40 @@ Platform.getIdentity = { responseType: platform_pb.GetIdentityResponse }; -Platform.getIdentities = { - methodName: "getIdentities", +Platform.getIdentityKeys = { + methodName: "getIdentityKeys", service: Platform, requestStream: false, responseStream: false, - requestType: platform_pb.GetIdentitiesRequest, - responseType: platform_pb.GetIdentitiesResponse + requestType: platform_pb.GetIdentityKeysRequest, + responseType: platform_pb.GetIdentityKeysResponse }; -Platform.getIdentityKeys = { - methodName: "getIdentityKeys", +Platform.getIdentitiesContractKeys = { + methodName: "getIdentitiesContractKeys", service: Platform, requestStream: false, responseStream: false, - requestType: platform_pb.GetIdentityKeysRequest, - responseType: platform_pb.GetIdentityKeysResponse + requestType: platform_pb.GetIdentitiesContractKeysRequest, + responseType: platform_pb.GetIdentitiesContractKeysResponse +}; + +Platform.getIdentityNonce = { + methodName: "getIdentityNonce", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetIdentityNonceRequest, + responseType: platform_pb.GetIdentityNonceResponse +}; + +Platform.getIdentityContractNonce = { + methodName: "getIdentityContractNonce", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetIdentityContractNonceRequest, + responseType: platform_pb.GetIdentityContractNonceResponse }; Platform.getIdentityBalance = { @@ -109,15 +127,6 @@ Platform.getDocuments = { responseType: platform_pb.GetDocumentsResponse }; -Platform.getIdentitiesByPublicKeyHashes = { - methodName: "getIdentitiesByPublicKeyHashes", - service: Platform, - requestStream: false, - responseStream: false, - requestType: platform_pb.GetIdentitiesByPublicKeyHashesRequest, - responseType: platform_pb.GetIdentitiesByPublicKeyHashesResponse -}; - Platform.getIdentityByPublicKeyHash = { methodName: "getIdentityByPublicKeyHash", service: Platform, @@ -172,6 +181,78 @@ Platform.getEpochsInfo = { responseType: platform_pb.GetEpochsInfoResponse }; +Platform.getContestedResources = { + methodName: "getContestedResources", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetContestedResourcesRequest, + responseType: platform_pb.GetContestedResourcesResponse +}; + +Platform.getContestedResourceVoteState = { + methodName: "getContestedResourceVoteState", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetContestedResourceVoteStateRequest, + responseType: platform_pb.GetContestedResourceVoteStateResponse +}; + +Platform.getContestedResourceVotersForIdentity = { + methodName: "getContestedResourceVotersForIdentity", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetContestedResourceVotersForIdentityRequest, + responseType: platform_pb.GetContestedResourceVotersForIdentityResponse +}; + +Platform.getContestedResourceIdentityVotes = { + methodName: "getContestedResourceIdentityVotes", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetContestedResourceIdentityVotesRequest, + responseType: platform_pb.GetContestedResourceIdentityVotesResponse +}; + +Platform.getVotePollsByEndDate = { + methodName: "getVotePollsByEndDate", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetVotePollsByEndDateRequest, + responseType: platform_pb.GetVotePollsByEndDateResponse +}; + +Platform.getPrefundedSpecializedBalance = { + methodName: "getPrefundedSpecializedBalance", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetPrefundedSpecializedBalanceRequest, + responseType: platform_pb.GetPrefundedSpecializedBalanceResponse +}; + +Platform.getTotalCreditsInPlatform = { + methodName: "getTotalCreditsInPlatform", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetTotalCreditsInPlatformRequest, + responseType: platform_pb.GetTotalCreditsInPlatformResponse +}; + +Platform.getPathElements = { + methodName: "getPathElements", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetPathElementsRequest, + responseType: platform_pb.GetPathElementsResponse +}; + exports.Platform = Platform; function PlatformClient(serviceHost, options) { @@ -241,11 +322,11 @@ PlatformClient.prototype.getIdentity = function getIdentity(requestMessage, meta }; }; -PlatformClient.prototype.getIdentities = function getIdentities(requestMessage, metadata, callback) { +PlatformClient.prototype.getIdentityKeys = function getIdentityKeys(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentities, { + var client = grpc.unary(Platform.getIdentityKeys, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -272,11 +353,73 @@ PlatformClient.prototype.getIdentities = function getIdentities(requestMessage, }; }; -PlatformClient.prototype.getIdentityKeys = function getIdentityKeys(requestMessage, metadata, callback) { +PlatformClient.prototype.getIdentitiesContractKeys = function getIdentitiesContractKeys(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentityKeys, { + var client = grpc.unary(Platform.getIdentitiesContractKeys, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getIdentityNonce = function getIdentityNonce(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getIdentityNonce, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getIdentityContractNonce = function getIdentityContractNonce(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getIdentityContractNonce, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -520,11 +663,11 @@ PlatformClient.prototype.getDocuments = function getDocuments(requestMessage, me }; }; -PlatformClient.prototype.getIdentitiesByPublicKeyHashes = function getIdentitiesByPublicKeyHashes(requestMessage, metadata, callback) { +PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPublicKeyHash(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentitiesByPublicKeyHashes, { + var client = grpc.unary(Platform.getIdentityByPublicKeyHash, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -551,11 +694,11 @@ PlatformClient.prototype.getIdentitiesByPublicKeyHashes = function getIdentities }; }; -PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPublicKeyHash(requestMessage, metadata, callback) { +PlatformClient.prototype.waitForStateTransitionResult = function waitForStateTransitionResult(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentityByPublicKeyHash, { + var client = grpc.unary(Platform.waitForStateTransitionResult, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -582,11 +725,11 @@ PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPubl }; }; -PlatformClient.prototype.waitForStateTransitionResult = function waitForStateTransitionResult(requestMessage, metadata, callback) { +PlatformClient.prototype.getConsensusParams = function getConsensusParams(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.waitForStateTransitionResult, { + var client = grpc.unary(Platform.getConsensusParams, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -613,11 +756,11 @@ PlatformClient.prototype.waitForStateTransitionResult = function waitForStateTra }; }; -PlatformClient.prototype.getConsensusParams = function getConsensusParams(requestMessage, metadata, callback) { +PlatformClient.prototype.getProtocolVersionUpgradeState = function getProtocolVersionUpgradeState(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getConsensusParams, { + var client = grpc.unary(Platform.getProtocolVersionUpgradeState, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -644,11 +787,11 @@ PlatformClient.prototype.getConsensusParams = function getConsensusParams(reques }; }; -PlatformClient.prototype.getProtocolVersionUpgradeState = function getProtocolVersionUpgradeState(requestMessage, metadata, callback) { +PlatformClient.prototype.getProtocolVersionUpgradeVoteStatus = function getProtocolVersionUpgradeVoteStatus(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getProtocolVersionUpgradeState, { + var client = grpc.unary(Platform.getProtocolVersionUpgradeVoteStatus, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -675,11 +818,11 @@ PlatformClient.prototype.getProtocolVersionUpgradeState = function getProtocolVe }; }; -PlatformClient.prototype.getProtocolVersionUpgradeVoteStatus = function getProtocolVersionUpgradeVoteStatus(requestMessage, metadata, callback) { +PlatformClient.prototype.getEpochsInfo = function getEpochsInfo(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getProtocolVersionUpgradeVoteStatus, { + var client = grpc.unary(Platform.getEpochsInfo, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -706,11 +849,228 @@ PlatformClient.prototype.getProtocolVersionUpgradeVoteStatus = function getProto }; }; -PlatformClient.prototype.getEpochsInfo = function getEpochsInfo(requestMessage, metadata, callback) { +PlatformClient.prototype.getContestedResources = function getContestedResources(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getEpochsInfo, { + var client = grpc.unary(Platform.getContestedResources, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getContestedResourceVoteState = function getContestedResourceVoteState(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getContestedResourceVoteState, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getContestedResourceVotersForIdentity = function getContestedResourceVotersForIdentity(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getContestedResourceVotersForIdentity, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getContestedResourceIdentityVotes = function getContestedResourceIdentityVotes(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getContestedResourceIdentityVotes, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getVotePollsByEndDate = function getVotePollsByEndDate(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getVotePollsByEndDate, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getPrefundedSpecializedBalance = function getPrefundedSpecializedBalance(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getPrefundedSpecializedBalance, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getTotalCreditsInPlatform = function getTotalCreditsInPlatform(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getTotalCreditsInPlatform, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getPathElements = function getPathElements(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getPathElements, { request: requestMessage, host: this.serviceHost, metadata: metadata, diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 1af84023709..fb412a201de 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", @@ -37,13 +37,13 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/dashevo/dapi-grpc.git" + "url": "git+https://github.com/dashpay/platform.git" }, "license": "MIT", "bugs": { - "url": "https://github.com/dashevo/dapi-grpc/issues" + "url": "https://github.com/dashpay/platform/issues" }, - "homepage": "https://github.com/dashevo/dapi-grpc#readme", + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/dapi-grpc#readme", "dependencies": { "@dashevo/grpc-common": "workspace:*", "@dashevo/protobufjs": "6.10.5", diff --git a/packages/dapi-grpc/protos/core/v0/core.proto b/packages/dapi-grpc/protos/core/v0/core.proto index 2ba33d19534..1bc206dc3d5 100644 --- a/packages/dapi-grpc/protos/core/v0/core.proto +++ b/packages/dapi-grpc/protos/core/v0/core.proto @@ -3,20 +3,23 @@ syntax = "proto3"; package org.dash.platform.dapi.v0; service Core { - rpc getStatus (GetStatusRequest) returns (GetStatusResponse); + rpc getBlockchainStatus (GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse); + rpc getMasternodeStatus (GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse); rpc getBlock (GetBlockRequest) returns (GetBlockResponse); + rpc getBestBlockHeight (GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse); rpc broadcastTransaction (BroadcastTransactionRequest) returns (BroadcastTransactionResponse); rpc getTransaction (GetTransactionRequest) returns (GetTransactionResponse); rpc getEstimatedTransactionFee (GetEstimatedTransactionFeeRequest) returns (GetEstimatedTransactionFeeResponse); rpc subscribeToBlockHeadersWithChainLocks (BlockHeadersWithChainLocksRequest) returns (stream BlockHeadersWithChainLocksResponse); rpc subscribeToTransactionsWithProofs (TransactionsWithProofsRequest) returns (stream TransactionsWithProofsResponse); + rpc subscribeToMasternodeList (MasternodeListRequest) returns (stream MasternodeListResponse); } -message GetStatusRequest { +message GetBlockchainStatusRequest { } -message GetStatusResponse { +message GetBlockchainStatusResponse { message Version { uint32 protocol = 1; uint32 software = 2; @@ -47,25 +50,6 @@ message GetStatusResponse { double sync_progress = 8; } - message Masternode { - enum Status { - UNKNOWN = 0; - WAITING_FOR_PROTX = 1; - POSE_BANNED = 2; - REMOVED = 3; - OPERATOR_KEY_CHANGED = 4; - PROTX_IP_CHANGED = 5; - READY = 6; - ERROR = 7; - } - - Status status = 1; - bytes pro_tx_hash = 2; - uint32 pose_penalty = 3; - bool is_synced = 4; - double sync_progress = 5; - } - message NetworkFee { double relay = 1; double incremental = 2; @@ -81,10 +65,32 @@ message GetStatusResponse { Status status = 3; double sync_progress = 4; Chain chain = 5; - Masternode masternode = 6; Network network = 7; } +message GetMasternodeStatusRequest { + +} + +message GetMasternodeStatusResponse { + enum Status { + UNKNOWN = 0; + WAITING_FOR_PROTX = 1; + POSE_BANNED = 2; + REMOVED = 3; + OPERATOR_KEY_CHANGED = 4; + PROTX_IP_CHANGED = 5; + READY = 6; + ERROR = 7; + } + + Status status = 1; + bytes pro_tx_hash = 2; + uint32 pose_penalty = 3; + bool is_synced = 4; + double sync_progress = 5; +} + message GetBlockRequest { oneof block { uint32 height = 1; @@ -96,6 +102,14 @@ message GetBlockResponse { bytes block = 1; } +message GetBestBlockHeightRequest { + +} + +message GetBestBlockHeightResponse { + uint32 height = 1; +} + message BroadcastTransactionRequest { bytes transaction = 1; bool allow_high_fees = 2; @@ -182,3 +196,11 @@ message RawTransactions { message InstantSendLockMessages { repeated bytes messages = 1; } + +message MasternodeListRequest { + +} + +message MasternodeListResponse { + bytes masternode_list_diff = 1; +} diff --git a/packages/dapi-grpc/protos/platform/v0/platform.proto b/packages/dapi-grpc/protos/platform/v0/platform.proto index 5407772dc0c..ca940cf221a 100644 --- a/packages/dapi-grpc/protos/platform/v0/platform.proto +++ b/packages/dapi-grpc/protos/platform/v0/platform.proto @@ -10,8 +10,10 @@ service Platform { rpc broadcastStateTransition(BroadcastStateTransitionRequest) returns (BroadcastStateTransitionResponse); rpc getIdentity(GetIdentityRequest) returns (GetIdentityResponse); - rpc getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse); rpc getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse); + rpc getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse); + rpc getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse); + rpc getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse); rpc getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse); rpc getIdentityBalanceAndRevision(GetIdentityBalanceAndRevisionRequest) @@ -23,8 +25,6 @@ service Platform { rpc getDataContracts(GetDataContractsRequest) returns (GetDataContractsResponse); rpc getDocuments(GetDocumentsRequest) returns (GetDocumentsResponse); - rpc getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) - returns (GetIdentitiesByPublicKeyHashesResponse); rpc getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse); rpc waitForStateTransitionResult(WaitForStateTransitionResultRequest) @@ -34,24 +34,39 @@ service Platform { rpc getProtocolVersionUpgradeState(GetProtocolVersionUpgradeStateRequest) returns (GetProtocolVersionUpgradeStateResponse); rpc getProtocolVersionUpgradeVoteStatus(GetProtocolVersionUpgradeVoteStatusRequest) returns (GetProtocolVersionUpgradeVoteStatusResponse); rpc getEpochsInfo(GetEpochsInfoRequest) returns (GetEpochsInfoResponse); -} - + // What votes are currently happening for a specific contested index + rpc getContestedResources(GetContestedResourcesRequest) returns (GetContestedResourcesResponse); + // What's the state of a contested resource vote? (ie who is winning?) + rpc getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse); + // Who voted for a contested resource to go to a specific identity? + rpc getContestedResourceVotersForIdentity(GetContestedResourceVotersForIdentityRequest) returns (GetContestedResourceVotersForIdentityResponse); + // How did an identity vote? + rpc getContestedResourceIdentityVotes(GetContestedResourceIdentityVotesRequest) returns (GetContestedResourceIdentityVotesResponse); + // What vote polls will end soon? + rpc getVotePollsByEndDate(GetVotePollsByEndDateRequest) returns (GetVotePollsByEndDateResponse); + rpc getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse); + rpc getTotalCreditsInPlatform(GetTotalCreditsInPlatformRequest) returns (GetTotalCreditsInPlatformResponse); + rpc getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse); +} + +// Proof message includes cryptographic proofs for validating responses message Proof { - bytes grovedb_proof = 1; - bytes quorum_hash = 2; - bytes signature = 3; - uint32 round = 4; - bytes block_id_hash = 5; - uint32 quorum_type = 6; + bytes grovedb_proof = 1; // GroveDB proof for the data + bytes quorum_hash = 2; // Hash of the quorum validating the data + bytes signature = 3; // Signature proving data authenticity + uint32 round = 4; // Consensus round number + bytes block_id_hash = 5; // Hash of the block ID + uint32 quorum_type = 6; // Type of the quorum } +// ResponseMetadata provides metadata about the blockchain state at the time of response message ResponseMetadata { - uint64 height = 1; - uint32 core_chain_locked_height = 2; - uint32 epoch = 3; - uint64 time_ms = 4; - uint32 protocol_version = 5; - string chain_id = 6; + uint64 height = 1; // Current blockchain height + uint32 core_chain_locked_height = 2; // Latest known core height in consensus + uint32 epoch = 3; // Current epoch number + uint64 time_ms = 4; // Timestamp in milliseconds + uint32 protocol_version = 5; // Protocol version + string chain_id = 6; // Identifier of the blockchain } message StateTransitionBroadcastError { @@ -60,6 +75,14 @@ message StateTransitionBroadcastError { bytes data = 3; } +enum KeyPurpose { + AUTHENTICATION = 0; + ENCRYPTION = 1; + DECRYPTION = 2; + TRANSFER = 3; + VOTING = 5; +} + message BroadcastStateTransitionRequest { bytes state_transition = 1; } message BroadcastStateTransitionResponse {} @@ -67,18 +90,40 @@ message BroadcastStateTransitionResponse {} message GetIdentityRequest { message GetIdentityRequestV0 { - bytes id = 1; - bool prove = 2; + bytes id = 1; // The ID of the identity being requested + bool prove = 2; // Flag to request a proof as the response } oneof version { GetIdentityRequestV0 v0 = 1; } } +message GetIdentityNonceRequest { + + message GetIdentityNonceRequestV0 { + bytes identity_id = 1; + bool prove = 2; + } + + oneof version { GetIdentityNonceRequestV0 v0 = 1; } +} + + +message GetIdentityContractNonceRequest { + + message GetIdentityContractNonceRequestV0 { + bytes identity_id = 1; + bytes contract_id = 2; + bool prove = 3; + } + + oneof version { GetIdentityContractNonceRequestV0 v0 = 1; } +} + message GetIdentityBalanceRequest { message GetIdentityBalanceRequestV0 { - bytes id = 1; - bool prove = 2; + bytes id = 1; // ID of the identity whose balance is requested + bool prove = 2; // Flag to request a proof as the response } oneof version { GetIdentityBalanceRequestV0 v0 = 1; } @@ -87,8 +132,8 @@ message GetIdentityBalanceRequest { message GetIdentityBalanceAndRevisionRequest { message GetIdentityBalanceAndRevisionRequestV0 { - bytes id = 1; - bool prove = 2; + bytes id = 1; // ID of the identity for balance and revision + bool prove = 2; // Flag to request a proof as the response } oneof version { GetIdentityBalanceAndRevisionRequestV0 v0 = 1; } @@ -98,55 +143,49 @@ message GetIdentityResponse { message GetIdentityResponseV0 { oneof result { - bytes identity = 1; - Proof proof = 2; + bytes identity = 1; // The requested identity data + Proof proof = 2; // Proof of the identity data, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { GetIdentityResponseV0 v0 = 1; } } -message GetIdentitiesRequest { +message GetIdentityNonceResponse { - message GetIdentitiesRequestV0 { - repeated bytes ids = 1; - bool prove = 2; + message GetIdentityNonceResponseV0 { + oneof result { + uint64 identity_nonce = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; } - oneof version { GetIdentitiesRequestV0 v0 = 1; } + oneof version { GetIdentityNonceResponseV0 v0 = 1; } } -message GetIdentitiesResponse { - - message IdentityValue { bytes value = 1; } +message GetIdentityContractNonceResponse { - message IdentityEntry { - bytes key = 1; - IdentityValue value = 2; - } - - message Identities { repeated IdentityEntry identity_entries = 1; } - - message GetIdentitiesResponseV0 { + message GetIdentityContractNonceResponseV0 { oneof result { - Identities identities = 1; + uint64 identity_contract_nonce = 1; Proof proof = 2; } ResponseMetadata metadata = 3; } - oneof version { GetIdentitiesResponseV0 v0 = 1; } + oneof version { GetIdentityContractNonceResponseV0 v0 = 1; } } message GetIdentityBalanceResponse { message GetIdentityBalanceResponseV0 { oneof result { - uint64 balance = 1; - Proof proof = 2; + uint64 balance = 1; // The balance of the requested identity + Proof proof = 2; // Proof of the balance, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { GetIdentityBalanceResponseV0 v0 = 1; } @@ -156,15 +195,15 @@ message GetIdentityBalanceAndRevisionResponse { message GetIdentityBalanceAndRevisionResponseV0 { message BalanceAndRevision { - uint64 balance = 1; - uint64 revision = 2; + uint64 balance = 1; // Balance of the identity + uint64 revision = 2; // Revision number of the identity } oneof result { - BalanceAndRevision balance_and_revision = 1; - Proof proof = 2; + BalanceAndRevision balance_and_revision = 1; // The balance and revision data + Proof proof = 2; // Proof of the data, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { GetIdentityBalanceAndRevisionResponseV0 v0 = 1; } @@ -172,34 +211,42 @@ message GetIdentityBalanceAndRevisionResponse { message KeyRequestType { oneof request { - AllKeys all_keys = 1; - SpecificKeys specific_keys = 2; - SearchKey search_key = 3; + AllKeys all_keys = 1; // Request for all keys + SpecificKeys specific_keys = 2; // Request for specific keys by their IDs + SearchKey search_key = 3; // Request for keys based on a search criteria } } +// AllKeys is an empty message used to signify a request for all keys message AllKeys {} -message SpecificKeys { repeated uint32 key_ids = 1; } +// SpecificKeys is used to request specific keys by their IDs +message SpecificKeys { + repeated uint32 key_ids = 1; // List of key IDs +} -message SearchKey { map purpose_map = 1; } +// SearchKey represents a request to search for keys based on specific criteria +message SearchKey { + map purpose_map = 1; // Map of purposes to their security level maps +} +// SecurityLevelMap maps security levels to a request type for key retrieval message SecurityLevelMap { enum KeyKindRequestType { - CURRENT_KEY_OF_KIND_REQUEST = 0; - ALL_KEYS_OF_KIND_REQUEST = 1; + CURRENT_KEY_OF_KIND_REQUEST = 0; // Request the current key of a particular kind + ALL_KEYS_OF_KIND_REQUEST = 1; // Request all keys of a particular kind } - map security_level_map = 1; + map security_level_map = 1; // Maps security levels to key request types } message GetIdentityKeysRequest { message GetIdentityKeysRequestV0 { - bytes identity_id = 1; - KeyRequestType request_type = 2; - google.protobuf.UInt32Value limit = 3; - google.protobuf.UInt32Value offset = 4; - bool prove = 5; + bytes identity_id = 1; // ID of the identity for key retrieval + KeyRequestType request_type = 2; // Type of key request: all, specific, or search + google.protobuf.UInt32Value limit = 3; // Limit on the number of keys to be returned + google.protobuf.UInt32Value offset = 4; // Offset for pagination through the keys + bool prove = 5; // Flag to request a proof as the response } oneof version { GetIdentityKeysRequestV0 v0 = 1; } @@ -208,42 +255,104 @@ message GetIdentityKeysRequest { message GetIdentityKeysResponse { message GetIdentityKeysResponseV0 { - message Keys { repeated bytes keys_bytes = 1; } + message Keys { repeated bytes keys_bytes = 1; } // Collection of keys as byte sequences + + oneof result { + Keys keys = 1; // The actual key data + Proof proof = 2; // Proof of the keys data, if requested + } + ResponseMetadata metadata = 3; // Metadata about the blockchain state + } + oneof version { GetIdentityKeysResponseV0 v0 = 1; } +} + +message GetIdentitiesContractKeysRequest { + message GetIdentitiesContractKeysRequestV0 { + repeated bytes identities_ids = 1; + bytes contract_id = 2; + optional string document_type_name = 3; + repeated KeyPurpose purposes = 4; + bool prove = 5; + } + + oneof version { + GetIdentitiesContractKeysRequestV0 v0 = 1; + } +} + +message GetIdentitiesContractKeysResponse { + message GetIdentitiesContractKeysResponseV0 { + message PurposeKeys { + KeyPurpose purpose = 1; + repeated bytes keys_bytes = 2; + } + + message IdentityKeys { + bytes identity_id = 1; + repeated PurposeKeys keys = 2; + } + + message IdentitiesKeys { + repeated IdentityKeys entries = 1; + }; oneof result { - Keys keys = 1; + IdentitiesKeys identities_keys = 1; Proof proof = 2; } ResponseMetadata metadata = 3; } - oneof version { GetIdentityKeysResponseV0 v0 = 1; } + oneof version { GetIdentitiesContractKeysResponseV0 v0 = 1; } } message GetProofsRequest { message GetProofsRequestV0 { + // DocumentRequest specifies a request for a document proof message DocumentRequest { - bytes contract_id = 1; - string document_type = 2; - bool document_type_keeps_history = 3; - bytes document_id = 4; + enum DocumentContestedStatus { + NOT_CONTESTED = 0; + MAYBE_CONTESTED = 1; + CONTESTED = 2; + } + bytes contract_id = 1; // ID of the contract the document belongs to + string document_type = 2; // Type of document being requested + bool document_type_keeps_history = 3; // Indicates if the document type keeps a history of changes + bytes document_id = 4; // ID of the specific document being requested + DocumentContestedStatus document_contested_status = 5; } + // IdentityRequest specifies a request for an identity proof message IdentityRequest { enum Type { - FULL_IDENTITY = 0; - BALANCE = 1; - KEYS = 2; + FULL_IDENTITY = 0; // Request for the full identity + BALANCE = 1; // Request for the identity's balance + KEYS = 2; // Request for the identity's keys + REVISION = 3; // Request for the identity's revision } - bytes identity_id = 1; - Type request_type = 2; + bytes identity_id = 1; // ID of the identity for which the proof is requested + Type request_type = 2; // Type of identity request } - message ContractRequest { bytes contract_id = 1; } + // ContractRequest specifies a request for a data contract proof. + message ContractRequest { bytes contract_id = 1; } // ID of the contract for which the proof is requested + + message VoteStatusRequest { + message ContestedResourceVoteStatusRequest { + bytes contract_id = 1; + string document_type_name = 2; + string index_name = 3; + repeated bytes index_values = 4; + bytes voter_identifier = 5; + } + + oneof request_type { ContestedResourceVoteStatusRequest contested_resource_vote_status_request = 1; } + } - repeated IdentityRequest identities = 1; - repeated ContractRequest contracts = 2; - repeated DocumentRequest documents = 3; + repeated IdentityRequest identities = 1; // List of identity requests + repeated ContractRequest contracts = 2; // List of contract requests + repeated DocumentRequest documents = 3; // List of document requests + repeated VoteStatusRequest votes = 4; } oneof version { GetProofsRequestV0 v0 = 1; } @@ -251,17 +360,19 @@ message GetProofsRequest { message GetProofsResponse { message GetProofsResponseV0 { - oneof result { Proof proof = 1; } + oneof result { + Proof proof = 1; // Cryptographic proof for the requested data + } - ResponseMetadata metadata = 2; + ResponseMetadata metadata = 2; // Metadata about the blockchain state } oneof version { GetProofsResponseV0 v0 = 1; } } message GetDataContractRequest { message GetDataContractRequestV0 { - bytes id = 1; - bool prove = 2; + bytes id = 1; // The ID of the data contract being requested + bool prove = 2; // Flag to request a proof as the response } oneof version { GetDataContractRequestV0 v0 = 1; } } @@ -269,135 +380,115 @@ message GetDataContractRequest { message GetDataContractResponse { message GetDataContractResponseV0 { oneof result { - bytes data_contract = 1; - Proof proof = 2; + bytes data_contract = 1; // The actual data contract in binary form + Proof proof = 2; // Cryptographic proof of the data contract, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { GetDataContractResponseV0 v0 = 1; } } message GetDataContractsRequest { message GetDataContractsRequestV0 { - repeated bytes ids = 1; - bool prove = 2; + repeated bytes ids = 1; // A list of unique IDs for the data contracts being requested + bool prove = 2; // Flag to request a proof as the response } oneof version { GetDataContractsRequestV0 v0 = 1; } } message GetDataContractsResponse { message DataContractEntry { - bytes identifier = 1; - google.protobuf.BytesValue data_contract = 2; + bytes identifier = 1; // The unique identifier of the data contract + google.protobuf.BytesValue data_contract = 2; // The actual data contract content } + + // DataContracts is a collection of data contract entries. message DataContracts { - repeated DataContractEntry data_contract_entries = 1; + repeated DataContractEntry data_contract_entries = 1; // A list of data contract entries } message GetDataContractsResponseV0 { oneof result { - DataContracts data_contracts = 1; - Proof proof = 2; + DataContracts data_contracts = 1; // The actual data contracts requested + Proof proof = 2; // Cryptographic proof for the data contracts, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { GetDataContractsResponseV0 v0 = 1; } } message GetDataContractHistoryRequest { message GetDataContractHistoryRequestV0 { - bytes id = 1; - google.protobuf.UInt32Value limit = 2; - google.protobuf.UInt32Value offset = 3; - uint64 start_at_ms = 4; - bool prove = 5; + bytes id = 1; // The unique ID of the data contract + google.protobuf.UInt32Value limit = 2; // The maximum number of history entries to return + google.protobuf.UInt32Value offset = 3; // The offset for pagination through the contract history + uint64 start_at_ms = 4; // Only return results starting at this time in milliseconds + bool prove = 5; // Flag to request a proof as the response } oneof version { GetDataContractHistoryRequestV0 v0 = 1; } } message GetDataContractHistoryResponse { message GetDataContractHistoryResponseV0 { + // Represents a single entry in the data contract's history message DataContractHistoryEntry { - uint64 date = 1; - bytes value = 2; + uint64 date = 1; // The date of the history entry + bytes value = 2; // The value of the data contract at this point in history } + // Collection of data contract history entries message DataContractHistory { - repeated DataContractHistoryEntry data_contract_entries = 1; + repeated DataContractHistoryEntry data_contract_entries = 1; // List of history entries } oneof result { - DataContractHistory data_contract_history = 1; - Proof proof = 2; + DataContractHistory data_contract_history = 1; // The actual history of the data contract + Proof proof = 2; // Cryptographic proof of the data contract history, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { GetDataContractHistoryResponseV0 v0 = 1; } } message GetDocumentsRequest { message GetDocumentsRequestV0 { - bytes data_contract_id = 1; - string document_type = 2; - bytes where = 3; - bytes order_by = 4; - uint32 limit = 5; + bytes data_contract_id = 1; // The ID of the data contract containing the documents + string document_type = 2; // The type of document being requested + bytes where = 3; // Conditions to be met by the requested documents + bytes order_by = 4; // Ordering criteria for the documents + uint32 limit = 5; // Maximum number of documents to return + + // Specifies the starting point for the document retrieval oneof start { - bytes start_after = 6; - bytes start_at = 7; + bytes start_after = 6; // Start retrieval after this document + bytes start_at = 7; // Start retrieval at this document } - bool prove = 8; + bool prove = 8; // Flag to request a proof as the response } oneof version { GetDocumentsRequestV0 v0 = 1; } } message GetDocumentsResponse { message GetDocumentsResponseV0 { - message Documents { repeated bytes documents = 1; } - - oneof result { - Documents documents = 1; - Proof proof = 2; + // Represents a collection of documents + message Documents { + repeated bytes documents = 1; // The actual documents in binary form } - ResponseMetadata metadata = 3; - } - oneof version { GetDocumentsResponseV0 v0 = 1; } -} - -message GetIdentitiesByPublicKeyHashesRequest { - message GetIdentitiesByPublicKeyHashesRequestV0 { - repeated bytes public_key_hashes = 1; - bool prove = 2; - } - oneof version { GetIdentitiesByPublicKeyHashesRequestV0 v0 = 1; } -} -message GetIdentitiesByPublicKeyHashesResponse { - message PublicKeyHashIdentityEntry { - bytes public_key_hash = 1; - google.protobuf.BytesValue value = 2; - } - - message IdentitiesByPublicKeyHashes { - repeated PublicKeyHashIdentityEntry identity_entries = 1; - } - - message GetIdentitiesByPublicKeyHashesResponseV0 { oneof result { - IdentitiesByPublicKeyHashes identities = 1; - Proof proof = 2; + Documents documents = 1; // The actual documents requested + Proof proof = 2; // Cryptographic proof of the documents, if requested } - - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } - oneof version { GetIdentitiesByPublicKeyHashesResponseV0 v0 = 1; } + oneof version { GetDocumentsResponseV0 v0 = 1; } } message GetIdentityByPublicKeyHashRequest { message GetIdentityByPublicKeyHashRequestV0 { - bytes public_key_hash = 1; - bool prove = 2; + bytes public_key_hash = 1; // The public key hash of the identity being requested + bool prove = 2; // Flag to request a proof as the response } oneof version { GetIdentityByPublicKeyHashRequestV0 v0 = 1; } } @@ -405,19 +496,19 @@ message GetIdentityByPublicKeyHashRequest { message GetIdentityByPublicKeyHashResponse { message GetIdentityByPublicKeyHashResponseV0 { oneof result { - bytes identity = 1; - Proof proof = 2; + bytes identity = 1; // The actual identity data corresponding to the requested public key hash + Proof proof = 2; // Cryptographic proof for the identity data, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { GetIdentityByPublicKeyHashResponseV0 v0 = 1; } } message WaitForStateTransitionResultRequest { message WaitForStateTransitionResultRequestV0 { - bytes state_transition_hash = 1; - bool prove = 2; + bytes state_transition_hash = 1; // The hash of the state transition to wait for + bool prove = 2; // Flag to request a proof as the response } oneof version { WaitForStateTransitionResultRequestV0 v0 = 1; } } @@ -425,38 +516,38 @@ message WaitForStateTransitionResultRequest { message WaitForStateTransitionResultResponse { message WaitForStateTransitionResultResponseV0 { oneof result { - StateTransitionBroadcastError error = 1; - Proof proof = 2; + StateTransitionBroadcastError error = 1; // Any error that occurred during the state transition broadcast + Proof proof = 2; // Cryptographic proof for the state transition, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { WaitForStateTransitionResultResponseV0 v0 = 1; } } message GetConsensusParamsRequest { message GetConsensusParamsRequestV0 { - int32 height = 1; - bool prove = 2; + int32 height = 1; // The blockchain height at which to get the consensus parameters + bool prove = 2; // Flag to request a proof as the response } oneof version { GetConsensusParamsRequestV0 v0 = 1; } } message GetConsensusParamsResponse { message ConsensusParamsBlock { - string max_bytes = 1; - string max_gas = 2; - string time_iota_ms = 3; + string max_bytes = 1; // The maximum size of a block in bytes + string max_gas = 2; // The maximum gas allowed in a block + string time_iota_ms = 3; // The minimum time increment between consecutive blocks, in milliseconds } message ConsensusParamsEvidence { - string max_age_num_blocks = 1; - string max_age_duration = 2; - string max_bytes = 3; + string max_age_num_blocks = 1; // The maximum age of evidence, in number of blocks + string max_age_duration = 2; // The maximum age of evidence, as a duration + string max_bytes = 3; // The maximum size of evidence in bytes } message GetConsensusParamsResponseV0 { - ConsensusParamsBlock block = 1; - ConsensusParamsEvidence evidence = 2; + ConsensusParamsBlock block = 1; // Consensus parameters related to block creation and validation + ConsensusParamsEvidence evidence = 2; // Consensus parameters related to evidence } oneof version { GetConsensusParamsResponseV0 v0 = 1; } } @@ -464,7 +555,7 @@ message GetConsensusParamsResponse { message GetProtocolVersionUpgradeStateRequest { message GetProtocolVersionUpgradeStateRequestV0 { - bool prove = 1; + bool prove = 1; // Flag to request a proof as the response } oneof version { @@ -474,20 +565,22 @@ message GetProtocolVersionUpgradeStateRequest { message GetProtocolVersionUpgradeStateResponse { message GetProtocolVersionUpgradeStateResponseV0 { + // Versions holds a collection of version entries message Versions { - repeated VersionEntry versions = 1; + repeated VersionEntry versions = 1; // List of protocol version entries } + // VersionEntry represents a single entry of a protocol version message VersionEntry { - uint32 version_number = 1; - uint32 vote_count = 2; + uint32 version_number = 1; // The protocol version number + uint32 vote_count = 2; // The vote count for this protocol version } oneof result { - Versions versions = 1; - Proof proof = 2; + Versions versions = 1; // The actual protocol version information + Proof proof = 2; // Cryptographic proof of the protocol version information, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { @@ -497,9 +590,9 @@ message GetProtocolVersionUpgradeStateResponse { message GetProtocolVersionUpgradeVoteStatusRequest { message GetProtocolVersionUpgradeVoteStatusRequestV0 { - bytes start_pro_tx_hash = 1; - uint32 count = 2; - bool prove = 3; + bytes start_pro_tx_hash = 1; // The starting masternode provider transaction hash to filter the votes by + uint32 count = 2; // The number of vote entries to retrieve + bool prove = 3; // Flag to request a proof as the response } oneof version { @@ -509,20 +602,22 @@ message GetProtocolVersionUpgradeVoteStatusRequest { message GetProtocolVersionUpgradeVoteStatusResponse { message GetProtocolVersionUpgradeVoteStatusResponseV0 { + // VersionSignals holds a collection of version signal entries message VersionSignals { - repeated VersionSignal version_signals = 1; + repeated VersionSignal version_signals = 1; // List of version signal entries } + // VersionSignal represents a single voting signal for a protocol version message VersionSignal { - bytes pro_tx_hash = 1; - uint32 version = 2; + bytes pro_tx_hash = 1; // The masternode provider transaction hash associated with the vote + uint32 version = 2; // The protocol version number that is being voted on } oneof result { - VersionSignals versions = 1; - Proof proof = 2; + VersionSignals versions = 1; // The actual version signal information + Proof proof = 2; // Cryptographic proof of the version signal information, if requested } - ResponseMetadata metadata = 3; + ResponseMetadata metadata = 3; // Metadata about the blockchain state } oneof version { @@ -532,10 +627,10 @@ message GetProtocolVersionUpgradeVoteStatusResponse { message GetEpochsInfoRequest { message GetEpochsInfoRequestV0 { - google.protobuf.UInt32Value start_epoch = 1; - uint32 count = 2; - bool ascending = 3; - bool prove = 4; + google.protobuf.UInt32Value start_epoch = 1; // The starting epoch for the request + uint32 count = 2; // The number of epochs to retrieve information for + bool ascending = 3; // Flag indicating if the epochs should be listed in ascending order + bool prove = 4; // Flag to request a proof as the response } oneof version { @@ -545,26 +640,364 @@ message GetEpochsInfoRequest { message GetEpochsInfoResponse { message GetEpochsInfoResponseV0 { + // EpochInfos holds a collection of epoch information entries message EpochInfos { - repeated EpochInfo epoch_infos = 1; + repeated EpochInfo epoch_infos = 1; // List of information for each requested epoch } + // EpochInfo represents information about a single epoch message EpochInfo { - uint32 number = 1; - uint64 first_block_height = 2; - uint32 first_core_block_height = 3; - uint64 start_time = 4; - double fee_multiplier = 5; + uint32 number = 1; // The number of the epoch + uint64 first_block_height = 2; // The height of the first block in this epoch + uint32 first_core_block_height = 3; // The height of the first Core block in this epoch + uint64 start_time = 4; // The start time of the epoch + double fee_multiplier = 5; // The fee multiplier applicable in this epoch + uint32 protocol_version = 6; + } + + oneof result { + EpochInfos epochs = 1; // The actual information about the requested epochs + Proof proof = 2; // Cryptographic proof of the epoch information, if requested + } + ResponseMetadata metadata = 3; // Metadata about the blockchain state + } + + oneof version { + GetEpochsInfoResponseV0 v0 = 1; + } +} + +message GetContestedResourcesRequest { + message GetContestedResourcesRequestV0 { + message StartAtValueInfo { + bytes start_value = 1; + bool start_value_included = 2; + } + + bytes contract_id = 1; + string document_type_name = 2; + string index_name = 3; + repeated bytes start_index_values = 4; + repeated bytes end_index_values = 5; + optional StartAtValueInfo start_at_value_info = 6; + optional uint32 count = 7; + bool order_ascending = 8; + bool prove = 9; + } + + oneof version { + GetContestedResourcesRequestV0 v0 = 1; + } +} + +message GetContestedResourcesResponse { + message GetContestedResourcesResponseV0 { + message ContestedResourceValues { + repeated bytes contested_resource_values = 1; } oneof result { - EpochInfos epochs = 1; + ContestedResourceValues contested_resource_values = 1; Proof proof = 2; } ResponseMetadata metadata = 3; } oneof version { - GetEpochsInfoResponseV0 v0 = 1; + GetContestedResourcesResponseV0 v0 = 1; + } +} + +message GetVotePollsByEndDateRequest { + message GetVotePollsByEndDateRequestV0 { + message StartAtTimeInfo { + uint64 start_time_ms = 1; + bool start_time_included = 2; + } + message EndAtTimeInfo { + uint64 end_time_ms = 1; + bool end_time_included = 2; + } + optional StartAtTimeInfo start_time_info = 1; + optional EndAtTimeInfo end_time_info = 2; + optional uint32 limit = 3; + optional uint32 offset = 4; + bool ascending = 5; + bool prove = 6; + } + + oneof version { + GetVotePollsByEndDateRequestV0 v0 = 1; + } +} + +message GetVotePollsByEndDateResponse { + message GetVotePollsByEndDateResponseV0 { + message SerializedVotePollsByTimestamp { + uint64 timestamp = 1; + repeated bytes serialized_vote_polls = 2; + } + + message SerializedVotePollsByTimestamps { + repeated SerializedVotePollsByTimestamp vote_polls_by_timestamps = 1; + bool finished_results = 2; + } + + oneof result { + SerializedVotePollsByTimestamps vote_polls_by_timestamps = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { + GetVotePollsByEndDateResponseV0 v0 = 1; + } +} + +// What's the state of a contested resource vote? (ie who is winning?) +message GetContestedResourceVoteStateRequest { + message GetContestedResourceVoteStateRequestV0 { + message StartAtIdentifierInfo { + bytes start_identifier = 1; + bool start_identifier_included = 2; + } + enum ResultType { + DOCUMENTS = 0; + VOTE_TALLY = 1; + DOCUMENTS_AND_VOTE_TALLY = 2; + } + + bytes contract_id = 1; + string document_type_name = 2; + string index_name = 3; + repeated bytes index_values = 4; + ResultType result_type = 5; + bool allow_include_locked_and_abstaining_vote_tally = 6; + optional StartAtIdentifierInfo start_at_identifier_info = 7; + optional uint32 count = 8; + bool prove = 9; + } + + oneof version { + GetContestedResourceVoteStateRequestV0 v0 = 1; + } +} + +message GetContestedResourceVoteStateResponse { + message GetContestedResourceVoteStateResponseV0 { + message FinishedVoteInfo { + enum FinishedVoteOutcome { + TOWARDS_IDENTITY = 0; + LOCKED = 1; + NO_PREVIOUS_WINNER = 2; + } + FinishedVoteOutcome finished_vote_outcome = 1; + optional bytes won_by_identity_id = 2; // Only used when vote_choice_type is TOWARDS_IDENTITY + uint64 finished_at_block_height = 3; + uint32 finished_at_core_block_height = 4; + uint64 finished_at_block_time_ms = 5; + uint32 finished_at_epoch = 6; + } + + message ContestedResourceContenders { + repeated Contender contenders = 1; + optional uint32 abstain_vote_tally = 2; + optional uint32 lock_vote_tally = 3; + optional FinishedVoteInfo finished_vote_info = 4; + } + + message Contender { + bytes identifier = 1; + optional uint32 vote_count = 2; + optional bytes document = 3; + } + + oneof result { + ContestedResourceContenders contested_resource_contenders = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { + GetContestedResourceVoteStateResponseV0 v0 = 1; + } +} + +// Who voted for a contested resource to go to a specific identity? +message GetContestedResourceVotersForIdentityRequest { + message GetContestedResourceVotersForIdentityRequestV0 { + message StartAtIdentifierInfo { + bytes start_identifier = 1; + bool start_identifier_included = 2; + } + bytes contract_id = 1; + string document_type_name = 2; + string index_name = 3; + repeated bytes index_values = 4; + bytes contestant_id = 5; + optional StartAtIdentifierInfo start_at_identifier_info = 6; + optional uint32 count = 7; + bool order_ascending = 8; + bool prove = 9; + } + + oneof version { + GetContestedResourceVotersForIdentityRequestV0 v0 = 1; + } +} + +message GetContestedResourceVotersForIdentityResponse { + message GetContestedResourceVotersForIdentityResponseV0 { + message ContestedResourceVoters { + repeated bytes voters = 1; + bool finished_results = 2; + } + + oneof result { + ContestedResourceVoters contested_resource_voters = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { + GetContestedResourceVotersForIdentityResponseV0 v0 = 1; + } +} + +// How did an identity vote? +message GetContestedResourceIdentityVotesRequest { + message GetContestedResourceIdentityVotesRequestV0 { + message StartAtVotePollIdInfo { + bytes start_at_poll_identifier = 1; + bool start_poll_identifier_included = 2; + } + bytes identity_id = 1; + google.protobuf.UInt32Value limit = 2; + google.protobuf.UInt32Value offset = 3; + bool order_ascending = 4; + optional StartAtVotePollIdInfo start_at_vote_poll_id_info = 5; + bool prove = 6; + } + + oneof version { + GetContestedResourceIdentityVotesRequestV0 v0 = 1; + } +} + +message GetContestedResourceIdentityVotesResponse { + message GetContestedResourceIdentityVotesResponseV0 { + message ContestedResourceIdentityVotes { + repeated ContestedResourceIdentityVote contested_resource_identity_votes = 1; + bool finished_results = 2; + } + + message ResourceVoteChoice { + enum VoteChoiceType { + TOWARDS_IDENTITY = 0; + ABSTAIN = 1; + LOCK = 2; + } + VoteChoiceType vote_choice_type = 1; + optional bytes identity_id = 2; // Only used when vote_choice_type is TOWARDS_IDENTITY + } + + message ContestedResourceIdentityVote { + bytes contract_id = 1; + string document_type_name = 2; + repeated bytes serialized_index_storage_values = 3; + ResourceVoteChoice vote_choice = 4; + } + + oneof result { + ContestedResourceIdentityVotes votes = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { + GetContestedResourceIdentityVotesResponseV0 v0 = 1; + } +} + +message GetPrefundedSpecializedBalanceRequest { + + message GetPrefundedSpecializedBalanceRequestV0 { + bytes id = 1; + bool prove = 2; + } + + oneof version { GetPrefundedSpecializedBalanceRequestV0 v0 = 1; } +} + +message GetPrefundedSpecializedBalanceResponse { + + message GetPrefundedSpecializedBalanceResponseV0 { + oneof result { + uint64 balance = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { GetPrefundedSpecializedBalanceResponseV0 v0 = 1; } +} + +message GetTotalCreditsInPlatformRequest { + message GetTotalCreditsInPlatformRequestV0 { + bool prove = 1; + } + + oneof version { + GetTotalCreditsInPlatformRequestV0 v0 = 1; + } +} + +message GetTotalCreditsInPlatformResponse { + message GetTotalCreditsInPlatformResponseV0 { + oneof result { + uint64 credits = 1; + + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { + GetTotalCreditsInPlatformResponseV0 v0 = 1; + } +} + +message GetPathElementsRequest { + message GetPathElementsRequestV0 { + repeated bytes path = 1; + repeated bytes keys = 2; + bool prove = 3; + } + + oneof version { + GetPathElementsRequestV0 v0 = 1; + } +} + +message GetPathElementsResponse { + message GetPathElementsResponseV0 { + message Elements { + repeated bytes elements = 1; + } + + oneof result { + Elements elements = 1; + + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { + GetPathElementsResponseV0 v0 = 1; } } diff --git a/packages/dapi-grpc/src/core/proto/org.dash.platform.dapi.v0.rs b/packages/dapi-grpc/src/core/proto/org.dash.platform.dapi.v0.rs deleted file mode 100644 index 322464c7958..00000000000 --- a/packages/dapi-grpc/src/core/proto/org.dash.platform.dapi.v0.rs +++ /dev/null @@ -1,666 +0,0 @@ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetStatusRequest {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetStatusResponse { - #[prost(message, optional, tag = "1")] - pub version: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub time: ::core::option::Option, - #[prost(enumeration = "get_status_response::Status", tag = "3")] - pub status: i32, - #[prost(double, tag = "4")] - pub sync_progress: f64, - #[prost(message, optional, tag = "5")] - pub chain: ::core::option::Option, - #[prost(message, optional, tag = "6")] - pub masternode: ::core::option::Option, - #[prost(message, optional, tag = "7")] - pub network: ::core::option::Option, -} -/// Nested message and enum types in `GetStatusResponse`. -pub mod get_status_response { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Version { - #[prost(uint32, tag = "1")] - pub protocol: u32, - #[prost(uint32, tag = "2")] - pub software: u32, - #[prost(string, tag = "3")] - pub agent: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Time { - #[prost(uint32, tag = "1")] - pub now: u32, - #[prost(int32, tag = "2")] - pub offset: i32, - #[prost(uint32, tag = "3")] - pub median: u32, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Chain { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - #[prost(uint32, tag = "2")] - pub headers_count: u32, - #[prost(uint32, tag = "3")] - pub blocks_count: u32, - #[prost(bytes = "vec", tag = "4")] - pub best_block_hash: ::prost::alloc::vec::Vec, - #[prost(double, tag = "5")] - pub difficulty: f64, - #[prost(bytes = "vec", tag = "6")] - pub chain_work: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "7")] - pub is_synced: bool, - #[prost(double, tag = "8")] - pub sync_progress: f64, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Masternode { - #[prost(enumeration = "masternode::Status", tag = "1")] - pub status: i32, - #[prost(bytes = "vec", tag = "2")] - pub pro_tx_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "3")] - pub pose_penalty: u32, - #[prost(bool, tag = "4")] - pub is_synced: bool, - #[prost(double, tag = "5")] - pub sync_progress: f64, - } - /// Nested message and enum types in `Masternode`. - pub mod masternode { - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Status { - Unknown = 0, - WaitingForProtx = 1, - PoseBanned = 2, - Removed = 3, - OperatorKeyChanged = 4, - ProtxIpChanged = 5, - Ready = 6, - Error = 7, - } - impl Status { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Status::Unknown => "UNKNOWN", - Status::WaitingForProtx => "WAITING_FOR_PROTX", - Status::PoseBanned => "POSE_BANNED", - Status::Removed => "REMOVED", - Status::OperatorKeyChanged => "OPERATOR_KEY_CHANGED", - Status::ProtxIpChanged => "PROTX_IP_CHANGED", - Status::Ready => "READY", - Status::Error => "ERROR", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNKNOWN" => Some(Self::Unknown), - "WAITING_FOR_PROTX" => Some(Self::WaitingForProtx), - "POSE_BANNED" => Some(Self::PoseBanned), - "REMOVED" => Some(Self::Removed), - "OPERATOR_KEY_CHANGED" => Some(Self::OperatorKeyChanged), - "PROTX_IP_CHANGED" => Some(Self::ProtxIpChanged), - "READY" => Some(Self::Ready), - "ERROR" => Some(Self::Error), - _ => None, - } - } - } - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct NetworkFee { - #[prost(double, tag = "1")] - pub relay: f64, - #[prost(double, tag = "2")] - pub incremental: f64, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Network { - #[prost(uint32, tag = "1")] - pub peers_count: u32, - #[prost(message, optional, tag = "2")] - pub fee: ::core::option::Option, - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Status { - NotStarted = 0, - Syncing = 1, - Ready = 2, - Error = 3, - } - impl Status { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Status::NotStarted => "NOT_STARTED", - Status::Syncing => "SYNCING", - Status::Ready => "READY", - Status::Error => "ERROR", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NOT_STARTED" => Some(Self::NotStarted), - "SYNCING" => Some(Self::Syncing), - "READY" => Some(Self::Ready), - "ERROR" => Some(Self::Error), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetBlockRequest { - #[prost(oneof = "get_block_request::Block", tags = "1, 2")] - pub block: ::core::option::Option, -} -/// Nested message and enum types in `GetBlockRequest`. -pub mod get_block_request { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Block { - #[prost(uint32, tag = "1")] - Height(u32), - #[prost(string, tag = "2")] - Hash(::prost::alloc::string::String), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetBlockResponse { - #[prost(bytes = "vec", tag = "1")] - pub block: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastTransactionRequest { - #[prost(bytes = "vec", tag = "1")] - pub transaction: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub allow_high_fees: bool, - #[prost(bool, tag = "3")] - pub bypass_limits: bool, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastTransactionResponse { - #[prost(string, tag = "1")] - pub transaction_id: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetTransactionRequest { - #[prost(string, tag = "1")] - pub id: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetTransactionResponse { - #[prost(bytes = "vec", tag = "1")] - pub transaction: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - pub block_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "3")] - pub height: u32, - #[prost(uint32, tag = "4")] - pub confirmations: u32, - #[prost(bool, tag = "5")] - pub is_instant_locked: bool, - #[prost(bool, tag = "6")] - pub is_chain_locked: bool, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockHeadersWithChainLocksRequest { - #[prost(uint32, tag = "3")] - pub count: u32, - #[prost(oneof = "block_headers_with_chain_locks_request::FromBlock", tags = "1, 2")] - pub from_block: ::core::option::Option< - block_headers_with_chain_locks_request::FromBlock, - >, -} -/// Nested message and enum types in `BlockHeadersWithChainLocksRequest`. -pub mod block_headers_with_chain_locks_request { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum FromBlock { - #[prost(bytes, tag = "1")] - FromBlockHash(::prost::alloc::vec::Vec), - #[prost(uint32, tag = "2")] - FromBlockHeight(u32), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockHeadersWithChainLocksResponse { - #[prost(oneof = "block_headers_with_chain_locks_response::Responses", tags = "1, 2")] - pub responses: ::core::option::Option< - block_headers_with_chain_locks_response::Responses, - >, -} -/// Nested message and enum types in `BlockHeadersWithChainLocksResponse`. -pub mod block_headers_with_chain_locks_response { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Responses { - #[prost(message, tag = "1")] - BlockHeaders(super::BlockHeaders), - #[prost(bytes, tag = "2")] - ChainLock(::prost::alloc::vec::Vec), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockHeaders { - #[prost(bytes = "vec", repeated, tag = "1")] - pub headers: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEstimatedTransactionFeeRequest { - #[prost(uint32, tag = "1")] - pub blocks: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEstimatedTransactionFeeResponse { - #[prost(double, tag = "1")] - pub fee: f64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionsWithProofsRequest { - #[prost(message, optional, tag = "1")] - pub bloom_filter: ::core::option::Option, - #[prost(uint32, tag = "4")] - pub count: u32, - #[prost(bool, tag = "5")] - pub send_transaction_hashes: bool, - #[prost(oneof = "transactions_with_proofs_request::FromBlock", tags = "2, 3")] - pub from_block: ::core::option::Option, -} -/// Nested message and enum types in `TransactionsWithProofsRequest`. -pub mod transactions_with_proofs_request { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum FromBlock { - #[prost(bytes, tag = "2")] - FromBlockHash(::prost::alloc::vec::Vec), - #[prost(uint32, tag = "3")] - FromBlockHeight(u32), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BloomFilter { - #[prost(bytes = "vec", tag = "1")] - pub v_data: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "2")] - pub n_hash_funcs: u32, - #[prost(uint32, tag = "3")] - pub n_tweak: u32, - #[prost(uint32, tag = "4")] - pub n_flags: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionsWithProofsResponse { - #[prost(oneof = "transactions_with_proofs_response::Responses", tags = "1, 2, 3")] - pub responses: ::core::option::Option, -} -/// Nested message and enum types in `TransactionsWithProofsResponse`. -pub mod transactions_with_proofs_response { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Responses { - #[prost(message, tag = "1")] - RawTransactions(super::RawTransactions), - #[prost(message, tag = "2")] - InstantSendLockMessages(super::InstantSendLockMessages), - #[prost(bytes, tag = "3")] - RawMerkleBlock(::prost::alloc::vec::Vec), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RawTransactions { - #[prost(bytes = "vec", repeated, tag = "1")] - pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct InstantSendLockMessages { - #[prost(bytes = "vec", repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// Generated client implementations. -pub mod core_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - #[derive(Debug, Clone)] - pub struct CoreClient { - inner: tonic::client::Grpc, - } - impl CoreClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl CoreClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> CoreClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - CoreClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - pub async fn get_status( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getStatus", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getStatus")); - self.inner.unary(req, path, codec).await - } - pub async fn get_block( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getBlock", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getBlock")); - self.inner.unary(req, path, codec).await - } - pub async fn broadcast_transaction( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/broadcastTransaction", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "broadcastTransaction", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_transaction( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getTransaction", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getTransaction"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_estimated_transaction_fee( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getEstimatedTransactionFee", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "getEstimatedTransactionFee", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn subscribe_to_block_headers_with_chain_locks( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/subscribeToBlockHeadersWithChainLocks", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "subscribeToBlockHeadersWithChainLocks", - ), - ); - self.inner.server_streaming(req, path, codec).await - } - pub async fn subscribe_to_transactions_with_proofs( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "subscribeToTransactionsWithProofs", - ), - ); - self.inner.server_streaming(req, path, codec).await - } - } -} diff --git a/packages/dapi-grpc/src/lib.rs b/packages/dapi-grpc/src/lib.rs index 32d1a1ac5d3..486ba8f3fce 100644 --- a/packages/dapi-grpc/src/lib.rs +++ b/packages/dapi-grpc/src/lib.rs @@ -2,23 +2,47 @@ pub use prost::Message; #[cfg(feature = "core")] pub mod core { + #![allow(non_camel_case_types)] pub mod v0 { - include!("core/proto/org.dash.platform.dapi.v0.rs"); + #[cfg(all(feature = "server", not(feature = "client")))] + include!("core/server/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "client", not(feature = "server")))] + include!("core/client/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "server", feature = "client"))] + include!("core/client_server/org.dash.platform.dapi.v0.rs"); } } #[cfg(feature = "platform")] pub mod platform { pub mod v0 { - include!("platform/proto/org.dash.platform.dapi.v0.rs"); + #[cfg(all(feature = "server", not(feature = "client")))] + include!("platform/server/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "client", not(feature = "server")))] + include!("platform/client/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "server", feature = "client"))] + include!("platform/client_server/org.dash.platform.dapi.v0.rs"); } + #[cfg(feature = "tenderdash-proto")] pub use tenderdash_proto as proto; + #[cfg(any(feature = "server", feature = "client"))] mod versioning; + #[cfg(any(feature = "server", feature = "client"))] pub use versioning::{VersionedGrpcMessage, VersionedGrpcResponse}; } #[cfg(feature = "serde")] // Serde deserialization logic pub mod deserialization; + +// We need mock module even if the feature is disabled +pub mod mock; + +// Re-export tonic to ensure everyone uses the same version +pub use tonic; diff --git a/packages/dapi-grpc/src/mock.rs b/packages/dapi-grpc/src/mock.rs new file mode 100644 index 00000000000..c20c248cb50 --- /dev/null +++ b/packages/dapi-grpc/src/mock.rs @@ -0,0 +1,130 @@ +//! Mocking support for messages. +//! +//! Contains [Mockable] trait that should be implemented by any object that can be used in the DAPI. +//! +//! Note that this trait is defined even if mocks are not supported, but it should always return `None` on serialization. + +#[cfg(feature = "mocks")] +pub mod serde_mockable; + +use tonic::Streaming; + +/// Mocking support for messages. +/// +/// This trait should be implemented by any object that can be used in the DAPI. +/// +/// We use serde_json to serialize/deserialize messages. +// TODO: Move to a different crate where it can be easily shared by dapi-grpc, dash-platform-sdk, and rs-dapi-client. +pub trait Mockable +where + Self: std::marker::Sized, +{ + /// Serialize the message to bytes for mocking purposes. + /// + /// Returns None if the message is not serializable or mocking is disabled. + /// + /// # Panics + /// + /// Panics on any error. + fn mock_serialize(&self) -> Option> { + None + } + /// Deserialize the message serialized with [mock_serialize()]. + /// + /// Returns None if the message is not serializable or mocking is disabled. + /// + /// # Panics + /// + /// Panics on any error. + fn mock_deserialize(_data: &[u8]) -> Option { + None + } +} +#[cfg(feature = "mocks")] +#[derive(serde::Serialize, serde::Deserialize)] +enum SerializableResult { + Ok(Vec), + Err(Vec), +} +impl Mockable for Result +where + T: Mockable, + E: Mockable, +{ + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + let serializable = match self { + Ok(value) => SerializableResult::Ok(value.mock_serialize()?), + Err(error) => SerializableResult::Err(error.mock_serialize()?), + }; + serde_json::to_vec(&serializable).ok() + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + if data.is_empty() { + return None; + } + let deser: SerializableResult = + serde_json::from_slice(data).expect("unable to deserialize mock data"); + Some(match deser { + SerializableResult::Ok(data) => Ok(T::mock_deserialize(&data)?), + SerializableResult::Err(data) => Err(E::mock_deserialize(&data)?), + }) + } +} + +impl Mockable for Option { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + self.as_ref().and_then(|value| value.mock_serialize()) + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + T::mock_deserialize(data).map(Some) + } +} + +impl Mockable for Vec { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + serde_json::to_vec(self).ok() + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + serde_json::from_slice(data).ok() + } +} +#[cfg(feature = "mocks")] +#[derive(serde::Serialize, serde::Deserialize)] +struct MockableStatus { + code: i32, + message: Vec, +} +impl Mockable for crate::tonic::Status { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + let mockable = MockableStatus { + code: self.code().into(), + message: self.message().as_bytes().to_vec(), + }; + + Some(serde_json::to_vec(&mockable).expect("unable to serialize tonic::Status")) + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + let MockableStatus { code, message } = + serde_json::from_slice(data).expect("unable to deserialize tonic::Status"); + let message = std::str::from_utf8(&message).expect("invalid utf8 message in tonic::Status"); + Some(Self::new(code.into(), message)) + } +} + +/// Mocking of gRPC streaming responses is not supported. +/// +/// This will return `None` on serialization, +/// effectively disabling mocking of streaming responses. +impl Mockable for Streaming {} diff --git a/packages/dapi-grpc/src/mock/serde_mockable.rs b/packages/dapi-grpc/src/mock/serde_mockable.rs new file mode 100644 index 00000000000..1fcd398c079 --- /dev/null +++ b/packages/dapi-grpc/src/mock/serde_mockable.rs @@ -0,0 +1,105 @@ +//! Serde serialization and deserialization for Mockable objects. +//! +//! This module provides a custom serialization and deserialization implementation for Mockable objects. +//! +//! /// ## Example +/// +/// ```rust +/// struct SomeObject { +/// field: u32, +/// } +/// +/// impl dapi_grpc::mock::Mockable for SomeObject { +/// fn mock_serialize(&self) -> Option> { +/// Some(self.field.to_be_bytes().to_vec()) +/// } +/// +/// fn mock_deserialize(bytes: &[u8]) -> Option { +/// if bytes.len() != 4 { +/// return None; +/// } +/// +/// Some(SomeObject { +/// field: u32::from_be_bytes(bytes.try_into().expect("4 bytes")), +/// }) +/// } +/// } +/// +/// #[derive(serde::Serialize,serde::Deserialize)] +/// struct TestStruct { +/// #[serde(with="dapi_grpc::mock::serde_mockable")] +/// field: SomeObject, +/// } +/// ``` +use super::Mockable; + +use serde::{ + de::{self, Visitor}, + Deserializer, Serializer, +}; +use serde_bytes::Deserialize; +use std::fmt; +use std::marker::PhantomData; + +/// Serialize any Mockable object to bytes. +/// +/// ## Example +/// +/// `#[serde(with="dapi_grpc::mock::serde_mockable")]` +pub fn serialize(data: &T, serializer: S) -> Result +where + S: Serializer, +{ + match data.mock_serialize() { + Some(bytes) => serializer.serialize_bytes(bytes.as_slice()), + None => Err(serde::ser::Error::custom( + "Mockable object is not serializable", + )), + } +} + +struct MockableVisitor { + marker: PhantomData, +} + +impl<'de, T> Visitor<'de> for MockableVisitor +where + T: Mockable, +{ + type Value = T; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a byte array") + } + + fn visit_bytes(self, v: &[u8]) -> Result + where + E: de::Error, + { + T::mock_deserialize(v).ok_or_else(|| E::custom("Failed to deserialize Mockable object")) + } + + fn visit_seq(self, seq: A) -> Result + where + A: de::SeqAccess<'de>, + { + let bytes = >::deserialize(de::value::SeqAccessDeserializer::new(seq))?; + T::mock_deserialize(&bytes).ok_or_else(|| { + serde::de::Error::custom("Failed to deserialize Mockable object from seq") + }) + } +} + +/// Deserialize any Mockable object from bytes. +/// +/// ## Example +/// +/// `#[serde(with="dapi_grpc::mock::serde_mockable")]` +pub fn deserialize<'de, T: Mockable, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + deserializer.deserialize_bytes(MockableVisitor { + marker: PhantomData, + }) +} diff --git a/packages/dapi-grpc/src/platform/proto/org.dash.platform.dapi.v0.rs b/packages/dapi-grpc/src/platform/proto/org.dash.platform.dapi.v0.rs deleted file mode 100644 index eb8b1b91236..00000000000 --- a/packages/dapi-grpc/src/platform/proto/org.dash.platform.dapi.v0.rs +++ /dev/null @@ -1,2481 +0,0 @@ -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Proof { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub grovedb_proof: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde(with = "serde_bytes")] - pub quorum_hash: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde(with = "serde_bytes")] - pub signature: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "4")] - pub round: u32, - #[prost(bytes = "vec", tag = "5")] - #[serde(with = "serde_bytes")] - pub block_id_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "6")] - pub quorum_type: u32, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ResponseMetadata { - #[prost(uint64, tag = "1")] - #[serde(with = "crate::deserialization::from_to_string")] - pub height: u64, - #[prost(uint32, tag = "2")] - pub core_chain_locked_height: u32, - #[prost(uint32, tag = "3")] - pub epoch: u32, - #[prost(uint64, tag = "4")] - #[serde(with = "crate::deserialization::from_to_string")] - pub time_ms: u64, - #[prost(uint32, tag = "5")] - pub protocol_version: u32, - #[prost(string, tag = "6")] - pub chain_id: ::prost::alloc::string::String, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StateTransitionBroadcastError { - #[prost(uint32, tag = "1")] - pub code: u32, - #[prost(string, tag = "2")] - pub message: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "3")] - pub data: ::prost::alloc::vec::Vec, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastStateTransitionRequest { - #[prost(bytes = "vec", tag = "1")] - pub state_transition: ::prost::alloc::vec::Vec, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastStateTransitionResponse {} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityRequest { - #[prost(oneof = "get_identity_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityRequest`. -pub mod get_identity_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceRequest { - #[prost(oneof = "get_identity_balance_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityBalanceRequest`. -pub mod get_identity_balance_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceAndRevisionRequest { - #[prost(oneof = "get_identity_balance_and_revision_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_balance_and_revision_request::Version, - >, -} -/// Nested message and enum types in `GetIdentityBalanceAndRevisionRequest`. -pub mod get_identity_balance_and_revision_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceAndRevisionRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceAndRevisionRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityResponse { - #[prost(oneof = "get_identity_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityResponse`. -pub mod get_identity_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identity_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentityResponseV0`. - pub mod get_identity_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(bytes, tag = "1")] - Identity(::prost::alloc::vec::Vec), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesRequest { - #[prost(oneof = "get_identities_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentitiesRequest`. -pub mod get_identities_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesRequestV0 { - #[prost(bytes = "vec", repeated, tag = "1")] - #[serde(with = "crate::deserialization::vec_base64string")] - pub ids: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesResponse { - #[prost(oneof = "get_identities_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentitiesResponse`. -pub mod get_identities_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentityValue { - #[prost(bytes = "vec", tag = "1")] - pub value: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentityEntry { - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub value: ::core::option::Option, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Identities { - #[prost(message, repeated, tag = "1")] - pub identity_entries: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identities_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentitiesResponseV0`. - pub mod get_identities_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Identities(super::Identities), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceResponse { - #[prost(oneof = "get_identity_balance_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityBalanceResponse`. -pub mod get_identity_balance_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identity_balance_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentityBalanceResponseV0`. - pub mod get_identity_balance_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(uint64, tag = "1")] - Balance(u64), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceAndRevisionResponse { - #[prost(oneof = "get_identity_balance_and_revision_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_balance_and_revision_response::Version, - >, -} -/// Nested message and enum types in `GetIdentityBalanceAndRevisionResponse`. -pub mod get_identity_balance_and_revision_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceAndRevisionResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_identity_balance_and_revision_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_identity_balance_and_revision_response_v0::Result, - >, - } - /// Nested message and enum types in `GetIdentityBalanceAndRevisionResponseV0`. - pub mod get_identity_balance_and_revision_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct BalanceAndRevision { - #[prost(uint64, tag = "1")] - pub balance: u64, - #[prost(uint64, tag = "2")] - pub revision: u64, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - BalanceAndRevision(BalanceAndRevision), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceAndRevisionResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct KeyRequestType { - #[prost(oneof = "key_request_type::Request", tags = "1, 2, 3")] - pub request: ::core::option::Option, -} -/// Nested message and enum types in `KeyRequestType`. -pub mod key_request_type { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Request { - #[prost(message, tag = "1")] - AllKeys(super::AllKeys), - #[prost(message, tag = "2")] - SpecificKeys(super::SpecificKeys), - #[prost(message, tag = "3")] - SearchKey(super::SearchKey), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AllKeys {} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SpecificKeys { - #[prost(uint32, repeated, tag = "1")] - pub key_ids: ::prost::alloc::vec::Vec, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SearchKey { - #[prost(map = "uint32, message", tag = "1")] - pub purpose_map: ::std::collections::HashMap, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SecurityLevelMap { - #[prost( - map = "uint32, enumeration(security_level_map::KeyKindRequestType)", - tag = "1" - )] - pub security_level_map: ::std::collections::HashMap, -} -/// Nested message and enum types in `SecurityLevelMap`. -pub mod security_level_map { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum KeyKindRequestType { - CurrentKeyOfKindRequest = 0, - AllKeysOfKindRequest = 1, - } - impl KeyKindRequestType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - KeyKindRequestType::CurrentKeyOfKindRequest => { - "CURRENT_KEY_OF_KIND_REQUEST" - } - KeyKindRequestType::AllKeysOfKindRequest => "ALL_KEYS_OF_KIND_REQUEST", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "CURRENT_KEY_OF_KIND_REQUEST" => Some(Self::CurrentKeyOfKindRequest), - "ALL_KEYS_OF_KIND_REQUEST" => Some(Self::AllKeysOfKindRequest), - _ => None, - } - } - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityKeysRequest { - #[prost(oneof = "get_identity_keys_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityKeysRequest`. -pub mod get_identity_keys_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityKeysRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub identity_id: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub request_type: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub limit: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub offset: ::core::option::Option, - #[prost(bool, tag = "5")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityKeysRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityKeysResponse { - #[prost(oneof = "get_identity_keys_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityKeysResponse`. -pub mod get_identity_keys_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityKeysResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identity_keys_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentityKeysResponseV0`. - pub mod get_identity_keys_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Keys { - #[prost(bytes = "vec", repeated, tag = "1")] - pub keys_bytes: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Keys(Keys), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityKeysResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProofsRequest { - #[prost(oneof = "get_proofs_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetProofsRequest`. -pub mod get_proofs_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProofsRequestV0 { - #[prost(message, repeated, tag = "1")] - pub identities: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub contracts: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub documents: ::prost::alloc::vec::Vec, - } - /// Nested message and enum types in `GetProofsRequestV0`. - pub mod get_proofs_request_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DocumentRequest { - #[prost(bytes = "vec", tag = "1")] - pub contract_id: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub document_type: ::prost::alloc::string::String, - #[prost(bool, tag = "3")] - pub document_type_keeps_history: bool, - #[prost(bytes = "vec", tag = "4")] - pub document_id: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentityRequest { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub identity_id: ::prost::alloc::vec::Vec, - #[prost(enumeration = "identity_request::Type", tag = "2")] - pub request_type: i32, - } - /// Nested message and enum types in `IdentityRequest`. - pub mod identity_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Type { - FullIdentity = 0, - Balance = 1, - Keys = 2, - } - impl Type { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Type::FullIdentity => "FULL_IDENTITY", - Type::Balance => "BALANCE", - Type::Keys => "KEYS", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "FULL_IDENTITY" => Some(Self::FullIdentity), - "BALANCE" => Some(Self::Balance), - "KEYS" => Some(Self::Keys), - _ => None, - } - } - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ContractRequest { - #[prost(bytes = "vec", tag = "1")] - pub contract_id: ::prost::alloc::vec::Vec, - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProofsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProofsResponse { - #[prost(oneof = "get_proofs_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetProofsResponse`. -pub mod get_proofs_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProofsResponseV0 { - #[prost(message, optional, tag = "2")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_proofs_response_v0::Result", tags = "1")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetProofsResponseV0`. - pub mod get_proofs_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProofsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractRequest { - #[prost(oneof = "get_data_contract_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractRequest`. -pub mod get_data_contract_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractResponse { - #[prost(oneof = "get_data_contract_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractResponse`. -pub mod get_data_contract_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_data_contract_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetDataContractResponseV0`. - pub mod get_data_contract_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(bytes, tag = "1")] - DataContract(::prost::alloc::vec::Vec), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractsRequest { - #[prost(oneof = "get_data_contracts_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractsRequest`. -pub mod get_data_contracts_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractsRequestV0 { - #[prost(bytes = "vec", repeated, tag = "1")] - #[serde(with = "crate::deserialization::vec_base64string")] - pub ids: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractsResponse { - #[prost(oneof = "get_data_contracts_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractsResponse`. -pub mod get_data_contracts_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContractEntry { - #[prost(bytes = "vec", tag = "1")] - pub identifier: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub data_contract: ::core::option::Option<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContracts { - #[prost(message, repeated, tag = "1")] - pub data_contract_entries: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractsResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_data_contracts_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetDataContractsResponseV0`. - pub mod get_data_contracts_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - DataContracts(super::DataContracts), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractHistoryRequest { - #[prost(oneof = "get_data_contract_history_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractHistoryRequest`. -pub mod get_data_contract_history_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractHistoryRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub limit: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub offset: ::core::option::Option, - #[prost(uint64, tag = "4")] - #[serde(with = "crate::deserialization::from_to_string")] - pub start_at_ms: u64, - #[prost(bool, tag = "5")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractHistoryRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractHistoryResponse { - #[prost(oneof = "get_data_contract_history_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractHistoryResponse`. -pub mod get_data_contract_history_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractHistoryResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_data_contract_history_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option< - get_data_contract_history_response_v0::Result, - >, - } - /// Nested message and enum types in `GetDataContractHistoryResponseV0`. - pub mod get_data_contract_history_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContractHistoryEntry { - #[prost(uint64, tag = "1")] - pub date: u64, - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContractHistory { - #[prost(message, repeated, tag = "1")] - pub data_contract_entries: ::prost::alloc::vec::Vec< - DataContractHistoryEntry, - >, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - DataContractHistory(DataContractHistory), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractHistoryResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDocumentsRequest { - #[prost(oneof = "get_documents_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDocumentsRequest`. -pub mod get_documents_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDocumentsRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub data_contract_id: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub document_type: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "3")] - #[serde(with = "serde_bytes")] - pub r#where: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "4")] - #[serde(with = "serde_bytes")] - pub order_by: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "5")] - pub limit: u32, - #[prost(bool, tag = "8")] - pub prove: bool, - #[prost(oneof = "get_documents_request_v0::Start", tags = "6, 7")] - pub start: ::core::option::Option, - } - /// Nested message and enum types in `GetDocumentsRequestV0`. - pub mod get_documents_request_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Start { - #[prost(bytes, tag = "6")] - StartAfter(::prost::alloc::vec::Vec), - #[prost(bytes, tag = "7")] - StartAt(::prost::alloc::vec::Vec), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDocumentsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDocumentsResponse { - #[prost(oneof = "get_documents_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDocumentsResponse`. -pub mod get_documents_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDocumentsResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_documents_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetDocumentsResponseV0`. - pub mod get_documents_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Documents { - #[prost(bytes = "vec", repeated, tag = "1")] - pub documents: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Documents(Documents), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDocumentsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesByPublicKeyHashesRequest { - #[prost(oneof = "get_identities_by_public_key_hashes_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_identities_by_public_key_hashes_request::Version, - >, -} -/// Nested message and enum types in `GetIdentitiesByPublicKeyHashesRequest`. -pub mod get_identities_by_public_key_hashes_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesByPublicKeyHashesRequestV0 { - #[prost(bytes = "vec", repeated, tag = "1")] - #[serde(with = "crate::deserialization::vec_base64string")] - pub public_key_hashes: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesByPublicKeyHashesRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesByPublicKeyHashesResponse { - #[prost(oneof = "get_identities_by_public_key_hashes_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_identities_by_public_key_hashes_response::Version, - >, -} -/// Nested message and enum types in `GetIdentitiesByPublicKeyHashesResponse`. -pub mod get_identities_by_public_key_hashes_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct PublicKeyHashIdentityEntry { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub public_key_hash: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub value: ::core::option::Option<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentitiesByPublicKeyHashes { - #[prost(message, repeated, tag = "1")] - pub identity_entries: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesByPublicKeyHashesResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_identities_by_public_key_hashes_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_identities_by_public_key_hashes_response_v0::Result, - >, - } - /// Nested message and enum types in `GetIdentitiesByPublicKeyHashesResponseV0`. - pub mod get_identities_by_public_key_hashes_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Identities(super::IdentitiesByPublicKeyHashes), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesByPublicKeyHashesResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityByPublicKeyHashRequest { - #[prost(oneof = "get_identity_by_public_key_hash_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_by_public_key_hash_request::Version, - >, -} -/// Nested message and enum types in `GetIdentityByPublicKeyHashRequest`. -pub mod get_identity_by_public_key_hash_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityByPublicKeyHashRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub public_key_hash: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityByPublicKeyHashRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityByPublicKeyHashResponse { - #[prost(oneof = "get_identity_by_public_key_hash_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_by_public_key_hash_response::Version, - >, -} -/// Nested message and enum types in `GetIdentityByPublicKeyHashResponse`. -pub mod get_identity_by_public_key_hash_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityByPublicKeyHashResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_identity_by_public_key_hash_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_identity_by_public_key_hash_response_v0::Result, - >, - } - /// Nested message and enum types in `GetIdentityByPublicKeyHashResponseV0`. - pub mod get_identity_by_public_key_hash_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(bytes, tag = "1")] - Identity(::prost::alloc::vec::Vec), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityByPublicKeyHashResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct WaitForStateTransitionResultRequest { - #[prost(oneof = "wait_for_state_transition_result_request::Version", tags = "1")] - pub version: ::core::option::Option< - wait_for_state_transition_result_request::Version, - >, -} -/// Nested message and enum types in `WaitForStateTransitionResultRequest`. -pub mod wait_for_state_transition_result_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct WaitForStateTransitionResultRequestV0 { - #[prost(bytes = "vec", tag = "1")] - pub state_transition_hash: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(WaitForStateTransitionResultRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct WaitForStateTransitionResultResponse { - #[prost(oneof = "wait_for_state_transition_result_response::Version", tags = "1")] - pub version: ::core::option::Option< - wait_for_state_transition_result_response::Version, - >, -} -/// Nested message and enum types in `WaitForStateTransitionResultResponse`. -pub mod wait_for_state_transition_result_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct WaitForStateTransitionResultResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "wait_for_state_transition_result_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - wait_for_state_transition_result_response_v0::Result, - >, - } - /// Nested message and enum types in `WaitForStateTransitionResultResponseV0`. - pub mod wait_for_state_transition_result_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Error(super::super::StateTransitionBroadcastError), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(WaitForStateTransitionResultResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetConsensusParamsRequest { - #[prost(oneof = "get_consensus_params_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetConsensusParamsRequest`. -pub mod get_consensus_params_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetConsensusParamsRequestV0 { - #[prost(int32, tag = "1")] - pub height: i32, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetConsensusParamsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetConsensusParamsResponse { - #[prost(oneof = "get_consensus_params_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetConsensusParamsResponse`. -pub mod get_consensus_params_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ConsensusParamsBlock { - #[prost(string, tag = "1")] - pub max_bytes: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub max_gas: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub time_iota_ms: ::prost::alloc::string::String, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ConsensusParamsEvidence { - #[prost(string, tag = "1")] - pub max_age_num_blocks: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub max_age_duration: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub max_bytes: ::prost::alloc::string::String, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetConsensusParamsResponseV0 { - #[prost(message, optional, tag = "1")] - pub block: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub evidence: ::core::option::Option, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetConsensusParamsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeStateRequest { - #[prost(oneof = "get_protocol_version_upgrade_state_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_protocol_version_upgrade_state_request::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeStateRequest`. -pub mod get_protocol_version_upgrade_state_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeStateRequestV0 { - #[prost(bool, tag = "1")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeStateRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeStateResponse { - #[prost(oneof = "get_protocol_version_upgrade_state_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_protocol_version_upgrade_state_response::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeStateResponse`. -pub mod get_protocol_version_upgrade_state_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeStateResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_protocol_version_upgrade_state_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_protocol_version_upgrade_state_response_v0::Result, - >, - } - /// Nested message and enum types in `GetProtocolVersionUpgradeStateResponseV0`. - pub mod get_protocol_version_upgrade_state_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Versions { - #[prost(message, repeated, tag = "1")] - pub versions: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct VersionEntry { - #[prost(uint32, tag = "1")] - pub version_number: u32, - #[prost(uint32, tag = "2")] - pub vote_count: u32, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Versions(Versions), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeStateResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeVoteStatusRequest { - #[prost( - oneof = "get_protocol_version_upgrade_vote_status_request::Version", - tags = "1" - )] - pub version: ::core::option::Option< - get_protocol_version_upgrade_vote_status_request::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeVoteStatusRequest`. -pub mod get_protocol_version_upgrade_vote_status_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeVoteStatusRequestV0 { - #[prost(bytes = "vec", tag = "1")] - pub start_pro_tx_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "2")] - pub count: u32, - #[prost(bool, tag = "3")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeVoteStatusRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeVoteStatusResponse { - #[prost( - oneof = "get_protocol_version_upgrade_vote_status_response::Version", - tags = "1" - )] - pub version: ::core::option::Option< - get_protocol_version_upgrade_vote_status_response::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeVoteStatusResponse`. -pub mod get_protocol_version_upgrade_vote_status_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeVoteStatusResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_protocol_version_upgrade_vote_status_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_protocol_version_upgrade_vote_status_response_v0::Result, - >, - } - /// Nested message and enum types in `GetProtocolVersionUpgradeVoteStatusResponseV0`. - pub mod get_protocol_version_upgrade_vote_status_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct VersionSignals { - #[prost(message, repeated, tag = "1")] - pub version_signals: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct VersionSignal { - #[prost(bytes = "vec", tag = "1")] - pub pro_tx_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "2")] - pub version: u32, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Versions(VersionSignals), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeVoteStatusResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEpochsInfoRequest { - #[prost(oneof = "get_epochs_info_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetEpochsInfoRequest`. -pub mod get_epochs_info_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetEpochsInfoRequestV0 { - #[prost(message, optional, tag = "1")] - pub start_epoch: ::core::option::Option, - #[prost(uint32, tag = "2")] - pub count: u32, - #[prost(bool, tag = "3")] - pub ascending: bool, - #[prost(bool, tag = "4")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetEpochsInfoRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEpochsInfoResponse { - #[prost(oneof = "get_epochs_info_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetEpochsInfoResponse`. -pub mod get_epochs_info_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetEpochsInfoResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_epochs_info_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetEpochsInfoResponseV0`. - pub mod get_epochs_info_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct EpochInfos { - #[prost(message, repeated, tag = "1")] - pub epoch_infos: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct EpochInfo { - #[prost(uint32, tag = "1")] - pub number: u32, - #[prost(uint64, tag = "2")] - pub first_block_height: u64, - #[prost(uint32, tag = "3")] - pub first_core_block_height: u32, - #[prost(uint64, tag = "4")] - pub start_time: u64, - #[prost(double, tag = "5")] - pub fee_multiplier: f64, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Epochs(EpochInfos), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetEpochsInfoResponseV0), - } -} -/// Generated client implementations. -pub mod platform_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - #[derive(Debug, Clone)] - pub struct PlatformClient { - inner: tonic::client::Grpc, - } - impl PlatformClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl PlatformClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> PlatformClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - PlatformClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - pub async fn broadcast_state_transition( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/broadcastStateTransition", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "broadcastStateTransition", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentity", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Platform", "getIdentity"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identities( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentities", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentities", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_keys( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityKeys", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityKeys", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_balance( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityBalance", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityBalance", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_balance_and_revision( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityBalanceAndRevision", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityBalanceAndRevision", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_proofs( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getProofs", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Platform", "getProofs"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_data_contract( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDataContract", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getDataContract", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_data_contract_history( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDataContractHistory", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getDataContractHistory", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_data_contracts( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDataContracts", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getDataContracts", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_documents( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDocuments", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Platform", "getDocuments"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identities_by_public_key_hashes( - &mut self, - request: impl tonic::IntoRequest< - super::GetIdentitiesByPublicKeyHashesRequest, - >, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentitiesByPublicKeyHashes", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_by_public_key_hash( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityByPublicKeyHash", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityByPublicKeyHash", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn wait_for_state_transition_result( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/waitForStateTransitionResult", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "waitForStateTransitionResult", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_consensus_params( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getConsensusParams", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getConsensusParams", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_protocol_version_upgrade_state( - &mut self, - request: impl tonic::IntoRequest< - super::GetProtocolVersionUpgradeStateRequest, - >, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getProtocolVersionUpgradeState", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getProtocolVersionUpgradeState", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_protocol_version_upgrade_vote_status( - &mut self, - request: impl tonic::IntoRequest< - super::GetProtocolVersionUpgradeVoteStatusRequest, - >, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getProtocolVersionUpgradeVoteStatus", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getProtocolVersionUpgradeVoteStatus", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_epochs_info( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getEpochsInfo", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getEpochsInfo", - ), - ); - self.inner.unary(req, path, codec).await - } - } -} diff --git a/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js b/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js index 7710a63e2c2..3ee9ce6e2a9 100644 --- a/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js +++ b/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js @@ -11,7 +11,8 @@ describe('CorePromiseClient', () => { corePromiseClient = new CorePromiseClient('https://localhost/'); corePromiseClient.client = { - getStatus: this.sinon.stub().resolves(response), + getBlockchainStatus: this.sinon.stub().resolves(response), + getMasternodeStatus: this.sinon.stub().resolves(response), getBlock: this.sinon.stub().resolves(response), broadcastTransaction: this.sinon.stub().resolves(response), getTransaction: this.sinon.stub().resolves(response), @@ -20,17 +21,37 @@ describe('CorePromiseClient', () => { }; }); - describe('#getStatus', () => { - it('should return status', async () => { - const result = await corePromiseClient.getStatus(request); + describe('#getBlockchainStatus', () => { + it('should return core chain status', async () => { + const result = await corePromiseClient.getBlockchainStatus(request); + + expect(result).to.equal(response); + expect(corePromiseClient.client.getBlockchainStatus).to.be.calledOnceWith(request); + }); + + it('should throw an error when metadata is not an object', async () => { + try { + corePromiseClient.getBlockchainStatus({}, 'metadata'); + + expect.fail('Error was not thrown'); + } catch (e) { + expect(e.message).to.equal('metadata must be an object'); + } + }); + }); + + describe('#getMasternodeStatus', () => { + it('should return masternode status', async () => { + const result = await corePromiseClient.getMasternodeStatus(request); expect(result).to.equal(response); - expect(corePromiseClient.client.getStatus).to.be.calledOnceWith(request); + expect(corePromiseClient.client.getMasternodeStatus) + .to.be.calledOnceWith(request); }); it('should throw an error when metadata is not an object', async () => { try { - corePromiseClient.getStatus({}, 'metadata'); + corePromiseClient.getMasternodeStatus({}, 'metadata'); expect.fail('Error was not thrown'); } catch (e) { diff --git a/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js b/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js index 084d444b510..5987cbfd0f4 100644 --- a/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +++ b/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js @@ -13,11 +13,15 @@ describe('PlatformPromiseClient', () => { platformPromiseClient.client = { broadcastStateTransition: this.sinon.stub().resolves(response), getIdentity: this.sinon.stub().resolves(response), + getIdentitiesContractKeys: this.sinon.stub().resolves(response), getDataContract: this.sinon.stub().resolves(response), getDocuments: this.sinon.stub().resolves(response), getEpochsInfo: this.sinon.stub().resolves(response), getProtocolVersionUpgradeVoteStatus: this.sinon.stub().resolves(response), getProtocolVersionUpgradeState: this.sinon.stub().resolves(response), + getIdentityContractNonce: this.sinon.stub().resolves(response), + getIdentityNonce: this.sinon.stub().resolves(response), + getIdentityKeys: this.sinon.stub().resolves(response), }; }); @@ -60,6 +64,26 @@ describe('PlatformPromiseClient', () => { }); }); + describe('#getIdentitiesContractKeys', () => { + it('should get identities', async () => { + const result = await platformPromiseClient.getIdentitiesContractKeys(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentitiesContractKeys) + .to.be.calledOnceWith(request); + }); + + it('should throw an error when metadata is not an object', async () => { + try { + platformPromiseClient.getIdentitiesContractKeys({}, 'metadata'); + + expect.fail('Error was not thrown'); + } catch (e) { + expect(e.message).to.equal('metadata must be an object'); + } + }); + }); + describe('#getDataContract', () => { it('should get data contract', async () => { const result = await platformPromiseClient.getDataContract(request); @@ -98,7 +122,7 @@ describe('PlatformPromiseClient', () => { }); describe('#getProtocolVersionUpgradeVoteStatus', () => { - it('should get version upgrade vote status', async () => { + it('should get version upgrade votes status', async () => { const result = await platformPromiseClient.getProtocolVersionUpgradeVoteStatus(request); expect(result).to.equal(response); @@ -116,4 +140,34 @@ describe('PlatformPromiseClient', () => { .to.be.calledOnceWith(request); }); }); + + describe('#getIdentityContractNonce', () => { + it('should get identity contract nonce', async () => { + const result = await platformPromiseClient.getIdentityContractNonce(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentityContractNonce) + .to.be.calledOnceWith(request); + }); + }); + + describe('#getIdentityNonce', () => { + it('should get identity nonce', async () => { + const result = await platformPromiseClient.getIdentityNonce(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentityNonce) + .to.be.calledOnceWith(request); + }); + }); + + describe('#getIdentityKeys', () => { + it('should get identity keys', async () => { + const result = await platformPromiseClient.getIdentityKeys(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentityKeys) + .to.be.calledOnceWith(request); + }); + }); }); diff --git a/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js b/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js index d0dbdc78e09..c40fc73d4c9 100644 --- a/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js +++ b/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js @@ -14,8 +14,11 @@ describe('getCoreDefinition', () => { expect(coreDefinition.service).to.have.property('getTransaction'); expect(coreDefinition.service.getTransaction.path).to.equal('/org.dash.platform.dapi.v0.Core/getTransaction'); - expect(coreDefinition.service).to.have.property('getStatus'); - expect(coreDefinition.service.getStatus.path).to.equal('/org.dash.platform.dapi.v0.Core/getStatus'); + expect(coreDefinition.service).to.have.property('getBlockchainStatus'); + expect(coreDefinition.service.getBlockchainStatus.path).to.equal('/org.dash.platform.dapi.v0.Core/getBlockchainStatus'); + + expect(coreDefinition.service).to.have.property('getMasternodeStatus'); + expect(coreDefinition.service.getMasternodeStatus.path).to.equal('/org.dash.platform.dapi.v0.Core/getMasternodeStatus'); expect(coreDefinition.service).to.have.property('getBlock'); expect(coreDefinition.service.getBlock.path).to.equal('/org.dash.platform.dapi.v0.Core/getBlock'); diff --git a/packages/dapi/.env.example b/packages/dapi/.env.example index be5c19be43c..3f99bcdc9f6 100644 --- a/packages/dapi/.env.example +++ b/packages/dapi/.env.example @@ -20,9 +20,6 @@ DASHCORE_RPC_HOST=127.0.0.1 DASHCORE_RPC_PORT=30002 DASHCORE_ZMQ_HOST=127.0.0.1 DASHCORE_ZMQ_PORT=30003 -DASHCORE_P2P_HOST=127.0.0.1 -DASHCORE_P2P_PORT=30001 -DASHCORE_P2P_NETWORK=testnet # Can be `testnet`, `regtest` and `livenet` NETWORK=testnet @@ -35,6 +32,9 @@ BLOCK_HEADERS_CACHE_SIZE=500 TENDERMINT_RPC_HOST=localhost TENDERMINT_RPC_PORT=26657 +DRIVE_RPC_HOST=localhost +DRIVE_RPC_PORT=26670 + # SERVICE_IMAGE_DRIVE= # Drive image name, if omitted dashpay/dashrive is used # SERVICE_IMAGE_DAPI= # DAPI image name, if omitted dashpay/dapi is used # SERVICE_IMAGE_CORE= # Dash Core image name, if omitted dashpay/dashcore is used @@ -42,3 +42,5 @@ TENDERMINT_RPC_PORT=26657 NODE_ENV=production LOG_LEVEL=trace + +WAIT_FOR_ST_RESULT_TIMEOUT=80000 diff --git a/packages/dapi/.eslintrc b/packages/dapi/.eslintrc index 7777fe3afec..7eb94b2144b 100644 --- a/packages/dapi/.eslintrc +++ b/packages/dapi/.eslintrc @@ -1,10 +1,22 @@ { "extends": "airbnb-base", + "parserOptions": { + // Required for certain syntax usages + "ecmaVersion": 2022, + "requireConfigFile": false + }, + "parser": "@babel/eslint-parser", "env": { "node": true }, "rules": { "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "no-continue": "off", + "class-methods-use-this": "off", "no-await-in-loop": "off", "no-restricted-syntax": [ "error", @@ -16,6 +28,10 @@ "selector": "WithStatement", "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize." } + ], + "curly": [ + "error", + "all" ] } } diff --git a/packages/dapi/doc/REFERENCE.md b/packages/dapi/doc/REFERENCE.md index c3411afc8aa..fb814322ffa 100644 --- a/packages/dapi/doc/REFERENCE.md +++ b/packages/dapi/doc/REFERENCE.md @@ -9,41 +9,34 @@ - [generate](#generate) - [getBestBlockHash](#getbestblockhash) - [getBlockHash](#getblockhash) - - [getMnListDiff](#getmnlistdiff) ## Layer 1 endpoints -### generate - -Note: regtest only - -Generates blocks on demand for regression tests. +### getBestBlockHash -##### Params +Returns best block hash (hash of the chaintip) -| name | type | description | -|---------|--------|----------------------------------------| -| args.amount | number | Amount of blocks to generate | +*takes no arguments* ##### Response -| name | type | description | -|--------------|------------------------|------------------------------------------------------------| -| blockHashes | promise (string array) | Returns a promise containing strings of block hashes | +| name | type | description | +|--------------|------------------|----------------------------------------| +| blockHash | promise (string) | hash of chaintip | --- -### getBestBlockHash +### getBestBlockHeight -Returns best block hash (hash of the chaintip) +Returns best block height (height of the chaintip) *takes no arguments* ##### Response -| name | type | description | -|--------------|------------------|----------------------------------------| -| blockHash | promise (string) | hash of chaintip | +| name | type | description | +|--------|------------------|--------------------| +| height | promise (string) | height of chaintip | --- @@ -62,21 +55,3 @@ Returns block hash for a given height. | name | type | description | |------------|------------------|---------------------------------------------| | blockHash | promise (string) | promise containing a string of a block hash | - ---- - -### getMnListDiff - -*needs definition* - -##### Params - -| name | type | description | -|---------|--------|----------------------------------------| -| packet | string | ST Packet object serialized using CBOR | - -##### Response - -| name | type | description | -|---------|--------|----------------------------------------| -| packet | string | ST Packet object serialized using CBOR | diff --git a/packages/dapi/lib/MasternodeListSync.js b/packages/dapi/lib/MasternodeListSync.js new file mode 100644 index 00000000000..1793c42c5e4 --- /dev/null +++ b/packages/dapi/lib/MasternodeListSync.js @@ -0,0 +1,191 @@ +const EventEmitter = require('events'); +const cbor = require('cbor'); +const logger = require('./logger'); + +const NULL_HASH = '0000000000000000000000000000000000000000000000000000000000000000'; + +/** + * @param {ChainLock} chainLock + * @return {string} + */ +function chainLockToBlockHashHex(chainLock) { + return chainLock.blockHash.toString('hex'); +} + +class MasternodeListSync extends EventEmitter { + /** + * @type {Buffer} + */ + fullDiffBuffer; + + /** + * @type {number} + */ + blockHeight = 0; + + /** + * @type {string} + */ + blockHash; + + /** + * @type {CoreRpcClient} + */ + coreRpc; + + /** + * @type {ChainDataProvider} + */ + chainDataProvider; + + /** + * @type {string} + */ + network; + + /** + * @param {CoreRpcClient} coreRpc + * @param {ChainDataProvider} chainDataProvider + * @param {string} network + */ + constructor(coreRpc, chainDataProvider, network) { + super(); + + this.coreRpc = coreRpc; + this.chainDataProvider = chainDataProvider; + this.network = network; + this.logger = logger.child({ + service: 'MasternodeListSync', + }); + + this.setMaxListeners(1000); + } + + /** + * @param {string} blockHash + * @param {number} blockHeight + * @return {Promise} + */ + async sync(blockHash, blockHeight) { + const fullDiffObject = await this.coreRpc.getMnListDiff(NULL_HASH, blockHash); + + const previousBlockHash = this.blockHash; + const previousBlockHeight = this.blockHeight; + + // TODO: We can't use dashcore-lib SimplifiedMNListDiff toBuffer method, because due to SML + // design it's impossible to deserialize it back without knowing of the protocol version. + // In future, we want to switch to Rust implementation of SML so we don't want to spend + // time on fixing this issue in JS dashcore-lib + this.fullDiffBuffer = await cbor.encodeAsync(fullDiffObject); + this.blockHeight = blockHeight; + this.blockHash = blockHash; + + this.logger.debug( + { + blockHash, + blockHeight, + network: this.network, + }, + `Full masternode list updated to block ${blockHeight}`, + ); + + if (previousBlockHash) { + const diffObject = await this.coreRpc.getMnListDiff(previousBlockHash, blockHash); + + // TODO: We can't use dashcore-lib SimplifiedMNListDiff toBuffer method, because due to SML + // design it's impossible to deserialize it back without knowing of the protocol version. + // In future, we want to switch to Rust implementation of SML so we don't want to spend + // time on fixing this issue in JS dashcore-lib + const diffBuffer = await cbor.encodeAsync(diffObject); + + this.logger.debug({ + previousBlockHash, + blockHash, + previousBlockHeight, + blockHeight, + network: this.network, + }, `New diff from block ${previousBlockHeight} to ${blockHeight} received`); + + this.emit(MasternodeListSync.EVENT_DIFF, diffBuffer, blockHeight, blockHash); + } + + this.blockHash = blockHash; + } + + /** + * @return {Promise} + */ + async init() { + // Init makes sure, that we have full diff, so we need to use the existing best chain lock + // or wait for the first one + + let resolved = false; + + return new Promise((resolve, reject) => { + const bestChainLock = this.chainDataProvider.getBestChainLock(); + + this.chainDataProvider.on(this.chainDataProvider.events.NEW_CHAIN_LOCK, (chainLock) => { + const blockHash = chainLockToBlockHashHex(chainLock); + + this.sync(blockHash, chainLock.height).then(() => { + // Resolve the promise when chain lock is arrive we don't have any yet + if (!bestChainLock && !resolved) { + resolve(); + resolved = true; + } + }).catch((error) => { + this.logger.error({ err: error }, `Failed to sync masternode list: ${error.message}`); + + if (!resolved) { + reject(error); + resolved = true; + } + }); + }); + + if (bestChainLock) { + const bestBlockHash = chainLockToBlockHashHex(bestChainLock); + + // Resolve promise when we have the best chain lock + this.sync(bestBlockHash, bestChainLock.height).then(() => { + if (!resolved) { + resolve(); + resolved = true; + } + }).catch((error) => { + this.logger.error({ err: error }, `Failed to sync masternode list: ${error.message}`); + + if (!resolved) { + reject(error); + resolved = true; + } + }); + } + }); + } + + /** + * @return {Buffer} + */ + getFullDiffBuffer() { + return this.fullDiffBuffer; + } + + /** + * @return {number} + */ + getBlockHeight() { + return this.blockHeight; + } + + /** + * @return {string} + */ + getBlockHash() { + return this.blockHash; + } +} + +MasternodeListSync.EVENT_DIFF = 'diff'; + +module.exports = MasternodeListSync; diff --git a/packages/dapi/lib/chainDataProvider/ChainDataProvider.js b/packages/dapi/lib/chainDataProvider/ChainDataProvider.js index d4336622f43..fa83155239b 100644 --- a/packages/dapi/lib/chainDataProvider/ChainDataProvider.js +++ b/packages/dapi/lib/chainDataProvider/ChainDataProvider.js @@ -11,9 +11,9 @@ const REORG_SAFE_DEPTH = 6; class ChainDataProvider extends EventEmitter { /** * - * @param coreRpcClient {CoreRpcClient} - * @param zmqClient {ZmqClient} - * @param blockHeadersCache {BlockHeadersCache} + * @param {CoreRpcClient} coreRpcClient + * @param {ZmqClient} zmqClient + * @param {BlockHeadersCache} blockHeadersCache */ constructor(coreRpcClient, zmqClient, blockHeadersCache) { super(); @@ -23,7 +23,7 @@ class ChainDataProvider extends EventEmitter { this.blockHeadersCache = blockHeadersCache; this.chainLock = null; - this.chainHeight = -1; + this.chainHeight = 0; } /** @@ -52,7 +52,7 @@ class ChainDataProvider extends EventEmitter { } /** - * + * @private * @param {Buffer} rawChainLockSigBuffer */ rawChainLockSigHandler(rawChainLockSigBuffer) { @@ -216,6 +216,15 @@ class ChainDataProvider extends EventEmitter { getBestChainLock() { return this.chainLock; } + + /** + * Return chain height + * + * @return {number} + */ + getChainHeight() { + return this.chainHeight; + } } ChainDataProvider.REORG_SAFE_DEPTH = REORG_SAFE_DEPTH; diff --git a/packages/dapi/lib/config/index.js b/packages/dapi/lib/config/index.js index 2bbf4945fa7..507b9f2ed2f 100644 --- a/packages/dapi/lib/config/index.js +++ b/packages/dapi/lib/config/index.js @@ -92,6 +92,10 @@ module.exports = { host: config[OPTIONS.TENDERMINT_RPC_HOST], port: parseInt(config[OPTIONS.TENDERMINT_RPC_PORT], 10), }, + driveRpc: { + host: config[OPTIONS.DRIVE_RPC_HOST], + port: parseInt(config[OPTIONS.DRIVE_RPC_PORT], 10), + }, blockHeaders: { cache: { maxSize: Number(config[OPTIONS.BLOCK_HEADERS_CACHE_SIZE]), diff --git a/packages/dapi/lib/config/validator.js b/packages/dapi/lib/config/validator.js index e35a8d7cb24..68554f2bf1b 100644 --- a/packages/dapi/lib/config/validator.js +++ b/packages/dapi/lib/config/validator.js @@ -38,8 +38,6 @@ function validatePort(port, parameterName) { */ function validateConfig(config) { const validationResults = []; - validationResults.push(validateHost(config.dashcore.p2p.host, 'DASHCORE_P2P_HOST')); - validationResults.push(validatePort(config.dashcore.p2p.port, 'DASHCORE_P2P_PORT')); validationResults.push(validateHost(config.dashcore.rpc.host, 'DASHCORE_RPC_HOST')); validationResults.push(validatePort(config.dashcore.rpc.port, 'DASHCORE_RPC_PORT')); validationResults.push(validateHost(config.dashcore.zmq.host, 'DASHCORE_ZMQ_HOST')); diff --git a/packages/dapi/lib/externalApis/dashcore/rpc.js b/packages/dapi/lib/externalApis/dashcore/rpc.js index d0c59c326b9..a0ba7722bdc 100644 --- a/packages/dapi/lib/externalApis/dashcore/rpc.js +++ b/packages/dapi/lib/externalApis/dashcore/rpc.js @@ -1,4 +1,5 @@ const RpcClient = require('@dashevo/dashd-rpc'); +const lodash = require('lodash'); const DashCoreRpcError = require('../../errors/DashCoreRpcError'); const constants = require('./constants'); const config = require('../../config'); @@ -169,6 +170,22 @@ const getRawTransaction = (txid, verboseMode = 0) => new Promise((resolve, rejec }); }); +const getRawTransactionMulti = async (txids, verboseMode = 0) => { + const promises = lodash.chunk(txids, 100) + .map((chunk) => new Promise((resolve, reject) => { + client.getRawTransactionMulti({ 0: chunk }, verboseMode, (err, r) => { + if (err) { + reject(new DashCoreRpcError(err.message, null, err.code)); + } else { + resolve(r.result); + } + }); + })); + + return (await Promise.all(promises)) + .reduce((accumulator, object) => ({ ...accumulator, ...object }), {}); +}; + const getRawBlock = (blockhash) => getBlock(blockhash, false); // This is only for in-wallet transaction @@ -357,6 +374,7 @@ module.exports = { sendRawTransaction, sendRawIxTransaction, getRawTransaction, + getRawTransactionMulti, getRawBlock, getTransaction, getTransactionFirstInputAddress, diff --git a/packages/dapi/lib/externalApis/drive/DriveClient.js b/packages/dapi/lib/externalApis/drive/DriveClient.js deleted file mode 100644 index 3c1de0dfede..00000000000 --- a/packages/dapi/lib/externalApis/drive/DriveClient.js +++ /dev/null @@ -1,259 +0,0 @@ -const jayson = require('jayson/promise'); - -const RPCError = require('../../rpcServer/RPCError'); -const createGrpcErrorFromDriveResponse = require('../../grpcServer/handlers/createGrpcErrorFromDriveResponse'); - -class DriveClient { - /** - * @param options - * @param {string} options.host - * @param {number} options.port - */ - constructor({ host, port }) { - this.client = jayson.client.http({ host, port }); - } - - /** - * Makes request to Drive and handle response - * - * @param {string} path - * @param {Uint8Array} data - * - * @return {Promise} - */ - async request(path, data) { - const requestOptions = { - path, - data: Buffer.from(data).toString('hex'), - }; - - const { result, error } = await this.client.request( - 'abci_query', - requestOptions, - ); - - // Handle JSON RPC error - if (error) { - throw new RPCError(error.code || -32602, error.message || 'Internal error', error.data); - } - - // Check and handle ABCI errors - const { response } = result; - - if (response.code === undefined || response.code === 0) { - // no errors found return the serialized response value - return Buffer.from(response.value, 'base64'); - } - - throw await createGrpcErrorFromDriveResponse(response.code, response.info); - } - - /** - * Fetch serialized data contract - * - * @param {GetDataContractRequest} request - * - * @return {Promise} - */ - async fetchDataContract(request) { - return this.request( - '/dataContract', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized data contracts - * - * @param {GetDataContractsRequest} request - * - * @return {Promise} - */ - async fetchDataContracts(request) { - return this.request( - '/dataContracts', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized data contract - * - * @param {GetDataContractHistoryRequest} request - * - * @return {Promise} - */ - async fetchDataContractHistory(request) { - return this.request( - '/dataContractHistory', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized documents - * - * @param {GetDocumentsRequest} request - * - * @return {Promise} - */ - async fetchDocuments(request) { - return this.request( - '/dataContract/documents', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity - * - * @param {GetIdentityRequest} request - * - * @return {Promise} - */ - async fetchIdentity(request) { - return this.request( - '/identity', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identities - * - * @param {GetIdentitiesRequest} request - * - * @return {Promise} - */ - async fetchIdentities(request) { - return this.request( - '/identities', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity balance - * - * @param {GetIdentityBalanceRequest} request - * - * @return {Promise} - */ - async fetchIdentityBalance(request) { - return this.request( - '/identity/balance', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity balance and revision - * - * @param {GetIdentityBalanceAndRevisionRequest} request - * - * @return {Promise} - */ - async fetchIdentityBalanceAndRevision(request) { - return this.request( - '/identity/balanceAndRevision', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity keys - * - * @param {GetIdentityKeysRequest} request - * - * @return {Promise} - */ - async fetchIdentityKeys(request) { - return this.request( - '/identity/keys', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity by its public key hash - * - * @param {GetIdentityByPublicKeyHashRequest} request - * - * @return {Promise} - */ - async fetchIdentityByPublicKeyHash(request) { - return this.request( - '/identity/by-public-key-hash', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identities by its public key hashes - * - * @param {GetIdentitiesByPublicKeyHashesRequest} request - * - * @return {Promise} - */ - async fetchIdentitiesByPublicKeyHashes(request) { - return this.request( - '/identities/by-public-key-hash', - request.serializeBinary(), - ); - } - - /** - * Fetch proofs by ids - * - * @param {GetProofsRequest} request - - * @return {Promise<{data: Buffer}>} - */ - async fetchProofs(request) { - return this.request( - '/proofs', - request.serializeBinary(), - ); - } - - /** - * Fetch epoch infos - * - * @param {GetEpochsInfoRequest} request - * @return {Promise} - */ - async fetchEpochsInfo(request) { - return this.request( - '/epochInfos', - request.serializeBinary(), - ); - } - - /** - * Fetch version upgrade vote status - * - * @param {GetProtocolVersionUpgradeVoteStatusRequest} request - * @return {Promise} - */ - async fetchVersionUpgradeVoteStatus(request) { - return this.request( - '/versionUpgrade/voteStatus', - request.serializeBinary(), - ); - } - - /** - * Fetch version upgrade state - * - * @param {GetProtocolVersionUpgradeStateRequest} request - * @return {Promise} - */ - async fetchVersionUpgradeState(request) { - return this.request( - '/versionUpgrade/state', - request.serializeBinary(), - ); - } -} - -module.exports = DriveClient; diff --git a/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js b/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js index 2153807a4e6..0d50ddd67a7 100644 --- a/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js +++ b/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js @@ -1,13 +1,12 @@ const { v0: { GetProofsRequest, - GetProofsResponse, }, } = require('@dashevo/dapi-grpc'); const { StateTransitionTypes } = require('@dashevo/wasm-dpp'); /** - * @param {DriveClient} driveClient + * @param {PlatformPromiseClient} driveClient * @return {fetchProofForStateTransition} */ function fetchProofForStateTransitionFactory(driveClient) { @@ -17,12 +16,12 @@ function fetchProofForStateTransitionFactory(driveClient) { * @return {Promise} */ async function fetchProofForStateTransition(stateTransition) { - const getProofsRequest = new GetProofsRequest(); - const modifiedIds = stateTransition.getModifiedDataIds(); const { GetProofsRequestV0 } = GetProofsRequest; + const requestV0 = new GetProofsRequestV0(); + if (stateTransition.isDocumentStateTransition()) { const { DocumentRequest } = GetProofsRequestV0; @@ -31,24 +30,48 @@ function fetchProofForStateTransitionFactory(driveClient) { documentRequest.setContractId(documentTransition.getDataContractId().toBuffer()); documentRequest.setDocumentType(documentTransition.getType()); documentRequest.setDocumentId(documentTransition.getId().toBuffer()); + + const status = documentTransition.hasPrefundedBalance() + ? DocumentRequest.DocumentContestedStatus.CONTESTED + : DocumentRequest.DocumentContestedStatus.NOT_CONTESTED; + + documentRequest.setDocumentContestedStatus(status); + return documentRequest; }); - getProofsRequest.setV0(new GetProofsRequestV0().setDocumentsList(documentsList)); + requestV0.setDocumentsList(documentsList); } if (stateTransition.isIdentityStateTransition()) { const { IdentityRequest } = GetProofsRequestV0; - const identitiesList = modifiedIds.map((id) => { - const identityRequest = new IdentityRequest(); - identityRequest.setIdentityId(id.toBuffer()); - identityRequest.setRequestType( - stateTransition.getType() === StateTransitionTypes.IdentityCreditTransfer - ? IdentityRequest.Type.BALANCE : IdentityRequest.Type.FULL_IDENTITY, - ); - return identityRequest; + const identitiesList = modifiedIds.flatMap((id) => { + const stType = stateTransition.getType(); + let proofRequests; + + if (stType === StateTransitionTypes.IdentityCreditTransfer) { + proofRequests = new IdentityRequest(); + proofRequests.setIdentityId(id.toBuffer()); + proofRequests.setRequestType(IdentityRequest.Type.BALANCE); + } else if (stType === StateTransitionTypes.IdentityTopUp) { + const proofRequestsBalance = new IdentityRequest(); + proofRequestsBalance.setIdentityId(id.toBuffer()); + proofRequestsBalance.setRequestType(IdentityRequest.Type.BALANCE); + + const proofRequestsRevision = new IdentityRequest(); + proofRequestsRevision.setIdentityId(id.toBuffer()); + proofRequestsRevision.setRequestType(IdentityRequest.Type.REVISION); + + proofRequests = [proofRequestsBalance, proofRequestsRevision]; + } else { + proofRequests = new IdentityRequest(); + proofRequests.setIdentityId(id.toBuffer()); + proofRequests.setRequestType(IdentityRequest.Type.FULL_IDENTITY); + } + + return proofRequests; }); - getProofsRequest.setV0(new GetProofsRequestV0().setIdentitiesList(identitiesList)); + requestV0.setIdentitiesList(identitiesList); } if (stateTransition.isDataContractStateTransition()) { const { ContractRequest } = GetProofsRequestV0; @@ -58,12 +81,37 @@ function fetchProofForStateTransitionFactory(driveClient) { return identityRequest; }); - getProofsRequest.setV0(new GetProofsRequestV0() - .setContractsList(contractsList)); + requestV0.setContractsList(contractsList); + } if (stateTransition.isVotingStateTransition()) { + const { VoteStatusRequest } = GetProofsRequestV0; + const { ContestedResourceVoteStatusRequest } = VoteStatusRequest; + + const contestedResourceVoteStatusRequest = new ContestedResourceVoteStatusRequest(); + + const contestedVotePoll = stateTransition.getContestedDocumentResourceVotePoll(); + + if (!contestedVotePoll) { + throw new Error('Masternode vote state transition should have a contested vote poll'); + } + + contestedResourceVoteStatusRequest.setContractId(contestedVotePoll.contractId.toBuffer()); + contestedResourceVoteStatusRequest.setDocumentTypeName(contestedVotePoll.documentTypeName); + contestedResourceVoteStatusRequest.setIndexName(contestedVotePoll.indexName); + contestedResourceVoteStatusRequest.setIndexValuesList(contestedVotePoll.indexValues); + contestedResourceVoteStatusRequest.setVoterIdentifier( + stateTransition.getProTxHash().toBuffer(), + ); + + const voteStatus = new VoteStatusRequest(); + voteStatus.setContestedResourceVoteStatusRequest(contestedResourceVoteStatusRequest); + + requestV0.setVotesList([voteStatus]); } - const responseBytes = await driveClient.fetchProofs(getProofsRequest); - return GetProofsResponse.deserializeBinary(responseBytes); + const request = new GetProofsRequest(); + request.setV0(requestV0); + + return driveClient.getProofs(request); } return fetchProofForStateTransition; diff --git a/packages/dapi/lib/externalApis/tenderdash/WsClient.js b/packages/dapi/lib/externalApis/tenderdash/WsClient.js index 1bf9e260bc5..f886483bf26 100644 --- a/packages/dapi/lib/externalApis/tenderdash/WsClient.js +++ b/packages/dapi/lib/externalApis/tenderdash/WsClient.js @@ -43,6 +43,11 @@ class WsClient extends EventEmitter { this.emit(event.type, event); + this.ws.removeAllListeners(); + this.ws.terminate(); + this.ws = null; + this.isConnected = false; + setTimeout(this.open.bind(this), this.autoReconnectInterval); } else { const event = { @@ -82,12 +87,6 @@ class WsClient extends EventEmitter { this.emit(event.type, event); - if (e.code === 1000) { // close normal - this.disconnect(); - - return; - } - reconnect(); }; @@ -100,16 +99,7 @@ class WsClient extends EventEmitter { this.emit(event.type, event); - switch (e.code) { - case 'ENOTFOUND': - case 'EAI_AGAIN': - case 'ECONNREFUSED': - reconnect(); - break; - default: - this.disconnect(); - break; - } + reconnect(); }; const onMessageListener = (rawData) => { diff --git a/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js index f952c4deb17..08449dbaa9d 100644 --- a/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js @@ -121,7 +121,7 @@ function subscribeToBlockHeadersWithChainLocksHandlerFactory( throw e; } - const bestBlockHeight = await coreAPI.getBestBlockHeight(); + const bestBlockHeight = chainDataProvider.getChainHeight(); const historicalCount = count === 0 ? bestBlockHeight - fromBlock.height + 1 : count; diff --git a/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js b/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js index b2a597a7534..e9a780d0981 100644 --- a/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js @@ -17,29 +17,41 @@ const { v0: { BroadcastTransactionRequest, GetTransactionRequest, - GetStatusRequest, - GetBlockRequest, + GetBlockchainStatusRequest, + // GetMasternodeStatusRequest, + // GetBlockRequest, + GetBestBlockHeightRequest, pbjs: { BroadcastTransactionRequest: PBJSBroadcastTransactionRequest, BroadcastTransactionResponse: PBJSBroadcastTransactionResponse, GetTransactionRequest: PBJSGetTransactionRequest, GetTransactionResponse: PBJSGetTransactionResponse, - GetStatusRequest: PBJSGetStatusRequest, - GetStatusResponse: PBJSGetStatusResponse, - GetBlockRequest: PBJSGetBlockRequest, - GetBlockResponse: PBJSGetBlockResponse, + GetBlockchainStatusRequest: PBJSGetBlockchainStatusRequest, + GetBlockchainStatusResponse: PBJSGetBlockchainStatusResponse, + // GetMasternodeStatusRequest: PBJSGetMasternodeStatusRequest, + // GetMasternodeStatusResponse: PBJSGetMasternodeStatusResponse, + // GetBlockRequest: PBJSGetBlockRequest, + // GetBlockResponse: PBJSGetBlockResponse, + GetBestBlockHeightRequest: PBJSGetBestBlockHeightRequest, + GetBestBlockHeightResponse: PBJSGetBestBlockHeightResponse, }, }, } = require('@dashevo/dapi-grpc'); const logger = require('../../../logger'); -const getBlockHandlerFactory = require( - './getBlockHandlerFactory', +// const getBlockHandlerFactory = require( +// './getBlockHandlerFactory', +// ); +const getBestBlockHeightHandlerFactory = require( + './getBestBlockHeightHandlerFactory', ); -const getStatusHandlerFactory = require( - './getStatusHandlerFactory', +const getBlockchainStatusHandlerFactory = require( + './getBlockchainStatusHandlerFactory', ); +// const getMasternodeStatusHandlerFactory = require( +// './getMasternodeStatusHandlerFactory', +// ); const getTransactionHandlerFactory = require( './getTransactionHandlerFactory', ); @@ -50,37 +62,67 @@ const broadcastTransactionHandlerFactory = require( /** * @param {CoreRpcClient} coreRPCClient * @param {boolean} isProductionEnvironment + * @param {ZmqClient} coreZmqClient * @returns {Object} */ -function coreHandlersFactory(coreRPCClient, isProductionEnvironment) { +function coreHandlersFactory(coreRPCClient, isProductionEnvironment, coreZmqClient) { const wrapInErrorHandler = wrapInErrorHandlerFactory(logger, isProductionEnvironment); // getBlock - const getBlockHandler = getBlockHandlerFactory(coreRPCClient); - const wrappedGetBlock = jsonToProtobufHandlerWrapper( + // const getBlockHandler = getBlockHandlerFactory(coreRPCClient); + // const wrappedGetBlock = jsonToProtobufHandlerWrapper( + // jsonToProtobufFactory( + // GetBlockRequest, + // PBJSGetBlockRequest, + // ), + // protobufToJsonFactory( + // PBJSGetBlockResponse, + // ), + // wrapInErrorHandler(getBlockHandler), + // ); + + // getBestBlockHeight + const getBestBlockHeightHandler = getBestBlockHeightHandlerFactory(coreRPCClient, coreZmqClient); + const wrappedGetBestBlockHeightHandler = jsonToProtobufHandlerWrapper( jsonToProtobufFactory( - GetBlockRequest, - PBJSGetBlockRequest, + GetBestBlockHeightRequest, + PBJSGetBestBlockHeightRequest, ), protobufToJsonFactory( - PBJSGetBlockResponse, + PBJSGetBestBlockHeightResponse, ), - wrapInErrorHandler(getBlockHandler), + wrapInErrorHandler(getBestBlockHeightHandler), ); - // getStatus - const getStatusHandler = getStatusHandlerFactory(coreRPCClient); - const wrappedGetStatus = jsonToProtobufHandlerWrapper( + // getBlockchainStatus + const getBlockchainStatusHandler = getBlockchainStatusHandlerFactory( + coreRPCClient, + coreZmqClient, + ); + const wrappedGetBlockchainStatus = jsonToProtobufHandlerWrapper( jsonToProtobufFactory( - GetStatusRequest, - PBJSGetStatusRequest, + GetBlockchainStatusRequest, + PBJSGetBlockchainStatusRequest, ), protobufToJsonFactory( - PBJSGetStatusResponse, + PBJSGetBlockchainStatusResponse, ), - wrapInErrorHandler(getStatusHandler), + wrapInErrorHandler(getBlockchainStatusHandler), ); + // getMasternodeStatus + // const getMasternodeStatusHandler = getMasternodeStatusHandlerFactory(coreRPCClient); + // const wrappedGetMasternodeStatus = jsonToProtobufHandlerWrapper( + // jsonToProtobufFactory( + // GetMasternodeStatusRequest, + // PBJSGetMasternodeStatusRequest, + // ), + // protobufToJsonFactory( + // PBJSGetMasternodeStatusResponse, + // ), + // wrapInErrorHandler(getMasternodeStatusHandler), + // ); + // getTransaction const getTransactionHandler = getTransactionHandlerFactory(coreRPCClient); const wrappedGetTransaction = jsonToProtobufHandlerWrapper( @@ -108,8 +150,11 @@ function coreHandlersFactory(coreRPCClient, isProductionEnvironment) { ); return { - getBlock: wrappedGetBlock, - getStatus: wrappedGetStatus, + // TODO: Enable when an attack resistance is proved + // getBlock: wrappedGetBlock, + getBestBlockHeight: wrappedGetBestBlockHeightHandler, + getBlockchainStatus: wrappedGetBlockchainStatus, + // getMasternodeStatus: wrappedGetMasternodeStatus, getTransaction: wrappedGetTransaction, broadcastTransaction: wrappedBroadcastTransaction, }; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getBestBlockHeightHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getBestBlockHeightHandlerFactory.js new file mode 100644 index 00000000000..ba2e19a4f9f --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/getBestBlockHeightHandlerFactory.js @@ -0,0 +1,57 @@ +const { + v0: { + GetBestBlockHeightResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const logger = require('../../../logger'); + +/** + * @param {CoreRpcClient} coreRPCClient + * @param {ZmqClient} coreZmqClient + * @returns {getBestBlockHeightHandler} + */ +function getBestBlockHeightHandlerFactory(coreRPCClient, coreZmqClient) { + let height = null; + + // Reset height on a new block, so it will be obtained again on a user request + coreZmqClient.on( + coreZmqClient.topics.hashblock, + () => { + height = null; + + logger.trace({ endpoint: 'getBestBlockHeight' }, 'cleanup best block height cache'); + }, + ); + + /** + * @typedef getBestBlockHeightHandler + * @return {Promise} + */ + async function getBestBlockHeightHandler() { + if (height === null) { + const start = Date.now(); + + height = await coreRPCClient.getBestBlockHeight(); + + const elapsedTime = Date.now() - start; + + logger.trace({ + endpoint: 'getBestBlockHeight', + }, `cached best block height ${height}. took ${elapsedTime}ms`); + } + + logger.trace({ + endpoint: 'getBestBlockHeight', + }, `responded with cached best block height ${height}`); + + const response = new GetBestBlockHeightResponse(); + response.setHeight(height); + + return response; + } + + return getBestBlockHeightHandler; +} + +module.exports = getBestBlockHeightHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.js new file mode 100644 index 00000000000..b07955d77b0 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.js @@ -0,0 +1,90 @@ +const { + v0: { + GetBlockchainStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {CoreRpcClient} coreRPCClient + * @param {ZmqClient} coreZmqClient + * @returns {getBlockchainStatusHandler} + */ +function getBlockchainStatusHandlerFactory(coreRPCClient, coreZmqClient) { + let response = null; + + // Reset height on a new block, so it will be obtained again on a user request + coreZmqClient.on( + coreZmqClient.topics.hashblock, + () => { + response = null; + }, + ); + + /** + * @typedef getBlockchainStatusHandler + * @return {Promise} + */ + async function getBlockchainStatusHandler() { + if (response === null) { + const [ + blockchainInfoResponse, + networkInfoResponse, + ] = await Promise.all([ + coreRPCClient.getBlockchainInfo(), + coreRPCClient.getNetworkInfo(), + ]); + + response = new GetBlockchainStatusResponse(); + + const version = new GetBlockchainStatusResponse.Version(); + version.setProtocol(networkInfoResponse.protocolversion); + version.setSoftware(networkInfoResponse.version); + version.setAgent(networkInfoResponse.subversion); + + const time = new GetBlockchainStatusResponse.Time(); + time.setOffset(networkInfoResponse.timeoffset); + time.setMedian(blockchainInfoResponse.mediantime); + + const chain = new GetBlockchainStatusResponse.Chain(); + chain.setName(blockchainInfoResponse.chain); + chain.setBlocksCount(blockchainInfoResponse.blocks); + chain.setHeadersCount(blockchainInfoResponse.headers); + chain.setBestBlockHash(Buffer.from(blockchainInfoResponse.bestblockhash, 'hex')); + chain.setDifficulty(blockchainInfoResponse.difficulty); + chain.setChainWork(Buffer.from(blockchainInfoResponse.chainwork, 'hex')); + chain.setIsSynced(blockchainInfoResponse.verificationprogress === 1); + chain.setSyncProgress(blockchainInfoResponse.verificationprogress); + + const network = new GetBlockchainStatusResponse.Network(); + network.setPeersCount(networkInfoResponse.connections); + + const networkFee = new GetBlockchainStatusResponse.NetworkFee(); + networkFee.setRelay(networkInfoResponse.relayfee); + networkFee.setIncremental(networkInfoResponse.incrementalfee); + + network.setFee(networkFee); + + response.setVersion(version); + response.setTime(time); + response.setSyncProgress(blockchainInfoResponse.verificationprogress); + response.setChain(chain); + response.setNetwork(network); + + let status = GetBlockchainStatusResponse.Status.SYNCING; + if (blockchainInfoResponse.verificationprogress === 1) { + status = GetBlockchainStatusResponse.Status.READY; + } + + response.setStatus(status); + } + + // Set now to current time + response.getTime().setNow(Math.floor(Date.now() / 1000)); + + return response; + } + + return getBlockchainStatusHandler; +} + +module.exports = getBlockchainStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.js new file mode 100644 index 00000000000..abfc0782008 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.js @@ -0,0 +1,67 @@ +const { + v0: { + GetMasternodeStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {CoreRpcClient} coreRPCClient + * @returns {getMasternodeStatusHandler} + */ +function getMasternodeStatusHandlerFactory(coreRPCClient) { + /** + * @typedef getMasternodeStatusHandler + * @return {Promise} + */ + async function getMasternodeStatusHandler() { + const [ + mnSyncStatusResponse, + masternodeStatusResponse, + ] = await Promise.all([ + coreRPCClient.getMnSync('status'), + coreRPCClient.getMasternode('status'), + ]); + + const response = new GetMasternodeStatusResponse(); + + const masternodeStatus = GetMasternodeStatusResponse.Status[masternodeStatusResponse.state]; + + response.setStatus(masternodeStatus); + + if (masternodeStatusResponse.proTxHash) { + response.setProTxHash(Buffer.from(masternodeStatusResponse.proTxHash, 'hex')); + } + + if (masternodeStatusResponse.dmnState) { + response.setPosePenalty(masternodeStatusResponse.dmnState.PoSePenalty); + } + + response.setIsSynced(mnSyncStatusResponse.IsSynced); + + let syncProgress; + switch (mnSyncStatusResponse.AssetID) { + case 999: + syncProgress = 1; + break; + case 0: + syncProgress = 0; + break; + case 1: + syncProgress = 1 / 3; + break; + case 4: + syncProgress = 2 / 3; + break; + default: + syncProgress = 0; + } + + response.setSyncProgress(syncProgress); + + return response; + } + + return getMasternodeStatusHandler; +} + +module.exports = getMasternodeStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getStatusHandlerFactory.js deleted file mode 100644 index 3f76cfa63d8..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/core/getStatusHandlerFactory.js +++ /dev/null @@ -1,118 +0,0 @@ -const { - v0: { - GetStatusResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {CoreRpcClient} coreRPCClient - * @returns {getStatusHandler} - */ -function getStatusHandlerFactory(coreRPCClient) { - /** - * @typedef getStatusHandler - * @return {Promise} - */ - async function getStatusHandler() { - const [ - blockchainInfoResponse, - networkInfoResponse, - mnSyncStatusResponse, - masternodeStatusResponse, - ] = await Promise.all([ - coreRPCClient.getBlockchainInfo(), - coreRPCClient.getNetworkInfo(), - coreRPCClient.getMnSync('status'), - coreRPCClient.getMasternode('status'), - ]); - - const response = new GetStatusResponse(); - - const version = new GetStatusResponse.Version(); - version.setProtocol(networkInfoResponse.protocolversion); - version.setSoftware(networkInfoResponse.version); - version.setAgent(networkInfoResponse.subversion); - - const time = new GetStatusResponse.Time(); - time.setNow(Math.floor(Date.now() / 1000)); - time.setOffset(networkInfoResponse.timeoffset); - time.setMedian(blockchainInfoResponse.mediantime); - - const chain = new GetStatusResponse.Chain(); - chain.setName(blockchainInfoResponse.chain); - chain.setBlocksCount(blockchainInfoResponse.blocks); - chain.setHeadersCount(blockchainInfoResponse.headers); - chain.setBestBlockHash(Buffer.from(blockchainInfoResponse.bestblockhash, 'hex')); - chain.setDifficulty(blockchainInfoResponse.difficulty); - chain.setChainWork(Buffer.from(blockchainInfoResponse.chainwork, 'hex')); - chain.setIsSynced(mnSyncStatusResponse.IsBlockchainSynced); - chain.setSyncProgress(blockchainInfoResponse.verificationprogress); - - const masternode = new GetStatusResponse.Masternode(); - - const masternodeStatus = GetStatusResponse.Masternode.Status[masternodeStatusResponse.state]; - - masternode.setStatus(masternodeStatus); - - if (masternodeStatusResponse.proTxHash) { - masternode.setProTxHash(Buffer.from(masternodeStatusResponse.proTxHash, 'hex')); - } - - if (masternodeStatusResponse.dmnState) { - masternode.setPosePenalty(masternodeStatusResponse.dmnState.PoSePenalty); - } - - masternode.setIsSynced(mnSyncStatusResponse.IsSynced); - - let syncProgress; - switch (mnSyncStatusResponse.AssetID) { - case 999: - syncProgress = 1; - break; - case 0: - syncProgress = 0; - break; - case 1: - syncProgress = 1 / 3; - break; - case 4: - syncProgress = 2 / 3; - break; - default: - syncProgress = 0; - } - - masternode.setSyncProgress(syncProgress); - - const network = new GetStatusResponse.Network(); - network.setPeersCount(networkInfoResponse.connections); - - const networkFee = new GetStatusResponse.NetworkFee(); - networkFee.setRelay(networkInfoResponse.relayfee); - networkFee.setIncremental(networkInfoResponse.incrementalfee); - - network.setFee(networkFee); - - response.setVersion(version); - response.setTime(time); - response.setSyncProgress(blockchainInfoResponse.verificationprogress); - response.setChain(chain); - response.setMasternode(masternode); - response.setNetwork(network); - - let status = GetStatusResponse.Status.NOT_STARTED; - if (mnSyncStatusResponse.IsBlockchainSynced && mnSyncStatusResponse.IsSynced) { - status = GetStatusResponse.Status.READY; - } else if (blockchainInfoResponse.verificationprogress > 0) { - status = GetStatusResponse.Status.SYNCING; - } - - response.setStatus(status); - - return response; - } - - return getStatusHandler; -} - -module.exports = getStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory.js new file mode 100644 index 00000000000..dce332f9ff0 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory.js @@ -0,0 +1,71 @@ +const { + v0: { + MasternodeListResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const MasternodeListSync = require('../../../MasternodeListSync'); +const logger = require('../../../logger'); + +/** + * @param {MasternodeListSync} masternodeListSync + */ +function subscribeToMasternodeListHandlerFactory(masternodeListSync) { + /** + * @param {grpc.ServerWriteableStream} call + * @return {Promise} + */ + async function subscribeToMasternodeListHandler(call) { + const requestLogger = logger.child({ + endpoint: 'subscribeToMasternodeListHandler', + request: Math.floor(Math.random() * 1000), + }); + + requestLogger.debug('Start stream'); + + // We create a closure here to have an independent listener for each call, + // so we can easily remove it when the call ends + const sendDiff = (diffBuffer, blockHeight, blockHash, full) => { + const response = new MasternodeListResponse(); + + response.setMasternodeListDiff(diffBuffer); + + let message = 'Masternode list diff sent'; + if (full) { + message = 'Full masternode list sent'; + } + + requestLogger.trace({ + blockHeight, + blockHash, + }, message); + + call.write(response); + }; + + const shutdown = () => { + call.end(); + + requestLogger.trace('Shutdown stream'); + + masternodeListSync.removeListener(MasternodeListSync.EVENT_DIFF, sendDiff); + }; + + call.on('end', shutdown); + call.on('cancelled', shutdown); + + masternodeListSync.on(MasternodeListSync.EVENT_DIFF, sendDiff); + + // Send full masternode list on subscribe + sendDiff( + masternodeListSync.getFullDiffBuffer(), + masternodeListSync.getBlockHeight(), + masternodeListSync.getBlockHash(), + true, + ); + } + + return subscribeToMasternodeListHandler; +} + +module.exports = subscribeToMasternodeListHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js b/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js index 1d190d63bfd..b6e7032f850 100644 --- a/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js +++ b/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js @@ -19,6 +19,7 @@ const { default: loadWasmDpp, deserializeConsensusError } = require('@dashevo/wa const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); const AlreadyExistsGrpcError = require('@dashevo/grpc-common/lib/server/error/AlreadyExistsGrpcError'); +const logger = require('../../logger'); /** * @param {Object} data @@ -100,7 +101,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // Undefined Drive and DAPI errors - if (code >= 17 && code < 1000) { + if (code >= 17 && code < 10000) { return new GrpcError( GrpcErrorCodes.UNKNOWN, message, @@ -109,11 +110,22 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // DPP errors - if (code >= 1000 && code < 5000) { - const consensusError = deserializeConsensusError(data.serializedError || []); + if (code >= 10000 && code < 50000) { + let consensusError; + try { + consensusError = deserializeConsensusError(data.serializedError || []); + } catch (e) { + logger.error({ + err: e, + data: data.serializedError, + code, + }, `Failed to deserialize consensus error with code ${code}: ${e.message}`); + + throw e; + } // Basic - if (code >= 1000 && code < 2000) { + if (code >= 10000 && code < 20000) { return new InvalidArgumentGrpcError( consensusError.message, { code, ...createRawMetadata(data) }, @@ -121,7 +133,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // Signature - if (code >= 2000 && code < 3000) { + if (code >= 20000 && code < 30000) { return new GrpcError( GrpcErrorCodes.UNAUTHENTICATED, consensusError.message, @@ -130,7 +142,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // Fee - if (code >= 3000 && code < 4000) { + if (code >= 30000 && code < 40000) { return new FailedPreconditionGrpcError( consensusError.message, { code, ...createRawMetadata(data) }, @@ -138,7 +150,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // State - if (code >= 4000 && code < 5000) { + if (code >= 40000 && code < 50000) { return new InvalidArgumentGrpcError( consensusError.message, { code, ...createRawMetadata(data) }, diff --git a/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js index 15e369f9ce5..ad772760427 100644 --- a/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js @@ -3,6 +3,8 @@ const { error: { InvalidArgumentGrpcError, AlreadyExistsGrpcError, + ResourceExhaustedGrpcError, + UnavailableGrpcError, }, }, } = require('@dashevo/grpc-common'); @@ -12,6 +14,7 @@ const { BroadcastStateTransitionResponse, }, } = require('@dashevo/dapi-grpc'); +const logger = require('../../../logger'); /** * @param {jaysonClient} rpcClient @@ -35,18 +38,64 @@ function broadcastStateTransitionHandlerFactory(rpcClient, createGrpcErrorFromDr throw new InvalidArgumentGrpcError('State Transition is not specified'); } - const tx = Buffer.from(stByteArray).toString('base64'); + const tx = Buffer.from(stByteArray) + .toString('base64'); - const { result, error: jsonRpcError } = await rpcClient.request('broadcast_tx_sync', { tx }); + let response; + + try { + response = await rpcClient.request('broadcast_tx', { tx }); + } catch (e) { + if (e.message === 'socket hang up') { + throw new UnavailableGrpcError('Tenderdash is not available'); + } + + e.message = `Failed broadcasting state transition: ${e.message}`; + + throw e; + } + + const { + result, + error: jsonRpcError, + } = response; if (jsonRpcError) { - if (jsonRpcError.data === 'tx already exists in cache') { - throw new AlreadyExistsGrpcError('State transition already in chain'); + if (typeof jsonRpcError.data === 'string') { + if (jsonRpcError.data === 'tx already exists in cache') { + throw new AlreadyExistsGrpcError('state transition already in chain'); + } + + if (jsonRpcError.data.startsWith('Tx too large.')) { + const message = jsonRpcError.data.replace('Tx too large. ', ''); + throw new InvalidArgumentGrpcError(`state transition is too large. ${message}`); + } + + if (jsonRpcError.data.startsWith('mempool is full')) { + throw new ResourceExhaustedGrpcError(jsonRpcError.data); + } + + // broadcasting is timed out + if (jsonRpcError.data.includes('context deadline exceeded')) { + throw new ResourceExhaustedGrpcError('broadcasting state transition is timed out'); + } + + if (jsonRpcError.data.includes('too_many_resets')) { + throw new ResourceExhaustedGrpcError('tenderdash is not responding: too many requests'); + } + + if (jsonRpcError.data.startsWith('broadcast confirmation not received:')) { + logger.error(`Failed broadcasting state transition: ${jsonRpcError.data}`); + + throw new UnavailableGrpcError(jsonRpcError.data); + } } const error = new Error(); Object.assign(error, jsonRpcError); + logger.error(error, `Unexpected JSON RPC error during broadcasting state transition: ${JSON.stringify(jsonRpcError)}`); + throw error; } diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHandlerFactory.js deleted file mode 100644 index 8d3c8a567a0..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHandlerFactory.js +++ /dev/null @@ -1,43 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getDataContractHandler} - */ -function getDataContractHandlerFactory(driveClient) { - /** - * @typedef getDataContractHandler - * - * @param {Object} call - * - * @returns {Promise} - */ - async function getDataContractHandler(call) { - const { request } = call; - - if (request.getV0().getId() === null) { - throw new InvalidArgumentGrpcError('id is not specified'); - } - - const dataContractResponseBuffer = await driveClient.fetchDataContract(request); - - return GetDataContractResponse.deserializeBinary(dataContractResponseBuffer); - } - - return getDataContractHandler; -} - -module.exports = getDataContractHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHistoryHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHistoryHandlerFactory.js deleted file mode 100644 index 40f607a935e..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHistoryHandlerFactory.js +++ /dev/null @@ -1,43 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractHistoryResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getDataContractHistoryHandler} - */ -function getDataContractHistoryHandlerFactory(driveClient) { - /** - * @typedef getDataContractHistoryHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getDataContractHistoryHandler(call) { - const { request } = call; - - if (request.getV0().getId() === null) { - throw new InvalidArgumentGrpcError('id is not specified'); - } - - const dataContractHistoryResponseBuffer = await driveClient.fetchDataContractHistory(request); - - return GetDataContractHistoryResponse.deserializeBinary(dataContractHistoryResponseBuffer); - } - - return getDataContractHistoryHandler; -} - -module.exports = getDataContractHistoryHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractsHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getDataContractsHandlerFactory.js deleted file mode 100644 index 5a2136e90e6..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractsHandlerFactory.js +++ /dev/null @@ -1,45 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractsResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getDataContractsHandler} - */ -function getDataContractsHandlerFactory(driveClient) { - /** - * @typedef getDataContractsHandler - * - * @param {Object} call - * - * @returns {Promise} - */ - async function getDocumentsHandler(call) { - const { request } = call; - - if (!request.getV0().getDataContractId()) { - throw new InvalidArgumentGrpcError('dataContractId is not specified'); - } - - if (!request.getV0().getDocumentType()) { - throw new InvalidArgumentGrpcError('documentType is not specified'); - } - - const documentResponseBuffer = await driveClient.fetchDocuments( - request, - ); - - return GetDocumentsResponse.deserializeBinary(documentResponseBuffer); - } - - return getDocumentsHandler; -} - -module.exports = getDocumentsHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.js deleted file mode 100644 index 240fa429690..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.js +++ /dev/null @@ -1,32 +0,0 @@ -const { - v0: { - GetEpochsInfoResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getEpochsInfoHandler} - */ -function getEpochsInfoHandlerFactory(driveClient) { - /** - * @typedef getEpochsInfoHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getEpochsInfoHandler(call) { - const { request } = call; - - const epochsInfoBuffer = await driveClient - .fetchEpochsInfo(request); - - return GetEpochsInfoResponse.deserializeBinary(epochsInfoBuffer); - } - - return getEpochsInfoHandler; -} - -module.exports = getEpochsInfoHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.js deleted file mode 100644 index e0d31d6244d..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesByPublicKeyHashesResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * - * @param {DriveClient} driveClient - * @return {getIdentitiesByPublicKeyHashesHandler} - */ -function getIdentitiesByPublicKeyHashesHandlerFactory( - driveClient, -) { - /** - * @typedef getIdentitiesByPublicKeyHashesHandler - * @param {Object} call - * @return {Promise} - */ - async function getIdentitiesByPublicKeyHashesHandler(call) { - const { request } = call; - - if (request.getV0().getPublicKeyHashesList().length === 0) { - throw new InvalidArgumentGrpcError('No public key hashes were provided'); - } - - const identitiesResponseBuffer = await driveClient - .fetchIdentitiesByPublicKeyHashes(request); - - return GetIdentitiesByPublicKeyHashesResponse.deserializeBinary(identitiesResponseBuffer); - } - - return getIdentitiesByPublicKeyHashesHandler; -} - -module.exports = getIdentitiesByPublicKeyHashesHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory.js deleted file mode 100644 index c2d12621e40..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory.js +++ /dev/null @@ -1,45 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentitiesHandler} - */ -function getIdentitiesHandlerFactory(driveClient) { - /** - * @typedef getIdentitiesHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentitiesHandler(call) { - const { request } = call; - - const identitiIds = request.getV0().getIdsList(); - - if (identitiIds === null) { - throw new InvalidArgumentGrpcError('identity ids are not specified'); - } - - const identitiesResponseBuffer = await driveClient.fetchIdentities(request); - - return GetIdentitiesResponse.deserializeBinary(identitiesResponseBuffer); - } - - return getIdentitiesHandler; -} - -module.exports = getIdentitiesHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.js deleted file mode 100644 index 064fc3033b2..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceAndRevisionResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentityBalanceAndRevisionHandler} - */ -function getIdentityBalanceAndRevisionHandlerFactory(driveClient) { - /** - * @typedef getIdentityBalanceAndRevisionHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityBalanceAndRevisionHandler(call) { - const { request } = call; - - if (!request.getV0().getId()) { - throw new InvalidArgumentGrpcError('identity id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentityBalanceAndRevision(request); - - return GetIdentityBalanceAndRevisionResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityBalanceAndRevisionHandler; -} - -module.exports = getIdentityBalanceAndRevisionHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.js deleted file mode 100644 index 300290e9907..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentityBalanceHandler} - */ -function getIdentityBalanceHandlerFactory(driveClient) { - /** - * @typedef getIdentityBalanceHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityBalanceHandler(call) { - const { request } = call; - - if (!request.getV0().getId()) { - throw new InvalidArgumentGrpcError('identity id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentityBalance(request); - - return GetIdentityBalanceResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityBalanceHandler; -} - -module.exports = getIdentityBalanceHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.js deleted file mode 100644 index 720181b237b..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityByPublicKeyHashResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * - * @param {DriveClient} driveClient - * @return {getIdentityByPublicKeyHashHandler} - */ -function getIdentityByPublicKeyHashHandlerFactory( - driveClient, -) { - /** - * @typedef getIdentityByPublicKeyHashHandler - * @param {Object} call - * @return {Promise} - */ - async function getIdentityByPublicKeyHashHandler(call) { - const { request } = call; - - if (request.getV0().getPublicKeyHash().length === 0) { - throw new InvalidArgumentGrpcError('No public key hash is provided'); - } - - const identitiesResponseBuffer = await driveClient - .fetchIdentityByPublicKeyHash(request); - - return GetIdentityByPublicKeyHashResponse.deserializeBinary(identitiesResponseBuffer); - } - - return getIdentityByPublicKeyHashHandler; -} - -module.exports = getIdentityByPublicKeyHashHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.js new file mode 100644 index 00000000000..3109022c925 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.js @@ -0,0 +1,33 @@ +const { + v0: { + GetIdentityContractNonceResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {DriveClient} driveClient + * + * @returns {getIdentityContractNonceHandler} + */ +function getIdentityContractNonceHandlerFactory(driveClient) { + /** + * @typedef getIdentityContractNonceHandler + * + * @param {Object} call + * + * @return {Promise} + */ + async function getIdentityContractNonceHandler(call) { + const { request } = call; + + const identityContractNonceBuffer = await driveClient + .fetchIdentityContractNonce(request); + + return GetIdentityContractNonceResponse + .deserializeBinary(identityContractNonceBuffer); + } + + return getIdentityContractNonceHandler; +} + +module.exports = getIdentityContractNonceHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityHandlerFactory.js deleted file mode 100644 index 1a78a398b6d..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getIdentityHandler} - */ -function getIdentityHandlerFactory(driveClient) { - /** - * @typedef getIdentityHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityHandler(call) { - const { request } = call; - - if (!request.getV0().getId()) { - throw new InvalidArgumentGrpcError('id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentity(request); - - return GetIdentityResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityHandler; -} - -module.exports = getIdentityHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.js deleted file mode 100644 index 2d446eeee73..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityKeysResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentityKeysHandler} - */ -function getIdentityKeysHandlerFactory(driveClient) { - /** - * @typedef getIdentityKeysHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityKeysHandler(call) { - const { request } = call; - - if (!request.getV0().getIdentityId()) { - throw new InvalidArgumentGrpcError('identity id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentityKeys(request); - - return GetIdentityKeysResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityKeysHandler; -} - -module.exports = getIdentityKeysHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.js new file mode 100644 index 00000000000..5d38ca93064 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.js @@ -0,0 +1,33 @@ +const { + v0: { + GetIdentityNonceResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {DriveClient} driveClient + * + * @returns {getIdentityNonceHandler} + */ +function getIdentityNonceHandlerFactory(driveClient) { + /** + * @typedef getIdentityNonceHandler + * + * @param {Object} call + * + * @return {Promise} + */ + async function getIdentityNonceHandler(call) { + const { request } = call; + + const identityNonceBuffer = await driveClient + .fetchIdentityNonce(request); + + return GetIdentityNonceResponse + .deserializeBinary(identityNonceBuffer); + } + + return getIdentityNonceHandler; +} + +module.exports = getIdentityNonceHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getProofsHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getProofsHandlerFactory.js deleted file mode 100644 index 044c2022dc1..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getProofsHandlerFactory.js +++ /dev/null @@ -1,31 +0,0 @@ -const { - v0: { - GetProofsResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getProofsHandler} - */ -function getProofsHandlerFactory(driveClient) { - /** - * @typedef getProofsHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getProofsHandler(call) { - const { request } = call; - - const proofsResponseBuffer = await driveClient.fetchProofs(request); - - return GetProofsResponse.deserializeBinary(proofsResponseBuffer); - } - - return getProofsHandler; -} - -module.exports = getProofsHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.js deleted file mode 100644 index ab60ab317fd..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.js +++ /dev/null @@ -1,33 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeStateResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getProtocolVersionUpgradeStateHandler} - */ -function getProtocolVersionUpgradeStateHandlerFactory(driveClient) { - /** - * @typedef getProtocolVersionUpgradeStateHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getProtocolVersionUpgradeStateHandler(call) { - const { request } = call; - - const versionUpgradeStateBuffer = await driveClient - .fetchVersionUpgradeState(request); - - return GetProtocolVersionUpgradeStateResponse - .deserializeBinary(versionUpgradeStateBuffer); - } - - return getProtocolVersionUpgradeStateHandler; -} - -module.exports = getProtocolVersionUpgradeStateHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.js deleted file mode 100644 index 4695e2193d2..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.js +++ /dev/null @@ -1,33 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeVoteStatusResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getProtocolVersionUpgradeVoteStatusHandler} - */ -function getProtocolVersionUpgradeVoteStatusHandlerFactory(driveClient) { - /** - * @typedef getProtocolVersionUpgradeVoteStatusHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getProtocolVersionUpgradeVoteStatusHandler(call) { - const { request } = call; - - const versionUpgradeVoteStatusBuffer = await driveClient - .fetchVersionUpgradeVoteStatus(request); - - return GetProtocolVersionUpgradeVoteStatusResponse - .deserializeBinary(versionUpgradeVoteStatusBuffer); - } - - return getProtocolVersionUpgradeVoteStatusHandler; -} - -module.exports = getProtocolVersionUpgradeVoteStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js index 32cbdff8360..131f230db47 100644 --- a/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js @@ -16,56 +16,15 @@ const { const { v0: { BroadcastStateTransitionRequest, - GetIdentityRequest, - GetIdentityKeysRequest, - GetDataContractRequest, - GetDataContractsRequest, - GetDataContractHistoryRequest, - GetDocumentsRequest, - GetIdentitiesRequest, - GetIdentitiesByPublicKeyHashesRequest, - GetIdentityByPublicKeyHashRequest, WaitForStateTransitionResultRequest, GetConsensusParamsRequest, - GetProofsRequest, - GetEpochsInfoRequest, - GetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeStateRequest, pbjs: { BroadcastStateTransitionRequest: PBJSBroadcastStateTransitionRequest, BroadcastStateTransitionResponse: PBJSBroadcastStateTransitionResponse, - GetIdentityRequest: PBJSGetIdentityRequest, - GetIdentityResponse: PBJSGetIdentityResponse, - GetIdentitiesRequest: PBJSGetIdentitiesRequest, - GetIdentitiesResponse: PBJSGetIdentitiesResponse, - GetIdentityBalanceResponse: PBJSGetIdentityBalanceResponse, - GetIdentityBalanceAndRevisionResponse: PBJSGetIdentityBalanceAndRevisionResponse, - GetIdentityKeysRequest: PBJSGetIdentityKeysRequest, - GetIdentityKeysResponse: PBJSGetIdentityKeysResponse, - GetDataContractRequest: PBJSGetDataContractRequest, - GetDataContractResponse: PBJSGetDataContractResponse, - GetDataContractsRequest: PBJSGetDataContractsRequest, - GetDataContractsResponse: PBJSGetDataContractsResponse, - GetDocumentsRequest: PBJSGetDocumentsRequest, - GetDocumentsResponse: PBJSGetDocumentsResponse, - GetIdentitiesByPublicKeyHashesResponse: PBJSGetIdentitiesByPublicKeyHashesResponse, - GetIdentitiesByPublicKeyHashesRequest: PBJSGetIdentitiesByPublicKeyHashesRequest, - GetIdentityByPublicKeyHashResponse: PBJSGetIdentityByPublicKeyHashResponse, - GetIdentityByPublicKeyHashRequest: PBJSGetIdentityByPublicKeyHashRequest, WaitForStateTransitionResultRequest: PBJSWaitForStateTransitionResultRequest, WaitForStateTransitionResultResponse: PBJSWaitForStateTransitionResultResponse, GetConsensusParamsRequest: PBJSGetConsensusParamsRequest, GetConsensusParamsResponse: PBJSGetConsensusParamsResponse, - GetDataContractHistoryRequest: PBJSGetDataContractHistoryRequest, - GetDataContractHistoryResponse: PBJSGetDataContractHistoryResponse, - GetProofsRequest: PBJSGetProofsRequest, - GetProofsResponse: PBJSGetProofsResponse, - GetEpochsInfoRequest: PBJSGetEpochsInfoRequest, - GetEpochsInfoResponse: PBJSGetEpochsInfoResponse, - GetProtocolVersionUpgradeVoteStatusRequest: PBJSGetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeVoteStatusResponse: PBJSGetProtocolVersionUpgradeVoteStatusResponse, - GetProtocolVersionUpgradeStateRequest: PBJSGetProtocolVersionUpgradeStateRequest, - GetProtocolVersionUpgradeStateResponse: PBJSGetProtocolVersionUpgradeStateResponse, }, }, } = require('@dashevo/dapi-grpc'); @@ -74,61 +33,17 @@ const logger = require('../../../logger'); const createGrpcErrorFromDriveResponse = require('../createGrpcErrorFromDriveResponse'); -const getIdentityHandlerFactory = require( - './getIdentityHandlerFactory', -); -const getIdentitiesHandlerFactory = require( - './getIdentitiesHandlerFactory', -); -const getIdentityBalanceHandlerFactory = require( - './getIdentityBalanceHandlerFactory', -); -const getIdentityKeysHandlerFactory = require( - './getIdentityKeysHandlerFactory', -); -const getIdentityBalanceAndRevisionHandlerFactory = require( - './getIdentityBalanceAndRevisionHandlerFactory', -); const broadcastStateTransitionHandlerFactory = require( './broadcastStateTransitionHandlerFactory', ); -const getDocumentsHandlerFactory = require( - './getDocumentsHandlerFactory', -); -const getDataContractHandlerFactory = require( - './getDataContractHandlerFactory', -); -const getDataContractsHandlerFactory = require( - './getDataContractsHandlerFactory', -); -const getDataContractHistoryHandlerFactory = require( - './getDataContractHistoryHandlerFactory', -); -const getIdentityByPublicKeyHashHandlerFactory = require( - './getIdentityByPublicKeyHashHandlerFactory', -); -const getIdentitiesByPublicKeyHashesHandlerFactory = require( - './getIdentitiesByPublicKeyHashesHandlerFactory', -); const waitForStateTransitionResultHandlerFactory = require( './waitForStateTransitionResultHandlerFactory', ); const getConsensusParamsHandlerFactory = require( './getConsensusParamsHandlerFactory', ); -const getProofsHandlerFactory = require( - './getProofsHandlerFactory', -); -const getEpochsInfoHandlerFactory = require( - './getEpochsInfoHandlerFactory', -); - -const getProtocolVersionUpgradeVoteStatusHandlerFactory = require( - './getProtocolVersionUpgradeVoteStatusHandlerFactory', -); - -const getProtocolVersionUpgradeStateHandlerFactory = require( - './getProtocolVersionUpgradeStateHandlerFactory', +const unimplementedHandlerFactory = require( + './unimplementedHandlerFactory', ); const fetchProofForStateTransitionFactory = require('../../../externalApis/drive/fetchProofForStateTransitionFactory'); @@ -140,7 +55,7 @@ const getConsensusParamsFactory = require('../../../externalApis/tenderdash/getC /** * @param {jaysonClient} rpcClient * @param {BlockchainListener} blockchainListener - * @param {DriveClient} driveClient + * @param {PlatformPromiseClient} driveClient * @param {DashPlatformProtocol} dpp * @param {boolean} isProductionEnvironment * @returns {Object} @@ -171,198 +86,6 @@ function platformHandlersFactory( wrapInErrorHandler(broadcastStateTransitionHandler), ); - // getIdentity - const getIdentityHandler = getIdentityHandlerFactory( - driveClient, - ); - - const wrappedGetIdentity = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityRequest, - PBJSGetIdentityRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityResponse, - ), - wrapInErrorHandler(getIdentityHandler), - ); - - // getIdentities - const getIdentitiesHandler = getIdentitiesHandlerFactory( - driveClient, - ); - - const wrappedGetIdentities = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentitiesRequest, - PBJSGetIdentitiesRequest, - ), - protobufToJsonFactory( - PBJSGetIdentitiesResponse, - ), - wrapInErrorHandler(getIdentitiesHandler), - ); - - // getIdentityBalance - const getIdentityBalanceHandler = getIdentityBalanceHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityBalance = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityRequest, - PBJSGetIdentityRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityBalanceResponse, - ), - wrapInErrorHandler(getIdentityBalanceHandler), - ); - - // getIdentityBalanceAndRevision - const getIdentityBalanceAndRevisionHandler = getIdentityBalanceAndRevisionHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityBalanceAndRevision = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityRequest, - PBJSGetIdentityRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityBalanceAndRevisionResponse, - ), - wrapInErrorHandler(getIdentityBalanceAndRevisionHandler), - ); - - // getIdentityKeys - const getIdentityKeysHandler = getIdentityKeysHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityKeys = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityKeysRequest, - PBJSGetIdentityKeysRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityKeysResponse, - ), - wrapInErrorHandler(getIdentityKeysHandler), - ); - - // getDocuments - const getDocumentsHandler = getDocumentsHandlerFactory( - driveClient, - ); - - const wrappedGetDocuments = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDocumentsRequest, - PBJSGetDocumentsRequest, - ), - protobufToJsonFactory( - PBJSGetDocumentsResponse, - ), - wrapInErrorHandler(getDocumentsHandler), - ); - - // getDataContract - const getDataContractHandler = getDataContractHandlerFactory( - driveClient, - ); - - const wrappedGetDataContract = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDataContractRequest, - PBJSGetDataContractRequest, - ), - protobufToJsonFactory( - PBJSGetDataContractResponse, - ), - wrapInErrorHandler(getDataContractHandler), - ); - - // getDataContracts - const getDataContractsHandler = getDataContractsHandlerFactory( - driveClient, - ); - - const wrappedGetDataContracts = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDataContractsRequest, - PBJSGetDataContractsRequest, - ), - protobufToJsonFactory( - PBJSGetDataContractsResponse, - ), - wrapInErrorHandler(getDataContractsHandler), - ); - - // getDataContractHistory - const getDataContractHistoryHandler = getDataContractHistoryHandlerFactory( - driveClient, - ); - - const wrappedGetDataContractHistory = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDataContractHistoryRequest, - PBJSGetDataContractHistoryRequest, - ), - protobufToJsonFactory( - PBJSGetDataContractHistoryResponse, - ), - wrapInErrorHandler(getDataContractHistoryHandler), - ); - - // getIdentityByPublicKeyHash - const getIdentityByPublicKeyHashHandler = getIdentityByPublicKeyHashHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityByPublicKeyHash = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityByPublicKeyHashRequest, - PBJSGetIdentityByPublicKeyHashRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityByPublicKeyHashResponse, - ), - wrapInErrorHandler(getIdentityByPublicKeyHashHandler), - ); - - // getIdentitiesByPublicKeyHashes - const getIdentitiesByPublicKeyHashesHandler = getIdentitiesByPublicKeyHashesHandlerFactory( - driveClient, - ); - - const wrappedGetIdentitiesByPublicKeyHashes = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentitiesByPublicKeyHashesRequest, - PBJSGetIdentitiesByPublicKeyHashesRequest, - ), - protobufToJsonFactory( - PBJSGetIdentitiesByPublicKeyHashesResponse, - ), - wrapInErrorHandler(getIdentitiesByPublicKeyHashesHandler), - ); - - // getProofs - const getProofsHandler = getProofsHandlerFactory( - driveClient, - ); - - const wrappedGetProofs = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetProofsRequest, - PBJSGetProofsRequest, - ), - protobufToJsonFactory( - PBJSGetProofsResponse, - ), - wrapInErrorHandler(getProofsHandler), - ); - // waitForStateTransitionResult const fetchProofForStateTransition = fetchProofForStateTransitionFactory(driveClient); @@ -381,6 +104,7 @@ function platformHandlersFactory( blockchainListener, dpp, createGrpcErrorFromDriveResponse, + parseInt(process.env.WAIT_FOR_ST_RESULT_TIMEOUT, 10), ); const wrappedWaitForStateTransitionResult = jsonToProtobufHandlerWrapper( @@ -409,74 +133,27 @@ function platformHandlersFactory( wrapInErrorHandler(getConsensusParamsHandler), ); - // getEpochsInfo - const getEpochsInfoHandler = getEpochsInfoHandlerFactory( - driveClient, - ); - - const wrappedGetEpochsInfo = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetEpochsInfoRequest, - PBJSGetEpochsInfoRequest, - ), - protobufToJsonFactory( - PBJSGetEpochsInfoResponse, - ), - wrapInErrorHandler(getEpochsInfoHandler), - ); - - // getProtocolVersionUpgradeVoteStatus - // eslint-disable-next-line max-len - const getProtocolVersionUpgradeVoteStatusHandler = getProtocolVersionUpgradeVoteStatusHandlerFactory( - driveClient, - ); - - const wrappedGetProtocolVersionUpgradeVoteStatus = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetProtocolVersionUpgradeVoteStatusRequest, - PBJSGetProtocolVersionUpgradeVoteStatusRequest, - ), - protobufToJsonFactory( - PBJSGetProtocolVersionUpgradeVoteStatusResponse, - ), - wrapInErrorHandler(getProtocolVersionUpgradeVoteStatusHandler), - ); - - // getProtocolVersionUpgradeState - const getProtocolVersionUpgradeStateHandler = getProtocolVersionUpgradeStateHandlerFactory( - driveClient, - ); - - const wrappedGetProtocolVersionUpgradeState = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetProtocolVersionUpgradeStateRequest, - PBJSGetProtocolVersionUpgradeStateRequest, - ), - protobufToJsonFactory( - PBJSGetProtocolVersionUpgradeStateResponse, - ), - wrapInErrorHandler(getProtocolVersionUpgradeStateHandler), - ); - return { broadcastStateTransition: wrappedBroadcastStateTransition, - getIdentity: wrappedGetIdentity, - getIdentities: wrappedGetIdentities, - getIdentityBalance: wrappedGetIdentityBalance, - getIdentityBalanceAndRevision: wrappedGetIdentityBalanceAndRevision, - getIdentityKeys: wrappedGetIdentityKeys, - getDocuments: wrappedGetDocuments, - getDataContract: wrappedGetDataContract, - getDataContracts: wrappedGetDataContracts, - getDataContractHistory: wrappedGetDataContractHistory, - getIdentityByPublicKeyHash: wrappedGetIdentityByPublicKeyHash, - getIdentitiesByPublicKeyHashes: wrappedGetIdentitiesByPublicKeyHashes, + getIdentity: wrapInErrorHandler(unimplementedHandlerFactory('getIdentity')), + getIdentitiesContractKeys: wrapInErrorHandler(unimplementedHandlerFactory('getIdentitiesContractKeys')), + getIdentityBalance: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityBalance')), + getIdentityBalanceAndRevision: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityBalanceAndRevision')), + getIdentityKeys: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityKeys')), + getDocuments: wrapInErrorHandler(unimplementedHandlerFactory('getDocuments')), + getDataContract: wrapInErrorHandler(unimplementedHandlerFactory('getDataContract')), + getDataContracts: wrapInErrorHandler(unimplementedHandlerFactory('getDataContracts')), + getDataContractHistory: wrapInErrorHandler(unimplementedHandlerFactory('getDataContractHistory')), + getIdentityByPublicKeyHash: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityByPublicKeyHash')), + getIdentitiesByPublicKeyHashes: wrapInErrorHandler(unimplementedHandlerFactory('getIdentitiesByPublicKeyHashes')), waitForStateTransitionResult: wrappedWaitForStateTransitionResult, getConsensusParams: wrappedGetConsensusParams, - getProofs: wrappedGetProofs, - getEpochsInfo: wrappedGetEpochsInfo, - getProtocolVersionUpgradeVoteStatus: wrappedGetProtocolVersionUpgradeVoteStatus, - getProtocolVersionUpgradeState: wrappedGetProtocolVersionUpgradeState, + getProofs: wrapInErrorHandler(unimplementedHandlerFactory('getProofs')), + getEpochsInfo: wrapInErrorHandler(unimplementedHandlerFactory('getEpochsInfo')), + getProtocolVersionUpgradeVoteStatus: wrapInErrorHandler(unimplementedHandlerFactory('getProtocolVersionUpgradeVoteStatus')), + getProtocolVersionUpgradeState: wrapInErrorHandler(unimplementedHandlerFactory('getProtocolVersionUpgradeState')), + getIdentityContractNonce: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityContractNonce')), + getIdentityNonce: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityNonce')), }; } diff --git a/packages/dapi/lib/grpcServer/handlers/platform/unimplementedHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/unimplementedHandlerFactory.js new file mode 100644 index 00000000000..74f916e386e --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/platform/unimplementedHandlerFactory.js @@ -0,0 +1,30 @@ +const { + server: { + error: { + UnimplementedGrpcError, + }, + }, +} = require('@dashevo/grpc-common'); + +const logger = require('../../../logger'); + +/** + * @param {string} name + * @returns {broadcastStateTransitionHandler} + */ +function unimplementedHandlerFactory(name) { + /** + * @typedef broadcastStateTransitionHandler + * + * @return {Promise} + */ + async function broadcastStateTransitionHandler() { + logger.error(`unimplemented endpoint '${name}' called`); + + throw new UnimplementedGrpcError('the endpoint is not implemented in DAPI'); + } + + return broadcastStateTransitionHandler; +} + +module.exports = unimplementedHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.js index ae1c8dda1bc..de8d1457e61 100644 --- a/packages/dapi/lib/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.js @@ -34,7 +34,7 @@ function waitForStateTransitionResultHandlerFactory( blockchainListener, dpp, createGrpcErrorFromDriveResponse, - stateTransitionWaitTimeout = 80000, + stateTransitionWaitTimeout, ) { /** * @param {Object} txDeliverResult diff --git a/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js index 4246616c0c7..8c1988216f3 100644 --- a/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js @@ -83,6 +83,7 @@ async function sendInstantLockResponse(call, instantLock) { * @param {testFunction} testTransactionAgainstFilter * @param {CoreRpcClient} coreAPI * @param {getMemPoolTransactions} getMemPoolTransactions + * @param {ChainDataProvider} chainDataProvider * @return {subscribeToTransactionsWithProofsHandler} */ function subscribeToTransactionsWithProofsHandlerFactory( @@ -92,6 +93,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( testTransactionAgainstFilter, coreAPI, getMemPoolTransactions, + chainDataProvider, ) { /** * @typedef subscribeToTransactionsWithProofsHandler @@ -159,7 +161,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( mediator.on( ProcessMediator.EVENTS.TRANSACTION, async (tx) => { - requestLogger.debug(`send transaction ${tx.hash}`); + requestLogger.debug(`sent transaction ${tx.hash}`); await sendTransactionsResponse(acknowledgingCall, [tx]); }, @@ -168,7 +170,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( mediator.on( ProcessMediator.EVENTS.MERKLE_BLOCK, async (merkleBlock) => { - requestLogger.debug('send merkle block'); + requestLogger.debug(`sent merkle block ${merkleBlock.header.hash}`); await sendMerkleBlockResponse(acknowledgingCall, merkleBlock); }, @@ -179,7 +181,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( async (instantLock) => { requestLogger.debug({ instantLock, - }, `send instant lock for ${instantLock.txid}`); + }, `sent instant lock for ${instantLock.txid}`); await sendInstantLockResponse(acknowledgingCall, instantLock); }, @@ -208,7 +210,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( throw e; } - const bestBlockHeight = await coreAPI.getBestBlockHeight(); + const bestBlockHeight = chainDataProvider.getChainHeight(); let historicalCount = count; diff --git a/packages/dapi/lib/rpcServer/commands/generateToAddress.js b/packages/dapi/lib/rpcServer/commands/generateToAddress.js deleted file mode 100644 index 743c49a4b80..00000000000 --- a/packages/dapi/lib/rpcServer/commands/generateToAddress.js +++ /dev/null @@ -1,87 +0,0 @@ -const Validator = require('../../utils/Validator'); -const argsSchema = require('../schemas/generateToAddress.json'); - -const validator = new Validator(argsSchema); -/** - * @param coreAPI - * @return {generateToAddress} - */ -const generateToAddressFactory = (coreAPI) => { - /** - * Layer 1 endpoint - * WORKS ONLY IN REGTEST MODE. - * Generates blocks on demand for regression tests. - * @typedef generateToAddress - * @param args - command arguments - * @param {number} args.blocksNumber - Number of blocks to generate - * @param {string} args.address - The address that will receive the newly generated Dash - * - * @return {Promise} - generated block hashes - */ - async function generateToAddress(args) { - validator.validate(args); - - const { blocksNumber, address } = args; - - return coreAPI.generateToAddress(blocksNumber, address); - } - - return generateToAddress; -}; - -/* eslint-disable max-len */ -/** - * @swagger - * /generateToAddress: - * post: - * operationId: generateToAddress - * deprecated: false - * summary: generate - * description: Generates blocks on demand sending funds to address - * tags: - * - L1 - * responses: - * 200: - * description: Successful response. Promise (string array) containing strings of block hashes. - * requestBody: - * content: - * application/json: - * schema: - * type: object - * required: - * - method - * - id - * - jsonrpc - * - params - * properties: - * method: - * type: string - * default: generate - * description: Method name - * id: - * type: integer - * default: 1 - * format: int32 - * description: Request ID - * jsonrpc: - * type: string - * default: '2.0' - * description: JSON-RPC Version (2.0) - * params: - * title: Parameters - * type: object - * required: - * - blocksNumber - * - address - * properties: - * blocksNumber: - * type: integer - * default: 1 - * description: Number of blocks to generate - * address: - * type: string - * description: Address to sends funds to - */ -/* eslint-enable max-len */ - -module.exports = generateToAddressFactory; diff --git a/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js b/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js index 397c779fd9c..4c610f8a032 100644 --- a/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js +++ b/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js @@ -1,8 +1,19 @@ /** * @param {Object} coreAPI + * @param {ZmqClient} coreZmqClient * @return {getBestBlockHash} */ -const getBestBlockHashFactory = (coreAPI) => { +const getBestBlockHashFactory = (coreAPI, coreZmqClient) => { + let hash = null; + + // Reset height on a new block, so it will be obtain again on a user request + coreZmqClient.on( + coreZmqClient.topics.hashblock, + () => { + hash = null; + }, + ); + /** * Layer 1 endpoint * Returns block hash of the chaintip @@ -10,7 +21,11 @@ const getBestBlockHashFactory = (coreAPI) => { * @return {Promise} - latest block hash */ async function getBestBlockHash() { - return coreAPI.getBestBlockHash(); + if (hash === null) { + hash = await coreAPI.getBestBlockHash(); + } + + return hash; } return getBestBlockHash; diff --git a/packages/dapi/lib/rpcServer/commands/getMnListDiff.js b/packages/dapi/lib/rpcServer/commands/getMnListDiff.js deleted file mode 100644 index fbbe1d28560..00000000000 --- a/packages/dapi/lib/rpcServer/commands/getMnListDiff.js +++ /dev/null @@ -1,86 +0,0 @@ -const Validator = require('../../utils/Validator'); -const argsSchema = require('../schemas/getMnListDiff.json'); - -const validator = new Validator(argsSchema); -/** - * Returns getMnListDiff function - * @param coreAPI - * @return {getMnListDiff} - */ -const getMnListDiffFactory = (coreAPI) => { - /** - * Layer 1 endpoint - * Returns calculated balance for the address - * @typedef getMnListDiff - * @param args - command arguments - * @param baseBlockHash {string} - * @param blockHash {string} - * @return {Promise} - */ - async function getMnListDiff(args) { - validator.validate(args); - const { baseBlockHash, blockHash } = args; - - return coreAPI.getMnListDiff(baseBlockHash, blockHash); - } - - return getMnListDiff; -}; - -/* eslint-disable max-len */ -/** - * @swagger - * /getMnListDiff: - * post: - * operationId: getMnListDiff - * deprecated: false - * summary: getMnListDiff - * description: "Returns masternode list diff for the provided block hashes" - * tags: - * - L1 - * responses: - * 200: - * description: Successful response. Promise (object array) containing a diff of the masternode list based on the provided block hashes. - * requestBody: - * content: - * application/json: - * schema: - * type: object - * required: - * - method - * - id - * - jsonrpc - * - params - * properties: - * method: - * type: string - * default: getMnListDiff - * description: Method name - * id: - * type: integer - * default: 1 - * format: int32 - * description: Request ID - * jsonrpc: - * type: string - * default: '2.0' - * description: JSON-RPC Version (2.0) - * params: - * title: Parameters - * type: object - * required: - * - baseBlockHash - * - blockHash - * properties: - * baseBlockHash: - * type: string - * default: '0000000000000000000000000000000000000000000000000000000000000000' - * description: Block hash - * blockHash: - * type: string - * default: '0000000000000000000000000000000000000000000000000000000000000000' - * description: Block hash - */ -/* eslint-enable max-len */ - -module.exports = getMnListDiffFactory; diff --git a/packages/dapi/lib/rpcServer/server.js b/packages/dapi/lib/rpcServer/server.js index 8477a521dd8..5a1d037c5b1 100644 --- a/packages/dapi/lib/rpcServer/server.js +++ b/packages/dapi/lib/rpcServer/server.js @@ -1,61 +1,44 @@ const jayson = require('jayson/promise'); -const { isRegtest, isDevnet } = require('../utils'); const errorHandlerDecorator = require('./errorHandlerDecorator'); const getBestBlockHash = require('./commands/getBestBlockHash'); const getBlockHash = require('./commands/getBlockHash'); -const getMnListDiff = require('./commands/getMnListDiff'); -const generateToAddress = require('./commands/generateToAddress'); // Following commands are not implemented yet: // const getVersion = require('./commands/getVersion'); -const createCommands = (dashcoreAPI) => ({ - getBestBlockHash: getBestBlockHash(dashcoreAPI), +const createCommands = (dashcoreAPI, coreZmqClient) => ({ + getBestBlockHash: getBestBlockHash(dashcoreAPI, coreZmqClient), getBlockHash: getBlockHash(dashcoreAPI), - getMnListDiff: getMnListDiff(dashcoreAPI), -}); - -const createRegtestCommands = (dashcoreAPI) => ({ - generateToAddress: generateToAddress(dashcoreAPI), }); /** * Starts RPC server * @param options * @param {number} options.port - port to listen for incoming RPC connections - * @param {string} options.networkType * @param {object} options.dashcoreAPI - * @param {AbstractDriveAdapter} options.driveAPI - Drive api adapter - * @param {object} options.tendermintRpcClient - * @param {DashPlatformProtocol} options.dpp - * @param {object} options.log + * @param {Logger} options.logger + * @param {ZmqClient} options.coreZmqClient */ const start = ({ port, - networkType, dashcoreAPI, logger, + coreZmqClient, }) => { const commands = createCommands( dashcoreAPI, + coreZmqClient, ); - - const areRegtestCommandsEnabled = isRegtest(networkType) || isDevnet(networkType); - - const allCommands = areRegtestCommandsEnabled - ? Object.assign(commands, createRegtestCommands(dashcoreAPI)) - : commands; - /* Decorate all commands with decorator that will intercept errors and format them before passing to user. */ - Object.keys(allCommands).forEach((commandName) => { - allCommands[commandName] = errorHandlerDecorator(allCommands[commandName], logger); + Object.keys(commands).forEach((commandName) => { + commands[commandName] = errorHandlerDecorator(commands[commandName], logger); }); - const server = jayson.server(allCommands); + const server = jayson.server(commands); server.http().listen(port); }; diff --git a/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js b/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js index 8958bad1f83..6c60898f8fe 100644 --- a/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js +++ b/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js @@ -19,9 +19,7 @@ function emitInstantLockToFilterCollectionFactory(bloomFilterEmitterCollection) const instantLock = new InstantLock(txLockBuffer); - logger.debug({ - instantLock, - }, `instant lock received for ${transaction.hash}`); + logger.debug(`instant lock received for ${transaction.hash}`); bloomFilterEmitterCollection.emit('instantLock', { transaction, diff --git a/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js b/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js index c528c0bb0b3..fc68a90650e 100644 --- a/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js +++ b/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js @@ -1,22 +1,11 @@ const { MerkleBlock, - Transaction, util: { buffer: BufferUtils }, } = require('@dashevo/dashcore-lib'); -const MAX_HEADERS_PER_REQUEST = 2000; +const getTransactions = require('./getTransactions'); -/** - * @param {CoreRpcClient} coreRpcApi - * @param {string[]} transactionHashes - * @return {Promise} - */ -async function getTransactions(coreRpcApi, transactionHashes) { - const rawTransactions = await Promise.all(transactionHashes.map( - (transactionHash) => coreRpcApi.getRawTransaction(transactionHash), - )); - return rawTransactions.map((tx) => new Transaction(tx)); -} +const MAX_HEADERS_PER_REQUEST = 2000; /** * @param {number} batchIndex diff --git a/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js b/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js index 95f89017e44..6912580dc2a 100644 --- a/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js +++ b/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js @@ -1,4 +1,4 @@ -const { Transaction } = require('@dashevo/dashcore-lib'); +const getTransactions = require('./getTransactions'); /** * @param {CoreRpcClient} coreAPI @@ -10,17 +10,8 @@ function getMemPoolTransactionsFactory(coreAPI) { * @returns {Promise} */ async function getMemPoolTransactions() { - const result = []; const memPoolTransactionIds = await coreAPI.getRawMemPool(false); - - for (const txId of memPoolTransactionIds) { - const rawTransaction = await coreAPI.getRawTransaction(txId); - - const transaction = new Transaction(rawTransaction); - result.push(transaction); - } - - return result; + return getTransactions(coreAPI, memPoolTransactionIds); } return getMemPoolTransactions; diff --git a/packages/dapi/lib/transactionsFilter/getTransactions.js b/packages/dapi/lib/transactionsFilter/getTransactions.js new file mode 100644 index 00000000000..5ec44c34c05 --- /dev/null +++ b/packages/dapi/lib/transactionsFilter/getTransactions.js @@ -0,0 +1,20 @@ +const { + Transaction, +} = require('@dashevo/dashcore-lib'); + +/** + * @param {CoreRpcClient} coreRpcApi + * @param {string[]} transactionHashes + * @return {Promise} + */ +async function getTransactions(coreRpcApi, transactionHashes) { + if (transactionHashes.length === 0) { + return []; + } + + const rawTransactions = await coreRpcApi.getRawTransactionMulti(transactionHashes); + return Object.values(rawTransactions) + .map((rawTransaction) => new Transaction(rawTransaction)); +} + +module.exports = getTransactions; diff --git a/packages/dapi/package.json b/packages/dapi/package.json index aef9e46b0c9..a7c2ce36847 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", @@ -35,8 +35,8 @@ "dependencies": { "@dashevo/bls": "~1.2.9", "@dashevo/dapi-grpc": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", - "@dashevo/dashd-rpc": "^18.2.0", + "@dashevo/dashcore-lib": "~0.21.3", + "@dashevo/dashd-rpc": "^19.0.0", "@dashevo/grpc-common": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", "@grpc/grpc-js": "1.4.4", @@ -53,9 +53,11 @@ "lru-cache": "^5.1.1", "pino": "^8.16.2", "pino-pretty": "^10.2.3", - "ws": "^7.5.3" + "ws": "^8.17.1" }, "devDependencies": { + "@babel/core": "^7.23.3", + "@babel/eslint-parser": "^7.23.3", "@dashevo/dapi-client": "workspace:*", "@dashevo/dp-services-ctl": "github:dashevo/js-dp-services-ctl#v0.19-dev", "chai": "^4.3.10", @@ -74,12 +76,12 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/dashevo/dapi.git" + "url": "git+https://github.com/dashpay/platform.git" }, "author": "", "license": "MIT", "bugs": { - "url": "https://github.com/dashevo/dapi/issues" + "url": "https://github.com/dashpay/platform/issues" }, - "homepage": "https://github.com/dashevo/dapi#readme" + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/dapi#readme" } diff --git a/packages/dapi/pm2.yml b/packages/dapi/pm2.yml deleted file mode 100644 index df8f450e3af..00000000000 --- a/packages/dapi/pm2.yml +++ /dev/null @@ -1,24 +0,0 @@ -- script: scripts/api.js - name: api - exec_mode: cluster - watch: false - instances: 2 - source_map_support: false - merge_logs: true - autorestart: true - out_file: "/dev/null" - error_file: "/dev/null" - vizion: false - wait_ready: true -- script: scripts/core-streams.js - name: core-streams - exec_mode: cluster - watch: false - instances: 2 - source_map_support: false - merge_logs: true - autorestart: true - out_file: "/dev/null" - error_file: "/dev/null" - vizion: false - wait_ready: true diff --git a/packages/dapi/scripts/api.js b/packages/dapi/scripts/api.js index 5339ed977a3..6577f973bfa 100644 --- a/packages/dapi/scripts/api.js +++ b/packages/dapi/scripts/api.js @@ -1,7 +1,6 @@ // Entry point for DAPI. const dotenv = require('dotenv'); const grpc = require('@grpc/grpc-js'); -// const loadBLS = require('@dashevo/bls'); const { server: { @@ -12,6 +11,9 @@ const { const { getCoreDefinition, getPlatformDefinition, + v0: { + PlatformPromiseClient, + }, } = require('@dashevo/dapi-grpc'); const { default: loadWasmDpp, DashPlatformProtocol } = require('@dashevo/wasm-dpp'); @@ -27,10 +29,8 @@ const config = require('../lib/config'); const { validateConfig } = require('../lib/config/validator'); const logger = require('../lib/logger'); const rpcServer = require('../lib/rpcServer/server'); -const DriveClient = require('../lib/externalApis/drive/DriveClient'); const dashCoreRpcClient = require('../lib/externalApis/dashcore/rpc'); const BlockchainListener = require('../lib/externalApis/tenderdash/BlockchainListener'); -// const DriveStateRepository = require('../lib/dpp/DriveStateRepository'); const coreHandlersFactory = require( '../lib/grpcServer/handlers/core/coreHandlersFactory', @@ -38,6 +38,7 @@ const coreHandlersFactory = require( const platformHandlersFactory = require( '../lib/grpcServer/handlers/platform/platformHandlersFactory', ); +const ZmqClient = require('../lib/externalApis/dashcore/ZmqClient'); async function main() { await loadWasmDpp(); @@ -53,11 +54,22 @@ async function main() { const isProductionEnvironment = process.env.NODE_ENV === 'production'; - logger.info('Connecting to Drive'); - const driveClient = new DriveClient({ - host: config.tendermintCore.host, - port: config.tendermintCore.port, - }); + // Subscribe to events from Dash Core + const coreZmqClient = new ZmqClient(config.dashcore.zmq.host, config.dashcore.zmq.port); + + // Bind logs on ZMQ connection events + coreZmqClient.on(ZmqClient.events.DISCONNECTED, logger.warn.bind(logger)); + coreZmqClient.on(ZmqClient.events.CONNECTION_DELAY, logger.warn.bind(logger)); + coreZmqClient.on(ZmqClient.events.MONITOR_ERROR, logger.warn.bind(logger)); + + // Wait until zmq connection is established + logger.info(`Connecting to Core ZMQ on ${coreZmqClient.connectionString}`); + + await coreZmqClient.start(); + + logger.info('Connection to ZMQ established.'); + + const driveClient = new PlatformPromiseClient(`http://${config.driveRpc.host}:${config.driveRpc.port}`, undefined); const rpcClient = RpcClient.http({ host: config.tendermintCore.host, @@ -110,9 +122,9 @@ async function main() { logger.info('Starting JSON RPC server'); rpcServer.start({ port: config.rpcServer.port, - networkType: config.network, dashcoreAPI: dashCoreRpcClient, logger, + coreZmqClient, }); logger.info(`JSON RPC server is listening on port ${config.rpcServer.port}`); @@ -124,6 +136,7 @@ async function main() { const coreHandlers = coreHandlersFactory( dashCoreRpcClient, isProductionEnvironment, + coreZmqClient, ); const platformHandlers = platformHandlersFactory( rpcClient, @@ -170,6 +183,3 @@ process.on('SIGINT', () => { process.exit(); }); - -// Tell PM2 that process ready to receive connections -process.send('ready'); diff --git a/packages/dapi/scripts/core-streams.js b/packages/dapi/scripts/core-streams.js index 7c3620781f7..9051b2e916b 100644 --- a/packages/dapi/scripts/core-streams.js +++ b/packages/dapi/scripts/core-streams.js @@ -19,9 +19,12 @@ const { const { v0: { + MasternodeListRequest, TransactionsWithProofsRequest, BlockHeadersWithChainLocksRequest, pbjs: { + MasternodeListRequest: PBJSMasternodeListRequest, + MasternodeListResponse: PBJSMasternodeListResponse, TransactionsWithProofsRequest: PBJSTransactionsWithProofsRequest, TransactionsWithProofsResponse: PBJSTransactionsWithProofsResponse, BlockHeadersWithChainLocksRequest: PBJSBlockHeadersWithChainLocksRequest, @@ -58,6 +61,8 @@ const subscribeToNewBlockHeaders = require('../lib/grpcServer/handlers/blockhead const subscribeToNewTransactions = require('../lib/transactionsFilter/subscribeToNewTransactions'); const getHistoricalTransactionsIteratorFactory = require('../lib/transactionsFilter/getHistoricalTransactionsIteratorFactory'); const getMemPoolTransactionsFactory = require('../lib/transactionsFilter/getMemPoolTransactionsFactory'); +const MasternodeListSync = require('../lib/MasternodeListSync'); +const subscribeToMasternodeListHandlerFactory = require('../lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory'); async function main() { // Validate config @@ -110,7 +115,7 @@ async function main() { ); // TODO: check if we can receive this event before 'rawtx', and if we can, - // we need to test tx in this message first before emitng lock to the bloom + // we need to test tx in this message first before emitting lock to the bloom // filter collection // Send transaction instant locks via `subscribeToTransactionsWithProofs` stream dashCoreZmqClient.on( @@ -125,8 +130,17 @@ async function main() { dashCoreZmqClient, blockHeadersCache, ); + await chainDataProvider.init(); + const masternodeListSync = new MasternodeListSync( + dashCoreRpcClient, + chainDataProvider, + config.network, + ); + + await masternodeListSync.init(); + // Start GRPC server logger.info('Starting GRPC server'); @@ -152,6 +166,7 @@ async function main() { testTransactionsAgainstFilter, dashCoreRpcClient, getMemPoolTransactions, + chainDataProvider, ); const wrappedSubscribeToTransactionsWithProofs = jsonToProtobufHandlerWrapper( @@ -186,11 +201,27 @@ async function main() { wrapInErrorHandler(subscribeToBlockHeadersWithChainLocksHandler), ); + const subscribeToMasternodeListHandler = subscribeToMasternodeListHandlerFactory( + masternodeListSync, + ); + + const wrappedSubscribeToMasternodeListHandler = jsonToProtobufHandlerWrapper( + jsonToProtobufFactory( + MasternodeListRequest, + PBJSMasternodeListRequest, + ), + protobufToJsonFactory( + PBJSMasternodeListResponse, + ), + wrapInErrorHandler(subscribeToMasternodeListHandler), + ); + const grpcServer = createServer( getCoreDefinition(0), { subscribeToTransactionsWithProofs: wrappedSubscribeToTransactionsWithProofs, subscribeToBlockHeadersWithChainLocks: wrappedSubscribeToBlockHeadersWithChainLocks, + subscribeToMasternodeList: wrappedSubscribeToMasternodeListHandler, }, ); @@ -219,6 +250,3 @@ process.on('SIGINT', () => { process.exit(); }); - -// Tell PM2 that process ready to receive connections -process.send('ready'); diff --git a/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js b/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js index 2eac560cd17..7f748d91c4b 100644 --- a/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js +++ b/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js @@ -194,7 +194,7 @@ describe('waitForStateTransitionResultHandlerFactory', () => { ); driveClientMock = { - fetchProofs: this.sinon.stub().resolves(response.serializeBinary()), + getProofs: this.sinon.stub().resolves(response), }; blockchainListener = new BlockchainListener(tenderDashWsClientMock); @@ -298,7 +298,7 @@ describe('waitForStateTransitionResultHandlerFactory', () => { .setIdentitiesList(identitiesList), ); - expect(driveClientMock.fetchProofs).to.be.calledOnceWithExactly(getProofsRequest); + expect(driveClientMock.getProofs).to.be.calledOnceWithExactly(getProofsRequest); }); it('should wait for state transition and return result with error', (done) => { diff --git a/packages/dapi/test/mocks/config.js b/packages/dapi/test/mocks/config.js index a2bf8360cdd..51d05a05f40 100644 --- a/packages/dapi/test/mocks/config.js +++ b/packages/dapi/test/mocks/config.js @@ -2,10 +2,6 @@ module.exports = { getConfigFixture() { return { dashcore: { - p2p: { - host: '123', - port: '123', - }, rpc: { host: '123', port: '123', diff --git a/packages/dapi/test/unit/config/index.spec.js b/packages/dapi/test/unit/config/index.spec.js index 1579893c842..dce63d7cf3f 100644 --- a/packages/dapi/test/unit/config/index.spec.js +++ b/packages/dapi/test/unit/config/index.spec.js @@ -31,8 +31,8 @@ describe('config/validator', () => { it('Should return errors in array if there are invalid fields in the config', () => { const config = getConfigFixture(); - config.dashcore.p2p.host = 1; - config.dashcore.p2p.port = '$/*'; + config.dashcore.rpc.host = 1; + config.dashcore.rpc.port = '$/*'; const validationResult = validateConfig(config); expect(validationResult.isValid).to.be.false; diff --git a/packages/dapi/test/unit/externalApis/drive/DriveClient.spec.js b/packages/dapi/test/unit/externalApis/drive/DriveClient.spec.js deleted file mode 100644 index 45f2ea3bcb3..00000000000 --- a/packages/dapi/test/unit/externalApis/drive/DriveClient.spec.js +++ /dev/null @@ -1,475 +0,0 @@ -const chai = require('chai'); -const sinon = require('sinon'); -const cbor = require('cbor'); - -const chaiAsPromised = require('chai-as-promised'); -const dirtyChai = require('dirty-chai'); - -const { BytesValue, UInt32Value } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); -const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); -const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); -const { - v0: { - GetIdentitiesByPublicKeyHashesRequest, - GetIdentitiesByPublicKeyHashesResponse, - GetDataContractRequest, - GetDataContractResponse, - GetDocumentsRequest, - GetDocumentsResponse, - GetEpochsInfoRequest, - GetEpochsInfoResponse, - GetIdentityRequest, - GetIdentityResponse, - GetProofsRequest, - GetProofsResponse, - GetProtocolVersionUpgradeStateRequest, - GetProtocolVersionUpgradeStateResponse, - GetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeVoteStatusResponse, - Proof, - ResponseMetadata, - }, -} = require('@dashevo/dapi-grpc'); - -const DriveClient = require('../../../../lib/externalApis/drive/DriveClient'); - -const RPCError = require('../../../../lib/rpcServer/RPCError'); - -chai.use(chaiAsPromised); -chai.use(dirtyChai); - -const { expect } = chai; - -describe('DriveClient', () => { - describe('constructor', () => { - it('Should create drive client with given options', () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - expect(drive.client.options.host).to.be.equal('127.0.0.1'); - expect(drive.client.options.port).to.be.equal(3000); - }); - }); - - it('should throw RPCError if JSON RPC call failed', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const error = new Error('Some RPC error'); - - sinon.stub(drive.client, 'request') - .resolves({ error }); - - try { - await drive.fetchDataContract(new GetDataContractRequest()); - } catch (e) { - expect(e).to.be.an.instanceOf(RPCError); - expect(e.message).to.be.equal(error.message); - expect(e.code).to.be.equal(-32602); - } - }); - - it('should throw ABCI error if response have one', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { - code: GrpcErrorCodes.INVALID_ARGUMENT, - info: cbor.encode({ - data: { - name: 'someData', - }, - message: 'some message', - }).toString('base64'), - }, - }, - }); - - try { - await drive.fetchDataContract(new GetDataContractRequest()); - } catch (e) { - expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); - expect(e.getCode()).to.equal(3); - expect(e.getMessage()).to.equal('some message'); - expect(e.getRawMetadata()).to.deep.equal({ - 'drive-error-data-bin': cbor.encode({ - name: 'someData', - }), - }); - } - }); - - describe('#fetchDataContract', () => { - it('Should call \'fetchContract\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const contractId = 'someId'; - const data = Buffer.from('someData'); - - const { GetDataContractRequestV0 } = GetDataContractRequest; - const request = new GetDataContractRequest(); - request.setV0( - new GetDataContractRequestV0() - .setId(contractId) - .setProve(false), - ); - - const { GetDataContractResponseV0 } = GetDataContractResponse; - const response = new GetDataContractResponse(); - response.setV0( - new GetDataContractResponseV0() - .setDataContract(data), - ); - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchDataContract(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/dataContract', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchDocuments', () => { - it('Should call \'fetchDocuments\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const contractId = 'someId'; - const type = 'object'; - const options = { - where: 'id === someId', - }; - - const { GetDocumentsRequestV0 } = GetDocumentsRequest; - const request = new GetDocumentsRequest(); - request.setV0( - new GetDocumentsRequestV0() - .setDataContractId(contractId) - .setDocumentType(type) - .setWhere(cbor.encode({ where: options.where })), - ); - - const { GetDocumentsResponseV0 } = GetDocumentsResponse; - const response = new GetDocumentsResponse(); - response.setV0( - new GetDocumentsResponseV0() - .setDocuments(new GetDocumentsResponseV0.Documents().setDocumentsList([])), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchDocuments(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/dataContract/documents', - data: Buffer.from(request.serializeBinary()).toString('hex'), // cbor encoded empty object - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchIdentity', () => { - it('Should call \'fetchIdentity\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const identityId = 'someId'; - const data = Buffer.from('someData'); - - const { GetIdentityRequestV0 } = GetIdentityRequest; - const request = new GetIdentityRequest(); - request.setV0( - new GetIdentityRequestV0() - .setId(identityId), - ); - - const { GetIdentityResponseV0 } = GetIdentityResponse; - const response = new GetIdentityResponse(); - response.setV0( - new GetIdentityResponseV0() - .setIdentity(data), - ); - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchIdentity(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/identity', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchIdentitiesByPublicKeyHashes', () => { - it('Should call \'fetchIdentitiesByPublicKeyHashes\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const identity = await getIdentityFixture(); - - const publicKeyHashes = [Buffer.alloc(1)]; - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList(publicKeyHashes) - .setProve(false), - ); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - const response = new GetIdentitiesByPublicKeyHashesResponse(); - response.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(publicKeyHashes[0]) - .setValue(new BytesValue().setValue(identity.toBuffer())), - ]), - ), - ); - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchIdentitiesByPublicKeyHashes(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/identities/by-public-key-hash', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchProofs', () => { - it('should call \'fetchProofs\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const identityIds = [Buffer.from('id')]; - - const request = new GetProofsRequest(); - const { GetProofsRequestV0 } = GetProofsRequest; - request.setV0( - new GetProofsRequestV0() - .setIdentitiesList(identityIds.map((id) => { - const { IdentityRequest } = GetProofsRequestV0; - const identityRequest = new IdentityRequest(); - identityRequest.setIdentityId(id); - identityRequest.setRequestType(IdentityRequest.Type.FULL_IDENTITY); - return identityRequest; - })), - ); - - const { GetProofsResponseV0 } = GetProofsResponse; - const response = new GetProofsResponse(); - response.setV0( - new GetProofsResponseV0() - .setProof(new Proof()) - .setMetadata(new ResponseMetadata()), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchProofs(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/proofs', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); - - describe('#fetchEpochsInfo', () => { - it('should call \'fetchEpochsInfo\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const { GetEpochsInfoRequestV0 } = GetEpochsInfoRequest; - const request = new GetEpochsInfoRequest(); - request.setV0( - new GetEpochsInfoRequestV0() - .setStartEpoch(new UInt32Value([1])) - .setCount(1), - ); - - const { GetEpochsInfoResponseV0 } = GetEpochsInfoResponse; - const response = new GetEpochsInfoResponse(); - const { EpochInfo, EpochInfos } = GetEpochsInfoResponseV0; - response.setV0( - new GetEpochsInfoResponseV0() - .setEpochs(new EpochInfos() - .setEpochInfosList([new EpochInfo() - .setNumber(1) - .setFirstBlockHeight(1) - .setFirstCoreBlockHeight(1) - .setStartTime(Date.now()) - .setFeeMultiplier(1.1)])), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchEpochsInfo(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/epochInfos', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); - - describe('#fetchVersionUpgradeVoteStatus', () => { - it('should call \'fetchEpochsInfo\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const { - GetProtocolVersionUpgradeVoteStatusRequestV0, - } = GetProtocolVersionUpgradeVoteStatusRequest; - const request = new GetProtocolVersionUpgradeVoteStatusRequest(); - request.setV0( - new GetProtocolVersionUpgradeVoteStatusRequestV0() - .setStartProTxHash(Buffer.alloc(32)) - .setCount(1), - ); - - const { - GetProtocolVersionUpgradeVoteStatusResponseV0, - } = GetProtocolVersionUpgradeVoteStatusResponse; - const response = new GetProtocolVersionUpgradeVoteStatusResponse(); - const { VersionSignal, VersionSignals } = GetProtocolVersionUpgradeVoteStatusResponseV0; - response.setV0( - new GetProtocolVersionUpgradeVoteStatusResponseV0() - .setVersions( - new VersionSignals() - .setVersionSignalsList([ - new VersionSignal() - .setProTxHash(Buffer.alloc(32)) - .setVersion(10), - ]), - - ), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchVersionUpgradeVoteStatus(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/versionUpgrade/voteStatus', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); - - describe('#fetchVersionUpgradeState', () => { - it('should call \'fetchEpochsInfo\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const { GetProtocolVersionUpgradeStateRequestV0 } = GetProtocolVersionUpgradeStateRequest; - const request = new GetProtocolVersionUpgradeStateRequest(); - request.setV0(new GetProtocolVersionUpgradeStateRequestV0()); - - const { GetProtocolVersionUpgradeStateResponseV0 } = GetProtocolVersionUpgradeStateResponse; - const response = new GetProtocolVersionUpgradeStateResponse(); - const { Versions, VersionEntry } = GetProtocolVersionUpgradeStateResponseV0; - response.setV0( - new GetProtocolVersionUpgradeStateResponseV0() - .setVersions( - new Versions() - .setVersionsList([ - new VersionEntry() - .setVersionNumber(1) - .setVoteCount(10), - ]), - ), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchVersionUpgradeState(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/versionUpgrade/state', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); -}); diff --git a/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js b/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js index d23051fcc40..841a6e73cac 100644 --- a/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js +++ b/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js @@ -1,4 +1,5 @@ const { expect } = require('chai'); +const crypto = require('crypto'); const { v0: { @@ -18,6 +19,7 @@ describe('fetchProofForStateTransition', () => { let identitiesProofResponse; let dataContractsProofResponse; let documentsProofResponse; + let masternodeVoteResponse; let stateTransitionFixture; beforeEach(async function beforeEach() { @@ -28,15 +30,19 @@ describe('fetchProofForStateTransition', () => { documentsProofResponse.setV0(new GetProofsResponseV0().setProof(new Proof([Buffer.from('documents contracts proof')]))); identitiesProofResponse = new GetProofsResponse(); identitiesProofResponse.setV0(new GetProofsResponseV0().setProof(new Proof([Buffer.from('identities contracts proof')]))); + masternodeVoteResponse = new GetProofsResponse(); + masternodeVoteResponse.setV0(new GetProofsResponseV0().setProof(new Proof([Buffer.from('masternode vote proof')]))); driveClientMock = { - fetchProofs: this.sinon.stub().callsFake(async (requestProto) => { + getProofs: this.sinon.stub().callsFake(async (requestProto) => { if (requestProto.getV0().getIdentitiesList().length > 0) { - return identitiesProofResponse.serializeBinary(); + return identitiesProofResponse; } if (requestProto.getV0().getDocumentsList().length > 0) { - return documentsProofResponse.serializeBinary(); + return documentsProofResponse; } if (requestProto.getV0().getContractsList().length > 0) { - return dataContractsProofResponse.serializeBinary(); + return dataContractsProofResponse; + } if (requestProto.getV0().getVotesList().length > 0) { + return masternodeVoteResponse; } return null; @@ -44,6 +50,7 @@ describe('fetchProofForStateTransition', () => { }; stateTransitionFixture = { + isVotingStateTransition: this.sinon.stub(), isIdentityStateTransition: this.sinon.stub(), isDocumentStateTransition: this.sinon.stub(), isDataContractStateTransition: this.sinon.stub(), @@ -79,6 +86,7 @@ describe('fetchProofForStateTransition', () => { getDataContractId: this.sinon.stub().returns(await generateRandomIdentifierAsync()), getType: this.sinon.stub().returns('niceDocument'), getId: this.sinon.stub().returns(await generateRandomIdentifierAsync()), + hasPrefundedBalance: this.sinon.stub().returns(true), }, ]); @@ -86,4 +94,25 @@ describe('fetchProofForStateTransition', () => { expect(result.serializeBinary()).to.deep .equal(documentsProofResponse.serializeBinary()); }); + + it('should fetch masternode vote proofs', async function it() { + const proTxHash = await generateRandomIdentifierAsync(); + const contractId = await generateRandomIdentifierAsync(); + const documentTypeName = 'documentType'; + const indexName = 'indexName'; + const indexValues = [crypto.randomBytes(32), crypto.randomBytes(32)]; + + stateTransitionFixture.getProTxHash = this.sinon.stub().returns(proTxHash); + stateTransitionFixture.isVotingStateTransition.returns(true); + stateTransitionFixture.getContestedDocumentResourceVotePoll = this.sinon.stub().returns({ + contractId, + documentTypeName, + indexName, + indexValues, + }); + + const result = await fetchProofForStateTransition(stateTransitionFixture); + expect(result.serializeBinary()).to.deep + .equal(masternodeVoteResponse.serializeBinary()); + }); }); diff --git a/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js index c4fed92c388..dabca29bbce 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js @@ -43,7 +43,6 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { getBlock: this.sinon.stub(), getBlockStats: this.sinon.stub(), getBlockHeaders: this.sinon.stub(), - getBestBlockHeight: this.sinon.stub(), getBlockHash: this.sinon.stub(), getBestChainLock: this.sinon.stub(), }; @@ -113,6 +112,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { }); coreAPIMock.getBlockStats.resolves({ height: 1 }); + chainDataProvider.chainHeight = 10; await subscribeToBlockHeadersWithChainLocksHandler(call); @@ -165,6 +165,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { }); coreAPIMock.getBlockStats.resolves({ height: 1 }); + chainDataProvider.chainHeight = 10; await subscribeToBlockHeadersWithChainLocksHandler(call); @@ -213,7 +214,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { coreAPIMock.getBlockStats.resolves({ height: 10 }); - coreAPIMock.getBestBlockHeight.resolves(11); + chainDataProvider.chainHeight = 11; await subscribeToBlockHeadersWithChainLocksHandler(call); diff --git a/packages/dapi/test/unit/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.spec.js new file mode 100644 index 00000000000..43c41f24dd7 --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.spec.js @@ -0,0 +1,110 @@ +const { + v0: { + GetBlockchainStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getBlockchainStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getBlockchainStatusHandlerFactory', () => { + let call; + let getBlockchainStatusHandler; + let coreRPCClientMock; + let now; + + let blockchainInfo; + let networkInfo; + let coreZmqClientMock; + + beforeEach(function beforeEach() { + blockchainInfo = { + chain: 'test', + blocks: 460991, + headers: 460991, + bestblockhash: '0000007464fd8cae97830d794bf03efbeaa4b8c3258a3def67a89cdbd060f827', + difficulty: 0.002261509525429119, + mediantime: 1615546573, + verificationprogress: 0.9999993798366165, + initialblockdownload: false, + chainwork: '000000000000000000000000000000000000000000000000022f149b98e063dc', + warnings: 'Warning: unknown new rules activated (versionbit 3)', + }; + + networkInfo = { + version: 170000, + subversion: '/Dash Core:0.17.0/', + protocolversion: 70218, + localservices: '0000000000000405', + localrelay: true, + timeoffset: 0, + networkactive: true, + connections: 8, + socketevents: 'select', + relayfee: 0.00001, + incrementalfee: 0.00001, + warnings: 'Warning: unknown new rules activated (versionbit 3)', + }; + + call = new GrpcCallMock(this.sinon); + + coreRPCClientMock = { + getBlockchainInfo: this.sinon.stub().resolves(blockchainInfo), + getNetworkInfo: this.sinon.stub().resolves(networkInfo), + }; + + coreZmqClientMock = { on: this.sinon.stub(), topics: { hashblock: 'fake' } }; + + now = new Date(); + this.sinon.useFakeTimers(now.getTime()); + + getBlockchainStatusHandler = getBlockchainStatusHandlerFactory( + coreRPCClientMock, + coreZmqClientMock, + ); + }); + + it('should return valid result', async () => { + const result = await getBlockchainStatusHandler(call); + + expect(result).to.be.an.instanceOf(GetBlockchainStatusResponse); + + // Validate protobuf object values + result.serializeBinary(); + + const version = result.getVersion(); + expect(version.getProtocol()).to.equal(networkInfo.protocolversion); + expect(version.getSoftware()).to.equal(networkInfo.version); + expect(version.getAgent()).to.equal(networkInfo.subversion); + + const time = result.getTime(); + expect(time.getNow()).to.be.an('number'); + expect(time.getNow()).to.equal(Math.floor(now.getTime() / 1000)); + expect(time.getOffset()).to.be.equal(networkInfo.timeoffset); + expect(time.getMedian()).to.be.equal(blockchainInfo.mediantime); + + const chain = result.getChain(); + expect(chain.getName()).to.be.equal(blockchainInfo.chain); + expect(chain.getBlocksCount()).to.be.equal(blockchainInfo.blocks); + expect(chain.getHeadersCount()).to.be.equal(blockchainInfo.headers); + expect(chain.getBestBlockHash()).to.be.an.instanceOf(Buffer); + expect(chain.getBestBlockHash().toString('hex')).to.be.equal(blockchainInfo.bestblockhash); + expect(chain.getDifficulty()).to.be.equal(blockchainInfo.difficulty); + expect(chain.getChainWork()).to.be.an.instanceOf(Buffer); + expect(chain.getChainWork().toString('hex')).to.be.equal(blockchainInfo.chainwork); + expect(chain.getIsSynced()).to.be.equal(blockchainInfo.verificationprogress === 1); + expect(chain.getSyncProgress()).to.be.equal(blockchainInfo.verificationprogress); + + const network = result.getNetwork(); + expect(network.getPeersCount()).to.be.equal(networkInfo.connections); + + const fee = network.getFee(); + expect(fee.getRelay()).to.be.equal(networkInfo.relayfee); + expect(fee.getIncremental()).to.be.equal(networkInfo.incrementalfee); + + expect(result.getStatus()).to.be.equal(GetBlockchainStatusResponse.Status.SYNCING); + expect(coreRPCClientMock.getBlockchainInfo).to.be.calledOnce(); + expect(coreRPCClientMock.getNetworkInfo).to.be.calledOnce(); + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.spec.js new file mode 100644 index 00000000000..0465462a086 --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.spec.js @@ -0,0 +1,84 @@ +const { + v0: { + GetMasternodeStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getMasternodeStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getMasternodeStatusHandlerFactory', () => { + let call; + let getMasternodeStatusHandler; + let coreRPCClientMock; + let now; + + let mnSyncInfo; + let masternodeStatus; + + beforeEach(function beforeEach() { + mnSyncInfo = { + AssetID: 999, + AssetName: 'MASTERNODE_SYNC_FINISHED', + AssetStartTime: 1615466139, + Attempt: 0, + IsBlockchainSynced: true, + IsSynced: true, + }; + + masternodeStatus = { + outpoint: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357-0', + service: '45.32.237.76:19999', + proTxHash: '04d06d16b3eca2f104ef9749d0c1c17d183eb1b4fe3a16808fd70464f03bcd63', + collateralHash: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357', + collateralIndex: 0, + dmnState: { + service: '45.32.237.76:19999', + registeredHeight: 7402, + lastPaidHeight: 59721, + PoSePenalty: 0, + PoSeRevivedHeight: 61915, + PoSeBanHeight: -1, + revocationReason: 0, + ownerAddress: 'yT8DDY5NkX4ZtBkUVz7y1RgzbakCnMPogh', + votingAddress: 'yMLrhooXyJtpV3R2ncsxvkrh6wRennNPoG', + payoutAddress: 'yTsGq4wV8WF5GKLaYV2C43zrkr2sfTtysT', + pubKeyOperator: '02a2e2673109a5e204f8a82baf628bb5f09a8dfc671859e84d2661cae03e6c6e198a037e968253e94cd099d07b98e94e', + }, + state: 'READY', + status: 'Ready', + }; + + call = new GrpcCallMock(this.sinon); + + coreRPCClientMock = { + getMnSync: this.sinon.stub().resolves(mnSyncInfo), + getMasternode: this.sinon.stub().resolves(masternodeStatus), + }; + + now = new Date(); + this.sinon.useFakeTimers(now.getTime()); + + getMasternodeStatusHandler = getMasternodeStatusHandlerFactory(coreRPCClientMock); + }); + + it('should return valid result', async () => { + const result = await getMasternodeStatusHandler(call); + + expect(result).to.be.an.instanceOf(GetMasternodeStatusResponse); + + // Validate protobuf object values + result.serializeBinary(); + + expect(result.getStatus()).to.be.equal(GetMasternodeStatusResponse.Status.READY); + expect(result.getProTxHash()).to.be.an.instanceOf(Buffer); + expect(result.getProTxHash().toString('hex')).to.be.equal(masternodeStatus.proTxHash); + expect(result.getPosePenalty()).to.be.equal(masternodeStatus.dmnState.PoSePenalty); + expect(result.getIsSynced()).to.be.equal(mnSyncInfo.IsSynced); + expect(result.getSyncProgress()).to.be.equal(1); + + expect(coreRPCClientMock.getMnSync).to.be.calledOnceWith('status'); + expect(coreRPCClientMock.getMasternode).to.be.calledOnceWith('status'); + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/core/getStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/core/getStatusHandlerFactory.spec.js deleted file mode 100644 index 1a1558a444c..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/core/getStatusHandlerFactory.spec.js +++ /dev/null @@ -1,150 +0,0 @@ -const { - v0: { - GetStatusResponse, - }, -} = require('@dashevo/dapi-grpc'); - -const getStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/core/getStatusHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getStatusHandlerFactory', () => { - let call; - let getStatusHandler; - let coreRPCClientMock; - let now; - - let blockchainInfo; - let networkInfo; - let mnSyncInfo; - let masternodeStatus; - - beforeEach(function beforeEach() { - mnSyncInfo = { - AssetID: 999, - AssetName: 'MASTERNODE_SYNC_FINISHED', - AssetStartTime: 1615466139, - Attempt: 0, - IsBlockchainSynced: true, - IsSynced: true, - }; - - blockchainInfo = { - chain: 'test', - blocks: 460991, - headers: 460991, - bestblockhash: '0000007464fd8cae97830d794bf03efbeaa4b8c3258a3def67a89cdbd060f827', - difficulty: 0.002261509525429119, - mediantime: 1615546573, - verificationprogress: 0.9999993798366165, - initialblockdownload: false, - chainwork: '000000000000000000000000000000000000000000000000022f149b98e063dc', - warnings: 'Warning: unknown new rules activated (versionbit 3)', - }; - - networkInfo = { - version: 170000, - subversion: '/Dash Core:0.17.0/', - protocolversion: 70218, - localservices: '0000000000000405', - localrelay: true, - timeoffset: 0, - networkactive: true, - connections: 8, - socketevents: 'select', - relayfee: 0.00001, - incrementalfee: 0.00001, - warnings: 'Warning: unknown new rules activated (versionbit 3)', - }; - - masternodeStatus = { - outpoint: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357-0', - service: '45.32.237.76:19999', - proTxHash: '04d06d16b3eca2f104ef9749d0c1c17d183eb1b4fe3a16808fd70464f03bcd63', - collateralHash: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357', - collateralIndex: 0, - dmnState: { - service: '45.32.237.76:19999', - registeredHeight: 7402, - lastPaidHeight: 59721, - PoSePenalty: 0, - PoSeRevivedHeight: 61915, - PoSeBanHeight: -1, - revocationReason: 0, - ownerAddress: 'yT8DDY5NkX4ZtBkUVz7y1RgzbakCnMPogh', - votingAddress: 'yMLrhooXyJtpV3R2ncsxvkrh6wRennNPoG', - payoutAddress: 'yTsGq4wV8WF5GKLaYV2C43zrkr2sfTtysT', - pubKeyOperator: '02a2e2673109a5e204f8a82baf628bb5f09a8dfc671859e84d2661cae03e6c6e198a037e968253e94cd099d07b98e94e', - }, - state: 'READY', - status: 'Ready', - }; - - call = new GrpcCallMock(this.sinon); - - coreRPCClientMock = { - getBlockchainInfo: this.sinon.stub().resolves(blockchainInfo), - getNetworkInfo: this.sinon.stub().resolves(networkInfo), - getMnSync: this.sinon.stub().resolves(mnSyncInfo), - getMasternode: this.sinon.stub().resolves(masternodeStatus), - }; - - now = new Date(); - this.sinon.useFakeTimers(now.getTime()); - - getStatusHandler = getStatusHandlerFactory(coreRPCClientMock); - }); - - it('should return valid result', async () => { - const result = await getStatusHandler(call); - - expect(result).to.be.an.instanceOf(GetStatusResponse); - - // Validate protobuf object values - result.serializeBinary(); - - const version = result.getVersion(); - expect(version.getProtocol()).to.equal(networkInfo.protocolversion); - expect(version.getSoftware()).to.equal(networkInfo.version); - expect(version.getAgent()).to.equal(networkInfo.subversion); - - const time = result.getTime(); - expect(time.getNow()).to.be.an('number'); - expect(time.getNow()).to.equal(Math.floor(now.getTime() / 1000)); - expect(time.getOffset()).to.be.equal(networkInfo.timeoffset); - expect(time.getMedian()).to.be.equal(blockchainInfo.mediantime); - - const chain = result.getChain(); - expect(chain.getName()).to.be.equal(blockchainInfo.chain); - expect(chain.getBlocksCount()).to.be.equal(blockchainInfo.blocks); - expect(chain.getHeadersCount()).to.be.equal(blockchainInfo.headers); - expect(chain.getBestBlockHash()).to.be.an.instanceOf(Buffer); - expect(chain.getBestBlockHash().toString('hex')).to.be.equal(blockchainInfo.bestblockhash); - expect(chain.getDifficulty()).to.be.equal(blockchainInfo.difficulty); - expect(chain.getChainWork()).to.be.an.instanceOf(Buffer); - expect(chain.getChainWork().toString('hex')).to.be.equal(blockchainInfo.chainwork); - expect(chain.getIsSynced()).to.be.equal(mnSyncInfo.IsBlockchainSynced); - expect(chain.getSyncProgress()).to.be.equal(blockchainInfo.verificationprogress); - - const masternode = result.getMasternode(); - expect(masternode.getStatus()).to.be.equal(GetStatusResponse.Masternode.Status.READY); - expect(masternode.getProTxHash()).to.be.an.instanceOf(Buffer); - expect(masternode.getProTxHash().toString('hex')).to.be.equal(masternodeStatus.proTxHash); - expect(masternode.getPosePenalty()).to.be.equal(masternodeStatus.dmnState.PoSePenalty); - expect(masternode.getIsSynced()).to.be.equal(mnSyncInfo.IsSynced); - expect(masternode.getSyncProgress()).to.be.equal(1); - - const network = result.getNetwork(); - expect(network.getPeersCount()).to.be.equal(networkInfo.connections); - - const fee = network.getFee(); - expect(fee.getRelay()).to.be.equal(networkInfo.relayfee); - expect(fee.getIncremental()).to.be.equal(networkInfo.incrementalfee); - - expect(result.getStatus()).to.be.equal(GetStatusResponse.Status.READY); - expect(coreRPCClientMock.getBlockchainInfo).to.be.calledOnce(); - expect(coreRPCClientMock.getNetworkInfo).to.be.calledOnce(); - expect(coreRPCClientMock.getMnSync).to.be.calledOnceWith('status'); - expect(coreRPCClientMock.getMasternode).to.be.calledOnceWith('status'); - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js b/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js index 88420d1f437..48a4c32e78d 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js @@ -66,23 +66,23 @@ describe('createGrpcErrorFromDriveResponse', () => { }); }); - it('should throw basic consensus error if error code = 1000', async () => { + it('should throw basic consensus error if error code = 10000', async () => { const consensusError = new ProtocolVersionParsingError('test'); const data = { serializedError: consensusError.serialize() }; info = { data }; - const error = await createGrpcErrorFromDriveResponse(1000, cbor.encode(info).toString('base64')); + const error = await createGrpcErrorFromDriveResponse(10000, cbor.encode(info).toString('base64')); expect(error).to.be.an.instanceOf(InvalidArgumentGrpcError); expect(error.message).to.be.equals(consensusError.message); expect(error.getRawMetadata()).to.deep.equal({ - code: 1000, + code: 10000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw signature consensus error if error code = 2000', async () => { + it('should throw signature consensus error if error code = 20000', async () => { const id = await generateRandomIdentifierAsync(); const consensusError = new IdentityNotFoundError(id); @@ -91,7 +91,7 @@ describe('createGrpcErrorFromDriveResponse', () => { info = { data }; const error = await createGrpcErrorFromDriveResponse( - 2000, + 20000, cbor.encode(info).toString('base64'), ); @@ -99,27 +99,27 @@ describe('createGrpcErrorFromDriveResponse', () => { expect(error.message).to.be.equals(consensusError.message); expect(error.getCode()).to.equal(GrpcErrorCodes.UNAUTHENTICATED); expect(error.getRawMetadata()).to.deep.equal({ - code: 2000, + code: 20000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw fee consensus error if error code = 3000', async () => { + it('should throw fee consensus error if error code = 30000', async () => { const consensusError = new BalanceIsNotEnoughError(BigInt(20), BigInt(10)); const data = { serializedError: consensusError.serialize() }; info = { data }; - const error = await createGrpcErrorFromDriveResponse(3000, cbor.encode(info).toString('base64')); + const error = await createGrpcErrorFromDriveResponse(30000, cbor.encode(info).toString('base64')); expect(error).to.be.an.instanceOf(FailedPreconditionGrpcError); expect(error.getRawMetadata()).to.deep.equal({ - code: 3000, + code: 30000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw state consensus error if error code = 4000', async () => { + it('should throw state consensus error if error code = 40000', async () => { const dataContractId = await generateRandomIdentifierAsync(); const consensusError = new DataContractAlreadyPresentError(dataContractId); @@ -128,23 +128,23 @@ describe('createGrpcErrorFromDriveResponse', () => { info = { data }; const error = await createGrpcErrorFromDriveResponse( - 4000, + 40000, cbor.encode(info).toString('base64'), ); expect(error).to.be.an.instanceOf(InvalidArgumentGrpcError); expect(error.getRawMetadata()).to.deep.equal({ - code: 4000, + code: 40000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw Unknown error code >= 5000', async () => { - const error = await createGrpcErrorFromDriveResponse(5000, encodedInfo); + it('should throw Unknown error code >= 50000', async () => { + const error = await createGrpcErrorFromDriveResponse(50000, encodedInfo); expect(error).to.be.an.instanceOf(GrpcError); expect(error.getMessage()).to.equal('Internal error'); - expect(error.getError().message).to.deep.equal('Unknown Drive’s error code: 5000'); + expect(error.getError().message).to.deep.equal('Unknown Drive’s error code: 50000'); }); it('should return InternalGrpcError if codes is undefined', async () => { diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js index 5f5a2cdf257..3dc61b2eb40 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js @@ -3,6 +3,8 @@ const { error: { InvalidArgumentGrpcError, AlreadyExistsGrpcError, + UnavailableGrpcError, + ResourceExhaustedGrpcError, }, }, } = require('@dashevo/grpc-common'); @@ -112,26 +114,75 @@ describe('broadcastStateTransitionHandlerFactory', () => { const tx = stateTransitionFixture.toBuffer().toString('base64'); expect(result).to.be.an.instanceOf(BroadcastStateTransitionResponse); - expect(rpcClientMock.request).to.be.calledOnceWith('broadcast_tx_sync', { tx }); + expect(rpcClientMock.request).to.be.calledOnceWith('broadcast_tx', { tx }); }); - it('should throw an error if transaction broadcast returns error', async () => { - const error = { code: -1, message: "Something didn't work", data: 'Some data' }; + it('should throw a UnavailableGrpcError if tenderdash hands up', async () => { + const error = new Error('socket hang up'); + rpcClientMock.request.throws(error); - response.error = error; + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw UnavailableGrpcError'); + } catch (e) { + expect(e).to.be.an.instanceOf(UnavailableGrpcError); + expect(e.getMessage()).to.equal('Tenderdash is not available'); + } + }); + + it('should throw a UnavailableGrpcError if broadcast confirmation not received', async () => { + response.error = { + code: -32603, + message: 'Internal error', + data: 'broadcast confirmation not received: heya', + }; try { await broadcastStateTransitionHandler(call); - expect.fail('should throw an error'); + expect.fail('should throw UnavailableGrpcError'); } catch (e) { - expect(e.message).to.equal(error.message); - expect(e.data).to.equal(error.data); - expect(e.code).to.equal(error.code); + expect(e).to.be.an.instanceOf(UnavailableGrpcError); + expect(e.getMessage()).to.equal(response.error.data); } }); - it('should throw FailedPreconditionGrpcError if transaction was broadcasted twice', async () => { + it('should throw an InvalidArgumentGrpcError if state transition size is too big', async () => { + response.error = { + code: -32603, + message: 'Internal error', + data: 'Tx too large. La la la', + }; + + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw UnavailableGrpcError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); + expect(e.getMessage()).to.equal('state transition is too large. La la la'); + } + }); + + it('should throw a ResourceExhaustedGrpcError if mempool is full', async () => { + response.error = { + code: -32603, + message: 'Internal error', + data: 'mempool is full: heya', + }; + + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw UnavailableGrpcError'); + } catch (e) { + expect(e).to.be.an.instanceOf(ResourceExhaustedGrpcError); + expect(e.getMessage()).to.equal(response.error.data); + } + }); + + it('should throw AlreadyExistsGrpcError if transaction was broadcasted twice', async () => { response.error = { code: -32603, message: 'Internal error', @@ -144,11 +195,11 @@ describe('broadcastStateTransitionHandlerFactory', () => { expect.fail('should throw AlreadyExistsGrpcError'); } catch (e) { expect(e).to.be.an.instanceOf(AlreadyExistsGrpcError); - expect(e.getMessage()).to.equal('State transition already in chain'); + expect(e.getMessage()).to.equal('state transition already in chain'); } }); - it('should throw call createGrpcErrorFromDriveResponse if error code is not 0', async () => { + it('should throw a gRPC error based on drive\'s response', async () => { const message = 'not found'; const metadata = { data: 'some data', @@ -176,4 +227,20 @@ describe('broadcastStateTransitionHandlerFactory', () => { ); } }); + + it('should throw an error if transaction broadcast returns unknown error', async () => { + const error = { code: -1, message: "Something didn't work", data: 'Some data' }; + + response.error = error; + + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw an error'); + } catch (e) { + expect(e.message).to.equal(error.message); + expect(e.data).to.equal(error.data); + expect(e.code).to.equal(error.code); + } + }); }); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getConsensusParamsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getConsensusParamsHandlerFactory.spec.js deleted file mode 100644 index f80d580d09e..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getConsensusParamsHandlerFactory.spec.js +++ /dev/null @@ -1,159 +0,0 @@ -const { - v0: { - GetConsensusParamsResponse, - }, -} = require('@dashevo/dapi-grpc'); -const { - server: { - error: { - InternalGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); -const FailedPreconditionGrpcError = require('@dashevo/grpc-common/lib/server/error/FailedPreconditionGrpcError'); -const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); -const getConsensusParamsHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getConsensusParamsHandlerFactory'); -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); -const RPCError = require('../../../../../lib/rpcServer/RPCError'); - -describe('getConsensusParamsHandlerFactory', () => { - let getConsensusParamsHandler; - let getConsensusParamsMock; - let consensusParamsFixture; - let request; - let call; - - beforeEach(function beforeEach() { - request = { - getHeight: this.sinon.stub().returns(0), // gRPC returns 0 if in parameter is empty - getProve: this.sinon.stub().returns(false), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - consensusParamsFixture = { - block: { - max_bytes: '22020096', - max_gas: '1000', - time_iota_ms: '1000', - }, - evidence: { - max_age_num_blocks: '100000', - max_age_duration: '200000', - max_bytes: '22020096', - }, - validator: { - pub_key_types: [ - 'ed25519', - ], - }, - }; - - getConsensusParamsMock = this.sinon.stub().resolves(consensusParamsFixture); - - getConsensusParamsHandler = getConsensusParamsHandlerFactory( - getConsensusParamsMock, - ); - }); - - it('should return valid data', async () => { - const result = await getConsensusParamsHandler(call); - - expect(result).to.be.an.instanceOf(GetConsensusParamsResponse); - - const block = result.getV0().getBlock(); - expect(block).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsBlock); - expect(block.getMaxBytes()).to.equal(consensusParamsFixture.block.max_bytes); - expect(block.getMaxGas()).to.equal(consensusParamsFixture.block.max_gas); - expect(block.getTimeIotaMs()).to.equal(consensusParamsFixture.block.time_iota_ms); - - const evidence = result.getV0().getEvidence(); - expect(evidence).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsEvidence); - expect(evidence.getMaxBytes()).to.equal(consensusParamsFixture.evidence.max_bytes); - expect(evidence.getMaxAgeDuration()).to.equal(consensusParamsFixture.evidence.max_age_duration); - expect(evidence.getMaxAgeNumBlocks()) - .to.equal(consensusParamsFixture.evidence.max_age_num_blocks); - - expect(getConsensusParamsMock).to.be.calledOnceWith(undefined); - }); - - it('should throw FailedPreconditionGrpcError', async () => { - const error = new RPCError(-32603, 'invalid height', 'some data'); - getConsensusParamsMock.throws(error); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw FailedPreconditionGrpcError'); - } catch (e) { - expect(e).to.be.an.instanceOf(FailedPreconditionGrpcError); - expect(e.getMessage()).to.equal('Invalid height: some data'); - expect(e.getCode()).to.equal(9); - } - }); - - it('should throw InternalGrpcError', async () => { - const error = new RPCError(32602, 'invalid height', 'some data'); - getConsensusParamsMock.throws(error); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw InternalGrpcError'); - } catch (e) { - expect(e).to.be.an.instanceOf(InternalGrpcError); - expect(e.getError()).to.equal(e.getError()); - } - }); - - it('should throw InvalidArgumentGrpcError', async () => { - request.getProve.returns(true); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError'); - } catch (e) { - expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('Prove is not implemented yet'); - } - }); - - it('should throw unknown error', async () => { - const error = new Error('unknown error'); - getConsensusParamsMock.throws(error); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw InternalGrpcError'); - } catch (e) { - expect(e).to.equal(e); - } - }); - - it('should return valid data for height', async () => { - request.getHeight.returns(42); - - const result = await getConsensusParamsHandler(call); - - expect(result).to.be.an.instanceOf(GetConsensusParamsResponse); - - const block = result.getV0().getBlock(); - expect(block).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsBlock); - expect(block.getMaxBytes()).to.equal(consensusParamsFixture.block.max_bytes); - expect(block.getMaxGas()).to.equal(consensusParamsFixture.block.max_gas); - expect(block.getTimeIotaMs()).to.equal(consensusParamsFixture.block.time_iota_ms); - - const evidence = result.getV0().getEvidence(); - expect(evidence).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsEvidence); - expect(evidence.getMaxBytes()).to.equal(consensusParamsFixture.evidence.max_bytes); - expect(evidence.getMaxAgeDuration()).to.equal(consensusParamsFixture.evidence.max_age_duration); - expect(evidence.getMaxAgeNumBlocks()) - .to.equal(consensusParamsFixture.evidence.max_age_num_blocks); - - expect(getConsensusParamsMock).to.be.calledOnceWith(42); - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractHandlerFactory.spec.js deleted file mode 100644 index f7a62f92933..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractHandlerFactory.spec.js +++ /dev/null @@ -1,163 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getDataContractFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getDataContractFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getDataContractHandlerFactory = require( - '../../../../../lib/grpcServer/handlers/platform/getDataContractHandlerFactory', -); - -describe('getDataContractHandlerFactory', () => { - let call; - let getDataContractHandler; - let driveClientMock; - let request; - let id; - let dataContractFixture; - let proofFixture; - let proofMock; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - dataContractFixture = await getDataContractFixture(); - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - response = new GetDataContractResponse(); - response.setV0( - new GetDataContractResponse.GetDataContractResponseV0() - .setDataContract(dataContractFixture.toBuffer()), - ); - - proofResponse = new GetDataContractResponse(); - proofResponse.setV0( - new GetDataContractResponse.GetDataContractResponseV0() - .setProof(proofMock), - ); - - driveClientMock = { - fetchDataContract: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getDataContractHandler = getDataContractHandlerFactory( - driveClientMock, - ); - }); - - it('should return data contract', async () => { - const result = await getDataContractHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractResponse); - - const contractBinary = result.getV0().getDataContract(); - expect(contractBinary).to.be.an.instanceOf(Uint8Array); - - expect(contractBinary).to.deep.equal(dataContractFixture.toBuffer()); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - }); - - it('should return proof', async function it() { - driveClientMock = { - fetchDataContract: this.sinon.stub().resolves(proofResponse.serializeBinary()), - }; - - getDataContractHandler = getDataContractHandlerFactory( - driveClientMock, - ); - - const result = await getDataContractHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractResponse); - - const contractBinary = result.getV0().getDataContract(); - expect(contractBinary).to.be.equal(''); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveClientMock.fetchDataContract).to.be.calledOnceWith(call.request); - }); - - it('should not include proof', async () => { - request.getProve.returns(false); - response.getV0().setProof(null); - driveClientMock.fetchDataContract.resolves(response.serializeBinary()); - - const result = await getDataContractHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractResponse); - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - - expect(driveClientMock.fetchDataContract).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if id is not specified', async () => { - id = null; - request.getId.returns(id); - - try { - await getDataContractHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('id is not specified'); - expect(driveClientMock.fetchDataContract).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - driveClientMock.fetchDataContract.throws(abciResponseError); - - try { - await getDataContractHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractsHandlerFactory.spec.js deleted file mode 100644 index 3eee6b5b0a2..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractsHandlerFactory.spec.js +++ /dev/null @@ -1,144 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractsResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getDataContractFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getDataContractFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getDataContractsHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getDataContractsHandlerFactory'); - -const { - DataContractEntry, - DataContracts, - GetDataContractsResponseV0, -} = GetDataContractsResponse; - -describe('getDataContractsHandlerFactory', () => { - let call; - let getDataContractsHandler; - let request; - let id; - let dataContractEntries; - let fetchDataContractsMock; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getIdsList: this.sinon.stub().returns([id]), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchDataContractsMock = this.sinon.stub(); - - getDataContractsHandler = getDataContractsHandlerFactory({ - fetchDataContracts: fetchDataContractsMock, - }); - }); - - it('should return data contracts', async () => { - const dataContractFixture = await getDataContractFixture(); - - const dataContractEntry = new DataContractEntry(); - dataContractEntry.setIdentifier(id.toBuffer()); - dataContractEntry.setDataContract(new BytesValue().setValue(dataContractFixture.toBuffer())); - - dataContractEntries = [ - dataContractEntry, - ]; - - const dataContracts = new DataContracts(); - dataContracts.setDataContractEntriesList(dataContractEntries); - - const response = new GetDataContractsResponse().setV0( - new GetDataContractsResponseV0().setDataContracts(dataContracts), - ); - - fetchDataContractsMock.resolves(response.serializeBinary()); - - const result = await getDataContractsHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractsResponse); - - const contractBinaries = result.getV0().getDataContracts().getDataContractEntriesList(); - - expect(contractBinaries).to.deep.equal(dataContractEntries); - - expect(fetchDataContractsMock).to.be.calledOnceWith(call.request); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetDataContractsResponse() - .setV0(new GetDataContractsResponseV0().setProof(proofMock)); - - fetchDataContractsMock.resolves(response.serializeBinary()); - - const result = await getDataContractsHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractsResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchDataContractsMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getIdsList.returns(null); - - try { - await getDataContractsHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('data contract ids are not specified'); - expect(fetchDataContractsMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchDataContractsMock.throws(abciResponseError); - - try { - await getDataContractsHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getDocumentsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getDocumentsHandlerFactory.spec.js deleted file mode 100644 index 69aff5ffb0b..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getDocumentsHandlerFactory.spec.js +++ /dev/null @@ -1,193 +0,0 @@ -const cbor = require('cbor'); - -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDocumentsResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getDocumentsFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getDocumentsFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getDocumentsHandlerFactory = require( - '../../../../../lib/grpcServer/handlers/platform/getDocumentsHandlerFactory', -); - -describe('getDocumentsHandlerFactory', () => { - let call; - let getDocumentsHandler; - let driveStateRepositoryMock; - let request; - let documentsFixture; - let dataContractId; - let documentType; - let where; - let orderBy; - let limit; - let startAfter; - let startAt; - let documentsSerialized; - let proofFixture; - let response; - let proofMock; - let proofResponse; - - beforeEach(async function beforeEach() { - dataContractId = await generateRandomIdentifierAsync(); - documentType = 'document'; - where = [['name', '==', 'John']]; - orderBy = [{ order: 'asc' }]; - limit = 20; - startAfter = new Uint8Array((await generateRandomIdentifierAsync()).toBuffer()); - startAt = new Uint8Array([]); - - request = { - getDataContractId: this.sinon.stub().returns(dataContractId), - getDocumentType: this.sinon.stub().returns(documentType), - getWhere_asU8: this.sinon.stub().returns(new Uint8Array(cbor.encode(where))), - getOrderBy_asU8: this.sinon.stub().returns(new Uint8Array(cbor.encode(orderBy))), - getLimit: this.sinon.stub().returns(limit), - getStartAfter_asU8: this.sinon.stub().returns(startAfter), - getStartAt_asU8: this.sinon.stub().returns(startAt), - getProve: this.sinon.stub().returns(false), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - const [document] = await getDocumentsFixture(); - - documentsFixture = [document]; - - documentsSerialized = documentsFixture.map((documentItem) => documentItem.toBuffer()); - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const { GetDocumentsResponseV0 } = GetDocumentsResponse; - response = new GetDocumentsResponse(); - response.setV0( - new GetDocumentsResponseV0() - .setDocuments( - new GetDocumentsResponseV0.Documents() - .setDocumentsList(documentsSerialized), - ), - ); - - proofResponse = new GetDocumentsResponse(); - proofResponse.setV0( - new GetDocumentsResponseV0().setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchDocuments: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getDocumentsHandler = getDocumentsHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - response.getV0().setProof(null); - - const result = await getDocumentsHandler(call); - - expect(result).to.be.an.instanceOf(GetDocumentsResponse); - const documents = result.getV0().getDocuments(); - - const documentsBinary = documents.getDocumentsList(); - expect(documentsBinary).to.be.an('array'); - expect(documentsBinary).to.have.lengthOf(documentsFixture.length); - - expect(driveStateRepositoryMock.fetchDocuments).to.be.calledOnceWith( - call.request, - ); - - expect(documentsBinary[0]).to.deep.equal(documentsSerialized[0]); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - driveStateRepositoryMock.fetchDocuments.resolves(proofResponse.serializeBinary()); - - const result = await getDocumentsHandler(call); - - expect(result).to.be.an.instanceOf(GetDocumentsResponse); - - expect(driveStateRepositoryMock.fetchDocuments).to.be.calledOnceWith( - call.request, - ); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - }); - - it('should throw InvalidArgumentGrpcError if dataContractId is not specified', async () => { - dataContractId = null; - request.getDataContractId.returns(dataContractId); - - try { - await getDocumentsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('dataContractId is not specified'); - expect(driveStateRepositoryMock.fetchDocuments).to.be.not.called(); - } - }); - - it('should throw InvalidArgumentGrpcError if documentType is not specified', async () => { - documentType = null; - request.getDocumentType.returns(documentType); - - try { - await getDocumentsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('documentType is not specified'); - expect(driveStateRepositoryMock.fetchDocuments).to.be.not.called(); - } - }); - - it('should throw error if fetchDocuments throws an error', async () => { - const error = new Error('Some error'); - - driveStateRepositoryMock.fetchDocuments.throws(error); - - try { - await getDocumentsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.equal(error); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.spec.js deleted file mode 100644 index 151f43b4e87..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.spec.js +++ /dev/null @@ -1,113 +0,0 @@ -const { - v0: { - GetEpochsInfoResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getEpochsInfoHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getEpochsInfoHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let getEpochsInfoHandler; - let epochNumber; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - epochNumber = 1; - const { GetEpochsInfoResponseV0 } = GetEpochsInfoResponse; - const { EpochInfos, EpochInfo } = GetEpochsInfoResponseV0; - response = new GetEpochsInfoResponse(); - response.setV0( - new GetEpochsInfoResponseV0() - .setEpochs(new EpochInfos() - .setEpochInfosList([new EpochInfo() - .setNumber(epochNumber) - .setFirstBlockHeight(1) - .setFirstCoreBlockHeight(1) - .setStartTime(Date.now()) - .setFeeMultiplier(1.1)])), - ); - - proofResponse = new GetEpochsInfoResponse(); - proofResponse.setV0( - new GetEpochsInfoResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchEpochsInfo: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getEpochsInfoHandler = getEpochsInfoHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getEpochsInfoHandler(call); - - expect(result).to.be.an.instanceOf(GetEpochsInfoResponse); - expect(result.getV0() - .getEpochs().getEpochInfosList()[0].getNumber()).to.equal(epochNumber); - expect(driveStateRepositoryMock.fetchEpochsInfo).to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchEpochsInfo.resolves(proofResponse.serializeBinary()); - - const result = await getEpochsInfoHandler(call); - - expect(result).to.be.an.instanceOf(GetEpochsInfoResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchEpochsInfo).to.be.calledOnceWith(call.request); - }); - - it('should throw an error when fetchEpochsInfo throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchEpochsInfo.throws(error); - - try { - await getEpochsInfoHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchEpochsInfo).to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.spec.js deleted file mode 100644 index 00388413e2f..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.spec.js +++ /dev/null @@ -1,159 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesByPublicKeyHashesResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const getIdentitiesByPublicKeyHashesHandlerFactory = require( - '../../../../../lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory', -); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getIdentitiesByPublicKeyHashesHandlerFactory', () => { - let call; - let driveClientMock; - let getIdentitiesByPublicKeyHashesHandler; - let identity; - let publicKeyHash; - let proofFixture; - let proofMock; - let response; - let proofResponse; - let request; - - beforeEach(async function beforeEach() { - publicKeyHash = Buffer.from('556c2910d46fda2b327ef9d9bda850cc84d30db0', 'hex'); - - request = { - getPublicKeyHashesList: this.sinon.stub().returns( - [publicKeyHash], - ), - getProve: this.sinon.stub().returns(false), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - identity = await getIdentityFixture(); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - response = new GetIdentitiesByPublicKeyHashesResponse(); - response.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(publicKeyHash) - .setValue(new BytesValue().setValue(identity.toBuffer())), - ]), - ), - ); - - proofResponse = new GetIdentitiesByPublicKeyHashesResponse(); - proofResponse.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setProof(proofMock), - ); - - driveClientMock = { - fetchIdentitiesByPublicKeyHashes: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getIdentitiesByPublicKeyHashesHandler = getIdentitiesByPublicKeyHashesHandlerFactory( - driveClientMock, - ); - }); - - it('should return identities', async () => { - const result = await getIdentitiesByPublicKeyHashesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesByPublicKeyHashesResponse); - - expect(result.getV0() - .getIdentities() - .getIdentityEntriesList()[0] - .getValue() - .getValue()).to.deep.equal( - identity.toBuffer(), - ); - - expect(driveClientMock.fetchIdentitiesByPublicKeyHashes) - .to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - driveClientMock.fetchIdentitiesByPublicKeyHashes.resolves(proofResponse.serializeBinary()); - - const result = await getIdentitiesByPublicKeyHashesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesByPublicKeyHashesResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - }); - - it('should throw an InvalidArgumentGrpcError if no hashes were submitted', async () => { - request.getPublicKeyHashesList.returns([]); - - try { - await getIdentitiesByPublicKeyHashesHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('No public key hashes were provided'); - expect(driveClientMock.fetchIdentitiesByPublicKeyHashes).to.not.be.called(); - } - }); - - it('should throw an error when fetchIdentity throws an error', async () => { - const error = new Error('Unknown error'); - - driveClientMock.fetchIdentitiesByPublicKeyHashes.throws(error); - - try { - await getIdentitiesByPublicKeyHashesHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveClientMock.fetchIdentitiesByPublicKeyHashes) - .to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesHandlerFactory.spec.js deleted file mode 100644 index c0ae75cbdc8..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesHandlerFactory.spec.js +++ /dev/null @@ -1,142 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - IdentityEntry, - IdentityValue, - GetIdentitiesResponseV0, - Identities, -} = GetIdentitiesResponse; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentitiesHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory'); - -describe('getIdentitiesHandlerFactory', () => { - let call; - let getIdentitiesHandler; - let fetchIdentitiesMock; - let request; - let id; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getIdsList: this.sinon.stub().returns([id]), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentitiesMock = this.sinon.stub(); - - getIdentitiesHandler = getIdentitiesHandlerFactory({ - fetchIdentities: fetchIdentitiesMock, - }); - }); - - it('should return identities', async () => { - const identityFixture = await getIdentityFixture(); - - const identityValue = new IdentityValue(); - identityValue.setValue(identityFixture.toBuffer()); - - const identityEntry = new IdentityEntry(); - identityEntry.setKey(id.toBuffer()); - identityEntry.setValue(identityValue); - - const identityEntries = [ - identityEntry, - ]; - - const identities = new Identities(); - identities.setIdentityEntriesList(identityEntries); - - const response = new GetIdentitiesResponse() - .setV0(new GetIdentitiesResponseV0().setIdentities(identities)); - - fetchIdentitiesMock.resolves(response.serializeBinary()); - - const result = await getIdentitiesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesResponse); - - const identityBinaries = result.getV0().getIdentities().getIdentityEntriesList(); - - expect(identityBinaries).to.deep.equal(identityEntries); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentitiesResponse() - .setV0(new GetIdentitiesResponseV0().setProof(proofMock)); - - fetchIdentitiesMock.resolves(response.serializeBinary()); - - const result = await getIdentitiesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentitiesMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getIdsList.returns(null); - - try { - await getIdentitiesHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity ids are not specified'); - expect(fetchIdentitiesMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentitiesMock.throws(abciResponseError); - - try { - await getIdentitiesHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.spec.js deleted file mode 100644 index effbd19d62c..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.spec.js +++ /dev/null @@ -1,137 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceAndRevisionResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityBalanceAndRevisionResponseV0, -} = GetIdentityBalanceAndRevisionResponse; - -const { - BalanceAndRevision, -} = GetIdentityBalanceAndRevisionResponseV0; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityBalanceAndRevisionHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory'); - -describe('getIdentityBalanceAndRevisionHandlerFactory', () => { - let call; - let getIdentityBalanceAndRevisionHandler; - let fetchIdentityBalanceAndRevisionMock; - let request; - let id; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityBalanceAndRevisionMock = this.sinon.stub(); - - getIdentityBalanceAndRevisionHandler = getIdentityBalanceAndRevisionHandlerFactory({ - fetchIdentityBalanceAndRevision: fetchIdentityBalanceAndRevisionMock, - }); - }); - - it('should return identity balance and revision', async () => { - const revisionAndBalance = new BalanceAndRevision(); - - revisionAndBalance.setRevision(1); - revisionAndBalance.setBalance(15); - - const response = new GetIdentityBalanceAndRevisionResponse() - .setV0( - new GetIdentityBalanceAndRevisionResponseV0().setBalanceAndRevision(revisionAndBalance), - ); - - fetchIdentityBalanceAndRevisionMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceAndRevisionHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceAndRevisionResponse); - - const identityRevisionAndBalance = result.getV0().getBalanceAndRevision(); - - expect(identityRevisionAndBalance.getRevision()).to.equals(1); - expect(identityRevisionAndBalance.getBalance()).to.equals(15); - - expect(fetchIdentityBalanceAndRevisionMock).to.be.calledOnceWith(call.request); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityBalanceAndRevisionResponse() - .setV0(new GetIdentityBalanceAndRevisionResponseV0().setProof(proofMock)); - - fetchIdentityBalanceAndRevisionMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceAndRevisionHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceAndRevisionResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityBalanceAndRevisionMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getId.returns(null); - - try { - await getIdentityBalanceAndRevisionHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity id is not specified'); - expect(fetchIdentityBalanceAndRevisionMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityBalanceAndRevisionMock.throws(abciResponseError); - - try { - await getIdentityBalanceAndRevisionHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.spec.js deleted file mode 100644 index 841901f649e..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.spec.js +++ /dev/null @@ -1,122 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityBalanceResponseV0, -} = GetIdentityBalanceResponse; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityBalanceHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory'); - -describe('getIdentityBalanceHandlerFactory', () => { - let call; - let getIdentityBalanceHandler; - let request; - let id; - let fetchIdentityBalanceMock; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityBalanceMock = this.sinon.stub(); - - getIdentityBalanceHandler = getIdentityBalanceHandlerFactory({ - fetchIdentityBalance: fetchIdentityBalanceMock, - }); - }); - - it('should return identity balance', async () => { - const response = new GetIdentityBalanceResponse() - .setV0(new GetIdentityBalanceResponseV0().setBalance(15)); - - fetchIdentityBalanceMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceResponse); - - const identityBalance = result.getV0().getBalance(); - - expect(identityBalance).to.deep.equal(15); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityBalanceResponse() - .setV0(new GetIdentityBalanceResponseV0().setProof(proofMock)); - - fetchIdentityBalanceMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityBalanceMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getId.returns(null); - - try { - await getIdentityBalanceHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity id is not specified'); - expect(fetchIdentityBalanceMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityBalanceMock.throws(abciResponseError); - - try { - await getIdentityBalanceHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.spec.js deleted file mode 100644 index 9f88a678a53..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.spec.js +++ /dev/null @@ -1,132 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityByPublicKeyHashResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityByPublicKeyHashResponseV0, -} = GetIdentityByPublicKeyHashResponse; - -/* eslint-disable import/no-extraneous-dependencies */ -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityByPublicKeyHashHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory'); - -describe('getIdentityByPublicKeyHashHandlerFactory', () => { - let call; - let getIdentityByPublicKeyHashHandler; - let request; - let fetchIdentityByPublicKeyHashMock; - - beforeEach(async function beforeEach() { - request = { - getPublicKeyHash: this.sinon.stub().returns( - Buffer.alloc(1, 1), - ), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityByPublicKeyHashMock = this.sinon.stub(); - - getIdentityByPublicKeyHashHandler = getIdentityByPublicKeyHashHandlerFactory({ - fetchIdentityByPublicKeyHash: fetchIdentityByPublicKeyHashMock, - }); - }); - - it('should return identity', async () => { - const identityFixture = await getIdentityFixture(); - - const response = new GetIdentityByPublicKeyHashResponse() - .setV0(new GetIdentityByPublicKeyHashResponseV0().setIdentity(identityFixture.toBuffer())); - - fetchIdentityByPublicKeyHashMock.resolves(response.serializeBinary()); - - const result = await getIdentityByPublicKeyHashHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityByPublicKeyHashResponse); - - const identity = result.getV0().getIdentity(); - - expect(identity).to.deep.equal(identityFixture.toBuffer()); - - expect(fetchIdentityByPublicKeyHashMock).to.be.calledOnceWith( - call.request, - ); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityByPublicKeyHashResponse().setV0( - new GetIdentityByPublicKeyHashResponseV0().setProof(proofMock), - ); - - fetchIdentityByPublicKeyHashMock.resolves(response.serializeBinary()); - - const result = await getIdentityByPublicKeyHashHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityByPublicKeyHashResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityByPublicKeyHashMock).to.be.calledOnceWith( - call.request, - ); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getPublicKeyHash.returns([]); - - try { - await getIdentityByPublicKeyHashHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('No public key hash is provided'); - expect(fetchIdentityByPublicKeyHashMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityByPublicKeyHashMock.throws(abciResponseError); - - try { - await getIdentityByPublicKeyHashHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.spec.js new file mode 100644 index 00000000000..672776bac36 --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.spec.js @@ -0,0 +1,110 @@ +const { + v0: { + GetIdentityContractNonceResponse, + Proof, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityContractNonceHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getIdentityContractNonceHandlerFactory', () => { + let call; + let driveStateRepositoryMock; + let getIdentityContractNonceHandler; + let nonce; + let proofFixture; + let proofMock; + let request; + let response; + let proofResponse; + + beforeEach(async function beforeEach() { + request = { + getProve: this.sinon.stub().returns(false), + }; + call = new GrpcCallMock(this.sinon, { + getV0: () => request, + }); + + proofFixture = { + merkleProof: Buffer.alloc(1, 1), + }; + + proofMock = new Proof(); + proofMock.setGrovedbProof(proofFixture.merkleProof); + + nonce = 1; + const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; + response = new GetIdentityContractNonceResponse(); + response.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(1), + ); + + proofResponse = new GetIdentityContractNonceResponse(); + proofResponse.setV0( + new GetIdentityContractNonceResponseV0() + .setProof(proofMock), + ); + + driveStateRepositoryMock = { + fetchIdentityContractNonce: this.sinon.stub().resolves(response.serializeBinary()), + }; + + getIdentityContractNonceHandler = getIdentityContractNonceHandlerFactory( + driveStateRepositoryMock, + ); + }); + + it('should return valid result', async () => { + const result = await getIdentityContractNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityContractNonceResponse); + expect(result.getV0() + .getIdentityContractNonce()).to.deep.equal(nonce); + expect(driveStateRepositoryMock.fetchIdentityContractNonce) + .to.be.calledOnceWith(call.request); + + const proof = result.getV0().getProof(); + expect(proof).to.be.undefined(); + }); + + it('should return proof', async () => { + request.getProve.returns(true); + + driveStateRepositoryMock.fetchIdentityContractNonce + .resolves(proofResponse.serializeBinary()); + + const result = await getIdentityContractNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityContractNonceResponse); + + const proof = result.getV0().getProof(); + + expect(proof).to.be.an.instanceOf(Proof); + const merkleProof = proof.getGrovedbProof(); + + expect(merkleProof).to.deep.equal(proofFixture.merkleProof); + + expect(driveStateRepositoryMock.fetchIdentityContractNonce) + .to.be.calledOnceWith(call.request); + }); + + it('should throw an error when fetchIdentityContractNonce throws unknown error', async () => { + const error = new Error('Unknown error'); + + driveStateRepositoryMock.fetchIdentityContractNonce.throws(error); + + try { + await getIdentityContractNonceHandler(call); + + expect.fail('should throw an error'); + } catch (e) { + expect(e).to.equal(error); + expect(driveStateRepositoryMock.fetchIdentityContractNonce) + .to.be.calledOnceWith(call.request); + } + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityHandlerFactory.spec.js deleted file mode 100644 index e3340dfcf5b..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityHandlerFactory.spec.js +++ /dev/null @@ -1,134 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const getIdentityHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getIdentityHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let id; - let getIdentityHandler; - let identity; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - identity = await getIdentityFixture(); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - response = new GetIdentityResponse(); - response.setV0( - new GetIdentityResponse.GetIdentityResponseV0() - .setIdentity(identity.toBuffer()), - ); - - proofResponse = new GetIdentityResponse(); - proofResponse.setV0( - new GetIdentityResponse.GetIdentityResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchIdentity: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getIdentityHandler = getIdentityHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getIdentityHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityResponse); - expect(result.getV0().getIdentity()).to.deep.equal(identity.toBuffer()); - expect(driveStateRepositoryMock.fetchIdentity).to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchIdentity.resolves(proofResponse.serializeBinary()); - - const result = await getIdentityHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchIdentity).to.be.calledOnceWith(call.request); - }); - - it('should throw an InvalidArgumentGrpcError if id is not specified', async () => { - request.getId.returns(null); - - try { - await getIdentityHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('id is not specified'); - expect(driveStateRepositoryMock.fetchIdentity).to.not.be.called(); - } - }); - - it('should throw an error when fetchIdentity throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchIdentity.throws(error); - - try { - await getIdentityHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchIdentity).to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.spec.js deleted file mode 100644 index 38a0cb37b89..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.spec.js +++ /dev/null @@ -1,135 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityKeysResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityKeysResponseV0, -} = GetIdentityKeysResponse; - -const { - Keys, -} = GetIdentityKeysResponseV0; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityKeysHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory'); - -describe('getIdentityKeysHandlerFactory', () => { - let call; - let getIdentityKeysHandler; - let fetchIdentityKeysMock; - let request; - let id; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getIdentityId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityKeysMock = this.sinon.stub(); - - getIdentityKeysHandler = getIdentityKeysHandlerFactory({ - fetchIdentityKeys: fetchIdentityKeysMock, - }); - }); - - it('should return identity keys', async () => { - const keysBytesList = [ - Buffer.from('key1'), - ]; - - const keys = new Keys(); - keys.setKeysBytesList(keysBytesList); - - const response = new GetIdentityKeysResponse() - .setV0(new GetIdentityKeysResponseV0().setKeys(keys)); - - fetchIdentityKeysMock.resolves(response.serializeBinary()); - - const result = await getIdentityKeysHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityKeysResponse); - - const keysBytes = result.getV0().getKeys().getKeysBytesList(); - - expect(keysBytes).to.deep.equal(keysBytesList); - - expect(fetchIdentityKeysMock).to.be.calledOnceWith(call.request); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityKeysResponse() - .setV0(new GetIdentityKeysResponseV0().setProof(proofMock)); - - fetchIdentityKeysMock.resolves(response.serializeBinary()); - - const result = await getIdentityKeysHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityKeysResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityKeysMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getIdentityId.returns(null); - - try { - await getIdentityKeysHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity id is not specified'); - expect(fetchIdentityKeysMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityKeysMock.throws(abciResponseError); - - try { - await getIdentityKeysHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.spec.js new file mode 100644 index 00000000000..cf0029c533b --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.spec.js @@ -0,0 +1,110 @@ +const { + v0: { + GetIdentityNonceResponse, + Proof, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityNonceHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getIdentityNonceHandlerFactory', () => { + let call; + let driveStateRepositoryMock; + let getIdentityNonceHandler; + let nonce; + let proofFixture; + let proofMock; + let request; + let response; + let proofResponse; + + beforeEach(async function beforeEach() { + request = { + getProve: this.sinon.stub().returns(false), + }; + call = new GrpcCallMock(this.sinon, { + getV0: () => request, + }); + + proofFixture = { + merkleProof: Buffer.alloc(1, 1), + }; + + proofMock = new Proof(); + proofMock.setGrovedbProof(proofFixture.merkleProof); + + nonce = 1; + const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; + response = new GetIdentityNonceResponse(); + response.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(1), + ); + + proofResponse = new GetIdentityNonceResponse(); + proofResponse.setV0( + new GetIdentityNonceResponseV0() + .setProof(proofMock), + ); + + driveStateRepositoryMock = { + fetchIdentityNonce: this.sinon.stub().resolves(response.serializeBinary()), + }; + + getIdentityNonceHandler = getIdentityNonceHandlerFactory( + driveStateRepositoryMock, + ); + }); + + it('should return valid result', async () => { + const result = await getIdentityNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityNonceResponse); + expect(result.getV0() + .getIdentityNonce()).to.deep.equal(nonce); + expect(driveStateRepositoryMock.fetchIdentityNonce) + .to.be.calledOnceWith(call.request); + + const proof = result.getV0().getProof(); + expect(proof).to.be.undefined(); + }); + + it('should return proof', async () => { + request.getProve.returns(true); + + driveStateRepositoryMock.fetchIdentityNonce + .resolves(proofResponse.serializeBinary()); + + const result = await getIdentityNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityNonceResponse); + + const proof = result.getV0().getProof(); + + expect(proof).to.be.an.instanceOf(Proof); + const merkleProof = proof.getGrovedbProof(); + + expect(merkleProof).to.deep.equal(proofFixture.merkleProof); + + expect(driveStateRepositoryMock.fetchIdentityNonce) + .to.be.calledOnceWith(call.request); + }); + + it('should throw an error when fetchIdentityNonce throws unknown error', async () => { + const error = new Error('Unknown error'); + + driveStateRepositoryMock.fetchIdentityNonce.throws(error); + + try { + await getIdentityNonceHandler(call); + + expect.fail('should throw an error'); + } catch (e) { + expect(e).to.equal(error); + expect(driveStateRepositoryMock.fetchIdentityNonce) + .to.be.calledOnceWith(call.request); + } + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getProofsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getProofsHandlerFactory.spec.js deleted file mode 100644 index f701b3e5efb..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getProofsHandlerFactory.spec.js +++ /dev/null @@ -1,78 +0,0 @@ -const { - v0: { - GetProofsResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getProofsHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getProofsHandlerFactory'); - -const { - GetProofsResponseV0, -} = GetProofsResponse; - -describe('getProofsHandlerFactory', () => { - let call; - let getProofsHandler; - let driveClientMock; - let request; - let proofFixture; - let proofMock; - let response; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, request); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - response = new GetProofsResponse() - .setV0(new GetProofsResponseV0().setProof(proofMock)); - - driveClientMock = { - fetchProofs: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getProofsHandler = getProofsHandlerFactory(driveClientMock); - }); - - it('should return proof', async () => { - const result = await getProofsHandler(call); - - expect(result).to.be.an.instanceOf(GetProofsResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveClientMock.fetchProofs).to.be.calledOnceWith(call.request); - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - driveClientMock.fetchProofs.throws(abciResponseError); - - try { - await getProofsHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.spec.js deleted file mode 100644 index 4b545dbd7d5..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.spec.js +++ /dev/null @@ -1,116 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeStateResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getProtocolVersionUpgradeStateHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getProtocolVersionUpgradeStateHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let getProtocolVersionUpgradeStateHandler; - let versionNumber; - let voteCount; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - versionNumber = 1; - voteCount = 1; - const { GetProtocolVersionUpgradeStateResponseV0 } = GetProtocolVersionUpgradeStateResponse; - const { Versions, VersionEntry } = GetProtocolVersionUpgradeStateResponseV0; - response = new GetProtocolVersionUpgradeStateResponse(); - response.setV0( - new GetProtocolVersionUpgradeStateResponseV0() - .setVersions(new Versions() - .setVersionsList([new VersionEntry() - .setVersionNumber(versionNumber) - .setVoteCount(voteCount)])), - ); - - proofResponse = new GetProtocolVersionUpgradeStateResponse(); - proofResponse.setV0( - new GetProtocolVersionUpgradeStateResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchVersionUpgradeState: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getProtocolVersionUpgradeStateHandler = getProtocolVersionUpgradeStateHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getProtocolVersionUpgradeStateHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeStateResponse); - expect(result.getV0() - .getVersions().getVersionsList()[0].getVersionNumber()).to.deep.equal(versionNumber); - expect(driveStateRepositoryMock.fetchVersionUpgradeState) - .to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchVersionUpgradeState - .resolves(proofResponse.serializeBinary()); - - const result = await getProtocolVersionUpgradeStateHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeStateResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchVersionUpgradeState) - .to.be.calledOnceWith(call.request); - }); - - it('should throw an error when fetchVersionUpgradeState throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchVersionUpgradeState.throws(error); - - try { - await getProtocolVersionUpgradeStateHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchVersionUpgradeState) - .to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.spec.js deleted file mode 100644 index 2a0e09da6d5..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.spec.js +++ /dev/null @@ -1,118 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeVoteStatusResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getProtocolVersionUpgradeVoteStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getProtocolVersionUpgradeVoteStatusHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let getProtocolVersionUpgradeVoteStatusHandler; - let proTxHash; - let version; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - version = 1; - proTxHash = Buffer.alloc(32).fill(1); - const { - GetProtocolVersionUpgradeVoteStatusResponseV0, - } = GetProtocolVersionUpgradeVoteStatusResponse; - const { VersionSignals, VersionSignal } = GetProtocolVersionUpgradeVoteStatusResponseV0; - response = new GetProtocolVersionUpgradeVoteStatusResponse(); - response.setV0( - new GetProtocolVersionUpgradeVoteStatusResponseV0() - .setVersions(new VersionSignals() - .setVersionSignalsList([new VersionSignal() - .setProTxHash(proTxHash) - .setVersion(version)])), - ); - - proofResponse = new GetProtocolVersionUpgradeVoteStatusResponse(); - proofResponse.setV0( - new GetProtocolVersionUpgradeVoteStatusResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchVersionUpgradeVoteStatus: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getProtocolVersionUpgradeVoteStatusHandler = getProtocolVersionUpgradeVoteStatusHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getProtocolVersionUpgradeVoteStatusHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeVoteStatusResponse); - expect(result.getV0() - .getVersions().getVersionSignalsList()[0].getProTxHash()).to.deep.equal(proTxHash); - expect(driveStateRepositoryMock.fetchVersionUpgradeVoteStatus) - .to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchVersionUpgradeVoteStatus - .resolves(proofResponse.serializeBinary()); - - const result = await getProtocolVersionUpgradeVoteStatusHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeVoteStatusResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchVersionUpgradeVoteStatus) - .to.be.calledOnceWith(call.request); - }); - - it('should throw an error when fetchVersionUpgradeVoteStatus throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchVersionUpgradeVoteStatus.throws(error); - - try { - await getProtocolVersionUpgradeVoteStatusHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchVersionUpgradeVoteStatus) - .to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js index c8705603bbc..523f2f8cf92 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js @@ -34,6 +34,7 @@ const subscribeToTransactionsWithProofsHandlerFactory = require( ); const ProcessMediator = require('../../../../../lib/transactionsFilter/ProcessMediator'); +const ChainDataProvider = require('../../../../../lib/chainDataProvider/ChainDataProvider'); use(sinonChai); use(chaiAsPromised); @@ -61,6 +62,8 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { let testTransactionAgainstFilterMock; let coreAPIMock; let getMemPoolTransactionsMock; + let chainDataProvider; + let zmqClientMock; beforeEach(function beforeEach() { const bloomFilterMessage = new BloomFilter(); @@ -93,12 +96,15 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { coreAPIMock = { getBlock: this.sinon.stub(), getBlockStats: this.sinon.stub(), - getBestBlockHeight: this.sinon.stub(), getBlockHash: this.sinon.stub(), }; getMemPoolTransactionsMock = this.sinon.stub().returns([]); + zmqClientMock = { on: this.sinon.stub(), topics: { hashblock: 'fake' } }; + + chainDataProvider = new ChainDataProvider(coreAPIMock, zmqClientMock); + subscribeToTransactionsWithProofsHandler = subscribeToTransactionsWithProofsHandlerFactory( getHistoricalTransactionsIteratorMock, subscribeToNewTransactionsMock, @@ -106,6 +112,7 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { testTransactionAgainstFilterMock, coreAPIMock, getMemPoolTransactionsMock, + chainDataProvider, ); this.sinon.spy(ProcessMediator.prototype, 'emit'); @@ -151,7 +158,7 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { call.request = TransactionsWithProofsRequest.deserializeBinary(call.request.serializeBinary()); coreAPIMock.getBlockStats.resolves({ height: 1 }); - coreAPIMock.getBestBlockHeight.resolves(10); + chainDataProvider.chainHeight = 10; try { await subscribeToTransactionsWithProofsHandler(call); @@ -184,7 +191,7 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { call = new GrpcCallMock(this.sinon, call.request); coreAPIMock.getBlockStats.resolves({ height: 1 }); - coreAPIMock.getBestBlockHeight.resolves(10); + chainDataProvider.chainHeight = 10; historicalTxData.push({ merkleBlock: { diff --git a/packages/dapi/test/unit/rpcServer/commands/generateToAddress.spec.js b/packages/dapi/test/unit/rpcServer/commands/generateToAddress.spec.js deleted file mode 100644 index 9b6bfcb6b86..00000000000 --- a/packages/dapi/test/unit/rpcServer/commands/generateToAddress.spec.js +++ /dev/null @@ -1,65 +0,0 @@ -const chai = require('chai'); -const sinon = require('sinon'); -const chaiAsPromised = require('chai-as-promised'); -const generateToAddressFactory = require('../../../../lib/rpcServer/commands/generateToAddress'); -const coreAPIFixture = require('../../../mocks/coreAPIFixture'); - -const { expect } = chai; -chai.use(chaiAsPromised); -let spy; - -describe('generateToAddress', () => { - describe('#factory', () => { - it('should return a function', () => { - const generate = generateToAddressFactory(coreAPIFixture); - expect(generate).to.be.a('function'); - }); - }); - - before(() => { - spy = sinon.spy(coreAPIFixture, 'generateToAddress'); - }); - - beforeEach(() => { - spy.resetHistory(); - }); - - after(() => { - spy.restore(); - }); - - it('Should return an array of block hashes', async () => { - const generateToAddress = generateToAddressFactory(coreAPIFixture); - - expect(spy.callCount).to.be.equal(0); - - const blockHashes = await generateToAddress({ blocksNumber: 10, address: '123456' }); - - expect(blockHashes).to.be.an('array'); - expect(blockHashes.length).to.be.equal(10); - expect(spy.callCount).to.be.equal(1); - }); - - it('Should throw an error if arguments are not valid', async () => { - const generateToAddress = generateToAddressFactory(coreAPIFixture); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: -1, address: '123' })).to.be.rejectedWith('must be >= 1'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: 0.5, address: '123' })).to.be.rejectedWith('must be integer'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({})).to.be.rejectedWith('must have required property'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress()).to.be.rejectedWith('must be object'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: 'string', address: '123' })).to.be.rejectedWith('must be integer'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: 1, address: 1 })).to.be.rejectedWith('must be string'); - expect(spy.callCount).to.be.equal(0); - }); -}); diff --git a/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js b/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js index 23dc36b268a..3c6e5572120 100644 --- a/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js +++ b/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js @@ -1,38 +1,32 @@ const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); -const sinon = require('sinon'); const getBestBlockHashFactory = require('../../../../lib/rpcServer/commands/getBestBlockHash'); -const coreAPIFixture = require('../../../mocks/coreAPIFixture'); chai.use(chaiAsPromised); + const { expect } = chai; -let spy; describe('getBestBlockHash', () => { - describe('#factory', () => { - it('should return a function', () => { - const getBestBlockHash = getBestBlockHashFactory(coreAPIFixture); - expect(getBestBlockHash).to.be.a('function'); - }); - }); + let getBestBlockHash; + let coreRPCClientMock; + let zmqClientMock; + let blockHash; - before(() => { - spy = sinon.spy(coreAPIFixture, 'getBestBlockHash'); - }); + beforeEach(function beforeEach() { + blockHash = '000000000074fc08fb6a92cb8994b14307038261e4266abc6994fa03955a1a59'; - beforeEach(() => { - spy.resetHistory(); - }); + coreRPCClientMock = { + getBestBlockHash: this.sinon.stub().resolves(blockHash), + }; + + zmqClientMock = { on: this.sinon.stub(), topics: { hashblock: 'fake' } }; - after(() => { - spy.restore(); + getBestBlockHash = getBestBlockHashFactory(coreRPCClientMock, zmqClientMock); }); it('Should return a number', async () => { - const getBestBlockHash = getBestBlockHashFactory(coreAPIFixture); - expect(spy.callCount).to.be.equal(0); const bestBlockHash = await getBestBlockHash(); - expect(bestBlockHash).to.be.an('string'); - expect(spy.callCount).to.be.equal(1); + expect(bestBlockHash).to.equals(blockHash); + expect(coreRPCClientMock.getBestBlockHash).to.be.calledOnce(); }); }); diff --git a/packages/dapi/test/unit/rpcServer/commands/getMnListDiff.spec.js b/packages/dapi/test/unit/rpcServer/commands/getMnListDiff.spec.js deleted file mode 100644 index d757928b4d0..00000000000 --- a/packages/dapi/test/unit/rpcServer/commands/getMnListDiff.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -const chai = require('chai'); -const chaiAsPromised = require('chai-as-promised'); -const sinon = require('sinon'); -const getMNListDiffFactory = require('../../../../lib/rpcServer/commands/getMnListDiff'); -const coreAPIFixture = require('../../../mocks/coreAPIFixture'); - -chai.use(chaiAsPromised); -const { expect } = chai; -let spy; -let baseBlockHash; -let blockHash; - -describe('getMNListDiff', () => { - describe('#factory', () => { - it('should return a function', () => { - const getMNListDiff = getMNListDiffFactory(coreAPIFixture); - expect(getMNListDiff).to.be.a('function'); - }); - }); - - before(() => { - spy = sinon.spy(coreAPIFixture, 'getMnListDiff'); - }); - - beforeEach(() => { - spy.resetHistory(); - - baseBlockHash = '0000000000000000000000000000000000000000000000000000000000000000'; - blockHash = '0000000000000000000000000000000000000000000000000000000000000000'; - }); - - after(() => { - spy.restore(); - }); - - it('Should return a masternode list difference list object', async () => { - const getMNListDiff = getMNListDiffFactory(coreAPIFixture); - expect(spy.callCount).to.be.equal(0); - - const mnDiffList = await getMNListDiff({ baseBlockHash, blockHash }); - expect(mnDiffList).to.be.an('object'); - expect(mnDiffList.baseBlockHash.length).to.equal(64); - expect(mnDiffList.blockHash.length).to.equal(64); - expect(mnDiffList.merkleRootMNList.length).to.equal(64); - expect(mnDiffList.deletedMNs).to.be.an('Array'); - expect(mnDiffList.mnList).to.be.an('Array'); - - expect(spy.callCount).to.be.equal(1); - }); -}); diff --git a/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js b/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js index dcd237701f1..0630a359655 100644 --- a/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js +++ b/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js @@ -65,7 +65,7 @@ describe('getHistoricalTransactionsIteratorFactory', () => { }; coreRpcMock = { getMerkleBlocks: sinon.stub(), - getRawTransaction: sinon.stub(), + getRawTransactionMulti: sinon.stub(), getBlock: sinon.stub(), getBlockStats: sinon.stub(), getBlockHash: sinon.stub(), @@ -74,15 +74,18 @@ describe('getHistoricalTransactionsIteratorFactory', () => { .withArgs() .resolves([rawMerkleBlock]); - coreRpcMock.getRawTransaction - .withArgs('cd75b421157eca03eff664bdc165730f91ef2fa52df19ff415ab5acb30045425') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000') - .withArgs('2ef9795147caaeecee5bc2520704bb372cde06dbd2e871750f31336fd3f02be3') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000') - .withArgs('2241d3448560f8b1d3a07ea5c31e79eb595632984a20f50944809a61fdd9fe0b') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000') - .withArgs('45afbfe270014d5593cb065562f1fed726f767fe334d8b3f4379025cfa5be8c5') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000'); + const txs = { + cd75b421157eca03eff664bdc165730f91ef2fa52df19ff415ab5acb30045425: '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + '2ef9795147caaeecee5bc2520704bb372cde06dbd2e871750f31336fd3f02be3': '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + '2241d3448560f8b1d3a07ea5c31e79eb595632984a20f50944809a61fdd9fe0b': '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + '45afbfe270014d5593cb065562f1fed726f767fe334d8b3f4379025cfa5be8c5': '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + }; + + coreRpcMock.getRawTransactionMulti.callsFake(async (txids) => txids + .reduce((acc, txid) => { + acc[txid] = txs[txid]; + return acc; + }, {})); mockData.blocks.forEach((mockedBlockData) => { coreRpcMock.getBlock.withArgs(mockedBlockData.hash).resolves(mockedBlockData); diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 212b6c2db31..fcba2751b0d 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "0.25.21", + "version": "2.1.0-dev.1", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { @@ -10,11 +10,19 @@ "lint:fix": "eslint . --fix" }, "author": "", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/dash-spv#readme", "license": "MIT", "dependencies": { "@dashevo/dark-gravity-wave": "^1.1.1", "@dashevo/dash-util": "^2.0.3", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.3", "levelup": "^4.4.0", "memdown": "^5.1.0", "wasm-x11-hash": "~0.0.2" diff --git a/packages/dashmate/README.md b/packages/dashmate/README.md index 7fa5d7a014f..dec9b177136 100644 --- a/packages/dashmate/README.md +++ b/packages/dashmate/README.md @@ -62,7 +62,7 @@ Example usage: ```bash $ dashmate stop -$ npm update -g dashmate +$ npm install -g dashmate $ dashmate update ╔══════════════════╤══════════════════════════════╤════════════╗ ║ Service │ Image │ Updated ║ @@ -71,11 +71,11 @@ $ dashmate update ║ Drive ABCI │ dashpay/drive:0.24 │ updated ║ ║ Drive Tenderdash │ dashpay/tenderdash:0.11.2 │ up to date ║ ║ DAPI API │ dashpay/dapi:0.24 │ updated ║ -║ DAPI Envoy │ dashpay/envoy:0.24 │ updated ║ +║ Gateway │ dashpay/envoy:0.24 │ updated ║ ║ Dashmate Helper │ dashpay/dashmate-helper:0.24 │ updated ║ ╚══════════════════╧══════════════════════════════╧════════════╝ $ dashmate update --format=json -[{"name":"core","title":"Core","updated":false,"image":"dashpay/dashd:19.2.0"},{"name":"drive_abci","title":"Drive ABCI","pulled":false,"image":"dashpay/drive:0.24"},{"name":"drive_tenderdash","title":"Drive Tenderdash","pulled":true,"image":"dashpay/tenderdash:0.11.2"},{"name":"dapi_api","title":"DAPI API","pulled":false,"image":"dashpay/dapi:0.24"},{"name":"dapi_envoy","title":"DAPI Envoy","pulled":false,"image":"dashpay/envoy:0.24"},{"name":"dashmate_helper","title":"Dashmate Helper","pulled":false,"image":"dashpay/dashmate-helper:0.24"}] +[{"name":"core","title":"Core","updated":false,"image":"dashpay/dashd:19.2.0"},{"name":"drive_abci","title":"Drive ABCI","pulled":false,"image":"dashpay/drive:0.24"},{"name":"drive_tenderdash","title":"Drive Tenderdash","pulled":true,"image":"dashpay/tenderdash:0.11.2"},{"name":"dapi_api","title":"DAPI API","pulled":false,"image":"dashpay/dapi:0.24"},{"name":"gateway","title":"Gateway","pulled":false,"image":"dashpay/envoy:0.24"},{"name":"dashmate_helper","title":"Dashmate Helper","pulled":false,"image":"dashpay/dashmate-helper:0.24"}] $ dashmate start ``` @@ -87,8 +87,8 @@ In some cases, you must also additionally reset platform data: ```bash $ dashmate stop -$ npm update -g dashmate -$ dashmate reset --platform-only --hard +$ npm install -g dashmate +$ dashmate reset --platform --hard $ dashmate update $ dashmate setup $ dashmate start @@ -177,6 +177,8 @@ USAGE $ dashmate start [-v] [--config ] [-w] FLAGS + -f, --force force start even if any services are already running + -p, --platform start only platform -v, --verbose use verbose mode for output -w, --wait-for-readiness wait for nodes to be ready --config= configuration name to use @@ -193,12 +195,15 @@ The `stop` command is used to stop a running node. ``` USAGE - $ dashmate stop [-v] [--config ] [-f] + $ dashmate stop [--config ] [-v] [-f] [-p] [-s] FLAGS - -f, --force force stop even if any is running + -f, --force force stop even if any service is running + -p, --platform stop only platform + -s, --safe wait for dkg before stop -v, --verbose use verbose mode for output --config= configuration name to use + ``` To stop a node: @@ -212,11 +217,13 @@ The `restart` command is used to restart a node with the default or specified co ``` USAGE - $ dashmate restart [-v] [--config ] + $ dashmate restart [--config ] [-v] [-p] [-s] FLAGS - -v, --verbose use verbose mode for output - --config= configuration name to use + -p, --platform restart only platform + -s, --safe wait for dkg before stop + -v, --verbose use verbose mode for output + --config= configuration name to use ``` ### Show node status @@ -276,14 +283,18 @@ The `reset` command removes all data corresponding to the specified config and a ``` USAGE - $ dashmate reset [-v] [--config ] [-h] [-f] [-p] + $ dashmate reset [--config ] [-v] [-h] [-f] [-p] [--keep-data] FLAGS - -f, --force skip running services check - -h, --hard reset config as well as data - -p, --platform-only reset platform data only - -v, --verbose use verbose mode for output - --config= configuration name to use + -f, --force skip running services check + -h, --hard reset config as well as services and data + -p, --platform reset platform services and data only + -v, --verbose use verbose mode for output + --config= configuration name to use + --keep-data keep data + +DESCRIPTION + Reset node data ``` To reset a node: @@ -391,7 +402,8 @@ USAGE $ dashmate group stop [-v] [--group ] [-f] FLAGS - -f, --force force stop even if any service is running + -f, --force force stop even if any is running + -s, --safe wait for dkg before stop -v, --verbose use verbose mode for output --group= group name to use ``` @@ -402,11 +414,15 @@ The `group restart` command is used to restart group nodes belonging to the defa ``` USAGE - $ dashmate group restart [-v] [--group ] + $ dashmate group restart [--group ] [-v] [-s] FLAGS - -v, --verbose use verbose mode for output - --group= group name to use + -s, --safe wait for dkg before stop + -v, --verbose use verbose mode for output + --group= group name to use + +DESCRIPTION + Restart group nodes ``` #### Show group status @@ -434,7 +450,7 @@ USAGE FLAGS -f, --force reset even running node - -p, --platform-only reset platform data only + -p, --platform reset platform data only -v, --verbose use verbose mode for output --group= group name to use --hard reset config as well as data @@ -503,7 +519,7 @@ again all your service configs (dashd.conf, config.toml, etc.), you can issue th ```bash dashmate config render -Config "testnet" service configs rendered +"testnet" service configs rendered ``` ### Development diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index 0f0d404023f..fa395ae5c46 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -1,30 +1,12 @@ import path from 'path'; - -import DPNSContract from '@dashevo/dpns-contract/lib/systemIds.js'; - -import DashPayContract from '@dashevo/dashpay-contract/lib/systemIds.js'; - -import FeatureFlagsContract from '@dashevo/feature-flags-contract/lib/systemIds.js'; - -import MasternodeRewardSharesContract from '@dashevo/masternode-reward-shares-contract/lib/systemIds.js'; - -import WithdrawalsContract from '@dashevo/withdrawals-contract/lib/systemIds.js'; - import semver from 'semver'; import fs from 'fs'; +import Config from '../../src/config/Config.js'; import { - NETWORK_TESTNET, PACKAGE_ROOT_DIR, + NETWORK_MAINNET, + PACKAGE_ROOT_DIR, } from '../../src/constants.js'; -import Config from '../../src/config/Config.js'; - -const { contractId: dpnsContractId, ownerId: dpnsOwnerId } = DPNSContract; - -const { contractId: dashpayContractId } = DashPayContract; - -const { contractId: featureFlagsContractId, ownerId: featureFlagsOwnerId } = FeatureFlagsContract; -const { contractId: masternodeRewardSharesContractId } = MasternodeRewardSharesContract; -const { contractId: withdrawalsContractId } = WithdrawalsContract; const { version } = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_DIR, 'package.json'), 'utf8')); @@ -34,7 +16,7 @@ const { version } = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_DIR, 'pack */ export default function getBaseConfigFactory(homeDir) { const prereleaseTag = semver.prerelease(version) === null ? '' : `-${semver.prerelease(version)[0]}`; - const dockerImageVersion = `${semver.major(version)}.${semver.minor(version)}${prereleaseTag}`; + const dockerImageVersion = `${semver.major(version)}${prereleaseTag}`; /** * @typedef {function} getBaseConfig @@ -72,7 +54,8 @@ export default function getBaseConfigFactory(homeDir) { port: 3001, }, docker: { - image: 'dashpay/dashd:20', commandArgs: [], + image: 'dashpay/dashd:21', + commandArgs: [], }, p2p: { host: '0.0.0.0', @@ -82,12 +65,50 @@ export default function getBaseConfigFactory(homeDir) { rpc: { host: '127.0.0.1', port: 9998, - user: 'dashrpc', - password: 'rpcpassword', + users: { + dashmate: { + password: 'rpcpassword', + whitelist: null, + lowPriority: false, + }, + dapi: { + password: 'rpcpassword', + whitelist: [ + 'getbestblockhash', 'getblockhash', 'sendrawtransaction', 'getrawtransaction', + 'getblockstats', 'getmerkleblocks', 'getrawtransactionmulti', 'getrawmempool', + 'getblockcount', 'getbestchainlock', 'getblock', 'getblockheader', 'getblockheaders', + 'protxdiff', 'getnetworkinfo', 'getblockchaininfo', 'mnsyncstatus', 'masternodestatus', + ], + lowPriority: true, + }, + drive_consensus: { + password: 'rpcpassword', + whitelist: [ + 'getbestchainlock', 'getblockchaininfo', 'getrawtransaction', 'submitchainlock', + 'verifychainlock', 'protxlistdiff', 'quorumlistextended', 'quoruminfo', + 'getassetunlockstatuses', 'sendrawtransaction', 'mnsyncstatus', 'getblockheader', 'getblockhash', + ], + lowPriority: false, + }, + drive_check_tx: { + password: 'rpcpassword', + whitelist: ['getrawtransaction'], + lowPriority: true, + }, + tenderdash: { + password: 'rpcpassword', + whitelist: [ + 'quoruminfo', 'quorumverify', 'quorumplatformsign', 'masternodestatus', 'masternodelist', + 'ping', 'getnetworkinfo', + ], + lowPriority: false, + }, + }, allowIps: ['127.0.0.1', '172.16.0.0/12', '192.168.0.0/16'], }, spork: { - address: null, privateKey: null, + address: null, + privateKey: null, }, masternode: { enable: true, @@ -96,47 +117,118 @@ export default function getBaseConfigFactory(homeDir) { }, }, miner: { - enable: false, interval: '2.5m', mediantime: null, address: null, + enable: false, + interval: '2.5m', + mediantime: null, + address: null, }, devnet: { - name: null, minimumDifficultyBlocks: 0, powTargetSpacing: 150, + name: null, + minimumDifficultyBlocks: 0, + powTargetSpacing: 150, + llmq: { + chainLocks: 'llmq_devnet', + instantSend: 'llmq_devnet_dip0024', + platform: 'llmq_devnet_platform', + mnhf: 'llmq_devnet', + }, }, log: { file: { - categories: [], path: homeDir.joinPath('logs', 'base', 'core.log'), + categories: [], + path: homeDir.joinPath('logs', 'base', 'core.log'), }, }, logIps: 0, - indexes: true, + indexes: [], }, platform: { - dapi: { - envoy: { - docker: { - image: 'dashpay/envoy:1.22.11', + gateway: { + docker: { + image: 'dashpay/envoy:1.30.2-impr.1', + }, + maxConnections: 1000, + maxHeapSizeInBytes: 125000000, // 1 Gb + upstreams: { + driveGrpc: { + maxRequests: 100, + }, + dapiApi: { + maxRequests: 100, + }, + dapiCoreStreams: { + maxRequests: 100, }, - http: { + dapiJsonRpc: { + maxRequests: 100, + }, + }, + metrics: { + enabled: false, + host: '127.0.0.1', + port: 9090, + }, + admin: { + enabled: false, + host: '127.0.0.1', + port: 9901, + }, + listeners: { + dapiAndDrive: { + http2: { + maxConcurrentStreams: 10, + }, + waitForStResultTimeout: '125s', host: '0.0.0.0', port: 443, - connectTimeout: '5s', - responseTimeout: '15s', }, - rateLimiter: { - maxTokens: 300, tokensPerFill: 150, fillInterval: '60s', enabled: true, + }, + log: { + level: 'info', + accessLogs: [ + { + type: 'stdout', + format: 'text', + template: null, + }, + ], + }, + rateLimiter: { + docker: { + image: 'envoyproxy/ratelimit:3fcc3609', }, - ssl: { + metrics: { enabled: false, - provider: 'zerossl', - providerConfigs: { - zerossl: { - apiKey: null, id: null, - }, + docker: { + image: 'prom/statsd-exporter:v0.26.1', }, + host: '127.0.0.1', + port: 9102, }, + unit: 'minute', + requestsPerUnit: 150, + blacklist: [], + whitelist: [], + enabled: true, }, + ssl: { + enabled: false, + provider: 'zerossl', + providerConfigs: { + zerossl: { + apiKey: null, + id: null, + }, + }, + }, + }, + dapi: { api: { docker: { image: `dashpay/dapi:${dockerImageVersion}`, + deploy: { + replicas: 1, + }, build: { enabled: false, context: path.join(PACKAGE_ROOT_DIR, '..', '..'), @@ -144,6 +236,7 @@ export default function getBaseConfigFactory(homeDir) { target: 'dapi', }, }, + waitForStResultTimeout: 120000, }, }, drive: { @@ -159,18 +252,61 @@ export default function getBaseConfigFactory(homeDir) { }, logs: { stdout: { - destination: 'stdout', level: 'info', format: 'compact', color: true, + destination: 'stdout', + level: 'info', + format: 'compact', + color: true, }, }, + tokioConsole: { + enabled: false, + host: '127.0.0.1', + port: 6669, + retention: 60 * 3, + }, validatorSet: { - llmqType: 4, + quorum: { + llmqType: 4, + dkgInterval: 24, + activeSigners: 24, + rotation: false, + }, + }, + chainLock: { + quorum: { + llmqType: 2, + dkgInterval: 288, + activeSigners: 4, + rotation: false, + }, + }, + instantLock: { + quorum: { + llmqType: 5, + dkgInterval: 288, + activeSigners: 32, + rotation: true, + }, + }, + metrics: { + enabled: false, + host: '127.0.0.1', + port: 29090, + }, + grovedbVisualizer: { + enabled: false, + host: '127.0.0.1', + port: 8083, + }, + proposer: { + txProcessingTimeLimit: null, }, epochTime: 788400, }, tenderdash: { mode: 'full', docker: { - image: 'dashpay/tenderdash:fix-ordered-map', + image: 'dashpay/tenderdash:1.2.0-dev.3', }, p2p: { host: '0.0.0.0', @@ -181,14 +317,18 @@ export default function getBaseConfigFactory(homeDir) { maxPacketMsgPayloadSize: 10240, sendRate: 5120000, recvRate: 5120000, + maxConnections: 64, + maxOutgoingConnections: 30, }, rpc: { host: '127.0.0.1', port: 26657, maxOpenConnections: 900, + timeoutBroadcastTx: 0, }, pprof: { - enabled: false, port: 6060, + enabled: false, + port: 6060, }, metrics: { enabled: false, @@ -196,8 +336,16 @@ export default function getBaseConfigFactory(homeDir) { port: 26660, }, mempool: { + cacheSize: 15000, size: 5000, maxTxsBytes: 1073741824, + timeoutCheckTx: '1s', + txEnqueueTimeout: '10ms', + txSendRateLimit: 10, + txRecvRateLimit: 12, + maxConcurrentCheckTx: 250, + ttlDuration: '0s', + ttlNumBlocks: 0, }, consensus: { createEmptyBlocks: true, @@ -222,18 +370,25 @@ export default function getBaseConfigFactory(homeDir) { }, }, log: { - level: 'info', format: 'plain', path: null, + level: 'info', + format: 'plain', + path: null, }, node: { - id: null, key: null, + id: null, + key: null, }, genesis: { consensus_params: { block: { - max_bytes: '22020096', max_gas: '-1', time_iota_ms: '5000', + max_bytes: '2097152', + max_gas: '57631392000', + time_iota_ms: '5000', }, evidence: { - max_age: '100000', max_age_num_blocks: '100000', max_age_duration: '172800000000000', + max_age: '100000', + max_age_num_blocks: '100000', + max_age_duration: '172800000000000', }, validator: { pub_key_types: ['bls12381'], @@ -241,49 +396,25 @@ export default function getBaseConfigFactory(homeDir) { version: { app_version: '1', }, + timeout: { + propose: '50000000000', + propose_delta: '5000000000', + vote: '10000000000', + vote_delta: '1000000000', + }, + synchrony: { + message_delay: '70000000000', + precision: '1000000000', + }, + abci: { + recheck_tx: true, + }, }, }, moniker: null, }, }, - dpns: { - contract: { - id: dpnsContractId, - }, - ownerId: dpnsOwnerId, - masterPublicKey: null, - secondPublicKey: null, - }, - dashpay: { - contract: { - id: dashpayContractId, - }, - masterPublicKey: null, - secondPublicKey: null, - }, - featureFlags: { - contract: { - id: featureFlagsContractId, - }, - ownerId: featureFlagsOwnerId, - masterPublicKey: null, - secondPublicKey: null, - }, sourcePath: null, - masternodeRewardShares: { - contract: { - id: masternodeRewardSharesContractId, - }, - masterPublicKey: null, - secondPublicKey: null, - }, - withdrawals: { - contract: { - id: withdrawalsContractId, - }, - masterPublicKey: null, - secondPublicKey: null, - }, enable: true, }, dashmate: { @@ -297,12 +428,13 @@ export default function getBaseConfigFactory(homeDir) { }, }, api: { - enable: false, port: 9100, + enable: false, + port: 9100, }, }, }, externalIp: null, - network: NETWORK_TESTNET, + network: NETWORK_MAINNET, environment: 'production', }; diff --git a/packages/dashmate/configs/defaults/getLocalConfigFactory.js b/packages/dashmate/configs/defaults/getLocalConfigFactory.js index 56b87efabc3..42254deb5de 100644 --- a/packages/dashmate/configs/defaults/getLocalConfigFactory.js +++ b/packages/dashmate/configs/defaults/getLocalConfigFactory.js @@ -32,17 +32,17 @@ export default function getLocalConfigFactory(getBaseConfig) { }, }, platform: { - dapi: { - envoy: { - ssl: { - provider: SSL_PROVIDERS.SELF_SIGNED, - }, - http: { + gateway: { + ssl: { + provider: SSL_PROVIDERS.SELF_SIGNED, + }, + listeners: { + dapiAndDrive: { port: 2443, }, - rateLimiter: { - enabled: false, - }, + }, + rateLimiter: { + enabled: false, }, }, drive: { @@ -65,8 +65,30 @@ export default function getLocalConfigFactory(getBaseConfig) { }, }, abci: { + epochTime: 1200, validatorSet: { - llmqType: 106, + quorum: { + llmqType: 106, + dkgInterval: 24, + activeSigners: 2, + rotation: false, + }, + }, + chainLock: { + quorum: { + llmqType: 100, + dkgInterval: 24, + activeSigners: 2, + rotation: false, + }, + }, + instantLock: { + quorum: { + llmqType: 104, + dkgInterval: 24, + activeSigners: 2, + rotation: false, + }, }, }, }, @@ -75,7 +97,8 @@ export default function getLocalConfigFactory(getBaseConfig) { network: NETWORK_LOCAL, }; - return new Config('local', lodashMerge({}, getBaseConfig().getOptions(), options)); + return new Config('local', lodashMerge({}, getBaseConfig() + .getOptions(), options)); } return getLocalConfig; diff --git a/packages/dashmate/configs/defaults/getMainnetConfigFactory.js b/packages/dashmate/configs/defaults/getMainnetConfigFactory.js index a744b69d763..e6aadafbc44 100644 --- a/packages/dashmate/configs/defaults/getMainnetConfigFactory.js +++ b/packages/dashmate/configs/defaults/getMainnetConfigFactory.js @@ -27,7 +27,6 @@ export default function getMainnetConfigFactory(homeDir, getBaseConfig) { }, }, core: { - indexes: false, log: { file: { path: homeDir.joinPath('logs', 'mainnet', 'core.log'), @@ -37,6 +36,51 @@ export default function getMainnetConfigFactory(homeDir, getBaseConfig) { network: NETWORK_MAINNET, platform: { enable: false, + drive: { + tenderdash: { + p2p: { + seeds: [ + { + id: '069639dfceec5f7c86257e6e9c46407c16ad1eab', + host: '34.211.174.194', + port: 26656, + }, + { + id: 'd46e2445642b2f94158ac3c2a6d90b88b83705b8', + host: '3.76.148.150', + port: 26656, + }, + { + id: 'b08a650ecfac178939f21c0c12801eccaf18a5ea', + host: '3.0.60.103', + port: 26656, + }, + { + id: '4cb4a8488eb1dbabda7fb79e47ac3c14eec73c4f', + host: '152.42.151.147', + port: 26656, + }, + ], + }, + mempool: { + timeoutCheckTx: '3s', + txEnqueueTimeout: '30ms', + txSendRateLimit: 100, + txRecvRateLimit: 120, + ttlDuration: '24h', + ttlNumBlocks: 0, + }, + genesis: { + chain_id: 'dash-1', + validator_quorum_type: 4, + }, + }, + abci: { + proposer: { + txProcessingTimeLimit: 5000, + }, + }, + }, }, }; diff --git a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js index df5e05056f0..ddf5a8ec98e 100644 --- a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js +++ b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js @@ -40,9 +40,9 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { }, }, platform: { - dapi: { - envoy: { - http: { + gateway: { + listeners: { + dapiAndDrive: { port: 1443, }, }, @@ -51,7 +51,31 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { abci: { epochTime: 3600, validatorSet: { - llmqType: 6, + quorum: { + llmqType: 6, + dkgInterval: 24, + activeSigners: 24, + rotation: false, + }, + }, + chainLock: { + quorum: { + llmqType: 1, + dkgInterval: 24, + activeSigners: 24, + rotation: false, + }, + }, + instantLock: { + quorum: { + llmqType: 5, + dkgInterval: 288, + activeSigners: 32, + rotation: true, + }, + }, + proposer: { + txProcessingTimeLimit: 5000, }, }, tenderdash: { @@ -70,8 +94,17 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { ], port: 36656, }, + mempool: { + timeoutCheckTx: '3s', + txEnqueueTimeout: '30ms', + txSendRateLimit: 100, + txRecvRateLimit: 120, + ttlDuration: '24h', + ttlNumBlocks: 0, + }, rpc: { port: 36657, + timeoutBroadcastTx: '1s', }, pprof: { port: 36060, @@ -80,66 +113,17 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { port: 36660, }, genesis: { - genesis_time: '2023-11-02T10:18:00.000Z', - chain_id: 'dash-testnet-37', - initial_core_chain_locked_height: 918609, - consensus_params: { - timeout: { - propose: '50000000000', - propose_delta: '10000000000', - vote: '500000000', - vote_delta: '100000000', - commit: '1000000000', - bypass_commit_timeout: false, - }, - block: { - max_bytes: '22020096', - max_gas: '-1', - time_iota_ms: '5000', - }, - evidence: { - max_age: '100000', - max_age_num_blocks: '100000', - max_age_duration: '172800000000000', - }, - validator: { - pub_key_types: [ - 'bls12381', - ], - }, - version: { - app_version: '1', - }, - }, + chain_id: 'dash-testnet-49', validator_quorum_type: 6, }, }, }, - dpns: { - masterPublicKey: '02c8b4747b528cac5fddf7a6cc63702ee04ed7d1332904e08510343ea00dce546a', - secondPublicKey: '0201ee28f84f5485390567e939c2b586010b63a69ec92cab535dc96a8c71913602', - }, - dashpay: { - masterPublicKey: '02d4dcce3f0a8d2936ce26df4d255fd2835b629b73eea39d4b2778096b91e77946', - secondPublicKey: '03699c8b4ebf1696c92e9ec605a02a38f6f9cec47d13fb584fdad779e936e20ccb', - }, - featureFlags: { - masterPublicKey: '029cf2232549de08c114c19763309cb067688e21e310ac07458b59c2c026be7234', - secondPublicKey: '02a2abb50c03ae9f778f08a93849ba334a82e625153720dd5ef14e564b78b414e5', - }, - masternodeRewardShares: { - masterPublicKey: '0319d795c0795bc8678bd0e58cfc7a4ad75c8e1797537728e7e8de8b9acc2bae2b', - secondPublicKey: '033756572938aaad752158b858ad38511c6edff4c79cf8462f70baa25fc6e8a616', - }, - withdrawals: { - masterPublicKey: '032f79d1d9d6e652599d3315d30306b1277fbf588e32e383aef0a59749547d47b7', - secondPublicKey: '03eebbe3dc3721603a0b5a13441f214550ffa7d035b7dea9f1911de0f63ddac58d', - }, }, network: NETWORK_TESTNET, }; - return new Config('testnet', lodashMerge({}, getBaseConfig().getOptions(), options)); + return new Config('testnet', lodashMerge({}, getBaseConfig() + .getOptions(), options)); } return getTestnetConfig; diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 205271a7234..f91237538ee 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -1,11 +1,12 @@ /* eslint-disable no-param-reassign */ import fs from 'fs'; +import lodash from 'lodash'; import path from 'path'; import { NETWORK_LOCAL, - NETWORK_TESTNET, NETWORK_MAINNET, + NETWORK_TESTNET, SSL_PROVIDERS, } from '../src/constants.js'; @@ -22,6 +23,37 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) function getConfigFileMigrations() { const base = defaultConfigs.get('base'); const testnet = defaultConfigs.get('testnet'); + const mainnet = defaultConfigs.get('mainnet'); + + /** + * @param {string} name + * @param {string} group + * @return {Config} + */ + function getDefaultConfigByNameOrGroup(name, group) { + let baseConfigName = name; + if (group !== null && defaultConfigs.has(group)) { + baseConfigName = group; + } else if (!defaultConfigs.has(baseConfigName)) { + baseConfigName = 'base'; + } + + return defaultConfigs.get(baseConfigName); + } + + function getDefaultConfigByNetwork(network) { + if (network === NETWORK_MAINNET) { + return defaultConfigs.get('mainnet'); + } + if (network === NETWORK_TESTNET) { + return defaultConfigs.get('testnet'); + } + if (network === NETWORK_LOCAL) { + return defaultConfigs.get('local'); + } + + return defaultConfigs.get('base'); + } return { '0.24.0': (configFile) => { @@ -40,7 +72,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) options.platform.dapi.api.docker.image = base.get('platform.dapi.api.docker.image'); - options.platform.dapi.envoy.docker.image = base.get('platform.dapi.envoy.docker.image'); + options.platform.gateway.docker.image = base.get('platform.gateway.docker.image'); }); return configFile; @@ -89,7 +121,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) '0.24.16': (configFile) => { Object.entries(configFile.configs) .forEach(([, options]) => { - options.platform.dapi.envoy.docker = base.get('platform.dapi.envoy.docker'); + options.platform.gateway.docker = base.get('platform.gateway.docker'); options.platform.dapi.api.docker.build = base.get('platform.dapi.api.docker.build'); @@ -170,7 +202,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) } if (defaultConfigs.has(name) && !options.platform.drive.tenderdash.metrics) { - options.platform.drive.tenderdash.metrics = defaultConfigs.get(name).get('platform.drive.tenderdash.metrics'); + options.platform.drive.tenderdash.metrics = defaultConfigs.get(name) + .get('platform.drive.tenderdash.metrics'); } }); return configFile; @@ -193,7 +226,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) if (options.network === NETWORK_TESTNET) { options.platform.drive.tenderdash.genesis.chain_id = testnet.get('platform.drive.tenderdash.genesis.chain_id'); - options.platform.drive.tenderdash.genesis.genesis_time = testnet.get('platform.drive.tenderdash.genesis.genesis_time'); + options.platform.drive.tenderdash.genesis.genesis_time = '2024-07-17T17:15:00.000Z'; } }); return configFile; @@ -215,7 +248,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) if (options.network === NETWORK_TESTNET) { options.platform.drive.tenderdash.genesis.chain_id = testnet.get('platform.drive.tenderdash.genesis.chain_id'); - options.platform.drive.tenderdash.genesis.genesis_time = testnet.get('platform.drive.tenderdash.genesis.genesis_time'); + options.platform.drive.tenderdash.genesis.genesis_time = '2024-07-17T17:15:00.000Z'; options.platform.drive.tenderdash.genesis .initial_core_chain_locked_height = testnet.get('platform.drive.tenderdash.genesis.initial_core_chain_locked_height'); } @@ -312,8 +345,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) if (name !== base.getName()) { options.platform.drive.tenderdash.genesis.chain_id = testnet.get('platform.drive.tenderdash.genesis.chain_id'); - options.platform.drive.tenderdash.genesis.initial_core_chain_locked_height = testnet.get('platform.drive.tenderdash.genesis.initial_core_chain_locked_height'); - options.platform.drive.tenderdash.genesis.genesis_time = testnet.get('platform.drive.tenderdash.genesis.genesis_time'); + options.platform.drive.tenderdash.genesis.initial_core_chain_locked_height = 14000; + options.platform.drive.tenderdash.genesis.genesis_time = '2024-07-17T17:15:00.000Z'; } } }); @@ -328,8 +361,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) if (options.network === NETWORK_TESTNET && name !== base.getName()) { options.platform.drive.tenderdash.genesis.chain_id = testnet.get('platform.drive.tenderdash.genesis.chain_id'); - options.platform.drive.tenderdash.genesis.initial_core_chain_locked_height = testnet.get('platform.drive.tenderdash.genesis.initial_core_chain_locked_height'); - options.platform.drive.tenderdash.genesis.genesis_time = testnet.get('platform.drive.tenderdash.genesis.genesis_time'); + options.platform.drive.tenderdash.genesis.initial_core_chain_locked_height = 1400; + options.platform.drive.tenderdash.genesis.genesis_time = '2024-07-17T17:15:00.000Z'; } }); @@ -340,8 +373,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) .forEach(([name, options]) => { if (options.network === NETWORK_TESTNET && name !== base.getName()) { options.platform.drive.tenderdash.genesis.chain_id = testnet.get('platform.drive.tenderdash.genesis.chain_id'); - options.platform.drive.tenderdash.genesis.initial_core_chain_locked_height = testnet.get('platform.drive.tenderdash.genesis.initial_core_chain_locked_height'); - options.platform.drive.tenderdash.genesis.genesis_time = testnet.get('platform.drive.tenderdash.genesis.genesis_time'); + options.platform.drive.tenderdash.genesis.initial_core_chain_locked_height = 1400; + options.platform.drive.tenderdash.genesis.genesis_time = '2024-07-17T17:15:00.000Z'; } }); @@ -364,7 +397,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) options.core.p2p.host = base.get('core.p2p.host'); options.core.rpc.host = base.get('core.rpc.host'); - options.platform.dapi.envoy.http.host = base.get('platform.dapi.envoy.http.host'); + options.platform.dapi.envoy.http.host = '0.0.0.0'; options.platform.drive.tenderdash.p2p.host = base.get('platform.drive.tenderdash.p2p.host'); options.platform.drive.tenderdash.rpc.host = base.get('platform.drive.tenderdash.rpc.host'); options.platform.drive.tenderdash.metrics.host = base.get('platform.drive.tenderdash.metrics.host'); @@ -383,8 +416,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) '0.25.20': (configFile) => { Object.entries(configFile.configs) .forEach(([name, options]) => { - options.platform.dapi.envoy.http.connectTimeout = base.get('platform.dapi.envoy.http.connectTimeout'); - options.platform.dapi.envoy.http.responseTimeout = base.get('platform.dapi.envoy.http.responseTimeout'); + options.platform.dapi.envoy.http.connectTimeout = '5s'; + options.platform.dapi.envoy.http.responseTimeout = '15s'; options.platform.drive.tenderdash.rpc.maxOpenConnections = base.get('platform.drive.tenderdash.rpc.maxOpenConnections'); @@ -399,13 +432,393 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) options.platform.drive.tenderdash.p2p.sendRate = defaultConfig.get('platform.drive.tenderdash.p2p.sendRate'); options.platform.drive.tenderdash.p2p.recvRate = defaultConfig.get('platform.drive.tenderdash.p2p.recvRate'); - options.platform.drive.tenderdash.mempool = base.get('platform.drive.tenderdash.mempool'); + options.platform.drive.tenderdash.mempool = lodash.clone(base.get('platform.drive.tenderdash.mempool')); options.platform.drive.tenderdash.consensus.peer = base.get('platform.drive.tenderdash.consensus.peer'); options.platform.drive.tenderdash.consensus.unsafeOverride = base.get('platform.drive.tenderdash.consensus.unsafeOverride'); }); return configFile; }, + '1.0.0-dev.2': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + if (defaultConfigs.has(name)) { + options.platform.drive.tenderdash.genesis = defaultConfigs.get(name) + .get('platform.drive.tenderdash.genesis'); + } + options.platform.dapi.api.docker.deploy = base.get('platform.dapi.api.docker.deploy'); + + let baseConfigName = name; + if (options.group !== null && defaultConfigs.has(options.group)) { + baseConfigName = options.group; + } else if (!defaultConfigs.has(baseConfigName)) { + baseConfigName = 'testnet'; + } + + options.platform.drive.abci.chainLock = defaultConfigs.get(baseConfigName) + .get('platform.drive.abci.chainLock'); + }); + + return configFile; + }, + '1.0.0-dev.4': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.core.docker.image = defaultConfig.get('core.docker.image'); + + options.platform.drive.tenderdash.docker.image = defaultConfig.get('platform.drive.tenderdash.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.5': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + options.platform.drive.tenderdash.mempool.cacheSize = base.get('platform.drive.tenderdash.mempool.cacheSize'); + }); + + return configFile; + }, + '1.0.0-dev.6': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + options.platform.drive.abci.tokioConsole = base.get('platform.drive.abci.tokioConsole'); + + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.platform.drive.tenderdash.docker.image = defaultConfig.get('platform.drive.tenderdash.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.7': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + if (options.network === NETWORK_TESTNET && name !== 'base') { + options.platform.drive.tenderdash.genesis = testnet.get('platform.drive.tenderdash.genesis'); + } + + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.core.docker.image = defaultConfig.get('core.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.8': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.core.docker.image = defaultConfig.get('core.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.9': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.platform.drive.tenderdash.mempool.timeoutCheckTx = defaultConfig.get('platform.drive.tenderdash.mempool.timeoutCheckTx'); + options.platform.drive.tenderdash.mempool.txEnqueueTimeout = defaultConfig.get('platform.drive.tenderdash.mempool.txEnqueueTimeout'); + options.platform.drive.tenderdash.mempool.txSendRateLimit = defaultConfig.get('platform.drive.tenderdash.mempool.txSendRateLimit'); + options.platform.drive.tenderdash.mempool.txRecvRateLimit = defaultConfig.get('platform.drive.tenderdash.mempool.txRecvRateLimit'); + options.platform.drive.tenderdash.rpc.timeoutBroadcastTx = defaultConfig.get('platform.drive.tenderdash.rpc.timeoutBroadcastTx'); + }); + + return configFile; + }, + '1.0.0-dev.10': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.12': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + // Update tenderdash config + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + options.platform.drive.tenderdash.mempool.maxConcurrentCheckTx = base.get('platform.drive.tenderdash.mempool.maxConcurrentCheckTx'); + + // Add metrics to Drive ABCI + options.platform.drive.abci.metrics = base.get('platform.drive.abci.metrics'); + + // Envoy -> Gateway + if (options.platform.dapi.envoy) { + options.platform.gateway = lodash.cloneDeep(options.platform.dapi.envoy); + + // add new options + options.platform.gateway.maxConnections = base.get('platform.gateway.maxConnections'); + options.platform.gateway.maxHeapSizeInBytes = base.get('platform.gateway.maxHeapSizeInBytes'); + options.platform.gateway.metrics = base.get('platform.gateway.metrics'); + options.platform.gateway.admin = base.get('platform.gateway.admin'); + options.platform.gateway.upstreams = base.get('platform.gateway.upstreams'); + options.platform.gateway.log = base.get('platform.gateway.log'); + + // http -> listeners + options.platform.gateway.listeners = lodash.cloneDeep( + base.get('platform.gateway.listeners'), + ); + + options.platform.gateway.listeners.dapiAndDrive.host = options.platform.dapi.envoy + .http.host; + options.platform.gateway.listeners.dapiAndDrive.port = options.platform.dapi.envoy + .http.port; + + delete options.platform.gateway.http; + + // update rate limiter + options.platform.gateway.rateLimiter.docker = base.get('platform.gateway.rateLimiter.docker'); + options.platform.gateway.rateLimiter.unit = base.get('platform.gateway.rateLimiter.unit'); + options.platform.gateway.rateLimiter.requestsPerUnit = base.get('platform.gateway.rateLimiter.requestsPerUnit'); + options.platform.gateway.rateLimiter.blacklist = base.get('platform.gateway.rateLimiter.blacklist'); + options.platform.gateway.rateLimiter.whitelist = base.get('platform.gateway.rateLimiter.whitelist'); + options.platform.gateway.rateLimiter.metrics = base.get('platform.gateway.rateLimiter.metrics'); + + delete options.platform.gateway.rateLimiter.fillInterval; + delete options.platform.gateway.rateLimiter.maxTokens; + delete options.platform.gateway.rateLimiter.tokensPerFill; + + // delete envoy + delete options.platform.dapi.envoy; + + // update image + options.platform.gateway.docker.image = base.get('platform.gateway.docker.image'); + } + + // rename non conventional field + if (options.platform.drive.abci.tokioConsole.retention_secs) { + options.platform.drive.abci.tokioConsole.retention = options.platform.drive.abci + .tokioConsole.retention_secs; + delete options.platform.drive.abci.tokioConsole.retention_secs; + } + + // move SSL files + if (options.network !== NETWORK_MAINNET) { + const filenames = ['private.key', 'bundle.crt', 'bundle.csr', 'csr.pem']; + + for (const filename of filenames) { + const oldFilePath = homeDir.joinPath( + name, + 'platform', + 'dapi', + 'envoy', + 'ssl', + filename, + ); + const newFilePath = homeDir.joinPath( + name, + 'platform', + 'gateway', + 'ssl', + filename, + ); + + if (fs.existsSync(oldFilePath)) { + fs.mkdirSync(path.dirname(newFilePath), { recursive: true }); + fs.copyFileSync(oldFilePath, newFilePath); + fs.rmSync(oldFilePath, { recursive: true }); + } + } + } + }); + + return configFile; + }, + '1.0.0-dev.16': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + // Update Drive's quorum configuration + if (name === 'base') { + options.network = NETWORK_MAINNET; + } + + const networkConfig = getDefaultConfigByNetwork(options.network); + + options.platform.drive.abci.chainLock.quorum = { + llmqType: networkConfig.get('platform.drive.abci.chainLock.quorum.llmqType'), + dkgInterval: networkConfig.get('platform.drive.abci.chainLock.quorum.dkgInterval'), + activeSigners: networkConfig.get('platform.drive.abci.chainLock.quorum.activeSigners'), + rotation: networkConfig.get('platform.drive.abci.chainLock.quorum.rotation'), + }; + + delete options.platform.drive.abci.chainLock.llmqType; + delete options.platform.drive.abci.chainLock.llmqSize; + delete options.platform.drive.abci.chainLock.dkgInterval; + + options.platform.drive.abci.validatorSet.quorum = { + llmqType: networkConfig.get('platform.drive.abci.validatorSet.quorum.llmqType'), + dkgInterval: networkConfig.get('platform.drive.abci.validatorSet.quorum.dkgInterval'), + activeSigners: networkConfig.get('platform.drive.abci.validatorSet.quorum.activeSigners'), + rotation: networkConfig.get('platform.drive.abci.validatorSet.quorum.rotation'), + }; + + delete options.platform.drive.abci.validatorSet.llmqType; + + options.platform.drive.abci.instantLock = { + quorum: { + llmqType: networkConfig.get('platform.drive.abci.instantLock.quorum.llmqType'), + dkgInterval: networkConfig.get('platform.drive.abci.instantLock.quorum.dkgInterval'), + activeSigners: networkConfig.get('platform.drive.abci.instantLock.quorum.activeSigners'), + rotation: networkConfig.get('platform.drive.abci.instantLock.quorum.rotation'), + }, + }; + }); + + return configFile; + }, + '1.0.0-dev.17': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + options.platform.drive.abci.grovedbVisualizer = base.get('platform.drive.abci.grovedbVisualizer'); + + // Update Core image + options.core.docker.image = getDefaultConfigByNameOrGroup(name, options.group) + .get('core.docker.image'); + + // Update Core RPC auth configuration + options.core.rpc.users = base.get('core.rpc.users'); + options.core.rpc.users.dashmate.password = options.core.rpc.password; + + delete options.core.rpc.user; + delete options.core.rpc.password; + }); + return configFile; + }, + '1.0.0-beta.4': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + // Update Core image + options.core.docker.image = getDefaultConfigByNameOrGroup(name, options.group) + .get('core.docker.image'); + + options.core.devnet.llmq = base.get('core.devnet.llmq'); + + if (options.network === NETWORK_TESTNET) { + options.platform.drive.tenderdash.genesis = testnet.get('platform.drive.tenderdash.genesis'); + } + }); + return configFile; + }, + '1.0.0-rc.1': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + delete options.platform.dpns; + delete options.platform.dashpay; + delete options.platform.featureFlags; + delete options.platform.masternodeRewardShares; + delete options.platform.withdrawals; + + // Update tenderdash image + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + + // Replace quorumsign with qurumplatformsign in Core RPC Tenderdash auth whitelist + options.core.rpc.users.tenderdash.whitelist = base.get('core.rpc.users.tenderdash.whitelist'); + }); + return configFile; + }, + '1.0.0-rc.2': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + if (options.network === NETWORK_TESTNET) { + options.platform.drive.tenderdash.genesis = testnet.get('platform.drive.tenderdash.genesis'); + } + + // Update tenderdash image + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + options.core.rpc.users.drive_consensus.whitelist = base.get('core.rpc.users.drive_consensus.whitelist'); + }); + return configFile; + }, + '1.0.0': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + if (name === 'base') { + options.platform.drive.tenderdash.mempool = base.get('platform.drive.tenderdash.mempool'); + options.platform.drive.tenderdash.genesis = base.get('platform.drive.tenderdash.genesis'); + } else if (options.network === NETWORK_MAINNET) { + options.platform.drive.tenderdash.p2p = mainnet.get('platform.drive.tenderdash.p2p'); + options.platform.drive.tenderdash.mempool = mainnet.get('platform.drive.tenderdash.mempool'); + options.platform.drive.tenderdash.genesis = mainnet.get('platform.drive.tenderdash.genesis'); + + if (options.platform.drive.tenderdash.node.id !== null) { + options.platform.enable = true; + } + } + + // Update tenderdash image + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + options.core.docker.image = base.get('core.docker.image'); + }); + return configFile; + }, + '1.0.2': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + options.core.indexes = []; + options.platform.drive.abci.docker.image = 'dashpay/drive:1'; + options.platform.dapi.api.docker.image = 'dashpay/dapi:1'; + }); + return configFile; + }, + '1.1.0-dev.1': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + if (name === 'local') { + options.platform.drive.abci.epochTime = 1200; + } + + if (options.network === NETWORK_MAINNET && name !== 'base') { + options.platform.drive.tenderdash.p2p.seeds = mainnet.get('platform.drive.tenderdash.p2p.seeds'); + } + + options.platform.drive.abci.docker.image = 'dashpay/drive:1-dev'; + options.platform.dapi.api.docker.image = 'dashpay/dapi:1-dev'; + + options.platform.gateway.listeners.dapiAndDrive.waitForStResultTimeout = '125s'; + options.platform.dapi.api.waitForStResultTimeout = 120000; + + options.platform.drive.tenderdash.p2p.maxConnections = 64; + options.platform.drive.tenderdash.p2p.maxOutgoingConnections = 30; + options.platform.drive.tenderdash.genesis + .consensus_params = base.get('platform.drive.tenderdash.genesis.consensus_params'); + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + }); + return configFile; + }, + '1.1.0-dev.2': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + if (options.network === NETWORK_TESTNET) { + options.platform.drive.abci.proposer = { + txProcessingTimeLimit: 5000, + }; + options.platform.drive.tenderdash.mempool.timeoutCheckTx = '3s'; + options.platform.drive.tenderdash.mempool.txEnqueueTimeout = '30ms'; + options.platform.drive.tenderdash.mempool.txSendRateLimit = 100; + options.platform.drive.tenderdash.mempool.txRecvRateLimit = 120; + options.platform.drive.tenderdash.mempool.ttlDuration = '24h'; + options.platform.drive.tenderdash.mempool.ttlNumBlocks = 0; + } else if (options.network === NETWORK_MAINNET && name !== 'base') { + options.platform.drive.abci.proposer = { + txProcessingTimeLimit: 5000, + }; + options.platform.drive.tenderdash.mempool.ttlDuration = '24h'; + options.platform.drive.tenderdash.mempool.ttlNumBlocks = 0; + } else { + options.platform.drive.tenderdash.mempool.ttlDuration = '0s'; + options.platform.drive.tenderdash.mempool.ttlNumBlocks = 0; + options.platform.drive.abci.proposer = { + txProcessingTimeLimit: null, + }; + } + }); + return configFile; + }, }; } diff --git a/packages/dashmate/docker-compose.build.dapi_core_streams.yml b/packages/dashmate/docker-compose.build.dapi_core_streams.yml new file mode 100644 index 00000000000..ec9cfdcf450 --- /dev/null +++ b/packages/dashmate/docker-compose.build.dapi_core_streams.yml @@ -0,0 +1,22 @@ +version: '3.7' + +services: + dapi_core_streams: + build: + context: ${PLATFORM_DAPI_API_DOCKER_BUILD_CONTEXT:?err} + dockerfile: ${PLATFORM_DAPI_API_DOCKER_BUILD_DOCKER_FILE:?err} + target: ${PLATFORM_DAPI_API_DOCKER_BUILD_TARGET} + args: + RUSTC_WRAPPER: ${RUSTC_WRAPPER} + SCCACHE_MEMCACHED: ${SCCACHE_MEMCACHED} + SCCACHE_GHA_ENABLED: ${SCCACHE_GHA_ENABLED} + ACTIONS_CACHE_URL: ${ACTIONS_CACHE_URL} + ACTIONS_RUNTIME_TOKEN: ${ACTIONS_RUNTIME_TOKEN} + SCCACHE_BUCKET: ${SCCACHE_BUCKET} + SCCACHE_REGION: ${SCCACHE_REGION} + SCCACHE_S3_KEY_PREFIX: ${SCCACHE_S3_KEY_PREFIX} + cache_from: + - ${CACHE_DAPI_API_FROM:-${PLATFORM_DAPI_API_DOCKER_IMAGE}} + cache_to: + - ${CACHE_DAPI_API_TO:-type=inline} + image: dapi:local diff --git a/packages/dashmate/docker-compose.build.dapi_tx_filter_stream.yml b/packages/dashmate/docker-compose.build.dapi_tx_filter_stream.yml deleted file mode 100644 index 35e82f593ac..00000000000 --- a/packages/dashmate/docker-compose.build.dapi_tx_filter_stream.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '3.7' - -services: - dapi_tx_filter_stream: - build: - context: ${PLATFORM_DAPI_API_DOCKER_BUILD_CONTEXT:?err} - dockerfile: ${PLATFORM_DAPI_API_DOCKER_BUILD_DOCKER_FILE:?err} - target: ${PLATFORM_DAPI_API_DOCKER_BUILD_TARGET} - args: - RUSTC_WRAPPER: ${RUSTC_WRAPPER} - SCCACHE_MEMCACHED: ${SCCACHE_MEMCACHED} - SCCACHE_GHA_ENABLED: ${SCCACHE_GHA_ENABLED} - ACTIONS_CACHE_URL: ${ACTIONS_CACHE_URL} - ACTIONS_RUNTIME_TOKEN: ${ACTIONS_RUNTIME_TOKEN} - SCCACHE_BUCKET: ${SCCACHE_BUCKET} - SCCACHE_REGION: ${SCCACHE_REGION} - SCCACHE_S3_KEY_PREFIX: ${SCCACHE_S3_KEY_PREFIX} - cache_from: - - ${CACHE_DAPI_API_FROM:-${PLATFORM_DAPI_API_DOCKER_IMAGE}} - cache_to: - - ${CACHE_DAPI_API_TO:-type=inline} - image: dapi:local diff --git a/packages/dashmate/docker-compose.rate_limiter.metrics.yml b/packages/dashmate/docker-compose.rate_limiter.metrics.yml new file mode 100644 index 00000000000..7e76d9959c3 --- /dev/null +++ b/packages/dashmate/docker-compose.rate_limiter.metrics.yml @@ -0,0 +1,20 @@ +version: '3.7' + +services: + gateway_rate_limiter_metrics: + image: ${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_DOCKER_IMAGE:?err} + labels: + org.dashmate.service.title: "Gateway rate limiter metrics exporter" + restart: unless-stopped + entrypoint: /bin/statsd_exporter + command: + - "--statsd.mapping-config=/etc/statsd-exporter/config.yaml" + networks: + - gateway_rate_limiter + volumes: + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/rate_limiter/statsd_exporter.yaml:/etc/statsd-exporter/config.yaml:ro + expose: + - 9125 + - 9125/udp + ports: + - ${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_HOST:?err}:${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_PORT:?err}:9102 diff --git a/packages/dashmate/docker-compose.rate_limiter.yml b/packages/dashmate/docker-compose.rate_limiter.yml new file mode 100644 index 00000000000..9833a620365 --- /dev/null +++ b/packages/dashmate/docker-compose.rate_limiter.yml @@ -0,0 +1,54 @@ +version: '3.7' + +services: + gateway: + depends_on: + - dapi_api + - dapi_core_streams + - drive_abci + - gateway_rate_limiter + + gateway_rate_limiter: + labels: + org.dashmate.service.title: "Gateway rate limiter" + restart: unless-stopped + image: ${PLATFORM_GATEWAY_RATE_LIMITER_DOCKER_IMAGE:?err} + command: /bin/ratelimit + depends_on: + - gateway_rate_limiter_redis + networks: + - gateway_rate_limiter + volumes: + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/rate_limiter/rate_limiter.yaml:/data/ratelimit/config/config.yaml:ro + environment: + - LOG_LEVEL=info + - LOG_FORMAT=text + - BACKEND_TYPE=redis + - REDIS_SOCKET_TYPE=tcp + - REDIS_URL=gateway_rate_limiter_redis:6379 + - RUNTIME_ROOT=/data + - RUNTIME_SUBDIRECTORY=ratelimit + - RUNTIME_WATCH_ROOT=false + - DISABLE_STATS=${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_DISABLED:?err} + - STATSD_HOST=gateway_rate_limiter_metrics + - STATSD_PORT=9125 + - CONFIG_TYPE=FILE + - GRPC_MAX_CONNECTION_AGE=1h + - GRPC_MAX_CONNECTION_AGE_GRACE=10m + - GRPC_PORT=8081 + expose: + - 8081 + profiles: + - platform + + gateway_rate_limiter_redis: + labels: + org.dashmate.service.title: "Gateway rate limiter storage" + restart: unless-stopped + image: redis:alpine + expose: + - 6379 + networks: + - gateway_rate_limiter + profiles: + - platform diff --git a/packages/dashmate/docker-compose.yml b/packages/dashmate/docker-compose.yml index 8ecff50b5b5..eddef84057a 100644 --- a/packages/dashmate/docker-compose.yml +++ b/packages/dashmate/docker-compose.yml @@ -12,6 +12,8 @@ services: ports: - 127.0.0.1:${DASHMATE_HELPER_API_PORT:?err}:${DASHMATE_HELPER_API_PORT:?err} command: yarn workspace dashmate helper ${CONFIG_NAME:?err} + expose: + - ${DASHMATE_HELPER_API_PORT:?err} volumes: - ${DASHMATE_HOME_DIR:?err}:/home/dashmate/.dashmate - /var/run/docker.sock:/var/run/docker.sock @@ -22,8 +24,8 @@ services: org.dashmate.service.title: "Core" restart: unless-stopped ports: - - ${CORE_P2P_HOST:?err}:${CORE_P2P_PORT:?err}:${CORE_P2P_PORT:?err} # P2P - - ${CORE_RPC_HOST:?err}:${CORE_RPC_PORT:?err}:${CORE_RPC_PORT:?err} #RPC + - ${CORE_P2P_HOST:?err}:${CORE_P2P_PORT:?err}:${CORE_P2P_PORT:?err} + - ${CORE_RPC_HOST:?err}:${CORE_RPC_PORT:?err}:${CORE_RPC_PORT:?err} volumes: - core_data:/home/dash - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/core/dash.conf:/home/dash/.dashcore/dash.conf:ro @@ -47,35 +49,53 @@ services: volumes: - drive_abci_data:/var/lib/dash/rs-drive-abci/db environment: - - BLOCK_SPACING_MS=3000 # TODO: sync with tenderdash - CHAIN_ID=${PLATFORM_DRIVE_TENDERDASH_GENESIS_CHAIN_ID:-devnet} - - CORE_JSON_RPC_USERNAME=${CORE_RPC_USER:?err} - - CORE_JSON_RPC_PASSWORD=${CORE_RPC_PASSWORD:?err} - - CORE_JSON_RPC_HOST=core - - CORE_JSON_RPC_PORT=${CORE_RPC_PORT:?err} - - CORE_ZMQ_HOST=core - - CORE_ZMQ_PORT=29998 - - DPNS_MASTER_PUBLIC_KEY=${PLATFORM_DPNS_MASTER_PUBLIC_KEY} - - DPNS_SECOND_PUBLIC_KEY=${PLATFORM_DPNS_SECOND_PUBLIC_KEY} - - DASHPAY_MASTER_PUBLIC_KEY=${PLATFORM_DASHPAY_MASTER_PUBLIC_KEY} - - DASHPAY_SECOND_PUBLIC_KEY=${PLATFORM_DASHPAY_SECOND_PUBLIC_KEY} + - CORE_CONSENSUS_JSON_RPC_USERNAME=drive_consensus + - CORE_CONSENSUS_JSON_RPC_PASSWORD=${CORE_RPC_USERS_DRIVE_CONSENSUS_PASSWORD:?err} + - CORE_CONSENSUS_JSON_RPC_HOST=core + - CORE_CONSENSUS_JSON_RPC_PORT=${CORE_RPC_PORT:?err} + - CORE_CHECK_TX_JSON_RPC_USERNAME=drive_check_tx + - CORE_CHECK_TX_JSON_RPC_PASSWORD=${CORE_RPC_USERS_DRIVE_CHECK_TX_PASSWORD:?err} + - CORE_CHECK_TX_JSON_RPC_HOST=core + - CORE_CHECK_TX_JSON_RPC_PORT=${CORE_RPC_PORT:?err} - EPOCH_TIME_LENGTH_S=${PLATFORM_DRIVE_ABCI_EPOCH_TIME} - - FEATURE_FLAGS_MASTER_PUBLIC_KEY=${PLATFORM_FEATURE_FLAGS_MASTER_PUBLIC_KEY} - - FEATURE_FLAGS_SECOND_PUBLIC_KEY=${PLATFORM_FEATURE_FLAGS_SECOND_PUBLIC_KEY} - - MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=${PLATFORM_MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY} - - MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=${PLATFORM_MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY} - - WITHDRAWALS_MASTER_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_MASTER_PUBLIC_KEY} - - WITHDRAWALS_SECOND_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_SECOND_PUBLIC_KEY} - - QUORUM_SIZE=5 # TODO: sync with Tenderdash - - QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_LLMQ_TYPE:?err} + - VALIDATOR_SET_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_LLMQ_TYPE:?err} + - VALIDATOR_SET_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_DKG_INTERVAL:?err} + - VALIDATOR_SET_QUORUM_ACTIVE_SIGNERS=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_ACTIVE_SIGNERS:?err} + - VALIDATOR_SET_QUORUM_ROTATION=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_ROTATION:?err} + - CHAIN_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_LLMQ_TYPE:?err} + - CHAIN_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_DKG_INTERVAL:?err} + - CHAIN_LOCK_QUORUM_ACTIVE_SIGNERS=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_ACTIVE_SIGNERS:?err} + - CHAIN_LOCK_QUORUM_ROTATION=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_ROTATION:?err} + - INSTANT_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_LLMQ_TYPE:?err} + - INSTANT_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_DKG_INTERVAL:?err} + - INSTANT_LOCK_QUORUM_ACTIVE_SIGNERS=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_ACTIVE_SIGNERS:?err} + - INSTANT_LOCK_QUORUM_ROTATION=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_ROTATION:?err} + - DB_PATH=/var/lib/dash/rs-drive-abci/db + - ABCI_CONSENSUS_BIND_ADDRESS=tcp://0.0.0.0:26658 + - GRPC_BIND_ADDRESS=0.0.0.0:26670 + - PROMETHEUS_BIND_ADDRESS=${PLATFORM_DRIVE_ABCI_METRICS_URL} + - TOKIO_CONSOLE_ENABLED=${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_ENABLED:?err} + - TOKIO_CONSOLE_ADDRESS=0.0.0.0:${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_PORT:?err} + - TOKIO_CONSOLE_RETENTION_SECS=${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_RETENTION:?err} + - GROVEDB_VISUALIZER_ENABLED=${PLATFORM_DRIVE_ABCI_GROVEDB_VISUALIZER_ENABLED:?err} + - GROVEDB_VISUALIZER_ADDRESS=0.0.0.0:${PLATFORM_DRIVE_ABCI_GROVEDB_VISUALIZER_PORT:?err} + - PROPOSER_TX_PROCESSING_TIME_LIMIT=${PLATFORM_DRIVE_ABCI_PROPOSER_TX_PROCESSING_TIME_LIMIT} - NETWORK=${NETWORK:?err} - - TENDERDASH_P2P_PORT=${PLATFORM_DRIVE_TENDERDASH_P2P_PORT:?err} stop_grace_period: 30s + expose: + - 26658 + - 26659 + - 26670 env_file: # Logger settings - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/drive/abci/logger.env profiles: - platform + ports: + - ${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_HOST:?err}:${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_PORT:?err}:${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_PORT:?err} + - ${PLATFORM_DRIVE_ABCI_METRICS_HOST:?err}:${PLATFORM_DRIVE_ABCI_METRICS_PORT:?err}:29090 + - ${PLATFORM_DRIVE_ABCI_GROVEDB_VISUALIZER_HOST:?err}:${PLATFORM_DRIVE_ABCI_GROVEDB_VISUALIZER_PORT:?err}:${PLATFORM_DRIVE_ABCI_GROVEDB_VISUALIZER_PORT:?err} drive_tenderdash: image: ${PLATFORM_DRIVE_TENDERDASH_DOCKER_IMAGE:?err} @@ -102,6 +122,9 @@ services: labels: org.dashmate.service.title: "DAPI API" restart: unless-stopped + deploy: + mode: replicated + replicas: ${PLATFORM_DAPI_API_DOCKER_DEPLOY_REPLICAS:-1} depends_on: - drive_tenderdash environment: @@ -109,63 +132,80 @@ services: - API_GRPC_PORT=3005 - DASHCORE_RPC_HOST=core - DASHCORE_RPC_PORT=${CORE_RPC_PORT:?err} - - DASHCORE_RPC_USER=${CORE_RPC_USER:?err} - - DASHCORE_RPC_PASS=${CORE_RPC_PASSWORD:?err} + - DASHCORE_RPC_USER=dapi + - DASHCORE_RPC_PASS=${CORE_RPC_USERS_DAPI_PASSWORD:?err} - DASHCORE_ZMQ_HOST=core - DASHCORE_ZMQ_PORT=29998 - - DASHCORE_P2P_HOST=core - - DASHCORE_P2P_PORT=${CORE_P2P_PORT:?err} - - DASHCORE_P2P_NETWORK=devnet - - NETWORK=devnet + - NETWORK=${NETWORK:?err} - TENDERMINT_RPC_HOST=drive_tenderdash - TENDERMINT_RPC_PORT=${PLATFORM_DRIVE_TENDERDASH_RPC_PORT:?err} - NODE_ENV=${ENVIRONMENT:?err} - command: --only api + - DRIVE_RPC_HOST=drive_abci + - DRIVE_RPC_PORT=26670 + - WAIT_FOR_ST_RESULT_TIMEOUT=${PLATFORM_DAPI_API_WAIT_FOR_ST_RESULT_TIMEOUT:?err} + command: yarn run api stop_grace_period: 10s + expose: + - 3004 + - 3005 profiles: - platform - dapi_tx_filter_stream: + dapi_core_streams: image: ${PLATFORM_DAPI_API_DOCKER_IMAGE:?err} labels: org.dashmate.service.title: "DAPI Transactions Filter Stream" restart: unless-stopped + deploy: + mode: replicated + replicas: ${PLATFORM_DAPI_API_DOCKER_DEPLOY_REPLICAS:-1} environment: - TX_FILTER_STREAM_GRPC_PORT=3006 - DASHCORE_RPC_HOST=core - DASHCORE_RPC_PORT=${CORE_RPC_PORT:?err} - - DASHCORE_RPC_USER=${CORE_RPC_USER:?err} - - DASHCORE_RPC_PASS=${CORE_RPC_PASSWORD:?err} + - DASHCORE_RPC_USER=dapi + - DASHCORE_RPC_PASS=${CORE_RPC_USERS_DAPI_PASSWORD:?err} - DASHCORE_ZMQ_HOST=core - DASHCORE_ZMQ_PORT=29998 - - DASHCORE_P2P_HOST=core - - DASHCORE_P2P_PORT=${CORE_P2P_PORT:?err} - - DASHCORE_P2P_NETWORK=devnet - - NETWORK=devnet + - NETWORK=${NETWORK:?err} - TENDERMINT_RPC_HOST=drive_tenderdash - TENDERMINT_RPC_PORT=26657 - command: --only core-streams + - DRIVE_RPC_HOST=drive_abci + - DRIVE_RPC_PORT=26670 + expose: + - 3006 + command: yarn run core-streams stop_grace_period: 10s profiles: - platform - dapi_envoy: - image: ${PLATFORM_DAPI_ENVOY_DOCKER_IMAGE:?err} + gateway: + image: ${PLATFORM_GATEWAY_DOCKER_IMAGE:?err} labels: - org.dashmate.service.title: "DAPI Envoy" + org.dashmate.service.title: "Gateway" restart: unless-stopped ports: - - ${PLATFORM_DAPI_ENVOY_HTTP_HOST:?err}:${PLATFORM_DAPI_ENVOY_HTTP_PORT:?err}:10000 # JSON RPC and gRPC Web & Native + # HTTP entry point to the platform. + # Supports HTTP1 and HTTP2 + # Serves JSON RPC, gRPC, and gRPC-Web + - ${PLATFORM_GATEWAY_LISTENERS_DAPI_AND_DRIVE_HOST:?err}:${PLATFORM_GATEWAY_LISTENERS_DAPI_AND_DRIVE_PORT:?err}:10000 + - ${PLATFORM_GATEWAY_METRICS_HOST:?err}:${PLATFORM_GATEWAY_METRICS_PORT:?err}:9090 + - ${PLATFORM_GATEWAY_ADMIN_HOST:?err}:${PLATFORM_GATEWAY_ADMIN_PORT:?err}:9901 depends_on: - dapi_api - - dapi_tx_filter_stream + - dapi_core_streams + - drive_abci + networks: + - default + - gateway_rate_limiter environment: - ENVOY_UID=${LOCAL_UID:?err} - ENVOY_GID=${LOCAL_GID:?err} + - LOG_LEVEL=${PLATFORM_GATEWAY_LOG_LEVEL:?err} volumes: - - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/dapi/envoy/envoy.yaml:/etc/envoy/envoy.yaml:ro - - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/dapi/envoy/ssl/bundle.crt:/etc/ssl/bundle.crt:ro - - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/dapi/envoy/ssl/private.key:/etc/ssl/private.key:ro + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/envoy.yaml:/etc/envoy/envoy.yaml:ro + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/ssl/bundle.crt:/etc/ssl/bundle.crt:ro + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/ssl/private.key:/etc/ssl/private.key:ro stop_grace_period: 10s profiles: - platform @@ -173,11 +213,13 @@ services: volumes: core_data: drive_abci_data: - drive_abci_logs: drive_tenderdash: networks: default: + driver: bridge ipam: config: - subnet: ${DOCKER_NETWORK_SUBNET:?err} + gateway_rate_limiter: + driver: bridge diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 02661e4b7ed..88780b923ad 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", @@ -12,10 +12,6 @@ "test:e2e": "mocha --recursive test/e2e", "helper": "node scripts/helper.js" }, - "repository": { - "type": "git", - "url": "git+https://github.com/dashevo/dashmate.git" - }, "type": "module", "bin": "./bin/run.js", "contributors": [ @@ -49,21 +45,20 @@ "node": ">=20" }, "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, "bugs": { - "url": "https://github.com/dashevo/dashmate/issues" + "url": "https://github.com/dashpay/platform/issues" }, - "homepage": "https://github.com/dashevo/dashmate#readme", + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/dashmate#readme", "dependencies": { - "@babel/core": "^7.23.3", - "@babel/eslint-parser": "^7.23.3", "@dashevo/bls": "~1.2.9", - "@dashevo/dashcore-lib": "~0.21.0", - "@dashevo/dashd-rpc": "^18.2.0", - "@dashevo/dashpay-contract": "workspace:*", + "@dashevo/dapi-client": "workspace:*", + "@dashevo/dashcore-lib": "~0.21.3", + "@dashevo/dashd-rpc": "^19.0.0", "@dashevo/docker-compose": "^0.24.4", - "@dashevo/dpns-contract": "workspace:*", - "@dashevo/feature-flags-contract": "workspace:*", - "@dashevo/masternode-reward-shares-contract": "workspace:*", "@dashevo/wallet-lib": "workspace:*", "@dashevo/withdrawals-contract": "workspace:*", "@oclif/core": "^3.10.8", @@ -72,8 +67,10 @@ "ajv-formats": "^2.1.1", "awilix": "^4.2.6", "begoo": "^2.0.2", + "bs58": "^4.0.1", "chalk": "^4.1.0", "cron": "^2.1.0", + "diskusage": "^1.2.0", "dockerode": "^3.3.5", "dot": "^1.1.3", "dotenv": "^8.6.0", @@ -94,10 +91,13 @@ "qs": "^6.11.0", "rxjs": "^6.6.7", "semver": "^7.5.3", + "systeminformation": "^5.22.11", "table": "^6.8.1", "wrap-ansi": "^7.0.0" }, "devDependencies": { + "@babel/core": "^7.23.3", + "@babel/eslint-parser": "^7.23.3", "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "dirty-chai": "^2.0.1", diff --git a/packages/dashmate/scripts/helper.js b/packages/dashmate/scripts/helper.js index 5ed920107c8..6cd9feb9f61 100644 --- a/packages/dashmate/scripts/helper.js +++ b/packages/dashmate/scripts/helper.js @@ -47,8 +47,8 @@ import createDIContainer from '../src/createDIContainer.js'; configFile: asValue(configFile), }); - const provider = config.get('platform.dapi.envoy.ssl.provider'); - const isEnabled = config.get('platform.dapi.envoy.ssl.enabled'); + const provider = config.get('platform.gateway.ssl.provider'); + const isEnabled = config.get('platform.gateway.ssl.enabled'); if (isEnabled && provider === 'zerossl') { const scheduleRenewZeroSslCertificate = container.resolve('scheduleRenewZeroSslCertificate'); diff --git a/packages/dashmate/src/commands/config/render.js b/packages/dashmate/src/commands/config/render.js index 76a2f117dbb..0e9c58ae0bb 100644 --- a/packages/dashmate/src/commands/config/render.js +++ b/packages/dashmate/src/commands/config/render.js @@ -31,6 +31,6 @@ Force dashmate to render all config's service configs writeServiceConfigs(config.getName(), configFiles); // eslint-disable-next-line no-console - console.log(`Config "${config.getName()}" service configs rendered`); + console.log(`"${config.getName()}" service configs rendered`); } } diff --git a/packages/dashmate/src/commands/group/restart.js b/packages/dashmate/src/commands/group/restart.js index c05d8b3c1e0..0ba25f5f8c9 100644 --- a/packages/dashmate/src/commands/group/restart.js +++ b/packages/dashmate/src/commands/group/restart.js @@ -7,6 +7,11 @@ export default class GroupRestartCommand extends GroupBaseCommand { static flags = { ...GroupBaseCommand.flags, + safe: { + char: 's', + description: 'wait for dkg before stop', + default: false, + }, }; /** @@ -21,6 +26,7 @@ export default class GroupRestartCommand extends GroupBaseCommand { async runWithDependencies( args, { + safe: isSafe, verbose: isVerbose, }, dockerCompose, @@ -38,8 +44,8 @@ export default class GroupRestartCommand extends GroupBaseCommand { { title: 'Stop nodes', task: () => ( - // So we stop the miner first, as there's a chance that MNs will get banned - // if the miner is still running when stopping them + // So we stop the miner first, as there's a chance that MNs will get banned + // if the miner is still running when stopping them new Listr(configGroup.reverse().map((config) => ({ task: () => stopNodeTask(config), }))) @@ -66,6 +72,7 @@ export default class GroupRestartCommand extends GroupBaseCommand { try { await tasks.run({ isVerbose, + isSafe, }); } catch (e) { throw new MuteOneLineError(e); diff --git a/packages/dashmate/src/commands/group/stop.js b/packages/dashmate/src/commands/group/stop.js index 149af9cc245..50c5fc6f5b5 100644 --- a/packages/dashmate/src/commands/group/stop.js +++ b/packages/dashmate/src/commands/group/stop.js @@ -13,6 +13,11 @@ export default class GroupStopCommand extends GroupBaseCommand { description: 'force stop even if any is running', default: false, }), + safe: Flags.boolean({ + char: 's', + description: 'wait for dkg before stop', + default: false, + }), }; /** @@ -27,6 +32,7 @@ export default class GroupStopCommand extends GroupBaseCommand { args, { force: isForce, + safe: isSafe, verbose: isVerbose, }, dockerCompose, @@ -63,6 +69,7 @@ export default class GroupStopCommand extends GroupBaseCommand { await tasks.run({ isVerbose, isForce, + isSafe, }); } catch (e) { throw new MuteOneLineError(e); diff --git a/packages/dashmate/src/commands/reset.js b/packages/dashmate/src/commands/reset.js index 442d9bbd8cb..99b640cdfc3 100644 --- a/packages/dashmate/src/commands/reset.js +++ b/packages/dashmate/src/commands/reset.js @@ -9,10 +9,11 @@ export default class ResetCommand extends ConfigBaseCommand { static flags = { ...ConfigBaseCommand.flags, - hard: Flags.boolean({ char: 'h', description: 'reset config as well as data', default: false }), + hard: Flags.boolean({ char: 'h', description: 'reset config as well as services and data', default: false }), force: Flags.boolean({ char: 'f', description: 'skip running services check', default: false }), platform: Flags.boolean({ char: 'p', description: 'reset platform services and data only', default: false }), verbose: Flags.boolean({ char: 'v', description: 'use verbose mode for output', default: false }), + 'keep-data': Flags.boolean({ description: 'keep data', default: false }), }; /** @@ -30,6 +31,7 @@ export default class ResetCommand extends ConfigBaseCommand { hard: isHardReset, force: isForce, platform: isPlatformOnlyReset, + 'keep-data': keepData, }, config, resetNodeTask, @@ -58,6 +60,7 @@ export default class ResetCommand extends ConfigBaseCommand { isPlatformOnlyReset, isForce, isVerbose, + keepData, }); } catch (e) { throw new MuteOneLineError(e); diff --git a/packages/dashmate/src/commands/restart.js b/packages/dashmate/src/commands/restart.js index 4cd5c29252e..a0352392161 100644 --- a/packages/dashmate/src/commands/restart.js +++ b/packages/dashmate/src/commands/restart.js @@ -10,6 +10,8 @@ export default class RestartCommand extends ConfigBaseCommand { static flags = { ...ConfigBaseCommand.flags, platform: Flags.boolean({ char: 'p', description: 'restart only platform', default: false }), + safe: Flags.boolean({ char: 's', description: 'wait for DKG before stop', default: false }), + force: Flags.boolean({ char: 'f', description: 'ignore DKG (masternode might be banned)', default: false }), }; /** @@ -25,6 +27,8 @@ export default class RestartCommand extends ConfigBaseCommand { { verbose: isVerbose, platform: platformOnly, + safe: isSafe, + force: isForce, }, dockerCompose, restartNodeTask, @@ -51,6 +55,8 @@ export default class RestartCommand extends ConfigBaseCommand { try { await tasks.run({ isVerbose, + isSafe, + isForce, platformOnly: platformOnly === true, }); } catch (e) { diff --git a/packages/dashmate/src/commands/setup.js b/packages/dashmate/src/commands/setup.js index 8b09ce8bc9f..f9e1465a226 100644 --- a/packages/dashmate/src/commands/setup.js +++ b/packages/dashmate/src/commands/setup.js @@ -66,10 +66,6 @@ export default class SetupCommand extends BaseCommand { const tasks = new Listr( [ - { - title: 'System requirements', - task: async () => dockerCompose.throwErrorIfNotInstalled(), - }, { title: 'Configuration preset', task: async (ctx, task) => { diff --git a/packages/dashmate/src/commands/status/platform.js b/packages/dashmate/src/commands/status/platform.js index 073ebd52573..2c0e401f18c 100644 --- a/packages/dashmate/src/commands/status/platform.js +++ b/packages/dashmate/src/commands/status/platform.js @@ -32,6 +32,7 @@ export default class PlatformStatusCommand extends ConfigBaseCommand { flags, dockerCompose, createRpcClient, + getConnectionHost, config, getPlatformScope, ) { @@ -57,6 +58,7 @@ export default class PlatformStatusCommand extends ConfigBaseCommand { if (flags.format === OUTPUT_FORMATS.PLAIN) { const { + platformActivation, httpService, httpPort, httpPortState, @@ -68,6 +70,8 @@ export default class PlatformStatusCommand extends ConfigBaseCommand { drive, } = scope; + plain['Platform Activation'] = platformActivation ? colors.platformActivation(platformActivation)(platformActivation) : 'n/a'; + plain['HTTP service'] = httpService || 'n/a'; plain['HTTP port'] = `${httpPort} ${httpPortState ? colors.portState(httpPortState)(httpPortState) : ''}`; plain['P2P service'] = p2pService || 'n/a'; diff --git a/packages/dashmate/src/commands/stop.js b/packages/dashmate/src/commands/stop.js index cb1c378b407..dc9f3fe177d 100644 --- a/packages/dashmate/src/commands/stop.js +++ b/packages/dashmate/src/commands/stop.js @@ -11,7 +11,7 @@ export default class StopCommand extends ConfigBaseCommand { ...ConfigBaseCommand.flags, force: Flags.boolean({ char: 'f', - description: 'force stop even if any service is running', + description: 'force stop even if any service is running or DKG is in progress', default: false, }), platform: Flags.boolean({ @@ -19,6 +19,11 @@ export default class StopCommand extends ConfigBaseCommand { description: 'stop only platform', default: false, }), + safe: Flags.boolean({ + char: 's', + description: 'wait for dkg before stop', + default: false, + }), }; /** @@ -32,6 +37,7 @@ export default class StopCommand extends ConfigBaseCommand { args, { force: isForce, + safe: isSafe, verbose: isVerbose, platform: platformOnly, }, @@ -59,6 +65,7 @@ export default class StopCommand extends ConfigBaseCommand { await tasks.run({ isForce, isVerbose, + isSafe, platformOnly: platformOnly === true, }); } catch (e) { diff --git a/packages/dashmate/src/commands/update.js b/packages/dashmate/src/commands/update.js index 8ba5b774d25..dce6b2c6790 100644 --- a/packages/dashmate/src/commands/update.js +++ b/packages/dashmate/src/commands/update.js @@ -35,6 +35,12 @@ export default class UpdateCommand extends ConfigBaseCommand { ) { const updateInfo = await updateNode(config); + const colors = { + updated: chalk.yellow, + 'up to date': chalk.green, + error: chalk.red, + }; + // Draw table or show json printArrayOfObjects(updateInfo .reduce( @@ -43,7 +49,7 @@ export default class UpdateCommand extends ConfigBaseCommand { }) => ([ ...acc, format === OUTPUT_FORMATS.PLAIN - ? { Service: title, Image: image, Updated: updated ? chalk.yellow('updated') : chalk.green('up to date') } + ? { Service: title, Image: image, Updated: colors[updated](updated) } : { name, title, updated, image, }, diff --git a/packages/dashmate/src/config/configJsonSchema.js b/packages/dashmate/src/config/configJsonSchema.js index d60a43e2d9e..0e9dc266d19 100644 --- a/packages/dashmate/src/config/configJsonSchema.js +++ b/packages/dashmate/src/config/configJsonSchema.js @@ -50,6 +50,11 @@ export default { required: ['image', 'build'], additionalProperties: false, }, + host: { + type: 'string', + minLength: 1, + format: 'ipv4', + }, port: { type: 'integer', minimum: 0, @@ -74,7 +79,7 @@ export default { }, duration: { type: 'string', - pattern: '^[0-9]+(\\.[0-9]+)?(ms|m|s|h)$', + pattern: '^0|([0-9]+(\\.[0-9]+)?(ms|m|s|h))$', }, optionalDuration: { type: ['null', 'string'], @@ -84,6 +89,58 @@ export default { type: 'string', pattern: '^[0-9]+(\\.[0-9]+)?s$', }, + enabledHostPort: { + type: 'object', + properties: { + enabled: { + type: 'boolean', + }, + host: { + $ref: '#/definitions/host', + }, + port: { + $ref: '#/definitions/port', + }, + }, + additionalProperties: false, + required: ['enabled', 'host', 'port'], + }, + quorum: { + type: 'object', + properties: { + llmqType: { + type: 'integer', + enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107], + }, + dkgInterval: { + type: 'integer', + minimum: 1, + }, + activeSigners: { + type: 'integer', + minimum: 1, + }, + rotation: { + type: 'boolean', + }, + }, + required: ['llmqType', 'dkgInterval', 'activeSigners', 'rotation'], + additionalProperties: false, + }, + quorumName: { + type: 'string', + enum: [ + 'llmq_devnet', + 'llmq_devnet_dip0024', + 'llmq_devnet_platform', + 'llmq_50_60', + 'llmq_60_75', + 'llmq_400_60', + 'llmq_400_85', + 'llmq_100_67', + 'llmq_25_67', + ], + }, }, properties: { description: { @@ -173,9 +230,7 @@ export default { type: 'object', properties: { host: { - type: 'string', - minLength: 1, - format: 'ipv4', + $ref: '#/definitions/host', }, port: { $ref: '#/definitions/port', @@ -212,13 +267,35 @@ export default { port: { $ref: '#/definitions/port', }, - user: { - type: 'string', - minLength: 1, - }, - password: { - type: 'string', - minLength: 1, + users: { + type: 'object', + minProperties: 1, + propertyNames: { + type: 'string', + minLength: 1, + }, + additionalProperties: { + type: 'object', + properties: { + password: { + type: 'string', + minLength: 1, + }, + whitelist: { + type: ['null', 'array'], + items: { + type: 'string', + minLength: 1, + }, + minItems: 1, + }, + lowPriority: { + type: 'boolean', + }, + }, + required: ['password', 'whitelist', 'lowPriority'], + additionalProperties: false, + }, }, allowIps: { type: 'array', @@ -227,7 +304,7 @@ export default { }, }, }, - required: ['host', 'port', 'user', 'password'], + required: ['host', 'port', 'users', 'allowIps'], additionalProperties: false, }, spork: { @@ -298,6 +375,25 @@ export default { type: 'integer', minimum: 1, }, + llmq: { + type: 'object', + properties: { + chainLocks: { + $ref: '#/definitions/quorumName', + }, + instantSend: { + $ref: '#/definitions/quorumName', + }, + platform: { + $ref: '#/definitions/quorumName', + }, + mnhf: { + $ref: '#/definitions/quorumName', + }, + }, + required: ['chainLocks', 'instantSend', 'platform', 'mnhf'], + additionalProperties: false, + }, }, additionalProperties: false, required: ['name', 'minimumDifficultyBlocks', 'powTargetSpacing'], @@ -337,7 +433,14 @@ export default { enum: [0, 1], }, indexes: { - type: 'boolean', + type: ['array'], + uniqueItems: true, + items: { + type: 'string', + enum: ['address', 'tx', 'timestamp', 'spent'], + }, + description: 'List of core indexes to enable. `platform.enable`, ' + + ' `core.masternode.enable`, and `core.insight.enabled` add indexes dynamically', }, }, required: ['docker', 'p2p', 'rpc', 'spork', 'masternode', 'miner', 'devnet', 'log', @@ -347,18 +450,78 @@ export default { platform: { type: 'object', properties: { - dapi: { + gateway: { type: 'object', properties: { - envoy: { + docker: { + $ref: '#/definitions/docker', + }, + maxConnections: { + type: 'integer', + minimum: 1, + description: 'Maximum number of connections that Gateway accepts from downstream clients', + }, + maxHeapSizeInBytes: { + type: 'integer', + minimum: 1, + description: 'Maximum heap size in bytes. If the heap size exceeds this value, Gateway will take actions to reduce memory usage', + }, + upstreams: { type: 'object', properties: { - docker: { - $ref: '#/definitions/docker', + driveGrpc: { + $id: 'gatewayUpstream', + type: 'object', + properties: { + maxRequests: { + type: 'integer', + minimum: 1, + description: 'The maximum number of parallel requests', + }, + }, + required: ['maxRequests'], + additionalProperties: false, }, - http: { + dapiApi: { + $ref: 'gatewayUpstream', + }, + dapiCoreStreams: { + $ref: 'gatewayUpstream', + }, + dapiJsonRpc: { + $ref: 'gatewayUpstream', + }, + }, + additionalProperties: false, + required: ['driveGrpc', 'dapiApi', 'dapiCoreStreams', 'dapiJsonRpc'], + }, + metrics: { + $ref: '#/definitions/enabledHostPort', + }, + admin: { + $ref: '#/definitions/enabledHostPort', + }, + listeners: { + type: 'object', + properties: { + dapiAndDrive: { type: 'object', properties: { + http2: { + type: 'object', + properties: { + maxConcurrentStreams: { + type: 'integer', + minimum: 1, + description: 'Maximum number of concurrent streams allowed for each connection', + }, + }, + additionalProperties: false, + required: ['maxConcurrentStreams'], + }, + waitForStResultTimeout: { + $ref: '#/definitions/durationInSeconds', + }, host: { type: 'string', minLength: 1, @@ -367,87 +530,267 @@ export default { port: { $ref: '#/definitions/port', }, - connectTimeout: { - $ref: '#/definitions/durationInSeconds', - }, - responseTimeout: { - $ref: '#/definitions/durationInSeconds', - }, }, - required: ['host', 'port', 'connectTimeout', 'responseTimeout'], + required: ['http2', 'host', 'port', 'waitForStResultTimeout'], additionalProperties: false, }, - rateLimiter: { + }, + required: ['dapiAndDrive'], + additionalProperties: false, + }, + rateLimiter: { + type: 'object', + properties: { + docker: { + $ref: '#/definitions/docker', + }, + unit: { + type: 'string', + enum: ['second', 'minute', 'hour', 'day'], + }, + requestsPerUnit: { + type: 'integer', + minimum: 1, + }, + blacklist: { + type: 'array', + items: { + $ref: '#/definitions/host', + }, + description: 'List of IP addresses that are blacklisted from making requests', + }, + whitelist: { + type: 'array', + items: { + $ref: '#/definitions/host', + }, + description: 'List of IP addresses that are whitelisted to make requests without limits', + }, + metrics: { type: 'object', properties: { - maxTokens: { - type: 'integer', - minimum: 0, - }, - tokensPerFill: { - type: 'integer', - minimum: 0, - }, - fillInterval: { - $ref: '#/definitions/duration', + docker: { + $ref: '#/definitions/docker', }, enabled: { type: 'boolean', }, + host: { + $ref: '#/definitions/host', + }, + port: { + $ref: '#/definitions/port', + }, }, - required: ['enabled', 'fillInterval', 'tokensPerFill', 'maxTokens'], additionalProperties: false, + required: ['docker', 'enabled', 'host', 'port'], + }, + enabled: { + type: 'boolean', }, - ssl: { + }, + required: ['docker', 'enabled', 'unit', 'requestsPerUnit', 'blacklist', 'whitelist', 'metrics'], + additionalProperties: false, + }, + ssl: { + type: 'object', + properties: { + enabled: { + type: 'boolean', + }, + provider: { + type: 'string', + enum: ['zerossl', 'self-signed', 'file'], + }, + providerConfigs: { type: 'object', properties: { - enabled: { - type: 'boolean', - }, - provider: { - type: 'string', - enum: ['zerossl', 'self-signed', 'file'], - }, - providerConfigs: { - type: 'object', + zerossl: { + type: ['object'], properties: { - zerossl: { - type: ['object'], + apiKey: { + type: ['string', 'null'], + minLength: 32, + }, + id: { + type: ['string', 'null'], + minLength: 32, + }, + }, + required: ['apiKey', 'id'], + additionalProperties: false, + }, + }, + }, + }, + required: ['provider', 'providerConfigs', 'enabled'], + additionalProperties: false, + }, + log: { + type: 'object', + properties: { + level: { + type: 'string', + enum: ['trace', 'debug', 'info', 'warn', 'error', 'critical', 'off'], + }, + accessLogs: { + type: 'array', + items: { + oneOf: [ + { + type: 'object', + properties: { + type: { + type: 'string', + minLength: 1, + enum: ['stdout', 'stderr'], + description: 'Access log type: stdout, stderr or file', + }, + format: { + type: 'string', + enum: ['text', 'json'], + }, + template: true, + }, + required: ['type', 'format'], + additionalProperties: false, + if: { + type: 'object', + properties: { + format: { + const: 'json', + }, + }, + }, + then: { + type: 'object', properties: { - apiKey: { - type: ['string', 'null'], - minLength: 32, + template: { + type: ['null', 'object'], + additionalProperties: { + type: 'string', + }, + description: 'JSON fields and values. If null, default template is used.', }, - id: { - type: ['string', 'null'], - minLength: 32, + }, + required: ['template'], + }, + else: { + type: 'object', + properties: { + template: { + type: ['null', 'string'], + description: 'Template string. If null, default template is used.', }, }, - required: ['apiKey', 'id'], - additionalProperties: false, + required: ['template'], }, }, - }, + { + type: 'object', + properties: { + type: { + type: 'string', + const: 'file', + description: 'Access log type: stdout, stderr or file', + }, + format: { + type: 'string', + enum: ['text', 'json'], + }, + path: { + type: 'string', + minLength: 1, + }, + template: true, + }, + required: ['type', 'format', 'path'], + additionalProperties: false, + if: { + type: 'object', + properties: { + format: { + const: 'json', + }, + }, + }, + then: { + type: 'object', + properties: { + template: { + type: ['null', 'object'], + additionalProperties: { + type: 'string', + }, + description: 'JSON fields and values. If null, default template is used.', + }, + }, + required: ['template'], + }, + else: { + type: 'object', + properties: { + template: { + type: ['null', 'string'], + description: 'Template string. If null, default template is used.', + }, + }, + required: ['template'], + }, + }, + ], }, - required: ['provider', 'providerConfigs', 'enabled'], - additionalProperties: false, }, }, - required: ['docker', 'http', 'rateLimiter', 'ssl'], additionalProperties: false, + required: ['level', 'accessLogs'], }, + }, + required: ['docker', 'listeners', 'rateLimiter', 'ssl', 'maxHeapSizeInBytes', 'maxConnections', 'upstreams', 'metrics', 'admin', 'log'], + additionalProperties: false, + }, + dapi: { + type: 'object', + properties: { api: { type: 'object', properties: { docker: { - $ref: '#/definitions/dockerWithBuild', + type: 'object', + properties: { + image: { + type: 'string', + minLength: 1, + }, + deploy: { + type: 'object', + properties: { + replicas: { + type: 'integer', + minimum: 0, + }, + }, + additionalProperties: false, + required: ['replicas'], + }, + build: { + $ref: '#/definitions/dockerBuild', + }, + }, + required: ['image', 'build', 'deploy'], + additionalProperties: false, + }, + waitForStResultTimeout: { + type: 'integer', + minimum: 1, + description: 'How many millis to wait for state transition result before timeout', }, }, - required: ['docker'], + required: ['docker', 'waitForStResultTimeout'], additionalProperties: false, }, }, - required: ['envoy', 'api'], + required: ['api'], additionalProperties: false, }, drive: { @@ -491,25 +834,81 @@ export default { additionalProperties: false, }, }, + tokioConsole: { + type: 'object', + properties: { + enabled: { + type: 'boolean', + }, + host: { + $ref: '#/definitions/host', + }, + port: { + $ref: '#/definitions/port', + }, + retention: { + type: 'integer', + minimum: 0, + description: 'How many seconds keep data if console is not connected', + }, + }, + required: ['enabled', 'host', 'port', 'retention'], + additionalProperties: false, + }, validatorSet: { type: 'object', properties: { - llmqType: { - type: 'number', - // https://github.com/dashpay/dashcore-lib/blob/843176fed9fc81feae43ccf319d99e2dd942fe1f/lib/constants/index.js#L50-L99 - enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107], + quorum: { + $ref: '#/definitions/quorum', + }, + }, + additionalProperties: false, + required: ['quorum'], + }, + chainLock: { + type: 'object', + properties: { + quorum: { + $ref: '#/definitions/quorum', + }, + }, + additionalProperties: false, + required: ['quorum'], + }, + instantLock: { + type: 'object', + properties: { + quorum: { + $ref: '#/definitions/quorum', }, }, additionalProperties: false, - required: ['llmqType'], + required: ['quorum'], }, epochTime: { type: 'integer', minimum: 180, }, + metrics: { + $ref: '#/definitions/enabledHostPort', + }, + grovedbVisualizer: { + $ref: '#/definitions/enabledHostPort', + }, + proposer: { + type: 'object', + properties: { + txProcessingTimeLimit: { + type: ['null', 'integer'], + minimum: 0, + }, + }, + required: ['txProcessingTimeLimit'], + additionalProperties: false, + }, }, additionalProperties: false, - required: ['docker', 'logs', 'validatorSet', 'epochTime'], + required: ['docker', 'logs', 'tokioConsole', 'validatorSet', 'chainLock', 'epochTime', 'metrics', 'grovedbVisualizer', 'proposer'], }, tenderdash: { type: 'object', @@ -559,13 +958,25 @@ export default { type: 'integer', minimum: 0, }, + maxConnections: { + type: 'integer', + minimum: 1, + }, + maxOutgoingConnections: { + type: 'integer', + minimum: 1, + }, }, - required: ['host', 'port', 'persistentPeers', 'seeds', 'flushThrottleTimeout', 'maxPacketMsgPayloadSize', 'sendRate', 'recvRate'], + required: ['host', 'port', 'persistentPeers', 'seeds', 'flushThrottleTimeout', 'maxPacketMsgPayloadSize', 'sendRate', 'recvRate', 'maxConnections', 'maxOutgoingConnections'], additionalProperties: false, }, mempool: { type: 'object', properties: { + cacheSize: { + type: 'integer', + minimum: 0, + }, size: { type: 'integer', minimum: 0, @@ -574,9 +985,34 @@ export default { type: 'integer', minimum: 0, }, + timeoutCheckTx: { + $ref: '#/definitions/duration', + }, + txEnqueueTimeout: { + $ref: '#/definitions/duration', + }, + txSendRateLimit: { + type: 'integer', + minimum: 0, + }, + txRecvRateLimit: { + type: 'integer', + minimum: 0, + }, + maxConcurrentCheckTx: { + type: 'integer', + minimum: 0, + }, + ttlDuration: { + $ref: '#/definitions/duration', + }, + ttlNumBlocks: { + type: 'integer', + minimum: 0, + }, }, additionalProperties: false, - required: ['size', 'maxTxsBytes'], + required: ['size', 'maxTxsBytes', 'cacheSize', 'timeoutCheckTx', 'txEnqueueTimeout', 'txSendRateLimit', 'txRecvRateLimit', 'maxConcurrentCheckTx', 'ttlDuration', 'ttlNumBlocks'], }, consensus: { type: 'object', @@ -684,8 +1120,11 @@ export default { type: 'integer', minimum: 0, }, + timeoutBroadcastTx: { + $ref: '#/definitions/duration', + }, }, - required: ['host', 'port', 'maxOpenConnections'], + required: ['host', 'port', 'maxOpenConnections', 'timeoutBroadcastTx'], additionalProperties: false, }, pprof: { @@ -702,23 +1141,7 @@ export default { additionalProperties: false, }, metrics: { - description: 'Prometheus metrics', - type: 'object', - properties: { - enabled: { - type: 'boolean', - }, - host: { - type: 'string', - minLength: 1, - format: 'ipv4', - }, - port: { - $ref: '#/definitions/port', - }, - }, - required: ['enabled', 'host', 'port'], - additionalProperties: false, + $ref: '#/definitions/enabledHostPort', }, node: { type: 'object', @@ -746,153 +1169,15 @@ export default { required: ['abci', 'tenderdash'], additionalProperties: false, }, - dpns: { - type: 'object', - properties: { - contract: { - type: 'object', - properties: { - id: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['id'], - additionalProperties: false, - }, - ownerId: { - type: ['string', 'null'], - minLength: 1, - }, - masterPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - secondPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['contract', 'ownerId', 'masterPublicKey', 'secondPublicKey'], - additionalProperties: false, - }, - dashpay: { - type: 'object', - properties: { - contract: { - type: 'object', - properties: { - id: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['id'], - additionalProperties: false, - }, - masterPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - secondPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['contract', 'masterPublicKey', 'secondPublicKey'], - additionalProperties: false, - }, - featureFlags: { - type: 'object', - properties: { - contract: { - type: 'object', - properties: { - id: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['id'], - additionalProperties: false, - }, - ownerId: { - type: ['string', 'null'], - minLength: 1, - }, - masterPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - secondPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['contract', 'ownerId', 'masterPublicKey', 'secondPublicKey'], - additionalProperties: false, - }, sourcePath: { type: ['string', 'null'], minLength: 1, }, - masternodeRewardShares: { - type: 'object', - properties: { - contract: { - type: 'object', - properties: { - id: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['id'], - additionalProperties: false, - }, - masterPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - secondPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['contract', 'masterPublicKey', 'secondPublicKey'], - additionalProperties: false, - }, - withdrawals: { - type: 'object', - properties: { - contract: { - type: 'object', - properties: { - id: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['id'], - additionalProperties: false, - }, - masterPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - secondPublicKey: { - type: ['string', 'null'], - minLength: 1, - }, - }, - required: ['contract', 'masterPublicKey', 'secondPublicKey'], - additionalProperties: false, - }, enable: { type: 'boolean', }, }, - required: ['dapi', 'drive', 'dpns', 'dashpay', 'featureFlags', 'sourcePath', 'masternodeRewardShares', 'withdrawals', 'enable'], + required: ['gateway', 'dapi', 'drive', 'sourcePath', 'enable'], additionalProperties: false, }, dashmate: { diff --git a/packages/dashmate/src/config/generateEnvsFactory.js b/packages/dashmate/src/config/generateEnvsFactory.js index 9aedfbb95d6..fcb0491ecf7 100644 --- a/packages/dashmate/src/config/generateEnvsFactory.js +++ b/packages/dashmate/src/config/generateEnvsFactory.js @@ -44,7 +44,7 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil if (config.get('platform.dapi.api.docker.build.enabled')) { dockerComposeFiles.push('docker-compose.build.dapi_api.yml'); - dockerComposeFiles.push('docker-compose.build.dapi_tx_filter_stream.yml'); + dockerComposeFiles.push('docker-compose.build.dapi_core_streams.yml'); } } @@ -56,6 +56,14 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil dockerComposeFiles.push(insightComposeFile); } + if (config.get('platform.gateway.rateLimiter.enabled')) { + dockerComposeFiles.push('docker-compose.rate_limiter.yml'); + + if (config.get('platform.gateway.rateLimiter.metrics.enabled')) { + dockerComposeFiles.push('docker-compose.rate_limiter.metrics.yml'); + } + } + // we need this for compatibility with old configs const projectIdWithPrefix = configFile.getProjectId() ? `_${configFile.getProjectId()}` : ''; @@ -68,6 +76,11 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil tenderdashLogDirectoryPath = path.dirname(tenderdashLogFilePath); } + let driveAbciMetricsUrl = ''; + if (config.get('platform.drive.abci.metrics.enabled')) { + driveAbciMetricsUrl = 'http://0.0.0.0:29090'; + } + return { DASHMATE_HOME_DIR: homeDir.getPath(), LOCAL_UID: uid, @@ -84,6 +97,8 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil ), DASHMATE_HELPER_DOCKER_IMAGE, PLATFORM_DRIVE_TENDERDASH_LOG_DIRECTORY_PATH: tenderdashLogDirectoryPath, + PLATFORM_GATEWAY_RATE_LIMITER_METRICS_DISABLED: !config.get('platform.gateway.rateLimiter.metrics.enabled'), + PLATFORM_DRIVE_ABCI_METRICS_URL: driveAbciMetricsUrl, ...convertObjectToEnvs(config.getOptions()), }; } diff --git a/packages/dashmate/src/constants.js b/packages/dashmate/src/constants.js index b7f7e7c4641..7dc045e3050 100644 --- a/packages/dashmate/src/constants.js +++ b/packages/dashmate/src/constants.js @@ -28,14 +28,19 @@ export const NODE_TYPE_MASTERNODE = 'masternode'; export const NODE_TYPE_FULLNODE = 'fullnode'; export const LLMQ_TYPE_TEST = 'llmq_test'; +export const LLMQ_TYPE_TEST_PLATFORM = 'llmq_test_platform'; export const QUORUM_TYPES = { LLMQ_TYPE_TEST: 100, + LLMQ_TYPE_TEST_PLATFORM: 106, }; export const MASTERNODE_COLLATERAL_AMOUNT = 1000; export const HPMN_COLLATERAL_AMOUNT = 4000; +// number of blocks to wait before core DKG exchange session +export const MIN_BLOCKS_BEFORE_DKG = 6; + export const PACKAGE_ROOT_DIR = path.join(url.fileURLToPath(import.meta.url), '../..'); export const TEMPLATES_DIR = path.join(PACKAGE_ROOT_DIR, 'templates'); diff --git a/packages/dashmate/src/core/CoreService.js b/packages/dashmate/src/core/CoreService.js index 73c2c243156..88bd883bd00 100644 --- a/packages/dashmate/src/core/CoreService.js +++ b/packages/dashmate/src/core/CoreService.js @@ -8,6 +8,7 @@ export default class CoreService { constructor(config, rpcClient, dockerContainer) { this.config = config; this.rpcClient = rpcClient; + rpcClient.setTimeout(240 * 1000); this.dockerContainer = dockerContainer; } diff --git a/packages/dashmate/src/core/activateCoreSpork.js b/packages/dashmate/src/core/activateCoreSpork.js index 4fd09d1b899..d8f684c3bf5 100644 --- a/packages/dashmate/src/core/activateCoreSpork.js +++ b/packages/dashmate/src/core/activateCoreSpork.js @@ -2,8 +2,9 @@ * @typedef activateCoreSpork * @param {RpcClient} rpcClient * @param {string} spork + * @param {number} height * @returns {Promise} */ -export default async function activateCoreSpork(rpcClient, spork) { - await rpcClient.sporkupdate(spork, 0); +export default async function activateCoreSpork(rpcClient, spork, height = 0) { + await rpcClient.sporkupdate(spork, height); } diff --git a/packages/dashmate/src/core/quorum/waitForDKGWindowPass.js b/packages/dashmate/src/core/quorum/waitForDKGWindowPass.js new file mode 100644 index 00000000000..21c4f2ccf25 --- /dev/null +++ b/packages/dashmate/src/core/quorum/waitForDKGWindowPass.js @@ -0,0 +1,40 @@ +import { MIN_BLOCKS_BEFORE_DKG } from '../../constants.js'; +import wait from '../../util/wait.js'; + +/** + * @param {RpcClient} rpcClient + * @return {Promise} + */ +export default async function waitForDKGWindowPass(rpcClient) { + let startBlockCount; + let startNextDkg; + + let isInDKG = true; + + do { + const [currentBlockCount, currentDkgInfo] = await Promise + .all([rpcClient.getBlockCount(), rpcClient.quorum('dkginfo')]); + + const { result: blockCount } = currentBlockCount; + const { result: dkgInfo } = currentDkgInfo; + + const { next_dkg: nextDkg } = dkgInfo; + + if (!startBlockCount) { + startBlockCount = blockCount; + } + + if (!startNextDkg) { + startNextDkg = nextDkg; + } + + isInDKG = nextDkg <= MIN_BLOCKS_BEFORE_DKG; + + if (isInDKG && blockCount > startBlockCount + startNextDkg + 1) { + throw new Error(`waitForDKGWindowPass deadline exceeded: dkg did not happen for ${startBlockCount + nextDkg + 1} ${startNextDkg + 1} blocks`); + } + + await wait(10000); + } + while (isInDKG); +} diff --git a/packages/dashmate/src/core/startCoreFactory.js b/packages/dashmate/src/core/startCoreFactory.js index 71fe923e48a..86401ee6dfd 100644 --- a/packages/dashmate/src/core/startCoreFactory.js +++ b/packages/dashmate/src/core/startCoreFactory.js @@ -75,8 +75,8 @@ export default function startCoreFactory( const rpcClient = createRpcClient( { port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }, ); diff --git a/packages/dashmate/src/core/waitForCoreStart.js b/packages/dashmate/src/core/waitForCoreStart.js index 8c04e8c0dd8..9edadbb6503 100644 --- a/packages/dashmate/src/core/waitForCoreStart.js +++ b/packages/dashmate/src/core/waitForCoreStart.js @@ -5,12 +5,13 @@ import wait from '../util/wait.js'; * * @typedef {waitForCoreStart} * @param {CoreService} coreService + * @param {number} [maxRetries=120] ~2 minutes + * @param {number} [delayMs=1000] * @return {Promise} */ -export default async function waitForCoreStart(coreService) { +export default async function waitForCoreStart(coreService, maxRetries = 120, delayMs = 1000) { let retries = 0; let isReady = false; - const maxRetries = 120; // ~2 minutes do { try { @@ -20,7 +21,7 @@ export default async function waitForCoreStart(coreService) { isReady = true; } catch (e) { // just wait 1 second before next try - await wait(1000); + await wait(delayMs); ++retries; } } while (!isReady && retries < maxRetries); diff --git a/packages/dashmate/src/core/waitForMasternodesSync.js b/packages/dashmate/src/core/waitForMasternodesSync.js index fdb686cd177..8f115410ea2 100644 --- a/packages/dashmate/src/core/waitForMasternodesSync.js +++ b/packages/dashmate/src/core/waitForMasternodesSync.js @@ -15,9 +15,17 @@ export default async function waitForMasternodesSync(rpcClient, progressCallback do { try { await rpcClient.mnsync('next'); + + ({ + result: { IsSynced: isSynced }, + } = await rpcClient.mnsync('status')); + + ({ + result: { verificationprogress: verificationProgress }, + } = await rpcClient.getBlockchainInfo()); } catch (e) { // Core RPC is not started yet - if (!e.message.includes('Dash JSON-RPC: Request Error: ') && e.code !== -28) { + if (!e.message.includes('Dash JSON-RPC: Request Error: ') && !e.message.includes('Timeout') && e.code !== -28) { throw e; } @@ -29,13 +37,6 @@ export default async function waitForMasternodesSync(rpcClient, progressCallback continue; } - ({ - result: { IsSynced: isSynced }, - } = await rpcClient.mnsync('status')); - ({ - result: { verificationprogress: verificationProgress }, - } = await rpcClient.getBlockchainInfo()); - if (!isSynced) { progressCallback(verificationProgress); diff --git a/packages/dashmate/src/core/wallet/registerMasternode.js b/packages/dashmate/src/core/wallet/registerMasternode.js index d5d2dba2759..285c65409bd 100644 --- a/packages/dashmate/src/core/wallet/registerMasternode.js +++ b/packages/dashmate/src/core/wallet/registerMasternode.js @@ -46,7 +46,7 @@ export default async function registerMasternode( if (hp) { const platformNodeId = config.get('platform.drive.tenderdash.node.id'); const platformP2PPort = config.get('platform.drive.tenderdash.p2p.port'); - const platformHttpPort = config.get('platform.dapi.envoy.http.port'); + const platformHttpPort = config.get('platform.gateway.listeners.dapiAndDrive.port'); proTxArgs.push(platformNodeId); proTxArgs.push(platformP2PPort.toString()); diff --git a/packages/dashmate/src/createDIContainer.js b/packages/dashmate/src/createDIContainer.js index 3c032e3a0e8..95b41e13920 100644 --- a/packages/dashmate/src/createDIContainer.js +++ b/packages/dashmate/src/createDIContainer.js @@ -109,6 +109,9 @@ import createIpAndPortsFormFactory from './listr/prompts/createIpAndPortsForm.js import registerMasternodeWithCoreWalletFactory from './listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js'; import registerMasternodeWithDMTFactory from './listr/tasks/setup/regular/registerMasternode/registerMasternodeWithDMT.js'; import writeConfigTemplatesFactory from './templates/writeConfigTemplatesFactory.js'; +import importCoreDataTaskFactory from './listr/tasks/setup/regular/importCoreDataTaskFactory.js'; +import verifySystemRequirementsTaskFactory + from './listr/tasks/setup/regular/verifySystemRequirementsTaskFactory.js'; /** * @param {Object} [options] @@ -298,6 +301,9 @@ export default async function createDIContainer(options = {}) { .singleton(), registerMasternodeWithDMT: asFunction(registerMasternodeWithDMTFactory) .singleton(), + importCoreDataTask: asFunction(importCoreDataTaskFactory).singleton(), + verifySystemRequirementsTask: asFunction(verifySystemRequirementsTaskFactory) + .singleton(), }); /** diff --git a/packages/dashmate/src/docker/DockerCompose.js b/packages/dashmate/src/docker/DockerCompose.js index 38353b98d33..bbdf19d28bb 100644 --- a/packages/dashmate/src/docker/DockerCompose.js +++ b/packages/dashmate/src/docker/DockerCompose.js @@ -414,15 +414,23 @@ export default class DockerCompose { * Down docker compose * * @param {Config} config + * @param {Object} [options] + * @param {Object} [options.removeVolumes=false] * @return {Promise} */ - async down(config) { + async down(config, options = {}) { await this.throwErrorIfNotInstalled(); + const commandOptions = ['--remove-orphans']; + + if (options.removeVolumes) { + commandOptions.push('-v'); + } + try { await dockerCompose.down({ ...this.#createOptions(config), - commandOptions: ['-v', '--remove-orphans'], + commandOptions, }); } catch (e) { throw new DockerComposeError(e); @@ -480,7 +488,15 @@ export default class DockerCompose { this.#isDockerSetupVerified = true; - const dockerComposeInstallLink = 'https://docs.docker.com/compose/install/'; + await this.throwErrorIfDockerIsNotInstalled(); + + await this.throwErrorIfDockerComposeIsNotInstalled(); + } + + /** + * @private + */ + async throwErrorIfDockerIsNotInstalled() { const dockerInstallLink = 'https://docs.docker.com/engine/install/'; const dockerPostInstallLinuxLink = 'https://docs.docker.com/engine/install/linux-postinstall/'; const dockerContextLink = 'https://docs.docker.com/engine/context/working-with-contexts/'; @@ -499,22 +515,55 @@ export default class DockerCompose { if (typeof dockerVersionInfo === 'string') { // Old versions - const version = semver.coerce(dockerVersionInfo); - if (semver.lt(version, DockerCompose.DOCKER_MIN_VERSION)) { + const parsedVersion = semver.coerce(dockerVersionInfo); + + if (parsedVersion === null) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Can't parse version from dockerVersionInfo: ${util.inspect(dockerVersionInfo)}`); + } + + return; + } + + if (semver.lt(parsedVersion, DockerCompose.DOCKER_MIN_VERSION)) { throw new Error(`Update Docker to version ${DockerCompose.DOCKER_MIN_VERSION} or higher. Please follow instructions ${dockerInstallLink}`); } } else { // Since 1.39 - if (typeof dockerVersionInfo.Components[0].Details.ApiVersion !== 'string') { - throw new Error(`docker version is not a string: ${util.inspect(dockerVersionInfo)}`); + if (typeof dockerVersionInfo?.Components[0]?.Details?.ApiVersion !== 'string') { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Docker API version must be a string: ${util.inspect(dockerVersionInfo)}`); + } + + return; + } + + const parsedVersion = semver.coerce(dockerVersionInfo.Components[0].Details.ApiVersion); + + if (parsedVersion === null) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Can't parse docker API version: ${util.inspect(dockerVersionInfo)}`); + } + + return; } - const version = semver.coerce(dockerVersionInfo.Components[0].Details.ApiVersion); const minVersion = '1.25.0'; - if (semver.lt(version, minVersion)) { + + if (semver.lt(parsedVersion, minVersion)) { throw new Error(`Update Docker Engine to version ${minVersion} or higher. Please follow instructions ${dockerInstallLink}`); } } + } + + /** + * @private + */ + async throwErrorIfDockerComposeIsNotInstalled() { + const dockerComposeInstallLink = 'https://docs.docker.com/compose/install/'; // Check docker compose let version; @@ -525,10 +574,26 @@ export default class DockerCompose { } if (typeof version !== 'string') { - throw new Error(`docker compose version is not a string: ${util.inspect(version)}`); + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`docker compose version is not a string: ${util.inspect(version)}`); + } + + return; + } + + const parsedVersion = semver.coerce(version); + + if (parsedVersion === null) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Can't parse docker compose version: ${util.inspect(version)}`); + } + + return; } - if (semver.lt(semver.coerce(version), DockerCompose.DOCKER_COMPOSE_MIN_VERSION)) { + if (semver.lt(parsedVersion, DockerCompose.DOCKER_COMPOSE_MIN_VERSION)) { throw new Error(`Update Docker Compose to version ${DockerCompose.DOCKER_COMPOSE_MIN_VERSION} or higher. Please follow instructions ${dockerComposeInstallLink}`); } } diff --git a/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js b/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js index a594315ef14..c403c2bef39 100644 --- a/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js +++ b/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js @@ -26,8 +26,8 @@ export default function scheduleRenewZeroSslCertificateFactory( */ async function scheduleRenewZeroSslCertificate(config) { const certificate = await getCertificate( - config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.apiKey', false), - config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.id', false), + config.get('platform.gateway.ssl.providerConfigs.zerossl.apiKey', false), + config.get('platform.gateway.ssl.providerConfigs.zerossl.id', false), ); if (!certificate) { @@ -55,14 +55,18 @@ export default function scheduleRenewZeroSslCertificateFactory( await tasks.run({ expirationDays: Certificate.EXPIRATION_LIMIT_DAYS, + noRetry: true, }); // Write config files configFileRepository.write(configFile); writeConfigTemplates(config); - // Restart Envoy to catch up new SSL certificates - await dockerCompose.execCommand(config, 'dapi_envoy', 'kill -SIGHUP 1'); + // TODO: We can use https://www.envoyproxy.io/docs/envoy/v1.30.1/start/quick-start/configuration-dynamic-filesystem.html#start-quick-start-dynamic-fs-dynamic-lds + // to dynamically update envoy configuration without restarting it + + // Restart Gateway to catch up new SSL certificates + await dockerCompose.execCommand(config, 'gateway', 'kill -SIGHUP 1'); return job.stop(); }, async () => { diff --git a/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js b/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js index 1a2495b8f36..ac93be1a621 100644 --- a/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js +++ b/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js @@ -107,7 +107,7 @@ export default function createIpAndPortsFormFactory(defaultConfigs) { if (initialPlatformHTTPPort === null || initialPlatformHTTPPort === undefined || network === PRESET_MAINNET) { - initialPlatformHTTPPort = defaultConfigs.get(network).get('platform.dapi.envoy.http.port').toString(); + initialPlatformHTTPPort = defaultConfigs.get(network).get('platform.gateway.listeners.dapiAndDrive.port').toString(); } fields.push({ diff --git a/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js b/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js index 024bfd2c375..50fa9209c32 100644 --- a/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js +++ b/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js @@ -8,8 +8,11 @@ import generateTenderdashNodeKey from '../../tenderdash/generateTenderdashNodeKe */ export default function createPlatformNodeKeyInput(options = {}) { let { initial } = options; + let additionalMessage = ''; if (initial === null || initial === undefined) { initial = generateTenderdashNodeKey(); + additionalMessage = ' You can provide a key, or a new key will be\n automatically generated' + + ' for you.'; } return { @@ -19,8 +22,7 @@ export default function createPlatformNodeKeyInput(options = {}) { This key is used to uniquely identify your Dash Platform node. The node key is derived from a standard Ed25519 cryptographic key pair, presented in a cached - format specific to Tenderdash. You can provide a key, or a new key will be - automatically generated for you.\n`, + format specific to Tenderdash.${additionalMessage}\n`, message: 'Enter Ed25519 node key', hint: 'Base64 encoded', initial, diff --git a/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js b/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js index 371097e0612..7953d4bcd1a 100644 --- a/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js @@ -1,14 +1,14 @@ +import DAPIClient from '@dashevo/dapi-client'; +import bs58 from 'bs58'; import { Listr } from 'listr2'; +import WithdrawalsContract from '@dashevo/withdrawals-contract/lib/systemIds.js'; import wait from '../../../util/wait.js'; /** * - * @param {createTenderdashRpcClient} createTenderdashRpcClient * @return {waitForNodeToBeReadyTask} */ -export default function waitForNodeToBeReadyTaskFactory( - createTenderdashRpcClient, -) { +export default function waitForNodeToBeReadyTaskFactory() { /** * @typedef waitForNodeToBeReadyTask * @param {Config} config @@ -19,18 +19,32 @@ export default function waitForNodeToBeReadyTaskFactory( { title: `Wait for node ${config.getName()} to be ready`, task: async () => { - const host = config.get('platform.drive.tenderdash.rpc.host'); - const port = config.get('platform.drive.tenderdash.rpc.port'); + let host = config.get('platform.gateway.listeners.dapiAndDrive.host'); + const port = config.get('platform.gateway.listeners.dapiAndDrive.port'); - const tenderdashRpcClient = createTenderdashRpcClient({ host, port }); + if (host === '0.0.0.0') { + host = '127.0.0.1'; + } + + const dapiClient = new DAPIClient({ + dapiAddresses: [`${host}:${port}:no-ssl`], + loggerOptions: { + level: 'silent', + }, + }); + + const withdrawalsContractId = bs58.decode(WithdrawalsContract.contractId); let success = false; do { - const response = await tenderdashRpcClient.request('status', {}).catch(() => {}); + const response = await dapiClient.platform.getDataContract(withdrawalsContractId, { + retries: 0, + prove: false, + }) + .catch(() => { + }); - if (response) { - success = !response.result.sync_info.catching_up; - } + success = Boolean(response); if (!success) { await wait(500); diff --git a/packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js index e666de51980..ce61a825f2f 100644 --- a/packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js @@ -115,8 +115,8 @@ export default function reindexNodeTaskFactory( // Wait until Core is started const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); @@ -128,7 +128,7 @@ export default function reindexNodeTaskFactory( ctx.coreService = new CoreService(config, rpcClient, container); - await waitForCoreStart(ctx.coreService); + await waitForCoreStart(ctx.coreService, 300, 2000); // When Core is started remove reindex=1 from dashd.conf // rendering service templates without additional variables @@ -146,7 +146,7 @@ export default function reindexNodeTaskFactory( await waitForCoreSync(ctx.coreService, (verificationProgress) => { const { percent, blocks, headers } = verificationProgress; - observer.next(`${(percent * 100).toFixed(4)}%, ${blocks} / ${headers}`); + observer.next(`${(percent * 100).toFixed(1)}%, ${blocks} / ${headers}`); }); await new Promise((res) => { setTimeout(res, 2000); }); diff --git a/packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js index 315c8e9073c..374c7f37043 100644 --- a/packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js @@ -52,57 +52,75 @@ export default function resetNodeTaskFactory( { title: 'Remove all services and associated data', enabled: (ctx) => !ctx.isPlatformOnlyReset, - task: async () => dockerCompose.down(config), + task: async (ctx, task) => { + if (ctx.keepData) { + // eslint-disable-next-line no-param-reassign + task.title = 'Remove all services and keep associated data'; + } + + const options = { + removeVolumes: !ctx.keepData, + }; + + return dockerCompose.down(config, options); + }, }, { title: 'Remove platform services and associated data', enabled: (ctx) => ctx.isPlatformOnlyReset, - task: async () => { + task: async (ctx, task) => { + if (ctx.keepData) { + // eslint-disable-next-line no-param-reassign + task.title = 'Remove platform services and keep associated data'; + } + await dockerCompose.rm(config, { profiles: ['platform'] }); // Remove volumes - const { COMPOSE_PROJECT_NAME: composeProjectName } = generateEnvs(config); + if (!ctx.keepData) { + const { COMPOSE_PROJECT_NAME: composeProjectName } = generateEnvs(config); - const projectVolumeNames = await dockerCompose.getVolumeNames( - config, - { profiles: ['platform'] }, - ); + const projectVolumeNames = await dockerCompose.getVolumeNames( + config, + { profiles: ['platform'] }, + ); - await Promise.all( - projectVolumeNames - .map((volumeName) => `${composeProjectName}_${volumeName}`) - .map(async (volumeName) => { - const volume = await docker.getVolume(volumeName); + await Promise.all( + projectVolumeNames + .map((volumeName) => `${composeProjectName}_${volumeName}`) + .map(async (volumeName) => { + const volume = await docker.getVolume(volumeName); - let isRetry; - do { - isRetry = false; + let isRetry; + do { + isRetry = false; - try { - await volume.remove({ force: true }); - } catch (e) { - // volume is in use - if (e.statusCode === 409) { - await wait(1000); + try { + await volume.remove({ force: true }); + } catch (e) { + // volume is in use + if (e.statusCode === 409) { + await wait(1000); - // Remove containers - await dockerCompose.rm(config, { profiles: ['platform'] }); + // Remove containers + await dockerCompose.rm(config, { profiles: ['platform'] }); - isRetry = true; + isRetry = true; - continue; - } + continue; + } - // volume does not exist - if (e.statusCode === 404) { - break; - } + // volume does not exist + if (e.statusCode === 404) { + break; + } - throw e; - } - } while (isRetry); - }), - ); + throw e; + } + } while (isRetry); + }), + ); + } }, }, { diff --git a/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js index 93966875254..d059e9c8606 100644 --- a/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js @@ -134,6 +134,7 @@ export default function configureCoreTaskFactory( const walletPassphrase = ''; const avoidReuse = false; const loadOnStartup = true; + const descriptors = false; await ctx.coreService.getRpcClient().createWallet( 'main', @@ -141,6 +142,7 @@ export default function configureCoreTaskFactory( createBlankWallet, walletPassphrase, avoidReuse, + descriptors, loadOnStartup, ); }, @@ -345,18 +347,6 @@ export default function configureCoreTaskFactory( title: 'Wait for quorums to be enabled', task: () => enableCoreQuorumsTask(), }, - { - title: 'Setting initial core chain locked height', - task: async (_, task) => { - const rpcClient = ctx.seedCoreService.getRpcClient(); - const { result: initialCoreChainLockedHeight } = await rpcClient.getBlockCount(); - - ctx.initialCoreChainLockedHeight = initialCoreChainLockedHeight; - - // eslint-disable-next-line no-param-reassign - task.output = `Initial chain locked core height is set to: ${ctx.initialCoreChainLockedHeight}`; - }, - }, { title: 'Activating V20 fork', task: () => new Observable(async (observer) => { @@ -398,6 +388,74 @@ export default function configureCoreTaskFactory( return this; }), }, + { + title: 'Wait for nodes to have the same height', + task: () => waitForNodesToHaveTheSameHeight( + ctx.rpcClients, + WAIT_FOR_NODES_TIMEOUT, + ), + }, + { + title: 'Enable EHF spork', + task: async () => new Observable(async (observer) => { + const seedRpcClient = ctx.seedCoreService.getRpcClient(); + const { + result: initialCoreChainLockedHeight, + } = await seedRpcClient.getBlockCount(); + + await activateCoreSpork( + seedRpcClient, + 'SPORK_24_TEST_EHF', + initialCoreChainLockedHeight, + ); + + let isEhfActivated = false; + let blockchainInfo; + + let blocksGenerated = 0; + + const blocksToGenerateInOneStep = 48; + + do { + ({ + result: blockchainInfo, + } = await ctx.seedCoreService.getRpcClient().getBlockchainInfo()); + + isEhfActivated = blockchainInfo.softforks && blockchainInfo.softforks.mn_rr + && blockchainInfo.softforks.mn_rr.active; + if (isEhfActivated) { + break; + } + + await ctx.bumpMockTime(blocksToGenerateInOneStep); + + await generateBlocks( + ctx.seedCoreService, + blocksToGenerateInOneStep, + NETWORK_LOCAL, + // eslint-disable-next-line no-loop-func + (blocks) => { + blocksGenerated += blocks; + + observer.next(`${blocksGenerated} blocks generated`); + }, + ); + } while (!isEhfActivated); + + observer.next(`EHF has been activated at height ${blockchainInfo.softforks.mn_rr.height}`); + + observer.complete(); + + return this; + }), + }, + { + title: 'Wait for nodes to have the same height', + task: () => waitForNodesToHaveTheSameHeight( + ctx.rpcClients, + WAIT_FOR_NODES_TIMEOUT, + ), + }, { title: 'Stopping nodes', task: async () => (Promise.all( diff --git a/packages/dashmate/src/listr/tasks/setup/local/configureTenderdashTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/local/configureTenderdashTaskFactory.js index af533570888..c3984d32c5a 100644 --- a/packages/dashmate/src/listr/tasks/setup/local/configureTenderdashTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/local/configureTenderdashTaskFactory.js @@ -12,7 +12,7 @@ export default function configureTenderdashTaskFactory() { function configureTenderdashTask(configGroup) { return new Listr([ { - task: async (ctx) => { + task: async () => { const platformConfigs = configGroup.filter((config) => config.get('platform.enable')); const subTasks = []; @@ -23,15 +23,8 @@ export default function configureTenderdashTaskFactory() { const randomChainIdPart = Math.floor(Math.random() * 60) + 1; const chainId = `dashmate_local_${randomChainIdPart}`; - const genesisTime = new Date().toISOString(); - platformConfigs.forEach((config, index) => { - config.set('platform.drive.tenderdash.genesis.genesis_time', genesisTime); config.set('platform.drive.tenderdash.genesis.chain_id', chainId); - config.set( - 'platform.drive.tenderdash.genesis.initial_core_chain_locked_height', - ctx.initialCoreChainLockedHeight, - ); const p2pPeers = platformConfigs .filter((_, i) => i !== index) @@ -50,7 +43,7 @@ export default function configureTenderdashTaskFactory() { config.set( 'platform.drive.tenderdash.genesis.validator_quorum_type', - config.get('platform.drive.abci.validatorSet.llmqType'), + config.get('platform.drive.abci.validatorSet.quorum.llmqType'), ); }); }, diff --git a/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js index 78d7c11788d..49fbbd47379 100644 --- a/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js @@ -1,15 +1,11 @@ import { Listr } from 'listr2'; -import lodash from 'lodash'; -import { LLMQ_TYPE_TEST, NETWORK_LOCAL } from '../../../../constants.js'; +import { LLMQ_TYPE_TEST_PLATFORM, NETWORK_LOCAL } from '../../../../constants.js'; import waitForNodesToHaveTheSameHeight from '../../../../core/waitForNodesToHaveTheSameHeight.js'; import waitForQuorumPhase from '../../../../core/quorum/waitForQuorumPhase.js'; import waitForQuorumConnections from '../../../../core/quorum/waitForQuorumConnections.js'; import waitForQuorumCommitments from '../../../../core/quorum/waitForQuorumCommitements.js'; import wait from '../../../../util/wait.js'; import waitForMasternodeProbes from '../../../../core/quorum/waitForMasternodeProbes.js'; - -const { isEqual } = lodash; - /** * @param {generateBlocks} generateBlocks * @return {enableCoreQuorumsTask} @@ -245,8 +241,9 @@ export default function enableCoreQuorumsTaskFactory(generateBlocks) { ); let { result: newQuorumList } = await ctx.seedRpcClient.quorum('list'); + let testPlatformQuorumEnabled = !!newQuorumList[LLMQ_TYPE_TEST_PLATFORM][0]; - while (isEqual(ctx.initialQuorumList, newQuorumList)) { + while (!testPlatformQuorumEnabled) { await wait(300); await ctx.bumpMockTime(); @@ -263,14 +260,15 @@ export default function enableCoreQuorumsTaskFactory(generateBlocks) { ); ({ result: newQuorumList } = await ctx.seedRpcClient.quorum('list')); + testPlatformQuorumEnabled = !!newQuorumList[LLMQ_TYPE_TEST_PLATFORM][0]; } const { result: quorumList } = await ctx.seedRpcClient.quorum('list', 1); // eslint-disable-next-line prefer-destructuring - ctx.quorumHash = quorumList[LLMQ_TYPE_TEST][0]; + ctx.quorumHash = quorumList[LLMQ_TYPE_TEST_PLATFORM][0]; - const llmqType = ctx.masternodeCoreServices[0].getConfig().get('platform.drive.abci.validatorSet.llmqType'); + const llmqType = ctx.masternodeCoreServices[0].getConfig().get('platform.drive.abci.validatorSet.quorum.llmqType'); const { result: quorumInfo } = await ctx.seedRpcClient.quorum('info', llmqType, ctx.quorumHash); diff --git a/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js index bdcbc554d8b..deeb3afa263 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js @@ -33,7 +33,7 @@ export default function configureNodeTaskFactory(createIpAndPortsForm) { task.title = `Configure ${ctx.nodeType}`; // Masternode Operator key - if (ctx.nodeType === NODE_TYPE_MASTERNODE) { + if (ctx.nodeType === NODE_TYPE_MASTERNODE && !ctx.config.get('core.masternode.operator.privateKey')) { const masternodeOperatorPrivateKey = await task.prompt({ type: 'input', header: ` Please enter your Masternode Operator BLS Private key. @@ -71,12 +71,23 @@ export default function configureNodeTaskFactory(createIpAndPortsForm) { let form; if (ctx.initialIpForm) { + // Using for testing form = ctx.initialIpForm; } else { + let initialIp = ctx.nodeType === NODE_TYPE_MASTERNODE ? '' : undefined; + if (ctx.importedExternalIp) { + initialIp = ctx.importedExternalIp; + } + + let initialCoreP2PPort = showEmptyPort ? '' : undefined; + if (ctx.importedP2pPort) { + initialCoreP2PPort = ctx.importedP2pPort; + } + form = await task.prompt(await createIpAndPortsForm(ctx.preset, { isHPMN: ctx.isHP, - initialIp: ctx.nodeType === NODE_TYPE_MASTERNODE ? '' : undefined, - initialCoreP2PPort: showEmptyPort ? '' : undefined, + initialIp, + initialCoreP2PPort, initialPlatformHTTPPort: showEmptyPort ? '' : undefined, initialPlatformP2PPort: showEmptyPort ? '' : undefined, })); @@ -86,7 +97,7 @@ export default function configureNodeTaskFactory(createIpAndPortsForm) { ctx.config.set('core.p2p.port', form.coreP2PPort); if (ctx.isHP) { - ctx.config.set('platform.dapi.envoy.http.port', form.platformHTTPPort); + ctx.config.set('platform.gateway.listeners.dapiAndDrive.port', form.platformHTTPPort); ctx.config.set('platform.drive.tenderdash.p2p.port', form.platformP2PPort); } } diff --git a/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js index f489be8de39..62c9f154d0d 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js @@ -91,7 +91,7 @@ export default function configureSSLCertificateTaskFactory( }, }); - ctx.config.set('platform.dapi.envoy.ssl.providerConfigs.zerossl.apiKey', apiKey); + ctx.config.set('platform.gateway.ssl.providerConfigs.zerossl.apiKey', apiKey); return obtainZeroSSLCertificateTask(ctx.config); }, @@ -141,7 +141,7 @@ export default function configureSSLCertificateTaskFactory( }); } - ctx.config.set('platform.dapi.envoy.ssl.provider', ctx.certificateProvider); + ctx.config.set('platform.gateway.ssl.provider', ctx.certificateProvider); // eslint-disable-next-line no-param-reassign task.output = ctx.certificateProvider; diff --git a/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js b/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js index de7f2be9631..d9cb36a9cbc 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js @@ -23,7 +23,7 @@ export default async function getConfigurationOutputFromContext(ctx) { if (ctx.isHP) { output += `\n\nPlatform P2P port: ${ctx.config.get('platform.drive.tenderdash.p2p.port')} - Platform HTTP port: ${ctx.config.get('platform.dapi.envoy.http.port')}`; + Platform HTTP port: ${ctx.config.get('platform.gateway.listeners.dapiAndDrive.port')}`; } return output; diff --git a/packages/dashmate/src/listr/tasks/setup/regular/importCoreDataTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/importCoreDataTaskFactory.js new file mode 100644 index 00000000000..be338af6633 --- /dev/null +++ b/packages/dashmate/src/listr/tasks/setup/regular/importCoreDataTaskFactory.js @@ -0,0 +1,237 @@ +import { Listr } from 'listr2'; +import fs from 'fs'; +import path from 'path'; +import chalk from 'chalk'; +import { + NETWORK_TESTNET, +} from '../../../../constants.js'; + +/** + * @param {Config} config + * @return {validateCoreDataDirectoryPath} + */ +function validateCoreDataDirectoryPathFactory(config) { + /** + * @typedef {function} validateCoreDataDirectoryPath + * @param {string} value + * @return {string|boolean} + */ + function validateCoreDataDirectoryPath(value) { + if (value.length === 0) { + return 'should not be empty'; + } + + // Path must be absolute + if (!path.isAbsolute(value)) { + return 'path must be absolute'; + } + + // Should contain data and dashd.conf + const configFilePath = path.join(value, 'dash.conf'); + + let dataDirName = 'blocks'; + if (config.get('network') === NETWORK_TESTNET) { + dataDirName = 'testnet3'; + } + + try { + fs.accessSync(configFilePath, fs.constants.R_OK); + fs.accessSync(path.join(value, dataDirName), fs.constants.R_OK); + } catch (e) { + return 'directory must be readable and contain blockchain data with dash.conf'; + } + + const configFileContent = fs.readFileSync(configFilePath, 'utf8'); + + // Config file should contain testnet=1 in case of testnet + // and shouldn't contain testnet=1, regtest=1 or devnet= in case of mainnet + if (config.get('network') === NETWORK_TESTNET) { + if (!configFileContent.includes('testnet=1')) { + return 'dash.conf should be configured for testnet'; + } + } else if (configFileContent.includes('testnet=1') + || configFileContent.includes('regtest=1') + || configFileContent.includes('devnet=')) { + return 'dash.conf should be configured for mainnet'; + } + + return true; + } + + return validateCoreDataDirectoryPath; +} + +/** + * + * @param {Docker} docker + * @param {dockerPull} dockerPull + * @param {generateEnvs} generateEnvs + * @return {importCoreDataTask} + */ +export default function importCoreDataTaskFactory( + docker, + dockerPull, + generateEnvs, +) { + /** + * @typedef {function} importCoreDataTask + * @returns {Listr} + */ + async function importCoreDataTask() { + return new Listr([ + { + title: 'Import existing Core data', + task: async (ctx, task) => { + const doImport = await task.prompt({ + type: 'toggle', + header: ` If you already run a masternode on this server, you can + import your existing Dash Core data instead of syncing a new dashmate node from scratch. + Your current user account must have read access to this directory.\n`, + message: 'Import existing data?', + enabled: 'Yes', + disabled: 'No', + initial: true, + }); + + if (!doImport) { + task.skip(); + return; + } + + // Masternode Operator key + const coreDataPath = await task.prompt({ + type: 'input', + header: ` Please enter path to your existing Dash Core data directory. + + - Your current user must have read access to this directory. + - The data directory usually ends with .dashcore and contains dash.conf and the data files to import + - If dash.conf is stored separately, you should copy or link to this file in the data directory\n`, + message: 'Core data directory path', + validate: validateCoreDataDirectoryPathFactory(ctx.config), + }); + + // Read configuration from dashd.conf + const configPath = path.join(coreDataPath, 'dash.conf'); + const configFileContent = fs.readFileSync(configPath, 'utf8'); + + // Config file should contain masternodeblsprivkey in case of masternode + if (ctx.config.get('core.masternode.enable')) { + const masternodeOperatorPrivateKey = configFileContent.match(/^masternodeblsprivkey=([^ \n]+)/m)?.[1]; + + if (masternodeOperatorPrivateKey) { + ctx.config.set('core.masternode.operator.privateKey', masternodeOperatorPrivateKey); + // txindex is enabled by default for masternodes + ctx.isReindexRequired = false; + } else { + // We need to reindex Core if there weren't all required indexed enabled before + ctx.isReindexRequired = !configFileContent.match(/^txindex=1/); + } + } + + const host = configFileContent.match(/^bind=([^ \n]+)/m)?.[1]; + + if (host) { + ctx.config.set('core.p2p.host', host); + } + + // Store values to fill in the configure node form + + // eslint-disable-next-line prefer-destructuring + ctx.importedP2pPort = configFileContent.match(/^port=([^ \n]+)/m)?.[1]; + + // eslint-disable-next-line prefer-destructuring + ctx.importedExternalIp = configFileContent.match(/^externalip=([^ \n]+)/m)?.[1]; + + // Copy data directory to docker a volume + + // Create a volume + const { COMPOSE_PROJECT_NAME: composeProjectName } = generateEnvs(ctx.config); + + const volumeName = `${composeProjectName}_core_data`; + + // Check if volume already exists + const volumes = await docker.listVolumes(); + const exists = volumes.Volumes.some((volume) => volume.Name === volumeName); + + if (exists) { + throw new Error(`Volume ${volumeName} already exists. Please remove it first.`); + } + + await docker.createVolume(volumeName); + + // Pull image + await dockerPull('alpine'); + + const commands = [ + `mkdir /${volumeName}/.dashcore/`, + 'cd /source', + `cp -avL * /${volumeName}/.dashcore/`, + `chown -R 1000:1000 /${volumeName}/`, + `rm /${volumeName}/.dashcore/dash.conf`, + ]; + + // Copy data and set user dash + const [result] = await docker.run( + 'alpine', + [ + '/bin/sh', + '-c', + commands.join(' && '), + ], + task.stdout(), + { + HostConfig: { + AutoRemove: true, + Binds: [ + `${coreDataPath}:/source:ro`, + ], + Mounts: [ + { + Type: 'volume', + Source: volumeName, + Target: `/${volumeName}`, + }, + ], + }, + }, + ); + + if (result.StatusCode !== 0) { + throw new Error('Cannot copy data dir to volume'); + } + + let header; + if (ctx.isReindexRequired) { + header = chalk` {bold You existing Core node doesn't have indexes required to run ${ctx.nodeTypeName}. + Reindex of the Core data will be needed after you finish the node setup.} + + Please stop your existing Dash Core node before reindexing. + Also, disable any automatic startup services (e.g., cron, systemd) for the existing Dash Core installation.\n`; + } else { + header = ` Please stop your existing Dash Core node before starting the new dashmate-based + node ("dashmate start"). Also, disable any automatic startup services (e.g., cron, systemd) for the existing Dash Core installation.\n`; + } + + await task.prompt({ + type: 'confirm', + header, + message: 'Press any key to continue...', + default: ' ', + separator: () => '', + format: () => '', + initial: true, + isTrue: () => true, + }); + + // eslint-disable-next-line no-param-reassign + task.output = `${coreDataPath} imported`; + }, + options: { + persistentOutput: true, + }, + }, + ]); + } + + return importCoreDataTask; +} diff --git a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js index 8688af05bd7..1b001be6114 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js @@ -218,42 +218,20 @@ export default function registerMasternodeWithCoreWalletFactory(createIpAndPorts const platformHTTPPort = state.ipAndPorts.platformHTTPPort || defaultConfigs.get(ctx.preset) - .get('platform.dapi.envoy.http.port'); + .get('platform.gateway.listeners.dapiAndDrive.port'); let command; if (ctx.isHP) { - command = `dash-cli protx register_evo \\ - ${state.collateral.txId} \\ - ${state.collateral.outputIndex} \\ - ${state.ipAndPorts.ip}:${state.ipAndPorts.coreP2PPort} \\ - ${state.keys.ownerAddress} \\ - ${operatorPublicKeyHex} \\ - ${state.keys.votingAddress} \\ - ${state.operator.rewardShare} \\ - ${state.keys.payoutAddress} \\ - ${deriveTenderdashNodeId(state.platformNodeKey)} \\ - ${platformP2PPort} \\ - ${platformHTTPPort}`; + command = `protx register_evo ${state.collateral.txId} ${state.collateral.outputIndex} ${state.ipAndPorts.ip}:${state.ipAndPorts.coreP2PPort} ${state.keys.ownerAddress} ${operatorPublicKeyHex} ${state.keys.votingAddress} ${state.operator.rewardShare} ${state.keys.payoutAddress} ${deriveTenderdashNodeId(state.platformNodeKey)} ${platformP2PPort} ${platformHTTPPort}`; } else { - command = `dash-cli protx register \\ - ${state.collateral.txId} \\ - ${state.collateral.outputIndex} \\ - ${state.ipAndPorts.ip}:${state.ipAndPorts.coreP2PPort} \\ - ${state.keys.ownerAddress} \\ - ${operatorPublicKeyHex} \\ - ${state.keys.votingAddress} \\ - ${state.operator.rewardShare} \\ - ${state.keys.payoutAddress}`; + command = `protx register ${state.collateral.txId} ${state.collateral.outputIndex} ${state.ipAndPorts.ip}:${state.ipAndPorts.coreP2PPort} ${state.keys.ownerAddress} ${operatorPublicKeyHex} ${state.keys.votingAddress} ${state.operator.rewardShare} ${state.keys.payoutAddress}`; } // Wrap the command to fit the terminal width (listr uses new lines to wrap the text) if (!ctx.isVerbose) { - command = command.replace(/\\/g, ''); command = wrapAnsi(command, process.stdout.columns - 3, { - hard: true, trim: false, }); - command = command.replace(/\n/g, '\\\n'); } // TODO: We need to give more info on how to run this command diff --git a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js index b65c2c84bfb..ce358f56fd4 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js @@ -73,7 +73,7 @@ export default function registerMasternodeGuideTaskFactory( ctx.config.set('platform.drive.tenderdash.node.id', deriveTenderdashNodeId(state.platformNodeKey)); ctx.config.set('platform.drive.tenderdash.node.key', state.platformNodeKey); - ctx.config.set('platform.dapi.envoy.http.port', state.ipAndPorts.platformHTTPPort); + ctx.config.set('platform.gateway.listeners.dapiAndDrive.port', state.ipAndPorts.platformHTTPPort); ctx.config.set('platform.drive.tenderdash.p2p.port', state.ipAndPorts.platformP2PPort); } diff --git a/packages/dashmate/src/listr/tasks/setup/regular/verifySystemRequirementsTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/verifySystemRequirementsTaskFactory.js new file mode 100644 index 00000000000..e110540c4d7 --- /dev/null +++ b/packages/dashmate/src/listr/tasks/setup/regular/verifySystemRequirementsTaskFactory.js @@ -0,0 +1,198 @@ +import chalk from 'chalk'; +import { Listr } from 'listr2'; +import os from 'os'; +import * as diskusage from 'diskusage'; +import si from 'systeminformation'; + +/** + * + * @param {Docker} docker + * @param {DockerCompose} dockerCompose + * @return {verifySystemRequirementsTask} + */ +export default function verifySystemRequirementsTaskFactory(docker, dockerCompose) { + /** + * @typedef {function} verifySystemRequirementsTask + * @returns {Listr} + */ + async function verifySystemRequirementsTask() { + return new Listr([ + { + title: 'System requirements', + task: async (ctx, task) => { + await dockerCompose.throwErrorIfNotInstalled(); + + const MINIMUM_CPU_CORES = ctx.isHP ? 4 : 2; + const MINIMUM_CPU_FREQUENCY = 2.4; // GHz + const MINIMUM_RAM = ctx.isHP ? 8 : 4; // GB + const MINIMUM_DISK_SPACE = ctx.isHP ? 200 : 100; // GB + + const warnings = []; + + // Get system info + let systemInfo; + try { + systemInfo = await docker.info(); + } catch (e) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Can't get docker info: ${e}`); + } + } + + if (systemInfo) { + if (Number.isInteger(systemInfo.NCPU)) { + // Check CPU cores + const cpuCores = systemInfo.NCPU; + + if (cpuCores < MINIMUM_CPU_CORES) { + warnings.push(`${cpuCores} CPU cores detected. At least ${MINIMUM_CPU_CORES} are required`); + } + } else { + // eslint-disable-next-line no-console + console.warn('Can\'t get NCPU from docker info'); + } + + // Check RAM + if (Number.isInteger(systemInfo.MemTotal)) { + const memoryGb = systemInfo.MemTotal / (1024 ** 3); // Convert to GB + + if (memoryGb < MINIMUM_RAM) { + warnings.push(`${memoryGb.toFixed(2)}GB RAM detected. At least ${MINIMUM_RAM}GB is required`); + } + } else { + // eslint-disable-next-line no-console + console.warn('Can\'t get MemTotal from docker info'); + } + } + + // Check CPU frequency + let hostCpu; + try { + hostCpu = await si.cpu(); + } catch { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn('Can\'t get CPU info'); + } + } + + if (hostCpu) { + if (hostCpu.speed === 0) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn('Can\'t get CPU frequency'); + } + } else if (hostCpu.speed < MINIMUM_CPU_FREQUENCY) { + warnings.push(`${hostCpu.speed.toFixed(1)}GHz CPU frequency detected. At least ${MINIMUM_CPU_FREQUENCY}GHz is required`); + } + } + + // Check swap information + let swap; + try { + swap = await si.mem(); + } catch (e) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Can't get swap info: ${e}`); + } + } + + if (swap) { + const swapTotalGb = (swap.swaptotal / (1024 ** 3)); // Convert bytes to GB + + if (swapTotalGb < 2) { + warnings.push(`Swap space is ${swapTotalGb.toFixed(2)}GB. 2GB is recommended`); + } + } + + // Get disk usage info + let diskInfo; + + if (systemInfo) { + try { + diskInfo = await diskusage.check(systemInfo.DockerRootDir); + } catch (e) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Can't get disk usage for '${systemInfo.DockerRootDir}': ${e}`); + } + } + } + + if (!diskInfo) { + try { + diskInfo = await diskusage.check(os.platform() === 'win32' ? 'c:' : '/'); + } catch (e) { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.warn(`Can't get disk usage for root directory: ${e}`); + } + } + } + + if (diskInfo) { + const availableDiskSpace = diskInfo.available / (1024 ** 3); // Convert to GB + + if (availableDiskSpace < MINIMUM_DISK_SPACE) { + warnings.push(`${availableDiskSpace.toFixed(2)}GB available disk space detected. At least ${MINIMUM_DISK_SPACE}GB is required`); + } + } + + let message = ''; + if (ctx.isHP) { + message = `Dash Platform requires more resources than the current system provides. + Evonode rewards are paid based on block production, and resource-limited + nodes may not be able to produce blocks quickly enough to receive reward + payments. Upgrading system resources is recommended before proceeding. + + {bold This node may not receive Dash Platform reward payments due to its resource limitations.}`; + } else { + message = `Limited system resources may impact the performance of the node. + The node might not provide required services to the network in time and will get PoSe banned. + PoSe banned node aren't receiving masternode rewards. + Upgrading system resources is recommended before proceeding.`; + } + + if (warnings.length > 0) { + const warningsText = warnings.map((warning) => ` - ${warning}`).join('\n'); + + const header = chalk` Minimum requirements have not been met: + +{red ${warningsText}} + + ${message}\n`; + + // This option is used for tests + if (ctx.acceptUnmetSystemRequirements) { + // eslint-disable-next-line no-console + console.warn(header); + } else { + const proceed = await task.prompt({ + type: 'toggle', + header, + message: ' Are you sure you want to proceed?', + enabled: 'Yes', + disabled: 'No', + initial: false, + }); + + if (!proceed) { + throw new Error('System requirements have not been met'); + } else { + // eslint-disable-next-line no-param-reassign + task.output = chalk`{yellow System requirements have not been met.}`; + } + } + } + }, + options: { + persistentOutput: true, + }, + }, + ]); + } + + return verifySystemRequirementsTask; +} diff --git a/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js index 0c0efc53e6a..5338eb4178a 100644 --- a/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js @@ -14,6 +14,7 @@ import generateRandomString from '../../../util/generateRandomString.js'; * @param {resolveDockerHostIp} resolveDockerHostIp * @param {generateHDPrivateKeys} generateHDPrivateKeys * @param {HomeDir} homeDir + * @param {DockerCompose} dockerCompose */ export default function setupLocalPresetTaskFactory( configFile, @@ -23,6 +24,7 @@ export default function setupLocalPresetTaskFactory( resolveDockerHostIp, generateHDPrivateKeys, homeDir, + dockerCompose, ) { /** * @typedef {setupLocalPresetTask} @@ -30,6 +32,10 @@ export default function setupLocalPresetTaskFactory( */ function setupLocalPresetTask() { return new Listr([ + { + title: 'System requirements', + task: async () => dockerCompose.throwErrorIfNotInstalled(), + }, { title: 'Set the number of nodes', enabled: (ctx) => ctx.nodeCount === undefined, @@ -77,7 +83,8 @@ export default function setupLocalPresetTaskFactory( ctx.minerInterval = await task.prompt({ type: 'input', message: 'Enter the interval between core blocks', - initial: configFile.getConfig('base').get('core.miner.interval'), + initial: configFile.getConfig('base') + .get('core.miner.interval'), validate: (state) => { if (state.match(/\d+(\.\d+)?([ms])/)) { return true; @@ -90,7 +97,7 @@ export default function setupLocalPresetTaskFactory( }, { title: 'Create local group configs', - task: async (ctx, task) => { + task: async (ctx) => { ctx.configGroup = new Array(ctx.nodeCount) .fill(undefined) .map((value, i) => `local_${i + 1}`) @@ -108,63 +115,6 @@ export default function setupLocalPresetTaskFactory( const hostDockerInternalIp = await resolveDockerHostIp(); - const network = ctx.configGroup[0].get('network'); - - const { - hdPrivateKey: dpnsPrivateKey, - derivedPrivateKeys: [ - dpnsDerivedMasterPrivateKey, - dpnsDerivedSecondPrivateKey, - ], - } = await generateHDPrivateKeys(network, [0, 1]); - - const { - hdPrivateKey: featureFlagsPrivateKey, - derivedPrivateKeys: [ - featureFlagsDerivedMasterPrivateKey, - featureFlagsDerivedSecondPrivateKey, - ], - } = await generateHDPrivateKeys(network, [0, 1]); - - const { - hdPrivateKey: dashpayPrivateKey, - derivedPrivateKeys: [ - dashpayDerivedMasterPrivateKey, - dashpayDerivedSecondPrivateKey, - ], - } = await generateHDPrivateKeys(network, [0, 1]); - - const { - hdPrivateKey: withdrawalsPrivateKey, - derivedPrivateKeys: [ - withdrawalsDerivedMasterPrivateKey, - withdrawalsDerivedSecondPrivateKey, - ], - } = await generateHDPrivateKeys(network, [0, 1]); - - const { - hdPrivateKey: masternodeRewardSharesPrivateKey, - derivedPrivateKeys: [ - masternodeRewardSharesDerivedMasterPrivateKey, - masternodeRewardSharesDerivedSecondPrivateKey, - ], - } = await generateHDPrivateKeys(network, [0, 1]); - - // eslint-disable-next-line no-param-reassign - task.output = `DPNS Private Key: ${dpnsPrivateKey.toString()}`; - - // eslint-disable-next-line no-param-reassign - task.output = `Feature Flags Private Key: ${featureFlagsPrivateKey.toString()}`; - - // eslint-disable-next-line no-param-reassign - task.output = `Dashpay Private Key: ${dashpayPrivateKey.toString()}`; - - // eslint-disable-next-line no-param-reassign - task.output = `Masternode Reward Shares Private Key: ${masternodeRewardSharesPrivateKey.toString()}`; - - // eslint-disable-next-line no-param-reassign - task.output = `Withdrawals Private Key: ${withdrawalsPrivateKey.toString()}`; - const subTasks = ctx.configGroup.map((config, i) => ( { title: `Create ${config.getName()} config`, @@ -174,11 +124,16 @@ export default function setupLocalPresetTaskFactory( config.set('group', 'local'); config.set('core.p2p.port', config.get('core.p2p.port') + (i * 100)); config.set('core.rpc.port', config.get('core.rpc.port') + (i * 100)); - config.set('core.rpc.user', generateRandomString(8)); - config.set('core.rpc.password', generateRandomString(12)); + + Object.values(config.get('core.rpc.users')).forEach((options) => { + // eslint-disable-next-line no-param-reassign + options.password = generateRandomString(12); + }); + config.set('externalIp', hostDockerInternalIp); - const subnet = config.get('docker.network.subnet').split('.'); + const subnet = config.get('docker.network.subnet') + .split('.'); subnet[2] = nodeIndex; config.set('docker.network.subnet', subnet.join('.')); @@ -201,32 +156,40 @@ export default function setupLocalPresetTaskFactory( config.set('description', 'seed node for local network'); config.set('core.masternode.enable', false); - config.set('core.miner.enable', true); // Enable miner for the seed node config.set('core.miner.enable', true); + // We need them to register masternodes + config.set('core.indexes', ['tx', 'address', 'timestamp', 'spent']); + // Disable platform for the seed node config.set('platform.enable', false); config.set('platform.drive.tenderdash.mode', 'seed'); } else { config.set('description', `local node #${nodeIndex}`); + config.set('platform.drive.tenderdash.mode', 'validator'); + const key = generateTenderdashNodeKey(); const id = deriveTenderdashNodeId(key); config.set('platform.drive.tenderdash.node.id', id); config.set('platform.drive.tenderdash.node.key', key); - config.set('platform.dapi.envoy.http.port', config.get('platform.dapi.envoy.http.port') + (i * 100)); + config.set('platform.drive.abci.grovedbVisualizer.port', config.get('platform.drive.abci.grovedbVisualizer.port') + (i * 100)); + config.set('platform.drive.abci.tokioConsole.port', config.get('platform.drive.abci.tokioConsole.port') + (i * 100)); + config.set('platform.drive.abci.metrics.port', config.get('platform.drive.abci.metrics.port') + (i * 100)); + config.set('platform.gateway.admin.port', config.get('platform.gateway.admin.port') + (i * 100)); + config.set('platform.gateway.listeners.dapiAndDrive.port', config.get('platform.gateway.listeners.dapiAndDrive.port') + (i * 100)); + config.set('platform.gateway.metrics.port', config.get('platform.gateway.metrics.port') + (i * 100)); + config.set('platform.gateway.rateLimiter.metrics.port', config.get('platform.gateway.rateLimiter.metrics.port') + (i * 100)); config.set('platform.drive.tenderdash.p2p.port', config.get('platform.drive.tenderdash.p2p.port') + (i * 100)); config.set('platform.drive.tenderdash.rpc.port', config.get('platform.drive.tenderdash.rpc.port') + (i * 100)); config.set('platform.drive.tenderdash.pprof.port', config.get('platform.drive.tenderdash.pprof.port') + (i * 100)); config.set('platform.drive.tenderdash.metrics.port', config.get('platform.drive.tenderdash.metrics.port') + (i * 100)); config.set('platform.drive.tenderdash.moniker', config.name); - config.set('platform.drive.tenderdash.mode', 'validator'); - // Setup logs if (ctx.debugLogs) { const stdoutLogger = config.get('platform.drive.abci.logs.stdout'); @@ -238,28 +201,6 @@ export default function setupLocalPresetTaskFactory( // TODO: Shall we use trace? config.set('platform.drive.tenderdash.log.level', 'debug'); } - - config.set('platform.dpns.masterPublicKey', dpnsDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.dpns.secondPublicKey', dpnsDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); - - config.set('platform.featureFlags.masterPublicKey', featureFlagsDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.featureFlags.secondPublicKey', featureFlagsDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); - - config.set('platform.dashpay.masterPublicKey', dashpayDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.dashpay.secondPublicKey', dashpayDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); - - config.set('platform.withdrawals.masterPublicKey', withdrawalsDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.withdrawals.secondPublicKey', withdrawalsDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); - - config.set( - 'platform.masternodeRewardShares.masterPublicKey', - masternodeRewardSharesDerivedMasterPrivateKey.privateKey - .toPublicKey().toString(), - ); config.set( - 'platform.masternodeRewardShares.secondPublicKey', - masternodeRewardSharesDerivedSecondPrivateKey.privateKey - .toPublicKey().toString(), - ); } }, options: { @@ -290,8 +231,7 @@ export default function setupLocalPresetTaskFactory( const subTasks = platformConfigs.map((config) => ({ title: `Generate certificate for ${config.getName()}`, task: async () => obtainSelfSignedCertificateTask(config), - } - )); + })); return new Listr(subTasks); }, diff --git a/packages/dashmate/src/listr/tasks/setup/setupRegularPresetTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/setupRegularPresetTaskFactory.js index 544ab8003f2..25a88dddd92 100644 --- a/packages/dashmate/src/listr/tasks/setup/setupRegularPresetTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/setupRegularPresetTaskFactory.js @@ -5,7 +5,6 @@ import chalk from 'chalk'; import { NODE_TYPE_MASTERNODE, NODE_TYPE_FULLNODE, - PRESET_MAINNET, } from '../../../constants.js'; import { @@ -25,6 +24,8 @@ import generateRandomString from '../../../util/generateRandomString.js'; * @param {configureNodeTask} configureNodeTask * @param {configureSSLCertificateTask} configureSSLCertificateTask * @param {DefaultConfigs} defaultConfigs + * @param {verifySystemRequirementsTask} verifySystemRequirementsTask + * @param {importCoreDataTask} importCoreDataTask */ export default function setupRegularPresetTaskFactory( configFile, @@ -35,6 +36,8 @@ export default function setupRegularPresetTaskFactory( configureNodeTask, configureSSLCertificateTask, defaultConfigs, + importCoreDataTask, + verifySystemRequirementsTask, ) { /** * @typedef {setupRegularPresetTask} @@ -45,10 +48,8 @@ export default function setupRegularPresetTaskFactory( { title: 'Node type', task: async (ctx, task) => { - let nodeTypeName; - if (!ctx.nodeType) { - nodeTypeName = await task.prompt([ + ctx.nodeTypeName = await task.prompt([ { type: 'select', // Keep this order, because each item references the text in the previous item @@ -71,15 +72,15 @@ export default function setupRegularPresetTaskFactory( }, ]); - ctx.nodeType = getNodeTypeByName(nodeTypeName); - ctx.isHP = isNodeTypeNameHighPerformance(nodeTypeName); + ctx.nodeType = getNodeTypeByName(ctx.nodeTypeName); + ctx.isHP = isNodeTypeNameHighPerformance(ctx.nodeTypeName); } else { - nodeTypeName = getNodeTypeNameByType(ctx.nodeType); + ctx.nodeTypeName = getNodeTypeNameByType(ctx.nodeType); } ctx.config = defaultConfigs.get(ctx.preset); - ctx.config.set('platform.enable', ctx.isHP && ctx.config.get('network') !== PRESET_MAINNET); + ctx.config.set('platform.enable', ctx.isHP); ctx.config.set('core.masternode.enable', ctx.nodeType === NODE_TYPE_MASTERNODE); if (ctx.config.get('core.masternode.enable')) { @@ -88,26 +89,31 @@ export default function setupRegularPresetTaskFactory( ctx.config.set('platform.drive.tenderdash.mode', 'full'); } - ctx.config.set('core.rpc.user', generateRandomString(8)); - ctx.config.set('core.rpc.password', generateRandomString(12)); + Object.values(ctx.config.get('core.rpc.users')).forEach((options) => { + // eslint-disable-next-line no-param-reassign + options.password = generateRandomString(12); + }); // eslint-disable-next-line no-param-reassign - task.output = ctx.nodeType ? ctx.nodeType : nodeTypeName; + task.output = ctx.nodeTypeName; }, options: { persistentOutput: true, }, }, + { + task: () => verifySystemRequirementsTask(), + }, { enabled: (ctx) => ctx.nodeType === NODE_TYPE_MASTERNODE, task: async (ctx, task) => { let header; if (ctx.isHP) { - header = ` If your HP masternode is already registered, we will import your masternode - operator and platform node keys to configure an HP masternode. Please make + header = ` If your Evo masternode is already registered, we will import your masternode + operator and platform node keys to configure an Evo masternode. Please make sure your IP address has not changed, otherwise you will need to create a provider update service transaction.\n - If you are registering a new HP masternode, dashmate will provide more + If you are registering a new Evo masternode, dashmate will provide more information and help you to generate the necessary keys.\n`; } else { header = ` If your masternode is already registered, we will import your masternode @@ -131,6 +137,10 @@ export default function setupRegularPresetTaskFactory( enabled: (ctx) => !ctx.isMasternodeRegistered && ctx.nodeType === NODE_TYPE_MASTERNODE, task: () => registerMasternodeGuideTask(), }, + { + enabled: (ctx) => ctx.isMasternodeRegistered, + task: () => importCoreDataTask(), + }, { enabled: (ctx) => ctx.isMasternodeRegistered || ctx.nodeType === NODE_TYPE_FULLNODE, task: () => configureNodeTask(), @@ -144,11 +154,20 @@ export default function setupRegularPresetTaskFactory( configFile.setConfig(ctx.config); configFile.setDefaultConfigName(ctx.preset); + let startInstructions = ''; + if (ctx.isReindexRequired) { + startInstructions = chalk`You existing Core node doesn't have indexes required to run ${ctx.nodeTypeName} + Please run {bold.cyanBright dashmate core reindex} to reindex your node. + The node will be started automatically after reindex is complete.`; + } else { + startInstructions = chalk`You can now run {bold.cyanBright dashmate start} to start your node, followed by + {bold.cyanBright dashmate status} for a node health status overview.`; + } + // eslint-disable-next-line no-param-reassign task.output = chalk`Node configuration completed successfully! - You can now run {bold.cyanBright dashmate start} to start your node, followed by - {bold.cyanBright dashmate status} for a node health status overview. + ${startInstructions} Run {bold.cyanBright dashmate --help} or {bold.cyanBright dashmate --help} for quick help on how to use dashmate to manage your node.\n`; diff --git a/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js b/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js index 738c427611c..eba5de00e46 100644 --- a/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js +++ b/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js @@ -39,8 +39,8 @@ export default class VerificationServer { dots.templateSettings.strip = false; - // Set up Envoy config - const configSubPath = path.join('platform', 'dapi', 'envoy'); + // Set up Gateway config + const configSubPath = path.join('platform', 'gateway'); const templatePath = path.join(TEMPLATES_DIR, configSubPath, '_zerossl_validation.yaml.dot'); const templateString = fs.readFileSync(templatePath, 'utf-8'); const template = dots.template(templateString); @@ -48,9 +48,9 @@ export default class VerificationServer { const route = validationUrl.replace(`http://${config.get('externalIp')}`, ''); const body = validationContent.join('\\n'); - const envoyConfig = template({ route, body }); + const gatewayConfig = template({ route, body }); - const configDir = this.homeDir.joinPath(config.getName(), 'platform', 'dapi', 'envoy'); + const configDir = this.homeDir.joinPath(config.getName(), 'platform', 'gateway'); const configName = path.basename(templatePath, '.dot'); this.configPath = path.join(configDir, configName); @@ -59,7 +59,7 @@ export default class VerificationServer { fs.mkdirSync(configDir); } fs.rmSync(this.configPath, { force: true }); - fs.writeFileSync(this.configPath, envoyConfig, 'utf8'); + fs.writeFileSync(this.configPath, gatewayConfig, 'utf8'); } /** @@ -76,7 +76,7 @@ export default class VerificationServer { return false; } - const image = this.config.get('platform.dapi.envoy.docker.image'); + const image = this.config.get('platform.gateway.docker.image'); const name = 'dashmate-zerossl-validation'; diff --git a/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js b/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js index b3096936c40..bbcfac1ea04 100644 --- a/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js +++ b/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js @@ -20,8 +20,7 @@ export default function saveCertificateTaskFactory(homeDir) { const certificatesDir = homeDir.joinPath( config.getName(), 'platform', - 'dapi', - 'envoy', + 'gateway', 'ssl', ); @@ -34,7 +33,7 @@ export default function saveCertificateTaskFactory(homeDir) { const keyFile = path.join(certificatesDir, 'private.key'); fs.writeFileSync(keyFile, ctx.privateKeyFile, 'utf8'); - config.set('platform.dapi.envoy.ssl.enabled', true); + config.set('platform.gateway.ssl.enabled', true); }, }]); } diff --git a/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js b/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js index 16e5c669339..12718ad4de4 100644 --- a/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js @@ -37,10 +37,10 @@ export default function obtainZeroSSLCertificateTaskFactory( */ async function obtainZeroSSLCertificateTask(config) { // Make sure that required config options are set - const apiKey = config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.apiKey', true); + const apiKey = config.get('platform.gateway.ssl.providerConfigs.zerossl.apiKey', true); const externalIp = config.get('externalIp', true); - const sslConfigDir = homeDir.joinPath(config.getName(), 'platform', 'dapi', 'envoy', 'ssl'); + const sslConfigDir = homeDir.joinPath(config.getName(), 'platform', 'gateway', 'ssl'); const csrFilePath = path.join(sslConfigDir, 'csr.pem'); const privateKeyFilePath = path.join(sslConfigDir, 'private.key'); const bundleFilePath = path.join(sslConfigDir, 'bundle.crt'); @@ -54,7 +54,7 @@ export default function obtainZeroSSLCertificateTaskFactory( // Skips the check if force flag is set skip: (ctx) => ctx.force, task: async (ctx, task) => { - const certificateId = await config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.id'); + const certificateId = await config.get('platform.gateway.ssl.providerConfigs.zerossl.id'); if (!certificateId) { // Certificate is not configured @@ -179,9 +179,9 @@ export default function obtainZeroSSLCertificateTaskFactory( apiKey, ); - config.set('platform.dapi.envoy.ssl.enabled', true); - config.set('platform.dapi.envoy.ssl.provider', 'zerossl'); - config.set('platform.dapi.envoy.ssl.providerConfigs.zerossl.id', ctx.certificate.id); + config.set('platform.gateway.ssl.enabled', true); + config.set('platform.gateway.ssl.provider', 'zerossl'); + config.set('platform.gateway.ssl.providerConfigs.zerossl.id', ctx.certificate.id); }, }, { diff --git a/packages/dashmate/src/listr/tasks/startGroupNodesTaskFactory.js b/packages/dashmate/src/listr/tasks/startGroupNodesTaskFactory.js index 8a923331132..eae01bd49e4 100644 --- a/packages/dashmate/src/listr/tasks/startGroupNodesTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/startGroupNodesTaskFactory.js @@ -70,8 +70,8 @@ export default function startGroupNodesTaskFactory( task: async () => { const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); diff --git a/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js index ac2ea87a0c3..b364bcf2241 100644 --- a/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js @@ -29,11 +29,6 @@ export default function startNodeTaskFactory( * @return {Object} */ function startNodeTask(config) { - // Check external IP is set - if (config.get('core.masternode.enable')) { - config.get('externalIp', true); - } - const isMinerEnabled = config.get('core.miner.enable'); if (isMinerEnabled === true && config.get('network') !== NETWORK_LOCAL) { @@ -45,16 +40,22 @@ export default function startNodeTaskFactory( // Check Drive log files are created if (config.get('platform.enable')) { + // Ensure log files for Drive are created const loggers = config.get('platform.drive.abci.logs'); - - for (const logger of Object.values(loggers)) { - if (['stdout', 'stderr'].includes(logger.destination)) { - continue; - } - - ensureFileMountExists(logger.destination, 0o666); - } - + Object.values(loggers) + .filter((logger) => logger.destination !== 'stdout' && logger.destination !== 'stderr') + .forEach((logger) => { + ensureFileMountExists(logger.destination, 0o666); + }); + + // Ensure access log files for Gateway are created + config.get('platform.gateway.log.accessLogs') + .filter((log) => log.type === 'file') + .forEach((log) => { + ensureFileMountExists(log.path, 0o666); + }); + + // Ensure tenderdash log file is created const tenderdashLogFilePath = config.get('platform.drive.tenderdash.log.path'); if (tenderdashLogFilePath !== null) { ensureFileMountExists(tenderdashLogFilePath, 0o666); @@ -113,8 +114,8 @@ export default function startNodeTaskFactory( task: async () => { const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); diff --git a/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js index 9fe5f4dbda2..e57101c96b3 100644 --- a/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js @@ -1,4 +1,7 @@ +/* eslint-disable no-console */ import { Listr } from 'listr2'; +import { MIN_BLOCKS_BEFORE_DKG } from '../../constants.js'; +import waitForDKGWindowPass from '../../core/quorum/waitForDKGWindowPass.js'; /** * @param {DockerCompose} dockerCompose @@ -34,6 +37,36 @@ export default function stopNodeTaskFactory( } }, }, + { + title: 'Check node is participating in DKG', + enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && !ctx.isSafe && !ctx.platformOnly, + task: async () => { + const rpcClient = createRpcClient({ + port: config.get('core.rpc.port'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), + host: await getConnectionHost(config, 'core', 'core.rpc.host'), + }); + + const { result: dkgInfo } = await rpcClient.quorum('dkginfo'); + const { next_dkg: nextDkg } = dkgInfo; + + if (nextDkg <= MIN_BLOCKS_BEFORE_DKG) { + throw new Error('Your node is currently participating in DKG exchange session and ' + + 'stopping it right now may result in PoSE ban. Try again later, or continue with --force or --safe flags'); + } + }, + }, + { + title: 'Wait for DKG window to pass', + enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && ctx.isSafe && !ctx.platformOnly, + task: async () => waitForDKGWindowPass(createRpcClient({ + port: config.get('core.rpc.port'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), + host: await getConnectionHost(config, 'core', 'core.rpc.host'), + })), + }, { title: 'Save core node time', enabled: () => config.get('group') === 'local', @@ -41,8 +74,8 @@ export default function stopNodeTaskFactory( task: async () => { const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); @@ -58,7 +91,6 @@ export default function stopNodeTaskFactory( if (ctx.platformOnly) { profiles.push('platform'); } - await dockerCompose.stop(config, { profiles }); }, }, diff --git a/packages/dashmate/src/status/colors.js b/packages/dashmate/src/status/colors.js index 27c80532b2a..3f30854f377 100644 --- a/packages/dashmate/src/status/colors.js +++ b/packages/dashmate/src/status/colors.js @@ -34,6 +34,7 @@ export default { return chalk.green; case ServiceStatusEnum.syncing: case ServiceStatusEnum.wait_for_core: + case ServiceStatusEnum.wait_for_activation: return chalk.yellow; default: return chalk.red; @@ -73,4 +74,5 @@ export default { } return chalk.red; }, + platformActivation: (string) => (string.startsWith('Activated') ? chalk.green : chalk.yellow), }; diff --git a/packages/dashmate/src/status/determineStatus.js b/packages/dashmate/src/status/determineStatus.js index d31d71cfef1..723302a006f 100644 --- a/packages/dashmate/src/status/determineStatus.js +++ b/packages/dashmate/src/status/determineStatus.js @@ -37,9 +37,14 @@ export default { * Determine platform ServiceStatus based on DockerStatusEnum and core readiness * @param dockerStatus {DockerStatusEnum} * @param coreIsSynced {boolean} + * @param mnRRSoftFork {object} * @returns {ServiceStatusEnum} */ - platform: (dockerStatus, coreIsSynced) => { + platform: (dockerStatus, coreIsSynced, mnRRSoftFork) => { + if (coreIsSynced && !mnRRSoftFork.active) { + return ServiceStatusEnum.wait_for_activation; + } + if (dockerStatus === DockerStatusEnum.running) { return coreIsSynced ? ServiceStatusEnum.up : ServiceStatusEnum.wait_for_core; } diff --git a/packages/dashmate/src/status/enums/serviceStatus.js b/packages/dashmate/src/status/enums/serviceStatus.js index 6a6fc4500d2..09cb1f1c390 100644 --- a/packages/dashmate/src/status/enums/serviceStatus.js +++ b/packages/dashmate/src/status/enums/serviceStatus.js @@ -4,5 +4,6 @@ export const ServiceStatusEnum = { up: 'up', syncing: 'syncing', wait_for_core: 'wait_for_core', + wait_for_activation: 'wait_for_activation', error: 'error', }; diff --git a/packages/dashmate/src/status/scopes/core.js b/packages/dashmate/src/status/scopes/core.js index 339e4794011..d983bcd67c5 100644 --- a/packages/dashmate/src/status/scopes/core.js +++ b/packages/dashmate/src/status/scopes/core.js @@ -76,8 +76,8 @@ export default function getCoreScopeFactory( try { const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); diff --git a/packages/dashmate/src/status/scopes/masternode.js b/packages/dashmate/src/status/scopes/masternode.js index 0a3cff387ae..b29a5bbfc6a 100644 --- a/packages/dashmate/src/status/scopes/masternode.js +++ b/packages/dashmate/src/status/scopes/masternode.js @@ -17,8 +17,8 @@ export default function getMasternodeScopeFactory( async function getSyncAsset(config) { const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); @@ -31,8 +31,8 @@ export default function getMasternodeScopeFactory( async function getMasternodeInfo(config) { const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); diff --git a/packages/dashmate/src/status/scopes/platform.js b/packages/dashmate/src/status/scopes/platform.js index 74d961e63c4..f18b2915498 100644 --- a/packages/dashmate/src/status/scopes/platform.js +++ b/packages/dashmate/src/status/scopes/platform.js @@ -1,3 +1,4 @@ +import prettyMs from 'pretty-ms'; import providers from '../providers.js'; import { DockerStatusEnum } from '../enums/dockerStatus.js'; import { ServiceStatusEnum } from '../enums/serviceStatus.js'; @@ -15,24 +16,35 @@ export default function getPlatformScopeFactory( createRpcClient, getConnectionHost, ) { - async function getMNSync(config) { + async function getCoreInfo(config) { const rpcClient = createRpcClient({ port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), host: await getConnectionHost(config, 'core', 'core.rpc.host'), }); + const [mnSync, blockchainInfo] = await Promise.all([ + rpcClient.mnsync('status'), + rpcClient.getBlockchainInfo(), + ]); + + const { + result: { + softforks: { mn_rr: mnRR }, + }, + } = blockchainInfo; + const { result: { IsSynced: isSynced, }, - } = await rpcClient.mnsync('status'); + } = mnSync; - return isSynced; + return { isSynced, mnRRSoftFork: mnRR }; } - async function getTenderdashInfo(config, isCoreSynced) { + async function getTenderdashInfo(config, isCoreSynced, mnRRSoftFork) { const info = { p2pPortState: null, httpPortState: null, @@ -63,7 +75,7 @@ export default function getPlatformScopeFactory( } const dockerStatus = await determineStatus.docker(dockerCompose, config, 'drive_tenderdash'); - const serviceStatus = determineStatus.platform(dockerStatus, isCoreSynced); + const serviceStatus = determineStatus.platform(dockerStatus, isCoreSynced, mnRRSoftFork); info.dockerStatus = dockerStatus; info.serviceStatus = serviceStatus; @@ -77,7 +89,7 @@ export default function getPlatformScopeFactory( // Collecting platform data fails if Tenderdash is waiting for core to sync if (info.serviceStatus === ServiceStatusEnum.up) { const portStatusResult = await Promise.allSettled([ - providers.mnowatch.checkPortStatus(config.get('platform.dapi.envoy.http.port')), + providers.mnowatch.checkPortStatus(config.get('platform.gateway.listeners.dapiAndDrive.port')), providers.mnowatch.checkPortStatus(config.get('platform.drive.tenderdash.p2p.port')), ]); const [httpPortState, p2pPortState] = portStatusResult.map((result) => (result.status === 'fulfilled' ? result.value : null)); @@ -115,6 +127,10 @@ export default function getPlatformScopeFactory( const platformPeers = parseInt(tenderdashNetInfo.n_peers, 10); const { listening } = tenderdashNetInfo; + if (catchingUp) { + info.serviceStatus = ServiceStatusEnum.syncing; + } + info.version = version; info.listening = listening; info.latestBlockHeight = latestBlockHeight; @@ -138,7 +154,7 @@ export default function getPlatformScopeFactory( return info; } - const getDriveInfo = async (config, isCoreSynced) => { + const getDriveInfo = async (config, isCoreSynced, mnRRSoftFork) => { const info = { dockerStatus: null, serviceStatus: null, @@ -146,7 +162,7 @@ export default function getPlatformScopeFactory( try { info.dockerStatus = await determineStatus.docker(dockerCompose, config, 'drive_abci'); - info.serviceStatus = determineStatus.platform(info.dockerStatus, isCoreSynced); + info.serviceStatus = determineStatus.platform(info.dockerStatus, isCoreSynced, mnRRSoftFork); if (info.serviceStatus === ServiceStatusEnum.up) { const driveEchoResult = await dockerCompose.execCommand( @@ -181,7 +197,7 @@ export default function getPlatformScopeFactory( * @returns {Promise} */ async function getPlatformScope(config) { - const httpPort = config.get('platform.dapi.envoy.http.port'); + const httpPort = config.get('platform.gateway.listeners.dapiAndDrive.port'); const httpService = config.get('externalIp') ? `${config.get('externalIp')}:${httpPort}` : null; const p2pPort = config.get('platform.drive.tenderdash.p2p.port'); const p2pService = config.get('externalIp') ? `${config.get('externalIp')}:${p2pPort}` : null; @@ -190,6 +206,7 @@ export default function getPlatformScopeFactory( const rpcService = `${rpcHost}:${rpcPort}`; const scope = { + platformActivation: null, coreIsSynced: null, httpPort, httpService, @@ -229,11 +246,14 @@ export default function getPlatformScopeFactory( } } + let coreInfo; + try { - const coreIsSynced = await getMNSync(config); - scope.coreIsSynced = coreIsSynced; + coreInfo = await getCoreInfo(config); + + scope.coreIsSynced = coreInfo.isSynced; - if (!coreIsSynced) { + if (!coreInfo.isSynced) { if (process.env.DEBUG) { // eslint-disable-next-line no-console console.error('Platform status is not available until masternode state is \'READY\''); @@ -246,20 +266,34 @@ export default function getPlatformScopeFactory( } } - const [tenderdash, drive] = await Promise.all([ - getTenderdashInfo(config, scope.coreIsSynced), - getDriveInfo(config, scope.coreIsSynced), - ]); + if (coreInfo) { + const { mnRRSoftFork } = coreInfo; - if (tenderdash) { - scope.tenderdash = tenderdash; + if (mnRRSoftFork.active) { + scope.platformActivation = `Activated (at height ${mnRRSoftFork.height})`; + } else { + const startTime = mnRRSoftFork.bip9.start_time; - scope.httpPortState = tenderdash.httpPortState; - scope.p2pPortState = tenderdash.p2pPortState; - } + const diff = (new Date().getTime() - startTime) / 1000; + + scope.platformActivation = `Waiting for activation (approximately in ${prettyMs(diff, { compact: true })})`; + } + + const [tenderdash, drive] = await Promise.all([ + getTenderdashInfo(config, scope.coreIsSynced, coreInfo.mnRRSoftFork), + getDriveInfo(config, scope.coreIsSynced, coreInfo.mnRRSoftFork), + ]); + + if (tenderdash) { + scope.tenderdash = tenderdash; - if (drive) { - scope.drive = drive; + scope.httpPortState = tenderdash.httpPortState; + scope.p2pPortState = tenderdash.p2pPortState; + } + + if (drive) { + scope.drive = drive; + } } return scope; diff --git a/packages/dashmate/src/templates/renderServiceTemplatesFactory.js b/packages/dashmate/src/templates/renderServiceTemplatesFactory.js index c9eb69ffb56..785e4775ae0 100644 --- a/packages/dashmate/src/templates/renderServiceTemplatesFactory.js +++ b/packages/dashmate/src/templates/renderServiceTemplatesFactory.js @@ -1,4 +1,3 @@ -import dots from 'dot'; import * as glob from 'glob'; import { TEMPLATES_DIR } from '../constants.js'; @@ -15,8 +14,6 @@ export default function renderServiceTemplatesFactory(renderTemplate) { * @return {Object} */ function renderServiceTemplates(config) { - dots.templateSettings.strip = false; - const templatePaths = glob.sync(`${TEMPLATES_DIR}/**/*.dot`, { ignore: { // Ignore manual rendered templates diff --git a/packages/dashmate/src/templates/renderTemplateFactory.js b/packages/dashmate/src/templates/renderTemplateFactory.js index 6f69969579d..605a5c24065 100644 --- a/packages/dashmate/src/templates/renderTemplateFactory.js +++ b/packages/dashmate/src/templates/renderTemplateFactory.js @@ -1,5 +1,6 @@ import fs from 'fs'; import dots from 'dot'; +import crypto from 'crypto'; /** * @return {renderTemplate} @@ -16,9 +17,13 @@ export default function renderTemplateFactory() { */ function renderTemplate(templatePath, variables) { const templateString = fs.readFileSync(templatePath, 'utf-8'); + + // do not strip \n + dots.templateSettings.strip = false; + const template = dots.template(templateString); - return template(variables); + return template({ ...variables, crypto }); } return renderTemplate; diff --git a/packages/dashmate/src/test/constants/services.js b/packages/dashmate/src/test/constants/services.js index 1b29357cbbb..beb3d1d9aaf 100644 --- a/packages/dashmate/src/test/constants/services.js +++ b/packages/dashmate/src/test/constants/services.js @@ -1,9 +1,9 @@ export default { dashmate_helper: 'Dashmate Helper', - dapi_envoy: 'DAPI Envoy', + gateway: 'Gateway', dapi_api: 'DAPI API', drive_tenderdash: 'Drive Tenderdash', drive_abci: 'Drive ABCI', - dapi_tx_filter_stream: 'DAPI Transactions Filter Stream', + dapi_core_streams: 'DAPI Core Streams', core: 'Core', }; diff --git a/packages/dashmate/src/test/mock/getConfigMock.js b/packages/dashmate/src/test/mock/getConfigMock.js index 0e30ce5e0b4..1961c48f289 100644 --- a/packages/dashmate/src/test/mock/getConfigMock.js +++ b/packages/dashmate/src/test/mock/getConfigMock.js @@ -9,11 +9,11 @@ export default function getConfigMock(sinon) { configMock.get.withArgs('core.rpc.host').returns('127.0.0.1'); configMock.get.withArgs('docker.network.privateInterface').returns('127.0.0.1'); configMock.get.withArgs('docker.network.privateInterface').returns('127.0.0.1'); - configMock.get.withArgs('platform.dapi.envoy.http.port').returns('8100'); + configMock.get.withArgs('platform.gateway.listeners.dapiAndDrive.port').returns('8100'); configMock.get.withArgs('externalIp').returns('127.0.0.1'); configMock.get.withArgs('platform.drive.tenderdash.p2p.port').returns('8101'); - configMock.get.withArgs('platform.dapi.envoy.http.host').returns('0.0.0.0'); - configMock.get.withArgs('platform.dapi.envoy.http.port').returns('8102'); + configMock.get.withArgs('platform.gateway.listeners.dapiAndDrive.host').returns('0.0.0.0'); + configMock.get.withArgs('platform.gateway.listeners.dapiAndDrive.port').returns('8102'); configMock.get.withArgs('platform.drive.tenderdash.rpc.host').returns('127.0.0.1'); configMock.get.withArgs('platform.drive.tenderdash.rpc.port').returns('8103'); configMock.get.withArgs('platform.enable').returns(true); diff --git a/packages/dashmate/src/update/updateNodeFactory.js b/packages/dashmate/src/update/updateNodeFactory.js index 79996a2511d..13cf1ef83c2 100644 --- a/packages/dashmate/src/update/updateNodeFactory.js +++ b/packages/dashmate/src/update/updateNodeFactory.js @@ -19,10 +19,17 @@ export default function updateNodeFactory(getServiceList, docker) { return Promise.all( lodash.uniqBy(services, 'image') - .map(async ({ name, image, title }) => new Promise((resolve, reject) => { + .map(async ({ name, image, title }) => new Promise((resolve) => { docker.pull(image, (err, stream) => { if (err) { - reject(err); + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.error(`Failed to update ${name} service, image ${image}, error: ${err}`); + } + + resolve({ + name, title, image, updated: 'error', + }); } else { let updated = null; @@ -33,15 +40,26 @@ export default function updateNodeFactory(getServiceList, docker) { .trim() .split('\r\n') .map((str) => JSON.parse(str)) - .filter((obj) => obj.status.startsWith('Status: ')); + .filter((obj) => obj?.status?.startsWith('Status: ')); - if (status?.status.includes('Image is up to date for')) { - updated = false; - } else if (status?.status.includes('Downloaded newer image for')) { - updated = true; + if (status) { + if (status.status.includes('Image is up to date for')) { + updated = 'up to date'; + } else if (status.status.includes('Downloaded newer image for')) { + updated = 'updated'; + } } }); - stream.on('error', reject); + stream.on('error', () => { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.error(`Failed to update ${name} service, image ${image}, error: ${err}`); + } + + resolve({ + name, title, image, updated: 'error', + }); + }); stream.on('end', () => resolve({ name, title, image, updated, })); diff --git a/packages/dashmate/templates/core/dash.conf.dot b/packages/dashmate/templates/core/dash.conf.dot index 3907b248d8c..807431f9848 100644 --- a/packages/dashmate/templates/core/dash.conf.dot +++ b/packages/dashmate/templates/core/dash.conf.dot @@ -12,19 +12,26 @@ debuglogfile=/var/log/dash/{{= it.core.log.file.path.split('/').pop() }} logips={{=it.core.logIps }} fallbackfee=0.00001 -# JSONRPC +# JSON RPC server=1 -rpcuser={{=it.core.rpc.user}} -rpcpassword={{=it.core.rpc.password}} rpcwallet=main deprecatedrpc=hpmn +rpcworkqueue=64 +rpcthreads=16 +rpcwhitelistdefault=0 +rpcexternaluser={{= Object.entries(it.core.rpc.users).filter(([username, options]) => options.lowPriority).map(([username, options]) => username).join(',') }} +{{~ Object.keys(it.core.rpc.users) :user}} +{{ salt = it.crypto.randomBytes(16).toString('hex'); }} +{{ hmac = it.crypto.createHmac('sha256', salt).update(it.core.rpc.users[user].password); }} +rpcauth={{=user}}:{{=salt}}${{=hmac.digest('hex') }} +{{? it.core.rpc.users[user].whitelist !== null }} +rpcwhitelist={{=user}}:{{=it.core.rpc.users[user].whitelist.join(',')}} +{{?}} +{{~}} {{~it.core.rpc.allowIps :host}} rpcallowip={{=host}}{{~}} -rpcworkqueue=64 -rpcthreads=16 - # external network listen=1 dnsseed=0 @@ -36,11 +43,15 @@ externalip={{=it.externalIp}} whitelist={{=it.externalIp}} {{?}} -{{? it.core.indexes }}# Indices +{{? it.core.insight.enabled }} txindex=1 addressindex=1 timestampindex=1 spentindex=1 +{{??}} +{{~it.core.indexes :index}} +{{= index + 'index=1' }} +{{~}} {{?}} # ZeroMQ notifications @@ -69,7 +80,6 @@ regtest=1 {{? it.core.spork.address}}sporkaddr={{=it.core.spork.address}}{{?}} {{? it.core.spork.privateKey}}sporkkey={{=it.core.spork.privateKey}}{{?}} {{? it.core.miner.mediantime}}mocktime={{=it.core.miner.mediantime}}{{?}} -llmqtestinstantsend=llmq_test llmqtestinstantsenddip0024=llmq_test_instantsend {{?? it.network === 'devnet'}} @@ -83,10 +93,10 @@ powtargetspacing={{=it.core.devnet.powTargetSpacing}} minimumdifficultyblocks={{=it.core.devnet.minimumDifficultyBlocks}} highsubsidyblocks=500 highsubsidyfactor=10 -llmqchainlocks=llmq_devnet -llmqinstantsend=llmq_devnet -llmqinstantsenddip0024=llmq_devnet_dip0024 -llmqplatform=llmq_devnet_platform{{?}} +llmqchainlocks={{=it.core.devnet.llmq.chainLocks}} +llmqinstantsenddip0024={{=it.core.devnet.llmq.instantSend}} +llmqplatform={{=it.core.devnet.llmq.platform}} +llmqmnhf={{=it.core.devnet.llmq.mnhf}} {{?}} {{~it.core.p2p.seeds :seed}} diff --git a/packages/dashmate/templates/core/insight/dashcore-node.json.dot b/packages/dashmate/templates/core/insight/dashcore-node.json.dot index fc42cca72b2..cfb92e73b14 100644 --- a/packages/dashmate/templates/core/insight/dashcore-node.json.dot +++ b/packages/dashmate/templates/core/insight/dashcore-node.json.dot @@ -12,8 +12,8 @@ "connect": [{ "rpchost": "core", "rpcport": {{= it.core.rpc.port }}, - "rpcuser": "{{= it.core.rpc.user }}", - "rpcpassword": "{{= it.core.rpc.password }}", + "rpcuser": "dashmate", + "rpcpassword": "{{= it.core.rpc.users.dashmate.password }}", "zmqpubrawtx": "tcp://core:29998", "zmqpubhashblock": "tcp://core:29998" }] diff --git a/packages/dashmate/templates/dynamic-compose.yml.dot b/packages/dashmate/templates/dynamic-compose.yml.dot index 84fed7fa04d..c0055e69492 100644 --- a/packages/dashmate/templates/dynamic-compose.yml.dot +++ b/packages/dashmate/templates/dynamic-compose.yml.dot @@ -17,3 +17,12 @@ services: - {{=settings.destination}}:/var/log/dash/drive/{{=name}}/{{=settings.destination.split('/').reverse()[0]}} {{~}} {{?}} + + {{ gatewayLogs = it.platform.gateway.log.accessLogs.filter((l) => l.type === 'file'); }} + {{? gatewayLogs.length > 0 }} + gateway: + volumes: + {{~ gatewayLogs :log }} + - {{= log.path }}:/var/log/{{= log.path.split('/').reverse()[0] }} + {{~}} + {{?}} diff --git a/packages/dashmate/templates/platform/dapi/envoy/envoy.yaml.dot b/packages/dashmate/templates/platform/dapi/envoy/envoy.yaml.dot deleted file mode 100644 index 72447cb8112..00000000000 --- a/packages/dashmate/templates/platform/dapi/envoy/envoy.yaml.dot +++ /dev/null @@ -1,249 +0,0 @@ -!ignore filters: &filters - - name: envoy.http_connection_manager - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http - codec_type: auto - access_log: - - name: envoy.access_loggers.file - typed_config: - "@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog - path: /dev/stdout - log_format: - json_format: - timestamp: "%START_TIME%" - client: "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%" - protocol: "%PROTOCOL%" - method: "%REQ(:METHOD)%" - uri: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" - upstream: "%UPSTREAM_HOST%" - "http-status": "%RESPONSE_CODE%" - "grpc-status": "%GRPC_STATUS%" - "rx-bytes": "%BYTES_RECEIVED%" - "tx-bytes": "%BYTES_SENT%" - "response-flags": "%RESPONSE_FLAGS%" - duration: "%DURATION%" - authority: "%REQ(:AUTHORITY)%" - http_filters: - - name: envoy.filters.http.local_ratelimit - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit - stat_prefix: http_local_rate_limiter - # see documentation https://www.envoyproxy.io/docs/envoy/latest/api-v3/type/v3/token_bucket.proto#envoy-v3-api-msg-type-v3-tokenbucket - token_bucket: - max_tokens: {{=it.platform.dapi.envoy.rateLimiter.maxTokens}} - tokens_per_fill: {{=it.platform.dapi.envoy.rateLimiter.tokensPerFill}} - fill_interval: {{=it.platform.dapi.envoy.rateLimiter.fillInterval}} - filter_enabled: - runtime_key: local_rate_limit_enabled - default_value: - numerator: {{? it.platform.dapi.envoy.rateLimiter.enabled}}100{{??}}0{{?}} - denominator: HUNDRED - filter_enforced: - runtime_key: local_rate_limit_enforced - default_value: - numerator: 100 - denominator: HUNDRED - response_headers_to_add: - - append: false - header: - key: x-local-rate-limit - value: 'true' - - name: envoy.filters.http.grpc_web - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb - - name: envoy.filters.http.cors - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors - - name: envoy.filters.http.router - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router - route_config: - name: local_route - virtual_hosts: - - name: dapi_services - domains: [ "*" ] - routes: - # tx subscription streaming endpoint configuration - - match: - prefix: "/org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs" - route: - cluster: tx_filter_stream - timeout: 660s - max_stream_duration: - grpc_timeout_header_max: 600s - # block headers subscription streaming endpoint - - match: - prefix: "/org.dash.platform.dapi.v0.Core/subscribeToBlockHeadersWithChainLocks" - route: - cluster: tx_filter_stream - timeout: 660s - max_stream_duration: - grpc_timeout_header_max: 600s - # core unary endpoints - - match: - prefix: "/org.dash.platform.dapi.v0.Core" - route: - cluster: core_and_platform - timeout: {{= it.platform.dapi.envoy.http.responseTimeout }} - # platform unary endpoints - - match: - prefix: "/org.dash.platform.dapi.v0.Platform" - route: - cluster: core_and_platform - timeout: {{= it.platform.dapi.envoy.http.responseTimeout }} - # configuration of the static responses of unsupported api versions - # core static response - - match: - safe_regex: - google_re2: { } - regex: "\/org\\.dash\\.platform\\.dapi\\.v[1-9]+\\.Core" - response_headers_to_add: - - header: - key: "Content-Type" - value: "application/grpc-web+proto" - - header: - key: "grpc-status" - value: "12" - - header: - key: "grpc-message" - value: "Specified service version is not supported" - direct_response: - status: 204 - # platform static response - - match: - safe_regex: - google_re2: { } - regex: "\/org\\.dash\\.platform\\.dapi\\.v[1-9]+\\.Platform" - response_headers_to_add: - - header: - key: "Content-Type" - value: "application/grpc-web+proto" - - header: - key: "grpc-status" - value: "12" - - header: - key: "grpc-message" - value: "Specified service version is not supported" - direct_response: - status: 204 - # JSON RPC endpoints - - match: - path: "/" - route: - cluster: json_rpc - cors: - allow_origin_string_match: - - prefix: "*" - allow_methods: GET, PUT, DELETE, POST, OPTIONS - allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout - max_age: "1728000" - expose_headers: custom-header-1,grpc-status,grpc-message - -static_resources: - listeners: - - name: grpc_and_json_rpc - address: - socket_address: - address: 0.0.0.0 - port_value: 10000 - {{? it.platform.dapi.envoy.ssl.provider === 'self-signed'}} - listener_filters: - - name: envoy.filters.listener.tls_inspector - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector - filter_chains: - - filter_chain_match: - transport_protocol: raw_buffer - filters: *filters - - filter_chain_match: - transport_protocol: tls - filters: *filters - transport_socket: - name: envoy.transport_sockets.tls - typed_config: - "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext - common_tls_context: - alpn_protocols: [ "h2, http/1.1" ] - tls_certificates: - - certificate_chain: - filename: "/etc/ssl/bundle.crt" - private_key: - filename: "/etc/ssl/private.key" - {{??}} - filter_chains: - filters: *filters - transport_socket: - name: envoy.transport_sockets.tls - typed_config: - "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext - common_tls_context: - alpn_protocols: [ "h2, http/1.1" ] - tls_certificates: - - certificate_chain: - filename: "/etc/ssl/bundle.crt" - private_key: - filename: "/etc/ssl/private.key" - {{?}} - clusters: - - name: core_and_platform - connect_timeout: {{= it.platform.dapi.envoy.http.connectTimeout }} - type: logical_dns - lb_policy: round_robin - typed_extension_protocol_options: - envoy.extensions.upstreams.http.v3.HttpProtocolOptions: - "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions - explicit_http_config: - http2_protocol_options: - connection_keepalive: - interval: 30s - timeout: 5s - load_assignment: - cluster_name: core_and_platform - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: dapi_api - port_value: 3005 - - name: tx_filter_stream - connect_timeout: {{= it.platform.dapi.envoy.http.connectTimeout }} - type: logical_dns - lb_policy: round_robin - typed_extension_protocol_options: - envoy.extensions.upstreams.http.v3.HttpProtocolOptions: - "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions - explicit_http_config: - http2_protocol_options: - connection_keepalive: - interval: 30s - timeout: 5s - load_assignment: - cluster_name: tx_filter_stream - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: dapi_tx_filter_stream - port_value: 3006 - - name: json_rpc - connect_timeout: {{= it.platform.dapi.envoy.http.connectTimeout }} - type: logical_dns - lb_policy: round_robin - load_assignment: - cluster_name: json_rpc - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: dapi_api - port_value: 3004 - -admin: - address: - socket_address: - address: 0.0.0.0 # For docker container only. Must be a local/private interface. - port_value: 8081 diff --git a/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot b/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot index d5572596640..9caf3e128bf 100644 --- a/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot +++ b/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot @@ -10,10 +10,6 @@ ### Main Base Config Options ### ####################################################################### -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy-app = "tcp://drive_abci:26658" - # A custom human readable name for this node {{?it.platform.drive.tenderdash.moniker}}moniker = "{{=it.platform.drive.tenderdash.moniker}}"{{?}} @@ -71,13 +67,38 @@ genesis-file = "config/genesis.json" # Path to the JSON file containing the private key to use for node authentication in the p2p protocol node-key-file = "config/node_key.json" -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - # If true, query the ABCI app on connecting to a new peer # so the app can decide if we should keep the connection or not filter-peers = false +####################################################### +### ABCI App Connection Options ### +####################################################### +[abci] +# TCP or UNIX socket address of the ABCI application, +# or routing rules for routed multi-app setup, +# or the name of an ABCI application compiled in with the Tendermint binary +# Example for routed multi-app setup: +# abci = "routed" +# address = "Info:socket:unix:///tmp/socket.1,Info:socket:unix:///tmp/socket.2,CheckTx:socket:unix:///tmp/socket.1,*:socket:unix:///tmp/socket.3" +address = "CheckTx:grpc:drive_abci:26670,*:socket:tcp://drive_abci:26658" +# Transport mechanism to connect to the ABCI application: socket | grpc | routed +transport = "routed" +# Maximum number of simultaneous connections to the ABCI application +# per each method. Map of a gRPC method name,like "echo", to the number of concurrent connections. +# Special value "*" can be used to set the default limit for methods not explicitly listed. +# +# Example: +# +# grpc-concurrency = [ +# { "*" = 10 }, +# { "echo" = 2 }, +# { "info" = 2 }, +#] +grpc-concurrency = [ + { "check_tx" = {{= it.platform.drive.tenderdash.mempool.maxConcurrentCheckTx }} }, +] + ####################################################### ### Priv Validator Configuration ### @@ -100,10 +121,10 @@ laddr = "" core-rpc-host = "core:{{= it.core.rpc.port}}" # Local Dash Core RPC Username -core-rpc-username = "{{= it.core.rpc.user}}" +core-rpc-username = "tenderdash" # Local Dash Core RPC Password -core-rpc-password = "{{= it.core.rpc.password}}" +core-rpc-password = "{{= it.core.rpc.users.tenderdash.password}}" # Path to the client certificate generated while creating needed files for secure connection. # If a remote validator address is provided but no certificate, the connection will be insecure @@ -193,6 +214,13 @@ event-log-max-items = 0 # See https://github.com/tendermint/tendermint/issues/3435 timeout-broadcast-tx-commit = "10s" +# Timeout of transaction broadcast to mempool; 0 to disable. +# +# This setting affects timeout of CheckTX operations used before +# adding transaction to the mempool. If the operation takes longer, +# the transaction is rejected with an error. +timeout-broadcast-tx = "{{=it.platform.drive.tenderdash.rpc.timeoutBroadcastTx}}" + # Maximum size of request body, in bytes max-body-bytes = 1000000 @@ -250,11 +278,11 @@ persistent-peers = "{{~it.platform.drive.tenderdash.p2p.persistentPeers :peer:in upnp = false # Maximum number of connections (inbound and outbound). -max-connections = 64 +max-connections = {{=it.platform.drive.tenderdash.p2p.maxConnections}} # Maximum number of connections reserved for outgoing # connections. Must be less than max-connections -max-outgoing-connections = 12 +max-outgoing-connections = {{=it.platform.drive.tenderdash.p2p.maxOutgoingConnections}} # Rate limits the number of incoming connection attempts per IP address. max-incoming-connection-attempts = 100 @@ -315,16 +343,46 @@ size = {{= it.platform.drive.tenderdash.mempool.size }} max-txs-bytes = {{= it.platform.drive.tenderdash.mempool.maxTxsBytes }} # Size of the cache (used to filter transactions we saw earlier) in transactions -cache-size = 10000 +cache-size = {{= it.platform.drive.tenderdash.mempool.cacheSize }} # Do not remove invalid transactions from the cache (default: false) # Set to true if it's not possible for any invalid transaction to become valid # again in the future. -keep-invalid-txs-in-cache = false +keep-invalid-txs-in-cache = true + +# Timeout of check TX operations received from other nodes, using p2p protocol. +# Use 0 to disable. +timeout-check-tx = "{{=it.platform.drive.tenderdash.mempool.timeoutCheckTx}}" + +# TxEnqueueTimeout defines how many nanoseconds new mempool transaction (received +# from other nodes) will wait when internal processing queue is full +# (most likely due to busy CheckTx execution).Once the timeout is reached, the transaction +# will be silently dropped. +# +# If set to 0, the timeout is disabled and transactions will wait indefinitely. +tx-enqueue-timeout = "{{=it.platform.drive.tenderdash.mempool.txEnqueueTimeout}}" + +# tx-send-rate-limit is the rate limit for sending transactions to peers, in transactions per second. +# If zero, the rate limiter is disabled. +# +# Default: 0 +tx-send-rate-limit = {{=it.platform.drive.tenderdash.mempool.txSendRateLimit}} + +# tx-recv-rate-limit is the rate limit for receiving transactions from peers, in transactions per second. +# If zero, the rate limiter is disabled. +# +# Default: 0 +tx-recv-rate-limit = {{=it.platform.drive.tenderdash.mempool.txRecvRateLimit}} + +# tx-recv-rate-punish-peer set to true means that when tx-recv-rate-limit is reached, the peer will be punished +# (disconnected). If set to false, the peer will be throttled (messages will be dropped). +# +# Default: false +tx-recv-rate-punish-peer = false # Maximum size of a single transaction. # NOTE: the max size of a tx transmitted over the network is {max-tx-bytes}. -max-tx-bytes = 1048576 +max-tx-bytes = 50000 # Maximum size of a batch of transactions to send to a peer # Including space needed by encoding (one varint per transaction). @@ -337,7 +395,7 @@ max-batch-bytes = 0 # Note, if ttl-num-blocks is also defined, a transaction will be removed if it # has existed in the mempool at least ttl-num-blocks number of blocks or if it's # insertion time into the mempool is beyond ttl-duration. -ttl-duration = "0s" +ttl-duration = "{{=it.platform.drive.tenderdash.mempool.ttlDuration}}" # ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction # can exist for in the mempool. @@ -345,7 +403,7 @@ ttl-duration = "0s" # Note, if ttl-duration is also defined, a transaction will be removed if it # has existed in the mempool at least ttl-num-blocks number of blocks or if # it's insertion time into the mempool is beyond ttl-duration. -ttl-num-blocks = 0 +ttl-num-blocks = {{=it.platform.drive.tenderdash.mempool.ttlNumBlocks}} ####################################################### ### State Sync Configuration Options ### diff --git a/packages/dashmate/templates/platform/dapi/envoy/_zerossl_validation.yaml.dot b/packages/dashmate/templates/platform/gateway/_zerossl_validation.yaml.dot similarity index 100% rename from packages/dashmate/templates/platform/dapi/envoy/_zerossl_validation.yaml.dot rename to packages/dashmate/templates/platform/gateway/_zerossl_validation.yaml.dot diff --git a/packages/dashmate/templates/platform/gateway/envoy.yaml.dot b/packages/dashmate/templates/platform/gateway/envoy.yaml.dot new file mode 100644 index 00000000000..4ee35dcfd27 --- /dev/null +++ b/packages/dashmate/templates/platform/gateway/envoy.yaml.dot @@ -0,0 +1,487 @@ +!ignore filters: &filters + - name: envoy.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: ingress_http + normalize_path: true + merge_slashes: true + use_remote_address: true + path_with_escaped_slashes_action: UNESCAPE_AND_REDIRECT + # Settings applied both to HTTP1 and HTTP2 + common_http_protocol_options: + # A single HTTP connection timeout. + max_connection_duration: 600s + # How long to keep the connection alive when there are no streams (requests). + idle_timeout: 300s + # Request (stream) timeout. + # HTTP2 support multiple streams (requests) per connection. + # For HTTP1 it applies for single request. + # This param is overwritten in specific routes. + max_stream_duration: 15s + # Reject malformed requests with headers containing underscores. + headers_with_underscores_action: REJECT_REQUEST + # HTTP2 specific settings + http2_protocol_options: + # As a side effect this field acts as a soft limit on the number of bytes Envoy will buffer per-stream in the + # QUIC stream send and receive buffers. Once the buffer reaches this pointer, watermark callbacks will fire + # to stop the flow of data to the stream buffers. So we reduce it from 16 MiB to 64 KiB + initial_stream_window_size: 65536 # 64 KiB + # The same but for connection-level flow-control + initial_connection_window_size: 1048576 # 1 MiB + # This option sets the maximum number of concurrent streams allowed for each connection. + # It means N requests can be in flight at the same time on a single connection. + max_concurrent_streams: {{= it.platform.gateway.listeners.dapiAndDrive.http2.maxConcurrentStreams }} + # Stream idle timeout + stream_idle_timeout: 15s +{{? it.platform.gateway.log.accessLogs }} + access_log: + {{~ it.platform.gateway.log.accessLogs :log }} + {{ loggerType = {file: 'file.v3.FileAccessLog', stdout: 'stream.v3.StdoutAccessLog', stderr: 'stream.v3.StderrAccessLog'}; }} + - name: envoy.access_loggers.{{=log.type}} + typed_config: + "@type": type.googleapis.com/envoy.extensions.access_loggers.{{=loggerType[log.type]}} + {{? log.type === 'file' }} + path: "/var/log/{{=log.path.split('/').reverse()[0]}}" + {{?? log.type === 'stream' }} + {{=log.destination}} + {{?}} + log_format: + {{? log.format === 'json' }} + json_format: + {{? log.template === null }} + timestamp: "%START_TIME%" + client: "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%" + protocol: "%PROTOCOL%" + method: "%REQ(:METHOD)%" + uri: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" + "http-status": "%RESPONSE_CODE%" + "grpc-status": "%GRPC_STATUS%" + "rx-bytes": "%BYTES_RECEIVED%" + "tx-bytes": "%BYTES_SENT%" + "response-flags": "%RESPONSE_FLAGS%" + duration: "%DURATION%" + {{??}} + {{ template = Object.entries(log.template); }} + {{~ template :entry }} + "{{=entry[0]}}": "{{=entry[1]}}" + {{~}} + {{?}} + {{??}} + text_format_source: + {{? log.template === null }} + inline_string: "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%\" %RESPONSE_CODE% %GRPC_STATUS% %RESPONSE_FLAGS% R:%BYTES_RECEIVED% S:%BYTES_SENT% D:%DURATION%\n" + {{??}} + inline_string: "{{=log.template}}\n" + {{?}} + {{?}} + {{~}} +{{?}} + http_filters: + # TODO: Introduce when stable https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/adaptive_concurrency_filter.html + {{? it.platform.gateway.rateLimiter.enabled}} + - name: envoy.filters.http.ratelimit + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit + domain: edge_proxy_per_ip + # The rate limit service timeout before the request is considered failed + timeout: 5s + # Reject a request if rate limit service is unavailable + failure_mode_deny: true + # Respond with RESOURCE_EXHAUSTED status code if request is rejected + rate_limited_as_resource_exhausted: true + rate_limit_service: + grpc_service: + envoy_grpc: + cluster_name: ratelimit_service + timeout: 0.5s + transport_api_version: V3 + {{?}} + - name: envoy.filters.http.grpc_web + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb + - name: envoy.filters.http.cors + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + route_config: + name: local_route + virtual_hosts: + - name: http_services + domains: [ "*" ] + routes: + # DAPI core streaming endpoints + - match: + prefix: "/org.dash.platform.dapi.v0.Core/subscribeTo" + route: + cluster: dapi_core_streams + idle_timeout: 300s + # Upstream response timeout + timeout: 600s + max_stream_duration: + # Entire stream/request timeout + max_stream_duration: 600s + grpc_timeout_header_max: 600s + # Other DAPI Core endpoints + - match: + prefix: "/org.dash.platform.dapi.v0.Core" + route: + cluster: dapi_api + # Upstream response timeout + timeout: 15s + # DAPI waitForStateTransitionResult endpoint with bigger timeout + - match: + path: "/org.dash.platform.dapi.v0.Platform/waitForStateTransitionResult" + route: + cluster: dapi_api + idle_timeout: {{= it.platform.gateway.listeners.dapiAndDrive.waitForStResultTimeout }} + # Upstream response timeout + timeout: {{= it.platform.gateway.listeners.dapiAndDrive.waitForStResultTimeout }} + max_stream_duration: + # Entire stream/request timeout + max_stream_duration: {{= it.platform.gateway.listeners.dapiAndDrive.waitForStResultTimeout }} + grpc_timeout_header_max: {{= it.platform.gateway.listeners.dapiAndDrive.waitForStResultTimeout }} + # DAPI getConsensusParams endpoint + - match: + path: "/org.dash.platform.dapi.v0.Platform/getConsensusParams" + route: + cluster: dapi_api + # Upstream response timeout + timeout: 10s + # DAPI broadcastStateTransition endpoint + - match: + path: "/org.dash.platform.dapi.v0.Platform/broadcastStateTransition" + route: + cluster: dapi_api + # Upstream response timeout + timeout: 10s + # getProofs endpoint only for internal use (DAPI -> Drive) + - match: + path: "/org.dash.platform.dapi.v0.Platform/getProofs" + response_headers_to_add: + - header: + key: "Content-Type" + value: "application/grpc-web+proto" + - header: + key: "grpc-status" + value: "12" + - header: + key: "grpc-message" + value: "getProofs endpoint is only for internal use" + direct_response: + status: 204 + # Drive gRPC endpoints + - match: + prefix: "/org.dash.platform.dapi.v0.Platform" + route: + cluster: drive_grpc + # Upstream response timeout + timeout: 10s + # Static responses of unsupported api versions + # core static response + - match: + safe_regex: + regex: "\/org\\.dash\\.platform\\.dapi\\.v[1-9]+\\." + response_headers_to_add: + - header: + key: "Content-Type" + value: "application/grpc-web+proto" + - header: + key: "grpc-status" + value: "12" + - header: + key: "grpc-message" + value: "Specified service version is not supported" + direct_response: + status: 204 + # JSON RPC endpoints + - match: + path: "/" + route: + cluster: dapi_json_rpc + # Upstream response timeout + timeout: 10s + {{? it.platform.gateway.rateLimiter.enabled }} + rate_limits: + - actions: + remote_address: {} + {{?}} + typed_per_filter_config: + envoy.filters.http.cors: + "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.CorsPolicy + allow_origin_string_match: + - prefix: "*" + allow_methods: GET, PUT, DELETE, POST, OPTIONS + allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout + max_age: "1728000" + expose_headers: custom-header-1,grpc-status,grpc-message + +static_resources: + listeners: + - name: dapi_and_drive + address: + socket_address: + address: 0.0.0.0 # For docker container only. Must be a local/private interface. + port_value: 10000 + {{? it.platform.gateway.ssl.provider === 'self-signed'}} + listener_filters: + - name: envoy.filters.listener.tls_inspector + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector + per_connection_buffer_limit_bytes: 32768 # 32 KiB + filter_chains: + - filter_chain_match: + transport_protocol: raw_buffer + filters: *filters + - filter_chain_match: + transport_protocol: tls + filters: *filters + transport_socket: + name: envoy.transport_sockets.tls + typed_config: + "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext + common_tls_context: + alpn_protocols: [ "h2, http/1.1" ] + tls_certificates: + - certificate_chain: + filename: "/etc/ssl/bundle.crt" + private_key: + filename: "/etc/ssl/private.key" + {{??}} + filter_chains: + filters: *filters + transport_socket: + name: envoy.transport_sockets.tls + typed_config: + "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext + common_tls_context: + alpn_protocols: [ "h2, http/1.1" ] + tls_certificates: + - certificate_chain: + filename: "/etc/ssl/bundle.crt" + private_key: + filename: "/etc/ssl/private.key" + {{?}} + {{? it.platform.gateway.metrics.enabled }} + # Forward /stats/prometheus (which is a part of admin endpoint) + # to a separate listener with default Prometheus path /metrics + - name: prometheus_metrics + address: + socket_address: + address: "0.0.0.0" + port_value: 9090 + filter_chains: + - filters: + - name: "envoy.http_connection_manager" + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: ingress_metrics + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: [ "*" ] + routes: + - match: + prefix: "/metrics" + route: + cluster: admin + prefix_rewrite: "/stats/prometheus" + http_filters: + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + {{?}} + clusters: + - name: dapi_api + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: + initial_stream_window_size: 65536 # 64 KiB + initial_connection_window_size: 1048576 # 1 MiB + circuit_breakers: + thresholds: + - priority: DEFAULT + # The maximum number of parallel requests + max_requests: {{= it.platform.gateway.upstreams.dapiApi.maxRequests }} + load_assignment: + cluster_name: dapi_api + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: dapi_api + port_value: 3005 + - name: dapi_core_streams + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: + initial_stream_window_size: 65536 # 64 KiB + initial_connection_window_size: 1048576 # 1 MiB + circuit_breakers: + thresholds: + - priority: DEFAULT + max_requests: {{= it.platform.gateway.upstreams.dapiCoreStreams.maxRequests }} + load_assignment: + cluster_name: dapi_core_streams + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: dapi_core_streams + port_value: 3006 + - name: dapi_json_rpc + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + circuit_breakers: + thresholds: + - priority: DEFAULT + # The maximum number of parallel connections + max_connections: {{= it.platform.gateway.upstreams.dapiJsonRpc.maxRequests }} + # The maximum number of parallel requests + max_requests: {{= it.platform.gateway.upstreams.dapiJsonRpc.maxRequests }} + load_assignment: + cluster_name: dapi_json_rpc + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: dapi_api + port_value: 3004 + - name: drive_grpc + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: + initial_stream_window_size: 65536 # 64 KiB + initial_connection_window_size: 1048576 # 1 MiB + circuit_breakers: + thresholds: + - priority: DEFAULT + # The maximum number of parallel requests. + max_requests: {{= it.platform.gateway.upstreams.driveGrpc.maxRequests }} + load_assignment: + cluster_name: drive_grpc + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: drive_abci + port_value: 26670 + {{? it.platform.gateway.rateLimiter.enabled }} + - name: ratelimit_service + type: STRICT_DNS + connect_timeout: 1s + protocol_selection: USE_CONFIGURED_PROTOCOL + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: {} + load_assignment: + cluster_name: ratelimit_service + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: gateway_rate_limiter + port_value: 8081 + {{?}} + {{? it.platform.gateway.metrics.enabled && it.platform.gateway.admin.enabled }} + - name: admin + connect_timeout: 0.25s + type: STATIC + load_assignment: + cluster_name: admin + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: "127.0.0.1" + port_value: 9901 + {{?}} + +{{? it.platform.gateway.admin.enabled }} +admin: + address: + socket_address: + address: 0.0.0.0 # For docker container only. Must be a local/private interface. + port_value: 9901 +{{?}} + +# Dynamically adjust limits based on memory usage and number of active connections +# TODO: We can use data provided by drive, tenderdash, or dapi to configure adaptive limits based on load +# https://www.envoyproxy.io/docs/envoy/v1.30.1/api-v3/extensions/resource_monitors/injected_resource/v3/injected_resource.proto +overload_manager: + refresh_interval: 0.25s + resource_monitors: + # Monitor heap size + - name: "envoy.resource_monitors.fixed_heap" + typed_config: + "@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig + # Maximum heap size in bytes. If the heap size exceeds this value, Envoy will take actions to reduce memory usage. + max_heap_size_bytes: {{= it.platform.gateway.maxHeapSizeInBytes }} + # Monitor the number of active downstream connections + - name: "envoy.resource_monitors.global_downstream_max_connections" + typed_config: + "@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig + max_active_downstream_connections: {{= it.platform.gateway.maxConnections }} + actions: + # Reduce the heap size by releasing free memory if the current heap size is 92% of the maximum heap size. + - name: "envoy.overload_actions.shrink_heap" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.92 + # Disable HTTP keepalive connections if the current heap size is 92% of the maximum heap size + # OR the number of active downstream connections is 95% of the maximum number of connections. + # Envoy will drain HTTP/2 and HTTP/3 connections using GOAWAY with a drain grace period. + # For HTTP/1, Envoy will set a drain timer to close the more idle recently used connections. + - name: "envoy.overload_actions.disable_http_keepalive" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.92 + - name: "envoy.resource_monitors.global_downstream_max_connections" + threshold: + value: 0.95 + # Stop accepting new HTTP connections in configured listeners if the number of active downstream + # connections reached the maximum. + # TODO: Use `envoy.load_shed_points.tcp_listener_accept` instead `envoy.overload_actions.stop_accepting_connections` + # when `loadshed_points` start to support `global_downstream_max_connections` monitor. + - name: "envoy.overload_actions.stop_accepting_connections" + triggers: + - name: "envoy.resource_monitors.global_downstream_max_connections" + threshold: + value: 1.0 + # Stop accepting new HTTP requests if the current heap size is 95% of the maximum heap size. + - name: "envoy.overload_actions.stop_accepting_requests" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.95 + loadshed_points: + # Stop accepting new TCP connections if the current heap size is 95% of the maximum heap size + - name: "envoy.load_shed_points.tcp_listener_accept" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.95 diff --git a/packages/dashmate/templates/platform/gateway/rate_limiter/rate_limiter.yaml.dot b/packages/dashmate/templates/platform/gateway/rate_limiter/rate_limiter.yaml.dot new file mode 100644 index 00000000000..4e40286adae --- /dev/null +++ b/packages/dashmate/templates/platform/gateway/rate_limiter/rate_limiter.yaml.dot @@ -0,0 +1,23 @@ +domain: edge_proxy_per_ip +descriptors: + - key: remote_address + rate_limit: + unit: {{= it.platform.gateway.rateLimiter.unit }} + requests_per_unit: {{= it.platform.gateway.rateLimiter.requestsPerUnit }} + + # Blacklisted IPs + {{~ it.platform.gateway.rateLimiter.blacklist :ip }} + - key: remote_address + value: {{= ip }} + rate_limit: + unit: second + requests_per_unit: 0 + {{~}} + + # Whitelisted IPs + {{~ it.platform.gateway.rateLimiter.whitelist :ip }} + - key: remote_address + value: {{= ip }} + rate_limit: + unlimited: true + {{~}} diff --git a/packages/dashmate/templates/platform/gateway/rate_limiter/statsd_exporter.yaml.dot b/packages/dashmate/templates/platform/gateway/rate_limiter/statsd_exporter.yaml.dot new file mode 100644 index 00000000000..31f16dd6a59 --- /dev/null +++ b/packages/dashmate/templates/platform/gateway/rate_limiter/statsd_exporter.yaml.dot @@ -0,0 +1,93 @@ +mappings: # Requires statsd exporter >= v0.6.0 since it uses the "drop" action. + - match: "ratelimit.service.rate_limit.*.*.near_limit" + name: "ratelimit_service_rate_limit_near_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + - match: "ratelimit.service.rate_limit.*.*.over_limit" + name: "ratelimit_service_rate_limit_over_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + - match: "ratelimit.service.rate_limit.*.*.total_hits" + name: "ratelimit_service_rate_limit_total_hits" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + - match: "ratelimit.service.rate_limit.*.*.within_limit" + name: "ratelimit_service_rate_limit_within_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + + - match: "ratelimit.service.rate_limit.*.*.*.near_limit" + name: "ratelimit_service_rate_limit_near_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + - match: "ratelimit.service.rate_limit.*.*.*.over_limit" + name: "ratelimit_service_rate_limit_over_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + - match: "ratelimit.service.rate_limit.*.*.*.total_hits" + name: "ratelimit_service_rate_limit_total_hits" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + - match: "ratelimit.service.rate_limit.*.*.*.within_limit" + name: "ratelimit_service_rate_limit_within_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + + - match: "ratelimit.service.call.should_rate_limit.*" + name: "ratelimit_service_should_rate_limit_error" + match_metric_type: counter + labels: + err_type: "$1" + + - match: "ratelimit_server.*.total_requests" + name: "ratelimit_service_total_requests" + match_metric_type: counter + labels: + grpc_method: "$1" + + - match: "ratelimit_server.*.response_time" + name: "ratelimit_service_response_time_seconds" + timer_type: histogram + labels: + grpc_method: "$1" + + - match: "ratelimit.service.config_load_success" + name: "ratelimit_service_config_load_success" + match_metric_type: counter + - match: "ratelimit.service.config_load_error" + name: "ratelimit_service_config_load_error" + match_metric_type: counter + + - match: "ratelimit.service.rate_limit.*.*.*.shadow_mode" + name: "ratelimit_service_rate_limit_shadow_mode" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + + # Enable below in production once you have the metrics you need + # - match: "." + # match_type: "regex" + # action: "drop" + # name: "dropped" diff --git a/packages/dashmate/test/e2e/localNetwork.spec.js b/packages/dashmate/test/e2e/localNetwork.spec.js index ca4bc23cf71..d1f8c7bb7b8 100644 --- a/packages/dashmate/test/e2e/localNetwork.spec.js +++ b/packages/dashmate/test/e2e/localNetwork.spec.js @@ -52,7 +52,7 @@ describe('Local Network', function main() { localConfig.set('dashmate.helper.api.port', 40000); localConfig.set('core.p2p.port', 40001); localConfig.set('core.rpc.port', 40002); - localConfig.set('platform.dapi.envoy.http.port', 40003); + localConfig.set('platform.gateway.listeners.dapiAndDrive.port', 40003); localConfig.set('platform.drive.tenderdash.p2p.port', 40004); localConfig.set('platform.drive.tenderdash.rpc.port', 40005); localConfig.set('platform.drive.tenderdash.pprof.port', 40006); diff --git a/packages/dashmate/test/e2e/testnetEvonode.spec.js b/packages/dashmate/test/e2e/testnetEvonode.spec.js index efabb10553e..1e8f90d5ab4 100644 --- a/packages/dashmate/test/e2e/testnetEvonode.spec.js +++ b/packages/dashmate/test/e2e/testnetEvonode.spec.js @@ -74,6 +74,7 @@ describe('Testnet Evonode', function main() { chainFilePath: certificatePath, privateFilePath: privKeyPath, }, + acceptUnmetSystemRequirements: true, isVerbose: true, }); @@ -93,7 +94,7 @@ describe('Testnet Evonode', function main() { config.set('dashmate.helper.api.port', 40000); config.set('core.p2p.port', 40001); config.set('core.rpc.port', 40002); - config.set('platform.dapi.envoy.http.port', 40003); + config.set('platform.gateway.listeners.dapiAndDrive.port', 40003); config.set('platform.drive.tenderdash.p2p.port', 40004); config.set('platform.drive.tenderdash.rpc.port', 40005); config.set('platform.drive.tenderdash.pprof.port', 40006); @@ -129,8 +130,8 @@ describe('Testnet Evonode', function main() { const coreRpcClient = createRpcClient({ host: config.get('core.rpc.host'), port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), }); waitForCoreData = waitForCoreDataFactory(coreRpcClient); @@ -147,6 +148,7 @@ describe('Testnet Evonode', function main() { await task.run({ isVerbose: true, + isSafe: true, }); // TODO: Assert all services are running @@ -230,6 +232,7 @@ describe('Testnet Evonode', function main() { await task.run({ isVerbose: true, + isSafe: true, }); // TODO: Assert all services are running diff --git a/packages/dashmate/test/e2e/testnetFullnode.spec.js b/packages/dashmate/test/e2e/testnetFullnode.spec.js index 147b9d820d2..12329f3407f 100644 --- a/packages/dashmate/test/e2e/testnetFullnode.spec.js +++ b/packages/dashmate/test/e2e/testnetFullnode.spec.js @@ -71,6 +71,7 @@ describe('Testnet Fullnode', function main() { chainFilePath: certificatePath, privateFilePath: privKeyPath, }, + acceptUnmetSystemRequirements: true, isVerbose: true, }); @@ -90,7 +91,7 @@ describe('Testnet Fullnode', function main() { config.set('dashmate.helper.api.port', 40000); config.set('core.p2p.port', 40001); config.set('core.rpc.port', 40002); - config.set('platform.dapi.envoy.http.port', 40003); + config.set('platform.gateway.listeners.dapiAndDrive.port', 40003); config.set('platform.drive.tenderdash.p2p.port', 40004); config.set('platform.drive.tenderdash.rpc.port', 40005); config.set('platform.drive.tenderdash.pprof.port', 40006); @@ -122,8 +123,8 @@ describe('Testnet Fullnode', function main() { const coreRpcClient = createRpcClient({ host: config.get('core.rpc.host'), port: config.get('core.rpc.port'), - user: config.get('core.rpc.user'), - pass: config.get('core.rpc.password'), + user: 'dashmate', + pass: config.get('core.rpc.users.dashmate.password'), }); waitForCoreData = waitForCoreDataFactory(coreRpcClient); diff --git a/packages/dashmate/test/unit/commands/config/set.spec.js b/packages/dashmate/test/unit/commands/config/set.spec.js index 94089cb9a77..67b8bef75a3 100644 --- a/packages/dashmate/test/unit/commands/config/set.spec.js +++ b/packages/dashmate/test/unit/commands/config/set.spec.js @@ -42,18 +42,18 @@ describe('Config set command', () => { const command = new ConfigSetCommand(); await command.runWithDependencies({ - option: 'platform.drive.abci.validatorSet.llmqType', + option: 'platform.drive.abci.validatorSet.quorum.llmqType', value: 107, }, flags, config); - expect(config.get('platform.drive.abci.validatorSet.llmqType')).to.equal(107); + expect(config.get('platform.drive.abci.validatorSet.quorum.llmqType')).to.equal(107); await command.runWithDependencies({ - option: 'platform.drive.abci.validatorSet.llmqType', + option: 'platform.drive.abci.validatorSet.quorum.llmqType', value: '107', }, flags, config); - expect(config.get('platform.drive.abci.validatorSet.llmqType')).to.equal(107); + expect(config.get('platform.drive.abci.validatorSet.quorum.llmqType')).to.equal(107); }); it('should allow setting booleans', async () => { diff --git a/packages/dashmate/test/unit/commands/update.spec.js b/packages/dashmate/test/unit/commands/update.spec.js index ecf95ad7a39..12536a22930 100644 --- a/packages/dashmate/test/unit/commands/update.spec.js +++ b/packages/dashmate/test/unit/commands/update.spec.js @@ -42,4 +42,44 @@ describe('Update command', () => { expect(mockGetServicesList).to.have.been.calledOnceWithExactly(config); expect(mockDocker.pull).to.have.been.calledOnceWith(mockServicesList[0].image); }); + + it('should update other services if one of them fails', async function it() { + const command = new UpdateCommand(); + mockDockerResponse = { status: 'Status: Image is up to date for' }; + mockServicesList = [{ name: 'fake', image: 'fake', title: 'FAKE' }, + { name: 'fake_docker_pull_error', image: 'fake_err_image', title: 'FAKE_ERROR' }]; + + // test docker.pull returns error + mockDocker = { + pull: this.sinon.stub() + .callsFake((image, cb) => (image === mockServicesList[1].image ? cb(new Error(), null) + : cb(false, mockDockerStream))), + }; + + let updateNode = updateNodeFactory(mockGetServicesList, mockDocker); + + await command.runWithDependencies({}, { format: 'json' }, mockDocker, config, updateNode); + + expect(mockGetServicesList).to.have.been.calledOnceWithExactly(config); + expect(mockDocker.pull.firstCall.firstArg).to.equal(mockServicesList[0].image); + expect(mockDocker.pull.secondCall.firstArg).to.equal(mockServicesList[1].image); + + // test docker.pull stream returns error + mockDocker = { pull: this.sinon.stub().callsFake((image, cb) => cb(false, mockDockerStream)) }; + mockDockerStream = { + on: this.sinon.stub().callsFake((channel, cb) => (channel === 'error' ? cb(new Error()) : null)), + }; + + // reset + mockGetServicesList = this.sinon.stub().callsFake(() => mockServicesList); + mockDocker = { pull: this.sinon.stub().callsFake((image, cb) => cb(false, mockDockerStream)) }; + + updateNode = updateNodeFactory(mockGetServicesList, mockDocker); + + await command.runWithDependencies({}, { format: 'json' }, mockDocker, config, updateNode); + + expect(mockGetServicesList).to.have.been.calledOnceWithExactly(config); + expect(mockDocker.pull.firstCall.firstArg).to.equal(mockServicesList[0].image); + expect(mockDocker.pull.secondCall.firstArg).to.equal(mockServicesList[1].image); + }); }); diff --git a/packages/dashmate/test/unit/commands/config/configFile/migrateConfigFileFactory.spec.js b/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js similarity index 82% rename from packages/dashmate/test/unit/commands/config/configFile/migrateConfigFileFactory.spec.js rename to packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js index dae0bbe8719..eb7efe51ae8 100644 --- a/packages/dashmate/test/unit/commands/config/configFile/migrateConfigFileFactory.spec.js +++ b/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; -import HomeDir from '../../../../../src/config/HomeDir.js'; -import { PACKAGE_ROOT_DIR } from '../../../../../src/constants.js'; -import createDIContainer from '../../../../../src/createDIContainer.js'; -import getConfigFileDataV0250 from '../../../../../src/test/fixtures/getConfigFileDataV0250.js'; +import HomeDir from '../../../../src/config/HomeDir.js'; +import { PACKAGE_ROOT_DIR } from '../../../../src/constants.js'; +import createDIContainer from '../../../../src/createDIContainer.js'; +import getConfigFileDataV0250 from '../../../../src/test/fixtures/getConfigFileDataV0250.js'; describe('migrateConfigFileFactory', () => { let mockConfigFileData; diff --git a/packages/dashmate/test/unit/status/scopes/platform.spec.js b/packages/dashmate/test/unit/status/scopes/platform.spec.js index 59053d5ae97..c3a1c28ff19 100644 --- a/packages/dashmate/test/unit/status/scopes/platform.spec.js +++ b/packages/dashmate/test/unit/status/scopes/platform.spec.js @@ -47,7 +47,7 @@ describe('getPlatformScopeFactory', () => { config = getConfigMock(this.sinon); - httpPort = config.get('platform.dapi.envoy.http.port'); + httpPort = config.get('platform.gateway.listeners.dapiAndDrive.port'); httpService = `${config.get('externalIp')}:${httpPort}`; p2pPort = config.get('platform.drive.tenderdash.p2p.port'); p2pService = `${config.get('externalIp')}:${p2pPort}`; @@ -63,6 +63,13 @@ describe('getPlatformScopeFactory', () => { it('should just work', async () => { mockDetermineDockerStatus.returns(DockerStatusEnum.running); mockRpcClient.mnsync.withArgs('status').returns({ result: { IsSynced: true } }); + mockRpcClient.getBlockchainInfo.returns({ + result: { + softforks: { + mn_rr: { active: true, height: 1337 }, + }, + }, + }); mockDockerCompose.isServiceRunning.returns(true); mockDockerCompose.execCommand.returns({ exitCode: 0, out: '' }); mockMNOWatchProvider.returns(Promise.resolve('OPEN')); @@ -84,6 +91,7 @@ describe('getPlatformScopeFactory', () => { const mockNetInfo = { n_peers: 6, listening: true }; const expectedScope = { + platformActivation: 'Activated (at height 1337)', coreIsSynced: true, httpPort, httpService, @@ -126,6 +134,80 @@ describe('getPlatformScopeFactory', () => { expect(scope).to.deep.equal(expectedScope); }); + it('should return platform syncing when it is catching up', async () => { + mockDetermineDockerStatus.returns(DockerStatusEnum.running); + mockRpcClient.mnsync.withArgs('status').returns({ result: { IsSynced: true } }); + mockRpcClient.getBlockchainInfo.returns({ + result: { + softforks: { + mn_rr: { active: true, height: 1337 }, + }, + }, + }); + mockDockerCompose.isServiceRunning.returns(true); + mockDockerCompose.execCommand.returns({ exitCode: 0, out: '' }); + mockMNOWatchProvider.returns(Promise.resolve('OPEN')); + + const mockStatus = { + node_info: { + version: '0', + network: 'test', + moniker: 'test', + }, + sync_info: { + catching_up: true, + latest_app_hash: 'DEADBEEF', + latest_block_height: 1337, + latest_block_hash: 'DEADBEEF', + latest_block_time: 1337, + }, + }; + const mockNetInfo = { n_peers: 6, listening: true }; + + const expectedScope = { + platformActivation: 'Activated (at height 1337)', + coreIsSynced: true, + httpPort, + httpService, + p2pPort, + p2pService, + rpcService, + httpPortState: PortStateEnum.OPEN, + p2pPortState: PortStateEnum.OPEN, + tenderdash: { + httpPortState: PortStateEnum.OPEN, + p2pPortState: PortStateEnum.OPEN, + dockerStatus: DockerStatusEnum.running, + serviceStatus: ServiceStatusEnum.syncing, + version: '0', + listening: true, + catchingUp: true, + latestBlockHash: 'DEADBEEF', + latestBlockHeight: 1337, + latestBlockTime: 1337, + latestAppHash: 'DEADBEEF', + peers: 6, + moniker: 'test', + network: 'test', + }, + drive: { + dockerStatus: DockerStatusEnum.running, + serviceStatus: ServiceStatusEnum.up, + }, + }; + + mockFetch + .onFirstCall() + .returns(Promise.resolve({ json: () => Promise.resolve(mockStatus) })) + .onSecondCall() + .returns(Promise.resolve({ json: () => Promise.resolve(mockNetInfo) })); + mockMNOWatchProvider.returns(Promise.resolve('OPEN')); + + const scope = await getPlatformScope(config); + + expect(scope).to.deep.equal(expectedScope); + }); + it('should return empty scope if error during request to core', async () => { mockRpcClient.mnsync.withArgs('status').throws(new Error()); mockDockerCompose.execCommand.returns({ exitCode: 0, out: '' }); @@ -136,6 +218,7 @@ describe('getPlatformScopeFactory', () => { .returns(DockerStatusEnum.running); const expectedScope = { + platformActivation: null, coreIsSynced: null, httpPort, httpService, @@ -147,8 +230,8 @@ describe('getPlatformScopeFactory', () => { tenderdash: { httpPortState: null, p2pPortState: null, - dockerStatus: DockerStatusEnum.running, - serviceStatus: ServiceStatusEnum.wait_for_core, + dockerStatus: null, + serviceStatus: null, version: null, listening: null, catchingUp: null, @@ -161,8 +244,8 @@ describe('getPlatformScopeFactory', () => { network: null, }, drive: { - dockerStatus: DockerStatusEnum.running, - serviceStatus: ServiceStatusEnum.wait_for_core, + dockerStatus: null, + serviceStatus: null, }, }; @@ -172,16 +255,22 @@ describe('getPlatformScopeFactory', () => { }); it('should return empty scope if core is not synced', async () => { - mockDockerCompose.isServiceRunning - .withArgs(config, 'drive_tenderdash') - .returns(true); + mockDockerCompose.isServiceRunning.withArgs(config, 'drive_tenderdash').returns(true); mockDetermineDockerStatus.withArgs(mockDockerCompose, config, 'drive_tenderdash').returns(DockerStatusEnum.running); mockDetermineDockerStatus.withArgs(mockDockerCompose, config, 'drive_abci').returns(DockerStatusEnum.running); mockRpcClient.mnsync.withArgs('status').returns({ result: { IsSynced: false } }); + mockRpcClient.getBlockchainInfo.returns({ + result: { + softforks: { + mn_rr: { active: true, height: 1337 }, + }, + }, + }); mockDockerCompose.execCommand.returns({ exitCode: 1, out: '' }); mockMNOWatchProvider.returns(Promise.resolve('OPEN')); const expectedScope = { + platformActivation: 'Activated (at height 1337)', coreIsSynced: false, httpPort, httpService, @@ -219,6 +308,13 @@ describe('getPlatformScopeFactory', () => { it('should return drive info if tenderdash is failed', async () => { mockRpcClient.mnsync.withArgs('status').returns({ result: { IsSynced: true } }); + mockRpcClient.getBlockchainInfo.returns({ + result: { + softforks: { + mn_rr: { active: true, height: 1337 }, + }, + }, + }); mockDockerCompose.isServiceRunning .withArgs(config, 'drive_tenderdash') .returns(true); @@ -230,6 +326,7 @@ describe('getPlatformScopeFactory', () => { mockMNOWatchProvider.returns(Promise.resolve('OPEN')); const expectedScope = { + platformActivation: 'Activated (at height 1337)', coreIsSynced: true, httpPort, httpService, @@ -267,6 +364,13 @@ describe('getPlatformScopeFactory', () => { it('should still return scope with tenderdash if drive is failed', async () => { mockRpcClient.mnsync.withArgs('status').returns({ result: { IsSynced: true } }); + mockRpcClient.getBlockchainInfo.returns({ + result: { + softforks: { + mn_rr: { active: true, height: 1337 }, + }, + }, + }); mockDockerCompose.isServiceRunning .withArgs(config, 'drive_tenderdash') .returns(true); @@ -300,6 +404,7 @@ describe('getPlatformScopeFactory', () => { .returns(Promise.resolve({ json: () => Promise.resolve(mockNetInfo) })); const expectedScope = { + platformActivation: 'Activated (at height 1337)', coreIsSynced: true, httpPort, httpService, @@ -337,6 +442,13 @@ describe('getPlatformScopeFactory', () => { it('should have error service status in case FetchError to tenderdash', async () => { mockRpcClient.mnsync.returns({ result: { IsSynced: true } }); + mockRpcClient.getBlockchainInfo.returns({ + result: { + softforks: { + mn_rr: { active: true, height: 1337 }, + }, + }, + }); mockDockerCompose.isServiceRunning .withArgs(config, 'drive_tenderdash') .returns(true); @@ -346,6 +458,7 @@ describe('getPlatformScopeFactory', () => { mockFetch.returns(Promise.reject(new Error('FetchError'))); const expectedScope = { + platformActivation: 'Activated (at height 1337)', coreIsSynced: true, httpPort, httpService, diff --git a/packages/dashpay-contract/.eslintrc b/packages/dashpay-contract/.eslintrc index e2c337296e8..00e5bd1251f 100644 --- a/packages/dashpay-contract/.eslintrc +++ b/packages/dashpay-contract/.eslintrc @@ -17,6 +17,7 @@ "mocha": true }, "globals": { - "expect": true + "expect": true, + "BigInt": true } } diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index b11c400e19d..92ae5794cd5 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +platform-version = { path = "../rs-platform-version" } +thiserror = "1.0.58" serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/dashpay-contract/lib/systemIds.js b/packages/dashpay-contract/lib/systemIds.js index 1ebde45f137..a95c1d468cb 100644 --- a/packages/dashpay-contract/lib/systemIds.js +++ b/packages/dashpay-contract/lib/systemIds.js @@ -1,4 +1,4 @@ module.exports = { - ownerId: '5PhRFRrWZc5Mj8NqtpHNXCmmEQkcZE8akyDkKhsUVD4k', + ownerId: '11111111111111111111111111111111', contractId: 'Bwr4WHCPz5rFVAD87RqTs3izo4zpzwsEdKPWUT1NS1C7', }; diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 28724419441..e157381cbff 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", @@ -9,8 +9,12 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/dashevo/dashpay-contract.git" + "url": "git+https://github.com/dashpay/platform.git" }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/dashpay-contract#readme", "author": "Dash Core Team", "contributors": [ { @@ -20,10 +24,6 @@ } ], "license": "MIT", - "bugs": { - "url": "https://github.com/dashevo/dashpay-contract/issues" - }, - "homepage": "https://github.com/dashevo/dashpay-contract#readme", "devDependencies": { "@dashevo/wasm-dpp": "workspace:*", "chai": "^4.3.10", diff --git a/packages/dashpay-contract/schema/dashpay.schema.json b/packages/dashpay-contract/schema/v1/dashpay.schema.json similarity index 92% rename from packages/dashpay-contract/schema/dashpay.schema.json rename to packages/dashpay-contract/schema/v1/dashpay.schema.json index c51ee225f03..4c14b244e7a 100644 --- a/packages/dashpay-contract/schema/dashpay.schema.json +++ b/packages/dashpay-contract/schema/v1/dashpay.schema.json @@ -27,6 +27,7 @@ "avatarUrl": { "type": "string", "format": "uri", + "minLength": 1, "maxLength": 2048, "position": 0 }, @@ -48,15 +49,23 @@ }, "publicMessage": { "type": "string", + "minLength": 1, "maxLength": 140, "position": 3 }, "displayName": { "type": "string", + "minLength": 1, "maxLength": 25, "position": 4 } }, + "minProperties": 1, + "dependentRequired": { + "avatarUrl": ["avatarHash", "avatarFingerprint"], + "avatarHash": ["avatarUrl", "avatarFingerprint"], + "avatarFingerprint": ["avatarUrl", "avatarHash"] + }, "required": [ "$createdAt", "$updatedAt" @@ -131,6 +140,8 @@ "additionalProperties": false }, "contactRequest": { + "documentsMutable": false, + "canBeDeleted": false, "requiresIdentityEncryptionBoundedKey": 2, "requiresIdentityDecryptionBoundedKey": 2, "type": "object", @@ -228,15 +239,11 @@ "minItems": 38, "maxItems": 102, "position": 6 - }, - "coreHeightCreatedAt": { - "type": "integer", - "minimum": 1, - "position": 7 } }, "required": [ "$createdAt", + "$createdAtCoreBlockHeight", "toUserId", "encryptedPublicKey", "senderKeyIndex", diff --git a/packages/dashpay-contract/src/error.rs b/packages/dashpay-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/dashpay-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/dashpay-contract/src/lib.rs b/packages/dashpay-contract/src/lib.rs index 737eba57c6f..f17916867c2 100644 --- a/packages/dashpay-contract/src/lib.rs +++ b/packages/dashpay-contract/src/lib.rs @@ -1,5 +1,9 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::Error; +use platform_version::version::PlatformVersion; use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ @@ -7,26 +11,28 @@ pub const ID_BYTES: [u8; 32] = [ 44, 24, 16, 146, 129, 193, 70, 231, 178, 113, 188, ]; -pub const OWNER_ID_BYTES: [u8; 32] = [ - 65, 63, 57, 243, 204, 9, 106, 71, 187, 2, 94, 221, 190, 127, 141, 114, 137, 209, 243, 50, 60, - 215, 90, 101, 229, 15, 115, 5, 44, 117, 182, 217, -]; - -pub mod document_types { - pub mod contact_request { - pub const NAME: &str = "contactRequest"; - - pub mod properties { - pub const TO_USER_ID: &str = "toUserId"; - pub const CORE_HEIGHT_CREATED_AT: &str = "coreHeightCreatedAt"; - pub const CORE_CHAIN_LOCKED_HEIGHT: &str = "coreChainLockedHeight"; - } - } -} +pub const OWNER_ID_BYTES: [u8; 32] = [0; 32]; pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!("../schema/dashpay.schema.json")) +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.dashpay { + 1 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "dashpay_contract::load_definitions".to_string(), + known_versions: vec![1], + received: version, + }), + } +} +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.dashpay { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "dashpay_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/dashpay-contract/src/v1/mod.rs b/packages/dashpay-contract/src/v1/mod.rs new file mode 100644 index 00000000000..4eaa7d76a7b --- /dev/null +++ b/packages/dashpay-contract/src/v1/mod.rs @@ -0,0 +1,17 @@ +use crate::error::Error; +use serde_json::Value; + +pub mod document_types { + pub mod contact_request { + pub const NAME: &str = "contactRequest"; + + pub mod properties { + pub const TO_USER_ID: &str = "toUserId"; + } + } +} + +pub fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!("../../schema/v1/dashpay.schema.json")) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/dashpay-contract/test/unit/schema.spec.js b/packages/dashpay-contract/test/unit/schema.spec.js index a5407a94b1b..611e3b43059 100644 --- a/packages/dashpay-contract/test/unit/schema.spec.js +++ b/packages/dashpay-contract/test/unit/schema.spec.js @@ -1,19 +1,28 @@ const { expect } = require('chai'); const crypto = require('crypto'); -const { DashPlatformProtocol, JsonSchemaError } = require('@dashevo/wasm-dpp'); +const { + DashPlatformProtocol, + JsonSchemaError, +} = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const schema = require('../../schema/dashpay.schema.json'); +const schema = require('../../schema/v1/dashpay.schema.json'); const whitepaperMasternodeText = 'Full nodes are servers running on a P2P network that allow peers to use them to receive updates about the events on the network. These nodes utilize significant amounts of traffic and other resources that incur a substantial cost. As a result, a steady decrease in the amount of these nodes has been observed for some time on the Bitcoin network and as a result, block propagation times have been upwards of 40 seconds. Many solutions have been proposed such as a new reward scheme by Microsoft Research and the Bitnodes incentive program'; const encoded32Chars = '4fafc98bbfe597f7ba2c9f767d52036d'; const encoded64Chars = '4fafc98bbfe597f7ba2c9f767d52036d2226175960a908e355e5c575711eb166'; -const expectJsonSchemaError = (validationResult) => { +const expectJsonSchemaError = (validationResult, count = 1, index = 0) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(1); + expect(errors) + .to + .have + .length(count); - const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + const error = validationResult.getErrors()[index]; + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -29,11 +38,14 @@ describe('Dashpay Contract', () => { ); identityId = await generateRandomIdentifier(); - contract = dpp.dataContract.create(identityId, schema); + contract = dpp.dataContract.create(identityId, BigInt(1), schema); }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, schema)).to.not.throw(); + expect(() => dpp.dataContract.create(identityId, BigInt(1), schema)) + .to + .not + .throw(); }); describe('Documents', () => { @@ -43,7 +55,6 @@ describe('Dashpay Contract', () => { beforeEach(() => { profileData = { displayName: 'Bob', - publicMessage: 'Hello Dashpay!', }; }); @@ -55,8 +66,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxLength'); - expect(error.instancePath).to.deep.equal('/displayName'); + expect(error.keyword) + .to + .equal('maxLength'); + expect(error.instancePath) + .to + .deep + .equal('/displayName'); }); }); @@ -68,113 +84,286 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxLength'); - expect(error.instancePath).to.deep.equal('/publicMessage'); + expect(error.keyword) + .to + .equal('maxLength'); + expect(error.instancePath) + .to + .deep + .equal('/publicMessage'); }); }); describe('avatarUrl', () => { it('should not be empty', async () => { - profileData.avatarUrl = ''; + profileData = { + avatarUrl: '', + avatarHash: Buffer.alloc(32), + avatarFingerprint: Buffer.alloc(8), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); + const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('format'); - expect(error.instancePath).to.deep.equal('/avatarUrl'); + expect(error.keyword) + .to + .equal('format'); + expect(error.instancePath) + .to + .deep + .equal('/avatarUrl'); }); it('should have less than 2048 chars length', async () => { - profileData.avatarUrl = `https://github.com/dashpay/dash/wiki/Whitepaper?text=${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}`; + profileData = { + avatarUrl: `https://github.com/dashpay/dash/wiki/Whitepaper?text=${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}${encodeURI(whitepaperMasternodeText)}`, + avatarHash: Buffer.alloc(32), + avatarFingerprint: Buffer.alloc(8), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxLength'); - expect(error.instancePath).to.deep.equal('/avatarUrl'); + expect(error.keyword) + .to + .equal('maxLength'); + expect(error.instancePath) + .to + .deep + .equal('/avatarUrl'); }); it('should be of type URL', async () => { - profileData.avatarUrl = 'notAUrl'; + profileData = { + avatarUrl: 'notAUrl', + avatarHash: Buffer.alloc(32), + avatarFingerprint: Buffer.alloc(8), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('format'); - expect(error.instancePath).to.deep.equal('/avatarUrl'); + expect(error.keyword) + .to + .equal('format'); + expect(error.instancePath) + .to + .deep + .equal('/avatarUrl'); + }); + + it('should be present if other avatar properties are present', async () => { + profileData = { + avatarHash: Buffer.alloc(32), + avatarFingerprint: Buffer.alloc(8), + }; + + const document = dpp.document.create(contract, identityId, 'profile', profileData); + const validationResult = document.validate(dpp.protocolVersion); + let error = expectJsonSchemaError(validationResult, 2, 0); + + expect(error.keyword) + .to + .equal('required'); + expect(error.params) + .to + .deep + .equal({ missingProperty: 'avatarUrl' }); + + error = expectJsonSchemaError(validationResult, 2, 1); + + expect(error.keyword) + .to + .equal('required'); + expect(error.params) + .to + .deep + .equal({ missingProperty: 'avatarUrl' }); }); }); describe('avatarHash', () => { it('should have minimum length of 32', async () => { - profileData.avatarHash = Buffer.alloc(0); + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarHash: Buffer.alloc(0), + avatarFingerprint: Buffer.alloc(8), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/avatarHash'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarHash'); }); it('should have maximum length of 32', async () => { - profileData.avatarHash = Buffer.alloc(33); + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarHash: Buffer.alloc(33), + avatarFingerprint: Buffer.alloc(8), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/avatarHash'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarHash'); }); it('should be of type array', async () => { - profileData.avatarHash = 'notAnArray'; + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarHash: 'notAnArray', + avatarFingerprint: Buffer.alloc(8), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); + const error = expectJsonSchemaError(validationResult, 2); + + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/avatarHash'); + }); + + it('should be present if other avatar properties are present', async () => { + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarFingerprint: Buffer.alloc(8), + }; + + const document = dpp.document.create(contract, identityId, 'profile', profileData); + const validationResult = document.validate(dpp.protocolVersion); + let error = expectJsonSchemaError(validationResult, 2, 0); + + expect(error.keyword) + .to + .equal('required'); + expect(error.params) + .to + .deep + .equal({ missingProperty: 'avatarHash' }); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/avatarHash'); + error = expectJsonSchemaError(validationResult, 2, 1); + + expect(error.keyword) + .to + .equal('required'); + expect(error.params) + .to + .deep + .equal({ missingProperty: 'avatarHash' }); }); }); describe('avatarFingerprint', () => { it('should have minimum length of 8', async () => { - profileData.avatarFingerprint = Buffer.alloc(0); + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarHash: Buffer.alloc(32), + avatarFingerprint: Buffer.alloc(0), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/avatarFingerprint'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarFingerprint'); }); it('should have maximum length of 8', async () => { - profileData.avatarFingerprint = Buffer.alloc(33); + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarHash: Buffer.alloc(32), + avatarFingerprint: Buffer.alloc(33), + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/avatarFingerprint'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarFingerprint'); }); it('should be of type array', async () => { - profileData.avatarFingerprint = 'notAnArray'; + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarHash: Buffer.alloc(32), + avatarFingerprint: 'notAnArray', + }; const document = dpp.document.create(contract, identityId, 'profile', profileData); const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); + const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/avatarFingerprint'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/avatarFingerprint'); + }); + + it('should be present if other avatar properties are present', async () => { + profileData = { + avatarUrl: 'https://github.com/dashpay/dash.jpg', + avatarHash: Buffer.alloc(32), + }; + + const document = dpp.document.create(contract, identityId, 'profile', profileData); + const validationResult = document.validate(dpp.protocolVersion); + let error = expectJsonSchemaError(validationResult, 2, 0); + + expect(error.keyword) + .to + .equal('required'); + expect(error.params) + .to + .deep + .equal({ missingProperty: 'avatarFingerprint' }); + + error = expectJsonSchemaError(validationResult, 2, 1); + + expect(error.keyword) + .to + .equal('required'); + expect(error.params) + .to + .deep + .equal({ missingProperty: 'avatarFingerprint' }); }); }); @@ -185,8 +374,25 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); + }); + + it('at least one of avatarUrl, publicMessage or displayName should be present', async () => { + const profile = dpp.document.create(contract, identityId, 'profile', { }); + + const result = profile.validate(dpp.protocolVersion); + + const error = expectJsonSchemaError(result); + + expect(error.keyword) + .to + .equal('minProperties'); }); it('should be valid', async () => { @@ -194,7 +400,10 @@ describe('Dashpay Contract', () => { const result = profile.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -218,8 +427,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('encToUserId'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('encToUserId'); }); it('should have exactly 32 chars length', async () => { @@ -229,8 +442,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.equal('/encToUserId'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .equal('/encToUserId'); }); it('should have more or 32 chars length', async () => { @@ -240,8 +457,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.equal('/encToUserId'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .equal('/encToUserId'); }); }); @@ -253,8 +474,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('rootEncryptionKeyIndex'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('rootEncryptionKeyIndex'); }); it('should not be less than 0', async () => { @@ -264,8 +489,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/rootEncryptionKeyIndex'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/rootEncryptionKeyIndex'); }); }); @@ -277,8 +506,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('privateData'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('privateData'); }); }); @@ -289,8 +522,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); }); @@ -315,8 +553,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('toUserId'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('toUserId'); }); }); @@ -328,8 +570,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('encryptedPublicKey'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('encryptedPublicKey'); }); }); @@ -341,8 +587,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('senderKeyIndex'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('senderKeyIndex'); }); it('should not be less than 0', async () => { @@ -352,8 +602,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/senderKeyIndex'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/senderKeyIndex'); }); }); @@ -365,8 +619,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('recipientKeyIndex'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('recipientKeyIndex'); }); it('should not be less than 0', async () => { @@ -376,8 +634,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/recipientKeyIndex'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/recipientKeyIndex'); }); }); @@ -389,8 +651,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/encryptedAccountLabel'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/encryptedAccountLabel'); }); it('should have maximum length of 80', async () => { @@ -400,8 +667,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/encryptedAccountLabel'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/encryptedAccountLabel'); }); it('should be of type array', async () => { @@ -409,10 +681,15 @@ describe('Dashpay Contract', () => { const document = dpp.document.create(contract, identityId, 'contactRequest', contactRequestData); const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); + const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/encryptedAccountLabel'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/encryptedAccountLabel'); }); }); @@ -424,8 +701,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/autoAcceptProof'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/autoAcceptProof'); }); it('should have maximum length of 102', async () => { @@ -435,8 +717,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/autoAcceptProof'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/autoAcceptProof'); }); it('should be of type array', async () => { @@ -444,10 +731,15 @@ describe('Dashpay Contract', () => { const document = dpp.document.create(contract, identityId, 'contactRequest', contactRequestData); const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); + const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/autoAcceptProof'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/autoAcceptProof'); }); }); @@ -459,8 +751,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('accountReference'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('accountReference'); }); it('should not be less than 0', async () => { @@ -470,21 +766,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/accountReference'); - }); - }); - - describe('coreHeightCreatedAt', () => { - it('should not be less than 1', async () => { - contactRequestData.coreHeightCreatedAt = -1; - - const document = dpp.document.create(contract, identityId, 'contactRequest', contactRequestData); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/coreHeightCreatedAt'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/accountReference'); }); }); @@ -495,8 +782,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); }); }); diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 655973b97a0..7e0b5441f9c 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,12 +1,14 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } withdrawals-contract = { path = "../withdrawals-contract" } masternode-reward-shares-contract = { path = "../masternode-reward-shares-contract" } diff --git a/packages/data-contracts/src/error.rs b/packages/data-contracts/src/error.rs new file mode 100644 index 00000000000..b9a5dd5d244 --- /dev/null +++ b/packages/data-contracts/src/error.rs @@ -0,0 +1,104 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} + +impl From for Error { + fn from(e: withdrawals_contract::Error) -> Self { + match e { + withdrawals_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + withdrawals_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} + +impl From for Error { + fn from(e: dashpay_contract::Error) -> Self { + match e { + dashpay_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + dashpay_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} + +impl From for Error { + fn from(e: dpns_contract::Error) -> Self { + match e { + dpns_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + dpns_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} + +impl From for Error { + fn from(e: masternode_reward_shares_contract::Error) -> Self { + match e { + masternode_reward_shares_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + masternode_reward_shares_contract::Error::InvalidSchemaJson(e) => { + Error::InvalidSchemaJson(e) + } + } + } +} + +impl From for Error { + fn from(e: feature_flags_contract::Error) -> Self { + match e { + feature_flags_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + feature_flags_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} diff --git a/packages/data-contracts/src/lib.rs b/packages/data-contracts/src/lib.rs index 460233bb221..f6761d1eb8c 100644 --- a/packages/data-contracts/src/lib.rs +++ b/packages/data-contracts/src/lib.rs @@ -1,14 +1,18 @@ -use serde_json::{Error, Value}; +mod error; +use serde_json::Value; + +use crate::error::Error; pub use dashpay_contract; pub use dpns_contract; pub use feature_flags_contract; pub use masternode_reward_shares_contract; use platform_value::Identifier; +use platform_version::version::PlatformVersion; pub use withdrawals_contract; #[repr(u8)] -#[derive(PartialEq, Eq, Clone, Copy, Debug, Ord, PartialOrd)] +#[derive(PartialEq, Eq, Clone, Copy, Debug, Ord, PartialOrd, Hash)] pub enum SystemDataContract { Withdrawals = 0, MasternodeRewards = 1, @@ -20,6 +24,7 @@ pub enum SystemDataContract { pub struct DataContractSource { pub id_bytes: [u8; 32], pub owner_id_bytes: [u8; 32], + pub version: u32, pub definitions: Option, pub document_schemas: Value, } @@ -36,37 +41,46 @@ impl SystemDataContract { Identifier::new(bytes) } /// Returns [DataContractSource] - pub fn source(self) -> Result { + pub fn source(self, platform_version: &PlatformVersion) -> Result { let data = match self { SystemDataContract::Withdrawals => DataContractSource { id_bytes: withdrawals_contract::ID_BYTES, owner_id_bytes: withdrawals_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: withdrawals_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.withdrawals as u32, + definitions: withdrawals_contract::load_definitions(platform_version)?, + document_schemas: withdrawals_contract::load_documents_schemas(platform_version)?, }, SystemDataContract::MasternodeRewards => DataContractSource { id_bytes: masternode_reward_shares_contract::ID_BYTES, owner_id_bytes: masternode_reward_shares_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: masternode_reward_shares_contract::load_documents_schemas()?, + version: platform_version + .system_data_contracts + .masternode_reward_shares as u32, + definitions: withdrawals_contract::load_definitions(platform_version)?, + document_schemas: masternode_reward_shares_contract::load_documents_schemas( + platform_version, + )?, }, SystemDataContract::FeatureFlags => DataContractSource { id_bytes: feature_flags_contract::ID_BYTES, owner_id_bytes: feature_flags_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: feature_flags_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.feature_flags as u32, + definitions: feature_flags_contract::load_definitions(platform_version)?, + document_schemas: feature_flags_contract::load_documents_schemas(platform_version)?, }, SystemDataContract::DPNS => DataContractSource { id_bytes: dpns_contract::ID_BYTES, owner_id_bytes: dpns_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: dpns_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.dpns as u32, + definitions: dpns_contract::load_definitions(platform_version)?, + document_schemas: dpns_contract::load_documents_schemas(platform_version)?, }, SystemDataContract::Dashpay => DataContractSource { id_bytes: dashpay_contract::ID_BYTES, owner_id_bytes: dashpay_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: dashpay_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.dashpay as u32, + definitions: dashpay_contract::load_definitions(platform_version)?, + document_schemas: dashpay_contract::load_documents_schemas(platform_version)?, }, }; diff --git a/packages/dpns-contract/.eslintrc b/packages/dpns-contract/.eslintrc index eec7881491c..cb6c7636b60 100644 --- a/packages/dpns-contract/.eslintrc +++ b/packages/dpns-contract/.eslintrc @@ -1,15 +1,18 @@ { - "extends": "airbnb-base", - "rules": { - "no-plusplus": 0, - "eol-last": [ - "error", - "always" - ], - "class-methods-use-this": "off", - "curly": [ - "error", - "all" - ] - } -} \ No newline at end of file + "extends": "airbnb-base", + "rules": { + "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "class-methods-use-this": "off", + "curly": [ + "error", + "all" + ] + }, + "globals": { + "BigInt": true + } +} diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index aee9162ccad..73cf5273753 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/dpns-contract/lib/systemIds.js b/packages/dpns-contract/lib/systemIds.js index cc6db980c1b..37ebef80fce 100644 --- a/packages/dpns-contract/lib/systemIds.js +++ b/packages/dpns-contract/lib/systemIds.js @@ -1,4 +1,5 @@ module.exports = { - ownerId: '4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF', + ownerId: '11111111111111111111111111111111', contractId: 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', + dashTldDocumentId: '6Zft8WEaEPzfbSVMsd6xCw3KgCqAQEneupSB9wx2EhJ', }; diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index a1ea82bda12..9e2592c38a5 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,7 +1,15 @@ { "name": "@dashevo/dpns-contract", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "A contract and helper scripts for DPNS DApp", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/dpns-contract#readme", "scripts": { "lint": "eslint .", "test": "yarn run test:unit", diff --git a/packages/dpns-contract/schema/dpns-contract-documents.json b/packages/dpns-contract/schema/v1/dpns-contract-documents.json similarity index 80% rename from packages/dpns-contract/schema/dpns-contract-documents.json rename to packages/dpns-contract/schema/v1/dpns-contract-documents.json index 9dae86a9936..723d522d91b 100644 --- a/packages/dpns-contract/schema/dpns-contract-documents.json +++ b/packages/dpns-contract/schema/v1/dpns-contract-documents.json @@ -1,5 +1,9 @@ { "domain": { + "documentsMutable": false, + "canBeDeleted": true, + "transferable": 1, + "tradeMode": 1, "type": "object", "indices": [ { @@ -12,22 +16,24 @@ "normalizedLabel": "asc" } ], - "unique": true - }, - { - "name": "dashIdentityId", - "properties": [ - { - "records.dashUniqueIdentityId": "asc" - } - ], - "unique": true + "unique": true, + "contested": { + "fieldMatches": [ + { + "field": "normalizedLabel", + "regexPattern": "^[a-zA-Z01-]{3,19}$" + } + ], + "resolution": 0, + "description": "If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name" + } }, { - "name": "dashAlias", + "name": "identityId", + "nullSearchable": false, "properties": [ { - "records.dashAliasIdentityId": "asc" + "records.identity": "asc" } ] } @@ -77,33 +83,19 @@ "records": { "type": "object", "properties": { - "dashUniqueIdentityId": { - "type": "array", - "byteArray": true, - "minItems": 32, - "maxItems": 32, - "position": 0, - "contentMediaType": "application/x.dash.dpp.identifier", - "description": "Identity ID to be used to create the primary name the Identity", - "$comment": "Must be equal to the document owner" - - }, - "dashAliasIdentityId": { + "identity": { "type": "array", "byteArray": true, "minItems": 32, "maxItems": 32, "position": 1, "contentMediaType": "application/x.dash.dpp.identifier", - "description": "Identity ID to be used to create alias names for the Identity", - "$comment": "Must be equal to the document owner" + "description": "Identifier name record that refers to an Identity" } }, "minProperties": 1, - "maxProperties": 1, "position": 5, - "additionalProperties": false, - "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`" + "additionalProperties": false }, "subdomainRules": { "type": "object", @@ -122,6 +114,9 @@ } }, "required": [ + "$createdAt", + "$updatedAt", + "$transferredAt", "label", "normalizedLabel", "normalizedParentDomainName", @@ -129,10 +124,15 @@ "records", "subdomainRules" ], + "transient": [ + "preorderSalt" + ], "additionalProperties": false, "$comment": "In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted" }, "preorder": { + "documentsMutable": false, + "canBeDeleted": true, "type": "object", "indices": [ { diff --git a/packages/dpns-contract/src/error.rs b/packages/dpns-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/dpns-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/dpns-contract/src/lib.rs b/packages/dpns-contract/src/lib.rs index 0321c3823c9..967bce9ae1e 100644 --- a/packages/dpns-contract/src/lib.rs +++ b/packages/dpns-contract/src/lib.rs @@ -1,37 +1,47 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::{Error, Value}; +use platform_version::version::PlatformVersion; +use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, ]; -pub const OWNER_ID_BYTES: [u8; 32] = [ - 48, 18, 193, 155, 152, 236, 0, 51, 173, 219, 54, 205, 100, 183, 245, 16, 103, 15, 42, 53, 26, - 67, 4, 181, 246, 153, 65, 68, 40, 110, 253, 172, -]; +pub const OWNER_ID_BYTES: [u8; 32] = [0; 32]; -pub mod document_types { - pub mod domain { - pub const NAME: &str = "domain"; +pub const DPNS_DASH_TLD_DOCUMENT_ID: [u8; 32] = [ + 215, 242, 197, 63, 70, 169, 23, 171, 110, 91, 57, 162, 215, 188, 38, 11, 100, 146, 137, 69, 55, + 68, 209, 224, 212, 242, 106, 141, 142, 255, 55, 207, +]; - pub mod properties { - pub const LABEL: &str = "label"; - pub const NORMALIZED_LABEL: &str = "normalizedLabel"; - pub const PARENT_DOMAIN_NAME: &str = "parentDomainName"; - pub const NORMALIZED_PARENT_DOMAIN_NAME: &str = "normalizedParentDomainName"; - pub const PREORDER_SALT: &str = "preorderSalt"; - pub const ALLOW_SUBDOMAINS: &str = "subdomainRules.allowSubdomains"; - pub const RECORDS: &str = "records"; - pub const DASH_UNIQUE_IDENTITY_ID: &str = "dashUniqueIdentityId"; - pub const DASH_ALIAS_IDENTITY_ID: &str = "dashAliasIdentityId"; - } - } -} +pub const DPNS_DASH_TLD_PREORDER_SALT: [u8; 32] = [ + 224, 181, 8, 197, 163, 104, 37, 162, 6, 105, 58, 31, 65, 74, 161, 62, 219, 236, 244, 60, 65, + 227, 199, 153, 234, 158, 115, 123, 79, 154, 162, 38, +]; pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); - -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!("../schema/dpns-contract-documents.json")) +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.withdrawals { + 1 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "dpns_contract::load_definitions".to_string(), + known_versions: vec![1], + received: version, + }), + } +} +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.withdrawals { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "dpns_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/dpns-contract/src/v1/mod.rs b/packages/dpns-contract/src/v1/mod.rs new file mode 100644 index 00000000000..fb2117245e0 --- /dev/null +++ b/packages/dpns-contract/src/v1/mod.rs @@ -0,0 +1,25 @@ +use crate::Error; +use serde_json::Value; + +pub mod document_types { + pub mod domain { + pub const NAME: &str = "domain"; + + pub mod properties { + pub const LABEL: &str = "label"; + pub const NORMALIZED_LABEL: &str = "normalizedLabel"; + pub const PARENT_DOMAIN_NAME: &str = "parentDomainName"; + pub const NORMALIZED_PARENT_DOMAIN_NAME: &str = "normalizedParentDomainName"; + pub const PREORDER_SALT: &str = "preorderSalt"; + pub const ALLOW_SUBDOMAINS: &str = "subdomainRules.allowSubdomains"; + pub const RECORDS: &str = "records"; + pub const DASH_UNIQUE_IDENTITY_ID: &str = "dashUniqueIdentityId"; + pub const DASH_ALIAS_IDENTITY_ID: &str = "dashAliasIdentityId"; + } + } +} + +pub fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!("../../schema/v1/dpns-contract-documents.json")) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/dpns-contract/test/unit/dpnsContract.spec.js b/packages/dpns-contract/test/unit/dpnsContract.spec.js index 148d79f51c2..cd57e61f180 100644 --- a/packages/dpns-contract/test/unit/dpnsContract.spec.js +++ b/packages/dpns-contract/test/unit/dpnsContract.spec.js @@ -1,19 +1,26 @@ const crypto = require('crypto'); const { - DashPlatformProtocol, JsonSchemaError, + DashPlatformProtocol, + JsonSchemaError, } = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); const { expect } = require('chai'); -const dpnsContractDocumentsSchema = require('../../schema/dpns-contract-documents.json'); +const dpnsContractDocumentsSchema = require('../../schema/v1/dpns-contract-documents.json'); const expectJsonSchemaError = (validationResult, errorCount = 1) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(errorCount); + expect(errors) + .to + .have + .length(errorCount); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -30,11 +37,14 @@ describe('DPNS Contract', () => { identityId = await generateRandomIdentifier(); - dataContract = dpp.dataContract.create(identityId, dpnsContractDocumentsSchema); + dataContract = dpp.dataContract.create(identityId, BigInt(1), dpnsContractDocumentsSchema); }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, dpnsContractDocumentsSchema)).to.not.throw(); + expect(() => dpp.dataContract.create(identityId, BigInt(1), dpnsContractDocumentsSchema)) + .to + .not + .throw(); }); describe('documents', () => { @@ -55,8 +65,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('saltedDomainHash'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('saltedDomainHash'); }); it('should not be empty', async () => { @@ -66,8 +80,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/saltedDomainHash'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/saltedDomainHash'); }); it('should be not less than 32 bytes', async () => { @@ -77,8 +96,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.equal('/saltedDomainHash'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .equal('/saltedDomainHash'); }); it('should be not longer than 32 bytes', async () => { @@ -88,8 +111,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.equal('/saltedDomainHash'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .equal('/saltedDomainHash'); }); }); @@ -100,8 +127,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); it('should be valid', async () => { @@ -109,7 +141,10 @@ describe('DPNS Contract', () => { const result = await preorder.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -123,7 +158,7 @@ describe('DPNS Contract', () => { normalizedParentDomainName: 'dash', preorderSalt: crypto.randomBytes(32), records: { - dashUniqueIdentityId: await generateRandomIdentifier(), + identity: await generateRandomIdentifier(), }, subdomainRules: { allowSubdomains: false, @@ -139,8 +174,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('label'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('label'); }); it('should follow pattern', async () => { @@ -150,8 +189,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/label'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/label'); }); it('should be longer than 3 chars', async () => { @@ -161,8 +204,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minLength'); - expect(error.instancePath).to.equal('/label'); + expect(error.keyword) + .to + .equal('minLength'); + expect(error.instancePath) + .to + .equal('/label'); }); it('should be less than 63 chars', async () => { @@ -172,8 +219,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/label'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/label'); }); }); @@ -185,8 +236,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('normalizedLabel'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('normalizedLabel'); }); it('should follow pattern', async () => { @@ -196,8 +251,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedLabel'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedLabel'); }); it('should be less than 63 chars', async () => { @@ -207,8 +266,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedLabel'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedLabel'); }); }); @@ -220,8 +283,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('normalizedParentDomainName'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('normalizedParentDomainName'); }); it('should be less than 190 chars', async () => { @@ -231,8 +298,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedParentDomainName'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedParentDomainName'); }); it('should follow pattern', async () => { @@ -242,8 +313,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedParentDomainName'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedParentDomainName'); }); }); @@ -255,8 +330,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('preorderSalt'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('preorderSalt'); }); it('should not be empty', async () => { @@ -267,8 +346,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/preorderSalt'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/preorderSalt'); }); it('should be not less than 32 bytes', async () => { @@ -278,8 +362,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.equal('/preorderSalt'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .equal('/preorderSalt'); }); it('should be not longer than 32 bytes', async () => { @@ -289,8 +377,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.equal('/preorderSalt'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .equal('/preorderSalt'); }); }); @@ -302,8 +394,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); it('should be valid', async () => { @@ -311,7 +408,10 @@ describe('DPNS Contract', () => { const result = await domain.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); describe('Records', () => { @@ -322,8 +422,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('records'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('records'); }); it('should not be empty', async () => { @@ -333,8 +437,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.instancePath).to.deep.equal('/records'); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.instancePath) + .to + .deep + .equal('/records'); }); it('should not have additional properties', async () => { @@ -346,67 +455,42 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.instancePath).to.equal('/records'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.instancePath) + .to + .equal('/records'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); describe('Dash Identity', () => { - it('should have either `dashUniqueIdentityId` or `dashAliasIdentityId`', async () => { - rawDomainDocument.records = { - dashUniqueIdentityId: identityId, - dashAliasIdentityId: identityId, - }; - - const document = dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword).to.equal('maxProperties'); - expect(error.instancePath).to.equal('/records'); - }); - - describe('dashUniqueIdentityId', () => { - it('should no less than 32 bytes', async () => { - rawDomainDocument.records = { - dashUniqueIdentityId: crypto.randomBytes(30), - }; - - expect(() => { - dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); - }); - - it('should no more than 32 bytes', async () => { - rawDomainDocument.records = { - dashUniqueIdentityId: crypto.randomBytes(64), - }; - - expect(() => { - dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); - }); - }); - - describe('dashAliasIdentityId', () => { + describe('identity record', () => { it('should no less than 32 bytes', async () => { rawDomainDocument.records = { - dashAliasIdentityId: crypto.randomBytes(30), + identity: crypto.randomBytes(30), }; expect(() => { dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); + }) + .to + .throw(); }); it('should no more than 32 bytes', async () => { rawDomainDocument.records = { - dashAliasIdentityId: crypto.randomBytes(64), + identity: crypto.randomBytes(64), }; expect(() => { dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); + }) + .to + .throw(); }); }); }); @@ -420,8 +504,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('subdomainRules'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('subdomainRules'); }); it('should not have additional properties', async () => { @@ -431,9 +519,16 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.instancePath).to.equal('/subdomainRules'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.instancePath) + .to + .equal('/subdomainRules'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); describe('allowSubdomains', () => { @@ -444,8 +539,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/subdomainRules/allowSubdomains'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/subdomainRules/allowSubdomains'); }); }); }); diff --git a/packages/feature-flags-contract/.eslintrc b/packages/feature-flags-contract/.eslintrc index eec7881491c..cb6c7636b60 100644 --- a/packages/feature-flags-contract/.eslintrc +++ b/packages/feature-flags-contract/.eslintrc @@ -1,15 +1,18 @@ { - "extends": "airbnb-base", - "rules": { - "no-plusplus": 0, - "eol-last": [ - "error", - "always" - ], - "class-methods-use-this": "off", - "curly": [ - "error", - "all" - ] - } -} \ No newline at end of file + "extends": "airbnb-base", + "rules": { + "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "class-methods-use-this": "off", + "curly": [ + "error", + "all" + ] + }, + "globals": { + "BigInt": true + } +} diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index c5933bfd89d..429fd81ea09 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/feature-flags-contract/lib/systemIds.js b/packages/feature-flags-contract/lib/systemIds.js index afe15e8b956..9d08aab9fff 100644 --- a/packages/feature-flags-contract/lib/systemIds.js +++ b/packages/feature-flags-contract/lib/systemIds.js @@ -1,4 +1,4 @@ module.exports = { - ownerId: 'H9sjb2bHG8t7gq5SwNdqzMWG7KR6sf3CbziFzthCkDD6', + ownerId: '11111111111111111111111111111111', contractId: 'HY1keaRK5bcDmujNCQq5pxNyvAiHHpoHQgLN5ppiu4kh', }; diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 14799d25208..534509fbdbc 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", @@ -8,6 +8,14 @@ "test": "yarn run test:unit", "test:unit": "mocha 'test/unit/**/*.spec.js'" }, + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/feature-flags-contract#readme", "contributors": [ { "name": "Ivan Shumkov", diff --git a/packages/feature-flags-contract/schema/feature-flags-documents.json b/packages/feature-flags-contract/schema/v1/feature-flags-documents.json similarity index 100% rename from packages/feature-flags-contract/schema/feature-flags-documents.json rename to packages/feature-flags-contract/schema/v1/feature-flags-documents.json diff --git a/packages/feature-flags-contract/src/error.rs b/packages/feature-flags-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/feature-flags-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/feature-flags-contract/src/lib.rs b/packages/feature-flags-contract/src/lib.rs index 50264845dfc..482edf67345 100644 --- a/packages/feature-flags-contract/src/lib.rs +++ b/packages/feature-flags-contract/src/lib.rs @@ -1,5 +1,9 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::Error; +use platform_version::version::PlatformVersion; use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ @@ -7,25 +11,28 @@ pub const ID_BYTES: [u8; 32] = [ 212, 255, 2, 91, 7, 90, 243, 68, 55, 152, 34, ]; -pub const OWNER_ID_BYTES: [u8; 32] = [ - 240, 1, 0, 176, 193, 227, 118, 43, 139, 193, 66, 30, 17, 60, 118, 178, 166, 53, 197, 147, 11, - 154, 191, 43, 51, 101, 131, 190, 89, 135, 167, 21, -]; - -pub mod document_types { - pub mod update_consensus_params { - pub const NAME: &str = "updateConsensusParams"; - - pub mod properties { - pub const PROPERTY_BLOCK_HEIGHT: &str = "height"; - pub const PROPERTY_ENABLE_AT_HEIGHT: &str = "enableAtHeight"; - } - } -} +pub const OWNER_ID_BYTES: [u8; 32] = [0; 32]; pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!("../schema/feature-flags-documents.json")) +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.withdrawals { + 1 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "feature_flags_contract::load_definitions".to_string(), + known_versions: vec![1], + received: version, + }), + } +} +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.withdrawals { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "feature_flags_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/feature-flags-contract/src/v1/mod.rs b/packages/feature-flags-contract/src/v1/mod.rs new file mode 100644 index 00000000000..43ccaf608a4 --- /dev/null +++ b/packages/feature-flags-contract/src/v1/mod.rs @@ -0,0 +1,18 @@ +use crate::error::Error; +use serde_json::Value; + +pub mod document_types { + pub mod update_consensus_params { + pub const NAME: &str = "updateConsensusParams"; + + pub mod properties { + pub const PROPERTY_BLOCK_HEIGHT: &str = "height"; + pub const PROPERTY_ENABLE_AT_HEIGHT: &str = "enableAtHeight"; + } + } +} + +pub fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!("../../schema/v1/feature-flags-documents.json")) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js b/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js index f06deea8d41..c15c4978db5 100644 --- a/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js +++ b/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js @@ -1,17 +1,26 @@ -const { DashPlatformProtocol, JsonSchemaError } = require('@dashevo/wasm-dpp'); +const { + DashPlatformProtocol, + JsonSchemaError, +} = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); const { expect } = require('chai'); const crypto = require('crypto'); -const featureFlagsContractDocumentsSchema = require('../../schema/feature-flags-documents.json'); +const featureFlagsContractDocumentsSchema = require('../../schema/v1/feature-flags-documents.json'); const expectJsonSchemaError = (validationResult, errorCount = 1) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(errorCount); + expect(errors) + .to + .have + .length(errorCount); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -28,12 +37,24 @@ describe('Feature Flags contract', () => { identityId = await generateRandomIdentifier(); - dataContract = dpp.dataContract.create(identityId, featureFlagsContractDocumentsSchema); + dataContract = dpp.dataContract.create( + identityId, + BigInt(1), + featureFlagsContractDocumentsSchema, + ); }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, featureFlagsContractDocumentsSchema)) - .to.not.throw(); + expect(() => { + dpp.dataContract.create( + identityId, + BigInt(1), + featureFlagsContractDocumentsSchema, + ); + }) + .to + .not + .throw(); }); describe('documents', () => { @@ -68,8 +89,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(3); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(3); }); it('should not have additional properties', async () => { @@ -86,8 +111,13 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); describe('enabledAtHeight', () => { @@ -98,8 +128,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('enableAtHeight'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('enableAtHeight'); }); it('should be integer', () => { @@ -109,8 +143,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', () => { @@ -120,8 +158,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -140,8 +182,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(1); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(1); }); describe('maxBytes', () => { @@ -154,8 +200,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -167,8 +217,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -182,8 +236,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -195,8 +253,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -205,7 +267,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -228,8 +293,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(1); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(1); }); describe('maxBytes', () => { @@ -242,8 +311,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -255,8 +328,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -270,8 +347,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -283,8 +364,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -297,8 +382,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('seconds'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('seconds'); }); it('should be integer', () => { @@ -308,8 +397,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', () => { @@ -319,8 +412,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -332,8 +429,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('nanos'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('nanos'); }); it('should be integer', () => { @@ -343,8 +444,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 0', () => { @@ -354,8 +459,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(0); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(0); }); }); }); @@ -365,7 +474,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -383,8 +495,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(1); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(1); }); describe('appVersion', () => { @@ -397,8 +513,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -410,8 +530,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -420,7 +544,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -429,7 +556,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); }); diff --git a/packages/js-dapi-client/docs/_sidebar.md b/packages/js-dapi-client/docs/_sidebar.md index 2d2059938e0..6f1d91a8ec7 100644 --- a/packages/js-dapi-client/docs/_sidebar.md +++ b/packages/js-dapi-client/docs/_sidebar.md @@ -7,13 +7,15 @@ - [.broadcastTransaction()](usage/application/core/broadcastTransaction.md) - [.generateToAddress()](usage/application/core/generateToAddress.md) - [.getBestBlockHash()](usage/application/core/getBestBlockHash.md) + - [.getBestBlockHeight()](usage/application/core/getBestBlockHeight.md) - [.getBlockByHash()](usage/application/core/getBlockByHash.md) - [.getBlockByHeight()](usage/application/core/getBlockByHeight.md) - [.getBlockHash()](usage/application/core/getBlockHash.md) - - [.getMnListDiff()](usage/application/core/getMnListDiff.md) - [.getStatus()](usage/application/core/getStatus.md) - [.getTransaction()](usage/application/core/getTransaction.md) - [.subscribeToTransactionsWithProofs()](usage/application/core/subscribeToTransactionsWithProofs.md) + - [.subscribeToBlockHeadersWithChainLocks()](usage/application/core/subscribeToBlockHeadersWithChainLocks.md) + - [.subscribeToMasternodeList()](usage/application/core/subscribeToMasternodeList.md) - Platform - [.broadcastStateTransition()](usage/application/platform/broadcastStateTransition.md) - [.getDataContract()](usage/application/platform/getDataContract.md) diff --git a/packages/js-dapi-client/docs/usage/application/core/generateToAddress.md b/packages/js-dapi-client/docs/usage/application/core/generateToAddress.md deleted file mode 100644 index e3eb7fafcfc..00000000000 --- a/packages/js-dapi-client/docs/usage/application/core/generateToAddress.md +++ /dev/null @@ -1,13 +0,0 @@ -**Usage**: `await client.core.generateToAddress(blockMumber, address, options)` -**Description**: Allow to broadcast a valid **signed** transaction to the network. -**Notes**: Will only works on regtest. - -Parameters: - -| parameters | type | required | Description | -|---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **blocksNumber** | Number | yes | A number of block to see generated on the regtest network | -| **address** | String | yes | The address that will receive the newly generated Dash | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise} - a set of generated blockhashes. diff --git a/packages/js-dapi-client/docs/usage/application/core/getBestBlockHeight.md b/packages/js-dapi-client/docs/usage/application/core/getBestBlockHeight.md new file mode 100644 index 00000000000..9a301c031e6 --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/getBestBlockHeight.md @@ -0,0 +1,10 @@ +**Usage**: `await client.core.getBestBlockHeight(options)` +**Description**: Allow to fetch the best (highest/latest block height) from the network + +Parameters: + +| parameters | type | required | Description | +|---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ | +| **options** | DAPIClientOptions | no | | + +Returns : {Promise} - The best block height diff --git a/packages/js-dapi-client/docs/usage/application/core/getMnListDiff.md b/packages/js-dapi-client/docs/usage/application/core/getMnListDiff.md deleted file mode 100644 index 9c1ee698ab0..00000000000 --- a/packages/js-dapi-client/docs/usage/application/core/getMnListDiff.md +++ /dev/null @@ -1,12 +0,0 @@ -**Usage**: `await client.core.getMnListDiff(baseBlockHash, blockHash, options)` -**Description**: Allow to fetch a specific block hash from its height - -Parameters: - -| parameters | type | required | Description | -|---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **baseBlockHash** | String | yes | hash or height of start block | -| **blockHash** | String | yes | hash or height of end block | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise} - The Masternode List Diff of the specified period diff --git a/packages/js-dapi-client/docs/usage/application/core/subscribeToBlockHeadersWithChainLocks.md b/packages/js-dapi-client/docs/usage/application/core/subscribeToBlockHeadersWithChainLocks.md new file mode 100644 index 00000000000..5c7b09201c6 --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/subscribeToBlockHeadersWithChainLocks.md @@ -0,0 +1,39 @@ +**Usage**: `await client.core.subscribeToBlockHeadersWithChainLocks(options = { count: 0 })`\ +**Description**: Returns a ClientReadableStream streaming of block headers and chainlocks. + + +Parameters: + +| parameters | type | required | Description | +|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | +| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | +| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | +| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | + +Returns : Promise|!grpc.web.ClientReadableStream + +Example : + +```js +const { BlockHeader, ChainLock } = require('@dashevo/dashcore-lib'); + +const stream = await client.subscribeToBlockHeadersWithChainLocks({ fromBlockHeight: 0 }); + +stream + .on('data', (response) => { + const rawHeaders = response.getBlockHeaders(); + const rawChainLock = response.getChainLock(); + + if (headers.length > 0) { + const headers = rawHeaders.map((rawHeader) => new BlockHeader(rawHeader)); + console.dir(headers); + } + + if (rawChainLock) { + const chainLock = new ChainLock(rawChainLock); + } + }) + .on('error', (err) => { + // do something with err + }); +``` diff --git a/packages/js-dapi-client/docs/usage/application/core/subscribeToMasternodeList.md b/packages/js-dapi-client/docs/usage/application/core/subscribeToMasternodeList.md new file mode 100644 index 00000000000..badcd7ff782 --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/subscribeToMasternodeList.md @@ -0,0 +1,24 @@ +**Usage**: `await client.core.subscribeToMasternodeList(options = {})`\ +**Description**: Returns a ClientReadableStream streaming of masternode list diffs ([DIP-4](https://github.com/dashpay/dips/blob/master/dip-0004.md)). As a first message it returns a diff from the first block to the current tip and a diff for each new chainlocked block. + +Returns : Promise|!grpc.web.ClientReadableStream + +Example : + +```js +const { SimplifiedMNList, SimplifiedMNListDiff } = require('@dashevo/dashcore-lib'); + +const stream = await client.subscribeToMasternodeList(); + +const list = new SimplifiedMNList(); + +stream + .on('data', (response) => { + const diffBuffer = Buffer.from(response.getMasternodeListDiff_asU8()); + const diff = new SimplifiedMNListDiff(diffBuffer); + list.applyDiff(diff); + }) + .on('error', (err) => { + // do something with err + }); +``` diff --git a/packages/js-dapi-client/docs/usage/application/core/subscribeToTransactionsWithProofs.md b/packages/js-dapi-client/docs/usage/application/core/subscribeToTransactionsWithProofs.md new file mode 100644 index 00000000000..7411b3eeedd --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/subscribeToTransactionsWithProofs.md @@ -0,0 +1,48 @@ +**Usage**: `await client.core.subscribeToTransactionsWithProofs(bloomFilter, options = { count: 0 })`\ +**Description**: For any provided bloomfilter, it will return a ClientReadableStream streaming the transaction matching the filter. + + +Parameters: + +| parameters | type | required | Description | +|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | +| **bloomFilter.vData** | Uint8Array/Array | yes | The filter itself is simply a bit field of arbitrary byte-aligned size. The maximum size is 36,000 bytes. | +| **bloomFilter.nHashFuncs** | Number | yes | The number of hash functions to use in this filter. The maximum value allowed in this field is 50. | +| **bloomFilter.nTweak** | Number | yes | A random value to add to the seed value in the hash function used by the bloom filter. | +| **bloomFilter.nFlags** | Number | yes | A set of flags that control how matched items are added to the filter. | +| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | +| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | +| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | + +Returns : Promise|!grpc.web.ClientReadableStream + +Example : + +```js +const { BloomFilter, Transaction, MerkleBlock } = require('@dashevo/dashcore-lib'); + +const filter = BloomFilter.create(1, 0.001); // A BloomFilter object +const stream = await client.subscribeToTransactionsWithProofs(filter, { fromBlockHeight: 0 }); + +stream + .on('data', (response) => { + const rawMerkleBlock = response.getRawMerkleBlock(); + const rawTransactions = response.getRawTransactions(); + + if (merkleBlock) { + const merkleBlock = new MerkleBlock(rawMerkleBlock); + console.dir(merkleBlock); + } + + if (transactions.length > 0) { + // tx are probabilistic, so you will have to verify it's yours + const transactions = transactions.getTransactionsList() + .map((tx) => new Transaction(Buffer.from(tx))); + + console.dir(transactions); + } + }) + .on('error', (err) => { + // do something with err + }); +``` diff --git a/packages/js-dapi-client/docs/usage/utils/subscribeToTransactionsWithProofs.md b/packages/js-dapi-client/docs/usage/utils/subscribeToTransactionsWithProofs.md deleted file mode 100644 index 96602882b5d..00000000000 --- a/packages/js-dapi-client/docs/usage/utils/subscribeToTransactionsWithProofs.md +++ /dev/null @@ -1,45 +0,0 @@ -**Usage**: `await client.core.subscribeToTransactionsWithProofs(bloomFilter, options = { count: 0 })`\ -**Description**: For any provided bloomfilter, it will return a ClientReadableStream streaming the transaction matching the filter. - - -Parameters: - -| parameters | type | required | Description | -|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **bloomFilter.vData** | Uint8Array/Array | yes | The filter itself is simply a bit field of arbitrary byte-aligned size. The maximum size is 36,000 bytes. | -| **bloomFilter.nHashFuncs** | Number | yes | The number of hash functions to use in this filter. The maximum value allowed in this field is 50. | -| **bloomFilter.nTweak** | Number | yes | A random value to add to the seed value in the hash function used by the bloom filter. | -| **bloomFilter.nFlags** | Number | yes | A set of flags that control how matched items are added to the filter. | -| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | -| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | -| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | - -Returns : Promise|!grpc.web.ClientReadableStream - -Example : - -```js -const filter; // A BloomFilter object -const stream = await client.subscribeToTransactionsWithProofs(filter, { fromBlockHeight: 0 }); - -stream - .on('data', (response) => { - const merkleBlock = response.getRawMerkleBlock(); - const transactions = response.getRawTransactions(); - - if (merkleBlock) { - const merkleBlockHex = Buffer.from(merkleBlock).toString('hex'); - } - - if (transactions) { - transactions.getTransactionsList() - .forEach((tx) => { - // tx are probabilistic, so you will have to verify it's yours - const tx = new Transaction(Buffer.from(tx)); - }); - } - }) - .on('error', (err) => { - // do something with err - }); -``` diff --git a/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js b/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js index 4b79bf158df..642da97dc79 100644 --- a/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js +++ b/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js @@ -19,14 +19,15 @@ const validateNumber = (value, name, min = NaN, max = NaN) => { /** * @typedef {createBlockHeadersProviderFromOptions} * @param {DAPIClientOptions} options + * @param logger * @param {CoreMethodsFacade} coreMethods * @returns {BlockHeadersProvider} */ -function createBlockHeadersProviderFromOptions(options, coreMethods) { +function createBlockHeadersProviderFromOptions(options, coreMethods, logger) { let blockHeadersProvider; if (options.blockHeadersProvider) { if (options.blockHeadersProviderOptions) { - throw new DAPIClientError("Can't use 'blockHeadersProviderOptions' with 'blockHeadersProvider' option"); + throw new DAPIClientError('Can\'t use \'blockHeadersProviderOptions\' with \'blockHeadersProvider\' option'); } blockHeadersProvider = options.blockHeadersProvider; @@ -37,6 +38,7 @@ function createBlockHeadersProviderFromOptions(options, coreMethods) { coreMethods.subscribeToBlockHeadersWithChainLocks, { maxRetriesOnError: -1, + logger, }, )({ fromBlockHeight, diff --git a/packages/js-dapi-client/lib/DAPIClient.js b/packages/js-dapi-client/lib/DAPIClient.js index d6561c24683..ed8c80d7533 100644 --- a/packages/js-dapi-client/lib/DAPIClient.js +++ b/packages/js-dapi-client/lib/DAPIClient.js @@ -34,11 +34,20 @@ class DAPIClient extends EventEmitter { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, ...options, }; - this.dapiAddressProvider = createDAPIAddressProviderFromOptions(this.options); + this.logger = logger.getForId( + this.options.loggerOptions.identifier, + this.options.loggerOptions.level, + ); + + this.dapiAddressProvider = createDAPIAddressProviderFromOptions({ + ...this.options, + logger: this.logger, + }); const grpcTransport = new GrpcTransport( createDAPIAddressProviderFromOptions, @@ -57,7 +66,6 @@ class DAPIClient extends EventEmitter { this.core = new CoreMethodsFacade(jsonRpcTransport, grpcTransport); this.platform = new PlatformMethodsFacade(grpcTransport); - this.logger = logger.getForId(this.options.loggerOptions.identifier); this.initBlockHeadersProvider(); } @@ -66,12 +74,30 @@ class DAPIClient extends EventEmitter { * @private */ initBlockHeadersProvider() { - this.blockHeadersProvider = createBlockHeadersProviderFromOptions(this.options, this.core); + this.blockHeadersProvider = createBlockHeadersProviderFromOptions( + this.options, + this.core, + this.logger, + ); this.blockHeadersProvider.on(BlockHeadersProvider.EVENTS.ERROR, (e) => { this.emit(EVENTS.ERROR, e); }); } + + /** + * Close all open connections + * @returns {Promise} + */ + async disconnect() { + // Stop block headers provider + await this.blockHeadersProvider.stop(); + + // Stop masternode list provider + if (this.dapiAddressProvider.smlProvider) { + await this.dapiAddressProvider.smlProvider.unsubscribe(); + } + } } DAPIClient.EVENTS = EVENTS; @@ -89,6 +115,7 @@ DAPIClient.EVENTS = EVENTS; * @property {boolean} [throwDeadlineExceeded] * @property {object} [loggerOptions] * @property {string} [loggerOptions.identifier] + * @property {string} [loggerOptions.level] * @property {BlockHeadersProvider} [blockHeadersProvider] * @property {BlockHeadersProviderOptions} [blockHeadersProviderOptions] */ diff --git a/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js index 8e40f8de296..3c1c6e20c6b 100644 --- a/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js +++ b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js @@ -1,27 +1,34 @@ const SimplifiedMNList = require('@dashevo/dashcore-lib/lib/deterministicmnlist/SimplifiedMNList'); const SimplifiedMNListDiff = require('@dashevo/dashcore-lib/lib/deterministicmnlist/SimplifiedMNListDiff'); +const cbor = require('cbor'); + +const logger = require('../logger'); class SimplifiedMasternodeListProvider { /** - * - * @param {JsonRpcTransport} jsonRpcTransport - JsonRpcTransport instance + * @param {Function} createStream - JsonRpcTransport instance * @param {object} [options] - Options - * @param {number} [options.updateInterval] * @param {string} [options.network] + * @param {string} [options.loggerOptions] */ - constructor(jsonRpcTransport, options = {}) { - this.jsonRpcTransport = jsonRpcTransport; - - this.options = { - updateInterval: 60000, - ...options, - }; - - this.simplifiedMNList = new SimplifiedMNList(undefined, this.options.network); + constructor(createStream, options = {}) { + this.createStream = createStream; + this.options = options; + this.logger = logger.getForId( + this.options.loggerOptions.identifier, + this.options.loggerOptions.level, + ); - this.lastUpdateDate = 0; + /** + * @type {ReconnectableStream} + */ + this.stream = undefined; + this.removeStreamListeners = () => {}; - this.baseBlockHash = SimplifiedMasternodeListProvider.NULL_HASH; + /** + * @type {SimplifiedMNList} + */ + this.simplifiedMNList = new SimplifiedMNList(undefined); } /** @@ -29,75 +36,183 @@ class SimplifiedMasternodeListProvider { * @returns {Promise} */ async getSimplifiedMNList() { - if (this.needsUpdate()) { - await this.updateMasternodeList(); + if (this.stream === undefined) { + await this.subscribeToMasternodeList(); } return this.simplifiedMNList; } /** - * Checks whether simplified masternode list needs update + * Subscribe to simplified masternodes list updates. No need to call it manually * @private - * @returns {boolean} + * @returns {Promise} */ - needsUpdate() { - return Date.now() - this.options.updateInterval > this.lastUpdateDate; - } - - /** - * Updates simplified masternodes list. No need to call it manually - * @private - */ - async updateMasternodeList() { - const diff = await this.getSimplifiedMNListDiff(); - - try { - this.simplifiedMNList.applyDiff(diff); - } catch (e) { - if (e.message === 'Cannot apply diff: previous blockHash needs to equal the new diff\'s baseBlockHash') { - this.reset(); - - await this.updateMasternodeList(); - - return; - } - - throw e; + async subscribeToMasternodeList() { + if (this.stream) { + this.logger.debug('Masternode list stream already started'); + return Promise.resolve(); } - this.baseBlockHash = diff.blockHash; + this.logger.debug('Starting masternode list stream'); - this.lastUpdateDate = Date.now(); - } + this.stream = await this.createStream(); - /** - * Fetches masternode diff from DAPI - * @private - * @returns {Promise} - */ - async getSimplifiedMNListDiff() { - const blockHash = await this.jsonRpcTransport.request('getBestBlockHash'); + let diffCount = 0; + let resolved = false; - const rawSimplifiedMNListDiff = await this.jsonRpcTransport.request( - 'getMnListDiff', - { baseBlockHash: this.baseBlockHash, blockHash }, - { addresses: [this.jsonRpcTransport.getLastUsedAddress()] }, - ); + const rejectDiff = (error) => { + this.logger.silly('Stream is cancelled due to error. Retrying...', { error }); - return new SimplifiedMNListDiff(rawSimplifiedMNListDiff, this.options.network); + this.stream.cancel(); + this.stream.retryOnError(error); + }; + + return new Promise((resolve, reject) => { + const errorHandler = (error) => { + this.stream = null; + + this.logger.error( + `Masternode list sync failed: ${error.message}`, + { error, diffCount }, + ); + + if (!resolved) { + reject(error); + resolved = true; + } + }; + + const dataHandler = (response) => { + diffCount += 1; + + if (diffCount === 1) { + this.logger.silly( + 'Full masternode list diff received', + { diffCount }, + ); + } else { + this.logger.silly( + 'Received masternode list diff', + { diffCount }, + ); + } + + let simplifiedMNListDiff; + let simplifiedMNListDiffObject; + let simplifiedMNListDiffBuffer; + try { + simplifiedMNListDiffBuffer = Buffer.from(response.getMasternodeListDiff_asU8()); + + simplifiedMNListDiffObject = cbor.decodeFirstSync(simplifiedMNListDiffBuffer); + + simplifiedMNListDiff = new SimplifiedMNListDiff( + simplifiedMNListDiffObject, + this.options.network, + ); + } catch (e) { + this.logger.warn( + `Can't parse masternode list diff: ${e.message}`, + { + diffCount, + network: this.options.network, + error: e, + simplifiedMNListDiffObject, + simplifiedMNListDiffBytes: simplifiedMNListDiffBuffer.toString('hex'), + }, + ); + + rejectDiff(e); + + return; + } + + this.logger.silly( + 'Parsed masternode list diff successfully', + { + diffCount, + blockHash: simplifiedMNListDiff.blockHash, + }, + ); + + try { + // Restart list when we receive a full diff + if (diffCount === 1) { + this.simplifiedMNList = new SimplifiedMNList(simplifiedMNListDiff); + } else { + this.simplifiedMNList.applyDiff(simplifiedMNListDiff); + } + } catch (e) { + this.logger.warn( + `Can't apply masternode list diff: ${e.message}`, + { + diffCount, + network: this.options.network, + blockHash: simplifiedMNListDiff.blockHash, + error: e, + simplifiedMNListDiff, + }, + ); + + rejectDiff(e); + } + + this.logger.silly( + 'Masternode list diff applied successfully', + { + diffCount, + blockHash: simplifiedMNListDiff.blockHash, + }, + ); + + if (!resolved) { + resolve(); + resolved = true; + } + }; + + const beforeReconnectHandler = () => { + diffCount = 0; + + this.logger.debug( + 'Restarting masternode list stream', + { diffCount }, + ); + }; + + const endHandler = () => { + this.logger.warn( + 'Masternode list sync stopped', + { diffCount }, + ); + + this.removeStreamListeners(); + this.stream = null; + }; + + this.stream.on('data', dataHandler); + this.stream.on('beforeReconnect', beforeReconnectHandler); + this.stream.on('error', errorHandler); + this.stream.on('end', endHandler); + + this.removeStreamListeners = () => { + this.stream.removeListener('data', dataHandler); + this.stream.removeListener('beforeReconnect', beforeReconnectHandler); + this.stream.removeListener('error', errorHandler); + this.stream.removeListener('end', endHandler); + }; + }); } /** - * Reset simplifiedMNList - * @private + * Unsubscribe from masternode list updates */ - reset() { - this.simplifiedMNList = new SimplifiedMNList(undefined, this.options.network); - - this.lastUpdateDate = 0; - - this.baseBlockHash = SimplifiedMasternodeListProvider.NULL_HASH; + unsubscribe() { + if (this.stream) { + this.removeStreamListeners(); + this.stream.cancel(); + this.stream = null; + } } } diff --git a/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/createMasternodeListStreamFactory.js b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/createMasternodeListStreamFactory.js new file mode 100644 index 00000000000..a80bd3feffb --- /dev/null +++ b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/createMasternodeListStreamFactory.js @@ -0,0 +1,50 @@ +const { + v0: { + MasternodeListRequest, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +const GrpcTransport = require('../transport/GrpcTransport/GrpcTransport'); +const createGrpcTransportError = require('../transport/GrpcTransport/createGrpcTransportError'); +const ReconnectableStream = require('../transport/ReconnectableStream'); + +/** + * Creates continues masternode list stream + * + * @param {createDAPIAddressProviderFromOptions} createDAPIAddressProviderFromOptions + * @param {ListDAPIAddressProvider} listDAPIAddressProvider + * @param {Object} options + * @return {function(...[*]): Promise} + */ +function createMasternodeListStreamFactory( + createDAPIAddressProviderFromOptions, + listDAPIAddressProvider, + options, +) { + const grpcTransport = new GrpcTransport( + createDAPIAddressProviderFromOptions, + listDAPIAddressProvider, + createGrpcTransportError, + options, + ); + + return ReconnectableStream + .create( + () => grpcTransport.request( + CorePromiseClient, + 'subscribeToMasternodeList', + new MasternodeListRequest(), + { + timeout: undefined, + autoReconnectInterval: 0, + }, + ), + { + maxRetriesOnError: -1, + logger: options.logger, + }, + ); +} + +module.exports = createMasternodeListStreamFactory; diff --git a/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js b/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js index 73403ddc240..5a02a00b58d 100644 --- a/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js +++ b/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js @@ -6,10 +6,7 @@ const ListDAPIAddressProvider = require('./ListDAPIAddressProvider'); const SimplifiedMasternodeListProvider = require('../SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider'); const SimplifiedMasternodeListDAPIAddressProvider = require('./SimplifiedMasternodeListDAPIAddressProvider'); - -const JsonRpcTransport = require('../transport/JsonRpcTransport/JsonRpcTransport'); -const requestJsonRpc = require('../transport/JsonRpcTransport/requestJsonRpc'); -const createJsonTransportError = require('../transport/JsonRpcTransport/createJsonTransportError'); +const createMasternodeListStreamFactory = require('../SimplifiedMasternodeListProvider/createMasternodeListStreamFactory'); const DAPIClientError = require('../errors/DAPIClientError'); @@ -82,17 +79,15 @@ function createDAPIAddressProviderFromOptions(options) { options, ); - const jsonRpcTransport = new JsonRpcTransport( + const createStream = createMasternodeListStreamFactory( createDAPIAddressProviderFromOptions, - requestJsonRpc, listDAPIAddressProvider, - createJsonTransportError, options, ); const smlProvider = new SimplifiedMasternodeListProvider( - jsonRpcTransport, - { network: options.network }, + createStream, + options, ); return new SimplifiedMasternodeListDAPIAddressProvider( diff --git a/packages/js-dapi-client/lib/logger/index.js b/packages/js-dapi-client/lib/logger/index.js index c59df018a9c..a06b34c145d 100644 --- a/packages/js-dapi-client/lib/logger/index.js +++ b/packages/js-dapi-client/lib/logger/index.js @@ -1,7 +1,9 @@ const util = require('util'); const winston = require('winston'); -const LOG_LEVEL = process.env.LOG_LEVEL || 'info'; +// TODO: Refactor to use params instead on envs + +const LOG_LEVEL = process.env.LOG_LEVEL || 'silent'; const LOG_TO_FILE = process.env.LOG_WALLET_TO_FILE || 'false'; // Log levels: @@ -36,6 +38,7 @@ const createLogger = (formats = [], id = '') => { const transports = [ new winston.transports.Console({ format, + silent: LOG_LEVEL === 'silent', }), ]; @@ -44,6 +47,7 @@ const createLogger = (formats = [], id = '') => { new winston.transports.File({ filename: `wallet${id !== '' ? `_${id}` : ''}`, format, + silent: LOG_LEVEL === 'silent', }), ); } diff --git a/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js b/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js index 306add3c953..4aa080cb272 100644 --- a/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js +++ b/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js @@ -1,14 +1,15 @@ const broadcastTransactionFactory = require('./broadcastTransactionFactory'); -const generateToAddressFactory = require('./generateToAddressFactory'); const getBestBlockHashFactory = require('./getBestBlockHashFactory'); +const getBestBlockHeightFactory = require('./getBestBlockHeightFactory'); const getBlockByHashFactory = require('./getBlockByHashFactory'); const getBlockByHeightFactory = require('./getBlockByHeightFactory'); const getBlockHashFactory = require('./getBlockHashFactory'); -const getMnListDiffFactory = require('./getMnListDiffFactory'); -const getStatusFactory = require('./getStatusFactory'); +const getBlockchainStatusFactory = require('./getBlockchainStatusFactory'); +const getMasternodeStatusFactory = require('./getMasternodeStatusFactory'); const getTransactionFactory = require('./getTransaction/getTransactionFactory'); const subscribeToTransactionsWithProofsFactory = require('./subscribeToTransactionsWithProofsFactory'); const subscribeToBlockHeadersWithChainLocksFactory = require('./subscribeToBlockHeadersWithChainLocksFactory'); +const subscribeToToMasternodeListFactory = require('./subscribeToMasternodeListFactory'); class CoreMethodsFacade { /** @@ -17,13 +18,13 @@ class CoreMethodsFacade { */ constructor(jsonRpcTransport, grpcTransport) { this.broadcastTransaction = broadcastTransactionFactory(grpcTransport); - this.generateToAddress = generateToAddressFactory(jsonRpcTransport); this.getBestBlockHash = getBestBlockHashFactory(jsonRpcTransport); + this.getBestBlockHeight = getBestBlockHeightFactory(grpcTransport); this.getBlockByHash = getBlockByHashFactory(grpcTransport); this.getBlockByHeight = getBlockByHeightFactory(grpcTransport); this.getBlockHash = getBlockHashFactory(jsonRpcTransport); - this.getMnListDiff = getMnListDiffFactory(jsonRpcTransport); - this.getStatus = getStatusFactory(grpcTransport); + this.getBlockchainStatus = getBlockchainStatusFactory(grpcTransport); + this.getMasternodeStatus = getMasternodeStatusFactory(grpcTransport); this.getTransaction = getTransactionFactory(grpcTransport); this.subscribeToTransactionsWithProofs = subscribeToTransactionsWithProofsFactory( grpcTransport, @@ -31,6 +32,9 @@ class CoreMethodsFacade { this.subscribeToBlockHeadersWithChainLocks = subscribeToBlockHeadersWithChainLocksFactory( grpcTransport, ); + this.subscribeToMasternodeList = subscribeToToMasternodeListFactory( + grpcTransport, + ); } } diff --git a/packages/js-dapi-client/lib/methods/core/generateToAddressFactory.js b/packages/js-dapi-client/lib/methods/core/generateToAddressFactory.js deleted file mode 100644 index c6eaea08860..00000000000 --- a/packages/js-dapi-client/lib/methods/core/generateToAddressFactory.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @param {JsonRpcTransport} jsonRpcTransport - * @returns {generateToAddress} - */ -function generateToAddressFactory(jsonRpcTransport) { - /** - * ONLY FOR TESTING PURPOSES WITH REGTEST. WILL NOT WORK ON TESTNET/LIVENET. - * @typedef {generateToAddress} - * @param {number} blocksNumber - Number of blocks to generate - * @param {string} address - The address that will receive the newly generated Dash - * @param {DAPIClientOptions} [options] - * @returns {Promise} - block hashes - */ - function generateToAddress(blocksNumber, address, options = {}) { - return jsonRpcTransport.request( - 'generateToAddress', - { blocksNumber, address }, - options, - ); - } - - return generateToAddress; -} - -module.exports = generateToAddressFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getBestBlockHeightFactory.js b/packages/js-dapi-client/lib/methods/core/getBestBlockHeightFactory.js new file mode 100644 index 00000000000..485010fd33b --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/getBestBlockHeightFactory.js @@ -0,0 +1,34 @@ +const { + v0: { + GetBestBlockHeightRequest, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * + * @param {GrpcTransport} grpcTransport + * @returns {getBestBlockHeight} + */ +function getBestBlockHeightFactory(grpcTransport) { + /** + * Returns block height of chain tip + * @typedef {getBestBlockHeight} + * @param {DAPIClientOptions} [options] + * @returns {Promise} + */ + async function getBestBlockHeight(options = {}) { + const response = await grpcTransport.request( + CorePromiseClient, + 'getBestBlockHeight', + new GetBestBlockHeightRequest(), + options, + ); + + return response.getHeight(); + } + + return getBestBlockHeight; +} + +module.exports = getBestBlockHeightFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getBlockchainStatusFactory.js b/packages/js-dapi-client/lib/methods/core/getBlockchainStatusFactory.js new file mode 100644 index 00000000000..22b1f88e573 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/getBlockchainStatusFactory.js @@ -0,0 +1,59 @@ +const { + v0: { + GetBlockchainStatusRequest, + GetBlockchainStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getBlockchainStatus} + */ +function getBlockchainStatusFactory(grpcTransport) { + /** + * Get Core chain status + * @typedef {getBlockchainStatus} + * @param {DAPIClientOptions} [options] + * @returns {Promise} + */ + async function getBlockchainStatus(options = {}) { + const getBlockchainStatusRequest = new GetBlockchainStatusRequest(); + + const response = await grpcTransport.request( + CorePromiseClient, + 'getBlockchainStatus', + getBlockchainStatusRequest, + options, + ); + + const responseObject = response.toObject(); + + // Respond with Buffers instead of base64 for binary fields + + if (response.getChain()) { + if (response.getChain() + .getBestBlockHash()) { + responseObject.chain.bestBlockHash = Buffer.from(response.getChain() + .getBestBlockHash()); + } + + if (response.getChain() + .getChainWork()) { + responseObject.chain.chainWork = Buffer.from(response.getChain() + .getChainWork()); + } + } + + // Respond with constant names instead of constant values + + responseObject.status = Object.keys(GetBlockchainStatusResponse.Status) + .find((key) => GetBlockchainStatusResponse.Status[key] === responseObject.status); + + return responseObject; + } + + return getBlockchainStatus; +} + +module.exports = getBlockchainStatusFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getMasternodeStatusFactory.js b/packages/js-dapi-client/lib/methods/core/getMasternodeStatusFactory.js new file mode 100644 index 00000000000..c0da5feef98 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/getMasternodeStatusFactory.js @@ -0,0 +1,45 @@ +const { + v0: { + GetMasternodeStatusRequest, + GetMasternodeStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getMasternodeStatus} + */ +function getMasternodeStatusFactory(grpcTransport) { + /** + * Get Core chain status + * @typedef {getMasternodeStatus} + * @param {DAPIClientOptions} [options] + * @returns {Promise} + */ + async function getMasternodeStatus(options = {}) { + const getMasternodeStatusRequest = new GetMasternodeStatusRequest(); + + const response = await grpcTransport.request( + CorePromiseClient, + 'getMasternodeStatus', + getMasternodeStatusRequest, + options, + ); + + const responseObject = response.toObject(); + + // Respond with constant names instead of constant values + + responseObject.status = Object.keys(GetMasternodeStatusResponse.Status) + .find((key) => GetMasternodeStatusResponse.Status[key] === responseObject.status); + + responseObject.proTxHash = Buffer.from(responseObject.proTxHash, 'base64'); + + return responseObject; + } + + return getMasternodeStatus; +} + +module.exports = getMasternodeStatusFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getMnListDiffFactory.js b/packages/js-dapi-client/lib/methods/core/getMnListDiffFactory.js deleted file mode 100644 index 88401fc52b2..00000000000 --- a/packages/js-dapi-client/lib/methods/core/getMnListDiffFactory.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @param {JsonRpcTransport} jsonRpcTransport - * @returns {getMnListDiff} - */ -function getMnListDiffFactory(jsonRpcTransport) { - /** - * Get deterministic masternodelist diff - * @typedef {getMnListDiff} - * @param {string} baseBlockHash - hash or height of start block - * @param {string} blockHash - hash or height of end block - * @param {DAPIClientOptions} [options] - * @returns {Promise} - */ - function getMnListDiff(baseBlockHash, blockHash, options = {}) { - return jsonRpcTransport.request('getMnListDiff', { baseBlockHash, blockHash }, options); - } - - return getMnListDiff; -} - -module.exports = getMnListDiffFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getStatusFactory.js b/packages/js-dapi-client/lib/methods/core/getStatusFactory.js deleted file mode 100644 index b631e6edfe7..00000000000 --- a/packages/js-dapi-client/lib/methods/core/getStatusFactory.js +++ /dev/null @@ -1,68 +0,0 @@ -const { - v0: { - GetStatusRequest, - GetStatusResponse, - CorePromiseClient, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {GrpcTransport} grpcTransport - * @returns {getStatus} - */ -function getStatusFactory(grpcTransport) { - /** - * Get Core chain status - * @typedef {getStatus} - * @param {DAPIClientOptions} [options] - * @returns {Promise} - */ - async function getStatus(options = {}) { - const getStatusRequest = new GetStatusRequest(); - - const response = await grpcTransport.request( - CorePromiseClient, - 'getStatus', - getStatusRequest, - options, - ); - - const responseObject = response.toObject(); - - // Respond with Buffers instead of base64 for binary fields - - if (response.getChain()) { - if (response.getChain().getBestBlockHash()) { - responseObject.chain.bestBlockHash = Buffer.from(response.getChain().getBestBlockHash()); - } - - if (response.getChain().getChainWork()) { - responseObject.chain.chainWork = Buffer.from(response.getChain().getChainWork()); - } - } - - if (response.getMasternode()) { - if (response.getMasternode().getProTxHash()) { - responseObject.masternode.proTxHash = Buffer.from(response.getMasternode().getProTxHash()); - } - } - - // Respond with constant names instead of constant values - - responseObject.status = Object.keys(GetStatusResponse.Status) - .find((key) => GetStatusResponse.Status[key] === responseObject.status); - - if (responseObject.masternode) { - responseObject.masternode.status = Object.keys(GetStatusResponse.Masternode.Status) - .find((key) => ( - GetStatusResponse.Masternode.Status[key] === responseObject.masternode.status - )); - } - - return responseObject; - } - - return getStatus; -} - -module.exports = getStatusFactory; diff --git a/packages/js-dapi-client/lib/methods/core/subscribeToMasternodeListFactory.js b/packages/js-dapi-client/lib/methods/core/subscribeToMasternodeListFactory.js new file mode 100644 index 00000000000..1d7ba8228a6 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/subscribeToMasternodeListFactory.js @@ -0,0 +1,46 @@ +const { + v0: { + MasternodeListRequest, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {subscribeToMasternodeList} + */ +function subscribeToMasternodeListFactory(grpcTransport) { + /** + * @typedef {subscribeToMasternodeList} + * @param {DAPIClientOptions & subscribeToMasternodeListOptions} [options] + * @returns { + * EventEmitter|!grpc.web.ClientReadableStream + * } + */ + async function subscribeToMasternodeList(options = { }) { + // eslint-disable-next-line no-param-reassign + options = { + // Override global timeout option + // and timeout for this method by default + timeout: undefined, + ...options, + }; + + const request = new MasternodeListRequest(); + + return grpcTransport.request( + CorePromiseClient, + 'subscribeToMasternodeList', + request, + options, + ); + } + + return subscribeToMasternodeList; +} + +/** + * @typedef {object} subscribeToMasternodeListOptions + */ + +module.exports = subscribeToMasternodeListFactory; diff --git a/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js b/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js index 5678042ecfc..bf1784291eb 100644 --- a/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js +++ b/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js @@ -29,7 +29,7 @@ function subscribeToTransactionsWithProofsFactory(grpcTransport) { * EventEmitter|!grpc.web.ClientReadableStream * } */ - async function subscribeToTransactionsWithProofs(bloomFilter, options = { }) { + async function subscribeToTransactionsWithProofs(bloomFilter, options = {}) { // eslint-disable-next-line no-param-reassign options = { count: 0, diff --git a/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js b/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js index ce90c4457b6..b9659142ec2 100644 --- a/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js +++ b/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js @@ -3,12 +3,17 @@ const getDataContractFactory = require('./getDataContract/getDataContractFactory const getDataContractHistoryFactory = require('./getDataContractHistory/getDataContractHistoryFactory'); const getDocumentsFactory = require('./getDocuments/getDocumentsFactory'); const getIdentityFactory = require('./getIdentity/getIdentityFactory'); -const getIdentitiesByPublicKeyHashesFactory = require('./getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory'); +const getIdentityByPublicKeyHashFactory = require('./getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory'); +const getIdentitiesContractKeysFactory = require('./getIdentitiesContractKeys/getIdentitiesContractKeysFactory'); const waitForStateTransitionResultFactory = require('./waitForStateTransitionResult/waitForStateTransitionResultFactory'); const getConsensusParamsFactory = require('./getConsensusParams/getConsensusParamsFactory'); const getEpochsInfoFactory = require('./getEpochsInfo/getEpochsInfoFactory'); const getProtocolVersionUpgradeVoteStatusFactory = require('./getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory'); const getProtocolVersionUpgradeStateFactory = require('./getProtocolVersionUpgradeState/getProtocolVersionUpgradeStateFactory'); +const getIdentityContractNonceFactory = require('./getIdentityContractNonce/getIdentityContractNonceFactory'); +const getIdentityNonceFactory = require('./getIdentityNonce/getIdentityNonceFactory'); +const getIdentityKeysFactory = require('./getIdentityKeys/getIdentityKeysFactory'); +const getTotalCreditsInPlatformFactory = require('./getTotalCreditsInPlatform/getTotalCreditsInPlatformFactory'); class PlatformMethodsFacade { /** @@ -20,7 +25,8 @@ class PlatformMethodsFacade { this.getDataContractHistory = getDataContractHistoryFactory(grpcTransport); this.getDocuments = getDocumentsFactory(grpcTransport); this.getIdentity = getIdentityFactory(grpcTransport); - this.getIdentitiesByPublicKeyHashes = getIdentitiesByPublicKeyHashesFactory(grpcTransport); + this.getIdentityByPublicKeyHash = getIdentityByPublicKeyHashFactory(grpcTransport); + this.getIdentitiesContractKeys = getIdentitiesContractKeysFactory(grpcTransport); this.waitForStateTransitionResult = waitForStateTransitionResultFactory(grpcTransport); this.getConsensusParams = getConsensusParamsFactory(grpcTransport); this.getEpochsInfo = getEpochsInfoFactory(grpcTransport); @@ -28,6 +34,10 @@ class PlatformMethodsFacade { grpcTransport, ); this.getProtocolVersionUpgradeState = getProtocolVersionUpgradeStateFactory(grpcTransport); + this.getIdentityContractNonce = getIdentityContractNonceFactory(grpcTransport); + this.getIdentityNonce = getIdentityNonceFactory(grpcTransport); + this.getIdentityKeys = getIdentityKeysFactory(grpcTransport); + this.getTotalCreditsInPlatform = getTotalCreditsInPlatformFactory(grpcTransport); } } diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.js deleted file mode 100644 index 18b6198fb43..00000000000 --- a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.js +++ /dev/null @@ -1,46 +0,0 @@ -const AbstractResponse = require('../response/AbstractResponse'); - -class GetIdentitiesByPublicKeyHashesResponse extends AbstractResponse { - /** - * @param {Buffer[]} identities - * @param {Metadata} metadata - * @param {Proof} [proof] - */ - constructor(identities, metadata, proof = undefined) { - super(metadata, proof); - - this.identities = identities; - } - - /** - * @returns {Buffer[]} - */ - getIdentities() { - return this.identities; - } - - /** - * @param proto - * @returns {GetIdentitiesByPublicKeyHashesResponse} - */ - static createFromProto(proto) { - const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(proto); - - const identitiesList = proto.getV0().getIdentities(); - - return new GetIdentitiesByPublicKeyHashesResponse( - identitiesList !== undefined - ? identitiesList.getIdentityEntriesList() - .map((identity) => { - const value = identity.getValue(); - // TODO: rework to return whole `identity.getValue()` instead of inner getValue() - return value && Buffer.from(value.getValue()); - }) - : [], - metadata, - proof, - ); - } -} - -module.exports = GetIdentitiesByPublicKeyHashesResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js deleted file mode 100644 index 0580db39189..00000000000 --- a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js +++ /dev/null @@ -1,65 +0,0 @@ -const { - v0: { - PlatformPromiseClient, - GetIdentitiesByPublicKeyHashesRequest, - }, -} = require('@dashevo/dapi-grpc'); - -const GetIdentitiesByPublicKeyHashesResponse = require('./GetIdentitiesByPublicKeyHashesResponse'); -const InvalidResponseError = require('../response/errors/InvalidResponseError'); - -/** - * @param {GrpcTransport} grpcTransport - * @returns {getIdentitiesByPublicKeyHashes} - */ -function getIdentitiesByPublicKeyHashesFactory(grpcTransport) { - /** - * Fetch the identities by public key hashes - * @typedef {getIdentitiesByPublicKeyHashes} - * @param {Buffer[]} publicKeyHashes - * @param {DAPIClientOptions & {prove: boolean}} [options] - * @returns {Promise} - */ - async function getIdentitiesByPublicKeyHashes(publicKeyHashes, options = {}) { - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const getIdentitiesByPublicKeyHashesRequest = new GetIdentitiesByPublicKeyHashesRequest(); - getIdentitiesByPublicKeyHashesRequest.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList( - publicKeyHashes, - ).setProve(!!options.prove), - ); - - let lastError; - - // TODO: simple retry before the dapi versioning is properly implemented - for (let i = 0; i < 3; i += 1) { - try { - // eslint-disable-next-line no-await-in-loop - const getIdentitiesByPublicKeyHashesResponse = await grpcTransport.request( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - getIdentitiesByPublicKeyHashesRequest, - options, - ); - - return GetIdentitiesByPublicKeyHashesResponse - .createFromProto(getIdentitiesByPublicKeyHashesResponse); - } catch (e) { - if (e instanceof InvalidResponseError) { - lastError = e; - } else { - throw e; - } - } - } - - // If we made it past the cycle it means that the retry didn't work, - // and we're throwing the last error encountered - throw lastError; - } - - return getIdentitiesByPublicKeyHashes; -} - -module.exports = getIdentitiesByPublicKeyHashesFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.js new file mode 100644 index 00000000000..4fd843f6f92 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.js @@ -0,0 +1,65 @@ +const { Identifier } = require('@dashevo/wasm-dpp'); +const AbstractResponse = require('../response/AbstractResponse'); + +class GetIdentitiesContractKeysResponse extends AbstractResponse { + /** + * @param {object} identitiesKeys + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identitiesKeys, metadata, proof = undefined) { + super(metadata, proof); + + this.identitiesKeys = identitiesKeys; + } + + /** + * @returns {object} + */ + getIdentitiesKeys() { + return this.identitiesKeys; + } + + /** + * @param proto + * @returns {GetIdentitiesContractKeysResponse} + */ + static createFromProto(proto) { + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(proto); + + const identitiesKeys = proto.getV0().getIdentitiesKeys(); + + let identitiesKeysMap = {}; + if (identitiesKeys) { + const keysEntries = identitiesKeys.getEntriesList(); + + identitiesKeysMap = keysEntries.reduce((acc, entry) => { + const identityId = Identifier.from(Buffer.from(entry.getIdentityId())).toString(); + if (!acc[identityId]) { + acc[identityId] = {}; + } + + entry.getKeysList().forEach((key) => { + const purpose = key.getPurpose(); + if (!acc[identityId][purpose]) { + // eslint-disable-next-line no-param-reassign + acc[identityId][purpose] = []; + } + + // eslint-disable-next-line no-param-reassign + acc[identityId][purpose] = acc[identityId][purpose].concat(key.getKeysBytesList()); + }, {}); + + return acc; + }, {}); + } + + return new GetIdentitiesContractKeysResponse( + identitiesKeysMap, + metadata, + proof, + ); + } +} + +module.exports = GetIdentitiesContractKeysResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.js new file mode 100644 index 00000000000..47140bfe0cc --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.js @@ -0,0 +1,93 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentitiesContractKeysRequest, + }, +} = require('@dashevo/dapi-grpc'); +const { IdentityPublicKey } = require('@dashevo/wasm-dpp'); + +const GetIdentitiesContractKeysResponse = require('./GetIdentitiesContractKeysResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentitiesContractKeys} + */ +function getIdentitiesContractKeysFactory(grpcTransport) { + /** + * Fetch the identities by public key hashes + * @typedef {getIdentitiesContractKeys} + * @param {Buffer[]} identitiesIds + * @param {Buffer} contractId + * @param {IdentityPublicKey.PURPOSES[]} keyPurposes + * @param {string | null} documentTypeName + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentitiesContractKeys( + identitiesIds, + contractId, + keyPurposes, + documentTypeName = null, + options = {}, + ) { + const { GetIdentitiesContractKeysRequestV0 } = GetIdentitiesContractKeysRequest; + const getIdentitiesContractKeysRequest = new GetIdentitiesContractKeysRequest(); + + // eslint-disable-next-line no-param-reassign + identitiesIds = identitiesIds.map((id) => { + if (Buffer.isBuffer(id)) { + // eslint-disable-next-line no-param-reassign + id = Buffer.from(id); + } + + return id; + }); + + if (Buffer.isBuffer(contractId)) { + // eslint-disable-next-line no-param-reassign + contractId = Buffer.from(contractId); + } + + getIdentitiesContractKeysRequest.setV0( + new GetIdentitiesContractKeysRequestV0() + .setProve(!!options.prove) + .setIdentitiesIdsList(identitiesIds) + .setContractId(contractId) + .setPurposesList(keyPurposes) + .setDocumentTypeName(documentTypeName), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentitiesContractKeysResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + getIdentitiesContractKeysRequest, + options, + ); + + return GetIdentitiesContractKeysResponse + .createFromProto(getIdentitiesContractKeysResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentitiesContractKeys; +} + +module.exports = getIdentitiesContractKeysFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.js new file mode 100644 index 00000000000..86f97aecfe7 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.js @@ -0,0 +1,40 @@ +const AbstractResponse = require('../response/AbstractResponse'); + +class GetIdentityByPublicKeyHashResponse extends AbstractResponse { + /** + * @param {Buffer} identities + * @param identity + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identity, metadata, proof = undefined) { + super(metadata, proof); + + this.identity = identity; + } + + /** + * @returns {Buffer[]} + */ + getIdentity() { + return this.identity; + } + + /** + * @param proto + * @returns {GetIdentityByPublicKeyHashResponse} + */ + static createFromProto(proto) { + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(proto); + + const identity = proto.getV0().getIdentity(); + + return new GetIdentityByPublicKeyHashResponse( + Buffer.from(identity), + metadata, + proof, + ); + } +} + +module.exports = GetIdentityByPublicKeyHashResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.js new file mode 100644 index 00000000000..ed3ca1fca7e --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.js @@ -0,0 +1,64 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityByPublicKeyHashRequest, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityByPublicKeyHashResponse = require('./GetIdentityByPublicKeyHashResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityByPublicKeyHash} + */ +function getIdentityByPublicKeyHashFactory(grpcTransport) { + /** + * Fetch the identity by public key hash + * @typedef {getIdentityByPublicKeyHash} + * @param {Buffer} publicKeyHash + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityByPublicKeyHash(publicKeyHash, options = {}) { + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const getIdentityByPublicKeyHashRequest = new GetIdentityByPublicKeyHashRequest(); + getIdentityByPublicKeyHashRequest.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityByPublicKeyHashResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + getIdentityByPublicKeyHashRequest, + options, + ); + + return GetIdentityByPublicKeyHashResponse + .createFromProto(getIdentityByPublicKeyHashResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityByPublicKeyHash; +} + +module.exports = getIdentityByPublicKeyHashFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse.js new file mode 100644 index 00000000000..e04d6aaafa5 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse.js @@ -0,0 +1,49 @@ +const AbstractResponse = require('../response/AbstractResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +const IDENTITY_CONTRACT_NONCE_VALUE_FILTER = 0xFFFFFFFFFF; + +class GetIdentityContractNonceResponse extends AbstractResponse { + /** + * @param {number} identityContractNonce + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identityContractNonce, metadata, proof = undefined) { + super(metadata, proof); + + this.identityContractNonce = identityContractNonce; + } + + /** + * @returns {number} + */ + getIdentityContractNonce() { + return this.identityContractNonce; + } + + /** + * @param proto + * @returns {GetIdentityContractNonceResponse} + */ + static createFromProto(proto) { + // eslint-disable-next-line + const identityContractNonce = proto.getV0() + .getIdentityContractNonce() & IDENTITY_CONTRACT_NONCE_VALUE_FILTER; + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( + proto, + ); + + if ((typeof identityContractNonce === 'undefined' || identityContractNonce === null) && !proof) { + throw new InvalidResponseError('Contract nonce data is not defined'); + } + + return new GetIdentityContractNonceResponse( + identityContractNonce, + metadata, + proof, + ); + } +} + +module.exports = GetIdentityContractNonceResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.js new file mode 100644 index 00000000000..59aec51dc87 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.js @@ -0,0 +1,81 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityContractNonceRequest, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityContractNonceResponse = require('./GetIdentityContractNonceResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityContractNonce} + */ +function getIdentityContractNonceFactory(grpcTransport) { + /** + * Fetch the version upgrade votes status + * @typedef {getIdentityContractNonce} + * @param {Buffer} identityId + * @param {Buffer} contractId + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityContractNonce(identityId, contractId, options = {}) { + const { + GetIdentityContractNonceRequestV0, + } = GetIdentityContractNonceRequest; + + // eslint-disable-next-line max-len + const getIdentityContractNonceRequest = new GetIdentityContractNonceRequest(); + + if (Buffer.isBuffer(identityId)) { + // eslint-disable-next-line no-param-reassign + identityId = Buffer.from(identityId); + } + + if (Buffer.isBuffer(contractId)) { + // eslint-disable-next-line no-param-reassign + contractId = Buffer.from(contractId); + } + + getIdentityContractNonceRequest.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityContractNonceResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityContractNonce', + getIdentityContractNonceRequest, + options, + ); + + return GetIdentityContractNonceResponse + .createFromProto(getIdentityContractNonceResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityContractNonce; +} + +module.exports = getIdentityContractNonceFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse.js new file mode 100644 index 00000000000..de377cfdfb5 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse.js @@ -0,0 +1,52 @@ +const AbstractResponse = require('../response/AbstractResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +class GetIdentityKeysResponse extends AbstractResponse { + /** + * @param {number} identityKeys + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identityKeys, metadata, proof = undefined) { + super(metadata, proof); + + this.identityKeys = identityKeys; + } + + /** + * @returns {number} + */ + getIdentityKeys() { + return this.identityKeys; + } + + /** + * @param proto + * @returns {GetIdentityKeysResponse} + */ + static createFromProto(proto) { + // eslint-disable-next-line + const keys = proto.getV0().getKeys(); + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( + proto, + ); + + let identityKeys = []; + if ((typeof keys === 'undefined' || keys === null) && !proof) { + throw new InvalidResponseError('Identity keys are not defined'); + } else if (!proof) { + identityKeys = keys.getKeysBytesList(); + if ((typeof identityKeys === 'undefined' || identityKeys === null) && !proof) { + throw new InvalidResponseError('Identity keys are not defined'); + } + } + + return new GetIdentityKeysResponse( + identityKeys, + metadata, + proof, + ); + } +} + +module.exports = GetIdentityKeysResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js new file mode 100644 index 00000000000..68b20db334e --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js @@ -0,0 +1,78 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityKeysRequest, + KeyRequestType, + SpecificKeys, + }, +} = require('@dashevo/dapi-grpc'); +const { UInt32Value } = require('google-protobuf/google/protobuf/wrappers_pb'); + +const GetIdentityKeysResponse = require('./GetIdentityKeysResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityKeys} + */ +function getIdentityKeysFactory(grpcTransport) { + /** + * Fetch the version upgrade votes status + * @typedef {getIdentityKeys} + * @param {Buffer} identityId + * @param {number[]} keyIds + * @param {number} limit + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityKeys(identityId, keyIds, limit = 100, options = {}) { + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const getIdentityKeysRequest = new GetIdentityKeysRequest(); + + if (Buffer.isBuffer(identityId)) { + // eslint-disable-next-line no-param-reassign + identityId = Buffer.from(identityId); + } + + getIdentityKeysRequest.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType() + .setSpecificKeys(new SpecificKeys().setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([limit])) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityKeysResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityKeys', + getIdentityKeysRequest, + options, + ); + + return GetIdentityKeysResponse + .createFromProto(getIdentityKeysResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityKeys; +} + +module.exports = getIdentityKeysFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse.js new file mode 100644 index 00000000000..a490a1390b5 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse.js @@ -0,0 +1,49 @@ +const AbstractResponse = require('../response/AbstractResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +const IDENTITY_NONCE_VALUE_FILTER = 0xFFFFFFFFFF; + +class GetIdentityNonceResponse extends AbstractResponse { + /** + * @param {number} identityNonce + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identityNonce, metadata, proof = undefined) { + super(metadata, proof); + + this.identityNonce = identityNonce; + } + + /** + * @returns {number} + */ + getIdentityNonce() { + return this.identityNonce; + } + + /** + * @param proto + * @returns {GetIdentityNonceResponse} + */ + static createFromProto(proto) { + // eslint-disable-next-line + const identityNonce = proto.getV0() + .getIdentityNonce() & IDENTITY_NONCE_VALUE_FILTER; + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( + proto, + ); + + if ((typeof identityNonce === 'undefined' || identityNonce === null) && !proof) { + throw new InvalidResponseError('Nonce data is not defined'); + } + + return new GetIdentityNonceResponse( + identityNonce, + metadata, + proof, + ); + } +} + +module.exports = GetIdentityNonceResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/getIdentityNonceFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/getIdentityNonceFactory.js new file mode 100644 index 00000000000..217cfe48c34 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/getIdentityNonceFactory.js @@ -0,0 +1,74 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityNonceRequest, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityNonceResponse = require('./GetIdentityNonceResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityNonce} + */ +function getIdentityNonceFactory(grpcTransport) { + /** + * Fetch the version upgrade votes status + * @typedef {getIdentityNonce} + * @param {Buffer} identityId + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityNonce(identityId, options = {}) { + const { + GetIdentityNonceRequestV0, + } = GetIdentityNonceRequest; + + // eslint-disable-next-line max-len + const getIdentityNonceRequest = new GetIdentityNonceRequest(); + + if (Buffer.isBuffer(identityId)) { + // eslint-disable-next-line no-param-reassign + identityId = Buffer.from(identityId); + } + + getIdentityNonceRequest.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityNonceResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityNonce', + getIdentityNonceRequest, + options, + ); + + return GetIdentityNonceResponse + .createFromProto(getIdentityNonceResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityNonce; +} + +module.exports = getIdentityNonceFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.js b/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.js index 4b8fe08e2a2..a28ec23e6c1 100644 --- a/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.js +++ b/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.js @@ -32,7 +32,7 @@ class GetProtocolVersionUpgradeVoteStatusResponse extends AbstractResponse { ); if (!versions && !proof) { - throw new InvalidResponseError('Version upgrade vote status is not defined'); + throw new InvalidResponseError('Version upgrade votes status is not defined'); } let versionSignals = []; diff --git a/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.js b/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.js index fa7c87cda28..bc79c54315c 100644 --- a/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.js +++ b/packages/js-dapi-client/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.js @@ -14,7 +14,7 @@ const InvalidResponseError = require('../response/errors/InvalidResponseError'); */ function getProtocolVersionUpgradeVoteStatusFactory(grpcTransport) { /** - * Fetch the version upgrade vote status + * Fetch the version upgrade votes status * @typedef {getProtocolVersionUpgradeVoteStatus} * @param {string} startProTxHash * @param {number} count diff --git a/packages/js-dapi-client/lib/methods/platform/getTotalCreditsInPlatform/GetTotalCreditsInPlatformResponse.js b/packages/js-dapi-client/lib/methods/platform/getTotalCreditsInPlatform/GetTotalCreditsInPlatformResponse.js new file mode 100644 index 00000000000..a682d646d31 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getTotalCreditsInPlatform/GetTotalCreditsInPlatformResponse.js @@ -0,0 +1,46 @@ +const AbstractResponse = require('../response/AbstractResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +class GetTotalCreditsInPlatformResponse extends AbstractResponse { + /** + * @param {number} totalCreditsInPlatform + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(totalCreditsInPlatform, metadata, proof = undefined) { + super(metadata, proof); + + this.totalCreditsInPlatform = totalCreditsInPlatform; + } + + /** + * @returns {number} + */ + getTotalCreditsInPlatform() { + return this.totalCreditsInPlatform; + } + + /** + * @param proto + * @returns {GetTotalCreditsInPlatformResponse} + */ + static createFromProto(proto) { + // eslint-disable-next-line + const totalCreditsInPlatform = proto.getV0().getCredits(); + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( + proto, + ); + + if ((typeof totalCreditsInPlatform === 'undefined' || totalCreditsInPlatform === null) && !proof) { + throw new InvalidResponseError('Total Credits on Platform data is not defined'); + } + + return new GetTotalCreditsInPlatformResponse( + totalCreditsInPlatform, + metadata, + proof, + ); + } +} + +module.exports = GetTotalCreditsInPlatformResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getTotalCreditsInPlatform/getTotalCreditsInPlatformFactory.js b/packages/js-dapi-client/lib/methods/platform/getTotalCreditsInPlatform/getTotalCreditsInPlatformFactory.js new file mode 100644 index 00000000000..1bbbd3f022f --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getTotalCreditsInPlatform/getTotalCreditsInPlatformFactory.js @@ -0,0 +1,67 @@ +const { + v0: { + PlatformPromiseClient, + GetTotalCreditsInPlatformRequest, + }, +} = require('@dashevo/dapi-grpc'); + +const GetTotalCreditsInPlatformResponse = require('./GetTotalCreditsInPlatformResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getTotalCreditsInPlatform} + */ +function getTotalCreditsInPlatformFactory(grpcTransport) { + /** + * Fetch the version upgrade votes status + * @typedef {getTotalCreditsInPlatform} + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getTotalCreditsInPlatform(options = {}) { + const { + GetTotalCreditsInPlatformRequestV0, + } = GetTotalCreditsInPlatformRequest; + + // eslint-disable-next-line max-len + const getTotalCreditsInPlatformRequest = new GetTotalCreditsInPlatformRequest(); + + getTotalCreditsInPlatformRequest.setV0( + new GetTotalCreditsInPlatformRequestV0() + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getTotalCreditsInPlatformResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getTotalCreditsInPlatform', + getTotalCreditsInPlatformRequest, + options, + ); + + return GetTotalCreditsInPlatformResponse + .createFromProto(getTotalCreditsInPlatformResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getTotalCreditsInPlatform; +} + +module.exports = getTotalCreditsInPlatformFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/waitForStateTransitionResult/waitForStateTransitionResultFactory.js b/packages/js-dapi-client/lib/methods/platform/waitForStateTransitionResult/waitForStateTransitionResultFactory.js index f554ea0f431..62d7466fba2 100644 --- a/packages/js-dapi-client/lib/methods/platform/waitForStateTransitionResult/waitForStateTransitionResultFactory.js +++ b/packages/js-dapi-client/lib/methods/platform/waitForStateTransitionResult/waitForStateTransitionResultFactory.js @@ -24,7 +24,7 @@ function waitForStateTransitionResultFactory(grpcTransport) { // eslint-disable-next-line no-param-reassign options = { // Set default timeout - timeout: 80000, + timeout: 120000, prove: false, retry: 0, throwDeadlineExceeded: true, diff --git a/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js b/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js index f792c0738a9..5a25bf5e2e1 100644 --- a/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js +++ b/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js @@ -1,3 +1,4 @@ +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); const logger = require('../../logger'); const MaxRetriesReachedError = require('../errors/response/MaxRetriesReachedError'); @@ -81,7 +82,12 @@ class GrpcTransport { } catch (error) { this.lastUsedAddress = address; - this.logger.error(`GRPC Request ${method} to ${address.toString()} failed with error: ${error.message}`); + // Show NOT_FOUND errors only in debug mode + if (error.code !== GrpcErrorCodes.NOT_FOUND) { + this.logger.error(`GRPC Request ${method} to ${address.toString()} failed with error: ${error.message}`); + } else { + this.logger.debug(`GRPC Request ${method} to ${address.toString()} failed with error: ${error.message}`); + } // for unknown errors if (error.code === undefined) { @@ -98,6 +104,8 @@ class GrpcTransport { throw responseError; } + // TODO: Shouldn't we call address.markAsBanned() here? + if (options.retries === 0) { throw new MaxRetriesReachedError(responseError); } diff --git a/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js b/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js index 98043b61217..103c37bb399 100644 --- a/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js +++ b/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js @@ -118,7 +118,7 @@ async function createGrpcTransportError(grpcError, dapiAddress) { } // DPP consensus errors - if (code >= 1000 && code < 5000) { + if (code >= 10000 && code < 50000) { const consensusError = deserializeConsensusError(data.serializedError || []); delete data.serializedError; diff --git a/packages/js-dapi-client/lib/transport/ReconnectableStream.js b/packages/js-dapi-client/lib/transport/ReconnectableStream.js index 260e38f1247..af3a22c8fb8 100644 --- a/packages/js-dapi-client/lib/transport/ReconnectableStream.js +++ b/packages/js-dapi-client/lib/transport/ReconnectableStream.js @@ -12,8 +12,7 @@ const wait = require('../utils/wait'); * delay in MS to perform retry after an error */ const defaultOptions = { - // TODO: manage timeout according to the Nginx setting of the node - autoReconnectInterval: 50000, + autoReconnectInterval: 600000, maxRetriesOnError: 10, retryOnErrorDelay: 1000, }; @@ -57,6 +56,8 @@ class ReconnectableStream extends EventEmitter { const opts = { ...defaultOptions, ...options }; + this.logger = opts.logger || { debug: () => {} }; + /** * Auto-reconnect interval in millisecond * It is needed to automatically reconnect to another DAPI node @@ -109,6 +110,8 @@ class ReconnectableStream extends EventEmitter { } async connect(...args) { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Connecting to stream'); // Memorize current stream args (which can be altered by beforeReconnect logic) this.args = args; @@ -127,6 +130,8 @@ class ReconnectableStream extends EventEmitter { if (this.reconnectTimeout) { throw new Error('Auto reconnect timeout is already running.'); } + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Setting reconnect timeout'); this.reconnectTimeout = this.setTimeout( this.reconnect, this.autoReconnectInterval, @@ -134,6 +139,8 @@ class ReconnectableStream extends EventEmitter { } reconnect() { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Try reconnecting to stream'); if (this.reconnectTimeout) { this.reconnectTimeout = null; this.stream.cancel(); @@ -146,6 +153,8 @@ class ReconnectableStream extends EventEmitter { this.emit(EVENTS.BEFORE_RECONNECT, updateArgs); this.connect(...newArgs) .catch((connectError) => this.emit(EVENTS.ERROR, connectError)); + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Reconnected to stream'); } } @@ -186,9 +195,13 @@ class ReconnectableStream extends EventEmitter { * @private */ endHandler() { - this.stopAutoReconnect(); - this.stream = null; - this.emit(EVENTS.END); + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] End handler, stream exists:', !!this.stream); + if (this.stream) { + this.stopAutoReconnect(); + this.stream = null; + this.emit(EVENTS.END); + } } /** @@ -197,9 +210,21 @@ class ReconnectableStream extends EventEmitter { * @param e */ errorHandler(e) { + // eslint-disable-next-line no-unused-expressions + this.logger.debug(`[ReconnectableStream] Error in stream, code ${e.code}, e:`, e); + // In case of cancellation nothing has to happen. + // Do not retry UNKNOWN error code - HACH for grpc-web that ignores following error that happens + // in a while after stream cancellation + // Error message: + // "Response closed without grpc-status (Headers only) { + // [Error: Response closed without grpc-status (Headers only)]" // TODO: do we need to propagate GrpcErrorCodes.CANCELLED further? - if (e.code === GrpcErrorCodes.CANCELLED) { + if (e.code === GrpcErrorCodes.CANCELLED + || (e.code === GrpcErrorCodes.UNKNOWN && this.stream === null) + ) { + // e.code + this.logger.debug(`[ReconnectableStream] Returning from error handler without restart, error code ${e.code}, e:`); return; } @@ -212,6 +237,8 @@ class ReconnectableStream extends EventEmitter { * @param e */ retryOnError(e) { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Error handler', e); // Stop reconnect timeout if there is one this.stopAutoReconnect(); @@ -252,9 +279,13 @@ class ReconnectableStream extends EventEmitter { * @private */ stopAutoReconnect() { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Stopping auto reconnect'); if (this.reconnectTimeout) { this.clearTimeout(this.reconnectTimeout); this.reconnectTimeout = null; + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Stoped auto reconnect'); } } @@ -265,7 +296,18 @@ class ReconnectableStream extends EventEmitter { * @returns {*} */ cancel() { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Canceling streams'); this.stopAutoReconnect(); + // Hack for browsers to properly unsubscribe from ERROR event. + // (It will continue propagating despite of calling cancel) + // Ref to unsubscribe from ERROR event + const { stream } = this; + setTimeout(() => { + stream.removeListener(EVENTS.ERROR, this.errorHandler); + // endHandler + this.stream = null; + }, 1000); return this.stream.cancel(); } } diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 68a85d2a446..6ad2906baa7 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ @@ -25,10 +25,18 @@ "url": "https://github.com/shuplenkov" } ], + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/js-dapi-client#readme", "dependencies": { "@dashevo/dapi-grpc": "workspace:*", "@dashevo/dash-spv": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.3", "@dashevo/grpc-common": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", "bs58": "^4.0.1", @@ -57,7 +65,7 @@ "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsdoc": "^46.9.0", "events": "^3.3.0", - "karma": "^6.4.1", + "karma": "^6.4.3", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.1.2", @@ -92,7 +100,7 @@ "test:integration": "mocha './test/integration/**/*.spec.js'", "test:node": "NODE_ENV=test mocha", "test:browsers": "karma start ./karma.conf.js --single-run", - "test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=95 yarn run mocha 'test/unit/**/*.spec.js' 'test/integration/**/*.spec.js'", + "test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=90 yarn run mocha 'test/unit/**/*.spec.js' 'test/integration/**/*.spec.js'", "prepublishOnly": "yarn run build:web" }, "ultra": { diff --git a/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js b/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js index c6eecea9864..aeb50c773bd 100644 --- a/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js +++ b/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js @@ -7,7 +7,8 @@ const getMNListDiffsFixture = require('../../../lib/test/fixtures/getMNListDiffs const wait = require('../../../lib/utils/wait'); -describe('SimplifiedMasternodeListProvider', () => { +// TODO: Update test to new implementation +describe.skip('SimplifiedMasternodeListProvider', () => { let jsonTransportMock; let smlProvider; let lastUsedAddress; diff --git a/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js b/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js index 0e007be0676..d7eeecc6875 100644 --- a/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js +++ b/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js @@ -5,7 +5,8 @@ const { BroadcastTransactionResponse, GetBlockResponse, GetTransactionResponse, - GetStatusResponse, + GetBlockchainStatusResponse, + GetMasternodeStatusResponse, }, } = require('@dashevo/dapi-grpc'); @@ -43,17 +44,6 @@ describe('CoreMethodsFacade', () => { }); }); - describe('#generateToAddress', () => { - it('should generate address', async () => { - const response = 'response'; - jsonRpcTransportMock.request.resolves(response); - await coreMethods.generateToAddress(1, 'yTMDce5yEpiPqmgPrPmTj7yAmQPJERUSVy'); - - expect(grpcTransportMock.request).to.be.not.called(); - expect(jsonRpcTransportMock.request).to.be.calledOnce(); - }); - }); - describe('#getBestBlockHash', () => { it('should get best block hash', async () => { const response = '000000000b0339e07bce8b3186a6a57a3c45d10e16c4bce18ef81b667bc822b2'; @@ -102,40 +92,30 @@ describe('CoreMethodsFacade', () => { }); }); - describe('#getMnListDiff', () => { - it('should get mn list diff', async () => { - const baseBlockHash = '0000047d24635e347be3aaaeb66c26be94901a2f962feccd4f95090191f208c1'; - const blockHash = '000000000b0339e07bce8b3186a6a57a3c45d10e16c4bce18ef81b667bc822b2'; - - const response = { - baseBlockHash, - blockHash, - deletedMNs: [], - mnList: [], - }; - jsonRpcTransportMock.request.resolves(response); - await coreMethods.getMnListDiff(baseBlockHash, blockHash); + describe('#getBlockchainStatus', () => { + it('should get status', async () => { + const response = new GetBlockchainStatusResponse(); - expect(grpcTransportMock.request).to.be.not.called(); - expect(jsonRpcTransportMock.request).to.be.calledOnce(); - }); - }); + response.setStatus(GetBlockchainStatusResponse.Status.READY); - describe('#getStatus', () => { - it('should get status', async () => { - const response = new GetStatusResponse(); + grpcTransportMock.request.resolves(response); - response.setStatus(GetStatusResponse.Status.READY); + await coreMethods.getBlockchainStatus(); - const masternode = new GetStatusResponse.Masternode(); + expect(jsonRpcTransportMock.request).to.be.not.called(); + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); - masternode.setStatus(GetStatusResponse.Masternode.Status.READY); + describe('#getMasternodeStatus', () => { + it('should get masternode status', async () => { + const response = new GetMasternodeStatusResponse(); - response.setMasternode(masternode); + response.setStatus(GetMasternodeStatusResponse.Status.READY); grpcTransportMock.request.resolves(response); - await coreMethods.getStatus(); + await coreMethods.getMasternodeStatus(); expect(jsonRpcTransportMock.request).to.be.not.called(); expect(grpcTransportMock.request).to.be.calledOnce(); diff --git a/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js b/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js index a75a0304015..cb2c2dd0fae 100644 --- a/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js +++ b/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js @@ -4,11 +4,17 @@ const { GetDataContractResponse, GetDocumentsResponse, GetIdentityResponse, + GetIdentityByPublicKeyHashResponse, + GetIdentitiesContractKeysResponse, GetEpochsInfoResponse, GetProtocolVersionUpgradeVoteStatusResponse, GetProtocolVersionUpgradeStateResponse, + GetIdentityContractNonceResponse, + GetIdentityNonceResponse, + GetIdentityKeysResponse, BroadcastStateTransitionResponse, WaitForStateTransitionResultResponse, + KeyPurpose, }, } = require('@dashevo/dapi-grpc'); @@ -21,6 +27,8 @@ const PlatformMethodsFacade = require('../../../../lib/methods/platform/Platform const { WaitForStateTransitionResultResponseV0 } = WaitForStateTransitionResultResponse; const { GetIdentityResponseV0 } = GetIdentityResponse; +const { GetIdentityByPublicKeyHashResponseV0 } = GetIdentityByPublicKeyHashResponse; +const { GetIdentitiesContractKeysResponseV0 } = GetIdentitiesContractKeysResponse; const { GetDocumentsResponseV0 } = GetDocumentsResponse; const { GetDataContractResponseV0 } = GetDataContractResponse; const { GetEpochsInfoResponseV0 } = GetEpochsInfoResponse; @@ -28,6 +36,9 @@ const { GetProtocolVersionUpgradeVoteStatusResponseV0, } = GetProtocolVersionUpgradeVoteStatusResponse; const { GetProtocolVersionUpgradeStateResponseV0 } = GetProtocolVersionUpgradeStateResponse; +const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; +const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; +const { GetIdentityKeysResponseV0 } = GetIdentityKeysResponse; describe('PlatformMethodsFacade', () => { let grpcTransportMock; @@ -108,6 +119,56 @@ describe('PlatformMethodsFacade', () => { }); }); + describe('#getIdentityByPublicKeyHash', () => { + it('should get Identity', async () => { + const response = new GetIdentityByPublicKeyHashResponse(); + response.setV0( + new GetIdentityByPublicKeyHashResponseV0() + .setMetadata(new ResponseMetadata()) + .setIdentity((await getIdentityFixture()).toBuffer()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityByPublicKeyHash('41nthkqvHBLnqiMkSbsdTNANzYu9bgdv4etKoRUunY1M'); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + + describe('#getIdentitiesContractKeys', () => { + it('should get identities keys', async () => { + const identityFixture = await getIdentityFixture(); + + const { IdentitiesKeys, IdentityKeys, PurposeKeys } = GetIdentitiesContractKeysResponseV0; + + const response = new GetIdentitiesContractKeysResponse(); + response.setV0( + new GetIdentitiesContractKeysResponseV0() + .setIdentitiesKeys(new IdentitiesKeys() + .setEntriesList([ + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixture.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.ENCRYPTION) + .setKeysBytesList(identityFixture.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + ])) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentitiesContractKeys([ + Buffer.alloc(32).fill(1), + ], Buffer.alloc(32).fill(2), [KeyPurpose.ENCRYPTION]); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + describe('#waitForStateTransitionResult', () => { it('should wait for state transition', async () => { const response = new WaitForStateTransitionResultResponse(); @@ -154,7 +215,7 @@ describe('PlatformMethodsFacade', () => { }); describe('#getProtocolVersionUpgradeVoteStatus', () => { - it('should get version upgrade vote status', async () => { + it('should get version upgrade votes status', async () => { const startProTxHash = Buffer.alloc(32).fill('a').toString('hex'); const proTxHash = Buffer.alloc(32).fill('b').toString('hex'); @@ -201,4 +262,60 @@ describe('PlatformMethodsFacade', () => { expect(grpcTransportMock.request).to.be.calledOnce(); }); }); + + describe('#getIdentityContractNonce', () => { + it('should get nonce', async () => { + const response = new GetIdentityContractNonceResponse(); + + response.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(1) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityContractNonce(Buffer.alloc(32), Buffer.alloc(32)); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + + describe('#getIdentityNonce', () => { + it('should get nonce', async () => { + const response = new GetIdentityNonceResponse(); + + response.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(1) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityNonce(Buffer.alloc(32), Buffer.alloc(32)); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + + describe('#getIdentityKeys', () => { + it('should get keys', async () => { + const response = new GetIdentityKeysResponse(); + + const { Keys } = GetIdentityKeysResponseV0; + + response.setV0( + new GetIdentityKeysResponseV0() + .setKeys(new Keys().setKeysBytesList([Buffer.alloc(41), Buffer.alloc(46)])) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityKeys(Buffer.alloc(32), [0, 1], 100, {}); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); }); diff --git a/packages/js-dapi-client/test/unit/DAPIClient.spec.js b/packages/js-dapi-client/test/unit/DAPIClient.spec.js index 73283a9d8ac..dd57d1ff7e2 100644 --- a/packages/js-dapi-client/test/unit/DAPIClient.spec.js +++ b/packages/js-dapi-client/test/unit/DAPIClient.spec.js @@ -26,6 +26,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); @@ -51,6 +52,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); @@ -82,6 +84,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); @@ -109,6 +112,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); diff --git a/packages/js-dapi-client/test/unit/methods/core/generateToAddressFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/generateToAddressFactory.spec.js deleted file mode 100644 index c35d5c3c868..00000000000 --- a/packages/js-dapi-client/test/unit/methods/core/generateToAddressFactory.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -const generateToAddressFactory = require( - '../../../../lib/methods/core/generateToAddressFactory', -); - -describe('generateToAddressFactory', () => { - let generateToAddress; - let jsonRpcTransport; - - beforeEach(function beforeEach() { - jsonRpcTransport = { - request: this.sinon.stub(), - }; - - generateToAddress = generateToAddressFactory(jsonRpcTransport); - }); - - it('should call generateToAddress method', async () => { - const resultData = 'result'; - const blocksNumber = 10; - const address = 'yTMDce5yEpiPqmgPrPmTj7yAmQPJERUSVy'; - const options = {}; - jsonRpcTransport.request.resolves(resultData); - - const result = await generateToAddress(blocksNumber, address, options); - expect(result).to.equal(resultData); - expect(jsonRpcTransport.request).to.be.calledOnceWithExactly( - 'generateToAddress', - { blocksNumber, address }, - options, - ); - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getBlockchainStatusFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getBlockchainStatusFactory.spec.js new file mode 100644 index 00000000000..bceb20a0ec6 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/core/getBlockchainStatusFactory.spec.js @@ -0,0 +1,60 @@ +const { + v0: { + GetBlockchainStatusRequest, + GetBlockchainStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +const getBlockchainStatusFactory = require('../../../../lib/methods/core/getBlockchainStatusFactory'); + +describe('getBlockchainStatusFactory', () => { + let getBlockchainStatus; + let grpcTransportMock; + + beforeEach(function beforeEach() { + grpcTransportMock = { + request: this.sinon.stub(), + }; + getBlockchainStatus = getBlockchainStatusFactory(grpcTransportMock); + }); + + it('should return status', async () => { + const response = new GetBlockchainStatusResponse(); + + response.setStatus(GetBlockchainStatusResponse.Status.READY); + + const chain = new GetBlockchainStatusResponse.Chain(); + chain.setBestBlockHash(Buffer.from('bestBlockHash')); + + response.setChain(chain); + + grpcTransportMock.request.resolves(response); + + const options = { + timeout: 1000, + }; + + const result = await getBlockchainStatus( + options, + ); + + const request = new GetBlockchainStatusRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + CorePromiseClient, + 'getBlockchainStatus', + request, + options, + ); + + const expectedResult = { + ...response.toObject(), + status: 'READY', + }; + + expectedResult.chain.bestBlockHash = Buffer.from(expectedResult.chain.bestBlockHash, 'base64'); + + expect(result).to.deep.equal(expectedResult); + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getMasternodeStatusFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getMasternodeStatusFactory.spec.js new file mode 100644 index 00000000000..fdd1b569e53 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/core/getMasternodeStatusFactory.spec.js @@ -0,0 +1,54 @@ +const { + v0: { + GetMasternodeStatusRequest, + GetMasternodeStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +const getMasternodeStatusFactory = require('../../../../lib/methods/core/getMasternodeStatusFactory'); + +describe('getMasternodeStatusFactory', () => { + let getMasternodeStatus; + let grpcTransportMock; + + beforeEach(function beforeEach() { + grpcTransportMock = { + request: this.sinon.stub(), + }; + getMasternodeStatus = getMasternodeStatusFactory(grpcTransportMock); + }); + + it('should return status', async () => { + const response = new GetMasternodeStatusResponse(); + + response.setStatus(GetMasternodeStatusResponse.Status.READY); + + grpcTransportMock.request.resolves(response); + + const options = { + timeout: 1000, + }; + + const result = await getMasternodeStatus( + options, + ); + + const request = new GetMasternodeStatusRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + CorePromiseClient, + 'getMasternodeStatus', + request, + options, + ); + + const expectedResult = { + ...response.toObject(), + proTxHash: Buffer.alloc(0), + status: 'READY', + }; + + expect(result).to.deep.equal(expectedResult); + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getMnListDiffFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getMnListDiffFactory.spec.js deleted file mode 100644 index 9b7e996aa53..00000000000 --- a/packages/js-dapi-client/test/unit/methods/core/getMnListDiffFactory.spec.js +++ /dev/null @@ -1,35 +0,0 @@ -const getMnListDiffFactory = require('../../../../lib/methods/core/getMnListDiffFactory'); - -const getMNListDiffsFixture = require('../../../../lib/test/fixtures/getMNListDiffsFixture'); - -describe('getMnListDiff', () => { - let getMnListDiff; - let jsonRpcTransportMock; - let mnListDiff; - let baseBlockHash; - let blockHash; - - beforeEach(function beforeEach() { - baseBlockHash = '0000047d24635e347be3aaaeb66c26be94901a2f962feccd4f95090191f208c1'; - blockHash = '000000000b0339e07bce8b3186a6a57a3c45d10e16c4bce18ef81b667bc822b2'; - mnListDiff = getMNListDiffsFixture(); - - jsonRpcTransportMock = { - request: this.sinon.stub().resolves(mnListDiff), - }; - getMnListDiff = getMnListDiffFactory(jsonRpcTransportMock); - }); - - it('should return deterministic masternodelist diff', async () => { - const options = {}; - - const result = await getMnListDiff(baseBlockHash, blockHash, options); - - expect(result).to.deep.equal(mnListDiff); - expect(jsonRpcTransportMock.request).to.be.calledOnceWithExactly( - 'getMnListDiff', - { baseBlockHash, blockHash }, - options, - ); - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getStatusFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getStatusFactory.spec.js deleted file mode 100644 index b5376020dee..00000000000 --- a/packages/js-dapi-client/test/unit/methods/core/getStatusFactory.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { - v0: { - GetStatusRequest, - GetStatusResponse, - CorePromiseClient, - }, -} = require('@dashevo/dapi-grpc'); - -const getStatusFactory = require('../../../../lib/methods/core/getStatusFactory'); - -describe('getStatusFactory', () => { - let getStatus; - let grpcTransportMock; - - beforeEach(function beforeEach() { - grpcTransportMock = { - request: this.sinon.stub(), - }; - getStatus = getStatusFactory(grpcTransportMock); - }); - - it('should return status', async () => { - const response = new GetStatusResponse(); - - response.setStatus(GetStatusResponse.Status.READY); - - const masternode = new GetStatusResponse.Masternode(); - - masternode.setStatus(GetStatusResponse.Masternode.Status.READY); - - const chain = new GetStatusResponse.Chain(); - chain.setBestBlockHash(Buffer.from('bestBlockHash')); - - response.setMasternode(masternode); - response.setChain(chain); - - grpcTransportMock.request.resolves(response); - - const options = { - timeout: 1000, - }; - - const result = await getStatus( - options, - ); - - const request = new GetStatusRequest(); - - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - CorePromiseClient, - 'getStatus', - request, - options, - ); - - const expectedResult = { - ...response.toObject(), - status: 'READY', - masternode: { - ...response.getMasternode().toObject(), - status: 'READY', - }, - }; - - expectedResult.chain.bestBlockHash = Buffer.from(expectedResult.chain.bestBlockHash, 'base64'); - - expect(result).to.deep.equal(expectedResult); - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.spec.js deleted file mode 100644 index b43a0e5686f..00000000000 --- a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.spec.js +++ /dev/null @@ -1,144 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); -const { - v0: { - GetIdentitiesByPublicKeyHashesResponse, - ResponseMetadata, - Proof: ProofResponse, - }, -} = require('@dashevo/dapi-grpc'); - -const GetIdentitiesByPublicKeyHashesResponseClass = require('../../../../../lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse'); -const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); -const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); -const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); -const Proof = require('../../../../../lib/methods/platform/response/Proof'); -const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); - -describe('GetIdentitiesByPublicKeyHashesResponse', () => { - let getIdentitiesResponse; - let metadataFixture; - let identityFixture; - let proto; - let proofFixture; - - beforeEach(async () => { - metadataFixture = getMetadataFixture(); - identityFixture = await getIdentityFixture(); - proofFixture = getProofFixture(); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - proto = new GetIdentitiesByPublicKeyHashesResponse(); - - const metadata = new ResponseMetadata(); - metadata.setHeight(metadataFixture.height); - metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); - metadata.setTimeMs(metadataFixture.timeMs); - metadata.setProtocolVersion(metadataFixture.protocolVersion); - - proto.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(Buffer.alloc(20)) - .setValue(new BytesValue().setValue(identityFixture.toBuffer())), - ]), - ).setMetadata(metadata), - ); - - getIdentitiesResponse = new GetIdentitiesByPublicKeyHashesResponseClass( - [identityFixture.toBuffer()], - new Metadata(metadataFixture), - ); - }); - - it('should return identities', () => { - const identities = getIdentitiesResponse.getIdentities(); - const proof = getIdentitiesResponse.getProof(); - - expect(identities).to.deep.members([identityFixture.toBuffer()]); - expect(proof).to.equal(undefined); - }); - - it('should return proof', () => { - getIdentitiesResponse = new GetIdentitiesByPublicKeyHashesResponseClass( - [], - new Metadata(metadataFixture), - new Proof(proofFixture), - ); - - const identities = getIdentitiesResponse.getIdentities(); - const proof = getIdentitiesResponse.getProof(); - - expect(identities).to.deep.members([]); - expect(proof).to.be.an.instanceOf(Proof); - expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); - expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); - expect(proof.getSignature()).to.deep.equal(proofFixture.signature); - }); - - it('should create an instance from proto', () => { - getIdentitiesResponse = GetIdentitiesByPublicKeyHashesResponseClass.createFromProto(proto); - expect(getIdentitiesResponse).to.be.an.instanceOf( - GetIdentitiesByPublicKeyHashesResponseClass, - ); - expect(getIdentitiesResponse.getIdentities()).to.deep.equal([identityFixture.toBuffer()]); - - expect(getIdentitiesResponse.getMetadata()) - .to.be.an.instanceOf(Metadata); - expect(getIdentitiesResponse.getMetadata().getHeight()) - .to.equal(metadataFixture.height); - expect(getIdentitiesResponse.getMetadata().getCoreChainLockedHeight()) - .to.equal(metadataFixture.coreChainLockedHeight); - - expect(getIdentitiesResponse.getProof()).to.equal(undefined); - }); - - it('should create an instance with proof from proto', () => { - const proofProto = new ProofResponse(); - - proofProto.setQuorumHash(proofFixture.quorumHash); - proofProto.setSignature(proofFixture.signature); - proofProto.setGrovedbProof(proofFixture.merkleProof); - proofProto.setRound(proofFixture.round); - - proto.getV0().setProof(proofProto); - - getIdentitiesResponse = GetIdentitiesByPublicKeyHashesResponseClass.createFromProto(proto); - expect(getIdentitiesResponse).to.be.an.instanceOf( - GetIdentitiesByPublicKeyHashesResponseClass, - ); - expect(getIdentitiesResponse.getIdentities()).to.deep.members([]); - expect(getIdentitiesResponse.getMetadata()).to.deep.equal(metadataFixture); - - expect(getIdentitiesResponse.getProof()) - .to.be.an.instanceOf(Proof); - expect(getIdentitiesResponse.getProof().getGrovedbProof()) - .to.deep.equal(proofFixture.merkleProof); - expect(getIdentitiesResponse.getProof().getQuorumHash()) - .to.deep.equal(proofFixture.quorumHash); - expect(getIdentitiesResponse.getProof().getSignature()) - .to.deep.equal(proofFixture.signature); - expect(getIdentitiesResponse.getProof().getRound()) - .to.deep.equal(proofFixture.round); - }); - - it('should throw InvalidResponseError if Metadata is not defined', () => { - proto.getV0().setMetadata(undefined); - - try { - getIdentitiesResponse = GetIdentitiesByPublicKeyHashesResponseClass.createFromProto(proto); - - expect.fail('should throw InvalidResponseError'); - } catch (e) { - expect(e).to.be.an.instanceOf(InvalidResponseError); - } - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.spec.js deleted file mode 100644 index 205e45583f8..00000000000 --- a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.spec.js +++ /dev/null @@ -1,166 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); -const { - v0: { - PlatformPromiseClient, - GetIdentitiesByPublicKeyHashesRequest, - GetIdentitiesByPublicKeyHashesResponse, - ResponseMetadata, - Proof: ProofResponse, - }, -} = require('@dashevo/dapi-grpc'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); -const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); -const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); - -const getIdentitiesByPublicKeyHashesFactory = require( - '../../../../../lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory', -); -const Proof = require('../../../../../lib/methods/platform/response/Proof'); - -describe('getIdentitiesByPublicKeyHashesFactory', () => { - let grpcTransportMock; - let getIdentitiesByPublicKeyHashes; - let options; - let response; - let identityFixture; - let publicKeyHash; - let metadataFixture; - let proofFixture; - let proofResponse; - - beforeEach(async function beforeEach() { - identityFixture = await getIdentityFixture(); - metadataFixture = getMetadataFixture(); - proofFixture = getProofFixture(); - - const metadata = new ResponseMetadata(); - metadata.setHeight(metadataFixture.height); - metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); - metadata.setTimeMs(metadataFixture.timeMs); - metadata.setProtocolVersion(metadataFixture.protocolVersion); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - response = new GetIdentitiesByPublicKeyHashesResponse(); - response.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(publicKeyHash) - .setValue(new BytesValue().setValue(identityFixture.toBuffer())), - ]), - ).setMetadata(metadata), - ); - - proofResponse = new ProofResponse(); - - proofResponse.setQuorumHash(proofFixture.quorumHash); - proofResponse.setSignature(proofFixture.signature); - proofResponse.setGrovedbProof(proofFixture.merkleProof); - proofResponse.setRound(proofFixture.round); - - publicKeyHash = identityFixture.getPublicKeyById(1).hash(); - - grpcTransportMock = { - request: this.sinon.stub().resolves(response), - }; - - options = { - timeout: 1000, - }; - - getIdentitiesByPublicKeyHashes = getIdentitiesByPublicKeyHashesFactory(grpcTransportMock); - }); - - it('should return public key hashes to identity map', async () => { - const result = await getIdentitiesByPublicKeyHashes([publicKeyHash], options); - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList([publicKeyHash]) - .setProve(false), - ); - - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - request, - options, - ); - expect(result.getIdentities()).to.have.deep.equal([identityFixture.toBuffer()]); - expect(result.getMetadata()).to.deep.equal(metadataFixture); - expect(result.getProof()).to.equal(undefined); - }); - - it('should return proof', async () => { - options.prove = true; - response.getV0().setProof(proofResponse); - - const result = await getIdentitiesByPublicKeyHashes([publicKeyHash], options); - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList([publicKeyHash]) - .setProve(true), - ); - - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - request, - options, - ); - expect(result.getIdentities()).to.have.deep.members([]); - - expect(result.getMetadata()).to.deep.equal(metadataFixture); - - expect(result.getProof()).to.be.an.instanceOf(Proof); - expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); - expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); - expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); - expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); - expect(result.getMetadata()).to.deep.equal(metadataFixture); - expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); - expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( - metadataFixture.coreChainLockedHeight, - ); - }); - - it('should throw unknown error', async () => { - const error = new Error('Unknown found'); - - grpcTransportMock.request.throws(error); - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList([publicKeyHash]) - .setProve(false), - ); - - try { - await getIdentitiesByPublicKeyHashes([publicKeyHash], options); - - expect.fail('should throw unknown error'); - } catch (e) { - expect(e).to.deep.equal(error); - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - request, - options, - ); - } - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.spec.js new file mode 100644 index 00000000000..36fe8f57d7a --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.spec.js @@ -0,0 +1,177 @@ +const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const { + v0: { + GetIdentitiesContractKeysResponse, + ResponseMetadata, + KeyPurpose, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentitiesContractKeysResponseClass = require('../../../../../lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentitiesContractKeysResponse', () => { + let getIdentitiesContractKeysResponse; + let metadataFixture; + let identityFixtureA; + let identityFixtureB; + let identitiesContractKeys; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + identityFixtureA = await getIdentityFixture(await generateRandomIdentifier()); + identityFixtureB = await getIdentityFixture(await generateRandomIdentifier()); + proofFixture = getProofFixture(); + + const { + GetIdentitiesContractKeysResponseV0, + } = GetIdentitiesContractKeysResponse; + + const { IdentitiesKeys, IdentityKeys, PurposeKeys } = GetIdentitiesContractKeysResponseV0; + + proto = new GetIdentitiesContractKeysResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentitiesContractKeysResponseV0() + .setIdentitiesKeys(new IdentitiesKeys() + .setEntriesList([ + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureA.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.ENCRYPTION) + .setKeysBytesList(identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureB.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.DECRYPTION) + .setKeysBytesList(identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + ])) + .setMetadata(metadata), + ); + + identitiesContractKeys = { + [identityFixtureA.getId().toString()]: { + [KeyPurpose.ENCRYPTION]: identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + [identityFixtureB.getId().toString()]: { + [KeyPurpose.DECRYPTION]: identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + }; + + getIdentitiesContractKeysResponse = new GetIdentitiesContractKeysResponseClass( + identitiesContractKeys, + new Metadata(metadataFixture), + ); + }); + + it('should return identities keys', () => { + const keys = getIdentitiesContractKeysResponse.getIdentitiesKeys(); + const proof = getIdentitiesContractKeysResponse.getProof(); + + expect(keys).to.deep.equal(identitiesContractKeys); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentitiesContractKeysResponse = new GetIdentitiesContractKeysResponseClass( + {}, + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const keys = getIdentitiesContractKeysResponse.getIdentitiesKeys(); + const proof = getIdentitiesContractKeysResponse.getProof(); + + expect(keys).to.deep.equal({}); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + }); + + it('should create an instance from proto', () => { + getIdentitiesContractKeysResponse = GetIdentitiesContractKeysResponseClass + .createFromProto(proto); + expect(getIdentitiesContractKeysResponse).to.be.an.instanceOf( + GetIdentitiesContractKeysResponseClass, + ); + + expect(getIdentitiesContractKeysResponse.getIdentitiesKeys()).to.deep.equal( + identitiesContractKeys, + ); + + expect(getIdentitiesContractKeysResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentitiesContractKeysResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentitiesContractKeysResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentitiesContractKeysResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setProof(proofProto); + + getIdentitiesContractKeysResponse = GetIdentitiesContractKeysResponseClass + .createFromProto(proto); + expect(getIdentitiesContractKeysResponse).to.be.an.instanceOf( + GetIdentitiesContractKeysResponseClass, + ); + expect(getIdentitiesContractKeysResponse.getIdentitiesKeys()).to.deep.equal({}); + expect(getIdentitiesContractKeysResponse.getMetadata()).to.deep.equal(metadataFixture); + + expect(getIdentitiesContractKeysResponse.getProof()) + .to.be.an.instanceOf(Proof); + expect(getIdentitiesContractKeysResponse.getProof().getGrovedbProof()) + .to.deep.equal(proofFixture.merkleProof); + expect(getIdentitiesContractKeysResponse.getProof().getQuorumHash()) + .to.deep.equal(proofFixture.quorumHash); + expect(getIdentitiesContractKeysResponse.getProof().getSignature()) + .to.deep.equal(proofFixture.signature); + expect(getIdentitiesContractKeysResponse.getProof().getRound()) + .to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentitiesContractKeysResponse = GetIdentitiesContractKeysResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.spec.js new file mode 100644 index 00000000000..f6f061092db --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.spec.js @@ -0,0 +1,214 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentitiesContractKeysRequest, + GetIdentitiesContractKeysResponse, + KeyPurpose, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); +const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); + +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); + +const getIdentitiesContractKeysFactory = require( + '../../../../../lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory', +); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentitiesContractKeysFactory', () => { + let grpcTransportMock; + let getIdentitiesContractKeys; + let options; + let response; + + let identityFixtureA; + let identityFixtureB; + let contractId; + let identitiesContractKeys; + + let metadataFixture; + let proofFixture; + let proofResponse; + + let mockRequest; + + beforeEach(async function beforeEach() { + identityFixtureA = await getIdentityFixture(await generateRandomIdentifier()); + identityFixtureB = await getIdentityFixture(await generateRandomIdentifier()); + contractId = await generateRandomIdentifier(); + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { + GetIdentitiesContractKeysResponseV0, + } = GetIdentitiesContractKeysResponse; + + const { IdentitiesKeys, IdentityKeys, PurposeKeys } = GetIdentitiesContractKeysResponseV0; + + response = new GetIdentitiesContractKeysResponse(); + response.setV0( + new GetIdentitiesContractKeysResponseV0() + .setIdentitiesKeys(new IdentitiesKeys() + .setEntriesList([ + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureA.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.ENCRYPTION) + .setKeysBytesList(identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureB.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.DECRYPTION) + .setKeysBytesList(identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + ])) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + identitiesContractKeys = { + [identityFixtureA.getId().toString()]: { + [KeyPurpose.ENCRYPTION]: identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + [identityFixtureB.getId().toString()]: { + [KeyPurpose.DECRYPTION]: identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + }; + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + options = { + timeout: 1000, + }; + + mockRequest = () => { + const { GetIdentitiesContractKeysRequestV0 } = GetIdentitiesContractKeysRequest; + const request = new GetIdentitiesContractKeysRequest(); + request.setV0( + new GetIdentitiesContractKeysRequestV0() + .setProve(!!options.prove) + .setIdentitiesIdsList( + [Buffer.from(identityFixtureA.getId()), Buffer.from(identityFixtureB.getId())], + ) + .setContractId(Buffer.from(contractId)) + .setPurposesList([KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION]) + .setDocumentTypeName('contactRequest'), + ); + + return request; + }; + + getIdentitiesContractKeys = getIdentitiesContractKeysFactory(grpcTransportMock); + }); + + it('should return identity ids to key purposes to keys', async () => { + const result = await getIdentitiesContractKeys( + [identityFixtureA.getId(), identityFixtureB.getId()], + contractId, + [KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION], + 'contactRequest', + options, + ); + + const request = mockRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + request, + options, + ); + expect(result.getIdentitiesKeys()).to.deep.equal(identitiesContractKeys); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setProof(proofResponse); + + const result = await getIdentitiesContractKeys( + [identityFixtureA.getId(), identityFixtureB.getId()], + contractId, + [KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION], + 'contactRequest', + options, + ); + + const request = mockRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + request, + options, + ); + expect(result.getIdentitiesKeys()).to.deep.equal({}); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const request = mockRequest(); + + try { + await getIdentitiesContractKeys( + [identityFixtureA.getId(), identityFixtureB.getId()], + contractId, + [KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION], + 'contactRequest', + options, + ); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.spec.js new file mode 100644 index 00000000000..bda482f7dff --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.spec.js @@ -0,0 +1,136 @@ +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const { + v0: { + GetIdentityByPublicKeyHashResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityByPublicKeyHashResponseClass = require('../../../../../lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityByPublicKeyHashResponse', () => { + let getIdentityResponse; + let metadataFixture; + let identityFixture; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + identityFixture = await getIdentityFixture(); + proofFixture = getProofFixture(); + + const { + GetIdentityByPublicKeyHashResponseV0, + } = GetIdentityByPublicKeyHashResponse; + + proto = new GetIdentityByPublicKeyHashResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentityByPublicKeyHashResponseV0() + .setIdentity(identityFixture.toBuffer()) + .setMetadata(metadata), + ); + + getIdentityResponse = new GetIdentityByPublicKeyHashResponseClass( + identityFixture.toBuffer(), + new Metadata(metadataFixture), + ); + }); + + it('should return identity', () => { + const identity = getIdentityResponse.getIdentity(); + const proof = getIdentityResponse.getProof(); + + expect(identity).to.deep.equal(identityFixture.toBuffer()); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityResponse = new GetIdentityByPublicKeyHashResponseClass( + undefined, + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const identity = getIdentityResponse.getIdentity(); + const proof = getIdentityResponse.getProof(); + + expect(identity).to.equal(undefined); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + }); + + it('should create an instance from proto', () => { + getIdentityResponse = GetIdentityByPublicKeyHashResponseClass.createFromProto(proto); + expect(getIdentityResponse).to.be.an.instanceOf( + GetIdentityByPublicKeyHashResponseClass, + ); + expect(getIdentityResponse.getIdentity()).to.deep.equal(identityFixture.toBuffer()); + + expect(getIdentityResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setProof(proofProto); + proto.getV0().setIdentity(undefined); + + getIdentityResponse = GetIdentityByPublicKeyHashResponseClass.createFromProto(proto); + expect(getIdentityResponse).to.be.an.instanceOf( + GetIdentityByPublicKeyHashResponseClass, + ); + expect(getIdentityResponse.getIdentity()).to.deep.equal(Buffer.alloc(0)); + expect(getIdentityResponse.getMetadata()).to.deep.equal(metadataFixture); + + expect(getIdentityResponse.getProof()) + .to.be.an.instanceOf(Proof); + expect(getIdentityResponse.getProof().getGrovedbProof()) + .to.deep.equal(proofFixture.merkleProof); + expect(getIdentityResponse.getProof().getQuorumHash()) + .to.deep.equal(proofFixture.quorumHash); + expect(getIdentityResponse.getProof().getSignature()) + .to.deep.equal(proofFixture.signature); + expect(getIdentityResponse.getProof().getRound()) + .to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityResponse = GetIdentityByPublicKeyHashResponseClass.createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.spec.js new file mode 100644 index 00000000000..c36acc5eff6 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.spec.js @@ -0,0 +1,158 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityByPublicKeyHashRequest, + GetIdentityByPublicKeyHashResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); + +const getIdentityByPublicKeyHashFactory = require( + '../../../../../lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory', +); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityByPublicKeyHashFactory', () => { + let grpcTransportMock; + let getIdentityByPublicKeyHash; + let options; + let response; + let identityFixture; + let publicKeyHash; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + identityFixture = await getIdentityFixture(); + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { + GetIdentityByPublicKeyHashResponseV0, + } = GetIdentityByPublicKeyHashResponse; + + response = new GetIdentityByPublicKeyHashResponse(); + response.setV0( + new GetIdentityByPublicKeyHashResponseV0() + .setIdentity(identityFixture.toBuffer()) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + publicKeyHash = identityFixture.getPublicKeyById(1).hash(); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + options = { + timeout: 1000, + }; + + getIdentityByPublicKeyHash = getIdentityByPublicKeyHashFactory(grpcTransportMock); + }); + + it('should return identity', async () => { + const result = await getIdentityByPublicKeyHash(publicKeyHash, options); + + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const request = new GetIdentityByPublicKeyHashRequest(); + request.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + request, + options, + ); + expect(result.getIdentity()).to.have.deep.equal(identityFixture.toBuffer()); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setProof(proofResponse); + + const result = await getIdentityByPublicKeyHash(publicKeyHash, options); + + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const request = new GetIdentityByPublicKeyHashRequest(); + request.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + request, + options, + ); + expect(result.getIdentity()).to.deep.equal(Buffer.alloc(0)); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const request = new GetIdentityByPublicKeyHashRequest(); + request.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(false), + ); + + try { + await getIdentityByPublicKeyHash(publicKeyHash, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/GetIdentityContractNonce.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/GetIdentityContractNonce.spec.js new file mode 100644 index 00000000000..efb8e532f4d --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/GetIdentityContractNonce.spec.js @@ -0,0 +1,129 @@ +const { + v0: { + GetIdentityContractNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityContractNonceResponseClass = require('../../../../../lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityContractNonceResponse', () => { + let getIdentityContractNonceResponse; + let metadataFixture; + let nonce; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + nonce = 1; + proofFixture = getProofFixture(); + + const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; + proto = new GetIdentityContractNonceResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(nonce) + .setMetadata(metadata), + + ); + + getIdentityContractNonceResponse = new GetIdentityContractNonceResponseClass( + nonce, + new Metadata(metadataFixture), + ); + }); + + it('should return Identity', () => { + const identityContractNonce = getIdentityContractNonceResponse.getIdentityContractNonce(); + const proof = getIdentityContractNonceResponse.getProof(); + + expect(identityContractNonce).to.deep.equal(nonce); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityContractNonceResponse = new GetIdentityContractNonceResponseClass( + Buffer.alloc(0), + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const identityContractNonce = getIdentityContractNonceResponse.getIdentityContractNonce(); + const proof = getIdentityContractNonceResponse.getProof(); + + expect(identityContractNonce).to.deep.equal(Buffer.alloc(0)); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should create an instance from proto', () => { + getIdentityContractNonceResponse = GetIdentityContractNonceResponseClass.createFromProto(proto); + expect(getIdentityContractNonceResponse).to.be + .an.instanceOf(GetIdentityContractNonceResponseClass); + expect(getIdentityContractNonceResponse.getIdentityContractNonce()).to.deep.equal(nonce); + + expect(getIdentityContractNonceResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityContractNonceResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityContractNonceResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityContractNonceResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setIdentityContractNonce(undefined); + proto.getV0().setProof(proofProto); + + getIdentityContractNonceResponse = GetIdentityContractNonceResponseClass.createFromProto(proto); + + expect(getIdentityContractNonceResponse.getIdentityContractNonce()) + .to.deep.equal(0); + expect(getIdentityContractNonceResponse.getMetadata()).to.deep.equal(metadataFixture); + + const proof = getIdentityContractNonceResponse.getProof(); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityContractNonceResponse = GetIdentityContractNonceResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.spec.js new file mode 100644 index 00000000000..0f5e46045b9 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.spec.js @@ -0,0 +1,158 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityContractNonceRequest, + GetIdentityContractNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityContractNonceFactory = require('../../../../../lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityContractNonceFactory', () => { + let grpcTransportMock; + let getIdentityContractNonce; + let options; + let response; + let nonce; + let identityId; + let contractId; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + nonce = 1; + identityId = Buffer.alloc(32).fill(0); + contractId = Buffer.alloc(32).fill(1); + + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; + response = new GetIdentityContractNonceResponse(); + response.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(nonce) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + getIdentityContractNonce = getIdentityContractNonceFactory(grpcTransportMock); + + options = { + timeout: 1000, + }; + }); + + it('should return identity nonce', async () => { + const result = await getIdentityContractNonce(identityId, contractId, options); + + const { GetIdentityContractNonceRequestV0 } = GetIdentityContractNonceRequest; + const request = new GetIdentityContractNonceRequest(); + request.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityContractNonce', + request, + options, + ); + expect(result.getIdentityContractNonce()).to.deep.equal(nonce); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setIdentityContractNonce(undefined); + response.getV0().setProof(proofResponse); + + const result = await getIdentityContractNonce(identityId, contractId, options); + + const { GetIdentityContractNonceRequestV0 } = GetIdentityContractNonceRequest; + const request = new GetIdentityContractNonceRequest(); + request.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityContractNonce', + request, + options, + ); + + expect(result.getIdentityContractNonce()).to.deep.equal(0); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityContractNonceRequestV0 } = GetIdentityContractNonceRequest; + const request = new GetIdentityContractNonceRequest(); + request.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(false), + ); + + try { + await getIdentityContractNonce(identityId, contractId, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityContractNonce', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/GetIdentityKeys.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/GetIdentityKeys.spec.js new file mode 100644 index 00000000000..e9d13836c2e --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/GetIdentityKeys.spec.js @@ -0,0 +1,130 @@ +const { + v0: { + GetIdentityKeysResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityKeysResponseClass = require('../../../../../lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityKeysResponse', () => { + let getIdentityKeysResponse; + let metadataFixture; + let keys; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + keys = [Buffer.alloc(41).fill(1), Buffer.alloc(48).fill(2), Buffer.alloc(55).fill(3)]; + proofFixture = getProofFixture(); + + const { GetIdentityKeysResponseV0 } = GetIdentityKeysResponse; + proto = new GetIdentityKeysResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { Keys } = GetIdentityKeysResponseV0; + + proto.setV0( + new GetIdentityKeysResponseV0() + .setKeys(new Keys().setKeysBytesList(keys)) + .setMetadata(metadata), + ); + + getIdentityKeysResponse = new GetIdentityKeysResponseClass( + keys, + new Metadata(metadataFixture), + ); + }); + + it('should return Identity Keys', () => { + const identityKeys = getIdentityKeysResponse.getIdentityKeys(); + const proof = getIdentityKeysResponse.getProof(); + + expect(identityKeys).to.deep.equal(keys); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityKeysResponse = new GetIdentityKeysResponseClass( + Buffer.alloc(0), + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const identityKeys = getIdentityKeysResponse.getIdentityKeys(); + const proof = getIdentityKeysResponse.getProof(); + + expect(identityKeys).to.deep.equal(Buffer.alloc(0)); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should create an instance from proto', () => { + getIdentityKeysResponse = GetIdentityKeysResponseClass.createFromProto(proto); + expect(getIdentityKeysResponse).to.be + .an.instanceOf(GetIdentityKeysResponseClass); + expect(getIdentityKeysResponse.getIdentityKeys()).to.deep.equal(keys); + + expect(getIdentityKeysResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityKeysResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityKeysResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityKeysResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setKeys(undefined); + proto.getV0().setProof(proofProto); + + getIdentityKeysResponse = GetIdentityKeysResponseClass.createFromProto(proto); + + expect(getIdentityKeysResponse.getIdentityKeys()) + .to.deep.equal([]); + expect(getIdentityKeysResponse.getMetadata()).to.deep.equal(metadataFixture); + + const proof = getIdentityKeysResponse.getProof(); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityKeysResponse = GetIdentityKeysResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/getIdentityKeysFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/getIdentityKeysFactory.spec.js new file mode 100644 index 00000000000..b1368ee41b9 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/getIdentityKeysFactory.spec.js @@ -0,0 +1,173 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityKeysRequest, + GetIdentityKeysResponse, + ResponseMetadata, + Proof: ProofResponse, + KeyRequestType, + SpecificKeys, + }, +} = require('@dashevo/dapi-grpc'); +const { UInt32Value } = require('google-protobuf/google/protobuf/wrappers_pb'); + +const { GetIdentityKeysResponseV0 } = GetIdentityKeysResponse; +const { Keys } = GetIdentityKeysResponseV0; + +const getIdentityKeysFactory = require('../../../../../lib/methods/platform/getIdentityKeys/getIdentityKeysFactory'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityKeysFactory', () => { + let grpcTransportMock; + let getIdentityKeys; + let options; + let response; + let keys; + let identityId; + let keyIds; + let limit; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + keys = [Buffer.alloc(41), Buffer.alloc(46)]; + keyIds = [0, 1]; + limit = 100; + + identityId = Buffer.alloc(32).fill(0); + + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + response = new GetIdentityKeysResponse(); + + response.setV0( + new GetIdentityKeysResponseV0() + .setKeys(new Keys().setKeysBytesList(keys)) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + getIdentityKeys = getIdentityKeysFactory(grpcTransportMock); + + options = { + timeout: 1000, + }; + }); + + it('should return identity keys', async () => { + const result = await getIdentityKeys(identityId, keyIds, limit, options); + + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const request = new GetIdentityKeysRequest(); + request.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType().setSpecificKeys(new SpecificKeys() + .setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([limit])) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityKeys', + request, + options, + ); + expect(result.getIdentityKeys()).to.deep.equal(keys); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setKeys(undefined); + response.getV0().setProof(proofResponse); + + const result = await getIdentityKeys(identityId, keyIds, limit, options); + + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const request = new GetIdentityKeysRequest(); + request.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType().setSpecificKeys(new SpecificKeys() + .setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([limit])) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityKeys', + request, + options, + ); + + expect(result.getIdentityKeys()).to.deep.equal([]); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const request = new GetIdentityKeysRequest(); + request.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType().setSpecificKeys(new SpecificKeys() + .setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([100])) + .setProve(false), + ); + + try { + await getIdentityKeys(identityId, keyIds, limit, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityKeys', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/GetIdentityNonce.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/GetIdentityNonce.spec.js new file mode 100644 index 00000000000..6a0d7ca6f6c --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/GetIdentityNonce.spec.js @@ -0,0 +1,129 @@ +const { + v0: { + GetIdentityNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityNonceResponseClass = require('../../../../../lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityNonceResponse', () => { + let getIdentityNonceResponse; + let metadataFixture; + let nonce; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + nonce = 1; + proofFixture = getProofFixture(); + + const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; + proto = new GetIdentityNonceResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(nonce) + .setMetadata(metadata), + + ); + + getIdentityNonceResponse = new GetIdentityNonceResponseClass( + nonce, + new Metadata(metadataFixture), + ); + }); + + it('should return Identity', () => { + const IdentityNonce = getIdentityNonceResponse.getIdentityNonce(); + const proof = getIdentityNonceResponse.getProof(); + + expect(IdentityNonce).to.deep.equal(nonce); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityNonceResponse = new GetIdentityNonceResponseClass( + Buffer.alloc(0), + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const IdentityNonce = getIdentityNonceResponse.getIdentityNonce(); + const proof = getIdentityNonceResponse.getProof(); + + expect(IdentityNonce).to.deep.equal(Buffer.alloc(0)); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should create an instance from proto', () => { + getIdentityNonceResponse = GetIdentityNonceResponseClass.createFromProto(proto); + expect(getIdentityNonceResponse).to.be + .an.instanceOf(GetIdentityNonceResponseClass); + expect(getIdentityNonceResponse.getIdentityNonce()).to.deep.equal(nonce); + + expect(getIdentityNonceResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityNonceResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityNonceResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityNonceResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setIdentityNonce(undefined); + proto.getV0().setProof(proofProto); + + getIdentityNonceResponse = GetIdentityNonceResponseClass.createFromProto(proto); + + expect(getIdentityNonceResponse.getIdentityNonce()) + .to.deep.equal(0); + expect(getIdentityNonceResponse.getMetadata()).to.deep.equal(metadataFixture); + + const proof = getIdentityNonceResponse.getProof(); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityNonceResponse = GetIdentityNonceResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/getIdentityNonceFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/getIdentityNonceFactory.spec.js new file mode 100644 index 00000000000..b0f0b9fc222 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/getIdentityNonceFactory.spec.js @@ -0,0 +1,153 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityNonceRequest, + GetIdentityNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityNonceFactory = require('../../../../../lib/methods/platform/getIdentityNonce/getIdentityNonceFactory'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityNonceFactory', () => { + let grpcTransportMock; + let getIdentityNonce; + let options; + let response; + let nonce; + let identityId; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + nonce = 1; + identityId = Buffer.alloc(32).fill(0); + + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; + response = new GetIdentityNonceResponse(); + response.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(nonce) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + getIdentityNonce = getIdentityNonceFactory(grpcTransportMock); + + options = { + timeout: 1000, + }; + }); + + it('should return identity nonce', async () => { + const result = await getIdentityNonce(identityId, options); + + const { GetIdentityNonceRequestV0 } = GetIdentityNonceRequest; + const request = new GetIdentityNonceRequest(); + request.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityNonce', + request, + options, + ); + expect(result.getIdentityNonce()).to.deep.equal(nonce); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setIdentityNonce(undefined); + response.getV0().setProof(proofResponse); + + const result = await getIdentityNonce(identityId, options); + + const { GetIdentityNonceRequestV0 } = GetIdentityNonceRequest; + const request = new GetIdentityNonceRequest(); + request.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityNonce', + request, + options, + ); + + expect(result.getIdentityNonce()).to.deep.equal(0); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityNonceRequestV0 } = GetIdentityNonceRequest; + const request = new GetIdentityNonceRequest(); + request.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(false), + ); + + try { + await getIdentityNonce(identityId, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityNonce', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.spec.js index 0ee46a856db..99d6cf812d9 100644 --- a/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.spec.js +++ b/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.spec.js @@ -54,7 +54,7 @@ describe('GetProtocolVersionUpgradeVoteStatusResponse', () => { ); }); - it('should return vote statuses', () => { + it('should return votes statuses', () => { const versionSignals = getProtocolVersionUpgradeVoteStatus.getVersionSignals(); const proof = getProtocolVersionUpgradeVoteStatus.getProof(); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.spec.js index 0df97489429..24cbc95a1f1 100644 --- a/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.spec.js +++ b/packages/js-dapi-client/test/unit/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.spec.js @@ -75,7 +75,7 @@ describe('getProtocolVersionUpgradeVoteStatusFactory', () => { }; }); - it('should return vote statuses', async () => { + it('should return votes statuses', async () => { const result = await getProtocolVersionUpgradeVoteStatus(startProTxHash, 1, options); const { diff --git a/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js b/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js index 7cab061aa32..13205f6e0c2 100644 --- a/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js +++ b/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js @@ -168,7 +168,7 @@ describe('createGrpcTransportError', () => { metadata.set('drive-error-data-bin', driveErrorDataBin); const grpcError = new GrpcError( - 1000, + 10001, 'Parsing error', ); grpcError.metadata = metadata; diff --git a/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js b/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js index b7f7769662c..c946312a074 100644 --- a/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js +++ b/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js @@ -3,6 +3,7 @@ const { expect } = require('chai'); const ReconnectableStream = require('../../../lib/transport/ReconnectableStream'); const wait = require('../../../lib/utils/wait'); +const logger = require('../../../lib/logger'); describe('ReconnectableStream', () => { let reconnectableStream; @@ -14,20 +15,23 @@ describe('ReconnectableStream', () => { beforeEach(function () { stream = new EventEmitter(); - stream.cancel = this.sinon.stub().callsFake(() => { - stream.emit('error', { - message: 'CANCELED_ON_CLIENT', - code: 1, + stream.cancel = this.sinon.stub() + .callsFake(() => { + stream.emit('error', { + message: 'CANCELED_ON_CLIENT', + code: 1, + }); }); - }); this.sinon.spy(stream, 'on'); this.sinon.spy(stream, 'removeListener'); - const createStream = this.sinon.stub().returns(stream); + const createStream = this.sinon.stub() + .returns(stream); reconnectableStream = new ReconnectableStream(createStream, { maxRetriesOnError, retryOnErrorDelay, + logger, }); this.sinon.spy(reconnectableStream, 'addListeners'); @@ -39,43 +43,68 @@ describe('ReconnectableStream', () => { this.sinon.spy(reconnectableStream, 'stopAutoReconnect'); this.sinon.spy(reconnectableStream, 'retryOnError'); this.sinon.stub(reconnectableStream, 'clearTimeout'); - this.sinon.stub(reconnectableStream, 'setTimeout').callsFake((callback) => { - setTimeoutCallback = callback; - return setTimeoutReference; - }); + this.sinon.stub(reconnectableStream, 'setTimeout') + .callsFake((callback) => { + setTimeoutCallback = callback; + return setTimeoutReference; + }); }); describe('#connect', () => { it('should connect and create timeout', async () => { const args = [1, 2, 3]; await reconnectableStream.connect(...args); - expect(reconnectableStream.args).to.deep.equal(args); - expect(reconnectableStream.stream).to.equal(stream); - expect(reconnectableStream.addListeners).to.have.been.calledOnce(); - expect(reconnectableStream.startAutoReconnect).to.have.been.calledOnce(); + expect(reconnectableStream.args) + .to + .deep + .equal(args); + expect(reconnectableStream.stream) + .to + .equal(stream); + expect(reconnectableStream.addListeners) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.startAutoReconnect) + .to + .have + .been + .calledOnce(); }); it('should not initiate auto reconnect if autoReconnectInterval is not set', async () => { reconnectableStream.autoReconnectInterval = 0; await reconnectableStream.connect(); - expect(reconnectableStream.startAutoReconnect).to.have.not.been.called(); + expect(reconnectableStream.startAutoReconnect) + .to + .have + .not + .been + .called(); }); }); describe('#startAutoReconnect', () => { it('should trigger reconnect after timeout', async () => { reconnectableStream.stream = stream; - reconnectableStream.stream.on('error', () => {}); + reconnectableStream.stream.on('error', () => { + }); reconnectableStream.startAutoReconnect(); setTimeoutCallback(); - expect(reconnectableStream.reconnect).to.have.been.calledOnce(); + expect(reconnectableStream.reconnect) + .to + .have + .been + .calledOnce(); }); it('should not allow starting auto reconnect twice', () => { reconnectableStream.startAutoReconnect(); expect(reconnectableStream.startAutoReconnect.bind(reconnectableStream)) - .to.throw('Auto reconnect timeout is already running.'); + .to + .throw('Auto reconnect timeout is already running.'); }); }); @@ -83,26 +112,36 @@ describe('ReconnectableStream', () => { it('should update connect arguments', async () => { reconnectableStream.reconnectTimeout = 1; reconnectableStream.stream = stream; - reconnectableStream.stream.on('error', () => {}); + reconnectableStream.stream.on('error', () => { + }); reconnectableStream.on(ReconnectableStream.EVENTS.BEFORE_RECONNECT, (updateArgs) => { updateArgs('newArg1', 'newArg2'); }); reconnectableStream.reconnect(); - expect(reconnectableStream.connect).to.have.been.calledWith('newArg1', 'newArg2'); + expect(reconnectableStream.connect) + .to + .have + .been + .calledWith('newArg1', 'newArg2'); }); it('should reconnect only if reconnectTimeout exists', () => { reconnectableStream.reconnect(); expect(stream.cancel) - .to.have.not.been.called(); + .to + .have + .not + .been + .called(); }); it('should handle error on reconnect', async () => { reconnectableStream.reconnectTimeout = 1; reconnectableStream.stream = stream; - reconnectableStream.stream.on('error', () => {}); + reconnectableStream.stream.on('error', () => { + }); const errorEventPromise = new Promise((resolve) => { reconnectableStream.on('error', resolve); @@ -112,7 +151,9 @@ describe('ReconnectableStream', () => { reconnectableStream.createStream.throws(err); reconnectableStream.reconnect(); const emittedError = await errorEventPromise; - expect(emittedError).to.equal(err); + expect(emittedError) + .to + .equal(err); }); }); @@ -121,9 +162,21 @@ describe('ReconnectableStream', () => { reconnectableStream.stream = new EventEmitter(); this.sinon.spy(reconnectableStream.stream, 'on'); reconnectableStream.addListeners(); - expect(reconnectableStream.stream.on).to.have.been.calledWith('error'); - expect(reconnectableStream.stream.on).to.have.been.calledWith('data'); - expect(reconnectableStream.stream.on).to.have.been.calledWith('end'); + expect(reconnectableStream.stream.on) + .to + .have + .been + .calledWith('error'); + expect(reconnectableStream.stream.on) + .to + .have + .been + .calledWith('data'); + expect(reconnectableStream.stream.on) + .to + .have + .been + .calledWith('end'); }); it('should rewire cancel logic', function () { @@ -133,9 +186,15 @@ describe('ReconnectableStream', () => { reconnectableStream.addListeners(); reconnectableStream.stream.cancel(); expect(reconnectableStream.stream.removeListener) - .to.have.been.calledWith('data', reconnectableStream.dataHandler); + .to + .have + .been + .calledWith('data', reconnectableStream.dataHandler); expect(reconnectableStream.stream.removeListener) - .to.have.been.calledWith('end', reconnectableStream.endHandler); + .to + .have + .been + .calledWith('end', reconnectableStream.endHandler); }); }); @@ -145,14 +204,23 @@ describe('ReconnectableStream', () => { message: 'CANCELED_ON_CLIENT', code: 1, }); - expect(reconnectableStream.retryOnError).to.have.not.been.called(); + expect(reconnectableStream.retryOnError) + .to + .have + .not + .been + .called(); }); it('should retry on error', function () { reconnectableStream.stream = stream; reconnectableStream.retryOnError = this.sinon.spy(); reconnectableStream.errorHandler(new Error('Retry on error')); - expect(reconnectableStream.retryOnError).to.have.been.calledOnce(); + expect(reconnectableStream.retryOnError) + .to + .have + .been + .calledOnce(); reconnectableStream.stopAutoReconnect(); }); }); @@ -161,15 +229,27 @@ describe('ReconnectableStream', () => { it('should stop reconnect timeout', async () => { reconnectableStream.reconnectTimeout = setTimeoutReference; reconnectableStream.stopAutoReconnect(); - expect(reconnectableStream.clearTimeout).to.have.been + expect(reconnectableStream.clearTimeout) + .to + .have + .been .calledOnceWith(setTimeoutReference); - expect(reconnectableStream.reconnectTimeout).to.equal(null); + expect(reconnectableStream.reconnectTimeout) + .to + .equal(null); }); it('should do nothing in case reconnect timeout is not set', async () => { reconnectableStream.stopAutoReconnect(); - expect(reconnectableStream.clearTimeout).to.have.not.been.called(); - expect(reconnectableStream.reconnectTimeout).to.equal(null); + expect(reconnectableStream.clearTimeout) + .to + .have + .not + .been + .called(); + expect(reconnectableStream.reconnectTimeout) + .to + .equal(null); }); }); @@ -178,17 +258,36 @@ describe('ReconnectableStream', () => { reconnectableStream.stream = new EventEmitter(); reconnectableStream.stream.cancel = this.sinon.stub(); reconnectableStream.cancel(); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.stream.cancel).to.have.been.calledOnce(); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.stream.cancel) + .to + .have + .been + .calledOnce(); }); }); describe('#endHandler', () => { it('should handle end event', async () => { + reconnectableStream.stream = {}; reconnectableStream.endHandler(); - expect(reconnectableStream.stopAutoReconnect).to.have.been.called(); - expect(reconnectableStream.emit).to.have.been.calledWith(ReconnectableStream.EVENTS.END); - expect(reconnectableStream.stream).to.equal(null); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .called(); + expect(reconnectableStream.emit) + .to + .have + .been + .calledWith(ReconnectableStream.EVENTS.END); + expect(reconnectableStream.stream) + .to + .equal(null); }); }); @@ -199,10 +298,26 @@ describe('ReconnectableStream', () => { await wait(10); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('end'); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('data'); - expect(reconnectableStream.connect).to.have.been.calledOnce(); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('end'); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('data'); + expect(reconnectableStream.connect) + .to + .have + .been + .calledOnce(); }); it('should manage args via beforeReconnect', async () => { @@ -217,10 +332,26 @@ describe('ReconnectableStream', () => { await wait(10); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('end'); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('data'); - expect(reconnectableStream.connect).to.have.been.calledOnceWith(newArgs); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('end'); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('data'); + expect(reconnectableStream.connect) + .to + .have + .been + .calledOnceWith(newArgs); }); it('should handle error in case retry attempts were exhausted', async () => { @@ -242,7 +373,9 @@ describe('ReconnectableStream', () => { const error = new Error('Last error'); reconnectableStream.retryOnError(error); - expect(lastError).to.equal(error); + expect(lastError) + .to + .equal(error); }); it('should handle retry error', async () => { @@ -261,11 +394,19 @@ describe('ReconnectableStream', () => { // Wait for await wait(10); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.emit).to.have.been.calledWith( - 'error', - retryError, - ); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.emit) + .to + .have + .been + .calledWith( + 'error', + retryError, + ); }); }); }); diff --git a/packages/js-dash-sdk/.env.example b/packages/js-dash-sdk/.env.example index 2259f834ef5..433998c1d55 100644 --- a/packages/js-dash-sdk/.env.example +++ b/packages/js-dash-sdk/.env.example @@ -1,4 +1,3 @@ DAPI_SEED= FAUCET_PRIVATE_KEY= NETWORK= -DPNS_CONTRACT_ID= diff --git a/packages/js-dash-sdk/docs/platform/names/register.md b/packages/js-dash-sdk/docs/platform/names/register.md index c7171b8bfb9..2f99b536fe8 100644 --- a/packages/js-dash-sdk/docs/platform/names/register.md +++ b/packages/js-dash-sdk/docs/platform/names/register.md @@ -7,11 +7,10 @@ Parameters: |----------------------------------|-----------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **name** | String | yes | An alphanumeric (1-63 character) value used for human-identification (can contain `-` but not as the first or last character). If a name with no parent domain is entered, '.dash' is used. | | **records** | Object | yes | records object having only one of the following items | -| **records.dashUniqueIdentityId** | String | no | Unique Identity ID for this name record | -| **records.dashAliasIdentityId** | String | no | Used to signify that this name is the alias for another id | +| **records.identity** | String | yes | Identity ID for this name record | | **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | -**Example**: `await client.platform.names.register('alice', { dashUniqueIdentityId: identity.getId() }, identity)` +**Example**: `await client.platform.names.register('alice', { identity: identity.getId() }, identity)` Returns: the created domain document diff --git a/packages/js-dash-sdk/docs/platform/names/resolveByRecord.md b/packages/js-dash-sdk/docs/platform/names/resolveByRecord.md index af747c180b4..bb75a03f10d 100644 --- a/packages/js-dash-sdk/docs/platform/names/resolveByRecord.md +++ b/packages/js-dash-sdk/docs/platform/names/resolveByRecord.md @@ -5,7 +5,7 @@ Parameters: | parameters | type | required | Description | |------------|-----------|----------------|----------------------------------------------------------------------| -| **record** | String | yes | Type of the record (`dashUniqueIdentityId` or `dashAliasIdentityId`) | +| **record** | String | yes | Type of the record (`identity`) | | **value** | String | yes | Identifier value for the record | **Example**: @@ -13,7 +13,7 @@ Parameters: This example will describe how to resolve names by the dash unique identity id. ```js const identityId = '3ge4yjGinQDhxh2aVpyLTQaoka45BkijkoybfAkDepoN'; -const document = await client.platform.names.resolveByRecord('dashUniqueIdentityId', identityId); +const document = await client.platform.names.resolveByRecord('identity', identityId); ``` Returns: array of ExtendedDocument. diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 6c2380476c0..b11dcae75c9 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "3.25.21", + "version": "4.1.0-dev.1", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", @@ -29,25 +29,26 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/dashevo/DashJS.git" + "url": "git+https://github.com/dashpay/platform.git" }, - "author": "Dash Core Group ", - "license": "MIT", "bugs": { - "url": "https://github.com/dashevo/DashJS/issues" + "url": "https://github.com/dashpay/platform/issues" }, - "homepage": "https://github.com/dashevo/DashJS#readme", + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/js-dash-sdk#readme", + "author": "Dash Core Group ", + "license": "MIT", "dependencies": { "@dashevo/bls": "~1.2.9", "@dashevo/dapi-client": "workspace:*", "@dashevo/dapi-grpc": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.3", "@dashevo/dashpay-contract": "workspace:*", "@dashevo/dpns-contract": "workspace:*", "@dashevo/grpc-common": "workspace:*", "@dashevo/masternode-reward-shares-contract": "workspace:*", "@dashevo/wallet-lib": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", + "@dashevo/withdrawals-contract": "workspace:*", "bs58": "^4.0.1", "node-inspect-extracted": "^1.0.8", "winston": "^3.2.1" @@ -77,7 +78,7 @@ "eslint-plugin-import": "^2.29.0", "events": "^3.3.0", "https-browserify": "^1.0.0", - "karma": "^6.4.1", + "karma": "^6.4.3", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.1.2", @@ -106,7 +107,7 @@ "typescript": "^3.9.5", "url": "^0.11.3", "util": "^0.12.4", - "webpack": "^5.76.1", - "webpack-cli": "^4.9.1" + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4" } } diff --git a/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts index d677d7d6323..b44f7cd02fd 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts @@ -181,9 +181,9 @@ describe('Dash - Client', function suite() { describe('#platform.identities.topUp', async () => { it('should top up an identity', async () => { // Registering an identity we're going to top up - const identity = await client.platform.identities.register(1000); + const identity = await client.platform.identities.register(200000); // Topping up the identity - await client.platform.identities.topUp(identity.getId(), 1000); + await client.platform.identities.topUp(identity.getId(), 60000); expect(identity).to.be.not.null; @@ -206,7 +206,7 @@ describe('Dash - Client', function suite() { it('should throw TransitionBroadcastError when transport resolves error', async () => { // Registering an identity we're going to top up - const identity = await client.platform.identities.register(10000); + const identity = await client.platform.identities.register(200000); const errorResponse = { error: { @@ -234,7 +234,7 @@ describe('Dash - Client', function suite() { describe('#platform.identities.update', async () => { it('should update an identity', async () => { - const identity = await client.platform.identities.register(1000); + const identity = await client.platform.identities.register(200000); const privateKey = new PrivateKey(privateKeyFixture); @@ -271,7 +271,7 @@ describe('Dash - Client', function suite() { it('should throw TransitionBroadcastError when transport resolves error', async () => { // Registering an identity we're going to top up - const identity = await client.platform.identities.register(10000); + const identity = await client.platform.identities.register(200000); const errorResponse = { error: { @@ -389,7 +389,8 @@ describe('Dash - Client', function suite() { expect(await interceptedSt.verifySignature( identityFixture.getPublicKeyById(2), )).to.be.equal(true); - expect(interceptedSt.getEntropy()).to.be.deep.equal(dataContractFixture.getEntropy()); + expect(interceptedSt.getIdentityNonce()).to.be + .deep.equal(dataContractFixture.getIdentityNonce()); expect(interceptedSt.getDataContract().toObject()) .to.be.deep.equal(dataContractFixture.toObject()); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Client.ts b/packages/js-dash-sdk/src/SDK/Client/Client.ts index c5ed17cec57..7f185677ea5 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Client.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Client.ts @@ -6,6 +6,7 @@ import DAPIClient from '@dashevo/dapi-client'; import { contractId as dpnsContractId } from '@dashevo/dpns-contract/lib/systemIds'; import { contractId as dashpayContractId } from '@dashevo/dashpay-contract/lib/systemIds'; import { contractId as masternodeRewardSharesContractId } from '@dashevo/masternode-reward-shares-contract/lib/systemIds'; +import { contractId as withdrawalsContractId } from '@dashevo/withdrawals-contract/lib/systemIds'; import { Platform } from './Platform'; import { ClientApps, ClientAppsOptions } from './ClientApps'; @@ -138,6 +139,9 @@ export class Client extends EventEmitter { masternodeRewardShares: { contractId: masternodeRewardSharesContractId, }, + withdrawals: { + contractId: withdrawalsContractId, + }, ...this.options.apps, }); @@ -161,6 +165,7 @@ export class Client extends EventEmitter { options = { index: this.defaultAccountIndex, + synchronize: true, ...options, }; @@ -175,6 +180,8 @@ export class Client extends EventEmitter { if (this.wallet) { await this.wallet.disconnect(); } + + await this.dapiClient.disconnect(); } /** diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts index b13472a06db..031601620ed 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts @@ -1,4 +1,4 @@ -import fibonacci from '../../../../utils/fibonacci'; +import { fibonacci } from '../../../../utils/fibonacci'; import { wait } from '../../../../utils/wait'; /** diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts index ce464f641f4..2b679814453 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts @@ -1,6 +1,8 @@ +import { Metadata } from '@dashevo/dapi-client/lib/methods/platform/response/Metadata'; import { IPlatformStateProof } from './IPlatformStateProof'; export interface IStateTransitionResult { + metadata: Metadata, proof?: IPlatformStateProof, error?: { code: number, diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.spec.ts new file mode 100644 index 00000000000..018150fd933 --- /dev/null +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.spec.ts @@ -0,0 +1,97 @@ +import { Identifier } from '@dashevo/wasm-dpp'; +import { expect } from 'chai'; +import NonceManager, { NONCE_FETCH_INTERVAL } from './NonceManager'; + +describe('Dash - NonceManager', () => { + let nonceManager: NonceManager; + let dapiClientMock; + const identityId = new Identifier(Buffer.alloc(32).fill(1)); + const contractId = new Identifier(Buffer.alloc(32).fill(2)); + + beforeEach(function beforeEach() { + dapiClientMock = { + platform: { + getIdentityContractNonce: this.sinon.stub(), + getIdentityNonce: this.sinon.stub(), + }, + }; + + nonceManager = new NonceManager(dapiClientMock); + }); + + describe('Identity nonce', () => { + it('should set and get identity nonce', async () => { + nonceManager.setIdentityNonce(identityId, 1); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(1); + expect(dapiClientMock.platform.getIdentityNonce).to.not.be.called(); + }); + + it('should fetch identity nonce if it is not present', async () => { + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 1 }); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(1); + expect(dapiClientMock.platform.getIdentityNonce).to.be.calledOnce(); + }); + + it('should invalidate and re-fetch nonce after interval passed', async function it() { + const clock = this.sinon.useFakeTimers(); + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 1 }); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(1); + + clock.tick(NONCE_FETCH_INTERVAL + 1); + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 2 }); + await nonceManager.getIdentityNonce(identityId); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(2); + clock.restore(); + }); + + it('should bump identity nonce', async () => { + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 1 }); + const prevNonce = await nonceManager.getIdentityNonce(identityId); + const nextNonce = await nonceManager.bumpIdentityNonce(identityId); + const currentNonce = await nonceManager.getIdentityNonce(identityId); + expect(nextNonce) + .to.equal(currentNonce) + .to.equal(prevNonce + 1); + }); + }); + + describe('Identity contract nonce', () => { + it('should set and get identity contract nonce', async () => { + nonceManager.setIdentityContractNonce(identityId, contractId, 1); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(1); + expect(dapiClientMock.platform.getIdentityContractNonce).to.not.be.called(); + }); + + it('should fetch identity contract nonce if it is not present', async () => { + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 1 }); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(1); + expect(dapiClientMock.platform.getIdentityContractNonce).to.be.calledOnce(); + }); + + it('should invalidate and re-fetch nonce after interval passed', async function it() { + const clock = this.sinon.useFakeTimers(); + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 1 }); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(1); + + clock.tick(NONCE_FETCH_INTERVAL + 1); + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 2 }); + await nonceManager.getIdentityContractNonce(identityId, contractId); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(2); + clock.restore(); + }); + + it('should bump identity contract nonce', async () => { + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 1 }); + const prevNonce = await nonceManager.getIdentityContractNonce(identityId, contractId); + const nextNonce = await nonceManager.bumpIdentityContractNonce(identityId, contractId); + const currentNonce = await nonceManager.getIdentityContractNonce(identityId, contractId); + expect(nextNonce) + .to.equal(currentNonce) + .to.equal(prevNonce + 1); + }); + }); +}); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.ts new file mode 100644 index 00000000000..8c4cc38268c --- /dev/null +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.ts @@ -0,0 +1,162 @@ +import DAPIClient from '@dashevo/dapi-client'; +import { Identifier } from '@dashevo/wasm-dpp'; + +type NonceState = { + value: number, + lastFetchedAt: number, +}; + +// 20 min +export const NONCE_FETCH_INTERVAL = 1200 * 1000; + +class NonceManager { + public dapiClient: DAPIClient; + + private identityNonce: Map; + + private identityContractNonce: Map>; + + constructor(dapiClient: DAPIClient) { + this.dapiClient = dapiClient; + + this.identityNonce = new Map(); + this.identityContractNonce = new Map(); + } + + public setIdentityNonce(identityId: Identifier, nonce: number) { + const identityIdStr = identityId.toString(); + const nonceState = this.identityNonce.get(identityIdStr); + + if (!nonceState) { + this.identityNonce.set(identityIdStr, { + value: nonce, + lastFetchedAt: Date.now(), + }); + } else { + nonceState.value = nonce; + } + } + + public async getIdentityNonce(identityId: Identifier): Promise { + const identityIdStr = identityId.toString(); + let nonceState = this.identityNonce.get(identityIdStr); + + if (typeof nonceState === 'undefined') { + const { identityNonce } = await this.dapiClient.platform.getIdentityNonce(identityId); + + if (typeof identityNonce === 'undefined') { + throw new Error('Identity nonce is not found'); + } + + nonceState = { + value: identityNonce, + lastFetchedAt: Date.now(), + }; + + this.identityNonce.set(identityIdStr, nonceState); + } else { + const now = Date.now(); + if (now - nonceState.lastFetchedAt > NONCE_FETCH_INTERVAL) { + const { identityNonce } = await this.dapiClient.platform.getIdentityNonce(identityId); + + if (typeof identityNonce === 'undefined') { + throw new Error('Identity nonce is not found'); + } + + nonceState.value = identityNonce; + nonceState.lastFetchedAt = now; + } + } + + return nonceState.value; + } + + public async bumpIdentityNonce(identityId: Identifier): Promise { + const nextIdentityNonce = await this.getIdentityNonce(identityId) + 1; + this.setIdentityNonce(identityId, nextIdentityNonce); + return nextIdentityNonce; + } + + public setIdentityContractNonce(identityId: Identifier, contractId: Identifier, nonce: number) { + const identityIdStr = identityId.toString(); + const contractIdStr = contractId.toString(); + + let contractNonce = this.identityContractNonce.get(identityIdStr); + + if (!contractNonce) { + contractNonce = new Map(); + this.identityContractNonce.set(identityIdStr, contractNonce); + } + + const nonceState = contractNonce.get(contractIdStr); + + if (!nonceState) { + contractNonce.set(contractIdStr, { + value: nonce, + lastFetchedAt: Date.now(), + }); + } else { + nonceState.value = nonce; + } + } + + public async getIdentityContractNonce( + identityId: Identifier, + contractId: Identifier, + ): Promise { + const identityIdStr = identityId.toString(); + const contractIdStr = contractId.toString(); + + let contractNonce = this.identityContractNonce.get(identityIdStr); + + if (!contractNonce) { + contractNonce = new Map(); + this.identityContractNonce.set(identityIdStr, contractNonce); + } + + let nonceState = contractNonce.get(contractIdStr); + + if (typeof nonceState === 'undefined') { + const { identityContractNonce } = await this.dapiClient.platform + .getIdentityContractNonce(identityId, contractId); + + if (typeof identityContractNonce === 'undefined') { + throw new Error('Identity contract nonce is not found'); + } + + nonceState = { + value: identityContractNonce, + lastFetchedAt: Date.now(), + }; + + contractNonce.set(contractIdStr, nonceState); + } else { + const now = Date.now(); + if (now - nonceState.lastFetchedAt > NONCE_FETCH_INTERVAL) { + const { identityContractNonce } = await this.dapiClient.platform + .getIdentityContractNonce(identityId, contractId); + + if (typeof identityContractNonce === 'undefined') { + throw new Error('Identity nonce is not found'); + } + + nonceState.value = identityContractNonce; + nonceState.lastFetchedAt = now; + } + } + + return nonceState.value; + } + + public async bumpIdentityContractNonce( + identityId: Identifier, + contractId: Identifier, + ): Promise { + const nextIdentityContractNonce = await this + .getIdentityContractNonce(identityId, contractId) + 1; + this.setIdentityContractNonce(identityId, contractId, nextIdentityContractNonce); + return nextIdentityContractNonce; + } +} + +export default NonceManager; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts index 07e26cb522b..873fe62c53d 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts @@ -21,6 +21,7 @@ import getIdentity from './methods/identities/get'; import registerIdentity from './methods/identities/register'; import topUpIdentity from './methods/identities/topUp'; import creditTransferIdentity from './methods/identities/creditTransfer'; +import creditWithdrawal from './methods/identities/creditWithdrawal'; import updateIdentity from './methods/identities/update'; import createIdentityCreateTransition from './methods/identities/internal/createIdentityCreateTransition'; import createIdentityTopUpTransition from './methods/identities/internal/createIdentityTopUpTransition'; @@ -35,6 +36,7 @@ import broadcastStateTransition from './broadcastStateTransition'; import logger, { ConfigurableLogger } from '../../../logger'; import Fetcher from './Fetcher'; +import NonceManager from './NonceManager/NonceManager'; /** * Interface for PlatformOpts @@ -77,6 +79,7 @@ interface Identities { register: Function, topUp: Function, creditTransfer: Function, + withdrawCredits: Function, update: Function, utils: { createAssetLockTransaction: Function @@ -151,6 +154,8 @@ export class Platform { protected fetcher: Fetcher; + public nonceManager: NonceManager; + /** * Construct some instance of Platform * @@ -181,6 +186,7 @@ export class Platform { topUp: topUpIdentity.bind(this), creditTransfer: creditTransferIdentity.bind(this), update: updateIdentity.bind(this), + withdrawCredits: creditWithdrawal.bind(this), utils: { createAssetLockProof: createAssetLockProof.bind(this), createAssetLockTransaction: createAssetLockTransaction.bind(this), @@ -200,6 +206,7 @@ export class Platform { } this.fetcher = new Fetcher(this.client.getDAPIClient()); + this.nonceManager = new NonceManager(this.client.getDAPIClient()); } async initialize() { diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts index 912cd4fd340..a12b67872f4 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts @@ -22,8 +22,8 @@ export default async function broadcastStateTransition( stateTransition: any, // TODO: restore once validation is done? // eslint-disable-next-line - options: { skipValidation?: boolean; } = {}, -): Promise { + options: { skipValidation?: boolean; } = {}, +): Promise { const { client } = platform; // TODO(versioning): restore diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts index 6b5db8e7453..8b40c79b141 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts @@ -17,7 +17,12 @@ export async function create( await this.initialize(); - const dataContract = this.dpp.dataContract.create(identity.getId(), contractDefinitions); + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + const dataContract = this.dpp.dataContract.create( + identity.getId(), + BigInt(identityNonce), + contractDefinitions, + ); this.logger.debug(`[Contracts#create] created data contract "${dataContract.getId()}"`); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts index e684eab16aa..7347d158b3c 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts @@ -25,12 +25,19 @@ export default async function update( updatedDataContract.incrementVersion(); + const identityId = identity.getId(); + const dataContractId = dataContract.getId(); + + const identityContractNonce = await this.nonceManager + .bumpIdentityContractNonce(identityId, dataContractId); + const dataContractUpdateTransition = dpp.dataContract - .createDataContractUpdateTransition(updatedDataContract); + .createDataContractUpdateTransition(updatedDataContract, BigInt(identityContractNonce)); this.logger.silly(`[DataContract#update] Created data contract update transition ${dataContract.getId()}`); await signStateTransition(this, dataContractUpdateTransition, identity, 2); + // Broadcast state transition also wait for the result to be obtained await broadcastStateTransition(this, dataContractUpdateTransition); this.logger.silly(`[DataContract#update] Broadcasted data contract update transition ${dataContract.getId()}`); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts index 53308978d3b..4bbe6b6479d 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts @@ -31,7 +31,25 @@ export default async function broadcast( const { dpp } = this; - const documentsBatchTransition = dpp.document.createStateTransition(documents); + const identityId = identity.getId(); + const dataContractId = [ + ...(documents.create || []), + ...(documents.replace || []), + ...(documents.delete || []), + ][0]?.getDataContractId(); + + if (!dataContractId) { + throw new Error('Data contract ID is not found'); + } + + const identityContractNonce = await this.nonceManager + .bumpIdentityContractNonce(identityId, dataContractId); + + const documentsBatchTransition = dpp.document.createStateTransition(documents, { + [identityId.toString()]: { + [dataContractId.toString()]: identityContractNonce, + }, + }); this.logger.silly('[Document#broadcast] Created documents batch transition'); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts index 946284560b3..71c0f196584 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts @@ -16,19 +16,23 @@ export async function creditTransfer( recipientId = Identifier.from(recipientId); + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + const identityCreditTransferTransition = dpp.identity .createIdentityCreditTransferTransition( - identity.getId(), + identity, recipientId, BigInt(amount), + BigInt(identityNonce), ); this.logger.silly('[Identity#creditTransfer] Created IdentityCreditTransferTransition'); - const signerKeyIndex = 2; + const signerKeyIndex = 3; await signStateTransition(this, identityCreditTransferTransition, identity, signerKeyIndex); + // Skipping validation because it's already done above await broadcastStateTransition(this, identityCreditTransferTransition, { skipValidation: true, }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts new file mode 100644 index 00000000000..a2bd513397e --- /dev/null +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts @@ -0,0 +1,119 @@ +import { Identity } from '@dashevo/wasm-dpp'; +import { Address, Script } from '@dashevo/dashcore-lib'; +import { Metadata } from '@dashevo/dapi-client/lib/methods/platform/response/Metadata'; +import broadcastStateTransition from '../../broadcastStateTransition'; +import { Platform } from '../../Platform'; +import { signStateTransition } from '../../signStateTransition'; +import { nearestGreaterFibonacci } from '../../../../../utils/fibonacci'; + +export const STATUSES = { + PENDING: 0, + POOLED: 1, + BROADCASTED: 2, + COMPLETED: 3, +}; + +// Implement remaining pooling types when they ready on drive side +const DEFAULT_POOLING = 0; + +// TODO: add to dashcore-lib +// Asset unlock TX size is fixed with the default pooling +// since it has zero inputs and only one output +const ASSET_UNLOCK_TX_SIZE = 190; + +// Minimal accepted core fee per byte to avoid low fee error from core +const MIN_ASSET_UNLOCK_CORE_FEE_PER_BYTE = 1; + +// Minimal withdrawal amount in credits to avoid dust error from core +const MINIMAL_WITHDRAWAL_AMOUNT = ASSET_UNLOCK_TX_SIZE * MIN_ASSET_UNLOCK_CORE_FEE_PER_BYTE * 1000; + +type WithdrawalOptions = { + signingKeyIndex: number +}; + +/** Creates platform credits withdrawal request + * @param identity - identity to withdraw from + * @param amount - amount of credits to withdraw + * @param to - Dash L1 address + * @param options - withdrawal options + */ +export async function creditWithdrawal( + this: Platform, + identity: Identity, + amount: number, + to: string, + options: WithdrawalOptions = { + signingKeyIndex: 3, + }, +): Promise { + await this.initialize(); + + const { dpp } = this; + + let toAddress: Address; + try { + toAddress = new Address(to, this.client.network); + } catch (e) { + throw new Error(`Invalid core recipient "${to}" for network ${this.client.network}`); + } + this.logger.debug(`[Identity#creditWithdrawal] credits withdrawal from ${identity.getId().toString()} to ${toAddress.toString()} with amount ${amount}`); + + const outputScript = Script.buildPublicKeyHashOut(toAddress); + + const balance = identity.getBalance(); + if (amount > balance) { + throw new Error(`Withdrawal amount "${amount}" is bigger that identity balance "${balance}"`); + } + + if (amount < MINIMAL_WITHDRAWAL_AMOUNT) { + throw new Error(`Withdrawal amount "${amount}" is less than minimal allowed withdrawal amount "${MINIMAL_WITHDRAWAL_AMOUNT}"`); + } + + if (!this.client.wallet) { + throw new Error('Wallet is not initialized'); + } + + // Divide by 1000 as stated in policy for GetDustThreshold + // https://github.com/dashpay/dash/blob/master/src/policy/policy.cpp#L23 + const minRelayFeePerByte = Math.ceil(this.client.wallet.storage + .getDefaultChainStore().state.fees.minRelay / 1000); + + const coreFeePerByte = nearestGreaterFibonacci(minRelayFeePerByte); + + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + + const identityCreditWithdrawalTransition = dpp.identity + .createIdentityCreditWithdrawalTransition( + identity.getId(), + BigInt(amount), + coreFeePerByte, + DEFAULT_POOLING, + // @ts-ignore + outputScript.toBuffer(), + BigInt(identityNonce), + ); + + this.logger.silly('[Identity#creditWithdrawal] Created IdentityCreditWithdrawalTransition'); + + await signStateTransition( + this, + identityCreditWithdrawalTransition, + identity, + options.signingKeyIndex, + ); + + // Skipping validation because it's already done above + const stateTransitionResult = await broadcastStateTransition( + this, + identityCreditWithdrawalTransition, + { + skipValidation: true, + }, + ); + + this.logger.silly('[Identity#creditWithdrawal] Broadcasted IdentityCreditWithdrawalTransition'); + + return stateTransitionResult.metadata; +} + +export default creditWithdrawal; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts index 40aaa6ff7ab..83ece7d2377 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts @@ -26,35 +26,55 @@ export async function createIdentityCreateTransition( const identityIndex = await account.getUnusedIdentityIndex(); + // Authentication master key + const { privateKey: identityMasterPrivateKey } = account.identities .getIdentityHDKeyByIndex(identityIndex, 0); const identityMasterPublicKey = identityMasterPrivateKey.toPublicKey(); - const { privateKey: identitySecondPrivateKey } = account.identities + const masterKey = new IdentityPublicKey(1); + masterKey.setId(0); + masterKey.setData(identityMasterPublicKey.toBuffer()); + masterKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MASTER); + + // Authentication high level key + + const { privateKey: identityHighAuthPrivateKey } = account.identities .getIdentityHDKeyByIndex(identityIndex, 1); - const identitySecondPublicKey = identitySecondPrivateKey.toPublicKey(); + const identityHighAuthPublicKey = identityHighAuthPrivateKey.toPublicKey(); + + const highAuthKey = new IdentityPublicKey(1); + highAuthKey.setId(1); + highAuthKey.setData(identityHighAuthPublicKey.toBuffer()); + highAuthKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.HIGH); + + // Authentication critical level key - const { privateKey: identityThirdPrivateKey } = account.identities + const { privateKey: identityCriticalAuthPrivateKey } = account.identities .getIdentityHDKeyByIndex(identityIndex, 2); - const identityThirdPublicKey = identityThirdPrivateKey.toPublicKey(); + const identityCriticalAuthPublicKey = identityCriticalAuthPrivateKey.toPublicKey(); - const keyOne = new IdentityPublicKey(1); - keyOne.setData(identityMasterPublicKey.toBuffer()); + const criticalAuthKey = new IdentityPublicKey(1); + criticalAuthKey.setId(2); + criticalAuthKey.setData(identityCriticalAuthPublicKey.toBuffer()); + criticalAuthKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.CRITICAL); - const keyTwo = new IdentityPublicKey(1); - keyTwo.setId(1); - keyTwo.setData(identitySecondPublicKey.toBuffer()); - keyTwo.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.HIGH); + // Transfer key - const keyThree = new IdentityPublicKey(1); - keyThree.setId(2); - keyThree.setData(identityThirdPublicKey.toBuffer()); - keyThree.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.CRITICAL); + const { privateKey: identityTransferPrivateKey } = account.identities + .getIdentityHDKeyByIndex(identityIndex, 3); + const identityTransferPublicKey = identityTransferPrivateKey.toPublicKey(); + + const transferKey = new IdentityPublicKey(1); + transferKey.setId(3); + transferKey.setPurpose(IdentityPublicKey.PURPOSES.TRANSFER); + transferKey.setData(identityTransferPublicKey.toBuffer()); + transferKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.CRITICAL); // Create Identity const identity = dpp.identity.create( assetLockProof.createIdentifier(), - [keyOne, keyTwo, keyThree], + [masterKey, highAuthKey, criticalAuthKey, transferKey], ); // Create ST @@ -64,35 +84,62 @@ export async function createIdentityCreateTransition( ); // Create key proofs - const [masterKey, secondKey, thirdKey] = identityCreateTransition.getPublicKeys(); + const [ + stMasterKey, stHighAuthKey, stCriticalAuthKey, stTransferKey, + ] = identityCreateTransition.getPublicKeys(); + + // Sign master key + + identityCreateTransition.signByPrivateKey( + identityMasterPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); - await identityCreateTransition - .signByPrivateKey(identityMasterPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); + stMasterKey.setSignature(identityCreateTransition.getSignature()); - masterKey.setSignature(identityCreateTransition.getSignature()); + identityCreateTransition.setSignature(undefined); + + // Sign high auth key + + identityCreateTransition.signByPrivateKey( + identityHighAuthPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); + + stHighAuthKey.setSignature(identityCreateTransition.getSignature()); identityCreateTransition.setSignature(undefined); - await identityCreateTransition - .signByPrivateKey(identitySecondPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); + // Sign critical auth key - secondKey.setSignature(identityCreateTransition.getSignature()); + identityCreateTransition.signByPrivateKey( + identityCriticalAuthPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); + + stCriticalAuthKey.setSignature(identityCreateTransition.getSignature()); identityCreateTransition.setSignature(undefined); - await identityCreateTransition - .signByPrivateKey(identityThirdPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); + // Sign transfer key + + identityCreateTransition.signByPrivateKey( + identityTransferPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); - thirdKey.setSignature(identityCreateTransition.getSignature()); + stTransferKey.setSignature(identityCreateTransition.getSignature()); identityCreateTransition.setSignature(undefined); // Set public keys back after updating their signatures - identityCreateTransition.setPublicKeys([masterKey, secondKey, thirdKey]); + identityCreateTransition.setPublicKeys([ + stMasterKey, stHighAuthKey, stCriticalAuthKey, stTransferKey, + ]); // Sign and validate state transition - await identityCreateTransition + identityCreateTransition .signByPrivateKey(assetLockPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); // TODO(versioning): restore diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts index b147e32b20c..a3ea11f9b14 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts @@ -1,4 +1,3 @@ -import { ownerId as dpnsOwnerId } from '@dashevo/dpns-contract/lib/systemIds'; import { Platform } from '../../../Platform'; export async function waitForCoreChainLockedHeight( @@ -19,15 +18,9 @@ export async function waitForCoreChainLockedHeight( const promise = new Promise((resolve, reject) => { async function obtainCoreChainLockedHeight() { try { - const identityResponse = await platform.identities.get(dpnsOwnerId); + const response = await platform.client.getDAPIClient().platform.getEpochsInfo(0, 1); - if (!identityResponse) { - reject(new Error('Identity using to obtain core chain locked height is not present')); - - return; - } - - const metadata = identityResponse.getMetadata(); + const metadata = response.getMetadata(); coreChainLockedHeight = metadata.getCoreChainLockedHeight(); } catch (e) { diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts index 0ba6e5dcd21..941e75d303b 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts @@ -28,8 +28,11 @@ export async function update( const { dpp } = this; + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + const identityUpdateTransition = dpp.identity.createIdentityUpdateTransition( identity, + BigInt(identityNonce), publicKeys, ); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts index 363a60bcfdb..a0648c820d2 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts @@ -53,7 +53,7 @@ describe('Platform', () => { identityMock.getId.returns(identityId); await register.call(platformMock, 'Dash', { - dashUniqueIdentityId: identityId, + identity: identityId, }, identityMock); expect(platformMock.documents.create.getCall(0).args[0]).to.deep.equal('dpns.preorder'); @@ -72,7 +72,7 @@ describe('Platform', () => { normalizedParentDomainName: '', preorderSalt: Buffer.alloc(32), records: { - dashUniqueIdentityId: identityId, + identity: identityId, }, subdomainRules: { allowSubdomains: true, @@ -86,7 +86,7 @@ describe('Platform', () => { identityMock.getId.returns(identityId); await register.call(platformMock, 'User.dash', { - dashAliasIdentityId: identityId, + identity: identityId, }, identityMock); expect(platformMock.documents.create.getCall(0).args[0]).to.deep.equal('dpns.preorder'); @@ -105,7 +105,7 @@ describe('Platform', () => { normalizedParentDomainName: 'dash', preorderSalt: Buffer.alloc(32), records: { - dashAliasIdentityId: identityId, + identity: identityId, }, subdomainRules: { allowSubdomains: false, @@ -119,7 +119,7 @@ describe('Platform', () => { try { await register.call(platformMock, 'user.dash', { - dashUniqueIdentityId: await generateRandomIdentifier(), + identity: await generateRandomIdentifier(), }, identityMock); } catch (e) { expect(e.message).to.equal('DPNS is required to register a new name.'); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts index 86b07270d43..07f6576e782 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts @@ -11,8 +11,7 @@ const { hash } = require('@dashevo/wasm-dpp/lib/utils/hash'); * @param {Platform} this - bound instance class * @param {string} name - name * @param {Object} records - records object having only one of the following items - * @param {string} [records.dashUniqueIdentityId] - * @param {string} [records.dashAliasIdentityId] + * @param {string} [records.identity] * @param identity - identity * * @returns registered domain document @@ -21,8 +20,7 @@ export async function register( this: Platform, name: string, records: { - dashUniqueIdentityId?: Identifier | string, - dashAliasIdentityId?: Identifier | string, + identity?: Identifier | string, }, identity: { getId(): Identifier; @@ -31,12 +29,8 @@ export async function register( ): Promise { await this.initialize(); - if (records.dashUniqueIdentityId) { - records.dashUniqueIdentityId = Identifier.from(records.dashUniqueIdentityId); - } - - if (records.dashAliasIdentityId) { - records.dashAliasIdentityId = Identifier.from(records.dashAliasIdentityId); + if (records.identity) { + records.identity = Identifier.from(records.identity); } const nameLabels = name.split('.'); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts index 3a1a765a59f..0bcd4b2a75c 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts @@ -9,7 +9,7 @@ import { Platform } from '../../Platform'; export async function resolveByRecord(this: Platform, record: string, value: any): Promise { await this.initialize(); - if (record === 'dashUniqueIdentityId' || record === 'dashAliasIdentityId') { + if (record === 'identity') { value = Identifier.from(value); } diff --git a/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts b/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts index 062cb2cc73c..986e6e10d7e 100644 --- a/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts +++ b/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts @@ -16,6 +16,7 @@ export async function createIdentityFixtureInAccount(account) { const publicKeyOne = new IdentityPublicKey(1); publicKeyOne.setData(identityMasterPrivateKey.toPublicKey().toBuffer()); + publicKeyOne.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MASTER); const publicKeyTwo = new IdentityPublicKey(1); publicKeyTwo.setId(1); diff --git a/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts b/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts index fe0655ea2ee..b59c77b43f0 100644 --- a/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts +++ b/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts @@ -9,6 +9,7 @@ import { createDapiClientMock } from './createDapiClientMock'; import { wait } from '../../utils/wait'; const GetIdentityResponse = require('@dashevo/dapi-client/lib/methods/platform/getIdentity/GetIdentityResponse'); +const NotFoundError = require('@dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError'); const TxStreamMock = require('@dashevo/wallet-lib/src/test/mocks/TxStreamMock'); const TxStreamDataResponseMock = require('@dashevo/wallet-lib/src/test/mocks/TxStreamDataResponseMock'); @@ -84,6 +85,7 @@ export async function createAndAttachTransportMocksToClient(client, sinon) { // Mock dapi client for platform endpoints client.dapiClient = dapiClientMock; client.platform.fetcher.dapiClient = dapiClientMock; + client.platform.nonceManager.dapiClient = dapiClientMock; // Starting account sync const accountPromise = client.wallet.getAccount(); @@ -102,7 +104,8 @@ export async function createAndAttachTransportMocksToClient(client, sinon) { await accountPromise; // Putting data in transport stubs - transportMock.getIdentitiesByPublicKeyHashes.resolves([]); + transportMock.getIdentityByPublicKeyHash + .rejects(new NotFoundError('Identity not found', {}, null)); makeTxStreamEmitISLocksForTransactions(transportMock, txStreamMock); await makeGetIdentityRespondWithIdentity(client, dapiClientMock); diff --git a/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts b/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts index b5242efd843..b0f73ee401b 100644 --- a/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts +++ b/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts @@ -7,6 +7,8 @@ export function createDapiClientMock(sinon: SinonSandbox) { getIdentity: sinon.stub(), waitForStateTransitionResult: sinon.stub().resolves({}), getDataContract: sinon.stub(), + getIdentityContractNonce: sinon.stub().resolves({ identityContractNonce: 1 }), + getIdentityNonce: sinon.stub().resolves({ identityNonce: 1 }), }, }; } diff --git a/packages/js-dash-sdk/src/utils/fibonacci.ts b/packages/js-dash-sdk/src/utils/fibonacci.ts index 22ceb5c1c4e..3a8fd66b88a 100644 --- a/packages/js-dash-sdk/src/utils/fibonacci.ts +++ b/packages/js-dash-sdk/src/utils/fibonacci.ts @@ -1,8 +1,16 @@ -const fibonacci = (n) => { +export const fibonacci = (n: number): number => { if (n < 2) { return n; } return fibonacci(n - 1) + fibonacci(n - 2); }; -export default fibonacci; +export const nearestGreaterFibonacci = (value: number) => { + const phi = (1 + Math.sqrt(5)) / 2; + + // Use the rearranged Binet's formula to find the nearest index + const n = Math.ceil(Math.log(value * Math.sqrt(5) + 0.5) / Math.log(phi)); + + // Calculate the Fibonacci number using Binet's formula + return Math.round(phi ** n / Math.sqrt(5)); +}; diff --git a/packages/js-dash-sdk/tests/functional/sdk.js b/packages/js-dash-sdk/tests/functional/sdk.js index bdc800bfe00..5f24b7b7a34 100644 --- a/packages/js-dash-sdk/tests/functional/sdk.js +++ b/packages/js-dash-sdk/tests/functional/sdk.js @@ -2,6 +2,8 @@ const { expect } = require('chai'); const { Identifier } = require('@dashevo/wasm-dpp'); +const { contractId: dpnsContractIdString } = require('@dashevo/dpns-contract/lib/systemIds'); + const { Networks, } = require('@dashevo/dashcore-lib'); @@ -17,7 +19,7 @@ describe('SDK', function suite() { let clientInstance; beforeEach(async () => { - dpnsContractId = Identifier.from(process.env.DPNS_CONTRACT_ID); + dpnsContractId = Identifier.from(dpnsContractIdString); const clientOpts = { seeds: process.env.DAPI_SEED.split(','), diff --git a/packages/js-grpc-common/index.js b/packages/js-grpc-common/index.js index ed85e5354ca..add20ba40f3 100644 --- a/packages/js-grpc-common/index.js +++ b/packages/js-grpc-common/index.js @@ -22,6 +22,7 @@ const ResourceExhaustedGrpcError = require('./lib/server/error/ResourceExhausted const DeadlineExceededGrpcError = require('./lib/server/error/DeadlineExceededGrpcError'); const NotFoundGrpcError = require('./lib/server/error/NotFoundGrpcError'); const UnavailableGrpcError = require('./lib/server/error/UnavailableGrpcError'); +const UnimplementedGrpcError = require('./lib/server/error/UnimplementedGrpcError'); const AlreadyExistsGrpcError = require('./lib/server/error/AlreadyExistsGrpcError'); const GrpcError = require('./lib/server/error/GrpcError'); @@ -59,6 +60,7 @@ module.exports = { NotFoundGrpcError, UnavailableGrpcError, AlreadyExistsGrpcError, + UnimplementedGrpcError, }, checks: { checkVersionWrapperFactory, diff --git a/packages/js-grpc-common/lib/server/error/UnimplementedGrpcError.js b/packages/js-grpc-common/lib/server/error/UnimplementedGrpcError.js new file mode 100644 index 00000000000..a9a054c9b8c --- /dev/null +++ b/packages/js-grpc-common/lib/server/error/UnimplementedGrpcError.js @@ -0,0 +1,14 @@ +const GrpcError = require('./GrpcError'); +const GrpcErrorCodes = require('./GrpcErrorCodes'); + +class UnimplementedGrpcError extends GrpcError { + /** + * @param {string} message + * @param {Object} [metadata] + */ + constructor(message, metadata = undefined) { + super(GrpcErrorCodes.UNIMPLEMENTED, message, metadata); + } +} + +module.exports = UnimplementedGrpcError; diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index b63941f2870..8eac2a82bf2 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,8 +1,16 @@ { "name": "@dashevo/grpc-common", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Common GRPC library", "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/js-grpc-common#readme", "scripts": { "build": "", "lint": "eslint .", diff --git a/packages/masternode-reward-shares-contract/.eslintrc b/packages/masternode-reward-shares-contract/.eslintrc index 333860e2f93..cb6c7636b60 100644 --- a/packages/masternode-reward-shares-contract/.eslintrc +++ b/packages/masternode-reward-shares-contract/.eslintrc @@ -1,15 +1,18 @@ { - "extends": "airbnb-base", - "rules": { - "no-plusplus": 0, - "eol-last": [ - "error", - "always" - ], - "class-methods-use-this": "off", - "curly": [ - "error", - "all" - ] - } + "extends": "airbnb-base", + "rules": { + "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "class-methods-use-this": "off", + "curly": [ + "error", + "all" + ] + }, + "globals": { + "BigInt": true + } } diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index f18d7c30e78..61266726822 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/masternode-reward-shares-contract/lib/systemIds.js b/packages/masternode-reward-shares-contract/lib/systemIds.js index caeaa27c46e..773eba4640d 100644 --- a/packages/masternode-reward-shares-contract/lib/systemIds.js +++ b/packages/masternode-reward-shares-contract/lib/systemIds.js @@ -1,4 +1,4 @@ module.exports = { - ownerId: 'BjDiho3ahEBT6w45YungawKrUcqCZ7q7p46FXwnoakXR', + ownerId: '11111111111111111111111111111111', contractId: 'rUnsWrFu3PKyRMGk2mxmZVBPbQuZx2qtHeFjURoQevX', }; diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 484ccbfda10..83f9bafaf5c 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", @@ -30,6 +30,14 @@ } ], "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/masternode-reward-shares-contract#readme", "devDependencies": { "@dashevo/wasm-dpp": "workspace:*", "chai": "^4.3.10", diff --git a/packages/masternode-reward-shares-contract/schema/masternode-reward-shares-documents.json b/packages/masternode-reward-shares-contract/schema/v1/masternode-reward-shares-documents.json similarity index 100% rename from packages/masternode-reward-shares-contract/schema/masternode-reward-shares-documents.json rename to packages/masternode-reward-shares-contract/schema/v1/masternode-reward-shares-documents.json diff --git a/packages/masternode-reward-shares-contract/src/error.rs b/packages/masternode-reward-shares-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/masternode-reward-shares-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/masternode-reward-shares-contract/src/lib.rs b/packages/masternode-reward-shares-contract/src/lib.rs index 5d9a0fe4004..7563fada094 100644 --- a/packages/masternode-reward-shares-contract/src/lib.rs +++ b/packages/masternode-reward-shares-contract/src/lib.rs @@ -1,5 +1,9 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::Error; +use platform_version::version::PlatformVersion; use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ @@ -7,27 +11,28 @@ pub const ID_BYTES: [u8; 32] = [ 68, 99, 238, 176, 31, 247, 33, 149, 144, 149, 140, ]; -pub const OWNER_ID_BYTES: [u8; 32] = [ - 159, 101, 165, 10, 103, 89, 107, 118, 134, 35, 62, 205, 14, 245, 130, 168, 86, 190, 41, 247, - 139, 113, 170, 202, 91, 69, 135, 242, 242, 219, 97, 152, -]; +pub const OWNER_ID_BYTES: [u8; 32] = [0; 32]; pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); -pub mod document_types { - pub mod reward_share { - pub const NAME: &str = "rewardShare"; - - pub mod properties { - pub const PAY_TO_ID: &str = "payToId"; - pub const PERCENTAGE: &str = "percentage"; - } +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.withdrawals { + 0 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "masternode_reward_shares_contract::load_definitions".to_string(), + known_versions: vec![0], + received: version, + }), } } - -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!( - "../schema/masternode-reward-shares-documents.json" - )) +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.withdrawals { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "masternode_reward_shares_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/masternode-reward-shares-contract/src/v1/mod.rs b/packages/masternode-reward-shares-contract/src/v1/mod.rs new file mode 100644 index 00000000000..0af222aa0b7 --- /dev/null +++ b/packages/masternode-reward-shares-contract/src/v1/mod.rs @@ -0,0 +1,20 @@ +use crate::error::Error; +use serde_json::Value; + +pub mod document_types { + pub mod reward_share { + pub const NAME: &str = "rewardShare"; + + pub mod properties { + pub const PAY_TO_ID: &str = "payToId"; + pub const PERCENTAGE: &str = "percentage"; + } + } +} + +pub(super) fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!( + "../../schema/v1/masternode-reward-shares-documents.json" + )) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js b/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js index 704249bc68a..e2eae634f1e 100644 --- a/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js +++ b/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js @@ -1,17 +1,26 @@ -const { DashPlatformProtocol, JsonSchemaError } = require('@dashevo/wasm-dpp'); +const { + DashPlatformProtocol, + JsonSchemaError, +} = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); const { expect } = require('chai'); const crypto = require('crypto'); -const rewardSharingContractSchema = require('../../schema/masternode-reward-shares-documents.json'); +const rewardSharingContractSchema = require('../../schema/v1/masternode-reward-shares-documents.json'); const expectJsonSchemaError = (validationResult, errorCount = 1) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(errorCount); + expect(errors) + .to + .have + .length(errorCount); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -29,7 +38,11 @@ describe('Masternode reward shares contract', () => { identityId = await generateRandomIdentifier(); - contract = dpp.dataContract.create(identityId, rewardSharingContractSchema); + contract = dpp.dataContract.create( + identityId, + BigInt(1), + rewardSharingContractSchema, + ); rewardShare = { payToId: await generateRandomIdentifier(), @@ -38,8 +51,10 @@ describe('Masternode reward shares contract', () => { }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, rewardSharingContractSchema)) - .to.not.throw(); + expect(() => dpp.dataContract.create(identityId, BigInt(1), rewardSharingContractSchema)) + .to + .not + .throw(); }); describe('payToId', () => { @@ -50,22 +65,28 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('payToId'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('payToId'); }); it('should have no less than 32 bytes', () => { rewardShare.payToId = Buffer.alloc(31); expect(() => dpp.document.create(contract, identityId, 'rewardShare', rewardShare)) - .to.throw(); + .to + .throw(); }); it('should have no more than 32 bytes', async () => { rewardShare.payToId = Buffer.alloc(33); expect(() => dpp.document.create(contract, identityId, 'rewardShare', rewardShare)) - .to.throw(); + .to + .throw(); }); }); @@ -77,8 +98,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('percentage'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('percentage'); }); it('should not be less than 1', () => { @@ -88,8 +113,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/percentage'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/percentage'); }); it('should not be more than 10000', () => { @@ -99,8 +128,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maximum'); - expect(error.instancePath).to.equal('/percentage'); + expect(error.keyword) + .to + .equal('maximum'); + expect(error.instancePath) + .to + .equal('/percentage'); }); it('should be a number', () => { @@ -110,9 +143,15 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.equal('/percentage'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .equal('/percentage'); + expect(error.params.type) + .to + .equal('integer'); }); }); @@ -123,7 +162,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); }); diff --git a/packages/platform-test-suite/.env.example b/packages/platform-test-suite/.env.example index 627cc80d497..07cec90407e 100644 --- a/packages/platform-test-suite/.env.example +++ b/packages/platform-test-suite/.env.example @@ -12,10 +12,6 @@ NETWORK= # Start to sync wallet from specific height to speed up the sync process # SKIP_SYNC_BEFORE_HEIGHT= -# System Data Contract info required for some tests -DPNS_OWNER_PRIVATE_KEY= -FEATURE_FLAGS_OWNER_PRIVATE_KEY= -DASHPAY_OWNER_PRIVATE_KEY= # MASTERNODE_OWNER_PRO_REG_TX_HASH= # MASTERNODE_OWNER_MASTER_PRIVATE_KEY= diff --git a/packages/platform-test-suite/bin/test.sh b/packages/platform-test-suite/bin/test.sh index cceae71906e..898ea52e9f8 100755 --- a/packages/platform-test-suite/bin/test.sh +++ b/packages/platform-test-suite/bin/test.sh @@ -13,11 +13,6 @@ Usage: test [options] -k=key --faucet-key=key - faucet private key string -n=network --network=network - use regtest, devnet or testnet --skip-sync-before-height=H - start sync funding wallet from specific height - --dpns-tld-identity-private-key=private_key - top level identity private key - --dpns-tld-identity-id=tld_identity_id - top level identity id - --dpns-contract-id=tld_contract_id - dpns contract id - --feature-flags-identity-id=ff_identity_id - feature-flags contract id - --feature-flags-contract-id=ff_contract_id - feature-flags contract id --faucet-wallet-use-storage=true - use persistent wallet storage for faucet --faucet-wallet-storage-dir=absolute_dir - specify directory where faucet wallet persistent storage will be stored -b --bail - bail after first test failure @@ -60,21 +55,6 @@ case ${i} in --skip-sync-before-height=*) skip_sync_before_height="${i#*=}" ;; - --dpns-tld-identity-private-key=*) - identity_private_key="${i#*=}" - ;; - --dpns-tld-identity-id=*) - tld_identity_id="${i#*=}" - ;; - --dpns-contract-id=*) - tld_contract_id="${i#*=}" - ;; - --feature-flags-identity-id=*) - ff_identity_id="${i#*=}" - ;; - --feature-flags-contract-id=*) - ff_contract_id="${i#*=}" - ;; -b|--bail) bail=true ;; @@ -159,31 +139,6 @@ then cmd="${cmd} SKIP_SYNC_BEFORE_HEIGHT=${skip_sync_before_height}" fi -if [ -n "$tld_contract_id" ] -then - cmd="${cmd} DPNS_CONTRACT_ID=${tld_contract_id}" -fi - -if [ -n "$tld_identity_id" ] -then - cmd="${cmd} DPNS_TOP_LEVEL_IDENTITY_ID=${tld_identity_id}" -fi - -if [ -n "$ff_identity_id" ] -then - cmd="${cmd} FEATURE_FLAGS_IDENTITY_ID=${ff_identity_id}" -fi - -if [ -n "$ff_contract_id" ] -then - cmd="${cmd} FEATURE_FLAGS_CONTRACT_ID=${ff_contract_id}" -fi - -if [ -n "$identity_private_key" ] -then - cmd="${cmd} DPNS_TOP_LEVEL_IDENTITY_PRIVATE_KEY=${identity_private_key}" -fi - if [ -n "$faucet_wallet_use_storage" ] then cmd="${cmd} FAUCET_WALLET_USE_STORAGE=${faucet_wallet_use_storage}" diff --git a/packages/platform-test-suite/lib/test/bootstrap.js b/packages/platform-test-suite/lib/test/bootstrap.js index 477b2cfdb6e..f4e9d46724b 100644 --- a/packages/platform-test-suite/lib/test/bootstrap.js +++ b/packages/platform-test-suite/lib/test/bootstrap.js @@ -10,6 +10,10 @@ use(chaiAsPromised); use(dirtyChai); use(sinonChai); +dotenvSafe.config({ + path: path.resolve(__dirname, '..', '..', '.env'), +}); + process.env.NODE_ENV = 'test'; let faucetIndex = 1; @@ -21,10 +25,6 @@ if (process.env.MOCHA_WORKER_ID) { process.env.FAUCET_ADDRESS = process.env[`FAUCET_${faucetIndex}_ADDRESS`]; process.env.FAUCET_PRIVATE_KEY = process.env[`FAUCET_${faucetIndex}_PRIVATE_KEY`]; -dotenvSafe.config({ - path: path.resolve(__dirname, '..', '..', '.env'), -}); - exports.mochaHooks = { beforeEach() { if (!this.sinon) { diff --git a/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js b/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js index 7fa02011661..b2b302ff4e2 100644 --- a/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js +++ b/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js @@ -61,7 +61,7 @@ async function createClientWithFundedWallet(amount, HDPrivateKey = undefined) { await fundWallet(faucetClient.wallet, client.wallet, amount); if (useFaucetWalletStorage) { - await faucetClient.wallet.disconnect(); + await faucetClient.disconnect(); } return client; diff --git a/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js b/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js index 7c62e08ac24..5acec950e51 100644 --- a/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js +++ b/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js @@ -10,11 +10,12 @@ const { let randomOwnerId = null; /** - * + * @param {number} identityNonce * @param {Identifier} [ownerId] * @return {Promise} */ module.exports = async function getDataContractFixture( + identityNonce, ownerId = randomOwnerId, ) { const { DataContractFactory, Identifier, getLatestProtocolVersion } = await Platform @@ -150,5 +151,5 @@ module.exports = async function getDataContractFixture( documentsMutableContractDefault: true, }; - return factory.create(ownerId, documents, config); + return factory.create(ownerId, BigInt(identityNonce), documents, config); }; diff --git a/packages/platform-test-suite/lib/test/karma/bootstrap.js b/packages/platform-test-suite/lib/test/karma/bootstrap.js index 4ed1d836b8a..d76c466bdbc 100644 --- a/packages/platform-test-suite/lib/test/karma/bootstrap.js +++ b/packages/platform-test-suite/lib/test/karma/bootstrap.js @@ -3,6 +3,7 @@ const dirtyChai = require('dirty-chai'); const chaiAsPromised = require('chai-as-promised'); const sinon = require('sinon'); const sinonChai = require('sinon-chai'); +require('setimmediate'); use(chaiAsPromised); use(dirtyChai); diff --git a/packages/platform-test-suite/lib/waitForBlocks.js b/packages/platform-test-suite/lib/waitForBlocks.js index 4f0be6d4bf0..e1f826418ba 100644 --- a/packages/platform-test-suite/lib/waitForBlocks.js +++ b/packages/platform-test-suite/lib/waitForBlocks.js @@ -7,11 +7,11 @@ const wait = require('./wait'); * @return {Promise} */ module.exports = async function waitForBlocks(dapiClient, numberOfBlocks) { - let { chain: { blocksCount: currentBlockHeight } } = await dapiClient.core.getStatus(); + let currentBlockHeight = await dapiClient.core.getBestBlockHeight(); const desiredBlockHeight = currentBlockHeight + numberOfBlocks; do { - ({ chain: { blocksCount: currentBlockHeight } } = await dapiClient.core.getStatus()); + currentBlockHeight = await dapiClient.core.getBestBlockHeight(); if (currentBlockHeight < desiredBlockHeight) { await wait(5000); diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 9c3ac419b55..49d7fe717ce 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", @@ -15,22 +15,23 @@ }, "repository": { "type": "git", - "url": "git+ssh://git@github.com/dashevo/platform-test-suite.git" + "url": "git+https://github.com/dashpay/platform.git" }, - "license": "MIT", "bugs": { - "url": "https://github.com/dashevo/platform-test-suite/issues" + "url": "https://github.com/dashpay/platform/issues" }, - "homepage": "https://github.com/dashevo/platform-test-suite#readme", + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/platform-test-suite#readme", + "license": "MIT", "dependencies": { "@dashevo/dapi-client": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.3", "@dashevo/dpns-contract": "workspace:*", "@dashevo/feature-flags-contract": "workspace:*", "@dashevo/grpc-common": "workspace:*", "@dashevo/masternode-reward-shares-contract": "workspace:*", "@dashevo/wallet-lib": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", + "@dashevo/withdrawals-contract": "workspace:*", "assert": "^2.0.0", "assert-browserify": "^2.0.0", "browserify-zlib": "^0.2.0", @@ -46,7 +47,7 @@ "glob": "^10.3.4", "https-browserify": "^1.0.0", "js-merkle": "^0.1.5", - "karma": "^6.4.1", + "karma": "^6.4.3", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.1.2", @@ -62,6 +63,7 @@ "path-browserify": "^1.0.1", "process": "^0.11.10", "semver": "^7.5.3", + "setimmediate": "^1.0.5", "sinon": "^17.0.1", "sinon-chai": "^3.7.0", "stream-browserify": "^3.0.0", @@ -72,7 +74,7 @@ "utf-8-validate": "^5.0.9", "util": "^0.12.4", "webpack": "^5.76.1", - "ws": "^7.5.3" + "ws": "^8.17.1" }, "devDependencies": { "eslint": "^8.53.0", diff --git a/packages/platform-test-suite/test/e2e/contacts.spec.js b/packages/platform-test-suite/test/e2e/contacts.spec.js index df15ff694fc..fe8eaf2fced 100644 --- a/packages/platform-test-suite/test/e2e/contacts.spec.js +++ b/packages/platform-test-suite/test/e2e/contacts.spec.js @@ -1,4 +1,12 @@ -const { Identifier } = require('@dashevo/wasm-dpp'); +const Dash = require('dash'); + +const { + PlatformProtocol: { + Identifier, + IdentityPublicKey, + IdentityPublicKeyWithWitness, + }, +} = Dash; const createClientWithFundedWallet = require('../../lib/test/createClientWithFundedWallet'); const waitForSTPropagated = require('../../lib/waitForSTPropagated'); @@ -49,6 +57,8 @@ describe('e2e', () => { }, contact: { type: 'object', + requiresIdentityEncryptionBoundedKey: 2, + requiresIdentityDecryptionBoundedKey: 2, indices: [ { name: 'onwerIdToUserId', @@ -94,9 +104,9 @@ describe('e2e', () => { describe('Bob', () => { it('should create user wallet and identity', async () => { // Create Bob wallet - bobClient = await createClientWithFundedWallet(400000); + bobClient = await createClientWithFundedWallet(500000); - bobIdentity = await bobClient.platform.identities.register(300000); + bobIdentity = await bobClient.platform.identities.register(400000); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -149,6 +159,63 @@ describe('e2e', () => { expect(fetchedProfile.toObject()).to.be.deep.equal(profile.toObject()); }); + + it('should add encryption and decryption keys to the identity', async () => { + const account = await bobClient.getWalletAccount(); + + const numKeys = bobIdentity.getPublicKeys().length; + const identityIndex = await account.getUnusedIdentityIndex(); + + const { privateKey: encryptionPrivateKey } = account + .identities + .getIdentityHDKeyByIndex(identityIndex, 1); + + const { privateKey: decryptionPrivateKey } = account + .identities + .getIdentityHDKeyByIndex(identityIndex, 2); + + const encryptionPublicKey = new IdentityPublicKeyWithWitness(1); + encryptionPublicKey.setId(numKeys + 1); + encryptionPublicKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MEDIUM); + encryptionPublicKey.setPurpose(IdentityPublicKey.PURPOSES.ENCRYPTION); + encryptionPublicKey.setContractBounds(dataContract.getId(), 'contact'); + encryptionPublicKey.setData(encryptionPrivateKey.toPublicKey().toBuffer()); + + const decryptionPublicKey = new IdentityPublicKeyWithWitness(1); + decryptionPublicKey.setId(numKeys + 2); + decryptionPublicKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MEDIUM); + decryptionPublicKey.setPurpose(IdentityPublicKey.PURPOSES.DECRYPTION); + decryptionPublicKey.setContractBounds(dataContract.getId(), 'contact'); + decryptionPublicKey.setData(decryptionPrivateKey.toPublicKey().toBuffer()); + + const update = { + add: [encryptionPublicKey, decryptionPublicKey], + }; + + await bobClient.platform.identities.update( + bobIdentity, + update, + { + [encryptionPublicKey.getId()]: encryptionPrivateKey, + [decryptionPublicKey.getId()]: decryptionPrivateKey, + }, + ); + + await waitForSTPropagated(); + + const { identitiesKeys } = await bobClient.getDAPIClient().platform + .getIdentitiesContractKeys( + [bobIdentity.getId()], + dataContract.getId(), + [IdentityPublicKey.PURPOSES.ENCRYPTION, IdentityPublicKey.PURPOSES.DECRYPTION], + 'contact', + ); + + const bobKeys = identitiesKeys[bobIdentity.getId().toString()]; + expect(bobKeys).to.exist(); + expect(bobKeys[IdentityPublicKey.PURPOSES.ENCRYPTION]).to.have.length(1); + expect(bobKeys[IdentityPublicKey.PURPOSES.DECRYPTION]).to.have.length(1); + }); }); describe('Alice', () => { diff --git a/packages/platform-test-suite/test/e2e/dpns.spec.js b/packages/platform-test-suite/test/e2e/dpns.spec.js index e8cc3218a48..786f583f873 100644 --- a/packages/platform-test-suite/test/e2e/dpns.spec.js +++ b/packages/platform-test-suite/test/e2e/dpns.spec.js @@ -2,7 +2,6 @@ const crypto = require('crypto'); const { contractId: dpnsContractId, - ownerId: dpnsOwnerId, } = require('@dashevo/dpns-contract/lib/systemIds'); const createClientWithFundedWallet = require('../../lib/test/createClientWithFundedWallet'); @@ -33,8 +32,6 @@ describe('DPNS', () => { topLevelDomain = 'dash'; secondLevelDomain = getRandomDomain(); client = await createClientWithFundedWallet(1000000); - - await client.platform.identities.topUp(dpnsOwnerId, 300000); }); after(async () => { @@ -52,93 +49,6 @@ describe('DPNS', () => { }); }); - describe('DPNS owner', () => { - let createdTLD; - let newTopLevelDomain; - let ownerClient; - - before(async () => { - ownerClient = await createClientWithFundedWallet( - 10000, - process.env.DPNS_OWNER_PRIVATE_KEY, - ); - - newTopLevelDomain = getRandomDomain(); - identity = await ownerClient.platform.identities.get(dpnsOwnerId); - - expect(identity).to.exist(); - await ownerClient.platform.identities.topUp(dpnsOwnerId, 500); - }); - - after(async () => { - if (ownerClient) { - await ownerClient.disconnect(); - } - }); - - // generate a random one which will be used in tests above - // skip if DPNS owner private key is not passed and use `dash` in tests above - it('should be able to register a TLD', async () => { - createdTLD = await ownerClient.platform.names.register(newTopLevelDomain, { - dashAliasIdentityId: identity.getId(), - }, identity); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - expect(createdTLD).to.exist(); - expect(createdTLD.getType()).to.equal('domain'); - expect(createdTLD.getData().label).to.equal(newTopLevelDomain); - expect(createdTLD.getData().normalizedParentDomainName).to.equal(''); - }); - - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly - it.skip('should not be able to update domain', async () => { - createdTLD.set('label', 'anotherlabel'); - - let broadcastError; - - try { - await ownerClient.platform.documents.broadcast({ - replace: [createdTLD], - }, identity); - } catch (e) { - broadcastError = e; - } - - expect(broadcastError).to.exist(); - expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); - }); - - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly - it.skip('should not be able to delete domain', async () => { - let broadcastError; - - try { - await ownerClient.platform.documents.broadcast({ - delete: [createdTLD], - }, identity); - } catch (e) { - broadcastError = e; - } - - expect(broadcastError).to.exist(); - expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); - }); - }); - describe('Any Identity', () => { before(async () => { identity = await client.platform.identities.register(600000); @@ -152,16 +62,12 @@ describe('DPNS', () => { } }); - // TODO(rs-drive-abci): test randomly returns StateTransition already in chain error, - // but it's happening because of retry attempts for the same ST. - // Underlying issue causing retry is different and should be debugged. - // (console.log error in dapi-client's GrpcTransport for more details) - it.skip('should not be able to register TLD', async () => { + it('should not be able to register TLD', async () => { let broadcastError; try { await client.platform.names.register(getRandomDomain(), { - dashAliasIdentityId: identity.getId(), + identity: identity.getId(), }, identity); } catch (e) { broadcastError = e; @@ -169,34 +75,30 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Can\'t create top level domain for this identity'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - // TODO(rs-drive-abci): test randomly returns StateTransition already in chain error, - // but it's happening because of retry attempts for the same ST. - // Underlying issue causing retry is different and should be debugged. - // (console.log error in dapi-client's GrpcTransport for more details) - it.skip('should be able to register a second level domain', async () => { + it('should be able to register a second level domain', async () => { registeredDomain = await client.platform.names.register(`${secondLevelDomain}0.${topLevelDomain}`, { - dashUniqueIdentityId: identity.getId(), + identity: identity.getId(), }, identity); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); expect(registeredDomain.getType()).to.equal('domain'); - expect(registeredDomain.getData().label).to.equal(secondLevelDomain); + expect(registeredDomain.getData().label).to.equal(`${secondLevelDomain}0`); expect(registeredDomain.getData().normalizedParentDomainName).to.equal(topLevelDomain); }); - it.skip('should not be able register similar domain name', async () => { + it('should not be able register similar domain name', async () => { let broadcastError; try { const domain = `${secondLevelDomain}O.${topLevelDomain}`; await client.platform.names.register(domain, { - dashAliasIdentityId: identity.getId(), + identity: identity.getId(), }, identity); expect.fail('should throw error'); @@ -205,22 +107,18 @@ describe('DPNS', () => { } expect(broadcastError).to.exist(); - expect(broadcastError.code).to.be.equal(4009); - expect(broadcastError.message).to.match(/Document \w* has duplicate unique properties \["normalizedLabel", "normalizedParentDomainName"] with other documents/); + expect(broadcastError.code).to.be.equal(40105); + expect(broadcastError.message).to.match(/Document \w* has duplicate unique properties \["normalizedParentDomainName", "normalizedLabel"] with other documents/); }); - // TODO(rs-drive-abci): test randomly returns StateTransition already in chain error, - // but it's happening because of retry attempts for the same ST. - // Underlying issue causing retry is different and should be debugged. - // (console.log error in dapi-client's GrpcTransport for more details) - it.skip('should not be able to register a subdomain for parent domain which is not exist', async () => { + it('should not be able to register a subdomain for parent domain which is not exist', async () => { let broadcastError; try { - const domain = `${getRandomDomain()}.${getRandomDomain()}.${topLevelDomain}`; + const domain = `${getRandomDomain()}.${getRandomDomain()}`; await client.platform.names.register(domain, { - dashAliasIdentityId: identity.getId(), + identity: identity.getId(), }, identity); expect.fail('should throw error'); @@ -230,43 +128,112 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Parent domain is not present'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - // TODO(rs-drive-abci): restore - toObject mismatch (happens randomly) - it.skip('should be able to search a domain', async () => { + it('should be able to search a domain', async () => { const documents = await client.platform.names.search(secondLevelDomain, topLevelDomain); expect(documents).to.have.lengthOf(1); - const [document] = documents; - - expect(document.toObject()).to.deep.equal(registeredDomain.toObject()); + const rawDocument = documents[0].toObject(); + + delete rawDocument.$createdAt; + delete rawDocument.$createdAtCoreBlockHeight; + delete rawDocument.$createdAtBlockHeight; + delete rawDocument.$updatedAt; + delete rawDocument.$updatedAtCoreBlockHeight; + delete rawDocument.$updatedAtBlockHeight; + delete rawDocument.$transferredAt; + delete rawDocument.$transferredAtCoreBlockHeight; + delete rawDocument.$transferredAtBlockHeight; + delete rawDocument.preorderSalt; + + const rawRegisteredDomain = registeredDomain.toObject(); + + delete rawRegisteredDomain.$createdAt; + delete rawRegisteredDomain.$createdAtCoreBlockHeight; + delete rawRegisteredDomain.$createdAtBlockHeight; + delete rawRegisteredDomain.$updatedAt; + delete rawRegisteredDomain.$updatedAtCoreBlockHeight; + delete rawRegisteredDomain.$updatedAtBlockHeight; + delete rawRegisteredDomain.$transferredAt; + delete rawRegisteredDomain.$transferredAtCoreBlockHeight; + delete rawRegisteredDomain.$transferredAtBlockHeight; + delete rawRegisteredDomain.preorderSalt; + + expect(rawDocument).to.deep.equal(rawRegisteredDomain); }); - // TODO(rs-drive-abci): restore - toObject mismatch (happens randomly) - it.skip('should be able to resolve domain by it\'s name', async () => { - const document = await client.platform.names.resolve(`${secondLevelDomain}.${topLevelDomain}`); - - expect(document.toObject()).to.deep.equal(registeredDomain.toObject()); + it('should be able to resolve domain by it\'s name', async () => { + const document = await client.platform.names.resolve(`${secondLevelDomain}0.${topLevelDomain}`); + + const rawDocument = document.toObject(); + + delete rawDocument.$createdAt; + delete rawDocument.$createdAtCoreBlockHeight; + delete rawDocument.$createdAtBlockHeight; + delete rawDocument.$updatedAt; + delete rawDocument.$updatedAtCoreBlockHeight; + delete rawDocument.$updatedAtBlockHeight; + delete rawDocument.$transferredAt; + delete rawDocument.$transferredAtCoreBlockHeight; + delete rawDocument.$transferredAtBlockHeight; + delete rawDocument.preorderSalt; + + const rawRegisteredDomain = registeredDomain.toObject(); + + delete rawRegisteredDomain.$createdAt; + delete rawRegisteredDomain.$createdAtCoreBlockHeight; + delete rawRegisteredDomain.$createdAtBlockHeight; + delete rawRegisteredDomain.$updatedAt; + delete rawRegisteredDomain.$updatedAtCoreBlockHeight; + delete rawRegisteredDomain.$updatedAtBlockHeight; + delete rawRegisteredDomain.$transferredAt; + delete rawRegisteredDomain.$transferredAtCoreBlockHeight; + delete rawRegisteredDomain.$transferredAtBlockHeight; + delete rawRegisteredDomain.preorderSalt; + + expect(rawDocument).to.deep.equal(rawRegisteredDomain); }); - // TODO(rs-drive-abci): restore - toObject mismatch (happens randomly) - it.skip('should be able to resolve domain by it\'s record', async () => { + it('should be able to resolve domain by it\'s record', async () => { const [document] = await client.platform.names.resolveByRecord( - 'dashUniqueIdentityId', - registeredDomain.getData().records.dashUniqueIdentityId, + 'identity', + registeredDomain.getData().records.identity, ); - expect(document.toObject()).to.deep.equal(registeredDomain.toObject()); + const rawDocument = document.toObject(); + + delete rawDocument.$createdAt; + delete rawDocument.$createdAtCoreBlockHeight; + delete rawDocument.$createdAtBlockHeight; + delete rawDocument.$updatedAt; + delete rawDocument.$updatedAtCoreBlockHeight; + delete rawDocument.$updatedAtBlockHeight; + delete rawDocument.$transferredAt; + delete rawDocument.$transferredAtCoreBlockHeight; + delete rawDocument.$transferredAtBlockHeight; + delete rawDocument.preorderSalt; + + const rawRegisteredDomain = registeredDomain.toObject(); + + delete rawRegisteredDomain.$createdAt; + delete rawRegisteredDomain.$createdAtCoreBlockHeight; + delete rawRegisteredDomain.$createdAtBlockHeight; + delete rawRegisteredDomain.$updatedAt; + delete rawRegisteredDomain.$updatedAtCoreBlockHeight; + delete rawRegisteredDomain.$updatedAtBlockHeight; + delete rawRegisteredDomain.$transferredAt; + delete rawRegisteredDomain.$transferredAtCoreBlockHeight; + delete rawRegisteredDomain.$transferredAtBlockHeight; + delete rawRegisteredDomain.preorderSalt; + + expect(rawDocument).to.deep.equal(rawRegisteredDomain); }); - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly + // TODO: Enable test when we figure out how to skip a check in the SDK's state transition + // factory it.skip('should not be able to update domain', async () => { registeredDomain.set('label', 'newlabel'); @@ -284,15 +251,10 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly + // TODO: Enable test when we documentsMutable true fixed and do not prevent from deleting it.skip('should not be able to delete domain', async () => { let broadcastError; @@ -306,12 +268,12 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - it('should not be able to register two domains with same `dashAliasIdentityId` record'); + it('should not be able to register two domains with same `identity` record'); - it('should be able to register many domains with same `dashAliasIdentityId` record'); + it('should be able to register many domains with same `identity` record'); it('should not be able to update preorder'); diff --git a/packages/platform-test-suite/test/e2e/masternodeRewardShares.spec.js b/packages/platform-test-suite/test/e2e/masternodeRewardShares.spec.js deleted file mode 100644 index 24cb356d497..00000000000 --- a/packages/platform-test-suite/test/e2e/masternodeRewardShares.spec.js +++ /dev/null @@ -1,412 +0,0 @@ -const Dash = require('dash'); - -const { - contractId: masternodeRewardSharesContractId, -} = require('@dashevo/masternode-reward-shares-contract/lib/systemIds'); - -const generateRandomIdentifier = require('../../lib/test/utils/generateRandomIdentifier'); - -const createClientWithFundedWallet = require('../../lib/test/createClientWithFundedWallet'); -const waitForSTPropagated = require('../../lib/waitForSTPropagated'); - -const { - Core: { PrivateKey }, - PlatformProtocol: { IdentityPublicKeyWithWitness, IdentityPublicKey }, -} = Dash; - -describe('Masternode Reward Shares', () => { - let failed = false; - let client; - - before(async () => { - client = await createClientWithFundedWallet( - 10000000, - ); - - await client.platform.initialize(); - - const masternodeRewardSharesContract = await client.platform.contracts.get( - masternodeRewardSharesContractId, - ); - - client.getApps().set('masternodeRewardShares', { - contractId: masternodeRewardSharesContractId, - contract: masternodeRewardSharesContract, - }); - }); - - // Skip test if any prior test in this describe failed - beforeEach(function beforeEach() { - if (failed) { - this.skip(); - } - }); - - afterEach(function afterEach() { - failed = this.currentTest.state === 'failed'; - }); - - after(async () => { - if (client) { - await client.disconnect(); - } - }); - - describe('Data Contract', () => { - it('should exists', async () => { - const createdDataContract = await client.platform.contracts.get( - masternodeRewardSharesContractId, - ); - - expect(createdDataContract).to.exist(); - - expect(createdDataContract.getId().toString()).to.equal( - masternodeRewardSharesContractId, - ); - }); - }); - - // TODO(rs-drive-abci): test should be revisited and refined - // because rs-drive-abci does not allow updating masternode shares owner keys anymore - describe.skip('Masternode owner', () => { - let anotherIdentity; - let rewardShare; - let anotherRewardShare; - let masternodeOwnerMasterPrivateKey; - let masternodeOwnerIdentity; - let derivedPrivateKey; - let signaturePublicKeyId; - - before(async function before() { - if (!process.env.MASTERNODE_OWNER_PRO_REG_TX_HASH - || !process.env.MASTERNODE_OWNER_MASTER_PRIVATE_KEY) { - this.skip('masternode owner credentials are not set'); - } - - const masternodeOwnerIdentifier = Buffer.from(process.env.MASTERNODE_OWNER_PRO_REG_TX_HASH, 'hex'); - - masternodeOwnerIdentity = await client.platform.identities.get(masternodeOwnerIdentifier); - - masternodeOwnerMasterPrivateKey = process.env.MASTERNODE_OWNER_MASTER_PRIVATE_KEY; - - // Masternode identity should exist - expect(masternodeOwnerIdentity).to.exist(); - - await client.platform.identities.topUp(masternodeOwnerIdentity.getId(), 2500000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - // Since we cannot create "High" level key for masternode Identities automatically, - // (this key is used to sign state transitions, other than "update") - // we add this key here - - signaturePublicKeyId = masternodeOwnerIdentity.getPublicKeyMaxId() + 1; - - // Get Masternode Rewards Share Contract owner account - const account = await client.platform.client.getWalletAccount(); - - ({ privateKey: derivedPrivateKey } = account - .identities - .getIdentityHDKeyByIndex( - 1000, - signaturePublicKeyId, - )); - - const identityPublicKey = derivedPrivateKey.toPublicKey().toBuffer(); - - const newPublicKey = new IdentityPublicKeyWithWitness( - { - id: signaturePublicKeyId, - type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, - purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, - data: identityPublicKey, - readOnly: false, - signature: Buffer.alloc(0), - }, - ); - - const update = { - add: [newPublicKey], - }; - - const stateTransition = client.platform.dpp.identity.createIdentityUpdateTransition( - masternodeOwnerIdentity, - update, - ); - - const signerKey = masternodeOwnerIdentity.getPublicKeys()[0]; - - const updatedKeys = []; - const promises = stateTransition.getPublicKeysToAdd().map(async (publicKey) => { - stateTransition.setSignaturePublicKeyId(signerKey.getId()); - - await stateTransition.signByPrivateKey(derivedPrivateKey.toBuffer(), publicKey.getType()); - - publicKey.setSignature(stateTransition.getSignature()); - updatedKeys.push(publicKey); - - stateTransition.setSignature(undefined); - stateTransition.setSignaturePublicKeyId(undefined); - }); - - await Promise.all(promises); - stateTransition.setPublicKeysToAdd(updatedKeys); - - stateTransition.setSignaturePublicKeyId(0); - await stateTransition.signByPrivateKey( - new PrivateKey(masternodeOwnerMasterPrivateKey).toBuffer(), - IdentityPublicKey.TYPES.ECDSA_SECP256K1, - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - // Re-fetch identity after it got updated - masternodeOwnerIdentity = await client.platform.identities.get(masternodeOwnerIdentifier); - }); - - it('should be able to create reward shares with existing identity', async () => { - anotherIdentity = await client.platform.identities.register(100000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - rewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - masternodeOwnerIdentity, - { - payToId: anotherIdentity.getId(), - percentage: 1, - }, - ); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - }); - - it('should not be able to create reward shares with non-existing identity', async () => { - const payToId = await generateRandomIdentifier(); - - const invalidRewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - masternodeOwnerIdentity, - { - payToId, - percentage: 1, - }, - ); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [invalidRewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - try { - await client.platform.broadcastStateTransition( - stateTransition, - ); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal(`Identity '${payToId}' doesn't exist`); - expect(e.code).to.equal(4001); - } - }); - - it('should be able to update reward shares with existing identity', async () => { - const percentage = 2; - rewardShare.set('percentage', percentage); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - replace: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - const [updatedRewardShare] = await client.platform.documents.get('masternodeRewardShares.rewardShare', { - where: [['$id', '==', rewardShare.getId()]], - }); - - expect(updatedRewardShare).to.exists(); - - // TODO: check this case. - // rewardShare.set() can not accept bigint, however rewardShare.get() - // returns bigint. - expect(updatedRewardShare.get('percentage')).equals(BigInt(percentage)); - }); - - it('should not be able to update reward shares with non-existing identity', async () => { - const payToId = await generateRandomIdentifier(); - - [rewardShare] = await client.platform.documents.get( - 'masternodeRewardShares.rewardShare', - { where: [['$id', '==', rewardShare.getId()]] }, - ); - - rewardShare.set('payToId', payToId); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - replace: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - try { - await client.platform.broadcastStateTransition( - stateTransition, - ); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal(`Identity '${payToId}' doesn't exist`); - expect(e.code).to.equal(4001); - } - }); - - it('should not be able to share more than 100% of rewards', async () => { - anotherIdentity = await client.platform.identities.register(100000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - anotherRewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - masternodeOwnerIdentity, - { - payToId: anotherIdentity.getId(), - percentage: 9999, // it will be 10001 in summary - }, - ); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [anotherRewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - try { - await client.platform.broadcastStateTransition( - stateTransition, - ); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal('Percentage can not be more than 10000'); - expect(e.code).to.equal(4001); - } - }); - - it('should be able to remove reward shares', async () => { - const stateTransition = client.platform.dpp.document.createStateTransition({ - delete: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - const [storedDocument] = await client.platform.documents.get( - 'masternodeRewardShares.rewardShare', - { where: [['$id', '==', rewardShare.getId()]] }, - ); - - expect(storedDocument).to.not.exist(); - }); - }); - - // TODO(rs-drive-abci): restore. Apparently there's a bug that allows - // regular Identities to assign reward shares. - describe.skip('Any Identity', () => { - let identity; - - before(async () => { - identity = await client.platform.identities.register(200000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - }); - - it('should not be able to share rewards', async () => { - const rewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - identity, - { - payToId: await generateRandomIdentifier(), - percentage: 1, - }, - ); - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [rewardShare], - }); - - stateTransition.setSignaturePublicKeyId(1); - - const account = await client.getWalletAccount(); - - const { privateKey } = account.identities.getIdentityHDKeyById( - identity.getId().toString(), - 1, - ); - - await stateTransition.sign( - identity.getPublicKeyById(1), - privateKey.toBuffer(), - ); - - try { - await client.platform.documents.broadcast({ - create: [rewardShare], - }, identity); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal('Only masternode identities can share rewards'); - expect(e.code).to.equal(4001); - } - }); - }); -}); diff --git a/packages/platform-test-suite/test/e2e/wallet.spec.js b/packages/platform-test-suite/test/e2e/wallet.spec.js index d988f6b2547..241ba81204b 100644 --- a/packages/platform-test-suite/test/e2e/wallet.spec.js +++ b/packages/platform-test-suite/test/e2e/wallet.spec.js @@ -7,11 +7,12 @@ const waitForBalanceToChange = require('../../lib/test/waitForBalanceToChange'); const { EVENTS } = Dash.WalletLib; -describe('e2e', () => { +describe('e2e', function e2eTest() { + this.bail(true); + describe('Wallet', function main() { this.timeout(950000); - let failed = false; let fundedWallet; let fundedAccount; let emptyWallet; @@ -23,7 +24,16 @@ describe('e2e', () => { let firstTransaction; let secondTransaction; - before(async () => { + before(async function createClients() { + // TODO: temporarily disabled on browser because of header stream is not syncing + // headers at some point. Our theory is that because wallets aren't offloading properly + // and we have too many streams open. + if (typeof window !== 'undefined') { + this.skip('temporarily disabled on browser because of header stream is not syncing' + + ' headers at some point. Our theory is that because wallets aren\'t offloading' + + ' properly and we have too many streams open.'); + } + fundedWallet = await createClientWithFundedWallet(10000); const network = process.env.NETWORK; emptyWallet = new Dash.Client({ @@ -39,17 +49,6 @@ describe('e2e', () => { emptyWalletHeight = storage.getChainStore(storage.application.network).state.chainHeight; }); - // Skip test if any prior test in this describe failed - beforeEach(function beforeEach() { - if (failed) { - this.skip(); - } - }); - - afterEach(function afterEach() { - failed = this.currentTest.state === 'failed'; - }); - after(async () => { if (fundedWallet) { await fundedWallet.disconnect(); diff --git a/packages/platform-test-suite/test/e2e/withdrawals.spec.js b/packages/platform-test-suite/test/e2e/withdrawals.spec.js new file mode 100644 index 00000000000..ecbac9b8de2 --- /dev/null +++ b/packages/platform-test-suite/test/e2e/withdrawals.spec.js @@ -0,0 +1,288 @@ +const { expect } = require('chai'); + +const wait = require('@dashevo/dapi-client/lib/utils/wait'); +const { STATUSES: WITHDRAWAL_STATUSES } = require('dash/build/SDK/Client/Platform/methods/identities/creditWithdrawal'); + +const createClientWithFundedWallet = require('../../lib/test/createClientWithFundedWallet'); +const waitForSTPropagated = require('../../lib/waitForSTPropagated'); + +// TODO: temporary disabled due to flakiness. These tests aren't important for now, since we are +// going to release v1.0.0 with withdrawals disabled. +describe.skip('Withdrawals', function withdrawalsTest() { + this.bail(true); + + let client; + let identity; + + before(async function createClients() { + // TODO: temporarily disabled on browser because of header stream is not syncing + // headers at some point. Our theory is that because wallets aren't offloading properly + // and we have too many streams open. + if (typeof window !== 'undefined') { + this.skip('temporarily disabled on browser because of header stream is not syncing' + + ' headers at some point. Our theory is that because wallets aren\'t offloading properly' + + ' and we have too many streams open.'); + } + + client = await createClientWithFundedWallet( + 10000000, + ); + + await client.platform.initialize(); + }); + + after(async () => { + if (client) { + await client.disconnect(); + } + }); + + describe('Any Identity', () => { + const INITIAL_BALANCE = 1000000; + + before(async () => { + identity = await client.platform.identities.register(INITIAL_BALANCE); + + // Additional wait time to mitigate testnet latency + await waitForSTPropagated(); + }); + + it('should be able to withdraw credits', async () => { + const account = await client.getWalletAccount(); + const walletBalanceBefore = account.getTotalBalance(); + const identityBalanceBefore = identity.getBalance(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = 1000000; + + await client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + ); + + // Re-fetch identity to obtain latest core chain lock height + identity = await client.platform.identities.get(identity.getId()); + const identityMetadata = identity.getMetadata().toObject(); + const { coreChainLockedHeight: initialCoreChainLockedHeight } = identityMetadata; + + // Wait for core chain lock update. + // After that drive should update document status to completed. + // (Wait 2 chainlocks on regtest since they are processed quicker, + // and withdrawal might not complete yet) + const chainLocksToWait = process.env.NETWORK === 'regtest' ? 2 : 1; + const { promise } = await client.platform.identities.utils + .waitForCoreChainLockedHeight(initialCoreChainLockedHeight + chainLocksToWait); + await promise; + + // Wait for document completion to propagate + await waitForSTPropagated(); + + // Wait for document status to be changed to COMPLETED. + let withdrawalCompleted = false; + let withdrawalDocument; + for (let i = 0; i < 10; i++) { + const withdrawals = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [['$ownerId', '==', identity.getId()]], + }, + ); + + withdrawalDocument = withdrawals[withdrawals.length - 1]; + withdrawalCompleted = withdrawalDocument.get('status') === WITHDRAWAL_STATUSES.COMPLETED; + + if (withdrawalCompleted) { + break; + } + + await waitForSTPropagated(); + } + + expect(withdrawalCompleted).to.be.true(); + + const walletBalanceUpdated = account.getTotalBalance(); + + identity = await client.platform.identities.get(identity.getId()); + const identityBalanceUpdated = identity.getBalance(); + + // Should ensure balances are right + expect(walletBalanceUpdated).to.be.greaterThan(walletBalanceBefore); + expect(identityBalanceUpdated).to.be.lessThan(identityBalanceBefore); + + // Should allow deleting of the withdrawal document + await client.platform.documents.broadcast({ + delete: [withdrawalDocument], + }, identity); + }); + + it('should be able to query recent withdrawal updates', async () => { + const account = await client.getWalletAccount(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = 1000000; + + const firstWithdrawalTime = Date.now(); + const { height: withdrawalHeight } = await client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + ); + + let withdrawalBroadcasted = false; + let blocksPassed = 0; + + // Wait for first withdrawal to broadcast + while (!withdrawalBroadcasted && blocksPassed === 0) { + await waitForSTPropagated(); + + const withdrawals = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [ + ['$ownerId', '==', identity.getId()], + ['$updatedAt', '>', firstWithdrawalTime], + ], + orderBy: [ + ['$updatedAt', 'desc'], + ], + }, + ); + + // We want to ensure that our index works properly with updatedAt + // condition, and we are not receiving the document from previous test + expect(withdrawals.length).to.equal(1); + + const withdrawal = withdrawals[0]; + + withdrawalBroadcasted = withdrawal.get('status') === WITHDRAWAL_STATUSES.BROADCASTED; + + blocksPassed = withdrawal.getMetadata() + .getBlockHeight() - withdrawalHeight; + } + + expect(withdrawalBroadcasted).to.be.true(); + }); + + it('should not be able to withdraw more than balance available', async () => { + const account = await client.getWalletAccount(); + const identityBalanceBefore = identity.getBalance(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = identityBalanceBefore * 2; + + await expect(client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + )).to.be.rejectedWith(`Withdrawal amount "${amountToWithdraw}" is bigger that identity balance "${identityBalanceBefore}"`); + }); + + it('should not allow to create withdrawal with wrong security key type', async () => { + const account = await client.getWalletAccount(); + const identityBalanceBefore = identity.getBalance(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = identityBalanceBefore / 2; + + await expect(client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + { + signingKeyIndex: 1, + }, + )).to.be.rejectedWith('Error conversion not implemented: Invalid public key security level HIGH. The state transition requires one of CRITICAL'); + }); + + // TODO: Figure out how to overcome client-side validation and implement + // a consensus error for this case instead of misused InvalidDocumentTransitionActionError + it.skip('should not be able to create withdrawal document', async () => { + const withdrawal = await client.platform.documents.create( + 'withdrawals.withdrawal', + identity, + { + amount: 1000, + coreFeePerByte: 1365, + pooling: 0, + outputScript: Buffer.alloc(23), + status: 0, + }, + ); + + try { + await client.platform.documents.broadcast({ + create: [withdrawal], + }, identity); + + expect.fail('should throw broadcast error'); + } catch (e) { + expect(e.message).to.be.equal('Action is not allowed'); + expect(e.code).to.equal(40500); + } + }); + + it('should not be able to delete incomplete withdrawal document', async () => { + const account = await client.getWalletAccount(); + const withdrawTo = await account.getUnusedAddress(); + + await client.platform.identities.withdrawCredits( + identity, + BigInt(1000000), + withdrawTo.address, + ); + + await waitForSTPropagated(); + + let withdrawalBroadcasted = false; + let withdrawalDocument; + // Wait for withdrawal to broadcast, otherwise there's a chance + // that test will try update document at the same time with the drive itself + while (!withdrawalBroadcasted) { + ([withdrawalDocument] = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [['$ownerId', '==', identity.getId()]], + }, + )); + + withdrawalBroadcasted = withdrawalDocument.get('status') === WITHDRAWAL_STATUSES.BROADCASTED; + + await wait(1000); + } + + try { + await client.platform.documents.broadcast({ + delete: [withdrawalDocument], + }, identity); + + expect.fail('should throw broadcast error'); + } catch (e) { + expect(e.message).to.be.equal('withdrawal deletion is allowed only for COMPLETE statuses'); + expect(e.code).to.equal(40500); + } + }); + + it('should not be able to update withdrawal document', async () => { + const [withdrawalDocument] = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [['$ownerId', '==', identity.getId()]], + }, + ); + + withdrawalDocument.set('status', 3); + + try { + await client.platform.documents.broadcast({ + replace: [withdrawalDocument], + }, identity); + + expect.fail('should throw broadcast error'); + } catch (e) { + expect(e.message).to.be.equal('Action is not allowed'); + expect(e.code).to.equal(40500); + } + }); + }); +}); diff --git a/packages/platform-test-suite/test/functional/core/getBlock.spec.js b/packages/platform-test-suite/test/functional/core/getBlock.spec.js index 792baa5bf26..8a1de774d7d 100644 --- a/packages/platform-test-suite/test/functional/core/getBlock.spec.js +++ b/packages/platform-test-suite/test/functional/core/getBlock.spec.js @@ -4,7 +4,7 @@ const createClientWithoutWallet = require('../../../lib/test/createClientWithout const { Core: { Block }, Essentials: { Buffer } } = Dash; -describe('Core', () => { +describe.skip('Core', () => { describe('getBlock', () => { let client; @@ -29,8 +29,7 @@ describe('Core', () => { }); it('should get block by height', async () => { - const { chain: { blocksCount: bestBlockHeight } } = await client - .getDAPIClient().core.getStatus(); + const bestBlockHeight = await client.getDAPIClient().core.getBestBlockHeight(); const blockBinary = await client.getDAPIClient().core.getBlockByHeight(bestBlockHeight); diff --git a/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js b/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js index 2c1bbdd61a6..b7df1e3b884 100644 --- a/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js +++ b/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js @@ -8,8 +8,8 @@ describe('Core', () => { before(async () => { client = createClientWithoutWallet(); - ({ chain: { blocksCount: lastBlockHeight } } = await client - .getDAPIClient().core.getStatus()); + lastBlockHeight = await client + .getDAPIClient().core.getBestBlockHeight(); }); after(async () => { diff --git a/packages/platform-test-suite/test/functional/core/getBlockchainStatus.spec.js b/packages/platform-test-suite/test/functional/core/getBlockchainStatus.spec.js new file mode 100644 index 00000000000..780e2da5887 --- /dev/null +++ b/packages/platform-test-suite/test/functional/core/getBlockchainStatus.spec.js @@ -0,0 +1,54 @@ +const { Essentials: { Buffer } } = require('dash'); + +const createClientWithoutWallet = require('../../../lib/test/createClientWithoutWallet'); + +describe('Core', () => { + describe('getBlockchainStatus', function main() { + let client; + + this.timeout(160000); + + before(() => { + client = createClientWithoutWallet(); + }); + + after(async () => { + if (client) { + await client.disconnect(); + } + }); + + it('should return status', async () => { + const result = await client.getDAPIClient().core.getBlockchainStatus(); + + const { + version, time, status, syncProgress, chain, network, + } = result; + + expect(version.protocol).to.be.a('number'); + expect(version.software).to.be.a('number'); + expect(version.agent).to.be.a('string'); + + expect(time.now).to.be.a('number'); + expect(time.offset).to.be.a('number'); + expect(time.median).to.be.a('number'); + + expect(status).to.be.a('string'); + + expect(syncProgress).to.be.a('number'); + + expect(chain.name).to.be.a('string'); + expect(chain.headersCount).to.be.a('number'); + expect(chain.blocksCount).to.be.a('number'); + expect(chain.bestBlockHash).to.be.an.instanceOf(Buffer); + expect(chain.difficulty).to.be.a('number'); + expect(chain.chainWork).to.be.an.instanceOf(Buffer); + expect(chain.isSynced).to.be.a('boolean'); + expect(chain.syncProgress).to.be.a('number'); + + expect(network.peersCount).to.be.a('number'); + expect(network.fee.relay).to.be.a('number'); + expect(network.fee.incremental).to.be.a('number'); + }); + }); +}); diff --git a/packages/platform-test-suite/test/functional/core/getMasternodeStatus.spec.js b/packages/platform-test-suite/test/functional/core/getMasternodeStatus.spec.js new file mode 100644 index 00000000000..eb473c739ca --- /dev/null +++ b/packages/platform-test-suite/test/functional/core/getMasternodeStatus.spec.js @@ -0,0 +1,35 @@ +const { Essentials: { Buffer } } = require('dash'); + +const createClientWithoutWallet = require('../../../lib/test/createClientWithoutWallet'); + +describe.skip('Core', () => { + describe('getMasternodeStatus', function main() { + let client; + + this.timeout(160000); + + before(() => { + client = createClientWithoutWallet(); + }); + + after(async () => { + if (client) { + await client.disconnect(); + } + }); + + it('should return status', async () => { + const result = await client.getDAPIClient().core.getMasternodeStatus(); + + const { + status, proTxHash, posePenalty, isSynced, syncProgress, + } = result; + + expect(status).to.be.a('string'); + expect(proTxHash).to.be.an.instanceOf(Buffer); + expect(posePenalty).to.be.a('number'); + expect(isSynced).to.be.a('boolean'); + expect(syncProgress).to.be.a('number'); + }); + }); +}); diff --git a/packages/platform-test-suite/test/functional/core/getStatus.spec.js b/packages/platform-test-suite/test/functional/core/getStatus.spec.js deleted file mode 100644 index ae8c56aa5b6..00000000000 --- a/packages/platform-test-suite/test/functional/core/getStatus.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -const { Essentials: { Buffer } } = require('dash'); - -const createClientWithoutWallet = require('../../../lib/test/createClientWithoutWallet'); - -describe('Core', () => { - describe('getStatus', function main() { - let client; - - this.timeout(160000); - - before(() => { - client = createClientWithoutWallet(); - }); - - after(async () => { - if (client) { - await client.disconnect(); - } - }); - - it('should return status', async () => { - const result = await client.getDAPIClient().core.getStatus(); - - const { - version, time, status, syncProgress, chain, masternode, network, - } = result; - - expect(version.protocol).to.be.a('number'); - expect(version.software).to.be.a('number'); - expect(version.agent).to.be.a('string'); - - expect(time.now).to.be.a('number'); - expect(time.offset).to.be.a('number'); - expect(time.median).to.be.a('number'); - - expect(status).to.be.a('string'); - - expect(syncProgress).to.be.a('number'); - - expect(chain.name).to.be.a('string'); - expect(chain.headersCount).to.be.a('number'); - expect(chain.blocksCount).to.be.a('number'); - expect(chain.bestBlockHash).to.be.an.instanceOf(Buffer); - expect(chain.difficulty).to.be.a('number'); - expect(chain.chainWork).to.be.an.instanceOf(Buffer); - expect(chain.isSynced).to.be.a('boolean'); - expect(chain.syncProgress).to.be.a('number'); - - expect(masternode.status).to.be.a('string'); - expect(masternode.proTxHash).to.be.an.instanceOf(Buffer); - expect(masternode.posePenalty).to.be.a('number'); - expect(masternode.isSynced).to.be.a('boolean'); - expect(masternode.syncProgress).to.be.a('number'); - - expect(network.peersCount).to.be.a('number'); - expect(network.fee.relay).to.be.a('number'); - expect(network.fee.incremental).to.be.a('number'); - }); - }); -}); diff --git a/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js b/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js index ca039d2152f..1ee274c38e1 100644 --- a/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js +++ b/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js @@ -7,7 +7,6 @@ const createClientWithFundedWallet = require('../../../lib/test/createClientWith const { Core: { - Block, BlockHeader, ChainLock, }, @@ -76,7 +75,6 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { let sdkClient; const network = process.env.NETWORK; - let bestBlock; let bestBlockHeight; beforeEach(async () => { @@ -85,11 +83,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { seeds: getDAPISeeds(), }); - const bestBlockHash = await dapiClient.core.getBestBlockHash(); - bestBlock = new Block( - await dapiClient.core.getBlockByHash(bestBlockHash), - ); - bestBlockHeight = bestBlock.transactions[0].extraPayload.height; + bestBlockHeight = await dapiClient.core.getBestBlockHeight(); }); after(async () => { @@ -133,6 +127,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { streamError = e; }); + // TODO: Use promise instead of loop while (!streamEnded) { if (streamError) { throw streamError; @@ -142,18 +137,20 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { expect(streamError).to.not.exist(); expect(streamEnded).to.be.true(); - // TODO: fetching blocks one by one takes too long. Implement getBlockHeaders in dapi-client - const fetchedBlocks = []; - - for (let i = 1; i <= headersAmount; i++) { - const rawBlock = await dapiClient.core.getBlockByHeight(i); - const block = new Block(rawBlock); - - fetchedBlocks.push(block); - } - - expect(historicalBlockHeaders.map((header) => header.hash)) - .to.deep.equal(fetchedBlocks.map((block) => block.header.hash)); + // TODO: Implement getBlockHeaders in dapi-client so we can compare block hashes + // const fetchedBlocks = []; + // + // for (let i = 1; i <= headersAmount; i++) { + // const rawBlock = await dapiClient.core.getBlockByHeight(i); + // const block = new Block(rawBlock); + // + // fetchedBlocks.push(block); + // } + // + // expect(historicalBlockHeaders.map((header) => header.hash)) + // .to.deep.equal(fetchedBlocks.map((block) => block.header.hash)); + + expect(historicalBlockHeaders.length).to.equal(headersAmount); expect(bestChainLock.height).to.exist(); }); @@ -216,6 +213,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { await account.broadcastTransaction(transaction); + // TODO: Use promise instead of loop // Wait for stream ending while (!streamEnded) { if (streamError) { @@ -227,19 +225,20 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { expect(streamError).to.not.exist(); - // TODO: fetching blocks one by one takes too long. Implement getBlockHeaders in dapi-client - const fetchedHistoricalBlocks = []; - - for (let i = bestBlockHeight - historicalBlocksToGet + 1; i <= bestBlockHeight; i++) { - const rawBlock = await dapiClient.core.getBlockByHeight(i); - const block = new Block(rawBlock); - - fetchedHistoricalBlocks.push(block); - } - - for (let i = 0; i < historicalBlocksToGet; i++) { - expect(fetchedHistoricalBlocks[i].header.hash).to.equal([...blockHeadersHashesFromStream][i]); - } + // TODO: Implement getBlockHeaders in dapi-client to compare block hashes + // const fetchedHistoricalBlocks = []; + // + // for (let i = bestBlockHeight - historicalBlocksToGet + 1; i <= bestBlockHeight; i++) { + // const rawBlock = await dapiClient.core.getBlockByHeight(i); + // const block = new Block(rawBlock); + // + // fetchedHistoricalBlocks.push(block); + // } + // + // for (let i = 0; i < historicalBlocksToGet; i++) { + // expect(fetchedHistoricalBlocks[i].header.hash).to.equal( + // [...blockHeadersHashesFromStream][i]); + // } expect(obtainedFreshBlock).to.be.true(); expect(latestChainLock).to.exist(); diff --git a/packages/platform-test-suite/test/functional/platform/DataContract.spec.js b/packages/platform-test-suite/test/functional/platform/DataContract.spec.js index 8623aa0cf18..28fe50b14ec 100644 --- a/packages/platform-test-suite/test/functional/platform/DataContract.spec.js +++ b/packages/platform-test-suite/test/functional/platform/DataContract.spec.js @@ -12,7 +12,7 @@ const { PlatformProtocol: { IdentityNotFoundError, InvalidDataContractVersionError, - IncompatibleDataContractSchemaError, + IncompatibleDocumentTypeSchemaError, }, } = Dash; @@ -25,12 +25,14 @@ describe('Platform', () => { let identity; before(async () => { - dataContractFixture = await getDataContractFixture(); client = await createClientWithFundedWallet(35000000); // Looks like updating the contact and keeping history requires about // 7 million credits in fees. Investigate this further. identity = await client.platform.identities.register(30000000); + const nextNonce = await client.platform + .nonceManager.bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(nextNonce); }); after(async () => { @@ -42,7 +44,7 @@ describe('Platform', () => { it('should fail to create new data contract with unknown owner', async () => { // if no identity is specified // random is generated within the function - dataContractFixture = await getDataContractFixture(); + dataContractFixture = await getDataContractFixture(1); let broadcastError; @@ -53,7 +55,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(2000); + expect(broadcastError.getCause().getCode()).to.equal(20000); expect(broadcastError.getCause()).to.be.an.instanceOf(IdentityNotFoundError); }); @@ -61,7 +63,9 @@ describe('Platform', () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - dataContractFixture = await getDataContractFixture(identity.getId()); + const identityNonce = await client.platform.nonceManager + .bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(identityNonce, identity.getId()); await client.platform.contracts.publish(dataContractFixture, identity); }); @@ -97,11 +101,10 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1050); + expect(broadcastError.getCause().getCode()).to.equal(10212); expect(broadcastError.getCause()).to.be.an.instanceOf(InvalidDataContractVersionError); }); - // TODO(versioning): this test is not passing it('should not be able to update an existing data contract if schema is not backward compatible', async () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -123,8 +126,8 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1051); - expect(broadcastError.getCause()).to.be.an.instanceOf(IncompatibleDataContractSchemaError); + expect(broadcastError.getCause().getCode()).to.equal(10246); + expect(broadcastError.getCause()).to.be.an.instanceOf(IncompatibleDocumentTypeSchemaError); }); it('should be able to update an existing data contract', async () => { diff --git a/packages/platform-test-suite/test/functional/platform/Document.spec.js b/packages/platform-test-suite/test/functional/platform/Document.spec.js index 9d96259d863..55b5c03a489 100644 --- a/packages/platform-test-suite/test/functional/platform/Document.spec.js +++ b/packages/platform-test-suite/test/functional/platform/Document.spec.js @@ -18,6 +18,16 @@ const { }, } = Dash; +const getDocumentObject = (document) => { + const documentObject = document.toObject(); + + // Delete createdAt and updatedAt fields because they could vary slightly + delete documentObject.$createdAt; + delete documentObject.$updatedAt; + + return documentObject; +}; + describe('Platform', () => { describe('Document', function main() { this.timeout(700000); @@ -35,21 +45,26 @@ describe('Platform', () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - dataContractFixture = await getDataContractFixture(identity.getId()); + const identityNonce = await client.platform + .nonceManager.bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(identityNonce, identity.getId()); await client.platform.contracts.publish(dataContractFixture, identity); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - client.getApps().set('customContracts', { - contractId: dataContractFixture.getId(), - contract: dataContractFixture, - }); + client.getApps() + .set('customContracts', { + contractId: dataContractFixture.getId(), + contract: dataContractFixture, + }); }); beforeEach(async () => { - dataContractFixture = await getDataContractFixture(identity.getId()); + const identityNonce = await client.platform + .nonceManager.bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(identityNonce, identity.getId()); }); after(async () => { @@ -60,16 +75,19 @@ describe('Platform', () => { it('should fail to create new document with an unknown type', async () => { // Add undefined document type for - client.getApps().get('customContracts').contract.setDocumentSchema('undefinedType', { - type: 'object', - properties: { - name: { - type: 'string', - position: 0, + client.getApps() + .get('customContracts') + .contract + .setDocumentSchema('undefinedType', { + type: 'object', + properties: { + name: { + type: 'string', + position: 0, + }, }, - }, - additionalProperties: false, - }); + additionalProperties: false, + }); const newDocument = await client.platform.documents.create( 'customContracts.undefinedType', @@ -89,8 +107,16 @@ describe('Platform', () => { broadcastError = e; } - expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause()).to.be.an.instanceOf(InvalidDocumentTypeError); + expect(broadcastError) + .to + .be + .an + .instanceOf(StateTransitionBroadcastError); + expect(broadcastError.getCause()) + .to + .be + .an + .instanceOf(InvalidDocumentTypeError); }); it('should fail to create a new document with an unknown owner', async () => { @@ -114,10 +140,14 @@ describe('Platform', () => { broadcastError = e; } - expect(broadcastError).to.exist(); - expect(broadcastError.message).to.equal( - `Identity with ID ${unknownIdentity.getId()} is not associated with wallet, or it's not synced`, - ); + expect(broadcastError) + .to + .exist(); + expect(broadcastError.message) + .to + .equal( + `Identity with ID ${unknownIdentity.getId()} is not associated with wallet, or it's not synced`, + ); }); it('should fail to create a document that violates unique index constraint', async () => { @@ -160,9 +190,16 @@ describe('Platform', () => { broadcastError = e; } - expect(broadcastError).to.exist(); - expect(broadcastError.code).to.be.equal(4009); - expect(broadcastError.message).to.match(/Document \w* has duplicate unique properties \["\$ownerId", "firstName"] with other documents/); + expect(broadcastError) + .to + .exist(); + expect(broadcastError.code) + .to + .be + .equal(40105); + expect(broadcastError.message) + .to + .match(/Document \w* has duplicate unique properties \["\$ownerId", "firstName"] with other documents/); }); it('should be able to create new document', async () => { @@ -189,20 +226,31 @@ describe('Platform', () => { { where: [['$id', '==', document.getId()]] }, ); - expect(fetchedDocument).to.exist(); - expect(document.toObject()).to.deep.equal(fetchedDocument.toObject()); + expect(fetchedDocument) + .to + .exist(); + expect(fetchedDocument.getUpdatedAt()) - .to.be.deep.equal(fetchedDocument.getCreatedAt()); + .to.be.greaterThanOrEqual(document.getUpdatedAt()); + expect(fetchedDocument.getCreatedAt()) + .to.be.greaterThanOrEqual(document.getCreatedAt()); + + expect(getDocumentObject(document)).to.deep.equal(getDocumentObject(fetchedDocument)); + expect(fetchedDocument.getUpdatedAt()).to.be.deep.equal(fetchedDocument.getCreatedAt()); }); it('should be able to fetch created document by created timestamp', async () => { const [fetchedDocument] = await client.platform.documents.get( 'customContracts.indexedDocument', - { where: [['$createdAt', '==', document.getCreatedAt().getTime()]] }, + { + where: [['$createdAt', '>', document.getCreatedAt() + .getTime()]], + orderBy: [['$createdAt', 'desc']], + }, ); expect(fetchedDocument).to.exist(); - expect(document.toObject()).to.deep.equal(fetchedDocument.toObject()); + expect(getDocumentObject(document)).to.deep.equal(getDocumentObject(fetchedDocument)); }); it('should be able to update document', async () => { @@ -226,9 +274,13 @@ describe('Platform', () => { { where: [['$id', '==', document.getId()]] }, ); - expect(fetchedDocument.get('firstName')).to.equal('updatedName'); + expect(fetchedDocument.get('firstName')) + .to + .equal('updatedName'); expect(fetchedDocument.getUpdatedAt()) - .to.be.greaterThan(fetchedDocument.getCreatedAt()); + .to + .be + .greaterThan(fetchedDocument.getCreatedAt()); }); it.skip('should be able to prove that a document was updated', async () => { @@ -261,63 +313,57 @@ describe('Platform', () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - expect(proof.rootTreeProof).to.be.an.instanceof(Uint8Array); - expect(proof.rootTreeProof.length).to.be.greaterThan(0); - - expect(proof.storeTreeProofs).to.exist(); - expect(proof.storeTreeProofs.documentsProof).to.be.an.instanceof(Uint8Array); - expect(proof.storeTreeProofs.documentsProof.length).to.be.greaterThan(0); - - expect(proof.quorumHash).to.be.an.instanceof(Uint8Array); - expect(proof.quorumHash.length).to.be.equal(32); - - expect(proof.signature).to.be.an.instanceof(Uint8Array); - expect(proof.signature.length).to.be.equal(96); - - expect(proof.round).to.be.a('number'); - expect(proof.round).to.be.greaterThanOrEqual(0); - }); - - it('should fail to update document with timestamp in violated time frame', async () => { - const [storedDocument] = await client.platform.documents.get( - 'customContracts.indexedDocument', - { where: [['$id', '==', document.getId()]] }, - ); - - const updatedAt = storedDocument.getUpdatedAt(); - - updatedAt.setMinutes(updatedAt.getMinutes() - 10); - - let broadcastError; - - const documentsBatchTransition = await client.platform.documents.broadcast({ - replace: [storedDocument], - }, identity); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - const transitions = documentsBatchTransition.getTransitions(); - transitions[0].setRevision(transitions[0].getRevision() + 1); - transitions[0].setUpdatedAt(updatedAt); - - documentsBatchTransition.setTransitions(transitions); - const signedTransition = await signStateTransition( - client.platform, - documentsBatchTransition, - identity, - 1, - ); - - try { - await client.platform.broadcastStateTransition(signedTransition); - } catch (e) { - broadcastError = e; - } - - expect(broadcastError).to.exist(); - expect(broadcastError.code).to.be.equal(4008); - expect(broadcastError.message).to.match(/Document \w* updatedAt timestamp .* are out of block time window from .* and .*/); + expect(proof.rootTreeProof) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.rootTreeProof.length) + .to + .be + .greaterThan(0); + + expect(proof.storeTreeProofs) + .to + .exist(); + expect(proof.storeTreeProofs.documentsProof) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.storeTreeProofs.documentsProof.length) + .to + .be + .greaterThan(0); + + expect(proof.quorumHash) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.quorumHash.length) + .to + .be + .equal(32); + + expect(proof.signature) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.signature.length) + .to + .be + .equal(96); + + expect(proof.round) + .to + .be + .a('number'); + expect(proof.round) + .to + .be + .greaterThanOrEqual(0); }); it('should be able to delete a document', async () => { @@ -332,39 +378,10 @@ describe('Platform', () => { { where: [['$id', '==', document.getId()]] }, ); - expect(storedDocument).to.not.exist(); - }); - - it('should fail to create a new document with timestamp in violated time frame', async () => { - document = await client.platform.documents.create( - 'customContracts.indexedDocument', - identity, - { - firstName: 'myName', - lastName: 'lastName', - }, - ); - - const timestamp = document.getCreatedAt(); - - timestamp.setMinutes(timestamp.getMinutes() - 10); - - document.setCreatedAt(timestamp); - document.setUpdatedAt(timestamp); - - let broadcastError; - - try { - await client.platform.documents.broadcast({ - create: [document], - }, identity); - } catch (e) { - broadcastError = e; - } - - expect(broadcastError).to.exist(); - expect(broadcastError.message).to.match(/Document \w* createdAt timestamp .* are out of block time window from .* and .*/); - expect(broadcastError.code).to.be.equal(4008); + expect(storedDocument) + .to + .not + .exist(); }); }); }); diff --git a/packages/platform-test-suite/test/functional/platform/Identity.spec.js b/packages/platform-test-suite/test/functional/platform/Identity.spec.js index 3a1bf18e5af..09dd8b8e01b 100644 --- a/packages/platform-test-suite/test/functional/platform/Identity.spec.js +++ b/packages/platform-test-suite/test/functional/platform/Identity.spec.js @@ -2,10 +2,9 @@ const Dash = require('dash'); const { createFakeInstantLock } = require('dash/build/utils/createFakeIntantLock'); -const { hash } = require('@dashevo/wasm-dpp/lib/utils/hash'); +const { hash, sha256 } = require('@dashevo/wasm-dpp/lib/utils/hash'); const getDataContractFixture = require('../../../lib/test/fixtures/getDataContractFixture'); const createClientWithFundedWallet = require('../../../lib/test/createClientWithFundedWallet'); -const getDAPISeeds = require('../../../lib/test/getDAPISeeds'); const waitForSTPropagated = require('../../../lib/waitForSTPropagated'); const { @@ -23,6 +22,7 @@ const { IdentityPublicKey, InvalidInstantAssetLockProofSignatureError, IdentityAssetLockTransactionOutPointAlreadyExistsError, + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, BasicECDSAError, IdentityPublicKeyWithWitness, IdentityInsufficientBalanceError, @@ -55,6 +55,22 @@ describe('Platform', () => { expect(identity).to.exist(); }); + it('should fail to create an identity if asset lock amount is less than minimal', async () => { + let broadcastError; + + try { + await client.platform.identities.register(197000); + } catch (e) { + broadcastError = e; + } + + expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); + expect(broadcastError.getCause().getCode()).to.equal(10530); + expect(broadcastError.getCause()).to.be.an.instanceOf( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, + ); + }); + it('should fail to create an identity if instantLock is not valid', async () => { await client.platform.initialize(); @@ -62,7 +78,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(1); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const invalidInstantLock = createFakeInstantLock(transaction.hash); const assetLockProof = await client.platform.dpp.identity.createInstantAssetLockProof( @@ -87,7 +103,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1042); + expect(broadcastError.getCause().getCode()).to.equal(10513); expect(broadcastError.getCause()).to.be.an.instanceOf( InvalidInstantAssetLockProofSignatureError, ); @@ -101,7 +117,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(150000); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const account = await client.getWalletAccount(); @@ -141,7 +157,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1033); + expect(broadcastError.getCause().getCode()).to.equal(10504); expect(broadcastError.getCause()).to.be.an.instanceOf( IdentityAssetLockTransactionOutPointAlreadyExistsError, ); @@ -152,7 +168,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(15); + } = await client.platform.identities.utils.createAssetLockTransaction(210000); const account = await client.getWalletAccount(); @@ -192,7 +208,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(2009); + expect(broadcastError.getCause().getCode()).to.equal(20009); expect(broadcastError.getCause()).to.be.an.instanceOf( BasicECDSAError, ); @@ -217,13 +233,13 @@ describe('Platform', () => { }); it('should be able to get newly created identity by it\'s public key', async () => { - const response = await client.getDAPIClient().platform.getIdentitiesByPublicKeyHashes( - [identity.getPublicKeyById(0).hash()], + const response = await client.getDAPIClient().platform.getIdentityByPublicKeyHash( + identity.getPublicKeyById(0).hash(), ); - const [fetchedIdentity] = response.getIdentities(); + const fetchedIdentity = response.getIdentity(); - expect(fetchedIdentity).to.be.not.null(); + expect(fetchedIdentity.length).to.be.greaterThan(0); // TODO(rs-drive-abci): fix. rs-drive-abci now only returning identity bytes without the // asset lock proof. We would also want to do the same in rs-dpp and wasm-dpp, but @@ -245,7 +261,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(150000); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const account = await client.getWalletAccount(); @@ -309,7 +325,9 @@ describe('Platform', () => { let dataContractFixture; before(async () => { - dataContractFixture = await getDataContractFixture(identity.getId()); + const nextNonce = await client.platform.nonceManager + .bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(nextNonce, identity.getId()); await client.platform.contracts.publish(dataContractFixture, identity); @@ -323,7 +341,7 @@ describe('Platform', () => { }); it('should fail to create more documents if there are no more credits', async () => { - const lowBalanceIdentity = await client.platform.identities.register(150000); + const lowBalanceIdentity = await client.platform.identities.register(200000); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -358,7 +376,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(15); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const instantLock = createFakeInstantLock(transaction.hash); const assetLockProof = await client.platform.dpp.identity @@ -440,7 +458,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(1); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const account = await client.getWalletAccount(); @@ -457,7 +475,7 @@ describe('Platform', () => { // Creating ST that tries to spend the same output - const anotherIdentity = await client.platform.identities.register(150000); + const anotherIdentity = await client.platform.identities.register(200000); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -566,7 +584,7 @@ describe('Platform', () => { it('should be able to add public key to the identity', async () => { const identityBeforeUpdate = identity.toObject(); - expect(identityBeforeUpdate.publicKeys[3]).to.not.exist(); + const nextKeyId = identityBeforeUpdate.publicKeys.length; const account = await client.platform.client.getWalletAccount(); const identityIndex = await account.getUnusedIdentityIndex(); @@ -578,7 +596,7 @@ describe('Platform', () => { const identityPublicKey = identityPrivateKey.toPublicKey().toBuffer(); const newPublicKey = new IdentityPublicKeyWithWitness(1); - newPublicKey.setId(3); + newPublicKey.setId(nextKeyId); newPublicKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MEDIUM); newPublicKey.setData(identityPublicKey); @@ -604,7 +622,7 @@ describe('Platform', () => { expect(identity.getPublicKeyById(2)).to.exist(); const newPublicKeyObject = newPublicKey.toObject(true); - const expectedPublicKey = identity.getPublicKeyById(3).toObject(true); + const expectedPublicKey = identity.getPublicKeyById(4).toObject(true); delete expectedPublicKey.disabledAt; expect(expectedPublicKey).to.deep.equal( newPublicKeyObject, @@ -641,29 +659,12 @@ describe('Platform', () => { }); }); - // TODO(rs-drive-abci): fix - // fetching by opreatorIdentityId returns empty bytes and serialization fails - describe.skip('Masternodes', () => { - let dapiClient; - const network = process.env.NETWORK; - - beforeEach(() => { - dapiClient = new Dash.DAPIClient({ - network, - seeds: getDAPISeeds(), - }); - }); - + describe('Masternodes', () => { it('should receive masternode identities', async () => { await client.platform.initialize(); - const bestBlockHash = await dapiClient.core.getBestBlockHash(); - const baseBlockHash = await dapiClient.core.getBlockHash(1); - - const { mnList } = await dapiClient.core.getMnListDiff( - baseBlockHash, - bestBlockHash, - ); + const { mnList } = await client.getDAPIClient().dapiAddressProvider + .smlProvider.getSimplifiedMNList(); for (const masternodeEntry of mnList) { if (!masternodeEntry.isValid) { @@ -690,7 +691,7 @@ describe('Platform', () => { if (transaction.extraPayload.operatorReward > 0) { const operatorPubKey = Buffer.from(masternodeEntry.pubKeyOperator, 'hex'); - const operatorIdentityHash = hash( + const operatorIdentityHash = sha256( Buffer.concat([ Buffer.from(masternodeEntry.proRegTxHash, 'hex'), operatorPubKey, diff --git a/packages/platform-test-suite/test/functional/platform/proofs.spec.js b/packages/platform-test-suite/test/functional/platform/proofs.spec.js index 1ce7b4c69e8..d354fb7d4ec 100644 --- a/packages/platform-test-suite/test/functional/platform/proofs.spec.js +++ b/packages/platform-test-suite/test/functional/platform/proofs.spec.js @@ -32,7 +32,7 @@ describe('Platform', () => { let contractId; before(async () => { - dashClient = await createClientWithFundedWallet(500000); + dashClient = await createClientWithFundedWallet(1000000); await dashClient.platform.initialize(); @@ -134,11 +134,11 @@ describe('Platform', () => { let identity8PublicKeyHash; before(async () => { - identityAtKey5 = await dashClient.platform.identities.register(150000); + identityAtKey5 = await dashClient.platform.identities.register(200000); - identityAtKey6 = await dashClient.platform.identities.register(150000); + identityAtKey6 = await dashClient.platform.identities.register(200000); - identityAtKey8 = await dashClient.platform.identities.register(150000); + identityAtKey8 = await dashClient.platform.identities.register(200000); // await waitForBalanceToChange(walletAccount); @@ -233,7 +233,7 @@ describe('Platform', () => { }); // eslint-disable-next max-len - it('should be able to verify that multiple identities exist with getIdentitiesByPublicKeyHashes', async () => { + it.skip('should be able to verify that multiple identities exist with getIdentitiesByPublicKeyHashes', async () => { const publicKeyHashes = [ identity6PublicKeyHash, nonIncludedIdentityPubKeyHash, diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 8137e7c2144..ea4c4cc60ec 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,34 +1,38 @@ [package] name = "rs-dapi-client" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" [features] default = ["mocks", "offline-testing"] -mocks = ["dep:serde_json", "dep:sha2", "dep:hex"] +mocks = [ + "dep:sha2", + "dep:hex", + "dapi-grpc/mocks", + "dep:serde", + "dep:http-serde", + "dep:serde_json", +] # dump requests and responses to file -dump = ["mocks", "dep:serde_json", "dep:sha2", "dep:chrono", "dep:hex"] +dump = ["mocks"] # skip tests that require connection to the platform; enabled by default offline-testing = [] [dependencies] backon = "0.4.1" -dapi-grpc = { path = "../dapi-grpc", features = ["client"] } +dapi-grpc = { path = "../dapi-grpc" } futures = "0.3.28" -http = "0.2.9" +http-serde = { version = "1.1.3", optional = true } rand = { version = "0.8.5", features = ["small_rng"] } -thiserror = "1.0.41" -tonic = "0.9.2" -tracing = "0.1.37" -serde = { version = "1.0.171", default-features = false } -serde_json = { version = "1.0.103", features = [ - "preserve_order", -], optional = true } +thiserror = "1.0.58" +tracing = "0.1.40" tokio = { version = "1.32.0", default-features = false } sha2 = { version = "0.10", optional = true } -chrono = { version = "0.4.31", optional = true } hex = { version = "0.4.3", optional = true } - +lru = { version = "0.12.3" } +serde = { version = "1.0.197", optional = true, features = ["derive"] } +serde_json = { version = "1.0.120", optional = true } +chrono = { version = "0.4.38", features = ["serde"] } [dev-dependencies] tokio = { version = "1.32.0", features = ["macros"] } diff --git a/packages/rs-dapi-client/src/address_list.rs b/packages/rs-dapi-client/src/address_list.rs index 7d6aa6845fd..ab4e2ba0ebf 100644 --- a/packages/rs-dapi-client/src/address_list.rs +++ b/packages/rs-dapi-client/src/address_list.rs @@ -1,50 +1,94 @@ -//! Subsystem to manage peers. +//! Subsystem to manage DAPI nodes. -use std::time; - -use http::Uri; +use chrono::Utc; +use dapi_grpc::tonic::transport::Uri; use rand::{rngs::SmallRng, seq::IteratorRandom, SeedableRng}; +use std::collections::HashSet; +use std::hash::{Hash, Hasher}; +use std::str::FromStr; +use std::time::Duration; -const DEFAULT_BASE_BAN_PERIOD: time::Duration = time::Duration::from_secs(60); +const DEFAULT_BASE_BAN_PERIOD: Duration = Duration::from_secs(60); -/// Peer's address. -#[derive(Debug)] +/// DAPI address. +#[derive(Debug, Clone, Eq)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] pub struct Address { - base_ban_period: time::Duration, ban_count: usize, - banned_until: Option, + banned_until: Option>, + #[cfg_attr(feature = "mocks", serde(with = "http_serde::uri"))] uri: Uri, } +impl PartialEq for Address { + fn eq(&self, other: &Self) -> bool { + self.uri == other.uri + } +} + +impl PartialEq for Address { + fn eq(&self, other: &Uri) -> bool { + self.uri == *other + } +} + +impl Hash for Address { + fn hash(&self, state: &mut H) { + self.uri.hash(state); + } +} + +impl From for Address { + fn from(uri: Uri) -> Self { + Address { + ban_count: 0, + banned_until: None, + uri, + } + } +} + impl Address { /// Ban the [Address] so it won't be available through [AddressList::get_live_address] for some time. - pub fn ban(&mut self) { + fn ban(&mut self, base_ban_period: &Duration) { let coefficient = (self.ban_count as f64).exp(); - let ban_period = - time::Duration::from_secs_f64(self.base_ban_period.as_secs_f64() * coefficient); + let ban_period = Duration::from_secs_f64(base_ban_period.as_secs_f64() * coefficient); - self.banned_until = Some(time::Instant::now() + ban_period); + self.banned_until = Some(chrono::Utc::now() + ban_period); self.ban_count += 1; } + /// Check if [Address] is banned. + pub fn is_banned(&self) -> bool { + self.ban_count > 0 + } + /// Clears ban record. - pub fn clear_ban(&mut self) { + fn unban(&mut self) { self.ban_count = 0; self.banned_until = None; } - /// Get [Uri] of a peer. + /// Get [Uri] of a node. pub fn uri(&self) -> &Uri { &self.uri } } -/// A structure to manage peer's addresses to select from +/// [AddressList] errors +#[derive(Debug, thiserror::Error)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] +pub enum AddressListError { + #[error("address {0} not found in the list")] + AddressNotFound(#[cfg_attr(feature = "mocks", serde(with = "http_serde::uri"))] Uri), +} + +/// A structure to manage DAPI addresses to select from /// for [DapiRequest](crate::DapiRequest) execution. #[derive(Debug)] pub struct AddressList { - addresses: Vec
, - base_ban_period: time::Duration, + addresses: HashSet
, + base_ban_period: Duration, } impl Default for AddressList { @@ -53,6 +97,12 @@ impl Default for AddressList { } } +impl std::fmt::Display for Address { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.uri.fmt(f) + } +} + impl AddressList { /// Creates an empty [AddressList] with default base ban time. pub fn new() -> Self { @@ -60,38 +110,104 @@ impl AddressList { } /// Creates an empty [AddressList] with adjustable base ban time. - pub fn with_settings(base_ban_period: time::Duration) -> Self { + pub fn with_settings(base_ban_period: Duration) -> Self { AddressList { - addresses: Vec::new(), + addresses: HashSet::new(), base_ban_period, } } + /// Bans address + pub(crate) fn ban_address(&mut self, address: &Address) -> Result<(), AddressListError> { + if !self.addresses.remove(address) { + return Err(AddressListError::AddressNotFound(address.uri.clone())); + }; + + let mut banned_address = address.clone(); + banned_address.ban(&self.base_ban_period); + + self.addresses.insert(banned_address); + + Ok(()) + } + + /// Clears address' ban record + pub(crate) fn unban_address(&mut self, address: &Address) -> Result<(), AddressListError> { + if !self.addresses.remove(address) { + return Err(AddressListError::AddressNotFound(address.uri.clone())); + }; + + let mut unbanned_address = address.clone(); + unbanned_address.unban(); + + self.addresses.insert(unbanned_address); + + Ok(()) + } + + /// Adds a node [Address] to [AddressList] + /// Returns false if the address is already in the list. + pub fn add(&mut self, address: Address) -> bool { + self.addresses.insert(address) + } + // TODO: this is the most simple way to add an address - // however we need to support bulk loading (e.g. providing a network name) - // and also fetch updated from SML. - /// Manually add a peer to [AddressList]. - pub fn add_uri(&mut self, uri: Uri) { - self.addresses.push(Address { - ban_count: 0, - banned_until: None, - base_ban_period: self.base_ban_period, - uri, - }); + // however we need to support bulk loading (e.g. providing a network name) + // and also fetch updated from SML. + /// Add a node [Address] to [AddressList] by [Uri]. + /// Returns false if the address is already in the list. + pub fn add_uri(&mut self, uri: Uri) -> bool { + self.addresses.insert(uri.into()) } /// Randomly select a not banned address. - pub fn get_live_address(&mut self) -> Option<&mut Address> { - let now = time::Instant::now(); + pub fn get_live_address(&self) -> Option<&Address> { let mut rng = SmallRng::from_entropy(); + + self.unbanned().into_iter().choose(&mut rng) + } + + /// Get all addresses that are not banned. + fn unbanned(&self) -> Vec<&Address> { + let now = chrono::Utc::now(); + self.addresses - .iter_mut() + .iter() .filter(|addr| { addr.banned_until .map(|banned_until| banned_until < now) .unwrap_or(true) }) - .choose(&mut rng) + .collect() + } + + /// Get number of available, not banned addresses. + pub fn available(&self) -> usize { + self.unbanned().len() + } + + /// Get number of all addresses, both banned and not banned. + pub fn len(&self) -> usize { + self.addresses.len() + } + + /// Check if the list is empty. + /// Returns true if there are no addresses in the list. + /// Returns false if there is at least one address in the list. + /// Banned addresses are also counted. + pub fn is_empty(&self) -> bool { + self.addresses.is_empty() + } +} + +impl From<&str> for AddressList { + fn from(value: &str) -> Self { + let uri_list: Vec = value + .split(',') + .map(|uri| Uri::from_str(uri).expect("invalid uri")) + .collect(); + + Self::from_iter(uri_list) } } diff --git a/packages/rs-dapi-client/src/connection_pool.rs b/packages/rs-dapi-client/src/connection_pool.rs new file mode 100644 index 00000000000..16d8cf030db --- /dev/null +++ b/packages/rs-dapi-client/src/connection_pool.rs @@ -0,0 +1,172 @@ +use std::{ + fmt::Display, + sync::{Arc, Mutex}, +}; + +use dapi_grpc::tonic::transport::Uri; +use lru::LruCache; + +use crate::{ + request_settings::AppliedRequestSettings, + transport::{CoreGrpcClient, PlatformGrpcClient}, +}; + +/// ConnectionPool represents pool of connections to DAPI nodes. +/// +/// It can be cloned and shared between threads. +/// Cloning the pool will create a new reference to the same pool. +#[derive(Debug, Clone)] +pub struct ConnectionPool { + inner: Arc>>, +} + +impl ConnectionPool { + /// Create a new pool with a given capacity. + /// The pool will evict the least recently used item when the capacity is reached. + /// + /// # Panics + /// + /// Panics if the capacity is zero. + pub fn new(capacity: usize) -> Self { + Self { + inner: Arc::new(Mutex::new(LruCache::new( + capacity.try_into().expect("must be non-zero"), + ))), + } + } +} + +impl Default for ConnectionPool { + fn default() -> Self { + Self::new(50) + } +} + +impl ConnectionPool { + /// Get item from the pool for the given uri and settings. + /// + /// # Arguments + /// * `prefix` - Prefix for the item in the pool. Used to distinguish between Core and Platform clients. + /// * `uri` - URI of the node. + /// * `settings` - Applied request settings. + pub fn get( + &self, + prefix: PoolPrefix, + uri: &Uri, + settings: Option<&AppliedRequestSettings>, + ) -> Option { + let key = Self::key(prefix, uri, settings); + self.inner.lock().expect("must lock").get(&key).cloned() + } + + /// Get value from cache or create it using provided closure. + /// If value is already in the cache, it will be returned. + /// If value is not in the cache, it will be created by calling `create()` and stored in the cache. + /// + /// # Arguments + /// * `prefix` - Prefix for the item in the pool. Used to distinguish between Core and Platform clients. + /// * `uri` - URI of the node. + /// * `settings` - Applied request settings. + pub fn get_or_create( + &self, + prefix: PoolPrefix, + uri: &Uri, + settings: Option<&AppliedRequestSettings>, + create: impl FnOnce() -> PoolItem, + ) -> PoolItem { + if let Some(cli) = self.get(prefix, uri, settings) { + return cli; + } + + let cli = create(); + self.put(uri, settings, cli.clone()); + cli + } + + /// Put item into the pool for the given uri and settings. + pub fn put(&self, uri: &Uri, settings: Option<&AppliedRequestSettings>, value: PoolItem) { + let key = Self::key(&value, uri, settings); + self.inner.lock().expect("must lock").put(key, value); + } + + fn key>( + class: C, + uri: &Uri, + settings: Option<&AppliedRequestSettings>, + ) -> String { + let prefix: PoolPrefix = class.into(); + format!("{}:{}{:?}", prefix, uri, settings) + } +} + +/// Item stored in the pool. +/// +/// We use an enum as we need to represent two different types of clients. +#[derive(Clone, Debug)] +pub enum PoolItem { + Core(CoreGrpcClient), + Platform(PlatformGrpcClient), +} + +impl From for PoolItem { + fn from(client: PlatformGrpcClient) -> Self { + Self::Platform(client) + } +} +impl From for PoolItem { + fn from(client: CoreGrpcClient) -> Self { + Self::Core(client) + } +} + +impl From for PlatformGrpcClient { + fn from(client: PoolItem) -> Self { + match client { + PoolItem::Platform(client) => client, + _ => { + tracing::error!( + ?client, + "invalid connection fetched from pool: expected platform client" + ); + panic!("ClientType is not Platform: {:?}", client) + } + } + } +} + +impl From for CoreGrpcClient { + fn from(client: PoolItem) -> Self { + match client { + PoolItem::Core(client) => client, + _ => { + tracing::error!( + ?client, + "invalid connection fetched from pool: expected core client" + ); + panic!("ClientType is not Core: {:?}", client) + } + } + } +} + +/// Prefix for the item in the pool. Used to distinguish between Core and Platform clients. +pub enum PoolPrefix { + Core, + Platform, +} +impl Display for PoolPrefix { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + PoolPrefix::Core => write!(f, "Core"), + PoolPrefix::Platform => write!(f, "Platform"), + } + } +} +impl From<&PoolItem> for PoolPrefix { + fn from(item: &PoolItem) -> Self { + match item { + PoolItem::Core(_) => PoolPrefix::Core, + PoolItem::Platform(_) => PoolPrefix::Platform, + } + } +} diff --git a/packages/rs-dapi-client/src/dapi_client.rs b/packages/rs-dapi-client/src/dapi_client.rs index ca50c08666e..8e5a3d660b2 100644 --- a/packages/rs-dapi-client/src/dapi_client.rs +++ b/packages/rs-dapi-client/src/dapi_client.rs @@ -1,73 +1,99 @@ //! [DapiClient] definition. use backon::{ExponentialBuilder, Retryable}; -use tonic::async_trait; +use dapi_grpc::mock::Mockable; +use dapi_grpc::tonic::async_trait; +use std::fmt::Debug; +use std::sync::{Arc, RwLock}; +use std::time::Duration; use tracing::Instrument; +use crate::address_list::AddressListError; +use crate::connection_pool::ConnectionPool; use crate::{ transport::{TransportClient, TransportRequest}, - AddressList, CanRetry, RequestSettings, + Address, AddressList, CanRetry, RequestSettings, }; /// General DAPI request error type. #[derive(Debug, thiserror::Error)] -pub enum DapiClientError { +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] +pub enum DapiClientError { /// The error happened on transport layer - #[error("transport error: {0}")] - Transport(TE), - /// There are no valid peer addresses to use. + #[error("transport error with {1}: {0}")] + Transport( + #[cfg_attr(feature = "mocks", serde(with = "dapi_grpc::mock::serde_mockable"))] TE, + Address, + ), + /// There are no valid DAPI addresses to use. #[error("no available addresses to use")] NoAvailableAddresses, + /// [AddressListError] errors + #[error("address list error: {0}")] + AddressList(AddressListError), + #[cfg(feature = "mocks")] - /// Expectation not found - #[error("mock expectation not found for request: {0}")] - MockExpectationNotFound(String), + #[error("mock error: {0}")] + /// Error happened in mock client + Mock(#[from] crate::mock::MockError), } -impl CanRetry for DapiClientError { - fn can_retry(&self) -> bool { +impl CanRetry for DapiClientError { + fn is_node_failure(&self) -> bool { use DapiClientError::*; match self { NoAvailableAddresses => false, - Transport(transport_error) => transport_error.can_retry(), + Transport(transport_error, _) => transport_error.is_node_failure(), + AddressList(_) => false, #[cfg(feature = "mocks")] - MockExpectationNotFound(_) => false, + Mock(_) => false, } } } -#[async_trait] -/// DAPI client trait. -pub trait Dapi { - /// Execute request using this DAPI client. - async fn execute( - &mut self, - request: R, - settings: RequestSettings, - ) -> Result::Error>> - where - R: TransportRequest; +#[cfg(feature = "mocks")] +#[derive(serde::Serialize, serde::Deserialize)] +struct TransportErrorData { + transport_error: Vec, + address: Address, +} + +/// Serialization of [DapiClientError]. +/// +/// We need to do manual serialization because of the generic type parameter which doesn't support serde derive. +impl Mockable for DapiClientError { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + Some(serde_json::to_vec(self).expect("serialize DAPI client error")) + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + Some(serde_json::from_slice(data).expect("deserialize DAPI client error")) + } } #[async_trait] -impl Dapi for &mut D { +/// DAPI client executor trait. +pub trait DapiRequestExecutor { + /// Execute request using this DAPI client. async fn execute( - &mut self, + &self, request: R, settings: RequestSettings, ) -> Result::Error>> where - R: TransportRequest, - { - (**self).execute(request, settings).await - } + R: TransportRequest + Mockable, + R::Response: Mockable, + ::Error: Mockable; } /// Access point to DAPI. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct DapiClient { - address_list: AddressList, + address_list: Arc>, settings: RequestSettings, + pool: ConnectionPool, #[cfg(feature = "dump")] pub(crate) dump_dir: Option, } @@ -75,9 +101,13 @@ pub struct DapiClient { impl DapiClient { /// Initialize new [DapiClient] and optionally override default settings. pub fn new(address_list: AddressList, settings: RequestSettings) -> Self { + // multiply by 3 as we need to store core and platform addresses, and we want some spare capacity just in case + let address_count = 3 * address_list.len(); + Self { - address_list, + address_list: Arc::new(RwLock::new(address_list)), settings, + pool: ConnectionPool::new(address_count), #[cfg(feature = "dump")] dump_dir: None, } @@ -85,15 +115,17 @@ impl DapiClient { } #[async_trait] -impl Dapi for DapiClient { +impl DapiRequestExecutor for DapiClient { /// Execute the [DapiRequest](crate::DapiRequest). async fn execute( - &mut self, + &self, request: R, settings: RequestSettings, ) -> Result::Error>> where - R: TransportRequest, + R: TransportRequest + Mockable, + R::Response: Mockable, + ::Error: Mockable, { // Join settings of different sources to get final version of the settings for this execution: let applied_settings = self @@ -103,7 +135,12 @@ impl Dapi for DapiClient { .finalize(); // Setup retry policy: - let retry_settings = ExponentialBuilder::default().with_max_times(applied_settings.retries); + let retry_settings = ExponentialBuilder::default() + .with_max_times(applied_settings.retries) + // backon doesn't accept 1.0 + .with_factor(1.001) + .with_min_delay(Duration::from_secs(0)) + .with_max_delay(Duration::from_secs(0)); // Save dump dir for later use, as self is moved into routine #[cfg(feature = "dump")] @@ -115,43 +152,120 @@ impl Dapi for DapiClient { // more once to build new future on each retry. let routine = move || { // Try to get an address to initialize transport on: - let address = self.address_list.get_live_address().ok_or( + + let address_list = self + .address_list + .read() + .expect("can't get address list for read"); + + let address_result = address_list.get_live_address().cloned().ok_or( DapiClientError::<::Error>::NoAvailableAddresses, ); - // Get a transport client requried by the DAPI request from this DAPI client. - // It stays wrapped in `Result` since we want to return - // `impl Future`, not a `Result` itself. - let transport_client = address.map(|addr| R::Client::with_uri(addr.uri().clone())); + drop(address_list); + + let _span = tracing::trace_span!( + "execute request", + address = ?address_result, + settings = ?applied_settings, + method = request.method_name(), + ) + .entered(); + + tracing::trace!( + ?request, + "calling {} with {} request", + request.method_name(), + request.request_name(), + ); let transport_request = request.clone(); + let response_name = request.response_name(); // Create a future using `async` block that will be returned from the closure on // each retry. Could be just a request future, but need to unpack client first. async move { - transport_request - .execute_transport(&mut transport_client?, &applied_settings) + // It stays wrapped in `Result` since we want to return + // `impl Future`, not a `Result` itself. + let address = address_result?; + let pool = self.pool.clone(); + + let mut transport_client = R::Client::with_uri_and_settings( + address.uri().clone(), + &applied_settings, + &pool, + ); + + let response = transport_request + .execute_transport(&mut transport_client, &applied_settings) .await .map_err(|e| { - DapiClientError::<::Error>::Transport(e) - }) + DapiClientError::<::Error>::Transport( + e, + address.clone(), + ) + }); + + match &response { + Ok(_) => { + // Unban the address if it was banned and node responded successfully this time + if address.is_banned() { + let mut address_list = self + .address_list + .write() + .expect("can't get address list for write"); + + address_list.unban_address(&address) + .map_err(DapiClientError::<::Error>::AddressList)?; + } + + tracing::trace!(?response, "received {} response", response_name); + } + Err(error) => { + if error.is_node_failure() { + if applied_settings.ban_failed_address { + let mut address_list = self + .address_list + .write() + .expect("can't get address list for write"); + + address_list.ban_address(&address) + .map_err(DapiClientError::<::Error>::AddressList)?; + } + } else { + tracing::trace!(?error, "received error"); + } + } + }; + + response } }; // Start the routine with retry policy applied: // We allow let_and_return because `result` is used later if dump feature is enabled - #[allow(clippy::let_and_return)] let result = routine .retry(&retry_settings) - .when(|e| e.can_retry()) + .notify(|error, duration| { + tracing::warn!( + ?error, + "retrying error with sleeping {} secs", + duration.as_secs_f32() + ) + }) + .when(|e| e.is_node_failure()) .instrument(tracing::info_span!("request routine")) .await; + if let Err(error) = &result { + if error.is_node_failure() { + tracing::error!(?error, "request failed"); + } + } + // Dump request and response to disk if dump_dir is set: #[cfg(feature = "dump")] - if let Ok(ref result) = &result { - Self::dump_request_response(dump_request, result.clone(), dump_dir); - } + Self::dump_request_response(&dump_request, &result, dump_dir); result } diff --git a/packages/rs-dapi-client/src/dump.rs b/packages/rs-dapi-client/src/dump.rs index 4abafd6a65a..c81399395bf 100644 --- a/packages/rs-dapi-client/src/dump.rs +++ b/packages/rs-dapi-client/src/dump.rs @@ -1,21 +1,105 @@ //! Dumping of requests and responses to disk -use crate::{mock::Key, transport::TransportRequest, DapiClient}; -use std::path::PathBuf; +use dapi_grpc::mock::Mockable; + +use crate::{ + mock::{Key, MockResult}, + transport::TransportRequest, + DapiClient, +}; +use std::{any::type_name, path::PathBuf}; -#[derive(serde::Serialize, serde::Deserialize)] /// Data format of dumps created with [DapiClient::dump_dir]. +#[derive(Clone)] pub struct DumpData { /// Request that was sent to DAPI. - pub request: T, + pub serialized_request: Vec, /// Response that was received from DAPI. - pub response: T::Response, + pub serialized_response: Vec, + + phantom: std::marker::PhantomData, +} +impl DumpData { + /// Return deserialized request + pub fn deserialize(&self) -> (T, MockResult) { + let req = T::mock_deserialize(&self.serialized_request).unwrap_or_else(|| { + panic!( + "unable to deserialize mock data of type {}", + type_name::() + ) + }); + let resp = + >::mock_deserialize(&self.serialized_response).unwrap_or_else(|| { + panic!( + "unable to deserialize mock data of type {}", + type_name::() + ) + }); + + (req, resp) + } +} + +impl dapi_grpc::mock::Mockable for DumpData +where + T: Mockable, + T::Response: Mockable, +{ + // We use null-delimited JSON as a format for dump data to make it readable. + fn mock_serialize(&self) -> Option> { + // nulls are not allowed in serialized data as we use it as a delimiter + if self.serialized_request.contains(&0) { + panic!("null byte in serialized request"); + } + if self.serialized_response.contains(&0) { + panic!("null byte in serialized response"); + } + + let data = [ + &self.serialized_request, + "\n\0\n".as_bytes(), + &self.serialized_response, + ] + .concat(); + + Some(data) + } + + fn mock_deserialize(buf: &[u8]) -> Option { + // we panic as we expect this to be called only with data serialized by mock_serialize() + + // Split data into request and response + let buf = buf.split(|&b| b == 0).collect::>(); + if buf.len() != 2 { + panic!("invalid mock data format, expected exactly two items separated by null byte"); + } + + let request = buf.first().expect("missing request in mock data"); + let response = buf.last().expect("missing response in mock data"); + + Some(Self { + serialized_request: request.to_vec(), + serialized_response: response.to_vec(), + phantom: std::marker::PhantomData, + }) + } } impl DumpData { /// Create new dump data. - pub fn new(request: T, response: T::Response) -> Self { - Self { request, response } + pub fn new(request: &T, response: &MockResult) -> Self { + let request = request + .mock_serialize() + .expect("unable to serialize request"); + let response = response + .mock_serialize() + .expect("unable to serialize response"); + + Self { + serialized_request: request, + serialized_response: response, + phantom: std::marker::PhantomData, + } } // Return request type (T) name without module prefix @@ -28,19 +112,16 @@ impl DumpData { /// Filename consists of: /// /// * [DapiClient::DUMP_FILE_PREFIX] - /// * current timestamp /// * basename of the type of request, like `GetIdentityRequest` /// * unique identifier (hash) of the request pub fn filename(&self) -> Result { - let now = chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Nanos, true); - let key = Key::try_new(&self.request)?; + let key = Key::try_new(&self.serialized_request)?; // get request type without underscores (which we use as a file name separator) let request_type = Self::request_type().replace('_', "-"); let file = format!( - "{}_{}_{}_{}.json", + "{}_{}_{}.json", DapiClient::DUMP_FILE_PREFIX, - now, request_type, key ); @@ -51,33 +132,30 @@ impl DumpData { /// Load dump data from file. pub fn load>(file: P) -> Result where - T: for<'de> serde::Deserialize<'de>, - T::Response: for<'de> serde::Deserialize<'de>, + T: Mockable, + T::Response: Mockable, { - let f = std::fs::File::open(file)?; - - let data: Self = serde_json::from_reader(f).map_err(|e| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to parse json: {}", e), - ) - })?; - - Ok(data) + let data = std::fs::read(file)?; + + Self::mock_deserialize(&data).ok_or(std::io::Error::new( + std::io::ErrorKind::InvalidData, + format!( + "unable to deserialize mock data of type {}", + type_name::() + ), + )) } /// Save dump data to file. pub fn save(&self, file: &std::path::Path) -> Result<(), std::io::Error> where - T: serde::Serialize, - T::Response: serde::Serialize, + T: Mockable, + T::Response: Mockable, { - let encoded = serde_json::to_vec(self).map_err(|e| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to serialize json: {}", e), - ) - })?; + let encoded = self.mock_serialize().ok_or(std::io::Error::new( + std::io::ErrorKind::InvalidData, + format!("unable to serialize mock data of type {}", type_name::()), + ))?; std::fs::write(file, encoded) } @@ -107,12 +185,12 @@ impl DapiClient { /// /// Any errors are logged on `warn` level and ignored. pub(crate) fn dump_request_response( - request: R, - response: R::Response, + request: &R, + response: &MockResult, dump_dir: Option, ) where - R: serde::Serialize, - R::Response: serde::Serialize, + R: Mockable, + ::Response: Mockable, { let path = match dump_dir { Some(p) => p, diff --git a/packages/rs-dapi-client/src/lib.rs b/packages/rs-dapi-client/src/lib.rs index 0b3c19b74b3..e4f5836e29e 100644 --- a/packages/rs-dapi-client/src/lib.rs +++ b/packages/rs-dapi-client/src/lib.rs @@ -3,6 +3,7 @@ #![deny(missing_docs)] mod address_list; +mod connection_pool; mod dapi_client; #[cfg(feature = "dump")] pub mod dump; @@ -11,14 +12,14 @@ pub mod mock; mod request_settings; pub mod transport; -pub use dapi_client::Dapi; -use futures::{future::BoxFuture, FutureExt}; -pub use http::Uri; - +pub use address_list::Address; pub use address_list::AddressList; +pub use dapi_client::DapiRequestExecutor; pub use dapi_client::{DapiClient, DapiClientError}; +use dapi_grpc::mock::Mockable; #[cfg(feature = "dump")] pub use dump::DumpData; +use futures::{future::BoxFuture, FutureExt}; pub use request_settings::RequestSettings; /// A DAPI request could be executed with an initialized [DapiClient]. @@ -39,12 +40,12 @@ pub trait DapiRequest { /// Response from DAPI for this specific request. type Response; /// An error type for the transport this request uses. - type TransportError; + type TransportError: Mockable; /// Executes the request. - fn execute<'c, D: Dapi>( + fn execute<'c, D: DapiRequestExecutor>( self, - dapi_client: &'c mut D, + dapi_client: &'c D, settings: RequestSettings, ) -> BoxFuture<'c, Result>> where @@ -57,9 +58,9 @@ impl DapiRequest for T { type TransportError = ::Error; - fn execute<'c, D: Dapi>( + fn execute<'c, D: DapiRequestExecutor>( self, - dapi_client: &'c mut D, + dapi_client: &'c D, settings: RequestSettings, ) -> BoxFuture<'c, Result>> where @@ -73,5 +74,5 @@ impl DapiRequest for T { /// try to do a request again. pub trait CanRetry { /// Get boolean flag that indicates if the error is retryable. - fn can_retry(&self) -> bool; + fn is_node_failure(&self) -> bool; } diff --git a/packages/rs-dapi-client/src/mock.rs b/packages/rs-dapi-client/src/mock.rs index 142f7674747..813546686d4 100644 --- a/packages/rs-dapi-client/src/mock.rs +++ b/packages/rs-dapi-client/src/mock.rs @@ -13,8 +13,10 @@ use crate::{ transport::{TransportClient, TransportRequest}, - Dapi, DapiClientError, RequestSettings, + DapiClientError, DapiRequestExecutor, RequestSettings, }; +use dapi_grpc::mock::Mockable; +use dapi_grpc::tonic::async_trait; use hex::ToHex; use sha2::Digest; use std::{ @@ -22,17 +24,22 @@ use std::{ collections::HashMap, fmt::{Debug, Display}, }; -use tonic::async_trait; /// Mock DAPI client. /// -/// This is a mock implmeneation of [Dapi] that can be used for testing. +/// This is a mock implmeneation of [DapiRequestExecutor] that can be used for testing. /// /// See `tests/mock_dapi_client.rs` for an example. -#[derive(Default)] +#[derive(Default, Debug)] pub struct MockDapiClient { expectations: Expectations, } +/// Result of executing a mock request +pub type MockResult = Result< + ::Response, + DapiClientError<<::Client as TransportClient>::Error>, +>; + impl MockDapiClient { /// Create a new mock client pub fn new() -> Self { @@ -40,62 +47,73 @@ impl MockDapiClient { } /// Add a new expectation for a request - pub fn expect(&mut self, request: &R, response: &R::Response) -> &mut Self + pub fn expect( + &mut self, + request: &R, + response: &MockResult, + ) -> Result<&mut Self, MockError> where - R: TransportRequest, + R: TransportRequest + Mockable, + R::Response: Mockable, { - let key = self.expectations.add(request, response); + let key = self.expectations.add(request, response)?; tracing::trace!( %key, request_type = std::any::type_name::(), - response_typr = std::any::type_name::(), + response_type = std::any::type_name::(), "mock added expectation" ); - self + Ok(self) } /// Load expectation from file. /// /// The file must contain JSON structure. /// See [DumpData](crate::DumpData) and [DapiClient::dump_dir()](crate::DapiClient::dump_dir()) more for details. + /// + /// # Panics + /// + /// Panics if the file can't be read or the data can't be parsed. #[cfg(feature = "dump")] pub fn load>( &mut self, file: P, - ) -> Result<(T, T::Response), std::io::Error> + ) -> Result<(T, MockResult), std::io::Error> where - T: for<'de> serde::Deserialize<'de>, - T::Response: for<'de> serde::Deserialize<'de>, + T: Mockable, + T::Response: Mockable, { - let f = std::fs::File::open(file)?; + use crate::DumpData; - #[derive(serde::Deserialize)] - struct Data { - request: R, - response: R::Response, - } + let buf = std::fs::read(file)?; + let data = DumpData::::mock_deserialize(&buf).ok_or({ + std::io::Error::new(std::io::ErrorKind::InvalidData, "unable to parse json") + })?; - let data: Data = serde_json::from_reader(f).map_err(|e| { + let (request, response) = data.deserialize(); + self.expect(&request, &response).map_err(|e| { std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to parse json: {}", e), + std::io::ErrorKind::InvalidInput, + format!("unable to add expectation: {}", e), ) })?; - - self.expect(&data.request, &data.response); - Ok((data.request, data.response)) + Ok((request, response)) } } #[async_trait] -impl Dapi for MockDapiClient { +impl DapiRequestExecutor for MockDapiClient { async fn execute( - &mut self, + &self, request: R, _settings: RequestSettings, - ) -> Result::Error>> { + ) -> MockResult + where + R: Mockable, + R::Response: Mockable, + { let (key, response) = self.expectations.get(&request); tracing::trace!( @@ -107,17 +125,18 @@ impl Dapi for MockDapiClient { ); return if let Some(response) = response { - Ok(response) + response } else { - Err(DapiClientError::MockExpectationNotFound(format!( + Err(MockError::MockExpectationNotFound(format!( "unexpected mock request with key {}, use MockDapiClient::expect(): {:?}", key, request - ))) + )) + .into()) }; } } -#[derive(Eq, Hash, PartialEq, PartialOrd, Ord, Clone)] +#[derive(Eq, Hash, PartialEq, PartialOrd, Ord, Clone, Debug)] /// Unique identifier of some serializable object (e.g. request) that can be used as a key in a hashmap. pub struct Key([u8; 32]); @@ -127,34 +146,25 @@ impl Key { /// # Panics /// /// Panics if the object can't be serialized. - pub fn new(request: S) -> Self { + pub fn new(request: &S) -> Self { Self::try_new(request).expect("unable to create a key") } /// Generate unique identifier of some serializable object (e.g. request). - pub fn try_new(request: S) -> Result { - let mut encoded = match serde_json::to_vec(&request) { - Ok(b) => b, - Err(e) => { - return Err(std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to serialize json: {}", e), - )) - } - }; + pub fn try_new(request: &S) -> Result { // we append type name to the encoded value to make sure that different types // will have different keys let typ = type_name::().replace('&', ""); //remove & from type name + + let mut encoded = S::mock_serialize(request).ok_or(std::io::Error::new( + std::io::ErrorKind::InvalidData, + format!("mocking not supported for object of type {}", typ), + ))?; encoded.append(&mut typ.as_bytes().to_vec()); let mut e = sha2::Sha256::new(); e.update(encoded); - let key = e.finalize().try_into().map_err(|e| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("invalid key generated: {}", e), - ) - })?; + let key = e.finalize().into(); Ok(Self(key)) } @@ -175,21 +185,36 @@ impl Display for Key { } } +#[derive(Debug, thiserror::Error)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] +/// Mock errors +pub enum MockError { + #[error("mock expectation not found for request: {0}")] + /// Expectation not found + MockExpectationNotFound(String), + + #[error("expectation already defined for request: {0}")] + /// Expectation already defined for request + MockExpectationConflict(String), +} + +#[derive(Debug)] +/// Wrapper that encapsulated serialized form of expected response for a request struct ExpectedResponse(Vec); impl ExpectedResponse { - fn serialize(request: &I) -> Self { + fn serialize(request: &I) -> Self { // We use json because bincode sometimes fail to deserialize - Self(serde_json::to_vec(request).expect("encode value")) + Self(request.mock_serialize().expect("encode value")) } - fn deserialize serde::Deserialize<'de>>(&self) -> O { + fn deserialize(&self) -> O { // We use json because bincode sometimes fail to deserialize - serde_json::from_slice(&self.0).expect("deserialize value") + O::mock_deserialize(&self.0).expect("deserialize value") } } -#[derive(Default)] +#[derive(Default, Debug)] /// Requests expected by a mock and their responses. struct Expectations { expectations: HashMap, @@ -198,28 +223,33 @@ struct Expectations { impl Expectations { /// Add expected request and provide given response. /// - /// If the expectation already exists, it will be silently replaced. - pub fn add( + /// If the expectation already exists, error is returned. + pub fn add( &mut self, request: &I, response: &O, - ) -> Key { + ) -> Result { let key = Key::new(request); let value = ExpectedResponse::serialize(response); + if self.expectations.contains_key(&key) { + return Err(MockError::MockExpectationConflict(format!( + "expectation with key {} already defined for {} request", + key, + std::any::type_name::(), + ))); + } + self.expectations.insert(key.clone(), value); - key + Ok(key) } /// Get the response for a given request. /// /// Returns `None` if the request has not been expected. - pub fn get serde::Deserialize<'de> + Debug>( - &self, - request: I, - ) -> (Key, Option) { - let key = Key::new(&request); + pub fn get(&self, request: &I) -> (Key, Option) { + let key = Key::new(request); let response = self.expectations.get(&key).and_then(|v| v.deserialize()); diff --git a/packages/rs-dapi-client/src/request_settings.rs b/packages/rs-dapi-client/src/request_settings.rs index 79d94eb497f..7c900a78290 100644 --- a/packages/rs-dapi-client/src/request_settings.rs +++ b/packages/rs-dapi-client/src/request_settings.rs @@ -2,8 +2,11 @@ use std::time::Duration; +/// Default low-level client timeout +const DEFAULT_CONNECT_TIMEOUT: Option = None; const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10); const DEFAULT_RETRIES: usize = 5; +const DEFAULT_BAN_FAILED_ADDRESS: bool = true; /// DAPI request settings. /// @@ -12,12 +15,16 @@ const DEFAULT_RETRIES: usize = 5; /// 2. [crate::DapiClient] settings; /// 3. [crate::DapiRequest]-specific settings; /// 4. settings for an exact request execution call. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)] pub struct RequestSettings { + /// Timeout for establishing a connection. + pub connect_timeout: Option, /// Timeout for a request. pub timeout: Option, /// Number of retries until returning the last error. pub retries: Option, + /// Ban DAPI address if node not responded or responded with error. + pub ban_failed_address: Option, } impl RequestSettings { @@ -25,8 +32,10 @@ impl RequestSettings { /// Actually does the same as [Default], but it's `const`. pub const fn default() -> Self { RequestSettings { + connect_timeout: None, timeout: None, retries: None, + ban_failed_address: None, } } @@ -35,16 +44,22 @@ impl RequestSettings { /// 2. in case of two [Some] variants, right hand side argument will overwrite the value. pub fn override_by(self, rhs: RequestSettings) -> Self { RequestSettings { + connect_timeout: rhs.connect_timeout.or(self.connect_timeout), timeout: rhs.timeout.or(self.timeout), retries: rhs.retries.or(self.retries), + ban_failed_address: rhs.ban_failed_address.or(self.ban_failed_address), } } /// Fill in settings defaults. pub fn finalize(self) -> AppliedRequestSettings { AppliedRequestSettings { + connect_timeout: self.connect_timeout.or(DEFAULT_CONNECT_TIMEOUT), timeout: self.timeout.unwrap_or(DEFAULT_TIMEOUT), retries: self.retries.unwrap_or(DEFAULT_RETRIES), + ban_failed_address: self + .ban_failed_address + .unwrap_or(DEFAULT_BAN_FAILED_ADDRESS), } } } @@ -52,8 +67,12 @@ impl RequestSettings { /// DAPI settings ready to use. #[derive(Debug, Clone, Copy)] pub struct AppliedRequestSettings { + /// Timeout for establishing a connection. + pub connect_timeout: Option, /// Timeout for a request. pub timeout: Duration, /// Number of retries until returning the last error. pub retries: usize, + /// Ban DAPI address if node not responded or responded with error. + pub ban_failed_address: bool, } diff --git a/packages/rs-dapi-client/src/transport.rs b/packages/rs-dapi-client/src/transport.rs index 0af60c9bc5e..a5459834e1b 100644 --- a/packages/rs-dapi-client/src/transport.rs +++ b/packages/rs-dapi-client/src/transport.rs @@ -2,25 +2,41 @@ pub(crate) mod grpc; +use crate::connection_pool::ConnectionPool; pub use crate::request_settings::AppliedRequestSettings; use crate::{CanRetry, RequestSettings}; +use dapi_grpc::mock::Mockable; +use dapi_grpc::tonic::transport::Uri; pub use futures::future::BoxFuture; pub use grpc::{CoreGrpcClient, PlatformGrpcClient}; -use http::Uri; +use std::any; use std::fmt::Debug; /// Generic transport layer request. /// Requires [Clone] as could be retried and a client in general consumes a request. -pub trait TransportRequest: Clone + Send + Sync + Debug + serde::Serialize { +pub trait TransportRequest: Clone + Send + Sync + Debug + Mockable { /// A client specific to this type of transport. type Client: TransportClient; /// Transport layer response. - type Response: TransportResponse; + type Response: Mockable + Send + Debug; /// Settings that will override [DapiClient](crate::DapiClient)'s ones each time the request is executed. const SETTINGS_OVERRIDES: RequestSettings; + /// gRPC request name + fn request_name(&self) -> &'static str { + any::type_name::() + } + + /// gRPC response name + fn response_name(&self) -> &'static str { + any::type_name::() + } + + /// gRPC method name + fn method_name(&self) -> &'static str; + /// Perform transport request asynchronously. fn execute_transport<'c>( self, @@ -29,17 +45,18 @@ pub trait TransportRequest: Clone + Send + Sync + Debug + serde::Serialize { ) -> BoxFuture<'c, Result::Error>>; } -/// Generic transport layer response. -pub trait TransportResponse: - Clone + Send + Sync + Debug + serde::Serialize + for<'de> serde::Deserialize<'de> -{ -} - /// Generic way to create a transport client from provided [Uri]. pub trait TransportClient: Send + Sized { /// Error type for the specific client. - type Error: CanRetry + Send + Debug; + type Error: CanRetry + Send + Debug + Mockable; + + /// Build client using node's url. + fn with_uri(uri: Uri, pool: &ConnectionPool) -> Self; - /// Build client using peer's url. - fn with_uri(uri: Uri) -> Self; + /// Build client using node's url and [AppliedRequestSettings]. + fn with_uri_and_settings( + uri: Uri, + settings: &AppliedRequestSettings, + pool: &ConnectionPool, + ) -> Self; } diff --git a/packages/rs-dapi-client/src/transport/grpc.rs b/packages/rs-dapi-client/src/transport/grpc.rs index 224229a7356..43680130e8f 100644 --- a/packages/rs-dapi-client/src/transport/grpc.rs +++ b/packages/rs-dapi-client/src/transport/grpc.rs @@ -2,41 +2,83 @@ use std::time::Duration; +use super::{CanRetry, TransportClient, TransportRequest}; +use crate::connection_pool::{ConnectionPool, PoolPrefix}; +use crate::{request_settings::AppliedRequestSettings, RequestSettings}; use dapi_grpc::core::v0::core_client::CoreClient; +use dapi_grpc::core::v0::{self as core_proto}; use dapi_grpc::platform::v0::{self as platform_proto, platform_client::PlatformClient}; +use dapi_grpc::tonic::transport::Uri; +use dapi_grpc::tonic::Streaming; +use dapi_grpc::tonic::{transport::Channel, IntoRequest}; use futures::{future::BoxFuture, FutureExt, TryFutureExt}; -use http::Uri; -use tonic::{transport::Channel, IntoRequest}; - -use super::{CanRetry, TransportClient, TransportRequest, TransportResponse}; -use crate::{request_settings::AppliedRequestSettings, RequestSettings}; /// Platform Client using gRPC transport. pub type PlatformGrpcClient = PlatformClient; /// Core Client using gRPC transport. pub type CoreGrpcClient = CoreClient; +fn create_channel(uri: Uri, settings: Option<&AppliedRequestSettings>) -> Channel { + let mut builder = Channel::builder(uri); + + if let Some(settings) = settings { + if let Some(timeout) = settings.connect_timeout { + builder = builder.connect_timeout(timeout); + } + } + + builder.connect_lazy() +} + impl TransportClient for PlatformGrpcClient { - type Error = tonic::Status; + type Error = dapi_grpc::tonic::Status; + + fn with_uri(uri: Uri, pool: &ConnectionPool) -> Self { + pool.get_or_create(PoolPrefix::Platform, &uri, None, || { + Self::new(create_channel(uri.clone(), None)).into() + }) + .into() + } - fn with_uri(uri: Uri) -> Self { - Self::new(Channel::builder(uri).connect_lazy()) + fn with_uri_and_settings( + uri: Uri, + settings: &AppliedRequestSettings, + pool: &ConnectionPool, + ) -> Self { + pool.get_or_create(PoolPrefix::Platform, &uri, Some(settings), || { + Self::new(create_channel(uri.clone(), Some(settings))).into() + }) + .into() } } impl TransportClient for CoreGrpcClient { - type Error = tonic::Status; + type Error = dapi_grpc::tonic::Status; - fn with_uri(uri: Uri) -> Self { - Self::new(Channel::builder(uri).connect_lazy()) + fn with_uri(uri: Uri, pool: &ConnectionPool) -> Self { + pool.get_or_create(PoolPrefix::Core, &uri, None, || { + Self::new(create_channel(uri.clone(), None)).into() + }) + .into() + } + + fn with_uri_and_settings( + uri: Uri, + settings: &AppliedRequestSettings, + pool: &ConnectionPool, + ) -> Self { + pool.get_or_create(PoolPrefix::Core, &uri, Some(settings), || { + Self::new(create_channel(uri.clone(), Some(settings))).into() + }) + .into() } } -impl CanRetry for tonic::Status { - fn can_retry(&self) -> bool { +impl CanRetry for dapi_grpc::tonic::Status { + fn is_node_failure(&self) -> bool { let code = self.code(); - use tonic::Code::*; + use dapi_grpc::tonic::Code::*; matches!( code, Ok | DataLoss @@ -46,6 +88,7 @@ impl CanRetry for tonic::Status { | ResourceExhausted | Aborted | Internal + | Unavailable ) } } @@ -61,6 +104,10 @@ macro_rules! impl_transport_request_grpc { const SETTINGS_OVERRIDES: RequestSettings = $settings; + fn method_name(&self) -> &'static str { + stringify!($($method)+) + } + fn execute_transport<'c>( self, client: &'c mut Self::Client, @@ -68,7 +115,10 @@ macro_rules! impl_transport_request_grpc { ) -> BoxFuture<'c, Result::Error>> { let mut grpc_request = self.into_request(); - grpc_request.set_timeout(settings.timeout); + + if !settings.timeout.is_zero() { + grpc_request.set_timeout(settings.timeout); + } client .$($method)+(grpc_request) @@ -76,12 +126,13 @@ macro_rules! impl_transport_request_grpc { .boxed() } } - impl TransportResponse for $response {} }; } // Link to each platform gRPC request what client and method to use: +const STREAMING_TIMEOUT: Duration = Duration::from_secs(5 * 60); + impl_transport_request_grpc!( platform_proto::GetIdentityRequest, platform_proto::GetIdentityResponse, @@ -141,14 +192,6 @@ impl_transport_request_grpc!( wait_for_state_transition_result ); -impl_transport_request_grpc!( - platform_proto::GetIdentitiesByPublicKeyHashesRequest, - platform_proto::GetIdentitiesByPublicKeyHashesResponse, - PlatformGrpcClient, - RequestSettings::default(), - get_identities_by_public_key_hashes -); - impl_transport_request_grpc!( platform_proto::GetIdentityByPublicKeyHashRequest, platform_proto::GetIdentityByPublicKeyHashResponse, @@ -165,6 +208,22 @@ impl_transport_request_grpc!( get_identity_balance ); +impl_transport_request_grpc!( + platform_proto::GetIdentityNonceRequest, + platform_proto::GetIdentityNonceResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_identity_nonce +); + +impl_transport_request_grpc!( + platform_proto::GetIdentityContractNonceRequest, + platform_proto::GetIdentityContractNonceResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_identity_contract_nonce +); + impl_transport_request_grpc!( platform_proto::GetIdentityBalanceAndRevisionRequest, platform_proto::GetIdentityBalanceAndRevisionResponse, @@ -173,6 +232,14 @@ impl_transport_request_grpc!( get_identity_balance_and_revision ); +impl_transport_request_grpc!( + platform_proto::GetIdentitiesContractKeysRequest, + platform_proto::GetIdentitiesContractKeysResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_identities_contract_keys +); + impl_transport_request_grpc!( platform_proto::GetIdentityKeysRequest, platform_proto::GetIdentityKeysResponse, @@ -213,9 +280,77 @@ impl_transport_request_grpc!( get_data_contracts ); +// rpc getContestedResources(GetContestedResourcesRequest) returns (GetContestedResourcesResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourcesRequest, + platform_proto::GetContestedResourcesResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resources +); + +// rpc getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourceVoteStateRequest, + platform_proto::GetContestedResourceVoteStateResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resource_vote_state +); + +// rpc getContestedResourceVotersForIdentity(GetContestedResourceVotersForIdentityRequest) returns (GetContestedResourceVotersForIdentityResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourceVotersForIdentityRequest, + platform_proto::GetContestedResourceVotersForIdentityResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resource_voters_for_identity +); +// rpc getContestedResourceIdentityVoteStatus(GetContestedResourceIdentityVoteStatusRequest) returns (GetContestedResourceIdentityVoteStatusResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourceIdentityVotesRequest, + platform_proto::GetContestedResourceIdentityVotesResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resource_identity_votes +); +// rpc GetVotePollsByEndDateRequest(GetVotePollsByEndDateRequest) returns (GetVotePollsByEndDateResponse); +impl_transport_request_grpc!( + platform_proto::GetVotePollsByEndDateRequest, + platform_proto::GetVotePollsByEndDateResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_vote_polls_by_end_date +); + +// rpc getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse); +impl_transport_request_grpc!( + platform_proto::GetPrefundedSpecializedBalanceRequest, + platform_proto::GetPrefundedSpecializedBalanceResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_prefunded_specialized_balance +); + +// rpc getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse); +impl_transport_request_grpc!( + platform_proto::GetPathElementsRequest, + platform_proto::GetPathElementsResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_path_elements +); + +// rpc getTotalCreditsInPlatform(GetTotalCreditsInPlatformRequest) returns (GetTotalCreditsInPlatformResponse); +impl_transport_request_grpc!( + platform_proto::GetTotalCreditsInPlatformRequest, + platform_proto::GetTotalCreditsInPlatformResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_total_credits_in_platform +); + // Link to each core gRPC request what client and method to use: -/* -TODO: Implement serde on Core gRPC requests and responses impl_transport_request_grpc!( core_proto::GetTransactionRequest, @@ -226,11 +361,11 @@ impl_transport_request_grpc!( ); impl_transport_request_grpc!( - core_proto::GetStatusRequest, - core_proto::GetStatusResponse, + core_proto::GetBlockchainStatusRequest, + core_proto::GetBlockchainStatusResponse, CoreGrpcClient, RequestSettings::default(), - get_status + get_blockchain_status ); impl_transport_request_grpc!( @@ -240,4 +375,14 @@ impl_transport_request_grpc!( RequestSettings::default(), broadcast_transaction ); -*/ + +impl_transport_request_grpc!( + core_proto::TransactionsWithProofsRequest, + Streaming, + CoreGrpcClient, + RequestSettings { + timeout: Some(STREAMING_TIMEOUT), + ..RequestSettings::default() + }, + subscribe_to_transactions_with_proofs +); diff --git a/packages/rs-dapi-client/tests/local_platform_connectivity.rs b/packages/rs-dapi-client/tests/local_platform_connectivity.rs index fde903549ee..0a0ae4b59d7 100644 --- a/packages/rs-dapi-client/tests/local_platform_connectivity.rs +++ b/packages/rs-dapi-client/tests/local_platform_connectivity.rs @@ -1,7 +1,10 @@ #[cfg(not(feature = "offline-testing"))] mod tests { - use dapi_grpc::platform::v0::{ - self as platform_proto, get_identity_response, GetIdentityResponse, ResponseMetadata, + use dapi_grpc::{ + platform::v0::{ + self as platform_proto, get_identity_response, GetIdentityResponse, ResponseMetadata, + }, + tonic::transport::Uri, }; use rs_dapi_client::{AddressList, DapiClient, DapiRequest, RequestSettings}; @@ -13,7 +16,7 @@ mod tests { #[tokio::test] async fn get_identity() { let mut address_list = AddressList::new(); - address_list.add_uri(rs_dapi_client::Uri::from_static("http://127.0.0.1:2443")); + address_list.add_uri(Uri::from_static("http://127.0.0.1:2443")); let mut client = DapiClient::new(address_list, RequestSettings::default()); let request = platform_proto::GetIdentityRequest { diff --git a/packages/rs-dapi-client/tests/mock_dapi_client.rs b/packages/rs-dapi-client/tests/mock_dapi_client.rs index f5f67dce99c..f069c4e47a3 100644 --- a/packages/rs-dapi-client/tests/mock_dapi_client.rs +++ b/packages/rs-dapi-client/tests/mock_dapi_client.rs @@ -1,8 +1,11 @@ -use dapi_grpc::platform::v0::{GetIdentityRequest, GetIdentityResponse, Proof}; - -use rs_dapi_client::{mock::MockDapiClient, Dapi, DapiRequest, RequestSettings}; +#[cfg(feature = "mocks")] +use { + dapi_grpc::platform::v0::{GetIdentityRequest, GetIdentityResponse, Proof}, + rs_dapi_client::{mock::MockDapiClient, DapiRequest, DapiRequestExecutor, RequestSettings}, +}; #[tokio::test] +#[cfg(feature = "mocks")] async fn test_mock_get_identity_dapi_client() { let mut dapi = MockDapiClient::new(); @@ -19,13 +22,14 @@ async fn test_mock_get_identity_dapi_client() { })) }; - dapi.expect(&request, &response); + dapi.expect(&request, &Ok(response.clone())) + .expect("expectation added"); let settings = RequestSettings::default(); let result = dapi.execute(request.clone(), settings).await.unwrap(); - let result2 = request.execute(&mut dapi, settings).await.unwrap(); + let result2 = request.execute(&dapi, settings).await.unwrap(); assert_eq!(result, response); assert_eq!(result2, response); diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 74c9fe88024..a040809378f 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." @@ -11,7 +11,7 @@ proc-macro = true [dependencies] quote = "1.0.33" syn = "2.0.38" -heck = "0.4.1" +heck = "0.5.0" [dev-dependencies] diff --git a/packages/rs-dapi-grpc-macros/src/lib.rs b/packages/rs-dapi-grpc-macros/src/lib.rs index f310de526f2..f0331dd8398 100644 --- a/packages/rs-dapi-grpc-macros/src/lib.rs +++ b/packages/rs-dapi-grpc-macros/src/lib.rs @@ -115,6 +115,7 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { quote! { #mod_ident::Version::#version_ident(inner) => match &inner.result { Some(#mod_ident::#version_mod_ident::Result::Proof(proof)) => Ok(proof), + // TODO: this substitutes any error that could be received instead of a proof, not just version-related _ => return Err(::platform_version::error::PlatformVersionError::UnknownVersionError("unknown proof version not known".to_string())), }, } @@ -130,6 +131,7 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { quote! { #mod_ident::Version::#version_ident(inner) => match inner.result { Some(#mod_ident::#version_mod_ident::Result::Proof(proof)) => Ok(proof), + // TODO: this substitutes any error that could be received instead of a proof, not just version-related _ => return Err(::platform_version::error::PlatformVersionError::UnknownVersionError("unknown proof version not known".to_string())), }, } @@ -138,8 +140,7 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { let metadata_arms = (0..=versions).map(|version| { let version_ident = format_ident!("V{}", version); quote! { - #mod_ident::Version::#version_ident(inner) => inner.metadata.as_ref().ok_or(platform_version::error::PlatformVersionError:: - UnknownVersionError("result did not have metadata".to_string())), + #mod_ident::Version::#version_ident(inner) => inner.metadata.as_ref().ok_or(platform_version::error::PlatformVersionError:: UnknownVersionError("result did not have metadata".to_string())), } }); @@ -182,3 +183,44 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { // Return the generated code TokenStream::from(expanded) } + +/// Implement mocking on gRPC messages +/// +/// This adds implementation of [dapi_grpc::mock::Mockable] to the message. +/// If the `mocks` feature is enabled, the implementation uses serde_json to serialize/deserialize the message. +/// Otherwise, it returns None. +/// +/// ## Requirements +/// +/// When `mocks` feature is enabled: +/// +/// * The message must implement [serde::Serialize] and [serde::Deserialize]. +/// * The crate must depend on `serde` and `serde_json` crates. +/// +#[proc_macro_derive(Mockable)] +pub fn mockable_derive(input: TokenStream) -> TokenStream { + // Parse the input tokens into a syntax tree + let input = parse_macro_input!(input as DeriveInput); + + let name = input.ident; + + // Generate the implementation + let expanded = quote! { + impl crate::mock::Mockable for #name { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + Some(serde_json::to_vec_pretty(self).expect("unable to serialize mock data")) + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + Some(serde_json::from_slice(data).expect("unable to deserialize mock data")) + } + } + }; + + // println!("Expanded code: {}", expanded); + + // Return the generated code + TokenStream::from(expanded) +} diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index a1e21130130..9b916baae93 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,213 +1,279 @@ [package] name = "dpp" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" authors = [ - "Anton Suprunchuk ", - "Samuel Westrich ", - "Ivan Shumkov ", - "Djavid Gabibiyan ", - "Igor Markin ", + "Anton Suprunchuk ", + "Samuel Westrich ", + "Ivan Shumkov ", + "Djavid Gabibiyan ", + "Igor Markin ", ] [dependencies] -anyhow = { version = "1.0.70" } -async-trait = { version = "0.1.68" } -base64 = "0.20.0" -bls-signatures = { git = "https://github.com/dashpay/bls-signatures", branch = "develop" } +anyhow = { version = "1.0.81" } +async-trait = { version = "0.1.79" } +base64 = "0.22.1" +bls-signatures = { git = "https://github.com/dashpay/bls-signatures", tag = "v1.3.1", optional = true } bs58 = "0.4.0" byteorder = { version = "1.4" } -chrono = { version = "0.4.20", default-features = false, features = [ - "wasmbind", - "clock", +chrono = { version = "0.4.35", default-features = false, features = [ + "wasmbind", + "clock", ] } ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined", optional = true } dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [ - "std", - "secp-recovery", - "rand", - "signer", - "serde", + "std", + "secp-recovery", + "rand", + "signer", + "serde", ], default-features = false, branch = "master" } env_logger = { version = "0.9" } -enum-map = { version = "2.5.0" } getrandom = { version = "0.2", features = ["js"] } hex = { version = "0.4" } integer-encoding = { version = "4.0.0" } -itertools = { version = "0.10" } -json-patch = "0.2.6" -jsonptr = "0.1.5" -jsonschema = { git = "https://github.com/fominok/jsonschema-rs", branch = "feat-unevaluated-properties", default-features = false, features = [ - "draft202012", -] } +itertools = { version = "0.12.1" } +jsonschema = { git = "https://github.com/dashpay/jsonschema-rs", branch = "configure_regexp", default-features = false, features = [ + "draft202012", +], optional = true } lazy_static = { version = "1.4" } log = { version = "0.4.6" } num_enum = "0.5.7" bincode = { version = "2.0.0-rc.3", features = ["serde"] } rand = { version = "0.8.4", features = ["small_rng"] } -regex = { version = "1.5" } -serde = { version = "1.0.152", features = ["derive"] } +regex = { version = "1.10.4" } +serde = { version = "1.0.197", features = ["derive"] } serde_json = { version = "1.0", features = ["preserve_order"] } serde_repr = { version = "0.1.7" } sha2 = { version = "0.10" } thiserror = { version = "1.0" } -data-contracts = { path = "../data-contracts" } +data-contracts = { path = "../data-contracts", optional = true } platform-value = { path = "../rs-platform-value" } platform-version = { path = "../rs-platform-version" } platform-versioning = { path = "../rs-platform-versioning" } platform-serialization = { path = "../rs-platform-serialization" } platform-serialization-derive = { path = "../rs-platform-serialization-derive" } derive_more = "0.99.17" -ed25519-dalek = { version = "2.0.0-rc.2", features = ["rand_core"] } +ed25519-dalek = { version = "2.0.0-rc.2", features = [ + "rand_core", +], optional = true } nohash-hasher = "0.2.0" rust_decimal = "1.29.1" rust_decimal_macros = "1.29.1" indexmap = { version = "2.0.2", features = ["serde"] } +strum = { version = "0.25.0", features = ["derive"] } +json-schema-compatibility-validator = { path = '../rs-json-schema-compatibility-validator' } +once_cell = "1.19.0" [dev-dependencies] test-case = { version = "2.0" } tokio = { version = "1.17", features = ["full"] } pretty_assertions = { version = "1.3.0" } dpp = { path = ".", features = ["all_features_without_client"] } +assert_matches = "1.5.0" +once_cell = "1.7" [features] -default = [ - "json-object", - "platform-value", - "system_contracts", - "state-transitions", - "extended-document", -] +default = ["platform-value", "state-transitions"] all_features = [ - "json-object", - "platform-value", - "system_contracts", - "state-transitions", - "extended-document", - "cbor", - "validation", - "identity-hashing", - "identity-serialization", - "ciborium", - "document-serde-conversion", - "document-value-conversion", - "document-json-conversion", - "document-cbor-conversion", - "data-contract-serde-conversion", - "data-contract-value-conversion", - "data-contract-json-conversion", - "data-contract-cbor-conversion", - "identity-serde-conversion", - "identity-value-conversion", - "identity-json-conversion", - "identity-cbor-conversion", - "state-transition-serde-conversion", - "state-transition-value-conversion", - "state-transition-json-conversion", - "state-transition-validation", - "state-transition-signing", - "state-transitions", - "factories", - "fixtures-and-mocks", - "random-public-keys", - "random-identities", - "random-documents", - "random-document-types", - "fee-distribution", - "client", + "json-object", + "platform-value", + "system_contracts", + "state-transitions", + "extended-document", + "bls-signatures", + "cbor", + "validation", + "identity-hashing", + "identity-serialization", + "ciborium", + "document-serde-conversion", + "document-value-conversion", + "document-json-conversion", + "document-cbor-conversion", + "data-contract-serde-conversion", + "data-contract-value-conversion", + "data-contract-json-conversion", + "data-contract-cbor-conversion", + "identity-serde-conversion", + "identity-value-conversion", + "identity-json-conversion", + "identity-cbor-conversion", + "index-serde-conversion", + "state-transition-serde-conversion", + "state-transition-value-conversion", + "state-transition-json-conversion", + "state-transition-validation", + "state-transition-signing", + "state-transitions", + "factories", + "fixtures-and-mocks", + "random-public-keys", + "random-identities", + "random-documents", + "random-document-types", + "fee-distribution", + "client", + "vote-serialization", +] + +dash-sdk-features = [ + "json-object", + "platform-value", + "system_contracts", + "state-transitions", + "validation", + "identity-hashing", + "identity-serialization", + "vote-serialization", + "document-value-conversion", + "data-contract-value-conversion", + "identity-value-conversion", + "state-transition-serde-conversion", + "state-transition-value-conversion", + "state-transition-json-conversion", + "state-transition-validation", + "state-transition-signing", + "state-transitions", + "fee-distribution", + "client", + "platform-value-cbor", ] all_features_without_client = [ - "json-object", - "platform-value", - "system_contracts", - "state-transitions", - "extended-document", - "cbor", - "validation", - "identity-hashing", - "identity-serialization", - "ciborium", - "document-serde-conversion", - "document-value-conversion", - "document-json-conversion", - "document-cbor-conversion", - "data-contract-serde-conversion", - "data-contract-value-conversion", - "data-contract-json-conversion", - "data-contract-cbor-conversion", - "identity-serde-conversion", - "identity-value-conversion", - "identity-json-conversion", - "identity-cbor-conversion", - "state-transition-serde-conversion", - "state-transition-value-conversion", - "state-transition-json-conversion", - "state-transition-validation", - "state-transition-signing", - "state-transitions", - "factories", - "fixtures-and-mocks", - "random-public-keys", - "random-identities", - "random-documents", - "random-document-types", - "fee-distribution", -] -drive = ["state-transitions", "fee-distribution", "system_contracts"] + "json-object", + "platform-value", + "system_contracts", + "state-transitions", + "extended-document", + "cbor", + "validation", + "identity-hashing", + "identity-serialization", + "ciborium", + "document-serde-conversion", + "document-value-conversion", + "document-json-conversion", + "document-cbor-conversion", + "data-contract-serde-conversion", + "data-contract-value-conversion", + "data-contract-json-conversion", + "data-contract-cbor-conversion", + "identity-serde-conversion", + "identity-value-conversion", + "identity-json-conversion", + "identity-cbor-conversion", + "index-serde-conversion", + "state-transition-serde-conversion", + "state-transition-value-conversion", + "state-transition-json-conversion", + "state-transition-validation", + "state-transition-signing", + "state-transitions", + "factories", + "fixtures-and-mocks", + "random-public-keys", + "random-identities", + "random-documents", + "random-document-types", + "fee-distribution", + "vote-serialization", + "vote-serde-conversion", +] abci = [ - "state-transitions", - "state-transition-validation", - "validation", - "random-public-keys", - "identity-serialization", + "state-transitions", + "state-transition-validation", + "validation", + "random-public-keys", + "identity-serialization", + "vote-serialization", + "platform-value-cbor", ] cbor = ["ciborium"] validation = [ - "platform-value", - "document-value-conversion", - "state-transition-serde-conversion", + "json-schema-validation", + "platform-value", + "document-value-conversion", + "state-transition-serde-conversion", + "ed25519-dalek", ] -json-object = ["platform-value"] +platform-value-json = ["platform-value/json"] +platform-value-cbor = ["platform-value/cbor"] +json-schema-validation = ["jsonschema", "platform-value-json"] +json-object = ["platform-value", "platform-value-json"] platform-value = [] identity-hashing = ["identity-serialization"] +message-signing = [] +message-signature-verification = ["bls-signatures"] document-serde-conversion = [] document-value-conversion = ["document-serde-conversion"] -document-json-conversion = ["document-value-conversion"] -document-cbor-conversion = ["document-value-conversion"] +document-json-conversion = ["document-value-conversion", "platform-value-json"] +document-cbor-conversion = [ + "document-value-conversion", + "cbor", + "platform-value-cbor", +] data-contract-serde-conversion = [] data-contract-value-conversion = ["data-contract-serde-conversion"] -data-contract-json-conversion = ["data-contract-value-conversion"] -data-contract-cbor-conversion = ["data-contract-value-conversion"] +data-contract-json-conversion = [ + "data-contract-value-conversion", + "platform-value-json", +] +data-contract-cbor-conversion = [ + "data-contract-value-conversion", + "cbor", + "platform-value-cbor", +] identity-serialization = [] identity-serde-conversion = [] identity-value-conversion = ["identity-serde-conversion"] -identity-json-conversion = ["identity-value-conversion"] -identity-cbor-conversion = ["identity-value-conversion", "cbor"] -state-transition-serde-conversion = ["data-contract-serde-conversion"] +identity-json-conversion = ["identity-value-conversion", "platform-value-json"] +identity-cbor-conversion = [ + "identity-value-conversion", + "cbor", + "platform-value-cbor", +] +index-serde-conversion = [] +state-transition-serde-conversion = [ + "data-contract-serde-conversion", + "vote-serde-conversion", +] state-transition-value-conversion = [ - "platform-value", - "state-transition-serde-conversion", - "data-contract-value-conversion", + "platform-value", + "state-transition-serde-conversion", + "data-contract-value-conversion", ] state-transition-json-conversion = [ - "json-object", - "data-contract-json-conversion", + "json-object", + "state-transition-value-conversion", + "data-contract-json-conversion", + "platform-value-json", ] -state-transition-validation = [] -state-transition-signing = [] +state-transition-validation = [ + "state-transitions", + "message-signature-verification", +] +state-transition-signing = [ + "state-transitions", + "message-signing", + "state-transition-validation", +] +vote-serialization = [] +vote-serde-conversion = [] state-transitions = [] -system_contracts = ["factories"] -fixtures-and-mocks = [] -random-public-keys = [] +system_contracts = ["factories", "data-contracts", "platform-value-json"] +fixtures-and-mocks = ["system_contracts", "platform-value/json"] +random-public-keys = ["bls-signatures", "ed25519-dalek"] random-identities = ["random-public-keys"] random-documents = [] -random-document-types = [] +random-document-types = ["platform-value-json"] fee-distribution = [] extended-document = [ - "document-serde-conversion", - "data-contract-serde-conversion", - "data-contract-json-conversion", + "document-serde-conversion", + "data-contract-serde-conversion", + "data-contract-json-conversion", ] -client = [] + factories = [] +client = ["factories", "state-transitions"] diff --git a/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json b/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json index e802b7825af..80d20a3f775 100644 --- a/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json +++ b/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json @@ -109,13 +109,6 @@ "properties": { "$ref": "#/$defs/documentProperties" }, - "dependentSchemas": { - "type": "object", - "minProperties": 1, - "additionalProperties": { - "$ref": "#/$defs/documentSchema" - } - }, "dependentRequired": { "type": "object", "minProperties": 1, @@ -143,10 +136,6 @@ "type": "boolean", "const": true }, - "prefixItems": { - "$ref": "#/$defs/documentSchemaArray" - }, - "items": true, "position": { "type": "integer", "minimum": 0 @@ -160,16 +149,6 @@ "type": "string", "const": "array" } - }, - "not": { - "properties": { - "items": { - "type": "array" - } - }, - "required": [ - "items" - ] } }, "contentMediaType": { @@ -199,52 +178,6 @@ ] } }, - "uniqueItems": { - "description": "prevent slow validation of large non-scalar arrays", - "if": { - "properties": { - "uniqueItems": { - "const": true - }, - "items": { - "type": "object", - "properties": { - "type": { - "anyOf": [ - { - "type": "string", - "enum": [ - "object", - "array" - ] - }, - { - "type": "array", - "contains": { - "enum": [ - "object", - "array" - ] - } - } - ] - } - } - } - } - }, - "then": { - "properties": { - "maxItems": { - "type": "number", - "maximum": 100000 - } - }, - "required": [ - "maxItems" - ] - } - }, "pattern": { "description": "prevent slow pattern matching of large strings", "properties": { @@ -270,18 +203,6 @@ "required": [ "maxLength" ] - }, - "prefixItems": { - "$comment": "array must not contain undefined item sub schemas", - "properties": { - "items": { - "type": "boolean", - "const": false - } - }, - "required": [ - "items" - ] } }, "allOf": [ @@ -333,55 +254,6 @@ ] } }, - { - "$comment": "array must contain items", - "if": { - "properties": { - "type": { - "const": "array" - } - }, - "required": [ - "type" - ], - "not": { - "properties": { - "byteArray": true - }, - "required": [ - "byteArray" - ] - } - }, - "then": { - "properties": { - "items": true - }, - "required": [ - "items" - ] - } - }, - { - "$comment": "array without prefixItems must contain items sub schema", - "if": { - "not": { - "properties": { - "prefixItems": true - }, - "required": [ - "prefixItems" - ] - } - }, - "then": { - "properties": { - "items": { - "$ref": "#/$defs/documentSchema" - } - } - } - }, { "$comment": "all object properties must be defined", "if": { @@ -460,6 +332,52 @@ }, "unique": { "type": "boolean" + }, + "nullSearchable": { + "type": "boolean" + }, + "contested": { + "type": "object", + "properties": { + "fieldMatches": { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "regexPattern": { + "type": "string", + "minLength": 1, + "maxLength": 256 + } + }, + "additionalProperties": false, + "required": [ + "field", + "regexPattern" + ] + }, + "minItems": 1 + }, + "resolution": { + "type": "integer", + "enum": [ + 0 + ], + "description": "Resolution. 0 - Masternode Vote" + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 256 + } + }, + "required": ["resolution"], + "additionalProperties": false } }, "required": [ @@ -474,12 +392,48 @@ "signatureSecurityLevelRequirement": { "type": "integer", "enum": [ - 0, 1, 2, 3 ], - "description": "Public key security level. 0 - Master, 1 - Critical, 2 - High, 3 - Medium. If none specified, High level is used" + "description": "Public key security level. 1 - Critical, 2 - High, 3 - Medium. If none specified, High level is used" + }, + "documentsKeepHistory": { + "type": "boolean", + "description": "True if the documents keep all their history, default is false" + }, + "documentsMutable": { + "type": "boolean", + "description": "True if the documents are mutable, default is true" + }, + "canBeDeleted": { + "type": "boolean", + "description": "True if the documents can be deleted, default is true" + }, + "transferable": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "description": "Transferable without a marketplace sell. 0 - Never, 1 - Always" + }, + "tradeMode": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "description": "Built in marketplace system. 0 - None, 1 - Direct purchase (The user can buy the item without the need for an approval)" + }, + "creationRestrictionMode": { + "type": "integer", + "enum": [ + 0, + 1, + 2 + ], + "description": "Restrictions of document creation. 0 - No restrictions, 1 - Owner only, 2 - No creation (System Only)" }, "requiresIdentityEncryptionBoundedKey": { "type": "integer", @@ -515,7 +469,14 @@ "$ownerId": true, "$revision": true, "$createdAt": true, - "$updatedAt": true + "$updatedAt": true, + "$transferredAt": true, + "$createdAtBlockHeight": true, + "$updatedAtBlockHeight": true, + "$transferredAtBlockHeight": true, + "$createdAtCoreBlockHeight": true, + "$updatedAtCoreBlockHeight": true, + "$transferredAtCoreBlockHeight": true }, "propertyNames": { "oneOf": [ @@ -530,7 +491,14 @@ "$ownerId", "$revision", "$createdAt", - "$updatedAt" + "$updatedAt", + "$transferredAt", + "$createdAtBlockHeight", + "$updatedAtBlockHeight", + "$transferredAtBlockHeight", + "$createdAtCoreBlockHeight", + "$updatedAtCoreBlockHeight", + "$transferredAtCoreBlockHeight" ] } ] @@ -538,6 +506,12 @@ "minProperties": 1, "maxProperties": 100 }, + "transient": { + "type": "array", + "items": { + "type": "string" + } + }, "additionalProperties": { "type": "boolean", "const": false diff --git a/packages/rs-dpp/src/asset_lock/mod.rs b/packages/rs-dpp/src/asset_lock/mod.rs new file mode 100644 index 00000000000..5133348df5b --- /dev/null +++ b/packages/rs-dpp/src/asset_lock/mod.rs @@ -0,0 +1,16 @@ +use crate::asset_lock::reduced_asset_lock_value::AssetLockValue; + +pub mod reduced_asset_lock_value; + +pub type PastAssetLockStateTransitionHashes = Vec>; + +/// An enumeration of the possible states when querying platform to get the stored state of an outpoint +/// representing if the asset lock was already used or not. +pub enum StoredAssetLockInfo { + /// The asset lock was fully consumed in the past + FullyConsumed, + /// The asset lock was partially consumed, and we stored the asset lock value in the state + PartiallyConsumed(AssetLockValue), + /// The asset lock is not yet known to Platform + NotPresent, +} diff --git a/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/mod.rs b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/mod.rs new file mode 100644 index 00000000000..5b18311013a --- /dev/null +++ b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/mod.rs @@ -0,0 +1,111 @@ +use crate::asset_lock::reduced_asset_lock_value::v0::AssetLockValueV0; +use crate::fee::Credits; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use derive_more::From; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Bytes32; +use platform_version::version::PlatformVersion; + +mod v0; + +pub use v0::{AssetLockValueGettersV0, AssetLockValueSettersV0}; + +#[derive(Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize, From, PartialEq)] +#[platform_serialize(unversioned)] +pub enum AssetLockValue { + V0(AssetLockValueV0), +} + +impl AssetLockValue { + pub fn new( + initial_credit_value: Credits, + tx_out_script: Vec, + remaining_credit_value: Credits, + used_tags: Vec, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .asset_lock_versions + .reduced_asset_lock_value + .default_current_version + { + 0 => Ok(AssetLockValue::V0(AssetLockValueV0 { + initial_credit_value, + tx_out_script, + remaining_credit_value, + used_tags, + })), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "ReducedAssetLockValue::new".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} + +impl AssetLockValueGettersV0 for AssetLockValue { + fn initial_credit_value(&self) -> Credits { + match self { + AssetLockValue::V0(v0) => v0.initial_credit_value, + } + } + + fn tx_out_script(&self) -> &Vec { + match self { + AssetLockValue::V0(v0) => &v0.tx_out_script, + } + } + + fn tx_out_script_owned(self) -> Vec { + match self { + AssetLockValue::V0(v0) => v0.tx_out_script, + } + } + + fn remaining_credit_value(&self) -> Credits { + match self { + AssetLockValue::V0(v0) => v0.remaining_credit_value, + } + } + + fn used_tags_ref(&self) -> &Vec { + match self { + AssetLockValue::V0(v0) => &v0.used_tags, + } + } +} + +impl AssetLockValueSettersV0 for AssetLockValue { + fn set_initial_credit_value(&mut self, value: Credits) { + match self { + AssetLockValue::V0(v0) => v0.initial_credit_value = value, + } + } + + fn set_tx_out_script(&mut self, value: Vec) { + match self { + AssetLockValue::V0(v0) => v0.tx_out_script = value, + } + } + + fn set_remaining_credit_value(&mut self, value: Credits) { + match self { + AssetLockValue::V0(v0) => v0.remaining_credit_value = value, + } + } + + fn set_used_tags(&mut self, tags: Vec) { + match self { + AssetLockValue::V0(v0) => v0.used_tags = tags, + } + } + + fn add_used_tag(&mut self, tag: Bytes32) { + match self { + AssetLockValue::V0(v0) => v0.used_tags.push(tag), + } + } +} diff --git a/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/v0/mod.rs b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/v0/mod.rs new file mode 100644 index 00000000000..bc733e03f48 --- /dev/null +++ b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/v0/mod.rs @@ -0,0 +1,33 @@ +use crate::fee::Credits; +use bincode::{Decode, Encode}; +use platform_value::Bytes32; + +#[derive(Debug, Clone, Encode, Decode, PartialEq)] +pub struct AssetLockValueV0 { + pub(super) initial_credit_value: Credits, + pub(super) tx_out_script: Vec, + pub(super) remaining_credit_value: Credits, + /// The used tags can represent any token of that we want to say has been used + /// In practice for Platform this means that we are storing the asset lock transactions + /// to prevent replay attacks. + pub(super) used_tags: Vec, +} + +pub trait AssetLockValueGettersV0 { + fn initial_credit_value(&self) -> Credits; + fn tx_out_script(&self) -> &Vec; + + fn tx_out_script_owned(self) -> Vec; + fn remaining_credit_value(&self) -> Credits; + + fn used_tags_ref(&self) -> &Vec; +} + +pub trait AssetLockValueSettersV0 { + fn set_initial_credit_value(&mut self, value: Credits); + fn set_tx_out_script(&mut self, value: Vec); + fn set_remaining_credit_value(&mut self, value: Credits); + + fn set_used_tags(&mut self, tags: Vec); + fn add_used_tag(&mut self, tag: Bytes32); +} diff --git a/packages/rs-dpp/src/balances/credits.rs b/packages/rs-dpp/src/balances/credits.rs index 6febee1005e..d0f9e2805b9 100644 --- a/packages/rs-dpp/src/balances/credits.rs +++ b/packages/rs-dpp/src/balances/credits.rs @@ -12,6 +12,9 @@ use crate::ProtocolError; use integer_encoding::VarInt; use std::convert::TryFrom; +/// Duffs type +pub type Duffs = u64; + /// Credits type pub type Credits = u64; @@ -25,6 +28,8 @@ pub type SignedCredits = i64; pub const MAX_CREDITS: Credits = 9223372036854775807 as Credits; //i64 Max +pub const CREDITS_PER_DUFF: Credits = 1000; + /// Trait for signed and unsigned credits pub trait Creditable { diff --git a/packages/rs-dpp/src/balances/total_credits_balance/mod.rs b/packages/rs-dpp/src/balances/total_credits_balance/mod.rs index 5ba240e7d80..2bc0aceff9a 100644 --- a/packages/rs-dpp/src/balances/total_credits_balance/mod.rs +++ b/packages/rs-dpp/src/balances/total_credits_balance/mod.rs @@ -1,6 +1,7 @@ use crate::balances::credits::{Creditable, MAX_CREDITS}; use crate::fee::{Credits, SignedCredits}; use crate::ProtocolError; +use std::fmt; /// The outcome of verifying credits #[derive(Copy, Clone, Debug)] @@ -11,6 +12,31 @@ pub struct TotalCreditsBalance { pub total_in_pools: SignedCredits, /// all the credits in identity balances pub total_identity_balances: SignedCredits, + /// all the credits in specialized balances + pub total_specialized_balances: SignedCredits, +} + +impl fmt::Display for TotalCreditsBalance { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "TotalCreditsBalance {{")?; + writeln!( + f, + " total_credits_in_platform: {},", + self.total_credits_in_platform + )?; + writeln!(f, " total_in_pools: {},", self.total_in_pools)?; + writeln!( + f, + " total_identity_balances: {},", + self.total_identity_balances + )?; + writeln!( + f, + " total_specialized_balances: {}", + self.total_specialized_balances + )?; + write!(f, "}}") + } } impl TotalCreditsBalance { @@ -21,6 +47,7 @@ impl TotalCreditsBalance { total_credits_in_platform, total_in_pools, total_identity_balances, + total_specialized_balances, } = *self; if total_in_pools < 0 { @@ -35,6 +62,12 @@ impl TotalCreditsBalance { )); } + if total_specialized_balances < 0 { + return Err(ProtocolError::CriticalCorruptedCreditsCodeExecution( + "Credits of specialized balances are less than 0".to_string(), + )); + } + if total_credits_in_platform > MAX_CREDITS { return Err(ProtocolError::CriticalCorruptedCreditsCodeExecution( "Total credits in platform more than max credits size".to_string(), @@ -43,6 +76,7 @@ impl TotalCreditsBalance { let total_from_trees = (total_in_pools) .checked_add(total_identity_balances) + .and_then(|partial_sum| partial_sum.checked_add(total_specialized_balances)) .ok_or(ProtocolError::CriticalCorruptedCreditsCodeExecution( "Overflow of total credits".to_string(), ))?; @@ -55,14 +89,16 @@ impl TotalCreditsBalance { let TotalCreditsBalance { total_in_pools, total_identity_balances, + total_specialized_balances, .. } = *self; - let total_in_trees = total_in_pools.checked_add(total_identity_balances).ok_or( - ProtocolError::CriticalCorruptedCreditsCodeExecution( + let total_in_trees = total_in_pools + .checked_add(total_identity_balances) + .and_then(|partial_sum| partial_sum.checked_add(total_specialized_balances)) + .ok_or(ProtocolError::CriticalCorruptedCreditsCodeExecution( "Overflow of total credits".to_string(), - ), - )?; + ))?; Ok(total_in_trees.to_unsigned()) } diff --git a/packages/rs-dpp/src/block/block_info/mod.rs b/packages/rs-dpp/src/block/block_info/mod.rs index d2da67b9848..477064f9a1f 100644 --- a/packages/rs-dpp/src/block/block_info/mod.rs +++ b/packages/rs-dpp/src/block/block_info/mod.rs @@ -1,6 +1,8 @@ use crate::block::epoch::{Epoch, EPOCH_0}; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; use bincode::{Decode, Encode}; use serde::{Deserialize, Serialize}; +use std::fmt; pub const DEFAULT_BLOCK_INFO: BlockInfo = BlockInfo { time_ms: 0, @@ -13,21 +15,45 @@ pub const DEFAULT_BLOCK_INFO: BlockInfo = BlockInfo { // Extended block info however is not immutable // @immutable /// Block information -#[derive(Clone, Default, Debug, PartialEq, Eq, Encode, Decode, Serialize, Deserialize)] +#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Encode, Decode, Serialize, Deserialize)] pub struct BlockInfo { /// Block time in milliseconds - pub time_ms: u64, + pub time_ms: TimestampMillis, /// Block height - pub height: u64, + pub height: BlockHeight, /// Core height - pub core_height: u32, + pub core_height: CoreBlockHeight, /// Current fee epoch pub epoch: Epoch, } +impl fmt::Display for BlockInfo { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "BlockInfo {{ time_ms: {}, height: {}, core_height: {}, epoch: {} }}", + self.time_ms, self.height, self.core_height, self.epoch.index + ) + } +} + +// Implementing PartialOrd for BlockInfo based on height +impl PartialOrd for BlockInfo { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +// Implementing Ord for BlockInfo based on height +impl Ord for BlockInfo { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.height.cmp(&other.height) + } +} + impl BlockInfo { // TODO: It's not actually a genesis one. We should use just default to avoid confusion /// Create block info for genesis block @@ -36,8 +62,28 @@ impl BlockInfo { } /// Create default block with specified time - pub fn default_with_time(time_ms: u64) -> BlockInfo { + pub fn default_with_time(time_ms: TimestampMillis) -> BlockInfo { + BlockInfo { + time_ms, + ..Default::default() + } + } + + /// Create default block with specified height + pub fn default_with_height(height: BlockHeight) -> BlockInfo { + BlockInfo { + height, + ..Default::default() + } + } + + /// Create default block with specified height and time + pub fn default_with_height_and_time( + height: BlockHeight, + time_ms: TimestampMillis, + ) -> BlockInfo { BlockInfo { + height, time_ms, ..Default::default() } diff --git a/packages/rs-dpp/src/block/epoch/mod.rs b/packages/rs-dpp/src/block/epoch/mod.rs index 060836954a3..419930b4cf3 100644 --- a/packages/rs-dpp/src/block/epoch/mod.rs +++ b/packages/rs-dpp/src/block/epoch/mod.rs @@ -1,10 +1,13 @@ -use crate::ProtocolError; -use bincode::{Decode, Encode}; +use crate::{InvalidVectorSizeError, ProtocolError}; +use bincode::{BorrowDecode, Decode, Encode}; use serde::{Deserialize, Serialize}; /// Epoch key offset pub const EPOCH_KEY_OFFSET: u16 = 256; +/// The Highest allowed Epoch +pub const MAX_EPOCH: u16 = u16::MAX - EPOCH_KEY_OFFSET; + /// Epoch index type pub type EpochIndex = u16; @@ -16,17 +19,23 @@ pub const EPOCH_0: Epoch = Epoch { // We make this immutable because it should never be changed or updated // @immutable /// Epoch struct -#[derive(Serialize, Deserialize, Default, Clone, Eq, PartialEq, Copy, Encode, Decode, Debug)] +#[derive(Serialize, Clone, Eq, PartialEq, Copy, Debug)] #[serde(rename_all = "camelCase")] pub struct Epoch { /// Epoch index pub index: EpochIndex, /// Key - // todo: don't serialize key + #[serde(skip)] pub key: [u8; 2], } +impl Default for Epoch { + fn default() -> Self { + Self::new(0).unwrap() + } +} + impl Epoch { /// Create new epoch pub fn new(index: EpochIndex) -> Result { @@ -39,3 +48,68 @@ impl Epoch { }) } } + +impl TryFrom for Epoch { + type Error = ProtocolError; + + fn try_from(value: EpochIndex) -> Result { + Self::new(value) + } +} + +impl TryFrom<&Vec> for Epoch { + type Error = ProtocolError; + + fn try_from(value: &Vec) -> Result { + let key = value.clone().try_into().map_err(|_| { + ProtocolError::InvalidVectorSizeError(InvalidVectorSizeError::new(2, value.len())) + })?; + let index_with_offset = u16::from_be_bytes(key); + let index = index_with_offset + .checked_sub(EPOCH_KEY_OFFSET) + .ok_or(ProtocolError::Overflow("value too low, must have offset"))?; + Ok(Epoch { index, key }) + } +} + +impl Encode for Epoch { + fn encode( + &self, + encoder: &mut E, + ) -> Result<(), bincode::error::EncodeError> { + self.index.encode(encoder) + } +} + +impl<'de> Deserialize<'de> for Epoch { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + #[derive(Deserialize)] + struct EpochData { + index: EpochIndex, + } + + let data = EpochData::deserialize(deserializer)?; + Epoch::new(data.index).map_err(serde::de::Error::custom) + } +} + +impl Decode for Epoch { + fn decode( + decoder: &mut D, + ) -> Result { + let index = EpochIndex::decode(decoder)?; + Epoch::new(index).map_err(|e| bincode::error::DecodeError::OtherString(e.to_string())) + } +} + +impl<'de> BorrowDecode<'de> for Epoch { + fn borrow_decode>( + decoder: &mut D, + ) -> Result { + let index = EpochIndex::borrow_decode(decoder)?; + Epoch::new(index).map_err(|e| bincode::error::DecodeError::OtherString(e.to_string())) + } +} diff --git a/packages/rs-dpp/src/block/extended_block_info/mod.rs b/packages/rs-dpp/src/block/extended_block_info/mod.rs index 228e01b8aba..fb8a20950d7 100644 --- a/packages/rs-dpp/src/block/extended_block_info/mod.rs +++ b/packages/rs-dpp/src/block/extended_block_info/mod.rs @@ -72,6 +72,12 @@ impl ExtendedBlockInfoV0Getters for ExtendedBlockInfo { } } + fn proposer_pro_tx_hash(&self) -> &[u8; 32] { + match self { + ExtendedBlockInfo::V0(v0) => &v0.proposer_pro_tx_hash, + } + } + fn block_id_hash(&self) -> &[u8; 32] { match self { ExtendedBlockInfo::V0(v0) => &v0.block_id_hash, @@ -146,6 +152,7 @@ mod tests { app_hash: [1; 32], quorum_hash: [2; 32], block_id_hash: [3; 32], + proposer_pro_tx_hash: [4; 32], signature: [3; 96], round: 1, } diff --git a/packages/rs-dpp/src/block/extended_block_info/v0/mod.rs b/packages/rs-dpp/src/block/extended_block_info/v0/mod.rs index 9fb42e86472..4854f2d87cb 100644 --- a/packages/rs-dpp/src/block/extended_block_info/v0/mod.rs +++ b/packages/rs-dpp/src/block/extended_block_info/v0/mod.rs @@ -14,6 +14,8 @@ pub struct ExtendedBlockInfoV0 { pub quorum_hash: [u8; 32], /// The block id hash pub block_id_hash: [u8; 32], + /// The proposer pro_tx_hash + pub proposer_pro_tx_hash: [u8; 32], /// Signature #[serde(with = "signature_serializer")] pub signature: [u8; 96], @@ -37,6 +39,9 @@ pub trait ExtendedBlockInfoV0Getters { /// Returns the quorum hash. fn quorum_hash(&self) -> &[u8; 32]; + /// Proposer pro tx hash. + fn proposer_pro_tx_hash(&self) -> &[u8; 32]; + /// The block id hash fn block_id_hash(&self) -> &[u8; 32]; /// Returns the signature. @@ -85,6 +90,10 @@ impl ExtendedBlockInfoV0Getters for ExtendedBlockInfoV0 { &self.quorum_hash } + fn proposer_pro_tx_hash(&self) -> &[u8; 32] { + &self.proposer_pro_tx_hash + } + fn block_id_hash(&self) -> &[u8; 32] { &self.block_id_hash } diff --git a/packages/rs-dpp/src/block/extended_epoch_info/mod.rs b/packages/rs-dpp/src/block/extended_epoch_info/mod.rs index e414591f0c6..238fdd2a629 100644 --- a/packages/rs-dpp/src/block/extended_epoch_info/mod.rs +++ b/packages/rs-dpp/src/block/extended_epoch_info/mod.rs @@ -3,10 +3,10 @@ pub mod v0; use crate::block::epoch::EpochIndex; use crate::block::extended_epoch_info::v0::{ExtendedEpochInfoV0, ExtendedEpochInfoV0Getters}; use crate::protocol_error::ProtocolError; +use crate::util::deserializer::ProtocolVersion; use bincode::{Decode, Encode}; use derive_more::From; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use platform_version::version::PlatformVersion; use serde::{Deserialize, Serialize}; /// Extended Block information @@ -52,9 +52,15 @@ impl ExtendedEpochInfoV0Getters for ExtendedEpochInfo { } } - fn fee_multiplier(&self) -> f64 { + fn fee_multiplier_permille(&self) -> u64 { match self { - ExtendedEpochInfo::V0(v0) => v0.fee_multiplier, + ExtendedEpochInfo::V0(v0) => v0.fee_multiplier_permille, + } + } + + fn protocol_version(&self) -> ProtocolVersion { + match self { + ExtendedEpochInfo::V0(v0) => v0.protocol_version, } } } diff --git a/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs b/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs index e99b8e11325..5e56027df41 100644 --- a/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs +++ b/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs @@ -1,4 +1,5 @@ use crate::block::epoch::EpochIndex; +use crate::util::deserializer::ProtocolVersion; use bincode::{Decode, Encode}; use serde::{Deserialize, Serialize}; @@ -13,8 +14,10 @@ pub struct ExtendedEpochInfoV0 { pub first_block_height: u64, /// First core block height pub first_core_block_height: u32, - /// Fee multiplier - pub fee_multiplier: f64, + /// Fee multiplier that you would divide by 1000 to get float value + pub fee_multiplier_permille: u64, + /// Protocol version + pub protocol_version: u32, } /// Trait defining getters for `ExtendedEpochInfoV0`. @@ -31,6 +34,9 @@ pub trait ExtendedEpochInfoV0Getters { /// Returns the first core block height. fn first_core_block_height(&self) -> u32; - /// Returns the fee multiplier. - fn fee_multiplier(&self) -> f64; + /// Returns 1000 times the fee multiplier. so 1000 would be 1. + fn fee_multiplier_permille(&self) -> u64; + + /// Protocol version + fn protocol_version(&self) -> ProtocolVersion; } diff --git a/packages/rs-dpp/src/bls.rs b/packages/rs-dpp/src/bls.rs deleted file mode 100644 index a91deb9dc33..00000000000 --- a/packages/rs-dpp/src/bls.rs +++ /dev/null @@ -1,67 +0,0 @@ -use crate::{ProtocolError, PublicKeyValidationError}; -#[cfg(not(target_arch = "wasm32"))] -use anyhow::anyhow; -use bls_signatures::{PrivateKey, PublicKey}; -use std::convert::TryInto; - -pub trait BlsModule { - fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError>; - fn verify_signature( - &self, - signature: &[u8], - data: &[u8], - public_key: &[u8], - ) -> Result; - fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError>; - fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError>; -} - -// TODO: write tests for the native BLS module - -#[derive(Default)] -#[cfg(not(target_arch = "wasm32"))] -pub struct NativeBlsModule; - -#[cfg(not(target_arch = "wasm32"))] -impl BlsModule for NativeBlsModule { - fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError> { - match PublicKey::from_bytes(pk) { - Ok(_) => Ok(()), - Err(e) => Err(PublicKeyValidationError::new(e.to_string())), - } - } - - fn verify_signature( - &self, - signature: &[u8], - data: &[u8], - public_key: &[u8], - ) -> Result { - let public_key = PublicKey::from_bytes(public_key).map_err(anyhow::Error::msg)?; - let signature = - bls_signatures::Signature::from_bytes(signature).map_err(anyhow::Error::msg)?; - match public_key.verify(&signature, data) { - true => Ok(true), - // TODO change to specific error type - false => Err(anyhow!("Verification failed").into()), - } - } - - fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError> { - let fixed_len_key: [u8; 32] = private_key - .try_into() - .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; - let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; - let public_key = pk.g1_element().map_err(anyhow::Error::msg)?; - let public_key_bytes = public_key.to_bytes().to_vec(); - Ok(public_key_bytes) - } - - fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError> { - let fixed_len_key: [u8; 32] = private_key - .try_into() - .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; - let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; - Ok(pk.sign(data).to_bytes().to_vec()) - } -} diff --git a/packages/rs-dpp/src/bls/mod.rs b/packages/rs-dpp/src/bls/mod.rs new file mode 100644 index 00000000000..8b825531c02 --- /dev/null +++ b/packages/rs-dpp/src/bls/mod.rs @@ -0,0 +1,16 @@ +#[cfg(all(not(target_arch = "wasm32"), feature = "bls-signatures"))] +pub mod native_bls; + +use crate::{ProtocolError, PublicKeyValidationError}; + +pub trait BlsModule { + fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError>; + fn verify_signature( + &self, + signature: &[u8], + data: &[u8], + public_key: &[u8], + ) -> Result; + fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError>; + fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError>; +} diff --git a/packages/rs-dpp/src/bls/native_bls.rs b/packages/rs-dpp/src/bls/native_bls.rs new file mode 100644 index 00000000000..f6132842662 --- /dev/null +++ b/packages/rs-dpp/src/bls/native_bls.rs @@ -0,0 +1,48 @@ +use crate::{BlsModule, ProtocolError, PublicKeyValidationError}; +use anyhow::anyhow; +use bls_signatures::{PrivateKey, PublicKey}; + +#[derive(Default)] +pub struct NativeBlsModule; +impl BlsModule for NativeBlsModule { + fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError> { + match PublicKey::from_bytes(pk) { + Ok(_) => Ok(()), + Err(e) => Err(PublicKeyValidationError::new(e.to_string())), + } + } + + fn verify_signature( + &self, + signature: &[u8], + data: &[u8], + public_key: &[u8], + ) -> Result { + let public_key = PublicKey::from_bytes(public_key).map_err(anyhow::Error::msg)?; + let signature = + bls_signatures::Signature::from_bytes(signature).map_err(anyhow::Error::msg)?; + match public_key.verify(&signature, data) { + true => Ok(true), + // TODO change to specific error type + false => Err(anyhow!("Verification failed").into()), + } + } + + fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError> { + let fixed_len_key: [u8; 32] = private_key + .try_into() + .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; + let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; + let public_key = pk.g1_element().map_err(anyhow::Error::msg)?; + let public_key_bytes = public_key.to_bytes().to_vec(); + Ok(public_key_bytes) + } + + fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError> { + let fixed_len_key: [u8; 32] = private_key + .try_into() + .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; + let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; + Ok(pk.sign(data).to_bytes().to_vec()) + } +} diff --git a/packages/rs-dpp/src/core_subsidy/epoch_core_reward_credits_for_distribution/mod.rs b/packages/rs-dpp/src/core_subsidy/epoch_core_reward_credits_for_distribution/mod.rs new file mode 100644 index 00000000000..ddefad34d6e --- /dev/null +++ b/packages/rs-dpp/src/core_subsidy/epoch_core_reward_credits_for_distribution/mod.rs @@ -0,0 +1,42 @@ +mod v0; + +use crate::core_subsidy::epoch_core_reward_credits_for_distribution::v0::epoch_core_reward_credits_for_distribution_v0; +use crate::fee::Credits; +use crate::ProtocolError; +use platform_version::version::PlatformVersion; + +/// Gets the amount of core reward fees to be distributed for the Epoch. +/// +/// # Arguments +/// +/// * `from_start_block_core_height` - The height of the core block at the start of the epoch. +/// * `to_end_block_core_height_included` - The height of the core block at the start of the next epoch. +/// * `core_subsidy_halving_interval` - The halving interval set by the Core network. +/// * `platform_version` - The platform version. +/// +/// # Returns +/// +/// * `Result` - If the operation is successful, it returns `Ok(Credits)`. If there is an error, it returns `Error`. +pub fn epoch_core_reward_credits_for_distribution( + from_start_block_core_height: u32, + to_end_block_core_height_included: u32, + core_subsidy_halving_interval: u32, + platform_version: &PlatformVersion, +) -> Result { + match platform_version + .dpp + .methods + .epoch_core_reward_credits_for_distribution + { + 0 => epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height, + to_end_block_core_height_included, + core_subsidy_halving_interval, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "epoch_core_reward_credits_for_distribution".to_string(), + known_versions: vec![0], + received: version, + }), + } +} diff --git a/packages/rs-dpp/src/core_subsidy/epoch_core_reward_credits_for_distribution/v0/mod.rs b/packages/rs-dpp/src/core_subsidy/epoch_core_reward_credits_for_distribution/v0/mod.rs new file mode 100644 index 00000000000..4943e8daddb --- /dev/null +++ b/packages/rs-dpp/src/core_subsidy/epoch_core_reward_credits_for_distribution/v0/mod.rs @@ -0,0 +1,200 @@ +use crate::block::epoch::EpochIndex; +use crate::fee::Credits; + +use crate::core_subsidy::CORE_GENESIS_BLOCK_SUBSIDY; +use crate::ProtocolError; +use lazy_static::lazy_static; +use std::collections::HashMap; + +lazy_static! { + /// The Core reward halving distribution table for 100 years + /// Yearly decline of production by ~7.1% per year, projected ~18M coins max by year 2050+. + pub static ref CORE_HALVING_DISTRIBUTION: HashMap = { + let mut distribution = CORE_GENESIS_BLOCK_SUBSIDY; + (0..200).map(|i| { + let old_distribution = distribution; + distribution -= distribution / 14; + (i, old_distribution) + }).collect() + }; +} + +/// Gets the amount of core reward fees to be distributed for the Epoch. +pub(super) fn epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height: u32, + to_end_block_core_height_included: u32, + core_subsidy_halving_interval: u32, +) -> Result { + if from_start_block_core_height > to_end_block_core_height_included { + return Ok(0); + } + // Core is halving block rewards every year so we need to pay + // core block rewards according to halving ratio for the all years during + // the platform epoch payout period (unpaid epoch) + + // In Core there is an off by 1 compared to what we would expect, for if the halving interval is 1000 + // We would see a new reward year on block 1001. + + let previous_from_start_block_core_height = from_start_block_core_height.saturating_sub(1); + + let previous_to_end_block_core_height = to_end_block_core_height_included.saturating_sub(1); + + // Calculate start and end years for the platform epoch payout period + // according to start and end core block heights + + // 1000 would be on core year 0, as we would have 1000 - 1/1000 => 0, this is correct + let start_core_reward_year = + (previous_from_start_block_core_height / core_subsidy_halving_interval) as EpochIndex; + // 2000 would be on core year 1, as we would have 2000 - 1/1000 => 1, this is correct + let end_core_reward_year = + (previous_to_end_block_core_height / core_subsidy_halving_interval) as EpochIndex; + + let mut total_core_rewards = 0; + + // Calculate block rewards for each core reward year during the platform epoch payout period + for core_reward_epoch in start_core_reward_year..=end_core_reward_year { + // Calculate the block count per core reward year + + // If we are on the end core reward year + // We use the previous_from_start_block_core_height + // For example if we are calculating 2000 to 2001 + // We should have one block on start core year and one block on end core year + let core_reward_year_start_block = if core_reward_epoch == start_core_reward_year { + previous_from_start_block_core_height + } else { + core_reward_epoch as u32 * core_subsidy_halving_interval + }; + + let core_reward_year_end_block = if core_reward_epoch == end_core_reward_year { + to_end_block_core_height_included + } else { + (core_reward_epoch + 1) as u32 * core_subsidy_halving_interval + }; + + let block_count = core_reward_year_end_block - core_reward_year_start_block; + + // Fetch the core block distribution for the corresponding epoch from the distribution table + // Default to 0 if the core reward year is more than 100 years in the future + let core_block_distribution_ratio = CORE_HALVING_DISTRIBUTION + .get(&core_reward_epoch) + .ok_or(ProtocolError::NotSupported(format!( + "having distribution not supported for core reward epoch {}", + core_reward_epoch + )))?; + + // Calculate the core rewards for this epoch and add to the total + total_core_rewards += block_count as Credits * *core_block_distribution_ratio; + } + + Ok(total_core_rewards) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_epoch_core_reward_credits_for_distribution_simple_case_at_first_core_epoch() { + let core_subsidy_halving_interval = 150; + let from_start_block_core_height = 1; + let to_end_block_core_height_included = 150; + let expected_reward = CORE_GENESIS_BLOCK_SUBSIDY * 150; // Since all blocks are in the first epoch + + let result = epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height, + to_end_block_core_height_included, + core_subsidy_halving_interval, + ) + .unwrap(); + + assert_eq!(result, expected_reward); + } + + #[test] + fn test_epoch_core_reward_credits_for_distribution_simple_case_at_eighth_core_epoch() { + let core_subsidy_halving_interval = 150; + let from_start_block_core_height = 1201; + let to_end_block_core_height_included = 1350; + let expected_reward = CORE_HALVING_DISTRIBUTION[&8] * 150; // 1200 / 150 = 8 + + let result = epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height, + to_end_block_core_height_included, + core_subsidy_halving_interval, + ) + .unwrap(); + + assert_eq!(result, expected_reward); + } + + #[test] + fn test_epoch_core_reward_credits_for_distribution_across_two_epochs() { + let core_subsidy_halving_interval = 150; + let from_start_block_core_height = 149; + let to_end_block_core_height_included = 151; + let halved_subsidy = CORE_GENESIS_BLOCK_SUBSIDY - CORE_GENESIS_BLOCK_SUBSIDY / 14; + let expected_reward = (CORE_GENESIS_BLOCK_SUBSIDY * 2) + halved_subsidy; + + let result = epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height, + to_end_block_core_height_included, + core_subsidy_halving_interval, + ) + .unwrap(); + + assert_eq!(result, expected_reward); + } + + #[test] + fn test_epoch_core_reward_credits_for_distribution_across_three_epochs() { + let core_subsidy_halving_interval = 150; + let from_start_block_core_height = 149; + let to_end_block_core_height_included = 301; + let halved_subsidy = CORE_GENESIS_BLOCK_SUBSIDY - CORE_GENESIS_BLOCK_SUBSIDY / 14; + let next_halved_subsidy = halved_subsidy - halved_subsidy / 14; + let expected_reward = + (CORE_GENESIS_BLOCK_SUBSIDY * 2) + halved_subsidy * 150 + next_halved_subsidy; + + let result = epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height, + to_end_block_core_height_included, + core_subsidy_halving_interval, + ) + .unwrap(); + + assert_eq!(result, expected_reward); + } + + #[test] + fn test_epoch_core_reward_credits_for_distribution_inner_epoch() { + let core_subsidy_halving_interval = 150; + let from_start_block_core_height = 1303; + let to_end_block_core_height_included = 1305; + let expected_reward = CORE_HALVING_DISTRIBUTION[&8] * 3; // 1200 / 150 = 8 + + let result = epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height, + to_end_block_core_height_included, + core_subsidy_halving_interval, + ) + .unwrap(); + + assert_eq!(result, expected_reward); + } + + #[test] + fn test_epoch_core_reward_credits_for_distribution_long_test() { + let core_subsidy_halving_interval = 150; + let from_start_block_core_height = 1320; + let to_end_block_core_height_included = 1320; + + let result = epoch_core_reward_credits_for_distribution_v0( + from_start_block_core_height, + to_end_block_core_height_included, + core_subsidy_halving_interval, + ) + .unwrap(); + + assert_eq!(result, 62183484655); + } +} diff --git a/packages/rs-dpp/src/core_subsidy/mod.rs b/packages/rs-dpp/src/core_subsidy/mod.rs new file mode 100644 index 00000000000..10370ae1347 --- /dev/null +++ b/packages/rs-dpp/src/core_subsidy/mod.rs @@ -0,0 +1,26 @@ +pub mod epoch_core_reward_credits_for_distribution; + +use crate::fee::Credits; +use dashcore::Network; + +/// ORIGINAL CORE BLOCK DISTRIBUTION +/// STARTS AT 5 Dash +/// Take 60% for Masternodes +/// Take 37.5% of that for Platform +const CORE_GENESIS_BLOCK_SUBSIDY: Credits = 112500000000; + +pub trait NetworkCoreSubsidy { + fn core_subsidy_halving_interval(&self) -> u32; +} + +impl NetworkCoreSubsidy for Network { + fn core_subsidy_halving_interval(&self) -> u32 { + match self { + Network::Dash => 210240, + Network::Testnet => 210240, + Network::Devnet => 210240, + Network::Regtest => 150, + _ => 210240, + } + } +} diff --git a/packages/rs-dpp/src/data_contract/accessors/mod.rs b/packages/rs-dpp/src/data_contract/accessors/mod.rs index 344de28e3f2..fc5dc0789b7 100644 --- a/packages/rs-dpp/src/data_contract/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/accessors/mod.rs @@ -4,9 +4,10 @@ use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; use crate::data_contract::DocumentName; use crate::metadata::Metadata; use crate::prelude::DataContract; -use crate::ProtocolError; + use platform_value::Identifier; +use crate::data_contract::errors::DataContractError; use std::collections::BTreeMap; pub mod v0; @@ -36,13 +37,22 @@ impl DataContractV0Getters for DataContract { } } - fn document_type_cloned_for_name(&self, name: &str) -> Result { + fn document_type_cloned_for_name(&self, name: &str) -> Result { match self { DataContract::V0(v0) => v0.document_type_cloned_for_name(name), } } - fn document_type_for_name(&self, name: &str) -> Result { + fn document_type_borrowed_for_name( + &self, + name: &str, + ) -> Result<&DocumentType, DataContractError> { + match self { + DataContract::V0(v0) => v0.document_type_borrowed_for_name(name), + } + } + + fn document_type_for_name(&self, name: &str) -> Result { match self { DataContract::V0(v0) => v0.document_type_for_name(name), } @@ -66,12 +76,24 @@ impl DataContractV0Getters for DataContract { } } + fn document_types_with_contested_indexes(&self) -> BTreeMap<&DocumentName, &DocumentType> { + match self { + DataContract::V0(v0) => v0.document_types_with_contested_indexes(), + } + } + fn document_types(&self) -> &BTreeMap { match self { DataContract::V0(v0) => v0.document_types(), } } + fn document_types_mut(&mut self) -> &mut BTreeMap { + match self { + DataContract::V0(v0) => v0.document_types_mut(), + } + } + fn metadata(&self) -> Option<&Metadata> { match self { DataContract::V0(v0) => v0.metadata(), diff --git a/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs b/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs index f5b276d1cf6..e2e3e5fcd45 100644 --- a/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs @@ -1,8 +1,9 @@ use crate::data_contract::config::DataContractConfig; use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; +use crate::data_contract::errors::DataContractError; use crate::data_contract::DocumentName; use crate::metadata::Metadata; -use crate::ProtocolError; + use platform_value::Identifier; use std::collections::BTreeMap; @@ -17,19 +18,27 @@ pub trait DataContractV0Getters { /// Returns the identifier of the contract owner. fn owner_id(&self) -> Identifier; - fn document_type_cloned_for_name(&self, name: &str) -> Result; + fn document_type_cloned_for_name(&self, name: &str) -> Result; + fn document_type_borrowed_for_name( + &self, + name: &str, + ) -> Result<&DocumentType, DataContractError>; /// Returns the document type for the given document name. - fn document_type_for_name(&self, name: &str) -> Result; + fn document_type_for_name(&self, name: &str) -> Result; fn document_type_optional_for_name(&self, name: &str) -> Option; fn document_type_cloned_optional_for_name(&self, name: &str) -> Option; fn has_document_type_for_name(&self, name: &str) -> bool; + fn document_types_with_contested_indexes(&self) -> BTreeMap<&DocumentName, &DocumentType>; /// Returns a mapping of document names to their corresponding document types. fn document_types(&self) -> &BTreeMap; + /// Returns a mapping of document names to their corresponding document types as mutable. + fn document_types_mut(&mut self) -> &mut BTreeMap; + /// Returns optional metadata associated with the contract. fn metadata(&self) -> Option<&Metadata>; diff --git a/packages/rs-dpp/src/data_contract/config/fields.rs b/packages/rs-dpp/src/data_contract/config/fields.rs index 255c8b1eda1..200c0402e07 100644 --- a/packages/rs-dpp/src/data_contract/config/fields.rs +++ b/packages/rs-dpp/src/data_contract/config/fields.rs @@ -1,10 +1,9 @@ -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; - pub const DEFAULT_CONTRACT_KEEPS_HISTORY: bool = false; pub const DEFAULT_CONTRACT_CAN_BE_DELETED: bool = false; pub const DEFAULT_CONTRACT_MUTABILITY: bool = true; pub const DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY: bool = false; pub const DEFAULT_CONTRACT_DOCUMENT_MUTABILITY: bool = true; +pub const DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED: bool = true; pub mod property { pub const CAN_BE_DELETED: &str = "canBeDeleted"; @@ -12,6 +11,8 @@ pub mod property { pub const KEEPS_HISTORY: &str = "keepsHistory"; pub const DOCUMENTS_KEEP_HISTORY_CONTRACT_DEFAULT: &str = "documentsKeepHistoryContractDefault"; pub const DOCUMENTS_MUTABLE_CONTRACT_DEFAULT: &str = "documentsMutableContractDefault"; + pub const DOCUMENTS_CAN_BE_DELETED_CONTRACT_DEFAULT: &str = + "documentsCanBeDeletedContractDefault"; pub const REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY: &str = "requiresIdentityEncryptionBoundedKey"; pub const REQUIRES_IDENTITY_DECRYPTION_BOUNDED_KEY: &str = diff --git a/packages/rs-dpp/src/data_contract/config/methods/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/mod.rs index a78cbd18517..1af1fba5226 100644 --- a/packages/rs-dpp/src/data_contract/config/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/config/methods/mod.rs @@ -1 +1 @@ -mod validate_config_update; +mod validate_update; diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/mod.rs deleted file mode 100644 index 9372a892716..00000000000 --- a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/mod.rs +++ /dev/null @@ -1,30 +0,0 @@ -use crate::data_contract::config::DataContractConfig; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Identifier; -use platform_version::version::PlatformVersion; - -mod v0; - -impl DataContractConfig { - pub fn validate_config_update( - &self, - new_config: &DataContractConfig, - contract_id: Identifier, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .validation - .data_contract - .validate_config_update - { - 0 => Ok(self.validate_config_update_v0(new_config, contract_id)), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DataContractConfig::from_value".to_string(), - known_versions: vec![0], - received: version, - }), - } - } -} diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/v0/mod.rs deleted file mode 100644 index 9087683dcb8..00000000000 --- a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/v0/mod.rs +++ /dev/null @@ -1,108 +0,0 @@ -use crate::consensus::state::data_contract::data_contract_config_update_error::DataContractConfigUpdateError; -use crate::consensus::state::data_contract::data_contract_is_readonly_error::DataContractIsReadonlyError; -use crate::data_contract::config::v0::DataContractConfigGettersV0; -use crate::data_contract::config::DataContractConfig; -use crate::validation::SimpleConsensusValidationResult; -use platform_value::Identifier; - -impl DataContractConfig { - pub(super) fn validate_config_update_v0( - &self, - new_config: &DataContractConfig, - contract_id: Identifier, - ) -> SimpleConsensusValidationResult { - if self.readonly() { - return SimpleConsensusValidationResult::new_with_error( - DataContractIsReadonlyError::new(contract_id).into(), - ); - } - - if new_config.readonly() { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not be changed to readonly", - ) - .into(), - ); - } - - if new_config.keeps_history() != self.keeps_history() { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - format!( - "contract can not change whether it keeps history: changing from {} to {}", - self.keeps_history(), - new_config.keeps_history() - ), - ) - .into(), - ); - } - - if new_config.can_be_deleted() != self.can_be_deleted() { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - format!( - "contract can not change whether it can be delete: changing from {} to {}", - self.can_be_deleted(), - new_config.can_be_deleted() - ), - ) - .into(), - ); - } - - if new_config.documents_keep_history_contract_default() - != self.documents_keep_history_contract_default() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the default of whether documents keeps history", - ) - .into(), - ); - } - - if new_config.documents_mutable_contract_default() - != self.documents_mutable_contract_default() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the default of whether documents are mutable", - ) - .into(), - ); - } - - if new_config.requires_identity_encryption_bounded_key() - != self.requires_identity_encryption_bounded_key() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the requirement of needing a document encryption bounded key", - ) - .into(), - ); - } - - if new_config.requires_identity_decryption_bounded_key() - != self.requires_identity_decryption_bounded_key() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the requirement of needing a document decryption bounded key", - ) - .into(), - ); - } - - SimpleConsensusValidationResult::new() - } -} diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_update/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_update/mod.rs new file mode 100644 index 00000000000..1df2ee3d726 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/config/methods/validate_update/mod.rs @@ -0,0 +1,30 @@ +use crate::data_contract::config::DataContractConfig; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; + +mod v0; + +impl DataContractConfig { + pub fn validate_update( + &self, + new_config: &DataContractConfig, + contract_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .validation + .data_contract + .validate_config_update + { + 0 => Ok(self.validate_update_v0(new_config, contract_id)), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "validate_update".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_update/v0/mod.rs new file mode 100644 index 00000000000..224f7586f60 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/config/methods/validate_update/v0/mod.rs @@ -0,0 +1,139 @@ +use crate::consensus::state::data_contract::data_contract_config_update_error::DataContractConfigUpdateError; +use crate::consensus::state::data_contract::data_contract_is_readonly_error::DataContractIsReadonlyError; +use crate::data_contract::config::v0::DataContractConfigGettersV0; +use crate::data_contract::config::DataContractConfig; +use crate::validation::SimpleConsensusValidationResult; +use platform_value::Identifier; + +impl DataContractConfig { + #[inline(always)] + pub(super) fn validate_update_v0( + &self, + new_config: &DataContractConfig, + contract_id: Identifier, + ) -> SimpleConsensusValidationResult { + // Validate: Old contract is not read_only + + if self.readonly() { + return SimpleConsensusValidationResult::new_with_error( + DataContractIsReadonlyError::new(contract_id).into(), + ); + } + + // Validate: New contract is not read_only + + if new_config.readonly() { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not be changed to readonly", + ) + .into(), + ); + } + + // Validate: Keeps history did not change + + if new_config.keeps_history() != self.keeps_history() { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + format!( + "contract can not change whether it keeps history: changing from {} to {}", + self.keeps_history(), + new_config.keeps_history() + ), + ) + .into(), + ); + } + + // Validate: Can be deleted did not change + + if new_config.can_be_deleted() != self.can_be_deleted() { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + format!( + "contract can not change whether it can be delete: changing from {} to {}", + self.can_be_deleted(), + new_config.can_be_deleted() + ), + ) + .into(), + ); + } + + // Validate: Documents keep history did not change + + if new_config.documents_keep_history_contract_default() + != self.documents_keep_history_contract_default() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the default of whether documents keeps history", + ) + .into(), + ); + } + + // Validate: Documents mutable contract default did not change + + if new_config.documents_mutable_contract_default() + != self.documents_mutable_contract_default() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the default of whether documents are mutable", + ) + .into(), + ); + } + + // Validate: Documents can be deleted contract default did not change + + if new_config.documents_can_be_deleted_contract_default() + != self.documents_can_be_deleted_contract_default() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the default of whether documents can be deleted", + ) + .into(), + ); + } + + // Validate: Requires identity encryption bounded key did not change + + if new_config.requires_identity_encryption_bounded_key() + != self.requires_identity_encryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the requirement of needing a document encryption bounded key", + ) + .into(), + ); + } + + // Validate: Requires identity decryption bounded key did not change + + if new_config.requires_identity_decryption_bounded_key() + != self.requires_identity_decryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the requirement of needing a document decryption bounded key", + ) + .into(), + ); + } + + SimpleConsensusValidationResult::new() + } +} diff --git a/packages/rs-dpp/src/data_contract/config/mod.rs b/packages/rs-dpp/src/data_contract/config/mod.rs index 26aaba3636b..2f2a2c825a2 100644 --- a/packages/rs-dpp/src/data_contract/config/mod.rs +++ b/packages/rs-dpp/src/data_contract/config/mod.rs @@ -117,6 +117,12 @@ impl DataContractConfigGettersV0 for DataContractConfig { } } + fn documents_can_be_deleted_contract_default(&self) -> bool { + match self { + DataContractConfig::V0(v0) => v0.documents_can_be_deleted_contract_default, + } + } + /// Encryption key storage requirements fn requires_identity_encryption_bounded_key(&self) -> Option { match self { @@ -127,7 +133,7 @@ impl DataContractConfigGettersV0 for DataContractConfig { /// Decryption key storage requirements fn requires_identity_decryption_bounded_key(&self) -> Option { match self { - DataContractConfig::V0(v0) => v0.requires_identity_encryption_bounded_key, + DataContractConfig::V0(v0) => v0.requires_identity_decryption_bounded_key, } } } @@ -157,6 +163,12 @@ impl DataContractConfigSettersV0 for DataContractConfig { } } + fn set_documents_can_be_deleted_contract_default(&mut self, value: bool) { + match self { + DataContractConfig::V0(v0) => v0.documents_can_be_deleted_contract_default = value, + } + } + fn set_documents_mutable_contract_default(&mut self, value: bool) { match self { DataContractConfig::V0(v0) => v0.documents_mutable_contract_default = value, diff --git a/packages/rs-dpp/src/data_contract/config/v0/mod.rs b/packages/rs-dpp/src/data_contract/config/v0/mod.rs index e4d6eb9c981..329361befe4 100644 --- a/packages/rs-dpp/src/data_contract/config/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/config/v0/mod.rs @@ -1,8 +1,8 @@ use crate::data_contract::config; use crate::data_contract::config::{ - DataContractConfig, DEFAULT_CONTRACT_CAN_BE_DELETED, DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY, - DEFAULT_CONTRACT_DOCUMENT_MUTABILITY, DEFAULT_CONTRACT_KEEPS_HISTORY, - DEFAULT_CONTRACT_MUTABILITY, + DataContractConfig, DEFAULT_CONTRACT_CAN_BE_DELETED, DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED, + DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY, DEFAULT_CONTRACT_DOCUMENT_MUTABILITY, + DEFAULT_CONTRACT_KEEPS_HISTORY, DEFAULT_CONTRACT_MUTABILITY, }; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; use crate::ProtocolError; @@ -27,10 +27,14 @@ pub struct DataContractConfigV0 { /// Do documents in the contract keep history. This is a default for all documents in /// the contract, but can be overridden by the document itself pub documents_keep_history_contract_default: bool, - /// Are documents in the contract mutable. This specifies whether the document can be - /// changed or deleted. This is a default for all documents in the contract, but can be - /// overridden by the document itself + /// Are documents in the contract mutable? This specifies whether the documents can be + /// changed. This is a default for all document types in the contract, but can be + /// overridden by the document type config. pub documents_mutable_contract_default: bool, + /// Can documents in the contract be deleted? This specifies whether the documents can be + /// deleted. This is a default for all document types in the contract, but can be + /// overridden by the document types itself. + pub documents_can_be_deleted_contract_default: bool, /// Encryption key storage requirements pub requires_identity_encryption_bounded_key: Option, /// Decryption key storage requirements @@ -53,6 +57,7 @@ pub trait DataContractConfigGettersV0 { /// Returns whether documents in the contract are mutable by default. fn documents_mutable_contract_default(&self) -> bool; + fn documents_can_be_deleted_contract_default(&self) -> bool; /// Encryption key storage requirements fn requires_identity_encryption_bounded_key(&self) -> Option; @@ -78,6 +83,9 @@ pub trait DataContractConfigSettersV0 { /// Sets whether documents in the contract are mutable by default. fn set_documents_mutable_contract_default(&mut self, value: bool); + /// Sets whether documents in the contract can be deleted by default. + fn set_documents_can_be_deleted_contract_default(&mut self, value: bool); + /// Sets Encryption key storage requirements. fn set_requires_identity_encryption_bounded_key( &mut self, @@ -99,6 +107,7 @@ impl std::default::Default for DataContractConfigV0 { keeps_history: DEFAULT_CONTRACT_KEEPS_HISTORY, documents_keep_history_contract_default: DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY, documents_mutable_contract_default: DEFAULT_CONTRACT_DOCUMENT_MUTABILITY, + documents_can_be_deleted_contract_default: DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, } @@ -134,6 +143,7 @@ impl DataContractConfigV0 { /// /// * `Result`: On success, a ContractConfig. /// On failure, a ProtocolError. + #[inline(always)] pub(super) fn get_contract_configuration_properties_v0( contract: &BTreeMap, ) -> Result { @@ -156,6 +166,10 @@ impl DataContractConfigV0 { .get_optional_bool(config::property::DOCUMENTS_MUTABLE_CONTRACT_DEFAULT)? .unwrap_or(DEFAULT_CONTRACT_DOCUMENT_MUTABILITY); + let documents_can_be_deleted_contract_default = contract + .get_optional_bool(config::property::DOCUMENTS_CAN_BE_DELETED_CONTRACT_DEFAULT)? + .unwrap_or(DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED); + let requires_identity_encryption_bounded_key = contract .get_optional_integer::(config::property::REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY)? .map(|int| int.try_into()) @@ -172,6 +186,7 @@ impl DataContractConfigV0 { keeps_history, documents_keep_history_contract_default, documents_mutable_contract_default, + documents_can_be_deleted_contract_default, requires_identity_encryption_bounded_key, requires_identity_decryption_bounded_key, }) diff --git a/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs b/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs index bc9e08ecf52..541fabd5bae 100644 --- a/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs @@ -12,7 +12,7 @@ impl DataContractCborConversionMethodsV0 for DataContract { fn from_cbor_with_id( cbor_bytes: impl AsRef<[u8]>, contract_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -23,7 +23,7 @@ impl DataContractCborConversionMethodsV0 for DataContract { 0 => Ok(DataContractV0::from_cbor_with_id( cbor_bytes, contract_id, - validate, + full_validation, platform_version, )? .into()), @@ -37,7 +37,7 @@ impl DataContractCborConversionMethodsV0 for DataContract { fn from_cbor( cbor_bytes: impl AsRef<[u8]>, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -45,7 +45,9 @@ impl DataContractCborConversionMethodsV0 for DataContract { .contract_versions .contract_structure_version { - 0 => Ok(DataContractV0::from_cbor(cbor_bytes, validate, platform_version)?.into()), + 0 => Ok( + DataContractV0::from_cbor(cbor_bytes, full_validation, platform_version)?.into(), + ), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContract::from_cbor".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs b/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs index 5ceaec81c53..273f9709b49 100644 --- a/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs @@ -7,14 +7,14 @@ pub trait DataContractCborConversionMethodsV0 { fn from_cbor_with_id( cbor_bytes: impl AsRef<[u8]>, contract_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where Self: Sized; fn from_cbor( cbor_bytes: impl AsRef<[u8]>, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where diff --git a/packages/rs-dpp/src/data_contract/conversion/json/mod.rs b/packages/rs-dpp/src/data_contract/conversion/json/mod.rs index 6edf1037855..b06f6ff2ff9 100644 --- a/packages/rs-dpp/src/data_contract/conversion/json/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/json/mod.rs @@ -10,7 +10,7 @@ use serde_json::Value as JsonValue; impl DataContractJsonConversionMethodsV0 for DataContract { fn from_json( json_value: JsonValue, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -21,7 +21,9 @@ impl DataContractJsonConversionMethodsV0 for DataContract { .contract_versions .contract_structure_version { - 0 => Ok(DataContractV0::from_json(json_value, validate, platform_version)?.into()), + 0 => Ok( + DataContractV0::from_json(json_value, full_validation, platform_version)?.into(), + ), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContract::from_json_object".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs b/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs index 28d3b6621b8..459ed3b4598 100644 --- a/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs @@ -5,7 +5,7 @@ use serde_json::Value as JsonValue; pub trait DataContractJsonConversionMethodsV0 { fn from_json( json_value: JsonValue, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where diff --git a/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs b/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs index 7cc5c22c77c..43e558b17ab 100644 --- a/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs @@ -29,7 +29,12 @@ impl<'de> Deserialize<'de> for DataContract { let current_version = PlatformVersion::get_current().map_err(|e| serde::de::Error::custom(e.to_string()))?; // when deserializing from json/platform_value/cbor we always want to validate (as this is not coming from the state) - DataContract::try_from_platform_versioned(serialization_format, true, current_version) - .map_err(serde::de::Error::custom) + DataContract::try_from_platform_versioned( + serialization_format, + true, + &mut vec![], + current_version, + ) + .map_err(serde::de::Error::custom) } } diff --git a/packages/rs-dpp/src/data_contract/conversion/value/mod.rs b/packages/rs-dpp/src/data_contract/conversion/value/mod.rs index d33f2077170..bc54e6e80a1 100644 --- a/packages/rs-dpp/src/data_contract/conversion/value/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/value/mod.rs @@ -10,7 +10,7 @@ use platform_value::Value; impl DataContractValueConversionMethodsV0 for DataContract { fn from_value( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -18,7 +18,9 @@ impl DataContractValueConversionMethodsV0 for DataContract { .contract_versions .contract_structure_version { - 0 => Ok(DataContractV0::from_value(raw_object, validate, platform_version)?.into()), + 0 => Ok( + DataContractV0::from_value(raw_object, full_validation, platform_version)?.into(), + ), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContract::from_object".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs b/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs index 684bf051eb4..614330cdb99 100644 --- a/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs @@ -5,7 +5,7 @@ use platform_value::Value; pub trait DataContractValueConversionMethodsV0 { fn from_value( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where diff --git a/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs b/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs index bf38cb789eb..94373609317 100644 --- a/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs +++ b/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs @@ -1,4 +1,4 @@ pub mod property_names { pub const DATA_CONTRACT: &str = "dataContract"; - pub const ENTROPY: &str = "entropy"; + pub const IDENTITY_NONCE: &str = "identityNonce"; } diff --git a/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs b/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs index 4d3447ef557..0e9880679dc 100644 --- a/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs +++ b/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs @@ -4,7 +4,7 @@ pub mod v0; use crate::data_contract::created_data_contract::v0::{ CreatedDataContractInSerializationFormatV0, CreatedDataContractV0, }; -use crate::prelude::DataContract; +use crate::prelude::{DataContract, IdentityNonce}; use crate::version::PlatformVersion; use crate::ProtocolError; use bincode::{Decode, Encode}; @@ -16,7 +16,8 @@ use crate::serialization::{ PlatformSerializableWithPlatformVersion, }; use crate::ProtocolError::{PlatformDeserializationError, PlatformSerializationError}; -use platform_value::{Bytes32, Value}; +#[cfg(feature = "data-contract-value-conversion")] +use platform_value::Value; use platform_version::TryIntoPlatformVersioned; /// The created data contract is a intermediate structure that can be consumed by a @@ -49,7 +50,7 @@ impl PlatformSerializableWithPlatformVersion for CreatedDataContract { self, platform_version: &PlatformVersion, ) -> Result, ProtocolError> { - let (data_contract, entropy) = self.data_contract_and_entropy_owned(); + let (data_contract, identity_nonce) = self.data_contract_and_identity_nonce(); let data_contract_serialization_format: DataContractInSerializationFormat = data_contract.try_into_platform_versioned(platform_version)?; let created_data_contract_in_serialization_format = match platform_version @@ -60,7 +61,7 @@ impl PlatformSerializableWithPlatformVersion for CreatedDataContract { 0 => Ok(CreatedDataContractInSerializationFormat::V0( CreatedDataContractInSerializationFormatV0 { data_contract: data_contract_serialization_format, - entropy_used: entropy, + identity_nonce, }, )), version => Err(ProtocolError::UnknownVersionMismatch { @@ -81,7 +82,7 @@ impl PlatformSerializableWithPlatformVersion for CreatedDataContract { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for CreatedDataContract { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -99,11 +100,12 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Cre )) })? .0; - let (data_contract_in_serialization_format, entropy) = - created_data_contract_in_serialization_format.data_contract_and_entropy_owned(); + let (data_contract_in_serialization_format, identity_nonce) = + created_data_contract_in_serialization_format.data_contract_and_identity_nonce_owned(); let data_contract = DataContract::try_from_platform_versioned( data_contract_in_serialization_format, - validate, + full_validation, + &mut vec![], platform_version, )?; match platform_version @@ -113,7 +115,7 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Cre { 0 => Ok(CreatedDataContract::V0(CreatedDataContractV0 { data_contract, - entropy_used: entropy, + identity_nonce, })), version => Err(ProtocolError::UnknownVersionMismatch { method: "CreatedDataContract::versioned_deserialize".to_string(), @@ -139,9 +141,9 @@ impl CreatedDataContract { } } - pub fn data_contract_and_entropy_owned(self) -> (DataContract, Bytes32) { + pub fn data_contract_and_identity_nonce(self) -> (DataContract, IdentityNonce) { match self { - CreatedDataContract::V0(v0) => (v0.data_contract, v0.entropy_used), + CreatedDataContract::V0(v0) => (v0.data_contract, v0.identity_nonce), } } @@ -157,28 +159,22 @@ impl CreatedDataContract { } } - pub fn entropy_used_owned(self) -> Bytes32 { + pub fn identity_nonce(&self) -> IdentityNonce { match self { - CreatedDataContract::V0(v0) => v0.entropy_used, - } - } - - pub fn entropy_used(&self) -> &Bytes32 { - match self { - CreatedDataContract::V0(v0) => &v0.entropy_used, + CreatedDataContract::V0(v0) => v0.identity_nonce, } } #[cfg(test)] - pub fn set_entropy_used(&mut self, entropy_used: Bytes32) { + pub fn set_identity_nonce(&mut self, identity_nonce: IdentityNonce) { match self { - CreatedDataContract::V0(v0) => v0.entropy_used = entropy_used, + CreatedDataContract::V0(v0) => v0.identity_nonce = identity_nonce, } } - pub fn from_contract_and_entropy( + pub fn from_contract_and_identity_nonce( data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -188,7 +184,7 @@ impl CreatedDataContract { { 0 => Ok(CreatedDataContractV0 { data_contract, - entropy_used: entropy, + identity_nonce, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { @@ -202,7 +198,7 @@ impl CreatedDataContract { #[cfg(feature = "data-contract-value-conversion")] pub fn from_object( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -210,9 +206,12 @@ impl CreatedDataContract { .contract_versions .created_data_contract_structure { - 0 => Ok( - CreatedDataContractV0::from_object(raw_object, validate, platform_version)?.into(), - ), + 0 => Ok(CreatedDataContractV0::from_object( + raw_object, + full_validation, + platform_version, + )? + .into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "CreatedDataContract::from_object".to_string(), known_versions: vec![0], @@ -223,9 +222,13 @@ impl CreatedDataContract { } impl CreatedDataContractInSerializationFormat { - pub fn data_contract_and_entropy_owned(self) -> (DataContractInSerializationFormat, Bytes32) { + pub fn data_contract_and_identity_nonce_owned( + self, + ) -> (DataContractInSerializationFormat, IdentityNonce) { match self { - CreatedDataContractInSerializationFormat::V0(v0) => (v0.data_contract, v0.entropy_used), + CreatedDataContractInSerializationFormat::V0(v0) => { + (v0.data_contract, v0.identity_nonce) + } } } } diff --git a/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs b/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs index 5b27c4b65b4..d47dc3b894c 100644 --- a/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs @@ -1,33 +1,38 @@ use crate::data_contract::DataContract; use bincode::{Decode, Encode}; -#[cfg(feature = "data-contract-value-conversion")] -use crate::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; -use crate::data_contract::created_data_contract::fields::property_names::{DATA_CONTRACT, ENTROPY}; use crate::data_contract::serialized_version::DataContractInSerializationFormat; -use crate::version::PlatformVersion; -use crate::ProtocolError; -use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; -use platform_value::{Bytes32, Error, Value}; +use crate::prelude::IdentityNonce; +#[cfg(feature = "data-contract-value-conversion")] +use crate::{ + data_contract::{ + conversion::value::v0::DataContractValueConversionMethodsV0, + created_data_contract::fields::property_names::{DATA_CONTRACT, IDENTITY_NONCE}, + }, + version::PlatformVersion, + ProtocolError, +}; +#[cfg(feature = "data-contract-value-conversion")] +use platform_value::{btreemap_extensions::BTreeValueRemoveFromMapHelper, Error, Value}; // TODO: Decide on what we need ExtendedDataContract with metadata or CreatedDataContract or both. #[derive(Clone, Debug, PartialEq)] pub struct CreatedDataContractV0 { pub data_contract: DataContract, - pub entropy_used: Bytes32, + pub identity_nonce: IdentityNonce, } #[derive(Clone, Debug, Encode, Decode)] pub struct CreatedDataContractInSerializationFormatV0 { pub data_contract: DataContractInSerializationFormat, - pub entropy_used: Bytes32, + pub identity_nonce: IdentityNonce, } impl CreatedDataContractV0 { #[cfg(feature = "data-contract-value-conversion")] pub fn from_object( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let mut raw_map = raw_object @@ -38,16 +43,16 @@ impl CreatedDataContractV0 { Error::StructureError("unable to remove property dataContract".to_string()) })?; - let entropy_used = raw_map - .remove_bytes_32(ENTROPY) + let identity_nonce = raw_map + .remove_integer(IDENTITY_NONCE) .map_err(ProtocolError::ValueError)?; let data_contract = - DataContract::from_value(raw_data_contract, validate, platform_version)?; + DataContract::from_value(raw_data_contract, full_validation, platform_version)?; Ok(Self { data_contract, - entropy_used, + identity_nonce, }) } } diff --git a/packages/rs-dpp/src/data_contract/data_contract_facade.rs b/packages/rs-dpp/src/data_contract/data_contract_facade.rs index d07991b9247..d1f606622e3 100644 --- a/packages/rs-dpp/src/data_contract/data_contract_facade.rs +++ b/packages/rs-dpp/src/data_contract/data_contract_facade.rs @@ -1,12 +1,11 @@ use crate::data_contract::{DataContract, DataContractFactory}; use crate::data_contract::created_data_contract::CreatedDataContract; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, IdentityNonce}; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use crate::util::entropy_generator::EntropyGenerator; use crate::ProtocolError; use platform_value::Value; @@ -29,12 +28,9 @@ pub struct DataContractFacade { } impl DataContractFacade { - pub fn new( - protocol_version: u32, - entropy_generator: Option>, - ) -> Result { + pub fn new(protocol_version: u32) -> Result { Ok(Self { - factory: DataContractFactory::new(protocol_version, entropy_generator)?, + factory: DataContractFactory::new(protocol_version)?, }) } @@ -42,15 +38,22 @@ impl DataContractFacade { pub fn create( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { - self.factory - .create_with_value_config(owner_id, documents, config, definitions) + self.factory.create_with_value_config( + owner_id, + identity_nonce, + documents, + config, + definitions, + ) } /// Create Data Contract from plain object + #[cfg(all(feature = "identity-serialization", feature = "client"))] pub fn create_from_object( &self, raw_data_contract: Value, @@ -61,6 +64,7 @@ impl DataContractFacade { } /// Create Data Contract from buffer + #[cfg(all(feature = "identity-serialization", feature = "client"))] pub fn create_from_buffer( &self, buffer: Vec, @@ -84,8 +88,9 @@ impl DataContractFacade { pub fn create_data_contract_update_transition( &self, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { self.factory - .create_data_contract_update_transition(data_contract) + .create_data_contract_update_transition(data_contract, identity_contract_nonce) } } diff --git a/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs b/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs index 3b9c92e1034..377b852e25d 100644 --- a/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs @@ -7,8 +7,11 @@ use crate::data_contract::document_type::{DocumentType, DocumentTypeMutRef, Docu use platform_value::{Identifier, Value}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use indexmap::IndexMap; use std::collections::{BTreeMap, BTreeSet}; pub use v0::*; @@ -32,9 +35,9 @@ impl DocumentTypeV0Getters for DocumentType { } } - fn indices(&self) -> &Vec { + fn indexes(&self) -> &BTreeMap { match self { - DocumentType::V0(v0) => v0.indices(), + DocumentType::V0(v0) => v0.indexes(), } } @@ -74,6 +77,12 @@ impl DocumentTypeV0Getters for DocumentType { } } + fn transient_fields(&self) -> &BTreeSet { + match self { + DocumentType::V0(v0) => v0.transient_fields(), + } + } + fn documents_keep_history(&self) -> bool { match self { DocumentType::V0(v0) => v0.documents_keep_history(), @@ -86,6 +95,30 @@ impl DocumentTypeV0Getters for DocumentType { } } + fn documents_can_be_deleted(&self) -> bool { + match self { + DocumentType::V0(v0) => v0.documents_can_be_deleted(), + } + } + + fn trade_mode(&self) -> TradeMode { + match self { + DocumentType::V0(v0) => v0.trade_mode(), + } + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + match self { + DocumentType::V0(v0) => v0.creation_restriction_mode(), + } + } + + fn documents_transferable(&self) -> Transferable { + match self { + DocumentType::V0(v0) => v0.documents_transferable(), + } + } + fn data_contract_id(&self) -> Identifier { match self { DocumentType::V0(v0) => v0.data_contract_id(), @@ -109,6 +142,12 @@ impl DocumentTypeV0Getters for DocumentType { DocumentType::V0(v0) => v0.security_level_requirement(), } } + + fn find_contested_index(&self) -> Option<&Index> { + match self { + DocumentType::V0(v0) => v0.find_contested_index(), + } + } } impl<'a> DocumentTypeV0Getters for DocumentTypeRef<'a> { @@ -130,9 +169,9 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeRef<'a> { } } - fn indices(&self) -> &Vec { + fn indexes(&self) -> &BTreeMap { match self { - DocumentTypeRef::V0(v0) => v0.indices(), + DocumentTypeRef::V0(v0) => v0.indexes(), } } @@ -172,6 +211,12 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeRef<'a> { } } + fn transient_fields(&self) -> &BTreeSet { + match self { + DocumentTypeRef::V0(v0) => v0.transient_fields(), + } + } + fn documents_keep_history(&self) -> bool { match self { DocumentTypeRef::V0(v0) => v0.documents_keep_history(), @@ -184,6 +229,30 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeRef<'a> { } } + fn documents_can_be_deleted(&self) -> bool { + match self { + DocumentTypeRef::V0(v0) => v0.documents_can_be_deleted(), + } + } + + fn documents_transferable(&self) -> Transferable { + match self { + DocumentTypeRef::V0(v0) => v0.documents_transferable(), + } + } + + fn trade_mode(&self) -> TradeMode { + match self { + DocumentTypeRef::V0(v0) => v0.trade_mode(), + } + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + match self { + DocumentTypeRef::V0(v0) => v0.creation_restriction_mode(), + } + } + fn data_contract_id(&self) -> Identifier { match self { DocumentTypeRef::V0(v0) => v0.data_contract_id(), @@ -207,6 +276,12 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeRef<'a> { DocumentTypeRef::V0(v0) => v0.security_level_requirement(), } } + + fn find_contested_index(&self) -> Option<&Index> { + match self { + DocumentTypeRef::V0(v0) => v0.find_contested_index(), + } + } } impl<'a> DocumentTypeV0Getters for DocumentTypeMutRef<'a> { @@ -228,9 +303,9 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeMutRef<'a> { } } - fn indices(&self) -> &Vec { + fn indexes(&self) -> &BTreeMap { match self { - DocumentTypeMutRef::V0(v0) => v0.indices(), + DocumentTypeMutRef::V0(v0) => v0.indexes(), } } @@ -270,6 +345,12 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeMutRef<'a> { } } + fn transient_fields(&self) -> &BTreeSet { + match self { + DocumentTypeMutRef::V0(v0) => v0.transient_fields(), + } + } + fn documents_keep_history(&self) -> bool { match self { DocumentTypeMutRef::V0(v0) => v0.documents_keep_history(), @@ -282,6 +363,30 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeMutRef<'a> { } } + fn documents_can_be_deleted(&self) -> bool { + match self { + DocumentTypeMutRef::V0(v0) => v0.documents_can_be_deleted(), + } + } + + fn documents_transferable(&self) -> Transferable { + match self { + DocumentTypeMutRef::V0(v0) => v0.documents_transferable(), + } + } + + fn trade_mode(&self) -> TradeMode { + match self { + DocumentTypeMutRef::V0(v0) => v0.trade_mode(), + } + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + match self { + DocumentTypeMutRef::V0(v0) => v0.creation_restriction_mode(), + } + } + fn data_contract_id(&self) -> Identifier { match self { DocumentTypeMutRef::V0(v0) => v0.data_contract_id(), @@ -305,4 +410,10 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeMutRef<'a> { DocumentTypeMutRef::V0(v0) => v0.security_level_requirement(), } } + + fn find_contested_index(&self) -> Option<&Index> { + match self { + DocumentTypeMutRef::V0(v0) => v0.find_contested_index(), + } + } } diff --git a/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs index a87802cf6f8..ad134b558cb 100644 --- a/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs @@ -4,8 +4,11 @@ use crate::data_contract::document_type::property::DocumentProperty; use platform_value::{Identifier, Value}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use indexmap::IndexMap; use std::collections::{BTreeMap, BTreeSet}; @@ -18,7 +21,10 @@ pub trait DocumentTypeV0Getters { fn schema_owned(self) -> Value; /// Returns the indices of the document type. - fn indices(&self) -> &Vec; + fn indexes(&self) -> &BTreeMap; + + /// The contested index if one exists + fn find_contested_index(&self) -> Option<&Index>; /// Returns the index structure of the document type. fn index_structure(&self) -> &IndexLevel; @@ -38,12 +44,28 @@ pub trait DocumentTypeV0Getters { /// Returns the required fields of the document type. fn required_fields(&self) -> &BTreeSet; + /// Returns the transient fields of the document type. + /// Transient fields are fields that should be stripped from the document before storage. + fn transient_fields(&self) -> &BTreeSet; + /// Returns the documents keep history flag of the document type. fn documents_keep_history(&self) -> bool; /// Returns the documents mutable flag of the document type. fn documents_mutable(&self) -> bool; + /// Returns the documents can be deleted flag of the document type. + fn documents_can_be_deleted(&self) -> bool; + + /// Returns the documents transferable flag of the document type. + fn documents_transferable(&self) -> Transferable; + + /// Returns the documents trade mode flag of the document type. + fn trade_mode(&self) -> TradeMode; + + /// Returns the creation restriction mode. + fn creation_restriction_mode(&self) -> CreationRestrictionMode; + /// Returns the data contract id of the document type. fn data_contract_id(&self) -> Identifier; diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs index ed7c970e3b3..c9c8ee76e92 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs @@ -3,6 +3,7 @@ mod v0; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::data_contract::document_type::DocumentType; use crate::data_contract::DocumentName; +use crate::validation::operations::ProtocolValidationOperation; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_value::{Identifier, Value}; @@ -38,7 +39,9 @@ impl DocumentType { schema_defs: Option<&BTreeMap>, documents_keep_history_contract_default: bool, documents_mutable_contract_default: bool, - validate: bool, + documents_can_be_deleted_contract_default: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result, ProtocolError> { match platform_version @@ -54,7 +57,9 @@ impl DocumentType { schema_defs, documents_keep_history_contract_default, documents_mutable_contract_default, - validate, + documents_can_be_deleted_contract_default, + full_validation, + validation_operations, platform_version, ), version => Err(ProtocolError::UnknownVersionMismatch { diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs index 6ca8fefa149..1050a4c2285 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs @@ -1,6 +1,9 @@ +use crate::consensus::basic::data_contract::DocumentTypesAreMissingError; +use crate::data_contract::document_type::class_methods::consensus_or_protocol_data_contract_error; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::data_contract::document_type::DocumentType; use crate::data_contract::DocumentName; +use crate::validation::operations::ProtocolValidationOperation; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_value::{Identifier, Value}; @@ -13,11 +16,19 @@ impl DocumentTypeV0 { schema_defs: Option<&BTreeMap>, documents_keep_history_contract_default: bool, documents_mutable_contract_default: bool, - validate: bool, + documents_can_be_deleted_contract_default: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result, ProtocolError> { let mut contract_document_types: BTreeMap = BTreeMap::new(); + if document_schemas.is_empty() { + return Err(consensus_or_protocol_data_contract_error( + DocumentTypesAreMissingError::new(data_contract_id).into(), + )); + } + for (name, schema) in document_schemas.into_iter() { let document_type = match platform_version .dpp @@ -32,7 +43,9 @@ impl DocumentTypeV0 { schema_defs, documents_keep_history_contract_default, documents_mutable_contract_default, - validate, + documents_can_be_deleted_contract_default, + full_validation, + validation_operations, platform_version, )?, version => { @@ -50,3 +63,41 @@ impl DocumentTypeV0 { Ok(contract_document_types) } } + +#[cfg(test)] +mod tests { + use super::*; + + use crate::consensus::basic::data_contract::DocumentTypesAreMissingError; + use crate::consensus::basic::BasicError; + use crate::consensus::ConsensusError; + use crate::data_contract::errors::DataContractError; + use assert_matches::assert_matches; + use platform_value::Identifier; + use std::ops::Deref; + + #[test] + pub fn should_not_allow_creating_document_types_with_empty_schema() { + let id = Identifier::random(); + + let result = DocumentType::create_document_types_from_document_schemas( + id, + Default::default(), + None, + false, + false, + false, + false, + &mut vec![], + PlatformVersion::latest(), + ); + + assert_matches!(result, Err(ProtocolError::ConsensusError(e)) => { + assert_matches!(e.deref(), ConsensusError::BasicError(BasicError::ContractError( + DataContractError::DocumentTypesAreMissingError( + DocumentTypesAreMissingError { .. } + ) + ))); + }); + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs index 169b5bedf9b..1a38953a784 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs @@ -1,2 +1,39 @@ +#[cfg(feature = "validation")] +use crate::consensus::basic::BasicError; +#[cfg(feature = "validation")] +use crate::consensus::ConsensusError; +use crate::data_contract::errors::DataContractError; +use crate::ProtocolError; + mod create_document_types_from_document_schemas; mod try_from_schema; + +#[inline] +fn consensus_or_protocol_data_contract_error( + data_contract_error: DataContractError, +) -> ProtocolError { + #[cfg(feature = "validation")] + { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ContractError(data_contract_error)).into(), + ) + } + #[cfg(not(feature = "validation"))] + { + ProtocolError::DataContractError(data_contract_error) + } +} + +#[inline] +fn consensus_or_protocol_value_error(platform_value_error: platform_value::Error) -> ProtocolError { + #[cfg(feature = "validation")] + { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ValueError(platform_value_error.into())).into(), + ) + } + #[cfg(not(feature = "validation"))] + { + ProtocolError::ValueError(platform_value_error.into()) + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs index c8935442564..d56fad8f84e 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::data_contract::document_type::DocumentType; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::{Identifier, Value}; use platform_version::version::PlatformVersion; @@ -15,7 +16,9 @@ impl DocumentType { schema_defs: Option<&BTreeMap>, default_keeps_history: bool, default_mutability: bool, - validate: bool, + default_can_be_deleted: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -32,7 +35,9 @@ impl DocumentType { schema_defs, default_keeps_history, default_mutability, - validate, + default_can_be_deleted, + full_validation, + validation_operations, platform_version, ) .map(|document_type| document_type.into()), diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs index ec06bff4366..82019a53e77 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs @@ -1,45 +1,73 @@ -use crate::data_contract::document_type::v0::DocumentTypeV0; #[cfg(feature = "validation")] -use crate::data_contract::document_type::v0::StatelessJsonSchemaLazyValidator; -use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashSet}; -use std::convert::TryInto; - use crate::consensus::basic::data_contract::{ DuplicateIndexNameError, InvalidIndexPropertyTypeError, InvalidIndexedPropertyConstraintError, SystemPropertyIndexAlreadyPresentError, UndefinedIndexPropertyError, UniqueIndicesLimitReachedError, }; +#[cfg(feature = "validation")] use crate::consensus::ConsensusError; use crate::data_contract::document_type::array::ArrayItemType; use crate::data_contract::document_type::index::Index; use crate::data_contract::document_type::index_level::IndexLevel; use crate::data_contract::document_type::property::{DocumentProperty, DocumentPropertyType}; #[cfg(feature = "validation")] -use crate::data_contract::document_type::schema::{ - byte_array_has_no_items_as_parent_validator, pattern_is_valid_regex_validator, - traversal_validator, validate_max_depth, -}; +use crate::data_contract::document_type::schema::validate_max_depth; +use crate::data_contract::document_type::v0::DocumentTypeV0; +#[cfg(feature = "validation")] +use crate::data_contract::document_type::v0::StatelessJsonSchemaLazyValidator; +use indexmap::IndexMap; +#[cfg(feature = "validation")] +use std::collections::HashSet; +use std::collections::{BTreeMap, BTreeSet}; +use std::convert::TryInto; +#[cfg(feature = "validation")] +use crate::consensus::basic::data_contract::ContestedUniqueIndexOnMutableDocumentTypeError; +#[cfg(feature = "validation")] +use crate::consensus::basic::data_contract::ContestedUniqueIndexWithUniqueIndexError; +#[cfg(any(test, feature = "validation"))] +use crate::consensus::basic::data_contract::InvalidDocumentTypeNameError; +#[cfg(feature = "validation")] use crate::consensus::basic::document::MissingPositionsInDocumentTypePropertiesError; +#[cfg(feature = "validation")] use crate::consensus::basic::BasicError; -use crate::data_contract::document_type::schema::enrich_with_base_schema; -use crate::data_contract::document_type::{property_names, DocumentType}; -use crate::data_contract::errors::{DataContractError, StructureError}; +use crate::data_contract::document_type::class_methods::{ + consensus_or_protocol_data_contract_error, consensus_or_protocol_value_error, +}; +use crate::data_contract::document_type::property_names::{ + CAN_BE_DELETED, CREATION_RESTRICTION_MODE, DOCUMENTS_KEEP_HISTORY, DOCUMENTS_MUTABLE, + TRADE_MODE, TRANSFERABLE, +}; +use crate::data_contract::document_type::{ + property_names, ByteArrayPropertySizes, DocumentType, StringPropertySizes, +}; +use crate::data_contract::errors::DataContractError; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; use crate::identity::SecurityLevel; use crate::util::json_schema::resolve_uri; #[cfg(feature = "validation")] use crate::validation::meta_validators::DOCUMENT_META_SCHEMA_V0; +use crate::validation::operations::ProtocolValidationOperation; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_value::btreemap_extensions::BTreeValueMapHelper; use platform_value::{Identifier, Value}; -const UNIQUE_INDEX_LIMIT_V0: usize = 16; const NOT_ALLOWED_SYSTEM_PROPERTIES: [&str; 1] = ["$id"]; -const SYSTEM_PROPERTIES: [&str; 4] = ["$id", "$ownerId", "$createdAt", "$updatedAt"]; +const SYSTEM_PROPERTIES: [&str; 11] = [ + "$id", + "$ownerId", + "$createdAt", + "$updatedAt", + "$transferredAt", + "$createdAtBlockHeight", + "$updatedAtBlockHeight", + "$transferredAtBlockHeight", + "$createdAtCoreBlockHeight", + "$updatedAtCoreBlockHeight", + "$transferredAtCoreBlockHeight", +]; const MAX_INDEXED_STRING_PROPERTY_LENGTH: u16 = 63; const MAX_INDEXED_BYTE_ARRAY_PROPERTY_LENGTH: u16 = 255; @@ -47,6 +75,7 @@ const MAX_INDEXED_ARRAY_ITEMS: usize = 1024; impl DocumentTypeV0 { // TODO: Split into multiple functions + #[allow(unused_variables)] pub(crate) fn try_from_schema_v0( data_contract_id: Identifier, name: &str, @@ -54,18 +83,22 @@ impl DocumentTypeV0 { schema_defs: Option<&BTreeMap>, default_keeps_history: bool, default_mutability: bool, - validate: bool, // we don't need to validate if loaded from state + default_can_be_deleted: bool, + full_validation: bool, // we don't need to validate if loaded from state + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { // Create a full root JSON Schema from shorten contract document type schema - let root_schema = enrich_with_base_schema( + let root_schema = DocumentType::enrich_with_base_schema( schema.clone(), schema_defs.map(|defs| Value::from(defs.clone())), platform_version, )?; #[cfg(not(feature = "validation"))] - if validate { + if full_validation { + // TODO we are silently dropping this error when we shouldn't be + // but returning this error causes tests to fail; investigate more. ProtocolError::CorruptedCodeExecution( "validation is not enabled but is being called on try_from_schema_v0".to_string(), ); @@ -75,22 +108,18 @@ impl DocumentTypeV0 { let json_schema_validator = StatelessJsonSchemaLazyValidator::new(); #[cfg(feature = "validation")] - if validate { - // Make sure JSON Schema is compilable - let root_json_schema = root_schema - .try_to_validating_json() - .map_err(ProtocolError::ValueError)?; - - json_schema_validator.compile(&root_json_schema, platform_version)?; - - // Validate against JSON Schema - DOCUMENT_META_SCHEMA_V0 - .validate( - &root_schema - .try_to_validating_json() - .map_err(ProtocolError::ValueError)?, - ) - .map_err(|mut errs| ConsensusError::from(errs.next().unwrap()))?; + if full_validation { + // Make sure a document type name is compliant + if !name + .chars() + .all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-') + || name.is_empty() + || name.len() > 64 + { + return Err(ProtocolError::ConsensusError(Box::new( + InvalidDocumentTypeNameError::new(name.to_string()).into(), + ))); + } // Validate document schema depth let mut result = validate_max_depth(&root_schema, platform_version)?; @@ -98,57 +127,102 @@ impl DocumentTypeV0 { if !result.is_valid() { let error = result.errors.remove(0); + let schema_size = result.into_data()?.size; + + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), + ); + return Err(ProtocolError::ConsensusError(Box::new(error))); } - // TODO: Are we still aiming to use RE2 with linear time complexity to protect from ReDoS attacks? - // If not we can remove this validation - // Validate reg exp compatibility with RE2 and byteArray usage - result.merge(traversal_validator( - &root_schema, - &[ - pattern_is_valid_regex_validator, - byte_array_has_no_items_as_parent_validator, - ], - platform_version, - )?); + let schema_size = result.into_data()?.size; - if !result.is_valid() { - let error = result.errors.remove(0); + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), + ); - return Err(ProtocolError::ConsensusError(Box::new(error))); - } + // Make sure JSON Schema is compilable + let root_json_schema = root_schema.try_to_validating_json().map_err(|e| { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ValueError(e.into())).into(), + ) + })?; + + // Validate against JSON Schema + DOCUMENT_META_SCHEMA_V0 + .validate(&root_json_schema) + .map_err(|mut errs| ConsensusError::from(errs.next().unwrap()))?; + + json_schema_validator.compile(&root_json_schema, platform_version)?; } + // This has already been validated, but we leave the map_err here for consistency let schema_map = schema.to_map().map_err(|err| { - ProtocolError::DataContractError(DataContractError::InvalidContractStructure(format!( - "document schema must be an object: {err}" - ))) + consensus_or_protocol_data_contract_error(DataContractError::InvalidContractStructure( + format!("document schema must be an object: {err}"), + )) })?; - // TODO: These properties aren't defined in JSON meta schema // Do documents of this type keep history? (Overrides contract value) let documents_keep_history: bool = - Value::inner_optional_bool_value(schema_map, "documentsKeepHistory") - .map_err(ProtocolError::ValueError)? + Value::inner_optional_bool_value(schema_map, DOCUMENTS_KEEP_HISTORY) + .map_err(consensus_or_protocol_value_error)? .unwrap_or(default_keeps_history); // Are documents of this type mutable? (Overrides contract value) let documents_mutable: bool = - Value::inner_optional_bool_value(schema_map, "documentsMutable") - .map_err(ProtocolError::ValueError)? + Value::inner_optional_bool_value(schema_map, DOCUMENTS_MUTABLE) + .map_err(consensus_or_protocol_value_error)? .unwrap_or(default_mutability); + // Can documents of this type be deleted? (Overrides contract value) + let documents_can_be_deleted: bool = + Value::inner_optional_bool_value(schema_map, CAN_BE_DELETED) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or(default_can_be_deleted); + + // Are documents of this type transferable? + let documents_transferable_u8: u8 = + Value::inner_optional_integer_value(schema_map, TRANSFERABLE) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or_default(); + + let documents_transferable = documents_transferable_u8.try_into()?; + + // What is the trade mode of these documents + let documents_trade_mode_u8: u8 = + Value::inner_optional_integer_value(schema_map, TRADE_MODE) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or_default(); + + let trade_mode = documents_trade_mode_u8.try_into()?; + + // What is the creation restriction mode of this document type? + let documents_creation_restriction_mode_u8: u8 = + Value::inner_optional_integer_value(schema_map, CREATION_RESTRICTION_MODE) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or_default(); + + let creation_restriction_mode = documents_creation_restriction_mode_u8.try_into()?; + // Extract the properties let property_values = Value::inner_optional_index_map::( schema_map, property_names::PROPERTIES, property_names::POSITION, - )? + ) + .map_err(consensus_or_protocol_value_error)? .unwrap_or_default(); #[cfg(feature = "validation")] - if validate { + if full_validation { + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation( + property_values.values().len() as u64, + ), + ); + // We should validate that the positions are continuous for (pos, value) in property_values.values().enumerate() { if value.get_integer::(property_names::POSITION)? != pos as u32 { @@ -177,6 +251,13 @@ impl DocumentTypeV0 { property_names::REQUIRED, ); + let transient_fields = Value::inner_recursive_optional_array_of_strings( + schema_map, + "".to_string(), + property_names::PROPERTIES, + property_names::TRANSIENT, + ); + // Based on the property name, determine the type for (property_key, property_value) in property_values { // TODO: It's very inefficient. It must be done in one iteration and flattened properties @@ -184,58 +265,155 @@ impl DocumentTypeV0 { insert_values( &mut flattened_document_properties, &required_fields, + &transient_fields, None, property_key.clone(), property_value, &root_schema, - )?; + ) + .map_err(consensus_or_protocol_data_contract_error)?; insert_values_nested( &mut document_properties, &required_fields, + &transient_fields, property_key, property_value, &root_schema, - )?; + ) + .map_err(consensus_or_protocol_data_contract_error)?; } // Initialize indices let index_values = - Value::inner_optional_array_slice_value(schema_map, property_names::INDICES)?; + Value::inner_optional_array_slice_value(schema_map, property_names::INDICES) + .map_err(consensus_or_protocol_value_error)?; + #[cfg(feature = "validation")] let mut index_names: HashSet = HashSet::new(); + #[cfg(feature = "validation")] let mut unique_indices_count = 0; - let indices: Vec = index_values + #[cfg(feature = "validation")] + let mut last_non_contested_unique_index_name: Option = None; + + #[cfg(feature = "validation")] + let mut last_contested_unique_index_name: Option = None; + + #[cfg(feature = "validation")] + let mut contested_indices_count = 0; + + let indices: BTreeMap = index_values .map(|index_values| { index_values .iter() .map(|index_value| { let index: Index = index_value - .as_map() - .ok_or(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "index definition is not a map as expected".to_string(), - ), - ))? + .to_map() + .map_err(consensus_or_protocol_value_error)? .as_slice() - .try_into()?; + .try_into() + .map_err(consensus_or_protocol_data_contract_error)?; #[cfg(feature = "validation")] - if validate { + if full_validation { + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaIndexValidation( + index.properties.len() as u64, + index.unique, + ), + ); + // Unique indices produces significant load on the system during state validation // so we need to limit their number to prevent of spikes and DoS attacks if index.unique { unique_indices_count += 1; - if unique_indices_count > UNIQUE_INDEX_LIMIT_V0 { + if unique_indices_count + > platform_version + .dpp + .validation + .document_type + .unique_index_limit + { return Err(ProtocolError::ConsensusError(Box::new( UniqueIndicesLimitReachedError::new( name.to_string(), - UNIQUE_INDEX_LIMIT_V0, + platform_version + .dpp + .validation + .document_type + .unique_index_limit, + false, + ) + .into(), + ))); + } + + if let Some(last_contested_unique_index_name) = + last_contested_unique_index_name.as_ref() + { + return Err(ProtocolError::ConsensusError(Box::new( + ContestedUniqueIndexWithUniqueIndexError::new( + name.to_string(), + last_contested_unique_index_name.clone(), + index.name, + ) + .into(), + ))); + } + + if index.contested_index.is_none() { + last_non_contested_unique_index_name = Some(index.name.clone()); + } + } + + if index.contested_index.is_some() { + contested_indices_count += 1; + if contested_indices_count + > platform_version + .dpp + .validation + .document_type + .contested_index_limit + { + return Err(ProtocolError::ConsensusError(Box::new( + UniqueIndicesLimitReachedError::new( + name.to_string(), + platform_version + .dpp + .validation + .document_type + .contested_index_limit, + true, + ) + .into(), + ))); + } + + if let Some(last_unique_index_name) = + last_non_contested_unique_index_name.as_ref() + { + return Err(ProtocolError::ConsensusError(Box::new( + ContestedUniqueIndexWithUniqueIndexError::new( + name.to_string(), + index.name, + last_unique_index_name.clone(), ) .into(), ))); } + + if documents_mutable { + return Err(ProtocolError::ConsensusError(Box::new( + ContestedUniqueIndexOnMutableDocumentTypeError::new( + name.to_string(), + index.name, + ) + .into(), + ))); + } + + last_contested_unique_index_name = Some(index.name.clone()); } // Index names must be unique for the document type @@ -278,7 +456,7 @@ impl DocumentTypeV0 { })?; // Validate indexed property type - match property_definition.property_type { + match &property_definition.property_type { // Array and objects aren't supported for indexing yet DocumentPropertyType::Array(_) | DocumentPropertyType::Object(_) @@ -294,9 +472,9 @@ impl DocumentTypeV0 { ))) } // Indexed byte array size must be limited - DocumentPropertyType::ByteArray(_, maybe_max_size) - if maybe_max_size.is_none() - || maybe_max_size.unwrap() + DocumentPropertyType::ByteArray(sizes) + if sizes.max_size.is_none() + || sizes.max_size.unwrap() > MAX_INDEXED_BYTE_ARRAY_PROPERTY_LENGTH => { Err(ProtocolError::ConsensusError(Box::new( @@ -314,9 +492,9 @@ impl DocumentTypeV0 { ))) } // Indexed string length must be limited - DocumentPropertyType::String(_, maybe_max_length) - if maybe_max_length.is_none() - || maybe_max_length.unwrap() + DocumentPropertyType::String(sizes) + if sizes.max_length.is_none() + || sizes.max_length.unwrap() > MAX_INDEXED_STRING_PROPERTY_LENGTH => { Err(ProtocolError::ConsensusError(Box::new( @@ -341,15 +519,15 @@ impl DocumentTypeV0 { })?; } - Ok(index) + Ok((index.name.clone(), index)) }) - .collect::, ProtocolError>>() + .collect::, ProtocolError>>() }) .transpose()? .unwrap_or_default(); let index_structure = - IndexLevel::try_from_indices(indices.as_slice(), name, platform_version)?; + IndexLevel::try_from_indices(indices.values(), name, platform_version)?; // Collect binary and identifier properties let (identifier_paths, binary_paths) = DocumentType::find_identifier_and_binary_paths( @@ -361,18 +539,21 @@ impl DocumentTypeV0 { )?; let security_level_requirement = schema - .get_optional_integer::(property_names::SECURITY_LEVEL_REQUIREMENT)? + .get_optional_integer::(property_names::SECURITY_LEVEL_REQUIREMENT) + .map_err(consensus_or_protocol_value_error)? .map(SecurityLevel::try_from) .transpose()? .unwrap_or(SecurityLevel::HIGH); let requires_identity_encryption_bounded_key = schema - .get_optional_integer::(property_names::REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY)? + .get_optional_integer::(property_names::REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY) + .map_err(consensus_or_protocol_value_error)? .map(StorageKeyRequirements::try_from) .transpose()?; let requires_identity_decryption_bounded_key = schema - .get_optional_integer::(property_names::REQUIRES_IDENTITY_DECRYPTION_BOUNDED_KEY)? + .get_optional_integer::(property_names::REQUIRES_IDENTITY_DECRYPTION_BOUNDED_KEY) + .map_err(consensus_or_protocol_value_error)? .map(StorageKeyRequirements::try_from) .transpose()?; @@ -386,8 +567,13 @@ impl DocumentTypeV0 { identifier_paths, binary_paths, required_fields, + transient_fields, documents_keep_history, documents_mutable, + documents_can_be_deleted, + documents_transferable, + trade_mode, + creation_restriction_mode, data_contract_id, requires_identity_encryption_bounded_key, requires_identity_decryption_bounded_key, @@ -401,11 +587,12 @@ impl DocumentTypeV0 { fn insert_values( document_properties: &mut IndexMap, known_required: &BTreeSet, + known_transient: &BTreeSet, prefix: Option, property_key: String, property_value: &Value, root_schema: &Value, -) -> Result<(), ProtocolError> { +) -> Result<(), DataContractError> { let mut to_visit: Vec<(Option, String, &Value)> = vec![(prefix, property_key, property_value)]; @@ -417,22 +604,16 @@ fn insert_values( let mut inner_properties = property_value.to_btree_ref_string_map()?; - if let Some(schema_ref) = inner_properties - .get_optional_str(property_names::REF) - .map_err(ProtocolError::ValueError)? - { - let referenced_sub_schema = resolve_uri(root_schema, schema_ref).map_err(|err| { - ProtocolError::Generic(format!("invalid schema reference url: {err}")) - })?; + if let Some(schema_ref) = inner_properties.get_optional_str(property_names::REF)? { + let referenced_sub_schema = resolve_uri(root_schema, schema_ref)?; inner_properties = referenced_sub_schema.to_btree_ref_string_map()? } - let type_value = inner_properties - .get_str(property_names::TYPE) - .map_err(ProtocolError::ValueError)?; + let type_value = inner_properties.get_str(property_names::TYPE)?; let is_required = known_required.contains(&prefixed_property_key); + let is_transient = known_transient.contains(&prefixed_property_key); let field_type: DocumentPropertyType; match type_value { @@ -445,32 +626,30 @@ fn insert_values( match inner_properties .get_optional_str(property_names::CONTENT_MEDIA_TYPE)? { - Some(content_media_type) - if content_media_type - == "application/x.dash.dpp.identifier" => - { + Some("application/x.dash.dpp.identifier") => { DocumentPropertyType::Identifier } - Some(_) | None => DocumentPropertyType::ByteArray( - inner_properties - .get_optional_integer(property_names::MIN_ITEMS)?, - inner_properties - .get_optional_integer(property_names::MAX_ITEMS)?, - ), + Some(_) | None => { + DocumentPropertyType::ByteArray(ByteArrayPropertySizes { + min_size: inner_properties + .get_optional_integer(property_names::MIN_ITEMS)?, + max_size: inner_properties + .get_optional_integer(property_names::MAX_ITEMS)?, + }) + } } } else { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "byteArray should always be true if defined".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "byteArray should always be true if defined".to_string(), )); } } - // TODO: Contract indices and new encoding format don't support arrays - // but we still can use them as document fields with current cbor encoding - // This is a temporary workaround to bring back v0.22 behavior and should be - // replaced with a proper array support in future versions - None => DocumentPropertyType::Array(ArrayItemType::Boolean), + // TODO: Update when arrays are implemented + None => { + return Err(DataContractError::InvalidContractStructure( + "only byte arrays are supported now".to_string(), + )); + } }; document_properties.insert( @@ -478,6 +657,7 @@ fn insert_values( DocumentProperty { property_type: field_type, required: is_required, + transient: is_transient, }, ); } @@ -487,16 +667,16 @@ fn insert_values( let properties = properties_as_value .as_map() - .ok_or(ProtocolError::StructureError( - StructureError::ValueWrongType("properties must be a map"), + .ok_or(DataContractError::ValueWrongType( + "properties must be a map".to_string(), ))?; for (object_property_key, object_property_value) in properties.iter() { let object_property_string = object_property_key .as_text() - .ok_or(ProtocolError::StructureError(StructureError::KeyWrongType( - "property key must be a string", - )))? + .ok_or(DataContractError::KeyWrongType( + "property key must be a string".to_string(), + ))? .to_string(); to_visit.push(( Some(prefixed_property_key.clone()), @@ -508,15 +688,18 @@ fn insert_values( } "string" => { - field_type = DocumentPropertyType::String( - inner_properties.get_optional_integer(property_names::MIN_LENGTH)?, - inner_properties.get_optional_integer(property_names::MAX_LENGTH)?, - ); + field_type = DocumentPropertyType::String(StringPropertySizes { + min_length: inner_properties + .get_optional_integer(property_names::MIN_LENGTH)?, + max_length: inner_properties + .get_optional_integer(property_names::MAX_LENGTH)?, + }); document_properties.insert( prefixed_property_key, DocumentProperty { property_type: field_type, required: is_required, + transient: is_transient, }, ); } @@ -529,6 +712,7 @@ fn insert_values( DocumentProperty { property_type: field_type, required: is_required, + transient: is_transient, }, ); } @@ -540,68 +724,56 @@ fn insert_values( fn insert_values_nested( document_properties: &mut IndexMap, known_required: &BTreeSet, + known_transient: &BTreeSet, property_key: String, property_value: &Value, root_schema: &Value, -) -> Result<(), ProtocolError> { +) -> Result<(), DataContractError> { let mut inner_properties = property_value.to_btree_ref_string_map()?; - if let Some(schema_ref) = inner_properties - .get_optional_str(property_names::REF) - .map_err(ProtocolError::ValueError)? - { - let referenced_sub_schema = resolve_uri(root_schema, schema_ref).map_err(|err| { - ProtocolError::Generic(format!("invalid schema reference url: {err}")) - })?; + if let Some(schema_ref) = inner_properties.get_optional_str(property_names::REF)? { + let referenced_sub_schema = resolve_uri(root_schema, schema_ref)?; inner_properties = referenced_sub_schema.to_btree_ref_string_map()?; } - let type_value = inner_properties - .get_str(property_names::TYPE) - .map_err(ProtocolError::ValueError)?; + let type_value = inner_properties.get_str(property_names::TYPE)?; let is_required = known_required.contains(&property_key); - let field_type: DocumentPropertyType; + let is_transient = known_transient.contains(&property_key); - match type_value { - "integer" => { - field_type = DocumentPropertyType::Integer; - } - "number" => { - field_type = DocumentPropertyType::Number; - } - "string" => { - field_type = DocumentPropertyType::String( - inner_properties.get_optional_integer(property_names::MIN_LENGTH)?, - inner_properties.get_optional_integer(property_names::MAX_LENGTH)?, - ); - } + let field_type = match type_value { + "integer" => DocumentPropertyType::I64, + "number" => DocumentPropertyType::F64, + "string" => DocumentPropertyType::String(StringPropertySizes { + min_length: inner_properties.get_optional_integer(property_names::MIN_LENGTH)?, + max_length: inner_properties.get_optional_integer(property_names::MAX_LENGTH)?, + }), "array" => { // Only handling bytearrays for v1 // Return an error if it is not a byte array - field_type = match inner_properties.get_optional_bool(property_names::BYTE_ARRAY)? { + match inner_properties.get_optional_bool(property_names::BYTE_ARRAY)? { Some(inner_bool) => { if inner_bool { match inner_properties .get_optional_str(property_names::CONTENT_MEDIA_TYPE)? { - Some(content_media_type) - if content_media_type == "application/x.dash.dpp.identifier" => - { + Some("application/x.dash.dpp.identifier") => { DocumentPropertyType::Identifier } - Some(_) | None => DocumentPropertyType::ByteArray( - inner_properties.get_optional_integer(property_names::MIN_ITEMS)?, - inner_properties.get_optional_integer(property_names::MAX_ITEMS)?, - ), + Some(_) | None => { + DocumentPropertyType::ByteArray(ByteArrayPropertySizes { + min_size: inner_properties + .get_optional_integer(property_names::MIN_ITEMS)?, + max_size: inner_properties + .get_optional_integer(property_names::MAX_ITEMS)?, + }) + } } } else { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "byteArray should always be true if defined".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "byteArray should always be true if defined".to_string(), )); } } @@ -610,7 +782,7 @@ fn insert_values_nested( // This is a temporary workaround to bring back v0.22 behavior and should be // replaced with a proper array support in future versions None => DocumentPropertyType::Array(ArrayItemType::Boolean), - }; + } } "object" => { let mut nested_properties = IndexMap::new(); @@ -618,8 +790,8 @@ fn insert_values_nested( let properties = properties_as_value .as_map() - .ok_or(ProtocolError::StructureError( - StructureError::ValueWrongType("properties must be a map"), + .ok_or(DataContractError::ValueWrongType( + "properties must be a map".to_string(), ))?; let mut sorted_properties: Vec<_> = properties.iter().collect(); @@ -646,45 +818,245 @@ fn insert_values_nested( }) .collect(); + let stripped_transient: BTreeSet = known_transient + .iter() + .filter_map(|key| { + if key.starts_with(&property_key) && key.len() > property_key.len() { + Some(key[property_key.len() + 1..].to_string()) + } else { + None + } + }) + .collect(); + for (object_property_key, object_property_value) in properties.iter() { let object_property_string = object_property_key .as_text() - .ok_or(ProtocolError::StructureError(StructureError::KeyWrongType( - "property key must be a string", - )))? + .ok_or(DataContractError::KeyWrongType( + "property key must be a string".to_string(), + ))? .to_string(); insert_values_nested( &mut nested_properties, &stripped_required, + &stripped_transient, object_property_string, object_property_value, root_schema, )?; } } - field_type = DocumentPropertyType::Object(nested_properties); document_properties.insert( property_key, DocumentProperty { - property_type: field_type, + property_type: DocumentPropertyType::Object(nested_properties), required: is_required, + transient: is_transient, }, ); return Ok(()); } - _ => { - field_type = DocumentPropertyType::try_from_name(type_value)?; - } - } + _ => DocumentPropertyType::try_from_name(type_value)?, + }; document_properties.insert( property_key, DocumentProperty { property_type: field_type, required: is_required, + transient: is_transient, }, ); Ok(()) } + +#[cfg(test)] +mod tests { + use super::*; + use assert_matches::assert_matches; + use platform_value::platform_value; + + mod document_type_name { + use super::*; + + #[test] + fn should_be_valid() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let _result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "valid_name-a-b-123", + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ) + .expect("should be valid"); + } + + #[test] + fn should_no_be_empty() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "", + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + } + + #[test] + fn should_no_be_longer_than_64_chars() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + &"a".repeat(65), + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + } + + #[test] + fn should_no_be_alphanumeric() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "invalid name", + schema.clone(), + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "invalid&name", + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/index/mod.rs b/packages/rs-dpp/src/data_contract/document_type/index/mod.rs index 21db11aba41..a8768ed8f5d 100644 --- a/packages/rs-dpp/src/data_contract/document_type/index/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/index/mod.rs @@ -1,30 +1,271 @@ -use serde::{Deserialize, Serialize}; +#[cfg(feature = "index-serde-conversion")] +use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; -#[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Eq)] +#[derive(Debug, PartialEq, PartialOrd, Clone, Eq)] +#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))] pub enum OrderBy { - #[serde(rename = "asc")] + #[cfg_attr(feature = "index-serde-conversion", serde(rename = "asc"))] Asc, - #[serde(rename = "desc")] + #[cfg_attr(feature = "index-serde-conversion", serde(rename = "desc"))] Desc, } -use crate::data_contract::errors::{DataContractError, StructureError}; +use crate::data_contract::errors::DataContractError; use crate::ProtocolError; use anyhow::anyhow; +use crate::data_contract::document_type::ContestedIndexResolution::MasternodeVote; +use crate::data_contract::errors::DataContractError::RegexError; use platform_value::{Value, ValueMap}; use rand::distributions::{Alphanumeric, DistString}; +use regex::Regex; +#[cfg(feature = "index-serde-conversion")] +use serde::de::{VariantAccess, Visitor}; +use std::cmp::Ordering; +#[cfg(feature = "index-serde-conversion")] +use std::fmt; use std::{collections::BTreeMap, convert::TryFrom}; pub mod random_index; +#[repr(u8)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)] +#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))] +pub enum ContestedIndexResolution { + MasternodeVote = 0, +} + +impl TryFrom for ContestedIndexResolution { + type Error = ProtocolError; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(MasternodeVote), + value => Err(ProtocolError::UnknownStorageKeyRequirements(format!( + "contested index resolution unknown: {}", + value + ))), + } + } +} + +#[repr(u8)] +#[derive(Debug)] +pub enum ContestedIndexFieldMatch { + Regex(regex::Regex), + PositiveIntegerMatch(u128), +} + +#[cfg(feature = "index-serde-conversion")] +impl Serialize for ContestedIndexFieldMatch { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + ContestedIndexFieldMatch::Regex(ref regex) => serializer.serialize_newtype_variant( + "ContestedIndexFieldMatch", + 0, + "Regex", + regex.as_str(), + ), + ContestedIndexFieldMatch::PositiveIntegerMatch(ref num) => serializer + .serialize_newtype_variant( + "ContestedIndexFieldMatch", + 1, + "PositiveIntegerMatch", + num, + ), + } + } +} + +#[cfg(feature = "index-serde-conversion")] +impl<'de> Deserialize<'de> for ContestedIndexFieldMatch { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + #[derive(Deserialize)] + #[serde(field_identifier, rename_all = "snake_case")] + enum Field { + Regex, + PositiveIntegerMatch, + } + + struct FieldVisitor; + + impl<'de> Visitor<'de> for FieldVisitor { + type Value = Field; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("`regex` or `positive_integer_match`") + } + + fn visit_str(self, value: &str) -> Result + where + E: de::Error, + { + match value { + "regex" => Ok(Field::Regex), + "positive_integer_match" => Ok(Field::PositiveIntegerMatch), + _ => Err(de::Error::unknown_variant( + value, + &["regex", "positive_integer_match"], + )), + } + } + } + + struct ContestedIndexFieldMatchVisitor; + + impl<'de> Visitor<'de> for ContestedIndexFieldMatchVisitor { + type Value = ContestedIndexFieldMatch; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("enum ContestedIndexFieldMatch") + } + + fn visit_enum(self, visitor: V) -> Result + where + V: de::EnumAccess<'de>, + { + match visitor.variant()? { + (Field::Regex, v) => { + let regex_str: &str = v.newtype_variant()?; + Regex::new(regex_str) + .map(ContestedIndexFieldMatch::Regex) + .map_err(de::Error::custom) + } + (Field::PositiveIntegerMatch, v) => { + let num: u128 = v.newtype_variant()?; + Ok(ContestedIndexFieldMatch::PositiveIntegerMatch(num)) + } + } + } + } + + deserializer.deserialize_enum( + "ContestedIndexFieldMatch", + &["regex", "positive_integer_match"], + ContestedIndexFieldMatchVisitor, + ) + } +} + +impl PartialOrd for ContestedIndexFieldMatch { + fn partial_cmp(&self, other: &Self) -> Option { + use ContestedIndexFieldMatch::*; + match (self, other) { + // Comparing two integers + (PositiveIntegerMatch(a), PositiveIntegerMatch(b)) => a.partial_cmp(b), + + // Arbitrarily decide that any Regex is less than any PositiveIntegerMatch + (Regex(_), PositiveIntegerMatch(_)) => Some(Ordering::Less), + (PositiveIntegerMatch(_), Regex(_)) => Some(Ordering::Greater), + + // Comparing Regex with Regex, perhaps based on pattern length + (Regex(a), Regex(b)) => a.as_str().len().partial_cmp(&b.as_str().len()), + } + } +} + +impl Ord for ContestedIndexFieldMatch { + fn cmp(&self, other: &Self) -> Ordering { + use ContestedIndexFieldMatch::*; + match (self, other) { + // Directly compare integers + (PositiveIntegerMatch(a), PositiveIntegerMatch(b)) => a.cmp(b), + + // Compare Regex based on pattern string length + (Regex(a), Regex(b)) => a.as_str().len().cmp(&b.as_str().len()), + + // Regex is considered less than a positive integer + (Regex(_), PositiveIntegerMatch(_)) => Ordering::Less, + (PositiveIntegerMatch(_), Regex(_)) => Ordering::Greater, + } + } +} + +impl Clone for ContestedIndexFieldMatch { + fn clone(&self) -> Self { + match self { + ContestedIndexFieldMatch::Regex(regex) => { + ContestedIndexFieldMatch::Regex(regex::Regex::new(regex.as_str()).unwrap()) + } + ContestedIndexFieldMatch::PositiveIntegerMatch(int) => { + ContestedIndexFieldMatch::PositiveIntegerMatch(*int) + } + } + } +} + +impl PartialEq for ContestedIndexFieldMatch { + fn eq(&self, other: &Self) -> bool { + match self { + ContestedIndexFieldMatch::Regex(regex) => match other { + ContestedIndexFieldMatch::Regex(other_regex) => { + regex.as_str() == other_regex.as_str() + } + _ => false, + }, + ContestedIndexFieldMatch::PositiveIntegerMatch(int) => match other { + ContestedIndexFieldMatch::PositiveIntegerMatch(other_int) => int == other_int, + _ => false, + }, + } + } +} + +impl Eq for ContestedIndexFieldMatch {} + +impl ContestedIndexFieldMatch { + pub fn matches(&self, value: &Value) -> bool { + match self { + ContestedIndexFieldMatch::Regex(regex) => { + if let Some(string) = value.as_str() { + regex.is_match(string) + } else { + false + } + } + ContestedIndexFieldMatch::PositiveIntegerMatch(int) => value + .as_integer::() + .map(|i| i == *int) + .unwrap_or(false), + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Ord, PartialOrd)] +#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))] +pub struct ContestedIndexInformation { + pub field_matches: BTreeMap, + pub resolution: ContestedIndexResolution, +} + +impl Default for ContestedIndexInformation { + fn default() -> Self { + ContestedIndexInformation { + field_matches: BTreeMap::new(), + resolution: ContestedIndexResolution::MasternodeVote, + } + } +} + // Indices documentation: https://dashplatform.readme.io/docs/reference-data-contracts#document-indices -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))] pub struct Index { pub name: String, pub properties: Vec, pub unique: bool, + /// Null searchable indicates what to do if all members of the index are null + /// If this is set to false then we do not insert references which makes such items non-searchable + pub null_searchable: bool, + /// Contested indexes are useful when a resource is considered valuable + pub contested_index: Option, } impl Index { @@ -51,9 +292,18 @@ impl Index { .map(|property| property.name.clone()) .collect() } + + /// Get values + pub fn extract_values(&self, data: &BTreeMap) -> Vec { + self.properties + .iter() + .map(|property| data.get(&property.name).cloned().unwrap_or(Value::Null)) + .collect() + } } -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)] +#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))] pub struct IndexProperty { pub name: String, pub ascending: bool, @@ -174,7 +424,7 @@ impl Index { } impl TryFrom<&[(Value, Value)]> for Index { - type Error = ProtocolError; + type Error = DataContractError; fn try_from(index_type_value_map: &[(Value, Value)]) -> Result { // Decouple the map @@ -184,24 +434,24 @@ impl TryFrom<&[(Value, Value)]> for Index { // For properties, we iterate each and move it to IndexProperty let mut unique = false; + // The default for null searchable should be true. Do not change this without very + // careful thought and consideration. + let mut null_searchable = true; let mut name = None; + let mut contested_index = None; let mut index_properties: Vec = Vec::new(); for (key_value, value_value) in index_type_value_map { - let key = key_value.to_str().map_err(ProtocolError::ValueError)?; + let key = key_value.to_str()?; match key { "name" => { name = Some( value_value .as_text() - .ok_or({ - ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "index name should be a string".to_string(), - ), - ) - })? + .ok_or(DataContractError::InvalidContractStructure( + "index name should be a string".to_string(), + ))? .to_owned(), ); } @@ -210,40 +460,139 @@ impl TryFrom<&[(Value, Value)]> for Index { unique = value_value.as_bool().expect("confirmed as bool"); } } + "nullSearchable" => { + if value_value.is_bool() { + null_searchable = value_value.as_bool().expect("confirmed as bool"); + } + } + "contested" => { + let contested_properties_value_map = value_value.to_map()?; + + let mut contested_index_information = ContestedIndexInformation::default(); + + for (contested_key_value, contested_value) in contested_properties_value_map { + let contested_key = contested_key_value + .to_str() + .map_err(|e| DataContractError::ValueDecodingError(e.to_string()))?; + match contested_key { + "fieldMatches" => { + let field_matches_array = contested_value.to_array_ref()?; + for field_match in field_matches_array { + let field_match_map = field_match.to_map()?; + let mut name = None; + let mut field_matches = None; + for (field_match_key_as_value, field_match_value) in + field_match_map + { + let field_match_key = + field_match_key_as_value.to_str().map_err(|e| { + DataContractError::ValueDecodingError(e.to_string()) + })?; + match field_match_key { + "field" => { + let field = field_match_value.to_str()?.to_owned(); + name = Some(field); + } + "regexPattern" => { + let regex = field_match_value.to_str()?.to_owned(); + field_matches = + Some(ContestedIndexFieldMatch::Regex( + Regex::new(®ex).map_err(|e| { + RegexError(format!( + "invalid field match regex: {}", + e.to_string() + )) + })?, + )); + } + key => { + return Err(DataContractError::ValueWrongType( + format!("unexpected field match key {}", key), + )); + } + } + } + if name.is_none() { + return Err(DataContractError::FieldRequirementUnmet( + format!( + "field not present in contested fieldMatches {}", + key + ), + )); + } + if field_matches.is_none() { + return Err(DataContractError::FieldRequirementUnmet( + format!( + "field not present in contested fieldMatches {}", + key + ), + )); + } + contested_index_information + .field_matches + .insert(name.unwrap(), field_matches.unwrap()); + } + } + "resolution" => { + let resolution_int = contested_value.to_integer::()?; + contested_index_information.resolution = + resolution_int.try_into().map_err(|e: ProtocolError| { + DataContractError::ValueWrongType(e.to_string()) + })?; + } + "description" => {} + key => { + return Err(DataContractError::ValueWrongType(format!( + "unexpected contested key {}", + key + ))); + } + } + } + contested_index = Some(contested_index_information); + } "properties" => { let properties = - value_value.as_array().ok_or(ProtocolError::StructureError( - StructureError::ValueWrongType("properties value should be an array"), - ))?; + value_value + .as_array() + .ok_or(DataContractError::ValueWrongType( + "properties value should be an array".to_string(), + ))?; // Iterate over this and get the index properties for property in properties { - let property_map = property.as_map().ok_or( - ProtocolError::StructureError(StructureError::ValueWrongType( - "each property of an index should be a map", - )), - )?; + let property_map = + property.as_map().ok_or(DataContractError::ValueWrongType( + "each property of an index should be a map".to_string(), + ))?; let index_property = IndexProperty::from_platform_value(property_map)?; index_properties.push(index_property); } } _ => { - return Err(ProtocolError::StructureError( - StructureError::ValueWrongType("unexpected property name"), + return Err(DataContractError::ValueWrongType( + "unexpected property name".to_string(), )) } } } + if contested_index.is_some() && !unique { + return Err(DataContractError::InvalidContractStructure( + "contest supported only for unique indexes".to_string(), + )); + } + // if the index didn't have a name let's make one - //todo: we should remove the name altogether let name = name.unwrap_or_else(|| Alphanumeric.sample_string(&mut rand::thread_rng(), 24)); Ok(Index { name, properties: index_properties, unique, + null_searchable, + contested_index, }) } } @@ -251,20 +600,20 @@ impl TryFrom<&[(Value, Value)]> for Index { impl IndexProperty { pub fn from_platform_value( index_property_map: &[(Value, Value)], - ) -> Result { + ) -> Result { let property = &index_property_map[0]; let key = property .0 // key .as_text() - .ok_or(ProtocolError::DataContractError( - DataContractError::KeyWrongType("key should be of type string"), + .ok_or(DataContractError::KeyWrongType( + "key should be of type string".to_string(), ))?; let value = property .1 // value .as_text() - .ok_or(ProtocolError::DataContractError( - DataContractError::ValueWrongType("value should be of type string"), + .ok_or(DataContractError::ValueWrongType( + "value should be of type string".to_string(), ))?; let ascending = value == "asc"; diff --git a/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs b/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs index 269fa14ac20..bad9be1a883 100644 --- a/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs +++ b/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs @@ -3,13 +3,18 @@ use crate::ProtocolError; use rand::prelude::StdRng; use rand::seq::SliceRandom; use rand::Rng; +use std::borrow::Borrow; impl Index { - pub fn random( + pub fn random( field_names: &[String], - existing_indices: &[Index], + existing_indices: I, rng: &mut StdRng, - ) -> Result { + ) -> Result + where + I: Clone + IntoIterator, // T is the type of elements in the collection + T: Borrow, // Assuming Index is the type stored in the collection + { let index_name = format!("index_{}", rng.gen::()); let mut properties; @@ -27,13 +32,14 @@ impl Index { .drain(..) .map(|field_name| IndexProperty { name: field_name, - ascending: rng.gen(), + ascending: true, }) .collect::>(); if !existing_indices - .iter() - .any(|index| index.properties == properties) + .clone() + .into_iter() + .any(|index| index.borrow().properties == properties) { break; } @@ -52,6 +58,8 @@ impl Index { name: index_name, properties, unique, + null_searchable: true, + contested_index: None, }) } } diff --git a/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs b/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs index 036eb13faba..e2c6a132750 100644 --- a/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs @@ -1,17 +1,60 @@ +#[cfg(feature = "validation")] +use crate::consensus::basic::data_contract::DataContractInvalidIndexDefinitionUpdateError; use crate::consensus::basic::data_contract::DuplicateIndexError; use crate::consensus::basic::BasicError; use crate::consensus::ConsensusError; +use crate::data_contract::document_type::index_level::IndexType::{ + ContestedResourceIndex, NonUniqueIndex, UniqueIndex, +}; use crate::data_contract::document_type::Index; +#[cfg(feature = "validation")] +use crate::validation::SimpleConsensusValidationResult; use crate::version::PlatformVersion; use crate::ProtocolError; +use std::borrow::Borrow; use std::collections::BTreeMap; +#[derive(Debug, PartialEq, Copy, Clone)] +pub enum IndexType { + /// A normal non unique index + NonUniqueIndex, + /// A unique index, that means that the values for this index are unique + /// As long as one of the values is not nil + UniqueIndex, + /// A contested resource: This is a unique index but that can be contested through a resolution + /// The simplest to understand resolution is a masternode votes, but could also be something + /// like a bidding war. + /// For example the path/name in the dpns contract must be unique but it is a contested potentially + /// valuable resource. + ContestedResourceIndex, +} + +#[derive(Debug, PartialEq, Copy, Clone)] +pub struct IndexLevelTypeInfo { + /// should we insert if all fields up to here are null + pub should_insert_with_all_null: bool, + /// The index type + pub index_type: IndexType, +} + +impl IndexType { + pub fn is_unique(&self) -> bool { + match self { + NonUniqueIndex => false, + UniqueIndex => true, + ContestedResourceIndex => true, + } + } +} + +pub type ShouldInsertWithAllNull = bool; + #[derive(Debug, PartialEq, Clone)] pub struct IndexLevel { /// the lower index levels from this level sub_index_levels: BTreeMap, /// did an index terminate at this level - has_index_with_uniqueness: Option, + has_index_with_type: Option, /// unique level identifier level_identifier: u64, } @@ -25,8 +68,8 @@ impl IndexLevel { &self.sub_index_levels } - pub fn has_index_with_uniqueness(&self) -> Option { - self.has_index_with_uniqueness + pub fn has_index_with_type(&self) -> Option { + self.has_index_with_type } /// Checks whether the given `rhs` IndexLevel is a subset of the current IndexLevel (`self`). @@ -84,11 +127,15 @@ impl IndexLevel { None } - pub fn try_from_indices( - indices: &[Index], + pub fn try_from_indices( + indices: I, document_type_name: &str, // TODO: We shouldn't pass document type, it's only for errors platform_version: &PlatformVersion, - ) -> Result { + ) -> Result + where + I: IntoIterator, // T is the type of elements in the collection + T: Borrow, // Assuming Index is the type stored in the collection + { match platform_version .dpp .contract_versions @@ -105,19 +152,24 @@ impl IndexLevel { } } - fn try_from_indices_v0( - indices: &[Index], + fn try_from_indices_v0( + indices: I, document_type_name: &str, - ) -> Result { + ) -> Result + where + I: IntoIterator, // T is the type of elements in the collection + T: Borrow, // Assuming Index is the type stored in the collection + { let mut index_level = IndexLevel { sub_index_levels: Default::default(), - has_index_with_uniqueness: None, + has_index_with_type: None, level_identifier: 0, }; let mut counter: u64 = 0; - for index in indices { + for index_to_borrow in indices { + let index = index_to_borrow.borrow(); let mut current_level = &mut index_level; let mut properties_iter = index.properties.iter().peekable(); @@ -130,7 +182,7 @@ impl IndexLevel { IndexLevel { level_identifier: counter, sub_index_levels: Default::default(), - has_index_with_uniqueness: None, + has_index_with_type: None, } }); @@ -140,7 +192,7 @@ impl IndexLevel { // It means there are two indices with the same combination of properties. // We might need to take into account the sorting order when we have it - if current_level.has_index_with_uniqueness.is_some() { + if current_level.has_index_with_type.is_some() { // an index already exists return error return Err(ConsensusError::BasicError(BasicError::DuplicateIndexError( DuplicateIndexError::new( @@ -151,11 +203,311 @@ impl IndexLevel { .into()); } - current_level.has_index_with_uniqueness = Some(index.unique); + let index_type = if index.unique { + UniqueIndex + } else { + NonUniqueIndex + }; + + // if things are null searchable that means we should insert with all null + + current_level.has_index_with_type = Some(IndexLevelTypeInfo { + should_insert_with_all_null: index.null_searchable, + index_type, + }); } } } Ok(index_level) } + + #[cfg(feature = "validation")] + pub fn validate_update( + &self, + document_type_name: &str, + new_indices: &Self, + ) -> SimpleConsensusValidationResult { + // There is no changes. All good + if self == new_indices { + return SimpleConsensusValidationResult::new(); + } + + // We do not allow any index modifications now, but we want to figure out + // what changed, so we compare one way then the other + + // If the new contract document type doesn't contain all previous indexes + if let Some(non_subset_path) = new_indices.contains_subset_first_non_subset_path(self) { + return SimpleConsensusValidationResult::new_with_error( + DataContractInvalidIndexDefinitionUpdateError::new( + document_type_name.to_string(), + non_subset_path, + ) + .into(), + ); + } + + // If the old contract document type doesn't contain all new indexes + if let Some(non_subset_path) = self.contains_subset_first_non_subset_path(new_indices) { + return SimpleConsensusValidationResult::new_with_error( + DataContractInvalidIndexDefinitionUpdateError::new( + document_type_name.to_string(), + non_subset_path, + ) + .into(), + ); + } + + SimpleConsensusValidationResult::new() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::data_contract::document_type::IndexProperty; + use assert_matches::assert_matches; + + #[test] + fn should_pass_if_indices_are_the_same() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = old_index_structure.clone(); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert!(result.is_valid()); + } + + #[test] + fn should_pass_if_new_index_with_only_new_field_is_add() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }]; + + let new_indices = vec![ + Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }, + Index { + name: "test2".to_string(), + properties: vec![IndexProperty { + name: "test2".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }, + ]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test2" + ); + } + + #[test] + fn should_return_invalid_result_if_some_indices_are_removed() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![ + Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }, + Index { + name: "test2".to_string(), + properties: vec![IndexProperty { + name: "test2".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }, + ]; + + let new_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test2" + ); + } + + #[test] + fn should_return_invalid_result_if_additional_property_is_added_to_existing_index() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }]; + + let new_indices = vec![Index { + name: "test".to_string(), + properties: vec![ + IndexProperty { + name: "test".to_string(), + ascending: false, + }, + IndexProperty { + name: "test2".to_string(), + ascending: false, + }, + ], + unique: false, + null_searchable: true, + contested_index: None, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test -> test2" + ); + } + + #[test] + fn should_return_invalid_result_if_property_is_removed_to_existing_index() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![ + IndexProperty { + name: "test".to_string(), + ascending: false, + }, + IndexProperty { + name: "test2".to_string(), + ascending: false, + }, + ], + unique: false, + null_searchable: true, + contested_index: None, + }]; + + let new_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + null_searchable: true, + contested_index: None, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test -> test2" + ); + } } diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_and_revision_for_identity_id/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/contested_vote_poll_for_document/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/verify/identity/verify_identity_balance_and_revision_for_identity_id/mod.rs rename to packages/rs-dpp/src/data_contract/document_type/methods/contested_vote_poll_for_document/mod.rs diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/contested_vote_poll_for_document/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/contested_vote_poll_for_document/v0/mod.rs new file mode 100644 index 00000000000..d8f419a1a43 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/contested_vote_poll_for_document/v0/mod.rs @@ -0,0 +1,41 @@ +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::v0::DocumentTypeV0; +use crate::document::{Document, DocumentV0Getters}; +use crate::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use crate::voting::vote_polls::VotePoll; + +impl DocumentTypeV0 { + /// Figures out the prefunded voting balance (v0) for a document in a document type + pub(in crate::data_contract::document_type) fn contested_vote_poll_for_document_v0( + &self, + document: &Document, + ) -> Option { + self.indexes() + .values() + .find(|index| { + if let Some(contested_index_info) = &index.contested_index { + contested_index_info + .field_matches + .iter() + .all(|(field, field_match)| { + if let Some(value) = document.get(field) { + field_match.matches(value) + } else { + false + } + }) + } else { + false + } + }) + .map(|index| { + let index_values = index.extract_values(document.properties()); + VotePoll::ContestedDocumentResourceVotePoll(ContestedDocumentResourceVotePoll { + contract_id: self.data_contract_id, + document_type_name: self.name.clone(), + index_name: index.name.clone(), + index_values, + }) + }) + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs index ae392b645da..3242e1db19c 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs @@ -1,8 +1,14 @@ use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::data_contract::document_type::property_names::{CREATED_AT, UPDATED_AT}; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::v0::DocumentTypeV0; +use crate::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; use crate::document::{Document, DocumentV0, INITIAL_REVISION}; use crate::identity::TimestampMillis; +use crate::prelude::{BlockHeight, CoreBlockHeight}; use crate::version::PlatformVersion; use crate::ProtocolError; use chrono::Utc; @@ -14,6 +20,8 @@ impl DocumentTypeV0 { &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result { @@ -24,7 +32,7 @@ impl DocumentTypeV0 { &document_entropy, ); - let revision = if self.documents_mutable() { + let revision = if self.requires_revision() { Some(INITIAL_REVISION) } else { None @@ -40,11 +48,58 @@ impl DocumentTypeV0 { .get_optional_integer(UPDATED_AT) .map_err(ProtocolError::ValueError)?; + let mut transferred_at: Option = data + .get_optional_integer(TRANSFERRED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_block_height: Option = data + .get_optional_integer(CREATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_block_height: Option = data + .get_optional_integer(UPDATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_block_height: Option = data + .get_optional_integer(TRANSFERRED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_core_block_height: Option = data + .get_optional_integer(CREATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_core_block_height: Option = data + .get_optional_integer(UPDATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_core_block_height: Option = data + .get_optional_integer(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + let is_created_at_required = self.required_fields().contains(CREATED_AT); let is_updated_at_required = self.required_fields().contains(UPDATED_AT); + let is_transferred_at_required = self.required_fields().contains(TRANSFERRED_AT); + + let is_created_at_block_height_required = + self.required_fields().contains(CREATED_AT_BLOCK_HEIGHT); + let is_updated_at_block_height_required = + self.required_fields().contains(UPDATED_AT_BLOCK_HEIGHT); + let is_transferred_at_block_height_required = + self.required_fields().contains(TRANSFERRED_AT_BLOCK_HEIGHT); + + let is_created_at_core_block_height_required = self + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT); + let is_updated_at_core_block_height_required = self + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT); + let is_transferred_at_core_block_height_required = self + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT); if (is_created_at_required && created_at.is_none()) - || (is_updated_at_required && updated_at.is_none()) + || (is_updated_at_required && updated_at.is_none() + || (is_transferred_at_required && transferred_at.is_none())) { //we want only one call to get current time let now = Utc::now().timestamp_millis() as TimestampMillis; @@ -56,6 +111,35 @@ impl DocumentTypeV0 { if is_updated_at_required { updated_at = updated_at.or(Some(now)); }; + + if is_transferred_at_required { + transferred_at = transferred_at.or(Some(now)); + }; + }; + + if is_created_at_block_height_required { + created_at_block_height = created_at_block_height.or(Some(block_height)); + }; + + if is_updated_at_block_height_required { + updated_at_block_height = updated_at_block_height.or(Some(block_height)); + }; + + if is_transferred_at_block_height_required { + transferred_at_block_height = transferred_at_block_height.or(Some(block_height)); + }; + + if is_created_at_core_block_height_required { + created_at_core_block_height = created_at_core_block_height.or(Some(core_block_height)); + }; + + if is_updated_at_core_block_height_required { + updated_at_core_block_height = updated_at_core_block_height.or(Some(core_block_height)); + }; + + if is_transferred_at_core_block_height_required { + transferred_at_core_block_height = + transferred_at_core_block_height.or(Some(core_block_height)); }; match platform_version @@ -73,6 +157,13 @@ impl DocumentTypeV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }; document diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs index a24dfe3c77d..d0ab0243e15 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs @@ -1,13 +1,20 @@ -use crate::data_contract::document_type::property_names::{CREATED_AT, UPDATED_AT}; use crate::document::{Document, DocumentV0}; -use crate::prelude::TimestampMillis; +use crate::prelude::{BlockHeight, CoreBlockHeight}; use crate::ProtocolError; use chrono::Utc; use platform_value::Value; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::v0::DocumentTypeV0; +use crate::document::property_names::{ + CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT_BLOCK_HEIGHT, + UPDATED_AT_CORE_BLOCK_HEIGHT, +}; use crate::document::INITIAL_REVISION; use crate::version::PlatformVersion; +use platform_value::btreemap_extensions::BTreeValueMapHelper; use platform_value::Identifier; use std::collections::BTreeMap; @@ -18,22 +25,119 @@ impl DocumentTypeV0 { &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result { - let created_at = if self.required_fields.contains(CREATED_AT) { - Some(Utc::now().timestamp_millis() as TimestampMillis) - } else { - None + // Set timestamps if they are required and not exist + let mut created_at: Option = properties + .get_optional_integer(crate::document::property_names::CREATED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at: Option = properties + .get_optional_integer(crate::document::property_names::UPDATED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at: Option = properties + .get_optional_integer(TRANSFERRED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_block_height: Option = properties + .get_optional_integer(CREATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_block_height: Option = properties + .get_optional_integer(UPDATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_block_height: Option = properties + .get_optional_integer(TRANSFERRED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_core_block_height: Option = properties + .get_optional_integer(CREATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_core_block_height: Option = properties + .get_optional_integer(UPDATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_core_block_height: Option = properties + .get_optional_integer(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let is_created_at_required = self + .required_fields() + .contains(crate::document::property_names::CREATED_AT); + let is_updated_at_required = self + .required_fields() + .contains(crate::document::property_names::UPDATED_AT); + let is_transferred_at_required = self.required_fields().contains(TRANSFERRED_AT); + + let is_created_at_block_height_required = + self.required_fields().contains(CREATED_AT_BLOCK_HEIGHT); + let is_updated_at_block_height_required = + self.required_fields().contains(UPDATED_AT_BLOCK_HEIGHT); + let is_transferred_at_block_height_required = + self.required_fields().contains(TRANSFERRED_AT_BLOCK_HEIGHT); + + let is_created_at_core_block_height_required = self + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT); + let is_updated_at_core_block_height_required = self + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT); + let is_transferred_at_core_block_height_required = self + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT); + + if (is_created_at_required && created_at.is_none()) + || (is_updated_at_required && updated_at.is_none() + || (is_transferred_at_required && transferred_at.is_none())) + { + //we want only one call to get current time + let now = Utc::now().timestamp_millis() as crate::identity::TimestampMillis; + + if is_created_at_required { + created_at = created_at.or(Some(now)); + }; + + if is_updated_at_required { + updated_at = updated_at.or(Some(now)); + }; + + if is_transferred_at_required { + transferred_at = transferred_at.or(Some(now)); + }; }; - let updated_at = if self.required_fields.contains(UPDATED_AT) { - Some(Utc::now().timestamp_millis() as TimestampMillis) - } else { - None + if is_created_at_block_height_required { + created_at_block_height = created_at_block_height.or(Some(block_height)); + }; + + if is_updated_at_block_height_required { + updated_at_block_height = updated_at_block_height.or(Some(block_height)); + }; + + if is_transferred_at_block_height_required { + transferred_at_block_height = transferred_at_block_height.or(Some(block_height)); + }; + + if is_created_at_core_block_height_required { + created_at_core_block_height = created_at_core_block_height.or(Some(core_block_height)); + }; + + if is_updated_at_core_block_height_required { + updated_at_core_block_height = updated_at_core_block_height.or(Some(core_block_height)); + }; + + if is_transferred_at_core_block_height_required { + transferred_at_core_block_height = + transferred_at_core_block_height.or(Some(core_block_height)); }; - let revision = if self.documents_mutable { + let revision = if self.requires_revision() { Some(INITIAL_REVISION) } else { None @@ -51,6 +155,13 @@ impl DocumentTypeV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_revision_for_identity_id/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/deserialize_value_for_key/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/verify/identity/verify_identity_revision_for_identity_id/mod.rs rename to packages/rs-dpp/src/data_contract/document_type/methods/deserialize_value_for_key/mod.rs diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/deserialize_value_for_key/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/deserialize_value_for_key/v0/mod.rs new file mode 100644 index 00000000000..cfba305c39b --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/deserialize_value_for_key/v0/mod.rs @@ -0,0 +1,52 @@ +use crate::data_contract::document_type::v0::DocumentTypeV0; +use crate::data_contract::document_type::DocumentPropertyType; +use crate::data_contract::errors::DataContractError; +use crate::ProtocolError; +use itertools::Itertools; +use platform_value::{Identifier, Value}; + +// If another document type (like V1) ever were to exist we would need to implement serialize_value_for_key_v0 again + +impl DocumentTypeV0 { + pub(in crate::data_contract::document_type) fn deserialize_value_for_key_v0( + &self, + key: &str, + value: &[u8], + ) -> Result { + match key { + "$ownerId" | "$id" => { + let bytes = Identifier::from_bytes(value)?; + Ok(Value::Identifier(bytes.to_buffer())) + } + "$createdAt" | "$updatedAt" | "$transferredAt" => Ok(Value::U64( + DocumentPropertyType::decode_date_timestamp(value).ok_or( + ProtocolError::DataContractError(DataContractError::FieldRequirementUnmet( + "value must be 8 bytes long".to_string(), + )), + )?, + )), + "$createdAtBlockHeight" | "$updatedAtBlockHeight" | "$transferredAtBlockHeight" => { + Ok(Value::U64(DocumentPropertyType::decode_u64(value).ok_or( + ProtocolError::DataContractError(DataContractError::FieldRequirementUnmet( + "value must be 8 bytes long".to_string(), + )), + )?)) + } + "$createdAtCoreBlockHeight" + | "$updatedAtCoreBlockHeight" + | "$transferredAtCoreBlockHeight" => { + Ok(Value::U32(DocumentPropertyType::decode_u32(value).ok_or( + ProtocolError::DataContractError(DataContractError::FieldRequirementUnmet( + "value must be 4 bytes long".to_string(), + )), + )?)) + } + _ => { + let property = self.flattened_properties.get(key).ok_or_else(|| { + DataContractError::DocumentTypeFieldNotFound(format!("expected contract to have field: {key}, contract fields are {} on document type {}", self.flattened_properties.keys().join(" | "), self.name)) + })?; + property.property_type.decode_value_for_tree_keys(value) + } + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/index_for_types/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/index_for_types/v0/mod.rs index 8b1e372a161..72c582b8906 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/index_for_types/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/index_for_types/v0/mod.rs @@ -12,7 +12,7 @@ impl DocumentTypeV0 { ) -> Option<(&Index, u16)> { let mut best_index: Option<(&Index, u16)> = None; let mut best_difference = u16::MAX; - for index in self.indices.iter() { + for (_, index) in self.indices.iter() { let difference_option = index.matches(index_names, in_field_name, order_by); if let Some(difference) = difference_option { if difference == 0 { diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs index 337128e099d..ca83589ccca 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs @@ -1,9 +1,14 @@ +mod contested_vote_poll_for_document; mod create_document_from_data; mod create_document_with_prevalidated_properties; +mod deserialize_value_for_key; mod estimated_size; mod index_for_types; mod max_size; +mod prefunded_voting_balances_for_document; mod serialize_value_for_key; +#[cfg(feature = "validation")] +mod validate_update; use std::collections::BTreeMap; @@ -13,10 +18,12 @@ use crate::data_contract::document_type::index_level::IndexLevel; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::document::Document; use crate::document::INITIAL_REVISION; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::version::PlatformVersion; use crate::ProtocolError; +use crate::fee::Credits; +use crate::voting::vote_polls::VotePoll; use platform_value::{Identifier, Value}; // TODO: Some of those methods are only for tests. Hide under feature @@ -35,6 +42,12 @@ pub trait DocumentTypeV0Methods { value: &Value, platform_version: &PlatformVersion, ) -> Result, ProtocolError>; + fn deserialize_value_for_key( + &self, + key: &str, + serialized_value: &[u8], + platform_version: &PlatformVersion, + ) -> Result; fn max_size(&self, platform_version: &PlatformVersion) -> Result; @@ -59,23 +72,72 @@ pub trait DocumentTypeV0Methods { /// Non versioned fn top_level_indices(&self) -> Vec<&IndexProperty>; + /// Non versioned + fn top_level_indices_of_contested_unique_indexes(&self) -> Vec<&IndexProperty>; + fn create_document_from_data( &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result; - /// Creates a document at the current time based on document type information - /// Properties set here must be pre validated + /// Creates a document at the current time based on specified document type information. + /// This function requires that all properties provided are pre-validated according to + /// the document's schema requirements. + /// + /// # Parameters: + /// - `id`: An identifier for the document. Unique within the context of the document's type. + /// - `owner_id`: The identifier of the entity that will own this document. + /// - `block_height`: The block height at which this document is considered to have been created. + /// While this value is recorded in the document, it is ignored when the document is broadcasted + /// to the network. This is because the actual block height at the time of broadcast may differ. + /// This parameter is included to fulfill schema requirements that specify a block height; you may + /// use the current block height, a placeholder value of 0, or any other value as necessary. + /// - `core_block_height`: Similar to `block_height`, this represents the core network's block height + /// at the document's creation time. It is handled the same way as `block_height` regarding broadcast + /// and schema requirements. + /// - `properties`: A collection of properties for the document, structured as a `BTreeMap`. + /// These must be pre-validated to match the document's schema definitions. + /// - `platform_version`: A reference to the current version of the platform for which the document is created. + /// + /// # Returns: + /// A `Result`, which is `Ok` if the document was successfully created, or an error + /// indicating what went wrong during the creation process. + /// + /// # Note: + /// The `block_height` and `core_block_height` are primarily included for schema compliance and local record-keeping. + /// These values are not used when the document is broadcasted to the network, as the network assigns its own block + /// heights upon receipt and processing of the document. After broadcasting, it is recommended to update these fields + /// in their created_at/updated_at variants as well as the base created_at/updated_at in the client-side + /// representation of the document to reflect the values returned by the network. The base created_at/updated_at + /// uses current time when creating the local document and is also ignored as it is also set network side. fn create_document_with_prevalidated_properties( &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result; + + /// Figures out the minimum prefunded voting balance needed for a document + fn prefunded_voting_balance_for_document( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError>; + + /// Gets the vote poll associated with a document + fn contested_vote_poll_for_document( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError>; } impl DocumentTypeV0Methods for DocumentTypeV0 { @@ -124,6 +186,28 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { } } + fn deserialize_value_for_key( + &self, + key: &str, + value: &[u8], + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .document_type_versions + .methods + .deserialize_value_for_key + { + 0 => self.deserialize_value_for_key_v0(key, value), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "deserialize_value_for_key".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + fn max_size(&self, platform_version: &PlatformVersion) -> Result { match platform_version .dpp @@ -174,7 +258,7 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { } fn initial_revision(&self) -> Option { - if self.documents_mutable { + if self.requires_revision() { Some(INITIAL_REVISION) } else { None @@ -183,22 +267,38 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { fn requires_revision(&self) -> bool { self.documents_mutable + || self.documents_transferable.is_transferable() + || self.trade_mode.seller_sets_price() } fn top_level_indices(&self) -> Vec<&IndexProperty> { - let mut index_properties: Vec<&IndexProperty> = Vec::with_capacity(self.indices.len()); - for index in &self.indices { - if let Some(property) = index.properties.get(0) { - index_properties.push(property); - } - } - index_properties + self.indices + .values() + .filter_map(|index| index.properties.first()) + .collect() + } + + // This should normally just be 1 item, however we keep a vec in case we want to change things + // in the future. + fn top_level_indices_of_contested_unique_indexes(&self) -> Vec<&IndexProperty> { + self.indices + .values() + .filter_map(|index| { + if index.contested_index.is_some() { + index.properties.first() + } else { + None + } + }) + .collect() } fn create_document_from_data( &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result { @@ -212,6 +312,8 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { 0 => self.create_document_from_data_v0( data, owner_id, + block_height, + core_block_height, document_entropy, platform_version, ), @@ -227,6 +329,8 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result { @@ -240,6 +344,8 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { 0 => self.create_document_with_prevalidated_properties_v0( id, owner_id, + block_height, + core_block_height, properties, platform_version, ), @@ -250,4 +356,47 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { }), } } + + fn prefunded_voting_balance_for_document( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + match platform_version + .dpp + .contract_versions + .document_type_versions + .methods + .prefunded_voting_balance_for_document + { + 0 => Ok(self.prefunded_voting_balance_for_document_v0(document, platform_version)), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "prefunded_voting_balances_for_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + /// Gets the vote poll associated with a document + fn contested_vote_poll_for_document( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + match platform_version + .dpp + .contract_versions + .document_type_versions + .methods + .contested_vote_poll_for_document + { + 0 => Ok(self.contested_vote_poll_for_document_v0(document)), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "contested_vote_poll_for_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } } diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/prefunded_voting_balances_for_document/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/prefunded_voting_balances_for_document/mod.rs new file mode 100644 index 00000000000..e084dffc38f --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/prefunded_voting_balances_for_document/mod.rs @@ -0,0 +1 @@ +mod v0; diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/prefunded_voting_balances_for_document/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/prefunded_voting_balances_for_document/v0/mod.rs new file mode 100644 index 00000000000..afffeb1a68f --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/prefunded_voting_balances_for_document/v0/mod.rs @@ -0,0 +1,42 @@ +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::v0::DocumentTypeV0; +use crate::document::{Document, DocumentV0Getters}; +use crate::fee::Credits; +use crate::version::PlatformVersion; + +impl DocumentTypeV0 { + /// Figures out the prefunded voting balance (v0) for a document in a document type + pub(in crate::data_contract::document_type) fn prefunded_voting_balance_for_document_v0( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Option<(String, Credits)> { + self.indexes() + .values() + .find(|index| { + if let Some(contested_index_info) = &index.contested_index { + contested_index_info + .field_matches + .iter() + .all(|(field, field_match)| { + if let Some(value) = document.get(field) { + field_match.matches(value) + } else { + false + } + }) + } else { + false + } + }) + .map(|index| { + ( + index.name.clone(), + platform_version + .fee_version + .vote_resolution_fund_fees + .contested_document_vote_resolution_fund_required_amount, + ) + }) + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs index 3539b7615ed..92890cb647a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs @@ -21,16 +21,28 @@ impl DocumentTypeV0 { if bytes.len() != DEFAULT_HASH_SIZE { Err(ProtocolError::DataContractError( DataContractError::FieldRequirementUnmet( - "expected system value to be 32 bytes long", + "expected system value to be 32 bytes long".to_string(), ), )) } else { Ok(bytes) } } - "$createdAt" | "$updatedAt" => DocumentPropertyType::encode_date_timestamp( + "$createdAt" | "$updatedAt" | "$transferredAt" => { + Ok(DocumentPropertyType::encode_date_timestamp( + value.to_integer().map_err(ProtocolError::ValueError)?, + )) + } + "$createdAtBlockHeight" | "$updatedAtBlockHeight" | "$transferredAtBlockHeight" => { + Ok(DocumentPropertyType::encode_u64( + value.to_integer().map_err(ProtocolError::ValueError)?, + )) + } + "$createdAtCoreBlockHeight" + | "$updatedAtCoreBlockHeight" + | "$transferredAtCoreBlockHeight" => Ok(DocumentPropertyType::encode_u32( value.to_integer().map_err(ProtocolError::ValueError)?, - ), + )), _ => { let property = self.flattened_properties.get(key).ok_or_else(|| { DataContractError::DocumentTypeFieldNotFound(format!("expected contract to have field: {key}, contract fields are {} on document type {}", self.flattened_properties.keys().join(" | "), self.name)) @@ -39,7 +51,7 @@ impl DocumentTypeV0 { if bytes.len() > MAX_INDEX_SIZE { Err(ProtocolError::DataContractError( DataContractError::FieldRequirementUnmet( - "value must be less than 256 bytes long", + "value must be less than 256 bytes long".to_string(), ), )) } else { diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/mod.rs new file mode 100644 index 00000000000..78f27035a90 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/mod.rs @@ -0,0 +1,30 @@ +use crate::data_contract::document_type::DocumentTypeRef; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_version::version::PlatformVersion; + +mod v0; + +impl<'a> DocumentTypeRef<'a> { + /// Verify that the update to the document type is valid. + /// We assume that new document type is valid + pub fn validate_update( + &self, + new_document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .validation + .document_type + .validate_update + { + 0 => self.validate_update_v0(new_document_type, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "validate_update".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs new file mode 100644 index 00000000000..fe3980e0aa7 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs @@ -0,0 +1,1018 @@ +use crate::consensus::basic::data_contract::IncompatibleDocumentTypeSchemaError; +use crate::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::schema::validate_schema_compatibility; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::data_contract::errors::DataContractError; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_version::version::PlatformVersion; + +impl<'a> DocumentTypeRef<'a> { + #[inline(always)] + pub(super) fn validate_update_v0( + &self, + new_document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + // Validate configuration + let result = self.validate_config(new_document_type); + + if !result.is_valid() { + return Ok(result); + } + + // Validate indices + let result = self + .index_structure() + .validate_update(self.name(), new_document_type.index_structure()); + + if !result.is_valid() { + return Ok(result); + } + + // Validate schema compatibility + self.validate_schema(new_document_type, platform_version) + } + + fn validate_config( + &self, + new_document_type: DocumentTypeRef, + ) -> SimpleConsensusValidationResult { + if new_document_type.creation_restriction_mode() != self.creation_restriction_mode() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change creation restriction mode: changing from {} to {}", + self.creation_restriction_mode(), + new_document_type.creation_restriction_mode() + ), + ) + .into(), + ); + } + + if new_document_type.trade_mode() != self.trade_mode() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change trade mode: changing from {} to {}", + self.trade_mode(), + new_document_type.trade_mode() + ), + ) + .into(), + ); + } + + if new_document_type.documents_transferable() != self.documents_transferable() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether its documents are transferable: changing from {} to {}", + self.documents_transferable(), + new_document_type.documents_transferable() + ), + ) + .into(), + ); + } + + if new_document_type.documents_can_be_deleted() != self.documents_can_be_deleted() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether its documents can be deleted: changing from {} to {}", + self.documents_can_be_deleted(), + new_document_type.documents_can_be_deleted() + ), + ) + .into(), + ); + } + + if new_document_type.documents_keep_history() != self.documents_keep_history() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether it keeps history: changing from {} to {}", + self.documents_keep_history(), + new_document_type.documents_keep_history() + ), + ) + .into(), + ); + } + + if new_document_type.documents_mutable() != self.documents_mutable() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether its documents are mutable: changing from {} to {}", + self.documents_mutable(), + new_document_type.documents_mutable() + ), + ) + .into(), + ); + } + + if new_document_type.requires_identity_encryption_bounded_key() + != self.requires_identity_encryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether it required an identity encryption bounded key: changing from {:?} to {:?}", + self.requires_identity_encryption_bounded_key(), + new_document_type.requires_identity_encryption_bounded_key() + ), + ) + .into(), + ); + } + + if new_document_type.requires_identity_decryption_bounded_key() + != self.requires_identity_decryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether it required an identity decryption bounded key: changing from {:?} to {:?}", + self.requires_identity_decryption_bounded_key(), + new_document_type.requires_identity_decryption_bounded_key() + ), + ) + .into(), + ); + } + + if new_document_type.security_level_requirement() != self.security_level_requirement() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change the security level requirement for its updates: changing from {:?} to {:?}", + self.security_level_requirement(), + new_document_type.security_level_requirement() + ), + ) + .into(), + ); + } + + SimpleConsensusValidationResult::new() + } + + fn validate_schema( + &self, + new_document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + // All good if schema is the same + if self.schema() == new_document_type.schema() { + return Ok(SimpleConsensusValidationResult::new()); + } + + let old_document_schema_json = match self.schema().try_to_validating_json() { + Ok(json_value) => json_value, + Err(e) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + DataContractError::ValueDecodingError(format!( + "invalid existing json schema structure for document type {}: {e}", + self.name() + )) + .into(), + )); + } + }; + + let new_document_schema_json = match new_document_type.schema().try_to_validating_json() { + Ok(json_value) => json_value, + Err(e) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + DataContractError::ValueDecodingError(format!( + "invalid new json schema structure for document type {}: {e}", + self.name() + )) + .into(), + )); + } + }; + + let compatibility_validation_result = validate_schema_compatibility( + &old_document_schema_json, + &new_document_schema_json, + platform_version, + )?; + + // Convert the compatibility errors to consensus errors + let errors = compatibility_validation_result + .errors + .into_iter() + .map(|operation| { + IncompatibleDocumentTypeSchemaError::new( + self.name().clone(), + operation.name, + operation.path, + ) + .into() + }) + .collect(); + + Ok(SimpleConsensusValidationResult::new_with_errors(errors)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + use crate::consensus::state::state_error::StateError; + use crate::consensus::ConsensusError; + use crate::data_contract::document_type::DocumentType; + use assert_matches::assert_matches; + use platform_value::platform_value; + use platform_value::Identifier; + + mod validate_config { + use super::*; + + #[test] + fn should_return_invalid_result_when_creation_restriction_mode_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "creationRestrictionMode": 1, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "creationRestrictionMode": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change creation restriction mode: changing from Owner Only to No Restrictions" + ); + } + + #[test] + fn should_return_invalid_result_when_trade_mode_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "tradeMode": 1, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "tradeMode": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change trade mode: changing from Direct Purchase to No Trading" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_transferable_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "transferable": 1, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "transferable": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents are transferable: changing from Always to Never" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_can_be_deleted_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "canBeDeleted": true, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "canBeDeleted": false, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents can be deleted: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_keep_history_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsKeepHistory": true, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsKeepHistory": false, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether it keeps history: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_mutable_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsMutable": true, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsMutable": false, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents are mutable: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_requires_identity_encryption_bounded_key_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityEncryptionBoundedKey": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityEncryptionBoundedKey": 1, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether it required an identity encryption bounded key: changing from Some(Unique) to Some(Multiple)" + ); + } + + #[test] + fn should_return_invalid_result_when_requires_identity_decryption_bounded_key_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityDecryptionBoundedKey": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityDecryptionBoundedKey": 2, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether it required an identity decryption bounded key: changing from Some(Unique) to Some(MultipleReferenceToLatest)" + ); + } + + #[test] + fn should_return_invalid_result_when_security_level_requirement_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 1, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change the security level requirement for its updates: changing from MASTER to CRITICAL" + ); + } + } + + mod validate_schema { + use super::*; + use crate::consensus::basic::BasicError; + + #[test] + fn should_pass_when_schema_is_not_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema.clone(), + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_schema(new_document_type.as_ref(), platform_version) + .expect("failed to validate schema compatibility"); + + assert!(result.is_valid()); + } + + #[test] + fn should_return_invalid_result_when_schemas_are_not_backward_compatible() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema.clone(), + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "number", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_schema(new_document_type.as_ref(), platform_version) + .expect("failed to validate schema compatibility"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::IncompatibleDocumentTypeSchemaError(e) + )] if e.operation() == "replace" && e.property_path() == "/properties/test/type" + ); + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/mod.rs b/packages/rs-dpp/src/data_contract/document_type/mod.rs index 1ab0eeb300c..89143a89a5e 100644 --- a/packages/rs-dpp/src/data_contract/document_type/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/mod.rs @@ -7,38 +7,52 @@ pub mod methods; pub use index::*; mod index_level; pub use index_level::IndexLevel; +pub use index_level::IndexLevelTypeInfo; +pub use index_level::IndexType; #[cfg(feature = "random-documents")] pub mod random_document; +pub mod restricted_creation; pub mod schema; pub mod v0; use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::document::Document; -use crate::prelude::Revision; +use crate::fee::Credits; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::version::PlatformVersion; +use crate::voting::vote_polls::VotePoll; use crate::ProtocolError; use derive_more::From; use platform_value::{Identifier, Value}; use std::collections::BTreeMap; -pub(self) mod property_names { +mod property_names { pub const DOCUMENTS_KEEP_HISTORY: &str = "documentsKeepHistory"; pub const DOCUMENTS_MUTABLE: &str = "documentsMutable"; + + pub const CAN_BE_DELETED: &str = "canBeDeleted"; + pub const TRANSFERABLE: &str = "transferable"; + pub const TRADE_MODE: &str = "tradeMode"; + + pub const CREATION_RESTRICTION_MODE: &str = "creationRestrictionMode"; pub const SECURITY_LEVEL_REQUIREMENT: &str = "signatureSecurityLevelRequirement"; pub const REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY: &str = "requiresIdentityEncryptionBoundedKey"; pub const REQUIRES_IDENTITY_DECRYPTION_BOUNDED_KEY: &str = "requiresIdentityDecryptionBoundedKey"; pub const INDICES: &str = "indices"; + pub const NULL_SEARCHABLE: &str = "nullSearchable"; pub const PROPERTIES: &str = "properties"; pub const POSITION: &str = "position"; pub const REQUIRED: &str = "required"; + pub const TRANSIENT: &str = "transient"; pub const TYPE: &str = "type"; pub const REF: &str = "$ref"; pub const CREATED_AT: &str = "$createdAt"; pub const UPDATED_AT: &str = "$updatedAt"; + pub const TRANSFERRED_AT: &str = "$transferredAt"; pub const MIN_ITEMS: &str = "minItems"; pub const MAX_ITEMS: &str = "maxItems"; pub const MIN_LENGTH: &str = "minLength"; @@ -76,6 +90,18 @@ impl DocumentType { DocumentType::V0(v0) => DocumentTypeMutRef::V0(v0), } } + + pub fn prefunded_voting_balances_for_document( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + match self { + DocumentType::V0(v0) => { + v0.prefunded_voting_balance_for_document(document, platform_version) + } + } + } } impl<'a> DocumentTypeRef<'a> { @@ -112,6 +138,19 @@ impl<'a> DocumentTypeV0Methods for DocumentTypeRef<'a> { } } + fn deserialize_value_for_key( + &self, + key: &str, + serialized_value: &[u8], + platform_version: &PlatformVersion, + ) -> Result { + match self { + DocumentTypeRef::V0(v0) => { + v0.deserialize_value_for_key(key, serialized_value, platform_version) + } + } + } + fn max_size(&self, platform_version: &PlatformVersion) -> Result { match self { DocumentTypeRef::V0(v0) => v0.max_size(platform_version), @@ -158,17 +197,30 @@ impl<'a> DocumentTypeV0Methods for DocumentTypeRef<'a> { } } + fn top_level_indices_of_contested_unique_indexes(&self) -> Vec<&IndexProperty> { + match self { + DocumentTypeRef::V0(v0) => v0.top_level_indices_of_contested_unique_indexes(), + } + } + fn create_document_from_data( &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result { match self { - DocumentTypeRef::V0(v0) => { - v0.create_document_from_data(data, owner_id, document_entropy, platform_version) - } + DocumentTypeRef::V0(v0) => v0.create_document_from_data( + data, + owner_id, + block_height, + core_block_height, + document_entropy, + platform_version, + ), } } @@ -176,6 +228,8 @@ impl<'a> DocumentTypeV0Methods for DocumentTypeRef<'a> { &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result { @@ -183,9 +237,35 @@ impl<'a> DocumentTypeV0Methods for DocumentTypeRef<'a> { DocumentTypeRef::V0(v0) => v0.create_document_with_prevalidated_properties( id, owner_id, + block_height, + core_block_height, properties, platform_version, ), } } + + fn prefunded_voting_balance_for_document( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + match self { + DocumentTypeRef::V0(v0) => { + v0.prefunded_voting_balance_for_document(document, platform_version) + } + } + } + + fn contested_vote_poll_for_document( + &self, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + match self { + DocumentTypeRef::V0(v0) => { + v0.contested_vote_poll_for_document(document, platform_version) + } + } + } } diff --git a/packages/rs-dpp/src/data_contract/document_type/property/array.rs b/packages/rs-dpp/src/data_contract/document_type/property/array.rs index 2e45caf15e3..fd4e533fd2b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/array.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/array.rs @@ -122,6 +122,6 @@ impl ArrayItemType { fn get_field_type_matching_error() -> ProtocolError { ProtocolError::DataContractError(DataContractError::ValueWrongType( - "document field type doesn't match document value for array", + "document field type doesn't match document value for array".to_string(), )) } diff --git a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs index 0b7f1cac73e..927fb561a1a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs @@ -1,41 +1,62 @@ -use std::collections::BTreeMap; use std::convert::TryInto; -use std::io::{BufReader, Read}; +use std::io::{BufReader, Cursor, Read}; use crate::data_contract::errors::DataContractError; +use crate::consensus::basic::decode::DecodingError; use crate::prelude::TimestampMillis; use crate::ProtocolError; use array::ArrayItemType; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use indexmap::IndexMap; use integer_encoding::{VarInt, VarIntReader}; -use platform_value::Value; +use platform_value::{Identifier, Value}; use rand::distributions::{Alphanumeric, Standard}; use rand::rngs::StdRng; use rand::Rng; -use serde::{Deserialize, Serialize}; +use serde::Serialize; pub mod array; // This struct will be changed in future to support more validation logic and serialization // It will become versioned and it will be introduced by a new document type version // @append_only -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Serialize)] pub struct DocumentProperty { pub property_type: DocumentPropertyType, pub required: bool, + pub transient: bool, +} + +#[derive(Debug, PartialEq, Clone, Serialize)] +pub struct StringPropertySizes { + pub min_length: Option, + pub max_length: Option, +} + +#[derive(Debug, PartialEq, Clone, Serialize)] +pub struct ByteArrayPropertySizes { + pub min_size: Option, + pub max_size: Option, } // @append_only -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Serialize)] pub enum DocumentPropertyType { - ///Todo decompose integer - Integer, - Number, - String(Option, Option), // TODO use structure - ByteArray(Option, Option), // TODO user structure + U128, + I128, + U64, + I64, + U32, + I32, + U16, + I16, + U8, + I8, + F64, + String(StringPropertySizes), + ByteArray(ByteArrayPropertySizes), Identifier, Boolean, Date, @@ -45,23 +66,57 @@ pub enum DocumentPropertyType { } impl DocumentPropertyType { - pub fn try_from_name(name: &str) -> Result { + pub fn try_from_name(name: &str) -> Result { match name { - "integer" => Ok(DocumentPropertyType::Integer), - "number" => Ok(DocumentPropertyType::Number), + "u128" => Ok(DocumentPropertyType::U128), + "i128" => Ok(DocumentPropertyType::I128), + "u64" => Ok(DocumentPropertyType::U64), + "i64" | "integer" => Ok(DocumentPropertyType::I64), + "u32" => Ok(DocumentPropertyType::U32), + "i32" => Ok(DocumentPropertyType::I32), + "u16" => Ok(DocumentPropertyType::U16), + "i16" => Ok(DocumentPropertyType::I16), + "u8" => Ok(DocumentPropertyType::U8), + "i8" => Ok(DocumentPropertyType::I8), + "f64" | "number" => Ok(DocumentPropertyType::F64), "boolean" => Ok(DocumentPropertyType::Boolean), "date" => Ok(DocumentPropertyType::Date), "identifier" => Ok(DocumentPropertyType::Identifier), - _ => Err(DataContractError::ValueWrongType("invalid type").into()), + "string" => Ok(DocumentPropertyType::String(StringPropertySizes { + min_length: None, + max_length: None, + })), + "byteArray" => Ok(DocumentPropertyType::ByteArray(ByteArrayPropertySizes { + min_size: None, + max_size: None, + })), + "object" => Ok(DocumentPropertyType::Object(IndexMap::new())), + "array" => Err(DataContractError::ValueWrongType( + "array type needs to specify the inner type".to_string(), + )), + "variableTypeArray" => Ok(DocumentPropertyType::VariableTypeArray(Vec::new())), + name => Err(DataContractError::ValueWrongType(format!( + "invalid type {}", + name + ))), } } pub fn name(&self) -> String { match self { - DocumentPropertyType::Integer => "integer".to_string(), - DocumentPropertyType::Number => "number".to_string(), - DocumentPropertyType::String(_, _) => "string".to_string(), - DocumentPropertyType::ByteArray(_, _) => "byteArray".to_string(), + DocumentPropertyType::U128 => "u128".to_string(), + DocumentPropertyType::I128 => "i128".to_string(), + DocumentPropertyType::U64 => "u64".to_string(), + DocumentPropertyType::I64 => "i64".to_string(), + DocumentPropertyType::U32 => "u32".to_string(), + DocumentPropertyType::I32 => "i32".to_string(), + DocumentPropertyType::U16 => "u16".to_string(), + DocumentPropertyType::I16 => "i16".to_string(), + DocumentPropertyType::U8 => "u8".to_string(), + DocumentPropertyType::I8 => "i8".to_string(), + DocumentPropertyType::F64 => "f64".to_string(), + DocumentPropertyType::String(_) => "string".to_string(), + DocumentPropertyType::ByteArray(_) => "byteArray".to_string(), DocumentPropertyType::Identifier => "identifier".to_string(), DocumentPropertyType::Boolean => "boolean".to_string(), DocumentPropertyType::Date => "date".to_string(), @@ -73,15 +128,24 @@ impl DocumentPropertyType { pub fn min_size(&self) -> Option { match self { - DocumentPropertyType::Integer => Some(8), - DocumentPropertyType::Number => Some(8), - DocumentPropertyType::String(min_length, _) => match min_length { + DocumentPropertyType::U128 => Some(16), + DocumentPropertyType::I128 => Some(16), + DocumentPropertyType::U64 => Some(8), + DocumentPropertyType::I64 => Some(8), + DocumentPropertyType::U32 => Some(4), + DocumentPropertyType::I32 => Some(4), + DocumentPropertyType::U16 => Some(2), + DocumentPropertyType::I16 => Some(2), + DocumentPropertyType::U8 => Some(1), + DocumentPropertyType::I8 => Some(1), + DocumentPropertyType::F64 => Some(8), + DocumentPropertyType::String(sizes) => match sizes.min_length { None => Some(0), - Some(size) => Some(*size), + Some(size) => Some(size), }, - DocumentPropertyType::ByteArray(min_size, _) => match min_size { + DocumentPropertyType::ByteArray(sizes) => match sizes.min_size { None => Some(0), - Some(size) => Some(*size), + Some(size) => Some(size), }, DocumentPropertyType::Boolean => Some(1), DocumentPropertyType::Date => Some(8), @@ -97,15 +161,24 @@ impl DocumentPropertyType { pub fn min_byte_size(&self) -> Option { match self { - DocumentPropertyType::Integer => Some(8), - DocumentPropertyType::Number => Some(8), - DocumentPropertyType::String(min_length, _) => match min_length { + DocumentPropertyType::U128 => Some(16), + DocumentPropertyType::I128 => Some(16), + DocumentPropertyType::U64 => Some(8), + DocumentPropertyType::I64 => Some(8), + DocumentPropertyType::U32 => Some(4), + DocumentPropertyType::I32 => Some(4), + DocumentPropertyType::U16 => Some(2), + DocumentPropertyType::I16 => Some(2), + DocumentPropertyType::U8 => Some(1), + DocumentPropertyType::I8 => Some(1), + DocumentPropertyType::F64 => Some(8), + DocumentPropertyType::String(sizes) => match sizes.min_length { None => Some(0), - Some(size) => Some(*size * 4), + Some(size) => Some(size * 4), }, - DocumentPropertyType::ByteArray(min_size, _) => match min_size { + DocumentPropertyType::ByteArray(sizes) => match sizes.min_size { None => Some(0), - Some(size) => Some(*size), + Some(size) => Some(size), }, DocumentPropertyType::Boolean => Some(1), DocumentPropertyType::Date => Some(8), @@ -121,15 +194,24 @@ impl DocumentPropertyType { pub fn max_byte_size(&self) -> Option { match self { - DocumentPropertyType::Integer => Some(8), - DocumentPropertyType::Number => Some(8), - DocumentPropertyType::String(_, max_length) => match max_length { + DocumentPropertyType::U128 => Some(16), + DocumentPropertyType::I128 => Some(16), + DocumentPropertyType::U64 => Some(8), + DocumentPropertyType::I64 => Some(8), + DocumentPropertyType::U32 => Some(4), + DocumentPropertyType::I32 => Some(4), + DocumentPropertyType::U16 => Some(2), + DocumentPropertyType::I16 => Some(2), + DocumentPropertyType::U8 => Some(1), + DocumentPropertyType::I8 => Some(1), + DocumentPropertyType::F64 => Some(8), + DocumentPropertyType::String(sizes) => match sizes.max_length { None => Some(u16::MAX), - Some(size) => Some(*size * 4), + Some(size) => Some(size * 4), }, - DocumentPropertyType::ByteArray(_, max_size) => match max_size { + DocumentPropertyType::ByteArray(sizes) => match sizes.max_size { None => Some(u16::MAX), - Some(size) => Some(*size), + Some(size) => Some(size), }, DocumentPropertyType::Boolean => Some(1), DocumentPropertyType::Date => Some(8), @@ -145,15 +227,24 @@ impl DocumentPropertyType { pub fn max_size(&self) -> Option { match self { - DocumentPropertyType::Integer => Some(8), - DocumentPropertyType::Number => Some(8), - DocumentPropertyType::String(_, max_length) => match max_length { + DocumentPropertyType::U128 => Some(16), + DocumentPropertyType::I128 => Some(16), + DocumentPropertyType::U64 => Some(8), + DocumentPropertyType::I64 => Some(8), + DocumentPropertyType::U32 => Some(4), + DocumentPropertyType::I32 => Some(4), + DocumentPropertyType::U16 => Some(2), + DocumentPropertyType::I16 => Some(2), + DocumentPropertyType::U8 => Some(1), + DocumentPropertyType::I8 => Some(1), + DocumentPropertyType::F64 => Some(8), + DocumentPropertyType::String(sizes) => match sizes.max_length { None => Some(16383), - Some(size) => Some(*size), + Some(size) => Some(size), }, - DocumentPropertyType::ByteArray(_, max_size) => match max_size { + DocumentPropertyType::ByteArray(sizes) => match sizes.max_size { None => Some(u16::MAX), - Some(size) => Some(*size), + Some(size) => Some(size), }, DocumentPropertyType::Boolean => Some(1), DocumentPropertyType::Date => Some(8), @@ -227,9 +318,18 @@ impl DocumentPropertyType { pub fn random_value(&self, rng: &mut StdRng) -> Value { match self { - DocumentPropertyType::Integer => Value::I64(rng.gen::()), - DocumentPropertyType::Number => Value::Float(rng.gen::()), - DocumentPropertyType::String(_, _) => { + DocumentPropertyType::U128 => Value::U128(rng.gen::()), + DocumentPropertyType::I128 => Value::I128(rng.gen::()), + DocumentPropertyType::U64 => Value::U64(rng.gen::()), + DocumentPropertyType::I64 => Value::I64(rng.gen::()), + DocumentPropertyType::U32 => Value::U32(rng.gen::()), + DocumentPropertyType::I32 => Value::I32(rng.gen::()), + DocumentPropertyType::U16 => Value::U16(rng.gen::()), + DocumentPropertyType::I16 => Value::I16(rng.gen::()), + DocumentPropertyType::U8 => Value::U8(rng.gen::()), + DocumentPropertyType::I8 => Value::I8(rng.gen::()), + DocumentPropertyType::F64 => Value::Float(rng.gen::()), + DocumentPropertyType::String(_) => { let size = self.random_size(rng); Value::Text( rng.sample_iter(Alphanumeric) @@ -238,7 +338,7 @@ impl DocumentPropertyType { .collect(), ) } - DocumentPropertyType::ByteArray(_, _) => { + DocumentPropertyType::ByteArray(_) => { let size = self.random_size(rng); if self.min_size() == self.max_size() { match size { @@ -286,9 +386,18 @@ impl DocumentPropertyType { pub fn random_sub_filled_value(&self, rng: &mut StdRng) -> Value { match self { - DocumentPropertyType::Integer => Value::I64(rng.gen::()), - DocumentPropertyType::Number => Value::Float(rng.gen::()), - DocumentPropertyType::String(_, _) => { + DocumentPropertyType::U128 => Value::U128(rng.gen::()), + DocumentPropertyType::I128 => Value::I128(rng.gen::()), + DocumentPropertyType::U64 => Value::U64(rng.gen::()), + DocumentPropertyType::I64 => Value::I64(rng.gen::()), + DocumentPropertyType::U32 => Value::U32(rng.gen::()), + DocumentPropertyType::I32 => Value::I32(rng.gen::()), + DocumentPropertyType::U16 => Value::U16(rng.gen::()), + DocumentPropertyType::I16 => Value::I16(rng.gen::()), + DocumentPropertyType::U8 => Value::U8(rng.gen::()), + DocumentPropertyType::I8 => Value::I8(rng.gen::()), + DocumentPropertyType::F64 => Value::Float(rng.gen::()), + DocumentPropertyType::String(_) => { let size = self.min_size().unwrap(); Value::Text( rng.sample_iter(Alphanumeric) @@ -297,7 +406,7 @@ impl DocumentPropertyType { .collect(), ) } - DocumentPropertyType::ByteArray(_, _) => { + DocumentPropertyType::ByteArray(_) => { let size = self.min_size().unwrap(); Value::Bytes(rng.sample_iter(Standard).take(size as usize).collect()) } @@ -326,9 +435,18 @@ impl DocumentPropertyType { pub fn random_filled_value(&self, rng: &mut StdRng) -> Value { match self { - DocumentPropertyType::Integer => Value::I64(rng.gen::()), - DocumentPropertyType::Number => Value::Float(rng.gen::()), - DocumentPropertyType::String(_, _) => { + DocumentPropertyType::U128 => Value::U128(rng.gen::()), + DocumentPropertyType::I128 => Value::I128(rng.gen::()), + DocumentPropertyType::U64 => Value::U64(rng.gen::()), + DocumentPropertyType::I64 => Value::I64(rng.gen::()), + DocumentPropertyType::U32 => Value::U32(rng.gen::()), + DocumentPropertyType::I32 => Value::I32(rng.gen::()), + DocumentPropertyType::U16 => Value::U16(rng.gen::()), + DocumentPropertyType::I16 => Value::I16(rng.gen::()), + DocumentPropertyType::U8 => Value::U8(rng.gen::()), + DocumentPropertyType::I8 => Value::I8(rng.gen::()), + DocumentPropertyType::F64 => Value::Float(rng.gen::()), + DocumentPropertyType::String(_) => { let size = self.max_size().unwrap(); Value::Text( rng.sample_iter(Alphanumeric) @@ -337,7 +455,7 @@ impl DocumentPropertyType { .collect(), ) } - DocumentPropertyType::ByteArray(_, _) => { + DocumentPropertyType::ByteArray(_) => { let size = self.max_size().unwrap(); Value::Bytes(rng.sample_iter(Standard).take(size as usize).collect()) } @@ -364,20 +482,20 @@ impl DocumentPropertyType { } } - fn read_varint_value(buf: &mut BufReader<&[u8]>) -> Result, ProtocolError> { + fn read_varint_value(buf: &mut BufReader<&[u8]>) -> Result, DataContractError> { let bytes: usize = buf.read_varint().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading varint length from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading varint length from serialized document".to_string(), + ) })?; if bytes == 0 { Ok(vec![]) } else { let mut value: Vec = vec![0u8; bytes]; buf.read_exact(&mut value).map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading varint from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading varint from serialized document".to_string(), + ) })?; Ok(value) } @@ -389,7 +507,7 @@ impl DocumentPropertyType { &self, buf: &mut BufReader<&[u8]>, required: bool, - ) -> Result<(Option, bool), ProtocolError> { + ) -> Result<(Option, bool), DataContractError> { if !required { let marker = buf.read_u8().ok(); match marker { @@ -399,52 +517,125 @@ impl DocumentPropertyType { } } match self { - DocumentPropertyType::String(_, _) => { + DocumentPropertyType::U128 => { + let value = buf.read_u128::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading u128 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::U128(value)), false)) + } + DocumentPropertyType::I128 => { + let value = buf.read_i128::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading i128 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::I128(value)), false)) + } + DocumentPropertyType::U64 => { + let value = buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading u64 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::U64(value)), false)) + } + DocumentPropertyType::I64 => { + let value = buf.read_i64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading i64 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::I64(value)), false)) + } + DocumentPropertyType::U32 => { + let value = buf.read_u32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading u32 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::U32(value)), false)) + } + DocumentPropertyType::I32 => { + let value = buf.read_i32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading i32 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::I32(value)), false)) + } + DocumentPropertyType::U16 => { + let value = buf.read_u16::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading u16 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::U16(value)), false)) + } + DocumentPropertyType::I16 => { + let value = buf.read_i16::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading i16 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::I16(value)), false)) + } + DocumentPropertyType::U8 => { + let value = buf.read_u8().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading u8 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::U8(value)), false)) + } + DocumentPropertyType::I8 => { + let value = buf.read_i8().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading i8 from serialized document".to_string(), + ) + })?; + Ok((Some(Value::I8(value)), false)) + } + DocumentPropertyType::String(_) => { let bytes = Self::read_varint_value(buf)?; let string = String::from_utf8(bytes).map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading string from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading string from serialized document".to_string(), + ) })?; Ok((Some(Value::Text(string)), false)) } - DocumentPropertyType::Date | DocumentPropertyType::Number => { + DocumentPropertyType::Date | DocumentPropertyType::F64 => { let date = buf.read_f64::().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading date/number from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading date/number from serialized document".to_string(), + ) })?; Ok((Some(Value::Float(date)), false)) } - DocumentPropertyType::Integer => { - let integer = buf.read_i64::().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading integer from serialized document", - )) - })?; - Ok((Some(Value::I64(integer)), false)) - } DocumentPropertyType::Boolean => { let value = buf.read_u8().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading bool from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading bool from serialized document".to_string(), + ) })?; match value { 0 => Ok((Some(Value::Bool(false)), false)), _ => Ok((Some(Value::Bool(true)), false)), } } - DocumentPropertyType::ByteArray(min, max) => { - match (min, max) { + DocumentPropertyType::ByteArray(sizes) => { + match (sizes.min_size, sizes.max_size) { (Some(min), Some(max)) if min == max => { // if min == max, then we don't need a varint for the length - let len = *min as usize; + let len = min as usize; let mut bytes = vec![0; len]; buf.read_exact(&mut bytes).map_err(|_| { - ProtocolError::DecodingError( - "error reading 32 byte non main identifier".to_string(), - ) + DataContractError::DecodingContractError(DecodingError::new(format!( + "expected to read {} bytes (min size for byte array)", + len + ))) })?; // To save space we use predefined types for most popular blob sizes // so we don't need to store the size of the blob @@ -465,9 +656,9 @@ impl DocumentPropertyType { DocumentPropertyType::Identifier => { let mut id = [0; 32]; buf.read_exact(&mut id).map_err(|_| { - ProtocolError::DecodingError( - "error reading 32 byte non main identifier".to_string(), - ) + DataContractError::DecodingContractError(DecodingError::new( + "expected to read 32 bytes (identifier)".to_string(), + )) })?; //dbg!(hex::encode(&id)); Ok((Some(Value::Identifier(id)), false)) @@ -475,15 +666,15 @@ impl DocumentPropertyType { DocumentPropertyType::Object(inner_fields) => { let object_byte_len: usize = buf.read_varint().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading varint of object length", - )) + DataContractError::CorruptedSerialization( + "error reading varint of object length".to_string(), + ) })?; let mut object_bytes = vec![0u8; object_byte_len]; buf.read_exact(&mut object_bytes).map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading object bytes", - )) + DataContractError::CorruptedSerialization( + "error reading object bytes".to_string(), + ) })?; // Wrap the bytes in a BufReader let mut object_buf_reader = BufReader::new(&object_bytes[..]); @@ -493,10 +684,8 @@ impl DocumentPropertyType { .filter_map(|(key, field)| { if finished_buffer { return if field.required { - Some(Err(ProtocolError::DataContractError( - DataContractError::CorruptedSerialization( - "required field after finished buffer in object", - ), + Some(Err(DataContractError::CorruptedSerialization( + "required field after finished buffer in object".to_string(), ))) } else { None @@ -517,20 +706,18 @@ impl DocumentPropertyType { Err(e) => Some(Err(e)), } }) - .collect::, ProtocolError>>()?; + .collect::, DataContractError>>()?; if values.is_empty() { Ok((None, false)) } else { Ok((Some(Value::Map(values)), false)) } } - DocumentPropertyType::Array(_array_field_type) => { - Err(ProtocolError::DataContractError( - DataContractError::Unsupported("serialization of arrays not yet supported"), - )) - } - DocumentPropertyType::VariableTypeArray(_) => Err(ProtocolError::DataContractError( - DataContractError::Unsupported("serialization of arrays not yet supported"), + DocumentPropertyType::Array(_array_field_type) => Err(DataContractError::Unsupported( + "serialization of arrays not yet supported".to_string(), + )), + DocumentPropertyType::VariableTypeArray(_) => Err(DataContractError::Unsupported( + "serialization of variable type arrays not yet supported".to_string(), )), } } @@ -544,17 +731,17 @@ impl DocumentPropertyType { return Ok(vec![]); } match self { - DocumentPropertyType::String(_, _) => { + DocumentPropertyType::String(_) => { if let Value::Text(value) = value { let vec = value.into_bytes(); let mut r_vec = vec.len().encode_var_vec(); r_vec.extend(vec); Ok(r_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error(&value).into()) } } - DocumentPropertyType::Date => { + DocumentPropertyType::Date | DocumentPropertyType::F64 => { let value_as_f64 = value.into_float().map_err(ProtocolError::ValueError)?; let mut value_bytes = value_as_f64.to_be_bytes().to_vec(); if required { @@ -566,31 +753,119 @@ impl DocumentPropertyType { Ok(r_vec) } } - DocumentPropertyType::Integer => { + DocumentPropertyType::U128 => { + let value_as_u128: u128 = + value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_u128.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::I128 => { + let value_as_i128: i128 = + value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_i128.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::U64 => { + let value_as_u64: u64 = value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_u64.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::I64 => { let value_as_i64: i64 = value.into_integer().map_err(ProtocolError::ValueError)?; let mut value_bytes = value_as_i64.to_be_bytes().to_vec(); if required { Ok(value_bytes) } else { - // if the value wasn't required we need to add a byte to prove it existed let mut r_vec = vec![255u8]; r_vec.append(&mut value_bytes); Ok(r_vec) } } - DocumentPropertyType::Number => { - let value_as_f64 = value.into_float().map_err(ProtocolError::ValueError)?; - let mut value_bytes = value_as_f64.to_be_bytes().to_vec(); + DocumentPropertyType::U32 => { + let value_as_u32: u32 = value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_u32.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::I32 => { + let value_as_i32: i32 = value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_i32.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::U16 => { + let value_as_u16: u16 = value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_u16.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::I16 => { + let value_as_i16: i16 = value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_i16.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::U8 => { + let value_as_u8: u8 = value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_u8.to_be_bytes().to_vec(); + if required { + Ok(value_bytes) + } else { + let mut r_vec = vec![255u8]; + r_vec.append(&mut value_bytes); + Ok(r_vec) + } + } + DocumentPropertyType::I8 => { + let value_as_i8: i8 = value.into_integer().map_err(ProtocolError::ValueError)?; + let mut value_bytes = value_as_i8.to_be_bytes().to_vec(); if required { Ok(value_bytes) } else { - // if the value wasn't required we need to add a byte to prove it existed let mut r_vec = vec![255u8]; r_vec.append(&mut value_bytes); Ok(r_vec) } } - DocumentPropertyType::ByteArray(_, _) => { + DocumentPropertyType::ByteArray(_) => { let mut bytes = value.into_binary_bytes()?; let mut r_vec = bytes.len().encode_var_vec(); @@ -605,7 +880,9 @@ impl DocumentPropertyType { Ok(r_vec) } DocumentPropertyType::Boolean => { - let value_as_boolean = value.as_bool().ok_or_else(get_field_type_matching_error)?; + let value_as_boolean = value + .as_bool() + .ok_or_else(|| get_field_type_matching_error(&value))?; // 0 means does not exist if value_as_boolean { Ok(vec![1]) // 1 is true @@ -641,7 +918,7 @@ impl DocumentPropertyType { len_prepended_vec.append(&mut r_vec); Ok(len_prepended_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error(&value).into()) } } DocumentPropertyType::Array(array_field_type) => { @@ -656,12 +933,12 @@ impl DocumentPropertyType { })?; Ok(r_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error(&value).into()) } } DocumentPropertyType::VariableTypeArray(_) => Err(ProtocolError::DataContractError( DataContractError::Unsupported( - "serialization of variable type arrays not yet supported", + "serialization of variable type arrays not yet supported".to_string(), ), )), } @@ -676,8 +953,10 @@ impl DocumentPropertyType { return Ok(vec![]); } return match self { - DocumentPropertyType::String(_, _) => { - let value_as_text = value.as_text().ok_or_else(get_field_type_matching_error)?; + DocumentPropertyType::String(_) => { + let value_as_text = value + .as_text() + .ok_or_else(|| get_field_type_matching_error(value))?; let vec = value_as_text.as_bytes().to_vec(); let mut r_vec = vec.len().encode_var_vec(); r_vec.extend(vec); @@ -697,15 +976,51 @@ impl DocumentPropertyType { Ok(r_vec) } } - DocumentPropertyType::Integer => { + DocumentPropertyType::U128 => { + let value_as_u128: u128 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_u128.to_be_bytes().to_vec()) + } + DocumentPropertyType::I128 => { + let value_as_i128: i128 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_i128.to_be_bytes().to_vec()) + } + DocumentPropertyType::U64 => { + let value_as_u64: u64 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_u64.to_be_bytes().to_vec()) + } + DocumentPropertyType::I64 => { let value_as_i64: i64 = value.to_integer().map_err(ProtocolError::ValueError)?; Ok(value_as_i64.to_be_bytes().to_vec()) } - DocumentPropertyType::Number => { + DocumentPropertyType::U32 => { + let value_as_u32: u32 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_u32.to_be_bytes().to_vec()) + } + DocumentPropertyType::I32 => { + let value_as_i32: i32 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_i32.to_be_bytes().to_vec()) + } + DocumentPropertyType::U16 => { + let value_as_u16: u16 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_u16.to_be_bytes().to_vec()) + } + DocumentPropertyType::I16 => { + let value_as_i16: i16 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_i16.to_be_bytes().to_vec()) + } + DocumentPropertyType::U8 => { + let value_as_u8: u8 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_u8.to_be_bytes().to_vec()) + } + DocumentPropertyType::I8 => { + let value_as_i8: i8 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(value_as_i8.to_be_bytes().to_vec()) + } + DocumentPropertyType::F64 => { let value_as_f64 = value.to_float().map_err(ProtocolError::ValueError)?; Ok(value_as_f64.to_be_bytes().to_vec()) } - DocumentPropertyType::ByteArray(min, max) => match (min, max) { + DocumentPropertyType::ByteArray(sizes) => match (sizes.min_size, sizes.max_size) { (Some(min), Some(max)) if min == max => Ok(value.to_binary_bytes()?), _ => { let mut bytes = value.to_binary_bytes()?; @@ -717,7 +1032,9 @@ impl DocumentPropertyType { }, DocumentPropertyType::Identifier => Ok(value.to_identifier_bytes()?), DocumentPropertyType::Boolean => { - let value_as_boolean = value.as_bool().ok_or_else(get_field_type_matching_error)?; + let value_as_boolean = value + .as_bool() + .ok_or_else(|| get_field_type_matching_error(value))?; // 0 means does not exist if value_as_boolean { Ok(vec![1]) // 1 is true @@ -727,7 +1044,7 @@ impl DocumentPropertyType { } DocumentPropertyType::Object(inner_fields) => { let Some(value_map) = value.as_map() else { - return Err(get_field_type_matching_error()); + return Err(get_field_type_matching_error(value).into()); }; let value_map = Value::map_ref_into_btree_string_map(value_map)?; let mut r_vec = vec![]; @@ -769,12 +1086,14 @@ impl DocumentPropertyType { })?; Ok(r_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error(value).into()) } } DocumentPropertyType::VariableTypeArray(_) => Err(ProtocolError::DataContractError( - DataContractError::Unsupported("serialization of arrays not yet supported"), + DataContractError::Unsupported( + "serialization of arrays not yet supported".to_string(), + ), )), }; } @@ -785,8 +1104,10 @@ impl DocumentPropertyType { return Ok(vec![]); } match self { - DocumentPropertyType::String(_, _) => { - let value_as_text = value.as_text().ok_or_else(get_field_type_matching_error)?; + DocumentPropertyType::String(_) => { + let value_as_text = value + .as_text() + .ok_or_else(|| get_field_type_matching_error(value))?; let vec = value_as_text.as_bytes().to_vec(); if vec.is_empty() { // we don't want to collide with the definition of an empty string @@ -795,25 +1116,62 @@ impl DocumentPropertyType { Ok(vec) } } - DocumentPropertyType::Date => DocumentPropertyType::encode_date_timestamp( + DocumentPropertyType::Date => Ok(DocumentPropertyType::encode_date_timestamp( value.to_integer().map_err(ProtocolError::ValueError)?, - ), - DocumentPropertyType::Integer => { + )), + DocumentPropertyType::U128 => { + let value_as_u128 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_u128(value_as_u128)) + } + DocumentPropertyType::I128 => { + let value_as_i128 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_i128(value_as_i128)) + } + DocumentPropertyType::U64 => { + let value_as_u64 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_u64(value_as_u64)) + } + DocumentPropertyType::I64 => { let value_as_i64 = value.to_integer().map_err(ProtocolError::ValueError)?; - - DocumentPropertyType::encode_signed_integer(value_as_i64) + Ok(DocumentPropertyType::encode_i64(value_as_i64)) + } + DocumentPropertyType::U32 => { + let value_as_u32 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_u32(value_as_u32)) + } + DocumentPropertyType::I32 => { + let value_as_i32 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_i32(value_as_i32)) + } + DocumentPropertyType::U16 => { + let value_as_u16 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_u16(value_as_u16)) } - DocumentPropertyType::Number => Ok(Self::encode_float( + DocumentPropertyType::I16 => { + let value_as_i16 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_i16(value_as_i16)) + } + DocumentPropertyType::U8 => { + let value_as_u8 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_u8(value_as_u8)) + } + DocumentPropertyType::I8 => { + let value_as_i8 = value.to_integer().map_err(ProtocolError::ValueError)?; + Ok(DocumentPropertyType::encode_i8(value_as_i8)) + } + DocumentPropertyType::F64 => Ok(Self::encode_float( value.to_float().map_err(ProtocolError::ValueError)?, )), - DocumentPropertyType::ByteArray(_, _) => { + DocumentPropertyType::ByteArray(_) => { value.to_binary_bytes().map_err(ProtocolError::ValueError) } DocumentPropertyType::Identifier => value .to_identifier_bytes() .map_err(ProtocolError::ValueError), DocumentPropertyType::Boolean => { - let value_as_boolean = value.as_bool().ok_or_else(get_field_type_matching_error)?; + let value_as_boolean = value + .as_bool() + .ok_or_else(|| get_field_type_matching_error(value))?; if value_as_boolean { Ok(vec![1]) } else { @@ -822,13 +1180,136 @@ impl DocumentPropertyType { } DocumentPropertyType::Object(_) => Err(ProtocolError::DataContractError( DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an object", + "we should never try encoding an object".to_string(), + ), + )), + DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { + Err(ProtocolError::DataContractError( + DataContractError::EncodingDataStructureNotSupported( + "we should never try encoding an array".to_string(), + ), + )) + } + } + } + + // Given a field type and a Vec this function chooses and executes the right decoding method + pub fn decode_value_for_tree_keys(&self, value: &[u8]) -> Result { + if value.is_empty() { + return Ok(Value::Null); + } + match self { + DocumentPropertyType::String(_) => { + if value == &vec![0] { + // we don't want to collide with the definition of an empty string + Ok(Value::Text("".to_string())) + } else { + Ok(Value::Text(String::from_utf8(value.to_vec()).map_err( + |_| { + ProtocolError::DecodingError( + "could not decode utf8 bytes into string".to_string(), + ) + }, + )?)) + } + } + DocumentPropertyType::Date => { + let timestamp = DocumentPropertyType::decode_date_timestamp(value).ok_or( + ProtocolError::DecodingError("could not decode data timestamp".to_string()), + )?; + Ok(Value::U64(timestamp)) + } + DocumentPropertyType::U128 => { + let integer = DocumentPropertyType::decode_u128(value).ok_or( + ProtocolError::DecodingError("could not decode u128".to_string()), + )?; + Ok(Value::U128(integer)) + } + DocumentPropertyType::I128 => { + let integer = DocumentPropertyType::decode_i128(value).ok_or( + ProtocolError::DecodingError("could not decode i128".to_string()), + )?; + Ok(Value::I128(integer)) + } + DocumentPropertyType::U64 => { + let integer = DocumentPropertyType::decode_u64(value).ok_or( + ProtocolError::DecodingError("could not decode u64".to_string()), + )?; + Ok(Value::U64(integer)) + } + DocumentPropertyType::I64 => { + let integer = DocumentPropertyType::decode_i64(value).ok_or( + ProtocolError::DecodingError("could not decode i64".to_string()), + )?; + Ok(Value::I64(integer)) + } + DocumentPropertyType::U32 => { + let integer = DocumentPropertyType::decode_u32(value).ok_or( + ProtocolError::DecodingError("could not decode u32".to_string()), + )?; + Ok(Value::U32(integer)) + } + DocumentPropertyType::I32 => { + let integer = DocumentPropertyType::decode_i32(value).ok_or( + ProtocolError::DecodingError("could not decode i32".to_string()), + )?; + Ok(Value::I32(integer)) + } + DocumentPropertyType::U16 => { + let integer = DocumentPropertyType::decode_u16(value).ok_or( + ProtocolError::DecodingError("could not decode u16".to_string()), + )?; + Ok(Value::U16(integer)) + } + DocumentPropertyType::I16 => { + let integer = DocumentPropertyType::decode_i16(value).ok_or( + ProtocolError::DecodingError("could not decode i16".to_string()), + )?; + Ok(Value::I16(integer)) + } + DocumentPropertyType::U8 => { + let integer = DocumentPropertyType::decode_u8(value).ok_or( + ProtocolError::DecodingError("could not decode u8".to_string()), + )?; + Ok(Value::U8(integer)) + } + DocumentPropertyType::I8 => { + let integer = DocumentPropertyType::decode_i8(value).ok_or( + ProtocolError::DecodingError("could not decode i8".to_string()), + )?; + Ok(Value::I8(integer)) + } + DocumentPropertyType::F64 => { + let float = DocumentPropertyType::decode_float(value).ok_or( + ProtocolError::DecodingError("could not decode float".to_string()), + )?; + Ok(Value::Float(float)) + } + DocumentPropertyType::ByteArray(_) => Ok(Value::Bytes(value.to_vec())), + DocumentPropertyType::Identifier => { + let identifier = Identifier::from_bytes(value)?; + Ok(identifier.into()) + } + DocumentPropertyType::Boolean => { + if value == &vec![0] { + Ok(Value::Bool(false)) + } else if value == &vec![1] { + Ok(Value::Bool(true)) + } else { + Err(ProtocolError::DecodingError( + "could not decode bool".to_string(), + )) + } + } + DocumentPropertyType::Object(_) => Err(ProtocolError::DataContractError( + DataContractError::EncodingDataStructureNotSupported( + "we should never try decoding an object".to_string(), ), )), DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { Err(ProtocolError::DataContractError( DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an array", + "we should never try decoding an array".to_string(), ), )) } @@ -836,60 +1317,106 @@ impl DocumentPropertyType { } // Given a field type and a value this function chooses and executes the right encoding method - pub fn value_from_string(&self, str: &str) -> Result { + pub fn value_from_string(&self, str: &str) -> Result { match self { - DocumentPropertyType::String(min, max) => { - if let Some(min) = min { - if str.len() < *min as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("string is too small"), + DocumentPropertyType::String(sizes) => { + if let Some(min) = sizes.min_length { + if str.len() < min as usize { + return Err(DataContractError::FieldRequirementUnmet( + "string is too small".to_string(), )); } } - if let Some(max) = max { - if str.len() > *max as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("string is too big"), + if let Some(max) = sizes.max_length { + if str.len() > max as usize { + return Err(DataContractError::FieldRequirementUnmet( + "string is too big".to_string(), )); } } Ok(Value::Text(str.to_string())) } - DocumentPropertyType::Integer => str.parse::().map(Value::I128).map_err(|_| { - ProtocolError::DataContractError(DataContractError::ValueWrongType( - "value is not an integer from string", - )) + DocumentPropertyType::U128 => str.parse::().map(Value::U128).map_err(|_| { + DataContractError::ValueWrongType( + "value is not a u128 integer from string".to_string(), + ) + }), + DocumentPropertyType::I128 => str.parse::().map(Value::I128).map_err(|_| { + DataContractError::ValueWrongType( + "value is not an i128 integer from string".to_string(), + ) + }), + DocumentPropertyType::U64 => str.parse::().map(Value::U64).map_err(|_| { + DataContractError::ValueWrongType( + "value is not a u64 integer from string".to_string(), + ) + }), + DocumentPropertyType::I64 => str.parse::().map(Value::I64).map_err(|_| { + DataContractError::ValueWrongType( + "value is not an i64 integer from string".to_string(), + ) + }), + DocumentPropertyType::U32 => str.parse::().map(Value::U32).map_err(|_| { + DataContractError::ValueWrongType( + "value is not a u32 integer from string".to_string(), + ) + }), + DocumentPropertyType::I32 => str.parse::().map(Value::I32).map_err(|_| { + DataContractError::ValueWrongType( + "value is not an i32 integer from string".to_string(), + ) + }), + DocumentPropertyType::U16 => str.parse::().map(Value::U16).map_err(|_| { + DataContractError::ValueWrongType( + "value is not a u16 integer from string".to_string(), + ) }), - DocumentPropertyType::Number | DocumentPropertyType::Date => { + DocumentPropertyType::I16 => str.parse::().map(Value::I16).map_err(|_| { + DataContractError::ValueWrongType( + "value is not an i16 integer from string".to_string(), + ) + }), + DocumentPropertyType::U8 => str.parse::().map(Value::U8).map_err(|_| { + DataContractError::ValueWrongType( + "value is not a u8 integer from string".to_string(), + ) + }), + DocumentPropertyType::I8 => str.parse::().map(Value::I8).map_err(|_| { + DataContractError::ValueWrongType( + "value is not an i8 integer from string".to_string(), + ) + }), + DocumentPropertyType::F64 | DocumentPropertyType::Date => { str.parse::().map(Value::Float).map_err(|_| { - ProtocolError::DataContractError(DataContractError::ValueWrongType( - "value is not a float from string", - )) + DataContractError::ValueWrongType( + "value is not a float from string".to_string(), + ) }) } - DocumentPropertyType::ByteArray(min, max) => { - if let Some(min) = min { - if str.len() / 2 < *min as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("byte array is too small"), + DocumentPropertyType::ByteArray(sizes) => { + if let Some(min) = sizes.min_size { + if str.len() / 2 < min as usize { + return Err(DataContractError::FieldRequirementUnmet( + "byte array is too small".to_string(), )); } } - if let Some(max) = max { - if str.len() / 2 > *max as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("byte array is too big"), + if let Some(max) = sizes.max_size { + if str.len() / 2 > max as usize { + return Err(DataContractError::FieldRequirementUnmet( + "byte array is too big".to_string(), )); } } Ok(Value::Bytes(hex::decode(str).map_err(|_| { - ProtocolError::DataContractError(DataContractError::ValueDecodingError( - "could not parse hex bytes", - )) + DataContractError::ValueDecodingError("could not parse hex bytes".to_string()) })?)) } DocumentPropertyType::Identifier => Ok(Value::Identifier( - Value::Text(str.to_owned()).to_identifier()?.into_buffer(), + Value::Text(str.to_owned()) + .to_identifier() + .map_err(|e| DataContractError::ValueDecodingError(format!("{:?}", e)))? + .into_buffer(), )), DocumentPropertyType::Boolean => { if str.to_lowercase().as_str() == "true" { @@ -897,33 +1424,33 @@ impl DocumentPropertyType { } else if str.to_lowercase().as_str() == "false" { Ok(Value::Bool(false)) } else { - Err(ProtocolError::DataContractError( - DataContractError::ValueDecodingError( - "could not parse a boolean to a value", - ), + Err(DataContractError::ValueDecodingError( + "could not parse a boolean to a value".to_string(), )) } } - DocumentPropertyType::Object(_) => Err(ProtocolError::DataContractError( - DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an object", - ), - )), + DocumentPropertyType::Object(_) => { + Err(DataContractError::EncodingDataStructureNotSupported( + "we should never try encoding an object".to_string(), + )) + } DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { - Err(ProtocolError::DataContractError( - DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an array", - ), + Err(DataContractError::EncodingDataStructureNotSupported( + "we should never try encoding an array".to_string(), )) } } } - pub fn encode_date_timestamp(val: TimestampMillis) -> Result, ProtocolError> { - Self::encode_unsigned_integer(val) + pub fn encode_date_timestamp(val: TimestampMillis) -> Vec { + Self::encode_u64(val) + } + + pub fn decode_date_timestamp(val: &[u8]) -> Option { + Self::decode_u64(val) } - pub fn encode_unsigned_integer(val: u64) -> Result, ProtocolError> { + pub fn encode_u128(val: u128) -> Vec { // Positive integers are represented in binary with the signed bit set to 0 // Negative integers are represented in 2's complement form @@ -933,7 +1460,7 @@ impl DocumentPropertyType { // and a bigger negative number would be greater than a smaller one // maintains sort order for each domain let mut wtr = vec![]; - wtr.write_u64::(val).unwrap(); + wtr.write_u128::(val).unwrap(); // Flip the sign bit // to deal with interaction between the domains @@ -945,10 +1472,32 @@ impl DocumentPropertyType { // change was uniform across all elements wtr[0] ^= 0b1000_0000; - Ok(wtr) + wtr + } + + /// Decodes an unsigned integer on 128 bits. + pub fn decode_u128(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_u128::().ok() } - pub fn encode_signed_integer(val: i64) -> Result, ProtocolError> { + pub fn encode_i128(val: i128) -> Vec { // Positive integers are represented in binary with the signed bit set to 0 // Negative integers are represented in 2's complement form @@ -958,7 +1507,7 @@ impl DocumentPropertyType { // and a bigger negative number would be greater than a smaller one // maintains sort order for each domain let mut wtr = vec![]; - wtr.write_i64::(val).unwrap(); + wtr.write_i128::(val).unwrap(); // Flip the sign bit // to deal with interaction between the domains @@ -970,17 +1519,410 @@ impl DocumentPropertyType { // change was uniform across all elements wtr[0] ^= 0b1000_0000; - Ok(wtr) + wtr } - pub fn encode_float(val: f64) -> Vec { - // Floats are represented based on the IEEE 754-2008 standard - // [sign bit] [biased exponent] [mantissa] - - // when comparing floats, the sign bit has the greatest impact - // any positive number is greater than all negative numbers - // if the numbers come from the same domain then the exponent is the next factor to consider - // the exponent gives a sense of how many digits are in the non fractional part of the number + pub fn decode_i128(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_i128::().ok() + } + + pub fn encode_u64(val: u64) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u64::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + /// Decodes an unsigned integer on 64 bits. + pub fn decode_u64(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_u64::().ok() + } + + pub fn encode_i64(val: i64) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_i64::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + pub fn decode_i64(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_i64::().ok() + } + + pub fn encode_u32(val: u32) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u32::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + /// Decodes an unsigned integer on 32 bits. + pub fn decode_u32(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_u32::().ok() + } + + pub fn encode_i32(val: i32) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_i32::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + pub fn decode_i32(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_i32::().ok() + } + + pub fn encode_u16(val: u16) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u16::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + /// Decodes an unsigned integer on 32 bits. + pub fn decode_u16(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_u16::().ok() + } + + pub fn encode_i16(val: i16) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_i16::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + pub fn decode_i16(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_i16::().ok() + } + + pub fn encode_u8(val: u8) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u8(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + /// Decodes an unsigned integer on 8 bits. + pub fn decode_u8(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_u8().ok() + } + + pub fn encode_i8(val: i8) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_i8(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr + } + + pub fn decode_i8(val: &[u8]) -> Option { + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_i8().ok() + } + + pub fn encode_float(val: f64) -> Vec { + // Floats are represented based on the IEEE 754-2008 standard + // [sign bit] [biased exponent] [mantissa] + + // when comparing floats, the sign bit has the greatest impact + // any positive number is greater than all negative numbers + // if the numbers come from the same domain then the exponent is the next factor to consider + // the exponent gives a sense of how many digits are in the non fractional part of the number // for example in base 10, 10 has an exponent of 1 (1.0 * 10^1) // while 5000 (5.0 * 10^3) has an exponent of 3 // for the positive domain, the bigger the exponent the larger the number i.e 5000 > 10 @@ -1011,10 +1953,32 @@ impl DocumentPropertyType { wtr } + + /// Decodes a float on 64 bits. + pub fn decode_float(encoded: &[u8]) -> Option { + // Check if the value is negative by looking at the original sign bit + let is_negative = (encoded[0] & 0b1000_0000) == 0; + + // Create a mutable copy of the encoded vector to apply transformations + let mut wtr = encoded.to_vec(); + + if is_negative { + // For originally negative values, flip all the bits back + wtr = wtr.iter().map(|byte| !byte).collect(); + } else { + // For originally positive values, just flip the sign bit back + wtr[0] ^= 0b1000_0000; + } + + // Read the float value from the transformed vector + let mut cursor = Cursor::new(wtr); + cursor.read_f64::().ok() + } } -fn get_field_type_matching_error() -> ProtocolError { - ProtocolError::DataContractError(DataContractError::ValueWrongType( - "document field type doesn't match document value", +fn get_field_type_matching_error(value: &Value) -> DataContractError { + DataContractError::ValueWrongType(format!( + "document field type doesn't match \"{}\" document value", + value )) } diff --git a/packages/rs-dpp/src/data_contract/document_type/random_document.rs b/packages/rs-dpp/src/data_contract/document_type/random_document.rs index 3b8f542a7a7..9f98397ef9c 100644 --- a/packages/rs-dpp/src/data_contract/document_type/random_document.rs +++ b/packages/rs-dpp/src/data_contract/document_type/random_document.rs @@ -1,11 +1,14 @@ +use bincode::{Decode, Encode}; + +use platform_value::{Bytes32, Identifier}; +use rand::prelude::StdRng; + use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; use crate::document::Document; use crate::identity::Identity; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; use crate::version::PlatformVersion; use crate::ProtocolError; -use bincode::{Decode, Encode}; -use platform_value::{Bytes32, Identifier}; -use rand::prelude::StdRng; #[derive(Clone, Copy, Debug, Eq, PartialEq, Encode, Decode)] pub enum DocumentFieldFillType { @@ -28,38 +31,98 @@ pub enum DocumentFieldFillSize { // TODO The factory is used in benchmark and tests. Probably it should be available under the test feature /// Functions for creating various types of random documents. pub trait CreateRandomDocument { - /// Random documents with DoNotFillIfNotRequired and AnyDocumentFillSize + /// Generates a single random document, employing default behavior for document field + /// filling where fields that are not required will not be filled (`DoNotFillIfNotRequired`) and + /// any fill size that is contractually allowed may be used (`AnyDocumentFillSize`). + /// This method provides a straightforward way to create a document with random data, with an + /// optional seed for deterministic randomness. + /// + /// # Parameters: + /// - `seed`: An optional seed value for initializing the random number generator for deterministic outcomes. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. + fn random_document( + &self, + seed: Option, + platform_version: &PlatformVersion, + ) -> Result; + + /// Generates a single random document using a specified random number generator. Applies default behavior + /// for filling document fields, not filling those that are not required and using any fill size allowed by + /// the contract. + /// + /// # Parameters: + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. + fn random_document_with_rng( + &self, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result; + + /// Generates a specified number of random documents, employing default behavior for document field + /// filling where fields that are not required will not be filled (`DoNotFillIfNotRequired`) and + /// any fill size that is contractually allowed may be used (`AnyDocumentFillSize`). This method + /// is particularly useful for generating test documents or simulating documents in a variety of + /// sizes and completeness. + /// + /// # Parameters: + /// - `count`: The number of random documents to generate. + /// - `seed`: An optional seed value for initializing the random number generator for deterministic outcomes. + /// - `platform_version`: The version of the platform for which these documents are being generated. + /// + /// # Returns: + /// A `Result, ProtocolError>`, which is `Ok` containing a vector of documents if successful, + /// or an error if the operation fails. fn random_documents( &self, count: u32, seed: Option, platform_version: &PlatformVersion, ) -> Result, ProtocolError>; - /// Random documents with rng + + /// Generates a specified number of random documents using a specific random number generator (`rng`). + /// Default document field filling behavior is applied, where not required fields are not filled and any + /// fill size allowed by the contract may be used. This allows for controlled randomness in the document + /// generation process. + /// + /// # Parameters: + /// - `count`: The number of random documents to generate. + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which these documents are being generated. + /// + /// # Returns: + /// A `Result, ProtocolError>`, which is `Ok` containing a vector of documents if successful, + /// or an error if the operation fails. fn random_documents_with_rng( &self, count: u32, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> Result, ProtocolError>; - /// Creates `count` Documents with random data using the random number generator given. - fn random_documents_with_params( - &self, - count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Result, ProtocolError>; - /// Random document - fn random_document( - &self, - seed: Option, - platform_version: &PlatformVersion, - ) -> Result; - /// Creates a document with a random id, owner id, and properties using StdRng. + + /// Generates a single random document with a specified identifier and entropy values, using a given + /// random number generator. Defaults to not filling non-required fields and allowing any fill size, + /// unless specified otherwise through `document_field_fill_type` and `document_field_fill_size`. + /// + /// # Parameters: + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `owner_id`: The identifier for the owner of the document. + /// - `entropy`: A Bytes32 value to influence the randomness. + /// - `document_field_fill_type`: Specifies how document fields should be filled. + /// - `document_field_fill_size`: Specifies the size of the content to fill document fields with. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. fn random_document_with_identifier_and_entropy( &self, rng: &mut StdRng, @@ -69,88 +132,131 @@ pub trait CreateRandomDocument { document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result; - /// Random document with rng - fn random_document_with_rng( - &self, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Result; - /// Creates a document with a random id, owner id, and properties using StdRng. + + /// Generates a single random document with specified parameters for customization, using a given + /// random number generator. Defaults to not filling non-required fields and allowing any fill size + /// unless explicitly specified through `document_field_fill_type` and `document_field_fill_size`. + /// + /// # Parameters: + /// - `owner_id`: The identifier for the owner of the document. + /// - `entropy`: A Bytes32 value to influence the randomness. + /// - `time_ms`: An optional timestamp in milliseconds. + /// - `block_height`: An optional block height to be used in created_at_block_height/updated_at_block_height. Will default to 0 if required but not provided. + /// - `core_block_height`: An optional core block height to be used in created_at_core_block_height/updated_at_core_block_height. Will default to 0 if required but not provided. + /// - `document_field_fill_type`: Specifies how document fields should be filled. + /// - `document_field_fill_size`: Specifies the size of the content to fill document fields with. + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. fn random_document_with_params( &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> Result; + + /// Generates a specified number of random documents with additional parameters for customization, including + /// identities, timestamps, block heights, and specific document field filling strategies. + /// + /// # Parameters: + /// - `count`: The number of random documents to generate. + /// - `identities`: An array of `Identity` objects to associate with the documents. + /// - `time_ms`: An optional timestamp in milliseconds. + /// - `block_height`: An optional block height to be used in created_at_block_height/updated_at_block_height. Will default to 0 if required but not provided. + /// - `core_block_height`: An optional core block height to be used in created_at_core_block_height/updated_at_core_block_height. Will default to 0 if required but not provided. + /// - `document_field_fill_type`: Specifies how document fields should be filled. + /// - `document_field_fill_size`: Specifies the size of the content to fill document fields with. + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which these documents are being generated. + /// + /// # Returns: + /// A `Result, ProtocolError>` which is `Ok` containing a vector of tuples + /// if successful, each tuple consisting of a Document, its associated Identity, and a Bytes32 value, or an error + /// if the operation fails. + fn random_documents_with_params<'i>( + &self, + count: u32, + identities: &[&'i Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError>; } impl CreateRandomDocument for DocumentType { - fn random_documents( + fn random_document( &self, - count: u32, seed: Option, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentType::V0(v0) => v0.random_documents(count, seed, platform_version), + DocumentType::V0(v0) => v0.random_document(seed, platform_version), } } - fn random_documents_with_rng( + fn random_document_with_rng( &self, - count: u32, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentType::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), + DocumentType::V0(v0) => v0.random_document_with_rng(rng, platform_version), } } - fn random_documents_with_params( + fn random_documents( &self, count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, - rng: &mut StdRng, + seed: Option, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result, ProtocolError> { match self { - DocumentType::V0(v0) => v0.random_documents_with_params( - count, - identities, - time_ms, - document_field_fill_type, - document_field_fill_size, - rng, - platform_version, - ), // Add more cases as necessary for other variants + DocumentType::V0(v0) => v0.random_documents(count, seed, platform_version), } } - fn random_document( + fn random_documents_with_rng( &self, - seed: Option, + count: u32, + rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentType::V0(v0) => v0.random_document(seed, platform_version), + DocumentType::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), } } - fn random_document_with_rng( + fn random_document_with_identifier_and_entropy( &self, rng: &mut StdRng, + owner_id: Identifier, + entropy: Bytes32, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result { match self { - DocumentType::V0(v0) => v0.random_document_with_rng(rng, platform_version), + DocumentType::V0(v0) => v0.random_document_with_identifier_and_entropy( + rng, + owner_id, + entropy, + document_field_fill_type, + document_field_fill_size, + platform_version, + ), } } @@ -158,7 +264,9 @@ impl CreateRandomDocument for DocumentType { &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, @@ -169,6 +277,8 @@ impl CreateRandomDocument for DocumentType { owner_id, entropy, time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, rng, @@ -176,22 +286,28 @@ impl CreateRandomDocument for DocumentType { ), // Add more cases as necessary for other variants } } - fn random_document_with_identifier_and_entropy( + fn random_documents_with_params<'i>( &self, - rng: &mut StdRng, - owner_id: Identifier, - entropy: Bytes32, + count: u32, + identities: &[&'i Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentType::V0(v0) => v0.random_document_with_identifier_and_entropy( - rng, - owner_id, - entropy, + DocumentType::V0(v0) => v0.random_documents_with_params( + count, + identities, + time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, + rng, platform_version, ), } @@ -199,68 +315,66 @@ impl CreateRandomDocument for DocumentType { } impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { - fn random_documents( + fn random_document( &self, - count: u32, seed: Option, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentTypeRef::V0(v0) => v0.random_documents(count, seed, platform_version), + DocumentTypeRef::V0(v0) => v0.random_document(seed, platform_version), } } - fn random_documents_with_rng( + fn random_document_with_rng( &self, - count: u32, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentTypeRef::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), + DocumentTypeRef::V0(v0) => v0.random_document_with_rng(rng, platform_version), } } - fn random_documents_with_params( + fn random_documents( &self, count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, - rng: &mut StdRng, + seed: Option, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result, ProtocolError> { match self { - DocumentTypeRef::V0(v0) => v0.random_documents_with_params( - count, - identities, - time_ms, - document_field_fill_type, - document_field_fill_size, - rng, - platform_version, - ), // Add more cases as necessary for other variants + DocumentTypeRef::V0(v0) => v0.random_documents(count, seed, platform_version), } } - fn random_document( + fn random_documents_with_rng( &self, - seed: Option, + count: u32, + rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentTypeRef::V0(v0) => v0.random_document(seed, platform_version), + DocumentTypeRef::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), } } - fn random_document_with_rng( + fn random_document_with_identifier_and_entropy( &self, rng: &mut StdRng, + owner_id: Identifier, + entropy: Bytes32, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result { match self { - DocumentTypeRef::V0(v0) => v0.random_document_with_rng(rng, platform_version), + DocumentTypeRef::V0(v0) => v0.random_document_with_identifier_and_entropy( + rng, + owner_id, + entropy, + document_field_fill_type, + document_field_fill_size, + platform_version, + ), } } @@ -268,7 +382,9 @@ impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, @@ -279,6 +395,8 @@ impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { owner_id, entropy, time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, rng, @@ -287,24 +405,30 @@ impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { } } - fn random_document_with_identifier_and_entropy( + fn random_documents_with_params<'i>( &self, - rng: &mut StdRng, - owner_id: Identifier, - entropy: Bytes32, + count: u32, + identities: &[&'i Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentTypeRef::V0(v0) => v0.random_document_with_identifier_and_entropy( - rng, - owner_id, - entropy, + DocumentTypeRef::V0(v0) => v0.random_documents_with_params( + count, + identities, + time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, + rng, platform_version, - ), + ), // Add more cases as necessary for other variants } } } diff --git a/packages/rs-dpp/src/data_contract/document_type/restricted_creation/mod.rs b/packages/rs-dpp/src/data_contract/document_type/restricted_creation/mod.rs new file mode 100644 index 00000000000..81194382f46 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/restricted_creation/mod.rs @@ -0,0 +1,44 @@ +use crate::consensus::basic::data_contract::UnknownDocumentCreationRestrictionModeError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::ProtocolError; +use std::fmt; +use std::fmt::{Display, Formatter}; + +#[derive(Debug, PartialEq, Clone, Copy, Eq, Encode, Decode)] +pub enum CreationRestrictionMode { + NoRestrictions, + OwnerOnly, + NoCreationAllowed, +} + +impl Display for CreationRestrictionMode { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + match self { + CreationRestrictionMode::NoRestrictions => write!(f, "No Restrictions"), + CreationRestrictionMode::OwnerOnly => write!(f, "Owner Only"), + CreationRestrictionMode::NoCreationAllowed => write!(f, "No Creation Allowed"), + } + } +} + +impl TryFrom for CreationRestrictionMode { + type Error = ProtocolError; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(Self::NoRestrictions), + 1 => Ok(Self::OwnerOnly), + 2 => Ok(Self::NoCreationAllowed), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError( + BasicError::UnknownDocumentCreationRestrictionModeError( + UnknownDocumentCreationRestrictionModeError::new(vec![0, 1, 2], value), + ), + ) + .into(), + )), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs index 1cda5bc717b..dc7019cf7a2 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs @@ -1,26 +1,37 @@ mod v0; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::data_contract::document_type::DocumentType; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; -pub fn enrich_with_base_schema( - schema: Value, - schema_defs: Option, - platform_version: &PlatformVersion, -) -> Result { - match platform_version - .dpp - .contract_versions - .document_type_versions - .schema - .enrich_with_base_schema - { - 0 => v0::enrich_with_base_schema_v0(schema, schema_defs), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "enrich_with_base_schema".to_string(), - known_versions: vec![0], - received: version, - }), +impl DocumentType { + pub fn enrich_with_base_schema( + schema: Value, + schema_defs: Option, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .document_type_versions + .schema + .enrich_with_base_schema + { + 0 => Ok( + v0::enrich_with_base_schema_v0(schema, schema_defs).map_err(|e| { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ContractError(e)).into(), + ) + })?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "enrich_with_base_schema".to_string(), + known_versions: vec![0], + received: version, + }), + } } } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs index 87730098b36..3560e2b9308 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs @@ -1,7 +1,6 @@ use crate::data_contract::document_type::property_names; use crate::data_contract::errors::DataContractError; use crate::data_contract::serialized_version::v0::property_names as contract_property_names; -use crate::ProtocolError; use platform_value::{Value, ValueMapHelper}; pub const DATA_CONTRACT_SCHEMA_URI_V0: &str = @@ -9,24 +8,33 @@ pub const DATA_CONTRACT_SCHEMA_URI_V0: &str = pub const PROPERTY_SCHEMA: &str = "$schema"; -const TIMESTAMPS: [&str; 2] = ["$createdAt", "$updatedAt"]; +const SYSTEM_GENERATED_FIELDS: [&str; 9] = [ + "$createdAt", + "$updatedAt", + "$transferredAt", + "$createdAtBlockHeight", + "$updatedAtBlockHeight", + "$transferredAtBlockHeight", + "$createdAtCoreBlockHeight", + "$updatedAtCoreBlockHeight", + "$transferredAtCoreBlockHeight", +]; -pub fn enrich_with_base_schema_v0( +#[inline(always)] +pub(super) fn enrich_with_base_schema_v0( mut schema: Value, schema_defs: Option, -) -> Result { +) -> Result { let schema_map = schema.to_map_mut().map_err(|err| { - ProtocolError::DataContractError(DataContractError::InvalidContractStructure(format!( + DataContractError::InvalidContractStructure(format!( "document schema must be an object: {err}" - ))) + )) })?; // Add $schema if schema_map.get_optional_key(PROPERTY_SCHEMA).is_some() { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "document schema shouldn't contain '$schema' property".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "document schema shouldn't contain '$schema' property".to_string(), )); } @@ -40,20 +48,26 @@ pub fn enrich_with_base_schema_v0( .get_optional_key(contract_property_names::DEFINITIONS) .is_some() { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "document schema shouldn't contain '$schema' property".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "document schema shouldn't contain '$defs' property".to_string(), )); } - // Remove $createdAt and $updatedAt from JSON Schema since they aren't part of + if let Some(schema_defs) = schema_defs { + schema_map.insert_string_key_value( + contract_property_names::DEFINITIONS.to_string(), + schema_defs, + ) + } + + // Remove $createdAt, $updatedAt and $transferredAt and their height and core height variants + // from JSON Schema since they aren't part of // dynamic (user defined) document data which is validating against the schema if let Some(required) = schema_map.get_optional_key_mut(property_names::REQUIRED) { if let Some(required_array) = required.as_array_mut() { required_array.retain(|field_value| { if let Some(field) = field_value.as_text() { - !TIMESTAMPS.contains(&field) + !SYSTEM_GENERATED_FIELDS.contains(&field) } else { true } @@ -61,12 +75,5 @@ pub fn enrich_with_base_schema_v0( } } - if let Some(schema_defs) = schema_defs { - schema_map.insert_string_key_value( - contract_property_names::DEFINITIONS.to_string(), - schema_defs, - ) - } - Ok(schema) } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs index 7eeda7217e1..a8f97466e78 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs @@ -4,7 +4,7 @@ use crate::data_contract::document_type::DocumentType; use crate::version::dpp_versions::DocumentTypeVersions; use crate::ProtocolError; use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; mod v0; diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs index f2a0b4a209b..3fc2259f7ef 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs @@ -3,15 +3,17 @@ use crate::data_contract::document_type::property::{DocumentProperty, DocumentPr use crate::data_contract::document_type::v0::DocumentTypeV0; use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; impl DocumentTypeV0 { + #[inline(always)] pub(super) fn find_identifier_and_binary_paths_v0( properties: &IndexMap, ) -> (BTreeSet, BTreeSet) { Self::find_identifier_and_binary_paths_inner(properties, "") } + #[inline(always)] fn find_identifier_and_binary_paths_inner( properties: &IndexMap, current_path: &str, @@ -30,7 +32,7 @@ impl DocumentTypeV0 { DocumentPropertyType::Identifier => { identifier_paths.insert(new_path); } - DocumentPropertyType::ByteArray(_, _) => { + DocumentPropertyType::ByteArray(_) => { binary_paths.insert(new_path); } DocumentPropertyType::Object(inner_properties) => { diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs index 7016579b690..169953690a5 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs @@ -1,8 +1,6 @@ mod enrich_with_base_schema; -pub use enrich_with_base_schema::*; mod find_identifier_and_binary_paths; -pub use find_identifier_and_binary_paths::*; #[cfg(feature = "validation")] mod recursive_schema_validator; diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/mod.rs deleted file mode 100644 index da24750e5d1..00000000000 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/mod.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Value; -use platform_version::version::PlatformVersion; - -mod v0; - -pub fn byte_array_has_no_items_as_parent_validator( - path: &str, - key: &str, - parent: &Value, - value: &Value, - result: &mut SimpleConsensusValidationResult, - platform_version: &PlatformVersion, -) -> Result<(), ProtocolError> { - match platform_version - .dpp - .contract_versions - .document_type_versions - .schema - .recursive_schema_validator_versions - .byte_array_has_no_items_as_parent_validator - { - 0 => { - v0::byte_array_has_no_items_as_parent_validator_v0(path, key, parent, value, result); - Ok(()) - } - version => Err(ProtocolError::UnknownVersionMismatch { - method: "byte_array_has_no_items_as_parent_validator".to_string(), - known_versions: vec![0], - received: version, - }), - } -} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/v0/mod.rs deleted file mode 100644 index 1cdde43291e..00000000000 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/v0/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -use crate::consensus::basic::json_schema_compilation_error::JsonSchemaCompilationError; -use crate::consensus::basic::value_error::ValueError; -use crate::consensus::basic::BasicError; -use crate::consensus::ConsensusError; -use crate::validation::SimpleConsensusValidationResult; -use platform_value::Value; - -pub fn byte_array_has_no_items_as_parent_validator_v0( - path: &str, - key: &str, - parent: &Value, - value: &Value, - result: &mut SimpleConsensusValidationResult, -) { - if key == "byteArray" - && value.is_bool() - && (unwrap_error_to_result( - parent.get("items").map_err(|e| { - ConsensusError::BasicError(BasicError::ValueError(ValueError::new(e))) - }), - result, - ) - .is_some() - || unwrap_error_to_result( - parent.get("prefixItems").map_err(|e| { - ConsensusError::BasicError(BasicError::ValueError(ValueError::new(e))) - }), - result, - ) - .is_some()) - { - let compilation_error = format!( - "invalid path: '{}': byteArray cannot be used with 'items' or 'prefixItems", - path - ); - result.add_error(BasicError::JsonSchemaCompilationError( - JsonSchemaCompilationError::new(compilation_error), - )); - } -} - -fn unwrap_error_to_result<'a>( - v: Result, ConsensusError>, - result: &mut SimpleConsensusValidationResult, -) -> Option<&'a Value> { - match v { - Ok(v) => v, - Err(e) => { - result.add_error(e); - None - } - } -} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs index 15a5377cd91..9fcd16358c3 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs @@ -1,26 +1,23 @@ -mod byte_array_has_no_items_as_parent_validator; -pub use byte_array_has_no_items_as_parent_validator::*; -mod pattern_is_valid_regex_validator; -pub use pattern_is_valid_regex_validator::*; mod traversal_validator; pub use traversal_validator::*; #[cfg(test)] mod test { + use super::*; use crate::consensus::basic::BasicError; use crate::consensus::codes::ErrorWithCode; use crate::consensus::ConsensusError; + use assert_matches::assert_matches; use platform_value::{platform_value, Value}; use platform_version::version::PlatformVersion; - use super::*; - fn init() { let _ = env_logger::builder() .filter_level(log::LevelFilter::Debug) .try_init(); } + #[ignore] #[test] fn should_return_error_if_bytes_array_parent_contains_items_or_prefix_items() { let schema: Value = platform_value!( @@ -39,26 +36,23 @@ mod test { "additionalProperties": false, } ); - let mut result = traversal_validator( - &schema, - &[byte_array_has_no_items_as_parent_validator], - PlatformVersion::first(), - ) - .expect("expected traversal validator to succeed"); + let mut result = traversal_validator(&schema, &[], PlatformVersion::first()) + .expect("expected traversal validator to succeed"); assert_eq!(2, result.errors.len()); let first_error = get_basic_error(result.errors.pop().unwrap()); let second_error = get_basic_error(result.errors.pop().unwrap()); - assert!(matches!( + assert_matches!( first_error, - BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties/bar': byteArray cannot"), - )); - assert!(matches!( + BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties/bar': byteArray cannot") + ); + assert_matches!( second_error, - BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties': byteArray cannot"), - )); + BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties': byteArray cannot") + ); } + #[ignore] #[test] fn should_return_valid_result() { let schema: Value = platform_value!( @@ -75,15 +69,12 @@ mod test { "additionalProperties": false, } ); - assert!(traversal_validator( - &schema, - &[pattern_is_valid_regex_validator], - PlatformVersion::first() - ) - .expect("expected traversal validator to succeed") - .is_valid()); + assert!(traversal_validator(&schema, &[], PlatformVersion::first()) + .expect("expected traversal validator to succeed") + .is_valid()); } + #[ignore] #[test] fn should_return_invalid_result() { let schema: Value = platform_value!({ @@ -99,13 +90,9 @@ mod test { "additionalProperties": false, }); - let result = traversal_validator( - &schema, - &[pattern_is_valid_regex_validator], - PlatformVersion::first(), - ) - .expect("expected traversal validator to succeed"); - let consensus_error = result.errors.get(0).expect("the error should be returned"); + let result = traversal_validator(&schema, &[], PlatformVersion::first()) + .expect("expected traversal validator to succeed"); + let consensus_error = result.errors.first().expect("the error should be returned"); match consensus_error { ConsensusError::BasicError(BasicError::IncompatibleRe2PatternError(err)) => { @@ -114,38 +101,32 @@ mod test { err.pattern(), "^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$".to_string() ); - assert_eq!(consensus_error.code(), 1009); + assert_eq!(consensus_error.code(), 10202); } _ => panic!("Expected error to be IncompatibleRe2PatternError"), } } + #[ignore] #[test] fn should_be_valid_complex_for_complex_schema() { let schema = get_document_schema(); - assert!(traversal_validator( - &schema, - &[pattern_is_valid_regex_validator], - PlatformVersion::first() - ) - .expect("expected traversal validator to exist for first protocol version") - .is_valid()) + assert!(traversal_validator(&schema, &[], PlatformVersion::first()) + .expect("expected traversal validator to exist for first protocol version") + .is_valid()) } + #[ignore] #[test] fn invalid_result_for_array_of_object() { let mut schema = get_document_schema(); schema["properties"]["arrayOfObject"]["items"]["properties"]["simple"]["pattern"] = platform_value!("^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$"); - let result = traversal_validator( - &schema, - &[pattern_is_valid_regex_validator], - PlatformVersion::first(), - ) - .expect("expected traversal validator to exist for first protocol version"); - let consensus_error = result.errors.get(0).expect("the error should be returned"); + let result = traversal_validator(&schema, &[], PlatformVersion::first()) + .expect("expected traversal validator to exist for first protocol version"); + let consensus_error = result.errors.first().expect("the error should be returned"); match consensus_error { ConsensusError::BasicError(BasicError::IncompatibleRe2PatternError(err)) => { @@ -157,25 +138,22 @@ mod test { err.pattern(), "^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$".to_string() ); - assert_eq!(consensus_error.code(), 1009); + assert_eq!(consensus_error.code(), 10202); } _ => panic!("Expected error to be IncompatibleRe2PatternError"), } } + #[ignore] #[test] fn invalid_result_for_array_of_objects() { let mut schema = get_document_schema(); schema["properties"]["arrayOfObjects"]["items"][0]["properties"]["simple"]["pattern"] = platform_value!("^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$"); - let result = traversal_validator( - &schema, - &[pattern_is_valid_regex_validator], - PlatformVersion::first(), - ) - .expect("expected traversal validator to exist for first protocol version"); - let consensus_error = result.errors.get(0).expect("the error should be returned"); + let result = traversal_validator(&schema, &[], PlatformVersion::first()) + .expect("expected traversal validator to exist for first protocol version"); + let consensus_error = result.errors.first().expect("the error should be returned"); match consensus_error { ConsensusError::BasicError(BasicError::IncompatibleRe2PatternError(err)) => { @@ -187,7 +165,7 @@ mod test { err.pattern(), "^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$".to_string() ); - assert_eq!(consensus_error.code(), 1009); + assert_eq!(consensus_error.code(), 10202); } _ => panic!("Expected error to be IncompatibleRe2PatternError"), } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/mod.rs deleted file mode 100644 index 1cad6d626c7..00000000000 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/mod.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Value; -use platform_version::version::PlatformVersion; - -mod v0; - -pub fn pattern_is_valid_regex_validator( - path: &str, - key: &str, - parent: &Value, - value: &Value, - result: &mut SimpleConsensusValidationResult, - platform_version: &PlatformVersion, -) -> Result<(), ProtocolError> { - match platform_version - .dpp - .contract_versions - .document_type_versions - .schema - .recursive_schema_validator_versions - .pattern_is_valid_regex_validator - { - 0 => { - v0::pattern_is_valid_regex_validator_v0(path, key, parent, value, result); - Ok(()) - } - version => Err(ProtocolError::UnknownVersionMismatch { - method: "pattern_is_valid_regex_validator".to_string(), - known_versions: vec![0], - received: version, - }), - } -} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/v0/mod.rs deleted file mode 100644 index 523de0662f9..00000000000 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/v0/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -use crate::consensus::basic::data_contract::IncompatibleRe2PatternError; -use crate::validation::SimpleConsensusValidationResult; -use platform_value::Value; -use regex::Regex; - -pub fn pattern_is_valid_regex_validator_v0( - path: &str, - key: &str, - _parent: &Value, - value: &Value, - result: &mut SimpleConsensusValidationResult, -) { - if key == "pattern" { - if let Some(pattern) = value.as_str() { - // TODO: It doesn't make sense since Regex is not a RE2 engine - // and a doubt we use it in json schema library - if let Err(err) = Regex::new(pattern) { - result.add_error(IncompatibleRe2PatternError::new( - String::from(pattern), - path.to_string(), - err.to_string(), - )); - } - } else { - result.add_error(IncompatibleRe2PatternError::new( - String::new(), - path.to_string(), - format!("{} is not a string", path), - )); - } - } -} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs index e4acc21e956..5e4891d5c18 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs @@ -15,7 +15,8 @@ pub type SubValidator = fn( platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; -pub fn traversal_validator_v0( +#[inline(always)] +pub(super) fn traversal_validator_v0( raw_data_contract: &Value, validators: &[SubValidator], platform_version: &PlatformVersion, diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs index b407987498c..df6ef724d8a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs @@ -1,14 +1,20 @@ -use crate::validation::SimpleConsensusValidationResult; +use crate::validation::ConsensusValidationResult; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; mod v0; +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct MaxDepthValidationResult { + pub depth: u16, + pub size: u64, +} + pub fn validate_max_depth( value: &Value, platform_version: &PlatformVersion, -) -> Result { +) -> Result, ProtocolError> { match platform_version .dpp .contract_versions @@ -16,7 +22,7 @@ pub fn validate_max_depth( .schema .validate_max_depth { - 0 => Ok(v0::validate_max_depth_v0(value)), + 0 => Ok(v0::validate_max_depth_v0(value, platform_version)), version => Err(ProtocolError::UnknownVersionMismatch { method: "validate_max_depth".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs index 613e55bd87b..990f5cf15cf 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs @@ -1,65 +1,86 @@ use platform_value::Value; +use platform_version::version::PlatformVersion; use std::collections::BTreeSet; use crate::consensus::basic::data_contract::data_contract_max_depth_exceed_error::DataContractMaxDepthExceedError; use crate::consensus::basic::data_contract::InvalidJsonSchemaRefError; use crate::consensus::basic::BasicError; +use crate::data_contract::document_type::schema::MaxDepthValidationResult; use crate::util::json_schema::resolve_uri; -use crate::validation::SimpleConsensusValidationResult; +use crate::validation::ConsensusValidationResult; -const MAX_DEPTH: usize = 500; - -pub fn validate_max_depth_v0(value: &Value) -> SimpleConsensusValidationResult { - let mut result = SimpleConsensusValidationResult::default(); - let schema_depth = match calculate_max_depth(value) { - Ok(depth) => depth, - Err(err) => { - result.add_error(err); - return result; - } - }; - - if schema_depth > MAX_DEPTH { - result.add_error(BasicError::DataContractMaxDepthExceedError( - DataContractMaxDepthExceedError::new(schema_depth, MAX_DEPTH), - )); - } - result -} - -fn calculate_max_depth(platform_value: &Value) -> Result { +#[inline(always)] +pub(super) fn validate_max_depth_v0( + platform_value: &Value, + platform_version: &PlatformVersion, +) -> ConsensusValidationResult { + let max_allowed_depth = platform_version + .dpp + .contract_versions + .document_type_versions + .schema + .max_depth as usize; let mut values_depth_queue: Vec<(&Value, usize)> = vec![(platform_value, 0)]; - let mut max_depth: usize = 0; + let mut max_reached_depth: usize = 0; let mut visited: BTreeSet<*const Value> = BTreeSet::new(); let ref_value = Value::Text("$ref".to_string()); + let mut size: u64 = 1; // we start at 1, because we are a value + while let Some((value, depth)) = values_depth_queue.pop() { match value { Value::Map(map) => { let new_depth = depth + 1; - if max_depth < new_depth { - max_depth = new_depth + if new_depth > max_allowed_depth { + return ConsensusValidationResult::new_with_error( + BasicError::DataContractMaxDepthExceedError( + DataContractMaxDepthExceedError::new(max_allowed_depth), + ) + .into(), + ); + } + if max_reached_depth < new_depth { + max_reached_depth = new_depth } for (property_name, v) in map { + size += 1; // handling the internal references if property_name == &ref_value { if let Some(uri) = v.as_str() { - let resolved = resolve_uri(platform_value, uri).map_err(|e| { + let resolved = match resolve_uri(platform_value, uri).map_err(|e| { BasicError::InvalidJsonSchemaRefError( InvalidJsonSchemaRefError::new(format!( "invalid ref for max depth '{}': {}", uri, e )), ) - })?; + }) { + Ok(resolved) => resolved, + Err(e) => { + return ConsensusValidationResult::new_with_data_and_errors( + MaxDepthValidationResult { + depth: max_reached_depth as u16, // Not possible this is bigger than u16 max + size, + }, + vec![e.into()], + ); + } + }; if visited.contains(&(resolved as *const Value)) { - return Err(BasicError::InvalidJsonSchemaRefError( - InvalidJsonSchemaRefError::new(format!( - "the ref '{}' contains cycles", - uri - )), - )); + return ConsensusValidationResult::new_with_data_and_errors( + MaxDepthValidationResult { + depth: max_reached_depth as u16, // Not possible this is bigger than u16 max + size, + }, + vec![BasicError::InvalidJsonSchemaRefError( + InvalidJsonSchemaRefError::new(format!( + "the ref '{}' contains cycles", + uri + )), + ) + .into()], + ); } visited.insert(resolved as *const Value); @@ -75,10 +96,11 @@ fn calculate_max_depth(platform_value: &Value) -> Result { } Value::Array(array) => { let new_depth = depth + 1; - if max_depth < new_depth { - max_depth = new_depth + if max_reached_depth < new_depth { + max_reached_depth = new_depth } for v in array { + size += 1; if v.is_map() || v.is_array() { values_depth_queue.push((v, new_depth)) } @@ -88,7 +110,10 @@ fn calculate_max_depth(platform_value: &Value) -> Result { } } - Ok(max_depth) + ConsensusValidationResult::new_with_data(MaxDepthValidationResult { + depth: max_reached_depth as u16, // Not possible this is bigger than u16 max + size, + }) } #[cfg(test)] @@ -125,12 +150,13 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); - let err = get_ref_error(result); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); + + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "the ref '#/$defs/object' contains cycles".to_string() + err.to_string(), + "Invalid JSON Schema $ref: the ref '#/$defs/object' contains cycles".to_string() ); } @@ -161,8 +187,10 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); - assert!(matches!(result, Ok(5))); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data"); + assert_eq!(result, MaxDepthValidationResult { depth: 5, size: 19 }); } #[test] @@ -185,12 +213,12 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); - let err = get_ref_error(result); + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "invalid ref for max depth '#/$defs/object': value error: structure error: unable to get property $defs in $defs.object" + err.to_string(), + "Invalid JSON Schema $ref: invalid ref for max depth '#/$defs/object': value decoding error: StructureError(\"unable to get property $defs in $defs.object\")" .to_string() ); } @@ -215,12 +243,12 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); - let err = get_ref_error(result); + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "invalid ref for max depth 'https://json-schema.org/some': Generic Error: only local references are allowed" + err.to_string(), + "Invalid JSON Schema $ref: invalid ref for max depth 'https://json-schema.org/some': invalid uri error: only local uri references are allowed" .to_string() ); } @@ -245,12 +273,12 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); - let err = get_ref_error(result); + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "invalid ref for max depth '': Generic Error: only local references are allowed" + err.to_string(), + "Invalid JSON Schema $ref: invalid ref for max depth '': invalid uri error: only local uri references are allowed" .to_string() ); } @@ -272,13 +300,21 @@ mod test { } ) .into(); - assert!(matches!(calculate_max_depth(&schema), Ok(3))); + let found_depth = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data") + .depth; + assert_eq!(found_depth, 3); } #[test] fn should_calculate_valid_depth_for_empty_json() { let schema: Value = json!({}).into(); - assert!(matches!(calculate_max_depth(&schema), Ok(1))); + let found_depth = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data") + .depth; + assert_eq!(found_depth, 1); } #[test] @@ -296,16 +332,12 @@ mod test { }) .into(); - assert!(matches!(calculate_max_depth(&schema), Ok(4))); - } - pub fn get_ref_error(result: Result) -> InvalidJsonSchemaRefError { - match result { - Ok(_) => panic!("expected to have validation error"), - Err(e) => match e { - BasicError::InvalidJsonSchemaRefError(err) => err, - _ => panic!("expected error to be a InvalidJsonSchemaRefError"), - }, - } + let found_depth = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data") + .depth; + + assert_eq!(found_depth, 4); } } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs index 41ddc7b3d69..182f8082581 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs @@ -4,14 +4,19 @@ use platform_version::version::PlatformVersion; mod v0; -use crate::data_contract::document_type::schema::validate_schema_compatibility::v0::IncompatibleOperations; -pub use v0::EMPTY_JSON; +use crate::validation::SimpleValidationResult; + +#[derive(Debug, Clone)] +pub struct IncompatibleJsonSchemaOperation { + pub name: String, + pub path: String, +} pub fn validate_schema_compatibility( original_schema: &JsonValue, new_schema: &JsonValue, platform_version: &PlatformVersion, -) -> Result { +) -> Result, ProtocolError> { match platform_version .dpp .contract_versions @@ -19,7 +24,7 @@ pub fn validate_schema_compatibility( .schema .validate_schema_compatibility { - 0 => v0::validate_schema_compatibility(original_schema, new_schema), + 0 => v0::validate_schema_compatibility_v0(original_schema, new_schema), version => Err(ProtocolError::UnknownVersionMismatch { method: "validate_schema_compatibility".to_string(), known_versions: vec![0], @@ -27,16 +32,3 @@ pub fn validate_schema_compatibility( }), } } - -pub fn get_operation_and_property_name_json( - p: &json_patch::PatchOperation, -) -> (&'static str, &str) { - match &p { - json_patch::PatchOperation::Add(ref o) => ("add json", o.path.as_str()), - json_patch::PatchOperation::Copy(ref o) => ("copy json", o.path.as_str()), - json_patch::PatchOperation::Remove(ref o) => ("remove json", o.path.as_str()), - json_patch::PatchOperation::Replace(ref o) => ("replace json", o.path.as_str()), - json_patch::PatchOperation::Move(ref o) => ("move json", o.path.as_str()), - json_patch::PatchOperation::Test(ref o) => ("test json", o.path.as_str()), - } -} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs index b9dd5baafe2..b20239c2c26 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs @@ -1,397 +1,53 @@ -use std::collections::BTreeMap; -/// The Schema compatibility validator is a port of a JavaScript version -/// https://bitbucket.org/atlassian/json-schema-diff-validator/src/master/ -/// -/// The functionality has been ported 'as is' without any logic improvements and optimizations -use std::convert::TryFrom; - -use crate::data_contract::DocumentName; +use crate::data_contract::document_type::schema::IncompatibleJsonSchemaOperation; +use crate::data_contract::errors::{DataContractError, JsonSchemaError}; +use crate::data_contract::JsonValue; +use crate::validation::SimpleValidationResult; use crate::ProtocolError; -use anyhow::Context; -use itertools::Itertools; -use json_patch::PatchOperation; -use jsonptr::{Pointer, Resolve}; -use lazy_static::lazy_static; -use serde_json::{json, Value as JsonValue}; - -lazy_static! { - pub static ref EMPTY_JSON: JsonValue = json!({}); -} - -mod property_names { - pub const REQUIRED: &str = "required"; - pub const DEFINITIONS: &str = "definitions"; - pub const PROPERTIES: &str = "properties"; - pub const REF: &str = "$ref"; - pub const MIN_ITEMS: &str = "minItems"; -} - -#[derive(Default, Debug, Clone)] -pub struct ValidationOptions { - pub allow_new_one_of: bool, - pub allow_new_enum_value: bool, - pub allow_reorder: bool, - pub deprecated_items: Vec, -} - -struct RemovedItem { - name: String, - operation: PatchOperation, -} - -pub type IncompatibleOperations = Vec; - -pub fn any_schema_changes( - old_schema: &BTreeMap, - new_schema: &JsonValue, -) -> bool { - let changes = old_schema - .into_iter() - .filter(|(document_type, original_schema)| { - let new_document_schema = new_schema.get(document_type).unwrap_or(&EMPTY_JSON); - let diff = json_patch::diff(original_schema, new_document_schema); - !diff.0.is_empty() - }) - .count(); - - changes > 0 -} - -pub fn validate_schema_compatibility( +use json_schema_compatibility_validator::{ + validate_schemas_compatibility, CompatibilityRulesCollection, Options, + KEYWORD_COMPATIBILITY_RULES, +}; +use once_cell::sync::Lazy; +use std::ops::Deref; + +static OPTIONS: Lazy = Lazy::new(|| { + let mut required_rule = KEYWORD_COMPATIBILITY_RULES + .get("required") + .expect("required rule must be present") + .clone(); + + required_rule.allow_removal = false; + required_rule + .inner + .as_mut() + .expect("required rule must have inner rules") + .allow_removal = false; + + Options { + override_rules: CompatibilityRulesCollection::from_iter([("required", required_rule)]), + } +}); + +pub(super) fn validate_schema_compatibility_v0( original_schema: &JsonValue, new_schema: &JsonValue, -) -> Result { - validate_schema_compatibility_with_options( - original_schema, - new_schema, - ValidationOptions::default(), - ) -} - -pub fn validate_schema_compatibility_with_options( - original_schema: &JsonValue, - new_schema: &JsonValue, - opts: ValidationOptions, -) -> Result { - let patch = json_patch::diff(original_schema, new_schema); - let mut diffs: Vec = vec![]; - let mut removed: Vec = vec![]; - let mut inserted: Vec = vec![]; - - for operation in patch.0.into_iter() { - match operation { - PatchOperation::Move(ref op_move) => { - if is_operation_move_remove_compatible( - op_move.path.as_str(), - original_schema, - &opts, - )? { - continue; - } - diffs.push(operation); - } - - PatchOperation::Remove(ref op_remove) => { - if is_operation_move_remove_compatible( - op_remove.path.as_str(), - original_schema, - &opts, - )? { - continue; - } - diffs.push(operation); - } - - PatchOperation::Replace(ref op_replace) => { - let is_min_items = is_min_items(&op_replace.path); - let json_pointer = - Pointer::try_from(op_replace.path.as_str()).with_context(|| { - format!("unable to create a json pointer from '{}'", op_replace.path) - })?; - let old_value = original_schema.resolve(&json_pointer).with_context(|| { - format!("cannot find the '{}' in original schema", op_replace.path) - })?; - - if is_min_items && old_value.as_i64() > op_replace.value.as_i64() { - continue; - } - - if !opts.allow_reorder { - diffs.push(operation) - } else { - inserted.push(op_replace.value.to_string()); - removed.push(RemovedItem { - name: old_value.to_string(), - operation, - }); - } - } - PatchOperation::Add(ref op_add) => { - let is_new_any_of_item = is_anyof_path(&op_add.path); - let is_new_enum_value = is_enum_path(&op_add.path); - let path_two_last_levels = - get_second_last_sub_path(&op_add.path).with_context(|| { - format!("the second subpath doesn't exist in '{}'", op_add.path) - })?; - - if path_two_last_levels == property_names::REQUIRED { - diffs.push(operation); - continue; - } - if [property_names::PROPERTIES, property_names::DEFINITIONS] - .contains(&path_two_last_levels) - { - continue; - } - - if is_new_any_of_item && opts.allow_reorder { - inserted.push( - op_add - .value - .get(property_names::REF) - .with_context(|| { - format!("the property '{}' doesn't exist", property_names::REF) - })? - .to_string(), - ) - } else if (is_new_any_of_item && opts.allow_new_one_of) - || (is_new_enum_value && opts.allow_new_enum_value) - { - continue; - } else { - diffs.push(operation) - } - } - _ => continue, - } - } - - if opts.allow_reorder { - // When reordering is allowed, we want ot make sure that any item that - // was replaces is also inserted somewhere else - let filtered_removed = removed.into_iter().filter_map(|node| { - if inserted.contains(&node.name) { - Some(node.operation) - } else { - None - } - }); - - diffs.extend(filtered_removed); - } - - Ok(diffs) -} - -// checks if operation `move` or `remove` is backward compatible -fn is_operation_move_remove_compatible( - path: &str, - original_schema: &JsonValue, - opts: &ValidationOptions, -) -> Result { - let is_min_items = path.ends_with(property_names::MIN_ITEMS); - if get_second_last_sub_path(path) == Some(property_names::REQUIRED) || is_min_items { - return Ok(true); - } - - // Check if the removed node is deprecated - let is_any_of_item = is_anyof_path(path); - if is_any_of_item { - let json_pointer: Pointer = Pointer::try_from(path) - .with_context(|| format!("Unable to crate a Json Pointer from '{}'", path))?; - let value = original_schema - .resolve(&json_pointer) - .with_context(|| format!("Cannot find the '{}' in the original schema", path))?; - - if let Some(ref_value) = value.get("$ref") { - let ref_value_string = ref_value.to_string(); - let last_subpath = get_last_sub_path(&ref_value_string).with_context(|| { - format!("The last subpath doesn't exist in '{}'", ref_value_string) - })?; - - if opts.deprecated_items.iter().any(|i| i == last_subpath) { - return Ok(true); - } - } - } else { - let last_subpath = get_last_sub_path(path).unwrap(); - if opts.deprecated_items.iter().any(|i| i == last_subpath) { - return Ok(true); - } - } - - Ok(false) -} - -fn is_min_items(path: &str) -> bool { - path.ends_with(property_names::MIN_ITEMS) -} - -// checks if property path has form: '.../anyOf/[usize]' -fn is_anyof_path(path: &str) -> bool { - is_path_of_type(path, "anyOf") -} - -// checks if property path has form: '.../enum/[usize]' -fn is_enum_path(path: &str) -> bool { - is_path_of_type(path, "enum") -} - -// checks if property path has form: '.../[name]/[usize]' -fn is_path_of_type(path: &str, path_type: &str) -> bool { - let arr = path.split('/').collect_vec(); - if arr.len() < 2 { - return false; - } - if arr[arr.len() - 1].parse::().is_err() { - return false; - } - if arr[arr.len() - 2] != path_type { - return false; - } - true -} - -fn get_second_last_sub_path(path: &str) -> Option<&str> { - let arr = path.split('/').collect_vec(); - if arr.len() > 1 { - Some(arr[arr.len() - 2]) - } else { - None - } -} - -fn get_last_sub_path(path: &str) -> Option<&str> { - let arr = path.split('/').collect_vec(); - if !arr.is_empty() { - Some(arr[arr.len() - 1]) - } else { - None - } -} - -#[cfg(test)] -mod test { - - use super::*; - use lazy_static::lazy_static; - use serde_json::json; - - lazy_static! { - static ref DATA_SCHEMA: JsonValue = serde_json::from_str(include_str!( - "./../../../../../tests/payloads/schema/data.json" - )) - .unwrap(); - static ref DATA_SCHEMA_V2: JsonValue = serde_json::from_str(include_str!( - "./../../../../../tests/payloads/schema/data_v2.json" - )) - .unwrap(); - } - - #[test] - fn test_is_any_of_item() { - let any_of_item = "/anyOf/0"; - assert!(is_path_of_type(any_of_item, "anyOf")); - - let any_of_item = "/alpha/anyOf/0"; - assert!(is_path_of_type(any_of_item, "anyOf")); - - let is_not_any_of_item = ""; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - - let is_not_any_of_item = "/anyOf/o"; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - - let is_not_any_of_item = "/alpha/anyOf/o"; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - - let is_not_any_of_item = "/alpha/anyof/1"; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - } - - #[test] - fn should_return_ok_if_data_is_the_same() { - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &DATA_SCHEMA.clone(), - ValidationOptions::default(), - ); - assert!(matches!(result, Ok(operations) if operations.len() == 0)); - } - - #[test] - fn should_return_err_on_remove() { - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &DATA_SCHEMA_V2.clone(), - ValidationOptions::default(), - ); - assert!(matches!( - result, - Ok(operations) if operations.len() == 1 - )); - } - - #[test] - fn should_return_ok_if_new_field_is_added_but_not_required() { - let mut new_data_schema = DATA_SCHEMA.clone(); - new_data_schema["definitions"]["mntent"]["properties"]["field"] = - json!({"type" : "number"}); - - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &new_data_schema, - ValidationOptions::default(), - ); - - assert!(matches!(result, Ok(operations) if operations.len() == 0)); - } - - #[test] - fn should_return_ok_if_field_becomes_optional() { - let mut new_data_schema = DATA_SCHEMA.clone(); - new_data_schema[property_names::REQUIRED] = json!(["/"]); - - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &new_data_schema, - ValidationOptions::default(), - ); - - assert!(matches!(result, Ok(operations) if operations.len() == 0)); - } - - #[test] - fn should_return_err_if_field_becomes_required() { - let mut old_data_schema = DATA_SCHEMA.clone(); - old_data_schema[property_names::REQUIRED] = json!(["/"]); - - let result = validate_schema_compatibility_with_options( - &old_data_schema, - &DATA_SCHEMA.clone(), - ValidationOptions::default(), - ); - - assert!(matches!( - result, - Ok(operations) if operations.len() == 1 - )); - } - - #[test] - fn should_return_err_if_field_changes_its_type() { - let mut new_data_schema = DATA_SCHEMA.clone(); - new_data_schema["definitions"]["mntent"] = json!({"type" : "number"}); - - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &new_data_schema, - ValidationOptions::default(), - ); - - assert!(matches!( - result, - Ok(operations) if operations.len() > 0 - )); - } +) -> Result, ProtocolError> { + validate_schemas_compatibility(original_schema, new_schema, OPTIONS.deref()) + .map(|result| { + let errors = result + .into_changes() + .into_iter() + .map(|change| IncompatibleJsonSchemaOperation { + name: change.name().to_string(), + path: change.path().to_string(), + }) + .collect::>(); + + SimpleValidationResult::new_with_errors(errors) + }) + .map_err(|error| { + ProtocolError::DataContractError(DataContractError::JsonSchema( + JsonSchemaError::SchemaCompatibilityValidationError(error.to_string()), + )) + }) } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs b/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs index 208ebc1ff82..39306888028 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs @@ -6,8 +6,11 @@ use crate::data_contract::document_type::v0::DocumentTypeV0; use platform_value::{Identifier, Value}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use indexmap::IndexMap; use std::collections::{BTreeMap, BTreeSet}; @@ -24,10 +27,17 @@ impl DocumentTypeV0Getters for DocumentTypeV0 { self.schema } - fn indices(&self) -> &Vec { + fn indexes(&self) -> &BTreeMap { &self.indices } + fn find_contested_index(&self) -> Option<&Index> { + self.indices + .iter() + .find(|(_, index)| index.contested_index.is_some()) + .map(|(_, contested_index)| contested_index) + } + fn index_structure(&self) -> &IndexLevel { &self.index_structure } @@ -51,6 +61,9 @@ impl DocumentTypeV0Getters for DocumentTypeV0 { fn required_fields(&self) -> &BTreeSet { &self.required_fields } + fn transient_fields(&self) -> &BTreeSet { + &self.transient_fields + } fn documents_keep_history(&self) -> bool { self.documents_keep_history @@ -60,6 +73,22 @@ impl DocumentTypeV0Getters for DocumentTypeV0 { self.documents_mutable } + fn documents_can_be_deleted(&self) -> bool { + self.documents_can_be_deleted + } + + fn documents_transferable(&self) -> Transferable { + self.documents_transferable + } + + fn trade_mode(&self) -> TradeMode { + self.trade_mode + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + self.creation_restriction_mode + } + fn data_contract_id(&self) -> Identifier { self.data_contract_id } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs index cce01ea1b4e..9951c2b638b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs @@ -9,7 +9,10 @@ use crate::data_contract::storage_requirements::keys_for_document_type::StorageK #[cfg(feature = "validation")] pub(in crate::data_contract) use validator::StatelessJsonSchemaLazyValidator; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use platform_value::{Identifier, Value}; mod accessors; @@ -19,15 +22,6 @@ pub mod random_document; pub mod random_document_type; #[cfg(feature = "validation")] mod validator; - -// TODO: Is this needed? -pub const CONTRACT_DOCUMENTS_PATH_HEIGHT: u16 = 4; -pub const BASE_CONTRACT_ROOT_PATH_SIZE: usize = 33; // 1 + 32 -pub const BASE_CONTRACT_KEEPING_HISTORY_STORAGE_PATH_SIZE: usize = 34; // 1 + 32 + 1 -pub const BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_STORAGE_TIME_REFERENCE_PATH: usize = 75; -pub const BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_PRIMARY_KEY_PATH_FOR_DOCUMENT_ID_SIZE: usize = 67; // 1 + 32 + 1 + 1 + 32, then we need to add document_type_name.len() -pub const BASE_CONTRACT_DOCUMENTS_PATH: usize = 34; -pub const BASE_CONTRACT_DOCUMENTS_PRIMARY_KEY_PATH: usize = 35; pub const DEFAULT_HASH_SIZE: usize = 32; pub const DEFAULT_FLOAT_SIZE: usize = 8; pub const EMPTY_TREE_STORAGE_SIZE: usize = 33; @@ -38,7 +32,7 @@ pub const STORAGE_FLAGS_SIZE: usize = 2; pub struct DocumentTypeV0 { pub(in crate::data_contract) name: String, pub(in crate::data_contract) schema: Value, - pub(in crate::data_contract) indices: Vec, + pub(in crate::data_contract) indices: BTreeMap, pub(in crate::data_contract) index_structure: IndexLevel, /// Flattened properties flatten all objects for quick lookups for indexes /// Document field should not contain sub objects. @@ -49,10 +43,21 @@ pub struct DocumentTypeV0 { pub(in crate::data_contract) binary_paths: BTreeSet, /// The required fields on the document type pub(in crate::data_contract) required_fields: BTreeSet, + /// The transient fields on the document type + pub(in crate::data_contract) transient_fields: BTreeSet, /// Should documents keep history? pub(in crate::data_contract) documents_keep_history: bool, /// Are documents mutable? pub(in crate::data_contract) documents_mutable: bool, + /// Can documents of this type be deleted? + pub(in crate::data_contract) documents_can_be_deleted: bool, + /// Can documents be transferred without a trade? + pub(in crate::data_contract) documents_transferable: Transferable, + /// How are these documents traded? + pub(in crate::data_contract) trade_mode: TradeMode, + /// Is document creation restricted? + pub(in crate::data_contract) creation_restriction_mode: CreationRestrictionMode, + /// The data contract id pub(in crate::data_contract) data_contract_id: Identifier, /// Encryption key storage requirements pub(in crate::data_contract) requires_identity_encryption_bounded_key: @@ -64,3 +69,10 @@ pub struct DocumentTypeV0 { #[cfg(feature = "validation")] pub(in crate::data_contract) json_schema_validator: StatelessJsonSchemaLazyValidator, } + +impl DocumentTypeV0 { + // Public method to set the data_contract_id + pub fn set_data_contract_id(&mut self, new_id: Identifier) { + self.data_contract_id = new_id; + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs b/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs index 9b7b0ede625..66f37338607 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs @@ -3,24 +3,65 @@ //! This module defines the CreateRandomDocument trait and its functions, which //! create various types of random documents. //! +//! + +use platform_value::{Bytes32, Identifier}; +use rand::rngs::StdRng; +use rand::SeedableRng; +use std::time::{SystemTime, UNIX_EPOCH}; -use crate::data_contract::document_type::property_names::{CREATED_AT, UPDATED_AT}; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::random_document::{ CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType, }; use crate::data_contract::document_type::v0::DocumentTypeV0; - -use crate::document::{Document, DocumentV0}; +use crate::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; +use crate::document::{Document, DocumentV0, INITIAL_REVISION}; use crate::identity::accessors::IdentityGettersV0; use crate::identity::Identity; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; use crate::version::PlatformVersion; use crate::ProtocolError; -use platform_value::{Bytes32, Identifier}; -use rand::rngs::StdRng; -use rand::{Rng, SeedableRng}; -use std::time::{SystemTime, UNIX_EPOCH}; impl CreateRandomDocument for DocumentTypeV0 { + /// Creates a random Document using a seed if given, otherwise entropy. + fn random_document( + &self, + seed: Option, + platform_version: &PlatformVersion, + ) -> Result { + let mut rng = match seed { + None => StdRng::from_entropy(), + Some(seed_value) => StdRng::seed_from_u64(seed_value), + }; + self.random_document_with_rng(&mut rng, platform_version) + } + + /// Creates a document with a random id, owner id, and properties using StdRng. + fn random_document_with_rng( + &self, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result { + let owner_id = Identifier::random_with_rng(rng); + let entropy = Bytes32::random_with_rng(rng); + + self.random_document_with_params( + owner_id, + entropy, + None, + None, + None, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + rng, + platform_version, + ) + } + /// Creates `count` Documents with random data using a seed if given, otherwise entropy. fn random_documents( &self, @@ -49,52 +90,6 @@ impl CreateRandomDocument for DocumentTypeV0 { Ok(vec) } - /// Creates `count` Documents with random data using the random number generator given. - fn random_documents_with_params( - &self, - count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { - let mut vec = vec![]; - for _i in 0..count { - let identity_num = rng.gen_range(0..identities.len()); - let identity = identities.get(identity_num).unwrap().clone(); - let entropy = Bytes32::random_with_rng(rng); - vec.push(( - self.random_document_with_params( - identity.id(), - entropy, - time_ms, - document_field_fill_type, - document_field_fill_size, - rng, - platform_version, - )?, - identity, - entropy, - )); - } - Ok(vec) - } - - /// Creates a random Document using a seed if given, otherwise entropy. - fn random_document( - &self, - seed: Option, - platform_version: &PlatformVersion, - ) -> Result { - let mut rng = match seed { - None => StdRng::from_entropy(), - Some(seed_value) => StdRng::seed_from_u64(seed_value), - }; - self.random_document_with_rng(&mut rng, platform_version) - } - /// Creates a document with a random id, owner id, and properties using StdRng. fn random_document_with_identifier_and_entropy( &self, @@ -105,13 +100,12 @@ impl CreateRandomDocument for DocumentTypeV0 { document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result { - let now = SystemTime::now(); - let duration_since_epoch = now.duration_since(UNIX_EPOCH).expect("Time went backwards"); - let milliseconds = duration_since_epoch.as_millis() as u64; self.random_document_with_params( owner_id, entropy, - milliseconds, + None, + None, + None, document_field_fill_type, document_field_fill_size, rng, @@ -119,34 +113,14 @@ impl CreateRandomDocument for DocumentTypeV0 { ) } - /// Creates a document with a random id, owner id, and properties using StdRng. - fn random_document_with_rng( - &self, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Result { - let owner_id = Identifier::random_with_rng(rng); - let entropy = Bytes32::random_with_rng(rng); - let now = SystemTime::now(); - let duration_since_epoch = now.duration_since(UNIX_EPOCH).expect("Time went backwards"); - let milliseconds = duration_since_epoch.as_millis() as u64; - self.random_document_with_params( - owner_id, - entropy, - milliseconds, - DocumentFieldFillType::FillIfNotRequired, - DocumentFieldFillSize::AnyDocumentFillSize, - rng, - platform_version, - ) - } - /// Creates a document with a given owner id and entropy, and properties using StdRng. fn random_document_with_params( &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, @@ -184,24 +158,84 @@ impl CreateRandomDocument for DocumentTypeV0 { }) .collect(); - let revision = if self.documents_mutable { - Some(1) + let revision = if self.requires_revision() { + Some(INITIAL_REVISION) } else { None }; let created_at = if self.required_fields.contains(CREATED_AT) { - Some(time_ms) + if time_ms.is_some() { + time_ms + } else { + let now = SystemTime::now(); + let duration_since_epoch = + now.duration_since(UNIX_EPOCH).expect("Time went backwards"); + let milliseconds = duration_since_epoch.as_millis() as u64; + Some(milliseconds) + } } else { None }; let updated_at = if self.required_fields.contains(UPDATED_AT) { - Some(time_ms) + if time_ms.is_some() { + time_ms + } else if created_at.is_some() { + created_at + } else { + let now = SystemTime::now(); + let duration_since_epoch = + now.duration_since(UNIX_EPOCH).expect("Time went backwards"); + let milliseconds = duration_since_epoch.as_millis() as u64; + Some(milliseconds) + } } else { None }; + let created_at_block_height = if self.required_fields.contains(CREATED_AT_BLOCK_HEIGHT) { + if block_height.is_some() { + block_height + } else { + Some(0) + } + } else { + None + }; + + let updated_at_block_height = if self.required_fields.contains(UPDATED_AT_BLOCK_HEIGHT) { + if block_height.is_some() { + block_height + } else { + Some(0) + } + } else { + None + }; + + let created_at_core_block_height = + if self.required_fields.contains(CREATED_AT_CORE_BLOCK_HEIGHT) { + if core_block_height.is_some() { + core_block_height + } else { + Some(0) + } + } else { + None + }; + + let updated_at_core_block_height = + if self.required_fields.contains(UPDATED_AT_CORE_BLOCK_HEIGHT) { + if core_block_height.is_some() { + core_block_height + } else { + Some(0) + } + } else { + None + }; + match platform_version .dpp .document_versions @@ -214,6 +248,13 @@ impl CreateRandomDocument for DocumentTypeV0 { revision, created_at, updated_at, + transferred_at: None, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height: None, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height: None, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { @@ -223,4 +264,47 @@ impl CreateRandomDocument for DocumentTypeV0 { }), } } + + /// Creates `count` Documents with random data using the random number generator given. + fn random_documents_with_params<'i>( + &self, + count: u32, + identities: &[&'i Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let mut vec = vec![]; + + if identities.len() < count as usize { + return Err(ProtocolError::CorruptedCodeExecution(format!( + "not enough identities to create {count} documents" + ))); + } + + for i in 0..count { + let identity = identities[i as usize]; + let entropy = Bytes32::random_with_rng(rng); + vec.push(( + self.random_document_with_params( + identity.id(), + entropy, + time_ms, + block_height, + core_block_height, + document_field_fill_type, + document_field_fill_size, + rng, + platform_version, + )?, + identity, + entropy, + )); + } + Ok(vec) + } } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs b/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs index 26c84d2c316..767df9dba91 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs @@ -72,6 +72,7 @@ pub struct RandomDocumentTypeParameters { pub field_bounds: FieldMinMaxBounds, pub keep_history_chance: f64, pub documents_mutable_chance: f64, + pub documents_can_be_deleted_chance: f64, } impl RandomDocumentTypeParameters { @@ -97,19 +98,28 @@ impl RandomDocumentTypeParameters { } } +use crate::data_contract::document_type::array::ArrayItemType; use crate::data_contract::document_type::index_level::IndexLevel; -use crate::data_contract::document_type::v0::{DocumentTypeV0, StatelessJsonSchemaLazyValidator}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; +#[cfg(feature = "validation")] +use crate::data_contract::document_type::v0::StatelessJsonSchemaLazyValidator; use crate::data_contract::document_type::{ - DocumentProperty, DocumentPropertyType, DocumentType, Index, + v0::DocumentTypeV0, DocumentProperty, DocumentPropertyType, DocumentType, Index, }; +use crate::data_contract::document_type::{ByteArrayPropertySizes, StringPropertySizes}; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use crate::version::PlatformVersion; use crate::ProtocolError; use bincode::{Decode, Encode}; use indexmap::IndexMap; -use platform_value::{Identifier, Value}; +use itertools::Itertools; +use platform_value::{platform_value, Identifier}; use rand::rngs::StdRng; +use rand::seq::SliceRandom; use rand::Rng; +use serde_json::json; use std::collections::{BTreeMap, BTreeSet}; use std::ops::Range; @@ -136,26 +146,25 @@ impl DocumentTypeV0 { let random_weight = rng.gen_range(0..total_weight); let document_type = if random_weight < field_weights.string_weight { let has_min_len = rng.gen_bool(parameters.field_bounds.string_has_min_len_chance); - let has_max_len = rng.gen_bool(parameters.field_bounds.string_has_max_len_chance); - let min_len = if has_min_len { + let min_length = if has_min_len { Some(rng.gen_range(parameters.field_bounds.string_min_len.clone())) } else { None }; - let max_len = if has_max_len { - Some(rng.gen_range(parameters.field_bounds.string_max_len.clone())) - } else { - None - }; - DocumentPropertyType::String(min_len, max_len) + // If a string property is used in an index it must have maxLength 63 or less (v1.0-dev) + let max_length = Some(63); + DocumentPropertyType::String(StringPropertySizes { + min_length, + max_length, + }) } else if random_weight < field_weights.string_weight + field_weights.integer_weight { - DocumentPropertyType::Integer + DocumentPropertyType::I64 } else if random_weight < field_weights.string_weight + field_weights.integer_weight + field_weights.float_weight { - DocumentPropertyType::Number + DocumentPropertyType::F64 } else if random_weight < field_weights.string_weight + field_weights.integer_weight @@ -174,32 +183,360 @@ impl DocumentTypeV0 { } else { let has_min_len = rng.gen_bool(parameters.field_bounds.byte_array_has_min_len_chance); - let has_max_len = - rng.gen_bool(parameters.field_bounds.byte_array_has_max_len_chance); - let min_len = if has_min_len { + let min_size = if has_min_len { Some(rng.gen_range(parameters.field_bounds.byte_array_min_len.clone())) } else { None }; - let max_len = if has_max_len { - Some(rng.gen_range(parameters.field_bounds.byte_array_max_len.clone())) + // Indexed arrays must have maxItems 255 or less (v1.0-dev) + let max_size = Some(255); + DocumentPropertyType::ByteArray(ByteArrayPropertySizes { min_size, max_size }) + }; + + DocumentProperty { + property_type: document_type, + required, + transient: false, + } + }; + + let optional_field_count = if parameters.new_fields_optional_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_optional_count_range.clone()) + }; + + let required_field_count = if parameters.new_fields_required_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_required_count_range.clone()) + }; + + let mut properties = IndexMap::new(); + let mut required_fields = BTreeSet::new(); + + for _ in 0..optional_field_count { + let field_name = format!("field_{}", rng.gen::()); + properties.insert(field_name, random_field(false, rng)); + } + + for _ in 0..required_field_count { + let field_name = format!("field_{}", rng.gen::()); + properties.insert(field_name.clone(), random_field(true, rng)); + required_fields.insert(field_name); + } + + let index_count = if parameters.new_indexes_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_indexes_count_range.clone()) + }; + + let field_names: Vec = properties.keys().cloned().collect(); + // DPP only allows 10 properties per index (v1.0-dev) + let ten_field_names = field_names + .choose_multiple(&mut rand::thread_rng(), 10) + .cloned() + .collect_vec(); + + let mut indices = BTreeMap::new(); + + for _ in 0..index_count { + match Index::random(&ten_field_names, indices.values(), rng) { + Ok(index) => { + indices.insert(index.name.clone(), index); + } + Err(_) => break, + } + } + + let documents_keep_history = rng.gen_bool(parameters.keep_history_chance); + let documents_mutable = rng.gen_bool(parameters.documents_mutable_chance); + let documents_can_be_deleted = rng.gen_bool(parameters.documents_can_be_deleted_chance); + + let name = format!("doc_type_{}", rng.gen::()); + + let index_structure = + IndexLevel::try_from_indices(indices.values(), name.as_str(), platform_version)?; + let (identifier_paths, binary_paths) = DocumentType::find_identifier_and_binary_paths( + &properties, + &PlatformVersion::latest() + .dpp + .contract_versions + .document_type_versions, + )?; + + // Generate properties JSON schema + let mut position_counter = 0; + let properties_json_schema = properties.iter().map(|(key, prop)| { + let mut schema_part = match &prop.property_type { + DocumentPropertyType::String(sizes) => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("string".to_owned())); + if let Some(min_len) = sizes.min_length { + schema.insert("minLength".to_string(), serde_json::Value::Number(serde_json::Number::from(min_len))); + } + if let Some(max_len) = sizes.max_length { + schema.insert("maxLength".to_string(), serde_json::Value::Number(serde_json::Number::from(max_len))); + } + serde_json::Value::Object(schema) + }, + DocumentPropertyType::U128 | DocumentPropertyType::U64 | DocumentPropertyType::U32 | DocumentPropertyType::U16 | DocumentPropertyType::U8 | + DocumentPropertyType::I128 | DocumentPropertyType::I64 | DocumentPropertyType::I32 | DocumentPropertyType::I16 | DocumentPropertyType::I8 => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("integer".to_owned())); + // Add min and max if specified in parameters + let integer_min = parameters.field_bounds.integer_min.start; + let integer_max = parameters.field_bounds.integer_max.end; + schema.insert("minimum".to_string(), serde_json::Value::Number(serde_json::Number::from(integer_min))); + schema.insert("maximum".to_string(), serde_json::Value::Number(serde_json::Number::from(integer_max))); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::F64 => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("number".to_owned())); + // Add min and max if specified in parameters + let float_min = parameters.field_bounds.float_min.start; + let float_max = parameters.field_bounds.float_max.end; + schema.insert("minimum".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(float_min).unwrap())); + schema.insert("maximum".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(float_max).unwrap())); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Date => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("string".to_owned())); + schema.insert("format".to_string(), serde_json::Value::String("date-time".to_owned())); + // There's a maxLength constraint in DPP, not sure what it is. Just putting 10 for now. + schema.insert("maxLength".to_string(), serde_json::Value::Number(serde_json::Number::from(10))); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Boolean => { + serde_json::json!({"type": "boolean"}) + }, + DocumentPropertyType::ByteArray(sizes) => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("array".to_owned())); + if let Some(min_len) = sizes.min_size { + schema.insert("minItems".to_string(), serde_json::Value::Number(serde_json::Number::from(min_len))); + } + if let Some(max_len) = sizes.max_size { + schema.insert("maxItems".to_string(), serde_json::Value::Number(serde_json::Number::from(max_len))); + } + schema.insert("byteArray".to_string(), serde_json::Value::Bool(true)); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Identifier => { + json!({ + "type": "array", + "items": { + "type": "string", + "pattern": "^[0-9a-fA-F]{64}$" + }, + "minItems": 1, + "maxItems": 1, + "byteArray": true, + }) + }, + DocumentPropertyType::Object(sub_properties) => { + let sub_props_schema = sub_properties.iter().map(|(sub_key, _sub_prop)| { + (sub_key.clone(), serde_json::json!({"type": "string"})) + }).collect::>(); + + json!({ + "type": "object", + "properties": sub_props_schema, + "additionalProperties": false + }) + }, + DocumentPropertyType::Array(item_type) => { + let items_schema = match *item_type { + ArrayItemType::String(min, max) => json!({"type": "string", "minLength": min, "maxLength": max}), + ArrayItemType::Integer => json!({"type": "integer"}), + ArrayItemType::Number => json!({"type": "number"}), + ArrayItemType::ByteArray(min, max) => { + json!({"type": "array", "items": {"type": "byte"}, "minItems": min, "maxItems": max}) + }, + ArrayItemType::Identifier => json!({"type": "array"}), + ArrayItemType::Boolean => json!({"type": "bool"}), + ArrayItemType::Date => json!({"type": "date"}), + }; + + json!({ + "type": "array", + "items": items_schema, + "byteArray": true, + }) + }, + DocumentPropertyType::VariableTypeArray(types) => { + let types_schema = types.iter().map(|t| { + match t { + ArrayItemType::String(_, _) => json!({"type": "string"}), + _ => json!({}) + } + }).collect::>(); + + json!({ + "type": "array", + "items": { + "oneOf": types_schema + } + }) + }, + }; + + if let serde_json::Value::Object(ref mut schema) = schema_part { + schema.insert("position".to_string(), serde_json::Value::Number(serde_json::Number::from(position_counter))); + } + position_counter += 1; + + (key.clone(), schema_part) + }).collect::>(); + + // Generate indices + let indices_json_schema = indices + .iter() + .map(|(_, index)| { + let properties_schema = index + .properties + .iter() + .map(|prop| { + // Only "asc" is allowed for now (v1.0-dev) + json!({ ::clone(&prop.name): "asc" }) + }) + .collect::>(); + + json!({ + "name": index.name, + "properties": properties_schema, + "unique": index.unique, + }) + }) + .collect::>(); + + // Combine everything into the final schema + let schema = json!({ + "type": "object", + "properties": properties_json_schema, + "required": required_fields.iter().cloned().collect::>(), + "indices": indices_json_schema, + "additionalProperties": false, + }); + + // TODO: It might not work properly + Ok(DocumentTypeV0 { + name, + schema: schema.into(), + indices, + index_structure, + flattened_properties: properties.clone(), + properties, + identifier_paths, + binary_paths, + required_fields, + transient_fields: Default::default(), + documents_keep_history, + documents_mutable, + documents_can_be_deleted, + documents_transferable: Transferable::Never, + trade_mode: TradeMode::None, + creation_restriction_mode: CreationRestrictionMode::NoRestrictions, + data_contract_id, + requires_identity_encryption_bounded_key: None, + requires_identity_decryption_bounded_key: None, + security_level_requirement: SecurityLevel::HIGH, + #[cfg(feature = "validation")] + json_schema_validator: StatelessJsonSchemaLazyValidator::new(), + }) + } + + /// This is used to create an invalid random document type, often for testing + pub fn invalid_random_document_type( + parameters: RandomDocumentTypeParameters, + data_contract_id: Identifier, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result { + // Call the validation function at the beginning + parameters.validate_parameters()?; + + let field_weights = ¶meters.field_weights; + + let total_weight = field_weights.string_weight + + field_weights.float_weight + + field_weights.integer_weight + + field_weights.date_weight + + field_weights.boolean_weight + + field_weights.byte_array_weight; + + let random_field = |required: bool, rng: &mut StdRng| -> DocumentProperty { + let random_weight = rng.gen_range(0..total_weight); + let document_type = if random_weight < field_weights.string_weight { + let has_min_len = rng.gen_bool(parameters.field_bounds.string_has_min_len_chance); + let min_length = if has_min_len { + Some(rng.gen_range(parameters.field_bounds.string_min_len.clone())) + } else { + None + }; + // If a string property is used in an index it must have maxLength 63 or less (v1.0-dev) + let max_length = Some(63); + DocumentPropertyType::String(StringPropertySizes { + min_length, + max_length, + }) + } else if random_weight < field_weights.string_weight + field_weights.integer_weight { + DocumentPropertyType::I64 + } else if random_weight + < field_weights.string_weight + + field_weights.integer_weight + + field_weights.float_weight + { + DocumentPropertyType::F64 + } else if random_weight + < field_weights.string_weight + + field_weights.integer_weight + + field_weights.float_weight + + field_weights.date_weight + { + DocumentPropertyType::Date + } else if random_weight + < field_weights.string_weight + + field_weights.integer_weight + + field_weights.float_weight + + field_weights.date_weight + + field_weights.boolean_weight + { + DocumentPropertyType::Boolean + } else { + let has_min_len = + rng.gen_bool(parameters.field_bounds.byte_array_has_min_len_chance); + let min_size = if has_min_len { + Some(rng.gen_range(parameters.field_bounds.byte_array_min_len.clone())) } else { None }; - - DocumentPropertyType::ByteArray(min_len, max_len) + // Indexed arrays must have maxItems 255 or less (v1.0-dev) + let max_size = Some(255); + DocumentPropertyType::ByteArray(ByteArrayPropertySizes { min_size, max_size }) }; DocumentProperty { property_type: document_type, required, + transient: false, } }; - let optional_field_count = - rng.gen_range(parameters.new_fields_optional_count_range.clone()); - let required_field_count = - rng.gen_range(parameters.new_fields_required_count_range.clone()); + let optional_field_count = if parameters.new_fields_optional_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_optional_count_range.clone()) + }; + + let required_field_count = if parameters.new_fields_required_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_required_count_range.clone()) + }; let mut properties = IndexMap::new(); let mut required_fields = BTreeSet::new(); @@ -215,24 +552,38 @@ impl DocumentTypeV0 { required_fields.insert(field_name); } - let index_count = rng.gen_range(parameters.new_indexes_count_range.clone()); + let index_count = if parameters.new_indexes_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_indexes_count_range.clone()) + }; + let field_names: Vec = properties.keys().cloned().collect(); - let mut indices = Vec::with_capacity(index_count as usize); + // DPP only allows 10 properties per index (v1.0-dev) + let ten_field_names = field_names + .choose_multiple(&mut rand::thread_rng(), 10) + .cloned() + .collect_vec(); + + let mut indices = BTreeMap::new(); for _ in 0..index_count { - match Index::random(&field_names, &indices, rng) { - Ok(index) => indices.push(index), + match Index::random(&ten_field_names, indices.values(), rng) { + Ok(index) => { + indices.insert(index.name.clone(), index); + } Err(_) => break, } } let documents_keep_history = rng.gen_bool(parameters.keep_history_chance); let documents_mutable = rng.gen_bool(parameters.documents_mutable_chance); + let documents_can_be_deleted = rng.gen_bool(parameters.documents_can_be_deleted_chance); let name = format!("doc_type_{}", rng.gen::()); let index_structure = - IndexLevel::try_from_indices(indices.as_slice(), name.as_str(), platform_version)?; + IndexLevel::try_from_indices(indices.values(), name.as_str(), platform_version)?; let (identifier_paths, binary_paths) = DocumentType::find_identifier_and_binary_paths( &properties, &PlatformVersion::latest() @@ -241,10 +592,15 @@ impl DocumentTypeV0 { .document_type_versions, )?; + // Combine everything into the final schema + let schema = platform_value!({ + "invalid": "yo", + }); + // TODO: It might not work properly Ok(DocumentTypeV0 { name, - schema: Value::Null, + schema, indices, index_structure, flattened_properties: properties.clone(), @@ -252,12 +608,18 @@ impl DocumentTypeV0 { identifier_paths, binary_paths, required_fields, + transient_fields: Default::default(), documents_keep_history, documents_mutable, + documents_can_be_deleted, + documents_transferable: Transferable::Never, + trade_mode: TradeMode::None, + creation_restriction_mode: CreationRestrictionMode::NoRestrictions, data_contract_id, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, security_level_requirement: SecurityLevel::HIGH, + #[cfg(feature = "validation")] json_schema_validator: StatelessJsonSchemaLazyValidator::new(), }) } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs b/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs index 99327ef15d9..447d000fd26 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs @@ -28,11 +28,8 @@ impl PartialEq for StatelessJsonSchemaLazyValidator { fn eq(&self, _other: &Self) -> bool { true } - - fn ne(&self, other: &Self) -> bool { - !self.eq(other) - } } + impl Clone for StatelessJsonSchemaLazyValidator { fn clone(&self) -> Self { StatelessJsonSchemaLazyValidator::new() diff --git a/packages/rs-dpp/src/data_contract/errors/contract.rs b/packages/rs-dpp/src/data_contract/errors/contract.rs index c4d601063ed..80dee9f226f 100644 --- a/packages/rs-dpp/src/data_contract/errors/contract.rs +++ b/packages/rs-dpp/src/data_contract/errors/contract.rs @@ -1,71 +1,106 @@ +use crate::consensus::basic::data_contract::DocumentTypesAreMissingError; +use crate::consensus::basic::decode::DecodingError; +use crate::consensus::basic::BasicError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use thiserror::Error; -use crate::data_contract::DataContract; - use crate::consensus::basic::document::InvalidDocumentTypeError; +use crate::consensus::ConsensusError; use crate::data_contract::errors::json_schema_error::JsonSchemaError; -use crate::errors::consensus::ConsensusError; +use crate::ProtocolError; // @append_only -#[derive(Error, Debug)] +#[derive( + Error, Debug, PartialEq, PlatformSerialize, PlatformDeserialize, Encode, Decode, Clone, +)] pub enum DataContractError { - #[error("Data Contract already exists")] - DataContractAlreadyExistsError, + #[error(transparent)] + DecodingContractError(DecodingError), - #[error("Invalid Data Contract: {errors:?}")] - InvalidDataContractError { - errors: Vec, - raw_data_contract: DataContract, - }, + #[error(transparent)] + DecodingDocumentError(DecodingError), #[error(transparent)] InvalidDocumentTypeError(InvalidDocumentTypeError), + #[error(transparent)] + DocumentTypesAreMissingError(DocumentTypesAreMissingError), + #[error("missing required key: {0}")] MissingRequiredKey(String), #[error("field requirement unmet: {0}")] - FieldRequirementUnmet(&'static str), + FieldRequirementUnmet(String), + + #[error("regex error: {0}")] + RegexError(String), #[error("key wrong type error: {0}")] - KeyWrongType(&'static str), + KeyWrongType(String), #[error("value wrong type error: {0}")] - ValueWrongType(&'static str), + ValueWrongType(String), + + #[error("invalid uri error: {0}")] + InvalidURI(String), + + /// Key wrong bounds error + #[error("key out of bounds error: {0}")] + KeyWrongBounds(String), + + /// A key value pair must exist + #[error("key value must exist: {0}")] + KeyValueMustExist(String), #[error("value decoding error: {0}")] - ValueDecodingError(&'static str), + ValueDecodingError(String), #[error("encoding data structure not supported error: {0}")] - EncodingDataStructureNotSupported(&'static str), + EncodingDataStructureNotSupported(String), #[error("invalid contract structure: {0}")] InvalidContractStructure(String), #[error("document type not found: {0}")] - DocumentTypeNotFound(&'static str), + DocumentTypeNotFound(String), #[error("document type field not found: {0}")] DocumentTypeFieldNotFound(String), #[error("reference definition not found error: {0}")] - ReferenceDefinitionNotFound(&'static str), + ReferenceDefinitionNotFound(String), #[error("document owner id missing error: {0}")] - DocumentOwnerIdMissing(&'static str), + DocumentOwnerIdMissing(String), #[error("document id missing error: {0}")] - DocumentIdMissing(&'static str), + DocumentIdMissing(String), #[error("Operation not supported: {0}")] - Unsupported(&'static str), + Unsupported(String), #[error("Corrupted Serialization: {0}")] - CorruptedSerialization(&'static str), - - #[error("Corrupted Code Execution: {0}")] - CorruptedCodeExecution(&'static str), + CorruptedSerialization(String), - #[error("Corrupted Code Execution: {0}")] + #[error("Json schema error: {0}")] JsonSchema(JsonSchemaError), } + +impl From for DataContractError { + fn from(value: platform_value::Error) -> Self { + DataContractError::ValueDecodingError(format!("{:?}", value)) + } +} + +impl From<(platform_value::Error, &str)> for DataContractError { + fn from(value: (platform_value::Error, &str)) -> Self { + DataContractError::ValueDecodingError(format!("{}: {:?}", value.1, value.0)) + } +} + +impl From for ConsensusError { + fn from(e: DataContractError) -> Self { + ConsensusError::BasicError(BasicError::ContractError(e)) + } +} diff --git a/packages/rs-dpp/src/data_contract/errors/invalid_data_contract_error.rs b/packages/rs-dpp/src/data_contract/errors/invalid_data_contract_error.rs deleted file mode 100644 index 05ea1636d49..00000000000 --- a/packages/rs-dpp/src/data_contract/errors/invalid_data_contract_error.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::consensus::ConsensusError; -use crate::ProtocolError; -use platform_value::Value; -use thiserror::Error; - -// @append_only -#[derive(Error, Debug)] -#[error("Invalid Data Contract: {errors:?}")] -pub struct InvalidDataContractError { - pub errors: Vec, - raw_data_contract: Value, -} - -impl InvalidDataContractError { - pub fn new(errors: Vec, raw_data_contract: Value) -> Self { - Self { - errors, - raw_data_contract, - } - } - - pub fn errors(&self) -> &[ConsensusError] { - &self.errors - } - pub fn raw_data_contract(&self) -> Value { - self.raw_data_contract.clone() - } -} - -impl From for ProtocolError { - fn from(err: InvalidDataContractError) -> Self { - Self::InvalidDataContractError(err) - } -} diff --git a/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs b/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs index ea959b1d0ff..6d318541080 100644 --- a/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs +++ b/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs @@ -1,8 +1,16 @@ +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use thiserror::Error; // @append_only -#[derive(Error, Debug)] +#[derive( + Error, Debug, PartialEq, Eq, PlatformSerialize, PlatformDeserialize, Encode, Decode, Clone, +)] pub enum JsonSchemaError { #[error("can't create json schema: {0}")] - CreateSchemaError(&'static str), + CreateSchemaError(String), + + #[error("schema compatibility validation failed: {0}")] + SchemaCompatibilityValidationError(String), } diff --git a/packages/rs-dpp/src/data_contract/errors/mod.rs b/packages/rs-dpp/src/data_contract/errors/mod.rs index 55ee0433471..dd860ad6fe7 100644 --- a/packages/rs-dpp/src/data_contract/errors/mod.rs +++ b/packages/rs-dpp/src/data_contract/errors/mod.rs @@ -1,15 +1,11 @@ mod contract; mod data_contract_not_present_error; mod identity_not_present_error; -mod invalid_data_contract_error; mod invalid_document_type_error; mod json_schema_error; -mod structure; pub use contract::DataContractError; pub use data_contract_not_present_error::*; pub use identity_not_present_error::*; -pub use invalid_data_contract_error::*; pub use invalid_document_type_error::*; pub use json_schema_error::JsonSchemaError; -pub use structure::StructureError; diff --git a/packages/rs-dpp/src/data_contract/errors/structure.rs b/packages/rs-dpp/src/data_contract/errors/structure.rs deleted file mode 100644 index effe7abc63c..00000000000 --- a/packages/rs-dpp/src/data_contract/errors/structure.rs +++ /dev/null @@ -1,23 +0,0 @@ -// @append_only -/// structure errors -#[derive(Debug, thiserror::Error)] -pub enum StructureError { - /// Invalid protocol version error - #[error("invalid protocol version error: {0}")] - InvalidProtocolVersion(&'static str), - /// Invalid CBOR error - #[error("invalid cbor error: {0}")] - InvalidCBOR(&'static str), - /// Key wrong type error - #[error("key wrong type error: {0}")] - KeyWrongType(&'static str), - /// Key wrong bounds error - #[error("key out of bounds error: {0}")] - KeyWrongBounds(&'static str), - /// Value wrong type error - #[error("value wrong type error: {0}")] - ValueWrongType(&'static str), - /// A key value pair must exist - #[error("key value must exist: {0}")] - KeyValueMustExist(&'static str), -} diff --git a/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs b/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs index cdf5f9b2266..beafe720de4 100644 --- a/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs +++ b/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs @@ -11,6 +11,7 @@ mod test { use crate::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; use crate::serialization::PlatformSerializableWithPlatformVersion; use crate::tests::json_document::json_document_to_contract; + use assert_matches::assert_matches; use platform_version::version::PlatformVersion; type IndexName = &'static str; @@ -128,7 +129,7 @@ mod test { let document_type = data_contract .document_type_for_name(expect.document_name) .unwrap(); - assert_eq!(expect.indexes.len(), document_type.indices().len()); + assert_eq!(expect.indexes.len(), document_type.indexes().len()); } } @@ -174,23 +175,25 @@ mod test { .document_types .get("contactInfo") .unwrap() - .indices(); + .indexes() + .values() + .collect::>(); assert_eq!(contact_info_indices.len(), 2); - assert!(contact_info_indices[0].unique); - assert!(!contact_info_indices[1].unique); - assert_eq!(contact_info_indices[0].properties.len(), 3); + assert!(contact_info_indices[1].unique); + assert!(!contact_info_indices[0].unique); + assert_eq!(contact_info_indices[1].properties.len(), 3); - assert_eq!(contact_info_indices[0].properties[0].name, "$ownerId"); + assert_eq!(contact_info_indices[1].properties[0].name, "$ownerId"); assert_eq!( - contact_info_indices[0].properties[1].name, + contact_info_indices[1].properties[1].name, "rootEncryptionKeyIndex" ); assert_eq!( - contact_info_indices[0].properties[2].name, + contact_info_indices[1].properties[2].name, "derivationEncryptionKeyIndex" ); - assert!(contact_info_indices[0].properties[0].ascending); + assert!(contact_info_indices[1].properties[0].ascending); } #[test] @@ -217,6 +220,9 @@ mod test { contract .config .set_documents_mutable_contract_default(false); + contract + .config + .set_documents_can_be_deleted_contract_default(false); contract .config .set_documents_keep_history_contract_default(true); @@ -227,7 +233,7 @@ mod test { let deserialized_contract = DataContract::from_cbor(contract_cbor, true, platform_version) .expect("deserialization shouldn't fail"); - assert!(matches!( + assert_matches!( deserialized_contract.config(), DataContractConfig::V0(DataContractConfigV0 { can_be_deleted: false, @@ -235,10 +241,11 @@ mod test { keeps_history: true, documents_mutable_contract_default: false, documents_keep_history_contract_default: true, + documents_can_be_deleted_contract_default: false, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, }) - )); + ); } #[test] @@ -264,6 +271,9 @@ mod test { contract_v0 .config .set_documents_mutable_contract_default(false); + contract_v0 + .config + .set_documents_can_be_deleted_contract_default(false); contract_v0 .config .set_documents_keep_history_contract_default(true); @@ -285,6 +295,7 @@ mod test { documents_keep_history_contract_default: true, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, + documents_can_be_deleted_contract_default: false, }) ); } diff --git a/packages/rs-dpp/src/data_contract/factory/mod.rs b/packages/rs-dpp/src/data_contract/factory/mod.rs index 833f2e6735b..ff3a11ec2e1 100644 --- a/packages/rs-dpp/src/data_contract/factory/mod.rs +++ b/packages/rs-dpp/src/data_contract/factory/mod.rs @@ -3,13 +3,13 @@ mod v0; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::DataContract; -use crate::util::entropy_generator::EntropyGenerator; use crate::version::PlatformVersion; use crate::ProtocolError; use derive_more::From; use platform_value::{Identifier, Value}; use crate::data_contract::config::DataContractConfig; +use crate::prelude::IdentityNonce; #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; #[cfg(all(feature = "state-transitions", feature = "client"))] @@ -36,16 +36,13 @@ pub enum DataContractFactory { impl DataContractFactory { /// Create a new data contract factory knowing versions - pub fn new( - protocol_version: u32, - entropy_generator: Option>, - ) -> Result { + pub fn new(protocol_version: u32) -> Result { let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .platform_architecture .data_contract_factory_structure_version { - 0 => Ok(DataContractFactoryV0::new(protocol_version, entropy_generator).into()), + 0 => Ok(DataContractFactoryV0::new(protocol_version).into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContractFactory::new".to_string(), known_versions: vec![0], @@ -58,14 +55,19 @@ impl DataContractFactory { pub fn create_with_value_config( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { match self { - DataContractFactory::V0(v0) => { - v0.create_with_value_config(owner_id, documents, config, definitions) - } + DataContractFactory::V0(v0) => v0.create_with_value_config( + owner_id, + identity_nonce, + documents, + config, + definitions, + ), } } @@ -73,12 +75,15 @@ impl DataContractFactory { pub fn create( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { match self { - DataContractFactory::V0(v0) => v0.create(owner_id, documents, config, definitions), + DataContractFactory::V0(v0) => { + v0.create(owner_id, identity_nonce, documents, config, definitions) + } } } @@ -141,11 +146,13 @@ impl DataContractFactory { pub fn create_data_contract_update_transition( &self, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { match self { - DataContractFactory::V0(v0) => { - v0.create_unsigned_data_contract_update_transition(data_contract) - } + DataContractFactory::V0(v0) => v0.create_unsigned_data_contract_update_transition( + data_contract, + identity_contract_nonce, + ), } } } diff --git a/packages/rs-dpp/src/data_contract/factory/v0/mod.rs b/packages/rs-dpp/src/data_contract/factory/v0/mod.rs index 2c5196ab234..7b9949e5f88 100644 --- a/packages/rs-dpp/src/data_contract/factory/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/factory/v0/mod.rs @@ -1,4 +1,4 @@ -use platform_value::{Bytes32, Value}; +use platform_value::Value; use platform_version::TryFromPlatformVersioned; use crate::consensus::basic::decode::SerializedObjectParsingError; @@ -9,17 +9,18 @@ use crate::data_contract::config::DataContractConfig; #[cfg(feature = "data-contract-value-conversion")] use crate::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; use crate::data_contract::created_data_contract::CreatedDataContract; +#[cfg(feature = "data-contract-value-conversion")] use crate::data_contract::data_contract::DataContractV0; use crate::data_contract::serialized_version::v0::DataContractInSerializationFormatV0; use crate::data_contract::serialized_version::DataContractInSerializationFormat; -use crate::data_contract::DataContract; +use crate::data_contract::{DataContract, INITIAL_DATA_CONTRACT_VERSION}; use crate::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use crate::util::entropy_generator::{DefaultEntropyGenerator, EntropyGenerator}; +use crate::prelude::IdentityNonce; use crate::version::PlatformVersion; use crate::{errors::ProtocolError, prelude::Identifier}; @@ -30,26 +31,18 @@ use crate::{errors::ProtocolError, prelude::Identifier}; pub struct DataContractFactoryV0 { /// The feature version used by this factory. protocol_version: u32, - - /// An EntropyGenerator for generating entropy during data contract creation. - entropy_generator: Box, } impl DataContractFactoryV0 { - pub fn new( - protocol_version: u32, - entropy_generator: Option>, - ) -> Self { - Self { - protocol_version, - entropy_generator: entropy_generator.unwrap_or(Box::new(DefaultEntropyGenerator)), - } + pub fn new(protocol_version: u32) -> Self { + Self { protocol_version } } /// Create Data Contract pub fn create_with_value_config( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, @@ -60,23 +53,22 @@ impl DataContractFactoryV0 { let config = config .map(|config_value| DataContractConfig::from_value(config_value, platform_version)) .transpose()?; - self.create(owner_id, documents, config, definitions) + self.create(owner_id, identity_nonce, documents, config, definitions) } /// Create Data Contract pub fn create( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { - let entropy = Bytes32::new(self.entropy_generator.generate()?); - let platform_version = PlatformVersion::get(self.protocol_version)?; let data_contract_id = - DataContract::generate_data_contract_id_v0(owner_id.to_buffer(), entropy.to_buffer()); + DataContract::generate_data_contract_id_v0(owner_id.to_buffer(), identity_nonce); let defs = definitions .map(|defs| defs.into_btree_string_map()) @@ -90,16 +82,20 @@ impl DataContractFactoryV0 { let format = DataContractInSerializationFormat::V0(DataContractInSerializationFormatV0 { id: data_contract_id, config: config.unwrap_or(DataContractConfig::default_for_version(platform_version)?), - version: 1, + version: INITIAL_DATA_CONTRACT_VERSION, owner_id, document_schemas: documents_map, schema_defs: defs, }); let data_contract = - DataContract::try_from_platform_versioned(format, true, platform_version)?; + DataContract::try_from_platform_versioned(format, true, &mut vec![], platform_version)?; - CreatedDataContract::from_contract_and_entropy(data_contract, entropy, platform_version) + CreatedDataContract::from_contract_and_identity_nonce( + data_contract, + identity_nonce, + platform_version, + ) } #[cfg(feature = "data-contract-value-conversion")] @@ -107,7 +103,7 @@ impl DataContractFactoryV0 { pub fn create_from_object( &self, data_contract_object: Value, - validate: bool, + full_validation: bool, ) -> Result { let platform_version = PlatformVersion::get(self.protocol_version)?; match platform_version @@ -115,10 +111,12 @@ impl DataContractFactoryV0 { .contract_versions .contract_structure_version { - 0 => Ok( - DataContractV0::from_value(data_contract_object, validate, platform_version)? - .into(), - ), + 0 => Ok(DataContractV0::from_value( + data_contract_object, + full_validation, + platform_version, + )? + .into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContractFactoryV0::create_from_object".to_string(), known_versions: vec![0], @@ -192,9 +190,10 @@ impl DataContractFactoryV0 { pub fn create_unsigned_data_contract_update_transition( &self, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { DataContractUpdateTransition::try_from_platform_versioned( - data_contract, + (data_contract, identity_contract_nonce), PlatformVersion::get(self.protocol_version)?, ) } @@ -220,14 +219,14 @@ mod tests { fn get_test_data() -> TestData { let platform_version = PlatformVersion::latest(); let created_data_contract = - get_data_contract_fixture(None, platform_version.protocol_version); + get_data_contract_fixture(None, 0, platform_version.protocol_version); let raw_data_contract = created_data_contract .data_contract() .to_value(platform_version) .unwrap(); - let factory = DataContractFactoryV0::new(platform_version.protocol_version, None); + let factory = DataContractFactoryV0::new(platform_version.protocol_version); TestData { created_data_contract, raw_data_contract, @@ -258,6 +257,7 @@ mod tests { let result = factory .create_with_value_config( data_contract.owner_id(), + 1, raw_documents, None, Some(raw_defs), @@ -339,11 +339,15 @@ mod tests { .expect("Data Contract Transition should be created"); assert_eq!(0, result.state_transition_protocol_version()); - assert_eq!(&created_data_contract.entropy_used(), &result.entropy()); + assert_eq!( + created_data_contract.identity_nonce(), + result.identity_nonce() + ); let contract_value = DataContract::try_from_platform_versioned( result.data_contract().to_owned(), false, + &mut vec![], platform_version, ) .unwrap() diff --git a/packages/rs-dpp/src/data_contract/generate_data_contract.rs b/packages/rs-dpp/src/data_contract/generate_data_contract.rs index fa6caea7d17..0280124e115 100644 --- a/packages/rs-dpp/src/data_contract/generate_data_contract.rs +++ b/packages/rs-dpp/src/data_contract/generate_data_contract.rs @@ -1,18 +1,19 @@ use crate::data_contract::DataContract; +use crate::prelude::IdentityNonce; use platform_value::Identifier; use std::io::Write; -use crate::util::hash::hash; +use crate::util::hash::hash_double; impl DataContract { - /// Generate data contract id based on owner id and entropy + /// Generate data contract id based on owner id and identity nonce pub fn generate_data_contract_id_v0( owner_id: impl AsRef<[u8]>, - entropy: impl AsRef<[u8]>, + identity_nonce: IdentityNonce, ) -> Identifier { let mut b: Vec = vec![]; let _ = b.write(owner_id.as_ref()); - let _ = b.write(entropy.as_ref()); - Identifier::from(hash(b)) + let _ = b.write(identity_nonce.to_be_bytes().as_slice()); + Identifier::from(hash_double(b)) } } diff --git a/packages/rs-dpp/src/data_contract/methods/mod.rs b/packages/rs-dpp/src/data_contract/methods/mod.rs index 83e4933421c..d9bde273a7d 100644 --- a/packages/rs-dpp/src/data_contract/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/methods/mod.rs @@ -1,3 +1,5 @@ pub mod schema; #[cfg(feature = "validation")] -pub mod validation; +pub mod validate_document; +#[cfg(feature = "validation")] +pub mod validate_update; diff --git a/packages/rs-dpp/src/data_contract/methods/schema/mod.rs b/packages/rs-dpp/src/data_contract/methods/schema/mod.rs index c8ee5c7afac..63748fb45f8 100644 --- a/packages/rs-dpp/src/data_contract/methods/schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/methods/schema/mod.rs @@ -3,6 +3,7 @@ pub use v0::*; use crate::data_contract::{DefinitionName, DocumentName}; use crate::prelude::DataContract; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; @@ -13,13 +14,18 @@ impl DataContractSchemaMethodsV0 for DataContract { &mut self, schemas: BTreeMap, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { match self { - DataContract::V0(v0) => { - v0.set_document_schemas(schemas, defs, validate, platform_version) - } + DataContract::V0(v0) => v0.set_document_schemas( + schemas, + defs, + full_validation, + validation_operations, + platform_version, + ), } } @@ -27,13 +33,18 @@ impl DataContractSchemaMethodsV0 for DataContract { &mut self, name: &str, schema: Value, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { match self { - DataContract::V0(v0) => { - v0.set_document_schema(name, schema, validate, platform_version) - } + DataContract::V0(v0) => v0.set_document_schema( + name, + schema, + full_validation, + validation_operations, + platform_version, + ), } } @@ -52,11 +63,17 @@ impl DataContractSchemaMethodsV0 for DataContract { fn set_schema_defs( &mut self, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { match self { - DataContract::V0(v0) => v0.set_schema_defs(defs, validate, platform_version), + DataContract::V0(v0) => v0.set_schema_defs( + defs, + full_validation, + validation_operations, + platform_version, + ), } } } diff --git a/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs index a509d90d7e0..ff7bfcb5101 100644 --- a/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs @@ -1,4 +1,5 @@ use crate::data_contract::{DefinitionName, DocumentName}; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; @@ -9,7 +10,8 @@ pub trait DataContractSchemaMethodsV0 { &mut self, schemas: BTreeMap, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; @@ -17,7 +19,8 @@ pub trait DataContractSchemaMethodsV0 { &mut self, name: &str, schema: Value, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; @@ -26,7 +29,8 @@ pub trait DataContractSchemaMethodsV0 { fn set_schema_defs( &mut self, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; } diff --git a/packages/rs-dpp/src/data_contract/methods/validate_document/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_document/mod.rs new file mode 100644 index 00000000000..acf0bc2b34a --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_document/mod.rs @@ -0,0 +1,53 @@ +use crate::prelude::DataContract; +use platform_value::Value; +use platform_version::version::PlatformVersion; + +mod v0; +use crate::document::Document; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +pub use v0::*; + +impl DataContractDocumentValidationMethodsV0 for DataContract { + fn validate_document( + &self, + name: &str, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .methods + .validate_document + { + 0 => self.validate_document_v0(name, document, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DataContract::validate_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + fn validate_document_properties( + &self, + name: &str, + properties: Value, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .methods + .validate_document + { + 0 => self.validate_document_properties_v0(name, properties, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DataContract::validate_document_properties".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validate_document/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_document/v0/mod.rs new file mode 100644 index 00000000000..e7d10410226 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_document/v0/mod.rs @@ -0,0 +1,137 @@ +use crate::data_contract::accessors::v0::DataContractV0Getters; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; + +use crate::consensus::basic::document::{ + DocumentFieldMaxSizeExceededError, InvalidDocumentTypeError, MissingDocumentTypeError, +}; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::data_contract::schema::DataContractSchemaMethodsV0; +use crate::data_contract::DataContract; +use crate::document::{property_names, Document, DocumentV0Getters}; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Value; +use platform_version::version::PlatformVersion; +use std::ops::Deref; + +pub trait DataContractDocumentValidationMethodsV0 { + fn validate_document( + &self, + name: &str, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_document_properties( + &self, + name: &str, + value: Value, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContract { + #[inline(always)] + pub(super) fn validate_document_properties_v0( + &self, + name: &str, + value: Value, + platform_version: &PlatformVersion, + ) -> Result { + let Some(document_type) = self.document_type_optional_for_name(name) else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(name.to_owned(), self.id()).into(), + )); + }; + + let validator = match document_type { + DocumentTypeRef::V0(v0) => v0.json_schema_validator.deref(), + }; + + if let Some((key, size)) = + value.has_data_larger_than(platform_version.system_limits.max_field_value_size) + { + let field = match key { + Some(Value::Text(field)) => field, + _ => "".to_string(), + }; + return Ok(SimpleConsensusValidationResult::new_with_error( + ConsensusError::BasicError(BasicError::DocumentFieldMaxSizeExceededError( + DocumentFieldMaxSizeExceededError::new( + field, + size as u64, + platform_version.system_limits.max_field_value_size as u64, + ), + )), + )); + } + + let json_value = match value.try_into_validating_json() { + Ok(json_value) => json_value, + Err(e) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + ConsensusError::BasicError(BasicError::ValueError(e.into())), + )) + } + }; + + // Compile json schema validator if it's not yet compiled + if !validator.is_compiled(platform_version)? { + // It is normal that we get a protocol error here, since the document type is coming + // from the state + let root_schema = DocumentType::enrich_with_base_schema( + // TODO: I just wondering if we could you references here + // instead of cloning + document_type.schema().clone(), + self.schema_defs().map(|defs| Value::from(defs.clone())), + platform_version, + )?; + + let root_json_schema = root_schema + .try_to_validating_json() + .map_err(ProtocolError::ValueError)?; + + validator.compile_and_validate(&root_json_schema, &json_value, platform_version) + } else { + validator.validate(&json_value, platform_version) + } + } + + // TODO: Move to document + #[inline(always)] + pub(super) fn validate_document_v0( + &self, + name: &str, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result { + // Make sure that the document type is defined in the contract + let Some(document_type) = self.document_type_optional_for_name(name) else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(name.to_string(), self.id()).into(), + )); + }; + + // Make sure that timestamps are present if required + let required_fields = document_type.required_fields(); + + if required_fields.contains(property_names::CREATED_AT) && document.created_at().is_none() { + // TODO: Create a special consensus error for this + return Ok(SimpleConsensusValidationResult::new_with_error( + MissingDocumentTypeError::new().into(), + )); + } + + if required_fields.contains(property_names::UPDATED_AT) && document.updated_at().is_none() { + // TODO: Create a special consensus error for this + return Ok(SimpleConsensusValidationResult::new_with_error( + MissingDocumentTypeError::new().into(), + )); + } + + // Validate user defined properties + self.validate_document_properties_v0(name, document.properties().into(), platform_version) + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validate_update/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_update/mod.rs new file mode 100644 index 00000000000..e40ea1cb625 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_update/mod.rs @@ -0,0 +1,29 @@ +use crate::prelude::DataContract; +use platform_version::version::PlatformVersion; + +mod v0; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +pub use v0::*; + +impl DataContractUpdateValidationMethodsV0 for DataContract { + fn validate_update( + &self, + data_contract: &DataContract, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .methods + .validate_update + { + 0 => self.validate_update_v0(data_contract, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DataContract::validate_update".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs new file mode 100644 index 00000000000..fed077b7128 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs @@ -0,0 +1,404 @@ +use crate::data_contract::accessors::v0::DataContractV0Getters; + +use crate::consensus::basic::data_contract::{ + IncompatibleDataContractSchemaError, InvalidDataContractVersionError, +}; +use crate::consensus::state::data_contract::data_contract_update_permission_error::DataContractUpdatePermissionError; +use crate::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError; +use crate::data_contract::document_type::schema::validate_schema_compatibility; +use crate::data_contract::schema::DataContractSchemaMethodsV0; +use crate::data_contract::DataContract; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Value; +use platform_version::version::PlatformVersion; +use serde_json::json; + +pub trait DataContractUpdateValidationMethodsV0 { + fn validate_update( + &self, + data_contract: &DataContract, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContract { + #[inline(always)] + pub(super) fn validate_update_v0( + &self, + new_data_contract: &DataContract, + platform_version: &PlatformVersion, + ) -> Result { + // Check if the contract is owned by the same identity + if self.owner_id() != new_data_contract.owner_id() { + return Ok(SimpleConsensusValidationResult::new_with_error( + DataContractUpdatePermissionError::new(self.id(), new_data_contract.owner_id()) + .into(), + )); + } + + // Check version is bumped + // Failure (version != previous version + 1): Keep ST and transform it to a nonce bump action. + // How: A user pushed an update that was not the next version. + + let new_version = new_data_contract.version(); + let old_version = self.version(); + if new_version < old_version || new_version - old_version != 1 { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDataContractVersionError::new(old_version + 1, new_version).into(), + )); + } + + // Validate that the config was not updated + // * Includes verifications that: + // - Old contract is not read_only + // - New contract is not read_only + // - Keeps history did not change + // - Can be deleted did not change + // - Documents keep history did not change + // - Documents can be deleted contract default did not change + // - Documents mutable contract default did not change + // - Requires identity encryption bounded key did not change + // - Requires identity decryption bounded key did not change + // * Failure (contract does not exist): Keep ST and transform it to a nonce bump action. + // * How: A user pushed an update to a contract that changed its configuration. + + let config_validation_result = self.config().validate_update( + new_data_contract.config(), + self.id(), + platform_version, + )?; + + if !config_validation_result.is_valid() { + return Ok(SimpleConsensusValidationResult::new_with_errors( + config_validation_result.errors, + )); + } + + // Validate updates for existing document types to make sure that previously created + // documents will be still valid with a new version of the data contract + for (document_type_name, old_document_type) in self.document_types() { + // Make sure that existing document aren't removed + let Some(new_document_type) = + new_data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.id(), + document_type_name, + "document type can't be removed", + ) + .into(), + )); + }; + + // Validate document type update rules + let validate_update_result = old_document_type + .as_ref() + .validate_update(new_document_type, platform_version)?; + + if !validate_update_result.is_valid() { + return Ok(SimpleConsensusValidationResult::new_with_errors( + validate_update_result.errors, + )); + } + } + + // Schema $defs should be compatible + if let Some(old_defs_map) = self.schema_defs() { + // If new contract doesn't have $defs, it means that it's $defs was removed and compatibility is broken + let Some(new_defs_map) = new_data_contract.schema_defs() else { + return Ok(SimpleConsensusValidationResult::new_with_error( + IncompatibleDataContractSchemaError::new( + self.id(), + "remove".to_string(), + "/$defs".to_string(), + ) + .into(), + )); + }; + + // If $defs is updated we need to make sure that our data contract is still compatible + // with previously created data + if old_defs_map != new_defs_map { + // both new and old $defs already validated as a part of new and old contract + let old_defs_json = Value::from(old_defs_map) + .try_into_validating_json() + .map_err(ProtocolError::ValueError)?; + + let new_defs_json = Value::from(new_defs_map) + .try_into_validating_json() + .map_err(ProtocolError::ValueError)?; + + let old_defs_schema = json!({ + "$defs": old_defs_json + }); + + let new_defs_schema = json!({ + "$defs": new_defs_json + }); + + // We do not allow to remove or modify $ref in document type schemas + // it means that compatible changes in $defs won't break the overall compatibility + // Make sure that updated $defs schema is compatible + let compatibility_validation_result = validate_schema_compatibility( + &old_defs_schema, + &new_defs_schema, + platform_version, + )?; + + if !compatibility_validation_result.is_valid() { + let errors = compatibility_validation_result + .errors + .into_iter() + .map(|operation| { + IncompatibleDataContractSchemaError::new( + self.id(), + operation.name, + operation.path, + ) + .into() + }) + .collect(); + + return Ok(SimpleConsensusValidationResult::new_with_errors(errors)); + } + } + } + + Ok(SimpleConsensusValidationResult::new()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::consensus::basic::basic_error::BasicError; + use crate::consensus::state::state_error::StateError; + use crate::consensus::ConsensusError; + use crate::data_contract::config::v0::DataContractConfigSettersV0; + use crate::prelude::IdentityNonce; + use crate::tests::fixtures::get_data_contract_fixture; + use assert_matches::assert_matches; + use platform_value::platform_value; + use platform_value::Identifier; + + mod validate_update { + use super::*; + use crate::data_contract::accessors::v0::DataContractV0Setters; + use crate::data_contract::document_type::DocumentTypeMutRef; + + #[test] + fn should_return_invalid_result_if_owner_id_is_not_the_same() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.as_v0_mut().unwrap().owner_id = Identifier::random(); + + let result = old_data_contract + .validate_update(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DataContractUpdatePermissionError(e) + )] if *e.data_contract_id() == old_data_contract.id() && *e.identity_id() == new_data_contract.owner_id() + ); + } + + #[test] + fn should_return_invalid_result_if_contract_version_is_not_greater_for_one() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let new_data_contract = old_data_contract.clone(); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::InvalidDataContractVersionError(e) + )] if e.expected_version() == old_data_contract.version() + 1 && e.version() == new_data_contract.version() + ); + } + + #[test] + fn should_return_invalid_result_if_config_was_updated() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract.config_mut().set_readonly(true); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DataContractConfigUpdateError(e) + )] if e.additional_message() == "contract can not be changed to readonly" + ); + } + + #[test] + fn should_return_invalid_result_when_document_type_is_removed() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract + .document_types_mut() + .remove("niceDocument"); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can't be removed" + ); + } + + #[test] + fn should_return_invalid_result_when_document_type_has_incompatible_change() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + + let DocumentTypeMutRef::V0(new_document_type) = new_data_contract + .document_types_mut() + .get_mut("niceDocument") + .unwrap() + .as_mut_ref(); + new_document_type.documents_mutable = false; + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents are mutable: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_defs_is_removed() { + let platform_version = PlatformVersion::latest(); + + let mut old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + // Remove document that uses $defs, so we can safely remove it for testing + old_data_contract + .document_types_mut() + .remove("prettyDocument"); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract + .set_schema_defs(None, false, &mut Vec::new(), platform_version) + .expect("failed to set schema defs"); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::IncompatibleDataContractSchemaError(e) + )] if e.operation() == "remove" && e.field_path() == "/$defs" + ); + } + + #[test] + fn should_return_invalid_result_when_updated_defs_is_incompatible() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + let incompatible_defs_value = platform_value!({ + "lastName": { + "type": "number", + }, + }); + let incompatible_defs = incompatible_defs_value + .into_btree_string_map() + .expect("should convert to map"); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract + .set_schema_defs( + Some(incompatible_defs), + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to set schema defs"); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::IncompatibleDataContractSchemaError(e) + )] if e.operation() == "replace" && e.field_path() == "/$defs/lastName/type" + ); + } + + #[test] + fn should_pass_when_all_changes_are_compatible() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert!(result.is_valid()); + } + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validation/mod.rs b/packages/rs-dpp/src/data_contract/methods/validation/mod.rs deleted file mode 100644 index e0291db7abc..00000000000 --- a/packages/rs-dpp/src/data_contract/methods/validation/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -use crate::prelude::DataContract; -use platform_value::Value; -use platform_version::version::PlatformVersion; - -mod v0; -use crate::document::Document; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -pub use v0::*; - -impl DataContractValidationMethodsV0 for DataContract { - fn validate_document( - &self, - name: &str, - document: &Document, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .contract_versions - .methods - .validate_document - { - 0 => self.validate_document_v0(name, document, platform_version), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DataContract::validate_document".to_string(), - known_versions: vec![0], - received: version, - }), - } - } - - fn validate_document_properties( - &self, - name: &str, - properties: Value, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .contract_versions - .methods - .validate_document - { - 0 => self.validate_document_properties_v0(name, properties, platform_version), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DataContract::validate_document_properties".to_string(), - known_versions: vec![0], - received: version, - }), - } - } -} diff --git a/packages/rs-dpp/src/data_contract/methods/validation/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/validation/v0/mod.rs deleted file mode 100644 index f347ddb46c2..00000000000 --- a/packages/rs-dpp/src/data_contract/methods/validation/v0/mod.rs +++ /dev/null @@ -1,107 +0,0 @@ -use crate::data_contract::accessors::v0::DataContractV0Getters; -use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::data_contract::document_type::schema::enrich_with_base_schema; -use crate::data_contract::document_type::DocumentTypeRef; - -use crate::consensus::basic::document::{InvalidDocumentTypeError, MissingDocumentTypeError}; -use crate::data_contract::schema::DataContractSchemaMethodsV0; -use crate::data_contract::DataContract; -use crate::document::{property_names, Document, DocumentV0Getters}; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Value; -use platform_version::version::PlatformVersion; -use std::ops::Deref; - -pub trait DataContractValidationMethodsV0 { - fn validate_document( - &self, - name: &str, - document: &Document, - platform_version: &PlatformVersion, - ) -> Result; - - fn validate_document_properties( - &self, - name: &str, - value: Value, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl DataContract { - pub(super) fn validate_document_properties_v0( - &self, - name: &str, - value: Value, - platform_version: &PlatformVersion, - ) -> Result { - let Some(document_type) = self.document_type_optional_for_name(name) else { - return Ok(SimpleConsensusValidationResult::new_with_error( - InvalidDocumentTypeError::new(name.to_owned(), self.id()).into(), - )); - }; - - let validator = match document_type { - DocumentTypeRef::V0(v0) => v0.json_schema_validator.deref(), - }; - - // Compile json schema validator if it's not yet compiled - if !validator.is_compiled(platform_version)? { - let root_schema = enrich_with_base_schema( - // TODO: I just wondering if we could you references here - // instead of cloning - document_type.schema().clone(), - self.schema_defs().map(|defs| Value::from(defs.clone())), - platform_version, - )?; - - let root_json_schema = root_schema - .try_to_validating_json() - .map_err(ProtocolError::ValueError)?; - - validator.compile(&root_json_schema, platform_version)?; - } - - let json_value = value - .try_into_validating_json() - .map_err(ProtocolError::ValueError)?; - - validator.validate(&json_value, platform_version) - } - - // TODO: Move to document - pub(super) fn validate_document_v0( - &self, - name: &str, - document: &Document, - platform_version: &PlatformVersion, - ) -> Result { - // Make sure that the document type is defined in the contract - let Some(document_type) = self.document_type_optional_for_name(name) else { - return Ok(SimpleConsensusValidationResult::new_with_error( - InvalidDocumentTypeError::new(name.to_string(), self.id()).into(), - )); - }; - - // Make sure that timestamps are present if required - let required_fields = document_type.required_fields(); - - if required_fields.contains(property_names::CREATED_AT) && document.created_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - if required_fields.contains(property_names::UPDATED_AT) && document.updated_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - // Validate user defined properties - self.validate_document_properties_v0(name, document.properties().into(), platform_version) - } -} diff --git a/packages/rs-dpp/src/data_contract/mod.rs b/packages/rs-dpp/src/data_contract/mod.rs index cffbceea576..5fd8f7b56f5 100644 --- a/packages/rs-dpp/src/data_contract/mod.rs +++ b/packages/rs-dpp/src/data_contract/mod.rs @@ -4,11 +4,9 @@ use crate::serialization::{ PlatformLimitDeserializableFromVersionedStructure, PlatformSerializableWithPlatformVersion, }; -pub use data_contract::*; use derive_more::From; use bincode::config::{BigEndian, Configuration}; -pub use generate_data_contract::*; pub mod errors; pub mod extra; @@ -22,7 +20,7 @@ pub mod document_type; mod v0; #[cfg(feature = "factories")] -mod factory; +pub mod factory; #[cfg(feature = "factories")] pub use factory::*; pub mod conversion; @@ -42,8 +40,7 @@ pub use v0::*; use crate::data_contract::serialized_version::{ DataContractInSerializationFormat, CONTRACT_DESERIALIZATION_LIMIT, }; -use crate::data_contract::v0::data_contract::DataContractV0; -use crate::util::hash::hash_to_vec; +use crate::util::hash::hash_double_to_vec; use crate::version::{FeatureVersion, PlatformVersion}; use crate::ProtocolError; @@ -58,6 +55,8 @@ type DefinitionName = String; pub type DocumentName = String; type PropertyPath = String; +pub const INITIAL_DATA_CONTRACT_VERSION: u32 = 1; + /// Understanding Data Contract versioning /// Data contract versioning is both for the code structure and for serialization. /// @@ -123,7 +122,7 @@ impl PlatformSerializableWithPlatformVersion for DataContract { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for DataContract { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -143,7 +142,8 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Dat .0; DataContract::try_from_platform_versioned( data_contract_in_serialization_format, - validate, + full_validation, + &mut vec![], platform_version, ) } @@ -152,7 +152,7 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Dat impl PlatformDeserializableWithBytesLenFromVersionedStructure for DataContract { fn versioned_deserialize_with_bytes_len( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result<(Self, usize), ProtocolError> where @@ -171,7 +171,8 @@ impl PlatformDeserializableWithBytesLenFromVersionedStructure for DataContract { Ok(( DataContract::try_from_platform_versioned( data_contract_in_serialization_format, - validate, + full_validation, + &mut vec![], platform_version, )?, len, @@ -203,6 +204,7 @@ impl PlatformLimitDeserializableFromVersionedStructure for DataContract { DataContract::try_from_platform_versioned( data_contract_in_serialization_format, true, + &mut vec![], platform_version, ) } @@ -240,9 +242,9 @@ impl DataContract { } pub fn hash(&self, platform_version: &PlatformVersion) -> Result, ProtocolError> { - Ok(hash_to_vec(self.serialize_to_bytes_with_platform_version( - platform_version, - )?)) + Ok(hash_double_to_vec( + self.serialize_to_bytes_with_platform_version(platform_version)?, + )) } } @@ -265,7 +267,7 @@ mod tests { #[test] fn test_contract_serialization() { let platform_version = PlatformVersion::latest(); - let data_contract = load_system_data_contract(Dashpay, platform_version.protocol_version) + let data_contract = load_system_data_contract(Dashpay, platform_version) .expect("expected dashpay contract"); let platform_version = PlatformVersion::latest(); let serialized = data_contract @@ -288,8 +290,9 @@ mod tests { #[test] fn test_contract_can_have_specialized_contract_encryption_decryption_keys() { - let data_contract = get_dashpay_contract_with_generalized_encryption_key_fixture(None, 1) - .data_contract_owned(); + let data_contract = + get_dashpay_contract_with_generalized_encryption_key_fixture(None, 0, 1) + .data_contract_owned(); assert_eq!( data_contract .config() @@ -306,7 +309,7 @@ mod tests { #[test] fn test_contract_document_type_can_have_specialized_contract_encryption_decryption_keys() { - let data_contract = get_dashpay_contract_fixture(None, 1).data_contract_owned(); + let data_contract = get_dashpay_contract_fixture(None, 0, 1).data_contract_owned(); assert_eq!( data_contract .document_type_for_name("contactRequest") diff --git a/packages/rs-dpp/src/data_contract/serialized_version/mod.rs b/packages/rs-dpp/src/data_contract/serialized_version/mod.rs index bf25d0accbc..150bc6a28bf 100644 --- a/packages/rs-dpp/src/data_contract/serialized_version/mod.rs +++ b/packages/rs-dpp/src/data_contract/serialized_version/mod.rs @@ -4,12 +4,14 @@ use crate::data_contract::{DataContract, DefinitionName, DocumentName}; use crate::version::PlatformVersion; use std::collections::BTreeMap; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::From; use platform_value::{Identifier, Value}; use platform_version::TryFromPlatformVersioned; use platform_versioning::PlatformVersioned; +#[cfg(feature = "data-contract-serde-conversion")] use serde::{Deserialize, Serialize}; pub(in crate::data_contract) mod v0; @@ -53,6 +55,12 @@ impl DataContractInSerializationFormat { DataContractInSerializationFormat::V0(v0) => v0.schema_defs.as_ref(), } } + + pub fn version(&self) -> u32 { + match self { + DataContractInSerializationFormat::V0(v0) => v0.version, + } + } } impl TryFromPlatformVersioned for DataContractInSerializationFormat { @@ -163,7 +171,8 @@ impl TryFromPlatformVersioned for DataContractInSerializationForma impl DataContract { pub fn try_from_platform_versioned( value: DataContractInSerializationFormat, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { match value { @@ -176,7 +185,8 @@ impl DataContract { 0 => { let data_contract = DataContractV0::try_from_platform_versioned_v0( serialization_format_v0, - validate, + full_validation, + validation_operations, platform_version, )?; Ok(data_contract.into()) diff --git a/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs b/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs index ba2a5bd4f15..085b1d2a829 100644 --- a/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs @@ -1,7 +1,7 @@ use crate::data_contract::config::v0::DataContractConfigV0; use crate::data_contract::config::DataContractConfig; use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; + use crate::data_contract::v0::DataContractV0; use crate::data_contract::{DataContract, DefinitionName, DocumentName}; use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; diff --git a/packages/rs-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs b/packages/rs-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs deleted file mode 100644 index 0869dd85e0a..00000000000 --- a/packages/rs-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs +++ /dev/null @@ -1,447 +0,0 @@ -use std::collections::BTreeMap; -use std::convert::TryInto; - -use crate::serialization_traits::PlatformSerializable; -use platform_serialization::PlatformSignable; -use platform_serialization::{PlatformDeserialize, PlatformSerialize}; - -use platform_value::btreemap_extensions::BTreeValueMapHelper; -use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; -use platform_value::{BinaryData, Bytes32, IntegerReplacementType, ReplacementType, Value}; -use serde::{Deserialize, Serialize}; -use serde_json::Value as JsonValue; - -use crate::{ - data_contract::DataContract, - identity::KeyID, - prelude::Identifier, - state_transition::{ - StateTransitionConvert, StateTransitionIdentitySigned, StateTransitionLike, - StateTransitionType, - }, - Convertible, ProtocolError, -}; - -use super::property_names::*; - -use crate::serialization_traits::{PlatformDeserializable, Signable}; - -use bincode::{config, Decode, Encode}; - -mod action; -pub mod apply_data_contract_create_transition_factory; -pub mod builder; -mod serialize_for_signing; -pub mod validation; - -pub use action::{ - DataContractCreateTransitionAction, DATA_CONTRACT_CREATE_TRANSITION_ACTION_VERSION, -}; - -pub mod property_names { - pub const PROTOCOL_VERSION: &str = "protocolVersion"; - pub const DATA_CONTRACT: &str = "dataContract"; - pub const DATA_CONTRACT_ID: &str = "dataContract.$id"; - pub const DATA_CONTRACT_OWNER_ID: &str = "dataContract.ownerId"; - pub const DATA_CONTRACT_ENTROPY: &str = "dataContract.entropy"; - pub const ENTROPY: &str = "entropy"; - pub const DATA_CONTRACT_PROTOCOL_VERSION: &str = "dataContract.protocolVersion"; - pub const SIGNATURE_PUBLIC_KEY_ID: &str = "signaturePublicKeyId"; - pub const SIGNATURE: &str = "signature"; -} - -pub const IDENTIFIER_FIELDS: [&str; 2] = [ - property_names::DATA_CONTRACT_ID, - property_names::DATA_CONTRACT_OWNER_ID, -]; -pub const BINARY_FIELDS: [&str; 3] = [ - property_names::ENTROPY, - property_names::DATA_CONTRACT_ENTROPY, - property_names::SIGNATURE, -]; -pub const U32_FIELDS: [&str; 2] = [ - property_names::PROTOCOL_VERSION, - property_names::DATA_CONTRACT_PROTOCOL_VERSION, -]; - -#[derive( - Debug, - Clone, - Serialize, - Deserialize, - Encode, - Decode, - PlatformDeserialize, - PlatformSerialize, - PartialEq, - PlatformSignable, -)] -#[serde(rename_all = "camelCase")] -#[platform_error_type(ProtocolError)] -pub struct DataContractCreateTransition { - pub protocol_version: u32, - #[serde(rename = "type")] - pub transition_type: StateTransitionType, - pub data_contract: DataContract, - pub entropy: Bytes32, - #[platform_signable(exclude_from_sig_hash)] - pub signature_public_key_id: KeyID, - #[platform_signable(exclude_from_sig_hash)] - pub signature: BinaryData, -} - -impl std::default::Default for DataContractCreateTransition { - fn default() -> Self { - DataContractCreateTransition { - protocol_version: Default::default(), - transition_type: StateTransitionType::DataContractCreate, - entropy: Bytes32::default(), - signature_public_key_id: 0, - signature: BinaryData::default(), - data_contract: Default::default(), - } - } -} - -impl DataContractCreateTransition { - pub fn from_raw_object( - mut raw_object: Value, - ) -> Result { - Ok(DataContractCreateTransition { - protocol_version: raw_object.get_integer(PROTOCOL_VERSION)?, - signature: raw_object - .remove_optional_binary_data(SIGNATURE) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - signature_public_key_id: raw_object - .get_optional_integer(SIGNATURE_PUBLIC_KEY_ID) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - entropy: raw_object - .remove_optional_bytes_32(ENTROPY) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - data_contract: DataContract::from_raw_object( - raw_object.remove(DATA_CONTRACT).map_err(|_| { - ProtocolError::DecodingError( - "data contract missing on state transition".to_string(), - ) - })?, - )?, - ..Default::default() - }) - } - - pub fn from_value_map( - mut raw_data_contract_create_transition: BTreeMap, - ) -> Result { - Ok(DataContractCreateTransition { - protocol_version: raw_data_contract_create_transition - .get_integer(PROTOCOL_VERSION) - .map_err(ProtocolError::ValueError)?, - signature: raw_data_contract_create_transition - .remove_optional_binary_data(SIGNATURE) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - signature_public_key_id: raw_data_contract_create_transition - .remove_optional_integer(SIGNATURE_PUBLIC_KEY_ID) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - entropy: raw_data_contract_create_transition - .remove_optional_bytes_32(ENTROPY) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - data_contract: DataContract::from_raw_object( - raw_data_contract_create_transition - .remove(DATA_CONTRACT) - .ok_or(ProtocolError::DecodingError( - "data contract missing on state transition".to_string(), - ))?, - )?, - ..Default::default() - }) - } - - pub fn get_data_contract(&self) -> &DataContract { - &self.data_contract - } - - pub fn get_protocol_version(&self) -> u32 { - self.protocol_version - } - - pub fn set_data_contract(&mut self, data_contract: DataContract) { - self.data_contract = data_contract; - } - - /// Returns ID of the created contract - pub fn get_modified_data_ids(&self) -> Vec { - vec![self.data_contract.id] - } - - pub fn clean_value(value: &mut Value) -> Result<(), platform_value::Error> { - value.replace_at_paths(IDENTIFIER_FIELDS, ReplacementType::Identifier)?; - value.replace_at_paths(BINARY_FIELDS, ReplacementType::BinaryBytes)?; - value.replace_integer_type_at_paths(U32_FIELDS, IntegerReplacementType::U32)?; - Ok(()) - } -} - -impl StateTransitionIdentitySigned for DataContractCreateTransition { - /// Get owner ID - fn get_owner_id(&self) -> &Identifier { - &self.data_contract.owner_id - } - - fn get_signature_public_key_id(&self) -> Option { - Some(self.signature_public_key_id) - } - - fn set_signature_public_key_id(&mut self, key_id: crate::identity::KeyID) { - self.signature_public_key_id = key_id - } -} - -impl StateTransitionLike for DataContractCreateTransition { - /// Returns ID of the created contract - fn get_modified_data_ids(&self) -> Vec { - vec![self.data_contract.id] - } - - fn get_protocol_version(&self) -> u32 { - self.protocol_version - } - /// returns the type of State Transition - fn get_type(&self) -> StateTransitionType { - self.transition_type - } - /// returns the signature as a byte-array - fn get_signature(&self) -> &BinaryData { - &self.signature - } - /// set a new signature - fn set_signature(&mut self, signature: BinaryData) { - self.signature = signature - } - - fn set_signature_bytes(&mut self, signature: Vec) { - self.signature = BinaryData::new(signature) - } -} - -impl StateTransitionConvert for DataContractCreateTransition { - fn signature_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, SIGNATURE_PUBLIC_KEY_ID] - } - - fn identifiers_property_paths() -> Vec<&'static str> { - vec![] - } - - fn binary_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, ENTROPY] - } - - fn to_json(&self, skip_signature: bool) -> Result { - self.to_cleaned_object(skip_signature) - .and_then(|value| value.try_into().map_err(ProtocolError::ValueError)) - } - - fn to_object(&self, skip_signature: bool) -> Result { - let mut object: Value = platform_value::to_value(self)?; - if skip_signature { - Self::signature_property_paths() - .into_iter() - .try_for_each(|path| { - object - .remove_values_matching_path(path) - .map_err(ProtocolError::ValueError) - .map(|_| ()) - })?; - } - object.insert(String::from(DATA_CONTRACT), self.data_contract.to_object()?)?; - Ok(object) - } - - fn to_cleaned_object(&self, skip_signature: bool) -> Result { - let mut object: Value = platform_value::to_value(self)?; - if skip_signature { - Self::signature_property_paths() - .into_iter() - .try_for_each(|path| { - object - .remove_values_matching_path(path) - .map_err(ProtocolError::ValueError) - .map(|_| ()) - })?; - } - object.insert( - String::from(DATA_CONTRACT), - self.data_contract.to_cleaned_object()?, - )?; - Ok(object) - } -} - -#[cfg(test)] -mod test { - use crate::data_contract::CreatedDataContract; - use integer_encoding::VarInt; - - use crate::tests::fixtures::get_data_contract_fixture; - use crate::util::json_value::JsonValueExt; - use crate::version; - - use super::*; - - struct TestData { - state_transition: DataContractCreateTransition, - created_data_contract: CreatedDataContract, - } - - fn get_test_data() -> TestData { - let created_data_contract = get_data_contract_fixture(None); - - let state_transition = DataContractCreateTransition::from_raw_object(Value::from([ - (PROTOCOL_VERSION, version::LATEST_VERSION.into()), - (ENTROPY, created_data_contract.entropy_used.into()), - ( - DATA_CONTRACT, - created_data_contract.data_contract.to_object().unwrap(), - ), - ])) - .expect("state transition should be created without errors"); - - TestData { - created_data_contract, - state_transition, - } - } - - #[test] - fn should_return_protocol_version() { - let data = get_test_data(); - assert_eq!( - version::LATEST_VERSION, - data.state_transition.get_protocol_version() - ) - } - - #[test] - fn should_return_transition_type() { - let data = get_test_data(); - assert_eq!( - StateTransitionType::DataContractCreate, - data.state_transition.get_type() - ); - } - - #[test] - fn should_return_data_contract() { - let data = get_test_data(); - - assert_eq!( - data.state_transition - .get_data_contract() - .to_json_object() - .expect("conversion to object shouldn't fail"), - data.created_data_contract - .data_contract - .to_json_object() - .expect("conversion to object shouldn't fail") - ); - } - - #[test] - fn should_return_state_transition_in_json_format() { - let data = get_test_data(); - let mut json_object = data - .state_transition - .to_json(false) - .expect("conversion to JSON shouldn't fail"); - - assert_eq!( - version::LATEST_VERSION, - json_object - .get_u64(PROTOCOL_VERSION) - .expect("the protocol version should be present") as u32 - ); - - assert_eq!( - 0, - json_object - .get_u64(TRANSITION_TYPE) - .expect("the transition type should be present") as u8 - ); - assert_eq!( - 0, - json_object - .get_u64(SIGNATURE_PUBLIC_KEY_ID) - .expect("default public key id should be defined"), - ); - assert_eq!( - "", - json_object - .remove_into::(SIGNATURE) - .expect("default string value for signature should be present") - ); - - assert_eq!( - >::into(data.created_data_contract.entropy_used), - json_object - .remove_into::(ENTROPY) - .expect("the entropy should be present") - ) - } - - #[test] - fn should_return_serialized_state_transition_to_buffer() { - let data = get_test_data(); - let state_transition_bytes = data - .state_transition - .to_cbor_buffer(false) - .expect("state transition should be converted to buffer"); - let (protocol_version, _) = - u32::decode_var(state_transition_bytes.as_ref()).expect("expected to decode"); - assert_eq!(version::LATEST_VERSION, protocol_version) - } - - #[test] - fn should_return_owner_id() { - let data = get_test_data(); - assert_eq!( - &data.created_data_contract.data_contract.owner_id, - data.state_transition.get_owner_id() - ); - } - - #[test] - fn is_data_contract_state_transition() { - let data = get_test_data(); - assert!(data.state_transition.is_data_contract_state_transition()); - assert!(!data.state_transition.is_document_state_transition()); - assert!(!data.state_transition.is_identity_state_transition()); - } - - mod platform_serializable { - use crate::data_contract::state_transition::data_contract_create_transition::DataContractCreateTransition; - use crate::serialization_traits::{PlatformDeserializable, PlatformSerializable}; - - #[test] - fn should_serialize_config() { - let mut data = super::get_test_data(); - data.state_transition.data_contract.config.keeps_history = true; - let state_transition_bytes = data - .state_transition - .serialize() - .expect("state transition should be serialized"); - - assert!(data.state_transition.data_contract.config.keeps_history); - - let restored = DataContractCreateTransition::deserialize(&state_transition_bytes) - .expect("state transition should be deserialized"); - - assert!(restored.data_contract.config.keeps_history); - } - } -} diff --git a/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs b/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs index 56f0f4017ed..b825466eba2 100644 --- a/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs +++ b/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs @@ -1,3 +1,6 @@ +use crate::consensus::basic::data_contract::UnknownStorageKeyRequirementsError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; use crate::ProtocolError; use bincode::{Decode, Encode}; use serde_repr::*; @@ -20,10 +23,12 @@ impl TryFrom for StorageKeyRequirements { 0 => Ok(Self::Unique), 1 => Ok(Self::Multiple), 2 => Ok(Self::MultipleReferenceToLatest), - value => Err(ProtocolError::UnknownStorageKeyRequirements(format!( - "unrecognized storage key requirements: {}", - value - ))), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownStorageKeyRequirementsError( + UnknownStorageKeyRequirementsError::new(vec![0, 1, 3], value.into()), + )) + .into(), + )), } } } @@ -35,10 +40,12 @@ impl TryFrom for StorageKeyRequirements { 0 => Ok(Self::Unique), 1 => Ok(Self::Multiple), 2 => Ok(Self::MultipleReferenceToLatest), - value => Err(ProtocolError::UnknownStorageKeyRequirements(format!( - "unrecognized storage key requirements: {}", - value - ))), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownStorageKeyRequirementsError( + UnknownStorageKeyRequirementsError::new(vec![0, 1, 3], value), + )) + .into(), + )), } } } diff --git a/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs b/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs index 1d0168c5e5f..a8fd5cc9331 100644 --- a/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs @@ -1,15 +1,15 @@ use crate::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use crate::data_contract::config::DataContractConfig; -use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; use crate::data_contract::errors::DataContractError; -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; + use crate::data_contract::v0::DataContractV0; use crate::data_contract::DocumentName; use crate::metadata::Metadata; -use crate::ProtocolError; + +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use platform_value::Identifier; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeMap; impl DataContractV0Getters for DataContractV0 { fn id(&self) -> Identifier { @@ -28,20 +28,31 @@ impl DataContractV0Getters for DataContractV0 { self.owner_id } - fn document_type_cloned_for_name(&self, name: &str) -> Result { + fn document_type_cloned_for_name(&self, name: &str) -> Result { self.document_type_cloned_optional_for_name(name) .ok_or_else(|| { - ProtocolError::DataContractError(DataContractError::DocumentTypeNotFound( - "can not get document type from contract", - )) + DataContractError::DocumentTypeNotFound( + "can not get document type from contract".to_string(), + ) }) } - fn document_type_for_name(&self, name: &str) -> Result { + fn document_type_borrowed_for_name( + &self, + name: &str, + ) -> Result<&DocumentType, DataContractError> { + self.document_types.get(name).ok_or_else(|| { + DataContractError::DocumentTypeNotFound( + "can not get document type from contract".to_string(), + ) + }) + } + + fn document_type_for_name(&self, name: &str) -> Result { self.document_type_optional_for_name(name).ok_or_else(|| { - ProtocolError::DataContractError(DataContractError::DocumentTypeNotFound( - "can not get document type from contract", - )) + DataContractError::DocumentTypeNotFound( + "can not get document type from contract".to_string(), + ) }) } @@ -52,19 +63,33 @@ impl DataContractV0Getters for DataContractV0 { } fn document_type_cloned_optional_for_name(&self, name: &str) -> Option { - self.document_types - .get(name) - .map(|document_type| document_type.clone()) + self.document_types.get(name).cloned() } fn has_document_type_for_name(&self, name: &str) -> bool { self.document_types.get(name).is_some() } + fn document_types_with_contested_indexes(&self) -> BTreeMap<&DocumentName, &DocumentType> { + self.document_types + .iter() + .filter(|(_, document_type)| { + document_type + .indexes() + .iter() + .any(|(_, index)| index.contested_index.is_some()) + }) + .collect() + } + fn document_types(&self) -> &BTreeMap { &self.document_types } + fn document_types_mut(&mut self) -> &mut BTreeMap { + &mut self.document_types + } + fn metadata(&self) -> Option<&Metadata> { self.metadata.as_ref() } diff --git a/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs b/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs index 6d8fa5c5d9c..af497027fd3 100644 --- a/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs +++ b/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs @@ -14,10 +14,10 @@ impl DataContractCborConversionMethodsV0 for DataContractV0 { fn from_cbor_with_id( cbor_bytes: impl AsRef<[u8]>, contract_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { - let mut data_contract = Self::from_cbor(cbor_bytes, validate, platform_version)?; + let mut data_contract = Self::from_cbor(cbor_bytes, full_validation, platform_version)?; if let Some(id) = contract_id { data_contract.id = id; } @@ -26,7 +26,7 @@ impl DataContractCborConversionMethodsV0 for DataContractV0 { fn from_cbor( cbor_bytes: impl AsRef<[u8]>, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let data_contract_cbor_value: CborValue = ciborium::de::from_reader(cbor_bytes.as_ref()) @@ -37,7 +37,7 @@ impl DataContractCborConversionMethodsV0 for DataContractV0 { let data_contract_value: Value = Value::try_from(data_contract_cbor_value).map_err(ProtocolError::ValueError)?; - Self::from_value(data_contract_value, validate, platform_version) + Self::from_value(data_contract_value, full_validation, platform_version) } fn to_cbor(&self, platform_version: &PlatformVersion) -> Result, ProtocolError> { diff --git a/packages/rs-dpp/src/data_contract/v0/conversion/json.rs b/packages/rs-dpp/src/data_contract/v0/conversion/json.rs index c1b978830d1..90e05b5f1fd 100644 --- a/packages/rs-dpp/src/data_contract/v0/conversion/json.rs +++ b/packages/rs-dpp/src/data_contract/v0/conversion/json.rs @@ -11,10 +11,10 @@ use std::convert::TryInto; impl DataContractJsonConversionMethodsV0 for DataContractV0 { fn from_json( json_value: JsonValue, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { - Self::from_value(json_value.into(), validate, platform_version) + Self::from_value(json_value.into(), full_validation, platform_version) } /// Returns Data Contract as a JSON Value diff --git a/packages/rs-dpp/src/data_contract/v0/conversion/value.rs b/packages/rs-dpp/src/data_contract/v0/conversion/value.rs index 7f103c96d1f..3ed0a987135 100644 --- a/packages/rs-dpp/src/data_contract/v0/conversion/value.rs +++ b/packages/rs-dpp/src/data_contract/v0/conversion/value.rs @@ -15,7 +15,7 @@ pub const DATA_CONTRACT_IDENTIFIER_FIELDS_V0: [&str; 2] = impl DataContractValueConversionMethodsV0 for DataContractV0 { fn from_value( mut value: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { value.replace_at_paths( @@ -30,7 +30,8 @@ impl DataContractValueConversionMethodsV0 for DataContractV0 { DataContractV0::try_from_platform_versioned( data_contract_data.into(), - validate, + full_validation, + &mut vec![], // this is not used in consensus code platform_version, ) } diff --git a/packages/rs-dpp/src/data_contract/v0/data_contract.rs b/packages/rs-dpp/src/data_contract/v0/data_contract.rs index 100cd1eea1a..d77c22d0bc8 100644 --- a/packages/rs-dpp/src/data_contract/v0/data_contract.rs +++ b/packages/rs-dpp/src/data_contract/v0/data_contract.rs @@ -7,7 +7,7 @@ use crate::data_contract::{DefinitionName, DocumentName}; use crate::data_contract::config::DataContractConfig; use crate::data_contract::document_type::DocumentType; -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; + use crate::metadata::Metadata; /// `DataContractV0` represents a data contract in a decentralized platform. @@ -31,7 +31,7 @@ pub struct DataContractV0 { pub(crate) owner_id: Identifier, /// A mapping of document names to their corresponding document types. - pub(crate) document_types: BTreeMap, + pub document_types: BTreeMap, // TODO: Move metadata from here /// Optional metadata associated with the contract. @@ -44,66 +44,6 @@ pub struct DataContractV0 { pub(crate) schema_defs: Option>, } -// -// #[cfg(feature = "json-object")] -// impl TryFrom for DataContractV0 { -// type Error = ProtocolError; -// fn try_from(v: JsonValue) -> Result { -// DataContractV0::from_json_object(v) -// } -// } -// -// #[cfg(feature = "platform-value")] -// impl TryFrom for DataContractV0 { -// type Error = ProtocolError; -// fn try_from(value: Value) -> Result { -// DataContractV0::from_object(value) -// } -// } -// -// impl TryFrom for Value { -// type Error = ProtocolError; -// -// fn try_from(value: DataContractV0) -> Result { -// value.into_object() -// } -// } -// -// impl TryFrom<&DataContractV0> for Value { -// type Error = ProtocolError; -// -// fn try_from(value: &DataContractV0) -> Result { -// value.to_object() -// } -// } -// -// #[cfg(feature = "platform-value")] -// impl TryFrom<&str> for DataContractV0 { -// type Error = ProtocolError; -// fn try_from(v: &str) -> Result { -// let data_contract: DataContractV0 = serde_json::from_str(v)?; -// //todo: there's a better to do this, find it -// let value = data_contract.to_object()?; -// DataContractV0::from_object(value) -// } -// } -// -// impl<'a> TryFrom<&'a [u8]> for DataContractV0 { -// type Error = ProtocolError; -// -// fn try_from(_v: &[u8]) -> Result { -// todo!() -// } -// } -// -// impl TryFrom> for DataContractV0 { -// type Error = ProtocolError; -// -// fn try_from(_v: Vec) -> Result { -// todo!() -// } -// } - #[cfg(test)] mod test { diff --git a/packages/rs-dpp/src/data_contract/v0/methods/schema.rs b/packages/rs-dpp/src/data_contract/v0/methods/schema.rs index 724300da73b..d97cb54045c 100644 --- a/packages/rs-dpp/src/data_contract/v0/methods/schema.rs +++ b/packages/rs-dpp/src/data_contract/v0/methods/schema.rs @@ -4,6 +4,7 @@ use crate::data_contract::document_type::DocumentType; use crate::data_contract::schema::DataContractSchemaMethodsV0; use crate::data_contract::v0::DataContractV0; use crate::data_contract::{DefinitionName, DocumentName}; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; @@ -14,7 +15,8 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { &mut self, schemas: BTreeMap, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { self.document_types = DocumentType::create_document_types_from_document_schemas( @@ -23,7 +25,9 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { defs.as_ref(), self.config.documents_keep_history_contract_default(), self.config.documents_mutable_contract_default(), - validate, + self.config.documents_can_be_deleted_contract_default(), + full_validation, + validation_operations, platform_version, )?; @@ -34,7 +38,8 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { &mut self, name: &str, schema: Value, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { let document_type = DocumentType::try_from_schema( @@ -44,7 +49,9 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { self.schema_defs.as_ref(), self.config.documents_keep_history_contract_default(), self.config.documents_mutable_contract_default(), - validate, + self.config.documents_mutable_contract_default(), + full_validation, + validation_operations, platform_version, )?; @@ -68,7 +75,8 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { fn set_schema_defs( &mut self, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { let document_schemas = self @@ -77,7 +85,13 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { .map(|(name, document_type)| (name.to_owned(), document_type.schema().to_owned())) .collect(); - self.set_document_schemas(document_schemas, defs.clone(), validate, platform_version)?; + self.set_document_schemas( + document_schemas, + defs.clone(), + full_validation, + validation_operations, + platform_version, + )?; self.schema_defs = defs; @@ -100,18 +114,31 @@ mod test { let config = DataContractConfig::default_for_version(platform_version) .expect("should create a default config"); + let schema = platform_value!({ + "type": "object", + "properties": { + "a": { + "type": "string", + "maxLength": 10, + "position": 0 + } + }, + "additionalProperties": false, + }); + let serialization_format = DataContractInSerializationFormatV0 { id: Identifier::random(), config, version: 0, owner_id: Default::default(), schema_defs: None, - document_schemas: Default::default(), + document_schemas: BTreeMap::from([("document_type_name".to_string(), schema.clone())]), }; let mut data_contract = DataContractV0::try_from_platform_versioned( serialization_format.into(), true, + &mut vec![], platform_version, ) .expect("should create a contract from serialization format"); @@ -125,7 +152,7 @@ mod test { let defs_map = Some(defs.into_btree_string_map().expect("should convert to map")); data_contract - .set_schema_defs(defs_map.clone(), true, platform_version) + .set_schema_defs(defs_map.clone(), true, &mut vec![], platform_version) .expect("should set defs"); assert_eq!(defs_map.as_ref(), data_contract.schema_defs()) @@ -157,12 +184,13 @@ mod test { let mut data_contract = DataContractV0::try_from_platform_versioned( serialization_format.into(), true, + &mut vec![], platform_version, ) .expect("should create a contract from serialization format"); data_contract - .set_schema_defs(None, true, platform_version) + .set_schema_defs(None, true, &mut vec![], platform_version) .expect("should set defs"); assert_eq!(None, data_contract.schema_defs()) diff --git a/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs b/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs index da82005c7a0..65d78beaa1a 100644 --- a/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs +++ b/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs @@ -18,7 +18,7 @@ mod tests { let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); let contract = - get_data_contract_fixture(Some(identity.id()), platform_version.protocol_version) + get_data_contract_fixture(Some(identity.id()), 0, platform_version.protocol_version) .data_contract_owned(); let bytes = contract .serialize_to_bytes_with_platform_version(LATEST_PLATFORM_VERSION) diff --git a/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs b/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs index 0606d722212..104ede8844f 100644 --- a/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs +++ b/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs @@ -7,6 +7,7 @@ use crate::data_contract::DataContract; use crate::version::{PlatformVersion, PlatformVersionCurrentVersion}; use crate::ProtocolError; +use crate::validation::operations::ProtocolValidationOperation; use serde::{Deserialize, Deserializer, Serialize, Serializer}; pub mod bincode; @@ -31,15 +32,21 @@ impl<'de> Deserialize<'de> for DataContractV0 { let current_version = PlatformVersion::get_current().map_err(|e| serde::de::Error::custom(e.to_string()))?; // when deserializing from json/platform_value/cbor we always want to validate (as this is not coming from the state) - DataContractV0::try_from_platform_versioned_v0(serialization_format, true, current_version) - .map_err(serde::de::Error::custom) + DataContractV0::try_from_platform_versioned_v0( + serialization_format, + true, + &mut vec![], + current_version, + ) + .map_err(serde::de::Error::custom) } } impl DataContractV0 { pub(in crate::data_contract) fn try_from_platform_versioned( value: DataContractInSerializationFormat, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { match value { @@ -52,7 +59,8 @@ impl DataContractV0 { 0 => { let data_contract = DataContractV0::try_from_platform_versioned_v0( serialization_format_v0, - validate, + full_validation, + validation_operations, platform_version, )?; @@ -70,7 +78,8 @@ impl DataContractV0 { pub(in crate::data_contract) fn try_from_platform_versioned_v0( data_contract_data: DataContractInSerializationFormatV0, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { let DataContractInSerializationFormatV0 { @@ -88,7 +97,9 @@ impl DataContractV0 { schema_defs.as_ref(), config.documents_keep_history_contract_default(), config.documents_mutable_contract_default(), - validate, + config.documents_can_be_deleted_contract_default(), + full_validation, + validation_operations, platform_version, )?; diff --git a/packages/rs-dpp/src/document/accessors/mod.rs b/packages/rs-dpp/src/document/accessors/mod.rs index c2cd2492c04..2ba6d883103 100644 --- a/packages/rs-dpp/src/document/accessors/mod.rs +++ b/packages/rs-dpp/src/document/accessors/mod.rs @@ -4,7 +4,7 @@ pub use v0::*; use crate::document::Document; use crate::identity::TimestampMillis; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use platform_value::{Identifier, Value}; use std::collections::BTreeMap; @@ -68,6 +68,48 @@ impl DocumentV0Getters for Document { Document::V0(v0) => v0.updated_at, } } + + fn transferred_at(&self) -> Option { + match self { + Document::V0(v0) => v0.transferred_at, + } + } + + fn created_at_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.created_at_block_height, + } + } + + fn updated_at_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.updated_at_block_height, + } + } + + fn transferred_at_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.transferred_at_block_height, + } + } + + fn created_at_core_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.created_at_core_block_height, + } + } + + fn updated_at_core_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.updated_at_core_block_height, + } + } + + fn transferred_at_core_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.transferred_at_core_block_height, + } + } } impl DocumentV0Setters for Document { @@ -95,6 +137,12 @@ impl DocumentV0Setters for Document { } } + fn bump_revision(&mut self) { + match self { + Document::V0(v0) => v0.bump_revision(), + } + } + fn set_created_at(&mut self, created_at: Option) { match self { Document::V0(v0) => v0.created_at = created_at, @@ -106,4 +154,51 @@ impl DocumentV0Setters for Document { Document::V0(v0) => v0.updated_at = updated_at, } } + + fn set_transferred_at(&mut self, transferred_at: Option) { + match self { + Document::V0(v0) => v0.transferred_at = transferred_at, + } + } + + fn set_created_at_block_height(&mut self, created_at_block_height: Option) { + match self { + Document::V0(v0) => v0.created_at_block_height = created_at_block_height, + } + } + + fn set_updated_at_block_height(&mut self, updated_at_block_height: Option) { + match self { + Document::V0(v0) => v0.updated_at_block_height = updated_at_block_height, + } + } + + fn set_transferred_at_block_height(&mut self, transferred_at_block_height: Option) { + match self { + Document::V0(v0) => v0.transferred_at_block_height = transferred_at_block_height, + } + } + + fn set_created_at_core_block_height(&mut self, created_at_core_block_height: Option) { + match self { + Document::V0(v0) => v0.created_at_core_block_height = created_at_core_block_height, + } + } + + fn set_updated_at_core_block_height(&mut self, updated_at_core_block_height: Option) { + match self { + Document::V0(v0) => v0.updated_at_core_block_height = updated_at_core_block_height, + } + } + + fn set_transferred_at_core_block_height( + &mut self, + transferred_at_core_block_height: Option, + ) { + match self { + Document::V0(v0) => { + v0.transferred_at_core_block_height = transferred_at_core_block_height + } + } + } } diff --git a/packages/rs-dpp/src/document/accessors/v0/mod.rs b/packages/rs-dpp/src/document/accessors/v0/mod.rs index 0ae3b3acd36..671ac05c4a6 100644 --- a/packages/rs-dpp/src/document/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/document/accessors/v0/mod.rs @@ -30,6 +30,9 @@ pub trait DocumentV0Getters { /// Returns the time in milliseconds that the document was last updated. fn updated_at(&self) -> Option; + /// Returns the time in milliseconds that the document was last transferred. + fn transferred_at(&self) -> Option; + /// Retrieves the field specified by the path. /// Returns `None` if the path is empty or if the field is not present. fn get(&self, path: &str) -> Option<&Value> { @@ -38,6 +41,12 @@ pub trait DocumentV0Getters { fn id_ref(&self) -> &Identifier; fn owner_id_ref(&self) -> &Identifier; fn properties_consumed(self) -> BTreeMap; + fn created_at_block_height(&self) -> Option; + fn updated_at_block_height(&self) -> Option; + fn transferred_at_block_height(&self) -> Option; + fn created_at_core_block_height(&self) -> Option; + fn updated_at_core_block_height(&self) -> Option; + fn transferred_at_core_block_height(&self) -> Option; } pub trait DocumentV0Setters: DocumentV0Getters { @@ -70,6 +79,13 @@ pub trait DocumentV0Setters: DocumentV0Getters { } } + /// Removes the value under the given path. + /// The path supports syntax from the `lodash` JS library. Example: "root.people[0].name". + /// If parents are not present, they will be automatically created. + fn remove(&mut self, path: &str) -> Option { + self.properties_mut().remove(path) + } + /// Sets a `u8` value for the specified property name. fn set_u8(&mut self, property_name: &str, value: u8) { self.properties_mut() @@ -123,4 +139,15 @@ pub trait DocumentV0Setters: DocumentV0Getters { self.properties_mut() .insert(property_name.to_string(), Value::Bytes(value)); } + fn set_created_at_block_height(&mut self, created_at_block_height: Option); + fn set_updated_at_block_height(&mut self, updated_at_block_height: Option); + fn set_created_at_core_block_height(&mut self, created_at_core_block_height: Option); + fn set_updated_at_core_block_height(&mut self, updated_at_core_block_height: Option); + fn set_transferred_at_core_block_height( + &mut self, + transferred_at_core_block_height: Option, + ); + fn set_transferred_at_block_height(&mut self, transferred_at_block_height: Option); + fn set_transferred_at(&mut self, transferred_at: Option); + fn bump_revision(&mut self); } diff --git a/packages/rs-dpp/src/document/document_factory/mod.rs b/packages/rs-dpp/src/document/document_factory/mod.rs index 78cce0323e7..b026e805513 100644 --- a/packages/rs-dpp/src/document/document_factory/mod.rs +++ b/packages/rs-dpp/src/document/document_factory/mod.rs @@ -1,6 +1,7 @@ mod v0; use crate::data_contract::DataContract; +use std::collections::BTreeMap; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -11,8 +12,10 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +#[cfg(feature = "state-transitions")] +use crate::state_transition::documents_batch_transition::{ + document_transition::action_type::DocumentTransitionActionType, DocumentsBatchTransition, +}; use crate::util::entropy_generator::EntropyGenerator; pub use v0::DocumentFactoryV0; @@ -81,9 +84,12 @@ impl DocumentFactory { data: Value, ) -> Result { match self { - DocumentFactory::V0(v0) => { - v0.create_document(data_contract, owner_id, document_type_name, data) - } + DocumentFactory::V0(v0) => v0.create_document_without_time_based_properties( + data_contract, + owner_id, + document_type_name, + data, + ), } } @@ -111,12 +117,14 @@ impl DocumentFactory { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { match self { - DocumentFactory::V0(v0) => v0.create_state_transition(documents_iter), + DocumentFactory::V0(v0) => v0.create_state_transition(documents_iter, nonce_counter), } } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], diff --git a/packages/rs-dpp/src/document/document_factory/v0/mod.rs b/packages/rs-dpp/src/document/document_factory/v0/mod.rs index a017db8b2dd..58fc96de91a 100644 --- a/packages/rs-dpp/src/document/document_factory/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_factory/v0/mod.rs @@ -7,6 +7,7 @@ use crate::data_contract::DataContract; use crate::document::errors::DocumentError; use crate::document::{Document, DocumentV0Getters, DocumentV0Setters, INITIAL_REVISION}; use chrono::Utc; +use std::collections::BTreeMap; use crate::util::entropy_generator::{DefaultEntropyGenerator, EntropyGenerator}; use crate::version::PlatformVersion; @@ -17,17 +18,17 @@ use platform_value::{Bytes32, Identifier, Value}; use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::document::document_methods::DocumentMethodsV0; #[cfg(feature = "extended-document")] -use crate::document::extended_document::v0::ExtendedDocumentV0; -use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; -#[cfg(feature = "extended-document")] -use crate::document::ExtendedDocument; -use crate::prelude::TimestampMillis; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentCreateTransition, DocumentDeleteTransition, DocumentReplaceTransition, - DocumentTransition, +use crate::document::{ + extended_document::v0::ExtendedDocumentV0, + serialization_traits::DocumentPlatformConversionMethodsV0, ExtendedDocument, }; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; +#[cfg(feature = "state-transitions")] use crate::state_transition::documents_batch_transition::{ + document_transition::{ + action_type::DocumentTransitionActionType, DocumentCreateTransition, + DocumentDeleteTransition, DocumentReplaceTransition, DocumentTransition, + }, DocumentsBatchTransition, DocumentsBatchTransitionV0, }; use itertools::Itertools; @@ -87,6 +88,37 @@ impl DocumentFactoryV0 { } pub fn create_document( + &self, + data_contract: &DataContract, + owner_id: Identifier, + block_time: BlockHeight, + core_block_height: CoreBlockHeight, + document_type_name: String, + data: Value, + ) -> Result { + let platform_version = PlatformVersion::get(self.protocol_version)?; + if !data_contract.has_document_type_for_name(&document_type_name) { + return Err(DataContractError::InvalidDocumentTypeError( + InvalidDocumentTypeError::new(document_type_name, data_contract.id()), + ) + .into()); + } + + let document_entropy = self.entropy_generator.generate()?; + + let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; + + document_type.create_document_from_data( + data, + owner_id, + block_time, + core_block_height, + document_entropy, + platform_version, + ) + } + + pub fn create_document_without_time_based_properties( &self, data_contract: &DataContract, owner_id: Identifier, @@ -105,7 +137,14 @@ impl DocumentFactoryV0 { let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; - document_type.create_document_from_data(data, owner_id, document_entropy, platform_version) + document_type.create_document_from_data( + data, + owner_id, + 0, + 0, + document_entropy, + platform_version, + ) } #[cfg(feature = "extended-document")] @@ -128,9 +167,12 @@ impl DocumentFactoryV0 { let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; + // Extended documents are client side, so we don't need to fill in their timestamp properties let document = document_type.create_document_from_data( data, owner_id, + 0, + 0, document_entropy, platform_version, )?; @@ -167,6 +209,7 @@ impl DocumentFactoryV0 { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { let platform_version = PlatformVersion::get(self.protocol_version)?; let documents: Vec<( @@ -201,13 +244,14 @@ impl DocumentFactoryV0 { .into_iter() .map(|(action, documents)| match action { DocumentTransitionActionType::Create => { - Self::document_create_transitions(documents, platform_version) + Self::document_create_transitions(documents, nonce_counter, platform_version) } DocumentTransitionActionType::Delete => Self::document_delete_transitions( documents .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), DocumentTransitionActionType::Replace => Self::document_replace_transitions( @@ -215,8 +259,12 @@ impl DocumentFactoryV0 { .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), + _ => Err(ProtocolError::InvalidStateTransitionType( + "action type not accounted for".to_string(), + )), }) .collect::, ProtocolError>>()? .into_iter() @@ -230,12 +278,14 @@ impl DocumentFactoryV0 { Ok(DocumentsBatchTransitionV0 { owner_id, transitions, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } .into()) } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], @@ -328,8 +378,10 @@ impl DocumentFactoryV0 { // // Ok(data_contract) // // } // + #[cfg(feature = "state-transitions")] fn document_create_transitions( documents: Vec<(Document, DocumentTypeRef, Bytes32)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -350,21 +402,31 @@ impl DocumentFactoryV0 { .into()); } } - Ok(DocumentCreateTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentCreateTransition::from_document( document, document_type, entropy.to_buffer(), + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } + #[cfg(feature = "state-transitions")] fn document_replace_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -386,14 +448,22 @@ impl DocumentFactoryV0 { document.increment_revision()?; document.set_updated_at(Some(Utc::now().timestamp_millis() as TimestampMillis)); - Ok(DocumentReplaceTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentReplaceTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() // let mut raw_transitions = vec![]; @@ -437,15 +507,17 @@ impl DocumentFactoryV0 { // Ok(raw_transitions) } + #[cfg(feature = "state-transitions")] fn document_delete_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents .into_iter() .map(|(document, document_type)| { - if !document_type.documents_mutable() { - return Err(DocumentError::TryingToDeleteImmutableDocument { + if !document_type.documents_can_be_deleted() { + return Err(DocumentError::TryingToDeleteIndelibleDocument { document: Box::new(document), } .into()); @@ -456,14 +528,22 @@ impl DocumentFactoryV0 { } .into()); }; - Ok(DocumentDeleteTransition::from_document( + + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + let transition = DocumentDeleteTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } @@ -472,3 +552,70 @@ impl DocumentFactoryV0 { ids.into_iter().all_equal() } } + +#[cfg(test)] +mod test { + use data_contracts::SystemDataContract; + use platform_version::version::PlatformVersion; + use std::collections::BTreeMap; + + use crate::data_contract::accessors::v0::DataContractV0Getters; + use crate::document::document_factory::DocumentFactoryV0; + use crate::document::{Document, DocumentV0}; + use crate::identifier::Identifier; + use crate::system_data_contracts::load_system_data_contract; + + #[test] + /// Create a delete transition in DocumentFactoryV0 for an immutable but deletable document type + fn delete_immutable_but_deletable_documents() { + // Get a ref to the dpns preorder document type to pass to the factory + let dpns_contract = + load_system_data_contract(SystemDataContract::DPNS, PlatformVersion::latest()).unwrap(); + let document_type = dpns_contract + .document_type_borrowed_for_name("preorder") + .unwrap(); + let document_type_ref = document_type.as_ref(); + + // Create a preorder document + let document_id = Identifier::random(); + let owner_id = Identifier::random(); + let mut properties = BTreeMap::new(); + properties.insert( + "saltedDomainHash".to_string(), + platform_value::Value::Array(vec![]), + ); + let document_v0 = DocumentV0 { + id: document_id, + owner_id, + properties, + revision: Some(1), + created_at: None, + updated_at: None, + transferred_at: None, + created_at_block_height: None, + updated_at_block_height: None, + transferred_at_block_height: None, + created_at_core_block_height: None, + updated_at_core_block_height: None, + transferred_at_core_block_height: None, + }; + let document = Document::V0(document_v0); + + // This will be passed to the factory + let documents = vec![(document, document_type_ref)]; + let mut nonce_counter = BTreeMap::new(); + let platform_version = PlatformVersion::latest(); + + // Try to create the delete transition in the factory + let result = DocumentFactoryV0::document_delete_transitions( + documents, + &mut nonce_counter, + &platform_version, + ); + + // Checks + assert!(result.is_ok(), "The function should succeed"); + let transitions = result.unwrap(); + assert_eq!(transitions.len(), 1, "There should be one transition"); + } +} diff --git a/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs index 9a78e8128ba..8750f4034d6 100644 --- a/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs @@ -18,7 +18,7 @@ pub trait DocumentGetRawForContractV0: DocumentV0Getters + DocumentGetRawForDocu ) -> Result>, ProtocolError> { let document_type = contract.document_types().get(document_type_name).ok_or({ ProtocolError::DataContractError(DataContractError::DocumentTypeNotFound( - "document type should exist for name", + "document type should exist for name".to_string(), )) })?; self.get_raw_for_document_type_v0(key, document_type.as_ref(), owner_id, platform_version) diff --git a/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs index ca13d60c550..2bcaa11c271 100644 --- a/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs @@ -18,31 +18,66 @@ pub trait DocumentGetRawForDocumentTypeV0: DocumentV0Getters { // todo: maybe merge with document_type.serialize_value_for_key() because we use different // code paths for query and index creation // returns the owner id if the key path is $ownerId and an owner id is given - if key_path == "$ownerId" && owner_id.is_some() { - Ok(Some(Vec::from(owner_id.unwrap()))) - } else { - match key_path { - // returns self.id or self.owner_id if key path is $id or $ownerId - "$id" => return Ok(Some(self.id().to_vec())), - "$ownerId" => return Ok(Some(self.owner_id().to_vec())), - "$createdAt" => { - return Ok(self - .created_at() - .map(|time| DocumentPropertyType::encode_date_timestamp(time).unwrap())) - } - "$updatedAt" => { - return Ok(self - .updated_at() - .map(|time| DocumentPropertyType::encode_date_timestamp(time).unwrap())) - } - _ => {} - } - self.properties() - .get_optional_at_path(key_path)? - .map(|value| { - document_type.serialize_value_for_key(key_path, value, platform_version) - }) - .transpose() + if key_path == "$ownerId" { + if let Some(owner_id) = owner_id { + return Ok(Some(Vec::from(owner_id))); + } + } + + match key_path { + // returns self.id or self.owner_id if key path is $id or $ownerId + "$id" => return Ok(Some(self.id().to_vec())), + "$ownerId" => return Ok(Some(self.owner_id().to_vec())), + "$createdAt" => { + return Ok(self + .created_at() + .map(DocumentPropertyType::encode_date_timestamp)) + } + "$createdAtBlockHeight" => { + return Ok(self + .created_at_block_height() + .map(DocumentPropertyType::encode_u64)) + } + "$createdAtCoreBlockHeight" => { + return Ok(self + .created_at_core_block_height() + .map(DocumentPropertyType::encode_u32)) + } + "$updatedAt" => { + return Ok(self + .updated_at() + .map(DocumentPropertyType::encode_date_timestamp)) + } + "$updatedAtBlockHeight" => { + return Ok(self + .updated_at_block_height() + .map(DocumentPropertyType::encode_u64)) + } + "$updatedAtCoreBlockHeight" => { + return Ok(self + .updated_at_core_block_height() + .map(DocumentPropertyType::encode_u32)) + } + "$transferredAt" => { + return Ok(self + .transferred_at() + .map(DocumentPropertyType::encode_date_timestamp)) + } + "$transferredAtBlockHeight" => { + return Ok(self + .transferred_at_block_height() + .map(DocumentPropertyType::encode_u64)) + } + "$transferredAtCoreBlockHeight" => { + return Ok(self + .transferred_at_core_block_height() + .map(DocumentPropertyType::encode_u32)) + } + _ => {} } + self.properties() + .get_optional_at_path(key_path)? + .map(|value| document_type.serialize_value_for_key(key_path, value, platform_version)) + .transpose() } } diff --git a/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs index af2a92a3b0b..4961a39f42b 100644 --- a/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs @@ -3,7 +3,7 @@ use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::DataContract; use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; -use crate::util::hash::hash_to_vec; +use crate::util::hash::hash_double_to_vec; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -19,6 +19,6 @@ pub trait DocumentHashV0Method: DocumentPlatformConversionMethodsV0 { let mut buf = contract.id().to_vec(); buf.extend(document_type.name().as_bytes()); // TODO: Why we put it here? buf.extend(self.serialize(document_type, platform_version)?); - Ok(hash_to_vec(buf)) + Ok(hash_double_to_vec(buf)) } } diff --git a/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/mod.rs b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/mod.rs new file mode 100644 index 00000000000..85654bb28ad --- /dev/null +++ b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/mod.rs @@ -0,0 +1,2 @@ +mod v0; +pub(in crate::document) use v0::*; diff --git a/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/v0/mod.rs new file mode 100644 index 00000000000..0b9c65f7bb7 --- /dev/null +++ b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/v0/mod.rs @@ -0,0 +1,43 @@ +use crate::document::document_methods::DocumentGetRawForDocumentTypeV0; +use crate::document::DocumentV0Getters; +use platform_value::Value; +use std::collections::BTreeMap; + +pub trait DocumentIsEqualIgnoringTimestampsV0: + DocumentV0Getters + DocumentGetRawForDocumentTypeV0 +{ + /// Checks to see if a document is equal without time based fields. + /// Since these fields are set on the network this function can be useful to make sure that + /// fields that were supplied have not changed, while ignoring those that are set network side. + /// Time based fields that are ignored are + /// created_at/updated_at + /// created_at_block_height/updated_at_block_height + /// created_at_core_block_height/updated_at_core_block_height + fn is_equal_ignoring_time_based_fields_v0( + &self, + rhs: &Self, + also_ignore_fields: Option>, + ) -> bool { + fn filtered_properties<'a>( + properties: &'a BTreeMap, + ignore_fields: &Vec<&str>, + ) -> BTreeMap<&'a String, &'a Value> { + properties + .iter() + .filter(|(key, _)| !ignore_fields.contains(&key.as_str())) + .collect() + } + + let properties_equal = if let Some(fields) = &also_ignore_fields { + filtered_properties(self.properties(), fields) + == filtered_properties(rhs.properties(), fields) + } else { + self.properties() == rhs.properties() + }; + + self.id() == rhs.id() + && self.owner_id() == rhs.owner_id() + && properties_equal + && self.revision() == rhs.revision() + } +} diff --git a/packages/rs-dpp/src/document/document_methods/mod.rs b/packages/rs-dpp/src/document/document_methods/mod.rs index 18edf4b8d7a..6b3f779dde3 100644 --- a/packages/rs-dpp/src/document/document_methods/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/mod.rs @@ -6,10 +6,12 @@ use crate::ProtocolError; mod get_raw_for_contract; mod get_raw_for_document_type; mod hash; +mod is_equal_ignoring_timestamps; pub(in crate::document) use get_raw_for_contract::*; pub(in crate::document) use get_raw_for_document_type::*; pub(in crate::document) use hash::*; +pub(in crate::document) use is_equal_ignoring_timestamps::*; pub trait DocumentMethodsV0 { /// Return a value given the path to its key and the document type for a contract. @@ -39,4 +41,18 @@ pub trait DocumentMethodsV0 { ) -> Result, ProtocolError>; fn increment_revision(&mut self) -> Result<(), ProtocolError>; + + /// Checks to see if a document is equal without time based fields. + /// Since these fields are set on the network this function can be useful to make sure that + /// fields that were supplied have not changed, while ignoring those that are set network side. + /// Time based fields that are ignored are + /// created_at/updated_at + /// created_at_block_height/updated_at_block_height + /// created_at_core_block_height/updated_at_core_block_height + fn is_equal_ignoring_time_based_fields( + &self, + rhs: &Self, + also_ignore_fields: Option>, + platform_version: &PlatformVersion, + ) -> Result; } diff --git a/packages/rs-dpp/src/document/errors.rs b/packages/rs-dpp/src/document/errors.rs index 4e6e182cbf7..d16ca16f1ea 100644 --- a/packages/rs-dpp/src/document/errors.rs +++ b/packages/rs-dpp/src/document/errors.rs @@ -44,8 +44,8 @@ pub enum DocumentError { #[error("Trying To Replace Immutable Document")] TryingToReplaceImmutableDocument { document: Box }, - #[error("Trying To Delete Immutable Document")] - TryingToDeleteImmutableDocument { document: Box }, + #[error("Trying to delete indelible document")] + TryingToDeleteIndelibleDocument { document: Box }, #[error("Documents have mixed owner ids")] MismatchOwnerIdsError { documents: Vec }, diff --git a/packages/rs-dpp/src/document/extended_document/accessors.rs b/packages/rs-dpp/src/document/extended_document/accessors.rs index c051c7d79d4..a471124d21f 100644 --- a/packages/rs-dpp/src/document/extended_document/accessors.rs +++ b/packages/rs-dpp/src/document/extended_document/accessors.rs @@ -3,7 +3,7 @@ use crate::data_contract::DataContract; use crate::document::{Document, ExtendedDocument}; use crate::identity::TimestampMillis; use crate::metadata::Metadata; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::ProtocolError; use platform_value::{Bytes32, Identifier, Value}; use std::collections::BTreeMap; @@ -56,6 +56,7 @@ impl ExtendedDocument { } /// Returns an optional reference to the document's creation timestamp in milliseconds. + /// It will be None if it is not required by the schema. pub fn created_at(&self) -> Option { match self { ExtendedDocument::V0(v0) => v0.created_at(), @@ -63,12 +64,45 @@ impl ExtendedDocument { } /// Returns an optional reference to the document's last update timestamp in milliseconds. + /// It will be None if it is not required by the schema. pub fn updated_at(&self) -> Option { match self { ExtendedDocument::V0(v0) => v0.updated_at(), } } + /// Returns an optional block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.created_at_block_height(), + } + } + + /// Returns an optional block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.updated_at_block_height(), + } + } + + /// Returns an optional core block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_core_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.created_at_core_block_height(), + } + } + + /// Returns an optional core block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_core_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.updated_at_core_block_height(), + } + } + /// Returns the document type name as a reference to a string. pub fn document_type_name(&self) -> &String { match self { diff --git a/packages/rs-dpp/src/document/extended_document/fields.rs b/packages/rs-dpp/src/document/extended_document/fields.rs index 0466c759b01..09400b60edd 100644 --- a/packages/rs-dpp/src/document/extended_document/fields.rs +++ b/packages/rs-dpp/src/document/extended_document/fields.rs @@ -8,6 +8,13 @@ pub mod property_names { pub const OWNER_ID: &str = "$ownerId"; pub const CREATED_AT: &str = "$createdAt"; pub const UPDATED_AT: &str = "$updatedAt"; + pub const TRANSFERRED_AT: &str = "$transferredAt"; + pub const CREATED_AT_BLOCK_HEIGHT: &str = "$createdAtBlockHeight"; + pub const UPDATED_AT_BLOCK_HEIGHT: &str = "$updatedAtBlockHeight"; + pub const TRANSFERRED_AT_BLOCK_HEIGHT: &str = "$transferredAtBlockHeight"; + pub const CREATED_AT_CORE_BLOCK_HEIGHT: &str = "$createdAtCoreBlockHeight"; + pub const UPDATED_AT_CORE_BLOCK_HEIGHT: &str = "$updatedAtCoreBlockHeight"; + pub const TRANSFERRED_AT_CORE_BLOCK_HEIGHT: &str = "$transferredAtCoreBlockHeight"; } pub const IDENTIFIER_FIELDS: [&str; 3] = [ diff --git a/packages/rs-dpp/src/document/extended_document/mod.rs b/packages/rs-dpp/src/document/extended_document/mod.rs index fe16af61183..2901850d30b 100644 --- a/packages/rs-dpp/src/document/extended_document/mod.rs +++ b/packages/rs-dpp/src/document/extended_document/mod.rs @@ -7,6 +7,10 @@ pub(crate) mod v0; pub use fields::{property_names, IDENTIFIER_FIELDS}; +#[cfg(any( + feature = "document-json-conversion", + feature = "document-value-conversion" +))] use crate::data_contract::DataContract; use crate::ProtocolError; @@ -14,11 +18,14 @@ use crate::document::extended_document::v0::ExtendedDocumentV0; #[cfg(feature = "document-json-conversion")] use crate::document::serialization_traits::DocumentJsonMethodsV0; +#[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; use platform_value::Value; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "document-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "document-value-conversion")] use std::collections::BTreeMap; #[derive(Debug, Clone, PlatformVersioned)] @@ -68,7 +75,7 @@ impl ExtendedDocument { /// Returns a `ProtocolError` if the document type is not found in the data contract. pub fn needs_revision(&self) -> Result { match self { - ExtendedDocument::V0(v0) => v0.needs_revision(), + ExtendedDocument::V0(v0) => v0.requires_revision(), } } @@ -331,6 +338,8 @@ mod test { use crate::data_contract::document_type::random_document::CreateRandomDocument; use crate::document::serialization_traits::ExtendedDocumentPlatformConversionMethodsV0; use crate::tests::fixtures::get_dashpay_contract_fixture; + use base64::prelude::BASE64_STANDARD; + use base64::Engine; fn init() { let _ = env_logger::builder() @@ -410,8 +419,7 @@ mod test { fn test_document_json_deserialize() -> Result<()> { init(); let platform_version = PlatformVersion::latest(); - let dpns_contract = - load_system_data_contract(SystemDataContract::DPNS, platform_version.protocol_version)?; + let dpns_contract = load_system_data_contract(SystemDataContract::DPNS, platform_version)?; let document_json = get_data_from_file("src/tests/payloads/document_dpns.json")?; let doc = ExtendedDocument::from_json_string(&document_json, dpns_contract, platform_version)?; @@ -444,12 +452,12 @@ mod test { println!( "{:?}", doc.properties() - .get_at_path("records.dashUniqueIdentityId") + .get_at_path("records.identity") .expect("expected to get value") ); assert_eq!( doc.properties() - .get_at_path("records.dashUniqueIdentityId") + .get_at_path("records.identity") .expect("expected to get value"), &Value::Identifier( bs58::decode("HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn") @@ -481,6 +489,22 @@ mod test { assert_eq!(init_doc.created_at(), doc.created_at()); assert_eq!(init_doc.updated_at(), doc.updated_at()); + assert_eq!( + init_doc.created_at_block_height(), + doc.created_at_block_height() + ); + assert_eq!( + init_doc.updated_at_block_height(), + doc.updated_at_block_height() + ); + assert_eq!( + init_doc.created_at_core_block_height(), + doc.created_at_core_block_height() + ); + assert_eq!( + init_doc.updated_at_core_block_height(), + doc.updated_at_core_block_height() + ); assert_eq!(init_doc.id(), doc.id()); assert_eq!(init_doc.data_contract_id(), doc.data_contract_id()); assert_eq!(init_doc.owner_id(), doc.owner_id()); @@ -489,11 +513,8 @@ mod test { #[test] fn test_to_object() { init(); - let dpns_contract = load_system_data_contract( - SystemDataContract::DPNS, - LATEST_PLATFORM_VERSION.protocol_version, - ) - .unwrap(); + let dpns_contract = + load_system_data_contract(SystemDataContract::DPNS, LATEST_PLATFORM_VERSION).unwrap(); let document_json = get_data_from_file("src/tests/payloads/document_dpns.json").unwrap(); let document = ExtendedDocument::from_json_string( &document_json, @@ -517,10 +538,8 @@ mod test { fn test_json_serialize() -> Result<()> { init(); - let dpns_contract = load_system_data_contract( - SystemDataContract::DPNS, - LATEST_PLATFORM_VERSION.protocol_version, - )?; + let dpns_contract = + load_system_data_contract(SystemDataContract::DPNS, LATEST_PLATFORM_VERSION)?; let document_json = get_data_from_file("src/tests/payloads/document_dpns.json")?; let document = ExtendedDocument::from_json_string( &document_json, @@ -530,7 +549,7 @@ mod test { let string = serde_json::to_string(&document)?; assert_eq!( - "{\"version\":0,\"$type\":\"domain\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"document\":{\"$version\":\"0\",\"$id\":\"4veLBZPHDkaCPF9LfZ8fX3JZiS5q5iUVGhdBbaa9ga5E\",\"$ownerId\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"$protocolVersion\":0,\"$type\":\"domain\",\"label\":\"user-9999\",\"normalizedLabel\":\"user-9999\",\"normalizedParentDomainName\":\"dash\",\"preorderSalt\":\"BzQi567XVqc8wYiVHS887sJtL6MDbxLHNnp+UpTFSB0=\",\"records\":{\"dashUniqueIdentityId\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\"},\"subdomainRules\":{\"allowSubdomains\":false},\"$revision\":1,\"$createdAt\":null,\"$updatedAt\":null}}", + "{\"version\":0,\"$type\":\"domain\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"document\":{\"$version\":\"0\",\"$id\":\"4veLBZPHDkaCPF9LfZ8fX3JZiS5q5iUVGhdBbaa9ga5E\",\"$ownerId\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"$protocolVersion\":0,\"$type\":\"domain\",\"label\":\"user-9999\",\"normalizedLabel\":\"user-9999\",\"normalizedParentDomainName\":\"dash\",\"preorderSalt\":\"BzQi567XVqc8wYiVHS887sJtL6MDbxLHNnp+UpTFSB0=\",\"records\":{\"identity\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\"},\"subdomainRules\":{\"allowSubdomains\":false},\"$revision\":1,\"$createdAt\":null,\"$updatedAt\":null,\"$transferredAt\":null,\"$createdAtBlockHeight\":null,\"$updatedAtBlockHeight\":null,\"$transferredAtBlockHeight\":null,\"$createdAtCoreBlockHeight\":null,\"$updatedAtCoreBlockHeight\":null,\"$transferredAtCoreBlockHeight\":null}}", string ); @@ -542,11 +561,8 @@ mod test { init(); let document_json = get_data_from_file("src/tests/payloads/document_dpns.json")?; - let dpns_contract = load_system_data_contract( - SystemDataContract::DPNS, - LATEST_PLATFORM_VERSION.protocol_version, - ) - .unwrap(); + let dpns_contract = + load_system_data_contract(SystemDataContract::DPNS, LATEST_PLATFORM_VERSION).unwrap(); ExtendedDocument::from_json_string(&document_json, dpns_contract, LATEST_PLATFORM_VERSION) .expect("expected extended document"); Ok(()) @@ -581,8 +597,6 @@ mod test { .to_pretty_json(LATEST_PLATFORM_VERSION) .expect("no errors"); - println!("{:?}", json_document); - assert_eq!( json_document["$id"], JsonValue::String(bs58::encode(&id).into_string()) @@ -597,11 +611,11 @@ mod test { ); assert_eq!( json_document["alphaBinary"], - JsonValue::String(base64::encode(&alpha_value)) + JsonValue::String(BASE64_STANDARD.encode(&alpha_value)) ); assert_eq!( json_document["alphaIdentifier"], - JsonValue::String(base64::encode(&alpha_value)) + JsonValue::String(BASE64_STANDARD.encode(&alpha_value)) ); } @@ -613,7 +627,7 @@ mod test { fn new_example_document() -> ExtendedDocument { let data_contract = - get_dashpay_contract_fixture(None, LATEST_PLATFORM_VERSION.protocol_version) + get_dashpay_contract_fixture(None, 0, LATEST_PLATFORM_VERSION.protocol_version) .data_contract_owned(); let document_type = data_contract .document_type_for_name("profile") diff --git a/packages/rs-dpp/src/document/extended_document/serialize.rs b/packages/rs-dpp/src/document/extended_document/serialize.rs index 993c0ba2c0b..fed22526ab3 100644 --- a/packages/rs-dpp/src/document/extended_document/serialize.rs +++ b/packages/rs-dpp/src/document/extended_document/serialize.rs @@ -4,6 +4,9 @@ use crate::document::serialization_traits::ExtendedDocumentPlatformConversionMet use crate::prelude::ExtendedDocument; use crate::version::PlatformVersion; use crate::ProtocolError; +use bincode::enc::Encoder; +use bincode::error::EncodeError; +use platform_serialization::{PlatformVersionEncode, PlatformVersionedDecode}; use platform_version::version::FeatureVersion; impl ExtendedDocumentPlatformConversionMethodsV0 for ExtendedDocument { @@ -66,3 +69,32 @@ impl ExtendedDocumentPlatformConversionMethodsV0 for ExtendedDocument { } } } + +impl PlatformVersionEncode for ExtendedDocument { + fn platform_encode( + &self, + encoder: &mut E, + platform_version: &PlatformVersion, + ) -> Result<(), EncodeError> { + let serialized = self.serialize_to_bytes(platform_version).map_err(|e| { + EncodeError::OtherString(format!("Failed to serialize ExtendedDocument: {}", e)) + })?; + + serialized.platform_encode(encoder, platform_version) + } +} + +impl PlatformVersionedDecode for ExtendedDocument { + fn platform_versioned_decode( + decoder: &mut D, + platform_version: &PlatformVersion, + ) -> Result { + let bytes = Vec::::platform_versioned_decode(decoder, platform_version)?; + + Self::from_bytes(&bytes, platform_version) + .map_err(|e| { + EncodeError::OtherString(format!("Failed to serialize ExtendedDocument: {}", e)) + }) + .map_err(|e| bincode::error::DecodeError::OtherString(e.to_string())) + } +} diff --git a/packages/rs-dpp/src/document/extended_document/v0/mod.rs b/packages/rs-dpp/src/document/extended_document/v0/mod.rs index 65f14f84249..b1ca400b982 100644 --- a/packages/rs-dpp/src/document/extended_document/v0/mod.rs +++ b/packages/rs-dpp/src/document/extended_document/v0/mod.rs @@ -6,18 +6,25 @@ mod serialize; use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::DataContract; +#[cfg(any( + feature = "document-value-conversion", + feature = "document-json-conversion" +))] use crate::document::extended_document::fields::property_names; use crate::document::{Document, DocumentV0Getters, ExtendedDocument}; use crate::identity::TimestampMillis; use crate::metadata::Metadata; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; -use crate::util::hash::hash_to_vec; +use crate::util::hash::hash_double_to_vec; use crate::ProtocolError; use platform_value::btreemap_extensions::{ - BTreeValueMapInsertionPathHelper, BTreeValueMapPathHelper, BTreeValueMapReplacementPathHelper, - BTreeValueRemoveFromMapHelper, + BTreeValueMapInsertionPathHelper, BTreeValueMapPathHelper, +}; +#[cfg(feature = "document-value-conversion")] +use platform_value::btreemap_extensions::{ + BTreeValueMapReplacementPathHelper, BTreeValueRemoveFromMapHelper, }; use platform_value::{Bytes32, Identifier, ReplacementType, Value}; use serde::{Deserialize, Serialize}; @@ -25,8 +32,9 @@ use std::collections::BTreeMap; use crate::data_contract::accessors::v0::DataContractV0Getters; use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; #[cfg(feature = "validation")] -use crate::data_contract::validation::DataContractValidationMethodsV0; +use crate::data_contract::validate_document::DataContractDocumentValidationMethodsV0; #[cfg(feature = "document-json-conversion")] use crate::document::serialization_traits::DocumentJsonMethodsV0; #[cfg(feature = "document-value-conversion")] @@ -34,6 +42,7 @@ use crate::document::serialization_traits::DocumentPlatformValueMethodsV0; use crate::document::serialization_traits::ExtendedDocumentPlatformConversionMethodsV0; #[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; +#[cfg(feature = "document-json-conversion")] use platform_value::converter::serde_json::BTreeValueJsonConverter; use platform_version::version::PlatformVersion; #[cfg(feature = "document-json-conversion")] @@ -145,6 +154,7 @@ impl ExtendedDocumentV0 { // We can unwrap because the Document can not be created without a valid Document Type self.data_contract .document_type_for_name(self.document_type_name.as_str()) + .map_err(ProtocolError::DataContractError) } pub fn can_be_modified(&self) -> Result { @@ -152,23 +162,51 @@ impl ExtendedDocumentV0 { .map(|document_type| document_type.documents_mutable()) } - pub fn needs_revision(&self) -> Result { + pub fn requires_revision(&self) -> Result { self.document_type() - .map(|document_type| document_type.documents_mutable()) + .map(|document_type| document_type.requires_revision()) } pub fn revision(&self) -> Option { self.document.revision() } + /// Returns an optional block timestamp at which the document was created. + /// It will be None if it is not required by the schema. pub fn created_at(&self) -> Option { self.document.created_at() } + /// Returns an optional block timestamp at which the document was updated. + /// It will be None if it is not required by the schema. pub fn updated_at(&self) -> Option { self.document.updated_at() } + /// Returns an optional block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_block_height(&self) -> Option { + self.document.created_at_block_height() + } + + /// Returns an optional block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_block_height(&self) -> Option { + self.document.updated_at_block_height() + } + + /// Returns an optional core block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_core_block_height(&self) -> Option { + self.document.created_at_core_block_height() + } + + /// Returns an optional core block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_core_block_height(&self) -> Option { + self.document.updated_at_core_block_height() + } + /// Create an extended document with additional information. /// /// # Arguments @@ -415,7 +453,7 @@ impl ExtendedDocumentV0 { } pub fn hash(&self, platform_version: &PlatformVersion) -> Result, ProtocolError> { - Ok(hash_to_vec( + Ok(hash_double_to_vec( ExtendedDocumentPlatformConversionMethodsV0::serialize_to_bytes( self, platform_version, diff --git a/packages/rs-dpp/src/document/extended_document/v0/serialize.rs b/packages/rs-dpp/src/document/extended_document/v0/serialize.rs index 64c5f0a35d1..255d49bd960 100644 --- a/packages/rs-dpp/src/document/extended_document/v0/serialize.rs +++ b/packages/rs-dpp/src/document/extended_document/v0/serialize.rs @@ -21,6 +21,8 @@ use crate::version::PlatformVersion; use integer_encoding::{VarInt, VarIntReader}; +use crate::consensus::basic::decode::DecodingError; +use crate::data_contract::errors::DataContractError; use platform_version::version::FeatureVersion; impl ExtendedDocumentPlatformSerializationMethodsV0 for ExtendedDocumentV0 { @@ -95,9 +97,11 @@ impl ExtendedDocumentPlatformDeserializationMethodsV0 for ExtendedDocumentV0 { let (document_type_name_len, rest) = serialized_document .split_first() - .ok_or(ProtocolError::DecodingError( - "error reading document type name len from serialized extended document" - .to_string(), + .ok_or(DataContractError::DecodingDocumentError( + DecodingError::new( + "error reading document type name len from serialized extended document" + .to_string(), + ), ))?; if serialized_document.len() < *document_type_name_len as usize { return Err(ProtocolError::DecodingError( diff --git a/packages/rs-dpp/src/document/fields.rs b/packages/rs-dpp/src/document/fields.rs index efd49d69a52..452b7f7c3ef 100644 --- a/packages/rs-dpp/src/document/fields.rs +++ b/packages/rs-dpp/src/document/fields.rs @@ -5,8 +5,16 @@ pub mod property_names { pub const DATA_CONTRACT_ID: &str = "$dataContractId"; pub const REVISION: &str = "$revision"; pub const OWNER_ID: &str = "$ownerId"; + pub const PRICE: &str = "$price"; pub const CREATED_AT: &str = "$createdAt"; pub const UPDATED_AT: &str = "$updatedAt"; + pub const TRANSFERRED_AT: &str = "$transferredAt"; + pub const CREATED_AT_BLOCK_HEIGHT: &str = "$createdAtBlockHeight"; + pub const UPDATED_AT_BLOCK_HEIGHT: &str = "$updatedAtBlockHeight"; + pub const TRANSFERRED_AT_BLOCK_HEIGHT: &str = "$transferredAtBlockHeight"; + pub const CREATED_AT_CORE_BLOCK_HEIGHT: &str = "$createdAtCoreBlockHeight"; + pub const UPDATED_AT_CORE_BLOCK_HEIGHT: &str = "$updatedAtCoreBlockHeight"; + pub const TRANSFERRED_AT_CORE_BLOCK_HEIGHT: &str = "$transferredAtCoreBlockHeight"; } pub const IDENTIFIER_FIELDS: [&str; 3] = [ diff --git a/packages/rs-dpp/src/document/generate_document_id.rs b/packages/rs-dpp/src/document/generate_document_id.rs index a1a7009d859..b14fc599a44 100644 --- a/packages/rs-dpp/src/document/generate_document_id.rs +++ b/packages/rs-dpp/src/document/generate_document_id.rs @@ -1,5 +1,5 @@ use crate::document::Document; -use crate::{prelude::Identifier, util::hash::hash_to_vec}; +use crate::{prelude::Identifier, util::hash::hash_double_to_vec}; impl Document { /// Generates the document ID @@ -16,6 +16,6 @@ impl Document { buf.extend_from_slice(document_type_name.as_bytes()); buf.extend_from_slice(entropy); - Identifier::from_bytes(&hash_to_vec(&buf)).unwrap() + Identifier::from_bytes(&hash_double_to_vec(&buf)).unwrap() } } diff --git a/packages/rs-dpp/src/document/mod.rs b/packages/rs-dpp/src/document/mod.rs index 5eda83da448..29d2ec24a32 100644 --- a/packages/rs-dpp/src/document/mod.rs +++ b/packages/rs-dpp/src/document/mod.rs @@ -15,6 +15,7 @@ pub mod generate_document_id; pub mod serialization_traits; #[cfg(feature = "factories")] pub mod specialized_document_factory; +pub mod transfer; mod v0; pub use accessors::*; @@ -34,7 +35,7 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::DataContract; use crate::document::document_methods::{ DocumentGetRawForContractV0, DocumentGetRawForDocumentTypeV0, DocumentHashV0Method, - DocumentMethodsV0, + DocumentIsEqualIgnoringTimestampsV0, DocumentMethodsV0, }; use crate::document::errors::DocumentError; use crate::version::PlatformVersion; @@ -178,6 +179,32 @@ impl DocumentMethodsV0 for Document { Ok(()) } + + fn is_equal_ignoring_time_based_fields( + &self, + rhs: &Self, + also_ignore_fields: Option>, + platform_version: &PlatformVersion, + ) -> Result { + match (self, rhs) { + (Document::V0(document_v0), Document::V0(rhs_v0)) => { + match platform_version + .dpp + .document_versions + .document_method_versions + .is_equal_ignoring_timestamps + { + 0 => Ok(document_v0 + .is_equal_ignoring_time_based_fields_v0(rhs_v0, also_ignore_fields)), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentMethodV0::is_equal_ignoring_time_based_fields".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + } + } } #[cfg(test)] @@ -187,7 +214,7 @@ mod tests { use crate::data_contract::document_type::random_document::CreateRandomDocument; use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; use crate::tests::json_document::json_document_to_contract; - use platform_value::{Bytes32, Identifier}; + use regex::Regex; #[test] @@ -208,7 +235,7 @@ mod tests { .expect("expected to get a random document"); let document_string = format!("{}", document); - let pattern = r#"v\d+ : id:45ZNwGcxeMpLpYmiVEKKBKXbZfinrhjZLkau1GWizPFX owner_id:2vq574DjKi7ZD8kJ6dMHxT5wu6ZKD2bW5xKAyKAGW7qZ created_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) updated_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) avatarUrl:string y8RD1DbW18RuyblDX7hx\[...\(670\)\] displayName:string y94Itl6mn1yBE publicMessage:string SvAQrzsslj0ESc15GQBQ\[...\(105\)\] .*"#; + let pattern = r"v\d+ : id:45ZNwGcxeMpLpYmiVEKKBKXbZfinrhjZLkau1GWizPFX owner_id:2vq574DjKi7ZD8kJ6dMHxT5wu6ZKD2bW5xKAyKAGW7qZ created_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) updated_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) avatarUrl:string y8RD1DbW18RuyblDX7hx\[...\(670\)\] displayName:string y94Itl6mn1yBE publicMessage:string SvAQrzsslj0ESc15GQBQ\[...\(105\)\] .*"; let re = Regex::new(pattern).unwrap(); assert!( re.is_match(document_string.as_str()), diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs index b832c1977cb..ac52261c8e8 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs @@ -1,4 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; +use crate::data_contract::errors::DataContractError; +#[cfg(feature = "extended-document")] use crate::ProtocolError; use platform_version::version::PlatformVersion; @@ -8,7 +10,7 @@ pub(in crate::document) trait DocumentPlatformDeserializationMethodsV0 { serialized_document: &[u8], document_type: DocumentTypeRef, platform_version: &PlatformVersion, - ) -> Result + ) -> Result where Self: Sized; } diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs index 2fff26077c5..e3a112c47e9 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs @@ -4,6 +4,8 @@ mod v0; use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0}; +#[cfg(feature = "validation")] +use crate::prelude::ConsensusValidationResult; use crate::ProtocolError; use platform_version::version::{FeatureVersion, PlatformVersion}; pub use v0::*; @@ -73,6 +75,34 @@ impl DocumentPlatformConversionMethodsV0 for Document { }), } } + + #[cfg(feature = "validation")] + fn from_bytes_in_consensus( + serialized_document: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> + where + Self: Sized, + { + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0::from_bytes_in_consensus( + serialized_document, + document_type, + platform_version, + )? + .map(|document_v0| document_v0.into())), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::from_bytes_in_consensus".to_string(), + known_versions: vec![0], + received: version, + }), + } + } } #[cfg(test)] diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs index a3138412374..3e62bf50e11 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::ProtocolError; +#[cfg(feature = "extended-document")] use platform_version::version::PlatformVersion; pub(in crate::document) trait DocumentPlatformSerializationMethodsV0 { diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs index fcc676d680e..ce942172bc1 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs @@ -1,9 +1,11 @@ use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "validation")] +use crate::validation::ConsensusValidationResult; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_version::version::FeatureVersion; -pub trait DocumentPlatformConversionMethodsV0 { +pub trait DocumentPlatformConversionMethodsV0: Clone { /// Serializes the document. /// /// The serialization of a document follows the pattern: @@ -42,6 +44,18 @@ pub trait DocumentPlatformConversionMethodsV0 { ) -> Result where Self: Sized; + + #[cfg(feature = "validation")] + /// Reads a serialized document and creates a Document from it. + /// This will return a ConsensusValidationResult instead when the error is happening + /// in consensus (deserialization of a message from the network) + fn from_bytes_in_consensus( + serialized_document: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> + where + Self: Sized; } pub trait ExtendedDocumentPlatformConversionMethodsV0 { diff --git a/packages/rs-dpp/src/document/specialized_document_factory/mod.rs b/packages/rs-dpp/src/document/specialized_document_factory/mod.rs index f4f25835010..2e8cd371cda 100644 --- a/packages/rs-dpp/src/document/specialized_document_factory/mod.rs +++ b/packages/rs-dpp/src/document/specialized_document_factory/mod.rs @@ -1,6 +1,7 @@ mod v0; use crate::data_contract::DataContract; +use std::collections::BTreeMap; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -11,8 +12,10 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +#[cfg(feature = "state-transitions")] +use crate::state_transition::documents_batch_transition::{ + document_transition::action_type::DocumentTransitionActionType, DocumentsBatchTransition, +}; use crate::util::entropy_generator::EntropyGenerator; pub use v0::SpecializedDocumentFactoryV0; @@ -89,7 +92,7 @@ impl SpecializedDocumentFactory { ) -> Result { match self { SpecializedDocumentFactory::V0(v0) => { - v0.create_document(owner_id, document_type_name, data) + v0.create_document_without_time_based_properties(owner_id, document_type_name, data) } } } @@ -117,12 +120,16 @@ impl SpecializedDocumentFactory { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { match self { - SpecializedDocumentFactory::V0(v0) => v0.create_state_transition(documents_iter), + SpecializedDocumentFactory::V0(v0) => { + v0.create_state_transition(documents_iter, nonce_counter) + } } } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], diff --git a/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs b/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs index b469dc4fc04..e482d3822a7 100644 --- a/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs +++ b/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs @@ -7,6 +7,7 @@ use crate::data_contract::DataContract; use crate::document::errors::DocumentError; use crate::document::{Document, DocumentV0Getters, DocumentV0Setters, INITIAL_REVISION}; use chrono::Utc; +use std::collections::BTreeMap; use crate::util::entropy_generator::{DefaultEntropyGenerator, EntropyGenerator}; use crate::version::PlatformVersion; @@ -16,17 +17,17 @@ use platform_value::{Bytes32, Identifier, Value}; use crate::data_contract::document_type::methods::DocumentTypeV0Methods; #[cfg(feature = "extended-document")] -use crate::document::extended_document::v0::ExtendedDocumentV0; -use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; -#[cfg(feature = "extended-document")] -use crate::document::ExtendedDocument; -use crate::prelude::TimestampMillis; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentCreateTransition, DocumentDeleteTransition, DocumentReplaceTransition, - DocumentTransition, +use crate::document::{ + extended_document::v0::ExtendedDocumentV0, + serialization_traits::DocumentPlatformConversionMethodsV0, ExtendedDocument, }; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; +#[cfg(feature = "state-transitions")] use crate::state_transition::documents_batch_transition::{ + document_transition::{ + action_type::DocumentTransitionActionType, DocumentCreateTransition, + DocumentDeleteTransition, DocumentReplaceTransition, DocumentTransition, + }, DocumentsBatchTransition, DocumentsBatchTransitionV0, }; use itertools::Itertools; @@ -88,7 +89,38 @@ impl SpecializedDocumentFactoryV0 { entropy_generator, } } + pub fn create_document( + &self, + data_contract: &DataContract, + owner_id: Identifier, + block_time: BlockHeight, + core_block_height: CoreBlockHeight, + document_type_name: String, + data: Value, + ) -> Result { + let platform_version = PlatformVersion::get(self.protocol_version)?; + if !data_contract.has_document_type_for_name(&document_type_name) { + return Err(DataContractError::InvalidDocumentTypeError( + InvalidDocumentTypeError::new(document_type_name, data_contract.id()), + ) + .into()); + } + + let document_entropy = self.entropy_generator.generate()?; + + let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; + + document_type.create_document_from_data( + data, + owner_id, + block_time, + core_block_height, + document_entropy, + platform_version, + ) + } + pub fn create_document_without_time_based_properties( &self, owner_id: Identifier, document_type_name: String, @@ -111,7 +143,14 @@ impl SpecializedDocumentFactoryV0 { .data_contract .document_type_for_name(document_type_name.as_str())?; - document_type.create_document_from_data(data, owner_id, document_entropy, platform_version) + document_type.create_document_from_data( + data, + owner_id, + 0, + 0, + document_entropy, + platform_version, + ) } #[cfg(feature = "extended-document")] pub fn create_extended_document( @@ -140,6 +179,8 @@ impl SpecializedDocumentFactoryV0 { let document = document_type.create_document_from_data( data, owner_id, + 0, + 0, document_entropy, platform_version, )?; @@ -176,6 +217,7 @@ impl SpecializedDocumentFactoryV0 { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { let platform_version = PlatformVersion::get(self.protocol_version)?; let documents: Vec<( @@ -210,13 +252,14 @@ impl SpecializedDocumentFactoryV0 { .into_iter() .map(|(action, documents)| match action { DocumentTransitionActionType::Create => { - Self::document_create_transitions(documents, platform_version) + Self::document_create_transitions(documents, nonce_counter, platform_version) } DocumentTransitionActionType::Delete => Self::document_delete_transitions( documents .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), DocumentTransitionActionType::Replace => Self::document_replace_transitions( @@ -224,8 +267,12 @@ impl SpecializedDocumentFactoryV0 { .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), + _ => Err(ProtocolError::InvalidStateTransitionType( + "action type not accounted for".to_string(), + )), }) .collect::, ProtocolError>>()? .into_iter() @@ -239,12 +286,14 @@ impl SpecializedDocumentFactoryV0 { Ok(DocumentsBatchTransitionV0 { owner_id, transitions, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } .into()) } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], @@ -338,8 +387,10 @@ impl SpecializedDocumentFactoryV0 { // // Ok(data_contract) // // } // + #[cfg(feature = "state-transitions")] fn document_create_transitions( documents: Vec<(Document, DocumentTypeRef, Bytes32)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -360,21 +411,31 @@ impl SpecializedDocumentFactoryV0 { .into()); } } - Ok(DocumentCreateTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentCreateTransition::from_document( document, document_type, entropy.to_buffer(), + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } + #[cfg(feature = "state-transitions")] fn document_replace_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -396,14 +457,22 @@ impl SpecializedDocumentFactoryV0 { document.set_revision(document.revision().map(|revision| revision + 1)); document.set_updated_at(Some(Utc::now().timestamp_millis() as TimestampMillis)); - Ok(DocumentReplaceTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentReplaceTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() // let mut raw_transitions = vec![]; @@ -447,15 +516,17 @@ impl SpecializedDocumentFactoryV0 { // Ok(raw_transitions) } + #[cfg(feature = "state-transitions")] fn document_delete_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents .into_iter() .map(|(document, document_type)| { - if !document_type.documents_mutable() { - return Err(DocumentError::TryingToDeleteImmutableDocument { + if !document_type.documents_can_be_deleted() { + return Err(DocumentError::TryingToDeleteIndelibleDocument { document: Box::new(document), } .into()); @@ -466,14 +537,21 @@ impl SpecializedDocumentFactoryV0 { } .into()); }; - Ok(DocumentDeleteTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + let transition = DocumentDeleteTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } diff --git a/packages/rs-dpp/src/document/state_transition/documents_batch_transition/document_transition/document_create_transition_action.rs b/packages/rs-dpp/src/document/state_transition/documents_batch_transition/document_transition/document_create_transition_action.rs deleted file mode 100644 index 6583ee152b3..00000000000 --- a/packages/rs-dpp/src/document/state_transition/documents_batch_transition/document_transition/document_create_transition_action.rs +++ /dev/null @@ -1,140 +0,0 @@ -use crate::document::document_transition::document_base_transition_action::DocumentBaseTransitionAction; -use crate::document::document_transition::DocumentCreateTransition; -use crate::identity::TimestampMillis; -use platform_value::{Identifier, Value}; -use std::collections::BTreeMap; - -use crate::document::Document; -use crate::ProtocolError; -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, Default, Deserialize, Serialize)] -pub struct DocumentCreateTransitionAction { - /// Document Base Transition - pub base: DocumentBaseTransitionAction, - /// The creation time of the document - pub created_at: Option, - //todo: remove updated_at - /// The time the document was last updated - pub updated_at: Option, - /// Document properties - pub data: BTreeMap, -} - -impl From for DocumentCreateTransitionAction { - fn from(value: DocumentCreateTransition) -> Self { - let DocumentCreateTransition { - base, - created_at, - updated_at, - data, - .. - } = value; - DocumentCreateTransitionAction { - base: base.into(), - created_at, - updated_at, - data: data.unwrap_or_default(), - } - } -} - -impl From<&DocumentCreateTransition> for DocumentCreateTransitionAction { - fn from(value: &DocumentCreateTransition) -> Self { - let DocumentCreateTransition { - base, - created_at, - updated_at, - data, - .. - } = value; - DocumentCreateTransitionAction { - base: base.into(), - created_at: *created_at, - updated_at: *updated_at, - data: data.clone().unwrap_or_default(), - } - } -} - -impl Document { - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` reference and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A reference to the `DocumentCreateTransition` containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - pub fn try_from_create_transition( - value: &DocumentCreateTransitionAction, - owner_id: Identifier, - ) -> Result { - let DocumentCreateTransitionAction { - base, - created_at, - updated_at, - data, - } = value; - - let DocumentBaseTransitionAction { - id, - document_type_name, - data_contract, - .. - } = base; - - let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; - - Ok(Document { - id: *id, - owner_id, - properties: data.clone(), - revision: document_type.initial_revision(), - created_at: *created_at, - updated_at: *updated_at, - }) - } - - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` instance and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A `DocumentCreateTransition` instance containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - pub fn try_from_owned_create_transition( - value: DocumentCreateTransitionAction, - owner_id: Identifier, - ) -> Result { - let DocumentCreateTransitionAction { - base, - created_at, - updated_at, - data, - } = value; - - let DocumentBaseTransitionAction { - id, - document_type_name, - data_contract, - .. - } = base; - - let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; - - Ok(Document { - id, - owner_id, - properties: data, - revision: document_type.initial_revision(), - created_at, - updated_at, - }) - } -} diff --git a/packages/rs-dpp/src/document/state_transition/documents_batch_transition/document_transition/document_replace_transition_action.rs b/packages/rs-dpp/src/document/state_transition/documents_batch_transition/document_transition/document_replace_transition_action.rs deleted file mode 100644 index d063bd900df..00000000000 --- a/packages/rs-dpp/src/document/state_transition/documents_batch_transition/document_transition/document_replace_transition_action.rs +++ /dev/null @@ -1,115 +0,0 @@ -use crate::document::document_transition::document_base_transition_action::DocumentBaseTransitionAction; -use crate::document::document_transition::DocumentReplaceTransition; -use crate::document::Document; -use crate::identity::TimestampMillis; -use crate::prelude::Revision; -use crate::ProtocolError; -use platform_value::{Identifier, Value}; -use serde::{Deserialize, Serialize}; -use std::collections::BTreeMap; - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct DocumentReplaceTransitionAction { - /// Document Base Transition - pub base: DocumentBaseTransitionAction, - /// The current revision we are setting - pub revision: Revision, - /// The time the document was last updated - pub created_at: Option, - /// The time the document was last updated - pub updated_at: Option, - /// Document properties - pub data: BTreeMap, -} - -impl DocumentReplaceTransitionAction { - pub fn from_document_replace_transition( - document_replace_transition: &DocumentReplaceTransition, - originally_created_at: Option, - ) -> Self { - let DocumentReplaceTransition { - base, - revision, - updated_at, - data, - .. - } = document_replace_transition; - DocumentReplaceTransitionAction { - base: base.into(), - revision: *revision, - created_at: originally_created_at, - updated_at: *updated_at, - data: data.clone().unwrap_or_default(), - } - } -} - -impl Document { - /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionAction` reference and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A reference to the `DocumentReplaceTransitionAction` containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - pub fn try_from_replace_transition( - value: &DocumentReplaceTransitionAction, - owner_id: Identifier, - ) -> Result { - let DocumentReplaceTransitionAction { - base, - revision, - created_at, - updated_at, - data, - } = value; - - let DocumentBaseTransitionAction { id, .. } = base; - - Ok(Document { - id: *id, - owner_id, - properties: data.clone(), - revision: Some(*revision), - created_at: *created_at, - updated_at: *updated_at, - }) - } - - /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionAction` instance and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A `DocumentReplaceTransitionAction` instance containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - pub fn try_from_owned_replace_transition( - value: DocumentReplaceTransitionAction, - owner_id: Identifier, - ) -> Result { - let DocumentReplaceTransitionAction { - base, - revision, - created_at, - updated_at, - data, - } = value; - - let DocumentBaseTransitionAction { id, .. } = base; - - Ok(Document { - id, - owner_id, - properties: data, - revision: Some(revision), - created_at, - updated_at, - }) - } -} diff --git a/packages/rs-dpp/src/document/transfer.rs b/packages/rs-dpp/src/document/transfer.rs new file mode 100644 index 00000000000..cf7bfd48b25 --- /dev/null +++ b/packages/rs-dpp/src/document/transfer.rs @@ -0,0 +1,42 @@ +use crate::consensus::basic::data_contract::UnknownTransferableTypeError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use derive_more::Display; + +/// We made this enum because in the future we might have a case where documents are sometimes +/// transferable + +#[derive(Clone, Copy, Debug, PartialEq, Default, Display)] +#[repr(u8)] +pub enum Transferable { + #[default] + Never = 0, + Always = 1, +} + +impl Transferable { + pub fn is_transferable(&self) -> bool { + match self { + Transferable::Never => false, + Transferable::Always => true, + } + } +} + +impl TryFrom for Transferable { + type Error = ProtocolError; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(Self::Never), + 1 => Ok(Self::Always), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownTransferableTypeError( + UnknownTransferableTypeError::new(vec![0, 1], value), + )) + .into(), + )), + } + } +} diff --git a/packages/rs-dpp/src/document/v0/accessors.rs b/packages/rs-dpp/src/document/v0/accessors.rs index 857d65613a4..63d056b2d12 100644 --- a/packages/rs-dpp/src/document/v0/accessors.rs +++ b/packages/rs-dpp/src/document/v0/accessors.rs @@ -5,69 +5,270 @@ use platform_value::{Identifier, Value}; use std::collections::BTreeMap; impl DocumentV0Getters for DocumentV0 { + /// Returns the document's unique identifier. + /// + /// # Returns + /// An `Identifier` representing the unique ID of the document. fn id(&self) -> Identifier { self.id } + /// Returns the identifier of the document's owner. + /// + /// # Returns + /// An `Identifier` representing the owner's ID. fn owner_id(&self) -> Identifier { self.owner_id } + /// Provides a reference to the document's properties. + /// + /// # Returns + /// A reference to a `BTreeMap` containing the document's properties. fn properties(&self) -> &BTreeMap { &self.properties } + /// Provides a mutable reference to the document's properties. + /// + /// # Returns + /// A mutable reference to a `BTreeMap` containing the document's properties. fn properties_mut(&mut self) -> &mut BTreeMap { &mut self.properties } + /// Returns the document's revision, if it is part + /// of the document. The document will have this field if it's schema has this document type + /// as mutable. + /// + /// # Returns + /// An `Option` which is `Some(Revision)` if the document has a revision, or `None` if not. fn revision(&self) -> Option { self.revision } + /// Returns the timestamp of when the document was created, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the creation time in milliseconds, or `None` if not available. fn created_at(&self) -> Option { self.created_at } + /// Returns the timestamp of the last update to the document, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the update time in milliseconds, or `None` if not available. fn updated_at(&self) -> Option { self.updated_at } + /// Returns the timestamp of the last time the document was transferred, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the transferred at time in milliseconds, or `None` if not available. + fn transferred_at(&self) -> Option { + self.transferred_at + } + + /// Provides a reference to the document's unique identifier. + /// + /// # Returns + /// A reference to an `Identifier` representing the unique ID of the document. fn id_ref(&self) -> &Identifier { &self.id } + /// Provides a reference to the document's owner identifier. + /// + /// # Returns + /// A reference to an `Identifier` representing the owner's ID. fn owner_id_ref(&self) -> &Identifier { &self.owner_id } + /// Consumes the document and returns its properties. + /// + /// # Returns + /// A `BTreeMap` containing the document's properties. fn properties_consumed(self) -> BTreeMap { self.properties } + + /// Returns the block height at which the document was created, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the creation block height, or `None` if not available. + fn created_at_block_height(&self) -> Option { + self.created_at_block_height + } + + /// Returns the block height at which the document was last updated, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the update block height, or `None` if not available. + fn updated_at_block_height(&self) -> Option { + self.updated_at_block_height + } + + /// Returns the block height of the last time the document was transferred, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the transfer block height, or `None` if not available. + fn transferred_at_block_height(&self) -> Option { + self.transferred_at_block_height + } + + /// Returns the core network block height at which the document was created, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the creation core block height, or `None` if not available. + fn created_at_core_block_height(&self) -> Option { + self.created_at_core_block_height + } + + /// Returns the core network block height at which the document was last updated, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the update core block height, or `None` if not available. + fn updated_at_core_block_height(&self) -> Option { + self.updated_at_core_block_height + } + + /// Returns the core network block height of the last time the document was transferred, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the transfer core block height, or `None` if not available. + fn transferred_at_core_block_height(&self) -> Option { + self.transferred_at_core_block_height + } } impl DocumentV0Setters for DocumentV0 { + /// Sets the document's unique identifier. + /// + /// # Parameters + /// - `id`: An `Identifier` to set as the document's unique ID. fn set_id(&mut self, id: Identifier) { self.id = id; } + /// Sets the identifier of the document's owner. + /// + /// # Parameters + /// - `owner_id`: An `Identifier` to set as the document's owner ID. fn set_owner_id(&mut self, owner_id: Identifier) { self.owner_id = owner_id; } + /// Sets the document's properties. + /// + /// # Parameters + /// - `properties`: A `BTreeMap` containing the properties to set for the document. fn set_properties(&mut self, properties: BTreeMap) { self.properties = properties; } + /// Sets the document's revision. This is applicable if the document's schema indicates + /// the document type as mutable. + /// + /// # Parameters + /// - `revision`: An `Option` to set as the document's revision. `None` indicates + /// the document does not have a revision. fn set_revision(&mut self, revision: Option) { self.revision = revision; } + /// Bumps the document's revision if it has one. This is applicable if the document's schema indicates + /// the document type as mutable. + /// + fn bump_revision(&mut self) { + if let Some(revision) = self.revision { + self.revision = Some(revision.saturating_add(1)) + } + } + + /// Sets the timestamp of when the document was created. This is applicable if the document's + /// schema requires a creation timestamp. + /// + /// # Parameters + /// - `created_at`: An `Option` to set as the document's creation timestamp. + /// `None` indicates the timestamp is not available. fn set_created_at(&mut self, created_at: Option) { self.created_at = created_at; } + /// Sets the timestamp of the last update to the document. This is applicable if the document's + /// schema requires an update timestamp. + /// + /// # Parameters + /// - `updated_at`: An `Option` to set as the document's last update timestamp. + /// `None` indicates the timestamp is not available. fn set_updated_at(&mut self, updated_at: Option) { self.updated_at = updated_at; } + + fn set_transferred_at(&mut self, transferred_at: Option) { + self.transferred_at = transferred_at; + } + + /// Sets the block height at which the document was created. This is applicable if the document's + /// schema requires this information. + /// + /// # Parameters + /// - `created_at_block_height`: An `Option` to set as the document's creation block height. + /// `None` indicates the block height is not available. + fn set_created_at_block_height(&mut self, created_at_block_height: Option) { + self.created_at_block_height = created_at_block_height; + } + + /// Sets the block height at which the document was last updated. This is applicable if the document's + /// schema requires this information. + /// + /// # Parameters + /// - `updated_at_block_height`: An `Option` to set as the document's last update block height. + /// `None` indicates the block height is not available. + fn set_updated_at_block_height(&mut self, updated_at_block_height: Option) { + self.updated_at_block_height = updated_at_block_height; + } + + fn set_transferred_at_block_height(&mut self, transferred_at_block_height: Option) { + self.transferred_at_block_height = transferred_at_block_height; + } + + /// Sets the core network block height at which the document was created. This is applicable if the + /// document's schema requires this information. + /// + /// # Parameters + /// - `created_at_core_block_height`: An `Option` to set as the document's creation core block height. + /// `None` indicates the core block height is not available. + fn set_created_at_core_block_height(&mut self, created_at_core_block_height: Option) { + self.created_at_core_block_height = created_at_core_block_height; + } + + /// Sets the core network block height at which the document was last updated. This is applicable if the + /// document's schema requires this information. + /// + /// # Parameters + /// - `updated_at_core_block_height`: An `Option` to set as the document's last update core block height. + /// `None` indicates the core block height is not available. + fn set_updated_at_core_block_height(&mut self, updated_at_core_block_height: Option) { + self.updated_at_core_block_height = updated_at_core_block_height; + } + + fn set_transferred_at_core_block_height( + &mut self, + transferred_at_core_block_height: Option, + ) { + self.transferred_at_core_block_height = transferred_at_core_block_height; + } } diff --git a/packages/rs-dpp/src/document/v0/cbor_conversion.rs b/packages/rs-dpp/src/document/v0/cbor_conversion.rs index bcd4f40919a..8fe0732ea2c 100644 --- a/packages/rs-dpp/src/document/v0/cbor_conversion.rs +++ b/packages/rs-dpp/src/document/v0/cbor_conversion.rs @@ -1,9 +1,7 @@ -use crate::data_contract::errors::StructureError; - use crate::document::property_names; use crate::identity::TimestampMillis; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::ProtocolError; @@ -43,6 +41,22 @@ pub struct DocumentForCbor { pub created_at: Option, #[serde(rename = "$updatedAt")] pub updated_at: Option, + #[serde(rename = "$transferredAt")] + pub transferred_at: Option, + + #[serde(rename = "$createdAtBlockHeight")] + pub created_at_block_height: Option, + #[serde(rename = "$updatedAtBlockHeight")] + pub updated_at_block_height: Option, + #[serde(rename = "$transferredAtBlockHeight")] + pub transferred_at_block_height: Option, + + #[serde(rename = "$createdAtCoreBlockHeight")] + pub created_at_core_block_height: Option, + #[serde(rename = "$updatedAtCoreBlockHeight")] + pub updated_at_core_block_height: Option, + #[serde(rename = "$transferredAtCoreBlockHeight")] + pub transferred_at_core_block_height: Option, } #[cfg(feature = "cbor")] @@ -57,6 +71,13 @@ impl TryFrom for DocumentForCbor { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, } = value; Ok(DocumentForCbor { id: id.to_buffer(), @@ -66,6 +87,13 @@ impl TryFrom for DocumentForCbor { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }) } } @@ -96,6 +124,20 @@ impl DocumentV0 { let created_at = document_map.remove_optional_integer(property_names::CREATED_AT)?; let updated_at = document_map.remove_optional_integer(property_names::UPDATED_AT)?; + let transferred_at = + document_map.remove_optional_integer(property_names::TRANSFERRED_AT)?; + let created_at_block_height = + document_map.remove_optional_integer(property_names::CREATED_AT_BLOCK_HEIGHT)?; + let updated_at_block_height = + document_map.remove_optional_integer(property_names::UPDATED_AT_BLOCK_HEIGHT)?; + let transferred_at_block_height = + document_map.remove_optional_integer(property_names::TRANSFERRED_AT_BLOCK_HEIGHT)?; + let created_at_core_block_height = + document_map.remove_optional_integer(property_names::CREATED_AT_CORE_BLOCK_HEIGHT)?; + let updated_at_core_block_height = + document_map.remove_optional_integer(property_names::UPDATED_AT_CORE_BLOCK_HEIGHT)?; + let transferred_at_core_block_height = document_map + .remove_optional_integer(property_names::TRANSFERRED_AT_CORE_BLOCK_HEIGHT)?; // dev-note: properties is everything other than the id and owner id Ok(DocumentV0 { @@ -105,6 +147,13 @@ impl DocumentV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }) } } @@ -122,9 +171,9 @@ impl DocumentCborMethodsV0 for DocumentV0 { // we would need dedicated deserialization functions based on the document type let document_cbor_map: BTreeMap = ciborium::de::from_reader(document_cbor).map_err(|_| { - ProtocolError::StructureError(StructureError::InvalidCBOR( - "unable to decode document for document call", - )) + ProtocolError::InvalidCBOR( + "unable to decode document for document call".to_string(), + ) })?; let document_map: BTreeMap = Value::convert_from_cbor_map(document_cbor_map).map_err(ProtocolError::ValueError)?; diff --git a/packages/rs-dpp/src/document/v0/json_conversion.rs b/packages/rs-dpp/src/document/v0/json_conversion.rs index ea4fc8d046a..87c1718a867 100644 --- a/packages/rs-dpp/src/document/v0/json_conversion.rs +++ b/packages/rs-dpp/src/document/v0/json_conversion.rs @@ -33,6 +33,33 @@ impl<'a> DocumentJsonMethodsV0<'a> for DocumentV0 { JsonValue::Number(updated_at.into()), ); } + if let Some(created_at_block_height) = self.created_at_block_height { + value_mut.insert( + property_names::CREATED_AT_BLOCK_HEIGHT.to_string(), + JsonValue::Number(created_at_block_height.into()), + ); + } + + if let Some(updated_at_block_height) = self.updated_at_block_height { + value_mut.insert( + property_names::UPDATED_AT_BLOCK_HEIGHT.to_string(), + JsonValue::Number(updated_at_block_height.into()), + ); + } + + if let Some(created_at_core_block_height) = self.created_at_core_block_height { + value_mut.insert( + property_names::CREATED_AT_CORE_BLOCK_HEIGHT.to_string(), + JsonValue::Number(created_at_core_block_height.into()), + ); + } + + if let Some(updated_at_core_block_height) = self.updated_at_core_block_height { + value_mut.insert( + property_names::UPDATED_AT_CORE_BLOCK_HEIGHT.to_string(), + JsonValue::Number(updated_at_core_block_height.into()), + ); + } if let Some(revision) = self.revision { value_mut.insert( property_names::REVISION.to_string(), @@ -84,6 +111,18 @@ impl<'a> DocumentJsonMethodsV0<'a> for DocumentV0 { if let Ok(value) = document_value.remove(property_names::UPDATED_AT) { document.updated_at = serde_json::from_value(value)? } + if let Ok(value) = document_value.remove(property_names::CREATED_AT_BLOCK_HEIGHT) { + document.created_at_block_height = serde_json::from_value(value)?; + } + if let Ok(value) = document_value.remove(property_names::UPDATED_AT_BLOCK_HEIGHT) { + document.updated_at_block_height = serde_json::from_value(value)?; + } + if let Ok(value) = document_value.remove(property_names::CREATED_AT_CORE_BLOCK_HEIGHT) { + document.created_at_core_block_height = serde_json::from_value(value)?; + } + if let Ok(value) = document_value.remove(property_names::UPDATED_AT_CORE_BLOCK_HEIGHT) { + document.updated_at_core_block_height = serde_json::from_value(value)?; + } let platform_value: Value = document_value.into(); diff --git a/packages/rs-dpp/src/document/v0/mod.rs b/packages/rs-dpp/src/document/v0/mod.rs index aae6e1a25c5..c68c01a42ac 100644 --- a/packages/rs-dpp/src/document/v0/mod.rs +++ b/packages/rs-dpp/src/document/v0/mod.rs @@ -12,20 +12,22 @@ pub(super) mod json_conversion; mod platform_value_conversion; pub mod serialize; -use chrono::{DateTime, NaiveDateTime, Utc}; +use chrono::DateTime; use std::collections::BTreeMap; use std::fmt; use platform_value::Value; +#[cfg(feature = "document-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::document::document_methods::{ DocumentGetRawForContractV0, DocumentGetRawForDocumentTypeV0, DocumentHashV0Method, + DocumentIsEqualIgnoringTimestampsV0, }; use crate::identity::TimestampMillis; -use crate::prelude::Identifier; use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Identifier}; /// Documents contain the data that goes into data contracts. #[derive(Clone, Debug, PartialEq, Default)] @@ -40,30 +42,76 @@ pub struct DocumentV0 { /// The document's properties (data). #[cfg_attr(feature = "document-serde-conversion", serde(flatten))] pub properties: BTreeMap, - /// The document revision. + /// The document revision, if the document is mutable. #[cfg_attr( feature = "document-serde-conversion", serde(rename = "$revision", default) )] pub revision: Option, - /// The time in milliseconds that the document was created + /// The time in milliseconds that the document was created, if it is set as required by the document type schema. #[cfg_attr( feature = "document-serde-conversion", serde(rename = "$createdAt", default) )] pub created_at: Option, - /// The time in milliseconds that the document was last updated + /// The time in milliseconds that the document was last updated, if it is set as required by the document type schema. #[cfg_attr( feature = "document-serde-conversion", serde(rename = "$updatedAt", default) )] pub updated_at: Option, + /// The time in milliseconds that the document was last transferred, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$transferredAt", default) + )] + pub transferred_at: Option, + /// The block that the document was created, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$createdAtBlockHeight", default) + )] + pub created_at_block_height: Option, + /// The block that the document was last updated, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$updatedAtBlockHeight", default) + )] + pub updated_at_block_height: Option, + /// The block that the document was last transferred to a new identity, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$transferredAtBlockHeight", default) + )] + pub transferred_at_block_height: Option, + /// The core block that the document was created, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$createdAtCoreBlockHeight", default) + )] + pub created_at_core_block_height: Option, + /// The core block that the document was last updated, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$updatedAtCoreBlockHeight", default) + )] + pub updated_at_core_block_height: Option, + /// The core block that the document was last transferred to a new identity, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$transferredAtCoreBlockHeight", default) + )] + pub transferred_at_core_block_height: Option, } impl DocumentGetRawForContractV0 for DocumentV0 { //automatically done } +impl DocumentIsEqualIgnoringTimestampsV0 for DocumentV0 { + //automatically done +} + impl DocumentGetRawForDocumentTypeV0 for DocumentV0 { //automatically done } @@ -77,16 +125,35 @@ impl fmt::Display for DocumentV0 { write!(f, "id:{} ", self.id)?; write!(f, "owner_id:{} ", self.owner_id)?; if let Some(created_at) = self.created_at { - let naive = NaiveDateTime::from_timestamp_millis(created_at as i64).unwrap_or_default(); - let datetime: DateTime = DateTime::from_utc(naive, Utc); + let datetime = DateTime::from_timestamp_millis(created_at as i64).unwrap_or_default(); write!(f, "created_at:{} ", datetime.format("%Y-%m-%d %H:%M:%S"))?; } if let Some(updated_at) = self.updated_at { - let naive = NaiveDateTime::from_timestamp_millis(updated_at as i64).unwrap_or_default(); - let datetime: DateTime = DateTime::from_utc(naive, Utc); + let datetime = DateTime::from_timestamp_millis(updated_at as i64).unwrap_or_default(); write!(f, "updated_at:{} ", datetime.format("%Y-%m-%d %H:%M:%S"))?; } + if let Some(created_at_block_height) = self.created_at_block_height { + write!(f, "created_at_block_height:{} ", created_at_block_height)?; + } + if let Some(updated_at_block_height) = self.updated_at_block_height { + write!(f, "updated_at_block_height:{} ", updated_at_block_height)?; + } + if let Some(created_at_core_block_height) = self.created_at_core_block_height { + write!( + f, + "created_at_core_block_height:{} ", + created_at_core_block_height + )?; + } + if let Some(updated_at_core_block_height) = self.updated_at_core_block_height { + write!( + f, + "updated_at_core_block_height:{} ", + updated_at_core_block_height + )?; + } + if self.properties.is_empty() { write!(f, "no properties")?; } else { diff --git a/packages/rs-dpp/src/document/v0/serialize.rs b/packages/rs-dpp/src/document/v0/serialize.rs index 25c833a2c5d..0083216a12f 100644 --- a/packages/rs-dpp/src/document/v0/serialize.rs +++ b/packages/rs-dpp/src/document/v0/serialize.rs @@ -1,7 +1,14 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::errors::DataContractError; -use crate::document::property_names::{CREATED_AT, UPDATED_AT}; +use crate::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, PRICE, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; + +#[cfg(feature = "validation")] +use crate::prelude::ConsensusValidationResult; use crate::prelude::Revision; @@ -22,6 +29,11 @@ use platform_version::version::FeatureVersion; use std::collections::BTreeMap; +use crate::consensus::basic::decode::DecodingError; +#[cfg(feature = "validation")] +use crate::consensus::basic::BasicError; +#[cfg(feature = "validation")] +use crate::consensus::ConsensusError; use std::io::{BufReader, Read}; impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { @@ -45,43 +57,152 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { buffer.extend((1 as Revision).encode_var_vec()) } + let mut bitwise_exists_flag: u16 = 0; + + let mut time_fields_data_buffer = vec![]; + // $createdAt if let Some(created_at) = &self.created_at { - if !document_type.required_fields().contains(CREATED_AT) { - buffer.push(1); - } + bitwise_exists_flag |= 1; // dbg!("we pushed created at {}", hex::encode(created_at.to_be_bytes())); - buffer.extend(created_at.to_be_bytes()); + time_fields_data_buffer.extend(created_at.to_be_bytes()); } else if document_type.required_fields().contains(CREATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "created at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed created at with 0"); - // We don't have the created_at that wasn't required - buffer.push(0); } // $updatedAt if let Some(updated_at) = &self.updated_at { - if !document_type.required_fields().contains(UPDATED_AT) { - // dbg!("we added 1", field_name); - buffer.push(1); - } + bitwise_exists_flag |= 2; // dbg!("we pushed updated at {}", hex::encode(updated_at.to_be_bytes())); - buffer.extend(updated_at.to_be_bytes()); + time_fields_data_buffer.extend(updated_at.to_be_bytes()); } else if document_type.required_fields().contains(UPDATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "updated at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed updated at with 0"); - // We don't have the updated_at that wasn't required - buffer.push(0); + } + + // $transferredAt + if let Some(transferred_at) = &self.transferred_at { + bitwise_exists_flag |= 4; + // dbg!("we pushed transferred at {}", hex::encode(transferred_at.to_be_bytes())); + time_fields_data_buffer.extend(transferred_at.to_be_bytes()); + } else if document_type.required_fields().contains(TRANSFERRED_AT) { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred at field is not present".to_string(), + ), + )); + } + + // $createdAtBlockHeight + if let Some(created_at_block_height) = &self.created_at_block_height { + bitwise_exists_flag |= 8; + time_fields_data_buffer.extend(created_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtBlockHeight + if let Some(updated_at_block_height) = &self.updated_at_block_height { + bitwise_exists_flag |= 16; + time_fields_data_buffer.extend(updated_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtBlockHeight + if let Some(transferred_at_block_height) = &self.transferred_at_block_height { + bitwise_exists_flag |= 32; + time_fields_data_buffer.extend(transferred_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_block_height field is not present".to_string(), + ), + )); + } + + // $createdAtCoreBlockHeight + if let Some(created_at_core_block_height) = &self.created_at_core_block_height { + bitwise_exists_flag |= 64; + time_fields_data_buffer.extend(created_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtCoreBlockHeight + if let Some(updated_at_core_block_height) = &self.updated_at_core_block_height { + bitwise_exists_flag |= 128; + time_fields_data_buffer.extend(updated_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtCoreBlockHeight + if let Some(transferred_at_core_block_height) = &self.transferred_at_core_block_height { + bitwise_exists_flag |= 256; + time_fields_data_buffer.extend(transferred_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_core_block_height field is not present".to_string(), + ), + )); + } + + buffer.extend(bitwise_exists_flag.to_be_bytes().as_slice()); + buffer.append(&mut time_fields_data_buffer); + + // Now we serialize the price which might not be necessary unless called for by the document type + + if document_type.trade_mode().seller_sets_price() { + if let Some(price) = self.properties.get(PRICE) { + buffer.push(1); + let price_as_u64: u64 = price.to_integer().map_err(ProtocolError::ValueError)?; + buffer.append(&mut price_as_u64.to_be_bytes().to_vec()); + } else { + buffer.push(0); + } } // User defined properties @@ -91,7 +212,7 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { .try_for_each(|(field_name, property)| { if let Some(value) = self.properties.get(field_name) { if value.is_null() { - if property.required { + if property.required && !property.transient { Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "a required field is not present".to_string(), @@ -104,7 +225,7 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { Ok(()) } } else { - if !property.required { + if !property.required || property.transient { // dbg!("we added 1", field_name); buffer.push(1); } @@ -115,7 +236,7 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { buffer.extend(value.as_slice()); Ok(()) } - } else if property.required { + } else if property.required && !property.transient { Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey(format!( "a required field {field_name} is not present" @@ -152,44 +273,152 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { if let Some(revision) = self.revision { buffer.extend(revision.to_be_bytes()) } + let mut bitwise_exists_flag: u16 = 0; + + let mut time_fields_data_buffer = vec![]; // $createdAt - if let Some(created_at) = self.created_at { - if !document_type.required_fields().contains(CREATED_AT) { - buffer.push(1); - } + if let Some(created_at) = &self.created_at { + bitwise_exists_flag |= 1; // dbg!("we pushed created at {}", hex::encode(created_at.to_be_bytes())); - buffer.extend(created_at.to_be_bytes()); + time_fields_data_buffer.extend(created_at.to_be_bytes()); } else if document_type.required_fields().contains(CREATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "created at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed created at with 0"); - // We don't have the created_at that wasn't required - buffer.push(0); } // $updatedAt - if let Some(updated_at) = self.updated_at { - if !document_type.required_fields().contains(UPDATED_AT) { - // dbg!("we added 1", field_name); - buffer.push(1); - } + if let Some(updated_at) = &self.updated_at { + bitwise_exists_flag |= 2; // dbg!("we pushed updated at {}", hex::encode(updated_at.to_be_bytes())); - buffer.extend(updated_at.to_be_bytes()); + time_fields_data_buffer.extend(updated_at.to_be_bytes()); } else if document_type.required_fields().contains(UPDATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "updated at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed updated at with 0"); - // We don't have the updated_at that wasn't required - buffer.push(0); + } + + // $transferredAt + if let Some(transferred_at) = &self.transferred_at { + bitwise_exists_flag |= 4; + // dbg!("we pushed transferred at {}", hex::encode(transferred_at.to_be_bytes())); + time_fields_data_buffer.extend(transferred_at.to_be_bytes()); + } else if document_type.required_fields().contains(TRANSFERRED_AT) { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred at field is not present".to_string(), + ), + )); + } + + // $createdAtBlockHeight + if let Some(created_at_block_height) = &self.created_at_block_height { + bitwise_exists_flag |= 8; + time_fields_data_buffer.extend(created_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtBlockHeight + if let Some(updated_at_block_height) = &self.updated_at_block_height { + bitwise_exists_flag |= 16; + time_fields_data_buffer.extend(updated_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtBlockHeight + if let Some(transferred_at_block_height) = &self.transferred_at_block_height { + bitwise_exists_flag |= 32; + time_fields_data_buffer.extend(transferred_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_block_height field is not present".to_string(), + ), + )); + } + + // $createdAtCoreBlockHeight + if let Some(created_at_core_block_height) = &self.created_at_core_block_height { + bitwise_exists_flag |= 64; + time_fields_data_buffer.extend(created_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtCoreBlockHeight + if let Some(updated_at_core_block_height) = &self.updated_at_core_block_height { + bitwise_exists_flag |= 128; + time_fields_data_buffer.extend(updated_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtCoreBlockHeight + if let Some(transferred_at_core_block_height) = &self.transferred_at_core_block_height { + bitwise_exists_flag |= 256; + time_fields_data_buffer.extend(transferred_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_core_block_height field is not present".to_string(), + ), + )); + } + + buffer.extend(bitwise_exists_flag.to_be_bytes().as_slice()); + buffer.append(&mut time_fields_data_buffer); + + // Now we serialize the price which might not be necessary unless called for by the document type + + if document_type.trade_mode().seller_sets_price() { + if let Some(price) = self.properties.get(PRICE) { + buffer.push(1); + let price_as_u64: u64 = price.to_integer().map_err(ProtocolError::ValueError)?; + buffer.append(&mut price_as_u64.to_be_bytes().to_vec()); + } else { + buffer.push(0); + } } // User defined properties @@ -212,7 +441,7 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { Ok(()) } } else { - if !property.required { + if !property.required || property.transient { // dbg!("we added 1", field_name); buffer.push(1); } @@ -223,7 +452,7 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { buffer.extend(value.as_slice()); Ok(()) } - } else if property.required { + } else if property.required && !property.transient { Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey(format!( "a required field {field_name} is not present" @@ -247,59 +476,177 @@ impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 { serialized_document: &[u8], document_type: DocumentTypeRef, _platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { let mut buf = BufReader::new(serialized_document); if serialized_document.len() < 64 { - return Err(ProtocolError::DecodingError( - "serialized document is too small, must have id and owner id".to_string(), + return Err(DataContractError::DecodingDocumentError( + DecodingError::new( + "serialized document is too small, must have id and owner id".to_string(), + ), )); } // $id let mut id = [0; 32]; buf.read_exact(&mut id).map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading from serialized document for id".to_string(), - ) + )) })?; // $ownerId let mut owner_id = [0; 32]; buf.read_exact(&mut owner_id).map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading from serialized document for owner id".to_string(), - ) + )) })?; // $revision // if the document type is mutable then we should deserialize the revision let revision: Option = if document_type.requires_revision() { let revision = buf.read_varint().map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading revision from serialized document for revision".to_string(), - ) + )) })?; Some(revision) } else { None }; - // $createdAt - let created_at = read_timestamp(&mut buf, document_type, CREATED_AT)?; - let updated_at = read_timestamp(&mut buf, document_type, UPDATED_AT)?; + let timestamp_flags = buf.read_u16::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading timestamp flags from serialized document".to_string(), + ) + })?; + + let created_at = if timestamp_flags & 1 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading created_at timestamp from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let updated_at = if timestamp_flags & 2 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at timestamp from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let transferred_at = if timestamp_flags & 4 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading transferred_at timestamp from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let created_at_block_height = if timestamp_flags & 8 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading created_at_block_height from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let updated_at_block_height = if timestamp_flags & 16 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at_block_height from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let transferred_at_block_height = if timestamp_flags & 32 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading transferred_at_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + let created_at_core_block_height = if timestamp_flags & 64 > 0 { + Some(buf.read_u32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading created_at_core_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + let updated_at_core_block_height = if timestamp_flags & 128 > 0 { + Some(buf.read_u32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at_core_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + let transferred_at_core_block_height = if timestamp_flags & 256 > 0 { + Some(buf.read_u32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at_core_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + // Now we deserialize the price which might not be necessary unless called for by the document type + + let price = if document_type.trade_mode().seller_sets_price() { + let has_price = buf.read_u8().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading has price bool from serialized document".to_string(), + ) + })?; + if has_price > 0 { + let price = buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading price u64 from serialized document".to_string(), + ) + })?; + Some(price) + } else { + None + } + } else { + None + }; let mut finished_buffer = false; - let properties = document_type + let mut properties = document_type .properties() .iter() .filter_map(|(key, property)| { if finished_buffer { - return if property.required { - Some(Err(ProtocolError::DataContractError( - DataContractError::CorruptedSerialization( - "required field after finished buffer", - ), + return if property.required && !property.transient { + Some(Err(DataContractError::CorruptedSerialization( + "required field after finished buffer".to_string(), ))) } else { None @@ -307,7 +654,7 @@ impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 { } let read_value = property .property_type - .read_optionally_from(&mut buf, property.required); + .read_optionally_from(&mut buf, property.required & !property.transient); match read_value { Ok(read_value) => { @@ -317,7 +664,11 @@ impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 { Err(e) => Some(Err(e)), } }) - .collect::, ProtocolError>>()?; + .collect::, DataContractError>>()?; + + if let Some(price) = price { + properties.insert(PRICE.to_string(), price.into()); + } Ok(DocumentV0 { id: Identifier::new(id), @@ -326,36 +677,17 @@ impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }) } } -fn read_timestamp( - buf: &mut BufReader<&[u8]>, - document_type: DocumentTypeRef, - property_name: &str, -) -> Result, ProtocolError> { - if !document_type.required_fields().contains(property_name) { - let marker = buf.read_u8().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading created at optional byte from serialized document", - )) - })?; - - if marker == 0 { - return Ok(None); - } - } - - let timestamp = buf.read_u64::().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading created at from serialized document", - )) - })?; - - Ok(Some(timestamp)) -} - impl DocumentPlatformConversionMethodsV0 for DocumentV0 { /// Serializes the document. /// @@ -427,12 +759,46 @@ impl DocumentPlatformConversionMethodsV0 for DocumentV0 { platform_version: &PlatformVersion, ) -> Result { let serialized_version = serialized_document.read_varint().map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading revision from serialized document for revision".to_string(), - ) + )) })?; match serialized_version { - 0 => DocumentV0::from_bytes_v0(serialized_document, document_type, platform_version), + 0 => DocumentV0::from_bytes_v0(serialized_document, document_type, platform_version) + .map_err(ProtocolError::DataContractError), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::from_bytes (deserialization)".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + /// Reads a serialized document and creates a DocumentV0 from it. + #[cfg(feature = "validation")] + fn from_bytes_in_consensus( + mut serialized_document: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let serialized_version = serialized_document.read_varint().map_err(|_| { + DataContractError::DecodingDocumentError(DecodingError::new( + "error reading revision from serialized document for revision".to_string(), + )) + })?; + match serialized_version { + 0 => { + match DocumentV0::from_bytes_v0( + serialized_document, + document_type, + platform_version, + ) { + Ok(document) => Ok(ConsensusValidationResult::new_with_data(document)), + Err(err) => Ok(ConsensusValidationResult::new_with_error( + ConsensusError::BasicError(BasicError::ContractError(err)), + )), + } + } version => Err(ProtocolError::UnknownVersionMismatch { method: "Document::from_bytes (deserialization)".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs index f6c463b555f..e2f2f25012e 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs @@ -4,33 +4,41 @@ use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use thiserror::Error; use crate::consensus::basic::data_contract::data_contract_max_depth_exceed_error::DataContractMaxDepthExceedError; +#[cfg(feature = "json-schema-validation")] +use crate::consensus::basic::data_contract::InvalidJsonSchemaRefError; use crate::consensus::basic::data_contract::{ + ContestedUniqueIndexOnMutableDocumentTypeError, ContestedUniqueIndexWithUniqueIndexError, DataContractHaveNewUniqueIndexError, DataContractImmutablePropertiesUpdateError, DataContractInvalidIndexDefinitionUpdateError, DataContractUniqueIndicesChangedError, DuplicateIndexError, DuplicateIndexNameError, IncompatibleDataContractSchemaError, - IncompatibleRe2PatternError, InvalidCompoundIndexError, InvalidDataContractIdError, - InvalidDataContractVersionError, InvalidIndexPropertyTypeError, - InvalidIndexedPropertyConstraintError, InvalidJsonSchemaRefError, - SystemPropertyIndexAlreadyPresentError, UndefinedIndexPropertyError, - UniqueIndicesLimitReachedError, + IncompatibleDocumentTypeSchemaError, IncompatibleRe2PatternError, InvalidCompoundIndexError, + InvalidDataContractIdError, InvalidDataContractVersionError, InvalidDocumentTypeNameError, + InvalidDocumentTypeRequiredSecurityLevelError, InvalidIndexPropertyTypeError, + InvalidIndexedPropertyConstraintError, SystemPropertyIndexAlreadyPresentError, + UndefinedIndexPropertyError, UniqueIndicesLimitReachedError, + UnknownDocumentCreationRestrictionModeError, UnknownSecurityLevelError, + UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError, }; use crate::consensus::basic::decode::{ ProtocolVersionParsingError, SerializedObjectParsingError, VersionError, }; use crate::consensus::basic::document::{ - DataContractNotPresentError, DocumentTransitionsAreAbsentError, + DataContractNotPresentError, DocumentCreationNotAllowedError, + DocumentFieldMaxSizeExceededError, DocumentTransitionsAreAbsentError, DuplicateDocumentTransitionsWithIdsError, DuplicateDocumentTransitionsWithIndicesError, InconsistentCompoundIndexDataError, InvalidDocumentTransitionActionError, InvalidDocumentTransitionIdError, InvalidDocumentTypeError, MaxDocumentsTransitionsExceededError, MissingDataContractIdBasicError, MissingDocumentTransitionActionError, MissingDocumentTransitionTypeError, - MissingDocumentTypeError, MissingPositionsInDocumentTypePropertiesError, + MissingDocumentTypeError, MissingPositionsInDocumentTypePropertiesError, NonceOutOfBoundsError, }; use crate::consensus::basic::identity::{ - DataContractBoundsNotPresentError, DuplicatedIdentityPublicKeyBasicError, - DuplicatedIdentityPublicKeyIdBasicError, IdentityAssetLockProofLockedTransactionMismatchError, - IdentityAssetLockTransactionIsNotFoundError, - IdentityAssetLockTransactionOutPointAlreadyExistsError, + DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, + DuplicatedIdentityPublicKeyBasicError, DuplicatedIdentityPublicKeyIdBasicError, + IdentityAssetLockProofLockedTransactionMismatchError, + IdentityAssetLockStateTransitionReplayError, IdentityAssetLockTransactionIsNotFoundError, + IdentityAssetLockTransactionOutPointAlreadyConsumedError, + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, IdentityAssetLockTransactionOutputNotFoundError, IdentityCreditTransferToSelfError, InvalidAssetLockProofCoreChainHeightError, InvalidAssetLockProofTransactionHeightError, InvalidAssetLockTransactionOutputReturnSizeError, @@ -43,21 +51,31 @@ use crate::consensus::basic::identity::{ InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, InvalidInstantAssetLockProofError, InvalidInstantAssetLockProofSignatureError, MissingMasterPublicKeyError, NotImplementedIdentityCreditWithdrawalTransitionPoolingError, + TooManyMasterPublicKeyError, }; use crate::consensus::basic::invalid_identifier_error::InvalidIdentifierError; use crate::consensus::basic::state_transition::{ InvalidStateTransitionTypeError, MissingStateTransitionTypeError, StateTransitionMaxSizeExceededError, }; -use crate::consensus::basic::{IncompatibleProtocolVersionError, UnsupportedProtocolVersionError}; +use crate::consensus::basic::{ + IncompatibleProtocolVersionError, UnsupportedFeatureError, UnsupportedProtocolVersionError, +}; use crate::consensus::ConsensusError; -use crate::consensus::basic::json_schema_compilation_error::JsonSchemaCompilationError; -use crate::consensus::basic::json_schema_error::JsonSchemaError; +use crate::consensus::basic::overflow_error::OverflowError; use crate::consensus::basic::unsupported_version_error::UnsupportedVersionError; use crate::consensus::basic::value_error::ValueError; +#[cfg(feature = "json-schema-validation")] +use crate::consensus::basic::{ + json_schema_compilation_error::JsonSchemaCompilationError, json_schema_error::JsonSchemaError, +}; +use crate::consensus::state::identity::master_public_key_update_error::MasterPublicKeyUpdateError; +use crate::data_contract::errors::DataContractError; -#[derive(Error, Debug, PlatformSerialize, PlatformDeserialize, Encode, Decode, Clone)] +#[derive( + Error, Debug, PlatformSerialize, PlatformDeserialize, Encode, Decode, PartialEq, Clone, +)] pub enum BasicError { /* @@ -71,6 +89,24 @@ pub enum BasicError { #[error(transparent)] VersionError(VersionError), + #[error(transparent)] + ContractError(DataContractError), + + #[error(transparent)] + UnknownSecurityLevelError(UnknownSecurityLevelError), + + #[error(transparent)] + UnknownStorageKeyRequirementsError(UnknownStorageKeyRequirementsError), + + #[error(transparent)] + UnknownTransferableTypeError(UnknownTransferableTypeError), + + #[error(transparent)] + UnknownTradeModeError(UnknownTradeModeError), + + #[error(transparent)] + UnknownDocumentCreationRestrictionModeError(UnknownDocumentCreationRestrictionModeError), + #[error(transparent)] SerializedObjectParsingError(SerializedObjectParsingError), @@ -83,10 +119,12 @@ pub enum BasicError { #[error(transparent)] IncompatibleProtocolVersionError(IncompatibleProtocolVersionError), + #[cfg(feature = "json-schema-validation")] // Structure error #[error(transparent)] JsonSchemaCompilationError(JsonSchemaCompilationError), + #[cfg(feature = "json-schema-validation")] #[error(transparent)] JsonSchemaError(JsonSchemaError), @@ -118,6 +156,7 @@ pub enum BasicError { #[error(transparent)] InvalidIndexPropertyTypeError(InvalidIndexPropertyTypeError), + #[cfg(feature = "json-schema-validation")] #[error(transparent)] InvalidJsonSchemaRefError(InvalidJsonSchemaRefError), @@ -155,6 +194,9 @@ pub enum BasicError { #[error(transparent)] DataContractNotPresentError(DataContractNotPresentError), + #[error(transparent)] + DocumentCreationNotAllowedError(DocumentCreationNotAllowedError), + #[error(transparent)] DataContractBoundsNotPresentError(DataContractBoundsNotPresentError), @@ -164,6 +206,9 @@ pub enum BasicError { #[error(transparent)] DuplicateDocumentTransitionsWithIndicesError(DuplicateDocumentTransitionsWithIndicesError), + #[error(transparent)] + NonceOutOfBoundsError(NonceOutOfBoundsError), + #[error(transparent)] InconsistentCompoundIndexDataError(InconsistentCompoundIndexDataError), @@ -201,6 +246,11 @@ pub enum BasicError { #[error(transparent)] DuplicatedIdentityPublicKeyIdBasicError(DuplicatedIdentityPublicKeyIdBasicError), + #[error(transparent)] + DisablingKeyIdAlsoBeingAddedInSameTransitionError( + DisablingKeyIdAlsoBeingAddedInSameTransitionError, + ), + #[error(transparent)] IdentityAssetLockProofLockedTransactionMismatchError( IdentityAssetLockProofLockedTransactionMismatchError, @@ -210,10 +260,18 @@ pub enum BasicError { IdentityAssetLockTransactionIsNotFoundError(IdentityAssetLockTransactionIsNotFoundError), #[error(transparent)] - IdentityAssetLockTransactionOutPointAlreadyExistsError( - IdentityAssetLockTransactionOutPointAlreadyExistsError, + IdentityAssetLockTransactionOutPointAlreadyConsumedError( + IdentityAssetLockTransactionOutPointAlreadyConsumedError, + ), + + #[error(transparent)] + IdentityAssetLockTransactionOutPointNotEnoughBalanceError( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, ), + #[error(transparent)] + IdentityAssetLockStateTransitionReplayError(IdentityAssetLockStateTransitionReplayError), + #[error(transparent)] IdentityAssetLockTransactionOutputNotFoundError( IdentityAssetLockTransactionOutputNotFoundError, @@ -253,6 +311,15 @@ pub enum BasicError { #[error(transparent)] MissingMasterPublicKeyError(MissingMasterPublicKeyError), + #[error(transparent)] + TooManyMasterPublicKeyError(TooManyMasterPublicKeyError), + + #[error(transparent)] + MasterPublicKeyUpdateError(MasterPublicKeyUpdateError), + + #[error(transparent)] + InvalidDocumentTypeRequiredSecurityLevelError(InvalidDocumentTypeRequiredSecurityLevelError), + #[error(transparent)] InvalidIdentityPublicKeySecurityLevelError(InvalidIdentityPublicKeySecurityLevelError), @@ -297,6 +364,9 @@ pub enum BasicError { #[error(transparent)] MissingStateTransitionTypeError(MissingStateTransitionTypeError), + #[error(transparent)] + DocumentFieldMaxSizeExceededError(DocumentFieldMaxSizeExceededError), + #[error(transparent)] StateTransitionMaxSizeExceededError(StateTransitionMaxSizeExceededError), @@ -305,6 +375,24 @@ pub enum BasicError { #[error(transparent)] IdentityCreditTransferToSelfError(IdentityCreditTransferToSelfError), + + #[error(transparent)] + InvalidDocumentTypeNameError(InvalidDocumentTypeNameError), + + #[error(transparent)] + IncompatibleDocumentTypeSchemaError(IncompatibleDocumentTypeSchemaError), + + #[error(transparent)] + ContestedUniqueIndexOnMutableDocumentTypeError(ContestedUniqueIndexOnMutableDocumentTypeError), + + #[error(transparent)] + ContestedUniqueIndexWithUniqueIndexError(ContestedUniqueIndexWithUniqueIndexError), + + #[error(transparent)] + OverflowError(OverflowError), + + #[error(transparent)] + UnsupportedFeatureError(UnsupportedFeatureError), } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/contested_unique_index_on_mutable_document_type_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/contested_unique_index_on_mutable_document_type_error.rs new file mode 100644 index 00000000000..def757d547f --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/contested_unique_index_on_mutable_document_type_error.rs @@ -0,0 +1,48 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Document type '{document_type}' has a contested unique index '{contested_unique_index_name}' but is set as mutable which is not allowed" +)] +#[platform_serialize(unversioned)] +pub struct ContestedUniqueIndexOnMutableDocumentTypeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + document_type: String, + contested_unique_index_name: String, +} + +impl ContestedUniqueIndexOnMutableDocumentTypeError { + pub fn new(document_type: String, contested_unique_index_name: String) -> Self { + Self { + document_type, + contested_unique_index_name, + } + } + + pub fn document_type(&self) -> &str { + &self.document_type + } + + pub fn contested_unique_index_name(&self) -> &str { + &self.contested_unique_index_name + } +} + +impl From for ConsensusError { + fn from(err: ContestedUniqueIndexOnMutableDocumentTypeError) -> Self { + Self::BasicError(BasicError::ContestedUniqueIndexOnMutableDocumentTypeError( + err, + )) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/contested_unique_index_with_unique_index_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/contested_unique_index_with_unique_index_error.rs new file mode 100644 index 00000000000..cfaa8b9fe12 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/contested_unique_index_with_unique_index_error.rs @@ -0,0 +1,56 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Document type '{document_type}' has a contested unique index '{contested_unique_index_name}' and a unique index '{unique_index_name}' as well which is not allowed" +)] +#[platform_serialize(unversioned)] +pub struct ContestedUniqueIndexWithUniqueIndexError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + document_type: String, + contested_unique_index_name: String, + unique_index_name: String, +} + +impl ContestedUniqueIndexWithUniqueIndexError { + pub fn new( + document_type: String, + contested_unique_index_name: String, + unique_index_name: String, + ) -> Self { + Self { + document_type, + contested_unique_index_name, + unique_index_name, + } + } + + pub fn document_type(&self) -> &str { + &self.document_type + } + + pub fn contested_unique_index_name(&self) -> &str { + &self.contested_unique_index_name + } + + pub fn unique_index_name(&self) -> &str { + &self.unique_index_name + } +} + +impl From for ConsensusError { + fn from(err: ContestedUniqueIndexWithUniqueIndexError) -> Self { + Self::BasicError(BasicError::ContestedUniqueIndexWithUniqueIndexError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs index 326a4316e18..2eeebfb0ce0 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs @@ -7,7 +7,9 @@ use thiserror::Error; use bincode::{Decode, Encode}; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("only $defs, version and documents fields are allowed to be updated. Forbidden operation '{operation}' on '{field_path}'")] #[platform_serialize(unversioned)] pub struct DataContractImmutablePropertiesUpdateError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs index 5c0b8020a58..52f4633e2ad 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Document with type {document_type} has badly constructed index '{index_path}'. Existing properties in the indices should be defined in the beginning of it.")] +#[error("Document with type {document_type} could not add or remove '{index_path}' during data contract update as we do not allow modifications of data contract index paths")] #[platform_serialize(unversioned)] pub struct DataContractInvalidIndexDefinitionUpdateError { /* diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs index f30ca920e64..dd539edc469 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs @@ -16,24 +16,16 @@ pub struct DataContractMaxDepthExceedError { DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION */ - schema_depth: usize, max_depth: usize, } impl DataContractMaxDepthExceedError { - pub fn new(schema_depth: usize, max_depth: usize) -> Self { - Self { - schema_depth, - max_depth, - } + pub fn new(max_depth: usize) -> Self { + Self { max_depth } } - pub fn max_depth(&self) -> usize { self.max_depth } - pub fn schema_depth(&self) -> usize { - self.schema_depth - } } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs new file mode 100644 index 00000000000..63de5d6fdda --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs @@ -0,0 +1,43 @@ +use crate::consensus::basic::BasicError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::consensus::ConsensusError; +use crate::prelude::Identifier; + +use crate::data_contract::errors::DataContractError; +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Data Contract {data_contract_id} must have at least one document type defined.")] +#[platform_serialize(unversioned)] +pub struct DocumentTypesAreMissingError { + data_contract_id: Identifier, +} + +impl DocumentTypesAreMissingError { + pub fn new(data_contract_id: Identifier) -> Self { + Self { data_contract_id } + } + + pub fn data_contract_id(&self) -> Identifier { + self.data_contract_id + } +} + +impl From for ConsensusError { + fn from(err: DocumentTypesAreMissingError) -> Self { + Self::BasicError(BasicError::ContractError( + DataContractError::DocumentTypesAreMissingError(err), + )) + } +} + +impl From for DataContractError { + fn from(err: DocumentTypesAreMissingError) -> Self { + DataContractError::DocumentTypesAreMissingError(err) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs index 10666a545a9..9a75c009495 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs @@ -7,36 +7,25 @@ use crate::consensus::ConsensusError; use crate::prelude::Identifier; use bincode::{Decode, Encode}; -use platform_value::Value; #[derive( Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Data Contract updated schema is not backward compatible with one defined in Data Contract wid id {data_contract_id}. Field: '{field_path}', Operation: '{operation}'" +#[error("Data Contract updated schema is not backward compatible with one defined in Data Contract with id {data_contract_id}. Field: '{field_path}', Operation: '{operation}'" )] #[platform_serialize(unversioned)] pub struct IncompatibleDataContractSchemaError { data_contract_id: Identifier, operation: String, field_path: String, - old_schema: Value, - new_schema: Value, } impl IncompatibleDataContractSchemaError { - pub fn new( - data_contract_id: Identifier, - operation: String, - field_path: String, - old_schema: Value, - new_schema: Value, - ) -> Self { + pub fn new(data_contract_id: Identifier, operation: String, field_path: String) -> Self { Self { data_contract_id, operation, field_path, - old_schema, - new_schema, } } @@ -49,12 +38,6 @@ impl IncompatibleDataContractSchemaError { pub fn field_path(&self) -> String { self.field_path.clone() } - pub fn old_schema(&self) -> Value { - self.old_schema.clone() - } - pub fn new_schema(&self) -> Value { - self.new_schema.clone() - } } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs new file mode 100644 index 00000000000..2dd41eb12e4 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs @@ -0,0 +1,50 @@ +use crate::consensus::basic::BasicError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::consensus::ConsensusError; + +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Updated document type '{document_type_name}' schema is not backward compatible with previous version. Incompatible change '{operation}' of property '{property_path}'" +)] +#[platform_serialize(unversioned)] +pub struct IncompatibleDocumentTypeSchemaError { + document_type_name: String, + operation: String, + property_path: String, +} + +impl IncompatibleDocumentTypeSchemaError { + pub fn new( + document_type_name: impl Into, + operation: impl Into, + property_path: impl Into, + ) -> Self { + Self { + document_type_name: document_type_name.into(), + operation: operation.into(), + property_path: property_path.into(), + } + } + + pub fn document_type_name(&self) -> &str { + &self.document_type_name + } + pub fn operation(&self) -> &str { + &self.operation + } + pub fn property_path(&self) -> &str { + &self.property_path + } +} + +impl From for ConsensusError { + fn from(err: IncompatibleDocumentTypeSchemaError) -> Self { + Self::BasicError(BasicError::IncompatibleDocumentTypeSchemaError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs index f978d38d20f..02fde1a679c 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Data Contract version must be {expected_version}, go {version}")] +#[error("Data Contract version must be {expected_version}, got {version}")] #[platform_serialize(unversioned)] pub struct InvalidDataContractVersionError { /* diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs new file mode 100644 index 00000000000..8b9a8bf1c76 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs @@ -0,0 +1,36 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("document type name '{name}' is not supported. It must be from 1 to 64 alphanumeric chars, and '_' or '-'.")] +#[platform_serialize(unversioned)] +pub struct InvalidDocumentTypeNameError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + name: String, +} + +impl InvalidDocumentTypeNameError { + pub fn new(name: String) -> Self { + Self { name } + } + + pub fn name(&self) -> &str { + &self.name + } +} + +impl From for ConsensusError { + fn from(err: InvalidDocumentTypeNameError) -> Self { + Self::BasicError(BasicError::InvalidDocumentTypeNameError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_required_security_level.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_required_security_level.rs new file mode 100644 index 00000000000..dae65b27284 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_required_security_level.rs @@ -0,0 +1,60 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::identity::SecurityLevel; + +use bincode::{Decode, Encode}; +use platform_value::Identifier; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Invalid document type security level error security level: got {security_level:?} for {contract_id}::{document_type_name}")] +#[platform_serialize(unversioned)] +pub struct InvalidDocumentTypeRequiredSecurityLevelError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + security_level: SecurityLevel, + contract_id: Identifier, + document_type_name: String, +} + +impl InvalidDocumentTypeRequiredSecurityLevelError { + pub fn new( + security_level: SecurityLevel, + contract_id: Identifier, + document_type_name: String, + ) -> Self { + Self { + security_level, + contract_id, + document_type_name, + } + } + + pub fn security_level(&self) -> SecurityLevel { + self.security_level + } + + pub fn contract_id(&self) -> Identifier { + self.contract_id + } + + pub fn document_type_name(&self) -> &String { + &self.document_type_name + } +} + +impl From for ConsensusError { + fn from(err: InvalidDocumentTypeRequiredSecurityLevelError) -> Self { + Self::BasicError(BasicError::InvalidDocumentTypeRequiredSecurityLevelError( + err, + )) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs index 8c76d586b50..9e7bedab0d9 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs @@ -1,26 +1,39 @@ +mod contested_unique_index_on_mutable_document_type_error; +mod contested_unique_index_with_unique_index_error; mod data_contract_have_new_unique_index_error; mod data_contract_immutable_properties_update_error; mod data_contract_invalid_index_definition_update_error; pub mod data_contract_max_depth_exceed_error; mod data_contract_unique_indices_changed_error; +mod document_types_are_missing_error; mod duplicate_index_error; mod duplicate_index_name_error; mod incompatible_data_contract_schema_error; +mod incompatible_document_type_schema_error; mod incompatible_re2_pattern_error; mod invalid_compound_index_error; mod invalid_data_contract_id_error; mod invalid_data_contract_version_error; +mod invalid_document_type_name_error; +mod invalid_document_type_required_security_level; mod invalid_index_property_type_error; mod invalid_indexed_property_constraint_error; +#[cfg(feature = "json-schema-validation")] mod invalid_json_schema_ref_error; mod system_property_index_already_present_error; mod undefined_index_property_error; mod unique_indices_limit_reached_error; +mod unknown_document_creation_restriction_mode_error; +mod unknown_security_level_error; +mod unknown_storage_key_requirements_error; +mod unknown_trade_mode_error; +mod unknown_transferable_type_error; pub use data_contract_have_new_unique_index_error::*; pub use data_contract_immutable_properties_update_error::*; pub use data_contract_invalid_index_definition_update_error::*; pub use data_contract_unique_indices_changed_error::*; +pub use document_types_are_missing_error::*; pub use duplicate_index_error::*; pub use duplicate_index_name_error::*; pub use incompatible_data_contract_schema_error::*; @@ -28,10 +41,22 @@ pub use incompatible_re2_pattern_error::*; pub use invalid_compound_index_error::*; pub use invalid_data_contract_id_error::*; pub use invalid_data_contract_version_error::*; +pub use invalid_document_type_required_security_level::*; pub use invalid_index_property_type_error::*; pub use invalid_indexed_property_constraint_error::*; +#[cfg(feature = "json-schema-validation")] pub use invalid_json_schema_ref_error::*; -pub use invalid_json_schema_ref_error::*; + pub use system_property_index_already_present_error::*; pub use undefined_index_property_error::*; pub use unique_indices_limit_reached_error::*; + +pub use contested_unique_index_on_mutable_document_type_error::*; +pub use contested_unique_index_with_unique_index_error::*; +pub use incompatible_document_type_schema_error::*; +pub use invalid_document_type_name_error::*; +pub use unknown_document_creation_restriction_mode_error::*; +pub use unknown_security_level_error::*; +pub use unknown_storage_key_requirements_error::*; +pub use unknown_trade_mode_error::*; +pub use unknown_transferable_type_error::*; diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unique_indices_limit_reached_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unique_indices_limit_reached_error.rs index 9e538deaf4c..e136354d260 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unique_indices_limit_reached_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unique_indices_limit_reached_error.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("'{document_type}' document has more than '{index_limit}' unique indexes")] +#[error("'{document_type}' document has more than '{index_limit}' unique indexes (contested is {is_contested_limit})")] #[platform_serialize(unversioned)] pub struct UniqueIndicesLimitReachedError { /* @@ -17,23 +17,29 @@ pub struct UniqueIndicesLimitReachedError { */ document_type: String, - index_limit: usize, + index_limit: u16, + is_contested_limit: bool, } impl UniqueIndicesLimitReachedError { - pub fn new(document_type: String, index_limit: usize) -> Self { + pub fn new(document_type: String, index_limit: u16, is_contested_limit: bool) -> Self { Self { document_type, index_limit, + is_contested_limit, } } pub fn document_type(&self) -> &str { &self.document_type } - pub fn index_limit(&self) -> usize { + pub fn index_limit(&self) -> u16 { self.index_limit } + + pub fn is_contested_limit(&self) -> bool { + self.is_contested_limit + } } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_document_creation_restriction_mode_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_document_creation_restriction_mode_error.rs new file mode 100644 index 00000000000..2d55df7e397 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_document_creation_restriction_mode_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized document creation restriction mode: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownDocumentCreationRestrictionModeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownDocumentCreationRestrictionModeError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownDocumentCreationRestrictionModeError) -> Self { + Self::BasicError(BasicError::UnknownDocumentCreationRestrictionModeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_security_level_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_security_level_error.rs new file mode 100644 index 00000000000..325c5641106 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_security_level_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized security level: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownSecurityLevelError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownSecurityLevelError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownSecurityLevelError) -> Self { + Self::BasicError(BasicError::UnknownSecurityLevelError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_storage_key_requirements_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_storage_key_requirements_error.rs new file mode 100644 index 00000000000..82d00e70371 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_storage_key_requirements_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized storage key requirements: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownStorageKeyRequirementsError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: i128, +} + +impl UnknownStorageKeyRequirementsError { + pub fn new(allowed_values: Vec, received: i128) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> i128 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownStorageKeyRequirementsError) -> Self { + Self::BasicError(BasicError::UnknownStorageKeyRequirementsError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_trade_mode_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_trade_mode_error.rs new file mode 100644 index 00000000000..bbf57f33351 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_trade_mode_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized trade mode: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownTradeModeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownTradeModeError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownTradeModeError) -> Self { + Self::BasicError(BasicError::UnknownTradeModeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_transferable_type_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_transferable_type_error.rs new file mode 100644 index 00000000000..0ed1a89d4cf --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_transferable_type_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized transferable type: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownTransferableTypeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownTransferableTypeError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownTransferableTypeError) -> Self { + Self::BasicError(BasicError::UnknownTransferableTypeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/decode/decoding_error.rs b/packages/rs-dpp/src/errors/consensus/basic/decode/decoding_error.rs new file mode 100644 index 00000000000..6f3bb18e9f2 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/decode/decoding_error.rs @@ -0,0 +1,46 @@ +use crate::consensus::basic::BasicError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::consensus::ConsensusError; +use crate::data_contract::errors::DataContractError; +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Decoding error: {error}")] +#[platform_serialize(unversioned)] +pub struct DecodingError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + error: String, +} + +impl DecodingError { + pub fn new(error: String) -> Self { + Self { error } + } + + pub fn error(&self) -> &str { + &self.error + } +} + +impl From for ConsensusError { + fn from(err: DecodingError) -> Self { + Self::BasicError(BasicError::ContractError( + DataContractError::DecodingContractError(err), + )) + } +} + +impl From for DataContractError { + fn from(err: DecodingError) -> Self { + Self::DecodingContractError(err) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs index 115329f17ce..68796ee211e 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs @@ -1,7 +1,9 @@ +mod decoding_error; mod protocol_version_parsing_error; mod serialized_object_parsing_error; mod version_error; +pub use decoding_error::*; pub use protocol_version_parsing_error::*; pub use serialized_object_parsing_error::*; pub use version_error::*; diff --git a/packages/rs-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs b/packages/rs-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs index fdf2d879ba1..c64e379c0ba 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs @@ -6,7 +6,9 @@ use thiserror::Error; use crate::consensus::ConsensusError; use bincode::{Decode, Encode}; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("Can't read protocol version from serialized object: {parsing_error}")] #[platform_serialize(unversioned)] pub struct ProtocolVersionParsingError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs b/packages/rs-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs index c93e1e44394..c415b41e939 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs @@ -5,7 +5,9 @@ use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use thiserror::Error; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("Parsing of serialized object failed due to: {parsing_error}")] #[platform_serialize(unversioned)] pub struct SerializedObjectParsingError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/decode/version_error.rs b/packages/rs-dpp/src/errors/consensus/basic/decode/version_error.rs index f5429f5739a..013204d5ded 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/decode/version_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/decode/version_error.rs @@ -6,7 +6,9 @@ use thiserror::Error; use crate::consensus::ConsensusError; use bincode::{Decode, Encode}; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("Can't read protocol version from serialized object: {error}")] #[platform_serialize(unversioned)] pub struct VersionError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/document_creation_not_allowed_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/document_creation_not_allowed_error.rs new file mode 100644 index 00000000000..5ad1732dddc --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/document/document_creation_not_allowed_error.rs @@ -0,0 +1,58 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Document Creation on {data_contract_id}:{document_type_name} is not allowed because of the document type's creation restriction mode {creation_restriction_mode}")] +#[platform_serialize(unversioned)] +pub struct DocumentCreationNotAllowedError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + data_contract_id: Identifier, + + document_type_name: String, + + creation_restriction_mode: CreationRestrictionMode, +} + +impl DocumentCreationNotAllowedError { + pub fn new( + data_contract_id: Identifier, + document_type_name: String, + creation_restriction_mode: CreationRestrictionMode, + ) -> Self { + Self { + data_contract_id, + document_type_name, + creation_restriction_mode, + } + } + + pub fn data_contract_id(&self) -> Identifier { + self.data_contract_id + } + + pub fn document_type_name(&self) -> &str { + self.document_type_name.as_str() + } + + pub fn creation_restriction_mode(&self) -> CreationRestrictionMode { + self.creation_restriction_mode + } +} + +impl From for ConsensusError { + fn from(err: DocumentCreationNotAllowedError) -> Self { + Self::BasicError(BasicError::DocumentCreationNotAllowedError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/document_field_max_size_exceeded_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/document_field_max_size_exceeded_error.rs new file mode 100644 index 00000000000..358d7fd3987 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/document/document_field_max_size_exceeded_error.rs @@ -0,0 +1,51 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Document field {field} size {actual_size_bytes} is more than system maximum {max_size_bytes}" +)] +#[platform_serialize(unversioned)] +pub struct DocumentFieldMaxSizeExceededError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + field: String, + actual_size_bytes: u64, + max_size_bytes: u64, +} + +impl DocumentFieldMaxSizeExceededError { + pub fn new(field: String, actual_size_bytes: u64, max_size_bytes: u64) -> Self { + Self { + field, + actual_size_bytes, + max_size_bytes, + } + } + + pub fn field(&self) -> &str { + self.field.as_str() + } + + pub fn actual_size_bytes(&self) -> u64 { + self.actual_size_bytes + } + pub fn max_size_bytes(&self) -> u64 { + self.max_size_bytes + } +} + +impl From for ConsensusError { + fn from(err: DocumentFieldMaxSizeExceededError) -> Self { + Self::BasicError(BasicError::DocumentFieldMaxSizeExceededError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs index 932c01d4c48..854a530cb31 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs @@ -13,6 +13,12 @@ use thiserror::Error; #[platform_serialize(unversioned)] pub struct DocumentTransitionsAreAbsentError {} +impl Default for DocumentTransitionsAreAbsentError { + fn default() -> Self { + Self::new() + } +} + impl DocumentTransitionsAreAbsentError { pub fn new() -> Self { Self {} diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs new file mode 100644 index 00000000000..54eee70ff2c --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs @@ -0,0 +1,37 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::prelude::IdentityNonce; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Nonce is out of bounds: {}", nonce)] +#[platform_serialize(unversioned)] +pub struct NonceOutOfBoundsError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + nonce: IdentityNonce, +} + +impl NonceOutOfBoundsError { + pub fn new(nonce: IdentityNonce) -> Self { + Self { nonce } + } + + pub fn identity_contract_nonce(&self) -> IdentityNonce { + self.nonce + } +} + +impl From for ConsensusError { + fn from(err: NonceOutOfBoundsError) -> Self { + Self::BasicError(BasicError::NonceOutOfBoundsError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs index 8ebd8681547..549ae5d3fc6 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs @@ -17,15 +17,15 @@ pub struct MaxDocumentsTransitionsExceededError { DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION */ - max_transitions: u32, + max_transitions: u16, } impl MaxDocumentsTransitionsExceededError { - pub fn new(max_transitions: u32) -> Self { + pub fn new(max_transitions: u16) -> Self { Self { max_transitions } } - pub fn max_transitions(&self) -> u32 { + pub fn max_transitions(&self) -> u16 { self.max_transitions } } diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/missing_positions_in_document_type_properties_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/missing_positions_in_document_type_properties_error.rs index 0df9154b64d..ff520b8ffb6 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/document/missing_positions_in_document_type_properties_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/document/missing_positions_in_document_type_properties_error.rs @@ -19,7 +19,10 @@ use platform_value::Identifier; PlatformSerialize, PlatformDeserialize, )] -#[error("missing position is not present for updated document type")] +#[error( + "position field is not present for document type \"{}\"", + document_type_name +)] #[platform_serialize(unversioned)] pub struct MissingPositionsInDocumentTypePropertiesError { /* diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs index 97346e5b0ac..2297cea2092 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs @@ -1,7 +1,10 @@ mod data_contract_not_present_error; +mod document_creation_not_allowed_error; +mod document_field_max_size_exceeded_error; mod document_transitions_are_absent_error; mod duplicate_document_transitions_with_ids_error; mod duplicate_document_transitions_with_indices_error; +mod identity_contract_nonce_out_of_bounds_error; mod inconsistent_compound_index_data_error; mod invalid_document_transition_action_error; mod invalid_document_transition_id_error; @@ -14,9 +17,12 @@ mod missing_document_type_error; mod missing_positions_in_document_type_properties_error; pub use data_contract_not_present_error::*; +pub use document_creation_not_allowed_error::*; +pub use document_field_max_size_exceeded_error::*; pub use document_transitions_are_absent_error::*; pub use duplicate_document_transitions_with_ids_error::*; pub use duplicate_document_transitions_with_indices_error::*; +pub use identity_contract_nonce_out_of_bounds_error::*; pub use inconsistent_compound_index_data_error::*; pub use invalid_document_transition_action_error::*; pub use invalid_document_transition_id_error::*; diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/disabling_key_id_also_being_added_in_same_transition_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/disabling_key_id_also_being_added_in_same_transition_error.rs new file mode 100644 index 00000000000..4d37c1e4e70 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/disabling_key_id_also_being_added_in_same_transition_error.rs @@ -0,0 +1,36 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::identity::KeyID; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Disabling a key with id {key_id:?} that is being added in same state transition")] +#[platform_serialize(unversioned)] +pub struct DisablingKeyIdAlsoBeingAddedInSameTransitionError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + key_id: KeyID, +} + +impl DisablingKeyIdAlsoBeingAddedInSameTransitionError { + pub fn new(key_id: KeyID) -> Self { + Self { key_id } + } + + pub fn key_id(&self) -> KeyID { + self.key_id + } +} +impl From for ConsensusError { + fn from(err: DisablingKeyIdAlsoBeingAddedInSameTransitionError) -> Self { + Self::BasicError(BasicError::DisablingKeyIdAlsoBeingAddedInSameTransitionError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs new file mode 100644 index 00000000000..8c1e8ab9401 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs @@ -0,0 +1,56 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use dashcore::Txid; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Bytes32; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Asset lock transaction {transaction_id} is trying to be replayed and will be discarded")] +#[platform_serialize(unversioned)] +pub struct IdentityAssetLockStateTransitionReplayError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + #[platform_serialize(with_serde)] + #[bincode(with_serde)] + transaction_id: Txid, + + output_index: usize, + + state_transition_id: Bytes32, +} + +impl IdentityAssetLockStateTransitionReplayError { + pub fn new(transaction_id: Txid, output_index: usize, state_transition_id: Bytes32) -> Self { + Self { + transaction_id, + output_index, + state_transition_id, + } + } + + pub fn transaction_id(&self) -> Txid { + self.transaction_id + } + + pub fn state_transition_id(&self) -> Bytes32 { + self.state_transition_id + } + + pub fn output_index(&self) -> usize { + self.output_index + } +} + +impl From for ConsensusError { + fn from(err: IdentityAssetLockStateTransitionReplayError) -> Self { + Self::BasicError(BasicError::IdentityAssetLockStateTransitionReplayError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_consumed_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_consumed_error.rs new file mode 100644 index 00000000000..250d2fc72cc --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_consumed_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use dashcore::Txid; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Asset lock transaction {transaction_id} output {output_index} already completely used")] +#[platform_serialize(unversioned)] +pub struct IdentityAssetLockTransactionOutPointAlreadyConsumedError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + #[platform_serialize(with_serde)] + #[bincode(with_serde)] + transaction_id: Txid, + output_index: usize, +} + +impl IdentityAssetLockTransactionOutPointAlreadyConsumedError { + pub fn new(transaction_id: Txid, output_index: usize) -> Self { + Self { + transaction_id, + output_index, + } + } + + pub fn output_index(&self) -> usize { + self.output_index + } + + pub fn transaction_id(&self) -> Txid { + self.transaction_id + } +} + +impl From for ConsensusError { + fn from(err: IdentityAssetLockTransactionOutPointAlreadyConsumedError) -> Self { + Self::BasicError(BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs deleted file mode 100644 index 31b149e0e1d..00000000000 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs +++ /dev/null @@ -1,47 +0,0 @@ -use crate::consensus::basic::BasicError; -use crate::consensus::ConsensusError; -use crate::errors::ProtocolError; -use bincode::{Decode, Encode}; -use dashcore::Txid; -use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use thiserror::Error; - -#[derive( - Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, -)] -#[error("Asset lock transaction {transaction_id} output {output_index} already used")] -#[platform_serialize(unversioned)] -pub struct IdentityAssetLockTransactionOutPointAlreadyExistsError { - /* - - DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION - - */ - #[platform_serialize(with_serde)] - #[bincode(with_serde)] - transaction_id: Txid, - output_index: usize, -} - -impl IdentityAssetLockTransactionOutPointAlreadyExistsError { - pub fn new(transaction_id: Txid, output_index: usize) -> Self { - Self { - transaction_id, - output_index, - } - } - - pub fn output_index(&self) -> usize { - self.output_index - } - - pub fn transaction_id(&self) -> Txid { - self.transaction_id - } -} - -impl From for ConsensusError { - fn from(err: IdentityAssetLockTransactionOutPointAlreadyExistsError) -> Self { - Self::BasicError(BasicError::IdentityAssetLockTransactionOutPointAlreadyExistsError(err)) - } -} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_not_enough_balance_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_not_enough_balance_error.rs new file mode 100644 index 00000000000..98db7c70539 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_not_enough_balance_error.rs @@ -0,0 +1,72 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::fee::Credits; +use bincode::{Decode, Encode}; +use dashcore::Txid; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Asset lock transaction {transaction_id} output {output_index} only has {credits_left} credits left out of {initial_asset_lock_credits} initial credits on the asset lock but needs {credits_required} credits to start processing")] +#[platform_serialize(unversioned)] +pub struct IdentityAssetLockTransactionOutPointNotEnoughBalanceError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + #[platform_serialize(with_serde)] + #[bincode(with_serde)] + transaction_id: Txid, + output_index: usize, + initial_asset_lock_credits: Credits, + credits_left: Credits, + credits_required: Credits, +} + +impl IdentityAssetLockTransactionOutPointNotEnoughBalanceError { + pub fn new( + transaction_id: Txid, + output_index: usize, + initial_asset_lock_credits: Credits, + credits_left: Credits, + credits_required: Credits, + ) -> Self { + Self { + transaction_id, + output_index, + initial_asset_lock_credits, + credits_left, + credits_required, + } + } + + pub fn output_index(&self) -> usize { + self.output_index + } + + pub fn transaction_id(&self) -> Txid { + self.transaction_id + } + + pub fn initial_asset_lock_credits(&self) -> Credits { + self.initial_asset_lock_credits + } + + pub fn credits_left(&self) -> Credits { + self.credits_left + } + + pub fn credits_required(&self) -> Credits { + self.credits_required + } +} + +impl From for ConsensusError { + fn from(err: IdentityAssetLockTransactionOutPointNotEnoughBalanceError) -> Self { + Self::BasicError(BasicError::IdentityAssetLockTransactionOutPointNotEnoughBalanceError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs index 758c9fa362b..344a55633df 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs @@ -6,7 +6,9 @@ use thiserror::Error; use bincode::{Decode, Encode}; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize, PartialEq, +)] #[error("Invalid asset lock transaction: {message}")] #[platform_serialize(unversioned)] pub struct InvalidIdentityAssetLockTransactionError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs index 357b3389fd5..2c3be767a38 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs @@ -10,7 +10,7 @@ use bincode::{Decode, Encode}; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Core fee per byte {core_fee_per_byte:?} must be part of fibonacci sequence")] +#[error("Core fee per byte {core_fee_per_byte:?} must be part of fibonacci sequence and not less than {min_core_fee_per_byte:?}")] #[platform_serialize(unversioned)] pub struct InvalidIdentityCreditWithdrawalTransitionCoreFeeError { /* @@ -19,16 +19,23 @@ pub struct InvalidIdentityCreditWithdrawalTransitionCoreFeeError { */ core_fee_per_byte: u32, + min_core_fee_per_byte: u32, } impl InvalidIdentityCreditWithdrawalTransitionCoreFeeError { - pub fn new(core_fee_per_byte: u32) -> Self { - Self { core_fee_per_byte } + pub fn new(core_fee_per_byte: u32, min_core_fee_per_byte: u32) -> Self { + Self { + core_fee_per_byte, + min_core_fee_per_byte, + } } pub fn core_fee_per_byte(&self) -> u32 { self.core_fee_per_byte } + pub fn min_core_fee_per_byte(&self) -> u32 { + self.min_core_fee_per_byte + } } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs index dc6fa9e9c82..81bff1d14a2 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs @@ -14,6 +14,12 @@ use bincode::{Decode, Encode}; #[platform_serialize(unversioned)] pub struct InvalidIdentityUpdateTransitionDisableKeysError; +impl Default for InvalidIdentityUpdateTransitionDisableKeysError { + fn default() -> Self { + Self::new() + } +} + impl InvalidIdentityUpdateTransitionDisableKeysError { pub fn new() -> Self { Self {} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs index a553800f600..03048789878 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs @@ -14,6 +14,12 @@ use bincode::{Decode, Encode}; #[platform_serialize(unversioned)] pub struct InvalidIdentityUpdateTransitionEmptyError; +impl Default for InvalidIdentityUpdateTransitionEmptyError { + fn default() -> Self { + Self::new() + } +} + impl InvalidIdentityUpdateTransitionEmptyError { pub fn new() -> Self { Self {} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs index 130349d16a8..8d72de7772b 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs @@ -18,7 +18,7 @@ use bincode::{Decode, Encode}; PlatformSerialize, PlatformDeserialize, )] -#[error("Invalid instant lock proof signature")] +#[error("Instant lock proof signature is invalid or wasn't created recently. Pleases try chain asset lock proof instead.")] #[platform_serialize(unversioned)] pub struct InvalidInstantAssetLockProofSignatureError; diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs index fc70b59971f..aafc111b859 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs @@ -1,9 +1,12 @@ pub use data_contract_bounds_not_present_error::*; +pub use disabling_key_id_also_being_added_in_same_transition_error::*; pub use duplicated_identity_public_key_basic_error::*; pub use duplicated_identity_public_key_id_basic_error::*; pub use identity_asset_lock_proof_locked_transaction_mismatch_error::*; +pub use identity_asset_lock_state_transition_replay_error::*; pub use identity_asset_lock_transaction_is_not_found_error::*; -pub use identity_asset_lock_transaction_out_point_already_exists_error::*; +pub use identity_asset_lock_transaction_out_point_already_consumed_error::*; +pub use identity_asset_lock_transaction_out_point_not_enough_balance_error::*; pub use identity_asset_lock_transaction_output_not_found_error::*; pub use identity_credit_transfer_to_self_error::*; pub use invalid_asset_lock_proof_core_chain_height_error::*; @@ -25,13 +28,18 @@ pub use invalid_instant_asset_lock_proof_error::*; pub use invalid_instant_asset_lock_proof_signature_error::*; pub use missing_master_public_key_error::*; pub use not_implemented_identity_credit_withdrawal_transition_pooling_error::*; +pub use too_many_master_public_key_error::*; mod data_contract_bounds_not_present_error; +mod disabling_key_id_also_being_added_in_same_transition_error; mod duplicated_identity_public_key_basic_error; mod duplicated_identity_public_key_id_basic_error; mod identity_asset_lock_proof_locked_transaction_mismatch_error; mod identity_asset_lock_transaction_is_not_found_error; -mod identity_asset_lock_transaction_out_point_already_exists_error; +mod identity_asset_lock_transaction_out_point_already_consumed_error; + +mod identity_asset_lock_state_transition_replay_error; +mod identity_asset_lock_transaction_out_point_not_enough_balance_error; mod identity_asset_lock_transaction_output_not_found_error; mod identity_credit_transfer_to_self_error; mod invalid_asset_lock_proof_core_chain_height_error; @@ -53,3 +61,4 @@ mod invalid_instant_asset_lock_proof_error; mod invalid_instant_asset_lock_proof_signature_error; mod missing_master_public_key_error; mod not_implemented_identity_credit_withdrawal_transition_pooling_error; +mod too_many_master_public_key_error; diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/too_many_master_public_key_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/too_many_master_public_key_error.rs new file mode 100644 index 00000000000..0b8bda2d2c0 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/too_many_master_public_key_error.rs @@ -0,0 +1,42 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use bincode::{Decode, Encode}; + +#[derive( + Error, + Debug, + Clone, + PartialEq, + Eq, + Default, + Encode, + Decode, + PlatformSerialize, + PlatformDeserialize, +)] +#[error( + "Identity is trying to be created with more than one master key. Please only use one master key." +)] +#[platform_serialize(unversioned)] +pub struct TooManyMasterPublicKeyError; + +/* + +DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + +*/ + +impl TooManyMasterPublicKeyError { + pub fn new() -> Self { + Self + } +} +impl From for ConsensusError { + fn from(err: TooManyMasterPublicKeyError) -> Self { + Self::BasicError(BasicError::TooManyMasterPublicKeyError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error.rs b/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error.rs index 5ea5ff2b006..143b4015b66 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error.rs @@ -9,7 +9,9 @@ use platform_value::Value; use serde_json::Value as JsonValue; use thiserror::Error; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("JsonSchemaError: {error_summary}, path: {instance_path}")] #[platform_serialize(unversioned)] pub struct JsonSchemaError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs b/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs index bceddf8afdd..127313acdee 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs @@ -142,7 +142,7 @@ impl<'a> From<&ValidationError<'a>> for JsonSchemaErrorData { keyword, params, property_name, - error_message, + error_message: _, } = JsonSchemaErrorData::from(error.deref()); builder @@ -176,6 +176,13 @@ impl<'a> From<&ValidationError<'a>> for JsonSchemaErrorData { .set_keyword("resolver") .add_param("url", url.to_string().into()) .build(), + ValidationErrorKind::Custom { message } => { + builder.set_error_message(message.to_owned()).build() + } + ValidationErrorKind::UnevaluatedProperties { unexpected } => builder + .set_keyword("unevaluatedProperties") + .add_param("unexpected", unexpected.clone().into()) + .build(), } } } diff --git a/packages/rs-dpp/src/errors/consensus/basic/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/mod.rs index 1c417e2ee85..b96be4629b0 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/mod.rs @@ -1,5 +1,6 @@ pub use basic_error::*; pub use incompatible_protocol_version_error::*; +pub use unsupported_feature_error::*; pub use unsupported_protocol_version_error::*; pub use unsupported_version_error::*; @@ -12,8 +13,12 @@ pub mod unsupported_protocol_version_error; pub mod basic_error; pub mod invalid_identifier_error; +#[cfg(feature = "json-schema-validation")] pub mod json_schema_compilation_error; +#[cfg(feature = "json-schema-validation")] pub mod json_schema_error; +pub mod overflow_error; pub mod state_transition; +pub mod unsupported_feature_error; pub mod unsupported_version_error; pub mod value_error; diff --git a/packages/rs-dpp/src/errors/consensus/basic/overflow_error.rs b/packages/rs-dpp/src/errors/consensus/basic/overflow_error.rs new file mode 100644 index 00000000000..9d478a9123b --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/overflow_error.rs @@ -0,0 +1,35 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Overflow error")] +#[platform_serialize(unversioned)] +pub struct OverflowError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + message: String, +} + +impl OverflowError { + pub fn new(message: String) -> Self { + Self { message } + } + + pub fn message(&self) -> &str { + self.message.as_str() + } +} +impl From for ConsensusError { + fn from(err: OverflowError) -> Self { + Self::BasicError(BasicError::OverflowError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs b/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs index 8de34c07cd8..8d33a1999d1 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("State transition size {actual_size_kbytes} KB is more than maximum {max_size_kbytes} KB")] +#[error("State transition size {actual_size_bytes} is more than maximum {max_size_bytes}")] #[platform_serialize(unversioned)] pub struct StateTransitionMaxSizeExceededError { /* @@ -16,23 +16,23 @@ pub struct StateTransitionMaxSizeExceededError { DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION */ - actual_size_kbytes: usize, - max_size_kbytes: usize, + actual_size_bytes: u64, + max_size_bytes: u64, } impl StateTransitionMaxSizeExceededError { - pub fn new(actual_size_kbytes: usize, max_size_kbytes: usize) -> Self { + pub fn new(actual_size_bytes: u64, max_size_bytes: u64) -> Self { Self { - actual_size_kbytes, - max_size_kbytes, + actual_size_bytes, + max_size_bytes, } } - pub fn actual_size_kbytes(&self) -> usize { - self.actual_size_kbytes + pub fn actual_size_bytes(&self) -> u64 { + self.actual_size_bytes } - pub fn max_size_kbytes(&self) -> usize { - self.max_size_kbytes + pub fn max_size_bytes(&self) -> u64 { + self.max_size_bytes } } diff --git a/packages/rs-dpp/src/errors/consensus/basic/unsupported_feature_error.rs b/packages/rs-dpp/src/errors/consensus/basic/unsupported_feature_error.rs new file mode 100644 index 00000000000..40c7dc217b7 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/unsupported_feature_error.rs @@ -0,0 +1,45 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; + +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("feature {feature_name} is not supported in version {current_protocol_version}")] +#[platform_serialize(unversioned)] +pub struct UnsupportedFeatureError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + feature_name: String, + current_protocol_version: u32, +} + +impl UnsupportedFeatureError { + pub fn new(feature_name: String, current_protocol_version: u32) -> Self { + Self { + feature_name, + current_protocol_version, + } + } + + pub fn feature(&self) -> &String { + &self.feature_name + } + + pub fn current_protocol_version(&self) -> u32 { + self.current_protocol_version + } +} + +impl From for ConsensusError { + fn from(err: UnsupportedFeatureError) -> Self { + Self::BasicError(BasicError::UnsupportedFeatureError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs b/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs index a7e258e6c96..9021c8df0e3 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs @@ -3,8 +3,7 @@ use crate::consensus::ConsensusError; use crate::errors::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use platform_value::Value; -use std::convert::TryFrom; + use thiserror::Error; #[derive( diff --git a/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs b/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs index fe6f447eb3e..cba93d0a35c 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs @@ -3,8 +3,7 @@ use crate::consensus::ConsensusError; use crate::errors::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use platform_value::Value; -use std::convert::TryFrom; + use thiserror::Error; #[derive( diff --git a/packages/rs-dpp/src/errors/consensus/basic/value_error.rs b/packages/rs-dpp/src/errors/consensus/basic/value_error.rs index ce787a06d7c..83f1b85cdb5 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/value_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/value_error.rs @@ -1,6 +1,6 @@ use crate::consensus::basic::BasicError; use crate::consensus::ConsensusError; -use crate::errors::ProtocolError; +use crate::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use platform_value::Error as PlatformValueError; @@ -27,6 +27,10 @@ impl ValueError { } } + pub fn new_from_string(value_error: String) -> Self { + Self { value_error } + } + pub fn value_error(&self) -> &str { &self.value_error } @@ -36,3 +40,9 @@ impl From for ConsensusError { Self::BasicError(BasicError::ValueError(err)) } } + +impl From for ValueError { + fn from(err: PlatformValueError) -> Self { + ValueError::new(err) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/codes.rs b/packages/rs-dpp/src/errors/consensus/codes.rs index ea032c311bc..2d6cd6ddadb 100644 --- a/packages/rs-dpp/src/errors/consensus/codes.rs +++ b/packages/rs-dpp/src/errors/consensus/codes.rs @@ -1,6 +1,7 @@ use crate::consensus::signature::SignatureError; #[cfg(feature = "state-transition-validation")] use crate::consensus::state::data_trigger::DataTriggerError; +use crate::data_contract::errors::DataContractError; use crate::errors::consensus::{ basic::BasicError, fee::fee_error::FeeError, state::state_error::StateError, ConsensusError, @@ -25,95 +26,140 @@ impl ErrorWithCode for ConsensusError { } } } - impl ErrorWithCode for BasicError { fn code(&self) -> u32 { match self { - // Versioning - Self::UnsupportedVersionError(_) => 1100, - // Decoding - Self::ProtocolVersionParsingError { .. } => 1000, - Self::SerializedObjectParsingError { .. } => 1001, - Self::UnsupportedProtocolVersionError(_) => 1002, - Self::IncompatibleProtocolVersionError(_) => 1003, - Self::VersionError(_) => 1004, - - // Structure error - Self::JsonSchemaCompilationError(..) => 1004, - Self::JsonSchemaError(_) => 1005, - Self::InvalidIdentifierError { .. } => 1006, - Self::ValueError(_) => 1060, - - // DataContract - Self::DataContractMaxDepthExceedError { .. } => 1007, - Self::DuplicateIndexError { .. } => 1008, - Self::IncompatibleRe2PatternError { .. } => 1009, - Self::InvalidCompoundIndexError { .. } => 1010, - Self::InvalidDataContractIdError { .. } => 1011, - Self::InvalidIndexedPropertyConstraintError { .. } => 1012, - Self::InvalidIndexPropertyTypeError { .. } => 1013, - Self::InvalidJsonSchemaRefError { .. } => 1014, - Self::SystemPropertyIndexAlreadyPresentError { .. } => 1015, - Self::UndefinedIndexPropertyError { .. } => 1016, - Self::UniqueIndicesLimitReachedError { .. } => 1017, - Self::DuplicateIndexNameError { .. } => 1048, - Self::InvalidDataContractVersionError { .. } => 1050, - Self::IncompatibleDataContractSchemaError { .. } => 1051, - Self::DataContractImmutablePropertiesUpdateError { .. } => 1052, - Self::DataContractUniqueIndicesChangedError { .. } => 1053, - Self::DataContractInvalidIndexDefinitionUpdateError { .. } => 1054, - Self::DataContractHaveNewUniqueIndexError { .. } => 1055, - - // Document - Self::DataContractNotPresentError { .. } => 1018, - Self::DuplicateDocumentTransitionsWithIdsError { .. } => 1019, - Self::DuplicateDocumentTransitionsWithIndicesError { .. } => 1020, - Self::InconsistentCompoundIndexDataError { .. } => 1021, - Self::InvalidDocumentTransitionActionError { .. } => 1022, - Self::InvalidDocumentTransitionIdError { .. } => 1023, - Self::InvalidDocumentTypeError { .. } => 1024, - Self::MissingDataContractIdBasicError { .. } => 1025, - Self::MissingDocumentTransitionActionError { .. } => 1026, - Self::MissingDocumentTransitionTypeError { .. } => 1027, - Self::MissingDocumentTypeError { .. } => 1028, - Self::MissingPositionsInDocumentTypePropertiesError { .. } => 1067, - Self::MaxDocumentsTransitionsExceededError { .. } => 1065, - Self::DocumentTransitionsAreAbsentError { .. } => 1068, - - // Identity - Self::DuplicatedIdentityPublicKeyBasicError(_) => 1029, - Self::DuplicatedIdentityPublicKeyIdBasicError(_) => 1030, - Self::IdentityAssetLockProofLockedTransactionMismatchError(_) => 1031, - Self::IdentityAssetLockTransactionIsNotFoundError(_) => 1032, - Self::IdentityAssetLockTransactionOutPointAlreadyExistsError(_) => 1033, - Self::IdentityAssetLockTransactionOutputNotFoundError(_) => 1034, - Self::InvalidAssetLockProofCoreChainHeightError(_) => 1035, - Self::InvalidAssetLockProofTransactionHeightError(_) => 1036, - Self::InvalidAssetLockTransactionOutputReturnSizeError(_) => 1037, - Self::InvalidIdentityAssetLockTransactionError(_) => 1038, - Self::InvalidIdentityAssetLockTransactionOutputError(_) => 1039, - Self::InvalidIdentityPublicKeyDataError(_) => 1040, - Self::InvalidInstantAssetLockProofError(_) => 1041, - Self::InvalidInstantAssetLockProofSignatureError(_) => 1042, - Self::InvalidIdentityAssetLockProofChainLockValidationError(_) => 1043, - Self::DataContractBoundsNotPresentError(_) => 1066, - - Self::MissingMasterPublicKeyError(_) => 1046, - Self::InvalidIdentityPublicKeySecurityLevelError(_) => 1047, - Self::InvalidIdentityKeySignatureError { .. } => 1056, - Self::InvalidIdentityCreditWithdrawalTransitionOutputScriptError(_) => 1057, - Self::InvalidIdentityCreditWithdrawalTransitionCoreFeeError(_) => 1058, - Self::NotImplementedIdentityCreditWithdrawalTransitionPoolingError(_) => 1059, - Self::InvalidIdentityCreditTransferAmountError(_) => 1061, - Self::InvalidIdentityCreditWithdrawalTransitionAmountError(_) => 1062, - Self::InvalidIdentityUpdateTransitionEmptyError(_) => 1063, - Self::InvalidIdentityUpdateTransitionDisableKeysError(_) => 1064, - Self::IdentityCreditTransferToSelfError(_) => 1070, - - // State Transition - Self::InvalidStateTransitionTypeError { .. } => 1043, - Self::MissingStateTransitionTypeError { .. } => 1044, - Self::StateTransitionMaxSizeExceededError { .. } => 1045, + // Versioning Errors: 10000-10099 + Self::UnsupportedVersionError(_) => 10000, + Self::ProtocolVersionParsingError { .. } => 10001, + Self::SerializedObjectParsingError { .. } => 10002, + Self::UnsupportedProtocolVersionError(_) => 10003, + Self::IncompatibleProtocolVersionError(_) => 10004, + Self::VersionError(_) => 10005, + Self::UnsupportedFeatureError(_) => 10006, + + // Structure Errors: 10100-10199 + #[cfg(feature = "json-schema-validation")] + Self::JsonSchemaCompilationError(..) => 10100, + #[cfg(feature = "json-schema-validation")] + Self::JsonSchemaError(_) => 10101, + Self::InvalidIdentifierError { .. } => 10102, + Self::ValueError(_) => 10103, + + // DataContract Errors: 10200-10399 + Self::DataContractMaxDepthExceedError { .. } => 10200, + Self::DuplicateIndexError { .. } => 10201, + Self::IncompatibleRe2PatternError { .. } => 10202, + Self::InvalidCompoundIndexError { .. } => 10203, + Self::InvalidDataContractIdError { .. } => 10204, + Self::InvalidIndexedPropertyConstraintError { .. } => 10205, + Self::InvalidIndexPropertyTypeError { .. } => 10206, + #[cfg(feature = "json-schema-validation")] + Self::InvalidJsonSchemaRefError { .. } => 10207, + Self::SystemPropertyIndexAlreadyPresentError { .. } => 10208, + Self::UndefinedIndexPropertyError { .. } => 10209, + Self::UniqueIndicesLimitReachedError { .. } => 10210, + Self::DuplicateIndexNameError { .. } => 10211, + Self::InvalidDataContractVersionError { .. } => 10212, + Self::IncompatibleDataContractSchemaError { .. } => 10213, + Self::ContractError(DataContractError::DocumentTypesAreMissingError { .. }) => 10214, + Self::DataContractImmutablePropertiesUpdateError { .. } => 10215, + Self::DataContractUniqueIndicesChangedError { .. } => 10216, + Self::DataContractInvalidIndexDefinitionUpdateError { .. } => 10217, + Self::DataContractHaveNewUniqueIndexError { .. } => 10218, + Self::InvalidDocumentTypeRequiredSecurityLevelError { .. } => 10219, + Self::UnknownSecurityLevelError { .. } => 10220, + Self::UnknownStorageKeyRequirementsError { .. } => 10221, + Self::ContractError(DataContractError::DecodingContractError { .. }) => 10222, + Self::ContractError(DataContractError::DecodingDocumentError { .. }) => 10223, + Self::ContractError(DataContractError::InvalidDocumentTypeError { .. }) => 10224, + Self::ContractError(DataContractError::MissingRequiredKey(_)) => 10225, + Self::ContractError(DataContractError::FieldRequirementUnmet(_)) => 10226, + Self::ContractError(DataContractError::KeyWrongType(_)) => 10227, + Self::ContractError(DataContractError::ValueWrongType(_)) => 10228, + Self::ContractError(DataContractError::ValueDecodingError(_)) => 10229, + Self::ContractError(DataContractError::EncodingDataStructureNotSupported(_)) => 10230, + Self::ContractError(DataContractError::InvalidContractStructure(_)) => 10231, + Self::ContractError(DataContractError::DocumentTypeNotFound(_)) => 10232, + Self::ContractError(DataContractError::DocumentTypeFieldNotFound(_)) => 10233, + Self::ContractError(DataContractError::ReferenceDefinitionNotFound(_)) => 10234, + Self::ContractError(DataContractError::DocumentOwnerIdMissing(_)) => 10235, + Self::ContractError(DataContractError::DocumentIdMissing(_)) => 10236, + Self::ContractError(DataContractError::Unsupported(_)) => 10237, + Self::ContractError(DataContractError::CorruptedSerialization(_)) => 10238, + Self::ContractError(DataContractError::JsonSchema(_)) => 10239, + Self::ContractError(DataContractError::InvalidURI(_)) => 10240, + Self::ContractError(DataContractError::KeyWrongBounds(_)) => 10241, + Self::ContractError(DataContractError::KeyValueMustExist(_)) => 10242, + Self::UnknownTransferableTypeError { .. } => 10243, + Self::UnknownTradeModeError { .. } => 10244, + Self::UnknownDocumentCreationRestrictionModeError { .. } => 10245, + Self::IncompatibleDocumentTypeSchemaError { .. } => 10246, + Self::ContractError(DataContractError::RegexError(_)) => 10247, + Self::ContestedUniqueIndexOnMutableDocumentTypeError(_) => 10248, + Self::ContestedUniqueIndexWithUniqueIndexError(_) => 10249, + + // Document Errors: 10400-10499 + Self::DataContractNotPresentError { .. } => 10400, + Self::DuplicateDocumentTransitionsWithIdsError { .. } => 10401, + Self::DuplicateDocumentTransitionsWithIndicesError { .. } => 10402, + Self::InconsistentCompoundIndexDataError { .. } => 10403, + Self::InvalidDocumentTransitionActionError { .. } => 10404, + Self::InvalidDocumentTransitionIdError { .. } => 10405, + Self::InvalidDocumentTypeError { .. } => 10406, + Self::MissingDataContractIdBasicError { .. } => 10407, + Self::MissingDocumentTransitionActionError { .. } => 10408, + Self::MissingDocumentTransitionTypeError { .. } => 10409, + Self::MissingDocumentTypeError { .. } => 10410, + Self::MissingPositionsInDocumentTypePropertiesError { .. } => 10411, + Self::MaxDocumentsTransitionsExceededError { .. } => 10412, + Self::DocumentTransitionsAreAbsentError { .. } => 10413, + Self::NonceOutOfBoundsError(_) => 10414, + Self::InvalidDocumentTypeNameError(_) => 10415, + Self::DocumentCreationNotAllowedError(_) => 10416, + Self::DocumentFieldMaxSizeExceededError(_) => 10417, + + // Identity Errors: 10500-10599 + Self::DuplicatedIdentityPublicKeyBasicError(_) => 10500, + Self::DuplicatedIdentityPublicKeyIdBasicError(_) => 10501, + Self::IdentityAssetLockProofLockedTransactionMismatchError(_) => 10502, + Self::IdentityAssetLockTransactionIsNotFoundError(_) => 10503, + Self::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) => 10504, + Self::IdentityAssetLockTransactionOutputNotFoundError(_) => 10505, + Self::InvalidAssetLockProofCoreChainHeightError(_) => 10506, + Self::InvalidAssetLockProofTransactionHeightError(_) => 10507, + Self::InvalidAssetLockTransactionOutputReturnSizeError(_) => 10508, + Self::InvalidIdentityAssetLockTransactionError(_) => 10509, + Self::InvalidIdentityAssetLockTransactionOutputError(_) => 10510, + Self::InvalidIdentityPublicKeyDataError(_) => 10511, + Self::InvalidInstantAssetLockProofError(_) => 10512, + Self::InvalidInstantAssetLockProofSignatureError(_) => 10513, + Self::InvalidIdentityAssetLockProofChainLockValidationError(_) => 10514, + Self::DataContractBoundsNotPresentError(_) => 10515, + Self::DisablingKeyIdAlsoBeingAddedInSameTransitionError(_) => 10516, + Self::MissingMasterPublicKeyError(_) => 10517, + Self::TooManyMasterPublicKeyError(_) => 10518, + Self::InvalidIdentityPublicKeySecurityLevelError(_) => 10519, + Self::InvalidIdentityKeySignatureError { .. } => 10520, + Self::InvalidIdentityCreditWithdrawalTransitionOutputScriptError(_) => 10521, + Self::InvalidIdentityCreditWithdrawalTransitionCoreFeeError(_) => 10522, + Self::NotImplementedIdentityCreditWithdrawalTransitionPoolingError(_) => 10523, + Self::InvalidIdentityCreditTransferAmountError(_) => 10524, + Self::InvalidIdentityCreditWithdrawalTransitionAmountError(_) => 10525, + Self::InvalidIdentityUpdateTransitionEmptyError(_) => 10526, + Self::InvalidIdentityUpdateTransitionDisableKeysError(_) => 10527, + Self::IdentityCreditTransferToSelfError(_) => 10528, + Self::MasterPublicKeyUpdateError(_) => 10529, + Self::IdentityAssetLockTransactionOutPointNotEnoughBalanceError(_) => 10530, + Self::IdentityAssetLockStateTransitionReplayError(_) => 10531, + + // State Transition Errors: 10600-10699 + Self::InvalidStateTransitionTypeError { .. } => 10600, + Self::MissingStateTransitionTypeError { .. } => 10601, + Self::StateTransitionMaxSizeExceededError { .. } => 10602, + + // General Errors 10700-10799 + Self::OverflowError(_) => 10700, } } } @@ -121,17 +167,18 @@ impl ErrorWithCode for BasicError { impl ErrorWithCode for SignatureError { fn code(&self) -> u32 { match self { - Self::IdentityNotFoundError { .. } => 2000, - Self::InvalidIdentityPublicKeyTypeError { .. } => 2001, - Self::InvalidStateTransitionSignatureError { .. } => 2002, - Self::MissingPublicKeyError { .. } => 2003, - Self::InvalidSignaturePublicKeySecurityLevelError { .. } => 2004, - Self::WrongPublicKeyPurposeError { .. } => 2005, - Self::PublicKeyIsDisabledError { .. } => 2006, - Self::PublicKeySecurityLevelNotMetError { .. } => 2007, - Self::SignatureShouldNotBePresentError(_) => 2008, - Self::BasicECDSAError(_) => 2009, - Self::BasicBLSError(_) => 2010, + Self::IdentityNotFoundError { .. } => 20000, + Self::InvalidIdentityPublicKeyTypeError { .. } => 20001, + Self::InvalidStateTransitionSignatureError { .. } => 20002, + Self::MissingPublicKeyError { .. } => 20003, + Self::InvalidSignaturePublicKeySecurityLevelError { .. } => 20004, + Self::WrongPublicKeyPurposeError { .. } => 20005, + Self::PublicKeyIsDisabledError { .. } => 20006, + Self::PublicKeySecurityLevelNotMetError { .. } => 20007, + Self::SignatureShouldNotBePresentError(_) => 20008, + Self::BasicECDSAError(_) => 20009, + Self::BasicBLSError(_) => 20010, + Self::InvalidSignaturePublicKeyPurposeError(_) => 20011, } } } @@ -139,7 +186,7 @@ impl ErrorWithCode for SignatureError { impl ErrorWithCode for FeeError { fn code(&self) -> u32 { match self { - Self::BalanceIsNotEnoughError { .. } => 3000, + Self::BalanceIsNotEnoughError { .. } => 30000, } } } @@ -147,36 +194,58 @@ impl ErrorWithCode for FeeError { impl ErrorWithCode for StateError { fn code(&self) -> u32 { match self { - // Data contract - Self::DataContractAlreadyPresentError { .. } => 4000, - Self::DataContractIsReadonlyError { .. } => 4026, - #[cfg(feature = "validation")] + // Data contract Errors: 40000-40099 + Self::DataContractAlreadyPresentError { .. } => 40000, + Self::DataContractIsReadonlyError { .. } => 40001, + Self::DataContractConfigUpdateError { .. } => 40002, + + // Document Errors: 40100-40199 + Self::DocumentAlreadyPresentError { .. } => 40100, + Self::DocumentNotFoundError { .. } => 40101, + Self::DocumentOwnerIdMismatchError { .. } => 40102, + Self::DocumentTimestampsMismatchError { .. } => 40103, + Self::DocumentTimestampWindowViolationError { .. } => 40104, + Self::DuplicateUniqueIndexError { .. } => 40105, + Self::InvalidDocumentRevisionError { .. } => 40106, + Self::DocumentTimestampsAreEqualError(_) => 40107, + Self::DocumentNotForSaleError(_) => 40108, + Self::DocumentIncorrectPurchasePriceError(_) => 40109, + Self::DocumentContestCurrentlyLockedError(_) => 40110, + Self::DocumentContestNotJoinableError(_) => 40111, + Self::DocumentContestIdentityAlreadyContestantError(_) => 40112, + + // Identity Errors: 40200-40299 + Self::IdentityAlreadyExistsError(_) => 40200, + Self::IdentityPublicKeyIsReadOnlyError { .. } => 40201, + Self::InvalidIdentityPublicKeyIdError { .. } => 40202, + Self::InvalidIdentityRevisionError { .. } => 40203, + Self::InvalidIdentityNonceError(_) => 40204, + Self::MaxIdentityPublicKeyLimitReachedError { .. } => 40205, + Self::DuplicatedIdentityPublicKeyStateError { .. } => 40206, + Self::DuplicatedIdentityPublicKeyIdStateError { .. } => 40207, + Self::IdentityPublicKeyIsDisabledError { .. } => 40208, + Self::MissingIdentityPublicKeyIdsError { .. } => 40209, + Self::IdentityInsufficientBalanceError(_) => 40210, + Self::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError(_) => 40211, + Self::DocumentTypeUpdateError(_) => 40212, + Self::DataContractUpdatePermissionError(_) => 40213, + + // Voting Errors: 40300-40399 + Self::MasternodeNotFoundError(_) => 40300, + Self::VotePollNotFoundError(_) => 40301, + Self::VotePollNotAvailableForVotingError(_) => 40302, + Self::MasternodeVotedTooManyTimesError(_) => 40303, + Self::MasternodeVoteAlreadyPresentError(_) => 40304, + Self::MasternodeIncorrectVotingAddressError(_) => 40305, + Self::MasternodeIncorrectVoterIdentityIdError(_) => 40306, + + // Prefunded specialized balances Errors: 40400-40499 + Self::PrefundedSpecializedBalanceInsufficientError(_) => 40400, + Self::PrefundedSpecializedBalanceNotFoundError(_) => 40401, + + // Data trigger errors: 40500-40799 + #[cfg(feature = "state-transition-validation")] Self::DataTriggerError(ref e) => e.code(), - Self::DataContractConfigUpdateError { .. } => 4027, - - // Document - Self::DocumentAlreadyPresentError { .. } => 4004, - Self::DocumentNotFoundError { .. } => 4005, - Self::DocumentOwnerIdMismatchError { .. } => 4006, - Self::DocumentTimestampsMismatchError { .. } => 4007, - Self::DocumentTimestampWindowViolationError { .. } => 4008, - Self::DuplicateUniqueIndexError { .. } => 4009, - Self::InvalidDocumentRevisionError { .. } => 4010, - Self::DocumentTimestampsAreEqualError(_) => 4025, - - // Identity - Self::IdentityAlreadyExistsError(_) => 4011, - Self::IdentityPublicKeyDisabledAtWindowViolationError { .. } => 4012, - Self::IdentityPublicKeyIsReadOnlyError { .. } => 4017, - Self::InvalidIdentityPublicKeyIdError { .. } => 4018, - Self::InvalidIdentityRevisionError { .. } => 4019, - Self::MaxIdentityPublicKeyLimitReachedError { .. } => 4020, - Self::DuplicatedIdentityPublicKeyStateError { .. } => 4021, - Self::DuplicatedIdentityPublicKeyIdStateError { .. } => 4022, - Self::IdentityPublicKeyIsDisabledError { .. } => 4023, - Self::MissingIdentityPublicKeyIdsError { .. } => 4024, - Self::IdentityInsufficientBalanceError(_) => 4026, - Self::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError(_) => 4027, } } } @@ -185,9 +254,9 @@ impl ErrorWithCode for StateError { impl ErrorWithCode for DataTriggerError { fn code(&self) -> u32 { match self { - Self::DataTriggerConditionError { .. } => 4001, - Self::DataTriggerExecutionError { .. } => 4002, - Self::DataTriggerInvalidResultError { .. } => 4003, + Self::DataTriggerConditionError { .. } => 40500, + Self::DataTriggerExecutionError { .. } => 40501, + Self::DataTriggerInvalidResultError { .. } => 40502, } } } diff --git a/packages/rs-dpp/src/errors/consensus/consensus_error.rs b/packages/rs-dpp/src/errors/consensus/consensus_error.rs index 6966825408e..72d41d4aa3d 100644 --- a/packages/rs-dpp/src/errors/consensus/consensus_error.rs +++ b/packages/rs-dpp/src/errors/consensus/consensus_error.rs @@ -2,7 +2,6 @@ use crate::errors::ProtocolError; use bincode; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use thiserror::Error; use crate::consensus::state::state_error::StateError; @@ -16,7 +15,16 @@ use crate::errors::consensus::basic::BasicError; // TODO It must be versioned as all other serializable types -#[derive(Error, Debug, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone)] +#[derive( + thiserror::Error, + Debug, + Encode, + Decode, + PlatformSerialize, + PlatformDeserialize, + Clone, + PartialEq, +)] #[platform_serialize(limit = 2000)] #[error(transparent)] pub enum ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/fee/fee_error.rs b/packages/rs-dpp/src/errors/consensus/fee/fee_error.rs index ad853b4bc78..cc19ca60f2f 100644 --- a/packages/rs-dpp/src/errors/consensus/fee/fee_error.rs +++ b/packages/rs-dpp/src/errors/consensus/fee/fee_error.rs @@ -6,7 +6,9 @@ use thiserror::Error; use crate::errors::ProtocolError; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -#[derive(Error, Debug, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone)] +#[derive( + Error, Debug, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone, +)] pub enum FeeError { /* diff --git a/packages/rs-dpp/src/errors/consensus/signature/invalid_signature_public_key_purpose_error.rs b/packages/rs-dpp/src/errors/consensus/signature/invalid_signature_public_key_purpose_error.rs new file mode 100644 index 00000000000..55a05964394 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/signature/invalid_signature_public_key_purpose_error.rs @@ -0,0 +1,47 @@ +use thiserror::Error; + +use crate::consensus::signature::signature_error::SignatureError; +use crate::consensus::ConsensusError; +use crate::identity::Purpose; + +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; + +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Invalid public key purpose {public_key_purpose}. The state transition requires {allowed_key_purpose}")] +#[platform_serialize(unversioned)] +pub struct InvalidSignaturePublicKeyPurposeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + public_key_purpose: Purpose, + allowed_key_purpose: Purpose, +} + +impl InvalidSignaturePublicKeyPurposeError { + pub fn new(public_key_purpose: Purpose, allowed_key_purpose: Purpose) -> Self { + Self { + public_key_purpose, + allowed_key_purpose, + } + } + + pub fn public_key_purpose(&self) -> Purpose { + self.public_key_purpose + } + pub fn allowed_key_purpose(&self) -> Purpose { + self.allowed_key_purpose + } +} + +impl From for ConsensusError { + fn from(err: InvalidSignaturePublicKeyPurposeError) -> Self { + Self::SignatureError(SignatureError::InvalidSignaturePublicKeyPurposeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/signature/invalid_state_transition_signature_error.rs b/packages/rs-dpp/src/errors/consensus/signature/invalid_state_transition_signature_error.rs index c4641067165..4c179a63f3d 100644 --- a/packages/rs-dpp/src/errors/consensus/signature/invalid_state_transition_signature_error.rs +++ b/packages/rs-dpp/src/errors/consensus/signature/invalid_state_transition_signature_error.rs @@ -19,7 +19,9 @@ use thiserror::Error; )] #[error("Invalid State Transition signature")] #[platform_serialize(unversioned)] -pub struct InvalidStateTransitionSignatureError; +pub struct InvalidStateTransitionSignatureError { + message: String, +} /* @@ -28,8 +30,12 @@ DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION */ impl InvalidStateTransitionSignatureError { - pub fn new() -> Self { - Self + pub fn new(message: String) -> Self { + Self { message } + } + + pub fn message(&self) -> &String { + &self.message } } diff --git a/packages/rs-dpp/src/errors/consensus/signature/mod.rs b/packages/rs-dpp/src/errors/consensus/signature/mod.rs index 37be8d8a872..46c0b6282af 100644 --- a/packages/rs-dpp/src/errors/consensus/signature/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/signature/mod.rs @@ -2,6 +2,7 @@ mod basic_bls_error; mod basic_ecdsa_error; mod identity_not_found_error; mod invalid_identity_public_key_type_error; +mod invalid_signature_public_key_purpose_error; mod invalid_signature_public_key_security_level_error; mod invalid_state_transition_signature_error; mod missing_public_key_error; @@ -15,6 +16,7 @@ pub use crate::consensus::signature::basic_bls_error::BasicBLSError; pub use crate::consensus::signature::basic_ecdsa_error::BasicECDSAError; pub use crate::consensus::signature::identity_not_found_error::IdentityNotFoundError; pub use crate::consensus::signature::invalid_identity_public_key_type_error::InvalidIdentityPublicKeyTypeError; +pub use crate::consensus::signature::invalid_signature_public_key_purpose_error::InvalidSignaturePublicKeyPurposeError; pub use crate::consensus::signature::invalid_signature_public_key_security_level_error::InvalidSignaturePublicKeySecurityLevelError; pub use crate::consensus::signature::invalid_state_transition_signature_error::InvalidStateTransitionSignatureError; pub use crate::consensus::signature::missing_public_key_error::MissingPublicKeyError; diff --git a/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs b/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs index af4047782d3..f4d9811f099 100644 --- a/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs +++ b/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs @@ -8,10 +8,13 @@ use crate::consensus::ConsensusError; use bincode::{Decode, Encode}; use thiserror::Error; +use crate::consensus::signature::invalid_signature_public_key_purpose_error::InvalidSignaturePublicKeyPurposeError; use crate::errors::ProtocolError; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -#[derive(Error, Debug, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone)] +#[derive( + Error, Debug, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone, +)] pub enum SignatureError { /* @@ -30,6 +33,9 @@ pub enum SignatureError { #[error(transparent)] MissingPublicKeyError(MissingPublicKeyError), + #[error(transparent)] + InvalidSignaturePublicKeyPurposeError(InvalidSignaturePublicKeyPurposeError), + #[error(transparent)] InvalidSignaturePublicKeySecurityLevelError(InvalidSignaturePublicKeySecurityLevelError), diff --git a/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs b/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs index 6b4c4ddb28c..501cf0d64b4 100644 --- a/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs +++ b/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs @@ -46,7 +46,10 @@ impl From for ConsensusError { } } -#[cfg(all(feature = "state-transitions", feature = "validation"))] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] // This is a separate error of the same name, but from ProtocolError impl From for ConsensusError { fn from(value: crate::state_transition::errors::WrongPublicKeyPurposeError) -> Self { diff --git a/packages/rs-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs b/packages/rs-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs new file mode 100644 index 00000000000..73cafe6de32 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs @@ -0,0 +1,46 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Identity {identity_id} doesn't have permissions to update Data Contract {data_contract_id}" +)] +#[platform_serialize(unversioned)] +pub struct DataContractUpdatePermissionError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + data_contract_id: Identifier, + identity_id: Identifier, +} + +impl DataContractUpdatePermissionError { + pub fn new(data_contract_id: Identifier, identity_id: Identifier) -> Self { + Self { + data_contract_id, + identity_id, + } + } + + pub fn data_contract_id(&self) -> &Identifier { + &self.data_contract_id + } + pub fn identity_id(&self) -> &Identifier { + &self.identity_id + } +} + +impl From for ConsensusError { + fn from(err: DataContractUpdatePermissionError) -> Self { + Self::StateError(StateError::DataContractUpdatePermissionError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/data_contract/document_type_update_error.rs b/packages/rs-dpp/src/errors/consensus/state/data_contract/document_type_update_error.rs new file mode 100644 index 00000000000..a18c21f0c71 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/data_contract/document_type_update_error.rs @@ -0,0 +1,56 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Can't update Document Type {data_contract_id}::{document_type_name}: {additional_message}" +)] +#[platform_serialize(unversioned)] +pub struct DocumentTypeUpdateError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + data_contract_id: Identifier, + document_type_name: String, + additional_message: String, +} + +impl DocumentTypeUpdateError { + pub fn new( + data_contract_id: Identifier, + document_type_name: impl Into, + additional_message: impl Into, + ) -> Self { + Self { + data_contract_id, + document_type_name: document_type_name.into(), + additional_message: additional_message.into(), + } + } + + pub fn data_contract_id(&self) -> &Identifier { + &self.data_contract_id + } + + pub fn document_type_name(&self) -> &String { + &self.document_type_name + } + pub fn additional_message(&self) -> &str { + &self.additional_message + } +} + +impl From for ConsensusError { + fn from(err: DocumentTypeUpdateError) -> Self { + Self::StateError(StateError::DocumentTypeUpdateError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs b/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs index fe67475ed89..563596603d6 100644 --- a/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs @@ -1,3 +1,5 @@ pub mod data_contract_already_present_error; pub mod data_contract_config_update_error; pub mod data_contract_is_readonly_error; +pub mod data_contract_update_permission_error; +pub mod document_type_update_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_condition_error.rs b/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_condition_error.rs index 16130f396d1..9f0c216588e 100644 --- a/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_condition_error.rs +++ b/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_condition_error.rs @@ -8,7 +8,9 @@ use thiserror::Error; use crate::consensus::state::data_trigger::DataTriggerError; use bincode::{Decode, Encode}; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("{message}")] #[platform_serialize(unversioned)] pub struct DataTriggerConditionError { diff --git a/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_execution_error.rs b/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_execution_error.rs index 3268926edf9..f8bc1b46cf2 100644 --- a/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_execution_error.rs +++ b/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_execution_error.rs @@ -8,7 +8,9 @@ use thiserror::Error; use crate::consensus::state::data_trigger::DataTriggerError; use bincode::{Decode, Encode}; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("{message}")] #[platform_serialize(unversioned)] pub struct DataTriggerExecutionError { diff --git a/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_invalid_result_error.rs b/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_invalid_result_error.rs index 97ecc5fd5b6..35f06d3ff93 100644 --- a/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_invalid_result_error.rs +++ b/packages/rs-dpp/src/errors/consensus/state/data_trigger/data_trigger_invalid_result_error.rs @@ -8,7 +8,9 @@ use thiserror::Error; use crate::consensus::state::data_trigger::DataTriggerError; use bincode::{Decode, Encode}; -#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] #[error("Data trigger have not returned any result")] #[platform_serialize(unversioned)] pub struct DataTriggerInvalidResultError { diff --git a/packages/rs-dpp/src/errors/consensus/state/data_trigger/mod.rs b/packages/rs-dpp/src/errors/consensus/state/data_trigger/mod.rs index cd61d89b7cc..a753c9ccd62 100644 --- a/packages/rs-dpp/src/errors/consensus/state/data_trigger/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/data_trigger/mod.rs @@ -12,7 +12,9 @@ pub mod data_trigger_condition_error; pub mod data_trigger_execution_error; pub mod data_trigger_invalid_result_error; -#[derive(Error, Debug, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone)] +#[derive( + Error, Debug, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone, +)] pub enum DataTriggerError { /* diff --git a/packages/rs-dpp/src/errors/consensus/state/document/document_contest_currently_locked_error.rs b/packages/rs-dpp/src/errors/consensus/state/document/document_contest_currently_locked_error.rs new file mode 100644 index 00000000000..289d21a357a --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/document/document_contest_currently_locked_error.rs @@ -0,0 +1,55 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use crate::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Document Contest for vote_poll {vote_poll} is currently already locked {stored_info}, unlocking is possible by paying {unlock_cost} credits")] +#[platform_serialize(unversioned)] +pub struct DocumentContestCurrentlyLockedError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + vote_poll: ContestedDocumentResourceVotePoll, + stored_info: ContestedDocumentVotePollStoredInfo, + unlock_cost: u64, +} + +impl DocumentContestCurrentlyLockedError { + pub fn new( + vote_poll: ContestedDocumentResourceVotePoll, + stored_info: ContestedDocumentVotePollStoredInfo, + unlock_cost: u64, + ) -> Self { + Self { + vote_poll, + stored_info, + unlock_cost, + } + } + + pub fn vote_poll(&self) -> &ContestedDocumentResourceVotePoll { + &self.vote_poll + } + pub fn stored_info(&self) -> &ContestedDocumentVotePollStoredInfo { + &self.stored_info + } + + pub fn unlock_cost(&self) -> u64 { + self.unlock_cost + } +} + +impl From for ConsensusError { + fn from(err: DocumentContestCurrentlyLockedError) -> Self { + Self::StateError(StateError::DocumentContestCurrentlyLockedError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/document/document_contest_identity_already_contestant.rs b/packages/rs-dpp/src/errors/consensus/state/document/document_contest_identity_already_contestant.rs new file mode 100644 index 00000000000..1f2cf0a14dc --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/document/document_contest_identity_already_contestant.rs @@ -0,0 +1,49 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "An Identity with the id {identity_id} is already a contestant for the vote_poll {vote_poll}" +)] +#[platform_serialize(unversioned)] +pub struct DocumentContestIdentityAlreadyContestantError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + vote_poll: ContestedDocumentResourceVotePoll, + identity_id: Identifier, +} + +impl DocumentContestIdentityAlreadyContestantError { + pub fn new(vote_poll: ContestedDocumentResourceVotePoll, identity_id: Identifier) -> Self { + Self { + vote_poll, + identity_id, + } + } + + pub fn vote_poll(&self) -> &ContestedDocumentResourceVotePoll { + &self.vote_poll + } + pub fn identity_id(&self) -> &Identifier { + &self.identity_id + } +} + +impl From for ConsensusError { + fn from(err: DocumentContestIdentityAlreadyContestantError) -> Self { + Self::StateError(StateError::DocumentContestIdentityAlreadyContestantError( + err, + )) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/document/document_contest_not_joinable_error.rs b/packages/rs-dpp/src/errors/consensus/state/document/document_contest_not_joinable_error.rs new file mode 100644 index 00000000000..01abd52d675 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/document/document_contest_not_joinable_error.rs @@ -0,0 +1,70 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::prelude::TimestampMillis; +use crate::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use crate::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Document Contest for vote_poll {vote_poll} is not joinable {stored_info}, it started {start_time} and it is now {current_time}, and you can only join for {joinable_time}")] +#[platform_serialize(unversioned)] +pub struct DocumentContestNotJoinableError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + vote_poll: ContestedDocumentResourceVotePoll, + stored_info: ContestedDocumentVotePollStoredInfo, + start_time: TimestampMillis, + current_time: TimestampMillis, + joinable_time: TimestampMillis, +} + +impl DocumentContestNotJoinableError { + pub fn new( + vote_poll: ContestedDocumentResourceVotePoll, + stored_info: ContestedDocumentVotePollStoredInfo, + start_time: TimestampMillis, + current_time: TimestampMillis, + joinable_time: TimestampMillis, + ) -> Self { + Self { + vote_poll, + stored_info, + start_time, + current_time, + joinable_time, + } + } + + pub fn vote_poll(&self) -> &ContestedDocumentResourceVotePoll { + &self.vote_poll + } + pub fn stored_info(&self) -> &ContestedDocumentVotePollStoredInfo { + &self.stored_info + } + + pub fn start_time(&self) -> TimestampMillis { + self.start_time + } + + pub fn current_time(&self) -> TimestampMillis { + self.current_time + } + + pub fn joinable_time(&self) -> TimestampMillis { + self.joinable_time + } +} + +impl From for ConsensusError { + fn from(err: DocumentContestNotJoinableError) -> Self { + Self::StateError(StateError::DocumentContestNotJoinableError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/document/document_incorrect_purchase_price_error.rs b/packages/rs-dpp/src/errors/consensus/state/document/document_incorrect_purchase_price_error.rs new file mode 100644 index 00000000000..5e726c5cbef --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/document/document_incorrect_purchase_price_error.rs @@ -0,0 +1,58 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::fee::Credits; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("{document_id} document can not be purchased for {trying_to_purchase_at_price}, it's sale price is {actual_price} (in credits)")] +#[platform_serialize(unversioned)] +pub struct DocumentIncorrectPurchasePriceError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + document_id: Identifier, + + trying_to_purchase_at_price: Credits, + + actual_price: Credits, +} + +impl DocumentIncorrectPurchasePriceError { + pub fn new( + document_id: Identifier, + trying_to_purchase_at_price: Credits, + actual_price: Credits, + ) -> Self { + Self { + document_id, + trying_to_purchase_at_price, + actual_price, + } + } + + pub fn document_id(&self) -> &Identifier { + &self.document_id + } + + pub fn trying_to_purchase_at_price(&self) -> Credits { + self.trying_to_purchase_at_price + } + + pub fn actual_price(&self) -> Credits { + self.actual_price + } +} + +impl From for ConsensusError { + fn from(err: DocumentIncorrectPurchasePriceError) -> Self { + Self::StateError(StateError::DocumentIncorrectPurchasePriceError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/document/document_not_for_sale_error.rs b/packages/rs-dpp/src/errors/consensus/state/document/document_not_for_sale_error.rs new file mode 100644 index 00000000000..1304477355f --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/document/document_not_for_sale_error.rs @@ -0,0 +1,37 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("{document_id} document not for sale")] +#[platform_serialize(unversioned)] +pub struct DocumentNotForSaleError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + document_id: Identifier, +} + +impl DocumentNotForSaleError { + pub fn new(document_id: Identifier) -> Self { + Self { document_id } + } + + pub fn document_id(&self) -> &Identifier { + &self.document_id + } +} + +impl From for ConsensusError { + fn from(err: DocumentNotForSaleError) -> Self { + Self::StateError(StateError::DocumentNotForSaleError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/document/mod.rs b/packages/rs-dpp/src/errors/consensus/state/document/mod.rs index 2469345323f..9a3071065e4 100644 --- a/packages/rs-dpp/src/errors/consensus/state/document/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/document/mod.rs @@ -1,4 +1,9 @@ pub mod document_already_present_error; +pub mod document_contest_currently_locked_error; +pub mod document_contest_identity_already_contestant; +pub mod document_contest_not_joinable_error; +pub mod document_incorrect_purchase_price_error; +pub mod document_not_for_sale_error; pub mod document_not_found_error; pub mod document_owner_id_mismatch_error; pub mod document_timestamp_window_violation_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs b/packages/rs-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs deleted file mode 100644 index 772a5a123f2..00000000000 --- a/packages/rs-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs +++ /dev/null @@ -1,50 +0,0 @@ -use crate::consensus::state::state_error::StateError; -use crate::consensus::ConsensusError; -use crate::errors::ProtocolError; -use bincode::{Decode, Encode}; -use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use thiserror::Error; - -#[derive( - Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, -)] -#[error("Identity public keys disabled time ({disabled_at}) is out of block time window from {time_window_start} and {time_window_end}")] -#[platform_serialize(unversioned)] -pub struct IdentityPublicKeyDisabledAtWindowViolationError { - /* - - DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION - - */ - disabled_at: u64, - time_window_start: u64, - time_window_end: u64, -} - -impl IdentityPublicKeyDisabledAtWindowViolationError { - pub fn new(disabled_at: u64, time_window_start: u64, time_window_end: u64) -> Self { - Self { - disabled_at, - time_window_start, - time_window_end, - } - } - - pub fn disabled_at(&self) -> u64 { - self.disabled_at - } - - pub fn time_window_start(&self) -> u64 { - self.time_window_start - } - pub fn time_window_end(&self) -> u64 { - self.time_window_end - } -} -impl From for ConsensusError { - fn from(err: IdentityPublicKeyDisabledAtWindowViolationError) -> Self { - Self::StateError(StateError::IdentityPublicKeyDisabledAtWindowViolationError( - err, - )) - } -} diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs b/packages/rs-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs new file mode 100644 index 00000000000..39bbbfaaaf5 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs @@ -0,0 +1,76 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; // needed for PlatformDeserialize and PlatformSerialize +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use std::fmt::{Display, Formatter}; +use thiserror::Error; + +use crate::prelude::{Identifier, IdentityNonce}; + +use crate::identity::identity_nonce::MergeIdentityNonceResult; +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[platform_serialize(unversioned)] +pub struct InvalidIdentityNonceError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pub identity_id: Identifier, + pub current_identity_nonce: Option, + pub setting_identity_nonce: IdentityNonce, + pub error: MergeIdentityNonceResult, +} +impl Display for InvalidIdentityNonceError { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + // Pre-calculate the `current_identity_contract_nonce` value + let current_nonce = self + .current_identity_nonce + .as_ref() + .unwrap_or(&Default::default()) // Assuming `IdentityContractNonce` implements `Default` + .to_string(); // Assuming `IdentityContractNonce` implements `ToString` or has a similar method for representation + + // Format the error message with pre-calculated `current_nonce` + write!(f, "Identity {} is trying to set an invalid identity nonce. The current identity nonce is {}, we are setting {}, error is {}", self.identity_id, current_nonce, self.setting_identity_nonce, self.error) + } +} + +impl InvalidIdentityNonceError { + pub fn new( + identity_id: Identifier, + current_identity_contract_nonce: Option, + setting_identity_contract_nonce: IdentityNonce, + error: MergeIdentityNonceResult, + ) -> Self { + Self { + identity_id, + current_identity_nonce: current_identity_contract_nonce, + setting_identity_nonce: setting_identity_contract_nonce, + error, + } + } + + pub fn identity_id(&self) -> &Identifier { + &self.identity_id + } + pub fn current_identity_contract_nonce(&self) -> Option<&IdentityNonce> { + self.current_identity_nonce.as_ref() + } + + pub fn setting_identity_contract_nonce(&self) -> &IdentityNonce { + &self.setting_identity_nonce + } + + pub fn error(&self) -> &MergeIdentityNonceResult { + &self.error + } +} +impl From for ConsensusError { + fn from(err: InvalidIdentityNonceError) -> Self { + Self::StateError(StateError::InvalidIdentityNonceError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/master_public_key_update_error.rs b/packages/rs-dpp/src/errors/consensus/state/identity/master_public_key_update_error.rs new file mode 100644 index 00000000000..bde78547a79 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/identity/master_public_key_update_error.rs @@ -0,0 +1,66 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use bincode::{Decode, Encode}; + +#[derive( + Error, + Debug, + Clone, + PartialEq, + Eq, + Default, + Encode, + Decode, + PlatformSerialize, + PlatformDeserialize, +)] +#[error("Failed to update the master public key: {description}. Ensure the operation is valid and permissible under current system rules.")] +#[platform_serialize(unversioned)] +pub struct MasterPublicKeyUpdateError { + adding: usize, + removing: usize, + description: String, +} + +/* + +DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + +*/ + +impl MasterPublicKeyUpdateError { + pub fn new(adding: usize, removing: usize) -> Self { + let description = match (adding, removing) { + (1, _) => "Attempt to add a new master key is not allowed unless one is being disabled" + .to_string(), + (0, _) => "Removing a master key without adding one is not allowed".to_string(), + (_, 1) | (_, 0) => "Attempt to add more than one master key is not allowed".to_string(), + (adding, removing) => format!( + "Attempting to add {adding} master keys while removing {removing} master keys" + ), + }; + + Self { + adding, + removing, + description, + } + } + + pub fn adding(&self) -> usize { + self.adding + } + + pub fn removing(&self) -> usize { + self.removing + } +} +impl From for ConsensusError { + fn from(err: MasterPublicKeyUpdateError) -> Self { + Self::BasicError(BasicError::MasterPublicKeyUpdateError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs b/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs index 01ec04bb52a..53a60d0ed4c 100644 --- a/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs @@ -6,10 +6,11 @@ pub mod duplicated_identity_public_key_state_error; mod identity_already_exists_error; mod identity_insufficient_balance_error; pub mod identity_public_key_already_exists_for_unique_contract_bounds_error; -pub mod identity_public_key_disabled_at_window_violation_error; pub mod identity_public_key_is_disabled_error; pub mod identity_public_key_is_read_only_error; +pub mod invalid_identity_contract_nonce_error; pub mod invalid_identity_public_key_id_error; pub mod invalid_identity_revision_error; +pub mod master_public_key_update_error; pub mod max_identity_public_key_limit_reached_error; pub mod missing_identity_public_key_ids_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/mod.rs b/packages/rs-dpp/src/errors/consensus/state/mod.rs index bd83045b71a..118ca4b10c0 100644 --- a/packages/rs-dpp/src/errors/consensus/state/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/mod.rs @@ -3,4 +3,6 @@ pub mod data_contract; pub mod data_trigger; pub mod document; pub mod identity; +pub mod prefunded_specialized_balances; pub mod state_error; +pub mod voting; diff --git a/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/mod.rs b/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/mod.rs new file mode 100644 index 00000000000..fd640dd7ac5 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/mod.rs @@ -0,0 +1,2 @@ +pub mod prefunded_specialized_balance_insufficient_error; +pub mod prefunded_specialized_balance_not_found_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/prefunded_specialized_balance_insufficient_error.rs b/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/prefunded_specialized_balance_insufficient_error.rs new file mode 100644 index 00000000000..05bbb113249 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/prefunded_specialized_balance_insufficient_error.rs @@ -0,0 +1,56 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::prelude::Identifier; + +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Insufficient specialized balance {balance_id} balance {balance} required {required_balance}" +)] +#[platform_serialize(unversioned)] +pub struct PrefundedSpecializedBalanceInsufficientError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pub balance_id: Identifier, + pub balance: u64, + pub required_balance: u64, +} + +impl PrefundedSpecializedBalanceInsufficientError { + pub fn new(balance_id: Identifier, balance: u64, required_balance: u64) -> Self { + Self { + balance_id, + balance, + required_balance, + } + } + + pub fn balance_id(&self) -> &Identifier { + &self.balance_id + } + + pub fn balance(&self) -> u64 { + self.balance + } + + pub fn required_balance(&self) -> u64 { + self.required_balance + } +} +impl From for ConsensusError { + fn from(err: PrefundedSpecializedBalanceInsufficientError) -> Self { + Self::StateError(StateError::PrefundedSpecializedBalanceInsufficientError( + err, + )) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/prefunded_specialized_balance_not_found_error.rs b/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/prefunded_specialized_balance_not_found_error.rs new file mode 100644 index 00000000000..bf8f4bc1002 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/prefunded_specialized_balances/prefunded_specialized_balance_not_found_error.rs @@ -0,0 +1,38 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::prelude::Identifier; + +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Did not find a specialized balance with id: {balance_id}")] +#[platform_serialize(unversioned)] +pub struct PrefundedSpecializedBalanceNotFoundError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pub balance_id: Identifier, +} + +impl PrefundedSpecializedBalanceNotFoundError { + pub fn new(balance_id: Identifier) -> Self { + Self { balance_id } + } + + pub fn balance_id(&self) -> &Identifier { + &self.balance_id + } +} +impl From for ConsensusError { + fn from(err: PrefundedSpecializedBalanceNotFoundError) -> Self { + Self::StateError(StateError::PrefundedSpecializedBalanceNotFoundError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/state_error.rs b/packages/rs-dpp/src/errors/consensus/state/state_error.rs index 4098b85042d..cf5736fd88d 100644 --- a/packages/rs-dpp/src/errors/consensus/state/state_error.rs +++ b/packages/rs-dpp/src/errors/consensus/state/state_error.rs @@ -17,7 +17,6 @@ use crate::consensus::state::document::duplicate_unique_index_error::DuplicateUn use crate::consensus::state::document::invalid_document_revision_error::InvalidDocumentRevisionError; use crate::consensus::state::identity::duplicated_identity_public_key_id_state_error::DuplicatedIdentityPublicKeyIdStateError; use crate::consensus::state::identity::duplicated_identity_public_key_state_error::DuplicatedIdentityPublicKeyStateError; -use crate::consensus::state::identity::identity_public_key_disabled_at_window_violation_error::IdentityPublicKeyDisabledAtWindowViolationError; use crate::consensus::state::identity::identity_public_key_is_disabled_error::IdentityPublicKeyIsDisabledError; use crate::consensus::state::identity::identity_public_key_is_read_only_error::IdentityPublicKeyIsReadOnlyError; use crate::consensus::state::identity::invalid_identity_public_key_id_error::InvalidIdentityPublicKeyIdError; @@ -28,11 +27,30 @@ use crate::consensus::state::identity::{ IdentityAlreadyExistsError, IdentityInsufficientBalanceError, }; use crate::consensus::ConsensusError; +use crate::consensus::state::data_contract::data_contract_update_permission_error::DataContractUpdatePermissionError; +use crate::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError; +use crate::consensus::state::document::document_contest_currently_locked_error::DocumentContestCurrentlyLockedError; +use crate::consensus::state::document::document_contest_identity_already_contestant::DocumentContestIdentityAlreadyContestantError; +use crate::consensus::state::document::document_contest_not_joinable_error::DocumentContestNotJoinableError; +use crate::consensus::state::document::document_incorrect_purchase_price_error::DocumentIncorrectPurchasePriceError; +use crate::consensus::state::document::document_not_for_sale_error::DocumentNotForSaleError; use crate::consensus::state::identity::identity_public_key_already_exists_for_unique_contract_bounds_error::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError; +use crate::consensus::state::identity::invalid_identity_contract_nonce_error::InvalidIdentityNonceError; +use crate::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_insufficient_error::PrefundedSpecializedBalanceInsufficientError; +use crate::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError; +use crate::consensus::state::voting::masternode_incorrect_voter_identity_id_error::MasternodeIncorrectVoterIdentityIdError; +use crate::consensus::state::voting::masternode_incorrect_voting_address_error::MasternodeIncorrectVotingAddressError; +use crate::consensus::state::voting::masternode_not_found_error::MasternodeNotFoundError; +use crate::consensus::state::voting::masternode_vote_already_present_error::MasternodeVoteAlreadyPresentError; +use crate::consensus::state::voting::masternode_voted_too_many_times::MasternodeVotedTooManyTimesError; +use crate::consensus::state::voting::vote_poll_not_available_for_voting_error::VotePollNotAvailableForVotingError; +use crate::consensus::state::voting::vote_poll_not_found_error::VotePollNotFoundError; use super::document::document_timestamps_are_equal_error::DocumentTimestampsAreEqualError; -#[derive(Error, Debug, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone)] +#[derive( + Error, Debug, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone, +)] pub enum StateError { /* @@ -51,9 +69,24 @@ pub enum StateError { #[error(transparent)] DocumentAlreadyPresentError(DocumentAlreadyPresentError), + #[error(transparent)] + DocumentContestCurrentlyLockedError(DocumentContestCurrentlyLockedError), + + #[error(transparent)] + DocumentContestNotJoinableError(DocumentContestNotJoinableError), + + #[error(transparent)] + DocumentContestIdentityAlreadyContestantError(DocumentContestIdentityAlreadyContestantError), + #[error(transparent)] DocumentNotFoundError(DocumentNotFoundError), + #[error(transparent)] + DocumentNotForSaleError(DocumentNotForSaleError), + + #[error(transparent)] + DocumentIncorrectPurchasePriceError(DocumentIncorrectPurchasePriceError), + #[error(transparent)] DocumentOwnerIdMismatchError(DocumentOwnerIdMismatchError), @@ -77,11 +110,6 @@ pub enum StateError { IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError, ), - #[error(transparent)] - IdentityPublicKeyDisabledAtWindowViolationError( - IdentityPublicKeyDisabledAtWindowViolationError, - ), - #[error(transparent)] IdentityPublicKeyIsReadOnlyError(IdentityPublicKeyIsReadOnlyError), @@ -94,6 +122,9 @@ pub enum StateError { #[error(transparent)] InvalidIdentityRevisionError(InvalidIdentityRevisionError), + #[error(transparent)] + InvalidIdentityNonceError(InvalidIdentityNonceError), + #[error(transparent)] MaxIdentityPublicKeyLimitReachedError(MaxIdentityPublicKeyLimitReachedError), @@ -117,6 +148,39 @@ pub enum StateError { #[error(transparent)] DataContractConfigUpdateError(DataContractConfigUpdateError), + + #[error(transparent)] + DocumentTypeUpdateError(DocumentTypeUpdateError), + + #[error(transparent)] + PrefundedSpecializedBalanceInsufficientError(PrefundedSpecializedBalanceInsufficientError), + + #[error(transparent)] + PrefundedSpecializedBalanceNotFoundError(PrefundedSpecializedBalanceNotFoundError), + + #[error(transparent)] + DataContractUpdatePermissionError(DataContractUpdatePermissionError), + + #[error(transparent)] + MasternodeNotFoundError(MasternodeNotFoundError), + + #[error(transparent)] + MasternodeIncorrectVoterIdentityIdError(MasternodeIncorrectVoterIdentityIdError), + + #[error(transparent)] + MasternodeIncorrectVotingAddressError(MasternodeIncorrectVotingAddressError), + + #[error(transparent)] + VotePollNotFoundError(VotePollNotFoundError), + + #[error(transparent)] + VotePollNotAvailableForVotingError(VotePollNotAvailableForVotingError), + + #[error(transparent)] + MasternodeVotedTooManyTimesError(MasternodeVotedTooManyTimesError), + + #[error(transparent)] + MasternodeVoteAlreadyPresentError(MasternodeVoteAlreadyPresentError), } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/masternode_incorrect_voter_identity_id_error.rs b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_incorrect_voter_identity_id_error.rs new file mode 100644 index 00000000000..4219e0df96c --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_incorrect_voter_identity_id_error.rs @@ -0,0 +1,57 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Masternode {pro_tx_hash} voter identity id is incorrect, expected is {expected_voter_identity_id}, provided is {provided_voter_identity_id}")] +#[platform_serialize(unversioned)] +pub struct MasternodeIncorrectVoterIdentityIdError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pro_tx_hash: Identifier, + + expected_voter_identity_id: Identifier, + + provided_voter_identity_id: Identifier, +} + +impl MasternodeIncorrectVoterIdentityIdError { + pub fn new( + pro_tx_hash: Identifier, + expected_voter_identity_id: Identifier, + provided_voter_identity_id: Identifier, + ) -> Self { + Self { + pro_tx_hash, + expected_voter_identity_id, + provided_voter_identity_id, + } + } + + pub fn pro_tx_hash(&self) -> Identifier { + self.pro_tx_hash + } + + pub fn expected_voter_identity_id(&self) -> Identifier { + self.expected_voter_identity_id + } + + pub fn provided_voter_identity_id(&self) -> Identifier { + self.provided_voter_identity_id + } +} + +impl From for ConsensusError { + fn from(err: MasternodeIncorrectVoterIdentityIdError) -> Self { + Self::StateError(StateError::MasternodeIncorrectVoterIdentityIdError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/masternode_incorrect_voting_address_error.rs b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_incorrect_voting_address_error.rs new file mode 100644 index 00000000000..5953eb86d39 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_incorrect_voting_address_error.rs @@ -0,0 +1,57 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::{Bytes20, Identifier}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Masternode {pro_tx_hash} voting address is incorrect, current is {current_voting_address}, given is {given_voting_address}")] +#[platform_serialize(unversioned)] +pub struct MasternodeIncorrectVotingAddressError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pro_tx_hash: Identifier, + + current_voting_address: Bytes20, + + given_voting_address: Bytes20, +} + +impl MasternodeIncorrectVotingAddressError { + pub fn new( + pro_tx_hash: Identifier, + current_voting_address: Bytes20, + given_voting_address: Bytes20, + ) -> Self { + Self { + pro_tx_hash, + current_voting_address, + given_voting_address, + } + } + + pub fn pro_tx_hash(&self) -> Identifier { + self.pro_tx_hash + } + + pub fn current_voting_address(&self) -> Bytes20 { + self.current_voting_address + } + + pub fn given_voting_address(&self) -> Bytes20 { + self.given_voting_address + } +} + +impl From for ConsensusError { + fn from(err: MasternodeIncorrectVotingAddressError) -> Self { + Self::StateError(StateError::MasternodeIncorrectVotingAddressError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/masternode_not_found_error.rs b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_not_found_error.rs new file mode 100644 index 00000000000..f004cfe79d4 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_not_found_error.rs @@ -0,0 +1,37 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Masternode {pro_tx_hash} not found")] +#[platform_serialize(unversioned)] +pub struct MasternodeNotFoundError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pro_tx_hash: Identifier, +} + +impl MasternodeNotFoundError { + pub fn new(pro_tx_hash: Identifier) -> Self { + Self { pro_tx_hash } + } + + pub fn pro_tx_hash(&self) -> Identifier { + self.pro_tx_hash + } +} + +impl From for ConsensusError { + fn from(err: MasternodeNotFoundError) -> Self { + Self::StateError(StateError::MasternodeNotFoundError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/masternode_vote_already_present_error.rs b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_vote_already_present_error.rs new file mode 100644 index 00000000000..7526eba2172 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_vote_already_present_error.rs @@ -0,0 +1,46 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::voting::vote_polls::VotePoll; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Masternode vote is already present for masternode {pro_tx_hash} voting for {vote_poll}")] +#[platform_serialize(unversioned)] +pub struct MasternodeVoteAlreadyPresentError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pro_tx_hash: Identifier, + vote_poll: VotePoll, +} + +impl MasternodeVoteAlreadyPresentError { + pub fn new(pro_tx_hash: Identifier, vote_poll: VotePoll) -> Self { + Self { + pro_tx_hash, + vote_poll, + } + } + + pub fn pro_tx_hash(&self) -> Identifier { + self.pro_tx_hash + } + + pub fn vote_poll(&self) -> &VotePoll { + &self.vote_poll + } +} + +impl From for ConsensusError { + fn from(err: MasternodeVoteAlreadyPresentError) -> Self { + Self::StateError(StateError::MasternodeVoteAlreadyPresentError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/masternode_voted_too_many_times.rs b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_voted_too_many_times.rs new file mode 100644 index 00000000000..d1b167320a2 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/masternode_voted_too_many_times.rs @@ -0,0 +1,53 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Masternode with id: {pro_tx_hash} already voted {times_already_voted} times and is trying to vote again, they can only vote {max_times_allowed} times")] +#[platform_serialize(unversioned)] +pub struct MasternodeVotedTooManyTimesError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pro_tx_hash: Identifier, + + times_already_voted: u16, + + max_times_allowed: u16, +} + +impl MasternodeVotedTooManyTimesError { + pub fn new(pro_tx_hash: Identifier, times_already_voted: u16, max_times_allowed: u16) -> Self { + Self { + pro_tx_hash, + times_already_voted, + max_times_allowed, + } + } + + pub fn pro_tx_hash(&self) -> Identifier { + self.pro_tx_hash + } + + pub fn times_already_voted(&self) -> u16 { + self.times_already_voted + } + + pub fn max_times_allowed(&self) -> u16 { + self.max_times_allowed + } +} + +impl From for ConsensusError { + fn from(err: MasternodeVotedTooManyTimesError) -> Self { + Self::StateError(StateError::MasternodeVotedTooManyTimesError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/mod.rs b/packages/rs-dpp/src/errors/consensus/state/voting/mod.rs new file mode 100644 index 00000000000..fcf092f07aa --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/mod.rs @@ -0,0 +1,7 @@ +pub mod masternode_incorrect_voter_identity_id_error; +pub mod masternode_incorrect_voting_address_error; +pub mod masternode_not_found_error; +pub mod masternode_vote_already_present_error; +pub mod masternode_voted_too_many_times; +pub mod vote_poll_not_available_for_voting_error; +pub mod vote_poll_not_found_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/vote_poll_not_available_for_voting_error.rs b/packages/rs-dpp/src/errors/consensus/state/voting/vote_poll_not_available_for_voting_error.rs new file mode 100644 index 00000000000..26341b31d4d --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/vote_poll_not_available_for_voting_error.rs @@ -0,0 +1,39 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStatus; +use crate::voting::vote_polls::VotePoll; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("VotePoll {vote_poll} not available for voting: {status}")] +#[platform_serialize(unversioned)] +pub struct VotePollNotAvailableForVotingError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + vote_poll: VotePoll, + status: ContestedDocumentVotePollStatus, +} + +impl VotePollNotAvailableForVotingError { + pub fn new(vote_poll: VotePoll, status: ContestedDocumentVotePollStatus) -> Self { + Self { vote_poll, status } + } + + pub fn vote_poll(&self) -> &VotePoll { + &self.vote_poll + } +} + +impl From for ConsensusError { + fn from(err: VotePollNotAvailableForVotingError) -> Self { + Self::StateError(StateError::VotePollNotAvailableForVotingError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/voting/vote_poll_not_found_error.rs b/packages/rs-dpp/src/errors/consensus/state/voting/vote_poll_not_found_error.rs new file mode 100644 index 00000000000..77a6c62bdde --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/voting/vote_poll_not_found_error.rs @@ -0,0 +1,37 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::voting::vote_polls::VotePoll; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("VotePoll {vote_poll} not found")] +#[platform_serialize(unversioned)] +pub struct VotePollNotFoundError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + vote_poll: VotePoll, +} + +impl VotePollNotFoundError { + pub fn new(vote_poll: VotePoll) -> Self { + Self { vote_poll } + } + + pub fn vote_poll(&self) -> &VotePoll { + &self.vote_poll + } +} + +impl From for ConsensusError { + fn from(err: VotePollNotFoundError) -> Self { + Self::StateError(StateError::VotePollNotFoundError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/dpp_init_error.rs b/packages/rs-dpp/src/errors/dpp_init_error.rs index 9fa82c3f6ff..baf41047c23 100644 --- a/packages/rs-dpp/src/errors/dpp_init_error.rs +++ b/packages/rs-dpp/src/errors/dpp_init_error.rs @@ -1,15 +1,10 @@ -use std::borrow::Cow; - use crate::version::FeatureVersion; -use jsonschema::ValidationError; use thiserror::Error; #[derive(Error, Debug)] pub enum DashPlatformProtocolInitError { #[error(transparent)] SchemaDeserializationError(serde_json::Error), - #[error(transparent)] - ValidationError(ValidationError<'static>), #[error("Loaded Schema is invalid: {0}")] InvalidSchemaError(&'static str), #[error("platform init unknown version on {method}, received: {received}")] @@ -23,23 +18,8 @@ pub enum DashPlatformProtocolInitError { }, } -fn into_owned(err: ValidationError) -> ValidationError<'static> { - ValidationError { - instance_path: err.instance_path.clone(), - instance: Cow::Owned(err.instance.into_owned()), - kind: err.kind, - schema_path: err.schema_path, - } -} - impl From for DashPlatformProtocolInitError { fn from(error: serde_json::Error) -> Self { Self::SchemaDeserializationError(error) } } - -impl<'a> From> for DashPlatformProtocolInitError { - fn from(err: ValidationError<'a>) -> Self { - Self::ValidationError(into_owned(err)) - } -} diff --git a/packages/rs-dpp/src/errors/protocol_error.rs b/packages/rs-dpp/src/errors/protocol_error.rs index 1136eab12e0..2164b339f19 100644 --- a/packages/rs-dpp/src/errors/protocol_error.rs +++ b/packages/rs-dpp/src/errors/protocol_error.rs @@ -7,12 +7,31 @@ use crate::consensus::signature::{ use crate::consensus::ConsensusError; use crate::data_contract::errors::*; use crate::document::errors::*; -#[cfg(feature = "validation")] + +#[cfg(any( + feature = "state-transition-validation", + feature = "state-transition-signing" +))] use crate::state_transition::errors::InvalidIdentityPublicKeyTypeError; + +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] +use crate::state_transition::errors::StateTransitionError; + +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation", + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::state_transition::errors::WrongPublicKeyPurposeError; + #[cfg(feature = "state-transition-validation")] use crate::state_transition::errors::{ InvalidSignaturePublicKeyError, PublicKeyMismatchError, PublicKeySecurityLevelNotMetError, - StateTransitionError, StateTransitionIsNotSignedError, WrongPublicKeyPurposeError, + StateTransitionIsNotSignedError, }; use crate::{ CompatibleProtocolVersionIsNotDefinedError, DashPlatformProtocolInitError, @@ -93,6 +112,9 @@ pub enum ProtocolError { #[error("unknown storage key requirements {0}")] UnknownStorageKeyRequirements(String), + #[error("unknown contested index resolution {0}")] + UnknownContestedIndexResolution(String), + #[error(transparent)] DataContractError(#[from] DataContractError), @@ -100,8 +122,8 @@ pub enum ProtocolError { #[error(transparent)] StateTransitionError(#[from] StateTransitionError), - #[error(transparent)] - StructureError(#[from] StructureError), + #[error("Invalid State Transition Type: {0}")] + InvalidStateTransitionType(String), #[error(transparent)] PlatformVersionError(#[from] PlatformVersionError), @@ -115,23 +137,38 @@ pub enum ProtocolError { #[error("Generic Error: {0}")] Generic(String), + #[error("Not supported Error: {0}")] + NotSupported(String), + + #[cfg(feature = "message-signing")] + #[error("Invalid signing type error: {0}")] + InvalidSigningKeyTypeError(String), + // State Transition Errors - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(any( + feature = "state-transition-validation", + feature = "state-transition-signing" + ))] #[error(transparent)] InvalidIdentityPublicKeyTypeError(InvalidIdentityPublicKeyTypeError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] StateTransitionIsNotSignedError(StateTransitionIsNotSignedError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] PublicKeySecurityLevelNotMetError(PublicKeySecurityLevelNotMetError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation", + feature = "state-transition-signing", + feature = "state-transition-validation" + ))] #[error(transparent)] WrongPublicKeyPurposeError(WrongPublicKeyPurposeError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] PublicKeyMismatchError(PublicKeyMismatchError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] InvalidSignaturePublicKeyError(InvalidSignaturePublicKeyError), @@ -141,13 +178,6 @@ pub enum ProtocolError { #[error(transparent)] CompatibleProtocolVersionIsNotDefinedError(#[from] CompatibleProtocolVersionIsNotDefinedError), - // Data Contract - #[error("Data Contract already exists")] - DataContractAlreadyExistsError, - - #[error(transparent)] - InvalidDataContractError(InvalidDataContractError), - #[error(transparent)] InvalidDocumentTypeError(InvalidDocumentTypeError), @@ -172,7 +202,7 @@ pub enum ProtocolError { /// Error #[error("missing key: {0}")] - DocumentKeyMissing(String), + DesiredKeyWithTypePurposeSecurityLevelMissing(String), /// Value error #[error("value error: {0}")] @@ -196,6 +226,9 @@ pub enum ProtocolError { raw_identity: Value, }, + #[error("votes error {0}")] + VoteError(String), + #[error("Public key generation error {0}")] PublicKeyGenerationError(String), @@ -210,6 +243,10 @@ pub enum ProtocolError { #[error(transparent)] InvalidVectorSizeError(InvalidVectorSizeError), + + /// Invalid CBOR error + #[error("invalid cbor error: {0}")] + InvalidCBOR(String), } impl From<&str> for ProtocolError { diff --git a/packages/rs-dpp/src/fee/default_costs/constants.rs b/packages/rs-dpp/src/fee/default_costs/constants.rs index f93be480f1c..12f76d39099 100644 --- a/packages/rs-dpp/src/fee/default_costs/constants.rs +++ b/packages/rs-dpp/src/fee/default_costs/constants.rs @@ -1,7 +1,6 @@ use crate::fee::Credits; pub const BASE_ST_PROCESSING_FEE: Credits = 10000; // 84000 -pub const FEE_MULTIPLIER: Credits = 2; pub const DEFAULT_USER_TIP: Credits = 0; pub const STORAGE_CREDIT_PER_BYTE: Credits = 5000; pub const PROCESSING_CREDIT_PER_BYTE: Credits = 12; diff --git a/packages/rs-dpp/src/fee/default_costs/mod.rs b/packages/rs-dpp/src/fee/default_costs/mod.rs index 25fac22371b..9af68bb1434 100644 --- a/packages/rs-dpp/src/fee/default_costs/mod.rs +++ b/packages/rs-dpp/src/fee/default_costs/mod.rs @@ -29,16 +29,19 @@ //! Fee costs //! -//! Fee costs for Drive (GroveDB) operations +//! Fee costs for Known Platform operations //! -use crate::block::epoch::Epoch; -use crate::block::epoch::EpochIndex; -use lazy_static::lazy_static; -use std::collections::HashMap; +use crate::block::epoch::{Epoch, EpochIndex}; +use crate::fee::Credits; +use platform_version::version::fee::FeeVersion; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; pub mod constants; +pub type CachedEpochIndexFeeVersions = BTreeMap; + /// A Known Cost Item is an item that changes costs depending on the Epoch #[derive(Eq, PartialEq, Copy, Clone, Hash)] pub enum KnownCostItem { @@ -57,53 +60,120 @@ pub enum KnownCostItem { FetchIdentityBalanceProcessingCost, /// The cost for fetching an identity key FetchSingleIdentityKeyProcessingCost, + /// The cost for a Single SHA256 operation, with a specific size + SingleSHA256(usize), + /// The cost for a Blake3 operation, with a specific size + Blake3(usize), + /// The cost for a EcdsaSecp256k1 signature verification + VerifySignatureEcdsaSecp256k1, + /// The cost for a BLS12_381 signature verification + VerifySignatureBLS12_381, + /// The cost for a EcdsaHash160 signature verification + VerifySignatureEcdsaHash160, + /// The cost for a Bip13ScriptHash signature verification + VerifySignatureBip13ScriptHash, + /// The cost for a Eddsa25519Hash160 signature verification + VerifySignatureEddsa25519Hash160, } -const EPOCH_COST_UPDATE_VERSIONS: [u16; 1] = [0]; +impl KnownCostItem { + #[inline] + pub fn lookup_cost(&self, fee_version: &FeeVersion) -> Credits { + match self { + KnownCostItem::StorageDiskUsageCreditPerByte => { + fee_version.storage.storage_disk_usage_credit_per_byte + } + KnownCostItem::StorageProcessingCreditPerByte => { + fee_version.storage.storage_processing_credit_per_byte + } + KnownCostItem::StorageLoadCreditPerByte => { + fee_version.storage.storage_load_credit_per_byte + } + KnownCostItem::NonStorageLoadCreditPerByte => { + fee_version.storage.non_storage_load_credit_per_byte + } + KnownCostItem::StorageSeekCost => fee_version.storage.storage_seek_cost, + KnownCostItem::FetchIdentityBalanceProcessingCost => { + fee_version + .processing + .fetch_identity_balance_processing_cost + } + KnownCostItem::FetchSingleIdentityKeyProcessingCost => { + fee_version + .processing + .fetch_single_identity_key_processing_cost + } + KnownCostItem::Blake3(size) => { + fee_version.hashing.blake3_base + + fee_version.hashing.blake3_per_block * *size as u64 + } + KnownCostItem::SingleSHA256(size) => { + fee_version.hashing.single_sha256_base + + fee_version.hashing.sha256_per_block * *size as u64 + } + KnownCostItem::VerifySignatureEcdsaSecp256k1 => { + fee_version.signature.verify_signature_ecdsa_secp256k1 + } + KnownCostItem::VerifySignatureBLS12_381 => { + fee_version.signature.verify_signature_bls12_381 + } + KnownCostItem::VerifySignatureEcdsaHash160 => { + fee_version.signature.verify_signature_ecdsa_hash160 + } + KnownCostItem::VerifySignatureBip13ScriptHash => { + fee_version.signature.verify_signature_bip13_script_hash + } + KnownCostItem::VerifySignatureEddsa25519Hash160 => { + fee_version.signature.verify_signature_eddsa25519_hash160 + } + } + } -lazy_static! { - static ref EPOCH_COSTS: HashMap> = HashMap::from([( - 0, - HashMap::from([ - (KnownCostItem::StorageDiskUsageCreditPerByte, 27000u64), - (KnownCostItem::StorageProcessingCreditPerByte, 400u64), - (KnownCostItem::StorageLoadCreditPerByte, 400u64), - (KnownCostItem::NonStorageLoadCreditPerByte, 30u64), - (KnownCostItem::StorageSeekCost, 4000u64), - (KnownCostItem::FetchIdentityBalanceProcessingCost, 10000u64), - ( - KnownCostItem::FetchSingleIdentityKeyProcessingCost, - 10000u64 - ), - ]) - )]); + pub fn lookup_cost_on_epoch( + &self, + epoch: &T, + cached_fee_version: &CachedEpochIndexFeeVersions, + ) -> Credits { + let version = epoch.active_fee_version(cached_fee_version); + self.lookup_cost(&version) + } } /// Costs for Epochs pub trait EpochCosts { - //todo: should just have a static lookup table /// Get the closest epoch in the past that has a cost table /// This is where the base costs last changed - fn get_closest_epoch_index_cost_update_version(&self) -> EpochIndex; + fn active_fee_version(&self, cached_fee_version: &CachedEpochIndexFeeVersions) -> FeeVersion; /// Get the cost for the known cost item - fn cost_for_known_cost_item(&self, cost_item: KnownCostItem) -> u64; + fn cost_for_known_cost_item( + &self, + cached_fee_version: &CachedEpochIndexFeeVersions, + cost_item: KnownCostItem, + ) -> Credits; } impl EpochCosts for Epoch { - //todo: should just have a static lookup table - /// Get the closest epoch in the past that has a cost table - /// This is where the base costs last changed - fn get_closest_epoch_index_cost_update_version(&self) -> EpochIndex { - match EPOCH_COST_UPDATE_VERSIONS.binary_search(&self.index) { - Ok(_) => self.index, - Err(pos) => EPOCH_COST_UPDATE_VERSIONS[pos - 1], + /// Get the active fee version for an epoch + fn active_fee_version(&self, cached_fee_version: &CachedEpochIndexFeeVersions) -> FeeVersion { + // If the exact EpochIndex is matching to a FeeVersion update + if let Some(fee_version) = cached_fee_version.get(&self.index) { + return fee_version.clone(); } + // else return the FeeVersion at lower adjacent EpochIndex (if available, else the FeeVersion of first PlatformVersion) + cached_fee_version + .range(..=self.index) + .next_back() + .map(|(_, fee_version)| fee_version) + .unwrap_or_else(|| &PlatformVersion::first().fee_version) + .clone() } /// Get the cost for the known cost item - fn cost_for_known_cost_item(&self, cost_item: KnownCostItem) -> u64 { - let epoch = self.get_closest_epoch_index_cost_update_version(); - let specific_epoch_costs = EPOCH_COSTS.get(&epoch).unwrap(); - *specific_epoch_costs.get(&cost_item).unwrap() + fn cost_for_known_cost_item( + &self, + cached_fee_version: &CachedEpochIndexFeeVersions, + cost_item: KnownCostItem, + ) -> Credits { + cost_item.lookup_cost_on_epoch(self, cached_fee_version) } } diff --git a/packages/rs-dpp/src/fee/epoch/distribution.rs b/packages/rs-dpp/src/fee/epoch/distribution.rs index 5886bd54d6f..73d0b94ee99 100644 --- a/packages/rs-dpp/src/fee/epoch/distribution.rs +++ b/packages/rs-dpp/src/fee/epoch/distribution.rs @@ -248,6 +248,7 @@ where let era_start_epoch_index = start_epoch_index + epochs_per_era * era; for epoch_index in era_start_epoch_index..era_start_epoch_index + epochs_per_era { + //todo: this can lead to many many calls once we are further along in epochs map_function(epoch_index, epoch_fee_share)?; distribution_leftover_credits = distribution_leftover_credits diff --git a/packages/rs-dpp/src/fee/epoch/mod.rs b/packages/rs-dpp/src/fee/epoch/mod.rs index f438823506e..0d76c2ed178 100644 --- a/packages/rs-dpp/src/fee/epoch/mod.rs +++ b/packages/rs-dpp/src/fee/epoch/mod.rs @@ -42,7 +42,6 @@ use crate::block::epoch::EpochIndex; use crate::fee::{Credits, SignedCredits}; /// Genesis epoch index -//todo move to dpp pub const GENESIS_EPOCH_INDEX: EpochIndex = 0; /// Eras of fees charged for perpetual storage diff --git a/packages/rs-dpp/src/fee/fee_result/mod.rs b/packages/rs-dpp/src/fee/fee_result/mod.rs index 1956719049c..749cc834267 100644 --- a/packages/rs-dpp/src/fee/fee_result/mod.rs +++ b/packages/rs-dpp/src/fee/fee_result/mod.rs @@ -41,6 +41,7 @@ use crate::consensus::fee::fee_error::FeeError; use crate::fee::fee_result::refunds::FeeRefunds; use crate::fee::fee_result::BalanceChange::{AddToBalance, NoBalanceChange, RemoveFromBalance}; use crate::fee::Credits; +use crate::prelude::UserFeeIncrease; use crate::ProtocolError; use platform_value::Identifier; use std::cmp::Ordering; @@ -89,7 +90,7 @@ impl TryFrom>> for FeeResult { } /// The balance change for an identity -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum BalanceChange { /// Add Balance AddToBalance(Credits), @@ -192,6 +193,21 @@ impl FeeResult { removed_bytes_from_system: 0, } } + + /// Apply a fee multiplier to a fee result + pub fn apply_user_fee_increase(&mut self, add_fee_percentage_multiplier: UserFeeIncrease) { + let additional_processing_fee = (self.processing_fee as u128) + .saturating_mul(add_fee_percentage_multiplier as u128) + .saturating_div(100); + if additional_processing_fee > u64::MAX as u128 { + self.processing_fee = u64::MAX; + } else { + self.processing_fee = self + .processing_fee + .saturating_add(additional_processing_fee as u64); + } + } + /// Convenience method to get total fee pub fn total_base_fee(&self) -> Credits { self.storage_fee + self.processing_fee diff --git a/packages/rs-dpp/src/fee/fee_result/refunds.rs b/packages/rs-dpp/src/fee/fee_result/refunds.rs index 8e7ad0bad63..f95fd379d20 100644 --- a/packages/rs-dpp/src/fee/fee_result/refunds.rs +++ b/packages/rs-dpp/src/fee/fee_result/refunds.rs @@ -4,8 +4,8 @@ //! use crate::block::epoch::{Epoch, EpochIndex}; -use crate::fee::default_costs::EpochCosts; use crate::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; +use crate::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use crate::fee::epoch::distribution::calculate_storage_fee_refund_amount_and_leftovers; use crate::fee::epoch::{BytesPerEpoch, CreditsPerEpoch}; use crate::fee::Credits; @@ -38,6 +38,7 @@ impl FeeRefunds { storage_removal: I, current_epoch_index: EpochIndex, epochs_per_era: u16, + previous_fee_versions: &CachedEpochIndexFeeVersions, ) -> Result where I: IntoIterator, @@ -53,10 +54,10 @@ impl FeeRefunds { .map(|(encoded_epoch_index, bytes)| { let epoch_index : u16 = encoded_epoch_index.try_into().map_err(|_| ProtocolError::Overflow("can't fit u64 epoch index from StorageRemovalPerEpochByIdentifier to u16 EpochIndex"))?; - // TODO We should use multipliers + // TODO Add in multipliers once they have been made let credits: Credits = (bytes as Credits) - .checked_mul(Epoch::new(current_epoch_index)?.cost_for_known_cost_item(StorageDiskUsageCreditPerByte)) + .checked_mul(Epoch::new(current_epoch_index)?.cost_for_known_cost_item(previous_fee_versions, StorageDiskUsageCreditPerByte)) .ok_or(ProtocolError::Overflow("storage written bytes cost overflow"))?; let (amount, _) = calculate_storage_fee_refund_amount_and_leftovers( @@ -180,6 +181,11 @@ impl IntoIterator for FeeRefunds { #[cfg(test)] mod tests { use super::*; + use once_cell::sync::Lazy; + use platform_version::version::PlatformVersion; + + static EPOCH_CHANGE_FEE_VERSION_TEST: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); mod from_storage_removal { use super::*; @@ -194,8 +200,13 @@ mod tests { let storage_removal = BytesPerEpochByIdentifier::from_iter([(identity_id, bytes_per_epoch)]); - let fee_refunds = FeeRefunds::from_storage_removal(storage_removal, 3, 20) - .expect("should create fee refunds"); + let fee_refunds = FeeRefunds::from_storage_removal( + storage_removal, + 3, + 20, + &EPOCH_CHANGE_FEE_VERSION_TEST, + ) + .expect("should create fee refunds"); let credits_per_epoch = fee_refunds.get(&identity_id).expect("should exists"); diff --git a/packages/rs-dpp/src/fee/mod.rs b/packages/rs-dpp/src/fee/mod.rs index 9e18edc32b7..f89ba6be42a 100644 --- a/packages/rs-dpp/src/fee/mod.rs +++ b/packages/rs-dpp/src/fee/mod.rs @@ -4,6 +4,3 @@ pub mod epoch; pub mod fee_result; pub use crate::balances::credits::{Credits, SignedCredits}; - -/// Default original fee multiplier -pub const DEFAULT_ORIGINAL_FEE_MULTIPLIER: f64 = 2.0; diff --git a/packages/rs-dpp/src/identifier/mod.rs b/packages/rs-dpp/src/identifier/mod.rs index ced6fa8aa88..ae691e0b762 100644 --- a/packages/rs-dpp/src/identifier/mod.rs +++ b/packages/rs-dpp/src/identifier/mod.rs @@ -1,2 +1,32 @@ pub use platform_value::Identifier; pub use platform_value::IDENTIFIER_MEDIA_TYPE as MEDIA_TYPE; +use sha2::{Digest, Sha256}; + +pub trait MasternodeIdentifiers { + fn create_voter_identifier(pro_tx_hash: &[u8; 32], voting_address: &[u8; 20]) -> Identifier; + + fn create_operator_identifier(pro_tx_hash: &[u8; 32], pub_key_operator: &[u8]) -> Identifier; +} + +trait IdentifierConstructorPrivate { + fn hash_protxhash_with_key_data(pro_tx_hash: &[u8; 32], key_data: &[u8]) -> Identifier; +} +impl MasternodeIdentifiers for Identifier { + fn create_voter_identifier(pro_tx_hash: &[u8; 32], voting_address: &[u8; 20]) -> Identifier { + Self::hash_protxhash_with_key_data(pro_tx_hash, voting_address) + } + + fn create_operator_identifier(pro_tx_hash: &[u8; 32], pub_key_operator: &[u8]) -> Identifier { + Self::hash_protxhash_with_key_data(pro_tx_hash, pub_key_operator) + } +} + +impl IdentifierConstructorPrivate for Identifier { + fn hash_protxhash_with_key_data(pro_tx_hash: &[u8; 32], key_data: &[u8]) -> Identifier { + let mut hasher = Sha256::new(); + hasher.update(pro_tx_hash); + hasher.update(key_data); + let bytes: [u8; 32] = hasher.finalize().into(); + bytes.into() + } +} diff --git a/packages/rs-dpp/src/identity/accessors/mod.rs b/packages/rs-dpp/src/identity/accessors/mod.rs index 0c27ebd1d56..2c95c36236f 100644 --- a/packages/rs-dpp/src/identity/accessors/mod.rs +++ b/packages/rs-dpp/src/identity/accessors/mod.rs @@ -118,18 +118,20 @@ impl IdentityGettersV0 for Identity { } } - /// Get first public key matching a purpose, security levels or key types + /// Get first public key matching a purpose, security levels, or key types, optionally allowing disabled keys fn get_first_public_key_matching( &self, purpose: Purpose, security_levels: HashSet, key_types: HashSet, + allow_disabled: bool, ) -> Option<&IdentityPublicKey> { match self { Identity::V0(identity) => identity.public_keys.values().find(|key| { key.purpose() == purpose && security_levels.contains(&key.security_level()) && key_types.contains(&key.key_type()) + && (allow_disabled || !key.is_disabled()) }), } } diff --git a/packages/rs-dpp/src/identity/accessors/v0/mod.rs b/packages/rs-dpp/src/identity/accessors/v0/mod.rs index 390b0037be1..41d17c3c5b3 100644 --- a/packages/rs-dpp/src/identity/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/identity/accessors/v0/mod.rs @@ -1,4 +1,4 @@ -use crate::identity::{Identity, IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; +use crate::identity::{IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; use crate::prelude::Revision; use crate::ProtocolError; @@ -45,6 +45,7 @@ pub trait IdentityGettersV0 { purpose: Purpose, security_levels: HashSet, key_types: HashSet, + allow_disabled: bool, ) -> Option<&IdentityPublicKey>; /// Add an identity public key fn add_public_key(&mut self, key: IdentityPublicKey); diff --git a/packages/rs-dpp/src/identity/conversion/cbor/mod.rs b/packages/rs-dpp/src/identity/conversion/cbor/mod.rs index c0000c8b0d4..e084dffc38f 100644 --- a/packages/rs-dpp/src/identity/conversion/cbor/mod.rs +++ b/packages/rs-dpp/src/identity/conversion/cbor/mod.rs @@ -1,2 +1 @@ mod v0; -pub use v0::*; diff --git a/packages/rs-dpp/src/identity/identities_contract_keys.rs b/packages/rs-dpp/src/identity/identities_contract_keys.rs new file mode 100644 index 00000000000..063b5dabc7f --- /dev/null +++ b/packages/rs-dpp/src/identity/identities_contract_keys.rs @@ -0,0 +1,6 @@ +use crate::identity::{IdentityPublicKey, Purpose}; +use platform_value::Identifier; +use std::collections::BTreeMap; + +pub type IdentitiesContractKeys = + BTreeMap>>; diff --git a/packages/rs-dpp/src/identity/identity.rs b/packages/rs-dpp/src/identity/identity.rs index f73288d40ca..1c8951d13b6 100644 --- a/packages/rs-dpp/src/identity/identity.rs +++ b/packages/rs-dpp/src/identity/identity.rs @@ -1,17 +1,23 @@ use crate::identity::v0::IdentityV0; use crate::identity::{IdentityPublicKey, KeyID}; -use crate::prelude::{AssetLockProof, Revision}; +use crate::prelude::Revision; +#[cfg(feature = "identity-hashing")] use crate::serialization::PlatformSerializable; +#[cfg(feature = "identity-hashing")] use crate::util::hash; use crate::version::PlatformVersion; use crate::ProtocolError; +#[cfg(feature = "identity-serialization")] use bincode::{Decode, Encode}; use derive_more::From; +#[cfg(feature = "identity-serialization")] use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use platform_value::Identifier; +use crate::fee::Credits; +#[cfg(feature = "identity-serde-conversion")] use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, BTreeSet}; @@ -40,7 +46,7 @@ pub enum Identity { pub struct PartialIdentity { pub id: Identifier, pub loaded_public_keys: BTreeMap, - pub balance: Option, + pub balance: Option, pub revision: Option, /// These are keys that were requested but didn't exist pub not_found_public_keys: BTreeSet, @@ -50,9 +56,9 @@ impl Identity { #[cfg(feature = "identity-hashing")] /// Computes the hash of an identity pub fn hash(&self) -> Result, ProtocolError> { - Ok(hash::hash_to_vec(PlatformSerializable::serialize_to_bytes( - self, - )?)) + Ok(hash::hash_double_to_vec( + PlatformSerializable::serialize_to_bytes(self)?, + )) } pub fn default_versioned( diff --git a/packages/rs-dpp/src/identity/identity_facade.rs b/packages/rs-dpp/src/identity/identity_facade.rs index 13ae58a9197..919c68c6240 100644 --- a/packages/rs-dpp/src/identity/identity_facade.rs +++ b/packages/rs-dpp/src/identity/identity_facade.rs @@ -1,26 +1,26 @@ use dashcore::{InstantLock, Transaction}; -use platform_value::Value; -use platform_version::version::PlatformVersion; + use std::collections::BTreeMap; use crate::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; use crate::identity::state_transition::asset_lock_proof::{AssetLockProof, InstantAssetLockProof}; -use crate::identity::{Identity, IdentityPublicKey, KeyID, TimestampMillis}; -use crate::prelude::Identifier; +use crate::identity::{Identity, IdentityPublicKey, KeyID}; +use crate::prelude::{Identifier, IdentityNonce}; use crate::identity::identity_factory::IdentityFactory; #[cfg(feature = "state-transitions")] -use crate::state_transition::identity_create_transition::IdentityCreateTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::identity_update_transition::IdentityUpdateTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use crate::state_transition::{ + identity_create_transition::IdentityCreateTransition, + identity_credit_transfer_transition::IdentityCreditTransferTransition, + identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition, + identity_topup_transition::IdentityTopUpTransition, + identity_update_transition::IdentityUpdateTransition, + public_key_in_creation::IdentityPublicKeyInCreation, +}; -use crate::{DashPlatformProtocolInitError, ProtocolError}; +use crate::identity::core_script::CoreScript; +use crate::withdrawal::Pooling; +use crate::ProtocolError; #[derive(Clone)] pub struct IdentityFacade { @@ -52,6 +52,7 @@ impl IdentityFacade { // .create_from_object(raw_identity) // } + #[cfg(all(feature = "identity-serialization", feature = "client"))] pub fn create_from_buffer( &self, buffer: Vec, @@ -82,7 +83,7 @@ impl IdentityFacade { #[cfg(feature = "state-transitions")] pub fn create_identity_create_transition( &self, - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, ) -> Result { self.factory @@ -102,29 +103,52 @@ impl IdentityFacade { #[cfg(feature = "state-transitions")] pub fn create_identity_credit_transfer_transition( &self, - identity_id: Identifier, + identity: &Identity, recipient_id: Identifier, amount: u64, + identity_nonce: IdentityNonce, ) -> Result { - self.factory - .create_identity_credit_transfer_transition(identity_id, recipient_id, amount) + self.factory.create_identity_credit_transfer_transition( + identity, + recipient_id, + amount, + identity_nonce, + ) + } + + #[cfg(feature = "state-transitions")] + pub fn create_identity_credit_withdrawal_transition( + &self, + identity_id: Identifier, + amount: u64, + core_fee_per_byte: u32, + pooling: Pooling, + output_script: CoreScript, + identity_nonce: u64, + ) -> Result { + self.factory.create_identity_credit_withdrawal_transition( + identity_id, + amount, + core_fee_per_byte, + pooling, + output_script, + identity_nonce, + ) } #[cfg(feature = "state-transitions")] pub fn create_identity_update_transition( &self, identity: Identity, + identity_nonce: u64, add_public_keys: Option>, public_key_ids_to_disable: Option>, - // Pass disable time as argument because SystemTime::now() does not work for wasm target - // https://github.com/rust-lang/rust/issues/48564 - disable_time: Option, ) -> Result { self.factory.create_identity_update_transition( identity, + identity_nonce, add_public_keys, public_key_ids_to_disable, - disable_time, ) } } diff --git a/packages/rs-dpp/src/identity/identity_factory.rs b/packages/rs-dpp/src/identity/identity_factory.rs index 42134c9ed20..c6aface5912 100644 --- a/packages/rs-dpp/src/identity/identity_factory.rs +++ b/packages/rs-dpp/src/identity/identity_factory.rs @@ -1,8 +1,11 @@ use crate::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; -use crate::identity::state_transition::asset_lock_proof::{AssetLockProof, InstantAssetLockProof}; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::identity::state_transition::asset_lock_proof::AssetLockProof; +use crate::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +#[cfg(all(feature = "state-transitions", feature = "client"))] use crate::identity::state_transition::AssetLockProved; #[cfg(all(feature = "state-transitions", feature = "client"))] -use crate::identity::{IdentityV0, TimestampMillis}; +use crate::identity::IdentityV0; use crate::identity::{Identity, IdentityPublicKey, KeyID}; @@ -23,6 +26,10 @@ use crate::identity::accessors::IdentityGettersV0; #[cfg(all(feature = "validation", feature = "identity-value-conversion"))] use crate::identity::conversion::platform_value::IdentityPlatformValueConversionMethodsV0; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::identity::core_script::CoreScript; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::prelude::IdentityNonce; #[cfg(all(feature = "identity-serialization", feature = "client"))] use crate::serialization::PlatformDeserializable; #[cfg(all(feature = "state-transitions", feature = "client"))] @@ -34,6 +41,10 @@ use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCr #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; #[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +#[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0; #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; @@ -48,6 +59,8 @@ use crate::state_transition::identity_update_transition::IdentityUpdateTransitio #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::version::PlatformVersion; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::withdrawal::Pooling; #[cfg(any( all(feature = "identity-serialization", feature = "client"), feature = "identity-value-conversion" @@ -149,7 +162,7 @@ impl IdentityFactory { #[cfg(all(feature = "state-transitions", feature = "client"))] pub fn create_identity_create_transition( &self, - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, ) -> Result { let transition = @@ -172,8 +185,8 @@ impl IdentityFactory { revision: 0, }); - let mut identity_create_transition = IdentityCreateTransition::V0( - IdentityCreateTransitionV0::try_from_identity_v0(identity.clone(), asset_lock_proof)?, + let identity_create_transition = IdentityCreateTransition::V0( + IdentityCreateTransitionV0::try_from_identity_v0(&identity, asset_lock_proof)?, ); Ok((identity, identity_create_transition)) } @@ -187,7 +200,7 @@ impl IdentityFactory { let mut identity_topup_transition = IdentityTopUpTransitionV0::default(); identity_topup_transition.set_identity_id(identity_id); - identity_topup_transition.set_asset_lock_proof(asset_lock_proof); + identity_topup_transition.set_asset_lock_proof(asset_lock_proof)?; Ok(IdentityTopUpTransition::V0(identity_topup_transition)) } @@ -195,47 +208,68 @@ impl IdentityFactory { #[cfg(all(feature = "state-transitions", feature = "client"))] pub fn create_identity_credit_transfer_transition( &self, - identity_id: Identifier, + identity: &Identity, recipient_id: Identifier, amount: u64, + identity_nonce: IdentityNonce, ) -> Result { - let mut identity_credit_transfer_transition = IdentityCreditTransferTransitionV0::default(); - identity_credit_transfer_transition.identity_id = identity_id; - identity_credit_transfer_transition.recipient_id = recipient_id; - identity_credit_transfer_transition.amount = amount; + let identity_credit_transfer_transition = IdentityCreditTransferTransitionV0 { + identity_id: identity.id(), + recipient_id, + amount, + nonce: identity_nonce, + ..Default::default() + }; Ok(IdentityCreditTransferTransition::from( identity_credit_transfer_transition, )) } + #[cfg(all(feature = "state-transitions", feature = "client"))] + pub fn create_identity_credit_withdrawal_transition( + &self, + identity_id: Identifier, + amount: u64, + core_fee_per_byte: u32, + pooling: Pooling, + output_script: CoreScript, + identity_nonce: IdentityNonce, + ) -> Result { + let identity_credit_withdrawal_transition = IdentityCreditWithdrawalTransitionV0 { + identity_id, + amount, + core_fee_per_byte, + pooling, + output_script, + nonce: identity_nonce, + ..Default::default() + }; + + Ok(IdentityCreditWithdrawalTransition::from( + identity_credit_withdrawal_transition, + )) + } + #[cfg(all(feature = "state-transitions", feature = "client"))] pub fn create_identity_update_transition( &self, identity: Identity, + identity_nonce: u64, add_public_keys: Option>, public_key_ids_to_disable: Option>, - // Pass disable time as argument because SystemTime::now() does not work for wasm target - // https://github.com/rust-lang/rust/issues/48564 - disable_time: Option, ) -> Result { let mut identity_update_transition = IdentityUpdateTransitionV0::default(); identity_update_transition.set_identity_id(identity.id().to_owned()); identity_update_transition.set_revision(identity.revision() + 1); + identity_update_transition.set_nonce(identity_nonce); if let Some(add_public_keys) = add_public_keys { identity_update_transition.set_public_keys_to_add(add_public_keys); } if let Some(public_key_ids_to_disable) = public_key_ids_to_disable { - if disable_time.is_none() { - return Err(ProtocolError::Generic( - "Public keys disabled at must be present".to_string(), - )); - } - identity_update_transition.set_public_key_ids_to_disable(public_key_ids_to_disable); - identity_update_transition.set_public_keys_disabled_at(disable_time); } Ok(IdentityUpdateTransition::V0(identity_update_transition)) diff --git a/packages/rs-dpp/src/identity/identity_nonce.rs b/packages/rs-dpp/src/identity/identity_nonce.rs new file mode 100644 index 00000000000..fd98642a972 --- /dev/null +++ b/packages/rs-dpp/src/identity/identity_nonce.rs @@ -0,0 +1,275 @@ +use crate::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use std::fmt::{Debug, Display, Formatter}; + +use crate::consensus::state::identity::invalid_identity_contract_nonce_error::InvalidIdentityNonceError; +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::prelude::IdentityNonce; +use crate::validation::SimpleConsensusValidationResult; +use bincode::{Decode, Encode}; +use platform_value::Identifier; + +pub const IDENTITY_NONCE_VALUE_FILTER: u64 = 0xFFFFFFFFFF; +pub const MISSING_IDENTITY_REVISIONS_FILTER: u64 = 0xFFFFFF0000000000; +pub const MAX_MISSING_IDENTITY_REVISIONS: u64 = 24; +pub const MISSING_IDENTITY_REVISIONS_MAX_BYTES: u64 = MAX_MISSING_IDENTITY_REVISIONS; +pub const IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES: u64 = 40; + +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +/// The result of the merge of the identity contract nonce +pub enum MergeIdentityNonceResult { + /// The nonce is an invalid value + /// This could be 0 + InvalidNonce, + /// The nonce is too far in the future + NonceTooFarInFuture, + /// The nonce is too far in the past + NonceTooFarInPast, + /// The nonce is already present at the tip + NonceAlreadyPresentAtTip, + /// The nonce is already present in the past + NonceAlreadyPresentInPast(u64), + /// The merge is a success + MergeIdentityNonceSuccess(IdentityNonce), +} + +impl Display for MergeIdentityNonceResult { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.write_str(self.error_message().unwrap_or("no error")) + } +} + +impl MergeIdentityNonceResult { + /// Gives a result from the enum + pub fn error_message(&self) -> Option<&'static str> { + match self { + MergeIdentityNonceResult::NonceTooFarInFuture => Some("nonce too far in future"), + MergeIdentityNonceResult::NonceTooFarInPast => Some("nonce too far in past"), + MergeIdentityNonceResult::NonceAlreadyPresentAtTip => { + Some("nonce already present at tip") + } + MergeIdentityNonceResult::NonceAlreadyPresentInPast(_) => { + Some("nonce already present in past") + } + MergeIdentityNonceResult::MergeIdentityNonceSuccess(_) => None, + MergeIdentityNonceResult::InvalidNonce => Some("nonce is an invalid value"), + } + } + + /// Is this result an error? + pub fn is_error(&self) -> bool { + !matches!(self, MergeIdentityNonceResult::MergeIdentityNonceSuccess(_)) + } +} + +pub fn validate_new_identity_nonce( + new_revision_nonce: IdentityNonce, + identity_id: Identifier, +) -> SimpleConsensusValidationResult { + if new_revision_nonce >= MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + SimpleConsensusValidationResult::new_with_error(ConsensusError::StateError( + StateError::InvalidIdentityNonceError(InvalidIdentityNonceError { + identity_id, + current_identity_nonce: None, + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceTooFarInPast, + }), + )) + } else { + SimpleConsensusValidationResult::new() + } +} + +pub fn validate_identity_nonce_update( + existing_nonce: IdentityNonce, + new_revision_nonce: IdentityNonce, + identity_id: Identifier, +) -> SimpleConsensusValidationResult { + let actual_existing_revision = existing_nonce & IDENTITY_NONCE_VALUE_FILTER; + match actual_existing_revision.cmp(&new_revision_nonce) { + std::cmp::Ordering::Equal => { + // we were not able to update the revision as it is the same as we already had + return SimpleConsensusValidationResult::new_with_error(ConsensusError::StateError( + StateError::InvalidIdentityNonceError(InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceAlreadyPresentAtTip, + }), + )); + } + std::cmp::Ordering::Less => { + if new_revision_nonce - actual_existing_revision > MISSING_IDENTITY_REVISIONS_MAX_BYTES + { + // we are too far away from the actual revision + return SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::InvalidIdentityNonceError( + InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceTooFarInFuture, + }, + )), + ); + } + } + std::cmp::Ordering::Greater => { + let previous_revision_position_from_top = actual_existing_revision - new_revision_nonce; + if previous_revision_position_from_top > MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + return SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::InvalidIdentityNonceError( + InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceTooFarInPast, + }, + )), + ); + } else { + let old_missing_revisions = existing_nonce & MISSING_IDENTITY_REVISIONS_FILTER; + let old_revision_already_set = if old_missing_revisions == 0 { + true + } else { + let byte_to_unset = 1 + << (previous_revision_position_from_top - 1 + + IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES); + old_missing_revisions | byte_to_unset != old_missing_revisions + }; + + if old_revision_already_set { + return SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::InvalidIdentityNonceError( + InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceAlreadyPresentInPast( + previous_revision_position_from_top, + ), + }, + )), + ); + } + } + } + } + SimpleConsensusValidationResult::new() +} + +#[cfg(test)] +mod tests { + use crate::consensus::state::state_error::StateError; + use crate::consensus::ConsensusError; + use crate::identity::identity_nonce::{ + validate_identity_nonce_update, MergeIdentityNonceResult, + }; + use platform_value::Identifier; + + #[test] + fn validate_identity_nonce_not_changed() { + let tip = 50; + let new_nonce = tip; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!(e.error, MergeIdentityNonceResult::NonceAlreadyPresentAtTip); + } + + #[test] + fn validate_identity_nonce_update_too_far_in_past() { + let tip = 50; + let new_nonce = tip - 25; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!(e.error, MergeIdentityNonceResult::NonceTooFarInPast); + } + + #[test] + fn validate_identity_nonce_update_too_far_in_future() { + let tip = 50; + let new_nonce = tip + 25; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!(e.error, MergeIdentityNonceResult::NonceTooFarInFuture); + } + + #[test] + fn validate_identity_nonce_update_already_in_past_no_missing_in_nonce() { + let tip = 50; + let new_nonce = tip - 24; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!( + e.error, + MergeIdentityNonceResult::NonceAlreadyPresentInPast(24) + ); + } + + #[test] + fn validate_identity_nonce_update_already_in_past_some_missing_in_nonce() { + let tip = 50 | 0x0FFF000000000000; + let new_nonce = 50 - 24; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!( + e.error, + MergeIdentityNonceResult::NonceAlreadyPresentInPast(24) + ); + } + + #[test] + fn validate_identity_nonce_update_not_in_past_some_missing_in_nonce() { + let tip = 50 | 0x0FFF000000000000; + let new_nonce = 50 - 20; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + assert!(result.errors.is_empty()) + } + + #[test] + fn validate_identity_nonce_in_close_future() { + let tip = 50 | 0x0FFF000000000000; + let new_nonce = 50 + 24; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + assert!(result.errors.is_empty()) + } +} diff --git a/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs index b5df08e1746..2d400838b62 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs @@ -4,7 +4,7 @@ use crate::identity::identity_public_key::contract_bounds::ContractBounds::{ }; use crate::ProtocolError; use bincode::{Decode, Encode}; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Serialize}; pub type ContractBoundsType = u8; diff --git a/packages/rs-dpp/src/identity/identity_public_key/key_type.rs b/packages/rs-dpp/src/identity/identity_public_key/key_type.rs index edf601b4ca9..8f4ad7bb5a7 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/key_type.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/key_type.rs @@ -1,11 +1,16 @@ +#[cfg(feature = "random-public-keys")] use crate::util::hash::ripemd160_sha256; use anyhow::bail; use bincode::{Decode, Encode}; #[cfg(feature = "cbor")] use ciborium::value::Value as CborValue; +#[cfg(feature = "random-public-keys")] use dashcore::secp256k1::rand::rngs::StdRng as EcdsaRng; +#[cfg(feature = "random-public-keys")] use dashcore::secp256k1::rand::SeedableRng; +#[cfg(feature = "random-public-keys")] use dashcore::secp256k1::Secp256k1; +#[cfg(feature = "random-public-keys")] use dashcore::Network; use itertools::Itertools; use lazy_static::lazy_static; @@ -13,7 +18,9 @@ use lazy_static::lazy_static; use crate::fee::Credits; use crate::version::PlatformVersion; use crate::ProtocolError; +#[cfg(feature = "random-public-keys")] use rand::rngs::StdRng; +#[cfg(feature = "random-public-keys")] use rand::Rng; use serde_repr::{Deserialize_repr, Serialize_repr}; use std::collections::HashMap; @@ -34,8 +41,11 @@ use std::convert::TryFrom; PartialOrd, Encode, Decode, + Default, + strum::EnumIter, )] pub enum KeyType { + #[default] ECDSA_SECP256K1 = 0, BLS12_381 = 1, ECDSA_HASH160 = 2, @@ -43,14 +53,8 @@ pub enum KeyType { EDDSA_25519_HASH160 = 4, } -impl Default for KeyType { - fn default() -> Self { - KeyType::ECDSA_SECP256K1 - } -} - lazy_static! { - static ref KEY_TYPE_SIZES: HashMap = vec![ + static ref KEY_TYPE_SIZES: HashMap = [ (KeyType::ECDSA_SECP256K1, 33), (KeyType::BLS12_381, 48), (KeyType::ECDSA_HASH160, 20), @@ -73,6 +77,17 @@ impl KeyType { KEY_TYPE_SIZES[self] } + /// All key types + pub fn all_key_types() -> [KeyType; 5] { + [ + Self::ECDSA_SECP256K1, + Self::BLS12_381, + Self::ECDSA_HASH160, + Self::BIP13_SCRIPT_HASH, + Self::EDDSA_25519_HASH160, + ] + } + /// Are keys of this type unique? pub fn is_unique_key_type(&self) -> bool { match self { @@ -90,11 +105,36 @@ impl KeyType { ) -> Result { match platform_version.dpp.costs.signature_verify { 0 => Ok(match self { - KeyType::ECDSA_SECP256K1 => 3000, - KeyType::BLS12_381 => 6000, - KeyType::ECDSA_HASH160 => 4000, - KeyType::BIP13_SCRIPT_HASH => 6000, - KeyType::EDDSA_25519_HASH160 => 3000, + KeyType::ECDSA_SECP256K1 => { + platform_version + .fee_version + .signature + .verify_signature_ecdsa_secp256k1 + } + KeyType::BLS12_381 => { + platform_version + .fee_version + .signature + .verify_signature_bls12_381 + } + KeyType::ECDSA_HASH160 => { + platform_version + .fee_version + .signature + .verify_signature_ecdsa_hash160 + } + KeyType::BIP13_SCRIPT_HASH => { + platform_version + .fee_version + .signature + .verify_signature_bip13_script_hash + } + KeyType::EDDSA_25519_HASH160 => { + platform_version + .fee_version + .signature + .verify_signature_eddsa25519_hash160 + } }), version => Err(ProtocolError::UnknownVersionMismatch { method: "KeyType::signature_verify_cost".to_string(), diff --git a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs index 3f70f1a6a81..6978a3035db 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs @@ -5,9 +5,9 @@ use crate::ProtocolError; pub use v0::*; impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKey { - fn hash(&self) -> Result<[u8; 20], ProtocolError> { + fn public_key_hash(&self) -> Result<[u8; 20], ProtocolError> { match self { - IdentityPublicKey::V0(v0) => v0.hash(), + IdentityPublicKey::V0(v0) => v0.public_key_hash(), } } } diff --git a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs index 350721baae7..7b656292e33 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs @@ -2,5 +2,5 @@ use crate::ProtocolError; pub trait IdentityPublicKeyHashMethodsV0 { /// Get the original public key hash - fn hash(&self) -> Result<[u8; 20], ProtocolError>; + fn public_key_hash(&self) -> Result<[u8; 20], ProtocolError>; } diff --git a/packages/rs-dpp/src/identity/identity_public_key/purpose.rs b/packages/rs-dpp/src/identity/identity_public_key/purpose.rs index f192d4dedf3..dbadfa57480 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/purpose.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/purpose.rs @@ -1,4 +1,4 @@ -use crate::identity::Purpose::{AUTHENTICATION, DECRYPTION, ENCRYPTION, SYSTEM, VOTING, WITHDRAW}; +use crate::identity::Purpose::{AUTHENTICATION, DECRYPTION, ENCRYPTION, SYSTEM, TRANSFER, VOTING}; use anyhow::bail; use bincode::{Decode, Encode}; #[cfg(feature = "cbor")] @@ -20,25 +20,41 @@ use std::convert::TryFrom; PartialOrd, Encode, Decode, + Default, + strum::EnumIter, )] pub enum Purpose { /// at least one authentication key must be registered for all security levels + #[default] AUTHENTICATION = 0, /// this key cannot be used for signing documents ENCRYPTION = 1, /// this key cannot be used for signing documents DECRYPTION = 2, - /// this key cannot be used for signing documents - WITHDRAW = 3, + /// this key is used to sign credit transfer and withdrawal state transitions + TRANSFER = 3, /// this key cannot be used for signing documents SYSTEM = 4, /// this key cannot be used for signing documents VOTING = 5, } -impl Default for Purpose { - fn default() -> Self { - Purpose::AUTHENTICATION +impl From for [u8; 1] { + fn from(purpose: Purpose) -> Self { + [purpose as u8] + } +} + +impl From for &'static [u8; 1] { + fn from(purpose: Purpose) -> Self { + match purpose { + AUTHENTICATION => &[0], + ENCRYPTION => &[1], + DECRYPTION => &[2], + TRANSFER => &[3], + SYSTEM => &[4], + VOTING => &[5], + } } } @@ -49,7 +65,22 @@ impl TryFrom for Purpose { 0 => Ok(AUTHENTICATION), 1 => Ok(ENCRYPTION), 2 => Ok(DECRYPTION), - 3 => Ok(WITHDRAW), + 3 => Ok(TRANSFER), + 4 => Ok(SYSTEM), + 5 => Ok(VOTING), + value => bail!("unrecognized purpose: {}", value), + } + } +} + +impl TryFrom for Purpose { + type Error = anyhow::Error; + fn try_from(value: i32) -> Result { + match value { + 0 => Ok(AUTHENTICATION), + 1 => Ok(ENCRYPTION), + 2 => Ok(DECRYPTION), + 3 => Ok(TRANSFER), 4 => Ok(SYSTEM), 5 => Ok(VOTING), value => bail!("unrecognized purpose: {}", value), @@ -71,12 +102,12 @@ impl std::fmt::Display for Purpose { impl Purpose { /// The full range of purposes - pub fn full_range() -> [Purpose; 4] { - [AUTHENTICATION, ENCRYPTION, DECRYPTION, WITHDRAW] + pub fn full_range() -> [Purpose; 5] { + [AUTHENTICATION, ENCRYPTION, DECRYPTION, TRANSFER, VOTING] } /// Just the authentication and withdraw purposes - pub fn authentication_withdraw() -> [Purpose; 2] { - [AUTHENTICATION, WITHDRAW] + pub fn searchable_purposes() -> [Purpose; 3] { + [AUTHENTICATION, TRANSFER, VOTING] } /// Just the encryption and decryption purposes pub fn encryption_decryption() -> [Purpose; 2] { @@ -84,6 +115,6 @@ impl Purpose { } /// The last purpose pub fn last() -> Purpose { - Self::WITHDRAW + Self::TRANSFER } } diff --git a/packages/rs-dpp/src/identity/identity_public_key/random.rs b/packages/rs-dpp/src/identity/identity_public_key/random.rs index 80c28b98296..0dea7a5dee2 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/random.rs @@ -1,9 +1,10 @@ use crate::identity::identity_public_key::v0::IdentityPublicKeyV0; -use crate::identity::{IdentityPublicKey, KeyCount, KeyID}; +use crate::identity::{IdentityPublicKey, KeyCount, KeyID, KeyType, Purpose, SecurityLevel}; use crate::version::PlatformVersion; use crate::ProtocolError; +use crate::identity::contract_bounds::ContractBounds; use rand::rngs::StdRng; use rand::SeedableRng; @@ -243,6 +244,60 @@ impl IdentityPublicKey { } } + /// Generates a random key based on the platform version. + /// + /// # Parameters + /// + /// * `id`: The `KeyID` for the generated key. + /// * `rng`: A mutable reference to a random number generator of type `StdRng`. + /// * `used_key_matrix`: An optional tuple that contains the count of keys that have already been used + /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. + /// * `platform_version`: The platform version which determines the structure of the identity key. + /// + /// # Returns + /// + /// * `Result`: If successful, returns an instance of `Self`. + /// In case of an error, it returns a `ProtocolError`. + /// + /// # Errors + /// + /// * `ProtocolError::PublicKeyGenerationError`: This error is returned if too many keys have already been created. + /// * `ProtocolError::UnknownVersionMismatch`: This error is returned if the provided platform version is not recognized. + /// + pub fn random_key_with_known_attributes( + id: KeyID, + rng: &mut StdRng, + purpose: Purpose, + security_level: SecurityLevel, + key_type: KeyType, + contract_bounds: Option, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + match platform_version + .dpp + .identity_versions + .identity_key_structure_version + { + 0 => { + let (key, private_key) = IdentityPublicKeyV0::random_key_with_known_attributes( + id, + rng, + purpose, + security_level, + key_type, + contract_bounds, + platform_version, + )?; + Ok((key.into(), private_key)) + } + version => Err(ProtocolError::UnknownVersionMismatch { + method: "IdentityPublicKey::random_key_with_known_attributes".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + /// Generates a random ECDSA master authentication public key along with its corresponding private key. /// /// This method constructs a random ECDSA (using the secp256k1 curve) master authentication public key @@ -287,6 +342,56 @@ impl IdentityPublicKey { } } + pub fn random_voting_key_with_rng( + id: KeyID, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + match platform_version + .dpp + .identity_versions + .identity_key_structure_version + { + 0 => { + let (key, private_key) = + IdentityPublicKeyV0::random_voting_key_with_rng(id, rng, platform_version)?; + Ok((key.into(), private_key)) + } + version => Err(ProtocolError::UnknownVersionMismatch { + method: "IdentityPublicKey::random_voting_key_with_rng".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + /// Generates a random ECDSA master-level authentication public key along with its corresponding private key. + /// + /// This method constructs a random ECDSA (using the secp256k1 curve) high-level authentication public key + /// and returns both the public key and its corresponding private key. + /// + /// # Parameters + /// + /// * `id`: The `KeyID` for the generated key. + /// * `seed`: A seed that will create a random number generator `StdRng`. + /// + /// # Returns + /// + /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, + /// and the second element is the corresponding private key. + /// + pub fn random_ecdsa_master_authentication_key( + id: KeyID, + seed: Option, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + let mut rng = match seed { + None => StdRng::from_entropy(), + Some(seed_value) => StdRng::seed_from_u64(seed_value), + }; + Self::random_ecdsa_master_authentication_key_with_rng(id, &mut rng, platform_version) + } + /// Generates a random ECDSA critical-level authentication public key along with its corresponding private key. /// /// This method constructs a random ECDSA (using the secp256k1 curve) high-level authentication public key @@ -507,6 +612,9 @@ impl IdentityPublicKey { used_key_matrix[0] = true; used_key_matrix[1] = true; used_key_matrix[2] = true; + used_key_matrix[4] = true; //also a master key + used_key_matrix[8] = true; //also a master key + used_key_matrix[12] = true; //also a master key main_keys.extend((3..key_count).map(|i| { Self::random_authentication_key_with_private_key_with_rng( i, diff --git a/packages/rs-dpp/src/identity/identity_public_key/security_level.rs b/packages/rs-dpp/src/identity/identity_public_key/security_level.rs index ffb3d316c10..978134016b0 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/security_level.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/security_level.rs @@ -1,10 +1,13 @@ -use anyhow::bail; use bincode::{Decode, Encode}; #[cfg(feature = "cbor")] use ciborium::value::Value as CborValue; use serde_repr::{Deserialize_repr, Serialize_repr}; +use crate::consensus::basic::data_contract::UnknownSecurityLevelError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; use std::convert::TryFrom; #[repr(u8)] @@ -21,20 +24,17 @@ use std::convert::TryFrom; Ord, Encode, Decode, + Default, + strum::EnumIter, )] pub enum SecurityLevel { MASTER = 0, CRITICAL = 1, + #[default] HIGH = 2, MEDIUM = 3, } -impl Default for SecurityLevel { - fn default() -> Self { - SecurityLevel::MASTER - } -} - #[cfg(feature = "cbor")] impl Into for SecurityLevel { fn into(self) -> CborValue { @@ -43,14 +43,19 @@ impl Into for SecurityLevel { } impl TryFrom for SecurityLevel { - type Error = anyhow::Error; - fn try_from(value: u8) -> Result { + type Error = ProtocolError; + fn try_from(value: u8) -> Result { match value { 0 => Ok(Self::MASTER), 1 => Ok(Self::CRITICAL), 2 => Ok(Self::HIGH), 3 => Ok(Self::MEDIUM), - value => bail!("unrecognized security level: {}", value), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownSecurityLevelError( + UnknownSecurityLevelError::new(vec![0, 1, 2, 3], value), + )) + .into(), + )), } } } @@ -69,6 +74,19 @@ impl SecurityLevel { pub fn highest_level() -> SecurityLevel { Self::MASTER } + pub fn stronger_security_than(self: SecurityLevel, rhs: SecurityLevel) -> bool { + // Example: + // self: High 2 rhs: Master 0 + // Master has a stronger security level than high + // We expect False + // High < Master + // 2 < 0 <=> false + (self as u8) < (rhs as u8) + } + + pub fn stronger_or_equal_security_than(self: SecurityLevel, rhs: SecurityLevel) -> bool { + (self as u8) <= (rhs as u8) + } } impl std::fmt::Display for SecurityLevel { diff --git a/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs index 669334b6d5e..05232ed22a1 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs @@ -10,7 +10,7 @@ use platform_value::Bytes20; impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { /// Get the original public key hash - fn hash(&self) -> Result<[u8; 20], ProtocolError> { + fn public_key_hash(&self) -> Result<[u8; 20], ProtocolError> { if self.data.is_empty() { return Err(ProtocolError::EmptyPublicKeyDataError); } diff --git a/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs b/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs index 29c1cea85b5..13afdd673f6 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs @@ -1,7 +1,8 @@ +use crate::identity::contract_bounds::ContractBounds; use crate::identity::identity_public_key::v0::IdentityPublicKeyV0; -use crate::identity::KeyType::ECDSA_SECP256K1; -use crate::identity::Purpose::AUTHENTICATION; -use crate::identity::SecurityLevel::{CRITICAL, HIGH, MASTER}; +use crate::identity::KeyType::{ECDSA_HASH160, ECDSA_SECP256K1}; +use crate::identity::Purpose::{AUTHENTICATION, VOTING}; +use crate::identity::SecurityLevel::{CRITICAL, HIGH, MASTER, MEDIUM}; use crate::identity::{KeyCount, KeyID, KeyType, Purpose, SecurityLevel}; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -115,6 +116,32 @@ impl IdentityPublicKeyV0 { )) } + pub fn random_key_with_known_attributes( + id: KeyID, + rng: &mut StdRng, + purpose: Purpose, + security_level: SecurityLevel, + key_type: KeyType, + contract_bounds: Option, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + let read_only = false; + let (public_data, private_data) = + key_type.random_public_and_private_key_data(rng, platform_version)?; + let data = BinaryData::new(public_data); + let identity_public_key = IdentityPublicKeyV0 { + id, + key_type, + purpose, + security_level, + read_only, + disabled_at: None, + data, + contract_bounds, + }; + Ok((identity_public_key, private_data)) + } + pub fn random_key_with_rng( id: KeyID, rng: &mut StdRng, @@ -192,6 +219,32 @@ impl IdentityPublicKeyV0 { )) } + pub fn random_voting_key_with_rng( + id: KeyID, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + let key_type = ECDSA_HASH160; + let purpose = VOTING; + let security_level = MEDIUM; + let read_only = false; + let (data, private_data) = + key_type.random_public_and_private_key_data(rng, platform_version)?; + Ok(( + IdentityPublicKeyV0 { + id, + key_type, + purpose, + security_level, + read_only, + disabled_at: None, + data: data.into(), + contract_bounds: None, + }, + private_data, + )) + } + pub fn random_ecdsa_critical_level_authentication_key_with_rng( id: KeyID, rng: &mut StdRng, diff --git a/packages/rs-dpp/src/identity/methods/create_basic_identity/mod.rs b/packages/rs-dpp/src/identity/methods/create_basic_identity/mod.rs index c4888be4b48..2da82b989ff 100644 --- a/packages/rs-dpp/src/identity/methods/create_basic_identity/mod.rs +++ b/packages/rs-dpp/src/identity/methods/create_basic_identity/mod.rs @@ -2,12 +2,13 @@ mod v0; use crate::prelude::Identity; use crate::ProtocolError; +use platform_value::Identifier; use platform_version::version::PlatformVersion; impl Identity { pub fn create_basic_identity( - id: [u8; 32], + id: Identifier, platform_version: &PlatformVersion, ) -> Result { match platform_version diff --git a/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs b/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs index a385272e662..638a8603379 100644 --- a/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs +++ b/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs @@ -4,9 +4,10 @@ use platform_value::Identifier; use std::collections::BTreeMap; impl Identity { - pub(super) fn create_basic_identity_v0(id: [u8; 32]) -> Self { + #[inline(always)] + pub(super) fn create_basic_identity_v0(id: Identifier) -> Self { IdentityV0 { - id: Identifier::new(id), + id, revision: 0, balance: 0, public_keys: BTreeMap::new(), diff --git a/packages/rs-dpp/src/identity/mod.rs b/packages/rs-dpp/src/identity/mod.rs index 4260fccf522..f592c045d93 100644 --- a/packages/rs-dpp/src/identity/mod.rs +++ b/packages/rs-dpp/src/identity/mod.rs @@ -1,6 +1,5 @@ pub use credits_converter::*; -pub use credits_converter::*; -pub use get_biggest_possible_identity::*; + pub use identity::*; #[cfg(feature = "client")] pub use identity_facade::*; @@ -19,16 +18,17 @@ pub mod signer; pub mod accessors; pub(crate) mod conversion; -mod fields; +pub mod fields; +pub mod identities_contract_keys; #[cfg(feature = "client")] mod identity_facade; #[cfg(feature = "factories")] pub mod identity_factory; -mod methods; +pub mod identity_nonce; +pub mod methods; #[cfg(feature = "random-identities")] pub mod random; -mod v0; -pub mod versions; +pub mod v0; pub use fields::*; diff --git a/packages/rs-dpp/src/identity/signer.rs b/packages/rs-dpp/src/identity/signer.rs index ff6d12d477c..549a55da42b 100644 --- a/packages/rs-dpp/src/identity/signer.rs +++ b/packages/rs-dpp/src/identity/signer.rs @@ -1,8 +1,9 @@ use crate::prelude::IdentityPublicKey; use crate::ProtocolError; use platform_value::BinaryData; +use std::fmt::Debug; -pub trait Signer { +pub trait Signer: Sync + Debug { /// the public key bytes are only used to look up the private key fn sign( &self, diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs index ba16c593860..0a7b020cc1a 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs @@ -1,9 +1,8 @@ use ::serde::{Deserialize, Serialize}; use platform_value::Value; use std::convert::TryFrom; -use std::io; -use crate::util::hash::hash; +use crate::util::hash::hash_double; use crate::{identifier::Identifier, ProtocolError}; pub use bincode::{Decode, Encode}; use dashcore::OutPoint; @@ -44,14 +43,11 @@ impl ChainAssetLockProof { } /// Create identifier - pub fn create_identifier(&self) -> Result { - let output_vec: Vec = self - .out_point - .try_into() - .map_err(|e: io::Error| ProtocolError::EncodingError(e.to_string()))?; + pub fn create_identifier(&self) -> Identifier { + let outpoint_bytes: [u8; 36] = self.out_point.into(); - let hash = hash(output_vec); + let hash = hash_double(outpoint_bytes.as_slice()); - Ok(Identifier::new(hash)) + Identifier::new(hash) } } diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs index 5d11032960d..a86b732fe97 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs @@ -1,23 +1,23 @@ use std::convert::{TryFrom, TryInto}; -use std::io; use dashcore::consensus::{deserialize, Encodable}; use dashcore::transaction::special_transaction::TransactionPayload; use dashcore::{InstantLock, OutPoint, Transaction, TxIn, TxOut}; use platform_value::{BinaryData, Value}; -use crate::consensus::basic::identity::IdentityAssetLockProofLockedTransactionMismatchError; +#[cfg(feature = "validation")] +use crate::identity::state_transition::asset_lock_proof::instant::methods; +#[cfg(feature = "validation")] +use platform_version::version::PlatformVersion; use serde::de::Error as DeError; use serde::ser::Error as SerError; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use platform_version::version::{FeatureVersion, PlatformVersion}; -use crate::identity::state_transition::asset_lock_proof::instant::methods; -use crate::identity::state_transition::asset_lock_proof::validate_asset_lock_transaction_structure::validate_asset_lock_transaction_structure; use crate::prelude::Identifier; #[cfg(feature = "cbor")] use crate::util::cbor_value::CborCanonicalMap; -use crate::util::hash::hash; +use crate::util::hash::hash_double; +#[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; use crate::ProtocolError; @@ -28,11 +28,11 @@ use crate::ProtocolError; #[derive(Clone, Debug, Eq, PartialEq)] pub struct InstantAssetLockProof { /// The transaction's Instant Lock - instant_lock: InstantLock, + pub instant_lock: InstantLock, /// Asset Lock Special Transaction - transaction: Transaction, + pub transaction: Transaction, /// Index of the output in the transaction payload - output_index: u32, + pub output_index: u32, } impl Serialize for InstantAssetLockProof { @@ -131,11 +131,9 @@ impl InstantAssetLockProof { ProtocolError::IdentifierError(String::from("No output at a given index")) })?; - let output_vec: Vec = outpoint - .try_into() - .map_err(|e: io::Error| ProtocolError::EncodingError(e.to_string()))?; + let outpoint_bytes: [u8; 36] = outpoint.into(); - let hash = hash(output_vec); + let hash = hash_double(outpoint_bytes.as_slice()); Ok(Identifier::new(hash)) } diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs index 9743445699b..6cd29ce70e2 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs @@ -1,3 +1,4 @@ mod v0; +#[allow(unused_imports)] // Removing causes build failures; yet clippy insists it's unused pub(in crate::identity::state_transition::asset_lock_proof::instant) use v0::validate_instant_asset_lock_proof_structure_v0; diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs index 395190bec90..2e97ad74808 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs @@ -1,18 +1,20 @@ use std::convert::{TryFrom, TryInto}; -use dashcore::{OutPoint, Transaction, TxOut}; +use dashcore::{OutPoint, Transaction}; use serde::{Deserialize, Deserializer, Serialize}; pub use bincode::{Decode, Encode}; -pub use chain::*; + pub use instant::*; use platform_value::Value; +#[cfg(feature = "validation")] use platform_version::version::PlatformVersion; use serde::de::Error; use crate::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; use crate::prelude::Identifier; +#[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; use crate::{ProtocolError, SerdeParsingError}; @@ -173,7 +175,7 @@ impl AssetLockProof { pub fn create_identifier(&self) -> Result { match self { AssetLockProof::Instant(instant_proof) => instant_proof.create_identifier(), - AssetLockProof::Chain(chain_proof) => chain_proof.create_identifier(), + AssetLockProof::Chain(chain_proof) => Ok(chain_proof.create_identifier()), } } diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs index 64e8cdcd7c7..42255735b95 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs @@ -1,6 +1,6 @@ -use crate::validation::SimpleConsensusValidationResult; +use crate::validation::ConsensusValidationResult; use crate::ProtocolError; -use dashcore::Transaction; +use dashcore::{Transaction, TxOut}; use platform_version::version::PlatformVersion; mod v0; @@ -10,7 +10,7 @@ pub fn validate_asset_lock_transaction_structure( transaction: &Transaction, output_index: u32, platform_version: &PlatformVersion, -) -> Result { +) -> Result, ProtocolError> { match platform_version .dpp .state_transitions @@ -18,7 +18,10 @@ pub fn validate_asset_lock_transaction_structure( .asset_locks .validate_asset_lock_transaction_structure { - 0 => v0::validate_asset_lock_transaction_structure_v0(transaction, output_index), + 0 => Ok(v0::validate_asset_lock_transaction_structure_v0( + transaction, + output_index, + )), version => Err(ProtocolError::UnknownVersionMismatch { method: "validate_asset_lock_transaction_structure".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs index 0a3bb4b1b28..e55d94cc4b4 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs @@ -2,49 +2,42 @@ use crate::consensus::basic::identity::{ IdentityAssetLockTransactionOutputNotFoundError, InvalidIdentityAssetLockTransactionError, InvalidIdentityAssetLockTransactionOutputError, }; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; +use crate::validation::ConsensusValidationResult; use dashcore::transaction::special_transaction::TransactionPayload; -use dashcore::Transaction; +use dashcore::{Transaction, TxOut}; /// Validates asset lock transaction structure -pub fn validate_asset_lock_transaction_structure_v0( +#[inline(always)] +pub(super) fn validate_asset_lock_transaction_structure_v0( transaction: &Transaction, output_index: u32, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - +) -> ConsensusValidationResult { // It must be an Asset Lock Special Transaction let Some(TransactionPayload::AssetLockPayloadType(ref payload)) = transaction.special_transaction_payload else { - return Ok(SimpleConsensusValidationResult::new_with_error( + return ConsensusValidationResult::new_with_error( InvalidIdentityAssetLockTransactionError::new( "Funding transaction must have an Asset Lock Special Transaction Payload", ) .into(), - )); + ); }; // Output index should point to existing funding output in payload let Some(output) = payload.credit_outputs.get(output_index as usize) else { - result.add_error(IdentityAssetLockTransactionOutputNotFoundError::new( - output_index as usize, - )); - - return Ok(result); + return ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutputNotFoundError::new(output_index as usize).into(), + ); }; // Output should be P2PKH if !output.script_pubkey.is_p2pkh() { - result.add_error(InvalidIdentityAssetLockTransactionOutputError::new( - output_index as usize, - )); - - return Ok(result); + //Todo: better error + ConsensusValidationResult::new_with_error( + InvalidIdentityAssetLockTransactionOutputError::new(output_index as usize).into(), + ) + } else { + ConsensusValidationResult::new_with_data(output.clone()) } - - // TODO: Do we need to perform whole validation what Core supposed to do? - - Ok(result) } diff --git a/packages/rs-dpp/src/identity/state_transition/mod.rs b/packages/rs-dpp/src/identity/state_transition/mod.rs index a2b4256eb68..874928f8c58 100644 --- a/packages/rs-dpp/src/identity/state_transition/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/mod.rs @@ -16,3 +16,11 @@ pub trait AssetLockProved { /// Get asset lock proof fn asset_lock_proof(&self) -> &AssetLockProof; } + +/// Only state transitions funded with Asset Lock Transactions have Asset Lock Proofs +pub trait OptionallyAssetLockProved { + /// Returns asset lock proof if state transition implements it + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + None + } +} diff --git a/packages/rs-dpp/src/identity/v0/mod.rs b/packages/rs-dpp/src/identity/v0/mod.rs index 82180d7183f..47bd892074e 100644 --- a/packages/rs-dpp/src/identity/v0/mod.rs +++ b/packages/rs-dpp/src/identity/v0/mod.rs @@ -3,16 +3,22 @@ mod conversion; pub mod random; use std::collections::BTreeMap; +#[cfg(feature = "identity-value-conversion")] use std::convert::TryFrom; use std::hash::{Hash, Hasher}; +#[cfg(feature = "identity-value-conversion")] use platform_value::Value; +#[cfg(feature = "identity-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::identity::{IdentityPublicKey, KeyID, PartialIdentity}; use crate::prelude::Revision; -use crate::{errors::ProtocolError, identifier::Identifier}; +#[cfg(feature = "identity-value-conversion")] +use crate::errors::ProtocolError; +use crate::identifier::Identifier; +#[cfg(feature = "identity-serialization")] use bincode::{Decode, Encode}; /// Implement the Identity. Identity is a low-level construct that provides the foundation @@ -24,6 +30,7 @@ use bincode::{Decode, Encode}; derive(Serialize, Deserialize), serde(rename_all = "camelCase") )] + pub struct IdentityV0 { pub id: Identifier, #[cfg_attr( diff --git a/packages/rs-dpp/src/identity/v0/random.rs b/packages/rs-dpp/src/identity/v0/random.rs index 9e78a878da1..2be4a34cfe1 100644 --- a/packages/rs-dpp/src/identity/v0/random.rs +++ b/packages/rs-dpp/src/identity/v0/random.rs @@ -57,7 +57,8 @@ impl IdentityV0 { let balance = rng.gen::() >> 20; //around 175 Dash as max let (public_keys, private_keys): (BTreeMap, I) = IdentityPublicKey::main_keys_with_random_authentication_keys_with_private_keys_with_rng( - key_count, rng, + key_count, + rng, platform_version, )? .into_iter() diff --git a/packages/rs-dpp/src/identity/versions.rs b/packages/rs-dpp/src/identity/versions.rs deleted file mode 100644 index ed0b36c2287..00000000000 --- a/packages/rs-dpp/src/identity/versions.rs +++ /dev/null @@ -1,33 +0,0 @@ -use crate::identity::Identity; -use crate::version::{FeatureVersion, PlatformVersion, LATEST_PLATFORM_VERSION}; - -/// Versions -impl Identity { - /// Returns the default FeatureVersion for a given platform version. - /// - /// # Arguments - /// - /// * `platform_version` - A reference to the PlatformVersion object - pub fn default_version_on(platform_version: &PlatformVersion) -> FeatureVersion { - platform_version.identity.default_current_version - } - - /// Returns the default FeatureVersion for the latest platform version. - pub fn default_version() -> FeatureVersion { - LATEST_PLATFORM_VERSION.identity.default_current_version - } - - /// Returns the latest FeatureVersion supported by a given platform version. - /// - /// # Arguments - /// - /// * `platform_version` - A reference to the PlatformVersion object - pub fn latest_version_on(platform_version: &PlatformVersion) -> FeatureVersion { - platform_version.identity.max_version - } - - /// Returns the latest FeatureVersion supported by the latest platform version. - pub fn latest_version() -> FeatureVersion { - LATEST_PLATFORM_VERSION.identity.max_version - } -} diff --git a/packages/rs-dpp/src/lib.rs b/packages/rs-dpp/src/lib.rs index 9a648df7069..d2dc8b7f6e3 100644 --- a/packages/rs-dpp/src/lib.rs +++ b/packages/rs-dpp/src/lib.rs @@ -35,20 +35,31 @@ mod bls; #[cfg(feature = "fixtures-and-mocks")] pub mod tests; +pub mod asset_lock; pub mod balances; pub mod block; +/// Core subsidy +pub mod core_subsidy; pub mod fee; +pub mod nft; +pub mod prefunded_specialized_balance; pub mod serialization; -#[cfg(feature = "validation")] +#[cfg(any( + feature = "message-signing", + feature = "message-signature-verification" +))] pub mod signing; #[cfg(feature = "system_contracts")] pub mod system_data_contracts; +pub mod voting; pub mod withdrawal; pub use async_trait; + pub use bls::*; pub mod prelude { + pub use crate::data_contract::DataContract; #[cfg(feature = "extended-document")] pub use crate::document::ExtendedDocument; @@ -59,14 +70,29 @@ pub mod prelude { pub use crate::identity::IdentityPublicKey; #[cfg(feature = "validation")] pub use crate::validation::ConsensusValidationResult; + + pub type BlockHeight = u64; + + pub type CoreBlockHeight = u32; pub type TimestampMillis = u64; + + pub type TimestampIncluded = bool; pub type Revision = u64; + pub type IdentityNonce = u64; + + /// UserFeeIncrease is the additional percentage of the processing fee. + /// A 1 here means we pay 1% more in processing fees. A 100 means we pay 100% more. + pub type UserFeeIncrease = u16; } pub use bincode; +#[cfg(all(not(target_arch = "wasm32"), feature = "bls-signatures"))] pub use bls_signatures; +#[cfg(feature = "system_contracts")] pub use data_contracts; +#[cfg(feature = "ed25519-dalek")] pub use ed25519_dalek; +#[cfg(feature = "jsonschema")] pub use jsonschema; pub use platform_serialization; pub use platform_value; diff --git a/packages/rs-dpp/src/nft/mod.rs b/packages/rs-dpp/src/nft/mod.rs new file mode 100644 index 00000000000..884906fb1e8 --- /dev/null +++ b/packages/rs-dpp/src/nft/mod.rs @@ -0,0 +1,55 @@ +use crate::consensus::basic::data_contract::UnknownTradeModeError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use std::fmt; +use std::fmt::{Display, Formatter}; + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum TradeMode { + None = 0, + DirectPurchase = 1, + // PublicOffer = 2, + // PrivateOffer = 3, +} + +impl TradeMode { + pub fn seller_sets_price(&self) -> bool { + match self { + TradeMode::None => false, + TradeMode::DirectPurchase => true, + // TradeMode::PublicOffer => true, //min price + // TradeMode::PrivateOffer => true, //min price + } + } +} + +impl Display for TradeMode { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + match self { + TradeMode::None => write!(f, "No Trading"), + TradeMode::DirectPurchase => write!(f, "Direct Purchase"), + // TradeMode::PublicOffer => write!(f, "Public Offer"), + // TradeMode::PrivateOffer => write!(f, "Private Offer"), + } + } +} + +impl TryFrom for TradeMode { + type Error = ProtocolError; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(Self::None), + 1 => Ok(Self::DirectPurchase), + // 2 => Ok(Self::PublicOffer), + // 3 => Ok(Self::PrivateOffer), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownTradeModeError( + UnknownTradeModeError::new(vec![0, 1], value), + )) + .into(), + )), + } + } +} diff --git a/packages/rs-dpp/src/prefunded_specialized_balance/mod.rs b/packages/rs-dpp/src/prefunded_specialized_balance/mod.rs new file mode 100644 index 00000000000..72f0a1e9836 --- /dev/null +++ b/packages/rs-dpp/src/prefunded_specialized_balance/mod.rs @@ -0,0 +1,3 @@ +use platform_value::Identifier; + +pub type PrefundedSpecializedBalanceIdentifier = Identifier; diff --git a/packages/rs-dpp/src/schema/document/v0/documentBase.json b/packages/rs-dpp/src/schema/document/v0/documentBase.json index d745088cd11..a8ee99ae9cb 100644 --- a/packages/rs-dpp/src/schema/document/v0/documentBase.json +++ b/packages/rs-dpp/src/schema/document/v0/documentBase.json @@ -41,6 +41,34 @@ "$updatedAt": { "type": "integer", "minimum": 0 + }, + "$transferredAt": { + "type": "integer", + "minimum": 0 + }, + "$createdAtBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$updatedAtBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$transferredAtBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$createdAtCoreBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$updatedAtCoreBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$transferredAtCoreBlockHeight": { + "type": "integer", + "minimum": 0 } }, "required": [ diff --git a/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json b/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json index ff241acdfcb..b31632dd9ec 100644 --- a/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json +++ b/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json @@ -28,10 +28,6 @@ "minimum": 0, "description": "Identity update revision" }, - "publicKeysDisabledAt": { - "type": "integer", - "minimum": 0 - }, "addPublicKeys": { "type": "array", "minItems": 1, @@ -53,14 +49,6 @@ "minimum": 0 } }, - "dependentRequired": { - "disablePublicKeys": [ - "publicKeysDisabledAt" - ], - "publicKeysDisabledAt": [ - "disablePublicKeys" - ] - }, "anyOf": [ { "type": "object", diff --git a/packages/rs-dpp/src/serialization/serialization_traits.rs b/packages/rs-dpp/src/serialization/serialization_traits.rs index 9c83fe4a566..502d2a6eb65 100644 --- a/packages/rs-dpp/src/serialization/serialization_traits.rs +++ b/packages/rs-dpp/src/serialization/serialization_traits.rs @@ -1,10 +1,17 @@ +#[cfg(any( + feature = "message-signature-verification", + feature = "message-signing" +))] use crate::identity::KeyType; use serde::{Deserialize, Serialize}; +#[cfg(feature = "message-signature-verification")] use crate::validation::SimpleConsensusValidationResult; -use crate::version::{FeatureVersion, PlatformVersion}; -use crate::{BlsModule, ProtocolError}; +use crate::version::PlatformVersion; +#[cfg(feature = "message-signing")] +use crate::BlsModule; +use crate::ProtocolError; use platform_value::Value; pub trait Signable { @@ -93,7 +100,7 @@ pub trait PlatformDeserializableWithPotentialValidationFromVersionedStructure { /// DataContractV1 (if system version is 1) fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -112,7 +119,7 @@ pub trait PlatformDeserializableWithBytesLenFromVersionedStructure { /// DataContractV1 (if system version is 1) fn versioned_deserialize_with_bytes_len( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result<(Self, usize), ProtocolError> where @@ -159,13 +166,15 @@ pub trait ValueConvertible<'a>: Serialize + Deserialize<'a> { } pub trait PlatformMessageSignable { + #[cfg(feature = "message-signature-verification")] fn verify_signature( &self, public_key_type: KeyType, public_key_data: &[u8], signature: &[u8], - ) -> Result; + ) -> SimpleConsensusValidationResult; + #[cfg(feature = "message-signing")] fn sign_by_private_key( &self, private_key: &[u8], diff --git a/packages/rs-dpp/src/signing.rs b/packages/rs-dpp/src/signing.rs index ac2c7c511d3..96c810ff362 100644 --- a/packages/rs-dpp/src/signing.rs +++ b/packages/rs-dpp/src/signing.rs @@ -1,21 +1,23 @@ +#[cfg(feature = "message-signature-verification")] use crate::consensus::signature::{ BasicBLSError, BasicECDSAError, SignatureError, SignatureShouldNotBePresentError, }; use crate::identity::KeyType; use crate::serialization::PlatformMessageSignable; -#[cfg(any(feature = "state-transitions", feature = "validation"))] -use crate::state_transition::errors::InvalidIdentityPublicKeyTypeError; +#[cfg(feature = "message-signature-verification")] use crate::validation::SimpleConsensusValidationResult; +#[cfg(feature = "message-signing")] use crate::{BlsModule, ProtocolError}; use dashcore::signer; impl PlatformMessageSignable for &[u8] { + #[cfg(feature = "message-signature-verification")] fn verify_signature( &self, public_key_type: KeyType, public_key_data: &[u8], signature: &[u8], - ) -> Result { + ) -> SimpleConsensusValidationResult { let signable_data = self; match public_key_type { KeyType::ECDSA_SECP256K1 => { @@ -28,11 +30,11 @@ impl PlatformMessageSignable for &[u8] { // hex::encode(signable_data), // hex::encode(public_key_data) // )); - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::BLS12_381 => { @@ -40,66 +42,66 @@ impl PlatformMessageSignable for &[u8] { Ok(public_key) => public_key, Err(e) => { // dbg!(format!("bls public_key could not be recovered")); - return Ok(SimpleConsensusValidationResult::new_with_error( + return SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), - )); + ); } }; let signature = match bls_signatures::Signature::from_bytes(signature) { Ok(public_key) => public_key, Err(e) => { // dbg!(format!("bls signature could not be recovered")); - return Ok(SimpleConsensusValidationResult::new_with_error( + return SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), - )); + ); } }; if !public_key.verify(&signature, signable_data) { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new( "bls signature was incorrect".to_string(), )) .into(), - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::ECDSA_HASH160 => { if !signature.is_empty() { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::SignatureShouldNotBePresentError( SignatureShouldNotBePresentError::new("ecdsa_hash160 keys should not have a signature as that would reveal the public key".to_string()), ).into() - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::BIP13_SCRIPT_HASH => { if !signature.is_empty() { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::SignatureShouldNotBePresentError( SignatureShouldNotBePresentError::new("script hash keys should not have a signature as that would reveal the script".to_string()) - ).into())) + ).into()) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::EDDSA_25519_HASH160 => { if !signature.is_empty() { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::SignatureShouldNotBePresentError( SignatureShouldNotBePresentError::new("eddsa hash 160 keys should not have a signature as that would reveal the script".to_string()) ).into() - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } } } - + #[cfg(feature = "message-signing")] fn sign_by_private_key( &self, private_key: &[u8], @@ -119,9 +121,10 @@ impl PlatformMessageSignable for &[u8] { // https://github.com/dashevo/platform/blob/6b02b26e5cd3a7c877c5fdfe40c4a4385a8dda15/packages/js-dpp/lib/stateTransition/AbstractStateTransition.js#L187 // is to return the error for the BIP13_SCRIPT_HASH KeyType::BIP13_SCRIPT_HASH | KeyType::EDDSA_25519_HASH160 => { - Err(ProtocolError::InvalidIdentityPublicKeyTypeError( - InvalidIdentityPublicKeyTypeError::new(key_type), - )) + Err(ProtocolError::InvalidSigningKeyTypeError(format!( + "key type {} can not sign", + key_type + ))) } } } diff --git a/packages/rs-dpp/src/state_transition/abstract_state_transition.rs b/packages/rs-dpp/src/state_transition/abstract_state_transition.rs index 47ab0473811..7bd8e8f9f1f 100644 --- a/packages/rs-dpp/src/state_transition/abstract_state_transition.rs +++ b/packages/rs-dpp/src/state_transition/abstract_state_transition.rs @@ -1,12 +1,15 @@ use serde::Serialize; +#[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; pub mod state_transition_helpers { use super::*; use crate::ProtocolError; use platform_value::Value; + #[cfg(feature = "state-transition-json-conversion")] use std::convert::TryInto; + #[cfg(feature = "state-transition-json-conversion")] pub fn to_json<'a, I: IntoIterator>( serializable: impl Serialize, skip_signature_paths: I, diff --git a/packages/rs-dpp/src/state_transition/errors/mod.rs b/packages/rs-dpp/src/state_transition/errors/mod.rs index 59eb4570f6a..aa6cd9e5ed1 100644 --- a/packages/rs-dpp/src/state_transition/errors/mod.rs +++ b/packages/rs-dpp/src/state_transition/errors/mod.rs @@ -12,13 +12,18 @@ mod invalid_signature_public_key_error; mod public_key_mismatch_error; #[cfg(feature = "state-transition-validation")] mod public_key_security_level_not_met_error; -#[cfg(feature = "state-transition-validation")] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] mod state_transition_error; #[cfg(feature = "state-transition-validation")] mod state_transition_is_not_signed_error; #[cfg(any( + all(feature = "state-transitions", feature = "validation"), feature = "state-transition-validation", - feature = "state-transition-signing" + feature = "state-transition-signing", + feature = "state-transition-validation" ))] mod wrong_public_key_purpose_error; @@ -36,9 +41,17 @@ pub use invalid_signature_public_key_error::*; pub use public_key_mismatch_error::*; #[cfg(feature = "state-transition-validation")] pub use public_key_security_level_not_met_error::*; -#[cfg(feature = "state-transition-validation")] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] pub use state_transition_error::*; #[cfg(feature = "state-transition-validation")] pub use state_transition_is_not_signed_error::*; -#[cfg(feature = "state-transition-validation")] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation", + feature = "state-transition-signing", + feature = "state-transition-validation" +))] pub use wrong_public_key_purpose_error::*; diff --git a/packages/rs-dpp/src/state_transition/mod.rs b/packages/rs-dpp/src/state_transition/mod.rs index 73518cf73ed..879bb6e8713 100644 --- a/packages/rs-dpp/src/state_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/mod.rs @@ -1,4 +1,7 @@ use derive_more::From; +use documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use documents_batch_transition::document_transition::DocumentTransition; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use abstract_state_transition::state_transition_helpers; @@ -7,36 +10,69 @@ use platform_value::{BinaryData, Identifier}; pub use state_transition_types::*; use bincode::{Decode, Encode}; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use dashcore::signer; +#[cfg(feature = "state-transition-validation")] +use dashcore::signer::double_sha; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; +use platform_version::version::PlatformVersion; mod abstract_state_transition; -use crate::{BlsModule, ProtocolError}; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::BlsModule; +use crate::ProtocolError; mod state_transition_types; pub mod state_transition_factory; pub mod errors; -use crate::util::hash::{hash_to_vec, ripemd160_sha256}; +#[cfg(feature = "state-transition-signing")] +use crate::util::hash::ripemd160_sha256; +use crate::util::hash::{hash_double_to_vec, hash_single}; +pub mod proof_result; mod serialization; pub mod state_transitions; mod traits; // pub mod state_transition_fee; -pub use traits::*; - +#[cfg(feature = "state-transition-signing")] +use crate::consensus::signature::InvalidSignaturePublicKeySecurityLevelError; +#[cfg(feature = "state-transition-validation")] use crate::consensus::signature::{ - InvalidSignaturePublicKeySecurityLevelError, InvalidStateTransitionSignatureError, - PublicKeyIsDisabledError, SignatureError, + InvalidStateTransitionSignatureError, PublicKeyIsDisabledError, SignatureError, }; +#[cfg(feature = "state-transition-validation")] use crate::consensus::ConsensusError; +pub use traits::*; +use crate::balances::credits::CREDITS_PER_DUFF; +use crate::fee::Credits; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; -use crate::identity::{IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; +use crate::identity::state_transition::OptionallyAssetLockProved; +use crate::identity::Purpose; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::identity::{IdentityPublicKey, KeyType}; +use crate::identity::{KeyID, SecurityLevel}; +use crate::prelude::{AssetLockProof, UserFeeIncrease}; +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransitionSignable; pub use state_transitions::*; use crate::serialization::Signable; @@ -49,15 +85,13 @@ use crate::state_transition::data_contract_update_transition::{ use crate::state_transition::documents_batch_transition::{ DocumentsBatchTransition, DocumentsBatchTransitionSignable, }; -#[cfg(any( - feature = "state-transition-signing", - feature = "state-transition-validation" -))] +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::errors::InvalidSignaturePublicKeyError; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::errors::WrongPublicKeyPurposeError; #[cfg(feature = "state-transition-validation")] use crate::state_transition::errors::{ - InvalidIdentityPublicKeyTypeError, InvalidSignaturePublicKeyError, PublicKeyMismatchError, - StateTransitionIsNotSignedError, + InvalidIdentityPublicKeyTypeError, PublicKeyMismatchError, StateTransitionIsNotSignedError, }; use crate::state_transition::identity_create_transition::{ IdentityCreateTransition, IdentityCreateTransitionSignable, @@ -74,6 +108,10 @@ use crate::state_transition::identity_topup_transition::{ use crate::state_transition::identity_update_transition::{ IdentityUpdateTransition, IdentityUpdateTransitionSignable, }; + +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; + +#[cfg(feature = "state-transition-signing")] use crate::state_transition::state_transitions::document::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; pub type GetDataContractSecurityLevelRequirementFn = @@ -90,6 +128,7 @@ macro_rules! call_method { StateTransition::IdentityCreditWithdrawal(st) => st.$method($args), StateTransition::IdentityUpdate(st) => st.$method($args), StateTransition::IdentityCreditTransfer(st) => st.$method($args), + StateTransition::MasternodeVote(st) => st.$method($args), } }; ($state_transition:expr, $method:ident ) => { @@ -102,6 +141,7 @@ macro_rules! call_method { StateTransition::IdentityCreditWithdrawal(st) => st.$method(), StateTransition::IdentityUpdate(st) => st.$method(), StateTransition::IdentityCreditTransfer(st) => st.$method(), + StateTransition::MasternodeVote(st) => st.$method(), } }; } @@ -117,6 +157,7 @@ macro_rules! call_getter_method_identity_signed { StateTransition::IdentityCreditWithdrawal(st) => Some(st.$method($args)), StateTransition::IdentityUpdate(st) => Some(st.$method($args)), StateTransition::IdentityCreditTransfer(st) => Some(st.$method($args)), + StateTransition::MasternodeVote(st) => Some(st.$method($args)), } }; ($state_transition:expr, $method:ident ) => { @@ -129,6 +170,7 @@ macro_rules! call_getter_method_identity_signed { StateTransition::IdentityCreditWithdrawal(st) => Some(st.$method()), StateTransition::IdentityUpdate(st) => Some(st.$method()), StateTransition::IdentityCreditTransfer(st) => Some(st.$method()), + StateTransition::MasternodeVote(st) => Some(st.$method()), } }; } @@ -144,6 +186,7 @@ macro_rules! call_method_identity_signed { StateTransition::IdentityCreditWithdrawal(st) => st.$method($args), StateTransition::IdentityUpdate(st) => st.$method($args), StateTransition::IdentityCreditTransfer(st) => st.$method($args), + StateTransition::MasternodeVote(st) => st.$method($args), } }; ($state_transition:expr, $method:ident ) => { @@ -156,10 +199,12 @@ macro_rules! call_method_identity_signed { StateTransition::IdentityCreditWithdrawal(st) => st.$method(), StateTransition::IdentityUpdate(st) => st.$method(), StateTransition::IdentityCreditTransfer(st) => st.$method(), + StateTransition::MasternodeVote(st) => st.$method(), } }; } +#[cfg(feature = "state-transition-signing")] macro_rules! call_errorable_method_identity_signed { ($state_transition:expr, $method:ident, $args:tt ) => { match $state_transition { @@ -175,6 +220,7 @@ macro_rules! call_errorable_method_identity_signed { StateTransition::IdentityCreditWithdrawal(st) => st.$method($args), StateTransition::IdentityUpdate(st) => st.$method($args), StateTransition::IdentityCreditTransfer(st) => st.$method($args), + StateTransition::MasternodeVote(st) => st.$method($args), } }; ($state_transition:expr, $method:ident ) => { @@ -191,28 +237,31 @@ macro_rules! call_errorable_method_identity_signed { StateTransition::IdentityCreditWithdrawal(st) => st.$method(), StateTransition::IdentityUpdate(st) => st.$method(), StateTransition::IdentityCreditTransfer(st) => st.$method(), + StateTransition::MasternodeVote(st) => st.$method(), } }; } -macro_rules! call_static_method { - ($state_transition:expr, $method:ident ) => { - match $state_transition { - StateTransition::DataContractCreate(_) => DataContractCreateTransition::$method(), - StateTransition::DataContractUpdate(_) => DataContractUpdateTransition::$method(), - StateTransition::DocumentsBatch(_) => DocumentsBatchTransition::$method(), - StateTransition::IdentityCreate(_) => IdentityCreateTransition::$method(), - StateTransition::IdentityTopUp(_) => IdentityTopUpTransition::$method(), - StateTransition::IdentityCreditWithdrawal(_) => { - IdentityCreditWithdrawalTransition::$method() - } - StateTransition::IdentityUpdate(_) => IdentityUpdateTransition::$method(), - StateTransition::IdentityCreditTransfer(_) => { - IdentityCreditTransferTransition::$method() - } - } - }; -} +// TODO unused macros below +// macro_rules! call_static_method { +// ($state_transition:expr, $method:ident ) => { +// match $state_transition { +// StateTransition::DataContractCreate(_) => DataContractCreateTransition::$method(), +// StateTransition::DataContractUpdate(_) => DataContractUpdateTransition::$method(), +// StateTransition::DocumentsBatch(_) => DocumentsBatchTransition::$method(), +// StateTransition::IdentityCreate(_) => IdentityCreateTransition::$method(), +// StateTransition::IdentityTopUp(_) => IdentityTopUpTransition::$method(), +// StateTransition::IdentityCreditWithdrawal(_) => { +// IdentityCreditWithdrawalTransition::$method() +// } +// StateTransition::IdentityUpdate(_) => IdentityUpdateTransition::$method(), +// StateTransition::IdentityCreditTransfer(_) => { +// IdentityCreditTransferTransition::$method() +// } +// StateTransition::MasternodeVote(_) => MasternodeVote::$method(), +// } +// }; +// } #[derive( Debug, @@ -241,18 +290,16 @@ pub enum StateTransition { IdentityCreditWithdrawal(IdentityCreditWithdrawalTransition), IdentityUpdate(IdentityUpdateTransition), IdentityCreditTransfer(IdentityCreditTransferTransition), + MasternodeVote(MasternodeVoteTransition), } -impl StateTransition { - /// This means we should transform into the action before validation of the structure - pub fn requires_state_to_validate_structure(&self) -> bool { - matches!(self, StateTransition::DocumentsBatch(_)) - } - /// This means we should transform into the action before validation of the identity and signatures - pub fn requires_state_to_validate_identity_and_signatures(&self) -> bool { - matches!(self, StateTransition::DocumentsBatch(_)) +impl OptionallyAssetLockProved for StateTransition { + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + call_method!(self, optional_asset_lock_proof) } +} +impl StateTransition { pub fn is_identity_signed(&self) -> bool { !matches!( self, @@ -260,11 +307,38 @@ impl StateTransition { ) } + pub fn required_asset_lock_balance_for_processing_start( + &self, + platform_version: &PlatformVersion, + ) -> Credits { + match self { + StateTransition::IdentityCreate(_) => { + platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_create + * CREDITS_PER_DUFF + } + StateTransition::IdentityTopUp(_) => { + platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_top_up + * CREDITS_PER_DUFF + } + _ => 0, + } + } + fn hash(&self, skip_signature: bool) -> Result, ProtocolError> { if skip_signature { - Ok(hash_to_vec(self.signable_bytes()?)) + Ok(hash_double_to_vec(self.signable_bytes()?)) } else { - Ok(hash_to_vec( + Ok(hash_double_to_vec( crate::serialization::PlatformSerializable::serialize_to_bytes(self)?, )) } @@ -273,16 +347,34 @@ impl StateTransition { /// Returns state transition name pub fn name(&self) -> String { match self { - Self::DataContractCreate(_) => "DataContractCreate", - Self::DataContractUpdate(_) => "DataContractUpdate", - Self::DocumentsBatch(_) => "DocumentsBatch", - Self::IdentityCreate(_) => "IdentityCreate", - Self::IdentityTopUp(_) => "IdentityTopUp", - Self::IdentityCreditWithdrawal(_) => "IdentityCreditWithdrawal", - Self::IdentityUpdate(_) => "IdentityUpdate", - Self::IdentityCreditTransfer(_) => "IdentityCreditTransfer", + Self::DataContractCreate(_) => "DataContractCreate".to_string(), + Self::DataContractUpdate(_) => "DataContractUpdate".to_string(), + Self::DocumentsBatch(documents_batch_transition) => { + let mut document_transition_types = vec![]; + match documents_batch_transition { + DocumentsBatchTransition::V0(documents_batch_transition_v0) => { + for transition in documents_batch_transition_v0.transitions().iter() { + let document_transition_name = match transition { + DocumentTransition::Create(_) => "Create", + DocumentTransition::Replace(_) => "Replace", + DocumentTransition::Delete(_) => "Delete", + DocumentTransition::Transfer(_) => "Transfer", + DocumentTransition::UpdatePrice(_) => "UpdatePrice", + DocumentTransition::Purchase(_) => "Purchase", + }; + document_transition_types.push(document_transition_name); + } + } + } + format!("DocumentsBatch([{}])", document_transition_types.join(", ")) + } + Self::IdentityCreate(_) => "IdentityCreate".to_string(), + Self::IdentityTopUp(_) => "IdentityTopUp".to_string(), + Self::IdentityCreditWithdrawal(_) => "IdentityCreditWithdrawal".to_string(), + Self::IdentityUpdate(_) => "IdentityUpdate".to_string(), + Self::IdentityCreditTransfer(_) => "IdentityCreditTransfer".to_string(), + Self::MasternodeVote(_) => "MasternodeVote".to_string(), } - .to_string() } /// returns the signature as a byte-array @@ -290,26 +382,53 @@ impl StateTransition { call_method!(self, signature) } + /// returns the fee_increase additional percentage multiplier, it affects only processing costs + pub fn user_fee_increase(&self) -> UserFeeIncrease { + call_method!(self, user_fee_increase) + } + + /// The transaction id is a single hash of the data with the signature + pub fn transaction_id(&self) -> Result<[u8; 32], ProtocolError> { + Ok(hash_single( + crate::serialization::PlatformSerializable::serialize_to_bytes(self)?, + )) + } + /// returns the signature as a byte-array pub fn signature_public_key_id(&self) -> Option { call_getter_method_identity_signed!(self, signature_public_key_id) } - /// returns the signature as a byte-array + /// returns the key security level requirement for the state transition pub fn security_level_requirement(&self) -> Option> { call_getter_method_identity_signed!(self, security_level_requirement) } + /// returns the key purpose requirement for the state transition + pub fn purpose_requirement(&self) -> Option { + call_getter_method_identity_signed!(self, purpose_requirement) + } + /// returns the signature as a byte-array pub fn owner_id(&self) -> Identifier { call_method!(self, owner_id) } + /// returns the unique identifiers for the state transition + pub fn unique_identifiers(&self) -> Vec { + call_method!(self, unique_identifiers) + } + /// set a new signature pub fn set_signature(&mut self, signature: BinaryData) { call_method!(self, set_signature, signature) } + /// set fee multiplier + pub fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + call_method!(self, set_user_fee_increase, user_fee_increase) + } + /// set a new signature pub fn set_signature_public_key_id(&mut self, public_key_id: KeyID) { call_method_identity_signed!(self, set_signature_public_key_id, public_key_id) @@ -383,6 +502,10 @@ impl StateTransition { "identity top up can not be called for identity signing".to_string(), )) } + StateTransition::MasternodeVote(st) => { + st.verify_public_key_level_and_purpose(identity_public_key)?; + st.verify_public_key_is_enabled(identity_public_key)?; + } } let data = self.signable_bytes()?; self.set_signature(signer.sign(identity_public_key, data.as_slice())?); @@ -491,7 +614,7 @@ impl StateTransition { Ok(()) } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] fn verify_by_raw_public_key( &self, public_key: &[u8], @@ -553,7 +676,7 @@ impl StateTransition { } } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] fn verify_ecdsa_hash_160_signature_by_public_key_hash( &self, public_key_hash: &[u8], @@ -564,18 +687,18 @@ impl StateTransition { )); } let data = self.signable_bytes()?; - signer::verify_data_signature(&data, self.signature().as_slice(), public_key_hash).map_err( - |_| { + let data_hash = double_sha(data); + signer::verify_hash_signature(&data_hash, self.signature().as_slice(), public_key_hash) + .map_err(|e| { ProtocolError::from(ConsensusError::SignatureError( SignatureError::InvalidStateTransitionSignatureError( - InvalidStateTransitionSignatureError::new(), + InvalidStateTransitionSignatureError::new(e.to_string()), ), )) - }, - ) + }) } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] /// Verifies an ECDSA signature with the public key fn verify_ecdsa_signature_by_public_key(&self, public_key: &[u8]) -> Result<(), ProtocolError> { if self.signature().is_empty() { @@ -584,20 +707,18 @@ impl StateTransition { )); } let data = self.signable_bytes()?; - signer::verify_data_signature(&data, self.signature().as_slice(), public_key).map_err( - |_| { - // TODO: it shouldn't respond with consensus error + signer::verify_data_signature(&data, self.signature().as_slice(), public_key).map_err(|e| { + // TODO: it shouldn't respond with consensus error - ProtocolError::from(ConsensusError::SignatureError( - SignatureError::InvalidStateTransitionSignatureError( - InvalidStateTransitionSignatureError::new(), - ), - )) - }, - ) + ProtocolError::from(ConsensusError::SignatureError( + SignatureError::InvalidStateTransitionSignatureError( + InvalidStateTransitionSignatureError::new(e.to_string()), + ), + )) + }) } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] /// Verifies a BLS signature with the public key fn verify_bls_signature_by_public_key( &self, @@ -614,11 +735,11 @@ impl StateTransition { bls.verify_signature(self.signature().as_slice(), &data, public_key) .map(|_| ()) - .map_err(|_| { + .map_err(|e| { // TODO: it shouldn't respond with consensus error ProtocolError::from(ConsensusError::SignatureError( SignatureError::InvalidStateTransitionSignatureError( - InvalidStateTransitionSignatureError::new(), + InvalidStateTransitionSignatureError::new(e.to_string()), ), )) }) diff --git a/packages/rs-dpp/src/state_transition/proof_result.rs b/packages/rs-dpp/src/state_transition/proof_result.rs new file mode 100644 index 00000000000..ebff592c8c5 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/proof_result.rs @@ -0,0 +1,16 @@ +use crate::data_contract::DataContract; +use crate::document::Document; +use crate::identity::{Identity, PartialIdentity}; +use crate::voting::votes::Vote; +use platform_value::Identifier; +use std::collections::BTreeMap; + +#[derive(Debug)] +pub enum StateTransitionProofResult { + VerifiedDataContract(DataContract), + VerifiedIdentity(Identity), + VerifiedPartialIdentity(PartialIdentity), + VerifiedBalanceTransfer(PartialIdentity, PartialIdentity), //from/to + VerifiedDocuments(BTreeMap>), + VerifiedMasternodeVote(Vote), +} diff --git a/packages/rs-dpp/src/state_transition/serialization.rs b/packages/rs-dpp/src/state_transition/serialization.rs index b77c3031707..c36ae53db4f 100644 --- a/packages/rs-dpp/src/state_transition/serialization.rs +++ b/packages/rs-dpp/src/state_transition/serialization.rs @@ -3,9 +3,7 @@ use crate::state_transition::StateTransition; use crate::ProtocolError; impl StateTransition { - pub fn deserialize_many( - raw_state_transitions: &Vec>, - ) -> Result, ProtocolError> { + pub fn deserialize_many(raw_state_transitions: &[Vec]) -> Result, ProtocolError> { raw_state_transitions .iter() .map(|raw_state_transition| Self::deserialize_from_bytes(raw_state_transition)) @@ -15,6 +13,7 @@ impl StateTransition { #[cfg(test)] mod tests { + use crate::bls::native_bls::NativeBlsModule; use crate::data_contract::accessors::v0::DataContractV0Getters; use crate::identity::accessors::IdentityGettersV0; use crate::identity::core_script::CoreScript; @@ -46,7 +45,7 @@ mod tests { }; use crate::version::PlatformVersion; use crate::withdrawal::Pooling; - use crate::{NativeBlsModule, ProtocolError}; + use crate::ProtocolError; use platform_version::version::LATEST_PLATFORM_VERSION; use platform_version::TryIntoPlatformVersioned; use rand::rngs::StdRng; @@ -59,11 +58,11 @@ mod tests { let platform_version = LATEST_PLATFORM_VERSION; let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None, None); let identity_create_transition = IdentityCreateTransition::V0( IdentityCreateTransitionV0::try_from_identity( - identity, + &identity, AssetLockProof::Instant(asset_lock_proof), platform_version, ) @@ -85,11 +84,12 @@ mod tests { let platform_version = PlatformVersion::latest(); let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None, None); let identity_topup_transition = IdentityTopUpTransitionV0 { asset_lock_proof: AssetLockProof::Instant(asset_lock_proof), identity_id: identity.id(), + user_fee_increase: 0, signature: [1u8; 65].to_vec().into(), }; let state_transition: StateTransition = identity_topup_transition.into(); @@ -123,9 +123,10 @@ mod tests { signature_public_key_id: 0, identity_id: identity.id(), revision: 1, + nonce: 1, add_public_keys: add_public_keys_in_creation, disable_public_keys: vec![], - public_keys_disabled_at: None, + user_fee_increase: 0, }; let key_signable_bytes = identity_update_transition @@ -189,9 +190,10 @@ mod tests { signature_public_key_id: 0, identity_id: identity.id(), revision: 1, + nonce: 1, add_public_keys: add_public_keys_in_creation, disable_public_keys: vec![3, 4, 5], - public_keys_disabled_at: Some(15), + user_fee_increase: 0, }; let key_signable_bytes = identity_update_transition @@ -245,7 +247,8 @@ mod tests { core_fee_per_byte: 34, pooling: Pooling::Standard, output_script: CoreScript::from_bytes((0..23).collect::>()), - revision: 1, + nonce: 1, + user_fee_increase: 0, signature_public_key_id: 0, signature: [1u8; 65].to_vec().into(), }; @@ -266,6 +269,7 @@ mod tests { .expect("expected a random identity"); let created_data_contract = get_data_contract_fixture( Some(identity.id()), + 0, LATEST_PLATFORM_VERSION.protocol_version, ); let data_contract_create_transition: DataContractCreateTransition = created_data_contract @@ -286,15 +290,16 @@ mod tests { let platform_version = PlatformVersion::latest(); let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); - let mut created_data_contract = - get_data_contract_fixture(Some(identity.id()), platform_version.protocol_version); - created_data_contract.set_entropy_used(Default::default()); + let created_data_contract = + get_data_contract_fixture(Some(identity.id()), 0, platform_version.protocol_version); let data_contract_update_transition = DataContractUpdateTransition::V0(DataContractUpdateTransitionV0 { + identity_contract_nonce: 1, data_contract: created_data_contract .data_contract_owned() .try_into_platform_versioned(platform_version) .expect("expected a data contract"), + user_fee_increase: 0, signature_public_key_id: 0, signature: [1u8; 65].to_vec().into(), }); @@ -310,7 +315,9 @@ mod tests { #[test] fn document_batch_transition_10_created_documents_ser_de() { let platform_version = PlatformVersion::latest(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + + let mut nonces = BTreeMap::new(); + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); let documents = get_extended_documents_fixture_with_owner_id_from_contract( &data_contract, @@ -327,12 +334,14 @@ mod tests { data_contract .document_type_for_name(extended_document.document_type_name()) .unwrap(), - extended_document.entropy().clone(), + *extended_document.entropy(), ) }) .collect::>(); - let transitions = - get_document_transitions_fixture([(DocumentTransitionActionType::Create, documents)]); + let transitions = get_document_transitions_fixture( + [(DocumentTransitionActionType::Create, documents)], + &mut nonces, + ); let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { owner_id: data_contract.owner_id(), transitions, diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_operation_fees.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_operation_fees.rs deleted file mode 100644 index c003d9553df..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_operation_fees.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::fee::Credits; -use crate::NonConsensusError; - -use super::operations::{Operation, OperationLike}; -// -// pub fn calculate_operation_fees( -// operations: &[Operation], -// ) -> Result { -// let mut storage_fee: Credits = 0; -// let mut processing_fee: Credits = 0; -// let mut fee_refunds: Vec = Vec::new(); -// -// for operation in operations { -// storage_fee = storage_fee -// .checked_add(operation.get_storage_cost()?) -// .ok_or(NonConsensusError::Overflow("storage cost is too big"))?; -// processing_fee = processing_fee -// .checked_add(operation.get_processing_cost()?) -// .ok_or(NonConsensusError::Overflow("processing cost is too big"))?; -// -// // Merge refunds -// if let Some(operation_refunds) = operation.get_refunds() { -// for identity_refunds in operation_refunds { -// let mut existing_identity_refunds = fee_refunds -// .iter_mut() -// .find(|refund| refund.identifier == identity_refunds.identifier); -// -// if existing_identity_refunds.is_none() { -// fee_refunds.push(identity_refunds.clone()); -// continue; -// } -// -// for (epoch_index, credits) in identity_refunds.credits_per_epoch.iter() { -// if let Some(ref mut refunds) = existing_identity_refunds { -// let epoch = refunds -// .credits_per_epoch -// .entry(epoch_index.to_string()) -// .or_default(); -// -// *epoch = epoch -// .checked_add(*credits) -// .ok_or(NonConsensusError::Overflow("credits per epoch are too big"))? -// } -// } -// } -// } -// } -// -// Ok(DummyFeesResult { -// storage: storage_fee, -// processing: processing_fee, -// fee_refunds, -// }) -// } diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee.rs deleted file mode 100644 index 02c908fb8d8..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee.rs +++ /dev/null @@ -1,59 +0,0 @@ -use crate::state_transition::StateTransitionLike; - -use super::{calculate_operations_fees, constants::DEFAULT_USER_TIP}; - -pub fn calculate_state_transition_fee(state_transition: &impl StateTransitionLike) -> i64 { - let execution_context = state_transition.get_execution_context(); - let fee = calculate_operations_fees(execution_context.get_operations()); - - // Is not implemented yet - let storage_refund = 0; - - (fee.storage + fee.processing) + DEFAULT_USER_TIP - storage_refund -} - -#[cfg(test)] -mod test { - use crate::{ - identity::{ - state_transition::identity_create_transition::IdentityCreateTransition, KeyType, - }, - state_transition::{ - fee::operations::{ - DeleteOperation, Operation, PreCalculatedOperation, ReadOperation, WriteOperation, - }, - state_transition_execution_context::StateTransitionExecutionContext, - StateTransitionLike, - }, - tests::fixtures::identity_create_transition_fixture, - NativeBlsModule, - }; - - use super::calculate_state_transition_fee; - - // TODO: Must be more comprehensive. After we settle all factors and formula. - #[test] - fn should_calculate_fee_based_on_executed_operations() { - let bls = NativeBlsModule::default(); - let private_key = - hex::decode("af432c476f65211f45f48f1d42c9c0b497e56696aa1736b40544ef1a496af837") - .unwrap(); - let mut state_transition = - IdentityCreateTransition::new(identity_create_transition_fixture(None)).unwrap(); - state_transition - .sign_by_private_key(&private_key, KeyType::ECDSA_SECP256K1, &bls) - .expect("signing should be successful"); - - let execution_context = StateTransitionExecutionContext::default(); - execution_context.add_operation(Operation::Read(ReadOperation::new(10))); - execution_context.add_operation(Operation::Write(WriteOperation::new(5, 5))); - execution_context.add_operation(Operation::Delete(DeleteOperation::new(6, 6))); - execution_context.add_operation(Operation::PreCalculated(PreCalculatedOperation::new( - 12, 12, - ))); - state_transition.set_execution_context(execution_context); - - let result = calculate_state_transition_fee(&state_transition); - assert_eq!(13616, result) - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_factory.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_factory.rs deleted file mode 100644 index 0b100c90764..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_factory.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::{ - state_transition::{ - StateTransition, - }, - NonConsensusError, -}; -use crate::fee::fee_result::FeeResult; -use crate::state_transition::state_transition_execution_context::StateTransitionExecutionContext; -use crate::state_transition::state_transition_fee::calculate_state_transition_fee_from_operations_factory::calculate_state_transition_fee_from_operations; - - -pub fn calculate_state_transition_fee( - state_transition: &StateTransition, - execution_context: &StateTransitionExecutionContext, -) -> Result { - calculate_state_transition_fee_from_operations( - &execution_context.get_operations(), - state_transition.owner_id(), - ) -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_from_operations_factory.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_from_operations_factory.rs deleted file mode 100644 index 1a7cb983958..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_from_operations_factory.rs +++ /dev/null @@ -1,182 +0,0 @@ -use crate::fee::fee_result::FeeResult; -use crate::state_transition::fee::calculate_operation_fees::calculate_operation_fees; -use crate::state_transition::fee::operations::Operation; -use crate::{prelude::Identifier, NonConsensusError}; - -pub fn calculate_state_transition_fee_from_operations( - operations: &[Operation], - identity_id: &Identifier, -) -> Result { - calculate_state_transition_fee_from_operations_with_custom_calculator( - operations, - identity_id, - calculate_operation_fees, - ) -} - -fn calculate_state_transition_fee_from_operations_with_custom_calculator( - operations: &[Operation], - identity_id: &Identifier, - calculate_operation_fees_fn: impl FnOnce(&[Operation]) -> Result, -) -> Result { - let calculated_fees = calculate_operation_fees_fn(operations)?; - - let storage_fee = calculated_fees.storage; - let processing_fee = calculated_fees.processing; - let fee_refunds = calculated_fees.fee_refunds; - - let mut total_refunds = 0; - - let owner_refunds = fee_refunds - .iter() - .find(|refunds| identity_id == &refunds.identifier); - - if let Some(owner_refunds) = owner_refunds { - total_refunds = owner_refunds - .credits_per_epoch - .iter() - .fold(0, |sum, (_, credits)| sum + credits); - } - - let required_amount = if storage_fee > total_refunds { - (storage_fee - total_refunds) + DEFAULT_USER_TIP - } else { - 0 - }; - - let fee_sum = storage_fee + processing_fee; - - let desired_amount = if fee_sum > total_refunds { - (fee_sum - total_refunds) + DEFAULT_USER_TIP - } else { - 0 - }; - - Ok(FeeResult { - storage_fee, - processing_fee, - fee_refunds, - total_refunds, - required_amount, - desired_amount, - }) -} - -#[cfg(test)] -mod test { - - use platform_value::Identifier; - use std::collections::HashMap; - - use crate::fee::Credits; - use crate::identity::KeyType::ECDSA_SECP256K1; - use crate::state_transition::fee::calculate_operation_fees::calculate_operation_fees; - use crate::state_transition::fee::operations::{ - PreCalculatedOperation, SignatureVerificationOperation, - }; - use crate::{ - state_transition::fee::{operations::Operation, DummyFeesResult, FeeResult, Refunds}, - tests::utils::generate_random_identifier_struct, - NonConsensusError, - }; - - use super::calculate_state_transition_fee_from_operations_with_custom_calculator; - - #[test] - fn should_calculate_fee_based_on_executed_operations() { - let identifier = generate_random_identifier_struct(); - let storage_fee = 10000; - let processing_fee = 1000; - let total_refunds = 1000 + 500; - let required_amount = storage_fee - total_refunds; - let desired_amount = storage_fee + processing_fee - total_refunds; - - let mut credits_per_epoch: HashMap = Default::default(); - credits_per_epoch.insert("0".to_string(), 1000); - credits_per_epoch.insert("1".to_string(), 500); - - let refunds = Refunds { - identifier, - credits_per_epoch, - }; - - let mock = |_operations: &[Operation]| -> Result { - Ok(DummyFeesResult { - storage: storage_fee, - processing: processing_fee, - fee_refunds: vec![refunds.clone()], - }) - }; - - let result = calculate_state_transition_fee_from_operations_with_custom_calculator( - &[], - &identifier, - mock, - ) - .expect("result should be returned"); - let expected = FeeResult { - storage_fee, - processing_fee, - desired_amount, - required_amount, - fee_refunds: vec![refunds], - total_refunds: 1500, - }; - assert_eq!(expected, result); - } - - #[test] - fn test_with_negative_credits() { - // Set of operations that produced by Document Remove Transition - let operations = vec![ - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 551320, - fee_refunds: vec![], - }), - Operation::SignatureVerification(SignatureVerificationOperation { - signature_type: ECDSA_SECP256K1, - }), - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 551320, - fee_refunds: vec![], - }), - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 191260, - fee_refunds: vec![], - }), - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 16870910, - fee_refunds: vec![Refunds { - identifier: Identifier::new([ - 130, 188, 56, 7, 78, 143, 58, 212, 133, 162, 145, 56, 186, 219, 191, 75, - 64, 112, 236, 226, 135, 75, 132, 170, 135, 243, 180, 110, 103, 161, 153, - 252, - ]), - credits_per_epoch: [("0".to_string(), 114301030)].iter().cloned().collect(), - }], - }), - ]; - - let identifier = Identifier::new([ - 130, 188, 56, 7, 78, 143, 58, 212, 133, 162, 145, 56, 186, 219, 191, 75, 64, 112, 236, - 226, 135, 75, 132, 170, 135, 243, 180, 110, 103, 161, 153, 252, - ]); - - // Panics because of negative credits - let result = calculate_state_transition_fee_from_operations_with_custom_calculator( - &operations, - &identifier, - calculate_operation_fees, - ); - - assert!(matches!(result, Ok(FeeResult { - desired_amount, - required_amount, - .. - }) if desired_amount == 0 && required_amount == 0)); - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/mod.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/mod.rs deleted file mode 100644 index 21f0fa4cbfa..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ - -pub mod calculate_operation_fees; -pub mod calculate_state_transition_fee_factory; -pub mod calculate_state_transition_fee_from_operations_factory; -pub mod operations; -use crate::fee::fee_result::FeeResult; -use enum_map::EnumMap; -// -// #[derive(Debug, Clone, PartialEq, Eq, Default)] -// pub struct FeeResult { -// pub storage_fee: Credits, -// pub processing_fee: Credits, -// pub fee_refunds: Vec, -// pub total_refunds: Credits, -// pub desired_amount: Credits, -// pub required_amount: Credits, -// } - -// #[derive(Debug, Clone, PartialEq, Eq, Default)] -// pub struct DummyFeesResult { -// pub storage: Credits, -// pub processing: Credits, -// pub fee_refunds: Vec, -// } -// -// #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] -// #[serde(rename = "camelCase")] -// pub struct Refunds { -// pub identifier: Identifier, -// pub credits_per_epoch: HashMap, -// } diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/mod.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/operations/mod.rs deleted file mode 100644 index da2af583e64..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/mod.rs +++ /dev/null @@ -1,151 +0,0 @@ -mod precalculated_operation; -pub use precalculated_operation::*; - -mod read_operation; -pub use read_operation::*; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -mod signature_verification_operation; -use crate::fee::Credits; -pub use signature_verification_operation::*; - -use crate::NonConsensusError; - - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(tag = "type", rename_all = "camelCase")] -pub enum Operation { - Read(ReadOperation), - PreCalculated(PreCalculatedOperation), - SignatureVerification(SignatureVerificationOperation), -} - -pub trait OperationLike { - /// Get CPU cost of the operation - fn get_processing_cost(&self) -> Result; - /// Get storage cost of the operation - fn get_storage_cost(&self) -> Result; - - /// Get refunds - fn get_refunds(&self) -> Option<&Vec>; -} - -macro_rules! call_method { - ($operation_type:expr, $method:ident ) => { - match $operation_type { - Operation::Read(op) => op.$method(), - Operation::PreCalculated(op) => op.$method(), - Operation::SignatureVerification(op) => op.$method(), - } - }; -} - -impl OperationLike for Operation { - fn get_processing_cost(&self) -> Result { - call_method!(self, get_processing_cost) - } - - fn get_storage_cost(&self) -> Result { - call_method!(self, get_storage_cost) - } - - fn get_refunds(&self) -> Option<&Vec> { - call_method!(self, get_refunds) - } -} - -impl Operation { - fn try_from_json_str(from: &str) -> Result { - let operation = serde_json::from_str(from)?; - Ok(operation) - } - - fn try_from_json_value(from: Value) -> Result { - let operation = serde_json::from_value(from)?; - Ok(operation) - } - - fn to_json_value(&self) -> Result { - let value = serde_json::to_value(self)?; - Ok(value) - } - - fn to_json_string(&self) -> Result { - let json_string = serde_json::to_string_pretty(self)?; - Ok(json_string) - } -} - -#[cfg(test)] -mod test { - use super::{Operation, PreCalculatedOperation, ReadOperation, SignatureVerificationOperation}; - use crate::identity::KeyType; - use serde_json::json; - - struct TestCase { - json_str: String, - operation: Operation, - } - - macro_rules! json_string { - ($($json:tt)+) => { - serde_json::to_string_pretty(&json!($($json)+)).unwrap() - }; - } - - #[test] - fn test_deserialize_json_read_operation() { - let cases = vec![ - TestCase { - json_str: json_string!({ - "type": "read", - "valueSize" : 123, - }), - operation: Operation::Read(ReadOperation { value_size: 123 }), - }, - TestCase { - json_str: json_string!({ - "type": "preCalculated", - "storageCost" : 12357, - "processingCost" : 468910, - "feeRefunds" : [], - }), - operation: Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 12357, - processing_cost: 468910, - fee_refunds: vec![], - }), - }, - TestCase { - json_str: json_string!({ - "type": "signatureVerification", - "signatureType" : 1, - - }), - operation: Operation::SignatureVerification(SignatureVerificationOperation { - signature_type: KeyType::BLS12_381, - }), - }, - ]; - - for case in cases { - let operation = Operation::try_from_json_str(&case.json_str) - .unwrap_or_else(|e| panic!("failed deserializing: {}: {}", case.json_str, e)); - assert_eq!( - case.operation, operation, - "failed deserializing: {}", - case.json_str - ); - assert_eq!( - case.json_str, - operation - .to_json_string() - .unwrap_or_else(|e| panic!("failed serializing: {}: {}", case.json_str, e)), - "failed serializing: {}", - case.json_str - ); - } - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/precalculated_operation.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/operations/precalculated_operation.rs deleted file mode 100644 index 48035cff8c5..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/precalculated_operation.rs +++ /dev/null @@ -1,50 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use crate::fee::Credits; -use crate::NonConsensusError; - -use super::OperationLike; - -#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "camelCase")] -pub struct PreCalculatedOperation { - pub storage_cost: Credits, - pub processing_cost: Credits, - pub fee_refunds: Vec, -} - -impl PreCalculatedOperation { - pub fn from_fee(fee: DummyFeesResult) -> Self { - Self { - fee_refunds: fee.fee_refunds, - processing_cost: fee.processing, - storage_cost: fee.storage, - } - } - - pub fn new( - storage_cost: Credits, - processing_cost: Credits, - fee_refunds: impl IntoIterator, - ) -> Self { - Self { - storage_cost, - processing_cost, - fee_refunds: fee_refunds.into_iter().collect(), - } - } -} - -impl OperationLike for PreCalculatedOperation { - fn get_processing_cost(&self) -> Result { - Ok(self.processing_cost) - } - - fn get_storage_cost(&self) -> Result { - Ok(self.storage_cost) - } - - fn get_refunds(&self) -> Option<&Vec> { - Some(&self.fee_refunds) - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/read_operation.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/operations/read_operation.rs deleted file mode 100644 index e835d686d6a..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/read_operation.rs +++ /dev/null @@ -1,44 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use super::OperationLike; - -use crate::fee::default_costs::constants::{PROCESSING_CREDIT_PER_BYTE, READ_BASE_PROCESSING_COST}; -use crate::fee::Credits; -use crate::NonConsensusError; - -#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "camelCase")] -pub struct ReadOperation { - pub value_size: Credits, -} - -impl ReadOperation { - pub fn new(value_size: u64) -> Self { - Self { value_size } - } -} - -impl OperationLike for ReadOperation { - fn get_processing_cost(&self) -> Result { - let value_byte_processing_cost = self - .value_size - .checked_mul(PROCESSING_CREDIT_PER_BYTE) - .ok_or(NonConsensusError::Overflow( - "value processing cost is too big", - ))?; - - READ_BASE_PROCESSING_COST - .checked_add(value_byte_processing_cost) - .ok_or(NonConsensusError::Overflow( - "can't add read base processing cost", - )) - } - - fn get_storage_cost(&self) -> Result { - Ok(0) - } - - fn get_refunds(&self) -> Option<&Vec> { - None - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/state_transition_execution_context.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/state_transition_execution_context.rs deleted file mode 100644 index b2bdf383566..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/state_transition_execution_context.rs +++ /dev/null @@ -1,92 +0,0 @@ - -use crate::state_transition::state_transition_fee::operations::Operation; - - -#[derive(Debug, Clone, Default)] -pub struct StateTransitionExecutionContext { - operations : Vec, -} -// -// #[derive(Default, Debug, Clone)] -// struct StateTransitionContextInner { -// actual_operations: Vec, -// dry_run_operations: Vec, -// is_dry_run: bool, -// } -// -// impl StateTransitionExecutionContext { -// /// Add [`Operation`] into the execution context -// pub fn add_operation(&self, operation: Operation) { -// let mut inner = self.inner.lock().unwrap(); -// if inner.is_dry_run { -// inner.dry_run_operations.push(operation); -// } else { -// inner.actual_operations.push(operation); -// } -// } -// -// /// Add more than one [`Operation`] into the execution context -// pub fn add_operations(&self, operations: impl IntoIterator) { -// let mut inner = self.inner.lock().unwrap(); -// if inner.is_dry_run { -// inner.dry_run_operations.extend(operations); -// } else { -// inner.actual_operations.extend(operations); -// } -// } -// -// /// Replace all existing operations with a new collection of operations -// pub fn set_operations(&self, operations: Vec) { -// let mut inner = self.inner.lock().unwrap(); -// inner.actual_operations = operations -// } -// -// /// Returns dry run operations -// pub fn get_dry_operations(&self) -> Vec { -// let inner = self.inner.lock().unwrap(); -// inner.dry_run_operations.to_vec() -// } -// -// /// Returns all (actual & dry run) operations -// pub fn get_operations(&self) -> Vec { -// let inner = self.inner.lock().unwrap(); -// inner -// .actual_operations -// .iter() -// // TODO remove cloning -// .cloned() -// // TODO remove cloning -// .chain(inner.dry_run_operations.iter().cloned()) -// .collect() -// } -// -// /// Enable dry run -// pub fn enable_dry_run(&self) { -// let mut inner = self.inner.lock().unwrap(); -// inner.is_dry_run = true; -// } -// -// /// Enable dry run -// pub fn with_dry_run(self) -> Self { -// let mut inner = self.inner.lock().unwrap(); -// inner.is_dry_run = true; -// drop(inner); -// self -// } -// -// /// Disable dry run -// pub fn disable_dry_run(&self) { -// let mut inner = self.inner.lock().unwrap(); -// inner.is_dry_run = false; -// } -// -// pub fn clear_dry_run_operations(&self) { -// let mut inner = self.inner.lock().unwrap(); -// inner.dry_run_operations.clear() -// } -// -// pub fn is_dry_run(&self) -> bool { -// let inner = self.inner.lock().unwrap(); -// inner.is_dry_run -// } -// } diff --git a/packages/rs-dpp/src/state_transition/state_transition_types.rs b/packages/rs-dpp/src/state_transition/state_transition_types.rs index 1b747d3135f..246f4620631 100644 --- a/packages/rs-dpp/src/state_transition/state_transition_types.rs +++ b/packages/rs-dpp/src/state_transition/state_transition_types.rs @@ -28,6 +28,7 @@ pub enum StateTransitionType { IdentityUpdate = 5, IdentityCreditWithdrawal = 6, IdentityCreditTransfer = 7, + MasternodeVote = 8, } impl std::fmt::Display for StateTransitionType { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs index fa6c117a5a5..fc9a770f231 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs @@ -1,8 +1,13 @@ pub mod property_names { pub const STATE_TRANSITION_PROTOCOL_VERSION: &str = "$version"; - pub const ENTROPY: &str = "entropy"; + pub const IDENTITY_CONTRACT_NONCE: &str = "identityContractNonce"; + pub const IDENTITY_NONCE: &str = "identityNonce"; + + pub const USER_FEE_INCREASE: &str = "userFeeIncrease"; pub const SIGNATURE_PUBLIC_KEY_ID: &str = "signaturePublicKeyId"; pub const SIGNATURE: &str = "signature"; pub const TRANSITION_TYPE: &str = "type"; pub const REVISION: &str = "revision"; + + pub const NONCE: &str = "nonce"; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs index 2464b26f4de..d123c8b28cd 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs @@ -4,4 +4,6 @@ pub mod property_names { pub const DATA_CONTRACT_OWNER_ID: &str = "dataContract.ownerId"; pub const DATA_CONTRACT_ENTROPY: &str = "dataContract.entropy"; pub const DATA_CONTRACT_PROTOCOL_VERSION: &str = "dataContract.protocolVersion"; + + pub const IDENTITY_CONTRACT_NONCE: &str = "identityContractNonce"; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs index 9c94a833549..301bb1743ef 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs @@ -2,8 +2,8 @@ mod v0; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; -use platform_value::Bytes32; pub use v0::*; impl DataContractCreateTransitionAccessorsV0 for DataContractCreateTransition { @@ -13,9 +13,9 @@ impl DataContractCreateTransitionAccessorsV0 for DataContractCreateTransition { } } - fn entropy(&self) -> &Bytes32 { + fn identity_nonce(&self) -> IdentityNonce { match self { - DataContractCreateTransition::V0(transition) => &transition.entropy, + DataContractCreateTransition::V0(transition) => transition.identity_nonce, } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs index 81acd4abb1a..ff7d28fb776 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs @@ -1,10 +1,10 @@ use crate::data_contract::serialized_version::DataContractInSerializationFormat; -use platform_value::Bytes32; +use crate::prelude::IdentityNonce; pub trait DataContractCreateTransitionAccessorsV0 { fn data_contract(&self) -> &DataContractInSerializationFormat; - fn entropy(&self) -> &Bytes32; + fn identity_nonce(&self) -> IdentityNonce; fn set_data_contract(&mut self, data_contract: DataContractInSerializationFormat); } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs index 4d29a981c1a..3ae3b41bb24 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs @@ -1,17 +1,20 @@ use crate::state_transition::state_transitions; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, }; +#[allow(unused_imports)] // Removing causes build failures; yet clippy insists it's unused +pub use state_transitions::contract::common_fields::property_names::DATA_CONTRACT; pub use state_transitions::contract::common_fields::property_names::{ - DATA_CONTRACT, DATA_CONTRACT_ENTROPY, DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID, - DATA_CONTRACT_PROTOCOL_VERSION, + DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID, DATA_CONTRACT_PROTOCOL_VERSION, }; pub const IDENTIFIER_FIELDS: [&str; 2] = [DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID]; -pub const BINARY_FIELDS: [&str; 3] = [ENTROPY, DATA_CONTRACT_ENTROPY, SIGNATURE]; +pub const BINARY_FIELDS: [&str; 1] = [SIGNATURE]; pub const U32_FIELDS: [&str; 2] = [ STATE_TRANSITION_PROTOCOL_VERSION, DATA_CONTRACT_PROTOCOL_VERSION, ]; + +pub const U64_FIELDS: [&str; 1] = [IDENTITY_NONCE]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs index b843fef9cd0..b4ddf94b09d 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs @@ -33,8 +33,8 @@ mod test { JsonStateTransitionSerializationOptions, StateTransitionJsonConvert, }; + use crate::prelude::IdentityNonce; use dpp::util::json_value::JsonValueExt; - use platform_value::Bytes32; #[test] fn should_return_state_transition_in_json_format() { @@ -68,10 +68,10 @@ mod test { ); assert_eq!( - >::into(data.created_data_contract.entropy_used_owned()), + data.created_data_contract.identity_nonce(), json_object - .remove_into::(ENTROPY) - .expect("the entropy should be present") + .remove_into::(IDENTITY_NONCE) + .expect("the identity_nonce should be present") ) } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs index 8dd8f194cd1..b192abf21e2 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs @@ -5,19 +5,19 @@ pub use v0::*; use crate::data_contract::DataContract; use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_create_transition::{ DataContractCreateTransition, DataContractCreateTransitionV0, }; use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; -use platform_value::Bytes32; use platform_version::version::PlatformVersion; impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransition { fn new_from_data_contract( data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, identity: &PartialIdentity, key_id: KeyID, signer: &S, @@ -33,7 +33,7 @@ impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransition { ) { 0 => DataContractCreateTransitionV0::new_from_data_contract( data_contract, - entropy, + identity_nonce, identity, key_id, signer, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs index 145a30ebc32..638a0d0295b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs @@ -2,10 +2,10 @@ use crate::data_contract::DataContract; use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; +use crate::prelude::IdentityNonce; use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; -use platform_value::Bytes32; use platform_version::version::PlatformVersion; pub trait DataContractCreateTransitionMethodsV0 { @@ -14,7 +14,7 @@ pub trait DataContractCreateTransitionMethodsV0 { /// # Arguments /// /// * `data_contract` - A mutable `DataContract` instance, to be used in the transition. - /// * `entropy` - A `Bytes32` value providing additional randomness. + /// * `identity_nonce` - A `IdentityNonce` value providing additional randomness. /// * `identity` - A reference to a `PartialIdentity` object. /// * `key_id` - A `KeyID` identifier for the public key used for signing the transition. /// * `signer` - A reference to an object implementing the `Signer` trait. @@ -28,7 +28,7 @@ pub trait DataContractCreateTransitionMethodsV0 { /// object. Otherwise, returns `ProtocolError`. fn new_from_data_contract( data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, identity: &PartialIdentity, key_id: KeyID, signer: &S, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs index 0d3e8ae0f78..566dc56ea4f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs @@ -4,7 +4,6 @@ mod identity_signed; #[cfg(feature = "state-transition-json-conversion")] mod json_conversion; pub mod methods; -mod serialize; mod state_transition_like; mod v0; #[cfg(feature = "state-transition-value-conversion")] @@ -24,9 +23,11 @@ use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, Plat use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::data_contract::created_data_contract::CreatedDataContract; +use crate::identity::state_transition::OptionallyAssetLockProved; pub use v0::*; pub type DataContractCreateTransitionLatest = DataContractCreateTransitionV0; @@ -134,7 +135,7 @@ impl StateTransitionFieldTypes for DataContractCreateTransition { } fn binary_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, ENTROPY] + vec![SIGNATURE, IDENTITY_NONCE] } } @@ -146,6 +147,8 @@ impl DataContractCreateTransition { } } +impl OptionallyAssetLockProved for DataContractCreateTransition {} + #[cfg(test)] mod test { use crate::data_contract::conversion::json::DataContractJsonConversionMethodsV0; @@ -155,7 +158,6 @@ mod test { use crate::data_contract::accessors::v0::DataContractV0Getters; use crate::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; use crate::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; - use crate::state_transition::state_transitions::common_fields::property_names; use crate::state_transition::traits::StateTransitionLike; use crate::state_transition::{StateTransitionType, StateTransitionValueConvert}; use crate::tests::fixtures::get_data_contract_fixture; @@ -169,7 +171,7 @@ mod test { } pub(crate) fn get_test_data() -> TestData { - let created_data_contract = get_data_contract_fixture(None, 1); + let created_data_contract = get_data_contract_fixture(None, 0, 1); let state_transition = DataContractCreateTransition::from_object( Value::from([ @@ -181,12 +183,13 @@ mod test { .validation_and_processing .state_transitions .contract_create_state_transition - .structure, + .basic_structure + .unwrap(), ), ), ( - property_names::ENTROPY, - Value::Bytes32(created_data_contract.entropy_used().to_buffer()), + IDENTITY_NONCE, + Value::U64(created_data_contract.identity_nonce()), ), ( DATA_CONTRACT, @@ -235,6 +238,7 @@ mod test { let data_contract = DataContract::try_from_platform_versioned( data.state_transition.data_contract().clone(), false, + &mut vec![], LATEST_PLATFORM_VERSION, ) .expect("to get data contract"); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/serialize.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/serialize.rs deleted file mode 100644 index bb8226a25a1..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/serialize.rs +++ /dev/null @@ -1,118 +0,0 @@ -// use crate::data_contract::property_names::ENTROPY; -// -// use crate::data_contract::DataContract; -// use crate::document::document_transition::document_base_transition::JsonValue; -// use crate::identity::KeyID; -// use crate::serialization::PlatformDeserializable; -// use crate::serialization::{PlatformSerializable, Signable}; -// use crate::state_transition::{StateTransitionFieldTypes, StateTransitionLike, StateTransitionType}; -// use crate::version::{PlatformVersion}; -// use crate::{ProtocolError}; -// use bincode::{config, Decode, Encode}; -// use derive_more::From; -// use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -// use platform_versioning::PlatformVersioned; -// use platform_value::{BinaryData, Bytes32, Identifier, Value}; -// use serde::de::{MapAccess, Visitor}; -// use serde::ser::SerializeMap; -// use serde::{Deserialize, Deserializer, Serialize, Serializer}; -// -// use std::fmt; -// use crate::data_contract::state_transition::property_names::{SIGNATURE, SIGNATURE_PUBLIC_KEY_ID}; -// use crate::state_transition::data_contract_create_transition::{DataContractCreateTransition, DataContractCreateTransitionV0}; -// -// impl Serialize for DataContractCreateTransition { -// fn serialize(&self, serializer: S) -> Result -// where -// S: Serializer, -// { -// let mut state = serializer.serialize_map(None)?; -// -// match *self { -// DataContractCreateTransition::V0(ref v0) => { -// state.serialize_entry("type", &StateTransitionType::DataContractCreate)?; -// state.serialize_entry("version", &0u16)?; -// state.serialize_entry("dataContract", &v0.data_contract)?; -// state.serialize_entry("entropy", &v0.entropy)?; -// state.serialize_entry("signaturePublicKeyId", &v0.signature_public_key_id)?; -// state.serialize_entry("signature", &v0.signature)?; -// } -// } -// -// state.end() -// } -// } -// -// struct DataContractCreateTransitionVisitor; -// -// impl<'de> Visitor<'de> for DataContractCreateTransitionVisitor { -// type Value = DataContractCreateTransition; -// -// fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { -// formatter.write_str("a map representing a DataContractCreateTransition") -// } -// -// fn visit_map(self, mut map: A) -> Result -// where -// A: MapAccess<'de>, -// { -// let mut version: Option = None; -// let mut data_contract: Option = None; -// let mut entropy: Option = None; -// let mut signature_public_key_id: Option = None; -// let mut signature: Option = None; -// -// while let Some(key) = map.next_key()? { -// match key { -// "version" => { -// version = Some(map.next_value()?); -// } -// "dataContract" => { -// data_contract = Some(map.next_value()?); -// } -// "entropy" => { -// entropy = Some(map.next_value()?); -// } -// "signaturePublicKeyId" => { -// signature_public_key_id = Some(map.next_value()?); -// } -// "signature" => { -// signature = Some(map.next_value()?); -// } -// _ => {} -// } -// } -// -// let version = version.ok_or_else(|| serde::de::Error::missing_field("version"))?; -// let data_contract = -// data_contract.ok_or_else(|| serde::de::Error::missing_field("dataContract"))?; -// let entropy = entropy.ok_or_else(|| serde::de::Error::missing_field("entropy"))?; -// let signature_public_key_id = signature_public_key_id -// .ok_or_else(|| serde::de::Error::missing_field("signaturePublicKeyId"))?; -// let signature = signature.ok_or_else(|| serde::de::Error::missing_field("signature"))?; -// -// match version { -// 0 => Ok(DataContractCreateTransition::V0( -// DataContractCreateTransitionV0 { -// data_contract, -// entropy, -// signature_public_key_id, -// signature, -// }, -// )), -// _ => Err(serde::de::Error::unknown_variant( -// &format!("{}", version), -// &[], -// )), -// } -// } -// } -// -// impl<'de> Deserialize<'de> for DataContractCreateTransition { -// fn deserialize(deserializer: D) -> Result -// where -// D: Deserializer<'de>, -// { -// deserializer.deserialize_map(DataContractCreateTransitionVisitor) -// } -// } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs index cbacd9d9aba..fd23f890b8b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -35,6 +36,21 @@ impl StateTransitionLike for DataContractCreateTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DataContractCreateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + DataContractCreateTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } + fn set_signature_bytes(&mut self, signature: Vec) { match self { DataContractCreateTransition::V0(transition) => { @@ -48,4 +64,10 @@ impl StateTransitionLike for DataContractCreateTransition { DataContractCreateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + DataContractCreateTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs index 5aec8aea2e0..c7b4464dec8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::SecurityLevel::CRITICAL; +use crate::identity::SecurityLevel::{CRITICAL, HIGH}; use crate::identity::{KeyID, SecurityLevel}; use crate::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; use crate::state_transition::StateTransitionIdentitySigned; @@ -13,6 +13,6 @@ impl StateTransitionIdentitySigned for DataContractCreateTransitionV0 { } fn security_level_requirement(&self) -> Vec { - vec![CRITICAL] + vec![CRITICAL, HIGH] } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs index 67e6986e828..054004a6dc5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs @@ -10,13 +10,15 @@ mod version; use platform_serialization_derive::PlatformSignable; -use platform_value::{BinaryData, Bytes32}; +use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::{data_contract::DataContract, identity::KeyID, ProtocolError}; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; use bincode::{Decode, Encode}; use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; @@ -34,7 +36,8 @@ use crate::version::PlatformVersion; )] pub struct DataContractCreateTransitionV0 { pub data_contract: DataContractInSerializationFormat, - pub entropy: Bytes32, + pub identity_nonce: IdentityNonce, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] @@ -64,7 +67,8 @@ impl TryFromPlatformVersioned for DataContractCreateTransitionV0 { ) -> Result { Ok(DataContractCreateTransitionV0 { data_contract: value.try_into_platform_versioned(platform_version)?, - entropy: Default::default(), + identity_nonce: Default::default(), + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), }) @@ -78,10 +82,11 @@ impl TryFromPlatformVersioned for DataContractCreateTransit value: CreatedDataContract, platform_version: &PlatformVersion, ) -> Result { - let (data_contract, entropy) = value.data_contract_and_entropy_owned(); + let (data_contract, identity_nonce) = value.data_contract_and_identity_nonce(); Ok(DataContractCreateTransitionV0 { data_contract: data_contract.try_into_platform_versioned(platform_version)?, - entropy, + identity_nonce, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), }) diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs index 5110c92e422..b3c96c455a1 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs @@ -1,5 +1,6 @@ use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -40,4 +41,20 @@ impl StateTransitionLike for DataContractCreateTransitionV0 { fn owner_id(&self) -> Identifier { self.data_contract.owner_id() } + + fn unique_identifiers(&self) -> Vec { + vec![format!( + "dcc-{}-{}", + self.data_contract.owner_id(), + self.data_contract.id() + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs index 7e07594821f..7f3304ab27c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs @@ -1,6 +1,6 @@ use crate::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; use crate::state_transition::state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, + SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, }; use crate::state_transition::StateTransitionFieldTypes; @@ -14,6 +14,6 @@ impl StateTransitionFieldTypes for DataContractCreateTransitionV0 { } fn binary_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, ENTROPY] + vec![SIGNATURE] } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs index 35da1d2aec1..ca6fe4e1480 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs @@ -1,7 +1,5 @@ use crate::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; -use platform_value::Bytes32; - use crate::{data_contract::DataContract, identity::KeyID, NonConsensusError, ProtocolError}; use crate::serialization::Signable; @@ -11,6 +9,7 @@ use crate::data_contract::accessors::v0::DataContractV0Setters; use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use crate::identity::signer::Signer; use crate::identity::PartialIdentity; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_create_transition::methods::DataContractCreateTransitionMethodsV0; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; use platform_version::version::PlatformVersion; @@ -22,7 +21,7 @@ use crate::version::FeatureVersion; impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransitionV0 { fn new_from_data_contract( mut data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, identity: &PartialIdentity, key_id: KeyID, signer: &S, @@ -31,32 +30,47 @@ impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransitionV0 { ) -> Result { data_contract.set_id(DataContract::generate_data_contract_id_v0( identity.id, - entropy, + identity_nonce, )); + data_contract.set_owner_id(identity.id); + let transition = DataContractCreateTransition::V0(DataContractCreateTransitionV0 { data_contract: data_contract.try_into_platform_versioned(platform_version)?, - entropy: Default::default(), + identity_nonce, + user_fee_increase: 0, signature_public_key_id: key_id, signature: Default::default(), }); + let mut state_transition: StateTransition = transition.into(); let value = state_transition.signable_bytes()?; - let public_key = - identity - .loaded_public_keys - .get(&key_id) - .ok_or(ProtocolError::NonConsensusError( - NonConsensusError::StateTransitionCreationError( - "public key did not exist".to_string(), - ), - ))?; + + // The public key ids don't always match the keys in the map, so we need to do this. + let matching_key = identity + .loaded_public_keys + .iter() + .find_map(|(&key, public_key)| { + if public_key.id() == key_id { + Some(key) + } else { + None + } + }) + .expect("No matching public key id found in the map"); + + let public_key = identity.loaded_public_keys.get(&matching_key).ok_or( + ProtocolError::NonConsensusError(NonConsensusError::StateTransitionCreationError( + "public key did not exist".to_string(), + )), + )?; let security_level_requirements = state_transition.security_level_requirement().ok_or( ProtocolError::CorruptedCodeExecution( "expected security level requirements".to_string(), ), )?; + if !security_level_requirements.contains(&public_key.security_level()) { return Err(ProtocolError::ConsensusError(Box::new( SignatureError::InvalidSignaturePublicKeySecurityLevelError( @@ -69,7 +83,16 @@ impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransitionV0 { ))); } - state_transition.set_signature(signer.sign(public_key, &value)?); + // There was an error here where the public key supplied was not one belonging to the signer. + match signer.sign(public_key, &value) { + Ok(signature) => { + state_transition.set_signature(signature); + } + Err(e) => { + return Err(e); + } + } + Ok(state_transition) } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs index be5c2ec1937..f79c2f765fd 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs @@ -11,6 +11,7 @@ use crate::data_contract::conversion::value::v0::DataContractValueConversionMeth use crate::state_transition::{StateTransitionFieldTypes, StateTransitionValueConvert}; use crate::state_transition::data_contract_create_transition::{DataContractCreateTransitionV0}; use crate::state_transition::data_contract_create_transition::fields::*; +use crate::state_transition::state_transitions::common_fields::property_names::USER_FEE_INCREASE; use crate::state_transition::state_transitions::contract::data_contract_create_transition::fields::{BINARY_FIELDS, IDENTIFIER_FIELDS, U32_FIELDS}; impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { @@ -27,8 +28,8 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { .get_optional_integer(SIGNATURE_PUBLIC_KEY_ID) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), - entropy: raw_object - .remove_optional_bytes_32(ENTROPY) + identity_nonce: raw_object + .get_optional_integer(IDENTITY_NONCE) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), data_contract: DataContract::from_value( @@ -41,6 +42,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } @@ -57,8 +62,8 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { .remove_optional_integer(SIGNATURE_PUBLIC_KEY_ID) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), - entropy: raw_value_map - .remove_optional_bytes_32(ENTROPY) + identity_nonce: raw_value_map + .remove_optional_integer(IDENTITY_NONCE) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), data_contract: DataContract::from_value( @@ -71,6 +76,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_value_map + .remove_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs index c1d823b6b1b..a928d77b220 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs @@ -2,6 +2,7 @@ mod v0; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; pub use v0::*; @@ -19,4 +20,10 @@ impl DataContractUpdateTransitionAccessorsV0 for DataContractUpdateTransition { } } } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DataContractUpdateTransition::V0(transition) => transition.identity_contract_nonce, + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs index 66cbeab4b4b..49907ccd405 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs @@ -1,6 +1,9 @@ use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::IdentityNonce; pub trait DataContractUpdateTransitionAccessorsV0 { fn data_contract(&self) -> &DataContractInSerializationFormat; fn set_data_contract(&mut self, data_contract: DataContractInSerializationFormat); + + fn identity_contract_nonce(&self) -> IdentityNonce; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs index c0e7dfab8b3..90fc0adf6ae 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs @@ -1,7 +1,9 @@ use crate::state_transition::state_transitions; +use crate::state_transition::state_transitions::contract::common_fields::property_names::IDENTITY_CONTRACT_NONCE; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub use state_transitions::contract::common_fields::property_names::{ DATA_CONTRACT, DATA_CONTRACT_ENTROPY, DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID, @@ -10,7 +12,8 @@ pub use state_transitions::contract::common_fields::property_names::{ pub const IDENTIFIER_FIELDS: [&str; 2] = [DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID]; pub const BINARY_FIELDS: [&str; 2] = [DATA_CONTRACT_ENTROPY, SIGNATURE]; -pub const U32_FIELDS: [&str; 2] = [ +pub const U32_FIELDS: [&str; 3] = [ STATE_TRANSITION_PROTOCOL_VERSION, DATA_CONTRACT_PROTOCOL_VERSION, + IDENTITY_CONTRACT_NONCE, ]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs index b31ecf4a939..98522c59720 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs @@ -12,6 +12,7 @@ use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use platform_version::version::PlatformVersion; impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransition { @@ -19,6 +20,8 @@ impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransition { data_contract: DataContract, identity: &PartialIdentity, key_id: KeyID, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, feature_version: Option, @@ -34,6 +37,8 @@ impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransition { data_contract, identity, key_id, + identity_contract_nonce, + user_fee_increase, signer, platform_version, feature_version, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs index f114ca9bb3b..1dd2d579b34 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs @@ -2,6 +2,7 @@ use crate::data_contract::DataContract; use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; @@ -25,6 +26,8 @@ pub trait DataContractUpdateTransitionMethodsV0 { data_contract: DataContract, identity: &PartialIdentity, key_id: KeyID, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, feature_version: Option, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs index 56b7003ac0c..85b5a7317a6 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs @@ -6,6 +6,7 @@ use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, Plat use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub mod accessors; @@ -27,6 +28,8 @@ use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use crate::data_contract::DataContract; +use crate::identity::state_transition::OptionallyAssetLockProved; +use crate::prelude::IdentityNonce; pub use v0::*; pub type DataContractUpdateTransitionLatest = DataContractUpdateTransitionV0; @@ -57,11 +60,11 @@ pub enum DataContractUpdateTransition { V0(DataContractUpdateTransitionV0), } -impl TryFromPlatformVersioned for DataContractUpdateTransition { +impl TryFromPlatformVersioned<(DataContract, IdentityNonce)> for DataContractUpdateTransition { type Error = ProtocolError; fn try_from_platform_versioned( - value: DataContract, + value: (DataContract, IdentityNonce), platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -99,6 +102,8 @@ impl StateTransitionFieldTypes for DataContractUpdateTransition { } } +impl OptionallyAssetLockProved for DataContractUpdateTransition {} + #[cfg(test)] mod test { use crate::data_contract::DataContract; @@ -120,11 +125,10 @@ mod test { fn get_test_data() -> TestData { let platform_version = PlatformVersion::first(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); - let state_transition: DataContractUpdateTransition = data_contract - .clone() + let state_transition: DataContractUpdateTransition = (data_contract.clone(), 1) .try_into_platform_versioned(platform_version) .expect("expected to get transition"); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs index 1b6be85e7f2..7c03a33becc 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -48,4 +49,25 @@ impl StateTransitionLike for DataContractUpdateTransition { DataContractUpdateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + DataContractUpdateTransition::V0(transition) => transition.unique_identifiers(), + } + } + + /// returns the fee increase multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DataContractUpdateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee increase multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + DataContractUpdateTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs index 698560017b9..144d706ecca 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs @@ -9,6 +9,7 @@ mod value_conversion; mod version; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use bincode::{Decode, Encode}; @@ -17,6 +18,7 @@ use platform_version::version::PlatformVersion; use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; use crate::state_transition::StateTransition; use crate::{data_contract::DataContract, identity::KeyID, ProtocolError}; @@ -29,22 +31,30 @@ use crate::{data_contract::DataContract, identity::KeyID, ProtocolError}; )] pub struct DataContractUpdateTransitionV0 { + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$identity-contract-nonce") + )] + pub identity_contract_nonce: IdentityNonce, pub data_contract: DataContractInSerializationFormat, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] pub signature: BinaryData, } -impl TryFromPlatformVersioned for DataContractUpdateTransitionV0 { +impl TryFromPlatformVersioned<(DataContract, IdentityNonce)> for DataContractUpdateTransitionV0 { type Error = ProtocolError; fn try_from_platform_versioned( - value: DataContract, + value: (DataContract, IdentityNonce), platform_version: &PlatformVersion, ) -> Result { Ok(DataContractUpdateTransitionV0 { - data_contract: value.try_into_platform_versioned(platform_version)?, + identity_contract_nonce: value.1, + data_contract: value.0.try_into_platform_versioned(platform_version)?, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), }) diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs index 858883b8b23..1b6b946d53c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -40,4 +43,21 @@ impl StateTransitionLike for DataContractUpdateTransitionV0 { fn owner_id(&self) -> Identifier { self.data_contract.owner_id() } + + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{}-{:x}", + BASE64_STANDARD.encode(self.data_contract.owner_id()), + BASE64_STANDARD.encode(self.data_contract.id()), + self.identity_contract_nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs index 425a5f00a54..73c0a492613 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs @@ -3,6 +3,7 @@ use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; use crate::serialization::Signable; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::data_contract_update_transition::methods::DataContractUpdateTransitionMethodsV0; use crate::state_transition::data_contract_update_transition::{ DataContractUpdateTransition, DataContractUpdateTransitionV0, @@ -18,17 +19,21 @@ impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransitionV0 { data_contract: DataContract, identity: &PartialIdentity, key_id: KeyID, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _feature_version: Option, ) -> Result { let transition = DataContractUpdateTransition::V0(DataContractUpdateTransitionV0 { + identity_contract_nonce, data_contract: data_contract.try_into_platform_versioned(platform_version)?, + user_fee_increase, signature_public_key_id: key_id, signature: Default::default(), }); - //todo remove close - let mut state_transition: StateTransition = transition.clone().into(); + + let mut state_transition: StateTransition = transition.into(); let value = state_transition.signable_bytes()?; let public_key = identity diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs index 30d02d93379..9759ab775b4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs @@ -4,6 +4,9 @@ use crate::state_transition::data_contract_update_transition::fields::*; use crate::state_transition::data_contract_update_transition::{ DataContractUpdateTransitionV0, BINARY_FIELDS, IDENTIFIER_FIELDS, U32_FIELDS, }; +use crate::state_transition::state_transitions::common_fields::property_names::{ + IDENTITY_CONTRACT_NONCE, USER_FEE_INCREASE, +}; use crate::state_transition::StateTransitionFieldTypes; use crate::state_transition::StateTransitionValueConvert; use crate::ProtocolError; @@ -49,6 +52,14 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version: &PlatformVersion, ) -> Result { Ok(DataContractUpdateTransitionV0 { + identity_contract_nonce: raw_object.remove_integer(IDENTITY_CONTRACT_NONCE).map_err( + |_| { + ProtocolError::DecodingError( + "identity contract nonce missing on data contract update state transition" + .to_string(), + ) + }, + )?, signature: raw_object .remove_optional_binary_data(SIGNATURE) .map_err(ProtocolError::ValueError)? @@ -67,6 +78,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } @@ -75,6 +90,14 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version: &PlatformVersion, ) -> Result { Ok(DataContractUpdateTransitionV0 { + identity_contract_nonce: raw_value_map + .remove_integer(IDENTITY_CONTRACT_NONCE) + .map_err(|_| { + ProtocolError::DecodingError( + "identity contract nonce missing on data contract update state transition" + .to_string(), + ) + })?, signature: raw_value_map .remove_optional_binary_data(SIGNATURE) .map_err(ProtocolError::ValueError)? @@ -93,6 +116,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_value_map + .remove_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs index f8e4b467d3b..fd7c376f7b9 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs @@ -7,6 +7,10 @@ pub enum DocumentTransitionActionType { Create, //the entropy used Replace, Delete, + Transfer, + Purchase, + UpdatePrice, + IgnoreWhileBumpingRevision, } pub trait TransitionActionTypeGetter { @@ -19,6 +23,9 @@ impl TransitionActionTypeGetter for DocumentTransition { DocumentTransition::Create(_) => DocumentTransitionActionType::Create, DocumentTransition::Delete(_) => DocumentTransitionActionType::Delete, DocumentTransition::Replace(_) => DocumentTransitionActionType::Replace, + DocumentTransition::Transfer(_) => DocumentTransitionActionType::Transfer, + DocumentTransition::UpdatePrice(_) => DocumentTransitionActionType::UpdatePrice, + DocumentTransition::Purchase(_) => DocumentTransitionActionType::Purchase, } } } @@ -31,6 +38,7 @@ impl TryFrom<&str> for DocumentTransitionActionType { "create" => Ok(DocumentTransitionActionType::Create), "replace" => Ok(DocumentTransitionActionType::Replace), "delete" => Ok(DocumentTransitionActionType::Delete), + "transfer" => Ok(DocumentTransitionActionType::Transfer), action_type => Err(ProtocolError::Generic(format!( "unknown action type {action_type}" ))), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs index cbbd27c0eaf..b7e0135ed04 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs @@ -3,6 +3,7 @@ pub(in crate::state_transition::state_transitions::document::documents_batch_tra pub const DATA_CONTRACT_ID: &str = "$dataContractId"; pub const DOCUMENT_TYPE: &str = "$type"; pub const ACTION: &str = "$action"; + pub const IDENTITY_CONTRACT_NONCE: &str = "$identityContractNonce"; } pub const IDENTIFIER_FIELDS: [&str; 2] = [property_names::ID, property_names::DATA_CONTRACT_ID]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs index 37044e028f6..e500bbd5bd5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::ProtocolError; @@ -9,6 +10,7 @@ impl DocumentBaseTransition { pub fn from_document( document: &Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, ) -> Result { @@ -19,7 +21,12 @@ impl DocumentBaseTransition { .document_base_state_transition .default_current_version, ) { - 0 => Ok(DocumentBaseTransitionV0::from_document(document, document_type).into()), + 0 => Ok(DocumentBaseTransitionV0::from_document( + document, + document_type, + identity_contract_nonce, + ) + .into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "DocumentBaseTransition::from_document".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs index 71c8be92158..25dd569fb3e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs @@ -3,18 +3,32 @@ mod from_document; pub mod v0; mod v0_methods; +#[cfg(any( + feature = "state-transition-value-conversion", + feature = "state-transition-json-conversion" +))] use crate::data_contract::DataContract; use crate::state_transition::documents_batch_transition::document_base_transition::v0::{ DocumentBaseTransitionV0, DocumentTransitionObjectLike, }; +#[cfg(any( + feature = "state-transition-value-conversion", + feature = "state-transition-json-conversion" +))] use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::{Display, From}; pub use fields::*; +#[cfg(any( + feature = "state-transition-value-conversion", + feature = "state-transition-json-conversion" +))] use platform_value::Value; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "state-transition-value-conversion")] use std::collections::BTreeMap; #[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs index 236927bc074..7d3e6ef348b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs @@ -1,15 +1,18 @@ use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0Getters}; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; impl DocumentBaseTransitionV0 { pub(in crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_base_transition) fn from_document( document: &Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, ) -> Self { DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce, document_type_name: document_type.name().to_string(), data_contract_id: document_type.data_contract_id(), } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs index 44ad4a334f5..8392b812230 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs @@ -1,19 +1,32 @@ pub mod from_document; pub mod v0_methods; +#[cfg(feature = "state-transition-value-conversion")] use std::collections::BTreeMap; use bincode::{Decode, Encode}; use derive_more::Display; +#[cfg(feature = "state-transition-value-conversion")] use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; +#[cfg(feature = "state-transition-value-conversion")] use platform_value::Value; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; +#[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "state-transition-value-conversion")] use crate::data_contract::accessors::v0::DataContractV0Getters; +use crate::identifier::Identifier; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-value-conversion")] use crate::state_transition::documents_batch_transition::document_base_transition::property_names; -use crate::{data_contract::DataContract, errors::ProtocolError, identifier::Identifier}; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] +use crate::{data_contract::DataContract, errors::ProtocolError}; #[derive(Debug, Clone, Encode, Decode, Default, PartialEq, Display)] #[cfg_attr( @@ -31,6 +44,11 @@ pub struct DocumentBaseTransitionV0 { /// The document ID #[cfg_attr(feature = "state-transition-serde-conversion", serde(rename = "$id"))] pub id: Identifier, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$identity-contract-nonce") + )] + pub identity_contract_nonce: IdentityNonce, /// Name of document type found int the data contract associated with the `data_contract_id` #[cfg_attr(feature = "state-transition-serde-conversion", serde(rename = "$type"))] pub document_type_name: String, @@ -47,12 +65,14 @@ impl DocumentBaseTransitionV0 { pub fn from_value_map_consume( map: &mut BTreeMap, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { Ok(DocumentBaseTransitionV0 { id: Identifier::from( map.remove_hash256_bytes(property_names::ID) .map_err(ProtocolError::ValueError)?, ), + identity_contract_nonce, document_type_name: map .remove_string(property_names::DOCUMENT_TYPE) .map_err(ProtocolError::ValueError)?, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs index f14e445d823..c332648a547 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs @@ -1,5 +1,6 @@ use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; +use crate::prelude::IdentityNonce; use platform_value::Identifier; /// A trait that contains getter and setter methods for `DocumentBaseTransitionV0` @@ -22,6 +23,8 @@ pub trait DocumentBaseTransitionV0Methods { /// Sets the data contract ID. fn set_data_contract_id(&mut self, data_contract_id: Identifier); + fn identity_contract_nonce(&self) -> IdentityNonce; + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce); } impl DocumentBaseTransitionV0Methods for DocumentBaseTransitionV0 { @@ -52,4 +55,12 @@ impl DocumentBaseTransitionV0Methods for DocumentBaseTransitionV0 { fn set_data_contract_id(&mut self, data_contract_id: Identifier) { self.data_contract_id = data_contract_id; } + + fn identity_contract_nonce(&self) -> IdentityNonce { + self.identity_contract_nonce + } + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + self.identity_contract_nonce = identity_contract_nonce; + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs index 803e6c5835b..c7a543b5551 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs @@ -2,6 +2,7 @@ use crate::state_transition::documents_batch_transition::document_base_transitio use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::prelude::IdentityNonce; use platform_value::Identifier; impl DocumentBaseTransitionV0Methods for DocumentBaseTransition { @@ -46,4 +47,16 @@ impl DocumentBaseTransitionV0Methods for DocumentBaseTransition { DocumentBaseTransition::V0(v0) => v0.set_data_contract_id(data_contract_id), } } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DocumentBaseTransition::V0(v0) => v0.identity_contract_nonce, + } + } + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + match self { + DocumentBaseTransition::V0(v0) => v0.identity_contract_nonce = identity_contract_nonce, + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs index 9c52c268a69..bca79958bad 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs @@ -1,21 +1,58 @@ +#[cfg(feature = "state-transition-json-conversion")] use crate::data_contract::accessors::v0::DataContractV0Getters; +#[cfg(feature = "state-transition-json-conversion")] use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use crate::prelude::DataContract; +#[cfg(feature = "state-transition-json-conversion")] use crate::state_transition::data_contract_update_transition::IDENTIFIER_FIELDS; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentTransitionObjectLike; +#[cfg(feature = "state-transition-json-conversion")] use crate::state_transition::documents_batch_transition::document_create_transition::v0::BINARY_FIELDS; -use crate::state_transition::documents_batch_transition::document_create_transition::{ - DocumentCreateTransition, DocumentCreateTransitionV0, -}; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] +use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; +#[cfg(feature = "state-transition-value-conversion")] +use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; +#[cfg(feature = "state-transition-value-conversion")] use crate::state_transition::documents_batch_transition::fields::property_names::STATE_TRANSITION_PROTOCOL_VERSION; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use crate::ProtocolError; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use platform_value::btreemap_extensions::{ BTreeValueMapHelper, BTreeValueMapReplacementPathHelper, BTreeValueRemoveFromMapHelper, }; -use platform_value::{ReplacementType, Value}; +#[cfg(feature = "state-transition-json-conversion")] +use platform_value::ReplacementType; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] +use platform_value::Value; +#[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "state-transition-value-conversion")] use std::collections::BTreeMap; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] impl DocumentTransitionObjectLike for DocumentCreateTransition { #[cfg(feature = "state-transition-json-conversion")] fn from_json_object( diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs index 82ad07502bd..e275f726479 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; use crate::state_transition::documents_batch_transition::document_transition::DocumentCreateTransition; use crate::ProtocolError; @@ -10,6 +11,7 @@ impl DocumentCreateTransition { document: Document, document_type: DocumentTypeRef, entropy: [u8; 32], + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, base_feature_version: Option, @@ -26,6 +28,7 @@ impl DocumentCreateTransition { document, document_type, entropy, + identity_contract_nonce, platform_version, base_feature_version, )? diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs index 752e0ad1d5f..2af4a2174f8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs @@ -3,8 +3,16 @@ pub mod from_document; pub mod v0; mod v0_methods; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::Document; +use crate::state_transition::documents_batch_transition::document_create_transition::v0::DocumentFromCreateTransitionV0; +use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::{Display, From}; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use v0::DocumentCreateTransitionV0; @@ -23,3 +31,96 @@ impl Default for DocumentCreateTransition { DocumentCreateTransition::V0(DocumentCreateTransitionV0::default()) // since only v0 } } + +/// document from create transition +pub trait DocumentFromCreateTransition { + /// Attempts to create a new `Document` from the given `DocumentCreateTransition` reference, `owner_id`, and additional metadata. + /// + /// # Arguments + /// + /// * `document_create_transition` - A reference to the `DocumentCreateTransition` containing information about the document being created. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `block_info` - The block info containing information about the current block such as block time, block height and core block height. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform for compatibility. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_create_transition( + document_create_transition: &DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + + /// Attempts to create a new `Document` from the given `DocumentCreateTransition` instance, `owner_id`, and additional metadata. + /// + /// # Arguments + /// + /// * `document_create_transition` - A `DocumentCreateTransition` instance containing information about the document being created. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `block_info` - The block info containing information about the current block such as block time, block height and core block height. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform for compatibility. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_owned_create_transition( + document_create_transition: DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromCreateTransition for Document { + fn try_from_create_transition( + document_create_transition: &DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + match document_create_transition { + DocumentCreateTransition::V0(v0) => Self::try_from_create_transition_v0( + v0, + owner_id, + block_info, + document_type, + platform_version, + ), + } + } + + fn try_from_owned_create_transition( + document_create_transition: DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + match document_create_transition { + DocumentCreateTransition::V0(v0) => Self::try_from_owned_create_transition_v0( + v0, + owner_id, + block_info, + document_type, + platform_version, + ), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs index 3ef8cfd5b4a..3132a4ba07f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs @@ -1,5 +1,7 @@ +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0Getters}; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; use crate::ProtocolError; @@ -10,20 +12,23 @@ impl DocumentCreateTransitionV0 { document: Document, document_type: DocumentTypeRef, entropy: [u8; 32], + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, base_feature_version: Option, ) -> Result { + let prefunded_voting_balance = + document_type.prefunded_voting_balance_for_document(&document, platform_version)?; Ok(DocumentCreateTransitionV0 { base: DocumentBaseTransition::from_document( &document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )?, entropy, - created_at: document.created_at(), - updated_at: document.updated_at(), data: document.properties_consumed(), + prefunded_voting_balance, }) } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs index 35bc26c463b..b15cdf0e590 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs @@ -3,28 +3,42 @@ pub mod v0_methods; use bincode::{Decode, Encode}; +#[cfg(feature = "state-transition-value-conversion")] use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; -use platform_value::Value; +use platform_value::{Identifier, Value}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; use std::string::ToString; -use crate::identity::TimestampMillis; +#[cfg(feature = "state-transition-value-conversion")] +use crate::data_contract::DataContract; -use crate::{data_contract::DataContract, errors::ProtocolError}; +use crate::{document, errors::ProtocolError}; -use crate::state_transition::documents_batch_transition::document_base_transition::v0::{ - DocumentBaseTransitionV0, DocumentTransitionObjectLike, -}; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::{Document, DocumentV0}; +use crate::fee::Credits; +use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; +#[cfg(feature = "state-transition-value-conversion")] +use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentTransitionObjectLike; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use derive_more::Display; +#[cfg(feature = "state-transition-value-conversion")] +use platform_value::btreemap_extensions::BTreeValueRemoveTupleFromMapHelper; +use platform_version::version::PlatformVersion; -pub(self) mod property_names { +#[cfg(feature = "state-transition-value-conversion")] +use crate::state_transition::documents_batch_transition; + +mod property_names { pub const ENTROPY: &str = "$entropy"; - pub const CREATED_AT: &str = "$createdAt"; - pub const UPDATED_AT: &str = "$updatedAt"; + pub const PREFUNDED_VOTING_BALANCE: &str = "$prefundedVotingBalance"; } /// The Binary fields in [`DocumentCreateTransition`] @@ -38,14 +52,7 @@ pub use super::super::document_base_transition::IDENTIFIER_FIELDS; derive(Serialize, Deserialize), serde(rename_all = "camelCase") )] -#[display( - fmt = "Base: {}, Entropy: {:?}, Created At: {:?}, Updated At: {:?}, Data: {:?}", - "base", - "entropy", - "created_at", - "updated_at", - "data" -)] +#[display(fmt = "Base: {}, Entropy: {:?}, Data: {:?}", "base", "entropy", "data")] pub struct DocumentCreateTransitionV0 { /// Document Base Transition #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] @@ -58,73 +65,19 @@ pub struct DocumentCreateTransitionV0 { )] pub entropy: [u8; 32], + #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] + pub data: BTreeMap, + #[cfg_attr( feature = "state-transition-serde-conversion", - serde(rename = "$createdAt", skip_serializing_if = "Option::is_none") - )] - pub created_at: Option, - // TODO: It should be moved to update transition - #[cfg_attr( - feature = "state-transition-serde-conversion", - serde(rename = "$updatedAt", skip_serializing_if = "Option::is_none") + serde(rename = "$prefundedVotingBalance") )] - pub updated_at: Option, - - #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] - pub data: BTreeMap, + /// Pre funded balance (for unique index conflict resolution voting - the identity will put money + /// aside that will be used by voters to vote) + /// This is a map of index names to the amount we want to prefund them for + /// Since index conflict resolution is not a common feature most often nothing should be added here. + pub prefunded_voting_balance: Option<(String, Credits)>, } -// -// impl DocumentCreateTransitionV0 { -// pub fn get_revision(&self) -> Option { -// //todo: fix this -// Some(INITIAL_REVISION) -// } -// -// pub(crate) fn to_document(&self, owner_id: Identifier) -> Result { -// let properties = self.data.clone().unwrap_or_default(); -// Ok(Document { -// id: self.base.id, -// owner_id, -// properties, -// created_at: self.created_at, -// updated_at: self.updated_at, -// revision: self.get_revision(), -// }) -// } -// -// pub(crate) fn to_extended_document( -// &self, -// owner_id: Identifier, -// ) -> Result { -// Ok(ExtendedDocument { -// feature_version: LATEST_PLATFORM_VERSION -// .extended_document -// .default_current_version, -// document_type_name: self.base.document_type_name.clone(), -// data_contract_id: self.base.data_contract_id, -// document: self.to_document(owner_id)?, -// data_contract: self.base.data_contract.clone(), -// metadata: None, -// entropy: Bytes32::new(self.entropy), -// }) -// } -// -// pub(crate) fn into_document(self, owner_id: Identifier) -> Result { -// let id = self.base.id; -// let revision = self.get_revision(); -// let created_at = self.created_at; -// let updated_at = self.updated_at; -// let properties = self.data.unwrap_or_default(); -// Ok(Document { -// id, -// owner_id, -// properties, -// created_at, -// updated_at, -// revision, -// }) -// } -// } impl DocumentCreateTransitionV0 { #[cfg(feature = "state-transition-value-conversion")] @@ -132,20 +85,20 @@ impl DocumentCreateTransitionV0 { mut map: BTreeMap, data_contract: DataContract, ) -> Result { + let identity_contract_nonce = map + .remove_integer(documents_batch_transition::document_base_transition::property_names::IDENTITY_CONTRACT_NONCE) + .map_err(ProtocolError::ValueError)?; Ok(Self { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0::from_value_map_consume( &mut map, data_contract, + identity_contract_nonce, )?), entropy: map .remove_hash256_bytes(property_names::ENTROPY) .map_err(ProtocolError::ValueError)?, - created_at: map - .remove_optional_integer(property_names::CREATED_AT) - .map_err(ProtocolError::ValueError)?, - updated_at: map - .remove_optional_integer(property_names::UPDATED_AT) - .map_err(ProtocolError::ValueError)?, + prefunded_voting_balance: map + .remove_optional_tuple(property_names::PREFUNDED_VOTING_BALANCE)?, data: map, }) } @@ -157,16 +110,13 @@ impl DocumentCreateTransitionV0 { property_names::ENTROPY.to_string(), Value::Bytes(self.entropy.to_vec()), ); - if let Some(created_at) = self.created_at { - transition_base_map.insert( - property_names::CREATED_AT.to_string(), - Value::U64(created_at), - ); - } - if let Some(updated_at) = self.updated_at { + + if let Some((index_name, prefunded_voting_balance)) = &self.prefunded_voting_balance { + let index_name_value = Value::Text(index_name.clone()); + let prefunded_voting_balance_value = Value::U64(*prefunded_voting_balance); transition_base_map.insert( - property_names::UPDATED_AT.to_string(), - Value::U64(updated_at), + property_names::PREFUNDED_VOTING_BALANCE.to_string(), + Value::Array(vec![index_name_value, prefunded_voting_balance_value]), ); } @@ -176,6 +126,264 @@ impl DocumentCreateTransitionV0 { } } +/// documents from create transition v0 +pub trait DocumentFromCreateTransitionV0 { + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionV0` instance, incorporating additional metadata such as ownership and block information. + /// + /// This function is responsible for taking an owned `DocumentCreateTransitionV0` instance, which encapsulates the initial data for a document, and augmenting this with metadata including the document owner's identifier, block information, and the requirement status of `created_at` and `updated_at` timestamps, as dictated by the associated data contract and the current platform version. + /// + /// # Arguments + /// + /// * `v0` - An owned `DocumentCreateTransitionV0` instance containing the initial data for the document being created. + /// * `owner_id` - The `Identifier` of the document's owner, specifying who will own the newly created document. + /// * `block_info` - A reference to the `BlockInfo`, which provides context about the block height and other block-related metadata at the time of document creation. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion`, which may influence the creation process or validation logic based on the version-specific rules or features of the platform. + /// + /// # Returns + /// + /// * `Result` - On successful creation, returns a new `Document` object populated with the provided data and augmented with necessary metadata. If the creation process encounters any validation failures or other issues, it returns a `ProtocolError`. + /// + fn try_from_owned_create_transition_v0( + v0: DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionV0` reference, incorporating additional metadata like ownership and block information. + /// + /// This function takes a `DocumentCreateTransitionV0` reference, which contains the initial data for the document, and combines it with metadata such as the document owner's identifier, block information, and requirements for timestamp fields based on the associated data contract and platform version. + /// + /// # Arguments + /// + /// * `v0` - A reference to the `DocumentCreateTransitionV0` containing initial data for the document being created. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `block_info` - A reference to the `BlockInfo` containing the block height at which the document is being created. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being created. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, populated with the provided data and metadata. Returns a `ProtocolError` if the creation fails due to issues like missing required fields, incorrect types, or other validation failures. + /// + fn try_from_create_transition_v0( + v0: &DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromCreateTransitionV0 for Document { + fn try_from_owned_create_transition_v0( + v0: DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + let DocumentCreateTransitionV0 { base, data, .. } = v0; + + match base { + DocumentBaseTransition::V0(base_v0) => { + let DocumentBaseTransitionV0 { id, .. } = base_v0; + + let requires_created_at = document_type + .required_fields() + .contains(document::property_names::CREATED_AT); + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_created_at_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_BLOCK_HEIGHT); + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_created_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_CORE_BLOCK_HEIGHT); + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let created_at = if requires_created_at { + Some(block_info.time_ms) + } else { + None + }; + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let created_at_block_height = if requires_created_at_block_height { + Some(block_info.height) + } else { + None + }; + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let created_at_core_block_height = if requires_created_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id, + owner_id, + properties: data, + revision: document_type.initial_revision(), + created_at, + updated_at, + transferred_at: None, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height: None, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height: None, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_create_transition_v0".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + } + } + + fn try_from_create_transition_v0( + v0: &DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + let DocumentCreateTransitionV0 { base, data, .. } = v0; + + match base { + DocumentBaseTransition::V0(base_v0) => { + let DocumentBaseTransitionV0 { id, .. } = base_v0; + + let requires_created_at = document_type + .required_fields() + .contains(document::property_names::CREATED_AT); + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_created_at_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_BLOCK_HEIGHT); + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_created_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_CORE_BLOCK_HEIGHT); + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let created_at = if requires_created_at { + Some(block_info.time_ms) + } else { + None + }; + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let created_at_block_height = if requires_created_at_block_height { + Some(block_info.height) + } else { + None + }; + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let created_at_core_block_height = if requires_created_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id: *id, + owner_id, + properties: data.clone(), + revision: document_type.initial_revision(), + created_at, + updated_at, + transferred_at: None, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height: None, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height: None, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_owned_create_transition_v0".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + } + } +} + #[cfg(test)] mod test { use crate::data_contract::data_contract::DataContractV0; @@ -280,6 +488,7 @@ mod test { "id" : id, "$type" : "test", "$dataContractId" : data_contract_id, + "$identityContractNonce": 0u64, "revision" : 1u32, "alphaBinary" : alpha_binary, "alphaIdentifier" : alpha_identifier, @@ -311,7 +520,7 @@ mod test { } #[test] - fn covert_to_object_from_json_value_with_dynamic_binary_paths() { + fn convert_to_object_from_json_value_with_dynamic_binary_paths() { let data_contract = data_contract_with_dynamic_properties(); let alpha_value = vec![10_u8; 32]; let id = vec![11_u8; 32]; @@ -324,6 +533,7 @@ mod test { "$id" : id, "$type" : "test", "$dataContractId" : data_contract_id, + "$identityContractNonce": 0u64, "revision" : 1, "alphaBinary" : alpha_value, "alphaIdentifier" : alpha_value, @@ -340,7 +550,6 @@ mod test { .into_btree_string_map() .unwrap(); - println!("{:?}", object_transition); let v0 = object_transition.get("V0").expect("to get V0"); let right_id = Identifier::from_bytes(&id).unwrap(); let right_data_contract_id = Identifier::from_bytes(&data_contract_id).unwrap(); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs index 62b19c64ada..e5e2aa8710b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs @@ -1,10 +1,9 @@ -use crate::identity::TimestampMillis; - use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; use platform_value::Value; +use crate::fee::Credits; use std::collections::BTreeMap; pub trait DocumentCreateTransitionV0Methods { @@ -31,26 +30,6 @@ pub trait DocumentCreateTransitionV0Methods { /// * `entropy` - An array of 32 bytes to set. fn set_entropy(&mut self, entropy: [u8; 32]); - /// Returns a reference to the `created_at` field of the `DocumentCreateTransitionV0`. - fn created_at(&self) -> Option; - - /// Sets the value of the `created_at` field in the `DocumentCreateTransitionV0`. - /// - /// # Arguments - /// - /// * `created_at` - An `Option` containing a `TimestampMillis` value to set. - fn set_created_at(&mut self, created_at: Option); - - /// Returns a reference to the `updated_at` field of the `DocumentCreateTransitionV0`. - fn updated_at(&self) -> Option; - - /// Sets the value of the `updated_at` field in the `DocumentCreateTransitionV0`. - /// - /// # Arguments - /// - /// * `updated_at` - An `Option` containing a `TimestampMillis` value to set. - fn set_updated_at(&mut self, updated_at: Option); - /// Returns an optional reference to the `data` field of the `DocumentCreateTransitionV0`. fn data(&self) -> &BTreeMap; @@ -63,6 +42,10 @@ pub trait DocumentCreateTransitionV0Methods { /// /// * `data` - An `Option` containing a `BTreeMap` to set. fn set_data(&mut self, data: BTreeMap); + fn prefunded_voting_balance(&self) -> &Option<(String, Credits)>; + fn prefunded_voting_balances_mut(&mut self) -> &mut Option<(String, Credits)>; + fn set_prefunded_voting_balance(&mut self, index_name: String, amount: Credits); + fn clear_prefunded_voting_balance(&mut self); } impl DocumentCreateTransitionV0Methods for DocumentCreateTransitionV0 { @@ -86,31 +69,30 @@ impl DocumentCreateTransitionV0Methods for DocumentCreateTransitionV0 { self.entropy = entropy; } - fn created_at(&self) -> Option { - self.created_at + fn data(&self) -> &BTreeMap { + &self.data } - fn set_created_at(&mut self, created_at: Option) { - self.created_at = created_at; + fn data_mut(&mut self) -> &mut BTreeMap { + &mut self.data } - fn updated_at(&self) -> Option { - self.updated_at + fn set_data(&mut self, data: BTreeMap) { + self.data = data; } - fn set_updated_at(&mut self, updated_at: Option) { - self.updated_at = updated_at; + fn prefunded_voting_balance(&self) -> &Option<(String, Credits)> { + &self.prefunded_voting_balance } - fn data(&self) -> &BTreeMap { - &self.data + fn prefunded_voting_balances_mut(&mut self) -> &mut Option<(String, Credits)> { + &mut self.prefunded_voting_balance } - fn data_mut(&mut self) -> &mut BTreeMap { - &mut self.data + fn set_prefunded_voting_balance(&mut self, index_name: String, amount: Credits) { + self.prefunded_voting_balance = Some((index_name, amount)); } - - fn set_data(&mut self, data: BTreeMap) { - self.data = data; + fn clear_prefunded_voting_balance(&mut self) { + self.prefunded_voting_balance = None; } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs index 3d7be5840b3..11d349f56ca 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; use platform_value::{Value}; -use crate::identity::TimestampMillis; +use crate::fee::Credits; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; use crate::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; @@ -36,45 +36,45 @@ impl DocumentCreateTransitionV0Methods for DocumentCreateTransition { } } - fn created_at(&self) -> Option { + fn data(&self) -> &BTreeMap { match self { - DocumentCreateTransition::V0(v0) => v0.created_at, + DocumentCreateTransition::V0(v0) => &v0.data, } } - fn set_created_at(&mut self, created_at: Option) { + fn data_mut(&mut self) -> &mut BTreeMap { match self { - DocumentCreateTransition::V0(v0) => v0.created_at = created_at, + DocumentCreateTransition::V0(v0) => &mut v0.data, } } - fn updated_at(&self) -> Option { + fn set_data(&mut self, data: BTreeMap) { match self { - DocumentCreateTransition::V0(v0) => v0.updated_at, + DocumentCreateTransition::V0(v0) => v0.data = data, } } - fn set_updated_at(&mut self, updated_at: Option) { + fn prefunded_voting_balance(&self) -> &Option<(String, Credits)> { match self { - DocumentCreateTransition::V0(v0) => v0.updated_at = updated_at, + DocumentCreateTransition::V0(v0) => v0.prefunded_voting_balance(), } } - fn data(&self) -> &BTreeMap { + fn prefunded_voting_balances_mut(&mut self) -> &mut Option<(String, Credits)> { match self { - DocumentCreateTransition::V0(v0) => &v0.data, + DocumentCreateTransition::V0(v0) => v0.prefunded_voting_balances_mut(), } } - fn data_mut(&mut self) -> &mut BTreeMap { + fn set_prefunded_voting_balance(&mut self, index_name: String, amount: Credits) { match self { - DocumentCreateTransition::V0(v0) => &mut v0.data, + DocumentCreateTransition::V0(v0) => v0.set_prefunded_voting_balance(index_name, amount), } } - fn set_data(&mut self, data: BTreeMap) { + fn clear_prefunded_voting_balance(&mut self) { match self { - DocumentCreateTransition::V0(v0) => v0.data = data, + DocumentCreateTransition::V0(v0) => v0.clear_prefunded_voting_balance(), } } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs index c177c2e369d..3c6dfa6b80a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use platform_version::version::{FeatureVersion, PlatformVersion}; @@ -10,6 +11,7 @@ impl DocumentDeleteTransition { pub fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, base_feature_version: Option, @@ -25,6 +27,7 @@ impl DocumentDeleteTransition { 0 => Ok(DocumentDeleteTransitionV0::from_document( document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )? diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs index 94f386fbdb9..7a0f8fb2a62 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs @@ -1,9 +1,10 @@ mod from_document; pub mod v0; -mod v0_methods; +pub mod v0_methods; use bincode::{Decode, Encode}; use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use v0::*; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs index 59a1f3a2453..4fac1aff9f4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs @@ -1,6 +1,7 @@ use platform_version::version::{FeatureVersion, PlatformVersion}; use crate::data_contract::document_type::{DocumentTypeRef}; use crate::document::{Document}; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_transition::document_delete_transition::DocumentDeleteTransitionV0; @@ -9,6 +10,7 @@ impl DocumentDeleteTransitionV0 { pub(crate) fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, base_feature_version: Option, ) -> Result { @@ -16,6 +18,7 @@ impl DocumentDeleteTransitionV0 { base: DocumentBaseTransition::from_document( &document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )?, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs index d858b37db8a..813ea0b2ddf 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs @@ -6,6 +6,7 @@ use crate::state_transition::documents_batch_transition::document_base_transitio use bincode::{Decode, Encode}; use derive_more::Display; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use super::super::document_base_transition::IDENTIFIER_FIELDS; @@ -21,92 +22,3 @@ pub struct DocumentDeleteTransitionV0 { #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] pub base: DocumentBaseTransition, } -// -// impl DocumentTransitionObjectLike for DocumentDeleteTransitionV0 { -// #[cfg(feature = "state-transition-json-conversion")] -// fn from_json_object( -// json_value: JsonValue, -// data_contract: DataContract, -// ) -> Result { -// let mut document: DocumentDeleteTransitionV0 = serde_json::from_value(json_value)?; -// document.base.data_contract = data_contract; -// -// Ok(document) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_object( -// raw_transition: Value, -// data_contract: DataContract, -// ) -> Result { -// let base = DocumentBaseTransition::from_object(raw_transition, data_contract)?; -// -// Ok(DocumentDeleteTransitionV0 { base }) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_value_map( -// mut map: BTreeMap, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let base = DocumentBaseTransition::from_value_map_consume(&mut map, data_contract)?; -// -// Ok(DocumentDeleteTransitionV0 { base }) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_object(&self) -> Result { -// self.base.to_object() -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_value_map(&self) -> Result, ProtocolError> { -// self.base.to_value_map() -// } -// -// #[cfg(feature = "state-transition-json-conversion")] -// fn to_json(&self) -> Result { -// self.base.to_json() -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_cleaned_object(&self) -> Result { -// self.base.to_cleaned_object() -// } -// } -// -// #[cfg(test)] -// mod test { -// use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0Methods; -// use super::*; -// -// fn init() { -// let _ = env_logger::builder() -// .filter_level(log::LevelFilter::Debug) -// .try_init(); -// } -// -// #[test] -// fn test_deserialize_serialize_to_json() { -// init(); -// let transition_json = r#"{ -// "$action": 3, -// "$dataContractId": "5wpZAEWndYcTeuwZpkmSa8s49cHXU5q2DhdibesxFSu8", -// "$id": "6oCKUeLVgjr7VZCyn1LdGbrepqKLmoabaff5WQqyTKYP", -// "$type": "note" -// }"#; -// -// let cdt: DocumentDeleteTransitionV0 = -// serde_json::from_str(transition_json).expect("no error"); -// -// assert_eq!(cdt.base.document_type_name(), "note"); -// -// let mut json_no_whitespace = transition_json.to_string(); -// json_no_whitespace.retain(|v| !v.is_whitespace()); -// -// assert_eq!(cdt.to_json().unwrap().to_string(), json_no_whitespace); -// } -// } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/from_document.rs new file mode 100644 index 00000000000..d4b913405f0 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/from_document.rs @@ -0,0 +1,45 @@ +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::Document; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use platform_version::version::{FeatureVersion, PlatformVersion}; + +use crate::state_transition::documents_batch_transition::document_transition::{DocumentPurchaseTransition}; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::DocumentPurchaseTransitionV0; + +impl DocumentPurchaseTransition { + pub fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + feature_version: Option, + base_feature_version: Option, + ) -> Result { + match feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .document_purchase_state_transition + .bounds + .default_current_version, + ) { + 0 => Ok(DocumentPurchaseTransitionV0::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + base_feature_version, + )? + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentPurchaseTransition::from_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/mod.rs new file mode 100644 index 00000000000..9a5664cfaae --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/mod.rs @@ -0,0 +1,19 @@ +mod from_document; +pub mod v0; +pub mod v0_methods; + +use bincode::{Decode, Encode}; +use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; +pub use v0::*; + +#[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize) +)] +pub enum DocumentPurchaseTransition { + #[display(fmt = "V0({})", "_0")] + V0(DocumentPurchaseTransitionV0), +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/from_document.rs new file mode 100644 index 00000000000..80bfc2115c5 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/from_document.rs @@ -0,0 +1,40 @@ +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document, DocumentV0Getters}; +use crate::document::errors::DocumentError; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::DocumentPurchaseTransitionV0; + +impl DocumentPurchaseTransitionV0 { + pub(crate) fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + base_feature_version: Option, + ) -> Result { + let Some(revision) = document.revision() else { + return Err(ProtocolError::Document(Box::new( + DocumentError::DocumentNoRevisionError { + document: Box::new(document.clone()), + }, + ))); + }; + + Ok(DocumentPurchaseTransitionV0 { + base: DocumentBaseTransition::from_document( + &document, + document_type, + identity_contract_nonce, + platform_version, + base_feature_version, + )?, + revision, + price, + }) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/mod.rs new file mode 100644 index 00000000000..255310c394c --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/mod.rs @@ -0,0 +1,33 @@ +mod from_document; +pub mod v0_methods; + +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +use bincode::{Decode, Encode}; +use derive_more::Display; + +use crate::fee::Credits; +use crate::prelude::Revision; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +pub use super::super::document_base_transition::IDENTIFIER_FIELDS; + +#[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[display(fmt = "Base: {}", "base")] +pub struct DocumentPurchaseTransitionV0 { + #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] + pub base: DocumentBaseTransition, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$revision") + )] + pub revision: Revision, + #[cfg_attr(feature = "state-transition-serde-conversion", serde(rename = "price"))] + pub price: Credits, +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..95333296e41 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/v0_methods.rs @@ -0,0 +1,50 @@ +use crate::fee::Credits; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::DocumentPurchaseTransitionV0; + +pub trait DocumentPurchaseTransitionV0Methods { + /// Returns a reference to the `base` field of the `DocumentCreateTransitionV0`. + fn base(&self) -> &DocumentBaseTransition; + fn base_mut(&mut self) -> &mut DocumentBaseTransition; + + /// Sets the value of the `base` field in the `DocumentCreateTransitionV0`. + /// + /// # Arguments + /// + /// * `base` - A value of type `DocumentBaseTransition` to set. + fn set_base(&mut self, base: DocumentBaseTransition); + + /// Returns a reference to the `revision` field of the `DocumentReplaceTransitionV0`. + fn revision(&self) -> Revision; + + /// Sets the value of the `revision` field in the `DocumentReplaceTransitionV0`. + fn set_revision(&mut self, revision: Revision); + fn price(&self) -> Credits; +} + +impl DocumentPurchaseTransitionV0Methods for DocumentPurchaseTransitionV0 { + fn base(&self) -> &DocumentBaseTransition { + &self.base + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + &mut self.base + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + self.base = base + } + + fn revision(&self) -> Revision { + self.revision + } + + fn set_revision(&mut self, revision: Revision) { + self.revision = revision; + } + + fn price(&self) -> Credits { + self.price + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0_methods.rs new file mode 100644 index 00000000000..86c2fe8f193 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0_methods.rs @@ -0,0 +1,43 @@ +use crate::fee::Credits; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::DocumentPurchaseTransition; + +impl DocumentPurchaseTransitionV0Methods for DocumentPurchaseTransition { + fn base(&self) -> &DocumentBaseTransition { + match self { + DocumentPurchaseTransition::V0(v0) => &v0.base, + } + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + match self { + DocumentPurchaseTransition::V0(v0) => &mut v0.base, + } + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + match self { + DocumentPurchaseTransition::V0(v0) => v0.base = base, + } + } + + fn revision(&self) -> Revision { + match self { + DocumentPurchaseTransition::V0(v0) => v0.revision, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentPurchaseTransition::V0(v0) => v0.revision = revision, + } + } + + fn price(&self) -> Credits { + match self { + DocumentPurchaseTransition::V0(v0) => v0.price, + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs index 33fe7617b7d..059da81c223 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs @@ -1,6 +1,7 @@ use platform_version::version::{FeatureVersion, PlatformVersion}; use crate::data_contract::document_type::{DocumentTypeRef}; use crate::document::{Document}; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use crate::state_transition::documents_batch_transition::document_transition::{DocumentReplaceTransition}; use crate::state_transition::documents_batch_transition::document_transition::document_replace_transition::DocumentReplaceTransitionV0; @@ -9,6 +10,7 @@ impl DocumentReplaceTransition { pub fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, base_feature_version: Option, @@ -24,6 +26,7 @@ impl DocumentReplaceTransition { 0 => Ok(DocumentReplaceTransitionV0::from_document( document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )? diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs index ea9cc31e767..8e805318b5e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs @@ -1,9 +1,17 @@ mod from_document; pub mod v0; -mod v0_methods; +pub mod v0_methods; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::Document; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; +use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::{Display, From}; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use v0::*; @@ -16,3 +24,144 @@ pub enum DocumentReplaceTransition { #[display(fmt = "V0({})", "_0")] V0(DocumentReplaceTransitionV0), } + +/// document from replace transition +pub trait DocumentFromReplaceTransition { + /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` reference, incorporating `owner_id`, creation metadata, and additional blockchain-related information. + /// + /// This method is designed to replace an existing document with new information, while also preserving and incorporating specific metadata about the document's creation and update history. + /// + /// # Arguments + /// + /// * `document_replace_transition_action` - A reference to the `DocumentReplaceTransition` containing the new information for the document being replaced. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp indicating when the original document was created. + /// * `created_at_block_height` - An optional block height indicating when the original document was created. + /// * `created_at_core_block_height` - An optional core block height indicating when the original document was created. + /// * `block_info` - Current block information used for updating document metadata. + /// * `document_type` - Reference to the document type to ensure compatibility and proper validation. + /// * `platform_version` - Reference to the current platform version to check for compatibility and apply version-specific logic. + /// + /// # Returns + /// + /// * `Result` - On successful document replacement, returns a new `Document` object populated with the provided data and metadata. On failure, returns a `ProtocolError` detailing the issue. + /// + /// # Errors + /// + /// This function may return `ProtocolError` if there are validation errors related to document data, missing required metadata, or incompatibilities with the current platform version. + fn try_from_replace_transition( + document_replace_transition_action: &DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + + /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` instance, incorporating `owner_id`, creation metadata, and additional blockchain-related information. + /// + /// This method functions similarly to `try_from_replace_transition`, but it consumes the `DocumentReplaceTransition` instance, making it suitable for use cases where the transition is not needed after document creation. + /// + /// # Arguments + /// + /// * `document_replace_transition_action` - An owned `DocumentReplaceTransition` instance containing the new information for the document being replaced. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp indicating when the original document was created. + /// * `created_at_block_height` - An optional block height indicating when the original document was created. + /// * `created_at_core_block_height` - An optional core block height indicating when the original document was created. + /// * `block_info` - Current block information used for updating document metadata. + /// * `document_type` - Reference to the document type to ensure compatibility and proper validation. + /// * `platform_version` - Reference to the current platform version to check for compatibility and apply version-specific logic. + /// + /// # Returns + /// + /// * `Result` - On successful document replacement, returns a new `Document` object. On failure, returns a `ProtocolError` detailing the issue. + /// + /// # Errors + /// + /// This function may return `ProtocolError` for the same reasons as `try_from_replace_transition`, including validation failures, missing metadata, or platform incompatibilities. + fn try_from_owned_replace_transition( + document_replace_transition_action: DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromReplaceTransition for Document { + fn try_from_replace_transition( + document_replace_transition: &DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match document_replace_transition { + DocumentReplaceTransition::V0(v0) => Self::try_from_replace_transition_v0( + v0, + owner_id, + created_at, + created_at_block_height, + created_at_core_block_height, + transferred_at, + transferred_at_block_height, + transferred_at_core_block_height, + block_info, + document_type, + platform_version, + ), + } + } + + fn try_from_owned_replace_transition( + document_replace_transition: DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match document_replace_transition { + DocumentReplaceTransition::V0(v0) => Self::try_from_owned_replace_transition_v0( + v0, + owner_id, + created_at, + created_at_block_height, + created_at_core_block_height, + transferred_at, + transferred_at_block_height, + transferred_at_core_block_height, + block_info, + document_type, + platform_version, + ), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs index e0df4cef72a..5fbd783eb67 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs @@ -2,6 +2,7 @@ use platform_version::version::{FeatureVersion, PlatformVersion}; use crate::data_contract::document_type::{DocumentTypeRef}; use crate::document::{Document, DocumentV0Getters}; use crate::document::errors::DocumentError; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_transition::document_replace_transition::DocumentReplaceTransitionV0; @@ -10,6 +11,7 @@ impl DocumentReplaceTransitionV0 { pub(crate) fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, base_feature_version: Option, ) -> Result { @@ -17,6 +19,7 @@ impl DocumentReplaceTransitionV0 { base: DocumentBaseTransition::from_document( &document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )?, @@ -25,7 +28,6 @@ impl DocumentReplaceTransitionV0 { document: Box::new(document.clone()), })) })?, - updated_at: document.updated_at(), data: document.properties_consumed(), }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs index 5b546fbc01d..2c7f96e8e4c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs @@ -1,22 +1,28 @@ mod from_document; pub mod v0_methods; -use crate::identity::TimestampMillis; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision, TimestampMillis}; use bincode::{Decode, Encode}; use derive_more::Display; -use platform_value::Value; +use platform_value::{Identifier, Value}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::{Document, DocumentV0}; +use crate::{document, ProtocolError}; +use platform_version::version::PlatformVersion; use std::collections::BTreeMap; pub use super::super::document_base_transition::IDENTIFIER_FIELDS; +use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; -pub(self) mod property_names { +mod property_names { pub const REVISION: &str = "$revision"; - pub const UPDATED_AT: &str = "$updatedAt"; } #[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] @@ -25,13 +31,7 @@ pub(self) mod property_names { derive(Serialize, Deserialize), serde(rename_all = "camelCase") )] -#[display( - fmt = "Base: {}, Revision: {}, Updated At: {:?}, Data: {:?}", - "base", - "revision", - "updated_at", - "data" -)] +#[display(fmt = "Base: {}, Revision: {}, Data: {:?}", "base", "revision", "data")] pub struct DocumentReplaceTransitionV0 { #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] pub base: DocumentBaseTransition, @@ -40,215 +40,241 @@ pub struct DocumentReplaceTransitionV0 { serde(rename = "$revision") )] pub revision: Revision, - #[cfg_attr( - feature = "state-transition-serde-conversion", - serde(skip_serializing_if = "Option::is_none", rename = "$updatedAt") - )] - pub updated_at: Option, #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] pub data: BTreeMap, } -// -// impl DocumentReplaceTransitionV0 { -// pub(crate) fn to_document_for_dry_run( -// &self, -// owner_id: Identifier, -// ) -> Result { -// let properties = self.data.clone().unwrap_or_default(); -// Ok(Document { -// id: self.base.id, -// owner_id, -// properties, -// created_at: self.updated_at, // we can use the same time, as it can't be worse -// updated_at: self.updated_at, -// revision: Some(self.revision), -// }) -// } -// -// pub(crate) fn to_extended_document_for_dry_run( -// &self, -// owner_id: Identifier, -// platform_version -// ) -> Result { -// Ok(ExtendedDocument { -// feature_version: LATEST_PLATFORM_VERSION -// .extended_document -// .default_current_version, -// document_type_name: self.base.document_type_name.clone(), -// data_contract_id: self.base.data_contract_id, -// document: self.to_document_for_dry_run(owner_id)?, -// data_contract: self.base.data_contract.clone(), -// metadata: None, -// entropy: Bytes32::default(), -// }) -// } -// -// pub(crate) fn replace_document(&self, document: &mut Document) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.revision = Some(self.revision); -// document.updated_at = self.updated_at; -// document.properties = properties; -// Ok(()) -// } -// -// pub(crate) fn replace_extended_document( -// &self, -// document: &mut ExtendedDocument, -// ) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.document.revision = Some(self.revision); -// document.document.updated_at = self.updated_at; -// document.document.properties = properties; -// Ok(()) -// } -// -// pub(crate) fn patch_document(self, document: &mut Document) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.revision = Some(self.revision); -// document.updated_at = self.updated_at; -// document.properties.extend(properties); -// Ok(()) -// } -// -// pub(crate) fn patch_extended_document( -// self, -// document: &mut ExtendedDocument, -// ) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.document.revision = Some(self.revision); -// document.document.updated_at = self.updated_at; -// document.document.properties.extend(properties); -// Ok(()) -// } -// } -// -// impl DocumentTransitionObjectLike for DocumentReplaceTransitionV0 { -// #[cfg(feature = "state-transition-json-conversion")] -// fn from_json_object( -// json_value: JsonValue, -// data_contract: DataContract, -// ) -> Result { -// let value: Value = json_value.into(); -// let mut map = value -// .into_btree_string_map() -// .map_err(ProtocolError::ValueError)?; -// -// let document_type = map.get_str("$type")?; -// -// let (identifiers_paths, binary_paths): (Vec<_>, Vec<_>) = -// data_contract.get_identifiers_and_binary_paths_owned(document_type)?; -// -// map.replace_at_paths(binary_paths.into_iter(), ReplacementType::BinaryBytes)?; -// -// map.replace_at_paths( -// identifiers_paths -// .into_iter() -// .chain(IDENTIFIER_FIELDS.iter().map(|a| a.to_string())), -// ReplacementType::Identifier, -// )?; -// let document = Self::from_value_map(map, data_contract)?; -// -// Ok(document) -// } -// -// fn from_object( -// raw_transition: Value, -// data_contract: DataContract, -// ) -> Result { -// let map = raw_transition -// .into_btree_string_map() -// .map_err(ProtocolError::ValueError)?; -// Self::from_value_map(map, data_contract) -// } -// -// fn from_value_map( -// mut map: BTreeMap, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// Ok(DocumentReplaceTransitionV0 { -// base: DocumentBaseTransition::from_value_map_consume(&mut map, data_contract)?, -// revision: map -// .remove_integer(property_names::REVISION) -// .map_err(ProtocolError::ValueError)?, -// updated_at: map -// .remove_optional_integer(property_names::UPDATED_AT) -// .map_err(ProtocolError::ValueError)?, -// data: Some(map), -// }) -// } -// -// fn to_object(&self) -> Result { -// Ok(self.to_value_map()?.into()) -// } -// -// fn to_value_map(&self) -> Result, ProtocolError> { -// let mut transition_base_map = self.base.to_value_map()?; -// transition_base_map.insert( -// property_names::REVISION.to_string(), -// Value::U64(self.revision), -// ); -// if let Some(updated_at) = self.updated_at { -// transition_base_map.insert( -// property_names::UPDATED_AT.to_string(), -// Value::U64(updated_at), -// ); -// } -// if let Some(properties) = self.data.clone() { -// transition_base_map.extend(properties) -// } -// Ok(transition_base_map) -// } -// -// fn to_json(&self) -> Result { -// self.to_cleaned_object()? -// .try_into() -// .map_err(ProtocolError::ValueError) -// } -// -// fn to_cleaned_object(&self) -> Result { -// Ok(self.to_value_map()?.into()) -// } -// } -// -// #[cfg(test)] -// mod test { -// use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0Methods; -// use super::*; -// -// fn init() { -// let _ = env_logger::builder() -// .filter_level(log::LevelFilter::Debug) -// .try_init(); -// } -// -// #[test] -// fn test_deserialize_serialize_to_json() { -// init(); -// let transition_json = r#"{ -// "$action": 1, -// "$dataContractId": "5wpZAEWndYcTeuwZpkmSa8s49cHXU5q2DhdibesxFSu8", -// "$id": "6oCKUeLVgjr7VZCyn1LdGbrepqKLmoabaff5WQqyTKYP", -// "$revision" : 1, -// "$type": "note", -// "message": "example_message_replace" -// }"#; -// -// let cdt: DocumentReplaceTransitionV0 = -// serde_json::from_str(transition_json).expect("no error"); -// -// assert_eq!(cdt.base.document_type_name(), "note"); -// assert_eq!(cdt.revision, 1); -// assert_eq!( -// cdt.data.as_ref().unwrap().get_str("message").unwrap(), -// "example_message_replace" -// ); -// -// let mut json_no_whitespace = transition_json.to_string(); -// json_no_whitespace.retain(|v| !v.is_whitespace()); -// -// assert_eq!(cdt.to_json().unwrap().to_string(), json_no_whitespace); -// } -// } + +/// document from replace transition v0 +pub trait DocumentFromReplaceTransitionV0 { + /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionV0` reference. This operation is typically used to replace or update an existing document with new information. + /// + /// # Arguments + /// + /// * `value` - A reference to the `DocumentReplaceTransitionV0` containing the new information for the document. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during replacement. + /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during replacement. + /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during replacement. + /// * `block_info` - Information about the current block at the time of this replace transition. + /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being replaced. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being replaced. + /// + /// # Returns + /// + /// * `Result` - On successful replacement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the replacement fails due to validation errors or other issues. + /// + /// # Errors + /// + /// This function may return a `ProtocolError` if validation fails, required fields are missing, or if there are mismatches between field types and the schema defined in the data contract. + fn try_from_replace_transition_v0( + value: &DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionV0` instance. This function is similar to `try_from_replace_transition_v0` but consumes the `DocumentReplaceTransitionV0` instance, making it suitable for scenarios where the transition is owned and should not be reused after document creation. + /// + /// # Arguments + /// + /// * `value` - An owned `DocumentReplaceTransitionV0` instance containing the new information for the document. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during replacement. + /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during replacement. + /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during replacement. + /// * `block_info` - Information about the current block at the time of this replace transition. + /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being replaced. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being replaced. + /// + /// # Returns + /// + /// * `Result` - On successful replacement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the replacement fails due to validation errors or other issues. + /// + /// # Errors + /// + /// This function may return a `ProtocolError` for the same reasons as `try_from_replace_transition_v0`, including validation failures, missing required fields, or schema mismatches. + fn try_from_owned_replace_transition_v0( + value: DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromReplaceTransitionV0 for Document { + fn try_from_replace_transition_v0( + value: &DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let DocumentReplaceTransitionV0 { + base, + revision, + data, + } = value; + + let id = base.id(); + + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id, + owner_id, + properties: data.clone(), + revision: Some(*revision), + created_at, + updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_replace_transition".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + fn try_from_owned_replace_transition_v0( + value: DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let DocumentReplaceTransitionV0 { + base, + revision, + data, + } = value; + + let id = base.id(); + + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id, + owner_id, + properties: data, + revision: Some(revision), + created_at, + updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_replace_transition".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs index bc27aeb63c3..9bee325bb1b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs @@ -2,7 +2,6 @@ use platform_value::Value; use std::collections::BTreeMap; -use crate::identity::TimestampMillis; use crate::prelude::Revision; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; @@ -24,12 +23,6 @@ pub trait DocumentReplaceTransitionV0Methods { /// Sets the value of the `revision` field in the `DocumentReplaceTransitionV0`. fn set_revision(&mut self, revision: Revision); - /// Returns a reference to the `updated_at` field of the `DocumentReplaceTransitionV0`. - fn updated_at(&self) -> Option; - - /// Sets the value of the `updated_at` field in the `DocumentReplaceTransitionV0`. - fn set_updated_at(&mut self, updated_at: Option); - /// Returns a reference to the `data` field of the `DocumentReplaceTransitionV0`. fn data(&self) -> &BTreeMap; @@ -61,14 +54,6 @@ impl DocumentReplaceTransitionV0Methods for DocumentReplaceTransitionV0 { self.revision = revision; } - fn updated_at(&self) -> Option { - self.updated_at - } - - fn set_updated_at(&mut self, updated_at: Option) { - self.updated_at = updated_at; - } - fn data(&self) -> &BTreeMap { &self.data } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs index 41c6f54104a..29f79a05e22 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs @@ -1,6 +1,5 @@ use std::collections::BTreeMap; use platform_value::Value; -use crate::identity::TimestampMillis; use crate::prelude::Revision; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_transition::document_replace_transition::v0::v0_methods::DocumentReplaceTransitionV0Methods; @@ -37,18 +36,6 @@ impl DocumentReplaceTransitionV0Methods for DocumentReplaceTransition { } } - fn updated_at(&self) -> Option { - match self { - DocumentReplaceTransition::V0(v0) => v0.updated_at, - } - } - - fn set_updated_at(&mut self, updated_at: Option) { - match self { - DocumentReplaceTransition::V0(v0) => v0.updated_at = updated_at, - } - } - fn data(&self) -> &BTreeMap { match self { DocumentReplaceTransition::V0(v0) => &v0.data, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/from_document.rs new file mode 100644 index 00000000000..abfbf806df5 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/from_document.rs @@ -0,0 +1,43 @@ +use platform_value::Identifier; +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document}; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::{DocumentTransferTransition, DocumentTransferTransitionV0}; + +impl DocumentTransferTransition { + pub fn from_document( + document: Document, + document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, + recipient_owner_id: Identifier, + platform_version: &PlatformVersion, + feature_version: Option, + base_feature_version: Option, + ) -> Result { + match feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .document_transfer_state_transition + .bounds + .default_current_version, + ) { + 0 => Ok(DocumentTransferTransitionV0::from_document( + document, + document_type, + identity_contract_nonce, + recipient_owner_id, + platform_version, + base_feature_version, + )? + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentTransferTransition::from_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/mod.rs new file mode 100644 index 00000000000..e2185f76b08 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/mod.rs @@ -0,0 +1,19 @@ +mod from_document; +pub mod v0; +pub mod v0_methods; + +use bincode::{Decode, Encode}; +use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; +pub use v0::*; + +#[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize) +)] +pub enum DocumentTransferTransition { + #[display(fmt = "V0({})", "_0")] + V0(DocumentTransferTransitionV0), +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/from_document.rs new file mode 100644 index 00000000000..77a4d59c6d3 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/from_document.rs @@ -0,0 +1,36 @@ +use platform_value::Identifier; +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document, DocumentV0Getters}; +use crate::document::errors::DocumentError; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::DocumentTransferTransitionV0; + +impl DocumentTransferTransitionV0 { + pub(crate) fn from_document( + document: Document, + document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, + recipient_owner_id: Identifier, + platform_version: &PlatformVersion, + base_feature_version: Option, + ) -> Result { + Ok(DocumentTransferTransitionV0 { + base: DocumentBaseTransition::from_document( + &document, + document_type, + identity_contract_nonce, + platform_version, + base_feature_version, + )?, + revision: document.revision().ok_or_else(|| { + ProtocolError::Document(Box::new(DocumentError::DocumentNoRevisionError { + document: Box::new(document.clone()), + })) + })?, + recipient_owner_id, + }) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/mod.rs new file mode 100644 index 00000000000..c51f80cdb7b --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/mod.rs @@ -0,0 +1,46 @@ +mod from_document; +pub mod v0_methods; + +use crate::prelude::Revision; +use bincode::{Decode, Encode}; +use derive_more::Display; + +use platform_value::Identifier; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +pub use super::super::document_base_transition::IDENTIFIER_FIELDS; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +mod property_names { + pub const REVISION: &str = "$revision"; + + pub const RECIPIENT_OWNER_ID: &str = "recipientOwnerId"; +} + +#[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[display( + fmt = "Base: {}, Revision: {}, Recipient: {:?}", + "base", + "revision", + "recipient_owner_id" +)] +pub struct DocumentTransferTransitionV0 { + #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] + pub base: DocumentBaseTransition, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$revision") + )] + pub revision: Revision, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "recipientOwnerId") + )] + pub recipient_owner_id: Identifier, +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..6e4b8331155 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/v0_methods.rs @@ -0,0 +1,66 @@ +use platform_value::Identifier; + +use crate::prelude::Revision; + +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::DocumentTransferTransitionV0; + +pub trait DocumentTransferTransitionV0Methods { + /// Returns a reference to the `base` field of the `DocumentReplaceTransitionV0`. + fn base(&self) -> &DocumentBaseTransition; + /// Returns a mut reference to the `base` field of the `DocumentReplaceTransitionV0`. + fn base_mut(&mut self) -> &mut DocumentBaseTransition; + + /// Sets the value of the `base` field in the `DocumentReplaceTransitionV0`. + fn set_base(&mut self, base: DocumentBaseTransition); + + /// Returns a reference to the `revision` field of the `DocumentReplaceTransitionV0`. + fn revision(&self) -> Revision; + + /// Sets the value of the `revision` field in the `DocumentReplaceTransitionV0`. + fn set_revision(&mut self, revision: Revision); + + /// Returns the `recipient_owner_id` field of the `DocumentReplaceTransitionV0`. + fn recipient_owner_id(&self) -> Identifier; + + /// Returns a reference to the `recipient_owner_id` field of the `DocumentReplaceTransitionV0`. + fn recipient_owner_id_ref(&self) -> &Identifier; + + /// Sets the value of the `recipient_owner_id` field in the `DocumentReplaceTransitionV0`. + fn set_recipient_owner_id(&mut self, recipient_owner_id: Identifier); +} + +impl DocumentTransferTransitionV0Methods for DocumentTransferTransitionV0 { + fn base(&self) -> &DocumentBaseTransition { + &self.base + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + &mut self.base + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + self.base = base; + } + + fn revision(&self) -> Revision { + self.revision + } + + fn set_revision(&mut self, revision: Revision) { + self.revision = revision; + } + + fn recipient_owner_id(&self) -> Identifier { + self.recipient_owner_id + } + + fn recipient_owner_id_ref(&self) -> &Identifier { + &self.recipient_owner_id + } + + fn set_recipient_owner_id(&mut self, recipient_owner_id: Identifier) { + self.recipient_owner_id = recipient_owner_id; + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0_methods.rs new file mode 100644 index 00000000000..adeff540c05 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0_methods.rs @@ -0,0 +1,55 @@ +use platform_value::Identifier; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::DocumentTransferTransition; + +impl DocumentTransferTransitionV0Methods for DocumentTransferTransition { + fn base(&self) -> &DocumentBaseTransition { + match self { + DocumentTransferTransition::V0(v0) => &v0.base, + } + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + match self { + DocumentTransferTransition::V0(v0) => &mut v0.base, + } + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + match self { + DocumentTransferTransition::V0(v0) => v0.base = base, + } + } + + fn revision(&self) -> Revision { + match self { + DocumentTransferTransition::V0(v0) => v0.revision, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentTransferTransition::V0(v0) => v0.revision = revision, + } + } + + fn recipient_owner_id(&self) -> Identifier { + match self { + DocumentTransferTransition::V0(v0) => v0.recipient_owner_id, + } + } + + fn recipient_owner_id_ref(&self) -> &Identifier { + match self { + DocumentTransferTransition::V0(v0) => &v0.recipient_owner_id, + } + } + + fn set_recipient_owner_id(&mut self, recipient_owner_id: Identifier) { + match self { + DocumentTransferTransition::V0(v0) => v0.recipient_owner_id = recipient_owner_id, + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/from_document.rs new file mode 100644 index 00000000000..4f26ff90bd7 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/from_document.rs @@ -0,0 +1,44 @@ +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document}; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_transition::DocumentUpdatePriceTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::DocumentUpdatePriceTransitionV0; + +impl DocumentUpdatePriceTransition { + pub fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + feature_version: Option, + base_feature_version: Option, + ) -> Result { + match feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .document_update_price_state_transition + .bounds + .default_current_version, + ) { + 0 => Ok(DocumentUpdatePriceTransitionV0::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + base_feature_version, + )? + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentUpdatePriceTransition::from_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/mod.rs new file mode 100644 index 00000000000..25a16a09ae3 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/mod.rs @@ -0,0 +1,19 @@ +mod from_document; +pub mod v0; +pub mod v0_methods; + +use bincode::{Decode, Encode}; +use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; +pub use v0::*; + +#[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize) +)] +pub enum DocumentUpdatePriceTransition { + #[display(fmt = "V0({})", "_0")] + V0(DocumentUpdatePriceTransitionV0), +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/from_document.rs new file mode 100644 index 00000000000..570a3fb5610 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/from_document.rs @@ -0,0 +1,36 @@ +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document, DocumentV0Getters}; +use crate::document::errors::DocumentError; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::DocumentUpdatePriceTransitionV0; + +impl DocumentUpdatePriceTransitionV0 { + pub(crate) fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + base_feature_version: Option, + ) -> Result { + Ok(DocumentUpdatePriceTransitionV0 { + base: DocumentBaseTransition::from_document( + &document, + document_type, + identity_contract_nonce, + platform_version, + base_feature_version, + )?, + revision: document.revision().ok_or_else(|| { + ProtocolError::Document(Box::new(DocumentError::DocumentNoRevisionError { + document: Box::new(document.clone()), + })) + })?, + price, + }) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/mod.rs new file mode 100644 index 00000000000..fe1e11cae18 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/mod.rs @@ -0,0 +1,277 @@ +mod from_document; +pub mod v0_methods; + +use crate::prelude::Revision; +use bincode::{Decode, Encode}; +use derive_more::Display; + +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +use crate::fee::Credits; + +pub use super::super::document_base_transition::IDENTIFIER_FIELDS; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +mod property_names { + pub const REVISION: &str = "$revision"; +} + +#[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[display(fmt = "Base: {}, Revision: {}, Price: {}", "base", "revision", "price")] +pub struct DocumentUpdatePriceTransitionV0 { + #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] + pub base: DocumentBaseTransition, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$revision") + )] + pub revision: Revision, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$price") + )] + pub price: Credits, +} +// +// /// document from update_price transition v0 +// pub trait DocumentFromUpdatePriceTransitionV0 { +// /// Attempts to create a new `Document` from the given `DocumentUpdatePriceTransitionV0` reference. This operation is typically used to update_price or update an existing document with new information. +// /// +// /// # Arguments +// /// +// /// * `value` - A reference to the `DocumentUpdatePriceTransitionV0` containing the new information for the document. +// /// * `owner_id` - The `Identifier` of the document's owner. +// /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during update_pricement. +// /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during update_pricement. +// /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during update_pricement. +// /// * `block_info` - Information about the current block at the time of this update_price transition. +// /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being update_priced. +// /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being update_priced. +// /// +// /// # Returns +// /// +// /// * `Result` - On successful update_pricement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the update_pricement fails due to validation errors or other issues. +// /// +// /// # Errors +// /// +// /// This function may return a `ProtocolError` if validation fails, required fields are missing, or if there are mismatches between field types and the schema defined in the data contract. +// fn try_from_update_price_transition_v0( +// value: &DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result +// where +// Self: Sized; +// /// Attempts to create a new `Document` from the given `DocumentUpdatePriceTransitionV0` instance. This function is similar to `try_from_update_price_transition_v0` but consumes the `DocumentUpdatePriceTransitionV0` instance, making it suitable for scenarios where the transition is owned and should not be reused after document creation. +// /// +// /// # Arguments +// /// +// /// * `value` - An owned `DocumentUpdatePriceTransitionV0` instance containing the new information for the document. +// /// * `owner_id` - The `Identifier` of the document's owner. +// /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during update_pricement. +// /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during update_pricement. +// /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during update_pricement. +// /// * `block_info` - Information about the current block at the time of this update_price transition. +// /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being update_priced. +// /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being update_priced. +// /// +// /// # Returns +// /// +// /// * `Result` - On successful update_pricement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the update_pricement fails due to validation errors or other issues. +// /// +// /// # Errors +// /// +// /// This function may return a `ProtocolError` for the same reasons as `try_from_update_price_transition_v0`, including validation failures, missing required fields, or schema mismatches. +// fn try_from_owned_update_price_transition_v0( +// value: DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result +// where +// Self: Sized; +// } +// +// impl DocumentFromUpdatePriceTransitionV0 for Document { +// fn try_from_update_price_transition_v0( +// value: &DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result { +// let DocumentUpdatePriceTransitionV0 { +// base, +// revision, +// price, +// } = value; +// +// let id = base.id(); +// +// let requires_updated_at = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT); +// +// let requires_updated_at_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); +// +// let requires_updated_at_core_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); +// +// let updated_at = if requires_updated_at { +// Some(block_info.time_ms) +// } else { +// None +// }; +// +// let updated_at_block_height = if requires_updated_at_block_height { +// Some(block_info.height) +// } else { +// None +// }; +// +// let updated_at_core_block_height = if requires_updated_at_core_block_height { +// Some(block_info.core_height) +// } else { +// None +// }; +// +// data +// +// match platform_version +// .dpp +// .document_versions +// .document_structure_version +// { +// 0 => Ok(DocumentV0 { +// id, +// owner_id, +// properties: data.clone(), +// revision: Some(*revision), +// created_at, +// updated_at, +// transferred_at, +// created_at_block_height, +// updated_at_block_height, +// transferred_at_block_height, +// created_at_core_block_height, +// updated_at_core_block_height, +// transferred_at_core_block_height, +// } +// .into()), +// version => Err(ProtocolError::UnknownVersionMismatch { +// method: "Document::try_from_update_price_transition".to_string(), +// known_versions: vec![0], +// received: version, +// }), +// } +// } +// +// fn try_from_owned_update_price_transition_v0( +// value: DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result { +// let DocumentUpdatePriceTransitionV0 { +// base, +// revision, +// price, +// } = value; +// +// let id = base.id(); +// +// let requires_updated_at = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT); +// +// let requires_updated_at_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); +// +// let requires_updated_at_core_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); +// +// let updated_at = if requires_updated_at { +// Some(block_info.time_ms) +// } else { +// None +// }; +// +// let updated_at_block_height = if requires_updated_at_block_height { +// Some(block_info.height) +// } else { +// None +// }; +// +// let updated_at_core_block_height = if requires_updated_at_core_block_height { +// Some(block_info.core_height) +// } else { +// None +// }; +// match platform_version +// .dpp +// .document_versions +// .document_structure_version +// { +// 0 => Ok(DocumentV0 { +// id, +// owner_id, +// properties: data, +// revision: Some(revision), +// created_at, +// updated_at, +// transferred_at, +// created_at_block_height, +// updated_at_block_height, +// transferred_at_block_height, +// created_at_core_block_height, +// updated_at_core_block_height, +// transferred_at_core_block_height, +// } +// .into()), +// version => Err(ProtocolError::UnknownVersionMismatch { +// method: "Document::try_from_update_price_transition".to_string(), +// known_versions: vec![0], +// received: version, +// }), +// } +// } +// } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..74b27a3589d --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/v0_methods.rs @@ -0,0 +1,58 @@ +use crate::fee::Credits; +use crate::prelude::Revision; + +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::DocumentUpdatePriceTransitionV0; + +pub trait DocumentUpdatePriceTransitionV0Methods { + /// Returns a reference to the `base` field of the `DocumentUpdatePriceTransitionV0`. + fn base(&self) -> &DocumentBaseTransition; + /// Returns a mut reference to the `base` field of the `DocumentUpdatePriceTransitionV0`. + fn base_mut(&mut self) -> &mut DocumentBaseTransition; + + /// Sets the value of the `base` field in the `DocumentUpdatePriceTransitionV0`. + fn set_base(&mut self, base: DocumentBaseTransition); + + /// Returns a reference to the `revision` field of the `DocumentUpdatePriceTransitionV0`. + fn revision(&self) -> Revision; + + /// Sets the value of the `revision` field in the `DocumentUpdatePriceTransitionV0`. + fn set_revision(&mut self, revision: Revision); + + /// Returns a reference to the `price` field of the `DocumentUpdatePriceTransitionV0`. + fn price(&self) -> Credits; + + /// Sets the value of the `price` field in the `DocumentUpdatePriceTransitionV0`. + fn set_price(&mut self, price: Credits); +} + +impl DocumentUpdatePriceTransitionV0Methods for DocumentUpdatePriceTransitionV0 { + fn base(&self) -> &DocumentBaseTransition { + &self.base + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + &mut self.base + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + self.base = base; + } + + fn revision(&self) -> Revision { + self.revision + } + + fn set_revision(&mut self, revision: Revision) { + self.revision = revision; + } + + fn price(&self) -> Credits { + self.price + } + + fn set_price(&mut self, price: Credits) { + self.price = price; + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0_methods.rs new file mode 100644 index 00000000000..3b605d7431c --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0_methods.rs @@ -0,0 +1,49 @@ +use crate::fee::Credits; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::DocumentUpdatePriceTransition; + +impl DocumentUpdatePriceTransitionV0Methods for DocumentUpdatePriceTransition { + fn base(&self) -> &DocumentBaseTransition { + match self { + DocumentUpdatePriceTransition::V0(v0) => &v0.base, + } + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + match self { + DocumentUpdatePriceTransition::V0(v0) => &mut v0.base, + } + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.base = base, + } + } + + fn revision(&self) -> Revision { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.revision, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.revision = revision, + } + } + + fn price(&self) -> Credits { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.price, + } + } + + fn set_price(&mut self, price: Credits) { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.price = price, + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs index 10bd184e2dc..00e566b2a80 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs @@ -2,42 +2,43 @@ use std::collections::BTreeMap; use bincode::{Decode, Encode}; use derive_more::From; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, IdentityNonce}; use document_base_transition::DocumentBaseTransition; pub mod action_type; pub mod document_base_transition; pub mod document_create_transition; pub mod document_delete_transition; +pub mod document_purchase_transition; pub mod document_replace_transition; +pub mod document_transfer_transition; +pub mod document_update_price_transition; -use crate::identity::TimestampMillis; use crate::prelude::Revision; use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use derive_more::Display; pub use document_create_transition::DocumentCreateTransition; pub use document_delete_transition::DocumentDeleteTransition; pub use document_replace_transition::DocumentReplaceTransition; +pub use document_transfer_transition::DocumentTransferTransition; +pub use document_purchase_transition::DocumentPurchaseTransition; +pub use document_update_price_transition::DocumentUpdatePriceTransition; use platform_value::Value; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods; use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_replace_transition::v0::v0_methods::DocumentReplaceTransitionV0Methods; use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_delete_transition::v0::v0_methods::DocumentDeleteTransitionV0Methods; +use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods; pub const PROPERTY_ACTION: &str = "$action"; pub trait DocumentTransitionV0Methods { fn base(&self) -> &DocumentBaseTransition; - /// returns the creation timestamp (in milliseconds) if it exists for given type of document transition - fn created_at(&self) -> Option; - /// returns the update timestamp (in milliseconds) if it exists for given type of document transition - fn updated_at(&self) -> Option; - /// set the created_at (in milliseconds) if it exists - fn set_created_at(&mut self, timestamp_millis: Option); - /// set the updated_at (in milliseconds) if it exists - fn set_updated_at(&mut self, timestamp_millis: Option); /// returns the value of dynamic property. The dynamic property is a property that is not specified in protocol /// the `path` supports dot-syntax: i.e: property.internal_property fn get_dynamic_property(&self, path: &str) -> Option<&Value>; @@ -51,6 +52,9 @@ pub trait DocumentTransitionV0Methods { fn data(&self) -> Option<&BTreeMap>; /// get the revision of transition if exits fn revision(&self) -> Option; + + /// get the identity contract nonce + fn identity_contract_nonce(&self) -> IdentityNonce; #[cfg(test)] /// Inserts the dynamic property into the document fn insert_dynamic_property(&mut self, property_name: String, value: Value); @@ -61,6 +65,9 @@ pub trait DocumentTransitionV0Methods { // sets revision of the transition fn set_revision(&mut self, revision: Revision); + + // sets identity contract nonce + fn set_identity_contract_nonce(&mut self, nonce: IdentityNonce); } #[derive(Debug, Clone, Encode, Decode, From, PartialEq, Display)] @@ -77,115 +84,16 @@ pub enum DocumentTransition { #[display(fmt = "DeleteDocumentTransition({})", "_0")] Delete(DocumentDeleteTransition), -} -// -// impl AsRef for DocumentTransition { -// fn as_ref(&self) -> &Self { -// self -// } -// } -// -// macro_rules! call_method { -// ($state_transition:expr, $method:ident, $args:tt ) => { -// match $state_transition { -// DocumentTransition::Create(st) => st.$method($args), -// DocumentTransition::Replace(st) => st.$method($args), -// DocumentTransition::Delete(st) => st.$method($args), -// } -// }; -// ($state_transition:expr, $method:ident ) => { -// match $state_transition { -// DocumentTransition::Create(st) => st.$method(), -// DocumentTransition::Replace(st) => st.$method(), -// DocumentTransition::Delete(st) => st.$method(), -// } -// }; -// } -// -// impl DocumentTransitionObjectLike for DocumentTransition { -// #[cfg(feature = "state-transition-json-conversion")] -// fn from_json_object( -// json_value: JsonValue, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let action: Action = TryFrom::try_from(json_value.get_u64(PROPERTY_ACTION)? as u8) -// .context("invalid document transition action")?; -// -// Ok(match action { -// Action::Create => DocumentTransition::Create( -// DocumentCreateTransition::from_json_object(json_value, data_contract)?, -// ), -// Action::Replace => DocumentTransition::Replace( -// DocumentReplaceTransitionV0::from_json_object(json_value, data_contract)?, -// ), -// Action::Delete => DocumentTransition::Delete( -// DocumentDeleteTransition::from_json_object(json_value, data_contract)?, -// ), -// }) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_object( -// raw_transition: Value, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let map = raw_transition -// .into_btree_string_map() -// .map_err(ProtocolError::ValueError)?; -// Self::from_value_map(map, data_contract) -// } -// -// #[cfg(feature = "state-transition-json-conversion")] -// fn to_json(&self) -> Result { -// call_method!(self, to_json) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_value_map(&self) -> Result, ProtocolError> { -// call_method!(self, to_value_map) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_object(&self) -> Result { -// call_method!(self, to_object) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_cleaned_object(&self) -> Result { -// call_method!(self, to_cleaned_object) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_value_map( -// map: BTreeMap, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let action: Action = map.get_integer::(PROPERTY_ACTION)?.try_into()?; -// Ok(match action { -// Action::Create => DocumentTransition::Create(DocumentCreateTransition::from_value_map( -// map, -// data_contract, -// )?), -// Action::Replace => DocumentTransition::Replace( -// DocumentReplaceTransitionV0::from_value_map(map, data_contract)?, -// ), -// Action::Delete => DocumentTransition::Delete(DocumentDeleteTransition::from_value_map( -// map, -// data_contract, -// )?), -// }) -// } -// } + #[display(fmt = "TransferDocumentTransition({})", "_0")] + Transfer(DocumentTransferTransition), + + #[display(fmt = "UpdatePriceDocumentTransition({})", "_0")] + UpdatePrice(DocumentUpdatePriceTransition), + + #[display(fmt = "PurchaseDocumentTransition({})", "_0")] + Purchase(DocumentPurchaseTransition), +} impl DocumentTransition { pub fn as_transition_create(&self) -> Option<&DocumentCreateTransition> { @@ -210,55 +118,33 @@ impl DocumentTransition { None } } -} - -impl DocumentTransitionV0Methods for DocumentTransition { - fn base(&self) -> &DocumentBaseTransition { - match self { - DocumentTransition::Create(t) => t.base(), - DocumentTransition::Replace(t) => t.base(), - DocumentTransition::Delete(t) => t.base(), - } - } - fn created_at(&self) -> Option { - match self { - DocumentTransition::Create(t) => t.created_at(), - DocumentTransition::Replace(_) => None, - DocumentTransition::Delete(_) => None, - } - } - - fn updated_at(&self) -> Option { - match self { - DocumentTransition::Create(t) => t.updated_at(), - DocumentTransition::Replace(t) => t.updated_at(), - DocumentTransition::Delete(_) => None, - } - } - - // TODO: it's confusing to set a value and internally it's not setting if your variant doesn't have it. - fn set_created_at(&mut self, timestamp_millis: Option) { - match self { - DocumentTransition::Create(ref mut t) => t.set_created_at(timestamp_millis), - DocumentTransition::Replace(_) => {} - DocumentTransition::Delete(_) => {} + pub fn as_transition_transfer(&self) -> Option<&DocumentTransferTransition> { + if let Self::Transfer(ref t) = self { + Some(t) + } else { + None } } - fn set_updated_at(&mut self, timestamp_millis: Option) { - match self { - DocumentTransition::Create(ref mut t) => t.set_updated_at(timestamp_millis), - DocumentTransition::Replace(ref mut t) => t.set_updated_at(timestamp_millis), - DocumentTransition::Delete(_) => {} + pub fn as_transition_purchase(&self) -> Option<&DocumentPurchaseTransition> { + if let Self::Purchase(ref t) = self { + Some(t) + } else { + None } } +} - fn set_revision(&mut self, revision: Revision) { +impl DocumentTransitionV0Methods for DocumentTransition { + fn base(&self) -> &DocumentBaseTransition { match self { - DocumentTransition::Create(_) => {} - DocumentTransition::Replace(ref mut t) => t.set_revision(revision), - DocumentTransition::Delete(_) => {} + DocumentTransition::Create(t) => t.base(), + DocumentTransition::Replace(t) => t.base(), + DocumentTransition::Delete(t) => t.base(), + DocumentTransition::Transfer(t) => t.base(), + DocumentTransition::UpdatePrice(t) => t.base(), + DocumentTransition::Purchase(t) => t.base(), } } @@ -267,6 +153,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => t.data().get(path), DocumentTransition::Replace(t) => t.data().get(path), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(_) => None, + DocumentTransition::UpdatePrice(_) => None, + DocumentTransition::Purchase(_) => None, } } @@ -287,6 +176,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => Some(t.data()), DocumentTransition::Replace(t) => Some(t.data()), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(_) => None, + DocumentTransition::UpdatePrice(_) => None, + DocumentTransition::Purchase(_) => None, } } @@ -295,6 +187,20 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(_) => Some(1), DocumentTransition::Replace(t) => Some(t.revision()), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(t) => Some(t.revision()), + DocumentTransition::UpdatePrice(t) => Some(t.revision()), + DocumentTransition::Purchase(t) => Some(t.revision()), + } + } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DocumentTransition::Create(t) => t.base().identity_contract_nonce(), + DocumentTransition::Replace(t) => t.base().identity_contract_nonce(), + DocumentTransition::Delete(t) => t.base().identity_contract_nonce(), + DocumentTransition::Transfer(t) => t.base().identity_contract_nonce(), + DocumentTransition::UpdatePrice(t) => t.base().identity_contract_nonce(), + DocumentTransition::Purchase(t) => t.base().identity_contract_nonce(), } } @@ -312,6 +218,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { .insert(property_name, value); } DocumentTransition::Delete(_) => {} + DocumentTransition::Transfer(_) => {} + DocumentTransition::UpdatePrice(_) => {} + DocumentTransition::Purchase(_) => {} } } @@ -324,6 +233,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => t.base_mut(), DocumentTransition::Replace(t) => t.base_mut(), DocumentTransition::Delete(t) => t.base_mut(), + DocumentTransition::Transfer(t) => t.base_mut(), + DocumentTransition::UpdatePrice(t) => t.base_mut(), + DocumentTransition::Purchase(t) => t.base_mut(), } } @@ -332,6 +244,31 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => Some(t.data_mut()), DocumentTransition::Replace(t) => Some(t.data_mut()), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(_) => None, + DocumentTransition::UpdatePrice(_) => None, + DocumentTransition::Purchase(_) => None, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentTransition::Create(_) => {} + DocumentTransition::Replace(ref mut t) => t.set_revision(revision), + DocumentTransition::Delete(_) => {} + DocumentTransition::Transfer(ref mut t) => t.set_revision(revision), + DocumentTransition::UpdatePrice(ref mut t) => t.set_revision(revision), + DocumentTransition::Purchase(ref mut t) => t.set_revision(revision), + } + } + + fn set_identity_contract_nonce(&mut self, nonce: IdentityNonce) { + match self { + DocumentTransition::Create(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Replace(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Delete(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Transfer(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::UpdatePrice(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Purchase(t) => t.base_mut().set_identity_contract_nonce(nonce), } } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs index 8bcc2affc8b..06f39e42fc0 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs @@ -5,7 +5,8 @@ use crate::state_transition::documents_batch_transition::fields::property_names: OWNER_ID, TRANSITIONS_DATA_CONTRACT_ID, TRANSITIONS_ID, }; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub mod property_names { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs index 544d5d776d4..071ed54f90f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs @@ -1,31 +1,67 @@ +#[cfg(feature = "state-transition-signing")] use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "state-transition-signing")] use crate::document::Document; +use crate::fee::Credits; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::IdentityPublicKey; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::document_transition::DocumentTransition; use crate::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; -use crate::state_transition::documents_batch_transition::{ - DocumentsBatchTransition, DocumentsBatchTransitionV0, -}; +use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::documents_batch_transition::DocumentsBatchTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; pub mod v0; impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { + fn all_purchases_amount(&self) -> Result, ProtocolError> { + match self { + DocumentsBatchTransition::V0(v0) => v0.all_purchases_amount(), + } + } + + fn all_conflicting_index_collateral_voting_funds( + &self, + ) -> Result, ProtocolError> { + match self { + DocumentsBatchTransition::V0(v0) => v0.all_conflicting_index_collateral_voting_funds(), + } + } + fn set_transitions(&mut self, transitions: Vec) { match self { DocumentsBatchTransition::V0(v0) => v0.set_transitions(transitions), } } + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + match self { + DocumentsBatchTransition::V0(v0) => { + v0.set_identity_contract_nonce(identity_contract_nonce) + } + } + } + #[cfg(feature = "state-transition-signing")] fn new_document_creation_transition_from_document( document: Document, document_type: DocumentTypeRef, entropy: [u8; 32], identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, batch_feature_version: Option, @@ -45,6 +81,8 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { document_type, entropy, identity_public_key, + identity_contract_nonce, + user_fee_increase, signer, platform_version, batch_feature_version, @@ -65,10 +103,12 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { document: Document, document_type: DocumentTypeRef, identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, batch_feature_version: Option, - update_feature_version: Option, + replace_feature_version: Option, base_feature_version: Option, ) -> Result { match batch_feature_version.unwrap_or( @@ -83,10 +123,12 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { document, document_type, identity_public_key, + identity_contract_nonce, + user_fee_increase, signer, platform_version, batch_feature_version, - update_feature_version, + replace_feature_version, base_feature_version, )?, ), @@ -99,4 +141,186 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { }), } } + + #[cfg(feature = "state-transition-signing")] + fn new_document_transfer_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + recipient_owner_id: Identifier, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + transfer_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_transfer_transition_from_document( + document, + document_type, + recipient_owner_id, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + transfer_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: + "DocumentsBatchTransition::new_document_replacement_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_deletion_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + delete_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_deletion_transition_from_document( + document, + document_type, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + delete_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentsBatchTransition::new_document_deletion_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_update_price_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + update_price_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_update_price_transition_from_document( + document, + document_type, + price, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + update_price_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: + "DocumentsBatchTransition::new_document_update_price_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_purchase_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + new_owner_id: Identifier, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + purchase_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_purchase_transition_from_document( + document, + document_type, + new_owner_id, + price, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + purchase_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentsBatchTransition::new_document_purchase_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs index dbe2d89242a..ceffcaa7aec 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs @@ -1,15 +1,26 @@ +#[cfg(feature = "state-transition-signing")] use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "state-transition-signing")] use crate::document::Document; +use crate::fee::Credits; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; -use crate::identity::{IdentityPublicKey, SecurityLevel}; +#[cfg(feature = "state-transition-signing")] +use crate::identity::IdentityPublicKey; +use crate::identity::SecurityLevel; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use crate::state_transition::documents_batch_transition::document_transition::{ DocumentTransition, DocumentTransitionV0Methods, }; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; use crate::ProtocolError; use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; use std::convert::TryFrom; @@ -20,6 +31,8 @@ pub trait DocumentsBatchTransitionMethodsV0: DocumentsBatchTransitionAccessorsV0 document_type: DocumentTypeRef, entropy: [u8; 32], identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, batch_feature_version: Option, @@ -32,10 +45,72 @@ pub trait DocumentsBatchTransitionMethodsV0: DocumentsBatchTransitionAccessorsV0 document: Document, document_type: DocumentTypeRef, identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _batch_feature_version: Option, - update_feature_version: Option, + replace_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_deletion_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + delete_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_transfer_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + recipient_owner_id: Identifier, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + transfer_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_update_price_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + update_price_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_purchase_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + new_owner_id: Identifier, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + purchase_feature_version: Option, base_feature_version: Option, ) -> Result; @@ -78,4 +153,12 @@ pub trait DocumentsBatchTransitionMethodsV0: DocumentsBatchTransitionAccessorsV0 } fn set_transitions(&mut self, transitions: Vec); + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce); + + fn all_conflicting_index_collateral_voting_funds( + &self, + ) -> Result, ProtocolError>; + + fn all_purchases_amount(&self) -> Result, ProtocolError>; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs index 51678da4b61..f62e971fb7e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs @@ -5,6 +5,7 @@ use std::convert::TryInto; use derive_more::From; use platform_value::Value; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::ProtocolError; @@ -41,6 +42,7 @@ use crate::state_transition::data_contract_update_transition::{ use crate::state_transition::documents_batch_transition::fields::property_names; +use crate::identity::state_transition::OptionallyAssetLockProved; pub use v0::*; #[derive( @@ -94,7 +96,7 @@ pub enum DocumentsBatchTransition { // let maybe_signature = json_value.get_string(property_names::SIGNATURE).ok(); // let signature = if let Some(signature) = maybe_signature { // Some(BinaryData( -// base64::decode(signature).context("signature exists but isn't valid base64")?, +// BASE64_STANDARD.decode(signature).context("signature exists but isn't valid base64")?, // )) // } else { // None @@ -559,7 +561,7 @@ pub fn get_security_level_requirement(v: &Value, default: SecurityLevel) -> Secu // let data_contract_id = // Identifier::from_string(data_contract_id_base58, Encoding::Base58).unwrap(); // let owner_id = Identifier::from_string(owner_id_base58, Encoding::Base58).unwrap(); -// let entropy_bytes: [u8; 32] = base64::decode(entropy_base64).unwrap().try_into().unwrap(); +// let entropy_bytes: [u8; 32] = BASE64_STANDARD.decode(entropy_base64).unwrap().try_into().unwrap(); // // let mut data_contract = get_data_contract_fixture(Some(owner_id)).data_contract; // data_contract.id = data_contract_id; @@ -593,3 +595,4 @@ pub fn get_security_level_requirement(v: &Value, default: SecurityLevel) -> Secu // assert_eq!(hex::encode(expected_bytes), hex::encode(bytes)); // } // } +impl OptionallyAssetLockProved for DocumentsBatchTransition {} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs index 4bd3c12a507..69b5bfa5713 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for DocumentsBatchTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DocumentsBatchTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + DocumentsBatchTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } + fn owner_id(&self) -> Identifier { match self { DocumentsBatchTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + DocumentsBatchTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs index c93ce54bca0..fd4916864aa 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::SecurityLevel::HIGH; +use crate::identity::SecurityLevel::{CRITICAL, HIGH, MEDIUM}; use crate::identity::{KeyID, SecurityLevel}; use crate::state_transition::documents_batch_transition::DocumentsBatchTransitionV0; @@ -14,7 +14,10 @@ impl StateTransitionIdentitySigned for DocumentsBatchTransitionV0 { } fn security_level_requirement(&self) -> Vec { - // TODO: should use contract_based_security_level_requirement instead - vec![HIGH] + // These are the available key levels that must sign the state transition + // However the fact that it is signed by one of these does not guarantee that it + // meets the security level requirement, as that is dictated from within the data + // contract + vec![CRITICAL, HIGH, MEDIUM] } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs index 11556521d3c..4f301bb4520 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs @@ -15,7 +15,9 @@ use crate::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::PlatformSignable; +use crate::prelude::UserFeeIncrease; use platform_value::{BinaryData, Identifier}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Encode, Decode, PlatformSignable)] @@ -27,6 +29,7 @@ use serde::{Deserialize, Serialize}; pub struct DocumentsBatchTransitionV0 { pub owner_id: Identifier, pub transitions: Vec, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs index 2a3943b4c5e..ce3faf2c4b6 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use crate::state_transition::documents_batch_transition::document_transition::DocumentTransitionV0Methods; use crate::state_transition::documents_batch_transition::{ @@ -6,6 +7,8 @@ use crate::state_transition::documents_batch_transition::{ use crate::state_transition::StateTransitionType::DocumentsBatch; use crate::state_transition::{StateTransition, StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::{BinaryData, Identifier}; impl From for StateTransition { @@ -45,4 +48,27 @@ impl StateTransitionLike for DocumentsBatchTransitionV0 { fn owner_id(&self) -> Identifier { self.owner_id } + + /// We create a list of unique identifiers for the batch + fn unique_identifiers(&self) -> Vec { + self.transitions + .iter() + .map(|transition| { + format!( + "{}-{}-{:x}", + BASE64_STANDARD.encode(self.owner_id), + BASE64_STANDARD.encode(transition.data_contract_id()), + transition.identity_contract_nonce() + ) + }) + .collect() + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs index 60b61615b96..0bafe6b8aeb 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs @@ -1,20 +1,42 @@ +#[cfg(feature = "state-transition-signing")] use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "state-transition-signing")] use crate::document::{Document, DocumentV0Getters}; +use crate::fee::Credits; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::SecurityLevel; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] use crate::prelude::IdentityPublicKey; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentReplaceTransition, DocumentTransition, + DocumentTransition, DocumentTransitionV0Methods, +}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::documents_batch_transition::document_transition::{ + DocumentReplaceTransition, DocumentTransferTransition, DocumentPurchaseTransition, DocumentUpdatePriceTransition, }; use crate::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use crate::state_transition::documents_batch_transition::DocumentsBatchTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::documents_batch_transition::{ - DocumentsBatchTransition, DocumentsBatchTransitionV0, + DocumentDeleteTransition, DocumentsBatchTransition, }; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; impl DocumentsBatchTransitionAccessorsV0 for DocumentsBatchTransitionV0 { fn transitions(&self) -> &Vec { @@ -33,6 +55,8 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { document_type: DocumentTypeRef, entropy: [u8; 32], identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _batch_feature_version: Option, @@ -44,6 +68,7 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { document, document_type, entropy, + identity_contract_nonce, platform_version, create_feature_version, base_feature_version, @@ -51,6 +76,7 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { owner_id, transitions: vec![create_transition.into()], + user_fee_increase, signature_public_key_id: 0, signature: Default::default(), } @@ -69,23 +95,189 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { document: Document, document_type: DocumentTypeRef, identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _batch_feature_version: Option, - update_feature_version: Option, + replace_feature_version: Option, base_feature_version: Option, ) -> Result { let owner_id = document.owner_id(); let replace_transition = DocumentReplaceTransition::from_document( document, document_type, + identity_contract_nonce, platform_version, - update_feature_version, + replace_feature_version, base_feature_version, )?; let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { owner_id, transitions: vec![replace_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_transfer_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + recipient_owner_id: Identifier, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + transfer_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let owner_id = document.owner_id(); + let transfer_transition = DocumentTransferTransition::from_document( + document, + document_type, + identity_contract_nonce, + recipient_owner_id, + platform_version, + transfer_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id, + transitions: vec![transfer_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_deletion_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + delete_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let owner_id = document.owner_id(); + let delete_transition = DocumentDeleteTransition::from_document( + document, + document_type, + identity_contract_nonce, + platform_version, + delete_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id, + transitions: vec![delete_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_update_price_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + update_price_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let owner_id = document.owner_id(); + let transfer_transition = DocumentUpdatePriceTransition::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + update_price_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id, + transitions: vec![transfer_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_purchase_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + new_owner_id: Identifier, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + purchase_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let purchase_transition = DocumentPurchaseTransition::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + purchase_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id: new_owner_id, + transitions: vec![purchase_transition.into()], + user_fee_increase, signature_public_key_id: 0, signature: Default::default(), } @@ -102,4 +294,66 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { fn set_transitions(&mut self, transitions: Vec) { self.transitions = transitions; } + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + self.transitions + .iter_mut() + .for_each(|transition| transition.set_identity_contract_nonce(identity_contract_nonce)); + } + + fn all_purchases_amount(&self) -> Result, ProtocolError> { + let (total, any_purchases): (Option, bool) = self + .transitions + .iter() + .filter_map(|transition| { + transition + .as_transition_purchase() + .map(|purchase| purchase.price()) + }) + .fold((None, false), |(acc, _), price| match acc { + Some(acc_val) => acc_val + .checked_add(price) + .map_or((None, true), |sum| (Some(sum), true)), + None => (Some(price), true), + }); + + match (total, any_purchases) { + (Some(total), _) => Ok(Some(total)), + (None, true) => Err(ProtocolError::Overflow("overflow in all purchases amount")), // Overflow occurred + _ => Ok(None), // No purchases were found + } + } + + fn all_conflicting_index_collateral_voting_funds( + &self, + ) -> Result, ProtocolError> { + let (total, any_voting_funds): (Option, bool) = self + .transitions + .iter() + .filter_map(|transition| { + transition + .as_transition_create() + .and_then(|document_create_transition| { + // Safely sum up values to avoid overflow. + document_create_transition + .prefunded_voting_balance() + .as_ref() + .map(|(_, credits)| *credits) + }) + }) + .fold((None, false), |(acc, _), price| match acc { + Some(acc_val) => acc_val + .checked_add(price) + .map_or((None, true), |sum| (Some(sum), true)), + None => (Some(price), true), + }); + + match (total, any_voting_funds) { + (Some(total), _) => Ok(Some(total)), + (None, true) => Err(ProtocolError::Overflow( + "overflow in all voting funds amount", + )), // Overflow occurred + _ => Ok(None), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs index 0d03d710352..71e1b19b29f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs @@ -66,13 +66,13 @@ mod test { DocumentTransition::Create(DocumentCreateTransition::V0(DocumentCreateTransitionV0 { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0 { id: Identifier::random(), + identity_contract_nonce: 0, document_type_name: "a".to_string(), data_contract_id: Identifier::random(), }), entropy: Default::default(), - created_at: None, - updated_at: None, data: Default::default(), + prefunded_voting_balance: Default::default(), })); let create_transition_duplicate = create_transition.clone(); @@ -81,11 +81,11 @@ mod test { DocumentReplaceTransitionV0 { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0 { id: Identifier::random(), + identity_contract_nonce: 1, document_type_name: "a".to_string(), data_contract_id: Identifier::random(), }), revision: Default::default(), - updated_at: None, data: Default::default(), }, )); @@ -94,6 +94,7 @@ mod test { DocumentTransition::Delete(DocumentDeleteTransition::V0(DocumentDeleteTransitionV0 { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0 { id: Identifier::random(), + identity_contract_nonce: 2, document_type_name: "c".to_string(), data_contract_id: Identifier::random(), }), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs index 9dbc8c2b9ad..ada331ac037 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs @@ -1,2 +1,2 @@ mod find_duplicates_by_id; -pub mod validate_base_structure; +pub mod validate_basic_structure; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/mod.rs deleted file mode 100644 index 400433a814e..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_version::version::PlatformVersion; - -mod v0; - -impl DocumentsBatchTransition { - pub fn validate_base_structure<'d>( - &self, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .state_transitions - .documents - .documents_batch_transition - .validation - .validate_base_structure - { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DocumentsBatchTransition::validate".to_string(), - known_versions: vec![0], - received: version, - }), - } - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/v0/mod.rs deleted file mode 100644 index 7907d36993b..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/v0/mod.rs +++ /dev/null @@ -1,82 +0,0 @@ -use crate::consensus::basic::document::{ - DocumentTransitionsAreAbsentError, DuplicateDocumentTransitionsWithIdsError, - MaxDocumentsTransitionsExceededError, -}; -use crate::consensus::basic::BasicError; - -use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; -use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; -use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentTransition, DocumentTransitionV0Methods, -}; -use crate::state_transition::documents_batch_transition::validation::find_duplicates_by_id::find_duplicates_by_id; -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Identifier; -use platform_version::version::PlatformVersion; -use std::collections::btree_map::Entry; -use std::collections::BTreeMap; - -const MAX_TRANSITIONS_IN_BATCH: usize = 1; - -impl DocumentsBatchTransition { - pub(super) fn validate_base_structure_v0<'d>( - &self, - platform_version: &PlatformVersion, - ) -> Result { - if self.transitions().is_empty() { - return Ok(SimpleConsensusValidationResult::new_with_error( - DocumentTransitionsAreAbsentError::new().into(), - )); - } - - if self.transitions().len() > MAX_TRANSITIONS_IN_BATCH { - return Ok(SimpleConsensusValidationResult::new_with_error( - MaxDocumentsTransitionsExceededError::new(MAX_TRANSITIONS_IN_BATCH as u32).into(), - )); - } - - // Group transitions by contract ID - let mut document_transitions_by_contracts: BTreeMap> = - BTreeMap::new(); - - self.transitions().iter().for_each(|document_transition| { - let contract_identifier = document_transition.data_contract_id(); - - match document_transitions_by_contracts.entry(contract_identifier) { - Entry::Vacant(vacant) => { - vacant.insert(vec![document_transition]); - } - Entry::Occupied(mut identifiers) => { - identifiers.get_mut().push(document_transition); - } - }; - }); - - let mut result = SimpleConsensusValidationResult::default(); - - for transitions in document_transitions_by_contracts.values() { - // Make sure we don't have duplicate transitions - let duplicate_transitions = find_duplicates_by_id(transitions, platform_version)?; - - if !duplicate_transitions.is_empty() { - let references: Vec<(String, [u8; 32])> = duplicate_transitions - .into_iter() - .map(|transition| { - Ok(( - transition.base().document_type_name().clone(), - transition.base().id().to_buffer(), - )) - }) - .collect::, anyhow::Error>>()?; - - result.add_error(BasicError::DuplicateDocumentTransitionsWithIdsError( - DuplicateDocumentTransitionsWithIdsError::new(references), - )); - } - } - - Ok(result) - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/mod.rs new file mode 100644 index 00000000000..69891782113 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/mod.rs @@ -0,0 +1,29 @@ +use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_version::version::PlatformVersion; + +mod v0; + +impl DocumentsBatchTransition { + pub fn validate_base_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .state_transitions + .documents + .documents_batch_transition + .validation + .validate_base_structure + { + 0 => self.validate_base_structure_v0(platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentsBatchTransition::validate_base_structure".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/v0/mod.rs new file mode 100644 index 00000000000..1bc2dd8b510 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/v0/mod.rs @@ -0,0 +1,104 @@ +use crate::consensus::basic::document::{ + DocumentTransitionsAreAbsentError, DuplicateDocumentTransitionsWithIdsError, + MaxDocumentsTransitionsExceededError, NonceOutOfBoundsError, +}; +use crate::consensus::basic::BasicError; + +use crate::identity::identity_nonce::MISSING_IDENTITY_REVISIONS_FILTER; +use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::{ + DocumentTransition, DocumentTransitionV0Methods, +}; +use crate::state_transition::documents_batch_transition::validation::find_duplicates_by_id::find_duplicates_by_id; +use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +use std::collections::btree_map::Entry; +use std::collections::BTreeMap; + +impl DocumentsBatchTransition { + #[inline(always)] + pub(super) fn validate_base_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + if self.transitions().is_empty() { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentTransitionsAreAbsentError::new().into(), + )); + } + + let transitions_len = self.transitions().len(); + + if transitions_len > u16::MAX as usize + || transitions_len as u16 + > platform_version + .system_limits + .max_transitions_in_documents_batch + { + return Ok(SimpleConsensusValidationResult::new_with_error( + MaxDocumentsTransitionsExceededError::new( + platform_version + .system_limits + .max_transitions_in_documents_batch, + ) + .into(), + )); + } + + // Group transitions by contract ID + let mut document_transitions_by_contracts: BTreeMap> = + BTreeMap::new(); + + self.transitions().iter().for_each(|document_transition| { + let contract_identifier = document_transition.data_contract_id(); + + match document_transitions_by_contracts.entry(contract_identifier) { + Entry::Vacant(vacant) => { + vacant.insert(vec![document_transition]); + } + Entry::Occupied(mut identifiers) => { + identifiers.get_mut().push(document_transition); + } + }; + }); + + let mut result = SimpleConsensusValidationResult::default(); + + for transitions in document_transitions_by_contracts.values() { + for transition in transitions { + // We need to make sure that the identity contract nonce is within the allowed bounds + // This means that it is stored on 40 bits + if transition.identity_contract_nonce() & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + result.add_error(BasicError::NonceOutOfBoundsError( + NonceOutOfBoundsError::new(transition.identity_contract_nonce()), + )); + } + } + + // Make sure we don't have duplicate transitions + let duplicate_transitions = find_duplicates_by_id(transitions, platform_version)?; + + if !duplicate_transitions.is_empty() { + let references: Vec<(String, [u8; 32])> = duplicate_transitions + .into_iter() + .map(|transition| { + Ok(( + transition.base().document_type_name().clone(), + transition.base().id().to_buffer(), + )) + }) + .collect::, anyhow::Error>>()?; + + result.add_error(BasicError::DuplicateDocumentTransitionsWithIdsError( + DuplicateDocumentTransitionsWithIdsError::new(references), + )); + } + } + + Ok(result) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs index eefb63b3181..64ea5ff381f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs @@ -1,9 +1,8 @@ mod v0; -use crate::prelude::AssetLockProof; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; -use crate::NonConsensusError; + use platform_value::Identifier; pub use v0::*; @@ -14,6 +13,12 @@ impl IdentityCreateTransitionAccessorsV0 for IdentityCreateTransition { } } + fn public_keys_mut(&mut self) -> &mut Vec { + match self { + IdentityCreateTransition::V0(transition) => transition.public_keys_mut(), + } + } + fn set_public_keys(&mut self, public_keys: Vec) { match self { IdentityCreateTransition::V0(transition) => transition.set_public_keys(public_keys), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs index 6ed97a53fc8..04de1f7e3a7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs @@ -4,6 +4,10 @@ use platform_value::Identifier; pub trait IdentityCreateTransitionAccessorsV0 { /// Get identity public keys fn public_keys(&self) -> &[IdentityPublicKeyInCreation]; + + /// Get identity public keys as a mutable vec + fn public_keys_mut(&mut self) -> &mut Vec; + /// Replaces existing set of public keys with a new one fn set_public_keys(&mut self, public_keys: Vec); /// Adds public keys to the existing public keys array diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs index 40b5fc6173c..25602cb8b07 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs @@ -1,10 +1,14 @@ use crate::state_transition::state_transitions; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + SIGNATURE, STATE_TRANSITION_PROTOCOL_VERSION, }; +#[allow(unused_imports)] // Removing causes build failures; yet clippy insists it's unused pub use state_transitions::identity::common_fields::property_names::{ - ASSET_LOCK_PROOF, IDENTITY_ID, PUBLIC_KEYS, PUBLIC_KEYS_DATA, PUBLIC_KEYS_SIGNATURE, + ASSET_LOCK_PROOF, PUBLIC_KEYS, +}; +pub use state_transitions::identity::common_fields::property_names::{ + IDENTITY_ID, PUBLIC_KEYS_DATA, PUBLIC_KEYS_SIGNATURE, }; pub const IDENTIFIER_FIELDS: [&str; 1] = [IDENTITY_ID]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs index 0128b6ce3d8..83f90d6dad7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs @@ -2,24 +2,34 @@ mod v0; pub use v0::*; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] use crate::prelude::AssetLockProof; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::identity_create_transition::v0::IdentityCreateTransitionV0; use crate::state_transition::identity_create_transition::IdentityCreateTransition; - -use crate::state_transition::{StateTransition, StateTransitionType}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] use crate::version::PlatformVersion; +#[cfg(feature = "state-transition-signing")] use crate::{BlsModule, ProtocolError}; impl IdentityCreateTransitionMethodsV0 for IdentityCreateTransition { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], signer: &S, bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -33,6 +43,7 @@ impl IdentityCreateTransitionMethodsV0 for IdentityCreateTransition { asset_lock_proof_private_key, signer, bls, + user_fee_increase, platform_version, )?), v => Err(ProtocolError::UnknownVersionError(format!( diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs index 65343d67c57..9fdc3f989f6 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs @@ -1,18 +1,28 @@ +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] use crate::prelude::AssetLockProof; -use crate::state_transition::{StateTransition, StateTransitionType}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; pub trait IdentityCreateTransitionMethodsV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], signer: &S, bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, ) -> Result; /// Get State Transition type diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs index 91aab6d4997..0691ae08284 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs @@ -21,6 +21,7 @@ use fields::*; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub type IdentityCreateTransitionLatest = IdentityCreateTransitionV0; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs index 79954d54f93..cee34c9d4be 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs @@ -1,8 +1,14 @@ -use crate::identity::state_transition::AssetLockProved; +use crate::identity::state_transition::{AssetLockProved, OptionallyAssetLockProved}; use crate::prelude::AssetLockProof; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::ProtocolError; +impl OptionallyAssetLockProved for IdentityCreateTransition { + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + Some(self.asset_lock_proof()) + } +} + impl AssetLockProved for IdentityCreateTransition { fn set_asset_lock_proof( &mut self, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs index 06d6a06d543..63d23b3b520 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for IdentityCreateTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + IdentityCreateTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityCreateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityCreateTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs index 9b246d266b0..bf6cae62621 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs @@ -14,11 +14,12 @@ use bincode::{Decode, Encode}; use platform_serialization_derive::PlatformSignable; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::identity::state_transition::asset_lock_proof::AssetLockProof; use crate::identity::Identity; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, UserFeeIncrease}; use crate::identity::accessors::IdentityGettersV0; use crate::identity::state_transition::AssetLockProved; @@ -45,6 +46,7 @@ pub struct IdentityCreateTransitionV0 { #[platform_signable(into = "Vec")] pub public_keys: Vec, pub asset_lock_proof: AssetLockProof, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature: BinaryData, #[cfg_attr(feature = "state-transition-serde-conversion", serde(skip))] @@ -62,7 +64,7 @@ struct IdentityCreateTransitionV0Inner { public_keys: Vec, asset_lock_proof: AssetLockProof, // Generic identity ST fields - // protocol_version: u32, + user_fee_increase: UserFeeIncrease, signature: BinaryData, } @@ -73,23 +75,23 @@ impl TryFrom for IdentityCreateTransitionV0 { let IdentityCreateTransitionV0Inner { public_keys, asset_lock_proof, + user_fee_increase, signature, } = value; let identity_id = asset_lock_proof.create_identifier()?; Ok(Self { public_keys, asset_lock_proof, + user_fee_increase, signature, identity_id, }) } } -//todo: there shouldn't be a default - impl IdentityCreateTransitionV0 { pub fn try_from_identity_v0( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, ) -> Result { let mut identity_create_transition = IdentityCreateTransitionV0::default(); @@ -109,7 +111,7 @@ impl IdentityCreateTransitionV0 { } pub fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, platform_version: &PlatformVersion, ) -> Result { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs index 54a321e9887..42ece86f989 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::{ prelude::Identifier, @@ -49,4 +52,17 @@ impl StateTransitionLike for IdentityCreateTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// this is based on the asset lock + fn unique_identifiers(&self) -> Vec { + vec![BASE64_STANDARD.encode(self.identity_id)] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs index cec855002f7..da69511b197 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs @@ -1,36 +1,52 @@ -use crate::{ - prelude::Identifier, state_transition::StateTransitionType, BlsModule, NonConsensusError, - ProtocolError, -}; +use crate::{prelude::Identifier, state_transition::StateTransitionType}; +#[cfg(feature = "state-transition-signing")] +use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::state_transition::AssetLockProved; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] use crate::identity::KeyType::ECDSA_HASH160; +#[cfg(feature = "state-transition-signing")] use crate::prelude::AssetLockProof; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; +#[cfg(feature = "state-transition-signing")] use crate::serialization::Signable; use crate::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; use crate::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Setters; use crate::state_transition::identity_create_transition::v0::IdentityCreateTransitionV0; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::PlatformVersion; impl IdentityCreateTransitionMethodsV0 for IdentityCreateTransitionV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], signer: &S, bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, _platform_version: &PlatformVersion, ) -> Result { - let mut identity_create_transition = IdentityCreateTransitionV0::default(); + let mut identity_create_transition = IdentityCreateTransitionV0 { + user_fee_increase, + ..Default::default() + }; let public_keys = identity .public_keys() .iter() @@ -78,6 +94,11 @@ impl IdentityCreateTransitionAccessorsV0 for IdentityCreateTransitionV0 { &self.public_keys } + /// Get identity public keys + fn public_keys_mut(&mut self) -> &mut Vec { + &mut self.public_keys + } + /// Replaces existing set of public keys with a new one fn set_public_keys(&mut self, public_keys: Vec) { self.public_keys = public_keys; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs index abb71ed145a..e263f3faebd 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs @@ -1,5 +1,6 @@ mod v0; +use crate::prelude::IdentityNonce; use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use platform_value::Identifier; pub use v0::*; @@ -46,4 +47,16 @@ impl IdentityCreditTransferTransitionAccessorsV0 for IdentityCreditTransferTrans } } } + + fn set_nonce(&mut self, nonce: IdentityNonce) { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.nonce = nonce, + } + } + + fn nonce(&self) -> IdentityNonce { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.nonce, + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs index 425248a8ba7..63e2229d279 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs @@ -1,3 +1,5 @@ +use crate::prelude::IdentityNonce; + use platform_value::Identifier; pub trait IdentityCreditTransferTransitionAccessorsV0 { @@ -7,4 +9,6 @@ pub trait IdentityCreditTransferTransitionAccessorsV0 { fn set_identity_id(&mut self, identity_id: Identifier); fn recipient_id(&self) -> Identifier; fn set_recipient_id(&mut self, recipient_id: Identifier); + fn set_nonce(&mut self, nonce: IdentityNonce); + fn nonce(&self) -> IdentityNonce; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs index 5107fcbe3ca..6b5813e902b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs @@ -2,7 +2,8 @@ use crate::state_transition::state_transitions; use crate::state_transition::identity_credit_transfer_transition::fields::property_names::RECIPIENT_ID; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub use state_transitions::identity::common_fields::property_names::IDENTITY_ID; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs index 0100b34f87d..4b3b448eb54 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use crate::state_transition::StateTransitionIdentitySigned; @@ -26,4 +26,10 @@ impl StateTransitionIdentitySigned for IdentityCreditTransferTransition { } } } + + fn purpose_requirement(&self) -> Purpose { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.purpose_requirement(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs index ebe10ef16a9..b991b7402b8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs @@ -15,6 +15,7 @@ use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCr use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCreditTransferTransitionV0Signable; use crate::state_transition::StateTransitionFieldTypes; +use crate::identity::state_transition::OptionallyAssetLockProved; use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::From; @@ -22,6 +23,7 @@ use fields::*; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub type IdentityCreditTransferTransitionLatest = IdentityCreditTransferTransitionV0; @@ -71,6 +73,8 @@ impl IdentityCreditTransferTransition { } } +impl OptionallyAssetLockProved for IdentityCreditTransferTransition {} + impl StateTransitionFieldTypes for IdentityCreditTransferTransition { fn signature_property_paths() -> Vec<&'static str> { vec![SIGNATURE] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs index 04a99304b60..e4fecb34efa 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -43,9 +44,30 @@ impl StateTransitionLike for IdentityCreditTransferTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + IdentityCreditTransferTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityCreditTransferTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs index bee0594ba1b..bcab635e228 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs @@ -1,5 +1,5 @@ use crate::identity::SecurityLevel::CRITICAL; -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCreditTransferTransitionV0; use crate::state_transition::StateTransitionIdentitySigned; @@ -15,4 +15,8 @@ impl StateTransitionIdentitySigned for IdentityCreditTransferTransitionV0 { fn security_level_requirement(&self) -> Vec { vec![CRITICAL] } + + fn purpose_requirement(&self) -> Purpose { + Purpose::TRANSFER + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs index 55063239839..b04b6f3f761 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs @@ -10,12 +10,13 @@ mod version; use crate::identity::KeyID; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, IdentityNonce, UserFeeIncrease}; use crate::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive( @@ -40,6 +41,8 @@ pub struct IdentityCreditTransferTransitionV0 { pub identity_id: Identifier, pub recipient_id: Identifier, pub amount: u64, + pub nonce: IdentityNonce, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] @@ -76,6 +79,8 @@ mod test { identity_id: Identifier::random(), recipient_id: Identifier::random(), amount: rng.gen(), + nonce: 1, + user_fee_increase: 0, signature_public_key_id: rng.gen(), signature: [0; 65].to_vec().into(), }; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs index fb741a89f88..f11b5ae9d4a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -49,4 +52,21 @@ impl StateTransitionLike for IdentityCreditTransferTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want things to be unique based on the nonce, so we don't add the transition type + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{:x}", + BASE64_STANDARD.encode(self.identity_id), + self.nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs index 187a59c4ae2..dbf33c5a56e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs @@ -4,7 +4,7 @@ use crate::identity::core_script::CoreScript; use platform_value::Identifier; pub use v0::*; -use crate::prelude::Revision; +use crate::prelude::IdentityNonce; use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use crate::withdrawal::Pooling; @@ -16,21 +16,37 @@ impl IdentityCreditWithdrawalTransitionAccessorsV0 for IdentityCreditWithdrawalT } } + fn set_identity_id(&mut self, identity_id: Identifier) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.identity_id = identity_id; + } + } + } + fn amount(&self) -> u64 { match self { IdentityCreditWithdrawalTransition::V0(transition) => transition.amount, } } - fn set_revision(&mut self, revision: Revision) { + fn set_amount(&mut self, amount: u64) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.amount = amount; + } + } + } + + fn set_nonce(&mut self, nonce: IdentityNonce) { match self { - IdentityCreditWithdrawalTransition::V0(transition) => transition.revision = revision, + IdentityCreditWithdrawalTransition::V0(transition) => transition.nonce = nonce, } } - fn revision(&self) -> Revision { + fn nonce(&self) -> IdentityNonce { match self { - IdentityCreditWithdrawalTransition::V0(transition) => transition.revision, + IdentityCreditWithdrawalTransition::V0(transition) => transition.nonce, } } @@ -40,15 +56,39 @@ impl IdentityCreditWithdrawalTransitionAccessorsV0 for IdentityCreditWithdrawalT } } + fn set_pooling(&mut self, pooling: Pooling) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.pooling = pooling; + } + } + } + fn core_fee_per_byte(&self) -> u32 { match self { IdentityCreditWithdrawalTransition::V0(transition) => transition.core_fee_per_byte, } } + fn set_core_fee_per_byte(&mut self, core_fee_per_byte: u32) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.core_fee_per_byte = core_fee_per_byte; + } + } + } + fn output_script(&self) -> CoreScript { match self { IdentityCreditWithdrawalTransition::V0(transition) => transition.output_script.clone(), } } + + fn set_output_script(&mut self, output_script: CoreScript) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.output_script = output_script; + } + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs index f59529f8f88..1bcd8b29459 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs @@ -1,14 +1,19 @@ use crate::identity::core_script::CoreScript; -use crate::prelude::Revision; +use crate::prelude::IdentityNonce; use crate::withdrawal::Pooling; use platform_value::Identifier; pub trait IdentityCreditWithdrawalTransitionAccessorsV0 { fn identity_id(&self) -> Identifier; + fn set_identity_id(&mut self, identity_id: Identifier); fn amount(&self) -> u64; - fn set_revision(&mut self, revision: Revision); - fn revision(&self) -> Revision; + fn set_amount(&mut self, amount: u64); + fn nonce(&self) -> IdentityNonce; + fn set_nonce(&mut self, nonce: IdentityNonce); fn pooling(&self) -> Pooling; + fn set_pooling(&mut self, pooling: Pooling); fn core_fee_per_byte(&self) -> u32; + fn set_core_fee_per_byte(&mut self, amount: u32); fn output_script(&self) -> CoreScript; + fn set_output_script(&mut self, output_script: CoreScript); } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs index 1455089e1e4..2dd369f3b39 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use crate::state_transition::StateTransitionIdentitySigned; @@ -26,4 +26,10 @@ impl StateTransitionIdentitySigned for IdentityCreditWithdrawalTransition { } } } + + fn purpose_requirement(&self) -> Purpose { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => transition.purpose_requirement(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs index 6b3e0a53c00..96b2654046a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs @@ -1,5 +1,69 @@ mod v0; + use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::FeatureVersion; pub use v0::*; -impl IdentityCreditWithdrawalTransitionMethodsV0 for IdentityCreditWithdrawalTransition {} +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::Identity; + +#[cfg(feature = "state-transition-signing")] +use crate::identity::core_script::CoreScript; +#[cfg(feature = "state-transition-signing")] +use crate::identity::IdentityPublicKey; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] +use crate::version::PlatformVersion; +#[cfg(feature = "state-transition-signing")] +use crate::withdrawal::Pooling; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; + +impl IdentityCreditWithdrawalTransitionMethodsV0 for IdentityCreditWithdrawalTransition { + #[cfg(feature = "state-transition-signing")] + fn try_from_identity( + identity: &Identity, + withdrawal_key_to_use: Option<&IdentityPublicKey>, + output_script: CoreScript, + amount: u64, + pooling: Pooling, + core_fee_per_byte: u32, + user_fee_increase: UserFeeIncrease, + signer: S, + nonce: IdentityNonce, + platform_version: &PlatformVersion, + version: Option, + ) -> Result { + match version.unwrap_or( + platform_version + .dpp + .state_transition_conversion_versions + .identity_to_identity_withdrawal_transition, + ) { + 0 => Ok(IdentityCreditWithdrawalTransitionV0::try_from_identity( + identity, + withdrawal_key_to_use, + output_script, + amount, + pooling, + core_fee_per_byte, + user_fee_increase, + signer, + nonce, + platform_version, + version, + )?), + v => Err(ProtocolError::UnknownVersionError(format!( + "Unknown IdentityCreditWithdrawalTransition version for try_from_identity {v}" + ))), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs index d6cf5253ffb..0341f253f1f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs @@ -1,6 +1,39 @@ +#[cfg(feature = "state-transition-signing")] +use crate::identity::core_script::CoreScript; +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] +use crate::identity::IdentityPublicKey; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] +use crate::withdrawal::Pooling; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::{FeatureVersion, PlatformVersion}; pub trait IdentityCreditWithdrawalTransitionMethodsV0 { + #[cfg(feature = "state-transition-signing")] + fn try_from_identity( + identity: &Identity, + withdrawal_key_to_use: Option<&IdentityPublicKey>, + output_script: CoreScript, + amount: u64, + pooling: Pooling, + core_fee_per_byte: u32, + user_fee_increase: UserFeeIncrease, + signer: S, + nonce: IdentityNonce, + platform_version: &PlatformVersion, + version: Option, + ) -> Result; + /// Get State Transition Type fn get_type() -> StateTransitionType { StateTransitionType::IdentityCreditWithdrawal diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs index 7dc6a29030f..f7732969360 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs @@ -1,7 +1,7 @@ use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; pub mod accessors; -mod fields; +pub mod fields; mod identity_signed; #[cfg(feature = "state-transition-json-conversion")] mod json_conversion; @@ -15,13 +15,15 @@ mod version; use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0Signable; use crate::state_transition::StateTransitionFieldTypes; +use crate::identity::state_transition::OptionallyAssetLockProved; use crate::ProtocolError; use bincode::{Decode, Encode}; -use data_contracts::withdrawals_contract::document_types::withdrawal::properties::OUTPUT_SCRIPT; use derive_more::From; use fields::*; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; +use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub type IdentityCreditWithdrawalTransitionLatest = IdentityCreditWithdrawalTransitionV0; @@ -52,6 +54,25 @@ pub enum IdentityCreditWithdrawalTransition { V0(IdentityCreditWithdrawalTransitionV0), } +impl IdentityCreditWithdrawalTransition { + pub fn default_versioned(platform_version: &PlatformVersion) -> Result { + match platform_version + .dpp + .identity_versions + .identity_structure_version + { + 0 => Ok(IdentityCreditWithdrawalTransition::V0( + IdentityCreditWithdrawalTransitionV0::default(), + )), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "IdentityCreditWithdrawalTransition::default_versioned".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} + impl StateTransitionFieldTypes for IdentityCreditWithdrawalTransition { fn signature_property_paths() -> Vec<&'static str> { vec![SIGNATURE, SIGNATURE_PUBLIC_KEY_ID] @@ -65,3 +86,5 @@ impl StateTransitionFieldTypes for IdentityCreditWithdrawalTransition { vec![SIGNATURE, OUTPUT_SCRIPT] } } + +impl OptionallyAssetLockProved for IdentityCreditWithdrawalTransition {} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs index 2addd0674cd..022294a3a66 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -39,6 +40,21 @@ impl StateTransitionLike for IdentityCreditWithdrawalTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } + fn set_signature_bytes(&mut self, signature: Vec) { match self { IdentityCreditWithdrawalTransition::V0(transition) => { @@ -52,4 +68,10 @@ impl StateTransitionLike for IdentityCreditWithdrawalTransition { IdentityCreditWithdrawalTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs index 7207aa59e20..2c8011f2fd1 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs @@ -1,5 +1,5 @@ use crate::identity::SecurityLevel::CRITICAL; -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; use crate::state_transition::StateTransitionIdentitySigned; @@ -16,4 +16,8 @@ impl StateTransitionIdentitySigned for IdentityCreditWithdrawalTransitionV0 { fn security_level_requirement(&self) -> Vec { vec![CRITICAL] } + + fn purpose_requirement(&self) -> Purpose { + Purpose::TRANSFER + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs index 485801e5486..2a5246b9ab7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs @@ -3,22 +3,34 @@ mod identity_signed; mod json_conversion; mod state_transition_like; mod types; +mod v0_methods; #[cfg(feature = "state-transition-value-conversion")] mod value_conversion; mod version; use bincode::{Decode, Encode}; +use dashcore::transaction::special_transaction::asset_unlock::qualified_asset_unlock::ASSET_UNLOCK_TX_SIZE; use platform_serialization_derive::PlatformSignable; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; +use crate::balances::credits::CREDITS_PER_DUFF; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::{ identity::{core_script::CoreScript, KeyID}, - prelude::{Identifier, Revision}, + prelude::Identifier, + withdrawal::Pooling, ProtocolError, }; -use crate::withdrawal::Pooling; +// TODO: unsafe - we must use actual relay fee from core +/// Minimal core per byte. Must be a fibonacci number +pub const MIN_CORE_FEE_PER_BYTE: u32 = 1; + +/// Minimal amount in credits (x1000) to avoid "dust" error in Core +pub const MIN_WITHDRAWAL_AMOUNT: u64 = + (ASSET_UNLOCK_TX_SIZE as u64) * (MIN_CORE_FEE_PER_BYTE as u64) * CREDITS_PER_DUFF; #[derive(Debug, Clone, Encode, Decode, PlatformSignable, PartialEq)] #[cfg_attr( @@ -33,7 +45,8 @@ pub struct IdentityCreditWithdrawalTransitionV0 { pub core_fee_per_byte: u32, pub pooling: Pooling, pub output_script: CoreScript, - pub revision: Revision, + pub nonce: IdentityNonce, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs index 54f2ac1b7ab..605f8344512 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -50,4 +53,21 @@ impl StateTransitionLike for IdentityCreditWithdrawalTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want things to be unique based on the nonce, so we don't add the transition type + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{:x}", + BASE64_STANDARD.encode(self.identity_id), + self.nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..8d4f813231d --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/v0_methods.rs @@ -0,0 +1,76 @@ +#[cfg(feature = "state-transition-signing")] +use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] +use crate::identity::core_script::CoreScript; +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::IdentityPublicKey; +#[cfg(feature = "state-transition-signing")] +use crate::identity::{Identity, KeyType, Purpose, SecurityLevel}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +use crate::state_transition::identity_credit_withdrawal_transition::methods::IdentityCreditWithdrawalTransitionMethodsV0; +use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::{GetDataContractSecurityLevelRequirementFn, StateTransition}; +#[cfg(feature = "state-transition-signing")] +use crate::withdrawal::Pooling; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::{FeatureVersion, PlatformVersion}; + +impl IdentityCreditWithdrawalTransitionMethodsV0 for IdentityCreditWithdrawalTransitionV0 { + #[cfg(feature = "state-transition-signing")] + fn try_from_identity( + identity: &Identity, + withdrawal_key_to_use: Option<&IdentityPublicKey>, + output_script: CoreScript, + amount: u64, + pooling: Pooling, + core_fee_per_byte: u32, + user_fee_increase: UserFeeIncrease, + signer: S, + nonce: IdentityNonce, + _platform_version: &PlatformVersion, + _version: Option, + ) -> Result { + let mut transition: StateTransition = IdentityCreditWithdrawalTransitionV0 { + identity_id: identity.id(), + amount, + core_fee_per_byte, + pooling, + output_script, + nonce, + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let identity_public_key = match withdrawal_key_to_use { + Some(key) => key, + None => identity + .get_first_public_key_matching( + Purpose::TRANSFER, + SecurityLevel::full_range().into(), + KeyType::all_key_types().into(), + true, + ) + .ok_or_else(|| { + ProtocolError::DesiredKeyWithTypePurposeSecurityLevelMissing( + "no withdrawal public key".to_string(), + ) + })?, + }; + + transition.sign_external( + identity_public_key, + &signer, + None::, + )?; + + Ok(transition) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs index 2f9df88f1a2..41e8bfd9c53 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs @@ -2,7 +2,6 @@ mod v0; pub use v0::*; -use crate::prelude::AssetLockProof; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use platform_value::Identifier; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs index 2b2b09ca236..2d7db38ece0 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs @@ -1,7 +1,8 @@ use crate::state_transition::state_transitions; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub use state_transitions::identity::common_fields::property_names::{ ASSET_LOCK_PROOF, IDENTITY_ID, PUBLIC_KEYS, PUBLIC_KEYS_DATA, PUBLIC_KEYS_SIGNATURE, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs index 43e807d321d..243117c2945 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs @@ -2,38 +2,44 @@ mod v0; pub use v0::*; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; -use crate::prelude::AssetLockProof; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{AssetLockProof, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; -use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; impl IdentityTopUpTransitionMethodsV0 for IdentityTopUpTransition { #[cfg(feature = "state-transition-signing")] fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], - bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, version: Option, ) -> Result { match version.unwrap_or( platform_version .dpp - .state_transition_serialization_versions - .identity_top_up_state_transition - .default_current_version, + .state_transition_conversion_versions + .identity_to_identity_top_up_transition, ) { 0 => Ok(IdentityTopUpTransitionV0::try_from_identity( identity, asset_lock_proof, asset_lock_proof_private_key, - bls, + user_fee_increase, platform_version, version, )?), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs index 65328f50721..d314b9325a7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs @@ -1,16 +1,22 @@ +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; -use crate::prelude::AssetLockProof; -use crate::state_transition::{StateTransition, StateTransitionType}; -use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{AssetLockProof, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; pub trait IdentityTopUpTransitionMethodsV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], - bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, version: Option, ) -> Result; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs index 21f72678d8a..d336359e84c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs @@ -22,6 +22,7 @@ use derive_more::From; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive( diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs index 3d992128085..d664ee5ab91 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs @@ -1,8 +1,14 @@ -use crate::identity::state_transition::AssetLockProved; +use crate::identity::state_transition::{AssetLockProved, OptionallyAssetLockProved}; use crate::prelude::AssetLockProof; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use crate::ProtocolError; +impl OptionallyAssetLockProved for IdentityTopUpTransition { + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + Some(self.asset_lock_proof()) + } +} + impl AssetLockProved for IdentityTopUpTransition { fn set_asset_lock_proof( &mut self, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs index 63bec1d429f..a67c939243b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for IdentityTopUpTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityTopUpTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + IdentityTopUpTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityTopUpTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityTopUpTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs index f2bd2b06162..8541ad0e7b8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs @@ -13,11 +13,12 @@ use platform_serialization_derive::PlatformSignable; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::identity::state_transition::asset_lock_proof::AssetLockProof; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, UserFeeIncrease}; use crate::ProtocolError; @@ -40,6 +41,7 @@ pub struct IdentityTopUpTransitionV0 { // Own ST fields pub asset_lock_proof: AssetLockProof, pub identity_id: Identifier, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature: BinaryData, } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs index c1fee0d3a77..5d53273c2fc 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use crate::{ prelude::Identifier, @@ -49,4 +52,28 @@ impl StateTransitionLike for IdentityTopUpTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want transactions to be unique based on the asset lock proof, here there is a + /// conflict on purpose with identity create transitions + fn unique_identifiers(&self) -> Vec { + let identifier = self.asset_lock_proof.create_identifier(); + match identifier { + Ok(identifier) => { + vec![BASE64_STANDARD.encode(identifier)] + } + Err(_) => { + // no unique identifier, this won't actually occur on Platform + // as we ask for the unique identifier after validation + vec![String::default()] + } + } + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs index fb69de73202..da2b8f680b3 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs @@ -1,38 +1,52 @@ -use crate::{prelude::Identifier, BlsModule, ProtocolError}; - +#[cfg(feature = "state-transition-signing")] use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; -use crate::identity::KeyType::ECDSA_HASH160; -use crate::prelude::AssetLockProof; +use crate::prelude::Identifier; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{AssetLockProof, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use dashcore::signer; use crate::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0; use crate::state_transition::identity_topup_transition::methods::IdentityTopUpTransitionMethodsV0; +#[cfg(feature = "state-transition-signing")] +use crate::serialization::Signable; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; impl IdentityTopUpTransitionMethodsV0 for IdentityTopUpTransitionV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], - bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, _platform_version: &PlatformVersion, _version: Option, ) -> Result { let identity_top_up_transition = IdentityTopUpTransitionV0 { asset_lock_proof, identity_id: identity.id(), + user_fee_increase, signature: Default::default(), }; let mut state_transition: StateTransition = identity_top_up_transition.into(); - state_transition.sign_by_private_key(asset_lock_proof_private_key, ECDSA_HASH160, bls)?; + let data = state_transition.signable_bytes()?; + + let signature = signer::sign(&data, asset_lock_proof_private_key)?; + state_transition.set_signature(signature.to_vec().into()); Ok(state_transition) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs index d1dd35f4c4e..46ba75bd23a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs @@ -11,6 +11,7 @@ use crate::state_transition::identity_topup_transition::fields::*; use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; use crate::state_transition::StateTransitionValueConvert; +use crate::state_transition::state_transitions::common_fields::property_names::USER_FEE_INCREASE; use platform_version::version::PlatformVersion; impl<'a> StateTransitionValueConvert<'a> for IdentityTopUpTransitionV0 { @@ -33,10 +34,16 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityTopUpTransitionV0 { .map_err(ProtocolError::ValueError)?; let asset_lock_proof = AssetLockProof::try_from(raw_asset_lock_proof)?; + let user_fee_increase = raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(); + Ok(IdentityTopUpTransitionV0 { signature, identity_id, asset_lock_proof, + user_fee_increase, }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs index 9225779e547..858f0ee423c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs @@ -1,7 +1,7 @@ mod v0; -use crate::identity::{KeyID, TimestampMillis}; -use crate::prelude::Revision; +use crate::identity::KeyID; +use crate::prelude::{IdentityNonce, Revision}; use crate::state_transition::identity_update_transition::IdentityUpdateTransition; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use platform_value::Identifier; @@ -32,6 +32,18 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransition { } } + fn set_nonce(&mut self, nonce: IdentityNonce) { + match self { + IdentityUpdateTransition::V0(transition) => transition.set_nonce(nonce), + } + } + + fn nonce(&self) -> IdentityNonce { + match self { + IdentityUpdateTransition::V0(transition) => transition.nonce(), + } + } + fn set_public_keys_to_add(&mut self, add_public_keys: Vec) { match self { IdentityUpdateTransition::V0(transition) => { @@ -66,20 +78,6 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransition { } } - fn set_public_keys_disabled_at(&mut self, public_keys_disabled_at: Option) { - match self { - IdentityUpdateTransition::V0(transition) => { - transition.set_public_keys_disabled_at(public_keys_disabled_at) - } - } - } - - fn public_keys_disabled_at(&self) -> Option { - match self { - IdentityUpdateTransition::V0(transition) => transition.public_keys_disabled_at(), - } - } - fn owner_id(&self) -> Identifier { match self { IdentityUpdateTransition::V0(transition) => transition.owner_id(), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs index 8fece6aceb7..30a8daf5150 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs @@ -1,7 +1,8 @@ +use crate::prelude::IdentityNonce; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::{ identity::KeyID, - prelude::{Identifier, Revision, TimestampMillis}, + prelude::{Identifier, Revision}, }; pub trait IdentityUpdateTransitionAccessorsV0 { @@ -9,12 +10,12 @@ pub trait IdentityUpdateTransitionAccessorsV0 { fn identity_id(&self) -> Identifier; fn set_revision(&mut self, revision: Revision); fn revision(&self) -> Revision; + fn set_nonce(&mut self, nonce: IdentityNonce); + fn nonce(&self) -> IdentityNonce; fn set_public_keys_to_add(&mut self, add_public_keys: Vec); fn public_keys_to_add(&self) -> &[IdentityPublicKeyInCreation]; fn public_keys_to_add_mut(&mut self) -> &mut [IdentityPublicKeyInCreation]; fn set_public_key_ids_to_disable(&mut self, disable_public_keys: Vec); fn public_key_ids_to_disable(&self) -> &[KeyID]; - fn set_public_keys_disabled_at(&mut self, public_keys_disabled_at: Option); - fn public_keys_disabled_at(&self) -> Option; fn owner_id(&self) -> Identifier; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs index 673ff93b7d6..115e5cc3260 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs @@ -4,8 +4,8 @@ use crate::state_transition::identity_update_transition::fields::property_names: ADD_PUBLIC_KEYS_DATA, ADD_PUBLIC_KEYS_SIGNATURE, }; pub use state_transitions::common_fields::property_names::{ - ENTROPY, REVISION, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, - TRANSITION_TYPE, + IDENTITY_NONCE, REVISION, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, + STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, }; pub use state_transitions::identity::common_fields::property_names::IDENTITY_ID; @@ -14,7 +14,6 @@ pub mod property_names { pub const ADD_PUBLIC_KEYS_SIGNATURE: &str = "addPublicKeys[].signature"; pub const ADD_PUBLIC_KEYS: &str = "addPublicKeys"; pub const DISABLE_PUBLIC_KEYS: &str = "disablePublicKeys"; - pub const PUBLIC_KEYS_DISABLED_AT: &str = "publicKeysDisabledAt"; } pub const IDENTIFIER_FIELDS: [&str; 1] = [IDENTITY_ID]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs index 7ec7c165a63..dc530225de4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs @@ -1,16 +1,25 @@ mod v0; pub use v0::*; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::{Identity, IdentityPublicKey, KeyID}; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::identity_update_transition::v0::IdentityUpdateTransitionV0; use crate::state_transition::identity_update_transition::IdentityUpdateTransition; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; +#[cfg(feature = "state-transition-signing")] use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransition { @@ -20,7 +29,8 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransition { master_public_key_id: &KeyID, add_public_keys: Vec, disable_public_keys: Vec, - public_keys_disabled_at: Option, + nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, version: Option, @@ -37,7 +47,8 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransition { master_public_key_id, add_public_keys, disable_public_keys, - public_keys_disabled_at, + nonce, + user_fee_increase, signer, platform_version, version, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs index b692416b593..338f5afc448 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs @@ -1,10 +1,18 @@ -use platform_version::version::PlatformVersion; - +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::{Identity, IdentityPublicKey}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; -use crate::{identity::KeyID, state_transition::StateTransitionType, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use crate::{identity::KeyID, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::PlatformVersion; pub trait IdentityUpdateTransitionMethodsV0 { #[cfg(feature = "state-transition-signing")] @@ -13,7 +21,8 @@ pub trait IdentityUpdateTransitionMethodsV0 { master_public_key_id: &KeyID, add_public_keys: Vec, disable_public_keys: Vec, - public_keys_disabled_at: Option, + nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, version: Option, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs index 0ef9d4c5d7e..c886979839f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs @@ -17,12 +17,14 @@ use crate::state_transition::identity_update_transition::v0::IdentityUpdateTrans use crate::state_transition::StateTransitionFieldTypes; use fields::*; +use crate::identity::state_transition::OptionallyAssetLockProved; use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::From; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive( @@ -70,6 +72,8 @@ impl IdentityUpdateTransition { } } +impl OptionallyAssetLockProved for IdentityUpdateTransition {} + impl StateTransitionFieldTypes for IdentityUpdateTransition { fn binary_property_paths() -> Vec<&'static str> { vec![SIGNATURE, ADD_PUBLIC_KEYS_SIGNATURE] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs index 09084cf474d..69886a3c198 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_update_transition::IdentityUpdateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for IdentityUpdateTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityUpdateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + IdentityUpdateTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityUpdateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityUpdateTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs index 57959d7983f..1a0fe9b27d4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs @@ -15,6 +15,7 @@ mod test { }; use crate::tests::fixtures::identity_v0_fixture; use crate::tests::utils::generate_random_identifier_struct; + use assert_matches::assert_matches; use platform_value::BinaryData; use serde_json::Value as JsonValue; @@ -25,9 +26,10 @@ mod test { let transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { identity_id: generate_random_identifier_struct(), revision: 0, + nonce: 1, add_public_keys: vec![public_key.into()], disable_public_keys: vec![], - public_keys_disabled_at: None, + user_fee_increase: 0, signature_public_key_id: 0, signature: BinaryData::new(buffer.to_vec()), } @@ -39,11 +41,8 @@ mod test { into_validating_json: false, }) .expect("conversion to json shouldn't fail"); - assert!(matches!(result[IDENTITY_ID], JsonValue::String(_))); - assert!(matches!(result[SIGNATURE], JsonValue::String(_))); - assert!(matches!( - result[ADD_PUBLIC_KEYS][0]["data"], - JsonValue::String(_) - )); + assert_matches!(result[IDENTITY_ID], JsonValue::String(_)); + assert_matches!(result[SIGNATURE], JsonValue::String(_)); + assert_matches!(result[ADD_PUBLIC_KEYS][0]["data"], JsonValue::String(_)); } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs index 6cd7af74de0..55fb52ba7f5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs @@ -11,6 +11,7 @@ mod version; use bincode::{Decode, Encode}; use platform_serialization_derive::PlatformSignable; use platform_value::{BinaryData, Value}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use std::convert::{TryFrom, TryInto}; @@ -18,9 +19,10 @@ use std::convert::{TryFrom, TryInto}; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreationSignable; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::{ identity::KeyID, - prelude::{Identifier, Revision, TimestampMillis}, + prelude::{Identifier, Revision}, ProtocolError, }; @@ -39,9 +41,12 @@ pub struct IdentityUpdateTransitionV0 { /// Unique identifier of the identity to be updated pub identity_id: Identifier, - /// Identity Update revision number + /// The revision of the identity after update pub revision: Revision, + /// Identity nonce for this transition to prevent replay attacks + pub nonce: IdentityNonce, + /// Public Keys to add to the Identity /// we want to skip serialization of transitions, as we does it manually in `to_object()` and `to_json()` #[cfg_attr(feature = "state-transition-serde-conversion", serde(default))] @@ -52,8 +57,8 @@ pub struct IdentityUpdateTransitionV0 { #[cfg_attr(feature = "state-transition-serde-conversion", serde(default))] pub disable_public_keys: Vec, - /// Timestamp when keys were disabled - pub public_keys_disabled_at: Option, + /// The fee multiplier + pub user_fee_increase: UserFeeIncrease, /// The ID of the public key used to sing the State Transition #[platform_signable(exclude_from_sig_hash)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs index e44568fff41..00674b8b30f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -49,4 +52,21 @@ impl StateTransitionLike for IdentityUpdateTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want things to be unique based on the nonce, so we don't add the transition type + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{:x}", + BASE64_STANDARD.encode(self.identity_id), + self.nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + self.user_fee_increase = user_fee_increase + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs index 8f46eb0b5f1..26af0304de5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs @@ -1,29 +1,43 @@ +#[cfg(feature = "state-transition-signing")] use crate::serialization::Signable; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-signing")] use crate::consensus::signature::{ InvalidSignaturePublicKeySecurityLevelError, MissingPublicKeyError, SignatureError, }; +#[cfg(feature = "state-transition-signing")] use crate::consensus::ConsensusError; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::{Identity, IdentityPublicKey}; +#[cfg(feature = "state-transition-signing")] use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; use crate::state_transition::identity_update_transition::methods::IdentityUpdateTransitionMethodsV0; use crate::state_transition::identity_update_transition::v0::IdentityUpdateTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Setters; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::{GetDataContractSecurityLevelRequirementFn, StateTransition}; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; use crate::{ - identity::{KeyID, SecurityLevel}, - prelude::{Identifier, Revision, TimestampMillis}, - ProtocolError, + identity::KeyID, + prelude::{Identifier, Revision}, }; - +#[cfg(feature = "state-transition-signing")] +use crate::{identity::SecurityLevel, ProtocolError}; impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransitionV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer<'a, S: Signer>( @@ -31,7 +45,8 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransitionV0 { master_public_key_id: &KeyID, add_public_keys: Vec, disable_public_keys: Vec, - public_keys_disabled_at: Option, + nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, _platform_version: &PlatformVersion, _version: Option, @@ -46,9 +61,10 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransitionV0 { signature_public_key_id: 0, identity_id: identity.id(), revision: identity.revision(), + nonce, add_public_keys: add_public_keys_in_creation, disable_public_keys, - public_keys_disabled_at, + user_fee_increase, }; let state_transition: StateTransition = identity_update_transition.clone().into(); @@ -114,6 +130,14 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransitionV0 { self.revision } + fn set_nonce(&mut self, nonce: IdentityNonce) { + self.nonce = nonce; + } + + fn nonce(&self) -> IdentityNonce { + self.nonce + } + fn set_public_keys_to_add(&mut self, add_public_keys: Vec) { self.add_public_keys = add_public_keys; } @@ -134,14 +158,6 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransitionV0 { &self.disable_public_keys } - fn set_public_keys_disabled_at(&mut self, public_keys_disabled_at: Option) { - self.public_keys_disabled_at = public_keys_disabled_at; - } - - fn public_keys_disabled_at(&self) -> Option { - self.public_keys_disabled_at - } - fn owner_id(&self) -> Identifier { self.identity_id } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs index de82f22067b..67c42289be7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs @@ -9,6 +9,9 @@ use crate::state_transition::identity_update_transition::v0::{ use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::state_transition::StateTransitionValueConvert; +use crate::state_transition::state_transitions::common_fields::property_names::{ + NONCE, USER_FEE_INCREASE, +}; use platform_version::version::PlatformVersion; impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { @@ -29,6 +32,13 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { let revision = raw_object .get_integer(REVISION) .map_err(ProtocolError::ValueError)?; + let nonce = raw_object + .get_integer(NONCE) + .map_err(ProtocolError::ValueError)?; + let user_fee_increase = raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(); let add_public_keys = raw_object .remove_optional_array(property_names::ADD_PUBLIC_KEYS) .map_err(ProtocolError::ValueError)? @@ -38,18 +48,16 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { .collect::, ProtocolError>>()?; let disable_public_keys = remove_integer_list_or_default(&mut raw_object, property_names::DISABLE_PUBLIC_KEYS)?; - let public_keys_disabled_at = raw_object - .remove_optional_integer(property_names::PUBLIC_KEYS_DISABLED_AT) - .map_err(ProtocolError::ValueError)?; Ok(IdentityUpdateTransitionV0 { signature, signature_public_key_id, identity_id, revision, + nonce, add_public_keys, disable_public_keys, - public_keys_disabled_at, + user_fee_increase, }) } @@ -108,8 +116,6 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { value.remove_optional_value_if_empty_array(property_names::DISABLE_PUBLIC_KEYS)?; - value.remove_optional_value_if_null(property_names::PUBLIC_KEYS_DISABLED_AT)?; - Ok(value) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/accessors/mod.rs new file mode 100644 index 00000000000..078e18f4376 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/accessors/mod.rs @@ -0,0 +1,57 @@ +mod v0; + +use crate::prelude::IdentityNonce; +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use crate::voting::votes::Vote; +use platform_value::Identifier; +pub use v0::*; + +impl MasternodeVoteTransitionAccessorsV0 for MasternodeVoteTransition { + fn pro_tx_hash(&self) -> Identifier { + match self { + MasternodeVoteTransition::V0(transition) => transition.pro_tx_hash, + } + } + + fn voter_identity_id(&self) -> Identifier { + match self { + MasternodeVoteTransition::V0(transition) => transition.voter_identity_id, + } + } + + fn set_pro_tx_hash(&mut self, pro_tx_hash: Identifier) { + match self { + MasternodeVoteTransition::V0(transition) => { + transition.pro_tx_hash = pro_tx_hash; + } + } + } + + fn set_voter_identity_id(&mut self, voter_identity_id: Identifier) { + match self { + MasternodeVoteTransition::V0(transition) => { + transition.voter_identity_id = voter_identity_id; + } + } + } + + fn vote(&self) -> &Vote { + match self { + MasternodeVoteTransition::V0(transition) => &transition.vote, + } + } + + fn set_vote(&mut self, vote: Vote) { + match self { + MasternodeVoteTransition::V0(transition) => { + transition.vote = vote; + } + } + } + + fn nonce(&self) -> IdentityNonce { + match self { + MasternodeVoteTransition::V0(transition) => transition.nonce, + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/accessors/v0/mod.rs new file mode 100644 index 00000000000..dd62754e0e0 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/accessors/v0/mod.rs @@ -0,0 +1,13 @@ +use crate::prelude::IdentityNonce; +use crate::voting::votes::Vote; +use platform_value::Identifier; + +pub trait MasternodeVoteTransitionAccessorsV0 { + fn pro_tx_hash(&self) -> Identifier; + fn voter_identity_id(&self) -> Identifier; + fn set_pro_tx_hash(&mut self, pro_tx_hash: Identifier); + fn set_voter_identity_id(&mut self, voter_id: Identifier); + fn vote(&self) -> &Vote; + fn set_vote(&mut self, vote: Vote); + fn nonce(&self) -> IdentityNonce; +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/fields.rs new file mode 100644 index 00000000000..7c29ab10e2e --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/fields.rs @@ -0,0 +1,15 @@ +use crate::state_transition::state_transitions; + +use crate::state_transition::masternode_vote_transition::fields::property_names::PRO_TX_HASH; +pub use state_transitions::common_fields::property_names::{ + SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, +}; +pub use state_transitions::identity::common_fields::property_names::IDENTITY_ID; + +pub(crate) mod property_names { + pub const PRO_TX_HASH: &str = "proTxHash"; +} + +pub const IDENTIFIER_FIELDS: [&str; 1] = [PRO_TX_HASH]; +pub const BINARY_FIELDS: [&str; 1] = [SIGNATURE]; +pub const U32_FIELDS: [&str; 1] = [STATE_TRANSITION_PROTOCOL_VERSION]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/identity_signed.rs new file mode 100644 index 00000000000..cfc6f9d65bb --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/identity_signed.rs @@ -0,0 +1,31 @@ +use crate::identity::{KeyID, Purpose, SecurityLevel}; +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use crate::state_transition::StateTransitionIdentitySigned; + +impl StateTransitionIdentitySigned for MasternodeVoteTransition { + fn signature_public_key_id(&self) -> KeyID { + match self { + MasternodeVoteTransition::V0(transition) => transition.signature_public_key_id(), + } + } + + fn set_signature_public_key_id(&mut self, key_id: KeyID) { + match self { + MasternodeVoteTransition::V0(transition) => { + transition.set_signature_public_key_id(key_id) + } + } + } + + fn security_level_requirement(&self) -> Vec { + match self { + MasternodeVoteTransition::V0(transition) => transition.security_level_requirement(), + } + } + + fn purpose_requirement(&self) -> Purpose { + match self { + MasternodeVoteTransition::V0(transition) => transition.purpose_requirement(), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/json_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/json_conversion.rs new file mode 100644 index 00000000000..5eda4c90f15 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/json_conversion.rs @@ -0,0 +1,27 @@ +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use crate::state_transition::state_transitions::masternode_vote_transition::fields::*; +use crate::state_transition::{ + JsonStateTransitionSerializationOptions, StateTransitionJsonConvert, +}; +use crate::ProtocolError; +use serde_json::Number; +use serde_json::Value as JsonValue; + +impl<'a> StateTransitionJsonConvert<'a> for MasternodeVoteTransition { + fn to_json( + &self, + options: JsonStateTransitionSerializationOptions, + ) -> Result { + match self { + MasternodeVoteTransition::V0(transition) => { + let mut value = transition.to_json(options)?; + let map_value = value.as_object_mut().expect("expected an object"); + map_value.insert( + STATE_TRANSITION_PROTOCOL_VERSION.to_string(), + JsonValue::Number(Number::from(0)), + ); + Ok(value) + } + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/methods/mod.rs new file mode 100644 index 00000000000..e5aad46bd08 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/methods/mod.rs @@ -0,0 +1,58 @@ +mod v0; + +pub use v0::*; + +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::IdentityPublicKey; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::{FeatureVersion, PlatformVersion}; + +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] +use crate::voting::votes::Vote; + +impl MasternodeVoteTransitionMethodsV0 for MasternodeVoteTransition { + #[cfg(feature = "state-transition-signing")] + fn try_from_vote_with_signer( + vote: Vote, + signer: &S, + pro_tx_hash: Identifier, + masternode_voting_key: &IdentityPublicKey, + nonce: IdentityNonce, + platform_version: &PlatformVersion, + feature_version: Option, + ) -> Result { + match feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .masternode_vote_state_transition + .default_current_version, + ) { + 0 => Ok(MasternodeVoteTransitionV0::try_from_vote_with_signer( + vote, + signer, + pro_tx_hash, + masternode_voting_key, + nonce, + )?), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "MasternodeVoteTransition::try_from_vote_with_signer".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/methods/v0/mod.rs new file mode 100644 index 00000000000..f6fde73f8e5 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/methods/v0/mod.rs @@ -0,0 +1,35 @@ +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::IdentityPublicKey; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] +use crate::voting::votes::Vote; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::{FeatureVersion, PlatformVersion}; + +pub trait MasternodeVoteTransitionMethodsV0 { + #[cfg(feature = "state-transition-signing")] + fn try_from_vote_with_signer( + vote: Vote, + signer: &S, + pro_tx_hash: Identifier, + masternode_voting_key: &IdentityPublicKey, + nonce: IdentityNonce, + platform_version: &PlatformVersion, + feature_version: Option, + ) -> Result; + + /// Get State Transition Type + fn get_type() -> StateTransitionType { + StateTransitionType::MasternodeVote + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/mod.rs new file mode 100644 index 00000000000..a1b75dae203 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/mod.rs @@ -0,0 +1,90 @@ +pub mod accessors; +pub mod fields; +mod identity_signed; +#[cfg(feature = "state-transition-json-conversion")] +mod json_conversion; +pub mod methods; +mod state_transition_like; +pub mod v0; +#[cfg(feature = "state-transition-value-conversion")] +mod value_conversion; +mod version; + +use crate::state_transition::masternode_vote_transition::fields::property_names::PRO_TX_HASH; +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0Signable; +use crate::state_transition::StateTransitionFieldTypes; + +use crate::identity::state_transition::OptionallyAssetLockProved; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use derive_more::From; +use fields::*; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; +use platform_version::version::PlatformVersion; +use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +pub type MasternodeVoteTransitionLatest = MasternodeVoteTransitionV0; + +#[derive( + Debug, + Clone, + Encode, + Decode, + PlatformDeserialize, + PlatformSerialize, + PlatformSignable, + PlatformVersioned, + From, + PartialEq, +)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(tag = "$version") +)] +#[platform_serialize(unversioned)] //versioned directly, no need to use platform_version +#[platform_version_path_bounds( + "dpp.state_transition_serialization_versions.masternode_vote_state_transition" +)] +pub enum MasternodeVoteTransition { + #[cfg_attr(feature = "state-transition-serde-conversion", serde(rename = "0"))] + V0(MasternodeVoteTransitionV0), +} + +impl MasternodeVoteTransition { + pub fn default_versioned(platform_version: &PlatformVersion) -> Result { + match platform_version + .dpp + .identity_versions + .identity_structure_version + { + 0 => Ok(MasternodeVoteTransition::V0( + MasternodeVoteTransitionV0::default(), + )), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "MasternodeVoteTransitionV0::default_versioned".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} + +impl OptionallyAssetLockProved for MasternodeVoteTransition {} + +impl StateTransitionFieldTypes for MasternodeVoteTransition { + fn signature_property_paths() -> Vec<&'static str> { + vec![SIGNATURE] + } + + fn identifiers_property_paths() -> Vec<&'static str> { + vec![PRO_TX_HASH] + } + + fn binary_property_paths() -> Vec<&'static str> { + vec![] + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/state_transition_like.rs new file mode 100644 index 00000000000..b08fec4d3fe --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/state_transition_like.rs @@ -0,0 +1,70 @@ +use crate::prelude::UserFeeIncrease; +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use crate::state_transition::{StateTransitionLike, StateTransitionType}; +use crate::version::FeatureVersion; +use platform_value::{BinaryData, Identifier}; + +impl StateTransitionLike for MasternodeVoteTransition { + /// Returns ID of the credit_transferred contract + fn modified_data_ids(&self) -> Vec { + match self { + MasternodeVoteTransition::V0(transition) => transition.modified_data_ids(), + } + } + + fn state_transition_protocol_version(&self) -> FeatureVersion { + match self { + MasternodeVoteTransition::V0(_) => 0, + } + } + /// returns the type of State Transition + fn state_transition_type(&self) -> StateTransitionType { + match self { + MasternodeVoteTransition::V0(transition) => transition.state_transition_type(), + } + } + /// returns the signature as a byte-array + fn signature(&self) -> &BinaryData { + match self { + MasternodeVoteTransition::V0(transition) => transition.signature(), + } + } + /// set a new signature + fn set_signature(&mut self, signature: BinaryData) { + match self { + MasternodeVoteTransition::V0(transition) => transition.set_signature(signature), + } + } + + fn set_signature_bytes(&mut self, signature: Vec) { + match self { + MasternodeVoteTransition::V0(transition) => transition.set_signature_bytes(signature), + } + } + + fn owner_id(&self) -> Identifier { + match self { + MasternodeVoteTransition::V0(transition) => transition.owner_id(), + } + } + + fn unique_identifiers(&self) -> Vec { + match self { + MasternodeVoteTransition::V0(transition) => transition.unique_identifiers(), + } + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + MasternodeVoteTransition::V0(transition) => transition.user_fee_increase(), + } + } + + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + MasternodeVoteTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/identity_signed.rs new file mode 100644 index 00000000000..47531db0131 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/identity_signed.rs @@ -0,0 +1,22 @@ +use crate::identity::SecurityLevel::{CRITICAL, HIGH, MEDIUM}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::StateTransitionIdentitySigned; + +impl StateTransitionIdentitySigned for MasternodeVoteTransitionV0 { + fn signature_public_key_id(&self) -> KeyID { + self.signature_public_key_id + } + + fn set_signature_public_key_id(&mut self, key_id: KeyID) { + self.signature_public_key_id = key_id + } + + fn security_level_requirement(&self) -> Vec { + vec![CRITICAL, HIGH, MEDIUM] + } + + fn purpose_requirement(&self) -> Purpose { + Purpose::VOTING + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/json_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/json_conversion.rs new file mode 100644 index 00000000000..8bbca6c8adb --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/json_conversion.rs @@ -0,0 +1,4 @@ +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::StateTransitionJsonConvert; + +impl<'a> StateTransitionJsonConvert<'a> for MasternodeVoteTransitionV0 {} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/mod.rs new file mode 100644 index 00000000000..eac9dc34b5e --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/mod.rs @@ -0,0 +1,105 @@ +mod identity_signed; +#[cfg(feature = "state-transition-json-conversion")] +mod json_conversion; +mod state_transition_like; +mod types; +pub(super) mod v0_methods; +#[cfg(feature = "state-transition-value-conversion")] +mod value_conversion; +mod version; + +use crate::identity::KeyID; + +use crate::prelude::{Identifier, IdentityNonce}; + +use crate::protocol_error::ProtocolError; +use crate::voting::votes::Vote; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; +use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +#[derive( + Debug, + Clone, + Encode, + Decode, + PlatformSerialize, + PlatformDeserialize, + PlatformSignable, + PartialEq, +)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[platform_serialize(unversioned)] +#[derive(Default)] +pub struct MasternodeVoteTransitionV0 { + // Own ST fields + pub pro_tx_hash: Identifier, + pub voter_identity_id: Identifier, + pub vote: Vote, + pub nonce: IdentityNonce, + #[platform_signable(exclude_from_sig_hash)] + pub signature_public_key_id: KeyID, + #[platform_signable(exclude_from_sig_hash)] + pub signature: BinaryData, +} + +#[cfg(test)] +mod test { + + use crate::serialization::{PlatformDeserializable, PlatformSerializable}; + + use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; + use crate::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + use crate::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; + use crate::voting::vote_polls::VotePoll; + use crate::voting::votes::resource_vote::v0::ResourceVoteV0; + use crate::voting::votes::resource_vote::ResourceVote; + use crate::voting::votes::Vote; + use platform_value::Identifier; + use rand::Rng; + use std::fmt::Debug; + + fn test_masternode_vote_transition< + T: PlatformSerializable + PlatformDeserializable + Debug + PartialEq, + >( + transition: T, + ) where + ::Error: std::fmt::Debug, + { + let serialized = T::serialize_to_bytes(&transition).expect("expected to serialize"); + let deserialized = + T::deserialize_from_bytes(serialized.as_slice()).expect("expected to deserialize"); + assert_eq!(transition, deserialized); + } + + #[test] + fn test_masternode_vote_transition1() { + let mut rng = rand::thread_rng(); + let transition = MasternodeVoteTransitionV0 { + pro_tx_hash: Identifier::random(), + voter_identity_id: Identifier::random(), + vote: Vote::ResourceVote(ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Default::default(), + document_type_name: "hello".to_string(), + index_name: "index_1".to_string(), + index_values: vec![], + }, + ), + resource_vote_choice: ResourceVoteChoice::TowardsIdentity(Identifier::random()), + })), + nonce: 1, + signature_public_key_id: rng.gen(), + signature: [0; 65].to_vec().into(), + }; + + test_masternode_vote_transition(transition); + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/state_transition_like.rs new file mode 100644 index 00000000000..91a72646493 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/state_transition_like.rs @@ -0,0 +1,72 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; +use platform_value::BinaryData; + +use crate::prelude::UserFeeIncrease; +use crate::{ + prelude::Identifier, + state_transition::{StateTransitionLike, StateTransitionType}, +}; + +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; + +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType::MasternodeVote; +use crate::version::FeatureVersion; + +impl From for StateTransition { + fn from(value: MasternodeVoteTransitionV0) -> Self { + let masternode_vote_transition: MasternodeVoteTransition = value.into(); + masternode_vote_transition.into() + } +} + +impl StateTransitionLike for MasternodeVoteTransitionV0 { + fn state_transition_protocol_version(&self) -> FeatureVersion { + 0 + } + + /// returns the type of State Transition + fn state_transition_type(&self) -> StateTransitionType { + MasternodeVote + } + /// returns the signature as a byte-array + fn signature(&self) -> &BinaryData { + &self.signature + } + /// set a new signature + fn set_signature(&mut self, signature: BinaryData) { + self.signature = signature + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + // The user fee increase for a masternode votes is always 0 + 0 + } + + fn set_user_fee_increase(&mut self, _fee_multiplier: UserFeeIncrease) { + // Setting does nothing + } + + fn modified_data_ids(&self) -> Vec { + vec![self.voter_identity_id] + } + + fn set_signature_bytes(&mut self, signature: Vec) { + self.signature = BinaryData::new(signature) + } + + /// Get owner ID + fn owner_id(&self) -> Identifier { + self.voter_identity_id + } + + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{:x}", + BASE64_STANDARD.encode(self.pro_tx_hash), + self.nonce + )] + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/types.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/types.rs new file mode 100644 index 00000000000..da9ee6d3be1 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/types.rs @@ -0,0 +1,17 @@ +use crate::state_transition::masternode_vote_transition::fields::*; +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::StateTransitionFieldTypes; + +impl StateTransitionFieldTypes for MasternodeVoteTransitionV0 { + fn signature_property_paths() -> Vec<&'static str> { + vec![SIGNATURE] + } + + fn identifiers_property_paths() -> Vec<&'static str> { + vec![IDENTITY_ID] + } + + fn binary_property_paths() -> Vec<&'static str> { + vec![] + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..179f1c07486 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/v0_methods.rs @@ -0,0 +1,53 @@ +#[cfg(feature = "state-transition-signing")] +use crate::identifier::MasternodeIdentifiers; +#[cfg(feature = "state-transition-signing")] +use crate::identity::hash::IdentityPublicKeyHashMethodsV0; +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::{IdentityPublicKey, SecurityLevel}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] +use crate::voting::votes::Vote; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_value::Identifier; + +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; + +impl MasternodeVoteTransitionV0 { + #[cfg(feature = "state-transition-signing")] + pub fn try_from_vote_with_signer( + vote: Vote, + signer: &S, + pro_tx_hash: Identifier, + masternode_voting_key: &IdentityPublicKey, + nonce: IdentityNonce, + ) -> Result { + let voting_address = masternode_voting_key.public_key_hash()?; + let voter_identity_id = + Identifier::create_voter_identifier(pro_tx_hash.as_bytes(), &voting_address); + let masternode_vote_transition: MasternodeVoteTransition = MasternodeVoteTransitionV0 { + pro_tx_hash, + voter_identity_id, + vote, + nonce, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = masternode_vote_transition.into(); + state_transition.sign_external( + masternode_voting_key, + signer, + None:: Result>, + )?; + Ok(state_transition) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/value_conversion.rs new file mode 100644 index 00000000000..e17390a5620 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/value_conversion.rs @@ -0,0 +1,60 @@ +use std::collections::BTreeMap; + +use platform_value::{IntegerReplacementType, ReplacementType, Value}; + +use crate::{state_transition::StateTransitionFieldTypes, ProtocolError}; + +use crate::state_transition::masternode_vote_transition::fields::*; +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::StateTransitionValueConvert; + +use platform_version::version::PlatformVersion; + +impl<'a> StateTransitionValueConvert<'a> for MasternodeVoteTransitionV0 { + fn from_object( + raw_object: Value, + _platform_version: &PlatformVersion, + ) -> Result { + platform_value::from_value(raw_object).map_err(ProtocolError::ValueError) + } + + fn clean_value(value: &mut Value) -> Result<(), ProtocolError> { + value.replace_at_paths(IDENTIFIER_FIELDS, ReplacementType::Identifier)?; + value.replace_at_paths(BINARY_FIELDS, ReplacementType::BinaryBytes)?; + value.replace_integer_type_at_paths(U32_FIELDS, IntegerReplacementType::U32)?; + Ok(()) + } + + fn from_value_map( + raw_value_map: BTreeMap, + platform_version: &PlatformVersion, + ) -> Result { + let value: Value = raw_value_map.into(); + Self::from_object(value, platform_version) + } + + fn to_object(&self, skip_signature: bool) -> Result { + let mut value = platform_value::to_value(self)?; + if skip_signature { + value + .remove_values_matching_paths(Self::signature_property_paths()) + .map_err(ProtocolError::ValueError)?; + } + Ok(value) + } + + fn to_cleaned_object(&self, skip_signature: bool) -> Result { + let mut value = platform_value::to_value(self)?; + if skip_signature { + value + .remove_values_matching_paths(Self::signature_property_paths()) + .map_err(ProtocolError::ValueError)?; + } + Ok(value) + } + + // Override to_canonical_cleaned_object to manage add_public_keys individually + fn to_canonical_cleaned_object(&self, skip_signature: bool) -> Result { + self.to_cleaned_object(skip_signature) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/version.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/version.rs new file mode 100644 index 00000000000..35b2683ca28 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/v0/version.rs @@ -0,0 +1,9 @@ +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::FeatureVersioned; +use crate::version::FeatureVersion; + +impl FeatureVersioned for MasternodeVoteTransitionV0 { + fn feature_version(&self) -> FeatureVersion { + 0 + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/value_conversion.rs new file mode 100644 index 00000000000..f38aa07913b --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/value_conversion.rs @@ -0,0 +1,119 @@ +use std::collections::BTreeMap; + +use platform_value::Value; + +use crate::ProtocolError; + +use crate::state_transition::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use crate::state_transition::state_transitions::masternode_vote_transition::fields::*; +use crate::state_transition::StateTransitionValueConvert; + +use crate::serialization::ValueConvertible; +use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; +use platform_version::version::{FeatureVersion, PlatformVersion}; + +impl<'a> ValueConvertible<'a> for MasternodeVoteTransition {} + +impl<'a> StateTransitionValueConvert<'a> for MasternodeVoteTransition { + fn to_object(&self, skip_signature: bool) -> Result { + match self { + MasternodeVoteTransition::V0(transition) => { + let mut value = transition.to_object(skip_signature)?; + value.insert(STATE_TRANSITION_PROTOCOL_VERSION.to_string(), Value::U16(0))?; + Ok(value) + } + } + } + + fn to_canonical_object(&self, skip_signature: bool) -> Result { + match self { + MasternodeVoteTransition::V0(transition) => { + let mut value = transition.to_canonical_object(skip_signature)?; + value.insert(STATE_TRANSITION_PROTOCOL_VERSION.to_string(), Value::U16(0))?; + Ok(value) + } + } + } + + fn to_canonical_cleaned_object(&self, skip_signature: bool) -> Result { + match self { + MasternodeVoteTransition::V0(transition) => { + let mut value = transition.to_canonical_cleaned_object(skip_signature)?; + value.insert(STATE_TRANSITION_PROTOCOL_VERSION.to_string(), Value::U16(0))?; + Ok(value) + } + } + } + + fn to_cleaned_object(&self, skip_signature: bool) -> Result { + match self { + MasternodeVoteTransition::V0(transition) => { + let mut value = transition.to_cleaned_object(skip_signature)?; + value.insert(STATE_TRANSITION_PROTOCOL_VERSION.to_string(), Value::U16(0))?; + Ok(value) + } + } + } + + fn from_object( + mut raw_object: Value, + platform_version: &PlatformVersion, + ) -> Result { + let version: FeatureVersion = raw_object + .remove_optional_integer(STATE_TRANSITION_PROTOCOL_VERSION) + .map_err(ProtocolError::ValueError)? + .unwrap_or({ + platform_version + .dpp + .state_transition_serialization_versions + .contract_create_state_transition + .default_current_version + }); + + match version { + 0 => Ok(MasternodeVoteTransitionV0::from_object(raw_object, platform_version)?.into()), + n => Err(ProtocolError::UnknownVersionError(format!( + "Unknown MasternodeVoteTransition version {n}" + ))), + } + } + + fn from_value_map( + mut raw_value_map: BTreeMap, + platform_version: &PlatformVersion, + ) -> Result { + let version: FeatureVersion = raw_value_map + .remove_optional_integer(STATE_TRANSITION_PROTOCOL_VERSION) + .map_err(ProtocolError::ValueError)? + .unwrap_or({ + platform_version + .dpp + .state_transition_serialization_versions + .contract_create_state_transition + .default_current_version + }); + + match version { + 0 => Ok( + MasternodeVoteTransitionV0::from_value_map(raw_value_map, platform_version)?.into(), + ), + n => Err(ProtocolError::UnknownVersionError(format!( + "Unknown MasternodeVoteTransition version {n}" + ))), + } + } + + fn clean_value(value: &mut Value) -> Result<(), ProtocolError> { + let version: u8 = value + .get_integer(STATE_TRANSITION_PROTOCOL_VERSION) + .map_err(ProtocolError::ValueError)?; + + match version { + 0 => MasternodeVoteTransitionV0::clean_value(value), + n => Err(ProtocolError::UnknownVersionError(format!( + "Unknown MasternodeVoteTransition version {n}" + ))), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/version.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/version.rs new file mode 100644 index 00000000000..40a720b5a7b --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/masternode_vote_transition/version.rs @@ -0,0 +1,11 @@ +use crate::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use crate::state_transition::FeatureVersioned; +use crate::version::FeatureVersion; + +impl FeatureVersioned for MasternodeVoteTransition { + fn feature_version(&self) -> FeatureVersion { + match self { + MasternodeVoteTransition::V0(v0) => v0.feature_version(), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/mod.rs index 97956e466dd..bccd0766098 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/mod.rs @@ -4,4 +4,5 @@ pub mod identity_credit_transfer_transition; pub mod identity_credit_withdrawal_transition; pub mod identity_topup_transition; pub mod identity_update_transition; +pub mod masternode_vote_transition; pub mod public_key_in_creation; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs index 6e43c60aeb6..9be50be2d67 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs @@ -40,6 +40,8 @@ pub trait IdentityPublicKeyInCreationV0Setters { fn set_security_level(&mut self, security_level: SecurityLevel); + fn set_contract_bounds(&mut self, contract_bounds: Option); + fn set_read_only(&mut self, read_only: bool); } @@ -80,6 +82,12 @@ impl IdentityPublicKeyInCreationV0Setters for IdentityPublicKeyInCreation { } } + fn set_contract_bounds(&mut self, contract_bounds: Option) { + match self { + IdentityPublicKeyInCreation::V0(v0) => v0.contract_bounds = contract_bounds, + } + } + fn set_read_only(&mut self, read_only: bool) { match self { IdentityPublicKeyInCreation::V0(v0) => v0.read_only = read_only, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs index 8e79c3037f3..2c8d2fcaa48 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs @@ -5,6 +5,7 @@ use std::collections::HashMap; impl IdentityPublicKeyInCreation { /// Find duplicate key ids + #[inline(always)] pub(super) fn duplicated_key_ids_witness_v0( public_keys: &[IdentityPublicKeyInCreation], ) -> Vec { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs index 0d180f6121e..99ee267e7ad 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs @@ -4,6 +4,7 @@ use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation use std::collections::HashMap; impl IdentityPublicKeyInCreation { + #[inline(always)] pub(super) fn duplicated_keys_witness_v0( public_keys: &[IdentityPublicKeyInCreation], ) -> Vec { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs index 99fbe9a9581..9aa0eea8632 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs @@ -6,6 +6,7 @@ use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation use crate::{BlsModule, ProtocolError}; impl IdentityPublicKeyInCreation { + #[inline(always)] pub(super) fn from_public_key_signed_with_private_key_v0( public_key: IdentityPublicKey, state_transition_bytes: &[u8], diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs index 697425d22f7..69e746b3661 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs @@ -2,18 +2,17 @@ mod v0; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::ProtocolError; -use platform_version::version::PlatformVersion; impl IdentityPublicKeyInCreation { pub fn hash(&self) -> Result<[u8; 20], ProtocolError> { match self { - IdentityPublicKeyInCreation::V0(v0) => self.hash_v0(), + IdentityPublicKeyInCreation::V0(_v0) => self.hash_v0(), } } pub fn hash_as_vec(&self) -> Result, ProtocolError> { match self { - IdentityPublicKeyInCreation::V0(v0) => self.hash_v0().map(|hash| hash.to_vec()), + IdentityPublicKeyInCreation::V0(_v0) => self.hash_v0().map(|hash| hash.to_vec()), } } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs index 1892b3be624..2d4a33d3a75 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs @@ -2,18 +2,11 @@ use crate::identity::identity_public_key::methods::hash::IdentityPublicKeyHashMe use crate::identity::IdentityPublicKey; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::ProtocolError; -use std::convert::TryInto; impl IdentityPublicKeyInCreation { /// Get the original public key hash + #[inline(always)] pub(super) fn hash_v0(&self) -> Result<[u8; 20], ProtocolError> { - Into::::into(self.clone()) - .hash()? - .try_into() - .map_err(|_| { - ProtocolError::CorruptedCodeExecution( - "hash should always output 20 bytes".to_string(), - ) - }) + Into::::into(self.clone()).public_key_hash() } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs index f186a2e424d..e002fffb270 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs @@ -8,6 +8,7 @@ pub mod v0; impl IdentityPublicKeyInCreation { pub fn validate_identity_public_keys_structure( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], + in_create_identity: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -18,6 +19,7 @@ impl IdentityPublicKeyInCreation { { 0 => Self::validate_identity_public_keys_structure_v0( identity_public_keys_with_witness, + in_create_identity, platform_version, ), version => Err(ProtocolError::UnknownVersionMismatch { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs index 5c54f71e172..81b489092b5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs @@ -1,11 +1,12 @@ use crate::consensus::basic::identity::{ - DuplicatedIdentityPublicKeyIdBasicError, InvalidIdentityPublicKeySecurityLevelError, + DuplicatedIdentityPublicKeyBasicError, DuplicatedIdentityPublicKeyIdBasicError, + InvalidIdentityPublicKeySecurityLevelError, MissingMasterPublicKeyError, + TooManyMasterPublicKeyError, }; use crate::consensus::basic::BasicError; use lazy_static::lazy_static; use std::collections::HashMap; -use crate::consensus::state::identity::duplicated_identity_public_key_state_error::DuplicatedIdentityPublicKeyStateError; use crate::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; use crate::consensus::state::state_error::StateError; @@ -17,8 +18,6 @@ use crate::validation::SimpleConsensusValidationResult; use crate::ProtocolError; use platform_version::version::PlatformVersion; -const MAX_PUBLIC_KEYS: usize = 10; - lazy_static! { static ref ALLOWED_SECURITY_LEVELS: HashMap> = { let mut m = HashMap::new(); @@ -33,7 +32,7 @@ lazy_static! { ); m.insert(Purpose::ENCRYPTION, vec![SecurityLevel::MEDIUM]); m.insert(Purpose::DECRYPTION, vec![SecurityLevel::MEDIUM]); - m.insert(Purpose::WITHDRAW, vec![SecurityLevel::CRITICAL]); + m.insert(Purpose::TRANSFER, vec![SecurityLevel::CRITICAL]); m }; } @@ -41,14 +40,28 @@ impl IdentityPublicKeyInCreation { /// This validation will validate the count of new keys, that there are no duplicates either by /// id or by data. This is done before signature and state validation to remove potential /// attack vectors. + #[inline(always)] pub(super) fn validate_identity_public_keys_structure_v0( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], + in_create_identity: bool, platform_version: &PlatformVersion, ) -> Result { - if identity_public_keys_with_witness.len() > MAX_PUBLIC_KEYS { + if identity_public_keys_with_witness.len() + > platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize + { return Ok(SimpleConsensusValidationResult::new_with_error( StateError::MaxIdentityPublicKeyLimitReachedError( - MaxIdentityPublicKeyLimitReachedError::new(MAX_PUBLIC_KEYS), + MaxIdentityPublicKeyLimitReachedError::new( + platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize, + ), ) .into(), )); @@ -75,13 +88,33 @@ impl IdentityPublicKeyInCreation { )?; if !duplicated_key_ids.is_empty() { return Ok(SimpleConsensusValidationResult::new_with_error( - StateError::DuplicatedIdentityPublicKeyStateError( - DuplicatedIdentityPublicKeyStateError::new(duplicated_key_ids), + BasicError::DuplicatedIdentityPublicKeyBasicError( + DuplicatedIdentityPublicKeyBasicError::new(duplicated_key_ids), ) .into(), )); } + if in_create_identity { + // We should check that we are only adding one master authentication key + + let master_key_count = identity_public_keys_with_witness + .iter() + .filter(|key| key.security_level() == SecurityLevel::MASTER) + .count(); + if master_key_count == 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::MissingMasterPublicKeyError(MissingMasterPublicKeyError::new()) + .into(), + )); + } else if master_key_count > 1 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::TooManyMasterPublicKeyError(TooManyMasterPublicKeyError::new()) + .into(), + )); + } + } + // We should check all the security levels let validation_errors = identity_public_keys_with_witness .iter() diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs index 93f9d4f3762..63bd4949c68 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs @@ -7,6 +7,7 @@ use derive_more::From; use platform_serialization_derive::PlatformSignable; use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub mod accessors; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs index 1b9e9c2e0e6..8170f2a7b2a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs @@ -103,6 +103,10 @@ impl IdentityPublicKeyInCreationV0Setters for IdentityPublicKeyInCreationV0 { self.security_level = security_level; } + fn set_contract_bounds(&mut self, contract_bounds: Option) { + self.contract_bounds = contract_bounds; + } + fn set_purpose(&mut self, purpose: Purpose) { self.purpose = purpose; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/mod.rs index 92b259f4950..7de5b5a368b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/mod.rs @@ -2,6 +2,7 @@ mod common_fields; mod contract; pub(crate) mod document; pub mod identity; +pub mod signable_bytes_hasher; pub use contract::*; pub use document::*; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/signable_bytes_hasher.rs b/packages/rs-dpp/src/state_transition/state_transitions/signable_bytes_hasher.rs new file mode 100644 index 00000000000..d644279e58c --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/signable_bytes_hasher.rs @@ -0,0 +1,48 @@ +use crate::util::hash::hash_double; +use platform_value::Bytes32; + +/// This is a structure to hash signable bytes when we are not sure if we will need the hashing +#[derive(Debug, Clone)] +pub enum SignableBytesHasher { + Bytes(Vec), + PreHashed(Bytes32), +} + +impl SignableBytesHasher { + pub fn into_hashed_bytes(self) -> Bytes32 { + match self { + SignableBytesHasher::Bytes(signable_bytes) => hash_double(signable_bytes).into(), + SignableBytesHasher::PreHashed(pre_hashed) => pre_hashed, + } + } + + pub fn to_hashed_bytes(&self) -> Bytes32 { + match self { + SignableBytesHasher::Bytes(signable_bytes) => hash_double(signable_bytes).into(), + SignableBytesHasher::PreHashed(pre_hashed) => *pre_hashed, + } + } + + pub fn hash_bytes(&mut self) -> Bytes32 { + match self { + SignableBytesHasher::Bytes(signable_bytes) => { + let bytes_32: Bytes32 = hash_double(signable_bytes).into(); + *self = SignableBytesHasher::PreHashed(bytes_32); + bytes_32 + } + SignableBytesHasher::PreHashed(pre_hashed) => *pre_hashed, + } + } + + pub fn hash_bytes_and_check_if_vec_contains(&mut self, vec: &[Bytes32]) -> bool { + match self { + SignableBytesHasher::Bytes(signable_bytes) => { + let bytes_32: Bytes32 = hash_double(signable_bytes).into(); + let contains = vec.contains(&bytes_32); + *self = SignableBytesHasher::PreHashed(bytes_32); + contains + } + SignableBytesHasher::PreHashed(pre_hashed) => vec.contains(pre_hashed), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs b/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs index 4b19b3cda40..c81029a7fe1 100644 --- a/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs @@ -1,18 +1,31 @@ -use anyhow::anyhow; -use dashcore::secp256k1::{PublicKey as RawPublicKey, SecretKey as RawSecretKey}; - +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use crate::consensus::signature::{ InvalidSignaturePublicKeySecurityLevelError, PublicKeyIsDisabledError, }; +use anyhow::anyhow; +use dashcore::secp256k1::{PublicKey as RawPublicKey, SecretKey as RawSecretKey}; #[cfg(feature = "state-transition-validation")] use crate::state_transition::errors::WrongPublicKeyPurposeError; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use crate::state_transition::StateTransitionLike; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::identity::IdentityPublicKey; +use crate::identity::Purpose; use crate::{ - identity::{IdentityPublicKey, KeyID, Purpose, SecurityLevel}, + identity::{KeyID, SecurityLevel}, prelude::*, }; @@ -45,9 +58,9 @@ pub trait StateTransitionIdentitySigned: StateTransitionLike { )); } - if public_key.purpose() != Purpose::AUTHENTICATION { + if public_key.purpose() != self.purpose_requirement() { return Err(ProtocolError::WrongPublicKeyPurposeError( - WrongPublicKeyPurposeError::new(public_key.purpose(), Purpose::AUTHENTICATION), + WrongPublicKeyPurposeError::new(public_key.purpose(), self.purpose_requirement()), )); } Ok(()) @@ -73,6 +86,13 @@ pub trait StateTransitionIdentitySigned: StateTransitionLike { /// Returns minimal key security level that can be used to sign this ST. /// Override this method if the ST requires a different security level. fn security_level_requirement(&self) -> Vec; + + /// The purpose requirement for the signing key + /// The default is authentication + /// However for Withdrawals and Fund Transfers the requirement is TRANSFER + fn purpose_requirement(&self) -> Purpose { + Purpose::AUTHENTICATION + } } pub fn get_compressed_public_ec_key(private_key: &[u8]) -> Result<[u8; 33], ProtocolError> { diff --git a/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs b/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs index 28d53f16dc7..4884fd46b68 100644 --- a/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use platform_value::BinaryData; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, UserFeeIncrease}; use crate::version::FeatureVersion; use crate::state_transition::StateTransitionType; @@ -11,13 +11,16 @@ use crate::state_transition::{StateTransition, StateTransitionFieldTypes}; pub const DOCUMENT_TRANSITION_TYPES: [StateTransitionType; 1] = [StateTransitionType::DocumentsBatch]; -pub const IDENTITY_TRANSITION_TYPE: [StateTransitionType; 4] = [ +pub const IDENTITY_TRANSITION_TYPE: [StateTransitionType; 5] = [ StateTransitionType::IdentityCreate, StateTransitionType::IdentityTopUp, StateTransitionType::IdentityUpdate, StateTransitionType::IdentityCreditTransfer, + StateTransitionType::IdentityCreditWithdrawal, ]; +pub const VOTING_TRANSITION_TYPE: [StateTransitionType; 1] = [StateTransitionType::MasternodeVote]; + pub const DATA_CONTRACT_TRANSITION_TYPES: [StateTransitionType; 2] = [ StateTransitionType::DataContractCreate, StateTransitionType::DataContractUpdate, @@ -36,6 +39,10 @@ pub trait StateTransitionLike: fn signature(&self) -> &BinaryData; /// set a new signature fn set_signature(&mut self, signature: BinaryData); + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease; + /// set a fee multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease); /// get modified ids list fn modified_data_ids(&self) -> Vec; @@ -52,8 +59,17 @@ pub trait StateTransitionLike: IDENTITY_TRANSITION_TYPE.contains(&self.state_transition_type()) } + /// return true if state transition is a voting state transition + fn is_voting_state_transition(&self) -> bool { + VOTING_TRANSITION_TYPE.contains(&self.state_transition_type()) + } + fn set_signature_bytes(&mut self, signature: Vec); /// Get owner ID fn owner_id(&self) -> Identifier; + + /// unique identifiers for the state transition + /// This is often only one String except in the case of a documents batch state transition + fn unique_identifiers(&self) -> Vec; } diff --git a/packages/rs-dpp/src/system_data_contracts.rs b/packages/rs-dpp/src/system_data_contracts.rs index 7857cf112a1..dab3df0c552 100644 --- a/packages/rs-dpp/src/system_data_contracts.rs +++ b/packages/rs-dpp/src/system_data_contracts.rs @@ -5,18 +5,21 @@ use std::collections::{BTreeMap, BTreeSet}; use crate::data_contract::accessors::v0::DataContractV0Setters; pub use data_contracts::*; +use platform_version::version::PlatformVersion; fn create_data_contract( factory: &DataContractFactory, system_contract: SystemDataContract, + platform_version: &PlatformVersion, ) -> Result { let DataContractSource { id_bytes, owner_id_bytes, + version, definitions, document_schemas, } = system_contract - .source() + .source(platform_version) .map_err(|e| ProtocolError::Generic(e.to_string()))?; let id = Identifier::from(id_bytes); @@ -24,35 +27,37 @@ fn create_data_contract( let mut data_contract = factory.create_with_value_config( owner_id, + 0, document_schemas.into(), None, definitions.map(|def| def.into()), )?; data_contract.data_contract_mut().set_id(id); + data_contract.data_contract_mut().set_version(version); Ok(data_contract.data_contract_owned()) } pub fn load_system_data_contract( system_contract: SystemDataContract, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let factory = DataContractFactory::new(protocol_version, None)?; + let factory = DataContractFactory::new(platform_version.protocol_version)?; - create_data_contract(&factory, system_contract) + create_data_contract(&factory, system_contract, platform_version) } pub fn load_system_data_contracts( system_contracts: BTreeSet, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result, ProtocolError> { - let factory = DataContractFactory::new(protocol_version, None)?; + let factory = DataContractFactory::new(platform_version.protocol_version)?; system_contracts .into_iter() .map(|system_contract| { - let data_contract = create_data_contract(&factory, system_contract)?; + let data_contract = create_data_contract(&factory, system_contract, platform_version)?; Ok((system_contract, data_contract)) }) diff --git a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs index 078d486e86e..5a0320c2089 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs @@ -4,21 +4,26 @@ use crate::{ }; use crate::data_contract::created_data_contract::CreatedDataContract; +use crate::prelude::IdentityNonce; use data_contracts::SystemDataContract; +use platform_version::version::PlatformVersion; pub fn get_dashpay_contract_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { - let factory = - DataContractFactory::new(protocol_version, None).expect("expected to create factory"); - let dpns_schema = SystemDataContract::Dashpay - .source() + let factory = DataContractFactory::new(protocol_version).expect("expected to create factory"); + + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + + let dashpay_schema = SystemDataContract::Dashpay + .source(platform_version) .expect("DPNS contract must be defined") .document_schemas; let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); factory - .create_with_value_config(owner_id, dpns_schema.into(), None, None) + .create_with_value_config(owner_id, identity_nonce, dashpay_schema.into(), None, None) .expect("data in fixture should be correct") } diff --git a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs index 61d3ac61732..f018d69a588 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs @@ -6,16 +6,21 @@ use crate::{ use crate::data_contract::config::v0::DataContractConfigV0; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::prelude::IdentityNonce; use data_contracts::SystemDataContract; +use platform_version::version::PlatformVersion; pub fn get_dashpay_contract_with_generalized_encryption_key_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { - let factory = - DataContractFactory::new(protocol_version, None).expect("expected to create factory"); + let factory = DataContractFactory::new(protocol_version).expect("expected to create factory"); + + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + let dpns_schema = SystemDataContract::Dashpay - .source() + .source(platform_version) .expect("DPNS contract must be defined") .document_schemas; let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); @@ -23,6 +28,7 @@ pub fn get_dashpay_contract_with_generalized_encryption_key_fixture( factory .create( owner_id, + identity_nonce, dpns_schema.into(), Some( DataContractConfigV0 { diff --git a/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs index 78d33da4ae8..7c8fe9a581e 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs @@ -9,14 +9,17 @@ use super::get_dashpay_contract_fixture; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; +use crate::prelude::IdentityNonce; pub fn get_contact_request_document_fixture( owner_id: Option, + identity_nonce: IdentityNonce, additional_data: Option, protocol_version: u32, ) -> Document { let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); - let data_contract = get_dashpay_contract_fixture(None, protocol_version).data_contract_owned(); + let data_contract = + get_dashpay_contract_fixture(None, identity_nonce, protocol_version).data_contract_owned(); let factory = DocumentFactory::new(protocol_version) .expect("expected to create factory for get_contact_request_document_fixture"); @@ -41,11 +44,13 @@ pub fn get_contact_request_document_fixture( #[cfg(feature = "extended-document")] pub fn get_contact_request_extended_document_fixture( owner_id: Option, + identity_nonce: IdentityNonce, additional_data: Option, protocol_version: u32, ) -> ExtendedDocument { let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); - let data_contract = get_dashpay_contract_fixture(None, protocol_version).data_contract_owned(); + let data_contract = + get_dashpay_contract_fixture(None, identity_nonce, protocol_version).data_contract_owned(); let factory = DocumentFactory::new(protocol_version).expect("expected document factory"); diff --git a/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs b/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs index 4770ebede1b..b53a0786755 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs @@ -8,6 +8,7 @@ use crate::{ pub fn get_data_contract_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { let defs = platform_value!( @@ -284,12 +285,11 @@ pub fn get_data_contract_fixture( } }); - let factory = - DataContractFactory::new(protocol_version, None).expect("expected to create a factory"); + let factory = DataContractFactory::new(protocol_version).expect("expected to create a factory"); let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); factory - .create_with_value_config(owner_id, documents, None, Some(defs)) + .create_with_value_config(owner_id, identity_nonce, documents, None, Some(defs)) .expect("data in fixture should be correct") } diff --git a/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs index 5b4cd5709e5..dfb531b5546 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs @@ -1,7 +1,8 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::document_factory::DocumentFactory; -use platform_value::Bytes32; +use platform_value::{Bytes32, Identifier}; use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; use crate::document::Document; use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; @@ -9,8 +10,6 @@ use crate::state_transition::documents_batch_transition::document_transition::Do use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; -use super::get_data_contract_fixture; - pub fn get_document_transitions_fixture<'a>( documents: impl IntoIterator< Item = ( @@ -18,13 +17,14 @@ pub fn get_document_transitions_fixture<'a>( Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Vec { let protocol_version = PlatformVersion::latest().protocol_version; let document_factory = DocumentFactory::new(protocol_version).expect("expected to get document factory"); document_factory - .create_state_transition(documents) + .create_state_transition(documents, nonce_counter) .expect("the transitions should be created") .transitions() .to_owned() diff --git a/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs index 8af470b1487..647203d72ea 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs @@ -198,7 +198,7 @@ pub fn get_withdrawal_document_fixture( }; let document_type = data_contract.document_type_for_name( - data_contracts::withdrawals_contract::document_types::withdrawal::NAME, + data_contracts::withdrawals_contract::v1::document_types::withdrawal::NAME, )?; let properties = data @@ -211,6 +211,8 @@ pub fn get_withdrawal_document_fixture( document_type.create_document_with_prevalidated_properties( id, owner_id, + 0, + 0, properties, platform_version, ) diff --git a/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs b/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs index 3ac0e29d57d..56a36dd445d 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs @@ -1,6 +1,5 @@ use data_contracts::{DataContractSource, SystemDataContract}; -use platform_value::platform_value; -use serde_json::json; +use platform_version::version::PlatformVersion; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::DataContractFactory; @@ -9,22 +8,31 @@ use crate::tests::utils::generate_random_identifier_struct; pub fn get_dpns_data_contract_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { - let factory = DataContractFactory::new(protocol_version, None) + let factory = DataContractFactory::new(protocol_version) .expect("expected to create a factory for get_dpns_data_contract_fixture"); let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected to get platform version"); + let DataContractSource { - mut document_schemas, - .. + document_schemas, .. } = SystemDataContract::DPNS - .source() + .source(platform_version) .expect("should return DPNS data contract source"); //Todo create config factory - .create_with_value_config(owner_id, document_schemas.into(), None, None) + .create_with_value_config( + owner_id, + identity_nonce, + document_schemas.into(), + None, + None, + ) .expect("data in fixture should be correct") } diff --git a/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs index ab9b000eb73..d68f1d0842a 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs @@ -11,11 +11,13 @@ use super::get_dpns_data_contract_fixture; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; +use crate::prelude::IdentityNonce; use crate::util::strings::convert_to_homograph_safe_chars; pub struct ParentDocumentOptions { pub label: String, pub owner_id: Identifier, + pub identity_nonce: IdentityNonce, } impl Default for ParentDocumentOptions { @@ -23,6 +25,7 @@ impl Default for ParentDocumentOptions { Self { label: String::from("Parent"), owner_id: generate_random_identifier_struct(), + identity_nonce: 0, } } } @@ -31,7 +34,11 @@ pub fn get_dpns_parent_document_fixture( options: ParentDocumentOptions, protocol_version: u32, ) -> Document { - let data_contract = get_dpns_data_contract_fixture(Some(options.owner_id), protocol_version); + let data_contract = get_dpns_data_contract_fixture( + Some(options.owner_id), + options.identity_nonce, + protocol_version, + ); let document_factory = DocumentFactory::new(protocol_version).expect("expected to get document factory"); let mut pre_order_salt = [0u8; 32]; @@ -79,7 +86,11 @@ pub fn get_dpns_parent_extended_document_fixture( options: ParentDocumentOptions, protocol_version: u32, ) -> ExtendedDocument { - let data_contract = get_dpns_data_contract_fixture(Some(options.owner_id), protocol_version); + let data_contract = get_dpns_data_contract_fixture( + Some(options.owner_id), + options.identity_nonce, + protocol_version, + ); let document_factory = DocumentFactory::new(protocol_version).expect("expected to get document factory"); let mut pre_order_salt = [0u8; 32]; diff --git a/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs index b2a93207804..65f4df81f28 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs @@ -40,7 +40,6 @@ pub fn get_identity_update_transition_fixture( } .into()], disable_public_keys: vec![0], - public_keys_disabled_at: Some(1234567), ..Default::default() } .into(), diff --git a/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs index 66b50f6df10..b6f0ae7cefa 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs @@ -8,14 +8,19 @@ use crate::{ }; use data_contracts::SystemDataContract; use platform_value::platform_value; +use platform_version::version::PlatformVersion; pub fn get_masternode_reward_shares_documents_fixture( protocol_version: u32, ) -> (Vec, DataContract) { let owner_id = generate_random_identifier_struct(); let pay_to_id = generate_random_identifier_struct(); + + let platform_version = + PlatformVersion::get(protocol_version).expect("expected to get platform version"); + let data_contract = - load_system_data_contract(SystemDataContract::MasternodeRewards, protocol_version) + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) .expect("should load masternode rewards contract"); let factory = DocumentFactory::new(protocol_version).expect("expected to make factory"); @@ -37,7 +42,9 @@ pub fn get_masternode_reward_shares_documents_fixture( } pub fn get_masternode_reward_shares_data_contract_fixture(protocol_version: u32) -> DataContract { - load_system_data_contract(SystemDataContract::MasternodeRewards, protocol_version) + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) .expect("should load masternode rewards contract") } @@ -45,10 +52,12 @@ pub fn get_masternode_reward_shares_data_contract_fixture(protocol_version: u32) pub fn get_masternode_reward_shares_extended_documents_fixture( protocol_version: u32, ) -> (Vec, DataContract) { + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + let owner_id = generate_random_identifier_struct(); let pay_to_id = generate_random_identifier_struct(); let data_contract = - load_system_data_contract(SystemDataContract::MasternodeRewards, protocol_version) + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) .expect("should load masternode rewards contract"); let factory = DocumentFactory::new(protocol_version).expect("expected to make factory"); diff --git a/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs b/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs index 0e4c03dbeb2..e46fe4009c8 100644 --- a/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs @@ -11,7 +11,7 @@ use platform_value::string_encoding::{decode, Encoding}; //[198, 23, 40, 120, 58, 93, 0, 165, 27, 49, 4, 117, 107, 204, 67, 46, 164, 216, 230, 135, 201, 92, 31, 155, 62, 131, 211, 177, 139, 175, 163, 237] pub fn identity_create_transition_fixture(one_time_private_key: Option) -> Value { - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key, None); platform_value!({ "protocolVersion": version::LATEST_VERSION, diff --git a/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs b/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs index 5d88046a632..6573cd74d0c 100644 --- a/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs @@ -9,7 +9,7 @@ use crate::version; //[198, 23, 40, 120, 58, 93, 0, 165, 27, 49, 4, 117, 107, 204, 67, 46, 164, 216, 230, 135, 201, 92, 31, 155, 62, 131, 211, 177, 139, 175, 163, 237] pub fn identity_topup_transition_fixture(one_time_private_key: Option) -> Value { - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key, None); platform_value!({ "protocolVersion": version::LATEST_VERSION, "type": StateTransitionType::IdentityTopUp as u8, diff --git a/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs b/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs index 9a1a627f0bf..f00af679eda 100644 --- a/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs @@ -2,7 +2,8 @@ use std::str::FromStr; use dashcore::bls_sig_utils::BLSSignature; use dashcore::hash_types::CycleHash; -use dashcore::hashes::Hash; + +use crate::balances::credits::Duffs; use dashcore::secp256k1::rand::thread_rng; use dashcore::secp256k1::Secp256k1; use dashcore::transaction::special_transaction::asset_lock::AssetLockPayload; @@ -13,15 +14,15 @@ use dashcore::{ }; use crate::identity::state_transition::asset_lock_proof::{AssetLockProof, InstantAssetLockProof}; -use crate::util::vec::hex_to_array; //3bufpwQjL5qsvuP4fmCKgXJrKG852DDMYfi9J6XKqPAT //[198, 23, 40, 120, 58, 93, 0, 165, 27, 49, 4, 117, 107, 204, 67, 46, 164, 216, 230, 135, 201, 92, 31, 155, 62, 131, 211, 177, 139, 175, 163, 237] pub fn raw_instant_asset_lock_proof_fixture( one_time_private_key: Option, + amount: Option, ) -> InstantAssetLockProof { - let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key); + let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key, amount); let instant_lock = instant_asset_lock_is_lock_fixture(transaction.txid()); @@ -30,8 +31,9 @@ pub fn raw_instant_asset_lock_proof_fixture( pub fn instant_asset_lock_proof_fixture( one_time_private_key: Option, + amount: Option, ) -> AssetLockProof { - let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key); + let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key, amount); let instant_lock = instant_asset_lock_is_lock_fixture(transaction.txid()); @@ -42,6 +44,7 @@ pub fn instant_asset_lock_proof_fixture( pub fn instant_asset_lock_proof_transaction_fixture( one_time_private_key: Option, + amount: Option, ) -> Transaction { let mut rng = thread_rng(); let secp = Secp256k1::new(); @@ -75,12 +78,12 @@ pub fn instant_asset_lock_proof_transaction_fixture( let one_time_key_hash = one_time_public_key.pubkey_hash(); let funding_output = TxOut { - value: 100000000, // 1 Dash + value: amount.unwrap_or(100000000), // 1 Dash script_pubkey: ScriptBuf::new_p2pkh(&one_time_key_hash), }; let burn_output = TxOut { - value: 100000000, // 1 Dash + value: amount.unwrap_or(100000000), // 1 Dash script_pubkey: ScriptBuf::new_op_return(&[]), }; diff --git a/packages/rs-dpp/src/tests/fixtures/mod.rs b/packages/rs-dpp/src/tests/fixtures/mod.rs index 7d999752c4e..60b5cd4dfe2 100644 --- a/packages/rs-dpp/src/tests/fixtures/mod.rs +++ b/packages/rs-dpp/src/tests/fixtures/mod.rs @@ -7,7 +7,7 @@ pub use get_document_transitions_fixture::*; pub use get_documents_fixture::*; pub use get_dpns_data_contract::*; pub use get_dpns_document_fixture::*; -pub use get_dpp::*; + #[cfg(feature = "state-transitions")] pub use get_identity_update_transition_fixture::*; #[cfg(feature = "state-transitions")] @@ -29,8 +29,6 @@ mod get_document_transitions_fixture; pub use get_masternode_reward_shares_documents_fixture::*; -pub use get_documents_fixture::*; - mod get_dashpay_contract_fixture; mod get_dashpay_contract_with_generalized_encryption_key_fixture; mod get_data_contract; diff --git a/packages/rs-dpp/src/tests/json_document.rs b/packages/rs-dpp/src/tests/json_document.rs index 9fb9de83bc6..d0b80a33585 100644 --- a/packages/rs-dpp/src/tests/json_document.rs +++ b/packages/rs-dpp/src/tests/json_document.rs @@ -8,7 +8,7 @@ use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0}; -use crate::prelude::DataContract; +use crate::prelude::{DataContract, IdentityNonce}; #[cfg(feature = "data-contract-cbor-conversion")] use crate::util::cbor_serializer::serializable_value_to_cbor; use crate::version::PlatformVersion; @@ -65,12 +65,12 @@ pub fn json_document_to_cbor( #[cfg(feature = "data-contract-json-conversion")] pub fn json_document_to_contract( path: impl AsRef, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let value = json_document_to_json_value(path)?; - DataContract::from_json(value, validate, platform_version) + DataContract::from_json(value, full_validation, platform_version) } #[cfg(all( @@ -80,14 +80,15 @@ pub fn json_document_to_contract( /// Reads a JSON file and converts it a contract. pub fn json_document_to_created_contract( path: impl AsRef, - validate: bool, + identity_nonce: IdentityNonce, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { - let data_contract = json_document_to_contract(path, validate, platform_version)?; + let data_contract = json_document_to_contract(path, full_validation, platform_version)?; Ok(CreatedDataContractV0 { data_contract, - entropy_used: Default::default(), + identity_nonce, } .into()) } @@ -98,12 +99,12 @@ pub fn json_document_to_contract_with_ids( path: impl AsRef, id: Option, owner_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let value = json_document_to_json_value(path)?; - let mut contract = DataContract::from_json(value, validate, platform_version)?; + let mut contract = DataContract::from_json(value, full_validation, platform_version)?; if let Some(id) = id { contract.set_id(id); @@ -139,6 +140,14 @@ pub fn json_document_to_document( revision: data.remove_optional_integer("$revision")?, created_at: data.remove_optional_integer("$createdAt")?, updated_at: data.remove_optional_integer("$updatedAt")?, + transferred_at: data.remove_optional_integer("$transferredAt")?, + created_at_block_height: data.remove_optional_integer("$createdAtBlockHeight")?, + updated_at_block_height: data.remove_optional_integer("$updatedAtBlockHeight")?, + transferred_at_block_height: data.remove_optional_integer("$transferredAtBlockHeight")?, + created_at_core_block_height: data.remove_optional_integer("$createdAtCoreBlockHeight")?, + updated_at_core_block_height: data.remove_optional_integer("$updatedAtCoreBlockHeight")?, + transferred_at_core_block_height: data + .remove_optional_integer("$transferredAtCoreBlockHeight")?, }; data.replace_at_paths( diff --git a/packages/rs-dpp/src/tests/payloads/document_dpns.json b/packages/rs-dpp/src/tests/payloads/document_dpns.json index 49b2a388bd8..1e6e854ac4a 100644 --- a/packages/rs-dpp/src/tests/payloads/document_dpns.json +++ b/packages/rs-dpp/src/tests/payloads/document_dpns.json @@ -7,7 +7,7 @@ "$revision": 1, "label": "user-9999", "records": { - "dashUniqueIdentityId": "HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn" + "identity": "HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn" }, "preorderSalt": "BzQi567XVqc8wYiVHS887sJtL6MDbxLHNnp+UpTFSB0", "subdomainRules": { diff --git a/packages/rs-dpp/src/tests/utils/error_helpers.rs b/packages/rs-dpp/src/tests/utils/error_helpers.rs deleted file mode 100644 index fe53c3bb7ac..00000000000 --- a/packages/rs-dpp/src/tests/utils/error_helpers.rs +++ /dev/null @@ -1,110 +0,0 @@ -use crate::consensus::basic::json_schema_error::JsonSchemaError; -use crate::consensus::basic::value_error::ValueError; -use crate::consensus::basic::BasicError; -use crate::consensus::fee::fee_error::FeeError; -use crate::consensus::signature::SignatureError; -use crate::consensus::state::state_error::StateError; -use crate::consensus::ConsensusError; -use crate::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; - -pub fn get_schema_error( - result: &SimpleConsensusValidationResult, - number: usize, -) -> &JsonSchemaError { - json_schema_error( - result - .errors - .get(number) - .expect("the error should be returned in validation result"), - ) -} - -pub fn get_basic_error(consensus_error: &ConsensusError) -> &BasicError { - match consensus_error { - ConsensusError::BasicError(basic_error) => basic_error, - _ => panic!("error '{:?}' isn't a basic error", consensus_error), - } -} - -// TODO: Not sure it should be here. Looks more like a test helper -pub fn json_schema_error(consensus_error: &ConsensusError) -> &JsonSchemaError { - match consensus_error { - ConsensusError::BasicError(BasicError::JsonSchemaError(err)) => err, - _ => panic!("error '{:?}' isn't a json schema error", consensus_error), - } -} - -pub fn value_error(consensus_error: &ConsensusError) -> &ValueError { - match consensus_error { - ConsensusError::BasicError(BasicError::ValueError(err)) => err, - _ => panic!("error '{:?}' isn't a value error", consensus_error), - } -} - -pub fn get_state_error_from_result( - result: &ConsensusValidationResult, - error_number: usize, -) -> &StateError { - match result - .errors - .get(error_number) - .expect("error should be found") - { - ConsensusError::StateError(state_error) => state_error, - _ => panic!( - "error '{:?}' isn't a state error", - result.errors[error_number] - ), - } -} - -pub fn get_basic_error_from_result( - result: &SimpleConsensusValidationResult, - error_number: usize, -) -> &BasicError { - match result - .errors - .get(error_number) - .expect("basic error should be found") - { - ConsensusError::BasicError(basic_error) => basic_error, - _ => panic!( - "error '{:?}' isn't a Basic error", - result.errors[error_number] - ), - } -} - -pub fn get_signature_error_from_result( - result: &ConsensusValidationResult, - error_number: usize, -) -> &SignatureError { - match result - .errors - .get(error_number) - .expect("error should be found") - { - ConsensusError::SignatureError(signature_error) => signature_error, - _ => panic!( - "error '{:?}' isn't a Signature error", - result.errors[error_number] - ), - } -} - -pub fn get_fee_error_from_result( - result: &ConsensusValidationResult, - error_number: usize, -) -> &FeeError { - match result - .errors - .get(error_number) - .expect("error should be found") - { - ConsensusError::FeeError(signature_error) => signature_error, - _ => panic!( - "error '{:?}' isn't a Fee error", - result.errors[error_number] - ), - } -} diff --git a/packages/rs-dpp/src/tests/utils/mod.rs b/packages/rs-dpp/src/tests/utils/mod.rs index ad4055a61b8..0fc0b6d0e91 100644 --- a/packages/rs-dpp/src/tests/utils/mod.rs +++ b/packages/rs-dpp/src/tests/utils/mod.rs @@ -1,5 +1,2 @@ -pub use error_helpers::*; pub use utils::*; - -mod error_helpers; mod utils; diff --git a/packages/rs-dpp/src/util/cbor_value/convert.rs b/packages/rs-dpp/src/util/cbor_value/convert.rs index 18e8af258c6..fc1698e7668 100644 --- a/packages/rs-dpp/src/util/cbor_value/convert.rs +++ b/packages/rs-dpp/src/util/cbor_value/convert.rs @@ -1,3 +1,5 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use std::convert::TryInto; use ciborium::value::Value as CborValue; @@ -40,7 +42,7 @@ pub(super) fn convert_to( FieldType::StringBase64 => { let text = cbor_value.as_text()?; - base64::decode(text).ok()? + BASE64_STANDARD.decode(text).ok()? } }; @@ -56,7 +58,7 @@ pub(super) fn convert_to( } FieldType::StringBase64 => { - let encoded = base64::encode(data_bytes); + let encoded = BASE64_STANDARD.encode(data_bytes); CborValue::Text(encoded) } }; @@ -96,6 +98,9 @@ mod tests { let result = convert_to(&cbor_value, FieldType::ArrayInt, FieldType::StringBase64) .expect("no error"); - assert_eq!(CborValue::Text(base64::encode(vec![0_u8; 32])), result); + assert_eq!( + CborValue::Text(BASE64_STANDARD.encode(vec![0_u8; 32])), + result + ); } } diff --git a/packages/rs-dpp/src/util/deserializer.rs b/packages/rs-dpp/src/util/deserializer.rs index caddd4303e0..301bdf24d27 100644 --- a/packages/rs-dpp/src/util/deserializer.rs +++ b/packages/rs-dpp/src/util/deserializer.rs @@ -1,5 +1,8 @@ +#[cfg(feature = "cbor")] use crate::consensus::basic::decode::ProtocolVersionParsingError; +#[cfg(feature = "cbor")] use crate::consensus::basic::BasicError; +#[cfg(feature = "cbor")] use crate::consensus::ConsensusError; use integer_encoding::VarInt; use platform_version::version::FeatureVersion; @@ -66,13 +69,16 @@ pub fn split_cbor_feature_version( } pub mod serde_entropy { + use base64::prelude::BASE64_STANDARD; + use base64::Engine; use std::convert::TryInto; use serde::{Deserialize, Deserializer, Serializer}; pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<[u8; 32], D::Error> { let data: String = Deserialize::deserialize(d)?; - base64::decode(&data) + BASE64_STANDARD + .decode(&data) .map_err(|e| { serde::de::Error::custom(format!("Unable to decode {}' with base64 - {}", data, e)) })? @@ -89,6 +95,6 @@ pub mod serde_entropy { where S: Serializer, { - serializer.serialize_str(&base64::encode(buffer)) + serializer.serialize_str(&BASE64_STANDARD.encode(buffer)) } } diff --git a/packages/rs-dpp/src/util/hash.rs b/packages/rs-dpp/src/util/hash.rs index c21ce76edc7..6f7e1235fcd 100644 --- a/packages/rs-dpp/src/util/hash.rs +++ b/packages/rs-dpp/src/util/hash.rs @@ -1,16 +1,20 @@ use dashcore::hashes::{ripemd160, sha256, Hash}; use sha2::{Digest, Sha256}; -pub fn hash_to_vec(payload: impl AsRef<[u8]>) -> Vec { +pub fn hash_double_to_vec(payload: impl AsRef<[u8]>) -> Vec { Sha256::digest(Sha256::digest(payload)).to_vec() } -pub fn hash(payload: impl AsRef<[u8]>) -> [u8; 32] { +pub fn hash_double(payload: impl AsRef<[u8]>) -> [u8; 32] { Sha256::digest(Sha256::digest(payload)).into() } +pub fn hash_single(payload: impl AsRef<[u8]>) -> [u8; 32] { + Sha256::digest(payload).into() +} + pub fn hash_to_hex_string(payload: impl AsRef<[u8]>) -> String { - hex::encode(hash(payload)) + hex::encode(hash_double(payload)) } pub fn ripemd160_sha256(data: &[u8]) -> [u8; 20] { diff --git a/packages/rs-dpp/src/util/is_fibonacci_number.rs b/packages/rs-dpp/src/util/is_fibonacci_number.rs index fab42b93875..4c736e0a9a0 100644 --- a/packages/rs-dpp/src/util/is_fibonacci_number.rs +++ b/packages/rs-dpp/src/util/is_fibonacci_number.rs @@ -1,7 +1,20 @@ -fn is_perfect_square(number: u32) -> bool { +fn is_perfect_square(number: u64) -> bool { (number as f64).sqrt().fract() == 0.0 } -pub fn is_fibonacci_number(number: u32) -> bool { - is_perfect_square(5 * number * number + 4) || is_perfect_square(5 * number * number - 4) +pub fn is_fibonacci_number(number: u64) -> bool { + let square_check_up = 5u64 + .checked_mul(number) + .and_then(|n| n.checked_mul(number)) + .and_then(|n| n.checked_add(4)); + + let square_check_down = 5u64 + .checked_mul(number) + .and_then(|n| n.checked_mul(number)) + .and_then(|n| n.checked_sub(4)); + + match (square_check_up, square_check_down) { + (Some(n1), Some(n2)) => is_perfect_square(n1) || is_perfect_square(n2), + _ => false, // Return false if either calculation overflows + } } diff --git a/packages/rs-dpp/src/util/json_schema.rs b/packages/rs-dpp/src/util/json_schema.rs index 60103f715c0..10eb520568c 100644 --- a/packages/rs-dpp/src/util/json_schema.rs +++ b/packages/rs-dpp/src/util/json_schema.rs @@ -2,7 +2,8 @@ use anyhow::{anyhow, bail}; use platform_value::Value; use serde_json::Value as JsonValue; -use crate::{identifier, ProtocolError}; +use crate::data_contract::errors::DataContractError; +use crate::identifier; pub trait JsonSchemaExt { /// returns true if json value contains property 'type`, and it equals 'object' @@ -25,17 +26,15 @@ pub trait JsonSchemaExt { fn is_type_of_identifier(&self) -> bool; } -pub fn resolve_uri<'a>(value: &'a Value, uri: &str) -> Result<&'a Value, ProtocolError> { +pub fn resolve_uri<'a>(value: &'a Value, uri: &str) -> Result<&'a Value, DataContractError> { if !uri.starts_with("#/") { - return Err(ProtocolError::Generic( - "only local references are allowed".to_string(), + return Err(DataContractError::InvalidURI( + "only local uri references are allowed".to_string(), )); } let string_path = uri.strip_prefix("#/").unwrap().replace('/', "."); - value - .get_value_at_path(&string_path) - .map_err(ProtocolError::ValueError) + value.get_value_at_path(&string_path).map_err(|e| e.into()) } impl JsonSchemaExt for JsonValue { @@ -214,24 +213,29 @@ mod test { false, false, false, + false, + &mut vec![], LATEST_PLATFORM_VERSION, ) .unwrap(); - let indices = document_type.indices(); + let indices = document_type.indexes(); assert_eq!(indices.len(), 2); - assert_eq!(indices[0].name, "&ownerId"); - assert_eq!(indices[0].properties.len(), 1); - assert_eq!(indices[0].properties[0].name, "$ownerId"); - assert!(indices[0].properties[0].ascending); - assert!(indices[0].unique); - - assert_eq!(indices[1].name, "&ownerId&updatedAt"); - assert_eq!(indices[1].properties.len(), 2); - assert_eq!(indices[1].properties[0].name, "$ownerId"); - assert_eq!(indices[1].properties[1].name, "$updatedAt"); - assert!(!indices[1].unique); + assert_eq!(indices["&ownerId"].name, "&ownerId"); + assert_eq!(indices["&ownerId"].properties.len(), 1); + assert_eq!(indices["&ownerId"].properties[0].name, "$ownerId"); + assert!(indices["&ownerId"].properties[0].ascending); + assert!(indices["&ownerId"].unique); + + assert_eq!(indices["&ownerId&updatedAt"].name, "&ownerId&updatedAt"); + assert_eq!(indices["&ownerId&updatedAt"].properties.len(), 2); + assert_eq!(indices["&ownerId&updatedAt"].properties[0].name, "$ownerId"); + assert_eq!( + indices["&ownerId&updatedAt"].properties[1].name, + "$updatedAt" + ); + assert!(!indices["&ownerId&updatedAt"].unique); } } diff --git a/packages/rs-dpp/src/util/mod.rs b/packages/rs-dpp/src/util/mod.rs index a4ae012dca4..2dee13be293 100644 --- a/packages/rs-dpp/src/util/mod.rs +++ b/packages/rs-dpp/src/util/mod.rs @@ -13,4 +13,5 @@ pub mod json_value; pub mod protocol_data; pub mod strings; +pub mod units; pub mod vec; diff --git a/packages/rs-dpp/src/util/units.rs b/packages/rs-dpp/src/util/units.rs new file mode 100644 index 00000000000..ca00561cf05 --- /dev/null +++ b/packages/rs-dpp/src/util/units.rs @@ -0,0 +1,29 @@ +#[macro_export] +macro_rules! dash_to_credits { + // The macro takes a string literal representing the Dash amount. + ($dash:expr) => {{ + let dash_str = stringify!($dash); + + // Parsing the input string to separate the whole and fractional parts. + let parts: Vec<&str> = dash_str.split('.').collect(); + let mut credits: u128 = 0; + + // Process the whole number part if it exists. + if let Some(whole) = parts.get(0) { + if let Ok(whole_number) = whole.parse::() { + credits += whole_number * 100_000_000_000; // Whole Dash amount to credits + } + } + + // Process the fractional part if it exists. + if let Some(fraction) = parts.get(1) { + let fraction_length = fraction.len(); + let fraction_number = fraction.parse::().unwrap_or(0); + // Calculate the multiplier based on the number of digits in the fraction. + let multiplier = 10u128.pow(11 - fraction_length as u32); + credits += fraction_number * multiplier; // Fractional Dash to credits + } + + credits as u64 + }}; +} diff --git a/packages/rs-dpp/src/validation/block_time_window/mod.rs b/packages/rs-dpp/src/validation/block_time_window/mod.rs deleted file mode 100644 index a73df453ffc..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod validate_time_in_block_time_window; -pub mod validation_result; diff --git a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/mod.rs b/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/mod.rs deleted file mode 100644 index b47bd9fdc93..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::identity::TimestampMillis; -use crate::validation::block_time_window::validate_time_in_block_time_window::v0::validate_time_in_block_time_window_v0; -use crate::validation::block_time_window::validation_result::TimeWindowValidationResult; -use crate::version::PlatformVersion; -use crate::NonConsensusError; - -pub mod v0; - -pub fn validate_time_in_block_time_window( - last_block_header_time_millis: TimestampMillis, - time_to_check_millis: TimestampMillis, - average_block_spacing_ms: u64, //in the event of very long blocks we need to add this - platform_version: &PlatformVersion, -) -> Result { - match platform_version - .dpp - .validation - .validate_time_in_block_time_window - { - 0 => validate_time_in_block_time_window_v0( - last_block_header_time_millis, - time_to_check_millis, - average_block_spacing_ms, - ), - version => Err(NonConsensusError::UnknownVersionMismatch { - method: "validate_time_in_block_time_window".to_string(), - known_versions: vec![0], - received: version, - }), - } -} diff --git a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/v0/mod.rs b/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/v0/mod.rs deleted file mode 100644 index 200045be69e..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/v0/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -use crate::validation::block_time_window::validation_result::TimeWindowValidationResult; -use crate::{prelude::TimestampMillis, NonConsensusError}; - -pub const BLOCK_TIME_WINDOW_MINUTES: u64 = 5; -pub const BLOCK_TIME_WINDOW_MILLIS: u64 = BLOCK_TIME_WINDOW_MINUTES * 60 * 1000; - -/// Validates whether the provided timestamp (`time_to_check_millis`) falls within a calculated -/// time window based on the timestamp of the last block header (`last_block_header_time_millis`). -/// The window is calculated as `BLOCK_TIME_WINDOW_MILLIS` before and after -/// the `last_block_header_time_millis`, plus the `average_block_spacing_ms` to the end window. -/// -/// Returns a `TimeWindowValidationResult` with information about the calculated time window -/// and a validity flag indicating whether the time_to_check falls within this window. -/// -/// # Arguments -/// -/// * `last_block_header_time_millis` - The timestamp in milliseconds of the last block header. -/// * `time_to_check_millis` - The timestamp in milliseconds that needs to be checked against the time window. -/// * `average_block_spacing_ms` - The average spacing in milliseconds between blocks, added to the end of the time window. -/// -/// # Errors -/// -/// If any arithmetic operation (subtraction or addition) overflows, an `NonConsensusError::Overflow` error is returned. -pub(super) fn validate_time_in_block_time_window_v0( - last_block_header_time_millis: TimestampMillis, - time_to_check_millis: TimestampMillis, - average_block_spacing_ms: u64, //in the event of very long blocks we need to add this -) -> Result { - let time_window_start = last_block_header_time_millis - .checked_sub(BLOCK_TIME_WINDOW_MILLIS) - .ok_or(NonConsensusError::Overflow( - "calculation of start window failed", - ))?; - let time_window_end = last_block_header_time_millis - .checked_add(BLOCK_TIME_WINDOW_MILLIS) - .ok_or(NonConsensusError::Overflow( - "calculation of end window failed: block time window overflow", - ))? - .checked_add(average_block_spacing_ms) - .ok_or(NonConsensusError::Overflow( - "calculation of end window failed: average block spacing overflow", - ))?; - - let valid = - time_to_check_millis >= time_window_start && time_to_check_millis <= time_window_end; - - Ok(TimeWindowValidationResult { - time_window_start, - time_window_end, - valid, - }) -} diff --git a/packages/rs-dpp/src/validation/block_time_window/validation_result.rs b/packages/rs-dpp/src/validation/block_time_window/validation_result.rs deleted file mode 100644 index a75d4a60005..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/validation_result.rs +++ /dev/null @@ -1,14 +0,0 @@ -// We can safely assume that this will not need to ever be updated -// @immutable -/// Holds the result of a time window validation. -/// -/// This includes whether the validation was successful (`valid`) as well as -/// the start and end timestamps of the time window that was validated. -pub struct TimeWindowValidationResult { - /// Indicates whether the validation was successful. - pub valid: bool, - /// The start timestamp of the time window that was validated. - pub time_window_start: u64, - /// The end timestamp of the time window that was validated. - pub time_window_end: u64, -} diff --git a/packages/rs-dpp/src/validation/byte_array_keyword.rs b/packages/rs-dpp/src/validation/byte_array_keyword.rs new file mode 100644 index 00000000000..3304775b451 --- /dev/null +++ b/packages/rs-dpp/src/validation/byte_array_keyword.rs @@ -0,0 +1,160 @@ +use std::borrow::Cow; + +use jsonschema::error::{TypeKind, ValidationErrorKind}; +use jsonschema::paths::{JSONPointer, JsonPointerNode}; +use jsonschema::primitive_type::PrimitiveType; +use jsonschema::{ErrorIterator, Keyword, ValidationError}; +use serde_json::Value as JsonValue; +use std::iter::once; + +pub struct ByteArrayKeyword; + +impl Keyword for ByteArrayKeyword { + fn validate<'instance>( + &self, + instance: &'instance JsonValue, + instance_path: &JsonPointerNode, + ) -> ErrorIterator<'instance> { + // Make sure it's an array + if !instance.is_array() { + let error = ValidationError { + instance_path: instance_path.into(), + schema_path: JSONPointer::default(), + kind: ValidationErrorKind::Type { + kind: TypeKind::Single(PrimitiveType::Array), + }, + instance: Cow::Borrowed(instance), + }; + + return Box::new(once(error)); + } + + // Make sure it's an array of bytes + let bytes = instance + .as_array() + .expect("instance must be array and verified above"); + + for (i, value) in bytes.iter().enumerate() { + match value.as_u64() { + Some(byte) if byte > u8::MAX as u64 => { + let error = ValidationError { + instance_path: instance_path.push(i).into(), + schema_path: JSONPointer::default(), + kind: ValidationErrorKind::Maximum { + limit: u8::MAX.into(), + }, + instance: Cow::Borrowed(value), + }; + + return Box::new(once(error)); + } + None => { + let error = ValidationError { + instance_path: instance_path.push(i).into(), + schema_path: JSONPointer::default(), + kind: ValidationErrorKind::Type { + kind: TypeKind::Single(PrimitiveType::Integer), + }, + instance: Cow::Borrowed(value), + }; + + return Box::new(once(error)); + } + Some(_) => {} + } + } + + Box::new(None.into_iter()) + } + fn is_valid(&self, _instance: &JsonValue) -> bool { + true + } +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + + mod validate { + use super::*; + use assert_matches::assert_matches; + use jsonschema::error::ValidationErrorKind; + use jsonschema::paths::JSONPointer; + use std::borrow::Cow; + + #[test] + fn should_return_error_when_instance_is_not_an_array() { + let instance: JsonValue = json!({}); + let instance_path = JsonPointerNode::default(); + + let keyword = ByteArrayKeyword {}; + + let errors = keyword.validate(&instance, &instance_path); + + assert_matches!( + errors.collect::>().as_slice(), + [ValidationError { + kind: ValidationErrorKind::Type { + kind: TypeKind::Single(PrimitiveType::Array) + }, + instance_path: actual_instance_path, + schema_path: actual_schema_path, + instance: actual_instance, + .. + }] if *actual_instance_path == instance_path.into() + && actual_schema_path == &JSONPointer::default() + && actual_instance == &Cow::Borrowed(&instance) + ); + } + + #[test] + fn should_return_error_when_array_item_is_not_an_integer() { + let instance: JsonValue = json!([1, "a"]); + let instance_path = JsonPointerNode::default(); + + let keyword = ByteArrayKeyword {}; + + let errors = keyword.validate(&instance, &instance_path); + + assert_matches!( + errors.collect::>().as_slice(), + [ValidationError { + kind: ValidationErrorKind::Type { + kind: TypeKind::Single(PrimitiveType::Integer) + }, + instance_path: actual_instance_path, + schema_path: actual_schema_path, + instance: actual_instance, + .. + }] if *actual_instance_path == instance_path.push(1).into() + && actual_schema_path == &JSONPointer::default() + && actual_instance == &Cow::::Owned(JsonValue::from("a")) + ); + } + + #[test] + fn should_return_error_when_array_item_is_bigger_than_255() { + let instance: JsonValue = json!([1, 500]); + let instance_path = JsonPointerNode::default(); + + let keyword = ByteArrayKeyword {}; + + let errors = keyword.validate(&instance, &instance_path); + + assert_matches!( + errors.collect::>().as_slice(), + [ValidationError { + kind: ValidationErrorKind::Maximum { limit }, + instance_path: actual_instance_path, + schema_path: actual_schema_path, + instance: actual_instance, + .. + }] if *actual_instance_path == instance_path.push(1).into() + && actual_schema_path == &JSONPointer::default() + && actual_instance == &Cow::::Owned(JsonValue::from(500)) + && limit == &JsonValue::from(u8::MAX) + ); + } + } +} diff --git a/packages/rs-dpp/src/validation/byte_array_meta.rs b/packages/rs-dpp/src/validation/byte_array_meta.rs deleted file mode 100644 index 5b7772a8aa9..00000000000 --- a/packages/rs-dpp/src/validation/byte_array_meta.rs +++ /dev/null @@ -1,98 +0,0 @@ -use std::borrow::Cow; - -use jsonschema::{JSONSchema, ValidationError}; -use serde_json::json; -use serde_json::Value as JsonValue; - -pub(crate) fn error(instance: ValidationError) -> Vec { - vec![instance] -} - -pub fn into_owned(err: ValidationError) -> ValidationError<'static> { - ValidationError { - instance_path: err.instance_path.clone(), - instance: Cow::Owned(err.instance.into_owned()), - kind: err.kind, - schema_path: err.schema_path, - } -} - -pub fn validate(json_schema: &JsonValue) -> Result<(), Vec> { - let byte_array_meta = json!({ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://schema.dash.org/dpp-0-4-0/meta/byte-array", - "description": "Byte array keyword meta schema", - "type": "object", - "properties": { - "properties": { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": { - "byteArray": { - "type": "boolean", - "const": true - } - } - }, - "dependentSchemas": { - "byteArray": { - "description": "should be used only with array type", - "properties": { - "type": { - "type": "string", - "const": "array" - } - }, - "not": { - "properties": { - "items": { - "type": "array" - } - }, - "required": ["items"] - } - }, - "contentMediaType": { - "if": { - "properties": { - "contentMediaType": { - "const": "application/x.dash.dpp.identifier" - } - } - }, - "then": { - "properties": { - "byteArray": { - "const": true - }, - "minItems": { - "const": 32 - }, - "maxItems": { - "const": 32 - } - }, - "required": ["byteArray", "minItems", "maxItems"] - } - }, - } - } - } - }); - - let byte_array_meta_schema = JSONSchema::compile(&byte_array_meta).map_err(|err| { - error(ValidationError { - instance_path: err.instance_path.clone(), - instance: Cow::Owned(err.instance.into_owned()), - kind: err.kind, - schema_path: err.schema_path, - }) - })?; - - byte_array_meta_schema.validate(json_schema).map_err(|err| { - let errors: Vec = err.map(into_owned).collect(); - - errors - }) -} diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs index 834ad2cc75e..fdeb79f2c9e 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs @@ -1,5 +1,5 @@ use crate::data_contract::JsonValue; -use crate::validation::JsonSchemaValidator; +use crate::validation::{JsonSchemaValidator, SimpleConsensusValidationResult}; use crate::ProtocolError; use platform_version::version::PlatformVersion; @@ -26,6 +26,27 @@ impl JsonSchemaValidator { } } + pub fn compile_and_validate( + &self, + json_schema: &JsonValue, + json_value: &JsonValue, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .validation + .json_schema_validator + .compile_and_validate + { + 0 => self.compile_and_validate_v0(json_schema, json_value), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "JsonSchemaLazyValidator.compile_and_validate".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + pub fn is_compiled(&self, platform_version: &PlatformVersion) -> Result { match platform_version .dpp diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs index 9e01fb64e8c..897afdd144b 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs @@ -1,11 +1,12 @@ use crate::consensus::ConsensusError; use crate::data_contract::JsonValue; -use crate::validation::JsonSchemaValidator; +use crate::validation::byte_array_keyword::ByteArrayKeyword; +use crate::validation::{JsonSchemaValidator, SimpleConsensusValidationResult}; use crate::ProtocolError; -use jsonschema::{JSONSchema, KeywordDefinition}; -use serde_json::json; +use jsonschema::{JSONSchema, RegexEngine, RegexOptions}; impl JsonSchemaValidator { + #[inline(always)] pub(super) fn compile_v0(&self, json_schema: &JsonValue) -> Result { if self.is_compiled_v0() { return Ok(false); @@ -20,20 +21,14 @@ impl JsonSchemaValidator { let validator = JSONSchema::options() .with_meta_schemas() + .with_patterns_regex_engine(RegexEngine::Regex(RegexOptions { + size_limit: Some(5 * (1 << 20)), + ..Default::default() + })) .should_ignore_unknown_formats(false) .should_validate_formats(true) .with_draft(jsonschema::Draft::Draft202012) - .clone() // doesn't work otherwise - .add_keyword( - "byteArray", - KeywordDefinition::Schema(json!({ - "items": { - "type": "integer", - "minimum": 0, - "maximum": 255, - }, - })), - ) + .with_keyword("byteArray", |_, _, _| Ok(Box::new(ByteArrayKeyword))) .compile(json_schema) .map_err(|error| { ProtocolError::ConsensusError(Box::new(ConsensusError::from(error))) @@ -44,6 +39,55 @@ impl JsonSchemaValidator { Ok(true) } + #[inline(always)] + pub(super) fn compile_and_validate_v0( + &self, + json_schema: &JsonValue, + json_value: &JsonValue, + ) -> Result { + let mut validator_guard = self.validator.write().unwrap(); + + // Check again to ensure no other thread has modified it after dropping the read lock + if let Some(validator) = validator_guard.as_ref() { + match validator.validate(json_value) { + Ok(_) => Ok(SimpleConsensusValidationResult::new()), + Err(validation_errors) => { + let errors: Vec = + validation_errors.map(ConsensusError::from).collect(); + + Ok(SimpleConsensusValidationResult::new_with_errors(errors)) + } + } + } else { + let validator = JSONSchema::options() + .with_meta_schemas() + .with_patterns_regex_engine(RegexEngine::Regex(Default::default())) + .should_ignore_unknown_formats(false) + .should_validate_formats(true) + .with_draft(jsonschema::Draft::Draft202012) + .with_keyword("byteArray", |_, _, _| Ok(Box::new(ByteArrayKeyword))) + .compile(json_schema) + .map_err(|error| { + // Todo: not sure this is a consensus error + ProtocolError::ConsensusError(Box::new(ConsensusError::from(error))) + })?; + + let validation_result = if let Err(validation_errors) = validator.validate(json_value) { + let errors: Vec = + validation_errors.map(ConsensusError::from).collect(); + + Ok(SimpleConsensusValidationResult::new_with_errors(errors)) + } else { + Ok(SimpleConsensusValidationResult::new()) + }; + + *validator_guard = Some(validator); + + validation_result + } + } + + #[inline(always)] pub(super) fn is_compiled_v0(&self) -> bool { let validator_guard = self.validator.read().unwrap(); diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs index 88dc187a2ad..644351baeb3 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs @@ -4,6 +4,7 @@ use crate::ProtocolError; use platform_version::version::PlatformVersion; impl JsonSchemaValidator { + #[inline(always)] pub(super) fn new_compiled_v0( json_schema: &JsonValue, platform_version: &PlatformVersion, diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs index 31fcddeb157..a8650e98d88 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs @@ -5,6 +5,7 @@ use crate::ProtocolError; use serde_json::Value as JsonValue; impl JsonSchemaValidator { + #[inline(always)] pub(super) fn validate_v0( &self, instance: &JsonValue, diff --git a/packages/rs-dpp/src/validation/meta_validators/mod.rs b/packages/rs-dpp/src/validation/meta_validators/mod.rs index 48ee2923f49..8d1ce93b7e3 100644 --- a/packages/rs-dpp/src/validation/meta_validators/mod.rs +++ b/packages/rs-dpp/src/validation/meta_validators/mod.rs @@ -1,6 +1,7 @@ -use jsonschema::{Draft, JSONSchema, KeywordDefinition}; +use super::byte_array_keyword::ByteArrayKeyword; +use jsonschema::{Draft, JSONSchema, RegexEngine, RegexOptions}; use lazy_static::lazy_static; -use serde_json::{json, Value}; +use serde_json::Value; lazy_static! { static ref DRAFT202012: serde_json::Value = serde_json::from_str(include_str!( @@ -42,7 +43,12 @@ lazy_static! { pub static ref DRAFT_202012_META_SCHEMA: JSONSchema = JSONSchema::options() .with_draft(Draft::Draft202012) + .should_ignore_unknown_formats(false) .should_validate_formats(true) + .with_patterns_regex_engine(RegexEngine::Regex(RegexOptions { + size_limit: Some(5 * (1 << 20)), + ..Default::default() + })) .with_document( "https://json-schema.org/draft/2020-12/meta/applicator".to_string(), DRAFT202012_APPLICATOR.clone(), @@ -82,17 +88,17 @@ lazy_static! { // Compiled version of data contract meta schema pub static ref DOCUMENT_META_SCHEMA_V0: JSONSchema = JSONSchema::options() - .add_keyword( - "byteArray", - KeywordDefinition::Schema(json!({ - "items": { - "type": "integer", - "minimum": 0, - "maximum": 255, - }, - })), - ) + .with_keyword( + "byteArray", + |_, _, _| Ok(Box::new(ByteArrayKeyword)), + ) + .with_patterns_regex_engine(RegexEngine::Regex(RegexOptions { + size_limit: Some(5 * (1 << 20)), + ..Default::default() + })) + .should_ignore_unknown_formats(false) .should_validate_formats(true) + .with_patterns_regex_engine(RegexEngine::Regex(Default::default())) .with_draft(Draft::Draft202012) .with_document( "https://json-schema.org/draft/2020-12/meta/applicator".to_string(), diff --git a/packages/rs-dpp/src/validation/mod.rs b/packages/rs-dpp/src/validation/mod.rs index d8f6579fbda..5637dc28ba1 100644 --- a/packages/rs-dpp/src/validation/mod.rs +++ b/packages/rs-dpp/src/validation/mod.rs @@ -6,18 +6,17 @@ pub use validation_result::{ ValidationResult, }; +#[cfg(feature = "validation")] use crate::version::PlatformVersion; #[cfg(feature = "validation")] use crate::ProtocolError; - -#[cfg(feature = "validation")] -pub mod block_time_window; #[cfg(feature = "validation")] -pub(crate) mod byte_array_meta; +pub(crate) mod byte_array_keyword; #[cfg(feature = "validation")] -mod json_schema_validator; +pub mod json_schema_validator; #[cfg(feature = "validation")] pub(crate) mod meta_validators; +pub mod operations; mod validation_result; #[cfg(feature = "validation")] diff --git a/packages/rs-dpp/src/validation/operations.rs b/packages/rs-dpp/src/validation/operations.rs new file mode 100644 index 00000000000..477f1eb06a1 --- /dev/null +++ b/packages/rs-dpp/src/validation/operations.rs @@ -0,0 +1,60 @@ +use crate::fee::Credits; +use platform_version::version::PlatformVersion; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ProtocolValidationOperation { + DocumentTypeSchemaValidationForSize(u64), + DocumentTypeSchemaPropertyValidation(u64), + DocumentTypeSchemaIndexValidation(u64, bool), +} + +impl ProtocolValidationOperation { + pub fn processing_cost(&self, platform_version: &PlatformVersion) -> Credits { + match self { + ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(size) => { + platform_version + .fee_version + .data_contract + .document_type_base_fee + + *size + * platform_version + .fee_version + .data_contract + .document_type_size_fee + } + ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation(properties_count) => { + *properties_count + * platform_version + .fee_version + .data_contract + .document_type_per_property_fee + } + ProtocolValidationOperation::DocumentTypeSchemaIndexValidation( + index_properties_count, + is_unique, + ) => { + if *is_unique { + *index_properties_count + * platform_version + .fee_version + .data_contract + .document_type_unique_index_per_property_fee + + platform_version + .fee_version + .data_contract + .document_type_base_unique_index_fee + } else { + *index_properties_count + * platform_version + .fee_version + .data_contract + .document_type_non_unique_index_per_property_fee + + platform_version + .fee_version + .data_contract + .document_type_base_non_unique_index_fee + } + } + } + } +} diff --git a/packages/rs-dpp/src/validation/validation_result.rs b/packages/rs-dpp/src/validation/validation_result.rs index 11023608967..a711e5c62f5 100644 --- a/packages/rs-dpp/src/validation/validation_result.rs +++ b/packages/rs-dpp/src/validation/validation_result.rs @@ -237,6 +237,17 @@ impl ValidationResult { ))) } + pub fn into_data_and_errors(self) -> Result<(TData, Vec), ProtocolError> { + Ok(( + self.data + .ok_or(ProtocolError::CorruptedCodeExecution(format!( + "trying to push validation result into data (errors are {:?})", + self.errors + )))?, + self.errors, + )) + } + pub fn data_as_borrowed(&self) -> Result<&TData, ProtocolError> { self.data .as_ref() diff --git a/packages/rs-dpp/src/version/mod.rs b/packages/rs-dpp/src/version/mod.rs index 71e2b84d9b8..71347643217 100644 --- a/packages/rs-dpp/src/version/mod.rs +++ b/packages/rs-dpp/src/version/mod.rs @@ -10,6 +10,9 @@ lazy_static! { RwLock::new(None); } +/// Number of votes for a protocol version upgrade. +pub type ProtocolVersionVoteCount = u64; + pub trait PlatformVersionCurrentVersion { fn set_current(platform_version: &'static PlatformVersion); fn get_current<'a>() -> Result<&'a Self, ProtocolError>; diff --git a/packages/rs-dpp/src/version/validation/mod.rs b/packages/rs-dpp/src/version/validation/mod.rs deleted file mode 100644 index b9b602c153a..00000000000 --- a/packages/rs-dpp/src/version/validation/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[cfg(feature = "state-transitions")] -mod state_transitions; diff --git a/packages/rs-dpp/src/version/validation/state_transitions.rs b/packages/rs-dpp/src/version/validation/state_transitions.rs deleted file mode 100644 index a4ae3564241..00000000000 --- a/packages/rs-dpp/src/version/validation/state_transitions.rs +++ /dev/null @@ -1,205 +0,0 @@ -use crate::consensus::basic::UnsupportedVersionError; -use crate::validation::SimpleConsensusValidationResult; -use crate::version::PlatformVersion; - -impl PlatformVersion { - pub fn validate_contract_version(&self, version: u16) -> SimpleConsensusValidationResult { - if self - .dpp - .contract_versions - .contract_serialization_version - .check_version(version) - { - SimpleConsensusValidationResult::default() - } else { - SimpleConsensusValidationResult::new_with_error( - UnsupportedVersionError::new( - version, - self.dpp - .contract_versions - .contract_serialization_version - .min_version, - self.dpp - .contract_versions - .contract_serialization_version - .max_version, - ) - .into(), - ) - } - } - - pub fn validate_identity_create_state_transition_version( - &self, - version: u16, - ) -> SimpleConsensusValidationResult { - if self - .dpp - .state_transition_serialization_versions - .identity_create_state_transition - .check_version(version) - { - SimpleConsensusValidationResult::default() - } else { - SimpleConsensusValidationResult::new_with_error( - UnsupportedVersionError::new( - version, - self.dpp - .state_transition_serialization_versions - .identity_create_state_transition - .min_version, - self.dpp - .state_transition_serialization_versions - .identity_create_state_transition - .max_version, - ) - .into(), - ) - } - } - - pub fn validate_identity_top_up_state_transition_version( - &self, - version: u16, - ) -> SimpleConsensusValidationResult { - if self - .dpp - .state_transition_serialization_versions - .identity_top_up_state_transition - .check_version(version) - { - SimpleConsensusValidationResult::default() - } else { - SimpleConsensusValidationResult::new_with_error( - UnsupportedVersionError::new( - version, - self.dpp - .state_transition_serialization_versions - .identity_top_up_state_transition - .min_version, - self.dpp - .state_transition_serialization_versions - .identity_top_up_state_transition - .max_version, - ) - .into(), - ) - } - } - - pub fn validate_identity_update_state_transition_version( - &self, - version: u16, - ) -> SimpleConsensusValidationResult { - if self - .dpp - .state_transition_serialization_versions - .identity_update_state_transition - .check_version(version) - { - SimpleConsensusValidationResult::default() - } else { - SimpleConsensusValidationResult::new_with_error( - UnsupportedVersionError::new( - version, - self.dpp - .state_transition_serialization_versions - .identity_update_state_transition - .min_version, - self.dpp - .state_transition_serialization_versions - .identity_update_state_transition - .max_version, - ) - .into(), - ) - } - } - - pub fn validate_identity_credit_withdrawal_state_transition_version( - &self, - version: u16, - ) -> SimpleConsensusValidationResult { - if self - .dpp - .state_transition_serialization_versions - .identity_credit_withdrawal_state_transition - .check_version(version) - { - SimpleConsensusValidationResult::default() - } else { - SimpleConsensusValidationResult::new_with_error( - UnsupportedVersionError::new( - version, - self.dpp - .state_transition_serialization_versions - .identity_credit_withdrawal_state_transition - .min_version, - self.dpp - .state_transition_serialization_versions - .identity_credit_withdrawal_state_transition - .max_version, - ) - .into(), - ) - } - } - - pub fn validate_contract_create_state_transition_version( - &self, - version: u16, - ) -> SimpleConsensusValidationResult { - if self - .dpp - .state_transition_serialization_versions - .contract_create_state_transition - .check_version(version) - { - SimpleConsensusValidationResult::default() - } else { - SimpleConsensusValidationResult::new_with_error( - UnsupportedVersionError::new( - version, - self.dpp - .state_transition_serialization_versions - .contract_create_state_transition - .min_version, - self.dpp - .state_transition_serialization_versions - .contract_create_state_transition - .max_version, - ) - .into(), - ) - } - } - - pub fn validate_contract_update_state_transition_version( - &self, - version: u16, - ) -> SimpleConsensusValidationResult { - if self - .dpp - .state_transition_serialization_versions - .contract_update_state_transition - .check_version(version) - { - SimpleConsensusValidationResult::default() - } else { - SimpleConsensusValidationResult::new_with_error( - UnsupportedVersionError::new( - version, - self.dpp - .state_transition_serialization_versions - .contract_update_state_transition - .min_version, - self.dpp - .state_transition_serialization_versions - .contract_update_state_transition - .max_version, - ) - .into(), - ) - } - } -} diff --git a/packages/rs-dpp/src/voting/contender_structs/contender/mod.rs b/packages/rs-dpp/src/voting/contender_structs/contender/mod.rs new file mode 100644 index 00000000000..1e2c0135e34 --- /dev/null +++ b/packages/rs-dpp/src/voting/contender_structs/contender/mod.rs @@ -0,0 +1,184 @@ +pub mod v0; + +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::Document; +use crate::serialization::{PlatformDeserializable, PlatformSerializable}; +use crate::voting::contender_structs::contender::v0::ContenderV0; +use crate::voting::contender_structs::ContenderWithSerializedDocumentV0; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use derive_more::From; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; + +/// Represents a contender in the contested document vote poll. +/// +/// This struct holds the identity ID of the contender, the serialized document, +/// and the vote tally. +#[derive(Debug, PartialEq, Clone, From)] +pub enum Contender { + /// V0 + V0(ContenderV0), +} + +/// Represents a contender in the contested document vote poll. +/// This is for internal use where the document is in serialized form +/// +/// This struct holds the identity ID of the contender, the serialized document, +/// and the vote tally. +#[derive( + Debug, PartialEq, Eq, Clone, From, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[platform_serialize(unversioned)] +pub enum ContenderWithSerializedDocument { + /// V0 + V0(ContenderWithSerializedDocumentV0), +} + +impl Contender { + pub fn identity_id(&self) -> Identifier { + match self { + Contender::V0(v0) => v0.identity_id, + } + } + + pub fn identity_id_ref(&self) -> &Identifier { + match self { + Contender::V0(v0) => &v0.identity_id, + } + } + + pub fn document(&self) -> &Option { + match self { + Contender::V0(v0) => &v0.document, + } + } + + pub fn take_document(&mut self) -> Option { + match self { + Contender::V0(v0) => v0.document.take(), + } + } + + pub fn vote_tally(&self) -> Option { + match self { + Contender::V0(v0) => v0.vote_tally, + } + } +} + +impl ContenderWithSerializedDocument { + pub fn identity_id(&self) -> Identifier { + match self { + ContenderWithSerializedDocument::V0(v0) => v0.identity_id, + } + } + + pub fn identity_id_ref(&self) -> &Identifier { + match self { + ContenderWithSerializedDocument::V0(v0) => &v0.identity_id, + } + } + + pub fn serialized_document(&self) -> &Option> { + match self { + ContenderWithSerializedDocument::V0(v0) => &v0.serialized_document, + } + } + + pub fn take_serialized_document(&mut self) -> Option> { + match self { + ContenderWithSerializedDocument::V0(v0) => v0.serialized_document.take(), + } + } + + pub fn vote_tally(&self) -> Option { + match self { + ContenderWithSerializedDocument::V0(v0) => v0.vote_tally, + } + } +} + +impl ContenderWithSerializedDocument { + pub fn try_into_contender( + self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match self { + ContenderWithSerializedDocument::V0(v0) => Ok(v0 + .try_into_contender(document_type_ref, platform_version)? + .into()), + } + } + + pub fn try_to_contender( + &self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match self { + ContenderWithSerializedDocument::V0(v0) => Ok(v0 + .try_to_contender(document_type_ref, platform_version)? + .into()), + } + } +} + +impl Contender { + pub fn try_into_contender_with_serialized_document( + self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match self { + Contender::V0(v0) => Ok(v0 + .try_into_contender_with_serialized_document(document_type_ref, platform_version)? + .into()), + } + } + + pub fn try_to_contender_with_serialized_document( + &self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match self { + Contender::V0(v0) => Ok(v0 + .try_to_contender_with_serialized_document(document_type_ref, platform_version)? + .into()), + } + } + + pub fn serialize( + &self, + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + self.try_to_contender_with_serialized_document(document_type, platform_version)? + .serialize_to_bytes() + } + + pub fn serialize_consume( + self, + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + self.try_into_contender_with_serialized_document(document_type, platform_version)? + .serialize_to_bytes() + } + + pub fn from_bytes( + serialized_contender: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + let serialized_contender = + ContenderWithSerializedDocument::deserialize_from_bytes(serialized_contender)?; + serialized_contender.try_into_contender(document_type, platform_version) + } +} diff --git a/packages/rs-dpp/src/voting/contender_structs/contender/v0/mod.rs b/packages/rs-dpp/src/voting/contender_structs/contender/v0/mod.rs new file mode 100644 index 00000000000..7ff0929f612 --- /dev/null +++ b/packages/rs-dpp/src/voting/contender_structs/contender/v0/mod.rs @@ -0,0 +1,126 @@ +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use crate::document::Document; +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::ProtocolError; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; + +/// Represents a contender in the contested document vote poll. +/// +/// This struct holds the identity ID of the contender, the serialized document, +/// and the vote tally. +#[derive(Debug, PartialEq, Clone, Default)] +pub struct ContenderV0 { + /// The identity ID of the contender. + pub identity_id: Identifier, + /// The document associated with the contender. + pub document: Option, + /// The vote tally for the contender. + pub vote_tally: Option, +} + +/// Represents a contender in the contested document vote poll. +/// This is for internal use where the document is in serialized form +/// +/// This struct holds the identity ID of the contender, the serialized document, +/// and the vote tally. +#[derive(Debug, PartialEq, Eq, Clone, Default, Encode, Decode)] +pub struct ContenderWithSerializedDocumentV0 { + /// The identity ID of the contender. + pub identity_id: Identifier, + /// The serialized document associated with the contender. + pub serialized_document: Option>, + /// The vote tally for the contender. + pub vote_tally: Option, +} + +impl ContenderV0 { + pub fn try_into_contender_with_serialized_document( + self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let ContenderV0 { + identity_id, + document, + vote_tally, + } = self; + + Ok(ContenderWithSerializedDocumentV0 { + identity_id, + serialized_document: document + .map(|document| document.serialize(document_type_ref, platform_version)) + .transpose()?, + vote_tally, + }) + } + + pub fn try_to_contender_with_serialized_document( + &self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let ContenderV0 { + identity_id, + document, + vote_tally, + } = self; + + Ok(ContenderWithSerializedDocumentV0 { + identity_id: *identity_id, + serialized_document: document + .as_ref() + .map(|document| document.serialize(document_type_ref, platform_version)) + .transpose()?, + vote_tally: *vote_tally, + }) + } +} + +impl ContenderWithSerializedDocumentV0 { + pub fn try_into_contender( + self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let ContenderWithSerializedDocumentV0 { + identity_id, + serialized_document, + vote_tally, + } = self; + + Ok(ContenderV0 { + identity_id, + document: serialized_document + .map(|document| { + Document::from_bytes(document.as_slice(), document_type_ref, platform_version) + }) + .transpose()?, + vote_tally, + }) + } + + pub fn try_to_contender( + &self, + document_type_ref: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let ContenderWithSerializedDocumentV0 { + identity_id, + serialized_document, + vote_tally, + } = self; + + Ok(ContenderV0 { + identity_id: *identity_id, + document: serialized_document + .as_ref() + .map(|document| { + Document::from_bytes(document.as_slice(), document_type_ref, platform_version) + }) + .transpose()?, + vote_tally: *vote_tally, + }) + } +} diff --git a/packages/rs-dpp/src/voting/contender_structs/mod.rs b/packages/rs-dpp/src/voting/contender_structs/mod.rs new file mode 100644 index 00000000000..0e8d96c25fe --- /dev/null +++ b/packages/rs-dpp/src/voting/contender_structs/mod.rs @@ -0,0 +1,123 @@ +mod contender; + +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use crate::document::Document; +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use crate::ProtocolError; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +use std::fmt; + +pub use contender::v0::{ContenderV0, ContenderWithSerializedDocumentV0}; +pub use contender::{Contender, ContenderWithSerializedDocument}; + +/// Represents a finalized contender in the contested document vote poll. +/// This is for internal use where the document is in serialized form +/// +/// This struct holds the identity ID of the contender, the serialized document, +/// and the vote tally. +#[derive(Debug, PartialEq, Eq, Clone, Default)] +pub struct FinalizedContenderWithSerializedDocument { + /// The identity ID of the contender. + pub identity_id: Identifier, + /// The serialized document associated with the contender. + pub serialized_document: Vec, + /// The vote tally for the contender. + pub final_vote_tally: u32, +} + +/// Represents a finalized contender in the contested document vote poll. +/// This is for keeping information about previous vote polls +/// +/// This struct holds the identity ID of the contender, the serialized document, +/// and the vote tally. +#[derive(Debug, PartialEq, Eq, Clone, Default, Encode, Decode)] +pub struct FinalizedResourceVoteChoicesWithVoterInfo { + /// The resource vote choice. + pub resource_vote_choice: ResourceVoteChoice, + /// The pro_tx_hashes of the voters for this contender along with their strength + pub voters: Vec<(Identifier, u8)>, +} +impl fmt::Display for FinalizedResourceVoteChoicesWithVoterInfo { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let voters_str: Vec = self + .voters + .iter() + .map(|(id, strength)| format!("{}:{}", id, strength)) + .collect(); + write!( + f, + "FinalizedResourceVoteChoicesWithVoterInfo {{ resource_vote_choice: {}, voters: [{}] }}", + self.resource_vote_choice, + voters_str.join(", ") + ) + } +} + +/// Represents a finalized contender in the contested document vote poll. +/// This is for internal use where the document is in serialized form +/// +/// This struct holds the identity ID of the contender, the document, +/// and the vote tally. +#[derive(Debug, PartialEq, Clone)] +pub struct FinalizedContender { + /// The identity ID of the contender. + pub identity_id: Identifier, + /// The document associated with the contender. + pub document: Document, + /// The still serialized document + pub serialized_document: Vec, + /// The vote tally for the contender. + pub final_vote_tally: u32, +} + +impl FinalizedContender { + /// Try to get the finalized contender from a finalized contender with a serialized document + pub fn try_from_contender_with_serialized_document( + value: FinalizedContenderWithSerializedDocument, + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let FinalizedContenderWithSerializedDocument { + identity_id, + serialized_document, + final_vote_tally, + } = value; + + Ok(FinalizedContender { + identity_id, + document: Document::from_bytes(&serialized_document, document_type, platform_version)?, + serialized_document, + final_vote_tally, + }) + } +} + +impl TryFrom for FinalizedContenderWithSerializedDocument { + type Error = ProtocolError; + + fn try_from(value: ContenderWithSerializedDocument) -> Result { + let (identity_id, serialized_document, vote_tally) = match value { + ContenderWithSerializedDocument::V0(v0) => { + let ContenderWithSerializedDocumentV0 { + identity_id, + serialized_document, + vote_tally, + } = v0; + (identity_id, serialized_document, vote_tally) + } + }; + + Ok(FinalizedContenderWithSerializedDocument { + identity_id, + serialized_document: serialized_document.ok_or( + ProtocolError::CorruptedCodeExecution("expected serialized document".to_string()), + )?, + final_vote_tally: vote_tally.ok_or(ProtocolError::CorruptedCodeExecution( + "expected vote tally".to_string(), + ))?, + }) + } +} diff --git a/packages/rs-dpp/src/voting/mod.rs b/packages/rs-dpp/src/voting/mod.rs new file mode 100644 index 00000000000..dc8d5cb5fec --- /dev/null +++ b/packages/rs-dpp/src/voting/mod.rs @@ -0,0 +1,5 @@ +pub mod contender_structs; +pub mod vote_choices; +pub mod vote_info_storage; +pub mod vote_polls; +pub mod votes; diff --git a/packages/rs-dpp/src/voting/vote_choices/mod.rs b/packages/rs-dpp/src/voting/vote_choices/mod.rs new file mode 100644 index 00000000000..e04ed4ee230 --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_choices/mod.rs @@ -0,0 +1,3 @@ +pub mod resource_vote_choice; +/// The various vote choices a vote could have +pub mod yes_no_abstain_vote_choice; diff --git a/packages/rs-dpp/src/voting/vote_choices/resource_vote_choice/mod.rs b/packages/rs-dpp/src/voting/vote_choices/resource_vote_choice/mod.rs new file mode 100644 index 00000000000..fa4b19a7251 --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_choices/resource_vote_choice/mod.rs @@ -0,0 +1,56 @@ +use crate::voting::vote_choices::resource_vote_choice::ResourceVoteChoice::{ + Abstain, Lock, TowardsIdentity, +}; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_value::Identifier; +#[cfg(feature = "vote-serde-conversion")] +use serde::{Deserialize, Serialize}; +use std::fmt; + +/// A resource votes is a votes determining what we should do with a contested resource. +/// For example Alice and Bob both want the username "Malaka" +/// Some would vote for Alice to get it by putting in her Identifier. +/// Some would vote for Bob to get it by putting in Bob's Identifier. +/// Let's say someone voted, but is now not quite sure of their votes, they can abstain. +/// Lock is there to signal that the shared resource should be given to no one. +/// In this case Malaka might have a bad connotation in Greek, hence some might votes to Lock +/// the name. +/// +#[derive(Debug, Clone, Copy, Encode, Decode, Ord, Eq, PartialOrd, PartialEq, Default)] +#[cfg_attr( + feature = "vote-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +pub enum ResourceVoteChoice { + TowardsIdentity(Identifier), + #[default] + Abstain, + Lock, +} + +impl fmt::Display for ResourceVoteChoice { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ResourceVoteChoice::TowardsIdentity(identifier) => { + write!(f, "TowardsIdentity({})", identifier) + } + ResourceVoteChoice::Abstain => write!(f, "Abstain"), + ResourceVoteChoice::Lock => write!(f, "Lock"), + } + } +} + +impl TryFrom<(i32, Option>)> for ResourceVoteChoice { + type Error = ProtocolError; + + fn try_from(value: (i32, Option>)) -> Result { + match value.0 { + 0 => Ok(TowardsIdentity(value.1.ok_or(ProtocolError::DecodingError("identifier needed when trying to cast from an i32 to a resource vote choice".to_string()))?.try_into()?)), + 1 => Ok(Abstain), + 2 => Ok(Lock), + n => Err(ProtocolError::DecodingError(format!("identifier must be 0, 1, or 2, got {}", n))) + } + } +} diff --git a/packages/rs-dpp/src/voting/vote_choices/yes_no_abstain_vote_choice/mod.rs b/packages/rs-dpp/src/voting/vote_choices/yes_no_abstain_vote_choice/mod.rs new file mode 100644 index 00000000000..5f4a4cd32ee --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_choices/yes_no_abstain_vote_choice/mod.rs @@ -0,0 +1,16 @@ +use bincode::{Decode, Encode}; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, Encode, Decode, PartialEq, Default)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +pub enum YesNoAbstainVoteChoice { + YES, + NO, + #[default] + ABSTAIN, +} diff --git a/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_stored_info/mod.rs b/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_stored_info/mod.rs new file mode 100644 index 00000000000..12eb2b400cc --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_stored_info/mod.rs @@ -0,0 +1,208 @@ +mod v0; + +use crate::block::block_info::BlockInfo; +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::voting::contender_structs::{ + ContenderWithSerializedDocument, FinalizedResourceVoteChoicesWithVoterInfo, +}; +use crate::voting::vote_info_storage::contested_document_vote_poll_stored_info::v0::ContestedDocumentVotePollStoredInfoV0; +use crate::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; +use crate::ProtocolError; +use derive_more::From; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +use std::fmt; +pub use v0::ContestedDocumentVotePollStoredInfoV0Getters; + +pub type LockedVotePollCounter = u16; + +#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Encode, Decode)] +pub enum ContestedDocumentVotePollStatus { + #[default] + NotStarted, + Awarded(Identifier), + Locked, + Started(BlockInfo), +} + +impl fmt::Display for ContestedDocumentVotePollStatus { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ContestedDocumentVotePollStatus::NotStarted => write!(f, "NotStarted"), + ContestedDocumentVotePollStatus::Awarded(identifier) => { + write!(f, "Awarded({})", identifier) + } + ContestedDocumentVotePollStatus::Locked => write!(f, "Locked"), + ContestedDocumentVotePollStatus::Started(block_info) => { + write!(f, "Started({})", block_info) + } + } + } +} + +impl ContestedDocumentVotePollStatus { + pub fn awarded_or_locked(&self) -> bool { + matches!( + self, + ContestedDocumentVotePollStatus::Awarded(_) | ContestedDocumentVotePollStatus::Locked + ) + } +} + +/// Represents the stored info after a contested document vote poll. +/// +/// This struct holds the list of contenders, the abstaining vote tally. +#[derive( + Debug, PartialEq, Eq, Clone, From, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[platform_serialize(unversioned)] +pub enum ContestedDocumentVotePollStoredInfo { + /// V0. + V0(ContestedDocumentVotePollStoredInfoV0), +} + +impl fmt::Display for ContestedDocumentVotePollStoredInfo { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ContestedDocumentVotePollStoredInfo::V0(info) => write!(f, "V0({})", info), + } + } +} + +impl ContestedDocumentVotePollStoredInfo { + pub fn new( + start_block: BlockInfo, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .voting_versions + .contested_document_vote_poll_stored_info_version + { + 0 => Ok(ContestedDocumentVotePollStoredInfoV0::new(start_block).into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "ContestedDocumentVotePollStoredInfo::new".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + pub fn update_to_latest_version( + self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .voting_versions + .contested_document_vote_poll_stored_info_version + { + 0 => { + // Nothing to do + match self { + ContestedDocumentVotePollStoredInfo::V0(_) => Ok(self), + } + } + version => Err(ProtocolError::UnknownVersionMismatch { + method: "FinalizedContestedDocumentVotePollStoredInfo::update_to_latest_version" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + pub fn finalize_vote_poll( + &mut self, + resource_vote_choices: Vec, + finalization_block: BlockInfo, + winner: ContestedDocumentVotePollWinnerInfo, + ) -> Result<(), ProtocolError> { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => { + v0.finalize_vote_poll(resource_vote_choices, finalization_block, winner) + } + } + } +} + +impl ContestedDocumentVotePollStoredInfoV0Getters for ContestedDocumentVotePollStoredInfo { + fn last_resource_vote_choices( + &self, + ) -> Option<&Vec> { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.last_resource_vote_choices(), + } + } + + fn awarded_block(&self) -> Option { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.awarded_block(), + } + } + + fn current_start_block(&self) -> Option { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.current_start_block(), + } + } + + fn last_finalization_block(&self) -> Option { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.last_finalization_block(), + } + } + + fn winner(&self) -> ContestedDocumentVotePollWinnerInfo { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.winner(), + } + } + + fn last_locked_votes(&self) -> Option { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.last_locked_votes(), + } + } + + fn last_locked_voters(&self) -> Option> { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.last_locked_voters(), + } + } + + fn last_abstain_votes(&self) -> Option { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.last_abstain_votes(), + } + } + + fn last_abstain_voters(&self) -> Option> { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.last_abstain_voters(), + } + } + + fn contender_votes_in_vec_of_contender_with_serialized_document( + &self, + ) -> Option> { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => { + v0.contender_votes_in_vec_of_contender_with_serialized_document() + } + } + } + + fn vote_poll_status(&self) -> ContestedDocumentVotePollStatus { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => v0.vote_poll_status, + } + } + + fn vote_poll_status_ref(&self) -> &ContestedDocumentVotePollStatus { + match self { + ContestedDocumentVotePollStoredInfo::V0(v0) => &v0.vote_poll_status, + } + } +} diff --git a/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_stored_info/v0/mod.rs b/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_stored_info/v0/mod.rs new file mode 100644 index 00000000000..b7fe690994a --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_stored_info/v0/mod.rs @@ -0,0 +1,318 @@ +use crate::block::block_info::BlockInfo; +use crate::voting::contender_structs::{ + ContenderWithSerializedDocument, ContenderWithSerializedDocumentV0, + FinalizedResourceVoteChoicesWithVoterInfo, +}; +use crate::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use crate::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStatus; +use crate::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_value::Identifier; +use std::fmt; + +// We can have multiple rounds of voting, after an unlock for example +#[derive(Debug, PartialEq, Eq, Clone, Default, Encode, Decode)] +pub struct ContestedDocumentVotePollStoredInfoVoteEventV0 { + /// The list of contenders returned by the query. + pub resource_vote_choices: Vec, + /// Start Block + pub start_block: BlockInfo, + /// Finalization Block + pub finalization_block: BlockInfo, + /// Winner info + pub winner: ContestedDocumentVotePollWinnerInfo, +} + +impl fmt::Display for ContestedDocumentVotePollStoredInfoVoteEventV0 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let resource_vote_choices_str: Vec = self + .resource_vote_choices + .iter() + .map(|v| v.to_string()) + .collect(); + write!( + f, + "ContestedDocumentVotePollStoredInfoVoteEventV0 {{ resource_vote_choices: [{}], start_block: {}, finalization_block: {}, winner: {} }}", + resource_vote_choices_str.join(", "), + self.start_block, + self.finalization_block, + self.winner + ) + } +} + +#[derive(Debug, PartialEq, Eq, Clone, Default, Encode, Decode)] +pub struct ContestedDocumentVotePollStoredInfoV0 { + /// The list of contenders returned by the query. + pub finalized_events: Vec, + /// Start Block + pub vote_poll_status: ContestedDocumentVotePollStatus, + /// Locked count, aka how many times has this previously been locked + pub locked_count: u16, +} + +impl fmt::Display for ContestedDocumentVotePollStoredInfoV0 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let finalized_events_str: Vec = self + .finalized_events + .iter() + .map(|v| v.to_string()) + .collect(); + write!( + f, + "ContestedDocumentVotePollStoredInfoV0 {{ finalized_events: [{}], vote_poll_status: {}, locked_count: {} }}", + finalized_events_str.join(", "), + self.vote_poll_status, + self.locked_count + ) + } +} + +impl ContestedDocumentVotePollStoredInfoV0 { + pub fn new(start_block: BlockInfo) -> ContestedDocumentVotePollStoredInfoV0 { + ContestedDocumentVotePollStoredInfoV0 { + finalized_events: vec![], + vote_poll_status: ContestedDocumentVotePollStatus::Started(start_block), + locked_count: 0, + } + } +} + +impl ContestedDocumentVotePollStoredInfoVoteEventV0 { + pub fn new( + resource_vote_choices: Vec, + start_block: BlockInfo, + finalization_block: BlockInfo, + winner: ContestedDocumentVotePollWinnerInfo, + ) -> ContestedDocumentVotePollStoredInfoVoteEventV0 { + ContestedDocumentVotePollStoredInfoVoteEventV0 { + resource_vote_choices, + start_block, + finalization_block, + winner, + } + } +} + +impl ContestedDocumentVotePollStoredInfoV0 { + /// This will finalize the current vote poll. + /// However, if this results in it being locked, then it is possible to unlock in the future. + pub fn finalize_vote_poll( + &mut self, + resource_vote_choices: Vec, + finalization_block: BlockInfo, + winner: ContestedDocumentVotePollWinnerInfo, + ) -> Result<(), ProtocolError> { + let ContestedDocumentVotePollStatus::Started(started_block) = self.vote_poll_status else { + return Err(ProtocolError::CorruptedCodeExecution( + "trying to finalized vote poll that hasn't started".to_string(), + )); + }; + self.finalized_events + .push(ContestedDocumentVotePollStoredInfoVoteEventV0::new( + resource_vote_choices, + started_block, + finalization_block, + winner, + )); + match winner { + ContestedDocumentVotePollWinnerInfo::NoWinner => { + if self.locked_count > 0 { + // We return it to being in the locked position + self.vote_poll_status = ContestedDocumentVotePollStatus::Locked; + } else { + self.vote_poll_status = ContestedDocumentVotePollStatus::NotStarted; + } + } + ContestedDocumentVotePollWinnerInfo::WonByIdentity(identifier) => { + self.vote_poll_status = ContestedDocumentVotePollStatus::Awarded(identifier); + } + ContestedDocumentVotePollWinnerInfo::Locked => { + self.locked_count += 1; + self.vote_poll_status = ContestedDocumentVotePollStatus::Locked; + } + } + Ok(()) + } +} + +pub trait ContestedDocumentVotePollStoredInfoV0Getters { + fn last_resource_vote_choices(&self) + -> Option<&Vec>; + fn awarded_block(&self) -> Option; + fn current_start_block(&self) -> Option; + fn last_finalization_block(&self) -> Option; + fn winner(&self) -> ContestedDocumentVotePollWinnerInfo; + + fn last_locked_votes(&self) -> Option; + + fn last_locked_voters(&self) -> Option>; + + fn last_abstain_votes(&self) -> Option; + + fn last_abstain_voters(&self) -> Option>; + fn contender_votes_in_vec_of_contender_with_serialized_document( + &self, + ) -> Option>; + fn vote_poll_status(&self) -> ContestedDocumentVotePollStatus; + fn vote_poll_status_ref(&self) -> &ContestedDocumentVotePollStatus; +} + +impl ContestedDocumentVotePollStoredInfoV0Getters for ContestedDocumentVotePollStoredInfoV0 { + fn last_resource_vote_choices( + &self, + ) -> Option<&Vec> { + self.finalized_events + .last() + .map(|event| &event.resource_vote_choices) + } + + fn awarded_block(&self) -> Option { + if matches!( + self.vote_poll_status, + ContestedDocumentVotePollStatus::Awarded(_) + ) { + self.finalized_events + .last() + .map(|event| event.finalization_block) + } else { + None + } + } + + fn current_start_block(&self) -> Option { + if let ContestedDocumentVotePollStatus::Started(start_block) = self.vote_poll_status { + Some(start_block) + } else { + None + } + } + + fn last_finalization_block(&self) -> Option { + self.finalized_events + .last() + .map(|event| event.finalization_block) + } + + fn winner(&self) -> ContestedDocumentVotePollWinnerInfo { + match self.vote_poll_status { + ContestedDocumentVotePollStatus::NotStarted => { + ContestedDocumentVotePollWinnerInfo::NoWinner + } + ContestedDocumentVotePollStatus::Awarded(identifier) => { + ContestedDocumentVotePollWinnerInfo::WonByIdentity(identifier) + } + ContestedDocumentVotePollStatus::Locked => ContestedDocumentVotePollWinnerInfo::Locked, + ContestedDocumentVotePollStatus::Started(_) => { + ContestedDocumentVotePollWinnerInfo::NoWinner + } + } + } + + fn last_locked_votes(&self) -> Option { + self.last_resource_vote_choices() + .map(|resource_vote_choices| { + resource_vote_choices + .iter() + .filter(|choice| { + matches!(choice.resource_vote_choice, ResourceVoteChoice::Lock) + }) + .map(|choice| { + let sum: u32 = choice + .voters + .iter() + .map(|(_, strength)| *strength as u32) + .sum(); + sum + }) + .sum() + }) + } + + fn last_locked_voters(&self) -> Option> { + self.last_resource_vote_choices() + .map(|resource_vote_choices| { + resource_vote_choices + .iter() + .filter(|choice| { + matches!(choice.resource_vote_choice, ResourceVoteChoice::Lock) + }) + .flat_map(|choice| choice.voters.clone()) + .collect() + }) + } + + fn last_abstain_votes(&self) -> Option { + self.last_resource_vote_choices() + .map(|resource_vote_choices| { + resource_vote_choices + .iter() + .filter(|choice| { + matches!(choice.resource_vote_choice, ResourceVoteChoice::Abstain) + }) + .map(|choice| { + let sum: u32 = choice + .voters + .iter() + .map(|(_, strength)| *strength as u32) + .sum(); + sum + }) + .sum() + }) + } + + fn last_abstain_voters(&self) -> Option> { + self.last_resource_vote_choices() + .map(|resource_vote_choices| { + resource_vote_choices + .iter() + .filter(|choice| { + matches!(choice.resource_vote_choice, ResourceVoteChoice::Abstain) + }) + .flat_map(|choice| choice.voters.clone()) + .collect() + }) + } + + fn contender_votes_in_vec_of_contender_with_serialized_document( + &self, + ) -> Option> { + self.last_resource_vote_choices() + .map(|resource_vote_choices| { + resource_vote_choices + .iter() + .filter_map(|choice| { + if let ResourceVoteChoice::TowardsIdentity(identity_id) = + &choice.resource_vote_choice + { + let vote_tally: u32 = choice + .voters + .iter() + .map(|(_, strength)| *strength as u32) + .sum(); + Some( + ContenderWithSerializedDocumentV0 { + identity_id: *identity_id, + serialized_document: None, + vote_tally: Some(vote_tally), + } + .into(), + ) + } else { + None + } + }) + .collect() + }) + } + + fn vote_poll_status(&self) -> ContestedDocumentVotePollStatus { + self.vote_poll_status + } + + fn vote_poll_status_ref(&self) -> &ContestedDocumentVotePollStatus { + &self.vote_poll_status + } +} diff --git a/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_winner_info/mod.rs b/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_winner_info/mod.rs new file mode 100644 index 00000000000..7e666120149 --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_info_storage/contested_document_vote_poll_winner_info/mod.rs @@ -0,0 +1,23 @@ +use bincode::{Decode, Encode}; +use platform_value::Identifier; +use std::fmt; + +#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Encode, Decode)] +pub enum ContestedDocumentVotePollWinnerInfo { + #[default] + NoWinner, + WonByIdentity(Identifier), + Locked, +} + +impl fmt::Display for ContestedDocumentVotePollWinnerInfo { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ContestedDocumentVotePollWinnerInfo::NoWinner => write!(f, "NoWinner"), + ContestedDocumentVotePollWinnerInfo::WonByIdentity(identifier) => { + write!(f, "WonByIdentity({})", identifier) + } + ContestedDocumentVotePollWinnerInfo::Locked => write!(f, "Locked"), + } + } +} diff --git a/packages/rs-dpp/src/voting/vote_info_storage/mod.rs b/packages/rs-dpp/src/voting/vote_info_storage/mod.rs new file mode 100644 index 00000000000..a69f0aee63a --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_info_storage/mod.rs @@ -0,0 +1,2 @@ +pub mod contested_document_vote_poll_stored_info; +pub mod contested_document_vote_poll_winner_info; diff --git a/packages/rs-dpp/src/voting/vote_polls/contested_document_resource_vote_poll/mod.rs b/packages/rs-dpp/src/voting/vote_polls/contested_document_resource_vote_poll/mod.rs new file mode 100644 index 00000000000..21f953f844c --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_polls/contested_document_resource_vote_poll/mod.rs @@ -0,0 +1,66 @@ +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::serialization::PlatformSerializable; +use crate::util::hash::hash_double; +use crate::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::{Identifier, Value}; +#[cfg(feature = "vote-serde-conversion")] +use serde::{Deserialize, Serialize}; +use std::fmt; + +#[derive(Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize, PartialEq)] +#[cfg_attr( + feature = "vote-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[platform_serialize(unversioned)] //versioned directly, no need to use platform_version +#[platform_serialize(limit = 100000)] +pub struct ContestedDocumentResourceVotePoll { + pub contract_id: Identifier, + pub document_type_name: String, + pub index_name: String, + pub index_values: Vec, +} + +impl fmt::Display for ContestedDocumentResourceVotePoll { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // Format the index_values as a comma-separated list + let index_values_str: Vec = + self.index_values.iter().map(|v| v.to_string()).collect(); + write!( + f, + "ContestedDocumentResourceVotePoll {{ contract_id: {}, document_type_name: {}, index_name: {}, index_values: [{}] }}", + self.contract_id, + self.document_type_name, + self.index_name, + index_values_str.join(", ") + ) + } +} + +impl Default for ContestedDocumentResourceVotePoll { + fn default() -> Self { + ContestedDocumentResourceVotePoll { + contract_id: Default::default(), + document_type_name: "".to_string(), + index_name: "".to_string(), + index_values: vec![], + } + } +} + +impl ContestedDocumentResourceVotePoll { + pub fn sha256_2_hash(&self) -> Result<[u8; 32], ProtocolError> { + let encoded = self.serialize_to_bytes()?; + Ok(hash_double(encoded)) + } + + pub fn specialized_balance_id(&self) -> Result { + self.unique_id() + } + + pub fn unique_id(&self) -> Result { + self.sha256_2_hash().map(Identifier::new) + } +} diff --git a/packages/rs-dpp/src/voting/vote_polls/mod.rs b/packages/rs-dpp/src/voting/vote_polls/mod.rs new file mode 100644 index 00000000000..9186451e680 --- /dev/null +++ b/packages/rs-dpp/src/voting/vote_polls/mod.rs @@ -0,0 +1,59 @@ +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use crate::ProtocolError; +use derive_more::From; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +#[cfg(feature = "vote-serde-conversion")] +use serde::{Deserialize, Serialize}; +use std::fmt; + +pub mod contested_document_resource_vote_poll; + +#[derive(Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize, PartialEq, From)] +#[cfg_attr( + feature = "vote-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[platform_serialize(unversioned)] +#[platform_serialize(limit = 100000)] +pub enum VotePoll { + ContestedDocumentResourceVotePoll(ContestedDocumentResourceVotePoll), +} + +impl fmt::Display for VotePoll { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + VotePoll::ContestedDocumentResourceVotePoll(poll) => { + write!(f, "ContestedDocumentResourceVotePoll({})", poll) + } + } + } +} + +impl Default for VotePoll { + fn default() -> Self { + ContestedDocumentResourceVotePoll::default().into() + } +} + +impl VotePoll { + pub fn specialized_balance_id(&self) -> Result, ProtocolError> { + match self { + VotePoll::ContestedDocumentResourceVotePoll(contested_document_resource_vote_poll) => { + Ok(Some( + contested_document_resource_vote_poll.specialized_balance_id()?, + )) + } + } + } + + pub fn unique_id(&self) -> Result { + match self { + VotePoll::ContestedDocumentResourceVotePoll(contested_document_resource_vote_poll) => { + contested_document_resource_vote_poll.unique_id() + } + } + } +} diff --git a/packages/rs-dpp/src/voting/votes/mod.rs b/packages/rs-dpp/src/voting/votes/mod.rs new file mode 100644 index 00000000000..65d8264341d --- /dev/null +++ b/packages/rs-dpp/src/voting/votes/mod.rs @@ -0,0 +1,41 @@ +pub mod resource_vote; + +use crate::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; +use crate::voting::votes::resource_vote::ResourceVote; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use derive_more::From; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +#[cfg(feature = "vote-serde-conversion")] +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize, PartialEq, From)] +#[cfg_attr( + feature = "vote-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[platform_serialize(limit = 15000, unversioned)] +pub enum Vote { + ResourceVote(ResourceVote), +} + +impl Default for Vote { + fn default() -> Self { + Vote::ResourceVote(ResourceVote::default()) + } +} + +impl Vote { + pub fn specialized_balance_id(&self) -> Result, ProtocolError> { + match self { + Vote::ResourceVote(resource_vote) => resource_vote.vote_poll().specialized_balance_id(), + } + } + pub fn vote_poll_unique_id(&self) -> Result { + match self { + Vote::ResourceVote(resource_vote) => resource_vote.vote_poll().unique_id(), + } + } +} diff --git a/packages/rs-dpp/src/voting/votes/resource_vote/accessors/mod.rs b/packages/rs-dpp/src/voting/votes/resource_vote/accessors/mod.rs new file mode 100644 index 00000000000..eb6f42ef6e1 --- /dev/null +++ b/packages/rs-dpp/src/voting/votes/resource_vote/accessors/mod.rs @@ -0,0 +1,26 @@ +use crate::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use crate::voting::vote_polls::VotePoll; +use crate::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; +use crate::voting::votes::resource_vote::ResourceVote; + +pub mod v0; + +impl ResourceVoteGettersV0 for ResourceVote { + fn vote_poll(&self) -> &VotePoll { + match self { + ResourceVote::V0(v0) => &v0.vote_poll, + } + } + + fn vote_poll_owned(self) -> VotePoll { + match self { + ResourceVote::V0(v0) => v0.vote_poll, + } + } + + fn resource_vote_choice(&self) -> ResourceVoteChoice { + match self { + ResourceVote::V0(v0) => v0.resource_vote_choice, + } + } +} diff --git a/packages/rs-dpp/src/voting/votes/resource_vote/accessors/v0/mod.rs b/packages/rs-dpp/src/voting/votes/resource_vote/accessors/v0/mod.rs new file mode 100644 index 00000000000..f9289475aeb --- /dev/null +++ b/packages/rs-dpp/src/voting/votes/resource_vote/accessors/v0/mod.rs @@ -0,0 +1,14 @@ +use crate::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use crate::voting::vote_polls::VotePoll; + +/// Trait for getters in Resource Vote +pub trait ResourceVoteGettersV0 { + /// The vote poll + fn vote_poll(&self) -> &VotePoll; + + /// The vote poll as owned + fn vote_poll_owned(self) -> VotePoll; + + /// The choice made in the vote + fn resource_vote_choice(&self) -> ResourceVoteChoice; +} diff --git a/packages/rs-dpp/src/voting/votes/resource_vote/mod.rs b/packages/rs-dpp/src/voting/votes/resource_vote/mod.rs new file mode 100644 index 00000000000..8ee89fe3714 --- /dev/null +++ b/packages/rs-dpp/src/voting/votes/resource_vote/mod.rs @@ -0,0 +1,27 @@ +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::voting::votes::resource_vote::v0::ResourceVoteV0; +use crate::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +#[cfg(feature = "vote-serde-conversion")] +use serde::{Deserialize, Serialize}; + +pub mod accessors; +pub mod v0; + +#[derive(Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize, PartialEq)] +#[cfg_attr( + feature = "vote-serde-conversion", + derive(Serialize, Deserialize), + serde(tag = "$version") +)] +#[platform_serialize(limit = 15000, unversioned)] +pub enum ResourceVote { + #[cfg_attr(feature = "vote-serde-conversion", serde(rename = "0"))] + V0(ResourceVoteV0), +} + +impl Default for ResourceVote { + fn default() -> Self { + Self::V0(ResourceVoteV0::default()) + } +} diff --git a/packages/rs-dpp/src/voting/votes/resource_vote/v0/mod.rs b/packages/rs-dpp/src/voting/votes/resource_vote/v0/mod.rs new file mode 100644 index 00000000000..5a7a0a407fb --- /dev/null +++ b/packages/rs-dpp/src/voting/votes/resource_vote/v0/mod.rs @@ -0,0 +1,35 @@ +use crate::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use crate::voting::vote_polls::VotePoll; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +#[cfg(feature = "vote-serde-conversion")] +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Encode, Decode, PlatformDeserialize, PlatformSerialize, PartialEq)] +#[cfg_attr( + feature = "vote-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[platform_serialize(unversioned)] +pub struct ResourceVoteV0 { + pub vote_poll: VotePoll, + pub resource_vote_choice: ResourceVoteChoice, +} + +impl Default for ResourceVoteV0 { + fn default() -> Self { + ResourceVoteV0 { + vote_poll: VotePoll::default(), + resource_vote_choice: ResourceVoteChoice::Abstain, + } + } +} + +impl ResourceVoteV0 { + pub fn vote_poll_unique_id(&self) -> Result { + self.vote_poll.unique_id() + } +} diff --git a/packages/rs-drive-abci/.env.example b/packages/rs-drive-abci/.env.example deleted file mode 100644 index 6bde9c76a6b..00000000000 --- a/packages/rs-drive-abci/.env.example +++ /dev/null @@ -1,74 +0,0 @@ -# ABCI host and port to listen -ABCI_BIND_ADDRESS="tcp://0.0.0.0:26658" -ABCI_PROMETHEUS_BIND_ADDRESS="http://0.0.0.0:29090" - -# stderr logging for humans -ABCI_LOG_STDOUT_DESTINATION=stdout -ABCI_LOG_STDOUT_LEVEL=info -ABCI_LOG_STDOUT_FORMAT=pretty -ABCI_LOG_STDOUT_COLOR=true - -DB_PATH=/tmp/db - -# GroveDB database file -GROVEDB_LATEST_FILE=${DB_PATH}/latest_state - -# Cache size for Data Contracts -DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 -DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 - -# DashCore JSON-RPC host, port and credentials -# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls -CORE_JSON_RPC_HOST=127.0.0.1 -CORE_JSON_RPC_PORT=9998 -CORE_JSON_RPC_USERNAME=dashrpc -CORE_JSON_RPC_PASSWORD=password - -# DashCore ZMQ host and port -CORE_ZMQ_HOST=127.0.0.1 -CORE_ZMQ_PORT=29998 -CORE_ZMQ_CONNECTION_RETRIES=16 - -NETWORK=testnet - -INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 - -# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 -VALIDATOR_SET_LLMQ_TYPE=100 -VALIDATOR_SET_QUORUM_ROTATION_BLOCK_COUNT=64 - -DKG_INTERVAL=24 -MIN_QUORUM_VALID_MEMBERS=3 - -# DPNS Contract - -DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e -DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 - -# Dashpay Contract - -DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 -DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd - -# Feature flags contract - -FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 -FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 - -# Masternode reward shares contract - -MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e -MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 - -# Withdrawals contract - -WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a -WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 - -TENDERDASH_P2P_PORT=26656 - -EPOCH_TIME_LENGTH_S=788400 -QUORUM_SIZE=5 -QUORUM_TYPE=llmq_25_67 -CHAIN_ID=devnet -BLOCK_SPACING_MS=3000 diff --git a/packages/rs-drive-abci/.env.local b/packages/rs-drive-abci/.env.local new file mode 100644 index 00000000000..c0e3ac3347a --- /dev/null +++ b/packages/rs-drive-abci/.env.local @@ -0,0 +1,92 @@ +# ABCI host and port to listen +ABCI_CONSENSUS_BIND_ADDRESS="tcp://127.0.0.1:26658" +GRPC_BIND_ADDRESS="127.0.0.1:26670" + +# Metrics are disabled when empty. Must be http://127.0.0.1:29090 for example to enable +PROMETHEUS_BIND_ADDRESS= + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db +REJECTIONS_PATH=/tmp/rejected + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_CONSENSUS_JSON_RPC_HOST=127.0.0.1 +CORE_CONSENSUS_JSON_RPC_PORT=9998 +CORE_CONSENSUS_JSON_RPC_USERNAME=dashrpc +CORE_CONSENSUS_JSON_RPC_PASSWORD=password + +CORE_CHECK_TX_JSON_RPC_HOST=127.0.0.1 +CORE_CHECK_TX_JSON_RPC_PORT=9998 +CORE_CHECK_TX_JSON_RPC_USERNAME=dashrpc +CORE_CHECK_TX_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_QUORUM_TYPE=llmq_test_platform +VALIDATOR_SET_QUORUM_SIZE=3 +VALIDATOR_SET_QUORUM_WINDOW=24 +VALIDATOR_SET_QUORUM_ACTIVE_SIGNERS=2 +VALIDATOR_SET_QUORUM_ROTATION=false +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_test +CHAIN_LOCK_QUORUM_SIZE=3 +CHAIN_LOCK_QUORUM_WINDOW=24 +CHAIN_LOCK_QUORUM_ACTIVE_SIGNERS=2 +CHAIN_LOCK_QUORUM_ROTATION=false + +INSTANT_LOCK_QUORUM_TYPE=llmq_test_instantsend +INSTANT_LOCK_QUORUM_SIZE=3 +INSTANT_LOCK_QUORUM_WINDOW=24 +INSTANT_LOCK_QUORUM_ACTIVE_SIGNERS=2 +INSTANT_LOCK_QUORUM_ROTATION=false + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 + +TOKIO_CONSOLE_ENABLED=false +TOKIO_CONSOLE_ADDRESS=127.0.0.1:6669 +TOKIO_CONSOLE_RETENTION_SECS=180 + +GROVEDB_VISUALIZER_ENABLED=false +GROVEDB_VISUALIZER_ADDRESS=127.0.0.1:8083 + +NETWORK=regtest diff --git a/packages/rs-drive-abci/.env.mainnet b/packages/rs-drive-abci/.env.mainnet new file mode 100644 index 00000000000..65409c1d0a3 --- /dev/null +++ b/packages/rs-drive-abci/.env.mainnet @@ -0,0 +1,94 @@ +# ABCI host and port to listen +ABCI_CONSENSUS_BIND_ADDRESS="tcp://127.0.0.1:26658" +GRPC_BIND_ADDRESS="127.0.0.1:26670" + +# Metrics are disabled when empty. Must be http://127.0.0.1:29090 for example to enable +PROMETHEUS_BIND_ADDRESS= + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db +REJECTIONS_PATH=/tmp/rejected + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_CONSENSUS_JSON_RPC_HOST=127.0.0.1 +CORE_CONSENSUS_JSON_RPC_PORT=9998 +CORE_CONSENSUS_JSON_RPC_USERNAME=dashrpc +CORE_CONSENSUS_JSON_RPC_PASSWORD=password + +CORE_CHECK_TX_JSON_RPC_HOST=127.0.0.1 +CORE_CHECK_TX_JSON_RPC_PORT=9998 +CORE_CHECK_TX_JSON_RPC_USERNAME=dashrpc +CORE_CHECK_TX_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_QUORUM_TYPE=llmq_100_67 +VALIDATOR_SET_QUORUM_SIZE=100 +VALIDATOR_SET_QUORUM_WINDOW=24 +VALIDATOR_SET_QUORUM_ACTIVE_SIGNERS=24 +VALIDATOR_SET_QUORUM_ROTATION=false +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_400_60 +CHAIN_LOCK_QUORUM_SIZE=400 +CHAIN_LOCK_QUORUM_WINDOW=288 +CHAIN_LOCK_QUORUM_ACTIVE_SIGNERS=4 +CHAIN_LOCK_QUORUM_ROTATION=false + +INSTANT_LOCK_QUORUM_TYPE=llmq_60_75 +INSTANT_LOCK_QUORUM_SIZE=60 +INSTANT_LOCK_QUORUM_WINDOW=288 +INSTANT_LOCK_QUORUM_ACTIVE_SIGNERS=32 +INSTANT_LOCK_QUORUM_ROTATION=true + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 + +TOKIO_CONSOLE_ENABLED=false +TOKIO_CONSOLE_ADDRESS=127.0.0.1:6669 +TOKIO_CONSOLE_RETENTION_SECS=180 + +GROVEDB_VISUALIZER_ENABLED=false +GROVEDB_VISUALIZER_ADDRESS=127.0.0.1:8083 + +PROPOSER_TX_PROCESSING_TIME_LIMIT=5000 + +NETWORK=mainnet diff --git a/packages/rs-drive-abci/.env.testnet b/packages/rs-drive-abci/.env.testnet new file mode 100644 index 00000000000..dccf681adf6 --- /dev/null +++ b/packages/rs-drive-abci/.env.testnet @@ -0,0 +1,94 @@ +# ABCI host and port to listen +ABCI_CONSENSUS_BIND_ADDRESS="tcp://127.0.0.1:26658" +GRPC_BIND_ADDRESS="127.0.0.1:26670" + +# Metrics are disabled when empty. Must be http://127.0.0.1:29090 for example to enable +PROMETHEUS_BIND_ADDRESS= + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db +REJECTIONS_PATH=/tmp/rejected + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_CONSENSUS_JSON_RPC_HOST=127.0.0.1 +CORE_CONSENSUS_JSON_RPC_PORT=9998 +CORE_CONSENSUS_JSON_RPC_USERNAME=dashrpc +CORE_CONSENSUS_JSON_RPC_PASSWORD=password + +CORE_CHECK_TX_JSON_RPC_HOST=127.0.0.1 +CORE_CHECK_TX_JSON_RPC_PORT=9998 +CORE_CHECK_TX_JSON_RPC_USERNAME=dashrpc +CORE_CHECK_TX_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_QUORUM_TYPE=llmq_25_67 +VALIDATOR_SET_QUORUM_SIZE=25 +VALIDATOR_SET_QUORUM_WINDOW=24 +VALIDATOR_SET_QUORUM_ACTIVE_SIGNERS=24 +VALIDATOR_SET_QUORUM_ROTATION=false +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_50_60 +CHAIN_LOCK_QUORUM_SIZE=50 +CHAIN_LOCK_QUORUM_WINDOW=24 +CHAIN_LOCK_QUORUM_ACTIVE_SIGNERS=24 +CHAIN_LOCK_QUORUM_ROTATION=false + +INSTANT_LOCK_QUORUM_TYPE=llmq_60_75 +INSTANT_LOCK_QUORUM_SIZE=50 +INSTANT_LOCK_QUORUM_WINDOW=288 +INSTANT_LOCK_QUORUM_ACTIVE_SIGNERS=32 +INSTANT_LOCK_QUORUM_ROTATION=true + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 + +TOKIO_CONSOLE_ENABLED=false +TOKIO_CONSOLE_ADDRESS=127.0.0.1:6669 +TOKIO_CONSOLE_RETENTION_SECS=180 + +GROVEDB_VISUALIZER_ENABLED=false +GROVEDB_VISUALIZER_ADDRESS=127.0.0.1:8083 + +PROPOSER_TX_PROCESSING_TIME_LIMIT=5000 + +NETWORK=testnet diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index af6227b8831..1675ee853f0 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,114 +1,114 @@ [package] name = "drive-abci" -version = "0.25.21" +version = "1.1.0-dev.1" authors = [ - "Samuel Westrich ", - "Ivan Shumkov ", - "Djavid Gabibiyan ", - "Lukasz Klimek ", - "Igor Markin ", + "Samuel Westrich ", + "Ivan Shumkov ", + "Djavid Gabibiyan ", + "Lukasz Klimek ", + "Igor Markin ", ] edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] +arc-swap = "1.7.0" bincode = { version = "2.0.0-rc.3", features = ["serde"] } ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" } -chrono = "0.4.20" -serde = { version = "1.0.152", features = ["derive"] } +chrono = "0.4.35" +serde = { version = "1.0.197", features = ["derive"] } serde_json = { version = "1.0", features = ["preserve_order"] } -serde_with = { version = "3.1.0", features = [ - "hex", - "macros", -], default-features = false } -drive = { path = "../rs-drive", features = [ - "full", - "grovedb_operations_logging", +drive = { path = "../rs-drive", default-features = false, features = [ + "server", + "grovedb_operations_logging", ] } -thiserror = "1.0.30" +thiserror = "1.0.58" rand = "0.8.5" tempfile = "3.3.0" -bs58 = "0.4.0" hex = "0.4.3" -indexmap = { version = "1.9.3", features = ["serde"] } -sha2 = "0.10.6" -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", branch = "master" } +indexmap = { version = "2.2.6", features = ["serde"] } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.4" } dpp = { path = "../rs-dpp", features = ["abci"] } simple-signer = { path = "../simple-signer" } rust_decimal = "1.2.5" rust_decimal_macros = "1.25.0" mockall = { version = "0.11", optional = true } -bytes = { version = "1.4.0", default-features = false } -prost = { version = "0.11.6", default-features = false } +prost = { version = "0.12", default-features = false } tracing = { version = "0.1.37", default-features = false, features = [] } -clap = { version = "4.1.8", optional = true, features = ["derive"] } +clap = { version = "4.4.10", features = ["derive"] } envy = { version = "0.4.2" } -dotenvy = { version = "0.15.7", optional = true } -dapi-grpc = { path = "../dapi-grpc" } +dotenvy = { version = "0.15.7" } +dapi-grpc = { path = "../dapi-grpc", features = ["server"] } tracing-subscriber = { version = "0.3.16", default-features = false, features = [ - "env-filter", - "ansi", - "json", - "fmt", - "std", - "registry", - "tracing-log", + "env-filter", + "ansi", + "json", + "fmt", + "std", + "registry", + "tracing-log", ], optional = false } atty = { version = "0.2.14", optional = false } -tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v0.14.0-dev.2" } +tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "1.1.0", tag = "v1.1.0", features = [ + "grpc", +] } lazy_static = "1.4.0" itertools = { version = "0.10.5" } file-rotate = { version = "0.7.3" } reopen = { version = "1.0.3" } delegate = { version = "0.9.0" } regex = { version = "1.8.1" } -metrics = { version = "0.21" } -metrics-exporter-prometheus = { version = "0.12" } +metrics = { version = "0.22.3" } +metrics-exporter-prometheus = { version = "0.14.0" } url = { version = "2.3.1" } ureq = { "version" = "2.6.2" } -tokio = { version = "1", features = [ - "macros", - "signal", - "rt-multi-thread", - "time", +tokio = { version = "1.36", features = [ + "macros", + "signal", + "rt-multi-thread", + "time", ] } tokio-util = { version = "0.7.8" } derive_more = "0.99.17" +async-trait = "0.1.77" +console-subscriber = { version = "0.2.0", optional = true } [dev-dependencies] -base64 = "0.20.0" +base64 = "0.22.1" platform-version = { path = "../rs-platform-version", features = [ - "mock-versions", + "mock-versions", ] } dpp = { path = "../rs-dpp", features = [ - "abci", - "random-documents", - "state-transition-signing", - "random-identities", - "random-public-keys", - "random-document-types", - "fixtures-and-mocks", - "identity-value-conversion", - "data-contract-json-conversion", - "data-contract-cbor-conversion", + "abci", + "random-documents", + "state-transition-signing", + "random-identities", + "random-public-keys", + "random-document-types", + "fixtures-and-mocks", + "identity-value-conversion", + "data-contract-json-conversion", + "data-contract-cbor-conversion", ] } drive = { path = "../rs-drive" } strategy-tests = { path = "../strategy-tests" } +assert_matches = "1.5.0" +drive-abci = { path = ".", features = ["testing-config"] } # For tests of grovedb verify -rocksdb = { version = "0.21.0" } +rocksdb = { version = "0.22.0" } integer-encoding = { version = "4.0.0" } [features] -default = ["server", "mocks"] -server = ["clap", "dotenvy"] +# TODO: Remove console for production +default = ["mocks", "console"] mocks = ["mockall", "drive/fixtures-and-mocks"] - +console = ["console-subscriber", "tokio/tracing"] +testing-config = [] +grovedbg = ["drive/grovedbg"] [[bin]] name = "drive-abci" path = "src/main.rs" -required-features = ["server"] +required-features = ["console"] diff --git a/packages/rs-drive-abci/src/abci/app/check_tx.rs b/packages/rs-drive-abci/src/abci/app/check_tx.rs new file mode 100644 index 00000000000..2f4a39c1b33 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/check_tx.rs @@ -0,0 +1,99 @@ +use crate::abci::app::PlatformApplication; +use crate::abci::handler; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use crate::utils::spawn_blocking_task_with_name_if_supported; +use async_trait::async_trait; +use std::fmt::Debug; +use std::sync::Arc; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::abci_application_server as grpc_abci_server; +use tenderdash_abci::proto::tonic; + +/// AbciApp is an implementation of gRPC ABCI Application, as defined by Tenderdash. +/// +/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like +/// creating new proposal or finalizing new block. +pub struct CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + /// Platform + platform: Arc>, + core_rpc: Arc, +} + +impl PlatformApplication for CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + fn platform(&self) -> &Platform { + self.platform.as_ref() + } +} + +impl CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + /// Create new ABCI app + pub fn new(platform: Arc>, core_rpc: Arc) -> Self { + Self { platform, core_rpc } + } +} + +impl Debug for CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "") + } +} + +#[async_trait] +impl grpc_abci_server::AbciApplication for CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + async fn echo( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + let response = handler::echo(self, request.into_inner()).map_err(error_into_status)?; + + Ok(tonic::Response::new(response)) + } + + async fn check_tx( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + let platform = Arc::clone(&self.platform); + let core_rpc = Arc::clone(&self.core_rpc); + + let proto_request = request.into_inner(); + + let check_tx_type = proto::CheckTxType::try_from(proto_request.r#type) + .map_err(|_| tonic::Status::invalid_argument("invalid check tx type"))?; + + let thread_name = match check_tx_type { + proto::CheckTxType::New => "check_tx", + proto::CheckTxType::Recheck => "re_check_tx", + }; + + spawn_blocking_task_with_name_if_supported(thread_name, move || { + let response = handler::check_tx(&platform, &core_rpc, proto_request) + .map_err(error_into_status)?; + + Ok(tonic::Response::new(response)) + })? + .await + .map_err(|error| tonic::Status::internal(format!("check tx panics: {}", error)))? + } +} + +pub fn error_into_status(error: Error) -> tonic::Status { + tonic::Status::internal(error.to_string()) +} diff --git a/packages/rs-drive-abci/src/abci/app/consensus.rs b/packages/rs-drive-abci/src/abci/app/consensus.rs new file mode 100644 index 00000000000..a1f08429847 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/consensus.rs @@ -0,0 +1,152 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::handler; +use crate::abci::handler::error::error_into_exception; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; +use std::fmt::Debug; +use std::sync::RwLock; +use tenderdash_abci::proto::abci as proto; + +/// AbciApp is an implementation of ABCI Application, as defined by Tenderdash. +/// +/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like +/// creating new proposal or finalizing new block. +pub struct ConsensusAbciApplication<'a, C> { + /// Platform + platform: &'a Platform, + /// The current GroveDb transaction + transaction: RwLock>>, + /// The current block execution context + block_execution_context: RwLock>, +} + +impl<'a, C> ConsensusAbciApplication<'a, C> { + /// Create new ABCI app + pub fn new(platform: &'a Platform) -> Self { + Self { + platform, + transaction: Default::default(), + block_execution_context: Default::default(), + } + } +} + +impl<'a, C> PlatformApplication for ConsensusAbciApplication<'a, C> { + fn platform(&self) -> &Platform { + self.platform + } +} + +impl<'a, C> BlockExecutionApplication for ConsensusAbciApplication<'a, C> { + fn block_execution_context(&self) -> &RwLock> { + &self.block_execution_context + } +} + +impl<'a, C> TransactionalApplication<'a> for ConsensusAbciApplication<'a, C> { + /// create and store a new transaction + fn start_transaction(&self) { + let transaction = self.platform.drive.grove.start_transaction(); + self.transaction.write().unwrap().replace(transaction); + } + + fn transaction(&self) -> &RwLock>> { + &self.transaction + } + + /// Commit a transaction + fn commit_transaction(&self, platform_version: &PlatformVersion) -> Result<(), Error> { + let transaction = self + .transaction + .write() + .unwrap() + .take() + .ok_or(Error::Execution(ExecutionError::NotInTransaction( + "trying to commit a transaction, but we are not in one", + )))?; + + self.platform + .drive + .commit_transaction(transaction, &platform_version.drive) + .map_err(Error::Drive) + } +} + +impl<'a, C> Debug for ConsensusAbciApplication<'a, C> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "") + } +} + +impl<'a, C> tenderdash_abci::Application for ConsensusAbciApplication<'a, C> +where + C: CoreRPCLike, +{ + fn info( + &self, + request: proto::RequestInfo, + ) -> Result { + handler::info(self, request).map_err(error_into_exception) + } + + fn init_chain( + &self, + request: proto::RequestInitChain, + ) -> Result { + handler::init_chain(self, request).map_err(error_into_exception) + } + + fn query( + &self, + _request: proto::RequestQuery, + ) -> Result { + unreachable!("query is not implemented for consensus ABCI application") + } + + fn check_tx( + &self, + _request: proto::RequestCheckTx, + ) -> Result { + unreachable!("check_tx is not implemented for consensus ABCI application") + } + + fn extend_vote( + &self, + request: proto::RequestExtendVote, + ) -> Result { + handler::extend_vote(self, request).map_err(error_into_exception) + } + + fn finalize_block( + &self, + request: proto::RequestFinalizeBlock, + ) -> Result { + handler::finalize_block(self, request).map_err(error_into_exception) + } + + fn prepare_proposal( + &self, + request: proto::RequestPrepareProposal, + ) -> Result { + handler::prepare_proposal(self, request).map_err(error_into_exception) + } + + fn process_proposal( + &self, + request: proto::RequestProcessProposal, + ) -> Result { + handler::process_proposal(self, request).map_err(error_into_exception) + } + + fn verify_vote_extension( + &self, + request: proto::RequestVerifyVoteExtension, + ) -> Result { + handler::verify_vote_extension(self, request).map_err(error_into_exception) + } +} diff --git a/packages/rs-drive-abci/src/abci/app/execution_result.rs b/packages/rs-drive-abci/src/abci/app/execution_result.rs new file mode 100644 index 00000000000..43d6e61a34d --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/execution_result.rs @@ -0,0 +1,50 @@ +use crate::abci::handler::error::consensus::AbciResponseInfoGetter; +use crate::abci::handler::error::HandlerError; +use crate::error::Error; +use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; +use dpp::fee::SignedCredits; +use dpp::version::PlatformVersion; +use dpp::version::TryIntoPlatformVersioned; +use tenderdash_abci::proto::abci::ExecTxResult; + +impl TryIntoPlatformVersioned> for StateTransitionExecutionResult { + type Error = Error; + + fn try_into_platform_versioned( + self, + platform_version: &PlatformVersion, + ) -> Result, Self::Error> { + let response = match self { + StateTransitionExecutionResult::SuccessfulExecution(_, actual_fees) => { + Some(ExecTxResult { + code: 0, + gas_used: actual_fees.total_base_fee() as SignedCredits, + ..Default::default() + }) + } + StateTransitionExecutionResult::UnpaidConsensusError(error) => Some(ExecTxResult { + code: HandlerError::from(&error).code(), + info: error.response_info_for_version(platform_version)?, + gas_used: 0, + ..Default::default() + }), + StateTransitionExecutionResult::PaidConsensusError(error, actual_fees) => { + Some(ExecTxResult { + code: HandlerError::from(&error).code(), + info: error.response_info_for_version(platform_version)?, + gas_used: actual_fees.total_base_fee() as SignedCredits, + ..Default::default() + }) + } + StateTransitionExecutionResult::InternalError(message) => Some(ExecTxResult { + code: HandlerError::Internal(message).code(), + // TODO: That would be nice to provide more information about the error for debugging + info: String::default(), + ..Default::default() + }), + StateTransitionExecutionResult::NotExecuted(_) => None, + }; + + Ok(response) + } +} diff --git a/packages/rs-drive-abci/src/abci/app/full.rs b/packages/rs-drive-abci/src/abci/app/full.rs new file mode 100644 index 00000000000..55771162ad8 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/full.rs @@ -0,0 +1,153 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::handler; +use crate::abci::handler::error::error_into_exception; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; +use std::fmt::Debug; +use std::sync::RwLock; +use tenderdash_abci::proto::abci as proto; + +/// AbciApp is an implementation of ABCI Application, as defined by Tenderdash. +/// +/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like +/// creating new proposal or finalizing new block. +pub struct FullAbciApplication<'a, C> { + /// Platform + pub platform: &'a Platform, + /// The current GroveDB transaction + pub transaction: RwLock>>, + /// The current block execution context + pub block_execution_context: RwLock>, +} + +impl<'a, C> FullAbciApplication<'a, C> { + /// Create new ABCI app + pub fn new(platform: &'a Platform) -> Self { + Self { + platform, + transaction: Default::default(), + block_execution_context: Default::default(), + } + } +} + +impl<'a, C> PlatformApplication for FullAbciApplication<'a, C> { + fn platform(&self) -> &Platform { + self.platform + } +} + +impl<'a, C> BlockExecutionApplication for FullAbciApplication<'a, C> { + fn block_execution_context(&self) -> &RwLock> { + &self.block_execution_context + } +} + +impl<'a, C> TransactionalApplication<'a> for FullAbciApplication<'a, C> { + /// create and store a new transaction + fn start_transaction(&self) { + let transaction = self.platform.drive.grove.start_transaction(); + self.transaction.write().unwrap().replace(transaction); + } + + fn transaction(&self) -> &RwLock>> { + &self.transaction + } + + /// Commit a transaction + fn commit_transaction(&self, platform_version: &PlatformVersion) -> Result<(), Error> { + let transaction = self + .transaction + .write() + .unwrap() + .take() + .ok_or(Error::Execution(ExecutionError::NotInTransaction( + "trying to commit a transaction, but we are not in one", + )))?; + + self.platform + .drive + .commit_transaction(transaction, &platform_version.drive) + .map_err(Error::Drive) + } +} + +impl<'a, C> Debug for FullAbciApplication<'a, C> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "") + } +} + +impl<'a, C> tenderdash_abci::Application for FullAbciApplication<'a, C> +where + C: CoreRPCLike, +{ + fn info( + &self, + request: proto::RequestInfo, + ) -> Result { + handler::info(self, request).map_err(error_into_exception) + } + + fn init_chain( + &self, + request: proto::RequestInitChain, + ) -> Result { + handler::init_chain(self, request).map_err(error_into_exception) + } + + fn query( + &self, + _request: proto::RequestQuery, + ) -> Result { + unreachable!("query is not supported in full ABCI application") + } + + fn check_tx( + &self, + request: proto::RequestCheckTx, + ) -> Result { + handler::check_tx(self.platform, &self.platform.core_rpc, request) + .map_err(error_into_exception) + } + + fn extend_vote( + &self, + request: proto::RequestExtendVote, + ) -> Result { + handler::extend_vote(self, request).map_err(error_into_exception) + } + + fn finalize_block( + &self, + request: proto::RequestFinalizeBlock, + ) -> Result { + handler::finalize_block(self, request).map_err(error_into_exception) + } + + fn prepare_proposal( + &self, + request: proto::RequestPrepareProposal, + ) -> Result { + handler::prepare_proposal(self, request).map_err(error_into_exception) + } + + fn process_proposal( + &self, + request: proto::RequestProcessProposal, + ) -> Result { + handler::process_proposal(self, request).map_err(error_into_exception) + } + + fn verify_vote_extension( + &self, + request: proto::RequestVerifyVoteExtension, + ) -> Result { + handler::verify_vote_extension(self, request).map_err(error_into_exception) + } +} diff --git a/packages/rs-drive-abci/src/abci/app/mod.rs b/packages/rs-drive-abci/src/abci/app/mod.rs new file mode 100644 index 00000000000..d86290b566b --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/mod.rs @@ -0,0 +1,41 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use drive::grovedb::Transaction; +use std::sync::RwLock; + +mod check_tx; +mod consensus; +/// Convert state transition execution result into ABCI response +pub mod execution_result; +mod full; + +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::rpc::core::DefaultCoreRPC; +pub use check_tx::CheckTxAbciApplication; +pub use consensus::ConsensusAbciApplication; +use dpp::version::PlatformVersion; +pub use full::FullAbciApplication; + +/// Platform-based ABCI application +pub trait PlatformApplication { + /// Returns Platform + fn platform(&self) -> &Platform; +} + +/// Transactional ABCI application +pub trait TransactionalApplication<'a> { + /// Creates and keeps a new transaction + fn start_transaction(&self); + + /// Returns the current transaction + fn transaction(&self) -> &RwLock>>; + + /// Commits created transaction + fn commit_transaction(&self, platform_version: &PlatformVersion) -> Result<(), Error>; +} + +/// Application that executes blocks and need to keep context between handlers +pub trait BlockExecutionApplication { + /// Returns the current block execution context + fn block_execution_context(&self) -> &RwLock>; +} diff --git a/packages/rs-drive-abci/src/abci/config.rs b/packages/rs-drive-abci/src/abci/config.rs index ca28bee1227..33d150f77de 100644 --- a/packages/rs-drive-abci/src/abci/config.rs +++ b/packages/rs-drive-abci/src/abci/config.rs @@ -1,13 +1,8 @@ //! Configuration of ABCI Application server -use rand::prelude::StdRng; -use rand::SeedableRng; - -use dpp::identity::KeyType::ECDSA_SECP256K1; -use dpp::version::PlatformVersion; -use dpp::ProtocolError; +use crate::utils::from_opt_str_or_number; +use dpp::prelude::TimestampMillis; use serde::{Deserialize, Serialize}; -use serde_with::serde_as; // We allow changes in the ABCI configuration, but there should be a social process // involved in making this change. @@ -20,25 +15,8 @@ pub struct AbciConfig { /// Address should be an URL with scheme `tcp://` or `unix://`, for example: /// - `tcp://127.0.0.1:1234` /// - `unix:///var/run/abci.sock` - #[serde(rename = "abci_bind_address")] - pub bind_address: String, - - /// Address to listen for Prometheus connection. - /// - /// Optional. - /// - /// /// Address should be an URL with scheme `http://`, for example: - /// - `http://127.0.0.1:29090` - /// - /// Port number defaults to [DEFAULT_PROMETHEUS_PORT]. - /// - /// [DEFAULT_PROMETHEUS_PORT]: crate::metrics::DEFAULT_PROMETHEUS_PORT - #[serde(default, rename = "abci_prometheus_bind_address")] - pub prometheus_bind_address: Option, - - /// Public keys used for system identity - #[serde(flatten)] - pub keys: Keys, + #[serde(rename = "abci_consensus_bind_address")] + pub consensus_bind_address: String, /// Height of genesis block; defaults to 1 #[serde(default = "AbciConfig::default_genesis_height")] @@ -56,6 +34,10 @@ pub struct AbciConfig { // Note it is parsed directly in PlatformConfig::from_env() so here we just set defaults. #[serde(default)] pub log: crate::logging::LogConfigs, + + /// Maximum time limit (in ms) to process state transitions to prepare proposal + #[serde(default, deserialize_with = "from_opt_str_or_number")] + pub proposer_tx_processing_time_limit: Option, } impl AbciConfig { @@ -71,96 +53,12 @@ impl AbciConfig { impl Default for AbciConfig { fn default() -> Self { Self { - bind_address: "tcp://127.0.0.1:1234".to_string(), - prometheus_bind_address: None, - keys: Keys::new_random_keys_with_seed(18012014, PlatformVersion::first()) - .expect("random keys for first version can not error"), //Dash genesis day + consensus_bind_address: "tcp://127.0.0.1:1234".to_string(), genesis_height: AbciConfig::default_genesis_height(), genesis_core_height: AbciConfig::default_genesis_core_height(), chain_id: "chain_id".to_string(), log: Default::default(), + proposer_tx_processing_time_limit: Default::default(), } } } - -// @append_only -/// Struct to easily load from environment keys used by the Platform. -/// -/// Once loaded, Keys can be easily converted to [SystemIdentityPublicKeys] -/// -/// [SystemIdentityPublicKeys]: super::messages::SystemIdentityPublicKeys -#[serde_as] -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct Keys { - // dpns contract - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) dpns_master_public_key: Vec, - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) dpns_second_public_key: Vec, - - // dashpay contract - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) dashpay_master_public_key: Vec, - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) dashpay_second_public_key: Vec, - - // feature flags contract - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) feature_flags_master_public_key: Vec, - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) feature_flags_second_public_key: Vec, - - // masternode reward shares contract - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) masternode_reward_shares_master_public_key: Vec, - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) masternode_reward_shares_second_public_key: Vec, - - // withdrawals contract - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) withdrawals_master_public_key: Vec, - /// hex-encoded - #[serde_as(as = "serde_with::hex::Hex")] - pub(crate) withdrawals_second_public_key: Vec, -} - -impl Keys { - /// Create new random keys for a given seed - pub fn new_random_keys_with_seed( - seed: u64, - platform_version: &PlatformVersion, - ) -> Result { - let mut rng = StdRng::seed_from_u64(seed); - Ok(Keys { - dpns_master_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - dpns_second_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - dashpay_master_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - dashpay_second_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - feature_flags_master_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - feature_flags_second_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - masternode_reward_shares_master_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - masternode_reward_shares_second_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - withdrawals_master_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - withdrawals_second_public_key: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version)?, - }) - } -} diff --git a/packages/rs-drive-abci/src/abci/error.rs b/packages/rs-drive-abci/src/abci/error.rs index ce2016900ca..857321a16e8 100644 --- a/packages/rs-drive-abci/src/abci/error.rs +++ b/packages/rs-drive-abci/src/abci/error.rs @@ -1,4 +1,7 @@ use dpp::bls_signatures::BlsError; +use dpp::consensus::ConsensusError; +use tenderdash_abci::proto::abci::ExtendVoteExtension; +use tenderdash_abci::proto::types::VoteExtension; // @append_only /// Error returned within ABCI server @@ -10,13 +13,19 @@ pub enum AbciError { /// Request does not match currently processed block #[error("request does not match current block: {0}")] RequestForWrongBlockReceived(String), - /// Withdrawal transactions mismatch - #[error("vote extensions mismatch: got {got:?}, expected {expected:?}")] + /// Withdrawal votes extensions mismatch + #[error("votes extensions mismatch: got {got:?}, expected {expected:?}")] #[allow(missing_docs)] - VoteExtensionMismatchReceived { got: String, expected: String }, + VoteExtensionMismatchReceived { + got: Vec, + expected: Vec, + }, /// Vote extensions signature is invalid - #[error("one of vote extension signatures is invalid")] + #[error("one of votes extension signatures is invalid")] VoteExtensionsSignatureInvalid, + /// Invalid votes extensions verification + #[error("invalid votes extensions verification")] + InvalidVoteExtensionsVerification, /// Cannot load withdrawal transactions #[error("cannot load withdrawal transactions: {0}")] WithdrawalTransactionsDBLoadError(String), @@ -45,6 +54,14 @@ pub enum AbciError { #[error("bad commit signature: {0}")] BadCommitSignature(String), + /// The chain lock received was invalid + #[error("invalid chain lock: {0}")] + InvalidChainLock(String), + + /// The chain lock received was invalid + #[error("chain lock is for a block not known by core: {0}")] + ChainLockedBlockNotKnownByCore(String), + /// Error returned by Tenderdash-abci library #[error("tenderdash: {0}")] Tenderdash(#[from] tenderdash_abci::Error), @@ -61,14 +78,16 @@ pub enum AbciError { #[error("bls error from Tenderdash for threshold mechanisms: {1}: {0}")] BlsErrorOfTenderdashThresholdMechanism(BlsError, String), - /// Generic with code should only be used in tests - #[error("generic with code: {0}")] - GenericWithCode(u32), -} + /// Incompatibility version Error on info handshake between Drive ABCI and Tenderdash + #[error("ABCI version mismatch. Tenderdash requires ABCI protobuf definitions version {tenderdash}, our version is {drive}")] + AbciVersionMismatch { + /// ABCI version in Tenderdash + tenderdash: String, + /// ABCI version in Drive ABCI + drive: String, + }, -// used by `?` operator -impl From for String { - fn from(value: AbciError) -> Self { - value.to_string() - } + /// Generic with code should only be used in tests + #[error("invalid state transition error: {0}")] + InvalidStateTransition(#[from] ConsensusError), } diff --git a/packages/rs-drive-abci/src/abci/handler/check_tx.rs b/packages/rs-drive-abci/src/abci/handler/check_tx.rs new file mode 100644 index 00000000000..bcad2ba2b42 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/check_tx.rs @@ -0,0 +1,176 @@ +use crate::abci::handler::error::consensus::AbciResponseInfoGetter; +use crate::abci::handler::error::HandlerError; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::metrics::{LABEL_ABCI_RESPONSE_CODE, LABEL_CHECK_TX_MODE, LABEL_STATE_TRANSITION_NAME}; +use crate::platform_types::platform::{Platform, PlatformRef}; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::rpc::core::CoreRPCLike; +use dpp::consensus::codes::ErrorWithCode; +use dpp::fee::SignedCredits; +use dpp::util::hash::hash_single; +use metrics::Label; +use tenderdash_abci::proto::abci as proto; + +pub fn check_tx( + platform: &Platform, + core_rpc: &C, + request: proto::RequestCheckTx, +) -> Result +where + C: CoreRPCLike, +{ + let mut timer = crate::metrics::abci_request_duration("check_tx"); + + let platform_state = platform.state.load(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc, + }; + + let platform_version = platform_state.current_platform_version()?; + + let proto::RequestCheckTx { tx, r#type } = request; + + let validation_result = platform.check_tx( + tx.as_slice(), + r#type.try_into()?, + &platform_ref, + platform_version, + ); + + validation_result + .and_then(|validation_result| { + let (check_tx_result, errors) = + validation_result.into_data_and_errors().map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "validation result should contain check tx result", + )) + })?; + + let first_consensus_error = errors.first(); + + let (code, info) = if let Some(consensus_error) = first_consensus_error { + ( + consensus_error.code(), + consensus_error.response_info_for_version(platform_version)?, + ) + } else { + // If there are no execution errors the code will be 0 + (0, "".to_string()) + }; + + let gas_wanted = check_tx_result + .fee_result + .as_ref() + .map(|fee_result| fee_result.total_base_fee()) + .unwrap_or_default(); + + // Todo: IMPORTANT We need tenderdash to support multiple senders + let first_unique_identifier = check_tx_result + .unique_identifiers + .first() + .cloned() + .unwrap_or_default(); + + let state_transition_name = check_tx_result + .state_transition_name + .clone() + .unwrap_or_else(|| "Unknown".to_string()); + + let priority = check_tx_result.priority as i64; + + if tracing::enabled!(tracing::Level::TRACE) { + let message = match (r#type, code) { + (0, 0) => "added to mempool".to_string(), + (1, 0) => "kept in mempool after re-check".to_string(), + (0, _) => format!( + "rejected with code {code} due to error: {}", + first_consensus_error.ok_or_else(|| Error::Execution( + ExecutionError::CorruptedCodeExecution( + "consensus error must be present with non-zero error code" + ) + ))? + ), + (1, _) => format!( + "removed from mempool with code {code} after re-check due to error: {}", + first_consensus_error.ok_or_else(|| Error::Execution( + ExecutionError::CorruptedCodeExecution( + "consensus error must be present with non-zero error code" + ) + ))? + ), + _ => { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we have only 2 modes of check tx", + ))) + } + }; + + let state_transition_hash = + check_tx_result.state_transition_hash.ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "state transition hash must be present if trace level is enabled", + )) + })?; + + let st_hash = hex::encode(state_transition_hash); + + tracing::trace!( + ?check_tx_result, + error = ?first_consensus_error, + st_hash, + "{} state transition ({}) {}", + state_transition_name, + st_hash, + message + ); + } + + timer.add_label(Label::new( + LABEL_STATE_TRANSITION_NAME, + state_transition_name, + )); + timer.add_label(Label::new(LABEL_CHECK_TX_MODE, r#type.to_string())); + timer.add_label(Label::new(LABEL_ABCI_RESPONSE_CODE, code.to_string())); + + Ok(proto::ResponseCheckTx { + code, + data: vec![], + info, + gas_wanted: gas_wanted as SignedCredits, + codespace: "".to_string(), + sender: first_unique_identifier, + priority, + }) + }) + .or_else(|error| { + let handler_error = HandlerError::Internal(error.to_string()); + + if tracing::enabled!(tracing::Level::ERROR) { + let st_hash = hex::encode(hash_single(tx)); + + tracing::error!( + ?error, + st_hash, + check_tx_mode = r#type, + "Failed to check state transition ({}): {}", + st_hash, + error + ); + } + + Ok(proto::ResponseCheckTx { + code: handler_error.code(), + data: vec![], + info: handler_error.response_info()?, + gas_wanted: 0 as SignedCredits, + codespace: "".to_string(), + sender: "".to_string(), + priority: 0, + }) + }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/echo.rs b/packages/rs-drive-abci/src/abci/handler/echo.rs new file mode 100644 index 00000000000..7e8f60db3ac --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/echo.rs @@ -0,0 +1,14 @@ +use crate::abci::app::PlatformApplication; +use crate::error::Error; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; + +pub fn echo(_app: &A, request: proto::RequestEcho) -> Result +where + A: PlatformApplication, + C: CoreRPCLike, +{ + Ok(proto::ResponseEcho { + message: request.message, + }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/error/mod.rs b/packages/rs-drive-abci/src/abci/handler/error/mod.rs index 2d7f3a13e77..19735ff6d44 100644 --- a/packages/rs-drive-abci/src/abci/handler/error/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/error/mod.rs @@ -2,12 +2,16 @@ pub mod consensus; use crate::error::query::QueryError; use crate::error::Error; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; use dpp::platform_value::platform_value; use dpp::platform_value::string_encoding::{encode, Encoding}; -use tenderdash_abci::proto::abci::ResponseException; +use tenderdash_abci::proto::abci as proto; /// ABCI handlers errors #[derive(Debug, thiserror::Error)] +// Allow dead code, as the majority of these errors are reserved for future use +#[allow(dead_code)] pub enum HandlerError { /// ABCI Handler error (Cancelled) #[error("{0}")] @@ -57,6 +61,9 @@ pub enum HandlerError { /// ABCI Handler error (Unauthenticated) #[error("{0}")] Unauthenticated(String), + /// State Transition processing consensus error + #[error(transparent)] + StateTransitionConsensusError(ConsensusError), } /// Error codes for ABCI handlers @@ -99,60 +106,59 @@ pub enum HandlerErrorCode { impl HandlerError { /// Returns ABCI handler error code pub fn code(&self) -> u32 { - let code = match self { - HandlerError::Cancelled(_) => HandlerErrorCode::Cancelled, - HandlerError::Unknown(_) => HandlerErrorCode::Unknown, - HandlerError::InvalidArgument(_) => HandlerErrorCode::InvalidArgument, - HandlerError::DeadlineExceeded(_) => HandlerErrorCode::DeadlineExceeded, - HandlerError::NotFound(_) => HandlerErrorCode::NotFound, - HandlerError::AlreadyExists(_) => HandlerErrorCode::AlreadyExists, - HandlerError::PermissionDenied(_) => HandlerErrorCode::PermissionDenied, - HandlerError::ResourceExhausted(_) => HandlerErrorCode::ResourceExhausted, - HandlerError::FailedPrecondition(_) => HandlerErrorCode::FailedPrecondition, - HandlerError::Aborted(_) => HandlerErrorCode::Aborted, - HandlerError::OutOfRange(_) => HandlerErrorCode::OutOfRange, - HandlerError::Unimplemented(_) => HandlerErrorCode::Unimplemented, - HandlerError::Internal(_) => HandlerErrorCode::Internal, - HandlerError::Unavailable(_) => HandlerErrorCode::Unavailable, - HandlerError::DataLoss(_) => HandlerErrorCode::DataLoss, - HandlerError::Unauthenticated(_) => HandlerErrorCode::Unauthenticated, - }; - - code as u32 + match self { + HandlerError::Cancelled(_) => HandlerErrorCode::Cancelled as u32, + HandlerError::Unknown(_) => HandlerErrorCode::Unknown as u32, + HandlerError::InvalidArgument(_) => HandlerErrorCode::InvalidArgument as u32, + HandlerError::DeadlineExceeded(_) => HandlerErrorCode::DeadlineExceeded as u32, + HandlerError::NotFound(_) => HandlerErrorCode::NotFound as u32, + HandlerError::AlreadyExists(_) => HandlerErrorCode::AlreadyExists as u32, + HandlerError::PermissionDenied(_) => HandlerErrorCode::PermissionDenied as u32, + HandlerError::ResourceExhausted(_) => HandlerErrorCode::ResourceExhausted as u32, + HandlerError::FailedPrecondition(_) => HandlerErrorCode::FailedPrecondition as u32, + HandlerError::Aborted(_) => HandlerErrorCode::Aborted as u32, + HandlerError::OutOfRange(_) => HandlerErrorCode::OutOfRange as u32, + HandlerError::Unimplemented(_) => HandlerErrorCode::Unimplemented as u32, + HandlerError::Internal(_) => HandlerErrorCode::Internal as u32, + HandlerError::Unavailable(_) => HandlerErrorCode::Unavailable as u32, + HandlerError::DataLoss(_) => HandlerErrorCode::DataLoss as u32, + HandlerError::Unauthenticated(_) => HandlerErrorCode::Unauthenticated as u32, + HandlerError::StateTransitionConsensusError(error) => error.code(), + } } /// Returns error message - pub fn message(&self) -> &str { + pub fn message(&self) -> String { match self { - HandlerError::Cancelled(message) => message, - HandlerError::Unknown(message) => message, - HandlerError::InvalidArgument(message) => message, - HandlerError::DeadlineExceeded(message) => message, - HandlerError::NotFound(message) => message, - HandlerError::AlreadyExists(message) => message, - HandlerError::PermissionDenied(message) => message, - HandlerError::ResourceExhausted(message) => message, - HandlerError::FailedPrecondition(message) => message, - HandlerError::Aborted(message) => message, - HandlerError::OutOfRange(message) => message, - HandlerError::Unimplemented(message) => message, - HandlerError::Internal(message) => message, - HandlerError::Unavailable(message) => message, - HandlerError::DataLoss(message) => message, - HandlerError::Unauthenticated(message) => message, + HandlerError::Cancelled(message) => message.to_owned(), + HandlerError::Unknown(message) => message.to_owned(), + HandlerError::InvalidArgument(message) => message.to_owned(), + HandlerError::DeadlineExceeded(message) => message.to_owned(), + HandlerError::NotFound(message) => message.to_owned(), + HandlerError::AlreadyExists(message) => message.to_owned(), + HandlerError::PermissionDenied(message) => message.to_owned(), + HandlerError::ResourceExhausted(message) => message.to_owned(), + HandlerError::FailedPrecondition(message) => message.to_owned(), + HandlerError::Aborted(message) => message.to_owned(), + HandlerError::OutOfRange(message) => message.to_owned(), + HandlerError::Unimplemented(message) => message.to_owned(), + HandlerError::Internal(message) => message.to_owned(), + HandlerError::Unavailable(message) => message.to_owned(), + HandlerError::DataLoss(message) => message.to_owned(), + HandlerError::Unauthenticated(message) => message.to_owned(), + HandlerError::StateTransitionConsensusError(error) => error.to_string(), } } /// Returns base64-encoded message for info field of ABCI handler responses - pub fn response_info(&self) -> Result { + pub fn response_info(&self) -> Result { let error_data_buffer = platform_value!({ - "message": self.message().to_string(), + "message": self.message(), // TODO: consider capturing stack with one of the libs // and send it to the client //"stack": "..." }) - .to_cbor_buffer() - .map_err(|e| ResponseException::from(Error::Protocol(e.into())))?; + .to_cbor_buffer()?; let error_data_base64 = encode(&error_data_buffer, Encoding::Base64); @@ -172,3 +178,21 @@ impl From<&QueryError> for HandlerError { } } } + +impl From<&ConsensusError> for HandlerError { + fn from(value: &ConsensusError) -> Self { + Self::StateTransitionConsensusError(value.to_owned()) + } +} + +impl From<&Error> for HandlerError { + fn from(value: &Error) -> Self { + Self::Internal(value.to_string()) + } +} + +pub fn error_into_exception(error: Error) -> proto::ResponseException { + proto::ResponseException { + error: error.to_string(), + } +} diff --git a/packages/rs-drive-abci/src/abci/handler/execution_result.rs b/packages/rs-drive-abci/src/abci/handler/execution_result.rs deleted file mode 100644 index f2ec040a386..00000000000 --- a/packages/rs-drive-abci/src/abci/handler/execution_result.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::abci::handler::error::consensus::AbciResponseInfoGetter; -use crate::error::Error; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; -use dpp::consensus::codes::ErrorWithCode; -use dpp::fee::SignedCredits; -use dpp::version::PlatformVersion; -use dpp::version::TryIntoPlatformVersioned; -use tenderdash_abci::proto::abci::ExecTxResult; - -// State transitions are never free, so we should filter out SuccessfulFreeExecution -// So we use an option -impl TryIntoPlatformVersioned for StateTransitionExecutionResult { - type Error = Error; - - fn try_into_platform_versioned( - self, - platform_version: &PlatformVersion, - ) -> Result { - let response = match self { - Self::SuccessfulPaidExecution(dry_run_fee_result, fee_result) => ExecTxResult { - code: 0, - data: vec![], - log: "".to_string(), - info: "".to_string(), - gas_wanted: dry_run_fee_result.total_base_fee() as SignedCredits, - gas_used: fee_result.total_base_fee() as SignedCredits, - events: vec![], - codespace: "".to_string(), - }, - Self::SuccessfulFreeExecution => ExecTxResult { - code: 0, - data: vec![], - log: "".to_string(), - info: "".to_string(), - gas_wanted: 0, - gas_used: 0, - events: vec![], - codespace: "".to_string(), - }, - Self::ConsensusExecutionError(validation_result) => { - let error = validation_result - .errors - .first() - .expect("invalid execution result should have a consensus error"); - - ExecTxResult { - code: error.code(), - data: vec![], - log: "".to_string(), - info: error.response_info_for_version(platform_version)?, - gas_wanted: 0, - gas_used: 0, - events: vec![], - codespace: "".to_string(), - } - } - }; - - Ok(response) - } -} diff --git a/packages/rs-drive-abci/src/abci/handler/extend_vote.rs b/packages/rs-drive-abci/src/abci/handler/extend_vote.rs new file mode 100644 index 00000000000..4dc4e26edfd --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/extend_vote.rs @@ -0,0 +1,53 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::AbciError; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_state_info::v0::{ + BlockStateInfoV0Getters, BlockStateInfoV0Methods, +}; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; + +pub fn extend_vote<'a, A, C>( + app: &A, + request: proto::RequestExtendVote, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let _timer = crate::metrics::abci_request_duration("extend_vote"); + + let proto::RequestExtendVote { + hash: block_hash, + height, + round, + } = request; + let block_execution_context_guard = app.block_execution_context().read().unwrap(); + let block_execution_context = + block_execution_context_guard + .as_ref() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "block execution context must be set in block begin handler for extend votes", + )))?; + + // Verify Tenderdash that it called this handler correctly + let block_state_info = &block_execution_context.block_state_info(); + + if !block_state_info.matches_current_block(height as u64, round as u32, block_hash.clone())? { + return Err(AbciError::RequestForWrongBlockReceived(format!( + "received extend votes request for height: {} round: {}, block: {}; expected height: {} round: {}, block: {}", + height, round, hex::encode(block_hash), + block_state_info.height(), block_state_info.round(), block_state_info.block_hash().map(hex::encode).unwrap_or("None".to_string()) + )).into()); + } + + // Extend votes with unsigned withdrawal transactions + // we only want to sign the hash of the transaction + let vote_extensions = block_execution_context + .unsigned_withdrawal_transactions() + .into(); + + Ok(proto::ResponseExtendVote { vote_extensions }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/finalize_block.rs b/packages/rs-drive-abci/src/abci/handler/finalize_block.rs new file mode 100644 index 00000000000..9653391c7d5 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/finalize_block.rs @@ -0,0 +1,76 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::platform_types::cleaned_abci_messages::finalized_block_cleaned_request::v0::FinalizeBlockCleanedRequest; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::rpc::core::CoreRPCLike; +use std::sync::atomic::Ordering; +use tenderdash_abci::proto::abci as proto; + +pub fn finalize_block<'a, A, C>( + app: &A, + request: proto::RequestFinalizeBlock, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let _timer = crate::metrics::abci_request_duration("finalize_block"); + + let transaction_guard = app.transaction().read().unwrap(); + let transaction = + transaction_guard + .as_ref() + .ok_or(Error::Execution(ExecutionError::NotInTransaction( + "trying to finalize block without a current transaction", + )))?; + + // Get current block platform version + let block_execution_context = app + .block_execution_context() + .write() + .unwrap() + .take() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "block execution context must be set in block begin handler for finalize block", + )))?; + + let platform_version = block_execution_context + .block_platform_state() + .current_platform_version()?; + + let request_finalize_block: FinalizeBlockCleanedRequest = request.try_into()?; + + let block_height = request_finalize_block.height; + + let block_finalization_outcome = app.platform().finalize_block_proposal( + request_finalize_block, + block_execution_context, + transaction, + platform_version, + )?; + + drop(transaction_guard); + + //FIXME: tell tenderdash about the problem instead + // This can not go to production! + if !block_finalization_outcome.validation_result.is_valid() { + return Err(Error::Abci( + block_finalization_outcome + .validation_result + .errors + .into_iter() + .next() + .unwrap(), + )); + } + + app.commit_transaction(platform_version)?; + + app.platform() + .committed_block_height_guard + .store(block_height, Ordering::Relaxed); + + Ok(proto::ResponseFinalizeBlock { retain_height: 0 }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/info.rs b/packages/rs-drive-abci/src/abci/handler/info.rs new file mode 100644 index 00000000000..ea8aad0eec3 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/info.rs @@ -0,0 +1,57 @@ +use crate::abci::app::PlatformApplication; +use crate::abci::AbciError; +use crate::error::Error; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use tenderdash_abci::proto::abci as proto; + +pub fn info(app: &A, request: proto::RequestInfo) -> Result +where + A: PlatformApplication, + C: CoreRPCLike, +{ + if !tenderdash_abci::check_version(&request.abci_version) { + return Err(AbciError::AbciVersionMismatch { + tenderdash: request.abci_version, + drive: tenderdash_abci::proto::ABCI_VERSION.to_string(), + } + .into()); + } + + let platform_state = app.platform().state.load(); + + let state_app_hash = platform_state + .last_committed_block_app_hash() + .map(|app_hash| app_hash.to_vec()) + .unwrap_or_default(); + + let latest_supported_protocol_version = PlatformVersion::latest().protocol_version; + + let response = proto::ResponseInfo { + data: "".to_string(), + app_version: latest_supported_protocol_version as u64, + last_block_height: platform_state.last_committed_block_height() as i64, + version: env!("CARGO_PKG_VERSION").to_string(), + last_block_app_hash: state_app_hash.clone(), + }; + + tracing::debug!( + latest_supported_protocol_version, + software_version = env!("CARGO_PKG_VERSION"), + block_version = request.block_version, + p2p_version = request.p2p_version, + app_hash = hex::encode(state_app_hash), + height = platform_state.last_committed_block_height(), + "Handshake with consensus engine", + ); + + if tracing::enabled!(tracing::Level::TRACE) { + tracing::trace!( + platform_state_fingerprint = hex::encode(platform_state.fingerprint()?), + "platform runtime state", + ); + } + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/init_chain.rs b/packages/rs-drive-abci/src/abci/handler/init_chain.rs new file mode 100644 index 00000000000..a62a26021cb --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/init_chain.rs @@ -0,0 +1,42 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::error::Error; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; + +pub fn init_chain<'a, A, C>( + app: &A, + request: proto::RequestInitChain, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + app.start_transaction(); + + let transaction_guard = app.transaction().read().unwrap(); + let transaction = transaction_guard + .as_ref() + .expect("transaction must be started"); + + // We need to drop the block execution context just in case init chain had already been called + let block_context = app.block_execution_context().write().unwrap().take(); //drop the block execution context + if block_context.is_some() { + tracing::warn!("block context was present during init chain, dropping it"); + } + + let chain_id = request.chain_id.to_string(); + + let response = app.platform().init_chain(request, transaction)?; + + transaction.set_savepoint(); + + let app_hash = hex::encode(&response.app_hash); + + tracing::info!( + app_hash, + chain_id, + "Platform chain initialized, initial state is created" + ); + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 3235b7d59cd..8acd0737ebe 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -35,1349 +35,23 @@ //! can only make changes that are backwards compatible. Otherwise new calls must be made instead. //! -mod error; -mod execution_result; - -use crate::abci::server::AbciApplication; -use crate::error::execution::ExecutionError; - -use crate::error::Error; -use crate::rpc::core::CoreRPCLike; -use dpp::errors::consensus::codes::ErrorWithCode; -use tenderdash_abci::proto::abci as proto; -use tenderdash_abci::proto::abci::response_verify_vote_extension::VerifyStatus; -use tenderdash_abci::proto::abci::tx_record::TxAction; -use tenderdash_abci::proto::abci::{ - ExecTxResult, RequestCheckTx, RequestFinalizeBlock, RequestInitChain, RequestPrepareProposal, - RequestProcessProposal, RequestQuery, ResponseCheckTx, ResponseFinalizeBlock, - ResponseInitChain, ResponsePrepareProposal, ResponseProcessProposal, ResponseQuery, TxRecord, -}; -use tenderdash_abci::proto::types::VoteExtensionType; - -use super::AbciError; - -use crate::execution::types::block_execution_context::v0::{ - BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, - BlockExecutionContextV0Setters, -}; -use crate::execution::types::block_state_info::v0::{ - BlockStateInfoV0Getters, BlockStateInfoV0Methods, BlockStateInfoV0Setters, -}; -use crate::platform_types::block_execution_outcome; -use crate::platform_types::block_proposal::v0::BlockProposal; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; -use crate::platform_types::withdrawal::withdrawal_txs; -use dpp::dashcore::hashes::Hash; -use dpp::fee::SignedCredits; -use dpp::version::TryIntoPlatformVersioned; -use dpp::version::{PlatformVersion, PlatformVersionCurrentVersion}; -use error::consensus::AbciResponseInfoGetter; -use error::HandlerError; - -impl<'a, C> tenderdash_abci::Application for AbciApplication<'a, C> -where - C: CoreRPCLike, -{ - fn info( - &self, - request: proto::RequestInfo, - ) -> Result { - let state_guard = self.platform.state.read().unwrap(); - - if !tenderdash_abci::check_version(&request.abci_version) { - return Err(proto::ResponseException::from(format!( - "tenderdash requires ABCI version {}, our version is {}", - request.abci_version, - tenderdash_abci::proto::ABCI_VERSION - ))); - } - - let state_app_hash = state_guard - .last_block_app_hash() - .map(|app_hash| app_hash.to_vec()) - .unwrap_or_default(); - - let latest_platform_version = PlatformVersion::latest(); - - let response = proto::ResponseInfo { - data: "".to_string(), - app_version: latest_platform_version.protocol_version as u64, - last_block_height: state_guard.last_block_height() as i64, - version: env!("CARGO_PKG_VERSION").to_string(), - last_block_app_hash: state_app_hash.clone(), - }; - - tracing::info!( - protocol_version = latest_platform_version.protocol_version, - software_version = env!("CARGO_PKG_VERSION"), - block_version = request.block_version, - p2p_version = request.p2p_version, - app_hash = hex::encode(state_app_hash), - height = state_guard.last_block_height(), - "Consensus engine is started from block {}", - state_guard.last_block_height(), - ); - - if tracing::enabled!(tracing::Level::TRACE) { - tracing::trace!( - platform_state_fingerprint = hex::encode(state_guard.fingerprint()), - "platform runtime state", - ); - } - - Ok(response) - } - - fn init_chain( - &self, - request: RequestInitChain, - ) -> Result { - self.start_transaction(); - let chain_id = request.chain_id.to_string(); - - // We need to drop the block execution context just in case init chain had already been called - let mut block_execution_context = self.platform.block_execution_context.write().unwrap(); - let block_context = block_execution_context.take(); //drop the block execution context - if block_context.is_some() { - tracing::warn!("block context was present during init chain, restarting"); - let protocol_version_in_consensus = self.platform.config.initial_protocol_version; - let mut platform_state_write_guard = self.platform.state.write().unwrap(); - *platform_state_write_guard = PlatformState::default_with_protocol_versions( - protocol_version_in_consensus, - protocol_version_in_consensus, - ); - drop(platform_state_write_guard); - } - drop(block_execution_context); - - let transaction_guard = self.transaction.read().unwrap(); - let transaction = transaction_guard.as_ref().unwrap(); - let response = self.platform.init_chain(request, transaction)?; - - transaction.set_savepoint(); - - let app_hash = hex::encode(&response.app_hash); - - tracing::info!( - app_hash, - chain_id, - "platform chain initialized, initial state is created" - ); - - Ok(response) - } - - fn prepare_proposal( - &self, - mut request: RequestPrepareProposal, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("prepare_proposal"); - - // We should get the latest CoreChainLock from core - // It is possible that we will not get a chain lock from core, in this case, just don't - // propose one - // This is done before all else - - let core_chain_lock_update = match self.platform.core_rpc.get_best_chain_lock() { - Ok(latest_chain_lock) => { - if request.core_chain_locked_height < latest_chain_lock.core_block_height { - Some(latest_chain_lock) - } else { - None - } - } - Err(_) => None, - }; - - // Filter out transactions exceeding max_block_size - let mut transactions_exceeding_max_block_size = Vec::new(); - { - let mut total_transactions_size = 0; - let mut index_to_remove_at = None; - for (i, raw_transaction) in request.txs.iter().enumerate() { - total_transactions_size += raw_transaction.len(); - - if total_transactions_size as i64 > request.max_tx_bytes { - index_to_remove_at = Some(i); - break; - } - } - - if let Some(index_to_remove_at) = index_to_remove_at { - transactions_exceeding_max_block_size - .extend(request.txs.drain(index_to_remove_at..)); - } - } - - let mut block_proposal: BlockProposal = (&request).try_into()?; - - if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { - // We can't add this, as it slows down CI way too much - // todo: find a way to re-enable this without destroying CI - tracing::debug!( - "propose chain lock update to height {} at block {}", - core_chain_lock_update.core_block_height, - request.height - ); - block_proposal.core_chain_locked_height = core_chain_lock_update.core_block_height; - } - - // Prepare transaction - let transaction_guard = if request.height == self.platform.config.abci.genesis_height as i64 - { - // special logic on init chain - let transaction = self.transaction.read().unwrap(); - if transaction.is_none() { - return Err(Error::Abci(AbciError::BadRequest("received a prepare proposal request for the genesis height before an init chain request".to_string())))?; - } - if request.round > 0 { - transaction.as_ref().map(|tx| tx.rollback_to_savepoint()); - } - transaction - } else { - self.start_transaction(); - self.transaction.read().unwrap() - }; - - let transaction = transaction_guard.as_ref().unwrap(); - - // Running the proposal executes all the state transitions for the block - let run_result = self - .platform - .run_block_proposal(block_proposal, transaction)?; - - if !run_result.is_valid() { - // This is a system error, because we are proposing - return Err(run_result.errors.first().unwrap().to_string().into()); - } - - let block_execution_outcome::v0::BlockExecutionOutcome { - app_hash, - state_transition_results, - validator_set_update, - protocol_version, - } = run_result.into_data().map_err(Error::Protocol)?; - - let platform_version = PlatformVersion::get(protocol_version) - .expect("must be set in run block proposal from existing protocol version"); - - // We need to let Tenderdash know about the transactions we should remove from execution - let mut tx_results = Vec::new(); - let mut tx_records = Vec::new(); - let mut valid_txs_count = 0; - let mut invalid_tx_count = 0; - - for (tx, state_transition_execution_result) in state_transition_results { - let tx_result: ExecTxResult = - state_transition_execution_result.try_into_platform_versioned(platform_version)?; - - let action = if tx_result.code > 0 { - invalid_tx_count += 1; - TxAction::Removed - } else { - valid_txs_count += 1; - TxAction::Unmodified - } as i32; - - if action != TxAction::Removed as i32 { - tx_results.push(tx_result); - } - tx_records.push(TxRecord { action, tx }); - } - - let delayed_tx_count = transactions_exceeding_max_block_size.len(); - - // Add up exceeding transactions to the response - tx_records.extend( - transactions_exceeding_max_block_size - .into_iter() - .map(|tx| TxRecord { - action: TxAction::Delayed as i32, - tx, - }), - ); - - // TODO: implement all fields, including tx processing; for now, just leaving bare minimum - let response = ResponsePrepareProposal { - tx_results, - app_hash: app_hash.to_vec(), - tx_records, - core_chain_lock_update, - validator_set_update, - ..Default::default() - }; - - let mut block_execution_context_guard = - self.platform.block_execution_context.write().unwrap(); - - let block_execution_context = block_execution_context_guard - .as_mut() - .expect("expected that a block execution context was set"); - block_execution_context.set_proposer_results(Some(response.clone())); - - tracing::info!( - invalid_tx_count, - valid_txs_count, - delayed_tx_count, - "Prepared proposal with {} transitions for height: {}, round: {}", - valid_txs_count, - request.height, - request.round, - ); - - Ok(response) - } - - fn process_proposal( - &self, - mut request: RequestProcessProposal, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("process_proposal"); - - let mut block_execution_context_guard = - self.platform.block_execution_context.write().unwrap(); - - let mut drop_block_execution_context = false; - if let Some(block_execution_context) = block_execution_context_guard.as_mut() { - // We are already in a block - // This only makes sense if we were the proposer unless we are at a future round - if block_execution_context.block_state_info().round() != (request.round as u32) { - // We were not the proposer, and we should process something new - drop_block_execution_context = true; - } else if let Some(current_block_hash) = - block_execution_context.block_state_info().block_hash() - { - // There is also the possibility that this block already came in, but tenderdash crashed - // Now tenderdash is sending it again - if let Some(proposal_info) = block_execution_context.proposer_results() { - tracing::debug!( - method = "process_proposal", - ?proposal_info, // TODO: It might be too big for debug - "we knew block hash, block execution context already had a proposer result", - ); - // We were the proposer as well, so we have the result in cache - return Ok(ResponseProcessProposal { - status: proto::response_process_proposal::ProposalStatus::Accept.into(), - app_hash: proposal_info.app_hash.clone(), - tx_results: proposal_info.tx_results.clone(), - consensus_param_updates: proposal_info.consensus_param_updates.clone(), - validator_set_update: proposal_info.validator_set_update.clone(), - }); - } - - if current_block_hash.as_slice() == request.hash { - // We were not the proposer, just drop the execution context - tracing::warn!( - method = "process_proposal", - ?request, // Shumkov, lklimek: this structure might be very big and we already logged it such as all other ABCI requests and responses - "block execution context already existed, but we are running it again for same height {}/round {}", - request.height, - request.round, - ); - drop_block_execution_context = true; - } else { - // We are getting a different block hash for a block of the same round - // This is a terrible issue - return Err(Error::Abci(AbciError::BadRequest( - "received a process proposal request twice with different hash".to_string(), - )))?; - } - } else { - let Some(proposal_info) = block_execution_context.proposer_results() else { - return Err(Error::Abci(AbciError::BadRequest( - "received a process proposal request twice".to_string(), - )))?; - }; - - let expected_transactions = proposal_info - .tx_records - .iter() - .filter_map(|record| { - if record.action == TxAction::Removed as i32 - || record.action == TxAction::Delayed as i32 - { - None - } else { - Some(&record.tx) - } - }) - .collect::>(); - - // While it is true that the length could be same, seeing how this is such a rare situation - // It does not seem worth to deal with situations where the length is the same but the transactions have changed - if expected_transactions.len() == request.txs.len() - && proposal_info.core_chain_lock_update == request.core_chain_lock_update - { - let (app_hash, tx_results, consensus_param_updates, validator_set_update) = { - tracing::debug!( - method = "process_proposal", - "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result {:?}", - proposal_info, - ); - - // Cloning all required properties from proposal_info and then dropping it - let app_hash = proposal_info.app_hash.clone(); - let tx_results = proposal_info.tx_results.clone(); - let consensus_param_updates = proposal_info.consensus_param_updates.clone(); - let validator_set_update = proposal_info.validator_set_update.clone(); - ( - app_hash, - tx_results, - consensus_param_updates, - validator_set_update, - ) - }; - - // We need to set the block hash - block_execution_context - .block_state_info_mut() - .set_block_hash(Some(request.hash.clone().try_into().map_err(|_| { - Error::Abci(AbciError::BadRequestDataSize( - "block hash is not 32 bytes in process proposal".to_string(), - )) - })?)); - return Ok(ResponseProcessProposal { - status: proto::response_process_proposal::ProposalStatus::Accept.into(), - app_hash, - tx_results, - consensus_param_updates, - validator_set_update, - }); - } else { - tracing::warn!( - method = "process_proposal", - "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result {:?}, but we are requesting a different amount of transactions, dropping the cache", - proposal_info, - ); - - drop_block_execution_context = true; - }; - } - } - - if drop_block_execution_context { - *block_execution_context_guard = None; - } - drop(block_execution_context_guard); - - // Get transaction - let transaction_guard = if request.height == self.platform.config.abci.genesis_height as i64 - { - // special logic on init chain - let transaction = self.transaction.read().unwrap(); - if transaction.is_none() { - return Err(Error::Abci(AbciError::BadRequest("received a process proposal request for the genesis height before an init chain request".to_string())))?; - } - if request.round > 0 { - transaction.as_ref().map(|tx| tx.rollback_to_savepoint()); - } - transaction - } else { - self.start_transaction(); - self.transaction.read().unwrap() - }; - let transaction = transaction_guard.as_ref().unwrap(); - - // We can take the core chain lock update here because it won't be used anywhere else - if let Some(_c) = request.core_chain_lock_update.take() { - //todo: if there is a core chain lock update we need to validate it - } - - // Running the proposal executes all the state transitions for the block - let run_result = self - .platform - .run_block_proposal((&request).try_into()?, transaction)?; - - if !run_result.is_valid() { - // This was an error running this proposal, tell tenderdash that the block isn't valid - let response = ResponseProcessProposal { - status: proto::response_process_proposal::ProposalStatus::Reject.into(), - ..Default::default() - }; - - tracing::warn!( - errors = ?run_result.errors, - "Rejected invalid proposal for height: {}, round: {}", - request.height, - request.round, - ); - - Ok(response) - } else { - let block_execution_outcome::v0::BlockExecutionOutcome { - app_hash, - state_transition_results, - validator_set_update, - protocol_version, - } = run_result.into_data().map_err(Error::Protocol)?; - - let platform_version = PlatformVersion::get(protocol_version) - .expect("must be set in run block proposer from existing platform version"); - - let mut invalid_tx_count = 0; - let mut valid_tx_count = 0; - - let tx_results = state_transition_results - .into_iter() - .map(|(_, execution_result)| { - let tx_result: ExecTxResult = - execution_result.try_into_platform_versioned(platform_version)?; - - if tx_result.code == 0 { - valid_tx_count += 1; - } else { - invalid_tx_count += 1; - } - - Ok(tx_result) - }) - .collect::, Error>>()?; - - // TODO: implement all fields, including tx processing; for now, just leaving bare minimum - let response = ResponseProcessProposal { - app_hash: app_hash.to_vec(), - tx_results, - status: proto::response_process_proposal::ProposalStatus::Accept.into(), - validator_set_update, - ..Default::default() - }; - - tracing::info!( - invalid_tx_count, - valid_tx_count, - "Processed proposal with {} transactions for height: {}, round: {}", - valid_tx_count, - request.height, - request.round, - ); - - Ok(response) - } - } - - fn extend_vote( - &self, - request: proto::RequestExtendVote, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("extend_vote"); - - let proto::RequestExtendVote { - hash: block_hash, - height, - round, - } = request; - let guarded_block_execution_context = self.platform.block_execution_context.read().unwrap(); - let block_execution_context = - guarded_block_execution_context - .as_ref() - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "block execution context must be set in block begin handler for extend vote", - )))?; - - // Verify Tenderdash that it called this handler correctly - let block_state_info = &block_execution_context.block_state_info(); - - if !block_state_info.matches_current_block( - height as u64, - round as u32, - block_hash.clone(), - )? { - Err(Error::from(AbciError::RequestForWrongBlockReceived(format!( - "received extend vote request for height: {} round: {}, block: {}; expected height: {} round: {}, block: {}", - height, round, hex::encode(block_hash), - block_state_info.height(), block_state_info.round(), block_state_info.block_hash().map(hex::encode).unwrap_or("None".to_string()) - ))) - .into()) - } else { - // we only want to sign the hash of the transaction - let extensions = block_execution_context - .withdrawal_transactions() - .keys() - .map(|tx_id| proto::ExtendVoteExtension { - r#type: VoteExtensionType::ThresholdRecover as i32, - extension: tx_id.to_byte_array().to_vec(), - }) - .collect(); - Ok(proto::ResponseExtendVote { - vote_extensions: extensions, - }) - } - } - - /// Todo: Verify vote extension not really needed because extend vote is deterministic - fn verify_vote_extension( - &self, - request: proto::RequestVerifyVoteExtension, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("verify_vote_extension"); - - let proto::RequestVerifyVoteExtension { - height, - round, - vote_extensions, - .. - } = request; - - let guarded_block_execution_context = self.platform.block_execution_context.read().unwrap(); - let block_execution_context = - guarded_block_execution_context - .as_ref() - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "block execution context must be set in block begin handler for verify vote extension", - )))?; - - let platform_version = block_execution_context - .block_platform_state() - .current_platform_version()?; - - let got: withdrawal_txs::v0::WithdrawalTxs = vote_extensions.into(); - let expected = block_execution_context - .withdrawal_transactions() - .keys() - .map(|tx_id| proto::ExtendVoteExtension { - r#type: VoteExtensionType::ThresholdRecover as i32, - extension: tx_id.to_byte_array().to_vec(), - }) - .collect::>() - .into(); - - // let state = self.platform.state.read().unwrap(); - // - // let quorum = state.current_validator_set()?; - - // let validator_pro_tx_hash = ProTxHash::from_slice(validator_pro_tx_hash.as_slice()) - // .map_err(|_| { - // Error::Abci(AbciError::BadRequestDataSize(format!( - // "invalid vote extension protxhash: {}", - // hex::encode(validator_pro_tx_hash.as_slice()) - // ))) - // })?; - // - // let Some(validator) = quorum.validator_set.get(&validator_pro_tx_hash) else { - // return Ok(proto::ResponseVerifyVoteExtension { - // status: VerifyStatus::Unknown.into(), - // }); - // }; - - let validation_result = self.platform.check_withdrawals( - &got, - &expected, - height as u64, - round as u32, - None, - None, - platform_version, - )?; - - if validation_result.is_valid() { - Ok(proto::ResponseVerifyVoteExtension { - status: VerifyStatus::Accept.into(), - }) - } else { - tracing::error!( - ?got, - ?expected, - ?validation_result.errors, - "vote extension mismatch" - ); - Ok(proto::ResponseVerifyVoteExtension { - status: VerifyStatus::Reject.into(), - }) - } - } - - fn finalize_block( - &self, - request: RequestFinalizeBlock, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("finalize_block"); - - let transaction_guard = self.transaction.read().unwrap(); - - let transaction = transaction_guard.as_ref().ok_or(Error::Execution( - ExecutionError::NotInTransaction( - "trying to finalize block without a current transaction", - ), - ))?; - - let block_finalization_outcome = self - .platform - .finalize_block_proposal(request.try_into()?, transaction)?; - - //FIXME: tell tenderdash about the problem instead - // This can not go to production! - if !block_finalization_outcome.validation_result.is_valid() { - return Err(Error::Abci( - block_finalization_outcome - .validation_result - .errors - .into_iter() - .next() - .unwrap(), - ) - .into()); - } - - drop(transaction_guard); - - self.commit_transaction()?; - - Ok(ResponseFinalizeBlock { - events: vec![], - retain_height: 0, - }) - } - - fn check_tx( - &self, - request: RequestCheckTx, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("check_tx"); - - let RequestCheckTx { tx, .. } = request; - match self.platform.check_tx(tx.as_slice()) { - Ok(validation_result) => { - let platform_state = self.platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version()?; - let first_consensus_error = validation_result.errors.first(); - - let (code, info) = if let Some(consensus_error) = first_consensus_error { - ( - consensus_error.code(), - consensus_error - .response_info_for_version(platform_version) - .map_err(proto::ResponseException::from)?, - ) - } else { - // If there are no execution errors the code will be 0 - (0, "".to_string()) - }; - - let gas_wanted = validation_result - .data - .map(|fee_result| fee_result.total_base_fee()) - .unwrap_or_default(); - - Ok(ResponseCheckTx { - code, - data: vec![], - info, - gas_wanted: gas_wanted as SignedCredits, - codespace: "".to_string(), - sender: "".to_string(), - priority: 0, - }) - } - Err(error) => { - let handler_error = HandlerError::Internal(error.to_string()); - - tracing::error!(?error, "check_tx failed"); - - Ok(ResponseCheckTx { - code: handler_error.code(), - data: vec![], - info: handler_error.response_info()?, - gas_wanted: 0 as SignedCredits, - codespace: "".to_string(), - sender: "".to_string(), - priority: 0, - }) - } - } - } - - fn query(&self, request: RequestQuery) -> Result { - let _timer = crate::metrics::abci_request_duration("query"); - - let RequestQuery { data, path, .. } = &request; - - // TODO: It must be proto::ResponseException - let Some(platform_version) = PlatformVersion::get_maybe_current() else { - let handler_error = - HandlerError::Unavailable("platform is not initialized".to_string()); - - let response = ResponseQuery { - code: handler_error.code(), - log: "".to_string(), - info: handler_error.response_info()?, - index: 0, - key: vec![], - value: vec![], - proof_ops: None, - height: self.platform.state.read().unwrap().height() as i64, - codespace: "".to_string(), - }; - - tracing::error!(?response, "platform version not initialized"); - - return Ok(response); - }; - - let result = self - .platform - .query(path.as_str(), data.as_slice(), platform_version)?; - - let (code, data, info) = if result.is_valid() { - (0, result.data.unwrap_or_default(), "success".to_string()) - } else { - let error = result - .errors - .first() - .expect("validation result should have at least one error"); - - let handler_error = HandlerError::from(error); - - (handler_error.code(), vec![], handler_error.response_info()?) - }; - - let response = ResponseQuery { - //todo: right now just put GRPC error codes, - // later we will use own error codes - code, - log: "".to_string(), - info, - index: 0, - key: vec![], - value: data, - proof_ops: None, - height: self.platform.state.read().unwrap().height() as i64, - codespace: "".to_string(), - }; - - Ok(response) - } -} -// -// #[cfg(test)] -// mod tests { -// mod handlers { -// use crate::config::PlatformConfig; -// use crate::rpc::core::MockCoreRPCLike; -// use chrono::{Duration, Utc}; -// use dashcore_rpc::dashcore::hashes::hex::FromHex; -// use dashcore_rpc::dashcore::BlockHash; -// use dpp::contracts::withdrawals_contract; -// -// use dpp::identity::core_script::CoreScript; -// use dpp::identity::state_transition::identity_credit_withdrawal_transition::Pooling; -// use dpp::platform_value::{platform_value, BinaryData}; -// use dpp::prelude::Identifier; -// use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; -// use dpp::tests::fixtures::get_withdrawal_document_fixture; -// use dpp::util::hash; -// use drive::common::helpers::identities::create_test_masternode_identities; -// use dpp::block::block_info::BlockInfo; -// use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -// use drive::fee::epoch::CreditsPerEpoch; -// use drive::fee_pools::epochs::Epoch; -// use drive::tests::helpers::setup::setup_document; -// use rust_decimal::prelude::ToPrimitive; -// use serde_json::json; -// use std::cmp::Ordering; -// use std::ops::Div; -// use tenderdash_abci::Application; -// use tenderdash_abci::proto::abci::{RequestPrepareProposal, RequestProcessProposal}; -// use tenderdash_abci::proto::google::protobuf::Timestamp; -// -// use crate::abci::messages::{ -// AfterFinalizeBlockRequest, BlockBeginRequest, BlockEndRequest, BlockFees, -// }; -// use crate::platform::Platform; -// use crate::test::fixture::abci::static_init_chain_request; -// use crate::test::helpers::fee_pools::create_test_masternode_share_identities_and_documents; -// use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; -// -// -// fn prepare_withdrawal_test(platform: &TempPlatform) { -// let transaction = platform.drive.grove.start_transaction(); -// //this should happen after -// let data_contract = load_system_data_contract(SystemDataContract::Withdrawals) -// .expect("to load system data contract"); -// -// // Init withdrawal requests -// let withdrawals: Vec = (0..16) -// .map(|index: u64| (index.to_be_bytes().to_vec(), vec![index as u8; 32])) -// .collect(); -// -// let owner_id = Identifier::new([1u8; 32]); -// -// for (_, tx_bytes) in withdrawals.iter() { -// let tx_id = hash::hash(tx_bytes); -// -// let document = get_withdrawal_document_fixture( -// &data_contract, -// owner_id, -// platform_value!({ -// "amount": 1000u64, -// "coreFeePerByte": 1u32, -// "pooling": Pooling::Never as u8, -// "outputScript": CoreScript::from_bytes((0..23).collect::>()), -// "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, -// "transactionIndex": 1u64, -// "transactionSignHeight": 93u64, -// "transactionId": BinaryData::new(tx_id), -// }), -// None, -// ) -// .expect("expected withdrawal document"); -// -// let document_type = data_contract -// .document_type(withdrawals_contract::document_types::WITHDRAWAL) -// .expect("expected to get document type"); -// -// setup_document( -// &platform.drive, -// &document, -// &data_contract, -// document_type, -// Some(&transaction), -// ); -// } -// -// let block_info = BlockInfo { -// time_ms: 1, -// height: 1, -// epoch: Epoch::new(1).unwrap(), -// }; -// -// let mut drive_operations = vec![]; -// -// platform -// .drive -// .add_enqueue_withdrawal_transaction_operations(&withdrawals, &mut drive_operations); -// -// platform -// .drive -// .apply_drive_operations(drive_operations, true, &block_info, Some(&transaction)) -// .expect("to apply drive operations"); -// -// platform.drive.grove.commit_transaction(transaction).unwrap().expect("expected to commit transaction") -// } -// -// #[test] -// fn test_abci_flow_with_withdrawals() { -// let mut platform = TestPlatformBuilder::new() -// .with_config(PlatformConfig { -// verify_sum_trees: false, -// ..Default::default() -// }) -// .build_with_mock_rpc(); -// -// let mut core_rpc_mock = MockCoreRPCLike::new(); -// -// core_rpc_mock -// .expect_get_block_hash() -// // .times(total_days) -// .returning(|_| { -// Ok(BlockHash::from_hex( -// "0000000000000000000000000000000000000000000000000000000000000000", -// ) -// .unwrap()) -// }); -// -// core_rpc_mock -// .expect_get_block_json() -// // .times(total_days) -// .returning(|_| Ok(json!({}))); -// -// platform.core_rpc = core_rpc_mock; -// -// // init chain -// let init_chain_request = static_init_chain_request(); -// -// platform -// .init_chain(init_chain_request) -// .expect("should init chain"); -// -// prepare_withdrawal_test(&platform); -// -// let transaction = platform.drive.grove.start_transaction(); -// -// // setup the contract -// let contract = platform.create_mn_shares_contract(Some(&transaction)); -// -// let genesis_time = Utc::now(); -// -// let total_days = 29; -// -// let epoch_1_start_day = 18; -// -// let blocks_per_day = 50i64; -// -// let epoch_1_start_block = 13; -// -// let proposers_count = 50u16; -// -// let storage_fees_per_block = 42000; -// -// // and create masternode identities -// let proposers = create_test_masternode_identities( -// &platform.drive, -// proposers_count, -// Some(51), -// Some(&transaction), -// ); -// -// create_test_masternode_share_identities_and_documents( -// &platform.drive, -// &contract, -// &proposers, -// Some(53), -// Some(&transaction), -// ); -// -// platform.drive.grove.commit_transaction(transaction).unwrap().expect("expected to commit transaction"); -// -// let block_interval = 86400i64.div(blocks_per_day); -// -// let mut previous_block_time_ms: Option = None; -// -// // process blocks -// for day in 0..total_days { -// for block_num in 0..blocks_per_day { -// let block_time = if day == 0 && block_num == 0 { -// genesis_time -// } else { -// genesis_time -// + Duration::days(day as i64) -// + Duration::seconds(block_interval * block_num) -// }; -// -// let block_height = 1 + (blocks_per_day as u64 * day as u64) + block_num as u64; -// -// let block_time_ms = block_time -// .timestamp_millis() -// .to_u64() -// .expect("block time can not be before 1970"); -// -// //todo: before we had total_hpmns, where should we put it -// let request_process_proposal = RequestPrepareProposal { -// max_tx_bytes: 0, -// txs: vec![], -// local_last_commit: None, -// misbehavior: vec![], -// height: block_height as i64, -// round: 0, -// time: Some(Timestamp { -// seconds: (block_time_ms / 1000) as i64, -// nanos: ((block_time_ms % 1000) * 1000) as i32, -// }), -// next_validators_hash: [0u8;32].to_vec(), -// core_chain_locked_height: 1, -// proposer_pro_tx_hash: proposers -// .get(block_height as usize % (proposers_count as usize)) -// .unwrap().to_vec(), -// proposed_app_version: 1, -// version: None, -// quorum_hash: [0u8;32].to_vec(), -// }; -// -// // We are going to process the proposal, during processing we expect internal -// // subroutines to take place, these subroutines will create the transactions -// let process_proposal_response = platform -// .process_proposal(block_begin_request) -// .unwrap_or_else(|e| { -// panic!( -// "should begin process block #{} for day #{} : {:?}", -// block_height, day, e -// ) -// }); -// -// // Set previous block time -// previous_block_time_ms = Some(block_time_ms); -// -// // Should calculate correct current epochs -// let (epoch_index, epoch_change) = if day > epoch_1_start_day { -// (1, false) -// } else if day == epoch_1_start_day { -// match block_num.cmp(&epoch_1_start_block) { -// Ordering::Less => (0, false), -// Ordering::Equal => (1, true), -// Ordering::Greater => (1, false), -// } -// } else if day == 0 && block_num == 0 { -// (0, true) -// } else { -// (0, false) -// }; -// -// assert_eq!( -// block_begin_response.epoch_info.current_epoch_index, -// epoch_index -// ); -// -// assert_eq!( -// block_begin_response.epoch_info.is_epoch_change, -// epoch_change -// ); -// -// if day == 0 && block_num == 0 { -// let unsigned_withdrawal_hexes = block_begin_response -// .unsigned_withdrawal_transactions -// .iter() -// .map(hex::encode) -// .collect::>(); -// -// assert_eq!(unsigned_withdrawal_hexes, vec![ -// "200000000000000000000000000000000000000000000000000000000000000000010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200101010101010101010101010101010101010101010101010101010101010101010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200202020202020202020202020202020202020202020202020202020202020202010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200303030303030303030303030303030303030303030303030303030303030303010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200404040404040404040404040404040404040404040404040404040404040404010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200505050505050505050505050505050505050505050505050505050505050505010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200606060606060606060606060606060606060606060606060606060606060606010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200707070707070707070707070707070707070707070707070707070707070707010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200808080808080808080808080808080808080808080808080808080808080808010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200909090909090909090909090909090909090909090909090909090909090909010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// ]); -// } else { -// assert_eq!( -// block_begin_response.unsigned_withdrawal_transactions.len(), -// 0 -// ); -// } -// -// let block_end_request = BlockEndRequest { -// fees: BlockFees { -// storage_fee: storage_fees_per_block, -// processing_fee: 1600, -// refunds_per_epoch: CreditsPerEpoch::from_iter([(0, 100)]), -// }, -// }; -// -// let block_end_response = platform -// .block_end(block_end_request, Some(&transaction)) -// .unwrap_or_else(|_| { -// panic!( -// "should end process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// let after_finalize_block_request = AfterFinalizeBlockRequest { -// updated_data_contract_ids: Vec::new(), -// }; -// -// platform -// .after_finalize_block(after_finalize_block_request) -// .unwrap_or_else(|_| { -// panic!( -// "should begin process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// // Should pay to all proposers for epoch 0, when epochs 1 started -// if epoch_index != 0 && epoch_change { -// assert!(block_end_response.proposers_paid_count.is_some()); -// assert!(block_end_response.paid_epoch_index.is_some()); -// -// assert_eq!( -// block_end_response.proposers_paid_count.unwrap(), -// proposers_count -// ); -// assert_eq!(block_end_response.paid_epoch_index.unwrap(), 0); -// } else { -// assert!(block_end_response.proposers_paid_count.is_none()); -// assert!(block_end_response.paid_epoch_index.is_none()); -// }; -// } -// } -// } -// -// #[test] -// fn test_chain_halt_for_36_days() { -// // TODO refactor to remove code duplication -// -// let mut platform = TestPlatformBuilder::new() -// .with_config(PlatformConfig { -// verify_sum_trees: false, -// ..Default::default() -// }) -// .build_with_mock_rpc(); -// -// let mut core_rpc_mock = MockCoreRPCLike::new(); -// -// core_rpc_mock -// .expect_get_block_hash() -// // .times(1) // TODO: investigate why it always n + 1 -// .returning(|_| { -// Ok(BlockHash::from_hex( -// "0000000000000000000000000000000000000000000000000000000000000000", -// ) -// .unwrap()) -// }); -// -// core_rpc_mock -// .expect_get_block_json() -// // .times(1) // TODO: investigate why it always n + 1 -// .returning(|_| Ok(json!({}))); -// -// platform.core_rpc = core_rpc_mock; -// -// let transaction = platform.drive.grove.start_transaction(); -// -// // init chain -// let init_chain_request = static_init_chain_request(); -// -// platform -// .init_chain(init_chain_request, Some(&transaction)) -// .expect("should init chain"); -// -// // setup the contract -// let contract = platform.create_mn_shares_contract(Some(&transaction)); -// -// let genesis_time = Utc::now(); -// -// let epoch_2_start_day = 37; -// -// let blocks_per_day = 50i64; -// -// let proposers_count = 50u16; -// -// let storage_fees_per_block = 42000; -// -// // and create masternode identities -// let proposers = create_test_masternode_identities( -// &platform.drive, -// proposers_count, -// Some(52), -// Some(&transaction), -// ); -// -// create_test_masternode_share_identities_and_documents( -// &platform.drive, -// &contract, -// &proposers, -// Some(54), -// Some(&transaction), -// ); -// -// let block_interval = 86400i64.div(blocks_per_day); -// -// let mut previous_block_time_ms: Option = None; -// -// // process blocks -// for day in [0, 1, 2, 3, 37] { -// for block_num in 0..blocks_per_day { -// let block_time = if day == 0 && block_num == 0 { -// genesis_time -// } else { -// genesis_time -// + Duration::days(day as i64) -// + Duration::seconds(block_interval * block_num) -// }; -// -// let block_height = 1 + (blocks_per_day as u64 * day as u64) + block_num as u64; -// -// let block_time_ms = block_time -// .timestamp_millis() -// .to_u64() -// .expect("block time can not be before 1970"); -// -// // Processing block -// let block_begin_request = BlockBeginRequest { -// block_height, -// block_time_ms, -// previous_block_time_ms, -// proposer_pro_tx_hash: *proposers -// .get(block_height as usize % (proposers_count as usize)) -// .unwrap(), -// proposed_app_version: 1, -// validator_set_quorum_hash: Default::default(), -// last_synced_core_height: 1, -// core_chain_locked_height: 1, -// total_hpmns: proposers_count as u32, -// }; -// -// let block_begin_response = platform -// .block_begin(block_begin_request, Some(&transaction)) -// .unwrap_or_else(|_| { -// panic!( -// "should begin process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// // Set previous block time -// previous_block_time_ms = Some(block_time_ms); -// -// // Should calculate correct current epochs -// let (epoch_index, epoch_change) = if day == epoch_2_start_day { -// if block_num == 0 { -// (2, true) -// } else { -// (2, false) -// } -// } else if day == 0 && block_num == 0 { -// (0, true) -// } else { -// (0, false) -// }; -// -// assert_eq!( -// block_begin_response.epoch_info.current_epoch_index, -// epoch_index -// ); -// -// assert_eq!( -// block_begin_response.epoch_info.is_epoch_change, -// epoch_change -// ); -// -// let block_end_request = BlockEndRequest { -// fees: BlockFees { -// storage_fee: storage_fees_per_block, -// processing_fee: 1600, -// refunds_per_epoch: CreditsPerEpoch::from_iter([(0, 100)]), -// }, -// }; -// -// let block_end_response = platform -// .block_end(block_end_request, Some(&transaction)) -// .unwrap_or_else(|_| { -// panic!( -// "should end process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// let after_finalize_block_request = AfterFinalizeBlockRequest { -// updated_data_contract_ids: Vec::new(), -// }; -// -// platform -// .after_finalize_block(after_finalize_block_request) -// .unwrap_or_else(|_| { -// panic!( -// "should begin process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// // Should pay to all proposers for epoch 0, when epochs 1 started -// if epoch_index != 0 && epoch_change { -// assert!(block_end_response.proposers_paid_count.is_some()); -// assert!(block_end_response.paid_epoch_index.is_some()); -// -// assert_eq!( -// block_end_response.proposers_paid_count.unwrap(), -// blocks_per_day as u16, -// ); -// assert_eq!(block_end_response.paid_epoch_index.unwrap(), 0); -// } else { -// assert!(block_end_response.proposers_paid_count.is_none()); -// assert!(block_end_response.paid_epoch_index.is_none()); -// }; -// } -// } -// } -// } -// } +mod check_tx; +mod echo; +pub mod error; +mod extend_vote; +mod finalize_block; +mod info; +mod init_chain; +mod prepare_proposal; +mod process_proposal; +mod verify_vote_extension; + +pub use check_tx::check_tx; +pub use echo::echo; +pub use extend_vote::extend_vote; +pub use finalize_block::finalize_block; +pub use info::info; +pub use init_chain::init_chain; +pub use prepare_proposal::prepare_proposal; +pub use process_proposal::process_proposal; +pub use verify_vote_extension::verify_vote_extension; diff --git a/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs b/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs new file mode 100644 index 00000000000..6d2971c7034 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs @@ -0,0 +1,232 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::AbciError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Setters; +use crate::platform_types::block_execution_outcome; +use crate::platform_types::block_proposal::v0::BlockProposal; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; +use crate::rpc::core::CoreRPCLike; +use dpp::dashcore::hashes::Hash; +use dpp::version::TryIntoPlatformVersioned; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::tx_record::TxAction; +use tenderdash_abci::proto::abci::{ExecTxResult, TxRecord}; +use tenderdash_abci::proto::types::CoreChainLock; + +pub fn prepare_proposal<'a, A, C>( + app: &A, + mut request: proto::RequestPrepareProposal, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let timer = crate::metrics::abci_request_duration("prepare_proposal"); + + // We should get the latest CoreChainLock from core + // It is possible that we will not get a chain lock from core, in this case, just don't + // propose one + // This is done before all else + + let platform_state = app.platform().state.load(); + + let last_committed_core_height = platform_state.last_committed_core_height(); + + let core_chain_lock_update = match app.platform().core_rpc.get_best_chain_lock() { + Ok(latest_chain_lock) => { + if platform_state.last_committed_block_info().is_none() + || latest_chain_lock.block_height > last_committed_core_height + { + Some(latest_chain_lock) + } else { + None + } + } + Err(_) => None, + }; + + // Filter out transactions exceeding max_block_size + let mut transactions_exceeding_max_block_size = Vec::new(); + { + let mut total_transactions_size = 0; + let mut index_to_remove_at = None; + for (i, raw_transaction) in request.txs.iter().enumerate() { + total_transactions_size += raw_transaction.len(); + + if total_transactions_size as i64 > request.max_tx_bytes { + index_to_remove_at = Some(i); + break; + } + } + + if let Some(index_to_remove_at) = index_to_remove_at { + transactions_exceeding_max_block_size.extend(request.txs.drain(index_to_remove_at..)); + } + } + + let mut block_proposal: BlockProposal = (&request).try_into()?; + + if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { + // We can't add this, as it slows down CI way too much + // todo: find a way to re-enable this without destroying CI + tracing::debug!( + "propose chain lock update to height {} at block {}", + core_chain_lock_update.block_height, + request.height + ); + block_proposal.core_chain_locked_height = core_chain_lock_update.block_height; + } else { + block_proposal.core_chain_locked_height = last_committed_core_height; + } + + // Prepare transaction + let transaction_guard = if request.height == app.platform().config.abci.genesis_height as i64 { + // special logic on init chain + let transaction_guard = app.transaction().read().unwrap(); + if transaction_guard.is_none() { + Err(Error::Abci(AbciError::BadRequest("received a prepare proposal request for the genesis height before an init chain request".to_string())))?; + }; + if request.round > 0 { + transaction_guard + .as_ref() + .map(|tx| tx.rollback_to_savepoint()); + }; + transaction_guard + } else { + app.start_transaction(); + app.transaction().read().unwrap() + }; + + let transaction = transaction_guard + .as_ref() + .expect("transaction must be started"); + + // Running the proposal executes all the state transitions for the block + let mut run_result = app.platform().run_block_proposal( + block_proposal, + true, + &platform_state, + transaction, + Some(&timer), + )?; + + if !run_result.is_valid() { + // This is a system error, because we are proposing + return Err(run_result.errors.remove(0)); + } + + let block_execution_outcome::v0::BlockExecutionOutcome { + app_hash, + state_transitions_result, + validator_set_update, + platform_version, + mut block_execution_context, + } = run_result.into_data().map_err(Error::Protocol)?; + + // We need to let Tenderdash know about the transactions we should remove from execution + let valid_tx_count = state_transitions_result.valid_count(); + let failed_tx_count = state_transitions_result.failed_count(); + let delayed_tx_count = transactions_exceeding_max_block_size.len(); + let invalid_paid_tx_count = state_transitions_result.invalid_paid_count(); + let invalid_unpaid_tx_count = state_transitions_result.invalid_unpaid_count(); + + let storage_fees = state_transitions_result.aggregated_fees().storage_fee; + let processing_fees = state_transitions_result.aggregated_fees().processing_fee; + + let mut tx_results = Vec::new(); + let mut tx_records = Vec::new(); + + for (state_transition_execution_result, raw_state_transition) in state_transitions_result + .into_execution_results() + .into_iter() + .zip(request.txs) + { + let tx_action = match &state_transition_execution_result { + StateTransitionExecutionResult::SuccessfulExecution(..) => TxAction::Unmodified, + // We have identity to pay for the state transition, so we keep it in the block + StateTransitionExecutionResult::PaidConsensusError(..) => TxAction::Unmodified, + // We don't have any associated identity to pay for the state transition, + // so we remove it from the block to prevent spam attacks. + // Such state transitions must be invalidated by check tx, but they might + // still be added to mempool due to inconsistency between check tx and tx processing + // (fees calculation) or malicious proposer. + StateTransitionExecutionResult::UnpaidConsensusError(..) => TxAction::Removed, + // We shouldn't include in the block any state transitions that produced an internal error + // during execution + StateTransitionExecutionResult::InternalError(..) => TxAction::Removed, + // State Transition was not executed as it reached the maximum time limit + StateTransitionExecutionResult::NotExecuted(..) => TxAction::Delayed, + }; + + let tx_result: Option = + state_transition_execution_result.try_into_platform_versioned(platform_version)?; + + if let Some(result) = tx_result { + if tx_action != TxAction::Removed { + tx_results.push(result); + } + } + + tx_records.push(TxRecord { + action: tx_action.into(), + tx: raw_state_transition, + }); + } + + // Add up exceeding transactions to the response + tx_records.extend( + transactions_exceeding_max_block_size + .into_iter() + .map(|tx| TxRecord { + action: TxAction::Delayed as i32, + tx, + }), + ); + + let response = proto::ResponsePrepareProposal { + tx_results, + app_hash: app_hash.to_vec(), + tx_records, + core_chain_lock_update: core_chain_lock_update.map(|chain_lock| CoreChainLock { + core_block_hash: chain_lock.block_hash.to_byte_array().to_vec(), + core_block_height: chain_lock.block_height, + signature: chain_lock.signature.to_bytes().to_vec(), + }), + validator_set_update, + // TODO: implement consensus param updates + consensus_param_updates: None, + app_version: platform_version.protocol_version as u64, + }; + + block_execution_context.set_proposer_results(Some(response.clone())); + + app.block_execution_context() + .write() + .unwrap() + .replace(block_execution_context); + + let elapsed_time_ms = timer.elapsed().as_millis(); + + tracing::info!( + invalid_paid_tx_count, + invalid_unpaid_tx_count, + valid_tx_count, + delayed_tx_count, + failed_tx_count, + storage_fees, + processing_fees, + "Prepared proposal with {} transition{} for height: {}, round: {} in {} ms", + valid_tx_count + invalid_paid_tx_count, + if valid_tx_count + invalid_paid_tx_count > 0 { + "s" + } else { + "" + }, + request.height, + request.round, + elapsed_time_ms, + ); + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/process_proposal.rs b/packages/rs-drive-abci/src/abci/handler/process_proposal.rs new file mode 100644 index 00000000000..0e94f638ed0 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/process_proposal.rs @@ -0,0 +1,292 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::AbciError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::{ + BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, +}; +use crate::execution::types::block_state_info::v0::{ + BlockStateInfoV0Getters, BlockStateInfoV0Setters, +}; +use crate::platform_types::block_execution_outcome; +use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; +use crate::rpc::core::CoreRPCLike; +use dpp::version::TryIntoPlatformVersioned; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::tx_record::TxAction; + +pub fn process_proposal<'a, A, C>( + app: &A, + request: proto::RequestProcessProposal, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let timer = crate::metrics::abci_request_duration("process_proposal"); + + let mut drop_block_execution_context = false; + let mut block_execution_context_guard = app.block_execution_context().write().unwrap(); + if let Some(block_execution_context) = block_execution_context_guard.as_mut() { + // We are already in a block, or in init chain. + // This only makes sense if we were the proposer unless we are at a future round + if block_execution_context.block_state_info().round() != (request.round as u32) { + // We were not the proposer, and we should process something new + drop_block_execution_context = true; + } else if let Some(current_block_hash) = + block_execution_context.block_state_info().block_hash() + { + // There is also the possibility that this block already came in, but tenderdash crashed + // Now tenderdash is sending it again + if let Some(proposal_info) = block_execution_context.proposer_results() { + tracing::debug!( + method = "process_proposal", + "we knew block hash, block execution context already had a proposer result", + ); + // We were the proposer as well, so we have the result in cache + return Ok(proto::ResponseProcessProposal { + status: proto::response_process_proposal::ProposalStatus::Accept.into(), + app_hash: proposal_info.app_hash.clone(), + tx_results: proposal_info.tx_results.clone(), + consensus_param_updates: proposal_info.consensus_param_updates.clone(), + validator_set_update: proposal_info.validator_set_update.clone(), + events: Vec::new(), + }); + } + + if current_block_hash.as_slice() == request.hash { + // We were not the proposer, just drop the execution context + tracing::warn!( + method = "process_proposal", + "block execution context already existed, but we are running it again for same height {}/round {}", + request.height, + request.round, + ); + drop_block_execution_context = true; + } else { + // We are getting a different block hash for a block of the same round + // This is a terrible issue + Err(Error::Abci(AbciError::BadRequest( + "received a process proposal request twice with different hash".to_string(), + )))?; + } + } else { + let Some(proposal_info) = block_execution_context.proposer_results() else { + Err(Error::Abci(AbciError::BadRequest( + "received a process proposal request twice".to_string(), + )))? + }; + + let expected_transactions = proposal_info + .tx_records + .iter() + .filter_map(|record| { + if record.action == TxAction::Removed as i32 + || record.action == TxAction::Delayed as i32 + { + None + } else { + Some(&record.tx) + } + }) + .collect::>(); + + // While it is true that the length could be same, seeing how this is such a rare situation + // It does not seem worth to deal with situations where the length is the same but the transactions have changed + if expected_transactions.len() == request.txs.len() + && proposal_info.core_chain_lock_update == request.core_chain_lock_update + { + let (app_hash, tx_results, consensus_param_updates, validator_set_update) = { + tracing::debug!( + method = "process_proposal", + "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result {:?}", + proposal_info, + ); + + // Cloning all required properties from proposal_info and then dropping it + let app_hash = proposal_info.app_hash.clone(); + let tx_results = proposal_info.tx_results.clone(); + let consensus_param_updates = proposal_info.consensus_param_updates.clone(); + let validator_set_update = proposal_info.validator_set_update.clone(); + ( + app_hash, + tx_results, + consensus_param_updates, + validator_set_update, + ) + }; + + // We need to set the block hash + block_execution_context + .block_state_info_mut() + .set_block_hash(Some(request.hash.clone().try_into().map_err(|_| { + Error::Abci(AbciError::BadRequestDataSize( + "block hash is not 32 bytes in process proposal".to_string(), + )) + })?)); + return Ok(proto::ResponseProcessProposal { + status: proto::response_process_proposal::ProposalStatus::Accept.into(), + app_hash, + tx_results, + consensus_param_updates, + validator_set_update, + events: Vec::new(), + }); + } else { + tracing::warn!( + method = "process_proposal", + "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result, but we are requesting a different amount of transactions, dropping the cache", + ); + + drop_block_execution_context = true; + }; + } + } + + if drop_block_execution_context { + block_execution_context_guard.take(); + } + drop(block_execution_context_guard); + + // Get transaction + let transaction_guard = if request.height == app.platform().config.abci.genesis_height as i64 { + // special logic on init chain + let transaction_guard = app.transaction().read().unwrap(); + if transaction_guard.is_none() { + Err(Error::Abci(AbciError::BadRequest("received a process proposal request for the genesis height before an init chain request".to_string())))?; + } + if request.round > 0 { + transaction_guard + .as_ref() + .map(|tx| tx.rollback_to_savepoint()); + } + transaction_guard + } else { + app.start_transaction(); + app.transaction().read().unwrap() + }; + + let transaction = transaction_guard + .as_ref() + .expect("transaction must be started"); + + let platform_state = app.platform().state.load(); + + // Running the proposal executes all the state transitions for the block + let run_result = app.platform().run_block_proposal( + (&request).try_into()?, + false, + &platform_state, + transaction, + None, + )?; + + if !run_result.is_valid() { + // This was an error running this proposal, tell tenderdash that the block isn't valid + let response = proto::ResponseProcessProposal { + status: proto::response_process_proposal::ProposalStatus::Reject.into(), + app_hash: [0; 32].to_vec(), // we must send 32 bytes + ..Default::default() + }; + + tracing::warn!( + errors = ?run_result.errors, + "Rejected invalid proposal for height: {}, round: {}", + request.height, + request.round, + ); + + return Ok(response); + } + + let block_execution_outcome::v0::BlockExecutionOutcome { + app_hash, + state_transitions_result: state_transition_results, + validator_set_update, + platform_version, + block_execution_context, + } = run_result.into_data().map_err(Error::Protocol)?; + + app.block_execution_context() + .write() + .unwrap() + .replace(block_execution_context); + + let invalid_tx_count = state_transition_results.invalid_paid_count(); + let valid_tx_count = state_transition_results.valid_count(); + let failed_tx_count = state_transition_results.failed_count(); + let invalid_unpaid_tx_count = state_transition_results.invalid_unpaid_count(); + let unexpected_execution_results = failed_tx_count + invalid_unpaid_tx_count; + + let storage_fees = state_transition_results.aggregated_fees().storage_fee; + let processing_fees = state_transition_results.aggregated_fees().processing_fee; + + // Reject block if proposal contains failed or unpaid state transitions + if unexpected_execution_results > 0 { + let response = proto::ResponseProcessProposal { + app_hash: app_hash.to_vec(), + status: proto::response_process_proposal::ProposalStatus::Reject.into(), + ..Default::default() + }; + + let elapsed_time_ms = timer.elapsed().as_millis(); + + tracing::warn!( + invalid_tx_count, + valid_tx_count, + failed_tx_count, + invalid_unpaid_tx_count, + elapsed_time_ms, + "Rejected invalid proposal for height: {}, round: {} due to {} unexpected state transition execution result(s)", + request.height, + request.round, + unexpected_execution_results + ); + + return Ok(response); + } + + let tx_results = state_transition_results + .into_execution_results() + .into_iter() + // To prevent spam attacks we add to the block state transitions covered with fees only + .filter(|execution_result| { + matches!( + execution_result, + StateTransitionExecutionResult::SuccessfulExecution(..) + | StateTransitionExecutionResult::PaidConsensusError(..) + ) + }) + .filter_map(|execution_result| { + execution_result + .try_into_platform_versioned(platform_version) + .transpose() + }) + .collect::>()?; + + let response = proto::ResponseProcessProposal { + app_hash: app_hash.to_vec(), + tx_results, + status: proto::response_process_proposal::ProposalStatus::Accept.into(), + validator_set_update, + // TODO: Implement consensus param updates + consensus_param_updates: None, + events: Vec::new(), + }; + + let elapsed_time_ms = timer.elapsed().as_millis(); + + tracing::info!( + invalid_tx_count, + valid_tx_count, + elapsed_time_ms, + storage_fees, + processing_fees, + "Processed proposal with {} transactions for height: {}, round: {} in {} ms", + valid_tx_count + invalid_tx_count, + request.height, + request.round, + elapsed_time_ms, + ); + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs b/packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs new file mode 100644 index 00000000000..53d0ec3e3b1 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs @@ -0,0 +1,96 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication}; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::response_verify_vote_extension::VerifyStatus; +use tenderdash_abci::proto::abci::ExtendVoteExtension; + +/// Todo: Verify votes extension not really needed because extend votes is deterministic +pub fn verify_vote_extension( + app: &A, + request: proto::RequestVerifyVoteExtension, +) -> Result +where + A: PlatformApplication + BlockExecutionApplication, + C: CoreRPCLike, +{ + let _timer = crate::metrics::abci_request_duration("verify_vote_extension"); + + // Verify that this is a votes extension for our current executed block and our proposer + let proto::RequestVerifyVoteExtension { + height, + round, + vote_extensions, + .. + } = request; + + let height: u64 = height as u64; + let round: u32 = round as u32; + + // Make sure we are in a block execution phase + let block_execution_context_ref = app.block_execution_context().read().unwrap(); + let Some(block_execution_context) = block_execution_context_ref.as_ref() else { + tracing::warn!( + "votes extensions for height: {}, round: {} are rejected because we are not in a block execution phase", + height, + round, + ); + + return Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Reject.into(), + }); + }; + + // Make sure votes extension is for our currently executing block + + let block_state_info = block_execution_context.block_state_info(); + + // We might get votes extension to verify for previous (in case if other node is behind) + // or future round (in case if the current node is behind), so we make sure that only height + // is matching. It's fine because withdrawal transactions to sign are the same for any round + // of the same height + if block_state_info.height() != height { + tracing::warn!( + "votes extensions for height: {}, round: {} are rejected because we are at height: {}", + height, + round, + block_state_info.height(), + ); + + return Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Reject.into(), + }); + } + + // Verify that a validator is requesting a signatures + // for a correct set of withdrawal transactions + + let expected_withdrawals = block_execution_context.unsigned_withdrawal_transactions(); + + if expected_withdrawals != vote_extensions.as_slice() { + let expected_extensions: Vec = expected_withdrawals.into(); + + tracing::error!( + received_extensions = ?vote_extensions, + ?expected_extensions, + "votes extensions for height: {}, round: {} mismatch", + height, round + ); + + return Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Reject.into(), + }); + } + + tracing::debug!( + "votes extensions for height: {}, round: {} are successfully verified", + height, + round, + ); + + Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Accept.into(), + }) +} diff --git a/packages/rs-drive-abci/src/abci/mod.rs b/packages/rs-drive-abci/src/abci/mod.rs index f404881f811..e9b7681eaec 100644 --- a/packages/rs-drive-abci/src/abci/mod.rs +++ b/packages/rs-drive-abci/src/abci/mod.rs @@ -1,16 +1,11 @@ mod error; -/// The handlers of abci messages -#[cfg(any(feature = "server", test))] -pub mod handler; - // server configuration pub mod config; -#[cfg(any(feature = "server", test))] -pub(crate) mod server; + +/// ABCI applications +pub mod app; + +mod handler; pub use error::AbciError; -#[cfg(feature = "server")] -pub use server::start; -#[cfg(any(feature = "server", test))] -pub use server::AbciApplication; diff --git a/packages/rs-drive-abci/src/abci/server.rs b/packages/rs-drive-abci/src/abci/server.rs deleted file mode 100644 index c3d2247ddc4..00000000000 --- a/packages/rs-drive-abci/src/abci/server.rs +++ /dev/null @@ -1,95 +0,0 @@ -//! This module implements ABCI application server. -//! -use crate::error::execution::ExecutionError; -use crate::{ - config::PlatformConfig, error::Error, platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; -use drive::grovedb::Transaction; -use std::fmt::Debug; -use std::sync::RwLock; -use tokio_util::sync::CancellationToken; - -/// AbciApp is an implementation of ABCI Application, as defined by Tenderdash. -/// -/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like -/// creating new proposal or finalizing new block. -pub struct AbciApplication<'a, C> { - /// Platform - pub platform: &'a Platform, - /// The current transaction - pub transaction: RwLock>>, -} - -/// Start ABCI server and process incoming connections. -/// -/// Should never return. -pub fn start( - config: &PlatformConfig, - core_rpc: C, - cancel: CancellationToken, -) -> Result<(), Error> { - let bind_address = config.abci.bind_address.clone(); - - let platform: Platform = - Platform::open_with_client(&config.db_path, Some(config.clone()), core_rpc)?; - - let abci = AbciApplication::new(&platform)?; - - let server = tenderdash_abci::ServerBuilder::new(abci, &bind_address) - .with_cancel_token(cancel.clone()) - .build() - .map_err(super::AbciError::from)?; - - while !cancel.is_cancelled() { - tracing::info!("waiting for new ABCI connection"); - match server.next_client() { - Err(e) => tracing::error!("ABCI connection terminated: {:?}", e), - Ok(_) => tracing::info!("ABCI connection closed"), - } - } - - Ok(()) -} - -impl<'a, C> AbciApplication<'a, C> { - /// Create new ABCI app - pub fn new(platform: &'a Platform) -> Result, Error> { - let app = AbciApplication { - platform, - transaction: RwLock::new(None), - }; - - Ok(app) - } - - /// create and store a new transaction - pub fn start_transaction(&self) { - let transaction = self.platform.drive.grove.start_transaction(); - self.transaction.write().unwrap().replace(transaction); - } - - /// Commit a transaction - pub fn commit_transaction(&self) -> Result<(), Error> { - let transaction = self - .transaction - .write() - .unwrap() - .take() - .ok_or(Error::Execution(ExecutionError::NotInTransaction( - "trying to commit a transaction, but we are not in one", - )))?; - let platform_state = self.platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version()?; - self.platform - .drive - .commit_transaction(transaction, &platform_version.drive) - .map_err(Error::Drive) - } -} - -impl<'a, C> Debug for AbciApplication<'a, C> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "") - } -} diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index f325924e25f..0f29f1776fd 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -1,77 +1,73 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. - +use crate::logging::LogConfigs; +use crate::utils::from_str_or_number; +use crate::{abci::config::AbciConfig, error::Error}; +use bincode::{Decode, Encode}; use dashcore_rpc::json::QuorumType; -use std::path::PathBuf; - +use dpp::dashcore::Network; use dpp::util::deserializer::ProtocolVersion; -use drive::drive::config::DriveConfig; +use dpp::version::INITIAL_PROTOCOL_VERSION; +use drive::config::DriveConfig; use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use std::path::PathBuf; +use std::str::FromStr; -use crate::logging::LogConfigs; -use crate::{abci::config::AbciConfig, error::Error}; - -/// Configuration for Dash Core RPC client -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct CoreRpcConfig { +/// Configuration for Dash Core RPC client used in consensus logic +#[derive(Clone, Debug, Serialize, Deserialize, Default)] +pub struct ConsensusCoreRpcConfig { /// Core RPC client hostname or IP address - #[serde(rename = "core_json_rpc_host")] + #[serde(rename = "core_consensus_json_rpc_host")] pub host: String, - // FIXME: fix error Configuration(Custom("invalid type: string \"9998\", expected i16")) and change port to i16 /// Core RPC client port number - #[serde(rename = "core_json_rpc_port")] - pub port: String, + #[serde( + rename = "core_consensus_json_rpc_port", + deserialize_with = "from_str_or_number" + )] + pub port: u16, /// Core RPC client username - #[serde(rename = "core_json_rpc_username")] + #[serde(rename = "core_consensus_json_rpc_username")] pub username: String, /// Core RPC client password - #[serde(rename = "core_json_rpc_password")] + #[serde(rename = "core_consensus_json_rpc_password")] pub password: String, } -impl CoreRpcConfig { +impl ConsensusCoreRpcConfig { /// Return core address in the `host:port` format. pub fn url(&self) -> String { format!("{}:{}", self.host, self.port) } } -impl Default for CoreRpcConfig { - fn default() -> Self { - Self { - host: String::from("127.0.0.1"), - port: String::from("1234"), - username: String::from(""), - password: String::from(""), - } +/// Configuration for Dash Core RPC client used in check tx +#[derive(Clone, Debug, Serialize, Deserialize, Default)] +pub struct CheckTxCoreRpcConfig { + /// Core RPC client hostname or IP address + #[serde(rename = "core_check_tx_json_rpc_host")] + pub host: String, + + /// Core RPC client port number + #[serde( + rename = "core_check_tx_json_rpc_port", + deserialize_with = "from_str_or_number" + )] + pub port: u16, + + /// Core RPC client username + #[serde(rename = "core_check_tx_json_rpc_username")] + pub username: String, + + /// Core RPC client password + #[serde(rename = "core_check_tx_json_rpc_password")] + pub password: String, +} + +impl CheckTxCoreRpcConfig { + /// Return core address in the `host:port` format. + pub fn url(&self) -> String { + format!("{}:{}", self.host, self.port) } } @@ -79,36 +75,19 @@ impl Default for CoreRpcConfig { #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default)] pub struct CoreConfig { - /// Core RPC config + /// Core RPC config for consensus #[serde(flatten)] - pub rpc: CoreRpcConfig, - - /// DKG interval - pub dkg_interval: String, // String due to https://github.com/softprops/envy/issues/26 - /// Minimum number of valid members to use the quorum - pub min_quorum_valid_members: String, // String due to https://github.com/softprops/envy/issues/26 + pub consensus_rpc: ConsensusCoreRpcConfig, + /// Core RPC config for check tx + #[serde(flatten)] + pub check_tx_rpc: CheckTxCoreRpcConfig, } -impl CoreConfig { - /// return dkg_interval - pub fn dkg_interval(&self) -> u32 { - self.dkg_interval - .parse::() - .expect("DKG_INTERVAL is not an int") - } - /// Returns minimal number of quorum members - pub fn min_quorum_valid_members(&self) -> u32 { - self.min_quorum_valid_members - .parse::() - .expect("MIN_QUORUM_VALID_MEMBERS is not an int") - } -} impl Default for CoreConfig { fn default() -> Self { Self { - dkg_interval: String::from("24"), - min_quorum_valid_members: String::from("3"), - rpc: Default::default(), + consensus_rpc: Default::default(), + check_tx_rpc: Default::default(), } } } @@ -126,13 +105,6 @@ pub struct ExecutionConfig { #[serde(default = "ExecutionConfig::default_verify_sum_trees")] pub verify_sum_trees: bool, - /// How often should quorums change? - #[serde( - default = "ExecutionConfig::default_validator_set_quorum_rotation_block_count", - deserialize_with = "from_str_or_number" - )] - pub validator_set_quorum_rotation_block_count: u32, - /// How long in seconds should an epoch last /// It might last a lot longer if the chain is halted #[serde( @@ -142,18 +114,6 @@ pub struct ExecutionConfig { pub epoch_time_length_s: u64, } -fn from_str_or_number<'de, D, T>(deserializer: D) -> Result -where - D: serde::Deserializer<'de>, - T: serde::Deserialize<'de> + std::str::FromStr, - ::Err: std::fmt::Display, -{ - use serde::de::Error; - - let s = String::deserialize(deserializer)?; - s.parse::().map_err(Error::custom) -} - /// Configuration of Dash Platform. /// /// All fields in this struct can be configured using environment variables. @@ -173,6 +133,12 @@ where // NOTE: in renames, we use lower_snake_case, because uppercase does not work; see // https://github.com/softprops/envy/issues/61 and https://github.com/softprops/envy/pull/69 pub struct PlatformConfig { + /// The network type + #[serde( + default = "PlatformConfig::default_network", + deserialize_with = "from_str_to_network_with_aliases" + )] + pub network: Network, /// Drive configuration #[serde(flatten)] pub drive: DriveConfig, @@ -185,17 +151,36 @@ pub struct PlatformConfig { #[serde(flatten)] pub abci: AbciConfig, + /// Address to listen for Prometheus connection. + /// + /// Optional. + /// + /// /// Address should be an URL with scheme `http://`, for example: + /// - `http://127.0.0.1:29090` + /// + /// Port number defaults to [crate::metrics::DEFAULT_PROMETHEUS_PORT]. + pub prometheus_bind_address: Option, + + /// Address to listen for gRPC connection. + pub grpc_bind_address: String, + /// Execution config #[serde(flatten)] pub execution: ExecutionConfig, /// The default quorum type - pub quorum_type: String, + #[serde(flatten)] + pub validator_set: ValidatorSetConfig, - /// The default quorum size - pub quorum_size: u16, + /// Chain lock configuration + #[serde(flatten)] + pub chain_lock: ChainLockConfig, + + /// Instant lock configuration + #[serde(flatten)] + pub instant_lock: InstantLockConfig, - // todo: this should probably be coming from Tenderdash config + // todo: this should probably be coming from Tenderdash config. It's a test only param /// Approximately how often are blocks produced pub block_spacing_ms: u64, @@ -206,10 +191,354 @@ pub struct PlatformConfig { /// Path to data storage pub db_path: PathBuf, - // todo: put this in tests like #[cfg(test)] + /// Path to store rejected / invalid items (like transactions). + /// Used mainly for debuggig. + /// + /// If not set, rejected and invalid items will not be stored. + #[serde(default)] + pub rejections_path: Option, + + #[cfg(feature = "testing-config")] /// This should be None, except in the case of Testing platform #[serde(skip)] pub testing_configs: PlatformTestConfig, + + /// Enable tokio console (console feature must be enabled) + pub tokio_console_enabled: bool, + + // TODO: Use from_str_to_socket_address + /// Tokio console address to connect to + #[serde(default = "PlatformConfig::default_tokio_console_address")] + pub tokio_console_address: String, + + /// Number of seconds to store task information if there is no clients connected + #[serde(default = "PlatformConfig::default_tokio_console_retention_secs")] + pub tokio_console_retention_secs: u64, +} + +fn from_str_to_network_with_aliases<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let network_name = String::deserialize(deserializer)?; + + match network_name.as_str() { + "mainnet" => Ok(Network::Dash), + "local" => Ok(Network::Regtest), + _ => Network::from_str(network_name.as_str()) + .map_err(|e| serde::de::Error::custom(format!("can't parse network name: {e}"))), + } +} + +/// A config suitable for a quorum configuration +pub trait QuorumLikeConfig: Sized { + /// Quorum type + fn quorum_type(&self) -> QuorumType; + + /// Quorum size + fn quorum_size(&self) -> u16; + + /// Quorum DKG interval + fn quorum_window(&self) -> u32; + + /// Quorum active signers count + fn quorum_active_signers(&self) -> u16; + + /// Quorum rotation (dip24) or classic + fn quorum_rotation(&self) -> bool; +} + +/// Chain Lock quorum configuration +#[derive(Clone, Debug, Serialize, Deserialize, Encode, Decode)] +pub struct ValidatorSetConfig { + /// The quorum type used for verifying chain locks + #[serde( + rename = "validator_set_quorum_type", + serialize_with = "serialize_quorum_type", + deserialize_with = "deserialize_quorum_type" + )] + pub quorum_type: QuorumType, + + /// The quorum size + #[serde( + rename = "validator_set_quorum_size", + deserialize_with = "from_str_or_number" + )] + pub quorum_size: u16, + + /// The quorum window (DKG interval) + /// On Mainnet Chain Locks are signed using 400_60: One quorum in every 288 blocks and activeQuorumCount is 4. + /// On Testnet Chain Locks are signed using 50_60: One quorum in every 24 blocks and activeQuorumCount is 24. + #[serde( + rename = "validator_set_quorum_window", + deserialize_with = "from_str_or_number" + )] + pub quorum_window: u32, + + /// The number of active signers + #[serde( + rename = "validator_set_quorum_active_signers", + deserialize_with = "from_str_or_number" + )] + pub quorum_active_signers: u16, + + /// Whether the quorum is rotated DIP24 or classic + #[serde( + rename = "validator_set_quorum_rotation", + deserialize_with = "from_str_or_number" + )] + pub quorum_rotation: bool, +} + +impl Default for ValidatorSetConfig { + fn default() -> Self { + // Mainnet + Self::default_100_67() + } +} + +impl ValidatorSetConfig { + /// Creates a default config for LLMQ 100 67 + pub fn default_100_67() -> Self { + Self { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 100, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + } + } +} + +impl QuorumLikeConfig for ValidatorSetConfig { + fn quorum_type(&self) -> QuorumType { + self.quorum_type + } + + fn quorum_size(&self) -> u16 { + self.quorum_size + } + + fn quorum_window(&self) -> u32 { + self.quorum_window + } + + fn quorum_active_signers(&self) -> u16 { + self.quorum_active_signers + } + + fn quorum_rotation(&self) -> bool { + self.quorum_rotation + } +} + +/// Chain Lock quorum configuration +#[derive(Clone, Debug, Serialize, Deserialize, Encode, Decode)] +pub struct ChainLockConfig { + /// The quorum type used for verifying chain locks + #[serde( + rename = "chain_lock_quorum_type", + serialize_with = "serialize_quorum_type", + deserialize_with = "deserialize_quorum_type" + )] + pub quorum_type: QuorumType, + + /// The quorum size + #[serde( + rename = "chain_lock_quorum_size", + deserialize_with = "from_str_or_number" + )] + pub quorum_size: u16, + + /// The quorum window (DKG interval) + /// On Mainnet Chain Locks are signed using 400_60: One quorum in every 288 blocks and activeQuorumCount is 4. + /// On Testnet Chain Locks are signed using 50_60: One quorum in every 24 blocks and activeQuorumCount is 24. + #[serde( + rename = "chain_lock_quorum_window", + deserialize_with = "from_str_or_number" + )] + pub quorum_window: u32, + + /// The number of active signers + #[serde( + rename = "chain_lock_quorum_active_signers", + deserialize_with = "from_str_or_number" + )] + pub quorum_active_signers: u16, + + /// Whether the quorum is rotated DIP24 or classic + #[serde( + rename = "chain_lock_quorum_rotation", + deserialize_with = "from_str_or_number" + )] + pub quorum_rotation: bool, +} + +impl Default for ChainLockConfig { + fn default() -> Self { + // Mainnet + Self { + quorum_type: QuorumType::Llmq400_60, + quorum_size: 400, + quorum_window: 24 * 12, + quorum_active_signers: 4, + quorum_rotation: false, + } + } +} + +impl QuorumLikeConfig for ChainLockConfig { + fn quorum_type(&self) -> QuorumType { + self.quorum_type + } + + fn quorum_size(&self) -> u16 { + self.quorum_size + } + + fn quorum_window(&self) -> u32 { + self.quorum_window + } + + fn quorum_active_signers(&self) -> u16 { + self.quorum_active_signers + } + + fn quorum_rotation(&self) -> bool { + self.quorum_rotation + } +} + +impl ChainLockConfig { + /// Creates a default config for LLMQ 100 67 + pub fn default_100_67() -> Self { + Self { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 100, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + } + } +} + +/// Chain Lock quorum configuration +#[derive(Clone, Debug, Serialize, Deserialize, Encode, Decode)] +pub struct InstantLockConfig { + /// The quorum type used for verifying chain locks + #[serde( + rename = "instant_lock_quorum_type", + serialize_with = "serialize_quorum_type", + deserialize_with = "deserialize_quorum_type" + )] + pub quorum_type: QuorumType, + + /// The quorum size + #[serde( + rename = "instant_lock_quorum_size", + deserialize_with = "from_str_or_number" + )] + pub quorum_size: u16, + + /// The quorum window (DKG interval) + /// On Mainnet Chain Locks are signed using 400_60: One quorum in every 288 blocks and activeQuorumCount is 4. + /// On Testnet Chain Locks are signed using 50_60: One quorum in every 24 blocks and activeQuorumCount is 24. + #[serde( + rename = "instant_lock_quorum_window", + deserialize_with = "from_str_or_number" + )] + pub quorum_window: u32, + + /// The number of active signers + #[serde( + rename = "instant_lock_quorum_active_signers", + deserialize_with = "from_str_or_number" + )] + pub quorum_active_signers: u16, + + /// Whether the quorum is rotated DIP24 or classic + #[serde( + rename = "instant_lock_quorum_rotation", + deserialize_with = "from_str_or_number" + )] + pub quorum_rotation: bool, +} + +impl Default for InstantLockConfig { + fn default() -> Self { + // Mainnet + Self { + quorum_type: QuorumType::Llmq60_75, + quorum_active_signers: 32, + quorum_size: 60, + quorum_window: 24 * 12, + quorum_rotation: true, + } + } +} + +impl InstantLockConfig { + /// Creates a default config for LLMQ 100 67 + pub fn default_100_67() -> Self { + Self { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 100, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + } + } +} + +impl QuorumLikeConfig for InstantLockConfig { + fn quorum_type(&self) -> QuorumType { + self.quorum_type + } + + fn quorum_size(&self) -> u16 { + self.quorum_size + } + + fn quorum_window(&self) -> u32 { + self.quorum_window + } + + fn quorum_active_signers(&self) -> u16 { + self.quorum_active_signers + } + + fn quorum_rotation(&self) -> bool { + self.quorum_rotation + } +} + +fn serialize_quorum_type(quorum_type: &QuorumType, serializer: S) -> Result +where + S: serde::Serializer, +{ + serializer.serialize_str(quorum_type.to_string().as_str()) +} + +fn deserialize_quorum_type<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let quorum_type_name = String::deserialize(deserializer)?; + + let quorum_type = if let Ok(t) = quorum_type_name.trim().parse::() { + QuorumType::from(t) + } else { + QuorumType::from(quorum_type_name.as_str()) + }; + + if quorum_type == QuorumType::UNKNOWN { + return Err(serde::de::Error::custom(format!( + "unsupported QUORUM_TYPE: {}", + quorum_type_name + ))); + }; + + Ok(quorum_type) } impl ExecutionConfig { @@ -221,10 +550,6 @@ impl ExecutionConfig { true } - fn default_validator_set_quorum_rotation_block_count() -> u32 { - 15 - } - fn default_epoch_time_length_s() -> u64 { 788400 } @@ -232,25 +557,22 @@ impl ExecutionConfig { impl PlatformConfig { fn default_initial_protocol_version() -> ProtocolVersion { - //todo: versioning - 1 + INITIAL_PROTOCOL_VERSION } - /// Return type of quorum - pub fn quorum_type(&self) -> QuorumType { - let found = if let Ok(t) = self.quorum_type.trim().parse::() { - QuorumType::from(t) - } else { - QuorumType::from(self.quorum_type.as_str()) - }; + fn default_network() -> Network { + Network::Dash + } - if found == QuorumType::UNKNOWN { - panic!("config: unsupported QUORUM_TYPE: {}", self.quorum_type); - } + fn default_tokio_console_address() -> String { + String::from("127.0.0.1:6669") + } - found + fn default_tokio_console_retention_secs() -> u64 { + 60 * 3 } } + /// create new object using values from environment variables pub trait FromEnv { /// create new object using values from environment variables @@ -279,8 +601,6 @@ impl Default for ExecutionConfig { Self { use_document_triggers: ExecutionConfig::default_use_document_triggers(), verify_sum_trees: ExecutionConfig::default_verify_sum_trees(), - validator_set_quorum_rotation_block_count: - ExecutionConfig::default_validator_set_quorum_rotation_block_count(), epoch_time_length_s: ExecutionConfig::default_epoch_time_length_s(), } } @@ -288,45 +608,231 @@ impl Default for ExecutionConfig { impl Default for PlatformConfig { fn default() -> Self { + Self::default_mainnet() + } +} + +/// The platform config +impl PlatformConfig { + /// The default depending on the network + pub fn default_for_network(network: Network) -> Self { + match network { + Network::Dash => Self::default_mainnet(), + Network::Testnet => Self::default_testnet(), + Network::Devnet => Self::default_devnet(), + Network::Regtest => Self::default_local(), + _ => Self::default_testnet(), + } + } + + /// The default local config + pub fn default_local() -> Self { Self { - quorum_type: "llmq_100_67".to_string(), - quorum_size: 100, + network: Network::Regtest, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::LlmqTestPlatform, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 2, + quorum_rotation: false, + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::LlmqTest, + quorum_active_signers: 2, + quorum_size: 3, + quorum_window: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::LlmqTest, + quorum_active_signers: 2, + quorum_size: 3, + quorum_window: 24, + quorum_rotation: false, + }, block_spacing_ms: 5000, drive: Default::default(), abci: Default::default(), core: Default::default(), execution: Default::default(), db_path: PathBuf::from("/var/lib/dash-platform/data"), + rejections_path: Some(PathBuf::from("/var/log/dash/rejected")), + #[cfg(feature = "testing-config")] testing_configs: PlatformTestConfig::default(), - initial_protocol_version: 1, + tokio_console_enabled: false, + tokio_console_address: PlatformConfig::default_tokio_console_address(), + tokio_console_retention_secs: PlatformConfig::default_tokio_console_retention_secs(), + initial_protocol_version: Self::default_initial_protocol_version(), + prometheus_bind_address: None, + grpc_bind_address: "127.0.0.1:26670".to_string(), + } + } + + /// The default devnet config + pub fn default_devnet() -> Self { + Self { + network: Network::Regtest, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::LlmqDevnetPlatform, + quorum_size: 12, + quorum_window: 24, + quorum_active_signers: 8, + quorum_rotation: false, + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::LlmqDevnetPlatform, + quorum_size: 12, + quorum_window: 24, + quorum_active_signers: 8, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::LlmqDevnetDip0024, + quorum_active_signers: 4, + quorum_size: 8, + quorum_window: 48, + quorum_rotation: true, + }, + block_spacing_ms: 5000, + drive: Default::default(), + abci: Default::default(), + core: Default::default(), + execution: Default::default(), + db_path: PathBuf::from("/var/lib/dash-platform/data"), + rejections_path: Some(PathBuf::from("/var/log/dash/rejected")), + #[cfg(feature = "testing-config")] + testing_configs: PlatformTestConfig::default(), + tokio_console_enabled: false, + tokio_console_address: PlatformConfig::default_tokio_console_address(), + tokio_console_retention_secs: PlatformConfig::default_tokio_console_retention_secs(), + initial_protocol_version: Self::default_initial_protocol_version(), + prometheus_bind_address: None, + grpc_bind_address: "127.0.0.1:26670".to_string(), + } + } + + /// The default testnet config + pub fn default_testnet() -> Self { + Self { + network: Network::Testnet, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq25_67, + quorum_size: 25, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq50_60, + quorum_active_signers: 24, + quorum_size: 50, + quorum_window: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq60_75, + quorum_active_signers: 32, + quorum_size: 60, + quorum_window: 24 * 12, + quorum_rotation: true, + }, + block_spacing_ms: 5000, + drive: Default::default(), + abci: Default::default(), + core: Default::default(), + execution: Default::default(), + db_path: PathBuf::from("/var/lib/dash-platform/data"), + rejections_path: Some(PathBuf::from("/var/log/dash/rejected")), + #[cfg(feature = "testing-config")] + testing_configs: PlatformTestConfig::default(), + initial_protocol_version: Self::default_initial_protocol_version(), + prometheus_bind_address: None, + grpc_bind_address: "127.0.0.1:26670".to_string(), + tokio_console_enabled: false, + tokio_console_address: PlatformConfig::default_tokio_console_address(), + tokio_console_retention_secs: PlatformConfig::default_tokio_console_retention_secs(), + } + } + + /// The default mainnet config + pub fn default_mainnet() -> Self { + Self { + network: Network::Dash, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 100, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq400_60, + quorum_active_signers: 4, + quorum_size: 400, + quorum_window: 24 * 12, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq60_75, + quorum_active_signers: 32, + quorum_size: 60, + quorum_window: 24 * 12, + quorum_rotation: true, + }, + block_spacing_ms: 5000, + drive: Default::default(), + abci: Default::default(), + core: Default::default(), + execution: Default::default(), + db_path: PathBuf::from("/var/lib/dash-platform/data"), + rejections_path: Some(PathBuf::from("/var/log/dash/rejected")), + #[cfg(feature = "testing-config")] + testing_configs: PlatformTestConfig::default(), + initial_protocol_version: Self::default_initial_protocol_version(), + prometheus_bind_address: None, + grpc_bind_address: "127.0.0.1:26670".to_string(), + tokio_console_enabled: false, + tokio_console_address: PlatformConfig::default_tokio_console_address(), + tokio_console_retention_secs: PlatformConfig::default_tokio_console_retention_secs(), } } } +#[cfg(feature = "testing-config")] /// Configs that should only happen during testing -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug)] pub struct PlatformTestConfig { /// Block signing pub block_signing: bool, + /// Storing of platform state + pub store_platform_state: bool, /// Block signature verification pub block_commit_signature_verification: bool, + /// Disable instant lock signature verification + pub disable_instant_lock_signature_verification: bool, } +#[cfg(feature = "testing-config")] impl PlatformTestConfig { /// Much faster config for tests - pub fn default_with_no_block_signing() -> Self { + pub fn default_minimal_verifications() -> Self { Self { block_signing: false, + store_platform_state: false, block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, } } } +#[cfg(feature = "testing-config")] impl Default for PlatformTestConfig { fn default() -> Self { Self { block_signing: true, + store_platform_state: true, block_commit_signature_verification: true, + disable_instant_lock_signature_verification: false, } } } @@ -341,7 +847,7 @@ mod tests { #[test] fn test_config_from_env() { // ABCI log configs are parsed manually, so they deserve separate handling - // Notat that STDOUT is also defined in .env.example, but env var should overwrite it. + // Note that STDOUT is also defined in .env.example, but env var should overwrite it. let vectors = &[ ("STDOUT", "pretty"), ("UPPERCASE", "json"), @@ -354,14 +860,15 @@ mod tests { env::set_var(format!("ABCI_LOG_{}_FORMAT", vector.0), vector.1); } - let envfile = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".env.example"); + let envfile = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".env.local"); dotenvy::from_path(envfile.as_path()).expect("cannot load .env file"); - assert_eq!("5", env::var("QUORUM_SIZE").unwrap()); + assert_eq!("/tmp/db", env::var("DB_PATH").unwrap()); + assert_eq!("/tmp/rejected", env::var("REJECTIONS_PATH").unwrap()); let config = super::PlatformConfig::from_env().expect("expected config from env"); assert!(config.execution.verify_sum_trees); - assert_ne!(config.quorum_type(), QuorumType::UNKNOWN); + assert_ne!(config.validator_set.quorum_type, QuorumType::UNKNOWN); for id in vectors { matches!(config.abci.log[id.0].destination, LogDestination::Bytes); } diff --git a/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs b/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs index 47e8dbbc8dd..d1f79b1e55d 100644 --- a/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs +++ b/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs @@ -17,6 +17,14 @@ pub fn wait_for_core_to_sync_v0( tracing::info!(?core_rpc, "waiting for core rpc to start"); while !cancel.is_cancelled() { + let has_chain_locked = match core_rpc.get_best_chain_lock() { + Ok(_) => true, + Err(error) => { + tracing::warn!(?error, "cannot get best chain lock"); + false + } + }; + let mn_sync_status = match core_rpc.masternode_sync_status() { Ok(status) => status, Err(error) => { @@ -25,7 +33,7 @@ pub fn wait_for_core_to_sync_v0( } }; - if !mn_sync_status.is_synced || !mn_sync_status.is_blockchain_synced { + if !has_chain_locked || !mn_sync_status.is_synced || !mn_sync_status.is_blockchain_synced { std::thread::sleep(CORE_SYNC_STATUS_CHECK_TIMEOUT); tracing::info!("waiting for core to sync..."); diff --git a/packages/rs-drive-abci/src/error/execution.rs b/packages/rs-drive-abci/src/error/execution.rs index ce9a5886866..efa4e2a6c83 100644 --- a/packages/rs-drive-abci/src/error/execution.rs +++ b/packages/rs-drive-abci/src/error/execution.rs @@ -1,5 +1,6 @@ use dashcore_rpc::dashcore::consensus::encode::Error as DashCoreConsensusEncodeError; use dpp::bls_signatures::BlsError; +use dpp::identity::TimestampMillis; use dpp::version::FeatureVersion; use drive::error::Error as DriveError; @@ -53,21 +54,30 @@ pub enum ExecutionError { /// The platform encountered a corrupted cache state error. #[error("platform corrupted cached state error: {0}")] - CorruptedCachedState(&'static str), + CorruptedCachedState(String), /// The fork is not yet active for core. #[error("initialization fork not active: {0}")] InitializationForkNotActive(String), /// Invalid core chain locked height - #[error("core chain locked height {requested} is invalid: {v20_fork} <= {requested} <= {best} is not true")] - InitializationBadCoreLockedHeight { - /// v20 fork height - v20_fork: u32, - /// requested core height - requested: u32, + #[error("initial height {initial_height} is not chain locked. latest chainlocked height is {chain_lock_height}")] + InitializationHeightIsNotLocked { + /// initial height (requested or fork) + initial_height: u32, /// best core lock height - best: u32, + chain_lock_height: u32, + }, + + /// Genesis time is in the future. + #[error("genesis time {genesis_time} for initial height {initial_height} is in the future. current time is {current_time}")] + InitializationGenesisTimeInFuture { + /// initial height (requested or fork) + initial_height: u32, + /// genesis time + genesis_time: TimestampMillis, + /// current time + current_time: TimestampMillis, }, /// An error occurred during initialization. @@ -121,4 +131,8 @@ pub enum ExecutionError { /// General Bls Error #[error("bls error: {0}")] BlsErrorGeneral(#[from] BlsError), + + /// General IO Error + #[error("io error: {0}")] + IOError(#[from] std::io::Error), } diff --git a/packages/rs-drive-abci/src/error/mod.rs b/packages/rs-drive-abci/src/error/mod.rs index 3658a8169dc..5ada5f06b44 100644 --- a/packages/rs-drive-abci/src/error/mod.rs +++ b/packages/rs-drive-abci/src/error/mod.rs @@ -3,6 +3,8 @@ use crate::error::execution::ExecutionError; use crate::error::serialization::SerializationError; use crate::logging; use dashcore_rpc::Error as CoreRpcError; +use dpp::bls_signatures::BlsError; +use dpp::data_contract::errors::DataContractError; use dpp::platform_value::Error as ValueError; use dpp::version::PlatformVersionError; use drive::dpp::ProtocolError; @@ -36,6 +38,9 @@ pub enum Error { /// Core RPC Error #[error("core rpc error: {0}")] CoreRpc(#[from] CoreRpcError), + /// BLS Error + #[error("BLS error: {0}")] + BLSError(#[from] BlsError), /// Serialization Error #[error("serialization: {0}")] Serialization(#[from] SerializationError), @@ -57,6 +62,12 @@ impl From for Error { } } +impl From for Error { + fn from(value: DataContractError) -> Self { + Self::Protocol(ProtocolError::DataContractError(value)) + } +} + impl From for Error { fn from(value: ValueError) -> Self { let platform_error: ProtocolError = value.into(); @@ -64,6 +75,13 @@ impl From for Error { } } +impl From for Error { + fn from(value: drive::grovedb::Error) -> Self { + let drive_error: DriveError = value.into(); + drive_error.into() + } +} + impl From for ResponseException { fn from(value: Error) -> Self { Self { diff --git a/packages/rs-drive-abci/src/error/query.rs b/packages/rs-drive-abci/src/error/query.rs index 5cff82e1be4..0a6e9317031 100644 --- a/packages/rs-drive-abci/src/error/query.rs +++ b/packages/rs-drive-abci/src/error/query.rs @@ -44,6 +44,10 @@ pub enum QueryError { #[error("not found error: {0}")] NotFound(String), + /// Server issue + #[error("query not serviceable: {0}")] + NotServiceable(String), + /// Decoding Error #[error("decoding error: {0}")] DecodingError(String), diff --git a/packages/rs-drive-abci/src/execution/check_tx/mod.rs b/packages/rs-drive-abci/src/execution/check_tx/mod.rs index e6c5b7d3f35..1904289ca98 100644 --- a/packages/rs-drive-abci/src/execution/check_tx/mod.rs +++ b/packages/rs-drive-abci/src/execution/check_tx/mod.rs @@ -1,14 +1,75 @@ use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::platform_types::platform::Platform; +use crate::platform_types::platform::{Platform, PlatformRef}; +use crate::abci::AbciError; use crate::rpc::core::CoreRPCLike; use dpp::consensus::ConsensusError; use dpp::fee::fee_result::FeeResult; use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; mod v0; +// @append_only +#[repr(u8)] +#[derive(Copy, Clone, Debug)] +pub enum CheckTxLevel { + FirstTimeCheck = 0, + Recheck = 1, +} + +impl TryFrom for CheckTxLevel { + type Error = Error; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(CheckTxLevel::FirstTimeCheck), + 1 => Ok(CheckTxLevel::Recheck), + value => Err(Error::Abci(AbciError::BadRequest(format!( + "Invalid value for CheckTxLevel {}", + value + )))), + } + } +} + +impl TryFrom for CheckTxLevel { + type Error = Error; + + fn try_from(value: i32) -> Result { + match value { + 0 => Ok(CheckTxLevel::FirstTimeCheck), + 1 => Ok(CheckTxLevel::Recheck), + value => Err(Error::Abci(AbciError::BadRequest(format!( + "Invalid value for CheckTxLevel {}", + value + )))), + } + } +} + +/// The result of a check tx +#[derive(Clone, Debug)] +pub struct CheckTxResult { + /// The level used when checking the transaction + pub level: CheckTxLevel, + /// The fee_result if there was one + /// There might not be one in the case of a very cheep recheck + pub fee_result: Option, + /// A set of unique identifiers, if any are found already in the mempool then tenderdash should + /// reject the transition. All transitions return only 1 unique identifier except the documents + /// batch transition that returns 1 for each document transition + pub unique_identifiers: Vec, + /// Priority to return to tenderdash. State Transitions with higher priority take precedence + /// over state transitions with lower priority + pub priority: u32, + /// State transition type name. Using for logging + pub state_transition_name: Option, + /// State transition ID. Using for logging + pub state_transition_hash: Option<[u8; 32]>, +} + impl Platform where C: CoreRPCLike, @@ -25,16 +86,17 @@ where /// /// # Returns /// - /// * `Result, Error>` - If the state transition passes all + /// * `Result, Error>` - If the state transition passes all /// checks, it returns a `ValidationResult` with fee information. If any check fails, it returns an `Error`. pub fn check_tx( &self, raw_tx: &[u8], - ) -> Result, Error> { - let state = self.state.read().expect("expected to get state"); - let platform_version = state.current_platform_version()?; + check_tx_level: CheckTxLevel, + platform_ref: &PlatformRef, + platform_version: &PlatformVersion, + ) -> Result, Error> { match platform_version.drive_abci.methods.engine.check_tx { - 0 => self.check_tx_v0(raw_tx), + 0 => self.check_tx_v0(raw_tx, check_tx_level, platform_ref, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "check_tx".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs b/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs index 8368c3e21d0..d24ce2361d2 100644 --- a/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs @@ -1,28 +1,36 @@ use crate::error::Error; -use crate::execution::validation::state_transition::processor::process_state_transition; -use crate::platform_types::platform::{Platform, PlatformRef}; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::check_tx::{CheckTxLevel, CheckTxResult}; +use crate::execution::validation::state_transition::check_tx_verification::state_transition_to_execution_event_for_check_tx; + #[cfg(test)] -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; +use crate::platform_types::event_execution_result::EventExecutionResult; #[cfg(test)] -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::ConsensusExecutionError; +use crate::platform_types::event_execution_result::EventExecutionResult::UnpaidConsensusExecutionError; +use crate::platform_types::platform::{Platform, PlatformRef}; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; -use dpp::consensus::basic::decode::SerializedObjectParsingError; -use dpp::consensus::basic::BasicError; + use dpp::consensus::ConsensusError; -use dpp::fee::epoch::GENESIS_EPOCH_INDEX; -use dpp::fee::fee_result::FeeResult; + +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, InvalidStateTransition, InvalidWithProtocolErrorStateTransition, + SuccessfullyDecodedStateTransition, +}; +#[cfg(test)] +use crate::execution::validation::state_transition::processor::process_state_transition; +#[cfg(test)] use dpp::serialization::PlatformDeserializable; -use dpp::state_transition::StateTransition; #[cfg(test)] -use dpp::validation::SimpleConsensusValidationResult; +use dpp::state_transition::StateTransition; +use dpp::util::hash::hash_single; use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; #[cfg(test)] use drive::grovedb::Transaction; +const PRIORITY_USER_FEE_INCREASE_MULTIPLIER: u32 = 100; + impl Platform where C: CoreRPCLike, @@ -31,32 +39,41 @@ where pub(in crate::execution) fn execute_tx( &self, raw_tx: Vec, - block_info: &BlockInfo, transaction: &Transaction, - ) -> Result { + ) -> Result { let state_transition = StateTransition::deserialize_from_bytes(raw_tx.as_slice()).map_err(Error::Protocol)?; - let state_read_guard = self.state.read().unwrap(); + + let state_read_guard = self.state.load(); + let platform_ref = PlatformRef { drive: &self.drive, state: &state_read_guard, config: &self.config, core_rpc: &self.core_rpc, - block_info, }; - let state_transition_execution_event = - process_state_transition(&platform_ref, state_transition, Some(transaction))?; - - if state_transition_execution_event.is_valid() { - let platform_version = platform_ref.state.current_platform_version()?; - let execution_event = state_transition_execution_event.into_data()?; - self.execute_event(execution_event, block_info, transaction, platform_version) + let state_transition_execution_event = process_state_transition( + &platform_ref, + self.state.load().last_block_info(), + state_transition, + Some(transaction), + )?; + + if state_transition_execution_event.has_data() { + let (execution_event, errors) = + state_transition_execution_event.into_data_and_errors()?; + self.execute_event( + execution_event, + errors, + state_read_guard.last_block_info(), + transaction, + platform_ref.state.current_platform_version()?, + platform_ref.state.previous_fee_versions(), + ) } else { - Ok(ConsensusExecutionError( - SimpleConsensusValidationResult::new_with_errors( - state_transition_execution_event.errors, - ), + Ok(UnpaidConsensusExecutionError( + state_transition_execution_event.errors, )) } } @@ -64,7 +81,8 @@ where /// Checks a state transition to determine if it should be added to the mempool. /// /// This function performs a few checks, including validating the state transition and ensuring that the - /// user can pay for it. It may be inaccurate in rare cases, so the proposer needs to re-check transactions + /// user can pay for it. From the time a state transition is added to the mempool to the time it is included in a proposed block, + /// a previously valid state transition may have become invalid, so the proposer needs to re-check transactions /// before proposing a block. /// /// # Arguments @@ -73,53 +91,120 @@ where /// /// # Returns /// - /// * `Result, Error>` - If the state transition passes all + /// * `Result, Error>` - If the state transition passes all /// checks, it returns a `ValidationResult` with fee information. If any check fails, it returns an `Error`. pub(super) fn check_tx_v0( &self, raw_tx: &[u8], - ) -> Result, Error> { - let state_transition = match StateTransition::deserialize_from_bytes(raw_tx) { - Ok(state_transition) => state_transition, - Err(err) => { - return Ok(ValidationResult::new_with_error( - ConsensusError::BasicError(BasicError::SerializedObjectParsingError( - SerializedObjectParsingError::new(err.to_string()), - )), - )) - } + check_tx_level: CheckTxLevel, + platform_ref: &PlatformRef, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut state_transition_hash = None; + if tracing::enabled!(tracing::Level::TRACE) { + state_transition_hash = Some(hash_single(raw_tx)); + } + + let mut check_tx_result = CheckTxResult { + level: check_tx_level, + fee_result: None, + unique_identifiers: vec![], + priority: 0, + state_transition_name: None, + state_transition_hash, }; - let state_read_guard = self.state.read().unwrap(); + let raw_state_transitions = vec![raw_tx]; + let mut decoded_state_transitions: Vec = self + .decode_raw_state_transitions(&raw_state_transitions, platform_version)? + .into(); - // Latest committed or genesis block info - let block_info = state_read_guard.any_block_info(); + if decoded_state_transitions.len() != 1 { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected exactly one decoded state transition", + ))); + } - let platform_ref = PlatformRef { - drive: &self.drive, - state: &state_read_guard, - config: &self.config, - core_rpc: &self.core_rpc, - block_info, + let state_transition = match decoded_state_transitions.remove(0) { + DecodedStateTransition::SuccessfullyDecoded(SuccessfullyDecodedStateTransition { + decoded, + .. + }) => decoded, + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { error, .. }) => { + return Ok(ValidationResult::new_with_data_and_errors( + check_tx_result, + vec![error], + )); + } + DecodedStateTransition::FailedToDecode(InvalidWithProtocolErrorStateTransition { + error, + .. + }) => { + return Err(error.into()); + } }; - let execution_event = process_state_transition(&platform_ref, state_transition, None)?; + let user_fee_increase = state_transition.user_fee_increase() as u32; + + check_tx_result.priority = + user_fee_increase.saturating_mul(PRIORITY_USER_FEE_INCREASE_MULTIPLIER); + + check_tx_result.state_transition_name = Some(state_transition.name().to_string()); + + check_tx_result.unique_identifiers = state_transition.unique_identifiers(); - let platform_version = platform_ref.state.current_platform_version()?; + let validation_result = state_transition_to_execution_event_for_check_tx( + platform_ref, + state_transition, + check_tx_level, + platform_version, + )?; + + // If there are any validation errors happen we return + // the validation result with errors and CheckTxResult data + if !validation_result.is_valid() { + return Ok(ValidationResult::new_with_data_and_errors( + check_tx_result, + validation_result.errors, + )); + } + + // If we are here then state transition pre-validation succeeded + + // We should run the execution event in dry run (estimated fees) + // to see if we would have enough fees for the transition + if let Some(execution_event) = validation_result.into_data()? { + let validation_result = self.validate_fees_of_event( + &execution_event, + platform_ref.state.last_block_info(), + None, + platform_version, + platform_ref.state.previous_fee_versions(), + )?; + + let (estimated_fee_result, errors) = validation_result.into_data_and_errors()?; + + check_tx_result.fee_result = Some(estimated_fee_result); - // We should run the execution event in dry run to see if we would have enough fees for the transition - execution_event.and_then_borrowed_validation(|execution_event| { - self.validate_fees_of_event(execution_event, block_info, None, platform_version) - }) + Ok(ValidationResult::new_with_data_and_errors( + check_tx_result, + errors, + )) + } else { + // In case of asset lock based transitions, we don't have execution event + // because we already validated remaining balance + Ok(ValidationResult::new_with_data(check_tx_result)) + } } } #[cfg(test)] mod tests { - use crate::config::PlatformConfig; + use crate::config::{PlatformConfig, PlatformTestConfig}; + use crate::platform_types::event_execution_result::EventExecutionResult::{ + SuccessfulPaidExecution, UnpaidConsensusExecutionError, UnsuccessfulPaidExecution, + }; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; - use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::SuccessfulPaidExecution; - use crate::platform_types::system_identity_public_keys::v0::SystemIdentityPublicKeysV0; use crate::test::helpers::setup::TestPlatformBuilder; use dpp::block::block_info::BlockInfo; use dpp::consensus::basic::BasicError; @@ -130,11 +215,10 @@ mod tests { use dpp::dashcore::secp256k1::Secp256k1; use dpp::dashcore::{key::KeyPair, signer, Network, PrivateKey}; - use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::document_type::random_document::{ CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType, }; - use dpp::data_contracts::dpns_contract; use dpp::document::document_methods::DocumentMethodsV0; use dpp::document::DocumentV0Setters; use dpp::identity::accessors::{IdentityGettersV0, IdentitySettersV0}; @@ -144,6 +228,7 @@ mod tests { use dpp::prelude::{Identifier, IdentityPublicKey}; use dpp::serialization::{PlatformSerializable, Signable}; + use dpp::native_bls::NativeBlsModule; use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; @@ -155,36 +240,65 @@ mod tests { use dpp::state_transition::public_key_in_creation::v0::IdentityPublicKeyInCreationV0; use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use dpp::state_transition::{StateTransition, StateTransitionLike}; - use dpp::tests::fixtures::{get_dashpay_contract_fixture, instant_asset_lock_proof_fixture}; + use dpp::tests::fixtures::{ + get_dashpay_contract_fixture, get_dpns_data_contract_fixture, + instant_asset_lock_proof_fixture, + }; use dpp::version::PlatformVersion; - use dpp::NativeBlsModule; + use crate::execution::check_tx::CheckTxLevel::{FirstTimeCheck, Recheck}; + use crate::execution::validation::state_transition::tests::{ + setup_identity, setup_identity_return_master_key, + }; + use crate::platform_types::platform::PlatformRef; + use assert_matches::assert_matches; + use dpp::consensus::state::state_error::StateError; + use dpp::dash_to_credits; + use dpp::data_contract::document_type::v0::random_document_type::{ + FieldMinMaxBounds, FieldTypeWeights, RandomDocumentTypeParameters, + }; + use dpp::data_contract::document_type::v0::DocumentTypeV0; + use dpp::data_contract::document_type::DocumentType; use dpp::identity::contract_bounds::ContractBounds::SingleContractDocumentType; + use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + use dpp::identity::signer::Signer; use dpp::platform_value::Bytes32; - use dpp::system_data_contracts::dashpay_contract; + use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; + use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; + use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Setters; use dpp::system_data_contracts::SystemDataContract::Dashpay; - use platform_version::TryIntoPlatformVersioned; + use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use rand::rngs::StdRng; use rand::SeedableRng; use std::collections::BTreeMap; - // This test needs to be finished, but is still useful for debugging + // This test needs to be redone with new contract bytes, but is still useful for debugging #[test] #[ignore] fn verify_check_tx_on_data_contract_create() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) - .build_with_mock_rpc(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); - let state = platform.state.read().unwrap(); - let protocol_version = state.current_protocol_version_in_consensus(); + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); let platform_version = PlatformVersion::get(protocol_version).unwrap(); + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + let tx: Vec = vec![ 0, 0, 0, 104, 37, 39, 102, 34, 99, 205, 58, 189, 155, 27, 93, 128, 49, 86, 24, 164, 86, 171, 102, 203, 151, 25, 88, 2, 9, 48, 215, 150, 16, 127, 114, 0, 0, 0, 0, 0, 1, 0, 0, @@ -201,8 +315,8 @@ mod tests { 217, 221, 43, 251, 104, 84, 78, 35, 20, 237, 188, 237, 240, 216, 62, 79, 208, 96, 149, 116, 62, 82, 187, 135, 219, ]; - let state_transitions = StateTransition::deserialize_many(&vec![tx.clone()]) - .expect("expected a state transition"); + let state_transitions = + StateTransition::deserialize_many(&[tx.clone()]).expect("expected a state transition"); let state_transition = state_transitions.first().unwrap(); let StateTransition::DataContractCreate(contract_create) = state_transition else { panic!("expecting a data contract create"); @@ -234,33 +348,54 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); - let check_result = platform.check_tx(&tx).expect("expected to check tx"); + let check_result = platform + .check_tx(&tx, FirstTimeCheck, &platform_ref, platform_version) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let check_result = platform + .check_tx(&tx, Recheck, &platform_ref, platform_version) + .expect("expected to check tx"); - let result = platform + assert!(check_result.is_valid()); + + platform .platform .process_raw_state_transitions( - &vec![tx], - &state, + &vec![tx.clone()], + &platform_state, &BlockInfo::default(), &transaction, platform_version, + false, + None, ) .expect("expected to process state transition"); + + let check_result = platform + .check_tx(&tx, Recheck, &platform_ref, platform_version) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); } #[test] fn data_contract_create_check_tx() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) - .build_with_mock_rpc(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); - let state = platform.state.read().unwrap(); - let protocol_version = state.current_protocol_version_in_consensus(); + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); let platform_version = PlatformVersion::get(protocol_version).unwrap(); let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( @@ -285,7 +420,7 @@ mod tests { } .into(); - let dashpay = get_dashpay_contract_fixture(Some(identity.id()), protocol_version); + let dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); let mut create_contract_state_transition: StateTransition = dashpay .try_into_platform_versioned(platform_version) .expect("expected a state transition"); @@ -307,183 +442,1212 @@ mod tests { ) .expect("expected to insert identity"); + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + let validation_result = platform - .check_tx(serialized.as_slice()) + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); - } - #[test] - fn document_update_check_tx() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) - .build_with_mock_rpc(); + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2483610); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); - let mut platform_state = platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version().unwrap(); + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); - let mut signer = SimpleSigner::default(); + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check - let mut rng = StdRng::seed_from_u64(567); + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn data_contract_create_check_tx_for_invalid_contract() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, - Some(19), + Some(1), platform_version, ) .expect("expected to get key pair"); - signer.add_key(key.clone(), private_key.clone()); - - let (_, pk) = ECDSA_SECP256K1 - .random_public_and_private_key_data(&mut rng, platform_version) - .unwrap(); - - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); - - let identifier = asset_lock_proof - .create_identifier() - .expect("expected an identifier"); - + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); let identity: Identity = IdentityV0 { - id: identifier, + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), public_keys: BTreeMap::from([(1, key.clone())]), balance: 1000000000, revision: 0, } .into(); - let identity_create_transition: StateTransition = - IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), - asset_lock_proof, - pk.as_slice(), - &signer, - &NativeBlsModule, - platform_version, - ) - .expect("expected an identity create transition"); + let mut dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + + let dashpay_id = dashpay.data_contract().id(); + // we need to alter dashpay to make it invalid + + let document_types = dashpay.data_contract_mut().document_types_mut(); + + let parameters = RandomDocumentTypeParameters { + new_fields_optional_count_range: 5..6, + new_fields_required_count_range: 3..4, + new_indexes_count_range: Default::default(), + field_weights: FieldTypeWeights { + string_weight: 5, + float_weight: 3, + integer_weight: 2, + date_weight: 0, + boolean_weight: 1, + byte_array_weight: 0, + }, + field_bounds: FieldMinMaxBounds { + string_min_len: Default::default(), + string_has_min_len_chance: 0.0, + string_max_len: Default::default(), + string_has_max_len_chance: 0.0, + integer_min: Default::default(), + integer_has_min_chance: 0.0, + integer_max: Default::default(), + integer_has_max_chance: 0.0, + float_min: Default::default(), + float_has_min_chance: 0.0, + float_max: Default::default(), + float_has_max_chance: 0.0, + date_min: 0, + date_max: 100, + byte_array_min_len: Default::default(), + byte_array_has_min_len_chance: 0.0, + byte_array_max_len: Default::default(), + byte_array_has_max_len_chance: 0.0, + }, + keep_history_chance: 0.0, + documents_mutable_chance: 0.0, + documents_can_be_deleted_chance: 0.0, + }; - let identity_create_serialized_transition = identity_create_transition - .serialize_to_bytes() - .expect("serialized state transition"); + let mut rng = StdRng::seed_from_u64(6); + + document_types.insert( + "invalid".to_string(), + DocumentType::V0( + DocumentTypeV0::invalid_random_document_type( + parameters, + dashpay_id, + &mut rng, + platform_version, + ) + .expect("expected an invalid document type"), + ), + ); - let dashpay = - get_dashpay_contract_fixture(Some(identity.id()), platform_version.protocol_version); - let dashpay_contract = dashpay.data_contract().clone(); let mut create_contract_state_transition: StateTransition = dashpay .try_into_platform_versioned(platform_version) .expect("expected a state transition"); create_contract_state_transition .sign(&key, private_key.as_slice(), &NativeBlsModule) .expect("expected to sign transition"); - let data_contract_create_serialized_transition = create_contract_state_transition + let serialized = create_contract_state_transition .serialize_to_bytes() - .expect("expected data contract create serialized state transition"); + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); - let profile = dashpay_contract - .document_type_for_name("profile") - .expect("expected a profile document type"); + let validation_result = platform + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); - let entropy = Bytes32::random_with_rng(&mut rng); + assert!(validation_result.errors.is_empty()); - let mut document = profile - .random_document_with_identifier_and_entropy( - &mut rng, - identifier, - entropy, - DocumentFieldFillType::FillIfNotRequired, - DocumentFieldFillSize::AnyDocumentFillSize, + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, platform_version, ) - .expect("expected a random document"); - - document.set("avatarUrl", "http://test.com/bob.jpg".into()); + .expect("expected to check tx"); - let mut altered_document = document.clone(); + assert!(check_result.is_valid()); - altered_document.increment_revision().unwrap(); - altered_document.set("displayName", "Samuel".into()); - altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + let transaction = platform.drive.grove.start_transaction(); - let documents_batch_create_transition = - DocumentsBatchTransition::new_document_creation_transition_from_document( - document, - profile, - entropy.0, - &key, - &signer, + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, platform_version, - None, - None, + false, None, ) - .expect("expect to create documents batch transition"); + .expect("expected to process state transition"); - let documents_batch_create_serialized_transition = documents_batch_create_transition - .serialize_to_bytes() - .expect("expected documents batch serialized state transition"); + // We have one invalid paid for state transition + assert_eq!(processing_result.invalid_paid_count(), 1); - let documents_batch_update_transition = - DocumentsBatchTransition::new_document_replacement_transition_from_document( - altered_document, - profile, - &key, - &signer, + assert_eq!(processing_result.aggregated_fees().processing_fee, 346660); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, platform_version, - None, - None, - None, ) - .expect("expect to create documents batch transition"); + .expect("expected to check tx"); - let documents_batch_update_serialized_transition = documents_batch_update_transition - .serialize_to_bytes() - .expect("expected documents batch serialized state transition"); + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction platform .drive - .create_initial_state_structure(None, platform_version) - .expect("expected to create state structure"); - - let transaction = platform.drive.grove.start_transaction(); + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); - let validation_result = platform - .execute_tx( - identity_create_serialized_transition, - &BlockInfo::default(), - &transaction, + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, ) - .expect("expected to execute identity_create tx"); + .expect("expected to check tx"); - assert!( - matches!(validation_result, SuccessfulPaidExecution(..)), - "{:?}", - validation_result + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn data_contract_create_check_tx_priority() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut create_contract_state_transition: StateTransition = dashpay + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + + create_contract_state_transition.set_user_fee_increase(100); // This means that things will be twice as expensive + + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let validation_result = platform + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + assert_eq!(validation_result.data.unwrap().priority, 10000); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + assert_eq!(check_result.data.unwrap().priority, 10000); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + // The processing fees should be twice as much as a fee multiplier of 0, + // since a fee multiplier of 100 means 100% more of 1 (gives 2) + assert_eq!(processing_result.aggregated_fees().processing_fee, 4967220); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + assert_eq!(check_result.data.unwrap().priority, 10000); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn data_contract_create_check_tx_after_identity_balance_used_up() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 200000000, // we have enough balance only for 1 insertion (this is where this test is different) + revision: 0, + } + .into(); + + let dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut create_contract_state_transition: StateTransition = dashpay + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let validation_result = platform + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // the identity shouldn't have enough balance anymore + } + + #[test] + fn data_contract_update_check_tx() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let dashpay_created_contract = + get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut modified_dashpay_contract = dashpay_created_contract.data_contract().clone(); + let mut create_contract_state_transition: StateTransition = dashpay_created_contract + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2483610); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // Now let's do the data contract update + let _dashpay_id = modified_dashpay_contract.id(); + // we need to alter dashpay to make it invalid + + modified_dashpay_contract.set_version(2); + + let document_types = modified_dashpay_contract.document_types_mut(); + + let dpns_contract = + get_dpns_data_contract_fixture(Some(identity.id()), 1, protocol_version) + .data_contract_owned(); + + document_types.insert( + "preorder".to_string(), + dpns_contract + .document_type_for_name("preorder") + .expect("expected document type") + .to_owned_document_type(), + ); + + let mut update_contract_state_transition: StateTransition = + DataContractUpdateTransition::try_from_platform_versioned( + (modified_dashpay_contract, 2), + platform_version, + ) + .expect("expected a state transition") + .into(); + + update_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized_update = update_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let validation_result = platform + .check_tx( + serialized_update.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + let update_processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized_update.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + // We have one invalid paid for state transition + assert_eq!(update_processing_result.valid_count(), 1); + + assert_eq!( + update_processing_result.aggregated_fees().processing_fee, + 2495990 + ); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn data_contract_update_check_tx_for_invalid_update() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let dashpay_created_contract = + get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut modified_dashpay_contract = dashpay_created_contract.data_contract().clone(); + let mut create_contract_state_transition: StateTransition = dashpay_created_contract + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2483610); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // Now let's do the data contract update + let dashpay_id = modified_dashpay_contract.id(); + // we need to alter dashpay to make it invalid + + let document_types = modified_dashpay_contract.document_types_mut(); + + let parameters = RandomDocumentTypeParameters { + new_fields_optional_count_range: 5..6, + new_fields_required_count_range: 3..4, + new_indexes_count_range: Default::default(), + field_weights: FieldTypeWeights { + string_weight: 5, + float_weight: 3, + integer_weight: 2, + date_weight: 0, + boolean_weight: 1, + byte_array_weight: 0, + }, + field_bounds: FieldMinMaxBounds { + string_min_len: Default::default(), + string_has_min_len_chance: 0.0, + string_max_len: Default::default(), + string_has_max_len_chance: 0.0, + integer_min: Default::default(), + integer_has_min_chance: 0.0, + integer_max: Default::default(), + integer_has_max_chance: 0.0, + float_min: Default::default(), + float_has_min_chance: 0.0, + float_max: Default::default(), + float_has_max_chance: 0.0, + date_min: 0, + date_max: 100, + byte_array_min_len: Default::default(), + byte_array_has_min_len_chance: 0.0, + byte_array_max_len: Default::default(), + byte_array_has_max_len_chance: 0.0, + }, + keep_history_chance: 0.0, + documents_mutable_chance: 0.0, + documents_can_be_deleted_chance: 0.0, + }; + + let mut rng = StdRng::seed_from_u64(6); + + document_types.insert( + "invalid".to_string(), + DocumentType::V0( + DocumentTypeV0::invalid_random_document_type( + parameters, + dashpay_id, + &mut rng, + platform_version, + ) + .expect("expected an invalid document type"), + ), ); + let mut update_contract_state_transition: StateTransition = + DataContractUpdateTransition::try_from_platform_versioned( + (modified_dashpay_contract, 2), + platform_version, + ) + .expect("expected a state transition") + .into(); + + update_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized_update = update_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + let validation_result = platform - .execute_tx( - data_contract_create_serialized_transition, + .check_tx( + serialized_update.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized_update.clone()], + &platform_state, &BlockInfo::default(), &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + // We have one invalid paid for state transition + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 448640); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn document_update_check_tx() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version().unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(19), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let dashpay = + get_dashpay_contract_fixture(Some(identity.id()), 1, platform_version.protocol_version); + let dashpay_contract = dashpay.data_contract().clone(); + let mut create_contract_state_transition: StateTransition = dashpay + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let data_contract_create_serialized_transition = create_contract_state_transition + .serialize_to_bytes() + .expect("expected data contract create serialized state transition"); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identifier, + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + + assert!( + matches!(validation_result, SuccessfulPaidExecution(..)), + "{:?}", + validation_result + ); + + let validation_result = platform + .execute_tx(data_contract_create_serialized_transition, &transaction) .expect("expected to execute data_contract_create tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); let validation_result = platform - .execute_tx( - documents_batch_create_serialized_transition, - &BlockInfo::default(), - &transaction, - ) + .execute_tx(documents_batch_create_serialized_transition, &transaction) .expect("expected to execute document_create tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -495,7 +1659,12 @@ mod tests { .expect("expected to commit transaction"); let validation_result = platform - .check_tx(documents_batch_update_serialized_transition.as_slice()) + .check_tx( + documents_batch_update_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); @@ -503,22 +1672,38 @@ mod tests { #[test] fn identity_top_up_check_tx() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) - .build_with_mock_rpc(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + let mut signer = SimpleSigner::default(); let mut rng = StdRng::seed_from_u64(567); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, Some(19), @@ -532,9 +1717,10 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identifier = asset_lock_proof .create_identifier() @@ -542,7 +1728,7 @@ mod tests { let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } @@ -550,11 +1736,12 @@ mod tests { let identity_create_transition: StateTransition = IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), + &identity, asset_lock_proof, pk.as_slice(), &signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected an identity create transition"); @@ -571,11 +1758,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_create_serialized_transition, - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_create_serialized_transition, &transaction) .expect("expected to execute identity_create tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -590,16 +1773,17 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identity_top_up_transition: StateTransition = IdentityTopUpTransition::try_from_identity( - identity.clone(), + &identity, asset_lock_proof_top_up, pk.as_slice(), - &NativeBlsModule, + 0, platform_version, None, ) @@ -610,7 +1794,12 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); @@ -618,11 +1807,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_top_up_serialized_transition, - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_top_up_serialized_transition, &transaction) .expect("expected to execute identity top up tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -636,18 +1821,209 @@ mod tests { #[test] fn identity_cant_double_top_up() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) .build_with_mock_rpc(); + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version().unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(19), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identity_top_up_transition: StateTransition = + IdentityTopUpTransition::try_from_identity( + &identity, + asset_lock_proof_top_up, + pk.as_slice(), + 0, + platform_version, + None, + ) + .expect("expected an identity create transition"); + + let identity_top_up_serialized_transition = identity_top_up_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let validation_result = platform + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_top_up_serialized_transition.clone(), &transaction) + .expect("expected to execute identity top up tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let validation_result = platform + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); + + let validation_result = platform + .check_tx( + identity_top_up_serialized_transition.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); + } + + #[test] + fn identity_top_up_with_unknown_identity_doesnt_panic() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; - let platform_state = platform.state.read().unwrap(); + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); + + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + let mut signer = SimpleSigner::default(); let mut rng = StdRng::seed_from_u64(567); @@ -665,9 +2041,10 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identifier = asset_lock_proof .create_identifier() @@ -681,13 +2058,124 @@ mod tests { } .into(); + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identity_top_up_transition: StateTransition = + IdentityTopUpTransition::try_from_identity( + &identity, + asset_lock_proof_top_up, + pk.as_slice(), + 0, + platform_version, + None, + ) + .expect("expected an identity create transition"); + + let identity_top_up_serialized_transition = identity_top_up_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let validation_result = platform + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + // This errors because we never created the identity + + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::SignatureError(SignatureError::IdentityNotFoundError(_)) + )); + } + + #[test] + fn identity_cant_create_with_used_outpoint() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); + + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version().unwrap(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(19), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + let identity_create_transition: StateTransition = IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), + &identity, asset_lock_proof, pk.as_slice(), &signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected an identity create transition"); @@ -704,11 +2192,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_create_serialized_transition, - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_create_serialized_transition, &transaction) .expect("expected to execute identity_create tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -723,16 +2207,17 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identity_top_up_transition: StateTransition = IdentityTopUpTransition::try_from_identity( - identity.clone(), - asset_lock_proof_top_up, + &identity, + asset_lock_proof_top_up.clone(), pk.as_slice(), - &NativeBlsModule, + 0, platform_version, None, ) @@ -743,7 +2228,12 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); @@ -751,11 +2241,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_top_up_serialized_transition.clone(), - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_top_up_serialized_transition.clone(), &transaction) .expect("expected to execute identity top up tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -766,123 +2252,120 @@ mod tests { .unwrap() .expect("expected to commit transaction"); - let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) - .expect("expected to check tx"); - - assert!(matches!( - validation_result.errors.first().expect("expected an error"), - ConsensusError::BasicError( - BasicError::IdentityAssetLockTransactionOutPointAlreadyExistsError(_) - ) - )); - } - - #[test] - fn identity_top_up_with_unknown_identity_doesnt_panic() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) - .build_with_mock_rpc(); - - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); - - let platform_state = platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version().unwrap(); + // At this point we try creating a new identity with a used asset lock let mut signer = SimpleSigner::default(); - let mut rng = StdRng::seed_from_u64(567); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(4), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, - Some(19), + Some(50), platform_version, ) .expect("expected to get key pair"); signer.add_key(key.clone(), private_key.clone()); - let (_, pk) = ECDSA_SECP256K1 - .random_public_and_private_key_data(&mut rng, platform_version) - .unwrap(); - - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); - - let identifier = asset_lock_proof + let identifier = asset_lock_proof_top_up .create_identifier() .expect("expected an identifier"); let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } .into(); - platform - .drive - .create_initial_state_structure(None, platform_version) - .expect("expected to create state structure"); - - let (_, pk) = ECDSA_SECP256K1 - .random_public_and_private_key_data(&mut rng, platform_version) - .unwrap(); - - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); - - let identity_top_up_transition: StateTransition = - IdentityTopUpTransition::try_from_identity( - identity.clone(), + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, asset_lock_proof_top_up, pk.as_slice(), + &signer, &NativeBlsModule, + 0, platform_version, - None, ) .expect("expected an identity create transition"); - let identity_top_up_serialized_transition = identity_top_up_transition + let identity_create_serialized_transition = identity_create_transition .serialize_to_bytes() .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_create_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to check tx"); - // This errors because we never created the identity + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); + + let validation_result = platform + .check_tx( + identity_create_serialized_transition.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); assert!(matches!( validation_result.errors.first().expect("expected an error"), - ConsensusError::SignatureError(SignatureError::IdentityNotFoundError(_)) + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) )); } #[test] - fn identity_cant_create_with_used_outpoint() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) - .build_with_mock_rpc(); + fn identity_can_create_with_semi_used_outpoint() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc(); - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + let mut signer = SimpleSigner::default(); let mut rng = StdRng::seed_from_u64(567); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, Some(19), @@ -896,9 +2379,10 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identifier = asset_lock_proof .create_identifier() @@ -906,23 +2390,39 @@ mod tests { let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } .into(); - let identity_create_transition: StateTransition = + let mut identity_create_transition: StateTransition = IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), - asset_lock_proof, + &identity, + asset_lock_proof.clone(), pk.as_slice(), &signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected an identity create transition"); + let valid_identity_create_transition = identity_create_transition.clone(); + + // let's add an error so this fails on state validation + + if let StateTransition::IdentityCreate(identity_create_transition_inner) = + &mut identity_create_transition + { + // let's create a new key that isn't signed + let master_key = identity_create_transition_inner + .public_keys_mut() + .get_mut(0) + .expect("expected master key"); + master_key.set_signature(vec![].into()); + }; + let identity_create_serialized_transition = identity_create_transition .serialize_to_bytes() .expect("serialized state transition"); @@ -935,12 +2435,67 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_create_serialized_transition, - &BlockInfo::default(), - &transaction, + .execute_tx(identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + assert!(matches!(validation_result, UnsuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // now lets try to recreate the valid identity + + // This one will use the balance on the outpoint that was already saved + + let valid_identity_create_serialized_transition = valid_identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(valid_identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // this is unpaid because it will look like a replay attack + assert!(matches!( + validation_result, + UnpaidConsensusExecutionError(..) + )); + + let valid_identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 1, + platform_version, ) + .expect("expected an identity create transition"); + + let valid_identity_create_serialized_transition = valid_identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(valid_identity_create_serialized_transition, &transaction) .expect("expected to execute identity_create tx"); + + // the user fee increase changed, so this is now passing assert!(matches!(validation_result, SuccessfulPaidExecution(..))); platform @@ -954,16 +2509,17 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identity_top_up_transition: StateTransition = IdentityTopUpTransition::try_from_identity( - identity.clone(), + &identity, asset_lock_proof_top_up.clone(), pk.as_slice(), - &NativeBlsModule, + 0, platform_version, None, ) @@ -974,7 +2530,12 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); @@ -982,11 +2543,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_top_up_serialized_transition.clone(), - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_top_up_serialized_transition.clone(), &transaction) .expect("expected to execute identity top up tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -1001,6 +2558,12 @@ mod tests { let mut signer = SimpleSigner::default(); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(4), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, Some(50), @@ -1016,7 +2579,7 @@ mod tests { let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } @@ -1024,11 +2587,12 @@ mod tests { let identity_create_transition: StateTransition = IdentityCreateTransition::try_from_identity_with_signer( - identity, + &identity, asset_lock_proof_top_up, pk.as_slice(), &signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected an identity create transition"); @@ -1038,66 +2602,62 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_create_serialized_transition.as_slice()) + .check_tx( + identity_create_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) + .expect("expected to check tx"); + + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); + + let validation_result = platform + .check_tx( + identity_create_serialized_transition.as_slice(), + Recheck, + &platform_ref, + platform_version, + ) .expect("expected to check tx"); assert!(matches!( validation_result.errors.first().expect("expected an error"), ConsensusError::BasicError( - BasicError::IdentityAssetLockTransactionOutPointAlreadyExistsError(_) + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) ) )); } #[test] fn identity_update_with_non_master_key_check_tx() { - let mut config = PlatformConfig::default(); - - let mut rng = StdRng::seed_from_u64(1); - - let secp = Secp256k1::new(); - - let master_key_pair = KeyPair::new(&secp, &mut rng); - - let _master_secret_key = master_key_pair.secret_key(); - - let master_public_key = master_key_pair.public_key(); - - config.abci.keys.dpns_master_public_key = master_public_key.serialize().to_vec(); - - let high_key_pair = KeyPair::new(&secp, &mut rng); - - let high_secret_key = high_key_pair.secret_key(); - - let high_public_key = high_key_pair.public_key(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; - config.abci.keys.dpns_second_public_key = high_public_key.serialize().to_vec(); + let platform_version = PlatformVersion::latest(); let mut platform = TestPlatformBuilder::new() - .with_config(config) - .build_with_mock_rpc(); + .with_config(platform_config) + .build_with_mock_rpc() + .set_genesis_state(); - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); - - let platform_state = platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version().unwrap(); + let mut rng = StdRng::seed_from_u64(433); - let genesis_time = 0; + let platform_state = platform.state.load(); - let system_identity_public_keys_v0: SystemIdentityPublicKeysV0 = - platform.config.abci.keys.clone().into(); + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); - platform - .create_genesis_state( - genesis_time, - system_identity_public_keys_v0.into(), - None, - platform_version, - ) - .expect("expected to create genesis state"); + let secp = Secp256k1::new(); let new_key_pair = KeyPair::new(&secp, &mut rng); @@ -1122,94 +2682,87 @@ mod tests { new_key.signature = signature.to_vec().into(); let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { - identity_id: dpns_contract::OWNER_ID_BYTES.into(), + identity_id: identity.id(), revision: 0, + nonce: 1, add_public_keys: vec![IdentityPublicKeyInCreation::V0(new_key)], disable_public_keys: vec![], - public_keys_disabled_at: None, - signature_public_key_id: 1, + user_fee_increase: 0, + signature_public_key_id: key.id(), signature: Default::default(), } .into(); let mut update_transition: StateTransition = update_transition.into(); - let signature = signer::sign( - &update_transition - .signable_bytes() - .expect("expected signable bytes"), - &high_secret_key.secret_bytes(), - ) - .expect("expected to sign"); - - update_transition.set_signature(signature.to_vec().into()); + let data = update_transition + .signable_bytes() + .expect("expected signable bytes"); + update_transition.set_signature( + signer + .sign(&key, data.as_slice()) + .expect("expected to sign"), + ); let update_transition_bytes = update_transition .serialize_to_bytes() .expect("expected to serialize"); + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + let validation_result = platform - .check_tx(update_transition_bytes.as_slice()) + .check_tx( + update_transition_bytes.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to execute identity top up tx"); // Only master keys can sign an update - validation_result.errors.first().expect("expected an error"); + assert_matches!( + validation_result.errors.first(), + Some(ConsensusError::SignatureError( + SignatureError::InvalidSignaturePublicKeySecurityLevelError(_) + )) + ); } #[test] fn identity_update_with_encryption_key_check_tx() { - let mut config = PlatformConfig::default(); - - let mut rng = StdRng::seed_from_u64(1); - - let secp = Secp256k1::new(); - - let master_key_pair = KeyPair::new(&secp, &mut rng); - - let master_secret_key = master_key_pair.secret_key(); - - let master_public_key = master_key_pair.public_key(); - - config.abci.keys.dashpay_master_public_key = master_public_key.serialize().to_vec(); - - let high_key_pair = KeyPair::new(&secp, &mut rng); - - let high_secret_key = high_key_pair.secret_key(); - - let high_public_key = high_key_pair.public_key(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; - config.abci.keys.dashpay_second_public_key = high_public_key.serialize().to_vec(); + let platform_version = PlatformVersion::latest(); let mut platform = TestPlatformBuilder::new() - .with_config(config) - .build_with_mock_rpc(); - - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); + .with_config(platform_config) + .build_with_mock_rpc() + .set_genesis_state(); - let platform_state = platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version().unwrap(); + let (identity, signer, key) = + setup_identity_return_master_key(&mut platform, 958, dash_to_credits!(0.1)); - let genesis_time = 0; + let mut rng = StdRng::seed_from_u64(1); - let system_identity_public_keys_v0: SystemIdentityPublicKeysV0 = - platform.config.abci.keys.clone().into(); + let secp = Secp256k1::new(); - platform - .create_genesis_state( - genesis_time, - system_identity_public_keys_v0.into(), - None, - platform_version, - ) - .expect("expected to create genesis state"); + let platform_state = platform.state.load(); let new_key_pair = KeyPair::new(&secp, &mut rng); - let mut new_key = IdentityPublicKeyInCreationV0 { + let new_key = IdentityPublicKeyInCreationV0 { id: 2, purpose: Purpose::ENCRYPTION, security_level: SecurityLevel::MEDIUM, @@ -1223,61 +2776,55 @@ mod tests { }), }; - let signable_bytes = new_key + let _signable_bytes = new_key .signable_bytes() .expect("expected to get signable bytes"); let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { - identity_id: dashpay_contract::OWNER_ID_BYTES.into(), + identity_id: identity.id(), revision: 1, + nonce: 1, add_public_keys: vec![IdentityPublicKeyInCreation::V0(new_key.clone())], disable_public_keys: vec![], - public_keys_disabled_at: None, - signature_public_key_id: 0, + user_fee_increase: 0, + signature_public_key_id: key.id(), signature: Default::default(), } .into(); let mut update_transition: StateTransition = update_transition.into(); - let signable_bytes = update_transition + let data = update_transition .signable_bytes() .expect("expected signable bytes"); - - let secret = new_key_pair.secret_key(); - let signature = - signer::sign(&signable_bytes, &secret.secret_bytes()).expect("expected to sign"); - - new_key.signature = signature.to_vec().into(); - - let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { - identity_id: dashpay_contract::OWNER_ID_BYTES.into(), - revision: 1, - add_public_keys: vec![IdentityPublicKeyInCreation::V0(new_key)], - disable_public_keys: vec![], - public_keys_disabled_at: None, - signature_public_key_id: 0, - signature: Default::default(), - } - .into(); - - let mut update_transition: StateTransition = update_transition.into(); - - let signature = signer::sign(&signable_bytes, &master_secret_key.secret_bytes()) - .expect("expected to sign"); - - update_transition.set_signature(signature.to_vec().into()); + update_transition.set_signature( + signer + .sign(&key, data.as_slice()) + .expect("expected to sign"), + ); let update_transition_bytes = update_transition .serialize_to_bytes() .expect("expected to serialize"); + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &platform_state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + let validation_result = platform - .check_tx(update_transition_bytes.as_slice()) + .check_tx( + update_transition_bytes.as_slice(), + FirstTimeCheck, + &platform_ref, + platform_version, + ) .expect("expected to execute identity top up tx"); - // we won't have enough funds + // we shouldn't have any errors - validation_result.errors.first().expect("expected an error"); + assert_eq!(validation_result.errors.len(), 0); } } diff --git a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs index 88998b490da..2afab0f58ab 100644 --- a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs @@ -1,9 +1,9 @@ use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::platform_types::block_execution_outcome; use crate::platform_types::cleaned_abci_messages::finalized_block_cleaned_request::v0::FinalizeBlockCleanedRequest; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; @@ -18,7 +18,7 @@ where /// /// This function first retrieves the block execution context and decomposes the request. It then checks /// if the received block matches the expected block information (height, round, hash, etc.). If everything - /// matches, the function verifies the commit signature (if enabled) and the vote extensions. If all checks + /// matches, the function verifies the commit signature (if enabled) and the votes extensions. If all checks /// pass, the block is committed to the state. /// /// # Arguments @@ -34,12 +34,10 @@ where pub(crate) fn finalize_block_proposal( &self, request_finalize_block: FinalizeBlockCleanedRequest, + block_execution_context: BlockExecutionContext, transaction: &Transaction, + platform_version: &PlatformVersion, ) -> Result { - let state = self.state.read().expect("expected to get state"); - let current_protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = PlatformVersion::get(current_protocol_version)?; match platform_version .drive_abci .methods @@ -48,6 +46,7 @@ where { 0 => self.finalize_block_proposal_v0( request_finalize_block, + block_execution_context, transaction, platform_version, ), diff --git a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs index 0063cd57363..c56272b61d5 100644 --- a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs @@ -1,5 +1,3 @@ -use dashcore_rpc::dashcore::hashes::Hash; - use dpp::block::epoch::Epoch; use dpp::validation::SimpleValidationResult; @@ -10,16 +8,21 @@ use dpp::block::block_info::BlockInfo; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0; use dpp::version::PlatformVersion; +use dpp::dashcore::bls_sig_utils::BLSSignature; + use tenderdash_abci::{ proto::{serializers::timestamp::ToMilis, types::BlockId as ProtoBlockId}, - signatures::SignBytes, + signatures::Hashable, }; use crate::abci::AbciError; -use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::v0::{ + BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, + BlockExecutionContextV0OwnedGetters, +}; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_state_info::v0::{ BlockStateInfoV0Getters, BlockStateInfoV0Methods, }; @@ -43,7 +46,7 @@ where /// /// This function first retrieves the block execution context and decomposes the request. It then checks /// if the received block matches the expected block information (height, round, hash, etc.). If everything - /// matches, the function verifies the commit signature (if enabled) and the vote extensions. If all checks + /// matches, the function verifies the commit signature (if enabled) and the votes extensions. If all checks /// pass, the block is committed to the state. /// /// # Arguments @@ -59,31 +62,19 @@ where pub(super) fn finalize_block_proposal_v0( &self, request_finalize_block: FinalizeBlockCleanedRequest, + mut block_execution_context: BlockExecutionContext, transaction: &Transaction, - _platform_version: &PlatformVersion, + platform_version: &PlatformVersion, ) -> Result { let mut validation_result = SimpleValidationResult::::new_with_errors(vec![]); - // Retrieve block execution context before we do anything at all - let guarded_block_execution_context = self.block_execution_context.read().unwrap(); - let block_execution_context = - guarded_block_execution_context - .as_ref() - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "block execution context must be set in block begin handler for finalize block proposal", - )))?; - let block_state_info = block_execution_context.block_state_info(); let epoch_info = block_execution_context.epoch_info(); let block_platform_state = block_execution_context.block_platform_state(); - let current_protocol_version = block_platform_state.current_protocol_version_in_consensus(); - - let platform_version = PlatformVersion::get(current_protocol_version)?; - // Let's decompose the request let FinalizeBlockCleanedRequest { - commit: commit_info, + commit: mut commit_info, misbehavior: _, hash, height, @@ -101,13 +92,13 @@ where } = block; let block_id_hash = Into::::into(block_id.clone()) - .sha256(&self.config.abci.chain_id, height as i64, round as i32) + .calculate_msg_hash(&self.config.abci.chain_id, height as i64, round as i32) .map_err(AbciError::from)? .try_into() .expect("invalid sha256 length"); //// Verification that commit is for our current executed block - // When receiving the finalized block, we need to make sure that info matches our current block + // When receiving the finalized block, we need to make sure info matches our current block // First let's check the basics, height, round and hash if !block_state_info.matches_expected_block_info( @@ -126,14 +117,17 @@ where block_header.core_chain_locked_height, block_state_info.height(), block_state_info.round(), - block_state_info.block_hash().map(|a| hex::encode(a)).unwrap_or("None".to_string()), + block_state_info.block_hash().map(hex::encode).unwrap_or("None".to_string()), block_state_info.core_chain_locked_height() ))); return Ok(validation_result.into()); } - let state_cache = self.state.read().unwrap(); - let current_quorum_hash = state_cache.current_validator_set_quorum_hash().into(); + let last_committed_state = self.state.load(); + let current_quorum_hash = last_committed_state + .current_validator_set_quorum_hash() + .into(); + if current_quorum_hash != commit_info.quorum_hash { validation_result.add_error(AbciError::WrongFinalizeBlockReceived(format!( "received a block for h: {} r: {} with validator set quorum hash {} expected current validator set quorum hash is {}", @@ -142,17 +136,42 @@ where return Ok(validation_result.into()); } - let quorum_public_key = &state_cache.current_validator_set()?.threshold_public_key(); + // Verify votes extensions + // We don't need to verify votes extension signatures once again after tenderdash + // here, because we will do it bellow broadcasting withdrawal transactions. + // The sendrawtransaction RPC method returns an error if quorum signature is invalid + let expected_withdrawal_transactions = + block_execution_context.unsigned_withdrawal_transactions(); + + if !expected_withdrawal_transactions + .are_matching_with_vote_extensions(&commit_info.threshold_vote_extensions) + { + validation_result.add_error(AbciError::VoteExtensionMismatchReceived { + got: commit_info.threshold_vote_extensions, + expected: expected_withdrawal_transactions.into(), + }); + + return Ok(validation_result.into()); + } + + // Verify commit // In production this will always be true - if self + #[cfg(not(feature = "testing-config"))] + let verify_commit_signature = true; + + #[cfg(feature = "testing-config")] + let verify_commit_signature = self .config .testing_configs - .block_commit_signature_verification - { - // Verify commit - - let quorum_type = self.config.quorum_type(); + .block_commit_signature_verification; + + if verify_commit_signature { + let quorum_public_key = last_committed_state + .current_validator_set()? + .threshold_public_key(); + let quorum_type = self.config.validator_set.quorum_type; + // TODO: We already had commit in the function above, why do we need to create it again with clone? let commit = Commit::new_from_cleaned( commit_info.clone(), block_id, @@ -168,24 +187,6 @@ where return Ok(validation_result.into()); } } - drop(state_cache); - - // Verify vote extensions - // let received_withdrawals = WithdrawalTxs::from(&commit.threshold_vote_extensions); - // let our_withdrawals = WithdrawalTxs::load(Some(transaction), &self.drive) - // .map_err(|e| AbciError::WithdrawalTransactionsDBLoadError(e.to_string()))?; - //todo: reenable check - // - // if let Err(e) = self.check_withdrawals( - // &received_withdrawals, - // &our_withdrawals, - // Some(quorum_public_key), - // ) { - // validation_result.add_error(e); - // return Ok(validation_result.into()); - // } - - // Next let's check that the hash received is the same as the hash we expect if height == self.config.abci.genesis_height { self.drive @@ -197,31 +198,65 @@ where .expect("current epoch info should be in range"), ); - // we need to add the block time to_commit_block_info.time_ms = block_header.time.to_milis(); to_commit_block_info.core_height = block_header.core_chain_locked_height; - // // Finalize withdrawal processing - // our_withdrawals.finalize(Some(transaction), &self.drive, &to_commit_block_info)?; - - // At the end we update the state cache + // Append signatures and broadcast asset unlock transactions to Core + + // Drain withdrawal transaction instead of cloning + let unsigned_withdrawal_transactions = block_execution_context + .unsigned_withdrawal_transactions_mut() + .drain(); + + if !unsigned_withdrawal_transactions.is_empty() { + // Drain signatures instead of cloning + let signatures = commit_info + .threshold_vote_extensions + .drain(..) + .map(|vote_extension| { + let signature_bytes: [u8; 96] = + vote_extension.signature.try_into().map_err(|e| { + AbciError::BadRequestDataSize(format!( + "invalid votes extension signature size: {}", + hex::encode(e) + )) + })?; + + Ok(BLSSignature::from(signature_bytes)) + }) + .collect::>()?; + + self.append_signatures_and_broadcast_withdrawal_transactions( + unsigned_withdrawal_transactions, + signatures, + platform_version, + )?; + } - drop(guarded_block_execution_context); + // Update platform (drive abci) state let extended_block_info = ExtendedBlockInfoV0 { basic_info: to_commit_block_info, app_hash: block_header.app_hash, quorum_hash: current_quorum_hash, block_id_hash, + proposer_pro_tx_hash: block_header.proposer_pro_tx_hash, signature: commit_info.block_signature, round, } .into(); - self.update_state_cache(extended_block_info, transaction, platform_version)?; + self.update_drive_cache(&block_execution_context, platform_version)?; + + let block_platform_state = block_execution_context.block_platform_state_owned(); - self.update_drive_cache(platform_version)?; + self.update_state_cache( + extended_block_info, + block_platform_state, + transaction, + platform_version, + )?; // Gather some metrics crate::metrics::abci_last_block_time(block_header.time.seconds as u64); diff --git a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs index fe2df6ea990..57ec814c047 100644 --- a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs @@ -6,7 +6,6 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use crate::error::execution::ExecutionError; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; use tenderdash_abci::proto::abci::{RequestInitChain, ResponseInitChain}; @@ -21,10 +20,11 @@ where request: RequestInitChain, transaction: &Transaction, ) -> Result { - let state = self.state.read().expect("expected to get state"); - let current_protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = PlatformVersion::get(current_protocol_version)?; + // We don't have platform state at this point, so we should + // use initial protocol version from genesis + let protocol_version = self.config.initial_protocol_version; + let platform_version = PlatformVersion::get(protocol_version)?; + match platform_version.drive_abci.methods.engine.init_chain { 0 => self.init_chain_v0(request, transaction, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { diff --git a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs index 7a585aa5622..398d4c111f9 100644 --- a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs @@ -9,9 +9,12 @@ use drive::grovedb::Transaction; use crate::platform_types::cleaned_abci_messages::request_init_chain_cleaned_params; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::system_identity_public_keys::v0::SystemIdentityPublicKeysV0; +use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; +use std::sync::Arc; use tenderdash_abci::proto::abci::{RequestInitChain, ResponseInitChain, ValidatorSetUpdate}; +use tenderdash_abci::proto::google::protobuf::Timestamp; +use tenderdash_abci::proto::serializers::timestamp::FromMilis; impl Platform where @@ -28,23 +31,46 @@ where request_init_chain_cleaned_params::v0::RequestInitChainCleanedParams::try_from( request, )?; - // We get core height early, as this also verifies v20 fork - let core_height = - self.initial_core_height(request.initial_core_height, platform_version)?; - let genesis_time = request.genesis_time; - - let system_identity_public_keys_v0: SystemIdentityPublicKeysV0 = - self.config.abci.keys.clone().into(); + // Wait until we have an initial core height to start the chain + let (core_height, genesis_time) = loop { + match self.initial_core_height_and_time(request.initial_core_height, platform_version) { + Ok(height) => break height, + Err(e) => match e { + Error::Execution(ExecutionError::InitializationForkNotActive(_)) + | Error::Execution(ExecutionError::InitializationHeightIsNotLocked { + .. + }) + | Error::Execution(ExecutionError::InitializationGenesisTimeInFuture { + .. + }) => { + tracing::warn!( + error = ?e, + "Failed to obtain deterministic initial core height to start the chain. Retrying in 30 seconds.", + ); + + // We need to wait for the fork to be active + std::thread::sleep(std::time::Duration::from_secs(30)); + } + e => return Err(e), + }, + } + }; + // Create genesis drive state self.create_genesis_state( + core_height, genesis_time, - system_identity_public_keys_v0.into(), Some(transaction), platform_version, )?; - let mut state_guard = self.state.write().unwrap(); + // Create platform execution state + let mut initial_platform_state = PlatformState::default_with_protocol_versions( + request.initial_protocol_version, + request.initial_protocol_version, + &self.config, + )?; let genesis_block_info = BlockInfo { height: request.initial_height, @@ -53,9 +79,20 @@ where ..Default::default() }; + // !!! Very important to understand !!! + // We update the core info at the initial core height. This means that we use the quorums + // at the initial core height for block 1. + // The initial core height is either the height of the fork at which platform activates + // or it is the request.initial_core_height. + // Block 1 is signed with the quorum chosen based on this info/height. + // It is also worth saying that the quorum chosen will be the most recently built quorum. + // On block 1 the proposer will most likely propose a new core chain locked height. + // That will cause the core info to update again, so very often block 2 will be signed by + // a different quorum. + self.update_core_info( None, - &mut state_guard, + &mut initial_platform_state, core_height, true, &genesis_block_info, @@ -63,42 +100,47 @@ where platform_version, )?; - let (quorum_hash, validator_set) = - { - let validator_set_inner = state_guard.validator_sets().first().ok_or( - ExecutionError::InitializationError("we should have at least one quorum"), - )?; + let (quorum_hash, validator_set) = { + let validator_set_inner = initial_platform_state.validator_sets().first().ok_or( + ExecutionError::InitializationError("we should have at least one quorum"), + )?; + + ( + *validator_set_inner.0, + ValidatorSetUpdate::from(validator_set_inner.1), + ) + }; - ( - *validator_set_inner.0, - ValidatorSetUpdate::from(validator_set_inner.1), - ) - }; + initial_platform_state.set_current_validator_set_quorum_hash(quorum_hash); - state_guard.set_current_validator_set_quorum_hash(quorum_hash); + initial_platform_state.set_genesis_block_info(Some(genesis_block_info)); - state_guard.set_genesis_block_info(Some(genesis_block_info)); + initial_platform_state + .set_current_protocol_version_in_consensus(request.initial_protocol_version); if tracing::enabled!(tracing::Level::TRACE) { tracing::trace!( - platform_state_fingerprint = hex::encode(state_guard.fingerprint()), + platform_state_fingerprint = hex::encode(initial_platform_state.fingerprint()?), "platform runtime state", ); } + self.state.store(Arc::new(initial_platform_state)); + let app_hash = self .drive .grove - .root_hash(Some(transaction)) + .root_hash(Some(transaction), &platform_version.drive.grove_version) .unwrap() .map_err(GroveDB)?; Ok(ResponseInitChain { - consensus_params: None, //todo + consensus_params: None, app_hash: app_hash.to_vec(), validator_set_update: Some(validator_set), next_core_chain_lock_update: None, initial_core_height: core_height, // we send back the core height when the fork happens + genesis_time: Some(Timestamp::from_milis(genesis_time)), }) } } diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs index 01b951d49e1..a8420b34b04 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs @@ -1,7 +1,10 @@ use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::metrics::HistogramTiming; +use crate::platform_types::epoch_info::v0::EpochInfoV0Methods; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use crate::platform_types::{block_execution_outcome, block_proposal}; use crate::rpc::core::CoreRPCLike; use dpp::validation::ValidationResult; @@ -23,6 +26,7 @@ where /// # Arguments /// /// * `block_proposal` - The block proposal to be processed. + /// * `known_from_us` - Do we know that we made this block proposal? /// * `transaction` - The transaction associated with the block proposal. /// /// # Returns @@ -40,16 +44,78 @@ where pub fn run_block_proposal( &self, block_proposal: block_proposal::v0::BlockProposal, + known_from_us: bool, + platform_state: &PlatformState, transaction: &Transaction, + timer: Option<&HistogramTiming>, ) -> Result, Error> { - let state = self.state.read().expect("expected to get state"); - let current_protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = PlatformVersion::get(current_protocol_version)?; - let epoch_info = self.gather_epoch_info(&block_proposal, transaction, platform_version)?; + // Epoch information is always calculated with the last committed platform version + // even if we are switching to a new version in this block. + let last_committed_platform_version = platform_state.current_platform_version()?; - match platform_version + // !!!! This EpochInfo is based on the last committed platform version + // !!!! and will be used for the first block of the epoch. + let epoch_info = self.gather_epoch_info( + &block_proposal, + transaction, + platform_state, + last_committed_platform_version, + )?; + + // Create a bock state from previous committed state + let mut block_platform_state = platform_state.clone(); + + // Determine a platform version for this block + let block_platform_version = if epoch_info.is_epoch_change_but_not_genesis() + && platform_state.next_epoch_protocol_version() + != platform_state.current_protocol_version_in_consensus() + { + // Switch to next proposed platform version if we are on the first block of the new epoch + // and the next protocol version (locked in the previous epoch) is different from the + // current protocol version. + // This version will be set to the block state, and we decide on next version for next epoch + // during block processing + let next_protocol_version = platform_state.next_epoch_protocol_version(); + + // We should panic if this node is not supported a new protocol version + let Ok(next_platform_version) = PlatformVersion::get(next_protocol_version) else { + panic!( + r#"Failed to upgrade the network protocol version {next_protocol_version}. + +Please update your software to the latest version: https://docs.dash.org/platform-protocol-upgrade + +Your software version: {}, latest supported protocol version: {}."#, + env!("CARGO_PKG_VERSION"), + PlatformVersion::latest().protocol_version + ); + }; + + // Set current protocol version to the block platform state + block_platform_state.set_current_protocol_version_in_consensus(next_protocol_version); + + next_platform_version + } else { + // Stay on the last committed platform version + last_committed_platform_version + }; + + // Patch platform version and run migrations if we have patches and/or + // migrations defined for this height. + // It modifies the protocol version to function version mapping to apply hotfixes + // Also it performs migrations to fix corrupted state or prepare it for new features + let block_platform_version = if let Some(patched_platform_version) = self + .apply_platform_version_patch_and_migrate_state_for_height( + block_proposal.height, + &mut block_platform_state, + transaction, + )? { + patched_platform_version + } else { + block_platform_version + }; + + match block_platform_version .drive_abci .methods .engine @@ -57,9 +123,13 @@ where { 0 => self.run_block_proposal_v0( block_proposal, - epoch_info.into(), + known_from_us, + epoch_info, transaction, - platform_version, + platform_state, + block_platform_state, + block_platform_version, + timer, ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "run_block_proposal".to_string(), diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 25156a27993..19cc38acef2 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -1,6 +1,3 @@ -use dashcore_rpc::dashcore::hashes::Hash; -use dashcore_rpc::dashcore::Txid; - use dpp::block::epoch::Epoch; use dpp::validation::ValidationResult; @@ -8,7 +5,6 @@ use drive::error::Error::GroveDB; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; -use std::collections::BTreeMap; use crate::abci::AbciError; use crate::error::execution::ExecutionError; @@ -16,7 +12,6 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::block_execution_context::v0::{ BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, - BlockExecutionContextV0Setters, }; use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_fees::v0::BlockFeesV0; @@ -24,13 +19,15 @@ use crate::execution::types::block_state_info::v0::{ BlockStateInfoV0Getters, BlockStateInfoV0Methods, BlockStateInfoV0Setters, }; use crate::execution::types::{block_execution_context, block_state_info}; - +use crate::metrics::HistogramTiming; use crate::platform_types::block_execution_outcome; use crate::platform_types::block_proposal; use crate::platform_types::epoch_info::v0::{EpochInfoV0Getters, EpochInfoV0Methods}; use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::verify_chain_lock_result::v0::VerifyChainLockResult; use crate::rpc::core::CoreRPCLike; impl Platform @@ -46,6 +43,7 @@ where /// # Arguments /// /// * `block_proposal` - The block proposal to be processed. + /// * `known_from_us` - Do we know that we made this block proposal?. /// * `transaction` - The transaction associated with the block proposal. /// /// # Returns @@ -63,14 +61,15 @@ where pub(super) fn run_block_proposal_v0( &self, block_proposal: block_proposal::v0::BlockProposal, + known_from_us: bool, epoch_info: EpochInfo, transaction: &Transaction, - platform_version: &PlatformVersion, + last_committed_platform_state: &PlatformState, + mut block_platform_state: PlatformState, + platform_version: &'static PlatformVersion, + timer: Option<&HistogramTiming>, ) -> Result, Error> { - // Start by getting information from the state - let state = self.state.read().unwrap(); - tracing::trace!( method = "run_block_proposal_v0", ?block_proposal, @@ -80,14 +79,30 @@ where block_proposal.round, ); - let last_block_time_ms = state.last_block_time_ms(); - let last_block_height = - state.known_height_or(self.config.abci.genesis_height.saturating_sub(1)); - let last_block_core_height = - state.known_core_height_or(self.config.abci.genesis_core_height); - let hpmn_list_len = state.hpmn_list_len(); + // Run block proposal determines version by itself based on the previous + // state and block time. + // It should provide correct version on prepare proposal to block header + // and validate it on process proposal. + // If version set to 0 (default number value) it means we are on prepare proposal, + // so there is no need for validation. + if !known_from_us + && block_proposal.consensus_versions.app != platform_version.protocol_version as u64 + { + return Ok(ValidationResult::new_with_error( + AbciError::BadRequest(format!( + "received a block proposal with protocol version {}, expected: {}", + block_proposal.consensus_versions.app, platform_version.protocol_version + )) + .into(), + )); + } - let mut block_platform_state = state.clone(); + let last_block_time_ms = last_committed_platform_state.last_committed_block_time_ms(); + let last_block_height = last_committed_platform_state.last_committed_known_block_height_or( + self.config.abci.genesis_height.saturating_sub(1), + ); + let last_block_core_height = last_committed_platform_state + .last_committed_known_core_height_or(self.config.abci.genesis_core_height); // Init block execution context let block_state_info = block_state_info::v0::BlockStateInfoV0::from_block_proposal( @@ -110,6 +125,7 @@ where // destructure the block proposal let block_proposal::v0::BlockProposal { core_chain_locked_height, + core_chain_lock_update, proposed_app_version, proposer_pro_tx_hash, validator_set_quorum_hash, @@ -122,9 +138,116 @@ where .expect("current epoch index should be in range"), ); + if epoch_info.is_epoch_change_but_not_genesis() { + tracing::info!( + epoch_index = epoch_info.current_epoch_index(), + "epoch change occurring from epoch {} to epoch {}", + epoch_info + .previous_epoch_index() + .expect("must be set since we aren't on genesis"), + epoch_info.current_epoch_index(), + ); + } + + // Update block platform state with current and next epoch protocol versions + // if it was proposed + // This is happening only on epoch change + self.upgrade_protocol_version_on_epoch_change( + &block_info, + &epoch_info, + last_committed_platform_state, + &mut block_platform_state, + transaction, + platform_version, + )?; + + // If there is a core chain lock update, we should start by verifying it + if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { + if !known_from_us { + let verification_result = self.verify_chain_lock( + block_state_info.round, // the round is to allow us to bypass local verification in case of chain stall + &block_platform_state, + core_chain_lock_update, + true, // if it's not known from us, then we should try submitting it + platform_version, + ); + + let VerifyChainLockResult { + chain_lock_signature_is_deserializable, + found_valid_locally, + found_valid_by_core, + core_is_synced, + } = match verification_result { + Ok(verification_result) => verification_result, + Err(Error::Execution(e)) => { + // This will happen only if an internal version error + return Err(Error::Execution(e)); + } + Err(e) => { + // This will happen only if a core rpc error + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(e.to_string()).into(), + )); + } + }; + + if !chain_lock_signature_is_deserializable { + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that has a signature that can not be deserialized {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + + if let Some(found_valid_locally) = found_valid_locally { + // This means we are able to check if the chain lock is valid + if !found_valid_locally { + // The signature was not valid + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that we figured out was invalid based on platform state {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + + if let Some(found_valid_by_core) = found_valid_by_core { + // This means we asked core if the chain lock was valid + if !found_valid_by_core { + // Core said it wasn't valid + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that is invalid based on a core request {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + + if let Some(core_is_synced) = core_is_synced { + // Core is just not synced + if !core_is_synced { + // The submission was not accepted by core + return Ok(ValidationResult::new_with_error( + AbciError::ChainLockedBlockNotKnownByCore(format!( + "received a chain lock for height {} that we could not accept because core is not synced {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + } + } + // Update the masternode list and create masternode identities and also update the active quorums self.update_core_info( - Some(&state), + Some(last_committed_platform_state), &mut block_platform_state, core_chain_locked_height, false, @@ -132,9 +255,9 @@ where transaction, platform_version, )?; - drop(state); // Update the validator proposed app version + // It should be called after protocol version upgrade self.drive .update_validator_proposed_app_version( proposer_pro_tx_hash, @@ -146,154 +269,83 @@ where Error::Execution(ExecutionError::UpdateValidatorProposedAppVersionError(e)) })?; // This is a system error - let mut block_execution_context = block_execution_context::v0::BlockExecutionContextV0 { - block_state_info: block_state_info.into(), - epoch_info: epoch_info.clone(), - hpmn_count: hpmn_list_len as u32, - withdrawal_transactions: BTreeMap::new(), - block_platform_state, - proposer_results: None, - }; - - // Determine a new protocol version if enough proposers voted - if block_execution_context - .epoch_info - .is_epoch_change_but_not_genesis() - { - tracing::info!( - epoch_index = block_execution_context.epoch_info.current_epoch_index(), - "epoch change occurring from epoch {} to epoch {}", - block_execution_context - .epoch_info - .previous_epoch_index() - .expect("must be set since we aren't on genesis"), - block_execution_context.epoch_info.current_epoch_index(), - ); - - if block_execution_context - .block_platform_state - .current_protocol_version_in_consensus() - == block_execution_context - .block_platform_state - .next_epoch_protocol_version() - { - tracing::trace!( - epoch_index = block_execution_context.epoch_info.current_epoch_index(), - "protocol version remains the same {}", - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - ); - } else { - tracing::info!( - epoch_index = block_execution_context.epoch_info.current_epoch_index(), - "protocol version changed from {} to {}", - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - block_execution_context - .block_platform_state - .next_epoch_protocol_version(), - ); - } - - // Set current protocol version to the version from upcoming epoch - block_execution_context - .block_platform_state - .set_current_protocol_version_in_consensus( - block_execution_context - .block_platform_state - .next_epoch_protocol_version(), - ); - - // Determine new protocol version based on votes for the next epoch - let maybe_new_protocol_version = self.check_for_desired_protocol_upgrade( - block_execution_context.hpmn_count, - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - transaction, - )?; - - if let Some(new_protocol_version) = maybe_new_protocol_version { - block_execution_context - .block_platform_state - .set_next_epoch_protocol_version(new_protocol_version); - } else { - block_execution_context - .block_platform_state - .set_next_epoch_protocol_version( - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - ); - } - } - - let mut block_execution_context: BlockExecutionContext = block_execution_context.into(); - - // >>>>>> Withdrawal Status Update <<<<<<< - // Only update the broadcasted withdrawal statuses if the core chain lock height has - // changed. If it hasn't changed there should be no way a status could update - - if block_execution_context - .block_state_info() - .core_chain_locked_height() - != last_block_core_height - { - self.update_broadcasted_withdrawal_transaction_statuses( - &block_execution_context, + // Mark all previously broadcasted and chainlocked withdrawals as complete + // only when we are on a new core height + if block_state_info.core_chain_locked_height() != last_block_core_height { + self.update_broadcasted_withdrawal_statuses( + &block_info, transaction, platform_version, )?; } - // This takes withdrawals from the transaction queue + // Preparing withdrawal transactions for signing and broadcasting + // To process withdrawals we need to dequeue untiled transactions from the withdrawal transactions queue + // Untiled transactions then converted to unsigned transactions, appending current block information + // required for signature verification (core height and quorum hash) + // Then we save unsigned transaction bytes to block execution context + // to be signed (on extend_vote), verified (on verify_vote) and broadcasted (on finalize_block) let unsigned_withdrawal_transaction_bytes = self - .fetch_and_prepare_unsigned_withdrawal_transactions( + .dequeue_and_build_unsigned_withdrawal_transactions( validator_set_quorum_hash, - &block_execution_context, - transaction, + &block_info, + Some(transaction), platform_version, )?; - // Set the withdrawal transactions that were done in the previous block - block_execution_context.set_withdrawal_transactions( - unsigned_withdrawal_transaction_bytes - .into_iter() - .map(|withdrawal_transaction| { - ( - Txid::hash(withdrawal_transaction.as_slice()), - withdrawal_transaction, - ) - }) - .collect(), - ); + // Run all dao platform events, such as vote tallying and distribution of contested documents + // This must be done before state transition processing + // Otherwise we would expect a proof after a successful vote that has since been cleaned up. + self.run_dao_platform_events( + &block_info, + last_committed_platform_state, + &block_platform_state, + Some(transaction), + platform_version, + )?; - let (block_fees, state_transition_results) = self.process_raw_state_transitions( + // Process transactions + let state_transitions_result = self.process_raw_state_transitions( raw_state_transitions, - block_execution_context.block_platform_state(), + &block_platform_state, &block_info, transaction, platform_version, + known_from_us, + timer, )?; - let mut block_execution_context: BlockExecutionContext = block_execution_context; + // Pool withdrawals into transactions queue + // Takes queued withdrawals, creates untiled withdrawal transaction payload, saves them to queue + // Corresponding withdrawal documents are changed from queued to pooled self.pool_withdrawals_into_transactions_queue( - &block_execution_context, - transaction, + &block_info, + Some(transaction), platform_version, )?; - // while we have the state transitions executed, we now need to process the block fees + // Create a new block execution context + + let mut block_execution_context: BlockExecutionContext = + block_execution_context::v0::BlockExecutionContextV0 { + block_state_info: block_state_info.into(), + epoch_info: epoch_info.clone(), + // TODO: It doesn't seem correct to use previous block count of hpmns. + // We currently not using this field in the codebase. We probably should just remove it. + hpmn_count: last_committed_platform_state.hpmn_list_len() as u32, + unsigned_withdrawal_transactions: unsigned_withdrawal_transaction_bytes, + block_platform_state, + proposer_results: None, + } + .into(); - let block_fees_v0: BlockFeesV0 = block_fees.into(); + // while we have the state transitions executed, we now need to process the block fees + let block_fees_v0: BlockFeesV0 = state_transitions_result.aggregated_fees().clone().into(); // Process fees let processed_block_fees = self.process_block_fees( - block_execution_context.block_state_info(), - &epoch_info, + &block_execution_context, block_fees_v0.into(), transaction, platform_version, @@ -304,7 +356,7 @@ where let root_hash = self .drive .grove - .root_hash(Some(transaction)) + .root_hash(Some(transaction), &platform_version.drive.grove_version) .unwrap() .map_err(|e| Error::Drive(GroveDB(e)))?; //GroveDb errors are system errors @@ -312,31 +364,33 @@ where .block_state_info_mut() .set_app_hash(Some(root_hash)); - let state = self.state.read().unwrap(); - let validator_set_update = - self.validator_set_update(&state, &mut block_execution_context, platform_version)?; + let validator_set_update = self.validator_set_update( + block_proposal.proposer_pro_tx_hash, + last_committed_platform_state, + &mut block_execution_context, + platform_version, + )?; if tracing::enabled!(tracing::Level::TRACE) { tracing::trace!( method = "run_block_proposal_v0", app_hash = hex::encode(root_hash), - platform_state_fingerprint = - hex::encode(block_execution_context.block_platform_state().fingerprint()), + platform_state_fingerprint = hex::encode( + block_execution_context + .block_platform_state() + .fingerprint()? + ), "Block proposal executed successfully", ); } - self.block_execution_context - .write() - .unwrap() - .replace(block_execution_context); - Ok(ValidationResult::new_with_data( block_execution_outcome::v0::BlockExecutionOutcome { app_hash: root_hash, - state_transition_results, + state_transitions_result, validator_set_update, - protocol_version: platform_version.protocol_version, + platform_version, + block_execution_context, }, )) } diff --git a/packages/rs-drive-abci/src/execution/mod.rs b/packages/rs-drive-abci/src/execution/mod.rs index 4352caa5718..0e4b73c3f00 100644 --- a/packages/rs-drive-abci/src/execution/mod.rs +++ b/packages/rs-drive-abci/src/execution/mod.rs @@ -4,6 +4,8 @@ mod check_tx; pub mod engine; /// platform execution events pub(in crate::execution) mod platform_events; +/// Storage implementation for the execution state +pub mod storage; /// Types needed in execution pub mod types; /// Validation module diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs index ee3ad883d94..f881cea1dd8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs @@ -1,5 +1,3 @@ -/// Storage of the ephemeral state -pub(in crate::execution) mod store_ephemeral_state; /// Updating the state cache happens as the final part of block finalization pub(in crate::execution) mod update_state_cache; /// Validator set update diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/mod.rs deleted file mode 100644 index bef276301da..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -mod v0; - -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::PlatformState; -use crate::rpc::core::CoreRPCLike; - -use dpp::version::PlatformVersion; - -use drive::grovedb::Transaction; - -impl Platform -where - C: CoreRPCLike, -{ - /// Stores ephemeral state data, including the block information and quorum hash in GroveDB. - /// - /// This function is a version handler that directs to specific version implementations - /// of the store_ephemeral_state function. - /// - /// # Arguments - /// - /// * `platform_state` - A `PlatformState` reference. - /// * `transaction` - A `Transaction` reference. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns an empty `Result` if the data is successfully stored, otherwise returns an `Error`. - /// - pub fn store_ephemeral_state( - &self, - platform_state: &PlatformState, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - match platform_version - .drive_abci - .methods - .block_end - .store_ephemeral_state - { - 0 => self.store_ephemeral_state_v0(platform_state, transaction), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "store_ephemeral_state".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/v0/mod.rs deleted file mode 100644 index 016b67d2072..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/v0/mod.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; - -use crate::platform_types::platform_state::PlatformState; -use dpp::serialization::PlatformSerializable; - -use drive::error::Error::GroveDB; -use drive::grovedb::Transaction; - -impl Platform -where - C: CoreRPCLike, -{ - /// Stores ephemeral state data, including the block information and quorum hash in GroveDB. - /// - /// This function should be removed from the current location. - /// - /// # Arguments - /// - /// * `platform_state` - A `PlatformState` reference. - /// * `transaction` - A `Transaction` reference. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns an empty `Result` if the data is successfully stored, otherwise returns an `Error`. - /// - pub(super) fn store_ephemeral_state_v0( - &self, - platform_state: &PlatformState, - transaction: &Transaction, - ) -> Result<(), Error> { - // we need to serialize the platform state - let serialized_platform_state = platform_state.serialize_to_bytes()?; - - // next we need to store this data in grovedb - //todo:: maybe this should be in actual state - self.drive - .grove - .put_aux( - b"saved_state", - &serialized_platform_state, - None, - Some(transaction), - ) - .unwrap() - .map_err(|e| Error::Drive(GroveDB(e)))?; - - Ok(()) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs index a3bb44c9779..0342fe45594 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs @@ -6,9 +6,9 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::block::extended_block_info::ExtendedBlockInfo; + +use crate::execution::types::block_execution_context::BlockExecutionContext; use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; impl Platform where @@ -30,7 +30,11 @@ where /// * `Result<(), Error>` - If the state cache and quorums are successfully updated, it returns `Ok(())`. /// If there is a problem with the update, it returns an `Error`. /// - pub fn update_drive_cache(&self, platform_version: &PlatformVersion) -> Result<(), Error> { + pub fn update_drive_cache( + &self, + block_execution_context: &BlockExecutionContext, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { match platform_version .drive_abci .methods @@ -38,7 +42,7 @@ where .update_drive_cache { 0 => { - self.update_drive_cache_v0(); + self.update_drive_cache_v0(block_execution_context); Ok(()) } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs index bed5932843e..35852a05d92 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs @@ -1,3 +1,6 @@ +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::platform_types::epoch_info::v0::EpochInfoV0Methods; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; @@ -8,14 +11,27 @@ where /// Updates the drive cache at the end of finalize block. This does a few things like merging /// the data contract cache and the platform versions cache. /// - pub(super) fn update_drive_cache_v0(&self) { - let mut drive_cache = self.drive.cache.write().unwrap(); - + #[inline(always)] + pub(super) fn update_drive_cache_v0(&self, block_execution_context: &BlockExecutionContext) { // Update global cache with updated contracts - drive_cache.cached_contracts.merge_block_cache(); - // This is unnecessary since we clear block cache before every proposal execution - drive_cache.cached_contracts.clear_block_cache(); + self.drive + .cache + .data_contracts + .merge_and_clear_block_cache(); + + let mut protocol_versions_counter = self.drive.cache.protocol_versions_counter.write(); + + // Clear previously proposed versions since we started a new epoch + // For more information read comments in `upgrade_protocol_version_v0` function + if block_execution_context + .epoch_info() + .is_epoch_change_but_not_genesis() + { + protocol_versions_counter.clear_global_cache(); + protocol_versions_counter.unblock_global_cache(); + } - drive_cache.protocol_versions_counter.merge_block_cache() + // Update proposed versions with new proposal from the current block + protocol_versions_counter.merge_block_cache() } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs index a055056edc9..2027e434de1 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs @@ -5,6 +5,7 @@ use crate::error::Error; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::block::extended_block_info::ExtendedBlockInfo; use dpp::version::PlatformVersion; @@ -35,6 +36,7 @@ where pub fn update_state_cache( &self, extended_block_info: ExtendedBlockInfo, + block_platform_state: PlatformState, transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { @@ -44,7 +46,12 @@ where .block_end .update_state_cache { - 0 => self.update_state_cache_v0(extended_block_info, transaction, platform_version), + 0 => self.update_state_cache_v0( + extended_block_info, + block_platform_state, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "update_state_cache".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs index 5803180c654..e9c15fe0e0a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs @@ -1,12 +1,12 @@ -use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0OwnedGetters; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::block::extended_block_info::ExtendedBlockInfo; -use dpp::version::{PlatformVersion, PlatformVersionCurrentVersion}; +use dpp::version::PlatformVersion; use drive::grovedb::Transaction; +use std::sync::Arc; impl Platform where @@ -34,37 +34,32 @@ where /// This function may return an `Error` variant if there is a problem with updating the state cache /// and quorums or storing the ephemeral data. /// + #[inline(always)] pub(super) fn update_state_cache_v0( &self, extended_block_info: ExtendedBlockInfo, + mut block_platform_state: PlatformState, transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { - let mut block_execution_context = self.block_execution_context.write().unwrap(); - - let block_execution_context = block_execution_context.take().ok_or(Error::Execution( - ExecutionError::CorruptedCodeExecution("there should be a block execution context"), - ))?; - - let mut state_cache = self.state.write().unwrap(); - - *state_cache = block_execution_context.block_platform_state_owned(); + // Update block state and store it in shared lock if let Some(next_validator_set_quorum_hash) = - state_cache.take_next_validator_set_quorum_hash() + block_platform_state.take_next_validator_set_quorum_hash() { - state_cache.set_current_validator_set_quorum_hash(next_validator_set_quorum_hash); + block_platform_state + .set_current_validator_set_quorum_hash(next_validator_set_quorum_hash); } - state_cache.set_last_committed_block_info(Some(extended_block_info)); + block_platform_state.set_last_committed_block_info(Some(extended_block_info)); + + block_platform_state.set_genesis_block_info(None); - state_cache.set_genesis_block_info(None); + // Persist block state - //todo: verify this with an update - PlatformVersion::set_current(PlatformVersion::get(platform_version.protocol_version)?); + self.store_platform_state(&block_platform_state, Some(transaction), platform_version)?; - // Persist ephemeral data - self.store_ephemeral_state(&state_cache, transaction, platform_version)?; + self.state.store(Arc::new(block_platform_state)); Ok(()) } diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/mod.rs index fa9ade29664..ebfe6c3fdfb 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/mod.rs @@ -36,6 +36,7 @@ where /// pub fn validator_set_update( &self, + proposer_pro_tx_hash: [u8; 32], platform_state: &PlatformState, block_execution_context: &mut BlockExecutionContext, platform_version: &PlatformVersion, @@ -46,7 +47,11 @@ where .block_end .validator_set_update { - 0 => self.validator_set_update_v0(platform_state, block_execution_context), + 0 => self.validator_set_update_v0( + proposer_pro_tx_hash, + platform_state, + block_execution_context, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "validator_set_update".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs index 3a1ead24fb3..efc62518801 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs @@ -4,13 +4,14 @@ use crate::execution::types::block_execution_context::v0::{ BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, }; use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::platform_types::validator_set::v0::ValidatorSetV0Getters; use crate::rpc::core::CoreRPCLike; +use itertools::Itertools; +use dpp::dashcore::hashes::Hash; use tenderdash_abci::proto::abci::ValidatorSetUpdate; impl Platform @@ -19,33 +20,76 @@ where { /// We need to validate against the platform state for rotation and not the block execution /// context state + #[inline(always)] pub(super) fn validator_set_update_v0( &self, + proposer_pro_tx_hash: [u8; 32], platform_state: &PlatformState, block_execution_context: &mut BlockExecutionContext, ) -> Result, Error> { let mut perform_rotation = false; - if block_execution_context.block_state_info().height() - % self - .config - .execution - .validator_set_quorum_rotation_block_count as u64 - == 0 - { - tracing::debug!( - method = "validator_set_update_v0", - "rotation: previous quorum finished members. quorum rotation expected" - ); - perform_rotation = true; - } - // we also need to perform a rotation if the validator set is being removed - if block_execution_context + if let Some(validator_set) = block_execution_context .block_platform_state() .validator_sets() .get(&platform_state.current_validator_set_quorum_hash()) - .is_none() { + if let Some((last_member_pro_tx_hash, _)) = validator_set.members().last_key_value() { + // we should also perform a rotation if the validator set went through all quorum members + // this means we are at the last member of the quorum + if last_member_pro_tx_hash.as_byte_array() == &proposer_pro_tx_hash { + tracing::debug!( + method = "validator_set_update_v0", + "rotation: quorum finished as we hit last member {} of quorum {}. All known quorums are: [{}]. quorum rotation expected", + hex::encode(proposer_pro_tx_hash), + hex::encode(platform_state.current_validator_set_quorum_hash().as_byte_array()), + block_execution_context + .block_platform_state() + .validator_sets() + .keys() + .map(hex::encode).collect::>().join(" | "), + ); + perform_rotation = true; + } + } else { + // the validator set has no members, very weird, but let's just perform a rotation + tracing::debug!( + method = "validator_set_update_v0", + "rotation: validator set has no members", + ); + perform_rotation = true; + } + + // We should also perform a rotation if there are more than one quorum in the system + // and that the new proposer is on the same quorum and the last proposer but is before + // them in the list of proposers. + // This only works if Tenderdash goes through proposers properly + if &platform_state.last_committed_quorum_hash() + == platform_state + .current_validator_set_quorum_hash() + .as_byte_array() + && platform_state.last_committed_block_proposer_pro_tx_hash() > proposer_pro_tx_hash + && platform_state.validator_sets().len() > 1 + { + // 1 - We haven't changed quorums + // 2 - The new proposer is before the old proposer + // 3 - There are more than one quorum in the system + tracing::debug!( + method = "validator_set_update_v0", + "rotation: quorum finished as we hit last an earlier member {} than last block proposer {} for quorum {}. All known quorums are: [{}]. quorum rotation expected", + hex::encode(proposer_pro_tx_hash), + hex::encode(block_execution_context.block_platform_state().last_committed_block_proposer_pro_tx_hash()), + hex::encode(platform_state.current_validator_set_quorum_hash().as_byte_array()), + block_execution_context + .block_platform_state() + .validator_sets() + .keys() + .map(hex::encode).collect::>().join(" | "), + ); + perform_rotation = true; + } + } else { + // we also need to perform a rotation if the validator set is being removed tracing::debug!( method = "validator_set_update_v0", "rotation: new quorums not containing current quorum current {:?}, {}. quorum rotation expected˚", @@ -59,7 +103,7 @@ where perform_rotation = true; } - //todo: perform a rotation if quorum health is low + //todo: (maybe) perform a rotation if quorum health is low if perform_rotation { // get the index of the previous quorum @@ -67,15 +111,17 @@ where .validator_sets() .get_index_of(&platform_state.current_validator_set_quorum_hash()) .ok_or(Error::Execution(ExecutionError::CorruptedCachedState( - "current quorums do not contain current validator set", - )))?; + format!("perform_rotation: current validator set quorum hash {} not in current known validator sets [{}] processing block {}", platform_state.current_validator_set_quorum_hash(), platform_state + .validator_sets().keys().map(|quorum_hash| quorum_hash.to_string()).join(" | "), + platform_state.last_committed_block_height() + 1, + ))))?; // we should rotate the quorum let quorum_count = platform_state.validator_sets().len(); match quorum_count { 0 => Err(Error::Execution(ExecutionError::CorruptedCachedState( - "no current quorums", + "no current quorums".to_string(), ))), - 1 => Ok(None), + 1 => Ok(None), // no rotation as we are the only quorum count => { let start_index = index; index = (index + 1) % count; diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs index 1d281cb1d1d..96bdf8d2936 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs @@ -1,19 +1,18 @@ mod v0; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; -use drive::grovedb::Transaction; +use drive::grovedb::TransactionArg; +use drive::util::batch::DriveOperation; use crate::error::Error; use crate::execution::types::block_fees::BlockFees; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::storage_fee_distribution_outcome; use crate::error::execution::ExecutionError; +use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; impl Platform { @@ -41,10 +40,9 @@ impl Platform { /// pub fn add_process_epoch_change_operations( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: &BlockFees, - transaction: &Transaction, + transaction: TransactionArg, batch: &mut Vec, platform_version: &PlatformVersion, ) -> Result, Error> @@ -56,8 +54,7 @@ impl Platform { .add_process_epoch_change_operations { 0 => self.add_process_epoch_change_operations_v0( - block_info, - epoch_info, + block_execution_context, block_fees, transaction, batch, diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs index 24d58502f45..1aa590cbc3c 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs @@ -36,24 +36,25 @@ use std::option::Option::None; use dpp::block::epoch::Epoch; -use dpp::fee::epoch::{perpetual_storage_epochs, GENESIS_EPOCH_INDEX, PERPETUAL_STORAGE_ERAS}; -use dpp::fee::DEFAULT_ORIGINAL_FEE_MULTIPLIER; +use dpp::fee::epoch::{perpetual_storage_epochs, GENESIS_EPOCH_INDEX}; use dpp::version::PlatformVersion; -use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use drive::drive::batch::{DriveOperation, GroveDbOpBatch}; -use drive::grovedb::Transaction; +use drive::error; +use drive::grovedb::TransactionArg; +use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use drive::util::batch::{DriveOperation, GroveDbOpBatch}; use crate::error::Error; use crate::execution::types::block_fees::v0::BlockFeesV0Getters; use crate::execution::types::block_fees::BlockFees; use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::storage_fee_distribution_outcome; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; -use drive::fee_pools::epochs::operations_factory::EpochOperations; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use drive::drive::credit_pools::epochs::operations_factory::EpochOperations; /// From the Dash Improvement Proposal: @@ -74,18 +75,21 @@ impl Platform { /// accumulated during the previous epoch. /// /// `DistributionLeftoverCredits` will be returned, except if we are at Genesis Epoch. + #[inline(always)] pub(super) fn add_process_epoch_change_operations_v0( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: &BlockFees, - transaction: &Transaction, + transaction: TransactionArg, batch: &mut Vec, platform_version: &PlatformVersion, ) -> Result, Error> { let mut inner_batch = GroveDbOpBatch::new(); + let epoch_info = block_execution_context.epoch_info(); + let block_info = block_execution_context.block_state_info(); + // init next thousandth empty epochs since last initiated let last_initiated_epoch_index = epoch_info .previous_epoch_index() @@ -101,15 +105,36 @@ impl Platform { // init current epoch pool for processing let current_epoch = Epoch::new(epoch_info.current_epoch_index())?; - //todo: version + let Some(fee_multiplier) = platform_version + .fee_version + .uses_version_fee_multiplier_permille + else { + return Err(Error::Drive(error::drive::DriveError::NotSupported("the fee_multiplier_permille must be set in fees if using add_process_epoch_change_operations_v0").into())); + }; + + // it is important to set the current protocol version because we might have skipped + // protocol versions if we skip over epochs. current_epoch.add_init_current_operations( - DEFAULT_ORIGINAL_FEE_MULTIPLIER, // TODO use a data contract to choose the fee multiplier + fee_multiplier, // TODO (feature) use a data contract to choose the fee multiplier block_info.height(), block_info.core_chain_locked_height(), block_info.block_time_ms(), + block_execution_context + .block_platform_state() + .current_protocol_version_in_consensus(), &mut inner_batch, ); + // Update next epoch protocol version so it can be queryable + let next_epoch = Epoch::new(epoch_info.current_epoch_index() + 1)?; + inner_batch.push( + next_epoch.update_protocol_version_operation( + block_execution_context + .block_platform_state() + .next_epoch_protocol_version(), + ), + ); + // Nothing to distribute on genesis epoch start if current_epoch.index == GENESIS_EPOCH_INDEX { batch.push(DriveOperation::GroveDBOpBatch(inner_batch)); @@ -120,7 +145,7 @@ impl Platform { let storage_fee_distribution_outcome = self .add_distribute_storage_fee_to_epochs_operations( current_epoch.index, - Some(transaction), + transaction, &mut inner_batch, platform_version, )?; @@ -129,7 +154,7 @@ impl Platform { .add_delete_pending_epoch_refunds_except_specified_operations( &mut inner_batch, block_fees.refunds_per_epoch(), - Some(transaction), + transaction, &platform_version.drive, )?; @@ -150,11 +175,15 @@ mod tests { mod helpers { use super::*; + use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; use crate::execution::types::block_fees::v0::{BlockFeesV0, BlockFeesV0Methods}; use crate::execution::types::block_state_info::v0::BlockStateInfoV0; use crate::platform_types::epoch_info::v0::EpochInfoV0; + use crate::platform_types::platform_state::PlatformState; use dpp::block::block_info::BlockInfo; use dpp::fee::epoch::CreditsPerEpoch; + use drive::grovedb::Transaction; + use platform_version::version::INITIAL_PROTOCOL_VERSION; /// Process and validate an epoch change pub fn process_and_validate_epoch_change( @@ -194,6 +223,7 @@ mod tests { &BlockInfo::default(), Some(transaction), platform_version, + None, ) .expect("should apply batch"); } @@ -232,14 +262,29 @@ mod tests { } .into(); + let block_platform_state = PlatformState::default_with_protocol_versions( + INITIAL_PROTOCOL_VERSION, + INITIAL_PROTOCOL_VERSION, + &platform.config, + ) + .expect("failed to create platform state"); + + let block_execution_context = BlockExecutionContextV0 { + block_state_info: block_info.clone().into(), + epoch_info, + hpmn_count: 0, + unsigned_withdrawal_transactions: Default::default(), + block_platform_state, + proposer_results: None, + }; + let mut batch = vec![]; let storage_fee_distribution_outcome = platform .add_process_epoch_change_operations_v0( - &block_info.clone().into(), - &epoch_info, + &block_execution_context.into(), &block_fees, - transaction, + Some(transaction), &mut batch, platform_version, ) @@ -253,6 +298,7 @@ mod tests { &BlockInfo::default(), Some(transaction), platform_version, + None, ) .expect("should apply batch"); @@ -264,7 +310,7 @@ mod tests { let has_epoch_tree_exists = platform .drive - .has_epoch_tree_exists(&next_thousandth_epoch, Some(transaction)) + .has_epoch_tree_exists(&next_thousandth_epoch, Some(transaction), platform_version) .expect("should check epoch tree existence"); assert!(has_epoch_tree_exists); diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/mod.rs index f8d62b0dd9d..232c76143e8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/mod.rs @@ -1,2 +1,5 @@ mod add_process_epoch_change_operations; pub mod process_block_fees; + +#[cfg(test)] +mod tests; diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs index b82ac36f129..7ab4cbe08d8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs @@ -6,13 +6,12 @@ use drive::grovedb::Transaction; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_fees::BlockFees; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::processed_block_fees_outcome; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; impl Platform { @@ -37,8 +36,7 @@ impl Platform { /// pub fn process_block_fees( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: BlockFees, transaction: &Transaction, platform_version: &PlatformVersion, @@ -50,8 +48,7 @@ impl Platform { .process_block_fees { 0 => self.process_block_fees_v0( - block_info, - epoch_info, + block_execution_context, block_fees, transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs index 5659c7affe0..d73b86e7a21 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs @@ -1,35 +1,6 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Block Fees Processing. //! -//! This modules defines functions related to processing block fees upon block and +//! This module defines functions related to processing block fees upon block and //! epoch changes. //! @@ -37,23 +8,25 @@ use std::option::Option::None; use dpp::block::epoch::Epoch; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; use drive::drive::Drive; use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_fees::v0::BlockFeesV0Getters; use crate::execution::types::block_fees::BlockFees; use crate::execution::types::block_state_info::v0::{ BlockStateInfoV0Getters, BlockStateInfoV0Methods, }; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::processed_block_fees_outcome; use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; -use drive::fee_pools::epochs::operations_factory::EpochOperations; + +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use drive::drive::credit_pools::epochs::operations_factory::EpochOperations; /// From the Dash Improvement Proposal: @@ -73,24 +46,26 @@ impl Platform { /// and distributing the block fees from the previous block and applies the batch. /// /// Returns `ProcessedBlockFeesOutcome`. + #[inline(always)] pub(super) fn process_block_fees_v0( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: BlockFees, transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result { + let epoch_info = block_execution_context.epoch_info(); + let block_info = block_execution_context.block_state_info(); + let current_epoch = Epoch::new(epoch_info.current_epoch_index())?; let mut batch = vec![]; let storage_fee_distribution_outcome = if epoch_info.is_epoch_change() { self.add_process_epoch_change_operations( - block_info, - epoch_info, + block_execution_context, &block_fees, - transaction, + Some(transaction), &mut batch, platform_version, )? @@ -178,6 +153,11 @@ impl Platform { &block_info.to_block_info(epoch_info.try_into()?), Some(transaction), platform_version, + Some( + block_execution_context + .block_platform_state() + .previous_fee_versions(), + ), )?; let outcome = processed_block_fees_outcome::v0::ProcessedBlockFeesOutcome { @@ -222,14 +202,18 @@ mod tests { use crate::config::ExecutionConfig; use crate::{config::PlatformConfig, test::helpers::setup::TestPlatformBuilder}; - use drive::common::identities::create_test_masternode_identities; + use drive::util::test_helpers::test_utils::identities::create_test_masternode_identities; mod helpers { use super::*; + use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; use crate::execution::types::block_fees::v0::BlockFeesV0; use crate::execution::types::block_state_info::v0::BlockStateInfoV0; use crate::platform_types::epoch_info::v0::EpochInfoV0; + use crate::platform_types::epoch_info::EpochInfo; + use crate::platform_types::platform_state::PlatformState; use dpp::fee::epoch::{perpetual_storage_epochs, CreditsPerEpoch, GENESIS_EPOCH_INDEX}; + use platform_version::version::INITIAL_PROTOCOL_VERSION; /// Process and validate block fees pub fn process_and_validate_block_fees( @@ -259,7 +243,7 @@ mod tests { app_hash: None, }; - let epoch_info = EpochInfoV0::from_genesis_time_and_block_info( + let epoch_info: EpochInfo = EpochInfoV0::from_genesis_time_and_block_info( genesis_time_ms, &block_info, platform.config.execution.epoch_time_length_s, @@ -274,10 +258,25 @@ mod tests { } .into(); + let block_platform_state = PlatformState::default_with_protocol_versions( + INITIAL_PROTOCOL_VERSION, + INITIAL_PROTOCOL_VERSION, + &platform.config, + ) + .expect("failed to create default platform state"); + + let block_execution_context = BlockExecutionContextV0 { + block_state_info: block_info.clone().into(), + epoch_info: epoch_info.clone(), + hpmn_count: 0, + unsigned_withdrawal_transactions: Default::default(), + block_platform_state, + proposer_results: None, + }; + let storage_fee_distribution_outcome = platform .process_block_fees_v0( - &block_info.clone().into(), - &epoch_info, + &block_execution_context.into(), block_fees.clone(), transaction, platform_version, @@ -364,7 +363,7 @@ mod tests { ..Default::default() }) .build_with_mock_rpc() - .set_initial_state_structure(); + .set_genesis_state_with_activation_info(0, 1); let transaction = platform.drive.grove.start_transaction(); diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/tests.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/tests.rs new file mode 100644 index 00000000000..0e50baab4f6 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/tests.rs @@ -0,0 +1,845 @@ +#[cfg(test)] +mod refund_tests { + use crate::execution::validation::state_transition::tests::{ + fetch_expected_identity_balance, process_state_transitions, + setup_identity_with_system_credits, + }; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::fast_forward_to_block::fast_forward_to_block; + use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; + use dpp::block::block_info::BlockInfo; + use dpp::dash_to_credits; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use dpp::data_contract::document_type::random_document::{ + CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType, + }; + use dpp::data_contract::document_type::DocumentTypeRef; + use dpp::document::document_methods::DocumentMethodsV0; + use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; + use dpp::document::{Document, DocumentV0Setters}; + use dpp::fee::fee_result::FeeResult; + use dpp::fee::Credits; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::{Identity, IdentityPublicKey}; + use dpp::platform_value::Bytes32; + use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; + use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; + use drive::util::test_helpers::setup_contract; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + use simple_signer::signer::SimpleSigner; + use std::ops::Deref; + + // There's a fee for the first document that a user creates on a contract as they add space + // For the identity data contract nonce + fn setup_join_contract_document<'a>( + platform: &TempPlatform, + profile: DocumentTypeRef, + rng: &mut StdRng, + identity: &'a Identity, + key: &IdentityPublicKey, + signer: &SimpleSigner, + ) -> Credits { + let platform_version = PlatformVersion::latest(); + + let platform_state = platform.state.load(); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/ivan.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Ivan".into()); + altered_document.set("avatarUrl", "http://test.com/dog.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + profile, + entropy.0, + key, + 2, + 0, + signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let (mut fee_results, processed_block_fee_outcome) = process_state_transitions( + &platform, + &vec![documents_batch_create_transition.clone()], + BlockInfo::default(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + assert_eq!( + fee_result.storage_fee, + processed_block_fee_outcome.fees_in_pools.storage_fees + ); + + assert_eq!( + fee_result.processing_fee, + processed_block_fee_outcome.fees_in_pools.processing_fees + ); + + let expected_user_balance_after_creation = + dash_to_credits!(1) - fee_result.total_base_fee(); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + expected_user_balance_after_creation, + ); + + expected_user_balance_after_creation + } + + fn setup_initial_document<'a>( + platform: &TempPlatform, + profile: DocumentTypeRef, + rng: &mut StdRng, + identity: &'a Identity, + key: &IdentityPublicKey, + signer: &SimpleSigner, + ) -> (Document, FeeResult, Credits) { + // Let's make another document first just so the operations of joining a contract are out of the way + // (A user pays to add some data to the state on the first time they make their first document for a contract) + let user_credits_left = + setup_join_contract_document(platform, profile, rng, identity, key, signer); + + let platform_version = PlatformVersion::latest(); + + let platform_state = platform.state.load(); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let serialized_len = document + .serialize(profile, platform_version) + .expect("expected to serialize") + .len() as u64; + + assert_eq!(serialized_len, 173); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + profile, + entropy.0, + key, + 3, + 0, + signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let (mut fee_results, _) = process_state_transitions( + &platform, + &vec![documents_batch_create_transition.clone()], + BlockInfo::default(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + assert_eq!(fee_result.storage_fee, 11124000); + + let added_bytes = fee_result.storage_fee + / platform_version + .fee_version + .storage + .storage_disk_usage_credit_per_byte; + + // Key -> 65 bytes + // 32 bytes for the key prefix + // 32 bytes for the unique id + // 1 byte for key_size (required space for 64) + + // Value -> 279 + // 1 for the flag option with flags + // 1 for the flags size + // 35 for flags 32 + 1 + 2 + // 1 for the enum type + // 1 for item + // 173 for item serialized bytes (verified above) + // 1 for Basic Merk + // 32 for node hash + // 32 for value hash + // 2 byte for the value_size (required space for above 128) + + // Parent Hook -> 68 + // Key Bytes 32 + // Hash Size 32 + // Key Length 1 + // Child Heights 2 + // Basic Merk 1 + + assert_eq!(added_bytes, 65 + 279 + 68); + + let expected_user_balance_after_creation = user_credits_left - fee_result.total_base_fee(); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + expected_user_balance_after_creation, + ); + + (document, fee_result, expected_user_balance_after_creation) + } + + #[test] + fn test_document_refund_immediate() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let dashpay_contract_no_indexes = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json", + None, + None, + ); + + let profile = dashpay_contract_no_indexes + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = + setup_identity_with_system_credits(&mut platform, 958, dash_to_credits!(1)); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + dash_to_credits!(1), + ); + + let (document, insertion_fee_result, current_user_balance) = + setup_initial_document(&platform, profile, &mut rng, &identity, &key, &signer); + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let (mut fee_results, _) = process_state_transitions( + &platform, + &vec![documents_batch_delete_transition.clone()], + BlockInfo::default(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + let refund_amount = fee_result + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()) + .expect("expected refunds for identity"); + + // we should be refunding more than 99% + let lower_bound = insertion_fee_result.storage_fee * 99 / 100; + assert!(refund_amount > lower_bound, "expected the refund amount to be more than 99% of the storage cost, as it is for just one out of 2000 epochs"); + assert!( + refund_amount < insertion_fee_result.storage_fee, + "expected the refund amount to be less than the insertion cost" + ); + + assert_eq!(fee_result.storage_fee, 0); + + let expected_user_balance_after_deletion = + current_user_balance - fee_result.total_base_fee() + refund_amount; + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + expected_user_balance_after_deletion, + ); + } + #[test] + fn test_document_refund_after_an_epoch() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let dashpay_contract_no_indexes = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json", + None, + None, + ); + + let profile = dashpay_contract_no_indexes + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let mut rng = StdRng::seed_from_u64(433); + + let (identity, signer, key) = + setup_identity_with_system_credits(&mut platform, 958, dash_to_credits!(1)); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + dash_to_credits!(1), + ); + + let (document, insertion_fee_result, current_user_balance) = + setup_initial_document(&platform, profile, &mut rng, &identity, &key, &signer); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 1, false); //next epoch + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let platform_state = platform.state.load(); + + let (mut fee_results, _) = process_state_transitions( + &platform, + &vec![documents_batch_delete_transition.clone()], + *platform_state.last_block_info(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + let refund_amount = fee_result + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()) + .expect("expected refunds for identity"); + + // we should be refunding more than 99% still + let lower_bound = insertion_fee_result.storage_fee * 99 / 100; + assert!(refund_amount > lower_bound, "expected the refund amount to be more than 99% of the storage cost, as it is for just one out of 2000 epochs"); + assert!( + refund_amount < insertion_fee_result.storage_fee, + "expected the refund amount to be less than the insertion cost" + ); + + assert_eq!(fee_result.storage_fee, 0); + + let expected_user_balance_after_deletion = + current_user_balance - fee_result.total_base_fee() + refund_amount; + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + expected_user_balance_after_deletion, + ); + } + + #[test] + fn test_document_refund_after_a_year() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let dashpay_contract_no_indexes = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json", + None, + None, + ); + + let profile = dashpay_contract_no_indexes + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let mut rng = StdRng::seed_from_u64(433); + + let (identity, signer, key) = + setup_identity_with_system_credits(&mut platform, 958, dash_to_credits!(1)); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + dash_to_credits!(1), + ); + + let (document, insertion_fee_result, current_user_balance) = + setup_initial_document(&platform, profile, &mut rng, &identity, &key, &signer); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 40, false); //a year later + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let platform_state = platform.state.load(); + + let (mut fee_results, _) = process_state_transitions( + &platform, + &vec![documents_batch_delete_transition.clone()], + *platform_state.last_block_info(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + let refund_amount = fee_result + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()) + .expect("expected refunds for identity"); + + // we should be refunding around 94% after a year. + let refunded_percentage = refund_amount * 100 / insertion_fee_result.storage_fee; + assert_eq!(refunded_percentage, 94); + + assert_eq!(fee_result.storage_fee, 0); + + let expected_user_balance_after_deletion = + current_user_balance - fee_result.total_base_fee() + refund_amount; + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + expected_user_balance_after_deletion, + ); + } + + #[test] + fn test_document_refund_after_25_years() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let dashpay_contract_no_indexes = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json", + None, + None, + ); + + let profile = dashpay_contract_no_indexes + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let mut rng = StdRng::seed_from_u64(433); + + let (identity, signer, key) = + setup_identity_with_system_credits(&mut platform, 958, dash_to_credits!(1)); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + dash_to_credits!(1), + ); + + let (document, insertion_fee_result, current_user_balance) = + setup_initial_document(&platform, profile, &mut rng, &identity, &key, &signer); + + fast_forward_to_block(&platform, 10_200_000_000, 9000, 42, 40 * 25, false); //25 years later + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let platform_state = platform.state.load(); + + let (mut fee_results, _) = process_state_transitions( + &platform, + &vec![documents_batch_delete_transition.clone()], + *platform_state.last_block_info(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + let refund_amount = fee_result + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()) + .expect("expected refunds for identity"); + + // we should be refunding around 21% after 25 years. + let refunded_percentage = refund_amount * 100 / insertion_fee_result.storage_fee; + assert_eq!(refunded_percentage, 21); + + assert_eq!(fee_result.storage_fee, 0); + + let expected_user_balance_after_deletion = + current_user_balance - fee_result.total_base_fee() + refund_amount; + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + expected_user_balance_after_deletion, + ); + } + + #[test] + fn test_document_refund_after_50_years() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let dashpay_contract_no_indexes = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json", + None, + None, + ); + + let profile = dashpay_contract_no_indexes + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let mut rng = StdRng::seed_from_u64(433); + + let (identity, signer, key) = + setup_identity_with_system_credits(&mut platform, 958, dash_to_credits!(1)); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + dash_to_credits!(1), + ); + + let (document, _, current_user_balance) = + setup_initial_document(&platform, profile, &mut rng, &identity, &key, &signer); + + fast_forward_to_block(&platform, 10_200_000_000, 9000, 42, 40 * 50, false); //50 years later + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let platform_state = platform.state.load(); + + let (mut fee_results, _) = process_state_transitions( + &platform, + &vec![documents_batch_delete_transition.clone()], + *platform_state.last_block_info(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + let refund_amount = fee_result + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()) + .expect("expected refunds for identity"); + + // we should be refunding nothing after 50 years. + assert_eq!(refund_amount, 0); + + assert_eq!(fee_result.storage_fee, 0); + + let expected_user_balance_after_deletion = + current_user_balance - fee_result.total_base_fee() + refund_amount; + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + expected_user_balance_after_deletion, + ); + } + + #[test] + fn test_document_refund_after_10_epochs_on_different_fee_version_increasing_fees() { + let platform_version = PlatformVersion::latest(); + let platform_version_with_higher_fees = platform_version.clone(); + + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let dashpay_contract_no_indexes = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json", + None, + None, + ); + + let profile = dashpay_contract_no_indexes + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let mut rng = StdRng::seed_from_u64(433); + + let (identity, signer, key) = + setup_identity_with_system_credits(&mut platform, 958, dash_to_credits!(1)); + + fetch_expected_identity_balance( + &platform, + identity.id(), + platform_version, + dash_to_credits!(1), + ); + + let (document, insertion_fee_result, current_user_balance) = + setup_initial_document(&platform, profile, &mut rng, &identity, &key, &signer); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 10, false); //next epoch + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + profile, + &key, + 4, + 0, + &signer, + &platform_version_with_higher_fees, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let mut platform_state = platform.state.load().clone().deref().clone(); + + platform_state + .previous_fee_versions_mut() + .insert(5, platform_version_with_higher_fees.fee_version.clone()); + + let (mut fee_results, _) = process_state_transitions( + &platform, + &vec![documents_batch_delete_transition.clone()], + *platform_state.last_block_info(), + &platform_state, + ); + + let fee_result = fee_results.remove(0); + + let credits_verified = platform + .platform + .drive + .calculate_total_credits_balance(None, &platform_version_with_higher_fees.drive) + .expect("expected to check sum trees"); + + let balanced = credits_verified + .ok() + .expect("expected that credits will balance when we remove in same block"); + + assert!(balanced, "platform should be balanced {}", credits_verified); + + let refund_amount = fee_result + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()) + .expect("expected refunds for identity"); + + println!("{}", insertion_fee_result.storage_fee); + println!("{}", refund_amount); + + // we should be refunding around 21% after 25 years. + let refunded_percentage = refund_amount * 100 / insertion_fee_result.storage_fee; + assert_eq!(refunded_percentage, 98); + + assert_eq!(fee_result.storage_fee, 0); + + let expected_user_balance_after_deletion = + current_user_balance - fee_result.total_base_fee() + refund_amount; + + fetch_expected_identity_balance( + &platform, + identity.id(), + &platform_version_with_higher_fees, + expected_user_balance_after_deletion, + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs index ab753ba88b6..f8f25668636 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs @@ -6,9 +6,8 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::block::extended_block_info::ExtendedBlockInfo; + use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; impl Platform where diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs index 1529688bf4c..ecf723fa2ad 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs @@ -8,10 +8,15 @@ where /// Clears the drive cache at the start of block processing. This does a few things like clearing /// the block data contract cache and the block platform versions cache. /// + #[inline(always)] pub(super) fn clear_drive_block_cache_v0(&self) { - let mut drive_cache = self.drive.cache.write().unwrap(); + self.drive.cache.data_contracts.clear_block_cache(); - drive_cache.cached_contracts.clear_block_cache(); - drive_cache.protocol_versions_counter.clear_block_cache() + let mut protocol_versions_counter = self.drive.cache.protocol_versions_counter.write(); + + protocol_versions_counter.clear_block_cache(); + // Getter is disabled in case of epoch change so we need to enable it back + // For more information read comments in `upgrade_protocol_version_v0` function + protocol_versions_counter.unblock_global_cache(); } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_start/migrate_state/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_start/migrate_state/mod.rs new file mode 100644 index 00000000000..96d91d938c4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/block_start/migrate_state/mod.rs @@ -0,0 +1,30 @@ +use crate::error::Error; + +use dpp::prelude::BlockHeight; +use drive::grovedb::Transaction; + +use crate::platform_types::platform::Platform; + +use crate::platform_types::platform_state::PlatformState; + +impl Platform { + /// Perform state migration based on block height + pub fn migrate_state_for_height( + &self, + height: BlockHeight, + _block_platform_state: &mut PlatformState, + _transaction: &Transaction, + ) -> Result<(), Error> { + #[allow(clippy::match_single_binding)] + let is_migrated = match height { + // 30 => self.migration_30_test(block_platform_state, transaction)?, + _ => false, + }; + + if is_migrated { + tracing::debug!("Successfully migrated state for height {}", height); + } + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_start/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_start/mod.rs index cd4e1a74dc7..7557122603b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_start/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_start/mod.rs @@ -1,2 +1,6 @@ /// Clearing the drive cache should happen when a new block is going to be run pub(in crate::execution) mod clear_drive_block_cache; +/// State migration +mod migrate_state; +/// Patch the platform version function mapping and migrate state based on the block height +pub(in crate::execution) mod patch_platform; diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_start/patch_platform.rs b/packages/rs-drive-abci/src/execution/platform_events/block_start/patch_platform.rs new file mode 100644 index 00000000000..953ec4f217f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/block_start/patch_platform.rs @@ -0,0 +1,28 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::prelude::BlockHeight; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; + +impl Platform { + /// This function patches platform version and run migrations + /// It modifies protocol version to function version mapping to apply hotfixes + /// Also it performs migrations to fix corrupted state or prepare it for new features + /// + /// This function appends the patch to PlatformState, potentially alter Drive and Platform execution state + /// and returns patched version + pub fn apply_platform_version_patch_and_migrate_state_for_height( + &self, + height: BlockHeight, + platform_state: &mut PlatformState, + transaction: &Transaction, + ) -> Result, Error> { + let patched_platform_version = + platform_state.apply_platform_version_patch_for_height(height)?; + + self.migrate_state_for_height(height, platform_state, transaction)?; + + Ok(patched_platform_version) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs index 467af1138b2..f0d40e393d5 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs @@ -1,5 +1,6 @@ use crate::error::Error; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; @@ -30,6 +31,7 @@ where /// /// * Result<(), Error> - Returns Ok(()) if the update is successful. Returns an error if /// there is a problem updating the masternode list, quorum information, or the state. + #[inline(always)] pub(super) fn update_core_info_v0( &self, platform_state: Option<&PlatformState>, @@ -40,6 +42,12 @@ where transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { + // the core height of the block platform state is the last committed + if !is_init_chain && block_platform_state.last_committed_core_height() == core_block_height + { + // if we get the same height that we know we do not need to update core info + return Ok(()); + } self.update_masternode_list( platform_state, block_platform_state, @@ -51,6 +59,7 @@ where )?; self.update_quorum_info( + platform_state, block_platform_state, core_block_height, false, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs index a4a607b9ba3..5b3d815efb0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs @@ -10,6 +10,7 @@ impl Platform where C: CoreRPCLike, { + #[inline(always)] pub(super) fn create_operator_identity_v0( masternode: &MasternodeListItem, platform_version: &PlatformVersion, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs index 616ef40b5d6..eb4da99b897 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs @@ -2,7 +2,7 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; -use dpp::dashcore::hashes::Hash; +use dpp::identifier::Identifier; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::Identity; use dpp::version::PlatformVersion; @@ -25,8 +25,8 @@ where Ok(identity) } - fn get_owner_identifier(masternode: &MasternodeListItem) -> Result<[u8; 32], Error> { + fn get_owner_identifier(masternode: &MasternodeListItem) -> Result { let masternode_identifier: [u8; 32] = masternode.pro_tx_hash.into(); - Ok(masternode_identifier) + Ok(masternode_identifier.into()) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_voter_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_voter_identity/v0/mod.rs index 68ec59fce8c..9268960874e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_voter_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_voter_identity/v0/mod.rs @@ -3,8 +3,10 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; use dpp::dashcore::hashes::Hash; +use dpp::identifier::MasternodeIdentifiers; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::Identity; +use dpp::prelude::Identifier; use dpp::version::PlatformVersion; impl Platform @@ -16,8 +18,7 @@ where voting_key: &[u8; 20], platform_version: &PlatformVersion, ) -> Result { - let voting_identifier = - Self::get_voter_identifier(pro_tx_hash, voting_key, platform_version)?; + let voting_identifier = Identifier::create_voter_identifier(pro_tx_hash, voting_key); let mut identity = Identity::create_basic_identity(voting_identifier, platform_version)?; identity.add_public_keys([Self::get_voter_identity_key( *voting_key, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/mod.rs index 417d41160dc..66d540c0c08 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/mod.rs @@ -8,7 +8,7 @@ use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; +use drive::util::batch::DriveOperation; use drive::grovedb::Transaction; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs index 6efc66d8447..a43dcf02dbd 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs @@ -4,15 +4,15 @@ use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; use dpp::block::block_info::BlockInfo; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::identity::Purpose::WITHDRAW; +use dpp::identity::Purpose::TRANSFER; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; -use drive::drive::batch::DriveOperation::IdentityOperation; -use drive::drive::batch::IdentityOperationType::DisableIdentityKeys; use drive::drive::identity::key::fetch::{ IdentityKeysRequest, KeyIDIdentityPublicKeyPairVec, KeyRequestType, }; use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; +use drive::util::batch::DriveOperation::IdentityOperation; +use drive::util::batch::IdentityOperationType::DisableIdentityKeys; impl Platform where @@ -40,14 +40,14 @@ where Self::get_voter_identifier_from_masternode_list_item(old_masternode, platform_version)?; let operator_key_request = IdentityKeysRequest { - identity_id: operator_identifier, + identity_id: operator_identifier.into_buffer(), request_type: KeyRequestType::AllKeys, limit: None, offset: None, }; let voter_key_request = IdentityKeysRequest { - identity_id: voter_identifier, + identity_id: voter_identifier.into_buffer(), request_type: KeyRequestType::AllKeys, limit: None, offset: None, @@ -62,7 +62,7 @@ where )? .into_iter() .filter_map(|(key_id, key)| { - if key.is_disabled() || key.purpose() == WITHDRAW { + if key.is_disabled() || key.purpose() == TRANSFER { None // Don't disable withdrawal keys } else { Some(key_id) @@ -95,9 +95,8 @@ where ); drive_operations.push(IdentityOperation(DisableIdentityKeys { - identity_id: operator_identifier, + identity_id: operator_identifier.into_buffer(), keys_ids: operator_identity_keys, - disable_at: block_info.time_ms, })); tracing::trace!( @@ -109,9 +108,8 @@ where ); drive_operations.push(IdentityOperation(DisableIdentityKeys { - identity_id: voter_identifier, + identity_id: voter_identifier.into_buffer(), keys_ids: voter_identity_keys, - disable_at: block_info.time_ms, })); Ok(()) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/mod.rs index 8229de81ece..87f27b24f10 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/mod.rs @@ -5,6 +5,7 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; @@ -23,22 +24,21 @@ where /// /// # Returns /// - /// * Result<[u8; 32], Error> - Returns the derived operator identifier if successful. Otherwise, returns an error. + /// * Result - Returns the derived operator identifier if successful. Otherwise, returns an error. pub(super) fn get_operator_identifier_from_masternode_list_item( masternode: &MasternodeListItem, platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { + ) -> Result { match platform_version .drive_abci .methods .core_based_updates .masternode_updates - .get_operator_identifier + .get_operator_identifier_from_masternode_list_item { - 0 => Self::get_operator_identifier_from_masternode_list_item_v0( + 0 => Ok(Self::get_operator_identifier_from_masternode_list_item_v0( masternode, - platform_version, - ), + )), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "get_operator_identifier_from_masternode_list_item".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs index a3aee5b8604..20a09780697 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs @@ -1,33 +1,20 @@ -use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; -use dpp::dashcore::hashes::Hash; -use dpp::version::PlatformVersion; +use dpp::identifier::MasternodeIdentifiers; +use dpp::prelude::Identifier; impl Platform where C: CoreRPCLike, { - pub(super) fn get_operator_identifier_v0( - pro_tx_hash: &[u8; 32], - pub_key_operator: &[u8], - platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { - let operator_identifier = - Self::hash_protxhash_with_key_data(pro_tx_hash, pub_key_operator, platform_version)?; - Ok(operator_identifier) - } - pub(super) fn get_operator_identifier_from_masternode_list_item_v0( masternode: &MasternodeListItem, - platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { + ) -> Identifier { let pro_tx_hash = &masternode.pro_tx_hash.into(); - Self::get_operator_identifier_v0( + Identifier::create_operator_identifier( pro_tx_hash, masternode.state.pub_key_operator.as_slice(), - platform_version, ) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs index 6df7c15c6e7..ff3a8899500 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs @@ -30,7 +30,7 @@ where IdentityPublicKeyV0 { id: 1, key_type: KeyType::ECDSA_HASH160, - purpose: Purpose::WITHDRAW, + purpose: Purpose::TRANSFER, security_level: SecurityLevel::CRITICAL, read_only: true, data: BinaryData::new(operator_payout_address.to_vec()), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs index 03865a481cb..eb478c5acca 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs @@ -16,7 +16,7 @@ where Ok(IdentityPublicKeyV0 { id: key_id, key_type: KeyType::ECDSA_HASH160, - purpose: Purpose::WITHDRAW, + purpose: Purpose::TRANSFER, security_level: SecurityLevel::CRITICAL, read_only: true, data: BinaryData::new(payout_address.to_vec()), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/mod.rs index 25d6838f850..c82078fa8df 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/mod.rs @@ -5,6 +5,7 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; @@ -12,40 +13,6 @@ impl Platform where C: CoreRPCLike, { - /// Retrieves a voter identifier using the provided transaction hash and voting address. - /// - /// This function derives the voter identifier and delegates to a version-specific method depending on the platform version. - /// - /// # Arguments - /// - /// * pro_tx_hash - A reference to the transaction hash. - /// * voting_address - A reference to the voting address. - /// * platform_version - The version of the platform to determine which method to delegate to. - /// - /// # Returns - /// - /// * Result<[u8; 32], Error> - Returns the derived voter identifier if successful. Otherwise, returns an error. - pub(crate) fn get_voter_identifier( - pro_tx_hash: &[u8; 32], - voting_address: &[u8; 20], - platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { - match platform_version - .drive_abci - .methods - .core_based_updates - .masternode_updates - .get_voter_identifier - { - 0 => Self::get_voter_identifier_v0(pro_tx_hash, voting_address, platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "get_voter_identifier".to_string(), - known_versions: vec![0], - received: version, - })), - } - } - /// Retrieves a voter identifier based on the provided masternode list item. /// /// This function derives the voter identifier for a masternode and delegates to a version-specific method depending on the platform version. @@ -57,22 +24,21 @@ where /// /// # Returns /// - /// * Result<[u8; 32], Error> - Returns the derived voter identifier if successful. Otherwise, returns an error. + /// * Result - Returns the derived voter identifier if successful. Otherwise, returns an error. pub(crate) fn get_voter_identifier_from_masternode_list_item( masternode: &MasternodeListItem, platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { + ) -> Result { match platform_version .drive_abci .methods .core_based_updates .masternode_updates - .get_voter_identifier + .get_voter_identifier_from_masternode_list_item { - 0 => Self::get_voter_identifier_from_masternode_list_item_v0( + 0 => Ok(Self::get_voter_identifier_from_masternode_list_item_v0( masternode, - platform_version, - ), + )), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "get_voter_identifier_from_masternode_list_item".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs index d3e4a39d5aa..709879db084 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs @@ -1,30 +1,17 @@ -use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; -use dpp::dashcore::hashes::Hash; -use dpp::version::PlatformVersion; +use dpp::identifier::{Identifier, MasternodeIdentifiers}; impl Platform where C: CoreRPCLike, { - pub(super) fn get_voter_identifier_v0( - pro_tx_hash: &[u8; 32], - voting_address: &[u8; 20], - platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { - let voting_identifier = - Self::hash_protxhash_with_key_data(pro_tx_hash, voting_address, platform_version)?; - Ok(voting_identifier) - } - pub(super) fn get_voter_identifier_from_masternode_list_item_v0( masternode: &MasternodeListItem, - platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { + ) -> Identifier { let pro_tx_hash = &masternode.pro_tx_hash.into(); let voting_address = &masternode.state.voting_address; - Self::get_voter_identifier(pro_tx_hash, voting_address, platform_version) + Identifier::create_voter_identifier(pro_tx_hash, voting_address) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/mod.rs deleted file mode 100644 index 88b1fcff76e..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/mod.rs +++ /dev/null @@ -1,46 +0,0 @@ -mod v0; - -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; - -impl Platform -where - C: CoreRPCLike, -{ - /// Hashes transaction hash with key data. - /// - /// This function performs the hash operation and delegates to a version-specific method depending on the platform version. - /// - /// # Arguments - /// - /// * pro_tx_hash - The provided transaction hash. - /// * key_data - The key data. - /// * platform_version - The version of the platform to determine which method to delegate to. - /// - /// # Returns - /// - /// * Result<[u8; 32], Error> - Returns a 32 byte hash if successful. Otherwise, returns an error. - pub(in crate::execution::platform_events::core_based_updates) fn hash_protxhash_with_key_data( - pro_tx_hash: &[u8; 32], - key_data: &[u8], - platform_version: &PlatformVersion, - ) -> Result<[u8; 32], Error> { - match platform_version - .drive_abci - .methods - .core_based_updates - .masternode_updates - .hash_protxhash_with_key_data - { - 0 => Self::hash_protxhash_with_key_data_v0(pro_tx_hash, key_data), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "hash_protxhash_with_key_data".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/v0/mod.rs deleted file mode 100644 index 8e696e032b6..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/v0/mod.rs +++ /dev/null @@ -1,23 +0,0 @@ -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use sha2::{Digest, Sha256}; - -impl Platform -where - C: CoreRPCLike, -{ - pub(super) fn hash_protxhash_with_key_data_v0( - pro_tx_hash: &[u8; 32], - key_data: &[u8], - ) -> Result<[u8; 32], Error> { - // todo: maybe change hash functions - let mut hasher = Sha256::new(); - hasher.update(pro_tx_hash); - hasher.update(key_data); - Ok(hasher - .finalize() - .try_into() - .expect("expected a 32 byte hash")) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/mod.rs index a0edc0c7698..e3168a64e75 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/mod.rs @@ -7,7 +7,6 @@ mod get_operator_identity_keys; mod get_owner_identity_key; mod get_voter_identifier; mod get_voter_identity_key; -mod hash_protxhash_with_key_data; mod update_masternode_identities; mod update_operator_identity; mod update_owner_withdrawal_address; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_masternode_identities/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_masternode_identities/v0/mod.rs index 938804b9a44..751abd32be2 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_masternode_identities/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_masternode_identities/v0/mod.rs @@ -10,8 +10,10 @@ use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation::IdentityOperation; -use drive::drive::batch::IdentityOperationType::AddNewIdentity; +use drive::util::batch::DriveOperation::IdentityOperation; +use drive::util::batch::IdentityOperationType::AddNewIdentity; + +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use drive::grovedb::Transaction; use std::collections::BTreeMap; @@ -134,12 +136,14 @@ where } } + let previous_fee_verions = platform_state.map(|state| state.previous_fee_versions()); self.drive.apply_drive_operations( drive_operations, true, block_info, Some(transaction), platform_version, + previous_fee_verions, )?; let height = block_info.height; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/mod.rs index 04abcec895f..2a32163ba93 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/mod.rs @@ -10,7 +10,7 @@ use dashcore_rpc::json::DMNStateDiff; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; +use drive::util::batch::DriveOperation; use drive::grovedb::Transaction; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs index 98c1b95edbc..68d8585f5f0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs @@ -14,19 +14,19 @@ use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::identity_public_key::v0::IdentityPublicKeyV0; -use dpp::identity::Purpose::WITHDRAW; +use dpp::identity::Purpose::TRANSFER; use dpp::identity::{Identity, IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; use dpp::platform_value::BinaryData; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; -use drive::drive::batch::DriveOperation::IdentityOperation; -use drive::drive::batch::IdentityOperationType::{ - AddNewIdentity, AddNewKeysToIdentity, DisableIdentityKeys, -}; use drive::drive::identity::key::fetch::{ IdentityKeysRequest, KeyIDIdentityPublicKeyPairBTreeMap, KeyRequestType, }; use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; +use drive::util::batch::DriveOperation::IdentityOperation; +use drive::util::batch::IdentityOperationType::{ + AddNewIdentity, AddNewKeysToIdentity, DisableIdentityKeys, +}; impl Platform where @@ -35,7 +35,7 @@ where pub(super) fn update_operator_identity_v0( &self, masternode: &(ProTxHash, DMNStateDiff), - block_info: &BlockInfo, + _block_info: &BlockInfo, platform_state: &PlatformState, transaction: &Transaction, drive_operations: &mut Vec, @@ -57,9 +57,10 @@ where .full_masternode_list() .get(pro_tx_hash) .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCachedState( - "expected masternode to be in state", - )) + Error::Execution(ExecutionError::CorruptedCachedState(format!( + "expected masternode {} to be in state", + pro_tx_hash + ))) })?; let old_operator_identifier = Self::get_operator_identifier_from_masternode_list_item( @@ -77,7 +78,7 @@ where )?; let key_request = IdentityKeysRequest { - identity_id: old_operator_identifier, + identity_id: old_operator_identifier.to_buffer(), request_type: KeyRequestType::AllKeys, limit: None, offset: None, @@ -142,9 +143,8 @@ where if !old_operator_identity_key_ids_to_disable.is_empty() { drive_operations.push(IdentityOperation(DisableIdentityKeys { - identity_id: new_operator_identifier, + identity_id: new_operator_identifier.to_buffer(), keys_ids: old_operator_identity_key_ids_to_disable, - disable_at: block_info.time_ms, })); } @@ -191,7 +191,7 @@ where let key = IdentityPublicKeyV0 { id: new_key_id, key_type: KeyType::ECDSA_HASH160, - purpose: WITHDRAW, + purpose: TRANSFER, security_level: SecurityLevel::CRITICAL, read_only: true, data: BinaryData::new(new_operator_payout_address.to_vec()), @@ -204,7 +204,7 @@ where } drive_operations.push(IdentityOperation(AddNewKeysToIdentity { - identity_id: new_operator_identifier, + identity_id: new_operator_identifier.to_buffer(), unique_keys_to_add, non_unique_keys_to_add, })); @@ -230,9 +230,8 @@ where if !old_operator_identity_key_ids_to_disable.is_empty() { drive_operations.push(IdentityOperation(DisableIdentityKeys { - identity_id: old_operator_identifier, + identity_id: old_operator_identifier.to_buffer(), keys_ids: old_operator_identity_key_ids_to_disable, - disable_at: block_info.time_ms, })); } let new_payout_address = diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/mod.rs index 732708ad9c6..5374de13540 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/mod.rs @@ -8,7 +8,7 @@ use dashcore_rpc::json::DMNStateDiff; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; +use drive::util::batch::DriveOperation; use drive::grovedb::Transaction; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs index fc45189d7bd..73d26e82359 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs @@ -13,13 +13,13 @@ use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV use dpp::identity::KeyID; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; -use drive::drive::batch::DriveOperation::IdentityOperation; -use drive::drive::batch::IdentityOperationType::{AddNewKeysToIdentity, DisableIdentityKeys}; use drive::drive::identity::key::fetch::{ IdentityKeysRequest, KeyIDIdentityPublicKeyPairBTreeMap, KeyRequestType, }; use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; +use drive::util::batch::DriveOperation::IdentityOperation; +use drive::util::batch::IdentityOperationType::{AddNewKeysToIdentity, DisableIdentityKeys}; impl Platform where C: CoreRPCLike, @@ -85,7 +85,6 @@ where drive_operations.push(IdentityOperation(DisableIdentityKeys { identity_id: owner_identifier, keys_ids: key_ids_to_disable, - disable_at: block_info.time_ms, })); } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/mod.rs index 421a7e929d9..f0c711d4d51 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/mod.rs @@ -12,8 +12,8 @@ use dashcore_rpc::dashcore::ProTxHash; use dashcore_rpc::json::DMNStateDiff; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; impl Platform where diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs index 87ee96806d1..a0b6fa68a1c 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs @@ -14,13 +14,13 @@ use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; -use drive::drive::batch::DriveOperation::IdentityOperation; -use drive::drive::batch::IdentityOperationType::{ - AddNewIdentity, DisableIdentityKeys, ReEnableIdentityKeys, -}; use drive::drive::identity::key::fetch::{IdentityKeysRequest, KeyIDVec, KeyRequestType}; use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; +use drive::util::batch::DriveOperation::IdentityOperation; +use drive::util::batch::IdentityOperationType::{ + AddNewIdentity, DisableIdentityKeys, ReEnableIdentityKeys, +}; impl Platform where @@ -47,16 +47,17 @@ where .full_masternode_list() .get(pro_tx_hash) .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCachedState( - "expected masternode to be in state", - )) + Error::Execution(ExecutionError::CorruptedCachedState(format!( + "expected masternode {} to be in state", + pro_tx_hash + ))) })?; let old_voter_identifier = Self::get_voter_identifier_from_masternode_list_item(old_masternode, platform_version)?; let key_request = IdentityKeysRequest { - identity_id: old_voter_identifier, + identity_id: old_voter_identifier.to_buffer(), request_type: KeyRequestType::AllKeys, limit: None, offset: None, @@ -83,9 +84,8 @@ where ); drive_operations.push(IdentityOperation(DisableIdentityKeys { - identity_id: old_voter_identifier, + identity_id: old_voter_identifier.to_buffer(), keys_ids: old_voter_identity_key_ids, - disable_at: block_info.time_ms, })); // Part 2 : Create or Update Voting identity based on new key @@ -127,7 +127,7 @@ where ); drive_operations.push(IdentityOperation(ReEnableIdentityKeys { - identity_id: old_voter_identifier, + identity_id: old_voter_identifier.into_buffer(), keys_ids: new_voter_identity_key_ids, })); } else { diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs index fc0f4c3ea94..b6c447fa75b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs @@ -90,7 +90,7 @@ where // baseBlock must be a chain height and not 0 None } else { - let state_core_height = state.core_height(); + let state_core_height = state.last_committed_core_height(); if core_block_height == state_core_height { return Ok(update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome::default()); // no need to do anything diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs index e9372043b18..e02de6a933e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs @@ -40,10 +40,10 @@ where transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { - if let Some(last_commited_block_info) = + if let Some(last_committed_block_info) = block_platform_state.last_committed_block_info().as_ref() { - if core_block_height == last_commited_block_info.basic_info().core_height { + if core_block_height == last_committed_block_info.basic_info().core_height { tracing::debug!( method = "update_masternode_list_v0", "no update mnl at height {}", @@ -56,38 +56,35 @@ where method = "update_masternode_list_v0", "update mnl to height {} at block {}", core_block_height, - block_platform_state.core_height() + block_platform_state.last_committed_core_height() ); - //todo: there's a weird condition that can happen if we are not on init chain, but we are - // in the genesis and we are not on round 0, and the core height changed - if block_platform_state.last_committed_block_info().is_some() || is_init_chain { - let update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome { - masternode_list_diff, - removed_masternodes, - } = self.update_state_masternode_list_v0( - block_platform_state, - core_block_height, - is_init_chain, - )?; - self.update_masternode_identities( - masternode_list_diff, - &removed_masternodes, - block_info, - platform_state, - transaction, - platform_version, - )?; + let update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome { + masternode_list_diff, + removed_masternodes, + } = self.update_state_masternode_list_v0( + block_platform_state, + core_block_height, + is_init_chain, + )?; - if !removed_masternodes.is_empty() { - self.drive.remove_validators_proposed_app_versions( - removed_masternodes - .into_keys() - .map(|pro_tx_hash| pro_tx_hash.into()), - Some(transaction), - &platform_version.drive, - )?; - } + self.update_masternode_identities( + masternode_list_diff, + &removed_masternodes, + block_info, + platform_state, + transaction, + platform_version, + )?; + + if !removed_masternodes.is_empty() { + self.drive.remove_validators_proposed_app_versions( + removed_masternodes + .into_keys() + .map(|pro_tx_hash| pro_tx_hash.into()), + Some(transaction), + &platform_version.drive, + )?; } Ok(()) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs index 535f5e5ff0c..87510c71171 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs @@ -26,6 +26,7 @@ where /// on success, or an `Error` on failure. pub(in crate::execution::platform_events::core_based_updates) fn update_quorum_info( &self, + platform_state: Option<&PlatformState>, block_platform_state: &mut PlatformState, core_block_height: u32, start_from_scratch: bool, @@ -38,6 +39,7 @@ where .update_quorum_info { 0 => self.update_quorum_info_v0( + platform_state, block_platform_state, core_block_height, start_from_scratch, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index 24130b279d4..bcc65582d7e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -3,15 +3,45 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; +use dashcore_rpc::json::{ExtendedQuorumListResult, QuorumType}; use std::collections::BTreeMap; +use std::fmt::Display; use crate::platform_types::validator_set::v0::{ValidatorSetV0, ValidatorSetV0Getters}; use crate::platform_types::validator_set::ValidatorSet; use crate::rpc::core::CoreRPCLike; +use crate::platform_types::signature_verification_quorum_set::{ + SignatureVerificationQuorumSet, SignatureVerificationQuorumSetV0Methods, VerificationQuorum, +}; +use dpp::bls_signatures::PublicKey as BlsPublicKey; use dpp::dashcore::QuorumHash; use tracing::Level; +#[derive(Copy, Clone)] +enum QuorumSetType { + ChainLock(QuorumType), + InstantLock(QuorumType), +} + +impl QuorumSetType { + fn quorum_type(&self) -> QuorumType { + match self { + QuorumSetType::ChainLock(quorum_type) => *quorum_type, + QuorumSetType::InstantLock(quorum_type) => *quorum_type, + } + } +} + +impl Display for QuorumSetType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + QuorumSetType::ChainLock(quorum_type) => write!(f, "chain lock ({quorum_type})"), + QuorumSetType::InstantLock(quorum_type) => write!(f, "instant lock ({quorum_type})"), + } + } +} + impl Platform where C: CoreRPCLike, @@ -29,19 +59,34 @@ where /// on success, or an `Error` on failure. pub(super) fn update_quorum_info_v0( &self, + platform_state: Option<&PlatformState>, block_platform_state: &mut PlatformState, core_block_height: u32, start_from_scratch: bool, ) -> Result<(), Error> { let _span = tracing::span!(Level::TRACE, "update_quorum_info", core_block_height).entered(); + let last_committed_core_height = block_platform_state.last_committed_core_height(); + + let validator_set_quorum_type = self.config.validator_set.quorum_type; + let chain_lock_quorum_type = self.config.chain_lock.quorum_type; + let instant_lock_quorum_type = self.config.instant_lock.quorum_type; + if start_from_scratch { - tracing::debug!("update quorum info from scratch up to {core_block_height}"); - } else if core_block_height != block_platform_state.core_height() { tracing::debug!( - previous_core_block_height = block_platform_state.core_height(), + ?validator_set_quorum_type, + ?chain_lock_quorum_type, + ?instant_lock_quorum_type, + "update quorum info from scratch up to {core_block_height}", + ); + } else if core_block_height != last_committed_core_height { + tracing::debug!( + ?validator_set_quorum_type, + ?chain_lock_quorum_type, + ?instant_lock_quorum_type, + previous_core_block_height = last_committed_core_height, "update quorum info from {} to {}", - block_platform_state.core_height(), + last_committed_core_height, core_block_height ); } else { @@ -50,55 +95,64 @@ where return Ok(()); // no need to do anything } + // We request the quorum list from the current core block height, this is because we also keep + // the previous chain lock validating quorum. Core will sign from 8 blocks before the current + // core block height, so often we will use the previous chain lock validating quorums instead. + let mut extended_quorum_list = self .core_rpc .get_quorum_listextended(Some(core_block_height))?; let validator_quorums_list: BTreeMap<_, _> = extended_quorum_list .quorums_by_type - .remove(&self.config.quorum_type()) + .remove(&validator_set_quorum_type) .ok_or(Error::Execution(ExecutionError::DashCoreBadResponseError( format!( "expected quorums of type {}, but did not receive any from Dash Core", - self.config.quorum_type + self.config.validator_set.quorum_type ), )))? .into_iter() .collect(); + let mut removed_a_validator_set = false; + // Remove validator_sets entries that are no longer valid for the core block height block_platform_state .validator_sets_mut() .retain(|quorum_hash, _| { - let has_quorum = validator_quorums_list.contains_key::(quorum_hash); + let retain = validator_quorums_list.contains_key::(quorum_hash); + removed_a_validator_set |= !retain; - if has_quorum { + if !retain { tracing::trace!( ?quorum_hash, - quorum_type = ?self.config.quorum_type(), - "remove validator set {} with quorum type {}", + quorum_type = ?self.config.validator_set.quorum_type, + "removed validator set {} with quorum type {}", quorum_hash, - self.config.quorum_type() + self.config.validator_set.quorum_type ) } - has_quorum + retain }); // Fetch quorum info and their keys from the RPC for new quorums let mut quorum_infos = validator_quorums_list - .iter() + .into_iter() .filter(|(key, _)| { !block_platform_state .validator_sets() .contains_key::(key) }) .map(|(key, _)| { - let quorum_info_result = - self.core_rpc - .get_quorum_info(self.config.quorum_type(), key, None)?; + let quorum_info_result = self.core_rpc.get_quorum_info( + self.config.validator_set.quorum_type, + &key, + None, + )?; - Ok((*key, quorum_info_result)) + Ok((key, quorum_info_result)) }) .collect::, Error>>()?; @@ -124,16 +178,18 @@ where tracing::trace!( ?validator_set, ?quorum_hash, - quorum_type = ?self.config.quorum_type(), + quorum_type = ?self.config.validator_set.quorum_type, "add new validator set {} with quorum type {}", quorum_hash, - self.config.quorum_type() + self.config.validator_set.quorum_type ); Ok((quorum_hash, validator_set)) }) .collect::, Error>>()?; + let is_validator_set_updated = !new_validator_sets.is_empty() || removed_a_validator_set; + // Add new validator_sets entries block_platform_state .validator_sets_mut() @@ -154,6 +210,238 @@ where } }); + // Update Chain Lock quorums + + // Use already updated validator sets if we use the same quorums + let quorum_set_type = QuorumSetType::ChainLock(chain_lock_quorum_type); + let are_chainlock_quorum_updated = if chain_lock_quorum_type == validator_set_quorum_type { + // Update only in case if there are any changes + if is_validator_set_updated { + Self::update_quorums_from_validator_set( + quorum_set_type, + platform_state, + block_platform_state, + core_block_height, + ); + } + + is_validator_set_updated + } else { + self.update_quorums_from_quorum_list( + quorum_set_type, + block_platform_state.chain_lock_validating_quorums_mut(), + platform_state, + &extended_quorum_list, + last_committed_core_height, + core_block_height, + )? + }; + + // Update Instant Lock quorums + + // Use already updated chainlock quorums if we use the same quorum type + let quorum_set_type = QuorumSetType::InstantLock(instant_lock_quorum_type); + if instant_lock_quorum_type == chain_lock_quorum_type { + if are_chainlock_quorum_updated { + tracing::trace!( + "updated instant lock validating quorums to chain lock validating quorums because they share the same quorum type", + ); + + block_platform_state.set_instant_lock_validating_quorums( + block_platform_state.chain_lock_validating_quorums().clone(), + ); + } + // The same for validator set quorum type + } else if instant_lock_quorum_type == validator_set_quorum_type { + if is_validator_set_updated { + Self::update_quorums_from_validator_set( + quorum_set_type, + platform_state, + block_platform_state, + core_block_height, + ); + } + } else { + self.update_quorums_from_quorum_list( + quorum_set_type, + block_platform_state.instant_lock_validating_quorums_mut(), + platform_state, + &extended_quorum_list, + last_committed_core_height, + core_block_height, + )?; + } + Ok(()) } + + fn update_quorums_from_validator_set( + quorum_set_type: QuorumSetType, + platform_state: Option<&PlatformState>, + block_platform_state: &mut PlatformState, + core_block_height: u32, + ) { + let quorums = block_platform_state + .validator_sets() + .iter() + .map(|(quorum_hash, validator_set)| { + ( + *quorum_hash, + VerificationQuorum { + public_key: validator_set.threshold_public_key().clone(), + index: validator_set.quorum_index(), + }, + ) + }) + .collect(); + + tracing::trace!( + "updated {} validating quorums to current validator set because they share the same quorum type", + quorum_set_type + ); + + let last_committed_core_height = block_platform_state.last_committed_core_height(); + + let quorum_set = quorum_set_by_type_mut(block_platform_state, &quorum_set_type); + + if platform_state.is_some() { + // we already have state, so we update last and previous quorums + quorum_set.replace_quorums(quorums, last_committed_core_height, core_block_height); + } else { + // the only case where there will be no platform_state is init chain, + // so there is no previous quorums to update + quorum_set.set_current_quorums(quorums) + } + } + + fn update_quorums_from_quorum_list( + &self, + quorum_set_type: QuorumSetType, + quorum_set: &mut SignatureVerificationQuorumSet, + platform_state: Option<&PlatformState>, + full_quorum_list: &ExtendedQuorumListResult, + last_committed_core_height: u32, + next_core_height: u32, + ) -> Result { + // TODO: Use HashSet, we don't need to update index for existing quorums + let quorums_list: BTreeMap<_, _> = full_quorum_list + .quorums_by_type + .get(&quorum_set_type.quorum_type()) + .ok_or(Error::Execution(ExecutionError::DashCoreBadResponseError( + format!( + "expected quorums {}, but did not receive any from Dash Core", + quorum_set_type + ), + )))? + .iter() + .map(|(quorum_hash, extended_quorum_details)| { + (quorum_hash, extended_quorum_details.quorum_index) + }) + .collect(); + + let mut removed_a_validating_quorum = false; + + // Remove validating_quorums entries that are no longer valid for the core block height + // and update quorum index for existing validator sets + quorum_set + .current_quorums_mut() + .retain(|quorum_hash, quorum| { + let retain = match quorums_list.get(quorum_hash) { + Some(index) => { + quorum.index = *index; + true + } + None => false, + }; + + if !retain { + tracing::trace!( + ?quorum_hash, + quorum_type = ?quorum_set_type.quorum_type(), + "removed old {} quorum {}", + quorum_set_type, + quorum_hash, + ); + } + removed_a_validating_quorum |= !retain; + retain + }); + + // Fetch quorum info and their keys from the RPC for new quorums + // and then create VerificationQuorum instances + let new_quorums = quorums_list + .into_iter() + .filter(|(quorum_hash, _)| { + !quorum_set + .current_quorums() + .contains_key::(quorum_hash) + }) + .map(|(quorum_hash, index)| { + let quorum_info = self.core_rpc.get_quorum_info( + quorum_set_type.quorum_type(), + quorum_hash, + None, + )?; + + let public_key = + match BlsPublicKey::from_bytes(quorum_info.quorum_public_key.as_slice()) + .map_err(ExecutionError::BlsErrorFromDashCoreResponse) + { + Ok(public_key) => public_key, + Err(e) => return Err(e.into()), + }; + + tracing::trace!( + ?public_key, + ?quorum_hash, + index, + quorum_type = ?quorum_set_type.quorum_type(), + "add new {} quorum {}", + quorum_set_type, + quorum_hash, + ); + + Ok((*quorum_hash, VerificationQuorum { public_key, index })) + }) + .collect::, Error>>()?; + + let are_quorums_updated = !new_quorums.is_empty() || removed_a_validating_quorum; + + quorum_set.current_quorums_mut().extend(new_quorums); + + if are_quorums_updated { + if let Some(old_state) = platform_state { + let previous_validating_quorums = + quorum_set_by_type(old_state, &quorum_set_type).current_quorums(); + + quorum_set.set_previous_past_quorums( + previous_validating_quorums.clone(), + last_committed_core_height, + next_core_height, + ); + } + } + + Ok(are_quorums_updated) + } +} + +fn quorum_set_by_type_mut<'p>( + platform_state: &'p mut PlatformState, + quorum_set_type: &QuorumSetType, +) -> &'p mut SignatureVerificationQuorumSet { + match quorum_set_type { + QuorumSetType::ChainLock(_) => platform_state.chain_lock_validating_quorums_mut(), + QuorumSetType::InstantLock(_) => platform_state.instant_lock_validating_quorums_mut(), + } +} + +fn quorum_set_by_type<'p>( + platform_state: &'p PlatformState, + quorum_set_type: &QuorumSetType, +) -> &'p SignatureVerificationQuorumSet { + match quorum_set_type { + QuorumSetType::ChainLock(_) => platform_state.chain_lock_validating_quorums(), + QuorumSetType::InstantLock(_) => platform_state.instant_lock_validating_quorums(), + } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs new file mode 100644 index 00000000000..3af3b3fbd2d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -0,0 +1,76 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dashcore_rpc::dashcore_rpc_json::QuorumType; +use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::dashcore::QuorumHash; + +use std::collections::BTreeMap; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +pub type ReversedQuorumHashBytes = Vec; + +impl Platform +where + C: CoreRPCLike, +{ + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + // TODO: use CoreQuorumSet.select_quorums instead + pub fn choose_quorum<'a>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .choose_quorum + { + 0 => Ok(Self::choose_quorum_v0( + llmq_quorum_type, + quorums, + request_id, + )), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "choose_quorum".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + /// + pub fn choose_quorum_thread_safe<'a, const T: usize>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .choose_quorum + { + 0 => Ok(Self::choose_quorum_thread_safe_v0( + llmq_quorum_type, + quorums, + request_id, + )), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "choose_quorum_thread_safe".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs new file mode 100644 index 00000000000..0d8ac563e34 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -0,0 +1,357 @@ +use dashcore_rpc::dashcore_rpc_json::QuorumType; +use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; +use dpp::dashcore::QuorumHash; +use std::collections::BTreeMap; + +use crate::platform_types::platform::Platform; + +use crate::execution::platform_events::core_chain_lock::choose_quorum::ReversedQuorumHashBytes; + +impl Platform { + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + pub(super) fn choose_quorum_v0<'a>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + ) -> Option<(ReversedQuorumHashBytes, &'a BlsPublicKey)> { + // Scoring system logic + let mut scores: Vec<(ReversedQuorumHashBytes, &BlsPublicKey, [u8; 32])> = Vec::new(); + + for (quorum_hash, public_key) in quorums { + let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash_bytes.reverse(); + + let mut hasher = sha256d::Hash::engine(); + + // Serialize and hash the LLMQ type + hasher.input(&[llmq_quorum_type as u8]); + + // Serialize and add the quorum hash + hasher.input(quorum_hash_bytes.as_slice()); + + // Serialize and add the selection hash from the chain lock + hasher.input(request_id.as_slice()); + + // Finalize the hash + let hash_result = sha256d::Hash::from_engine(hasher); + scores.push((quorum_hash_bytes, public_key, hash_result.into())); + } + + if scores.is_empty() { + None + } else { + scores.sort_by_key(|k| k.2); + + let (quorum_hash, key, _) = scores.remove(0); + + Some((quorum_hash, key)) + } + } + + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + pub(super) fn choose_quorum_thread_safe_v0<'a, const T: usize>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + ) -> Option<(ReversedQuorumHashBytes, &'a [u8; T])> { + // Scoring system logic + let mut scores: Vec<(ReversedQuorumHashBytes, &[u8; T], [u8; 32])> = Vec::new(); + + for (quorum_hash, key) in quorums { + let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash_bytes.reverse(); + + let mut hasher = sha256d::Hash::engine(); + + // Serialize and hash the LLMQ type + hasher.input(&[llmq_quorum_type as u8]); + + // Serialize and add the quorum hash + hasher.input(quorum_hash_bytes.as_slice()); + + // Serialize and add the selection hash from the chain lock + hasher.input(request_id.as_slice()); + + // Finalize the hash + let hash_result = sha256d::Hash::from_engine(hasher); + scores.push((quorum_hash_bytes, key, hash_result.into())); + } + + scores.sort_by_key(|k| k.2); + scores.pop().map(|(hash, key, _)| (hash, key)) + } +} + +#[cfg(test)] +mod tests { + use crate::platform_types::platform::Platform; + use crate::rpc::core::MockCoreRPCLike; + use dashcore_rpc::dashcore_rpc_json::QuorumType; + use dpp::bls_signatures::PublicKey as BlsPublicKey; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::QuorumHash; + use std::collections::BTreeMap; + + #[test] + fn test_choose_quorum() { + // Active quorums: + let quorum_hash1 = QuorumHash::from_slice( + hex::decode("000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash2 = QuorumHash::from_slice( + hex::decode("000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash3 = QuorumHash::from_slice( + hex::decode("0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash4 = QuorumHash::from_slice( + hex::decode("0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorums = BTreeMap::from([ + (quorum_hash1, BlsPublicKey::generate()), + (quorum_hash2, BlsPublicKey::generate()), + (quorum_hash3, BlsPublicKey::generate()), + (quorum_hash4, BlsPublicKey::generate()), + ]); + + // + // ############### + // llmqType[1] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[4] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[5] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 + // llmqType[100] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + + let mut request_id: [u8; 32] = + hex::decode("bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5") + .unwrap() + .try_into() + .unwrap(); + + request_id.reverse(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + // ############### + // llmqType[1] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[4] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[5] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[100] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b + + let mut request_id: [u8; 32] = + hex::decode("b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20") + .unwrap() + .try_into() + .unwrap(); + + request_id.reverse(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b" + ); + + // ############### + // llmqType[1] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[4] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[5] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[100] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 + + let mut request_id: [u8; 32] = + hex::decode("2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10") + .unwrap() + .try_into() + .unwrap(); + + request_id.reverse(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223" + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs new file mode 100644 index 00000000000..52eb63c4e44 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs @@ -0,0 +1,54 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; + +/// Version 0 +pub mod v0; + +/// As we ask to make sure that core is synced to the chain lock, we get back one of 3 +pub enum CoreSyncStatus { + /// Core is synced + Done, + /// Core is 1 or 2 blocks off, we should retry shortly + Almost, + /// Core is more than 2 blocks off + Not, +} + +impl Platform +where + C: CoreRPCLike, +{ + /// The point of this call is to make sure core is synced. + /// Before this call we had previously validated that the chain lock is valid. + /// Right now the core height should be the same as the chain lock height. + /// + /// Todo: In the future: The core height passed here is the core height that we need to be able to validate all + /// asset lock proofs. + /// It should be chosen by taking the highest height of all state transitions that require core. + /// State transitions that require core are: + /// *Identity Create State transition + /// *Identity Top up State transition + pub fn make_sure_core_is_synced_to_chain_lock( + &self, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .core_chain_lock + .make_sure_core_is_synced_to_chain_lock + { + 0 => self.make_sure_core_is_synced_to_chain_lock_v0(chain_lock, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "make_sure_core_is_synced_to_chain_lock".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs new file mode 100644 index 00000000000..f92183277b4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -0,0 +1,38 @@ +use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// The point of this call is to make sure core is synced. + /// Before this call we had previously validated that the chain lock is valid. + pub(super) fn make_sure_core_is_synced_to_chain_lock_v0( + &self, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result { + let given_chain_lock_height = chain_lock.block_height; + // We need to make sure core is synced to the core height we see as valid for the state transitions + + // TODO: submit_chain_lock responds with invalid signature. We should handle it properly and return CoreSyncStatus + let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; + Ok(if best_chain_locked_height >= given_chain_lock_height { + CoreSyncStatus::Done + } else if best_chain_locked_height - given_chain_lock_height + <= platform_version + .drive_abci + .methods + .core_chain_lock + .recent_block_count_amount + { + CoreSyncStatus::Almost + } else { + CoreSyncStatus::Not + }) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs new file mode 100644 index 00000000000..a44b48464e8 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -0,0 +1,5 @@ +mod choose_quorum; +mod make_sure_core_is_synced_to_chain_lock; +mod verify_chain_lock; +mod verify_chain_lock_locally; +mod verify_chain_lock_through_core; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs new file mode 100644 index 00000000000..038a7365ac8 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -0,0 +1,50 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::dashcore::ChainLock; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::verify_chain_lock_result::v0::VerifyChainLockResult; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Verify the chain lock + /// If submit is true, we try to submit the chain lock if it is considered valid or we can not check to see if it is + /// valid on platform. + pub fn verify_chain_lock( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + make_sure_core_is_synced: bool, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock + { + 0 => self.verify_chain_lock_v0( + round, + platform_state, + chain_lock, + make_sure_core_is_synced, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs new file mode 100644 index 00000000000..d8ea647594b --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -0,0 +1,164 @@ +use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use crate::execution::platform_events::core_chain_lock::verify_chain_lock::VerifyChainLockResult; +use dpp::dashcore::ChainLock; +use dpp::version::PlatformVersion; +use std::thread::sleep; +use std::time::Duration; + +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; + +use crate::rpc::core::CoreRPCLike; + +const CORE_ALMOST_SYNCED_RETRIES: u32 = 5; +const CORE_ALMOST_SYNCED_SLEEP_TIME: u64 = 200; + +impl Platform +where + C: CoreRPCLike, +{ + pub(super) fn verify_chain_lock_v0( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + make_sure_core_is_synced: bool, + platform_version: &PlatformVersion, + ) -> Result { + // first we try to verify the chain lock locally + match self.verify_chain_lock_locally(round, platform_state, chain_lock, platform_version) { + Ok(Some(valid)) => { + if valid && make_sure_core_is_synced { + match self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version) + { + Ok(sync_status) => { + match sync_status { + CoreSyncStatus::Done => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: None, + core_is_synced: Some(true), + }), + CoreSyncStatus::Almost => { + for _i in 0..CORE_ALMOST_SYNCED_RETRIES { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(CORE_ALMOST_SYNCED_SLEEP_TIME)); + let best_chain_locked = + self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height >= chain_lock.block_height + { + return Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }); + } + } + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } + CoreSyncStatus::Not => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }), + } + } + Err(Error::CoreRpc(error)) => { + tracing::error!( + ?chain_lock, + ?error, + "Failed to submit chain lock: {}", + error + ); + + //ToDO (important), separate errors from core, connection Errors -> Err, others should be part of the result + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(false), + core_is_synced: None, //we do not know + }) + } + Err(e) => Err(e), + } + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: None, + core_is_synced: None, + }) + } + } + Ok(None) => { + // we were not able to verify locally + let (verified, status) = self.verify_chain_lock_through_core( + chain_lock, + make_sure_core_is_synced, + platform_version, + )?; + + if let Some(sync_status) = status { + // if we had make_sure_core_is_synced set to true + match sync_status { + CoreSyncStatus::Done => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: None, + core_is_synced: Some(true), + }), + CoreSyncStatus::Almost => { + for _i in 0..CORE_ALMOST_SYNCED_RETRIES { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(CORE_ALMOST_SYNCED_SLEEP_TIME)); + let best_chain_locked = self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height >= chain_lock.block_height { + return Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }); + } + } + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } + CoreSyncStatus::Not => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }), + } + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(verified), + core_is_synced: None, + }) + } + } + Err(Error::BLSError(_)) => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: false, + found_valid_locally: None, + found_valid_by_core: None, + core_is_synced: None, + }), + Err(e) => Err(e), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs new file mode 100644 index 00000000000..2e022adf5dd --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -0,0 +1,46 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::dashcore::ChainLock; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Returning None here means we were unable to verify the chain lock because of an absence of + /// the quorum + pub fn verify_chain_lock_locally( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock_locally + { + 0 => self.verify_chain_lock_locally_v0( + round, + platform_state, + chain_lock, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock_locally".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs new file mode 100644 index 00000000000..a48fc30c670 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -0,0 +1,282 @@ +use dpp::bls_signatures::G2Element; + +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; +use dpp::dashcore::{ChainLock, QuorumSigningRequestId}; + +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::error::execution::ExecutionError; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::signature_verification_quorum_set::SignatureVerificationQuorumSetV0Methods; +use dpp::version::PlatformVersion; + +const CHAIN_LOCK_REQUEST_ID_PREFIX: &str = "clsig"; + +const SIGN_OFFSET: u32 = 8; + +impl Platform +where + C: CoreRPCLike, +{ + /// Returning None here means we were unable to verify the chain lock because of an absence of + /// the quorum + #[inline(always)] + pub(super) fn verify_chain_lock_locally_v0( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + _platform_version: &PlatformVersion, + ) -> Result, Error> { + let quorum_set = platform_state.chain_lock_validating_quorums(); + let quorum_config = quorum_set.config(); + + // First verify that the signature conforms to a signature + let Ok(signature) = G2Element::from_bytes(chain_lock.signature.as_bytes()) else { + return Ok(Some(false)); + }; + + // we attempt to verify the chain lock locally + let chain_lock_height = chain_lock.block_height; + + let window_width = quorum_config.window; + + // The last block in the window where the quorums would be the same + let last_block_in_window = platform_state.last_committed_core_height() + - platform_state.last_committed_core_height() % window_width + + window_width + - 1; + + let verification_height = chain_lock_height.saturating_sub(SIGN_OFFSET); + + if verification_height > last_block_in_window { + tracing::debug!( + ?chain_lock, + "h:{} r:{} skipped message_digest for chain lock at core height {} is {}, verification height {}, last block in window {}", + platform_state.last_committed_block_height() + 1, + round, + chain_lock.block_height, + platform_state.last_committed_core_height(), + verification_height, + last_block_in_window, + ); + return Ok(None); // the chain lock is too far in the future or the past to verify locally + } + + let mut selected_quorums = platform_state + .chain_lock_validating_quorums() + .select_quorums(chain_lock_height, verification_height); + + // TODO: We can use chain_lock.request_id() + + // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks + // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. + + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(chain_lock.block_height.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + tracing::trace!( + ?chain_lock, + "request id for chain lock at height {} is {}", + chain_lock.block_height, + hex::encode(request_id.as_byte_array()) + ); + + // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined + + let probable_quorums = selected_quorums.next().ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "No quorums selected for chain lock signature verification for specified height", + )) + })?; + + let Some((quorum_hash, quorum)) = probable_quorums.choose_quorum(request_id.as_ref()) + else { + return Ok(None); + }; + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + + let mut engine = sha256d::Hash::engine(); + + let mut reversed_quorum_hash = quorum_hash.to_byte_array().to_vec(); + reversed_quorum_hash.reverse(); + + engine.input(&[quorum_config.quorum_type as u8]); + engine.input(reversed_quorum_hash.as_slice()); + engine.input(request_id.as_byte_array()); + engine.input(chain_lock.block_hash.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + let mut chain_lock_verified = quorum + .public_key + .verify(&signature, message_digest.as_ref()); + + tracing::debug!( + ?chain_lock, + "h:{} r:{} message_digest for chain lock at core height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification height {}, last block in window {}", + platform_state.last_committed_block_height() + 1, + round, + chain_lock.block_height, + hex::encode(message_digest.as_byte_array()), + hex::encode(reversed_quorum_hash.as_slice()), + hex::encode(chain_lock.block_hash.as_byte_array()), + if chain_lock_verified { "verified"} else {"not verified"}, + platform_state.last_committed_core_height(), + verification_height, + last_block_in_window, + ); + + if !chain_lock_verified { + // We should also check the other quorum, as there could be the situation where the core height wasn't updated every block. + if let Some(second_to_check_quorums) = selected_quorums.next() { + let Some((quorum_hash, quorum)) = + second_to_check_quorums.choose_quorum(request_id.as_ref()) + else { + // we return that we are not able to verify + return Ok(None); + }; + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + + let mut engine = sha256d::Hash::engine(); + + let mut reversed_quorum_hash = quorum_hash.to_byte_array().to_vec(); + reversed_quorum_hash.reverse(); + + engine.input(&[quorum_config.quorum_type as u8]); + engine.input(reversed_quorum_hash.as_slice()); + engine.input(request_id.as_byte_array()); + engine.input(chain_lock.block_hash.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + chain_lock_verified = quorum + .public_key + .verify(&signature, message_digest.as_ref()); + + tracing::debug!( + ?chain_lock, + "h:{} r:{} tried second quorums message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", + platform_state.last_committed_block_height() + 1, + round, + chain_lock.block_height, + hex::encode(message_digest.as_byte_array()), + hex::encode(reversed_quorum_hash.as_slice()), + hex::encode(chain_lock.block_hash.as_byte_array()), + if chain_lock_verified { "verified"} else {"not verified"} + ); + if !chain_lock_verified { + tracing::debug!( + "chain lock was invalid for both recent and old chain lock quorums" + ); + } + } else if !platform_state + .chain_lock_validating_quorums() + .has_previous_past_quorums() + { + // we don't have old quorums, this means our node is very new. + tracing::debug!( + "we had no previous quorums locally, we should validate through core", + ); + return Ok(None); + } else if !selected_quorums.should_be_verifiable() { + tracing::debug!( + "we were in a situation where it would be possible we didn't have all quorums and we couldn't verify locally, we should validate through core", + ); + return Ok(None); + } else if round >= 10 { + tracing::debug!("high round when chain lock was invalid, asking core to verify"); + } else { + tracing::debug!("chain lock was invalid, and we deemed there was no reason to check old quorums"); + } + } + + Ok(Some(chain_lock_verified)) + } +} + +#[cfg(test)] +mod tests { + use crate::execution::platform_events::core_chain_lock::verify_chain_lock_locally::v0::CHAIN_LOCK_REQUEST_ID_PREFIX; + use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; + use dpp::dashcore::QuorumSigningRequestId; + + #[test] + fn verify_request_id() { + assert_eq!( + hex::encode(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()), + "636c736967" + ); + assert_eq!(hex::encode(122u32.to_le_bytes()), "7a000000"); + + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(122u32.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + assert_eq!( + hex::encode(request_id.as_byte_array()), + "e1a9d40e5145fdc168819125b5ae1b8f12d5115471624eb363a6c7a3693be2e6" + ); + + // + // let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + } + + #[test] + fn verify_message_digest() { + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(956087u32.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + assert_eq!( + hex::encode(request_id.as_byte_array()), + "ea04b27adfaa698487aee46b922fb8f1c77a562787b6afe65eecf7e685888928" + ); + + let mut block_hash = + hex::decode("000000d94ea7ac4f86c5f583e7da0feb90b9f8d038f25e55cc305524c5327266") + .unwrap(); + let mut quorum_hash = + hex::decode("0000009d376e73a22aa997bb6542bd1fc3018f61c2301a817126a737ffdcdc80") + .unwrap(); + + block_hash.reverse(); + quorum_hash.reverse(); + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[1u8]); + engine.input(quorum_hash.as_slice()); + engine.input(request_id.to_byte_array().as_slice()); + engine.input(block_hash.as_slice()); + + let mut message_digest = sha256d::Hash::from_engine(engine).as_byte_array().to_vec(); + + message_digest.reverse(); + + assert_eq!( + hex::encode(message_digest.as_slice()), + "5ec53e83b8ff390b970e28db21da5b8e45fbe3b69d9f11a2c39062769b1f5e47" + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs new file mode 100644 index 00000000000..e7c585498d7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -0,0 +1,39 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::dashcore::ChainLock; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Verify the chain lock through core + pub fn verify_chain_lock_through_core( + &self, + chain_lock: &ChainLock, + submit: bool, + platform_version: &PlatformVersion, + ) -> Result<(bool, Option), Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock_through_core + { + 0 => self.verify_chain_lock_through_core_v0(chain_lock, submit, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock_through_core".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs new file mode 100644 index 00000000000..1aa5d4db57b --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -0,0 +1,43 @@ +use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use dpp::dashcore::ChainLock; +use dpp::version::PlatformVersion; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +impl Platform +where + C: CoreRPCLike, +{ + /// Verify the chain lock through core v0 + #[inline(always)] + pub(super) fn verify_chain_lock_through_core_v0( + &self, + chain_lock: &ChainLock, + submit: bool, + platform_version: &PlatformVersion, + ) -> Result<(bool, Option), Error> { + if submit { + let given_chain_lock_height = chain_lock.block_height; + + let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; + Ok(if best_chain_locked_height >= given_chain_lock_height { + (true, Some(CoreSyncStatus::Done)) + } else if best_chain_locked_height - given_chain_lock_height + <= platform_version + .drive_abci + .methods + .core_chain_lock + .recent_block_count_amount + { + (true, Some(CoreSyncStatus::Almost)) + } else { + (true, Some(CoreSyncStatus::Not)) + }) + } else { + Ok((self.core_rpc.verify_chain_lock(chain_lock)?, None)) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/mod.rs new file mode 100644 index 00000000000..87db2f8862d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/mod.rs @@ -0,0 +1,2 @@ +/// Instant Lock recent signature verification +pub mod verify_recent_signature_locally; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/mod.rs new file mode 100644 index 00000000000..e804ad228ef --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/mod.rs @@ -0,0 +1,47 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::dashcore::InstantLock; + +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; + +/// Traits implements a method for signature verification using platform execution state +pub trait VerifyInstantLockSignature { + fn verify_recent_signature_locally( + &self, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl VerifyInstantLockSignature for InstantLock { + /// Verify instant lock signature with limited quorum set what we store in Platform state + /// + /// This is a limited verification and will work properly only for recently signed instant locks. + /// Even valid instant locks that was signed some time ago will be considered invalid due to limited + /// quorum information in the platform state. In turn, this verification doesn't use Core RPC or any other + /// IO. This is done to prevent DoS attacks on slow verify instant lock signature Core RPC method. + /// In case of failed signature verification (or any knowing the fact that signing quorum is old), + /// we expect clients to use ChainAssetLockProof. + fn verify_recent_signature_locally( + &self, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .core_instant_send_lock + .verify_recent_signature_locally + { + 0 => v0::verify_recent_instant_lock_signature_locally_v0(self, platform_state), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "InstantLock.verify_recent_signature_locally".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs new file mode 100644 index 00000000000..335e5cb201c --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs @@ -0,0 +1,152 @@ +use dpp::bls_signatures::G2Element; +use std::fmt::{Debug, Formatter}; + +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; +use dpp::dashcore::InstantLock; + +use crate::error::execution::ExecutionError; +use crate::error::Error; + +use crate::error::serialization::SerializationError; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::signature_verification_quorum_set::{ + SignatureVerificationQuorumSetV0Methods, SIGN_OFFSET, +}; + +#[inline(always)] +pub(super) fn verify_recent_instant_lock_signature_locally_v0( + instant_lock: &InstantLock, + platform_state: &PlatformState, +) -> Result { + // First verify that the signature conforms to a signature + let signature = match G2Element::from_bytes(instant_lock.signature.as_bytes()) { + Ok(signature) => signature, + Err(e) => { + tracing::trace!( + instant_lock = ?InstantLockDebug(instant_lock), + "Invalid instant Lock {} signature format: {}", + instant_lock.txid, + e, + ); + + return Ok(false); + } + }; + + let signing_height = platform_state.last_committed_core_height(); + let verification_height = signing_height.saturating_sub(SIGN_OFFSET); + + let quorum_set = platform_state.instant_lock_validating_quorums(); + + // Based on the deterministic masternode list at the given height, a quorum must be selected + // that was active at the time this block was mined + let selected_quorums = quorum_set.select_quorums(signing_height, verification_height); + + if selected_quorums.is_empty() { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "No quorums selected for instant lock signature verification for specified height", + ))); + }; + + let request_id = instant_lock.request_id().map_err(|e| { + Error::Serialization(SerializationError::CorruptedSerialization(format!( + "can't hash instant lock request ID for signature verification: {e}" + ))) + })?; + + let mut selected_quorums_for_logging = Vec::new(); + if tracing::enabled!(tracing::Level::TRACE) { + selected_quorums_for_logging = Vec::from_iter(selected_quorums.clone()); + } + + for (i, quorums) in selected_quorums.enumerate() { + let Some((quorum_hash, quorum)) = quorums.choose_quorum(request_id.as_ref()) else { + if tracing::enabled!(tracing::Level::TRACE) { + tracing::trace!( + quorums_iteration = i + 1, + selected_quorums = ?selected_quorums_for_logging, + instant_lock = ?InstantLockDebug(instant_lock), + ?quorum_set, + request_id = request_id.to_string(), + quorums = ?quorums.quorums, + request_id = request_id.to_string(), + signing_height, + verification_height, + "No chosen for instant Lock {} request ID {}", + instant_lock.txid, + request_id, + ); + }; + + continue; + }; + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), txId). + // llmqType and quorumHash must be taken from the quorum selected in 1. + let mut engine = sha256d::Hash::engine(); + + let mut reversed_quorum_hash = quorum_hash.to_byte_array().to_vec(); + reversed_quorum_hash.reverse(); + + engine.input(&[quorum_set.config().quorum_type as u8]); + engine.input(reversed_quorum_hash.as_slice()); + engine.input(request_id.as_byte_array()); + engine.input(instant_lock.txid.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + if quorum + .public_key + .verify(&signature, message_digest.as_ref()) + { + return Ok(true); + } + + if tracing::enabled!(tracing::Level::TRACE) { + tracing::trace!( + quorums_iteration = i + 1, + selected_quorums = ?selected_quorums_for_logging, + instant_lock = ?InstantLockDebug(instant_lock), + ?quorum_set, + quorum_hash = quorum_hash.to_string(), + quorum = ?quorum, + request_id = request_id.to_string(), + message_digest = message_digest.to_string(), + signing_height, + verification_height, + "Instant Lock {} signature verification failed", + instant_lock.txid, + ); + }; + } + + Ok(false) +} + +// TODO: The best way is to implement Value trait for InstantLock and hashes +// in dashcore + +/// An additional struct to implement Debug for InstantLock with hex strings +/// instead of byte arrays +struct InstantLockDebug<'a>(&'a InstantLock); + +impl<'a> Debug for InstantLockDebug<'a> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + let instant_lock = &self.0; + f.debug_struct("InstantLock") + .field("version", &instant_lock.version) + .field( + "inputs", + &instant_lock + .inputs + .iter() + .map(|input| input.to_string()) + .collect::>(), + ) + .field("txid", &instant_lock.txid.to_string()) + .field("cyclehash", &instant_lock.cyclehash.to_string()) + .field("signature", &instant_lock.signature.to_string()) + .finish() + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/epoch_core_reward_credits_for_distribution/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/epoch_core_reward_credits_for_distribution/mod.rs deleted file mode 100644 index 5e5aaca2cca..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/epoch_core_reward_credits_for_distribution/mod.rs +++ /dev/null @@ -1,44 +0,0 @@ -mod v0; - -use crate::error::execution::ExecutionError; -use crate::error::Error; - -use crate::platform_types::platform::Platform; - -use dpp::fee::Credits; -use dpp::version::PlatformVersion; - -impl Platform { - /// Gets the amount of core reward fees to be distributed for the Epoch. - /// - /// # Arguments - /// - /// * `epoch_start_block_core_height` - The height of the core block at the start of the epoch. - /// * `next_epoch_start_block_core_height` - The height of the core block at the start of the next epoch. - /// - /// # Returns - /// - /// * `Result` - If the operation is successful, it returns `Ok(Credits)`. If there is an error, it returns `Error`. - pub fn epoch_core_reward_credits_for_distribution( - epoch_start_block_core_height: u32, - next_epoch_start_block_core_height: u32, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .drive_abci - .methods - .core_subsidy - .epoch_core_reward_credits_for_distribution - { - 0 => Self::epoch_core_reward_credits_for_distribution_v0( - epoch_start_block_core_height, - next_epoch_start_block_core_height, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "epoch_core_reward_credits_for_distribution_v0".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/epoch_core_reward_credits_for_distribution/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/epoch_core_reward_credits_for_distribution/v0/mod.rs deleted file mode 100644 index 62ac9a68988..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/epoch_core_reward_credits_for_distribution/v0/mod.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::error::Error; -use crate::execution::platform_events::core_subsidy::{ - CORE_GENESIS_BLOCK_SUBSIDY, CORE_SUBSIDY_HALVING_INTERVAL, -}; -use crate::platform_types::platform::Platform; -use dpp::block::epoch::EpochIndex; -use dpp::fee::Credits; - -use lazy_static::lazy_static; -use std::collections::HashMap; - -lazy_static! { - /// The Core reward halving distribution table for 100 years - /// Yearly decline of production by ~7.1% per year, projected ~18M coins max by year 2050+. - pub static ref CORE_HALVING_DISTRIBUTION: HashMap = { - let mut distribution = CORE_GENESIS_BLOCK_SUBSIDY; - (0..100).map(|i| { - let old_distribution = distribution; - distribution -= distribution / 14; - (i, old_distribution) - }).collect() - }; -} - -impl Platform { - /// Gets the amount of core reward fees to be distributed for the Epoch. - pub(super) fn epoch_core_reward_credits_for_distribution_v0( - epoch_start_block_core_height: u32, - next_epoch_start_block_core_height: u32, - ) -> Result { - // Core is halving block rewards every year so we need to pay - // core block rewards according to halving ratio for the all years during - // the platform epoch payout period (unpaid epoch) - - // Calculate start and end years for the platform epoch payout period - // according to start and end core block heights - let start_core_reward_year = - (epoch_start_block_core_height / CORE_SUBSIDY_HALVING_INTERVAL) as EpochIndex; - let end_core_reward_year = - (next_epoch_start_block_core_height / CORE_SUBSIDY_HALVING_INTERVAL) as EpochIndex; - - let mut total_core_rewards = 0; - - // Calculate block rewards for each core reward year during the platform epoch payout period - for core_reward_year in start_core_reward_year..=end_core_reward_year { - // Calculate the block count per core reward year - - let core_reward_year_start_block = if core_reward_year == end_core_reward_year { - next_epoch_start_block_core_height - } else { - (core_reward_year + 1) as u32 * CORE_SUBSIDY_HALVING_INTERVAL - }; - - let core_reward_year_end_block = if core_reward_year == start_core_reward_year { - epoch_start_block_core_height - } else { - core_reward_year as u32 * CORE_SUBSIDY_HALVING_INTERVAL - }; - - let block_count = core_reward_year_start_block - core_reward_year_end_block; - - // Fetch the core block distribution for the corresponding epoch from the distribution table - // Default to 0 if the core reward year is more than 100 years in the future - let core_block_distribution_ratio = CORE_HALVING_DISTRIBUTION - .get(&core_reward_year) - .unwrap_or(&0); - - // Calculate the core rewards for this epoch and add to the total - total_core_rewards += block_count as Credits * *core_block_distribution_ratio; - } - - Ok(total_core_rewards) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/mod.rs deleted file mode 100644 index 00cce374722..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/core_subsidy/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -mod epoch_core_reward_credits_for_distribution; - -use dpp::fee::Credits; - -/// Actual number of core blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050) -pub const CORE_SUBSIDY_HALVING_INTERVAL: u32 = 210240; - -/// ORIGINAL CORE BLOCK DISTRIBUTION -/// STARTS AT 25 Dash -/// Take 60% for Masternodes -/// Take 37.5% of that for Platform -const CORE_GENESIS_BLOCK_SUBSIDY: Credits = 585000000000; diff --git a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs index b319ac4fb34..57aff29475a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs @@ -4,8 +4,9 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::block_proposal; -use crate::platform_types::epoch_info::v0::EpochInfoV0; +use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; @@ -28,10 +29,27 @@ impl Platform { &self, block_proposal: &block_proposal::v0::BlockProposal, transaction: &Transaction, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { + // !! BE AWARE BEFORE YOU MODIFY THIS CODE !!! + // Please be aware epoch information is gathered with previous platform version + // on epoch change (1st block of the epoch), despite we are switching to a new version + // in this block. Thus, the previous version of EpochInfo might also be used for the first block. + // A new version of this method will be called for the rest of epoch blocks + // and first block of the next epoch. + // This means that if we ever want to update EpochInfo, we will need to do so on a release + // where the new fields of epoch info are not being used. Then make another version once + // that one is activated. match platform_version.drive_abci.methods.epoch.gather_epoch_info { - 0 => self.gather_epoch_info_v0(block_proposal, transaction, platform_version), + 0 => self + .gather_epoch_info_v0( + block_proposal, + transaction, + platform_state, + platform_version, + ) + .map(|v0| v0.into()), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "gather_epoch_info".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs index a64fb5ac28f..81d3ff3d127 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs @@ -6,6 +6,7 @@ use crate::platform_types::block_proposal; use crate::platform_types::epoch_info::v0::EpochInfoV0; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use drive::grovedb::Transaction; impl Platform { @@ -14,12 +15,11 @@ impl Platform { &self, block_proposal: &block_proposal::v0::BlockProposal, transaction: &Transaction, + platform_state: &PlatformState, platform_version: &PlatformVersion, ) -> Result { // Start by getting information from the state - let state = self.state.read().unwrap(); - - let last_block_time_ms = state.last_block_time_ms(); + let last_block_time_ms = platform_state.last_committed_block_time_ms(); // Init block execution context let block_state_info = block_state_info::v0::BlockStateInfoV0::from_block_proposal( @@ -33,6 +33,7 @@ impl Platform { block_time_ms, .. } = &block_proposal; + let genesis_time_ms = self.get_genesis_time(*height, *block_time_ms, transaction, platform_version)?; diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/mod.rs index f9300516078..2145adf36a5 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/mod.rs @@ -9,7 +9,7 @@ use crate::platform_types::platform::Platform; use dpp::block::epoch::Epoch; use dpp::fee::Credits; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; +use drive::util::batch::DriveOperation; use drive::grovedb::TransactionArg; diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/v0/mod.rs index e1641df9af8..52493f0cabb 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/v0/mod.rs @@ -6,10 +6,10 @@ use crate::platform_types::platform::Platform; use dpp::block::epoch::Epoch; use dpp::fee::Credits; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; +use drive::util::batch::DriveOperation; -use drive::fee_pools::epochs::operations_factory::EpochOperations; -use drive::fee_pools::update_storage_fee_distribution_pool_operation; +use drive::drive::credit_pools::epochs::operations_factory::EpochOperations; +use drive::drive::credit_pools::operations::update_storage_fee_distribution_pool_operation; use drive::grovedb::TransactionArg; use drive::{error, grovedb}; @@ -75,13 +75,13 @@ impl Platform { mod tests { use super::*; use dpp::block::block_info::BlockInfo; - use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use crate::test::helpers::setup::TestPlatformBuilder; use crate::execution::types::block_fees; use crate::execution::types::block_fees::v0::BlockFeesV0Methods; - use drive::drive::batch::GroveDbOpBatch; + use drive::util::batch::GroveDbOpBatch; #[test] fn test_distribute_block_fees_into_uncommitted_epoch_on_epoch_change() { @@ -97,7 +97,17 @@ mod tests { let mut inner_batch = GroveDbOpBatch::new(); - current_epoch_tree.add_init_current_operations(1.0, 1, 1, 1, &mut inner_batch); + current_epoch_tree.add_init_current_operations( + platform_version + .fee_version + .uses_version_fee_multiplier_permille + .expect("expected a fee multiplier"), + 1, + 1, + 1, + platform_version.protocol_version, + &mut inner_batch, + ); batch.push(DriveOperation::GroveDBOpBatch(inner_batch)); @@ -126,6 +136,7 @@ mod tests { &BlockInfo::default(), Some(&transaction), platform_version, + None, ) .expect("should apply batch"); @@ -159,7 +170,17 @@ mod tests { let mut batch = GroveDbOpBatch::new(); - current_epoch_tree.add_init_current_operations(1.0, 1, 1, 1, &mut batch); + current_epoch_tree.add_init_current_operations( + platform_version + .fee_version + .uses_version_fee_multiplier_permille + .expect("expected a fee multiplier"), + 1, + 1, + 1, + platform_version.protocol_version, + &mut batch, + ); // Apply new pool structure platform @@ -194,6 +215,7 @@ mod tests { &BlockInfo::default(), Some(&transaction), platform_version, + None, ) .expect("should apply batch"); diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/mod.rs index b675bcd18db..df022d3b7ff 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/mod.rs @@ -7,8 +7,8 @@ use crate::execution::types::storage_fee_distribution_outcome::v0::StorageFeeDis use crate::platform_types::platform::Platform; use dpp::block::epoch::EpochIndex; use dpp::version::PlatformVersion; -use drive::drive::batch::GroveDbOpBatch; use drive::grovedb::TransactionArg; +use drive::util::batch::GroveDbOpBatch; impl Platform { /// This function is a versioned method that adds operations to the GroveDB operation batch. diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/v0/mod.rs index 0085d637088..2773ae01ac2 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_storage_fee_to_epochs_operations/v0/mod.rs @@ -7,8 +7,8 @@ use dpp::fee::epoch::distribution::{ }; use dpp::fee::epoch::SignedCreditsPerEpoch; use dpp::version::PlatformVersion; -use drive::drive::batch::GroveDbOpBatch; use drive::grovedb::TransactionArg; +use drive::util::batch::GroveDbOpBatch; impl Platform { /// Adds operations to the GroveDB op batch which distribute storage fees @@ -59,6 +59,7 @@ impl Platform { batch, credits_per_epochs, transaction, + platform_version, )?; Ok( @@ -84,12 +85,13 @@ mod tests { perpetual_storage_epochs, CreditsPerEpoch, SignedCreditsPerEpoch, GENESIS_EPOCH_INDEX, }; use dpp::fee::Credits; - use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use drive::drive::batch::DriveOperation; - use drive::drive::config::DriveConfig; + + use drive::config::DriveConfig; + use drive::drive::credit_pools::epochs::operations_factory::EpochOperations; + use drive::drive::credit_pools::operations::update_storage_fee_distribution_pool_operation; use drive::drive::Drive; - use drive::fee_pools::epochs::operations_factory::EpochOperations; - use drive::fee_pools::update_storage_fee_distribution_pool_operation; + use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use drive::util::batch::DriveOperation; use crate::test::helpers::setup::TestPlatformBuilder; @@ -196,6 +198,7 @@ mod tests { &BlockInfo::default(), Some(&transaction), platform_version, + None, ) .expect("should apply batch"); diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/mod.rs index d1de76e96df..7c90d35c61e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/mod.rs @@ -7,7 +7,7 @@ use crate::execution::types::proposer_payouts::v0::ProposersPayouts; use crate::platform_types::platform::Platform; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; +use drive::util::batch::DriveOperation; use drive::grovedb::Transaction; diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs index fec5da6a840..47f1f408728 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs @@ -2,13 +2,16 @@ use crate::error::Error; use crate::execution::types::proposer_payouts; use crate::platform_types::platform::Platform; use dpp::block::epoch::Epoch; +use dpp::core_subsidy::epoch_core_reward_credits_for_distribution::epoch_core_reward_credits_for_distribution; +use dpp::core_subsidy::NetworkCoreSubsidy; use dpp::version::PlatformVersion; -use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use drive::drive::batch::{DriveOperation, GroveDbOpBatch, SystemOperationType}; -use drive::fee_pools::epochs::operations_factory::EpochOperations; -use drive::fee_pools::update_unpaid_epoch_index_operation; +use drive::drive::credit_pools::epochs::operations_factory::EpochOperations; +use drive::drive::credit_pools::operations::update_unpaid_epoch_index_operation; +use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use drive::util::batch::{DriveOperation, GroveDbOpBatch, SystemOperationType}; use crate::execution::types::unpaid_epoch::v0::UnpaidEpochV0Getters; + use drive::grovedb::Transaction; impl Platform { @@ -37,10 +40,21 @@ impl Platform { return Ok(None); }; + let start_block_core_height = if unpaid_epoch.epoch_index == 0 { + //On epoch 0 we need to use the activation height instead of the start of the block + self.drive + .fetch_genesis_core_height(Some(transaction), platform_version)? + } else { + // The unpaid epochs start block has had its credits distributed, so we must do a + 1 + // But only if we are not in the first epoch + unpaid_epoch.start_block_core_height + 1 + }; + // Calculate core block reward for the unpaid epoch - let core_block_rewards = Self::epoch_core_reward_credits_for_distribution( - unpaid_epoch.start_block_core_height, + let core_block_rewards = epoch_core_reward_credits_for_distribution( + start_block_core_height, unpaid_epoch.next_epoch_start_block_core_height, + self.config.network.core_subsidy_halving_interval(), platform_version, )?; @@ -52,6 +66,14 @@ impl Platform { }, )); + tracing::info!( + "Core block rewards for epoch {} from height {} to height {} are {}", + unpaid_epoch.epoch_index, + unpaid_epoch.start_block_core_height, + unpaid_epoch.next_epoch_start_block_core_height, + core_block_rewards + ); + let unpaid_epoch = unpaid_epoch.into(); let proposers_paid_count = self.add_epoch_pool_to_proposers_payout_operations( @@ -92,7 +114,7 @@ mod tests { use super::*; use dpp::block::block_info::BlockInfo; - use drive::common::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; + use drive::util::test_helpers::test_utils::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; use crate::test::helpers::setup::TestPlatformBuilder; @@ -131,7 +153,7 @@ mod tests { let platform_version = PlatformVersion::latest(); let platform = TestPlatformBuilder::new() .build_with_mock_rpc() - .set_initial_state_structure(); + .set_genesis_state_with_activation_info(0, 1); let transaction = platform.drive.grove.start_transaction(); // Create masternode reward shares contract @@ -146,7 +168,17 @@ mod tests { let mut batch = GroveDbOpBatch::new(); - unpaid_epoch.add_init_current_operations(1.0, 1, 1, 1, &mut batch); + unpaid_epoch.add_init_current_operations( + platform_version + .fee_version + .uses_version_fee_multiplier_permille + .expect("expected a fee multiplier"), + 1, + 1, + 1, + platform_version.protocol_version, + &mut batch, + ); batch.push( unpaid_epoch @@ -161,10 +193,14 @@ mod tests { ); current_epoch.add_init_current_operations( - 1.0, + platform_version + .fee_version + .uses_version_fee_multiplier_permille + .expect("expected a fee multiplier"), proposers_count as u64 + 1, 3, 2, + platform_version.protocol_version, &mut batch, ); @@ -203,6 +239,7 @@ mod tests { &BlockInfo::default(), Some(&transaction), platform_version, + None, ) .expect("should apply batch"); @@ -216,7 +253,7 @@ mod tests { let next_unpaid_epoch_index = platform .drive - .get_unpaid_epoch_index_v0(Some(&transaction)) + .get_unpaid_epoch_index(Some(&transaction), platform_version) .expect("should get unpaid epoch index"); assert_eq!(next_unpaid_epoch_index, current_epoch.index); diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/mod.rs index 3c4ed23591e..99359266920 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/mod.rs @@ -2,10 +2,12 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::unpaid_epoch::UnpaidEpoch; use crate::platform_types::platform::Platform; + use dpp::fee::Credits; + use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; mod v0; diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs index 0c7a65f0a74..15709631b66 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs @@ -9,11 +9,12 @@ use dpp::block::epoch::Epoch; use dpp::document::DocumentV0Getters; use dpp::fee::Credits; use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; + use dpp::version::PlatformVersion; use dpp::ProtocolError; -use drive::drive::batch::DriveOperation; -use drive::drive::batch::DriveOperation::IdentityOperation; -use drive::drive::batch::IdentityOperationType::AddToIdentityBalance; +use drive::util::batch::DriveOperation; +use drive::util::batch::DriveOperation::IdentityOperation; +use drive::util::batch::IdentityOperationType::AddToIdentityBalance; use drive::grovedb::Transaction; @@ -65,6 +66,17 @@ impl Platform { let proposers_len = proposers.len() as u16; + tracing::trace!( + unpaid_block_count = unpaid_epoch_block_count, + unpaid_epoch_index = unpaid_epoch.epoch_index(), + fees = storage_and_processing_fees, + core_block_rewards, + total_payouts, + "Pay {total_payouts} credits to {proposers_len} proposers for {} proposed blocks in epoch {}", + unpaid_epoch_block_count, + unpaid_epoch.epoch_index(), + ); + for (i, (proposer_tx_hash, proposed_block_count)) in proposers.into_iter().enumerate() { let i = i as u16; @@ -163,6 +175,7 @@ impl Platform { #[cfg(test)] mod tests { use super::*; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; mod add_epoch_pool_to_proposers_payout_operations { use super::*; @@ -174,10 +187,11 @@ mod tests { use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; - use drive::common::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; - use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use drive::drive::batch::GroveDbOpBatch; - use drive::fee_pools::epochs::operations_factory::EpochOperations; + + use drive::drive::credit_pools::epochs::operations_factory::EpochOperations; + use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use drive::util::batch::GroveDbOpBatch; + use drive::util::test_helpers::test_utils::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; use rust_decimal::Decimal; use rust_decimal_macros::dec; @@ -187,7 +201,7 @@ mod tests { .build_with_mock_rpc() .set_initial_state_structure(); - let platform_read_guard = platform.state.read().unwrap(); + let platform_read_guard = platform.state.load(); let platform_version = platform_read_guard .current_platform_version() .expect("platform_version"); @@ -205,7 +219,17 @@ mod tests { let mut batch = GroveDbOpBatch::new(); - unpaid_epoch_tree.add_init_current_operations(1.0, 1, 1, 1, &mut batch); + unpaid_epoch_tree.add_init_current_operations( + platform_version + .fee_version + .uses_version_fee_multiplier_permille + .expect("expected a fee multiplier"), + 1, + 1, + 1, + platform_version.protocol_version, + &mut batch, + ); batch.push( unpaid_epoch_tree @@ -220,10 +244,14 @@ mod tests { ); next_epoch_tree.add_init_current_operations( - 1.0, + platform_version + .fee_version + .uses_version_fee_multiplier_permille + .expect("expected a fee multiplier"), proposers_count as u64 + 1, 1, 10, + platform_version.protocol_version, &mut batch, ); @@ -281,6 +309,7 @@ mod tests { &BlockInfo::default(), Some(&transaction), platform_version, + None, ) .expect("should apply batch"); @@ -289,7 +318,7 @@ mod tests { // check we paid 500 to every mn identity let paid_mn_identities_balances = platform .drive - .fetch_identities_balances(&pro_tx_hashes, Some(&transaction)) + .fetch_identities_balances(&pro_tx_hashes, Some(&transaction), platform_version) .expect("expected to get identities"); let total_fees = Decimal::from(storage_fees + processing_fees); @@ -319,7 +348,7 @@ mod tests { let refetched_share_identities_balances = platform .drive - .fetch_identities_balances(&share_identities, Some(&transaction)) + .fetch_identities_balances(&share_identities, Some(&transaction), platform_version) .expect("expected to get identities"); for (_, balance) in refetched_share_identities_balances { diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs index 6dd0da06831..2cabe4862f0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs @@ -4,7 +4,7 @@ use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; -use drive::drive::flags::StorageFlags; +use drive::util::storage_flags::StorageFlags; use drive::grovedb::TransactionArg; @@ -20,11 +20,9 @@ impl Platform { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> DataContract { - let contract = load_system_data_contract( - SystemDataContract::MasternodeRewards, - platform_version.protocol_version, - ) - .expect("should load masternode reward contract"); + let contract = + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) + .expect("should load masternode reward contract"); let storage_flags = Some(Cow::Owned(StorageFlags::SingleEpoch(0))); diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs index 6f84e0799f6..c2174873406 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs @@ -15,12 +15,13 @@ use dpp::platform_value::Value; use drive::dpp::document::Document; use drive::grovedb::TransactionArg; -use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; +use drive::query::{DriveDocumentQuery, InternalClauses, WhereClause, WhereOperator}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::version::PlatformVersion; -use drive::drive::document::query::{QueryDocumentsOutcomeV0Methods}; +use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use std::collections::BTreeMap; -use dpp::data_contract::accessors::v0::DataContractV0Getters; + use crate::execution::platform_events::fee_pool_outwards_distribution::fetch_reward_shares_list_for_masternode::MN_REWARD_SHARES_DOCUMENT_TYPE; impl Platform { @@ -31,14 +32,17 @@ impl Platform { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - let document_type = self + let masternode_rewards_contract = self .drive - .system_contracts - .masternode_rewards - .document_type_for_name(MN_REWARD_SHARES_DOCUMENT_TYPE)?; + .cache + .system_data_contracts + .load_masternode_reward_shares(); + + let document_type = + masternode_rewards_contract.document_type_for_name(MN_REWARD_SHARES_DOCUMENT_TYPE)?; - let drive_query = DriveQuery { - contract: &self.drive.system_contracts.masternode_rewards, + let drive_query = DriveDocumentQuery { + contract: &masternode_rewards_contract, document_type, internal_clauses: InternalClauses { primary_key_in_clause: None, diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs index 3027934ef5c..56278173b73 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs @@ -25,7 +25,9 @@ impl Platform { return Ok(None); } - let unpaid_epoch_index = self.drive.get_unpaid_epoch_index_v0(transaction)?; + let unpaid_epoch_index = self + .drive + .get_unpaid_epoch_index(transaction, platform_version)?; // We pay for previous epochs only if unpaid_epoch_index == current_epoch_index { @@ -130,10 +132,10 @@ mod tests { mod find_oldest_epoch_needing_payment { use crate::execution::types::unpaid_epoch::v0::UnpaidEpochV0Methods; use crate::test::helpers::setup::TestPlatformBuilder; - use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use drive::drive::batch::GroveDbOpBatch; - use drive::fee_pools::epochs::operations_factory::EpochOperations; - use drive::fee_pools::update_unpaid_epoch_index_operation; + use drive::drive::credit_pools::epochs::operations_factory::EpochOperations; + use drive::drive::credit_pools::operations::update_unpaid_epoch_index_operation; + use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use drive::util::batch::GroveDbOpBatch; use super::*; diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/mod.rs deleted file mode 100644 index 5ee1549005f..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::document::Document; -use dpp::identifier::Identifier; -use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; -use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use drive::grovedb::TransactionArg; -use std::collections::HashMap; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Builds a list of Core transactions from withdrawal documents. This function is a version handler that - /// directs to specific version implementations of the `build_withdrawal_transactions_from_documents` function. - /// - /// # Arguments - /// - /// * `documents` - A slice of `Document`. - /// * `drive_operation_types` - A mutable reference to `Vec`. - /// * `transaction` - A `TransactionArg` reference. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result, Error>` - Returns a HashMap containing withdrawal transactions if found, otherwise returns an `Error`. - pub(in crate::execution::platform_events::identity_credit_withdrawal) fn build_withdrawal_transactions_from_documents( - &self, - documents: &[Document], - drive_operation_types: &mut Vec, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .build_withdrawal_transactions_from_documents - { - 0 => self.build_withdrawal_transactions_from_documents_v0( - documents, - drive_operation_types, - transaction, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "build_withdrawal_transactions_from_documents".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/v0/mod.rs deleted file mode 100644 index 09b1c48c78f..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/v0/mod.rs +++ /dev/null @@ -1,266 +0,0 @@ -use std::collections::HashMap; - -use dashcore_rpc::dashcore::{ - blockdata::transaction::special_transaction::asset_unlock::unqualified_asset_unlock::{ - AssetUnlockBasePayload, AssetUnlockBaseTransactionInfo, - }, - consensus::Encodable, - ScriptBuf, TxOut, -}; -use dpp::document::{Document, DocumentV0Getters}; -use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - -use drive::dpp::identifier::Identifier; -use drive::dpp::identity::convert_credits_to_duffs; -use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use drive::{drive::batch::DriveOperation, query::TransactionArg}; - -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -impl Platform -where - C: CoreRPCLike, -{ - /// Build list of Core transactions from withdrawal documents - pub(super) fn build_withdrawal_transactions_from_documents_v0( - &self, - documents: &[Document], - drive_operation_types: &mut Vec, - transaction: TransactionArg, - ) -> Result, Error> { - let mut withdrawals: HashMap = HashMap::new(); - - let latest_withdrawal_index = self - .drive - .fetch_and_remove_latest_withdrawal_transaction_index_operations( - drive_operation_types, - transaction, - )?; - - for (i, document) in documents.iter().enumerate() { - let output_script_bytes = document - .properties() - .get_bytes(withdrawal::properties::OUTPUT_SCRIPT) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't get outputScript from withdrawal document", - )) - })?; - - let amount = document - .properties() - .get_integer(withdrawal::properties::AMOUNT) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't get amount from withdrawal document", - )) - })?; - - let core_fee_per_byte: u32 = document - .properties() - .get_integer(withdrawal::properties::CORE_FEE_PER_BYTE) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't get coreFeePerByte from withdrawal document", - )) - })?; - - let state_transition_size = 190; - - let output_script = ScriptBuf::from_bytes(output_script_bytes); - - let tx_out = TxOut { - value: convert_credits_to_duffs(amount)?, - script_pubkey: output_script, - }; - - let transaction_index = latest_withdrawal_index + i as u64; - - let withdrawal_transaction = AssetUnlockBaseTransactionInfo { - version: 1, - lock_time: 0, - output: vec![tx_out], - base_payload: AssetUnlockBasePayload { - version: 1, - index: transaction_index, - fee: (state_transition_size * core_fee_per_byte * 1000), - }, - }; - - let mut transaction_buffer: Vec = vec![]; - - withdrawal_transaction - .consensus_encode(&mut transaction_buffer) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't consensus encode a withdrawal transaction", - )) - })?; - - withdrawals.insert( - document.id(), - (transaction_index.to_be_bytes().to_vec(), transaction_buffer), - ); - } - - Ok(withdrawals) - } -} - -#[cfg(test)] -mod tests { - - use dpp::withdrawal::Pooling; - use dpp::{ - data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, - }; - use drive::tests::helpers::setup::setup_document; - - mod build_withdrawal_transactions_from_documents { - use dpp::block::block_info::BlockInfo; - - use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::data_contracts::withdrawals_contract::document_types::withdrawal; - use dpp::identity::core_script::CoreScript; - use dpp::platform_value::platform_value; - use dpp::prelude::Identifier; - use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; - use dpp::version::PlatformVersion; - use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; - use drive::tests::helpers::setup::setup_system_data_contract; - use itertools::Itertools; - - use crate::test::helpers::setup::TestPlatformBuilder; - - use super::*; - - #[test] - fn test_build() { - let platform_version = PlatformVersion::latest(); - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let transaction = platform.drive.grove.start_transaction(); - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); - - let owner_id = Identifier::new([1u8; 32]); - - let document_1 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, - "transactionIndex": 1u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &platform.drive, - &document_1, - &data_contract, - document_type, - Some(&transaction), - ); - - let document_2 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, - "transactionIndex": 2u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - setup_document( - &platform.drive, - &document_2, - &data_contract, - document_type, - Some(&transaction), - ); - - let documents = vec![document_1, document_2]; - - let mut batch = vec![]; - - let transactions = platform - .build_withdrawal_transactions_from_documents_v0( - &documents, - &mut batch, - Some(&transaction), - ) - .expect("to build transactions from documents"); - - platform - .drive - .apply_drive_operations( - batch, - true, - &BlockInfo::default(), - Some(&transaction), - platform_version, - ) - .expect("to apply drive op batch"); - - assert_eq!( - transactions - .values() - .cloned() - .sorted() - .collect::>(), - vec![ - ( - vec![0, 0, 0, 0, 0, 0, 0, 0], - vec![ - 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 48, 230, 2, 0 - ], - ), - ( - vec![0, 0, 0, 0, 0, 0, 0, 1], - vec![ - 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 48, 230, 2, 0 - ], - ), - ] - .into_iter() - .sorted() - .collect::>(), - ); - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/mod.rs deleted file mode 100644 index aa0430c75fe..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/mod.rs +++ /dev/null @@ -1,55 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Prepares a list of an unsigned withdrawal transaction bytes. This function is a version handler that - /// directs to specific version implementations of the `fetch_and_prepare_unsigned_withdrawal_transactions` function. - /// - /// # Arguments - /// - /// * `validator_set_quorum_hash` - A byte array. - /// * `block_execution_context` - A `BlockExecutionContext` reference. - /// * `transaction` - A `Transaction` reference. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result>, Error>` - Returns a Vector of unsigned withdrawal transactions if found, otherwise returns an `Error`. - pub(in crate::execution) fn fetch_and_prepare_unsigned_withdrawal_transactions( - &self, - validator_set_quorum_hash: [u8; 32], - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .fetch_and_prepare_unsigned_withdrawal_transactions - { - 0 => self.fetch_and_prepare_unsigned_withdrawal_transactions_v0( - validator_set_quorum_hash, - block_execution_context, - transaction, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "fetch_and_prepare_unsigned_withdrawal_transactions".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/v0/mod.rs deleted file mode 100644 index f388172b268..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/v0/mod.rs +++ /dev/null @@ -1,168 +0,0 @@ -use dashcore_rpc::dashcore::{ - blockdata::transaction::special_transaction::asset_unlock::request_info::AssetUnlockRequestInfo, - hashes::Hash, QuorumHash, -}; -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::document_methods::DocumentMethodsV0; -use dpp::document::{Document, DocumentV0Setters}; -use dpp::version::PlatformVersion; - -use drive::dpp::system_data_contracts::withdrawals_contract; -use drive::dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - -use drive::dpp::util::hash; - -use drive::drive::batch::DriveOperation; -use drive::grovedb::Transaction; - -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -const WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT: u16 = 16; - -impl Platform -where - C: CoreRPCLike, -{ - /// Prepares a list of an unsigned withdrawal transaction bytes - pub(super) fn fetch_and_prepare_unsigned_withdrawal_transactions_v0( - &self, - validator_set_quorum_hash: [u8; 32], - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let block_info = BlockInfo { - time_ms: block_execution_context.block_state_info().block_time_ms(), - height: block_execution_context.block_state_info().height(), - core_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - epoch: Epoch::new(block_execution_context.epoch_info().current_epoch_index())?, - }; - - let data_contract_id = withdrawals_contract::ID; - - let (_, Some(contract_fetch_info)) = self.drive.get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - Some(transaction), - platform_version, - )? - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "can't fetch withdrawal data contract", - ))); - }; - - let mut drive_operations: Vec = vec![]; - - // Get 16 latest withdrawal transactions from the queue - let untied_withdrawal_transactions = self.drive.dequeue_withdrawal_transactions( - WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT, - Some(transaction), - &mut drive_operations, - )?; - - if untied_withdrawal_transactions.is_empty() { - return Ok(Vec::new()); - } - - // Appending request_height and quorum_hash to withdrawal transaction - // and pass it to JS Drive for singing and broadcasting - let (unsigned_withdrawal_transactions, documents_to_update): (Vec<_>, Vec<_>) = - untied_withdrawal_transactions - .into_iter() - .map(|(_, untied_transaction_bytes)| { - let request_info = AssetUnlockRequestInfo { - request_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - quorum_hash: QuorumHash::hash(&validator_set_quorum_hash), - }; - - let mut unsigned_transaction_bytes = vec![]; - - request_info - .consensus_append_to_base_encode( - untied_transaction_bytes.clone(), - &mut unsigned_transaction_bytes, - ) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "could not add additional request info to asset unlock transaction", - )) - })?; - - let original_transaction_id = hash::hash_to_vec(untied_transaction_bytes); - let update_transaction_id = - hash::hash_to_vec(unsigned_transaction_bytes.clone()); - - let mut document = self.drive.find_withdrawal_document_by_transaction_id( - &original_transaction_id, - Some(transaction), - platform_version, - )?; - - document.set_bytes( - withdrawal::properties::TRANSACTION_ID, - update_transaction_id, - ); - - document.set_i64( - withdrawal::properties::UPDATED_AT, - block_info.time_ms.try_into().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't convert u64 block time to i64 updated_at", - )) - })?, - ); - - document.increment_revision().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Could not increment document revision", - )) - })?; - - Ok((unsigned_transaction_bytes, document)) - }) - .collect::, Document)>, Error>>()? - .into_iter() - .unzip(); - - self.drive.add_update_multiple_documents_operations( - &documents_to_update, - &contract_fetch_info.contract, - contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "could not get document type", - )) - })?, - &mut drive_operations, - &platform_version.drive, - )?; - - self.drive.apply_drive_operations( - drive_operations, - true, - &block_info, - Some(transaction), - platform_version, - )?; - - Ok(unsigned_withdrawal_transactions) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/mod.rs deleted file mode 100644 index a63d7ae4f5f..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/mod.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::identifier::Identifier; -use dpp::version::PlatformVersion; -use std::collections::BTreeMap; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Fetch Core transactions by range of Core heights. This function is a version handler that - /// directs to specific version implementations of the `fetch_transactions_block_inclusion_status` function. - /// - /// # Arguments - /// - /// * `current_chain_locked_core_height` - The current chain locked core height - /// * `transactions` - A list of transactions to fetch. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result, Error>` - Returns a Vector of transaction hashes if found, otherwise returns an `Error`. - pub(in crate::execution::platform_events::identity_credit_withdrawal) fn fetch_transactions_block_inclusion_status( - &self, - current_chain_locked_core_height: u32, - transaction_identifiers: Vec<[u8; 32]>, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .fetch_transactions_block_inclusion_status - { - 0 => self.fetch_transactions_block_inclusion_status_v0( - current_chain_locked_core_height, - transaction_identifiers, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "fetch_transactions_block_inclusion_status".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/v0/mod.rs deleted file mode 100644 index 6363d8d3d6a..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/v0/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -use dpp::dashcore::hashes::Hash; -use dpp::dashcore::Txid; -use dpp::prelude::Identifier; -use std::collections::BTreeMap; - -use crate::{error::Error, platform_types::platform::Platform, rpc::core::CoreRPCLike}; - -impl Platform -where - C: CoreRPCLike, -{ - /// Fetch Core transactions by range of Core heights - pub(super) fn fetch_transactions_block_inclusion_status_v0( - &self, - current_chain_locked_core_height: u32, - transaction_identifiers: Vec<[u8; 32]>, - ) -> Result, Error> { - let tx_ids: Vec = transaction_identifiers - .iter() - .map(|transaction_id| Txid::from_byte_array(*transaction_id)) - .collect(); - let transactions_are_chain_locked_result = - self.core_rpc.get_transactions_are_chain_locked(tx_ids)?; - - Ok(transactions_are_chain_locked_result - .into_iter() - .zip(transaction_identifiers) - .map(|(lock_result, identifier)| { - let Some(mined_height) = lock_result.height else { - return (identifier, false); - }; - let withdrawal_chain_locked = - lock_result.chain_lock && current_chain_locked_core_height >= mined_height; - (identifier, withdrawal_chain_locked) - }) - .collect()) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/mod.rs deleted file mode 100644 index 60843ec380d..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub(in crate::execution) mod build_withdrawal_transactions_from_documents; -pub(in crate::execution) mod fetch_and_prepare_unsigned_withdrawal_transactions; -mod fetch_transactions_block_inclusion_status; -pub(in crate::execution) mod pool_withdrawals_into_transactions_queue; -pub(in crate::execution) mod update_broadcasted_withdrawal_transaction_statuses; diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/mod.rs deleted file mode 100644 index fded57be054..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Pool withdrawal documents into transactions. This function is a version handler that - /// directs to specific version implementations of the `pool_withdrawals_into_transactions_queue` function. - /// - /// # Arguments - /// - /// * `block_execution_context` - A `BlockExecutionContext` reference that provides context for block execution. - /// * `transaction` - A `Transaction` reference representing the current transaction. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns `Ok(())` if successful, otherwise returns an `Error`. - pub(in crate::execution) fn pool_withdrawals_into_transactions_queue( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .pool_withdrawals_into_transactions_queue - { - 0 => self.pool_withdrawals_into_transactions_queue_v0( - block_execution_context, - transaction, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "pool_withdrawals_into_transactions_queue".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs deleted file mode 100644 index 139820ec9ac..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs +++ /dev/null @@ -1,321 +0,0 @@ -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::document_methods::DocumentMethodsV0; -use dpp::document::{DocumentV0Getters, DocumentV0Setters}; -use dpp::version::PlatformVersion; - -use drive::dpp::util::hash; -use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use drive::grovedb::Transaction; - -use dpp::system_data_contracts::withdrawals_contract; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -impl Platform -where - C: CoreRPCLike, -{ - /// Pool withdrawal documents into transactions - pub(super) fn pool_withdrawals_into_transactions_queue_v0( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - let block_info = BlockInfo { - time_ms: block_execution_context.block_state_info().block_time_ms(), - height: block_execution_context.block_state_info().height(), - core_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - epoch: Epoch::new(block_execution_context.epoch_info().current_epoch_index())?, - }; - - let data_contract_id = withdrawals_contract::ID; - - let (_, Some(contract_fetch_info)) = self.drive.get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - Some(transaction), - platform_version, - )? - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "can't fetch withdrawal data contract", - ))); - }; - - let mut documents = self.drive.fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::QUEUED.into(), - Some(transaction), - platform_version, - )?; - - if documents.is_empty() { - return Ok(()); - } - - let mut drive_operations = vec![]; - - let withdrawal_transactions = self.build_withdrawal_transactions_from_documents( - &documents, - &mut drive_operations, - Some(transaction), - platform_version, - )?; - - for document in documents.iter_mut() { - let Some((_, transaction_bytes)) = withdrawal_transactions.get(&document.id()) else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "transactions must contain a transaction", - ))); - }; - - let transaction_id = hash::hash_to_vec(transaction_bytes); - - document.set_bytes( - withdrawal::properties::TRANSACTION_ID, - transaction_id.clone(), - ); - - document.set_u8( - withdrawal::properties::STATUS, - withdrawals_contract::WithdrawalStatus::POOLED as u8, - ); - - document.set_i64( - withdrawal::properties::UPDATED_AT, - block_info.time_ms.try_into().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't convert u64 block time to i64 updated_at", - )) - })?, - ); - - document.increment_revision().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Could not increment document revision", - )) - })?; - } - - self.drive.add_update_multiple_documents_operations( - &documents, - &contract_fetch_info.contract, - contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't fetch withdrawal data contract", - )) - })?, - &mut drive_operations, - &platform_version.drive, - )?; - - let withdrawal_transactions: Vec = - withdrawal_transactions.values().cloned().collect(); - - self.drive.add_enqueue_withdrawal_transaction_operations( - &withdrawal_transactions, - &mut drive_operations, - ); - - self.drive.apply_drive_operations( - drive_operations, - true, - &block_info, - Some(transaction), - platform_version, - )?; - - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use dashcore_rpc::dashcore::QuorumHash; - use dpp::dashcore::hashes::Hash; - - use dpp::data_contracts::SystemDataContract; - use dpp::identifier::Identifier; - use dpp::identity::core_script::CoreScript; - use dpp::tests::fixtures::get_withdrawal_document_fixture; - use dpp::withdrawal::Pooling; - use drive::tests::helpers::setup::{setup_document, setup_system_data_contract}; - - use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; - use crate::execution::types::block_state_info::v0::BlockStateInfoV0; - use crate::platform_types::epoch_info::v0::EpochInfoV0; - use crate::platform_types::platform_state::v0::PlatformStateV0; - use crate::test::helpers::setup::TestPlatformBuilder; - use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; - use dpp::platform_value::platform_value; - use dpp::system_data_contracts::load_system_data_contract; - use dpp::version::PlatformVersion; - - #[test] - fn test_pooling() { - let platform_version = PlatformVersion::latest(); - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let transaction = platform.drive.grove.start_transaction(); - - platform.block_execution_context.write().unwrap().replace( - BlockExecutionContextV0 { - block_state_info: BlockStateInfoV0 { - height: 1, - round: 0, - block_time_ms: 1, - previous_block_time_ms: Some(1), - proposer_pro_tx_hash: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, - ], - core_chain_locked_height: 96, - block_hash: None, - app_hash: None, - } - .into(), - epoch_info: EpochInfoV0 { - current_epoch_index: 1, - previous_epoch_index: None, - is_epoch_change: false, - } - .into(), - hpmn_count: 100, - withdrawal_transactions: Default::default(), - block_platform_state: PlatformStateV0 { - last_committed_block_info: None, - current_protocol_version_in_consensus: 0, - next_epoch_protocol_version: 0, - current_validator_set_quorum_hash: QuorumHash::all_zeros(), - next_validator_set_quorum_hash: None, - validator_sets: Default::default(), - full_masternode_list: Default::default(), - hpmn_masternode_list: Default::default(), - genesis_block_info: None, - } - .into(), - proposer_results: None, - } - .into(), - ); - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); - - let owner_id = Identifier::new([1u8; 32]); - - let document_1 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, - "transactionIndex": 1u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &platform.drive, - &document_1, - &data_contract, - document_type, - Some(&transaction), - ); - - let document_2 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, - "transactionIndex": 2u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - setup_document( - &platform.drive, - &document_2, - &data_contract, - document_type, - Some(&transaction), - ); - - let guarded_block_execution_context = platform.block_execution_context.write().unwrap(); - let block_execution_context = guarded_block_execution_context.as_ref().unwrap(); - platform - .pool_withdrawals_into_transactions_queue_v0( - block_execution_context, - &transaction, - platform_version, - ) - .expect("to pool withdrawal documents into transactions"); - - let updated_documents = platform - .drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::POOLED.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch withdrawal documents"); - - let tx_ids = [ - "4b74f91644215904ff1aa4122b204ba674aea74d99a17c03fbda483692bf735b", - "897ec16cb13d802ee6acdaf55274c59f3509a4929d726bab919a962ed4a8703c", - ]; - - for document in updated_documents { - assert_eq!(document.revision(), Some(2)); - - let tx_id: Vec = document - .properties() - .get_bytes("transactionId") - .expect("to get transactionId"); - - let tx_id_hex = hex::encode(tx_id); - - assert!(tx_ids.contains(&tx_id_hex.as_str())); - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/mod.rs deleted file mode 100644 index d764c5a33ce..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/mod.rs +++ /dev/null @@ -1,62 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Update statuses for broadcasted withdrawals - /// - /// This method is responsible for updating the status of withdrawal transactions that have been broadcasted. - /// This is done based on the height of the last synced core block, which helps in determining whether the withdrawal - /// transaction has been completed or expired. - /// - /// # Arguments - /// - /// * `block_execution_context` - Contextual information about the current block execution. - /// * `transaction` - A transaction argument to interact with the underlying storage. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns an Ok(()) if the statuses are successfully updated. - /// Otherwise, it returns an Error. - /// - /// # Errors - /// - /// This function may return an error if any of the following conditions are met: - /// - /// * There is an issue interacting with the underlying storage. - /// * There is an error fetching the withdrawal data contract. - /// * There is an error getting the transactionId or transactionSignHeight from the withdrawal document. - pub fn update_broadcasted_withdrawal_transaction_statuses( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .update_broadcasted_withdrawal_transaction_statuses - { - 0 => self.update_broadcasted_withdrawal_transaction_statuses_v0( - block_execution_context, - transaction, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "update_broadcasted_withdrawal_transaction_statuses".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs deleted file mode 100644 index b5ebb9f46fd..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs +++ /dev/null @@ -1,469 +0,0 @@ -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contracts::withdrawals_contract::WithdrawalStatus; -use dpp::document::document_methods::DocumentMethodsV0; -use dpp::document::{Document, DocumentV0Getters, DocumentV0Setters}; -use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; -use dpp::platform_value::Bytes32; -use dpp::prelude::Identifier; -use dpp::system_data_contracts::withdrawals_contract; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; -use dpp::version::PlatformVersion; -use std::collections::BTreeMap; - -use drive::drive::batch::DriveOperation; -use drive::grovedb::Transaction; - -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -const NUMBER_OF_BLOCKS_BEFORE_EXPIRED: u32 = 48; - -impl Platform -where - C: CoreRPCLike, -{ - /// Update statuses for broadcasted withdrawals - pub(super) fn update_broadcasted_withdrawal_transaction_statuses_v0( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - let block_info = BlockInfo { - time_ms: block_execution_context.block_state_info().block_time_ms(), - height: block_execution_context.block_state_info().height(), - core_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - epoch: Epoch::new(block_execution_context.epoch_info().current_epoch_index())?, - }; - - let data_contract_id = withdrawals_contract::ID; - - let (_, Some(contract_fetch_info)) = self.drive.get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - Some(transaction), - platform_version, - )? - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "can't fetch withdrawal data contract", - ))); - }; - - let broadcasted_withdrawal_documents = self.drive.fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::BROADCASTED.into(), - Some(transaction), - platform_version, - )?; - - // Collecting only documents that have been updated - let transactions_to_check: Vec<[u8; 32]> = broadcasted_withdrawal_documents - .iter() - .map(|document| { - document - .properties() - .get_hash256_bytes(withdrawal::properties::TRANSACTION_ID) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transactionId from withdrawal document".to_string(), - )) - }) - }) - .collect::, Error>>()?; - - let core_transactions_statuses = if transactions_to_check.is_empty() { - BTreeMap::new() - } else { - self.fetch_transactions_block_inclusion_status( - block_execution_context - .block_state_info() - .core_chain_locked_height(), - transactions_to_check, - platform_version, - )? - }; - - let mut drive_operations: Vec = vec![]; - - // Collecting only documents that have been updated - let documents_to_update: Vec = broadcasted_withdrawal_documents - .into_iter() - .map(|mut document| { - let transaction_sign_height: u32 = document - .properties() - .get_optional_integer(withdrawal::properties::TRANSACTION_SIGN_HEIGHT)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transactionSignHeight from withdrawal document".to_string(), - )))?; - - let transaction_id = document - .properties() - .get_optional_hash256_bytes(withdrawal::properties::TRANSACTION_ID)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transactionId from withdrawal document".to_string(), - )))?; - - let transaction_index = document - .properties() - .get_optional_integer(withdrawal::properties::TRANSACTION_INDEX)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transaction index from withdrawal document".to_string(), - )))?; - - let current_status: WithdrawalStatus = document - .properties() - .get_optional_integer::(withdrawal::properties::STATUS)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transaction index from withdrawal document".to_string(), - )))? - .try_into() - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedDriveResponse( - "Withdrawal status unknown".to_string(), - )) - })?; - - let block_height_difference = block_execution_context - .block_state_info() - .core_chain_locked_height() - - transaction_sign_height; - - let is_chain_locked = - *core_transactions_statuses - .get(&transaction_id) - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "we should always have a withdrawal status", - )))?; - - let mut status = current_status; - - if is_chain_locked { - status = WithdrawalStatus::COMPLETE; - } else if block_height_difference > NUMBER_OF_BLOCKS_BEFORE_EXPIRED { - status = WithdrawalStatus::EXPIRED; - } else { - // todo: there could be a problem here where we always get the same withdrawals - // and don't cycle them most likely when we query withdrawals - return Ok(None); - } - - document.set_u8(withdrawal::properties::STATUS, status.into()); - - document.set_u64(withdrawal::properties::UPDATED_AT, block_info.time_ms); - - document.increment_revision().map_err(Error::Protocol)?; - - if status == WithdrawalStatus::EXPIRED { - self.drive.add_insert_expired_index_operation( - transaction_index, - &mut drive_operations, - ); - } - - Ok(Some(document)) - }) - .collect::>, Error>>()? - .into_iter() - .flatten() - .collect(); - - self.drive.add_update_multiple_documents_operations( - &documents_to_update, - &contract_fetch_info.contract, - contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't fetch withdrawal data contract", - )) - })?, - &mut drive_operations, - &platform_version.drive, - )?; - - self.drive.apply_drive_operations( - drive_operations, - true, - &block_info, - Some(transaction), - platform_version, - )?; - - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use dashcore_rpc::dashcore::{hashes::hex::FromHex, BlockHash, QuorumHash}; - use dashcore_rpc::dashcore_rpc_json::GetTransactionLockedResult; - use dpp::{ - data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, - }; - use drive::tests::helpers::setup::setup_document; - use serde_json::json; - use std::str::FromStr; - - use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; - use crate::execution::types::block_state_info::v0::BlockStateInfoV0; - use crate::platform_types::epoch_info::v0::EpochInfoV0; - use crate::platform_types::platform_state::v0::PlatformStateV0; - use crate::rpc::core::MockCoreRPCLike; - use crate::test::helpers::setup::TestPlatformBuilder; - - use dpp::data_contract::accessors::v0::DataContractV0Getters; - - use dpp::document::DocumentV0Getters; - use dpp::identity::core_script::CoreScript; - use dpp::platform_value::platform_value; - - use crate::platform_types::platform::Platform; - use dpp::dashcore::hashes::Hash; - use dpp::dashcore::Txid; - use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - use dpp::version::PlatformVersion; - use dpp::withdrawal::Pooling; - use dpp::{ - prelude::Identifier, - system_data_contracts::{load_system_data_contract, SystemDataContract}, - }; - use drive::tests::helpers::setup::setup_system_data_contract; - - #[test] - fn test_statuses_are_updated() { - let platform_version = PlatformVersion::latest(); - let mut platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut mock_rpc_client = MockCoreRPCLike::new(); - - mock_rpc_client - .expect_get_transactions_are_chain_locked() - .returning(move |tx_ids: Vec| { - Ok(tx_ids - .into_iter() - .map(|tx_id| { - if tx_id.to_byte_array() - == [ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - ] - { - GetTransactionLockedResult { - height: Some(93), - chain_lock: true, - } - } else { - GetTransactionLockedResult { - height: None, - chain_lock: false, - } - } - }) - .collect()) - }); - - mock_rpc_client - .expect_get_block_hash() - .withf(|height| *height == 95) - .returning(|_| { - Ok(BlockHash::from_str( - "0000000000000000000000000000000000000000000000000000000000000000", - ) - .unwrap()) - }); - - mock_rpc_client - .expect_get_block_hash() - .withf(|height| *height == 96) - .returning(|_| { - Ok(BlockHash::from_str( - "1111111111111111111111111111111111111111111111111111111111111111", - ) - .unwrap()) - }); - - mock_rpc_client - .expect_get_block_json() - .withf(|bh| { - hex::encode(bh) - == "0000000000000000000000000000000000000000000000000000000000000000" - }) - .returning(|_| { - Ok(json!({ - "tx": ["0101010101010101010101010101010101010101010101010101010101010101"] - })) - }); - - mock_rpc_client - .expect_get_block_json() - .withf(|bh| { - hex::encode(bh) - == "1111111111111111111111111111111111111111111111111111111111111111" - }) - .returning(|_| { - Ok(json!({ - "tx": ["0202020202020202020202020202020202020202020202020202020202020202"] - })) - }); - - platform.core_rpc = mock_rpc_client; - - let transaction = platform.drive.grove.start_transaction(); - - let block_execution_context = BlockExecutionContextV0 { - block_state_info: BlockStateInfoV0 { - height: 1, - round: 0, - block_time_ms: 1, - previous_block_time_ms: Some(1), - proposer_pro_tx_hash: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - ], - core_chain_locked_height: 96, - block_hash: None, - app_hash: None, - } - .into(), - epoch_info: EpochInfoV0 { - current_epoch_index: 1, - previous_epoch_index: None, - is_epoch_change: false, - } - .into(), - hpmn_count: 100, - withdrawal_transactions: Default::default(), - block_platform_state: PlatformStateV0 { - last_committed_block_info: None, - current_protocol_version_in_consensus: 0, - next_epoch_protocol_version: 0, - current_validator_set_quorum_hash: QuorumHash::all_zeros(), - next_validator_set_quorum_hash: None, - validator_sets: Default::default(), - full_masternode_list: Default::default(), - hpmn_masternode_list: Default::default(), - genesis_block_info: None, - } - .into(), - proposer_results: None, - }; - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); - - let owner_id = Identifier::new([1u8; 32]); - - let document_1 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, - "transactionIndex": 1u64, - "transactionSignHeight": 93u64, - "transactionId": Identifier::new([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), - }), - None, - platform_version.protocol_version, - ).expect("expected withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &platform.drive, - &document_1, - &data_contract, - document_type, - Some(&transaction), - ); - - let document_2 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, - "transactionIndex": 2u64, - "transactionSignHeight": 10u64, - "transactionId": Identifier::new([3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - setup_document( - &platform.drive, - &document_2, - &data_contract, - document_type, - Some(&transaction), - ); - - platform - .update_broadcasted_withdrawal_transaction_statuses_v0( - &block_execution_context.into(), - &transaction, - platform_version, - ) - .expect("to update withdrawal statuses"); - - let documents = platform - .drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::EXPIRED.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch documents by status"); - - assert_eq!(documents.len(), 1); - assert_eq!( - documents.get(0).unwrap().id().to_vec(), - document_2.id().to_vec() - ); - - let documents = platform - .drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::COMPLETE.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch documents by status"); - - assert_eq!(documents.len(), 1); - assert_eq!( - documents.get(0).unwrap().id().to_vec(), - document_1.id().to_vec() - ); - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/mod.rs index bc070e70c5f..e046d8bc3d4 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/mod.rs @@ -1,8 +1,8 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::system_identity_public_keys::SystemIdentityPublicKeys; use dpp::identity::TimestampMillis; +use dpp::prelude::CoreBlockHeight; use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; @@ -12,8 +12,8 @@ impl Platform { /// Creates trees and populates them with necessary identities, contracts and documents pub fn create_genesis_state( &self, + genesis_core_height: CoreBlockHeight, genesis_time: TimestampMillis, - system_identity_public_keys: SystemIdentityPublicKeys, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(), Error> { @@ -24,8 +24,8 @@ impl Platform { .create_genesis_state { 0 => self.create_genesis_state_v0( + genesis_core_height, genesis_time, - system_identity_public_keys, transaction, platform_version, ), diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs index ba2a1044d6b..c8aae65e354 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs @@ -1,190 +1,83 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. - use crate::error::Error; use crate::platform_types::platform::Platform; -use dpp::platform_value::{platform_value, BinaryData}; +use dpp::platform_value::platform_value; use dpp::ProtocolError; -use drive::dpp::identity::{Identity, KeyType, Purpose, SecurityLevel, TimestampMillis}; +use drive::dpp::identity::TimestampMillis; -use crate::platform_types::system_identity_public_keys::v0::SystemIdentityPublicKeysV0Getters; -use crate::platform_types::system_identity_public_keys::SystemIdentityPublicKeys; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::DataContract; use dpp::document::DocumentV0; -use dpp::identity::identity_public_key::v0::IdentityPublicKeyV0; -use dpp::identity::IdentityV0; use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::version::PlatformVersion; -use drive::dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; -use drive::drive::batch::{ - DataContractOperationType, DocumentOperationType, DriveOperation, IdentityOperationType, -}; +use drive::dpp::system_data_contracts::SystemDataContract; +use drive::util::batch::{DataContractOperationType, DocumentOperationType, DriveOperation}; -use drive::drive::object_size_info::{DocumentAndContractInfo, DocumentInfo, OwnedDocumentInfo}; +use dpp::prelude::CoreBlockHeight; +use dpp::system_data_contracts::dpns_contract::DPNS_DASH_TLD_DOCUMENT_ID; use drive::query::TransactionArg; +use drive::util::object_size_info::{ + DataContractInfo, DocumentInfo, DocumentTypeInfo, OwnedDocumentInfo, +}; use std::borrow::Cow; use std::collections::BTreeMap; -const DPNS_DASH_TLD_DOCUMENT_ID: [u8; 32] = [ - 215, 242, 197, 63, 70, 169, 23, 171, 110, 91, 57, 162, 215, 188, 38, 11, 100, 146, 137, 69, 55, - 68, 209, 224, 212, 242, 106, 141, 142, 255, 55, 207, -]; -const DPNS_DASH_TLD_PREORDER_SALT: [u8; 32] = [ - 224, 181, 8, 197, 163, 104, 37, 162, 6, 105, 58, 31, 65, 74, 161, 62, 219, 236, 244, 60, 65, - 227, 199, 153, 234, 158, 115, 123, 79, 154, 162, 38, -]; - impl Platform { /// Creates trees and populates them with necessary identities, contracts and documents - pub fn create_genesis_state_v0( + #[inline(always)] + pub(super) fn create_genesis_state_v0( &self, + genesis_core_height: CoreBlockHeight, genesis_time: TimestampMillis, - system_identity_public_keys: SystemIdentityPublicKeys, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(), Error> { //versioned call self.drive - .create_initial_state_structure(transaction, platform_version) - .map_err(Error::Drive)?; + .create_initial_state_structure(transaction, platform_version)?; + + self.drive + .store_genesis_core_height(genesis_core_height, transaction, platform_version)?; let mut operations = vec![]; // Create system identities and contracts - let dpns_contract = - load_system_data_contract(SystemDataContract::DPNS, platform_version.protocol_version)?; + let system_data_contracts = &self.drive.cache.system_data_contracts; let system_data_contract_types = BTreeMap::from_iter([ - ( - SystemDataContract::DPNS, - ( - dpns_contract.clone(), - system_identity_public_keys.dpns_contract_owner(), - ), - ), + (SystemDataContract::DPNS, system_data_contracts.load_dpns()), ( SystemDataContract::Withdrawals, - ( - load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - )?, - system_identity_public_keys.withdrawals_contract_owner(), - ), + system_data_contracts.load_withdrawals(), ), - // TODO: Do we still need feature flags to change consensus params like timeouts and so on? - // ( - // SystemDataContract::FeatureFlags, - // ( - // load_system_data_contract( - // SystemDataContract::FeatureFlags, - // platform_version.protocol_version, - // )?, - // system_identity_public_keys.feature_flags_contract_owner(), - // ), - // ), ( SystemDataContract::Dashpay, - ( - load_system_data_contract( - SystemDataContract::Dashpay, - platform_version.protocol_version, - )?, - system_identity_public_keys.dashpay_contract_owner(), - ), + system_data_contracts.load_dashpay(), ), ( SystemDataContract::MasternodeRewards, - ( - load_system_data_contract( - SystemDataContract::MasternodeRewards, - platform_version.protocol_version, - )?, - system_identity_public_keys.masternode_reward_shares_contract_owner(), - ), + system_data_contracts.load_masternode_reward_shares(), ), ]); - for (_, (data_contract, identity_public_keys_set)) in system_data_contract_types { - let public_keys = [ - ( - 0, - IdentityPublicKeyV0 { - id: 0, - purpose: Purpose::AUTHENTICATION, - security_level: SecurityLevel::MASTER, - contract_bounds: None, - key_type: KeyType::ECDSA_SECP256K1, - read_only: false, - data: identity_public_keys_set.master.clone().into(), - disabled_at: None, - } - .into(), - ), - ( - 1, - IdentityPublicKeyV0 { - id: 1, - purpose: Purpose::AUTHENTICATION, - security_level: SecurityLevel::HIGH, - contract_bounds: None, - key_type: KeyType::ECDSA_SECP256K1, - read_only: false, - data: identity_public_keys_set.high.clone().into(), - disabled_at: None, - } - .into(), - ), - ]; - - let identity = IdentityV0 { - id: data_contract.owner_id(), - public_keys: BTreeMap::from(public_keys), - balance: 0, - revision: 0, - } - .into(); - + for data_contract in system_data_contract_types.values() { self.register_system_data_contract_operations( data_contract, &mut operations, platform_version, )?; - - self.register_system_identity_operations(identity, &mut operations); } - self.register_dpns_top_level_domain_operations(&dpns_contract, &mut operations)?; + let dpns_contract = system_data_contracts.load_dpns(); + + self.register_dpns_top_level_domain_operations( + &dpns_contract, + genesis_time, + &mut operations, + )?; let block_info = BlockInfo::default_with_time(genesis_time); @@ -194,23 +87,23 @@ impl Platform { &block_info, transaction, platform_version, + None, // No previous_fee_versions needed for genesis state creation )?; Ok(()) } - fn register_system_data_contract_operations( + fn register_system_data_contract_operations<'a>( &self, - data_contract: DataContract, - operations: &mut Vec, + data_contract: &'a DataContract, + operations: &mut Vec>, platform_version: &PlatformVersion, ) -> Result<(), Error> { let serialization = data_contract.serialize_to_bytes_with_platform_version(platform_version)?; operations.push(DriveOperation::DataContractOperation( - //todo: remove cbor DataContractOperationType::ApplyContractWithSerialization { - contract: Cow::Owned(data_contract), + contract: Cow::Borrowed(data_contract), serialized_contract: serialization, storage_flags: None, }, @@ -218,22 +111,10 @@ impl Platform { Ok(()) } - fn register_system_identity_operations( - &self, - identity: Identity, - operations: &mut Vec, - ) { - operations.push(DriveOperation::IdentityOperation( - IdentityOperationType::AddNewIdentity { - identity, - is_masternode_identity: false, - }, - )) - } - fn register_dpns_top_level_domain_operations<'a>( &'a self, contract: &'a DataContract, + genesis_time: TimestampMillis, operations: &mut Vec>, ) -> Result<(), Error> { let domain = "dash"; @@ -243,9 +124,8 @@ impl Platform { "normalizedLabel" : domain, "parentDomainName" : "", "normalizedParentDomainName" : "", - "preorderSalt" : BinaryData::new(DPNS_DASH_TLD_PREORDER_SALT.to_vec()), "records" : { - "dashAliasIdentityId" : contract.owner_id(), + "identity" : contract.owner_id(), }, "subdomainRules": { "allowSubdomains": true, @@ -261,25 +141,29 @@ impl Platform { properties: document_stub_properties, owner_id: contract.owner_id(), revision: None, - created_at: None, - updated_at: None, + created_at: Some(genesis_time), + updated_at: Some(genesis_time), + transferred_at: Some(genesis_time), + created_at_block_height: None, + updated_at_block_height: None, + transferred_at_block_height: None, + created_at_core_block_height: None, + updated_at_core_block_height: None, + transferred_at_core_block_height: None, } .into(); let document_type = contract.document_type_for_name("domain")?; - let operation = - DriveOperation::DocumentOperation(DocumentOperationType::AddDocumentForContract { - document_and_contract_info: DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentInfo::DocumentOwnedInfo((document, None)), - owner_id: None, - }, - contract, - document_type, - }, - override_document: false, - }); + let operation = DriveOperation::DocumentOperation(DocumentOperationType::AddDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentInfo::DocumentOwnedInfo((document, None)), + owner_id: None, + }, + contract_info: DataContractInfo::BorrowedDataContract(contract), + document_type_info: DocumentTypeInfo::DocumentTypeRef(document_type), + override_document: false, + }); operations.push(operation); @@ -292,10 +176,12 @@ mod tests { mod create_genesis_state { use crate::config::PlatformConfig; use crate::test::helpers::setup::TestPlatformBuilder; - use drive::drive::config::DriveConfig; + use drive::config::DriveConfig; + use platform_version::version::PlatformVersion; #[test] pub fn should_create_genesis_state_deterministically() { + let platform_version = PlatformVersion::latest(); let platform = TestPlatformBuilder::new() .with_config(PlatformConfig { drive: DriveConfig { @@ -310,16 +196,13 @@ mod tests { let root_hash = platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should obtain root hash"); assert_eq!( - root_hash, - [ - 148, 196, 101, 163, 1, 56, 137, 50, 117, 196, 107, 103, 222, 55, 110, 59, 11, - 177, 172, 37, 17, 234, 56, 154, 232, 24, 208, 220, 27, 128, 201, 97 - ] + hex::encode(root_hash), + "dc5b0d4be407428adda2315db7d782e64015cbe2d2b7df963f05622390dc3c9f" ) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/mod.rs index fad7a0151e2..7e1cd4cea6f 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/mod.rs @@ -4,6 +4,7 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use dpp::prelude::{CoreBlockHeight, TimestampMillis}; use dpp::version::PlatformVersion; impl Platform @@ -13,33 +14,33 @@ where /// Determine initial core height. /// /// Use core height received from Tenderdash (from genesis.json) by default, - /// otherwise we go with height of v20 fork. + /// otherwise we go with height of mn_rr fork. /// - /// Core height is verified to ensure that it is both at or after v20 fork, and + /// Core height is verified to ensure that it is both at or after mn_rr fork, and /// before or at last chain lock. /// /// ## Error handling /// /// This function will fail if: /// - /// * v20 fork is not yet active - /// * `requested` core height is before v20 fork + /// * mn_rr fork is not yet active + /// * `requested` core height is before mn_rr fork /// * `requested` core height is after current best chain lock /// - pub(in crate::execution) fn initial_core_height( + pub(in crate::execution) fn initial_core_height_and_time( &self, requested: Option, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result<(CoreBlockHeight, TimestampMillis), Error> { match platform_version .drive_abci .methods .initialization - .initial_core_height + .initial_core_height_and_time { - 0 => self.initial_core_height_v0(requested), + 0 => self.initial_core_height_and_time_v0(requested), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "initial_core_height".to_string(), + method: "initial_core_height_and_time".to_string(), known_versions: vec![0], received: version, })), diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs index ae673a857c1..7cfa2462482 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs @@ -2,7 +2,8 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dashcore_rpc::dashcore_rpc_json::Bip9SoftforkStatus; +use dpp::prelude::{CoreBlockHeight, TimestampMillis}; +use std::time::{SystemTime, UNIX_EPOCH}; impl Platform where @@ -11,68 +12,80 @@ where /// Determine initial core height. /// /// Use core height received from Tenderdash (from genesis.json) by default, - /// otherwise we go with height of v20 fork. + /// otherwise we go with height of mn_rr fork. /// - /// Core height is verified to ensure that it is both at or after v20 fork, and + /// Core height is verified to ensure that it is both at or after mn_rr fork, and /// before or at last chain lock. /// /// ## Error handling /// /// This function will fail if: /// - /// * v20 fork is not yet active - /// * `requested` core height is before v20 fork + /// * mn_rr fork is not yet active + /// * `requested` core height is before mn_rr fork /// * `requested` core height is after current best chain lock /// - pub(in crate::execution::platform_events) fn initial_core_height_v0( + pub(in crate::execution::platform_events) fn initial_core_height_and_time_v0( &self, requested: Option, - ) -> Result { - let fork_info = self.core_rpc.get_fork_info("v20")?.ok_or( + ) -> Result<(CoreBlockHeight, TimestampMillis), Error> { + let fork_info = self.core_rpc.get_fork_info("mn_rr")?.ok_or( ExecutionError::InitializationForkNotActive("fork is not yet known".to_string()), )?; if !fork_info.active || fork_info.height.is_none() { // fork is not good yet return Err(ExecutionError::InitializationForkNotActive(format!( "fork is not yet known (currently {:?})", - fork_info.bip9.unwrap() + fork_info )) .into()); } else { - tracing::debug!(?fork_info, "core fork v20 is active"); + tracing::debug!(?fork_info, "core fork mn_rr is active"); }; // We expect height to present if the fork is active - let v20_fork = fork_info.height.unwrap(); + let mn_rr_fork_height = fork_info.height.unwrap(); - if let Some(requested) = requested { - let best = self.core_rpc.get_best_chain_lock()?.core_block_height; - - tracing::trace!( + let initial_height = if let Some(requested) = requested { + tracing::debug!( requested, - v20_fork, - best, - "selecting initial core lock height" + mn_rr_fork_height, + "initial core lock height is set in genesis" ); - // TODO in my opinion, the condition should be: - // - // `v20_fork <= requested && requested <= best` - // - // but it results in 1440 <= 1243 <= 1545 - // - // So, fork_info.since differs? is it non-deterministic? - if requested <= best { - Ok(requested) - } else { - Err(ExecutionError::InitializationBadCoreLockedHeight { - requested, - best, - v20_fork, + + requested + } else { + tracing::debug!(mn_rr_fork_height, "used fork height as initial core height"); + + mn_rr_fork_height + }; + + // Make sure initial height is chain locked + let chain_lock_height = self.core_rpc.get_best_chain_lock()?.block_height; + + if initial_height <= chain_lock_height { + let block_time = self.core_rpc.get_block_time_from_height(initial_height)?; + + let current_time = SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("Time went backwards") // Copilot rocks :)) + .as_millis() as TimestampMillis; + + if block_time > current_time { + return Err(ExecutionError::InitializationGenesisTimeInFuture { + initial_height, + genesis_time: block_time, + current_time, } - .into()) + .into()); } + + Ok((initial_height, block_time)) } else { - tracing::trace!(v20_fork, "used fork height as initial core lock height"); - Ok(v20_fork) + Err(ExecutionError::InitializationHeightIsNotLocked { + initial_height, + chain_lock_height, + } + .into()) } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/mod.rs index 51efcb08668..41b64d63b18 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/mod.rs @@ -2,26 +2,27 @@ pub(in crate::execution) mod block_end; /// Block fee processing pub(in crate::execution) mod block_fee_processing; +/// Events happening what starting to process a block +pub(in crate::execution) mod block_start; /// Update from core such as a masternode list update or quorums being updated pub(in crate::execution) mod core_based_updates; -/// Core subsidy -pub(in crate::execution) mod core_subsidy; +/// Verify the chain lock +pub(in crate::execution) mod core_chain_lock; +/// Instant lock methods +pub(in crate::execution) mod core_instant_send_lock; /// Epoch based methods pub(in crate::execution) mod epoch; /// Fee pools module pub(in crate::execution) mod fee_pool_inwards_distribution; /// Fee pool outwards distribution towards proposers pub(in crate::execution) mod fee_pool_outwards_distribution; -/// Functions related to IdentityCreditWithdrawalTransaction -pub(in crate::execution) mod identity_credit_withdrawal; /// Initialization pub(in crate::execution) mod initialization; /// Protocol upgrade events pub(in crate::execution) mod protocol_upgrade; /// State transition processing pub(in crate::execution) mod state_transition_processing; -/// Platform withdrawals +/// Voting +pub(in crate::execution) mod voting; +/// Withdrawal methods pub(in crate::execution) mod withdrawals; - -/// Events happening what starting to process a block -pub(in crate::execution) mod block_start; diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs index c2d15fa430c..33805f31251 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs @@ -3,20 +3,16 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use dpp::util::deserializer::ProtocolVersion; use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; mod v0; impl Platform { /// Checks for a network upgrade and resets activation window. /// This method should only be called when a new epoch starts. - /// It alters the underlying state but does not change the drive cache. /// /// # Arguments /// /// * `total_hpmns` - The total number of high priority masternodes. - /// * `current_protocol_version_in_consensus` - The current protocol version in consensus. - /// * `transaction` - A transaction argument to interact with the underlying storage. /// /// # Returns /// @@ -34,21 +30,15 @@ impl Platform { pub fn check_for_desired_protocol_upgrade( &self, total_hpmns: u32, - current_protocol_version_in_consensus: ProtocolVersion, - transaction: &Transaction, + platform_version: &PlatformVersion, ) -> Result, Error> { - let current_platform_version = PlatformVersion::get(current_protocol_version_in_consensus)?; - match current_platform_version + match platform_version .drive_abci .methods .protocol_upgrade .check_for_desired_protocol_upgrade { - 0 => self.check_for_desired_protocol_upgrade_v0( - total_hpmns, - current_protocol_version_in_consensus, - transaction, - ), + 0 => self.check_for_desired_protocol_upgrade_v0(total_hpmns, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "check_for_desired_protocol_upgrade".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs index dfd442eb4bc..ba60c5a3fec 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs @@ -1,28 +1,27 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; -use dpp::version::PlatformVersion; +use dpp::version::PlatformVersion; use drive::dpp::util::deserializer::ProtocolVersion; -use drive::grovedb::Transaction; - -/// The percentage needed of HPMNs to upgrade the protocol -/// It always needs to be higher than the rounded amount after applying the percentage -const PROTOCOL_VERSION_UPGRADE_PERCENTAGE_NEEDED: u64 = 75; impl Platform { /// checks for a network upgrade and resets activation window /// this should only be called on epoch change - /// this will change backing state, but does not change drive cache pub(super) fn check_for_desired_protocol_upgrade_v0( &self, total_hpmns: u32, - current_protocol_version_in_consensus: ProtocolVersion, - transaction: &Transaction, + platform_version: &PlatformVersion, ) -> Result, Error> { - let required_upgraded_hpns = 1 + let upgrade_percentage_needed = platform_version + .drive_abci + .methods + .protocol_upgrade + .protocol_version_upgrade_percentage_needed; + + let required_upgraded_hpmns = 1 + (total_hpmns as u64) - .checked_mul(PROTOCOL_VERSION_UPGRADE_PERCENTAGE_NEEDED) + .checked_mul(upgrade_percentage_needed) .and_then(|product| product.checked_div(100)) .ok_or(Error::Execution(ExecutionError::Overflow( "overflow for required block count", @@ -30,11 +29,10 @@ impl Platform { // if we are at an epoch change, check to see if over 75% of blocks of previous epoch // were on the future version - let mut cache = self.drive.cache.write().unwrap(); - let mut versions_passing_threshold = cache - .protocol_versions_counter - .versions_passing_threshold(required_upgraded_hpns); - drop(cache); + let protocol_versions_counter = self.drive.cache.protocol_versions_counter.read(); + + let mut versions_passing_threshold = + protocol_versions_counter.versions_passing_threshold(required_upgraded_hpmns); if versions_passing_threshold.len() > 1 { return Err(Error::Execution( @@ -44,28 +42,21 @@ impl Platform { )); } + tracing::trace!( + total_hpmns, + required_upgraded_hpmns, + all_votes = ?protocol_versions_counter.global_cache, + ?versions_passing_threshold, + "Protocol version voting is finished. {} versions passing the threshold: {:?}", + versions_passing_threshold.len(), + versions_passing_threshold + ); + if !versions_passing_threshold.is_empty() { // same as equals 1 - let new_version = versions_passing_threshold.remove(0); - // Persist current and next epoch protocol versions - // we also drop all protocol version votes information - self.drive - .change_to_new_version_and_clear_version_information( - current_protocol_version_in_consensus, - new_version, - Some(transaction), - ) - .map_err(Error::Drive)?; - - Ok(Some(new_version)) + let next_version = versions_passing_threshold.remove(0); + Ok(Some(next_version)) } else { - // we need to drop all version information - let current_platform_version = - PlatformVersion::get(current_protocol_version_in_consensus)?; - self.drive - .clear_version_information(Some(transaction), ¤t_platform_version.drive) - .map_err(Error::Drive)?; - Ok(None) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs index a69fee99bb2..b2e1e826d4e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs @@ -1 +1,2 @@ mod check_for_desired_protocol_upgrade; +mod upgrade_protocol_version; diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/mod.rs new file mode 100644 index 00000000000..18fff0fb658 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/mod.rs @@ -0,0 +1,58 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::epoch_info::EpochInfo; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; + +impl Platform { + /// Sets current protocol version and next epoch protocol version to block platform state + /// + /// This function should be called on very top of bock production before we add new proposed version for the next epoch + /// + /// It takes five parameters: + /// * `block_info`: Information about the current block. + /// * `epoch_info`: Information about the current epoch. + /// * `last_committed_platform_state`: The last committed state of the platform. + /// * `block_platform_state`: The current state of the platform. + /// * `transaction`: The current transaction. + /// * `platform_version`: The current version of the platform. + /// + /// # Errors + /// + /// This function will return an error if the previous block protocol version does not match the current block protocol version not on epoch change + pub fn upgrade_protocol_version_on_epoch_change( + &self, + block_info: &BlockInfo, + epoch_info: &EpochInfo, + last_committed_platform_state: &PlatformState, + block_platform_state: &mut PlatformState, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .protocol_upgrade + .upgrade_protocol_version_on_epoch_change + { + 0 => self.upgrade_protocol_version_on_epoch_change_v0( + block_info, + epoch_info, + last_committed_platform_state, + block_platform_state, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "upgrade_protocol_version_on_epoch_change".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs new file mode 100644 index 00000000000..5edbf3e2f19 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs @@ -0,0 +1,160 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::epoch_info::v0::{EpochInfoV0Getters, EpochInfoV0Methods}; +use crate::platform_types::epoch_info::EpochInfo; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use chrono::{TimeZone, Utc}; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; + +impl Platform { + /// Sets current protocol version and next epoch protocol version to block platform state + /// + /// It takes five parameters: + /// * `epoch_info`: Information about the current epoch. + /// * `last_committed_platform_state`: The last committed state of the platform. + /// * `block_platform_state`: The current state of the platform. + /// * `transaction`: The current transaction. + /// * `platform_version`: The current version of the platform. + /// + /// # Errors + /// + /// This function will return an error if the previous block protocol version does not match the current block protocol version not on epoch change + pub(super) fn upgrade_protocol_version_on_epoch_change_v0( + &self, + block_info: &BlockInfo, + epoch_info: &EpochInfo, + last_committed_platform_state: &PlatformState, + block_platform_state: &mut PlatformState, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let previous_block_protocol_version = last_committed_platform_state + .current_platform_version()? + .protocol_version; + let current_block_protocol_version = platform_version.protocol_version; + + // Protocol version can be changed only on epoch change + if epoch_info.is_epoch_change_but_not_genesis() { + if current_block_protocol_version == previous_block_protocol_version { + tracing::info!( + epoch_index = epoch_info.current_epoch_index(), + "protocol version remains the same {}", + current_block_protocol_version, + ); + } else { + tracing::info!( + epoch_index = epoch_info.current_epoch_index(), + "protocol version changed from {} to {}", + previous_block_protocol_version, + current_block_protocol_version, + ); + }; + + // Determine a new protocol version for the next epoch if enough proposers voted + // otherwise keep the current one + + let hpmn_list_len = last_committed_platform_state.hpmn_list_len() as u32; + + let next_epoch_protocol_version = + self.check_for_desired_protocol_upgrade(hpmn_list_len, platform_version)?; + + if let Some(protocol_version) = next_epoch_protocol_version { + tracing::trace!( + current_epoch_index = epoch_info.current_epoch_index(), + "Next protocol version set to {}", + protocol_version + ); + + block_platform_state.set_next_epoch_protocol_version(protocol_version); + } else { + tracing::trace!( + current_epoch_index = epoch_info.current_epoch_index(), + "Non of the votes reached threshold. Next protocol version remains the same {}", + block_platform_state.next_epoch_protocol_version() + ); + } + + // Since we are starting a new epoch we need to drop previously + // proposed versions + + // Remove previously proposed versions from Drive state + self.drive + .clear_version_information(Some(transaction), &platform_version.drive) + .map_err(Error::Drive)?; + + let previous_fee_versions_map = block_platform_state.previous_fee_versions_mut(); + + let platform_version = PlatformVersion::get(current_block_protocol_version)?; + // If cached_fee_version is non-empty + if let Some((_, last_fee_version)) = previous_fee_versions_map.iter().last() { + // Insert the new (epoch_index, fee_version) only if the new fee_version is different from the last_fee_version. + if *last_fee_version != platform_version.fee_version { + previous_fee_versions_map.insert( + epoch_info.current_epoch_index(), + platform_version.fee_version.clone(), + ); + } + // In case of empty cached_fee_version, insert the new (epoch_index, fee_version) + } else { + previous_fee_versions_map.insert( + epoch_info.current_epoch_index(), + platform_version.fee_version.clone(), + ); + } + + // We clean voting counter cache only on finalize block because: + // 1. The voting counter global cache uses for querying of voting information in Drive queries + // 2. There might be multiple rounds so on the next round we will lose all previous epoch vote_choices + // + // Instead of clearing cache, the further block processing logic is using `get_if_enabled` + // to get a version counter from the global cache. We disable this getter here to prevent + // reading previous voting information for the new epoch. + // The getter must be enabled back on finalize block in [update_drive_cache] and at the very beginning + // of the block processing in [clear_drive_block_cache]. + + let mut protocol_versions_counter = self.drive.cache.protocol_versions_counter.write(); + protocol_versions_counter.block_global_cache(); + drop(protocol_versions_counter); + } else if current_block_protocol_version != previous_block_protocol_version { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "unexpected protocol upgrade: it should happen only on epoch change", + ))); + } + + // Warn user to update software if the next protocol version is not supported + let latest_supported_protocol_version = PlatformVersion::latest().protocol_version; + let next_epoch_protocol_version = block_platform_state.next_epoch_protocol_version(); + if block_platform_state.next_epoch_protocol_version() > latest_supported_protocol_version { + let genesis_time_ms = self.get_genesis_time( + block_info.height, + block_info.time_ms, + transaction, + platform_version, + )?; + + let next_epoch_activation_datetime_ms = genesis_time_ms + + (epoch_info.current_epoch_index() as u64 + * self.config.execution.epoch_time_length_s + * 1000); + + let next_epoch_activation_datetime = Utc + .timestamp_millis_opt(next_epoch_activation_datetime_ms as i64) + .single() + .expect("next_epoch_activation_date must always be in the range"); + + tracing::warn!( + next_epoch_protocol_version, + latest_supported_protocol_version, + "The node doesn't support new protocol version {} that will be activated starting from {}. Please update your software, otherwise the node won't be able to participate in the network. https://docs.dash.org/platform-protocol-upgrade", + next_epoch_protocol_version, + next_epoch_activation_datetime.to_rfc2822(), + ); + } + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/mod.rs new file mode 100644 index 00000000000..92bf4fc44f2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_container::StateTransitionContainer; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Processes the given raw state transitions based on the `block_info` and `transaction`. + /// + /// # Arguments + /// + /// * `raw_state_transitions` - A reference to a vector of raw state transitions. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result<(FeeResult, Vec), Error>` - If the processing is successful, it returns + /// a tuple consisting of a `FeeResult` and a vector of `ExecTxResult`. If the processing fails, + /// it returns an `Error`. + /// + /// # Errors + /// + /// This function may return an `Error` variant if there is a problem with deserializing the raw + /// state transitions, processing state transitions, or executing events. + pub(in crate::execution) fn decode_raw_state_transitions<'a>( + &self, + raw_state_transitions: &'a [impl AsRef<[u8]>], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .state_transition_processing + .decode_raw_state_transitions + { + 0 => Ok(self + .decode_raw_state_transitions_v0(raw_state_transitions, platform_version) + .into()), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "decode_raw_state_transitions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/v0/mod.rs new file mode 100644 index 00000000000..a8a03d5f087 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/v0/mod.rs @@ -0,0 +1,121 @@ +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, InvalidStateTransition, InvalidWithProtocolErrorStateTransition, + StateTransitionContainerV0, SuccessfullyDecodedStateTransition, +}; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::consensus::basic::decode::SerializedObjectParsingError; +use dpp::consensus::basic::state_transition::StateTransitionMaxSizeExceededError; +use dpp::consensus::basic::BasicError; +use dpp::consensus::ConsensusError; +use dpp::serialization::PlatformDeserializable; +use dpp::state_transition::StateTransition; +use dpp::version::PlatformVersion; +use dpp::ProtocolError; +use std::time::{Duration, Instant}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Decodes and processes raw state transitions for version 0. + /// + /// This method deserializes each raw state transition from the provided vector, attempting to process + /// and categorize them into valid or invalid state transitions based on the deserialization outcome + /// and specific validation rules. It encapsulates the results in a `StateTransitionContainerV0`, + /// which separately tracks valid and invalid state transitions along with any associated errors. + /// + /// ## Arguments + /// + /// - `raw_state_transitions`: A reference to a vector of raw state transitions, where each state transition + /// is represented as a vector of bytes. + /// + /// ## Returns + /// + /// - `StateTransitionContainerV0`: A container holding the processed state transitions, including + /// both successfully deserialized transitions and those that failed validation with their corresponding errors. + /// + /// ## Errors + /// + /// Errors can arise from issues in deserializing the raw state transitions or if the processing of state transitions + /// encounters a scenario that warrants halting further execution. Specific errors include deserialization failures, + /// exceeding the maximum encoded bytes limit for a state transition. Protocol level errors should never occur, but + /// are also included in the result container. + /// + pub(super) fn decode_raw_state_transitions_v0<'a>( + &self, + raw_state_transitions: &'a [impl AsRef<[u8]>], + platform_version: &PlatformVersion, + ) -> StateTransitionContainerV0<'a> { + // Todo: might be better to have StateTransitionContainerV0 be a decoder instead and have + // the method decode_raw_state_transitions + let decoded_state_transitions = raw_state_transitions + .iter() + .map(|raw_state_transition| { + if raw_state_transition.as_ref().len() as u64 + > platform_version.system_limits.max_state_transition_size + { + // The state transition is too big + let consensus_error = ConsensusError::BasicError( + BasicError::StateTransitionMaxSizeExceededError( + StateTransitionMaxSizeExceededError::new( + raw_state_transition.as_ref().len() as u64, + platform_version.system_limits.max_state_transition_size, + ), + ), + ); + + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw: raw_state_transition.as_ref(), + error: consensus_error, + elapsed_time: Duration::default(), + }) + } else { + let start_time = Instant::now(); + + match StateTransition::deserialize_from_bytes(raw_state_transition.as_ref()) { + Ok(state_transition) => DecodedStateTransition::SuccessfullyDecoded( + SuccessfullyDecodedStateTransition { + decoded: state_transition, + raw: raw_state_transition.as_ref(), + elapsed_time: start_time.elapsed(), + }, + ), + Err(error) => match error { + ProtocolError::PlatformDeserializationError(message) => { + let consensus_error = + SerializedObjectParsingError::new(message.clone()).into(); + + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw: raw_state_transition.as_ref(), + error: consensus_error, + elapsed_time: start_time.elapsed(), + }) + } + ProtocolError::MaxEncodedBytesReachedError { .. } => { + let message = error.to_string(); + let consensus_error = + SerializedObjectParsingError::new(message.clone()).into(); + + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw: raw_state_transition.as_ref(), + error: consensus_error, + elapsed_time: start_time.elapsed(), + }) + } + protocol_error => DecodedStateTransition::FailedToDecode( + InvalidWithProtocolErrorStateTransition { + raw: raw_state_transition.as_ref(), + error: protocol_error, + elapsed_time: start_time.elapsed(), + }, + ), + }, + } + } + }) + .collect(); + + StateTransitionContainerV0::new(decoded_state_transitions) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs index 0b8d5e3f4cd..e2aa2dab962 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs @@ -3,10 +3,13 @@ mod v0; use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; +use crate::platform_types::event_execution_result::EventExecutionResult; use crate::platform_types::platform::Platform; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; + use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; +use dpp::consensus::ConsensusError; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; @@ -37,17 +40,26 @@ where pub(in crate::execution) fn execute_event( &self, event: ExecutionEvent, + consensus_errors: Vec, block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result { + previous_fee_versions: &CachedEpochIndexFeeVersions, + ) -> Result { match platform_version .drive_abci .methods .state_transition_processing .execute_event { - 0 => self.execute_event_v0(event, block_info, transaction, platform_version), + 0 => self.execute_event_v0( + event, + consensus_errors, + block_info, + transaction, + platform_version, + previous_fee_versions, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "execute_event".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs index d0f889d64ad..87004687898 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs @@ -1,13 +1,18 @@ use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; -use crate::platform_types::platform::Platform; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::{ - ConsensusExecutionError, SuccessfulFreeExecution, SuccessfulPaidExecution, +use crate::execution::types::execution_operation::ValidationOperation; +use crate::platform_types::event_execution_result::EventExecutionResult; +use crate::platform_types::event_execution_result::EventExecutionResult::{ + SuccessfulFreeExecution, SuccessfulPaidExecution, UnpaidConsensusExecutionError, + UnsuccessfulPaidExecution, }; +use crate::platform_types::platform::Platform; + use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; -use dpp::validation::SimpleConsensusValidationResult; +use dpp::consensus::ConsensusError; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; use drive::drive::identity::update::apply_balance_change_outcome::ApplyBalanceChangeOutcomeV0Methods; use drive::grovedb::Transaction; @@ -38,31 +43,51 @@ where /// /// This function may return an `Error` variant if there is a problem with the drive operations or /// an internal error occurs. + #[inline(always)] pub(super) fn execute_event_v0( &self, event: ExecutionEvent, + mut consensus_errors: Vec, block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result { - //todo: we need to split out errors - // between failed execution and internal errors - let validation_result = - self.validate_fees_of_event(&event, block_info, Some(transaction), platform_version)?; + previous_fee_versions: &CachedEpochIndexFeeVersions, + ) -> Result { + let maybe_fee_validation_result = match event { + ExecutionEvent::PaidFromAssetLock { .. } | ExecutionEvent::Paid { .. } => { + Some(self.validate_fees_of_event( + &event, + block_info, + Some(transaction), + platform_version, + previous_fee_versions, + )?) + } + ExecutionEvent::PaidFromAssetLockWithoutIdentity { .. } + | ExecutionEvent::PaidFixedCost { .. } + | ExecutionEvent::Free { .. } => None, + }; match event { - ExecutionEvent::PaidFromAssetLockDriveEvent { + ExecutionEvent::PaidFromAssetLock { identity, operations, + execution_operations, + user_fee_increase, .. } - | ExecutionEvent::PaidDriveEvent { + | ExecutionEvent::Paid { identity, operations, + execution_operations, + user_fee_increase, + .. } => { - if validation_result.is_valid_with_data() { + // We can unwrap here because we have the match right above + let mut fee_validation_result = maybe_fee_validation_result.unwrap(); + if fee_validation_result.is_valid_with_data() { //todo: make this into an atomic event with partial batches - let individual_fee_result = self + let mut individual_fee_result = self .drive .apply_drive_operations( operations, @@ -70,9 +95,18 @@ where block_info, Some(transaction), platform_version, + Some(previous_fee_versions), ) .map_err(Error::Drive)?; + ValidationOperation::add_many_to_fee_result( + &execution_operations, + &mut individual_fee_result, + platform_version, + )?; + + individual_fee_result.apply_user_fee_increase(user_fee_increase); + let balance_change = individual_fee_result.into_balance_change(identity.id); let outcome = self.drive.apply_balance_change_from_fee_to_identity( @@ -81,17 +115,78 @@ where platform_version, )?; + if consensus_errors.is_empty() { + Ok(SuccessfulPaidExecution( + Some(fee_validation_result.into_data()?), + outcome.actual_fee_paid_owned(), + )) + } else { + Ok(UnsuccessfulPaidExecution( + Some(fee_validation_result.into_data()?), + outcome.actual_fee_paid_owned(), + consensus_errors, + )) + } + } else { + consensus_errors.append(&mut fee_validation_result.errors); + Ok(UnpaidConsensusExecutionError(consensus_errors)) + } + } + // This is for Partially used Asset Locks + // NOT used for identity create or identity top up + ExecutionEvent::PaidFromAssetLockWithoutIdentity { + processing_fees, + operations, + } => { + self.drive + .apply_drive_operations( + operations, + true, + block_info, + Some(transaction), + platform_version, + Some(previous_fee_versions), + ) + .map_err(Error::Drive)?; + + if consensus_errors.is_empty() { Ok(SuccessfulPaidExecution( - validation_result.into_data()?, - outcome.actual_fee_paid_owned(), + None, + FeeResult::default_with_fees(0, processing_fees), )) } else { - Ok(ConsensusExecutionError( - SimpleConsensusValidationResult::new_with_errors(validation_result.errors), + Ok(UnsuccessfulPaidExecution( + None, + FeeResult::default_with_fees(0, processing_fees), + consensus_errors, + )) + } + } + ExecutionEvent::PaidFixedCost { + operations, + fees_to_add_to_pool, + } => { + if consensus_errors.is_empty() { + self.drive + .apply_drive_operations( + operations, + true, + block_info, + Some(transaction), + platform_version, + Some(previous_fee_versions), + ) + .map_err(Error::Drive)?; + + Ok(SuccessfulPaidExecution( + None, + FeeResult::default_with_fees(0, fees_to_add_to_pool), )) + } else { + Ok(UnpaidConsensusExecutionError(consensus_errors)) } } - ExecutionEvent::FreeDriveEvent { operations } => { + ExecutionEvent::Free { operations } => { self.drive .apply_drive_operations( operations, @@ -99,6 +194,7 @@ where block_info, Some(transaction), platform_version, + Some(previous_fee_versions), ) .map_err(Error::Drive)?; Ok(SuccessfulFreeExecution) diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs index 56add58ac01..b8e08aad2ad 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs @@ -1,3 +1,4 @@ +mod decode_raw_state_transitions; mod execute_event; mod process_raw_state_transitions; mod validate_fees_of_event; diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs index 5f26cd86f79..b4025034693 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs @@ -2,15 +2,14 @@ mod v0; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::metrics::HistogramTiming; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; +use crate::platform_types::state_transitions_processing_result::StateTransitionsProcessingResult; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; -use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; -use tenderdash_abci::proto::abci::ExecTxResult; impl Platform where @@ -44,7 +43,9 @@ where block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result<(FeeResult, Vec<(Vec, StateTransitionExecutionResult)>), Error> { + proposing_state_transitions: bool, + timer: Option<&HistogramTiming>, + ) -> Result { match platform_version .drive_abci .methods @@ -57,6 +58,8 @@ where block_info, transaction, platform_version, + proposing_state_transitions, + timer, ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "process_raw_state_transitions".to_string(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs index e6c04fb97e7..ee7979595e6 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs @@ -1,21 +1,36 @@ use crate::error::Error; -use crate::execution::validation::state_transition::processor::process_state_transition; use crate::platform_types::platform::{Platform, PlatformRef}; use crate::platform_types::platform_state::PlatformState; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::{ - ConsensusExecutionError, SuccessfulPaidExecution, -}; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; -use dpp::dashcore; -use dpp::dashcore::hashes::Hash; +use dpp::consensus::codes::ErrorWithCode; use dpp::fee::fee_result::FeeResult; -use dpp::state_transition::StateTransition; -use dpp::validation::SimpleConsensusValidationResult; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; +use crate::execution::types::execution_event::ExecutionEvent; +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, InvalidStateTransition, InvalidWithProtocolErrorStateTransition, + SuccessfullyDecodedStateTransition, +}; +use crate::execution::validation::state_transition::processor::process_state_transition; +use crate::metrics::{state_transition_execution_histogram, HistogramTiming}; +use crate::platform_types::event_execution_result::EventExecutionResult; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::state_transitions_processing_result::{ + NotExecutedReason, StateTransitionExecutionResult, StateTransitionsProcessingResult, +}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::util::hash::hash_single; +use dpp::validation::ConsensusValidationResult; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; +use std::time::Instant; + +#[derive(Debug)] +struct StateTransitionAwareError<'t> { + error: Error, + raw_state_transition: &'t [u8], + state_transition_name: Option, +} impl Platform where @@ -35,9 +50,9 @@ where /// /// # Returns /// - /// * `Result<(FeeResult, Vec), Error>` - If the processing is successful, it returns - /// a tuple consisting of a `FeeResult` and a vector of `ExecTxResult`. If the processing fails, - /// it returns an `Error`. + /// * `Result` - If the processing is successful, it returns + /// a `StateTransitionsProcessingResult` with state transition execution results and aggregated information. + /// If the processing fails, it returns an `Error`. /// /// # Errors /// @@ -46,88 +61,428 @@ where /// pub(super) fn process_raw_state_transitions_v0( &self, - raw_state_transitions: &Vec>, + raw_state_transitions: &[Vec], block_platform_state: &PlatformState, block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result<(FeeResult, Vec<(Vec, StateTransitionExecutionResult)>), Error> { - let state_transitions = StateTransition::deserialize_many(raw_state_transitions)?; - let mut aggregate_fee_result = FeeResult::default(); + proposing_state_transitions: bool, + timer: Option<&HistogramTiming>, + ) -> Result { let platform_ref = PlatformRef { drive: &self.drive, state: block_platform_state, config: &self.config, core_rpc: &self.core_rpc, - block_info, }; - let exec_tx_results = state_transitions - .into_iter() - .zip(raw_state_transitions.iter()) - .map(|(state_transition, raw_state_transition)| { - let state_transition_execution_event = process_state_transition( - &platform_ref, - state_transition.clone(), - Some(transaction), - )?; - - // Tenderdash hex-encoded ST hash - let mut st_hash = String::new(); - if tracing::enabled!(tracing::Level::TRACE) { - st_hash = hex::encode( - dashcore::hashes::sha256::Hash::hash(raw_state_transition).to_byte_array(), + + let state_transition_container = + self.decode_raw_state_transitions(raw_state_transitions, platform_version)?; + + let mut processing_result = StateTransitionsProcessingResult::default(); + + for decoded_state_transition in state_transition_container.into_iter() { + // If we propose state transitions, we need to check if we have a time limit for processing + // set and if we have exceeded it. + let execution_result = if proposing_state_transitions + && timer.map_or(false, |timer| { + timer.elapsed().as_millis() + > self + .config + .abci + .proposer_tx_processing_time_limit + .unwrap_or(u16::MAX) as u128 + }) { + StateTransitionExecutionResult::NotExecuted(NotExecutedReason::ProposerRanOutOfTime) + } else { + match decoded_state_transition { + DecodedStateTransition::SuccessfullyDecoded( + SuccessfullyDecodedStateTransition { + decoded: state_transition, + raw: raw_state_transition, + elapsed_time: decoding_elapsed_time, + }, + ) => { + let start_time = Instant::now(); + + let state_transition_name = state_transition.name(); + + if tracing::enabled!(tracing::Level::TRACE) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::trace!( + ?state_transition, + st_hash, + "Processing {} state transition", + state_transition_name + ); + } + + // Validate state transition and produce an execution event + let execution_result = process_state_transition( + &platform_ref, + block_info, + state_transition, + Some(transaction), + ) + .map(|validation_result| { + self.process_validation_result_v0( + raw_state_transition, + &state_transition_name, + validation_result, + block_info, + transaction, + platform_version, + platform_ref.state.previous_fee_versions(), + ) + .unwrap_or_else(error_to_internal_error_execution_result) + }) + .map_err(|error| StateTransitionAwareError { + error, + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + }) + .unwrap_or_else(error_to_internal_error_execution_result); + + // Store metrics + let elapsed_time = start_time.elapsed() + decoding_elapsed_time; + + let code = match &execution_result { + StateTransitionExecutionResult::SuccessfulExecution(_, _) => 0, + StateTransitionExecutionResult::PaidConsensusError(error, _) + | StateTransitionExecutionResult::UnpaidConsensusError(error) => { + error.code() + } + StateTransitionExecutionResult::InternalError(_) => 1, + StateTransitionExecutionResult::NotExecuted(_) => 1, //todo + }; + + state_transition_execution_histogram( + elapsed_time, + &state_transition_name, + code, + ); + + execution_result + } + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw, + error, + elapsed_time: decoding_elapsed_time, + }) => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw)); + + tracing::debug!( + ?error, + st_hash, + "Invalid unknown state transition ({}): {}", + st_hash, + error + ); + } + + // Store metrics + state_transition_execution_histogram( + decoding_elapsed_time, + "Unknown", + error.code(), + ); + + StateTransitionExecutionResult::UnpaidConsensusError(error) + } + DecodedStateTransition::FailedToDecode( + InvalidWithProtocolErrorStateTransition { + raw, + error: protocol_error, + elapsed_time: decoding_elapsed_time, + }, + ) => { + // Store metrics + state_transition_execution_histogram(decoding_elapsed_time, "Unknown", 1); + + error_to_internal_error_execution_result(StateTransitionAwareError { + error: protocol_error.into(), + raw_state_transition: raw, + state_transition_name: None, + }) + } + } + }; + + processing_result.add(execution_result)?; + } + + Ok(processing_result) + } + + fn process_validation_result_v0<'a>( + &self, + raw_state_transition: &'a [u8], //used for errors + state_transition_name: &str, + mut validation_result: ConsensusValidationResult, + block_info: &BlockInfo, + transaction: &Transaction, + platform_version: &PlatformVersion, + previous_fee_versions: &CachedEpochIndexFeeVersions, + ) -> Result> { + // State Transition is invalid + if !validation_result.is_valid() { + // To prevent spam we should deduct fees for invalid state transitions as well. + // There are three cases when the user can't pay fees: + // 1. The state transition is funded by an asset lock transactions. This transactions are + // placed on the payment blockchain and they can't be partially spent. + // 2. We can't prove that the state transition is associated with the identity + // 3. The revision given by the state transition isn't allowed based on the state + if validation_result.data.is_none() { + let first_consensus_error = validation_result + .errors + // the first error must be present for an invalid result + .remove(0); + + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::debug!( + error = ?first_consensus_error, + st_hash, + "Invalid {} state transition without identity ({}): {}", + state_transition_name, + st_hash, + &first_consensus_error ); } - let execution_result = if state_transition_execution_event.is_valid() { - let execution_event = state_transition_execution_event.into_data()?; + // We don't have execution event, so we can't pay for processing + return Ok(StateTransitionExecutionResult::UnpaidConsensusError( + first_consensus_error, + )); + }; + + let (execution_event, errors) = validation_result + .into_data_and_errors() + .expect("data must be present since we check it few lines above"); + + let first_consensus_error = errors + .first() + .expect("error must be present since we check it few lines above") + .clone(); + + // In this case the execution event will be to pay for the state transition processing + // This ONLY pays for what is needed to prevent attacks on the system + + let event_execution_result = self + .execute_event( + execution_event, + errors, + block_info, + transaction, + platform_version, + previous_fee_versions, + ) + .map_err(|error| StateTransitionAwareError { + error, + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + })?; + + let state_transition_execution_result = match event_execution_result { + EventExecutionResult::SuccessfulPaidExecution(estimated_fees, actual_fees) + | EventExecutionResult::UnsuccessfulPaidExecution(estimated_fees, actual_fees, _) => + { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); - let result = self.execute_event( - execution_event, - block_info, - transaction, - platform_version, - )?; + tracing::debug!( + error = ?first_consensus_error, + st_hash, + ?estimated_fees, + ?actual_fees, + "Invalid {} state transition ({}): {}", + state_transition_name, + st_hash, + &first_consensus_error + ); + } + + StateTransitionExecutionResult::PaidConsensusError( + first_consensus_error, + actual_fees, + ) + } + EventExecutionResult::SuccessfulFreeExecution => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::debug!( + error = ?first_consensus_error, + st_hash, + "Free invalid {} state transition ({}): {}", + state_transition_name, + st_hash, + &first_consensus_error + ); + } + + StateTransitionExecutionResult::UnpaidConsensusError(first_consensus_error) + } + EventExecutionResult::UnpaidConsensusExecutionError(mut payment_errors) => { + let payment_consensus_error = payment_errors + // the first error must be present for an invalid result + .remove(0); + + if tracing::enabled!(tracing::Level::ERROR) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::error!( + main_error = ?first_consensus_error, + payment_error = ?payment_consensus_error, + st_hash, + "Not able to reduce balance for identity {} state transition ({}): {}", + state_transition_name, + st_hash, + payment_consensus_error + ); + } + + StateTransitionExecutionResult::InternalError(format!( + "{first_consensus_error} {payment_consensus_error}", + )) + } + }; + + return Ok(state_transition_execution_result); + } + + let (execution_event, errors) = + validation_result.into_data_and_errors().map_err(|error| { + StateTransitionAwareError { + error: error.into(), + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + } + })?; + + let event_execution_result = self + .execute_event( + execution_event, + errors, + block_info, + transaction, + platform_version, + previous_fee_versions, + ) + .map_err(|error| StateTransitionAwareError { + error, + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + })?; + + let state_transition_execution_result = match event_execution_result { + EventExecutionResult::SuccessfulPaidExecution(estimated_fees, actual_fees) => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); tracing::debug!( - method = "process_raw_state_transitions_v0", + ?actual_fees, + ?estimated_fees, + st_hash, "{} state transition ({}) successfully processed", - state_transition.name(), + state_transition_name, st_hash, ); + } - tracing::trace!(?state_transition, "State transition"); + StateTransitionExecutionResult::SuccessfulExecution(estimated_fees, actual_fees) + } + EventExecutionResult::UnsuccessfulPaidExecution( + estimated_fees, + actual_fees, + mut errors, + ) => { + let payment_consensus_error = errors + // the first error must be present for an invalid result + .remove(0); - result - } else { - let first_consensus_error = state_transition_execution_event - .errors - .first() - .expect("first error must be present for invalid result"); + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); tracing::debug!( - errors = ?state_transition_execution_event.errors, - method = "process_raw_state_transitions_v0", - "Invalid {} state transition ({}): {}", - state_transition.name(), + ?actual_fees, + ?estimated_fees, + st_hash, + "{} state transition ({}) processed and mark as invalid: {}", + state_transition_name, + st_hash, + payment_consensus_error + ); + } + + StateTransitionExecutionResult::PaidConsensusError( + payment_consensus_error, + actual_fees, + ) + } + EventExecutionResult::SuccessfulFreeExecution => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::debug!( + st_hash, + "Free {} state transition ({}) successfully processed", + state_transition_name, st_hash, - first_consensus_error ); + } - tracing::trace!(?state_transition, "State transition"); + StateTransitionExecutionResult::SuccessfulExecution(None, FeeResult::default()) + } + EventExecutionResult::UnpaidConsensusExecutionError(mut errors) => { + // TODO: In case of balance is not enough, we need to reduce balance only for processing fees + // and return paid consensus error. + // Unpaid consensus error should be only if balance not enough even + // to cover processing fees + let first_consensus_error = errors + // the first error must be present for an invalid result + .remove(0); - ConsensusExecutionError(SimpleConsensusValidationResult::new_with_errors( - state_transition_execution_event.errors, - )) - }; - if let SuccessfulPaidExecution(_, fee_result) = &execution_result { - aggregate_fee_result.checked_add_assign(fee_result.clone())?; + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::debug!( + error = ?first_consensus_error, + st_hash, + "Insufficient identity balance to process {} state transition ({}): {}", + state_transition_name, + st_hash, + first_consensus_error + ); } - Ok((raw_state_transition.clone(), execution_result)) - }) - .collect::, StateTransitionExecutionResult)>, Error>>()?; + StateTransitionExecutionResult::UnpaidConsensusError(first_consensus_error) + } + }; + + Ok(state_transition_execution_result) + } +} - Ok((aggregate_fee_result, exec_tx_results)) +fn error_to_internal_error_execution_result( + error_with_st: StateTransitionAwareError, +) -> StateTransitionExecutionResult { + if tracing::enabled!(tracing::Level::ERROR) { + let st_hash = hex::encode(hash_single(error_with_st.raw_state_transition)); + + tracing::error!( + error = ?error_with_st.error, + raw_state_transition = ?error_with_st.raw_state_transition, + st_hash, + "Failed to process {} state transition ({}) : {}", + error_with_st.state_transition_name.unwrap_or_else(|| "unknown".to_string()), + st_hash, + error_with_st.error, + ); } + + StateTransitionExecutionResult::InternalError(error_with_st.error.to_string()) } diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs index ff62581d7c4..b3dff473711 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs @@ -7,6 +7,7 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; use dpp::prelude::ConsensusValidationResult; use dpp::version::PlatformVersion; @@ -41,6 +42,7 @@ where block_info: &BlockInfo, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: &CachedEpochIndexFeeVersions, ) -> Result, Error> { match platform_version .drive_abci @@ -48,7 +50,13 @@ where .state_transition_processing .validate_fees_of_event { - 0 => self.validate_fees_of_event_v0(event, block_info, transaction, platform_version), + 0 => self.validate_fees_of_event_v0( + event, + block_info, + transaction, + platform_version, + previous_fee_versions, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "validate_fees_of_event".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs index d2d35895c90..04e8f0f503e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs @@ -1,14 +1,18 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; +use crate::execution::types::execution_operation::ValidationOperation; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; use dpp::consensus::state::identity::IdentityInsufficientBalanceError; use dpp::consensus::state::state_error::StateError; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; + use dpp::prelude::ConsensusValidationResult; use dpp::version::PlatformVersion; + use drive::grovedb::TransactionArg; impl Platform @@ -38,18 +42,21 @@ where block_info: &BlockInfo, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: &CachedEpochIndexFeeVersions, ) -> Result, Error> { match event { - ExecutionEvent::PaidFromAssetLockDriveEvent { + ExecutionEvent::PaidFromAssetLock { identity, added_balance, operations, + execution_operations, + user_fee_increase, } => { let previous_balance = identity.balance.ok_or(Error::Execution( - ExecutionError::CorruptedCodeExecution("partial identity info with no balance"), + ExecutionError::CorruptedCodeExecution("partial identity info with no balance in paid from asset lock execution event"), ))?; let previous_balance_with_top_up = previous_balance + added_balance; - let estimated_fee_result = self + let mut estimated_fee_result = self .drive .apply_drive_operations( operations.clone(), @@ -57,9 +64,18 @@ where block_info, transaction, platform_version, + Some(previous_fee_versions), ) .map_err(Error::Drive)?; + ValidationOperation::add_many_to_fee_result( + execution_operations, + &mut estimated_fee_result, + platform_version, + )?; + + estimated_fee_result.apply_user_fee_increase(*user_fee_increase); + // TODO: Should take into account refunds as well let total_fee = estimated_fee_result.total_base_fee(); if previous_balance_with_top_up >= total_fee { @@ -80,14 +96,21 @@ where )) } } - ExecutionEvent::PaidDriveEvent { + ExecutionEvent::Paid { identity, + removed_balance, operations, + execution_operations, + user_fee_increase, } => { let balance = identity.balance.ok_or(Error::Execution( - ExecutionError::CorruptedCodeExecution("partial identity info with no balance"), + ExecutionError::CorruptedCodeExecution( + "partial identity info with no balance in paid execution event", + ), ))?; - let estimated_fee_result = self + let balance_after_principal_operation = + balance.saturating_sub(removed_balance.unwrap_or_default()); + let mut estimated_fee_result = self .drive .apply_drive_operations( operations.clone(), @@ -95,12 +118,21 @@ where block_info, transaction, platform_version, + Some(previous_fee_versions), ) .map_err(Error::Drive)?; + ValidationOperation::add_many_to_fee_result( + execution_operations, + &mut estimated_fee_result, + platform_version, + )?; + + estimated_fee_result.apply_user_fee_increase(*user_fee_increase); + // TODO: Should take into account refunds as well let required_balance = estimated_fee_result.total_base_fee(); - if balance >= required_balance { + if balance_after_principal_operation >= required_balance { Ok(ConsensusValidationResult::new_with_data( estimated_fee_result, )) @@ -118,9 +150,11 @@ where )) } } - ExecutionEvent::FreeDriveEvent { .. } => Ok(ConsensusValidationResult::new_with_data( - FeeResult::default(), - )), + ExecutionEvent::PaidFixedCost { .. } + | ExecutionEvent::Free { .. } + | ExecutionEvent::PaidFromAssetLockWithoutIdentity { .. } => Ok( + ConsensusValidationResult::new_with_data(FeeResult::default()), + ), } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/award_document_to_winner/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/award_document_to_winner/mod.rs new file mode 100644 index 00000000000..16115f50483 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/award_document_to_winner/mod.rs @@ -0,0 +1,45 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use dpp::voting::contender_structs::FinalizedContender; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::grovedb::TransactionArg; +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + pub(in crate::execution) fn award_document_to_winner( + &self, + block_info: &BlockInfo, + contender: FinalizedContender, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .voting + .award_document_to_winner + { + 0 => self.award_document_to_winner_v0( + block_info, + contender, + vote_poll, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "award_document_to_winner".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/award_document_to_winner/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/award_document_to_winner/v0/mod.rs new file mode 100644 index 00000000000..cdf7107d625 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/award_document_to_winner/v0/mod.rs @@ -0,0 +1,55 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use dpp::voting::contender_structs::FinalizedContender; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::grovedb::TransactionArg; +use drive::util::object_size_info::DocumentInfo::DocumentAndSerialization; +use drive::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Awards a document to the winner of a contest + #[inline(always)] + pub(super) fn award_document_to_winner_v0( + &self, + block_info: &BlockInfo, + contender: FinalizedContender, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let FinalizedContender { + identity_id, + document, + serialized_document, + .. + } = contender; + // Let's start by getting the identity + + let owned_document_info = OwnedDocumentInfo { + document_info: DocumentAndSerialization((document, serialized_document, None)), + owner_id: Some(identity_id.to_buffer()), + }; + + // Let's insert the document into the state + self.drive.add_document_for_contract( + DocumentAndContractInfo { + owned_document_info, + contract: vote_poll.contract.as_ref(), + document_type: vote_poll.document_type()?, + }, + false, + *block_info, + true, + transaction, + platform_version, + None, + )?; + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/mod.rs new file mode 100644 index 00000000000..6bb08f7facb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/mod.rs @@ -0,0 +1,43 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + pub(in crate::execution) fn check_for_ended_vote_polls( + &self, + block_platform_state: &PlatformState, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .voting + .check_for_ended_vote_polls + { + 0 => self.check_for_ended_vote_polls_v0( + block_platform_state, + block_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "check_for_ended_vote_polls".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/v0/mod.rs new file mode 100644 index 00000000000..ca84b637298 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/v0/mod.rs @@ -0,0 +1,184 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::document::DocumentV0Getters; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::contender_structs::FinalizedContender; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice::TowardsIdentity; +use dpp::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; +use drive::drive::votes::resolved::vote_polls::resolve::VotePollResolver; +use drive::drive::votes::resolved::vote_polls::{ResolvedVotePoll, ResolvedVotePollWithVotes}; +use drive::grovedb::TransactionArg; +use drive::query::VotePollsByEndDateDriveQuery; +use itertools::Itertools; +use std::collections::BTreeMap; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + #[inline(always)] + pub(super) fn check_for_ended_vote_polls_v0( + &self, + block_platform_state: &PlatformState, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // let's start by getting the vote polls that have finished + let vote_polls_by_timestamp = + VotePollsByEndDateDriveQuery::execute_no_proof_for_specialized_end_time_query( + block_info.time_ms, + platform_version + .drive_abci + .validation_and_processing + .event_constants + .maximum_vote_polls_to_process, + &self.drive, + transaction, + &mut vec![], + platform_version, + )?; + + let vote_polls_with_info = vote_polls_by_timestamp.into_iter().map(|(end_date, vote_polls)| { + let vote_polls_with_votes = vote_polls.into_iter().map(|vote_poll| { + let resolved_vote_poll = + vote_poll.resolve(&self.drive, transaction, platform_version)?; + match resolved_vote_poll { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + resolved_contested_document_resource_vote_poll, + ) => { + let document_type = + resolved_contested_document_resource_vote_poll.document_type()?; + // let's see who actually won + let result = self.tally_votes_for_contested_document_resource_vote_poll( + (&resolved_contested_document_resource_vote_poll).into(), + transaction, + platform_version, + )?; + let contenders = result.contenders; + // For each contender if there vote_tally is 1 or more we need to get their votes + // We don't do this for contenders with 0 votes, as there is no point. + + let sorted_contenders: Vec<_> = contenders + .into_iter() + .sorted_by(|a, b| Ord::cmp(&b.final_vote_tally, &a.final_vote_tally)) + .collect(); + + let (contenders_with_votes, contenders_with_no_votes) : (Vec<_>, Vec<_>) = sorted_contenders.iter().partition(|a| a.final_vote_tally > 0); + + let fetch_contenders = contenders_with_votes + .iter() + .map(|contender| contender.identity_id) + .collect::>(); + let mut other_contenders = if contenders_with_no_votes.is_empty() + { + BTreeMap::new() + } else { + // Other contenders are only those with no votes + contenders_with_no_votes.into_iter().map(|contender| (TowardsIdentity(contender.identity_id), vec![])).collect() + }; + + // We need to get the votes of the sorted contenders + let mut identifiers_voting_for_contenders = + self.drive.fetch_identities_voting_for_contenders( + &resolved_contested_document_resource_vote_poll, + fetch_contenders, + true, + transaction, + platform_version, + )?; + + identifiers_voting_for_contenders.append(&mut other_contenders); + + let highest_vote_tally = sorted_contenders + .first() + .map(|max_voted_contender| max_voted_contender.final_vote_tally) + .unwrap_or_default(); + // These are all the people who got top votes + let top_contenders: Vec = sorted_contenders + .into_iter() + .filter(|c| c.final_vote_tally == highest_vote_tally) + .take(100) // Limit to the first 100 before the expensive operation + .map(|contender| { + FinalizedContender::try_from_contender_with_serialized_document( + contender, + document_type, + platform_version, + ) + .map_err(Error::Protocol) + }) + .collect::, Error>>()?; + // Now we sort by the document creation date + let maybe_top_contender = top_contenders.into_iter().max_by(|a, b| { + a.document + .created_at() + .cmp(&b.document.created_at()) + .then_with(|| { + a.document + .created_at_block_height() + .cmp(&b.document.created_at_block_height()) + }) + .then_with(|| { + a.document + .created_at_core_block_height() + .cmp(&b.document.created_at_core_block_height()) + }) + .then_with(|| a.document.id().cmp(&b.document.id())) + }); + // We award the document to the top contender + let winner_info = if let Some(top_contender) = maybe_top_contender { + // let's check to make sure the lock votes didn't win it + // if the lock is tied with the top contender the top contender gets it + if result.locked_vote_tally > top_contender.final_vote_tally { + // the record will show it's locked + ContestedDocumentVotePollWinnerInfo::Locked + } else { + let contender_id = top_contender.identity_id; + // We award the document to the winner of the vote poll + self.award_document_to_winner( + block_info, + top_contender, + &resolved_contested_document_resource_vote_poll, + transaction, + platform_version, + )?; + ContestedDocumentVotePollWinnerInfo::WonByIdentity(contender_id) + } + } else { + ContestedDocumentVotePollWinnerInfo::NoWinner + }; + // We want to keep a record of how everyone voted + self.keep_record_of_finished_contested_resource_vote_poll( + block_platform_state, + block_info, + &resolved_contested_document_resource_vote_poll, + &identifiers_voting_for_contenders, + winner_info, + transaction, + platform_version, + )?; + Ok(ResolvedVotePollWithVotes::ContestedDocumentResourceVotePollWithContractInfoAndVotes(resolved_contested_document_resource_vote_poll, identifiers_voting_for_contenders)) + } + } + }).collect::, Error>>()?; + Ok((end_date, vote_polls_with_votes)) + }).collect::>, Error>>()?; + + // We need to clean up the vote polls + // This means removing it and also removing all current votes + if !vote_polls_with_info.is_empty() { + self.clean_up_after_vote_polls_end( + &vote_polls_with_info, + transaction, + platform_version, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/mod.rs new file mode 100644 index 00000000000..05a48ad45c7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::identifier::Identifier; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + pub(in crate::execution) fn clean_up_after_contested_resources_vote_polls_end( + &self, + vote_polls: Vec<( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .voting + .clean_up_after_contested_resources_vote_poll_end + { + 0 => self.clean_up_after_contested_resources_vote_polls_end_v0( + vote_polls, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "clean_up_after_contested_resources_vote_polls_end".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v0/mod.rs new file mode 100644 index 00000000000..f648ad27f86 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v0/mod.rs @@ -0,0 +1,124 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::identifier::Identifier; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::ProtocolError; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + #[inline(always)] + pub(super) fn clean_up_after_contested_resources_vote_polls_end_v0( + &self, + vote_polls: Vec<( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut operations = vec![]; + + // We remove the end date query + self.drive + .remove_contested_resource_vote_poll_end_date_query_operations( + vote_polls.as_slice(), + &mut operations, + transaction, + platform_version, + )?; + + // We remove the votes from under the contenders votes received + self.drive + .remove_contested_resource_vote_poll_votes_operations( + vote_polls.as_slice(), + true, + &mut operations, + transaction, + platform_version, + )?; + + // We remove the documents that contenders have + self.drive + .remove_contested_resource_vote_poll_documents_operations( + vote_polls.as_slice(), + &mut operations, + transaction, + platform_version, + )?; + + // We remove the contenders + self.drive + .remove_contested_resource_vote_poll_contenders_operations( + vote_polls.as_slice(), + &mut operations, + transaction, + platform_version, + )?; + + let vote_poll_ids = vote_polls + .iter() + .map(|(vote_poll, _, _)| Ok((*vote_poll, vote_poll.unique_id()?))) + .collect::, + ProtocolError, + >>()?; + + let mut identity_to_vote_ids_map: BTreeMap<&Identifier, Vec<&Identifier>> = BTreeMap::new(); + + for (vote_poll, _, voters_for_contender) in &vote_polls { + let vote_id = vote_poll_ids + .iter() + .find_map(|(vp, vid)| if vp == vote_poll { Some(vid) } else { None }) + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "the vote poll must exist in this lookup table", + )))?; + + for identifiers in voters_for_contender.values() { + for identity_id in identifiers { + identity_to_vote_ids_map + .entry(identity_id) + .or_default() + .push(vote_id); + } + } + } + + for (identity, vote_ids) in identity_to_vote_ids_map { + // We remove the identity votes given + self.drive + .remove_specific_vote_references_given_by_identity( + identity, + vote_ids.as_slice(), + &mut operations, + transaction, + platform_version, + )?; + } + + if !operations.is_empty() { + self.drive.apply_batch_low_level_drive_operations( + None, + transaction, + operations, + &mut vec![], + &platform_version.drive, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/mod.rs new file mode 100644 index 00000000000..d5089264b83 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/mod.rs @@ -0,0 +1,38 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use drive::drive::votes::resolved::vote_polls::ResolvedVotePollWithVotes; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + pub(in crate::execution) fn clean_up_after_vote_polls_end( + &self, + vote_polls: &BTreeMap>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .voting + .clean_up_after_vote_poll_end + { + 0 => self.clean_up_after_vote_polls_end_v0(vote_polls, transaction, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "clean_up_after_vote_polls_end".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/v0/mod.rs new file mode 100644 index 00000000000..20f39351ef7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/v0/mod.rs @@ -0,0 +1,54 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::identifier::Identifier; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::drive::votes::resolved::vote_polls::ResolvedVotePollWithVotes; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + #[inline(always)] + pub(super) fn clean_up_after_vote_polls_end_v0( + &self, + vote_polls: &BTreeMap>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // Create a vector to hold the references to the contested document resource vote polls + let mut contested_polls: Vec<( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )> = Vec::new(); + + // Iterate over the vote polls and match on the enum variant + for (end_date, vote_polls_for_time) in vote_polls { + for vote_poll in vote_polls_for_time { + match vote_poll { + ResolvedVotePollWithVotes::ContestedDocumentResourceVotePollWithContractInfoAndVotes(contested_poll, vote_info) => { + contested_polls.push((contested_poll, end_date, vote_info)); + } // Add more match arms here for other types of vote polls in the future + } + } + } + + if !contested_polls.is_empty() { + // Call the function to clean up contested document resource vote polls + self.clean_up_after_contested_resources_vote_polls_end( + contested_polls, + transaction, + platform_version, + ) + } else { + Ok(()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/keep_record_of_vote_poll/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/keep_record_of_vote_poll/mod.rs new file mode 100644 index 00000000000..b5743cbf504 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/keep_record_of_vote_poll/mod.rs @@ -0,0 +1,54 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Keeps a record of the vote poll after it has finished + pub(in crate::execution) fn keep_record_of_finished_contested_resource_vote_poll( + &self, + block_platform_state: &PlatformState, + block_info: &BlockInfo, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + contender_votes: &BTreeMap>, + winner_info: ContestedDocumentVotePollWinnerInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .voting + .keep_record_of_finished_contested_resource_vote_poll + { + 0 => self.keep_record_of_finished_contested_resource_vote_poll_v0( + block_platform_state, + block_info, + vote_poll, + contender_votes, + winner_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "keep_record_of_finished_contested_resource_vote_poll".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/keep_record_of_vote_poll/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/keep_record_of_vote_poll/v0/mod.rs new file mode 100644 index 00000000000..1eb1ea71f09 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/keep_record_of_vote_poll/v0/mod.rs @@ -0,0 +1,99 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::dashcore_rpc_json::MasternodeType; +use dpp::block::block_info::BlockInfo; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::ProTxHash; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use dpp::voting::contender_structs::FinalizedResourceVoteChoicesWithVoterInfo; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::error::drive::DriveError; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +impl Platform +where + C: CoreRPCLike, +{ + /// Keeps a record of the vote poll after it has finished + #[inline(always)] + pub(super) fn keep_record_of_finished_contested_resource_vote_poll_v0( + &self, + block_platform_state: &PlatformState, + block_info: &BlockInfo, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + contender_votes: &BTreeMap>, + winner_info: ContestedDocumentVotePollWinnerInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let finalized_resource_vote_choices_with_voter_infos = contender_votes + .iter() + .map(|(resource_vote_choice, voters)| { + let full_masternode_list = block_platform_state.full_masternode_list(); + let voters = voters + .iter() + .map(|pro_tx_hash_identifier| { + let strength = if let Some(masternode) = full_masternode_list.get( + &ProTxHash::from_byte_array(pro_tx_hash_identifier.to_buffer()), + ) { + match masternode.node_type { + MasternodeType::Regular => 1, + MasternodeType::Evo => 4, + } + } else { + 0 + }; + (*pro_tx_hash_identifier, strength) + }) + .collect(); + + FinalizedResourceVoteChoicesWithVoterInfo { + resource_vote_choice: *resource_vote_choice, + voters, + } + }) + .collect(); + let stored_info_from_disk = self + .drive + .fetch_contested_document_vote_poll_stored_info( + vote_poll, + None, + transaction, + platform_version, + )? + .1 + .ok_or(Error::Drive(drive::error::Error::Drive( + DriveError::CorruptedDriveState( + "there must be a record of the vote poll in the state".to_string(), + ), + )))?; + + // We perform an upgrade of the stored version just in case, most of the time this does nothing + let mut stored_info = stored_info_from_disk.update_to_latest_version(platform_version)?; + + // We need to construct the finalized contested document vote poll stored info + stored_info.finalize_vote_poll( + finalized_resource_vote_choices_with_voter_infos, + *block_info, + winner_info, + )?; + + // We reinsert the info + self.drive + .insert_stored_info_for_contested_resource_vote_poll( + vote_poll, + stored_info, + transaction, + platform_version, + )?; + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/mod.rs new file mode 100644 index 00000000000..326867bbcb7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/mod.rs @@ -0,0 +1,8 @@ +mod award_document_to_winner; +mod check_for_ended_vote_polls; +mod clean_up_after_contested_resources_vote_polls_end; +mod clean_up_after_vote_polls_end; +mod keep_record_of_vote_poll; +mod remove_votes_for_removed_masternodes; +mod run_dao_platform_events; +mod tally_votes_for_contested_document_resource_vote_poll; diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/remove_votes_for_removed_masternodes/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/remove_votes_for_removed_masternodes/mod.rs new file mode 100644 index 00000000000..8328eb0fc1c --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/remove_votes_for_removed_masternodes/mod.rs @@ -0,0 +1,41 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +mod v0; +impl Platform +where + C: CoreRPCLike, +{ + /// Removes the votes for removed masternodes + pub(in crate::execution) fn remove_votes_for_removed_masternodes( + &self, + last_committed_platform_state: &PlatformState, + block_platform_state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .voting + .remove_votes_for_removed_masternodes + { + 0 => self.remove_votes_for_removed_masternodes_v0( + last_committed_platform_state, + block_platform_state, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "remove_votes_for_removed_masternodes".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/remove_votes_for_removed_masternodes/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/remove_votes_for_removed_masternodes/v0/mod.rs new file mode 100644 index 00000000000..b0081570c75 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/remove_votes_for_removed_masternodes/v0/mod.rs @@ -0,0 +1,39 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dpp::dashcore::hashes::Hash; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +impl Platform +where + C: CoreRPCLike, +{ + /// Removes the votes for removed masternodes + pub(super) fn remove_votes_for_removed_masternodes_v0( + &self, + last_committed_platform_state: &PlatformState, + block_platform_state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let masternode_list_changes = + block_platform_state.full_masternode_list_changes(last_committed_platform_state); + + if !masternode_list_changes.removed_masternodes.is_empty() { + self.drive.remove_all_votes_given_by_identities( + masternode_list_changes + .removed_masternodes + .iter() + .map(|pro_tx_hash| pro_tx_hash.as_byte_array().to_vec()) + .collect(), + transaction, + platform_version, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/run_dao_platform_events/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/run_dao_platform_events/mod.rs new file mode 100644 index 00000000000..c9c3cab5b0e --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/run_dao_platform_events/mod.rs @@ -0,0 +1,44 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +mod v0; +impl Platform +where + C: CoreRPCLike, +{ + /// Runs the dao platform events + pub(in crate::execution) fn run_dao_platform_events( + &self, + block_info: &BlockInfo, + last_committed_platform_state: &PlatformState, + block_platform_state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .voting + .run_dao_platform_events + { + 0 => self.run_dao_platform_events_v0( + block_info, + last_committed_platform_state, + block_platform_state, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "run_dao_platform_events".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/run_dao_platform_events/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/run_dao_platform_events/v0/mod.rs new file mode 100644 index 00000000000..817067f58c0 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/run_dao_platform_events/v0/mod.rs @@ -0,0 +1,41 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +impl Platform +where + C: CoreRPCLike, +{ + pub(super) fn run_dao_platform_events_v0( + &self, + block_info: &BlockInfo, + last_committed_platform_state: &PlatformState, + block_platform_state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // Remove any votes that + + self.remove_votes_for_removed_masternodes( + last_committed_platform_state, + block_platform_state, + transaction, + platform_version, + )?; + + // Check for any vote polls that might have ended + + self.check_for_ended_vote_polls( + block_platform_state, + block_info, + transaction, + platform_version, + )?; + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/tally_votes_for_contested_document_resource_vote_poll/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/tally_votes_for_contested_document_resource_vote_poll/mod.rs new file mode 100644 index 00000000000..3a70992c5b2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/tally_votes_for_contested_document_resource_vote_poll/mod.rs @@ -0,0 +1,41 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use drive::grovedb::TransactionArg; +use drive::query::vote_poll_vote_state_query::FinalizedContestedDocumentVotePollDriveQueryExecutionResult; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Tally the votes for a contested resource vote poll + pub(in crate::execution) fn tally_votes_for_contested_document_resource_vote_poll( + &self, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePoll, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .voting + .tally_votes_for_contested_document_resource_vote_poll + { + 0 => self.tally_votes_for_contested_document_resource_vote_poll_v0( + contested_document_resource_vote_poll, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "tally_votes_for_contested_resource_vote_poll".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/tally_votes_for_contested_document_resource_vote_poll/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/tally_votes_for_contested_document_resource_vote_poll/v0/mod.rs new file mode 100644 index 00000000000..f3f2219223c --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/tally_votes_for_contested_document_resource_vote_poll/v0/mod.rs @@ -0,0 +1,45 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use drive::grovedb::TransactionArg; +use drive::query::vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, ContestedDocumentVotePollDriveQueryResultType, + FinalizedContestedDocumentVotePollDriveQueryExecutionResult, +}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + pub(super) fn tally_votes_for_contested_document_resource_vote_poll_v0( + &self, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePoll, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + //todo: try to figure out how to do this without a clone + //we start by only requesting the vote tally because we don't want to load all the documents + let query = ContestedDocumentVotePollDriveQuery { + vote_poll: contested_document_resource_vote_poll, + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + offset: None, + limit: Some( + platform_version + .drive_abci + .validation_and_processing + .event_constants + .maximum_contenders_to_consider, + ), + start_at: None, + allow_include_locked_and_abstaining_vote_tally: true, + }; + + let query_result = + query.execute_no_proof(&self.drive, transaction, &mut vec![], platform_version)?; + + Ok(query_result.try_into()?) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/mod.rs new file mode 100644 index 00000000000..de42c73bda7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/mod.rs @@ -0,0 +1,39 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::CoreRPCLike; +use dpp::dashcore::bls_sig_utils::BLSSignature; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Appends signatures to unsigned withdrawal transactions and broadcast them to Core + pub(in crate::execution) fn append_signatures_and_broadcast_withdrawal_transactions( + &self, + unsigned_withdrawal_transactions: UnsignedWithdrawalTxs, + signatures: Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .append_signatures_and_broadcast_withdrawal_transactions + { + 0 => self.append_signatures_and_broadcast_withdrawal_transactions_v0( + unsigned_withdrawal_transactions, + signatures, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "append_signatures_and_broadcast_withdrawal_transactions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs new file mode 100644 index 00000000000..22a3c4d555f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs @@ -0,0 +1,157 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::{ + CoreRPCLike, CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED, CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM, + CORE_RPC_TX_ALREADY_IN_CHAIN, +}; +use dashcore_rpc::jsonrpc; +use dashcore_rpc::Error as CoreRPCError; +use dpp::dashcore::bls_sig_utils::BLSSignature; +use dpp::dashcore::transaction::special_transaction::TransactionPayload::AssetUnlockPayloadType; +use dpp::dashcore::{consensus, Txid}; + +use std::fs::{self, File}; +use std::io::Write; +use std::path::Path; +use std::time::{SystemTime, UNIX_EPOCH}; + +impl Platform +where + C: CoreRPCLike, +{ + pub(super) fn append_signatures_and_broadcast_withdrawal_transactions_v0( + &self, + unsigned_withdrawal_transactions: UnsignedWithdrawalTxs, + signatures: Vec, + ) -> Result<(), Error> { + if unsigned_withdrawal_transactions.is_empty() { + return Ok(()); + } + + if unsigned_withdrawal_transactions.len() != signatures.len() { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "number of signatures must match number of withdrawal transactions", + ))); + } + + tracing::debug!( + "Broadcasting {} withdrawal transactions", + unsigned_withdrawal_transactions.len(), + ); + + let mut transaction_submission_failures = vec![]; + + for (mut transaction, signature) in + unsigned_withdrawal_transactions.into_iter().zip(signatures) + { + let Some(AssetUnlockPayloadType(mut payload)) = transaction.special_transaction_payload + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "withdrawal transaction payload must be AssetUnlockPayloadType", + ))); + }; + + payload.quorum_sig = signature; + + let index = payload.base.index; + + transaction.special_transaction_payload = Some(AssetUnlockPayloadType(payload)); + + let tx_bytes = consensus::serialize(&transaction); + + // TODO: We need to broadcast all or none of the transactions (in case of error) + // will be fixed in upcoming PR + match self.core_rpc.send_raw_transaction(&tx_bytes) { + Ok(_) => { + tracing::debug!( + tx_id = transaction.txid().to_hex(), + index, + "Successfully broadcasted withdrawal transaction with index {}", + index + ); + } + // Ignore errors that can happen during blockchain synchronization. + // They will be logged with dashcore_rpc + Err(CoreRPCError::JsonRpc(jsonrpc::error::Error::Rpc(e))) + if e.code == CORE_RPC_TX_ALREADY_IN_CHAIN + || e.message == CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM + || e.message == CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED => + { + // These will never work again + } + // Errors that can happen if we created invalid tx or Core isn't responding + Err(e) => { + tracing::warn!( + tx_id = transaction.txid().to_string(), + index, + "Failed to broadcast asset unlock transaction {}: {}", + index, + e + ); + // These errors might allow the state transition to be broadcast in the future + transaction_submission_failures.push((transaction.txid(), tx_bytes)); + } + } + } + + if let Some(ref rejections_path) = self.config.rejections_path { + store_transaction_failures(transaction_submission_failures, rejections_path) + .map_err(|e| Error::Execution(e.into()))?; + } + + Ok(()) + } +} + +// Function to handle the storage of transaction submission failures +fn store_transaction_failures( + failures: Vec<(Txid, Vec)>, + dir_path: &Path, +) -> std::io::Result<()> { + if failures.is_empty() { + return Ok(()); + } + + tracing::trace!( + "Store {} Asset Unlock transaction submission failures in {}", + failures.len(), + dir_path.display() + ); + + // Ensure the directory exists + fs::create_dir_all(dir_path).map_err(|e| { + std::io::Error::new( + e.kind(), + format!("cannot create dir {}: {}", dir_path.display(), e), + ) + })?; + + // Get the current timestamp + let timestamp = SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("expected system time to be after unix epoch time") + .as_secs(); + + for (tx_id, transaction) in failures { + // Create the file name + let file_name = dir_path.join(format!("tx_{}_{}.dat", timestamp, tx_id)); + + // Write the bytes to the file + let mut file = File::create(&file_name).map_err(|e| { + std::io::Error::new( + e.kind(), + format!("cannot create file {}: {}", file_name.display(), e), + ) + })?; + file.write_all(&transaction).map_err(|e| { + std::io::Error::new( + e.kind(), + format!("cannot write to file {}: {}", file_name.display(), e), + ) + })?; + } + + Ok(()) +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/mod.rs new file mode 100644 index 00000000000..e4cd110298d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/mod.rs @@ -0,0 +1,55 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::document::Document; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use drive::drive::identity::withdrawals::{ + WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes, +}; +use std::collections::HashMap; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Builds a list of Core transactions from withdrawal documents. This function is a version handler that + /// directs to specific version implementations of the `build_withdrawal_transactions_from_documents` function. + /// + /// # Arguments + /// + /// * `documents` - A slice of `Document`. + /// * `drive_operation_types` - A mutable reference to `Vec`. + /// * `transaction` - A `TransactionArg` reference. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result, Error>` - Returns a HashMap containing withdrawal transactions if found, otherwise returns an `Error`. + pub(in crate::execution::platform_events::withdrawals) fn build_untied_withdrawal_transactions_from_documents( + &self, + documents: &[Document], + start_index: WithdrawalTransactionIndex, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .build_untied_withdrawal_transactions_from_documents + { + 0 => { + self.build_untied_withdrawal_transactions_from_documents_v0(documents, start_index) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "build_untied_withdrawal_transactions_from_documents".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/v0/mod.rs new file mode 100644 index 00000000000..ea63771c63f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/v0/mod.rs @@ -0,0 +1,235 @@ +use std::collections::HashMap; + +use dashcore_rpc::dashcore::{ + blockdata::transaction::special_transaction::asset_unlock::{ + qualified_asset_unlock::ASSET_UNLOCK_TX_SIZE, + unqualified_asset_unlock::{AssetUnlockBasePayload, AssetUnlockBaseTransactionInfo}, + }, + consensus::Encodable, + ScriptBuf, TxOut, +}; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + +use drive::dpp::identifier::Identifier; +use drive::dpp::identity::convert_credits_to_duffs; +use drive::drive::identity::withdrawals::{ + WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes, +}; + +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Build list of Core transactions from withdrawal documents + pub(super) fn build_untied_withdrawal_transactions_from_documents_v0( + &self, + documents: &[Document], + start_index: WithdrawalTransactionIndex, + ) -> Result, Error> { + let mut withdrawals: HashMap = + HashMap::new(); + + for (i, document) in documents.iter().enumerate() { + let output_script_bytes = document + .properties() + .get_bytes(withdrawal::properties::OUTPUT_SCRIPT) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't get outputScript from withdrawal document", + )) + })?; + + let amount = document + .properties() + .get_integer(withdrawal::properties::AMOUNT) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't get amount from withdrawal document", + )) + })?; + + let core_fee_per_byte: u32 = document + .properties() + .get_integer(withdrawal::properties::CORE_FEE_PER_BYTE) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't get coreFeePerByte from withdrawal document", + )) + })?; + + let output_script = ScriptBuf::from_bytes(output_script_bytes); + + let tx_out = TxOut { + value: convert_credits_to_duffs(amount)?, + script_pubkey: output_script, + }; + + let transaction_index = start_index + i as WithdrawalTransactionIndex; + + let withdrawal_transaction = AssetUnlockBaseTransactionInfo { + version: 1, + lock_time: 0, + output: vec![tx_out], + base_payload: AssetUnlockBasePayload { + version: 1, + index: transaction_index, + fee: ASSET_UNLOCK_TX_SIZE as u32 * core_fee_per_byte, + }, + }; + + let mut transaction_buffer: Vec = vec![]; + + withdrawal_transaction + .consensus_encode(&mut transaction_buffer) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't consensus encode a withdrawal transaction", + )) + })?; + + withdrawals.insert(document.id(), (transaction_index, transaction_buffer)); + } + + Ok(withdrawals) + } +} + +#[cfg(test)] +mod tests { + + use dpp::withdrawal::Pooling; + use dpp::{ + data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, + }; + use drive::util::test_helpers::setup::setup_document; + + mod build_withdrawal_transactions_from_documents { + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contracts::withdrawals_contract::v1::document_types::withdrawal; + use dpp::identity::core_script::CoreScript; + use dpp::platform_value::platform_value; + use dpp::prelude::Identifier; + use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; + use dpp::version::PlatformVersion; + use drive::drive::identity::withdrawals::WithdrawalTransactionIndexAndBytes; + use drive::util::test_helpers::setup::setup_system_data_contract; + use itertools::Itertools; + + use crate::test::helpers::setup::TestPlatformBuilder; + + use super::*; + + #[test] + fn test_build() { + let platform_version = PlatformVersion::latest(); + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let transaction = platform.drive.grove.start_transaction(); + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); + + let owner_id = Identifier::new([1u8; 32]); + + let document_1 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, + "transactionIndex": 1u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &platform.drive, + &document_1, + &data_contract, + document_type, + Some(&transaction), + ); + + let document_2 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, + "transactionIndex": 2u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + setup_document( + &platform.drive, + &document_2, + &data_contract, + document_type, + Some(&transaction), + ); + + let documents = vec![document_1, document_2]; + + let transactions = platform + .build_untied_withdrawal_transactions_from_documents_v0(&documents, 50) + .expect("to build transactions from documents"); + + assert_eq!( + transactions + .values() + .cloned() + .sorted() + .collect::>(), + vec![ + ( + 50, + vec![ + 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, + 1, 50, 0, 0, 0, 0, 0, 0, 0, 190, 0, 0, 0 + ], + ), + ( + 51, + vec![ + 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, + 1, 51, 0, 0, 0, 0, 0, 0, 0, 190, 0, 0, 0 + ], + ), + ] + .into_iter() + .sorted() + .collect::>(), + ); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/mod.rs deleted file mode 100644 index a1f73a4753a..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/mod.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::abci::AbciError; -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::withdrawal::withdrawal_txs; -use crate::rpc::core::CoreRPCLike; -use dpp::bls_signatures; -use dpp::validation::SimpleValidationResult; -use dpp::version::PlatformVersion; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Version-dependent method that checks the validity of withdrawal transactions. - /// - /// Based on the `platform_version` passed, this function will route to the appropriate versioned - /// implementation of the `check_withdrawals` method. Each implementation will compare the received - /// withdrawal transactions with the expected ones, returning an error if they do not match. - /// - /// If a validator public key is provided, each versioned method also verifies the withdrawal - /// transactions' signatures. The `platform_version` parameter dictates which version of the - /// method to call. If an unsupported version is passed, the function will return an - /// `Error::Execution` with an `ExecutionError::UnknownVersionMismatch` error. - /// - /// # Arguments - /// - /// * `received_withdrawals` - The withdrawal transactions received. - /// * `our_withdrawals` - The expected withdrawal transactions. - /// * `height` - The block height. - /// * `round` - The consensus round. - /// * `verify_with_validator_public_key` - An optional reference to a validator public key. - /// * `quorum_hash` - An optional byte slice reference containing the quorum hash. - /// * `platform_version` - A `PlatformVersion` reference dictating which version of the method to call. - /// - /// # Returns - /// - /// * `Result, Error>` - On success, a `SimpleValidationResult` - /// containing an `AbciError` is returned. On error, an `Error` is returned. - /// - pub(crate) fn check_withdrawals( - &self, - received_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - our_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - height: u64, - round: u32, - verify_with_validator_public_key: Option<&bls_signatures::PublicKey>, - quorum_hash: Option<&[u8]>, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match platform_version - .drive_abci - .methods - .withdrawals - .check_withdrawals - { - 0 => Ok(self.check_withdrawals_v0( - received_withdrawals, - our_withdrawals, - height, - round, - verify_with_validator_public_key, - quorum_hash, - )), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "check_withdrawals".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs deleted file mode 100644 index 7c7594d1bb3..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs +++ /dev/null @@ -1,78 +0,0 @@ -use crate::abci::AbciError; -use crate::platform_types::platform::Platform; -use crate::platform_types::withdrawal::withdrawal_txs; -use crate::rpc::core::CoreRPCLike; -use dpp::bls_signatures; -use dpp::validation::SimpleValidationResult; - -impl Platform -where - C: CoreRPCLike, -{ - /// Checks if the received withdrawal transactions are correct and match the expected withdrawal transactions. - /// - /// This function compares the received withdrawal transactions with the expected ones. If they don't match, - /// an error is returned. If a validator public key is provided, the function also verifies the withdrawal - /// transactions' signatures. - /// - /// # Arguments - /// - /// * `received_withdrawals` - The withdrawal transactions received. - /// * `our_withdrawals` - The expected withdrawal transactions. - /// * `height` - The block height. - /// * `round` - The consensus round. - /// * `verify_with_validator_public_key` - An optional reference to a validator public key. - /// * `quorum_hash` - An optional byte slice reference containing the quorum hash. - /// - /// # Returns - /// - /// * `SimpleValidationResult` - If the received withdrawal transactions match the expected ones - /// and the signatures are valid (if provided), it returns a default `SimpleValidationResult`. Otherwise, - /// it returns a `SimpleValidationResult` with an error. - /// - pub(super) fn check_withdrawals_v0( - &self, - received_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - our_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - height: u64, - round: u32, - verify_with_validator_public_key: Option<&bls_signatures::PublicKey>, - quorum_hash: Option<&[u8]>, - ) -> SimpleValidationResult { - if received_withdrawals.ne(our_withdrawals) { - return SimpleValidationResult::new_with_error( - AbciError::VoteExtensionMismatchReceived { - got: received_withdrawals.to_string(), - expected: our_withdrawals.to_string(), - }, - ); - } - - // we only verify if verify_with_validator_public_key exists - if let Some(validator_public_key) = verify_with_validator_public_key { - let quorum_hash = quorum_hash.expect("quorum hash is required to verify signature"); - let validation_result = received_withdrawals.verify_signatures( - &self.config.abci.chain_id, - self.config.quorum_type(), - quorum_hash, - height, - round, - validator_public_key, - ); - - if validation_result.is_valid() { - SimpleValidationResult::default() - } else { - SimpleValidationResult::new_with_error( - validation_result - .errors - .into_iter() - .next() - .expect("expected an error"), - ) - } - } else { - SimpleValidationResult::default() - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/mod.rs new file mode 100644 index 00000000000..851c2081c4e --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/mod.rs @@ -0,0 +1,58 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; + +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; + +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Prepares a list of an unsigned withdrawal transaction bytes. This function is a version handler that + /// directs to specific version implementations of the `fetch_and_prepare_unsigned_withdrawal_transactions` function. + /// + /// # Arguments + /// + /// * `validator_set_quorum_hash` - A byte array. + /// * `block_execution_context` - A `BlockExecutionContext` reference. + /// * `transaction` - A `Transaction` reference. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result>, Error>` - Returns a Vector of unsigned withdrawal transactions if found, otherwise returns an `Error`. + pub(in crate::execution) fn dequeue_and_build_unsigned_withdrawal_transactions( + &self, + validator_set_quorum_hash: [u8; 32], + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .withdrawals + .dequeue_and_build_unsigned_withdrawal_transactions + { + 0 => self.dequeue_and_build_unsigned_withdrawal_transactions_v0( + validator_set_quorum_hash, + block_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "dequeue_and_build_unsigned_withdrawal_transactions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/v0/mod.rs new file mode 100644 index 00000000000..33edd099278 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/v0/mod.rs @@ -0,0 +1,192 @@ +use dashcore_rpc::dashcore::{ + blockdata::transaction::special_transaction::asset_unlock::request_info::AssetUnlockRequestInfo, + hashes::Hash, QuorumHash, +}; +use dpp::block::block_info::BlockInfo; +use dpp::dashcore::transaction::special_transaction::asset_unlock::qualified_asset_unlock::build_asset_unlock_tx; +use dpp::dashcore::Transaction; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::document::document_methods::DocumentMethodsV0; +use dpp::document::{Document, DocumentV0Setters}; +use dpp::version::PlatformVersion; + +use drive::dpp::system_data_contracts::withdrawals_contract; +use drive::dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use drive::query::TransactionArg; +use drive::util::batch::DriveOperation; + +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::CoreHeight; +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; +use dpp::errors::ProtocolError; + +use drive::config::DEFAULT_QUERY_LIMIT; + +const WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT: u16 = 16; + +impl Platform +where + C: CoreRPCLike, +{ + /// Prepares a list of an unsigned withdrawal transaction bytes + pub(super) fn dequeue_and_build_unsigned_withdrawal_transactions_v0( + &self, + validator_set_quorum_hash: [u8; 32], + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let mut drive_operations: Vec = vec![]; + + // Get 16 latest withdrawal transactions from the queue + let untied_withdrawal_transactions = self.drive.dequeue_untied_withdrawal_transactions( + WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT, + transaction, + &mut drive_operations, + platform_version, + )?; + + if untied_withdrawal_transactions.is_empty() { + return Ok(UnsignedWithdrawalTxs::default()); + } + + let transaction_indices = untied_withdrawal_transactions + .iter() + .map(|(transaction_id, _)| *transaction_id) + .collect::>(); + + let documents = self.fetch_and_modify_withdrawal_documents_to_broadcasted_by_indices( + &transaction_indices, + block_info, + transaction, + platform_version, + )?; + + tracing::debug!( + "Deque {} unsigned withdrawal transactions for signing with indices from {} to {}", + documents.len(), + transaction_indices.first().expect("must be present"), + transaction_indices.last().expect("must be present") + ); + + let withdrawals_contract = self.drive.cache.system_data_contracts.load_withdrawals(); + + self.drive.add_update_multiple_documents_operations( + &documents, + &withdrawals_contract, + withdrawals_contract + .document_type_for_name(withdrawal::NAME) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "could not get document type", + )) + })?, + &mut drive_operations, + &platform_version.drive, + )?; + + // Appending request_height and quorum_hash to withdrawal transaction + let unsigned_withdrawal_transactions = untied_withdrawal_transactions + .into_iter() + .map(|(_, untied_transaction_bytes)| { + build_unsigned_transaction( + untied_transaction_bytes, + validator_set_quorum_hash, + block_info.core_height, + ) + }) + .collect::>()?; + + self.drive.apply_drive_operations( + drive_operations, + true, + block_info, + transaction, + platform_version, + None, + )?; + + Ok(UnsignedWithdrawalTxs::from_vec( + unsigned_withdrawal_transactions, + )) + } + + fn fetch_and_modify_withdrawal_documents_to_broadcasted_by_indices( + &self, + transaction_indices: &[WithdrawalTransactionIndex], + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let documents = self + .drive + .find_withdrawal_documents_by_status_and_transaction_indices( + withdrawals_contract::WithdrawalStatus::POOLED, + transaction_indices, + DEFAULT_QUERY_LIMIT, + transaction, + platform_version, + )?; + + documents + .into_iter() + .map(|mut document| { + document.set_i64( + withdrawal::properties::STATUS, + withdrawals_contract::WithdrawalStatus::BROADCASTED as i64, + ); + + document.set_u64( + withdrawal::properties::TRANSACTION_SIGN_HEIGHT, + block_info.core_height as u64, + ); + + document.set_updated_at(Some(block_info.time_ms)); + + document.increment_revision().map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Could not increment document revision", + )) + })?; + + Ok(document) + }) + .collect() + } +} + +fn build_unsigned_transaction( + untied_transaction_bytes: Vec, + mut validator_set_quorum_hash: [u8; 32], + core_chain_locked_height: CoreHeight, +) -> Result { + // Core expects it reversed + validator_set_quorum_hash.reverse(); + + let request_info = AssetUnlockRequestInfo { + request_height: core_chain_locked_height, + quorum_hash: QuorumHash::from_byte_array(validator_set_quorum_hash), + }; + + let mut unsigned_transaction_bytes = vec![]; + + request_info + .consensus_append_to_base_encode( + untied_transaction_bytes.clone(), + &mut unsigned_transaction_bytes, + ) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "could not add additional request info to asset unlock transaction", + )) + })?; + + build_asset_unlock_tx(&unsigned_transaction_bytes) + .map_err(|error| Error::Protocol(ProtocolError::DashCoreError(error))) +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/mod.rs new file mode 100644 index 00000000000..0a4b17062eb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/mod.rs @@ -0,0 +1,52 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::json::AssetUnlockStatus; +use dpp::version::PlatformVersion; +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use std::collections::BTreeMap; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Fetch Core transactions by range of Core heights. This function is a version handler that + /// directs to specific version implementations of the `fetch_transactions_block_inclusion_status` function. + /// + /// # Arguments + /// + /// * `current_chain_locked_core_height` - The current chain locked core height + /// * `transactions` - A list of transactions to fetch. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result, Error>` - Returns a Vector of transaction hashes if found, otherwise returns an `Error`. + pub(in crate::execution::platform_events::withdrawals) fn fetch_transactions_block_inclusion_status( + &self, + current_chain_locked_core_height: u32, + withdrawal_indices: &[WithdrawalTransactionIndex], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .fetch_transactions_block_inclusion_status + { + 0 => self.fetch_transactions_block_inclusion_status_v0( + current_chain_locked_core_height, + withdrawal_indices, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "fetch_transactions_block_inclusion_status".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/v0/mod.rs new file mode 100644 index 00000000000..86433d8c03f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/v0/mod.rs @@ -0,0 +1,31 @@ +use dashcore_rpc::dashcore_rpc_json::AssetUnlockStatus; +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use std::collections::BTreeMap; + +use crate::{error::Error, platform_types::platform::Platform, rpc::core::CoreRPCLike}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Fetch Core transactions by range of Core heights + pub(super) fn fetch_transactions_block_inclusion_status_v0( + &self, + current_chain_locked_core_height: u32, + withdrawal_indices: &[WithdrawalTransactionIndex], + ) -> Result, Error> { + let asset_unlock_statuses_result = self + .core_rpc + .get_asset_unlock_statuses(withdrawal_indices, current_chain_locked_core_height)?; + + Ok(asset_unlock_statuses_result + .into_iter() + .map(|asset_unlock_status_result| { + ( + asset_unlock_status_result.index, + asset_unlock_status_result.status, + ) + }) + .collect()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs index 2c5c4be28ed..75412110566 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs @@ -1 +1,6 @@ -mod check_withdrawals; +pub(in crate::execution) mod append_signatures_and_broadcast_withdrawal_transactions; +pub(in crate::execution) mod build_untied_withdrawal_transactions_from_documents; +pub(in crate::execution) mod dequeue_and_build_unsigned_withdrawal_transactions; +pub(in crate::execution) mod fetch_transactions_block_inclusion_status; +pub(in crate::execution) mod pool_withdrawals_into_transactions_queue; +pub(in crate::execution) mod update_broadcasted_withdrawal_statuses; diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/mod.rs new file mode 100644 index 00000000000..910445fe326 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/mod.rs @@ -0,0 +1,53 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Pool withdrawal documents into transactions. This function is a version handler that + /// directs to specific version implementations of the `pool_withdrawals_into_transactions_queue` function. + /// + /// # Arguments + /// + /// * `block_execution_context` - A `BlockExecutionContext` reference that provides context for block execution. + /// * `transaction` - A `Transaction` reference representing the current transaction. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result<(), Error>` - Returns `Ok(())` if successful, otherwise returns an `Error`. + pub(in crate::execution) fn pool_withdrawals_into_transactions_queue( + &self, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .pool_withdrawals_into_transactions_queue + { + 0 => self.pool_withdrawals_into_transactions_queue_v0( + block_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "pool_withdrawals_into_transactions_queue".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/v0/mod.rs new file mode 100644 index 00000000000..9540d42f12f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/v0/mod.rs @@ -0,0 +1,281 @@ +use dpp::block::block_info::BlockInfo; + +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::document::document_methods::DocumentMethodsV0; +use dpp::document::{DocumentV0Getters, DocumentV0Setters}; + +use dpp::version::PlatformVersion; + +use drive::drive::identity::withdrawals::WithdrawalTransactionIndexAndBytes; +use drive::grovedb::TransactionArg; + +use dpp::system_data_contracts::withdrawals_contract; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; +use drive::config::DEFAULT_QUERY_LIMIT; + +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Pool withdrawal documents into transactions + pub(super) fn pool_withdrawals_into_transactions_queue_v0( + &self, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut documents = self.drive.fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::QUEUED.into(), + DEFAULT_QUERY_LIMIT, + transaction, + platform_version, + )?; + + if documents.is_empty() { + return Ok(()); + } + + let start_transaction_index = self + .drive + .fetch_next_withdrawal_transaction_index(transaction, platform_version)?; + + let untied_withdrawal_transactions = self + .build_untied_withdrawal_transactions_from_documents( + &documents, + start_transaction_index, + platform_version, + )?; + + for document in documents.iter_mut() { + let Some((transaction_index, _)) = untied_withdrawal_transactions.get(&document.id()) + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "transactions must contain a transaction", + ))); + }; + + document.set_u64( + withdrawal::properties::TRANSACTION_INDEX, + *transaction_index, + ); + + document.set_u8( + withdrawal::properties::STATUS, + withdrawals_contract::WithdrawalStatus::POOLED as u8, + ); + + document.set_updated_at(Some(block_info.time_ms)); + + document.increment_revision().map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Could not increment document revision", + )) + })?; + } + + let withdrawal_transactions: Vec = + untied_withdrawal_transactions.into_values().collect(); + + let withdrawal_transactions_count = withdrawal_transactions.len(); + + let mut drive_operations = Vec::new(); + + self.drive + .add_enqueue_untied_withdrawal_transaction_operations( + withdrawal_transactions, + &mut drive_operations, + platform_version, + )?; + + let end_transaction_index = start_transaction_index + withdrawal_transactions_count as u64; + + self.drive + .add_update_next_withdrawal_transaction_index_operation( + end_transaction_index, + &mut drive_operations, + platform_version, + )?; + + tracing::debug!( + "Pooled {} withdrawal documents into {} transactions with indices from {} to {}", + documents.len(), + withdrawal_transactions_count, + start_transaction_index, + end_transaction_index, + ); + + let withdrawals_contract = self.drive.cache.system_data_contracts.load_withdrawals(); + + self.drive.add_update_multiple_documents_operations( + &documents, + &withdrawals_contract, + withdrawals_contract + .document_type_for_name(withdrawal::NAME) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't fetch withdrawal data contract", + )) + })?, + &mut drive_operations, + &platform_version.drive, + )?; + + self.drive.apply_drive_operations( + drive_operations, + true, + block_info, + transaction, + platform_version, + None, + )?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use dpp::block::epoch::Epoch; + use itertools::Itertools; + + use dpp::data_contracts::SystemDataContract; + use dpp::identifier::Identifier; + use dpp::identity::core_script::CoreScript; + use dpp::tests::fixtures::get_withdrawal_document_fixture; + use dpp::withdrawal::Pooling; + use drive::util::test_helpers::setup::{setup_document, setup_system_data_contract}; + + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; + use dpp::platform_value::platform_value; + use dpp::system_data_contracts::load_system_data_contract; + use dpp::version::PlatformVersion; + + #[test] + fn test_pooling() { + let platform_version = PlatformVersion::latest(); + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let transaction = platform.drive.grove.start_transaction(); + + let block_info = BlockInfo { + time_ms: 1, + height: 1, + core_height: 96, + epoch: Epoch::default(), + }; + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); + + let owner_id = Identifier::new([1u8; 32]); + + let document_1 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, + "transactionIndex": 1u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &platform.drive, + &document_1, + &data_contract, + document_type, + Some(&transaction), + ); + + let document_2 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, + "transactionIndex": 2u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + setup_document( + &platform.drive, + &document_2, + &data_contract, + document_type, + Some(&transaction), + ); + + platform + .pool_withdrawals_into_transactions_queue_v0( + &block_info, + Some(&transaction), + platform_version, + ) + .expect("to pool withdrawal documents into transactions"); + + let updated_documents = platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::POOLED.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch withdrawal documents"); + + for (i, document) in updated_documents + .into_iter() + // Sort by index because updated_at is the same for all documents within batch + .sorted_by(|a, b| { + let a_index = a + .properties() + .get_u64(withdrawal::properties::TRANSACTION_INDEX) + .expect("to get transactionIndex"); + let b_index = b + .properties() + .get_u64(withdrawal::properties::TRANSACTION_INDEX) + .expect("to get transactionIndex"); + a_index.cmp(&b_index) + }) + .enumerate() + { + assert_eq!(document.revision(), Some(2)); + + let tx_index = document + .properties() + .get_u64(withdrawal::properties::TRANSACTION_INDEX) + .expect("to get transactionIndex"); + + assert_eq!(tx_index, i as u64); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs new file mode 100644 index 00000000000..6d5cade8e6e --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs @@ -0,0 +1,64 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; + +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Update statuses for broadcasted withdrawals + /// + /// This method is responsible for updating the status of withdrawal transactions that have been broadcasted and reached finality. + /// This is done based on the height of the last synced core block, which helps in determining whether the withdrawal + /// transaction has been completed or expired. + /// + /// # Arguments + /// + /// * `block_execution_context` - Contextual information about the current block execution. + /// * `transaction` - A transaction argument to interact with the underlying storage. + /// + /// # Returns + /// + /// * `Result<(), Error>` - Returns an Ok(()) if the statuses are successfully updated. + /// Otherwise, it returns an Error. + /// + /// # Errors + /// + /// This function may return an error if any of the following conditions are met: + /// + /// * There is an issue interacting with the underlying storage. + /// * There is an error fetching the withdrawal data contract. + /// * There is an error getting the transactionId or transactionSignHeight from the withdrawal document. + pub fn update_broadcasted_withdrawal_statuses( + &self, + block_info: &BlockInfo, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .update_broadcasted_withdrawal_statuses + { + 0 => self.update_broadcasted_withdrawal_statuses_v0( + block_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "update_broadcasted_withdrawal_statuses".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/v0/mod.rs new file mode 100644 index 00000000000..0257f293518 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/v0/mod.rs @@ -0,0 +1,327 @@ +use dashcore_rpc::json::AssetUnlockStatus; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contracts::withdrawals_contract::WithdrawalStatus; +use dpp::document::document_methods::DocumentMethodsV0; +use dpp::document::{DocumentV0Getters, DocumentV0Setters}; +use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; + +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; +use dpp::version::PlatformVersion; +use itertools::Itertools; +use std::collections::HashSet; + +use drive::config::DEFAULT_QUERY_LIMIT; +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use drive::grovedb::Transaction; +use drive::util::batch::DriveOperation; + +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; + +const NUMBER_OF_BLOCKS_BEFORE_EXPIRED: u32 = 48; + +impl Platform +where + C: CoreRPCLike, +{ + /// Update statuses for broadcasted withdrawals + pub(super) fn update_broadcasted_withdrawal_statuses_v0( + &self, + block_info: &BlockInfo, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let broadcasted_withdrawal_documents = + self.drive.fetch_oldest_withdrawal_documents_by_status( + WithdrawalStatus::BROADCASTED.into(), + DEFAULT_QUERY_LIMIT, + transaction.into(), + platform_version, + )?; + + if broadcasted_withdrawal_documents.is_empty() { + return Ok(()); + } + + // Collecting unique withdrawal indices + let broadcasted_withdrawal_indices = broadcasted_withdrawal_documents + .iter() + .map(|document| { + document + .properties() + .get_optional_u64(withdrawal::properties::TRANSACTION_INDEX)? + .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( + "Can't get transaction index from withdrawal document".to_string(), + ))) + }) + .collect::, Error>>()? + .into_iter() + .collect_vec(); + + let withdrawal_transaction_statuses = self.fetch_transactions_block_inclusion_status( + block_info.core_height, + &broadcasted_withdrawal_indices, + platform_version, + )?; + + let mut drive_operations: Vec = vec![]; + + // Collecting only documents that have been updated + let mut documents_to_update = Vec::new(); + + for mut document in broadcasted_withdrawal_documents { + let withdrawal_index = document + .properties() + .get_optional_u64(withdrawal::properties::TRANSACTION_INDEX)? + .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( + "Can't get transaction index from withdrawal document".to_string(), + )))?; + + let transaction_sign_height = document + .properties() + .get_optional_u64(withdrawal::properties::TRANSACTION_SIGN_HEIGHT)? + .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( + "Can't get transaction sign height from withdrawal document".to_string(), + )))? as u32; + + let withdrawal_transaction_status = withdrawal_transaction_statuses + .get(&withdrawal_index) + .unwrap_or_else(|| { + tracing::warn!( + "Withdrawal transaction with index {} is not found in Core", + withdrawal_index + ); + + &AssetUnlockStatus::Unknown + }); + + let block_height_difference = block_info.core_height - transaction_sign_height; + + let status = if withdrawal_transaction_status == &AssetUnlockStatus::Chainlocked { + tracing::debug!( + transaction_sign_height, + "Withdrawal with transaction index {} is marked as complete", + withdrawal_index + ); + + WithdrawalStatus::COMPLETE + } else if block_height_difference > NUMBER_OF_BLOCKS_BEFORE_EXPIRED { + tracing::debug!( + transaction_sign_height, + "Withdrawal with transaction index {} is marked as expired", + withdrawal_index + ); + + WithdrawalStatus::EXPIRED + } else { + continue; + }; + + document.set_u8(withdrawal::properties::STATUS, status.into()); + + document.set_updated_at(Some(block_info.time_ms)); + + document.increment_revision().map_err(Error::Protocol)?; + + documents_to_update.push(document); + } + + if documents_to_update.is_empty() { + return Ok(()); + } + + let withdrawals_contract = self.drive.cache.system_data_contracts.load_withdrawals(); + + self.drive.add_update_multiple_documents_operations( + &documents_to_update, + &withdrawals_contract, + withdrawals_contract + .document_type_for_name(withdrawal::NAME) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't fetch withdrawal data contract", + )) + })?, + &mut drive_operations, + &platform_version.drive, + )?; + + self.drive.apply_drive_operations( + drive_operations, + true, + block_info, + transaction.into(), + platform_version, + None, + )?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TestPlatformBuilder; + use dashcore_rpc::json::{AssetUnlockStatus, AssetUnlockStatusResult}; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::document::DocumentV0Getters; + use dpp::identity::core_script::CoreScript; + use dpp::platform_value::platform_value; + use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + use dpp::version::PlatformVersion; + use dpp::withdrawal::Pooling; + use dpp::{ + data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, + }; + use dpp::{ + prelude::Identifier, + system_data_contracts::{load_system_data_contract, SystemDataContract}, + }; + use drive::util::test_helpers::setup::setup_document; + use drive::util::test_helpers::setup::setup_system_data_contract; + + #[test] + fn test_statuses_are_updated() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let mut mock_rpc_client = MockCoreRPCLike::new(); + + mock_rpc_client + .expect_get_asset_unlock_statuses() + .returning(move |indices: &[u64], _core_chain_locked_height| { + Ok(indices + .iter() + .map(|index| { + let status = if index == &1 { + AssetUnlockStatus::Chainlocked + } else { + AssetUnlockStatus::Unknown + }; + + AssetUnlockStatusResult { + index: *index, + status, + } + }) + .collect()) + }); + + platform.core_rpc = mock_rpc_client; + + let transaction = platform.drive.grove.start_transaction(); + + let block_info = BlockInfo { + time_ms: 0, + height: 1, + core_height: 96, + epoch: Default::default(), + }; + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); + + let owner_id = Identifier::new([1u8; 32]); + + let document_1 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, + "transactionIndex": 1u64, + "transactionSignHeight": 1, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &platform.drive, + &document_1, + &data_contract, + document_type, + Some(&transaction), + ); + + let document_2 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, + "transactionIndex": 2u64, + "transactionSignHeight": 1, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + setup_document( + &platform.drive, + &document_2, + &data_contract, + document_type, + Some(&transaction), + ); + + platform + .update_broadcasted_withdrawal_statuses_v0(&block_info, &transaction, platform_version) + .expect("to update withdrawal statuses"); + + let documents = platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + WithdrawalStatus::EXPIRED.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch documents by status"); + + assert_eq!(documents.len(), 1); + assert_eq!( + documents.first().unwrap().id().to_vec(), + document_2.id().to_vec() + ); + + let documents = platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + WithdrawalStatus::COMPLETE.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch documents by status"); + + assert_eq!(documents.len(), 1); + assert_eq!( + documents.first().unwrap().id().to_vec(), + document_1.id().to_vec() + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/mod.rs b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/mod.rs new file mode 100644 index 00000000000..f2537eca34f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/mod.rs @@ -0,0 +1,32 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; +use drive::drive::Drive; +use drive::query::TransactionArg; + +mod v0; + +impl Platform { + /// Fetches execution state from grovedb storage + pub fn fetch_platform_state( + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .platform_state_storage + .fetch_platform_state + { + 0 => Platform::::fetch_platform_state_v0(drive, transaction, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "fetch_platform_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/v0/mod.rs new file mode 100644 index 00000000000..25960bf5b39 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/v0/mod.rs @@ -0,0 +1,24 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::serialization::PlatformDeserializableFromVersionedStructure; +use dpp::version::PlatformVersion; +use drive::drive::Drive; +use drive::query::TransactionArg; + +impl Platform { + pub(super) fn fetch_platform_state_v0( + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + drive + .fetch_platform_state_bytes(transaction, platform_version) + .map_err(Error::Drive)? + .map(|bytes| { + PlatformState::versioned_deserialize(&bytes, platform_version) + .map_err(Error::Protocol) + }) + .transpose() + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/mod.rs b/packages/rs-drive-abci/src/execution/storage/mod.rs new file mode 100644 index 00000000000..54302920e5d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/mod.rs @@ -0,0 +1,2 @@ +mod fetch_platform_state; +mod store_platform_state; diff --git a/packages/rs-drive-abci/src/execution/storage/store_platform_state/mod.rs b/packages/rs-drive-abci/src/execution/storage/store_platform_state/mod.rs new file mode 100644 index 00000000000..203b81d2019 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/store_platform_state/mod.rs @@ -0,0 +1,32 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; +use drive::query::TransactionArg; + +impl Platform { + /// Store the execution state in grovedb storage + pub fn store_platform_state( + &self, + state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .platform_state_storage + .store_platform_state + { + 0 => self.store_platform_state_v0(state, transaction, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "store_platform_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/store_platform_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/storage/store_platform_state/v0/mod.rs new file mode 100644 index 00000000000..a6d79b2b483 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/store_platform_state/v0/mod.rs @@ -0,0 +1,38 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::serialization::PlatformSerializable; +use dpp::version::PlatformVersion; +use drive::query::TransactionArg; + +impl Platform { + pub(super) fn store_platform_state_v0( + &self, + state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + #[cfg(feature = "testing-config")] + { + if self.config.testing_configs.store_platform_state { + self.drive + .store_platform_state_bytes( + &state.serialize_to_bytes()?, + transaction, + platform_version, + ) + .map_err(Error::Drive)?; + } + } + #[cfg(not(feature = "testing-config"))] + self.drive + .store_platform_state_bytes(&state.serialize_to_bytes()?, transaction, platform_version) + .map_err(Error::Drive)?; + + // We need to persist new protocol version as well be able to read block state + self.drive + .store_current_protocol_version(platform_version.protocol_version, transaction)?; + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs b/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs index 0ff0b617492..a0054fff7a9 100644 --- a/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs @@ -9,13 +9,12 @@ use crate::execution::types::block_execution_context::v0::{ use crate::execution::types::block_state_info::BlockStateInfo; use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; use derive_more::From; -use dpp::dashcore::Txid; -use std::collections::BTreeMap; use tenderdash_abci::proto::abci::ResponsePrepareProposal; /// The versioned block execution context -#[derive(Debug, From)] +#[derive(Debug, From, Clone)] pub enum BlockExecutionContext { /// Version 0 V0(v0::BlockExecutionContextV0), @@ -49,9 +48,9 @@ impl BlockExecutionContextV0Getters for BlockExecutionContext { } } - fn withdrawal_transactions(&self) -> &BTreeMap> { + fn unsigned_withdrawal_transactions(&self) -> &UnsignedWithdrawalTxs { match self { - BlockExecutionContext::V0(v0) => &v0.withdrawal_transactions, + BlockExecutionContext::V0(v0) => &v0.unsigned_withdrawal_transactions, } } @@ -87,9 +86,9 @@ impl BlockExecutionContextV0Setters for BlockExecutionContext { } } - fn set_withdrawal_transactions(&mut self, transactions: BTreeMap>) { + fn set_unsigned_withdrawal_transactions(&mut self, transactions: UnsignedWithdrawalTxs) { match self { - BlockExecutionContext::V0(v0) => v0.withdrawal_transactions = transactions, + BlockExecutionContext::V0(v0) => v0.unsigned_withdrawal_transactions = transactions, } } @@ -119,12 +118,6 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContext { } } - fn withdrawal_transactions_mut(&mut self) -> &mut BTreeMap> { - match self { - BlockExecutionContext::V0(v0) => v0.withdrawal_transactions_mut(), - } - } - fn block_platform_state_mut(&mut self) -> &mut PlatformState { match self { BlockExecutionContext::V0(v0) => v0.block_platform_state_mut(), @@ -136,6 +129,12 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContext { BlockExecutionContext::V0(v0) => v0.proposer_results_mut(), } } + + fn unsigned_withdrawal_transactions_mut(&mut self) -> &mut UnsignedWithdrawalTxs { + match self { + BlockExecutionContext::V0(v0) => v0.unsigned_withdrawal_transactions_mut(), + } + } } impl BlockExecutionContextV0OwnedGetters for BlockExecutionContext { @@ -153,13 +152,6 @@ impl BlockExecutionContextV0OwnedGetters for BlockExecutionContext { } } - /// Consumes the object and returns the owned `withdrawal_transactions`. - fn withdrawal_transactions_owned(self) -> BTreeMap> { - match self { - BlockExecutionContext::V0(v0) => v0.withdrawal_transactions, - } - } - /// Consumes the object and returns the owned `PlatformState`. fn block_platform_state_owned(self) -> PlatformState { match self { diff --git a/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs index 33cd7fa2f19..9276f1ff8a7 100644 --- a/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs @@ -31,12 +31,12 @@ use crate::execution::types::block_state_info::BlockStateInfo; use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform_state::PlatformState; -use dashcore_rpc::dashcore::Txid; -use std::collections::BTreeMap; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; + use tenderdash_abci::proto::abci::ResponsePrepareProposal; /// V0 of the Block execution context -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct BlockExecutionContextV0 { /// Block info pub block_state_info: BlockStateInfo, @@ -44,8 +44,8 @@ pub struct BlockExecutionContextV0 { pub epoch_info: EpochInfo, /// Total hpmn count pub hpmn_count: u32, - /// Current withdrawal transactions hash -> Transaction - pub withdrawal_transactions: BTreeMap>, + /// Unsigned withdrawal transactions to be available for extend and verify votes handlers + pub unsigned_withdrawal_transactions: UnsignedWithdrawalTxs, /// Block state pub block_platform_state: PlatformState, /// The response prepare proposal if proposed by us @@ -63,7 +63,7 @@ pub trait BlockExecutionContextV0Getters { fn hpmn_count(&self) -> u32; /// Returns a reference of the withdrawal_transactions field. - fn withdrawal_transactions(&self) -> &BTreeMap>; + fn unsigned_withdrawal_transactions(&self) -> &UnsignedWithdrawalTxs; /// Returns a reference of the block_platform_state field. fn block_platform_state(&self) -> &PlatformState; @@ -84,7 +84,7 @@ pub trait BlockExecutionContextV0Setters { fn set_hpmn_count(&mut self, count: u32); /// Sets the withdrawal_transactions field. - fn set_withdrawal_transactions(&mut self, transactions: BTreeMap>); + fn set_unsigned_withdrawal_transactions(&mut self, transactions: UnsignedWithdrawalTxs); /// Sets the block_platform_state field. fn set_block_platform_state(&mut self, state: PlatformState); @@ -101,14 +101,14 @@ pub trait BlockExecutionContextV0MutableGetters { /// Returns a mutable reference to the epoch_info field. fn epoch_info_mut(&mut self) -> &mut EpochInfo; - /// Returns a mutable reference to the withdrawal_transactions field. - fn withdrawal_transactions_mut(&mut self) -> &mut BTreeMap>; - /// Returns a mutable reference to the block_platform_state field. fn block_platform_state_mut(&mut self) -> &mut PlatformState; /// Returns a mutable reference to the proposer_results field. fn proposer_results_mut(&mut self) -> Option<&mut ResponsePrepareProposal>; + + /// Returns a mut reference of the withdrawal_transactions field. + fn unsigned_withdrawal_transactions_mut(&mut self) -> &mut UnsignedWithdrawalTxs; } /// A trait defining methods for interacting with a BlockExecutionContextV0. @@ -119,9 +119,6 @@ pub trait BlockExecutionContextV0OwnedGetters { /// Consumes the BlockExecutionContextV0 and returns the epoch_info field. fn epoch_info_owned(self) -> EpochInfo; - /// Consumes the BlockExecutionContextV0 and returns the withdrawal_transactions field. - fn withdrawal_transactions_owned(self) -> BTreeMap>; - /// Consumes the BlockExecutionContextV0 and returns the block_platform_state field. fn block_platform_state_owned(self) -> PlatformState; @@ -145,9 +142,9 @@ impl BlockExecutionContextV0Getters for BlockExecutionContextV0 { self.hpmn_count } - /// Returns a reference to the withdrawal_transactions field. - fn withdrawal_transactions(&self) -> &BTreeMap> { - &self.withdrawal_transactions + /// Returns a reference to the unsigned withdrawal transactions + fn unsigned_withdrawal_transactions(&self) -> &UnsignedWithdrawalTxs { + &self.unsigned_withdrawal_transactions } /// Returns a reference to the block_platform_state field. @@ -175,8 +172,8 @@ impl BlockExecutionContextV0Setters for BlockExecutionContextV0 { self.hpmn_count = count; } /// Sets the withdrawal_transactions field. - fn set_withdrawal_transactions(&mut self, transactions: BTreeMap>) { - self.withdrawal_transactions = transactions; + fn set_unsigned_withdrawal_transactions(&mut self, transactions: UnsignedWithdrawalTxs) { + self.unsigned_withdrawal_transactions = transactions; } /// Sets the block_platform_state field. fn set_block_platform_state(&mut self, state: PlatformState) { @@ -199,11 +196,6 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContextV0 { &mut self.epoch_info } - /// Returns a mutable reference to the withdrawal_transactions field. - fn withdrawal_transactions_mut(&mut self) -> &mut BTreeMap> { - &mut self.withdrawal_transactions - } - /// Returns a mutable reference to the block_platform_state field. fn block_platform_state_mut(&mut self) -> &mut PlatformState { &mut self.block_platform_state @@ -213,6 +205,10 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContextV0 { fn proposer_results_mut(&mut self) -> Option<&mut ResponsePrepareProposal> { self.proposer_results.as_mut() } + + fn unsigned_withdrawal_transactions_mut(&mut self) -> &mut UnsignedWithdrawalTxs { + &mut self.unsigned_withdrawal_transactions + } } impl BlockExecutionContextV0OwnedGetters for BlockExecutionContextV0 { @@ -226,11 +222,6 @@ impl BlockExecutionContextV0OwnedGetters for BlockExecutionContextV0 { self.epoch_info } - /// Consumes the object and returns the owned `BTreeMap` of withdrawal transactions. - fn withdrawal_transactions_owned(self) -> BTreeMap> { - self.withdrawal_transactions - } - /// Consumes the object and returns the owned `PlatformState`. fn block_platform_state_owned(self) -> PlatformState { self.block_platform_state diff --git a/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs b/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs index 86e794cc001..684bcaaa569 100644 --- a/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs @@ -11,7 +11,7 @@ use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; /// The versioned block state info -#[derive(Debug, From)] +#[derive(Debug, From, Clone, Eq, PartialEq)] pub enum BlockStateInfo { /// Version 0 V0(v0::BlockStateInfoV0), diff --git a/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs index 1b58804fdbb..8e3b405e651 100644 --- a/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs @@ -34,7 +34,7 @@ use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; /// Block info -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct BlockStateInfoV0 { /// Block height pub height: u64, diff --git a/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs b/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs index 9e799bd0648..1150faaca11 100644 --- a/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs @@ -2,77 +2,73 @@ mod v0; use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::execution::types::execution_event::ExecutionEvent::{ - PaidDriveEvent, PaidFromAssetLockDriveEvent, -}; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValueGettersV0; use dpp::block::epoch::Epoch; use dpp::fee::Credits; use dpp::identity::PartialIdentity; +use dpp::prelude::UserFeeIncrease; use dpp::version::PlatformVersion; use drive::state_transition_action::StateTransitionAction; -use drive::drive::batch::transitions::DriveHighLevelOperationConverter; -use drive::drive::batch::DriveOperation; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use drive::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use drive::state_transition_action::system::partially_use_asset_lock_action::PartiallyUseAssetLockActionAccessorsV0; +use drive::util::batch::DriveOperation; /// An execution event #[derive(Clone)] pub(in crate::execution) enum ExecutionEvent<'a> { /// A drive event that is paid by an identity - PaidDriveEvent { + Paid { /// The identity requesting the event identity: PartialIdentity, + /// The removed balance in the case of a transfer or withdrawal + removed_balance: Option, /// the operations that the identity is requesting to perform operations: Vec>, + /// the execution operations that we must also pay for + execution_operations: Vec, + /// the fee multiplier that the user agreed to, 0 means 100% of the base fee, 1 means 101% + user_fee_increase: UserFeeIncrease, + }, + /// A drive event that has a fixed cost that will be taken out in the operations + PaidFixedCost { + /// the operations that should be performed + operations: Vec>, + /// fees to add + fees_to_add_to_pool: Credits, }, /// A drive event that is paid from an asset lock - PaidFromAssetLockDriveEvent { + PaidFromAssetLock { /// The identity requesting the event identity: PartialIdentity, /// The added balance added_balance: Credits, /// the operations that should be performed operations: Vec>, + /// the execution operations that we must also pay for + execution_operations: Vec, + /// the fee multiplier that the user agreed to, 0 means 100% of the base fee, 1 means 101% + user_fee_increase: UserFeeIncrease, }, - /// A drive event that is free - FreeDriveEvent { + /// A drive event that is paid from an asset lock + PaidFromAssetLockWithoutIdentity { + /// The processing fees that should be distributed to validators + processing_fees: Credits, /// the operations that should be performed operations: Vec>, }, -} - -impl<'a> ExecutionEvent<'a> { - /// Creates a new identity Insertion Event - pub fn new_document_operation( - identity: PartialIdentity, - operation: DriveOperation<'a>, - ) -> Self { - Self::PaidDriveEvent { - identity, - operations: vec![operation], - } - } - /// Creates a new identity Insertion Event - pub fn new_contract_operation( - identity: PartialIdentity, - operation: DriveOperation<'a>, - ) -> Self { - Self::PaidDriveEvent { - identity, - operations: vec![operation], - } - } - /// Creates a new identity Insertion Event - pub fn new_identity_insertion( - identity: PartialIdentity, + /// A drive event that is free + #[allow(dead_code)] // TODO investigate why `variant `Free` is never constructed` + Free { + /// the operations that should be performed operations: Vec>, - ) -> Self { - Self::PaidDriveEvent { - identity, - operations, - } - } + }, } impl<'a> ExecutionEvent<'a> { @@ -80,46 +76,138 @@ impl<'a> ExecutionEvent<'a> { action: StateTransitionAction, identity: Option, epoch: &Epoch, + execution_context: StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result { match &action { StateTransitionAction::IdentityCreateAction(identity_create_action) => { + let user_fee_increase = identity_create_action.user_fee_increase(); let identity = identity_create_action.into(); let operations = action.into_high_level_drive_operations(epoch, platform_version)?; - Ok(PaidFromAssetLockDriveEvent { + Ok(ExecutionEvent::PaidFromAssetLock { identity, added_balance: 0, operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, }) } StateTransitionAction::IdentityTopUpAction(identity_top_up_action) => { - let added_balance = identity_top_up_action.top_up_balance_amount(); + let user_fee_increase = identity_top_up_action.user_fee_increase(); + let added_balance = identity_top_up_action + .top_up_asset_lock_value() + .remaining_credit_value(); let operations = action.into_high_level_drive_operations(epoch, platform_version)?; if let Some(identity) = identity { - Ok(PaidFromAssetLockDriveEvent { + Ok(ExecutionEvent::PaidFromAssetLock { identity, added_balance, operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, + }) + } else { + Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "partial identity should be present for identity top up action", + ))) + } + } + StateTransitionAction::PartiallyUseAssetLockAction(partially_used_asset_lock) => { + let used_credits = partially_used_asset_lock.used_credits(); + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + // We mark it as a free operation because the event itself is paying for itself + Ok(ExecutionEvent::PaidFromAssetLockWithoutIdentity { + processing_fees: used_credits, + operations, + }) + } + StateTransitionAction::IdentityCreditWithdrawalAction(identity_credit_withdrawal) => { + let user_fee_increase = identity_credit_withdrawal.user_fee_increase(); + let removed_balance = identity_credit_withdrawal.amount(); + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + if let Some(identity) = identity { + Ok(ExecutionEvent::Paid { + identity, + removed_balance: Some(removed_balance), + operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, }) } else { Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "partial identity should be present", + "partial identity should be present for identity credit withdrawal action", ))) } } + StateTransitionAction::IdentityCreditTransferAction(identity_credit_transfer) => { + let user_fee_increase = identity_credit_transfer.user_fee_increase(); + let removed_balance = identity_credit_transfer.transfer_amount(); + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + if let Some(identity) = identity { + Ok(ExecutionEvent::Paid { + identity, + removed_balance: Some(removed_balance), + operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, + }) + } else { + Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "partial identity should be present for identity credit transfer action", + ))) + } + } + StateTransitionAction::DocumentsBatchAction(document_batch_action) => { + let user_fee_increase = action.user_fee_increase(); + let removed_balance = document_batch_action.all_used_balances()?; + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + if let Some(identity) = identity { + Ok(ExecutionEvent::Paid { + identity, + removed_balance, + operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, + }) + } else { + Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "partial identity should be present for other state transitions", + ))) + } + } + StateTransitionAction::MasternodeVoteAction(_) => { + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + + Ok(ExecutionEvent::PaidFixedCost { + operations, + fees_to_add_to_pool: platform_version + .fee_version + .vote_resolution_fund_fees + .contested_document_single_vote_cost, + }) + } _ => { + let user_fee_increase = action.user_fee_increase(); let operations = action.into_high_level_drive_operations(epoch, platform_version)?; if let Some(identity) = identity { - Ok(PaidDriveEvent { + Ok(ExecutionEvent::Paid { identity, + removed_balance: None, operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, }) } else { Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "partial identity should be present", + "partial identity should be present for other state transitions", ))) } } diff --git a/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs b/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs index a15e2095c19..4024224e2e8 100644 --- a/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs @@ -1,14 +1,75 @@ +use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; +use dpp::identity::KeyCount; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; pub mod signature_verification_operation; #[derive(Debug, Clone, PartialEq, Eq)] -pub enum ExecutionOperation { +pub struct RetrieveIdentityInfo { + query_by_key_id_key_count: u16, + request_balance: bool, + request_revision: bool, +} + +impl RetrieveIdentityInfo { + pub fn only_balance() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 0, + request_balance: true, + request_revision: false, + } + } + + pub fn one_key() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 1, + request_balance: false, + request_revision: false, + } + } + + pub fn one_key_and_balance_and_revision() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 1, + request_balance: true, + request_revision: true, + } + } + + pub fn one_key_and_balance() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 1, + request_balance: true, + request_revision: false, + } + } + + pub fn one_key_and_revision() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 1, + request_balance: false, + request_revision: true, + } + } +} + +pub type HashBlockCount = u16; + +pub const SHA256_BLOCK_SIZE: u16 = 64; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ValidationOperation { + Protocol(ProtocolValidationOperation), + RetrieveIdentity(RetrieveIdentityInfo), + RetrievePrefundedSpecializedBalance, + SingleSha256(HashBlockCount), + DoubleSha256(HashBlockCount), + ValidateKeyStructure(KeyCount), // This is extremely cheap SignatureVerification(SignatureVerificationOperation), PrecalculatedOperation(FeeResult), } @@ -18,3 +79,139 @@ pub trait OperationLike { fn storage_cost(&self, platform_version: &PlatformVersion) -> Result; } + +impl ValidationOperation { + pub fn add_many_to_fee_result( + execution_operations: &[ValidationOperation], + fee_result: &mut FeeResult, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + for execution_operation in execution_operations { + match execution_operation { + ValidationOperation::SignatureVerification(signature_verification_operation) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add( + signature_verification_operation.processing_cost(platform_version)?, + ) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::PrecalculatedOperation(precalculated_operation) => { + fee_result.checked_add_assign(precalculated_operation.clone())?; + } + ValidationOperation::SingleSha256(block_count) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add( + platform_version.fee_version.hashing.single_sha256_base + + platform_version.fee_version.hashing.sha256_per_block + * (*block_count as u64), + ) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::DoubleSha256(block_count) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add( + platform_version.fee_version.hashing.single_sha256_base + + platform_version.fee_version.hashing.sha256_per_block + * (*block_count as u64), + ) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::RetrieveIdentity(RetrieveIdentityInfo { + query_by_key_id_key_count, + request_balance, + request_revision, + }) => { + let base_cost = match (request_balance, request_revision) { + (true, true) => { + platform_version + .fee_version + .processing + .fetch_identity_balance_and_revision_processing_cost + } + (true, false) => { + platform_version + .fee_version + .processing + .fetch_identity_revision_processing_cost + } + (false, true) => { + platform_version + .fee_version + .processing + .fetch_identity_balance_processing_cost + } + (false, false) => 0, + }; + + let key_cost = platform_version + .fee_version + .processing + .fetch_identity_cost_per_look_up_key_by_id + .checked_mul(*query_by_key_id_key_count as u64) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + + let operation_cost = + base_cost + .checked_add(key_cost) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + + fee_result.processing_fee = fee_result + .processing_fee + .checked_add(operation_cost) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::RetrievePrefundedSpecializedBalance => { + let operation_cost = platform_version + .fee_version + .processing + .fetch_prefunded_specialized_balance_processing_cost; + + fee_result.processing_fee = fee_result + .processing_fee + .checked_add(operation_cost) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::ValidateKeyStructure(key_count) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add( + platform_version + .fee_version + .processing + .validate_key_structure + * (*key_count as u64), + ) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::Protocol(dpp_validation_operation) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add(dpp_validation_operation.processing_cost(platform_version)) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + } + } + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/types/fees_in_pools/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/fees_in_pools/v0/mod.rs index 8ea59905f0f..0722a753dfe 100644 --- a/packages/rs-drive-abci/src/execution/types/fees_in_pools/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/fees_in_pools/v0/mod.rs @@ -1,5 +1,6 @@ use dpp::fee::Credits; use serde::{Deserialize, Serialize}; +use std::fmt; /// Struct containing the amount of processing and storage fees in the distribution pools #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)] @@ -9,3 +10,12 @@ pub struct FeesInPoolsV0 { /// Amount of storage fees in the distribution pools pub storage_fees: Credits, } + +impl fmt::Display for FeesInPoolsV0 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "FeesInPoolsV0 {{")?; + writeln!(f, " processing_fees: {},", self.processing_fees)?; + writeln!(f, " storage_fees: {}", self.storage_fees)?; + write!(f, "}}") + } +} diff --git a/packages/rs-drive-abci/src/execution/types/mod.rs b/packages/rs-drive-abci/src/execution/types/mod.rs index 1a50965d3d6..ba0208c1743 100644 --- a/packages/rs-drive-abci/src/execution/types/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/mod.rs @@ -15,10 +15,13 @@ pub(in crate::execution) mod processed_block_fees_outcome; /// Proposer payouts pub(in crate::execution) mod proposer_payouts; /// A structure representing the context of the execution of a state transition -pub(in crate::execution) mod state_transition_execution_context; +pub mod state_transition_execution_context; /// A structure used in the distribution of storage fees pub(in crate::execution) mod storage_fee_distribution_outcome; /// A structure representing an unpaid epoch pub(in crate::execution) mod unpaid_epoch; /// A structure representing the outcome of updating a masternode list in the state pub(in crate::execution) mod update_state_masternode_list_outcome; + +/// A container for the state transitions +pub(in crate::execution) mod state_transition_container; diff --git a/packages/rs-drive-abci/src/execution/types/processed_block_fees_outcome/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/processed_block_fees_outcome/v0/mod.rs index fb48bf8d992..46d7bea3605 100644 --- a/packages/rs-drive-abci/src/execution/types/processed_block_fees_outcome/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/processed_block_fees_outcome/v0/mod.rs @@ -1,4 +1,5 @@ use crate::execution::types::{fees_in_pools, proposer_payouts}; +use std::fmt; /// Holds info relevant fees and a processed block #[derive(Debug)] @@ -10,3 +11,27 @@ pub struct ProcessedBlockFeesOutcome { /// A number of epochs which had refunded pub refunded_epochs_count: Option, } + +impl fmt::Display for ProcessedBlockFeesOutcome { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "ProcessedBlockFeesOutcome {{")?; + writeln!(f, " fees_in_pools: {},", self.fees_in_pools)?; + writeln!( + f, + " payouts: {},", + match &self.payouts { + Some(payouts) => format!("{}", payouts), + None => "None".to_string(), + } + )?; + writeln!( + f, + " refunded_epochs_count: {}", + match self.refunded_epochs_count { + Some(count) => count.to_string(), + None => "None".to_string(), + } + )?; + write!(f, "}}") + } +} diff --git a/packages/rs-drive-abci/src/execution/types/proposer_payouts/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/proposer_payouts/v0/mod.rs index c239150a834..767fa57e781 100644 --- a/packages/rs-drive-abci/src/execution/types/proposer_payouts/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/proposer_payouts/v0/mod.rs @@ -1,4 +1,5 @@ use dpp::block::epoch::EpochIndex; +use std::fmt; /// Struct containing the number of proposers to be paid and the index of the epoch /// they're to be paid from. @@ -9,3 +10,16 @@ pub struct ProposersPayouts { /// Index of last epoch marked as paid pub paid_epoch_index: EpochIndex, } + +impl fmt::Display for ProposersPayouts { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "ProposersPayouts {{")?; + writeln!( + f, + " proposers_paid_count: {},", + self.proposers_paid_count + )?; + writeln!(f, " paid_epoch_index: {}", self.paid_epoch_index)?; + write!(f, "}}") + } +} diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_container/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_container/mod.rs new file mode 100644 index 00000000000..664247ca31e --- /dev/null +++ b/packages/rs-drive-abci/src/execution/types/state_transition_container/mod.rs @@ -0,0 +1,42 @@ +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, StateTransitionContainerV0, +}; +use derive_more::From; + +pub(crate) mod v0; + +#[derive(Debug, From)] +pub enum StateTransitionContainer<'a> { + V0(StateTransitionContainerV0<'a>), +} + +impl<'a> IntoIterator for &'a StateTransitionContainer<'a> { + type Item = &'a DecodedStateTransition<'a>; + type IntoIter = std::slice::Iter<'a, DecodedStateTransition<'a>>; + + fn into_iter(self) -> Self::IntoIter { + match self { + StateTransitionContainer::V0(v0) => v0.into_iter(), + } + } +} + +impl<'a> IntoIterator for StateTransitionContainer<'a> { + type Item = DecodedStateTransition<'a>; + type IntoIter = std::vec::IntoIter>; + + fn into_iter(self) -> Self::IntoIter { + match self { + StateTransitionContainer::V0(v0) => v0.into_iter(), + } + } +} + +#[allow(clippy::from_over_into)] +impl<'a> Into>> for StateTransitionContainer<'a> { + fn into(self) -> Vec> { + match self { + StateTransitionContainer::V0(v0) => v0.into(), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_container/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_container/v0/mod.rs new file mode 100644 index 00000000000..1cf580930d5 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/types/state_transition_container/v0/mod.rs @@ -0,0 +1,76 @@ +use dpp::consensus::ConsensusError; +use dpp::state_transition::StateTransition; +use dpp::ProtocolError; +use std::time::Duration; + +/// Decoded state transition result +#[derive(Debug)] +pub enum DecodedStateTransition<'a> { + SuccessfullyDecoded(SuccessfullyDecodedStateTransition<'a>), + InvalidEncoding(InvalidStateTransition<'a>), + FailedToDecode(InvalidWithProtocolErrorStateTransition<'a>), +} + +/// Invalid encoded state transition +#[derive(Debug)] +pub struct InvalidStateTransition<'a> { + pub raw: &'a [u8], + pub error: ConsensusError, + pub elapsed_time: Duration, +} + +/// State transition that failed to decode +#[derive(Debug)] +pub struct InvalidWithProtocolErrorStateTransition<'a> { + pub raw: &'a [u8], + pub error: ProtocolError, + pub elapsed_time: Duration, +} + +/// Successfully decoded state transition +#[derive(Debug)] +pub struct SuccessfullyDecodedStateTransition<'a> { + pub decoded: StateTransition, + pub raw: &'a [u8], + pub elapsed_time: Duration, +} + +/// This is a container that holds state transitions +#[derive(Debug)] +pub struct StateTransitionContainerV0<'a> { + // We collect all decoding results in the same vector because we want to + // keep the original input order when we process them and log results we can + // easily match with txs in block + state_transitions: Vec>, +} + +impl<'a> StateTransitionContainerV0<'a> { + pub fn new(state_transitions: Vec>) -> Self { + Self { state_transitions } + } +} + +impl<'a> IntoIterator for &'a StateTransitionContainerV0<'a> { + type Item = &'a DecodedStateTransition<'a>; + type IntoIter = std::slice::Iter<'a, DecodedStateTransition<'a>>; + + fn into_iter(self) -> Self::IntoIter { + self.state_transitions.iter() + } +} + +impl<'a> IntoIterator for StateTransitionContainerV0<'a> { + type Item = DecodedStateTransition<'a>; + type IntoIter = std::vec::IntoIter>; + + fn into_iter(self) -> Self::IntoIter { + self.state_transitions.into_iter() + } +} + +#[allow(clippy::from_over_into)] +impl<'a> Into>> for StateTransitionContainerV0<'a> { + fn into(self) -> Vec> { + self.state_transitions + } +} diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs index a3b397de511..4d9ede1066c 100644 --- a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs @@ -1,48 +1,75 @@ use crate::error::execution::ExecutionError; -use crate::execution::types::execution_operation::ExecutionOperation; +use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; use crate::execution::types::state_transition_execution_context::v0::StateTransitionExecutionContextV0; use derive_more::From; +use dpp::fee::fee_result::FeeResult; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; +/// V0 module pub mod v0; #[derive(Debug, Clone, From)] +/// The state transition execution context pub enum StateTransitionExecutionContext { + /// Version 0 V0(StateTransitionExecutionContextV0), } +/// The trait defining state transition execution context methods for v0 pub trait StateTransitionExecutionContextMethodsV0 { - fn add_operation(&mut self, operation: ExecutionOperation); - fn add_operations(&mut self, operations: Vec); - fn operations_consume(self) -> Vec; - fn operations_slice(&self) -> &[ExecutionOperation]; + /// Add an operation to the state transition execution context + fn add_operation(&mut self, operation: ValidationOperation); + /// Add operations to the state transition execution context + fn add_operations(&mut self, operations: Vec); + /// Add dpp operations to the state transition execution context + fn add_dpp_operations(&mut self, operations: Vec); + /// Consume the operations of the context + fn operations_consume(self) -> Vec; + /// Returns a slice of operations, does not consume the context + fn operations_slice(&self) -> &[ValidationOperation]; + /// Are we in a dry run? fn in_dry_run(&self) -> bool; + /// Set us to be in a dry run fn enable_dry_run(&mut self); + /// Set us not to be in a dry run fn disable_dry_run(&mut self); + + /// Get the fee costs of all operations in the execution context + fn fee_cost(&self, platform_version: &PlatformVersion) -> Result; } impl StateTransitionExecutionContextMethodsV0 for StateTransitionExecutionContext { - fn add_operation(&mut self, operation: ExecutionOperation) { + fn add_operation(&mut self, operation: ValidationOperation) { match self { StateTransitionExecutionContext::V0(v0) => v0.operations.push(operation), } } - fn add_operations(&mut self, operations: Vec) { + fn add_operations(&mut self, operations: Vec) { match self { StateTransitionExecutionContext::V0(v0) => v0.operations.extend(operations), } } - fn operations_consume(self) -> Vec { + fn add_dpp_operations(&mut self, operations: Vec) { + match self { + StateTransitionExecutionContext::V0(v0) => v0 + .operations + .extend(operations.into_iter().map(ValidationOperation::Protocol)), + } + } + + fn operations_consume(self) -> Vec { match self { StateTransitionExecutionContext::V0(v0) => v0.operations, } } - fn operations_slice(&self) -> &[ExecutionOperation] { + fn operations_slice(&self) -> &[ValidationOperation] { match self { StateTransitionExecutionContext::V0(v0) => v0.operations.as_slice(), } @@ -65,6 +92,19 @@ impl StateTransitionExecutionContextMethodsV0 for StateTransitionExecutionContex StateTransitionExecutionContext::V0(v0) => v0.dry_run = false, } } + fn fee_cost(&self, platform_version: &PlatformVersion) -> Result { + match self { + StateTransitionExecutionContext::V0(v0) => { + let mut fee_result = FeeResult::default(); + ValidationOperation::add_many_to_fee_result( + v0.operations.as_slice(), + &mut fee_result, + platform_version, + )?; + Ok(fee_result) + } + } + } } impl DefaultForPlatformVersion for StateTransitionExecutionContext { diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs index dbf0c508252..d3c6330e5b1 100644 --- a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs @@ -1,9 +1,12 @@ -use crate::execution::types::execution_operation::ExecutionOperation; +use crate::execution::types::execution_operation::ValidationOperation; +/// The V0 struct of the state transition execution context #[derive(Debug, Clone, Default)] pub struct StateTransitionExecutionContextV0 { // Are we executing the state transition in a dry run // Dry run is execution on check tx + /// Are we in a dry run? pub dry_run: bool, - pub operations: Vec, + /// The execution operations + pub operations: Vec, } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/mod.rs new file mode 100644 index 00000000000..c389fbd3e61 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/mod.rs @@ -0,0 +1,48 @@ +pub(crate) mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::execution_event::ExecutionEvent; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::StateTransition; +use dpp::version::PlatformVersion; + +use crate::execution::check_tx::CheckTxLevel; + +/// === CHECK TX: NEW ==== +/// Full validation for identity create and identity top up +/// Otherwise only validate: +/// * identity has enough balance for fee +/// * identity signature on tx is valid +/// * ST structure is valid +/// +/// === CHECK TX: RECHECK === +/// For identity create and identity top up, make sure asset lock has not been used up +/// For other state transitions verify that the user still has enough balance +/// +pub(in crate::execution) fn state_transition_to_execution_event_for_check_tx<'a, C: CoreRPCLike>( + platform: &'a PlatformRef, + state_transition: StateTransition, + check_tx_level: CheckTxLevel, + platform_version: &PlatformVersion, +) -> Result>>, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transition_to_execution_event_for_check_tx + { + 0 => v0::state_transition_to_execution_event_for_check_tx_v0( + platform, + state_transition, + check_tx_level, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "state_transition_to_execution_event_for_check_tx".to_string(), + known_versions: vec![0], + received: version, + })), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs new file mode 100644 index 00000000000..b48464fd3cb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs @@ -0,0 +1,289 @@ +use crate::error::Error; +use crate::execution::types::execution_event::ExecutionEvent; +use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::platform_types::platform::PlatformRef; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::rpc::core::CoreRPCLike; +use dpp::identity::state_transition::OptionallyAssetLockProved; +use dpp::prelude::ConsensusValidationResult; +use dpp::serialization::Signable; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::ProtocolError; + +use dpp::state_transition::StateTransition; +use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; +use crate::error::execution::ExecutionError; +use crate::execution::check_tx::CheckTxLevel; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; +use crate::execution::validation::state_transition::processor::v0::{StateTransitionIdentityBalanceValidationV0, StateTransitionBasicStructureValidationV0, StateTransitionNonceValidationV0, StateTransitionIdentityBasedSignatureValidationV0, StateTransitionStructureKnownInStateValidationV0}; +use crate::execution::validation::state_transition::ValidationMode; + +pub(super) fn state_transition_to_execution_event_for_check_tx_v0<'a, C: CoreRPCLike>( + platform: &'a PlatformRef, + state_transition: StateTransition, + check_tx_level: CheckTxLevel, + platform_version: &PlatformVersion, +) -> Result>>, Error> { + // we need to validate the structure, the fees, and the signature + let mut state_transition_execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version)?; + + #[allow(unreachable_patterns)] + match check_tx_level { + CheckTxLevel::FirstTimeCheck => { + // Only identity top up and identity create do not have nonces validation + if state_transition.has_nonces_validation() { + let result = state_transition.validate_nonces( + &platform.into(), + platform.state.last_block_info(), + None, + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + // Only Data contract update does not have basic structure validation + if state_transition.has_basic_structure_validation() { + // First we validate the basic structure + let result = state_transition.validate_basic_structure(platform_version)?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + // Only identity create does not use identity in state validation, because it doesn't yet have the identity in state + let mut maybe_identity = if state_transition.uses_identity_in_state() { + // Validating signature for identity based state transitions (all those except identity create and identity top up) + // As we already have removed identity create above, it just splits between identity top up (below - false) and + // all other state transitions (above - true) + let result = if state_transition.validates_signature_based_on_identity_info() { + state_transition.validate_identity_signed_state_transition( + platform.drive, + None, + &mut state_transition_execution_context, + platform_version, + ) + } else { + state_transition.retrieve_identity_info( + platform.drive, + None, + &mut state_transition_execution_context, + platform_version, + ) + }?; + if !result.is_valid() { + // If the signature is not valid or if we could not retrieve identity info + // we do not have the user pay for the state transition. + // Since it is most likely not from them + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + Some(result.into_data()?) + } else { + None + }; + + let action = if state_transition + .requires_advanced_structure_validation_with_state_on_check_tx() + { + let state_transition_action_result = state_transition.transform_into_action( + platform, + platform.state.last_block_info(), + ValidationMode::CheckTx, + &mut state_transition_execution_context, + None, + )?; + if !state_transition_action_result.is_valid_with_data() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + state_transition_action_result.errors, + ), + ); + } + let action = state_transition_action_result.into_data()?; + + // Validating structure + let result = state_transition.validate_advanced_structure_from_state( + &action, + maybe_identity.as_ref(), + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + Some(action) + } else { + None + }; + + // For identity credit withdrawal and identity credit transfers we have a balance pre check that includes a + // processing amount and the transfer amount. + // For other state transitions we only check a min balance for an amount set per version. + // This is not done for identity create and identity top up who don't have this check here + if state_transition.has_balance_pre_check_validation() { + // Validating that we have sufficient balance for a transfer or withdrawal, + // this must happen after validating the signature + let identity = + maybe_identity + .as_mut() + .ok_or(ProtocolError::CorruptedCodeExecution( + "identity must be known to validate the balance".to_string(), + ))?; + + let result = state_transition + .validate_minimum_balance_pre_check(identity, platform_version)?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + let action = if let Some(action) = action { + action + } else { + let state_transition_action_result = state_transition.transform_into_action( + platform, + platform.state.last_block_info(), + ValidationMode::CheckTx, + &mut state_transition_execution_context, + None, + )?; + if !state_transition_action_result.is_valid_with_data() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + state_transition_action_result.errors, + ), + ); + } + state_transition_action_result.into_data()? + }; + + let execution_event = ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + )?; + + Ok( + ConsensusValidationResult::>::new_with_data(Some( + execution_event, + )), + ) + } + CheckTxLevel::Recheck => { + if let Some(asset_lock_proof) = state_transition.optional_asset_lock_proof() { + let mut signable_bytes_hasher = + SignableBytesHasher::Bytes(state_transition.signable_bytes()?); + // we should check that the asset lock is still valid + let validation_result = asset_lock_proof + .verify_is_not_spent_and_has_enough_balance( + platform, + &mut signable_bytes_hasher, + state_transition + .required_asset_lock_balance_for_processing_start(platform_version), + None, + platform_version, + )?; + + if validation_result.is_valid() { + Ok(ConsensusValidationResult::>::new_with_data(None)) + } else { + Ok( + ConsensusValidationResult::>::new_with_errors( + validation_result.errors, + ), + ) + } + } else { + if state_transition.has_nonces_validation() { + let result = state_transition.validate_nonces( + &platform.into(), + platform.state.last_block_info(), + None, + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + let state_transition_action_result = state_transition.transform_into_action( + platform, + platform.state.last_block_info(), + ValidationMode::RecheckTx, + &mut state_transition_execution_context, + None, + )?; + + if !state_transition_action_result.is_valid_with_data() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + state_transition_action_result.errors, + ), + ); + } + let action = state_transition_action_result.into_data()?; + + let maybe_identity = platform.drive.fetch_identity_with_balance( + state_transition.owner_id().to_buffer(), + None, + platform_version, + )?; + + let execution_event = ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + )?; + + Ok( + ConsensusValidationResult::>::new_with_data(Some( + execution_event, + )), + ) + } + } + _ => Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "CheckTxLevel must be first time check or recheck", + ))), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/chain/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/chain/mod.rs deleted file mode 100644 index bcca8030c28..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/chain/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; -use dpp::consensus::basic::identity::{ - IdentityAssetLockTransactionOutPointAlreadyExistsError, - InvalidAssetLockProofCoreChainHeightError, -}; -use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; -use dpp::platform_value::Bytes36; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use drive::grovedb::TransactionArg; - -// TODO: Versioning -impl AssetLockProofStateValidation for ChainAssetLockProof { - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - if platform_ref.block_info.core_height < self.core_chain_locked_height { - result.add_error(InvalidAssetLockProofCoreChainHeightError::new( - self.core_chain_locked_height, - platform_ref.block_info.core_height, - )); - - return Ok(result); - } - - // Make sure that asset lock isn't spent yet - - let outpoint_bytes = self.out_point.try_into().map_err(|e| { - Error::Execution(ExecutionError::Conversion(String::from( - "can't convert output to bytes", - ))) - })?; - - let is_already_spent = platform_ref.drive.has_asset_lock_outpoint( - &Bytes36::new(outpoint_bytes), - transaction, - &platform_version.drive, - )?; - - if is_already_spent { - result.add_error(IdentityAssetLockTransactionOutPointAlreadyExistsError::new( - self.out_point.txid, - self.out_point.vout as usize, - )) - } - - Ok(result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/instant/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/instant/mod.rs deleted file mode 100644 index 4f193c2c33b..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/instant/mod.rs +++ /dev/null @@ -1,68 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; -use crate::rpc::signature::CoreSignatureVerification; -use dpp::consensus::basic::identity::{ - IdentityAssetLockTransactionOutPointAlreadyExistsError, - InvalidInstantAssetLockProofSignatureError, -}; -use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; -use dpp::platform_value::Bytes36; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use drive::grovedb::TransactionArg; - -// TODO: Versioning -impl AssetLockProofStateValidation for InstantAssetLockProof { - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - // Make sure that asset lock isn't spent yet - - let Some(asset_lock_outpoint) = self.out_point() else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "asset lock outpoint must be present", - ))); - }; - - let outpoint_bytes = asset_lock_outpoint.try_into().map_err(|e| { - Error::Execution(ExecutionError::Conversion(format!( - "can't convert output to bytes: {e}", - ))) - })?; - - let is_already_spent = platform_ref.drive.has_asset_lock_outpoint( - &Bytes36::new(outpoint_bytes), - transaction, - &platform_version.drive, - )?; - - if is_already_spent { - result.add_error(IdentityAssetLockTransactionOutPointAlreadyExistsError::new( - asset_lock_outpoint.txid, - asset_lock_outpoint.vout as usize, - )) - } - - // Verify instant lock signature with Core - - let is_instant_lock_signature_valid = self - .instant_lock() - .verify_signature(platform_ref.core_rpc, platform_ref.block_info.core_height)?; - - if !is_instant_lock_signature_valid { - result.add_error(InvalidInstantAssetLockProofSignatureError::new()); - - return Ok(result); - } - - Ok(result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs index d498e0f5de5..c1e44b07b05 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs @@ -1,52 +1,2 @@ -mod chain; -mod instant; - -use crate::error::Error; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; -use dpp::prelude::AssetLockProof; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use drive::grovedb::TransactionArg; - -/// A trait for validating state transitions within a blockchain. -pub trait AssetLockProofStateValidation { - /// Validates the state transition by analyzing the changes in the platform state after applying the transaction. - /// - /// # Arguments - /// - /// * `platform` - A reference to the platform containing the state data. - /// * `tx` - The transaction argument to be applied. - /// - /// # Type Parameters - /// - /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. - /// - /// # Returns - /// - /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl AssetLockProofStateValidation for AssetLockProof { - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - match self { - AssetLockProof::Instant(proof) => { - proof.validate_state(platform_ref, transaction, platform_version) - } - AssetLockProof::Chain(proof) => { - proof.validate_state(platform_ref, transaction, platform_version) - } - } - } -} +pub mod validate; +pub mod verify_is_not_spent; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/chain/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/chain/mod.rs new file mode 100644 index 00000000000..f0ff6ac4c81 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/chain/mod.rs @@ -0,0 +1,50 @@ +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::consensus::basic::identity::{ + InvalidAssetLockProofCoreChainHeightError, +}; +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + +// TODO: Versioning +impl AssetLockProofValidation for ChainAssetLockProof { + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + if validation_mode != ValidationMode::RecheckTx + && platform_ref.state.last_committed_core_height() < self.core_chain_locked_height + { + return Ok(ConsensusValidationResult::new_with_error( + InvalidAssetLockProofCoreChainHeightError::new( + self.core_chain_locked_height, + platform_ref.state.last_committed_core_height(), + ) + .into(), + )); + } + + self.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + ) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/instant/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/instant/mod.rs new file mode 100644 index 00000000000..a2500b06636 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/instant/mod.rs @@ -0,0 +1,78 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::consensus::basic::identity::InvalidInstantAssetLockProofSignatureError; +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; + +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::platform_events::core_instant_send_lock::verify_recent_signature_locally::VerifyInstantLockSignature; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; +use crate::execution::validation::state_transition::ValidationMode; + +// TODO: Versioning +impl AssetLockProofValidation for InstantAssetLockProof { + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // Verify instant lock signature with Core + + let validation_result = self.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + )?; + + if !validation_result.is_valid() { + return Ok(validation_result); + } + + // If we have a partially spent asset lock then we do not need to verify the signature of the instant lock + // As we know this outpoint was already considered final and locked. + + if validation_mode != ValidationMode::RecheckTx && !validation_result.has_data() { + // We should be able to disable instant lock versification for integration tests + #[cfg(feature = "testing-config")] + if platform_ref + .config + .testing_configs + .disable_instant_lock_signature_verification + { + return Ok(validation_result); + } + + // TODO: Shouldn't we add an operation for fees? + + // This is a limited verification and will work properly only for recently signed instant locks. + // Even valid instant locks that was signed some time ago will be considered invalid due to limited + // quorum information in the platform state. In turn, this verification doesn't use Core RPC or any other + // IO. This is done to prevent DoS attacks on slow verify instant lock signature Core RPC method. + // In case of failed signature verification (or any knowing the fact that signing quorum is old), + // we expect clients to use ChainAssetLockProof. + let is_valid = self + .instant_lock() + .verify_recent_signature_locally(platform_ref.state, platform_version)?; + + if !is_valid { + return Ok(ConsensusValidationResult::new_with_error( + InvalidInstantAssetLockProofSignatureError::new().into(), + )); + } + } + + Ok(validation_result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/mod.rs new file mode 100644 index 00000000000..ee7e2652e0d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/mod.rs @@ -0,0 +1,72 @@ +mod chain; +mod instant; + +use crate::error::Error; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::fee::Credits; +use dpp::prelude::AssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +/// A trait for validating state transitions within a blockchain. +pub trait AssetLockProofValidation { + /// Validates the state transition by analyzing the changes in the platform state after applying the transaction. + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform containing the state data. + /// * `tx` - The transaction argument to be applied. + /// + /// # Type Parameters + /// + /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl AssetLockProofValidation for AssetLockProof { + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + AssetLockProof::Instant(proof) => proof.validate( + platform_ref, + signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + ), + AssetLockProof::Chain(proof) => proof.validate( + platform_ref, + signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + ), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/chain/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/chain/mod.rs new file mode 100644 index 00000000000..3eb45e3b8d9 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/chain/mod.rs @@ -0,0 +1,33 @@ +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; + +use super::verify_asset_lock_is_not_spent_and_has_enough_balance; + +// TODO: Versioning +impl AssetLockProofVerifyIsNotSpent for ChainAssetLockProof { + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + verify_asset_lock_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + self.out_point, + required_balance, + transaction, + platform_version, + ) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/instant/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/instant/mod.rs new file mode 100644 index 00000000000..f6ad4a3a793 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/instant/mod.rs @@ -0,0 +1,43 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; + +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; + +use super::verify_asset_lock_is_not_spent_and_has_enough_balance; + +// TODO: Versioning +impl AssetLockProofVerifyIsNotSpent for InstantAssetLockProof { + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // Make sure that asset lock isn't spent yet + + let Some(asset_lock_outpoint) = self.out_point() else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "asset lock outpoint must be present", + ))); + }; + + verify_asset_lock_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + asset_lock_outpoint, + required_balance, + transaction, + platform_version, + ) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/mod.rs new file mode 100644 index 00000000000..a38cf9a5097 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/mod.rs @@ -0,0 +1,105 @@ +mod chain; +mod instant; +mod v0; + +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::dashcore::OutPoint; +use dpp::fee::Credits; + +use dpp::prelude::AssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::v0::verify_asset_lock_is_not_spent_and_has_enough_balance_v0; + +/// A trait for validating that an asset lock is not spent +pub trait AssetLockProofVerifyIsNotSpent { + /// Validates that the asset lock was not spent + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform containing the state data. + /// * `transaction` - The database transaction to check on, can be None. + /// * `platform_version` - The platform version that we are using + /// + /// # Type Parameters + /// + /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl AssetLockProofVerifyIsNotSpent for AssetLockProof { + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + AssetLockProof::Instant(proof) => proof.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + ), + AssetLockProof::Chain(proof) => proof.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + ), + } + } +} + +#[inline(always)] +fn verify_asset_lock_is_not_spent_and_has_enough_balance( + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + out_point: OutPoint, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, +) -> Result, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .common_validation_methods + .asset_locks + .verify_asset_lock_is_not_spent_and_has_enough_balance + { + 0 => verify_asset_lock_is_not_spent_and_has_enough_balance_v0( + platform_ref, + signable_bytes_hasher, + out_point, + required_balance, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_asset_lock_is_not_spent_and_has_enough_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/v0/mod.rs new file mode 100644 index 00000000000..1ca28e3ff83 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/v0/mod.rs @@ -0,0 +1,88 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; +use dpp::asset_lock::StoredAssetLockInfo; +use dpp::consensus::basic::identity::{ + IdentityAssetLockStateTransitionReplayError, + IdentityAssetLockTransactionOutPointAlreadyConsumedError, + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, +}; +use dpp::dashcore::OutPoint; +use dpp::fee::Credits; +use dpp::platform_value::Bytes36; +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +/// Both proofs share the same verification logic +#[inline(always)] +pub(super) fn verify_asset_lock_is_not_spent_and_has_enough_balance_v0( + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + out_point: OutPoint, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, +) -> Result, Error> { + // Make sure that asset lock isn't spent yet + + let stored_asset_lock_info = platform_ref.drive.fetch_asset_lock_outpoint_info( + &Bytes36::new(out_point.into()), + transaction, + &platform_version.drive, + )?; + + match stored_asset_lock_info { + StoredAssetLockInfo::FullyConsumed => { + // It was already entirely spent + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointAlreadyConsumedError::new( + out_point.txid, + out_point.vout as usize, + ) + .into(), + )) + } + StoredAssetLockInfo::PartiallyConsumed(reduced_asset_lock_value) => { + if reduced_asset_lock_value.remaining_credit_value() == 0 { + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointAlreadyConsumedError::new( + out_point.txid, + out_point.vout as usize, + ) + .into(), + )) + } else if reduced_asset_lock_value.remaining_credit_value() < required_balance { + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError::new( + out_point.txid, + out_point.vout as usize, + reduced_asset_lock_value.initial_credit_value(), + reduced_asset_lock_value.remaining_credit_value(), + required_balance, + ) + .into(), + )) + } else if signable_bytes_hasher + .hash_bytes_and_check_if_vec_contains(reduced_asset_lock_value.used_tags_ref()) + { + // Here we check that the transaction was not already tried to be execution + // This is the replay attack prevention + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockStateTransitionReplayError::new( + out_point.txid, + out_point.vout as usize, + signable_bytes_hasher.to_hashed_bytes(), + ) + .into(), + )) + } else { + Ok(ConsensusValidationResult::new_with_data( + reduced_asset_lock_value, + )) + } + } + StoredAssetLockInfo::NotPresent => Ok(ConsensusValidationResult::new()), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs index d4e70a394e8..6347c9515c0 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs @@ -6,7 +6,6 @@ use dpp::consensus::basic::identity::{ InvalidAssetLockProofTransactionHeightError, }; use dpp::dashcore::secp256k1::ThirtyTwoByteHash; -use dpp::dashcore::transaction::special_transaction::TransactionPayload; use dpp::dashcore::TxOut; use dpp::identity::state_transition::asset_lock_proof::validate_asset_lock_transaction_structure::validate_asset_lock_transaction_structure; use dpp::prelude::{AssetLockProof, ConsensusValidationResult}; @@ -41,6 +40,8 @@ pub fn fetch_asset_lock_transaction_output_sync_v0( let maybe_transaction_info = core_rpc .get_optional_transaction_extended_info(&transaction_hash) .map_err(|e| { + //todo multiple errors are possible from core, some that + // would lead to consensus errors, other execution errors Error::Execution(ExecutionError::DashCoreBadResponseError(format!( "can't fetch asset transaction for chain asset lock proof: {e}", ))) @@ -95,33 +96,13 @@ pub fn fetch_asset_lock_transaction_output_sync_v0( // Validate asset lock transaction - let validate_asset_lock_transaction_result = validate_asset_lock_transaction_structure( - &transaction, - output_index, - platform_version, - )?; - - if !validate_asset_lock_transaction_result.is_valid() { - return Ok(ConsensusValidationResult::new_with_errors( - validate_asset_lock_transaction_result.errors, - )); - } - - // Extract outpoint from the payload - if let Some(TransactionPayload::AssetLockPayloadType(mut payload)) = - transaction.special_transaction_payload - { - // We are dealing with old Rust edition so we can't use optional remove - if payload.credit_outputs.get(output_index as usize).is_some() { - let output = payload.credit_outputs.remove(output_index as usize); - - return Ok(ValidationResult::new_with_data(output)); - } - } - - Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "transaction should have outpoint", - ))) + // While we don't need this validation for recheck, we still need to get the tx_out + // To get the Tx_out we need some sanity checks, then this checks that we are p2pkh. + // The check for p2pkh is only marginally more expensive than the check to see if we are + // on a recheck, so there's no point making the code more complicated and stripping + // out a very cheap check on recheck tx + validate_asset_lock_transaction_structure(&transaction, output_index, platform_version) + .map_err(Error::Protocol) } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs index c27af2cf33d..8e425890600 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs @@ -3,5 +3,7 @@ pub mod asset_lock; pub mod validate_identity_public_key_contract_bounds; pub mod validate_identity_public_key_ids_dont_exist_in_state; pub mod validate_identity_public_key_ids_exist_in_state; +pub mod validate_not_disabling_last_master_key; +pub mod validate_simple_pre_check_balance; pub mod validate_state_transition_identity_signed; pub mod validate_unique_identity_public_key_hashes_in_state; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs index 43acebf0c00..48753f8193a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs @@ -1,7 +1,7 @@ use crate::error::Error; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use dpp::consensus::basic::document::{ - DataContractNotPresentError, InvalidDocumentTypeError, MissingDocumentTypeError, + DataContractNotPresentError, InvalidDocumentTypeError, }; use dpp::consensus::basic::identity::DataContractBoundsNotPresentError; use dpp::consensus::basic::BasicError; @@ -22,7 +22,7 @@ use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; use drive::drive::Drive; use drive::drive::identity::key::fetch::{IdentityKeysRequest, KeyKindRequestType, KeyRequestType, OptionalSingleIdentityPublicKeyOutcome}; -use drive::grovedb::{Transaction, TransactionArg}; +use drive::grovedb::TransactionArg; pub(super) fn validate_identity_public_keys_contract_bounds_v0( identity_id: Identifier, @@ -55,7 +55,7 @@ fn validate_identity_public_key_contract_bounds_v0( identity_public_key_in_creation: &IdentityPublicKeyInCreation, drive: &Drive, transaction: TransactionArg, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result { //todo: we should add to the execution context the cost of fetching contracts diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs index dde54fe0540..a9feed80d56 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs @@ -21,7 +21,7 @@ pub(super) fn validate_identity_public_key_ids_dont_exist_in_state_v0( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], drive: &Drive, transaction: TransactionArg, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result { // first let's check that the identity has no keys with the same id diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs index 933e1ec9c88..aa252d7d03a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs @@ -1,6 +1,6 @@ use dpp::identifier::Identifier; -use dpp::identity::KeyID; -use dpp::validation::SimpleConsensusValidationResult; +use dpp::identity::{IdentityPublicKey, KeyID}; +use dpp::validation::ConsensusValidationResult; use drive::drive::Drive; use drive::grovedb::TransactionArg; use dpp::version::PlatformVersion; @@ -18,7 +18,7 @@ pub(crate) fn validate_identity_public_key_ids_exist_in_state( execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, -) -> Result { +) -> Result>, Error> { match platform_version .drive_abci .validation_and_processing diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs index 32f596f1e36..6422faf196e 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs @@ -2,28 +2,28 @@ use crate::error::Error; use dpp::consensus::state::identity::missing_identity_public_key_ids_error::MissingIdentityPublicKeyIdsError; -use dpp::identity::KeyID; +use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::platform_value::Identifier; +use dpp::prelude::ConsensusValidationResult; -use dpp::validation::SimpleConsensusValidationResult; - -use drive::drive::identity::key::fetch::{IdentityKeysRequest, KeyIDVec, KeyRequestType}; +use drive::drive::identity::key::fetch::{ + IdentityKeysRequest, KeyIDIdentityPublicKeyPairBTreeMap, KeyRequestType, +}; use drive::drive::Drive; use drive::grovedb::TransactionArg; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use dpp::version::PlatformVersion; -use std::collections::BTreeSet; /// This will validate that all keys are valid against the state pub(super) fn validate_identity_public_key_ids_exist_in_state_v0( identity_id: Identifier, key_ids: &[KeyID], drive: &Drive, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, -) -> Result { +) -> Result>, Error> { let limit = key_ids.len() as u16; let identity_key_request = IdentityKeysRequest { identity_id: identity_id.to_buffer(), @@ -31,20 +31,20 @@ pub(super) fn validate_identity_public_key_ids_exist_in_state_v0( limit: Some(limit), offset: None, }; - let keys = drive.fetch_identity_keys::( + let to_remove_keys = drive.fetch_identity_keys::( identity_key_request, transaction, platform_version, )?; - if keys.len() != key_ids.len() { - let to_remove = BTreeSet::from_iter(keys); + if to_remove_keys.len() != key_ids.len() { let mut missing_keys = key_ids.to_vec(); - missing_keys.retain(|found_key| !to_remove.contains(found_key)); + missing_keys.retain(|found_key| !to_remove_keys.contains_key(found_key)); // keys should all exist - Ok(SimpleConsensusValidationResult::new_with_error( + Ok(ConsensusValidationResult::new_with_error( MissingIdentityPublicKeyIdsError::new(missing_keys).into(), )) } else { - Ok(SimpleConsensusValidationResult::default()) + let values: Vec<_> = to_remove_keys.into_values().collect(); + Ok(ConsensusValidationResult::new_with_data(values)) } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/mod.rs new file mode 100644 index 00000000000..a4d29d4b8b0 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/mod.rs @@ -0,0 +1,30 @@ +use dpp::identity::IdentityPublicKey; +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::common::validate_not_disabling_last_master_key::v0::validate_master_key_uniqueness_v0; + +pub mod v0; + +pub(crate) fn validate_master_key_uniqueness( + public_keys_being_added: &[IdentityPublicKeyInCreation], + public_keys_to_disable: &[IdentityPublicKey], + platform_version: &PlatformVersion, +) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .common_validation_methods + .validate_master_key_uniqueness + { + 0 => validate_master_key_uniqueness_v0(public_keys_being_added, public_keys_to_disable), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "validate_not_disabling_last_master_key".to_string(), + known_versions: vec![0], + received: version, + })), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/v0/mod.rs new file mode 100644 index 00000000000..3abdc332e3d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/v0/mod.rs @@ -0,0 +1,42 @@ +use crate::error::Error; +use dpp::consensus::basic::BasicError; +use dpp::consensus::state::identity::master_public_key_update_error::MasterPublicKeyUpdateError; + +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::{IdentityPublicKey, SecurityLevel}; +use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; + +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::SimpleConsensusValidationResult; + +/// This will validate that all keys are valid against the state +pub(super) fn validate_master_key_uniqueness_v0( + public_keys_being_added: &[IdentityPublicKeyInCreation], + public_keys_to_disable: &[IdentityPublicKey], +) -> Result { + let master_keys_to_disable_count = public_keys_to_disable + .iter() + .filter(|key| key.security_level() == SecurityLevel::MASTER) + .count(); + + let master_keys_being_added_count = public_keys_being_added + .iter() + .filter(|key| key.security_level() == SecurityLevel::MASTER) + .count(); + + // Check that at most one master key is being disabled and at most one is being added + if master_keys_to_disable_count > 1 + || master_keys_being_added_count > 1 + || ((master_keys_to_disable_count == 1) ^ (master_keys_being_added_count == 1)) + { + Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::MasterPublicKeyUpdateError(MasterPublicKeyUpdateError::new( + master_keys_being_added_count, + master_keys_to_disable_count, + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/mod.rs new file mode 100644 index 00000000000..38ad05a89f2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/mod.rs @@ -0,0 +1,39 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::common::validate_simple_pre_check_balance::v0::ValidateSimplePreCheckBalanceV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::StateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +pub mod v0; + +pub trait ValidateSimplePreCheckBalance { + fn validate_simple_pre_check_minimum_balance( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl ValidateSimplePreCheckBalance for StateTransition { + fn validate_simple_pre_check_minimum_balance( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .common_validation_methods + .validate_simple_pre_check_balance + { + 0 => self.validate_simple_pre_check_minimum_balance_v0(identity, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "StateTransition::validate_simple_pre_check_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/v0/mod.rs new file mode 100644 index 00000000000..6f9cfb87adf --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/v0/mod.rs @@ -0,0 +1,80 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::StateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub trait ValidateSimplePreCheckBalanceV0 { + fn validate_simple_pre_check_minimum_balance_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl ValidateSimplePreCheckBalanceV0 for StateTransition { + fn validate_simple_pre_check_minimum_balance_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let amount = match self { + StateTransition::DataContractCreate(_) => { + platform_version + .fee_version + .state_transition_min_fees + .contract_create + } + StateTransition::DataContractUpdate(_) => { + platform_version + .fee_version + .state_transition_min_fees + .contract_update + } + StateTransition::DocumentsBatch(_) => { + platform_version + .fee_version + .state_transition_min_fees + .document_batch_sub_transition + } + StateTransition::IdentityCreate(_) + | StateTransition::IdentityTopUp(_) + | StateTransition::MasternodeVote(_) => 0, + StateTransition::IdentityCreditWithdrawal(_) => { + platform_version + .fee_version + .state_transition_min_fees + .credit_withdrawal + } + StateTransition::IdentityUpdate(_) => { + platform_version + .fee_version + .state_transition_min_fees + .identity_update + } + StateTransition::IdentityCreditTransfer(_) => { + platform_version + .fee_version + .state_transition_min_fees + .credit_transfer + } + }; + + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for identity based operations", + )))?; + + if balance < amount { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(identity.id, balance, amount).into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs index 73b3aa83886..6e35b4361d9 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs @@ -1,15 +1,9 @@ -use std::sync::Arc; - -use dpp::identifier::Identifier; use dpp::identity::PartialIdentity; -use dpp::ProtocolError; use dpp::state_transition::StateTransition; use dpp::validation::ConsensusValidationResult; use dpp::version::{PlatformVersion}; -use drive::drive::contract::DataContractFetchInfo; use drive::drive::Drive; use drive::grovedb::TransactionArg; -use drive::state_transition_action::StateTransitionAction; use crate::error::Error; use crate::error::execution::ExecutionError; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; @@ -17,13 +11,11 @@ use crate::execution::validation::state_transition::common::validate_state_trans pub mod v0; -pub type GetDataContractFn = fn(Identifier) -> Result, ProtocolError>; - pub trait ValidateStateTransitionIdentitySignature { fn validate_state_transition_identity_signed( &self, drive: &Drive, - action: Option<&StateTransitionAction>, + request_balance: bool, request_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, @@ -35,7 +27,7 @@ impl ValidateStateTransitionIdentitySignature for StateTransition { fn validate_state_transition_identity_signed( &self, drive: &Drive, - action: Option<&StateTransitionAction>, + request_balance: bool, request_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, @@ -50,7 +42,7 @@ impl ValidateStateTransitionIdentitySignature for StateTransition { { 0 => self.validate_state_transition_identity_signed_v0( drive, - action, + request_balance, request_revision, transaction, execution_context, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs index be7cd864eb1..4e316a7af0e 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs @@ -1,40 +1,34 @@ use crate::error::Error; use dpp::consensus::signature::{ - IdentityNotFoundError, InvalidSignaturePublicKeySecurityLevelError, - InvalidStateTransitionSignatureError, PublicKeySecurityLevelNotMetError, + IdentityNotFoundError, InvalidSignaturePublicKeyPurposeError, + InvalidSignaturePublicKeySecurityLevelError, InvalidStateTransitionSignatureError, + PublicKeySecurityLevelNotMetError, }; use dpp::identity::PartialIdentity; use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; -use crate::execution::types::execution_operation::ExecutionOperation; +use crate::execution::types::execution_operation::{RetrieveIdentityInfo, ValidationOperation}; use crate::execution::types::state_transition_execution_context::{ StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, }; use dpp::consensus::ConsensusError; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::error::execution::ExecutionError; +use dpp::consensus::signature::{ + InvalidIdentityPublicKeyTypeError, MissingPublicKeyError, PublicKeyIsDisabledError, + SignatureError, +}; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::native_bls::NativeBlsModule; use dpp::state_transition::StateTransition; use dpp::validation::ConsensusValidationResult; use dpp::version::PlatformVersion; use dpp::ProtocolError; -use dpp::{ - consensus::signature::{ - InvalidIdentityPublicKeyTypeError, MissingPublicKeyError, PublicKeyIsDisabledError, - SignatureError, - }, - NativeBlsModule, -}; use drive::dpp::identity::KeyType; use drive::drive::identity::key::fetch::IdentityKeysRequest; use drive::drive::Drive; use drive::grovedb::TransactionArg; -use drive::state_transition_action::StateTransitionAction; use lazy_static::lazy_static; use std::collections::HashSet; @@ -52,8 +46,8 @@ pub(super) trait ValidateStateTransitionIdentitySignatureV0<'a> { fn validate_state_transition_identity_signed_v0( &self, drive: &Drive, - action: Option<&StateTransitionAction>, - request_revision: bool, + request_identity_balance: bool, + request_identity_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, @@ -64,8 +58,8 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { fn validate_state_transition_identity_signed_v0( &self, drive: &Drive, - action: Option<&StateTransitionAction>, - request_revision: bool, + request_identity_balance: bool, + request_identity_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, @@ -80,36 +74,65 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { let owner_id = self.owner_id(); - let security_levels = match self { - StateTransition::DocumentsBatch(_) => { - let action = action.ok_or(ProtocolError::CorruptedCodeExecution( - "we expect a state transition action when validating the signature of the documents batch transition".to_string(), - ))?; - let StateTransitionAction::DocumentsBatchAction(documents_batch_action) = action - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "we expect a documents batch state transition action when validating the signature of the documents batch transition", - ))); - }; - documents_batch_action.contract_based_security_level_requirement() - } - _ => self - .security_level_requirement() + let security_levels = + self.security_level_requirement() .ok_or(ProtocolError::CorruptedCodeExecution( - "state_transition does not have a owner Id to verify".to_string(), - )), - }?; + "state_transition does not have security level".to_string(), + ))?; + + let purpose = self + .purpose_requirement() + .ok_or(ProtocolError::CorruptedCodeExecution( + "state_transition does not have a key purpose requirement".to_string(), + ))?; let key_request = IdentityKeysRequest::new_specific_key_query(owner_id.as_bytes(), key_id); - let maybe_partial_identity = if request_revision { - drive.fetch_identity_balance_with_keys_and_revision( - key_request, - transaction, - platform_version, - )? - } else { - drive.fetch_identity_balance_with_keys(key_request, transaction, platform_version)? + let maybe_partial_identity = match (request_identity_balance, request_identity_revision) { + (true, true) => { + // This is for identity update + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::one_key_and_balance_and_revision(), + )); + drive.fetch_identity_balance_with_keys_and_revision( + key_request, + transaction, + platform_version, + )? + } + (true, false) => { + // This is for most state transitions + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::one_key_and_balance(), + )); + drive.fetch_identity_balance_with_keys( + key_request, + transaction, + platform_version, + )? + } + (false, true) => { + // This currently is not used + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::one_key_and_revision(), + )); + drive.fetch_identity_revision_with_keys( + key_request, + transaction, + platform_version, + )? + } + (false, false) => { + // This is for masternode vote transition + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::one_key(), + )); + drive.fetch_identity_keys_as_partial_identity( + key_request, + transaction, + platform_version, + )? + } }; let partial_identity = match maybe_partial_identity { @@ -130,6 +153,7 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { return Ok(validation_result); } + // This is very cheap because there will only be 1 key let Some(public_key) = partial_identity.loaded_public_keys.get(&key_id) else { validation_result.add_error(SignatureError::MissingPublicKeyError( MissingPublicKeyError::new(key_id), @@ -137,6 +161,7 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { return Ok(validation_result); }; + // Todo: is this needed? if !SUPPORTED_KEY_TYPES.contains(&public_key.key_type()) { validation_result.add_error(SignatureError::InvalidIdentityPublicKeyTypeError( InvalidIdentityPublicKeyTypeError::new(public_key.key_type()), @@ -144,6 +169,13 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { return Ok(validation_result); } + if purpose != public_key.purpose() { + validation_result.add_error(SignatureError::InvalidSignaturePublicKeyPurposeError( + InvalidSignaturePublicKeyPurposeError::new(public_key.purpose(), purpose), + )); + return Ok(validation_result); + } + if !security_levels.contains(&public_key.security_level()) { validation_result.add_error( SignatureError::InvalidSignaturePublicKeySecurityLevelError( @@ -164,11 +196,7 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { } let operation = SignatureVerificationOperation::new(public_key.key_type()); - execution_context.add_operation(ExecutionOperation::SignatureVerification(operation)); - - // if execution_context.is_dry_run() { - // return Ok(validation_result); - // } + execution_context.add_operation(ValidationOperation::SignatureVerification(operation)); let signature_is_valid = self.verify_signature(public_key, &NativeBlsModule); @@ -213,9 +241,9 @@ pub fn convert_to_consensus_signature_error( ), ProtocolError::WrongPublicKeyPurposeError(err) => Ok(err.into()), ProtocolError::Error(_) => Err(error), - _ => Ok(ConsensusError::SignatureError( + e => Ok(ConsensusError::SignatureError( SignatureError::InvalidStateTransitionSignatureError( - InvalidStateTransitionSignatureError::new(), + InvalidStateTransitionSignatureError::new(e.to_string()), ), )), } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs index 830dca757a9..84398f0dde9 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs @@ -6,11 +6,11 @@ use dpp::version::PlatformVersion; use crate::error::Error; use crate::error::execution::ExecutionError; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::v0::validate_unique_identity_public_key_hashes_in_state_v0; +use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::v0::validate_unique_identity_public_key_hashes_not_in_state_v0; pub mod v0; -pub(crate) fn validate_unique_identity_public_key_hashes_in_state( +pub(crate) fn validate_unique_identity_public_key_hashes_not_in_state( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], drive: &Drive, execution_context: &mut StateTransitionExecutionContext, @@ -24,7 +24,7 @@ pub(crate) fn validate_unique_identity_public_key_hashes_in_state( .common_validation_methods .validate_unique_identity_public_key_hashes_in_state { - 0 => validate_unique_identity_public_key_hashes_in_state_v0( + 0 => validate_unique_identity_public_key_hashes_not_in_state_v0( identity_public_keys_with_witness, drive, execution_context, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs index b58dcf59c8e..ff1f78ef018 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs @@ -18,10 +18,10 @@ use dpp::version::PlatformVersion; use std::collections::HashMap; /// This will validate that all keys are valid against the state -pub(super) fn validate_unique_identity_public_key_hashes_in_state_v0( +pub(super) fn validate_unique_identity_public_key_hashes_not_in_state_v0( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], drive: &Drive, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs index 6e781129222..491f3e39b22 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs @@ -1,3 +1,4 @@ +pub(crate) mod check_tx_verification; mod common; pub(crate) mod processor; mod state_transitions; @@ -5,3 +6,6 @@ mod state_transitions; pub mod transformer; pub use state_transitions::*; + +#[cfg(test)] +pub(crate) use state_transitions::tests; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs index 58b133813b0..4a3a7a13243 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs @@ -5,13 +5,19 @@ use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::StateTransition; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use drive::grovedb::TransactionArg; -/// There are 3 stages in a state transition processing: -/// Structure, Signature and State validation, +/// There are multiple stages in a state transition processing: +/// Basic Structure +/// Signature +/// Balance +/// Advanced Structure +/// State /// /// The structure validation verifies that the form of the state transition is good, for example /// that a contract is well formed, or that a document is valid against the contract. @@ -25,6 +31,7 @@ use drive::grovedb::TransactionArg; /// pub(in crate::execution) fn process_state_transition<'a, C: CoreRPCLike>( platform: &'a PlatformRef, + block_info: &BlockInfo, state_transition: StateTransition, transaction: TransactionArg, ) -> Result>, Error> { @@ -36,6 +43,7 @@ pub(in crate::execution) fn process_state_transition<'a, C: CoreRPCLike>( { 0 => v0::process_state_transition_v0( platform, + block_info, state_transition, transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs index 4f9f4f7d351..9ec26800a92 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs @@ -4,25 +4,34 @@ use crate::execution::validation::state_transition::transformer::StateTransition use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::fee::Credits; use dpp::identity::PartialIdentity; +use dpp::prefunded_specialized_balance::PrefundedSpecializedBalanceIdentifier; use dpp::prelude::ConsensusValidationResult; +use dpp::ProtocolError; +use std::collections::BTreeMap; +use crate::error::execution::ExecutionError; use dpp::serialization::Signable; -use dpp::state_transition::{StateTransition}; -use drive::state_transition_action::StateTransitionAction; +use dpp::state_transition::StateTransition; use dpp::validation::SimpleConsensusValidationResult; use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; use drive::drive::Drive; use drive::grovedb::TransactionArg; -use crate::error::execution::ExecutionError; -use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use drive::state_transition_action::StateTransitionAction; + +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext}; +use crate::execution::validation::state_transition::common::validate_simple_pre_check_balance::ValidateSimplePreCheckBalance; use crate::execution::validation::state_transition::common::validate_state_transition_identity_signed::{ValidateStateTransitionIdentitySignature}; -use crate::execution::validation::state_transition::state_transitions::identity_update::identity_and_signatures::v0::IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0; -use crate::execution::validation::state_transition::state_transitions::identity_create::identity_and_signatures::v0::IdentityCreateStateTransitionIdentityAndSignaturesValidationV0; +use crate::execution::validation::state_transition::identity_create::{StateTransitionStateValidationForIdentityCreateTransitionV0, StateTransitionStructureKnownInStateValidationForIdentityCreateTransitionV0}; +use crate::execution::validation::state_transition::identity_top_up::StateTransitionIdentityTopUpTransitionActionTransformer; +use crate::execution::validation::state_transition::state_transitions::identity_update::advanced_structure::v0::IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0; use crate::execution::validation::state_transition::state_transitions::identity_top_up::identity_retrieval::v0::IdentityTopUpStateTransitionIdentityRetrievalV0; - -pub(in crate::execution) fn process_state_transition_v0<'a, C: CoreRPCLike>( +use crate::execution::validation::state_transition::ValidationMode; +pub(super) fn process_state_transition_v0<'a, C: CoreRPCLike>( platform: &'a PlatformRef, + block_info: &BlockInfo, state_transition: StateTransition, transaction: TransactionArg, platform_version: &PlatformVersion, @@ -30,79 +39,219 @@ pub(in crate::execution) fn process_state_transition_v0<'a, C: CoreRPCLike>( let mut state_transition_execution_context = StateTransitionExecutionContext::default_for_platform_version(platform_version)?; - let action = if state_transition.requires_state_to_validate_structure() { - let state_transition_action_result = - state_transition.transform_into_action(platform, true, transaction)?; - if !state_transition_action_result.is_valid_with_data() { + // Only identity create does not use identity in state validation, because it doesn't yet have the identity in state + let mut maybe_identity = if state_transition.uses_identity_in_state() { + // Validating signature for identity based state transitions (all those except identity create and identity top up) + // As we already have removed identity create above, it just splits between identity top up (below - false) and + // all other state transitions (above - true) + let result = if state_transition.validates_signature_based_on_identity_info() { + state_transition.validate_identity_signed_state_transition( + platform.drive, + transaction, + &mut state_transition_execution_context, + platform_version, + ) + } else { + // Currently only identity top up uses this, + // We will add the cost for a balance retrieval + state_transition.retrieve_identity_info( + platform.drive, + transaction, + &mut state_transition_execution_context, + platform_version, + ) + }?; + if !result.is_valid() { + // If the signature is not valid or if we could not retrieve identity info + // we do not have the user pay for the state transition. + // Since it is most likely not from them + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions + return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + } + Some(result.into_data()?) + } else { + // Currently only identity create + None + }; + + // Only identity top up and identity create do not have nonces validation + if state_transition.has_nonces_validation() { + // Validating identity contract nonce, this must happen after validating the signature + let result = state_transition.validate_nonces( + &platform.into(), + platform.state.last_block_info(), + transaction, + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + // If the nonce is not valid the state transition is not paid for, most likely because + // this is just a replayed block + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions + return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + } + } + + // Only Data contract state transitions and Masternode vote do not have basic structure validation + if state_transition.has_basic_structure_validation() { + // We validate basic structure validation after verifying the identity, + // this is structure validation that does not require state and is already checked on check_tx + let consensus_result = state_transition.validate_basic_structure(platform_version)?; + + if !consensus_result.is_valid() { + // Basic structure validation is extremely cheap to process, because of this attacks are + // not likely. + // Often the basic structure validation is necessary for estimated costs + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions return Ok( ConsensusValidationResult::::new_with_errors( - state_transition_action_result.errors, + consensus_result.errors, ), ); } - Some(state_transition_action_result.into_data()?) + } + + // For identity credit withdrawal and identity credit transfers we have a balance pre check that includes a + // processing amount and the transfer amount. + // For other state transitions we only check a min balance for an amount set per version. + // This is not done for identity create and identity top up who don't have this check here + if state_transition.has_balance_pre_check_validation() { + // Validating that we have sufficient balance for a transfer or withdrawal, + // this must happen after validating the signature + + let identity = maybe_identity + .as_mut() + .ok_or(ProtocolError::CorruptedCodeExecution( + "identity must be known to validate the balance".to_string(), + ))?; + let result = + state_transition.validate_minimum_balance_pre_check(identity, platform_version)?; + + if !result.is_valid() { + return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + } + } + + // The prefunded_balances are currently not used as we would only use them for a masternode vote + // however the masternode vote acts as a free operation, as it is paid for + let _prefunded_balances = if state_transition.uses_prefunded_specialized_balance_for_payment() { + Some( + state_transition.validate_minimum_prefunded_specialized_balance_pre_check( + platform.drive, + transaction, + &mut state_transition_execution_context, + platform_version, + )?, + ) } else { None }; - // Validating structure - let result = state_transition.validate_structure( - &platform.into(), - action.as_ref(), - platform.state.current_protocol_version_in_consensus(), - )?; - if !result.is_valid() { - return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + // Only identity update and data contract create have advanced structure validation without state + if state_transition.has_advanced_structure_validation_without_state() { + // Currently only used for Identity Update + // Next we have advanced structure validation, this is structure validation that does not require + // state but isn't checked on check_tx. If advanced structure fails identity nonces or identity + // contract nonces will be bumped + let identity = maybe_identity + .as_ref() + .ok_or(ProtocolError::CorruptedCodeExecution( + "the identity should always be known on advanced structure validation".to_string(), + ))?; + let consensus_result = state_transition.validate_advanced_structure( + identity, + &mut state_transition_execution_context, + platform_version, + )?; + + if !consensus_result.is_valid() { + return consensus_result.map_result(|action| { + ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + ) + }); + } } - let action = if state_transition.requires_state_to_validate_identity_and_signatures() { - if let Some(action) = action { - Some(action) - } else { - let state_transition_action_result = - state_transition.transform_into_action(platform, true, transaction)?; - if !state_transition_action_result.is_valid_with_data() { - return Ok( - ConsensusValidationResult::::new_with_errors( - state_transition_action_result.errors, - ), - ); - } - Some(state_transition_action_result.into_data()?) + // Identity create, documents batch and masternode vote all have advanced structure validation with state + let action = if state_transition.has_advanced_structure_validation_with_state() { + // Currently used for identity create and documents batch + let state_transition_action_result = state_transition.transform_into_action( + platform, + block_info, + ValidationMode::Validator, + &mut state_transition_execution_context, + transaction, + )?; + if !state_transition_action_result.is_valid_with_data() { + return state_transition_action_result.map_result(|action| { + ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + ) + }); + } + let action = state_transition_action_result.into_data()?; + + // Validating structure + let result = state_transition.validate_advanced_structure_from_state( + &action, + maybe_identity.as_ref(), + &mut state_transition_execution_context, + platform_version, + )?; + if !result.is_valid() { + return result.map_result(|action| { + ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + ) + }); } + + Some(action) } else { None }; - // - let result = state_transition.validate_identity_and_signatures( - platform.drive, - action.as_ref(), - transaction, + // Validating state + // Only identity Top up does not validate state and instead just returns the action for topping up + let result = state_transition.validate_state( + action, + platform, + ValidationMode::Validator, + block_info, &mut state_transition_execution_context, - platform_version, + transaction, )?; - // Validating signatures - if !result.is_valid() { - return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); - } - let maybe_identity = result.into_data()?; - - // Validating state - let result = state_transition.validate_state(action, platform, transaction)?; result.map_result(|action| { ExecutionEvent::create_from_state_transition_action( action, maybe_identity, - platform.state.epoch_ref(), + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, platform_version, ) }) } /// A trait for validating state transitions within a blockchain. -pub(crate) trait StateTransitionSignatureValidationV0 { +pub(crate) trait StateTransitionIdentityBasedSignatureValidationV0 { /// Validates the identity and signatures of a transaction to ensure its authenticity. /// /// # Arguments @@ -118,34 +267,194 @@ pub(crate) trait StateTransitionSignatureValidationV0 { /// - `Ok(ConsensusValidationResult>)`: Indicates that the transaction has passed authentication, and the result contains an optional `PartialIdentity`. /// - `Err(Error)`: Indicates that the transaction failed authentication, and the result contains an `Error` indicating the reason for failure. /// - fn validate_identity_and_signatures( + fn validate_identity_signed_state_transition( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + /// fetches identity info + fn retrieve_identity_info( &self, drive: &Drive, - action: Option<&StateTransitionAction>, tx: TransactionArg, execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, - ) -> Result>, Error>; + ) -> Result, Error>; + + /// Is the state transition supposed to have an identity in the state to succeed + fn uses_identity_in_state(&self) -> bool; + + /// Do we validate the signature based on identity info? + fn validates_signature_based_on_identity_info(&self) -> bool; } /// A trait for validating state transitions within a blockchain. -pub(crate) trait StateTransitionStructureValidationV0 { +pub(crate) trait StateTransitionBasicStructureValidationV0 { /// Validates the structure of a transaction by checking its basic elements. /// /// # Arguments /// - /// * `drive` - A reference to the drive containing the transaction data. - /// * `tx` - The transaction argument to be checked. + /// * `platform` - A reference to the platform state ref. + /// * `platform_version` - The platform version. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate_basic_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + /// True if the state transition has basic structure validation. + /// Currently only data contract update does not + fn has_basic_structure_validation(&self) -> bool { + true + } +} + +/// A trait for validating state transitions within a blockchain. +/// The advanced structure validation should always happen in a block +/// and not in check_tx +pub(crate) trait StateTransitionAdvancedStructureValidationV0 { + /// Validates the structure of a transaction by checking its basic elements. + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform state ref. + /// * `platform_version` - The platform version. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate_advanced_structure( + &self, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + /// True if the state transition has advanced structure validation. + /// This structure validation makes users pay if there is a failure + fn has_advanced_structure_validation_without_state(&self) -> bool; +} + +/// A trait for validating state transitions within a blockchain. +pub(crate) trait StateTransitionNonceValidationV0 { + /// Validates the structure of a transaction by checking its basic elements. + /// + /// # Arguments + /// + /// * `platform_version` - The platform version. /// /// # Returns /// /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. - fn validate_structure( + fn validate_nonces( &self, platform: &PlatformStateRef, - action: Option<&StateTransitionAction>, - protocol_version: u32, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, ) -> Result; + + /// True if the state transition validates nonces, either identity nonces or identity contract + /// nonces + fn has_nonces_validation(&self) -> bool { + true + } +} + +/// A trait for validating state transitions within a blockchain. +pub(crate) trait StateTransitionStructureKnownInStateValidationV0 { + /// Validates the structure of a transaction by checking its basic elements. + /// + /// # Arguments + /// + /// * `action` - An optional reference to the state transition action. + /// * `platform_version` - The platform version. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate_advanced_structure_from_state( + &self, + action: &StateTransitionAction, + maybe_identity: Option<&PartialIdentity>, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + /// This means we should transform into the action before validation of the structure + fn has_advanced_structure_validation_with_state(&self) -> bool; + /// This means we should transform into the action before validation of the advanced structure, + /// and that we must even do this on check_tx + fn requires_advanced_structure_validation_with_state_on_check_tx(&self) -> bool; +} + +/// A trait for validating state transitions within a blockchain. +pub(crate) trait StateTransitionIdentityBalanceValidationV0 { + /// Validates the state transition by analyzing the changes in the platform state after applying the transaction. + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform containing the state data. + /// * `tx` - The transaction argument to be applied. + /// + /// # Type Parameters + /// + /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. + /// + /// # Returns + /// + /// * `Result, Error>` - A result with either a ConsensusValidationResult containing a StateTransitionAction or an Error. + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; + + /// True if the state transition has a balance validation. + /// This balance validation is not for the operations of the state transition, but more as a + /// quick early verification that the user has the balance they want to transfer or withdraw. + fn has_balance_pre_check_validation(&self) -> bool { + true + } +} + +pub(crate) trait StateTransitionPrefundedSpecializedBalanceValidationV0 { + /// Validates the state transition by analyzing the changes in the platform state after applying the transaction. + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform containing the state data. + /// * `tx` - The transaction argument to be applied. + /// + /// # Type Parameters + /// + /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. + /// + /// # Returns + /// + /// * `Result, Error>` - A result with either a ConsensusValidationResult containing a StateTransitionAction or an Error. + fn validate_minimum_prefunded_specialized_balance_pre_check( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result< + ConsensusValidationResult>, + Error, + >; + + /// Do we use a prefunded specialized balance for payment + fn uses_prefunded_specialized_balance_for_payment(&self) -> bool { + false + } } /// A trait for validating state transitions within a blockchain. @@ -170,187 +479,391 @@ pub(crate) trait StateTransitionStateValidationV0: &self, action: Option, platform: &PlatformRef, + validation_mode: ValidationMode, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error>; } -impl StateTransitionStructureValidationV0 for StateTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for StateTransition { + fn validate_basic_structure( &self, - platform: &PlatformStateRef, - action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { match self { - StateTransition::DataContractCreate(st) => { - st.validate_structure(platform, action, protocol_version) - } - StateTransition::DataContractUpdate(st) => { - st.validate_structure(platform, action, protocol_version) + StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::MasternodeVote(_) => { + // no basic structure validation + Ok(SimpleConsensusValidationResult::new()) } - StateTransition::IdentityCreate(st) => { - st.validate_structure(platform, action, protocol_version) + StateTransition::IdentityCreate(st) => st.validate_basic_structure(platform_version), + StateTransition::IdentityUpdate(st) => st.validate_basic_structure(platform_version), + StateTransition::IdentityTopUp(st) => st.validate_basic_structure(platform_version), + StateTransition::IdentityCreditWithdrawal(st) => { + st.validate_basic_structure(platform_version) } - StateTransition::IdentityUpdate(st) => { - st.validate_structure(platform, action, protocol_version) + StateTransition::DocumentsBatch(st) => st.validate_basic_structure(platform_version), + StateTransition::IdentityCreditTransfer(st) => { + st.validate_basic_structure(platform_version) } - StateTransition::IdentityTopUp(st) => { - st.validate_structure(platform, action, protocol_version) + } + } + fn has_basic_structure_validation(&self) -> bool { + !matches!( + self, + StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::MasternodeVote(_) + ) + } +} + +impl StateTransitionNonceValidationV0 for StateTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match self { + StateTransition::DocumentsBatch(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::DataContractCreate(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::DataContractUpdate(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::IdentityUpdate(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::IdentityCreditTransfer(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::IdentityCreditWithdrawal(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::MasternodeVote(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + _ => Ok(SimpleConsensusValidationResult::new()), + } + } + + fn has_nonces_validation(&self) -> bool { + matches!( + self, + StateTransition::DocumentsBatch(_) + | StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::IdentityUpdate(_) + | StateTransition::IdentityCreditTransfer(_) + | StateTransition::IdentityCreditWithdrawal(_) + ) + } +} + +impl StateTransitionIdentityBalanceValidationV0 for StateTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match self { + StateTransition::IdentityCreditTransfer(st) => { + st.validate_minimum_balance_pre_check(identity, platform_version) } StateTransition::IdentityCreditWithdrawal(st) => { - st.validate_structure(platform, action, protocol_version) + st.validate_minimum_balance_pre_check(identity, platform_version) } StateTransition::DocumentsBatch(st) => { - st.validate_structure(platform, action, protocol_version) + st.validate_minimum_balance_pre_check(identity, platform_version) } - StateTransition::IdentityCreditTransfer(st) => { - st.validate_structure(platform, action, protocol_version) + StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::IdentityUpdate(_) => { + self.validate_simple_pre_check_minimum_balance(identity, platform_version) } + StateTransition::MasternodeVote(_) + | StateTransition::IdentityCreate(_) + | StateTransition::IdentityTopUp(_) => Ok(SimpleConsensusValidationResult::new()), } } + + fn has_balance_pre_check_validation(&self) -> bool { + matches!( + self, + StateTransition::IdentityCreditTransfer(_) + | StateTransition::IdentityCreditWithdrawal(_) + | StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::DocumentsBatch(_) + | StateTransition::IdentityUpdate(_) + ) + } } -impl StateTransitionSignatureValidationV0 for StateTransition { - fn validate_identity_and_signatures( +impl StateTransitionPrefundedSpecializedBalanceValidationV0 for StateTransition { + fn validate_minimum_prefunded_specialized_balance_pre_check( &self, drive: &Drive, - action: Option<&StateTransitionAction>, tx: TransactionArg, execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, - ) -> Result>, Error> { + ) -> Result< + ConsensusValidationResult>, + Error, + > { match self { - StateTransition::DataContractCreate(_) - | StateTransition::DataContractUpdate(_) - | StateTransition::IdentityCreditWithdrawal(_) - | StateTransition::IdentityCreditTransfer(_) - | StateTransition::DocumentsBatch(_) => { - //Basic signature verification - Ok(self - .validate_state_transition_identity_signed( - drive, - action, - false, - tx, - execution_context, - platform_version, - )? - .map(Some)) + StateTransition::MasternodeVote(masternode_vote_transition) => { + masternode_vote_transition.validate_minimum_prefunded_specialized_balance_pre_check( + drive, + tx, + execution_context, + platform_version, + ) } + _ => Ok(ConsensusValidationResult::new()), + } + } + + fn uses_prefunded_specialized_balance_for_payment(&self) -> bool { + matches!( + self, + | StateTransition::MasternodeVote(_) + ) + } +} + +impl StateTransitionAdvancedStructureValidationV0 for StateTransition { + fn validate_advanced_structure( + &self, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { StateTransition::IdentityUpdate(st) => { match platform_version .drive_abci .validation_and_processing .state_transitions .identity_update_state_transition - .identity_signatures + .advanced_structure { Some(0) => { let signable_bytes: Vec = self.signable_bytes()?; - let mut validation_result = self - .validate_state_transition_identity_signed( - drive, - action, - true, - tx, - execution_context, - platform_version, - )?; - if !validation_result.is_valid() { - Ok(validation_result.map(Some)) - } else { - let partial_identity = validation_result.data_as_borrowed()?; - let result = st - .validate_identity_update_state_transition_signatures_v0( - signable_bytes, - partial_identity, - )?; - validation_result.merge(result); - Ok(validation_result.map(Some)) - } + st.validate_identity_update_state_transition_signatures_v0( + signable_bytes, + identity, + execution_context, + ) } - None => Err(Error::Execution(ExecutionError::VersionNotActive { - method: "identity update transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - })), Some(version) => { Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity update transition: validate_identity_and_signatures" + method: "identity update transition: validate_advanced_structure" .to_string(), known_versions: vec![0], received: version, })) } + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity update transition: validate_advanced_structure" + .to_string(), + known_versions: vec![0], + })), } } - StateTransition::IdentityCreate(st) => { - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .identity_create_state_transition - .identity_signatures - { - Some(0) => { - let mut validation_result = - ConsensusValidationResult::>::default(); + StateTransition::DataContractCreate(st) => { + st.validate_advanced_structure(identity, execution_context, platform_version) + } + _ => Ok(ConsensusValidationResult::::new()), + } + } - let signable_bytes: Vec = self.signable_bytes()?; + fn has_advanced_structure_validation_without_state(&self) -> bool { + matches!( + self, + StateTransition::IdentityUpdate(_) | StateTransition::DataContractCreate(_) + ) + } +} - let result = st.validate_identity_create_state_transition_signatures_v0( - signable_bytes, - )?; +impl StateTransitionStructureKnownInStateValidationV0 for StateTransition { + fn validate_advanced_structure_from_state( + &self, + action: &StateTransitionAction, + maybe_identity: Option<&PartialIdentity>, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + StateTransition::DocumentsBatch(st) => st.validate_advanced_structure_from_state( + action, + maybe_identity, + execution_context, + platform_version, + ), + StateTransition::IdentityCreate(st) => { + let signable_bytes = self.signable_bytes()?; + let StateTransitionAction::IdentityCreateAction(identity_create_action) = action + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "action must be a identity create transition action", + ))); + }; + st.validate_advanced_structure_from_state_for_identity_create_transition( + identity_create_action, + signable_bytes, + execution_context, + platform_version, + ) + } + StateTransition::MasternodeVote(st) => st.validate_advanced_structure_from_state( + action, + maybe_identity, + execution_context, + platform_version, + ), + _ => Ok(ConsensusValidationResult::new()), + } + } - validation_result.merge(result); - validation_result.set_data(None); + /// This means we should transform into the action before validation of the advanced structure + fn has_advanced_structure_validation_with_state(&self) -> bool { + matches!( + self, + StateTransition::DocumentsBatch(_) + | StateTransition::IdentityCreate(_) + | StateTransition::MasternodeVote(_) + ) + } - Ok(validation_result) - } - None => Err(Error::Execution(ExecutionError::VersionNotActive { - method: "identity create transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - })), - Some(version) => { - Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity create transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - received: version, - })) - } - } + /// This means we should transform into the action before validation of the advanced structure, + /// and that we must even do this on check_tx + fn requires_advanced_structure_validation_with_state_on_check_tx(&self) -> bool { + matches!(self, StateTransition::DocumentsBatch(_)) + } +} + +impl StateTransitionIdentityBasedSignatureValidationV0 for StateTransition { + fn validate_identity_signed_state_transition( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::IdentityCreditWithdrawal(_) + | StateTransition::IdentityCreditTransfer(_) + | StateTransition::DocumentsBatch(_) => { + //Basic signature verification + Ok(self.validate_state_transition_identity_signed( + drive, + true, + false, + tx, + execution_context, + platform_version, + )?) } - StateTransition::IdentityTopUp(st) => { - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .identity_top_up_state_transition - .identity_signatures - { - // The validation of the signature happens on the state level - Some(0) => Ok(st - .retrieve_topped_up_identity(drive, tx, platform_version)? - .map(Some)), - None => Err(Error::Execution(ExecutionError::VersionNotActive { - method: "identity top up transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - })), - Some(version) => { - Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - received: version, - })) - } - } + StateTransition::IdentityUpdate(_) => { + //Basic signature verification + Ok(self.validate_state_transition_identity_signed( + drive, + true, + true, + tx, + execution_context, + platform_version, + )?) + } + StateTransition::MasternodeVote(_) => { + //Basic signature verification + + // We do not request the balance because masternodes do not pay for their voting + // themselves + + Ok(self.validate_state_transition_identity_signed( + drive, + false, + false, + tx, + execution_context, + platform_version, + )?) } + StateTransition::IdentityCreate(_) => Ok(ConsensusValidationResult::new()), + StateTransition::IdentityTopUp(_) => Ok(ConsensusValidationResult::new()), + } + } + + fn retrieve_identity_info( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + StateTransition::IdentityTopUp(st) => Ok(st.retrieve_topped_up_identity( + drive, + tx, + execution_context, + platform_version, + )?), + _ => Ok(ConsensusValidationResult::new()), } } + + /// Is the state transition supposed to have an identity in the state to succeed + fn uses_identity_in_state(&self) -> bool { + !matches!(self, StateTransition::IdentityCreate(_)) + } + + /// Do we validate the signature based on identity info? + fn validates_signature_based_on_identity_info(&self) -> bool { + !matches!( + self, + StateTransition::IdentityCreate(_) | StateTransition::IdentityTopUp(_) + ) + } } impl StateTransitionStateValidationV0 for StateTransition { @@ -358,19 +871,103 @@ impl StateTransitionStateValidationV0 for StateTransition { &self, action: Option, platform: &PlatformRef, + validation_mode: ValidationMode, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { match self { - StateTransition::DataContractCreate(st) => st.validate_state(action, platform, tx), - StateTransition::DataContractUpdate(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityCreate(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityUpdate(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityTopUp(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityCreditWithdrawal(st) => { - st.validate_state(action, platform, tx) + // The replay attack is prevented by checking if a data contract exists with this id first + StateTransition::DataContractCreate(st) => st.validate_state( + action, + platform, + validation_mode, + block_info, + execution_context, + tx, + ), + // The replay attack is prevented by identity data contract nonce + StateTransition::DataContractUpdate(st) => st.validate_state( + action, + platform, + validation_mode, + block_info, + execution_context, + tx, + ), + StateTransition::IdentityCreate(st) => { + let action = + action.ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "identity create validation should always an action", + )))?; + let StateTransitionAction::IdentityCreateAction(action) = action else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "action must be a identity create transition action", + ))); + }; + st.validate_state_for_identity_create_transition( + action, + platform, + execution_context, + tx, + ) + } + StateTransition::IdentityUpdate(st) => st.validate_state( + action, + platform, + validation_mode, + block_info, + execution_context, + tx, + ), + StateTransition::IdentityTopUp(st) => { + // Nothing to validate from state + if let Some(action) = action { + Ok(ConsensusValidationResult::new_with_data(action)) + } else { + let signable_bytes = self.signable_bytes()?; + st.transform_into_action_for_identity_top_up_transition( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + ) + } } - StateTransition::DocumentsBatch(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityCreditTransfer(st) => st.validate_state(action, platform, tx), + StateTransition::IdentityCreditWithdrawal(st) => st.validate_state( + action, + platform, + validation_mode, + block_info, + execution_context, + tx, + ), + // The replay attack is prevented by identity data contract nonce + StateTransition::DocumentsBatch(st) => st.validate_state( + action, + platform, + validation_mode, + block_info, + execution_context, + tx, + ), + StateTransition::IdentityCreditTransfer(st) => st.validate_state( + action, + platform, + validation_mode, + block_info, + execution_context, + tx, + ), + StateTransition::MasternodeVote(st) => st.validate_state( + action, + platform, + validation_mode, + block_info, + execution_context, + tx, + ), } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..9bdc1119eb6 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs @@ -0,0 +1,193 @@ +use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use dpp::consensus::basic::data_contract::{ + InvalidDataContractIdError, InvalidDataContractVersionError, +}; +use dpp::consensus::basic::BasicError; +use dpp::data_contract::INITIAL_DATA_CONTRACT_VERSION; +use dpp::prelude::DataContract; +use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::validation::ConsensusValidationResult; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition::state_transitions::data_contract_create) trait DataContractCreatedStateTransitionAdvancedStructureValidationV0 { + fn validate_advanced_structure_v0(&self, execution_context: &mut StateTransitionExecutionContext) -> Result, Error>; +} + +impl DataContractCreatedStateTransitionAdvancedStructureValidationV0 + for DataContractCreateTransition +{ + fn validate_advanced_structure_v0( + &self, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error> { + if self.data_contract().version() != INITIAL_DATA_CONTRACT_VERSION { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![InvalidDataContractVersionError::new( + INITIAL_DATA_CONTRACT_VERSION, + self.data_contract().version(), + ) + .into()], + )); + } + + // Validate data contract id + let generated_id = DataContract::generate_data_contract_id_v0( + self.data_contract().owner_id(), + self.identity_nonce(), + ); + + // This hash will only take 1 block (64 bytes) + execution_context.add_operation(ValidationOperation::DoubleSha256(1)); + + if generated_id != self.data_contract().id() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + BasicError::InvalidDataContractIdError(InvalidDataContractIdError::new( + generated_id.to_vec(), + self.data_contract().id().to_vec(), + )) + .into(), + ], + )); + } + + Ok(ConsensusValidationResult::default()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use assert_matches::assert_matches; + + mod validate_advanced_structure { + use super::*; + use dpp::consensus::ConsensusError; + use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; + use dpp::prelude::{Identifier, IdentityNonce}; + use dpp::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; + use dpp::tests::fixtures::get_data_contract_fixture; + use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceActionAccessorsV0; + use platform_version::version::PlatformVersion; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; + + #[test] + fn should_return_invalid_result_if_contract_version_is_not_initial() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let mut data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + data_contract.set_version(6); + + let identity_id = data_contract.owner_id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .validate_advanced_structure_v0(&mut execution_context) + .expect("failed to validate advanced structure"); + + assert_matches!(execution_context.operations_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) + if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError(BasicError::InvalidDataContractVersionError(e))] if e.expected_version() == INITIAL_DATA_CONTRACT_VERSION && e.version() == 6 + ); + } + + #[test] + fn should_return_invalid_result_if_contract_id_is_not_valid() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let mut data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let original_id = data_contract.id(); + let invalid_id = Identifier::default(); + + data_contract.set_id(invalid_id); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .validate_advanced_structure_v0(&mut execution_context) + .expect("failed to validate advanced structure"); + + assert_matches!( + execution_context.operations_slice(), + [ValidationOperation::DoubleSha256(1)] + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) + if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError(BasicError::InvalidDataContractIdError(e))] + if Identifier::try_from(e.expected_id()).unwrap() == original_id + && Identifier::try_from(e.invalid_id()).unwrap() == invalid_id + ); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/mod.rs new file mode 100644 index 00000000000..a220f2d16fa --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_create::identity_nonce::v0::DataContractCreateTransitionIdentityNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for DataContractCreateTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .contract_create_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract create transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "data contract create transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/v0/mod.rs new file mode 100644 index 00000000000..f47704af14f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait DataContractCreateTransitionIdentityNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContractCreateTransitionIdentityNonceV0 for DataContractCreateTransition { + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.identity_nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.data_contract().owner_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs index 1238d95630a..c22ef31de13 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs @@ -1,9 +1,11 @@ +mod advanced_structure; +mod identity_nonce; mod state; -mod structure; +use dpp::block::block_info::BlockInfo; +use dpp::identity::PartialIdentity; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; -use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; @@ -11,27 +13,43 @@ use drive::state_transition_action::StateTransitionAction; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_create::advanced_structure::v0::DataContractCreatedStateTransitionAdvancedStructureValidationV0; use crate::execution::validation::state_transition::data_contract_create::state::v0::DataContractCreateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::data_contract_create::structure::v0::DataContractCreatedStateTransitionStructureValidationV0; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionAdvancedStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +impl ValidationMode { + /// Returns if we should validate the contract when we transform it from its serialized form + pub fn should_fully_validate_contract_on_transform_into_action(&self) -> bool { + match self { + ValidationMode::CheckTx => false, + ValidationMode::RecheckTx => false, + ValidationMode::Validator => true, + ValidationMode::NoValidation => false, + } + } +} + impl StateTransitionActionTransformerV0 for DataContractCreateTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -39,7 +57,11 @@ impl StateTransitionActionTransformerV0 for DataContractCreateTransition { .contract_create_state_transition .transform_into_action { - 0 => self.transform_into_action_v0::(platform_version), + 0 => self.transform_into_action_v0::( + validation_mode, + execution_context, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "data contract create transition: transform_into_action".to_string(), known_versions: vec![0], @@ -49,29 +71,36 @@ impl StateTransitionActionTransformerV0 for DataContractCreateTransition { } } -impl StateTransitionStructureValidationV0 for DataContractCreateTransition { - fn validate_structure( +impl StateTransitionAdvancedStructureValidationV0 for DataContractCreateTransition { + fn validate_advanced_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, - ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; + _identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { match platform_version .drive_abci .validation_and_processing .state_transitions .contract_create_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "data contract create transition: validate_structure".to_string(), + Some(0) => self.validate_advanced_structure_v0(execution_context), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract create transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "data contract create transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } + + fn has_advanced_structure_validation_without_state(&self) -> bool { + true + } } impl StateTransitionStateValidationV0 for DataContractCreateTransition { @@ -79,10 +108,13 @@ impl StateTransitionStateValidationV0 for DataContractCreateTransition { &self, _action: Option, platform: &PlatformRef, + validation_mode: ValidationMode, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -90,7 +122,14 @@ impl StateTransitionStateValidationV0 for DataContractCreateTransition { .contract_create_state_transition .state { - 0 => self.validate_state_v0(platform, tx, platform_version), + 0 => self.validate_state_v0( + platform, + validation_mode, + &block_info.epoch, + tx, + execution_context, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "data contract create transition: validate_state".to_string(), known_versions: vec![0], @@ -99,3 +138,213 @@ impl StateTransitionStateValidationV0 for DataContractCreateTransition { } } } + +#[cfg(test)] +mod tests { + use crate::execution::validation::state_transition::state_transitions::tests::setup_identity; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; + use crate::test::helpers::setup::TestPlatformBuilder; + use assert_matches::assert_matches; + use dpp::block::block_info::BlockInfo; + use dpp::consensus::basic::BasicError; + use dpp::consensus::ConsensusError; + use dpp::dash_to_credits; + use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::data_contract_create_transition::methods::DataContractCreateTransitionMethodsV0; + use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; + use dpp::tests::json_document::json_document_to_contract_with_ids; + use platform_version::version::PlatformVersion; + + #[test] + fn test_data_contract_creation_with_contested_unique_index() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let data_contract = json_document_to_contract_with_ids( + "tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index.json", + None, + None, + false, //no need to validate the data contracts in tests for drive + platform_version, + ) + .expect("expected to get json based contract"); + + let data_contract_create_transition = DataContractCreateTransition::new_from_data_contract( + data_contract, + 1, + &identity.into_partial_identity_info(), + key.id(), + &signer, + platform_version, + None, + ) + .expect("expect to create documents batch transition"); + + let data_contract_create_serialized_transition = data_contract_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![data_contract_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::SuccessfulExecution(_, _)] + ); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + } + + #[test] + fn test_dpns_contract_creation_with_contract_id_non_contested() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let data_contract = json_document_to_contract_with_ids( + "tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id.json", + None, + None, + false, //no need to validate the data contracts in tests for drive + platform_version, + ) + .expect("expected to get json based contract"); + + let data_contract_create_transition = DataContractCreateTransition::new_from_data_contract( + data_contract, + 1, + &identity.into_partial_identity_info(), + key.id(), + &signer, + platform_version, + None, + ) + .expect("expect to create documents batch transition"); + + let data_contract_create_serialized_transition = data_contract_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![data_contract_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::SuccessfulExecution(_, _)] + ); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + } + + #[test] + fn test_data_contract_creation_with_contested_unique_index_and_unique_index_should_fail() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let data_contract = json_document_to_contract_with_ids( + "tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-and-other-unique-index.json", + None, + None, + false, //no need to validate the data contracts in tests for drive + platform_version, + ) + .expect("expected to get json based contract"); + + let data_contract_create_transition = DataContractCreateTransition::new_from_data_contract( + data_contract, + 1, + &identity.into_partial_identity_info(), + key.id(), + &signer, + platform_version, + None, + ) + .expect("expect to create documents batch transition"); + + let data_contract_create_serialized_transition = data_contract_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![data_contract_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::PaidConsensusError( + ConsensusError::BasicError(BasicError::ContestedUniqueIndexWithUniqueIndexError(_)), + _ + )] + ); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs index 15e656dce8b..27c7a5ce4ed 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs @@ -1,28 +1,42 @@ use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::block::epoch::Epoch; use dpp::consensus::state::data_contract::data_contract_already_present_error::DataContractAlreadyPresentError; use dpp::consensus::state::state_error::StateError; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::ProtocolError; -use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; +use crate::error::execution::ExecutionError; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::execution::validation::state_transition::ValidationMode; +use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use drive::state_transition_action::contract::data_contract_create::DataContractCreateTransitionAction; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; use drive::state_transition_action::StateTransitionAction; pub(in crate::execution::validation::state_transition::state_transitions::data_contract_create) trait DataContractCreateStateTransitionStateValidationV0 { fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error>; fn transform_into_action_v0( &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error>; } @@ -31,40 +45,465 @@ impl DataContractCreateStateTransitionStateValidationV0 for DataContractCreateTr fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error> { - let drive = platform.drive; + let action = self.transform_into_action_v0::( + validation_mode, + execution_context, + platform_version, + )?; + + if !action.is_valid() { + return Ok(action); + } + + let contract_fetch_info = platform.drive.get_contract_with_fetch_info_and_fee( + self.data_contract().id().to_buffer(), + Some(epoch), + false, + tx, + platform_version, + )?; + + let fee = contract_fetch_info.0.ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "fee must exist in validate state for data contract create transition", + ), + ))?; + + // We add the cost for fetching the contract even if the contract doesn't exist or was in cache + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + // Data contract shouldn't exist - if drive - .get_contract_with_fetch_info_and_fee( - self.data_contract().id().to_buffer(), - None, - false, - tx, - platform_version, - )? - .1 - .is_some() - { - Ok(ConsensusValidationResult::new_with_errors(vec![ - StateError::DataContractAlreadyPresentError(DataContractAlreadyPresentError::new( - self.data_contract().id().to_owned(), - )) - .into(), - ])) - } else { - self.transform_into_action_v0::(platform_version) + if contract_fetch_info.1.is_some() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![StateError::DataContractAlreadyPresentError( + DataContractAlreadyPresentError::new(self.data_contract().id().to_owned()), + ) + .into()], + )); } + + Ok(action) } fn transform_into_action_v0( &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error> { - let create_action: DataContractCreateTransitionAction = - self.try_into_platform_versioned(platform_version)?; - let action: StateTransitionAction = create_action.into(); - Ok(action.into()) + let mut validation_operations = vec![]; + + // The transformation of the state transition into the state transition action will transform + // The contract in serialized form into it's execution form + let result = DataContractCreateTransitionAction::try_from_borrowed_transition( + self, + validation_mode.should_fully_validate_contract_on_transform_into_action(), + &mut validation_operations, + platform_version, + ); + + execution_context.add_dpp_operations(validation_operations); + + // Return validation result if any consensus errors happened + // during data contract validation + match result { + Err(ProtocolError::ConsensusError(consensus_error)) => { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![*consensus_error], + )) + } + Err(protocol_error) => Err(protocol_error.into()), + Ok(create_action) => { + let action: StateTransitionAction = create_action.into(); + Ok(action.into()) + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TestPlatformBuilder; + use assert_matches::assert_matches; + use dpp::block::block_info::BlockInfo; + use dpp::consensus::basic::BasicError; + use dpp::consensus::ConsensusError; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::errors::DataContractError; + use dpp::data_contract::serialized_version::DataContractInSerializationFormat; + use dpp::platform_value::Value; + use dpp::prelude::IdentityNonce; + use dpp::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; + use dpp::tests::fixtures::get_data_contract_fixture; + use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceActionAccessorsV0; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; + + mod validate_state_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_when_transform_into_action_failed() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + None, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_return_invalid_result_when_contract_with_specified_id_already_exists() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + None, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError(StateError::DataContractAlreadyPresentError(e))] if *e.data_contract_id() == data_contract_id + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) + if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_pass_when_data_contract_valid_and_does_not_exist() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + None, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractCreateAction(action)) if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + } + + mod transform_into_action_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_if_data_contract_is_not_valid() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0::( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_pass_when_data_contract_is_valid() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0::( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractCreateAction(action)) if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/v0/mod.rs deleted file mode 100644 index 6ef443a4adc..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/v0/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::error::Error; -use dpp::consensus::basic::data_contract::InvalidDataContractIdError; -use dpp::consensus::basic::BasicError; -use dpp::prelude::DataContract; -use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; -use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use dpp::ProtocolError; - -pub(in crate::execution::validation::state_transition::state_transitions::data_contract_create) trait DataContractCreatedStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self, platform_version: &PlatformVersion) -> Result; -} - -impl DataContractCreatedStateTransitionStructureValidationV0 for DataContractCreateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - // Validate data contract - let result = DataContract::try_from_platform_versioned( - self.data_contract().clone(), - true, - platform_version, - ); - - // Return validation result if any consensus errors happened - // during data contract validation - match result { - Err(ProtocolError::ConsensusError(consensus_error)) => { - return Ok(SimpleConsensusValidationResult::new_with_error( - *consensus_error, - )) - } - Err(protocol_error) => return Err(protocol_error.into()), - Ok(_) => {} - } - - // Validate data contract id - let generated_id = DataContract::generate_data_contract_id_v0( - self.data_contract().owner_id(), - self.entropy(), - ); - - if generated_id != self.data_contract().id() { - return Ok(SimpleConsensusValidationResult::new_with_error( - BasicError::InvalidDataContractIdError(InvalidDataContractIdError::new( - generated_id.to_vec(), - self.data_contract().id().to_vec(), - )) - .into(), - )); - } - - Ok(SimpleConsensusValidationResult::default()) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..6b977fccd61 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/mod.rs @@ -0,0 +1,51 @@ +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use drive::grovedb::TransactionArg; +use dpp::version::PlatformVersion; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_update::identity_contract_nonce::v0::DataContractUpdateStateTransitionIdentityContractNonceV0; +use crate::execution::validation::state_transition::processor::v0::{StateTransitionNonceValidationV0}; +use crate::platform_types::platform::{PlatformStateRef}; + +pub(crate) mod v0; + +impl StateTransitionNonceValidationV0 for DataContractUpdateTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .contract_update_state_transition + .nonce + { + Some(0) => self.validate_identity_contract_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract update transition: validate_identity_contract_nonce" + .to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "data contract update transition: validate_identity_contract_nonce" + .to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..2f012f5a0c4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/v0/mod.rs @@ -0,0 +1,72 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait DataContractUpdateStateTransitionIdentityContractNonceV0 +{ + fn validate_identity_contract_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContractUpdateStateTransitionIdentityContractNonceV0 for DataContractUpdateTransition { + fn validate_identity_contract_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.identity_contract_nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.data_contract().owner_id(); + let contract_id = self.data_contract().id(); + let (existing_nonce, fee) = platform.drive.fetch_identity_contract_nonce_with_fees( + identity_id.to_buffer(), + contract_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs index 1fc864b41fa..d74a18ba331 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs @@ -1,24 +1,23 @@ +mod identity_contract_nonce; mod state; -mod structure; +use dpp::block::block_info::BlockInfo; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; +use dpp::validation::ConsensusValidationResult; use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; -use dpp::version::PlatformVersion; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; + use drive::state_transition_action::StateTransitionAction; use crate::execution::validation::state_transition::data_contract_update::state::v0::DataContractUpdateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::data_contract_update::structure::v0::DataContractUpdateStateTransitionStructureValidationV0; -use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, -}; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform::PlatformRef; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; @@ -26,11 +25,13 @@ impl StateTransitionActionTransformerV0 for DataContractUpdateTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -38,7 +39,9 @@ impl StateTransitionActionTransformerV0 for DataContractUpdateTransition { .contract_update_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(platform_version), + 0 => { + self.transform_into_action_v0(validation_mode, execution_context, platform_version) + } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "data contract update transition: transform_into_action".to_string(), known_versions: vec![0], @@ -48,77 +51,105 @@ impl StateTransitionActionTransformerV0 for DataContractUpdateTransition { } } -impl StateTransitionStructureValidationV0 for DataContractUpdateTransition { - fn validate_structure( - &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, - ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .contract_update_state_transition - .structure - { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "data contract update transition: validate_structure".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} - -impl StateTransitionStateValidationV0 for DataContractUpdateTransition { - fn validate_state( - &self, - _action: Option, - platform: &PlatformRef, - tx: TransactionArg, - ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .contract_update_state_transition - .state - { - 0 => self.validate_state_v0(platform, tx, platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "data contract update transition: validate_state".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} - #[cfg(test)] mod tests { - use crate::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; + use crate::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig, ValidatorSetConfig}; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::MockCoreRPCLike; use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; use dpp::block::block_info::BlockInfo; + use dpp::consensus::state::state_error::StateError; + use dpp::consensus::ConsensusError; + use dpp::dash_to_credits; + use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; + use rand::prelude::StdRng; + use rand::SeedableRng; + use std::collections::BTreeMap; use dpp::data_contract::DataContract; + use dpp::fee::Credits; + use dpp::identifier::Identifier; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0}; use dpp::platform_value::BinaryData; - use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransitionV0; - + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::data_contract_update_transition::methods::DataContractUpdateTransitionMethodsV0; + use dpp::state_transition::data_contract_update_transition::{ + DataContractUpdateTransition, DataContractUpdateTransitionV0, + }; + + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; use dpp::tests::fixtures::get_data_contract_fixture; + use dpp::tests::json_document::json_document_to_contract; use dpp::version::PlatformVersion; + use drive::util::storage_flags::StorageFlags; + use simple_signer::signer::SimpleSigner; struct TestData { data_contract: DataContract, platform: TempPlatform, } + fn setup_identity( + platform: &mut TempPlatform, + seed: u64, + credits: Credits, + ) -> (Identity, SimpleSigner, IdentityPublicKey) { + let platform_version = PlatformVersion::latest(); + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key_with_rng( + 0, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key_with_rng( + 1, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let identity: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + ]), + balance: credits, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + (identity, signer, critical_public_key) + } + fn apply_contract( platform: &TempPlatform, data_contract: &DataContract, @@ -140,18 +171,21 @@ mod tests { fn setup_test() -> TestData { let platform_version = PlatformVersion::latest(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); let config = PlatformConfig { - quorum_size: 10, + validator_set: ValidatorSetConfig { + quorum_size: 10, + ..Default::default() + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 300, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let platform = TestPlatformBuilder::new() @@ -184,9 +218,11 @@ mod tests { use dpp::platform_value::platform_value; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; + use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; + use crate::execution::validation::state_transition::ValidationMode; use dpp::version::TryFromPlatformVersioned; use platform_version::version::LATEST_PLATFORM_VERSION; - use platform_version::TryIntoPlatformVersioned; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; #[test] pub fn should_return_error_if_trying_to_update_document_schema_in_a_readonly_contract() { @@ -220,29 +256,49 @@ mod tests { data_contract.increment_version(); data_contract - .set_document_schema("niceDocument", updated_document, true, platform_version) + .set_document_schema( + "niceDocument", + updated_document, + true, + &mut vec![], + platform_version, + ) .expect("to be able to set document schema"); let state_transition = DataContractUpdateTransitionV0 { + identity_contract_nonce: 1, data_contract: DataContractInSerializationFormat::try_from_platform_versioned( data_contract, platform_version, ) .expect("to be able to convert data contract to serialization format"), + user_fee_increase: 0, signature: BinaryData::new(vec![0; 65]), signature_public_key_id: 0, }; + let state = platform.state.load(); + let platform_ref = PlatformRef { drive: &platform.drive, - state: &platform.state.read().unwrap(), + state: &state, config: &platform.config, core_rpc: &platform.core_rpc, - block_info: &BlockInfo::default(), }; + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("expected a platform version"); + let result = DataContractUpdateTransition::V0(state_transition) - .validate_state(None, &platform_ref, None) + .validate_state( + None, + &platform_ref, + ValidationMode::Validator, + &BlockInfo::default(), + &mut execution_context, + None, + ) .expect("state transition to be validated"); assert!(!result.is_valid()); @@ -293,30 +349,50 @@ mod tests { data_contract.increment_version(); data_contract - .set_document_schema("niceDocument", updated_document, true, platform_version) + .set_document_schema( + "niceDocument", + updated_document, + true, + &mut vec![], + platform_version, + ) .expect("to be able to set document schema"); // TODO: add a data contract stop transition let state_transition = DataContractUpdateTransitionV0 { + identity_contract_nonce: 1, data_contract: DataContractInSerializationFormat::try_from_platform_versioned( data_contract.clone(), platform_version, ) .expect("to be able to convert data contract to serialization format"), + user_fee_increase: 0, signature: BinaryData::new(vec![0; 65]), signature_public_key_id: 0, }; + let state = platform.state.load(); + let platform_ref = PlatformRef { drive: &platform.drive, - state: &platform.state.read().unwrap(), + state: &state, config: &platform.config, core_rpc: &platform.core_rpc, - block_info: &BlockInfo::default(), }; + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("expected a platform version"); + let result = DataContractUpdateTransition::V0(state_transition) - .validate_state(None, &platform_ref, None) + .validate_state( + None, + &platform_ref, + ValidationMode::Validator, + &BlockInfo::default(), + &mut execution_context, + None, + ) .expect("state transition to be validated"); assert!(result.is_valid()); @@ -392,12 +468,14 @@ mod tests { } #[test] - fn should_fail_if_trying_to_update_config() { + fn should_return_invalid_result_if_trying_to_update_config() { let TestData { mut data_contract, platform, } = setup_test(); + let platform_version = PlatformVersion::latest(); + data_contract.config_mut().set_keeps_history(true); data_contract.config_mut().set_readonly(false); @@ -437,6 +515,7 @@ mod tests { "niceDocument", updated_document_type.into(), true, + &mut vec![], LATEST_PLATFORM_VERSION, ) .expect("to be able to set document schema"); @@ -444,22 +523,34 @@ mod tests { // It should be not possible to modify this data_contract.config_mut().set_keeps_history(false); - let state_transition: DataContractUpdateTransitionV0 = data_contract + let state_transition: DataContractUpdateTransitionV0 = (data_contract, 1) .try_into_platform_versioned(LATEST_PLATFORM_VERSION) .expect("expected an update transition"); let state_transition: DataContractUpdateTransition = state_transition.into(); + let state = platform.state.load(); + let platform_ref = PlatformRef { drive: &platform.drive, - state: &platform.state.read().unwrap(), + state: &state, config: &platform.config, core_rpc: &platform.core_rpc, - block_info: &BlockInfo::default(), }; + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("expected a platform version"); + let result = state_transition - .validate_state(None, &platform_ref, None) + .validate_state( + None, + &platform_ref, + ValidationMode::Validator, + &BlockInfo::default(), + &mut execution_context, + None, + ) .expect("state transition to be validated"); assert!(!result.is_valid()); @@ -468,11 +559,111 @@ mod tests { StateError::DataContractConfigUpdateError, 1 ); - let error = errors.get(0).expect("to have an error"); + let error = errors.first().expect("to have an error"); assert_eq!( error.additional_message(), "contract can not change whether it keeps history: changing from true to false" ); } } + + #[test] + fn test_data_contract_update_changing_various_document_type_options() { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-creation-restricted-to-owner.json"; + + let platform_state = platform.state.load(); + let platform_version = platform_state + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let mut contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + + contract.set_owner_id(identity.id()); + + platform + .drive + .apply_contract( + &contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let updated_card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json"; + + // let's construct the grovedb structure for the card game data contract + let mut contract_not_restricted_to_owner = + json_document_to_contract(updated_card_game_path, true, platform_version) + .expect("expected to get data contract"); + + contract_not_restricted_to_owner.set_owner_id(identity.id()); + + contract_not_restricted_to_owner.set_version(2); + + let data_contract_update_transition = DataContractUpdateTransition::new_from_data_contract( + contract_not_restricted_to_owner, + &identity.into_partial_identity_info(), + key.id(), + 2, + 0, + &signer, + platform_version, + None, + ) + .expect("expect to create documents batch transition"); + + let data_contract_update_serialized_transition = data_contract_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![data_contract_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + // There is no issue because the creator of the contract made the document + + assert_eq!(processing_result.invalid_paid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let result = processing_result.into_execution_results().remove(0); + + assert!(matches!( + result, + StateTransitionExecutionResult::PaidConsensusError( + ConsensusError::StateError( + StateError::DocumentTypeUpdateError(error) + ), _ + ) if error.data_contract_id() == &contract.id() + && error.document_type_name() == "card" + && error.additional_message() == "document type can not change creation restriction mode: changing from Owner Only to No Restrictions" + )); + } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs index 9a1925de7fc..3d32ae75290 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs @@ -1 +1,57 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_update::state::v0::DataContractUpdateStateTransitionStateValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionStateValidationV0; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform::PlatformRef; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; +use dpp::validation::ConsensusValidationResult; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::StateTransitionAction; + pub(crate) mod v0; + +impl StateTransitionStateValidationV0 for DataContractUpdateTransition { + fn validate_state( + &self, + action: Option, + platform: &PlatformRef, + validation_mode: ValidationMode, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error> { + let platform_version = platform.state.current_platform_version()?; + + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .contract_update_state_transition + .state + { + 0 => { + if action.is_some() { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution("data contract update is calling validate state, and the action is already known. It should not be known at this point"))); + } + self.validate_state_v0( + platform, + validation_mode, + &block_info.epoch, + execution_context, + tx, + platform_version, + ) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract update transition: validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs index 92d98021473..ef81c1a3650 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs @@ -1,49 +1,48 @@ use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; -use serde::Serialize; +use dpp::block::epoch::Epoch; -use dpp::consensus::basic::data_contract::{ - DataContractInvalidIndexDefinitionUpdateError, IncompatibleDataContractSchemaError, - InvalidDataContractVersionError, -}; use dpp::consensus::basic::document::DataContractNotPresentError; use dpp::consensus::basic::BasicError; -use dpp::consensus::state::data_contract::data_contract_is_readonly_error::DataContractIsReadonlyError; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::config::v0::DataContractConfigGettersV0; +use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::document_type::schema::{ - get_operation_and_property_name_json, validate_schema_compatibility, EMPTY_JSON, -}; -use dpp::data_contract::schema::DataContractSchemaMethodsV0; -use dpp::data_contract::JsonValue; -use dpp::platform_value::converter::serde_json::BTreeValueJsonConverter; -use dpp::platform_value::{Value, ValueMap}; +use dpp::data_contract::validate_update::DataContractUpdateValidationMethodsV0; use dpp::prelude::ConsensusValidationResult; -use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; use dpp::ProtocolError; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; +use dpp::version::PlatformVersion; +use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::ValidationMode; use drive::grovedb::TransactionArg; use drive::state_transition_action::contract::data_contract_update::DataContractUpdateTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; use drive::state_transition_action::StateTransitionAction; pub(in crate::execution::validation::state_transition::state_transitions::data_contract_update) trait DataContractUpdateStateTransitionStateValidationV0 { fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; fn transform_into_action_v0( &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion ) -> Result, Error>; } @@ -52,16 +51,24 @@ impl DataContractUpdateStateTransitionStateValidationV0 for DataContractUpdateTr fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - let action = self.transform_into_action_v0(platform_version)?; + let action = + self.transform_into_action_v0(validation_mode, execution_context, platform_version)?; - if !action.is_valid_with_data() { + if !action.is_valid() { return Ok(action); } - let state_transition_action = action.data.as_ref().unwrap(); + let state_transition_action = action.data.as_ref().ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "we should always have an action at this point in data contract update", + ), + ))?; let new_data_contract = match state_transition_action { StateTransitionAction::DataContractUpdateAction(action) => { @@ -69,192 +76,578 @@ impl DataContractUpdateStateTransitionStateValidationV0 for DataContractUpdateTr } _ => None, } - .unwrap(); + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we should always have a data contract at this point in data contract update", + )))?; let drive = platform.drive; - let mut validation_result = ConsensusValidationResult::default(); + + // Check previous data contract already exists in the state + // Failure (contract does not exist): Keep ST and transform it to a nonce bump action. + // How: A user pushed an update for a data contract that didn’t exist. + // Note: Existing in the state can also mean that it exists in the current block state, meaning that the contract was inserted in the same block with a previous transition. + // Data contract should exist - let add_to_cache_if_pulled = tx.is_some(); + let add_to_cache_if_pulled = validation_mode.can_alter_cache(); + + let data_contract_fetch_info = drive.get_contract_with_fetch_info_and_fee( + new_data_contract.id().to_buffer(), + Some(epoch), + add_to_cache_if_pulled, + tx, + platform_version, + )?; + + let fee = data_contract_fetch_info.0.ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "fee must exist in validate state for data contract update transition", + ), + ))?; + + // We add the cost for fetching the contract even if the contract doesn't exist or was in cache + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + // Data contract should exist - let Some(contract_fetch_info) = drive - .get_contract_with_fetch_info_and_fee( - new_data_contract.id().to_buffer(), - None, - add_to_cache_if_pulled, - tx, - platform_version, - )? - .1 - else { - validation_result.add_error(BasicError::DataContractNotPresentError( - DataContractNotPresentError::new(new_data_contract.id()), + let Some(contract_fetch_info) = data_contract_fetch_info.1 else { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_data_contract_update_transition( + self, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + BasicError::DataContractNotPresentError(DataContractNotPresentError::new( + new_data_contract.id(), + )) + .into(), + ], )); - return Ok(validation_result); }; let old_data_contract = &contract_fetch_info.contract; - let new_version = new_data_contract.version(); - let old_version = old_data_contract.version(); - if new_version < old_version || new_version - old_version != 1 { - validation_result.add_error(BasicError::InvalidDataContractVersionError( - InvalidDataContractVersionError::new(old_version + 1, new_version), - )) + let validation_result = + old_data_contract.validate_update(new_data_contract, platform_version)?; + + if !validation_result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_data_contract_update_transition( + self, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } - if old_data_contract.config().readonly() { - validation_result.add_error(DataContractIsReadonlyError::new(new_data_contract.id())); - return Ok(validation_result); + Ok(action) + } + + fn transform_into_action_v0( + &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut validation_operations = vec![]; + + let result = DataContractUpdateTransitionAction::try_from_borrowed_transition( + self, + validation_mode.should_fully_validate_contract_on_transform_into_action(), + &mut validation_operations, + platform_version, + ); + + execution_context.add_dpp_operations(validation_operations); + + // Return validation result if any consensus errors happened + // during data contract validation + match result { + Err(ProtocolError::ConsensusError(consensus_error)) => { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_data_contract_update_transition(self), + ); + + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![*consensus_error], + )) + } + Err(protocol_error) => Err(protocol_error.into()), + Ok(create_action) => { + let action: StateTransitionAction = create_action.into(); + Ok(action.into()) + } } + } +} - // We should now validate that new indexes contains all old indexes - // This is most easily done by using the index level construct - - for (new_contract_document_type_name, new_contract_document_type) in - new_data_contract.document_types() - { - let Some(old_contract_document_type) = - old_data_contract.document_type_optional_for_name(new_contract_document_type_name) - else { - // if it's a new document type (ie the old data contract didn't have it) - // then new indices on it are fine - continue; +#[cfg(test)] +mod tests { + use super::*; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TestPlatformBuilder; + use assert_matches::assert_matches; + use dpp::block::block_info::BlockInfo; + use dpp::consensus::ConsensusError; + use dpp::data_contract::accessors::v0::DataContractV0Setters; + use dpp::data_contract::errors::DataContractError; + use dpp::data_contract::serialized_version::DataContractInSerializationFormat; + use dpp::platform_value::Value; + use dpp::prelude::IdentityNonce; + use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransitionV0; + use dpp::tests::fixtures::get_data_contract_fixture; + use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceActionAccessorsV0; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; + + mod validate_state_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_when_transform_into_action_failed() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, }; - // If the new contract document type doesn't contain all previous indexes then - // there is a problem - if let Some(non_subset_path) = new_contract_document_type - .index_structure() - .contains_subset_first_non_subset_path(old_contract_document_type.index_structure()) - { - validation_result.add_error( - BasicError::DataContractInvalidIndexDefinitionUpdateError( - DataContractInvalidIndexDefinitionUpdateError::new( - new_contract_document_type_name.clone(), - non_subset_path, - ), - ), + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, ) - } + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } - if !validation_result.is_valid() { - return Ok(validation_result); - } + #[test] + fn should_return_invalid_result_when_data_contract_does_not_exist() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); - let config_validation_result = old_data_contract.config().validate_config_update( - new_data_contract.config(), - self.data_contract().id(), - platform_version, - )?; + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; - if !config_validation_result.is_valid() { - validation_result.merge(config_validation_result); - return Ok(validation_result); + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractNotPresentError(e) + )] if e.data_contract_id() == data_contract_id + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } - // Schema defs should be compatible - - // TODO: WE need to combine defs with documents schema and and resolve all refs - // Having such full schema we can make sure that changes in defs are actually - // affect document schema. Current simplified solution just apply the same logic - // as for document schema - if let Some(old_defs) = old_data_contract.schema_defs() { - let Some(new_defs) = self.data_contract().schema_defs() else { - validation_result.add_error(BasicError::IncompatibleDataContractSchemaError( - IncompatibleDataContractSchemaError::new( - self.data_contract().id(), - "remove".to_string(), - "$defs".to_string(), - old_defs.into(), - Value::Null, - ), - )); - - return Ok(validation_result); + #[test] + fn should_return_invalid_result_when_new_data_contract_has_incompatible_changes() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, }; - let old_defs_json: JsonValue = old_defs - .to_json_value() - .map_err(ProtocolError::ValueError)?; + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::InvalidDataContractVersionError(e) + )] if e.expected_version() == 2 && e.version() == 1 + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_pass_when_contract_exists_and_update_is_compatible() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); - let new_defs_json: JsonValue = new_defs - .to_json_value() - .map_err(ProtocolError::ValueError)?; + let mut data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); - let diffs = - validate_schema_compatibility(&old_defs_json, &new_defs_json, platform_version)?; + let data_contract_id = data_contract.id(); - if diffs.len() > 0 { - let (operation_name, property_name) = - get_operation_and_property_name_json(&diffs[0]); + data_contract.set_version(2); - validation_result.add_error(BasicError::IncompatibleDataContractSchemaError( - IncompatibleDataContractSchemaError::new( - self.data_contract().id(), - operation_name.to_owned(), - property_name.to_owned(), - old_defs_json.into(), - new_defs_json.into(), - ), - )); + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); - return Ok(validation_result); + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractUpdateAction(action)) + if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } + } - for (document_type_name, old_document_schema) in old_data_contract.document_schemas() { - let old_document_schema_json: JsonValue = old_document_schema - .clone() - .try_into() - .map_err(ProtocolError::ValueError)?; - - let new_document_schema = new_data_contract - .document_type_optional_for_name(&document_type_name) - .map(|document_type| document_type.schema().clone()) - .unwrap_or(ValueMap::new().into()); - - let new_document_schema_json: JsonValue = new_document_schema - .clone() - .try_into() - .map_err(ProtocolError::ValueError)?; - - let diffs = validate_schema_compatibility( - &old_document_schema_json, - &new_document_schema_json, - platform_version, - )?; - - if diffs.len() > 0 { - let (operation_name, property_name) = - get_operation_and_property_name_json(&diffs[0]); - - validation_result.add_error(BasicError::IncompatibleDataContractSchemaError( - IncompatibleDataContractSchemaError::new( - self.data_contract().id(), - operation_name.to_owned(), - property_name.to_owned(), - old_document_schema.clone(), - new_document_schema, - ), - )); - - return Ok(validation_result); + mod transform_into_action_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_when_new_data_contract_is_not_valid() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } - Ok(action) - } + #[test] + fn should_pass_when_new_data_contract_is_valid() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); - fn transform_into_action_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let action: StateTransitionAction = TryIntoPlatformVersioned::< - DataContractUpdateTransitionAction, - >::try_into_platform_versioned( - self, platform_version - )? - .into(); - Ok(action.into()) + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractUpdateAction(action)) if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/v0/mod.rs deleted file mode 100644 index 20853351aeb..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/v0/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::error::Error; -use dpp::data_contract::DataContract; -use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; -use dpp::ProtocolError; - -use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; - -pub(in crate::execution::validation::state_transition::state_transitions::data_contract_update) trait DataContractUpdateStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self, platform_version: &PlatformVersion) -> Result; -} - -impl DataContractUpdateStateTransitionStructureValidationV0 for DataContractUpdateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - match DataContract::try_from_platform_versioned( - self.data_contract().clone(), - true, - platform_version, - ) { - Ok(_) => Ok(SimpleConsensusValidationResult::default()), - Err(ProtocolError::ConsensusError(e)) => Ok( - SimpleConsensusValidationResult::new_with_error(e.as_ref().clone()), - ), - Err(e) => Err(e.into()), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs index 1d287f1095c..54176e1dcee 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::block_info::BlockInfo; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; @@ -5,6 +6,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_create_transition_action::state_v0::DocumentCreateTransitionActionStateValidationV0; use crate::execution::validation::state_transition::documents_batch::action_validation::document_create_transition_action::structure_v0::DocumentCreateTransitionActionStructureValidationV0; use crate::platform_types::platform::PlatformStateRef; @@ -15,7 +17,7 @@ mod structure_v0; pub trait DocumentCreateTransitionActionValidation { fn validate_structure( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result; @@ -23,6 +25,8 @@ pub trait DocumentCreateTransitionActionValidation { &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -31,7 +35,7 @@ pub trait DocumentCreateTransitionActionValidation { impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction { fn validate_structure( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -41,7 +45,7 @@ impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction .documents_batch_state_transition .document_create_transition_structure_validation { - 0 => self.validate_structure_v0(platform, platform_version), + 0 => self.validate_structure_v0(owner_id, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentCreateTransitionAction::validate_structure".to_string(), known_versions: vec![0], @@ -54,6 +58,8 @@ impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -64,7 +70,14 @@ impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction .documents_batch_state_transition .document_create_transition_state_validation { - 0 => self.validate_state_v0(platform, owner_id, transaction, platform_version), + 0 => self.validate_state_v0( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentCreateTransitionAction::validate_state".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs index 963bb4708d1..29368d7c99c 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs @@ -1,16 +1,25 @@ +use dpp::block::block_info::BlockInfo; use dpp::consensus::basic::document::InvalidDocumentTypeError; use dpp::consensus::ConsensusError; use dpp::consensus::state::document::document_already_present_error::DocumentAlreadyPresentError; +use dpp::consensus::state::document::document_contest_currently_locked_error::DocumentContestCurrentlyLockedError; +use dpp::consensus::state::document::document_contest_identity_already_contestant::DocumentContestIdentityAlreadyContestantError; +use dpp::consensus::state::document::document_contest_not_joinable_error::DocumentContestNotJoinableError; use dpp::consensus::state::state_error::StateError; use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::{DocumentV0Getters}; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::prelude::{ConsensusValidationResult, Identifier}; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::{DocumentCreateTransitionAction, DocumentCreateTransitionActionAccessorsV0}; use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::{ContestedDocumentVotePollStatus, ContestedDocumentVotePollStoredInfoV0Getters}; +use drive::error::drive::DriveError; use drive::query::TransactionArg; use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; +use crate::execution::validation::state_transition::documents_batch::state::v0::fetch_contender::fetch_contender; use crate::execution::validation::state_transition::documents_batch::state::v0::fetch_documents::fetch_document_with_id; use crate::platform_types::platform::PlatformStateRef; @@ -19,6 +28,8 @@ pub(super) trait DocumentCreateTransitionActionStateValidationV0 { &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -28,6 +39,8 @@ impl DocumentCreateTransitionActionStateValidationV0 for DocumentCreateTransitio &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -46,7 +59,7 @@ impl DocumentCreateTransitionActionStateValidationV0 for DocumentCreateTransitio // TODO: Use multi get https://github.com/facebook/rocksdb/wiki/MultiGet-Performance // We should check to see if a document already exists in the state - let already_existing_document = fetch_document_with_id( + let (already_existing_document, fee_result) = fetch_document_with_id( platform.drive, contract, document_type, @@ -55,6 +68,8 @@ impl DocumentCreateTransitionActionStateValidationV0 for DocumentCreateTransitio platform_version, )?; + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee_result)); + if already_existing_document.is_some() { return Ok(ConsensusValidationResult::new_with_error( ConsensusError::StateError(StateError::DocumentAlreadyPresentError( @@ -65,16 +80,85 @@ impl DocumentCreateTransitionActionStateValidationV0 for DocumentCreateTransitio // we also need to validate that the new document wouldn't conflict with any other document // this means for example having overlapping unique indexes - platform - .drive - .validate_document_create_transition_action_uniqueness( - contract, - document_type, - self, - owner_id, - transaction, - platform_version, - ) - .map_err(Error::Drive) + + if document_type.indexes().values().any(|index| index.unique) { + let validation_result = platform + .drive + .validate_document_create_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive)?; + + if !validation_result.is_valid() { + return Ok(validation_result); + } + } + + if let Some((contested_document_resource_vote_poll, _)) = self.prefunded_voting_balance() { + if let Some(stored_info) = self.current_store_contest_info() { + // We have previous stored info + match stored_info.vote_poll_status() { + ContestedDocumentVotePollStatus::NotStarted => { + Ok(SimpleConsensusValidationResult::new()) + } + ContestedDocumentVotePollStatus::Awarded(_) => { + // This is weird as it should have already been found when querying the document, however it is possible + // That it was destroyed + Ok(SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::DocumentAlreadyPresentError( + DocumentAlreadyPresentError::new(self.base().id()), + )), + )) + } + ContestedDocumentVotePollStatus::Locked => { + Ok(SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::DocumentContestCurrentlyLockedError( + DocumentContestCurrentlyLockedError::new( + contested_document_resource_vote_poll.into(), + stored_info.clone(), + platform_version.fee_version.vote_resolution_fund_fees.contested_document_vote_resolution_unlock_fund_required_amount, + ))), + )) + } + ContestedDocumentVotePollStatus::Started(start_block) => { + // We need to make sure that if there is a contest, it is in its first week + // The week might be more or less, as it's a versioned parameter + let time_ms_since_start = block_info.time_ms.checked_sub(start_block.time_ms).ok_or(Error::Drive(drive::error::Error::Drive(DriveError::CorruptedDriveState(format!("it makes no sense that the start block time {} is before our current block time {}", start_block.time_ms, block_info.time_ms)))))?; + let join_time_allowed = platform_version.dpp.validation.voting.allow_other_contenders_time_ms; + if time_ms_since_start > join_time_allowed { + return Ok(SimpleConsensusValidationResult::new_with_error(ConsensusError::StateError(StateError::DocumentContestNotJoinableError( + DocumentContestNotJoinableError::new( + contested_document_resource_vote_poll.into(), + stored_info.clone(), + start_block.time_ms, + block_info.time_ms, + join_time_allowed, + ))))) + } + + // we need to also make sure that we are not already a contestant + + let (maybe_existing_contender, fee_result) = fetch_contender(platform.drive, contested_document_resource_vote_poll, owner_id, block_info, transaction, platform_version)?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee_result)); + + if maybe_existing_contender.is_some() { + Ok(SimpleConsensusValidationResult::new_with_error(ConsensusError::StateError(StateError::DocumentContestIdentityAlreadyContestantError(DocumentContestIdentityAlreadyContestantError::new(contested_document_resource_vote_poll.into(), owner_id))))) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } + } + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } else { + Ok(SimpleConsensusValidationResult::new()) + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs index 22409379a81..1fbfb2096a2 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs @@ -1,34 +1,26 @@ -use dpp::consensus::basic::document::{InvalidDocumentTypeError, MissingDocumentTypeError}; -use dpp::consensus::ConsensusError; -use dpp::consensus::state::document::document_timestamp_window_violation_error::DocumentTimestampWindowViolationError; -use dpp::consensus::state::document::document_timestamps_mismatch_error::DocumentTimestampsMismatchError; -use dpp::consensus::state::state_error::StateError; +use dpp::consensus::basic::document::{DocumentCreationNotAllowedError, InvalidDocumentTypeError}; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::validation::DataContractValidationMethodsV0; -use dpp::document::extended_document::property_names; -use dpp::identity::TimestampMillis; -use dpp::ProtocolError; +use dpp::data_contract::document_type::restricted_creation::CreationRestrictionMode; +use dpp::data_contract::validate_document::DataContractDocumentValidationMethodsV0; +use dpp::identifier::Identifier; use dpp::validation::{SimpleConsensusValidationResult}; -use dpp::validation::block_time_window::validate_time_in_block_time_window::validate_time_in_block_time_window; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::{DocumentCreateTransitionAction, DocumentCreateTransitionActionAccessorsV0}; use dpp::version::PlatformVersion; use crate::error::Error; -use crate::platform_types::platform::PlatformStateRef; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; pub(super) trait DocumentCreateTransitionActionStructureValidationV0 { fn validate_structure_v0( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result; } impl DocumentCreateTransitionActionStructureValidationV0 for DocumentCreateTransitionAction { fn validate_structure_v0( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { let contract_fetch_info = self.base().data_contract_fetch_info(); @@ -44,64 +36,29 @@ impl DocumentCreateTransitionActionStructureValidationV0 for DocumentCreateTrans )); }; - // Make sure that timestamps are present if required - let required_fields = document_type.required_fields(); - - if required_fields.contains(property_names::CREATED_AT) && self.created_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - if required_fields.contains(property_names::UPDATED_AT) && self.updated_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - if self.created_at().is_some() - && self.updated_at().is_some() - && self.created_at() != self.updated_at() - { - return Ok(SimpleConsensusValidationResult::new_with_error( - DocumentTimestampsMismatchError::new(self.base().id()).into(), - )); - } - - let validation_result = check_if_timestamps_are_equal(self); - if !validation_result.is_valid() { - return Ok(validation_result); - } - - // Validate timestamps against block time - // we do validation here but not in validate state because it's a cheap validation - // and validate state implements expensive validation only - let latest_block_time_ms = platform.state.last_block_time_ms(); - let average_block_spacing_ms = platform.config.block_spacing_ms; - - // We do not need to perform these checks on genesis - if let Some(latest_block_time_ms) = latest_block_time_ms { - let validation_result = check_created_inside_time_window( - self, - latest_block_time_ms, - average_block_spacing_ms, - platform_version, - )?; - if !validation_result.is_valid() { - return Ok(validation_result); + match document_type.creation_restriction_mode() { + CreationRestrictionMode::NoRestrictions => {} + CreationRestrictionMode::OwnerOnly => { + if owner_id != data_contract.owner_id() { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentCreationNotAllowedError::new( + self.base().data_contract_id(), + document_type_name.clone(), + document_type.creation_restriction_mode(), + ) + .into(), + )); + } } - - let validation_result = check_updated_inside_time_window( - self, - latest_block_time_ms, - average_block_spacing_ms, - platform_version, - )?; - - if !validation_result.is_valid() { - return Ok(validation_result); + CreationRestrictionMode::NoCreationAllowed => { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentCreationNotAllowedError::new( + self.base().data_contract_id(), + document_type_name.clone(), + document_type.creation_restriction_mode(), + ) + .into(), + )); } } @@ -112,91 +69,3 @@ impl DocumentCreateTransitionActionStructureValidationV0 for DocumentCreateTrans .map_err(Error::Protocol) } } - -fn check_if_timestamps_are_equal( - document_transition: &DocumentCreateTransitionAction, -) -> SimpleConsensusValidationResult { - let mut result = SimpleConsensusValidationResult::default(); - let created_at = document_transition.created_at(); - let updated_at = document_transition.updated_at(); - - if created_at.is_some() && updated_at.is_some() && updated_at.unwrap() != created_at.unwrap() { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampsMismatchError(DocumentTimestampsMismatchError::new( - document_transition.base().id(), - )), - )); - } - - result -} - -fn check_created_inside_time_window( - document_transition: &DocumentCreateTransitionAction, - last_block_ts_millis: TimestampMillis, - average_block_spacing_ms: u64, - platform_version: &PlatformVersion, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - let created_at = match document_transition.created_at() { - Some(t) => t, - None => return Ok(result), - }; - - let window_validation = validate_time_in_block_time_window( - last_block_ts_millis, - created_at, - average_block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - if !window_validation.valid { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampWindowViolationError( - DocumentTimestampWindowViolationError::new( - String::from("createdAt"), - document_transition.base().id(), - created_at as i64, - window_validation.time_window_start as i64, - window_validation.time_window_end as i64, - ), - ), - )); - } - Ok(result) -} - -fn check_updated_inside_time_window( - document_transition: &DocumentCreateTransitionAction, - last_block_ts_millis: TimestampMillis, - average_block_spacing_ms: u64, - platform_version: &PlatformVersion, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - let updated_at = match document_transition.updated_at() { - Some(t) => t, - None => return Ok(result), - }; - - let window_validation = validate_time_in_block_time_window( - last_block_ts_millis, - updated_at, - average_block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - if !window_validation.valid { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampWindowViolationError( - DocumentTimestampWindowViolationError::new( - String::from("updatedAt"), - document_transition.base().id(), - updated_at as i64, - window_validation.time_window_start as i64, - window_validation.time_window_end as i64, - ), - ), - )); - } - Ok(result) -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs index 3257028d794..b36e68daa93 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::block_info::BlockInfo; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; @@ -5,6 +6,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_delete_transition_action::state_v0::DocumentDeleteTransitionActionStateValidationV0; use crate::execution::validation::state_transition::documents_batch::action_validation::document_delete_transition_action::structure_v0::DocumentDeleteTransitionActionStructureValidationV0; use crate::platform_types::platform::PlatformStateRef; @@ -22,6 +24,8 @@ pub trait DocumentDeleteTransitionActionValidation { &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -52,6 +56,8 @@ impl DocumentDeleteTransitionActionValidation for DocumentDeleteTransitionAction &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -62,7 +68,14 @@ impl DocumentDeleteTransitionActionValidation for DocumentDeleteTransitionAction .documents_batch_state_transition .document_delete_transition_state_validation { - 0 => self.validate_state_v0(platform, owner_id, transaction, platform_version), + 0 => self.validate_state_v0( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentDeleteTransitionAction::validate_state".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs index be9d279253e..98ce7ed92b8 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::block_info::BlockInfo; use dpp::consensus::basic::document::InvalidDocumentTypeError; use dpp::consensus::ConsensusError; use dpp::consensus::state::document::document_not_found_error::DocumentNotFoundError; @@ -14,6 +15,8 @@ use drive::grovedb::TransactionArg; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; use crate::execution::validation::state_transition::documents_batch::state::v0::fetch_documents::fetch_document_with_id; use crate::platform_types::platform::PlatformStateRef; @@ -22,6 +25,8 @@ pub(super) trait DocumentDeleteTransitionActionStateValidationV0 { &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -31,6 +36,8 @@ impl DocumentDeleteTransitionActionStateValidationV0 for DocumentDeleteTransitio &self, platform: &PlatformStateRef, owner_id: Identifier, + _block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -48,7 +55,7 @@ impl DocumentDeleteTransitionActionStateValidationV0 for DocumentDeleteTransitio }; // TODO: Use multi get https://github.com/facebook/rocksdb/wiki/MultiGet-Performance - let original_document = fetch_document_with_id( + let (original_document, fee) = fetch_document_with_id( platform.drive, contract, document_type, @@ -57,6 +64,8 @@ impl DocumentDeleteTransitionActionStateValidationV0 for DocumentDeleteTransitio platform_version, )?; + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + let Some(document) = original_document else { return Ok(ConsensusValidationResult::new_with_error( ConsensusError::StateError(StateError::DocumentNotFoundError( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs index ed3222d459b..3813405201c 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs @@ -1,5 +1,10 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; +use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; use crate::error::Error; @@ -8,6 +13,29 @@ pub(super) trait DocumentDeleteTransitionActionStructureValidationV0 { } impl DocumentDeleteTransitionActionStructureValidationV0 for DocumentDeleteTransitionAction { fn validate_structure_v0(&self) -> Result { - Ok(SimpleConsensusValidationResult::new()) + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + if !document_type.documents_can_be_deleted() { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "documents of type {} can not be deleted", + document_type_name + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::new()) + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/mod.rs new file mode 100644 index 00000000000..ef6c32b9968 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/mod.rs @@ -0,0 +1,87 @@ +use dpp::block::block_info::BlockInfo; +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionAction; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::state_v0::DocumentPurchaseTransitionActionStateValidationV0; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::structure_v0::DocumentPurchaseTransitionActionStructureValidationV0; +use crate::platform_types::platform::PlatformStateRef; + +mod state_v0; +mod structure_v0; + +pub trait DocumentPurchaseTransitionActionValidation { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentPurchaseTransitionActionValidation for DocumentPurchaseTransitionAction { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_purchase_transition_structure_validation + { + 0 => self.validate_structure_v0(platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentPurchaseTransitionAction::validate_structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_purchase_transition_state_validation + { + 0 => self.validate_state_v0( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentPurchaseTransitionAction::validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/state_v0/mod.rs new file mode 100644 index 00000000000..79e43113440 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/state_v0/mod.rs @@ -0,0 +1,70 @@ +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::InvalidDocumentTypeError; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformStateRef; + +pub(super) trait DocumentPurchaseTransitionActionStateValidationV0 { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentPurchaseTransitionActionStateValidationV0 for DocumentPurchaseTransitionAction { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + + let contract = &contract_fetch_info.contract; + + let document_type_name = self.base().document_type_name(); + + let Some(document_type) = contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), contract.id()).into(), + )); + }; + + // There is no need to verify that the document already existed, since this is done when + // transforming into an action + + // We need to verify that the resultant document doesn't violate any unique properties + + if document_type.indexes().values().any(|index| index.unique) { + platform + .drive + .validate_document_purchase_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/structure_v0/mod.rs new file mode 100644 index 00000000000..afbe3ae28b2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/structure_v0/mod.rs @@ -0,0 +1,61 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::document::DocumentV0Getters; +use dpp::nft::TradeMode; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::Error; + +pub(super) trait DocumentPurchaseTransitionActionStructureValidationV0 { + fn validate_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentPurchaseTransitionActionStructureValidationV0 for DocumentPurchaseTransitionAction { + fn validate_structure_v0( + &self, + _platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + // We can not purchase from ourselves + // The document owner id is already our owner id, as the action we want to take is to + // insert this document into the state (with our owner id) + if self.original_owner_id() == self.document().owner_id() { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "on document type: {} identity trying to purchase a document that is already owned by the purchaser", + document_type_name + )) + .into(), + )); + } + + if document_type.trade_mode() != TradeMode::DirectPurchase { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "{} trade mode is not direct purchase but we are trying to purchase directly", + document_type_name + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs index 1ac0639b8f7..fe65d922dd6 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::block_info::BlockInfo; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; @@ -6,6 +7,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_replace_transition_action::state_v0::DocumentReplaceTransitionActionStateValidationV0; use crate::execution::validation::state_transition::documents_batch::action_validation::document_replace_transition_action::structure_v0::DocumentReplaceTransitionActionStructureValidationV0; use crate::platform_types::platform::PlatformStateRef; @@ -16,7 +18,6 @@ mod structure_v0; pub trait DocumentReplaceTransitionActionValidation { fn validate_structure( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result; @@ -24,6 +25,8 @@ pub trait DocumentReplaceTransitionActionValidation { &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -32,7 +35,6 @@ pub trait DocumentReplaceTransitionActionValidation { impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionAction { fn validate_structure( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -42,7 +44,7 @@ impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionActi .documents_batch_state_transition .document_replace_transition_structure_validation { - 0 => self.validate_structure_v0(platform, platform_version), + 0 => self.validate_structure_v0(platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentReplaceTransitionAction::validate_structure".to_string(), known_versions: vec![0], @@ -55,6 +57,8 @@ impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionActi &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -65,7 +69,14 @@ impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionActi .documents_batch_state_transition .document_replace_transition_state_validation { - 0 => self.validate_state_v0(platform, owner_id, transaction, platform_version), + 0 => self.validate_state_v0( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentReplaceTransitionAction::validate_state".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs index c2ec518776b..8fea8e28565 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs @@ -1,5 +1,7 @@ +use dpp::block::block_info::BlockInfo; use dpp::consensus::basic::document::InvalidDocumentTypeError; use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; @@ -7,6 +9,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::platform_types::platform::PlatformStateRef; pub(super) trait DocumentReplaceTransitionActionStateValidationV0 { @@ -14,6 +17,8 @@ pub(super) trait DocumentReplaceTransitionActionStateValidationV0 { &self, platform: &PlatformStateRef, owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -23,6 +28,8 @@ impl DocumentReplaceTransitionActionStateValidationV0 for DocumentReplaceTransit &self, platform: &PlatformStateRef, owner_id: Identifier, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -39,19 +46,23 @@ impl DocumentReplaceTransitionActionStateValidationV0 for DocumentReplaceTransit )); }; - // The rest of state validation is actually happening in documents batch transition transformer - // TODO: Think more about this architecture + // There is no need to verify that the document already existed, since this is done when + // transforming into an action - platform - .drive - .validate_document_replace_transition_action_uniqueness( - contract, - document_type, - self, - owner_id, - transaction, - platform_version, - ) - .map_err(Error::Drive) + if document_type.indexes().values().any(|index| index.unique) { + platform + .drive + .validate_document_replace_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs index 1bf0ba9b8d3..6f77359d1ad 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs @@ -1,35 +1,22 @@ -use dpp::consensus::basic::document::{InvalidDocumentTypeError, MissingDocumentTypeError}; -use dpp::consensus::state::document::document_timestamp_window_violation_error::DocumentTimestampWindowViolationError; -use dpp::consensus::ConsensusError; - -use dpp::consensus::state::state_error::StateError; +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::validation::DataContractValidationMethodsV0; -use dpp::document::{DocumentV0Getters}; -use dpp::document::extended_document::property_names; -use dpp::identity::TimestampMillis; -use dpp::ProtocolError; -use dpp::validation::block_time_window::validate_time_in_block_time_window::validate_time_in_block_time_window; +use dpp::data_contract::validate_document::DataContractDocumentValidationMethodsV0; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; use dpp::version::PlatformVersion; use crate::error::Error; -use crate::platform_types::platform::PlatformStateRef; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; pub(super) trait DocumentReplaceTransitionActionStructureValidationV0 { fn validate_structure_v0( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result; } impl DocumentReplaceTransitionActionStructureValidationV0 for DocumentReplaceTransitionAction { fn validate_structure_v0( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result { let contract_fetch_info = self.base().data_contract_fetch_info(); @@ -45,35 +32,16 @@ impl DocumentReplaceTransitionActionStructureValidationV0 for DocumentReplaceTra )); }; - // Make sure that timestamps are present if required - let required_fields = document_type.required_fields(); - - if required_fields.contains(property_names::UPDATED_AT) && self.updated_at().is_none() { - // TODO: Create a special consensus error for this + if !document_type.documents_mutable() { return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), + InvalidDocumentTransitionActionError::new(format!( + "{} is not mutable and can not be replaced", + document_type_name + )) + .into(), )); } - // Validate timestamps against block time - // we do validation here but not in validate state because it's a cheap validation - // and validate state implements expensive validation only - let latest_block_time_ms = platform.state.last_block_time_ms(); - let average_block_spacing_ms = platform.config.block_spacing_ms; - - if let Some(latest_block_time_ms) = latest_block_time_ms { - let validation_result = check_updated_inside_time_window( - self, - latest_block_time_ms, - average_block_spacing_ms, - platform_version, - )?; - - if !validation_result.is_valid() { - return Ok(validation_result); - } - } - // Validate user defined properties data_contract @@ -81,38 +49,3 @@ impl DocumentReplaceTransitionActionStructureValidationV0 for DocumentReplaceTra .map_err(Error::Protocol) } } - -fn check_updated_inside_time_window( - document_transition: &DocumentReplaceTransitionAction, - last_block_ts_millis: TimestampMillis, - average_block_spacing_ms: u64, - platform_version: &PlatformVersion, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - let updated_at = match document_transition.updated_at() { - Some(t) => t, - None => return Ok(result), - }; - - let window_validation = validate_time_in_block_time_window( - last_block_ts_millis, - updated_at, - average_block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - if !window_validation.valid { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampWindowViolationError( - DocumentTimestampWindowViolationError::new( - String::from("updatedAt"), - document_transition.base().id(), - updated_at as i64, - window_validation.time_window_start as i64, - window_validation.time_window_end as i64, - ), - ), - )); - } - Ok(result) -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/mod.rs new file mode 100644 index 00000000000..9b4f6e8b55d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/mod.rs @@ -0,0 +1,87 @@ +use dpp::block::block_info::BlockInfo; +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::DocumentTransferTransitionAction; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::state_v0::DocumentTransferTransitionActionStateValidationV0; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::structure_v0::DocumentTransferTransitionActionStructureValidationV0; +use crate::platform_types::platform::PlatformStateRef; + +mod state_v0; +mod structure_v0; + +pub trait DocumentTransferTransitionActionValidation { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentTransferTransitionActionValidation for DocumentTransferTransitionAction { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_structure_validation + { + 0 => self.validate_structure_v0(platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentTransferTransitionAction::validate_structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_state_validation + { + 0 => self.validate_state_v0( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentTransferTransitionAction::validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/state_v0/mod.rs new file mode 100644 index 00000000000..7613df9afcd --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/state_v0/mod.rs @@ -0,0 +1,68 @@ +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::InvalidDocumentTypeError; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformStateRef; + +pub(super) trait DocumentTransferTransitionActionStateValidationV0 { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentTransferTransitionActionStateValidationV0 for DocumentTransferTransitionAction { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + + let contract = &contract_fetch_info.contract; + + let document_type_name = self.base().document_type_name(); + + let Some(document_type) = contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), contract.id()).into(), + )); + }; + + // There is no need to verify that the document already existed, since this is done when + // transforming into an action + + if document_type.indexes().values().any(|index| index.unique) { + platform + .drive + .validate_document_transfer_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/structure_v0/mod.rs new file mode 100644 index 00000000000..3910574a615 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/structure_v0/mod.rs @@ -0,0 +1,46 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::Error; + +pub(super) trait DocumentTransferTransitionActionStructureValidationV0 { + fn validate_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentTransferTransitionActionStructureValidationV0 for DocumentTransferTransitionAction { + fn validate_structure_v0( + &self, + _platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + if !document_type.documents_transferable().is_transferable() { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "{} is not a transferable document type", + document_type_name + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/mod.rs new file mode 100644 index 00000000000..39a18561c03 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/mod.rs @@ -0,0 +1,87 @@ +use dpp::block::block_info::BlockInfo; +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::DocumentUpdatePriceTransitionAction; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::state_v0::DocumentUpdatePriceTransitionActionStateValidationV0; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::structure_v0::DocumentUpdatePriceTransitionActionStructureValidationV0; +use crate::platform_types::platform::PlatformStateRef; + +mod state_v0; +mod structure_v0; + +pub trait DocumentUpdatePriceTransitionActionValidation { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentUpdatePriceTransitionActionValidation for DocumentUpdatePriceTransitionAction { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_structure_validation + { + 0 => self.validate_structure_v0(platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentUpdatePriceTransitionAction::validate_structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_state_validation + { + 0 => self.validate_state_v0( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentUpdatePriceTransitionAction::validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/state_v0/mod.rs new file mode 100644 index 00000000000..43a72d50a57 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/state_v0/mod.rs @@ -0,0 +1,68 @@ +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::InvalidDocumentTypeError; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformStateRef; + +pub(super) trait DocumentUpdatePriceTransitionActionStateValidationV0 { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentUpdatePriceTransitionActionStateValidationV0 for DocumentUpdatePriceTransitionAction { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + + let contract = &contract_fetch_info.contract; + + let document_type_name = self.base().document_type_name(); + + let Some(document_type) = contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), contract.id()).into(), + )); + }; + + // There is no need to verify that the document already existed, since this is done when + // transforming into an action + + if document_type.indexes().values().any(|index| index.unique) { + platform + .drive + .validate_document_update_price_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/structure_v0/mod.rs new file mode 100644 index 00000000000..f8b66fe3746 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/structure_v0/mod.rs @@ -0,0 +1,49 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::Error; + +pub(super) trait DocumentUpdatePriceTransitionActionStructureValidationV0 { + fn validate_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentUpdatePriceTransitionActionStructureValidationV0 + for DocumentUpdatePriceTransitionAction +{ + fn validate_structure_v0( + &self, + _platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + if !document_type.trade_mode().seller_sets_price() { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "{} is in trade mode {} that does not support the seller setting the price", + document_type_name, + document_type.trade_mode(), + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs index 5689698caaf..32c28c43faa 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs @@ -1,3 +1,6 @@ pub(crate) mod document_create_transition_action; pub(crate) mod document_delete_transition_action; +pub(crate) mod document_purchase_transition_action; pub(crate) mod document_replace_transition_action; +pub(crate) mod document_transfer_transition_action; +pub(crate) mod document_update_price_transition_action; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..6c9f7b93b42 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/v0/mod.rs @@ -0,0 +1,208 @@ +use crate::error::Error; +use dpp::consensus::basic::document::InvalidDocumentTransitionIdError; +use dpp::consensus::signature::{InvalidSignaturePublicKeySecurityLevelError, SignatureError}; +use dpp::document::Document; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::{ + DocumentTransition, DocumentTransitionV0Methods, +}; + +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::{StateTransitionIdentitySigned, StateTransitionLike}; + +use dpp::validation::ConsensusValidationResult; + +use dpp::version::PlatformVersion; + +use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; +use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; +use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_replace_transition_action::DocumentReplaceTransitionActionValidation; +use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_delete_transition_action::DocumentDeleteTransitionActionValidation; +use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_create_transition_action::DocumentCreateTransitionActionValidation; +use dpp::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; +use drive::state_transition_action::StateTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; +use crate::error::execution::ExecutionError; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::DocumentPurchaseTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::DocumentTransferTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::DocumentUpdatePriceTransitionActionValidation; + +pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchStateTransitionStructureValidationV0 +{ + fn validate_advanced_structure_from_state_v0( + &self, + action: &DocumentsBatchTransitionAction, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl DocumentsBatchStateTransitionStructureValidationV0 for DocumentsBatchTransition { + fn validate_advanced_structure_from_state_v0( + &self, + action: &DocumentsBatchTransitionAction, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let security_levels = action.contract_based_security_level_requirement()?; + + let signing_key = identity.loaded_public_keys.get(&self.signature_public_key_id()).ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution("the key must exist for advanced structure validation as we already fetched it during signature validation")))?; + + if !security_levels.contains(&signing_key.security_level()) { + // We only need to bump the first identity data contract nonce as that will make a replay + // attack not possible + + let first_transition = self.transitions().first().ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution("There must be at least one state transition as this is already verified in basic validation")))?; + + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition( + first_transition.base(), + self.owner_id(), + self.user_fee_increase(), + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![SignatureError::InvalidSignaturePublicKeySecurityLevelError( + InvalidSignaturePublicKeySecurityLevelError::new( + signing_key.security_level(), + security_levels, + ), + ) + .into()], + )); + } + + // We should validate that all newly created documents have valid ids + for transition in self.transitions() { + if let DocumentTransition::Create(create_transition) = transition { + // Validate the ID + let generated_document_id = Document::generate_document_id_v0( + create_transition.base().data_contract_id_ref(), + &self.owner_id(), + create_transition.base().document_type_name(), + &create_transition.entropy(), + ); + + // This hash will take 2 blocks (128 bytes) + execution_context.add_operation(ValidationOperation::DoubleSha256(2)); + + let id = create_transition.base().id(); + if generated_document_id != id { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition( + transition.base(), + self.owner_id(), + self.user_fee_increase(), + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + InvalidDocumentTransitionIdError::new(generated_document_id, id).into(), + ], + )); + } + } + } + + // Next we need to validate the structure of all actions (this means with the data contract) + for transition in action.transitions() { + match transition { + DocumentTransitionAction::CreateAction(create_action) => { + let result = create_action.validate_structure(identity.id, platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the create action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::ReplaceAction(replace_action) => { + let result = replace_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the replace action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::DeleteAction(delete_action) => { + let result = delete_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the delete action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::TransferAction(transfer_action) => { + let result = transfer_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the transfer action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::UpdatePriceAction(update_price_action) => { + let result = update_price_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the update price action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::PurchaseAction(purchase_action) => { + let result = purchase_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the purchase action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::BumpIdentityDataContractNonce(_) => { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we should not have a bump identity contract nonce at this stage", + ))); + } + } + } + Ok(ConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/mod.rs new file mode 100644 index 00000000000..b56c2b8ff32 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/mod.rs @@ -0,0 +1,33 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::documents_batch::balance::v0::DocumentsBatchTransitionBalanceValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionIdentityBalanceValidationV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(crate) mod v0; +impl StateTransitionIdentityBalanceValidationV0 for DocumentsBatchTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .balance_pre_check + { + 0 => self.validate_advanced_minimum_balance_pre_check_v0(identity, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "documents batch transition: validate_minimum_balance_pre_check" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/v0/mod.rs new file mode 100644 index 00000000000..6f2dc0fd993 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/v0/mod.rs @@ -0,0 +1,88 @@ +use crate::error::Error; +use dpp::consensus::basic::overflow_error::OverflowError; +use dpp::consensus::basic::BasicError; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::consensus::ConsensusError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::ProtocolError; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::error::execution::ExecutionError; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions) trait DocumentsBatchTransitionBalanceValidationV0 +{ + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentsBatchTransitionBalanceValidationV0 for DocumentsBatchTransition { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for documents batch transition", + )))?; + + let purchases_amount = match self.all_purchases_amount() { + Ok(purchase_amount) => purchase_amount.unwrap_or_default(), + Err(ProtocolError::Overflow(e)) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + ConsensusError::BasicError(BasicError::OverflowError(OverflowError::new( + e.to_owned(), + ))), + )) + } + Err(e) => return Err(e.into()), + }; + + // If we added documents that had a conflicting index we need to put up a collateral that voters can draw on + + let conflicting_indices_collateral_amount = + match self.all_conflicting_index_collateral_voting_funds() { + Ok(conflicting_indices_collateral_amount) => { + conflicting_indices_collateral_amount.unwrap_or_default() + } + Err(ProtocolError::Overflow(e)) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + ConsensusError::BasicError(BasicError::OverflowError(OverflowError::new( + e.to_owned(), + ))), + )) + } + Err(e) => return Err(e.into()), + }; + + let base_fees = match platform_version.fee_version.state_transition_min_fees.document_batch_sub_transition.checked_mul(self.transitions().len() as u64) { + None => return Ok(SimpleConsensusValidationResult::new_with_error(ConsensusError::BasicError(BasicError::OverflowError(OverflowError::new("overflow when multiplying base fee and amount of sub transitions in documents batch transition".to_string()))))), + Some(base_fees) => base_fees + }; + + // This is just the needed balance to pass this validation step, most likely the actual fees are smaller + let needed_balance = match purchases_amount + .checked_add(conflicting_indices_collateral_amount).and_then(|added| added.checked_add(base_fees)) { + None => return Ok(SimpleConsensusValidationResult::new_with_error(ConsensusError::BasicError(BasicError::OverflowError(OverflowError::new("overflow when adding all purchases amount with conflicting_indices_collateral_amounts and base fees in documents batch transition".to_string()))))), + Some(needed_balance) => needed_balance + }; + + if balance < needed_balance { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(identity.id, balance, needed_balance).into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/v0/mod.rs deleted file mode 100644 index cf7b9490eb8..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/v0/mod.rs +++ /dev/null @@ -1,94 +0,0 @@ -use crate::error::Error; -use dpp::consensus::basic::document::InvalidDocumentTransitionIdError; -use dpp::document::Document; -use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; -use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; -use dpp::state_transition::documents_batch_transition::document_transition::DocumentTransition; - -use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; -use dpp::state_transition::StateTransitionLike; - -use dpp::validation::SimpleConsensusValidationResult; - -use dpp::version::PlatformVersion; - -use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; -use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; -use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_replace_transition_action::DocumentReplaceTransitionActionValidation; -use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_delete_transition_action::DocumentDeleteTransitionActionValidation; -use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_create_transition_action::DocumentCreateTransitionActionValidation; -use dpp::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; -use crate::platform_types::platform::PlatformStateRef; - -pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchStateTransitionStructureValidationV0 -{ - fn validate_structure_v0( - &self, - platform: &PlatformStateRef, - action: &DocumentsBatchTransitionAction, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl DocumentsBatchStateTransitionStructureValidationV0 for DocumentsBatchTransition { - fn validate_structure_v0( - &self, - platform: &PlatformStateRef, - action: &DocumentsBatchTransitionAction, - platform_version: &PlatformVersion, - ) -> Result { - // First we should validate the base structure - let result = self - .validate_base_structure(platform_version) - .map_err(Error::Protocol)?; - - if !result.is_valid() { - return Ok(result); - } - - // We should validate that all newly created documents have valid ids - for transition in self.transitions() { - if let DocumentTransition::Create(create_transition) = transition { - // Validate the ID - let generated_document_id = Document::generate_document_id_v0( - create_transition.base().data_contract_id_ref(), - &self.owner_id(), - create_transition.base().document_type_name(), - &create_transition.entropy(), - ); - - let id = create_transition.base().id(); - if generated_document_id != id { - return Ok(SimpleConsensusValidationResult::new_with_error( - InvalidDocumentTransitionIdError::new(generated_document_id, id).into(), - )); - } - } - } - - // Next we need to validate the structure of all actions (this means with the data contract) - for transition in action.transitions() { - match transition { - DocumentTransitionAction::CreateAction(create_action) => { - let result = create_action.validate_structure(platform, platform_version)?; - if !result.is_valid() { - return Ok(result); - } - } - DocumentTransitionAction::ReplaceAction(replace_action) => { - let result = replace_action.validate_structure(platform, platform_version)?; - if !result.is_valid() { - return Ok(result); - } - } - DocumentTransitionAction::DeleteAction(delete_action) => { - let result = delete_action.validate_structure(platform_version)?; - if !result.is_valid() { - return Ok(result); - } - } - } - } - Ok(SimpleConsensusValidationResult::new()) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs index a719f3cde91..7c390af6f24 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs @@ -88,7 +88,7 @@ impl DataTriggerBindingV0Getters for DataTriggerBindingV0 { document_type: &str, transition_action_type: DocumentTransitionActionType, ) -> bool { - &self.data_contract_id == data_contract_id + self.data_contract_id == data_contract_id && self.document_type == document_type && self.transition_action_type == transition_action_type } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs index d4498a54241..4e11bd50ee8 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs @@ -1,14 +1,11 @@ use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::dashpay::create_contact_request_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::dpns::create_domain_data_trigger; -use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::feature_flags::create_feature_flag_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::reject::reject_data_trigger; -use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::reward_share::create_masternode_reward_shares_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::withdrawals::delete_withdrawal_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::bindings::data_trigger_binding::DataTriggerBindingV0; use dpp::errors::ProtocolError; -use dpp::system_data_contracts::feature_flags_contract::document_types::update_consensus_params; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; use dpp::system_data_contracts::{dashpay_contract, dpns_contract, SystemDataContract}; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionActionType; @@ -24,8 +21,10 @@ use drive::state_transition_action::document::documents_batch::document_transiti /// # Errors /// /// Returns a `ProtocolError` if there was an error. -pub fn data_trigger_bindings_list_v0() -> Result, ProtocolError> { +#[inline(always)] +pub(super) fn data_trigger_bindings_list_v0() -> Result, ProtocolError> { let data_triggers = vec![ + // Disable all actions on domain for DPNS DataTriggerBindingV0 { data_contract_id: dpns_contract::ID, document_type: "domain".to_string(), @@ -46,70 +45,68 @@ pub fn data_trigger_bindings_list_v0() -> Result, Prot }, DataTriggerBindingV0 { data_contract_id: dpns_contract::ID, - document_type: "preorder".to_string(), - transition_action_type: DocumentTransitionActionType::Delete, + document_type: "domain".to_string(), + transition_action_type: DocumentTransitionActionType::Transfer, data_trigger: reject_data_trigger, }, DataTriggerBindingV0 { data_contract_id: dpns_contract::ID, - document_type: "preorder".to_string(), - transition_action_type: DocumentTransitionActionType::Delete, + document_type: "domain".to_string(), + transition_action_type: DocumentTransitionActionType::Purchase, data_trigger: reject_data_trigger, }, DataTriggerBindingV0 { - data_contract_id: dashpay_contract::ID, - document_type: "contactRequest".to_string(), - transition_action_type: DocumentTransitionActionType::Create, - data_trigger: create_contact_request_data_trigger, - }, - DataTriggerBindingV0 { - data_contract_id: dashpay_contract::ID, - document_type: "contactRequest".to_string(), - transition_action_type: DocumentTransitionActionType::Replace, + data_contract_id: dpns_contract::ID, + document_type: "domain".to_string(), + transition_action_type: DocumentTransitionActionType::UpdatePrice, data_trigger: reject_data_trigger, }, DataTriggerBindingV0 { data_contract_id: dashpay_contract::ID, document_type: "contactRequest".to_string(), - transition_action_type: DocumentTransitionActionType::Delete, - data_trigger: reject_data_trigger, - }, - DataTriggerBindingV0 { - data_contract_id: dashpay_contract::ID, - document_type: update_consensus_params::NAME.to_string(), transition_action_type: DocumentTransitionActionType::Create, - data_trigger: create_feature_flag_data_trigger, - }, - DataTriggerBindingV0 { - data_contract_id: SystemDataContract::FeatureFlags.id(), - document_type: update_consensus_params::NAME.to_string(), - transition_action_type: DocumentTransitionActionType::Replace, - data_trigger: reject_data_trigger, - }, - DataTriggerBindingV0 { - data_contract_id: SystemDataContract::FeatureFlags.id(), - document_type: update_consensus_params::NAME.to_string(), - transition_action_type: DocumentTransitionActionType::Delete, - data_trigger: reject_data_trigger, + data_trigger: create_contact_request_data_trigger, }, + // DataTriggerBindingV0 { + // data_contract_id: SystemDataContract::FeatureFlags.id(), + // document_type: update_consensus_params::NAME.to_string(), + // transition_action_type: DocumentTransitionActionType::Create, + // data_trigger: create_feature_flag_data_trigger, + // }, + // DataTriggerBindingV0 { + // data_contract_id: SystemDataContract::FeatureFlags.id(), + // document_type: update_consensus_params::NAME.to_string(), + // transition_action_type: DocumentTransitionActionType::Replace, + // data_trigger: reject_data_trigger, + // }, + // DataTriggerBindingV0 { + // data_contract_id: SystemDataContract::FeatureFlags.id(), + // document_type: update_consensus_params::NAME.to_string(), + // transition_action_type: DocumentTransitionActionType::Delete, + // data_trigger: reject_data_trigger, + // }, + // Only masternodes will be able to update it DataTriggerBindingV0 { data_contract_id: SystemDataContract::MasternodeRewards.id(), - document_type: update_consensus_params::NAME.to_string(), + document_type: "rewardShare".to_string(), transition_action_type: DocumentTransitionActionType::Create, - data_trigger: create_masternode_reward_shares_data_trigger, + data_trigger: reject_data_trigger, }, + // Only masternodes will be able to update it DataTriggerBindingV0 { data_contract_id: SystemDataContract::MasternodeRewards.id(), document_type: "rewardShare".to_string(), transition_action_type: DocumentTransitionActionType::Replace, - data_trigger: create_masternode_reward_shares_data_trigger, + data_trigger: reject_data_trigger, }, + // Only masternodes will be able to update it DataTriggerBindingV0 { - data_contract_id: SystemDataContract::Withdrawals.id(), - document_type: withdrawal::NAME.to_string(), - transition_action_type: DocumentTransitionActionType::Create, + data_contract_id: SystemDataContract::MasternodeRewards.id(), + document_type: "rewardShare".to_string(), + transition_action_type: DocumentTransitionActionType::Delete, data_trigger: reject_data_trigger, }, + // We can't use mutability flag otherwise documents won't have revision DataTriggerBindingV0 { data_contract_id: SystemDataContract::Withdrawals.id(), document_type: withdrawal::NAME.to_string(), diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs index 6fcd49f3d5c..ac229976a55 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs @@ -9,11 +9,12 @@ use dpp::version::PlatformVersion; use crate::execution::validation::state_transition::documents_batch::data_triggers::bindings::data_trigger_binding::DataTriggerBinding; use crate::execution::validation::state_transition::documents_batch::data_triggers::bindings::data_trigger_binding::DataTriggerBindingV0Getters; use crate::error::Error; +use crate::error::execution::ExecutionError; pub trait DataTriggerExecutor { fn validate_with_data_triggers( &self, - data_trigger_bindings: &Vec, + data_trigger_bindings: &[DataTriggerBinding], context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result; @@ -22,12 +23,22 @@ pub trait DataTriggerExecutor { impl DataTriggerExecutor for DocumentTransitionAction { fn validate_with_data_triggers( &self, - data_trigger_bindings: &Vec, + data_trigger_bindings: &[DataTriggerBinding], context: &DataTriggerExecutionContext, platform_version: &PlatformVersion, ) -> Result { - let data_contract_id = self.base().data_contract_id(); - let document_type_name = self.base().document_type_name(); + let data_contract_id = self + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_id(); + let document_type_name = self + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .document_type_name(); let transition_action = self.action_type(); // Match data triggers by action type, contract ID and document type name diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs index 0cc6304e022..9920418f531 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs @@ -1,7 +1,7 @@ use dpp::validation::SimpleValidationResult; -///! Data triggers implement custom validation logic for state transitions -///! that modifies documents in a specific data contract. -///! Data triggers can be assigned based on the data contract ID, document type, and action. +/// Data triggers implement custom validation logic for state transitions +/// that modifies documents in a specific data contract. +/// Data triggers can be assigned based on the data contract ID, document type, and action. use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use crate::error::Error; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs index 42b07516598..b1b183ef24d 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs @@ -1,7 +1,6 @@ -///! The `dashpay_data_triggers` module contains data triggers specific to the DashPay data contract. +//! The `dashpay_data_triggers` module contains data triggers specific to the DashPay data contract. use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError; use dpp::data_contract::accessors::v0::DataContractV0Getters; @@ -10,13 +9,12 @@ use dpp::ProtocolError; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; -use dpp::system_data_contracts::dashpay_contract::document_types::contact_request::properties::{CORE_HEIGHT_CREATED_AT, TO_USER_ID}; +use dpp::system_data_contracts::dashpay_contract::v1::document_types::contact_request::properties +::{TO_USER_ID}; use dpp::version::PlatformVersion; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContextMethodsV0; use crate::execution::validation::state_transition::documents_batch::data_triggers::{DataTriggerExecutionContext, DataTriggerExecutionResult}; -const BLOCKS_SIZE_WINDOW: u32 = 8; - /// Creates a data trigger for handling contact request documents. /// /// The trigger is executed whenever a new contact request document is created on the blockchain. @@ -32,83 +30,72 @@ const BLOCKS_SIZE_WINDOW: u32 = 8; /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_contact_request_data_trigger_v0( +#[inline(always)] +pub(super) fn create_contact_request_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let mut result = DataTriggerExecutionResult::default(); let is_dry_run = context.state_transition_execution_context.in_dry_run(); let owner_id = context.owner_id; - let document_create_transition = match document_transition { - DocumentTransitionAction::CreateAction(d) => d, - _ => { - return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( - format!( - "the Document Transition {} isn't 'CREATE", - document_transition.base().id() - ), - ))) - } + let DocumentTransitionAction::CreateAction(document_create_transition) = document_transition + else { + return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( + format!( + "the Document Transition {} isn't 'CREATE", + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() + ), + ))); }; - let data = &document_create_transition.data(); - let maybe_core_height_created_at: Option = data - .get_optional_integer(CORE_HEIGHT_CREATED_AT) - .map_err(ProtocolError::ValueError)?; + let data = document_create_transition.data(); + let to_user_id = data .get_identifier(TO_USER_ID) .map_err(ProtocolError::ValueError)?; - if !is_dry_run { - if owner_id == &to_user_id { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - format!("Identity {to_user_id} must not be equal to owner id"), - ); - - result.add_error(err); - - return Ok(result); - } - - if let Some(core_height_created_at) = maybe_core_height_created_at { - let core_chain_locked_height = context.platform.state.core_height(); - - let height_window_start = core_chain_locked_height.saturating_sub(BLOCKS_SIZE_WINDOW); - let height_window_end = core_chain_locked_height.saturating_add(BLOCKS_SIZE_WINDOW); - - if core_height_created_at < height_window_start - || core_height_created_at > height_window_end - { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_create_transition.base().id(), - format!( - "Core height {} is out of block height window from {} to {}", - core_height_created_at, height_window_start, height_window_end - ), - ); + // You shouldn't create a contract request to yourself + if !is_dry_run && owner_id == &to_user_id { + let err = DataTriggerConditionError::new( + data_contract.id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), + format!("Identity {to_user_id} must not be equal to owner id"), + ); - result.add_error(err); + result.add_error(err); - return Ok(result); - } - } + return Ok(result); } - // toUserId identity exits - let identity = context.platform.drive.fetch_identity_balance( + // TODO: Calculate fee operations + + // Recipient identity must exist + let to_identity = context.platform.drive.fetch_identity_balance( to_user_id.to_buffer(), context.transaction, platform_version, )?; - if !is_dry_run && identity.is_none() { + if !is_dry_run && to_identity.is_none() { let err = DataTriggerConditionError::new( data_contract.id(), document_create_transition.base().id(), @@ -127,11 +114,12 @@ pub fn create_contact_request_data_trigger_v0( mod test { use dpp::block::block_info::BlockInfo; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0; + use std::collections::BTreeMap; use std::sync::Arc; use dpp::document::{DocumentV0Getters, DocumentV0Setters}; use dpp::platform_value; - use dpp::platform_value::{Bytes32, platform_value}; + use dpp::platform_value::{Bytes32}; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionActionType; use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::dashpay::create_contact_request_data_trigger; @@ -143,43 +131,49 @@ mod test { use dpp::version::DefaultForPlatformVersion; use drive::drive::contract::DataContractFetchInfo; use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; #[test] fn should_successfully_execute_on_dry_run() { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let state_read_guard = platform.state.read().unwrap(); + + let mut nonce_counter = BTreeMap::new(); + let state = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_read_guard, + state: &state, config: &platform.config, }; - let protocol_version = state_read_guard.current_protocol_version_in_consensus(); - let platform_version = state_read_guard + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = state .current_platform_version() .expect("should return a platform version"); - let mut contact_request_document = get_contact_request_document_fixture( + let contact_request_document = get_contact_request_document_fixture( None, + 0, None, - state_read_guard.current_protocol_version_in_consensus(), + state.current_protocol_version_in_consensus(), ); - contact_request_document.set(CORE_HEIGHT_CREATED_AT, platform_value!(10u32)); let owner_id = &contact_request_document.owner_id(); let data_contract = - get_dashpay_contract_fixture(None, protocol_version).data_contract_owned(); + get_dashpay_contract_fixture(None, 0, protocol_version).data_contract_owned(); let document_type = data_contract .document_type_for_name("contactRequest") .expect("expected a contact request"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(contact_request_document, document_type, Bytes32::default())], - )]); + let document_transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(contact_request_document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); let document_transition = document_transitions - .get(0) + .first() .expect("document transition should be present"); let document_create_transition = document_transition @@ -200,9 +194,9 @@ mod test { }; let result = create_contact_request_data_trigger( - &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { + &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(&platform.drive, None, document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dashpay_contract_fixture(protocol_version))) - }).expect("expected to create action").into(), + }, platform_version).expect("expected to create action").0.into(), &data_trigger_context, platform_version, ) @@ -212,13 +206,18 @@ mod test { } #[test] - fn should_fail_if_owner_id_equals_to_user_id() { + fn should_return_invalid_result_if_owner_id_equals_to_user_id() { + let platform_version = PlatformVersion::latest(); let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let mut state_write_guard = platform.state.write().unwrap(); - state_write_guard.set_last_committed_block_info(Some( + let mut nonce_counter = BTreeMap::new(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + platform_state.set_last_committed_block_info(Some( ExtendedBlockInfoV0 { basic_info: BlockInfo { time_ms: 500000, @@ -226,9 +225,15 @@ mod test { core_height: 42, epoch: Default::default(), }, - app_hash: platform.drive.grove.root_hash(None).unwrap().unwrap(), + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), quorum_hash: [0u8; 32], block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], signature: [0u8; 96], round: 0, } @@ -236,37 +241,42 @@ mod test { )); let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_write_guard, + state: &platform_state, config: &platform.config, }; - let protocol_version = state_write_guard.current_protocol_version_in_consensus(); - let platform_version = state_write_guard + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = platform_state .current_platform_version() .expect("should return a platform version"); let mut contact_request_document = get_contact_request_document_fixture( None, + 0, None, - state_write_guard.current_protocol_version_in_consensus(), + platform_state.current_protocol_version_in_consensus(), ); let owner_id = contact_request_document.owner_id(); contact_request_document.set("toUserId", platform_value::to_value(owner_id).unwrap()); let data_contract = get_dashpay_contract_fixture( None, - state_write_guard.current_protocol_version_in_consensus(), + 0, + platform_state.current_protocol_version_in_consensus(), ) .data_contract_owned(); let document_type = data_contract .document_type_for_name("contactRequest") .expect("expected a contact request"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(contact_request_document, document_type, Bytes32::default())], - )]); + let document_transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(contact_request_document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); let document_transition = document_transitions - .get(0) + .first() .expect("document transition should be present"); let document_create_transition = document_transition @@ -277,7 +287,7 @@ mod test { StateTransitionExecutionContext::default_for_platform_version(platform_version) .unwrap(); let identity_fixture = - get_identity_fixture(state_write_guard.current_protocol_version_in_consensus()) + get_identity_fixture(platform_state.current_protocol_version_in_consensus()) .expect("expected to get identity fixture"); platform @@ -288,7 +298,7 @@ mod test { &BlockInfo::default(), true, None, - state_write_guard.current_platform_version().unwrap(), + platform_state.current_platform_version().unwrap(), ) .expect("expected to insert identity"); @@ -302,9 +312,9 @@ mod test { let _dashpay_identity_id = data_trigger_context.owner_id.to_owned(); let result = create_contact_request_data_trigger( - &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { + &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(&platform.drive, None, document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dashpay_contract_fixture(protocol_version))) - }).expect("expected to create action").into(), + }, platform_version).expect("expected to create action").0.into(), &data_trigger_context, platform_version, ) @@ -315,19 +325,24 @@ mod test { assert!(matches!( &result.errors.first().unwrap(), &DataTriggerError::DataTriggerConditionError(e) if { - e.message() == &format!("Identity {owner_id} must not be equal to owner id") + e.message() == format!("Identity {owner_id} must not be equal to owner id") } )); } #[test] - fn should_fail_if_id_not_exists() { + fn should_return_invalid_result_if_id_not_exists() { + let platform_version = PlatformVersion::latest(); let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let mut state_write_guard = platform.state.write().unwrap(); - state_write_guard.set_last_committed_block_info(Some( + let mut nonce_counter = BTreeMap::new(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + platform_state.set_last_committed_block_info(Some( ExtendedBlockInfoV0 { basic_info: BlockInfo { time_ms: 500000, @@ -335,9 +350,15 @@ mod test { core_height: 42, epoch: Default::default(), }, - app_hash: platform.drive.grove.root_hash(None).unwrap().unwrap(), + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), quorum_hash: [0u8; 32], block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], signature: [0u8; 96], round: 0, } @@ -346,22 +367,24 @@ mod test { let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_write_guard, + state: &platform_state, config: &platform.config, }; - let protocol_version = state_write_guard.current_protocol_version_in_consensus(); - let platform_version = state_write_guard + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = platform_state .current_platform_version() .expect("should return a platform version"); let contact_request_document = get_contact_request_document_fixture( None, + 0, None, - state_write_guard.current_protocol_version_in_consensus(), + platform_state.current_protocol_version_in_consensus(), ); let data_contract = get_dashpay_contract_fixture( None, - state_write_guard.current_protocol_version_in_consensus(), + 0, + platform_state.current_protocol_version_in_consensus(), ) .data_contract_owned(); let document_type = data_contract @@ -373,12 +396,15 @@ mod test { .get_identifier("toUserId") .expect("expected to get toUserId"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(contact_request_document, document_type, Bytes32::default())], - )]); + let document_transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(contact_request_document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); let document_transition = document_transitions - .get(0) + .first() .expect("document transition should be present"); let document_create_transition = document_transition @@ -399,9 +425,9 @@ mod test { let _dashpay_identity_id = data_trigger_context.owner_id.to_owned(); let result = create_contact_request_data_trigger( - &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { + &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(&platform.drive, None, document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dashpay_contract_fixture(protocol_version))) - }).expect("expected to create action").into(), + }, platform_version).expect("expected to create action").0.into(), &data_trigger_context, platform_version, ) @@ -413,10 +439,8 @@ mod test { assert!(matches!( data_trigger_error, DataTriggerError::DataTriggerConditionError(e) if { - e.message() == &format!("Identity {contract_request_to_user_id} doesn't exist") + e.message() == format!("Identity {contract_request_to_user_id} doesn't exist") } )); } - - // TODO! implement remaining tests } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs index c4a0ab9ae70..ed384955e76 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs @@ -1,8 +1,8 @@ use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError; use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contracts::dpns_contract::document_types::domain::properties::PARENT_DOMAIN_NAME; -///! The `dpns_triggers` module contains data triggers specific to the DPNS data contract. -use dpp::util::hash::hash; +use dpp::data_contracts::dpns_contract::v1::document_types::domain::properties::PARENT_DOMAIN_NAME; +/// The `dpns_triggers` module contains data triggers specific to the DPNS data contract. +use dpp::util::hash::hash_double; use std::collections::BTreeMap; use crate::error::execution::ExecutionError; @@ -19,11 +19,12 @@ use drive::state_transition_action::document::documents_batch::document_transiti use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use dpp::system_data_contracts::dpns_contract; -use dpp::system_data_contracts::dpns_contract::document_types::domain::properties::{ALLOW_SUBDOMAINS, DASH_ALIAS_IDENTITY_ID, DASH_UNIQUE_IDENTITY_ID, LABEL, NORMALIZED_LABEL, NORMALIZED_PARENT_DOMAIN_NAME, PREORDER_SALT, RECORDS}; +use dpp::system_data_contracts::dpns_contract::v1::document_types::domain::properties::{ALLOW_SUBDOMAINS, + DASH_ALIAS_IDENTITY_ID, DASH_UNIQUE_IDENTITY_ID, LABEL, NORMALIZED_LABEL, NORMALIZED_PARENT_DOMAIN_NAME, PREORDER_SALT, RECORDS}; use dpp::util::strings::convert_to_homograph_safe_chars; use dpp::version::PlatformVersion; use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; -use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; +use drive::query::{DriveDocumentQuery, InternalClauses, WhereClause, WhereOperator}; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContextMethodsV0; pub const MAX_PRINTABLE_DOMAIN_NAME_LENGTH: usize = 253; @@ -43,12 +44,18 @@ pub const MAX_PRINTABLE_DOMAIN_NAME_LENGTH: usize = 253; /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_domain_data_trigger_v0( +#[inline(always)] +pub(super) fn create_domain_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let is_dry_run = context.state_transition_execution_context.in_dry_run(); let document_create_transition = match document_transition { @@ -57,7 +64,12 @@ pub fn create_domain_data_trigger_v0( return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( format!( "the Document Transition {} isn't 'CREATE", - document_transition.base().id() + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() ), ))) } @@ -106,7 +118,12 @@ pub fn create_domain_data_trigger_v0( if full_domain_name.len() > MAX_PRINTABLE_DOMAIN_NAME_LENGTH { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "Full domain name length can not be more than {} characters long but got {}", MAX_PRINTABLE_DOMAIN_NAME_LENGTH, @@ -120,7 +137,12 @@ pub fn create_domain_data_trigger_v0( if normalized_label != convert_to_homograph_safe_chars(label.as_str()) { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "Normalized label doesn't match label: {} != {}", normalized_label, label @@ -135,7 +157,12 @@ pub fn create_domain_data_trigger_v0( { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "Normalized parent domain name doesn't match parent domain name: {} != {}", normalized_parent_domain_name, parent_domain_name @@ -152,7 +179,12 @@ pub fn create_domain_data_trigger_v0( if id != owner_id { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "ownerId {} doesn't match {} {}", owner_id, DASH_UNIQUE_IDENTITY_ID, id @@ -170,7 +202,12 @@ pub fn create_domain_data_trigger_v0( if id != owner_id { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "ownerId {} doesn't match {} {}", owner_id, DASH_ALIAS_IDENTITY_ID, id @@ -185,7 +222,12 @@ pub fn create_domain_data_trigger_v0( { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Can't create top level domain for this identity".to_string(), ); @@ -206,7 +248,7 @@ pub fn create_domain_data_trigger_v0( .as_str(), )?; - let drive_query = DriveQuery { + let drive_query = DriveDocumentQuery { contract: data_contract, document_type, internal_clauses: InternalClauses { @@ -257,7 +299,12 @@ pub fn create_domain_data_trigger_v0( if documents.is_empty() { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Parent domain is not present".to_string(), ); @@ -270,7 +317,12 @@ pub fn create_domain_data_trigger_v0( if rule_allow_subdomains { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Allowing subdomains registration is forbidden for this domain".to_string(), ); @@ -287,7 +339,12 @@ pub fn create_domain_data_trigger_v0( { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "The subdomain can be created only by the parent domain owner".to_string(), ); @@ -302,11 +359,11 @@ pub fn create_domain_data_trigger_v0( salted_domain_buffer.extend(preorder_salt); salted_domain_buffer.extend(full_domain_name.as_bytes()); - let salted_domain_hash = hash(salted_domain_buffer); + let salted_domain_hash = hash_double(salted_domain_buffer); let document_type = data_contract.document_type_for_name("preorder")?; - let drive_query = DriveQuery { + let drive_query = DriveDocumentQuery { contract: data_contract, document_type, internal_clauses: InternalClauses { @@ -350,7 +407,12 @@ pub fn create_domain_data_trigger_v0( if preorder_documents.is_empty() { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "preorderDocument was not found".to_string(), ); result.add_error(err) @@ -362,6 +424,7 @@ pub fn create_domain_data_trigger_v0( #[cfg(test)] mod test { use std::sync::Arc; + use dpp::block::block_info::BlockInfo; use dpp::platform_value::Bytes32; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionActionType; @@ -380,15 +443,18 @@ mod test { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let state_read_guard = platform.state.read().unwrap(); + + let mut nonce_counter = BTreeMap::new(); + + let state = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_read_guard, + state: &state, config: &platform.config, }; - let platform_version = state_read_guard + let platform_version = state .current_platform_version() .expect("should return a platform version"); @@ -401,21 +467,25 @@ mod test { owner_id, ..Default::default() }, - state_read_guard.current_protocol_version_in_consensus(), + state.current_protocol_version_in_consensus(), ); let data_contract = get_dpns_data_contract_fixture( Some(owner_id), - state_read_guard.current_protocol_version_in_consensus(), + 0, + state.current_protocol_version_in_consensus(), ) .data_contract_owned(); let document_type = data_contract .document_type_for_name("domain") .expect("expected to get domain document type"); - let transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(document, document_type, Bytes32::default())], - )]); - let first_transition = transitions.get(0).expect("transition should be present"); + let transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); + let first_transition = transitions.first().expect("transition should be present"); let document_create_transition = first_transition .as_transition_create() @@ -431,10 +501,10 @@ mod test { }; let result = create_domain_data_trigger_v0( - &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup( - document_create_transition,|_identifier| { + &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(&platform.drive, None, + document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dpns_contract_fixture(platform_version.protocol_version))) - }).expect("expected to create action").into(), + }, platform_version).expect("expected to create action").0.into(), &data_trigger_context, platform_version, ) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/mod.rs index 16ce43fb533..9b0ecd61878 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/mod.rs @@ -7,6 +7,7 @@ use crate::execution::validation::state_transition::documents_batch::data_trigge mod v0; +#[allow(unused)] pub fn create_feature_flag_data_trigger( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs index 2a307ea5dae..50c867efa68 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs @@ -1,4 +1,4 @@ -///! The `feature_flags_data_triggers` module contains data triggers related to feature flags. +//! The `feature_flags_data_triggers` module contains data triggers related to feature flags. use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; @@ -10,7 +10,8 @@ use drive::state_transition_action::document::documents_batch::document_transiti use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use dpp::system_data_contracts::feature_flags_contract; -use dpp::system_data_contracts::feature_flags_contract::document_types::update_consensus_params::properties::PROPERTY_ENABLE_AT_HEIGHT; +use dpp::system_data_contracts::feature_flags_contract::v1::document_types::update_consensus_params::properties +::PROPERTY_ENABLE_AT_HEIGHT; use dpp::version::PlatformVersion; use super::{DataTriggerExecutionContext, DataTriggerExecutionResult}; @@ -30,13 +31,20 @@ use super::{DataTriggerExecutionContext, DataTriggerExecutionResult}; /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_feature_flag_data_trigger_v0( +#[inline(always)] +#[allow(unused)] +pub(super) fn create_feature_flag_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, _platform_version: &PlatformVersion, ) -> Result { let mut result = DataTriggerExecutionResult::default(); - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let document_create_transition = match document_transition { @@ -45,7 +53,12 @@ pub fn create_feature_flag_data_trigger_v0( return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( format!( "the Document Transition {} isn't 'CREATE", - document_transition.base().id() + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() ), ))) } @@ -60,12 +73,17 @@ pub fn create_feature_flag_data_trigger_v0( ))) })?; - let latest_block_height = context.platform.state.height(); + let latest_block_height = context.platform.state.last_committed_block_height(); if enable_at_height < latest_block_height { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "This identity can't activate selected feature flag".to_string(), ); @@ -77,7 +95,12 @@ pub fn create_feature_flag_data_trigger_v0( if context.owner_id != &feature_flags_contract::OWNER_ID { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "This identity can't activate selected feature flag".to_string(), ); @@ -96,7 +119,7 @@ mod test { // let platform = TestPlatformBuilder::new() // .build_with_mock_rpc() // .set_initial_state_structure(); - // let state_read_guard = platform.state.read().unwrap(); + // let state_read_guard = platform.state.load(); // // let platform_ref = PlatformStateRef { // drive: &platform.drive, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs index 1b4a0167369..0b320c59295 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs @@ -2,5 +2,4 @@ pub mod dashpay; pub mod dpns; pub mod feature_flags; pub mod reject; -pub mod reward_share; pub mod withdrawals; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs index 48d087672a1..69c287e6004 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs @@ -4,6 +4,7 @@ use drive::state_transition_action::document::documents_batch::document_transiti use crate::error::Error; use crate::execution::validation::state_transition::documents_batch::data_triggers::DataTriggerExecutionResult; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; +use crate::error::execution::ExecutionError; /// Creates a data trigger for handling document rejections. /// @@ -21,16 +22,27 @@ use drive::state_transition_action::document::documents_batch::document_transiti /// /// A `SimpleValidationResult` containing either a `DataTriggerActionError` indicating the failure of the trigger /// or an empty result indicating the success of the trigger. -pub fn reject_data_trigger_v0( +#[inline(always)] +pub(super) fn reject_data_trigger_v0( document_transition: &DocumentTransitionAction, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let mut result = DataTriggerExecutionResult::default(); let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Action is not allowed".to_string(), ); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/mod.rs deleted file mode 100644 index e546b4f8baf..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; -use dpp::version::PlatformVersion; -use crate::error::Error; -use crate::error::execution::ExecutionError; -use crate::execution::validation::state_transition::documents_batch::data_triggers::{DataTriggerExecutionContext, DataTriggerExecutionResult}; -use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::reward_share::v0::create_masternode_reward_shares_data_trigger_v0; - -mod v0; - -pub fn create_masternode_reward_shares_data_trigger( - document_transition: &DocumentTransitionAction, - context: &DataTriggerExecutionContext<'_>, - platform_version: &PlatformVersion, -) -> Result { - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .documents_batch_state_transition - .data_triggers - .triggers - .create_masternode_reward_shares_data_trigger - { - 0 => create_masternode_reward_shares_data_trigger_v0( - document_transition, - context, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "create_masternode_reward_shares_data_trigger".to_string(), - known_versions: vec![0], - received: version, - })), - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/v0/mod.rs deleted file mode 100644 index 78c48f1e905..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/v0/mod.rs +++ /dev/null @@ -1,806 +0,0 @@ -///! The `reward_share_data_triggers` module contains data triggers related to reward sharing. -use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; -use dpp::platform_value::Value; - -use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; -use dpp::version::PlatformVersion; -use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; -use std::collections::BTreeMap; -use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::DocumentV0Getters; -use dpp::ProtocolError; -use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; -use dpp::system_data_contracts::masternode_reward_shares_contract::document_types::reward_share::properties::{PAY_TO_ID, PERCENTAGE}; -use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; - -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContextMethodsV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; - -use super::{DataTriggerExecutionContext, DataTriggerExecutionResult}; - -const MAX_PERCENTAGE: u64 = 10000; -const MAX_DOCUMENTS: usize = 16; - -/// Creates a data trigger for handling masternode reward share documents. -/// -/// The trigger is executed whenever a new masternode reward share document is created on the blockchain. -/// It performs various actions depending on the state of the document and the context in which it was created. -/// -/// # Arguments -/// -/// * `document_transition` - A reference to the document transition that triggered the data trigger. -/// * `context` - A reference to the data trigger execution context. -/// * `platform_version` - A reference to the platform version. -/// -/// # Returns -/// -/// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_masternode_reward_shares_data_trigger_v0( - document_transition: &DocumentTransitionAction, - context: &DataTriggerExecutionContext<'_>, - platform_version: &PlatformVersion, -) -> Result { - let mut result = DataTriggerExecutionResult::default(); - - let is_dry_run = context.state_transition_execution_context.in_dry_run(); - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); - let data_contract = &data_contract_fetch_info.contract; - - let document_create_transition = match document_transition { - DocumentTransitionAction::CreateAction(d) => d, - _ => { - return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( - format!( - "the Document Transition {} isn't 'CREATE", - document_transition.base().id() - ), - ))) - } - }; - - let properties = &document_create_transition.data(); - - let pay_to_id = properties - .get_hash256_bytes(PAY_TO_ID) - .map_err(ProtocolError::ValueError)?; - let percentage = properties - .get_integer(PERCENTAGE) - .map_err(ProtocolError::ValueError)?; - - if !is_dry_run { - let valid_masternodes_list = &context.platform.state.hpmn_masternode_list(); - - let owner_id_in_sml = valid_masternodes_list - .get(context.owner_id.as_slice()) - .is_some(); - - if !owner_id_in_sml { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - "Only masternode identities can share rewards".to_string(), - ); - - result.add_error(err); - } - } - - let maybe_identity = context.platform.drive.fetch_identity_balance( - pay_to_id, - context.transaction, - platform_version, - )?; - - if !is_dry_run && maybe_identity.is_none() { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - format!( - "Identity '{}' doesn't exist", - bs58::encode(pay_to_id).into_string() - ), - ); - - result.add_error(err); - - return Ok(result); - } - - let document_type = data_contract - .document_type_for_name(document_create_transition.base().document_type_name())?; - - let drive_query = DriveQuery { - contract: data_contract, - document_type, - internal_clauses: InternalClauses { - primary_key_in_clause: None, - primary_key_equal_clause: None, - in_clause: None, - range_clause: None, - equal_clauses: BTreeMap::from([( - "$ownerId".to_string(), - WhereClause { - field: "$ownerId".to_string(), - operator: WhereOperator::Equal, - value: Value::Identifier(context.owner_id.to_buffer()), - }, - )]), - }, - offset: None, - limit: Some((MAX_DOCUMENTS + 1) as u16), - order_by: Default::default(), - start_at: None, - start_at_included: false, - block_time_ms: None, - }; - - let documents = context - .platform - .drive - .query_documents( - drive_query, - None, - false, - context.transaction, - Some(platform_version.protocol_version), - )? - .documents_owned(); - - if is_dry_run { - return Ok(result); - } - - if documents.len() >= MAX_DOCUMENTS { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - format!( - "Reward shares cannot contain more than {} identities", - MAX_DOCUMENTS - ), - ); - - result.add_error(err); - - return Ok(result); - } - - let mut total_percent: u64 = percentage; - for d in documents.iter() { - total_percent += d - .properties() - .get_integer::(PERCENTAGE) - .map_err(ProtocolError::ValueError)?; - } - - if total_percent > MAX_PERCENTAGE { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - format!("Percentage can not be more than {}", MAX_PERCENTAGE), - ); - - result.add_error(err); - } - - Ok(result) -} - -#[cfg(test)] -mod test { - use super::*; - - use crate::platform_types::platform::PlatformStateRef; - use crate::test::helpers::setup::TestPlatformBuilder; - use dashcore_rpc::dashcore::hashes::Hash; - use dashcore_rpc::dashcore::{ProTxHash, Txid}; - use dashcore_rpc::dashcore_rpc_json::{DMNState, MasternodeListItem, MasternodeType}; - use dpp::block::block_info::BlockInfo; - use dpp::data_contract::document_type::random_document::CreateRandomDocument; - use dpp::data_contract::DataContract; - use dpp::document::{Document, DocumentV0Setters}; - use dpp::identity::Identity; - - use dpp::platform_value::{Bytes32, Identifier, Value}; - use dpp::tests::fixtures::{ - get_document_transitions_fixture, get_masternode_reward_shares_documents_fixture, - }; - use dpp::tests::utils::generate_random_identifier_struct; - - use crate::platform_types::platform_state::v0::PlatformStateV0; - use dpp::consensus::state::data_trigger::DataTriggerError; - use drive::drive::object_size_info::DocumentInfo::{DocumentOwnedInfo, DocumentRefInfo}; - use drive::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; - use std::net::SocketAddr; - use std::str::FromStr; - use std::sync::Arc; - - use dpp::identity::accessors::IdentitySettersV0; - use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; - use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionActionType; - use dpp::version::DefaultForPlatformVersion; - use drive::drive::contract::DataContractFetchInfo; - use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; - - struct TestData { - top_level_identifier: Identifier, - data_contract: DataContract, - document_type_name: String, - documents: Vec, - document_create_transition: DocumentCreateTransitionAction, - } - - fn setup_test(platform_state: &mut PlatformStateV0) -> TestData { - let top_level_identifier_hex = - "c286807d463b06c7aba3b9a60acf64c1fc03da8c1422005cd9b4293f08cf0562"; - let top_level_identifier = - Identifier::from_bytes(&hex::decode(top_level_identifier_hex).unwrap()).unwrap(); - - let pro_tx_hash = ProTxHash::from_byte_array(top_level_identifier.to_buffer()); - - platform_state.hpmn_masternode_list.insert(pro_tx_hash, MasternodeListItem { - node_type: MasternodeType::Evo, - pro_tx_hash, - collateral_hash: Txid::from_str("4eb56228c535db3b234907113fd41d57bcc7cdcb8e0e00e57590af27ee88c119").expect("expected to decode collateral hash"), - collateral_index: 0, - collateral_address: [0;20], - operator_reward: 0.0, - state: DMNState { - service: SocketAddr::from_str("1.2.3.4:1234").unwrap(), - registered_height: 0, - pose_revived_height: None, - pose_ban_height: None, - revocation_reason: 0, - owner_address: [1;20], - voting_address: [2;20], - payout_address: [3;20], - pub_key_operator: hex::decode("987a4873caba62cd45a2f7d4aa6d94519ee6753e9bef777c927cb94ade768a542b0ff34a93231d3a92b4e75ffdaa366e").expect("expected to decode collateral hash"), - operator_payout_address: None, - platform_node_id: None, - platform_p2p_port: None, - platform_http_port: None, - }, - }); - - let pro_tx_hash = - ProTxHash::from_str("a3e1edc6bd352eeaf0ae58e30781ef4b127854241a3fe7fddf36d5b7e1dc2b3f") - .expect("expected to create pro-tx-hash from slice"); - - platform_state.hpmn_masternode_list.insert(pro_tx_hash, MasternodeListItem { - node_type: MasternodeType::Evo, - pro_tx_hash, - collateral_hash: Txid::from_str("4eb56228c535db3b234907113fd41d57bcc7cdcb8e0e00e57590af27ee88c119").expect("expected to decode collateral hash"), - collateral_index: 0, - collateral_address: [0;20], - operator_reward: 0.0, - state: DMNState { - service: SocketAddr::from_str("1.2.3.5:1234").unwrap(), - registered_height: 0, - pose_revived_height: None, - pose_ban_height: None, - revocation_reason: 0, - owner_address: [1;20], - voting_address: [2;20], - payout_address: [3;20], - pub_key_operator: hex::decode("a87a4873caba62cd45a2f7d4aa6d94519ee6753e9bef777c927cb94ade768a542b0ff34a93231d3a92b4e75ffdaa366e").expect("expected to decode collateral hash"), - operator_payout_address: None, - platform_node_id: None, - platform_p2p_port: None, - platform_http_port: None, - }, - }); - - let (documents, data_contract) = get_masternode_reward_shares_documents_fixture(1); - let document_type = data_contract - .document_type_for_name("rewardShare") - .expect("expected the rewards document type"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(documents[0].clone(), document_type, Bytes32::default())], - )]); - - let document_create_transition = document_transitions[0] - .as_transition_create() - .unwrap() - .clone(); - TestData { - documents, - data_contract, - document_type_name: "rewardShare".to_string(), - top_level_identifier, - document_create_transition: DocumentCreateTransitionAction::from_document_create_transition_with_contract_lookup(document_create_transition, |_identifier| { - Ok(Arc::new(DataContractFetchInfo::masternode_rewards_contract_fixture(platform_state.current_protocol_version_in_consensus))) - }).expect("expected to create action"), - } - } - - fn get_data_trigger_error( - result: &Result, - error_number: usize, - ) -> &DataTriggerError { - let execution_result = result.as_ref().expect("it should return execution result"); - execution_result - .get_error(error_number) - .expect("errors should exist") - } - - #[test] - fn should_return_an_error_if_percentage_greater_than_10000() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - mut document_create_transition, - documents, - data_contract, - document_type_name, - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let document_type = data_contract - .document_type_for_name(document_type_name.as_str()) - .expect("expected the rewards document type"); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - for (i, document) in documents.iter().enumerate() { - platform_ref - .drive - .apply_contract( - &data_contract, - BlockInfo::default(), - true, - None, - None, - platform_version, - ) - .expect("expected to apply contract"); - let mut identity = - Identity::random_identity(2, Some(i as u64), platform_version).unwrap(); - - identity.set_id(document.owner_id()); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - state_write_guard.current_platform_version().unwrap(), - ) - .expect("expected to add an identity"); - - let mut identity = Identity::random_identity(2, Some(100 - i as u64), platform_version) - .expect("expected a platform identity"); - identity.set_id( - document - .properties() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - state_write_guard - .current_platform_version() - .expect("expected a platform version"), - ) - .expect("expected to add an identity"); - - platform_ref - .drive - .add_document_for_contract( - DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo((document, None)), - owner_id: None, - }, - contract: &data_contract, - document_type, - }, - false, - BlockInfo::default(), - true, - None, - platform_version, - ) - .expect("expected to add document"); - } - - // documentsFixture contains percentage = 500 - document_create_transition - .data_mut() - .insert("percentage".to_string(), Value::U64(90501)); - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .expect("expected to get an execution context"); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - - let percentage_error = get_data_trigger_error(&result, 0); - assert_eq!( - "Percentage can not be more than 10000", - percentage_error.to_string() - ); - } - - #[test] - fn should_return_an_error_if_pay_to_id_does_not_exists() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - let pay_to_id_bytes = document_create_transition - .data() - .get_hash256_bytes(PAY_TO_ID) - .expect("expected to be able to get a hash"); - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - - let error = get_data_trigger_error(&result, 0); - - let pay_to_id = Identifier::from(pay_to_id_bytes); - - assert_eq!( - format!("Identity '{}' doesn't exist", pay_to_id), - error.to_string() - ); - } - - #[test] - fn should_return_an_error_if_owner_id_is_not_a_masternode_identity() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &generate_random_identifier_struct(), - state_transition_execution_context: &execution_context, - transaction: None, - }; - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - let error = get_data_trigger_error(&result, 0); - - assert_eq!( - "Only masternode identities can share rewards", - error.to_string() - ); - } - - #[test] - fn should_pass() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let mut identity = Identity::random_identity( - 2, - Some(9), - state_write_guard.current_platform_version().unwrap(), - ) - .expect("expected a platform identity"); - identity.set_id( - document_create_transition - .data() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - state_write_guard.current_platform_version().unwrap(), - ) - .expect("expected to add an identity"); - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ) - .expect("the execution result should be returned"); - assert!(result.is_valid(), "{}", result.errors.first().unwrap()) - } - - #[test] - fn should_return_error_if_there_are_16_stored_shares() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let TestData { - document_create_transition, - data_contract, - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return platform version"); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - platform_ref - .drive - .apply_contract( - &data_contract, - BlockInfo::default(), - true, - None, - None, - platform_version, - ) - .expect("expected to apply contract"); - - let document_type = data_contract - .document_type_for_name(document_create_transition.base().document_type_name()) - .expect("expected to get document type"); - - let mut main_identity = Identity::random_identity(2, Some(1000_u64), platform_version) - .expect("expected a platform identity"); - - main_identity.set_id( - document_create_transition - .data() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - main_identity, - false, - &BlockInfo::default(), - true, - None, - platform_version, - ) - .expect("expected to add an identity"); - - for i in 0..16 { - let mut document = document_type - .random_document(Some(i), platform_version) - .expect("should generate a document"); - - document.set_owner_id(top_level_identifier); - - let mut identity = Identity::random_identity(2, Some(100 - i), platform_version) - .expect("expected a platform identity"); - identity.set_id( - document - .properties() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - platform_version, - ) - .expect("expected to add an identity"); - - platform - .drive - .add_document_for_contract( - DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentOwnedInfo((document, None)), - owner_id: Some(top_level_identifier.to_buffer()), - }, - contract: &data_contract, - document_type, - }, - false, - BlockInfo::genesis(), - true, - None, - platform_version, - ) - .expect("expected to insert a document successfully"); - } - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - let error = get_data_trigger_error(&result, 0); - - assert_eq!( - "Reward shares cannot contain more than 16 identities", - error.to_string() - ); - } - - #[test] - fn should_pass_on_dry_run() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let mut execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - execution_context.enable_dry_run(); - - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ) - .expect("the execution result should be returned"); - assert!(result.is_valid()); - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs index 466f0154fdf..e0960ea7151 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs @@ -1,4 +1,4 @@ -///! The `withdrawals_data_triggers` module contains data triggers related to withdrawals. +//! The `withdrawals_data_triggers` module contains data triggers related to withdrawals. use crate::error::execution::ExecutionError; use crate::error::Error; @@ -7,7 +7,7 @@ use dpp::platform_value::Value; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use dpp::system_data_contracts::withdrawals_contract; use dpp::version::PlatformVersion; -use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; +use drive::query::{DriveDocumentQuery, InternalClauses, WhereClause, WhereOperator}; use std::collections::BTreeMap; use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError; use dpp::{document, ProtocolError}; @@ -15,7 +15,7 @@ use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::DocumentV0Getters; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use crate::execution::validation::state_transition::documents_batch::data_triggers::{DataTriggerExecutionContext, DataTriggerExecutionResult}; @@ -33,12 +33,18 @@ use crate::execution::validation::state_transition::documents_batch::data_trigge /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn delete_withdrawal_data_trigger_v0( +#[inline(always)] +pub(super) fn delete_withdrawal_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let mut result = DataTriggerExecutionResult::default(); @@ -46,14 +52,19 @@ pub fn delete_withdrawal_data_trigger_v0( return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( format!( "the Document Transition {} isn't 'DELETE", - document_transition.base().id() + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() ), ))); }; let document_type = data_contract.document_type_for_name(withdrawal::NAME)?; - let drive_query = DriveQuery { + let drive_query = DriveDocumentQuery { contract: data_contract, document_type, internal_clauses: InternalClauses { @@ -87,7 +98,7 @@ pub fn delete_withdrawal_data_trigger_v0( )? .documents_owned(); - let Some(withdrawal) = withdrawals.get(0) else { + let Some(withdrawal) = withdrawals.first() else { let err = DataTriggerConditionError::new( data_contract.id(), dt_delete.base().id(), @@ -104,13 +115,11 @@ pub fn delete_withdrawal_data_trigger_v0( .get_integer("status") .map_err(ProtocolError::ValueError)?; - if status != withdrawals_contract::WithdrawalStatus::COMPLETE as u8 - || status != withdrawals_contract::WithdrawalStatus::EXPIRED as u8 - { + if status != withdrawals_contract::WithdrawalStatus::COMPLETE as u8 { let err = DataTriggerConditionError::new( data_contract.id(), dt_delete.base().id(), - "withdrawal deletion is allowed only for COMPLETE and EXPIRED statuses".to_string(), + "withdrawal deletion is allowed only for COMPLETE statuses".to_string(), ); result.add_error(err); @@ -131,26 +140,27 @@ mod tests { use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::{Document, DocumentV0Getters}; - use dpp::platform_value::{platform_value, Bytes32}; + use dpp::platform_value::platform_value; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionV0}; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionV0; use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; use dpp::tests::fixtures::{get_data_contract_fixture, get_withdrawal_document_fixture}; use dpp::version::PlatformVersion; - use drive::drive::object_size_info::DocumentInfo::DocumentRefInfo; - use drive::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; + use drive::util::object_size_info::DocumentInfo::DocumentRefInfo; + use drive::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use dpp::withdrawal::Pooling; use drive::drive::contract::DataContractFetchInfo; use crate::execution::types::state_transition_execution_context::v0::StateTransitionExecutionContextV0; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; #[test] fn should_throw_error_if_withdrawal_not_found() { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let state_read_guard = platform.state.read().unwrap(); + let state_read_guard = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, state: &state_read_guard, @@ -159,12 +169,13 @@ mod tests { let platform_version = state_read_guard.current_platform_version().unwrap(); let transition_execution_context = StateTransitionExecutionContextV0::default(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); let owner_id = data_contract.owner_id(); let base_transition: DocumentBaseTransitionAction = DocumentBaseTransitionActionV0 { id: Default::default(), + identity_contract_nonce: 1, document_type_name: "".to_string(), data_contract: Arc::new(DataContractFetchInfo::dpns_contract_fixture(1)), } @@ -202,11 +213,9 @@ mod tests { fn can_serialize_and_deserialize_withdrawal() { let platform_version = PlatformVersion::first(); - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); let owner_id = data_contract.owner_id(); let document_type = data_contract @@ -223,7 +232,6 @@ mod tests { "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, "transactionIndex": 1u64, "transactionSignHeight": 93u64, - "transactionId": Bytes32::new([1;32]), }), None, platform_version.protocol_version, @@ -242,7 +250,7 @@ mod tests { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_genesis_state(); - let state_read_guard = platform.state.read().unwrap(); + let state_read_guard = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, @@ -257,11 +265,9 @@ mod tests { .current_platform_version() .expect("should return a platform version"); - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); let owner_id = data_contract.owner_id(); let document_type = data_contract @@ -279,7 +285,6 @@ mod tests { "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, "transactionIndex": 1u64, "transactionSignHeight": 93u64, - "transactionId": Bytes32::new([1;32]), }), None, platform_version.protocol_version, @@ -302,6 +307,7 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -309,6 +315,7 @@ mod tests { DocumentDeleteTransitionAction::V0(DocumentDeleteTransitionActionV0 { base: DocumentBaseTransitionAction::V0(DocumentBaseTransitionActionV0 { id: document.id(), + identity_contract_nonce: 1, document_type_name: "withdrawal".to_string(), data_contract: Arc::new(DataContractFetchInfo::withdrawals_contract_fixture( platform_version.protocol_version, @@ -336,7 +343,7 @@ mod tests { assert_eq!( error.to_string(), - "withdrawal deletion is allowed only for COMPLETE and EXPIRED statuses" + "withdrawal deletion is allowed only for COMPLETE statuses" ); } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..1487567a4bd --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/v0/mod.rs @@ -0,0 +1,68 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::identity::identity_nonce::{validate_identity_nonce_update, validate_new_identity_nonce}; +use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::document_transition::DocumentTransitionV0Methods; + +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::StateTransitionLike; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchStateTransitionIdentityContractNonceV0 +{ + fn validate_identity_contract_nonces_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentsBatchStateTransitionIdentityContractNonceV0 for DocumentsBatchTransition { + fn validate_identity_contract_nonces_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + // We should validate that all newly created documents have valid ids + for transition in self.transitions() { + let revision_nonce = transition.identity_contract_nonce(); + let identity_id = self.owner_id(); + let (existing_nonce, fee) = platform.drive.fetch_identity_contract_nonce_with_fees( + identity_id.to_buffer(), + transition.data_contract_id().to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + if !result.is_valid() { + return Ok(result); + } + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs index 9e629b27724..42fa4e36440 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs @@ -1,9 +1,13 @@ mod action_validation; -mod base_structure; +mod advanced_structure; +mod balance; mod data_triggers; +mod identity_contract_nonce; mod state; mod transformer; +use dpp::block::block_info::BlockInfo; +use dpp::identity::PartialIdentity; use dpp::prelude::*; use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::validation::SimpleConsensusValidationResult; @@ -14,28 +18,46 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; use crate::rpc::core::CoreRPCLike; -use crate::execution::validation::state_transition::documents_batch::base_structure::v0::DocumentsBatchStateTransitionStructureValidationV0; +use crate::execution::validation::state_transition::documents_batch::advanced_structure::v0::DocumentsBatchStateTransitionStructureValidationV0; +use crate::execution::validation::state_transition::documents_batch::identity_contract_nonce::v0::DocumentsBatchStateTransitionIdentityContractNonceV0; use crate::execution::validation::state_transition::documents_batch::state::v0::DocumentsBatchStateTransitionStateValidationV0; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionNonceValidationV0, + StateTransitionStateValidationV0, StateTransitionStructureKnownInStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +impl ValidationMode { + /// Returns a bool on whether we should validate that documents are valid against the state + pub fn should_validate_document_valid_against_state(&self) -> bool { + match self { + ValidationMode::CheckTx => false, + ValidationMode::RecheckTx => false, + ValidationMode::Validator => true, + ValidationMode::NoValidation => false, + } + } +} + impl StateTransitionActionTransformerV0 for DocumentsBatchTransition { fn transform_into_action( &self, platform: &PlatformRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -43,7 +65,7 @@ impl StateTransitionActionTransformerV0 for DocumentsBatchTransition { .documents_batch_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(&platform.into(), validate, tx), + 0 => self.transform_into_action_v0(&platform.into(), block_info, validation_mode, tx), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "documents batch transition: transform_into_action".to_string(), known_versions: vec![0], @@ -53,25 +75,83 @@ impl StateTransitionActionTransformerV0 for DocumentsBatchTransition { } } -impl StateTransitionStructureValidationV0 for DocumentsBatchTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for DocumentsBatchTransition { + fn validate_basic_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .basic_structure + { + 0 => { + // There is nothing expensive here + self.validate_base_structure(platform_version) + .map_err(Error::Protocol) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "documents batch transition: base structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +impl StateTransitionNonceValidationV0 for DocumentsBatchTransition { + fn validate_nonces( &self, platform: &PlatformStateRef, - action: Option<&StateTransitionAction>, - protocol_version: u32, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .documents_batch_state_transition - .structure + .revision + { + 0 => self.validate_identity_contract_nonces_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "documents batch transition: revision".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +impl StateTransitionStructureKnownInStateValidationV0 for DocumentsBatchTransition { + fn validate_advanced_structure_from_state( + &self, + action: &StateTransitionAction, + identity: Option<&PartialIdentity>, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .advanced_structure { 0 => { - let action = - action.ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "documents batch structure validation should have an action", + let identity = + identity.ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "The identity must be known on advanced structure validation", )))?; let StateTransitionAction::DocumentsBatchAction(documents_batch_transition_action) = action @@ -80,19 +160,28 @@ impl StateTransitionStructureValidationV0 for DocumentsBatchTransition { "action must be a documents batch transition action", ))); }; - self.validate_structure_v0( - platform, + self.validate_advanced_structure_from_state_v0( documents_batch_transition_action, + identity, + execution_context, platform_version, ) } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "documents batch transition: base structure".to_string(), + method: "documents batch transition: advanced structure from state".to_string(), known_versions: vec![0], received: version, })), } } + + fn has_advanced_structure_validation_with_state(&self) -> bool { + true + } + + fn requires_advanced_structure_validation_with_state_on_check_tx(&self) -> bool { + true + } } impl StateTransitionStateValidationV0 for DocumentsBatchTransition { @@ -100,10 +189,12 @@ impl StateTransitionStateValidationV0 for DocumentsBatchTransition { &self, action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; match platform_version .drive_abci @@ -127,6 +218,8 @@ impl StateTransitionStateValidationV0 for DocumentsBatchTransition { self.validate_state_v0( documents_batch_transition_action, &platform.into(), + block_info, + execution_context, tx, platform_version, ) @@ -139,3 +232,7309 @@ impl StateTransitionStateValidationV0 for DocumentsBatchTransition { } } } + +#[cfg(test)] +mod tests { + use crate::execution::validation::state_transition::state_transitions::tests::setup_identity; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::block::block_info::BlockInfo; + use dpp::dash_to_credits; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use dpp::data_contract::document_type::random_document::{ + CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType, + }; + use dpp::document::document_methods::DocumentMethodsV0; + use dpp::document::transfer::Transferable; + use dpp::document::{DocumentV0Getters, DocumentV0Setters}; + use dpp::fee::fee_result::BalanceChange; + use dpp::fee::Credits; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::nft::TradeMode; + use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; + use dpp::platform_value::{Bytes32, Value}; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; + use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; + use dpp::tests::json_document::json_document_to_contract; + use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; + use drive::query::DriveDocumentQuery; + use drive::util::storage_flags::StorageFlags; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + + mod creation_tests { + use rand::Rng; + use dapi_grpc::platform::v0::{get_contested_resource_vote_state_request, get_contested_resource_vote_state_response, GetContestedResourceVoteStateRequest, GetContestedResourceVoteStateResponse}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0::ResultType; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::GetContestedResourceVoteStateRequestV0; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::{get_contested_resource_vote_state_response_v0, GetContestedResourceVoteStateResponseV0}; + use super::*; + use assert_matches::assert_matches; + use rand::distributions::Standard; + use dpp::consensus::basic::document::DocumentFieldMaxSizeExceededError; + use dpp::consensus::ConsensusError; + use dpp::consensus::basic::BasicError; + use dpp::fee::fee_result::refunds::FeeRefunds; + use dpp::fee::fee_result::FeeResult; + use dpp::data_contract::accessors::v0::DataContractV0Setters; + use dpp::data_contract::document_type::restricted_creation::CreationRestrictionMode; + use dpp::document::Document; + use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; + use dpp::util::hash::hash_double; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice::TowardsIdentity; + use drive::util::object_size_info::DataContractResolvedInfo; + use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; + use drive::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally; + use drive::query::vote_poll_vote_state_query::ResolvedContestedDocumentVotePollDriveQuery; + use drive::util::test_helpers::setup_contract; + use crate::execution::validation::state_transition::state_transitions::tests::{add_contender_to_dpns_name_contest, create_dpns_identity_name_contest, create_dpns_name_contest_give_key_info, perform_votes_multi}; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult::PaidConsensusError; + use crate::test::helpers::fast_forward_to_block::fast_forward_to_block; + + #[test] + fn test_document_creation() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::SuccessfulExecution(_, _)] + ); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + } + + #[test] + fn test_document_creation_with_very_big_field() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay_contract_no_max_length = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-no-max-length.json", + None, + None, + ); + + let dashpay_contract = dashpay_contract_no_max_length.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let max_field_size = platform_version.system_limits.max_field_value_size; + let avatar_size = max_field_size + 1000; + + document.set( + "avatar", + Value::Bytes( + rng.sample_iter(Standard) + .take(avatar_size as usize) + .collect(), + ), + ); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + assert_eq!( + processing_result.execution_results().first().unwrap(), + &PaidConsensusError( + ConsensusError::BasicError(BasicError::DocumentFieldMaxSizeExceededError( + DocumentFieldMaxSizeExceededError::new( + "avatar".to_string(), + avatar_size as u64, + max_field_size as u64 + ) + )), + FeeResult { + storage_fee: 11556000, + processing_fee: 526140, + fee_refunds: FeeRefunds::default(), + removed_bytes_from_system: 0 + } + ) + ); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + } + + #[test] + fn test_document_creation_on_contested_unique_index() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity_1, signer_1, key_1) = + setup_identity(&mut platform, 958, dash_to_credits!(0.5)); + + let (identity_2, signer_2, key_2) = + setup_identity(&mut platform, 93, dash_to_credits!(0.5)); + + let dpns = platform.drive.cache.system_data_contracts.load_dpns(); + let dpns_contract = dpns.clone(); + + let preorder = dpns_contract + .document_type_for_name("preorder") + .expect("expected a profile document type"); + + assert!(!preorder.documents_mutable()); + assert!(preorder.documents_can_be_deleted()); + assert!(!preorder.documents_transferable().is_transferable()); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + assert!(!domain.documents_mutable()); + // Deletion is disabled with data trigger + assert!(domain.documents_can_be_deleted()); + assert!(domain.documents_transferable().is_transferable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut preorder_document_1 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut preorder_document_2 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_1 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_2 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document_1.set("parentDomainName", "dash".into()); + document_1.set("normalizedParentDomainName", "dash".into()); + document_1.set("label", "quantum".into()); + document_1.set("normalizedLabel", "quantum".into()); + document_1.set("records.identity", document_1.owner_id().into()); + document_1.set("subdomainRules.allowSubdomains", false.into()); + + document_2.set("parentDomainName", "dash".into()); + document_2.set("normalizedParentDomainName", "dash".into()); + document_2.set("label", "quantum".into()); + document_2.set("normalizedLabel", "quantum".into()); + document_2.set("records.identity", document_2.owner_id().into()); + document_2.set("subdomainRules.allowSubdomains", false.into()); + + let salt_1: [u8; 32] = rng.gen(); + let salt_2: [u8; 32] = rng.gen(); + + let mut salted_domain_buffer_1: Vec = vec![]; + salted_domain_buffer_1.extend(salt_1); + salted_domain_buffer_1.extend("quantum.dash".as_bytes()); + + let salted_domain_hash_1 = hash_double(salted_domain_buffer_1); + + let mut salted_domain_buffer_2: Vec = vec![]; + salted_domain_buffer_2.extend(salt_2); + salted_domain_buffer_2.extend("quantum.dash".as_bytes()); + + let salted_domain_hash_2 = hash_double(salted_domain_buffer_2); + + preorder_document_1.set("saltedDomainHash", salted_domain_hash_1.into()); + preorder_document_2.set("saltedDomainHash", salted_domain_hash_2.into()); + + document_1.set("preorderSalt", salt_1.into()); + document_2.set("preorderSalt", salt_2.into()); + + let documents_batch_create_preorder_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_1, + preorder, + entropy.0, + &key_1, + 2, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_1 = + documents_batch_create_preorder_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_preorder_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_2, + preorder, + entropy.0, + &key_2, + 2, + 0, + &signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_2 = + documents_batch_create_preorder_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_1, + domain, + entropy.0, + &key_1, + 3, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_1 = + documents_batch_create_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_2, + domain, + entropy.0, + &key_2, + 3, + 0, + &signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_2 = + documents_batch_create_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_preorder_transition_1.clone(), + documents_batch_create_serialized_preorder_transition_2.clone(), + ], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 2); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_transition_1.clone(), + documents_batch_create_serialized_transition_2.clone(), + ], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 2); + + // Now let's run a query for the vote totals + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = + bincode::encode_to_vec(Value::Text("quantum".to_string()), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: false, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(abstain_vote_tally, None); + + assert_eq!(lock_vote_tally, None); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + let first_contender_document = Document::from_bytes( + first_contender + .document + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + let second_contender_document = Document::from_bytes( + second_contender + .document + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + assert_ne!(first_contender_document, second_contender_document); + + assert_eq!(first_contender.identifier, identity_1.id().to_vec()); + + assert_eq!(second_contender.identifier, identity_2.id().to_vec()); + + assert_eq!(first_contender.vote_count, Some(0)); + + assert_eq!(second_contender.vote_count, Some(0)); + + let GetContestedResourceVoteStateResponse { version } = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![dash_encoded, quantum_encoded], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_contested_resource_vote_state_response_v0::Result::Proof(proof)) = result + else { + panic!("expected contenders") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedContestedDocumentVotePollDriveQuery { + vote_poll: ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::BorrowedDataContract(&dpns_contract), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![ + Value::Text("dash".to_string()), + Value::Text("quantum".to_string()), + ], + }, + result_type: DocumentsAndVoteTally, + offset: None, + limit: None, + start_at: None, + allow_include_locked_and_abstaining_vote_tally: true, + }; + + let (_root_hash, result) = resolved_contested_document_vote_poll_drive_query + .verify_vote_poll_vote_state_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + let contenders = result.contenders; + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + let first_contender_document = Document::from_bytes( + first_contender + .serialized_document() + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + let second_contender_document = Document::from_bytes( + second_contender + .serialized_document() + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + assert_ne!(first_contender_document, second_contender_document); + + assert_eq!(first_contender.identity_id(), identity_1.id()); + + assert_eq!(second_contender.identity_id(), identity_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(0)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + } + + #[test] + fn test_that_a_contested_document_can_not_be_added_to_after_a_week() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + fast_forward_to_block(&platform, 500_000_000, 900, 42, 0, false); //less than a week + + let platform_state = platform.state.load(); + + let _contender_3 = add_contender_to_dpns_name_contest( + &mut platform, + &platform_state, + 4, + "quantum", + None, // this should succeed, as we are under a week + platform_version, + ); + + fast_forward_to_block(&platform, 1_000_000_000, 900, 42, 0, false); //more than a week, less than 2 weeks + + let platform_state = platform.state.load(); + + // We expect this to fail + + let _contender_4 = add_contender_to_dpns_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + Some("Document Contest for vote_poll ContestedDocumentResourceVotePoll { contract_id: GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec, document_type_name: domain, index_name: parentNameAndLabel, index_values: [string dash, string quantum] } is not joinable V0(ContestedDocumentVotePollStoredInfoV0 { finalized_events: [], vote_poll_status: Started(BlockInfo { time_ms: 3000, height: 0, core_height: 0, epoch: 0 }), locked_count: 0 }), it started 3000 and it is now 1000003000, and you can only join for 604800000"), // this should fail, as we are over a week + platform_version, + ); + } + + #[test] + fn test_that_a_contested_document_can_not_be_added_twice_by_the_same_identity() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let ( + ( + _contender_1, + contender_1_signer, + contender_1_key, + _preorder_document_1, + (document_1, entropy), + ), + (_contender_2, _, _, _, _), + dpns_contract, + ) = create_dpns_name_contest_give_key_info( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let documents_batch_create_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_1, + domain, + entropy.0, + &contender_1_key, + 4, + 0, + &contender_1_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_1 = + documents_batch_create_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition_1.clone()], + &platform_state, + &BlockInfo::default_with_time( + &platform_state + .last_committed_block_time_ms() + .unwrap_or_default() + + 3000, + ), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "An Identity with the id BjNejy4r9QAvLHpQ9Yq6yRMgNymeGZ46d48fJxJbMrfW is already a contestant for the vote_poll ContestedDocumentResourceVotePoll { contract_id: GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec, document_type_name: domain, index_name: parentNameAndLabel, index_values: [string dash, string quantum] }"); + } + + #[test] + fn test_that_a_contested_document_can_not_be_added_if_we_are_locked() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 3), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 8), + (ResourceVoteChoice::Lock, 10), + ], + "quantum", + 10, + platform_version, + ); + + fast_forward_to_block(&platform, 200_000_000, 900, 42, 0, false); //less than a week + + let platform_state = platform.state.load(); + + let _contender_3 = add_contender_to_dpns_name_contest( + &mut platform, + &platform_state, + 4, + "quantum", + None, // this should succeed, as we are under a week + platform_version, + ); + + fast_forward_to_block(&platform, 2_000_000_000, 900, 42, 0, false); //more than two weeks + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &BlockInfo { + time_ms: 2_000_000_000, + height: 900, + core_height: 42, + epoch: Default::default(), + }, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let platform_state = platform.state.load(); + + // We expect this to fail + + let _contender_4 = add_contender_to_dpns_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + Some("Document Contest for vote_poll ContestedDocumentResourceVotePoll { contract_id: GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec, document_type_name: domain, index_name: parentNameAndLabel, index_values: [string dash, string quantum] } is currently already locked V0(ContestedDocumentVotePollStoredInfoV0 { finalized_events: [ContestedDocumentVotePollStoredInfoVoteEventV0 { resource_vote_choices: [FinalizedResourceVoteChoicesWithVoterInfo { resource_vote_choice: TowardsIdentity(BjNejy4r9QAvLHpQ9Yq6yRMgNymeGZ46d48fJxJbMrfW), voters: [2oGomAQc47V9h3mkpyHUPbF74gT2AmoYKg1oSb94Rbwm:1, 4iroeiNBeBYZetCt21kW7FGyczE8WqoqzZ48YAHwyV7R:1, Cdf8V4KGHHd395x5xPJPPrzTKwmp5MqbuszSE2iMzzeP:1] }, FinalizedResourceVoteChoicesWithVoterInfo { resource_vote_choice: TowardsIdentity(FiLk5pGtspYtF65PKsQq3YFr1DEiXPHTZeKjusT6DuqN), voters: [] }, FinalizedResourceVoteChoicesWithVoterInfo { resource_vote_choice: TowardsIdentity(Fv8S6kTbNrRqKC7PR7XcRUoPR59bxNhhggg5mRaNN6ow), voters: [4MK8GWEWX1PturUqjZJefdE4WGrUqz1UQZnbK17ENkeA:1, 5gRudU7b4n8LYkNvhZomv6FtMrP7gvaTvRrHKfaTS22K:1, AfzQBrdwzDuTVdXrMWqQyVvXRWqPMDVjA76hViuGLh6W:1, E75wdFZB22P1uW1wJBJGPgXZuZKLotK7YmbH5wUk5msH:1, G3ZfS2v39x6FuLGnnJ1RNQyy4zn4Wb64KiGAjqj39wUu:1] }, FinalizedResourceVoteChoicesWithVoterInfo { resource_vote_choice: Abstain, voters: [5Ur8tDxJnatfUd9gcVFDde7ptHydujZzJLNTxa6aMYYy:1, 93Gsg14oT9K4FLYmC7N26uS4g5b7JcM1GwGEDeJCCBPJ:1, 96eX4PTjbXRuGHuMzwXdptWFtHcboXbtevk51Jd73pP7:1, AE9xm2mbemDeMxPUzyt35Agq1axRxggVfV4DRLAZp7Qt:1, FbLyu5d7JxEsvSsujj7Wopg57Wrvz9HH3UULCusKpBnF:1, GsubMWb3LH1skUJrcxTmZ7wus1habJcbpb8su8yBVqFY:1, H9UrL7aWaxDmXhqeGMJy7LrGdT2wWb45mc7kQYsoqwuf:1, Hv88mzPZVKq2fnjoUqK56vjzkcmqRHpWE1ME4z1MXDrw:1] }, FinalizedResourceVoteChoicesWithVoterInfo { resource_vote_choice: Lock, voters: [F1oA8iAoyJ8dgCAi2GSPqcNhp9xEuAqhP47yXBDw5QR:1, 2YSjsJUp74MJpm12rdn8wyPR5MY3c322pV8E8siw989u:1, 3fQrmN4PWhthUFnCFTaJqbT2PPGf7MytAyik4eY1DP8V:1, 7r7gnAiZunVLjtSd5ky4yvPpnWTFYbJuQAapg8kDCeNK:1, 86TUE89xNkBDcmshXRD198xjAvMmKecvHbwo6i83AmqA:1, 97iYr4cirPdG176kqa5nvJWT9tsnqxHmENfRnZUgM6SC:1, 99nKfYZL4spsTe9p9pPNhc1JWv9yq4CbPPMPm87a5sgn:1, BYAqFxCVwMKrw5YAQMCFQGiAF2v3YhKRm2EdGfgkYN9G:1, CGKeK3AfdZUxXF3qH9zxp5MR7Z4WvDVqMrU5wjMKqT5C:1, HRPPEX4mdoZAMkg6NLJUgDzN4pSTpiDXEAGcR5JBdiXX:1] }], start_block: BlockInfo { time_ms: 3000, height: 0, core_height: 0, epoch: 0 }, finalization_block: BlockInfo { time_ms: 2000000000, height: 900, core_height: 42, epoch: 0 }, winner: Locked }], vote_poll_status: Locked, locked_count: 1 }), unlocking is possible by paying 400000000000 credits"), // this should fail, as it is locked + platform_version, + ); + } + + #[test] + fn test_document_creation_on_restricted_document_type_that_only_allows_contract_owner_to_create( + ) { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (another_identity, another_identity_signer, another_identity_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-creation-restricted-to-owner.json"; + + let platform_state = platform.state.load(); + let platform_version = platform_state + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let mut contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + + contract.set_owner_id(identity.id()); + + platform + .drive + .apply_contract( + &contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert_eq!( + card_document_type.creation_restriction_mode(), + CreationRestrictionMode::OwnerOnly + ); + + let mut rng = StdRng::seed_from_u64(433); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + // There is no issue because the creator of the contract made the document + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // Now let's try for another identity + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + another_identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 8.into()); + document.set("defense", 2.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &another_identity_key, + 2, + 0, + &another_identity_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + // There is no issue because the creator of the contract made the document + + assert_eq!(processing_result.invalid_paid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "Document Creation on 86LHvdC1Tqx5P97LQUSibGFqf2vnKFpB6VkqQ7oso86e:card is not allowed because of the document type's creation restriction mode Owner Only"); + } + } + + mod replacement_tests { + use super::*; + use crate::test::helpers::fast_forward_to_block::fast_forward_to_block; + + #[test] + fn test_document_replace_on_document_type_that_is_mutable() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1341740); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_document_replace_on_document_type_that_is_not_mutable() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(!contact_request_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 41880); + } + + #[test] + fn test_document_replace_on_document_type_that_is_not_mutable_but_is_transferable() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(435); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 452, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + document.set("attack", 6.into()); + document.set("defense", 0.into()); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + document, + card_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 445700); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + } + + #[test] + fn test_document_replace_that_does_not_yet_exist() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 516040); + } + + #[test] + fn test_double_document_replace() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let mut altered_document_2 = altered_document.clone(); + + altered_document_2.increment_revision().unwrap(); + altered_document_2.set("displayName", "Ody".into()); + altered_document_2.set("avatarUrl", "http://test.com/drapes.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let receiver_documents_sql_string = "select * from profile".to_string(); + + let query_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &dashpay, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-14 21:20:00 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/bob.[...(23)] displayName:string QBwBNNXXYCngB0er publicMessage:string 8XG7KBGNvm2 "); + + let documents_batch_update_transition_1 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_1 = + documents_batch_update_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_update_transition_2 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document_2, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_2 = + documents_batch_update_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_update_serialized_transition_1.clone(), + documents_batch_update_serialized_transition_2.clone(), + ], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 2); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-14 21:20:00 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/drap[...(26)] displayName:string Ody publicMessage:string 8XG7KBGNvm2 "); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_double_document_replace_different_height_same_epoch() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let mut altered_document_2 = altered_document.clone(); + + altered_document_2.increment_revision().unwrap(); + altered_document_2.set("displayName", "Ody".into()); + altered_document_2.set("avatarUrl", "http://test.com/drapes.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let receiver_documents_sql_string = "select * from profile".to_string(); + + let query_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &dashpay, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-14 21:20:00 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/bob.[...(23)] displayName:string QBwBNNXXYCngB0er publicMessage:string 8XG7KBGNvm2 "); + + fast_forward_to_block(&platform, 1_400_000_000, 901, 43, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let documents_batch_update_transition_1 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_1 = + documents_batch_update_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_update_transition_2 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document_2, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_2 = + documents_batch_update_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition_1.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-17 04:53:20 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/cat.[...(23)] displayName:string Samuel publicMessage:string 8XG7KBGNvm2 "); + + fast_forward_to_block(&platform, 1_600_000_000, 902, 44, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition_2.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-19 12:26:40 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/drap[...(26)] displayName:string Ody publicMessage:string 8XG7KBGNvm2 "); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_double_document_replace_no_change_different_height_same_epoch() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + + let mut altered_document_2 = altered_document.clone(); + + altered_document_2.increment_revision().unwrap(); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let receiver_documents_sql_string = "select * from profile".to_string(); + + let query_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &dashpay, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-14 21:20:00 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/bob.[...(23)] displayName:string QBwBNNXXYCngB0er publicMessage:string 8XG7KBGNvm2 "); + + fast_forward_to_block(&platform, 1_400_000_000, 901, 43, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let documents_batch_update_transition_1 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_1 = + documents_batch_update_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_update_transition_2 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document_2, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_2 = + documents_batch_update_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition_1.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-17 04:53:20 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/bob.[...(23)] displayName:string QBwBNNXXYCngB0er publicMessage:string 8XG7KBGNvm2 "); + + fast_forward_to_block(&platform, 1_600_000_000, 902, 44, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition_2.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-19 12:26:40 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/bob.[...(23)] displayName:string QBwBNNXXYCngB0er publicMessage:string 8XG7KBGNvm2 "); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_double_document_replace_different_height_different_epoch() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let mut altered_document_2 = altered_document.clone(); + + altered_document_2.increment_revision().unwrap(); + altered_document_2.set("displayName", "Ody".into()); + altered_document_2.set("avatarUrl", "http://test.com/drapes.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let receiver_documents_sql_string = "select * from profile".to_string(); + + let query_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &dashpay, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-14 21:20:00 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/bob.[...(23)] displayName:string QBwBNNXXYCngB0er publicMessage:string 8XG7KBGNvm2 "); + + fast_forward_to_block(&platform, 1_400_000_000, 901, 43, 1, false); //next epoch + + let platform_state = platform.state.load(); + + let documents_batch_update_transition_1 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_1 = + documents_batch_update_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_update_transition_2 = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document_2, + profile, + &key, + 4, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition_2 = + documents_batch_update_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition_1.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-17 04:53:20 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/cat.[...(23)] displayName:string Samuel publicMessage:string 8XG7KBGNvm2 "); + + fast_forward_to_block(&platform, 1_600_000_000, 905, 44, 2, true); //next epoch + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition_2.clone()], + &platform_state, + platform_state.last_block_info(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + let query_sender_results = platform + .drive + .query_documents(query_documents.clone(), None, false, None, None) + .expect("expected query result"); + + let document = query_sender_results + .documents() + .first() + .expect("expected a document"); + + assert_eq!(document.to_string(), "v0 : id:GcviwUsEr9Ji4rCrnnsgmVAghNaVPDumsfcagvBbBy45 owner_id:CisQdz2ej7EwWv8JbetSXBNsV4xsf8QsSS8tqp4tEf7V created_at:1970-01-14 21:20:00 updated_at:1970-01-19 12:26:40 avatarFingerprint:bytes d7b0e2b357c10312 avatarHash:bytes32 YonaRoE0hMgat53AYt5LTlQlIkKLReGpB7xNAqJ5HM8= avatarUrl:string http://test.com/drap[...(26)] displayName:string Ody publicMessage:string 8XG7KBGNvm2 "); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + } + + mod deletion_tests { + use super::*; + + #[test] + fn test_document_delete_on_document_type_that_is_mutable_and_can_be_deleted() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + assert!(profile.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1609340); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_document_delete_on_document_type_that_is_mutable_and_can_not_be_deleted() { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let contract_path = "tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-mutable-and-can-not-be-deleted.json"; + + let platform_state = platform.state.load(); + let platform_version = platform_state + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let dashpay_contract = json_document_to_contract(contract_path, true, platform_version) + .expect("expected to get data contract"); + platform + .drive + .apply_contract( + &dashpay_contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(contact_request_document_type.documents_mutable()); + + assert!(!contact_request_document_type.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 445700); + } + + #[test] + fn test_document_delete_on_document_type_that_is_not_mutable_and_can_be_deleted() { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let contract_path = "tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-not-mutable-and-can-be-deleted.json"; + + let platform_state = platform.state.load(); + let platform_version = platform_state + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let dashpay_contract = json_document_to_contract(contract_path, true, platform_version) + .expect("expected to get data contract"); + platform + .drive + .apply_contract( + &dashpay_contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(!contact_request_document_type.documents_mutable()); + + assert!(contact_request_document_type.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2762400); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_document_delete_on_document_type_that_is_not_mutable_and_can_not_be_deleted() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(!contact_request_document_type.documents_mutable()); + + assert!(!contact_request_document_type.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 445700); + } + + #[test] + fn test_document_delete_that_does_not_yet_exist() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_delete_serialized_transition = documents_batch_delete_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_delete_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 516040); + } + } + + mod transfer_tests { + use super::*; + + #[test] + fn test_document_transfer_on_document_type_that_is_transferable_that_has_no_owner_indices() + { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable-no-owner-indexes.json"; + + let platform_state = platform.state.load(); + let platform_version = platform_state + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + platform + .drive + .apply_contract( + &contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 0); // There is no storage fee, as there are no indexes that will change + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1985420); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_document_transfer_on_document_type_that_is_transferable() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 37341000); // 1383 bytes added + + // todo: we should expect these numbers to be closer + + assert_eq!( + processing_result + .aggregated_fees() + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()), + Some(14992395) + ); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 3369260); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to have no documents, and the receiver to have 1 + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn test_document_transfer_on_document_type_that_is_not_transferable() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Never); + + let mut rng = StdRng::seed_from_u64(435); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 452, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 445700); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + } + + #[test] + fn test_document_transfer_that_does_not_yet_exist() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Never); + + let mut rng = StdRng::seed_from_u64(435); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 452, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 0 documents, and the receiver to also have none + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 36200); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have no document, and the receiver to have none as well + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 0); + } + + #[test] + fn test_document_delete_after_transfer() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document.clone(), + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 3730120); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to have no documents, and the receiver to have 1 + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + + // Now let's try to delete the transferred document + + document.set_owner_id(receiver.id()); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + card_document_type, + &recipient_key, + 2, + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 571240); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + } + + mod nft_tests { + use super::*; + #[test] + fn test_document_set_price_on_document_without_ability_to_purchase() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "Document transition action card is in trade mode No Trading that does not support the seller setting the price is not supported"); + } + + #[test] + fn test_document_set_price() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2473880); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + // The sender document should have the desired price + + let document = query_sender_results.documents().first().unwrap(); + + let price: Credits = document + .properties() + .get_integer("$price") + .expect("expected to get back price"); + + assert_eq!(dash_to_credits!(0.1), price); + + assert_eq!(document.revision(), Some(2)); + } + + #[test] + fn test_document_set_price_and_purchase() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (purchaser, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(1.0)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!( + processing_result + .aggregated_fees() + .clone() + .into_balance_change(identity.id()) + .change(), + &BalanceChange::RemoveFromBalance { + required_removed_balance: 123579000, + desired_removed_balance: 126435860, + } + ); + + let original_creation_cost = 126435860; + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + // the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee + assert_eq!( + seller_balance, + dash_to_credits!(0.1) - original_creation_cost + ); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", purchaser.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 216000); // we added 8 bytes for the price + + assert_eq!( + processing_result + .aggregated_fees() + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()), + None + ); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2473880); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + // the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee + assert_eq!( + seller_balance, + dash_to_credits!(0.1) - original_creation_cost - 2689880 + ); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + // The sender document should have the desired price + + let mut document = query_sender_results.documents_owned().remove(0); + + let price: Credits = document + .properties() + .get_integer("$price") + .expect("expected to get back price"); + + assert_eq!(dash_to_credits!(0.1), price); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + purchaser.id(), + dash_to_credits!(0.1), //same price as requested + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 64611000); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 4080480); + + assert_eq!( + processing_result + .aggregated_fees() + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()), + Some(22704503) + ); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to have no documents, and the receiver to have 1 + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + // the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee + assert_eq!( + seller_balance, + dash_to_credits!(0.2) - original_creation_cost + 20014623 + ); + + let buyers_balance = platform + .drive + .fetch_identity_balance(purchaser.id().to_buffer(), None, platform_version) + .expect("expected to get purchaser balance") + .expect("expected that purchaser exists"); + + // the buyer payed 0.1, but also storage and processing fees + assert_eq!(buyers_balance, dash_to_credits!(0.9) - 68691480); + } + + #[test] + fn test_document_set_price_and_try_purchase_at_different_amount() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (purchaser, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(1.0)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.5), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + purchaser.id(), + dash_to_credits!(0.35), //different than requested price + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "5rJccTdtJfg6AxSKyrptWUug3PWjveEitTTLqBn9wHdk document can not be purchased for 35000000000, it's sale price is 50000000000 (in credits)"); + } + + #[test] + fn test_document_set_price_and_purchase_from_ones_self() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.5)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.5)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + identity.id(), + dash_to_credits!(0.1), //same price as requested + &key, + 1, // 1 because he's never done anything + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "Document transition action on document type: card identity trying to purchase a document that is already owned by the purchaser is not supported"); + } + + #[test] + fn test_document_set_price_and_purchase_then_try_buy_back() { + // In this test we try to buy back a document after it has been sold + + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (purchaser, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(1.0)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + purchaser.id(), + dash_to_credits!(0.1), //same price as requested + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // Let's verify some stuff + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", purchaser.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + + // The sender document should have the desired price + + let mut document = query_receiver_results.documents_owned().remove(0); + + let price: Option = document + .properties() + .get_optional_integer("$price") + .expect("expected to get back price"); + + assert_eq!(price, None); + + assert_eq!(document.owner_id(), purchaser.id()); + + // At this point we want to have the sender to try to buy back the document + + document.set_revision(Some(4)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + identity.id(), + dash_to_credits!(0.1), //same price as old requested + &key, + 4, // 1 because he's never done anything + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!( + consensus_error.to_string(), + "5rJccTdtJfg6AxSKyrptWUug3PWjveEitTTLqBn9wHdk document not for sale" + ); + } + + #[test] + fn test_document_set_price_and_purchase_with_enough_credits_to_buy_but_not_enough_to_pay_for_processing( + ) { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveDocumentQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2473880); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + // The sender document should have the desired price + + let mut document = query_sender_results.documents_owned().remove(0); + + let price: Credits = document + .properties() + .get_integer("$price") + .expect("expected to get back price"); + + assert_eq!(dash_to_credits!(0.1), price); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + receiver.id(), + dash_to_credits!(0.1), //same price as requested + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // nothing can go through because the purchaser doesn't have enough balance + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + } + + #[test] + fn test_document_set_price_on_not_owned_document() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, other_identity_signer, other_identity_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + document.set_owner_id(other_identity.id()); // we do this to trick the system + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &other_identity_key, + 1, + 0, + &other_identity_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 36200); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveDocumentQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + // The sender document should not have the desired price + + let document = query_sender_results.documents().first().unwrap(); + + assert_eq!( + document + .properties() + .get_optional_integer::("$price") + .expect("expected None"), + None + ); + } + } + + mod dpns_tests { + use super::*; + use crate::execution::validation::state_transition::tests::setup_identity; + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::dash_to_credits; + use dpp::data_contract::document_type::random_document::{ + DocumentFieldFillSize, DocumentFieldFillType, + }; + use dpp::platform_value::Bytes32; + use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; + use dpp::util::hash::hash_double; + use drive::query::{InternalClauses, OrderClause, WhereClause, WhereOperator}; + use drive::util::test_helpers::setup_contract; + use indexmap::IndexMap; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::Rng; + use std::collections::BTreeMap; + + #[test] + fn test_dpns_contract_references_with_no_contested_unique_index() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity_1, signer_1, key_1) = + setup_identity(&mut platform, 958, dash_to_credits!(0.5)); + + let (identity_2, signer_2, key_2) = + setup_identity(&mut platform, 93, dash_to_credits!(0.5)); + + let (identity_3, signer_3, key_3) = + setup_identity(&mut platform, 98, dash_to_credits!(0.5)); + + let dashpay_contract = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + None, + None, + ); + + let card_game = setup_contract( + &platform.drive, + "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json", + None, + None, + ); + + let dpns_contract = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id.json", + None, + None, + ); + + let preorder = dpns_contract + .document_type_for_name("preorder") + .expect("expected a profile document type"); + + assert!(!preorder.documents_mutable()); + assert!(preorder.documents_can_be_deleted()); + assert!(!preorder.documents_transferable().is_transferable()); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + assert!(!domain.documents_mutable()); + // Deletion is disabled with data trigger + assert!(domain.documents_can_be_deleted()); + assert!(domain.documents_transferable().is_transferable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut preorder_document_1 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut preorder_document_2 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut preorder_document_3 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_3.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_1 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_2 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_3 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_3.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document_1.set("parentDomainName", "dash".into()); + document_1.set("normalizedParentDomainName", "dash".into()); + document_1.set("label", "quantum123".into()); + document_1.set("normalizedLabel", "quantum123".into()); + document_1.set("records.contract", dashpay_contract.id().into()); + document_1.set("subdomainRules.allowSubdomains", false.into()); + + document_2.set("parentDomainName", "dash".into()); + document_2.set("normalizedParentDomainName", "dash".into()); + document_2.set("label", "van89".into()); + document_2.set("normalizedLabel", "van89".into()); + document_2.set("records.contract", card_game.id().into()); + document_2.set("subdomainRules.allowSubdomains", false.into()); + + document_3.set("parentDomainName", "dash".into()); + document_3.set("normalizedParentDomainName", "dash".into()); + document_3.set("label", "jazz65".into()); + document_3.set("normalizedLabel", "jazz65".into()); + document_3.set("records.identity", document_3.owner_id().into()); + document_3.set("subdomainRules.allowSubdomains", false.into()); + + let salt_1: [u8; 32] = rng.gen(); + let salt_2: [u8; 32] = rng.gen(); + let salt_3: [u8; 32] = rng.gen(); + + let mut salted_domain_buffer_1: Vec = vec![]; + salted_domain_buffer_1.extend(salt_1); + salted_domain_buffer_1.extend("quantum123.dash".as_bytes()); + + let salted_domain_hash_1 = hash_double(salted_domain_buffer_1); + + let mut salted_domain_buffer_2: Vec = vec![]; + salted_domain_buffer_2.extend(salt_2); + salted_domain_buffer_2.extend("van89.dash".as_bytes()); + + let salted_domain_hash_2 = hash_double(salted_domain_buffer_2); + + let mut salted_domain_buffer_3: Vec = vec![]; + salted_domain_buffer_3.extend(salt_3); + salted_domain_buffer_3.extend("jazz65.dash".as_bytes()); + + let salted_domain_hash_3 = hash_double(salted_domain_buffer_3); + + preorder_document_1.set("saltedDomainHash", salted_domain_hash_1.into()); + preorder_document_2.set("saltedDomainHash", salted_domain_hash_2.into()); + preorder_document_3.set("saltedDomainHash", salted_domain_hash_3.into()); + + document_1.set("preorderSalt", salt_1.into()); + document_2.set("preorderSalt", salt_2.into()); + document_3.set("preorderSalt", salt_3.into()); + + let documents_batch_create_preorder_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_1, + preorder, + entropy.0, + &key_1, + 2, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_1 = + documents_batch_create_preorder_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_preorder_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_2, + preorder, + entropy.0, + &key_2, + 2, + 0, + &signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_2 = + documents_batch_create_preorder_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_preorder_transition_3 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_3, + preorder, + entropy.0, + &key_3, + 2, + 0, + &signer_3, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_3 = + documents_batch_create_preorder_transition_3 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_1, + domain, + entropy.0, + &key_1, + 3, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_1 = + documents_batch_create_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_2, + domain, + entropy.0, + &key_2, + 3, + 0, + &signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_2 = + documents_batch_create_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_3 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_3.clone(), + domain, + entropy.0, + &key_3, + 3, + 0, + &signer_3, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_3 = + documents_batch_create_transition_3 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_preorder_transition_1.clone(), + documents_batch_create_serialized_preorder_transition_2.clone(), + documents_batch_create_serialized_preorder_transition_3.clone(), + ], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 3); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_transition_1.clone(), + documents_batch_create_serialized_transition_2.clone(), + documents_batch_create_serialized_transition_3.clone(), + ], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 3); + + let mut order_by = IndexMap::new(); + + order_by.insert( + "records.identity".to_string(), + OrderClause { + field: "records.identity".to_string(), + ascending: true, + }, + ); + + let drive_query = DriveDocumentQuery { + contract: &dpns_contract, + document_type: domain, + internal_clauses: InternalClauses { + primary_key_in_clause: None, + primary_key_equal_clause: None, + in_clause: None, + range_clause: Some(WhereClause { + field: "records.identity".to_string(), + operator: WhereOperator::LessThanOrEquals, + value: Value::Bytes32([255; 32]), + }), + equal_clauses: Default::default(), + }, + offset: None, + limit: None, + order_by, + start_at: None, + start_at_included: false, + block_time_ms: None, + }; + + let documents = platform + .drive + .query_documents(drive_query, None, false, None, None) + .expect("expected to get back documents") + .documents_owned(); + + let transient_fields = domain + .transient_fields() + .iter() + .map(|a| a.as_str()) + .collect(); + + assert!(documents + .get(0) + .expect("expected a document") + .is_equal_ignoring_time_based_fields( + &document_3, + Some(transient_fields), + platform_version + ) + .expect("expected to run is equal")); + + let drive_query = DriveDocumentQuery { + contract: &dpns_contract, + document_type: domain, + internal_clauses: InternalClauses { + primary_key_in_clause: None, + primary_key_equal_clause: None, + in_clause: None, + range_clause: None, + equal_clauses: BTreeMap::from([( + "records.identity".to_string(), + WhereClause { + field: "records.identity".to_string(), + operator: WhereOperator::Equal, + value: Value::Null, + }, + )]), + }, + offset: None, + limit: None, + order_by: Default::default(), + start_at: None, + start_at_included: false, + block_time_ms: None, + }; + + let documents = platform + .drive + .query_documents(drive_query, None, false, None, None) + .expect("expected to get back documents") + .documents_owned(); + + // This is normal because we set that we could not query on null + assert_eq!(documents.len(), 0); + } + + #[test] + fn test_dpns_contract_references_with_no_contested_unique_index_null_searchable_true() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity_1, signer_1, key_1) = + setup_identity(&mut platform, 958, dash_to_credits!(0.5)); + + let (identity_2, signer_2, key_2) = + setup_identity(&mut platform, 93, dash_to_credits!(0.5)); + + let (identity_3, signer_3, key_3) = + setup_identity(&mut platform, 98, dash_to_credits!(0.5)); + + let dashpay_contract = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + None, + None, + ); + + let card_game = setup_contract( + &platform.drive, + "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json", + None, + None, + ); + + let dpns_contract = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id-null-searchable-true.json", + None, + None, + ); + + let preorder = dpns_contract + .document_type_for_name("preorder") + .expect("expected a profile document type"); + + assert!(!preorder.documents_mutable()); + assert!(preorder.documents_can_be_deleted()); + assert!(!preorder.documents_transferable().is_transferable()); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + assert!(!domain.documents_mutable()); + // Deletion is disabled with data trigger + assert!(domain.documents_can_be_deleted()); + assert!(domain.documents_transferable().is_transferable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut preorder_document_1 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut preorder_document_2 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut preorder_document_3 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_3.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_1 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_2 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_3 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_3.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document_1.set("parentDomainName", "dash".into()); + document_1.set("normalizedParentDomainName", "dash".into()); + document_1.set("label", "quantum123".into()); + document_1.set("normalizedLabel", "quantum123".into()); + document_1.set("records.contract", dashpay_contract.id().into()); + document_1.set("subdomainRules.allowSubdomains", false.into()); + + document_2.set("parentDomainName", "dash".into()); + document_2.set("normalizedParentDomainName", "dash".into()); + document_2.set("label", "van89".into()); + document_2.set("normalizedLabel", "van89".into()); + document_2.set("records.contract", card_game.id().into()); + document_2.set("subdomainRules.allowSubdomains", false.into()); + + document_3.set("parentDomainName", "dash".into()); + document_3.set("normalizedParentDomainName", "dash".into()); + document_3.set("label", "jazz65".into()); + document_3.set("normalizedLabel", "jazz65".into()); + document_3.set("records.identity", document_3.owner_id().into()); + document_3.set("subdomainRules.allowSubdomains", false.into()); + + let salt_1: [u8; 32] = rng.gen(); + let salt_2: [u8; 32] = rng.gen(); + let salt_3: [u8; 32] = rng.gen(); + + let mut salted_domain_buffer_1: Vec = vec![]; + salted_domain_buffer_1.extend(salt_1); + salted_domain_buffer_1.extend("quantum123.dash".as_bytes()); + + let salted_domain_hash_1 = hash_double(salted_domain_buffer_1); + + let mut salted_domain_buffer_2: Vec = vec![]; + salted_domain_buffer_2.extend(salt_2); + salted_domain_buffer_2.extend("van89.dash".as_bytes()); + + let salted_domain_hash_2 = hash_double(salted_domain_buffer_2); + + let mut salted_domain_buffer_3: Vec = vec![]; + salted_domain_buffer_3.extend(salt_3); + salted_domain_buffer_3.extend("jazz65.dash".as_bytes()); + + let salted_domain_hash_3 = hash_double(salted_domain_buffer_3); + + preorder_document_1.set("saltedDomainHash", salted_domain_hash_1.into()); + preorder_document_2.set("saltedDomainHash", salted_domain_hash_2.into()); + preorder_document_3.set("saltedDomainHash", salted_domain_hash_3.into()); + + document_1.set("preorderSalt", salt_1.into()); + document_2.set("preorderSalt", salt_2.into()); + document_3.set("preorderSalt", salt_3.into()); + + let documents_batch_create_preorder_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_1, + preorder, + entropy.0, + &key_1, + 2, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_1 = + documents_batch_create_preorder_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_preorder_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_2, + preorder, + entropy.0, + &key_2, + 2, + 0, + &signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_2 = + documents_batch_create_preorder_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_preorder_transition_3 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_3, + preorder, + entropy.0, + &key_3, + 2, + 0, + &signer_3, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_3 = + documents_batch_create_preorder_transition_3 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_1, + domain, + entropy.0, + &key_1, + 3, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_1 = + documents_batch_create_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_2, + domain, + entropy.0, + &key_2, + 3, + 0, + &signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_2 = + documents_batch_create_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_3 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_3.clone(), + domain, + entropy.0, + &key_3, + 3, + 0, + &signer_3, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_3 = + documents_batch_create_transition_3 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_preorder_transition_1.clone(), + documents_batch_create_serialized_preorder_transition_2.clone(), + documents_batch_create_serialized_preorder_transition_3.clone(), + ], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 3); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_transition_1.clone(), + documents_batch_create_serialized_transition_2.clone(), + documents_batch_create_serialized_transition_3.clone(), + ], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 3); + + let mut order_by = IndexMap::new(); + + order_by.insert( + "records.identity".to_string(), + OrderClause { + field: "records.identity".to_string(), + ascending: true, + }, + ); + + let drive_query = DriveDocumentQuery { + contract: &dpns_contract, + document_type: domain, + internal_clauses: InternalClauses { + primary_key_in_clause: None, + primary_key_equal_clause: None, + in_clause: None, + range_clause: Some(WhereClause { + field: "records.identity".to_string(), + operator: WhereOperator::LessThanOrEquals, + value: Value::Bytes32([255; 32]), + }), + equal_clauses: Default::default(), + }, + offset: None, + limit: None, + order_by, + start_at: None, + start_at_included: false, + block_time_ms: None, + }; + + let documents = platform + .drive + .query_documents(drive_query, None, false, None, None) + .expect("expected to get back documents") + .documents_owned(); + + // here we will get all 3 documents + assert_eq!(documents.len(), 3); + + let drive_query = DriveDocumentQuery { + contract: &dpns_contract, + document_type: domain, + internal_clauses: InternalClauses { + primary_key_in_clause: None, + primary_key_equal_clause: None, + in_clause: None, + range_clause: None, + equal_clauses: BTreeMap::from([( + "records.identity".to_string(), + WhereClause { + field: "records.identity".to_string(), + operator: WhereOperator::Equal, + value: Value::Null, + }, + )]), + }, + offset: None, + limit: None, + order_by: Default::default(), + start_at: None, + start_at_included: false, + block_time_ms: None, + }; + + let documents = platform + .drive + .query_documents(drive_query, None, false, None, None) + .expect("expected to get back documents") + .documents_owned(); + + assert_eq!(documents.len(), 2); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs index 32f99e179e2..47a71a2e699 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs @@ -7,6 +7,9 @@ use dpp::version::PlatformVersion; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub(super) fn execute_data_triggers( document_transition_actions: &Vec, context: &DataTriggerExecutionContext, @@ -15,6 +18,12 @@ pub(super) fn execute_data_triggers( let data_trigger_bindings = data_trigger_bindings_list(platform_version)?; for document_transition_action in document_transition_actions { + if matches!( + document_transition_action, + DocumentTransitionAction::BumpIdentityDataContractNonce(_) + ) { + continue; + } let data_trigger_execution_result = document_transition_action .validate_with_data_triggers(&data_trigger_bindings, context, platform_version)?; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_contender.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_contender.rs new file mode 100644 index 00000000000..8398f39b985 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_contender.rs @@ -0,0 +1,54 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use dpp::voting::contender_structs::ContenderWithSerializedDocument; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::drive::Drive; +use drive::grovedb::TransactionArg; +use drive::query::vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQueryResultType, ResolvedContestedDocumentVotePollDriveQuery, +}; + +pub(crate) fn fetch_contender( + drive: &Drive, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + contender_id: Identifier, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, +) -> Result<(Option, FeeResult), Error> { + let contender_query = ResolvedContestedDocumentVotePollDriveQuery { + vote_poll: vote_poll.into(), + result_type: ContestedDocumentVotePollDriveQueryResultType::VoteTally, // Cheaper than anything else + offset: None, + limit: Some(1), + start_at: Some((contender_id.0 .0, true)), + allow_include_locked_and_abstaining_vote_tally: false, + }; + + let mut drive_operations = vec![]; + + let mut result = + contender_query.execute(drive, transaction, &mut drive_operations, platform_version)?; + + let fee = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + match result.contenders.pop() { + None => Ok((None, fee)), + Some(contender) => { + if contender.identity_id() == contender_id { + Ok((Some(contender), fee)) + } else { + Ok((None, fee)) + } + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs index 1b55ac6a673..d569e680a2c 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs @@ -12,6 +12,7 @@ use dpp::data_contract::DataContract; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use dpp::document::Document; +use dpp::fee::fee_result::FeeResult; use dpp::platform_value::{Identifier, Value}; use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use dpp::state_transition::documents_batch_transition::document_transition::{ @@ -22,9 +23,11 @@ use dpp::version::PlatformVersion; use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use drive::drive::Drive; use drive::grovedb::TransactionArg; -use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; +use drive::query::{DriveDocumentQuery, InternalClauses, WhereClause, WhereOperator}; #[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub(crate) fn fetch_documents_for_transitions( platform: &PlatformStateRef, document_transitions: &[&DocumentTransition], @@ -82,7 +85,7 @@ pub(crate) fn fetch_documents_for_transitions_knowing_contract_id_and_document_t let add_to_cache_if_pulled = transaction.is_some(); let (_, contract_fetch_info) = drive.get_contract_with_fetch_info_and_fee( contract_id.to_buffer(), - Some(&platform.state.epoch()), + Some(platform.state.last_committed_block_epoch_ref()), add_to_cache_if_pulled, transaction, platform_version, @@ -134,7 +137,7 @@ pub(crate) fn fetch_documents_for_transitions_knowing_contract_and_document_type .map(|dt| Value::Identifier(dt.get_id().to_buffer())) .collect(); - let drive_query = DriveQuery { + let drive_query = DriveDocumentQuery { contract, document_type, internal_clauses: InternalClauses { @@ -177,8 +180,8 @@ pub(crate) fn fetch_document_with_id( id: Identifier, transaction: TransactionArg, platform_version: &PlatformVersion, -) -> Result, Error> { - let drive_query = DriveQuery { +) -> Result<(Option, FeeResult), Error> { + let drive_query = DriveDocumentQuery { contract, document_type, internal_clauses: InternalClauses { @@ -200,7 +203,6 @@ pub(crate) fn fetch_document_with_id( block_time_ms: None, }; - //todo: deal with cost of this operation let documents_outcome = drive.query_documents( drive_query, None, @@ -209,11 +211,18 @@ pub(crate) fn fetch_document_with_id( Some(platform_version.protocol_version), )?; + let fee = documents_outcome.cost(); + let fee_result = FeeResult { + storage_fee: 0, + processing_fee: fee, + fee_refunds: Default::default(), + removed_bytes_from_system: 0, + }; let mut documents = documents_outcome.documents_owned(); if documents.is_empty() { - Ok(None) + Ok((None, fee_result)) } else { - Ok(Some(documents.remove(0))) + Ok((Some(documents.remove(0)), fee_result)) } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs index 066402e2c09..5ee90a17ab4 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs @@ -1,5 +1,7 @@ +use dpp::block::block_info::BlockInfo; +use dpp::consensus::ConsensusError; +use dpp::consensus::state::state_error::StateError; use dpp::prelude::ConsensusValidationResult; -use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::state_transition::StateTransitionLike; use drive::state_transition_action::StateTransitionAction; @@ -7,17 +9,24 @@ use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; use drive::grovedb::TransactionArg; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; use crate::error::Error; +use crate::error::execution::ExecutionError; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_create_transition_action::DocumentCreateTransitionActionValidation; use crate::execution::validation::state_transition::documents_batch::action_validation::document_delete_transition_action::DocumentDeleteTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::DocumentPurchaseTransitionActionValidation; use crate::execution::validation::state_transition::documents_batch::action_validation::document_replace_transition_action::DocumentReplaceTransitionActionValidation; -use crate::execution::validation::state_transition::documents_batch::data_triggers::DataTriggerExecutionContext; -use crate::execution::validation::state_transition::documents_batch::state::v0::data_triggers::execute_data_triggers; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::DocumentTransferTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::DocumentUpdatePriceTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::data_triggers::{data_trigger_bindings_list, DataTriggerExecutionContext, DataTriggerExecutor}; use crate::platform_types::platform::{PlatformStateRef}; use crate::execution::validation::state_transition::state_transitions::documents_batch::transformer::v0::DocumentsBatchTransitionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; mod data_triggers; +pub mod fetch_contender; pub mod fetch_documents; pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchStateTransitionStateValidationV0 @@ -26,6 +35,8 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume &self, action: DocumentsBatchTransitionAction, platform: &PlatformStateRef, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; @@ -33,7 +44,8 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume fn transform_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, tx: TransactionArg, ) -> Result, Error>; } @@ -41,8 +53,10 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume impl DocumentsBatchStateTransitionStateValidationV0 for DocumentsBatchTransition { fn validate_state_v0( &self, - state_transition_action: DocumentsBatchTransitionAction, + mut state_transition_action: DocumentsBatchTransitionAction, platform: &PlatformStateRef, + block_info: &BlockInfo, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { @@ -53,40 +67,139 @@ impl DocumentsBatchStateTransitionStateValidationV0 for DocumentsBatchTransition let owner_id = state_transition_action.owner_id(); + let mut validated_transitions = vec![]; + + let data_trigger_bindings = if platform.config.execution.use_document_triggers { + data_trigger_bindings_list(platform_version)? + } else { + vec![] + }; + // Next we need to validate the structure of all actions (this means with the data contract) - for transition in state_transition_action.transitions() { - let transition_validation_result = match transition { + for transition in state_transition_action.transitions_take() { + let transition_validation_result = match &transition { DocumentTransitionAction::CreateAction(create_action) => create_action - .validate_state(platform, owner_id, transaction, platform_version)?, + .validate_state( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + )?, DocumentTransitionAction::ReplaceAction(replace_action) => replace_action - .validate_state(platform, owner_id, transaction, platform_version)?, + .validate_state( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + )?, + DocumentTransitionAction::TransferAction(transfer_action) => transfer_action + .validate_state( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + )?, DocumentTransitionAction::DeleteAction(delete_action) => delete_action - .validate_state(platform, owner_id, transaction, platform_version)?, + .validate_state( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + )?, + DocumentTransitionAction::UpdatePriceAction(update_price_action) => { + update_price_action.validate_state( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + )? + } + DocumentTransitionAction::PurchaseAction(purchase_action) => purchase_action + .validate_state( + platform, + owner_id, + block_info, + execution_context, + transaction, + platform_version, + )?, + DocumentTransitionAction::BumpIdentityDataContractNonce(..) => { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we should never start with a bump identity data contract nonce", + ))); + } }; if !transition_validation_result.is_valid() { + // If a state transition isn't valid we still need to bump the identity data contract nonce validation_result.add_errors(transition_validation_result.errors); + validated_transitions.push( + DocumentTransitionAction::BumpIdentityDataContractNonce( + BumpIdentityDataContractNonceAction::from_document_base_transition_action( + transition.base_owned().ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "base should always exist on transition", + ), + ))?, + owner_id, + state_transition_action.user_fee_increase(), + ), + ), + ); + } else if platform.config.execution.use_document_triggers { + // we should also validate document triggers + let data_trigger_execution_context = DataTriggerExecutionContext { + platform, + transaction, + owner_id: &self.owner_id(), + state_transition_execution_context: &state_transition_execution_context, + }; + let data_trigger_execution_result = transition.validate_with_data_triggers( + &data_trigger_bindings, + &data_trigger_execution_context, + platform_version, + )?; - return Ok(validation_result); + if !data_trigger_execution_result.is_valid() { + // If a state transition isn't valid because of data triggers we still need + // to bump the identity data contract nonce + let consensus_errors: Vec = data_trigger_execution_result + .errors + .into_iter() + .map(|e| ConsensusError::StateError(StateError::DataTriggerError(e))) + .collect(); + validation_result.add_errors(consensus_errors); + validated_transitions + .push(DocumentTransitionAction::BumpIdentityDataContractNonce( + BumpIdentityDataContractNonceAction::from_document_base_transition_action( + transition.base_owned().ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "base should always exist on transition", + ), + ))?, + owner_id, + state_transition_action.user_fee_increase(), + ), + )); + } else { + validated_transitions.push(transition); + } + } else { + validated_transitions.push(transition); } } - let data_trigger_execution_context = DataTriggerExecutionContext { - platform, - transaction, - owner_id: &self.owner_id(), - state_transition_execution_context: &state_transition_execution_context, - }; - - if platform.config.execution.use_document_triggers { - let data_triggers_validation_result = execute_data_triggers( - state_transition_action.transitions(), - &data_trigger_execution_context, - platform.state.current_platform_version()?, - )?; - - validation_result.add_errors_into(data_triggers_validation_result.errors); - } + state_transition_action.set_transitions(validated_transitions); validation_result.set_data(state_transition_action.into()); @@ -96,14 +209,23 @@ impl DocumentsBatchStateTransitionStateValidationV0 for DocumentsBatchTransition fn transform_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, tx: TransactionArg, ) -> Result, Error> { let platform_version = platform.state.current_platform_version()?; + let mut execution_context = StateTransitionExecutionContext::default_for_platform_version(platform_version)?; - let validation_result = - self.try_into_action_v0(platform, validate, tx, &mut execution_context)?; + + let validation_result = self.try_into_action_v0( + platform, + block_info, + validation_mode.should_validate_document_valid_against_state(), + tx, + &mut execution_context, + )?; + Ok(validation_result.map(Into::into)) } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs index c7b8a06bd22..68ec4de478e 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs @@ -14,18 +14,26 @@ use dpp::consensus::state::document::invalid_document_revision_error::InvalidDoc use dpp::consensus::state::state_error::StateError; use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::state::document::document_incorrect_purchase_price_error::DocumentIncorrectPurchasePriceError; +use dpp::consensus::state::document::document_not_for_sale_error::DocumentNotForSaleError; +use dpp::document::property_names::PRICE; use dpp::document::{Document, DocumentV0Getters}; +use dpp::fee::Credits; +use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; +use dpp::prelude::Revision; use dpp::validation::SimpleConsensusValidationResult; use dpp::{consensus::ConsensusError, prelude::Identifier, validation::ConsensusValidationResult}; -use dpp::state_transition::documents_batch_transition::{DocumentsBatchTransition}; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; -use dpp::state_transition::documents_batch_transition::document_transition::{DocumentTransition, DocumentReplaceTransition, DocumentTransitionV0Methods}; +use dpp::state_transition::documents_batch_transition::document_transition::{DocumentTransition, DocumentTransitionV0Methods}; +use dpp::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; use dpp::state_transition::StateTransitionLike; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; -use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; +use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::DocumentReplaceTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; use drive::state_transition_action::document::documents_batch::v0::DocumentsBatchTransitionActionV0; @@ -35,16 +43,25 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use dpp::state_transition::documents_batch_transition::document_transition::document_replace_transition::v0::v0_methods::DocumentReplaceTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods; use drive::drive::contract::DataContractFetchInfo; -use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext}; +use drive::drive::Drive; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionAction; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::DocumentTransferTransitionAction; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::DocumentUpdatePriceTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchTransitionTransformerV0 { fn try_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + full_validation: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, ) -> Result, Error>; @@ -53,7 +70,8 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume trait DocumentsBatchTransitionInternalTransformerV0 { fn transform_document_transitions_within_contract_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + full_validation: bool, data_contract_id: &Identifier, owner_id: Identifier, document_transitions: &BTreeMap<&String, Vec<&DocumentTransition>>, @@ -63,34 +81,41 @@ trait DocumentsBatchTransitionInternalTransformerV0 { ) -> Result>, Error>; fn transform_document_transitions_within_document_type_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + full_validation: bool, data_contract_fetch_info: Arc, document_type_name: &str, owner_id: Identifier, document_transitions: &[&DocumentTransition], - _execution_context: &mut StateTransitionExecutionContext, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result>, Error>; /// The data contract can be of multiple difference versions - fn transform_transition_v0<'a>( - validate: bool, + fn transform_transition_v0( + drive: &Drive, + transaction: TransactionArg, + full_validation: bool, + block_info: &BlockInfo, data_contract_fetch_info: Arc, transition: &DocumentTransition, replaced_documents: &[Document], owner_id: Identifier, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, ) -> Result, Error>; fn find_replaced_document_v0<'a>( document_transition: &'a DocumentTransition, fetched_documents: &'a [Document], ) -> ConsensusValidationResult<&'a Document>; fn check_ownership_of_old_replaced_document_v0( - document_transition: &DocumentReplaceTransition, + document_id: Identifier, fetched_document: &Document, owner_id: &Identifier, ) -> SimpleConsensusValidationResult; fn check_revision_is_bumped_by_one_during_replace_v0( - document_transition: &DocumentReplaceTransition, + transition_revision: Revision, + document_id: Identifier, original_document: &Document, ) -> SimpleConsensusValidationResult; } @@ -99,11 +124,13 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { fn try_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validate_against_state: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, ) -> Result, Error> { let owner_id = self.owner_id(); + let user_fee_increase = self.user_fee_increase(); let platform_version = platform.state.current_platform_version()?; let mut transitions_by_contracts_and_types: BTreeMap< &Identifier, @@ -139,7 +166,8 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { |(data_contract_id, document_transitions_by_document_type)| { Self::transform_document_transitions_within_contract_v0( platform, - validate, + block_info, + validate_against_state, data_contract_id, owner_id, document_transitions_by_document_type, @@ -152,14 +180,17 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { .collect::>>, Error>>()?; let validation_result = ConsensusValidationResult::flatten(validation_result); - if validation_result.is_valid() { + if validation_result.has_data() { + let (transitions, errors) = validation_result.into_data_and_errors()?; let batch_transition_action = DocumentsBatchTransitionActionV0 { owner_id, - transitions: validation_result.into_data()?, + transitions, + user_fee_increase, } .into(); - Ok(ConsensusValidationResult::new_with_data( + Ok(ConsensusValidationResult::new_with_data_and_errors( batch_transition_action, + errors, )) } else { Ok(ConsensusValidationResult::new_with_errors( @@ -172,7 +203,8 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition { fn transform_document_transitions_within_contract_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validate_against_state: bool, data_contract_id: &Identifier, owner_id: Identifier, document_transitions: &BTreeMap<&String, Vec<&DocumentTransition>>, @@ -201,33 +233,34 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition }; let validation_result = document_transitions - .iter() - .map(|(document_type_name, document_transitions)| { - Self::transform_document_transitions_within_document_type_v0( - platform, - validate, - data_contract_fetch_info.clone(), - document_type_name, - owner_id, - document_transitions, - execution_context, - transaction, - platform_version, - ) - }) - .collect::>>, Error>>( - )?; + .iter() + .map(|(document_type_name, document_transitions)| { + Self::transform_document_transitions_within_document_type_v0( + platform, + block_info, + validate_against_state, + data_contract_fetch_info.clone(), + document_type_name, + owner_id, + document_transitions, + execution_context, + transaction, + platform_version, + ) + }) + .collect::>>, Error>>()?; Ok(ConsensusValidationResult::flatten(validation_result)) } fn transform_document_transitions_within_document_type_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validate_against_state: bool, data_contract_fetch_info: Arc, document_type_name: &str, owner_id: Identifier, document_transitions: &[&DocumentTransition], - _execution_context: &mut StateTransitionExecutionContext, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result>, Error> { @@ -250,15 +283,23 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition )); }; - let replace_transitions = document_transitions + let replace_and_transfer_transitions = document_transitions .iter() - .filter(|transition| matches!(transition, DocumentTransition::Replace(_))) + .filter(|transition| { + matches!( + transition, + DocumentTransition::Replace(_) + | DocumentTransition::Transfer(_) + | DocumentTransition::Purchase(_) + | DocumentTransition::UpdatePrice(_) + ) + }) .copied() .collect::>(); - // We fetch documents only for replace transitions + // We fetch documents only for replace and transfer transitions // since we need them to create transition actions - // Below we also perform state validation for replace transitions only + // Below we also perform state validation for replace and transfer transitions only // other transitions are validated in their validate_state functions // TODO: Think more about this architecture let fetched_documents_validation_result = @@ -266,7 +307,7 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition platform.drive, data_contract, document_type, - replace_transitions.as_slice(), + replace_and_transfer_transitions.as_slice(), transaction, platform_version, )?; @@ -279,17 +320,22 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition let replaced_documents = fetched_documents_validation_result.into_data()?; - let document_transition_actions_result = if !dry_run { + Ok(if !dry_run { let document_transition_actions_validation_result = document_transitions .iter() .map(|transition| { // we validate every transition in this document type Self::transform_transition_v0( - validate, + platform.drive, + transaction, + validate_against_state, + block_info, data_contract_fetch_info.clone(), transition, &replaced_documents, owner_id, + execution_context, + platform_version, ) }) .collect::>, Error>>( @@ -305,34 +351,34 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition result } else { ConsensusValidationResult::default() - }; - - if !document_transition_actions_result.is_valid() { - return Ok(document_transition_actions_result); - } - - let document_transition_actions = document_transition_actions_result.into_data()?; - - Ok(ConsensusValidationResult::new_with_data( - document_transition_actions, - )) + }) } /// The data contract can be of multiple difference versions fn transform_transition_v0<'a>( - validate: bool, + drive: &Drive, + transaction: TransactionArg, + validate_against_state: bool, + block_info: &BlockInfo, data_contract_fetch_info: Arc, transition: &DocumentTransition, replaced_documents: &[Document], owner_id: Identifier, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, ) -> Result, Error> { match transition { DocumentTransition::Create(document_create_transition) => { let result = ConsensusValidationResult::::new(); - let document_create_action = DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { - Ok(data_contract_fetch_info.clone()) - })?; + let (document_create_action, fee_result) = DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup( + drive, transaction, + document_create_transition, block_info, |_identifier| { + Ok(data_contract_fetch_info.clone()) + }, platform_version)?; + + execution_context + .add_operation(ValidationOperation::PrecalculatedOperation(fee_result)); if result.is_valid() { Ok(DocumentTransitionAction::CreateAction(document_create_action).into()) @@ -347,8 +393,18 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition Self::find_replaced_document_v0(transition, replaced_documents); if !validation_result.is_valid_with_data() { - result.merge(validation_result); - return Ok(result); + // We can set the user fee increase to 0 here because it is decided by the Documents Batch instead + let bump_action = + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition( + document_replace_transition.base(), + owner_id, + 0, + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action.into(), + validation_result.errors, + )); } let original_document = validation_result.into_data()?; @@ -357,8 +413,22 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition // In this case we don't care about the created at let original_document_created_at = original_document.created_at(); + let original_document_created_at_block_height = + original_document.created_at_block_height(); + + let original_document_created_at_core_block_height = + original_document.created_at_core_block_height(); + + let original_document_transferred_at = original_document.transferred_at(); + + let original_document_transferred_at_block_height = + original_document.transferred_at_block_height(); + + let original_document_transferred_at_core_block_height = + original_document.transferred_at_core_block_height(); + let validation_result = Self::check_ownership_of_old_replaced_document_v0( - document_replace_transition, + document_replace_transition.base().id(), original_document, &owner_id, ); @@ -368,12 +438,13 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition return Ok(result); } - if validate { + if validate_against_state { //there are situations where we don't want to validate this against the state // for example when we already applied the state transition action // and we are just validating it happened let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( - document_replace_transition, + document_replace_transition.revision(), + document_replace_transition.base().id(), original_document, ); @@ -387,6 +458,12 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition DocumentReplaceTransitionAction::try_from_borrowed_document_replace_transition( document_replace_transition, original_document_created_at, + original_document_created_at_block_height, + original_document_created_at_core_block_height, + original_document_transferred_at, + original_document_transferred_at_block_height, + original_document_transferred_at_core_block_height, + block_info, |_identifier| Ok(data_contract_fetch_info.clone()), )?; @@ -397,11 +474,187 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition } } DocumentTransition::Delete(document_delete_transition) => { - let action = DocumentDeleteTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_delete_transition, |_identifier| { - Ok(data_contract_fetch_info.clone()) - })?; + let action = DocumentDeleteTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_delete_transition, |_identifier| { + Ok(data_contract_fetch_info.clone()) + })?; Ok(DocumentTransitionAction::DeleteAction(action).into()) } + DocumentTransition::Transfer(document_transfer_transition) => { + let mut result = ConsensusValidationResult::::new(); + + let validation_result = + Self::find_replaced_document_v0(transition, replaced_documents); + + if !validation_result.is_valid_with_data() { + result.merge(validation_result); + return Ok(result); + } + + let original_document = validation_result.into_data()?; + + let validation_result = Self::check_ownership_of_old_replaced_document_v0( + document_transfer_transition.base().id(), + original_document, + &owner_id, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + + if validate_against_state { + //there are situations where we don't want to validate this against the state + // for example when we already applied the state transition action + // and we are just validating it happened + let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( + document_transfer_transition.revision(), + document_transfer_transition.base().id(), + original_document, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + } + + let document_transfer_action = + DocumentTransferTransitionAction::try_from_borrowed_document_transfer_transition( + document_transfer_transition, + original_document.clone(), //todo: remove clone + block_info, + |_identifier| Ok(data_contract_fetch_info.clone()), + )?; + + if result.is_valid() { + Ok(DocumentTransitionAction::TransferAction(document_transfer_action).into()) + } else { + Ok(result) + } + } + DocumentTransition::UpdatePrice(document_update_price_transition) => { + let mut result = ConsensusValidationResult::::new(); + + let validation_result = + Self::find_replaced_document_v0(transition, replaced_documents); + + if !validation_result.is_valid_with_data() { + result.merge(validation_result); + return Ok(result); + } + + let original_document = validation_result.into_data()?; + + let validation_result = Self::check_ownership_of_old_replaced_document_v0( + document_update_price_transition.base().id(), + original_document, + &owner_id, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + + if validate_against_state { + //there are situations where we don't want to validate this against the state + // for example when we already applied the state transition action + // and we are just validating it happened + let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( + document_update_price_transition.revision(), + document_update_price_transition.base().id(), + original_document, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + } + + let document_update_price_action = + DocumentUpdatePriceTransitionAction::try_from_borrowed_document_update_price_transition( + document_update_price_transition, + original_document.clone(), //todo: find a way to not have to use cloning + block_info, + |_identifier| Ok(data_contract_fetch_info.clone()), + )?; + + if result.is_valid() { + Ok( + DocumentTransitionAction::UpdatePriceAction(document_update_price_action) + .into(), + ) + } else { + Ok(result) + } + } + DocumentTransition::Purchase(document_purchase_transition) => { + let mut result = ConsensusValidationResult::::new(); + + let validation_result = + Self::find_replaced_document_v0(transition, replaced_documents); + + if !validation_result.is_valid_with_data() { + result.merge(validation_result); + return Ok(result); + } + + let original_document = validation_result.into_data()?; + + let Some(listed_price) = original_document + .properties() + .get_optional_integer::(PRICE)? + else { + result.add_error(StateError::DocumentNotForSaleError( + DocumentNotForSaleError::new(original_document.id()), + )); + return Ok(result); + }; + + if listed_price != document_purchase_transition.price() { + result.add_error(StateError::DocumentIncorrectPurchasePriceError( + DocumentIncorrectPurchasePriceError::new( + original_document.id(), + document_purchase_transition.price(), + listed_price, + ), + )); + return Ok(result); + } + + if validate_against_state { + //there are situations where we don't want to validate this against the state + // for example when we already applied the state transition action + // and we are just validating it happened + let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( + document_purchase_transition.revision(), + document_purchase_transition.base().id(), + original_document, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + } + + let document_purchase_action = + DocumentPurchaseTransitionAction::try_from_borrowed_document_purchase_transition( + document_purchase_transition, + original_document.clone(), //todo: find a way to not have to use cloning + owner_id, + block_info, + |_identifier| Ok(data_contract_fetch_info.clone()), + )?; + + if result.is_valid() { + Ok(DocumentTransitionAction::PurchaseAction(document_purchase_action).into()) + } else { + Ok(result) + } + } } } @@ -425,7 +678,7 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition } fn check_ownership_of_old_replaced_document_v0( - document_transition: &DocumentReplaceTransition, + document_id: Identifier, fetched_document: &Document, owner_id: &Identifier, ) -> SimpleConsensusValidationResult { @@ -433,7 +686,7 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition if fetched_document.owner_id() != owner_id { result.add_error(ConsensusError::StateError( StateError::DocumentOwnerIdMismatchError(DocumentOwnerIdMismatchError::new( - document_transition.base().id(), + document_id, owner_id.to_owned(), fetched_document.owner_id(), )), @@ -442,33 +695,32 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition result } fn check_revision_is_bumped_by_one_during_replace_v0( - document_transition: &DocumentReplaceTransition, + transition_revision: Revision, + document_id: Identifier, original_document: &Document, ) -> SimpleConsensusValidationResult { let mut result = SimpleConsensusValidationResult::default(); - let revision = document_transition.revision(); - // If there was no previous revision this means that the document_type is not update-able // However this should have been caught earlier let Some(previous_revision) = original_document.revision() else { result.add_error(ConsensusError::StateError( StateError::InvalidDocumentRevisionError(InvalidDocumentRevisionError::new( - document_transition.base().id(), + document_id, None, - revision, + transition_revision, )), )); return result; }; // no need to check bounds here, because it would be impossible to hit the end on a u64 let expected_revision = previous_revision + 1; - if revision != expected_revision { + if transition_revision != expected_revision { result.add_error(ConsensusError::StateError( StateError::InvalidDocumentRevisionError(InvalidDocumentRevisionError::new( - document_transition.base().id(), + document_id, Some(previous_revision), - revision, + transition_revision, )), )) } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..10ccad492ba --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/v0/mod.rs @@ -0,0 +1,144 @@ +use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::execution::validation::state_transition::identity_create::identity_and_signatures::v0::IdentityCreateStateTransitionIdentityAndSignaturesValidationV0; +use dpp::consensus::basic::invalid_identifier_error::InvalidIdentifierError; +use dpp::consensus::basic::BasicError; +use dpp::consensus::ConsensusError; +use dpp::identity::state_transition::AssetLockProved; +use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; +use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use dpp::ProtocolError; +use drive::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; +use drive::state_transition_action::system::partially_use_asset_lock_action::PartiallyUseAssetLockAction; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionAdvancedStructureValidationV0 +{ + fn validate_advanced_structure_from_state_v0( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl IdentityCreateStateTransitionAdvancedStructureValidationV0 for IdentityCreateTransition { + fn validate_advanced_structure_from_state_v0( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // We should validate that the identity id is created from the asset lock proof + + // We don't need to return a consensus error here because the outpoint will already have been checked in the transformation into an action + let identifier_from_outpoint = self.asset_lock_proof().create_identifier()?; + + // Creating an identifier costs 1 block hash (64 bytes) + // The cost should come here after, as the protocol error is just if no outpoint exists + + execution_context.add_operation(ValidationOperation::DoubleSha256(1)); + + if identifier_from_outpoint != self.identity_id() { + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .identity_id_not_correct; + + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + // Most probably an attempted attack + let bump_action = StateTransitionAction::PartiallyUseAssetLockAction( + PartiallyUseAssetLockAction::from_borrowed_identity_create_transition_action( + action, + used_credits, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ConsensusError::BasicError( + BasicError::InvalidIdentifierError(InvalidIdentifierError::new( + "identity_id".to_string(), + "does not match created identifier from asset lock".to_string(), + )), + )], + )); + } + + let validation_result = + IdentityPublicKeyInCreation::validate_identity_public_keys_structure( + self.public_keys(), + true, + platform_version, + ) + .map_err(Error::Protocol)?; + + if !validation_result.is_valid() { + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .validation_of_added_keys_structure_failure; + + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + let bump_action = StateTransitionAction::PartiallyUseAssetLockAction( + PartiallyUseAssetLockAction::from_borrowed_identity_create_transition_action( + action, + used_credits, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); + } + + // Now we should validate proof of possession + let validation_result = self.validate_identity_create_state_transition_signatures_v0( + signable_bytes, + execution_context, + ); + + if !validation_result.is_valid() { + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .validation_of_added_keys_proof_of_possession_failure; + + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + let bump_action = StateTransitionAction::PartiallyUseAssetLockAction( + PartiallyUseAssetLockAction::from_borrowed_identity_create_transition_action( + action, + used_credits, + ), + ); + + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )) + } else { + Ok(ConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/v0/mod.rs new file mode 100644 index 00000000000..9ac16266842 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/v0/mod.rs @@ -0,0 +1,54 @@ +use crate::error::Error; +use dpp::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; +use dpp::consensus::state::state_error::StateError; +use dpp::identity::state_transition::AssetLockProved; +use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; +use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionBasicStructureValidationV0 +{ + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreateStateTransitionBasicStructureValidationV0 for IdentityCreateTransition { + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let result = self + .asset_lock_proof() + .validate_structure(platform_version)?; + + if !result.is_valid() { + return Ok(result); + } + + if self.public_keys().len() + > platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize + { + Ok(SimpleConsensusValidationResult::new_with_error( + StateError::MaxIdentityPublicKeyLimitReachedError( + MaxIdentityPublicKeyLimitReachedError::new( + platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize, + ), + ) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs index 4ab68979bac..5d09fedb7ee 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs @@ -1,11 +1,8 @@ -use crate::error::Error; -use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutputNotFoundError; -use dpp::consensus::basic::invalid_identifier_error::InvalidIdentifierError; -use dpp::consensus::basic::BasicError; -use dpp::consensus::ConsensusError; -use dpp::identity::state_transition::AssetLockProved; - -use dpp::prelude::ConsensusValidationResult; +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; use dpp::serialization::PlatformMessageSignable; use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; use dpp::state_transition::identity_create_transition::IdentityCreateTransition; @@ -16,58 +13,30 @@ pub(crate) trait IdentityCreateStateTransitionIdentityAndSignaturesValidationV0 fn validate_identity_create_state_transition_signatures_v0( &self, signable_bytes: Vec, - ) -> Result; + execution_context: &mut StateTransitionExecutionContext, + ) -> SimpleConsensusValidationResult; } impl IdentityCreateStateTransitionIdentityAndSignaturesValidationV0 for IdentityCreateTransition { fn validate_identity_create_state_transition_signatures_v0( &self, signable_bytes: Vec, - ) -> Result { - let mut validation_result = SimpleConsensusValidationResult::default(); + execution_context: &mut StateTransitionExecutionContext, + ) -> SimpleConsensusValidationResult { for key in self.public_keys().iter() { let result = signable_bytes.as_slice().verify_signature( key.key_type(), key.data().as_slice(), key.signature().as_slice(), - )?; + ); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(key.key_type()), + )); if !result.is_valid() { - validation_result.add_errors(result.errors); - } - } - - if !validation_result.is_valid() { - return Ok(validation_result); - } - - // We should validate that the identity id is created from the asset lock proof - - let identifier_from_outpoint = match self.asset_lock_proof().create_identifier() { - Ok(identifier) => identifier, - Err(_) => { - return Ok(ConsensusValidationResult::new_with_error( - ConsensusError::BasicError( - BasicError::IdentityAssetLockTransactionOutputNotFoundError( - IdentityAssetLockTransactionOutputNotFoundError::new( - self.asset_lock_proof().output_index() as usize, - ), - ), - ), - )) + return result; } - }; - - if identifier_from_outpoint != self.identity_id() { - return Ok(ConsensusValidationResult::new_with_error( - ConsensusError::BasicError(BasicError::InvalidIdentifierError( - InvalidIdentifierError::new( - "identity_id".to_string(), - "does not match created identifier from asset lock".to_string(), - ), - )), - )); } - Ok(validation_result) + SimpleConsensusValidationResult::new() } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs index ad40672612a..1e0d8bf4b00 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs @@ -1,18 +1,16 @@ +mod advanced_structure; +mod basic_structure; pub(crate) mod identity_and_signatures; mod state; -mod structure; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::identity_create::basic_structure::v0::IdentityCreateStateTransitionBasicStructureValidationV0; use crate::execution::validation::state_transition::identity_create::state::v0::IdentityCreateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::identity_create::structure::v0::IdentityCreateStateTransitionStructureValidationV0; -use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, -}; -use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::execution::validation::state_transition::processor::v0::StateTransitionBasicStructureValidationV0; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; @@ -22,15 +20,35 @@ use dpp::state_transition::identity_create_transition::IdentityCreateTransition; use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_create::advanced_structure::v0::IdentityCreateStateTransitionAdvancedStructureValidationV0; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use drive::grovedb::TransactionArg; +use drive::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; use drive::state_transition_action::StateTransitionAction; -impl StateTransitionActionTransformerV0 for IdentityCreateTransition { - fn transform_into_action( +/// A trait for transforming into an action for the identity create transition +pub trait StateTransitionActionTransformerForIdentityCreateTransitionV0 { + /// Transforming into the action + fn transform_into_action_for_identity_create_transition( &self, platform: &PlatformRef, - _validate: bool, - _tx: TransactionArg, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error>; +} + +impl StateTransitionActionTransformerForIdentityCreateTransitionV0 for IdentityCreateTransition { + fn transform_into_action_for_identity_create_transition( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, ) -> Result, Error> { let platform_version = platform.state.current_platform_version()?; match platform_version @@ -40,7 +58,14 @@ impl StateTransitionActionTransformerV0 for IdentityCreateTransition { .identity_create_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(platform, platform_version), + 0 => self.transform_into_action_v0( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "identity create transition: transform_into_action".to_string(), known_versions: vec![0], @@ -50,36 +75,103 @@ impl StateTransitionActionTransformerV0 for IdentityCreateTransition { } } -impl StateTransitionStructureValidationV0 for IdentityCreateTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityCreateTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_create_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity create transition: validate_structure".to_string(), + Some(0) => { + // There is nothing expensive to add as validation methods to the execution context + self.validate_basic_structure_v0(platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity create transition: validate_basic_structure".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity create transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), + } + } +} + +/// A trait for advanced structure validation after transforming into an action +pub trait StateTransitionStructureKnownInStateValidationForIdentityCreateTransitionV0 { + /// Validation of the advanced structure + fn validate_advanced_structure_from_state_for_identity_create_transition( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl StateTransitionStructureKnownInStateValidationForIdentityCreateTransitionV0 + for IdentityCreateTransition +{ + fn validate_advanced_structure_from_state_for_identity_create_transition( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_create_state_transition + .advanced_structure + { + Some(0) => self.validate_advanced_structure_from_state_v0( + action, + signable_bytes, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity create transition: validate_advanced_structure_from_state" + .to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity create transition: validate_advanced_structure_from_state" + .to_string(), + known_versions: vec![0], + })), } } } -impl StateTransitionStateValidationV0 for IdentityCreateTransition { - fn validate_state( +/// A trait for state validation for the identity create transition +pub trait StateTransitionStateValidationForIdentityCreateTransitionV0 { + /// Validate state + fn validate_state_for_identity_create_transition( &self, - _action: Option, + action: IdentityCreateTransitionAction, platform: &PlatformRef, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error>; +} + +impl StateTransitionStateValidationForIdentityCreateTransitionV0 for IdentityCreateTransition { + fn validate_state_for_identity_create_transition( + &self, + action: IdentityCreateTransitionAction, + platform: &PlatformRef, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { let platform_version = platform.state.current_platform_version()?; @@ -90,7 +182,7 @@ impl StateTransitionStateValidationV0 for IdentityCreateTransition { .identity_create_state_transition .state { - 0 => self.validate_state_v0(platform, tx, platform_version), + 0 => self.validate_state_v0(platform, action, execution_context, tx, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "identity create transition: validate_state".to_string(), known_versions: vec![0], @@ -99,3 +191,1065 @@ impl StateTransitionStateValidationV0 for IdentityCreateTransition { } } } + +#[cfg(test)] +mod tests { + use crate::config::{PlatformConfig, PlatformTestConfig}; + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::block::block_info::BlockInfo; + use dpp::dashcore::{Network, PrivateKey}; + use dpp::identity::accessors::{IdentityGettersV0, IdentitySettersV0}; + use dpp::identity::KeyType::ECDSA_SECP256K1; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0}; + use dpp::native_bls::NativeBlsModule; + use dpp::prelude::Identifier; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; + use dpp::state_transition::identity_create_transition::IdentityCreateTransition; + use dpp::state_transition::StateTransition; + use dpp::tests::fixtures::instant_asset_lock_proof_fixture; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + use simple_signer::signer::SimpleSigner; + use std::collections::BTreeMap; + + #[test] + fn test_identity_create_validation() { + let platform_version = PlatformVersion::latest(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1871240); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance(identity.id().into_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 99913915760); + } + + #[test] + fn test_identity_create_asset_lock_reuse_after_issue() { + let platform_version = PlatformVersion::latest(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let mut identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 80700 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // Okay now let us try to reuse the asset lock + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + // let's set the new key to the identity (replacing the one that was causing the issue + identity.set_public_keys(BTreeMap::from([ + (0, master_key.clone()), + (1, new_public_key.clone()), + ])); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2146900); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance(identity.id().into_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 99909310400); // The identity balance is smaller than if there hadn't been any issue + } + + #[test] + fn test_identity_create_asset_lock_reuse_after_max_issues() { + let platform_version = PlatformVersion::latest(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + for i in 0..16 { + let (new_master_key, new_master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58 + i), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_master_key.clone(), new_master_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, new_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 80700 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + // Okay now let us try to reuse the asset lock, there should be no balance + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, new_public_key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + #[test] + fn test_identity_create_asset_lock_use_all_funds() { + let platform_version = PlatformVersion::latest(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + Some(220000), + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + // this should work for 2 times only + for i in 0..2 { + let (new_master_key, new_master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58 + i), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_master_key.clone(), new_master_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, new_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 13800 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + // Okay now let us try to reuse the asset lock, there should be no balance + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, new_public_key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + #[test] + fn test_identity_create_asset_lock_replay_attack() { + let platform_version = PlatformVersion::latest(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let mut identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 80700 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // let's try to replay the bad transaction + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + + // Okay now let us try to reuse the asset lock + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + // let's set the new key to the identity (replacing the one that was causing the issue + identity.set_public_keys(BTreeMap::from([ + (0, master_key.clone()), + (1, new_public_key.clone()), + ])); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2146900); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance(identity.id().into_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 99909310400); // The identity balance is smaller than if there hadn't been any issue + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs index d4ce9661856..bea657b54eb 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs @@ -1,43 +1,61 @@ use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; +use dpp::balances::credits::CREDITS_PER_DUFF; +use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointNotEnoughBalanceError; use dpp::consensus::signature::{BasicECDSAError, SignatureError}; use dpp::consensus::state::identity::IdentityAlreadyExistsError; -use dpp::dashcore::signer; -use dpp::dashcore::signer::double_sha; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::{signer, ScriptBuf, Txid}; +use dpp::identity::KeyType; use dpp::identity::state_transition::AssetLockProved; use dpp::prelude::ConsensusValidationResult; -use dpp::serialization::Signable; use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; +use dpp::ProtocolError; + use dpp::state_transition::identity_create_transition::IdentityCreateTransition; -use dpp::state_transition::{StateTransition, StateTransitionLike}; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::state_transition::StateTransitionLike; use dpp::version::PlatformVersion; use drive::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; use drive::state_transition_action::StateTransitionAction; -use drive::grovedb::TransactionArg; -use dpp::version::DefaultForPlatformVersion; use crate::error::execution::ExecutionError; -use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::execution_operation::{ValidationOperation, SHA256_BLOCK_SIZE}; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::system::partially_use_asset_lock_action::PartiallyUseAssetLockAction; + use crate::execution::validation::state_transition::common::asset_lock::transaction::fetch_asset_lock_transaction_output_sync::fetch_asset_lock_transaction_output_sync; -use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_in_state; +use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_not_in_state; +use crate::execution::validation::state_transition::ValidationMode; pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionStateValidationV0 { fn validate_state_v0( &self, platform: &PlatformRef, - tx: TransactionArg, + action: IdentityCreateTransitionAction, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; fn transform_into_action_v0( &self, platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; } @@ -46,108 +64,207 @@ impl IdentityCreateStateTransitionStateValidationV0 for IdentityCreateTransition fn validate_state_v0( &self, platform: &PlatformRef, - tx: TransactionArg, + action: IdentityCreateTransitionAction, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { let drive = platform.drive; - let mut state_transition_execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version)?; - let mut validation_result = ConsensusValidationResult::::default(); let identity_id = self.identity_id(); let balance = - drive.fetch_identity_balance(identity_id.to_buffer(), tx, platform_version)?; + drive.fetch_identity_balance(identity_id.to_buffer(), transaction, platform_version)?; // Balance is here to check if the identity does already exist if balance.is_some() { + // Since the id comes from the state transition this should never be reachable return Ok(ConsensusValidationResult::new_with_error( IdentityAlreadyExistsError::new(identity_id.to_owned()).into(), )); } - // Validate asset lock proof state - validation_result.merge(self.asset_lock_proof().validate_state( - platform, - tx, - platform_version, - )?); - - if !validation_result.is_valid() { - return Ok(validation_result); - } - // Now we should check the state of added keys to make sure there aren't any that already exist - validation_result.add_errors( - validate_unique_identity_public_key_hashes_in_state( + let unique_public_key_validation_result = + validate_unique_identity_public_key_hashes_not_in_state( self.public_keys(), drive, - &mut state_transition_execution_context, - tx, + execution_context, + transaction, platform_version, - )? - .errors, - ); + )?; - if !validation_result.is_valid() { - return Ok(validation_result); - } + if unique_public_key_validation_result.is_valid() { + // We just pass the action that was given to us + Ok(ConsensusValidationResult::new_with_data( + StateTransitionAction::IdentityCreateAction(action), + )) + } else { + // It's not valid, we need to give back the action that partially uses the asset lock + + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .unique_key_already_present; - self.transform_into_action_v0(platform, platform_version) + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + let bump_action = PartiallyUseAssetLockAction::from_identity_create_transition_action( + action, + used_credits, + ); + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action.into(), + unique_public_key_validation_result.errors, + )) + } } fn transform_into_action_v0( &self, platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - let mut validation_result = ConsensusValidationResult::::default(); + // Todo: we might want a lowered required balance + let required_balance = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_create + * CREDITS_PER_DUFF; - let tx_out_validation = fetch_asset_lock_transaction_output_sync( - platform.core_rpc, - self.asset_lock_proof(), - platform_version, - )?; + let signable_bytes_len = signable_bytes.len(); - if !tx_out_validation.is_valid() { + let mut signable_bytes_hasher = SignableBytesHasher::Bytes(signable_bytes); + // Validate asset lock proof state + // The required balance is in credits because we verify the asset lock value (which is in credits) + let asset_lock_proof_validation = if validation_mode != ValidationMode::NoValidation { + self.asset_lock_proof().validate( + platform, + &mut signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + )? + } else { + ConsensusValidationResult::new() + }; + + if !asset_lock_proof_validation.is_valid() { return Ok(ConsensusValidationResult::new_with_errors( - tx_out_validation.errors, + asset_lock_proof_validation.errors, )); } - let tx_out = tx_out_validation.into_data()?; + let mut needs_signature_verification = true; + + let asset_lock_value_to_be_consumed = if asset_lock_proof_validation.has_data() { + let asset_lock_value = asset_lock_proof_validation.into_data()?; + + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + asset_lock_value + } else { + let tx_out_validation = fetch_asset_lock_transaction_output_sync( + platform.core_rpc, + self.asset_lock_proof(), + platform_version, + )?; + + if !tx_out_validation.is_valid() { + return Ok(ConsensusValidationResult::new_with_errors( + tx_out_validation.errors, + )); + } - // Verify one time signature + let tx_out = tx_out_validation.into_data()?; - let singable_bytes = StateTransition::IdentityCreate(self.clone()).signable_bytes()?; + let min_value = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_create; + if tx_out.value < min_value { + return Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError::new( + self.asset_lock_proof() + .out_point() + .map(|outpoint| outpoint.txid) + .unwrap_or(Txid::all_zeros()), + self.asset_lock_proof().output_index() as usize, + tx_out.value, + tx_out.value, + min_value, + ) + .into(), + )); + } - let public_key_hash = tx_out - .script_pubkey - .p2pkh_public_key_hash_bytes() - .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "output must be a valid p2pkh already", - )) - })?; + // Verify one time signature - if let Err(e) = signer::verify_hash_signature( - &double_sha(singable_bytes), - self.signature().as_slice(), - public_key_hash, - ) { - return Ok(ConsensusValidationResult::new_with_error( - SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + + let initial_balance_amount = tx_out.value * CREDITS_PER_DUFF; + AssetLockValue::new( + initial_balance_amount, + tx_out.script_pubkey.0, + initial_balance_amount, + vec![], + platform_version, + )? + }; + + if needs_signature_verification { + let tx_out_script_pubkey = + ScriptBuf(asset_lock_value_to_be_consumed.tx_out_script().clone()); + + // Verify one time signature + + let public_key_hash = tx_out_script_pubkey + .p2pkh_public_key_hash_bytes() + .ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCachedState( + "the script inside the state must be a p2pkh".to_string(), + )) + })?; + + let block_count = signable_bytes_len as u16 / SHA256_BLOCK_SIZE; + + execution_context.add_operation(ValidationOperation::DoubleSha256(block_count)); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(KeyType::ECDSA_HASH160), )); - } - match IdentityCreateTransitionAction::try_from_borrowed(self, tx_out.value * 1000) { - Ok(action) => { - validation_result.set_data(action.into()); - } - Err(error) => { - validation_result.add_error(error); + if let Err(e) = signer::verify_hash_signature( + &signable_bytes_hasher.hash_bytes().as_slice(), + self.signature().as_slice(), + public_key_hash, + ) { + return Ok(ConsensusValidationResult::new_with_error( + SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), + )); } } - Ok(validation_result) + match IdentityCreateTransitionAction::try_from_borrowed( + self, + signable_bytes_hasher, + asset_lock_value_to_be_consumed, + ) { + Ok(action) => Ok(ConsensusValidationResult::new_with_data(action.into())), + Err(error) => Ok(ConsensusValidationResult::new_with_error(error)), + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/v0/mod.rs deleted file mode 100644 index 502f1c6d3a6..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/v0/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::error::Error; -use dpp::identity::state_transition::AssetLockProved; -use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; -use dpp::state_transition::identity_create_transition::IdentityCreateTransition; -use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; - -pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionStructureValidationV0 -{ - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl IdentityCreateStateTransitionStructureValidationV0 for IdentityCreateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - let result = self - .asset_lock_proof() - .validate_structure(platform_version)?; - - if !result.is_valid() { - return Ok(result); - } - - IdentityPublicKeyInCreation::validate_identity_public_keys_structure( - self.public_keys(), - platform_version, - ) - .map_err(Error::Protocol) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/mod.rs new file mode 100644 index 00000000000..fe390272c18 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/mod.rs @@ -0,0 +1,38 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::identity_credit_transfer::balance::v0::IdentityCreditTransferTransitionBalanceValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionIdentityBalanceValidationV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(crate) mod v0; +impl StateTransitionIdentityBalanceValidationV0 for IdentityCreditTransferTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_transfer_state_transition + .advanced_minimum_balance_pre_check + { + Some(0) => { + self.validate_advanced_minimum_balance_pre_check_v0(identity, platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit transfer transition: validate_balance".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit transfer transition: validate_balance".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/v0/mod.rs new file mode 100644 index 00000000000..6ea45ee35e2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/v0/mod.rs @@ -0,0 +1,43 @@ +use crate::error::Error; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::error::execution::ExecutionError; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditTransferTransitionBalanceValidationV0 +{ + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditTransferTransitionBalanceValidationV0 for IdentityCreditTransferTransition { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for credit transfer transition", + )))?; + + if balance < self.amount().checked_add(platform_version.fee_version.state_transition_min_fees.credit_transfer).ok_or(Error::Execution(ExecutionError::Overflow("overflow when adding amount and min_leftover_credits_before_processing in identity credit transfer")))? { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(self.identity_id(), balance, self.amount()) + .into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs index 797eef6760c..a21e4049654 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs @@ -1,6 +1,9 @@ +mod balance; +mod nonce; mod state; mod structure; +use dpp::block::block_info::BlockInfo; use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -10,26 +13,30 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; use crate::execution::validation::state_transition::identity_credit_transfer::state::v0::IdentityCreditTransferStateTransitionStateValidationV0; use crate::execution::validation::state_transition::identity_credit_transfer::structure::v0::IdentityCreditTransferStateTransitionStructureValidationV0; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; impl StateTransitionActionTransformerV0 for IdentityCreditTransferTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + _validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -47,27 +54,31 @@ impl StateTransitionActionTransformerV0 for IdentityCreditTransferTransition { } } -impl StateTransitionStructureValidationV0 for IdentityCreditTransferTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityCreditTransferTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_credit_transfer_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity credit transfer transition: validate_structure".to_string(), + Some(0) => { + // There is nothing expensive here + self.validate_basic_structure_v0() + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit transfer transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit transfer transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } } @@ -77,10 +88,13 @@ impl StateTransitionStateValidationV0 for IdentityCreditTransferTransition { &self, _action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/mod.rs new file mode 100644 index 00000000000..b6a24435f92 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_credit_transfer::nonce::v0::IdentityCreditTransferTransitionIdentityNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for IdentityCreditTransferTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_transfer_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit transfer transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit transfer transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/v0/mod.rs new file mode 100644 index 00000000000..290f8a33179 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditTransferTransitionIdentityNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditTransferTransitionIdentityNonceV0 for IdentityCreditTransferTransition { + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.identity_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs index 9a0951d43aa..2d19799dccd 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs @@ -8,16 +8,16 @@ use dpp::state_transition::identity_credit_transfer_transition::accessors::Ident use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use dpp::validation::SimpleConsensusValidationResult; -const MIN_TRANSFER_AMOUNT: u64 = 1000; +const MIN_TRANSFER_AMOUNT: u64 = 100000; pub(in crate::execution::validation::state_transition::state_transitions::identity_credit_transfer) trait IdentityCreditTransferStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self) -> Result; + fn validate_basic_structure_v0(&self) -> Result; } impl IdentityCreditTransferStateTransitionStructureValidationV0 for IdentityCreditTransferTransition { - fn validate_base_structure_v0(&self) -> Result { + fn validate_basic_structure_v0(&self) -> Result { let result = SimpleConsensusValidationResult::new(); if self.identity_id() == self.recipient_id() { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/mod.rs new file mode 100644 index 00000000000..edbfa3f1a6a --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/mod.rs @@ -0,0 +1,38 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::identity_credit_withdrawal::balance::v0::IdentityCreditTransferTransitionBalanceValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionIdentityBalanceValidationV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(crate) mod v0; +impl StateTransitionIdentityBalanceValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_withdrawal_state_transition + .advanced_minimum_balance_pre_check + { + Some(0) => { + self.validate_advanced_minimum_balance_pre_check_v0(identity, platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit withdrawal transition: validate_balance".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit withdrawal transition: validate_balance".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/v0/mod.rs new file mode 100644 index 00000000000..0c1b879b0f9 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/v0/mod.rs @@ -0,0 +1,42 @@ +use crate::error::Error; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; + +use crate::error::execution::ExecutionError; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditTransferTransitionBalanceValidationV0 +{ + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditTransferTransitionBalanceValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for credit withdrawal transition", + )))?; + + if balance < self.amount().checked_add(platform_version.fee_version.state_transition_min_fees.credit_withdrawal).ok_or(Error::Execution(ExecutionError::Overflow("overflow when adding amount and min_leftover_credits_before_processing in identity credit withdrawal")))? { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(self.identity_id(), balance, self.amount()) + .into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs index 7b91a82a282..8e5f5155f28 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs @@ -1,6 +1,9 @@ +mod balance; +mod nonce; mod state; mod structure; +use dpp::block::block_info::BlockInfo; use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -10,27 +13,31 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; use crate::execution::validation::state_transition::identity_credit_withdrawal::state::v0::IdentityCreditWithdrawalStateTransitionStateValidationV0; use crate::execution::validation::state_transition::identity_credit_withdrawal::structure::v0::IdentityCreditWithdrawalStateTransitionStructureValidationV0; - +use crate::execution::validation::state_transition::identity_credit_withdrawal::structure::v1::IdentityCreditWithdrawalStateTransitionStructureValidationV1; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; impl StateTransitionActionTransformerV0 for IdentityCreditWithdrawalTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + _validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -48,27 +55,34 @@ impl StateTransitionActionTransformerV0 for IdentityCreditWithdrawalTransition { } } -impl StateTransitionStructureValidationV0 for IdentityCreditWithdrawalTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_credit_withdrawal_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity credit withdrawal transition: validate_structure".to_string(), + Some(0) => { + // Returns not supported + self.validate_basic_structure_v0(platform_version) + } + Some(1) => self.validate_basic_structure_v1(), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit withdrawal transition: validate_basic_structure" + .to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit withdrawal transition: validate_basic_structure" + .to_string(), + known_versions: vec![0], + })), } } } @@ -78,10 +92,13 @@ impl StateTransitionStateValidationV0 for IdentityCreditWithdrawalTransition { &self, _action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -98,3 +115,98 @@ impl StateTransitionStateValidationV0 for IdentityCreditWithdrawalTransition { } } } + +#[cfg(test)] +mod tests { + use crate::config::{PlatformConfig, PlatformTestConfig}; + use crate::execution::validation::state_transition::tests::setup_identity_with_withdrawal_key_and_system_credits; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; + use crate::test::helpers::fast_forward_to_block::fast_forward_to_block; + use crate::test::helpers::setup::TestPlatformBuilder; + use assert_matches::assert_matches; + use dpp::block::block_info::BlockInfo; + use dpp::consensus::basic::BasicError; + use dpp::consensus::ConsensusError; + use dpp::dash_to_credits; + use dpp::identity::core_script::CoreScript; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::identity_credit_withdrawal_transition::methods::IdentityCreditWithdrawalTransitionMethodsV0; + use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; + use dpp::withdrawal::Pooling; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::{Rng, SeedableRng}; + + #[test] + fn test_identity_credit_withdrawal_is_disabled_on_release() { + let platform_version = PlatformVersion::first(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let mut rng = StdRng::seed_from_u64(567); + + let mut platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_initial_state_structure(); + + fast_forward_to_block(&platform, 1_200_000_000, 900, 42, 1, false); //next epoch + + let (identity, signer, _, withdrawal_key) = + setup_identity_with_withdrawal_key_and_system_credits( + &mut platform, + rng.gen(), + dash_to_credits!(0.5), + ); + + let platform_state = platform.state.load(); + + let withdrawal_amount = dash_to_credits!(0.1); + + let credit_withdrawal_transition = IdentityCreditWithdrawalTransition::try_from_identity( + &identity, + Some(&withdrawal_key), + CoreScript::random_p2pkh(&mut rng), + withdrawal_amount, + Pooling::Never, + 1, + 0, + signer, + 2, + platform_version, + None, + ) + .expect("expected a credit withdrawal transition"); + + let credit_withdrawal_transition_serialized_transition = credit_withdrawal_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![credit_withdrawal_transition_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::UnpaidConsensusError( + ConsensusError::BasicError(BasicError::UnsupportedFeatureError(_)) + )] + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/mod.rs new file mode 100644 index 00000000000..8676f0eb75e --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_credit_withdrawal::nonce::v0::IdentityCreditWithdrawalTransitionIdentityContractNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_withdrawal_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit withdrawal transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit withdrawal transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/v0/mod.rs new file mode 100644 index 00000000000..f99d11d9a80 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/v0/mod.rs @@ -0,0 +1,73 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditWithdrawalTransitionIdentityContractNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditWithdrawalTransitionIdentityContractNonceV0 + for IdentityCreditWithdrawalTransition +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.identity_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs index 335bec12a72..cecf5edb3d6 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs @@ -5,9 +5,7 @@ use crate::rpc::core::CoreRPCLike; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use dpp::consensus::signature::IdentityNotFoundError; -use dpp::consensus::state::identity::invalid_identity_revision_error::InvalidIdentityRevisionError; use dpp::consensus::state::identity::IdentityInsufficientBalanceError; -use dpp::consensus::state::state_error::StateError; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; @@ -61,29 +59,6 @@ impl IdentityCreditWithdrawalStateTransitionStateValidationV0 )); } - let Some(revision) = platform.drive.fetch_identity_revision( - self.identity_id().to_buffer(), - true, - tx, - platform_version, - )? - else { - return Ok(ConsensusValidationResult::new_with_error( - IdentityNotFoundError::new(self.identity_id()).into(), - )); - }; - - // Check revision - if revision + 1 != self.revision() { - return Ok(ConsensusValidationResult::new_with_error( - StateError::InvalidIdentityRevisionError(InvalidIdentityRevisionError::new( - self.identity_id(), - revision, - )) - .into(), - )); - } - self.transform_into_action_v0(platform) } @@ -91,11 +66,13 @@ impl IdentityCreditWithdrawalStateTransitionStateValidationV0 &self, platform: &PlatformRef, ) -> Result, Error> { - let last_block_time = platform.state.last_block_time_ms().ok_or(Error::Execution( - ExecutionError::StateNotInitialized( - "expected a last platform block during identity update validation", - ), - ))?; + let last_block_time = + platform + .state + .last_committed_block_time_ms() + .ok_or(Error::Execution(ExecutionError::StateNotInitialized( + "expected a last platform block during identity update validation", + )))?; Ok(ConsensusValidationResult::new_with_data( IdentityCreditWithdrawalTransitionAction::from_identity_credit_withdrawal( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/mod.rs index 9a1925de7fc..008be12cc67 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/mod.rs @@ -1 +1,2 @@ pub(crate) mod v0; +pub(crate) mod v1; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs index d50df91f7c7..d69627cf842 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs @@ -1,70 +1,30 @@ -use dpp::consensus::basic::identity::{ - InvalidIdentityCreditWithdrawalTransitionAmountError, - InvalidIdentityCreditWithdrawalTransitionCoreFeeError, - InvalidIdentityCreditWithdrawalTransitionOutputScriptError, - NotImplementedIdentityCreditWithdrawalTransitionPoolingError, -}; -use dpp::consensus::ConsensusError; - use crate::error::Error; -use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::consensus::basic::{BasicError, UnsupportedFeatureError}; +use dpp::consensus::ConsensusError; use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; -use dpp::util::is_fibonacci_number::is_fibonacci_number; use dpp::validation::SimpleConsensusValidationResult; -use dpp::withdrawal::Pooling; - -const MIN_WITHDRAWAL_AMOUNT: u64 = 1000; +use dpp::version::PlatformVersion; pub(in crate::execution::validation::state_transition::state_transitions::identity_credit_withdrawal) trait IdentityCreditWithdrawalStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self) -> Result; + fn validate_basic_structure_v0(&self, platform_version: &PlatformVersion) -> Result; } impl IdentityCreditWithdrawalStateTransitionStructureValidationV0 for IdentityCreditWithdrawalTransition { - fn validate_base_structure_v0(&self) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - if self.amount() < MIN_WITHDRAWAL_AMOUNT { - result.add_error(ConsensusError::from( - InvalidIdentityCreditWithdrawalTransitionAmountError::new( - self.amount(), - MIN_WITHDRAWAL_AMOUNT, - ), - )); - } - - // currently we do not support pooling, so we must validate that pooling is `Never` - - if self.pooling() != Pooling::Never { - result.add_error( - NotImplementedIdentityCreditWithdrawalTransitionPoolingError::new( - self.pooling() as u8 - ), - ); - - return Ok(result); - } - - // validate core_fee is in fibonacci sequence - - if !is_fibonacci_number(self.core_fee_per_byte()) { - result.add_error(InvalidIdentityCreditWithdrawalTransitionCoreFeeError::new( - self.core_fee_per_byte(), - )); - - return Ok(result); - } - - // validate output_script types - if !self.output_script().is_p2pkh() && !self.output_script().is_p2sh() { - result.add_error( - InvalidIdentityCreditWithdrawalTransitionOutputScriptError::new( - self.output_script().clone(), - ), - ); - } - - Ok(result) + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + // This is basically disabled, return that it is not enabled + + let error = SimpleConsensusValidationResult::new_with_error(ConsensusError::BasicError( + BasicError::UnsupportedFeatureError(UnsupportedFeatureError::new( + "identity credit withdrawals".to_string(), + platform_version.protocol_version, + )), + )); + + Ok(error) } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v1/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v1/mod.rs new file mode 100644 index 00000000000..b89b35655c9 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v1/mod.rs @@ -0,0 +1,71 @@ +use dpp::consensus::basic::identity::{ + InvalidIdentityCreditWithdrawalTransitionAmountError, + InvalidIdentityCreditWithdrawalTransitionCoreFeeError, + InvalidIdentityCreditWithdrawalTransitionOutputScriptError, + NotImplementedIdentityCreditWithdrawalTransitionPoolingError, +}; +use dpp::consensus::ConsensusError; + +use crate::error::Error; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::v0::{ + MIN_CORE_FEE_PER_BYTE, MIN_WITHDRAWAL_AMOUNT, +}; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::util::is_fibonacci_number::is_fibonacci_number; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::withdrawal::Pooling; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_credit_withdrawal) trait IdentityCreditWithdrawalStateTransitionStructureValidationV1 { + fn validate_basic_structure_v1(&self) -> Result; +} + +impl IdentityCreditWithdrawalStateTransitionStructureValidationV1 + for IdentityCreditWithdrawalTransition +{ + fn validate_basic_structure_v1(&self) -> Result { + let mut result = SimpleConsensusValidationResult::default(); + + if self.amount() < MIN_WITHDRAWAL_AMOUNT { + result.add_error(ConsensusError::from( + InvalidIdentityCreditWithdrawalTransitionAmountError::new( + self.amount(), + MIN_WITHDRAWAL_AMOUNT, + ), + )); + } + + // currently we do not support pooling, so we must validate that pooling is `Never` + + if self.pooling() != Pooling::Never { + result.add_error( + NotImplementedIdentityCreditWithdrawalTransitionPoolingError::new( + self.pooling() as u8 + ), + ); + + return Ok(result); + } + + // validate core_fee is in fibonacci sequence + if !is_fibonacci_number(self.core_fee_per_byte() as u64) { + result.add_error(InvalidIdentityCreditWithdrawalTransitionCoreFeeError::new( + self.core_fee_per_byte(), + MIN_CORE_FEE_PER_BYTE, + )); + + return Ok(result); + } + + // validate output_script types + if !self.output_script().is_p2pkh() && !self.output_script().is_p2sh() { + result.add_error( + InvalidIdentityCreditWithdrawalTransitionOutputScriptError::new( + self.output_script().clone(), + ), + ); + } + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs index 6c90b2a9cbd..2b49d301aa7 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs @@ -8,6 +8,10 @@ use dpp::state_transition::identity_topup_transition::accessors::IdentityTopUpTr use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; use dpp::version::PlatformVersion; +use crate::execution::types::execution_operation::{RetrieveIdentityInfo, ValidationOperation}; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; use drive::drive::Drive; use drive::grovedb::TransactionArg; @@ -17,6 +21,7 @@ pub(in crate::execution::validation::state_transition) trait IdentityTopUpStateT &self, drive: &Drive, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error>; } @@ -26,10 +31,15 @@ impl IdentityTopUpStateTransitionIdentityRetrievalV0 for IdentityTopUpTransition &self, drive: &Drive, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error> { let mut validation_result = ConsensusValidationResult::::default(); + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::only_balance(), + )); + let maybe_partial_identity = drive.fetch_identity_with_balance( self.identity_id().to_buffer(), tx, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs index f5969bea524..e3fe3482073 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs @@ -1,8 +1,6 @@ pub(crate) mod identity_retrieval; -mod state; mod structure; - -use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +mod transform_into_action; use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -12,28 +10,42 @@ use drive::state_transition_action::StateTransitionAction; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; -use crate::execution::validation::state_transition::identity_top_up::state::v0::IdentityTopUpStateTransitionStateValidationV0; use crate::execution::validation::state_transition::identity_top_up::structure::v0::IdentityTopUpStateTransitionStructureValidationV0; -use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, -}; +use crate::execution::validation::state_transition::identity_top_up::transform_into_action::v0::IdentityTopUpStateTransitionStateValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionBasicStructureValidationV0; -use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -impl StateTransitionActionTransformerV0 for IdentityTopUpTransition { - fn transform_into_action( +/// A trait to transform into a top up action +pub trait StateTransitionIdentityTopUpTransitionActionTransformer { + /// Transform into a top up action + fn transform_into_action_for_identity_top_up_transition( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error>; +} + +impl StateTransitionIdentityTopUpTransitionActionTransformer for IdentityTopUpTransition { + fn transform_into_action_for_identity_top_up_transition( &self, platform: &PlatformRef, - _validate: bool, - _tx: TransactionArg, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -41,9 +53,16 @@ impl StateTransitionActionTransformerV0 for IdentityTopUpTransition { .identity_top_up_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(platform, platform_version), + 0 => self.transform_into_action_v0( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: transform_into_action".to_string(), + method: "identity top up transition: transform_top_up_into_action".to_string(), known_versions: vec![0], received: version, })), @@ -51,53 +70,183 @@ impl StateTransitionActionTransformerV0 for IdentityTopUpTransition { } } -impl StateTransitionStructureValidationV0 for IdentityTopUpTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityTopUpTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_top_up_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: validate_structure".to_string(), + Some(0) => { + // There is nothing expensive here, so need to ask users to pay for anything + self.validate_basic_structure_v0(platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity top up transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity top up transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } } -impl StateTransitionStateValidationV0 for IdentityTopUpTransition { - fn validate_state( - &self, - _action: Option, - platform: &PlatformRef, - tx: TransactionArg, - ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .identity_top_up_state_transition - .state - { - 0 => self.validate_state_v0(platform, tx, platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: validate_state".to_string(), - known_versions: vec![0], - received: version, - })), +#[cfg(test)] +mod tests { + use crate::config::{PlatformConfig, PlatformTestConfig}; + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::block::block_info::BlockInfo; + use dpp::dashcore::{Network, PrivateKey}; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::KeyType::ECDSA_SECP256K1; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0}; + use dpp::prelude::Identifier; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::identity_topup_transition::methods::IdentityTopUpTransitionMethodsV0; + use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; + use dpp::state_transition::StateTransition; + use dpp::tests::fixtures::instant_asset_lock_proof_fixture; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + use simple_signer::signer::SimpleSigner; + use std::collections::BTreeMap; + + #[test] + fn test_identity_top_up_validation() { + let platform_version = PlatformVersion::latest(); + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + ]), + balance: 50000000000, + revision: 0, } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identity_top_up_transition: StateTransition = + IdentityTopUpTransition::try_from_identity( + &identity_already_in_system, + asset_lock_proof, + pk.as_slice(), + 0, + platform_version, + None, + ) + .expect("expected an identity create transition"); + + let identity_top_up_serialized_transition = identity_top_up_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_top_up_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 540580); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance( + identity_already_in_system.id().into_buffer(), + None, + platform_version, + ) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 149993654420); // about 0.5 Dash starting balance + 1 Dash asset lock top up } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/v0/mod.rs deleted file mode 100644 index 1e4c2886a44..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/v0/mod.rs +++ /dev/null @@ -1,117 +0,0 @@ -use crate::error::Error; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; - -use dpp::consensus::signature::{BasicECDSAError, SignatureError}; -use dpp::dashcore::signer; -use dpp::dashcore::signer::double_sha; -use dpp::identity::state_transition::AssetLockProved; - -use dpp::prelude::ConsensusValidationResult; -use dpp::serialization::Signable; -use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; -use dpp::state_transition::{StateTransition, StateTransitionLike}; - -use dpp::version::PlatformVersion; -use drive::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; -use drive::state_transition_action::StateTransitionAction; - -use drive::grovedb::TransactionArg; -use crate::error::execution::ExecutionError; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; -use crate::execution::validation::state_transition::common::asset_lock::transaction::fetch_asset_lock_transaction_output_sync::fetch_asset_lock_transaction_output_sync; - -pub(in crate::execution::validation::state_transition::state_transitions::identity_top_up) trait IdentityTopUpStateTransitionStateValidationV0 -{ - fn validate_state_v0( - &self, - platform: &PlatformRef, - tx: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error>; - - fn transform_into_action_v0( - &self, - platform: &PlatformRef, - platform_version: &PlatformVersion, - ) -> Result, Error>; -} - -impl IdentityTopUpStateTransitionStateValidationV0 for IdentityTopUpTransition { - fn validate_state_v0( - &self, - platform: &PlatformRef, - tx: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let mut validation_result = ConsensusValidationResult::::default(); - - validation_result.merge(self.asset_lock_proof().validate_state( - platform, - tx, - platform_version, - )?); - - if !validation_result.is_valid() { - return Ok(validation_result); - } - - self.transform_into_action_v0(platform, platform_version) - } - - fn transform_into_action_v0( - &self, - platform: &PlatformRef, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let mut validation_result = ConsensusValidationResult::::default(); - - let tx_out_validation = fetch_asset_lock_transaction_output_sync( - platform.core_rpc, - self.asset_lock_proof(), - platform_version, - )?; - - if !tx_out_validation.is_valid() { - return Ok(ConsensusValidationResult::new_with_errors( - tx_out_validation.errors, - )); - } - - let tx_out = tx_out_validation.into_data()?; - - // Verify one time signature - - let singable_bytes = StateTransition::IdentityTopUp(self.clone()).signable_bytes()?; - - let public_key_hash = tx_out - .script_pubkey - .p2pkh_public_key_hash_bytes() - .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "output must be a valid p2pkh already", - )) - })?; - - if let Err(e) = signer::verify_hash_signature( - &double_sha(singable_bytes), - self.signature().as_slice(), - public_key_hash, - ) { - return Ok(ConsensusValidationResult::new_with_error( - SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), - )); - } - - match IdentityTopUpTransitionAction::try_from_borrowed(self, &tx_out.value * 1000) { - Ok(action) => { - validation_result.set_data(action.into()); - } - Err(error) => { - validation_result.add_error(error); - } - } - - Ok(validation_result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs index 28bdf9425d0..6a8be703cff 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs @@ -7,19 +7,17 @@ use dpp::version::PlatformVersion; pub(in crate::execution::validation::state_transition::state_transitions::identity_top_up) trait IdentityTopUpStateTransitionStructureValidationV0 { - fn validate_base_structure_v0( + fn validate_basic_structure_v0( &self, platform_version: &PlatformVersion, ) -> Result; } impl IdentityTopUpStateTransitionStructureValidationV0 for IdentityTopUpTransition { - fn validate_base_structure_v0( + fn validate_basic_structure_v0( &self, platform_version: &PlatformVersion, ) -> Result { - // TODO: Add validation for the structure of the IdentityTopUpTransition - self.asset_lock_proof() .validate_structure(platform_version) .map_err(Error::Protocol) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/v0/mod.rs new file mode 100644 index 00000000000..003b05567d4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/v0/mod.rs @@ -0,0 +1,197 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; +use dpp::balances::credits::CREDITS_PER_DUFF; +use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointNotEnoughBalanceError; + +use dpp::consensus::signature::{BasicECDSAError, SignatureError}; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::{signer, ScriptBuf, Txid}; +use dpp::identity::state_transition::AssetLockProved; +use dpp::identity::KeyType; + +use dpp::prelude::ConsensusValidationResult; + +use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::state_transition::StateTransitionLike; + +use dpp::version::PlatformVersion; +use drive::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; +use drive::state_transition_action::StateTransitionAction; + +use crate::error::execution::ExecutionError; +use drive::grovedb::TransactionArg; + +use crate::execution::types::execution_operation::{SHA256_BLOCK_SIZE, ValidationOperation}; +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use crate::execution::validation::state_transition::common::asset_lock::transaction::fetch_asset_lock_transaction_output_sync::fetch_asset_lock_transaction_output_sync; +use crate::execution::validation::state_transition::ValidationMode; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_top_up) trait IdentityTopUpStateTransitionStateValidationV0 +{ + fn transform_into_action_v0( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl IdentityTopUpStateTransitionStateValidationV0 for IdentityTopUpTransition { + fn transform_into_action_v0( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // Todo: we might want a lowered required balance + let required_balance = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_top_up; + + let signable_bytes_len = signable_bytes.len(); + + let mut signable_bytes_hasher = SignableBytesHasher::Bytes(signable_bytes); + + // Validate asset lock proof state + let asset_lock_proof_validation = if validation_mode != ValidationMode::NoValidation { + self.asset_lock_proof().validate( + platform, + &mut signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + )? + } else { + ConsensusValidationResult::new() + }; + + if !asset_lock_proof_validation.is_valid() { + return Ok(ConsensusValidationResult::new_with_errors( + asset_lock_proof_validation.errors, + )); + } + + let mut needs_signature_verification = true; + + let asset_lock_value_to_be_consumed = if asset_lock_proof_validation.has_data() { + let asset_lock_value = asset_lock_proof_validation.into_data()?; + // There is no needed to recheck signatures on recheck tx + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + asset_lock_value + } else { + let tx_out_validation = fetch_asset_lock_transaction_output_sync( + platform.core_rpc, + self.asset_lock_proof(), + platform_version, + )?; + + if !tx_out_validation.is_valid() { + return Ok(ConsensusValidationResult::new_with_errors( + tx_out_validation.errors, + )); + } + + let tx_out = tx_out_validation.into_data()?; + + // We should always check that the balance is enough as it's very cheap and we could have + // had a version change that would have changed the minimum duff balance for processing + // start + + let min_value = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_top_up; + if tx_out.value < min_value { + return Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError::new( + self.asset_lock_proof() + .out_point() + .map(|outpoint| outpoint.txid) + .unwrap_or(Txid::all_zeros()), + self.asset_lock_proof().output_index() as usize, + tx_out.value, + tx_out.value, + min_value, + ) + .into(), + )); + } + + // Verify one time signature + // This is not necessary on recheck + + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + + let initial_balance_amount = tx_out.value * CREDITS_PER_DUFF; + AssetLockValue::new( + initial_balance_amount, + tx_out.script_pubkey.0, + initial_balance_amount, + vec![], + platform_version, + )? + }; + + if needs_signature_verification { + let tx_out_script_pubkey = + ScriptBuf(asset_lock_value_to_be_consumed.tx_out_script().clone()); + + // Verify one time signature + + let public_key_hash = tx_out_script_pubkey + .p2pkh_public_key_hash_bytes() + .ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCachedState( + "the script inside the state must be a p2pkh".to_string(), + )) + })?; + + let block_count = signable_bytes_len as u16 / SHA256_BLOCK_SIZE; + + execution_context.add_operation(ValidationOperation::DoubleSha256(block_count)); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(KeyType::ECDSA_HASH160), + )); + + if let Err(e) = signer::verify_hash_signature( + &signable_bytes_hasher.hash_bytes().as_slice(), + self.signature().as_slice(), + public_key_hash, + ) { + return Ok(ConsensusValidationResult::new_with_error( + SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), + )); + } + } + + match IdentityTopUpTransitionAction::try_from_borrowed( + self, + signable_bytes_hasher, + asset_lock_value_to_be_consumed, + ) { + Ok(action) => Ok(ConsensusValidationResult::new_with_data(action.into())), + Err(error) => Ok(ConsensusValidationResult::new_with_error(error)), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..a5071a5d3a0 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/v0/mod.rs @@ -0,0 +1,86 @@ +use crate::error::execution::ExecutionError::CorruptedCodeExecution; +use crate::error::Error; + +use dpp::consensus::state::identity::invalid_identity_revision_error::InvalidIdentityRevisionError; +use dpp::consensus::state::state_error::StateError; + +use dpp::identity::PartialIdentity; + +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use dpp::serialization::PlatformMessageSignable; +use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; +use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; +use dpp::validation::ConsensusValidationResult; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition) trait IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 +{ + fn validate_identity_update_state_transition_signatures_v0( + &self, + signable_bytes: Vec, + partial_identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error>; +} + +impl IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 for IdentityUpdateTransition { + fn validate_identity_update_state_transition_signatures_v0( + &self, + signable_bytes: Vec, + partial_identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error> { + let Some(revision) = partial_identity.revision else { + return Err(Error::Execution(CorruptedCodeExecution( + "revision should exist", + ))); + }; + + // Check revision + if revision + 1 != self.revision() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + StateError::InvalidIdentityRevisionError(InvalidIdentityRevisionError::new( + self.identity_id(), + revision, + )) + .into(), + ], + )); + } + + for key in self.public_keys_to_add().iter() { + let validation_result = signable_bytes.as_slice().verify_signature( + key.key_type(), + key.data().as_slice(), + key.signature().as_slice(), + ); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(key.key_type()), + )); + if !validation_result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); + } + } + + Ok(ConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/mod.rs new file mode 100644 index 00000000000..9a1925de7fc --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/mod.rs @@ -0,0 +1 @@ +pub(crate) mod v0; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/v0/mod.rs new file mode 100644 index 00000000000..2252d0192c4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/v0/mod.rs @@ -0,0 +1,89 @@ +use crate::error::Error; +use dpp::consensus::basic::identity::{ + DisablingKeyIdAlsoBeingAddedInSameTransitionError, DuplicatedIdentityPublicKeyIdBasicError, + InvalidIdentityUpdateTransitionEmptyError, +}; +use dpp::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; +use dpp::consensus::ConsensusError; +use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; +use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use std::collections::HashSet; + +const MAX_KEYS_TO_DISABLE: usize = 10; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_update) trait IdentityUpdateStateTransitionStructureValidationV0 +{ + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityUpdateStateTransitionStructureValidationV0 for IdentityUpdateTransition { + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let mut result = SimpleConsensusValidationResult::default(); + + // Ensure that either disablePublicKeys or addPublicKeys is present + if self.public_key_ids_to_disable().is_empty() && self.public_keys_to_add().is_empty() { + result.add_error(ConsensusError::from( + InvalidIdentityUpdateTransitionEmptyError::new(), + )); + } + + if !result.is_valid() { + return Ok(result); + } + + // Validate public keys to disable + if !self.public_key_ids_to_disable().is_empty() { + // Ensure max items + if self.public_key_ids_to_disable().len() > MAX_KEYS_TO_DISABLE { + result.add_error(ConsensusError::from( + MaxIdentityPublicKeyLimitReachedError::new(MAX_KEYS_TO_DISABLE), + )); + } + + // Check key id duplicates + let mut ids = HashSet::new(); + for key_id in self.public_key_ids_to_disable() { + if ids.contains(key_id) { + result.add_error(ConsensusError::from( + DuplicatedIdentityPublicKeyIdBasicError::new(vec![*key_id]), + )); + break; + } + + if self + .public_keys_to_add() + .iter() + .any(|public_key_in_creation| public_key_in_creation.id() == *key_id) + { + result.add_error(ConsensusError::from( + DisablingKeyIdAlsoBeingAddedInSameTransitionError::new(*key_id), + )); + break; + } + + ids.insert(key_id); + } + } + + if !result.is_valid() { + return Ok(result); + } + + IdentityPublicKeyInCreation::validate_identity_public_keys_structure( + self.public_keys_to_add(), + false, + platform_version, + ) + .map_err(Error::Protocol) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/v0/mod.rs deleted file mode 100644 index cc845dc0e8a..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/v0/mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -use crate::error::execution::ExecutionError::CorruptedCodeExecution; -use crate::error::Error; - -use dpp::consensus::state::identity::invalid_identity_revision_error::InvalidIdentityRevisionError; -use dpp::consensus::state::state_error::StateError; - -use dpp::identity::PartialIdentity; - -use dpp::serialization::PlatformMessageSignable; -use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; -use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; -use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; -use dpp::validation::SimpleConsensusValidationResult; - -pub(in crate::execution::validation::state_transition) trait IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 -{ - fn validate_identity_update_state_transition_signatures_v0( - &self, - signable_bytes: Vec, - partial_identity: &PartialIdentity, - ) -> Result; -} - -impl IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 for IdentityUpdateTransition { - fn validate_identity_update_state_transition_signatures_v0( - &self, - signable_bytes: Vec, - partial_identity: &PartialIdentity, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - for key in self.public_keys_to_add().iter() { - let validation_result = signable_bytes.as_slice().verify_signature( - key.key_type(), - key.data().as_slice(), - key.signature().as_slice(), - )?; - if !validation_result.is_valid() { - result.add_errors(validation_result.errors); - } - } - - let Some(revision) = partial_identity.revision else { - return Err(Error::Execution(CorruptedCodeExecution( - "revision should exist", - ))); - }; - - // Check revision - if revision + 1 != self.revision() { - result.add_error(StateError::InvalidIdentityRevisionError( - InvalidIdentityRevisionError::new(self.identity_id(), revision), - )); - return Ok(result); - } - - Ok(result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs index 73bde66a799..0b6adcdf0d4 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs @@ -1,7 +1,9 @@ -pub(crate) mod identity_and_signatures; +pub(crate) mod advanced_structure; +mod basic_structure; +mod nonce; mod state; -mod structure; +use dpp::block::block_info::BlockInfo; use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -11,28 +13,32 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use crate::execution::validation::state_transition::identity_update::basic_structure::v0::IdentityUpdateStateTransitionStructureValidationV0; use crate::execution::validation::state_transition::identity_update::state::v0::IdentityUpdateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::identity_update::structure::v0::IdentityUpdateStateTransitionStructureValidationV0; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; impl StateTransitionActionTransformerV0 for IdentityUpdateTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + _validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -50,27 +56,28 @@ impl StateTransitionActionTransformerV0 for IdentityUpdateTransition { } } -impl StateTransitionStructureValidationV0 for IdentityUpdateTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityUpdateTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_update_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity update transition: validate_structure".to_string(), + Some(0) => self.validate_basic_structure_v0(platform_version), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity update transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity update transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } } @@ -80,10 +87,12 @@ impl StateTransitionStateValidationV0 for IdentityUpdateTransition { &self, _action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; match platform_version .drive_abci .validation_and_processing @@ -100,3 +109,232 @@ impl StateTransitionStateValidationV0 for IdentityUpdateTransition { } } } + +#[cfg(test)] +mod tests { + use crate::config::{PlatformConfig, PlatformTestConfig}; + use crate::execution::validation::state_transition::tests::{ + setup_add_key_to_identity, setup_identity_return_master_key, + }; + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::block::block_info::BlockInfo; + use dpp::dash_to_credits; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::contract_bounds::ContractBounds; + use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + use dpp::identity::signer::Signer; + use dpp::identity::{KeyType, Purpose, SecurityLevel}; + use dpp::serialization::{PlatformSerializable, Signable}; + use dpp::state_transition::identity_update_transition::v0::IdentityUpdateTransitionV0; + use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; + use dpp::state_transition::StateTransition; + use platform_version::version::PlatformVersion; + + #[test] + fn test_identity_update_that_disables_an_authentication_key() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform_version = PlatformVersion::latest(); + + let mut platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_genesis_state(); + + let (identity, signer, key) = + setup_identity_return_master_key(&mut platform, 958, dash_to_credits!(0.1)); + + let platform_state = platform.state.load(); + + let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { + identity_id: identity.id(), + revision: 1, + nonce: 1, + add_public_keys: vec![], + disable_public_keys: vec![1], + user_fee_increase: 0, + signature_public_key_id: key.id(), + signature: Default::default(), + } + .into(); + + let mut update_transition: StateTransition = update_transition.into(); + + let data = update_transition + .signable_bytes() + .expect("expected signable bytes"); + update_transition.set_signature( + signer + .sign(&key, data.as_slice()) + .expect("expected to sign"), + ); + + let update_transition_bytes = update_transition + .serialize_to_bytes() + .expect("expected to serialize"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![update_transition_bytes.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + true, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!(issues.len(), 0); + } + + #[test] + fn test_identity_update_that_disables_an_encryption_key() { + let platform_config = PlatformConfig { + testing_configs: PlatformTestConfig { + disable_instant_lock_signature_verification: true, + ..Default::default() + }, + ..Default::default() + }; + + let platform_version = PlatformVersion::latest(); + + let mut platform = TestPlatformBuilder::new() + .with_config(platform_config) + .build_with_mock_rpc() + .set_genesis_state(); + + let (mut identity, mut signer, master_key) = + setup_identity_return_master_key(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let key = setup_add_key_to_identity( + &mut platform, + &mut identity, + &mut signer, + 4, + 2, + Purpose::ENCRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + ); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + + let platform_state = platform.state.load(); + + let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { + identity_id: identity.id(), + revision: 1, + nonce: 1, + add_public_keys: vec![], + disable_public_keys: vec![key.id()], + user_fee_increase: 0, + signature_public_key_id: master_key.id(), + signature: Default::default(), + } + .into(); + + let mut update_transition: StateTransition = update_transition.into(); + + let data = update_transition + .signable_bytes() + .expect("expected signable bytes"); + update_transition.set_signature( + signer + .sign(&master_key, data.as_slice()) + .expect("expected to sign"), + ); + + let update_transition_bytes = update_transition + .serialize_to_bytes() + .expect("expected to serialize"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![update_transition_bytes.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + true, + None, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let issues = platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/mod.rs new file mode 100644 index 00000000000..30f81ef9996 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_update::nonce::v0::IdentityUpdateTransitionIdentityContractNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for IdentityUpdateTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_update_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity update transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity update transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/v0/mod.rs new file mode 100644 index 00000000000..fc51a636c58 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityUpdateTransitionIdentityContractNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityUpdateTransitionIdentityContractNonceV0 for IdentityUpdateTransition { + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.identity_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs index 7619699f122..08997950bf5 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs @@ -1,30 +1,25 @@ -use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; -use dpp::consensus::state::identity::identity_public_key_disabled_at_window_violation_error::IdentityPublicKeyDisabledAtWindowViolationError; -use dpp::consensus::state::state_error::StateError; - use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; -use dpp::validation::block_time_window::validate_time_in_block_time_window::validate_time_in_block_time_window; use dpp::version::PlatformVersion; -use dpp::ProtocolError; use drive::state_transition_action::identity::identity_update::IdentityUpdateTransitionAction; use drive::state_transition_action::StateTransitionAction; use drive::grovedb::TransactionArg; use dpp::version::DefaultForPlatformVersion; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::common::validate_identity_public_key_contract_bounds::validate_identity_public_keys_contract_bounds; use crate::execution::validation::state_transition::common::validate_identity_public_key_ids_dont_exist_in_state::validate_identity_public_key_ids_dont_exist_in_state; use crate::execution::validation::state_transition::common::validate_identity_public_key_ids_exist_in_state::validate_identity_public_key_ids_exist_in_state; -use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_in_state; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::common::validate_not_disabling_last_master_key::validate_master_key_uniqueness; +use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_not_in_state; pub(in crate::execution::validation::state_transition::state_transitions::identity_update) trait IdentityUpdateStateTransitionStateValidationV0 { @@ -54,7 +49,7 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition // Now we should check the state of added keys to make sure there aren't any that already exist validation_result.add_errors( - validate_unique_identity_public_key_hashes_in_state( + validate_unique_identity_public_key_hashes_not_in_state( self.public_keys_to_add(), drive, &mut state_transition_execution_context, @@ -65,7 +60,14 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition ); if !validation_result.is_valid() { - return Ok(validation_result); + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } validation_result.add_errors( @@ -81,7 +83,14 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition ); if !validation_result.is_valid() { - return Ok(validation_result); + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } // Now we should check to make sure any keys that are added are valid for the contract @@ -99,12 +108,18 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition ); if !validation_result.is_valid() { - return Ok(validation_result); + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } if !self.public_key_ids_to_disable().is_empty() { - // We need to validate that all keys removed existed - validation_result.add_errors( + let validation_result_and_keys_to_disable = validate_identity_public_key_ids_exist_in_state( self.identity_id(), self.public_key_ids_to_disable(), @@ -112,43 +127,35 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition &mut state_transition_execution_context, tx, platform_version, - )? - .errors, - ); - - if !validation_result.is_valid() { - return Ok(validation_result); + )?; + // We need to validate that all keys removed existed + if !validation_result_and_keys_to_disable.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result_and_keys_to_disable.errors, + )); } - if let Some(disabled_at_ms) = self.public_keys_disabled_at() { - // We need to verify the time the keys were disabled - - let last_block_time = platform.state.last_block_time_ms().ok_or( - Error::Execution(ExecutionError::StateNotInitialized( - "expected a last platform block during identity update validation", - )), - )?; + let keys_to_disable = validation_result_and_keys_to_disable.into_data()?; - let window_validation_result = validate_time_in_block_time_window( - last_block_time, - disabled_at_ms, - platform.config.block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - - if !window_validation_result.valid { - validation_result.add_error( - StateError::IdentityPublicKeyDisabledAtWindowViolationError( - IdentityPublicKeyDisabledAtWindowViolationError::new( - disabled_at_ms, - window_validation_result.time_window_start, - window_validation_result.time_window_end, - ), - ), - ); - return Ok(validation_result); - } + let validation_result = validate_master_key_uniqueness( + self.public_keys_to_add(), + keys_to_disable.as_slice(), + platform_version, + )?; + if !validation_result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } } self.transform_into_action_v0() diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/v0/mod.rs deleted file mode 100644 index 3c7ce366d68..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/v0/mod.rs +++ /dev/null @@ -1,88 +0,0 @@ -use crate::error::Error; -use dpp::consensus::basic::identity::{ - DuplicatedIdentityPublicKeyIdBasicError, InvalidIdentityUpdateTransitionDisableKeysError, - InvalidIdentityUpdateTransitionEmptyError, -}; -use dpp::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; -use dpp::consensus::ConsensusError; -use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; -use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; -use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use std::collections::HashSet; - -const MAX_KEYS_TO_DISABLE: usize = 10; - -pub(in crate::execution::validation::state_transition::state_transitions::identity_update) trait IdentityUpdateStateTransitionStructureValidationV0 -{ - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl IdentityUpdateStateTransitionStructureValidationV0 for IdentityUpdateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - // Ensure that either disablePublicKeys or addPublicKeys is present - if self.public_key_ids_to_disable().is_empty() && self.public_keys_to_add().is_empty() { - result.add_error(ConsensusError::from( - InvalidIdentityUpdateTransitionEmptyError::new(), - )); - } - - if !result.is_valid() { - return Ok(result); - } - - // Validate public keys to disable - if !self.public_key_ids_to_disable().is_empty() { - // Ensure max items - if self.public_key_ids_to_disable().len() > MAX_KEYS_TO_DISABLE { - result.add_error(ConsensusError::from( - MaxIdentityPublicKeyLimitReachedError::new(MAX_KEYS_TO_DISABLE), - )); - } - - // Check key id duplicates - let mut ids = HashSet::new(); - for key_id in self.public_key_ids_to_disable() { - if ids.contains(key_id) { - result.add_error(ConsensusError::from( - DuplicatedIdentityPublicKeyIdBasicError::new(vec![*key_id]), - )); - break; - } - - ids.insert(key_id); - } - - // Ensure disable at timestamp is present - if self.public_keys_disabled_at().is_none() { - result.add_error(ConsensusError::from( - InvalidIdentityUpdateTransitionDisableKeysError::new(), - )) - } - } else if self.public_keys_disabled_at().is_some() { - // Ensure there are public keys to disable when disable at timestamp is present - result.add_error(ConsensusError::from( - InvalidIdentityUpdateTransitionDisableKeysError::new(), - )) - } - - if !result.is_valid() { - return Ok(result); - } - - IdentityPublicKeyInCreation::validate_identity_public_keys_structure( - self.public_keys_to_add(), - platform_version, - ) - .map_err(Error::Protocol) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/advanced_structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/advanced_structure/mod.rs new file mode 100644 index 00000000000..b44732c3d07 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/advanced_structure/mod.rs @@ -0,0 +1,65 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::masternode_vote::advanced_structure::v0::MasternodeVoteStateTransitionAdvancedStructureValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionStructureKnownInStateValidationV0; +use dpp::identity::PartialIdentity; +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::version::PlatformVersion; +use drive::state_transition_action::StateTransitionAction; + +pub(crate) mod v0; + +impl StateTransitionStructureKnownInStateValidationV0 for MasternodeVoteTransition { + fn validate_advanced_structure_from_state( + &self, + action: &StateTransitionAction, + identity: Option<&PartialIdentity>, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .masternode_vote_state_transition + .advanced_structure + { + Some(0) => { + let identity = + identity.ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "The identity must be known on advanced structure validation", + )))?; + let StateTransitionAction::MasternodeVoteAction(masternode_vote_action) = action + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "action must be a masternode vote action", + ))); + }; + self.validate_advanced_structure_from_state_v0( + masternode_vote_action, + identity, + execution_context, + ) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "masternode vote transition: validate_advanced_structure".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "masternode vote transition: validate_advanced_structure".to_string(), + known_versions: vec![0], + })), + } + } + + fn has_advanced_structure_validation_with_state(&self) -> bool { + true + } + + fn requires_advanced_structure_validation_with_state_on_check_tx(&self) -> bool { + true + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..0773f388402 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/advanced_structure/v0/mod.rs @@ -0,0 +1,75 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use dpp::consensus::state::voting::masternode_incorrect_voter_identity_id_error::MasternodeIncorrectVoterIdentityIdError; +use dpp::consensus::state::voting::masternode_incorrect_voting_address_error::MasternodeIncorrectVotingAddressError; +use dpp::identifier::MasternodeIdentifiers; +use dpp::identity::hash::IdentityPublicKeyHashMethodsV0; +use dpp::identity::PartialIdentity; +use dpp::prelude::{ConsensusValidationResult, Identifier}; +use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::state_transition::StateTransitionIdentitySigned; +use drive::state_transition_action::identity::masternode_vote::MasternodeVoteTransitionAction; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition::state_transitions::masternode_vote) trait MasternodeVoteStateTransitionAdvancedStructureValidationV0 +{ + fn validate_advanced_structure_from_state_v0( + &self, + action: &MasternodeVoteTransitionAction, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error>; +} + +impl MasternodeVoteStateTransitionAdvancedStructureValidationV0 for MasternodeVoteTransition { + fn validate_advanced_structure_from_state_v0( + &self, + action: &MasternodeVoteTransitionAction, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error> { + let key = identity + .loaded_public_keys + .get(&self.signature_public_key_id()) + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "public key must be known", + )))?; + + let voting_address = key.public_key_hash()?; + if action.voting_address() != voting_address { + return Ok(ConsensusValidationResult::new_with_error( + MasternodeIncorrectVotingAddressError::new( + self.pro_tx_hash(), + action.voting_address().into(), + voting_address.into(), + ) + .into(), + )); + } + + // We also need to verify that the provided voter_id is correct + + execution_context.add_operation(ValidationOperation::SingleSha256(2)); + + let expected_voter_identity_id = + Identifier::create_voter_identifier(self.pro_tx_hash().as_bytes(), &voting_address); + + if expected_voter_identity_id != self.voter_identity_id() { + return Ok(ConsensusValidationResult::new_with_error( + MasternodeIncorrectVoterIdentityIdError::new( + self.pro_tx_hash(), + expected_voter_identity_id, + self.voter_identity_id(), + ) + .into(), + )); + } + + Ok(ConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/balance/mod.rs new file mode 100644 index 00000000000..8fd9438e1d7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/balance/mod.rs @@ -0,0 +1,56 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::masternode_vote::balance::v0::MasternodeVoteTransitionBalanceValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionPrefundedSpecializedBalanceValidationV0; +use dpp::fee::Credits; +use dpp::prefunded_specialized_balance::PrefundedSpecializedBalanceIdentifier; +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::version::PlatformVersion; +use drive::drive::Drive; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +pub(crate) mod v0; + +impl StateTransitionPrefundedSpecializedBalanceValidationV0 for MasternodeVoteTransition { + fn validate_minimum_prefunded_specialized_balance_pre_check( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result< + ConsensusValidationResult>, + Error, + > { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .masternode_vote_state_transition + .advanced_minimum_balance_pre_check + { + Some(0) => self.validate_advanced_minimum_balance_pre_check_v0( + drive, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "masternode vote transition: validate_balance".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "masternode vote transition: validate_balance".to_string(), + known_versions: vec![0], + })), + } + } + + fn uses_prefunded_specialized_balance_for_payment(&self) -> bool { + true + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/balance/v0/mod.rs new file mode 100644 index 00000000000..f5c7a563097 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/balance/v0/mod.rs @@ -0,0 +1,88 @@ +use std::collections::BTreeMap; +use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_insufficient_error::PrefundedSpecializedBalanceInsufficientError; +use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError; +use crate::error::Error; +use dpp::fee::Credits; +use dpp::prefunded_specialized_balance::PrefundedSpecializedBalanceIdentifier; +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; + +use crate::error::execution::ExecutionError; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use dpp::version::PlatformVersion; +use drive::drive::Drive; +use drive::grovedb::TransactionArg; + +pub(super) trait MasternodeVoteTransitionBalanceValidationV0 { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result< + ConsensusValidationResult>, + Error, + >; +} + +impl MasternodeVoteTransitionBalanceValidationV0 for MasternodeVoteTransition { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result< + ConsensusValidationResult>, + Error, + > { + execution_context.add_operation(ValidationOperation::RetrievePrefundedSpecializedBalance); + + let vote = self.vote(); + + let balance_id = vote.specialized_balance_id()?.ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "In this version there should always be a specialized balance id", + ), + ))?; + let maybe_balance = drive.fetch_prefunded_specialized_balance( + balance_id.to_buffer(), + tx, + platform_version, + )?; + + let Some(balance) = maybe_balance else { + // If there is no balance we are voting on something that either was never created or has finished + return Ok(ConsensusValidationResult::new_with_error( + PrefundedSpecializedBalanceNotFoundError::new(balance_id).into(), + )); + }; + if balance + < platform_version + .fee_version + .state_transition_min_fees + .masternode_vote + { + return Ok(ConsensusValidationResult::new_with_error( + PrefundedSpecializedBalanceInsufficientError::new( + balance_id, + balance, + platform_version + .fee_version + .state_transition_min_fees + .masternode_vote, + ) + .into(), + )); + } + + Ok(ConsensusValidationResult::new_with_data(BTreeMap::from([ + (balance_id, balance), + ]))) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs new file mode 100644 index 00000000000..f2ce1e36626 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs @@ -0,0 +1,8029 @@ +mod advanced_structure; +mod balance; +mod nonce; +mod state; +mod transform_into_action; + +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::validation::ConsensusValidationResult; +use drive::state_transition_action::StateTransitionAction; + +use drive::grovedb::TransactionArg; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; + +use crate::execution::validation::state_transition::masternode_vote::state::v0::MasternodeVoteStateTransitionStateValidationV0; +use crate::execution::validation::state_transition::masternode_vote::transform_into_action::v0::MasternodeVoteStateTransitionTransformIntoActionValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionStateValidationV0; +use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + +impl StateTransitionActionTransformerV0 for MasternodeVoteTransition { + fn transform_into_action( + &self, + platform: &PlatformRef, + _block_info: &BlockInfo, + validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error> { + let platform_version = platform.state.current_platform_version()?; + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .masternode_vote_state_transition + .transform_into_action + { + 0 => self + .transform_into_action_v0(platform, validation_mode, tx, platform_version) + .map(|result| result.map(|action| action.into())), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "masternode votes state transition: transform_into_action".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +impl StateTransitionStateValidationV0 for MasternodeVoteTransition { + fn validate_state( + &self, + action: Option, + platform: &PlatformRef, + _validation_mode: ValidationMode, + _block_info: &BlockInfo, + _execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error> { + let platform_version = platform.state.current_platform_version()?; + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .masternode_vote_state_transition + .state + { + 0 => self.validate_state_v0(action, platform, tx, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "masternode votes state transition: validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +#[cfg(test)] +mod tests { + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::block::block_info::BlockInfo; + use dpp::dash_to_credits; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::platform_value::Value; + use platform_version::version::PlatformVersion; + use dapi_grpc::platform::v0::{get_contested_resources_request, get_contested_resources_response, get_vote_polls_by_end_date_request, get_vote_polls_by_end_date_response, GetContestedResourcesRequest, GetVotePollsByEndDateRequest, GetVotePollsByEndDateResponse}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0::ResultType; + use dapi_grpc::platform::v0::get_vote_polls_by_end_date_request::GetVotePollsByEndDateRequestV0; + use dapi_grpc::platform::v0::get_vote_polls_by_end_date_response::{get_vote_polls_by_end_date_response_v0, GetVotePollsByEndDateResponseV0}; + use dapi_grpc::platform::v0::get_vote_polls_by_end_date_response::get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamp; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice::TowardsIdentity; + use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; + use dpp::voting::vote_polls::VotePoll; + use dpp::voting::votes::resource_vote::ResourceVote; + use dpp::voting::votes::resource_vote::v0::ResourceVoteV0; + use drive::util::object_size_info::DataContractResolvedInfo; + use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; + use dpp::identifier::Identifier; + use dpp::prelude::DataContract; + use dpp::util::strings::convert_to_homograph_safe_chars; + use drive::query::vote_polls_by_document_type_query::ResolvedVotePollsByDocumentTypeQuery; + use crate::platform_types::platform_state::PlatformState; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TempPlatform; + use dpp::serialization::PlatformDeserializable; + use drive::query::VotePollsByEndDateDriveQuery; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0; + use dpp::platform_value::IdentifierBytes32; + use dpp::platform_value::Value::Text; + use dapi_grpc::platform::v0::{get_prefunded_specialized_balance_request, GetPrefundedSpecializedBalanceRequest}; + use dapi_grpc::platform::v0::get_prefunded_specialized_balance_request::GetPrefundedSpecializedBalanceRequestV0; + use std::collections::BTreeMap; + use std::sync::Arc; + use dapi_grpc::platform::v0::get_contested_resources_request::GetContestedResourcesRequestV0; + use dapi_grpc::platform::v0::get_contested_resources_response::{get_contested_resources_response_v0, GetContestedResourcesResponseV0}; + use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_request::GetContestedResourceVotersForIdentityRequestV0; + use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_response::{ + get_contested_resource_voters_for_identity_response_v0, + GetContestedResourceVotersForIdentityResponseV0, + }; + use dapi_grpc::platform::v0::{ + get_contested_resource_voters_for_identity_request, + get_contested_resource_voters_for_identity_response, + GetContestedResourceVotersForIdentityRequest, + }; + use drive::query::vote_poll_contestant_votes_query::ResolvedContestedDocumentVotePollVotesDriveQuery; + use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_request::get_contested_resource_voters_for_identity_request_v0; + use dpp::platform_value; + use dapi_grpc::platform::v0::get_contested_resource_identity_votes_request::{ + get_contested_resource_identity_votes_request_v0, + GetContestedResourceIdentityVotesRequestV0, + }; + use dapi_grpc::platform::v0::get_contested_resource_identity_votes_response::{ + get_contested_resource_identity_votes_response_v0, + GetContestedResourceIdentityVotesResponseV0, + }; + use dapi_grpc::platform::v0::{ + get_contested_resource_identity_votes_request, + get_contested_resource_identity_votes_response, + GetContestedResourceIdentityVotesRequest, + }; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice::Lock; + use drive::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; + use crate::error::Error; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + use dapi_grpc::platform::v0::get_prefunded_specialized_balance_response; + use dapi_grpc::platform::v0::get_prefunded_specialized_balance_response::{ + get_prefunded_specialized_balance_response_v0, + GetPrefundedSpecializedBalanceResponseV0, + }; + use dpp::fee::Credits; + use drive::drive::Drive; + use crate::execution::validation::state_transition::state_transitions::tests::{create_dpns_identity_name_contest, verify_dpns_name_contest, perform_vote, setup_masternode_identity, get_proved_vote_states, get_vote_states, perform_votes_multi}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::{finished_vote_info, FinishedVoteInfo}; + use dpp::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; + use dapi_grpc::platform::v0::get_vote_polls_by_end_date_request::get_vote_polls_by_end_date_request_v0; + mod vote_tests { + use super::*; + + mod contests_requests_query { + use super::*; + use dapi_grpc::platform::v0::get_contested_resources_request::get_contested_resources_request_v0; + + #[test] + fn test_not_proved_contests_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (identity_1, identity_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + verify_dpns_name_contest( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + &identity_1, + &identity_2, + "quantum", + platform_version, + ); + + let (identity_3, identity_4, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "cooldog", + platform_version, + ); + + verify_dpns_name_contest( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + &identity_3, + &identity_4, + "cooldog", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let index_name = "parentNameAndLabel".to_string(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode value"); + + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![dash_encoded.clone()], + end_index_values: vec![], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + )) = result + else { + panic!("expected contested resources") + }; + + assert_eq!(contested_resource_values.len(), 2); + } + + #[test] + fn test_proved_contests_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_identity_1, _identity_2, _dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (_identity_3, _identity_4, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "cooldog", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let index_name = "parentNameAndLabel".to_string(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode value"); + + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![dash_encoded], + end_index_values: vec![], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::Proof(proof)) = result else { + panic!("expected proof") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract( + dpns_contract.as_ref(), + ), + document_type_name: domain.name(), + index_name: &index_name, + start_index_values: &vec!["dash".into()], + end_index_values: &vec![], + limit: None, + order_ascending: true, + start_at_value: &None, + }; + + let (_, contests) = resolved_contested_document_vote_poll_drive_query + .verify_contests_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + assert_eq!(contests.len(), 2); + } + + #[test] + fn test_empty_string_start_index_value() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_contender_1, _contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let index_name = "parentNameAndLabel".to_string(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let empty_encoded = bincode::encode_to_vec(Value::Text("".to_string()), config) + .expect("expected to encode value"); + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![empty_encoded.clone()], + end_index_values: vec![], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + )) = result + else { + panic!("expected contested resources") + }; + + assert_eq!(contested_resource_values.len(), 0); + } + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![empty_encoded], + end_index_values: vec![], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::Proof(proof)) = result + else { + panic!("expected proof") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract( + dpns_contract.as_ref(), + ), + document_type_name: domain.name(), + index_name: &index_name, + start_index_values: &vec!["".into()], + end_index_values: &vec![], + limit: None, + order_ascending: true, + start_at_value: &None, + }; + + let (_, contests) = resolved_contested_document_vote_poll_drive_query + .verify_contests_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + assert_eq!(contests.len(), 0); + } + } + + #[test] + fn test_no_start_index_value() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_contender_1, _contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let index_name = "parentNameAndLabel".to_string(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + )) = result + else { + panic!("expected contested resources") + }; + + let dash_encoded = + bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + assert_eq!( + contested_resource_values.first(), + Some(dash_encoded).as_ref() + ); + } + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::Proof(proof)) = result + else { + panic!("expected proof") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract( + dpns_contract.as_ref(), + ), + document_type_name: domain.name(), + index_name: &index_name, + start_index_values: &vec![], + end_index_values: &vec![], + limit: None, + order_ascending: true, + start_at_value: &None, + }; + + let (_, contests) = resolved_contested_document_vote_poll_drive_query + .verify_contests_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + assert_eq!( + contests.first(), + Some(Value::Text("dash".to_string())).as_ref() + ); + } + } + + #[test] + fn test_existing_end_index_value() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_contender_1, _contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let encoded_existing_value = + bincode::encode_to_vec(Value::Text("quantum".to_string()), config) + .expect("expected to encode value"); + + let index_name = "parentNameAndLabel".to_string(); + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![encoded_existing_value.clone()], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + )) = result + else { + panic!("expected contested resources") + }; + + let dash_encoded = + bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + assert_eq!( + contested_resource_values.first(), + Some(dash_encoded).as_ref() + ); + } + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![encoded_existing_value], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::Proof(proof)) = result + else { + panic!("expected proof") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract( + dpns_contract.as_ref(), + ), + document_type_name: domain.name(), + index_name: &index_name, + start_index_values: &vec![], + end_index_values: &vec!["quantum".into()], + limit: None, + order_ascending: true, + start_at_value: &None, + }; + + let (_, contests) = resolved_contested_document_vote_poll_drive_query + .verify_contests_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + assert_eq!( + contests.first(), + Some(Value::Text("dash".to_string())).as_ref() + ); + } + } + + #[test] + fn test_non_existing_end_index_value() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_contender_1, _contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let encoded_non_existing_value = + bincode::encode_to_vec(Value::Text("cashcash".to_string()), config) + .expect("expected to encode value"); + + let index_name = "parentNameAndLabel".to_string(); + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![encoded_non_existing_value.clone()], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + )) = result + else { + panic!("expected contested resources") + }; + + assert_eq!(contested_resource_values.first(), None); + } + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![encoded_non_existing_value], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::Proof(proof)) = result + else { + panic!("expected proof") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract( + dpns_contract.as_ref(), + ), + document_type_name: domain.name(), + index_name: &index_name, + start_index_values: &vec![], + end_index_values: &vec!["cashcash".into()], + limit: None, + order_ascending: true, + start_at_value: &None, + }; + + let (_, contests) = resolved_contested_document_vote_poll_drive_query + .verify_contests_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + assert_eq!(contests.first(), None); + } + } + + #[test] + fn test_non_existing_end_index_value_many_values() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_contender_1, _contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let encoded_non_existing_value_1 = + bincode::encode_to_vec(Value::Text("cashcash".to_string()), config) + .expect("expected to encode value"); + + let encoded_non_existing_value_2 = + bincode::encode_to_vec(Value::Text("cennnn".to_string()), config) + .expect("expected to encode value"); + + let index_name = "parentNameAndLabel".to_string(); + + { + let query_validation_error = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![ + encoded_non_existing_value_1.clone(), + encoded_non_existing_value_2.clone(), + ], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .first_error() + .map(|e| e.to_string()); + + assert_eq!(query_validation_error, Some("query syntax error: incorrect index values error: too many end index values were provided".to_string())); + } + + { + let query_validation_error = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![], + end_index_values: vec![ + encoded_non_existing_value_1.clone(), + encoded_non_existing_value_2.clone(), + ], + start_at_value_info: None, + count: None, + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .first_error() + .map(|e| e.to_string()); + + assert_eq!(query_validation_error, Some("query syntax error: incorrect index values error: too many end index values were provided".to_string())); + } + } + + #[test] + fn test_limit() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_contender_1, _contender_2, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (_contender_3, _contender_4, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "coya", + platform_version, + ); + + let (_contender_5, _contender_6, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "tobe", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let index_name = "parentNameAndLabel".to_string(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode value"); + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![dash_encoded.clone()], + end_index_values: vec![], + start_at_value_info: None, + count: Some(2), + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + )) = result + else { + panic!("expected contested resources") + }; + + assert_eq!(contested_resource_values.len(), 2); + } + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![dash_encoded], + end_index_values: vec![], + start_at_value_info: None, + count: Some(2), + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::Proof(proof)) = result + else { + panic!("expected proof") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract( + dpns_contract.as_ref(), + ), + document_type_name: domain.name(), + index_name: &index_name, + start_index_values: &vec!["dash".into()], + end_index_values: &vec![], + limit: Some(2), + order_ascending: true, + start_at_value: &None, + }; + + let (_, contests) = resolved_contested_document_vote_poll_drive_query + .verify_contests_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + assert_eq!(contests.len(), 2); + } + } + + #[test] + fn test_start_at() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (_contender_1, _contender_2, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (_contender_3, _contender_4, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "coya", + platform_version, + ); + + let (_contender_5, _contender_6, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "tobe", + platform_version, + ); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let index_name = "parentNameAndLabel".to_string(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode value"); + + let quantum_encoded = bincode::encode_to_vec( + Value::Text(convert_to_homograph_safe_chars("quantum")), + config, + ) + .expect("expected to encode value"); + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![dash_encoded.clone()], + end_index_values: vec![], + start_at_value_info: Some( + get_contested_resources_request_v0::StartAtValueInfo { + start_value: quantum_encoded.clone(), + start_value_included: false, + }, + ), + count: None, + order_ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + )) = result + else { + panic!("expected contested resources") + }; + + assert_eq!(contested_resource_values.len(), 1); + } + + { + let query_validation_result = platform + .query_contested_resources( + GetContestedResourcesRequest { + version: Some(get_contested_resources_request::Version::V0( + GetContestedResourcesRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + start_index_values: vec![dash_encoded], + end_index_values: vec![], + start_at_value_info: Some( + get_contested_resources_request_v0::StartAtValueInfo { + start_value: quantum_encoded.clone(), + start_value_included: false, + }, + ), + count: None, + order_ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resources_response::Version::V0( + GetContestedResourcesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resources_response_v0::Result::Proof(proof)) = result + else { + panic!("expected proof") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract( + dpns_contract.as_ref(), + ), + document_type_name: domain.name(), + index_name: &index_name, + start_index_values: &vec!["dash".into()], + end_index_values: &vec![], + limit: None, + order_ascending: true, + start_at_value: &Some(( + Value::Text(convert_to_homograph_safe_chars("quantum")), + false, + )), + }; + + let (_, contests) = resolved_contested_document_vote_poll_drive_query + .verify_contests_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + assert_eq!(contests.len(), 1); + } + } + } + + mod vote_state_query { + use super::*; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::{ + get_contested_resource_vote_state_request_v0, + GetContestedResourceVoteStateRequestV0, + }; + use dapi_grpc::platform::v0::{ + get_contested_resource_vote_state_request, GetContestedResourceVoteStateRequest, + }; + + #[test] + fn test_not_proved_vote_state_query_request_after_vote() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (pro_tx_hash_1, _masternode_1, signer_1, voting_key_1) = + setup_masternode_identity(&mut platform, 29, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer_1, + pro_tx_hash_1, + &voting_key_1, + 1, + None, + platform_version, + ); + + // Documents and Tally + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + + // Documents + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), None); + + assert_eq!(second_contender.vote_tally(), None); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + + // VoteTally + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + } + + #[test] + fn test_proved_vote_state_query_request_after_vote() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (pro_tx_hash_1, _masternode_1, signer_1, voting_key_1) = + setup_masternode_identity(&mut platform, 29, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer_1, + pro_tx_hash_1, + &voting_key_1, + 1, + None, + platform_version, + ); + + { + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + + { + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), None); + + assert_eq!(second_contender.vote_tally(), None); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + + { + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + } + + #[test] + fn test_not_proved_vote_state_query_request_after_many_votes() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + // DocumentsAndVoteTally + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + // Now let's not include locked and abstaining + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + false, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + + // Documents + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), None); + + assert_eq!(second_contender.vote_tally(), None); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + + // Now let's not include locked and abstaining + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + false, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), None); + + assert_eq!(second_contender.vote_tally(), None); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + + // VoteTally + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + // Now let's not include locked and abstaining + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + false, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + } + + #[test] + fn test_proved_vote_state_query_request_after_many_votes() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + // DocumentsAndVoteTally + { + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + // Now let's not include locked and abstaining + + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + false, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + + // Documents + { + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), None); + + assert_eq!(second_contender.vote_tally(), None); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + + // Now let's not include locked and abstaining + + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + false, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), None); + + assert_eq!(second_contender.vote_tally(), None); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + + // VoteTally + { + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + // Now let's not include locked and abstaining + + let (contenders, abstaining, locking, finished_info) = get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + false, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!(finished_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, None); + + assert_eq!(locking, None); + } + } + + fn get_vote_states_expect_error( + platform: &TempPlatform, + platform_state: &PlatformState, + dpns_contract: &DataContract, + index_values: Vec>, + count: Option, + allow_include_locked_and_abstaining_vote_tally: bool, + start_at_identifier_info: Option< + get_contested_resource_vote_state_request_v0::StartAtIdentifierInfo, + >, + result_type: ResultType, + prove: bool, + expected_error: &str, + platform_version: &PlatformVersion, + ) { + // Now let's run a query for the vote totals + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values, + result_type: result_type as i32, + allow_include_locked_and_abstaining_vote_tally, + start_at_identifier_info, + count, + prove, + }, + )), + }, + platform_state, + platform_version, + ) + .expect("expected to execute query"); + + assert_eq!( + query_validation_result + .first_error() + .expect("expected query to return error") + .to_string() + .as_str(), + expected_error + ); + } + + #[test] + fn test_vote_state_query_request_with_no_index_values_should_return_error() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + // DocumentsAndVoteTally + { + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + vec![], + None, + true, + None, + ResultType::DocumentsAndVoteTally, + false, + "invalid argument error: query uses index parentNameAndLabel, this index has 2 properties, but the query provided 0 index values instead", + platform_version, + ); + + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + vec![], + None, + true, + None, + ResultType::DocumentsAndVoteTally, + true, + "invalid argument error: query uses index parentNameAndLabel, this index has 2 properties, but the query provided 0 index values instead", + platform_version, + ); + } + + // Documents + { + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + vec![], + None, + true, + None, + ResultType::Documents, + false, + "invalid argument error: query uses index parentNameAndLabel, this index has 2 properties, but the query provided 0 index values instead", + platform_version, + ); + + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + vec![], + None, + true, + None, + ResultType::Documents, + true, + "invalid argument error: query uses index parentNameAndLabel, this index has 2 properties, but the query provided 0 index values instead", + platform_version, + ); + } + + // VoteTally + { + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + vec![], + None, + true, + None, + ResultType::VoteTally, + false, + "invalid argument error: query uses index parentNameAndLabel, this index has 2 properties, but the query provided 0 index values instead", + platform_version, + ); + + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + vec![], + None, + true, + None, + ResultType::VoteTally, + true, + "invalid argument error: query uses index parentNameAndLabel, this index has 2 properties, but the query provided 0 index values instead", + platform_version, + ); + } + } + + #[test] + fn test_vote_state_query_request_with_limit_too_high_should_return_error() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec( + Value::Text(convert_to_homograph_safe_chars("quantum")), + config, + ) + .expect("expected to encode the word quantum"); + + let index_values = vec![dash_encoded, quantum_encoded]; + + // DocumentsAndVoteTally + { + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + index_values.clone(), + Some(3000), + true, + None, + ResultType::DocumentsAndVoteTally, + false, + "invalid argument error: limit 3000 out of bounds of [1, 100]", + platform_version, + ); + + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + index_values.clone(), + Some(3000), + true, + None, + ResultType::DocumentsAndVoteTally, + true, + "invalid argument error: limit 3000 out of bounds of [1, 100]", + platform_version, + ); + } + + // Documents + { + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + index_values.clone(), + Some(3000), + true, + None, + ResultType::Documents, + false, + "invalid argument error: limit 3000 out of bounds of [1, 100]", + platform_version, + ); + + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + index_values.clone(), + Some(3000), + true, + None, + ResultType::Documents, + true, + "invalid argument error: limit 3000 out of bounds of [1, 100]", + platform_version, + ); + } + + // VoteTally + { + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + index_values.clone(), + Some(3000), + true, + None, + ResultType::VoteTally, + false, + "invalid argument error: limit 3000 out of bounds of [1, 100]", + platform_version, + ); + + get_vote_states_expect_error( + &platform, + &platform_state, + &dpns_contract, + index_values.clone(), + Some(3000), + true, + None, + ResultType::VoteTally, + true, + "invalid argument error: limit 3000 out of bounds of [1, 100]", + platform_version, + ); + } + } + + #[test] + fn test_vote_state_query_request_with_limit_4_should_return_4_contenders() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, _dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (contender_3, _contender_4, _dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + let (_contender_5, _contender_6, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (TowardsIdentity(contender_3.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + // DocumentsAndVoteTally + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(3), + false, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (3, None, None, None) + ); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(3), + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (3, Some(10), Some(3), None) + ); + } + + // Documents + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + false, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, None, None, None) + ); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + true, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, None, None, None) + ); + } + + // VoteTally + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(3), + false, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (3, None, None, None) + ); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(3), + true, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (3, Some(10), Some(3), None) + ); + } + } + + #[test] + fn test_proved_vote_state_query_request_with_limit_4_should_return_4_contenders() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, _dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (contender_3, _contender_4, _dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + let (_contender_5, _contender_6, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (TowardsIdentity(contender_3.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + // DocumentsAndVoteTally + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + false, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, None, None, None) + ); + + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, Some(10), Some(3), None) + ); + } + + // Documents + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + false, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, None, None, None) + ); + + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + true, + None, + ResultType::Documents, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, None, None, None) + ); + } + + // VoteTally + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + false, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, None, None, None) + ); + + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + Some(4), + true, + None, + ResultType::VoteTally, + platform_version, + ); + + assert_eq!( + (contenders.len(), abstaining, locking, finished_vote_info), + (4, Some(10), Some(3), None) + ); + } + } + } + + mod contestant_received_votes_query { + use super::*; + + fn get_contestant_votes( + platform: &TempPlatform, + platform_state: &PlatformState, + dpns_contract: &DataContract, + contender_id: Identifier, + name: &str, + count: Option, + order_ascending: bool, + start_at_identifier_info: Option< + get_contested_resource_voters_for_identity_request_v0::StartAtIdentifierInfo, + >, + should_be_finished: bool, + platform_version: &PlatformVersion, + ) -> Vec { + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec( + Value::Text(convert_to_homograph_safe_chars(name)), + config, + ) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_voters_for_identity( + GetContestedResourceVotersForIdentityRequest { + version: Some( + get_contested_resource_voters_for_identity_request::Version::V0( + GetContestedResourceVotersForIdentityRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![ + dash_encoded.clone(), + quantum_encoded.clone(), + ], + contestant_id: contender_id.to_vec(), + start_at_identifier_info, + count, + order_ascending, + prove: false, + }, + ), + ), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_voters_for_identity_response::Version::V0( + GetContestedResourceVotersForIdentityResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_voters_for_identity_response_v0::Result::ContestedResourceVoters( + get_contested_resource_voters_for_identity_response_v0::ContestedResourceVoters { + voters, + finished_results, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + if should_be_finished { + assert!(finished_results); + } + + voters + .into_iter() + .map(Identifier::from_vec) + .collect::, platform_value::Error>>() + .expect("expected all voters to be identifiers") + } + + fn get_proved_contestant_votes( + platform: &TempPlatform, + platform_state: &PlatformState, + dpns_contract: &DataContract, + contender_id: Identifier, + name: &str, + count: Option, + order_ascending: bool, + start_at_identifier_info: Option< + get_contested_resource_voters_for_identity_request_v0::StartAtIdentifierInfo, + >, + platform_version: &PlatformVersion, + ) -> Vec { + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec( + Value::Text(convert_to_homograph_safe_chars(name)), + config, + ) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_voters_for_identity( + GetContestedResourceVotersForIdentityRequest { + version: Some( + get_contested_resource_voters_for_identity_request::Version::V0( + GetContestedResourceVotersForIdentityRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![ + dash_encoded.clone(), + quantum_encoded.clone(), + ], + contestant_id: contender_id.to_vec(), + start_at_identifier_info, + count, + order_ascending, + prove: true, + }, + ), + ), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_voters_for_identity_response::Version::V0( + GetContestedResourceVotersForIdentityResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resource_voters_for_identity_response_v0::Result::Proof( + proof, + )) = result + else { + panic!("expected contenders") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedContestedDocumentVotePollVotesDriveQuery { + vote_poll: ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::BorrowedDataContract( + &dpns_contract, + ), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![ + Value::Text("dash".to_string()), + Value::Text("quantum".to_string()), + ], + }, + contestant_id: contender_id, + offset: None, + limit: None, + start_at: None, + order_ascending: true, + }; + + let (_, voters) = resolved_contested_document_vote_poll_drive_query + .verify_vote_poll_votes_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + voters + } + + #[test] + fn test_non_proved_contestant_votes_query_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (contender_3, _, _) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + platform_version, + ); + + for i in 0..50 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + for i in 0..5 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 100 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + for i in 0..8 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 200 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_3.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + let voters = get_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_1.id(), + "quantum", + None, + true, + None, + true, + platform_version, + ); + assert_eq!(voters.len(), 50); + + let voters_2 = get_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_2.id(), + "quantum", + None, + true, + None, + true, + platform_version, + ); + + assert_eq!(voters_2.len(), 5); + + let voters_3 = get_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_3.id(), + "quantum", + None, + true, + None, + true, + platform_version, + ); + + let mut voters_3_desc = get_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_3.id(), + "quantum", + None, + false, + None, + true, + platform_version, + ); + + voters_3_desc.reverse(); + + assert_eq!(voters_3, voters_3_desc); + + assert_eq!(voters_3.len(), 8); + + // let's add another 50 votes + for i in 0..50 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 400 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + let voters = get_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_1.id(), + "quantum", + None, + true, + None, + true, + platform_version, + ); + assert_eq!(voters.len(), 100); + + // let's add another vote + for i in 0..1 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 500 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + let voters = get_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_1.id(), + "quantum", + None, + true, + None, + false, + platform_version, + ); + assert_eq!(voters.len(), 100); + + let voters_reversed_30 = get_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_1.id(), + "quantum", + Some(30), + false, + Some(get_contested_resource_voters_for_identity_request_v0::StartAtIdentifierInfo { + start_identifier: voters.last().expect("expected a last voter").to_vec(), + start_identifier_included: true, + }), + false, + platform_version, + ); + assert_eq!(voters_reversed_30.len(), 30); + + let reversed_last_30_from_100_query: Vec<_> = + voters.split_at(70).1.iter().rev().cloned().collect(); + + assert_eq!(voters_reversed_30, reversed_last_30_from_100_query); + } + + #[test] + fn test_proved_contestant_votes_query_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (contender_3, _, _) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + platform_version, + ); + + for i in 0..50 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + for i in 0..5 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 100 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + for i in 0..8 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 200 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_3.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + let voters_1 = get_proved_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_1.id(), + "quantum", + None, + true, + None, + platform_version, + ); + + assert_eq!(voters_1.len(), 50); + + let voters_2 = get_proved_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_2.id(), + "quantum", + None, + true, + None, + platform_version, + ); + + assert_eq!(voters_2.len(), 5); + + let voters_3 = get_proved_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_3.id(), + "quantum", + None, + true, + None, + platform_version, + ); + + let mut voters_3_desc = get_proved_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_3.id(), + "quantum", + None, + false, + None, + platform_version, + ); + + voters_3_desc.reverse(); + + assert_eq!(voters_3, voters_3_desc); + + assert_eq!(voters_3.len(), 8); + } + } + + mod identity_given_votes_query { + use super::*; + use drive::query::{ + contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery, + contract_lookup_fn_for_contract, + }; + + fn get_identity_given_votes( + platform: &TempPlatform, + platform_state: &PlatformState, + contract: &DataContract, + identity_id: Identifier, + count: Option, + order_ascending: bool, + start_at_vote_poll_id_info: Option< + get_contested_resource_identity_votes_request_v0::StartAtVotePollIdInfo, + >, + should_be_finished: bool, + platform_version: &PlatformVersion, + ) -> Vec { + let query_validation_result = platform + .query_contested_resource_identity_votes( + GetContestedResourceIdentityVotesRequest { + version: Some( + get_contested_resource_identity_votes_request::Version::V0( + GetContestedResourceIdentityVotesRequestV0 { + identity_id: identity_id.to_vec(), + limit: count, + offset: None, + order_ascending, + start_at_vote_poll_id_info, + prove: false, + }, + ), + ), + }, + platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_identity_votes_response::Version::V0( + GetContestedResourceIdentityVotesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resource_identity_votes_response_v0::Result::Votes( + get_contested_resource_identity_votes_response_v0::ContestedResourceIdentityVotes { + contested_resource_identity_votes, finished_results, + }, + )) = result + else { + panic!("expected contenders") + }; + if should_be_finished { + assert!(finished_results); + } + + contested_resource_identity_votes + .into_iter() + .map(|vote| { + let get_contested_resource_identity_votes_response_v0::ContestedResourceIdentityVote { + contract_id, document_type_name, serialized_index_storage_values, vote_choice + } = vote; + let vote_choice = vote_choice.expect("expected a vote choice"); + let storage_form = ContestedDocumentResourceVoteStorageForm { + contract_id: contract_id.try_into().expect("expected 32 bytes"), + document_type_name, + index_values: serialized_index_storage_values, + resource_vote_choice: (vote_choice.vote_choice_type, vote_choice.identity_id).try_into()?, + }; + Ok(storage_form.resolve_with_contract(contract, platform_version)?) + }) + .collect::, Error>>() + .expect("expected all voters to be identifiers") + } + + fn get_proved_identity_given_votes( + platform: &TempPlatform, + platform_state: &PlatformState, + contract: &DataContract, + identity_id: Identifier, + count: Option, + order_ascending: bool, + start_at_vote_poll_id_info: Option< + get_contested_resource_identity_votes_request_v0::StartAtVotePollIdInfo, + >, + platform_version: &PlatformVersion, + ) -> Vec { + let query_validation_result = platform + .query_contested_resource_identity_votes( + GetContestedResourceIdentityVotesRequest { + version: Some( + get_contested_resource_identity_votes_request::Version::V0( + GetContestedResourceIdentityVotesRequestV0 { + identity_id: identity_id.to_vec(), + limit: count.map(|limit| limit as u32), + offset: None, + order_ascending, + start_at_vote_poll_id_info: start_at_vote_poll_id_info + .clone(), + prove: true, + }, + ), + ), + }, + platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_identity_votes_response::Version::V0( + GetContestedResourceIdentityVotesResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resource_identity_votes_response_v0::Result::Proof(proof)) = + result + else { + panic!("expected contenders") + }; + + let query = ContestedResourceVotesGivenByIdentityQuery { + identity_id, + offset: None, + limit: count, + start_at: start_at_vote_poll_id_info.map(|start_at_vote_poll_info| { + let included = start_at_vote_poll_info.start_poll_identifier_included; + ( + start_at_vote_poll_info + .start_at_poll_identifier + .try_into() + .expect("expected 32 bytes"), + included, + ) + }), + order_ascending, + }; + + query + .verify_identity_votes_given_proof::>( + proof.grovedb_proof.as_slice(), + &contract_lookup_fn_for_contract(Arc::new(contract.to_owned())), + platform_version, + ) + .expect("expected to verify proof") + .1 + .into_values() + .collect() + } + + #[test] + fn test_not_proved_identity_given_votes_query_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1_quantum, _contender_2_quantum, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (_contender_1_cooldog, contender_2_cooldog, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "cooldog", + platform_version, + ); + + let (_contender_1_superman, _contender_2_superman, dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "superman", + platform_version, + ); + + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10, platform_version); + + // Now let's perform a few votes + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1_quantum.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2_cooldog.id()), + "cooldog", + &signer, + pro_tx_hash, + &voting_key, + 2, + None, + platform_version, + ); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + ResourceVoteChoice::Lock, + "superman", + &signer, + pro_tx_hash, + &voting_key, + 3, + None, + platform_version, + ); + + let mut votes = get_identity_given_votes( + &platform, + &platform_state, + &dpns_contract, + pro_tx_hash, + None, + true, + None, + true, + platform_version, + ); + + assert_eq!(votes.len(), 3); + + let vote_0 = votes.remove(0); + let vote_1 = votes.remove(0); + let vote_2 = votes.remove(0); + + assert_eq!( + vote_0, + ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: dpns_contract.id(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("c001d0g".to_string()) + ] + } + ), + resource_vote_choice: TowardsIdentity(contender_2_cooldog.id()) + }) + ); + + assert_eq!( + vote_1, + ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: dpns_contract.id(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("superman".to_string()) + ] + } + ), + resource_vote_choice: Lock + }) + ); + + assert_eq!( + vote_2, + ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: dpns_contract.id(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + ), + resource_vote_choice: TowardsIdentity(contender_1_quantum.id()) + }) + ); + } + + #[test] + fn test_proved_identity_given_votes_query_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1_quantum, _contender_2_quantum, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (_contender_1_cooldog, contender_2_cooldog, _dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "cooldog", + platform_version, + ); + + let (_contender_1_superman, _contender_2_superman, dpns_contract) = + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "superman", + platform_version, + ); + + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10, platform_version); + + // Now let's perform a few votes + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1_quantum.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2_cooldog.id()), + "cooldog", + &signer, + pro_tx_hash, + &voting_key, + 2, + None, + platform_version, + ); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + ResourceVoteChoice::Lock, + "superman", + &signer, + pro_tx_hash, + &voting_key, + 3, + None, + platform_version, + ); + + let mut votes = get_proved_identity_given_votes( + &platform, + &platform_state, + &dpns_contract, + pro_tx_hash, + None, + true, + None, + platform_version, + ); + + assert_eq!(votes.len(), 3); + + let vote_0 = votes.remove(0); + let vote_1 = votes.remove(0); + let vote_2 = votes.remove(0); + + assert_eq!( + vote_0, + ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: dpns_contract.id(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("c001d0g".to_string()) + ] + } + ), + resource_vote_choice: TowardsIdentity(contender_2_cooldog.id()) + }) + ); + + assert_eq!( + vote_1, + ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: dpns_contract.id(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("superman".to_string()) + ] + } + ), + resource_vote_choice: Lock + }) + ); + + assert_eq!( + vote_2, + ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: dpns_contract.id(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + ), + resource_vote_choice: TowardsIdentity(contender_1_quantum.id()) + }) + ); + } + } + + mod end_date_query { + use super::*; + + #[test] + fn test_not_proved_end_date_query_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: None, + end_time_info: None, + limit: None, + offset: None, + ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::VotePollsByTimestamps( + get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamps { + vote_polls_by_timestamps, + finished_results, + }, + )) = result + else { + panic!("expected contenders") + }; + + assert!(finished_results); + + let serialized_contested_vote_poll_bytes = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, + 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, 100, + 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, 101, 65, + 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, 7, 113, 117, + 97, 110, 116, 117, 109, + ]; + + // The timestamp is 0 because there were no blocks + assert_eq!( + vote_polls_by_timestamps, + vec![SerializedVotePollsByTimestamp { + timestamp: 1_209_603_000, // in ms, 2 weeks after Jan 1 1970 + serialized_vote_polls: vec![serialized_contested_vote_poll_bytes.clone()] + }] + ); + + // Let's try deserializing + + let vote_poll = VotePoll::deserialize_from_bytes( + serialized_contested_vote_poll_bytes.as_slice(), + ) + .expect("expected to deserialize"); + + assert_eq!( + vote_poll, + VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, + 91, 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, + 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + ) + ); + } + + #[test] + fn test_proved_end_date_query_request() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: None, + end_time_info: None, + limit: None, + offset: None, + ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::Proof(proof)) = result + else { + panic!("expected contenders") + }; + + let vote_poll_by_end_date_query = VotePollsByEndDateDriveQuery { + start_time: None, + end_time: None, + offset: None, + limit: None, + order_ascending: true, + }; + + let (_, vote_polls_by_timestamps) = vote_poll_by_end_date_query + .verify_vote_polls_by_end_date_proof::>( + proof.grovedb_proof.as_ref(), + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!( + vote_polls_by_timestamps, + BTreeMap::from([( + 1_209_603_000, + vec![VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, + 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, + 191, 83, 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + )] + )]) + ); + } + + #[test] + fn test_not_proved_end_date_query_multiple_contests() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 500000, + height: 100, + core_height: 42, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create two new contenders, but we are on the same contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "coolio", + platform_version, + ); + + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: None, + end_time_info: None, + limit: None, + offset: None, + ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::VotePollsByTimestamps( + get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamps { + vote_polls_by_timestamps, + finished_results, + }, + )) = result + else { + panic!("expected contenders") + }; + + assert!(finished_results); + + let serialized_contested_vote_poll_bytes_1 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, + 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, 100, + 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, 101, 65, + 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, 7, 113, 117, + 97, 110, 116, 117, 109, + ]; + + let serialized_contested_vote_poll_bytes_2 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, + 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, 100, + 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, 101, 65, + 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, 6, 99, 48, 48, + 49, 49, 48, + ]; + + // The timestamp is 0 because there were no blocks + assert_eq!( + vote_polls_by_timestamps, + vec![ + SerializedVotePollsByTimestamp { + timestamp: 1_209_603_000, // in ms, 2 weeks after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_1.clone() + ] + }, + SerializedVotePollsByTimestamp { + timestamp: 1_210_103_000, // in ms, 500 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_2.clone() + ] + }, + ] + ); + + // Let's try deserializing + + let vote_poll_1 = VotePoll::deserialize_from_bytes( + serialized_contested_vote_poll_bytes_1.as_slice(), + ) + .expect("expected to deserialize"); + + assert_eq!( + vote_poll_1, + VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, + 91, 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, + 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + ) + ); + + // Let's try deserializing + + let vote_poll_2 = VotePoll::deserialize_from_bytes( + serialized_contested_vote_poll_bytes_2.as_slice(), + ) + .expect("expected to deserialize"); + + assert_eq!( + vote_poll_2, + VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, + 91, 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, + 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("c00110".to_string()) + ] + } + ) + ); + } + + #[test] + fn test_proved_end_date_query_multiple_contests() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 500000, + height: 100, + core_height: 42, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create two new contenders, but we are on the same contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "coolio", + platform_version, + ); + + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: None, + end_time_info: None, + limit: None, + offset: None, + ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::Proof(proof)) = result + else { + panic!("expected contenders") + }; + + let vote_poll_by_end_date_query = VotePollsByEndDateDriveQuery { + start_time: None, + end_time: None, + offset: None, + limit: None, + order_ascending: true, + }; + + let (_, vote_polls_by_timestamps) = vote_poll_by_end_date_query + .verify_vote_polls_by_end_date_proof::>( + proof.grovedb_proof.as_ref(), + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!( + vote_polls_by_timestamps, + BTreeMap::from([ + ( + 1_209_603_000, + vec![VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, + 222, 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, + 246, 34, 191, 83, 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + )] + ), + ( + 1_210_103_000, + vec![VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, + 222, 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, + 246, 34, 191, 83, 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("c00110".to_string()) + ] + } + )] + ) + ]) + ); + } + + #[test] + fn test_not_proved_end_date_query_multiple_contests_with_start_at() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 500000, + height: 100, + core_height: 42, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create two new contenders, but we are on the same contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "coolio", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 900000, + height: 150, + core_height: 45, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 10, + "crazyman", + platform_version, + ); + + // ascending order + { + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: Some( + get_vote_polls_by_end_date_request_v0::StartAtTimeInfo { + start_time_ms: 1_209_603_000, + start_time_included: false, + }, + ), + end_time_info: None, + limit: None, + offset: None, + ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::VotePollsByTimestamps( + get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamps { + vote_polls_by_timestamps, + finished_results, + }, + )) = result + else { + panic!("expected contenders") + }; + + assert!(finished_results); + + let serialized_contested_vote_poll_bytes_2 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, + 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, + 100, 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, + 101, 65, 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, + 6, 99, 48, 48, 49, 49, 48, + ]; + + let serialized_contested_vote_poll_bytes_3 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, + 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, + 100, 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, + 101, 65, 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, + 8, 99, 114, 97, 122, 121, 109, 97, 110, + ]; + + assert_eq!( + vote_polls_by_timestamps, + vec![ + SerializedVotePollsByTimestamp { + timestamp: 1_210_103_000, // in ms, 500 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_2.clone() + ] + }, + SerializedVotePollsByTimestamp { + timestamp: 1_210_503_000, // in ms, 900 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_3.clone() + ] + }, + ] + ); + } + + // descending order + { + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: Some( + get_vote_polls_by_end_date_request_v0::StartAtTimeInfo { + start_time_ms: 1_209_603_000, + start_time_included: false, + }, + ), + end_time_info: None, + limit: None, + offset: None, + ascending: false, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::VotePollsByTimestamps( + get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamps { + vote_polls_by_timestamps, + finished_results, + }, + )) = result + else { + panic!("expected contenders") + }; + + assert!(finished_results); + + let serialized_contested_vote_poll_bytes_2 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, + 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, + 100, 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, + 101, 65, 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, + 6, 99, 48, 48, 49, 49, 48, + ]; + + let serialized_contested_vote_poll_bytes_3 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, + 126, 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, + 100, 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, + 101, 65, 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, + 8, 99, 114, 97, 122, 121, 109, 97, 110, + ]; + + assert_eq!( + vote_polls_by_timestamps, + vec![ + SerializedVotePollsByTimestamp { + timestamp: 1_210_503_000, // in ms, 900 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_3.clone() + ] + }, + SerializedVotePollsByTimestamp { + timestamp: 1_210_103_000, // in ms, 500 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_2.clone() + ] + }, + ] + ); + } + } + + #[test] + fn test_not_proved_end_date_query_multiple_contests_with_end_at() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 500000, + height: 100, + core_height: 42, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create two new contenders, but we are on the same contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "coolio", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 900000, + height: 150, + core_height: 45, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 10, + "crazyman", + platform_version, + ); + + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: Some( + get_vote_polls_by_end_date_request_v0::StartAtTimeInfo { + start_time_ms: 1_209_603_000, + start_time_included: false, + }, + ), + end_time_info: Some( + get_vote_polls_by_end_date_request_v0::EndAtTimeInfo { + end_time_ms: 1_210_500_000, + end_time_included: true, + }, + ), + limit: None, + offset: None, + ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::VotePollsByTimestamps( + get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamps { + vote_polls_by_timestamps, + finished_results, + }, + )) = result + else { + panic!("expected contenders") + }; + + assert!(finished_results); + + let serialized_contested_vote_poll_bytes_2 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, + 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, 100, + 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, 101, 65, + 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, 6, 99, 48, 48, + 49, 49, 48, + ]; + + assert_eq!( + vote_polls_by_timestamps, + vec![SerializedVotePollsByTimestamp { + timestamp: 1_210_103_000, // in ms, 500 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![serialized_contested_vote_poll_bytes_2.clone()] + },] + ); + } + + #[test] + fn test_not_proved_end_date_query_multiple_contests_with_end_at_before_start_at() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 500000, + height: 100, + core_height: 42, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create two new contenders, but we are on the same contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "coolio", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 900000, + height: 150, + core_height: 45, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 10, + "crazyman", + platform_version, + ); + + platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: Some( + get_vote_polls_by_end_date_request_v0::StartAtTimeInfo { + start_time_ms: 1_209_603_000, + start_time_included: true, + }, + ), + end_time_info: Some( + get_vote_polls_by_end_date_request_v0::EndAtTimeInfo { + end_time_ms: 1_209_601_000, + end_time_included: true, + }, + ), + limit: None, + offset: None, + ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect_err("expected query to be invalid"); + + platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: Some( + get_vote_polls_by_end_date_request_v0::StartAtTimeInfo { + start_time_ms: 1_209_603_000, + start_time_included: true, + }, + ), + end_time_info: Some( + get_vote_polls_by_end_date_request_v0::EndAtTimeInfo { + end_time_ms: 1_209_603_000, + end_time_included: false, + }, + ), + limit: None, + offset: None, + ascending: true, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect_err("expected query to be invalid"); + } + + #[test] + fn test_not_proved_end_date_query_multiple_contests_with_start_at_ascending_false() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 500000, + height: 100, + core_height: 42, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create two new contenders, but we are on the same contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "coolio", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 900000, + height: 150, + core_height: 45, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 10, + "crazyman", + platform_version, + ); + + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: Some( + get_vote_polls_by_end_date_request_v0::StartAtTimeInfo { + start_time_ms: 1_209_603_000, + start_time_included: false, + }, + ), + end_time_info: None, + limit: None, + offset: None, + ascending: false, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::VotePollsByTimestamps( + get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamps { + vote_polls_by_timestamps, + finished_results, + }, + )) = result + else { + panic!("expected contenders") + }; + + assert!(finished_results); + + let serialized_contested_vote_poll_bytes_2 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, + 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, 100, + 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, 101, 65, + 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, 6, 99, 48, 48, + 49, 49, 48, + ]; + + let serialized_contested_vote_poll_bytes_3 = vec![ + 0, 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, + 10, 29, 113, 42, 9, 196, 13, 87, 33, 246, 34, 191, 83, 197, 49, 85, 6, 100, + 111, 109, 97, 105, 110, 18, 112, 97, 114, 101, 110, 116, 78, 97, 109, 101, 65, + 110, 100, 76, 97, 98, 101, 108, 2, 18, 4, 100, 97, 115, 104, 18, 8, 99, 114, + 97, 122, 121, 109, 97, 110, + ]; + + assert_eq!( + vote_polls_by_timestamps, + vec![ + SerializedVotePollsByTimestamp { + timestamp: 1_210_503_000, // in ms, 900 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_3.clone() + ] + }, + SerializedVotePollsByTimestamp { + timestamp: 1_210_103_000, // in ms, 500 s after Jan 1 1970 + 3 seconds (chosen block time in test) + serialized_vote_polls: vec![ + serialized_contested_vote_poll_bytes_2.clone() + ] + }, + ] + ); + } + + #[test] + fn test_proved_end_date_query_multiple_contests_with_start_at() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: BlockInfo { + time_ms: 500000, + height: 100, + core_height: 42, + epoch: Default::default(), + }, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + // we create two new contenders, but we are on the same contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 8, + "quantum", + platform_version, + ); + + // we create a new contest + create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "coolio", + platform_version, + ); + + // ascending order + { + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: None, + end_time_info: None, + limit: None, + offset: None, + ascending: true, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::Proof(proof)) = result + else { + panic!("expected contenders") + }; + + let vote_poll_by_end_date_query = VotePollsByEndDateDriveQuery { + start_time: None, + end_time: None, + offset: None, + limit: None, + order_ascending: true, + }; + + let (_, vote_polls_by_timestamps) = vote_poll_by_end_date_query + .verify_vote_polls_by_end_date_proof::>( + proof.grovedb_proof.as_ref(), + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!( + vote_polls_by_timestamps, + BTreeMap::from([ + ( + 1_209_603_000, + vec![VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, + 109, 222, 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, + 87, 33, 246, 34, 191, 83, 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + )] + ), + ( + 1_210_103_000, + vec![VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, + 109, 222, 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, + 87, 33, 246, 34, 191, 83, 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("c00110".to_string()) + ] + } + )] + ) + ]) + ); + } + + // descending order + { + let GetVotePollsByEndDateResponse { version } = platform + .query_vote_polls_by_end_date_query( + GetVotePollsByEndDateRequest { + version: Some(get_vote_polls_by_end_date_request::Version::V0( + GetVotePollsByEndDateRequestV0 { + start_time_info: None, + end_time_info: None, + limit: None, + offset: None, + ascending: false, + prove: true, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_vote_polls_by_end_date_response::Version::V0( + GetVotePollsByEndDateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_vote_polls_by_end_date_response_v0::Result::Proof(proof)) = result + else { + panic!("expected contenders") + }; + + let vote_poll_by_end_date_query = VotePollsByEndDateDriveQuery { + start_time: None, + end_time: None, + offset: None, + limit: None, + order_ascending: false, + }; + + let (_, vote_polls_by_timestamps) = vote_poll_by_end_date_query + .verify_vote_polls_by_end_date_proof::>( + proof.grovedb_proof.as_ref(), + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!( + vote_polls_by_timestamps, + BTreeMap::from([ + ( + 1_209_603_000, + vec![VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, + 109, 222, 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, + 87, 33, 246, 34, 191, 83, 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("quantum".to_string()) + ] + } + )] + ), + ( + 1_210_103_000, + vec![VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: Identifier(IdentifierBytes32([ + 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, + 109, 222, 123, 91, 126, 10, 29, 113, 42, 9, 196, 13, + 87, 33, 246, 34, 191, 83, 197, 49, 85 + ])), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Text("dash".to_string()), + Text("c00110".to_string()) + ] + } + )] + ) + ]) + ); + } + } + } + + mod prefunded_specialized_balance_query { + + use super::*; + + fn get_specialized_balance( + platform: &TempPlatform, + platform_state: &PlatformState, + dpns_contract: &DataContract, + name: &str, + platform_version: &PlatformVersion, + ) -> Credits { + let vote_poll = ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::BorrowedDataContract(dpns_contract), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Value::Text("dash".to_string()), + Value::Text(convert_to_homograph_safe_chars(name)), + ], + }; + + let specialized_balance_response = platform + .query_prefunded_specialized_balance( + GetPrefundedSpecializedBalanceRequest { + version: Some(get_prefunded_specialized_balance_request::Version::V0( + GetPrefundedSpecializedBalanceRequestV0 { + id: vote_poll + .specialized_balance_id() + .expect("expected a specialized balance id") + .to_vec(), + prove: false, + }, + )), + }, + platform_state, + platform_version, + ) + .expect("expected to be able to query specialized balance") + .into_data() + .expect("expected that the query would execute successfully"); + + let get_prefunded_specialized_balance_response::Version::V0( + GetPrefundedSpecializedBalanceResponseV0 { + metadata: _, + result, + }, + ) = specialized_balance_response + .version + .expect("expected a version"); + + let Some(get_prefunded_specialized_balance_response_v0::Result::Balance(balance)) = + result + else { + panic!("expected balance") + }; + balance + } + + fn get_proved_specialized_balance( + platform: &TempPlatform, + platform_state: &PlatformState, + dpns_contract: &DataContract, + name: &str, + platform_version: &PlatformVersion, + ) -> Credits { + let vote_poll = ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::BorrowedDataContract(dpns_contract), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Value::Text("dash".to_string()), + Value::Text(convert_to_homograph_safe_chars(name)), + ], + }; + + let balance_id = vote_poll + .specialized_balance_id() + .expect("expected a specialized balance id"); + + let specialized_balance_response = platform + .query_prefunded_specialized_balance( + GetPrefundedSpecializedBalanceRequest { + version: Some(get_prefunded_specialized_balance_request::Version::V0( + GetPrefundedSpecializedBalanceRequestV0 { + id: balance_id.to_vec(), + prove: true, + }, + )), + }, + platform_state, + platform_version, + ) + .expect("expected to be able to query specialized balance") + .into_data() + .expect("expected that the query would execute successfully"); + + let get_prefunded_specialized_balance_response::Version::V0( + GetPrefundedSpecializedBalanceResponseV0 { + metadata: _, + result, + }, + ) = specialized_balance_response + .version + .expect("expected a version"); + + let Some(get_prefunded_specialized_balance_response_v0::Result::Proof(proof)) = + result + else { + panic!("expected balance") + }; + + Drive::verify_specialized_balance( + proof.grovedb_proof.as_slice(), + balance_id.to_buffer(), + false, + platform_version, + ) + .expect("expected to verify balance") + .1 + .expect("expected balance to exist") + } + + #[test] + fn test_non_proved_prefunded_specialized_balance_request_after_many_votes() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let start_balance = get_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(start_balance, dash_to_credits!(0.4)); + + let (_contender_3, _contender_4, _) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + platform_version, + ); + + let start_balance_after_more_contenders = get_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(start_balance_after_more_contenders, dash_to_credits!(0.8)); + + for i in 0..50 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + let balance_after_50_votes = get_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(balance_after_50_votes, dash_to_credits!(0.795)); + + for i in 0..5 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 100 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + let balance_after_55_votes = get_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(balance_after_55_votes, dash_to_credits!(0.7945)); + } + + #[test] + fn test_proved_prefunded_specialized_balance_request_after_many_votes() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let start_balance = get_proved_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(start_balance, dash_to_credits!(0.4)); + + let (_contender_3, _contender_4, _) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 9, + "quantum", + platform_version, + ); + + let start_balance_after_more_contenders = get_proved_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(start_balance_after_more_contenders, dash_to_credits!(0.8)); + + for i in 0..50 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + let balance_after_50_votes = get_proved_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(balance_after_50_votes, dash_to_credits!(0.795)); + + for i in 0..5 { + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 100 + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + } + + let balance_after_55_votes = get_proved_specialized_balance( + &platform, + &platform_state, + dpns_contract.as_ref(), + "quantum", + platform_version, + ); + + assert_eq!(balance_after_55_votes, dash_to_credits!(0.7945)); + } + } + + mod document_distribution { + use super::*; + use crate::execution::validation::state_transition::tests::create_dpns_contract_name_contest; + + #[test] + fn test_document_distribution() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_1.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + } + + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(( + ContestedDocumentVotePollWinnerInfo::WonByIdentity(contender_1.id()), + block_info + )) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + } + } + + #[test] + fn test_document_distribution_abstain_very_high() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 60), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(60)); + + assert_eq!(locking, Some(3)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_1.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(60)); + + assert_eq!(locking, Some(3)); + } + + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(( + ContestedDocumentVotePollWinnerInfo::WonByIdentity(contender_1.id()), + block_info + )) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(60)); + + assert_eq!(locking, Some(3)); + } + } + + #[test] + fn test_document_distribution_low_votes() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 1), + (TowardsIdentity(contender_2.id()), 1), + (ResourceVoteChoice::Abstain, 1), + (ResourceVoteChoice::Lock, 1), + ], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(1)); + + assert_eq!(abstaining, Some(1)); + + assert_eq!(locking, Some(1)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_1.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(1)); + + assert_eq!(abstaining, Some(1)); + + assert_eq!(locking, Some(1)); + } + + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(( + ContestedDocumentVotePollWinnerInfo::WonByIdentity(contender_1.id()), + block_info + )) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(1)); + + assert_eq!(abstaining, Some(1)); + + assert_eq!(locking, Some(1)); + } + } + + #[test] + fn test_document_distribution_single_vote() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![(TowardsIdentity(contender_1.id()), 1)], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_1.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(( + ContestedDocumentVotePollWinnerInfo::WonByIdentity(contender_1.id()), + block_info + )) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(1)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + } + + #[test] + fn test_document_distribution_no_votes() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(0)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + false, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_1.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(0)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(( + ContestedDocumentVotePollWinnerInfo::WonByIdentity(contender_1.id()), + block_info + )) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(0)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + + assert_eq!(abstaining, Some(0)); + + assert_eq!(locking, Some(0)); + } + } + + #[test] + fn test_document_locking() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 20), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 60), + ], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(20)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(60)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: finished_vote_info::FinishedVoteOutcome::Locked + as i32, + won_by_identity_id: None, + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(20)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(60)); + } + + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some((ContestedDocumentVotePollWinnerInfo::Locked, block_info)) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(20)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(60)); + } + } + + #[test] + fn test_new_vote_after_document_distribution() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + // now let's try to do another vote + + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 5000, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 2, + Some("VotePoll ContestedDocumentResourceVotePoll(ContestedDocumentResourceVotePoll { contract_id: GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec, document_type_name: domain, index_name: parentNameAndLabel, index_values: [string dash, string quantum] }) not available for voting: Awarded(BjNejy4r9QAvLHpQ9Yq6yRMgNymeGZ46d48fJxJbMrfW)"), + platform_version, + ); + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_1.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + } + } + + #[test] + fn test_new_vote_after_lock() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 2), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 50), + ], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(2)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(50)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + // now let's try to do another vote + + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 5000, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 2, + Some("VotePoll ContestedDocumentResourceVotePoll(ContestedDocumentResourceVotePoll { contract_id: GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec, document_type_name: domain, index_name: parentNameAndLabel, index_values: [string dash, string quantum] }) not available for voting: Locked"), + platform_version, + ); + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: finished_vote_info::FinishedVoteOutcome::Locked + as i32, + won_by_identity_id: None, + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(2)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(50)); + } + } + + #[test] + fn test_document_distribution_to_contract() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_contract_name_contest( + &mut platform, + &platform_state, + 600, + "cards", + platform_version, + ); + + perform_votes_multi( + &mut platform, + &dpns_contract, + vec![ + (TowardsIdentity(contender_1.id()), 50), + (TowardsIdentity(contender_2.id()), 5), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "cards", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "cards", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 1. + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "cards", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_1.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + } + + { + let (contenders, abstaining, locking, finished_vote_info) = + get_proved_vote_states( + &platform, + &platform_state, + &dpns_contract, + "cards", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(( + ContestedDocumentVotePollWinnerInfo::WonByIdentity(contender_1.id()), + block_info + )) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(50)); + + assert_eq!(second_contender.vote_tally(), Some(5)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + } + } + } + mod changing_vote { + use super::*; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice::Abstain; + #[test] + fn test_masternode_vote_again_same_vote_should_return_error() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, _contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 2, + Some("Masternode vote is already present for masternode 4iroeiNBeBYZetCt21kW7FGyczE8WqoqzZ48YAHwyV7R voting for ContestedDocumentResourceVotePoll(ContestedDocumentResourceVotePoll { contract_id: GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec, document_type_name: domain, index_name: parentNameAndLabel, index_values: [string dash, string quantum] })"), + platform_version, + ); + } + + #[test] + fn test_masternode_vote_again_different_choice() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 2, + None, + platform_version, + ); + + let (contenders, _abstaining, _locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(0)); + + assert_eq!(second_contender.vote_tally(), Some(1)); + } + + #[test] + fn test_masternode_vote_again_different_choice_too_many_times() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let (pro_tx_hash, _masternode, signer, voting_key) = + setup_masternode_identity(&mut platform, 10, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 1, + None, + platform_version, + ); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 2, + None, + platform_version, + ); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + Lock, + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 3, + None, + platform_version, + ); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + Abstain, + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 4, + None, + platform_version, + ); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_1.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 5, + None, + platform_version, + ); + + perform_vote( + &mut platform, + &platform_state, + dpns_contract.as_ref(), + TowardsIdentity(contender_2.id()), + "quantum", + &signer, + pro_tx_hash, + &voting_key, + 6, + Some("Masternode with id: 4iroeiNBeBYZetCt21kW7FGyczE8WqoqzZ48YAHwyV7R already voted 5 times and is trying to vote again, they can only vote 5 times"), + platform_version, + ); + } + } + mod masternodes_being_removed { + use super::*; + use crate::execution::validation::state_transition::state_transitions::tests::take_down_masternode_identities; + + #[test] + fn test_masternode_vote_removals() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + + let (contender_1, contender_2, dpns_contract) = create_dpns_identity_name_contest( + &mut platform, + &platform_state, + 7, + "quantum", + platform_version, + ); + + let masternodes_by_vote_choice = perform_votes_multi( + &mut platform, + dpns_contract.as_ref(), + vec![ + (TowardsIdentity(contender_1.id()), 20), + (TowardsIdentity(contender_2.id()), 12), + (ResourceVoteChoice::Abstain, 10), + (ResourceVoteChoice::Lock, 3), + ], + "quantum", + 10, + platform_version, + ); + + let platform_state = platform.state.load(); + + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!(finished_vote_info, None); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_ne!(first_contender.document(), second_contender.document()); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(20)); + + assert_eq!(second_contender.vote_tally(), Some(12)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + + // now let's take down some masternodes + + let voting_for_contender_1 = masternodes_by_vote_choice + .get(&TowardsIdentity(contender_1.id())) + .expect("expected a vector of 50 masternode identities") + .iter() + .take(10) + .map(|(pro_tx_hash, _, _, _)| *pro_tx_hash) + .collect(); + + let platform_state_before_masternode_identity_removals = + platform_state.as_ref().clone(); + + take_down_masternode_identities(&mut platform, &voting_for_contender_1); + + let block_platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .remove_votes_for_removed_masternodes( + &platform_state_before_masternode_identity_removals, + &block_platform_state, + Some(&transaction), + platform_version, + ) + .expect("expected to remove votes for removed masternodes"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // let's fast-forward to make sure it's properly distributed + + let mut platform_state = (**platform_state).clone(); + + let block_info = BlockInfo { + time_ms: 1_209_900_000, //2 weeks and 300s + height: 10000, + core_height: 42, + epoch: Default::default(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state)); + + let platform_state = platform.state.load(); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .check_for_ended_vote_polls( + &platform_state, + &block_info, + Some(&transaction), + platform_version, + ) + .expect("expected to check for ended vote polls"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // At this point the document should have been awarded to contender 2. + + { + let (contenders, abstaining, locking, finished_vote_info) = get_vote_states( + &platform, + &platform_state, + &dpns_contract, + "quantum", + None, + true, + None, + ResultType::DocumentsAndVoteTally, + platform_version, + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: + finished_vote_info::FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(contender_2.id().to_vec()), + finished_at_block_height: 10000, + finished_at_core_block_height: 42, + finished_at_block_time_ms: 1209900000, + finished_at_epoch: 0 + }) + ); + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.document(), &None); + + assert_eq!(second_contender.document(), &None); + + assert_eq!(first_contender.identity_id(), contender_1.id()); + + assert_eq!(second_contender.identity_id(), contender_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(10)); + + assert_eq!(second_contender.vote_tally(), Some(12)); + + assert_eq!(abstaining, Some(10)); + + assert_eq!(locking, Some(3)); + } + } + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/nonce/mod.rs new file mode 100644 index 00000000000..216c68a1ecb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::masternode_vote::nonce::v0::MasternodeVoteTransitionIdentityNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for MasternodeVoteTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .masternode_vote_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "masternode vote transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "masternode vote transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/nonce/v0/mod.rs new file mode 100644 index 00000000000..bdb92a5a716 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/nonce/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait MasternodeVoteTransitionIdentityNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl MasternodeVoteTransitionIdentityNonceV0 for MasternodeVoteTransition { + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let pro_tx_hash_identity_id = self.pro_tx_hash(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + pro_tx_hash_identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, pro_tx_hash_identity_id) + } else { + validate_new_identity_nonce(revision_nonce, pro_tx_hash_identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/state/mod.rs new file mode 100644 index 00000000000..9a1925de7fc --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/state/mod.rs @@ -0,0 +1 @@ +pub(crate) mod v0; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/state/v0/mod.rs new file mode 100644 index 00000000000..cde77903a56 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/state/v0/mod.rs @@ -0,0 +1,99 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::consensus::state::state_error::StateError; +use dpp::consensus::state::voting::vote_poll_not_available_for_voting_error::VotePollNotAvailableForVotingError; +use dpp::consensus::state::voting::vote_poll_not_found_error::VotePollNotFoundError; +use dpp::consensus::ConsensusError; + +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; + +use crate::error::execution::ExecutionError; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::{ + ContestedDocumentVotePollStatus, ContestedDocumentVotePollStoredInfoV0Getters, +}; +use drive::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use drive::drive::votes::resolved::votes::resolved_resource_vote::accessors::v0::ResolvedResourceVoteGettersV0; +use drive::drive::votes::resolved::votes::ResolvedVote; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition::state_transitions::masternode_vote) trait MasternodeVoteStateTransitionStateValidationV0 +{ + fn validate_state_v0( + &self, + action: Option, + platform: &PlatformRef, + tx: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl MasternodeVoteStateTransitionStateValidationV0 for MasternodeVoteTransition { + fn validate_state_v0( + &self, + action: Option, + platform: &PlatformRef, + tx: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(StateTransitionAction::MasternodeVoteAction(masternode_vote_action)) = action + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "action should be known in validate state for masternode vote transition", + ))); + }; + + // We need to make sure that the vote poll exists and is in started state + match masternode_vote_action.vote_ref() { + ResolvedVote::ResolvedResourceVote(resource_vote) => { + let vote_poll = resource_vote.vote_poll(); + match vote_poll { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll, + ) => { + let Some(stored_info) = platform + .drive + .fetch_contested_document_vote_poll_stored_info( + contested_document_resource_vote_poll, + None, + tx, + platform_version, + )? + .1 + else { + return Ok(ConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::VotePollNotFoundError( + VotePollNotFoundError::new(vote_poll.into()), + )), + )); + }; + let vote_poll_status = stored_info.vote_poll_status(); + match &vote_poll_status { + ContestedDocumentVotePollStatus::NotStarted + | ContestedDocumentVotePollStatus::Awarded(_) + | ContestedDocumentVotePollStatus::Locked => { + Ok(ConsensusValidationResult::new_with_error( + ConsensusError::StateError( + StateError::VotePollNotAvailableForVotingError( + VotePollNotAvailableForVotingError::new( + vote_poll.into(), + vote_poll_status, + ), + ), + ), + )) + } + ContestedDocumentVotePollStatus::Started(_) => { + Ok(ConsensusValidationResult::new_with_data( + masternode_vote_action.into(), + )) + } + } + } + } + } + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/transform_into_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/transform_into_action/mod.rs new file mode 100644 index 00000000000..9a1925de7fc --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/transform_into_action/mod.rs @@ -0,0 +1 @@ +pub(crate) mod v0; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/transform_into_action/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/transform_into_action/v0/mod.rs new file mode 100644 index 00000000000..b49fbe56eaa --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/transform_into_action/v0/mod.rs @@ -0,0 +1,138 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dashcore_rpc::dashcore_rpc_json::MasternodeType; +use dpp::consensus::state::state_error::StateError; +use dpp::consensus::state::voting::masternode_not_found_error::MasternodeNotFoundError; +use dpp::consensus::state::voting::masternode_vote_already_present_error::MasternodeVoteAlreadyPresentError; +use dpp::consensus::state::voting::masternode_voted_too_many_times::MasternodeVotedTooManyTimesError; +use dpp::consensus::ConsensusError; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::ProTxHash; + +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use drive::state_transition_action::identity::masternode_vote::MasternodeVoteTransitionAction; + +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; +use dpp::voting::votes::Vote; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions::masternode_vote) trait MasternodeVoteStateTransitionTransformIntoActionValidationV0 +{ + fn transform_into_action_v0( + &self, + platform: &PlatformRef, + validation_mode: ValidationMode, + tx: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl MasternodeVoteStateTransitionTransformIntoActionValidationV0 for MasternodeVoteTransition { + fn transform_into_action_v0( + &self, + platform: &PlatformRef, + validation_mode: ValidationMode, + tx: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut previous_resource_vote_choice_to_remove = None; + if validation_mode != ValidationMode::NoValidation { + // Before we transform into action we want to make sure that we have not yet voted + match self.vote() { + Vote::ResourceVote(resource_vote) => { + match resource_vote.vote_poll() { + VotePoll::ContestedDocumentResourceVotePoll(vote_poll) => { + let vote_id = vote_poll.unique_id()?; + let maybe_existing_resource_vote_choice = + platform.drive.fetch_identity_contested_resource_vote( + self.pro_tx_hash(), + vote_id, + tx, + &mut vec![], + platform_version, + )?; + if let Some((existing_resource_vote_choice, previous_vote_count)) = + maybe_existing_resource_vote_choice + { + if existing_resource_vote_choice + == resource_vote.resource_vote_choice() + { + // We are submitting a vote for something we already have + return Ok(ConsensusValidationResult::new_with_error( + ConsensusError::StateError( + StateError::MasternodeVoteAlreadyPresentError( + MasternodeVoteAlreadyPresentError::new( + self.pro_tx_hash(), + resource_vote.vote_poll().clone(), + ), + ), + ), + )); + } else if previous_vote_count + >= platform_version + .dpp + .validation + .voting + .votes_allowed_per_masternode + { + // We are submitting a vote for something we already have + return Ok(ConsensusValidationResult::new_with_error( + ConsensusError::StateError( + StateError::MasternodeVotedTooManyTimesError( + MasternodeVotedTooManyTimesError::new( + self.pro_tx_hash(), + previous_vote_count, + platform_version + .dpp + .validation + .voting + .votes_allowed_per_masternode, + ), + ), + ), + )); + } else { + previous_resource_vote_choice_to_remove = + Some((existing_resource_vote_choice, previous_vote_count)); + } + } + } + } + } + } + } + + let Some(masternode) = platform + .state + .full_masternode_list() + .get(&ProTxHash::from_byte_array(self.pro_tx_hash().to_buffer())) + else { + return Ok(ConsensusValidationResult::new_with_error( + MasternodeNotFoundError::new(self.pro_tx_hash()).into(), + )); + }; + + let strength = match masternode.node_type { + MasternodeType::Regular => 1, + MasternodeType::Evo => 4, + }; + + Ok(ConsensusValidationResult::new_with_data( + MasternodeVoteTransitionAction::transform_from_transition( + self, + masternode.state.voting_address, + strength, + previous_resource_vote_choice_to_remove, + platform.drive, + tx, + platform_version, + )?, + )) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs index 39b3dee515e..00f0933f5cf 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs @@ -21,3 +21,2036 @@ pub mod data_contract_create; /// Module for updating an existing data contract entity. pub mod data_contract_update; + +/// Module for voting from a masternode. +pub mod masternode_vote; + +/// The validation mode we are using +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum ValidationMode { + /// The basic checktx before the state transition is put into mempool + CheckTx, + /// Rechecking a state transition every block + RecheckTx, + /// The validation during block execution by a proposer or validator + Validator, + /// A validation mode used to get the action with no validation + NoValidation, +} + +impl ValidationMode { + /// Can this validation mode alter cache on drive? + pub fn can_alter_cache(&self) -> bool { + match self { + ValidationMode::CheckTx => false, + ValidationMode::RecheckTx => false, + ValidationMode::Validator => true, + ValidationMode::NoValidation => false, + } + } +} + +#[cfg(test)] +pub(crate) mod tests { + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TempPlatform; + use dpp::block::block_info::BlockInfo; + use dpp::fee::Credits; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0, KeyID, KeyType, Purpose, SecurityLevel}; + use dpp::prelude::{Identifier, IdentityNonce}; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::{Rng, SeedableRng}; + use simple_signer::signer::SimpleSigner; + use std::collections::BTreeMap; + use std::net::{IpAddr, Ipv4Addr, SocketAddr}; + use std::ops::Deref; + use std::sync::Arc; + use arc_swap::Guard; + use assert_matches::assert_matches; + use dashcore_rpc::dashcore_rpc_json::{DMNState, MasternodeListItem, MasternodeType}; + use dapi_grpc::platform::v0::{get_contested_resource_vote_state_request, get_contested_resource_vote_state_response, GetContestedResourceVoteStateRequest, GetContestedResourceVoteStateResponse}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0::ResultType; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::{get_contested_resource_vote_state_request_v0, GetContestedResourceVoteStateRequestV0}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::{get_contested_resource_vote_state_response_v0, GetContestedResourceVoteStateResponseV0}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::FinishedVoteInfo; + use dpp::dash_to_credits; + use dpp::dashcore::{ProTxHash, Txid}; + use dpp::dashcore::hashes::Hash; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::DataContract; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use dpp::data_contract::document_type::random_document::{CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType}; + use dpp::document::{Document, DocumentV0Getters, DocumentV0Setters}; + use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; + use dpp::fee::fee_result::FeeResult; + use dpp::identifier::MasternodeIdentifiers; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::contract_bounds::ContractBounds; + use dpp::identity::hash::IdentityPublicKeyHashMethodsV0; + use dpp::platform_value::{Bytes32, Value}; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; + use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; + use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; + use dpp::state_transition::masternode_vote_transition::methods::MasternodeVoteTransitionMethodsV0; + use dpp::state_transition::StateTransition; + use dpp::util::hash::hash_double; + use dpp::util::strings::convert_to_homograph_safe_chars; + use dpp::voting::contender_structs::{Contender, ContenderV0}; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + use dpp::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; + use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; + use dpp::voting::vote_polls::VotePoll; + use dpp::voting::votes::resource_vote::ResourceVote; + use dpp::voting::votes::resource_vote::v0::ResourceVoteV0; + use dpp::voting::votes::Vote; + use drive::util::object_size_info::DataContractResolvedInfo; + use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; + use drive::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally; + use drive::query::vote_poll_vote_state_query::{ContestedDocumentVotePollDriveQueryResultType, ResolvedContestedDocumentVotePollDriveQuery}; + use drive::util::test_helpers::setup_contract; + use crate::execution::types::block_execution_context::BlockExecutionContext; + use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; + use crate::expect_match; + use crate::platform_types::platform_state::PlatformState; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult::{SuccessfulExecution, UnpaidConsensusError}; + use crate::execution::types::block_state_info::BlockStateInfo; + use crate::execution::types::block_state_info::v0::BlockStateInfoV0; + use crate::platform_types::epoch_info::EpochInfo; + use crate::platform_types::epoch_info::v0::EpochInfoV0; + use crate::execution::types::block_fees::v0::BlockFeesV0; + use crate::execution::types::processed_block_fees_outcome::v0::ProcessedBlockFeesOutcome; + + /// We add an identity, but we also add the same amount to system credits + pub(crate) fn setup_identity_with_system_credits( + platform: &mut TempPlatform, + seed: u64, + credits: Credits, + ) -> (Identity, SimpleSigner, IdentityPublicKey) { + let platform_version = PlatformVersion::latest(); + platform + .drive + .add_to_system_credits(credits, None, platform_version) + .expect("expected to add to system credits"); + setup_identity(platform, seed, credits) + } + + pub(crate) fn setup_identity( + platform: &mut TempPlatform, + seed: u64, + credits: Credits, + ) -> (Identity, SimpleSigner, IdentityPublicKey) { + let platform_version = PlatformVersion::latest(); + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key_with_rng( + 0, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key_with_rng( + 1, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let identity: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + ]), + balance: credits, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + (identity, signer, critical_public_key) + } + + pub(crate) fn setup_identity_return_master_key( + platform: &mut TempPlatform, + seed: u64, + credits: Credits, + ) -> (Identity, SimpleSigner, IdentityPublicKey) { + let platform_version = PlatformVersion::latest(); + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key_with_rng( + 0, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key_with_rng( + 1, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let identity: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + ]), + balance: credits, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + (identity, signer, master_key) + } + + pub(crate) fn setup_add_key_to_identity( + platform: &mut TempPlatform, + identity: &mut Identity, + signer: &mut SimpleSigner, + seed: u64, + key_id: KeyID, + purpose: Purpose, + security_level: SecurityLevel, + key_type: KeyType, + contract_bounds: Option, + ) -> IdentityPublicKey { + let platform_version = PlatformVersion::latest(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (key, private_key) = IdentityPublicKey::random_key_with_known_attributes( + key_id, + &mut rng, + purpose, + security_level, + key_type, + contract_bounds, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + identity.add_public_key(key.clone()); + + platform + .drive + .add_new_unique_keys_to_identity( + identity.id().to_buffer(), + vec![key.clone()], + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new key"); + + key + } + + pub(crate) fn setup_identity_with_withdrawal_key_and_system_credits( + platform: &mut TempPlatform, + seed: u64, + credits: Credits, + ) -> (Identity, SimpleSigner, IdentityPublicKey, IdentityPublicKey) { + let platform_version = PlatformVersion::latest(); + platform + .drive + .add_to_system_credits(credits, None, platform_version) + .expect("expected to add to system credits"); + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key_with_rng( + 0, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key_with_rng( + 1, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let (withdrawal_public_key, withdrawal_private_key) = + IdentityPublicKey::random_key_with_known_attributes( + 2, + &mut rng, + Purpose::TRANSFER, + SecurityLevel::CRITICAL, + KeyType::ECDSA_SECP256K1, + None, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key( + withdrawal_public_key.clone(), + withdrawal_private_key.clone(), + ); + + let identity: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + (2, withdrawal_public_key.clone()), + ]), + balance: credits, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + (identity, signer, critical_public_key, withdrawal_public_key) + } + + pub(crate) fn process_state_transitions( + platform: &TempPlatform, + state_transitions: &[StateTransition], + block_info: BlockInfo, + platform_state: &PlatformState, + ) -> (Vec, ProcessedBlockFeesOutcome) { + let platform_version = PlatformVersion::latest(); + + let raw_state_transitions = state_transitions + .iter() + .map(|a| a.serialize_to_bytes().expect("expected to serialize")) + .collect(); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &raw_state_transitions, + &platform_state, + &block_info, + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + let fee_results = processing_result.execution_results().iter().map(|result| { + let fee_result = expect_match!(result, StateTransitionExecutionResult::SuccessfulExecution(_, fee_result) => fee_result); + fee_result.clone() + }).collect(); + + // while we have the state transitions executed, we now need to process the block fees + let block_fees_v0: BlockFeesV0 = processing_result.aggregated_fees().clone().into(); + + let block_execution_context = BlockExecutionContext::V0(BlockExecutionContextV0 { + block_state_info: BlockStateInfo::V0(BlockStateInfoV0 { + height: block_info.height, + round: 0, + block_time_ms: block_info.time_ms, + previous_block_time_ms: platform_state.last_committed_block_time_ms(), + proposer_pro_tx_hash: Default::default(), + core_chain_locked_height: 0, + block_hash: None, + app_hash: None, + }), + epoch_info: EpochInfo::V0(EpochInfoV0::default()), + hpmn_count: 0, + unsigned_withdrawal_transactions: Default::default(), + block_platform_state: platform_state.clone(), + proposer_results: None, + }); + + // Process fees + let processed_block_fees = platform + .process_block_fees( + &block_execution_context, + block_fees_v0.into(), + &transaction, + platform_version, + ) + .expect("expected to process block fees"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + (fee_results, processed_block_fees) + } + + pub(crate) fn fetch_expected_identity_balance( + platform: &TempPlatform, + identity_id: Identifier, + platform_version: &PlatformVersion, + expected_balance: Credits, + ) { + assert_eq!( + expected_balance, + platform + .drive + .fetch_identity_balance(identity_id.to_buffer(), None, platform_version) + .expect("expected to be able to fetch balance") + .expect("expected a balance") + ); + } + pub(crate) fn setup_masternode_identity( + platform: &mut TempPlatform, + seed: u64, + platform_version: &PlatformVersion, + ) -> (Identifier, Identity, SimpleSigner, IdentityPublicKey) { + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (voting_key, voting_private_key) = + IdentityPublicKey::random_voting_key_with_rng(0, &mut rng, platform_version) + .expect("expected to get key pair"); + + signer.add_key(voting_key.clone(), voting_private_key.clone()); + + let pro_tx_hash_bytes: [u8; 32] = rng.gen(); + + let voting_address = voting_key + .public_key_hash() + .expect("expected a public key hash"); + + let voter_identifier = + Identifier::create_voter_identifier(&pro_tx_hash_bytes, &voting_address); + + let identity: Identity = IdentityV0 { + id: voter_identifier, + public_keys: BTreeMap::from([(0, voting_key.clone())]), + balance: 0, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity.clone(), + true, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + let mut platform_state = platform.state.load().clone().deref().clone(); + + let pro_tx_hash = ProTxHash::from_byte_array(pro_tx_hash_bytes); + + let random_ip = Ipv4Addr::new( + rng.gen_range(0..255), + rng.gen_range(0..255), + rng.gen_range(0..255), + rng.gen_range(0..255), + ); + + platform_state.full_masternode_list_mut().insert( + pro_tx_hash, + MasternodeListItem { + node_type: MasternodeType::Regular, + pro_tx_hash, + collateral_hash: Txid::from_byte_array(rng.gen()), + collateral_index: 0, + collateral_address: rng.gen(), + operator_reward: 0.0, + state: DMNState { + service: SocketAddr::new(IpAddr::V4(random_ip), 19999), + registered_height: 0, + pose_revived_height: None, + pose_ban_height: None, + revocation_reason: 0, + owner_address: rng.gen(), + voting_address, + payout_address: rng.gen(), + pub_key_operator: vec![], + operator_payout_address: None, + platform_node_id: None, + platform_p2p_port: None, + platform_http_port: None, + }, + }, + ); + + platform.state.store(Arc::new(platform_state)); + + (pro_tx_hash_bytes.into(), identity, signer, voting_key) + } + + pub(crate) fn take_down_masternode_identities( + platform: &mut TempPlatform, + masternode_identities: &Vec, + ) { + let mut platform_state = platform.state.load().clone().deref().clone(); + + let list = platform_state.full_masternode_list_mut(); + + for masternode_identifiers in masternode_identities { + let pro_tx_hash = ProTxHash::from_byte_array(masternode_identifiers.to_buffer()); + + list.remove(&pro_tx_hash); + } + + platform.state.store(Arc::new(platform_state)); + } + + pub(crate) fn create_dpns_name_contest_give_key_info( + platform: &mut TempPlatform, + platform_state: &PlatformState, + seed: u64, + name: &str, + platform_version: &PlatformVersion, + ) -> ( + ( + Identity, + SimpleSigner, + IdentityPublicKey, + (Document, Bytes32), + (Document, Bytes32), + ), + ( + Identity, + SimpleSigner, + IdentityPublicKey, + (Document, Bytes32), + (Document, Bytes32), + ), + Arc, + ) { + let mut rng = StdRng::seed_from_u64(seed); + + let identity_1_info = setup_identity(platform, rng.gen(), dash_to_credits!(0.5)); + + let identity_2_info = setup_identity(platform, rng.gen(), dash_to_credits!(0.5)); + + // Flip them if needed so identity 1 id is always smaller than identity 2 id + let (identity_1_info, identity_2_info) = if identity_1_info.0.id() < identity_2_info.0.id() + { + (identity_1_info, identity_2_info) + } else { + (identity_2_info, identity_1_info) + }; + + let ((preorder_document_1, document_1), (preorder_document_2, document_2), dpns_contract) = + create_dpns_name_contest_on_identities( + platform, + &identity_1_info, + &identity_2_info, + platform_state, + rng, + name, + platform_version, + ); + + let (identity_1, signer_1, identity_key_1) = identity_1_info; + + let (identity_2, signer_2, identity_key_2) = identity_2_info; + + ( + ( + identity_1, + signer_1, + identity_key_1, + preorder_document_1, + document_1, + ), + ( + identity_2, + signer_2, + identity_key_2, + preorder_document_2, + document_2, + ), + dpns_contract, + ) + } + + pub(crate) fn create_dpns_identity_name_contest( + platform: &mut TempPlatform, + platform_state: &PlatformState, + seed: u64, + name: &str, + platform_version: &PlatformVersion, + ) -> (Identity, Identity, Arc) { + let mut rng = StdRng::seed_from_u64(seed); + + let identity_1_info = setup_identity(platform, rng.gen(), dash_to_credits!(0.5)); + + let identity_2_info = setup_identity(platform, rng.gen(), dash_to_credits!(0.5)); + + // Flip them if needed so identity 1 id is always smaller than identity 2 id + let (identity_1_info, identity_2_info) = if identity_1_info.0.id() < identity_2_info.0.id() + { + (identity_1_info, identity_2_info) + } else { + (identity_2_info, identity_1_info) + }; + + let (_, _, dpns_contract) = create_dpns_name_contest_on_identities( + platform, + &identity_1_info, + &identity_2_info, + platform_state, + rng, + name, + platform_version, + ); + (identity_1_info.0, identity_2_info.0, dpns_contract) + } + + pub(crate) fn create_dpns_contract_name_contest( + platform: &mut TempPlatform, + platform_state: &PlatformState, + seed: u64, + name: &str, + platform_version: &PlatformVersion, + ) -> (Identity, Identity, DataContract) { + let mut rng = StdRng::seed_from_u64(seed); + + let identity_1_info = setup_identity(platform, rng.gen(), dash_to_credits!(0.5)); + + let identity_2_info = setup_identity(platform, rng.gen(), dash_to_credits!(0.5)); + + // Flip them if needed so identity 1 id is always smaller than identity 2 id + let (identity_1_info, identity_2_info) = if identity_1_info.0.id() < identity_2_info.0.id() + { + (identity_1_info, identity_2_info) + } else { + (identity_2_info, identity_1_info) + }; + + let dashpay_contract = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + None, + None, + ); + + let card_game = setup_contract( + &platform.drive, + "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json", + None, + None, + ); + + let (_, _, dpns_contract) = create_dpns_name_contest_on_identities_for_contract_records( + platform, + &identity_1_info, + &identity_2_info, + &dashpay_contract, + &card_game, + platform_state, + rng, + name, + platform_version, + ); + (identity_1_info.0, identity_2_info.0, dpns_contract) + } + + fn create_dpns_name_contest_on_identities( + platform: &mut TempPlatform, + identity_1: &(Identity, SimpleSigner, IdentityPublicKey), + identity_2: &(Identity, SimpleSigner, IdentityPublicKey), + platform_state: &PlatformState, + mut rng: StdRng, + name: &str, + platform_version: &PlatformVersion, + ) -> ( + ((Document, Bytes32), (Document, Bytes32)), + ((Document, Bytes32), (Document, Bytes32)), + Arc, + ) { + let (identity_1, signer_1, key_1) = identity_1; + + let (identity_2, signer_2, key_2) = identity_2; + + let dpns = platform.drive.cache.system_data_contracts.load_dpns(); + let dpns_contract = dpns.clone(); + + let preorder = dpns_contract + .document_type_for_name("preorder") + .expect("expected a profile document type"); + + assert!(!preorder.documents_mutable()); + assert!(preorder.documents_can_be_deleted()); + assert!(!preorder.documents_transferable().is_transferable()); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + assert!(!domain.documents_mutable()); + // Deletion is disabled with data trigger + assert!(domain.documents_can_be_deleted()); + assert!(domain.documents_transferable().is_transferable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut preorder_document_1 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut preorder_document_2 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_1 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_2 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document_1.set("parentDomainName", "dash".into()); + document_1.set("normalizedParentDomainName", "dash".into()); + document_1.set("label", name.into()); + document_1.set( + "normalizedLabel", + convert_to_homograph_safe_chars(name).into(), + ); + document_1.set("records.identity", document_1.owner_id().into()); + document_1.set("subdomainRules.allowSubdomains", false.into()); + + document_2.set("parentDomainName", "dash".into()); + document_2.set("normalizedParentDomainName", "dash".into()); + document_2.set("label", name.into()); + document_2.set( + "normalizedLabel", + convert_to_homograph_safe_chars(name).into(), + ); + document_2.set("records.identity", document_2.owner_id().into()); + document_2.set("subdomainRules.allowSubdomains", false.into()); + + let salt_1: [u8; 32] = rng.gen(); + let salt_2: [u8; 32] = rng.gen(); + + let mut salted_domain_buffer_1: Vec = vec![]; + salted_domain_buffer_1.extend(salt_1); + salted_domain_buffer_1.extend((convert_to_homograph_safe_chars(name) + ".dash").as_bytes()); + + let salted_domain_hash_1 = hash_double(salted_domain_buffer_1); + + let mut salted_domain_buffer_2: Vec = vec![]; + salted_domain_buffer_2.extend(salt_2); + salted_domain_buffer_2.extend((convert_to_homograph_safe_chars(name) + ".dash").as_bytes()); + + let salted_domain_hash_2 = hash_double(salted_domain_buffer_2); + + preorder_document_1.set("saltedDomainHash", salted_domain_hash_1.into()); + preorder_document_2.set("saltedDomainHash", salted_domain_hash_2.into()); + + document_1.set("preorderSalt", salt_1.into()); + document_2.set("preorderSalt", salt_2.into()); + + let documents_batch_create_preorder_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_1.clone(), + preorder, + entropy.0, + key_1, + 2, + 0, + signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_1 = + documents_batch_create_preorder_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_preorder_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_2.clone(), + preorder, + entropy.0, + key_2, + 2, + 0, + signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_2 = + documents_batch_create_preorder_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_1.clone(), + domain, + entropy.0, + key_1, + 3, + 0, + signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_1 = documents_batch_create_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_2.clone(), + domain, + entropy.0, + key_2, + 3, + 0, + signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_2 = documents_batch_create_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_preorder_transition_1.clone(), + documents_batch_create_serialized_preorder_transition_2.clone(), + ], + platform_state, + &BlockInfo::default_with_time( + platform_state + .last_committed_block_time_ms() + .unwrap_or_default() + + 3000, + ), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 2); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_transition_1.clone(), + documents_batch_create_serialized_transition_2.clone(), + ], + platform_state, + &BlockInfo::default_with_time( + platform_state + .last_committed_block_time_ms() + .unwrap_or_default() + + 3000, + ), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 2); + ( + ((preorder_document_1, entropy), (document_1, entropy)), + ((preorder_document_2, entropy), (document_2, entropy)), + dpns_contract, + ) + } + + fn create_dpns_name_contest_on_identities_for_contract_records( + platform: &mut TempPlatform, + identity_1: &(Identity, SimpleSigner, IdentityPublicKey), + identity_2: &(Identity, SimpleSigner, IdentityPublicKey), + contract_1: &DataContract, + contract_2: &DataContract, + platform_state: &PlatformState, + mut rng: StdRng, + name: &str, + platform_version: &PlatformVersion, + ) -> ( + ((Document, Bytes32), (Document, Bytes32)), + ((Document, Bytes32), (Document, Bytes32)), + DataContract, + ) { + let (identity_1, signer_1, key_1) = identity_1; + + let (identity_2, signer_2, key_2) = identity_2; + + let dpns_contract = setup_contract( + &platform.drive, + "tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id.json", + None, + None, + ); + + let preorder = dpns_contract + .document_type_for_name("preorder") + .expect("expected a profile document type"); + + assert!(!preorder.documents_mutable()); + assert!(preorder.documents_can_be_deleted()); + assert!(!preorder.documents_transferable().is_transferable()); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + assert!(!domain.documents_mutable()); + // Deletion is disabled with data trigger + assert!(domain.documents_can_be_deleted()); + assert!(domain.documents_transferable().is_transferable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut preorder_document_1 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut preorder_document_2 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_1 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_2 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_2.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document_1.set("parentDomainName", "dash".into()); + document_1.set("normalizedParentDomainName", "dash".into()); + document_1.set("label", name.into()); + document_1.set( + "normalizedLabel", + convert_to_homograph_safe_chars(name).into(), + ); + document_1.remove("records.identity"); + document_1.set("records.contract", contract_1.id().into()); + document_1.set("subdomainRules.allowSubdomains", false.into()); + + document_2.set("parentDomainName", "dash".into()); + document_2.set("normalizedParentDomainName", "dash".into()); + document_2.set("label", name.into()); + document_2.set( + "normalizedLabel", + convert_to_homograph_safe_chars(name).into(), + ); + document_2.remove("records.identity"); + document_2.set("records.contract", contract_2.id().into()); + document_2.set("subdomainRules.allowSubdomains", false.into()); + + let salt_1: [u8; 32] = rng.gen(); + let salt_2: [u8; 32] = rng.gen(); + + let mut salted_domain_buffer_1: Vec = vec![]; + salted_domain_buffer_1.extend(salt_1); + salted_domain_buffer_1.extend((convert_to_homograph_safe_chars(name) + ".dash").as_bytes()); + + let salted_domain_hash_1 = hash_double(salted_domain_buffer_1); + + let mut salted_domain_buffer_2: Vec = vec![]; + salted_domain_buffer_2.extend(salt_2); + salted_domain_buffer_2.extend((convert_to_homograph_safe_chars(name) + ".dash").as_bytes()); + + let salted_domain_hash_2 = hash_double(salted_domain_buffer_2); + + preorder_document_1.set("saltedDomainHash", salted_domain_hash_1.into()); + preorder_document_2.set("saltedDomainHash", salted_domain_hash_2.into()); + + document_1.set("preorderSalt", salt_1.into()); + document_2.set("preorderSalt", salt_2.into()); + + let documents_batch_create_preorder_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_1.clone(), + preorder, + entropy.0, + key_1, + 2, + 0, + signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_1 = + documents_batch_create_preorder_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_preorder_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_2.clone(), + preorder, + entropy.0, + key_2, + 2, + 0, + signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_2 = + documents_batch_create_preorder_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_1.clone(), + domain, + entropy.0, + key_1, + 3, + 0, + signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_1 = documents_batch_create_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_2 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_2.clone(), + domain, + entropy.0, + key_2, + 3, + 0, + signer_2, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_2 = documents_batch_create_transition_2 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_preorder_transition_1.clone(), + documents_batch_create_serialized_preorder_transition_2.clone(), + ], + platform_state, + &BlockInfo::default_with_time( + platform_state + .last_committed_block_time_ms() + .unwrap_or_default() + + 3000, + ), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 2); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![ + documents_batch_create_serialized_transition_1.clone(), + documents_batch_create_serialized_transition_2.clone(), + ], + platform_state, + &BlockInfo::default_with_time( + platform_state + .last_committed_block_time_ms() + .unwrap_or_default() + + 3000, + ), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 2); + ( + ((preorder_document_1, entropy), (document_1, entropy)), + ((preorder_document_2, entropy), (document_2, entropy)), + dpns_contract, + ) + } + + pub(crate) fn add_contender_to_dpns_name_contest( + platform: &mut TempPlatform, + platform_state: &PlatformState, + seed: u64, + name: &str, + expect_err: Option<&str>, + platform_version: &PlatformVersion, + ) -> Identity { + let mut rng = StdRng::seed_from_u64(seed); + + let (identity_1, signer_1, key_1) = + setup_identity(platform, rng.gen(), dash_to_credits!(0.5)); + + let dpns = platform.drive.cache.system_data_contracts.load_dpns(); + let dpns_contract = dpns.clone(); + + let preorder = dpns_contract + .document_type_for_name("preorder") + .expect("expected a profile document type"); + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut preorder_document_1 = preorder + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + let mut document_1 = domain + .random_document_with_identifier_and_entropy( + &mut rng, + identity_1.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document_1.set("parentDomainName", "dash".into()); + document_1.set("normalizedParentDomainName", "dash".into()); + document_1.set("label", name.into()); + document_1.set( + "normalizedLabel", + convert_to_homograph_safe_chars(name).into(), + ); + document_1.set("records.identity", document_1.owner_id().into()); + document_1.set("subdomainRules.allowSubdomains", false.into()); + + let salt_1: [u8; 32] = rng.gen(); + + let mut salted_domain_buffer_1: Vec = vec![]; + salted_domain_buffer_1.extend(salt_1); + salted_domain_buffer_1.extend((convert_to_homograph_safe_chars(name) + ".dash").as_bytes()); + + let salted_domain_hash_1 = hash_double(salted_domain_buffer_1); + + preorder_document_1.set("saltedDomainHash", salted_domain_hash_1.into()); + + document_1.set("preorderSalt", salt_1.into()); + + let documents_batch_create_preorder_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + preorder_document_1, + preorder, + entropy.0, + &key_1, + 2, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_preorder_transition_1 = + documents_batch_create_preorder_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_create_transition_1 = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document_1, + domain, + entropy.0, + &key_1, + 3, + 0, + &signer_1, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition_1 = documents_batch_create_transition_1 + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_preorder_transition_1.clone()], + platform_state, + &BlockInfo::default_with_time( + platform_state + .last_committed_block_time_ms() + .unwrap_or_default() + + 3000, + ), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition_1.clone()], + platform_state, + &BlockInfo::default_with_time( + platform_state + .last_committed_block_time_ms() + .unwrap_or_default() + + 3000, + ), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + if let Some(expected_err) = expect_err { + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), expected_err); + } else { + assert_eq!(processing_result.valid_count(), 1); + } + identity_1 + } + + pub(crate) fn verify_dpns_name_contest( + platform: &mut TempPlatform, + platform_state: &Guard>, + dpns_contract: &DataContract, + identity_1: &Identity, + identity_2: &Identity, + name: &str, + platform_version: &PlatformVersion, + ) { + // Now let's run a query for the vote totals + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = + bincode::encode_to_vec(Value::Text(convert_to_homograph_safe_chars(name)), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + .. + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + let first_contender_document = Document::from_bytes( + first_contender + .document + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + let second_contender_document = Document::from_bytes( + second_contender + .document + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + assert_ne!(first_contender_document, second_contender_document); + + assert_eq!(first_contender.identifier, identity_1.id().to_vec()); + + assert_eq!(second_contender.identifier, identity_2.id().to_vec()); + + assert_eq!(first_contender.vote_count, Some(0)); + + assert_eq!(second_contender.vote_count, Some(0)); + + let GetContestedResourceVoteStateResponse { version } = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![dash_encoded, quantum_encoded], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: true, + }, + )), + }, + platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = version.expect("expected a version"); + + let Some(get_contested_resource_vote_state_response_v0::Result::Proof(proof)) = result + else { + panic!("expected contenders") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedContestedDocumentVotePollDriveQuery { + vote_poll: ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::BorrowedDataContract(dpns_contract), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![ + Value::Text("dash".to_string()), + Value::Text(convert_to_homograph_safe_chars(name)), + ], + }, + result_type: DocumentsAndVoteTally, + offset: None, + limit: None, + start_at: None, + allow_include_locked_and_abstaining_vote_tally: true, + }; + + let (_, result) = resolved_contested_document_vote_poll_drive_query + .verify_vote_poll_vote_state_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + let contenders = result.contenders; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + let first_contender_document = Document::from_bytes( + first_contender + .serialized_document() + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + let second_contender_document = Document::from_bytes( + second_contender + .serialized_document() + .as_ref() + .expect("expected a document") + .as_slice(), + domain, + platform_version, + ) + .expect("expected to get document"); + + assert_ne!(first_contender_document, second_contender_document); + + assert_eq!(first_contender.identity_id(), identity_1.id()); + + assert_eq!(second_contender.identity_id(), identity_2.id()); + + assert_eq!(first_contender.vote_tally(), Some(0)); + + assert_eq!(second_contender.vote_tally(), Some(0)); + } + + pub(crate) fn perform_vote( + platform: &mut TempPlatform, + platform_state: &Guard>, + dpns_contract: &DataContract, + resource_vote_choice: ResourceVoteChoice, + name: &str, + signer: &SimpleSigner, + pro_tx_hash: Identifier, + voting_key: &IdentityPublicKey, + nonce: IdentityNonce, + expect_error: Option<&str>, + platform_version: &PlatformVersion, + ) { + // Let's vote for contender 1 + + let vote = Vote::ResourceVote(ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + ContestedDocumentResourceVotePoll { + contract_id: dpns_contract.id(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Value::Text("dash".to_string()), + Value::Text(convert_to_homograph_safe_chars(name)), + ], + }, + ), + resource_vote_choice, + })); + + let masternode_vote_transition = MasternodeVoteTransition::try_from_vote_with_signer( + vote, + signer, + pro_tx_hash, + voting_key, + nonce, + platform_version, + None, + ) + .expect("expected to make transition vote"); + + let masternode_vote_serialized_transition = masternode_vote_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![masternode_vote_serialized_transition.clone()], + platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + false, + None, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let execution_result = processing_result.into_execution_results().remove(0); + if let Some(error_msg) = expect_error { + assert_matches!(execution_result, UnpaidConsensusError(..)); + let UnpaidConsensusError(consensus_error) = execution_result else { + panic!() + }; + assert_eq!(consensus_error.to_string(), error_msg) + } else { + assert_matches!(execution_result, SuccessfulExecution(..)); + } + } + + pub(crate) fn perform_votes( + platform: &mut TempPlatform, + dpns_contract: &DataContract, + resource_vote_choice: ResourceVoteChoice, + name: &str, + count: u64, + start_seed: u64, + platform_version: &PlatformVersion, + ) -> Vec<(Identifier, Identity, SimpleSigner, IdentityPublicKey)> { + let mut masternode_infos = vec![]; + for i in 0..count { + let (pro_tx_hash_bytes, voting_identity, signer, voting_key) = + setup_masternode_identity(platform, start_seed + i, platform_version); + + let platform_state = platform.state.load(); + + perform_vote( + platform, + &platform_state, + dpns_contract, + resource_vote_choice, + name, + &signer, + pro_tx_hash_bytes, + &voting_key, + 1, + None, + platform_version, + ); + + masternode_infos.push((pro_tx_hash_bytes, voting_identity, signer, voting_key)); + } + masternode_infos + } + + pub(crate) fn perform_votes_multi( + platform: &mut TempPlatform, + dpns_contract: &DataContract, + resource_vote_choices: Vec<(ResourceVoteChoice, u64)>, + name: &str, + start_seed: u64, + platform_version: &PlatformVersion, + ) -> BTreeMap> + { + let mut count_aggregate = start_seed; + let mut masternodes_by_vote_choice = BTreeMap::new(); + for (resource_vote_choice, count) in resource_vote_choices.into_iter() { + let masternode_infos = perform_votes( + platform, + dpns_contract, + resource_vote_choice, + name, + count, + count_aggregate, + platform_version, + ); + masternodes_by_vote_choice.insert(resource_vote_choice, masternode_infos); + count_aggregate += count; + } + masternodes_by_vote_choice + } + + pub(crate) fn get_vote_states( + platform: &TempPlatform, + platform_state: &PlatformState, + dpns_contract: &DataContract, + name: &str, + count: Option, + allow_include_locked_and_abstaining_vote_tally: bool, + start_at_identifier_info: Option< + get_contested_resource_vote_state_request_v0::StartAtIdentifierInfo, + >, + result_type: ResultType, + platform_version: &PlatformVersion, + ) -> ( + Vec, + Option, + Option, + Option, + ) { + // Now let's run a query for the vote totals + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = + bincode::encode_to_vec(Value::Text(convert_to_homograph_safe_chars(name)), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: result_type as i32, + allow_include_locked_and_abstaining_vote_tally, + start_at_identifier_info, + count, + prove: false, + }, + )), + }, + platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + ( + contenders + .into_iter() + .map(|contender| { + ContenderV0 { + identity_id: contender.identifier.try_into().expect("expected 32 bytes"), + document: contender.document.map(|document_bytes| { + Document::from_bytes( + document_bytes.as_slice(), + domain, + platform_version, + ) + .expect("expected to deserialize document") + }), + vote_tally: contender.vote_count, + } + .into() + }) + .collect(), + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + ) + } + + pub(crate) fn get_proved_vote_states( + platform: &TempPlatform, + platform_state: &PlatformState, + dpns_contract: &DataContract, + name: &str, + count: Option, + allow_include_locked_and_abstaining_vote_tally: bool, + start_at_identifier_info: Option< + get_contested_resource_vote_state_request_v0::StartAtIdentifierInfo, + >, + result_type: ResultType, + platform_version: &PlatformVersion, + ) -> ( + Vec, + Option, + Option, + Option<(ContestedDocumentVotePollWinnerInfo, BlockInfo)>, + ) { + // Now let's run a query for the vote totals + + let domain = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type"); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let name_encoded = + bincode::encode_to_vec(Value::Text(convert_to_homograph_safe_chars(name)), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), name_encoded.clone()], + result_type: result_type as i32, + allow_include_locked_and_abstaining_vote_tally, + start_at_identifier_info, + count, + prove: true, + }, + )), + }, + platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some(get_contested_resource_vote_state_response_v0::Result::Proof(proof)) = result + else { + panic!("expected contenders") + }; + + let resolved_contested_document_vote_poll_drive_query = + ResolvedContestedDocumentVotePollDriveQuery { + vote_poll: ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::BorrowedDataContract(dpns_contract), + document_type_name: domain.name().clone(), + index_name: index_name.clone(), + index_values: vec![ + Value::Text("dash".to_string()), + Value::Text(convert_to_homograph_safe_chars(name)), + ], + }, + result_type: ContestedDocumentVotePollDriveQueryResultType::try_from( + result_type as i32, + ) + .expect("expected valid result type"), + offset: None, + limit: count.map(|a| a as u16), + start_at: None, + allow_include_locked_and_abstaining_vote_tally, + }; + + let (_, result) = resolved_contested_document_vote_poll_drive_query + .verify_vote_poll_vote_state_proof(proof.grovedb_proof.as_ref(), platform_version) + .expect("expected to verify proof"); + + let abstaining_vote_tally = result.abstaining_vote_tally; + let lock_vote_tally = result.locked_vote_tally; + + let contenders = result.contenders; + let finished_vote_info = result.winner; + ( + contenders + .into_iter() + .map(|contender| { + ContenderV0 { + identity_id: contender.identity_id(), + document: contender + .serialized_document() + .as_ref() + .map(|document_bytes| { + Document::from_bytes( + document_bytes.as_slice(), + domain, + platform_version, + ) + .expect("expected to deserialize document") + }), + vote_tally: contender.vote_tally(), + } + .into() + }) + .collect(), + abstaining_vote_tally, + lock_vote_tally, + finished_vote_info, + ) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs index a96ba6b8361..e078e0c8b64 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs @@ -1,7 +1,13 @@ use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_create::StateTransitionActionTransformerForIdentityCreateTransitionV0; +use crate::execution::validation::state_transition::identity_top_up::StateTransitionIdentityTopUpTransitionActionTransformer; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; use dpp::prelude::ConsensusValidationResult; +use dpp::serialization::Signable; use dpp::state_transition::StateTransition; use drive::grovedb::TransactionArg; use drive::state_transition_action::StateTransitionAction; @@ -27,7 +33,9 @@ pub trait StateTransitionActionTransformerV0 { fn transform_into_action( &self, platform: &PlatformRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error>; } @@ -36,26 +44,81 @@ impl StateTransitionActionTransformerV0 for StateTransition { fn transform_into_action( &self, platform: &PlatformRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { match self { - StateTransition::DataContractCreate(st) => { - st.transform_into_action(platform, validate, tx) + StateTransition::DataContractCreate(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::DataContractUpdate(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::IdentityCreate(st) => { + let signable_bytes = self.signable_bytes()?; + st.transform_into_action_for_identity_create_transition( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + ) } - StateTransition::DataContractUpdate(st) => { - st.transform_into_action(platform, validate, tx) - } - StateTransition::IdentityCreate(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityUpdate(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityTopUp(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityCreditWithdrawal(st) => { - st.transform_into_action(platform, validate, tx) - } - StateTransition::DocumentsBatch(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityCreditTransfer(st) => { - st.transform_into_action(platform, validate, tx) + StateTransition::IdentityUpdate(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::IdentityTopUp(st) => { + let signable_bytes = self.signable_bytes()?; + st.transform_into_action_for_identity_top_up_transition( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + ) } + StateTransition::IdentityCreditWithdrawal(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::DocumentsBatch(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::IdentityCreditTransfer(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::MasternodeVote(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), } } } diff --git a/packages/rs-drive-abci/src/lib.rs b/packages/rs-drive-abci/src/lib.rs index ac645f7582f..5e475d189aa 100644 --- a/packages/rs-drive-abci/src/lib.rs +++ b/packages/rs-drive-abci/src/lib.rs @@ -37,9 +37,14 @@ pub mod metrics; pub mod test; /// Mimic of block execution for tests -#[cfg(all(feature = "server", any(feature = "mocks", test)))] +#[cfg(any(feature = "mocks", test))] pub mod mimic; /// Platform module pub mod platform_types; /// Querying pub mod query; +/// Various utils +pub mod utils; + +/// Drive server +pub mod server; diff --git a/packages/rs-drive-abci/src/logging/destination.rs b/packages/rs-drive-abci/src/logging/destination.rs index 200a2b538d2..4f318926206 100644 --- a/packages/rs-drive-abci/src/logging/destination.rs +++ b/packages/rs-drive-abci/src/logging/destination.rs @@ -219,7 +219,7 @@ impl LogDestinationWriter { } LogDestinationWriter::RotationWriter(w) => { let paths = w.0.lock().unwrap().log_paths(); - let path = paths.get(0).expect("exactly one path excepted"); + let path = paths.first().expect("exactly one path excepted"); fs::read_to_string(path).unwrap() } _ => todo!(), @@ -258,7 +258,6 @@ impl TryFrom<&LogConfig> for Reopen { let open_fn = move || { OpenOptions::new() .create(true) - .write(true) .append(true) .mode(mode) .open(&opened_path) diff --git a/packages/rs-drive-abci/src/logging/level.rs b/packages/rs-drive-abci/src/logging/level.rs index 4986c11f643..a914e45d30d 100644 --- a/packages/rs-drive-abci/src/logging/level.rs +++ b/packages/rs-drive-abci/src/logging/level.rs @@ -110,7 +110,7 @@ impl TryFrom<&LogLevel> for EnvFilter { .expect("should be a valid log specification") } LogLevel::Debug => EnvFilter::try_new( - "info,tenderdash_abci=debug,drive_abci=debug,drive=debug,dpp=debug", + "info,tenderdash_abci=debug,drive_abci=debug,drive=debug,dpp=debug,dapi_grpc=debug,tonic=debug", ) .expect("should be a valid log specification"), LogLevel::Trace => EnvFilter::try_new( diff --git a/packages/rs-drive-abci/src/logging/logger.rs b/packages/rs-drive-abci/src/logging/logger.rs index ea04a2f74b3..121ce76b933 100644 --- a/packages/rs-drive-abci/src/logging/logger.rs +++ b/packages/rs-drive-abci/src/logging/logger.rs @@ -2,8 +2,6 @@ use crate::logging::config::LogConfig; use crate::logging::destination::{LogDestinationWriter, Writer}; use crate::logging::error::Error; use crate::logging::{LogConfigs, LogFormat, LogLevel}; - -use itertools::Itertools; use lazy_static::__Deref; use std::collections::HashMap; use std::fmt::Debug; @@ -14,7 +12,6 @@ use tracing_subscriber::fmt; use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt; use tracing_subscriber::registry; use tracing_subscriber::util::SubscriberInitExt; -use tracing_subscriber::util::TryInitError; use tracing_subscriber::EnvFilter; use tracing_subscriber::Layer; use tracing_subscriber::Registry; @@ -180,19 +177,24 @@ impl Loggers { /// drive_abci::logging::Loggers::default().try_install().ok(); /// ``` pub fn try_install(&self) -> Result<(), Error> { - // Based on examples from https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/index.html - let loggers = self - .0 - .values() - .map(|l| Ok(Box::new(l.layer()?))) - .collect::, _>>()?; + let layers = self.tracing_subscriber_layers()?; registry() - .with(loggers) + .with(layers) .try_init() .map_err(Error::TryInitError) } + /// Returns tracing subscriber layers + pub fn tracing_subscriber_layers(&self) -> Result>>, Error> { + // Based on examples from https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/index.html + + self.0 + .values() + .map(|l| Ok(Box::new(l.layer()?))) + .collect::, _>>() + } + /// Flushes all loggers. /// /// In case of multiple errors, returns only the last one. @@ -316,7 +318,9 @@ impl Logger { let formatter = fmt::layer::() .with_writer(make_writer) - .with_ansi(ansi); + .with_ansi(ansi) + .with_thread_names(true) + .with_thread_ids(true); let formatter = match self.format { LogFormat::Full => formatter.with_filter(filter).boxed(), diff --git a/packages/rs-drive-abci/src/main.rs b/packages/rs-drive-abci/src/main.rs index 051fc53e689..fee28d30861 100644 --- a/packages/rs-drive-abci/src/main.rs +++ b/packages/rs-drive-abci/src/main.rs @@ -3,21 +3,29 @@ //! RS-Drive-ABCI server starts a single-threaded server and listens to connections from Tenderdash. use clap::{Parser, Subcommand}; +use dpp::version::PlatformVersion; use drive_abci::config::{FromEnv, PlatformConfig}; use drive_abci::core::wait_for_core_to_sync::v0::wait_for_core_to_sync_v0; -use drive_abci::logging; use drive_abci::logging::{LogBuilder, LogConfig, LogDestination, Loggers}; use drive_abci::metrics::{Prometheus, DEFAULT_PROMETHEUS_PORT}; +use drive_abci::platform_types::platform::Platform; use drive_abci::rpc::core::DefaultCoreRPC; +use drive_abci::{logging, server}; use itertools::Itertools; use std::fs::remove_file; +#[cfg(tokio_unstable)] +use std::net::SocketAddr; use std::path::PathBuf; use std::process::ExitCode; -use tokio::runtime::Builder; +use std::sync::Arc; +use tokio::runtime::{Builder, Runtime}; use tokio::signal::unix::{signal, SignalKind}; use tokio::time::Duration; use tokio_util::sync::CancellationToken; -use tracing::warn; +#[cfg(tokio_unstable)] +use tracing_subscriber::layer::SubscriberExt; +#[cfg(tokio_unstable)] +use tracing_subscriber::util::SubscriberInitExt; const SHUTDOWN_TIMEOUT_MILIS: u64 = 5000; // 5s; Docker defaults to 10s @@ -60,7 +68,7 @@ struct Cli { command: Commands, /// Path to the config (.env) file. #[arg(short, long, value_hint = clap::ValueHint::FilePath) ] - config: Option, + config: Option, /// Enable verbose logging. Use multiple times for even more logs. /// @@ -82,15 +90,21 @@ struct Cli { } impl Cli { - fn run(self, config: PlatformConfig, cancel: CancellationToken) -> Result<(), String> { + fn run( + self, + runtime: &Runtime, + config: PlatformConfig, + cancel: CancellationToken, + ) -> Result<(), String> { match self.command { Commands::Start => { - verify_grovedb(&config.db_path, false)?; - + if config.drive.grovedb_verify_on_startup { + verify_grovedb(&config.db_path, false)?; + } let core_rpc = DefaultCoreRPC::open( - config.core.rpc.url().as_str(), - config.core.rpc.username.clone(), - config.core.rpc.password.clone(), + config.core.consensus_rpc.url().as_str(), + config.core.consensus_rpc.username.clone(), + config.core.consensus_rpc.password.clone(), ) .unwrap(); @@ -99,9 +113,21 @@ impl Cli { // Drive and Tenderdash rely on Core. Various functions will fail if Core is not synced. // We need to make sure that Core is ready before we start Drive ABCI app // Tenderdash won't start too until ABCI port is open. - wait_for_core_to_sync_v0(&core_rpc, cancel.clone()).unwrap(); + wait_for_core_to_sync_v0(&core_rpc, cancel.clone()).map_err(|e| e.to_string())?; + + if cancel.is_cancelled() { + return Ok(()); + } + + let platform: Platform = Platform::open_with_client( + config.db_path.clone(), + Some(config.clone()), + core_rpc, + ) + .expect("Failed to open platform"); + + server::start(runtime, Arc::new(platform), config, cancel); - drive_abci::abci::start(&config, core_rpc, cancel).map_err(|e| e.to_string())?; return Ok(()); } Commands::Config => dump_config(&config)?, @@ -116,46 +142,86 @@ impl Cli { fn main() -> Result<(), ExitCode> { let cli = Cli::parse(); let config = load_config(&cli.config); - // We use `cancel` to notify other subsystems that the server is shutting down - let cancel = tokio_util::sync::CancellationToken::new(); - - let loggers = configure_logging(&cli, &config).expect("failed to configure logging"); - - install_panic_hook(cancel.clone()); // Start tokio runtime and thread listening for signals. // The runtime will be reused by Prometheus and rs-tenderdash-abci. - - // TODO: 8 MB stack threads as some recursions in GroveDB can be pretty deep - // We could remove such a stack stack size once deletion of a node doesn't recurse in grovedb - let runtime = Builder::new_multi_thread() - .enable_all() + // TODO: 8 MB stack threads as some recursions in GroveDB can be pretty deep + // We could remove such a stack stack size once deletion of a node doesn't recurse in grovedb .thread_stack_size(8 * 1024 * 1024) + .enable_all() .build() .expect("cannot initialize tokio runtime"); - let rt_guard = runtime.enter(); + + // We use `cancel` to notify other subsystems that the server is shutting down + let cancel = CancellationToken::new(); + + let loggers = configure_logging(&cli, &config).expect("failed to configure logging"); + + // If tokio console is enabled, we install loggers together with tokio console + // due to type compatibility issue + + #[cfg(not(feature = "console"))] + loggers.install(); + + #[cfg(feature = "console")] + if config.tokio_console_enabled { + #[cfg(not(tokio_unstable))] + panic!("tokio_unstable flag should be set"); + + // Initialize Tokio console subscriber + #[cfg(tokio_unstable)] + { + let socket_addr: SocketAddr = config + .tokio_console_address + .parse() + .expect("cannot parse tokio console address"); + + let console_layer = console_subscriber::ConsoleLayer::builder() + .retention(Duration::from_secs(config.tokio_console_retention_secs)) + .server_addr(socket_addr) + .spawn(); + + tracing_subscriber::registry() + .with( + loggers + .tracing_subscriber_layers() + .expect("should return layers"), + ) + .with(console_layer) + .try_init() + .expect("can't init tracing subscribers"); + } + } else { + loggers.install(); + } + + // Log panics + + install_panic_hook(cancel.clone()); + + // Start runtime in the main thread + + let runtime_guard = runtime.enter(); runtime.spawn(handle_signals(cancel.clone(), loggers)); - // Main thread is not started in runtime, as it is synchronous and we don't want to run into - // potential, hard to debug, issues. - let status = match cli.run(config, cancel) { + let result = match cli.run(&runtime, config, cancel) { Ok(()) => { tracing::debug!("shutdown complete"); - ExitCode::SUCCESS + Ok(()) } Err(e) => { tracing::error!(error = e, "drive-abci failed"); - ExitCode::FAILURE + Err(ExitCode::FAILURE) } }; - drop(rt_guard); + drop(runtime_guard); runtime.shutdown_timeout(Duration::from_millis(SHUTDOWN_TIMEOUT_MILIS)); tracing::info!("drive-abci server is stopped"); - Err(status) + result } /// Handle signals received from operating system @@ -193,16 +259,15 @@ async fn handle_signals(cancel: CancellationToken, logs: Loggers) -> Result<(), /// Start prometheus exporter if it's configured. fn start_prometheus(config: &PlatformConfig) -> Result, String> { let prometheus_addr = config - .abci .prometheus_bind_address .clone() .filter(|s| !s.is_empty()); if let Some(addr) = prometheus_addr { + tracing::info!("Expose prometheus metrics on {}", addr); + let addr = url::Url::parse(&addr).map_err(|e| e.to_string())?; - Ok(Some( - drive_abci::metrics::Prometheus::new(addr).map_err(|e| e.to_string())?, - )) + Ok(Some(Prometheus::new(addr).map_err(|e| e.to_string())?)) } else { Ok(None) } @@ -219,7 +284,7 @@ fn dump_config(config: &PlatformConfig) -> Result<(), String> { /// Check status of ABCI server. fn check_status(config: &PlatformConfig) -> Result<(), String> { - if let Some(prometheus_addr) = &config.abci.prometheus_bind_address { + if let Some(prometheus_addr) = &config.prometheus_bind_address { let url = url::Url::parse(prometheus_addr).expect("cannot parse ABCI_PROMETHEUS_BIND_ADDRESS"); @@ -266,8 +331,14 @@ fn verify_grovedb(db_path: &PathBuf, force: bool) -> Result<(), String> { } let grovedb = drive::grovedb::GroveDb::open(db_path).expect("open grovedb"); + //todo: get platform version instead of taking latest let result = grovedb - .visualize_verify_grovedb() + .visualize_verify_grovedb( + None, + true, + true, + &PlatformVersion::latest().drive.grove_version, + ) .map_err(|e| e.to_string()); match result { @@ -302,7 +373,7 @@ fn load_config(path: &Option) -> PlatformConfig { } } else if let Err(e) = dotenvy::dotenv() { if e.not_found() { - warn!("cannot find any matching .env file"); + tracing::warn!("cannot find any matching .env file"); } else { panic!("cannot load config file: {}", e); } @@ -333,7 +404,6 @@ fn configure_logging(cli: &Cli, config: &PlatformConfig) -> Result std::time::Duration { + self.start.elapsed() + } + + /// Add label to the histrgram + pub fn add_label(&mut self, label: Label) { + self.key = self.key.with_extra_labels(vec![label]); + } + + /// Cancel timing measurement and discard the metric. + pub fn cancel(mut self) { + self.skip = true; + + drop(self); + } } impl Drop for HistogramTiming { @@ -65,11 +98,15 @@ impl Drop for HistogramTiming { /// since the start time. #[inline] fn drop(&mut self) { + if self.skip { + return; + } + let stop = self.start.elapsed(); let key = self.key.name().to_string(); let labels: Vec

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone; - - /// Remove a specific path and key from the batch and return the removed `Op`. - /// - /// # Arguments - /// - /// * `path` - The path to search for. - /// * `key` - The key to search for. - /// - /// # Returns - /// - /// * `Option` - Returns the removed `Op` if found, or `None` otherwise. - fn remove<'c, P>(&mut self, path: P, key: &[u8]) -> Option - where - P: IntoIterator, -

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone; - - /// Find and remove a specific path and key from the batch if it is an - /// `Op::Insert`, `Op::Replace`, or `Op::Patch`. Return the found `Op` regardless of whether it was removed. - /// - /// # Arguments - /// - /// * `path` - The path to search for. - /// * `key` - The key to search for. - /// - /// # Returns - /// - /// * `Option` - Returns the found `Op` if it exists. If the `Op` is an `Op::Insert`, `Op::Replace`, - /// or `Op::Patch`, it will be removed from the batch. - fn remove_if_insert(&mut self, path: Vec>, key: &[u8]) -> Option; -} - -impl GroveDbOpBatchV0Methods for GroveDbOpBatch { - /// Creates a new empty batch of GroveDB operations. - fn new() -> Self { - GroveDbOpBatch { - operations: Vec::new(), - } - } - - /// Gets the number of operations from a list of GroveDB ops. - fn len(&self) -> usize { - self.operations.len() - } - - /// Checks to see if the operation batch is empty - fn is_empty(&self) -> bool { - self.operations.is_empty() - } - - /// Pushes an operation into a list of GroveDB ops. - fn push(&mut self, op: GroveDbOp) { - self.operations.push(op); - } - - /// Appends operations into a list of GroveDB ops. - fn append(&mut self, other: &mut Self) { - self.operations.append(&mut other.operations); - } - - /// Extend operations into a list of GroveDB ops. - fn extend>(&mut self, other_ops: I) { - self.operations.extend(other_ops); - } - - /// Puts a list of GroveDB operations into a batch. - fn from_operations(operations: Vec) -> Self { - GroveDbOpBatch { operations } - } - - /// Adds an `Insert` operation with an empty tree at the specified path and key to a list of GroveDB ops. - fn add_insert_empty_tree(&mut self, path: Vec>, key: Vec) { - self.operations - .push(GroveDbOp::insert_op(path, key, Element::empty_tree())) - } - - /// Adds an `Insert` operation with an empty tree with storage flags to a list of GroveDB ops. - fn add_insert_empty_tree_with_flags( - &mut self, - path: Vec>, - key: Vec, - storage_flags: &Option>, - ) { - self.operations.push(GroveDbOp::insert_op( - path, - key, - Element::empty_tree_with_flags(StorageFlags::map_borrowed_cow_to_some_element_flags( - storage_flags, - )), - )) - } - - /// Adds an `Insert` operation with an empty sum tree at the specified path and key to a list of GroveDB ops. - fn add_insert_empty_sum_tree(&mut self, path: Vec>, key: Vec) { - self.operations - .push(GroveDbOp::insert_op(path, key, Element::empty_sum_tree())) - } - - /// Adds an `Insert` operation with an empty sum tree with storage flags to a list of GroveDB ops. - fn add_insert_empty_sum_tree_with_flags( - &mut self, - path: Vec>, - key: Vec, - storage_flags: &Option>, - ) { - self.operations.push(GroveDbOp::insert_op( - path, - key, - Element::empty_sum_tree_with_flags( - StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), - ), - )) - } - - /// Adds a `Delete` operation to a list of GroveDB ops. - fn add_delete(&mut self, path: Vec>, key: Vec) { - self.operations.push(GroveDbOp::delete_op(path, key)) - } - - /// Adds a `Delete` tree operation to a list of GroveDB ops. - fn add_delete_tree(&mut self, path: Vec>, key: Vec, is_sum_tree: bool) { - self.operations - .push(GroveDbOp::delete_tree_op(path, key, is_sum_tree)) - } - - /// Adds an `Insert` operation with an element to a list of GroveDB ops. - fn add_insert(&mut self, path: Vec>, key: Vec, element: Element) { - self.operations - .push(GroveDbOp::insert_op(path, key, element)) - } - - /// Verify consistency of operations - fn verify_consistency_of_operations(&self) -> GroveDbOpConsistencyResults { - GroveDbOp::verify_consistency_of_operations(&self.operations) - } - - /// Check if the batch contains a specific path and key. - /// - /// # Arguments - /// - /// * `path` - The path to search for. - /// * `key` - The key to search for. - /// - /// # Returns - /// - /// * `Option<&Op>` - Returns a reference to the `Op` if found, or `None` otherwise. - fn contains<'c, P>(&self, path: P, key: &[u8]) -> Option<&Op> - where - P: IntoIterator, -

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, - { - let path = KeyInfoPath( - path.into_iter() - .map(|item| KeyInfo::KnownKey(item.to_vec())) - .collect(), - ); - - self.operations.iter().find_map(|op| { - if &op.path == &path && op.key == KeyInfo::KnownKey(key.to_vec()) { - Some(&op.op) - } else { - None - } - }) - } - - /// Remove a specific path and key from the batch and return the removed `Op`. - /// - /// # Arguments - /// - /// * `path` - The path to search for. - /// * `key` - The key to search for. - /// - /// # Returns - /// - /// * `Option` - Returns the removed `Op` if found, or `None` otherwise. - fn remove<'c, P>(&mut self, path: P, key: &[u8]) -> Option - where - P: IntoIterator, -

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, - { - let path = KeyInfoPath( - path.into_iter() - .map(|item| KeyInfo::KnownKey(item.to_vec())) - .collect(), - ); - - if let Some(index) = self - .operations - .iter() - .position(|op| &op.path == &path && op.key == KeyInfo::KnownKey(key.to_vec())) - { - Some(self.operations.remove(index).op) - } else { - None - } - } - - /// Find and remove a specific path and key from the batch if it is an - /// `Op::Insert`, `Op::Replace`, or `Op::Patch`. Return the found `Op` regardless of whether it was removed. - /// - /// # Arguments - /// - /// * `path` - The path to search for. - /// * `key` - The key to search for. - /// - /// # Returns - /// - /// * `Option` - Returns the found `Op` if it exists. If the `Op` is an `Op::Insert`, `Op::Replace`, - /// or `Op::Patch`, it will be removed from the batch. - fn remove_if_insert(&mut self, path: Vec>, key: &[u8]) -> Option { - let path = KeyInfoPath( - path.into_iter() - .map(|item| KeyInfo::KnownKey(item.to_vec())) - .collect(), - ); - - if let Some(index) = self - .operations - .iter() - .position(|op| &op.path == &path && op.key == KeyInfo::KnownKey(key.to_vec())) - { - let op = &self.operations[index].op; - let op = if matches!( - op, - &Op::Insert { .. } | &Op::Replace { .. } | &Op::Patch { .. } - ) { - self.operations.remove(index).op - } else { - op.clone() - }; - Some(op) - } else { - None - } - } -} - -impl IntoIterator for GroveDbOpBatch { - type Item = GroveDbOp; - type IntoIter = std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - self.operations.into_iter() - } -} diff --git a/packages/rs-drive/src/drive/batch/mod.rs b/packages/rs-drive/src/drive/batch/mod.rs deleted file mode 100644 index 508ab4b8d57..00000000000 --- a/packages/rs-drive/src/drive/batch/mod.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! GroveDB Operations Batch. -//! -//! This module defines the GroveDbOpBatch struct and implements its functions. -//! - -/// Operation module -pub mod drive_op_batch; -// TODO: Must crate only but we need to remove of use it first -pub mod grovedb_op_batch; -pub mod transitions; - -pub use drive_op_batch::DataContractOperationType; -pub use drive_op_batch::DocumentOperationType; -pub use drive_op_batch::DriveOperation; -pub use drive_op_batch::IdentityOperationType; -pub use drive_op_batch::SystemOperationType; -pub use grovedb_op_batch::GroveDbOpBatch; diff --git a/packages/rs-drive/src/drive/batch/transitions/contract/data_contract_create_transition.rs b/packages/rs-drive/src/drive/batch/transitions/contract/data_contract_create_transition.rs deleted file mode 100644 index 3005ee1f1d3..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/contract/data_contract_create_transition.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation::DataContractOperation; -use crate::drive::batch::{DataContractOperationType, DriveOperation}; -use crate::error::Error; -use crate::state_transition_action::contract::data_contract_create::DataContractCreateTransitionAction; -use dpp::block::epoch::Epoch; -use dpp::version::PlatformVersion; -use std::borrow::Cow; - -impl DriveHighLevelOperationConverter for DataContractCreateTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - _epoch: &Epoch, - _platform_version: &PlatformVersion, - ) -> Result>, Error> { - let mut drive_operations = vec![]; - // We must create the contract - drive_operations.push(DataContractOperation( - DataContractOperationType::ApplyContract { - contract: Cow::Owned(self.data_contract()), - storage_flags: None, - }, - )); - - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/contract/data_contract_update_transition.rs b/packages/rs-drive/src/drive/batch/transitions/contract/data_contract_update_transition.rs deleted file mode 100644 index b031dcb5647..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/contract/data_contract_update_transition.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation::DataContractOperation; -use crate::drive::batch::{DataContractOperationType, DriveOperation}; -use crate::error::Error; -use crate::state_transition_action::contract::data_contract_update::DataContractUpdateTransitionAction; -use dpp::block::epoch::Epoch; -use dpp::version::PlatformVersion; -use std::borrow::Cow; - -impl DriveHighLevelOperationConverter for DataContractUpdateTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - _epoch: &Epoch, - _platform_version: &PlatformVersion, - ) -> Result>, Error> { - let mut drive_operations = vec![]; - // We must create the contract - drive_operations.push(DataContractOperation( - DataContractOperationType::ApplyContract { - contract: Cow::Owned(self.data_contract()), - storage_flags: None, - }, - )); - - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/document/document_create_transition.rs b/packages/rs-drive/src/drive/batch/transitions/document/document_create_transition.rs deleted file mode 100644 index 08e1e360bb9..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/document/document_create_transition.rs +++ /dev/null @@ -1,46 +0,0 @@ -use crate::drive::batch::transitions::document::DriveHighLevelDocumentOperationConverter; -use crate::drive::batch::DriveOperation::DocumentOperation; -use crate::drive::batch::{DocumentOperationType, DriveOperation}; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::DocumentOwnedInfo; -use crate::drive::object_size_info::OwnedDocumentInfo; -use crate::error::Error; -use dpp::block::epoch::Epoch; - -use dpp::document::Document; -use dpp::prelude::Identifier; -use std::borrow::Cow; -use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use crate::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::{DocumentCreateTransitionAction, DocumentCreateTransitionActionAccessorsV0, DocumentFromCreateTransition}; -use dpp::version::PlatformVersion; - -impl DriveHighLevelDocumentOperationConverter for DocumentCreateTransitionAction { - fn into_high_level_document_drive_operations<'b>( - self, - epoch: &Epoch, - owner_id: Identifier, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let data_contract_id = self.base().data_contract_id(); - - let document_type_name = self.base().document_type_name().clone(); - - let document = - Document::try_from_owned_create_transition(self, owner_id, platform_version)?; - - let storage_flags = StorageFlags::new_single_epoch(epoch.index, Some(owner_id.to_buffer())); - - let mut drive_operations = vec![]; - drive_operations.push(DocumentOperation(DocumentOperationType::AddDocument { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentOwnedInfo((document, Some(Cow::Owned(storage_flags)))), - owner_id: Some(owner_id.into_buffer()), - }, - contract_id: data_contract_id, - document_type_name: Cow::Owned(document_type_name), - override_document: false, - })); - - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/document/document_delete_transition.rs b/packages/rs-drive/src/drive/batch/transitions/document/document_delete_transition.rs deleted file mode 100644 index b65b0d6b4a5..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/document/document_delete_transition.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::drive::batch::transitions::document::DriveHighLevelDocumentOperationConverter; - -use crate::drive::batch::DriveOperation::DocumentOperation; -use crate::drive::batch::{DocumentOperationType, DriveOperation}; - -use crate::error::Error; -use dpp::block::epoch::Epoch; - -use dpp::identifier::Identifier; -use std::borrow::Cow; -use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use crate::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; -use crate::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; -use dpp::version::PlatformVersion; - -impl DriveHighLevelDocumentOperationConverter for DocumentDeleteTransitionAction { - fn into_high_level_document_drive_operations<'b>( - self, - _epoch: &Epoch, - _owner_id: Identifier, - _platform_version: &PlatformVersion, - ) -> Result>, Error> { - let base = self.base_owned(); - - let mut drive_operations = vec![]; - drive_operations.push(DocumentOperation( - DocumentOperationType::DeleteDocumentOfNamedTypeForContractId { - document_id: base.id().to_buffer(), - contract_id: base.data_contract_id().to_buffer(), - document_type_name: Cow::Owned(base.document_type_name_owned()), - }, - )); - - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/document/document_transition.rs b/packages/rs-drive/src/drive/batch/transitions/document/document_transition.rs deleted file mode 100644 index 550659ebea2..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/document/document_transition.rs +++ /dev/null @@ -1,40 +0,0 @@ -use crate::drive::batch::transitions::document::DriveHighLevelDocumentOperationConverter; -use crate::drive::batch::DriveOperation; -use crate::error::Error; -use crate::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; -use dpp::block::epoch::Epoch; -use dpp::prelude::Identifier; -use dpp::version::PlatformVersion; - -impl DriveHighLevelDocumentOperationConverter for DocumentTransitionAction { - fn into_high_level_document_drive_operations<'b>( - self, - epoch: &Epoch, - owner_id: Identifier, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - match self { - DocumentTransitionAction::CreateAction(document_create_transition) => { - document_create_transition.into_high_level_document_drive_operations( - epoch, - owner_id, - platform_version, - ) - } - DocumentTransitionAction::ReplaceAction(document_replace_transition) => { - document_replace_transition.into_high_level_document_drive_operations( - epoch, - owner_id, - platform_version, - ) - } - DocumentTransitionAction::DeleteAction(document_delete_transition) => { - document_delete_transition.into_high_level_document_drive_operations( - epoch, - owner_id, - platform_version, - ) - } - } - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/document/document_update_transition.rs b/packages/rs-drive/src/drive/batch/transitions/document/document_update_transition.rs deleted file mode 100644 index 18e5e8d6797..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/document/document_update_transition.rs +++ /dev/null @@ -1,43 +0,0 @@ -use crate::drive::batch::transitions::document::DriveHighLevelDocumentOperationConverter; -use crate::drive::batch::DriveOperation::DocumentOperation; -use crate::drive::batch::{DocumentOperationType, DriveOperation}; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::DocumentOwnedInfo; -use crate::drive::object_size_info::OwnedDocumentInfo; -use crate::error::Error; -use dpp::block::epoch::Epoch; - -use dpp::document::Document; -use dpp::prelude::Identifier; -use std::borrow::Cow; -use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use crate::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentFromReplaceTransition, DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; -use dpp::version::PlatformVersion; - -impl DriveHighLevelDocumentOperationConverter for DocumentReplaceTransitionAction { - fn into_high_level_document_drive_operations<'b>( - self, - epoch: &Epoch, - owner_id: Identifier, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let data_contract_id = self.base().data_contract_id(); - let document_type_name = self.base().document_type_name().clone(); - let document = - Document::try_from_owned_replace_transition(self, owner_id, platform_version)?; - - let storage_flags = StorageFlags::new_single_epoch(epoch.index, Some(owner_id.to_buffer())); - - let mut drive_operations = vec![]; - drive_operations.push(DocumentOperation(DocumentOperationType::UpdateDocument { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentOwnedInfo((document, Some(Cow::Owned(storage_flags)))), - owner_id: Some(owner_id.into_buffer()), - }, - contract_id: data_contract_id, - document_type_name: Cow::Owned(document_type_name), - })); - - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/document/documents_batch_transition.rs b/packages/rs-drive/src/drive/batch/transitions/document/documents_batch_transition.rs deleted file mode 100644 index 458db3f9d92..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/document/documents_batch_transition.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::drive::batch::transitions::document::DriveHighLevelDocumentOperationConverter; -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation; -use crate::error::Error; -use crate::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; -use dpp::block::epoch::Epoch; -use dpp::version::PlatformVersion; - -impl DriveHighLevelOperationConverter for DocumentsBatchTransitionAction { - fn into_high_level_drive_operations<'b>( - self, - epoch: &Epoch, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let owner_id = self.owner_id(); - let transitions = self.transitions_owned(); - Ok(transitions - .into_iter() - .map(|transition| { - transition.into_high_level_document_drive_operations( - epoch, - owner_id, - platform_version, - ) - }) - .collect::>, Error>>()? - .into_iter() - .flatten() - .collect()) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/document/mod.rs b/packages/rs-drive/src/drive/batch/transitions/document/mod.rs deleted file mode 100644 index 6e865020e1a..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/document/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use crate::drive::batch::DriveOperation; -use crate::error::Error; -use dpp::block::epoch::Epoch; -use dpp::platform_value::Identifier; -use dpp::version::PlatformVersion; - -mod document_create_transition; -mod document_delete_transition; -mod document_transition; -mod document_update_transition; -mod documents_batch_transition; - -/// A converter that will get High Level Drive Operations from State transitions -pub trait DriveHighLevelDocumentOperationConverter { - /// This will get a list of atomic drive operations from a high level operations - fn into_high_level_document_drive_operations<'a>( - self, - epoch: &Epoch, - owner_id: Identifier, - platform_version: &PlatformVersion, - ) -> Result>, Error>; -} diff --git a/packages/rs-drive/src/drive/batch/transitions/identity/identity_create_transition.rs b/packages/rs-drive/src/drive/batch/transitions/identity/identity_create_transition.rs deleted file mode 100644 index 47c315ec2fb..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/identity/identity_create_transition.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation::{IdentityOperation, SystemOperation}; -use crate::drive::batch::{DriveOperation, IdentityOperationType, SystemOperationType}; - -use crate::error::Error; -use crate::state_transition_action::identity::identity_create::{ - IdentityCreateTransitionAction, IdentityFromIdentityCreateTransitionAction, -}; -use dpp::block::epoch::Epoch; -use dpp::prelude::Identity; -use dpp::version::PlatformVersion; - -impl DriveHighLevelOperationConverter for IdentityCreateTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - _epoch: &Epoch, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let initial_balance_amount = self.initial_balance_amount(); - let asset_lock_outpoint = self.asset_lock_outpoint(); - let identity = - Identity::try_from_identity_create_transition_action(self, platform_version)?; - - let drive_operations = vec![ - IdentityOperation(IdentityOperationType::AddNewIdentity { - identity, - is_masternode_identity: false, - }), - SystemOperation(SystemOperationType::AddToSystemCredits { - amount: initial_balance_amount, - }), - SystemOperation(SystemOperationType::AddUsedAssetLock { - asset_lock_outpoint, - }), - ]; - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/identity/identity_credit_transfer.rs b/packages/rs-drive/src/drive/batch/transitions/identity/identity_credit_transfer.rs deleted file mode 100644 index 69e96e3b64f..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/identity/identity_credit_transfer.rs +++ /dev/null @@ -1,32 +0,0 @@ -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation::IdentityOperation; -use crate::drive::batch::{DriveOperation, IdentityOperationType}; - -use crate::error::Error; -use crate::state_transition_action::identity::identity_credit_transfer::IdentityCreditTransferTransitionAction; -use dpp::block::epoch::Epoch; -use dpp::version::PlatformVersion; - -impl DriveHighLevelOperationConverter for IdentityCreditTransferTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - _epoch: &Epoch, - _platform_version: &PlatformVersion, - ) -> Result>, Error> { - let recipient_id = self.recipient_id(); - let identity_id = self.identity_id(); - let transfer_amount = self.transfer_amount(); - - let drive_operations = vec![ - IdentityOperation(IdentityOperationType::RemoveFromIdentityBalance { - identity_id: identity_id.to_buffer(), - balance_to_remove: transfer_amount, - }), - IdentityOperation(IdentityOperationType::AddToIdentityBalance { - identity_id: recipient_id.to_buffer(), - added_balance: transfer_amount, - }), - ]; - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/identity/identity_credit_withdrawal_transition.rs b/packages/rs-drive/src/drive/batch/transitions/identity/identity_credit_withdrawal_transition.rs deleted file mode 100644 index fc03bd39ac0..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/identity/identity_credit_withdrawal_transition.rs +++ /dev/null @@ -1,39 +0,0 @@ -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation::{DocumentOperation, IdentityOperation}; -use crate::drive::batch::{DocumentOperationType, DriveOperation, IdentityOperationType}; -use crate::drive::object_size_info::{DocumentInfo, OwnedDocumentInfo}; -use crate::error::Error; -use dpp::block::epoch::Epoch; - -use crate::state_transition_action::identity::identity_credit_withdrawal::IdentityCreditWithdrawalTransitionAction; -use dpp::version::PlatformVersion; - -impl DriveHighLevelOperationConverter for IdentityCreditWithdrawalTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - _epoch: &Epoch, - _platform_version: &PlatformVersion, - ) -> Result>, Error> { - let identity_id = self.identity_id(); - let revision = self.revision(); - let prepared_withdrawal_document = self.prepared_withdrawal_document_owned(); - - let drive_operations = vec![ - IdentityOperation(IdentityOperationType::UpdateIdentityRevision { - identity_id: identity_id.into_buffer(), - revision, - }), - DocumentOperation(DocumentOperationType::AddWithdrawalDocument { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentInfo::DocumentOwnedInfo(( - prepared_withdrawal_document, - None, - )), - owner_id: None, - }, - }), - ]; - - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/identity/identity_top_up_transition.rs b/packages/rs-drive/src/drive/batch/transitions/identity/identity_top_up_transition.rs deleted file mode 100644 index 7142661f46d..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/identity/identity_top_up_transition.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation::{IdentityOperation, SystemOperation}; -use crate::drive::batch::{DriveOperation, IdentityOperationType, SystemOperationType}; - -use crate::error::Error; -use crate::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; -use dpp::block::epoch::Epoch; -use dpp::version::PlatformVersion; - -impl DriveHighLevelOperationConverter for IdentityTopUpTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - _epoch: &Epoch, - _platform_version: &PlatformVersion, - ) -> Result>, Error> { - let top_up_balance_amount = self.top_up_balance_amount(); - let identity_id = self.identity_id(); - let asset_lock_outpoint = self.asset_lock_outpoint(); - - let drive_operations = vec![ - IdentityOperation(IdentityOperationType::AddToIdentityBalance { - identity_id: identity_id.to_buffer(), - added_balance: top_up_balance_amount, - }), - SystemOperation(SystemOperationType::AddToSystemCredits { - amount: top_up_balance_amount, - }), - SystemOperation(SystemOperationType::AddUsedAssetLock { - asset_lock_outpoint, - }), - ]; - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/identity/identity_update_transition.rs b/packages/rs-drive/src/drive/batch/transitions/identity/identity_update_transition.rs deleted file mode 100644 index 0d4683b3213..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/identity/identity_update_transition.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::drive::batch::transitions::DriveHighLevelOperationConverter; -use crate::drive::batch::DriveOperation::IdentityOperation; -use crate::drive::batch::{DriveOperation, IdentityOperationType}; - -use crate::error::Error; -use dpp::block::epoch::Epoch; -use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::identity::IdentityPublicKey; - -use crate::state_transition_action::identity::identity_update::IdentityUpdateTransitionAction; -use dpp::version::PlatformVersion; - -impl DriveHighLevelOperationConverter for IdentityUpdateTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - _epoch: &Epoch, - _platform_version: &PlatformVersion, - ) -> Result>, Error> { - let identity_id = self.identity_id(); - let revision = self.revision(); - let public_keys_disabled_at = self.public_keys_disabled_at(); - let (add_public_keys, disable_public_keys) = self.public_keys_to_add_and_disable_owned(); - - let (unique_keys, non_unique_keys): (Vec, Vec) = - add_public_keys - .into_iter() - .partition(|key| key.key_type().is_unique_key_type()); - - let mut drive_operations = vec![]; - - drive_operations.push(IdentityOperation( - IdentityOperationType::UpdateIdentityRevision { - identity_id: identity_id.to_buffer(), - revision, - }, - )); - - if !unique_keys.is_empty() || !non_unique_keys.is_empty() { - drive_operations.push(IdentityOperation( - IdentityOperationType::AddNewKeysToIdentity { - identity_id: identity_id.to_buffer(), - unique_keys_to_add: unique_keys, - non_unique_keys_to_add: non_unique_keys, - }, - )); - } - if let Some(public_keys_disabled_at) = public_keys_disabled_at { - if !disable_public_keys.is_empty() { - drive_operations.push(IdentityOperation( - IdentityOperationType::DisableIdentityKeys { - identity_id: identity_id.to_buffer(), - keys_ids: disable_public_keys, - disable_at: public_keys_disabled_at, - }, - )); - } - } - - Ok(drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/batch/transitions/identity/mod.rs b/packages/rs-drive/src/drive/batch/transitions/identity/mod.rs deleted file mode 100644 index 9acf476f353..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/identity/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod identity_create_transition; -mod identity_credit_transfer; -mod identity_credit_withdrawal_transition; -mod identity_top_up_transition; -mod identity_update_transition; diff --git a/packages/rs-drive/src/drive/batch/transitions/mod.rs b/packages/rs-drive/src/drive/batch/transitions/mod.rs deleted file mode 100644 index 0244e016e18..00000000000 --- a/packages/rs-drive/src/drive/batch/transitions/mod.rs +++ /dev/null @@ -1,63 +0,0 @@ -//! Translation of State Transitions to Drive Operations -//! -//! This module defines general, commonly used functions in Drive. -//! - -mod contract; -mod document; -mod identity; - -use crate::drive::batch::DriveOperation; -use crate::error::Error; -use crate::state_transition_action::StateTransitionAction; -use dpp::block::epoch::Epoch; -use dpp::version::PlatformVersion; - -/// A converter that will get High Level Drive Operations from State transitions -pub trait DriveHighLevelOperationConverter { - /// This will get a list of atomic drive operations from a high level operations - fn into_high_level_drive_operations<'a>( - self, - epoch: &Epoch, - platform_version: &PlatformVersion, - ) -> Result>, Error>; -} - -impl<'s> DriveHighLevelOperationConverter for StateTransitionAction { - fn into_high_level_drive_operations<'a>( - self, - epoch: &Epoch, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - match self { - StateTransitionAction::DataContractCreateAction(data_contract_create_transition) => { - data_contract_create_transition - .into_high_level_drive_operations(epoch, platform_version) - } - StateTransitionAction::DataContractUpdateAction(data_contract_update_transition) => { - data_contract_update_transition - .into_high_level_drive_operations(epoch, platform_version) - } - StateTransitionAction::DocumentsBatchAction(documents_batch_transition) => { - documents_batch_transition.into_high_level_drive_operations(epoch, platform_version) - } - StateTransitionAction::IdentityCreateAction(identity_create_transition) => { - identity_create_transition.into_high_level_drive_operations(epoch, platform_version) - } - StateTransitionAction::IdentityTopUpAction(identity_top_up_transition) => { - identity_top_up_transition.into_high_level_drive_operations(epoch, platform_version) - } - StateTransitionAction::IdentityCreditWithdrawalAction( - identity_credit_withdrawal_transition, - ) => identity_credit_withdrawal_transition - .into_high_level_drive_operations(epoch, platform_version), - StateTransitionAction::IdentityUpdateAction(identity_update_transition) => { - identity_update_transition.into_high_level_drive_operations(epoch, platform_version) - } - StateTransitionAction::IdentityCreditTransferAction( - identity_credit_transfer_transition, - ) => identity_credit_transfer_transition - .into_high_level_drive_operations(epoch, platform_version), - } - } -} diff --git a/packages/rs-drive/src/drive/cache.rs b/packages/rs-drive/src/drive/cache.rs deleted file mode 100644 index 8e15643bfbe..00000000000 --- a/packages/rs-drive/src/drive/cache.rs +++ /dev/null @@ -1,275 +0,0 @@ -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::contract::DataContractFetchInfo; -use crate::drive::Drive; -use crate::error::Error; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::identity::TimestampMillis; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::util::deserializer::ProtocolVersion; -use grovedb::TransactionArg; -#[cfg(any(feature = "full", feature = "verify"))] -use moka::sync::Cache; -#[cfg(any(feature = "full", feature = "verify"))] -use nohash_hasher::IntMap; -use platform_version::version::drive_versions::DriveVersion; -#[cfg(any(feature = "full", feature = "verify"))] -use std::sync::Arc; - -/// Drive cache struct -#[cfg(feature = "full")] -pub struct DriveCache { - /// Cached contracts - pub cached_contracts: DataContractCache, - /// Genesis time in ms - pub genesis_time_ms: Option, - /// Lazy loaded counter of votes to upgrade protocol version - pub protocol_versions_counter: ProtocolVersionsCache, -} - -/// ProtocolVersion cache that handles both global and block data -#[cfg(feature = "full")] -#[derive(Default)] -pub struct ProtocolVersionsCache { - /// The current global cache for protocol versions - // TODO: If we persist this in the state and it should be loaded for correct - // use then it's not actually the cache. Move out of cache because it's confusing - pub global_cache: IntMap, - block_cache: IntMap, - loaded: bool, - needs_wipe: bool, -} - -/// DataContract cache that handles both global and block data -#[cfg(feature = "full")] -pub struct DataContractCache { - global_cache: Cache<[u8; 32], Arc>, - block_cache: Cache<[u8; 32], Arc>, -} - -#[cfg(feature = "full")] -impl ProtocolVersionsCache { - /// Create a new ProtocolVersionsCache instance - pub fn new() -> Self { - Self::default() - } - - /// Load the protocol versions cache from disk if needed - pub fn load_if_needed( - &mut self, - drive: &Drive, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - if !self.loaded { - self.global_cache = drive.fetch_versions_with_counter(transaction, drive_version)?; - self.loaded = true; - }; - Ok(()) - } - - /// Sets the protocol version to the block cache - pub fn set_block_cache_version_count(&mut self, version: ProtocolVersion, count: u64) { - self.block_cache.insert(version, count); - } - - /// Tries to get a version from block cache if present - /// if block cache doesn't have the version set - /// then it tries get the version from global cache - pub fn get(&self, version: &ProtocolVersion) -> Option<&u64> { - if let Some(count) = self.block_cache.get(version) { - Some(count) - } else { - self.global_cache.get(version) - } - } - - /// Merge block cache to global cache - pub fn merge_block_cache(&mut self) { - if self.needs_wipe { - self.global_cache.clear(); - self.block_cache.clear(); - self.needs_wipe = false; - } else { - self.global_cache.extend(self.block_cache.drain()); - } - } - - /// Clear block cache - pub fn clear_block_cache(&mut self) { - self.block_cache.clear() - } - - /// Versions passing threshold - pub fn versions_passing_threshold( - &mut self, - required_upgraded_hpns: u64, - ) -> Vec { - self.needs_wipe = true; - let mut cache = self.global_cache.clone(); - - cache.extend(self.block_cache.drain()); - cache - .into_iter() - .filter_map(|(protocol_version, count)| { - if count >= required_upgraded_hpns { - Some(protocol_version) - } else { - None - } - }) - .collect::>() - } -} - -#[cfg(feature = "full")] -impl DataContractCache { - /// Create a new DataContract cache instance - pub fn new(global_cache_max_capacity: u64, block_cache_max_capacity: u64) -> Self { - Self { - global_cache: Cache::new(global_cache_max_capacity), - block_cache: Cache::new(block_cache_max_capacity), - } - } - - /// Inserts DataContract to block cache - /// otherwise to goes to global cache - pub fn insert(&mut self, fetch_info: Arc, is_block_cache: bool) { - let data_contract_id_bytes = fetch_info.contract.id().to_buffer(); - - if is_block_cache { - self.block_cache.insert(data_contract_id_bytes, fetch_info); - } else { - self.global_cache.insert(data_contract_id_bytes, fetch_info); - } - } - - /// Tries to get a data contract from block cache if present - /// if block cache doesn't have the contract - /// then it tries get the contract from global cache - pub fn get( - &self, - contract_id: [u8; 32], - is_block_cache: bool, - ) -> Option> { - let maybe_fetch_info = if is_block_cache { - self.block_cache.get(&contract_id) - } else { - None - }; - - maybe_fetch_info.or_else(|| self.global_cache.get(&contract_id)) - } - - /// Remove contract from both block and global cache - pub fn remove(&mut self, contract_id: [u8; 32]) { - self.block_cache.remove(&contract_id); - self.global_cache.remove(&contract_id); - } - - /// Merge block cache to global cache - pub fn merge_block_cache(&mut self) { - for (contract_id, fetch_info) in self.block_cache.iter() { - self.global_cache.insert(*contract_id, fetch_info); - } - } - - /// Clear block cache - pub fn clear_block_cache(&mut self) { - self.block_cache.invalidate_all(); - } -} - -#[cfg(feature = "full")] -#[cfg(test)] -mod tests { - use super::*; - - mod get { - use super::*; - use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; - use dpp::version::PlatformVersion; - - #[test] - fn test_get_from_global_cache_when_block_cache_is_not_requested() { - let data_contract_cache = DataContractCache::new(10, 10); - - let protocol_version = PlatformVersion::latest().protocol_version; - - // Create global contract - let fetch_info_global = Arc::new(DataContractFetchInfo::dpns_contract_fixture( - protocol_version, - )); - - let contract_id = fetch_info_global.contract.id().to_buffer(); - - data_contract_cache - .global_cache - .insert(contract_id, Arc::clone(&fetch_info_global)); - - // Create transactional contract with a new version - let mut fetch_info_block = - DataContractFetchInfo::dpns_contract_fixture(protocol_version); - - fetch_info_block.contract.increment_version(); - - let fetch_info_block_boxed = Arc::new(fetch_info_block); - - data_contract_cache - .block_cache - .insert(contract_id, Arc::clone(&fetch_info_block_boxed)); - - let fetch_info_from_cache = data_contract_cache - .get(contract_id, false) - .expect("should be present"); - - assert_eq!(fetch_info_from_cache, fetch_info_global) - } - - #[test] - fn test_get_from_global_cache_when_block_cache_does_not_have_contract() { - let data_contract_cache = DataContractCache::new(10, 10); - - let protocol_version = PlatformVersion::latest().protocol_version; - - let fetch_info_global = Arc::new(DataContractFetchInfo::dpns_contract_fixture( - protocol_version, - )); - - let contract_id = fetch_info_global.contract.id().to_buffer(); - - data_contract_cache - .global_cache - .insert(contract_id, Arc::clone(&fetch_info_global)); - - let fetch_info_from_cache = data_contract_cache - .get(contract_id, true) - .expect("should be present"); - - assert_eq!(fetch_info_from_cache, fetch_info_global) - } - - #[test] - fn test_get_from_block_cache() { - let data_contract_cache = DataContractCache::new(10, 10); - - let protocol_version = PlatformVersion::latest().protocol_version; - - let fetch_info_block = Arc::new(DataContractFetchInfo::dpns_contract_fixture( - protocol_version, - )); - - let contract_id = fetch_info_block.contract.id().to_buffer(); - - data_contract_cache - .block_cache - .insert(contract_id, Arc::clone(&fetch_info_block)); - - let fetch_info_from_cache = data_contract_cache - .get(contract_id, true) - .expect("should be present"); - - assert_eq!(fetch_info_from_cache, fetch_info_block) - } - } -} diff --git a/packages/rs-drive/src/drive/config.rs b/packages/rs-drive/src/drive/config.rs deleted file mode 100644 index 0f4e417d77b..00000000000 --- a/packages/rs-drive/src/drive/config.rs +++ /dev/null @@ -1,158 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Drive Configuration File -//! - -use dpp::fee::epoch::DEFAULT_EPOCHS_PER_ERA; -use serde::{Deserialize, Serialize}; - -/// Boolean if GroveDB batching consistency verification is enabled by default -pub const DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED: bool = false; -/// Boolean if GroveDB has_raw in enabled by default -pub const DEFAULT_GROVE_HAS_RAW_ENABLED: bool = true; -/// The default default query limit -pub const DEFAULT_DEFAULT_QUERY_LIMIT: u16 = 100; -/// The default max query limit -pub const DEFAULT_MAX_QUERY_LIMIT: u16 = 100; -/// Default maximum number of contracts in cache -pub const DEFAULT_DATA_CONTRACTS_CACHE_SIZE: u64 = 500; - -#[derive(Clone, Debug, Serialize, Deserialize)] -/// Encoding for Drive -pub enum DriveEncoding { - /// Drive CBOR - DriveCbor, - /// Drive protobuf - DriveProtobuf, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -/// Drive configuration struct -pub struct DriveConfig { - /// Boolean if batching consistency verification is enabled - #[serde(default = "default_batching_consistency_verification")] - pub batching_consistency_verification: bool, - - /// Boolean if has_raw is enabled - #[serde(default = "default_has_raw_enabled")] - pub has_raw_enabled: bool, - - /// The default returned count if no limit is set - #[serde( - default = "default_default_query_limit", - deserialize_with = "from_str_or_number" - )] - pub default_query_limit: u16, - - /// The default returned count if no limit is set - #[serde( - default = "default_epochs_per_era", - deserialize_with = "from_str_or_number" - )] - pub epochs_per_era: u16, - - /// The limit for user defined queries - #[serde( - default = "default_max_query_limit", - deserialize_with = "from_str_or_number" - )] - pub max_query_limit: u16, - - /// Default genesis time - #[serde(default)] - pub default_genesis_time: Option, - - /// Maximum number of contracts in global cache - #[serde( - default = "default_data_contracts_cache_size", - deserialize_with = "from_str_or_number" - )] - pub data_contracts_global_cache_size: u64, - - /// Maximum number of contracts in block candidate cache - #[serde( - default = "default_data_contracts_cache_size", - deserialize_with = "from_str_or_number" - )] - pub data_contracts_block_cache_size: u64, -} - -fn from_str_or_number<'de, D, T>(deserializer: D) -> Result -where - D: serde::Deserializer<'de>, - T: serde::Deserialize<'de> + std::str::FromStr, - ::Err: std::fmt::Display, -{ - use serde::de::Error; - - let s = String::deserialize(deserializer)?; - s.parse::().map_err(Error::custom) -} - -// Define default functions for serde -fn default_batching_consistency_verification() -> bool { - DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED -} - -fn default_has_raw_enabled() -> bool { - DEFAULT_GROVE_HAS_RAW_ENABLED -} - -fn default_default_query_limit() -> u16 { - DEFAULT_DEFAULT_QUERY_LIMIT -} - -fn default_epochs_per_era() -> u16 { - DEFAULT_EPOCHS_PER_ERA -} - -fn default_max_query_limit() -> u16 { - DEFAULT_MAX_QUERY_LIMIT -} - -fn default_data_contracts_cache_size() -> u64 { - DEFAULT_DATA_CONTRACTS_CACHE_SIZE -} - -impl Default for DriveConfig { - fn default() -> Self { - DriveConfig { - batching_consistency_verification: - DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED, - has_raw_enabled: DEFAULT_GROVE_HAS_RAW_ENABLED, - default_query_limit: DEFAULT_DEFAULT_QUERY_LIMIT, - epochs_per_era: DEFAULT_EPOCHS_PER_ERA, - max_query_limit: DEFAULT_MAX_QUERY_LIMIT, - default_genesis_time: None, - data_contracts_global_cache_size: DEFAULT_DATA_CONTRACTS_CACHE_SIZE, - data_contracts_block_cache_size: DEFAULT_DATA_CONTRACTS_CACHE_SIZE, - } - } -} diff --git a/packages/rs-drive/src/drive/constants.rs b/packages/rs-drive/src/drive/constants.rs new file mode 100644 index 00000000000..41644ad7ddd --- /dev/null +++ b/packages/rs-drive/src/drive/constants.rs @@ -0,0 +1,74 @@ +//! Drive Constants +//! +//! Constants values that will NEVER change. +//! + +///DataContract Documents subtree path height +pub const CONTRACT_DOCUMENTS_PATH_HEIGHT: u16 = 4; +/// Base contract root path size +pub const BASE_CONTRACT_ROOT_PATH_SIZE: u32 = 33; // 1 + 32 +/// Base contract keeping_history_storage path size +pub const BASE_CONTRACT_KEEPING_HISTORY_STORAGE_PATH_SIZE: u32 = 34; // 1 + 32 + 1 +/// Base contract documents_keeping_history_storage_time_reference path size +pub const BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_STORAGE_TIME_REFERENCE_PATH: u32 = 75; +/// Base contract documents_keeping_history_primary_key path for document ID size +pub const BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_PRIMARY_KEY_PATH_FOR_DOCUMENT_ID_SIZE: u32 = 67; // 1 + 32 + 1 + 1 + 32, then we need to add document_type_name.len() +/// BaseDataContract Documents path size +pub const BASE_CONTRACT_DOCUMENTS_PATH: u32 = 34; +/// BaseDataContract Documents primary key path +pub const BASE_CONTRACT_DOCUMENTS_PRIMARY_KEY_PATH: u32 = 35; + +/// Some optimized document reference size +pub const OPTIMIZED_DOCUMENT_REFERENCE: u16 = 34; + +/// Empty tree storage size +pub const EMPTY_TREE_STORAGE_SIZE: u32 = 33; +/// Max index size +pub const MAX_INDEX_SIZE: usize = 255; +/// Storage flags size +pub const STORAGE_FLAGS_SIZE: u32 = 2; + +/// Default required bytes to hold a user balance +/// TODO We probably don't need it anymore since we always pay for 9 bytes +pub const AVERAGE_BALANCE_SIZE: u32 = 6; + +/// Default required bytes to hold a public key +pub const AVERAGE_KEY_SIZE: u32 = 50; + +/// How many updates would occur on average for an item +pub const AVERAGE_NUMBER_OF_UPDATES: u8 = 10; + +/// How many bytes are added on average per update +/// 1 here signifies less than 128 +pub const AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE: u8 = 1; + +/// The estimated average document type name size +pub const ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE: u8 = 12; + +/// The estimated average index name size +pub const ESTIMATED_AVERAGE_INDEX_NAME_SIZE: u8 = 16; + +/// The estimated count of identities having the same key if they are not unique +pub const ESTIMATED_NON_UNIQUE_KEY_DUPLICATES: u32 = 2; + +/// The average size of an item that is acting as a tree reference towards the contested item vote +pub const AVERAGE_CONTESTED_RESOURCE_ITEM_REFERENCE_SIZE: u32 = 150; + +/// Contested document reference size +// we need to construct the reference from the split height of the contract document +// type which is at 4 +// 0 represents document storage +// Then we add document id +// Then we add 0 if the document type keys history +// vec![vec![0], Vec::from(document.id)]; +// 1 (vec size) + 1 (subvec size) + 32 (document id size) = 34 +// + 6 = 40 +// 6 because of: +// 1 for type reference +// 1 for reference type +// 1 for root height offset +// reference path size +// 1 reference_hops options +// 1 reference_hops count +// 1 element flags option +pub const CONTESTED_DOCUMENT_REFERENCE_SIZE: u32 = 40; diff --git a/packages/rs-drive/src/drive/contract/apply/apply_contract/mod.rs b/packages/rs-drive/src/drive/contract/apply/apply_contract/mod.rs index d0f6dc57dd7..6d167865cc9 100644 --- a/packages/rs-drive/src/drive/contract/apply/apply_contract/mod.rs +++ b/packages/rs-drive/src/drive/contract/apply/apply_contract/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::flags::StorageFlags; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; diff --git a/packages/rs-drive/src/drive/contract/apply/apply_contract/v0/mod.rs b/packages/rs-drive/src/drive/contract/apply/apply_contract/v0/mod.rs index d29f0e9a8bc..795ed88a807 100644 --- a/packages/rs-drive/src/drive/contract/apply/apply_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/apply/apply_contract/v0/mod.rs @@ -1,12 +1,13 @@ -use crate::drive::flags::StorageFlags; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; use dpp::serialization::PlatformSerializableWithPlatformVersion; +use crate::error::contract::DataContractError; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -39,6 +40,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the contract application or fee calculation fails. + #[inline(always)] pub(super) fn apply_contract_v0( &self, contract: &DataContract, @@ -62,6 +64,7 @@ impl Drive { /// Gets the operations for applying a contract /// If the contract already exists, we get operations for an update /// Otherwise we get operations for an insert + #[inline(always)] pub(super) fn apply_contract_operations_v0( &self, contract: &DataContract, @@ -76,6 +79,16 @@ impl Drive { let serialized_contract = contract .serialize_to_bytes_with_platform_version(platform_version) .map_err(Error::Protocol)?; + + if serialized_contract.len() as u64 > u32::MAX as u64 + || serialized_contract.len() as u32 + > platform_version.dpp.contract_versions.max_serialized_size + { + // This should normally be caught by DPP, but there is a rare possibility that the + // re-serialized size is bigger than the original serialized data contract. + return Err(Error::DataContract(DataContractError::ContractTooBig(format!("Trying to insert a data contract of size {} that is over the max allowed insertion size {}", serialized_contract.len(), platform_version.dpp.contract_versions.max_serialized_size)))); + } + self.apply_contract_with_serialization_operations( contract, serialized_contract, diff --git a/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/mod.rs b/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/mod.rs index 4c9018c408e..6da197cc243 100644 --- a/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/mod.rs +++ b/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::flags::StorageFlags; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; diff --git a/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs b/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs index b38bdbbfac4..816b660e324 100644 --- a/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs @@ -1,14 +1,13 @@ -use crate::drive::contract::paths::{contract_keeping_history_storage_path, contract_root_path}; -use crate::drive::defaults::CONTRACT_MAX_SERIALIZED_SIZE; +use crate::drive::contract::paths::{contract_keeping_history_root_path, contract_root_path}; -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; -use crate::drive::grove_operations::{DirectQueryType, QueryType}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use crate::util::grove_operations::{DirectQueryType, QueryType}; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::platform_value::string_encoding::Encoding; @@ -26,6 +25,7 @@ use std::collections::HashMap; impl Drive { /// Applies a contract and returns the fee for applying. /// If the contract already exists, an update is applied, otherwise an insert. + #[inline(always)] pub(super) fn apply_contract_with_serialization_v0( &self, contract: &DataContract, @@ -60,12 +60,14 @@ impl Drive { &platform_version.drive, )?; cost_operations.push(CalculatedCostOperation(fetch_cost)); + let fees = Drive::calculate_fee( None, Some(cost_operations), &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok(fees) } @@ -73,6 +75,7 @@ impl Drive { /// Gets the operations for applying a contract with it's serialization /// If the contract already exists, we get operations for an update /// Otherwise we get operations for an insert + #[inline(always)] pub(super) fn apply_contract_with_serialization_operations_v0( &self, contract: &DataContract, @@ -99,12 +102,16 @@ impl Drive { in_tree_using_sums: false, // we can ignore flags as this is just an approximation // and it's doubtful that contracts will always be inserted at max size - query_target: QueryTargetValue(CONTRACT_MAX_SERIALIZED_SIZE as u32), + query_target: QueryTargetValue( + platform_version + .system_limits + .estimated_contract_max_serialized_size as u32, + ), } }; // We can do a get direct because there are no references involved - match self.grove_get_raw( + match self.grove_get_raw_optional( (&contract_root_path(contract.id_ref().as_bytes())).into(), &[0], direct_query_type, @@ -126,9 +133,7 @@ impl Drive { // we need to get the latest of a contract that keeps history, can't be raw since there is a reference let stored_element = self .grove_get( - (&contract_keeping_history_storage_path( - contract.id_ref().as_bytes(), - )) + (&contract_keeping_history_root_path(contract.id_ref().as_bytes())) .into(), &[0], QueryType::StatefulQuery, diff --git a/packages/rs-drive/src/drive/contract/contract_fetch_info.rs b/packages/rs-drive/src/drive/contract/contract_fetch_info.rs index 3565b1ccc66..cd22aea53d8 100644 --- a/packages/rs-drive/src/drive/contract/contract_fetch_info.rs +++ b/packages/rs-drive/src/drive/contract/contract_fetch_info.rs @@ -1,7 +1,9 @@ -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; use dpp::data_contract::DataContract; +#[cfg(feature = "fixtures-and-mocks")] use dpp::data_contracts; use dpp::fee::fee_result::FeeResult; +#[cfg(feature = "fixtures-and-mocks")] use dpp::system_data_contracts::load_system_data_contract; #[cfg(feature = "fixtures-and-mocks")] use dpp::tests::fixtures::get_dashpay_contract_fixture; @@ -10,8 +12,8 @@ use dpp::tests::fixtures::get_dpns_data_contract_fixture; #[cfg(feature = "fixtures-and-mocks")] use dpp::tests::fixtures::get_masternode_reward_shares_data_contract_fixture; use grovedb_costs::OperationCost; - -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(feature = "fixtures-and-mocks")] +use platform_version::version::PlatformVersion; /// DataContract and fetch information #[derive(PartialEq, Debug, Clone)] pub struct DataContractFetchInfo { @@ -31,7 +33,7 @@ pub struct DataContractFetchInfo { impl DataContractFetchInfo { /// This should ONLY be used for tests pub fn dpns_contract_fixture(protocol_version: u32) -> Self { - let dpns = get_dpns_data_contract_fixture(None, protocol_version); + let dpns = get_dpns_data_contract_fixture(None, 0, protocol_version); DataContractFetchInfo { contract: dpns.data_contract_owned(), storage_flags: None, @@ -42,7 +44,7 @@ impl DataContractFetchInfo { /// This should ONLY be used for tests pub fn dashpay_contract_fixture(protocol_version: u32) -> Self { - let dashpay = get_dashpay_contract_fixture(None, protocol_version); + let dashpay = get_dashpay_contract_fixture(None, 0, protocol_version); DataContractFetchInfo { contract: dashpay.data_contract_owned(), storage_flags: None, @@ -65,11 +67,15 @@ impl DataContractFetchInfo { /// This should ONLY be used for tests pub fn withdrawals_contract_fixture(protocol_version: u32) -> Self { + let platform_version = + PlatformVersion::get(protocol_version).expect("expected to get version"); + let contract = load_system_data_contract( data_contracts::SystemDataContract::Withdrawals, - protocol_version, + platform_version, ) .expect("to load system data contract"); + DataContractFetchInfo { contract, storage_flags: None, diff --git a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs index 6921c6bda57..ba04d65bc61 100644 --- a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs @@ -1,11 +1,8 @@ -use crate::drive::contract::paths::contract_keeping_history_storage_path; -use crate::drive::defaults::{ - AVERAGE_NUMBER_OF_UPDATES, DEFAULT_FLOAT_SIZE, DEFAULT_FLOAT_SIZE_U8, - ESTIMATED_AVERAGE_INDEX_NAME_SIZE, -}; -use crate::drive::document::contract_document_type_path; -use crate::drive::flags::StorageFlags; +use crate::drive::constants::{AVERAGE_NUMBER_OF_UPDATES, ESTIMATED_AVERAGE_INDEX_NAME_SIZE}; +use crate::drive::contract::paths::contract_keeping_history_root_path; +use crate::drive::document::paths::contract_document_type_path; use crate::drive::Drive; +use crate::util::storage_flags::StorageFlags; use crate::error::Error; use dpp::data_contract::accessors::v0::DataContractV0Getters; @@ -14,6 +11,8 @@ use dpp::data_contract::DataContract; use dpp::serialization::PlatformSerializableWithPlatformVersion; +use crate::drive::votes::paths::vote_contested_resource_active_polls_contract_document_tree_path; +use crate::util::type_constants::{DEFAULT_FLOAT_SIZE, DEFAULT_FLOAT_SIZE_U8}; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel}; @@ -24,6 +23,7 @@ use std::collections::HashMap; impl Drive { /// Adds the estimation costs for a contract insertion + #[inline(always)] pub(super) fn add_estimation_costs_for_contract_insertion_v0( contract: &DataContract, estimated_costs_only_with_layer_info: &mut HashMap, @@ -42,6 +42,37 @@ impl Drive { None }; + let document_types_with_contested_unique_indexes = + contract.document_types_with_contested_indexes(); + + if !document_types_with_contested_unique_indexes.is_empty() { + Self::add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded( + contract, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + + for document_type_name in document_types_with_contested_unique_indexes.keys() { + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path( + vote_contested_resource_active_polls_contract_document_tree_path( + contract.id_ref().as_bytes(), + document_type_name.as_str(), + ), + ), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(2), + estimated_layer_sizes: AllSubtrees( + ESTIMATED_AVERAGE_INDEX_NAME_SIZE, + NoSumTrees, + None, + ), + }, + ); + } + } + for document_type_name in contract.document_types().keys() { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(contract_document_type_path( @@ -61,14 +92,14 @@ impl Drive { } if contract.config().keeps_history() { - // we are dealing with a sibling reference - // sibling reference serialized size is going to be the encoded time size + // We are dealing with a sibling reference. + // The sibling reference serialized size is going to be the encoded time size // (DEFAULT_FLOAT_SIZE) plus 1 byte for reference type and 1 byte for the space of // the encoded time let reference_size = DEFAULT_FLOAT_SIZE + 2; estimated_costs_only_with_layer_info.insert( - KeyInfoPath::from_known_path(contract_keeping_history_storage_path( + KeyInfoPath::from_known_path(contract_keeping_history_root_path( contract.id_ref().as_bytes(), )), EstimatedLayerInformation { diff --git a/packages/rs-drive/src/drive/contract/estimation_costs/mod.rs b/packages/rs-drive/src/drive/contract/estimation_costs/mod.rs index 43fcd9c603a..11258554b45 100644 --- a/packages/rs-drive/src/drive/contract/estimation_costs/mod.rs +++ b/packages/rs-drive/src/drive/contract/estimation_costs/mod.rs @@ -1,3 +1,2 @@ /// The estimated costs for a contract insert mod add_estimation_costs_for_contract_insertion; -pub use add_estimation_costs_for_contract_insertion::*; diff --git a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/mod.rs index 8582b423238..6d4e9ae0793 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/mod.rs @@ -4,7 +4,7 @@ use crate::drive::contract::DataContractFetchInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; use grovedb_costs::{CostResult, CostsExt, OperationCost}; diff --git a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/v0/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/v0/mod.rs index 429b4ede574..19f51db1902 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract/v0/mod.rs @@ -1,11 +1,11 @@ use crate::drive::contract::{paths, DataContractFetchInfo}; -use crate::drive::flags::StorageFlags; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::{CalculatedCostOperation, PreCalculatedFeeResult}; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::{CalculatedCostOperation, PreCalculatedFeeResult}; +use crate::util::storage_flags::StorageFlags; use dpp::block::epoch::Epoch; use dpp::data_contract::DataContract; use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; @@ -42,6 +42,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the contract fetching or fee calculation fails. + #[inline(always)] pub(super) fn fetch_contract_v0( &self, contract_id: [u8; 32], @@ -55,10 +56,11 @@ impl Drive { // We need to pass allow cache to false let (value, mut cost) = if known_keeps_history.unwrap_or_default() { let CostContext { value, cost } = self.grove.get_caching_optional( - (&paths::contract_keeping_history_storage_path(&contract_id)).into(), + (&paths::contract_keeping_history_root_path(&contract_id)).into(), &[0], false, transaction, + &platform_version.drive.grove_version, ); (value, cost) } else { @@ -67,6 +69,7 @@ impl Drive { &[0], false, transaction, + &platform_version.drive.grove_version, ); (value, cost) }; @@ -91,7 +94,8 @@ impl Drive { Some(vec![drive_operation]), epoch, self.config.epochs_per_era, - platform_version + platform_version, + None, ) )) } else { @@ -117,10 +121,11 @@ impl Drive { value, cost: secondary_cost, } = self.grove.get_caching_optional( - (&paths::contract_keeping_history_storage_path(&contract_id)).into(), + (&paths::contract_keeping_history_root_path(&contract_id)).into(), &[0], false, transaction, + &platform_version.drive.grove_version, ); cost.add_assign(secondary_cost); @@ -145,7 +150,8 @@ impl Drive { Some(vec![drive_operation]), epoch, self.config.epochs_per_era, - platform_version + platform_version, + None, ) )) } else { @@ -192,6 +198,7 @@ impl Drive { } /// Fetch contract from database and add operations + #[inline(always)] pub(super) fn fetch_contract_and_add_operations_v0( &self, contract_id: [u8; 32], diff --git a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/mod.rs index 473a187dd6c..ee60215b7fe 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/mod.rs @@ -79,14 +79,14 @@ impl Drive { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use super::*; use crate::error::drive::DriveError; use crate::error::Error; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::config::v0::DataContractConfigSettersV0; @@ -160,6 +160,7 @@ mod tests { "niceDocument", updated_document.clone(), true, + &mut vec![], platform_version, ) .expect("to be able to set document schema"); @@ -250,7 +251,7 @@ mod tests { fn setup_test() -> TestData { let data_contract = - get_data_contract_fixture(None, PlatformVersion::latest().protocol_version) + get_data_contract_fixture(None, 0, PlatformVersion::latest().protocol_version) .data_contract_owned(); TestData { diff --git a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/v0/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/v0/mod.rs index 38d81fdeab9..5f5a368beff 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/fetch_contract_with_history/v0/mod.rs @@ -1,4 +1,4 @@ -use crate::common::decode::decode_u64; +use crate::util::common::decode::decode_u64; use crate::drive::Drive; use crate::error::drive::DriveError; @@ -47,6 +47,7 @@ impl Drive { /// * If the contract cannot be deserialized due to protocol errors. /// /// * If the queried contract path does not refer to a contract element. + #[inline(always)] pub(super) fn fetch_contract_with_history_v0( &self, contract_id: [u8; 32], diff --git a/packages/rs-drive/src/drive/contract/get_fetch/get_cached_contract_with_fetch_info/v0/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/get_cached_contract_with_fetch_info/v0/mod.rs index 79fb9c71a2e..0e2d6af17d0 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/get_cached_contract_with_fetch_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/get_cached_contract_with_fetch_info/v0/mod.rs @@ -5,15 +5,14 @@ use std::sync::Arc; impl Drive { /// Returns the contract fetch info with the given ID if it's in cache. + #[inline(always)] pub(super) fn get_cached_contract_with_fetch_info_v0( &self, contract_id: [u8; 32], transaction: TransactionArg, ) -> Option> { self.cache - .read() - .unwrap() - .cached_contracts + .data_contracts .get(contract_id, transaction.is_some()) .map(|fetch_info| Arc::clone(&fetch_info)) } diff --git a/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/mod.rs index 0192b1290a1..e49ee0b1f85 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/mod.rs @@ -4,7 +4,7 @@ use crate::drive::contract::DataContractFetchInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; @@ -181,12 +181,12 @@ impl Drive { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use crate::drive::contract::tests::setup_reference_contract; - use crate::drive::flags::StorageFlags; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::storage_flags::StorageFlags; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; @@ -213,6 +213,7 @@ mod tests { true, Some(&transaction), platform_version, + None, ) .expect("should update contract"); @@ -276,7 +277,7 @@ mod tests { assert_eq!( result.0, Some(FeeResult { - processing_fee: 4060, + processing_fee: 2800, ..Default::default() }) ); @@ -362,9 +363,7 @@ mod tests { // Commit transaction and merge block (transactional) cache to global cache transaction.commit().expect("expected to commit"); - let mut drive_cache = drive.cache.write().unwrap(); - drive_cache.cached_contracts.merge_block_cache(); - drop(drive_cache); + drive.cache.data_contracts.merge_and_clear_block_cache(); /* *DataContracts fetched with user query and during block execution must have equal costs diff --git a/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/v0/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/v0/mod.rs index 9e48288ace0..4d7e51f7a1d 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/get_contract_with_fetch_info/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::contract::DataContractFetchInfo; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::{CalculatedCostOperation, PreCalculatedFeeResult}; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::{CalculatedCostOperation, PreCalculatedFeeResult}; use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; @@ -32,6 +32,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the contract fetching fails. + #[inline(always)] pub(super) fn get_contract_with_fetch_info_v0( &self, contract_id: [u8; 32], @@ -73,6 +74,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the contract fetching or fee calculation fails. + #[inline(always)] pub(super) fn get_contract_with_fetch_info_and_fee_v0( &self, contract_id: [u8; 32], @@ -98,6 +100,7 @@ impl Drive { epoch, self.config.epochs_per_era, platform_version, + None, ) .map(Some) })?; @@ -105,6 +108,7 @@ impl Drive { } /// Returns the contract with fetch info and operations with the given ID. + #[inline(always)] pub(super) fn get_contract_with_fetch_info_and_add_to_operations_v0( &self, contract_id: [u8; 32], @@ -114,10 +118,9 @@ impl Drive { drive_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result>, Error> { - let cache = self.cache.read().unwrap(); - - match cache - .cached_contracts + match self + .cache + .data_contracts .get(contract_id, transaction.is_some()) { None => { @@ -132,10 +135,8 @@ impl Drive { if add_to_cache_if_pulled { // Store a contract in cache if present if let Some(contract_fetch_info) = &maybe_contract_fetch_info { - drop(cache); - let mut cache = self.cache.write().unwrap(); - cache - .cached_contracts + self.cache + .data_contracts .insert(Arc::clone(contract_fetch_info), transaction.is_some()); }; } @@ -155,6 +156,7 @@ impl Drive { epoch, self.config.epochs_per_era, platform_version, + None, )?; let updated_contract_fetch_info = Arc::new(DataContractFetchInfo { @@ -163,11 +165,9 @@ impl Drive { cost: contract_fetch_info.cost.clone(), fee: Some(fee.clone()), }); - drop(cache); - let mut cache = self.cache.write().unwrap(); // we override the cache for the contract as the fee is now calculated - cache - .cached_contracts + self.cache + .data_contracts .insert(updated_contract_fetch_info, transaction.is_some()); fee diff --git a/packages/rs-drive/src/drive/contract/get_fetch/get_contracts_with_fetch_info/v0/mod.rs b/packages/rs-drive/src/drive/contract/get_fetch/get_contracts_with_fetch_info/v0/mod.rs index 2e6d723366f..be1654fc4d9 100644 --- a/packages/rs-drive/src/drive/contract/get_fetch/get_contracts_with_fetch_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/get_fetch/get_contracts_with_fetch_info/v0/mod.rs @@ -29,6 +29,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the contract fetching fails. + #[inline(always)] pub(super) fn get_contracts_with_fetch_info_v0( &self, contract_ids: &[[u8; 32]], diff --git a/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs b/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs index b52aadd665b..8844fe39bcc 100644 --- a/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs @@ -1,16 +1,16 @@ -use crate::common::encode::encode_u64; use crate::drive::contract::paths; -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::{BatchInsertTreeApplyType, DirectQueryType}; -use crate::drive::object_size_info::DriveKeyInfo::KeyRef; -use crate::drive::object_size_info::PathKeyElementInfo::{ - PathFixedSizeKeyRefElement, PathKeyElementSize, -}; -use crate::drive::object_size_info::PathKeyInfo; use crate::drive::Drive; use crate::drive::LowLevelDriveOperation; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::common::encode::encode_u64; +use crate::util::grove_operations::{BatchInsertTreeApplyType, DirectQueryType}; +use crate::util::object_size_info::DriveKeyInfo::KeyRef; +use crate::util::object_size_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyElementSize, +}; +use crate::util::object_size_info::PathKeyInfo; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::config::v0::DataContractConfigGettersV0; @@ -24,6 +24,7 @@ use std::collections::HashMap; impl Drive { /// Adds a contract to storage. + #[inline(always)] pub(super) fn add_contract_to_storage_v0( &self, contract_element: Element, @@ -78,6 +79,7 @@ impl Drive { self.batch_insert_empty_tree_if_not_exists( key_info, + false, storage_flags.as_ref().map(|flags| flags.as_ref()), apply_type, transaction, @@ -89,7 +91,7 @@ impl Drive { let encoded_time = encode_u64(block_info.time_ms); let contract_keeping_history_storage_path = - paths::contract_keeping_history_storage_path(contract.id_ref().as_bytes()); + paths::contract_keeping_history_root_path(contract.id_ref().as_bytes()); if !is_first_insert { // we can use a DirectQueryType::StatefulDirectQuery because if we were stateless we would always think diff --git a/packages/rs-drive/src/drive/contract/insert/insert_contract/mod.rs b/packages/rs-drive/src/drive/contract/insert/insert_contract/mod.rs index 98e43a3b813..8b39715cbb7 100644 --- a/packages/rs-drive/src/drive/contract/insert/insert_contract/mod.rs +++ b/packages/rs-drive/src/drive/contract/insert/insert_contract/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; diff --git a/packages/rs-drive/src/drive/contract/insert/insert_contract/v0/mod.rs b/packages/rs-drive/src/drive/contract/insert/insert_contract/v0/mod.rs index 8233b88b3bf..207626f0641 100644 --- a/packages/rs-drive/src/drive/contract/insert/insert_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/insert/insert_contract/v0/mod.rs @@ -1,11 +1,11 @@ use crate::drive::contract::paths; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DriveKeyInfo::{Key, KeyRef}; -use crate::drive::{contract_documents_path, Drive, RootTree}; +use crate::drive::{contract_documents_path, votes, Drive, RootTree}; +use crate::util::object_size_info::DriveKeyInfo::{Key, KeyRef}; +use crate::util::storage_flags::StorageFlags; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::config::v0::DataContractConfigGettersV0; @@ -15,6 +15,10 @@ use dpp::fee::fee_result::FeeResult; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::serialization::PlatformSerializableWithPlatformVersion; +use crate::drive::votes::paths::{ + CONTESTED_DOCUMENT_INDEXES_TREE_KEY, CONTESTED_DOCUMENT_STORAGE_TREE_KEY, +}; +use crate::error::contract::DataContractError; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; @@ -22,6 +26,7 @@ use std::collections::{HashMap, HashSet}; impl Drive { /// Insert a contract. + #[inline(always)] pub(super) fn insert_contract_v0( &self, contract: &DataContract, @@ -41,8 +46,20 @@ impl Drive { None }; + let serialized_contract = + contract.serialize_to_bytes_with_platform_version(platform_version)?; + + if serialized_contract.len() as u64 > u32::MAX as u64 + || serialized_contract.len() as u32 + > platform_version.dpp.contract_versions.max_serialized_size + { + // This should normally be caught by DPP, but there is a rare possibility that the + // re-serialized size is bigger than the original serialized data contract. + return Err(Error::DataContract(DataContractError::ContractTooBig(format!("Trying to insert a data contract of size {} that is over the max allowed insertion size {}", serialized_contract.len(), platform_version.dpp.contract_versions.max_serialized_size)))); + } + let contract_element = Element::Item( - contract.serialize_to_bytes_with_platform_version(platform_version)?, + serialized_contract, StorageFlags::map_to_some_element_flags(storage_flags.as_ref()), ); @@ -62,6 +79,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, ) } @@ -101,6 +119,7 @@ impl Drive { /// The operations for adding a contract. /// These operations add a contract to storage using `add_contract_to_storage` /// and insert the empty trees which will be necessary to later insert documents. + #[inline(always)] pub(super) fn insert_contract_add_operations_v0( &self, contract_element: Element, @@ -170,9 +189,81 @@ impl Drive { &platform_version.drive, )?; + // If the contract happens to contain any contested indexes then we add the contract to the + // contested contracts + + let document_types_with_contested_indexes = + contract.document_types_with_contested_indexes(); + + if !document_types_with_contested_indexes.is_empty() { + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contested_document_tree_levels_up_to_contract( + contract, + None, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + let contested_contract_root_path = + votes::paths::vote_contested_resource_active_polls_tree_path(); + + self.batch_insert_empty_tree( + contested_contract_root_path, + KeyRef(contract.id_ref().as_bytes()), + storage_flags.as_ref(), + &mut batch_operations, + &platform_version.drive, + )?; + + let contested_unique_index_contract_document_types_path = + votes::paths::vote_contested_resource_active_polls_contract_tree_path( + contract.id_ref().as_bytes(), + ); + + for (type_key, _document_type) in document_types_with_contested_indexes.into_iter() { + self.batch_insert_empty_tree( + contested_unique_index_contract_document_types_path, + KeyRef(type_key.as_bytes()), + storage_flags.as_ref(), + &mut batch_operations, + &platform_version.drive, + )?; + + let type_path = [ + contested_unique_index_contract_document_types_path[0], + contested_unique_index_contract_document_types_path[1], + contested_unique_index_contract_document_types_path[2], + contested_unique_index_contract_document_types_path[3], + type_key.as_bytes(), + ]; + + // primary key tree + let key_info_storage = Key(vec![CONTESTED_DOCUMENT_STORAGE_TREE_KEY]); + self.batch_insert_empty_tree( + type_path, + key_info_storage, + storage_flags.as_ref(), + &mut batch_operations, + &platform_version.drive, + )?; + + // index key tree + let key_info_indexes = Key(vec![CONTESTED_DOCUMENT_INDEXES_TREE_KEY]); + self.batch_insert_empty_tree( + type_path, + key_info_indexes, + storage_flags.as_ref(), + &mut batch_operations, + &platform_version.drive, + )?; + } + } + // next we should store each document type // right now we are referring them by name - // toDo: change this to be a reference by index + // todo: maybe change this to be a reference by index let contract_documents_path = contract_documents_path(contract.id_ref().as_bytes()); for (type_key, document_type) in contract.document_types().iter() { diff --git a/packages/rs-drive/src/drive/contract/mod.rs b/packages/rs-drive/src/drive/contract/mod.rs index f6aa60708e6..6ccfda82925 100644 --- a/packages/rs-drive/src/drive/contract/mod.rs +++ b/packages/rs-drive/src/drive/contract/mod.rs @@ -1,67 +1,38 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! DriveDataContracts. //! //! This module defines functions pertinent toDataContracts stored in Drive. //! -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod apply; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(feature = "server")] mod contract_fetch_info; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod estimation_costs; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod get_fetch; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod insert; /// Various paths for contract operations -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub mod paths; -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) mod prove; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) mod queries; #[cfg(feature = "fixtures-and-mocks")] /// Test helpers and utility methods pub mod test_helpers; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod update; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(feature = "server")] pub use contract_fetch_info::*; /// How many contracts to fetch at once. This is an arbitrary number and is needed to prevent /// the server from being overloaded with requests. pub const MAX_CONTRACT_HISTORY_FETCH_LIMIT: u16 = 10; -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use dpp::block::block_info::BlockInfo; @@ -70,11 +41,9 @@ mod tests { use std::borrow::Cow; use std::option::Option::None; - use crate::drive::flags::StorageFlags; - use crate::drive::object_size_info::{ - DocumentAndContractInfo, DocumentInfo, OwnedDocumentInfo, - }; use crate::drive::Drive; + use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfo, OwnedDocumentInfo}; + use crate::util::storage_flags::StorageFlags; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::random_document::CreateRandomDocument; use dpp::data_contract::schema::DataContractSchemaMethodsV0; @@ -92,9 +61,12 @@ mod tests { use dpp::tests::json_document::json_document_to_contract; use crate::drive::identity::key::fetch::{IdentityKeysRequest, KeyIDIdentityPublicKeyPairVec}; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::version::PlatformVersion; + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] fn setup_deep_nested_50_contract() -> (Drive, DataContract) { let drive: Drive = setup_drive_with_initial_state_structure(); let platform_version = PlatformVersion::latest(); @@ -118,6 +90,8 @@ mod tests { } #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] fn setup_deep_nested_10_contract() -> (Drive, DataContract) { let drive: Drive = setup_drive_with_initial_state_structure(); let platform_version = PlatformVersion::latest(); @@ -168,7 +142,7 @@ mod tests { let platform_version = PlatformVersion::latest(); // let's construct the grovedb structure for the dashpay data contract - let contract = get_dashpay_contract_fixture(None, 1).data_contract_owned(); + let contract = get_dashpay_contract_fixture(None, 0, 1).data_contract_owned(); drive .apply_contract( &contract, @@ -189,7 +163,7 @@ mod tests { let platform_version = PlatformVersion::latest(); // let's construct the grovedb structure for the dashpay data contract - let contract = get_dashpay_contract_with_generalized_encryption_key_fixture(None, 1) + let contract = get_dashpay_contract_with_generalized_encryption_key_fixture(None, 0, 1) .data_contract_owned(); drive .apply_contract( @@ -227,7 +201,7 @@ mod tests { }); contract - .set_document_schema("note2", note2_schema, true, platform_version) + .set_document_schema("note2", note2_schema, true, &mut vec![], platform_version) .expect("should set a document schema"); drive @@ -263,7 +237,7 @@ mod tests { // // let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); // drive - // .add_document_for_contract( + // .add_contested_document_for_contract( // DocumentAndContractInfo { // owned_document_info: OwnedDocumentInfo { // document_info: DocumentInfo::DocumentRefInfo((&document, storage_flags)), @@ -316,6 +290,7 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); } @@ -518,6 +493,7 @@ mod tests { false, None, platform_version, + None, ) .expect("expected to apply contract successfully"); } diff --git a/packages/rs-drive/src/drive/contract/paths.rs b/packages/rs-drive/src/drive/contract/paths.rs index 4af51dac788..2221e398ebe 100644 --- a/packages/rs-drive/src/drive/contract/paths.rs +++ b/packages/rs-drive/src/drive/contract/paths.rs @@ -103,7 +103,7 @@ pub fn contract_storage_path_vec(contract_id: &[u8]) -> Vec> { } /// Takes a contract ID and returns the contract's storage history path. -pub fn contract_keeping_history_storage_path_vec(contract_id: &[u8]) -> Vec> { +pub fn contract_keeping_history_root_path_vec(contract_id: &[u8]) -> Vec> { vec![ Into::<&[u8; 1]>::into(RootTree::DataContractDocuments).to_vec(), contract_id.to_vec(), @@ -112,7 +112,7 @@ pub fn contract_keeping_history_storage_path_vec(contract_id: &[u8]) -> Vec [&[u8]; 3] { +pub fn contract_keeping_history_root_path(contract_id: &[u8]) -> [&[u8]; 3] { [ Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), contract_id, diff --git a/packages/rs-drive/src/drive/contract/prove/mod.rs b/packages/rs-drive/src/drive/contract/prove/mod.rs index e1776aff435..6b3e674d2d0 100644 --- a/packages/rs-drive/src/drive/contract/prove/mod.rs +++ b/packages/rs-drive/src/drive/contract/prove/mod.rs @@ -1,11 +1,8 @@ /// The `prove_contract` module provides functionality for getting a proved contract. mod prove_contract; -pub use prove_contract::*; /// The `prove_contract_history` module provides functionality for getting contract historical proofs. mod prove_contract_history; -pub use prove_contract_history::*; /// The `prove_contract` module provides functionality for getting multiple proved contracts. mod prove_contracts; -pub use prove_contracts::*; diff --git a/packages/rs-drive/src/drive/contract/prove/prove_contract/v0/mod.rs b/packages/rs-drive/src/drive/contract/prove/prove_contract/v0/mod.rs index a80e7bc13ab..94a6484ccd1 100644 --- a/packages/rs-drive/src/drive/contract/prove/prove_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/prove/prove_contract/v0/mod.rs @@ -1,6 +1,7 @@ use crate::drive::Drive; use crate::error::Error; +use crate::drive::contract::paths::contract_root_path; use dpp::version::PlatformVersion; use grovedb::TransactionArg; @@ -25,60 +26,33 @@ impl Drive { /// # Errors /// /// This function returns an error if the path query generation or proof generation fails. + #[inline(always)] pub(super) fn prove_contract_v0( &self, contract_id: [u8; 32], transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - let contract_query = Self::fetch_contract_query(contract_id, true); - tracing::trace!(?contract_query, "proving contract"); - let contract_proof = self.grove_get_proved_path_query( - &contract_query, - false, + self.grove_get_proved_path_query_with_conditional( + (&contract_root_path(&contract_id)).into(), + &[0], + &|element| { + if let Some(element) = element { + if element.is_basic_tree() { + // this is a contract that keeps history + Self::fetch_contract_with_history_latest_query(contract_id, true) + } else { + // this is a normal contract + Self::fetch_contract_query(contract_id, true) + } + } else { + // we will just get the proof that the contract doesn't exist, either way + Self::fetch_contract_query(contract_id, true) + } + }, transaction, &mut vec![], &platform_version.drive, - )?; - let result = Drive::verify_contract( - contract_proof.as_slice(), - Some(false), - false, - false, - contract_id, - platform_version, - ); - match result { - Ok(_) => Ok(contract_proof), - Err(Error::GroveDB(grovedb::Error::WrongElementType(s))) if s == "expected an item" => { - // In this case we are trying to prove a historical type contract - let contract_query = - Self::fetch_contract_with_history_latest_query(contract_id, true); - tracing::trace!(?contract_query, "proving historical contract"); - let historical_contract_proof = self.grove_get_proved_path_query( - &contract_query, - false, - transaction, - &mut vec![], - &platform_version.drive, - )?; - if let Ok(Some(_)) = Drive::verify_contract( - historical_contract_proof.as_slice(), - Some(true), - false, - false, - contract_id, - platform_version, - ) - .map(|(_, proof_returned_historical_contract)| proof_returned_historical_contract) - { - // Only return the historical proof if an element was found - Ok(historical_contract_proof) - } else { - Ok(contract_proof) - } - } - Err(e) => Err(e), - } + ) } } diff --git a/packages/rs-drive/src/drive/contract/prove/prove_contract_history/v0/mod.rs b/packages/rs-drive/src/drive/contract/prove/prove_contract_history/v0/mod.rs index 5e4c0c6e255..7da6cb662e8 100644 --- a/packages/rs-drive/src/drive/contract/prove/prove_contract_history/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/prove/prove_contract_history/v0/mod.rs @@ -26,6 +26,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the path query generation or proof generation fails. + #[inline(always)] pub(super) fn prove_contract_history_v0( &self, contract_id: [u8; 32], @@ -40,7 +41,6 @@ impl Drive { self.grove_get_proved_path_query( &history_query, - false, transaction, &mut vec![], &platform_version.drive, diff --git a/packages/rs-drive/src/drive/contract/prove/prove_contracts/v0/mod.rs b/packages/rs-drive/src/drive/contract/prove/prove_contracts/v0/mod.rs index 0ddfd41435e..fa5ad597a41 100644 --- a/packages/rs-drive/src/drive/contract/prove/prove_contracts/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/prove/prove_contracts/v0/mod.rs @@ -26,6 +26,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the path query generation or proof generation fails. + #[inline(always)] pub(super) fn prove_contracts_v0( &self, contract_ids: &[[u8; 32]], @@ -37,6 +38,7 @@ impl Drive { // we first need to fetch all contracts let contracts = self.grove_get_raw_path_query_with_optional( &contracts_query, + true, transaction, &mut vec![], &platform_version.drive, @@ -83,11 +85,11 @@ impl Drive { let contracts_query = Self::fetch_contracts_query( non_historical_contracts.as_slice(), historical_contracts.as_slice(), + platform_version, )?; self.grove_get_proved_path_query( &contracts_query, - true, transaction, &mut vec![], &platform_version.drive, diff --git a/packages/rs-drive/src/drive/contract/queries.rs b/packages/rs-drive/src/drive/contract/queries.rs index 85ab326fa8e..30bb318e0b6 100644 --- a/packages/rs-drive/src/drive/contract/queries.rs +++ b/packages/rs-drive/src/drive/contract/queries.rs @@ -1,6 +1,5 @@ -use crate::common::encode::encode_u64; use crate::drive::contract::paths::{ - contract_keeping_history_storage_path_vec, contract_root_path_vec, + contract_keeping_history_root_path_vec, contract_root_path_vec, }; use crate::drive::contract::{paths, MAX_CONTRACT_HISTORY_FETCH_LIMIT}; use crate::drive::{Drive, RootTree}; @@ -8,7 +7,9 @@ use crate::error::drive::DriveError; use crate::error::Error; use crate::error::Error::GroveDB; use crate::query::{Query, QueryItem}; +use crate::util::common::encode::encode_u64; use grovedb::{PathQuery, SizedQuery}; +use platform_version::version::PlatformVersion; impl Drive { /// Creates a path query for a specified contract. @@ -56,7 +57,7 @@ impl Drive { contract_id: [u8; 32], with_limit: bool, ) -> PathQuery { - let contract_path = contract_keeping_history_storage_path_vec(contract_id.as_slice()); + let contract_path = contract_keeping_history_root_path_vec(contract_id.as_slice()); let mut query = PathQuery::new_single_key(contract_path, vec![0]); if with_limit { @@ -120,6 +121,7 @@ impl Drive { pub fn fetch_contracts_query( non_historical_contract_ids: &[[u8; 32]], historical_contract_ids: &[[u8; 32]], + platform_version: &PlatformVersion, ) -> Result { if non_historical_contract_ids.is_empty() { return Ok(Self::fetch_historical_contracts_query( @@ -137,7 +139,11 @@ impl Drive { let mut historical_contracts_query = Self::fetch_historical_contracts_query(historical_contract_ids); historical_contracts_query.query.limit = None; - PathQuery::merge(vec![&contracts_query, &historical_contracts_query]).map_err(GroveDB) + PathQuery::merge( + vec![&contracts_query, &historical_contracts_query], + &platform_version.drive.grove_version, + ) + .map_err(GroveDB) } /// Creates a merged path query for multiple historical contracts. @@ -214,7 +220,7 @@ impl Drive { ); Ok(PathQuery::new( - paths::contract_keeping_history_storage_path_vec(&contract_id), + paths::contract_keeping_history_root_path_vec(&contract_id), SizedQuery::new(query, Some(limit), offset), )) } diff --git a/packages/rs-drive/src/drive/contract/test_helpers.rs b/packages/rs-drive/src/drive/contract/test_helpers.rs index 72299019b59..c2bb04fe38f 100644 --- a/packages/rs-drive/src/drive/contract/test_helpers.rs +++ b/packages/rs-drive/src/drive/contract/test_helpers.rs @@ -1,5 +1,5 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::GroveDbOpBatch; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; use crate::drive::RootTree; diff --git a/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs b/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs index 9b7b67048b4..8d22fc40435 100644 --- a/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs +++ b/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs @@ -3,11 +3,12 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; @@ -46,6 +47,7 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -54,9 +56,14 @@ impl Drive { .update .update_contract { - 0 => { - self.update_contract_v0(contract, block_info, apply, transaction, platform_version) - } + 0 => self.update_contract_v0( + contract, + block_info, + apply, + transaction, + platform_version, + previous_fee_versions, + ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "update_contract".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs b/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs index e0efe9e743b..9c08aad8a13 100644 --- a/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs @@ -1,11 +1,11 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::DriveKeyInfo::KeyRef; -use crate::drive::object_size_info::PathKeyInfo::PathFixedSizeKeyRef; use crate::drive::{contract_documents_path, Drive}; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::DriveKeyInfo::KeyRef; +use crate::util::object_size_info::PathKeyInfo::PathFixedSizeKeyRef; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::config::v0::DataContractConfigGettersV0; @@ -16,6 +16,7 @@ use dpp::fee::fee_result::FeeResult; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::serialization::PlatformSerializableWithPlatformVersion; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; @@ -45,6 +46,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the contract update or fee calculation fails. + #[inline(always)] pub(super) fn update_contract_v0( &self, contract: &DataContract, @@ -52,6 +54,7 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { if !apply { return self.insert_contract( @@ -121,10 +124,8 @@ impl Drive { "contract should exist", )))?; - let mut drive_cache = self.cache.write().unwrap(); - - drive_cache - .cached_contracts + self.cache + .data_contracts .insert(updated_contract_fetch_info, transaction.is_some()); Drive::calculate_fee( @@ -133,10 +134,12 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, ) } /// Updates a contract. + #[inline(always)] pub(super) fn update_contract_element_v0( &self, contract_element: Element, @@ -168,6 +171,7 @@ impl Drive { } /// Updates a contract. + #[inline(always)] pub(super) fn update_contract_add_operations_v0( &self, contract_element: Element, @@ -314,6 +318,7 @@ impl Drive { if !index_cache.contains(index_bytes) { self.batch_insert_empty_tree_if_not_exists( PathFixedSizeKeyRef((type_path, index.name.as_bytes())), + false, storage_flags.as_ref().map(|flags| flags.as_ref()), apply_type, transaction, diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/mod.rs index 90acf8a7aac..847c7036291 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/mod.rs @@ -28,7 +28,7 @@ impl Drive { epoch_tree: &Epoch, transaction: TransactionArg, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match platform_version .drive .methods @@ -36,7 +36,7 @@ impl Drive { .epochs .get_epoch_fee_multiplier { - 0 => self.get_epoch_fee_multiplier_v0(epoch_tree, transaction), + 0 => self.get_epoch_fee_multiplier_v0(epoch_tree, transaction, platform_version), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epoch_fee_multiplier".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/v0/mod.rs index d5bb19fde26..d89596e693a 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_fee_multiplier/v0/mod.rs @@ -4,10 +4,10 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; +use crate::drive::credit_pools::epochs::epoch_key_constants; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use dpp::block::epoch::Epoch; - -use crate::fee_pools::epochs::epoch_key_constants; -use crate::fee_pools::epochs::paths::EpochProposers; +use platform_version::version::PlatformVersion; impl Drive { /// Gets the Fee Multiplier for the Epoch. @@ -15,13 +15,15 @@ impl Drive { &self, epoch_tree: &Epoch, transaction: TransactionArg, - ) -> Result { + platform_version: &PlatformVersion, + ) -> Result { let element = self .grove .get( &epoch_tree.get_path(), epoch_key_constants::KEY_FEE_MULTIPLIER.as_slice(), transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -32,7 +34,7 @@ impl Drive { ))); }; - Ok(f64::from_be_bytes( + Ok(u64::from_be_bytes( encoded_multiplier.as_slice().try_into().map_err(|_| { Error::Drive(DriveError::CorruptedSerialization(String::from( "epochs multiplier must be f64", @@ -44,18 +46,18 @@ impl Drive { #[cfg(test)] mod tests { - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::drive::batch::GroveDbOpBatch; + use crate::drive::credit_pools::epochs::epoch_key_constants; + use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; + use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::error::drive::DriveError; use crate::error::Error; - use crate::fee_pools::epochs::epoch_key_constants; - use crate::fee_pools::epochs::operations_factory::EpochOperations; - use crate::fee_pools::epochs::paths::EpochProposers; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::GroveDbOpBatch; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::epoch::Epoch; - use dpp::version::drive_versions::DriveVersion; use dpp::version::PlatformVersion; use grovedb::Element; + use grovedb_version::version::GroveVersion; #[test] fn test_error_if_epoch_tree_is_not_initiated_v0() { @@ -89,6 +91,7 @@ mod tests { Element::Item(u128::MAX.to_be_bytes().to_vec(), None), None, Some(&transaction), + GroveVersion::latest(), ) .unwrap() .expect("should insert invalid data"); @@ -104,12 +107,12 @@ mod tests { #[test] fn test_value_is_set_v0() { let drive = setup_drive_with_initial_state_structure(); - let drive_version = DriveVersion::latest(); + let platform_version = PlatformVersion::latest(); let transaction = drive.grove.start_transaction(); let epoch = Epoch::new(0).unwrap(); - let multiplier = 42.0; + let multiplier = 42000; let mut batch = GroveDbOpBatch::new(); @@ -117,14 +120,21 @@ mod tests { .add_init_empty_operations(&mut batch) .expect("should add empty epoch operations"); - epoch.add_init_current_operations(multiplier, 1, 1, 1, &mut batch); + epoch.add_init_current_operations( + multiplier, + 1, + 1, + 1, + platform_version.protocol_version, + &mut batch, + ); drive - .grove_apply_batch(batch, false, Some(&transaction), &drive_version) + .grove_apply_batch(batch, false, Some(&transaction), &platform_version.drive) .expect("should apply batch"); let stored_multiplier = drive - .get_epoch_fee_multiplier_v0(&epoch, Some(&transaction)) + .get_epoch_fee_multiplier_v0(&epoch, Some(&transaction), platform_version) .expect("should get multiplier"); assert_eq!(stored_multiplier, multiplier); diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs index 132142dcc16..8e790b846bf 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs @@ -37,7 +37,11 @@ impl Drive { .epochs .get_epoch_processing_credits_for_distribution { - 0 => self.get_epoch_processing_credits_for_distribution_v0(epoch_tree, transaction), + 0 => self.get_epoch_processing_credits_for_distribution_v0( + epoch_tree, + transaction, + platform_version, + ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epoch_processing_credits_for_distribution".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs index 137583e8594..ad944b1d36e 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs @@ -5,11 +5,11 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; +use crate::drive::credit_pools::epochs::epoch_key_constants; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use dpp::block::epoch::Epoch; use dpp::fee::Credits; - -use crate::fee_pools::epochs::epoch_key_constants; -use crate::fee_pools::epochs::paths::EpochProposers; +use platform_version::version::PlatformVersion; impl Drive { /// Gets the amount of processing fees to be distributed for the Epoch. @@ -17,6 +17,7 @@ impl Drive { &self, epoch_tree: &Epoch, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { let element = self .grove @@ -24,6 +25,7 @@ impl Drive { &epoch_tree.get_path(), epoch_key_constants::KEY_POOL_PROCESSING_FEES.as_slice(), transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -40,16 +42,18 @@ impl Drive { #[cfg(test)] mod tests { + use crate::drive::credit_pools::epochs::epoch_key_constants; + use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::error::drive::DriveError; use crate::error::Error; - use crate::fee_pools::epochs::epoch_key_constants; - use crate::fee_pools::epochs::paths::EpochProposers; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::epoch::Epoch; + use dpp::version::PlatformVersion; use grovedb::Element; #[test] fn test_error_if_value_has_wrong_element_type() { + let platform_version = PlatformVersion::latest(); let drive = setup_drive_with_initial_state_structure(); let transaction = drive.grove.start_transaction(); @@ -63,12 +67,16 @@ mod tests { Element::Item(u128::MAX.to_be_bytes().to_vec(), None), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); - let result = - drive.get_epoch_processing_credits_for_distribution_v0(&epoch, Some(&transaction)); + let result = drive.get_epoch_processing_credits_for_distribution_v0( + &epoch, + Some(&transaction), + platform_version, + ); assert!(matches!( result, diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/mod.rs index a58749f7245..395d3a2838c 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/mod.rs @@ -36,7 +36,11 @@ impl Drive { .epochs .get_epoch_storage_credits_for_distribution { - 0 => self.get_epoch_storage_credits_for_distribution_v0(epoch_tree, transaction), + 0 => self.get_epoch_storage_credits_for_distribution_v0( + epoch_tree, + transaction, + platform_version, + ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epoch_storage_credits_for_distribution".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/v0/mod.rs index b393a046642..f52962d3bee 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_storage_credits_for_distribution/v0/mod.rs @@ -1,13 +1,13 @@ use dpp::balances::credits::Creditable; use grovedb::{Element, TransactionArg}; +use crate::drive::credit_pools::epochs::epoch_key_constants; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; use dpp::block::epoch::Epoch; - -use crate::fee_pools::epochs::epoch_key_constants; -use crate::fee_pools::epochs::paths::EpochProposers; +use platform_version::version::PlatformVersion; impl Drive { /// Gets the amount of storage credits to be distributed for the Epoch. @@ -15,6 +15,7 @@ impl Drive { &self, epoch_tree: &Epoch, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { let element = self .grove @@ -22,6 +23,7 @@ impl Drive { &epoch_tree.get_path(), epoch_key_constants::KEY_POOL_STORAGE_FEES.as_slice(), transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -42,9 +44,9 @@ mod tests { use crate::error::drive::DriveError; use crate::error::Error; - use crate::fee_pools::epochs::paths::EpochProposers; - use crate::fee_pools::epochs_root_tree_key_constants::KEY_STORAGE_FEE_POOL; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::drive::credit_pools::epochs::epochs_root_tree_key_constants::KEY_STORAGE_FEE_POOL; + use crate::drive::credit_pools::epochs::paths::EpochProposers; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::epoch::Epoch; use dpp::version::PlatformVersion; use grovedb::Element; @@ -72,6 +74,7 @@ mod tests { #[test] fn test_error_if_value_has_invalid_length_v0() { + let platform_version = PlatformVersion::latest(); let drive = setup_drive_with_initial_state_structure(); let transaction = drive.grove.start_transaction(); @@ -85,12 +88,16 @@ mod tests { Element::Item(u128::MAX.to_be_bytes().to_vec(), None), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); - let result = - drive.get_epoch_storage_credits_for_distribution_v0(&epoch, Some(&transaction)); + let result = drive.get_epoch_storage_credits_for_distribution_v0( + &epoch, + Some(&transaction), + platform_version, + ); assert!(matches!( result, diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_total_credits_for_distribution/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_total_credits_for_distribution/v0/mod.rs index 3576eac391d..9e6cf57e43d 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_total_credits_for_distribution/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_total_credits_for_distribution/v0/mod.rs @@ -1,7 +1,7 @@ use grovedb::TransactionArg; -use crate::drive::fee::get_overflow_error; use crate::drive::Drive; +use crate::fees::get_overflow_error; use crate::error::Error; use dpp::block::epoch::Epoch; @@ -37,10 +37,10 @@ impl Drive { #[cfg(test)] mod tests { - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::drive::batch::GroveDbOpBatch; - use crate::fee_pools::epochs::operations_factory::EpochOperations; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::GroveDbOpBatch; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::epoch::Epoch; use dpp::fee::Credits; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs index 52472cca3e7..f0a061ce024 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Credit Distribution. //! //! This module implements functions in Drive to distribute fees for a given Epoch. diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/epoch_key_constants.rs b/packages/rs-drive/src/drive/credit_pools/epochs/epoch_key_constants.rs new file mode 100644 index 00000000000..d3c987a75c4 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/epoch_key_constants.rs @@ -0,0 +1,39 @@ +/// Processing fee pool key +pub const KEY_POOL_PROCESSING_FEES: &[u8; 1] = b"p"; +/// Processing fee pool key as u8 +pub const KEY_POOL_PROCESSING_FEES_U8: u8 = b'p'; + +/// Storage fee pool key +pub const KEY_POOL_STORAGE_FEES: &[u8; 1] = b"s"; +/// Storage fee pool key as u8 +pub const KEY_POOL_STORAGE_FEES_U8: u8 = b's'; + +/// Start time key +pub const KEY_START_TIME: &[u8; 1] = b"t"; +/// Start time key as u8 +pub const KEY_START_TIME_U8: u8 = b't'; + +/// Epoch's protocol version key +pub const KEY_PROTOCOL_VERSION: &[u8; 1] = b"v"; +/// Epoch's protocol version key as u8 +pub const KEY_PROTOCOL_VERSION_U8: u8 = b'v'; + +/// Start block height key +pub const KEY_START_BLOCK_HEIGHT: &[u8; 1] = b"h"; +/// Start block height key as u8 +pub const KEY_START_BLOCK_HEIGHT_U8: u8 = b'h'; + +/// Start block core chain locked height key +pub const KEY_START_BLOCK_CORE_HEIGHT: &[u8; 1] = b"c"; +/// Start block core chain locked height key as u8 +pub const KEY_START_BLOCK_CORE_HEIGHT_U8: u8 = b'c'; + +/// Proposers key +pub const KEY_PROPOSERS: &[u8; 1] = b"m"; +/// Proposers key as u8 +pub const KEY_PROPOSERS_U8: u8 = b'm'; + +/// Fee multiplier key +pub const KEY_FEE_MULTIPLIER: &[u8; 1] = b"x"; +/// Fee multiplier key as u8 +pub const KEY_FEE_MULTIPLIER_U8: u8 = b'x'; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/epochs_root_tree_key_constants.rs b/packages/rs-drive/src/drive/credit_pools/epochs/epochs_root_tree_key_constants.rs new file mode 100644 index 00000000000..abdd5780f54 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/epochs_root_tree_key_constants.rs @@ -0,0 +1,13 @@ +/// Storage fee pool key +pub const KEY_STORAGE_FEE_POOL: &[u8; 1] = b"s"; + +/// Storage fee pool key +pub const KEY_STORAGE_FEE_POOL_U8: u8 = b's'; +/// Unpaid epoch index key +pub const KEY_UNPAID_EPOCH_INDEX: &[u8; 1] = b"u"; +/// Unpaid epoch index key +pub const KEY_UNPAID_EPOCH_INDEX_U8: u8 = b'u'; +/// Pending refunds that will be deducted from epoch storage fee pools +pub const KEY_PENDING_EPOCH_REFUNDS: &[u8; 1] = b"p"; +/// Pending refunds that will be deducted from epoch storage fee pools +pub const KEY_PENDING_EPOCH_REFUNDS_U8: u8 = b'p'; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/mod.rs index c861f139f3c..fcd6e1ff0ec 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use dpp::block::epoch::Epoch; + use dpp::block::extended_epoch_info::ExtendedEpochInfo; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs index e72e63bceee..f72b49c4dba 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use dpp::block::epoch::{Epoch, EpochIndex, EPOCH_KEY_OFFSET}; +use dpp::block::epoch::{EpochIndex, EPOCH_KEY_OFFSET}; use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0; use dpp::block::extended_epoch_info::ExtendedEpochInfo; use dpp::ProtocolError; @@ -10,11 +10,12 @@ use grovedb::{Element, PathQuery, Query, SizedQuery, TransactionArg}; use std::collections::BTreeMap; use std::u64; +use crate::drive::credit_pools::epochs::epoch_key_constants::{ + KEY_FEE_MULTIPLIER, KEY_PROTOCOL_VERSION, KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, + KEY_START_TIME, +}; use crate::drive::credit_pools::pools_vec_path; use crate::error::query::QuerySyntaxError; -use crate::fee_pools::epochs::epoch_key_constants::{ - KEY_FEE_MULTIPLIER, KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, KEY_START_TIME, -}; use crate::query::QueryItem; use dpp::version::PlatformVersion; @@ -27,6 +28,7 @@ impl Drive { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { + // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch and 16383 is large enough. if count > 16383 { return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( "get_epochs_infos_v0 count too high {}", @@ -42,6 +44,7 @@ impl Drive { KEY_START_BLOCK_HEIGHT.to_vec(), KEY_START_BLOCK_CORE_HEIGHT.to_vec(), KEY_FEE_MULTIPLIER.to_vec(), + KEY_PROTOCOL_VERSION.to_vec(), ]); let mut query = if ascending { Query::new_single_query_item(QueryItem::RangeFrom( @@ -56,7 +59,8 @@ impl Drive { query.set_subquery(subquery); let path_query = PathQuery::new( pools_vec_path(), - SizedQuery::new(query, Some(count * 4), None), + // The multiplier must be equal to requested keys count + SizedQuery::new(query, Some(count * 5), None), ); let results = self @@ -75,9 +79,7 @@ impl Drive { if let QueryResultElement::PathKeyElementTrioResultItem((path, key, element)) = result_item { - acc.entry(path) - .or_insert_with(BTreeMap::new) - .insert(key, element); + acc.entry(path).or_default().insert(key, element); } acc }, @@ -195,14 +197,34 @@ impl Drive { let fee_multiplier_bytes: [u8; 8] = match encoded_multiplier.as_slice().try_into().map_err(|_| { Error::Drive(DriveError::CorruptedSerialization( - "fee multiplier must be 8 bytes for a f64".to_string(), + "fee multiplier must be 8 bytes for a u64".to_string(), + )) + }) { + Ok(value) => value, + Err(e) => return Some(Err(e)), + }; + + let fee_multiplier = u64::from_be_bytes(fee_multiplier_bytes); + + let protocol_version_element = inner_map.get(&KEY_PROTOCOL_VERSION.to_vec())?; + + let Element::Item(encoded_protocol_version, _) = protocol_version_element else { + return Some(Err(Error::Drive(DriveError::UnexpectedElementType( + "protocol version must be an item", + )))); + }; + + let protocol_version_bytes: [u8; 4] = + match encoded_protocol_version.as_slice().try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "protocol version must be 4 bytes for a u32".to_string(), )) }) { Ok(value) => value, Err(e) => return Some(Err(e)), }; - let fee_multiplier = f64::from_be_bytes(fee_multiplier_bytes); + let protocol_version = u32::from_be_bytes(protocol_version_bytes); // Construct the ExtendedEpochInfo Some(Ok(ExtendedEpochInfoV0 { @@ -210,7 +232,8 @@ impl Drive { first_block_time, first_block_height, first_core_block_height, - fee_multiplier, + fee_multiplier_permille: fee_multiplier, + protocol_version, } .into())) }) diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/mod.rs new file mode 100644 index 00000000000..de7a2652ab9 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/mod.rs @@ -0,0 +1,45 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use std::collections::BTreeMap; + +use dpp::block::epoch::EpochIndex; +use dpp::util::deserializer::ProtocolVersion; +use grovedb::TransactionArg; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Get multiple epoch protocol versions starting at a given epoch index + pub fn get_epochs_protocol_versions( + &self, + start_epoch_index: u16, + count: Option, + ascending: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .credit_pools + .epochs + .get_epochs_protocol_versions + { + 0 => self.get_epochs_protocol_versions_v0( + start_epoch_index, + count, + ascending, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "get_epochs_protocol_versions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/v0/mod.rs new file mode 100644 index 00000000000..4284f8956b2 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/v0/mod.rs @@ -0,0 +1,116 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::block::epoch::{EpochIndex, EPOCH_KEY_OFFSET}; +use dpp::util::deserializer::ProtocolVersion; +use dpp::ProtocolError; +use grovedb::query_result_type::{QueryResultElement, QueryResultType}; +use grovedb::{Element, PathQuery, Query, SizedQuery, TransactionArg}; +use std::collections::BTreeMap; + +use crate::drive::credit_pools::epochs::epoch_key_constants::KEY_PROTOCOL_VERSION; +use crate::drive::credit_pools::pools_vec_path; +use crate::error::query::QuerySyntaxError; +use crate::query::QueryItem; +use dpp::version::PlatformVersion; + +impl Drive { + pub(super) fn get_epochs_protocol_versions_v0( + &self, + start_epoch_index: u16, + count: Option, + ascending: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + if let Some(count) = count { + // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch and 16383 is large enough. + if count > 16383 { + return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( + "get_epochs_protocol_versions_v0 count too high {}", + count + )))); + } + } + let index_with_offset = start_epoch_index + .checked_add(EPOCH_KEY_OFFSET) + .ok_or(ProtocolError::Overflow("stored epoch index too high"))?; + let mut query = if ascending { + Query::new_single_query_item(QueryItem::RangeFrom( + index_with_offset.to_be_bytes().to_vec().., + )) + } else { + Query::new_single_query_item(QueryItem::RangeToInclusive( + ..=index_with_offset.to_be_bytes().to_vec(), + )) + }; + query.left_to_right = ascending; + query.set_subquery_path(vec![KEY_PROTOCOL_VERSION.to_vec()]); + let path_query = PathQuery::new( + pools_vec_path(), + // The multiplier must be equal to requested keys count + SizedQuery::new(query, count, None), + ); + + let results = self + .grove_get_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + &mut vec![], + &platform_version.drive, + )? + .0; + + let mut map: BTreeMap = BTreeMap::default(); + + for result_item in results.elements.into_iter() { + if let QueryResultElement::PathKeyElementTrioResultItem(( + mut path, + _, + protocol_version_element, + )) = result_item + { + let Some(epoch_index_vec) = path.pop() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "path must be bigger than empty".to_string(), + ))); + }; + + let epoch_index_bytes: [u8; 32] = + epoch_index_vec.as_slice().try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "extended epoch info: item has an invalid length".to_string(), + )) + })?; + let epoch_index = + EpochIndex::from_be_bytes([epoch_index_bytes[0], epoch_index_bytes[1]]) + .checked_sub(EPOCH_KEY_OFFSET) + .ok_or(Error::Drive(DriveError::CorruptedSerialization( + "epoch bytes on disk too small, should be over epoch key offset" + .to_string(), + )))?; + + let Element::Item(encoded_protocol_version, _) = protocol_version_element else { + return Err(Error::Drive(DriveError::UnexpectedElementType( + "protocol version must be an item", + ))); + }; + + let protocol_version_bytes: [u8; 4] = encoded_protocol_version + .as_slice() + .try_into() + .map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "protocol version must be 4 bytes for a u32".to_string(), + )) + })?; + + let protocol_version = u32::from_be_bytes(protocol_version_bytes); + + map.insert(epoch_index, protocol_version); + } + } + Ok(map) + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/has_epoch_tree_exists.rs b/packages/rs-drive/src/drive/credit_pools/epochs/has_epoch_tree_exists.rs new file mode 100644 index 00000000000..7fca44958e9 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/has_epoch_tree_exists.rs @@ -0,0 +1,74 @@ +use crate::drive::credit_pools::pools_path; +use crate::drive::Drive; +use crate::error::Error; +use dpp::block::epoch::Epoch; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Checks if an Epoch tree exists. Returns a bool. + /// Does not need to be versioned as it is very simple + pub fn has_epoch_tree_exists( + &self, + epoch_tree: &Epoch, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + self.grove + .has_raw( + &pools_path(), + &epoch_tree.key, + transaction, + &platform_version.drive.grove_version, + ) + .unwrap() + .map_err(Error::GroveDB) + } +} + +#[cfg(test)] +mod tests { + + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + + mod has_epoch_tree_exists { + use super::*; + use dpp::block::epoch::Epoch; + + use dpp::fee::epoch::GENESIS_EPOCH_INDEX; + use platform_version::version::PlatformVersion; + + #[test] + fn test_return_true_if_tree_exists() { + let platform_version = PlatformVersion::latest(); + let drive = setup_drive_with_initial_state_structure(); + let transaction = drive.grove.start_transaction(); + + let epoch_tree = Epoch::new(GENESIS_EPOCH_INDEX).unwrap(); + + let is_exist = drive + .has_epoch_tree_exists(&epoch_tree, Some(&transaction), platform_version) + .expect("should check epoch tree existence"); + + assert!(is_exist); + } + + #[test] + fn test_return_false_if_tree_doesnt_exist() { + let platform_version = PlatformVersion::latest(); + // default will be 40 epochs per era + // 50 eras + // = 2000 + let drive = setup_drive_with_initial_state_structure(); + let transaction = drive.grove.start_transaction(); + + let epoch_tree = Epoch::new(2000 + 1).unwrap(); + + let is_exist = drive + .has_epoch_tree_exists(&epoch_tree, Some(&transaction), platform_version) + .expect("should check epoch tree existence"); + + assert!(!is_exist); + } + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/mod.rs index 6168093348b..4d84a335e3f 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/mod.rs @@ -1,104 +1,32 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Epochs Mod File. //! -use crate::drive::credit_pools::paths::pools_path; -use crate::drive::Drive; -use crate::error::Error; -use dpp::block::epoch::Epoch; -use grovedb::TransactionArg; - +#[cfg(feature = "server")] pub mod credit_distribution_pools; +#[cfg(feature = "server")] mod get_epochs_infos; +#[cfg(feature = "server")] +mod get_epochs_protocol_versions; + +#[cfg(any(feature = "server", feature = "verify"))] +/// Epoch key constants module +pub mod epoch_key_constants; +#[cfg(any(feature = "server", feature = "verify"))] +/// Epochs root tree key constants module +pub mod epochs_root_tree_key_constants; +#[cfg(feature = "server")] +pub mod operations_factory; +/// Paths module +#[cfg(any(feature = "server", feature = "verify"))] +pub mod paths; +#[cfg(feature = "server")] pub mod proposers; +#[cfg(feature = "server")] mod prove_epochs_infos; +#[cfg(feature = "server")] pub mod start_block; +#[cfg(feature = "server")] pub mod start_time; -impl Drive { - /// Checks if an Epoch tree exists. Returns a bool. - /// Does not need to be versioned as it is very simple - pub fn has_epoch_tree_exists( - &self, - epoch_tree: &Epoch, - transaction: TransactionArg, - ) -> Result { - self.grove - .has_raw(&pools_path(), &epoch_tree.key, transaction) - .unwrap() - .map_err(Error::GroveDB) - } -} - -#[cfg(feature = "full")] -#[cfg(test)] -mod tests { - use super::*; - - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; - - mod has_epoch_tree_exists { - use super::*; - - use dpp::fee::epoch::GENESIS_EPOCH_INDEX; - - #[test] - fn test_return_true_if_tree_exists() { - let drive = setup_drive_with_initial_state_structure(); - let transaction = drive.grove.start_transaction(); - - let epoch_tree = Epoch::new(GENESIS_EPOCH_INDEX).unwrap(); - - let is_exist = drive - .has_epoch_tree_exists(&epoch_tree, Some(&transaction)) - .expect("should check epoch tree existence"); - - assert!(is_exist); - } - - #[test] - fn test_return_false_if_tree_doesnt_exist() { - // default will be 40 epochs per era - // 50 eras - // = 2000 - let drive = setup_drive_with_initial_state_structure(); - let transaction = drive.grove.start_transaction(); - - let epoch_tree = Epoch::new(2000 + 1).unwrap(); - - let is_exist = drive - .has_epoch_tree_exists(&epoch_tree, Some(&transaction)) - .expect("should check epoch tree existence"); - - assert!(!is_exist); - } - } -} +#[cfg(feature = "server")] +mod has_epoch_tree_exists; diff --git a/packages/rs-drive/src/fee_pools/epochs/operations_factory.rs b/packages/rs-drive/src/drive/credit_pools/epochs/operations_factory.rs similarity index 88% rename from packages/rs-drive/src/fee_pools/epochs/operations_factory.rs rename to packages/rs-drive/src/drive/credit_pools/epochs/operations_factory.rs index 34df1ce3ec1..2133e856657 100644 --- a/packages/rs-drive/src/fee_pools/epochs/operations_factory.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/operations_factory.rs @@ -1,53 +1,25 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Epoch Operations //! //! Defines and implements in `Epoch` functions relevant to epoch management. //! -use crate::drive::batch::GroveDbOpBatch; use crate::drive::credit_pools::paths::pools_vec_path; use crate::drive::Drive; use crate::error::Error; +use crate::util::batch::GroveDbOpBatch; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::fee_pools::epochs::epoch_key_constants::{ +use crate::drive::credit_pools::epochs::epoch_key_constants::{ KEY_FEE_MULTIPLIER, KEY_POOL_PROCESSING_FEES, KEY_POOL_STORAGE_FEES, KEY_PROPOSERS, - KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, KEY_START_TIME, + KEY_PROTOCOL_VERSION, KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, KEY_START_TIME, }; -use crate::fee_pools::epochs::paths::EpochProposers; +use crate::drive::credit_pools::epochs::paths::EpochProposers; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::balances::credits::Creditable; use dpp::block::epoch::Epoch; use dpp::fee::Credits; +use dpp::util::deserializer::ProtocolVersion; use dpp::version::PlatformVersion; -use grovedb::batch::GroveDbOp; +use grovedb::batch::QualifiedGroveDbOp; use grovedb::{Element, TransactionArg}; /// Operations on Epochs @@ -60,7 +32,7 @@ pub trait EpochOperations { cached_previous_block_count: Option, transaction: TransactionArg, platform_version: &PlatformVersion, - ) -> Result; + ) -> Result; /// Adds to the groveDB op batch operations to insert an empty tree into the epoch fn add_init_empty_without_storage_operations(&self, batch: &mut GroveDbOpBatch); /// Adds to the groveDB op batch operations to insert an empty tree into the epoch @@ -69,43 +41,55 @@ pub trait EpochOperations { /// Adds to the groveDB op batch initialization operations for the epoch. fn add_init_current_operations( &self, - multiplier: f64, + multiplier_permille: u64, start_block_height: u64, // TODO Many method in drive needs block time and height. Maybe we need DTO for drive as well which will contain block information start_block_core_height: u32, start_time_ms: u64, + protocol_version: ProtocolVersion, batch: &mut GroveDbOpBatch, ); /// Adds to the groveDB op batch operations signifying that the epoch distribution fees were paid out. fn add_mark_as_paid_operations(&self, batch: &mut GroveDbOpBatch); + /// Update Epoch's protocol version + fn update_protocol_version_operation( + &self, + protocol_version: ProtocolVersion, + ) -> QualifiedGroveDbOp; /// Returns a groveDB op which updates the epoch start time. - fn update_start_time_operation(&self, time_ms: u64) -> GroveDbOp; + fn update_start_time_operation(&self, time_ms: u64) -> QualifiedGroveDbOp; /// Returns a groveDB op which updates the epoch start block height. - fn update_start_block_height_operation(&self, start_block_height: u64) -> GroveDbOp; + fn update_start_block_height_operation(&self, start_block_height: u64) -> QualifiedGroveDbOp; /// Returns a groveDB op which updates the epoch start block height. - fn update_start_block_core_height_operation(&self, start_block_core_height: u32) -> GroveDbOp; + fn update_start_block_core_height_operation( + &self, + start_block_core_height: u32, + ) -> QualifiedGroveDbOp; /// Returns a groveDB op which updates the epoch fee multiplier. - fn update_fee_multiplier_operation(&self, multiplier: f64) -> GroveDbOp; + fn update_fee_multiplier_operation(&self, multiplier_permille: u64) -> QualifiedGroveDbOp; /// Returns a groveDB op which updates the epoch processing credits for distribution. fn update_processing_fee_pool_operation( &self, processing_fee: Credits, - ) -> Result; + ) -> Result; /// Returns a groveDB op which deletes the epoch processing credits for distribution tree. - fn delete_processing_credits_for_distribution_operation(&self) -> GroveDbOp; + fn delete_processing_credits_for_distribution_operation(&self) -> QualifiedGroveDbOp; /// Returns a groveDB op which updates the epoch storage credits for distribution. - fn update_storage_fee_pool_operation(&self, storage_fee: Credits) -> Result; + fn update_storage_fee_pool_operation( + &self, + storage_fee: Credits, + ) -> Result; /// Returns a groveDB op which deletes the epoch storage credits for distribution tree. - fn delete_storage_credits_for_distribution_operation(&self) -> GroveDbOp; + fn delete_storage_credits_for_distribution_operation(&self) -> QualifiedGroveDbOp; /// Returns a groveDB op which updates the given epoch proposer's block count. fn update_proposer_block_count_operation( &self, proposer_pro_tx_hash: &[u8; 32], block_count: u64, - ) -> GroveDbOp; + ) -> QualifiedGroveDbOp; /// Returns a groveDB op which inserts an empty tree into the epoch proposers path. - fn init_proposers_tree_operation(&self) -> GroveDbOp; + fn init_proposers_tree_operation(&self) -> QualifiedGroveDbOp; /// Returns a groveDB op which deletes the epoch proposers tree. - fn delete_proposers_tree_operation(&self) -> GroveDbOp; + fn delete_proposers_tree_operation(&self) -> QualifiedGroveDbOp; /// Adds a groveDB op to the batch which deletes the given epoch proposers from the proposers tree. fn add_delete_proposers_operations( &self, @@ -123,7 +107,7 @@ impl EpochOperations for Epoch { cached_previous_block_count: Option, transaction: TransactionArg, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { // get current proposer's block count let proposed_block_count = if let Some(block_count) = cached_previous_block_count { block_count @@ -166,10 +150,11 @@ impl EpochOperations for Epoch { /// Adds to the groveDB op batch initialization operations for the epoch. fn add_init_current_operations( &self, - multiplier: f64, + multiplier_permille: u64, start_block_height: u64, // TODO Many method in drive needs block time and height. Maybe we need DTO for drive as well which will contain block information start_block_core_height: u32, start_time_ms: u64, + protocol_version: ProtocolVersion, batch: &mut GroveDbOpBatch, ) { batch.push(self.update_start_block_height_operation(start_block_height)); @@ -178,9 +163,11 @@ impl EpochOperations for Epoch { batch.push(self.init_proposers_tree_operation()); - batch.push(self.update_fee_multiplier_operation(multiplier)); + batch.push(self.update_fee_multiplier_operation(multiplier_permille)); batch.push(self.update_start_time_operation(start_time_ms)); + + batch.push(self.update_protocol_version_operation(protocol_version)); } /// Adds to the groveDB op batch operations signifying that the epoch distribution fees were paid out. @@ -193,8 +180,20 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which updates the epoch start time. - fn update_start_time_operation(&self, time_ms: u64) -> GroveDbOp { - GroveDbOp::insert_op( + fn update_protocol_version_operation( + &self, + protocol_version: ProtocolVersion, + ) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( + self.get_path_vec(), + KEY_PROTOCOL_VERSION.to_vec(), + Element::Item(protocol_version.to_be_bytes().to_vec(), None), + ) + } + + /// Returns a groveDB op which updates the epoch start time. + fn update_start_time_operation(&self, time_ms: u64) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( self.get_path_vec(), KEY_START_TIME.to_vec(), Element::Item(time_ms.to_be_bytes().to_vec(), None), @@ -202,8 +201,8 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which updates the epoch start block height. - fn update_start_block_height_operation(&self, start_block_height: u64) -> GroveDbOp { - GroveDbOp::insert_op( + fn update_start_block_height_operation(&self, start_block_height: u64) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( self.get_path_vec(), KEY_START_BLOCK_HEIGHT.to_vec(), Element::Item(start_block_height.to_be_bytes().to_vec(), None), @@ -211,8 +210,11 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which updates the epoch start block core height. - fn update_start_block_core_height_operation(&self, start_block_core_height: u32) -> GroveDbOp { - GroveDbOp::insert_op( + fn update_start_block_core_height_operation( + &self, + start_block_core_height: u32, + ) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( self.get_path_vec(), KEY_START_BLOCK_CORE_HEIGHT.to_vec(), Element::Item(start_block_core_height.to_be_bytes().to_vec(), None), @@ -220,11 +222,11 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which updates the epoch fee multiplier. - fn update_fee_multiplier_operation(&self, multiplier: f64) -> GroveDbOp { - GroveDbOp::insert_op( + fn update_fee_multiplier_operation(&self, multiplier_permille: u64) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( self.get_path_vec(), KEY_FEE_MULTIPLIER.to_vec(), - Element::Item(multiplier.to_be_bytes().to_vec(), None), + Element::Item(multiplier_permille.to_be_bytes().to_vec(), None), ) } @@ -232,8 +234,8 @@ impl EpochOperations for Epoch { fn update_processing_fee_pool_operation( &self, processing_fee: Credits, - ) -> Result { - Ok(GroveDbOp::insert_op( + ) -> Result { + Ok(QualifiedGroveDbOp::insert_or_replace_op( self.get_path_vec(), KEY_POOL_PROCESSING_FEES.to_vec(), Element::new_sum_item(processing_fee.to_signed()?), @@ -241,13 +243,16 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which deletes the epoch processing credits for distribution tree. - fn delete_processing_credits_for_distribution_operation(&self) -> GroveDbOp { - GroveDbOp::delete_op(self.get_path_vec(), KEY_POOL_PROCESSING_FEES.to_vec()) + fn delete_processing_credits_for_distribution_operation(&self) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::delete_op(self.get_path_vec(), KEY_POOL_PROCESSING_FEES.to_vec()) } /// Returns a groveDB op which updates the epoch storage credits for distribution. - fn update_storage_fee_pool_operation(&self, storage_fee: Credits) -> Result { - Ok(GroveDbOp::insert_op( + fn update_storage_fee_pool_operation( + &self, + storage_fee: Credits, + ) -> Result { + Ok(QualifiedGroveDbOp::insert_or_replace_op( self.get_path_vec(), KEY_POOL_STORAGE_FEES.to_vec(), Element::new_sum_item(storage_fee.to_signed()?), @@ -255,8 +260,8 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which deletes the epoch storage credits for distribution tree. - fn delete_storage_credits_for_distribution_operation(&self) -> GroveDbOp { - GroveDbOp::delete_op(self.get_path_vec(), KEY_POOL_STORAGE_FEES.to_vec()) + fn delete_storage_credits_for_distribution_operation(&self) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::delete_op(self.get_path_vec(), KEY_POOL_STORAGE_FEES.to_vec()) } /// Returns a groveDB op which updates the given epoch proposer's block count. @@ -264,8 +269,8 @@ impl EpochOperations for Epoch { &self, proposer_pro_tx_hash: &[u8; 32], block_count: u64, - ) -> GroveDbOp { - GroveDbOp::insert_op( + ) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( self.get_proposers_path_vec(), proposer_pro_tx_hash.to_vec(), Element::Item(block_count.to_be_bytes().to_vec(), None), @@ -273,8 +278,8 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which inserts an empty tree into the epoch proposers path. - fn init_proposers_tree_operation(&self) -> GroveDbOp { - GroveDbOp::insert_op( + fn init_proposers_tree_operation(&self) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( self.get_path_vec(), KEY_PROPOSERS.to_vec(), Element::empty_tree(), @@ -282,8 +287,8 @@ impl EpochOperations for Epoch { } /// Returns a groveDB op which deletes the epoch proposers tree. - fn delete_proposers_tree_operation(&self) -> GroveDbOp { - GroveDbOp::delete_tree_op(self.get_path_vec(), KEY_PROPOSERS.to_vec(), false) + fn delete_proposers_tree_operation(&self) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::delete_tree_op(self.get_path_vec(), KEY_PROPOSERS.to_vec(), false) } /// Adds a groveDB op to the batch which deletes the given epoch proposers from the proposers tree. @@ -301,7 +306,7 @@ impl EpochOperations for Epoch { #[cfg(test)] mod tests { use super::*; - use crate::tests::helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; + use crate::util::test_helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; use chrono::Utc; use dpp::version::PlatformVersion; @@ -481,7 +486,7 @@ mod tests { let epoch = Epoch::new(1042).unwrap(); - let multiplier = 42.0; + let multiplier = 42000; let start_time = 1; let start_block_height = 2; let start_block_core_height = 5; @@ -497,6 +502,7 @@ mod tests { start_block_height, start_block_core_height, start_time, + platform_version.protocol_version, &mut batch, ); @@ -558,7 +564,14 @@ mod tests { let mut batch = GroveDbOpBatch::new(); - epoch.add_init_current_operations(1.0, 2, 5, 3, &mut batch); + epoch.add_init_current_operations( + 1000, + 2, + 5, + 3, + platform_version.protocol_version, + &mut batch, + ); // Apply init current drive @@ -579,6 +592,7 @@ mod tests { &epoch.get_path(), KEY_PROPOSERS.as_slice(), Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap(); @@ -867,6 +881,7 @@ mod tests { &epoch.get_path(), KEY_PROPOSERS.as_slice(), Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect_err("expect tree not exists"); @@ -928,7 +943,7 @@ mod tests { assert_eq!(stored_proposers, awaited_result); let deleted_pro_tx_hashes = vec![ - awaited_result.get(0).unwrap().0.clone(), + awaited_result.first().unwrap().0.clone(), awaited_result.get(1).unwrap().0.clone(), ]; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/paths.rs b/packages/rs-drive/src/drive/credit_pools/epochs/paths.rs new file mode 100644 index 00000000000..6a5325e4948 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/paths.rs @@ -0,0 +1,73 @@ +use crate::drive::credit_pools::epochs::epoch_key_constants; +use crate::drive::RootTree; +use crate::error::drive::DriveError; +use crate::error::fee::FeeError; +use crate::error::Error; +use dpp::block::epoch::{Epoch, EPOCH_KEY_OFFSET}; + +/// Proposer Trait for Epoch +pub trait EpochProposers { + /// Get the path to this epoch as a vector + fn get_path_vec(&self) -> Vec>; + /// Get the path to this epoch as a fixed size path + fn get_path(&self) -> [&[u8]; 2]; + /// Get the path to the proposers tree of this epoch as a vector + fn get_proposers_path_vec(&self) -> Vec>; + /// Get the path to the proposers tree of this epoch as a fixed length path + fn get_proposers_path(&self) -> [&[u8]; 3]; +} + +impl EpochProposers for Epoch { + /// Get the path to the proposers tree of this epoch as a fixed length path + fn get_proposers_path(&self) -> [&[u8]; 3] { + [ + Into::<&[u8; 1]>::into(RootTree::Pools), + &self.key, + epoch_key_constants::KEY_PROPOSERS.as_slice(), + ] + } + + /// Get the path to the proposers tree of this epoch as a vector + fn get_proposers_path_vec(&self) -> Vec> { + vec![ + vec![RootTree::Pools as u8], + self.key.to_vec(), + epoch_key_constants::KEY_PROPOSERS.to_vec(), + ] + } + + /// Get the path to this epoch as a fixed size path + fn get_path(&self) -> [&[u8]; 2] { + [Into::<&[u8; 1]>::into(RootTree::Pools), &self.key] + } + + /// Get the path to this epoch as a vector + fn get_path_vec(&self) -> Vec> { + vec![vec![RootTree::Pools as u8], self.key.to_vec()] + } +} + +/// Encodes an epoch index key with storage offset +pub fn encode_epoch_index_key(index: u16) -> Result<[u8; 2], Error> { + let index_with_offset = + index + .checked_add(EPOCH_KEY_OFFSET) + .ok_or(Error::Fee(FeeError::Overflow( + "stored epoch index too high", + )))?; + + Ok(index_with_offset.to_be_bytes()) +} + +/// Decodes an epoch index key +pub fn decode_epoch_index_key(epoch_key: &[u8]) -> Result { + let index_with_offset = u16::from_be_bytes(epoch_key.try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization(String::from( + "epoch index must be u16", + ))) + })?); + + index_with_offset + .checked_sub(EPOCH_KEY_OFFSET) + .ok_or(Error::Fee(FeeError::Overflow("stored epoch index too low"))) +} diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/mod.rs index b5ea8d9b917..5619f999363 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/mod.rs @@ -37,7 +37,7 @@ impl Drive { .epochs .get_epoch_proposers { - 0 => self.get_epoch_proposers_v0(epoch_tree, limit, transaction), + 0 => self.get_epoch_proposers_v0(epoch_tree, limit, transaction, platform_version), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epoch_proposers".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/v0/mod.rs index 2a84a51af9a..f60fc3d5ba5 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epoch_proposers/v0/mod.rs @@ -1,11 +1,12 @@ use grovedb::query_result_type::QueryResultType::QueryKeyElementPairResultType; use grovedb::{Element, PathQuery, Query, SizedQuery, TransactionArg}; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee_pools::epochs::paths::EpochProposers; use dpp::block::epoch::Epoch; +use platform_version::version::PlatformVersion; impl Drive { /// Returns a list of the Epoch's block proposers @@ -14,6 +15,7 @@ impl Drive { epoch_tree: &Epoch, limit: Option, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result, u64)>, Error> { let path_as_vec = epoch_tree.get_proposers_path_vec(); @@ -28,8 +30,10 @@ impl Drive { &path_query, transaction.is_some(), true, + true, QueryKeyElementPairResultType, transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)? @@ -48,7 +52,7 @@ impl Drive { let block_count = u64::from_be_bytes( encoded_block_count.as_slice().try_into().map_err(|_| { Error::Drive(DriveError::CorruptedSerialization(String::from( - String::from("epochs proposer block count must be u64"), + "epochs proposer block count must be u64", ))) })?, ); @@ -63,10 +67,10 @@ impl Drive { #[cfg(test)] mod tests { - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::drive::batch::GroveDbOpBatch; - use crate::fee_pools::epochs::operations_factory::EpochOperations; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::GroveDbOpBatch; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::epoch::Epoch; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/mod.rs index 39cd99a3a4b..96093cf0889 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/mod.rs @@ -37,7 +37,12 @@ impl Drive { .epochs .get_epochs_proposer_block_count { - 0 => self.get_epochs_proposer_block_count_v0(epoch, proposer_tx_hash, transaction), + 0 => self.get_epochs_proposer_block_count_v0( + epoch, + proposer_tx_hash, + transaction, + platform_version, + ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epochs_proposer_block_count".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/v0/mod.rs index 4081dd965d9..9ebe6efdc3b 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/get_epochs_proposer_block_count/v0/mod.rs @@ -1,10 +1,11 @@ use grovedb::{Element, TransactionArg}; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee_pools::epochs::paths::EpochProposers; use dpp::block::epoch::Epoch; +use platform_version::version::PlatformVersion; impl Drive { /// Returns the given proposer's block count @@ -13,10 +14,16 @@ impl Drive { epoch: &Epoch, proposer_tx_hash: &[u8; 32], transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { let element = self .grove - .get(&epoch.get_proposers_path(), proposer_tx_hash, transaction) + .get( + &epoch.get_proposers_path(), + proposer_tx_hash, + transaction, + &platform_version.drive.grove_version, + ) .unwrap() .map_err(Error::GroveDB)?; @@ -41,16 +48,16 @@ impl Drive { #[cfg(test)] mod tests { - use crate::drive::batch::GroveDbOpBatch; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::batch::GroveDbOpBatch; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::epoch::Epoch; use grovedb::Element; - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; + use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::error::drive::DriveError; use crate::error::Error; - use crate::fee_pools::epochs::operations_factory::EpochOperations; - use crate::fee_pools::epochs::paths::EpochProposers; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/mod.rs index c785e54554f..dad59b749ef 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/mod.rs @@ -33,7 +33,7 @@ impl Drive { .epochs .is_epochs_proposers_tree_empty { - 0 => self.is_epochs_proposers_tree_empty_v0(epoch_tree, transaction), + 0 => self.is_epochs_proposers_tree_empty_v0(epoch_tree, transaction, drive_version), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "is_epochs_proposers_tree_empty".to_string(), known_versions: vec![0], @@ -45,7 +45,7 @@ impl Drive { #[cfg(test)] mod tests { - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::epoch::Epoch; use dpp::version::drive_versions::DriveVersion; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/v0/mod.rs index 2e7ce994105..00b7f07742c 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/is_epochs_proposers_tree_empty/v0/mod.rs @@ -1,10 +1,11 @@ use grovedb::TransactionArg; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee_pools::epochs::paths::EpochProposers; use dpp::block::epoch::Epoch; +use platform_version::version::drive_versions::DriveVersion; impl Drive { /// Returns true if the Epoch's Proposers Tree is empty @@ -12,10 +13,15 @@ impl Drive { &self, epoch_tree: &Epoch, transaction: TransactionArg, + drive_version: &DriveVersion, ) -> Result { match self .grove - .is_empty_tree(&epoch_tree.get_proposers_path(), transaction) + .is_empty_tree( + &epoch_tree.get_proposers_path(), + transaction, + &drive_version.grove_version, + ) .unwrap() { Ok(result) => Ok(result), diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/mod.rs index f859159347b..d7c9b646d90 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/proposers/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/proposers/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Epoch Proposers. //! //! This module implements functions in Drive relevant to block proposers. diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/mod.rs index 53bb73f0277..eee830a1924 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use dpp::block::epoch::Epoch; + use grovedb::TransactionArg; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs index ccc50354cb4..80f15a235f4 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs @@ -1,18 +1,18 @@ use crate::drive::Drive; -use crate::error::drive::DriveError; + use crate::error::Error; -use dpp::block::epoch::{Epoch, EpochIndex, EPOCH_KEY_OFFSET}; -use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0; +use dpp::block::epoch::EPOCH_KEY_OFFSET; + use dpp::ProtocolError; -use grovedb::query_result_type::QueryResultElement; -use grovedb::{Element, PathQuery, Query, SizedQuery, TransactionArg}; -use std::collections::BTreeMap; +use grovedb::{PathQuery, Query, SizedQuery, TransactionArg}; + +use crate::drive::credit_pools::epochs::epoch_key_constants::{ + KEY_FEE_MULTIPLIER, KEY_PROTOCOL_VERSION, KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, + KEY_START_TIME, +}; use crate::drive::credit_pools::pools_vec_path; use crate::error::query::QuerySyntaxError; -use crate::fee_pools::epochs::epoch_key_constants::{ - KEY_FEE_MULTIPLIER, KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, KEY_START_TIME, -}; use crate::query::QueryItem; use dpp::version::PlatformVersion; @@ -25,6 +25,7 @@ impl Drive { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { + // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch and 16383 is large enough. if count > 16383 { return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( "get_epochs_infos_v0 count too high {}", @@ -40,6 +41,7 @@ impl Drive { KEY_START_BLOCK_HEIGHT.to_vec(), KEY_START_BLOCK_CORE_HEIGHT.to_vec(), KEY_FEE_MULTIPLIER.to_vec(), + KEY_PROTOCOL_VERSION.to_vec(), ]); let mut query = if ascending { Query::new_single_query_item(QueryItem::RangeFrom( @@ -54,12 +56,12 @@ impl Drive { query.set_subquery(subquery); let path_query = PathQuery::new( pools_vec_path(), - SizedQuery::new(query, Some(count * 4), None), + // The multiplier must be equal to requested keys count + SizedQuery::new(query, Some(count * 5), None), ); self.grove_get_proved_path_query( &path_query, - false, transaction, &mut vec![], &platform_version.drive, diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/mod.rs index 94027c3a7e6..270bf110789 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/mod.rs @@ -35,7 +35,9 @@ impl Drive { .epochs .get_epoch_start_block_core_height { - 0 => self.get_epoch_start_block_core_height_v0(epoch_tree, transaction), + 0 => { + self.get_epoch_start_block_core_height_v0(epoch_tree, transaction, platform_version) + } version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epoch_start_block_core_height".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/v0/mod.rs index dab0912103f..8d4b7bbafe7 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_core_height/v0/mod.rs @@ -4,10 +4,10 @@ use crate::error::Error; use dpp::block::epoch::Epoch; +use crate::drive::credit_pools::epochs::epoch_key_constants::KEY_START_BLOCK_CORE_HEIGHT; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use grovedb::{Element, TransactionArg}; - -use crate::fee_pools::epochs::epoch_key_constants::KEY_START_BLOCK_CORE_HEIGHT; -use crate::fee_pools::epochs::paths::EpochProposers; +use platform_version::version::PlatformVersion; impl Drive { /// Returns the core block height of the Epoch's start block @@ -15,6 +15,7 @@ impl Drive { &self, epoch_tree: &Epoch, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { let element = self .grove @@ -22,6 +23,7 @@ impl Drive { &epoch_tree.get_path(), KEY_START_BLOCK_CORE_HEIGHT.as_slice(), transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/mod.rs index 1501be47ad5..8e078b696d2 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/mod.rs @@ -35,7 +35,7 @@ impl Drive { .epochs .get_epoch_start_block_height { - 0 => self.get_epoch_start_block_height_v0(epoch_tree, transaction), + 0 => self.get_epoch_start_block_height_v0(epoch_tree, transaction, platform_version), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epoch_start_block_height".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/v0/mod.rs index 7fd1a86c7b3..2b650b284a8 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_epoch_start_block_height/v0/mod.rs @@ -4,10 +4,10 @@ use crate::error::Error; use dpp::block::epoch::Epoch; +use crate::drive::credit_pools::epochs::epoch_key_constants::KEY_START_BLOCK_HEIGHT; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use grovedb::{Element, TransactionArg}; - -use crate::fee_pools::epochs::epoch_key_constants::KEY_START_BLOCK_HEIGHT; -use crate::fee_pools::epochs::paths::EpochProposers; +use platform_version::version::PlatformVersion; impl Drive { /// Returns the block height of the Epoch's start block @@ -15,6 +15,7 @@ impl Drive { &self, epoch_tree: &Epoch, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { let element = self .grove @@ -22,6 +23,7 @@ impl Drive { &epoch_tree.get_path(), KEY_START_BLOCK_HEIGHT.as_slice(), transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/mod.rs index 83cc1aa1fe1..2b657f87a92 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/mod.rs @@ -44,6 +44,7 @@ impl Drive { from_epoch_index, to_epoch_index, transaction, + platform_version, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_first_epoch_start_block_info_between_epochs".to_string(), diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/v0/mod.rs index c65d9a06b40..1dea8618231 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/get_first_epoch_start_block_info_between_epochs/v0/mod.rs @@ -3,15 +3,15 @@ use crate::drive::credit_pools::paths::pools_vec_path; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee_pools::epochs::paths; use dpp::block::epoch::EpochIndex; -use grovedb::query_result_type::QueryResultType::QueryPathKeyElementTrioResultType; -use grovedb::{Element, PathQuery, Query, SizedQuery, TransactionArg}; - -use crate::fee_pools::epochs::epoch_key_constants::{ +use crate::drive::credit_pools::epochs; +use crate::drive::credit_pools::epochs::epoch_key_constants::{ KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, }; +use grovedb::query_result_type::QueryResultType::QueryPathKeyElementTrioResultType; +use grovedb::{Element, PathQuery, Query, SizedQuery, TransactionArg}; +use platform_version::version::PlatformVersion; impl Drive { /// Returns the index and start block platform and core heights of the first epoch between @@ -21,6 +21,7 @@ impl Drive { from_epoch_index: EpochIndex, to_epoch_index: EpochIndex, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result, Error> { let mut start_block_height_query = Query::new(); start_block_height_query.insert_key(KEY_START_BLOCK_HEIGHT.to_vec()); @@ -28,8 +29,8 @@ impl Drive { let mut epochs_query = Query::new(); - let from_epoch_key = paths::encode_epoch_index_key(from_epoch_index)?.to_vec(); - let current_epoch_key = paths::encode_epoch_index_key(to_epoch_index)?.to_vec(); + let from_epoch_key = epochs::paths::encode_epoch_index_key(from_epoch_index)?.to_vec(); + let current_epoch_key = epochs::paths::encode_epoch_index_key(to_epoch_index)?.to_vec(); epochs_query.insert_range_after_to_inclusive(from_epoch_key..=current_epoch_key); @@ -45,8 +46,10 @@ impl Drive { &path_query, transaction.is_some(), false, //set to false on purpose + true, QueryPathKeyElementTrioResultType, transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -105,7 +108,7 @@ impl Drive { "epoch pool shouldn't have empty path", )))?; - let epoch_index = paths::decode_epoch_index_key(epoch_key.as_slice())?; + let epoch_index = epochs::paths::decode_epoch_index_key(epoch_key.as_slice())?; Ok(Some(StartBlockInfo { epoch_index, diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/mod.rs index a2857939b93..bea94b346e0 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_block/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_block/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Epoch Start Blocks //! //! This modules implements functions in Drive relevant to Epoch start blocks. @@ -37,6 +8,7 @@ mod get_epoch_start_block_height; mod get_first_epoch_start_block_info_between_epochs; use dpp::block::epoch::EpochIndex; +use dpp::prelude::{BlockHeight, CoreBlockHeight}; /// `StartBlockInfo` contains information about the starting block of an epoch. #[derive(Debug, PartialEq, Eq)] @@ -45,26 +17,26 @@ pub struct StartBlockInfo { pub epoch_index: EpochIndex, /// The height of the starting block within the epoch. - pub start_block_height: u64, + pub start_block_height: BlockHeight, /// The core height of the starting block. - pub start_block_core_height: u32, + pub start_block_core_height: CoreBlockHeight, } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use super::*; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; mod get_epoch_start_block_height { use super::*; - use crate::error::drive::DriveError; - use crate::error::Error; - use crate::fee_pools::epochs::epoch_key_constants::{ + use crate::drive::credit_pools::epochs::epoch_key_constants::{ KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, }; - use crate::fee_pools::epochs::paths::EpochProposers; + use crate::drive::credit_pools::epochs::paths::EpochProposers; + use crate::error::drive::DriveError; + use crate::error::Error; use dpp::block::epoch::Epoch; use dpp::version::PlatformVersion; use grovedb::Element; @@ -122,6 +94,7 @@ mod tests { Element::Item(u128::MAX.to_be_bytes().to_vec(), None), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); @@ -152,6 +125,7 @@ mod tests { Element::Item(u64::MAX.to_be_bytes().to_vec(), None), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); @@ -185,6 +159,7 @@ mod tests { Element::empty_tree(), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); @@ -215,6 +190,7 @@ mod tests { Element::empty_tree(), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); @@ -234,9 +210,9 @@ mod tests { mod get_first_epoch_start_block_height_between_epochs { use super::*; - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::drive::batch::GroveDbOpBatch; - use crate::fee_pools::epochs::operations_factory::EpochOperations; + use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::GroveDbOpBatch; use dpp::block::epoch::Epoch; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/mod.rs index d224cb5aa12..8972a1d5441 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/mod.rs @@ -33,7 +33,7 @@ impl Drive { .epochs .get_epoch_start_time { - 0 => self.get_epoch_start_time_v0(epoch_tree, transaction), + 0 => self.get_epoch_start_time_v0(epoch_tree, transaction, platform_version), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_epoch_start_time".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/v0/mod.rs index 3239bda5a12..65414461dd2 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_time/get_epoch_start_time/v0/mod.rs @@ -1,11 +1,11 @@ +use crate::drive::credit_pools::epochs::epoch_key_constants::KEY_START_TIME; +use crate::drive::credit_pools::epochs::paths::EpochProposers; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; use dpp::block::epoch::Epoch; use grovedb::{Element, TransactionArg}; - -use crate::fee_pools::epochs::epoch_key_constants::KEY_START_TIME; -use crate::fee_pools::epochs::paths::EpochProposers; +use platform_version::version::PlatformVersion; impl Drive { /// Returns the start time of the given Epoch. @@ -13,6 +13,7 @@ impl Drive { &self, epoch_tree: &Epoch, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { let element = self .grove @@ -20,6 +21,7 @@ impl Drive { &epoch_tree.get_path(), KEY_START_TIME.as_slice(), transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -41,10 +43,10 @@ impl Drive { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use super::*; @@ -105,6 +107,7 @@ mod tests { Element::empty_tree(), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); @@ -134,6 +137,7 @@ mod tests { Element::Item(u128::MAX.to_be_bytes().to_vec(), None), None, Some(&transaction), + &platform_version.drive.grove_version, ) .unwrap() .expect("should insert invalid data"); diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/start_time/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/start_time/mod.rs index 88d83f1be43..2ceb01302b0 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/start_time/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/start_time/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Epoch Start Times. //! //! This module implements functions in Drive relevant to Epoch start times. diff --git a/packages/rs-drive/src/drive/credit_pools/initialization.rs b/packages/rs-drive/src/drive/credit_pools/initialization.rs new file mode 100644 index 00000000000..46144416020 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/initialization.rs @@ -0,0 +1,46 @@ +use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; +use crate::drive::credit_pools::operations; +use crate::drive::Drive; +use crate::error::Error; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; +use dpp::block::epoch::Epoch; +use dpp::fee::epoch::{perpetual_storage_epochs, GENESIS_EPOCH_INDEX}; +use dpp::util::deserializer::ProtocolVersion; + +impl Drive { + #[cfg(feature = "server")] + /// Adds the operations to groveDB op batch to create the fee pool trees + pub fn add_create_fee_pool_trees_operations( + batch: &mut GroveDbOpBatch, + epochs_per_era: u16, + protocol_version: ProtocolVersion, + ) -> Result<(), Error> { + // Init storage credit pool + batch.push(operations::update_storage_fee_distribution_pool_operation( + 0, + )?); + + // Init next epoch to pay + batch.push(operations::update_unpaid_epoch_index_operation( + GENESIS_EPOCH_INDEX, + )); + + operations::add_create_pending_epoch_refunds_tree_operations(batch); + + // We need to insert 50 era worth of epochs, + // with 40 epochs per era that's 2000 epochs + // however this is configurable + for i in GENESIS_EPOCH_INDEX..perpetual_storage_epochs(epochs_per_era) { + let epoch = Epoch::new(i)?; + epoch.add_init_empty_operations(batch)?; + } + + let genesis_epoch = Epoch::new(GENESIS_EPOCH_INDEX)?; + + // Initial protocol version for genesis epoch + batch.push(genesis_epoch.update_protocol_version_operation(protocol_version)); + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/mod.rs b/packages/rs-drive/src/drive/credit_pools/mod.rs index 82f4c4f0b1a..398980bc91f 100644 --- a/packages/rs-drive/src/drive/credit_pools/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/mod.rs @@ -1,59 +1,69 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -use crate::drive::batch::GroveDbOpBatch; +#[cfg(feature = "server")] use crate::drive::Drive; +#[cfg(feature = "server")] use crate::error::drive::DriveError; +#[cfg(feature = "server")] use crate::error::Error; +#[cfg(feature = "server")] +use crate::util::batch::GroveDbOpBatch; -use crate::fee_pools::epochs::epoch_key_constants::KEY_POOL_STORAGE_FEES; -use crate::fee_pools::epochs::paths::encode_epoch_index_key; -use crate::fee_pools::epochs::paths::EpochProposers; +#[cfg(feature = "server")] +use epochs::epoch_key_constants::KEY_POOL_STORAGE_FEES; +#[cfg(feature = "server")] +use epochs::paths::encode_epoch_index_key; +#[cfg(feature = "server")] +use epochs::paths::EpochProposers; +#[cfg(feature = "server")] use dpp::block::epoch::{Epoch, EpochIndex}; +#[cfg(feature = "server")] use dpp::fee::epoch::SignedCreditsPerEpoch; +#[cfg(feature = "server")] use dpp::fee::SignedCredits; +#[cfg(feature = "server")] use grovedb::query_result_type::QueryResultType; +#[cfg(feature = "server")] use grovedb::{Element, PathQuery, Query, TransactionArg}; +#[cfg(feature = "server")] use itertools::Itertools; +#[cfg(any(feature = "server", feature = "verify"))] /// Epochs module pub mod epochs; + +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) mod paths; + +#[cfg(feature = "server")] pub mod pending_epoch_refunds; + +#[cfg(feature = "server")] pub mod storage_fee_distribution_pool; +#[cfg(feature = "server")] pub mod unpaid_epoch; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::fee::get_overflow_error; +/// Initialization module +#[cfg(feature = "server")] +pub mod initialization; + +/// Operations module + +#[cfg(feature = "server")] +pub mod operations; + +#[cfg(feature = "server")] +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + +#[cfg(feature = "server")] +use crate::fees::get_overflow_error; + +#[cfg(any(feature = "server", feature = "verify"))] pub use paths::*; +#[cfg(feature = "server")] +use platform_version::version::PlatformVersion; + +#[cfg(feature = "server")] impl Drive { /// Adds GroveDB operations to update epoch storage fee pools with specified map of credits to epochs /// This method optimized to update sequence of epoch pools without gaps @@ -62,6 +72,7 @@ impl Drive { batch: &mut GroveDbOpBatch, credits_per_epochs: SignedCreditsPerEpoch, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result<(), Error> { if credits_per_epochs.is_empty() { return Ok(()); @@ -99,8 +110,10 @@ impl Drive { &PathQuery::new_unsized(pools_vec_path(), epochs_query), transaction.is_some(), true, + true, QueryResultType::QueryElementResultType, transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -162,25 +175,26 @@ impl Drive { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use super::*; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; mod add_update_epoch_storage_fee_pools_operations { use super::*; - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::fee_pools::epochs::operations_factory::EpochOperations; + use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::block::epoch::EpochIndex; use dpp::fee::epoch::GENESIS_EPOCH_INDEX; use dpp::fee::Credits; use dpp::version::PlatformVersion; - use grovedb::batch::Op; + use grovedb::batch::GroveOp; #[test] fn should_do_nothing_if_credits_per_epoch_are_empty() { + let platform_version = PlatformVersion::latest(); let drive = setup_drive_with_initial_state_structure(); let transaction = drive.grove.start_transaction(); @@ -193,6 +207,7 @@ mod tests { &mut batch, credits_per_epoch, Some(&transaction), + platform_version, ) .expect("should update epoch storage pools"); @@ -239,6 +254,7 @@ mod tests { &mut batch, credits_to_epochs, Some(&transaction), + platform_version, ) .expect("should update epoch storage pools"); @@ -252,7 +268,7 @@ mod tests { Epoch::new(i as EpochIndex).unwrap().get_path_vec() ); - let Op::Insert { + let GroveOp::InsertOrReplace { element: Element::SumItem(credits, _), } = operation.op else { @@ -307,6 +323,7 @@ mod tests { &mut batch, credits_to_epochs, Some(&transaction), + platform_version, ) .expect("should update epoch storage pools"); @@ -315,7 +332,7 @@ mod tests { let updated_credits: Vec<_> = batch .into_iter() .map(|operation| { - let Op::Insert { + let GroveOp::InsertOrReplace { element: Element::SumItem(credits, _), } = operation.op else { diff --git a/packages/rs-drive/src/drive/credit_pools/operations.rs b/packages/rs-drive/src/drive/credit_pools/operations.rs new file mode 100644 index 00000000000..7dd78802b55 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/operations.rs @@ -0,0 +1,134 @@ +use crate::drive::credit_pools::epochs::epochs_root_tree_key_constants::{ + KEY_PENDING_EPOCH_REFUNDS, KEY_STORAGE_FEE_POOL, KEY_UNPAID_EPOCH_INDEX, +}; +use crate::drive::credit_pools::pools_vec_path; +use crate::error::Error; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; +use dpp::balances::credits::Creditable; +use dpp::block::epoch::EpochIndex; +use dpp::fee::Credits; +use grovedb::batch::QualifiedGroveDbOp; +use grovedb::Element; + +#[cfg(feature = "server")] +/// Adds operations to batch to create pending pool updates tree +pub fn add_create_pending_epoch_refunds_tree_operations(batch: &mut GroveDbOpBatch) { + batch.add_insert_empty_sum_tree(pools_vec_path(), KEY_PENDING_EPOCH_REFUNDS.to_vec()); +} + +#[cfg(feature = "server")] +/// Updates the storage fee distribution pool with a new storage fee +pub fn update_storage_fee_distribution_pool_operation( + storage_fee: Credits, +) -> Result { + Ok(QualifiedGroveDbOp::insert_or_replace_op( + pools_vec_path(), + KEY_STORAGE_FEE_POOL.to_vec(), + Element::new_sum_item(storage_fee.to_signed()?), + )) +} + +#[cfg(feature = "server")] +/// Updates the unpaid epoch index +pub fn update_unpaid_epoch_index_operation(epoch_index: EpochIndex) -> QualifiedGroveDbOp { + QualifiedGroveDbOp::insert_or_replace_op( + pools_vec_path(), + KEY_UNPAID_EPOCH_INDEX.to_vec(), + Element::new_item(epoch_index.to_be_bytes().to_vec()), + ) +} + +#[cfg(test)] +mod tests { + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + + mod add_create_fee_pool_trees_operations { + use super::*; + use crate::error::Error; + use dpp::block::epoch::Epoch; + use dpp::fee::epoch::perpetual_storage_epochs; + use dpp::version::PlatformVersion; + + #[test] + fn test_values_are_set() { + let drive = setup_drive_with_initial_state_structure(); + let transaction = drive.grove.start_transaction(); + let platform_version = PlatformVersion::latest(); + + let storage_fee_pool = drive + .get_storage_fees_from_distribution_pool(Some(&transaction), platform_version) + .expect("should get storage fee pool"); + + assert_eq!(storage_fee_pool, 0u64); + } + + #[test] + fn test_epoch_trees_are_created() { + let drive = setup_drive_with_initial_state_structure(); + let platform_version = PlatformVersion::latest(); + let transaction = drive.grove.start_transaction(); + + let perpetual_storage_epochs = perpetual_storage_epochs(drive.config.epochs_per_era); + + for epoch_index in 0..perpetual_storage_epochs { + let epoch = Epoch::new(epoch_index).unwrap(); + + let storage_fee = drive + .get_epoch_storage_credits_for_distribution( + &epoch, + Some(&transaction), + platform_version, + ) + .expect("should get storage fee"); + + assert_eq!(storage_fee, 0); + } + + let epoch = Epoch::new(perpetual_storage_epochs).unwrap(); // 1001th epochs pool + + let result = drive.get_epoch_storage_credits_for_distribution( + &epoch, + Some(&transaction), + platform_version, + ); + + assert!(matches!(result, Err(Error::GroveDB(_)))); + } + } + + mod update_storage_fee_distribution_pool_operation { + use super::*; + use crate::drive::credit_pools::operations; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::GroveDbOpBatch; + use dpp::version::PlatformVersion; + + #[test] + fn test_update_and_get_value() { + let drive = setup_drive_with_initial_state_structure(); + let transaction = drive.grove.start_transaction(); + + let platform_version = PlatformVersion::latest(); + + let storage_fee = 42; + + let mut batch = GroveDbOpBatch::new(); + + batch.push( + operations::update_storage_fee_distribution_pool_operation(storage_fee) + .expect("should return operation"), + ); + + drive + .grove_apply_batch(batch, false, Some(&transaction), &platform_version.drive) + .expect("should apply batch"); + + let stored_storage_fee = drive + .get_storage_fees_from_distribution_pool(Some(&transaction), platform_version) + .expect("should get storage fee pool"); + + assert_eq!(storage_fee, stored_storage_fee); + } + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/paths.rs b/packages/rs-drive/src/drive/credit_pools/paths.rs index 13661d7f5d6..51a23e8878c 100644 --- a/packages/rs-drive/src/drive/credit_pools/paths.rs +++ b/packages/rs-drive/src/drive/credit_pools/paths.rs @@ -1,6 +1,6 @@ +use crate::drive::credit_pools::epochs::epochs_root_tree_key_constants::KEY_STORAGE_FEE_POOL; use crate::drive::RootTree; use crate::error::Error; -use crate::fee_pools::epochs_root_tree_key_constants::KEY_STORAGE_FEE_POOL; use dpp::block::epoch::{EpochIndex, EPOCH_KEY_OFFSET}; use dpp::ProtocolError; diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/mod.rs index 443f0ce254c..3f1617241f2 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/mod.rs @@ -1,9 +1,9 @@ mod v0; -use crate::drive::batch::GroveDbOpBatch; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::batch::GroveDbOpBatch; use dpp::fee::epoch::CreditsPerEpoch; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; @@ -38,6 +38,7 @@ impl Drive { batch, refunds_per_epoch, transaction, + drive_version, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "add_delete_pending_epoch_refunds_except_specified_operations".to_string(), diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/v0/mod.rs index 98b63f37383..49cf61635e8 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/add_delete_pending_epoch_refunds_except_specified/v0/mod.rs @@ -1,14 +1,15 @@ -use crate::drive::batch::GroveDbOpBatch; use crate::drive::credit_pools::pending_epoch_refunds::pending_epoch_refunds_path_vec; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::batch::GroveDbOpBatch; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::fee::epoch::CreditsPerEpoch; use grovedb::query_result_type::QueryResultType; use grovedb::{PathQuery, Query, TransactionArg}; +use platform_version::version::drive_versions::DriveVersion; impl Drive { /// Adds operations to delete pending epoch refunds except epochs from provided collection @@ -17,6 +18,7 @@ impl Drive { batch: &mut GroveDbOpBatch, refunds_per_epoch: &CreditsPerEpoch, transaction: TransactionArg, + drive_version: &DriveVersion, ) -> Result<(), Error> { // TODO: Replace with key iterator let mut query = Query::new(); @@ -29,8 +31,10 @@ impl Drive { &PathQuery::new_unsized(pending_epoch_refunds_path_vec(), query), transaction.is_some(), true, + true, QueryResultType::QueryKeyElementPairResultType, transaction, + &drive_version.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -57,16 +61,16 @@ impl Drive { #[cfg(test)] mod tests { - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::drive::batch::GroveDbOpBatch; use crate::drive::credit_pools::pending_epoch_refunds::pending_epoch_refunds_path_vec; use crate::drive::Drive; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::GroveDbOpBatch; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::fee::epoch::CreditsPerEpoch; use dpp::version::PlatformVersion; - use grovedb::batch::Op; + use grovedb::batch::GroveOp; #[test] fn should_add_delete_operations_v0() { @@ -96,6 +100,7 @@ mod tests { &BlockInfo::default(), Some(&transaction), platform_version, + None, ) .expect("should apply batch"); @@ -119,7 +124,7 @@ mod tests { assert_eq!(batch.len(), expected_pending_refunds.len()); for operation in batch.into_iter() { - assert!(matches!(operation.op, Op::Delete)); + assert!(matches!(operation.op, GroveOp::Delete)); assert_eq!(operation.path.to_path(), pending_epoch_refunds_path_vec()); diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/mod.rs index 6789d6cde42..ffeb59f44cb 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/mod.rs @@ -34,6 +34,7 @@ impl Drive { 0 => self.fetch_and_add_pending_epoch_refunds_to_collection_v0( refunds_per_epoch, transaction, + drive_version, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "fetch_and_add_pending_epoch_refunds_to_collection".to_string(), diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/v0/mod.rs index 9c6245aa1cf..c593f5d49f2 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_and_add_pending_epoch_refunds_to_collection/v0/mod.rs @@ -3,12 +3,13 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::drive::fee::get_overflow_error; +use crate::fees::get_overflow_error; use dpp::balances::credits::Creditable; use dpp::fee::epoch::CreditsPerEpoch; use grovedb::query_result_type::QueryResultType; use grovedb::{Element, PathQuery, Query, TransactionArg}; +use platform_version::version::drive_versions::DriveVersion; impl Drive { /// Fetches pending epoch refunds and adds them to specified collection @@ -16,6 +17,7 @@ impl Drive { &self, mut refunds_per_epoch: CreditsPerEpoch, transaction: TransactionArg, + drive_version: &DriveVersion, ) -> Result { if refunds_per_epoch.is_empty() { return Ok(refunds_per_epoch); @@ -36,8 +38,10 @@ impl Drive { &PathQuery::new_unsized(pending_epoch_refunds_path_vec(), query), transaction.is_some(), true, + true, QueryResultType::QueryKeyElementPairResultType, transaction, + &drive_version.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; @@ -75,7 +79,7 @@ impl Drive { #[cfg(test)] mod tests { use crate::drive::Drive; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::fee::epoch::CreditsPerEpoch; @@ -108,6 +112,7 @@ mod tests { &BlockInfo::default(), Some(&transaction), platform_version, + None, ) .expect("should apply batch"); diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/mod.rs index c27f5749960..af8d8323fa5 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/mod.rs @@ -29,7 +29,7 @@ impl Drive { .pending_epoch_refunds .fetch_pending_epoch_refunds { - 0 => self.fetch_pending_epoch_refunds_v0(transaction), + 0 => self.fetch_pending_epoch_refunds_v0(transaction, drive_version), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "fetch_pending_epoch_refunds".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/v0/mod.rs index 64419b3205e..08007ef34fb 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/methods/fetch_pending_epoch_refunds/v0/mod.rs @@ -7,12 +7,14 @@ use dpp::balances::credits::Creditable; use dpp::fee::epoch::CreditsPerEpoch; use grovedb::query_result_type::QueryResultType; use grovedb::{Element, PathQuery, Query, TransactionArg}; +use platform_version::version::drive_versions::DriveVersion; impl Drive { /// Fetches all pending epoch refunds pub(super) fn fetch_pending_epoch_refunds_v0( &self, transaction: TransactionArg, + drive_version: &DriveVersion, ) -> Result { let mut query = Query::new(); @@ -24,8 +26,10 @@ impl Drive { &PathQuery::new_unsized(pending_epoch_refunds_path_vec(), query), transaction.is_some(), true, + true, QueryResultType::QueryKeyElementPairResultType, transaction, + &drive_version.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/mod.rs index 27cc0484b06..81a2f38751c 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/mod.rs @@ -41,6 +41,4 @@ mod methods; mod operations; mod paths; -pub use methods::*; -pub use operations::*; pub use paths::*; diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/mod.rs index a1e21f12149..b0097ab6fe7 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/mod.rs @@ -1,6 +1,6 @@ mod v0; -use crate::drive::batch::DriveOperation; +use crate::util::batch::DriveOperation; use crate::drive::Drive; use crate::error::drive::DriveError; diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/v0/mod.rs index 05fe18dcdb1..b397aea12bb 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/operations/add_update_pending_epoch_refunds_operations/v0/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::{DriveOperation, GroveDbOpBatch}; use crate::drive::credit_pools::pending_epoch_refunds::pending_epoch_refunds_path_vec; use crate::drive::Drive; use crate::error::Error; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::{DriveOperation, GroveDbOpBatch}; use dpp::balances::credits::Creditable; use dpp::fee::epoch::CreditsPerEpoch; use grovedb::Element; diff --git a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/paths.rs b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/paths.rs index 36f49b11d8b..7dfb62cb3f4 100644 --- a/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/paths.rs +++ b/packages/rs-drive/src/drive/credit_pools/pending_epoch_refunds/paths.rs @@ -1,5 +1,5 @@ +use crate::drive::credit_pools::epochs::epochs_root_tree_key_constants::KEY_PENDING_EPOCH_REFUNDS; use crate::drive::RootTree; -use crate::fee_pools::epochs_root_tree_key_constants::KEY_PENDING_EPOCH_REFUNDS; /// Returns the path to pending epoch refunds pub fn pending_epoch_refunds_path_vec() -> Vec> { diff --git a/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/mod.rs b/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/mod.rs index 093ddb214a4..a93b2c636b1 100644 --- a/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/mod.rs @@ -39,7 +39,7 @@ impl Drive { .storage_fee_distribution_pool .get_storage_fees_from_distribution_pool { - 0 => self.get_storage_fees_from_distribution_pool_v0(transaction), + 0 => self.get_storage_fees_from_distribution_pool_v0(transaction, platform_version), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "get_storage_fees_from_distribution_pool".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/v0/mod.rs index 54733a18fcd..98e8dac0f1b 100644 --- a/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/get_storage_fees_from_distribution_pool/v0/mod.rs @@ -1,23 +1,29 @@ use crate::drive::credit_pools::paths::pools_path; use crate::drive::Drive; use crate::error::drive::DriveError; +use crate::error::Error; use dpp::balances::credits::Creditable; use dpp::fee::Credits; use grovedb::{Element, TransactionArg}; +use platform_version::version::PlatformVersion; -use crate::error::Error; - -use crate::fee_pools::epochs_root_tree_key_constants::KEY_STORAGE_FEE_POOL; +use crate::drive::credit_pools::epochs::epochs_root_tree_key_constants::KEY_STORAGE_FEE_POOL; impl Drive { /// Returns the amount of credits in the storage fee distribution pool. pub(super) fn get_storage_fees_from_distribution_pool_v0( &self, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { match self .grove - .get(&pools_path(), KEY_STORAGE_FEE_POOL.as_slice(), transaction) + .get( + &pools_path(), + KEY_STORAGE_FEE_POOL.as_slice(), + transaction, + &platform_version.drive.grove_version, + ) .unwrap() { Ok(Element::SumItem(credits, _)) => Ok(credits.to_unsigned()), @@ -30,18 +36,18 @@ impl Drive { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use super::*; - use crate::tests::helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; + use crate::util::test_helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; mod get_storage_fees_from_distribution_pool { use super::*; - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::drive::batch::GroveDbOpBatch; use crate::drive::credit_pools::paths::pools_vec_path; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::GroveDbOpBatch; use dpp::version::PlatformVersion; #[test] diff --git a/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/mod.rs b/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/mod.rs index 1ef1e4516fc..b98ef16c53f 100644 --- a/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/storage_fee_distribution_pool/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Storage Fee Distribution Pool. //! diff --git a/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/get_unpaid_epoch_index/mod.rs b/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/get_unpaid_epoch_index/mod.rs new file mode 100644 index 00000000000..47dcb8ee5e7 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/get_unpaid_epoch_index/mod.rs @@ -0,0 +1,32 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::block::epoch::EpochIndex; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Returns the index of the unpaid Epoch. + pub fn get_unpaid_epoch_index( + &self, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .credit_pools + .unpaid_epoch + .get_unpaid_epoch_index + { + 0 => self.get_unpaid_epoch_index_v0(transaction, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "get_unpaid_epoch_index".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/get_unpaid_epoch_index/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/get_unpaid_epoch_index/v0/mod.rs new file mode 100644 index 00000000000..a9c1e14a2d4 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/get_unpaid_epoch_index/v0/mod.rs @@ -0,0 +1,138 @@ +use crate::drive::credit_pools::epochs::epochs_root_tree_key_constants::KEY_UNPAID_EPOCH_INDEX; +use crate::drive::credit_pools::paths::pools_path; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::block::epoch::EpochIndex; + +use grovedb::{Element, TransactionArg}; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Returns the index of the unpaid Epoch. + #[inline(always)] + pub(super) fn get_unpaid_epoch_index_v0( + &self, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let element = self + .grove + .get( + &pools_path(), + KEY_UNPAID_EPOCH_INDEX, + transaction, + &platform_version.drive.grove_version, + ) + .unwrap() + .map_err(Error::GroveDB)?; + + let Element::Item(encoded_epoch_index, _) = element else { + return Err(Error::Drive(DriveError::UnexpectedElementType( + "must be an item", + ))); + }; + + let epoch_index = + EpochIndex::from_be_bytes(encoded_epoch_index.as_slice().try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "item has an invalid length".to_string(), + )) + })?); + + Ok(epoch_index) + } +} + +#[cfg(feature = "server")] +#[cfg(test)] +mod tests { + use super::*; + + use crate::util::test_helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; + + mod get_unpaid_epoch_index { + use super::*; + + #[test] + fn test_error_if_fee_pools_tree_is_not_initiated() { + let platform_version = PlatformVersion::latest(); + let drive = setup_drive(None); + let transaction = drive.grove.start_transaction(); + + let result = drive.get_unpaid_epoch_index_v0(Some(&transaction), platform_version); + + assert!(matches!( + result, + Err(Error::GroveDB(grovedb::Error::PathParentLayerNotFound(_))) + )); + } + + #[test] + fn test_error_if_element_has_invalid_type() { + let platform_version = PlatformVersion::latest(); + let drive = setup_drive_with_initial_state_structure(); + let transaction = drive.grove.start_transaction(); + + // We need to first delete the item, because you can not replace an item with a tree + drive + .grove + .delete( + &pools_path(), + KEY_UNPAID_EPOCH_INDEX.as_slice(), + None, + Some(&transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should delete old item"); + + drive + .grove + .insert( + &pools_path(), + KEY_UNPAID_EPOCH_INDEX.as_slice(), + Element::empty_tree(), + None, + Some(&transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should insert invalid data"); + + let result = drive.get_unpaid_epoch_index_v0(Some(&transaction), platform_version); + + assert!(matches!( + result, + Err(Error::Drive(DriveError::UnexpectedElementType(_))) + )); + } + + #[test] + fn test_error_if_value_has_invalid_length() { + let platform_version = PlatformVersion::latest(); + let drive = setup_drive_with_initial_state_structure(); + let transaction = drive.grove.start_transaction(); + + drive + .grove + .insert( + &pools_path(), + KEY_UNPAID_EPOCH_INDEX.as_slice(), + Element::Item(u128::MAX.to_be_bytes().to_vec(), None), + None, + Some(&transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should insert invalid data"); + + let result = drive.get_unpaid_epoch_index_v0(Some(&transaction), platform_version); + + assert!(matches!( + result, + Err(Error::Drive(DriveError::CorruptedSerialization(_))) + )); + } + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/mod.rs b/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/mod.rs index 3092f0f4015..781c4305d48 100644 --- a/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/unpaid_epoch/mod.rs @@ -1,156 +1,4 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Unpaid Epoch. //! -use crate::drive::credit_pools::paths::pools_path; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee_pools::epochs_root_tree_key_constants::KEY_UNPAID_EPOCH_INDEX; -use dpp::block::epoch::EpochIndex; - -use grovedb::{Element, TransactionArg}; - -impl Drive { - /// Returns the index of the unpaid Epoch. - pub fn get_unpaid_epoch_index_v0( - &self, - transaction: TransactionArg, - ) -> Result { - let element = self - .grove - .get(&pools_path(), KEY_UNPAID_EPOCH_INDEX, transaction) - .unwrap() - .map_err(Error::GroveDB)?; - - let Element::Item(encoded_epoch_index, _) = element else { - return Err(Error::Drive(DriveError::UnexpectedElementType( - "must be an item", - ))); - }; - - let epoch_index = - EpochIndex::from_be_bytes(encoded_epoch_index.as_slice().try_into().map_err(|_| { - Error::Drive(DriveError::CorruptedSerialization( - "item has an invalid length".to_string(), - )) - })?); - - Ok(epoch_index) - } -} - -#[cfg(feature = "full")] -#[cfg(test)] -mod tests { - use super::*; - - use crate::tests::helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; - - mod get_unpaid_epoch_index { - use super::*; - - #[test] - fn test_error_if_fee_pools_tree_is_not_initiated() { - let drive = setup_drive(None); - let transaction = drive.grove.start_transaction(); - - let result = drive.get_unpaid_epoch_index_v0(Some(&transaction)); - - assert!(matches!( - result, - Err(Error::GroveDB(grovedb::Error::PathParentLayerNotFound(_))) - )); - } - - #[test] - fn test_error_if_element_has_invalid_type() { - let drive = setup_drive_with_initial_state_structure(); - let transaction = drive.grove.start_transaction(); - - // We need to first delete the item, because you can not replace an item with a tree - drive - .grove - .delete( - &pools_path(), - KEY_UNPAID_EPOCH_INDEX.as_slice(), - None, - Some(&transaction), - ) - .unwrap() - .expect("should delete old item"); - - drive - .grove - .insert( - &pools_path(), - KEY_UNPAID_EPOCH_INDEX.as_slice(), - Element::empty_tree(), - None, - Some(&transaction), - ) - .unwrap() - .expect("should insert invalid data"); - - let result = drive.get_unpaid_epoch_index_v0(Some(&transaction)); - - assert!(matches!( - result, - Err(Error::Drive(DriveError::UnexpectedElementType(_))) - )); - } - - #[test] - fn test_error_if_value_has_invalid_length() { - let drive = setup_drive_with_initial_state_structure(); - let transaction = drive.grove.start_transaction(); - - drive - .grove - .insert( - &pools_path(), - KEY_UNPAID_EPOCH_INDEX.as_slice(), - Element::Item(u128::MAX.to_be_bytes().to_vec(), None), - None, - Some(&transaction), - ) - .unwrap() - .expect("should insert invalid data"); - - let result = drive.get_unpaid_epoch_index_v0(Some(&transaction)); - - assert!(matches!( - result, - Err(Error::Drive(DriveError::CorruptedSerialization(_))) - )); - } - } -} +mod get_unpaid_epoch_index; diff --git a/packages/rs-drive/src/drive/defaults.rs b/packages/rs-drive/src/drive/defaults.rs deleted file mode 100644 index 3440843d64f..00000000000 --- a/packages/rs-drive/src/drive/defaults.rs +++ /dev/null @@ -1,103 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Drive Defaults -//! -//! Default values for Drive constants. -//! - -/// Protocol version -pub const PROTOCOL_VERSION: u32 = 1; -///DataContract Documents subtree path height -pub const CONTRACT_DOCUMENTS_PATH_HEIGHT: u16 = 4; -/// Base contract root path size -pub const BASE_CONTRACT_ROOT_PATH_SIZE: u32 = 33; // 1 + 32 -/// Base contract keeping_history_storage path size -pub const BASE_CONTRACT_KEEPING_HISTORY_STORAGE_PATH_SIZE: u32 = 34; // 1 + 32 + 1 -/// Base contract documents_keeping_history_storage_time_reference path size -pub const BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_STORAGE_TIME_REFERENCE_PATH: u32 = 75; -/// Base contract documents_keeping_history_primary_key path for document ID size -pub const BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_PRIMARY_KEY_PATH_FOR_DOCUMENT_ID_SIZE: u32 = 67; // 1 + 32 + 1 + 1 + 32, then we need to add document_type_name.len() -/// BaseDataContract Documents path size -pub const BASE_CONTRACT_DOCUMENTS_PATH: u32 = 34; -/// BaseDataContract Documents primary key path -pub const BASE_CONTRACT_DOCUMENTS_PRIMARY_KEY_PATH: u32 = 35; -/// Default hash size -pub const DEFAULT_HASH_SIZE: u32 = 32; -/// Default hash 160 size as u8 -pub const DEFAULT_HASH_160_SIZE_U8: u8 = 20; -/// Default hash size as u8 -pub const DEFAULT_HASH_SIZE_U8: u8 = 32; -/// Default hash size as u16 -pub const DEFAULT_HASH_SIZE_U16: u16 = 32; -/// Default hash size as u32 -pub const DEFAULT_HASH_SIZE_U32: u32 = 32; -/// Some optimized document reference size -pub const OPTIMIZED_DOCUMENT_REFERENCE: u16 = 34; // 1 + hops + DEFAULT_HASH_SIZE -/// Default float size -pub const DEFAULT_FLOAT_SIZE: u32 = 8; -/// Default float size as u16 -pub const DEFAULT_FLOAT_SIZE_U16: u16 = 8; -/// Default float size as u8 -pub const DEFAULT_FLOAT_SIZE_U8: u8 = 8; -/// Empty tree storage size -pub const EMPTY_TREE_STORAGE_SIZE: u32 = 33; -/// Max index size -pub const MAX_INDEX_SIZE: usize = 255; -/// Storage flags size -pub const STORAGE_FLAGS_SIZE: u32 = 2; - -/// Serialized contract max size -pub const CONTRACT_MAX_SERIALIZED_SIZE: u16 = 16384; -// TODO: Insert correct value here -/// Max element size -pub const MAX_ELEMENT_SIZE: u32 = 5000; - -/// Default required bytes to hold a user balance -/// TODO We probably don't need it anymore since we always pay for 9 bytes -pub const AVERAGE_BALANCE_SIZE: u32 = 6; - -/// Default required bytes to hold a public key -pub const AVERAGE_KEY_SIZE: u32 = 50; - -/// How many updates would occur on average for an item -pub const AVERAGE_NUMBER_OF_UPDATES: u8 = 10; - -/// How many bytes are added on average per update -/// 1 here signifies less than 128 -pub const AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE: u8 = 1; - -/// The estimated average document type name size -pub const ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE: u8 = 12; - -/// The estimated average index name size -pub const ESTIMATED_AVERAGE_INDEX_NAME_SIZE: u8 = 16; - -/// The estimated count of identities having the same key if they are not unique -pub const ESTIMATED_NON_UNIQUE_KEY_DUPLICATES: u32 = 2; diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs index a90d757fdce..9aa5ecc8a6b 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs @@ -10,6 +10,8 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::identifier::Identifier; use grovedb::TransactionArg; impl Drive { @@ -30,13 +32,14 @@ impl Drive { /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. pub fn delete_document_for_contract( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type_name: &str, block_info: BlockInfo, apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -53,6 +56,7 @@ impl Drive { apply, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "delete_document_for_contract".to_string(), diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs index 4bed01a5ba4..a0bda229329 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs @@ -1,10 +1,12 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -12,15 +14,17 @@ use std::collections::HashMap; impl Drive { /// Deletes a document and returns the associated fee. + #[inline(always)] pub(super) fn delete_document_for_contract_v0( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type_name: &str, block_info: BlockInfo, apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { let mut drive_operations: Vec = vec![]; let estimated_costs_only_with_layer_info = if apply { @@ -43,6 +47,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/mod.rs index ad521ec087b..f695f0240c7 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/mod.rs @@ -3,9 +3,10 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::DataContract; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -29,7 +30,7 @@ impl Drive { /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. pub fn delete_document_for_contract_apply_and_add_to_operations( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type_name: &str, estimated_costs_only_with_layer_info: Option< diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/v0/mod.rs index 2579d18c864..92f56ee2d56 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_apply_and_add_to_operations/v0/mod.rs @@ -1,8 +1,9 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::DataContract; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -10,9 +11,10 @@ use std::collections::HashMap; impl Drive { /// Deletes a document. + #[inline(always)] pub(super) fn delete_document_for_contract_apply_and_add_to_operations_v0( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type_name: &str, mut estimated_costs_only_with_layer_info: Option< diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs index 64009ee3a07..7d13b030330 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs @@ -2,16 +2,16 @@ mod v0; use grovedb::TransactionArg; -use dpp::block::block_info::BlockInfo; - use crate::drive::Drive; +use dpp::block::block_info::BlockInfo; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use crate::error::drive::DriveError; use crate::error::Error; use dpp::fee::fee_result::FeeResult; - +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; impl Drive { @@ -33,13 +33,14 @@ impl Drive { /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. pub fn delete_document_for_contract_id( &self, - document_id: [u8; 32], - contract_id: [u8; 32], + document_id: Identifier, + contract_id: Identifier, document_type_name: &str, block_info: BlockInfo, apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -56,6 +57,7 @@ impl Drive { apply, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "delete_document_for_contract_id".to_string(), diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs index 76d8e48b452..f18762d7331 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs @@ -4,30 +4,32 @@ use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; -use dpp::block::block_info::BlockInfo; - use crate::drive::Drive; use crate::error::document::DocumentError; +use dpp::block::block_info::BlockInfo; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::fee::fee_result::FeeResult; - +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; impl Drive { /// Deletes a document and returns the associated fee. /// The contract CBOR is given instead of the contract itself. + #[inline(always)] pub(super) fn delete_document_for_contract_id_v0( &self, - document_id: [u8; 32], - contract_id: [u8; 32], + document_id: Identifier, + contract_id: Identifier, document_type_name: &str, block_info: BlockInfo, apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { let mut drive_operations: Vec = vec![]; let estimated_costs_only_with_layer_info = if apply { @@ -38,7 +40,7 @@ impl Drive { let contract_fetch_info = self .get_contract_with_fetch_info_and_add_to_operations( - contract_id, + contract_id.to_buffer(), Some(&block_info.epoch), true, transaction, @@ -58,13 +60,13 @@ impl Drive { &mut drive_operations, platform_version, )?; - let fees = Drive::calculate_fee( None, Some(drive_operations), &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/mod.rs index 0a64f0ccaf8..bbf98468c85 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/mod.rs @@ -3,9 +3,10 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -30,8 +31,8 @@ impl Drive { /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. pub fn delete_document_for_contract_id_with_named_type_operations( &self, - document_id: [u8; 32], - contract_id: [u8; 32], + document_id: Identifier, + contract_id: Identifier, document_type_name: &str, epoch: &Epoch, previous_batch_operations: Option<&mut Vec>, diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/v0/mod.rs index 02e8ab70177..45b3a24e689 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id_with_named_type_operations/v0/mod.rs @@ -8,19 +8,21 @@ use crate::drive::Drive; use crate::error::document::DocumentError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; impl Drive { /// Prepares the operations for deleting a document. + #[inline(always)] pub(super) fn delete_document_for_contract_id_with_named_type_operations_v0( &self, - document_id: [u8; 32], - contract_id: [u8; 32], + document_id: Identifier, + contract_id: Identifier, document_type_name: &str, epoch: &Epoch, previous_batch_operations: Option<&mut Vec>, @@ -32,7 +34,7 @@ impl Drive { ) -> Result, Error> { let mut operations = vec![]; let Some(contract_fetch_info) = self.get_contract_with_fetch_info_and_add_to_operations( - contract_id, + contract_id.to_buffer(), Some(epoch), true, transaction, diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/mod.rs index 1abdf5037d4..8aef9035a68 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/mod.rs @@ -3,11 +3,12 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::document_type::DocumentTypeRef; use dpp::data_contract::DataContract; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -30,7 +31,7 @@ impl Drive { /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. pub(crate) fn delete_document_for_contract_operations( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type: DocumentTypeRef, previous_batch_operations: Option<&mut Vec>, diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs index d6388079c3b..cec20f624ae 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs @@ -6,37 +6,39 @@ use dpp::data_contract::document_type::DocumentTypeRef; use std::collections::HashMap; -use crate::drive::document::contract_documents_primary_key_path; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::{ +use crate::drive::document::paths::contract_documents_primary_key_path; +use crate::util::object_size_info::DocumentInfo::{ DocumentEstimatedAverageSize, DocumentOwnedInfo, }; +use crate::util::storage_flags::StorageFlags; use dpp::data_contract::DataContract; use dpp::document::Document; -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; -use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::drive::Drive; +use crate::util::grove_operations::DirectQueryType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; impl Drive { /// Prepares the operations for deleting a document. + #[inline(always)] pub(super) fn delete_document_for_contract_operations_v0( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type: DocumentTypeRef, previous_batch_operations: Option<&mut Vec>, @@ -48,7 +50,7 @@ impl Drive { ) -> Result, Error> { let mut batch_operations: Vec = vec![]; - if !document_type.documents_mutable() { + if !document_type.documents_can_be_deleted() { return Err(Error::Drive(DriveError::UpdatingReadOnlyImmutableDocument( "this document type is not mutable and can not be deleted", ))); diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/mod.rs index 66d0fd37cb6..f0c1053cbfe 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/mod.rs @@ -3,10 +3,11 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::DataContract; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -29,7 +30,7 @@ impl Drive { /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. pub(crate) fn delete_document_for_contract_with_named_type_operations( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type_name: &str, previous_batch_operations: Option<&mut Vec>, diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/v0/mod.rs index 00fa07d3082..042506bb49b 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_with_named_type_operations/v0/mod.rs @@ -9,17 +9,19 @@ use dpp::data_contract::DataContract; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; impl Drive { /// Prepares the operations for deleting a document. + #[inline(always)] pub(super) fn delete_document_for_contract_with_named_type_operations_v0( &self, - document_id: [u8; 32], + document_id: Identifier, contract: &DataContract, document_type_name: &str, previous_batch_operations: Option<&mut Vec>, diff --git a/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs index e1f97a19ebc..2f2863cd4ac 100644 --- a/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs @@ -8,11 +8,9 @@ use dpp::data_contract::document_type::DocumentTypeRef; use std::collections::HashMap; -use crate::drive::defaults::{ - AVERAGE_NUMBER_OF_UPDATES, AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE, DEFAULT_HASH_SIZE_U8, -}; +use crate::drive::constants::{AVERAGE_NUMBER_OF_UPDATES, AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE}; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; use crate::drive::Drive; @@ -21,6 +19,7 @@ use crate::error::Error; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use dpp::version::PlatformVersion; impl Drive { @@ -47,6 +46,7 @@ impl Drive { /// to derive estimations for mutable documents. In the future, the contract might dictate how often /// documents are expected to mutate. /// - The function assumes a default hash size (`DEFAULT_HASH_SIZE_U8`) and other default values for its estimations. + #[inline(always)] pub(super) fn add_estimation_costs_for_remove_document_to_primary_storage_v0( primary_key_path: [&[u8]; 5], document_type: DocumentTypeRef, diff --git a/packages/rs-drive/src/drive/document/delete/mod.rs b/packages/rs-drive/src/drive/document/delete/mod.rs index 01a7df4435b..07d73261350 100644 --- a/packages/rs-drive/src/drive/document/delete/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Delete Documents. //! //! This module implements functions in Drive for deleting documents. @@ -35,92 +6,88 @@ // Module: delete_document_for_contract // This module contains functionality for deleting a document associated with a given contract mod delete_document_for_contract; -pub use delete_document_for_contract::*; // Module: delete_document_for_contract_id // This module contains functionality for deleting a document associated with a given contract id mod delete_document_for_contract_id; -pub use delete_document_for_contract_id::*; // Module: delete_document_for_contract_apply_and_add_to_operations // This module contains functionality to apply a delete operation and add to the operations of a contract mod delete_document_for_contract_apply_and_add_to_operations; -pub use delete_document_for_contract_apply_and_add_to_operations::*; // Module: remove_document_from_primary_storage // This module contains functionality to remove a document from primary storage mod remove_document_from_primary_storage; -pub use remove_document_from_primary_storage::*; // Module: remove_reference_for_index_level_for_contract_operations // This module contains functionality to remove a reference for an index level for contract operations mod remove_reference_for_index_level_for_contract_operations; -pub use remove_reference_for_index_level_for_contract_operations::*; // Module: remove_indices_for_index_level_for_contract_operations // This module contains functionality to remove indices for an index level for contract operations mod remove_indices_for_index_level_for_contract_operations; -pub use remove_indices_for_index_level_for_contract_operations::*; // Module: remove_indices_for_top_index_level_for_contract_operations // This module contains functionality to remove indices for the top index level for contract operations mod remove_indices_for_top_index_level_for_contract_operations; -pub use remove_indices_for_top_index_level_for_contract_operations::*; // Module: delete_document_for_contract_id_with_named_type_operations // This module contains functionality to delete a document for a contract id with named type operations mod delete_document_for_contract_id_with_named_type_operations; -pub use delete_document_for_contract_id_with_named_type_operations::*; // Module: delete_document_for_contract_with_named_type_operations // This module contains functionality to delete a document for a contract with named type operations mod delete_document_for_contract_with_named_type_operations; -pub use delete_document_for_contract_with_named_type_operations::*; // Module: delete_document_for_contract_operations // This module contains functionality to delete a document for contract operations mod delete_document_for_contract_operations; -pub use delete_document_for_contract_operations::*; mod internal; -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use dpp::balances::credits::Creditable; use dpp::block::block_info::BlockInfo; use rand::Rng; + use once_cell::sync::Lazy; use std::borrow::Cow; + use std::collections::BTreeMap; use std::option::Option::None; use tempfile::TempDir; - use crate::common::setup_contract; - use crate::drive::config::DriveConfig; + use crate::config::DriveConfig; use crate::drive::document::tests::setup_dashpay; - use crate::drive::flags::StorageFlags; - use crate::drive::object_size_info::DocumentInfo::DocumentRefInfo; - use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::drive::Drive; + use crate::util::object_size_info::DocumentInfo::DocumentRefInfo; + use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; + use crate::util::storage_flags::StorageFlags; + use crate::util::test_helpers::setup_contract; - use crate::query::DriveQuery; + use crate::query::DriveDocumentQuery; use dpp::block::epoch::Epoch; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::Document; - use dpp::fee::default_costs::EpochCosts; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::tests::json_document::{json_document_to_contract, json_document_to_document}; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::version::PlatformVersion; + static EPOCH_CHANGE_FEE_VERSION_TEST: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); + #[test] fn test_add_and_remove_family_one_document_no_transaction() { let tmp_dir = TempDir::new().unwrap(); + + let (drive, _) = Drive::open(tmp_dir, None).expect("expected to open Drive successfully"); + let platform_version = PlatformVersion::latest(); - let drive: Drive = Drive::open(tmp_dir, None, platform_version) - .expect("expected to open Drive successfully"); drive .create_initial_state_structure(None, platform_version) @@ -164,13 +131,15 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); let sql_string = "select * from person where firstName = 'Samuel' order by firstName asc limit 100"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -199,6 +168,7 @@ mod tests { true, None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -255,6 +225,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -266,8 +237,9 @@ mod tests { let sql_string = "select * from person where firstName = 'Samuel' order by firstName asc limit 100"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -298,6 +270,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -393,6 +366,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -427,6 +401,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -438,8 +413,9 @@ mod tests { let sql_string = "select * from person where firstName > 'A' order by firstName asc limit 5"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -465,6 +441,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -476,8 +453,9 @@ mod tests { let sql_string = "select * from person where firstName > 'A' order by firstName asc limit 5"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -503,6 +481,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -514,8 +493,9 @@ mod tests { let sql_string = "select * from person where firstName > 'A' order by firstName asc limit 5"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -570,6 +550,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -600,6 +581,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -611,8 +593,9 @@ mod tests { let sql_string = "select * from person where firstName > 'A' order by firstName asc limit 5"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -638,6 +621,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -668,6 +652,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -690,6 +675,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -709,6 +695,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -720,8 +707,9 @@ mod tests { let sql_string = "select * from person where firstName > 'A' order by firstName asc limit 5"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -766,6 +754,7 @@ mod tests { true, None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to insert a document successfully"); @@ -785,6 +774,7 @@ mod tests { true, None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); } @@ -838,15 +828,17 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); let added_bytes = fee_result.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); - // We added 1557 bytes - assert_eq!(added_bytes, 1557); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); + // We added 1559 bytes + assert_eq!(added_bytes, 1559); let document_id = bs58::decode("AM47xnyLfTAC9f61ZQPGfMK5Datk2FeYZwgYvcAnzqFY") .into_vec() @@ -865,6 +857,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); @@ -875,14 +868,15 @@ mod tests { .get(&0) .unwrap(); - assert_eq!(*removed_credits, 41827688); + assert_eq!(*removed_credits, 41881536); let refund_equivalent_bytes = removed_credits.to_unsigned() - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); assert!(added_bytes > refund_equivalent_bytes); - assert_eq!(refund_equivalent_bytes, 1549); // we refunded 1549 instead of 1556 + assert_eq!(refund_equivalent_bytes, 1551); // we refunded 1551 instead of 1559 } #[test] @@ -934,15 +928,17 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); let added_bytes = fee_result.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); - // We added 1553 bytes - assert_eq!(added_bytes, 1557); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); + // We added 1558 bytes + assert_eq!(added_bytes, 1559); let document_id = bs58::decode("AM47xnyLfTAC9f61ZQPGfMK5Datk2FeYZwgYvcAnzqFY") .into_vec() @@ -961,11 +957,12 @@ mod tests { false, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to be able to delete the document"); assert!(fee_result.fee_refunds.0.is_empty()); assert_eq!(fee_result.storage_fee, 0); - assert_eq!(fee_result.processing_fee, 145470580); + assert_eq!(fee_result.processing_fee, 71994700); } } diff --git a/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/mod.rs index 1dd989ae6aa..f4d46a63f80 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/mod.rs @@ -3,9 +3,10 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -28,7 +29,7 @@ impl Drive { /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. pub(in crate::drive::document) fn remove_document_from_primary_storage( &self, - document_id: [u8; 32], + document_id: Identifier, document_type: DocumentTypeRef, contract_documents_primary_key_path: [&[u8]; 5], estimated_costs_only_with_layer_info: &mut Option< diff --git a/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs index fe7bf90602a..b3ea51c398a 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs @@ -6,24 +6,27 @@ use dpp::data_contract::document_type::DocumentTypeRef; use std::collections::HashMap; -use crate::drive::grove_operations::BatchDeleteApplyType::{ +use crate::util::grove_operations::BatchDeleteApplyType::{ StatefulBatchDelete, StatelessBatchDelete, }; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::identifier::Identifier; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U32; use dpp::version::PlatformVersion; impl Drive { /// Removes the document from primary storage. + #[inline(always)] pub(super) fn remove_document_from_primary_storage_v0( &self, - document_id: [u8; 32], + document_id: Identifier, document_type: DocumentTypeRef, contract_documents_primary_key_path: [&[u8]; 5], estimated_costs_only_with_layer_info: &mut Option< @@ -36,6 +39,7 @@ impl Drive { let apply_type = if estimated_costs_only_with_layer_info.is_some() { StatelessBatchDelete { is_sum_tree: false, + estimated_key_size: DEFAULT_HASH_SIZE_U32, estimated_value_size: document_type.estimated_size(platform_version)? as u32, } } else { diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/mod.rs index 02f0dd41834..a10973b5714 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/mod.rs @@ -1,11 +1,11 @@ mod v0; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentAndContractInfo; -use crate::drive::object_size_info::PathInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; +use crate::util::object_size_info::PathInfo; +use crate::util::storage_flags::StorageFlags; use dpp::data_contract::document_type::IndexLevel; @@ -39,6 +39,7 @@ impl Drive { index_path_info: PathInfo<0>, index_level: &IndexLevel, any_fields_null: bool, + all_fields_null: bool, storage_flags: &Option<&StorageFlags>, previous_batch_operations: &Option<&mut Vec>, estimated_costs_only_with_layer_info: &mut Option< @@ -61,6 +62,7 @@ impl Drive { index_path_info, index_level, any_fields_null, + all_fields_null, storage_flags, previous_batch_operations, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs index 2ddce191d56..6ad033a0f41 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -9,29 +9,31 @@ use dpp::data_contract::document_type::IndexLevel; use grovedb::EstimatedSumTrees::NoSumTrees; use std::collections::HashMap; -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; -use crate::drive::object_size_info::DriveKeyInfo::KeyRef; +use crate::util::object_size_info::DriveKeyInfo::KeyRef; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::drive::Drive; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::error::fee::FeeError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; impl Drive { /// Removes indices for an index level and recurses. + #[inline] pub(super) fn remove_indices_for_index_level_for_contract_operations_v0( &self, document_and_contract_info: &DocumentAndContractInfo, index_path_info: PathInfo<0>, index_level: &IndexLevel, mut any_fields_null: bool, + mut all_fields_null: bool, storage_flags: &Option<&StorageFlags>, previous_batch_operations: &Option<&mut Vec>, estimated_costs_only_with_layer_info: &mut Option< @@ -60,12 +62,13 @@ impl Drive { ); } - if let Some(unique) = index_level.has_index_with_uniqueness() { + if let Some(index_type) = index_level.has_index_with_type() { self.remove_reference_for_index_level_for_contract_operations( document_and_contract_info, index_path_info.clone(), - unique, + index_type, any_fields_null, + all_fields_null, storage_flags, previous_batch_operations, estimated_costs_only_with_layer_info, @@ -128,16 +131,18 @@ impl Drive { // Iteration 2. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId//accountReference any_fields_null |= document_index_field.is_empty(); + all_fields_null &= document_index_field.is_empty(); // we push the actual value of the index path sub_level_index_path_info.push(document_index_field)?; // Iteration 1. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId// // Iteration 2. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId//accountReference/ - self.remove_indices_for_index_level_for_contract_operations( + self.remove_indices_for_index_level_for_contract_operations_v0( document_and_contract_info, sub_level_index_path_info, sub_level, any_fields_null, + all_fields_null, storage_flags, previous_batch_operations, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/mod.rs index bdf3eaf6738..c22ab61d614 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/mod.rs @@ -1,12 +1,12 @@ mod v0; -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; +use crate::util::object_size_info::DocumentAndContractInfo; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs index dbc171c0988..332e9214519 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs @@ -7,24 +7,26 @@ use grovedb::{EstimatedLayerInformation, TransactionArg}; use grovedb::EstimatedSumTrees::NoSumTrees; use std::collections::HashMap; -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; -use crate::drive::document::{contract_document_type_path_vec, unique_event_id}; +use crate::drive::document::unique_event_id; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::drive::Drive; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::error::fee::FeeError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::config::v0::DataContractConfigGettersV0; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::drive::document::paths::contract_document_type_path_vec; use dpp::version::PlatformVersion; impl Drive { /// Removes indices for the top index level and calls for lower levels. + #[inline(always)] pub(super) fn remove_indices_for_top_index_level_for_contract_operations_v0( &self, document_and_contract_info: &DocumentAndContractInfo, @@ -129,6 +131,7 @@ impl Drive { } let any_fields_null = document_top_field.is_empty(); + let all_fields_null = document_top_field.is_empty(); let mut index_path_info = if document_and_contract_info .owned_document_info @@ -138,7 +141,7 @@ impl Drive { // This is a stateless operation PathInfo::PathWithSizes(KeyInfoPath::from_known_owned_path(index_path)) } else { - PathInfo::PathIterator::<0>(index_path) + PathInfo::PathAsVec::<0>(index_path) }; // we push the actual value of the index path @@ -150,6 +153,7 @@ impl Drive { index_path_info, sub_level, any_fields_null, + all_fields_null, &storage_flags, previous_batch_operations, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/mod.rs index c8fc6e335f9..bf35d3504cf 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/mod.rs @@ -1,16 +1,17 @@ mod v0; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::{DocumentAndContractInfo, PathInfo}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::{DocumentAndContractInfo, PathInfo}; +use crate::util::storage_flags::StorageFlags; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; +use dpp::data_contract::document_type::IndexLevelTypeInfo; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; @@ -37,8 +38,9 @@ impl Drive { &self, document_and_contract_info: &DocumentAndContractInfo, index_path_info: PathInfo<0>, - unique: bool, + index_type: IndexLevelTypeInfo, any_fields_null: bool, + all_fields_null: bool, storage_flags: &Option<&StorageFlags>, previous_batch_operations: &Option<&mut Vec>, estimated_costs_only_with_layer_info: &mut Option< @@ -59,8 +61,9 @@ impl Drive { 0 => self.remove_reference_for_index_level_for_contract_operations_v0( document_and_contract_info, index_path_info, - unique, + index_type, any_fields_null, + all_fields_null, storage_flags, previous_batch_operations, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs index ea6ce25248d..0ee9619ac03 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs @@ -5,29 +5,34 @@ use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; use grovedb::EstimatedLayerSizes::{AllReference, AllSubtrees}; use grovedb::{EstimatedLayerInformation, TransactionArg}; +use dpp::data_contract::document_type::IndexLevelTypeInfo; +use dpp::data_contract::document_type::IndexType::{ContestedResourceIndex, NonUniqueIndex}; use grovedb::EstimatedSumTrees::NoSumTrees; use std::collections::HashMap; -use crate::drive::defaults::{CONTRACT_DOCUMENTS_PATH_HEIGHT, DEFAULT_HASH_SIZE_U8}; +use crate::drive::constants::CONTRACT_DOCUMENTS_PATH_HEIGHT; use crate::drive::document::document_reference_size; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::drive::Drive; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use dpp::version::PlatformVersion; impl Drive { /// Removes the terminal reference. + #[inline(always)] pub(super) fn remove_reference_for_index_level_for_contract_operations_v0( &self, document_and_contract_info: &DocumentAndContractInfo, index_path_info: PathInfo<0>, - unique: bool, + index_type: IndexLevelTypeInfo, any_fields_null: bool, + all_fields_null: bool, storage_flags: &Option<&StorageFlags>, previous_batch_operations: &Option<&mut Vec>, estimated_costs_only_with_layer_info: &mut Option< @@ -38,13 +43,19 @@ impl Drive { batch_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), Error> { + if all_fields_null && !index_type.should_insert_with_all_null { + return Ok(()); + } let mut key_info_path = index_path_info.convert_to_key_info_path(); let document_type = document_and_contract_info.document_type; // unique indexes will be stored under key "0" // non unique indices should have a tree at key "0" that has all elements based off of primary key - if !unique || any_fields_null { + if index_type.index_type == NonUniqueIndex + || index_type.index_type == ContestedResourceIndex + || any_fields_null + { key_info_path.push(KnownKey(vec![0])); if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/mod.rs new file mode 100644 index 00000000000..6cb78e48f5a --- /dev/null +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/mod.rs @@ -0,0 +1,67 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::object_size_info::DocumentAndContractInfo; +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerInformation; +use std::collections::HashMap; + +mod v0; + +impl Drive { + /// Adds estimated storage costs for adding a document to primary storage based on platform version. + /// + /// This function uses the platform version to determine the appropriate method to estimate storage costs + /// for adding a document to the primary storage. Currently, it supports version `0` and delegates the estimation + /// to `add_estimation_costs_for_add_document_to_primary_storage_v0`. + /// + /// If an unsupported version is provided, an error indicating a version mismatch will be returned. + /// + /// # Arguments + /// * `document_and_contract_info`: Information about the document and its associated contract. + /// * `primary_key_path`: Key path where the document should be stored in primary storage. + /// * `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap where the estimated layer + /// information will be stored for the given key path. + /// * `platform_version`: Version of the platform being used, which determines the estimation method. + /// + /// # Returns + /// * `Result<(), Error>`: Returns `Ok(())` if the operation succeeds. Returns an `Error` if the provided platform + /// version method is unsupported or if there's any other issue. + /// + /// # Errors + /// * `DriveError::UnknownVersionMismatch`: Returned if the platform version method specified is unsupported. + /// + /// # Panics + /// This function will not panic under normal circumstances. However, unexpected behavior may result + /// from incorrect arguments or unforeseen edge cases. + pub(crate) fn add_estimation_costs_for_add_contested_document_to_primary_storage< + const N: usize, + >( + document_and_contract_info: &DocumentAndContractInfo, + primary_key_path: [&[u8]; N], + estimated_costs_only_with_layer_info: &mut HashMap, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .document + .estimation_costs + .add_estimation_costs_for_add_contested_document_to_primary_storage + { + 0 => Self::add_estimation_costs_for_add_contested_document_to_primary_storage_v0( + document_and_contract_info, + primary_key_path, + estimated_costs_only_with_layer_info, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "Drive::add_estimation_costs_for_add_contested_document_to_primary_storage" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs new file mode 100644 index 00000000000..3de9414bc08 --- /dev/null +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs @@ -0,0 +1,91 @@ +use crate::drive::constants::{AVERAGE_NUMBER_OF_UPDATES, AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE}; +use crate::util::storage_flags::StorageFlags; + +use crate::drive::Drive; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods}; + +use crate::error::Error; + +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::AllItems; + +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; +use std::collections::HashMap; + +impl Drive { + /// Adds estimated storage costs for adding a document to primary storage. + /// + /// This function computes and updates the expected costs associated with storing + /// a document in primary storage. Depending on the type and history preservation + /// properties of the document, the costs are determined differently. + /// + /// - If the document type retains history, the function will account for costs + /// associated with trees and potential flags for deletion. + /// - Otherwise, the function will only account for the cost of storing the elements. + /// + /// # Arguments + /// * `document_and_contract_info`: Information about the document and its associated contract. + /// * `primary_key_path`: Key path where the document should be stored in primary storage. + /// * `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap where the estimated layer + /// information will be stored for the given key path. + /// * `platform_version`: Version of the platform being used, potentially affecting some estimates. + /// + /// # Returns + /// * `Result<(), Error>`: Returns `Ok(())` if the operation succeeds, otherwise it returns an `Error`. + /// + /// # Errors + /// This function might return an `Error` if there's a problem estimating the document's size for the + /// given platform version. + /// + /// # Panics + /// This function will not panic under normal circumstances. However, unexpected behavior may result + /// from incorrect arguments or unforeseen edge cases. + #[inline(always)] + pub(super) fn add_estimation_costs_for_add_contested_document_to_primary_storage_v0< + const N: usize, + >( + document_and_contract_info: &DocumentAndContractInfo, + primary_key_path: [&[u8]; N], + estimated_costs_only_with_layer_info: &mut HashMap, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + if document_and_contract_info + .owned_document_info + .document_info + .get_borrowed_document() + .is_none() + { + return Ok(()); + }; + let document_type = document_and_contract_info.document_type; + // we just have the elements + let approximate_size = if document_type.documents_mutable() { + //todo: have the contract say how often we expect documents to mutate + Some(( + AVERAGE_NUMBER_OF_UPDATES as u16, + AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE, + )) + } else { + None + }; + let flags_size = StorageFlags::approximate_size(true, approximate_size); + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(primary_key_path), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllItems( + DEFAULT_HASH_SIZE_U8, + document_type.estimated_size(platform_version)? as u32, + Some(flags_size), + ), + }, + ); + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/mod.rs index 5c4662c28fb..7fb0e137506 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/mod.rs @@ -1,7 +1,7 @@ -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::object_size_info::DocumentAndContractInfo; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerInformation; @@ -55,7 +55,7 @@ impl Drive { platform_version, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "Drive::add_estimation_costs_for_add_document_to_primary_storage_v0" + method: "Drive::add_estimation_costs_for_add_document_to_primary_storage" .to_string(), known_versions: vec![0], received: version, diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs index 6ca6efccd22..a43d53d1bfc 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs @@ -1,12 +1,9 @@ -use crate::drive::defaults::{ - AVERAGE_NUMBER_OF_UPDATES, AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE, DEFAULT_FLOAT_SIZE, - DEFAULT_FLOAT_SIZE_U8, DEFAULT_HASH_SIZE_U8, -}; -use crate::drive::document::contract_documents_keeping_history_primary_key_path_for_document_id; -use crate::drive::flags::StorageFlags; +use crate::drive::constants::{AVERAGE_NUMBER_OF_UPDATES, AVERAGE_UPDATE_BYTE_COUNT_REQUIRED_SIZE}; +use crate::drive::document::paths::contract_documents_keeping_history_primary_key_path_for_document_id; +use crate::util::storage_flags::StorageFlags; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods}; use crate::drive::Drive; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods}; use crate::error::Error; @@ -22,6 +19,9 @@ use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees, Mix}; use grovedb::EstimatedSumTrees::NoSumTrees; +use crate::util::type_constants::{ + DEFAULT_FLOAT_SIZE, DEFAULT_FLOAT_SIZE_U8, DEFAULT_HASH_SIZE_U8, +}; use std::collections::HashMap; impl Drive { @@ -52,6 +52,7 @@ impl Drive { /// # Panics /// This function will not panic under normal circumstances. However, unexpected behavior may result /// from incorrect arguments or unforeseen edge cases. + #[inline(always)] pub(super) fn add_estimation_costs_for_add_document_to_primary_storage_v0( document_and_contract_info: &DocumentAndContractInfo, primary_key_path: [&[u8]; 5], diff --git a/packages/rs-drive/src/drive/document/estimation_costs/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/mod.rs index 51c40696624..7831d471846 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/mod.rs @@ -1,5 +1,5 @@ mod stateless_delete_of_non_tree_for_costs; -pub use stateless_delete_of_non_tree_for_costs::*; mod add_estimation_costs_for_add_document_to_primary_storage; -pub use add_estimation_costs_for_add_document_to_primary_storage::*; + +mod add_estimation_costs_for_add_contested_document_to_primary_storage; diff --git a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs index 70de4c9c3f9..4d8a852d845 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs @@ -1,6 +1,6 @@ mod v0; -use crate::drive::grove_operations::{BatchDeleteUpTreeApplyType, IsSubTree, IsSumSubTree}; +use crate::util::grove_operations::{BatchDeleteUpTreeApplyType, IsSubTree, IsSumSubTree}; use crate::drive::Drive; diff --git a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs index ac6330292bf..7d70f79819e 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs @@ -1,6 +1,6 @@ -use crate::drive::defaults::CONTRACT_DOCUMENTS_PATH_HEIGHT; +use crate::drive::constants::CONTRACT_DOCUMENTS_PATH_HEIGHT; -use crate::drive::grove_operations::{BatchDeleteUpTreeApplyType, IsSubTree, IsSumSubTree}; +use crate::util::grove_operations::{BatchDeleteUpTreeApplyType, IsSubTree, IsSumSubTree}; use crate::drive::Drive; use crate::error::fee::FeeError; @@ -37,6 +37,7 @@ impl Drive { /// # Errors /// Returns an `Error::Fee(FeeError::CorruptedEstimatedLayerInfoMissing)` if the required layer /// information is missing in the provided estimated costs. + #[inline(always)] pub(super) fn stateless_delete_of_non_tree_for_costs_v0( element_estimated_sizes: EstimatedLayerSizes, key_info_path: &KeyInfoPath, diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/mod.rs index f3fd6babb4e..32823a82e9c 100644 --- a/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/mod.rs +++ b/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/mod.rs @@ -9,9 +9,9 @@ use dpp::data_contract::DataContract; use dpp::identifier::Identifier; use dpp::platform_value::Value; -use dpp::prelude::TimestampMillis; -use dpp::validation::SimpleConsensusValidationResult; +use dpp::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; +use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; use grovedb::TransactionArg; use std::collections::BTreeMap; @@ -40,6 +40,20 @@ pub(in crate::drive::document::index_uniqueness) struct UniquenessOfDataRequest< pub created_at: Option, /// Optional timestamp indicating the last time the document was updated. pub updated_at: Option, + /// Optional timestamp indicating the last time the document was transferred. + pub transferred_at: Option, + /// Optional timestamp indicating the block height at which the document was created. + pub created_at_block_height: Option, + /// Optional timestamp indicating the last block height the document was updated. + pub updated_at_block_height: Option, + /// Optional timestamp indicating the last block height the document was transferred. + pub transferred_at_block_height: Option, + /// Optional timestamp indicating the core height at which the document was created. + pub created_at_core_block_height: Option, + /// Optional timestamp indicating the last core block height the document was updated. + pub updated_at_core_block_height: Option, + /// Optional timestamp indicating the last core block height the document was transferred. + pub transferred_at_core_block_height: Option, /// The actual data to be checked for uniqueness, represented as a mapping. pub data: &'a BTreeMap, } diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/v0/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/v0/mod.rs index 021a3fe4f5d..dab9fd17703 100644 --- a/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/index_uniqueness/internal/validate_uniqueness_of_data/v0/mod.rs @@ -3,11 +3,11 @@ use crate::drive::Drive; use crate::drive::document::index_uniqueness::internal::validate_uniqueness_of_data::UniquenessOfDataRequest; use crate::drive::document::query::QueryDocumentsOutcomeV0Methods; use crate::error::Error; -use crate::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; +use crate::query::{DriveDocumentQuery, InternalClauses, WhereClause, WhereOperator}; use dpp::consensus::state::document::duplicate_unique_index_error::DuplicateUniqueIndexError; use dpp::consensus::state::state_error::StateError; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::document::DocumentV0Getters; +use dpp::document::{property_names, DocumentV0Getters}; use dpp::platform_value::platform_value; use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; @@ -34,6 +34,7 @@ impl Drive { /// /// * Contains a validation result indicating if the data is unique or not, or /// * An error that occurred during the operation. + #[inline(always)] pub(super) fn validate_uniqueness_of_data_v0( &self, request: UniquenessOfDataRequest, @@ -48,15 +49,22 @@ impl Drive { allow_original, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, data, } = request; let validation_results = document_type - .indices() - .iter() + .indexes() + .values() .filter_map(|index| { if !index.unique { - // if a index is not unique there is no issue + // if an index is not unique there is no issue None } else { let where_queries = index @@ -64,24 +72,80 @@ impl Drive { .iter() .filter_map(|property| { let value = match property.name.as_str() { - "$ownerId" => { + property_names::OWNER_ID => { platform_value!(owner_id) } - "$createdAt" => { + property_names::CREATED_AT => { if let Some(created_at) = created_at { platform_value!(created_at) } else { return None; } } - "$updatedAt" => { + property_names::UPDATED_AT => { if let Some(updated_at) = updated_at { platform_value!(updated_at) } else { return None; } } - + property_names::TRANSFERRED_AT => { + if let Some(transferred_at) = transferred_at { + platform_value!(transferred_at) + } else { + return None; + } + } + property_names::CREATED_AT_BLOCK_HEIGHT => { + if let Some(created_at_block_height) = created_at_block_height { + platform_value!(created_at_block_height) + } else { + return None; + } + } + property_names::UPDATED_AT_BLOCK_HEIGHT => { + if let Some(updated_at_block_height) = updated_at_block_height { + platform_value!(updated_at_block_height) + } else { + return None; + } + } + property_names::TRANSFERRED_AT_BLOCK_HEIGHT => { + if let Some(transferred_at_block_height) = + transferred_at_block_height + { + platform_value!(transferred_at_block_height) + } else { + return None; + } + } + property_names::CREATED_AT_CORE_BLOCK_HEIGHT => { + if let Some(created_at_core_block_height) = + created_at_core_block_height + { + platform_value!(created_at_core_block_height) + } else { + return None; + } + } + property_names::UPDATED_AT_CORE_BLOCK_HEIGHT => { + if let Some(updated_at_core_block_height) = + updated_at_core_block_height + { + platform_value!(updated_at_core_block_height) + } else { + return None; + } + } + property_names::TRANSFERRED_AT_CORE_BLOCK_HEIGHT => { + if let Some(transferred_at_core_block_height) = + transferred_at_core_block_height + { + platform_value!(transferred_at_core_block_height) + } else { + return None; + } + } _ => { if let Some(value) = data.get(property.name.as_str()) { value.clone() @@ -105,7 +169,7 @@ impl Drive { // there are empty fields, which means that the index is no longer unique None } else { - let query = DriveQuery { + let query = DriveDocumentQuery { contract, document_type, internal_clauses: InternalClauses { diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/mod.rs index 0a35800771d..e5dac3fa3ea 100644 --- a/packages/rs-drive/src/drive/document/index_uniqueness/mod.rs +++ b/packages/rs-drive/src/drive/document/index_uniqueness/mod.rs @@ -36,8 +36,10 @@ mod internal; mod validate_document_create_transition_action_uniqueness; -pub use validate_document_create_transition_action_uniqueness::*; + mod validate_document_replace_transition_action_uniqueness; -pub use validate_document_replace_transition_action_uniqueness::*; + +mod validate_document_purchase_transition_action_uniqueness; +mod validate_document_transfer_transition_action_uniqueness; mod validate_document_uniqueness; -pub use validate_document_uniqueness::*; +mod validate_document_update_price_transition_action_uniqueness; diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_create_transition_action_uniqueness/v0/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_create_transition_action_uniqueness/v0/mod.rs index f0a5a72c86b..5f9c96d1ab5 100644 --- a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_create_transition_action_uniqueness/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_create_transition_action_uniqueness/v0/mod.rs @@ -11,6 +11,12 @@ use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; use grovedb::TransactionArg; use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; @@ -19,6 +25,7 @@ use dpp::version::PlatformVersion; impl Drive { /// Validate that a document create transition action would be unique in the state + #[inline(always)] pub(super) fn validate_document_create_transition_action_uniqueness_v0( &self, contract: &DataContract, @@ -28,14 +35,77 @@ impl Drive { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { + let required_fields = document_type.required_fields(); + + let is_created_at_required = required_fields.contains(CREATED_AT); + let is_updated_at_required = required_fields.contains(UPDATED_AT); + let is_transferred_at_required = required_fields.contains(TRANSFERRED_AT); + + let is_created_at_block_height_required = required_fields.contains(CREATED_AT_BLOCK_HEIGHT); + let is_updated_at_block_height_required = required_fields.contains(UPDATED_AT_BLOCK_HEIGHT); + let is_transferred_at_block_height_required = + required_fields.contains(TRANSFERRED_AT_BLOCK_HEIGHT); + + let is_created_at_core_block_height_required = + required_fields.contains(CREATED_AT_CORE_BLOCK_HEIGHT); + let is_updated_at_core_block_height_required = + required_fields.contains(UPDATED_AT_CORE_BLOCK_HEIGHT); + let is_transferred_at_core_block_height_required = + required_fields.contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT); + + let block_info = document_create_transition.block_info(); + let request = UniquenessOfDataRequest { contract, document_type, owner_id, document_id: document_create_transition.base().id(), allow_original: false, - created_at: document_create_transition.created_at(), - updated_at: document_create_transition.updated_at(), + created_at: if is_created_at_required { + Some(block_info.time_ms) + } else { + None + }, + updated_at: if is_updated_at_required { + Some(block_info.time_ms) + } else { + None + }, + transferred_at: if is_transferred_at_required { + Some(block_info.time_ms) + } else { + None + }, + created_at_block_height: if is_created_at_block_height_required { + Some(block_info.height) + } else { + None + }, + updated_at_block_height: if is_updated_at_block_height_required { + Some(block_info.height) + } else { + None + }, + transferred_at_block_height: if is_transferred_at_block_height_required { + Some(block_info.height) + } else { + None + }, + created_at_core_block_height: if is_created_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, + updated_at_core_block_height: if is_updated_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, + transferred_at_core_block_height: if is_transferred_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, data: document_create_transition.data(), }; self.validate_uniqueness_of_data(request, transaction, platform_version) diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/mod.rs new file mode 100644 index 00000000000..a4e3bc9d05c --- /dev/null +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/mod.rs @@ -0,0 +1,70 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; + +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; + +use grovedb::TransactionArg; + +use crate::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionAction; +use dpp::version::PlatformVersion; + +impl Drive { + /// Validate that a document purchase transition action would be unique in the state. + /// + /// # Arguments + /// + /// * `contract` - A `DataContract` object representing the contract. + /// * `document_type` - A `DocumentType` object representing the type of the document. + /// * `document_purchase_transition` - A `DocumentPurchaseTransitionAction` object representing the document purchase transition action. + /// * `owner_id` - An `Identifier` object representing the owner's ID. + /// * `transaction` - A `TransactionArg` object representing the transaction. + /// * `drive_version` - A `DriveVersion` object representing the version of the Drive. + /// + /// # Returns + /// + /// * `Result` - If successful, returns a `SimpleConsensusValidationResult` object representing the result of the validation. + /// If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of the Drive is unknown. + pub fn validate_document_purchase_transition_action_uniqueness( + &self, + contract: &DataContract, + document_type: DocumentTypeRef, + document_purchase_transition: &DocumentPurchaseTransitionAction, + owner_id: Identifier, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .document + .index_uniqueness + .validate_document_purchase_transition_action_uniqueness + { + 0 => self.validate_document_purchase_transition_action_uniqueness_v0( + contract, + document_type, + document_purchase_transition, + owner_id, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "validate_document_purchase_transition_action_uniqueness".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/v0/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/v0/mod.rs new file mode 100644 index 00000000000..a9673724cfc --- /dev/null +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/v0/mod.rs @@ -0,0 +1,64 @@ +use dpp::data_contract::DataContract; + +use crate::drive::Drive; + +use crate::drive::document::index_uniqueness::internal::validate_uniqueness_of_data::UniquenessOfDataRequest; +use crate::error::Error; + +use dpp::data_contract::document_type::DocumentTypeRef; + +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; + +use dpp::document::DocumentV0Getters; +use grovedb::TransactionArg; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; + +impl Drive { + /// Validate that a document purchase transition action would be unique in the state + #[inline(always)] + pub(super) fn validate_document_purchase_transition_action_uniqueness_v0( + &self, + contract: &DataContract, + document_type: DocumentTypeRef, + document_purchase_transition: &DocumentPurchaseTransitionAction, + owner_id: Identifier, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let request = UniquenessOfDataRequest { + contract, + document_type, + owner_id, + document_id: document_purchase_transition.base().id(), + allow_original: true, + created_at: document_purchase_transition.document().created_at(), + updated_at: document_purchase_transition.document().updated_at(), + transferred_at: document_purchase_transition.document().transferred_at(), + created_at_block_height: document_purchase_transition + .document() + .created_at_block_height(), + updated_at_block_height: document_purchase_transition + .document() + .updated_at_block_height(), + transferred_at_block_height: document_purchase_transition + .document() + .transferred_at_block_height(), + created_at_core_block_height: document_purchase_transition + .document() + .created_at_core_block_height(), + updated_at_core_block_height: document_purchase_transition + .document() + .updated_at_core_block_height(), + transferred_at_core_block_height: document_purchase_transition + .document() + .transferred_at_core_block_height(), + data: document_purchase_transition.document().properties(), + }; + self.validate_uniqueness_of_data(request, transaction, platform_version) + } +} diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_replace_transition_action_uniqueness/v0/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_replace_transition_action_uniqueness/v0/mod.rs index e36ec5925d1..8930e78be5c 100644 --- a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_replace_transition_action_uniqueness/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_replace_transition_action_uniqueness/v0/mod.rs @@ -19,6 +19,7 @@ use dpp::version::PlatformVersion; impl Drive { /// Validate that a document replace transition action would be unique in the state + #[inline(always)] pub(super) fn validate_document_replace_transition_action_uniqueness_v0( &self, contract: &DataContract, @@ -36,6 +37,16 @@ impl Drive { allow_original: true, created_at: document_replace_transition.created_at(), updated_at: document_replace_transition.updated_at(), + transferred_at: document_replace_transition.transferred_at(), + created_at_block_height: document_replace_transition.created_at_block_height(), + updated_at_block_height: document_replace_transition.updated_at_block_height(), + transferred_at_block_height: document_replace_transition.transferred_at_block_height(), + created_at_core_block_height: document_replace_transition + .created_at_core_block_height(), + updated_at_core_block_height: document_replace_transition + .updated_at_core_block_height(), + transferred_at_core_block_height: document_replace_transition + .transferred_at_core_block_height(), data: document_replace_transition.data(), }; self.validate_uniqueness_of_data(request, transaction, platform_version) diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_transfer_transition_action_uniqueness/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_transfer_transition_action_uniqueness/mod.rs new file mode 100644 index 00000000000..b72f8d55ae2 --- /dev/null +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_transfer_transition_action_uniqueness/mod.rs @@ -0,0 +1,70 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; + +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; + +use grovedb::TransactionArg; + +use crate::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::DocumentTransferTransitionAction; +use dpp::version::PlatformVersion; + +impl Drive { + /// Validate that a document transfer transition action would be unique in the state. + /// + /// # Arguments + /// + /// * `contract` - A `DataContract` object representing the contract. + /// * `document_type` - A `DocumentType` object representing the type of the document. + /// * `document_transfer_transition` - A `DocumentTransferTransitionAction` object representing the document transfer transition action. + /// * `owner_id` - An `Identifier` object representing the owner's ID. + /// * `transaction` - A `TransactionArg` object representing the transaction. + /// * `drive_version` - A `DriveVersion` object representing the version of the Drive. + /// + /// # Returns + /// + /// * `Result` - If successful, returns a `SimpleConsensusValidationResult` object representing the result of the validation. + /// If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of the Drive is unknown. + pub fn validate_document_transfer_transition_action_uniqueness( + &self, + contract: &DataContract, + document_type: DocumentTypeRef, + document_transfer_transition: &DocumentTransferTransitionAction, + owner_id: Identifier, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .document + .index_uniqueness + .validate_document_transfer_transition_action_uniqueness + { + 0 => self.validate_document_transfer_transition_action_uniqueness_v0( + contract, + document_type, + document_transfer_transition, + owner_id, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "validate_document_transfer_transition_action_uniqueness".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_transfer_transition_action_uniqueness/v0/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_transfer_transition_action_uniqueness/v0/mod.rs new file mode 100644 index 00000000000..a4a2551716c --- /dev/null +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_transfer_transition_action_uniqueness/v0/mod.rs @@ -0,0 +1,64 @@ +use dpp::data_contract::DataContract; + +use crate::drive::Drive; + +use crate::drive::document::index_uniqueness::internal::validate_uniqueness_of_data::UniquenessOfDataRequest; +use crate::error::Error; + +use dpp::data_contract::document_type::DocumentTypeRef; + +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; + +use dpp::document::DocumentV0Getters; +use grovedb::TransactionArg; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; + +impl Drive { + /// Validate that a document transfer transition action would be unique in the state + #[inline(always)] + pub(super) fn validate_document_transfer_transition_action_uniqueness_v0( + &self, + contract: &DataContract, + document_type: DocumentTypeRef, + document_transfer_transition: &DocumentTransferTransitionAction, + owner_id: Identifier, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let request = UniquenessOfDataRequest { + contract, + document_type, + owner_id, + document_id: document_transfer_transition.base().id(), + allow_original: true, + created_at: document_transfer_transition.document().created_at(), + updated_at: document_transfer_transition.document().updated_at(), + transferred_at: document_transfer_transition.document().transferred_at(), + created_at_block_height: document_transfer_transition + .document() + .created_at_block_height(), + updated_at_block_height: document_transfer_transition + .document() + .updated_at_block_height(), + transferred_at_block_height: document_transfer_transition + .document() + .transferred_at_block_height(), + created_at_core_block_height: document_transfer_transition + .document() + .created_at_core_block_height(), + updated_at_core_block_height: document_transfer_transition + .document() + .updated_at_core_block_height(), + transferred_at_core_block_height: document_transfer_transition + .document() + .transferred_at_core_block_height(), + data: document_transfer_transition.document().properties(), + }; + self.validate_uniqueness_of_data(request, transaction, platform_version) + } +} diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_uniqueness/v0/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_uniqueness/v0/mod.rs index eff788a31dc..b4e6e8a8f38 100644 --- a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_uniqueness/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_uniqueness/v0/mod.rs @@ -16,6 +16,7 @@ use grovedb::TransactionArg; impl Drive { /// Validate that a document would be unique in the state + #[inline(always)] pub(super) fn validate_document_uniqueness_v0( &self, contract: &DataContract, @@ -34,6 +35,13 @@ impl Drive { allow_original, created_at: document.created_at(), updated_at: document.updated_at(), + transferred_at: document.transferred_at(), + created_at_block_height: document.created_at_block_height(), + updated_at_block_height: document.updated_at_block_height(), + transferred_at_block_height: document.transferred_at_block_height(), + created_at_core_block_height: document.created_at_core_block_height(), + updated_at_core_block_height: document.updated_at_core_block_height(), + transferred_at_core_block_height: document.transferred_at_core_block_height(), data: document.properties(), }; self.validate_uniqueness_of_data(request, transaction, platform_version) diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_update_price_transition_action_uniqueness/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_update_price_transition_action_uniqueness/mod.rs new file mode 100644 index 00000000000..6d412a95ab8 --- /dev/null +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_update_price_transition_action_uniqueness/mod.rs @@ -0,0 +1,70 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; + +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; + +use grovedb::TransactionArg; + +use crate::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::DocumentUpdatePriceTransitionAction; +use dpp::version::PlatformVersion; + +impl Drive { + /// Validate that a document update_price transition action would be unique in the state. + /// + /// # Arguments + /// + /// * `contract` - A `DataContract` object representing the contract. + /// * `document_type` - A `DocumentType` object representing the type of the document. + /// * `document_update_price_transition` - A `DocumentUpdatePriceTransitionAction` object representing the document update_price transition action. + /// * `owner_id` - An `Identifier` object representing the owner's ID. + /// * `transaction` - A `TransactionArg` object representing the transaction. + /// * `drive_version` - A `DriveVersion` object representing the version of the Drive. + /// + /// # Returns + /// + /// * `Result` - If successful, returns a `SimpleConsensusValidationResult` object representing the result of the validation. + /// If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of the Drive is unknown. + pub fn validate_document_update_price_transition_action_uniqueness( + &self, + contract: &DataContract, + document_type: DocumentTypeRef, + document_update_price_transition: &DocumentUpdatePriceTransitionAction, + owner_id: Identifier, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .document + .index_uniqueness + .validate_document_update_price_transition_action_uniqueness + { + 0 => self.validate_document_update_price_transition_action_uniqueness_v0( + contract, + document_type, + document_update_price_transition, + owner_id, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "validate_document_update_price_transition_action_uniqueness".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_update_price_transition_action_uniqueness/v0/mod.rs b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_update_price_transition_action_uniqueness/v0/mod.rs new file mode 100644 index 00000000000..21b3d94564d --- /dev/null +++ b/packages/rs-drive/src/drive/document/index_uniqueness/validate_document_update_price_transition_action_uniqueness/v0/mod.rs @@ -0,0 +1,64 @@ +use dpp::data_contract::DataContract; + +use crate::drive::Drive; + +use crate::drive::document::index_uniqueness::internal::validate_uniqueness_of_data::UniquenessOfDataRequest; +use crate::error::Error; + +use dpp::data_contract::document_type::DocumentTypeRef; + +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; + +use dpp::document::DocumentV0Getters; +use grovedb::TransactionArg; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; + +impl Drive { + /// Validate that a document update_price transition action would be unique in the state + #[inline(always)] + pub(super) fn validate_document_update_price_transition_action_uniqueness_v0( + &self, + contract: &DataContract, + document_type: DocumentTypeRef, + document_update_price_transition: &DocumentUpdatePriceTransitionAction, + owner_id: Identifier, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let request = UniquenessOfDataRequest { + contract, + document_type, + owner_id, + document_id: document_update_price_transition.base().id(), + allow_original: true, + created_at: document_update_price_transition.document().created_at(), + updated_at: document_update_price_transition.document().updated_at(), + transferred_at: document_update_price_transition.document().transferred_at(), + created_at_block_height: document_update_price_transition + .document() + .created_at_block_height(), + updated_at_block_height: document_update_price_transition + .document() + .updated_at_block_height(), + transferred_at_block_height: document_update_price_transition + .document() + .transferred_at_block_height(), + created_at_core_block_height: document_update_price_transition + .document() + .created_at_core_block_height(), + updated_at_core_block_height: document_update_price_transition + .document() + .updated_at_core_block_height(), + transferred_at_core_block_height: document_update_price_transition + .document() + .transferred_at_core_block_height(), + data: document_update_price_transition.document().properties(), + }; + self.validate_uniqueness_of_data(request, transaction, platform_version) + } +} diff --git a/packages/rs-drive/src/drive/document/insert/add_document/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document/mod.rs index 74eae75b298..3002a727e83 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document/mod.rs @@ -1,7 +1,7 @@ mod v0; -use crate::drive::object_size_info::OwnedDocumentInfo; use crate::drive::Drive; +use crate::util::object_size_info::OwnedDocumentInfo; use crate::error::drive::DriveError; use crate::error::Error; diff --git a/packages/rs-drive/src/drive/document/insert/add_document/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document/v0/mod.rs index 228529c93d8..78cf1b12a5a 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document/v0/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::drive::Drive; use crate::error::document::DocumentError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::fee::fee_result::FeeResult; @@ -13,6 +13,7 @@ use grovedb::TransactionArg; impl Drive { /// Adds a document using bincode serialization + #[inline(always)] pub(super) fn add_document_v0( &self, owned_document_info: OwnedDocumentInfo, @@ -63,6 +64,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs index c01d6d9a810..8cd26c38f49 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs @@ -1,7 +1,7 @@ mod v0; -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; +use crate::util::object_size_info::DocumentAndContractInfo; use crate::error::drive::DriveError; use crate::error::Error; @@ -9,6 +9,7 @@ use crate::error::Error; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::TransactionArg; @@ -34,6 +35,7 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -49,6 +51,7 @@ impl Drive { apply, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "add_document_for_contract".to_string(), diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs index b035a8ba01d..a8656a1546c 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs @@ -1,16 +1,18 @@ -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; +use crate::util::object_size_info::DocumentAndContractInfo; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::TransactionArg; impl Drive { /// Adds a document to a contract. + #[inline(always)] pub(super) fn add_document_for_contract_v0( &self, document_and_contract_info: DocumentAndContractInfo, @@ -19,6 +21,7 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { let mut drive_operations: Vec = vec![]; self.add_document_for_contract_apply_and_add_to_operations( @@ -37,6 +40,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/mod.rs index 6d5812c5665..dd8edb51c15 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/mod.rs @@ -1,10 +1,10 @@ mod v0; -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/v0/mod.rs index 681436e719c..6ccf4cee2f7 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_apply_and_add_to_operations/v0/mod.rs @@ -1,7 +1,7 @@ -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; @@ -11,6 +11,7 @@ use std::collections::HashMap; impl Drive { /// Performs the operations to add a document to a contract. + #[inline(always)] pub(super) fn add_document_for_contract_apply_and_add_to_operations_v0( &self, document_and_contract_info: DocumentAndContractInfo, diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/mod.rs index e36e0fa6c6a..16f5f829768 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/mod.rs @@ -1,10 +1,10 @@ mod v0; -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs index 30f2821623b..1faf95a1dc2 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs @@ -1,10 +1,10 @@ -use crate::drive::document::contract_documents_primary_key_path; -use crate::drive::grove_operations::DirectQueryType::{StatefulDirectQuery, StatelessDirectQuery}; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods}; +use crate::drive::document::paths::contract_documents_primary_key_path; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType::{StatefulDirectQuery, StatelessDirectQuery}; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods}; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; @@ -17,6 +17,7 @@ use std::collections::HashMap; impl Drive { /// Gathers the operations to add a document to a contract. + #[inline(always)] pub(super) fn add_document_for_contract_operations_v0( &self, document_and_contract_info: DocumentAndContractInfo, @@ -61,7 +62,7 @@ impl Drive { .document_info .is_document_size(); - // 3. Document is exists in the storage + // 3. Document exists in storage let is_update = could_be_update && self.grove_has_raw( primary_key_path.as_ref().into(), diff --git a/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/mod.rs index da41c863b23..f78e3247790 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/mod.rs @@ -8,11 +8,11 @@ use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs index 0cfc8f2c305..f0ecde6e3ee 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs @@ -10,32 +10,25 @@ use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; use std::option::Option::None; -use crate::drive::defaults::{DEFAULT_HASH_SIZE_U8, STORAGE_FLAGS_SIZE}; -use crate::drive::document::{ - contract_documents_keeping_history_primary_key_path_for_document_id, - contract_documents_keeping_history_primary_key_path_for_unknown_document_id, - contract_documents_keeping_history_storage_time_reference_path_size, - contract_documents_primary_key_path, -}; - -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::{ +use crate::drive::constants::STORAGE_FLAGS_SIZE; +use crate::util::object_size_info::DocumentInfo::{ DocumentAndSerialization, DocumentEstimatedAverageSize, DocumentOwnedInfo, DocumentRefAndSerialization, DocumentRefInfo, }; +use crate::util::storage_flags::StorageFlags; -use crate::drive::object_size_info::PathKeyElementInfo::{ - PathFixedSizeKeyRefElement, PathKeyUnknownElementSize, -}; -use crate::drive::object_size_info::PathKeyInfo::{PathFixedSizeKeyRef, PathKeySize}; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyUnknownElementSize, +}; +use crate::util::object_size_info::PathKeyInfo::{PathFixedSizeKeyRef, PathKeySize}; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods}; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; -use crate::drive::grove_operations::{BatchInsertApplyType, BatchInsertTreeApplyType}; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use crate::util::grove_operations::{BatchInsertApplyType, BatchInsertTreeApplyType}; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; @@ -45,6 +38,13 @@ use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::DocumentV0Getters; +use crate::drive::document::paths::{ + contract_documents_keeping_history_primary_key_path_for_document_id, + contract_documents_keeping_history_primary_key_path_for_unknown_document_id, + contract_documents_keeping_history_storage_time_reference_path_size, + contract_documents_primary_key_path, +}; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use dpp::version::PlatformVersion; impl Drive { @@ -135,6 +135,7 @@ impl Drive { // we first insert an empty tree if the document is new self.batch_insert_empty_tree_if_not_exists( path_key_info, + false, storage_flags, apply_type, transaction, @@ -142,7 +143,7 @@ impl Drive { drive_operations, drive_version, )?; - let encoded_time = DocumentPropertyType::encode_unsigned_integer(block_info.time_ms)?; + let encoded_time = DocumentPropertyType::encode_date_timestamp(block_info.time_ms); let path_key_element_info = match &document_and_contract_info .owned_document_info .document_info @@ -228,7 +229,11 @@ impl Drive { PathKeyUnknownElementSize(( document_id_in_primary_path, KnownKey(encoded_time.clone()), - Element::required_item_space(*max_size, STORAGE_FLAGS_SIZE), + Element::required_item_space( + *max_size, + STORAGE_FLAGS_SIZE, + &platform_version.drive.grove_version, + )?, )) } }; @@ -250,7 +255,11 @@ impl Drive { PathKeyUnknownElementSize(( document_id_in_primary_path, KnownKey(vec![0]), - Element::required_item_space(reference_max_size, STORAGE_FLAGS_SIZE), + Element::required_item_space( + reference_max_size, + STORAGE_FLAGS_SIZE, + &platform_version.drive.grove_version, + )?, )) } else { // we should also insert a reference at 0 to the current value @@ -325,7 +334,11 @@ impl Drive { unique_id: document_type.unique_id_for_storage().to_vec(), max_size: DEFAULT_HASH_SIZE_U8, }, - Element::required_item_space(*average_size, STORAGE_FLAGS_SIZE), + Element::required_item_space( + *average_size, + STORAGE_FLAGS_SIZE, + &platform_version.drive.grove_version, + )?, )), DocumentOwnedInfo((document, storage_flags)) => { let serialized_document = document @@ -401,7 +414,11 @@ impl Drive { unique_id: document_type.unique_id_for_storage().to_vec(), max_size: DEFAULT_HASH_SIZE_U8, }, - Element::required_item_space(*max_size, STORAGE_FLAGS_SIZE), + Element::required_item_space( + *max_size, + STORAGE_FLAGS_SIZE, + &platform_version.drive.grove_version, + )?, )), }; let apply_type = if estimated_costs_only_with_layer_info.is_none() { diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/mod.rs index 4132e9c7c29..b7b2ac40608 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/mod.rs @@ -1,13 +1,13 @@ mod v0; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; -use crate::drive::object_size_info::{DocumentAndContractInfo, PathInfo}; use crate::drive::Drive; use crate::error::drive::DriveError; +use crate::util::object_size_info::{DocumentAndContractInfo, PathInfo}; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::document_type::IndexLevel; use dpp::version::PlatformVersion; @@ -24,6 +24,7 @@ impl Drive { index_path_info: PathInfo<0>, index_level: &IndexLevel, any_fields_null: bool, + all_fields_null: bool, previous_batch_operations: &mut Option<&mut Vec>, storage_flags: &Option<&StorageFlags>, estimated_costs_only_with_layer_info: &mut Option< @@ -46,6 +47,7 @@ impl Drive { index_path_info, index_level, any_fields_null, + all_fields_null, previous_batch_operations, storage_flags, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs index 8a0f4f3a105..2725cc80b1c 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -1,12 +1,12 @@ -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::DriveKeyInfo::KeyRef; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::drive::Drive; use crate::error::fee::FeeError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::DriveKeyInfo::KeyRef; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; +use crate::util::storage_flags::StorageFlags; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use dpp::data_contract::document_type::IndexLevel; use dpp::version::PlatformVersion; @@ -19,12 +19,14 @@ use std::collections::HashMap; impl Drive { /// Adds indices for an index level and recurses. + #[inline] pub(super) fn add_indices_for_index_level_for_contract_operations_v0( &self, document_and_contract_info: &DocumentAndContractInfo, index_path_info: PathInfo<0>, index_level: &IndexLevel, mut any_fields_null: bool, + mut all_fields_null: bool, previous_batch_operations: &mut Option<&mut Vec>, storage_flags: &Option<&StorageFlags>, estimated_costs_only_with_layer_info: &mut Option< @@ -35,12 +37,13 @@ impl Drive { batch_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), Error> { - if let Some(unique) = index_level.has_index_with_uniqueness() { + if let Some(index_type) = index_level.has_index_with_type() { self.add_reference_for_index_level_for_contract_operations( document_and_contract_info, index_path_info.clone(), - unique, + index_type, any_fields_null, + all_fields_null, previous_batch_operations, storage_flags, estimated_costs_only_with_layer_info, @@ -106,6 +109,7 @@ impl Drive { // here we are inserting an empty tree that will have a subtree of all other index properties self.batch_insert_empty_tree_if_not_exists( path_key_info.clone(), + false, *storage_flags, apply_type, transaction, @@ -153,6 +157,7 @@ impl Drive { // here we are inserting an empty tree that will have a subtree of all other index properties self.batch_insert_empty_tree_if_not_exists( path_key_info.clone(), + false, *storage_flags, apply_type, transaction, @@ -162,16 +167,18 @@ impl Drive { )?; any_fields_null |= document_index_field.is_empty(); + all_fields_null &= document_index_field.is_empty(); // we push the actual value of the index path sub_level_index_path_info.push(document_index_field)?; // Iteration 1. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId// // Iteration 2. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId//accountReference/ - self.add_indices_for_index_level_for_contract_operations( + self.add_indices_for_index_level_for_contract_operations_v0( document_and_contract_info, sub_level_index_path_info, sub_level, any_fields_null, + all_fields_null, previous_batch_operations, storage_flags, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs index 2c7c14d1b56..c21146a1832 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs @@ -1,20 +1,21 @@ -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; -use crate::drive::document::{contract_document_type_path_vec, unique_event_id}; +use crate::drive::document::unique_event_id; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; -use crate::drive::grove_operations::BatchInsertTreeApplyType; +use crate::util::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::drive::Drive; +use crate::util::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; use crate::error::fee::FeeError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::config::v0::DataContractConfigGettersV0; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::version::PlatformVersion; +use crate::drive::document::paths::contract_document_type_path_vec; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::AllSubtrees; @@ -54,8 +55,8 @@ impl Drive { // we need to construct the path for documents on the contract // the path is - // * Document andDataContract root tree - // *DataContract ID recovered from document + // * Document and DataContract root tree + // * DataContract ID recovered from document // * 0 to signify Documents and notDataContract let contract_document_type_path = contract_document_type_path_vec( document_and_contract_info.contract.id_ref().as_bytes(), @@ -119,6 +120,7 @@ impl Drive { // here we are inserting an empty tree that will have a subtree of all other index properties self.batch_insert_empty_tree_if_not_exists( path_key_info.clone(), + false, storage_flags, apply_type, transaction, @@ -156,6 +158,7 @@ impl Drive { } let any_fields_null = document_top_field.is_empty(); + let all_fields_null = document_top_field.is_empty(); let mut index_path_info = if document_and_contract_info .owned_document_info @@ -165,7 +168,7 @@ impl Drive { // This is a stateless operation PathInfo::PathWithSizes(KeyInfoPath::from_known_owned_path(index_path)) } else { - PathInfo::PathIterator::<0>(index_path) + PathInfo::PathAsVec::<0>(index_path) }; // we push the actual value of the index path @@ -177,6 +180,7 @@ impl Drive { index_path_info, sub_level, any_fields_null, + all_fields_null, previous_batch_operations, &storage_flags, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/mod.rs index e47b4c58630..bb95aa19332 100644 --- a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/mod.rs @@ -1,16 +1,17 @@ mod v0; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; -use crate::drive::object_size_info::{DocumentAndContractInfo, PathInfo}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::{DocumentAndContractInfo, PathInfo}; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; +use dpp::data_contract::document_type::IndexLevelTypeInfo; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; @@ -20,8 +21,9 @@ impl Drive { &self, document_and_contract_info: &DocumentAndContractInfo, index_path_info: PathInfo<0>, - unique: bool, + index_type: IndexLevelTypeInfo, any_fields_null: bool, + all_fields_null: bool, previous_batch_operations: &mut Option<&mut Vec>, storage_flags: &Option<&StorageFlags>, estimated_costs_only_with_layer_info: &mut Option< @@ -40,8 +42,9 @@ impl Drive { 0 => self.add_reference_for_index_level_for_contract_operations_v0( document_and_contract_info, index_path_info, - unique, + index_type, any_fields_null, + all_fields_null, previous_batch_operations, storage_flags, estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs index c46e791faa0..be2ec0515d1 100644 --- a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs @@ -1,38 +1,41 @@ -use crate::drive::defaults::{DEFAULT_HASH_SIZE_U8, STORAGE_FLAGS_SIZE}; +use crate::drive::constants::STORAGE_FLAGS_SIZE; use crate::drive::document::{document_reference_size, make_document_reference}; -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; -use crate::drive::grove_operations::{BatchInsertApplyType, BatchInsertTreeApplyType}; -use crate::drive::object_size_info::DocumentInfo::{ - DocumentAndSerialization, DocumentEstimatedAverageSize, DocumentOwnedInfo, - DocumentRefAndSerialization, DocumentRefInfo, -}; -use crate::drive::object_size_info::DriveKeyInfo::{Key, KeyRef}; -use crate::drive::object_size_info::KeyElementInfo::{KeyElement, KeyUnknownElementSize}; -use crate::drive::object_size_info::{DocumentAndContractInfo, PathInfo, PathKeyElementInfo}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use crate::util::grove_operations::{BatchInsertApplyType, BatchInsertTreeApplyType}; +use crate::util::object_size_info::DocumentInfo::{ + DocumentAndSerialization, DocumentEstimatedAverageSize, DocumentOwnedInfo, + DocumentRefAndSerialization, DocumentRefInfo, +}; +use crate::util::object_size_info::DriveKeyInfo::{Key, KeyRef}; +use crate::util::object_size_info::KeyElementInfo::{KeyElement, KeyUnknownElementSize}; +use crate::util::object_size_info::{DocumentAndContractInfo, PathInfo, PathKeyElementInfo}; +use crate::util::storage_flags::StorageFlags; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::data_contract::document_type::IndexLevelTypeInfo; use dpp::document::DocumentV0Getters; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; -use grovedb::EstimatedLayerSizes::AllSubtrees; -use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::EstimatedLayerSizes::AllReference; use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; impl Drive { /// Adds the terminal reference. + #[inline(always)] pub(super) fn add_reference_for_index_level_for_contract_operations_v0( &self, document_and_contract_info: &DocumentAndContractInfo, mut index_path_info: PathInfo<0>, - unique: bool, + index_type: IndexLevelTypeInfo, any_fields_null: bool, + all_fields_null: bool, previous_batch_operations: &mut Option<&mut Vec>, storage_flags: &Option<&StorageFlags>, estimated_costs_only_with_layer_info: &mut Option< @@ -42,9 +45,14 @@ impl Drive { batch_operations: &mut Vec, drive_version: &DriveVersion, ) -> Result<(), Error> { + if all_fields_null && !index_type.should_insert_with_all_null { + return Ok(()); + } // unique indexes will be stored under key "0" - // non unique indices should have a tree at key "0" that has all elements based off of primary key - if !unique || any_fields_null { + // non-unique indices should have a tree at key "0" that has all elements based off of primary key + if !index_type.index_type.is_unique() || any_fields_null { + // Tree generation, this happens for both non unique indexes, unique indexes with a null inside + // a member of the path let key_path_info = KeyRef(&[0]); let path_key_info = key_path_info.add_path_info(index_path_info.clone()); @@ -61,9 +69,13 @@ impl Drive { } }; - // here we are inserting an empty tree that will have a subtree of all other index properties + // Here we are inserting an empty tree that will have a subtree of all other index properties + // It is basically the 0 + // Underneath we will have all elements if non unique index, or all identity contenders if + // a contested resource index self.batch_insert_empty_tree_if_not_exists( path_key_info, + false, *storage_flags, apply_type, transaction, @@ -73,6 +85,8 @@ impl Drive { )?; index_path_info.push(Key(vec![0]))?; + // This is the simpler situation + // Under each tree we have all the references if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { @@ -82,9 +96,9 @@ impl Drive { EstimatedLayerInformation { is_sum_tree: false, estimated_layer_count: PotentiallyAtMaxElements, - estimated_layer_sizes: AllSubtrees( + estimated_layer_sizes: AllReference( DEFAULT_HASH_SIZE_U8, - NoSumTrees, + document_reference_size(document_and_contract_info.document_type), storage_flags.map(|s| s.serialized_size()), ), }, @@ -119,7 +133,11 @@ impl Drive { .to_vec(), max_size: DEFAULT_HASH_SIZE_U8, }, - Element::required_item_space(*max_size, STORAGE_FLAGS_SIZE), + Element::required_item_space( + *max_size, + STORAGE_FLAGS_SIZE, + &drive_version.grove_version, + )?, )), }; @@ -159,7 +177,11 @@ impl Drive { .to_vec(), max_size: 1, }, - Element::required_item_space(*estimated_size, STORAGE_FLAGS_SIZE), + Element::required_item_space( + *estimated_size, + STORAGE_FLAGS_SIZE, + &drive_version.grove_version, + )?, )), }; diff --git a/packages/rs-drive/src/drive/document/insert/mod.rs b/packages/rs-drive/src/drive/document/insert/mod.rs index 8bff50895c3..e2e2f378900 100644 --- a/packages/rs-drive/src/drive/document/insert/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Insert Documents. //! //! This module implements functions in Drive relevant to inserting documents. @@ -35,42 +6,34 @@ // Module: add_document // This module contains functionality for adding a document mod add_document; -pub use add_document::*; // Module: add_document_for_contract // This module contains functionality for adding a document for a given contract mod add_document_for_contract; -pub use add_document_for_contract::*; // Module: add_document_for_contract_apply_and_add_to_operations // This module contains functionality for applying and adding operations for a contract document mod add_document_for_contract_apply_and_add_to_operations; -pub use add_document_for_contract_apply_and_add_to_operations::*; // Module: add_document_for_contract_operations // This module contains functionality for adding a document for contract operations mod add_document_for_contract_operations; -pub use add_document_for_contract_operations::*; // Module: add_document_to_primary_storage // This module contains functionality for adding a document to primary storage mod add_document_to_primary_storage; -pub use add_document_to_primary_storage::*; // Module: add_indices_for_index_level_for_contract_operations // This module contains functionality for adding indices for an index level for contract operations mod add_indices_for_index_level_for_contract_operations; -pub use add_indices_for_index_level_for_contract_operations::*; // Module: add_indices_for_top_index_level_for_contract_operations // This module contains functionality for adding indices for the top index level for contract operations mod add_indices_for_top_index_level_for_contract_operations; -pub use add_indices_for_top_index_level_for_contract_operations::*; // Module: add_reference_for_index_level_for_contract_operations // This module contains functionality for adding a reference for an index level for contract operations mod add_reference_for_index_level_for_contract_operations; -pub use add_reference_for_index_level_for_contract_operations::*; #[cfg(all( feature = "fixtures-and-mocks", @@ -84,28 +47,30 @@ mod tests { use std::option::Option::None; use dpp::block::block_info::BlockInfo; - use rand::Rng; + use rand::{random, Rng}; - use crate::common::setup_contract; use crate::drive::document::tests::setup_dashpay; - use crate::drive::flags::StorageFlags; - use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; - use crate::fee::op::LowLevelDriveOperation; + use crate::fees::op::LowLevelDriveOperation; + use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; + use crate::util::storage_flags::StorageFlags; + use crate::util::test_helpers::setup_contract; + use once_cell::sync::Lazy; + use std::collections::BTreeMap; use dpp::block::epoch::Epoch; use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::document::Document; - use crate::drive::object_size_info::DocumentInfo::DocumentRefInfo; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; - use dpp::document::serialization_traits::DocumentCborMethodsV0; - use dpp::fee::default_costs::EpochCosts; + use crate::util::object_size_info::DocumentInfo::DocumentRefInfo; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::fee_result::FeeResult; - use dpp::tests::fixtures::get_dpns_data_contract_fixture; use dpp::tests::json_document::json_document_to_document; use dpp::version::PlatformVersion; + static EPOCH_CHANGE_FEE_VERSION_TEST: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); + #[test] fn test_add_dashpay_documents_no_transaction() { let (drive, dashpay) = setup_dashpay("add", true); @@ -144,6 +109,7 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -165,6 +131,7 @@ mod tests { true, None, platform_version, + None, ) .expect_err("expected not to be able to insert same document twice"); @@ -186,6 +153,7 @@ mod tests { true, None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to override a document successfully"); } @@ -209,7 +177,7 @@ mod tests { .document_type_for_name("contactRequest") .expect("expected to get document type"); - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + let random_owner_id = random::<[u8; 32]>(); let dashpay_cr_document = json_document_to_document( "tests/supporting_files/contract/dashpay/contact-request0.json", @@ -237,6 +205,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -258,6 +227,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect_err("expected not to be able to insert same document twice"); @@ -279,6 +249,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to override a document successfully"); } @@ -330,17 +301,19 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); assert_eq!( fee_result, FeeResult { - storage_fee: 3057 - * Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte), - processing_fee: 2316870, + storage_fee: 3058 + * Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ), + processing_fee: 1695100, ..Default::default() } ); @@ -393,17 +366,19 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); assert_eq!( fee_result, FeeResult { - storage_fee: 1303 - * Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte), - processing_fee: 1481210, + storage_fee: 1305 + * Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ), + processing_fee: 900400, ..Default::default() } ); @@ -461,15 +436,17 @@ mod tests { false, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); let added_bytes = storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); - assert_eq!(1303, added_bytes); - assert_eq!(142936000, processing_fee); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); + assert_eq!(1305, added_bytes); + assert_eq!(73253660, processing_fee); } #[test] @@ -487,7 +464,7 @@ mod tests { Some(&db_transaction), ); - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + let random_owner_id = random::<[u8; 32]>(); let document_type = contract .document_type_for_name("contactRequest") @@ -519,6 +496,7 @@ mod tests { false, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -540,6 +518,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -561,7 +540,7 @@ mod tests { Some(&db_transaction), ); - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + let random_owner_id = random::<[u8; 32]>(); let document_type = contract .document_type_for_name("contactRequest") @@ -584,7 +563,7 @@ mod tests { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("expected a root hash calculation to succeed"); @@ -610,7 +589,7 @@ mod tests { let root_hash_after_fee = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("expected a root hash calculation to succeed"); @@ -685,17 +664,19 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); assert_eq!( fee_result, FeeResult { - storage_fee: 1761 - * Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte), - processing_fee: 2069390, + storage_fee: 1840 + * Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ), + processing_fee: 1264300, ..Default::default() } ); @@ -711,7 +692,7 @@ mod tests { fn test_add_dashpay_many_non_conflicting_documents() { let (drive, dashpay) = setup_dashpay("add_no_conflict", true); - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + let random_owner_id = random::<[u8; 32]>(); let platform_version = PlatformVersion::first(); @@ -761,6 +742,7 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -782,6 +764,7 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -803,6 +786,7 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); } @@ -815,7 +799,7 @@ mod tests { .document_type_for_name("contactRequest") .expect("expected to get document type"); - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + let random_owner_id = random::<[u8; 32]>(); let platform_version = PlatformVersion::first(); @@ -853,6 +837,7 @@ mod tests { true, None, platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -874,104 +859,10 @@ mod tests { true, None, platform_version, + None, ) .expect_err( "expected not to be able to insert document with already existing unique index", ); } - - #[test] - fn test_create_two_documents_with_the_same_index_in_different_transactions() { - let drive = setup_drive_with_initial_state_structure(); - - let db_transaction = drive.grove.start_transaction(); - - let platform_version = PlatformVersion::latest(); - - let created_contract = - get_dpns_data_contract_fixture(None, platform_version.protocol_version); - - drive - .apply_contract( - created_contract.data_contract(), - BlockInfo::default(), - true, - StorageFlags::optional_default_as_cow(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to apply contract successfully"); - - // Create dash TLD - - let dash_tld_cbor = hex::decode("00ac632469645820d7f2c53f46a917ab6e5b39a2d7bc260b649289453744d1e0d4f26a8d8eff37cf65247479706566646f6d61696e656c6162656c6464617368677265636f726473a17364617368416c6961734964656e74697479496458203012c19b98ec0033addb36cd64b7f510670f2a351a4304b5f6994144286efdac68246f776e6572496458203012c19b98ec0033addb36cd64b7f510670f2a351a4304b5f6994144286efdac69247265766973696f6e016a246372656174656441741b0000017f07c861586c7072656f7264657253616c745820e0b508c5a36825a206693a1f414aa13edbecf43c41e3c799ea9e737b4f9aa2266e737562646f6d61696e52756c6573a16f616c6c6f77537562646f6d61696e73f56f2464617461436f6e747261637449645820e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c531556f6e6f726d616c697a65644c6162656c6464617368781a6e6f726d616c697a6564506172656e74446f6d61696e4e616d6560").unwrap(); - let dash_tld = Document::from_cbor(&dash_tld_cbor, None, None, platform_version) - .expect("expected to get document"); - - let info = DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &dash_tld, - StorageFlags::optional_default_as_cow(), - )), - owner_id: None, - }, - contract: created_contract.data_contract(), - document_type: created_contract - .data_contract() - .document_type_for_name("domain") - .expect("expected to get document type"), - }; - - drive - .add_document_for_contract( - info, - true, - BlockInfo::default(), - true, - Some(&db_transaction), - platform_version, - ) - .expect("should create dash tld"); - - drive - .grove - .commit_transaction(db_transaction) - .unwrap() - .expect("should commit transaction"); - - let db_transaction = drive.grove.start_transaction(); - - // add random TLD - - let random_tld_cbor = hex::decode("00ab632469645820655c9b5606f4ad53daea90de9c540aad656ed5fbe5fb14b40700f6f56dc793ac65247479706566646f6d61696e656c6162656c746433653966343532373963343865306261363561677265636f726473a17364617368416c6961734964656e74697479496458203012c19b98ec0033addb36cd64b7f510670f2a351a4304b5f6994144286efdac68246f776e6572496458203012c19b98ec0033addb36cd64b7f510670f2a351a4304b5f6994144286efdac69247265766973696f6e016c7072656f7264657253616c745820219353a923a29cd02c521b141f326ac0d12c362a84f1979a5de89b8dba12891b6e737562646f6d61696e52756c6573a16f616c6c6f77537562646f6d61696e73f56f2464617461436f6e747261637449645820e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c531556f6e6f726d616c697a65644c6162656c746433653966343532373963343865306261363561781a6e6f726d616c697a6564506172656e74446f6d61696e4e616d6560").unwrap(); - let _random_tld = Document::from_cbor(&random_tld_cbor, None, None, platform_version) - .expect("expected to get document"); - - let info = DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &dash_tld, - StorageFlags::optional_default_as_cow(), - )), - owner_id: None, - }, - contract: created_contract.data_contract(), - document_type: created_contract - .data_contract() - .document_type_for_name("domain") - .expect("expected to get document type"), - }; - - drive - .add_document_for_contract( - info, - true, - BlockInfo::default(), - true, - Some(&db_transaction), - platform_version, - ) - .expect("should create random tld"); - } } diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document/mod.rs new file mode 100644 index 00000000000..bfefd4f4cf4 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document/mod.rs @@ -0,0 +1,68 @@ +mod v0; + +use crate::drive::Drive; +use crate::util::object_size_info::OwnedDocumentInfo; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Adds a contested document using bincode serialization + /// + /// # Parameters + /// * `owned_document_info`: The document info to be added. + /// * `data_contract_id`: The identifier for the data contract. + /// * `document_type_name`: The document type name. + /// * `override_document`: Whether to override the document. + /// * `block_info`: The block info. + /// * `apply`: Whether to apply the operation. + /// * `transaction`: The transaction argument. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(FeeResult)` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn add_contested_document( + &self, + owned_document_info: OwnedDocumentInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + also_insert_vote_poll_stored_info: Option, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .document + .insert_contested + .add_contested_document + { + 0 => self.add_contested_document_v0( + owned_document_info, + contested_document_resource_vote_poll, + insert_without_check, + also_insert_vote_poll_stored_info, + block_info, + apply, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_document".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document/v0/mod.rs new file mode 100644 index 00000000000..7afbb825416 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document/v0/mod.rs @@ -0,0 +1,81 @@ +use crate::drive::Drive; +use crate::error::document::DocumentError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::fee::fee_result::FeeResult; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Adds a contested document using bincode serialization + #[inline(always)] + pub(super) fn add_contested_document_v0( + &self, + owned_document_info: OwnedDocumentInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + also_insert_vote_poll_stored_info: Option, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let mut drive_operations: Vec = vec![]; + + let contract_fetch_info = self + .get_contract_with_fetch_info_and_add_to_operations( + contested_document_resource_vote_poll + .contract + .id() + .into_buffer(), + Some(&block_info.epoch), + true, + transaction, + &mut drive_operations, + platform_version, + )? + .ok_or(Error::Document(DocumentError::DataContractNotFound))?; + + let contract = &contract_fetch_info.contract; + + let document_type = contract.document_type_for_name( + contested_document_resource_vote_poll + .document_type_name + .as_str(), + )?; + + let document_and_contract_info = DocumentAndContractInfo { + owned_document_info, + contract, + document_type, + }; + let mut drive_operations: Vec = vec![]; + self.add_contested_document_for_contract_apply_and_add_to_operations( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + block_info, + true, + apply, + also_insert_vote_poll_stored_info, + transaction, + &mut drive_operations, + platform_version, + )?; + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + Ok(fees) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract/mod.rs new file mode 100644 index 00000000000..f2863a8c03f --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract/mod.rs @@ -0,0 +1,66 @@ +mod v0; + +use crate::drive::Drive; +use crate::util::object_size_info::DocumentAndContractInfo; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Adds a contested document to a contract. + /// + /// # Parameters + /// * `document_and_contract_info`: Information about the document and contract. + /// * `override_document`: Whether to override the document. + /// * `block_info`: The block info. + /// * `apply`: Whether to apply the operation. + /// * `transaction`: The transaction argument. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(FeeResult)` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn add_contested_document_for_contract( + &self, + document_and_contract_info: DocumentAndContractInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + block_info: BlockInfo, + apply: bool, + also_insert_vote_poll_stored_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .document + .insert_contested + .add_contested_document_for_contract + { + 0 => self.add_contested_document_for_contract_v0( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + block_info, + apply, + also_insert_vote_poll_stored_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_document_for_contract".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract/v0/mod.rs new file mode 100644 index 00000000000..e52df3ccdee --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract/v0/mod.rs @@ -0,0 +1,51 @@ +use crate::drive::Drive; +use crate::util::object_size_info::DocumentAndContractInfo; + +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Adds a contested document to a contract. + #[inline(always)] + pub(super) fn add_contested_document_for_contract_v0( + &self, + document_and_contract_info: DocumentAndContractInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + block_info: BlockInfo, + apply: bool, + also_insert_vote_poll_stored_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let mut drive_operations: Vec = vec![]; + self.add_contested_document_for_contract_apply_and_add_to_operations( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + &block_info, + true, + apply, + also_insert_vote_poll_stored_info, + transaction, + &mut drive_operations, + platform_version, + )?; + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + Ok(fees) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_apply_and_add_to_operations/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_apply_and_add_to_operations/mod.rs new file mode 100644 index 00000000000..06513c02cc3 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_apply_and_add_to_operations/mod.rs @@ -0,0 +1,73 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; +use dpp::block::block_info::BlockInfo; + +use dpp::version::PlatformVersion; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Performs the operations to add a contested document to a contract. + /// + /// # Parameters + /// * `document_and_contract_info`: The document and contract info. + /// * `params`: In v0 the params should be: + /// * `override_document`: Whether to override the document. + /// * `block_info`: The block info. + /// * `document_is_unique_for_document_type_in_batch`: Whether the document is unique for the document type in batch. + /// * `stateful`: Whether the operation is stateful. + /// * `transaction`: The transaction argument. + /// * `drive_operations`: The drive operations. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub(crate) fn add_contested_document_for_contract_apply_and_add_to_operations( + &self, + document_and_contract_info: DocumentAndContractInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + block_info: &BlockInfo, + document_is_unique_for_document_type_in_batch: bool, + stateful: bool, + also_insert_vote_poll_stored_info: Option, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .document + .insert_contested + .add_contested_document_for_contract_apply_and_add_to_operations + { + 0 => self.add_contested_document_for_contract_apply_and_add_to_operations_v0( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + block_info, + document_is_unique_for_document_type_in_batch, + stateful, + also_insert_vote_poll_stored_info, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_document_for_contract_apply_and_add_to_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_apply_and_add_to_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_apply_and_add_to_operations/v0/mod.rs new file mode 100644 index 00000000000..1c031429898 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_apply_and_add_to_operations/v0/mod.rs @@ -0,0 +1,75 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; +use dpp::block::block_info::BlockInfo; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Performs the operations to add a document to a contract. + #[inline(always)] + pub(super) fn add_contested_document_for_contract_apply_and_add_to_operations_v0( + &self, + document_and_contract_info: DocumentAndContractInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + block_info: &BlockInfo, + document_is_unique_for_document_type_in_batch: bool, + stateful: bool, + also_insert_vote_poll_stored_info: Option, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut estimated_costs_only_with_layer_info = if stateful { + None::> + } else { + Some(HashMap::new()) + }; + if document_is_unique_for_document_type_in_batch { + let batch_operations = self.add_contested_document_for_contract_operations( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + block_info, + also_insert_vote_poll_stored_info, + &mut None, + &mut estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + self.apply_batch_low_level_drive_operations( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_operations, + &platform_version.drive, + ) + } else { + let batch_operations = self.add_contested_document_for_contract_operations( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + block_info, + also_insert_vote_poll_stored_info, + &mut Some(drive_operations), + &mut estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + self.apply_batch_low_level_drive_operations( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_operations, + &platform_version.drive, + ) + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_operations/mod.rs new file mode 100644 index 00000000000..6d58de492c7 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_operations/mod.rs @@ -0,0 +1,58 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; +use dpp::block::block_info::BlockInfo; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Gathers the operations to add a contested document to a contract. + pub(crate) fn add_contested_document_for_contract_operations( + &self, + document_and_contract_info: DocumentAndContractInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + block_info: &BlockInfo, + also_insert_vote_poll_stored_info: Option, + previous_batch_operations: &mut Option<&mut Vec>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .document + .insert_contested + .add_contested_document_for_contract_operations + { + 0 => self.add_contested_document_for_contract_operations_v0( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + block_info, + also_insert_vote_poll_stored_info, + previous_batch_operations, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_document_for_contract_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_operations/v0/mod.rs new file mode 100644 index 00000000000..6734a354ed9 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract_operations/v0/mod.rs @@ -0,0 +1,97 @@ +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use dpp::voting::vote_polls::VotePoll; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Gathers the operations to add a contested document to a contract. + #[inline(always)] + pub(super) fn add_contested_document_for_contract_operations_v0( + &self, + document_and_contract_info: DocumentAndContractInfo, + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + insert_without_check: bool, + block_info: &BlockInfo, + also_insert_vote_poll_stored_info: Option, + previous_batch_operations: &mut Option<&mut Vec>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut batch_operations: Vec = vec![]; + + // if we are trying to get estimated costs we need to add the upper levels + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_contested_document_tree_levels_up_to_contract( + document_and_contract_info.contract, + Some(document_and_contract_info.document_type), + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + // if we have override_document set that means we already checked if it exists + self.add_contested_document_to_primary_storage( + &document_and_contract_info, + insert_without_check, + estimated_costs_only_with_layer_info, + transaction, + &mut batch_operations, + platform_version, + )?; + + let end_date = block_info.time_ms.saturating_add( + platform_version + .dpp + .voting_versions + .default_vote_poll_time_duration_ms, + ); + + let contest_already_existed = self.add_contested_indices_for_contract_operations( + &document_and_contract_info, + previous_batch_operations, + estimated_costs_only_with_layer_info, + transaction, + &mut batch_operations, + platform_version, + )?; + + if !contest_already_existed { + if let Some(vote_poll_stored_start_info) = also_insert_vote_poll_stored_info { + let mut operations = self + .insert_stored_info_for_contested_resource_vote_poll_operations( + &contested_document_resource_vote_poll, + vote_poll_stored_start_info, + platform_version, + )?; + batch_operations.append(&mut operations); + } + + self.add_vote_poll_end_date_query_operations( + document_and_contract_info.owned_document_info.owner_id, + VotePoll::ContestedDocumentResourceVotePoll( + contested_document_resource_vote_poll.into(), + ), + end_date, + block_info, + estimated_costs_only_with_layer_info, + previous_batch_operations, + &mut batch_operations, + transaction, + platform_version, + )?; + } + + Ok(batch_operations) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/mod.rs new file mode 100644 index 00000000000..7f869b45224 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/mod.rs @@ -0,0 +1,64 @@ +mod v0; + +use grovedb::batch::KeyInfoPath; + +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +use std::collections::HashMap; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Adds a contested document to primary storage. + /// + /// # Parameters + /// * `document_and_contract_info`: Information about the document and contract. + /// * `block_info`: The block info. + /// * `insert_without_check`: Whether to insert the document without check. + /// * `estimated_costs_only_with_layer_info`: Information about the estimated costs only with layer. + /// * `transaction`: The transaction argument. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub(crate) fn add_contested_document_to_primary_storage( + &self, + document_and_contract_info: &DocumentAndContractInfo, + insert_without_check: bool, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .document + .insert_contested + .add_contested_document_to_primary_storage + { + 0 => self.add_contested_document_to_primary_storage_0( + document_and_contract_info, + insert_without_check, + estimated_costs_only_with_layer_info, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_document_to_primary_storage".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/v0/mod.rs new file mode 100644 index 00000000000..5df447b5ef5 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/v0/mod.rs @@ -0,0 +1,226 @@ +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; + +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; + +use std::collections::HashMap; + +use crate::drive::constants::STORAGE_FLAGS_SIZE; +use crate::util::object_size_info::DocumentInfo::{ + DocumentAndSerialization, DocumentEstimatedAverageSize, DocumentOwnedInfo, + DocumentRefAndSerialization, DocumentRefInfo, +}; +use crate::util::storage_flags::StorageFlags; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; +use crate::util::object_size_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyUnknownElementSize, +}; + +use crate::util::grove_operations::BatchInsertApplyType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; + +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use dpp::document::DocumentV0Getters; + +use crate::drive::votes::paths::vote_contested_resource_contract_documents_storage_path; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; +use dpp::version::PlatformVersion; + +impl Drive { + /// Adds a document to primary storage. + /// If a document isn't sent to this function then we are just calling to know the query and + /// insert operations + pub(super) fn add_contested_document_to_primary_storage_0( + &self, + document_and_contract_info: &DocumentAndContractInfo, + insert_without_check: bool, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let drive_version = &platform_version.drive; + let contract = document_and_contract_info.contract; + let document_type = document_and_contract_info.document_type; + let primary_key_path = vote_contested_resource_contract_documents_storage_path( + contract.id_ref().as_bytes(), + document_type.name().as_str(), + ); + // if we are trying to get estimated costs we should add this level + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_add_contested_document_to_primary_storage( + document_and_contract_info, + primary_key_path, + estimated_costs_only_with_layer_info, + platform_version, + )?; + } + + if insert_without_check { + let path_key_element_info = match &document_and_contract_info + .owned_document_info + .document_info + { + DocumentRefAndSerialization((document, serialized_document, storage_flags)) => { + let element = Element::Item( + serialized_document.to_vec(), + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + DocumentAndSerialization((document, serialized_document, storage_flags)) => { + let element = Element::Item( + serialized_document.to_vec(), + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + DocumentRefInfo((document, storage_flags)) => { + let serialized_document = document + .serialize(document_and_contract_info.document_type, platform_version)?; + let element = Element::Item( + serialized_document, + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + DocumentEstimatedAverageSize(average_size) => PathKeyUnknownElementSize(( + KeyInfoPath::from_known_path(primary_key_path), + KeyInfo::MaxKeySize { + unique_id: document_type.unique_id_for_storage().to_vec(), + max_size: DEFAULT_HASH_SIZE_U8, + }, + Element::required_item_space( + *average_size, + STORAGE_FLAGS_SIZE, + &platform_version.drive.grove_version, + )?, + )), + DocumentOwnedInfo((document, storage_flags)) => { + let serialized_document = document + .serialize(document_and_contract_info.document_type, platform_version)?; + let element = Element::Item( + serialized_document, + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + }; + self.batch_insert(path_key_element_info, drive_operations, drive_version)?; + } else { + let path_key_element_info = match &document_and_contract_info + .owned_document_info + .document_info + { + DocumentRefAndSerialization((document, serialized_document, storage_flags)) => { + let element = Element::Item( + serialized_document.to_vec(), + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + DocumentAndSerialization((document, serialized_document, storage_flags)) => { + let element = Element::Item( + serialized_document.to_vec(), + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + DocumentOwnedInfo((document, storage_flags)) => { + let serialized_document = document + .serialize(document_and_contract_info.document_type, platform_version)?; + let element = Element::Item( + serialized_document, + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + DocumentRefInfo((document, storage_flags)) => { + let serialized_document = document + .serialize(document_and_contract_info.document_type, platform_version)?; + let element = Element::Item( + serialized_document, + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ); + PathFixedSizeKeyRefElement(( + primary_key_path, + document.id_ref().as_slice(), + element, + )) + } + DocumentEstimatedAverageSize(max_size) => PathKeyUnknownElementSize(( + KeyInfoPath::from_known_path(primary_key_path), + KeyInfo::MaxKeySize { + unique_id: document_type.unique_id_for_storage().to_vec(), + max_size: DEFAULT_HASH_SIZE_U8, + }, + Element::required_item_space( + *max_size, + STORAGE_FLAGS_SIZE, + &platform_version.drive.grove_version, + )?, + )), + }; + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertApplyType::StatefulBatchInsert + } else { + BatchInsertApplyType::StatelessBatchInsert { + in_tree_using_sums: false, + target: QueryTargetValue(document_type.estimated_size(platform_version)? as u32), + } + }; + + let inserted = self.batch_insert_if_not_exists( + path_key_element_info, + apply_type, + transaction, + drive_operations, + drive_version, + )?; + if !inserted { + return Err(Error::Drive(DriveError::CorruptedDocumentAlreadyExists( + "item already exists in insert contested", + ))); + } + } + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/mod.rs new file mode 100644 index 00000000000..370100c7871 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/mod.rs @@ -0,0 +1,49 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::HashMap; + +mod v0; + +impl Drive { + /// Adds indices for an index level and recurses. + /// Will return true if the contest already existed + pub(crate) fn add_contested_indices_for_contract_operations( + &self, + document_and_contract_info: &DocumentAndContractInfo, + previous_batch_operations: &mut Option<&mut Vec>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .document + .insert_contested + .add_contested_indices_for_contract_operations + { + 0 => self.add_contested_indices_for_contract_operations_v0( + document_and_contract_info, + previous_batch_operations, + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_indices_for_contract_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs new file mode 100644 index 00000000000..1881419fdd2 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs @@ -0,0 +1,292 @@ +use crate::util::grove_operations::BatchInsertTreeApplyType; + +use crate::drive::Drive; +use crate::util::object_size_info::{ + DocumentAndContractInfo, DocumentInfoV0Methods, DriveKeyInfo, PathInfo, +}; + +use crate::error::fee::FeeError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + +use crate::drive::votes::paths::{ + vote_contested_resource_contract_documents_indexes_path_vec, + RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32, RESOURCE_LOCK_VOTE_TREE_KEY_U8_32, +}; +use crate::error::drive::DriveError; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; +use dpp::data_contract::document_type::IndexProperty; +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Adds contested indices for the contract operations + /// Will return true if the contest already existed + pub(crate) fn add_contested_indices_for_contract_operations_v0( + &self, + document_and_contract_info: &DocumentAndContractInfo, + previous_batch_operations: &mut Option<&mut Vec>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + let drive_version = &platform_version.drive; + let owner_id = document_and_contract_info + .owned_document_info + .owner_id + .ok_or(Error::Drive(DriveError::ContestedDocumentMissingOwnerId( + "expecting an owner id", + )))?; + let contested_index = document_and_contract_info + .document_type + .find_contested_index() + .ok_or(Error::Drive(DriveError::ContestedIndexNotFound( + "a contested index is expected", + )))?; + let document_type = document_and_contract_info.document_type; + let storage_flags = document_and_contract_info + .owned_document_info + .document_info + .get_storage_flags_ref(); + + // we need to construct the path for documents on the contract + // the path is + // * Document and DataContract root tree + // * DataContract ID recovered from document + // * 0 to signify Documents and notDataContract + let contract_document_type_path = + vote_contested_resource_contract_documents_indexes_path_vec( + document_and_contract_info.contract.id_ref().as_bytes(), + document_and_contract_info.document_type.name(), + ); + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: false, + flags_len: storage_flags + .map(|s| s.serialized_size()) + .unwrap_or_default(), + } + }; + + // at this point the contract path is to the contract documents + // for each index the top index component will already have been added + // when the contract itself was created + let index_path: Vec> = contract_document_type_path.clone(); + + let mut index_path_info = if document_and_contract_info + .owned_document_info + .document_info + .is_document_size() + { + // This is a stateless operation + PathInfo::PathWithSizes(KeyInfoPath::from_known_owned_path(index_path)) + } else { + PathInfo::PathAsVec::<0>(index_path) + }; + + let mut contest_already_existed = true; + + // next we need to store a reference to the document for each index + for IndexProperty { name, .. } in &contested_index.properties { + // We on purpose do not want to put index names + // This is different from document secondary indexes + // The reason is that there is only one index so we already know the structure + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info + { + let document_top_field_estimated_size = document_and_contract_info + .owned_document_info + .document_info + .get_estimated_size_for_document_type(name, document_type)?; + + if document_top_field_estimated_size > u8::MAX as u16 { + return Err(Error::Fee(FeeError::Overflow( + "document field is too big for being an index on delete", + ))); + } + + // On this level we will have all the user defined values for the paths + estimated_costs_only_with_layer_info.insert( + index_path_info.clone().convert_to_key_info_path(), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllSubtrees( + document_top_field_estimated_size as u8, + NoSumTrees, + storage_flags.map(|s| s.serialized_size()), + ), + }, + ); + } + + // with the example of the dashpay contract's first index + // the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId + let document_top_field = document_and_contract_info + .owned_document_info + .document_info + .get_raw_for_document_type( + name, + document_type, + document_and_contract_info.owned_document_info.owner_id, + None, //we should never need this in contested documents + platform_version, + )? + .unwrap_or_default(); + + // here we are inserting an empty tree that will have a subtree of all other index properties + let inserted = self.batch_insert_empty_tree_if_not_exists( + document_top_field + .clone() + .add_path_info(index_path_info.clone()), + false, + storage_flags, + apply_type, + transaction, + previous_batch_operations, + batch_operations, + drive_version, + )?; + + // if we insert anything, that means that the contest didn't already exist + if contest_already_existed { + contest_already_existed &= !inserted; + } + + index_path_info.push(document_top_field)?; + } + + // Under each tree we have all identifiers of identities that want the contested resource + // Contrary to normal secondary indexes there are no property names and there is no termination key "0" + // We get something like + // Inter-wizard championship (event type) + // | + // Goblet of Fire (event name) <---- We just inserted this + // / \ + // Sam's ID Ivan's ID <---- We now need to insert at this level + // / \ / \ + // 0 (ref) 1 (sum tree) 0 (ref) 1 (sum tree) + // + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + // On this level we will have all the identities + estimated_costs_only_with_layer_info.insert( + index_path_info.clone().convert_to_key_info_path(), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(16), // very seldom would more than 16 people want the resource + estimated_layer_sizes: AllSubtrees( + DEFAULT_HASH_SIZE_U8, + NoSumTrees, + storage_flags.map(|s| s.serialized_size()), + ), + }, + ); + } + + self.batch_insert_empty_tree_if_not_exists( + DriveKeyInfo::Key(owner_id.to_vec()).add_path_info(index_path_info.clone()), + false, + storage_flags, + apply_type, + transaction, + previous_batch_operations, + batch_operations, + drive_version, + )?; + + let inserted_abstain = self.batch_insert_empty_tree_if_not_exists( + DriveKeyInfo::Key(RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.to_vec()) + .add_path_info(index_path_info.clone()), + false, + storage_flags, + apply_type, + transaction, + previous_batch_operations, + batch_operations, + drive_version, + )?; + + let inserted_lock = self.batch_insert_empty_tree_if_not_exists( + DriveKeyInfo::Key(RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec()) + .add_path_info(index_path_info.clone()), + false, + storage_flags, + apply_type, + transaction, + previous_batch_operations, + batch_operations, + drive_version, + )?; + + let mut towards_identity_index_path_info = index_path_info.clone(); + towards_identity_index_path_info.push(DriveKeyInfo::Key(owner_id.to_vec()))?; + + // Inter-wizard championship (event type) + // | + // Goblet of Fire (event name) + // / \ + // Sam's ID Ivan's ID <---- We just inserted this + // / \ / \ + // 0 (ref) 1 (sum tree) 0 (ref) 1 (sum tree) <---- We now need to insert at this level + // + + self.add_contested_reference_and_vote_subtree_to_document_operations( + document_and_contract_info, + towards_identity_index_path_info, + storage_flags, + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_version, + )?; + + if inserted_abstain { + let mut towards_abstain_index_path_info = index_path_info.clone(); + towards_abstain_index_path_info.push(DriveKeyInfo::Key( + RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.to_vec(), + ))?; + + self.add_contested_vote_subtree_for_non_identities_operations( + towards_abstain_index_path_info, + storage_flags, + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_version, + )?; + } + + if inserted_lock { + let mut towards_lock_index_path_info = index_path_info; + towards_lock_index_path_info.push(DriveKeyInfo::Key( + RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec(), + ))?; + + self.add_contested_vote_subtree_for_non_identities_operations( + towards_lock_index_path_info, + storage_flags, + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_version, + )?; + } + + Ok(contest_already_existed) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/mod.rs new file mode 100644 index 00000000000..76584f5582f --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/mod.rs @@ -0,0 +1,64 @@ +mod v0; + +use crate::drive::flags::StorageFlags; + +use crate::drive::object_size_info::{DocumentAndContractInfo, PathInfo}; +use crate::drive::Drive; +use crate::error::drive::DriveError; + +use crate::error::Error; +use crate::fee::op::LowLevelDriveOperation; +use dpp::data_contract::document_type::IndexLevel; + +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; + +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Adds indices for an index level and recurses. + pub(crate) fn add_contested_indices_for_index_level_for_contract_operations( + &self, + document_and_contract_info: &DocumentAndContractInfo, + index_path_info: PathInfo<0>, + index_level: &IndexLevel, + any_fields_null: bool, + previous_batch_operations: &mut Option<&mut Vec>, + storage_flags: &Option<&StorageFlags>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + event_id: [u8; 32], + transaction: TransactionArg, + batch_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .document + .insert_contested + .add_contested_indices_for_index_level_for_contract_operations + { + 0 => self.add_contested_indices_for_index_level_for_contract_operations_v0( + document_and_contract_info, + index_path_info, + index_level, + any_fields_null, + previous_batch_operations, + storage_flags, + estimated_costs_only_with_layer_info, + event_id, + transaction, + batch_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_indices_for_index_level_for_contract_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs new file mode 100644 index 00000000000..a989dd3997b --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -0,0 +1,189 @@ +use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; +use crate::drive::flags::StorageFlags; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::drive::object_size_info::DriveKeyInfo::KeyRef; +use crate::drive::object_size_info::{DocumentAndContractInfo, DocumentInfoV0Methods, PathInfo}; +use crate::drive::Drive; +use crate::error::fee::FeeError; +use crate::error::Error; +use crate::fee::op::LowLevelDriveOperation; +use dpp::data_contract::document_type::IndexLevel; + +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Adds indices for an index level and recurses. + #[inline] + pub(super) fn add_contested_indices_for_index_level_for_contract_operations_v0( + &self, + document_and_contract_info: &DocumentAndContractInfo, + index_path_info: PathInfo<0>, + index_level: &IndexLevel, + mut any_fields_null: bool, + previous_batch_operations: &mut Option<&mut Vec>, + storage_flags: &Option<&StorageFlags>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + event_id: [u8; 32], + transaction: TransactionArg, + batch_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + if let Some(index_type) = index_level.has_index_with_type() { + self.add_contested_reference_for_index_level_for_contract_operations( + document_and_contract_info, + index_path_info.clone(), + index_type, + any_fields_null, + previous_batch_operations, + storage_flags, + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + &platform_version.drive, + )?; + } + + let document_type = document_and_contract_info.document_type; + + let sub_level_index_count = index_level.sub_levels().len() as u32; + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + // On this level we will have a 0 and all the top index paths + estimated_costs_only_with_layer_info.insert( + index_path_info.clone().convert_to_key_info_path(), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(sub_level_index_count + 1), + estimated_layer_sizes: AllSubtrees( + DEFAULT_HASH_SIZE_U8, + NoSumTrees, + storage_flags.map(|s| s.serialized_size()), + ), + }, + ); + } + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: false, + flags_len: storage_flags + .map(|s| s.serialized_size()) + .unwrap_or_default(), + } + }; + + // fourth we need to store a reference to the document for each index + for (name, sub_level) in index_level.sub_levels() { + let mut sub_level_index_path_info = index_path_info.clone(); + let index_property_key = KeyRef(name.as_bytes()); + + let document_index_field = document_and_contract_info + .owned_document_info + .document_info + .get_raw_for_document_type( + name, + document_type, + document_and_contract_info.owned_document_info.owner_id, + Some((sub_level, event_id)), + platform_version, + )? + .unwrap_or_default(); + + let path_key_info = index_property_key + .clone() + .add_path_info(sub_level_index_path_info.clone()); + + // here we are inserting an empty tree that will have a subtree of all other index properties + self.batch_insert_empty_tree_if_not_exists( + path_key_info.clone(), + false, + *storage_flags, + apply_type, + transaction, + previous_batch_operations, + batch_operations, + &platform_version.drive, + )?; + + sub_level_index_path_info.push(index_property_key)?; + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info + { + let document_top_field_estimated_size = document_and_contract_info + .owned_document_info + .document_info + .get_estimated_size_for_document_type(name, document_type)?; + + if document_top_field_estimated_size > u8::MAX as u16 { + return Err(Error::Fee(FeeError::Overflow( + "document top field is too big for being an index on delete", + ))); + } + + estimated_costs_only_with_layer_info.insert( + sub_level_index_path_info.clone().convert_to_key_info_path(), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllSubtrees( + document_top_field_estimated_size as u8, + NoSumTrees, + storage_flags.map(|s| s.serialized_size()), + ), + }, + ); + } + + // Iteration 1. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId + // Iteration 2. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId//accountReference + + let path_key_info = document_index_field + .clone() + .add_path_info(sub_level_index_path_info.clone()); + + // here we are inserting an empty tree that will have a subtree of all other index properties + self.batch_insert_empty_tree_if_not_exists( + path_key_info.clone(), + false, + *storage_flags, + apply_type, + transaction, + previous_batch_operations, + batch_operations, + &platform_version.drive, + )?; + + any_fields_null |= document_index_field.is_empty(); + + // we push the actual value of the index path + sub_level_index_path_info.push(document_index_field)?; + // Iteration 1. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId// + // Iteration 2. the index path is now something likeDataContracts/ContractID/Documents(1)/$ownerId//toUserId//accountReference/ + self.add_contested_indices_for_index_level_for_contract_operations( + document_and_contract_info, + sub_level_index_path_info, + sub_level, + any_fields_null, + previous_batch_operations, + storage_flags, + estimated_costs_only_with_layer_info, + event_id, + transaction, + batch_operations, + platform_version, + )?; + } + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/mod.rs new file mode 100644 index 00000000000..c9bbbe92948 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/mod.rs @@ -0,0 +1,54 @@ +mod v0; + +use crate::util::storage_flags::StorageFlags; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::{DocumentAndContractInfo, PathInfo}; +use dpp::version::drive_versions::DriveVersion; + +use grovedb::batch::KeyInfoPath; + +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Adds the terminal reference. + pub fn add_contested_reference_and_vote_subtree_to_document_operations( + &self, + document_and_contract_info: &DocumentAndContractInfo, + index_path_info: PathInfo<0>, + storage_flags: Option<&StorageFlags>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .document + .insert_contested + .add_contested_reference_and_vote_subtree_to_document_operations + { + 0 => self.add_contested_reference_and_vote_subtree_to_document_operations_v0( + document_and_contract_info, + index_path_info, + storage_flags, + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_reference_for_index_level_for_contract_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs new file mode 100644 index 00000000000..9caf559b176 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs @@ -0,0 +1,186 @@ +use crate::drive::constants::{CONTESTED_DOCUMENT_REFERENCE_SIZE, STORAGE_FLAGS_SIZE}; +use crate::drive::document::make_document_contested_reference; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::DocumentInfo::{ + DocumentAndSerialization, DocumentEstimatedAverageSize, DocumentOwnedInfo, + DocumentRefAndSerialization, DocumentRefInfo, +}; +use crate::util::object_size_info::DriveKeyInfo::KeyRef; +use crate::util::object_size_info::KeyElementInfo::{KeyElement, KeyUnknownElementSize}; +use crate::util::object_size_info::{DocumentAndContractInfo, PathInfo, PathKeyElementInfo}; +use crate::util::storage_flags::StorageFlags; +use crate::util::type_constants::{DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, U8_SIZE_U8}; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerSizes::{AllItems, Mix}; +use grovedb::EstimatedSumTrees::AllSumTrees; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Adds the terminal reference. + #[inline(always)] + pub(super) fn add_contested_reference_and_vote_subtree_to_document_operations_v0( + &self, + document_and_contract_info: &DocumentAndContractInfo, + index_path_info: PathInfo<0>, + storage_flags: Option<&StorageFlags>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + // Inter-wizard championship (event type) + // | + // Goblet of Fire (event name) + // / \ + // Sam's ID Ivan's ID + // / \ / \ + // 0 (ref) 1 (sum tree) 0 (ref) 1 (sum tree) <---- We now need to insert at this level + // + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + // On this level we will have all the identities + estimated_costs_only_with_layer_info.insert( + index_path_info.clone().convert_to_key_info_path(), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(2), + estimated_layer_sizes: Mix { + // The votes don't have storage flags + subtrees_size: Some(( + U8_SIZE_U8, + AllSumTrees, // There is 1 tree that is a sum tree, so all are sum trees + None, + 1, + )), + items_size: None, + // The references do have storage flags + // We keep storage flags because when the item is moved after being won, + // a transformation needs to take place on the storage flags to be able to + // allow the refund of credits on delete later. + references_size: Some(( + U8_SIZE_U8, + CONTESTED_DOCUMENT_REFERENCE_SIZE, + storage_flags.map(|s| s.serialized_size()), + 1, + )), + }, + }, + ); + } + + // We create the reference + + // Here we are getting the document id and the reference + let ref_key_element_info = + match &document_and_contract_info.owned_document_info.document_info { + DocumentRefAndSerialization((document, _, storage_flags)) + | DocumentRefInfo((document, storage_flags)) => { + let document_reference = make_document_contested_reference( + document, + storage_flags.as_ref().map(|flags| flags.as_ref()), + ); + KeyElement((&[0], document_reference)) + } + DocumentOwnedInfo((document, storage_flags)) + | DocumentAndSerialization((document, _, storage_flags)) => { + let document_reference = make_document_contested_reference( + document, + storage_flags.as_ref().map(|flags| flags.as_ref()), + ); + KeyElement((&[0], document_reference)) + } + DocumentEstimatedAverageSize(max_size) => { + let unique_id = document_and_contract_info + .document_type + .unique_id_for_storage() + .to_vec(); + KeyUnknownElementSize(( + KeyInfo::MaxKeySize { + unique_id, + max_size: DEFAULT_HASH_SIZE_U8, + }, + Element::required_item_space( + *max_size, + STORAGE_FLAGS_SIZE, + &drive_version.grove_version, + )?, + )) + } + }; + + // Now let's insert the reference, the reference is a key element that already has the 0 + + let reference_path_key_element_info = PathKeyElementInfo::from_path_info_and_key_element( + index_path_info.clone(), + ref_key_element_info, + )?; + + // here we are inserting the ref + self.batch_insert( + reference_path_key_element_info, + batch_operations, + drive_version, + )?; + + // Let's insert the voting tree + + let votes_key_path_info = KeyRef(&[1]); + + let votes_path_key_info = votes_key_path_info.add_path_info(index_path_info.clone()); + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + // On this level we will have a 0 and all the top index paths + estimated_costs_only_with_layer_info.insert( + votes_path_key_info.clone().convert_to_key_info_path()?, + EstimatedLayerInformation { + is_sum_tree: true, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, None), + }, + ); + } + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: true, + flags_len: storage_flags + .map(|s| s.serialized_size()) + .unwrap_or_default(), + } + }; + + // here we are the tree that will contain the voting tree + let inserted = self.batch_insert_empty_tree_if_not_exists( + votes_path_key_info, + true, + storage_flags, + apply_type, + transaction, + &mut None, + batch_operations, + drive_version, + )?; + + if !inserted { + return Err(Error::Drive(DriveError::CorruptedContractIndexes( + "contested votes tree already exists", + ))); + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/mod.rs new file mode 100644 index 00000000000..e2461f5c489 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/mod.rs @@ -0,0 +1,51 @@ +mod v0; + +use crate::util::storage_flags::StorageFlags; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathInfo; +use dpp::version::drive_versions::DriveVersion; + +use grovedb::batch::KeyInfoPath; + +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Adds the contested vote subtree + pub fn add_contested_vote_subtree_for_non_identities_operations( + &self, + index_path_info: PathInfo<0>, + storage_flags: Option<&StorageFlags>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .document + .insert_contested + .add_contested_vote_subtree_for_non_identities_operations + { + 0 => self.add_contested_vote_subtree_for_non_identities_operations_v0( + index_path_info, + storage_flags, + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_contested_vote_subtree_for_non_identities_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs new file mode 100644 index 00000000000..21439d39c01 --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs @@ -0,0 +1,113 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::DriveKeyInfo::KeyRef; +use crate::util::object_size_info::PathInfo; +use crate::util::storage_flags::StorageFlags; +use crate::util::type_constants::{DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, U8_SIZE_U8}; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerSizes::{AllItems, Mix}; +use grovedb::EstimatedSumTrees::AllSumTrees; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Adds the contested vote subtree + #[inline(always)] + pub(super) fn add_contested_vote_subtree_for_non_identities_operations_v0( + &self, + index_path_info: PathInfo<0>, + storage_flags: Option<&StorageFlags>, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + // Inter-wizard championship (event type) + // | + // Goblet of Fire (event name) + // / \ + // Lock Abstain + // \ \ + // 1 (sum tree) 1 (sum tree) <---- We now need to insert at this level + // + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + // On this level we will have all the identities + estimated_costs_only_with_layer_info.insert( + index_path_info.clone().convert_to_key_info_path(), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(1), + estimated_layer_sizes: Mix { + // The votes don't have storage flags + subtrees_size: Some(( + U8_SIZE_U8, + AllSumTrees, // There is 1 tree that is a sum tree, so all are sum trees + None, + 1, + )), + items_size: None, + references_size: None, + }, + }, + ); + } + + // Let's insert the voting tree + + let votes_key_path_info = KeyRef(&[1]); + + let votes_path_key_info = votes_key_path_info.add_path_info(index_path_info.clone()); + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + // On this level we will have a 0 and all the top index paths + estimated_costs_only_with_layer_info.insert( + votes_path_key_info.clone().convert_to_key_info_path()?, + EstimatedLayerInformation { + is_sum_tree: true, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, None), + }, + ); + } + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: true, + flags_len: storage_flags + .map(|s| s.serialized_size()) + .unwrap_or_default(), + } + }; + + // here we are the tree that will contain the voting tree + let inserted = self.batch_insert_empty_tree_if_not_exists( + votes_path_key_info, + true, + storage_flags, + apply_type, + transaction, + &mut None, + batch_operations, + drive_version, + )?; + + if !inserted { + return Err(Error::Drive(DriveError::CorruptedContractIndexes( + "contested votes tree already exists for a non identity (abstain or lock)", + ))); + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/document/insert_contested/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/mod.rs new file mode 100644 index 00000000000..7d38f3c056a --- /dev/null +++ b/packages/rs-drive/src/drive/document/insert_contested/mod.rs @@ -0,0 +1,135 @@ +//! Insert Documents. +//! +//! This module implements functions in Drive relevant to inserting documents. +//! + +// Module: add_contested_document +// This module contains functionality for adding a document +mod add_contested_document; + +// Module: add_contested_document_for_contract +// This module contains functionality for adding a document for a given contract +mod add_contested_document_for_contract; + +// Module: add_contested_document_for_contract_apply_and_add_to_operations +// This module contains functionality for applying and adding operations for a contract document +mod add_contested_document_for_contract_apply_and_add_to_operations; + +// Module: add_contested_document_for_contract_operations +// This module contains functionality for adding a document for contract operations +mod add_contested_document_for_contract_operations; + +// Module: add_contested_document_to_primary_storage +// This module contains functionality for adding a document to primary storage +mod add_contested_document_to_primary_storage; + +// Module: add_contested_indices_for_index_level_for_contract_operations +// This module contains functionality for adding indices for an index level for contract operations +// mod add_contested_indices_for_index_level_for_contract_operations; + +// Module: add_contested_indices_for_top_index_level_for_contract_operations +// This module contains functionality for adding indices for the top index level for contract operations +mod add_contested_indices_for_contract_operations; + +// Module: add_contested_reference_and_vote_subtree_to_document_operations +// This module contains functionality for adding a reference for an index level for contract operations +mod add_contested_reference_and_vote_subtree_to_document_operations; +mod add_contested_vote_subtrees_for_non_identities_operations; + +#[cfg(all( + feature = "fixtures-and-mocks", + feature = "data-contract-cbor-conversion" +))] +use dpp::data_contract::conversion::cbor::DataContractCborConversionMethodsV0; + +#[cfg(test)] +mod tests { + use std::option::Option::None; + + use dpp::block::block_info::BlockInfo; + use rand::random; + + use crate::drive::document::tests::setup_dashpay; + use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; + use crate::util::storage_flags::StorageFlags; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + + use crate::util::object_size_info::DocumentInfo::DocumentRefInfo; + use dpp::tests::json_document::json_document_to_document; + use dpp::version::PlatformVersion; + + #[test] + fn test_add_dashpay_conflicting_unique_index_documents() { + let (drive, dashpay) = setup_dashpay("add_conflict", true); + + let document_type = dashpay + .document_type_for_name("contactRequest") + .expect("expected to get document type"); + + let random_owner_id = random::<[u8; 32]>(); + + let platform_version = PlatformVersion::first(); + + let dashpay_cr_document_0 = json_document_to_document( + "tests/supporting_files/contract/dashpay/contact-request0.json", + Some(random_owner_id.into()), + document_type, + platform_version, + ) + .expect("expected to get cbor document"); + + let dashpay_cr_document_0_dup = json_document_to_document( + "tests/supporting_files/contract/dashpay/contact-request0-dup-unique-index.json", + Some(random_owner_id.into()), + document_type, + platform_version, + ) + .expect("expected to get cbor document"); + + drive + .add_document_for_contract( + DocumentAndContractInfo { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &dashpay_cr_document_0, + StorageFlags::optional_default_as_cow(), + )), + owner_id: None, + }, + contract: &dashpay, + document_type, + }, + false, + BlockInfo::default(), + true, + None, + platform_version, + None, + ) + .expect("expected to insert a document successfully"); + + drive + .add_document_for_contract( + DocumentAndContractInfo { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &dashpay_cr_document_0_dup, + StorageFlags::optional_default_as_cow(), + )), + owner_id: None, + }, + contract: &dashpay, + document_type, + }, + false, + BlockInfo::default(), + true, + None, + platform_version, + None, + ) + .expect_err( + "expected not to be able to insert document with already existing unique index", + ); + } +} diff --git a/packages/rs-drive/src/drive/document/mod.rs b/packages/rs-drive/src/drive/document/mod.rs index c177970be26..08a8a4be489 100644 --- a/packages/rs-drive/src/drive/document/mod.rs +++ b/packages/rs-drive/src/drive/document/mod.rs @@ -1,170 +1,46 @@ -// MIT LICENSE -// -// Copyright (c) 2022 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! General Drive Document Functions //! //! This module defines general functions relevant to Documents in Drive. //! Namely functions to return the paths to certain objects and the path sizes. //! -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; -#[cfg(feature = "full")] -use crate::drive::flags::StorageFlags; -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::{defaults, RootTree}; +#[cfg(feature = "server")] +use crate::drive::votes::paths::CONTESTED_DOCUMENT_STORAGE_TREE_KEY; +#[cfg(feature = "server")] +use crate::util::storage_flags::StorageFlags; +#[cfg(feature = "server")] use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(feature = "server")] use dpp::data_contract::document_type::DocumentTypeRef; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::document::Document; +#[cfg(feature = "server")] use dpp::document::DocumentV0Getters; -#[cfg(feature = "full")] -use grovedb::batch::key_info::KeyInfo; -#[cfg(feature = "full")] -use grovedb::batch::KeyInfoPath; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use grovedb::reference_path::ReferencePathType::UpstreamRootHeightReference; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use grovedb::Element; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod delete; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod estimation_costs; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod index_uniqueness; -#[cfg(any(feature = "full", feature = "fixtures-and-mocks"))] +#[cfg(any(feature = "server", feature = "fixtures-and-mocks"))] mod insert; -#[cfg(any(feature = "full", feature = "fixtures-and-mocks"))] +#[cfg(any(feature = "server", feature = "fixtures-and-mocks"))] +mod insert_contested; +#[cfg(any(feature = "server", feature = "fixtures-and-mocks"))] pub mod query; -#[cfg(any(feature = "full", feature = "fixtures-and-mocks"))] +#[cfg(any(feature = "server", feature = "fixtures-and-mocks"))] mod update; -#[cfg(any(feature = "full", feature = "verify"))] -/// Returns the path to a contract document type. -pub(crate) fn contract_document_type_path<'a>( - contract_id: &'a [u8; 32], - document_type_name: &'a str, -) -> [&'a [u8]; 4] { - [ - Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), - contract_id, - &[1], - document_type_name.as_bytes(), - ] -} +/// paths +#[cfg(any(feature = "server", feature = "verify"))] +pub mod paths; -#[cfg(any(feature = "full", feature = "verify"))] -/// Returns the path to a contract document type. -pub(crate) fn contract_document_type_path_vec( - contract_id: &[u8], - document_type_name: &str, -) -> Vec> { - vec![ - vec![RootTree::DataContractDocuments as u8], - contract_id.to_vec(), - vec![1u8], - document_type_name.as_bytes().to_vec(), - ] -} - -#[cfg(any(feature = "full", feature = "verify"))] -/// Returns the path to the primary keys of a contract document type. -pub(crate) fn contract_documents_primary_key_path<'a>( - contract_id: &'a [u8], - document_type_name: &'a str, -) -> [&'a [u8]; 5] { - [ - Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), // 1 - contract_id, // 32 - &[1], // 1 - document_type_name.as_bytes(), - &[0], // 1 - ] -} - -#[cfg(any(feature = "full", feature = "verify"))] -/// Returns the path to a contract document. -fn contract_documents_keeping_history_primary_key_path_for_document_id<'a>( - contract_id: &'a [u8], - document_type_name: &'a str, - document_id: &'a [u8], -) -> [&'a [u8]; 6] { - [ - Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), - contract_id, - &[1], - document_type_name.as_bytes(), - &[0], - document_id, - ] -} - -#[cfg(feature = "full")] -/// Returns the path to a contract document when the document id isn't known. -fn contract_documents_keeping_history_primary_key_path_for_unknown_document_id( - contract_id: &[u8], - document_type: DocumentTypeRef, -) -> KeyInfoPath { - let mut key_info_path = KeyInfoPath::from_known_path(contract_documents_primary_key_path( - contract_id, - document_type.name().as_str(), - )); - key_info_path.push(KeyInfo::MaxKeySize { - unique_id: document_type.unique_id_for_storage().to_vec(), - max_size: DEFAULT_HASH_SIZE_U8, - }); - key_info_path -} - -#[cfg(any(feature = "full", feature = "verify"))] -#[allow(dead_code)] -/// Returns the size of the path to a contract document. -fn contract_documents_keeping_history_primary_key_path_for_document_id_size( - document_type_name_len: u32, -) -> u32 { - defaults::BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_PRIMARY_KEY_PATH_FOR_DOCUMENT_ID_SIZE - + document_type_name_len -} - -#[cfg(any(feature = "full", feature = "verify"))] -/// Returns the size of the path to the time at which a document type was stored. -fn contract_documents_keeping_history_storage_time_reference_path_size( - document_type_name_len: u32, -) -> u32 { - defaults::BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_STORAGE_TIME_REFERENCE_PATH - + document_type_name_len -} - -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Creates a reference to a document. fn make_document_reference( document: &Document, @@ -199,7 +75,40 @@ fn make_document_reference( ) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] +/// Creates a reference to a contested document. +fn make_document_contested_reference( + document: &Document, + storage_flags: Option<&StorageFlags>, +) -> Element { + // we need to construct the reference from the split height of the contract document + // type which is at 5 for the contested tree + // 0 represents document storage + // Then we add document id + // Then we add 0 if the document type keys history + let reference_path = vec![ + vec![CONTESTED_DOCUMENT_STORAGE_TREE_KEY], + document.id().to_vec(), + ]; + let max_reference_hops = 1; + // 2 because the contract could allow for history + // 5 because + // -VotesTree + // -ContestedResourceTree + // -ActivePolls + // -DataContract ID + // - DocumentType + // We add 2 + // - 0 Storage + // - Document id + Element::Reference( + UpstreamRootHeightReference(5, reference_path), + Some(max_reference_hops), + StorageFlags::map_to_some_element_flags(storage_flags), + ) +} + +#[cfg(feature = "server")] /// size of a document reference. fn document_reference_size(document_type: DocumentTypeRef) -> u32 { // we need to construct the reference from the split height of the contract document @@ -224,26 +133,24 @@ fn document_reference_size(document_type: DocumentTypeRef) -> u32 { 6 + reference_path_size } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn unique_event_id() -> [u8; 32] { rand::random::<[u8; 32]>() } /// Tests module -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] pub(crate) mod tests { use std::option::Option::None; - use tempfile::TempDir; - - use crate::drive::flags::StorageFlags; use crate::drive::Drive; + use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::prelude::DataContract; use dpp::tests::json_document::json_document_to_contract; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::version::PlatformVersion; /// Setup Dashpay diff --git a/packages/rs-drive/src/drive/document/paths.rs b/packages/rs-drive/src/drive/document/paths.rs new file mode 100644 index 00000000000..9fa8b56772f --- /dev/null +++ b/packages/rs-drive/src/drive/document/paths.rs @@ -0,0 +1,107 @@ +use crate::drive::{constants, RootTree}; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "server")] +use grovedb::batch::key_info::KeyInfo; +#[cfg(feature = "server")] +use grovedb::batch::KeyInfoPath; + +#[cfg(any(feature = "server", feature = "verify"))] +/// Returns the path to a contract document type. +pub(crate) fn contract_document_type_path<'a>( + contract_id: &'a [u8; 32], + document_type_name: &'a str, +) -> [&'a [u8]; 4] { + [ + Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), + contract_id, + &[1], + document_type_name.as_bytes(), + ] +} + +#[cfg(any(feature = "server", feature = "verify"))] +/// Returns the path to a contract document type. +pub(crate) fn contract_document_type_path_vec( + contract_id: &[u8], + document_type_name: &str, +) -> Vec> { + vec![ + vec![RootTree::DataContractDocuments as u8], + contract_id.to_vec(), + vec![1u8], + document_type_name.as_bytes().to_vec(), + ] +} + +#[cfg(any(feature = "server", feature = "verify"))] +/// Returns the path to the primary keys of a contract document type. +pub(crate) fn contract_documents_primary_key_path<'a>( + contract_id: &'a [u8], + document_type_name: &'a str, +) -> [&'a [u8]; 5] { + [ + Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), // 1 + contract_id, // 32 + &[1], // 1 + document_type_name.as_bytes(), + &[0], // 1 + ] +} + +#[cfg(any(feature = "server", feature = "verify"))] +/// Returns the path to a contract document. +pub fn contract_documents_keeping_history_primary_key_path_for_document_id<'a>( + contract_id: &'a [u8], + document_type_name: &'a str, + document_id: &'a [u8], +) -> [&'a [u8]; 6] { + [ + Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), + contract_id, + &[1], + document_type_name.as_bytes(), + &[0], + document_id, + ] +} + +#[cfg(feature = "server")] +/// Returns the path to a contract document when the document id isn't known. +pub fn contract_documents_keeping_history_primary_key_path_for_unknown_document_id( + contract_id: &[u8], + document_type: DocumentTypeRef, +) -> KeyInfoPath { + let mut key_info_path = KeyInfoPath::from_known_path(contract_documents_primary_key_path( + contract_id, + document_type.name().as_str(), + )); + key_info_path.push(KeyInfo::MaxKeySize { + unique_id: document_type.unique_id_for_storage().to_vec(), + max_size: DEFAULT_HASH_SIZE_U8, + }); + key_info_path +} + +#[cfg(any(feature = "server", feature = "verify"))] +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] +/// Returns the size of the path to a contract document. +fn contract_documents_keeping_history_primary_key_path_for_document_id_size( + document_type_name_len: u32, +) -> u32 { + constants::BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_PRIMARY_KEY_PATH_FOR_DOCUMENT_ID_SIZE + + document_type_name_len +} + +#[cfg(any(feature = "server", feature = "verify"))] +/// Returns the size of the path to the time at which a document type was stored. +pub fn contract_documents_keeping_history_storage_time_reference_path_size( + document_type_name_len: u32, +) -> u32 { + constants::BASE_CONTRACT_DOCUMENTS_KEEPING_HISTORY_STORAGE_TIME_REFERENCE_PATH + + document_type_name_len +} diff --git a/packages/rs-drive/src/drive/document/query/mod.rs b/packages/rs-drive/src/drive/document/query/mod.rs index ac0f06a31a3..cd75afdde3c 100644 --- a/packages/rs-drive/src/drive/document/query/mod.rs +++ b/packages/rs-drive/src/drive/document/query/mod.rs @@ -1,44 +1,18 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Drive Queries //! //! Defines and implements in Drive functions relevant to querying. //! +mod query_contested_documents_vote_state; mod query_documents; + pub use query_documents::*; -#[cfg(feature = "fixtures-and-mocks")] +#[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] use dpp::block::block_info::BlockInfo; #[cfg(feature = "fixtures-and-mocks")] use dpp::block::epoch::Epoch; +#[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] use dpp::data_contract::accessors::v0::DataContractV0Getters; #[cfg(feature = "fixtures-and-mocks")] #[cfg(feature = "fixtures-and-mocks")] @@ -46,25 +20,28 @@ use grovedb::TransactionArg; use crate::drive::Drive; -#[cfg(feature = "fixtures-and-mocks")] +#[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] use crate::error::query::QuerySyntaxError; #[cfg(feature = "fixtures-and-mocks")] use crate::error::Error; #[cfg(feature = "fixtures-and-mocks")] -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; #[cfg(feature = "fixtures-and-mocks")] -use crate::query::DriveQuery; +use crate::query::DriveDocumentQuery; +#[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] +use crate::verify::RootHash; #[cfg(all( feature = "fixtures-and-mocks", feature = "data-contract-cbor-conversion" ))] use dpp::data_contract::conversion::cbor::DataContractCborConversionMethodsV0; -#[cfg(feature = "fixtures-and-mocks")] +#[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] use dpp::data_contract::document_type::DocumentTypeRef; -#[cfg(feature = "fixtures-and-mocks")] +#[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] use dpp::data_contract::DataContract; #[cfg(feature = "fixtures-and-mocks")] use dpp::version::PlatformVersion; +#[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] use dpp::version::PlatformVersionCurrentVersion; // TODO: Not using @@ -131,7 +108,7 @@ impl Drive { // }) // } - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] /// Performs and returns the result of the specified query along with skipped items and the cost. pub fn query_raw_documents_from_contract_cbor_using_cbor_encoded_query_with_cost( &self, @@ -162,6 +139,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -170,7 +148,7 @@ impl Drive { Ok((items, skipped, cost)) } - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] /// Performs and returns the result of the specified query along with the fee. /// Proof is generated. pub fn query_proof_of_documents_using_contract_id_using_cbor_encoded_query_with_cost( @@ -215,6 +193,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -223,7 +202,7 @@ impl Drive { Ok((items, cost)) } - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] /// Performs and returns the result of the specified query along with the fee. /// Proof is generated. pub fn query_proof_of_documents_using_cbor_encoded_query_with_cost( @@ -253,6 +232,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -261,7 +241,7 @@ impl Drive { Ok((items, cost)) } - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] /// Performs and returns the result of the specified internal query. /// Proof is generated. pub(crate) fn query_proof_of_documents_using_cbor_encoded_query( @@ -274,12 +254,13 @@ impl Drive { protocol_version: Option, ) -> Result, Error> { let platform_version = PlatformVersion::get_version_or_current_or_latest(protocol_version)?; - let query = DriveQuery::from_cbor(query_cbor, contract, document_type, &self.config)?; + let query = + DriveDocumentQuery::from_cbor(query_cbor, contract, document_type, &self.config)?; query.execute_with_proof_internal(self, transaction, drive_operations, platform_version) } - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] /// Performs the specified internal query and returns the root hash, values, and fee. pub fn query_proof_of_documents_using_cbor_encoded_query_only_get_elements( &self, @@ -289,7 +270,7 @@ impl Drive { block_info: Option, transaction: TransactionArg, protocol_version: Option, - ) -> Result<([u8; 32], Vec>, u64), Error> { + ) -> Result<(RootHash, Vec>, u64), Error> { let platform_version = PlatformVersion::get_version_or_current_or_latest(protocol_version)?; let mut drive_operations: Vec = vec![]; @@ -309,6 +290,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -318,7 +300,7 @@ impl Drive { } /// Performs the specified internal query and returns the root hash and values. - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] pub(crate) fn query_proof_of_documents_using_cbor_encoded_query_only_get_elements_internal( &self, contract: &DataContract, @@ -327,9 +309,10 @@ impl Drive { transaction: TransactionArg, drive_operations: &mut Vec, protocol_version: Option, - ) -> Result<([u8; 32], Vec>), Error> { + ) -> Result<(RootHash, Vec>), Error> { let platform_version = PlatformVersion::get_version_or_current_or_latest(protocol_version)?; - let query = DriveQuery::from_cbor(query_cbor, contract, document_type, &self.config)?; + let query = + DriveDocumentQuery::from_cbor(query_cbor, contract, document_type, &self.config)?; query.execute_with_proof_only_get_elements_internal( self, @@ -340,7 +323,7 @@ impl Drive { } /// Performs and returns the result of the specified query along with skipped items and the cost. - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] pub fn query_documents_cbor_from_contract( &self, contract: &DataContract, @@ -367,6 +350,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -375,7 +359,7 @@ impl Drive { Ok((items, skipped, cost)) } - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] /// Performs and returns the result of the specified query along with skipped items and the cost. pub fn query_documents_cbor_with_document_type_lookup( &self, @@ -404,13 +388,17 @@ impl Drive { .contract .document_type_for_name(document_type_name)?; - let query = - DriveQuery::from_cbor(query_cbor, &contract.contract, document_type, &self.config)?; + let query = DriveDocumentQuery::from_cbor( + query_cbor, + &contract.contract, + document_type, + &self.config, + )?; self.query_serialized_documents(query, epoch, transaction, platform_version) } - #[cfg(feature = "fixtures-and-mocks")] + #[cfg(all(feature = "fixtures-and-mocks", feature = "cbor_query"))] /// Performs and returns the result of the specified query along with skipped items. pub fn query_documents_for_cbor_query_internal( &self, @@ -422,7 +410,8 @@ impl Drive { protocol_version: Option, ) -> Result<(Vec>, u16), Error> { let platform_version = PlatformVersion::get_version_or_current_or_latest(protocol_version)?; - let query = DriveQuery::from_cbor(query_cbor, contract, document_type, &self.config)?; + let query = + DriveDocumentQuery::from_cbor(query_cbor, contract, document_type, &self.config)?; query.execute_raw_results_no_proof_internal( self, @@ -437,7 +426,7 @@ impl Drive { /// and the cost. pub fn query_serialized_documents( &self, - query: DriveQuery, + query: DriveDocumentQuery, epoch: Option<&Epoch>, transaction: TransactionArg, platform_version: &PlatformVersion, @@ -456,6 +445,7 @@ impl Drive { epoch, self.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { diff --git a/packages/rs-drive/src/drive/document/query/query_contested_documents_vote_state/mod.rs b/packages/rs-drive/src/drive/document/query/query_contested_documents_vote_state/mod.rs new file mode 100644 index 00000000000..aaf7d749361 --- /dev/null +++ b/packages/rs-drive/src/drive/document/query/query_contested_documents_vote_state/mod.rs @@ -0,0 +1,93 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use derive_more::From; +use dpp::block::epoch::Epoch; +use dpp::version::{PlatformVersion, PlatformVersionCurrentVersion}; +use dpp::voting::contender_structs::ContenderWithSerializedDocument; +use grovedb::TransactionArg; + +mod v0; + +use crate::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQuery; +pub use v0::*; + +/// Represents the outcome of a query to retrieve documents. +/// +/// This enum provides versioning for the outcomes of querying documents. +/// As the system evolves, new versions of the outcome structure can be +/// added to this enum without breaking existing implementations. +#[derive(From, Debug)] +pub enum QueryContestedDocumentsVoteStateOutcome { + /// Version 0 of the `QueryDocumentsOutcome`. + /// + /// This version contains a list of documents retrieved, the number of + /// skipped documents, and the cost associated with the query. + V0(QueryContestedDocumentsVoteStateOutcomeV0), +} + +impl QueryContestedDocumentsVoteStateOutcomeV0Methods for QueryContestedDocumentsVoteStateOutcome { + fn contenders(&self) -> &Vec { + match self { + QueryContestedDocumentsVoteStateOutcome::V0(outcome) => outcome.contenders(), + } + } + + fn contenders_owned(self) -> Vec { + match self { + QueryContestedDocumentsVoteStateOutcome::V0(outcome) => outcome.contenders_owned(), + } + } + + fn cost(&self) -> u64 { + match self { + QueryContestedDocumentsVoteStateOutcome::V0(outcome) => outcome.cost(), + } + } +} + +impl Drive { + /// Performs a specified drive query and returns the result, along with any skipped items and the cost. + /// + /// This function is used to execute a given [DriveQuery]. It has options to operate in a dry-run mode + /// and supports different protocol versions. In case an epoch is specified, it calculates the fee. + /// + /// # Arguments + /// + /// * `query` - The [DriveQuery] being executed. + /// * `epoch` - An `Option<&Epoch>`. If provided, it will be used to calculate the processing fee. + /// * `dry_run` - If true, the function will not perform any actual operation and return a default `QueryDocumentsOutcome`. + /// * `transaction` - The `TransactionArg` holding the transaction data. + /// * `protocol_version` - An `Option` representing the protocol version. If not provided, the function falls back + /// to current or latest version. + /// + /// # Returns + /// + /// * `Result` - Returns `QueryDocumentsOutcome` on success with the list of documents, + /// number of skipped items, and cost. If the operation fails, it returns an `Error`. + pub fn query_contested_documents_vote_state( + &self, + query: ContestedDocumentVotePollDriveQuery, + epoch: Option<&Epoch>, + transaction: TransactionArg, + protocol_version: Option, + ) -> Result { + let platform_version = PlatformVersion::get_version_or_current_or_latest(protocol_version)?; + + match platform_version + .drive + .methods + .document + .query + .query_documents + { + 0 => self.query_contested_documents_v0(query, epoch, transaction, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "query_documents".to_string(), + known_versions: vec![0], + received: version, + })), + } + .map(|outcome| outcome.into()) + } +} diff --git a/packages/rs-drive/src/drive/document/query/query_contested_documents_vote_state/v0/mod.rs b/packages/rs-drive/src/drive/document/query/query_contested_documents_vote_state/v0/mod.rs new file mode 100644 index 00000000000..105d93da60c --- /dev/null +++ b/packages/rs-drive/src/drive/document/query/query_contested_documents_vote_state/v0/mod.rs @@ -0,0 +1,96 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQuery; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; +use dpp::voting::contender_structs::ContenderWithSerializedDocument; +use grovedb::TransactionArg; + +/// The outcome of a query +#[derive(Debug, Default)] +pub struct QueryContestedDocumentsVoteStateOutcomeV0 { + contenders: Vec, + cost: u64, +} + +/// Trait defining methods associated with `QueryDocumentsOutcomeV0`. +/// +/// This trait provides a set of methods to interact with and retrieve +/// details from an instance of `QueryDocumentsOutcomeV0`. These methods +/// include retrieving the documents, skipped count, and the associated cost +/// of the query. +pub trait QueryContestedDocumentsVoteStateOutcomeV0Methods { + /// Returns a reference to the contenders found from the query. + fn contenders(&self) -> &Vec; + /// Consumes the instance to return the owned contenders. + fn contenders_owned(self) -> Vec; + /// Returns the processing cost associated with the query. + fn cost(&self) -> u64; +} + +impl QueryContestedDocumentsVoteStateOutcomeV0Methods + for QueryContestedDocumentsVoteStateOutcomeV0 +{ + fn contenders(&self) -> &Vec { + &self.contenders + } + + fn contenders_owned(self) -> Vec { + self.contenders + } + + fn cost(&self) -> u64 { + self.cost + } +} + +impl Drive { + /// Performs a specified drive query and returns the result, along with any skipped items and the cost. + /// + /// This function is used to execute a given [DriveQuery]. It has options to operate in a dry-run mode + /// and supports different protocol versions. In case an epoch is specified, it calculates the fee. + /// + /// # Arguments + /// + /// * `query` - The [DriveQuery] being executed. + /// * `epoch` - An `Option<&Epoch>`. If provided, it will be used to calculate the processing fee. + /// * `dry_run` - If true, the function will not perform any actual operation and return a default `QueryDocumentsOutcome`. + /// * `transaction` - The `TransactionArg` holding the transaction data. + /// * `platform_version` - A reference to the `PlatformVersion` object specifying the version of functions to call. + /// + /// # Returns + /// + /// * `Result` - Returns `QueryDocumentsOutcome` on success with the list of documents, + /// number of skipped items, and cost. If the operation fails, it returns an `Error`. + #[inline(always)] + pub(super) fn query_contested_documents_v0( + &self, + query: ContestedDocumentVotePollDriveQuery, + epoch: Option<&Epoch>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let mut drive_operations: Vec = vec![]; + let contested_document_vote_poll_drive_query_execution_result = + query.execute_no_proof(self, transaction, &mut drive_operations, platform_version)?; + let cost = if let Some(epoch) = epoch { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + + Ok(QueryContestedDocumentsVoteStateOutcomeV0 { + contenders: contested_document_vote_poll_drive_query_execution_result.contenders, + cost, + }) + } +} diff --git a/packages/rs-drive/src/drive/document/query/query_documents/mod.rs b/packages/rs-drive/src/drive/document/query/query_documents/mod.rs index 362ddf218c5..d29b3a171c6 100644 --- a/packages/rs-drive/src/drive/document/query/query_documents/mod.rs +++ b/packages/rs-drive/src/drive/document/query/query_documents/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::document::query::query_documents::v0::QueryDocumentsOutcomeV0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::query::DriveQuery; +use crate::query::DriveDocumentQuery; +use derive_more::From; use dpp::block::epoch::Epoch; use dpp::document::Document; use dpp::version::{PlatformVersion, PlatformVersionCurrentVersion}; @@ -17,6 +17,7 @@ pub use v0::*; /// This enum provides versioning for the outcomes of querying documents. /// As the system evolves, new versions of the outcome structure can be /// added to this enum without breaking existing implementations. +#[derive(From, Debug)] pub enum QueryDocumentsOutcome { /// Version 0 of the `QueryDocumentsOutcome`. /// @@ -54,12 +55,12 @@ impl QueryDocumentsOutcomeV0Methods for QueryDocumentsOutcome { impl Drive { /// Performs a specified drive query and returns the result, along with any skipped items and the cost. /// - /// This function is used to execute a given [DriveQuery]. It has options to operate in a dry-run mode + /// This function is used to execute a given [DriveDocumentQuery]. It has options to operate in a dry-run mode /// and supports different protocol versions. In case an epoch is specified, it calculates the fee. /// /// # Arguments /// - /// * `query` - The [DriveQuery] being executed. + /// * `query` - The [DriveDocumentQuery] being executed. /// * `epoch` - An `Option<&Epoch>`. If provided, it will be used to calculate the processing fee. /// * `dry_run` - If true, the function will not perform any actual operation and return a default `QueryDocumentsOutcome`. /// * `transaction` - The `TransactionArg` holding the transaction data. @@ -72,7 +73,7 @@ impl Drive { /// number of skipped items, and cost. If the operation fails, it returns an `Error`. pub fn query_documents( &self, - query: DriveQuery, + query: DriveDocumentQuery, epoch: Option<&Epoch>, dry_run: bool, transaction: TransactionArg, diff --git a/packages/rs-drive/src/drive/document/query/query_documents/v0/mod.rs b/packages/rs-drive/src/drive/document/query/query_documents/v0/mod.rs index 3a82270ddb4..b41ae676a23 100644 --- a/packages/rs-drive/src/drive/document/query/query_documents/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/query/query_documents/v0/mod.rs @@ -1,8 +1,7 @@ -use crate::drive::document::query::query_documents::QueryDocumentsOutcome; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::query::DriveQuery; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::DriveDocumentQuery; use dpp::block::epoch::Epoch; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::Document; @@ -53,21 +52,15 @@ impl QueryDocumentsOutcomeV0Methods for QueryDocumentsOutcomeV0 { } } -impl From for QueryDocumentsOutcome { - fn from(val: QueryDocumentsOutcomeV0) -> Self { - QueryDocumentsOutcome::V0(val) - } -} - impl Drive { /// Performs a specified drive query and returns the result, along with any skipped items and the cost. /// - /// This function is used to execute a given [DriveQuery]. It has options to operate in a dry-run mode + /// This function is used to execute a given [DriveDocumentQuery]. It has options to operate in a dry-run mode /// and supports different protocol versions. In case an epoch is specified, it calculates the fee. /// /// # Arguments /// - /// * `query` - The [DriveQuery] being executed. + /// * `query` - The [DriveDocumentQuery] being executed. /// * `epoch` - An `Option<&Epoch>`. If provided, it will be used to calculate the processing fee. /// * `dry_run` - If true, the function will not perform any actual operation and return a default `QueryDocumentsOutcome`. /// * `transaction` - The `TransactionArg` holding the transaction data. @@ -77,9 +70,10 @@ impl Drive { /// /// * `Result` - Returns `QueryDocumentsOutcome` on success with the list of documents, /// number of skipped items, and cost. If the operation fails, it returns an `Error`. + #[inline(always)] pub(super) fn query_documents_v0( &self, - query: DriveQuery, + query: DriveDocumentQuery, epoch: Option<&Epoch>, dry_run: bool, transaction: TransactionArg, @@ -108,6 +102,7 @@ impl Drive { epoch, self.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { diff --git a/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/mod.rs b/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/mod.rs index 77ef683e22a..28bfd1748f4 100644 --- a/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/mod.rs @@ -1,9 +1,9 @@ mod v0; -use crate::drive::batch::DriveOperation; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::batch::DriveOperation; use dpp::data_contract::document_type::DocumentTypeRef; use dpp::data_contract::DataContract; use dpp::document::Document; diff --git a/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/v0/mod.rs index bcaa79b69a5..6e995a8a3d0 100644 --- a/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/add_update_multiple_documents_operations/v0/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::batch::drive_op_batch::{ +use crate::drive::Drive; +use crate::util::batch::drive_op_batch::{ DocumentOperation, DocumentOperationsForContractDocumentType, UpdateOperationInfo, }; -use crate::drive::batch::{DocumentOperationType, DriveOperation}; -use crate::drive::Drive; +use crate::util::batch::{DocumentOperationType, DriveOperation}; use dpp::data_contract::document_type::DocumentTypeRef; use dpp::data_contract::DataContract; use dpp::document::Document; diff --git a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/mod.rs b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/mod.rs index d119a0da9f1..112b42c86cd 100644 --- a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/mod.rs @@ -1,10 +1,10 @@ mod v0; -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/v0/mod.rs index 7d3238cd3a7..0ceebab996e 100644 --- a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_apply_and_add_to_operations/v0/mod.rs @@ -1,7 +1,7 @@ -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentAndContractInfo; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/mod.rs b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/mod.rs index c042a578743..58486487b9e 100644 --- a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/mod.rs @@ -1,11 +1,11 @@ mod v0; -use crate::drive::object_size_info::DocumentAndContractInfo; use crate::drive::Drive; +use crate::util::object_size_info::DocumentAndContractInfo; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs index 082b51ed4ef..7d33635c1a7 100644 --- a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs @@ -1,25 +1,21 @@ -use crate::drive::defaults::CONTRACT_DOCUMENTS_PATH_HEIGHT; -use crate::drive::document::{ - contract_document_type_path, - contract_documents_keeping_history_primary_key_path_for_document_id, - contract_documents_primary_key_path, make_document_reference, -}; +use crate::drive::constants::CONTRACT_DOCUMENTS_PATH_HEIGHT; +use crate::drive::document::make_document_reference; -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::{ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::{ BatchDeleteUpTreeApplyType, BatchInsertApplyType, BatchInsertTreeApplyType, DirectQueryType, QueryType, }; -use crate::drive::object_size_info::DocumentInfo::DocumentOwnedInfo; -use crate::drive::object_size_info::DriveKeyInfo::{Key, KeyRef, KeySize}; -use crate::drive::object_size_info::PathKeyElementInfo::PathKeyRefElement; -use crate::drive::object_size_info::{ +use crate::util::object_size_info::DocumentInfo::DocumentOwnedInfo; +use crate::util::object_size_info::DriveKeyInfo::{Key, KeyRef, KeySize}; +use crate::util::object_size_info::PathKeyElementInfo::PathKeyRefElement; +use crate::util::object_size_info::{ DocumentAndContractInfo, DocumentInfoV0Methods, DriveKeyInfo, PathKeyInfo, }; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; @@ -28,6 +24,12 @@ use dpp::document::document_methods::DocumentMethodsV0; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::{Document, DocumentV0Getters}; +use crate::drive::document::paths::{ + contract_document_type_path, + contract_documents_keeping_history_primary_key_path_for_document_id, + contract_documents_primary_key_path, +}; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::version::PlatformVersion; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::key_info::KeyInfo::KnownKey; @@ -51,7 +53,9 @@ impl Drive { ) -> Result, Error> { let drive_version = &platform_version.drive; let mut batch_operations: Vec = vec![]; - if !document_and_contract_info.document_type.documents_mutable() { + if !document_and_contract_info.document_type.requires_revision() + // if it requires revision then there are reasons for us to be able to update in drive + { return Err(Error::Drive(DriveError::UpdatingReadOnlyImmutableDocument( "documents for this contract are not mutable", ))); @@ -167,7 +171,7 @@ impl Drive { let mut batch_insertion_cache: HashSet>> = HashSet::new(); // fourth we need to store a reference to the document for each index - for index in document_type.indices() { + for index in document_type.indexes().values() { // at this point the contract path is to the contract documents // for each index the top index component will already have been added // when the contract itself was created @@ -175,7 +179,7 @@ impl Drive { .iter() .map(|&x| Vec::from(x)) .collect(); - let top_index_property = index.properties.get(0).ok_or(Error::Drive( + let top_index_property = index.properties.first().ok_or(Error::Drive( DriveError::CorruptedContractIndexes("invalid contract indices"), ))?; index_path.push(Vec::from(top_index_property.name.as_bytes())); @@ -195,7 +199,7 @@ impl Drive { .get_raw_for_document_type( &top_index_property.name, document_type, - owner_id, + None, // We want to use the old owner id None, platform_version, )? @@ -223,6 +227,7 @@ impl Drive { index_path.clone(), document_top_field.as_slice(), )), + false, storage_flags, BatchInsertTreeApplyType::StatefulBatchInsertTree, transaction, @@ -266,7 +271,7 @@ impl Drive { .get_raw_for_document_type( &index_property.name, document_type, - owner_id, + None, // We want to use the old owner_id None, platform_version, )? @@ -295,6 +300,7 @@ impl Drive { index_path.clone(), index_property.name.as_bytes(), )), + false, storage_flags, BatchInsertTreeApplyType::StatefulBatchInsertTree, transaction, @@ -326,6 +332,7 @@ impl Drive { index_path.clone(), document_index_field.as_slice(), )), + false, storage_flags, BatchInsertTreeApplyType::StatefulBatchInsertTree, transaction, @@ -402,6 +409,7 @@ impl Drive { // here we are inserting an empty tree that will have a subtree of all other index properties self.batch_insert_empty_tree_if_not_exists( PathKeyInfo::PathKeyRef::<0>((index_path.clone(), &[0])), + false, storage_flags, BatchInsertTreeApplyType::StatefulBatchInsertTree, transaction, diff --git a/packages/rs-drive/src/drive/document/update/mod.rs b/packages/rs-drive/src/drive/document/update/mod.rs index c785fcb8d0b..313af57de89 100644 --- a/packages/rs-drive/src/drive/document/update/mod.rs +++ b/packages/rs-drive/src/drive/document/update/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Update Documents. //! //! This modules implements functions in Drive relevant to updating Documents. @@ -34,41 +5,33 @@ // Module: add_update_multiple_documents_operations // This module contains functionality for adding operations to update multiple documents -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod add_update_multiple_documents_operations; -#[cfg(feature = "full")] -pub use add_update_multiple_documents_operations::*; // Module: update_document_for_contract // This module contains functionality for updating a document for a given contract -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod update_document_for_contract; -#[cfg(feature = "full")] -pub use update_document_for_contract::*; // Module: update_document_for_contract_id // This module contains functionality for updating a document associated with a given contract id -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod update_document_for_contract_id; -#[cfg(feature = "full")] -pub use update_document_for_contract_id::*; // Module: update_document_with_serialization_for_contract // This module contains functionality for updating a document (with serialization) for a contract mod internal; mod update_document_with_serialization_for_contract; -pub use update_document_with_serialization_for_contract::*; - #[cfg(test)] mod tests { + use dpp::data_contract::{DataContract, DataContractFactory}; use grovedb::TransactionArg; use std::borrow::Cow; + use std::collections::BTreeMap; use std::default::Default; use std::option::Option::None; - use dpp::data_contract::{DataContract, DataContractFactory}; - use dpp::platform_value::{platform_value, Identifier, Value}; use dpp::block::block_info::BlockInfo; @@ -77,18 +40,17 @@ mod tests { use rand::{random, Rng}; use serde::{Deserialize, Serialize}; use serde_json::json; - use tempfile::TempDir; - use crate::drive::config::DriveConfig; - use crate::drive::flags::StorageFlags; - use crate::drive::object_size_info::DocumentInfo::{DocumentOwnedInfo, DocumentRefInfo}; - use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; + use crate::config::DriveConfig; use crate::drive::Drive; + use crate::util::object_size_info::DocumentInfo::{DocumentOwnedInfo, DocumentRefInfo}; + use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; + use crate::util::storage_flags::StorageFlags; use crate::drive::document::tests::setup_dashpay; - use crate::query::DriveQuery; - use crate::tests::helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; - use crate::{common::setup_contract, drive::test_utils::TestEntropyGenerator}; + use crate::query::DriveDocumentQuery; + use crate::util::test_helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; + use crate::util::test_helpers::setup_contract; use dpp::block::epoch::Epoch; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; @@ -98,13 +60,17 @@ mod tests { }; use dpp::document::specialized_document_factory::SpecializedDocumentFactory; use dpp::document::{Document, DocumentV0Getters, DocumentV0Setters}; - use dpp::fee::default_costs::EpochCosts; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::fee_result::FeeResult; use dpp::platform_value; use dpp::tests::json_document::json_document_to_document; + use once_cell::sync::Lazy; use platform_version::version::PlatformVersion; + static EPOCH_CHANGE_FEE_VERSION_TEST: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); + #[test] fn test_create_and_update_document_same_transaction() { let (drive, contract) = setup_dashpay("", true); @@ -120,6 +86,8 @@ mod tests { platform_value!({"displayName": "Alice"}), Identifier::random(), random(), + random(), + random(), platform_version, ) .expect("should create document"); @@ -148,6 +116,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should create alice profile"); @@ -177,6 +146,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should update alice profile"); } @@ -194,6 +164,8 @@ mod tests { platform_value!({"displayName": "Alice"}), Identifier::random(), random(), + random(), + random(), platform_version, ) .expect("should create document"); @@ -222,14 +194,16 @@ mod tests { true, None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should create alice profile"); // Check Alice profile let sql_string = "select * from profile"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -263,6 +237,7 @@ mod tests { true, None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should update alice profile"); @@ -288,6 +263,8 @@ mod tests { platform_value!({"displayName": "Alice"}), Identifier::random(), random(), + random(), + random(), platform_version, ) .expect("should create document"); @@ -316,6 +293,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should create alice profile"); @@ -328,8 +306,9 @@ mod tests { // Check Alice profile let sql_string = "select * from profile"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -365,6 +344,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should update alice profile"); @@ -396,6 +376,8 @@ mod tests { platform_value!({"displayName": "Alice"}), Identifier::random(), random(), + random(), + random(), platform_version, ) .expect("should create document"); @@ -424,6 +406,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should create alice profile"); @@ -436,8 +419,9 @@ mod tests { // Check Alice profile let sql_string = "select * from profile"; - let query = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); let (results_no_transaction, _, _) = query .execute_raw_results_no_proof(&drive, None, None, platform_version) @@ -457,13 +441,14 @@ mod tests { drive .delete_document_for_contract( - document.id().to_buffer(), + document.id(), &contract, "profile", BlockInfo::default(), true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to delete document"); @@ -510,6 +495,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should update alice profile"); @@ -623,6 +609,7 @@ mod tests { true, None, platform_version, + None, ) .expect("should add document"); @@ -657,6 +644,7 @@ mod tests { StorageFlags::optional_default_as_cow(), None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should update document"); @@ -678,6 +666,7 @@ mod tests { true, None, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("should delete document"); } @@ -729,6 +718,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -743,6 +733,7 @@ mod tests { StorageFlags::optional_default_as_cow(), Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect_err("expected not to be able to update a non mutable document"); @@ -764,6 +755,7 @@ mod tests { true, Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect_err("expected not to be able to override a non mutable document"); } @@ -823,6 +815,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -837,6 +830,7 @@ mod tests { StorageFlags::optional_default_as_cow(), Some(&db_transaction), platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to update a document with history successfully"); } @@ -918,11 +912,12 @@ mod tests { platform_version, ); let original_bytes = original_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); let expected_added_bytes = if using_history { - //Explanation for 1236 + //Explanation for 1237 //todo 1238 @@ -941,13 +936,13 @@ mod tests { // 32 bytes for the unique id // 1 byte for key_size (required space for 64) - // Value -> 224 + // Value -> 223 // 1 for the flag option with flags // 1 for the flags size // 35 for flags 32 + 1 + 2 // 1 for the enum type // 1 for item - // 118 for item serialized bytes (verified above) + // 117 for item serialized bytes (verified above) // 1 for Basic Merk // 32 for node hash // 32 for value hash @@ -1085,12 +1080,13 @@ mod tests { assert_eq!(*removed_credits, 25940733); let refund_equivalent_bytes = removed_credits.to_unsigned() - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); assert!(expected_added_bytes > refund_equivalent_bytes); - assert_eq!(refund_equivalent_bytes, 960); // we refunded 960 instead of 962 + assert_eq!(refund_equivalent_bytes, 960); // we refunded 960 instead of 963 // let's re-add it again let original_fees = apply_person( @@ -1104,9 +1100,10 @@ mod tests { ); let original_bytes = original_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); assert_eq!(original_bytes, expected_added_bytes); } @@ -1124,9 +1121,10 @@ mod tests { // we both add and remove bytes // this is because trees are added because of indexes, and also removed let added_bytes = update_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); let expected_added_bytes = if using_history { 313 } else { 1 }; assert_eq!(added_bytes, expected_added_bytes); @@ -1195,9 +1193,10 @@ mod tests { platform_version, ); let original_bytes = original_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); let expected_added_bytes = if using_history { 1238 } else { 962 }; assert_eq!(original_bytes, expected_added_bytes); if !using_history { @@ -1220,12 +1219,13 @@ mod tests { assert_eq!(*removed_credits, 25940733); let refund_equivalent_bytes = removed_credits.to_unsigned() - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); assert!(expected_added_bytes > refund_equivalent_bytes); - assert_eq!(refund_equivalent_bytes, 960); // we refunded 960 instead of 1011 + assert_eq!(refund_equivalent_bytes, 960); // we refunded 960 instead of 1012 // let's re-add it again let original_fees = apply_person( @@ -1239,9 +1239,10 @@ mod tests { ); let original_bytes = original_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); assert_eq!(original_bytes, expected_added_bytes); } @@ -1259,9 +1260,10 @@ mod tests { // we both add and remove bytes // this is because trees are added because of indexes, and also removed let added_bytes = update_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); let removed_credits = update_fees .fee_refunds @@ -1277,9 +1279,10 @@ mod tests { let expected_removed_credits = if using_history { 16286655 } else { 16232643 }; assert_eq!(*removed_credits, expected_removed_credits); let refund_equivalent_bytes = removed_credits.to_unsigned() - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); assert!(expected_added_bytes > refund_equivalent_bytes); let expected_remove_bytes = if using_history { 603 } else { 601 }; @@ -1389,11 +1392,12 @@ mod tests { platform_version, ); let original_bytes = original_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); let expected_added_bytes = if using_history { - //Explanation for 1238 + //Explanation for 1237 //todo 1238 @@ -1418,7 +1422,7 @@ mod tests { // 35 for flags 32 + 1 + 2 // 1 for the enum type // 1 for item - // 117 for item serialized bytes + // 116 for item serialized bytes // 1 for Basic Merk // 32 for node hash // 32 for value hash @@ -1548,9 +1552,10 @@ mod tests { // we both add and remove bytes // this is because trees are added because of indexes, and also removed let added_bytes = update_fees.storage_fee - / Epoch::new(0) - .unwrap() - .cost_for_known_cost_item(StorageDiskUsageCreditPerByte); + / Epoch::new(0).unwrap().cost_for_known_cost_item( + &EPOCH_CHANGE_FEE_VERSION_TEST, + StorageDiskUsageCreditPerByte, + ); let expected_added_bytes = if using_history { 1239 } else { 963 }; assert_eq!(added_bytes, expected_added_bytes); @@ -1628,6 +1633,7 @@ mod tests { apply, transaction, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to add document") } @@ -1642,13 +1648,14 @@ mod tests { ) -> FeeResult { drive .delete_document_for_contract( - person.id.to_buffer(), + person.id, contract, "person", block_info, true, transaction, platform_version, + Some(&EPOCH_CHANGE_FEE_VERSION_TEST), ) .expect("expected to remove person") } @@ -1833,11 +1840,10 @@ mod tests { } }); - let factory = DataContractFactory::new(1, Some(Box::new(TestEntropyGenerator::new()))) - .expect("expected to create factory"); + let factory = DataContractFactory::new(1).expect("expected to create factory"); let contract = factory - .create_with_value_config(owner_id, documents, None, None) + .create_with_value_config(owner_id, 0, documents, None, None) .expect("data in fixture should be correct") .data_contract_owned(); @@ -1896,6 +1902,7 @@ mod tests { true, None, platform_version, + None, ) .expect("should create document"); @@ -1918,6 +1925,7 @@ mod tests { storage_flags, None, platform_version, + None, ) .expect("should update document"); diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs index ada6c71acf3..159c39c80ca 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs @@ -1,6 +1,6 @@ mod v0; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; use crate::drive::Drive; use crate::error::drive::DriveError; @@ -14,6 +14,7 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use grovedb::TransactionArg; use std::borrow::Cow; @@ -45,6 +46,7 @@ impl Drive { storage_flags: Option>, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -63,6 +65,7 @@ impl Drive { storage_flags, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "update_document_for_contract".to_string(), diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs index 8046e330714..1e96985ff3d 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs @@ -1,13 +1,14 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::DocumentRefInfo; -use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentInfo::DocumentRefInfo; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::document_type::DocumentTypeRef; use dpp::data_contract::DataContract; use dpp::document::Document; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; @@ -17,6 +18,7 @@ use std::collections::HashMap; impl Drive { /// Updates a document and returns the associated fee. + #[inline(always)] pub(super) fn update_document_for_contract_v0( &self, document: &Document, @@ -28,6 +30,7 @@ impl Drive { storage_flags: Option>, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { let mut drive_operations: Vec = vec![]; let estimated_costs_only_with_layer_info = if apply { @@ -59,6 +62,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs index a81ac41b2bc..50968aeaa51 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs @@ -1,6 +1,6 @@ mod v0; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; use crate::drive::Drive; use crate::error::drive::DriveError; @@ -12,6 +12,7 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use grovedb::TransactionArg; use std::borrow::Cow; @@ -43,6 +44,7 @@ impl Drive { storage_flags: Option>, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -61,6 +63,7 @@ impl Drive { storage_flags, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "update_document_for_contract_id".to_string(), diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs index 99652216657..745d748fe97 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs @@ -1,15 +1,16 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::DocumentRefAndSerialization; -use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::drive::Drive; use crate::error::document::DocumentError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentInfo::DocumentRefAndSerialization; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::Document; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; @@ -19,6 +20,7 @@ use std::collections::HashMap; impl Drive { /// Updates a serialized document given a contract id and returns the associated fee. + #[inline(always)] pub(super) fn update_document_for_contract_id_v0( &self, serialized_document: &[u8], @@ -30,6 +32,7 @@ impl Drive { storage_flags: Option>, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { let mut drive_operations: Vec = vec![]; let estimated_costs_only_with_layer_info = if apply { @@ -73,13 +76,13 @@ impl Drive { &mut drive_operations, platform_version, )?; - let fees = Drive::calculate_fee( None, Some(drive_operations), &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) diff --git a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs index 0eb574f2ee7..2837319a966 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs @@ -1,6 +1,6 @@ mod v0; -use crate::drive::flags::StorageFlags; +use crate::util::storage_flags::StorageFlags; use crate::drive::Drive; use crate::error::drive::DriveError; @@ -13,6 +13,7 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use grovedb::TransactionArg; use std::borrow::Cow; @@ -46,6 +47,7 @@ impl Drive { storage_flags: Option>, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -65,6 +67,7 @@ impl Drive { storage_flags, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "update_document_with_serialization_for_contract".to_string(), diff --git a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs index 7b66b9ecb09..70292f91bb3 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs @@ -1,15 +1,16 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::DocumentRefAndSerialization; -use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentInfo::DocumentRefAndSerialization; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::DataContract; use dpp::document::Document; use dpp::fee::fee_result::FeeResult; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -18,6 +19,7 @@ use std::collections::HashMap; impl Drive { /// Updates a document and returns the associated fee. + #[inline(always)] pub(super) fn update_document_with_serialization_for_contract_v0( &self, document: &Document, @@ -30,6 +32,7 @@ impl Drive { storage_flags: Option>, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { let mut drive_operations: Vec = vec![]; let estimated_costs_only_with_layer_info = if apply { @@ -64,6 +67,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs b/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs deleted file mode 100644 index e0a41ceee8d..00000000000 --- a/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::{BaseOp, LowLevelDriveOperation}; -use dpp::block::epoch::Epoch; -use dpp::fee::fee_result::FeeResult; -use dpp::version::PlatformVersion; -use enum_map::EnumMap; - -mod v0; - -impl Drive { - /// Calculates fees for the given operations. Returns the storage and processing costs. - // Developer note : If there would ever need to be more parameters, they could be added as an option. - // For example we could transform - // pub fn calculate_fee( - // base_operations: Option>, - // drive_operations: Option>, - // epoch: &Epoch, - // platform_version: &PlatformVersion, - // ) -> Result { - // into - // pub fn calculate_fee( - // base_operations: Option>, - // drive_operations: Option>, - // new_operations: Option>, - // epoch: &Epoch, - // platform_version: &PlatformVersion, - // ) -> Result { - // All places in old code would just use a None for new_operations - // And calculate_fee_v0 would not use new_operations - pub fn calculate_fee( - base_operations: Option>, - drive_operations: Option>, - epoch: &Epoch, - epochs_per_era: u16, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version.drive.methods.fees.calculate_fee { - 0 => Self::calculate_fee_v0(base_operations, drive_operations, epoch, epochs_per_era), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "Drive::calculate_fee".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/fee/calculate_fee/v0/mod.rs b/packages/rs-drive/src/drive/fee/calculate_fee/v0/mod.rs deleted file mode 100644 index b704a2dc319..00000000000 --- a/packages/rs-drive/src/drive/fee/calculate_fee/v0/mod.rs +++ /dev/null @@ -1,42 +0,0 @@ -use crate::drive::Drive; -use crate::error::fee::FeeError; -use crate::error::Error; -use crate::fee::op::{BaseOp, LowLevelDriveOperation}; -use dpp::block::epoch::Epoch; -use dpp::fee::fee_result::FeeResult; - -use enum_map::EnumMap; - -impl Drive { - /// Calculates fees for the given operations. Returns the storage and processing costs. - pub fn calculate_fee_v0( - base_operations: Option>, - drive_operations: Option>, - epoch: &Epoch, - epochs_per_era: u16, - ) -> Result { - let mut aggregate_fee_result = FeeResult::default(); - if let Some(base_operations) = base_operations { - for (base_op, count) in base_operations.iter() { - match base_op.cost().checked_mul(*count) { - None => return Err(Error::Fee(FeeError::Overflow("overflow error"))), - Some(cost) => match aggregate_fee_result.processing_fee.checked_add(cost) { - None => return Err(Error::Fee(FeeError::Overflow("overflow error"))), - Some(value) => aggregate_fee_result.processing_fee = value, - }, - } - } - } - - if let Some(drive_operations) = drive_operations { - // println!("{:#?}", drive_operations); - for drive_fee_result in - LowLevelDriveOperation::consume_to_fees(drive_operations, epoch, epochs_per_era)? - { - aggregate_fee_result.checked_add_assign(drive_fee_result)?; - } - } - - Ok(aggregate_fee_result) - } -} diff --git a/packages/rs-drive/src/drive/fee/mod.rs b/packages/rs-drive/src/drive/fee/mod.rs deleted file mode 100644 index 41796c1b134..00000000000 --- a/packages/rs-drive/src/drive/fee/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -use crate::error::fee::FeeError; -use crate::error::Error; - -mod calculate_fee; - -/// Get overflow error -pub fn get_overflow_error(str: &'static str) -> Error { - Error::Fee(FeeError::Overflow(str)) -} diff --git a/packages/rs-drive/src/drive/flags.rs b/packages/rs-drive/src/drive/flags.rs deleted file mode 100644 index 7d1846de437..00000000000 --- a/packages/rs-drive/src/drive/flags.rs +++ /dev/null @@ -1,763 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Flags -//! - -#[cfg(feature = "full")] -use crate::drive::defaults::DEFAULT_HASH_SIZE; -#[cfg(feature = "full")] -use crate::drive::flags::StorageFlags::{ - MultiEpoch, MultiEpochOwned, SingleEpoch, SingleEpochOwned, -}; -#[cfg(feature = "full")] -use grovedb::ElementFlags; -#[cfg(feature = "full")] -use grovedb_costs::storage_cost::removal::StorageRemovedBytes::SectionedStorageRemoval; -#[cfg(feature = "full")] -use grovedb_costs::storage_cost::removal::{ - StorageRemovalPerEpochByIdentifier, StorageRemovedBytes, -}; -#[cfg(feature = "full")] -use integer_encoding::VarInt; -#[cfg(feature = "full")] -use intmap::IntMap; -#[cfg(feature = "full")] -use std::borrow::Cow; -#[cfg(feature = "full")] -use std::cmp::Ordering; -#[cfg(any(feature = "full", feature = "verify"))] -use std::collections::BTreeMap; - -#[cfg(feature = "full")] -use crate::error::storage_flags::StorageFlagsError; -#[cfg(feature = "full")] -use crate::error::Error; - -#[cfg(any(feature = "full", feature = "verify"))] -type EpochIndex = u16; - -#[cfg(any(feature = "full", feature = "verify"))] -type BaseEpoch = EpochIndex; - -#[cfg(any(feature = "full", feature = "verify"))] -type BytesAddedInEpoch = u32; - -#[cfg(any(feature = "full", feature = "verify"))] -type OwnerId = [u8; 32]; - -#[cfg(feature = "full")] -/// The size of single epoch flags -pub const SINGLE_EPOCH_FLAGS_SIZE: u32 = 3; - -#[cfg(any(feature = "full", feature = "verify"))] -/// Storage flags -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum StorageFlags { - /// Single epoch - /// represented as byte 0 - SingleEpoch(BaseEpoch), - - /// Multi epoch - /// represented as byte 1 - MultiEpoch(BaseEpoch, BTreeMap), - - /// Single epoch owned - /// represented as byte 2 - SingleEpochOwned(BaseEpoch, OwnerId), - - /// Multi epoch owned - /// represented as byte 3 - MultiEpochOwned(BaseEpoch, BTreeMap, OwnerId), -} - -#[cfg(feature = "full")] -impl StorageFlags { - /// Create new single epoch storage flags - pub fn new_single_epoch(epoch: BaseEpoch, maybe_owner_id: Option) -> Self { - match maybe_owner_id { - None => SingleEpoch(epoch), - Some(owner_id) => SingleEpochOwned(epoch, owner_id), - } - } - - fn combine_owner_id<'a>(&'a self, rhs: &'a Self) -> Result, Error> { - if let Some(our_owner_id) = self.owner_id() { - if let Some(other_owner_id) = rhs.owner_id() { - if our_owner_id != other_owner_id { - return Err(Error::StorageFlags( - StorageFlagsError::MergingStorageFlagsFromDifferentOwners( - "can not merge from different owners", - ), - )); - } - } - Ok(Some(our_owner_id)) - } else if let Some(other_owner_id) = rhs.owner_id() { - Ok(Some(other_owner_id)) - } else { - Ok(None) - } - } - - fn combine_non_base_epoch_bytes( - &self, - rhs: &Self, - ) -> Option> { - if let Some(our_epoch_index_map) = self.epoch_index_map() { - if let Some(other_epoch_index_map) = rhs.epoch_index_map() { - let mut combined_index_map = our_epoch_index_map.clone(); - other_epoch_index_map - .iter() - .for_each(|(epoch_index, bytes_added)| { - let original_value = combined_index_map.remove(epoch_index); - match original_value { - None => combined_index_map.insert(*epoch_index, *bytes_added), - Some(original_bytes) => combined_index_map - .insert(*epoch_index, original_bytes + *bytes_added), - }; - }); - Some(combined_index_map) - } else { - Some(our_epoch_index_map.clone()) - } - } else { - rhs.epoch_index_map().cloned() - } - } - - fn combine_same_base_epoch(&self, rhs: Self) -> Result { - let base_epoch = *self.base_epoch(); - let owner_id = self.combine_owner_id(&rhs)?; - let other_epoch_bytes = self.combine_non_base_epoch_bytes(&rhs); - - match (owner_id, other_epoch_bytes) { - (None, None) => Ok(SingleEpoch(base_epoch)), - (Some(owner_id), None) => Ok(SingleEpochOwned(base_epoch, *owner_id)), - (None, Some(other_epoch_bytes)) => Ok(MultiEpoch(base_epoch, other_epoch_bytes)), - (Some(owner_id), Some(other_epoch_bytes)) => { - Ok(MultiEpochOwned(base_epoch, other_epoch_bytes, *owner_id)) - } - } - } - - fn combine_with_higher_base_epoch(&self, rhs: Self, added_bytes: u32) -> Result { - let base_epoch = *self.base_epoch(); - let epoch_with_adding_bytes = rhs.base_epoch(); - let owner_id = self.combine_owner_id(&rhs)?; - let mut other_epoch_bytes = self.combine_non_base_epoch_bytes(&rhs).unwrap_or_default(); - let original_value = other_epoch_bytes.remove(epoch_with_adding_bytes); - match original_value { - None => other_epoch_bytes.insert(*epoch_with_adding_bytes, added_bytes), - Some(original_bytes) => { - other_epoch_bytes.insert(*epoch_with_adding_bytes, original_bytes + added_bytes) - } - }; - - match owner_id { - None => Ok(MultiEpoch(base_epoch, other_epoch_bytes)), - Some(owner_id) => Ok(MultiEpochOwned(base_epoch, other_epoch_bytes, *owner_id)), - } - } - - fn combine_with_higher_base_epoch_remove_bytes( - self, - rhs: Self, - removed_bytes: &StorageRemovedBytes, - ) -> Result { - if matches!(&self, &SingleEpoch(_) | &SingleEpochOwned(..)) { - return Ok(self); - } - let base_epoch = *self.base_epoch(); - let owner_id = self.combine_owner_id(&rhs)?; - let mut other_epoch_bytes = self.combine_non_base_epoch_bytes(&rhs).unwrap_or_default(); - if let SectionedStorageRemoval(sectioned_bytes_by_identifier) = removed_bytes { - if sectioned_bytes_by_identifier.len() > 1 { - return Err(Error::StorageFlags( - StorageFlagsError::MergingStorageFlagsFromDifferentOwners( - "can not remove bytes when there is no epoch", - ), - )); - } - let identifier = owner_id.copied().unwrap_or_default(); - let sectioned_bytes = - sectioned_bytes_by_identifier - .get(&identifier) - .ok_or(Error::StorageFlags( - StorageFlagsError::MergingStorageFlagsFromDifferentOwners( - "can not remove bytes when there is no epoch", - ), - ))?; - sectioned_bytes - .iter() - .try_for_each(|(epoch, removed_bytes)| { - let bytes_added_in_epoch = - other_epoch_bytes - .get_mut(&(*epoch as u16)) - .ok_or(Error::StorageFlags( - StorageFlagsError::RemovingAtEpochWithNoAssociatedStorage( - "can not remove bytes when there is no epoch", - ), - ))?; - *bytes_added_in_epoch = - bytes_added_in_epoch.checked_sub(*removed_bytes).ok_or( - Error::StorageFlags(StorageFlagsError::StorageFlagsOverflow( - "can't remove more bytes than exist at that epoch", - )), - )?; - Ok::<(), Error>(()) - })?; - } - - match owner_id { - None => Ok(MultiEpoch(base_epoch, other_epoch_bytes)), - Some(owner_id) => Ok(MultiEpochOwned(base_epoch, other_epoch_bytes, *owner_id)), - } - } - - /// Optional combine added bytes - pub fn optional_combine_added_bytes( - ours: Option, - theirs: Self, - added_bytes: u32, - ) -> Result { - match ours { - None => Ok(theirs), - Some(ours) => Ok(ours.combine_added_bytes(theirs, added_bytes)?), - } - } - - /// Optional combine removed bytes - pub fn optional_combine_removed_bytes( - ours: Option, - theirs: Self, - removed_bytes: &StorageRemovedBytes, - ) -> Result { - match ours { - None => Ok(theirs), - Some(ours) => Ok(ours.combine_removed_bytes(theirs, removed_bytes)?), - } - } - - /// Combine added bytes - pub fn combine_added_bytes(self, rhs: Self, added_bytes: u32) -> Result { - match self.base_epoch().cmp(rhs.base_epoch()) { - Ordering::Equal => self.combine_same_base_epoch(rhs), - Ordering::Less => self.combine_with_higher_base_epoch(rhs, added_bytes), - Ordering::Greater => Err(Error::StorageFlags( - StorageFlagsError::MergingStorageFlagsWithDifferentBaseEpoch( - "can not merge with new item in older base epoch", - ), - )), - } - } - - /// Combine removed bytes - pub fn combine_removed_bytes( - self, - rhs: Self, - removed_bytes: &StorageRemovedBytes, - ) -> Result { - match self.base_epoch().cmp(rhs.base_epoch()) { - Ordering::Equal => self.combine_same_base_epoch(rhs), - Ordering::Less => self.combine_with_higher_base_epoch_remove_bytes(rhs, removed_bytes), - Ordering::Greater => Err(Error::StorageFlags( - StorageFlagsError::MergingStorageFlagsWithDifferentBaseEpoch( - "can not merge with new item in older base epoch", - ), - )), - } - } - - /// Returns base epoch - pub fn base_epoch(&self) -> &BaseEpoch { - match self { - SingleEpoch(base_epoch) - | MultiEpoch(base_epoch, _) - | SingleEpochOwned(base_epoch, _) - | MultiEpochOwned(base_epoch, _, _) => base_epoch, - } - } - - /// Returns owner id - pub fn owner_id(&self) -> Option<&OwnerId> { - match self { - SingleEpochOwned(_, owner_id) | MultiEpochOwned(_, _, owner_id) => Some(owner_id), - _ => None, - } - } - - /// Returns epoch index map - pub fn epoch_index_map(&self) -> Option<&BTreeMap> { - match self { - MultiEpoch(_, epoch_int_map) | MultiEpochOwned(_, epoch_int_map, _) => { - Some(epoch_int_map) - } - _ => None, - } - } - - /// Returns optional default storage flags - pub fn optional_default() -> Option { - None - } - - /// Returns default optional storage flag as ref - pub fn optional_default_as_ref() -> Option<&'static Self> { - None - } - - /// Returns default optional storage flag as ref - pub fn optional_default_as_cow() -> Option> { - None - } - - /// Returns type byte - pub fn type_byte(&self) -> u8 { - match self { - SingleEpoch(_) => 0, - MultiEpoch(..) => 1, - SingleEpochOwned(..) => 2, - MultiEpochOwned(..) => 3, - } - } - - fn append_to_vec_base_epoch(&self, buffer: &mut Vec) { - match self { - SingleEpoch(base_epoch) - | MultiEpoch(base_epoch, ..) - | SingleEpochOwned(base_epoch, ..) - | MultiEpochOwned(base_epoch, ..) => buffer.extend(base_epoch.to_be_bytes()), - } - } - - fn maybe_append_to_vec_epoch_map(&self, buffer: &mut Vec) { - match self { - MultiEpoch(_, epoch_map) | MultiEpochOwned(_, epoch_map, _) => { - if epoch_map.is_empty() { - panic!("this should not be empty"); - } - epoch_map.iter().for_each(|(epoch_index, bytes_added)| { - buffer.extend(epoch_index.to_be_bytes()); - buffer.extend(bytes_added.encode_var_vec()); - }) - } - _ => {} - } - } - - fn maybe_epoch_map_size(&self) -> u32 { - let mut size = 0; - match self { - MultiEpoch(_, epoch_map) | MultiEpochOwned(_, epoch_map, _) => { - epoch_map.iter().for_each(|(_epoch_index, bytes_added)| { - size += 2; - size += bytes_added.encode_var_vec().len() as u32; - }) - } - _ => {} - } - size - } - - fn maybe_append_to_vec_owner_id(&self, buffer: &mut Vec) { - match self { - SingleEpochOwned(_, owner_id) | MultiEpochOwned(_, _, owner_id) => { - buffer.extend(owner_id); - } - _ => {} - } - } - - fn maybe_owner_id_size(&self) -> u32 { - match self { - SingleEpochOwned(..) | MultiEpochOwned(..) => DEFAULT_HASH_SIZE, - _ => 0, - } - } - - /// ApproximateSize - pub fn approximate_size( - has_owner_id: bool, - approximate_changes_and_bytes_count: Option<(u16, u8)>, - ) -> u32 { - let mut size = 3; // 1 for type byte, 2 for epoch number - if has_owner_id { - size += DEFAULT_HASH_SIZE; - } - if let Some((approximate_change_count, bytes_changed_required_size)) = - approximate_changes_and_bytes_count - { - size += (approximate_change_count as u32) * (2 + bytes_changed_required_size as u32) - } - size - } - - /// Serialize storage flags - pub fn serialize(&self) -> Vec { - let mut buffer = vec![self.type_byte()]; - self.maybe_append_to_vec_owner_id(&mut buffer); - self.append_to_vec_base_epoch(&mut buffer); - self.maybe_append_to_vec_epoch_map(&mut buffer); - buffer - } - - /// Serialize storage flags - pub fn serialized_size(&self) -> u32 { - let mut buffer_len = 3; //for type byte and base epoch - buffer_len += self.maybe_owner_id_size(); - buffer_len += self.maybe_epoch_map_size(); - buffer_len - } - - /// Deserialize single epoch storage flags from bytes - pub fn deserialize_single_epoch(data: &[u8]) -> Result { - if data.len() != 3 { - Err(Error::StorageFlags( - StorageFlagsError::StorageFlagsWrongSize("single epoch must be 3 bytes total"), - )) - } else { - let epoch = u16::from_be_bytes(data[1..3].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "single epoch must be 3 bytes total", - )) - })?); - Ok(SingleEpoch(epoch)) - } - } - - /// Deserialize multi epoch storage flags from bytes - pub fn deserialize_multi_epoch(data: &[u8]) -> Result { - let len = data.len(); - if len < 6 { - Err(Error::StorageFlags( - StorageFlagsError::StorageFlagsWrongSize( - "multi epoch must be at least 6 bytes total", - ), - )) - } else { - let base_epoch = u16::from_be_bytes(data[1..3].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "multi epoch must have enough bytes for the base epoch", - )) - })?); - let mut offset = 3; - let mut bytes_per_epoch: BTreeMap = BTreeMap::default(); - while offset + 2 < len { - // 2 for epoch size - let epoch_index = - u16::from_be_bytes(data[offset..offset + 2].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "multi epoch must have enough bytes epoch indexes", - )) - })?); - offset += 2; - let (bytes_at_epoch, bytes_used) = u32::decode_var(&data[offset..]).ok_or( - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "multi epoch must have enough bytes for the amount of bytes used", - )), - )?; - offset += bytes_used; - bytes_per_epoch.insert(epoch_index, bytes_at_epoch); - } - Ok(MultiEpoch(base_epoch, bytes_per_epoch)) - } - } - - /// Deserialize single epoch owned storage flags from bytes - pub fn deserialize_single_epoch_owned(data: &[u8]) -> Result { - if data.len() != 35 { - Err(Error::StorageFlags( - StorageFlagsError::StorageFlagsWrongSize( - "single epoch owned must be 35 bytes total", - ), - )) - } else { - let owner_id: OwnerId = data[1..33].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "single epoch owned must be 35 bytes total for owner id", - )) - })?; - let epoch = u16::from_be_bytes(data[33..35].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "single epoch owned must be 35 bytes total for epoch", - )) - })?); - Ok(SingleEpochOwned(epoch, owner_id)) - } - } - - /// Deserialize multi epoch owned storage flags from bytes - pub fn deserialize_multi_epoch_owned(data: &[u8]) -> Result { - let len = data.len(); - if len < 38 { - Err(Error::StorageFlags( - StorageFlagsError::StorageFlagsWrongSize( - "multi epoch owned must be at least 38 bytes total", - ), - )) - } else { - let owner_id: OwnerId = data[1..33].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "multi epoch owned must be 38 bytes total for owner id", - )) - })?; - let base_epoch = u16::from_be_bytes(data[33..35].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "multi epoch must have enough bytes for the base epoch", - )) - })?); - let mut offset = 35; - let mut bytes_per_epoch: BTreeMap = BTreeMap::default(); - while offset + 2 < len { - // 2 for epoch size - let epoch_index = - u16::from_be_bytes(data[offset..offset + 2].try_into().map_err(|_| { - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "multi epoch must have enough bytes epoch indexes", - )) - })?); - offset += 2; - let (bytes_at_epoch, bytes_used) = u32::decode_var(&data[offset..]).ok_or( - Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( - "multi epoch must have enough bytes for the amount of bytes used", - )), - )?; - offset += bytes_used; - bytes_per_epoch.insert(epoch_index, bytes_at_epoch); - } - Ok(MultiEpochOwned(base_epoch, bytes_per_epoch, owner_id)) - } - } - - /// Deserialize storage flags from bytes - pub fn deserialize(data: &[u8]) -> Result, Error> { - let first_byte = data.first(); - match first_byte { - None => Ok(None), - Some(first_byte) => match *first_byte { - 0 => Ok(Some(Self::deserialize_single_epoch(data)?)), - 1 => Ok(Some(Self::deserialize_multi_epoch(data)?)), - 2 => Ok(Some(Self::deserialize_single_epoch_owned(data)?)), - 3 => Ok(Some(Self::deserialize_multi_epoch_owned(data)?)), - _ => Err(Error::StorageFlags( - StorageFlagsError::DeserializeUnknownStorageFlagsType( - "unknown storage flags serialization", - ), - )), - }, - } - } - - /// Creates storage flags from a slice. - pub fn from_slice(data: &[u8]) -> Result, Error> { - Self::deserialize(data) - } - - /// Creates storage flags from element flags. - pub fn from_element_flags_ref(data: &ElementFlags) -> Result, Error> { - Self::from_slice(data.as_slice()) - } - - /// Create Storage flags from optional element flags ref - pub fn map_some_element_flags_ref(data: &Option) -> Result, Error> { - match data { - None => Ok(None), - Some(data) => Self::from_slice(data.as_slice()), - } - } - - /// Create Storage flags from optional element flags ref - pub fn map_cow_some_element_flags_ref( - data: &Option, - ) -> Result>, Error> { - match data { - None => Ok(None), - Some(data) => Self::from_slice(data.as_slice()).map(|option| option.map(Cow::Owned)), - } - } - - /// Map to owned optional element flags - pub fn map_owned_to_element_flags(maybe_storage_flags: Option) -> ElementFlags { - maybe_storage_flags - .map(|storage_flags| storage_flags.serialize()) - .unwrap_or_default() - } - - /// Map to optional element flags - pub fn map_to_some_element_flags(maybe_storage_flags: Option<&Self>) -> Option { - maybe_storage_flags.map(|storage_flags| storage_flags.serialize()) - } - - /// Map to optional element flags - pub fn map_cow_to_some_element_flags( - maybe_storage_flags: Option>, - ) -> Option { - maybe_storage_flags.map(|storage_flags| storage_flags.serialize()) - } - - /// Map to optional element flags - pub fn map_borrowed_cow_to_some_element_flags( - maybe_storage_flags: &Option>, - ) -> Option { - maybe_storage_flags - .as_ref() - .map(|storage_flags| storage_flags.serialize()) - } - - /// Creates optional element flags - pub fn to_some_element_flags(&self) -> Option { - Some(self.serialize()) - } - - /// Creates element flags. - pub fn to_element_flags(&self) -> ElementFlags { - self.serialize() - } - - /// split_storage_removed_bytes removes bytes as LIFO - pub fn split_storage_removed_bytes( - &self, - removed_key_bytes: u32, - removed_value_bytes: u32, - ) -> Result<(StorageRemovedBytes, StorageRemovedBytes), grovedb::Error> { - fn single_storage_removal( - removed_bytes: u32, - base_epoch: &BaseEpoch, - owner_id: Option<&OwnerId>, - ) -> StorageRemovedBytes { - let bytes_left = removed_bytes; - let mut sectioned_storage_removal: IntMap = IntMap::default(); - if bytes_left > 0 { - // We need to take some from the base epoch - sectioned_storage_removal.insert(*base_epoch as u64, removed_bytes); - } - let mut sectioned_storage_removal_by_identifier: StorageRemovalPerEpochByIdentifier = - BTreeMap::new(); - if let Some(owner_id) = owner_id { - sectioned_storage_removal_by_identifier - .insert(*owner_id, sectioned_storage_removal); - } else { - let default = [0u8; 32]; - sectioned_storage_removal_by_identifier.insert(default, sectioned_storage_removal); - } - SectionedStorageRemoval(sectioned_storage_removal_by_identifier) - } - - fn sectioned_storage_removal( - removed_bytes: u32, - base_epoch: &BaseEpoch, - other_epoch_bytes: &BTreeMap, - owner_id: Option<&OwnerId>, - ) -> StorageRemovedBytes { - let mut bytes_left = removed_bytes; - let mut rev_iter = other_epoch_bytes.iter().rev(); - let mut sectioned_storage_removal: IntMap = IntMap::default(); - while bytes_left > 0 { - if let Some((epoch_index, bytes_in_epoch)) = rev_iter.next_back() { - if *bytes_in_epoch < bytes_left { - bytes_left -= bytes_in_epoch; - sectioned_storage_removal.insert(*epoch_index as u64, *bytes_in_epoch); - } else if *bytes_in_epoch >= bytes_left { - //take all bytes - bytes_left = 0; - sectioned_storage_removal.insert(*epoch_index as u64, bytes_left); - } - } else { - break; - } - } - if bytes_left > 0 { - // We need to take some from the base epoch - sectioned_storage_removal.insert(*base_epoch as u64, bytes_left); - } - let mut sectioned_storage_removal_by_identifier: StorageRemovalPerEpochByIdentifier = - BTreeMap::new(); - if let Some(owner_id) = owner_id { - sectioned_storage_removal_by_identifier - .insert(*owner_id, sectioned_storage_removal); - } else { - let default = [0u8; 32]; - sectioned_storage_removal_by_identifier.insert(default, sectioned_storage_removal); - } - SectionedStorageRemoval(sectioned_storage_removal_by_identifier) - } - match self { - SingleEpoch(base_epoch) => { - let value_storage_removal = - single_storage_removal(removed_value_bytes, base_epoch, None); - let key_storage_removal = - single_storage_removal(removed_key_bytes, base_epoch, None); - Ok((key_storage_removal, value_storage_removal)) - } - SingleEpochOwned(base_epoch, owner_id) => { - let value_storage_removal = - single_storage_removal(removed_value_bytes, base_epoch, Some(owner_id)); - let key_storage_removal = - single_storage_removal(removed_key_bytes, base_epoch, Some(owner_id)); - Ok((key_storage_removal, value_storage_removal)) - } - MultiEpoch(base_epoch, other_epoch_bytes) => { - let value_storage_removal = sectioned_storage_removal( - removed_value_bytes, - base_epoch, - other_epoch_bytes, - None, - ); - let key_storage_removal = sectioned_storage_removal( - removed_key_bytes, - base_epoch, - other_epoch_bytes, - None, - ); - Ok((key_storage_removal, value_storage_removal)) - } - MultiEpochOwned(base_epoch, other_epoch_bytes, owner_id) => { - let value_storage_removal = sectioned_storage_removal( - removed_value_bytes, - base_epoch, - other_epoch_bytes, - Some(owner_id), - ); - let key_storage_removal = sectioned_storage_removal( - removed_key_bytes, - base_epoch, - other_epoch_bytes, - Some(owner_id), - ); - Ok((key_storage_removal, value_storage_removal)) - } - } - } - - /// Wrap Storage Flags into optional owned cow - pub fn into_optional_cow<'a>(self) -> Option> { - Some(Cow::Owned(self)) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_delete/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_delete/mod.rs deleted file mode 100644 index 25a6906749a..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_delete/mod.rs +++ /dev/null @@ -1,46 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::BatchDeleteApplyType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Pushes a "delete element" operation to `drive_operations`. - /// - /// # Parameters - /// * `path`: The path to delete. - /// * `key`: The key of the item to delete. - /// * `apply_type`: The apply type for the delete operation. - /// * `transaction`: The transaction argument. - /// * `drive_operations`: The vector containing low-level drive operations. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn batch_delete>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - apply_type: BatchDeleteApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.batch.batch_delete { - 0 => self.batch_delete_v0(path, key, apply_type, transaction, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_delete".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_delete/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_delete/v0/mod.rs deleted file mode 100644 index 3274e1d93fb..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_delete/v0/mod.rs +++ /dev/null @@ -1,66 +0,0 @@ -use crate::drive::grove_operations::{push_drive_operation_result, BatchDeleteApplyType}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::operations::delete::DeleteOptions; -use grovedb::{GroveDb, TransactionArg}; -use grovedb_path::SubtreePath; -use grovedb_storage::rocksdb_storage::RocksDbStorage; - -impl Drive { - /// Pushes a "delete element" operation to `drive_operations`. - pub(super) fn batch_delete_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - apply_type: BatchDeleteApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - let current_batch_operations = - LowLevelDriveOperation::grovedb_operations_batch(drive_operations); - let options = DeleteOptions { - allow_deleting_non_empty_trees: false, - deleting_non_empty_trees_returns_error: true, - base_root_storage_is_free: true, - validate_tree_at_path_exists: false, //todo: not sure about this one - }; - let delete_operation = match apply_type { - BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, - estimated_value_size, - } => GroveDb::worst_case_delete_operation_for_delete_internal::( - &KeyInfoPath::from_known_owned_path(path.to_vec()), - &KeyInfo::KnownKey(key.to_vec()), - is_sum_tree, - false, - true, - 0, - estimated_value_size, - ) - .map(|r| r.map(Some)), - BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum, - } => self.grove.delete_operation_for_delete_internal( - path, - key, - &options, - is_known_to_be_subtree_with_sum, - ¤t_batch_operations.operations, - transaction, - ), - }; - - if let Some(delete_operation) = - push_drive_operation_result(delete_operation, drive_operations)? - { - // we also add the actual delete operation - drive_operations.push(GroveOperation(delete_operation)) - } - - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_delete_up_tree_while_empty/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_delete_up_tree_while_empty/mod.rs deleted file mode 100644 index 1ef4158b98d..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_delete_up_tree_while_empty/mod.rs +++ /dev/null @@ -1,63 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::BatchDeleteUpTreeApplyType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::batch::KeyInfoPath; - -use grovedb::TransactionArg; - -impl Drive { - /// Pushes a "delete up tree while empty" operation to `drive_operations`. - /// - /// # Parameters - /// * `path`: The path to delete. - /// * `key`: The key of the item to delete. - /// * `stop_path_height`: The maximum height to delete up the tree. - /// * `apply_type`: The apply type for the delete operation. - /// * `transaction`: The transaction argument. - /// * `check_existing_operations`: The existing operations to check. - /// * `drive_operations`: The vector containing low-level drive operations. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn batch_delete_up_tree_while_empty( - &self, - path: KeyInfoPath, - key: &[u8], - stop_path_height: Option, - apply_type: BatchDeleteUpTreeApplyType, - transaction: TransactionArg, - check_existing_operations: &Option<&mut Vec>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .grove_methods - .batch - .batch_delete_up_tree_while_empty - { - 0 => self.batch_delete_up_tree_while_empty_v0( - path, - key, - stop_path_height, - apply_type, - transaction, - check_existing_operations, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_delete_up_tree_while_empty".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_delete_up_tree_while_empty/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_delete_up_tree_while_empty/v0/mod.rs deleted file mode 100644 index 27a1ef7e71e..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_delete_up_tree_while_empty/v0/mod.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::grove_operations::{push_drive_operation_result, BatchDeleteUpTreeApplyType}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::operations::delete::DeleteUpTreeOptions; -use grovedb::{GroveDb, TransactionArg}; -use grovedb_storage::rocksdb_storage::RocksDbStorage; - -impl Drive { - /// Pushes a "delete up tree while empty" operation to `drive_operations`. - pub(super) fn batch_delete_up_tree_while_empty_v0( - &self, - path: KeyInfoPath, - key: &[u8], - stop_path_height: Option, - apply_type: BatchDeleteUpTreeApplyType, - transaction: TransactionArg, - check_existing_operations: &Option<&mut Vec>, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - //these are the operations in the current operations (eg, delete/add) - let mut current_batch_operations = - LowLevelDriveOperation::grovedb_operations_batch(drive_operations); - - //These are the operations in the same batch, but in a different operation - if let Some(existing_operations) = check_existing_operations { - let mut other_batch_operations = - LowLevelDriveOperation::grovedb_operations_batch(existing_operations); - current_batch_operations.append(&mut other_batch_operations); - } - let cost_context = match apply_type { - BatchDeleteUpTreeApplyType::StatelessBatchDelete { - estimated_layer_info, - } => GroveDb::average_case_delete_operations_for_delete_up_tree_while_empty::< - RocksDbStorage, - >( - &path, - &KeyInfo::KnownKey(key.to_vec()), - stop_path_height, - true, - estimated_layer_info, - ), - BatchDeleteUpTreeApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum, - } => { - let options = DeleteUpTreeOptions { - allow_deleting_non_empty_trees: false, - deleting_non_empty_trees_returns_error: true, - base_root_storage_is_free: true, - validate_tree_at_path_exists: false, - stop_path_height, - }; - self.grove.delete_operations_for_delete_up_tree_while_empty( - path.to_path_refs().as_slice().into(), - key, - &options, - is_known_to_be_subtree_with_sum, - current_batch_operations.operations, - transaction, - ) - } - }; - let delete_operations = push_drive_operation_result(cost_context, drive_operations)?; - delete_operations - .into_iter() - .for_each(|op| drive_operations.push(GroveOperation(op))); - - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert/mod.rs deleted file mode 100644 index 09dc4151893..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -mod v0; - -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; - -impl Drive { - /// Pushes an "insert element" operation to `drive_operations`. - /// - /// # Parameters - /// * `path_key_element_info`: The key information of the document and element to insert. - /// * `drive_operations`: The vector containing low-level drive operations. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn batch_insert( - &self, - path_key_element_info: PathKeyElementInfo, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.batch.batch_insert { - 0 => self.batch_insert_v0(path_key_element_info, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_insert".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert/v0/mod.rs deleted file mode 100644 index 6d2b97133ea..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert/v0/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::object_size_info::PathKeyElementInfo::{ - PathFixedSizeKeyRefElement, PathKeyElement, PathKeyElementSize, PathKeyRefElement, - PathKeyUnknownElementSize, -}; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -impl Drive { - /// Pushes an "insert element" operation to `drive_operations`. - pub(super) fn batch_insert_v0( - &self, - path_key_element_info: PathKeyElementInfo, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - match path_key_element_info { - PathKeyRefElement((path, key, element)) => { - drive_operations.push(LowLevelDriveOperation::insert_for_known_path_key_element( - path, - key.to_vec(), - element, - )); - Ok(()) - } - PathKeyElement((path, key, element)) => { - drive_operations.push(LowLevelDriveOperation::insert_for_known_path_key_element( - path, key, element, - )); - Ok(()) - } - PathKeyElementSize((key_info_path, key_info, element)) => { - drive_operations.push( - LowLevelDriveOperation::insert_for_estimated_path_key_element( - key_info_path, - key_info, - element, - ), - ); - Ok(()) - } - PathKeyUnknownElementSize(_) => Err(Error::Drive(DriveError::NotSupportedPrivate( - "inserting unsized documents into a batch is not currently supported", - ))), - PathFixedSizeKeyRefElement((path, key, element)) => { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - drive_operations.push(LowLevelDriveOperation::insert_for_known_path_key_element( - path_items, - key.to_vec(), - element, - )); - Ok(()) - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree/mod.rs deleted file mode 100644 index bf53837666f..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree/mod.rs +++ /dev/null @@ -1,46 +0,0 @@ -mod v0; - -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DriveKeyInfo; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; - -impl Drive { - /// Pushes an "insert empty tree" operation to `drive_operations`. - /// - /// # Parameters - /// * `path`: The path to insert an empty tree. - /// * `key_info`: The key information of the document. - /// * `storage_flags`: Storage options for the operation. - /// * `drive_operations`: The vector containing low-level drive operations. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn batch_insert_empty_tree<'a, 'c, P>( - &'a self, - path: P, - key_info: DriveKeyInfo<'c>, - storage_flags: Option<&StorageFlags>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> - where - P: IntoIterator, -

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, - { - match drive_version.grove_methods.batch.batch_insert_empty_tree { - 0 => self.batch_insert_empty_tree_v0(path, key_info, storage_flags, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_insert_empty_tree".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree/v0/mod.rs deleted file mode 100644 index 62e3dcfcfee..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree/v0/mod.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DriveKeyInfo; -use crate::drive::object_size_info::DriveKeyInfo::{Key, KeyRef, KeySize}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use grovedb::batch::KeyInfoPath; - -impl Drive { - /// Pushes an "insert empty tree" operation to `drive_operations`. - pub(super) fn batch_insert_empty_tree_v0<'a, 'c, P>( - &'a self, - path: P, - key_info: DriveKeyInfo<'c>, - storage_flags: Option<&StorageFlags>, - drive_operations: &mut Vec, - ) -> Result<(), Error> - where - P: IntoIterator, -

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, - { - match key_info { - KeyRef(key) => { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - drive_operations.push(LowLevelDriveOperation::for_known_path_key_empty_tree( - path_items, - key.to_vec(), - storage_flags, - )); - Ok(()) - } - KeySize(key) => { - drive_operations.push(LowLevelDriveOperation::for_estimated_path_key_empty_tree( - KeyInfoPath::from_known_path(path), - key, - storage_flags, - )); - Ok(()) - } - Key(key) => { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - drive_operations.push(LowLevelDriveOperation::for_known_path_key_empty_tree( - path_items, - key, - storage_flags, - )); - Ok(()) - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists/mod.rs deleted file mode 100644 index 7a9bc127666..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists/mod.rs +++ /dev/null @@ -1,49 +0,0 @@ -mod v0; - -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::PathKeyInfo; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. - /// Will also check the current drive operations - pub fn batch_insert_empty_tree_if_not_exists( - &self, - path_key_info: PathKeyInfo, - storage_flags: Option<&StorageFlags>, - apply_type: BatchInsertTreeApplyType, - transaction: TransactionArg, - check_existing_operations: &mut Option<&mut Vec>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - match drive_version - .grove_methods - .batch - .batch_insert_empty_tree_if_not_exists - { - 0 => self.batch_insert_empty_tree_if_not_exists_v0( - path_key_info, - storage_flags, - apply_type, - transaction, - check_existing_operations, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_insert_empty_tree_if_not_exists".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs deleted file mode 100644 index 1c1709184fc..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs +++ /dev/null @@ -1,294 +0,0 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::PathKeyInfo; -use crate::drive::object_size_info::PathKeyInfo::{ - PathFixedSizeKey, PathFixedSizeKeyRef, PathKey, PathKeyRef, PathKeySize, -}; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::Op; -use grovedb::TransactionArg; - -impl Drive { - /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. - /// Will also check the current drive operations - pub(super) fn batch_insert_empty_tree_if_not_exists_v0( - &self, - path_key_info: PathKeyInfo, - storage_flags: Option<&StorageFlags>, - apply_type: BatchInsertTreeApplyType, - transaction: TransactionArg, - check_existing_operations: &mut Option<&mut Vec>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - //todo: clean up the duplication - match path_key_info { - PathKeyRef((path, key)) => { - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path.clone(), - key.to_vec(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if let Some(existing_operations) = check_existing_operations { - let mut i = 0; - let mut found = false; - while i < existing_operations.len() { - // we need to check every drive operation - // if it already exists then just ignore things - // if we had a delete then we need to remove the delete - let previous_drive_operation = &existing_operations[i]; - if previous_drive_operation == &drive_operation { - found = true; - break; - } else if let GroveOperation(grove_op) = previous_drive_operation { - if grove_op.key == key - && grove_op.path == path - && matches!(grove_op.op, Op::DeleteTree) - { - found = true; - existing_operations.remove(i); - break; - } else { - i += 1; - } - } else { - i += 1; - } - } - if !found { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } else { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } - } - PathKeySize(_key_path_info, _key_info) => Err(Error::Drive( - DriveError::NotSupportedPrivate("document sizes in batch operations not supported"), - )), - PathKey((path, key)) => { - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path.clone(), - key.to_vec(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if let Some(existing_operations) = check_existing_operations { - let mut i = 0; - let mut found = false; - while i < existing_operations.len() { - // we need to check every drive operation - // if it already exists then just ignore things - // if we had a delete then we need to remove the delete - let previous_drive_operation = &existing_operations[i]; - if previous_drive_operation == &drive_operation { - found = true; - break; - } else if let GroveOperation(grove_op) = previous_drive_operation { - if grove_op.key == key - && grove_op.path == path - && matches!(grove_op.op, Op::DeleteTree) - { - found = true; - existing_operations.remove(i); - break; - } else { - i += 1; - } - } else { - i += 1; - } - } - if !found { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } else { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } - } - PathFixedSizeKey((path, key)) => { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path_items, - key.to_vec(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if let Some(existing_operations) = check_existing_operations { - let mut i = 0; - let mut found = false; - while i < existing_operations.len() { - // we need to check every drive operation - // if it already exists then just ignore things - // if we had a delete then we need to remove the delete - let previous_drive_operation = &existing_operations[i]; - if previous_drive_operation == &drive_operation { - found = true; - break; - } else if let GroveOperation(grove_op) = previous_drive_operation { - if grove_op.key == key - && grove_op.path == path - && matches!(grove_op.op, Op::DeleteTree) - { - found = true; - existing_operations.remove(i); - break; - } else { - i += 1; - } - } else { - i += 1; - } - } - if !found { - let has_raw = self.grove_has_raw( - path.as_ref().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } else { - let has_raw = self.grove_has_raw( - path.as_ref().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } - } - PathFixedSizeKeyRef((path, key)) => { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path_items, - key.to_vec(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if let Some(existing_operations) = check_existing_operations { - let mut i = 0; - let mut found = false; - while i < existing_operations.len() { - // we need to check every drive operation - // if it already exists then just ignore things - // if we had a delete then we need to remove the delete - let previous_drive_operation = &existing_operations[i]; - if previous_drive_operation == &drive_operation { - found = true; - break; - } else if let GroveOperation(grove_op) = previous_drive_operation { - if grove_op.key == key - && grove_op.path == path - && matches!(grove_op.op, Op::DeleteTree) - { - found = true; - existing_operations.remove(i); - break; - } else { - i += 1; - } - } else { - i += 1; - } - } - if !found { - let has_raw = self.grove_has_raw( - path.as_ref().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } else { - let has_raw = self.grove_has_raw( - path.as_ref().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/mod.rs deleted file mode 100644 index 3ae1d40a46d..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/mod.rs +++ /dev/null @@ -1,61 +0,0 @@ -mod v0; - -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::PathKeyInfo; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. - /// Will also check the current drive operations. - /// - /// # Parameters - /// * `path_key_info`: Information about the path and key. - /// * `storage_flags`: Optional flags for the storage. - /// * `apply_type`: The apply type for the operation. - /// * `transaction`: The transaction argument for the operation. - /// * `drive_operations`: The list of drive operations to append to. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(bool)` if the operation was successful. Returns true if the path key already exists without references. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - /// * `Err(DriveError::CorruptedCodeExecution)` if the operation is not supported. - pub fn batch_insert_empty_tree_if_not_exists_check_existing_operations( - &self, - path_key_info: PathKeyInfo, - storage_flags: Option<&StorageFlags>, - apply_type: BatchInsertTreeApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - match drive_version - .grove_methods - .batch - .batch_insert_empty_tree_if_not_exists_check_existing_operations - { - 0 => self.batch_insert_empty_tree_if_not_exists_check_existing_operations_v0( - path_key_info, - storage_flags, - apply_type, - transaction, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_insert_empty_tree_if_not_exists_check_existing_operations" - .to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/v0/mod.rs deleted file mode 100644 index 7851e4a941d..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/v0/mod.rs +++ /dev/null @@ -1,133 +0,0 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::PathKeyInfo; -use crate::drive::object_size_info::PathKeyInfo::{ - PathFixedSizeKey, PathFixedSizeKeyRef, PathKey, PathKeyRef, PathKeySize, -}; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. - /// Will also check the current drive operations - pub(super) fn batch_insert_empty_tree_if_not_exists_check_existing_operations_v0< - const N: usize, - >( - &self, - path_key_info: PathKeyInfo, - storage_flags: Option<&StorageFlags>, - apply_type: BatchInsertTreeApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - match path_key_info { - PathKeyRef((path, key)) => { - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path.clone(), - key.to_vec(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if !drive_operations.contains(&drive_operation) { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } - PathKeySize(_key_path_info, _key_info) => Err(Error::Drive( - DriveError::NotSupportedPrivate("document sizes in batch operations not supported"), - )), - PathKey((path, key)) => { - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path.clone(), - key.clone(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if !drive_operations.contains(&drive_operation) { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } - PathFixedSizeKey((path, key)) => { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path_items, - key.to_vec(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if !drive_operations.contains(&drive_operation) { - let has_raw = self.grove_has_raw( - path.as_ref().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } - PathFixedSizeKeyRef((path, key)) => { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - let drive_operation = LowLevelDriveOperation::for_known_path_key_empty_tree( - path_items, - key.to_vec(), - storage_flags, - ); - // we only add the operation if it doesn't already exist in the current batch - if !drive_operations.contains(&drive_operation) { - let has_raw = self.grove_has_raw( - path.as_ref().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push(drive_operation); - } - Ok(!has_raw) - } else { - Ok(false) - } - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_changed_value/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_if_changed_value/mod.rs deleted file mode 100644 index 6c062a8b832..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_changed_value/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::BatchInsertApplyType; - -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, TransactionArg}; - -impl Drive { - /// Pushes an "insert element if element was changed or is new" operation to `drive_operations`. - /// Returns true if the path key already exists without references. - /// - /// # Parameters - /// * `path_key_element_info`: Information about the path, key and element. - /// * `apply_type`: The apply type for the operation. - /// * `transaction`: The transaction argument for the operation. - /// * `drive_operations`: The list of drive operations to append to. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok((bool, Option))` if the operation was successful. Returns true if the path key already exists without references. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - /// * `Err(DriveError::CorruptedCodeExecution)` if the operation is not supported. - pub fn batch_insert_if_changed_value( - &self, - path_key_element_info: PathKeyElementInfo, - apply_type: BatchInsertApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(bool, Option), Error> { - match drive_version - .grove_methods - .batch - .batch_insert_if_changed_value - { - 0 => self.batch_insert_if_changed_value_v0( - path_key_element_info, - apply_type, - transaction, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_insert_if_changed_value".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_changed_value/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_if_changed_value/v0/mod.rs deleted file mode 100644 index 82723224787..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_changed_value/v0/mod.rs +++ /dev/null @@ -1,134 +0,0 @@ -use crate::drive::grove_operations::BatchInsertApplyType; -use crate::drive::object_size_info::PathKeyElementInfo::{ - PathFixedSizeKeyRefElement, PathKeyElement, PathKeyElementSize, PathKeyRefElement, - PathKeyUnknownElementSize, -}; - -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, GroveDb, TransactionArg}; - -impl Drive { - /// Pushes an "insert element if element was changed or is new" operation to `drive_operations`. - /// Returns true if the path key already exists without references. - pub(super) fn batch_insert_if_changed_value_v0( - &self, - path_key_element_info: PathKeyElementInfo, - apply_type: BatchInsertApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(bool, Option), Error> { - match path_key_element_info { - PathKeyRefElement((path, key, element)) => { - let previous_element = self.grove_get_raw_optional( - path.as_slice().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - let needs_insert = match &previous_element { - None => true, - Some(previous_element) => previous_element != &element, - }; - if needs_insert { - drive_operations.push( - LowLevelDriveOperation::insert_for_known_path_key_element( - path, - key.to_vec(), - element, - ), - ); - } - Ok((needs_insert, previous_element)) - } - PathKeyElement((path, key, element)) => { - let previous_element = self.grove_get_raw_optional( - path.as_slice().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - let needs_insert = match &previous_element { - None => true, - Some(previous_element) => previous_element != &element, - }; - if needs_insert { - drive_operations.push( - LowLevelDriveOperation::insert_for_known_path_key_element( - path, key, element, - ), - ); - } - Ok((needs_insert, previous_element)) - } - PathFixedSizeKeyRefElement((path, key, element)) => { - let previous_element = self.grove_get_raw_optional( - (&path).into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - let needs_insert = match &previous_element { - None => true, - Some(previous_element) => previous_element != &element, - }; - if needs_insert { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - drive_operations.push( - LowLevelDriveOperation::insert_for_known_path_key_element( - path_items, - key.to_vec(), - element, - ), - ); - } - Ok((needs_insert, previous_element)) - } - PathKeyElementSize((key_info_path, key_info, element)) => { - match apply_type { - BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, .. - } => { - // we can estimate that the element was the same size - drive_operations.push(CalculatedCostOperation( - GroveDb::average_case_for_get_raw( - &key_info_path, - &key_info, - element.serialized_size() as u32, - in_tree_using_sums, - ), - )); - drive_operations.push( - LowLevelDriveOperation::insert_for_estimated_path_key_element( - key_info_path, - key_info, - element, - ), - ); - Ok((true, None)) - } - BatchInsertApplyType::StatefulBatchInsert => { - Err(Error::Drive(DriveError::NotSupportedPrivate( - "document sizes for stateful insert in batch operations not supported", - ))) - } - } - } - PathKeyUnknownElementSize(_) => Err(Error::Drive(DriveError::NotSupportedPrivate( - "document sizes in batch operations not supported", - ))), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_not_exists/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_if_not_exists/mod.rs deleted file mode 100644 index 21f95fd5f61..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_not_exists/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::BatchInsertApplyType; - -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Pushes an "insert element if the path key does not yet exist" operation to `drive_operations`. - /// Returns true if the path key already exists without references. - /// - /// # Parameters - /// * `path_key_element_info`: Information about the path, key and element. - /// * `apply_type`: The apply type for the operation. - /// * `transaction`: The transaction argument for the operation. - /// * `drive_operations`: The list of drive operations to append to. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(bool)` if the operation was successful. Returns true if the path key already exists without references. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - /// * `Err(DriveError::CorruptedCodeExecution)` if the operation is not supported. - pub fn batch_insert_if_not_exists( - &self, - path_key_element_info: PathKeyElementInfo, - apply_type: BatchInsertApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - match drive_version.grove_methods.batch.batch_insert_if_not_exists { - 0 => self.batch_insert_if_not_exists_v0( - path_key_element_info, - apply_type, - transaction, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_insert_if_not_exists".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_not_exists/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_insert_if_not_exists/v0/mod.rs deleted file mode 100644 index 8407b05a84b..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_insert_if_not_exists/v0/mod.rs +++ /dev/null @@ -1,122 +0,0 @@ -use crate::drive::grove_operations::BatchInsertApplyType; -use crate::drive::object_size_info::PathKeyElementInfo::{ - PathFixedSizeKeyRefElement, PathKeyElement, PathKeyElementSize, PathKeyRefElement, - PathKeyUnknownElementSize, -}; - -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::{GroveDb, TransactionArg}; - -impl Drive { - /// Pushes an "insert element if the path key does not yet exist" operation to `drive_operations`. - /// Returns true if the path key already exists without references. - pub(super) fn batch_insert_if_not_exists_v0( - &self, - path_key_element_info: PathKeyElementInfo, - apply_type: BatchInsertApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - match path_key_element_info { - PathKeyRefElement((path, key, element)) => { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push( - LowLevelDriveOperation::insert_for_known_path_key_element( - path, - key.to_vec(), - element, - ), - ); - } - Ok(!has_raw) - } - PathKeyElement((path, key, element)) => { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key.as_slice(), - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - drive_operations.push( - LowLevelDriveOperation::insert_for_known_path_key_element( - path, key, element, - ), - ); - } - Ok(!has_raw) - } - PathFixedSizeKeyRefElement((path, key, element)) => { - let has_raw = self.grove_has_raw( - path.as_slice().into(), - key, - apply_type.to_direct_query_type(), - transaction, - drive_operations, - drive_version, - )?; - if !has_raw { - let path_items: Vec> = path.into_iter().map(Vec::from).collect(); - drive_operations.push( - LowLevelDriveOperation::insert_for_known_path_key_element( - path_items, - key.to_vec(), - element, - ), - ); - } - Ok(!has_raw) - } - PathKeyElementSize((key_info_path, key_info, element)) => { - match apply_type { - BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, .. - } => { - // we can estimate that the element was the same size - drive_operations.push(CalculatedCostOperation( - GroveDb::average_case_for_has_raw( - &key_info_path, - &key_info, - element.serialized_size() as u32, - in_tree_using_sums, - ), - )); - drive_operations.push( - LowLevelDriveOperation::insert_for_estimated_path_key_element( - key_info_path, - key_info, - element, - ), - ); - Ok(true) - } - BatchInsertApplyType::StatefulBatchInsert => { - Err(Error::Drive(DriveError::NotSupportedPrivate( - "document sizes for stateful insert in batch operations not supported", - ))) - } - } - } - PathKeyUnknownElementSize(_) => Err(Error::Drive(DriveError::NotSupportedPrivate( - "document sizes in batch operations not supported", - ))), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_refresh_reference/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_refresh_reference/mod.rs deleted file mode 100644 index 67301fc2f40..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_refresh_reference/mod.rs +++ /dev/null @@ -1,49 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::Element; - -impl Drive { - /// Pushes an "refresh reference" operation to `drive_operations`. - /// - /// # Parameters - /// * `path`: The path of the reference to be refreshed. - /// * `key`: The key of the reference to be refreshed. - /// * `document_reference`: The element to be referenced. - /// * `trust_refresh_reference`: Flag to trust the refresh reference. - /// * `drive_operations`: The list of drive operations to append to. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the reference was successfully refreshed. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - /// * `Err(DriveError::CorruptedCodeExecution)` if expected a reference on refresh. - pub fn batch_refresh_reference( - &self, - path: Vec>, - key: Vec, - document_reference: Element, - trust_refresh_reference: bool, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.batch.batch_refresh_reference { - 0 => self.batch_refresh_reference_v0( - path, - key, - document_reference, - trust_refresh_reference, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_refresh_reference".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_refresh_reference/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_refresh_reference/v0/mod.rs deleted file mode 100644 index fda90d43db7..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_refresh_reference/v0/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use grovedb::Element; - -impl Drive { - /// Pushes an "refresh reference" operation to `drive_operations`. - pub(super) fn batch_refresh_reference_v0( - &self, - path: Vec>, - key: Vec, - document_reference: Element, - trust_refresh_reference: bool, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - let Element::Reference(reference_path_type, max_reference_hop, flags) = document_reference - else { - return Err(Error::Drive(DriveError::CorruptedCodeExecution( - "expected a reference on refresh", - ))); - }; - drive_operations.push( - LowLevelDriveOperation::refresh_reference_for_known_path_key_reference_info( - path, - key, - reference_path_type, - max_reference_hop, - flags, - trust_refresh_reference, - ), - ); - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_remove_raw/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_remove_raw/mod.rs deleted file mode 100644 index 8a84498f231..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_remove_raw/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::BatchDeleteApplyType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Pushes a "delete element" operation to `drive_operations` and returns the current element. - /// If the element didn't exist does nothing. - /// It is raw, because it does not use references. - /// - /// # Parameters - /// * `path`: The path to the element to delete. - /// * `key`: The key of the element to delete. - /// * `apply_type`: The delete operation type. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: The list of drive operations to append to. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Some(Element))` if the element was successfully deleted. - /// * `Ok(None)` if the element does not exist. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn batch_remove_raw>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - apply_type: BatchDeleteApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version.grove_methods.batch.batch_remove_raw { - 0 => self.batch_remove_raw_v0( - path, - key, - apply_type, - transaction, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "batch_remove_raw".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/batch_remove_raw/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/batch_remove_raw/v0/mod.rs deleted file mode 100644 index e3c5758ab60..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/batch_remove_raw/v0/mod.rs +++ /dev/null @@ -1,107 +0,0 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::grove_operations::{push_drive_operation_result, BatchDeleteApplyType}; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::{KeyInfoPath, Op}; -use grovedb::operations::delete::DeleteOptions; -use grovedb::{Element, GroveDb, TransactionArg}; -use grovedb_path::SubtreePath; -use grovedb_storage::rocksdb_storage::RocksDbStorage; - -impl Drive { - /// Pushes a "delete element" operation to `drive_operations` and returns the current element. - /// If the element didn't exist does nothing. - /// It is raw, because it does not use references. - pub(super) fn batch_remove_raw_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - apply_type: BatchDeleteApplyType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - let mut current_batch_operations = - LowLevelDriveOperation::grovedb_operations_batch(drive_operations); - let options = DeleteOptions { - allow_deleting_non_empty_trees: false, - deleting_non_empty_trees_returns_error: true, - base_root_storage_is_free: true, - validate_tree_at_path_exists: false, //todo: not sure about this one - }; - - let needs_removal_from_state = - match current_batch_operations.remove_if_insert(path.to_vec(), key) { - Some(Op::Insert { element }) - | Some(Op::Replace { element }) - | Some(Op::Patch { element, .. }) => return Ok(Some(element)), - Some(Op::InsertTreeWithRootHash { .. }) => { - return Err(Error::Drive(DriveError::CorruptedCodeExecution( - "we should not be seeing internal grovedb operations", - ))); - } - Some(Op::Delete { .. }) - | Some(Op::DeleteTree { .. }) - | Some(Op::DeleteSumTree { .. }) => false, - _ => true, - }; - - let maybe_element = self.grove_get_raw_optional( - path.clone(), - key, - (&apply_type).into(), - transaction, - drive_operations, - drive_version, - )?; - if maybe_element.is_none() - && matches!( - &apply_type, - &BatchDeleteApplyType::StatefulBatchDelete { .. } - ) - { - return Ok(None); - } - if needs_removal_from_state { - let delete_operation = match apply_type { - BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, - estimated_value_size, - } => GroveDb::worst_case_delete_operation_for_delete_internal::( - &KeyInfoPath::from_known_owned_path(path.to_vec()), - &KeyInfo::KnownKey(key.to_vec()), - is_sum_tree, - false, - true, - 0, - estimated_value_size, - ) - .map(|r| r.map(Some)), - BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum, - } => self.grove.delete_operation_for_delete_internal( - path, - key, - &options, - is_known_to_be_subtree_with_sum, - ¤t_batch_operations.operations, - transaction, - ), - }; - - if let Some(delete_operation) = - push_drive_operation_result(delete_operation, drive_operations)? - { - // we also add the actual delete operation - drive_operations.push(GroveOperation(delete_operation)) - } - } - - Ok(maybe_element) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_batch/mod.rs deleted file mode 100644 index 2363512b028..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -mod v0; - -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Applies the given groveDB operations batch. - /// - /// # Parameters - /// * `ops`: The groveDB operations batch. - /// * `validate`: Specifies whether to validate that insertions do not override existing entries. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn grove_apply_batch( - &self, - ops: GroveDbOpBatch, - validate: bool, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.apply.grove_apply_batch { - 0 => self.grove_apply_batch_v0(ops, validate, transaction, drive_version), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_apply_batch".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_batch/v0/mod.rs deleted file mode 100644 index 7f9e246c71e..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch/v0/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::Error; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Applies the given groveDB operations batch. - pub(super) fn grove_apply_batch_v0( - &self, - ops: GroveDbOpBatch, - validate: bool, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - self.grove_apply_batch_with_add_costs( - ops, - validate, - transaction, - &mut vec![], - drive_version, - ) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch_with_add_costs/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_batch_with_add_costs/mod.rs deleted file mode 100644 index c698886bd89..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch_with_add_costs/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -mod v0; - -use crate::drive::batch::GroveDbOpBatch; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::TransactionArg; - -impl Drive { - /// Applies the given groveDB operations batch and gets and passes the costs to `push_drive_operation_result`. - /// - /// # Parameters - /// * `ops`: The groveDB operations batch. - /// * `validate`: Specifies whether to validate that insertions do not override existing entries. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector of operations on the drive. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn grove_apply_batch_with_add_costs( - &self, - ops: GroveDbOpBatch, - validate: bool, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .grove_methods - .apply - .grove_apply_batch_with_add_costs - { - 0 => self.grove_apply_batch_with_add_costs_v0( - ops, - validate, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_apply_batch_with_add_costs".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs deleted file mode 100644 index d1cb90764d5..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs +++ /dev/null @@ -1,185 +0,0 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::push_drive_operation_result; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::query::GroveError; -use grovedb::batch::{BatchApplyOptions, GroveDbOp}; -use grovedb::TransactionArg; -use grovedb_costs::storage_cost::removal::StorageRemovedBytes::BasicStorageRemoval; -use grovedb_costs::storage_cost::transition::OperationStorageTransitionType; -use tracing::Level; - -impl Drive { - /// Applies the given groveDB operations batch and gets and passes the costs to `push_drive_operation_result`. - pub(super) fn grove_apply_batch_with_add_costs_v0( - &self, - ops: GroveDbOpBatch, - validate: bool, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - if ops.is_empty() { - return Err(Error::Drive(DriveError::BatchIsEmpty())); - } - // if ops.operations.len() < 500 { - // //no initialization - // dbg!("batch {:#?}", &ops); - // } - - if self.config.batching_consistency_verification { - let consistency_results = GroveDbOp::verify_consistency_of_operations(&ops.operations); - if !consistency_results.is_empty() { - tracing::error!( - ?consistency_results, - "grovedb consistency verification failed" - ); - return Err(Error::Drive(DriveError::GroveDBInsertion( - "insertion order error", - ))); - } - } - - // Clone ops only if we log them - #[cfg(feature = "grovedb_operations_logging")] - let maybe_params_for_logs = if tracing::event_enabled!(target: "drive_grovedb_operations", Level::TRACE) - { - let root_hash = self - .grove - .root_hash(transaction) - .unwrap() - .map_err(Error::GroveDB)?; - - Some((ops.clone(), root_hash)) - } else { - None - }; - - let cost_context = self.grove.apply_batch_with_element_flags_update( - ops.operations, - Some(BatchApplyOptions { - validate_insertion_does_not_override: validate, - validate_insertion_does_not_override_tree: validate, - allow_deleting_non_empty_trees: false, - deleting_non_empty_trees_returns_error: true, - disable_operation_consistency_check: !self.config.batching_consistency_verification, - base_root_storage_is_free: true, - batch_pause_height: None, - }), - |cost, old_flags, new_flags| { - // if there were no flags before then the new flags are used - if old_flags.is_none() { - return Ok(false); - } - // This could be none only because the old element didn't exist - // If they were empty we get an error - let maybe_old_storage_flags = StorageFlags::map_some_element_flags_ref(&old_flags) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive did not understand flags of old item being updated", - ) - })?; - let new_storage_flags = StorageFlags::from_element_flags_ref(new_flags) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive did not understand updated item flag information", - ) - })? - .ok_or(GroveError::JustInTimeElementFlagsClientError( - "removing flags from an item with flags is not allowed", - ))?; - match &cost.transition_type() { - OperationStorageTransitionType::OperationUpdateBiggerSize => { - let combined_storage_flags = StorageFlags::optional_combine_added_bytes( - maybe_old_storage_flags, - new_storage_flags, - cost.added_bytes, - ) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive could not combine storage flags (new flags were bigger)", - ) - })?; - let combined_flags = combined_storage_flags.to_element_flags(); - // it's possible they got bigger in the same epoch - if combined_flags == *new_flags { - // they are the same there was no update - Ok(false) - } else { - *new_flags = combined_flags; - Ok(true) - } - } - OperationStorageTransitionType::OperationUpdateSmallerSize => { - let combined_storage_flags = StorageFlags::optional_combine_removed_bytes( - maybe_old_storage_flags, - new_storage_flags, - &cost.removed_bytes, - ) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive could not combine storage flags (new flags were smaller)", - ) - })?; - let combined_flags = combined_storage_flags.to_element_flags(); - // it's possible they got bigger in the same epoch - if combined_flags == *new_flags { - // they are the same there was no update - Ok(false) - } else { - *new_flags = combined_flags; - Ok(true) - } - } - _ => Ok(false), - } - }, - |flags, removed_key_bytes, removed_value_bytes| { - let maybe_storage_flags = - StorageFlags::from_element_flags_ref(flags).map_err(|_| { - GroveError::SplitRemovalBytesClientError( - "drive did not understand flags of item being updated", - ) - })?; - // if there were no flags before then the new flags are used - match maybe_storage_flags { - None => Ok(( - BasicStorageRemoval(removed_key_bytes), - BasicStorageRemoval(removed_value_bytes), - )), - Some(storage_flags) => storage_flags - .split_storage_removed_bytes(removed_key_bytes, removed_value_bytes), - } - }, - transaction, - ); - - #[cfg(feature = "grovedb_operations_logging")] - if tracing::event_enabled!(target: "drive_grovedb_operations", Level::TRACE) - && cost_context.value.is_ok() - { - let root_hash = self - .grove - .root_hash(transaction) - .unwrap() - .map_err(Error::GroveDB)?; - - let (ops, previous_root_hash) = - maybe_params_for_logs.expect("log params should be set above"); - - tracing::trace!( - target: "drive_grovedb_operations", - ?ops, - ?root_hash, - ?previous_root_hash, - is_transactional = transaction.is_some(), - "grovedb batch applied", - ); - } - - push_drive_operation_result(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_operation/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_operation/mod.rs deleted file mode 100644 index 4390e4197aa..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_operation/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::GroveDbOp; -use grovedb::TransactionArg; - -impl Drive { - /// Applies the given groveDB operation. - /// - /// # Parameters - /// * `operation`: The groveDB operation to apply. - /// * `validate`: Specifies whether to validate that insertions do not override existing entries. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn grove_apply_operation( - &self, - operation: GroveDbOp, - validate: bool, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.apply.grove_apply_operation { - 0 => self.grove_apply_operation_v0(operation, validate, transaction, drive_version), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_apply_operation".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_operation/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_operation/v0/mod.rs deleted file mode 100644 index 0ccd2a41af1..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_operation/v0/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::Error; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::GroveDbOp; -use grovedb::TransactionArg; - -impl Drive { - /// Applies the given groveDB operation - pub(super) fn grove_apply_operation_v0( - &self, - operation: GroveDbOp, - validate: bool, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - self.grove_apply_batch_with_add_costs( - GroveDbOpBatch { - operations: vec![operation], - }, - validate, - transaction, - &mut vec![], - drive_version, - ) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch/mod.rs deleted file mode 100644 index 4be68d4d4c2..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -mod v0; - -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::query::GroveError; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::{GroveDbOp, OpsByLevelPath}; -use grovedb::TransactionArg; -use grovedb_costs::OperationCost; - -impl Drive { - /// Applies the given groveDB operations batch. - /// - /// # Parameters - /// * `ops`: The batch of groveDB operations to apply. - /// * `validate`: Specifies whether to validate that insertions do not override existing entries. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `add_on_operations`: A closure that takes in the operation cost and optional operation by level path - /// and returns a result of groveDB operations or a grove error. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn grove_apply_partial_batch( - &self, - ops: GroveDbOpBatch, - validate: bool, - transaction: TransactionArg, - add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.apply.grove_apply_partial_batch { - 0 => self.grove_apply_partial_batch_v0( - ops, - validate, - add_on_operations, - transaction, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_apply_partial_batch".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch/v0/mod.rs deleted file mode 100644 index 26f8d07613e..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch/v0/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::Error; -use crate::query::GroveError; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::{GroveDbOp, OpsByLevelPath}; -use grovedb::TransactionArg; -use grovedb_costs::OperationCost; - -impl Drive { - /// Applies the given groveDB operations batch. - pub(super) fn grove_apply_partial_batch_v0( - &self, - ops: GroveDbOpBatch, - validate: bool, - add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - self.grove_apply_partial_batch_with_add_costs( - ops, - validate, - transaction, - add_on_operations, - &mut vec![], - drive_version, - ) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch_with_add_costs/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch_with_add_costs/mod.rs deleted file mode 100644 index 014e377ae75..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch_with_add_costs/mod.rs +++ /dev/null @@ -1,62 +0,0 @@ -mod v0; - -use crate::drive::batch::GroveDbOpBatch; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::query::GroveError; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::{GroveDbOp, OpsByLevelPath}; -use grovedb::TransactionArg; -use grovedb_costs::OperationCost; - -impl Drive { - /// Applies the given groveDB operations batch, gets and passes the costs to `push_drive_operation_result`. - /// - /// # Parameters - /// * `ops`: The batch of groveDB operations to retrieve costs for. - /// * `validate`: Specifies whether to validate that insertions do not override existing entries. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `add_on_operations`: A closure that takes in the operation cost and optional operation by level path - /// and returns a result of groveDB operations or a grove error. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn grove_apply_partial_batch_with_add_costs( - &self, - ops: GroveDbOpBatch, - validate: bool, - transaction: TransactionArg, - add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .grove_methods - .apply - .grove_apply_partial_batch_with_add_costs - { - 0 => self.grove_apply_partial_batch_with_add_costs_v0( - ops, - validate, - transaction, - add_on_operations, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_apply_partial_batch_with_add_costs".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs deleted file mode 100644 index c26e17fe483..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs +++ /dev/null @@ -1,144 +0,0 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::push_drive_operation_result; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::query::GroveError; -use grovedb::batch::{BatchApplyOptions, GroveDbOp, OpsByLevelPath}; -use grovedb::TransactionArg; -use grovedb_costs::storage_cost::removal::StorageRemovedBytes::BasicStorageRemoval; -use grovedb_costs::storage_cost::transition::OperationStorageTransitionType; -use grovedb_costs::OperationCost; - -impl Drive { - /// Applies the given groveDB operations batch and gets and passes the costs to `push_drive_operation_result`. - pub(super) fn grove_apply_partial_batch_with_add_costs_v0( - &self, - ops: GroveDbOpBatch, - validate: bool, - transaction: TransactionArg, - add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - if ops.is_empty() { - return Err(Error::Drive(DriveError::BatchIsEmpty())); - } - // println!("batch {:#?}", ops); - if self.config.batching_consistency_verification { - let consistency_results = GroveDbOp::verify_consistency_of_operations(&ops.operations); - if !consistency_results.is_empty() { - // println!("consistency_results {:#?}", consistency_results); - return Err(Error::Drive(DriveError::GroveDBInsertion( - "insertion order error", - ))); - } - } - - let cost_context = self.grove.apply_partial_batch_with_element_flags_update( - ops.operations, - Some(BatchApplyOptions { - validate_insertion_does_not_override: validate, - validate_insertion_does_not_override_tree: validate, - allow_deleting_non_empty_trees: false, - deleting_non_empty_trees_returns_error: true, - disable_operation_consistency_check: false, - base_root_storage_is_free: true, - batch_pause_height: None, - }), - |cost, old_flags, new_flags| { - // if there were no flags before then the new flags are used - if old_flags.is_none() { - return Ok(false); - } - // This could be none only because the old element didn't exist - // If they were empty we get an error - let maybe_old_storage_flags = StorageFlags::map_some_element_flags_ref(&old_flags) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive did not understand flags of old item being updated", - ) - })?; - let new_storage_flags = StorageFlags::from_element_flags_ref(new_flags) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive did not understand updated item flag information", - ) - })? - .ok_or(GroveError::JustInTimeElementFlagsClientError( - "removing flags from an item with flags is not allowed", - ))?; - match &cost.transition_type() { - OperationStorageTransitionType::OperationUpdateBiggerSize => { - let combined_storage_flags = StorageFlags::optional_combine_added_bytes( - maybe_old_storage_flags, - new_storage_flags, - cost.added_bytes, - ) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive could not combine storage flags (new flags were bigger)", - ) - })?; - let combined_flags = combined_storage_flags.to_element_flags(); - // it's possible they got bigger in the same epoch - if combined_flags == *new_flags { - // they are the same there was no update - Ok(false) - } else { - *new_flags = combined_flags; - Ok(true) - } - } - OperationStorageTransitionType::OperationUpdateSmallerSize => { - let combined_storage_flags = StorageFlags::optional_combine_removed_bytes( - maybe_old_storage_flags, - new_storage_flags, - &cost.removed_bytes, - ) - .map_err(|_| { - GroveError::JustInTimeElementFlagsClientError( - "drive could not combine storage flags (new flags were smaller)", - ) - })?; - let combined_flags = combined_storage_flags.to_element_flags(); - // it's possible they got bigger in the same epoch - if combined_flags == *new_flags { - // they are the same there was no update - Ok(false) - } else { - *new_flags = combined_flags; - Ok(true) - } - } - _ => Ok(false), - } - }, - |flags, removed_key_bytes, removed_value_bytes| { - let maybe_storage_flags = - StorageFlags::from_element_flags_ref(flags).map_err(|_| { - GroveError::SplitRemovalBytesClientError( - "drive did not understand flags of item being updated", - ) - })?; - // if there were no flags before then the new flags are used - match maybe_storage_flags { - None => Ok(( - BasicStorageRemoval(removed_key_bytes), - BasicStorageRemoval(removed_value_bytes), - )), - Some(storage_flags) => storage_flags - .split_storage_removed_bytes(removed_key_bytes, removed_value_bytes), - } - }, - add_on_operations, - transaction, - ); - push_drive_operation_result(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_batch_operations_costs/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_batch_operations_costs/mod.rs deleted file mode 100644 index bca547909ee..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_batch_operations_costs/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -mod v0; - -use crate::drive::batch::GroveDbOpBatch; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::batch::KeyInfoPath; -use grovedb::EstimatedLayerInformation; -use std::collections::HashMap; - -impl Drive { - /// Retrieves the costs for the given batch of groveDB operations. - /// The costs are then added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `ops`: The batch of groveDB operations to retrieve costs for. - /// * `estimated_layer_info`: A map with estimated layer information. - /// * `validate`: Specifies whether to validate that insertions do not override existing entries. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `drive_version`: The drive version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. - pub fn grove_batch_operations_costs( - &self, - ops: GroveDbOpBatch, - estimated_layer_info: HashMap, - validate: bool, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .grove_methods - .costs - .grove_batch_operations_costs - { - 0 => self.grove_batch_operations_costs_v0( - ops, - estimated_layer_info, - validate, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_batch_operations_costs".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_batch_operations_costs/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_batch_operations_costs/v0/mod.rs deleted file mode 100644 index c753729bd1e..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_batch_operations_costs/v0/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::grove_operations::push_drive_operation_result; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::query::GroveError; -use grovedb::batch::estimated_costs::EstimatedCostsType::AverageCaseCostsType; -use grovedb::batch::{BatchApplyOptions, KeyInfoPath}; -use grovedb::{EstimatedLayerInformation, GroveDb}; -use std::collections::HashMap; - -impl Drive { - /// Gets the costs for the given groveDB op batch and passes them to `push_drive_operation_result`. - pub(super) fn grove_batch_operations_costs_v0( - &self, - ops: GroveDbOpBatch, - estimated_layer_info: HashMap, - validate: bool, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - let cost_context = GroveDb::estimated_case_operations_for_batch( - AverageCaseCostsType(estimated_layer_info), - ops.operations, - Some(BatchApplyOptions { - validate_insertion_does_not_override: validate, - validate_insertion_does_not_override_tree: validate, - allow_deleting_non_empty_trees: false, - deleting_non_empty_trees_returns_error: true, - disable_operation_consistency_check: false, - base_root_storage_is_free: true, - batch_pause_height: None, - }), - |_, _, _| Ok(false), - |_, _, _| Err(GroveError::InternalError("not implemented")), - ); - push_drive_operation_result(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_clear/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_clear/mod.rs deleted file mode 100644 index f62bc040844..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_clear/mod.rs +++ /dev/null @@ -1,40 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; - -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Handles the deletion of an element in GroveDB at the specified path and key. - /// The operation cost is added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the subtree is to be cleared. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_clear>( - &self, - path: SubtreePath<'_, B>, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.basic.grove_clear { - 0 => self.grove_clear_v0(path, transaction), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_clear".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_clear/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_clear/v0/mod.rs deleted file mode 100644 index 7801d9e5e5f..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_clear/v0/mod.rs +++ /dev/null @@ -1,67 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use grovedb::operations::delete::ClearOptions; -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; -use tracing::Level; - -impl Drive { - /// Pushes the `OperationCost` of deleting an element in groveDB to `drive_operations`. - pub(super) fn grove_clear_v0>( - &self, - path: SubtreePath<'_, B>, - transaction: TransactionArg, - ) -> Result<(), Error> { - let options = ClearOptions { - check_for_subtrees: false, - allow_deleting_subtrees: false, - trying_to_clear_with_subtrees_returns_error: false, - }; - - #[cfg(feature = "grovedb_operations_logging")] - let maybe_params_for_logs = if tracing::event_enabled!(target: "drive_grovedb_operations", Level::TRACE) - { - let root_hash = self - .grove - .root_hash(transaction) - .unwrap() - .map_err(Error::GroveDB)?; - - Some((path.clone(), root_hash)) - } else { - None - }; - - // we will always return true if there is no error when we don't check for subtrees - let result = self - .grove - .clear_subtree(path, Some(options), transaction) - .map_err(Error::GroveDB) - .map(|_| ()); - - #[cfg(feature = "grovedb_operations_logging")] - if tracing::event_enabled!(target: "drive_grovedb_operations", Level::TRACE) - && result.is_ok() - { - let root_hash = self - .grove - .root_hash(transaction) - .unwrap() - .map_err(Error::GroveDB)?; - - let (path, previous_root_hash) = - maybe_params_for_logs.expect("log params should be set above"); - - tracing::trace!( - target: "drive_grovedb_operations", - path = ?path.to_vec(), - ?root_hash, - ?previous_root_hash, - is_transactional = transaction.is_some(), - "grovedb clear", - ); - } - - result - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_delete/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_delete/mod.rs deleted file mode 100644 index cf85fcc341a..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_delete/mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; - -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Handles the deletion of an element in GroveDB at the specified path and key. - /// The operation cost is added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the element is to be deleted. - /// * `key`: The key of the element to be deleted from the subtree. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_delete>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.basic.grove_delete { - 0 => self.grove_delete_v0(path, key, transaction, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_delete".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_delete/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_delete/v0/mod.rs deleted file mode 100644 index 3b9f07bd7af..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_delete/v0/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::drive::grove_operations::push_drive_operation_result; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use grovedb::operations::delete::DeleteOptions; -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Pushes the `OperationCost` of deleting an element in groveDB to `drive_operations`. - pub(super) fn grove_delete_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - let options = DeleteOptions { - allow_deleting_non_empty_trees: false, - deleting_non_empty_trees_returns_error: true, - base_root_storage_is_free: true, - validate_tree_at_path_exists: false, - }; - let cost_context = self.grove.delete(path, key, Some(options), transaction); - push_drive_operation_result(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get/mod.rs deleted file mode 100644 index 13fb3e56978..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get/mod.rs +++ /dev/null @@ -1,46 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::QueryType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Retrieves an element from GroveDB. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. - /// * `key`: The key of the element to be retrieved from the subtree. - /// * `query_type`: The type of query to perform, whether stateless or stateful. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Some(Element))` if the operation was successful and the element was found. - /// * `Ok(None)` if the operation was successful but the element was not found. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. - pub fn grove_get>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - query_type: QueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version.grove_methods.basic.grove_get { - 0 => self.grove_get_v0(path, key, query_type, transaction, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get/v0/mod.rs deleted file mode 100644 index 5370ded97e2..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get/v0/mod.rs +++ /dev/null @@ -1,62 +0,0 @@ -use crate::drive::grove_operations::{QueryTarget, QueryType}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::{Element, GroveDb, TransactionArg}; -use grovedb_costs::CostContext; -use grovedb_path::SubtreePath; - -impl Drive { - /// Gets the element at the given path from groveDB. - /// Pushes the `OperationCost` of getting the element to `drive_operations`. - pub(super) fn grove_get_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - query_type: QueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result, Error> { - match query_type { - QueryType::StatelessQuery { - in_tree_using_sums, - query_target, - estimated_reference_sizes, - } => { - let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); - let key_info = KeyInfo::KnownKey(key.to_vec()); - let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { - GroveDb::average_case_for_get_tree( - &key_info_path, - &key_info, - flags_size, - is_sum_tree, - in_tree_using_sums, - ) - } - QueryTarget::QueryTargetValue(estimated_value_size) => { - GroveDb::average_case_for_get( - &key_info_path, - &key_info, - in_tree_using_sums, - estimated_value_size, - estimated_reference_sizes, - ) - } - }; - - drive_operations.push(CalculatedCostOperation(cost)); - Ok(None) - } - QueryType::StatefulQuery => { - let CostContext { value, cost } = self.grove.get(path, key, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - Ok(Some(value.map_err(Error::GroveDB)?)) - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_path_query/mod.rs deleted file mode 100644 index d68cf4ecebe..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query/mod.rs +++ /dev/null @@ -1,44 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::query_result_type::{QueryResultElements, QueryResultType}; -use grovedb::{PathQuery, TransactionArg}; - -impl Drive { - /// Retrieves the results of a path query from GroveDB. - /// - /// # Parameters - /// * `path_query`: The path query to execute. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `result_type`: The expected type of result of the path query. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok((QueryResultElements, u16))` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. - pub fn grove_get_path_query( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - result_type: QueryResultType, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(QueryResultElements, u16), Error> { - match drive_version.grove_methods.basic.grove_get_path_query { - 0 => { - self.grove_get_path_query_v0(path_query, transaction, result_type, drive_operations) - } - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_path_query".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_path_query/v0/mod.rs deleted file mode 100644 index 1b26fca1fab..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query/v0/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::query_result_type::{QueryResultElements, QueryResultType}; -use grovedb::{PathQuery, TransactionArg}; -use grovedb_costs::CostContext; - -impl Drive { - /// Gets the return value and the cost of a groveDB path query. - /// Pushes the cost to `drive_operations` and returns the return value. - pub(super) fn grove_get_path_query_v0( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - result_type: QueryResultType, - drive_operations: &mut Vec, - ) -> Result<(QueryResultElements, u16), Error> { - let CostContext { value, cost } = self.grove.query( - path_query, - transaction.is_some(), - true, - result_type, - transaction, - ); - drive_operations.push(CalculatedCostOperation(cost)); - value.map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_serialized_results/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_serialized_results/mod.rs deleted file mode 100644 index 142d6437745..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_serialized_results/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::PathQuery; -use grovedb::TransactionArg; - -impl Drive { - /// Retrieves the serialized results of a path query from GroveDB. - /// - /// # Parameters - /// * `path_query`: The path query to execute. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok((Vec>, u16))` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. - pub fn grove_get_path_query_serialized_results( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(Vec>, u16), Error> { - match drive_version - .grove_methods - .basic - .grove_get_path_query_serialized_results - { - 0 => self.grove_get_path_query_serialized_results_v0( - path_query, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_path_query_serialized_results".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_serialized_results/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_serialized_results/v0/mod.rs deleted file mode 100644 index c99e84e0ea1..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_serialized_results/v0/mod.rs +++ /dev/null @@ -1,23 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::{PathQuery, TransactionArg}; -use grovedb_costs::CostContext; - -impl Drive { - /// Gets the return value and the cost of a groveDB path query. - /// Pushes the cost to `drive_operations` and returns the return value. - pub(super) fn grove_get_path_query_serialized_results_v0( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result<(Vec>, u16), Error> { - let CostContext { value, cost } = - self.grove - .query_item_value(path_query, transaction.is_some(), true, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - value.map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_with_optional/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_with_optional/mod.rs deleted file mode 100644 index 2fb13607e01..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_with_optional/mod.rs +++ /dev/null @@ -1,49 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::query_result_type::PathKeyOptionalElementTrio; -use grovedb::PathQuery; -use grovedb::TransactionArg; - -impl Drive { - /// Retrieves the results of a path query from GroveDB with optional elements. - /// - /// # Parameters - /// * `path_query`: The path query to execute. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Vec)` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. - pub fn grove_get_path_query_with_optional( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version - .grove_methods - .basic - .grove_get_path_query_with_optional - { - 0 => self.grove_get_path_query_with_optional_v0( - path_query, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_path_query_with_optional".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_with_optional/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_with_optional/v0/mod.rs deleted file mode 100644 index c456f8b6118..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_path_query_with_optional/v0/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::query_result_type::PathKeyOptionalElementTrio; -use grovedb::{PathQuery, TransactionArg}; -use grovedb_costs::CostContext; - -impl Drive { - /// Gets the return value and the cost of a groveDB path query. - /// Pushes the cost to `drive_operations` and returns the return value. - pub(super) fn grove_get_path_query_with_optional_v0( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result, Error> { - let CostContext { value, cost } = - self.grove - .query_keys_optional(path_query, true, true, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - value.map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_proved_path_query/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_proved_path_query/mod.rs deleted file mode 100644 index 06ae0e3ffc0..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_proved_path_query/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::{PathQuery, TransactionArg}; - -impl Drive { - /// Retrieves a proof of the specified path query in groveDB. - /// The operation's cost is then added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path_query`: The groveDB path query to retrieve a proof for. - /// * `verbose`: Specifies whether to include all paths in the proof (when set to `true`) or only those that were - /// affected by changes (when set to `false`). - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Vec)` if the operation was successful, returning the proof data. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_get_proved_path_query( - &self, - path_query: &PathQuery, - verbose: bool, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version - .grove_methods - .basic - .grove_get_proved_path_query - { - 0 => self.grove_get_proved_path_query_v0( - path_query, - verbose, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_proved_path_query".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_proved_path_query/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_proved_path_query/v0/mod.rs deleted file mode 100644 index cde7474ce4c..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_proved_path_query/v0/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::{PathQuery, TransactionArg}; -use grovedb_costs::CostContext; - -impl Drive { - /// Gets the return value and the cost of a groveDB proved path query. - /// Pushes the cost to `drive_operations` and returns the return value. - /// Verbose should be generally set to false unless one needs to prove - /// subsets of a proof. - pub(super) fn grove_get_proved_path_query_v0( - &self, - path_query: &PathQuery, - verbose: bool, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result, Error> { - let CostContext { value, cost } = - self.grove - .get_proved_path_query(path_query, verbose, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - value.map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw/mod.rs deleted file mode 100644 index ea5cdf12d74..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Handles the retrieval of a raw element from GroveDB at the specified path and key. - /// The operation cost is added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. - /// * `key`: The key of the element to be retrieved from the subtree. - /// * `direct_query_type`: The type of query to perform, whether stateless or stateful. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Some(Element))` if the operation was successful and the element was found. - /// * `Ok(None)` if the operation was successful but the element was not found. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_get_raw>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - direct_query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version.grove_methods.basic.grove_get_raw { - 0 => self.grove_get_raw_v0(path, key, direct_query_type, transaction, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_raw".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw/v0/mod.rs deleted file mode 100644 index 96c7d358492..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw/v0/mod.rs +++ /dev/null @@ -1,60 +0,0 @@ -use crate::drive::grove_operations::{DirectQueryType, QueryTarget}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::{Element, GroveDb, TransactionArg}; -use grovedb_costs::CostContext; -use grovedb_path::SubtreePath; - -impl Drive { - /// grove_get_raw basically means that there are no reference hops, this only matters - /// when calculating worst case costs - pub(super) fn grove_get_raw_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - direct_query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result, Error> { - match direct_query_type { - DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, - query_target, - } => { - let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); - let key_info = KeyInfo::KnownKey(key.to_vec()); - let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { - GroveDb::average_case_for_get_tree( - &key_info_path, - &key_info, - flags_size, - is_sum_tree, - in_tree_using_sums, - ) - } - QueryTarget::QueryTargetValue(estimated_value_size) => { - GroveDb::average_case_for_get_raw( - &key_info_path, - &key_info, - estimated_value_size, - in_tree_using_sums, - ) - } - }; - - drive_operations.push(CalculatedCostOperation(cost)); - Ok(None) - } - DirectQueryType::StatefulDirectQuery => { - let CostContext { value, cost } = self.grove.get_raw(path, key, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - Ok(Some(value.map_err(Error::GroveDB)?)) - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_optional/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_optional/mod.rs deleted file mode 100644 index aa8c12bbdf6..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_optional/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Handles the retrieval of a raw element from GroveDB at the specified path and key, - /// if it exists, without causing an error if the element is not found. - /// - /// The operation cost is added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. - /// * `key`: The key of the element to be retrieved from the subtree. - /// * `direct_query_type`: The type of query to perform, whether stateless or stateful. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Some(Element))` if the operation was successful and the element was found. - /// * `Ok(None)` if the operation was successful but the element was not found. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_get_raw_optional>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - direct_query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version.grove_methods.basic.grove_get_raw_optional { - 0 => self.grove_get_raw_optional_v0( - path, - key, - direct_query_type, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_raw_optional".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_optional/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_optional/v0/mod.rs deleted file mode 100644 index f351a0e7a5f..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_optional/v0/mod.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::drive::grove_operations::{DirectQueryType, QueryTarget}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::{Element, GroveDb, TransactionArg}; -use grovedb_costs::CostContext; -use grovedb_path::SubtreePath; - -impl Drive { - /// grove_get_raw basically means that there are no reference hops, this only matters - /// when calculating worst case costs - pub(super) fn grove_get_raw_optional_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - direct_query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result, Error> { - match direct_query_type { - DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, - query_target, - } => { - let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); - let key_info = KeyInfo::KnownKey(key.to_vec()); - let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { - GroveDb::average_case_for_get_tree( - &key_info_path, - &key_info, - flags_size, - is_sum_tree, - in_tree_using_sums, - ) - } - QueryTarget::QueryTargetValue(estimated_value_size) => { - GroveDb::average_case_for_get_raw( - &key_info_path, - &key_info, - estimated_value_size, - in_tree_using_sums, - ) - } - }; - - drive_operations.push(CalculatedCostOperation(cost)); - Ok(None) - } - DirectQueryType::StatefulDirectQuery => { - let CostContext { value, cost } = - self.grove.get_raw_optional(path, key, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - Ok(value.map_err(Error::GroveDB)?) - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query/mod.rs deleted file mode 100644 index dc2d43934ac..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; - -use grovedb::query_result_type::{QueryResultElements, QueryResultType}; -use grovedb::{PathQuery, TransactionArg}; - -impl Drive { - /// Retrieves the raw results of a path query from GroveDB. - /// - /// # Parameters - /// * `path_query`: The path query to execute. - /// * `transaction`: The GroveDB transaction associated with this operation. - /// * `result_type`: The desired result type of the query. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok((QueryResultElements, u16))` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. - pub fn grove_get_raw_path_query( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - result_type: QueryResultType, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(QueryResultElements, u16), Error> { - match drive_version.grove_methods.basic.grove_get_raw_path_query { - 0 => self.grove_get_raw_path_query_v0( - path_query, - transaction, - result_type, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_raw_path_query".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query/v0/mod.rs deleted file mode 100644 index 7293183a997..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query/v0/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::query_result_type::{QueryResultElements, QueryResultType}; -use grovedb::{PathQuery, TransactionArg}; -use grovedb_costs::CostContext; - -impl Drive { - /// Gets the return value and the cost of a groveDB raw path query. - /// Pushes the cost to `drive_operations` and returns the return value. - pub(super) fn grove_get_raw_path_query_v0( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - result_type: QueryResultType, - drive_operations: &mut Vec, - ) -> Result<(QueryResultElements, u16), Error> { - let CostContext { value, cost } = self.grove.query_raw( - path_query, - transaction.is_some(), - true, - result_type, - transaction, - ); - drive_operations.push(CalculatedCostOperation(cost)); - value.map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query_with_optional/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query_with_optional/mod.rs deleted file mode 100644 index ea275621730..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query_with_optional/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::query_result_type::PathKeyOptionalElementTrio; -use grovedb::{PathQuery, TransactionArg}; - -impl Drive { - /// Retrieves the raw results of a path query from GroveDB with optional elements. - /// - /// # Parameters - /// * `path_query`: The path query to execute. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Vec)` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. - pub fn grove_get_raw_path_query_with_optional( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version - .grove_methods - .basic - .grove_get_raw_path_query_with_optional - { - 0 => self.grove_get_raw_path_query_with_optional_v0( - path_query, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_raw_path_query_with_optional".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query_with_optional/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query_with_optional/v0/mod.rs deleted file mode 100644 index a76ed04f393..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_path_query_with_optional/v0/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::query_result_type::PathKeyOptionalElementTrio; -use grovedb::{PathQuery, TransactionArg}; -use grovedb_costs::CostContext; - -impl Drive { - /// Gets the return value and the cost of a groveDB path query. - /// Pushes the cost to `drive_operations` and returns the return value. - pub(super) fn grove_get_raw_path_query_with_optional_v0( - &self, - path_query: &PathQuery, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result, Error> { - let CostContext { value, cost } = - self.grove - .query_raw_keys_optional(path_query, true, true, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - value.map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/mod.rs deleted file mode 100644 index 435b60dd688..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -use grovedb_path::SubtreePath; - -impl Drive { - /// Retrieves a u64 value from GroveDB that was originally encoded as a varint. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. - /// * `key`: The key of the element to be retrieved from the subtree. - /// * `direct_query_type`: The type of query to perform, whether stateless or stateful. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(Some(u64))` if the operation was successful and the element was found and could be decoded to a u64. - /// * `Ok(None)` if the operation was successful but the element was not found. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::CorruptedElementType)` if the element was found but could not be decoded to a u64. - /// * `Err(DriveError::CorruptedQueryReturnedNonItem)` if the query returned an unexpected non-item element. - pub fn grove_get_raw_value_u64_from_encoded_var_vec>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - direct_query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version - .grove_methods - .basic - .grove_get_raw_value_u64_from_encoded_var_vec - { - 0 => self.grove_get_raw_value_u64_from_encoded_var_vec_v0( - path, - key, - direct_query_type, - transaction, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_raw_value_u64_from_encoded_var_vec".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/v0/mod.rs deleted file mode 100644 index 0b1379120eb..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/v0/mod.rs +++ /dev/null @@ -1,44 +0,0 @@ -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; -use integer_encoding::VarInt; - -impl Drive { - /// grove_get_direct_u64 is a helper function to get a - pub(super) fn grove_get_raw_value_u64_from_encoded_var_vec_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - direct_query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result, Error> { - let element = self.grove_get_raw_optional( - path, - key, - direct_query_type, - transaction, - drive_operations, - drive_version, - )?; - element - .map(|element| match element { - Element::Item(value, ..) => u64::decode_var(value.as_slice()) - .ok_or(Error::Drive(DriveError::CorruptedElementType( - "encoded value could not be decoded", - ))) - .map(|(value, _)| value), - Element::SumItem(value, ..) => Ok(value as u64), - _ => Err(Error::Drive(DriveError::CorruptedQueryReturnedNonItem( - "expected an item", - ))), - }) - .transpose() - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_sum_tree_total_value/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_sum_tree_total_value/mod.rs deleted file mode 100644 index 989fe61a4d4..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_sum_tree_total_value/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Retrieves the total value from a sum tree within groveDB at the specified path and key. - /// The cost of the operation is then appended to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the sum tree is located. - /// * `key`: The key where the sum tree resides within the subtree. - /// * `query_type`: The type of query to perform, either `StatelessDirectQuery` or `StatefulDirectQuery`. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(i64)` if the operation was successful, returning the total value of the sum tree. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - /// * `Err(DriveError::CorruptedBalancePath)` if the balance path does not refer to a sum tree. - /// * `Err(DriveError::CorruptedCodeExecution)` if trying to query a non-tree element. - pub fn grove_get_sum_tree_total_value>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - match drive_version - .grove_methods - .basic - .grove_get_sum_tree_total_value - { - 0 => self.grove_get_sum_tree_total_value_v0( - path, - key, - query_type, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_get_sum_tree_total_value".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs deleted file mode 100644 index 76f43405369..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs +++ /dev/null @@ -1,62 +0,0 @@ -use crate::drive::grove_operations::{DirectQueryType, QueryTarget}; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::{Element, GroveDb, TransactionArg}; -use grovedb_costs::CostContext; -use grovedb_path::SubtreePath; - -impl Drive { - /// Gets the element at the given path from groveDB. - /// Pushes the `OperationCost` of getting the element to `drive_operations`. - pub(super) fn grove_get_sum_tree_total_value_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result { - match query_type { - DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, - query_target, - } => { - let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); - let key_info = KeyInfo::KnownKey(key.to_vec()); - let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { - Ok(GroveDb::average_case_for_get_tree( - &key_info_path, - &key_info, - flags_size, - is_sum_tree, - in_tree_using_sums, - )) - } - _ => Err(Error::Drive(DriveError::CorruptedCodeExecution( - "can not query a non tree", - ))), - }?; - - drive_operations.push(CalculatedCostOperation(cost)); - Ok(0) - } - DirectQueryType::StatefulDirectQuery => { - let CostContext { value, cost } = self.grove.get_raw(path, key, transaction); - drive_operations.push(CalculatedCostOperation(cost)); - let element = value.map_err(Error::GroveDB)?; - match element { - Element::SumTree(_, value, _) => Ok(value), - _ => Err(Error::Drive(DriveError::CorruptedBalancePath( - "balance path does not refer to a sum tree", - ))), - } - } - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_has_raw/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_has_raw/mod.rs deleted file mode 100644 index 21c65d6125c..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_has_raw/mod.rs +++ /dev/null @@ -1,47 +0,0 @@ -mod v0; - -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; - -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Checks whether an element exists in groveDB at the specified path and key. - /// The operation's cost is then appended to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the element resides. - /// * `key`: The key where the element resides within the subtree. - /// * `query_type`: The type of query to perform, either `StatelessDirectQuery` or `StatefulDirectQuery`. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(bool)` if the operation was successful, returning `true` if the element exists and `false` otherwise. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_has_raw>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result { - match drive_version.grove_methods.basic.grove_has_raw { - 0 => self.grove_has_raw_v0(path, key, query_type, transaction, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_has_raw".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_has_raw/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_has_raw/v0/mod.rs deleted file mode 100644 index 777b5c23215..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_has_raw/v0/mod.rs +++ /dev/null @@ -1,73 +0,0 @@ -use crate::drive::grove_operations::{DirectQueryType, QueryTarget}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; -use crate::query::GroveError; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::{GroveDb, TransactionArg}; -use grovedb_costs::CostContext; -use grovedb_path::SubtreePath; - -impl Drive { - /// Gets the return value and the cost of a groveDB `has_raw` operation. - /// Pushes the cost to `drive_operations` and returns the return value. - pub(super) fn grove_has_raw_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - query_type: DirectQueryType, - transaction: TransactionArg, - drive_operations: &mut Vec, - ) -> Result { - let CostContext { value, cost } = match query_type { - DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, - query_target, - } => { - let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); - let key_info = KeyInfo::KnownKey(key.to_vec()); - let cost = match query_target { - QueryTarget::QueryTargetTree(flags_len, is_sum_tree) => { - GroveDb::average_case_for_has_raw_tree( - &key_info_path, - &key_info, - flags_len, - is_sum_tree, - in_tree_using_sums, - ) - } - QueryTarget::QueryTargetValue(estimated_value_size) => { - GroveDb::average_case_for_has_raw( - &key_info_path, - &key_info, - estimated_value_size, - in_tree_using_sums, - ) - } - }; - - CostContext { - value: Ok(false), - cost, - } - } - DirectQueryType::StatefulDirectQuery => { - if self.config.has_raw_enabled { - self.grove.has_raw(path, key, transaction) - } else { - self.grove.get_raw(path, key, transaction).map(|r| match r { - Err(GroveError::PathKeyNotFound(_)) - | Err(GroveError::PathNotFound(_)) - | Err(GroveError::PathParentLayerNotFound(_)) => Ok(false), - Err(e) => Err(e), - Ok(_) => Ok(true), - }) - } - } - }; - drive_operations.push(CalculatedCostOperation(cost)); - Ok(value?) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert/mod.rs deleted file mode 100644 index 61a94a553f6..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert/mod.rs +++ /dev/null @@ -1,47 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::operations::insert::InsertOptions; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Inserts an element into groveDB at the specified path and key. - /// The operation's cost is then added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. - /// * `key`: The key where the new element should be inserted in the subtree. - /// * `element`: The element to be inserted. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `options`: Optional insert options to further configure the operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_insert>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - element: Element, - transaction: TransactionArg, - options: Option, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.basic.grove_insert { - 0 => self.grove_insert_v0(path, key, element, transaction, options, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_insert".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert/v0/mod.rs deleted file mode 100644 index 209bcbf8ea5..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert/v0/mod.rs +++ /dev/null @@ -1,23 +0,0 @@ -use crate::drive::grove_operations::push_drive_operation_result; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use grovedb::operations::insert::InsertOptions; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Pushes the `OperationCost` of inserting an element in groveDB to `drive_operations`. - pub(super) fn grove_insert_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - element: Element, - transaction: TransactionArg, - options: Option, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - let cost_context = self.grove.insert(path, key, element, options, transaction); - push_drive_operation_result(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_sum_tree/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_sum_tree/mod.rs deleted file mode 100644 index 917e3c8dd9b..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_sum_tree/mod.rs +++ /dev/null @@ -1,55 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::operations::insert::InsertOptions; -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Inserts an empty sum tree into groveDB at the specified path and key. - /// The operation's cost is then added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. - /// * `key`: The key where the new element should be inserted in the subtree. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `options`: Optional insert options to further configure the operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_insert_empty_sum_tree>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - transaction: TransactionArg, - options: Option, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .grove_methods - .basic - .grove_insert_empty_sum_tree - { - 0 => self.grove_insert_empty_sum_tree_v0( - path, - key, - transaction, - options, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_insert_empty_sum_tree".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_sum_tree/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_sum_tree/v0/mod.rs deleted file mode 100644 index 72d0324bef1..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_sum_tree/v0/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::drive::grove_operations::push_drive_operation_result; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use grovedb::operations::insert::InsertOptions; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Pushes the `OperationCost` of inserting an empty sum tree in groveDB to `drive_operations`. - pub fn grove_insert_empty_sum_tree_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - transaction: TransactionArg, - options: Option, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - let cost_context = - self.grove - .insert(path, key, Element::empty_sum_tree(), options, transaction); - push_drive_operation_result(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_tree/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_tree/mod.rs deleted file mode 100644 index d7b1cd73dfa..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_tree/mod.rs +++ /dev/null @@ -1,45 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::operations::insert::InsertOptions; -use grovedb::TransactionArg; -use grovedb_path::SubtreePath; - -impl Drive { - /// Inserts an empty tree into groveDB at the specified path and key. - /// The operation's cost is then added to `drive_operations` for later processing. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. - /// * `key`: The key where the new element should be inserted in the subtree. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `options`: Optional insert options to further configure the operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(())` if the operation was successful. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_insert_empty_tree>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - transaction: TransactionArg, - options: Option, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version.grove_methods.basic.grove_insert_empty_tree { - 0 => self.grove_insert_empty_tree_v0(path, key, transaction, options, drive_operations), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_insert_empty_tree".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_tree/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_tree/v0/mod.rs deleted file mode 100644 index 91a72836c36..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert_empty_tree/v0/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::drive::grove_operations::push_drive_operation_result; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use grovedb::operations::insert::InsertOptions; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Pushes the `OperationCost` of inserting an empty tree in groveDB to `drive_operations`. - pub(super) fn grove_insert_empty_tree_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - transaction: TransactionArg, - options: Option, - drive_operations: &mut Vec, - ) -> Result<(), Error> { - let cost_context = - self.grove - .insert(path, key, Element::empty_tree(), options, transaction); - push_drive_operation_result(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert_if_not_exists/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert_if_not_exists/mod.rs deleted file mode 100644 index cba39bb65e3..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert_if_not_exists/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Inserts an element into groveDB only if the specified path and key do not exist. - /// This operation costs are then stored in `drive_operations`. - /// - /// # Parameters - /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. - /// * `key`: The key where the new element should be inserted in the subtree. - /// * `element`: The element to be inserted. - /// * `transaction`: The groveDB transaction associated with this operation. - /// * `drive_operations`: A vector to collect the costs of operations for later computation. In this case, - /// it collects the cost of this insert operation if the path and key did not exist. - /// * `platform_version`: The platform version to select the correct function version to run. - /// - /// # Returns - /// * `Ok(true)` if the insertion was successful. - /// * `Ok(false)` if the path and key already existed. - /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. - pub fn grove_insert_if_not_exists>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - element: Element, - transaction: TransactionArg, - drive_operations: Option<&mut Vec>, - drive_version: &DriveVersion, - ) -> Result { - match drive_version.grove_methods.basic.grove_insert_if_not_exists { - 0 => self.grove_insert_if_not_exists_v0( - path, - key, - element, - transaction, - drive_operations, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "grove_insert_if_not_exists".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/grove_insert_if_not_exists/v0/mod.rs b/packages/rs-drive/src/drive/grove_operations/grove_insert_if_not_exists/v0/mod.rs deleted file mode 100644 index 49462660e6f..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/grove_insert_if_not_exists/v0/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::drive::grove_operations::push_drive_operation_result_optional; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use grovedb::{Element, TransactionArg}; -use grovedb_path::SubtreePath; - -impl Drive { - /// Pushes the `OperationCost` of inserting an element in groveDB where the path key does not yet exist - /// to `drive_operations`. - pub(super) fn grove_insert_if_not_exists_v0>( - &self, - path: SubtreePath<'_, B>, - key: &[u8], - element: Element, - transaction: TransactionArg, - drive_operations: Option<&mut Vec>, - ) -> Result { - let cost_context = self - .grove - .insert_if_not_exists(path, key, element, transaction); - push_drive_operation_result_optional(cost_context, drive_operations) - } -} diff --git a/packages/rs-drive/src/drive/grove_operations/mod.rs b/packages/rs-drive/src/drive/grove_operations/mod.rs deleted file mode 100644 index 1ca6e9bda1e..00000000000 --- a/packages/rs-drive/src/drive/grove_operations/mod.rs +++ /dev/null @@ -1,466 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Grove Operations. -//! -//! Defines and implements in Drive functions pertinent to groveDB operations. -//! - -/// Grove insert operation -pub mod grove_insert; - -/// Grove insert operation into an empty tree -pub mod grove_insert_empty_tree; - -/// Grove insert operation into an empty sum tree -pub mod grove_insert_empty_sum_tree; - -/// Grove insert operation, but only if it doesn't already exist -pub mod grove_insert_if_not_exists; - -/// Grove delete operation -pub mod grove_delete; - -/// Fetch raw grove data -pub mod grove_get_raw; - -/// Fetch raw grove data if it exists -pub mod grove_get_raw_optional; - -/// Fetch u64 value from encoded variable vector in raw grove data -pub mod grove_get_raw_value_u64_from_encoded_var_vec; - -/// Grove get operation -pub mod grove_get; - -/// Serialized results from grove path query -pub mod grove_get_path_query_serialized_results; - -/// Grove path query operation -pub mod grove_get_path_query; - -/// Grove path query operation with optional return value -pub mod grove_get_path_query_with_optional; - -/// Fetch raw data from grove path query with optional return value -pub mod grove_get_raw_path_query_with_optional; - -/// Fetch raw data from grove path query -pub mod grove_get_raw_path_query; - -/// Proved path query in grove -pub mod grove_get_proved_path_query; - -/// Get total value from sum tree in grove -pub mod grove_get_sum_tree_total_value; - -/// Check if raw data exists in grove -pub mod grove_has_raw; - -/// Batch insert operation into empty tree -pub mod batch_insert_empty_tree; - -/// Batch insert operation into empty tree, but only if it doesn't already exist -pub mod batch_insert_empty_tree_if_not_exists; - -/// Batch insert operation into empty tree, but only if it doesn't exist and check existing operations -pub mod batch_insert_empty_tree_if_not_exists_check_existing_operations; - -/// Batch insert operation -pub mod batch_insert; - -/// Batch insert operation, but only if it doesn't already exist -pub mod batch_insert_if_not_exists; - -/// Batch insert operation, but only if the value has changed -pub mod batch_insert_if_changed_value; - -/// Batch delete operation -pub mod batch_delete; - -/// Batch remove raw data operation -pub mod batch_remove_raw; - -/// Batch delete operation up the tree while it's empty -pub mod batch_delete_up_tree_while_empty; - -/// Batch refresh reference operation -pub mod batch_refresh_reference; - -/// Apply grove operation -pub mod grove_apply_operation; - -/// Apply batch grove operation -pub mod grove_apply_batch; - -/// Apply batch grove operation with additional costs -pub mod grove_apply_batch_with_add_costs; - -/// Apply partial batch grove operation -pub mod grove_apply_partial_batch; - -/// Apply partial batch grove operation with additional costs -pub mod grove_apply_partial_batch_with_add_costs; - -/// Get cost of grove batch operations -pub mod grove_batch_operations_costs; - -/// Clear a subtree in grovedb -pub mod grove_clear; - -use grovedb_costs::CostContext; - -use grovedb::EstimatedLayerInformation; - -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::CalculatedCostOperation; - -use grovedb::Error as GroveError; - -use intmap::IntMap; - -/// Pushes an operation's `OperationCost` to `drive_operations` given its `CostContext` -/// and returns the operation's return value. -fn push_drive_operation_result( - cost_context: CostContext>, - drive_operations: &mut Vec, -) -> Result { - let CostContext { value, cost } = cost_context; - drive_operations.push(CalculatedCostOperation(cost)); - value.map_err(Error::GroveDB) -} - -/// Pushes an operation's `OperationCost` to `drive_operations` given its `CostContext` -/// if `drive_operations` is given. Returns the operation's return value. -fn push_drive_operation_result_optional( - cost_context: CostContext>, - drive_operations: Option<&mut Vec>, -) -> Result { - let CostContext { value, cost } = cost_context; - if let Some(drive_operations) = drive_operations { - drive_operations.push(CalculatedCostOperation(cost)); - } - value.map_err(Error::GroveDB) -} -/// Is subtree? -pub type IsSubTree = bool; -/// Is sum subtree? -pub type IsSumSubTree = bool; -/// Is sum tree? -pub type IsSumTree = bool; - -/// Batch delete apply type -pub enum BatchDeleteApplyType { - /// Stateless batch delete - StatelessBatchDelete { - /// Are we deleting in a sum tree - is_sum_tree: bool, - /// What is the estimatated value size - estimated_value_size: u32, - }, - /// Stateful batch delete - StatefulBatchDelete { - /// Are we known to be in a subtree and does this subtree have sums - is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, - }, -} - -/// Batch delete up tree apply type -pub enum BatchDeleteUpTreeApplyType { - /// Stateless batch delete - StatelessBatchDelete { - /// The estimated layer info - estimated_layer_info: IntMap, - }, - /// Stateful batch delete - StatefulBatchDelete { - /// Are we known to be in a subtree and does this subtree have sums - is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, - }, -} - -/// batch insert tree apply type -#[derive(Clone, Copy)] -/// Batch insert tree apply type -pub enum BatchInsertTreeApplyType { - /// Stateless batch insert tree - StatelessBatchInsertTree { - /// Does this tree use sums? - in_tree_using_sums: bool, - /// Are we inserting in a sum tree - is_sum_tree: bool, - /// The flags length - flags_len: FlagsLen, - }, - /// Stateful batch insert tree - StatefulBatchInsertTree, -} - -/// Represents the types for batch insert operations in a tree structure. -impl BatchInsertTreeApplyType { - /// Converts the current `BatchInsertTreeApplyType` into a corresponding `DirectQueryType`. - /// - /// # Returns - /// - /// - A variant of `DirectQueryType::StatelessDirectQuery` if the current type is `BatchInsertTreeApplyType::StatelessBatchInsertTree`. - /// - `DirectQueryType::StatefulDirectQuery` if the current type is `BatchInsertTreeApplyType::StatefulBatchInsertTree`. - /// ``` - pub(crate) fn to_direct_query_type(&self) -> DirectQueryType { - match self { - BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums, - is_sum_tree, - flags_len, - } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: *in_tree_using_sums, - query_target: QueryTarget::QueryTargetTree(*flags_len, *is_sum_tree), - }, - BatchInsertTreeApplyType::StatefulBatchInsertTree => { - DirectQueryType::StatefulDirectQuery - } - } - } -} - -/// Batch insert apply type -pub enum BatchInsertApplyType { - /// Stateless batch insert - StatelessBatchInsert { - /// Does this tree use sums? - in_tree_using_sums: bool, - /// the type of Target (Tree or Value) - target: QueryTarget, - }, - /// Stateful batch insert - StatefulBatchInsert, -} - -impl BatchInsertApplyType { - /// Converts the current `BatchInsertApplyType` into a corresponding `DirectQueryType`. - /// - /// # Returns - /// - /// - A variant of `DirectQueryType::StatelessDirectQuery` if the current type is `BatchInsertApplyType::StatelessBatchInsert`. - /// - `DirectQueryType::StatefulDirectQuery` if the current type is `BatchInsertApplyType::StatefulBatchInsert`. - /// ``` - pub(crate) fn to_direct_query_type(&self) -> DirectQueryType { - match self { - BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, - target, - } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: *in_tree_using_sums, - query_target: *target, - }, - BatchInsertApplyType::StatefulBatchInsert => DirectQueryType::StatefulDirectQuery, - } - } -} - -/// Flags length -pub type FlagsLen = u32; - -/// query target -#[derive(Clone, Copy)] -/// Query target -pub enum QueryTarget { - /// tree - QueryTargetTree(FlagsLen, IsSumTree), - /// value - QueryTargetValue(u32), -} - -impl QueryTarget { - /// Length - pub(crate) fn len(&self) -> u32 { - match self { - QueryTarget::QueryTargetTree(flags_len, is_sum_tree) => { - let len = if *is_sum_tree { 11 } else { 3 }; - *flags_len + len - } - QueryTarget::QueryTargetValue(len) => *len, - } - } -} - -/// direct query type -#[derive(Clone, Copy)] -/// Direct query type -pub enum DirectQueryType { - /// Stateless direct query - StatelessDirectQuery { - /// Does this tree use sums? - in_tree_using_sums: bool, - /// the type of Target (Tree or Value) - query_target: QueryTarget, - }, - /// Stateful direct query - StatefulDirectQuery, -} - -impl From for QueryType { - fn from(value: DirectQueryType) -> Self { - match value { - DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, - query_target, - } => QueryType::StatelessQuery { - in_tree_using_sums, - query_target, - estimated_reference_sizes: vec![], - }, - DirectQueryType::StatefulDirectQuery => QueryType::StatefulQuery, - } - } -} - -impl DirectQueryType { - /// Converts the current `DirectQueryType` into a corresponding `QueryType` - /// while associating it with the given reference sizes. - /// - /// # Parameters - /// - /// * `reference_sizes`: A vector of `u32` values representing the reference sizes - /// associated with the query. - /// - /// # Returns - /// - /// - A variant of `QueryType::StatelessQuery` with the provided reference sizes if - /// the current type is `DirectQueryType::StatelessDirectQuery`. - /// - `QueryType::StatefulQuery` if the current type is `DirectQueryType::StatefulDirectQuery`. - /// - /// # Example - /// - /// ```ignore - /// let direct_query = DirectQueryType::StatelessDirectQuery { - /// in_tree_using_sums: true, - /// query_target: SomeTarget, // Replace with an actual target instance. - /// }; - /// - /// let ref_sizes = vec![100, 200, 300]; - /// let query_type = direct_query.add_reference_sizes(ref_sizes); - /// ``` - #[allow(dead_code)] - pub(crate) fn add_reference_sizes(self, reference_sizes: Vec) -> QueryType { - match self { - DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, - query_target, - } => QueryType::StatelessQuery { - in_tree_using_sums, - query_target, - estimated_reference_sizes: reference_sizes, - }, - DirectQueryType::StatefulDirectQuery => QueryType::StatefulQuery, - } - } -} - -/// Query type -#[derive(Clone)] -pub enum QueryType { - /// Stateless query - StatelessQuery { - /// Does this tree use sums? - in_tree_using_sums: bool, - /// the type of Target (Tree or Value) - query_target: QueryTarget, - /// The estimated sizes of references - estimated_reference_sizes: Vec, - }, - /// Stateful query - StatefulQuery, -} - -impl From for QueryType { - fn from(value: BatchDeleteApplyType) -> Self { - match value { - BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, - estimated_value_size, - } => QueryType::StatelessQuery { - in_tree_using_sums: is_sum_tree, - query_target: QueryTarget::QueryTargetValue(estimated_value_size), - estimated_reference_sizes: vec![], - }, - BatchDeleteApplyType::StatefulBatchDelete { .. } => QueryType::StatefulQuery, - } - } -} - -impl From<&BatchDeleteApplyType> for QueryType { - fn from(value: &BatchDeleteApplyType) -> Self { - match value { - BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, - estimated_value_size, - } => QueryType::StatelessQuery { - in_tree_using_sums: *is_sum_tree, - query_target: QueryTarget::QueryTargetValue(*estimated_value_size), - estimated_reference_sizes: vec![], - }, - BatchDeleteApplyType::StatefulBatchDelete { .. } => QueryType::StatefulQuery, - } - } -} - -impl From for DirectQueryType { - fn from(value: BatchDeleteApplyType) -> Self { - match value { - BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, - estimated_value_size, - } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: is_sum_tree, - query_target: QueryTarget::QueryTargetValue(estimated_value_size), - }, - BatchDeleteApplyType::StatefulBatchDelete { .. } => { - DirectQueryType::StatefulDirectQuery - } - } - } -} - -impl From<&BatchDeleteApplyType> for DirectQueryType { - fn from(value: &BatchDeleteApplyType) -> Self { - match value { - BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, - estimated_value_size, - } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: *is_sum_tree, - query_target: QueryTarget::QueryTargetValue(*estimated_value_size), - }, - BatchDeleteApplyType::StatefulBatchDelete { .. } => { - DirectQueryType::StatefulDirectQuery - } - } - } -} diff --git a/packages/rs-drive/src/drive/identity/balance/mod.rs b/packages/rs-drive/src/drive/identity/balance/mod.rs index fecdbebd4e4..efe584ce637 100644 --- a/packages/rs-drive/src/drive/identity/balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/balance/mod.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod prove; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod update; diff --git a/packages/rs-drive/src/drive/identity/balance/prove.rs b/packages/rs-drive/src/drive/identity/balance/prove.rs index 700434a23ff..0f23f06c97a 100644 --- a/packages/rs-drive/src/drive/identity/balance/prove.rs +++ b/packages/rs-drive/src/drive/identity/balance/prove.rs @@ -14,13 +14,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result, Error> { let balance_query = Self::balance_for_identity_id_query(identity_id); - self.grove_get_proved_path_query( - &balance_query, - false, - transaction, - &mut vec![], - drive_version, - ) + self.grove_get_proved_path_query(&balance_query, transaction, &mut vec![], drive_version) } /// Proves an Identity's balance and revision from the backing store @@ -30,14 +24,11 @@ impl Drive { transaction: TransactionArg, drive_version: &DriveVersion, ) -> Result, Error> { - let balance_query = Self::balance_and_revision_for_identity_id_query(identity_id); - self.grove_get_proved_path_query( - &balance_query, - true, - transaction, - &mut vec![], - drive_version, - ) + let balance_query = Self::balance_and_revision_for_identity_id_query( + identity_id, + &drive_version.grove_version, + ); + self.grove_get_proved_path_query(&balance_query, transaction, &mut vec![], drive_version) } /// Proves multiple Identity balances from the backing store @@ -47,21 +38,16 @@ impl Drive { transaction: TransactionArg, drive_version: &DriveVersion, ) -> Result, Error> { - let balance_query = Self::balances_for_identity_ids_query(identity_ids)?; - self.grove_get_proved_path_query( - &balance_query, - false, - transaction, - &mut vec![], - drive_version, - ) + let balance_query = + Self::balances_for_identity_ids_query(identity_ids, &drive_version.grove_version)?; + self.grove_get_proved_path_query(&balance_query, transaction, &mut vec![], drive_version) } } #[cfg(test)] mod tests { use super::*; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::identity::Identity; diff --git a/packages/rs-drive/src/drive/identity/balance/update.rs b/packages/rs-drive/src/drive/identity/balance/update.rs index 6500ad80500..df5644b5463 100644 --- a/packages/rs-drive/src/drive/identity/balance/update.rs +++ b/packages/rs-drive/src/drive/identity/balance/update.rs @@ -3,10 +3,10 @@ mod tests { use dpp::prelude::*; - use crate::common::identities::create_test_identity; use crate::error::drive::DriveError; use crate::error::Error; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::test_utils::identities::create_test_identity; use dpp::block::epoch::Epoch; use dpp::identity::accessors::IdentityGettersV0; @@ -16,7 +16,7 @@ mod tests { use dpp::identity::accessors::IdentityGettersV0; use dpp::version::PlatformVersion; - use crate::fee::op::LowLevelDriveOperation; + use crate::fees::op::LowLevelDriveOperation; use super::*; @@ -62,7 +62,7 @@ mod tests { assert_eq!( fee_result, FeeResult { - processing_fee: 517620, + processing_fee: 174660, removed_bytes_from_system: 0, ..Default::default() } @@ -157,7 +157,7 @@ mod tests { fee_result, FeeResult { storage_fee: 0, - processing_fee: 1176280, + processing_fee: 385160, removed_bytes_from_system: 0, ..Default::default() } @@ -239,7 +239,7 @@ mod tests { fee_result, FeeResult { storage_fee: 0, - processing_fee: 849550, + processing_fee: 260540, removed_bytes_from_system: 0, ..Default::default() } @@ -284,7 +284,7 @@ mod tests { let app_hash_before = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -302,14 +302,14 @@ mod tests { assert_eq!( fee_result, FeeResult { - processing_fee: 9751440, + processing_fee: 4278840, ..Default::default() } ); let app_hash_after = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -371,13 +371,14 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to add to identity balance"); assert_eq!( fee_result, FeeResult { - processing_fee: 517620, + processing_fee: 174660, removed_bytes_from_system: 0, ..Default::default() } @@ -415,7 +416,7 @@ mod tests { let app_hash_before = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -429,12 +430,13 @@ mod tests { false, None, platform_version, + None, ) .expect("expected to add to identity balance"); let app_hash_after = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -443,7 +445,7 @@ mod tests { assert_eq!( fee_result, FeeResult { - processing_fee: 5418770, + processing_fee: 2476860, ..Default::default() } ); @@ -465,14 +467,14 @@ mod tests { mod apply_balance_change_from_fee_to_identity_operations { use super::*; use crate::error::identity::IdentityError; - use crate::fee::op::LowLevelDriveOperation; + use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::epoch::{CreditsPerEpoch, GENESIS_EPOCH_INDEX}; use dpp::fee::fee_result::refunds::{CreditsPerEpochByIdentifier, FeeRefunds}; use dpp::fee::fee_result::FeeResult; use dpp::fee::{Credits, SignedCredits}; use dpp::version::PlatformVersion; - use grovedb::batch::Op; + use grovedb::batch::GroveOp; use grovedb::Element; use nohash_hasher::IntMap; use std::collections::BTreeMap; @@ -547,15 +549,15 @@ mod tests { [ _, _, - LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::SumItem(refund_amount, None), }, .. }), .., - LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::SumItem(other_refund_amount, None), }, .. @@ -643,14 +645,14 @@ mod tests { [ _, _, - LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::SumItem(refund_amount, None), }, .. }), - LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::Item(debt_bytes, None), }, .. @@ -718,8 +720,8 @@ mod tests { [ _, _, - LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::Item(debt_bytes, None), }, .. @@ -773,8 +775,8 @@ mod tests { assert!(matches!( drive_operations[..], - [_, LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + [_, LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::SumItem(balance, None), }, .. @@ -832,14 +834,14 @@ mod tests { &drive_operations[..], [ _, - LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::SumItem(balance, None), }, .. }), - LowLevelDriveOperation::GroveOperation(grovedb::batch::GroveDbOp { - op: Op::Replace { + LowLevelDriveOperation::GroveOperation(grovedb::batch::QualifiedGroveDbOp { + op: GroveOp::Replace { element: Element::Item(debt_bytes, None), }, .. diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..83f7c31b1be --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/mod.rs @@ -0,0 +1,160 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::prelude::{IdentityNonce, Revision}; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Identity's contract document nonce from the backing store + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to fetch. + /// * `contract_id` - For Contract Id to fetch. + /// * `apply` - If `true`, the changes are applied, otherwise only the cost is estimated. + /// * `transaction` - Transaction arguments. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option` for the Identity's revision, otherwise an `Error` if the operation fails or the version is not supported. + pub fn fetch_identity_contract_nonce( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .fetch + .attributes + .identity_contract_nonce + { + 0 => self.fetch_identity_contract_nonce_v0( + identity_id, + contract_id, + apply, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_contract_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Creates the operations to get Identity's contract nonce from the backing store. + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to fetch. + /// * `contract_id` - For Contract Id to fetch. + /// * `apply` - If `true`, the changes are applied, otherwise only the cost is estimated. + /// * `transaction` - Transaction arguments. + /// * `drive_operations` - A mutable reference to a vector of low-level drive operations. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option` for the Identity's revision, otherwise an `Error` if the operation fails or the version is not supported. + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub(crate) fn fetch_identity_contract_nonce_operations( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .fetch + .attributes + .identity_contract_nonce + { + 0 => self.fetch_identity_contract_nonce_operations_v0( + identity_id, + contract_id, + apply, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_contract_nonce_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Fetches the Identity's contract nonce from the backing store with its associated fees. + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to fetch. + /// * `contract_id` - For Contract Id to fetch. + /// * `block_info` - Information about the block. + /// * `apply` - If `true`, the changes are applied, otherwise only the cost is estimated. + /// * `transaction` - Transaction arguments. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option` for the Identity's revision and the `FeeResult`, otherwise an `Error` if the operation fails or the version is not supported. + pub fn fetch_identity_contract_nonce_with_fees( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Option, FeeResult), Error> { + match platform_version + .drive + .methods + .identity + .fetch + .attributes + .identity_contract_nonce + { + 0 => self.fetch_identity_contract_nonce_with_fees_v0( + identity_id, + contract_id, + block_info, + apply, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_contract_nonce_with_fees".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..14a8e3e05ee --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/v0/mod.rs @@ -0,0 +1,119 @@ +use crate::drive::identity::identity_contract_info_group_path; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::prelude::IdentityNonce; + +use crate::drive::identity::contract_info::ContractInfoStructure::IdentityContractNonceKey; +use dpp::version::PlatformVersion; +use grovedb::Element::Item; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Identity's contract revision from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_identity_contract_nonce_v0( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations: Vec = vec![]; + self.fetch_identity_contract_nonce_operations_v0( + identity_id, + contract_id, + apply, + transaction, + &mut drive_operations, + platform_version, + ) + } + + /// Creates the operations to get Identity's contract revision from the backing store + /// This gets operations based on apply flag (stateful vs stateless) + pub(super) fn fetch_identity_contract_nonce_operations_v0( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let direct_query_type = if apply { + DirectQueryType::StatefulDirectQuery + } else { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: false, + query_target: QueryTargetValue(1), + } + }; + let identity_contract_path = + identity_contract_info_group_path(&identity_id, contract_id.as_slice()); + match self.grove_get_raw_optional( + (&identity_contract_path).into(), + &[IdentityContractNonceKey as u8], + direct_query_type, + transaction, + drive_operations, + &platform_version.drive, + ) { + Ok(Some(Item(encoded_nonce, _))) => { + let nonce = + IdentityNonce::from_be_bytes(encoded_nonce.try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedElementType( + "identity contract nonce was not 8 bytes as expected", + )) + })?); + + Ok(Some(nonce)) + } + + Ok(None) => Ok(None), + + Ok(Some(..)) => Err(Error::Drive(DriveError::CorruptedElementType( + "identity contract nonce was present but was not identified as an item", + ))), + + Err(e) => Err(e), + } + } + + /// Fetches the Identity's contract revision from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_identity_contract_nonce_with_fees_v0( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Option, FeeResult), Error> { + let mut drive_operations: Vec = vec![]; + let value = self.fetch_identity_contract_nonce_operations_v0( + identity_id, + contract_id, + apply, + transaction, + &mut drive_operations, + platform_version, + )?; + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + Ok((value, fees)) + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..7fe12af0882 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/mod.rs @@ -0,0 +1,90 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; + +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::identity::identity_nonce::MergeIdentityNonceResult; +use dpp::prelude::IdentityNonce; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::HashMap; + +mod v0; + +impl Drive { + /// Merges the given revision into the identity contract pair nonce + pub fn merge_identity_contract_nonce( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + revision_nonce: IdentityNonce, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .identity + .contract_info + .merge_identity_contract_nonce + { + 0 => self.merge_identity_contract_nonce_v0( + identity_id, + contract_id, + revision_nonce, + block_info, + apply, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "merge_revision_nonce_for_identity_contract_pair".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Gives the operations of merging the given revision into the identity contract pair nonce + pub fn merge_identity_contract_nonce_operations( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + revision_nonce: IdentityNonce, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(MergeIdentityNonceResult, Vec), Error> { + match platform_version + .drive + .methods + .identity + .contract_info + .merge_identity_contract_nonce + { + 0 => self.merge_identity_contract_nonce_operations_v0( + identity_id, + contract_id, + revision_nonce, + block_info, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "merge_revision_nonce_for_identity_contract_pair_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..aaa805ca542 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/v0/mod.rs @@ -0,0 +1,637 @@ +use crate::drive::identity::contract_info::ContractInfoStructure::IdentityContractNonceKey; +use crate::drive::identity::IdentityRootStructure::IdentityContractInfo; +use crate::drive::identity::{ + identity_contract_info_group_path, identity_contract_info_root_path_vec, identity_path_vec, +}; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::{PathKeyElementInfo, PathKeyInfo}; + +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::identity::identity_nonce::{IDENTITY_NONCE_VALUE_FILTER, IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES, MAX_MISSING_IDENTITY_REVISIONS, MISSING_IDENTITY_REVISIONS_FILTER, MISSING_IDENTITY_REVISIONS_MAX_BYTES}; +use dpp::prelude::IdentityNonce; +use crate::drive::identity::contract_info::identity_contract_nonce::merge_identity_contract_nonce::MergeIdentityNonceResult; +use crate::drive::identity::contract_info::identity_contract_nonce::merge_identity_contract_nonce::MergeIdentityNonceResult::{MergeIdentityNonceSuccess, NonceAlreadyPresentAtTip, NonceAlreadyPresentInPast, NonceTooFarInFuture, NonceTooFarInPast}; + +impl Drive { + pub(in crate::drive::identity::contract_info) fn merge_identity_contract_nonce_v0( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + identity_contract_nonce: IdentityNonce, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + let mut estimated_costs_only_with_layer_info = if apply { + None::> + } else { + Some(HashMap::new()) + }; + + let (result, batch_operations) = self.merge_identity_contract_nonce_operations_v0( + identity_id, + contract_id, + identity_contract_nonce, + block_info, + &mut estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + + if !result.is_error() { + self.apply_batch_low_level_drive_operations( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_operations, + &platform_version.drive, + )?; + } + + Ok(result) + } + + /// Sets the revision nonce for the identity contract pair + pub(super) fn merge_identity_contract_nonce_operations_v0( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + revision_nonce: IdentityNonce, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(MergeIdentityNonceResult, Vec), Error> { + let mut drive_operations = vec![]; + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok((MergeIdentityNonceResult::InvalidNonce, drive_operations)); + } + + if revision_nonce == 0 { + return Ok((MergeIdentityNonceResult::InvalidNonce, drive_operations)); + } + + let identity_path = identity_path_vec(identity_id.as_slice()); + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_contract_info( + &identity_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: false, + flags_len: 0, + } + }; + + let previous_nonce_is_sure_to_not_exist = if revision_nonce + <= MAX_MISSING_IDENTITY_REVISIONS + { + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info( + &identity_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + // we insert the contract root tree if it doesn't exist already + self.batch_insert_empty_tree_if_not_exists( + PathKeyInfo::<0>::PathKey((identity_path, vec![IdentityContractInfo as u8])), + false, + None, + apply_type, + transaction, + &mut None, + &mut drive_operations, + &platform_version.drive, + )?; + + // we insert the contract root tree if it doesn't exist already + let inserted = self.batch_insert_empty_tree_if_not_exists( + PathKeyInfo::<0>::PathKey(( + identity_contract_info_root_path_vec(&identity_id), + contract_id.to_vec(), + )), + false, + None, + apply_type, + transaction, + &mut None, + &mut drive_operations, + &platform_version.drive, + )?; + if estimated_costs_only_with_layer_info.is_none() { + inserted + } else { + false //in the case of fee estimation it might exist + } + } else { + false + }; + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_contract_info_group( + &identity_id, + &contract_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + let (existing_nonce, _fees) = if previous_nonce_is_sure_to_not_exist { + (None, FeeResult::default()) + } else { + self.fetch_identity_contract_nonce_with_fees( + identity_id, + contract_id, + block_info, + estimated_costs_only_with_layer_info.is_none(), + transaction, + platform_version, + )? + }; + + let (nonce_to_set, is_new) = if estimated_costs_only_with_layer_info.is_some() { + // we are just getting estimated costs + (revision_nonce, true) + } else if let Some(existing_nonce) = existing_nonce { + let actual_existing_revision = existing_nonce & IDENTITY_NONCE_VALUE_FILTER; + let nonce_to_set = match actual_existing_revision.cmp(&revision_nonce) { + std::cmp::Ordering::Equal => { + // we were not able to update the revision as it is the same as we already had + return Ok((NonceAlreadyPresentAtTip, drive_operations)); + } + std::cmp::Ordering::Less => { + if revision_nonce - actual_existing_revision + > MISSING_IDENTITY_REVISIONS_MAX_BYTES + { + // we are too far away from the actual revision + return Ok((NonceTooFarInFuture, drive_operations)); + } else { + let missing_amount_of_revisions = + revision_nonce - actual_existing_revision - 1; + let new_previous_missing_revisions = (existing_nonce + & MISSING_IDENTITY_REVISIONS_FILTER) + << (missing_amount_of_revisions + 1); + // the missing_revisions_bytes are the amount of bytes to put in the missing area + let missing_revisions_bytes = if missing_amount_of_revisions > 0 { + ((1 << missing_amount_of_revisions) - 1) + << IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES + } else { + 0 + }; + new_previous_missing_revisions | revision_nonce | missing_revisions_bytes + } + } + std::cmp::Ordering::Greater => { + let previous_revision_position_from_top = + actual_existing_revision - revision_nonce; + if previous_revision_position_from_top >= MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + return Ok((NonceTooFarInPast, drive_operations)); + } else { + let old_missing_revisions = + existing_nonce & MISSING_IDENTITY_REVISIONS_FILTER; + if old_missing_revisions == 0 { + return Ok(( + NonceAlreadyPresentInPast(previous_revision_position_from_top), + drive_operations, + )); + } else { + let byte_to_unset = 1 + << (previous_revision_position_from_top - 1 + + IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES); + let old_revision_already_set = + old_missing_revisions | byte_to_unset != old_missing_revisions; + if old_revision_already_set { + return Ok(( + NonceAlreadyPresentInPast(previous_revision_position_from_top), + drive_operations, + )); + } else { + existing_nonce & !byte_to_unset + } + } + } + } + }; + (nonce_to_set, false) + } else if revision_nonce >= MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + return Ok((NonceTooFarInFuture, drive_operations)); + } else { + // there was no previous revision nonce, just set + // todo: this will only work if we have at most one document per state transition + // when we change batch state transitions back to multiple we need to check existing + // operations. + + let missing_amount_of_revisions = revision_nonce - 1; + // the missing_revisions_bytes are the amount of bytes to put in the missing area + let missing_revisions_bytes = if missing_amount_of_revisions > 0 { + ((1 << missing_amount_of_revisions) - 1) << IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES + } else { + 0 + }; + + (missing_revisions_bytes | revision_nonce, true) + }; + + let identity_contract_nonce_bytes = nonce_to_set.to_be_bytes().to_vec(); + let identity_contract_nonce_element = Element::new_item(identity_contract_nonce_bytes); + + //println!("{} is {:b}, existing was {:?}", nonce_to_set, nonce_to_set, existing_nonce); + + if is_new { + self.batch_insert( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + identity_contract_info_group_path(&identity_id, &contract_id), + &[IdentityContractNonceKey as u8], + identity_contract_nonce_element, + )), + &mut drive_operations, + &platform_version.drive, + )?; + } else { + // We are replacing the nonce, matters for fees + self.batch_replace( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + identity_contract_info_group_path(&identity_id, &contract_id), + &[IdentityContractNonceKey as u8], + identity_contract_nonce_element, + )), + &mut drive_operations, + &platform_version.drive, + )?; + } + + Ok((MergeIdentityNonceSuccess(nonce_to_set), drive_operations)) + } +} + +#[cfg(feature = "server")] +#[cfg(test)] +mod tests { + use crate::drive::Drive; + use crate::util::test_helpers::setup::setup_drive; + use dpp::block::block_info::BlockInfo; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::Identity; + use dpp::prelude::IdentityNonce; + use platform_version::version::PlatformVersion; + + fn setup_base_test(contract_id: [u8; 32]) -> (Drive, Identity) { + let drive = setup_drive(None); + let transaction = drive.grove.start_transaction(); + + let platform_version = PlatformVersion::first(); + + drive + .create_initial_state_structure(Some(&transaction), platform_version) + .expect("expected to create root tree successfully"); + + let identity = Identity::random_identity(5, Some(12345), platform_version) + .expect("expected a random identity"); + + drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to insert identity"); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 1, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + drive + .commit_transaction(transaction, &platform_version.drive) + .expect("expected to commit transaction"); + + (drive, identity) + } + + #[test] + fn merge_identity_contract_nonce_with_bump() { + let contract_id = [0; 32]; + let (drive, identity) = setup_base_test(contract_id); + + let platform_version = PlatformVersion::first(); + + let transaction = drive.grove.start_transaction(); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 2, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + } + + #[test] + fn merge_identity_contract_nonce_0_is_invalid() { + let contract_id = [0; 32]; + let (drive, identity) = setup_base_test(contract_id); + + let platform_version = PlatformVersion::first(); + + let transaction = drive.grove.start_transaction(); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 0, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!(result.error_message(), Some("nonce is an invalid value")); + } + + #[test] + fn merge_identity_contract_nonce_many_updates() { + let contract_id = [0; 32]; + let (drive, identity) = setup_base_test(contract_id); + + let platform_version = PlatformVersion::first(); + + let transaction = drive.grove.start_transaction(); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 10, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 9, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 8, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 3, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 12, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 11, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 11, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!( + result.error_message(), + Some("nonce already present in past") + ); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 12, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!(result.error_message(), Some("nonce already present at tip")); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 0, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!(result.error_message(), Some("nonce is an invalid value")); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 12 + 25, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!(result.error_message(), Some("nonce too far in future")); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 12 + 24, // 36 + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 13, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert!(result.error_message().is_none()); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 12, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!(result.error_message(), Some("nonce too far in past")); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + 8, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!(result.error_message(), Some("nonce too far in past")); + + let result = drive + .merge_identity_contract_nonce_v0( + identity.id().to_buffer(), + contract_id, + IdentityNonce::MAX, + &BlockInfo::default(), + true, + Some(&transaction), + &mut vec![], + platform_version, + ) + .expect("expected to merge identity contract nonce"); + + assert_eq!(result.error_message(), Some("nonce is an invalid value")); + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..a874e27e83f --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/mod.rs @@ -0,0 +1,5 @@ +#[cfg(feature = "server")] +mod fetch_identity_contract_nonce; +pub(crate) mod merge_identity_contract_nonce; +#[cfg(feature = "server")] +mod prove_identity_contract_nonce; diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/prove_identity_contract_nonce/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/prove_identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..538f38e2c0e --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/prove_identity_contract_nonce/mod.rs @@ -0,0 +1,44 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; +use grovedb::TransactionArg; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Fetches the Identity's contract document nonce from the backing store + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to prove. + /// * `contract_id` - For Contract Id to prove. + /// * `transaction` - Transaction arguments. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option` for the Identity's revision, otherwise an `Error` if the operation fails or the version is not supported. + pub fn prove_identity_contract_nonce( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version.methods.identity.prove.identity_contract_nonce { + 0 => self.prove_identity_contract_nonce_v0( + identity_id, + contract_id, + transaction, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "prove_identity_contract_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/prove_identity_contract_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/prove_identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..b634d3fa4d4 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/prove_identity_contract_nonce/v0/mod.rs @@ -0,0 +1,23 @@ +use crate::drive::Drive; +use crate::error::Error; +use grovedb::TransactionArg; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Proves the Identity's contract nonce from the backing store + pub(super) fn prove_identity_contract_nonce_v0( + &self, + identity_id: [u8; 32], + contract_id: [u8; 32], + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result, Error> { + let identity_contract_path = Self::identity_contract_nonce_query(identity_id, contract_id); + self.grove_get_proved_path_query( + &identity_contract_path, + transaction, + &mut vec![], + drive_version, + ) + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/insert/add_potential_contract_info_for_contract_bounded_key/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/insert/add_potential_contract_info_for_contract_bounded_key/mod.rs deleted file mode 100644 index 7ad6e460586..00000000000 --- a/packages/rs-drive/src/drive/identity/contract_info/insert/add_potential_contract_info_for_contract_bounded_key/mod.rs +++ /dev/null @@ -1,71 +0,0 @@ -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::epoch::Epoch; -use dpp::identity::IdentityPublicKey; -use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use platform_version::version::PlatformVersion; -use std::collections::HashMap; - -mod v0; - -impl Drive { - /// Adds potential contract information for a contract-bounded key. - /// - /// This function considers the contract bounds associated with an identity key and forms the operations needed to process the contract information. - /// - /// # Arguments - /// - /// * `identity_id` - An array of bytes representing the identity id. - /// * `identity_key` - A reference to the `IdentityPublicKey` associated with the contract. - /// * `epoch` - The current epoch. - /// * `estimated_costs_only_with_layer_info` - A mutable reference to an optional `HashMap` that may contain estimated layer information. - /// * `transaction` - The transaction arguments. - /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` objects. - /// * `platform_version` - A reference to the platform version information. - /// - /// # Returns - /// - /// * `Result<(), Error>` - If successful, returns unit (`()`). If an error occurs during the operation, returns an `Error`. - /// - /// # Errors - /// - /// This function may return an `Error` if the operation creation process fails or if the platform version does not match any of the implemented method versions. - pub(crate) fn add_potential_contract_info_for_contract_bounded_key( - &self, - identity_id: [u8; 32], - identity_key: &IdentityPublicKey, - epoch: &Epoch, - estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - transaction: TransactionArg, - drive_operations: &mut Vec, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - match platform_version - .drive - .methods - .identity - .contract_info - .add_potential_contract_info_for_contract_bounded_key - { - 0 => self.add_potential_contract_info_for_contract_bounded_key_v0( - identity_id, - identity_key, - epoch, - estimated_costs_only_with_layer_info, - transaction, - drive_operations, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "add_potential_contract_info_for_contract_bounded_key".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/identity/contract_info/insert/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/insert/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs deleted file mode 100644 index be1d31b5a5b..00000000000 --- a/packages/rs-drive/src/drive/identity/contract_info/insert/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs +++ /dev/null @@ -1,470 +0,0 @@ -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; -use crate::drive::grove_operations::{BatchInsertApplyType, BatchInsertTreeApplyType}; -use crate::drive::identity::contract_info::insert::DataContractApplyInfo; -use crate::drive::identity::IdentityRootStructure::IdentityContractInfo; -use crate::drive::identity::{ - identity_contract_info_group_path_key_purpose_vec, identity_contract_info_group_path_vec, - identity_contract_info_root_path_vec, identity_key_location_within_identity_vec, - identity_path_vec, -}; -use crate::drive::object_size_info::{PathKeyElementInfo, PathKeyInfo}; -use crate::drive::Drive; -use crate::error::contract::DataContractError; -use crate::error::identity::IdentityError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::config::v0::DataContractConfigGettersV0; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; -use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::identity::{IdentityPublicKey, Purpose}; -use dpp::version::PlatformVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::reference_path::ReferencePathType::{SiblingReference, UpstreamRootHeightReference}; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; -use grovedb_costs::OperationCost; -use integer_encoding::VarInt; -use std::collections::HashMap; - -impl Drive { - pub(super) fn add_potential_contract_info_for_contract_bounded_key_v0( - &self, - identity_id: [u8; 32], - identity_key: &IdentityPublicKey, - epoch: &Epoch, - estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - transaction: TransactionArg, - drive_operations: &mut Vec, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - if let Some(contract_bounds) = &identity_key.contract_bounds() { - // We need to get the contract - let contract_apply_info = DataContractApplyInfo::new_from_single_key( - identity_key.id(), - identity_key.purpose(), - contract_bounds, - self, - epoch, - transaction, - drive_operations, - platform_version, - )?; - self.add_contract_info_operations_v0( - identity_id, - epoch, - vec![contract_apply_info], - estimated_costs_only_with_layer_info, - transaction, - drive_operations, - platform_version, - )?; - } - Ok(()) - } - - /// Adds the contract info operations - fn add_contract_info_operations_v0( - &self, - identity_id: [u8; 32], - epoch: &Epoch, - contract_infos: Vec, - estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - transaction: TransactionArg, - drive_operations: &mut Vec, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - let identity_path = identity_path_vec(identity_id.as_slice()); - - if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { - Self::add_estimation_costs_for_contract_info( - &identity_id, - estimated_costs_only_with_layer_info, - &platform_version.drive, - )?; - } - - let apply_type = if estimated_costs_only_with_layer_info.is_none() { - BatchInsertTreeApplyType::StatefulBatchInsertTree - } else { - BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, - flags_len: 0, - } - }; - - // we insert the contract root tree if it doesn't exist already - self.batch_insert_empty_tree_if_not_exists_check_existing_operations( - PathKeyInfo::<0>::PathKey((identity_path, vec![IdentityContractInfo as u8])), - None, - apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - - for contract_info in contract_infos.into_iter() { - let root_id = contract_info.root_id(); - - let contract = if estimated_costs_only_with_layer_info.is_none() { - // we should start by fetching the contract - let (fee, contract) = self.get_contract_with_fetch_info_and_fee( - root_id, - Some(epoch), - true, - transaction, - platform_version, - )?; - - let fee = fee.ok_or(Error::Identity( - IdentityError::IdentityKeyDataContractNotFound, - ))?; - let contract = contract.ok_or(Error::Identity( - IdentityError::IdentityKeyDataContractNotFound, - ))?; - drive_operations.push(LowLevelDriveOperation::PreCalculatedFeeResult(fee)); - Some(contract) - } else { - drive_operations.push(LowLevelDriveOperation::CalculatedCostOperation( - OperationCost { - seek_count: 1, - storage_cost: Default::default(), - storage_loaded_bytes: 100, - hash_node_calls: 0, - }, - )); - None - }; - - let (document_keys, contract_or_family_keys) = contract_info.keys(); - - if !contract_or_family_keys.is_empty() { - // we only need to do this once - if let Some(estimated_costs_only_with_layer_info) = - estimated_costs_only_with_layer_info - { - Self::add_estimation_costs_for_contract_info_group( - &identity_id, - &root_id, - estimated_costs_only_with_layer_info, - &platform_version.drive, - )?; - } - - self.batch_insert_empty_tree_if_not_exists_check_existing_operations( - PathKeyInfo::<0>::PathKey(( - identity_contract_info_root_path_vec(&identity_id), - root_id.to_vec(), - )), - None, - apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - } - - for (key_id, purpose) in contract_or_family_keys { - if let Some(estimated_costs_only_with_layer_info) = - estimated_costs_only_with_layer_info - { - Self::add_estimation_costs_for_contract_info_group_key_purpose( - &identity_id, - &root_id, - purpose, - estimated_costs_only_with_layer_info, - &platform_version.drive, - )?; - } - - // We need to insert the key type - self.batch_insert_empty_tree_if_not_exists_check_existing_operations( - PathKeyInfo::<0>::PathKey(( - identity_contract_info_group_path_vec(&identity_id, &root_id), - vec![purpose as u8], - )), - None, - apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - - // we need to add a reference to the key - let key_id_bytes = key_id.encode_var_vec(); - let key_reference = - identity_key_location_within_identity_vec(key_id_bytes.as_slice()); - - let reference_type_path = UpstreamRootHeightReference(2, key_reference); - - let ref_apply_type = if estimated_costs_only_with_layer_info.is_none() { - BatchInsertApplyType::StatefulBatchInsert - } else { - BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, - target: QueryTargetValue(reference_type_path.serialized_size() as u32), - } - }; - - // at this point we want to know if the contract is single key or multiple key - let storage_key_requirements = contract - .as_ref() - .map(|contract| match purpose { - Purpose::ENCRYPTION => { - let encryption_storage_key_requirements = contract - .contract - .config() - .requires_identity_encryption_bounded_key() - .ok_or(Error::DataContract( - DataContractError::KeyBoundsExpectedButNotPresent( - "expected encryption key bounds", - ), - ))?; - Ok(encryption_storage_key_requirements) - } - Purpose::DECRYPTION => { - let decryption_storage_key_requirements = contract - .contract - .config() - .requires_identity_decryption_bounded_key() - .ok_or(Error::DataContract( - DataContractError::KeyBoundsExpectedButNotPresent( - "expected encryption key bounds", - ), - ))?; - Ok(decryption_storage_key_requirements) - } - _ => Err(Error::Identity(IdentityError::IdentityKeyBoundsError( - "purpose not available for key bounds", - ))), - }) - .transpose()? - .unwrap_or(StorageKeyRequirements::MultipleReferenceToLatest); - - // if we are multiple we insert the key under the key bytes, otherwise it is under 0 - - if storage_key_requirements == StorageKeyRequirements::Unique { - self.batch_insert_if_not_exists( - PathKeyElementInfo::<0>::PathKeyElement(( - identity_contract_info_group_path_key_purpose_vec( - &identity_id, - &root_id, - purpose, - ), - vec![], - Element::Reference(reference_type_path, Some(1), None), - )), - ref_apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - } else { - self.batch_insert_if_not_exists( - PathKeyElementInfo::<0>::PathKeyRefElement(( - identity_contract_info_group_path_key_purpose_vec( - &identity_id, - &root_id, - purpose, - ), - key_id_bytes.as_slice(), - Element::Reference(reference_type_path, Some(1), None), - )), - ref_apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - }; - - if storage_key_requirements == StorageKeyRequirements::MultipleReferenceToLatest { - // we also insert a sibling reference so we can query the current key - - let sibling_ref_type_path = SiblingReference(key_id_bytes); - - self.batch_insert( - PathKeyElementInfo::<0>::PathKeyElement(( - identity_contract_info_group_path_vec(&identity_id, &root_id), - vec![], - Element::Reference(sibling_ref_type_path, Some(2), None), - )), - drive_operations, - &platform_version.drive, - )?; - } - } - - for (document_type_name, document_key_ids) in document_keys { - // The path is the concatenation of the contract_id and the document type name - let mut contract_id_bytes_with_document_type_name = root_id.to_vec(); - contract_id_bytes_with_document_type_name.extend(document_type_name.as_bytes()); - - if let Some(estimated_costs_only_with_layer_info) = - estimated_costs_only_with_layer_info - { - Self::add_estimation_costs_for_contract_info_group( - &identity_id, - &contract_id_bytes_with_document_type_name, - estimated_costs_only_with_layer_info, - &platform_version.drive, - )?; - } - - self.batch_insert_empty_tree_if_not_exists_check_existing_operations( - PathKeyInfo::<0>::PathKey(( - identity_contract_info_root_path_vec(&identity_id), - contract_id_bytes_with_document_type_name.to_vec(), - )), - None, - apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - for (key_id, purpose) in document_key_ids { - if let Some(estimated_costs_only_with_layer_info) = - estimated_costs_only_with_layer_info - { - Self::add_estimation_costs_for_contract_info_group_key_purpose( - &identity_id, - &contract_id_bytes_with_document_type_name, - purpose, - estimated_costs_only_with_layer_info, - &platform_version.drive, - )?; - } - - // We need to insert the key type - self.batch_insert_empty_tree_if_not_exists_check_existing_operations( - PathKeyInfo::<0>::PathKey(( - identity_contract_info_group_path_vec( - &identity_id, - &contract_id_bytes_with_document_type_name, - ), - vec![purpose as u8], - )), - None, - apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - - // we need to add a reference to the key - let key_id_bytes = key_id.encode_var_vec(); - let key_reference = - identity_key_location_within_identity_vec(key_id_bytes.as_slice()); - - let reference = UpstreamRootHeightReference(2, key_reference); - - let ref_apply_type = if estimated_costs_only_with_layer_info.is_none() { - BatchInsertApplyType::StatefulBatchInsert - } else { - BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, - target: QueryTargetValue(reference.serialized_size() as u32), - } - }; - - // at this point we want to know if the contract is single key or multiple key - let storage_key_requirements = contract - .as_ref() - .map(|contract| match purpose { - Purpose::ENCRYPTION => { - let document_type = contract - .contract - .document_type_for_name(document_type_name.as_str())?; - let encryption_storage_key_requirements = document_type - .requires_identity_encryption_bounded_key() - .ok_or(Error::DataContract( - DataContractError::KeyBoundsExpectedButNotPresent( - "expected encryption key bounds in document type", - ), - ))?; - Ok(encryption_storage_key_requirements) - } - Purpose::DECRYPTION => { - let document_type = contract - .contract - .document_type_for_name(document_type_name.as_str())?; - let decryption_storage_key_requirements = document_type - .requires_identity_decryption_bounded_key() - .ok_or(Error::DataContract( - DataContractError::KeyBoundsExpectedButNotPresent( - "expected encryption key bounds in document type", - ), - ))?; - Ok(decryption_storage_key_requirements) - } - _ => Err(Error::Identity(IdentityError::IdentityKeyBoundsError( - "purpose not available for key bounds", - ))), - }) - .transpose()? - .unwrap_or(StorageKeyRequirements::MultipleReferenceToLatest); - - if storage_key_requirements == StorageKeyRequirements::Unique { - self.batch_insert( - PathKeyElementInfo::<0>::PathKeyElement(( - identity_contract_info_group_path_key_purpose_vec( - &identity_id, - &contract_id_bytes_with_document_type_name, - purpose, - ), - vec![], - Element::Reference(reference, Some(1), None), - )), - drive_operations, - &platform_version.drive, - )?; - } else { - self.batch_insert_if_not_exists( - PathKeyElementInfo::<0>::PathKeyElement(( - identity_contract_info_group_path_key_purpose_vec( - &identity_id, - &contract_id_bytes_with_document_type_name, - purpose, - ), - key_id_bytes.clone(), - Element::Reference(reference, Some(1), None), - )), - ref_apply_type, - transaction, - drive_operations, - &platform_version.drive, - )?; - }; - - if storage_key_requirements == StorageKeyRequirements::MultipleReferenceToLatest - { - // we also insert a sibling reference so we can query the current key - - let sibling_ref_type_path = SiblingReference(key_id_bytes); - - self.batch_insert( - PathKeyElementInfo::<0>::PathKeyElement(( - identity_contract_info_group_path_key_purpose_vec( - &identity_id, - &contract_id_bytes_with_document_type_name, - purpose, - ), - vec![], - Element::Reference(sibling_ref_type_path, Some(2), None), - )), - drive_operations, - &platform_version.drive, - )?; - } - } - } - } - - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/identity/contract_info/insert/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/insert/mod.rs deleted file mode 100644 index 9b0e2876a29..00000000000 --- a/packages/rs-drive/src/drive/identity/contract_info/insert/mod.rs +++ /dev/null @@ -1,121 +0,0 @@ -mod add_potential_contract_info_for_contract_bounded_key; - -use crate::drive::batch::DriveOperation; -use crate::drive::grove_operations::BatchInsertApplyType::StatefulBatchInsert; -use crate::drive::grove_operations::BatchInsertTreeApplyType::StatefulBatchInsertTree; -use crate::drive::identity::contract_info::insert::DataContractApplyInfo::ContractBased; -use crate::drive::identity::IdentityRootStructure::IdentityContractInfo; -use crate::drive::identity::{ - identity_contract_info_group_path_vec, identity_contract_info_root_path_vec, - identity_key_location_within_identity_vec, identity_path_vec, -}; -use crate::drive::object_size_info::{PathKeyElementInfo, PathKeyInfo}; -use crate::drive::Drive; -use crate::error::identity::IdentityError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::identifier::Identifier; -use dpp::identity::contract_bounds::ContractBounds; -use dpp::identity::{IdentityPublicKey, KeyID, Purpose}; -use dpp::version::PlatformVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::reference_path::ReferencePathType::UpstreamRootHeightReference; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; -use integer_encoding::VarInt; -use std::collections::{BTreeMap, HashMap}; - -pub enum DataContractApplyInfo { - /// The root_id is either a contract id or an owner id - /// It is a contract id for in the case of contract bound keys or contract - /// document bound keys - /// In the case - ContractBased { - contract_id: Identifier, - document_type_keys: BTreeMap>, - contract_keys: Vec<(KeyID, Purpose)>, - }, - // ContractFamilyBased { - // contracts_owner_id: Identifier, - // family_keys: Vec, - // }, -} - -impl DataContractApplyInfo { - fn root_id(&self) -> [u8; 32] { - match self { - ContractBased { contract_id, .. } => contract_id.to_buffer(), - // ContractFamilyBased { - // contracts_owner_id, .. - // } => contracts_owner_id.to_buffer(), - } - } - fn keys( - self, - ) -> ( - BTreeMap>, - Vec<(KeyID, Purpose)>, - ) { - match self { - ContractBased { - document_type_keys, - contract_keys, - .. - } => (document_type_keys, contract_keys), - // ContractFamilyBased { family_keys, .. } => (BTreeMap::new(), family_keys), - } - } - fn new_from_single_key( - key_id: KeyID, - purpose: Purpose, - contract_bounds: &ContractBounds, - drive: &Drive, - epoch: &Epoch, - transaction: TransactionArg, - drive_operations: &mut Vec, - platform_version: &PlatformVersion, - ) -> Result { - let contract_id = contract_bounds.identifier().to_buffer(); - // we are getting with fetch info to add the cost to the drive operations - let maybe_contract_fetch_info = drive.get_contract_with_fetch_info_and_add_to_operations( - contract_id, - Some(epoch), - false, - transaction, - drive_operations, - platform_version, - )?; - let Some(contract_fetch_info) = maybe_contract_fetch_info else { - return Err(Error::Identity(IdentityError::IdentityKeyBoundsError( - "Contract for key bounds not found", - ))); - }; - let contract = &contract_fetch_info.contract; - match contract_bounds { - ContractBounds::SingleContract { .. } => Ok(ContractBased { - contract_id: contract.id(), - document_type_keys: Default::default(), - contract_keys: vec![(key_id, purpose)], - }), - ContractBounds::SingleContractDocumentType { document_type_name: document_type, .. } => { - let document_type = contract - .document_type_for_name(document_type) - .map_err(Error::Protocol)?; - Ok(ContractBased { - contract_id: contract.id(), - document_type_keys: BTreeMap::from([( - document_type.name().clone(), - vec![(key_id, purpose)], - )]), - contract_keys: vec![], - }) - } - // ContractBounds::MultipleContractsOfSameOwner { .. } => Ok(ContractFamilyBased { - // contracts_owner_id: contract.owner_id(), - // family_keys: vec![key_id], - // }), - } - } -} diff --git a/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/mod.rs new file mode 100644 index 00000000000..8641b8a4fb2 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/mod.rs @@ -0,0 +1,71 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::epoch::Epoch; +use dpp::identity::IdentityPublicKey; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::HashMap; + +mod v0; + +impl Drive { + /// Adds potential contract information for a contract-bounded key. + /// + /// This function considers the contract bounds associated with an identity key and forms the operations needed to process the contract information. + /// + /// # Arguments + /// + /// * `identity_id` - An array of bytes representing the identity id. + /// * `identity_key` - A reference to the `IdentityPublicKey` associated with the contract. + /// * `epoch` - The current epoch. + /// * `estimated_costs_only_with_layer_info` - A mutable reference to an optional `HashMap` that may contain estimated layer information. + /// * `transaction` - The transaction arguments. + /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` objects. + /// * `platform_version` - A reference to the platform version information. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns unit (`()`). If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function may return an `Error` if the operation creation process fails or if the platform version does not match any of the implemented method versions. + pub(crate) fn add_potential_contract_info_for_contract_bounded_key( + &self, + identity_id: [u8; 32], + identity_key: &IdentityPublicKey, + epoch: &Epoch, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .identity + .contract_info + .add_potential_contract_info_for_contract_bounded_key + { + 0 => self.add_potential_contract_info_for_contract_bounded_key_v0( + identity_id, + identity_key, + epoch, + estimated_costs_only_with_layer_info, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_potential_contract_info_for_contract_bounded_key".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs new file mode 100644 index 00000000000..745bd2daffa --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs @@ -0,0 +1,522 @@ +use crate::drive::identity::contract_info::keys::IdentityDataContractKeyApplyInfo; +use crate::drive::identity::contract_info::ContractInfoStructure::ContractInfoKeysKey; +use crate::drive::identity::IdentityRootStructure::IdentityContractInfo; +use crate::drive::identity::{ + identity_contract_info_group_keys_path_vec, identity_contract_info_group_path_key_purpose_vec, + identity_contract_info_group_path_vec, identity_contract_info_root_path_vec, + identity_key_location_within_identity_vec, identity_path_vec, +}; +use crate::drive::Drive; +use crate::error::contract::DataContractError; +use crate::error::identity::IdentityError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use crate::util::grove_operations::{BatchInsertApplyType, BatchInsertTreeApplyType}; +use crate::util::object_size_info::{PathKeyElementInfo, PathKeyInfo}; +use dpp::block::epoch::Epoch; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::config::v0::DataContractConfigGettersV0; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::{IdentityPublicKey, Purpose}; +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::reference_path::ReferencePathType::{SiblingReference, UpstreamRootHeightReference}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb_costs::OperationCost; +use integer_encoding::VarInt; +use std::collections::HashMap; + +impl Drive { + #[inline(always)] + pub(in crate::drive::identity::contract_info) fn add_potential_contract_info_for_contract_bounded_key_v0( + &self, + identity_id: [u8; 32], + identity_key: &IdentityPublicKey, + epoch: &Epoch, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + if let Some(contract_bounds) = &identity_key.contract_bounds() { + // We need to get the contract + let contract_apply_info = IdentityDataContractKeyApplyInfo::new_from_single_key( + identity_key.id(), + identity_key.purpose(), + contract_bounds, + self, + epoch, + transaction, + drive_operations, + platform_version, + )?; + self.add_contract_info_operations_v0( + identity_id, + epoch, + vec![contract_apply_info], + estimated_costs_only_with_layer_info, + transaction, + drive_operations, + platform_version, + )?; + } + Ok(()) + } + + /// Adds the contract info operations + fn add_contract_info_operations_v0( + &self, + identity_id: [u8; 32], + epoch: &Epoch, + contract_infos: Vec, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let identity_path = identity_path_vec(identity_id.as_slice()); + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_contract_info( + &identity_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: false, + flags_len: 0, + } + }; + + // we insert the contract root tree if it doesn't exist already + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathKeyInfo::<0>::PathKey((identity_path, vec![IdentityContractInfo as u8])), + false, + None, + apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + + for contract_info in contract_infos.into_iter() { + let root_id = contract_info.root_id(); + + let contract = if estimated_costs_only_with_layer_info.is_none() { + // we should start by fetching the contract + let (fee, contract) = self.get_contract_with_fetch_info_and_fee( + root_id, + Some(epoch), + true, + transaction, + platform_version, + )?; + + let fee = fee.ok_or(Error::Identity( + IdentityError::IdentityKeyDataContractNotFound, + ))?; + let contract = contract.ok_or(Error::Identity( + IdentityError::IdentityKeyDataContractNotFound, + ))?; + drive_operations.push(LowLevelDriveOperation::PreCalculatedFeeResult(fee)); + Some(contract) + } else { + drive_operations.push(LowLevelDriveOperation::CalculatedCostOperation( + OperationCost { + seek_count: 1, + storage_cost: Default::default(), + storage_loaded_bytes: 100, + hash_node_calls: 0, + }, + )); + None + }; + + let (document_keys, contract_or_family_keys) = contract_info.keys(); + + if !contract_or_family_keys.is_empty() { + // we only need to do this once + if let Some(estimated_costs_only_with_layer_info) = + estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info_group( + &identity_id, + &root_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + + Self::add_estimation_costs_for_contract_info_group_keys( + &identity_id, + &root_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathKeyInfo::<0>::PathKey(( + identity_contract_info_root_path_vec(&identity_id), + root_id.to_vec(), + )), + false, + None, + apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + + // We need to insert the keys parent tree + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathKeyInfo::<0>::PathKey(( + identity_contract_info_group_path_vec(&identity_id, &root_id), + vec![ContractInfoKeysKey as u8], + )), + false, + None, + apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + } + + for (key_id, purpose) in contract_or_family_keys { + if let Some(estimated_costs_only_with_layer_info) = + estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info_group_key_purpose( + &identity_id, + &root_id, + purpose, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + // We need to insert the key type + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathKeyInfo::<0>::PathKey(( + identity_contract_info_group_keys_path_vec(&identity_id, &root_id), + vec![purpose as u8], + )), + false, + None, + apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + + // we need to add a reference to the key + let key_id_bytes = key_id.encode_var_vec(); + let key_reference = + identity_key_location_within_identity_vec(key_id_bytes.as_slice()); + + let reference_type_path = UpstreamRootHeightReference(2, key_reference); + + let ref_apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertApplyType::StatefulBatchInsert + } else { + BatchInsertApplyType::StatelessBatchInsert { + in_tree_using_sums: false, + target: QueryTargetValue(reference_type_path.serialized_size() as u32), + } + }; + + // at this point we want to know if the contract is single key or multiple key + let storage_key_requirements = contract + .as_ref() + .map(|contract| match purpose { + Purpose::ENCRYPTION => { + let encryption_storage_key_requirements = contract + .contract + .config() + .requires_identity_encryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds for encryption", + ), + ))?; + Ok(encryption_storage_key_requirements) + } + Purpose::DECRYPTION => { + let decryption_storage_key_requirements = contract + .contract + .config() + .requires_identity_decryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds for decryption", + ), + ))?; + Ok(decryption_storage_key_requirements) + } + _ => Err(Error::Identity(IdentityError::IdentityKeyBoundsError( + "purpose not available for key bounds", + ))), + }) + .transpose()? + .unwrap_or(StorageKeyRequirements::MultipleReferenceToLatest); + + // if we are multiple we insert the key under the key bytes, otherwise it is under 0 + + if storage_key_requirements == StorageKeyRequirements::Unique { + self.batch_insert_if_not_exists( + PathKeyElementInfo::<0>::PathKeyElement(( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &root_id, + purpose, + ), + vec![], + Element::Reference(reference_type_path, Some(1), None), + )), + ref_apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + } else { + self.batch_insert_if_not_exists( + PathKeyElementInfo::<0>::PathKeyRefElement(( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &root_id, + purpose, + ), + key_id_bytes.as_slice(), + Element::Reference(reference_type_path, Some(1), None), + )), + ref_apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + }; + + if storage_key_requirements == StorageKeyRequirements::MultipleReferenceToLatest { + // we also insert a sibling reference so we can query the current key + + let sibling_ref_type_path = SiblingReference(key_id_bytes); + + self.batch_insert( + PathKeyElementInfo::<0>::PathKeyElement(( + identity_contract_info_group_keys_path_vec(&identity_id, &root_id), + vec![], + Element::Reference(sibling_ref_type_path, Some(2), None), + )), + drive_operations, + &platform_version.drive, + )?; + } + } + + for (document_type_name, document_key_ids) in document_keys { + // The path is the concatenation of the contract_id and the document type name + let mut contract_id_bytes_with_document_type_name = root_id.to_vec(); + contract_id_bytes_with_document_type_name.extend(document_type_name.as_bytes()); + + if let Some(estimated_costs_only_with_layer_info) = + estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info_group( + &identity_id, + &contract_id_bytes_with_document_type_name, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + + Self::add_estimation_costs_for_contract_info_group_keys( + &identity_id, + &contract_id_bytes_with_document_type_name, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathKeyInfo::<0>::PathKey(( + identity_contract_info_root_path_vec(&identity_id), + contract_id_bytes_with_document_type_name.to_vec(), + )), + false, + None, + apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathKeyInfo::<0>::PathKey(( + identity_contract_info_group_path_vec( + &identity_id, + &contract_id_bytes_with_document_type_name, + ), + vec![ContractInfoKeysKey as u8], + )), + false, + None, + apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + + for (key_id, purpose) in document_key_ids { + if let Some(estimated_costs_only_with_layer_info) = + estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info_group_key_purpose( + &identity_id, + &contract_id_bytes_with_document_type_name, + purpose, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + // We need to insert the key type + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathKeyInfo::<0>::PathKey(( + identity_contract_info_group_keys_path_vec( + &identity_id, + &contract_id_bytes_with_document_type_name, + ), + vec![purpose as u8], + )), + false, + None, + apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + + // we need to add a reference to the key + let key_id_bytes = key_id.encode_var_vec(); + let key_reference = + identity_key_location_within_identity_vec(key_id_bytes.as_slice()); + + let reference = UpstreamRootHeightReference(2, key_reference); + + let ref_apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertApplyType::StatefulBatchInsert + } else { + BatchInsertApplyType::StatelessBatchInsert { + in_tree_using_sums: false, + target: QueryTargetValue(reference.serialized_size() as u32), + } + }; + + // at this point we want to know if the contract is single key or multiple key + let storage_key_requirements = contract + .as_ref() + .map(|contract| match purpose { + Purpose::ENCRYPTION => { + let document_type = contract + .contract + .document_type_for_name(document_type_name.as_str())?; + let encryption_storage_key_requirements = document_type + .requires_identity_encryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds in document type", + ), + ))?; + Ok(encryption_storage_key_requirements) + } + Purpose::DECRYPTION => { + let document_type = contract + .contract + .document_type_for_name(document_type_name.as_str())?; + let decryption_storage_key_requirements = document_type + .requires_identity_decryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds in document type", + ), + ))?; + Ok(decryption_storage_key_requirements) + } + _ => Err(Error::Identity(IdentityError::IdentityKeyBoundsError( + "purpose not available for key bounds", + ))), + }) + .transpose()? + .unwrap_or(StorageKeyRequirements::MultipleReferenceToLatest); + + if storage_key_requirements == StorageKeyRequirements::Unique { + self.batch_insert( + PathKeyElementInfo::<0>::PathKeyElement(( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &contract_id_bytes_with_document_type_name, + purpose, + ), + vec![], + Element::Reference(reference, Some(1), None), + )), + drive_operations, + &platform_version.drive, + )?; + } else { + self.batch_insert_if_not_exists( + PathKeyElementInfo::<0>::PathKeyElement(( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &contract_id_bytes_with_document_type_name, + purpose, + ), + key_id_bytes.clone(), + Element::Reference(reference, Some(1), None), + )), + ref_apply_type, + transaction, + drive_operations, + &platform_version.drive, + )?; + }; + + if storage_key_requirements == StorageKeyRequirements::MultipleReferenceToLatest + { + // we also insert a sibling reference so we can query the current key + + let sibling_ref_type_path = SiblingReference(key_id_bytes); + + self.batch_insert( + PathKeyElementInfo::<0>::PathKeyElement(( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &contract_id_bytes_with_document_type_name, + purpose, + ), + vec![], + Element::Reference(sibling_ref_type_path, Some(2), None), + )), + drive_operations, + &platform_version.drive, + )?; + } + } + } + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/keys/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/keys/mod.rs new file mode 100644 index 00000000000..f005f110f6d --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/keys/mod.rs @@ -0,0 +1,109 @@ +use crate::drive::identity::contract_info::keys::IdentityDataContractKeyApplyInfo::ContractBased; +use crate::drive::Drive; +use crate::error::identity::IdentityError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::epoch::Epoch; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::identity::contract_bounds::ContractBounds; +use dpp::identity::{KeyID, Purpose}; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +mod add_potential_contract_info_for_contract_bounded_key; +mod refresh_potential_contract_info_key_references; + +pub enum IdentityDataContractKeyApplyInfo { + /// The root_id is either a contract id or an owner id + /// It is a contract id for in the case of contract bound keys or contract + /// document bound keys + ContractBased { + contract_id: Identifier, + document_type_keys: BTreeMap>, + contract_keys: Vec<(KeyID, Purpose)>, + }, + // ContractFamilyBased { + // contracts_owner_id: Identifier, + // family_keys: Vec, + // }, +} + +impl IdentityDataContractKeyApplyInfo { + fn root_id(&self) -> [u8; 32] { + match self { + ContractBased { contract_id, .. } => contract_id.to_buffer(), + // ContractFamilyBased { + // contracts_owner_id, .. + // } => contracts_owner_id.to_buffer(), + } + } + fn keys( + self, + ) -> ( + BTreeMap>, + Vec<(KeyID, Purpose)>, + ) { + match self { + ContractBased { + document_type_keys, + contract_keys, + .. + } => (document_type_keys, contract_keys), + // ContractFamilyBased { family_keys, .. } => (BTreeMap::new(), family_keys), + } + } + fn new_from_single_key( + key_id: KeyID, + purpose: Purpose, + contract_bounds: &ContractBounds, + drive: &Drive, + epoch: &Epoch, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + let contract_id = contract_bounds.identifier().to_buffer(); + // we are getting with fetch info to add the cost to the drive operations + let maybe_contract_fetch_info = drive.get_contract_with_fetch_info_and_add_to_operations( + contract_id, + Some(epoch), + false, + transaction, + drive_operations, + platform_version, + )?; + let Some(contract_fetch_info) = maybe_contract_fetch_info else { + return Err(Error::Identity(IdentityError::IdentityKeyBoundsError( + "Contract for key bounds not found", + ))); + }; + let contract = &contract_fetch_info.contract; + match contract_bounds { + ContractBounds::SingleContract { .. } => Ok(ContractBased { + contract_id: contract.id(), + document_type_keys: Default::default(), + contract_keys: vec![(key_id, purpose)], + }), + ContractBounds::SingleContractDocumentType { + document_type_name: document_type, + .. + } => { + let document_type = contract.document_type_for_name(document_type)?; + Ok(ContractBased { + contract_id: contract.id(), + document_type_keys: BTreeMap::from([( + document_type.name().clone(), + vec![(key_id, purpose)], + )]), + contract_keys: vec![], + }) + } // ContractBounds::MultipleContractsOfSameOwner { .. } => Ok(ContractFamilyBased { + // contracts_owner_id: contract.owner_id(), + // family_keys: vec![key_id], + // }), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/keys/refresh_potential_contract_info_key_references/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/keys/refresh_potential_contract_info_key_references/mod.rs new file mode 100644 index 00000000000..1ca7c91d3bf --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/keys/refresh_potential_contract_info_key_references/mod.rs @@ -0,0 +1,71 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::epoch::Epoch; +use dpp::identity::IdentityPublicKey; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::HashMap; + +mod v0; + +impl Drive { + /// Adds potential contract information for a contract-bounded key. + /// + /// This function considers the contract bounds associated with an identity key and forms the operations needed to process the contract information. + /// + /// # Arguments + /// + /// * `identity_id` - An array of bytes representing the identity id. + /// * `identity_key` - A reference to the `IdentityPublicKey` associated with the contract. + /// * `epoch` - The current epoch. + /// * `estimated_costs_only_with_layer_info` - A mutable reference to an optional `HashMap` that may contain estimated layer information. + /// * `transaction` - The transaction arguments. + /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` objects. + /// * `platform_version` - A reference to the platform version information. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns unit (`()`). If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function may return an `Error` if the operation creation process fails or if the platform version does not match any of the implemented method versions. + pub(crate) fn refresh_potential_contract_info_key_references( + &self, + identity_id: [u8; 32], + identity_key: &IdentityPublicKey, + epoch: &Epoch, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .identity + .contract_info + .refresh_potential_contract_info_key_references + { + 0 => self.refresh_potential_contract_info_key_references_v0( + identity_id, + identity_key, + epoch, + estimated_costs_only_with_layer_info, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "refresh_potential_contract_info_key_references".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/keys/refresh_potential_contract_info_key_references/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/keys/refresh_potential_contract_info_key_references/v0/mod.rs new file mode 100644 index 00000000000..8183b3ae9ec --- /dev/null +++ b/packages/rs-drive/src/drive/identity/contract_info/keys/refresh_potential_contract_info_key_references/v0/mod.rs @@ -0,0 +1,337 @@ +use crate::drive::identity::contract_info::keys::IdentityDataContractKeyApplyInfo; +use crate::drive::identity::{ + identity_contract_info_group_keys_path_vec, identity_contract_info_group_path_key_purpose_vec, + identity_key_location_within_identity_vec, +}; +use crate::drive::Drive; +use crate::error::contract::DataContractError; +use crate::error::identity::IdentityError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::epoch::Epoch; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::config::v0::DataContractConfigGettersV0; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::{IdentityPublicKey, Purpose}; +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::reference_path::ReferencePathType::{SiblingReference, UpstreamRootHeightReference}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb_costs::OperationCost; +use integer_encoding::VarInt; +use std::collections::HashMap; + +impl Drive { + #[inline(always)] + pub(in crate::drive::identity::contract_info) fn refresh_potential_contract_info_key_references_v0( + &self, + identity_id: [u8; 32], + identity_key: &IdentityPublicKey, + epoch: &Epoch, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + if let Some(contract_bounds) = &identity_key.contract_bounds() { + // We need to get the contract + let contract_apply_info = IdentityDataContractKeyApplyInfo::new_from_single_key( + identity_key.id(), + identity_key.purpose(), + contract_bounds, + self, + epoch, + transaction, + drive_operations, + platform_version, + )?; + self.refresh_contract_info_operations_v0( + identity_id, + epoch, + vec![contract_apply_info], + estimated_costs_only_with_layer_info, + transaction, + drive_operations, + platform_version, + )?; + } + Ok(()) + } + + /// Refreshes keys for the contract info + fn refresh_contract_info_operations_v0( + &self, + identity_id: [u8; 32], + epoch: &Epoch, + contract_infos: Vec, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_contract_info( + &identity_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + for contract_info in contract_infos.into_iter() { + let root_id = contract_info.root_id(); + + let contract = if estimated_costs_only_with_layer_info.is_none() { + // we should start by fetching the contract + let (fee, contract) = self.get_contract_with_fetch_info_and_fee( + root_id, + Some(epoch), + true, + transaction, + platform_version, + )?; + + let fee = fee.ok_or(Error::Identity( + IdentityError::IdentityKeyDataContractNotFound, + ))?; + let contract = contract.ok_or(Error::Identity( + IdentityError::IdentityKeyDataContractNotFound, + ))?; + drive_operations.push(LowLevelDriveOperation::PreCalculatedFeeResult(fee)); + Some(contract) + } else { + drive_operations.push(LowLevelDriveOperation::CalculatedCostOperation( + OperationCost { + seek_count: 1, + storage_cost: Default::default(), + storage_loaded_bytes: 100, + hash_node_calls: 0, + }, + )); + None + }; + + let (document_keys, contract_or_family_keys) = contract_info.keys(); + + for (key_id, purpose) in contract_or_family_keys { + if let Some(estimated_costs_only_with_layer_info) = + estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info_group_key_purpose( + &identity_id, + &root_id, + purpose, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + // we need to add a reference to the key + let key_id_bytes = key_id.encode_var_vec(); + let key_reference = + identity_key_location_within_identity_vec(key_id_bytes.as_slice()); + + let reference_type_path = UpstreamRootHeightReference(2, key_reference); + + // at this point we want to know if the contract is single key or multiple key + let storage_key_requirements = contract + .as_ref() + .map(|contract| match purpose { + Purpose::ENCRYPTION => { + let encryption_storage_key_requirements = contract + .contract + .config() + .requires_identity_encryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds for encryption", + ), + ))?; + Ok(encryption_storage_key_requirements) + } + Purpose::DECRYPTION => { + let decryption_storage_key_requirements = contract + .contract + .config() + .requires_identity_decryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds for decryption", + ), + ))?; + Ok(decryption_storage_key_requirements) + } + _ => Err(Error::Identity(IdentityError::IdentityKeyBoundsError( + "purpose not available for key bounds", + ))), + }) + .transpose()? + .unwrap_or(StorageKeyRequirements::MultipleReferenceToLatest); + + // if we are multiple we refresh the key under the key bytes, otherwise it is under 0 + + let key = if storage_key_requirements == StorageKeyRequirements::Unique { + vec![] + } else { + key_id_bytes.clone() + }; + + self.batch_refresh_reference( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &root_id, + purpose, + ), + key, + Element::Reference(reference_type_path, Some(1), None), + true, + drive_operations, + &platform_version.drive, + )?; + + if storage_key_requirements == StorageKeyRequirements::MultipleReferenceToLatest { + // we also refresh the sibling reference, so we can query the current key + + let sibling_ref_type_path = SiblingReference(key_id_bytes); + + self.batch_refresh_reference( + identity_contract_info_group_keys_path_vec(&identity_id, &root_id), + vec![], + Element::Reference(sibling_ref_type_path, Some(2), None), + true, + drive_operations, + &platform_version.drive, + )?; + } + } + + for (document_type_name, document_key_ids) in document_keys { + // The path is the concatenation of the contract_id and the document type name + let mut contract_id_bytes_with_document_type_name = root_id.to_vec(); + contract_id_bytes_with_document_type_name.extend(document_type_name.as_bytes()); + + if let Some(estimated_costs_only_with_layer_info) = + estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info_group( + &identity_id, + &contract_id_bytes_with_document_type_name, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + + Self::add_estimation_costs_for_contract_info_group_keys( + &identity_id, + &contract_id_bytes_with_document_type_name, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + for (key_id, purpose) in document_key_ids { + if let Some(estimated_costs_only_with_layer_info) = + estimated_costs_only_with_layer_info + { + Self::add_estimation_costs_for_contract_info_group_key_purpose( + &identity_id, + &contract_id_bytes_with_document_type_name, + purpose, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + // we need to add a reference to the key + let key_id_bytes = key_id.encode_var_vec(); + let key_reference = + identity_key_location_within_identity_vec(key_id_bytes.as_slice()); + + let reference = UpstreamRootHeightReference(2, key_reference); + + // at this point we want to know if the contract is single key or multiple key + let storage_key_requirements = contract + .as_ref() + .map(|contract| match purpose { + Purpose::ENCRYPTION => { + let document_type = contract + .contract + .document_type_for_name(document_type_name.as_str())?; + let encryption_storage_key_requirements = document_type + .requires_identity_encryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds in document type", + ), + ))?; + Ok(encryption_storage_key_requirements) + } + Purpose::DECRYPTION => { + let document_type = contract + .contract + .document_type_for_name(document_type_name.as_str())?; + let decryption_storage_key_requirements = document_type + .requires_identity_decryption_bounded_key() + .ok_or(Error::DataContract( + DataContractError::KeyBoundsExpectedButNotPresent( + "expected encryption key bounds in document type", + ), + ))?; + Ok(decryption_storage_key_requirements) + } + _ => Err(Error::Identity(IdentityError::IdentityKeyBoundsError( + "purpose not available for key bounds", + ))), + }) + .transpose()? + .unwrap_or(StorageKeyRequirements::MultipleReferenceToLatest); + + let key = if storage_key_requirements == StorageKeyRequirements::Unique { + vec![] + } else { + key_id_bytes.clone() + }; + + self.batch_refresh_reference( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &contract_id_bytes_with_document_type_name, + purpose, + ), + key, + Element::Reference(reference, Some(1), None), + true, + drive_operations, + &platform_version.drive, + )?; + + if storage_key_requirements == StorageKeyRequirements::MultipleReferenceToLatest + { + // we also need to refresh the sibling reference, so we can query the current key + + let sibling_ref_type_path = SiblingReference(key_id_bytes); + + self.batch_refresh_reference( + identity_contract_info_group_path_key_purpose_vec( + &identity_id, + &contract_id_bytes_with_document_type_name, + purpose, + ), + vec![], + Element::Reference(sibling_ref_type_path, Some(2), None), + true, + drive_operations, + &platform_version.drive, + )?; + } + } + } + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/identity/contract_info/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/mod.rs index b8e5d32bb82..1f0e79b8bb9 100644 --- a/packages/rs-drive/src/drive/identity/contract_info/mod.rs +++ b/packages/rs-drive/src/drive/identity/contract_info/mod.rs @@ -1 +1,14 @@ -mod insert; +#[cfg(feature = "server")] +pub(crate) mod identity_contract_nonce; +#[cfg(feature = "server")] +pub mod keys; + +/// The sub elements in the contract space for each identity. +#[repr(u8)] +#[derive(Copy, Clone)] +pub enum ContractInfoStructure { + /// The identity contract nonce to stop replay attacks + IdentityContractNonceKey = 0, + /// The contract bound keys + ContractInfoKeysKey = 1, +} diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs index 0ae2870ad83..fd7be5dcdb2 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs @@ -1,4 +1,4 @@ -use crate::drive::defaults::{AVERAGE_BALANCE_SIZE, DEFAULT_HASH_SIZE_U8}; +use crate::drive::constants::AVERAGE_BALANCE_SIZE; use crate::drive::Drive; @@ -9,9 +9,9 @@ use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; use crate::drive::balances::balance_path_vec; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use grovedb::EstimatedSumTrees::SomeSumTrees; use std::collections::HashMap; - // we need to construct the reference from the split height of the key // type which is at 4 // 0 represents document storage diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs index d55a9f82a89..79a3a2c57b6 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs @@ -1,18 +1,11 @@ -use crate::drive::defaults::{AVERAGE_BALANCE_SIZE, DEFAULT_HASH_SIZE_U8}; - +use crate::drive::identity::{identity_contract_info_root_path_vec, identity_path_vec}; use crate::drive::{identity_tree_path, Drive}; - +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use grovedb::batch::KeyInfoPath; -use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerInformation; -use grovedb::EstimatedLayerSizes::{AllItems, AllReference, AllSubtrees}; - -use crate::drive::identity::estimation_costs::KEY_REFERENCE_SIZE; -use crate::drive::identity::{ - identity_contract_info_group_path_vec, identity_contract_info_root_path, - identity_contract_info_root_path_vec, -}; -use grovedb::EstimatedSumTrees::{NoSumTrees, SomeSumTrees}; +use grovedb::EstimatedLayerSizes::{AllSubtrees, Mix}; +use grovedb::EstimatedSumTrees::NoSumTrees; use std::collections::HashMap; impl Drive { @@ -20,6 +13,48 @@ impl Drive { identity_id: &[u8; 32], estimated_costs_only_with_layer_info: &mut HashMap, ) { + // we have constructed the top layer so contract/documents tree are at the top + // since balance will be on layer 2, updating will mean we will update 1 sum tree + // and 1 normal tree, hence we should give an equal weight to both + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path([]), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + + // we then need to insert the root identity layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(identity_tree_path()), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), + }, + ); + + // In this layer we have + // Keys + // / \ + // Nonce Revision + // / \ / + // DataContract Info Negative Credit Query Keys + + // we then need to insert the identity layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(2, false), + estimated_layer_sizes: Mix { + subtrees_size: Some((1, NoSumTrees, None, 2)), // weight of 2 because 1 for keys and 1 for data contract info + items_size: Some((1, 8, None, 1)), + references_size: None, + }, + }, + ); // we then need to insert for the identity contract info estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_contract_info_root_path_vec(identity_id)), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs index 030ef0e3f65..9fc0347ab8a 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs @@ -1,16 +1,10 @@ -use crate::drive::{identity_tree_path, Drive}; - +use crate::drive::identity::identity_contract_info_group_path_vec; +use crate::drive::Drive; use grovedb::batch::KeyInfoPath; -use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerCount::ApproximateElements; use grovedb::EstimatedLayerInformation; -use grovedb::EstimatedLayerSizes::{AllItems, AllReference, AllSubtrees}; - -use crate::drive::identity::estimation_costs::KEY_REFERENCE_SIZE; -use crate::drive::identity::{ - identity_contract_info_group_path_vec, identity_contract_info_root_path, - identity_contract_info_root_path_vec, -}; -use grovedb::EstimatedSumTrees::{NoSumTrees, SomeSumTrees}; +use grovedb::EstimatedLayerSizes::Mix; +use grovedb::EstimatedSumTrees::NoSumTrees; use std::collections::HashMap; impl Drive { @@ -28,7 +22,11 @@ impl Drive { EstimatedLayerInformation { is_sum_tree: false, estimated_layer_count: ApproximateElements(2), - estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + estimated_layer_sizes: Mix { + subtrees_size: Some((1, NoSumTrees, None, 1)), + items_size: Some((1, 1, None, 1)), + references_size: None, + }, }, ); } diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/mod.rs new file mode 100644 index 00000000000..5a097e92d48 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/mod.rs @@ -0,0 +1,54 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerInformation; +use std::collections::HashMap; + +impl Drive { + /// Adds estimation costs for balances. + /// + /// It operates on the provided HashMap, `estimated_costs_only_with_layer_info`, and adds + /// new entries to it, representing the estimated costs for different layers of the balance tree. + /// + /// # Parameters + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a HashMap storing + /// the `KeyInfoPath` and `EstimatedLayerInformation`. + /// + /// # Returns + /// - `Ok(())` if successful. + /// - `Err(DriveError::UnknownVersionMismatch)` if the method version doesn't match any known versions. + /// + /// # Errors + /// This function will return an error if the method version doesn't match any known versions. + pub(crate) fn add_estimation_costs_for_contract_info_group_keys( + identity_id: &[u8; 32], + group_id: &[u8], + estimated_costs_only_with_layer_info: &mut HashMap, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .identity + .cost_estimation + .for_contract_info_group_keys + { + 0 => { + Self::add_estimation_costs_for_contract_info_group_keys_v0( + identity_id, + group_id, + estimated_costs_only_with_layer_info, + ); + Ok(()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_estimation_costs_for_contract_info_group_keys".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs new file mode 100644 index 00000000000..efa3892a36c --- /dev/null +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs @@ -0,0 +1,29 @@ +use crate::drive::identity::identity_contract_info_group_keys_path_vec; +use crate::drive::Drive; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::ApproximateElements; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::EstimatedSumTrees::NoSumTrees; +use std::collections::HashMap; + +impl Drive { + pub(super) fn add_estimation_costs_for_contract_info_group_keys_v0( + identity_id: &[u8; 32], + group_id: &[u8], + estimated_costs_only_with_layer_info: &mut HashMap, + ) { + // we then need to insert for the identity contract info for the contract in question + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_owned_path(identity_contract_info_group_keys_path_vec( + identity_id, + group_id, + )), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(2), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + } +} diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs index 5fa539573bc..3721c5cad3b 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs @@ -1,4 +1,4 @@ -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use crate::drive::{identity_tree_path, Drive}; diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs index 462e79c4f8c..34a7a6d214a 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs @@ -1,4 +1,4 @@ -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use crate::drive::{identity_tree_path, Drive}; diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs index 149c4da3c2d..f7a49a2bd7c 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs @@ -37,12 +37,12 @@ impl Drive { let estimated_layer_count = match purpose { Purpose::AUTHENTICATION => ApproximateElements(4), Purpose::ENCRYPTION => { - unreachable!() + return; } Purpose::DECRYPTION => { - unreachable!() + return; } - Purpose::WITHDRAW => ApproximateElements(1), + Purpose::TRANSFER => ApproximateElements(1), Purpose::SYSTEM => ApproximateElements(1), Purpose::VOTING => ApproximateElements(1), }; @@ -50,12 +50,12 @@ impl Drive { let estimated_layer_sizes = match purpose { Purpose::AUTHENTICATION => AllSubtrees(1, NoSumTrees, None), Purpose::ENCRYPTION => { - unreachable!() + return; } Purpose::DECRYPTION => { - unreachable!() + return; } - Purpose::WITHDRAW => AllReference(1, KEY_REFERENCE_SIZE, None), + Purpose::TRANSFER => AllReference(1, KEY_REFERENCE_SIZE, None), Purpose::SYSTEM => AllReference(1, KEY_REFERENCE_SIZE, None), Purpose::VOTING => AllReference(1, KEY_REFERENCE_SIZE, None), }; diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/mod.rs new file mode 100644 index 00000000000..91df3ac0f69 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/mod.rs @@ -0,0 +1,56 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerInformation; +use std::collections::HashMap; + +mod v0; + +impl Drive { + /// This function adds estimation costs for an updated revision. + /// + /// It expects an identity in the form of an array of bytes, and a mutable reference to a HashMap containing + /// the estimated costs with layer info. Additionally, it takes a reference to the drive version. + /// + /// Based on the version of the drive, it calls the appropriate function to handle cost estimation. + /// + /// # Parameters + /// - `identity_id`: A 32-byte array representing the identity id. + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a HashMap storing + /// the `KeyInfoPath` and `EstimatedLayerInformation`. + /// - `drive_version`: A reference to the `DriveVersion`. + /// + /// # Returns + /// - `Ok(())` if successful. + /// - `Err(DriveError::UnknownVersionMismatch)` if the method version doesn't match any known versions. + /// + /// # Errors + /// This function will return an error if the method version doesn't match any known versions. + pub(crate) fn add_estimation_costs_for_update_nonce( + identity_id: [u8; 32], + estimated_costs_only_with_layer_info: &mut HashMap, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .identity + .cost_estimation + .for_update_revision + { + 0 => { + Self::add_estimation_costs_for_update_nonce_v0( + identity_id, + estimated_costs_only_with_layer_info, + ); + Ok(()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_estimation_costs_for_update_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs new file mode 100644 index 00000000000..bbd73f99edf --- /dev/null +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs @@ -0,0 +1,81 @@ +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; + +use crate::drive::{identity_tree_path, Drive}; + +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::{AllSubtrees, Mix}; + +use crate::drive::identity::identity_path_vec; + +use grovedb::EstimatedSumTrees::NoSumTrees; +use std::collections::HashMap; + +impl Drive { + /// This function adds estimation costs for an updated revision. + /// + /// It expects an identity in the form of an array of bytes, and a mutable reference to a HashMap containing + /// the estimated costs with layer info. Additionally, it takes a reference to the drive version. + /// + /// Based on the version of the drive, it calls the appropriate function to handle cost estimation. + /// + /// # Parameters + /// - `identity_id`: A 32-byte array representing the identity id. + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a HashMap storing + /// the `KeyInfoPath` and `EstimatedLayerInformation`. + /// - `drive_version`: A reference to the `DriveVersion`. + /// + /// # Returns + /// - `Ok(())` if successful. + /// - `Err(DriveError::UnknownVersionMismatch)` if the method version doesn't match any known versions. + /// + /// # Errors + /// This function will return an error if the method version doesn't match any known versions. + pub(super) fn add_estimation_costs_for_update_nonce_v0( + identity_id: [u8; 32], + estimated_costs_only_with_layer_info: &mut HashMap, + ) { + // we need to add the root + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path([]), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(0, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + + // we then need to insert the root identity layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(identity_tree_path()), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), + }, + ); + + // In this layer we have + // Keys + // / \ + // Nonce Revision + // / \ / + // DataContract Info Negative Credit Query Keys + + // we then need to insert the identity layer for fee refunds + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(1, false), + //We can mark these as all subtrees, because the revision will be under + estimated_layer_sizes: Mix { + subtrees_size: Some((1, NoSumTrees, None, 1)), + items_size: Some((1, 8, None, 1)), + references_size: None, + }, + }, + ); + } +} diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/mod.rs index 2495574fd2a..718583e8d5a 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/mod.rs @@ -47,7 +47,7 @@ impl Drive { Ok(()) } version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "get_cached_contract_with_fetch_info".to_string(), + method: "add_estimation_costs_for_update_revision".to_string(), known_versions: vec![0], received: version, })), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs index fbd0bea2f26..f5fe620cc68 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs @@ -1,4 +1,4 @@ -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use crate::drive::{identity_tree_path, Drive}; @@ -57,11 +57,11 @@ impl Drive { ); // In this layer we have - // Keys - // / \ - //DataContract Info Revision - // / / - // Negative Credit Query Keys + // Keys + // / \ + // Nonce Revision + // / \ / + // DataContract Info Negative Credit Query Keys // we then need to insert the identity layer for fee refunds estimated_costs_only_with_layer_info.insert( diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/mod.rs index db3ead6f991..bb20c35363b 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/mod.rs @@ -3,10 +3,12 @@ mod for_balances; mod for_identity_contract_info; mod for_identity_contract_info_group; mod for_identity_contract_info_group_key_purpose; +mod for_identity_contract_info_group_keys; mod for_keys_for_identity_id; mod for_negative_credit; mod for_purpose_in_key_reference_tree; mod for_root_key_reference_tree; +mod for_update_nonce; mod for_update_revision; /// size of a key reference. diff --git a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/mod.rs b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/mod.rs index 17033ecbc7c..1c55b9bcad5 100644 --- a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/mod.rs @@ -2,7 +2,7 @@ mod v0; use crate::drive::Drive; use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; diff --git a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs index 0ce12abf78a..2c5c98f7dbe 100644 --- a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs @@ -1,11 +1,11 @@ use crate::drive::balances::balance_path; -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; @@ -57,6 +57,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok((value, fees)) } diff --git a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance_include_debt/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance_include_debt/v0/mod.rs index 34bb3a9ae4b..b3f47ce16cd 100644 --- a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance_include_debt/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance_include_debt/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::balances::credits::Creditable; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; @@ -54,6 +54,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok((value, fees)) } diff --git a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/mod.rs b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/mod.rs index 4226599c5fb..5af91efe4c7 100644 --- a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::fee::Credits; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs index 718b2759cbf..ba32dca8740 100644 --- a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs @@ -1,10 +1,10 @@ -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; use crate::drive::identity::{identity_path, IdentityRootStructure}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; use dpp::fee::Credits; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/fetch/contract_keys/mod.rs b/packages/rs-drive/src/drive/identity/fetch/contract_keys/mod.rs new file mode 100644 index 00000000000..20f41d6507b --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/contract_keys/mod.rs @@ -0,0 +1,62 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use std::collections::BTreeMap; + +use dpp::identifier::Identifier; +use dpp::identity::Purpose; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Fetches identities contract keys given identity ids, contract id, optional document type name and purposes + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_ids` - The slice of identity ids to prove + /// * `contract_id` - The contract id + /// * `document_type_name` - The optional document type name + /// * `purposes` - Key purposes + /// * `transaction` - Transaction arguments. + /// * `drive_version` - A reference to the drive version. + /// + /// # Returns + /// + /// Returns a `Result` containing a map with keys per purpose per identity id, otherwise an `Error` if the operation fails or the version is not supported. + pub fn fetch_identities_contract_keys( + &self, + identity_ids: &[[u8; 32]], + contract_id: &[u8; 32], + document_type_name: Option, + purposes: Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result>>, Error> { + match platform_version + .drive + .methods + .identity + .keys + .fetch + .fetch_identities_contract_keys + { + 0 => self.fetch_identities_contract_keys_v0( + identity_ids, + contract_id, + document_type_name, + purposes, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identities_contract_keys".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/contract_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/contract_keys/v0/mod.rs new file mode 100644 index 00000000000..edab5df7ccf --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/contract_keys/v0/mod.rs @@ -0,0 +1,130 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::identity::Purpose; +use dpp::prelude::Identifier; +use grovedb::query_result_type::QueryResultType; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// Fetches identities keys bound to specified contract + pub(super) fn fetch_identities_contract_keys_v0( + &self, + identity_ids: &[[u8; 32]], + contract_id: &[u8; 32], + document_type_name: Option, + purposes: Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result>>, Error> { + // let contract = &self.get_contract_with_fetch_info( + // *contract_id, + // false, + // transaction, + // platform_version, + // )?.ok_or(Error::Query(QuerySyntaxError::DataContractNotFound("Contract not found for get_identities_contract_keys")))?.contract; + + // let (requires_encryption, requires_decryption) = + // if let Some(document_type_name) = document_type_name { + // let document_type = contract.document_type_for_name(&document_type_name)?; + // ( + // document_type.requires_identity_encryption_bounded_key(), + // document_type.requires_identity_decryption_bounded_key() + // ) + // } else { + // ( + // contract.config().requires_identity_encryption_bounded_key(), + // contract.config().requires_identity_decryption_bounded_key(), + // ) + // }; + + // let purpose_to_storage_requirements = purposes + // .into_iter() + // .map(|purpose| { + // let requirements = if purpose == Purpose::ENCRYPTION { + // requires_encryption.ok_or(Error::DataContract(DataContractError::KeyBoundsExpectedButNotPresent( + // "expected an encryption key" + // ))) + // } else if purpose == Purpose::DECRYPTION { + // requires_decryption.ok_or(Error::DataContract(DataContractError::KeyBoundsExpectedButNotPresent( + // "expected a decryption key" + // ))) + // } else { + // Err( + // Error::Query( + // QuerySyntaxError::InvalidKeyParameter( + // "expected an encryption or decryption key".to_string() + // ) + // ) + // ) + // }?; + // + // Ok((purpose, requirements)) + // }) + // .collect::, Error>>()?; + + let mut drive_operations: Vec = vec![]; + + let query = Self::identities_contract_keys_query( + identity_ids, + contract_id, + &document_type_name, + &purposes, + Some((identity_ids.len() * purposes.len()) as u16), + ); + + let result = self + .grove_get_path_query( + &query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + &mut drive_operations, + &platform_version.drive, + )? + .0 + .to_path_key_elements(); + + let mut partial_identities = BTreeMap::new(); + + for (path, _, element) in result { + if let Some(identity_id_bytes) = path.get(1) { + let identity_id = Identifier::from_vec(identity_id_bytes.to_owned())?; + // We can use expect here because we have already shown that the path must have + // at least 2 sub parts as we get index 1 + let purpose_bytes = path.last().expect("last path element is the purpose"); + if purpose_bytes.len() != 1 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "purpose for identifier {} at path {} is {}, should be 1 byte", + identity_id, + path.iter().map(hex::encode).collect::>().join("/"), + hex::encode(purpose_bytes) + )))); + } + + let purpose_first_byte = purpose_bytes + .first() + .expect("we have already shown there is 1 byte"); + + let purpose = Purpose::try_from(*purpose_first_byte).map_err(|e| { + Error::Drive(DriveError::CorruptedDriveState(format!( + "purpose for identifier {} at path {} has error : {}", + identity_id, + path.iter().map(hex::encode).collect::>().join("/"), + e + ))) + })?; + + let entry = partial_identities + .entry(identity_id) + .or_insert(BTreeMap::new()); + + entry.insert(purpose, element.into_item_bytes()?); + } + } + + Ok(partial_identities) + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identities_by_unique_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identities_by_unique_public_key_hashes/v0/mod.rs index 146548b195d..830860005cd 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identities_by_unique_public_key_hashes/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identities_by_unique_public_key_hashes/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::Identity; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identity_by_unique_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identity_by_unique_public_key_hash/v0/mod.rs index 28cb920ea69..cc9c62beb73 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identity_by_unique_public_key_hash/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_full_identity_by_unique_public_key_hash/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::Identity; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/mod.rs index ed9cb148d81..645642e9e30 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/mod.rs @@ -2,7 +2,7 @@ mod v0; use crate::drive::Drive; use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/v0/mod.rs index 31e745dfdd1..7e0ea455f30 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_id_by_unique_public_key_hash/v0/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::grove_operations::DirectQueryType::StatefulDirectQuery; use crate::drive::{unique_key_hashes_tree_path, Drive}; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType::StatefulDirectQuery; use dpp::version::PlatformVersion; use grovedb::Element::Item; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_non_unique_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_non_unique_public_key_hash/v0/mod.rs index ec43e893a85..ee462d63281 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_non_unique_public_key_hash/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_non_unique_public_key_hash/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::{non_unique_key_hashes_sub_tree_path_vec, Drive}; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use crate::query::QueryItem; use grovedb::query_result_type::QueryResultType; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/mod.rs index 1b8ce87b5f5..b4bfd2eb59c 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/mod.rs @@ -2,7 +2,7 @@ mod v0; use crate::drive::Drive; use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/v0/mod.rs index f68ac5b6aa0..02c048b1306 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/fetch_identity_ids_by_unique_public_key_hashes/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::{unique_key_hashes_tree_path_vec, Drive}; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::Element::Item; @@ -49,6 +49,7 @@ impl Drive { let path_query = PathQuery::new(unique_key_hashes, sized_query); self.grove_get_raw_path_query_with_optional( &path_query, + true, transaction, drive_operations, &platform_version.drive, diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_any_of_unique_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_any_of_unique_public_key_hashes/v0/mod.rs index e8cc172aa7b..787abf9dbb8 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_any_of_unique_public_key_hashes/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_any_of_unique_public_key_hashes/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::{unique_key_hashes_tree_path_vec, Drive}; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use grovedb::query_result_type::QueryResultType; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/mod.rs index 679322d9e8a..7fa958a13cf 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/mod.rs @@ -2,7 +2,7 @@ mod v0; use crate::drive::Drive; use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/v0/mod.rs index 17500820ef4..a978bb98385 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash/v0/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::grove_operations::DirectQueryType::StatefulDirectQuery; use crate::drive::{non_unique_key_hashes_tree_path, Drive}; +use crate::util::grove_operations::DirectQueryType::StatefulDirectQuery; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/mod.rs index 2b2f1945868..4be7dd8dcc0 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/mod.rs @@ -2,7 +2,7 @@ mod v0; use crate::drive::Drive; use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/v0/mod.rs index 96def08fc17..a30aa3d9761 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_non_unique_public_key_hash_already_for_identity/v0/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::grove_operations::DirectQueryType::StatefulDirectQuery; use crate::drive::{non_unique_key_hashes_sub_tree_path, Drive}; +use crate::util::grove_operations::DirectQueryType::StatefulDirectQuery; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/mod.rs index 464751acb7a..dee523f0800 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/mod.rs @@ -2,7 +2,7 @@ mod v0; use crate::drive::Drive; use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/v0/mod.rs index d43ce8e99bc..7dcfbc03aa1 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/has_unique_public_key_hash/v0/mod.rs @@ -1,8 +1,8 @@ -use crate::drive::grove_operations::DirectQueryType::StatefulDirectQuery; use crate::drive::{unique_key_hashes_tree_path, Drive}; +use crate::util::grove_operations::DirectQueryType::StatefulDirectQuery; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; diff --git a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/mod.rs b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/mod.rs index b41b9587d25..9a928d7b272 100644 --- a/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/fetch_by_public_key_hashes/mod.rs @@ -8,27 +8,25 @@ mod has_non_unique_public_key_hash; mod has_non_unique_public_key_hash_already_for_identity; mod has_unique_public_key_hash; -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { - use crate::tests::helpers::setup::setup_drive; + use crate::util::test_helpers::setup::setup_drive; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::identity_public_key::methods::hash::IdentityPublicKeyHashMethodsV0; use dpp::identity::Identity; - use dpp::version::drive_versions::DriveVersion; use dpp::version::PlatformVersion; #[test] fn test_fetch_all_keys_on_identity() { let drive = setup_drive(None); - let drive_version = DriveVersion::latest(); + let platform_version = PlatformVersion::latest(); + let drive_version = &platform_version.drive; let transaction = drive.grove.start_transaction(); - let platform_version = PlatformVersion::first(); - drive .create_initial_state_structure(Some(&transaction), platform_version) .expect("expected to create root tree successfully"); @@ -58,11 +56,7 @@ mod tests { assert_eq!(public_keys.len(), 5); for (_, key) in public_keys { - let hash = key - .hash() - .expect("expected to get hash") - .try_into() - .expect("expected 20 bytes"); + let hash = key.public_key_hash().expect("expected to get hash"); if key.key_type().is_unique_key_type() { let identity_id = drive .fetch_identity_id_by_unique_public_key_hash( diff --git a/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/mod.rs b/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/mod.rs index fa597dd3249..e6fdfe60448 100644 --- a/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; diff --git a/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/v0/mod.rs index be13b98efd3..845f7ca37d3 100644 --- a/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/full_identity/fetch_full_identity/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; use dpp::identifier::Identifier; @@ -33,6 +33,7 @@ impl Drive { epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok((maybe_identity, fee)) } diff --git a/packages/rs-drive/src/drive/identity/fetch/full_identity/mod.rs b/packages/rs-drive/src/drive/identity/fetch/full_identity/mod.rs index 1726990c312..95dc07e00d8 100644 --- a/packages/rs-drive/src/drive/identity/fetch/full_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/full_identity/mod.rs @@ -1,11 +1,11 @@ mod fetch_full_identities; mod fetch_full_identity; -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; mod fetch_full_identities { use super::*; diff --git a/packages/rs-drive/src/drive/identity/fetch/mod.rs b/packages/rs-drive/src/drive/identity/fetch/mod.rs index 1e40ba1e02d..01ad75add42 100644 --- a/packages/rs-drive/src/drive/identity/fetch/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/mod.rs @@ -1,54 +1,59 @@ -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] use crate::drive::identity::identity_path_vec; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] use crate::drive::identity::IdentityRootStructure::IdentityTreeRevision; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] use crate::drive::Drive; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use crate::drive::RootTree; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use crate::error::drive::DriveError; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use crate::error::Error; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] use crate::query::Query; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use crate::query::QueryItem; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use grovedb::query_result_type::QueryResultType::{ QueryElementResultType, QueryKeyElementPairResultType, }; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use grovedb::Element::SumItem; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use grovedb::TransactionArg; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] use grovedb::{PathQuery, SizedQuery}; -#[cfg(feature = "full")] +use platform_version::version::PlatformVersion; +#[cfg(feature = "server")] use std::collections::BTreeMap; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod balance; -#[cfg(feature = "full")] +#[cfg(feature = "server")] +mod contract_keys; +#[cfg(feature = "server")] mod fetch_by_public_key_hashes; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod full_identity; -#[cfg(feature = "full")] +#[cfg(feature = "server")] +mod nonce; +#[cfg(feature = "server")] mod partial_identity; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod prove; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) mod queries; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod revision; impl Drive { - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// The query for the identity revision pub fn identity_revision_query(identity_id: &[u8; 32]) -> PathQuery { let identity_path = identity_path_vec(identity_id.as_slice()); @@ -64,12 +69,13 @@ impl Drive { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Given a vector of identities, fetches the identities from storage. pub fn verify_all_identities_exist( &self, ids: &Vec<[u8; 32]>, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result { let mut query = Query::new(); for id in ids { @@ -85,19 +91,28 @@ impl Drive { }; let (result_items, _) = self .grove - .query_raw(&path_query, true, true, QueryElementResultType, transaction) + .query_raw( + &path_query, + true, + true, + true, + QueryElementResultType, + transaction, + &platform_version.drive.grove_version, + ) .unwrap() .map_err(Error::GroveDB)?; Ok(result_items.len() == ids.len()) } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Given a vector of identities, fetches the identities from storage. pub fn fetch_identities_balances( &self, ids: &Vec<[u8; 32]>, transaction: TransactionArg, + platform_version: &PlatformVersion, ) -> Result, Error> { let mut query = Query::new(); for id in ids { @@ -117,8 +132,10 @@ impl Drive { &path_query, true, true, + true, QueryKeyElementPairResultType, transaction, + &platform_version.drive.grove_version, ) .unwrap() .map_err(Error::GroveDB)?; diff --git a/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/mod.rs b/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/mod.rs new file mode 100644 index 00000000000..31a8fe3e217 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/mod.rs @@ -0,0 +1,146 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::prelude::IdentityNonce; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Identity's nonce from the backing store + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to fetch. + /// * `apply` - If `true`, the changes are applied, otherwise only the cost is estimated. + /// * `transaction` - Transaction arguments. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option` for the Identity's nonce, otherwise an `Error` if the operation fails or the version is not supported. + pub fn fetch_identity_nonce( + &self, + identity_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .fetch + .attributes + .nonce + { + 0 => self.fetch_identity_nonce_v0(identity_id, apply, transaction, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Creates the operations to get Identity's nonce from the backing store. + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to fetch. + /// * `apply` - If `true`, the changes are applied, otherwise only the cost is estimated. + /// * `transaction` - Transaction arguments. + /// * `drive_operations` - A mutable reference to a vector of low-level drive operations. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option` for the Identity's nonce, otherwise an `Error` if the operation fails or the version is not supported. + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub(crate) fn fetch_identity_nonce_operations( + &self, + identity_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .fetch + .attributes + .nonce + { + 0 => self.fetch_identity_nonce_operations_v0( + identity_id, + apply, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_nonce_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Fetches the Identity's nonce from the backing store with its associated fees. + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to fetch. + /// * `block_info` - Information about the block. + /// * `apply` - If `true`, the changes are applied, otherwise only the cost is estimated. + /// * `transaction` - Transaction arguments. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option` for the Identity's nonce and the `FeeResult`, otherwise an `Error` if the operation fails or the version is not supported. + pub fn fetch_identity_nonce_with_fees( + &self, + identity_id: [u8; 32], + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Option, FeeResult), Error> { + match platform_version + .drive + .methods + .identity + .fetch + .attributes + .nonce + { + 0 => self.fetch_identity_nonce_with_fees_v0( + identity_id, + block_info, + apply, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_nonce_with_fees".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/v0/mod.rs new file mode 100644 index 00000000000..14a7c3f705e --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/v0/mod.rs @@ -0,0 +1,113 @@ +use crate::drive::identity::identity_path; +use crate::drive::identity::IdentityRootStructure::IdentityTreeNonce; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::prelude::IdentityNonce; + +use dpp::version::PlatformVersion; +use grovedb::Element::Item; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Identity's nonce from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_identity_nonce_v0( + &self, + identity_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations: Vec = vec![]; + self.fetch_identity_nonce_operations_v0( + identity_id, + apply, + transaction, + &mut drive_operations, + platform_version, + ) + } + + /// Creates the operations to get Identity's nonce from the backing store + /// This gets operations based on apply flag (stateful vs stateless) + pub(super) fn fetch_identity_nonce_operations_v0( + &self, + identity_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let direct_query_type = if apply { + DirectQueryType::StatefulDirectQuery + } else { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: false, + query_target: QueryTargetValue(1), + } + }; + let identity_path = identity_path(identity_id.as_slice()); + match self.grove_get_raw_optional( + (&identity_path).into(), + &[IdentityTreeNonce as u8], + direct_query_type, + transaction, + drive_operations, + &platform_version.drive, + ) { + Ok(Some(Item(encoded_nonce, _))) => { + let nonce = + IdentityNonce::from_be_bytes(encoded_nonce.try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedElementType( + "identity nonce was not 8 bytes as expected", + )) + })?); + + Ok(Some(nonce)) + } + + Ok(None) => Ok(None), + + Ok(Some(..)) => Err(Error::Drive(DriveError::CorruptedElementType( + "identity nonce was present but was not identified as an item", + ))), + + Err(e) => Err(e), + } + } + + /// Fetches the Identity's nonce from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_identity_nonce_with_fees_v0( + &self, + identity_id: [u8; 32], + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Option, FeeResult), Error> { + let mut drive_operations: Vec = vec![]; + let value = self.fetch_identity_nonce_operations_v0( + identity_id, + apply, + transaction, + &mut drive_operations, + platform_version, + )?; + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + Ok((value, fees)) + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/nonce/mod.rs b/packages/rs-drive/src/drive/identity/fetch/nonce/mod.rs new file mode 100644 index 00000000000..6eea4fe165d --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/nonce/mod.rs @@ -0,0 +1,2 @@ +mod fetch_identity_nonce; +mod prove_identity_nonce; diff --git a/packages/rs-drive/src/drive/identity/fetch/nonce/prove_identity_nonce/mod.rs b/packages/rs-drive/src/drive/identity/fetch/nonce/prove_identity_nonce/mod.rs new file mode 100644 index 00000000000..fb836958c89 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/nonce/prove_identity_nonce/mod.rs @@ -0,0 +1,39 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Identity's nonce from the backing store + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_id` - Identity Id to prove. + /// * `apply` - If `true`, the changes are applied, otherwise only the cost is estimated. + /// * `transaction` - Transaction arguments. + /// * `platform_version` - A reference to the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing a Proof for the Identity's nonce, otherwise an `Error` if the operation fails or the version is not supported. + pub fn prove_identity_nonce( + &self, + identity_id: [u8; 32], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version.drive.methods.identity.prove.identity_nonce { + 0 => self.prove_identity_nonce_v0(identity_id, transaction, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "prove_identity_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/nonce/prove_identity_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/nonce/prove_identity_nonce/v0/mod.rs new file mode 100644 index 00000000000..9201a255342 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/nonce/prove_identity_nonce/v0/mod.rs @@ -0,0 +1,24 @@ +use crate::drive::Drive; +use crate::error::Error; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Proves the Identity's nonce from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn prove_identity_nonce_v0( + &self, + identity_id: [u8; 32], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let nonce_query = Self::identity_nonce_query(identity_id); + self.grove_get_proved_path_query( + &nonce_query, + transaction, + &mut vec![], + &platform_version.drive, + ) + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/mod.rs index 00e4e65a215..6e0c95fe661 100644 --- a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/mod.rs @@ -3,7 +3,6 @@ use crate::drive::identity::key::fetch::IdentityKeysRequest; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; use dpp::identity::PartialIdentity; use dpp::version::PlatformVersion; @@ -66,7 +65,6 @@ impl Drive { /// /// - `identity_key_request`: A request containing information about the identity whose balance and keys need to be fetched. /// - `apply`: Whether to apply the operation or just fetch an estimation. - /// - `epoch`: Current epoch for cost estimation. /// - `transaction`: A transaction argument for the database. /// - `platform_version`: The platform version being used. /// @@ -82,7 +80,6 @@ impl Drive { &self, identity_key_request: IdentityKeysRequest, apply: bool, - epoch: &Epoch, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(Option, FeeResult), Error> { @@ -97,7 +94,6 @@ impl Drive { 0 => self.fetch_identity_balance_with_keys_with_cost_v0( identity_key_request, apply, - epoch, transaction, platform_version, ), diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/v0/mod.rs index c4bf3aeaf1a..9cdf3847504 100644 --- a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys/v0/mod.rs @@ -5,15 +5,11 @@ use crate::drive::identity::key::fetch::{ use crate::drive::Drive; use crate::error::Error; -use dpp::block::epoch::Epoch; -use dpp::fee::default_costs::KnownCostItem::FetchIdentityBalanceProcessingCost; use dpp::fee::fee_result::FeeResult; use dpp::identifier::Identifier; use dpp::identity::PartialIdentity; use grovedb::TransactionArg; -use dpp::fee::default_costs::EpochCosts; - use dpp::version::PlatformVersion; use std::collections::{BTreeMap, BTreeSet}; @@ -63,6 +59,7 @@ impl Drive { loaded_public_keys, balance: Some(balance), revision: None, + not_found_public_keys, })) } @@ -73,13 +70,15 @@ impl Drive { &self, identity_key_request: IdentityKeysRequest, apply: bool, - epoch: &Epoch, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(Option, FeeResult), Error> { - let balance_cost = epoch.cost_for_known_cost_item(FetchIdentityBalanceProcessingCost); + let balance_cost = platform_version + .fee_version + .processing + .fetch_identity_balance_processing_cost; if !apply { - let keys_cost = identity_key_request.processing_cost(epoch)?; + let keys_cost = identity_key_request.processing_cost(platform_version)?; return Ok(( None, FeeResult::new_from_processing_fee(balance_cost + keys_cost), @@ -96,7 +95,7 @@ impl Drive { return Ok((None, FeeResult::new_from_processing_fee(balance_cost))); }; - let keys_cost = identity_key_request.processing_cost(epoch)?; + let keys_cost = identity_key_request.processing_cost(platform_version)?; let loaded_public_keys = self.fetch_identity_keys::( identity_key_request, @@ -109,6 +108,7 @@ impl Drive { loaded_public_keys, balance: Some(balance), revision: None, + not_found_public_keys: Default::default(), }), FeeResult::new_from_processing_fee(balance_cost + keys_cost), diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys_and_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys_and_revision/v0/mod.rs index f5b8346d9dc..dafe030a9c0 100644 --- a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys_and_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_balance_with_keys_and_revision/v0/mod.rs @@ -68,6 +68,7 @@ impl Drive { loaded_public_keys, balance: Some(balance), revision: Some(revision), + not_found_public_keys, })) } diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_keys/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_keys/mod.rs new file mode 100644 index 00000000000..b5ed2e56f2f --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_keys/mod.rs @@ -0,0 +1,57 @@ +mod v0; + +use crate::drive::identity::key::fetch::IdentityKeysRequest; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::identity::PartialIdentity; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Identity's keys as `PartialIdentityInfo` from the backing store. + /// + /// This method selects the appropriate version of the function to call based on the + /// provided platform version. + /// + /// # Parameters + /// + /// - `identity_key_request`: A request containing information about the identity whose balance and keys need to be fetched. + /// - `transaction`: A transaction argument for the database. + /// - `platform_version`: The platform version being used. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option`. + /// + /// # Errors + /// + /// Returns an error if the platform version is not recognized or if there's a failure + /// during the operation. + pub fn fetch_identity_keys_as_partial_identity( + &self, + identity_key_request: IdentityKeysRequest, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .fetch + .partial_identity + .fetch_identity_keys + { + 0 => self.fetch_identity_keys_as_partial_identity_v0( + identity_key_request, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_keys_as_partial_identity".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_keys/v0/mod.rs new file mode 100644 index 00000000000..c837c6746cb --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_keys/v0/mod.rs @@ -0,0 +1,56 @@ +use crate::drive::identity::key::fetch::{ + IdentityKeysRequest, KeyIDOptionalIdentityPublicKeyPairBTreeMap, +}; +use crate::drive::Drive; +use crate::error::Error; + +use dpp::identifier::Identifier; +use dpp::identity::PartialIdentity; +use grovedb::TransactionArg; + +use dpp::version::PlatformVersion; +use std::collections::{BTreeMap, BTreeSet}; + +impl Drive { + /// Fetches the Identity's keys as PartialIdentityInfo from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_identity_keys_as_partial_identity_v0( + &self, + identity_key_request: IdentityKeysRequest, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let id = Identifier::new(identity_key_request.identity_id); + + let public_keys_with_optionals = self + .fetch_identity_keys::( + identity_key_request, + transaction, + platform_version, + )?; + + let mut loaded_public_keys = BTreeMap::new(); + let mut not_found_public_keys = BTreeSet::new(); + + public_keys_with_optionals + .into_iter() + .for_each(|(key, value)| { + match value { + None => { + not_found_public_keys.insert(key); + } + Some(value) => { + loaded_public_keys.insert(key, value); + } + }; + }); + Ok(Some(PartialIdentity { + id, + loaded_public_keys, + balance: None, + revision: None, + + not_found_public_keys, + })) + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_revision_with_keys/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_revision_with_keys/mod.rs new file mode 100644 index 00000000000..06114ebe093 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_revision_with_keys/mod.rs @@ -0,0 +1,57 @@ +mod v0; + +use crate::drive::identity::key::fetch::IdentityKeysRequest; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::identity::PartialIdentity; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Identity's revision along with its keys as `PartialIdentityInfo` from the backing store. + /// + /// This method selects the appropriate version of the function to call based on the + /// provided platform version. + /// + /// # Parameters + /// + /// - `identity_key_request`: A request containing information about the identity whose balance and keys need to be fetched. + /// - `transaction`: A transaction argument for the database. + /// - `platform_version`: The platform version being used. + /// + /// # Returns + /// + /// Returns a `Result` containing an `Option`. + /// + /// # Errors + /// + /// Returns an error if the platform version is not recognized or if there's a failure + /// during the operation. + pub fn fetch_identity_revision_with_keys( + &self, + identity_key_request: IdentityKeysRequest, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .fetch + .partial_identity + .fetch_identity_balance_with_keys_and_revision + { + 0 => self.fetch_identity_revision_with_keys_v0( + identity_key_request, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_revision_with_keys".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_revision_with_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_revision_with_keys/v0/mod.rs new file mode 100644 index 00000000000..50199051f42 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_revision_with_keys/v0/mod.rs @@ -0,0 +1,66 @@ +use crate::drive::identity::key::fetch::{ + IdentityKeysRequest, KeyIDOptionalIdentityPublicKeyPairBTreeMap, +}; +use crate::drive::Drive; +use crate::error::Error; + +use dpp::identifier::Identifier; +use dpp::identity::PartialIdentity; +use grovedb::TransactionArg; + +use dpp::version::PlatformVersion; +use std::collections::{BTreeMap, BTreeSet}; + +impl Drive { + /// Fetches the Identity's revision with keys as PartialIdentityInfo from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_identity_revision_with_keys_v0( + &self, + identity_key_request: IdentityKeysRequest, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let id = Identifier::new(identity_key_request.identity_id); + + let revision = self.fetch_identity_revision( + identity_key_request.identity_id, + true, + transaction, + platform_version, + )?; + let Some(revision) = revision else { + return Ok(None); + }; + + let public_keys_with_optionals = self + .fetch_identity_keys::( + identity_key_request, + transaction, + platform_version, + )?; + + let mut loaded_public_keys = BTreeMap::new(); + let mut not_found_public_keys = BTreeSet::new(); + + public_keys_with_optionals + .into_iter() + .for_each(|(key, value)| { + match value { + None => { + not_found_public_keys.insert(key); + } + Some(value) => { + loaded_public_keys.insert(key, value); + } + }; + }); + Ok(Some(PartialIdentity { + id, + loaded_public_keys, + balance: None, + revision: Some(revision), + + not_found_public_keys, + })) + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/mod.rs index f6ba1396471..d9c96c8bd9e 100644 --- a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/mod.rs @@ -3,7 +3,6 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; use dpp::identity::PartialIdentity; @@ -63,7 +62,6 @@ impl Drive { /// /// - `identity_id`: A 32-byte array representing the ID of the identity. /// - `apply`: A boolean to determine if the balance should be applied or just estimated. - /// - `epoch`: The current epoch for fee calculations. /// - `transaction`: A transaction argument for the database. /// - `platform_version`: The platform version being used. /// @@ -79,7 +77,6 @@ impl Drive { &self, identity_id: [u8; 32], apply: bool, - epoch: &Epoch, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(Option, FeeResult), Error> { @@ -94,7 +91,6 @@ impl Drive { 0 => self.fetch_identity_with_balance_with_cost_v0( identity_id, apply, - epoch, transaction, platform_version, ), diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/v0/mod.rs index 6a870ed1588..55f984e4742 100644 --- a/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/fetch_identity_with_balance/v0/mod.rs @@ -1,15 +1,11 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::epoch::Epoch; -use dpp::fee::default_costs::KnownCostItem::FetchIdentityBalanceProcessingCost; +use crate::fees::op::LowLevelDriveOperation; use dpp::fee::fee_result::FeeResult; use dpp::identifier::Identifier; use dpp::identity::PartialIdentity; use grovedb::TransactionArg; -use dpp::fee::default_costs::EpochCosts; - use dpp::version::PlatformVersion; impl Drive { @@ -35,6 +31,7 @@ impl Drive { loaded_public_keys: Default::default(), balance: Some(balance), revision: None, + not_found_public_keys: Default::default(), })) } @@ -45,11 +42,13 @@ impl Drive { &self, identity_id: [u8; 32], apply: bool, - epoch: &Epoch, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(Option, FeeResult), Error> { - let balance_cost = epoch.cost_for_known_cost_item(FetchIdentityBalanceProcessingCost); + let balance_cost = platform_version + .fee_version + .processing + .fetch_identity_balance_processing_cost; if !apply { return Ok((None, FeeResult::new_from_processing_fee(balance_cost))); } @@ -67,6 +66,7 @@ impl Drive { loaded_public_keys: Default::default(), balance: Some(balance), revision: None, + not_found_public_keys: Default::default(), }), FeeResult::new_from_processing_fee(balance_cost), diff --git a/packages/rs-drive/src/drive/identity/fetch/partial_identity/mod.rs b/packages/rs-drive/src/drive/identity/fetch/partial_identity/mod.rs index 60fab3a419a..00576a74355 100644 --- a/packages/rs-drive/src/drive/identity/fetch/partial_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/partial_identity/mod.rs @@ -1,3 +1,5 @@ mod fetch_identity_balance_with_keys; mod fetch_identity_balance_with_keys_and_revision; +mod fetch_identity_keys; +mod fetch_identity_revision_with_keys; mod fetch_identity_with_balance; diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/mod.rs index 1efdd47e5df..b095b6bf427 100644 --- a/packages/rs-drive/src/drive/identity/fetch/prove/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/prove/mod.rs @@ -2,5 +2,6 @@ mod prove_full_identities; mod prove_full_identities_by_unique_public_key_hashes; mod prove_full_identity; mod prove_full_identity_by_unique_public_key_hash; +mod prove_identities_contract_keys; mod prove_identity_id_by_unique_public_key_hash; mod prove_identity_ids_by_unique_public_key_hashes; diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities/v0/mod.rs index 36c6e2fe503..66e28991997 100644 --- a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; @@ -13,20 +13,14 @@ impl Drive { drive_version: &DriveVersion, ) -> Result, Error> { let mut drive_operations: Vec = vec![]; - let query = Self::full_identities_query(identity_ids)?; - self.grove_get_proved_path_query( - &query, - false, - transaction, - &mut drive_operations, - drive_version, - ) + let query = Self::full_identities_query(identity_ids, &drive_version.grove_version)?; + self.grove_get_proved_path_query(&query, transaction, &mut drive_operations, drive_version) } } #[cfg(test)] mod tests { - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; @@ -73,6 +67,7 @@ mod tests { .copied() .collect::>() .borrow(), + &platform_version.drive.grove_version, ) .expect("expected to get query"); @@ -82,8 +77,10 @@ mod tests { &path_query, true, true, + true, QueryResultType::QueryPathKeyElementTrioResultType, None, + &platform_version.drive.grove_version, ) .unwrap() .expect("expected to run the path query"); @@ -101,8 +98,12 @@ mod tests { ) .expect("should fetch an identity"); - let (_hash, proof) = GroveDb::verify_query(fetched_identities.as_slice(), &path_query) - .expect("expected to verify query"); + let (_hash, proof) = GroveDb::verify_query( + fetched_identities.as_slice(), + &path_query, + &platform_version.drive.grove_version, + ) + .expect("expected to verify query"); // We want to get a proof on the balance, the revision and 5 keys assert_eq!(proof.len(), 14); @@ -139,6 +140,7 @@ mod tests { .copied() .collect::>() .borrow(), + &platform_version.drive.grove_version, ) .expect("expected to get query"); @@ -250,8 +252,10 @@ mod tests { &path_query, true, true, + true, QueryResultType::QueryPathKeyElementTrioResultType, None, + &platform_version.drive.grove_version, ) .unwrap() .expect("expected to run the path query"); @@ -269,8 +273,12 @@ mod tests { ) .expect("should fetch an identity"); - let (_hash, proof) = GroveDb::verify_query(fetched_identities.as_slice(), &path_query) - .expect("expected to verify query"); + let (_hash, proof) = GroveDb::verify_query( + fetched_identities.as_slice(), + &path_query, + &platform_version.drive.grove_version, + ) + .expect("expected to verify query"); // We want to get a proof on the balance, the revision and 5 keys assert_eq!(proof.len(), 70); diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities_by_unique_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities_by_unique_public_key_hashes/v0/mod.rs index 592adeafe05..b7be9365d33 100644 --- a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities_by_unique_public_key_hashes/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identities_by_unique_public_key_hashes/v0/mod.rs @@ -22,7 +22,11 @@ impl Drive { .into_iter() .map(|(public_key_hash, maybe_identity_id)| { if let Some(identity_id) = maybe_identity_id { - Self::full_identity_with_public_key_hash_query(public_key_hash, identity_id) + Self::full_identity_with_public_key_hash_query( + public_key_hash, + identity_id, + &platform_version.drive.grove_version, + ) } else { Ok(Self::identity_id_by_unique_public_key_hash_query( public_key_hash, @@ -31,10 +35,13 @@ impl Drive { }) .collect::, Error>>()?; - let path_query = PathQuery::merge(path_queries.iter().collect()).map_err(Error::GroveDB)?; + let path_query = PathQuery::merge( + path_queries.iter().collect(), + &platform_version.drive.grove_version, + ) + .map_err(Error::GroveDB)?; self.grove_get_proved_path_query( &path_query, - true, transaction, &mut vec![], &platform_version.drive, @@ -45,7 +52,7 @@ impl Drive { #[cfg(test)] mod tests { use crate::drive::Drive; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; @@ -89,7 +96,9 @@ mod tests { .filter(|public_key| public_key.key_type().is_unique_key_type()) .map(move |public_key| { ( - public_key.hash().expect("expected to be 20 bytes"), + public_key + .public_key_hash() + .expect("expected to be 20 bytes"), Some(identity.clone()), ) }) @@ -105,7 +114,9 @@ mod tests { .filter(|public_key| public_key.key_type().is_unique_key_type()) .map(move |public_key| { ( - public_key.hash().expect("expected to be 20 bytes"), + public_key + .public_key_hash() + .expect("expected to be 20 bytes"), Some(identity.id().to_buffer()), ) }) diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity/v0/mod.rs index 5c0fa1fb847..4d3676d9b15 100644 --- a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; @@ -13,20 +13,14 @@ impl Drive { drive_version: &DriveVersion, ) -> Result, Error> { let mut drive_operations: Vec = vec![]; - let query = Self::full_identity_query(&identity_id)?; - self.grove_get_proved_path_query( - &query, - false, - transaction, - &mut drive_operations, - drive_version, - ) + let query = Self::full_identity_query(&identity_id, &drive_version.grove_version)?; + self.grove_get_proved_path_query(&query, transaction, &mut drive_operations, drive_version) } } #[cfg(test)] mod tests { - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use crate::drive::Drive; @@ -42,8 +36,8 @@ mod tests { #[test] fn should_prove_full_identity_query_no_tx() { - let drive = setup_drive_with_initial_state_structure(); let platform_version = PlatformVersion::latest(); + let drive = setup_drive_with_initial_state_structure(); let identity = Identity::random_identity(5, Some(14), platform_version) .expect("expected a random identity"); @@ -58,8 +52,11 @@ mod tests { ) .expect("expected to insert identity"); - let path_query = Drive::full_identity_query(identity.id().as_bytes()) - .expect("expected to make the query"); + let path_query = Drive::full_identity_query( + identity.id().as_bytes(), + &platform_version.drive.grove_version, + ) + .expect("expected to make the query"); // The query is querying // root @@ -147,8 +144,10 @@ mod tests { &path_query, true, true, + true, QueryResultType::QueryPathKeyElementTrioResultType, None, + &platform_version.drive.grove_version, ) .unwrap() .expect("expected to run the path query"); @@ -158,8 +157,12 @@ mod tests { .prove_full_identity_v0(identity.id().to_buffer(), None, &platform_version.drive) .expect("should fetch an identity"); - let (_hash, proof) = GroveDb::verify_query(fetched_identity.as_slice(), &path_query) - .expect("expected to verify query"); + let (_hash, proof) = GroveDb::verify_query( + fetched_identity.as_slice(), + &path_query, + &platform_version.drive.grove_version, + ) + .expect("expected to verify query"); // We want to get a proof on the balance, the revision and 5 keys assert_eq!(proof.len(), 7); diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity_by_unique_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity_by_unique_public_key_hash/v0/mod.rs index 1c0362898ca..3df63086c2d 100644 --- a/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity_by_unique_public_key_hash/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_full_identity_by_unique_public_key_hash/v0/mod.rs @@ -20,11 +20,13 @@ impl Drive { platform_version, )?; if let Some(identity_id) = identity_id { - let query = - Self::full_identity_with_public_key_hash_query(public_key_hash, identity_id)?; + let query = Self::full_identity_with_public_key_hash_query( + public_key_hash, + identity_id, + &platform_version.drive.grove_version, + )?; self.grove_get_proved_path_query( &query, - true, transaction, &mut vec![], &platform_version.drive, @@ -34,7 +36,6 @@ impl Drive { let query = Self::identity_id_by_unique_public_key_hash_query(public_key_hash); self.grove_get_proved_path_query( &query, - false, transaction, &mut vec![], &platform_version.drive, @@ -46,7 +47,7 @@ impl Drive { #[cfg(test)] mod tests { use super::*; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; @@ -79,10 +80,8 @@ mod tests { .values() .find(|public_key| public_key.key_type().is_unique_key_type()) .expect("expected a unique key") - .hash() - .expect("expected to hash data") - .try_into() - .expect("expected to be 20 bytes"); + .public_key_hash() + .expect("expected to hash data"); let proof = drive .prove_full_identity_by_unique_public_key_hash(first_key_hash, None, platform_version) diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_identities_contract_keys/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identities_contract_keys/mod.rs new file mode 100644 index 00000000000..7556fca4253 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identities_contract_keys/mod.rs @@ -0,0 +1,58 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::identity::Purpose; +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Proves identities contract keys given identity ids, contract id, optional document type name and purposes + /// + /// This function uses the versioning system to call the appropriate handler based on the provided `DriveVersion`. + /// + /// # Arguments + /// + /// * `identity_ids` - The slice of identity ids to prove + /// * `contract_id` - The contract id + /// * `document_type_name` - The optional document type name + /// * `purposes` - Key purposes + /// * `transaction` - Transaction arguments. + /// * `drive_version` - A reference to the drive version. + /// + /// # Returns + /// + /// Returns a `Result` containing a vector of bytes representing the proved identities keys bound to specified contract, otherwise an `Error` if the operation fails or the version is not supported. + pub fn prove_identities_contract_keys( + &self, + identity_ids: &[[u8; 32]], + contract_id: &[u8; 32], + document_type_name: Option, + purposes: Vec, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version + .methods + .identity + .prove + .identities_contract_keys + { + 0 => self.prove_identities_contract_keys_v0( + identity_ids, + contract_id, + document_type_name, + purposes, + transaction, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "prove_identities_contract_keys".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_identities_contract_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identities_contract_keys/v0/mod.rs new file mode 100644 index 00000000000..d2f644995bc --- /dev/null +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identities_contract_keys/v0/mod.rs @@ -0,0 +1,30 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::identity::Purpose; +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Proves identities keys bound to specified contract + #[inline(always)] + pub(super) fn prove_identities_contract_keys_v0( + &self, + identity_ids: &[[u8; 32]], + contract_id: &[u8; 32], + document_type_name: Option, + purposes: Vec, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result, Error> { + let mut drive_operations: Vec = vec![]; + let query = Self::identities_contract_keys_query( + identity_ids, + contract_id, + &document_type_name, + &purposes, + Some((identity_ids.len() * purposes.len()) as u16), + ); + self.grove_get_proved_path_query(&query, transaction, &mut drive_operations, drive_version) + } +} diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_id_by_unique_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_id_by_unique_public_key_hash/v0/mod.rs index 34d5e219be4..cd41d83e24e 100644 --- a/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_id_by_unique_public_key_hash/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_id_by_unique_public_key_hash/v0/mod.rs @@ -14,20 +14,14 @@ impl Drive { drive_version: &DriveVersion, ) -> Result, Error> { let path_query = Self::identity_id_by_unique_public_key_hash_query(public_key_hash); - self.grove_get_proved_path_query( - &path_query, - false, - transaction, - &mut vec![], - drive_version, - ) + self.grove_get_proved_path_query(&path_query, transaction, &mut vec![], drive_version) } } #[cfg(test)] mod tests { use crate::drive::Drive; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; @@ -60,10 +54,8 @@ mod tests { .values() .find(|public_key| public_key.key_type().is_unique_key_type()) .expect("expected a unique key") - .hash() - .expect("expected to hash data") - .try_into() - .expect("expected to be 20 bytes"); + .public_key_hash() + .expect("expected to hash data"); let proof = drive .prove_identity_id_by_unique_public_key_hash_v0( diff --git a/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_ids_by_unique_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_ids_by_unique_public_key_hashes/v0/mod.rs index a0c5b03100d..28a7cfa35ce 100644 --- a/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_ids_by_unique_public_key_hashes/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/prove/prove_identity_ids_by_unique_public_key_hashes/v0/mod.rs @@ -16,7 +16,6 @@ impl Drive { let path_query = Self::identity_ids_by_unique_public_key_hash_query(public_key_hashes); self.grove_get_proved_path_query( &path_query, - false, transaction, &mut vec![], &platform_version.drive, @@ -27,7 +26,7 @@ impl Drive { #[cfg(test)] mod tests { use crate::drive::Drive; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; @@ -71,7 +70,9 @@ mod tests { .filter(|public_key| public_key.key_type().is_unique_key_type()) .map(move |public_key| { ( - public_key.hash().expect("expected to be 20 bytes"), + public_key + .public_key_hash() + .expect("expected to be 20 bytes"), Some(identity.id().to_buffer()), ) }) diff --git a/packages/rs-drive/src/drive/identity/fetch/queries/mod.rs b/packages/rs-drive/src/drive/identity/fetch/queries/mod.rs index 45582997c33..aa12b299102 100644 --- a/packages/rs-drive/src/drive/identity/fetch/queries/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/queries/mod.rs @@ -1,13 +1,20 @@ use crate::drive::balances::balance_path_vec; use crate::drive::identity::key::fetch::IdentityKeysRequest; -use crate::drive::{unique_key_hashes_tree_path_vec, Drive}; +use crate::drive::{identity_tree_path_vec, unique_key_hashes_tree_path_vec, Drive}; use crate::error::Error; -use crate::drive::identity::identity_path_vec; -use crate::drive::identity::IdentityRootStructure::IdentityTreeRevision; +use crate::drive::identity::contract_info::ContractInfoStructure; +use crate::drive::identity::contract_info::ContractInfoStructure::IdentityContractNonceKey; +use crate::drive::identity::IdentityRootStructure::{IdentityTreeNonce, IdentityTreeRevision}; +use crate::drive::identity::{ + identity_contract_info_group_path_vec, identity_path_vec, IdentityRootStructure, +}; use crate::error::query::QuerySyntaxError; +use dpp::identity::Purpose; +use grovedb::query_result_type::Key; use grovedb::{PathQuery, Query, SizedQuery}; +use grovedb_version::version::GroveVersion; /// An enumeration representing the types of identity prove requests. /// @@ -24,6 +31,8 @@ pub enum IdentityProveRequestType { Balance = 1, /// Keys: A variant representing keys access only, assigned the value 2. Keys = 2, + /// Revision: A variant representing revision field + Revision = 3, } impl TryFrom for IdentityProveRequestType { @@ -34,6 +43,7 @@ impl TryFrom for IdentityProveRequestType { 0 => Ok(IdentityProveRequestType::FullIdentity), 1 => Ok(IdentityProveRequestType::Balance), 2 => Ok(IdentityProveRequestType::Keys), + 3 => Ok(IdentityProveRequestType::Revision), _ => Err(Error::Query(QuerySyntaxError::InvalidIdentityProveRequest( "unknown prove request type", ))), @@ -63,11 +73,14 @@ impl Drive { } /// The path query for the revision and the balance of an identity - pub fn revision_and_balance_path_query(identity_id: [u8; 32]) -> PathQuery { + pub fn revision_and_balance_path_query( + identity_id: [u8; 32], + grove_version: &GroveVersion, + ) -> Result { let revision_query = Self::revision_for_identity_id_path_query(identity_id); let balance_query = Self::balance_for_identity_id_query(identity_id); - PathQuery::merge(vec![&revision_query, &balance_query]) - .expect("expected to be able to merge path queries") + PathQuery::merge(vec![&revision_query, &balance_query], grove_version) + .map_err(Error::GroveDB) } /// The query for proving an identity id from a public key hash. @@ -92,53 +105,70 @@ impl Drive { } /// The query getting all keys and balance and revision - pub fn full_identity_query(identity_id: &[u8; 32]) -> Result { + pub fn full_identity_query( + identity_id: &[u8; 32], + grove_version: &GroveVersion, + ) -> Result { let balance_query = Self::identity_balance_query(identity_id); let revision_query = Self::identity_revision_query(identity_id); let key_request = IdentityKeysRequest::new_all_keys_query(identity_id, None); let all_keys_query = key_request.into_path_query(); - PathQuery::merge(vec![&balance_query, &revision_query, &all_keys_query]) - .map_err(Error::GroveDB) + PathQuery::merge( + vec![&balance_query, &revision_query, &all_keys_query], + grove_version, + ) + .map_err(Error::GroveDB) } /// The query getting all keys and revision - pub fn identity_all_keys_query(identity_id: &[u8; 32]) -> Result { + pub fn identity_all_keys_query( + identity_id: &[u8; 32], + grove_version: &GroveVersion, + ) -> Result { let revision_query = Self::identity_revision_query(identity_id); let key_request = IdentityKeysRequest::new_all_keys_query(identity_id, None); let all_keys_query = key_request.into_path_query(); - PathQuery::merge(vec![&revision_query, &all_keys_query]).map_err(Error::GroveDB) + PathQuery::merge(vec![&revision_query, &all_keys_query], grove_version) + .map_err(Error::GroveDB) } /// The query getting all balances and revision - pub fn balances_for_identity_ids_query(identity_ids: &[[u8; 32]]) -> Result { + pub fn balances_for_identity_ids_query( + identity_ids: &[[u8; 32]], + grove_version: &GroveVersion, + ) -> Result { let path_queries: Vec = identity_ids .iter() .map(Self::identity_balance_query) .collect::>(); - PathQuery::merge(path_queries.iter().collect()).map_err(Error::GroveDB) + PathQuery::merge(path_queries.iter().collect(), grove_version).map_err(Error::GroveDB) } /// The query getting all keys and balance and revision - pub fn full_identities_query(identity_ids: &[[u8; 32]]) -> Result { + pub fn full_identities_query( + identity_ids: &[[u8; 32]], + grove_version: &GroveVersion, + ) -> Result { let path_queries: Vec = identity_ids .iter() - .map(Self::full_identity_query) + .map(|identity_id| Self::full_identity_query(identity_id, grove_version)) .collect::, Error>>()?; - PathQuery::merge(path_queries.iter().collect()).map_err(Error::GroveDB) + PathQuery::merge(path_queries.iter().collect(), grove_version).map_err(Error::GroveDB) } /// This query gets the full identity and the public key hash pub fn full_identity_with_public_key_hash_query( public_key_hash: [u8; 20], identity_id: [u8; 32], + grove_version: &GroveVersion, ) -> Result { - let full_identity_query = Self::full_identity_query(&identity_id)?; + let full_identity_query = Self::full_identity_query(&identity_id, grove_version)?; let identity_id_by_public_key_hash_query = Self::identity_id_by_unique_public_key_hash_query(public_key_hash); - PathQuery::merge(vec![ - &full_identity_query, - &identity_id_by_public_key_hash_query, - ]) + PathQuery::merge( + vec![&full_identity_query, &identity_id_by_public_key_hash_query], + grove_version, + ) .map_err(Error::GroveDB) } @@ -146,15 +176,16 @@ impl Drive { pub fn full_identities_with_keys_hashes_query( identity_ids: &[[u8; 32]], key_hashes: &[[u8; 20]], + grove_version: &GroveVersion, ) -> Result { - let identities_path_query = Self::full_identities_query(identity_ids)?; + let identities_path_query = Self::full_identities_query(identity_ids, grove_version)?; let key_hashes_to_identity_ids_query = Self::identity_ids_by_unique_public_key_hash_query(key_hashes); - PathQuery::merge(vec![ - &identities_path_query, - &key_hashes_to_identity_ids_query, - ]) + PathQuery::merge( + vec![&identities_path_query, &key_hashes_to_identity_ids_query], + grove_version, + ) .map_err(Error::GroveDB) } @@ -173,17 +204,133 @@ impl Drive { } } + /// The query for the identity contract bounded keys for multiple identities + pub fn identities_contract_keys_query( + identity_ids: &[[u8; 32]], + contract_id: &[u8; 32], + document_type_name: &Option, + purposes: &[Purpose], + limit: Option, + ) -> PathQuery { + let identities_path = identity_tree_path_vec(); + let mut query = Query::new(); + query.insert_keys( + identity_ids + .iter() + .map(|identity_id| identity_id.to_vec()) + .collect(), + ); + + let mut group_id = contract_id.to_vec(); + if let Some(document_type_name) = document_type_name { + group_id.extend(document_type_name.as_bytes()); + } + + query.default_subquery_branch.subquery_path = Some(vec![ + vec![IdentityRootStructure::IdentityContractInfo as u8], + group_id, + vec![ContractInfoStructure::ContractInfoKeysKey as u8], + ]); + + let mut sub_query = Query::new(); + + sub_query.insert_keys( + purposes + .iter() + .map(|purpose| vec![*purpose as u8]) + .collect(), + ); + + sub_query.set_subquery_key(Key::new()); + + query.default_subquery_branch.subquery = Some(sub_query.into()); + PathQuery { + path: identities_path, + query: SizedQuery { + query, + limit, + offset: None, + }, + } + } + + /// The query for the identity contract document type bounded keys for multiple identities + pub fn identities_contract_document_type_keys_query( + identity_ids: &[[u8; 32]], + contract_id: [u8; 32], + document_type_name: &str, + purposes: Vec, + ) -> PathQuery { + let identities_path = identity_tree_path_vec(); + let mut query = Query::new(); + query.insert_keys( + identity_ids + .iter() + .map(|identity_id| identity_id.to_vec()) + .collect(), + ); + let mut group_id = contract_id.to_vec(); + group_id.extend(document_type_name.as_bytes()); + query.default_subquery_branch.subquery_path = Some(vec![ + vec![IdentityRootStructure::IdentityContractInfo as u8], + contract_id.to_vec(), + vec![ContractInfoStructure::ContractInfoKeysKey as u8], + ]); + + let mut sub_query = Query::new(); + + sub_query.insert_keys( + purposes + .into_iter() + .map(|purpose| vec![purpose as u8]) + .collect(), + ); + + query.default_subquery_branch.subquery = Some(sub_query.into()); + PathQuery { + path: identities_path, + query: SizedQuery { + query, + limit: None, + offset: None, + }, + } + } + /// The query for proving the identities balance from an identity id. pub fn balance_for_identity_id_query(identity_id: [u8; 32]) -> PathQuery { let balance_path = balance_path_vec(); PathQuery::new_single_key(balance_path, identity_id.to_vec()) } + /// The query for proving an identity's nonce. + pub fn identity_nonce_query(identity_id: [u8; 32]) -> PathQuery { + let identity_path = identity_path_vec(identity_id.as_slice()); + PathQuery::new_single_key(identity_path, vec![IdentityTreeNonce as u8]) + } + + /// The query for proving the identities nonce for a specific contract. + pub fn identity_contract_nonce_query( + identity_id: [u8; 32], + contract_id: [u8; 32], + ) -> PathQuery { + let identity_contract_path = + identity_contract_info_group_path_vec(&identity_id, contract_id.as_slice()); + PathQuery::new_single_key(identity_contract_path, vec![IdentityContractNonceKey as u8]) + } + /// The query for proving the identities balance and revision from an identity id. - pub fn balance_and_revision_for_identity_id_query(identity_id: [u8; 32]) -> PathQuery { + pub fn balance_and_revision_for_identity_id_query( + identity_id: [u8; 32], + grove_version: &GroveVersion, + ) -> PathQuery { let balance_path_query = Self::balance_for_identity_id_query(identity_id); let revision_path_query = Self::identity_revision_query(&identity_id); //todo: lazy static this - PathQuery::merge(vec![&balance_path_query, &revision_path_query]).unwrap() + PathQuery::merge( + vec![&balance_path_query, &revision_path_query], + grove_version, + ) + .unwrap() } } diff --git a/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/mod.rs b/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/mod.rs index 41494e0ef9a..4250f48a58f 100644 --- a/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/mod.rs @@ -2,7 +2,7 @@ mod v0; use crate::drive::Drive; use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::prelude::Revision; diff --git a/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs index c8d354b3c67..bc58f655241 100644 --- a/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs @@ -1,11 +1,11 @@ -use crate::drive::grove_operations::DirectQueryType; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; use crate::drive::identity::identity_path; use crate::drive::identity::IdentityRootStructure::IdentityTreeRevision; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::prelude::Revision; @@ -106,6 +106,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok((value, fees)) } diff --git a/packages/rs-drive/src/drive/identity/insert/add_new_identity/mod.rs b/packages/rs-drive/src/drive/identity/insert/add_new_identity/mod.rs index b34078456a0..bd03fbe38b6 100644 --- a/packages/rs-drive/src/drive/identity/insert/add_new_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/insert/add_new_identity/mod.rs @@ -1,7 +1,7 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::identity::Identity; diff --git a/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs index bb52ab42db2..6b6dfbf6d08 100644 --- a/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs @@ -1,10 +1,10 @@ -use crate::drive::flags::StorageFlags; -use crate::drive::grove_operations::BatchInsertTreeApplyType; -use crate::drive::object_size_info::PathKeyInfo::PathFixedSizeKey; use crate::drive::{identity_tree_path, Drive}; use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::PathKeyInfo::PathFixedSizeKey; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::identity::accessors::IdentityGettersV0; @@ -51,6 +51,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok(fees) } @@ -130,6 +131,7 @@ impl Drive { // We insert the identity tree let inserted = self.batch_insert_empty_tree_if_not_exists( PathFixedSizeKey((identity_tree_path, id.to_vec())), + false, Some(&storage_flags), apply_type, transaction, @@ -187,6 +189,7 @@ impl Drive { .iter() .map(|identity_public_key| identity_public_key.id()) .collect(), + &block_info.epoch, estimated_costs_only_with_layer_info, transaction, platform_version, @@ -244,10 +247,13 @@ impl Drive { .push(self.initialize_negative_identity_balance_operation_v0(id.to_buffer())); // We insert the revision - // todo: we might not need the revision batch_operations .push(self.initialize_identity_revision_operation_v0(id.to_buffer(), revision)); + // We insert a nonce of 0, nonces are used to prevent replay attacks, and should not be confused + // revisions + batch_operations.push(self.initialize_identity_nonce_operation_v0(id.to_buffer(), 0)); + let mut create_tree_keys_operations = self.create_key_tree_with_keys_operations( id.to_buffer(), public_keys.into_values().collect(), @@ -267,16 +273,13 @@ impl Drive { #[cfg(test)] mod tests { - use crate::tests::helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; + use crate::util::test_helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; use dpp::identity::Identity; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::version::PlatformVersion; - use tempfile::TempDir; - - use crate::drive::Drive; #[test] fn test_insert_and_fetch_identity_v0() { diff --git a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/mod.rs index 714bca11ce9..88040df2cb2 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/v0/mod.rs index 18d572717cd..d17cdc20b6c 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_current_identity_keys/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::identity::key::fetch::{IdentityKeysRequest, KeyIDIdentityPublicKeyPairBTreeMap}; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::version::PlatformVersion; @@ -10,6 +10,7 @@ use std::collections::BTreeMap; impl Drive { /// Fetch all the current keys of every kind for a specific Identity + #[inline(always)] pub(super) fn fetch_all_current_identity_keys_v0( &self, identity_id: [u8; 32], diff --git a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/mod.rs index 4f355cd5b80..c119b471ae0 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/v0/mod.rs index 0b0c1005fe3..52374cc12a8 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/fetch_all_identity_keys/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::identity::key::fetch::IdentityKeysRequest; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::{IdentityPublicKey, KeyID, IDENTITY_MAX_KEYS}; use dpp::version::PlatformVersion; @@ -10,6 +10,7 @@ use std::collections::BTreeMap; impl Drive { /// Fetch all the keys of every kind for a specific Identity + #[inline(always)] pub(super) fn fetch_all_identity_keys_v0( &self, identity_id: [u8; 32], @@ -26,6 +27,7 @@ impl Drive { } /// Operations for fetching all the keys of every kind for a specific Identity + #[inline(always)] pub(super) fn fetch_all_identity_keys_operations_v0( &self, identity_id: [u8; 32], diff --git a/packages/rs-drive/src/drive/identity/key/fetch/fetch_identities_all_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/fetch_identities_all_keys/v0/mod.rs index 6792dc73b3f..3a54dda22e8 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/fetch_identities_all_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/fetch_identities_all_keys/v0/mod.rs @@ -29,6 +29,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the key fetching fails. + #[inline(always)] pub(super) fn fetch_identities_all_keys_v0( &self, identity_ids: &[[u8; 32]], diff --git a/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/mod.rs index 44b99fde299..ec54f15491f 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/mod.rs @@ -4,7 +4,7 @@ use crate::drive::identity::key::fetch::{IdentityKeysRequest, IdentityPublicKeyR use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/v0/mod.rs index cc69305c880..d9a4edf0fa5 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/fetch_identity_keys/v0/mod.rs @@ -2,11 +2,11 @@ use crate::drive::identity::key::fetch::KeyRequestType::{ AllKeys, ContractBoundKey, ContractDocumentTypeBoundKey, SearchKey, SpecificKeys, }; use crate::drive::identity::key::fetch::{ - IdentityKeysRequest, IdentityPublicKeyResult, KeyKindRequestType, KeyRequestType, + IdentityKeysRequest, IdentityPublicKeyResult, KeyKindRequestType, }; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::query_result_type::QueryResultType::QueryPathKeyElementTrioResultType; @@ -56,6 +56,7 @@ impl Drive { let result = self.grove_get_raw_path_query_with_optional( &path_query, + false, transaction, drive_operations, &platform_version.drive, diff --git a/packages/rs-drive/src/drive/identity/key/fetch/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/mod.rs index 9f0cbcfce5c..4567278c784 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/mod.rs @@ -1,75 +1,57 @@ -#[cfg(feature = "full")] +// Conditional imports for the features "server" or "verify" +#[cfg(any(feature = "server", feature = "verify"))] +use { + crate::{ + drive::identity::{ + identity_contract_info_group_path_key_purpose_vec, identity_key_tree_path_vec, + identity_query_keys_tree_path_vec, + key::fetch::KeyKindRequestType::{AllKeysOfKindRequest, CurrentKeyOfKindRequest}, + key::fetch::KeyRequestType::{ + AllKeys, ContractBoundKey, ContractDocumentTypeBoundKey, SearchKey, SpecificKeys, + }, + }, + query::{Query, QueryItem}, + }, + dpp::{ + identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0, + identity::{KeyID, Purpose}, + }, + grovedb::{PathQuery, SizedQuery}, + integer_encoding::VarInt, + std::{collections::BTreeMap, ops::RangeFull}, +}; + +// Conditional imports for the feature "server" +#[cfg(feature = "server")] +use { + crate::error::{drive::DriveError, fee::FeeError, identity::IdentityError, Error}, + dpp::{ + fee::Credits, + identity::{IdentityPublicKey, SecurityLevel}, + serialization::PlatformDeserializable, + version::PlatformVersion, + }, + grovedb::{ + query_result_type::{ + Key, Path, PathKeyOptionalElementTrio, QueryResultElement, QueryResultElements, + }, + Element, + Element::Item, + }, + std::collections::HashSet, +}; + +// Modules conditionally compiled for the feature "server" +#[cfg(feature = "server")] mod fetch_all_current_identity_keys; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod fetch_all_identity_keys; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod fetch_identities_all_keys; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod fetch_identity_keys; -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::identity::{identity_key_tree_path_vec, identity_query_keys_tree_path_vec}; - -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::identity::key::fetch::KeyKindRequestType::{ - AllKeysOfKindRequest, CurrentKeyOfKindRequest, -}; -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::identity::key::fetch::KeyRequestType::{AllKeys, SearchKey, SpecificKeys}; - -#[cfg(feature = "full")] -use crate::error::drive::DriveError; -#[cfg(feature = "full")] -use crate::error::fee::FeeError; -#[cfg(feature = "full")] -use crate::error::identity::IdentityError; -#[cfg(feature = "full")] -use crate::error::Error; - -#[cfg(any(feature = "full", feature = "verify"))] -use crate::query::{Query, QueryItem}; -#[cfg(feature = "full")] -use dpp::block::epoch::Epoch; -#[cfg(feature = "full")] -use dpp::fee::default_costs::EpochCosts; -#[cfg(feature = "full")] -use dpp::fee::default_costs::KnownCostItem::FetchSingleIdentityKeyProcessingCost; -#[cfg(feature = "full")] -use dpp::fee::Credits; -use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::identity::KeyID; - -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::identity::{Purpose, SecurityLevel}; -#[cfg(feature = "full")] -use dpp::prelude::IdentityPublicKey; -use dpp::serialization::PlatformDeserializable; -use dpp::version::PlatformVersion; - -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::identity::identity_contract_info_group_path_key_purpose_vec; -use crate::drive::identity::key::fetch::KeyRequestType::{ - ContractBoundKey, ContractDocumentTypeBoundKey, -}; -#[cfg(feature = "full")] -use grovedb::query_result_type::{ - Key, Path, PathKeyOptionalElementTrio, QueryResultElement, QueryResultElements, -}; -#[cfg(feature = "full")] -use grovedb::Element; -#[cfg(feature = "full")] -use grovedb::Element::Item; -#[cfg(any(feature = "full", feature = "verify"))] -use grovedb::{PathQuery, SizedQuery}; -#[cfg(any(feature = "full", feature = "verify"))] -use integer_encoding::VarInt; -#[cfg(any(feature = "full", feature = "verify"))] -use std::collections::BTreeMap; -use std::collections::HashSet; -use std::ops::RangeFull; - -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// The kind of keys you are requesting /// A kind is a purpose/security level pair /// Do you want to get all keys in that pair @@ -82,7 +64,7 @@ pub enum KeyKindRequestType { AllKeysOfKindRequest, } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// The type of key request #[derive(Clone)] pub enum KeyRequestType { @@ -98,63 +80,63 @@ pub enum KeyRequestType { ContractDocumentTypeBoundKey([u8; 32], String, Purpose, KeyKindRequestType), } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// The key purpose as u8. pub type PurposeU8 = u8; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// The key security level as u8. pub type SecurityLevelU8 = u8; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a hashset of IdentityPublicKey Ids as the outcome of the query. pub type KeyIDHashSet = HashSet; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a vec of IdentityPublicKey Ids as the outcome of the query. pub type KeyIDVec = Vec; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a vec of IdentityPublicKeys as the outcome of the query. pub type KeyVec = Vec; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a vec of serialized IdentityPublicKeys as the outcome of the query. pub type SerializedKeyVec = Vec>; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a single IdentityPublicKey as the outcome of the query. pub type SingleIdentityPublicKeyOutcome = IdentityPublicKey; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for an optional single IdentityPublicKey as the outcome of the query. pub type OptionalSingleIdentityPublicKeyOutcome = Option; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a Vector for key id to identity public key pair common pattern. pub type KeyIDIdentityPublicKeyPairVec = Vec<(KeyID, IdentityPublicKey)>; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a Vector for key id to optional identity public key pair common pattern. pub type KeyIDOptionalIdentityPublicKeyPairVec = Vec<(KeyID, Option)>; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a Vector for query key path to optional identity public key pair common pattern. pub type QueryKeyPathOptionalIdentityPublicKeyTrioVec = Vec<(Path, Key, Option)>; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a bTreemap for a key id to identity public key pair common pattern. pub type KeyIDIdentityPublicKeyPairBTreeMap = BTreeMap; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a bTreemap for a key id to optional identity public key pair common pattern. pub type KeyIDOptionalIdentityPublicKeyPairBTreeMap = BTreeMap>; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Type alias for a bTreemap for a query key path to optional identity public key pair common pattern. pub type QueryKeyPathOptionalIdentityPublicKeyTrioBTreeMap = BTreeMap<(Path, Key), Option>; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// A trait to get typed results from raw results from Drive pub trait IdentityPublicKeyResult { /// Get a typed result from a trio of path key elements @@ -173,7 +155,7 @@ pub trait IdentityPublicKeyResult { Self: Sized; } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn element_to_serialized_identity_public_key(element: Element) -> Result, Error> { let Item(value, _) = element else { return Err(Error::Drive(DriveError::CorruptedElementType( @@ -184,7 +166,7 @@ fn element_to_serialized_identity_public_key(element: Element) -> Result Ok(value) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn element_to_identity_public_key(element: Element) -> Result { let Item(value, _) = element else { return Err(Error::Drive(DriveError::CorruptedElementType( @@ -195,14 +177,14 @@ fn element_to_identity_public_key(element: Element) -> Result Result { let public_key = element_to_identity_public_key(element)?; Ok(public_key.id()) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn element_to_identity_public_key_id_and_object_pair( element: Element, ) -> Result<(KeyID, IdentityPublicKey), Error> { @@ -211,7 +193,7 @@ fn element_to_identity_public_key_id_and_object_pair( Ok((public_key.id(), public_key)) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn key_and_optional_element_to_identity_public_key_id_and_object_pair( (_path, key, maybe_element): (Path, Key, Option), ) -> Result<(KeyID, Option), Error> { @@ -230,7 +212,7 @@ fn key_and_optional_element_to_identity_public_key_id_and_object_pair( Ok((key_id, None)) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn supported_query_result_element_to_identity_public_key( query_result_element: QueryResultElement, ) -> Result { @@ -243,7 +225,7 @@ fn supported_query_result_element_to_identity_public_key( } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn supported_query_result_element_to_serialized_identity_public_key( query_result_element: QueryResultElement, ) -> Result, Error> { @@ -256,7 +238,7 @@ fn supported_query_result_element_to_serialized_identity_public_key( } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn supported_query_result_element_to_identity_public_key_id( query_result_element: QueryResultElement, ) -> Result { @@ -269,7 +251,7 @@ fn supported_query_result_element_to_identity_public_key_id( } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn supported_query_result_element_to_identity_public_key_id_and_object_pair( query_result_element: QueryResultElement, ) -> Result<(KeyID, IdentityPublicKey), Error> { @@ -282,7 +264,7 @@ fn supported_query_result_element_to_identity_public_key_id_and_object_pair( } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for SingleIdentityPublicKeyOutcome { fn try_from_path_key_optional( value: Vec, @@ -336,7 +318,7 @@ impl IdentityPublicKeyResult for SingleIdentityPublicKeyOutcome { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for OptionalSingleIdentityPublicKeyOutcome { fn try_from_path_key_optional( value: Vec, @@ -386,7 +368,7 @@ impl IdentityPublicKeyResult for OptionalSingleIdentityPublicKeyOutcome { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for KeyIDHashSet { fn try_from_path_key_optional( value: Vec, @@ -412,7 +394,7 @@ impl IdentityPublicKeyResult for KeyIDHashSet { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for KeyIDVec { fn try_from_path_key_optional( value: Vec, @@ -438,7 +420,7 @@ impl IdentityPublicKeyResult for KeyIDVec { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for KeyVec { fn try_from_path_key_optional( value: Vec, @@ -464,7 +446,7 @@ impl IdentityPublicKeyResult for KeyVec { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for SerializedKeyVec { fn try_from_path_key_optional( value: Vec, @@ -490,7 +472,7 @@ impl IdentityPublicKeyResult for SerializedKeyVec { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for KeyIDIdentityPublicKeyPairVec { fn try_from_path_key_optional( value: Vec, @@ -516,7 +498,7 @@ impl IdentityPublicKeyResult for KeyIDIdentityPublicKeyPairVec { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for KeyIDOptionalIdentityPublicKeyPairVec { fn try_from_path_key_optional( value: Vec, @@ -538,7 +520,7 @@ impl IdentityPublicKeyResult for KeyIDOptionalIdentityPublicKeyPairVec { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for QueryKeyPathOptionalIdentityPublicKeyTrioVec { fn try_from_path_key_optional( value: Vec, @@ -568,7 +550,7 @@ impl IdentityPublicKeyResult for QueryKeyPathOptionalIdentityPublicKeyTrioVec { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for KeyIDIdentityPublicKeyPairBTreeMap { fn try_from_path_key_optional( value: Vec, @@ -594,7 +576,7 @@ impl IdentityPublicKeyResult for KeyIDIdentityPublicKeyPairBTreeMap { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for KeyIDOptionalIdentityPublicKeyPairBTreeMap { fn try_from_path_key_optional( value: Vec, @@ -616,7 +598,7 @@ impl IdentityPublicKeyResult for KeyIDOptionalIdentityPublicKeyPairBTreeMap { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityPublicKeyResult for QueryKeyPathOptionalIdentityPublicKeyTrioBTreeMap { fn try_from_path_key_optional( value: Vec, @@ -646,7 +628,7 @@ impl IdentityPublicKeyResult for QueryKeyPathOptionalIdentityPublicKeyTrioBTreeM } } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// A request to get Keys from an Identity #[derive(Clone)] pub struct IdentityKeysRequest { @@ -661,20 +643,27 @@ pub struct IdentityKeysRequest { } impl IdentityKeysRequest { - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Gets the processing cost of an identity keys request - pub fn processing_cost(&self, epoch: &Epoch) -> Result { + pub fn processing_cost(&self, platform_version: &PlatformVersion) -> Result { match &self.request_type { AllKeys => Err(Error::Fee(FeeError::OperationNotAllowed( "You can not get costs for requesting all keys", ))), SpecificKeys(keys) => Ok(keys.len() as u64 - * epoch.cost_for_known_cost_item(FetchSingleIdentityKeyProcessingCost)), + * platform_version + .fee_version + .processing + .fetch_single_identity_key_processing_cost), SearchKey(_search) => todo!(), ContractBoundKey(_, _, key_kind) | ContractDocumentTypeBoundKey(_, _, _, key_kind) => { match key_kind { CurrentKeyOfKindRequest => { - Ok(epoch.cost_for_known_cost_item(FetchSingleIdentityKeyProcessingCost)) + // not accessible + Ok(platform_version + .fee_version + .processing + .fetch_single_identity_key_processing_cost) } AllKeysOfKindRequest => Err(Error::Fee(FeeError::OperationNotAllowed( "You can not get costs for an all keys of kind request", @@ -684,7 +673,7 @@ impl IdentityKeysRequest { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Make a request for all current keys for the identity pub fn new_all_current_keys_query(identity_id: [u8; 32]) -> Self { let mut sec_btree_map = BTreeMap::new(); @@ -703,7 +692,7 @@ impl IdentityKeysRequest { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Make a request for an encryption key for a specific contract pub fn new_contract_encryption_keys_query( identity_id: [u8; 32], @@ -721,7 +710,7 @@ impl IdentityKeysRequest { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Make a request for an decryption key for a specific contract pub fn new_contract_decryption_keys_query( identity_id: [u8; 32], @@ -739,7 +728,7 @@ impl IdentityKeysRequest { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Make a request for an encryption key for a specific contract document type pub fn new_document_type_encryption_keys_query( identity_id: [u8; 32], @@ -759,7 +748,7 @@ impl IdentityKeysRequest { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Make a request for an decryption key for a specific contract document type pub fn new_document_type_decryption_keys_query( identity_id: [u8; 32], @@ -779,7 +768,7 @@ impl IdentityKeysRequest { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Make a request for all current keys for the identity pub fn new_all_keys_query(identity_id: &[u8; 32], limit: Option) -> Self { IdentityKeysRequest { @@ -790,7 +779,7 @@ impl IdentityKeysRequest { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Make a request for specific keys for the identity pub fn new_specific_keys_query(identity_id: &[u8; 32], key_ids: Vec) -> Self { let limit = key_ids.len() as u16; @@ -802,7 +791,7 @@ impl IdentityKeysRequest { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Make a request for specific keys for the identity pub fn new_specific_keys_query_without_limit( identity_id: &[u8; 32], @@ -816,7 +805,7 @@ impl IdentityKeysRequest { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Make a request for a specific key for the identity without a limit /// Not have a limit is needed if you want to merge path queries pub fn new_specific_key_query_without_limit(identity_id: &[u8; 32], key_id: KeyID) -> Self { @@ -828,7 +817,7 @@ impl IdentityKeysRequest { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Make a request for a specific key for the identity pub fn new_specific_key_query(identity_id: &[u8; 32], key_id: KeyID) -> Self { IdentityKeysRequest { @@ -839,7 +828,7 @@ impl IdentityKeysRequest { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Create the path query for the request pub fn into_path_query(self) -> PathQuery { let IdentityKeysRequest { @@ -868,7 +857,7 @@ impl IdentityKeysRequest { query: SizedQuery { query: Self::specific_keys_query(key_ids), limit, - offset, + offset: None, }, } } @@ -941,7 +930,7 @@ impl IdentityKeysRequest { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// All keys fn all_keys_query() -> Query { let mut query = Query::new(); @@ -949,7 +938,7 @@ impl IdentityKeysRequest { query } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Fetch a specific key knowing the id fn specific_keys_query(key_ids: Vec) -> Query { let mut query = Query::new(); @@ -959,7 +948,7 @@ impl IdentityKeysRequest { query } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Construct the query for the request fn construct_search_query( key_requests: BTreeMap>, @@ -1003,14 +992,13 @@ impl IdentityKeysRequest { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { - use crate::tests::helpers::setup::setup_drive; + use crate::util::test_helpers::setup::setup_drive; use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::Identity; - use dpp::version::drive_versions::DriveVersion; use super::*; @@ -1053,7 +1041,6 @@ mod tests { #[test] fn test_fetch_single_identity_key() { let drive = setup_drive(None); - let _drive_version = DriveVersion::latest(); let transaction = drive.grove.start_transaction(); @@ -1094,7 +1081,6 @@ mod tests { #[test] fn test_fetch_multiple_identity_key() { let drive = setup_drive(None); - let _drive_version = DriveVersion::latest(); let transaction = drive.grove.start_transaction(); @@ -1135,7 +1121,6 @@ mod tests { #[test] fn test_fetch_unknown_identity_key_returns_not_found() { let drive = setup_drive(None); - let _drive_version = DriveVersion::latest(); let transaction = drive.grove.start_transaction(); diff --git a/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/mod.rs index 07212bbf68c..d113438d6e1 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::block::epoch::Epoch; diff --git a/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/v0/mod.rs index b17b44f5a0d..766bb770e82 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/create_key_tree_with_keys/v0/mod.rs @@ -2,7 +2,7 @@ use crate::drive::identity::identity_path; use crate::drive::identity::IdentityRootStructure::{IdentityTreeKeyReferences, IdentityTreeKeys}; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::IdentityPublicKey; diff --git a/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/mod.rs index 9ee13b1a51c..dde4f4d05e3 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/v0/mod.rs index e3f720f2e65..0e5c38f85cd 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/create_new_identity_key_query_trees/v0/mod.rs @@ -1,10 +1,10 @@ use crate::drive::identity::{ identity_query_keys_purpose_tree_path, identity_query_keys_tree_path, }; -use crate::drive::object_size_info::DriveKeyInfo; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DriveKeyInfo; use dpp::identity::{Purpose, SecurityLevel}; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; @@ -33,8 +33,9 @@ impl Drive { )?; } - // There are 4 Purposes: Authentication, Encryption, Decryption, Withdrawal - for purpose in Purpose::authentication_withdraw() { + // There are 5 Purposes: Authentication, Encryption, Decryption, Transfer and Voting + // Searchable purposes are Authentication, Transfer and Voting + for purpose in Purpose::searchable_purposes() { self.batch_insert_empty_tree( identity_query_key_tree, DriveKeyInfo::Key(vec![purpose as u8]), diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/mod.rs index 5dd90d4b8a2..ea1402b00a1 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs index 95c523c67c2..8ae39f8b345 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs @@ -1,14 +1,16 @@ -use crate::drive::flags::SINGLE_EPOCH_FLAGS_SIZE; -use crate::drive::grove_operations::BatchInsertTreeApplyType; use crate::drive::identity::{ - identity_key_location_within_identity_vec, identity_query_keys_full_tree_path, + identity_key_location_within_identity_vec, + identity_query_keys_for_authentication_full_tree_path, + identity_query_keys_for_direct_searchable_reference_full_tree_path, identity_query_keys_purpose_tree_path, }; -use crate::drive::object_size_info::PathKeyElementInfo::PathFixedSizeKeyRefElement; -use crate::drive::object_size_info::PathKeyInfo::PathFixedSizeKey; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::PathKeyElementInfo::PathFixedSizeKeyRefElement; +use crate::util::object_size_info::PathKeyInfo::PathFixedSizeKey; +use crate::util::storage_flags::SINGLE_EPOCH_FLAGS_SIZE; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::{IdentityPublicKey, Purpose, SecurityLevel}; use dpp::version::drive_versions::DriveVersion; @@ -63,54 +65,80 @@ impl Drive { // Now lets add in references so we can query keys. // We assume the following, the identity already has a the basic Query Tree - if !(purpose == Purpose::AUTHENTICATION && security_level == SecurityLevel::MEDIUM) { - // Not Medium (Medium is already pre-inserted) + match purpose { + Purpose::AUTHENTICATION => { + if security_level != SecurityLevel::MEDIUM { + // Not Medium (Medium is already pre-inserted) - let purpose_path = identity_query_keys_purpose_tree_path( - identity_id.as_slice(), - purpose_vec.as_slice(), - ); + let purpose_path = identity_query_keys_purpose_tree_path( + identity_id.as_slice(), + purpose_vec.as_slice(), + ); - let apply_type = if estimated_costs_only_with_layer_info.is_none() { - BatchInsertTreeApplyType::StatefulBatchInsertTree - } else { - BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, - flags_len: SINGLE_EPOCH_FLAGS_SIZE, - } - }; + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: false, + flags_len: SINGLE_EPOCH_FLAGS_SIZE, + } + }; - // We need to insert the security level if it doesn't yet exist - self.batch_insert_empty_tree_if_not_exists_check_existing_operations( - PathFixedSizeKey((purpose_path, vec![security_level as u8])), - None, - apply_type, - transaction, - drive_operations, - drive_version, - )?; - } + // We need to insert the security level if it doesn't yet exist + self.batch_insert_empty_tree_if_not_exists_check_existing_operations( + PathFixedSizeKey((purpose_path, vec![security_level as u8])), + false, + None, + apply_type, + transaction, + drive_operations, + drive_version, + )?; + } - // Now let's set the reference - let reference_path = identity_query_keys_full_tree_path( - identity_id.as_slice(), - purpose_vec.as_slice(), - security_level_vec.as_slice(), - ); + // Now let's set the reference + let reference_path = identity_query_keys_for_authentication_full_tree_path( + identity_id.as_slice(), + security_level_vec.as_slice(), + ); - let key_reference = identity_key_location_within_identity_vec(key_id_bytes); - self.batch_insert( - PathFixedSizeKeyRefElement(( - reference_path, - key_id_bytes, - Element::new_reference_with_flags( - ReferencePathType::UpstreamRootHeightReference(2, key_reference), - None, - ), - )), - drive_operations, - drive_version, - ) + let key_reference = identity_key_location_within_identity_vec(key_id_bytes); + self.batch_insert( + PathFixedSizeKeyRefElement(( + reference_path, + key_id_bytes, + Element::new_reference_with_flags( + ReferencePathType::UpstreamRootHeightReference(2, key_reference), + None, + ), + )), + drive_operations, + drive_version, + ) + } + Purpose::TRANSFER | Purpose::VOTING => { + // Now let's set the reference + let reference_path = + identity_query_keys_for_direct_searchable_reference_full_tree_path( + purpose, + identity_id.as_slice(), + ); + let key_reference = identity_key_location_within_identity_vec(key_id_bytes); + self.batch_insert( + PathFixedSizeKeyRefElement(( + reference_path, + key_id_bytes, + Element::new_reference_with_flags( + ReferencePathType::UpstreamRootHeightReference(2, key_reference), + None, + ), + )), + drive_operations, + drive_version, + ) + } + _ => Ok(()), + } } } diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/mod.rs index bd56e6a67e3..75d422e38d0 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/mod.rs @@ -3,10 +3,8 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; - -use dpp::version::drive_versions::DriveVersion; use platform_version::version::PlatformVersion; impl Drive { diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/v0/mod.rs index 4feb42f4b51..6aee46d0714 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_key_to_storage/v0/mod.rs @@ -1,8 +1,8 @@ use crate::drive::identity::identity_key_tree_path; -use crate::drive::object_size_info::PathKeyElementInfo::PathFixedSizeKeyRefElement; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo::PathFixedSizeKeyRefElement; use dpp::identity::IdentityPublicKey; use dpp::serialization::PlatformSerializable; use grovedb::Element; @@ -10,6 +10,7 @@ use platform_version::version::PlatformVersion; impl Drive { /// Generates a vector of operations for inserting key to storage. + #[inline(always)] pub(super) fn insert_key_to_storage_operations_v0( &self, identity_id: [u8; 32], diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/mod.rs index 4b4123e4a0a..31402c9e28b 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/mod.rs @@ -3,9 +3,9 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; -use dpp::version::drive_versions::DriveVersion; + use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/v0/mod.rs index 95e2869bd11..9046e151ece 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_new_non_unique_key/v0/mod.rs @@ -1,10 +1,10 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::{IdentityPublicKey, Purpose}; -use dpp::version::drive_versions::DriveVersion; + use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use integer_encoding::VarInt; @@ -12,7 +12,7 @@ use platform_version::version::PlatformVersion; use std::collections::HashMap; impl Drive { - /// Insert a new non unique key into an identity operations + /// Insert a new non-unique key into an identity operations pub(super) fn insert_new_non_unique_key_operations_v0( &self, identity_id: [u8; 32], @@ -63,7 +63,7 @@ impl Drive { if with_searchable_inner_references && matches!( identity_key.purpose(), - Purpose::AUTHENTICATION | Purpose::WITHDRAW + Purpose::AUTHENTICATION | Purpose::TRANSFER | Purpose::VOTING ) { self.insert_key_searchable_references_operations( diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/mod.rs index 3bbf64178e2..26b6a2ea1d7 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/mod.rs @@ -3,9 +3,9 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; -use dpp::version::drive_versions::DriveVersion; + use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/v0/mod.rs index 20933bde0c1..ad12a17b3cc 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_new_unique_key/v0/mod.rs @@ -1,10 +1,10 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::epoch::Epoch; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::{IdentityPublicKey, Purpose}; -use dpp::version::drive_versions::DriveVersion; + use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use integer_encoding::VarInt; @@ -13,6 +13,7 @@ use std::collections::HashMap; impl Drive { /// Insert a new key into an identity operations + #[inline(always)] pub(super) fn insert_new_unique_key_operations_v0( &self, identity_id: [u8; 32], @@ -58,7 +59,7 @@ impl Drive { if with_searchable_inner_references && matches!( identity_key.purpose(), - Purpose::AUTHENTICATION | Purpose::WITHDRAW + Purpose::AUTHENTICATION | Purpose::TRANSFER | Purpose::VOTING ) { self.insert_key_searchable_references_operations( diff --git a/packages/rs-drive/src/drive/identity/key/insert/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/mod.rs index d22e3ab2d29..e6d1fbe1ba8 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/mod.rs @@ -9,6 +9,9 @@ mod replace_key_in_storage; use dpp::identity::IdentityPublicKey; /// The contract apply info +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub enum DataContractApplyInfo { /// Keys of the contract apply info Keys(Vec), diff --git a/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/mod.rs index 6e3df538727..928956a6658 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::version::drive_versions::DriveVersion; diff --git a/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/v0/mod.rs index 14ed2e33eec..145a3fb0d7d 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/replace_key_in_storage/v0/mod.rs @@ -1,7 +1,7 @@ use crate::drive::identity::identity_key_tree_path_vec; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::serialization::PlatformSerializable; use grovedb::Element; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs index 5026c5a073d..355d05f34ba 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs @@ -1,11 +1,10 @@ -use crate::drive::defaults::{ - DEFAULT_HASH_160_SIZE_U8, DEFAULT_HASH_SIZE_U8, ESTIMATED_NON_UNIQUE_KEY_DUPLICATES, -}; +use crate::drive::constants::ESTIMATED_NON_UNIQUE_KEY_DUPLICATES; use crate::drive::{ non_unique_key_hashes_sub_tree_path_vec, non_unique_key_hashes_tree_path_vec, Drive, }; +use crate::util::type_constants::{DEFAULT_HASH_160_SIZE_U8, DEFAULT_HASH_SIZE_U8}; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerInformation; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs index 637b39938eb..80a35c46def 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs @@ -1,11 +1,10 @@ -use crate::drive::defaults::{DEFAULT_HASH_160_SIZE_U8, DEFAULT_HASH_SIZE_U32}; - use crate::drive::{unique_key_hashes_tree_path_vec, Drive}; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; use grovedb::EstimatedLayerSizes::AllItems; +use crate::util::type_constants::{DEFAULT_HASH_160_SIZE_U8, DEFAULT_HASH_SIZE_U32}; use grovedb::EstimatedLayerInformation; use std::collections::HashMap; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/mod.rs index 76b16830c1e..99dd457ccff 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/mod.rs @@ -5,7 +5,7 @@ use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/v0/mod.rs index 414fe86d8c2..9bfbac8ff16 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_non_unique_public_key_hash_reference_to_identity/v0/mod.rs @@ -1,5 +1,5 @@ -use crate::drive::object_size_info::DriveKeyInfo::KeyRef; -use crate::drive::object_size_info::PathKeyElementInfo::PathKeyRefElement; +use crate::util::object_size_info::DriveKeyInfo::KeyRef; +use crate::util::object_size_info::PathKeyElementInfo::PathKeyRefElement; use crate::drive::{ non_unique_key_hashes_sub_tree_path_vec, non_unique_key_hashes_tree_path, Drive, @@ -8,7 +8,7 @@ use crate::drive::{ use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/mod.rs index 1370140ab01..e2a2b933783 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/mod.rs @@ -5,7 +5,7 @@ use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/v0/mod.rs index 9f7301d33c7..174f1574bc2 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_non_unique_key/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation::FunctionOperation; -use crate::fee::op::{FunctionOp, HashFunction, LowLevelDriveOperation}; +use crate::fees::op::LowLevelDriveOperation::FunctionOperation; +use crate::fees::op::{FunctionOp, HashFunction, LowLevelDriveOperation}; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::identity_public_key::methods::hash::IdentityPublicKeyHashMethodsV0; use dpp::identity::IdentityPublicKey; @@ -28,7 +28,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result, Error> { let mut drive_operations = vec![]; - let hash_vec = identity_key.hash()?; + let hash_vec = identity_key.public_key_hash()?; let key_hash = hash_vec.as_slice().try_into().map_err(|_| { Error::Drive(DriveError::CorruptedCodeExecution("key hash not 20 bytes")) })?; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/mod.rs index c91733a8f21..9535b3ec088 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/mod.rs @@ -5,7 +5,7 @@ use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/v0/mod.rs index b7981f71dae..924f5a429e1 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_reference_to_unique_key/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation::FunctionOperation; -use crate::fee::op::{FunctionOp, HashFunction, LowLevelDriveOperation}; +use crate::fees::op::LowLevelDriveOperation::FunctionOperation; +use crate::fees::op::{FunctionOp, HashFunction, LowLevelDriveOperation}; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::identity_public_key::methods::hash::IdentityPublicKeyHashMethodsV0; use dpp::identity::IdentityPublicKey; @@ -28,7 +28,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result, Error> { let mut drive_operations = vec![]; - let hash_vec = identity_key.hash()?; + let hash_vec = identity_key.public_key_hash()?; let key_hash = hash_vec.as_slice().try_into().map_err(|_| { Error::Drive(DriveError::CorruptedCodeExecution("key hash not 20 bytes")) })?; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/mod.rs index 50489171c0c..4129f4424a6 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/mod.rs @@ -5,7 +5,7 @@ use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/v0/mod.rs index d7d1920a7bf..e498eb6c194 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/insert_unique_public_key_hash_reference_to_identity/v0/mod.rs @@ -1,11 +1,11 @@ -use crate::drive::object_size_info::PathKeyElementInfo::PathKeyRefElement; +use crate::util::object_size_info::PathKeyElementInfo::PathKeyRefElement; use crate::drive::{unique_key_hashes_tree_path_vec, Drive}; use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/identity/key/mod.rs b/packages/rs-drive/src/drive/identity/key/mod.rs index 255fff2d69a..b20ba03fdf9 100644 --- a/packages/rs-drive/src/drive/identity/key/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/mod.rs @@ -1,13 +1,13 @@ -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// Fetching of Identity Keys pub mod fetch; -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) mod insert; -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) mod insert_key_hash_identity_reference; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Prove module pub mod prove; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// Queries module pub mod queries; diff --git a/packages/rs-drive/src/drive/identity/key/prove/prove_identities_all_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/prove/prove_identities_all_keys/v0/mod.rs index 97e250f7f21..4802df1e5fd 100644 --- a/packages/rs-drive/src/drive/identity/key/prove/prove_identities_all_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/prove/prove_identities_all_keys/v0/mod.rs @@ -27,6 +27,7 @@ impl Drive { /// # Errors /// /// This function returns an error if the path query generation or proof generation fails. + #[inline(always)] pub(super) fn prove_identities_all_keys_v0( &self, identity_ids: &[[u8; 32]], @@ -34,13 +35,12 @@ impl Drive { transaction: TransactionArg, drive_version: &DriveVersion, ) -> Result, Error> { - let identity_query = Self::fetch_identities_all_keys_query(self, identity_ids, limit)?; - self.grove_get_proved_path_query( - &identity_query, - false, - transaction, - &mut vec![], - drive_version, - ) + let identity_query = Self::fetch_identities_all_keys_query( + self, + identity_ids, + limit, + &drive_version.grove_version, + )?; + self.grove_get_proved_path_query(&identity_query, transaction, &mut vec![], drive_version) } } diff --git a/packages/rs-drive/src/drive/identity/key/prove/prove_identity_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/prove/prove_identity_keys/v0/mod.rs index 4916db7bfa9..e3b213f2182 100644 --- a/packages/rs-drive/src/drive/identity/key/prove/prove_identity_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/prove/prove_identity_keys/v0/mod.rs @@ -24,6 +24,7 @@ impl Drive { /// proof is successfully generated. /// * `Err(Error)` - An error if the proof cannot be generated. /// + #[inline(always)] pub(super) fn prove_identity_keys_v0( &self, key_request: IdentityKeysRequest, @@ -33,7 +34,6 @@ impl Drive { let identity_query = key_request.into_path_query(); self.grove_get_proved_path_query( &identity_query, - false, transaction, &mut vec![], &platform_version.drive, diff --git a/packages/rs-drive/src/drive/identity/key/queries.rs b/packages/rs-drive/src/drive/identity/key/queries.rs index 16afb7488ff..b82d32a35c0 100644 --- a/packages/rs-drive/src/drive/identity/key/queries.rs +++ b/packages/rs-drive/src/drive/identity/key/queries.rs @@ -3,6 +3,7 @@ use crate::drive::Drive; use crate::error::Error; use crate::error::Error::GroveDB; use grovedb::PathQuery; +use grovedb_version::version::GroveVersion; impl Drive { /// Fetches the path queries for all keys associated with the specified identities. @@ -30,6 +31,7 @@ impl Drive { &self, identity_ids: &[[u8; 32]], limit: Option, + grove_version: &GroveVersion, ) -> Result { let path_queries = identity_ids .iter() @@ -39,6 +41,6 @@ impl Drive { }) .collect::>(); - PathQuery::merge(path_queries.iter().collect()).map_err(GroveDB) + PathQuery::merge(path_queries.iter().collect(), grove_version).map_err(GroveDB) } } diff --git a/packages/rs-drive/src/drive/identity/mod.rs b/packages/rs-drive/src/drive/identity/mod.rs index c40f1b92785..65928b5ecbf 100644 --- a/packages/rs-drive/src/drive/identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/mod.rs @@ -1,86 +1,59 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! This module defines functions within the Drive struct related to identities. //! Functions include inserting new identities into the `Identities` subtree and //! fetching identities from the subtree. //! -#[cfg(feature = "full")] -use crate::drive::object_size_info::DriveKeyInfo; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] use crate::drive::RootTree; +#[cfg(feature = "server")] +use crate::util::object_size_info::DriveKeyInfo; +use std::fmt; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::identity::{KeyID, Purpose, SecurityLevel}; +#[cfg(any(feature = "server", feature = "verify"))] +use dpp::identity::Purpose; +#[cfg(feature = "server")] +use dpp::identity::{KeyID, SecurityLevel}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Everything related to withdrawals pub mod withdrawals; -use dpp::identity::KeyType; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::identity::Purpose::AUTHENTICATION; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use integer_encoding::VarInt; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] mod balance; -#[cfg(feature = "full")] -mod contract_info; -#[cfg(feature = "full")] +#[cfg(any(feature = "server", feature = "verify"))] +pub(crate) mod contract_info; +#[cfg(feature = "server")] mod estimation_costs; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] mod fetch; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod insert; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// Module related to Identity Keys pub mod key; /// Module related to updating of identity -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub mod update; -#[cfg(feature = "full")] -pub use withdrawals::paths::add_initial_withdrawal_state_structure_operations; - -#[cfg(any(feature = "full", feature = "verify"))] +use crate::drive::identity::contract_info::ContractInfoStructure; +use crate::error::drive::DriveError; +use crate::error::Error; +#[cfg(any(feature = "server", feature = "verify"))] pub use fetch::queries::*; /// Identity path -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) fn identity_path(identity_id: &[u8]) -> [&[u8]; 2] { [Into::<&[u8; 1]>::into(RootTree::Identities), identity_id] } /// Identity path vector -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) fn identity_path_vec(identity_id: &[u8]) -> Vec> { vec![ Into::<&[u8; 1]>::into(RootTree::Identities).to_vec(), @@ -88,7 +61,7 @@ pub(crate) fn identity_path_vec(identity_id: &[u8]) -> Vec> { ] } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// The path for the contract info for an identity pub fn identity_contract_info_root_path(identity_id: &[u8; 32]) -> [&[u8]; 3] { [ @@ -98,7 +71,7 @@ pub fn identity_contract_info_root_path(identity_id: &[u8; 32]) -> [&[u8]; 3] { ] } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// The path for the contract info for an identity as a vec pub fn identity_contract_info_root_path_vec(identity_id: &[u8; 32]) -> Vec> { vec![ @@ -108,6 +81,19 @@ pub fn identity_contract_info_root_path_vec(identity_id: &[u8; 32]) -> Vec( + identity_id: &'a [u8; 32], + group_id: &'a [u8], +) -> [&'a [u8]; 4] { + [ + Into::<&[u8; 1]>::into(RootTree::Identities), + identity_id, + Into::<&[u8; 1]>::into(IdentityRootStructure::IdentityContractInfo), + group_id, + ] +} + /// The group is either a contract id or on a family of contracts owned by the same identity pub fn identity_contract_info_group_path_vec( identity_id: &[u8; 32], @@ -122,7 +108,21 @@ pub fn identity_contract_info_group_path_vec( } /// The group is either a contract id or on a family of contracts owned by the same identity -#[cfg(any(feature = "full", feature = "verify"))] +pub fn identity_contract_info_group_keys_path_vec( + identity_id: &[u8; 32], + group_id: &[u8], +) -> Vec> { + vec![ + vec![RootTree::Identities as u8], + identity_id.to_vec(), + vec![IdentityRootStructure::IdentityContractInfo as u8], + group_id.to_vec(), + vec![ContractInfoStructure::ContractInfoKeysKey as u8], + ] +} + +/// The group is either a contract id or on a family of contracts owned by the same identity +#[cfg(any(feature = "server", feature = "verify"))] pub fn identity_contract_info_group_path_key_purpose_vec( identity_id: &[u8; 32], group_id: &[u8], @@ -133,11 +133,12 @@ pub fn identity_contract_info_group_path_key_purpose_vec( identity_id.to_vec(), vec![IdentityRootStructure::IdentityContractInfo as u8], group_id.to_vec(), + vec![ContractInfoStructure::ContractInfoKeysKey as u8], vec![key_purpose as u8], ] } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// The path for a specific contract info for an identity pub fn identity_contract_info_path<'a>( identity_id: &'a [u8], @@ -151,7 +152,7 @@ pub fn identity_contract_info_path<'a>( ] } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// The path for a specific contract info for an identity as a vec pub fn identity_contract_info_path_vec(identity_id: &[u8], contract_id: &[u8]) -> Vec> { vec![ @@ -163,7 +164,7 @@ pub fn identity_contract_info_path_vec(identity_id: &[u8], contract_id: &[u8]) - } /// identity key tree path -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// Identity key tree path pub(crate) fn identity_key_tree_path(identity_id: &[u8]) -> [&[u8]; 3] { [ @@ -173,7 +174,7 @@ pub(crate) fn identity_key_tree_path(identity_id: &[u8]) -> [&[u8]; 3] { ] } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// The path for all identity keys as a vec pub fn identity_key_tree_path_vec(identity_id: &[u8]) -> Vec> { vec![ @@ -183,7 +184,7 @@ pub fn identity_key_tree_path_vec(identity_id: &[u8]) -> Vec> { ] } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// The path for a specific key as a vec pub fn identity_key_path_vec(identity_id: &[u8], key_id: KeyID) -> Vec> { vec![ @@ -195,7 +196,7 @@ pub fn identity_key_path_vec(identity_id: &[u8], key_id: KeyID) -> Vec> } /// identity key location within identity vec -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Identity key location within identity vector pub(crate) fn identity_key_location_within_identity_vec(encoded_key_id: &[u8]) -> Vec> { vec![ @@ -205,7 +206,7 @@ pub(crate) fn identity_key_location_within_identity_vec(encoded_key_id: &[u8]) - } /// identity query keys tree path -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Identity query keys tree path pub(crate) fn identity_query_keys_tree_path(identity_id: &[u8]) -> [&[u8]; 3] { [ @@ -216,7 +217,7 @@ pub(crate) fn identity_query_keys_tree_path(identity_id: &[u8]) -> [&[u8]; 3] { } /// identity query keys tree path vec -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// Identity query keys tree path vector pub(crate) fn identity_query_keys_tree_path_vec(identity_id: [u8; 32]) -> Vec> { vec![ @@ -227,7 +228,7 @@ pub(crate) fn identity_query_keys_tree_path_vec(identity_id: [u8; 32]) -> Vec( identity_id: &'a [u8], @@ -242,7 +243,7 @@ pub(crate) fn identity_query_keys_purpose_tree_path<'a>( } /// identity query keys purpose tree path vec -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Identity query keys purpose tree path vec pub(crate) fn identity_query_keys_purpose_tree_path_vec( identity_id: &[u8], @@ -257,7 +258,7 @@ pub(crate) fn identity_query_keys_purpose_tree_path_vec( } /// identity query keys security level tree path vec -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Identity query keys security level tree path vec pub(crate) fn identity_query_keys_security_level_tree_path_vec( identity_id: &[u8], @@ -273,69 +274,120 @@ pub(crate) fn identity_query_keys_security_level_tree_path_vec( } /// identity query keys full tree path -#[cfg(feature = "full")] +#[cfg(feature = "server")] +/// Identity query keys full tree path +pub(crate) fn identity_query_keys_for_direct_searchable_reference_full_tree_path( + purpose: Purpose, + identity_id: &[u8], +) -> [&[u8]; 4] { + [ + Into::<&[u8; 1]>::into(RootTree::Identities), + identity_id, + Into::<&[u8; 1]>::into(IdentityRootStructure::IdentityTreeKeyReferences), + Into::<&[u8; 1]>::into(purpose), + ] +} + +/// identity query keys full tree path +#[cfg(feature = "server")] /// Identity query keys full tree path -pub(crate) fn identity_query_keys_full_tree_path<'a>( +pub(crate) fn identity_query_keys_for_authentication_full_tree_path<'a>( identity_id: &'a [u8], - purpose: &'a [u8], security_level: &'a [u8], ) -> [&'a [u8]; 5] { [ Into::<&[u8; 1]>::into(RootTree::Identities), identity_id, Into::<&[u8; 1]>::into(IdentityRootStructure::IdentityTreeKeyReferences), - purpose, + Into::<&[u8; 1]>::into(Purpose::AUTHENTICATION), security_level, ] } /// The root structure of identities -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] #[repr(u8)] #[derive(Copy, Clone)] pub enum IdentityRootStructure { - /// The revision of identity data - IdentityTreeRevision = 0, + /// The revision of the identity + IdentityTreeRevision = 192, + /// The nonce of the identity, it is used to prevent replay attacks + IdentityTreeNonce = 64, /// The keys that an identity has - IdentityTreeKeys = 1, + IdentityTreeKeys = 128, /// A Way to search for specific keys - IdentityTreeKeyReferences = 2, + IdentityTreeKeyReferences = 160, /// Owed processing fees - IdentityTreeNegativeCredit = 3, + IdentityTreeNegativeCredit = 96, /// Identity contract information - IdentityContractInfo = 4, + IdentityContractInfo = 32, +} + +#[cfg(any(feature = "server", feature = "verify"))] +impl fmt::Display for IdentityRootStructure { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let variant_name = match self { + IdentityRootStructure::IdentityTreeRevision => "Revision", + IdentityRootStructure::IdentityTreeNonce => "Nonce", + IdentityRootStructure::IdentityTreeKeys => "IdentityKeys", + IdentityRootStructure::IdentityTreeKeyReferences => "IdentityKeyReferences", + IdentityRootStructure::IdentityTreeNegativeCredit => "NegativeCredit", + IdentityRootStructure::IdentityContractInfo => "ContractInfo", + }; + write!(f, "{}", variant_name) + } +} + +#[cfg(any(feature = "server", feature = "verify"))] +impl TryFrom for IdentityRootStructure { + type Error = Error; + + fn try_from(value: u8) -> Result { + match value { + 192 => Ok(IdentityRootStructure::IdentityTreeRevision), + 64 => Ok(IdentityRootStructure::IdentityTreeNonce), + 128 => Ok(IdentityRootStructure::IdentityTreeKeys), + 160 => Ok(IdentityRootStructure::IdentityTreeKeyReferences), + 96 => Ok(IdentityRootStructure::IdentityTreeNegativeCredit), + 32 => Ok(IdentityRootStructure::IdentityContractInfo), + _ => Err(Error::Drive(DriveError::NotSupported( + "unknown identity root structure tree item", + ))), + } + } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl IdentityRootStructure { fn to_drive_key_info<'a>(self) -> DriveKeyInfo<'a> { DriveKeyInfo::Key(vec![self as u8]) } } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] impl From for u8 { fn from(root_tree: IdentityRootStructure) -> Self { root_tree as u8 } } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] impl From for [u8; 1] { fn from(root_tree: IdentityRootStructure) -> Self { [root_tree as u8] } } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] impl From for &'static [u8; 1] { fn from(identity_tree: IdentityRootStructure) -> Self { match identity_tree { - IdentityRootStructure::IdentityTreeRevision => &[0], - IdentityRootStructure::IdentityTreeKeys => &[1], - IdentityRootStructure::IdentityTreeKeyReferences => &[2], - IdentityRootStructure::IdentityTreeNegativeCredit => &[3], - IdentityRootStructure::IdentityContractInfo => &[4], + IdentityRootStructure::IdentityTreeRevision => &[192], + IdentityRootStructure::IdentityTreeNonce => &[64], + IdentityRootStructure::IdentityTreeKeys => &[128], + IdentityRootStructure::IdentityTreeKeyReferences => &[160], + IdentityRootStructure::IdentityTreeNegativeCredit => &[96], + IdentityRootStructure::IdentityContractInfo => &[32], } } } diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/mod.rs index e1369f2bdab..25234b095e6 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::block::epoch::Epoch; diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/v0/mod.rs index f33d3b5f09a..95d766d83fd 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_new_keys_to_identity/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::IdentityPublicKey; use dpp::block::epoch::Epoch; @@ -12,7 +12,8 @@ use std::collections::HashMap; impl Drive { /// The operations for adding new keys to an identity /// This should not be called for adding new keys to a masternode - pub fn add_new_keys_to_identity_operations_v0( + #[inline(always)] + pub(super) fn add_new_keys_to_identity_operations_v0( &self, identity_id: [u8; 32], unique_keys_to_add: Vec, diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_new_non_unique_keys_to_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_new_non_unique_keys_to_identity/v0/mod.rs index 3b3cd55a5c2..7b0dae6c4f1 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_new_non_unique_keys_to_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_new_non_unique_keys_to_identity/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::identity::IdentityPublicKey; @@ -12,7 +12,8 @@ use std::collections::HashMap; impl Drive { /// Add new non unique keys to an identity - pub fn add_new_non_unique_keys_to_identity_v0( + #[inline(always)] + pub(super) fn add_new_non_unique_keys_to_identity_v0( &self, identity_id: [u8; 32], keys_to_add: Vec, @@ -50,6 +51,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_new_unique_keys_to_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_new_unique_keys_to_identity/v0/mod.rs index 15ba0f38986..70de562e499 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_new_unique_keys_to_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_new_unique_keys_to_identity/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::identity::IdentityPublicKey; @@ -12,7 +12,8 @@ use std::collections::HashMap; impl Drive { /// Add new keys to an identity - pub fn add_new_unique_keys_to_identity_v0( + #[inline(always)] + pub(super) fn add_new_unique_keys_to_identity_v0( &self, identity_id: [u8; 32], keys_to_add: Vec, @@ -50,6 +51,7 @@ impl Drive { &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/mod.rs index bddb0cad9bc..aaa3db05935 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/v0/mod.rs index a57614649b3..8876c58ce12 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_to_identity_balance/v0/mod.rs @@ -2,7 +2,7 @@ use crate::drive::identity::update::add_to_previous_balance_outcome::AddToPrevio use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; @@ -14,7 +14,8 @@ use std::collections::HashMap; impl Drive { /// Balances are stored in the balance tree under the identity's id - pub fn add_to_identity_balance_v0( + #[inline(always)] + pub(super) fn add_to_identity_balance_v0( &self, identity_id: [u8; 32], added_balance: Credits, @@ -45,13 +46,13 @@ impl Drive { &mut drive_operations, &platform_version.drive, )?; - let fees = Drive::calculate_fee( None, Some(drive_operations), &block_info.epoch, self.config.epochs_per_era, platform_version, + None, )?; Ok(fees) @@ -59,7 +60,8 @@ impl Drive { /// Balances are stored in the balance tree under the identity's id /// This gets operations based on apply flag (stateful vs stateless) - pub fn add_to_identity_balance_operations_v0( + #[inline(always)] + pub(super) fn add_to_identity_balance_operations_v0( &self, identity_id: [u8; 32], added_balance: Credits, diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/mod.rs index 1a971d23ba1..abdad771903 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/mod.rs @@ -4,7 +4,7 @@ use crate::drive::identity::update::add_to_previous_balance_outcome::AddToPrevio use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::fee::Credits; use dpp::version::PlatformVersion; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/v0/mod.rs index 65bb107d584..9d8dc948f5f 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/add_to_previous_balance/v0/mod.rs @@ -5,7 +5,7 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::balances::credits::MAX_CREDITS; use dpp::fee::Credits; diff --git a/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/mod.rs index 7df89df8b84..ca00accd272 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/mod.rs @@ -5,7 +5,7 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::fee::fee_result::{BalanceChangeForIdentity, FeeResult}; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/v0/mod.rs index 2f705e9e113..6b290a7d70c 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/apply_balance_change_from_fee_to_identity/v0/mod.rs @@ -6,7 +6,7 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::consensus::ConsensusError; use dpp::fee::fee_result::{BalanceChange, BalanceChangeForIdentity, FeeResult}; @@ -48,7 +48,8 @@ impl Drive { /// If calculated balance is below 0 it will go to negative balance /// /// Balances are stored in the identity under key 0 - pub fn apply_balance_change_from_fee_to_identity_operations_v0( + #[inline(always)] + pub(super) fn apply_balance_change_from_fee_to_identity_operations_v0( &self, balance_change: BalanceChangeForIdentity, transaction: TransactionArg, @@ -56,8 +57,6 @@ impl Drive { ) -> Result<(Vec, FeeResult), Error> { let mut drive_operations = vec![]; - let _drive_version = &platform_version.drive; - if matches!(balance_change.change(), BalanceChange::NoBalanceChange) { return Ok((drive_operations, balance_change.into_fee_result())); } diff --git a/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/mod.rs index 4a71a7fb0c5..9305f6c3544 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::identity::KeyID; @@ -13,6 +13,7 @@ use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; +use dpp::block::epoch::Epoch; use std::collections::HashMap; impl Drive { @@ -84,6 +85,7 @@ impl Drive { identity_id: [u8; 32], key_ids: Vec, disable_at: TimestampMillis, + epoch: &Epoch, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, @@ -101,6 +103,7 @@ impl Drive { identity_id, key_ids, disable_at, + epoch, estimated_costs_only_with_layer_info, transaction, platform_version, diff --git a/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/v0/mod.rs index 19247c46010..f1505c71d36 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/disable_identity_keys/v0/mod.rs @@ -3,7 +3,7 @@ use dpp::block::block_info::BlockInfo; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use grovedb::batch::KeyInfoPath; use crate::drive::identity::key::fetch::{ @@ -16,6 +16,7 @@ use dpp::identity::identity_public_key::accessors::v0::{ use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::prelude::TimestampMillis; +use dpp::block::epoch::Epoch; use dpp::version::PlatformVersion; use dpp::ProtocolError; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -44,6 +45,7 @@ impl Drive { identity_id, keys_ids, disable_at, + &block_info.epoch, &mut estimated_costs_only_with_layer_info, transaction, platform_version, @@ -58,13 +60,13 @@ impl Drive { &mut drive_operations, &platform_version.drive, )?; - let fees = Drive::calculate_fee( None, Some(drive_operations), &block_info.epoch, self.config.epochs_per_era, platform_version, + None, // TODO: Does disable mean delete? Check if previous_fee_versions are required in this case )?; Ok(fees) @@ -93,11 +95,13 @@ impl Drive { /// A `Result` containing a vector of `LowLevelDriveOperation` which represents the operations /// performed during the disabling process, or an `Error` if the operation fails. /// - pub fn disable_identity_keys_operations_v0( + #[inline(always)] + pub(super) fn disable_identity_keys_operations_v0( &self, identity_id: [u8; 32], key_ids: Vec, disable_at: TimestampMillis, + epoch: &Epoch, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, @@ -119,6 +123,11 @@ impl Drive { estimated_costs_only_with_layer_info, drive_version, )?; + Self::add_estimation_costs_for_root_key_reference_tree( + identity_id, + estimated_costs_only_with_layer_info, + drive_version, + )?; key_ids .into_iter() .map(|key_id| { @@ -166,6 +175,16 @@ impl Drive { &mut drive_operations, drive_version, )?; + + self.refresh_identity_key_reference_operations( + identity_id, + &key, + epoch, + estimated_costs_only_with_layer_info, + transaction, + &mut drive_operations, + platform_version, + )? } Ok(drive_operations) diff --git a/packages/rs-drive/src/drive/identity/update/methods/merge_identity_nonce/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/merge_identity_nonce/mod.rs new file mode 100644 index 00000000000..006dfe746b6 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/methods/merge_identity_nonce/mod.rs @@ -0,0 +1,128 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; + +use dpp::prelude::IdentityNonce; + +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +use crate::error::identity::IdentityError; +use dpp::identity::identity_nonce::MergeIdentityNonceResult; +use std::collections::HashMap; + +pub(crate) trait MergeIdentityContractNonceResultToResult { + fn to_result(self) -> Result<(), Error>; +} + +impl MergeIdentityContractNonceResultToResult for MergeIdentityNonceResult { + /// Gives a result from the enum + fn to_result(self) -> Result<(), Error> { + if let Some(error_message) = self.error_message() { + Err(Error::Identity(IdentityError::IdentityNonceError( + error_message, + ))) + } else { + Ok(()) + } + } +} + +impl Drive { + /// Updates the nonce for a specific identity. This function is version controlled. + /// + /// # Arguments + /// + /// * `identity_id` - The ID of the Identity whose nonce is to be updated. + /// * `nonce` - The nonce to update to. + /// * `block_info` - The current block information. + /// * `apply` - Whether to apply the change. + /// * `transaction` - The current transaction. + /// * `drive_version` - The drive version. + /// + /// # Returns + /// + /// * `Result` - The resulting fee if successful, or an error. + pub fn merge_identity_nonce( + &self, + identity_id: [u8; 32], + nonce: IdentityNonce, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(MergeIdentityNonceResult, Option), Error> { + match platform_version + .drive + .methods + .identity + .update + .merge_identity_nonce + { + 0 => self.merge_identity_nonce_v0( + identity_id, + nonce, + block_info, + apply, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "merge_identity_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Updates the nonce operation of the identity. This function is version controlled. + /// + /// # Arguments + /// + /// * `identity_id` - The ID of the Identity whose nonce operation is to be updated. + /// * `nonce` - The nonce to update to. + /// * `estimated_costs_only_with_layer_info` - The estimated costs with layer information. + /// + /// # Returns + /// + /// * `LowLevelDriveOperation` - The resulting low level drive operation. + pub fn merge_identity_nonce_operations( + &self, + identity_id: [u8; 32], + nonce: IdentityNonce, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(MergeIdentityNonceResult, Vec), Error> { + match platform_version + .drive + .methods + .identity + .update + .merge_identity_nonce + { + 0 => self.merge_identity_nonce_operations_v0( + identity_id, + nonce, + block_info, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "merge_identity_nonce_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/update/methods/merge_identity_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/merge_identity_nonce/v0/mod.rs new file mode 100644 index 00000000000..14887efb3a1 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/methods/merge_identity_nonce/v0/mod.rs @@ -0,0 +1,74 @@ +use dpp::block::block_info::BlockInfo; + +use crate::drive::Drive; + +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use grovedb::batch::KeyInfoPath; + +use dpp::fee::fee_result::FeeResult; + +use dpp::prelude::IdentityNonce; + +use dpp::version::PlatformVersion; +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +use dpp::identity::identity_nonce::MergeIdentityNonceResult; +use std::collections::HashMap; + +impl Drive { + /// Update nonce for specific identity + #[inline(always)] + pub(super) fn merge_identity_nonce_v0( + &self, + identity_id: [u8; 32], + nonce: IdentityNonce, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(MergeIdentityNonceResult, Option), Error> { + // TODO: In case of dry run we will get less because we replace the same bytes + + let mut estimated_costs_only_with_layer_info = if apply { + None::> + } else { + Some(HashMap::new()) + }; + + let (result, batch_operations) = self.merge_identity_nonce_operations_v0( + identity_id, + nonce, + block_info, + &mut estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + + let mut drive_operations: Vec = vec![]; + + let fees = if result.is_error() { + None + } else { + self.apply_batch_low_level_drive_operations( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + &mut drive_operations, + &platform_version.drive, + )?; + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + + Some(fees) + }; + + Ok((result, fees)) + } +} diff --git a/packages/rs-drive/src/drive/identity/update/methods/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/mod.rs index 0bb1e1e30af..a0145681117 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/mod.rs @@ -5,6 +5,8 @@ mod add_to_identity_balance; mod add_to_previous_balance; mod apply_balance_change_from_fee_to_identity; mod disable_identity_keys; +pub(crate) mod merge_identity_nonce; mod re_enable_identity_keys; +mod refresh_identity_key_reference_operations; mod remove_from_identity_balance; mod update_identity_revision; diff --git a/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/mod.rs index 9dde1d7cdfb..dd89d99f60f 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/mod.rs @@ -3,13 +3,14 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::KeyID; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; +use dpp::block::epoch::Epoch; use std::collections::HashMap; impl Drive { @@ -35,6 +36,7 @@ impl Drive { &self, identity_id: [u8; 32], key_ids: Vec, + epoch: &Epoch, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, @@ -51,6 +53,7 @@ impl Drive { 0 => self.re_enable_identity_keys_operations_v0( identity_id, key_ids, + epoch, estimated_costs_only_with_layer_info, transaction, platform_version, diff --git a/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/v0/mod.rs index b5fe344b47e..1434691be2f 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/re_enable_identity_keys/v0/mod.rs @@ -4,12 +4,13 @@ use crate::drive::identity::key::fetch::{ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::identity::identity_public_key::accessors::v0::{ IdentityPublicKeyGettersV0, IdentityPublicKeySettersV0, }; use dpp::identity::{IdentityPublicKey, KeyID}; +use dpp::block::epoch::Epoch; use dpp::version::PlatformVersion; use dpp::ProtocolError; use grovedb::batch::KeyInfoPath; @@ -40,10 +41,12 @@ impl Drive { /// A `Result` containing a vector of `LowLevelDriveOperation` which represents the operations /// performed during the re-enabling process, or an `Error` if the process fails. /// - pub fn re_enable_identity_keys_operations_v0( + #[inline(always)] + pub(super) fn re_enable_identity_keys_operations_v0( &self, identity_id: [u8; 32], key_ids: Vec, + epoch: &Epoch, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, @@ -111,6 +114,16 @@ impl Drive { &mut drive_operations, drive_version, )?; + + self.refresh_identity_key_reference_operations( + identity_id, + &key, + epoch, + estimated_costs_only_with_layer_info, + transaction, + &mut drive_operations, + platform_version, + )? } Ok(drive_operations) diff --git a/packages/rs-drive/src/drive/identity/update/methods/refresh_identity_key_reference_operations/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/refresh_identity_key_reference_operations/mod.rs new file mode 100644 index 00000000000..cf10dce2368 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/methods/refresh_identity_key_reference_operations/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +use dpp::block::epoch::Epoch; +use dpp::identity::IdentityPublicKey; +use std::collections::HashMap; + +impl Drive { + /// Refreshes the identity key reference + pub fn refresh_identity_key_reference_operations( + &self, + identity_id: [u8; 32], + key: &IdentityPublicKey, + epoch: &Epoch, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .identity + .update + .refresh_identity_key_reference_operations + { + 0 => self.refresh_identity_key_reference_operations_v0( + identity_id, + key, + epoch, + estimated_costs_only_with_layer_info, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "refresh_identity_key_reference_v0".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/update/methods/refresh_identity_key_reference_operations/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/refresh_identity_key_reference_operations/v0/mod.rs new file mode 100644 index 00000000000..9c1a800722a --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/methods/refresh_identity_key_reference_operations/v0/mod.rs @@ -0,0 +1,110 @@ +use crate::drive::identity::{ + identity_key_location_within_identity_vec, identity_query_keys_purpose_tree_path_vec, + identity_query_keys_security_level_tree_path_vec, +}; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::epoch::Epoch; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::{IdentityPublicKey, Purpose}; +use grovedb::batch::KeyInfoPath; +use grovedb::reference_path::ReferencePathType; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use integer_encoding::VarInt; +use platform_version::version::PlatformVersion; +use std::collections::HashMap; + +impl Drive { + /// Refreshes identity key reference operations. + pub fn refresh_identity_key_reference_operations_v0( + &self, + identity_id: [u8; 32], + key: &IdentityPublicKey, + epoch: &Epoch, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // At this point, we need to refresh reference to that Identity key that was just updated (disable is an update) + + let key_id_bytes = key.id().encode_var_vec(); + + let key_reference = identity_key_location_within_identity_vec(&key_id_bytes); + + let identity_key_reference = Element::new_reference_with_flags( + ReferencePathType::UpstreamRootHeightReference(2, key_reference), + None, + ); + + let trust_refresh_reference = true; // todo: check if this needs to be false + + let purpose = key.purpose(); + let security_level = key.security_level(); + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_purpose_in_key_reference_tree( + identity_id, + estimated_costs_only_with_layer_info, + key.purpose(), + &platform_version.drive, + )?; + + if matches!(purpose, Purpose::AUTHENTICATION) { + Self::add_estimation_costs_for_authentication_keys_security_level_in_key_reference_tree( + identity_id, + estimated_costs_only_with_layer_info, + key.security_level(), + &platform_version.drive, + )?; + } + } + + let key_path_for_refresh = match purpose { + Purpose::AUTHENTICATION => { + // Now let's set the reference + Some(identity_query_keys_security_level_tree_path_vec( + identity_id.as_slice(), + security_level, + )) + } + Purpose::TRANSFER | Purpose::VOTING => { + // Now let's set the reference + Some(identity_query_keys_purpose_tree_path_vec( + identity_id.as_slice(), + purpose, + )) + } + _ => None, + }; + + if let Some(key_path) = key_path_for_refresh { + self.batch_refresh_reference( + key_path, + key_id_bytes.to_vec(), + identity_key_reference.clone(), + trust_refresh_reference, + drive_operations, + &platform_version.drive, + )?; + } + + if key.contract_bounds().is_some() { + // if there are contract bounds we need to insert them + self.refresh_potential_contract_info_key_references( + identity_id, + &key, + epoch, + estimated_costs_only_with_layer_info, + transaction, + drive_operations, + platform_version, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs index afb4c69d6e6..13ecb79d9aa 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs @@ -3,11 +3,12 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -36,6 +37,7 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -51,6 +53,7 @@ impl Drive { apply, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "remove_from_identity_balance".to_string(), diff --git a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs index 0c9286db797..491bd63bd47 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs @@ -2,12 +2,13 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::balances::credits::MAX_CREDITS; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -23,6 +24,7 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { let mut estimated_costs_only_with_layer_info = if apply { None::> @@ -46,13 +48,13 @@ impl Drive { &mut drive_operations, &platform_version.drive, )?; - let fees = Drive::calculate_fee( None, Some(drive_operations), &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) } diff --git a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs index 2adb07a9a55..cd3919f2771 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; @@ -13,6 +13,7 @@ use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use std::collections::HashMap; impl Drive { @@ -38,6 +39,7 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { match platform_version .drive @@ -53,6 +55,7 @@ impl Drive { apply, transaction, platform_version, + previous_fee_versions, ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "update_identity_revision".to_string(), diff --git a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs index ce00b4d896b..4106b2ba531 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs @@ -3,7 +3,7 @@ use dpp::block::block_info::BlockInfo; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use grovedb::batch::KeyInfoPath; use dpp::fee::fee_result::FeeResult; @@ -13,12 +13,13 @@ use dpp::prelude::Revision; use dpp::version::PlatformVersion; use grovedb::{EstimatedLayerInformation, TransactionArg}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use std::collections::HashMap; impl Drive { - //todo: this should probably not exist /// Update revision for specific identity - pub fn update_identity_revision_v0( + #[inline(always)] + pub(super) fn update_identity_revision_v0( &self, identity_id: [u8; 32], revision: Revision, @@ -26,9 +27,8 @@ impl Drive { apply: bool, transaction: TransactionArg, platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, ) -> Result { - // TODO: In case of dry run we will get less because we replace the same bytes - let mut estimated_costs_only_with_layer_info = if apply { None::> } else { @@ -51,13 +51,13 @@ impl Drive { &mut drive_operations, &platform_version.drive, )?; - let fees = Drive::calculate_fee( None, Some(drive_operations), &block_info.epoch, self.config.epochs_per_era, platform_version, + previous_fee_versions, )?; Ok(fees) diff --git a/packages/rs-drive/src/drive/identity/update/mod.rs b/packages/rs-drive/src/drive/identity/update/mod.rs index fcdee4602de..b28d7f31340 100644 --- a/packages/rs-drive/src/drive/identity/update/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/mod.rs @@ -1,4 +1,4 @@ -mod methods; +pub(crate) mod methods; mod operations; mod structs; @@ -9,7 +9,7 @@ mod tests { use dpp::prelude::*; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::identity::accessors::IdentityGettersV0; mod add_new_keys_to_identity { @@ -61,7 +61,7 @@ mod tests { fee_result, FeeResult { storage_fee: 14202000, - processing_fee: 2364090, + processing_fee: 1098260, ..Default::default() } ); @@ -121,7 +121,7 @@ mod tests { fee_result, FeeResult { storage_fee: 347382000, - processing_fee: 9274850, + processing_fee: 6819220, ..Default::default() } ); @@ -155,7 +155,7 @@ mod tests { let app_hash_before = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -172,7 +172,7 @@ mod tests { let app_hash_after = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -182,7 +182,7 @@ mod tests { fee_result, FeeResult { storage_fee: 17145000, - processing_fee: 12012160, + processing_fee: 5483620, ..Default::default() } ); @@ -255,7 +255,7 @@ mod tests { fee_result, FeeResult { storage_fee: 513000, - processing_fee: 1582060, + processing_fee: 869380, ..Default::default() } ); @@ -292,7 +292,7 @@ mod tests { let app_hash_before = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -310,7 +310,7 @@ mod tests { let app_hash_after = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -320,7 +320,7 @@ mod tests { fee_result, FeeResult { storage_fee: 486000, - processing_fee: 5432130, + processing_fee: 3216860, ..Default::default() } ); @@ -374,7 +374,7 @@ mod tests { ) .expect("should get the cost of the disabling a few keys"); - assert_eq!(expected_fee_result.storage_fee, fee_result.storage_fee,); + assert_eq!(expected_fee_result.storage_fee, fee_result.storage_fee); } } @@ -418,6 +418,7 @@ mod tests { true, Some(&db_transaction), platform_version, + None, ) .expect("should update revision"); @@ -425,7 +426,7 @@ mod tests { fee_result, FeeResult { storage_fee: 0, - processing_fee: 715520, + processing_fee: 238820, removed_bytes_from_system: 0, ..Default::default() } @@ -459,7 +460,7 @@ mod tests { let app_hash_before = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -471,12 +472,13 @@ mod tests { false, None, platform_version, + None, ) .expect("should estimate the revision update"); let app_hash_after = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -486,7 +488,7 @@ mod tests { fee_result, FeeResult { storage_fee: 0, - processing_fee: 4217750, + processing_fee: 1813560, removed_bytes_from_system: 0, ..Default::default() } diff --git a/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_nonce_operation/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_nonce_operation/mod.rs new file mode 100644 index 00000000000..e084dffc38f --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_nonce_operation/mod.rs @@ -0,0 +1 @@ +mod v0; diff --git a/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_nonce_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_nonce_operation/v0/mod.rs new file mode 100644 index 00000000000..84850462d5c --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_nonce_operation/v0/mod.rs @@ -0,0 +1,23 @@ +use crate::drive::identity::{identity_path_vec, IdentityRootStructure}; +use crate::drive::Drive; +use crate::fees::op::LowLevelDriveOperation; +use dpp::prelude::IdentityNonce; +use grovedb::Element; + +impl Drive { + /// Initialize the nonce of the identity, should only be called on create identity + /// Nonces get bumped on all identity state transitions except those that use an asset lock + pub(in crate::drive::identity) fn initialize_identity_nonce_operation_v0( + &self, + identity_id: [u8; 32], + nonce: IdentityNonce, + ) -> LowLevelDriveOperation { + let identity_path = identity_path_vec(identity_id.as_slice()); + let revision_bytes = nonce.to_be_bytes().to_vec(); + LowLevelDriveOperation::insert_for_known_path_key_element( + identity_path, + Into::<&[u8; 1]>::into(IdentityRootStructure::IdentityTreeNonce).to_vec(), + Element::new_item(revision_bytes), + ) + } +} diff --git a/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_revision_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_revision_operation/v0/mod.rs index 97348950566..b6a36f678ee 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_revision_operation/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/initialize_identity_revision_operation/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::identity::{identity_path_vec, IdentityRootStructure}; use crate::drive::Drive; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::prelude::Revision; use grovedb::Element; diff --git a/packages/rs-drive/src/drive/identity/update/operations/initialize_negative_identity_balance_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/initialize_negative_identity_balance_operation/v0/mod.rs index 97d613c8599..1a497aee942 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/initialize_negative_identity_balance_operation/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/initialize_negative_identity_balance_operation/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::identity::{identity_path_vec, IdentityRootStructure}; use crate::drive::Drive; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use grovedb::Element; impl Drive { diff --git a/packages/rs-drive/src/drive/identity/update/operations/insert_identity_balance_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/insert_identity_balance_operation/v0/mod.rs index 429d9865722..599a1fd0425 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/insert_identity_balance_operation/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/insert_identity_balance_operation/v0/mod.rs @@ -2,7 +2,7 @@ use crate::drive::balances::balance_path_vec; use crate::drive::Drive; use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::balances::credits::MAX_CREDITS; use dpp::fee::Credits; use grovedb::Element; diff --git a/packages/rs-drive/src/drive/identity/update/operations/merge_identity_nonce_operations/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/merge_identity_nonce_operations/mod.rs new file mode 100644 index 00000000000..e084dffc38f --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/operations/merge_identity_nonce_operations/mod.rs @@ -0,0 +1 @@ +mod v0; diff --git a/packages/rs-drive/src/drive/identity/update/operations/merge_identity_nonce_operations/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/merge_identity_nonce_operations/v0/mod.rs new file mode 100644 index 00000000000..dcca501abd8 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/update/operations/merge_identity_nonce_operations/v0/mod.rs @@ -0,0 +1,469 @@ +use crate::drive::identity::identity_path; +use crate::drive::Drive; + +use crate::error::Error; + +use crate::fees::op::LowLevelDriveOperation; +use grovedb::batch::KeyInfoPath; + +use dpp::prelude::IdentityNonce; + +use dpp::version::PlatformVersion; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; + +use crate::drive::identity::IdentityRootStructure::IdentityTreeNonce; +use crate::util::object_size_info::PathKeyElementInfo; +use dpp::block::block_info::BlockInfo; +use dpp::identity::identity_nonce::MergeIdentityNonceResult::{ + MergeIdentityNonceSuccess, NonceAlreadyPresentAtTip, NonceAlreadyPresentInPast, + NonceTooFarInFuture, NonceTooFarInPast, +}; +use dpp::identity::identity_nonce::{ + MergeIdentityNonceResult, IDENTITY_NONCE_VALUE_FILTER, IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES, + MISSING_IDENTITY_REVISIONS_FILTER, MISSING_IDENTITY_REVISIONS_MAX_BYTES, +}; +use std::collections::HashMap; + +impl Drive { + /// Update the nonce of the identity + /// Nonces get bumped on all identity state transitions except those that use an asset lock + pub(in crate::drive::identity::update) fn merge_identity_nonce_operations_v0( + &self, + identity_id: [u8; 32], + revision_nonce: IdentityNonce, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(MergeIdentityNonceResult, Vec), Error> { + let mut drive_operations = vec![]; + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok((MergeIdentityNonceResult::InvalidNonce, drive_operations)); + } + + if revision_nonce == 0 { + return Ok((MergeIdentityNonceResult::InvalidNonce, drive_operations)); + } + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_update_nonce( + identity_id, + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + let (existing_nonce, _unused_fees) = self.fetch_identity_nonce_with_fees( + identity_id, + block_info, + estimated_costs_only_with_layer_info.is_none(), + transaction, + platform_version, + )?; + + let nonce_to_set = if estimated_costs_only_with_layer_info.is_some() { + // we are just getting estimated costs + revision_nonce + } else if let Some(existing_nonce) = existing_nonce { + let actual_existing_revision = existing_nonce & IDENTITY_NONCE_VALUE_FILTER; + // equal + match actual_existing_revision.cmp(&revision_nonce) { + std::cmp::Ordering::Equal => { + // we were not able to update the revision as it is the same as we already had + return Ok((NonceAlreadyPresentAtTip, drive_operations)); + } + std::cmp::Ordering::Less => { + if revision_nonce - actual_existing_revision + > MISSING_IDENTITY_REVISIONS_MAX_BYTES + { + // we are too far away from the actual revision + return Ok((NonceTooFarInFuture, drive_operations)); + } else { + let missing_amount_of_revisions = + revision_nonce - actual_existing_revision - 1; + let new_previous_missing_revisions = (existing_nonce + & MISSING_IDENTITY_REVISIONS_FILTER) + << (missing_amount_of_revisions + 1); + // the missing_revisions_bytes are the amount of bytes to put in the missing area + let missing_revisions_bytes = if missing_amount_of_revisions > 0 { + ((1 << missing_amount_of_revisions) - 1) + << IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES + } else { + 0 + }; + new_previous_missing_revisions | revision_nonce | missing_revisions_bytes + } + } + std::cmp::Ordering::Greater => { + let previous_revision_position_from_top = + actual_existing_revision - revision_nonce; + if previous_revision_position_from_top >= MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + return Ok((NonceTooFarInPast, drive_operations)); + } else { + let old_missing_revisions = + existing_nonce & MISSING_IDENTITY_REVISIONS_FILTER; + if old_missing_revisions == 0 { + return Ok(( + NonceAlreadyPresentInPast(previous_revision_position_from_top), + drive_operations, + )); + } else { + let byte_to_unset = 1 + << (previous_revision_position_from_top - 1 + + IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES); + let old_revision_already_set = + old_missing_revisions | byte_to_unset != old_missing_revisions; + if old_revision_already_set { + return Ok(( + NonceAlreadyPresentInPast(previous_revision_position_from_top), + drive_operations, + )); + } else { + existing_nonce & !byte_to_unset + } + } + } + } + } + } else if revision_nonce >= MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + return Ok((NonceTooFarInFuture, drive_operations)); + } else { + // there was no previous revision nonce, just set it + + let missing_amount_of_revisions = revision_nonce - 1; + // the missing_revisions_bytes are the amount of bytes to put in the missing area + let missing_revisions_bytes = if missing_amount_of_revisions > 0 { + ((1 << missing_amount_of_revisions) - 1) << IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES + } else { + 0 + }; + + missing_revisions_bytes | revision_nonce + }; + + let identity_nonce_bytes = nonce_to_set.to_be_bytes().to_vec(); + let identity_nonce_element = Element::new_item(identity_nonce_bytes); + + //println!("{} is {:b}, existing was {:?}", nonce_to_set, nonce_to_set, existing_nonce); + + self.batch_insert( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + identity_path(&identity_id), + &[IdentityTreeNonce as u8], + identity_nonce_element, + )), + &mut drive_operations, + &platform_version.drive, + )?; + + Ok((MergeIdentityNonceSuccess(nonce_to_set), drive_operations)) + } +} + +#[cfg(feature = "server")] +#[cfg(test)] +mod tests { + use crate::drive::Drive; + use crate::util::test_helpers::setup::setup_drive; + use dpp::block::block_info::BlockInfo; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::Identity; + use dpp::prelude::IdentityNonce; + use platform_version::version::PlatformVersion; + + fn setup_base_test() -> (Drive, Identity) { + let drive = setup_drive(None); + let transaction = drive.grove.start_transaction(); + + let platform_version = PlatformVersion::first(); + + drive + .create_initial_state_structure(Some(&transaction), platform_version) + .expect("expected to create root tree successfully"); + + let identity = Identity::random_identity(5, Some(12345), platform_version) + .expect("expected a random identity"); + + drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to insert identity"); + + drive + .merge_identity_nonce( + identity.id().to_buffer(), + 1, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + drive + .commit_transaction(transaction, &platform_version.drive) + .expect("expected to commit transaction"); + + (drive, identity) + } + + #[test] + fn merge_identity_nonce_with_bump() { + let (drive, identity) = setup_base_test(); + + let platform_version = PlatformVersion::first(); + + let transaction = drive.grove.start_transaction(); + + drive + .merge_identity_nonce( + identity.id().to_buffer(), + 2, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + } + + #[test] + fn merge_identity_nonce_0_is_invalid() { + let (drive, identity) = setup_base_test(); + + let platform_version = PlatformVersion::first(); + + let transaction = drive.grove.start_transaction(); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 0, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!(result.error_message(), Some("nonce is an invalid value")); + } + + #[test] + fn merge_identity_nonce_many_updates() { + let (drive, identity) = setup_base_test(); + + let platform_version = PlatformVersion::first(); + + let transaction = drive.grove.start_transaction(); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 10, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 9, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 8, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 3, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 12, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 11, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 11, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!( + result.error_message(), + Some("nonce already present in past") + ); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 12, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!(result.error_message(), Some("nonce already present at tip")); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 0, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!(result.error_message(), Some("nonce is an invalid value")); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 12 + 25, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!(result.error_message(), Some("nonce too far in future")); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 12 + 24, // 36 + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 13, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert!(result.error_message().is_none()); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 12, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!(result.error_message(), Some("nonce too far in past")); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + 8, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!(result.error_message(), Some("nonce too far in past")); + + let (result, _) = drive + .merge_identity_nonce( + identity.id().to_buffer(), + IdentityNonce::MAX, + &BlockInfo::default(), + true, + Some(&transaction), + platform_version, + ) + .expect("expected to merge identity nonce"); + + assert_eq!(result.error_message(), Some("nonce is an invalid value")); + } +} diff --git a/packages/rs-drive/src/drive/identity/update/operations/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/mod.rs index 6f4ec0475fe..8440044fb79 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/mod.rs @@ -1,6 +1,8 @@ +mod initialize_identity_nonce_operation; mod initialize_identity_revision_operation; mod initialize_negative_identity_balance_operation; mod insert_identity_balance_operation; +mod merge_identity_nonce_operations; mod update_identity_balance_operation; mod update_identity_negative_credit_operation; mod update_identity_revision_operation; diff --git a/packages/rs-drive/src/drive/identity/update/operations/update_identity_balance_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/update_identity_balance_operation/v0/mod.rs index f1a78ffba31..91440b173c3 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/update_identity_balance_operation/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/update_identity_balance_operation/v0/mod.rs @@ -2,7 +2,7 @@ use crate::drive::balances::balance_path_vec; use crate::drive::Drive; use crate::error::identity::IdentityError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::balances::credits::MAX_CREDITS; use dpp::fee::Credits; use grovedb::Element; diff --git a/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/mod.rs index 7726235049c..2bbef48f4d6 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::fee::Credits; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/v0/mod.rs index acc746d4832..fa4d18a9ad8 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/update_identity_negative_credit_operation/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::identity::{identity_path_vec, IdentityRootStructure}; use crate::drive::Drive; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::fee::Credits; use grovedb::Element; diff --git a/packages/rs-drive/src/drive/identity/update/operations/update_identity_revision_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/operations/update_identity_revision_operation/v0/mod.rs index 172da84924e..d13e6e03c63 100644 --- a/packages/rs-drive/src/drive/identity/update/operations/update_identity_revision_operation/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/operations/update_identity_revision_operation/v0/mod.rs @@ -3,7 +3,7 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use grovedb::batch::KeyInfoPath; use dpp::prelude::Revision; diff --git a/packages/rs-drive/src/drive/identity/withdrawals/document/fetch_oldest_withdrawal_documents_by_status/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/document/fetch_oldest_withdrawal_documents_by_status/mod.rs new file mode 100644 index 00000000000..a82c2cc2db1 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/document/fetch_oldest_withdrawal_documents_by_status/mod.rs @@ -0,0 +1,40 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::document::Document; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Fetch withdrawal documents by it's status ordered by updated_at ascending + pub fn fetch_oldest_withdrawal_documents_by_status( + &self, + status: u8, + limit: u16, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .withdrawals + .document + .fetch_oldest_withdrawal_documents_by_status + { + 0 => self.fetch_oldest_withdrawal_documents_by_status_v0( + status, + limit, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_up_to_100_oldest_withdrawal_documents_by_status".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/document/fetch_oldest_withdrawal_documents_by_status/v0/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/document/fetch_oldest_withdrawal_documents_by_status/v0/mod.rs new file mode 100644 index 00000000000..b60e41be442 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/document/fetch_oldest_withdrawal_documents_by_status/v0/mod.rs @@ -0,0 +1,215 @@ +use crate::drive::document::query::QueryDocumentsOutcomeV0Methods; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::query::{DriveDocumentQuery, InternalClauses, OrderClause, WhereClause}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contracts::withdrawals_contract; +use dpp::data_contracts::withdrawals_contract::v1::document_types::withdrawal; +use dpp::document::Document; +use dpp::platform_value::Value; +use grovedb::TransactionArg; +use indexmap::IndexMap; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + pub(super) fn fetch_oldest_withdrawal_documents_by_status_v0( + &self, + status: u8, + limit: u16, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let data_contract_id = withdrawals_contract::ID; + + let contract_fetch_info = self + .get_contract_with_fetch_info_and_fee( + data_contract_id.to_buffer(), + None, + true, + transaction, + platform_version, + )? + .1 + .ok_or_else(|| { + Error::Drive(DriveError::CorruptedCodeExecution( + "Can't fetch data contract", + )) + })?; + + let document_type = contract_fetch_info + .contract + .document_type_for_name(withdrawal::NAME)?; + + let mut where_clauses = BTreeMap::new(); + + //todo: make this lazy loaded or const + where_clauses.insert( + withdrawal::properties::STATUS.to_string(), + WhereClause { + field: withdrawal::properties::STATUS.to_string(), + operator: crate::query::WhereOperator::Equal, + value: Value::U8(status), + }, + ); + + let mut order_by = IndexMap::new(); + + order_by.insert( + withdrawal::properties::UPDATED_AT.to_string(), + OrderClause { + field: withdrawal::properties::UPDATED_AT.to_string(), + ascending: true, + }, + ); + + let drive_query = DriveDocumentQuery { + contract: &contract_fetch_info.contract, + document_type, + internal_clauses: InternalClauses { + primary_key_in_clause: None, + primary_key_equal_clause: None, + in_clause: None, + range_clause: None, + equal_clauses: where_clauses, + }, + offset: None, + limit: Some(limit), + order_by, + start_at: None, + start_at_included: false, + block_time_ms: None, + }; + + let outcome = self.query_documents( + drive_query, + None, + false, + transaction, + Some(platform_version.protocol_version), + )?; + + Ok(outcome.documents_owned()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::config::DEFAULT_QUERY_LIMIT; + use crate::util::test_helpers::setup::{ + setup_document, setup_drive_with_initial_state_structure, setup_system_data_contract, + }; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::identifier::Identifier; + use dpp::identity::core_script::CoreScript; + use dpp::platform_value::platform_value; + use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; + use dpp::tests::fixtures::get_withdrawal_document_fixture; + use dpp::version::PlatformVersion; + use dpp::withdrawal::Pooling; + + #[test] + fn test_return_list_of_documents() { + let drive = setup_drive_with_initial_state_structure(); + + let transaction = drive.grove.start_transaction(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&drive, &data_contract, Some(&transaction)); + + let documents = drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::QUEUED.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch documents by status"); + + assert_eq!(documents.len(), 0); + + let owner_id = Identifier::new([1u8; 32]); + + let document = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, + "transactionIndex": 1u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &drive, + &document, + &data_contract, + document_type, + Some(&transaction), + ); + + let document = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::POOLED, + "transactionIndex": 2u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + setup_document( + &drive, + &document, + &data_contract, + document_type, + Some(&transaction), + ); + + let documents = drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::QUEUED.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch documents by status"); + + assert_eq!(documents.len(), 1); + + let documents = drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::POOLED.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch documents by status"); + + assert_eq!(documents.len(), 1); + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/document/find_withdrawal_documents_by_status_and_transaction_indices/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/document/find_withdrawal_documents_by_status_and_transaction_indices/mod.rs new file mode 100644 index 00000000000..a3545ad5397 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/document/find_withdrawal_documents_by_status_and_transaction_indices/mod.rs @@ -0,0 +1,45 @@ +mod v0; + +use crate::drive::identity::withdrawals::WithdrawalTransactionIndex; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::data_contracts::withdrawals_contract; +use dpp::document::Document; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Find withdrawal documents by status and transaction indices + pub fn find_withdrawal_documents_by_status_and_transaction_indices( + &self, + status: withdrawals_contract::WithdrawalStatus, + transaction_indices: &[WithdrawalTransactionIndex], + limit: u16, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .withdrawals + .document + .find_up_to_100_withdrawal_documents_by_status_and_transaction_indices + { + 0 => self.find_withdrawal_documents_by_status_and_transaction_indices_v0( + status, + transaction_indices, + limit, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "find_up_to_100_withdrawal_documents_by_status_and_transaction_indices" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/document/find_withdrawal_documents_by_status_and_transaction_indices/v0/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/document/find_withdrawal_documents_by_status_and_transaction_indices/v0/mod.rs new file mode 100644 index 00000000000..0d0dda43ed6 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/document/find_withdrawal_documents_by_status_and_transaction_indices/v0/mod.rs @@ -0,0 +1,174 @@ +use crate::drive::document::query::QueryDocumentsOutcomeV0Methods; +use crate::drive::identity::withdrawals::WithdrawalTransactionIndex; +use crate::drive::Drive; +use crate::error::Error; +use crate::query::{DriveDocumentQuery, InternalClauses, OrderClause, WhereClause}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contracts::withdrawals_contract; +use dpp::data_contracts::withdrawals_contract::v1::document_types::withdrawal; +use dpp::document::Document; +use dpp::platform_value::Value; +use grovedb::TransactionArg; +use indexmap::IndexMap; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + // TODO(withdrawals): Currently it queries only up to 100 documents. + // It works while we don't have pooling + + pub(super) fn find_withdrawal_documents_by_status_and_transaction_indices_v0( + &self, + status: withdrawals_contract::WithdrawalStatus, + transaction_indices: &[WithdrawalTransactionIndex], + limit: u16, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut where_clauses = BTreeMap::new(); + + where_clauses.insert( + withdrawal::properties::STATUS.to_string(), + WhereClause { + field: withdrawal::properties::STATUS.to_string(), + operator: crate::query::WhereOperator::Equal, + value: Value::U8(status as u8), + }, + ); + + where_clauses.insert( + withdrawal::properties::TRANSACTION_INDEX.to_string(), + WhereClause { + field: withdrawal::properties::TRANSACTION_INDEX.to_string(), + operator: crate::query::WhereOperator::In, + value: Value::Array( + transaction_indices + .iter() + .map(|index| Value::U64(*index)) + .collect::>(), + ), + }, + ); + + let mut order_by = IndexMap::new(); + + order_by.insert( + withdrawal::properties::TRANSACTION_INDEX.to_string(), + OrderClause { + field: withdrawal::properties::TRANSACTION_INDEX.to_string(), + ascending: true, + }, + ); + + let contract = self.cache.system_data_contracts.load_withdrawals(); + + let document_type = contract.document_type_for_name(withdrawal::NAME)?; + + let drive_query = DriveDocumentQuery { + contract: &contract, + document_type, + internal_clauses: InternalClauses { + primary_key_in_clause: None, + primary_key_equal_clause: None, + in_clause: None, + range_clause: None, + equal_clauses: where_clauses, + }, + offset: None, + limit: Some(limit), + order_by, + start_at: None, + start_at_included: false, + block_time_ms: None, + }; + + let outcome = self.query_documents( + drive_query, + None, + false, + transaction, + Some(platform_version.protocol_version), + )?; + + Ok(outcome.documents_owned()) + } +} + +#[cfg(test)] +mod tests { + use crate::config::DEFAULT_QUERY_LIMIT; + use crate::drive::identity::withdrawals::WithdrawalTransactionIndex; + use crate::util::test_helpers::setup::{ + setup_document, setup_drive_with_initial_state_structure, setup_system_data_contract, + }; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::identifier::Identifier; + use dpp::identity::core_script::CoreScript; + use dpp::platform_value::platform_value; + use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; + use dpp::tests::fixtures::get_withdrawal_document_fixture; + use dpp::version::PlatformVersion; + use dpp::withdrawal::Pooling; + + use super::*; + + #[test] + fn test_find_pooled_withdrawal_documents_by_transaction_index() { + let drive = setup_drive_with_initial_state_structure(); + + let transaction = drive.grove.start_transaction(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&drive, &data_contract, Some(&transaction)); + + let owner_id = Identifier::new([1u8; 32]); + + let transaction_index: WithdrawalTransactionIndex = 1; + + let document = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, + "transactionIndex": transaction_index, + }), + None, + platform_version.protocol_version, + ) + .expect("expected to get withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &drive, + &document, + &data_contract, + document_type, + Some(&transaction), + ); + + let found_document = drive + .find_withdrawal_documents_by_status_and_transaction_indices( + withdrawals_contract::WithdrawalStatus::POOLED, + &[transaction_index], + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to find document by it's transaction id"); + + assert_eq!(found_document.len(), 1); + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/document/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/document/mod.rs new file mode 100644 index 00000000000..0f3e6aec298 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/document/mod.rs @@ -0,0 +1,4 @@ +/// This module dedicated for a versioned fetch_up_to_100_oldest_withdrawal_documents_by_status +pub mod fetch_oldest_withdrawal_documents_by_status; +/// This module dedicated for a versioned find_up_to_100_withdrawal_documents_by_status_and_transaction_indices +pub mod find_withdrawal_documents_by_status_and_transaction_indices; diff --git a/packages/rs-drive/src/drive/identity/withdrawals/documents.rs b/packages/rs-drive/src/drive/identity/withdrawals/documents.rs deleted file mode 100644 index 52ffe87fa4c..00000000000 --- a/packages/rs-drive/src/drive/identity/withdrawals/documents.rs +++ /dev/null @@ -1,373 +0,0 @@ -use std::collections::BTreeMap; - -use dpp::data_contract::accessors::v0::DataContractV0Getters; - -use dpp::document::Document; -use dpp::platform_value::Value; -use dpp::system_data_contracts::withdrawals_contract; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; -use dpp::version::PlatformVersion; -use grovedb::TransactionArg; -use indexmap::IndexMap; - -use crate::drive::document::query::QueryDocumentsOutcomeV0Methods; -use crate::{ - drive::Drive, - error::{drive::DriveError, Error}, - query::{DriveQuery, InternalClauses, OrderClause, WhereClause}, -}; - -impl Drive { - /// Fetch withdrawal documents by it's status - pub fn fetch_withdrawal_documents_by_status( - &self, - status: u8, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let data_contract_id = withdrawals_contract::ID; - - let contract_fetch_info = self - .get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - transaction, - platform_version, - )? - .1 - .ok_or_else(|| { - Error::Drive(DriveError::CorruptedCodeExecution( - "Can't fetch data contract", - )) - })?; - - let document_type = contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME)?; - - let mut where_clauses = BTreeMap::new(); - - //todo: make this lazy loaded or const - where_clauses.insert( - withdrawal::properties::STATUS.to_string(), - WhereClause { - field: withdrawal::properties::STATUS.to_string(), - operator: crate::query::WhereOperator::Equal, - value: Value::U8(status), - }, - ); - - let mut order_by = IndexMap::new(); - - order_by.insert( - withdrawal::properties::UPDATED_AT.to_string(), - OrderClause { - field: withdrawal::properties::UPDATED_AT.to_string(), - ascending: true, - }, - ); - - let drive_query = DriveQuery { - contract: &contract_fetch_info.contract, - document_type, - internal_clauses: InternalClauses { - primary_key_in_clause: None, - primary_key_equal_clause: None, - in_clause: None, - range_clause: None, - equal_clauses: where_clauses, - }, - offset: None, - limit: Some(100), - order_by, - start_at: None, - start_at_included: false, - block_time_ms: None, - }; - - let outcome = self.query_documents( - drive_query, - None, - false, - transaction, - Some(platform_version.protocol_version), - )?; - - Ok(outcome.documents_owned()) - } - - /// Find one document by it's transactionId field - pub fn find_withdrawal_document_by_transaction_id( - &self, - original_transaction_id: &[u8], - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - let data_contract_id = withdrawals_contract::ID; - - let contract_fetch_info = self - .get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - transaction, - platform_version, - )? - .1 - .ok_or_else(|| { - Error::Drive(DriveError::CorruptedCodeExecution( - "Can't fetch data contract", - )) - })?; - - let document_type = contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME)?; - - let mut where_clauses = BTreeMap::new(); - - where_clauses.insert( - withdrawal::properties::TRANSACTION_ID.to_string(), - WhereClause { - field: withdrawal::properties::TRANSACTION_ID.to_string(), - operator: crate::query::WhereOperator::Equal, - value: Value::Bytes(original_transaction_id.to_vec()), - }, - ); - - where_clauses.insert( - withdrawal::properties::STATUS.to_string(), - WhereClause { - field: withdrawal::properties::STATUS.to_string(), - operator: crate::query::WhereOperator::Equal, - value: Value::U8(withdrawals_contract::WithdrawalStatus::POOLED as u8), - }, - ); - - let drive_query = DriveQuery { - contract: &contract_fetch_info.contract, - document_type, - internal_clauses: InternalClauses { - primary_key_in_clause: None, - primary_key_equal_clause: None, - in_clause: None, - range_clause: None, - equal_clauses: where_clauses, - }, - offset: None, - limit: Some(1), - order_by: IndexMap::new(), - start_at: None, - start_at_included: false, - block_time_ms: None, - }; - - let outcome = self.query_documents( - drive_query, - None, - false, - transaction, - Some(platform_version.protocol_version), - )?; - - let document = outcome.documents_owned().pop().ok_or(Error::Drive( - DriveError::CorruptedDriveState("document was not found by transactionId".to_string()), - ))?; - - Ok(document) - } -} - -#[cfg(test)] -mod tests { - use dpp::prelude::Identifier; - use dpp::system_data_contracts::withdrawals_contract; - use dpp::tests::fixtures::get_withdrawal_document_fixture; - - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; - use crate::tests::helpers::setup::{setup_document, setup_system_data_contract}; - - mod fetch_withdrawal_documents_by_status { - use super::*; - use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::identity::core_script::CoreScript; - use dpp::platform_value::platform_value; - use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; - use dpp::version::PlatformVersion; - use dpp::withdrawal::Pooling; - - #[test] - fn test_return_list_of_documents() { - let drive = setup_drive_with_initial_state_structure(); - - let transaction = drive.grove.start_transaction(); - - let platform_version = PlatformVersion::latest(); - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&drive, &data_contract, Some(&transaction)); - - let documents = drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::QUEUED.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch documents by status"); - - assert_eq!(documents.len(), 0); - - let owner_id = Identifier::new([1u8; 32]); - - let document = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, - "transactionIndex": 1u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &drive, - &document, - &data_contract, - document_type, - Some(&transaction), - ); - - let document = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::POOLED, - "transactionIndex": 2u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - setup_document( - &drive, - &document, - &data_contract, - document_type, - Some(&transaction), - ); - - let documents = drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::QUEUED.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch documents by status"); - - assert_eq!(documents.len(), 1); - - let documents = drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::POOLED.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch documents by status"); - - assert_eq!(documents.len(), 1); - } - } - - mod find_document_by_transaction_id { - use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::document::DocumentV0Getters; - use dpp::identity::core_script::CoreScript; - use dpp::platform_value::{platform_value, Bytes32}; - use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; - use dpp::version::PlatformVersion; - use dpp::withdrawal::Pooling; - - use super::*; - - #[test] - fn test_find_document_by_transaction_id() { - let drive = setup_drive_with_initial_state_structure(); - - let transaction = drive.grove.start_transaction(); - - let platform_version = PlatformVersion::latest(); - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&drive, &data_contract, Some(&transaction)); - - let owner_id = Identifier::new([1u8; 32]); - - let document = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, - "transactionIndex": 1u64, - "transactionId": Bytes32::default(), - }), - None, - platform_version.protocol_version, - ) - .expect("expected to get withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &drive, - &document, - &data_contract, - document_type, - Some(&transaction), - ); - - let found_document = drive - .find_withdrawal_document_by_transaction_id( - Bytes32::default().as_slice(), - Some(&transaction), - platform_version, - ) - .expect("to find document by it's transaction id"); - - assert_eq!(found_document.id().to_vec(), document.id().to_vec()); - } - } -} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/mod.rs index f5285349513..57f26a5b5ef 100644 --- a/packages/rs-drive/src/drive/identity/withdrawals/mod.rs +++ b/packages/rs-drive/src/drive/identity/withdrawals/mod.rs @@ -1,11 +1,12 @@ -/// Functions related to updating of a withdrawal status -pub mod documents; +/// Functions related to withdrawal documents +pub mod document; + /// Functions and constants related to GroveDB paths pub mod paths; -/// Functions related to withdrawal queue -pub mod queue; -/// Functions related to transaction index counter -pub mod transaction_index; +/// Functions related to withdrawal transactions +pub mod transaction; -/// Simple type alias for withdrawal transaction with it's id -pub type WithdrawalTransactionIdAndBytes = (Vec, Vec); +/// Simple type alias for withdrawal transaction with it's index +pub type WithdrawalTransactionIndexAndBytes = (WithdrawalTransactionIndex, Vec); +/// Transaction index type +pub type WithdrawalTransactionIndex = u64; diff --git a/packages/rs-drive/src/drive/identity/withdrawals/paths.rs b/packages/rs-drive/src/drive/identity/withdrawals/paths.rs index b4e53314a97..0dfcb3c4c94 100644 --- a/packages/rs-drive/src/drive/identity/withdrawals/paths.rs +++ b/packages/rs-drive/src/drive/identity/withdrawals/paths.rs @@ -1,32 +1,28 @@ use grovedb::Element; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::{batch::GroveDbOpBatch, RootTree}; +use crate::drive::{Drive, RootTree}; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; -/// constant id for transaction counter -pub const WITHDRAWAL_TRANSACTIONS_COUNTER_ID: [u8; 1] = [0]; +/// constant key for transaction counter +pub const WITHDRAWAL_TRANSACTIONS_NEXT_INDEX_KEY: [u8; 1] = [0]; /// constant id for subtree containing transactions queue -pub const WITHDRAWAL_TRANSACTIONS_QUEUE_ID: [u8; 1] = [1]; -/// constant id for subtree containing expired transaction ids -pub const WITHDRAWAL_TRANSACTIONS_EXPIRED_IDS: [u8; 1] = [2]; - -/// Add operations for creating initial withdrawal state structure -pub fn add_initial_withdrawal_state_structure_operations(batch: &mut GroveDbOpBatch) { - batch.add_insert( - vec![vec![RootTree::WithdrawalTransactions as u8]], - WITHDRAWAL_TRANSACTIONS_COUNTER_ID.to_vec(), - Element::Item(0u64.to_be_bytes().to_vec(), None), - ); - - batch.add_insert_empty_tree( - vec![vec![RootTree::WithdrawalTransactions as u8]], - WITHDRAWAL_TRANSACTIONS_QUEUE_ID.to_vec(), - ); - - batch.add_insert_empty_tree( - vec![vec![RootTree::WithdrawalTransactions as u8]], - WITHDRAWAL_TRANSACTIONS_EXPIRED_IDS.to_vec(), - ); +pub const WITHDRAWAL_TRANSACTIONS_QUEUE_KEY: [u8; 1] = [1]; + +impl Drive { + /// Add operations for creating initial withdrawal state structure + pub fn add_initial_withdrawal_state_structure_operations(batch: &mut GroveDbOpBatch) { + batch.add_insert( + vec![vec![RootTree::WithdrawalTransactions as u8]], + WITHDRAWAL_TRANSACTIONS_NEXT_INDEX_KEY.to_vec(), + Element::Item(0u64.to_be_bytes().to_vec(), None), + ); + + batch.add_insert_empty_tree( + vec![vec![RootTree::WithdrawalTransactions as u8]], + WITHDRAWAL_TRANSACTIONS_QUEUE_KEY.to_vec(), + ); + } } /// Helper function to get root path @@ -43,7 +39,7 @@ pub fn get_withdrawal_root_path() -> [&'static [u8]; 1] { pub fn get_withdrawal_transactions_queue_path_vec() -> Vec> { vec![ vec![RootTree::WithdrawalTransactions as u8], - WITHDRAWAL_TRANSACTIONS_QUEUE_ID.to_vec(), + WITHDRAWAL_TRANSACTIONS_QUEUE_KEY.to_vec(), ] } @@ -51,22 +47,6 @@ pub fn get_withdrawal_transactions_queue_path_vec() -> Vec> { pub fn get_withdrawal_transactions_queue_path() -> [&'static [u8]; 2] { [ Into::<&[u8; 1]>::into(RootTree::WithdrawalTransactions), - &WITHDRAWAL_TRANSACTIONS_QUEUE_ID, - ] -} - -/// Helper function to get expired ids path as Vec -pub fn get_withdrawal_transactions_expired_ids_path_vec() -> Vec> { - vec![ - vec![RootTree::WithdrawalTransactions as u8], - WITHDRAWAL_TRANSACTIONS_EXPIRED_IDS.to_vec(), - ] -} - -/// Helper function to get expired ids path as [u8] -pub fn get_withdrawal_transactions_expired_ids_path() -> [&'static [u8]; 2] { - [ - Into::<&[u8; 1]>::into(RootTree::WithdrawalTransactions), - &WITHDRAWAL_TRANSACTIONS_EXPIRED_IDS, + &WITHDRAWAL_TRANSACTIONS_QUEUE_KEY, ] } diff --git a/packages/rs-drive/src/drive/identity/withdrawals/queue.rs b/packages/rs-drive/src/drive/identity/withdrawals/queue.rs deleted file mode 100644 index 17c00a5c9be..00000000000 --- a/packages/rs-drive/src/drive/identity/withdrawals/queue.rs +++ /dev/null @@ -1,178 +0,0 @@ -use std::ops::RangeFull; - -use grovedb::{ - query_result_type::QueryResultType, Element, PathQuery, Query, QueryItem, SizedQuery, - TransactionArg, -}; - -use crate::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use crate::{ - drive::{ - batch::{drive_op_batch::WithdrawalOperationType, DriveOperation}, - Drive, - }, - error::{drive::DriveError, Error}, -}; - -use super::paths::get_withdrawal_transactions_queue_path_vec; - -impl Drive { - /// Add insert operations for withdrawal transactions to the batch - pub fn add_enqueue_withdrawal_transaction_operations<'a>( - &self, - withdrawals: &'a [WithdrawalTransactionIdAndBytes], - drive_operation_types: &mut Vec>, - ) { - if !withdrawals.is_empty() { - drive_operation_types.push(DriveOperation::WithdrawalOperation( - WithdrawalOperationType::InsertTransactions { - withdrawal_transactions: withdrawals, - }, - )); - } - } - - /// Get specified amount of withdrawal transactions from the DB - pub fn dequeue_withdrawal_transactions( - &self, - max_amount: u16, - transaction: TransactionArg, - drive_operation_types: &mut Vec, - ) -> Result, Error> { - let mut query = Query::new(); - - query.insert_item(QueryItem::RangeFull(RangeFull)); - - let path_query = PathQuery { - path: get_withdrawal_transactions_queue_path_vec(), - query: SizedQuery { - query, - limit: Some(max_amount), - offset: None, - }, - }; - - let result_items = self - .grove - .query_raw( - &path_query, - transaction.is_some(), - true, - QueryResultType::QueryKeyElementPairResultType, - transaction, - ) - .unwrap() - .map_err(Error::GroveDB)? - .0 - .to_key_elements(); - - let withdrawals = result_items - .into_iter() - .map(|(id, element)| match element { - Element::Item(bytes, _) => Ok((id, bytes)), - _ => Err(Error::Drive(DriveError::CorruptedWithdrawalNotItem( - "withdrawal is not an item", - ))), - }) - .collect::, Vec)>, Error>>()?; - - if !withdrawals.is_empty() { - for (id, _) in withdrawals.iter() { - drive_operation_types.push(DriveOperation::WithdrawalOperation( - WithdrawalOperationType::DeleteWithdrawalTransaction { id: id.clone() }, - )); - } - } - - Ok(withdrawals) - } -} - -#[cfg(test)] -mod tests { - use crate::{ - drive::batch::DriveOperation, - tests::helpers::setup::setup_drive_with_initial_state_structure, - }; - use dpp::block::block_info::BlockInfo; - use dpp::block::epoch::Epoch; - use dpp::version::PlatformVersion; - - #[test] - fn test_enqueue_and_dequeue() { - let drive = setup_drive_with_initial_state_structure(); - - let platform_version = PlatformVersion::latest(); - - let transaction = drive.grove.start_transaction(); - - let withdrawals: Vec<(Vec, Vec)> = (0..17) - .map(|i: u8| (i.to_be_bytes().to_vec(), vec![i; 32])) - .collect(); - - let block_info = BlockInfo { - time_ms: 1, - height: 1, - core_height: 1, - epoch: Epoch::new(1).unwrap(), - }; - - let mut drive_operations: Vec = vec![]; - - drive.add_enqueue_withdrawal_transaction_operations(&withdrawals, &mut drive_operations); - - drive - .apply_drive_operations( - drive_operations, - true, - &block_info, - Some(&transaction), - platform_version, - ) - .expect("to apply batch"); - - let mut drive_operations: Vec = vec![]; - - let withdrawals = drive - .dequeue_withdrawal_transactions(16, Some(&transaction), &mut drive_operations) - .expect("to dequeue withdrawals"); - - drive - .apply_drive_operations( - drive_operations, - true, - &block_info, - Some(&transaction), - platform_version, - ) - .expect("to apply batch"); - - assert_eq!(withdrawals.len(), 16); - - let mut drive_operations: Vec = vec![]; - - let withdrawals = drive - .dequeue_withdrawal_transactions(16, Some(&transaction), &mut drive_operations) - .expect("to dequeue withdrawals"); - - drive - .apply_drive_operations( - drive_operations, - true, - &block_info, - Some(&transaction), - platform_version, - ) - .expect("to apply batch"); - - assert_eq!(withdrawals.len(), 1); - - let mut drive_operations: Vec = vec![]; - - drive - .dequeue_withdrawal_transactions(16, Some(&transaction), &mut drive_operations) - .expect("to dequeue withdrawals"); - - assert_eq!(drive_operations.len(), 0); - } -} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/add_update_next_withdrawal_transaction_index_operation/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/add_update_next_withdrawal_transaction_index_operation/mod.rs new file mode 100644 index 00000000000..5554f8a4f6d --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/add_update_next_withdrawal_transaction_index_operation/mod.rs @@ -0,0 +1,42 @@ +mod v0; + +use crate::drive::identity::withdrawals::WithdrawalTransactionIndex; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::batch::DriveOperation; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Add next transaction index increment operation to the batch + pub fn add_update_next_withdrawal_transaction_index_operation( + &self, + index: WithdrawalTransactionIndex, + drive_operation_types: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .identity + .withdrawals + .transaction + .index + .add_update_next_withdrawal_transaction_index_operation + { + 0 => { + self.add_update_next_withdrawal_transaction_index_operation_v0( + index, + drive_operation_types, + ); + + Ok(()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_update_next_withdrawal_transaction_index_operation".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/add_update_next_withdrawal_transaction_index_operation/v0/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/add_update_next_withdrawal_transaction_index_operation/v0/mod.rs new file mode 100644 index 00000000000..4c162fd5ea3 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/add_update_next_withdrawal_transaction_index_operation/v0/mod.rs @@ -0,0 +1,16 @@ +use crate::drive::identity::withdrawals::WithdrawalTransactionIndex; +use crate::drive::Drive; +use crate::util::batch::drive_op_batch::WithdrawalOperationType; +use crate::util::batch::DriveOperation; + +impl Drive { + pub(super) fn add_update_next_withdrawal_transaction_index_operation_v0( + &self, + index: WithdrawalTransactionIndex, + drive_operation_types: &mut Vec, + ) { + drive_operation_types.push(DriveOperation::WithdrawalOperation( + WithdrawalOperationType::UpdateIndexCounter { index }, + )); + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/fetch_next_withdrawal_transaction_index/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/fetch_next_withdrawal_transaction_index/mod.rs new file mode 100644 index 00000000000..c3ae1dae3cd --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/fetch_next_withdrawal_transaction_index/mod.rs @@ -0,0 +1,34 @@ +use crate::drive::identity::withdrawals::WithdrawalTransactionIndex; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Fetches next withdrawal transaction index + pub fn fetch_next_withdrawal_transaction_index( + &self, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .identity + .withdrawals + .transaction + .index + .fetch_next_withdrawal_transaction_index + { + 0 => self.fetch_next_withdrawal_transaction_index_v0(transaction, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_next_withdrawal_transaction_index".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/fetch_next_withdrawal_transaction_index/v0/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/fetch_next_withdrawal_transaction_index/v0/mod.rs new file mode 100644 index 00000000000..bdc01546ddc --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/fetch_next_withdrawal_transaction_index/v0/mod.rs @@ -0,0 +1,43 @@ +use crate::drive::identity::withdrawals::paths::WITHDRAWAL_TRANSACTIONS_NEXT_INDEX_KEY; +use crate::drive::identity::withdrawals::WithdrawalTransactionIndex; +use crate::drive::{Drive, RootTree}; +use crate::error::drive::DriveError; +use crate::error::Error; +use grovedb::{Element, TransactionArg}; +use platform_version::version::PlatformVersion; + +impl Drive { + pub(super) fn fetch_next_withdrawal_transaction_index_v0( + &self, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let element = self + .grove + .get( + &[Into::<&[u8; 1]>::into(RootTree::WithdrawalTransactions).as_slice()], + &WITHDRAWAL_TRANSACTIONS_NEXT_INDEX_KEY, + transaction, + &platform_version.drive.grove_version, + ) + .unwrap() + .map_err(Error::GroveDB)?; + + let Element::Item(counter_bytes, _) = element else { + return Err(Error::Drive( + DriveError::CorruptedWithdrawalTransactionsCounterNotItem( + "withdrawal transactions counter must be an item", + ), + )); + }; + + let counter = + WithdrawalTransactionIndex::from_be_bytes(counter_bytes.try_into().map_err(|_| { + DriveError::CorruptedWithdrawalTransactionsCounterInvalidLength( + "withdrawal transactions counter must be an u64", + ) + })?); + + Ok(counter) + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/mod.rs new file mode 100644 index 00000000000..9928d324da5 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/index/mod.rs @@ -0,0 +1,74 @@ +/// This module dedicated for a versioned add_update_next_withdrawal_transaction_index_operation +pub mod add_update_next_withdrawal_transaction_index_operation; +/// This module dedicated for a versioned fetch_next_withdrawal_transaction_index +pub mod fetch_next_withdrawal_transaction_index; + +#[cfg(test)] +mod tests { + use dpp::block::block_info::BlockInfo; + use dpp::block::epoch::Epoch; + + use dpp::version::PlatformVersion; + + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + + #[test] + fn test_next_withdrawal_transaction_index() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let transaction = drive.grove.start_transaction(); + + let block_info = BlockInfo { + time_ms: 1, + height: 1, + core_height: 1, + epoch: Epoch::new(1).unwrap(), + }; + + let mut batch = vec![]; + + let counter: u64 = 42; + + drive + .add_update_next_withdrawal_transaction_index_operation( + counter, + &mut batch, + platform_version, + ) + .expect("to add update next withdrawal transaction index operation"); + + drive + .apply_drive_operations( + batch, + true, + &block_info, + Some(&transaction), + platform_version, + None, + ) + .expect("to apply drive ops"); + + let stored_counter = drive + .fetch_next_withdrawal_transaction_index(Some(&transaction), platform_version) + .expect("to withdraw counter"); + + assert_eq!(stored_counter, counter); + } + + #[test] + fn test_initial_withdrawal_transaction_index() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let transaction = drive.grove.start_transaction(); + + let stored_counter = drive + .fetch_next_withdrawal_transaction_index(Some(&transaction), platform_version) + .expect("to withdraw counter"); + + assert_eq!(stored_counter, 0); + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/mod.rs new file mode 100644 index 00000000000..03b9ea47d8f --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/mod.rs @@ -0,0 +1,5 @@ +/// Functions related to withdrawal queue +pub mod queue; + +/// Functions related to transaction index counter +pub mod index; diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/add_enqueue_untied_withdrawal_transaction_operations/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/add_enqueue_untied_withdrawal_transaction_operations/mod.rs new file mode 100644 index 00000000000..d0e8168790e --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/add_enqueue_untied_withdrawal_transaction_operations/mod.rs @@ -0,0 +1,42 @@ +use crate::drive::identity::withdrawals::WithdrawalTransactionIndexAndBytes; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::batch::DriveOperation; +use platform_version::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Add insert operations for withdrawal transactions to the batch + pub fn add_enqueue_untied_withdrawal_transaction_operations( + &self, + withdrawal_transactions: Vec, + drive_operation_types: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .identity + .withdrawals + .transaction + .queue + .add_enqueue_untied_withdrawal_transaction_operations + { + 0 => { + self.add_enqueue_untied_withdrawal_transaction_operations_v0( + withdrawal_transactions, + drive_operation_types, + ); + + Ok(()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_enqueue_untied_withdrawal_transaction_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/add_enqueue_untied_withdrawal_transaction_operations/v0/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/add_enqueue_untied_withdrawal_transaction_operations/v0/mod.rs new file mode 100644 index 00000000000..b14f505218c --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/add_enqueue_untied_withdrawal_transaction_operations/v0/mod.rs @@ -0,0 +1,20 @@ +use crate::drive::identity::withdrawals::WithdrawalTransactionIndexAndBytes; +use crate::drive::Drive; +use crate::util::batch::drive_op_batch::WithdrawalOperationType; +use crate::util::batch::DriveOperation; + +impl Drive { + pub(super) fn add_enqueue_untied_withdrawal_transaction_operations_v0( + &self, + withdrawal_transactions: Vec, + drive_operation_types: &mut Vec, + ) { + if !withdrawal_transactions.is_empty() { + drive_operation_types.push(DriveOperation::WithdrawalOperation( + WithdrawalOperationType::InsertTransactions { + withdrawal_transactions, + }, + )); + } + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/dequeue_untied_withdrawal_transactions/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/dequeue_untied_withdrawal_transactions/mod.rs new file mode 100644 index 00000000000..3fadfcc5c82 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/dequeue_untied_withdrawal_transactions/mod.rs @@ -0,0 +1,42 @@ +mod v0; + +use crate::drive::identity::withdrawals::WithdrawalTransactionIndexAndBytes; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::batch::DriveOperation; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Get specified amount of withdrawal transactions from the DB + pub fn dequeue_untied_withdrawal_transactions( + &self, + limit: u16, + transaction: TransactionArg, + drive_operation_types: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .identity + .withdrawals + .transaction + .queue + .dequeue_untied_withdrawal_transactions + { + 0 => self.dequeue_untied_withdrawal_transactions_v0( + limit, + transaction, + drive_operation_types, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "dequeue_untied_withdrawal_transactions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/dequeue_untied_withdrawal_transactions/v0/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/dequeue_untied_withdrawal_transactions/v0/mod.rs new file mode 100644 index 00000000000..a89b788b109 --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/dequeue_untied_withdrawal_transactions/v0/mod.rs @@ -0,0 +1,84 @@ +use crate::drive::identity::withdrawals::paths::get_withdrawal_transactions_queue_path_vec; +use crate::drive::identity::withdrawals::{ + WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes, +}; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::query::{Query, QueryItem}; +use crate::util::batch::drive_op_batch::WithdrawalOperationType; +use crate::util::batch::DriveOperation; +use grovedb::query_result_type::QueryResultType; +use grovedb::{Element, PathQuery, SizedQuery, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::convert::TryInto; +use std::ops::RangeFull; + +impl Drive { + pub(super) fn dequeue_untied_withdrawal_transactions_v0( + &self, + limit: u16, + transaction: TransactionArg, + drive_operation_types: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut query = Query::new(); + + query.insert_item(QueryItem::RangeFull(RangeFull)); + + let path_query = PathQuery { + path: get_withdrawal_transactions_queue_path_vec(), + query: SizedQuery { + query, + limit: Some(limit), + offset: None, + }, + }; + + let result_items = self + .grove + .query_raw( + &path_query, + transaction.is_some(), + true, + true, + QueryResultType::QueryKeyElementPairResultType, + transaction, + &platform_version.drive.grove_version, + ) + .unwrap() + .map_err(Error::GroveDB)? + .0 + .to_key_elements(); + + let withdrawal_transactions = result_items + .into_iter() + .map(|(index_bytes, element)| match element { + Element::Item(bytes, _) => { + let index = WithdrawalTransactionIndex::from_be_bytes( + index_bytes.try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization(String::from( + "withdrawal index must be u64", + ))) + })?, + ); + + Ok((index, bytes)) + } + _ => Err(Error::Drive(DriveError::CorruptedWithdrawalNotItem( + "withdrawal is not an item", + ))), + }) + .collect::, Error>>()?; + + if !withdrawal_transactions.is_empty() { + for (index, _) in withdrawal_transactions.iter() { + drive_operation_types.push(DriveOperation::WithdrawalOperation( + WithdrawalOperationType::DeleteWithdrawalTransaction { index: *index }, + )); + } + } + + Ok(withdrawal_transactions) + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/mod.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/mod.rs new file mode 100644 index 00000000000..85621a35e4d --- /dev/null +++ b/packages/rs-drive/src/drive/identity/withdrawals/transaction/queue/mod.rs @@ -0,0 +1,119 @@ +/// This module dedicated for a versioned add_enqueue_untied_withdrawal_transaction_operations +pub mod add_enqueue_untied_withdrawal_transaction_operations; +/// This module dedicated for a versioned dequeue_untied_withdrawal_transactions +pub mod dequeue_untied_withdrawal_transactions; + +#[cfg(test)] +mod tests { + use crate::drive::identity::withdrawals::{ + WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes, + }; + use crate::util::batch::DriveOperation; + use dpp::block::block_info::BlockInfo; + use dpp::block::epoch::Epoch; + + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + use dpp::version::PlatformVersion; + + #[test] + fn test_enqueue_and_dequeue() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let transaction = drive.grove.start_transaction(); + + let withdrawals: Vec = (0..17) + .map(|i: u8| (i as WithdrawalTransactionIndex, vec![i; 32])) + .collect(); + + let block_info = BlockInfo { + time_ms: 1, + height: 1, + core_height: 1, + epoch: Epoch::new(1).unwrap(), + }; + + let mut drive_operations: Vec = vec![]; + + drive + .add_enqueue_untied_withdrawal_transaction_operations( + withdrawals, + &mut drive_operations, + platform_version, + ) + .expect("to add enqueue untied withdrawal transaction operations"); + + drive + .apply_drive_operations( + drive_operations, + true, + &block_info, + Some(&transaction), + platform_version, + None, + ) + .expect("to apply batch"); + + let mut drive_operations: Vec = vec![]; + + let withdrawals = drive + .dequeue_untied_withdrawal_transactions( + 16, + Some(&transaction), + &mut drive_operations, + platform_version, + ) + .expect("to dequeue withdrawals"); + + drive + .apply_drive_operations( + drive_operations, + true, + &block_info, + Some(&transaction), + platform_version, + None, + ) + .expect("to apply batch"); + + assert_eq!(withdrawals.len(), 16); + + let mut drive_operations: Vec = vec![]; + + let withdrawals = drive + .dequeue_untied_withdrawal_transactions( + 16, + Some(&transaction), + &mut drive_operations, + platform_version, + ) + .expect("to dequeue withdrawals"); + + drive + .apply_drive_operations( + drive_operations, + true, + &block_info, + Some(&transaction), + platform_version, + None, + ) + .expect("to apply batch"); + + assert_eq!(withdrawals.len(), 1); + + let mut drive_operations: Vec = vec![]; + + drive + .dequeue_untied_withdrawal_transactions( + 16, + Some(&transaction), + &mut drive_operations, + platform_version, + ) + .expect("to dequeue withdrawals"); + + assert_eq!(drive_operations.len(), 0); + } +} diff --git a/packages/rs-drive/src/drive/identity/withdrawals/transaction_index.rs b/packages/rs-drive/src/drive/identity/withdrawals/transaction_index.rs deleted file mode 100644 index f87bc092649..00000000000 --- a/packages/rs-drive/src/drive/identity/withdrawals/transaction_index.rs +++ /dev/null @@ -1,239 +0,0 @@ -use grovedb::{ - query_result_type::{QueryResultElement, QueryResultType}, - Element, PathQuery, Query, SizedQuery, TransactionArg, -}; - -use crate::{ - drive::{ - batch::{drive_op_batch::WithdrawalOperationType, DriveOperation}, - Drive, RootTree, - }, - error::{drive::DriveError, Error}, -}; - -use super::paths::{ - get_withdrawal_transactions_expired_ids_path_vec, WITHDRAWAL_TRANSACTIONS_COUNTER_ID, -}; - -impl Drive { - /// Get and remove latest withdrawal index in a queue - pub fn fetch_and_remove_latest_withdrawal_transaction_index_operations( - &self, - drive_operation_types: &mut Vec, - transaction: TransactionArg, - ) -> Result { - let mut inner_query = Query::new(); - - inner_query.insert_all(); - - let expired_index_query = PathQuery::new( - get_withdrawal_transactions_expired_ids_path_vec(), - SizedQuery::new(inner_query, Some(1), None), - ); - - let (expired_index_elements, _) = self - .grove - .query_raw( - &expired_index_query, - transaction.is_some(), - true, - QueryResultType::QueryKeyElementPairResultType, - transaction, - ) - .unwrap()?; - - if !expired_index_elements.is_empty() { - let expired_index_element_pair = expired_index_elements.elements.get(0).unwrap(); - - if let QueryResultElement::KeyElementPairResultItem((key, _)) = - expired_index_element_pair - { - drive_operation_types.push(DriveOperation::WithdrawalOperation( - WithdrawalOperationType::DeleteExpiredIndex { key: key.clone() }, - )); - - let index = u64::from_be_bytes(key.clone().try_into().map_err(|_| { - Error::Drive(DriveError::CorruptedCodeExecution( - "Transaction index has wrong length", - )) - })?); - - return Ok(index); - } - } - - let result = self - .grove - .get( - &[Into::<&[u8; 1]>::into(RootTree::WithdrawalTransactions).as_slice()], - &WITHDRAWAL_TRANSACTIONS_COUNTER_ID, - transaction, - ) - .unwrap() - .map_err(Error::GroveDB); - - if let Err(Error::GroveDB(grovedb::Error::PathKeyNotFound(_))) = &result { - return Ok(0); - } - - let element = result?; - - if let Element::Item(counter_bytes, _) = element { - let counter = u64::from_be_bytes(counter_bytes.try_into().map_err(|_| { - DriveError::CorruptedWithdrawalTransactionsCounterInvalidLength( - "withdrawal transactions counter must be an u64", - ) - })?); - - Ok(counter) - } else { - Err(Error::Drive( - DriveError::CorruptedWithdrawalTransactionsCounterNotItem( - "withdrawal transactions counter must be an item", - ), - )) - } - } - - /// Add counter update operations to the batch - pub fn add_update_withdrawal_index_counter_operation( - &self, - value: u64, - drive_operation_types: &mut Vec, - ) { - drive_operation_types.push(DriveOperation::WithdrawalOperation( - WithdrawalOperationType::UpdateIndexCounter { index: value }, - )); - } - - /// Add insert expired counter operations - pub fn add_insert_expired_index_operation( - &self, - transaction_index: u64, - drive_operation_types: &mut Vec, - ) { - drive_operation_types.push(DriveOperation::WithdrawalOperation( - WithdrawalOperationType::InsertExpiredIndex { - index: transaction_index, - }, - )); - } -} - -#[cfg(test)] -mod tests { - use dpp::block::block_info::BlockInfo; - use dpp::block::epoch::Epoch; - use dpp::version::PlatformVersion; - use grovedb::Element; - - use crate::{ - drive::identity::withdrawals::paths::get_withdrawal_transactions_expired_ids_path, - tests::helpers::setup::setup_drive_with_initial_state_structure, - }; - - #[test] - fn test_withdrawal_transaction_counter() { - let drive = setup_drive_with_initial_state_structure(); - - let platform_version = PlatformVersion::latest(); - - let transaction = drive.grove.start_transaction(); - - let block_info = BlockInfo { - time_ms: 1, - height: 1, - core_height: 1, - epoch: Epoch::new(1).unwrap(), - }; - - let mut batch = vec![]; - - let counter: u64 = 42; - - drive.add_update_withdrawal_index_counter_operation(counter, &mut batch); - - drive - .apply_drive_operations( - batch, - true, - &block_info, - Some(&transaction), - platform_version, - ) - .expect("to apply drive ops"); - - let mut batch = vec![]; - - let stored_counter = drive - .fetch_and_remove_latest_withdrawal_transaction_index_operations( - &mut batch, - Some(&transaction), - ) - .expect("to withdraw counter"); - - drive - .apply_drive_operations( - batch, - true, - &block_info, - Some(&transaction), - platform_version, - ) - .expect("to apply drive ops"); - - assert_eq!(stored_counter, counter); - } - - #[test] - fn test_returns_0_if_empty() { - let drive = setup_drive_with_initial_state_structure(); - - let transaction = drive.grove.start_transaction(); - - let mut batch = vec![]; - - let stored_counter = drive - .fetch_and_remove_latest_withdrawal_transaction_index_operations( - &mut batch, - Some(&transaction), - ) - .expect("to withdraw counter"); - - assert_eq!(stored_counter, 0); - } - - #[test] - fn test_should_return_expired_index_if_any() { - let drive = setup_drive_with_initial_state_structure(); - - let transaction = drive.grove.start_transaction(); - - let bytes = 42u64.to_be_bytes(); - - let path = get_withdrawal_transactions_expired_ids_path(); - - drive - .grove - .insert( - &path, - &bytes, - Element::Item(bytes.to_vec(), None), - None, - Some(&transaction), - ) - .unwrap() - .expect("to update index counter"); - - let mut batch = vec![]; - - let stored_counter = drive - .fetch_and_remove_latest_withdrawal_transaction_index_operations( - &mut batch, - Some(&transaction), - ) - .expect("to withdraw counter"); - - assert_eq!(stored_counter, 42); - } -} diff --git a/packages/rs-drive/src/drive/initialization/genesis_core_height/mod.rs b/packages/rs-drive/src/drive/initialization/genesis_core_height/mod.rs new file mode 100644 index 00000000000..5e8f21d95e4 --- /dev/null +++ b/packages/rs-drive/src/drive/initialization/genesis_core_height/mod.rs @@ -0,0 +1,105 @@ +//! Drive Initialization + +use crate::drive::Drive; +use crate::error::Error; + +use crate::drive::system::{misc_path, misc_path_vec}; +use crate::error::drive::DriveError; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; +use crate::util::grove_operations::QueryType; +use dpp::prelude::CoreBlockHeight; +use dpp::version::PlatformVersion; +use grovedb::{Element, TransactionArg}; + +/// Genesis Core Height Key +#[cfg(any(feature = "server", feature = "verify"))] +pub const GENESIS_CORE_HEIGHT_KEY: &[u8; 1] = b"C"; + +impl Drive { + /// Stores the genesis core height in groveDB + pub fn store_genesis_core_height( + &self, + genesis_core_height: CoreBlockHeight, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let drive_version = &platform_version.drive; + let mut batch = GroveDbOpBatch::new(); + + // In Misc + batch.add_insert( + misc_path_vec(), + GENESIS_CORE_HEIGHT_KEY.to_vec(), + Element::Item(genesis_core_height.to_be_bytes().to_vec(), None), + ); + + self.grove_apply_batch(batch, false, transaction, drive_version)?; + + Ok(()) + } + + /// Fetches the genesis core height in groveDB + pub fn fetch_genesis_core_height( + &self, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let drive_version = &platform_version.drive; + + let genesis_core_height_vec = self + .grove_get( + (&misc_path()).into(), + GENESIS_CORE_HEIGHT_KEY, + QueryType::StatefulQuery, + transaction, + &mut vec![], + drive_version, + )? + .ok_or(Error::Drive(DriveError::CorruptedCodeExecution( + "genesis core height must exist", + ))) + .and_then(|element| element.into_item_bytes().map_err(Error::GroveDB))?; + + let genesis_core_height = + u32::from_be_bytes(genesis_core_height_vec.try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "storage value must be a u32".to_string(), + )) + })?); + + Ok(genesis_core_height) + } +} + +#[cfg(feature = "server")] +#[cfg(test)] +mod tests { + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + use dpp::prelude::CoreBlockHeight; + use dpp::version::PlatformVersion; + + #[test] + fn test_initial_state_structure_proper_heights() { + let drive = setup_drive_with_initial_state_structure(); + + let db_transaction = drive.grove.start_transaction(); + + let platform_version = PlatformVersion::latest(); + + let core_genesis_height: CoreBlockHeight = 1320; + drive + .store_genesis_core_height( + core_genesis_height, + Some(&db_transaction), + &platform_version, + ) + .expect("expected to store genesis core height"); + + let read_core_genesis_height = drive + .fetch_genesis_core_height(Some(&db_transaction), &platform_version) + .expect("expected to fetch genesis core height"); + + assert_eq!(core_genesis_height, read_core_genesis_height); + } +} diff --git a/packages/rs-drive/src/drive/initialization/mod.rs b/packages/rs-drive/src/drive/initialization/mod.rs index 248bd6aad8a..97159a53ba9 100644 --- a/packages/rs-drive/src/drive/initialization/mod.rs +++ b/packages/rs-drive/src/drive/initialization/mod.rs @@ -1,34 +1,6 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Drive Initialization +mod genesis_core_height; mod v0; use crate::drive::Drive; diff --git a/packages/rs-drive/src/drive/initialization/v0/mod.rs b/packages/rs-drive/src/drive/initialization/v0/mod.rs index 4a65004888d..e1c4ee377d4 100644 --- a/packages/rs-drive/src/drive/initialization/v0/mod.rs +++ b/packages/rs-drive/src/drive/initialization/v0/mod.rs @@ -1,46 +1,14 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Drive Initialization use grovedb_path::SubtreePath; use crate::drive::balances::TOTAL_SYSTEM_CREDITS_STORAGE_KEY; -use crate::drive::batch::GroveDbOpBatch; +use crate::util::batch::GroveDbOpBatch; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::identity::add_initial_withdrawal_state_structure_operations; -use crate::drive::protocol_upgrade::add_initial_fork_update_structure_operations; use crate::drive::system::misc_path_vec; use crate::drive::{Drive, RootTree}; use crate::error::Error; -use crate::fee_pools::add_create_fee_pool_trees_operations; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::version::PlatformVersion; use grovedb::{Element, TransactionArg}; @@ -120,14 +88,14 @@ impl Drive { self.grove_insert_empty_tree( SubtreePath::empty(), - &[RootTree::Misc as u8], + &[RootTree::Votes as u8], transaction, None, &mut drive_operations, drive_version, )?; - //Row 3 (3/8 taken) + //Row 3 (6/8 taken) self.grove_insert_empty_tree( SubtreePath::empty(), @@ -147,6 +115,15 @@ impl Drive { drive_version, )?; + self.grove_insert_empty_sum_tree( + SubtreePath::empty(), + &[RootTree::PreFundedSpecializedBalances as u8], + transaction, + None, + &mut drive_operations, + drive_version, + )?; + self.grove_insert_empty_tree( SubtreePath::empty(), &[RootTree::SpentAssetLockTransactions as u8], @@ -156,6 +133,15 @@ impl Drive { drive_version, )?; + self.grove_insert_empty_tree( + SubtreePath::empty(), + &[RootTree::Misc as u8], + transaction, + None, + &mut drive_operations, + drive_version, + )?; + self.grove_insert_empty_tree( SubtreePath::empty(), &[RootTree::Versions as u8], @@ -177,13 +163,23 @@ impl Drive { ); // In Pools: initialize the pools with epochs - add_create_fee_pool_trees_operations(&mut batch, self.config.epochs_per_era)?; + Drive::add_create_fee_pool_trees_operations( + &mut batch, + self.config.epochs_per_era, + platform_version.protocol_version, + )?; // In Withdrawals - add_initial_withdrawal_state_structure_operations(&mut batch); + Drive::add_initial_withdrawal_state_structure_operations(&mut batch); // For Versioning via forks - add_initial_fork_update_structure_operations(&mut batch); + Drive::add_initial_fork_update_structure_operations(&mut batch); + + // Pre funded specialized balances tree + Drive::add_initial_prefunded_specialized_balances_operations(&mut batch); + + // For the votes tree structure + Drive::add_initial_vote_tree_main_structure_operations(&mut batch, platform_version)?; self.grove_apply_batch(batch, false, transaction, drive_version)?; @@ -191,16 +187,15 @@ impl Drive { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { - use crate::drive::{Drive, RootTree}; + use crate::drive::RootTree; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::version::PlatformVersion; use grovedb::query_result_type::QueryResultType::QueryElementResultType; use grovedb::{PathQuery, Query, SizedQuery}; - use tempfile::TempDir; #[test] fn test_create_initial_state_structure() { @@ -228,14 +223,14 @@ mod tests { &platform_version.drive, ) .expect("expected to get root elements"); - assert_eq!(elements.len(), 11); + assert_eq!(elements.len(), 13); } #[test] fn test_initial_state_structure_proper_heights() { let drive = setup_drive_with_initial_state_structure(); - let db_transaction = drive.grove.start_transaction(); + let _db_transaction = drive.grove.start_transaction(); let platform_version = PlatformVersion::latest(); let drive_version = &platform_version.drive; @@ -255,13 +250,12 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 111); //it + left + right + assert_eq!(proof.len(), 112); //it + left + right // Merk Level 1 let mut query = Query::new(); @@ -278,7 +272,6 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, @@ -300,7 +293,6 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, @@ -323,14 +315,12 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 248); - //it + left + right + parent + sibling + parent sibling + grandparent + assert_eq!(proof.len(), 248); //it + left + right + parent + sibling + parent sibling + grandparent let mut query = Query::new(); query.insert_key(vec![RootTree::Pools as u8]); @@ -346,13 +336,12 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 184); //it + parent + sibling + parent sibling + grandparent + assert_eq!(proof.len(), 218); //it + left + parent + sibling + parent sibling + grandparent let mut query = Query::new(); query.insert_key(vec![RootTree::WithdrawalTransactions as u8]); @@ -368,7 +357,6 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, @@ -377,7 +365,7 @@ mod tests { assert_eq!(proof.len(), 216); //it + left + parent + sibling + parent sibling + grandparent let mut query = Query::new(); - query.insert_key(vec![RootTree::Misc as u8]); + query.insert_key(vec![RootTree::Votes as u8]); let root_path_query = PathQuery::new( vec![], SizedQuery { @@ -390,13 +378,12 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 216); //it + right + parent + sibling + parent sibling + grandparent + assert_eq!(proof.len(), 250); //it + left + right + parent + sibling + parent sibling + grandparent // Merk Level 3 @@ -414,13 +401,12 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 248); + assert_eq!(proof.len(), 248); //it + parent + sibling + parent sibling + grandparent + grandparent sibling + great-grandparent let mut query = Query::new(); query.insert_key(vec![ @@ -438,13 +424,33 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 248); + assert_eq!(proof.len(), 248); //it + parent + sibling + parent sibling + grandparent + grandparent sibling + great-grandparent + + let mut query = Query::new(); + query.insert_key(vec![RootTree::PreFundedSpecializedBalances as u8]); + let root_path_query = PathQuery::new( + vec![], + SizedQuery { + query, + limit: None, + offset: None, + }, + ); + let mut drive_operations = vec![]; + let proof = drive + .grove_get_proved_path_query( + &root_path_query, + None, + &mut drive_operations, + drive_version, + ) + .expect("expected to get root elements"); + assert_eq!(proof.len(), 217); //it + parent + parent sibling + grandparent + grandparent sibling + great-grandparent let mut query = Query::new(); query.insert_key(vec![RootTree::SpentAssetLockTransactions as u8]); @@ -460,13 +466,33 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 214); + assert_eq!(proof.len(), 214); //it + parent + parent sibling + grandparent + grandparent sibling + great-grandparent + + let mut query = Query::new(); + query.insert_key(vec![RootTree::Misc as u8]); + let root_path_query = PathQuery::new( + vec![], + SizedQuery { + query, + limit: None, + offset: None, + }, + ); + let mut drive_operations = vec![]; + let proof = drive + .grove_get_proved_path_query( + &root_path_query, + None, + &mut drive_operations, + drive_version, + ) + .expect("expected to get root elements"); + assert_eq!(proof.len(), 250); //it + parent + sibling + parent sibling + grandparent + grandparent sibling + great-grandparent let mut query = Query::new(); query.insert_key(vec![RootTree::Versions as u8]); @@ -482,12 +508,11 @@ mod tests { let proof = drive .grove_get_proved_path_query( &root_path_query, - false, None, &mut drive_operations, drive_version, ) .expect("expected to get root elements"); - assert_eq!(proof.len(), 216); + assert_eq!(proof.len(), 250); //it + parent + sibling + parent sibling + grandparent + grandparent sibling + great-grandparent } } diff --git a/packages/rs-drive/src/drive/mod.rs b/packages/rs-drive/src/drive/mod.rs index 053a051452a..f5abb9f3c9b 100644 --- a/packages/rs-drive/src/drive/mod.rs +++ b/packages/rs-drive/src/drive/mod.rs @@ -1,124 +1,73 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -#[cfg(any(feature = "full", feature = "verify"))] -use std::sync::RwLock; - -#[cfg(any(feature = "full", feature = "verify"))] +use std::sync::Arc; + +#[cfg(any(feature = "server", feature = "verify"))] use grovedb::GroveDb; +use std::fmt; -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::config::DriveConfig; +#[cfg(any(feature = "server", feature = "verify"))] +use crate::config::DriveConfig; -#[cfg(feature = "full")] -use crate::fee::op::LowLevelDriveOperation; +#[cfg(feature = "server")] +use crate::fees::op::LowLevelDriveOperation; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub mod balances; -/// Batch module -#[cfg(feature = "full")] -pub mod batch; -/// Drive Cache -#[cfg(any(feature = "full", feature = "verify"))] -pub mod cache; -#[cfg(any(feature = "full", feature = "verify"))] -pub mod config; +#[cfg(any(feature = "server", feature = "verify"))] +pub mod constants; ///DataContract module -#[cfg(any(feature = "full", feature = "verify", feature = "fixtures-and-mocks"))] +#[cfg(any(feature = "server", feature = "verify", feature = "fixtures-and-mocks"))] pub mod contract; /// Fee pools module -#[cfg(feature = "full")] +#[cfg(any(feature = "server", feature = "verify"))] pub mod credit_pools; -#[cfg(any(feature = "full", feature = "verify"))] -pub mod defaults; /// Document module -#[cfg(any(feature = "full", feature = "verify", feature = "fixtures-and-mocks"))] +#[cfg(any(feature = "server", feature = "verify", feature = "fixtures-and-mocks"))] pub mod document; -#[cfg(any(feature = "full", feature = "verify"))] -pub mod flags; -/// Low level GroveDB operations -#[cfg(feature = "full")] -pub mod grove_operations; /// Identity module -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub mod identity; -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub mod initialization; -#[cfg(feature = "full")] -pub mod object_size_info; /// Protocol upgrade module -#[cfg(feature = "full")] +#[cfg(any(feature = "server", feature = "verify"))] pub mod protocol_upgrade; -#[cfg(feature = "full")] -mod shared_estimation_costs; -#[cfg(feature = "full")] -mod system; -#[cfg(test)] -mod test_utils; - -#[cfg(feature = "full")] + +/// System module +#[cfg(feature = "server")] +pub mod system; + +#[cfg(feature = "server")] mod asset_lock; -#[cfg(feature = "full")] -pub(crate) mod fee; -#[cfg(feature = "full")] -mod open; -#[cfg(feature = "full")] -mod operations; -#[cfg(feature = "full")] -mod prove; -#[cfg(feature = "full")] -mod system_contracts_cache; -/// Contains a set of useful grovedb proof verification functions -#[cfg(any(feature = "full", feature = "verify"))] -pub mod verify; - -#[cfg(feature = "full")] -use crate::drive::cache::DriveCache; - -#[cfg(feature = "full")] -use crate::drive::system_contracts_cache::SystemContracts; +#[cfg(feature = "server")] +mod platform_state; +pub(crate) mod prefunded_specialized_balances; + +/// Vote module +#[cfg(any(feature = "server", feature = "verify"))] +pub mod votes; + +#[cfg(feature = "server")] +mod shared; + +#[cfg(feature = "server")] +use crate::cache::DriveCache; +use crate::error::drive::DriveError; +use crate::error::Error; /// Drive struct -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub struct Drive { /// GroveDB - pub grove: GroveDb, + pub grove: Arc, + /// Drive config pub config: DriveConfig, - /// Main contracts in the system - #[cfg(feature = "full")] - pub system_contracts: SystemContracts, + /// Drive Cache - #[cfg(feature = "full")] - pub cache: RwLock, + #[cfg(feature = "server")] + pub cache: DriveCache, } // The root tree structure is very important! @@ -126,16 +75,16 @@ pub struct Drive { // is at the top of the tree in order to reduce proof size // the most import tree is theDataContract Documents tree -// DataContract_Documents 64 -// / \ -// Identities 32 Balances 96 -// / \ / \ -// Token_Balances 16 Pools 48 WithdrawalTransactions 80 Misc 112 -// / \ / \ -// NUPKH->I 8 UPKH->I 24 SpentAssetLockTransactions 72 Versions 120 +// DataContract_Documents 64 +// / \ +// Identities 32 Balances 96 +// / \ / \ +// Token_Balances 16 Pools 48 WithdrawalTransactions 80 Votes 112 +// / \ / / / \ +// NUPKH->I 8 UPKH->I 24 PreFundedSpecializedBalances 40 SpentAssetLockTransactions 72 Misc 104 Versions 120 /// Keys for the root tree. -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] #[repr(u8)] pub enum RootTree { // Input data errors @@ -145,43 +94,98 @@ pub enum RootTree { Identities = 32, /// Unique Public Key Hashes to Identities UniquePublicKeyHashesToIdentities = 24, // UPKH->I above - /// Non Unique Public Key Hashes to Identities, useful for Masternode Identities + /// Non-Unique Public Key Hashes to Identities, useful for Masternode Identities NonUniquePublicKeyKeyHashesToIdentities = 8, // NUPKH->I /// Pools Pools = 48, + /// PreFundedSpecializedBalances are balances that can fund specific state transitions that match + /// predefined criteria + PreFundedSpecializedBalances = 40, /// Spent Asset Lock Transactions SpentAssetLockTransactions = 72, /// Misc - Misc = 112, + Misc = 104, /// Asset Unlock Transactions WithdrawalTransactions = 80, - /// Balances + /// Balances (For identities) Balances = 96, /// Token Balances TokenBalances = 16, /// Versions desired by proposers Versions = 120, + /// Registered votes + Votes = 112, +} + +#[cfg(any(feature = "server", feature = "verify"))] +impl fmt::Display for RootTree { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let variant_name = match self { + RootTree::DataContractDocuments => "DataContractAndDocumentsRoot", + RootTree::Identities => "Identities", + RootTree::UniquePublicKeyHashesToIdentities => "UniquePublicKeyHashesToIdentities", + RootTree::NonUniquePublicKeyKeyHashesToIdentities => { + "NonUniquePublicKeyKeyHashesToIdentities" + } + RootTree::Pools => "Pools", + RootTree::PreFundedSpecializedBalances => "PreFundedSpecializedBalances", + RootTree::SpentAssetLockTransactions => "SpentAssetLockTransactions", + RootTree::Misc => "Misc", + RootTree::WithdrawalTransactions => "WithdrawalTransactions", + RootTree::Balances => "Balances", + RootTree::TokenBalances => "TokenBalances", + RootTree::Versions => "Versions", + RootTree::Votes => "Votes", + }; + write!(f, "{}", variant_name) + } } /// Storage cost -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub const STORAGE_COST: i32 = 50; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] impl From for u8 { fn from(root_tree: RootTree) -> Self { root_tree as u8 } } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] impl From for [u8; 1] { fn from(root_tree: RootTree) -> Self { [root_tree as u8] } } -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] +impl TryFrom for RootTree { + type Error = Error; + + fn try_from(value: u8) -> Result { + match value { + 64 => Ok(RootTree::DataContractDocuments), + 32 => Ok(RootTree::Identities), + 24 => Ok(RootTree::UniquePublicKeyHashesToIdentities), + 8 => Ok(RootTree::NonUniquePublicKeyKeyHashesToIdentities), + 48 => Ok(RootTree::Pools), + 40 => Ok(RootTree::PreFundedSpecializedBalances), + 72 => Ok(RootTree::SpentAssetLockTransactions), + 104 => Ok(RootTree::Misc), + 80 => Ok(RootTree::WithdrawalTransactions), + 96 => Ok(RootTree::Balances), + 16 => Ok(RootTree::TokenBalances), + 120 => Ok(RootTree::Versions), + 112 => Ok(RootTree::Votes), + _ => Err(Error::Drive(DriveError::NotSupported( + "unknown root tree item", + ))), + } + } +} + +#[cfg(any(feature = "server", feature = "verify"))] impl From for &'static [u8; 1] { fn from(root_tree: RootTree) -> Self { match root_tree { @@ -190,24 +194,32 @@ impl From for &'static [u8; 1] { RootTree::UniquePublicKeyHashesToIdentities => &[24], RootTree::SpentAssetLockTransactions => &[72], RootTree::Pools => &[48], - RootTree::Misc => &[112], + RootTree::PreFundedSpecializedBalances => &[40], + RootTree::Misc => &[104], RootTree::WithdrawalTransactions => &[80], RootTree::Balances => &[96], RootTree::TokenBalances => &[16], RootTree::NonUniquePublicKeyKeyHashesToIdentities => &[8], RootTree::Versions => &[120], + RootTree::Votes => &[112], } } } /// Returns the path to the identities -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) fn identity_tree_path() -> [&'static [u8]; 1] { [Into::<&[u8; 1]>::into(RootTree::Identities)] } +/// Returns the path to the identities as a vec +#[cfg(any(feature = "server", feature = "verify"))] +pub(crate) fn identity_tree_path_vec() -> Vec> { + vec![vec![RootTree::Identities as u8]] +} + /// Returns the path to the key hashes. -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) fn unique_key_hashes_tree_path() -> [&'static [u8]; 1] { [Into::<&[u8; 1]>::into( RootTree::UniquePublicKeyHashesToIdentities, @@ -215,13 +227,13 @@ pub(crate) fn unique_key_hashes_tree_path() -> [&'static [u8]; 1] { } /// Returns the path to the key hashes. -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) fn unique_key_hashes_tree_path_vec() -> Vec> { vec![vec![RootTree::UniquePublicKeyHashesToIdentities as u8]] } /// Returns the path to the masternode key hashes. -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) fn non_unique_key_hashes_tree_path() -> [&'static [u8]; 1] { [Into::<&[u8; 1]>::into( RootTree::NonUniquePublicKeyKeyHashesToIdentities, @@ -229,7 +241,7 @@ pub(crate) fn non_unique_key_hashes_tree_path() -> [&'static [u8]; 1] { } /// Returns the path to the masternode key hashes. -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) fn non_unique_key_hashes_tree_path_vec() -> Vec> { vec![vec![ RootTree::NonUniquePublicKeyKeyHashesToIdentities as u8, @@ -237,7 +249,7 @@ pub(crate) fn non_unique_key_hashes_tree_path_vec() -> Vec> { } /// Returns the path to the masternode key hashes sub tree. -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) fn non_unique_key_hashes_sub_tree_path(public_key_hash: &[u8]) -> [&[u8]; 2] { [ Into::<&[u8; 1]>::into(RootTree::NonUniquePublicKeyKeyHashesToIdentities), @@ -246,7 +258,7 @@ pub(crate) fn non_unique_key_hashes_sub_tree_path(public_key_hash: &[u8]) -> [&[ } /// Returns the path to the masternode key hashes sub tree. -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub(crate) fn non_unique_key_hashes_sub_tree_path_vec(public_key_hash: [u8; 20]) -> Vec> { vec![ vec![RootTree::NonUniquePublicKeyKeyHashesToIdentities as u8], @@ -255,7 +267,7 @@ pub(crate) fn non_unique_key_hashes_sub_tree_path_vec(public_key_hash: [u8; 20]) } /// Returns the path to a contract's document types. -#[cfg(feature = "full")] +#[cfg(feature = "server")] fn contract_documents_path(contract_id: &[u8]) -> [&[u8]; 3] { [ Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), diff --git a/packages/rs-drive/src/drive/object_size_info/deletion_info.rs b/packages/rs-drive/src/drive/object_size_info/deletion_info.rs deleted file mode 100644 index affc6dd8d51..00000000000 --- a/packages/rs-drive/src/drive/object_size_info/deletion_info.rs +++ /dev/null @@ -1,9 +0,0 @@ -use crate::drive::object_size_info::key_value_info::KeyValueInfo; -use crate::drive::object_size_info::PathInfo; - -/// Deletion Info -#[allow(dead_code)] -pub struct DeletionInfo<'a, const N: usize> { - upper_path: PathInfo<'a, N>, - lower_path: Vec>, -} diff --git a/packages/rs-drive/src/drive/object_size_info/mod.rs b/packages/rs-drive/src/drive/object_size_info/mod.rs deleted file mode 100644 index 91eb8c07cd1..00000000000 --- a/packages/rs-drive/src/drive/object_size_info/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Object Size Info -//! -//! This module defines enums and implements functions relevant to the sizes of objects. -//! - -mod deletion_info; -mod document_and_contract_info; -mod document_info; -mod drive_key_info; -mod element_info; -mod key_element_info; -mod key_value_info; -mod owned_document_info; -mod path_info; -mod path_key_element_info; -mod path_key_info; - -pub use deletion_info::*; -pub use document_and_contract_info::*; -pub use document_info::*; -pub use drive_key_info::*; -pub use element_info::*; -pub use key_element_info::*; -pub use key_value_info::*; -pub use owned_document_info::*; -pub use path_info::*; -pub use path_key_element_info::*; -pub use path_key_info::*; diff --git a/packages/rs-drive/src/drive/object_size_info/path_info.rs b/packages/rs-drive/src/drive/object_size_info/path_info.rs deleted file mode 100644 index b2264ba2fbc..00000000000 --- a/packages/rs-drive/src/drive/object_size_info/path_info.rs +++ /dev/null @@ -1,81 +0,0 @@ -use grovedb::batch::key_info::KeyInfo::KnownKey; -use grovedb::batch::KeyInfoPath; - -use grovedb_storage::worst_case_costs::WorstKeyLength; - -use DriveKeyInfo::{Key, KeyRef, KeySize}; -use PathInfo::{PathFixedSizeIterator, PathIterator, PathWithSizes}; - -use crate::drive::object_size_info::drive_key_info::DriveKeyInfo; -use crate::error::drive::DriveError; -use crate::error::Error; - -/// Info about a path. -#[derive(Clone)] -pub enum PathInfo<'a, const N: usize> { - /// An into iter Path - PathFixedSizeIterator([&'a [u8]; N]), - - /// An into iter Path - PathIterator(Vec>), - - /// A path size - PathWithSizes(KeyInfoPath), -} - -impl<'a, const N: usize> PathInfo<'a, N> { - /// Returns the length of the path as a usize. - pub fn len(&self) -> u32 { - match self { - PathFixedSizeIterator(path_iterator) => { - (*path_iterator).into_iter().map(|a| a.len() as u32).sum() - } - PathIterator(path_iterator) => path_iterator.iter().map(|a| a.len() as u32).sum(), - PathWithSizes(path_size) => path_size.iterator().map(|a| a.max_length() as u32).sum(), - } - } - - /// Returns true if the path is empty. - pub fn is_empty(&self) -> bool { - match self { - PathFixedSizeIterator(path_iterator) => (*path_iterator).is_empty(), - PathIterator(path_iterator) => path_iterator.is_empty(), - PathWithSizes(path_size) => path_size.is_empty(), - } - } - - /// Pushes the given key into the path. - pub fn push(&mut self, key_info: DriveKeyInfo<'a>) -> Result<(), Error> { - match self { - PathFixedSizeIterator(_) => { - return Err(Error::Drive(DriveError::CorruptedCodeExecution( - "can not add a key to a fixed size path iterator", - ))) - } - PathIterator(path_iterator) => match key_info { - Key(key) => path_iterator.push(key), - KeyRef(key_ref) => path_iterator.push(key_ref.to_vec()), - KeySize(..) => { - return Err(Error::Drive(DriveError::CorruptedCodeExecution( - "can not add a key size to path iterator", - ))) - } - }, - PathWithSizes(key_info_path) => match key_info { - Key(key) => key_info_path.push(KnownKey(key)), - KeyRef(key_ref) => key_info_path.push(KnownKey(key_ref.to_vec())), - KeySize(key_info) => key_info_path.push(key_info), - }, - } - Ok(()) - } - - /// Get the KeyInfoPath for grovedb estimated costs - pub(crate) fn convert_to_key_info_path(self) -> KeyInfoPath { - match self { - PathFixedSizeIterator(path) => KeyInfoPath::from_known_path(path), - PathIterator(path) => KeyInfoPath::from_known_owned_path(path), - PathWithSizes(key_info_path) => key_info_path, - } - } -} diff --git a/packages/rs-drive/src/drive/open/mod.rs b/packages/rs-drive/src/drive/open/mod.rs deleted file mode 100644 index 7496a651cd7..00000000000 --- a/packages/rs-drive/src/drive/open/mod.rs +++ /dev/null @@ -1,60 +0,0 @@ -use crate::drive::cache::{DataContractCache, DriveCache, ProtocolVersionsCache}; -use crate::drive::config::DriveConfig; -use crate::drive::system_contracts_cache::SystemContracts; -use crate::drive::Drive; -use crate::error::Error; -use grovedb::GroveDb; -use platform_version::version::PlatformVersion; -use std::path::Path; -use std::sync::RwLock; - -impl Drive { - /// Opens a path in GroveDB. - /// - /// This is a non-versioned method which opens a specified path as a GroveDB instance and returns a `Drive` - /// instance with this GroveDB, cache and other configurations. - /// - /// # Arguments - /// - /// * `path` - A reference that implements the `AsRef` trait. This represents the path to the GroveDB. - /// * `config` - An `Option` which contains `DriveConfig`. If not specified, default configuration is used. - /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. - /// - /// # Returns - /// - /// * `Result` - On success, returns `Ok(Self)`, where `Self` is a `Drive` instance. On error, returns an `Error`. - /// - pub fn open>( - path: P, - config: Option, - platform_version: &PlatformVersion, - ) -> Result { - match GroveDb::open(path) { - Ok(grove) => { - let config = config.unwrap_or_default(); - let genesis_time_ms = config.default_genesis_time; - let data_contracts_global_cache_size = config.data_contracts_global_cache_size; - let data_contracts_block_cache_size = config.data_contracts_block_cache_size; - - let drive = Drive { - grove, - config, - system_contracts: SystemContracts::load_genesis_system_contracts( - platform_version.protocol_version, - )?, - cache: RwLock::new(DriveCache { - cached_contracts: DataContractCache::new( - data_contracts_global_cache_size, - data_contracts_block_cache_size, - ), - genesis_time_ms, - protocol_versions_counter: ProtocolVersionsCache::new(), - }), - }; - - Ok(drive) - } - Err(e) => Err(Error::GroveDB(e)), - } - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_batch_grovedb_operations/mod.rs b/packages/rs-drive/src/drive/operations/apply_batch_grovedb_operations/mod.rs deleted file mode 100644 index 0fad0e3204a..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_batch_grovedb_operations/mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -mod v0; - -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::collections::HashMap; - -impl Drive { - /// Applies a batch of groveDB operations, or estimates the cost of operations depending on the arguments provided. - /// - /// This method checks the drive version and calls the appropriate versioned method. - /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. - /// - /// # Arguments - /// - /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. - /// * `transaction` - The transaction argument to pass to the groveDB. - /// * `batch_operations` - A batch of operations to apply to the groveDB. - /// * `drive_operations` - A mutable reference to a vector of drive operations. - /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. - /// - pub(in crate::drive) fn apply_batch_grovedb_operations( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - batch_operations: GroveDbOpBatch, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .methods - .operations - .apply_batch_grovedb_operations - { - 0 => self.apply_batch_grovedb_operations_v0( - estimated_costs_only_with_layer_info, - transaction, - batch_operations, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "apply_batch_grovedb_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_batch_grovedb_operations/v0/mod.rs b/packages/rs-drive/src/drive/operations/apply_batch_grovedb_operations/v0/mod.rs deleted file mode 100644 index e22e9a660e6..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_batch_grovedb_operations/v0/mod.rs +++ /dev/null @@ -1,50 +0,0 @@ -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::collections::HashMap; - -impl Drive { - /// Applies a batch of groveDB operations if apply is True, otherwise gets the cost of the operations. - pub(super) fn apply_batch_grovedb_operations_v0( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - batch_operations: GroveDbOpBatch, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - if let Some(estimated_layer_info) = estimated_costs_only_with_layer_info { - // Leave this for future debugging - // for (k, v) in estimated_layer_info.iter() { - // let path = k - // .to_path() - // .iter() - // .map(|k| hex::encode(k.as_slice())) - // .join("/"); - // dbg!(path, v); - // } - self.grove_batch_operations_costs( - batch_operations, - estimated_layer_info, - false, - drive_operations, - drive_version, - )?; - } else { - self.grove_apply_batch_with_add_costs( - batch_operations, - false, - transaction, - drive_operations, - drive_version, - )?; - } - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_batch_low_level_drive_operations/mod.rs b/packages/rs-drive/src/drive/operations/apply_batch_low_level_drive_operations/mod.rs deleted file mode 100644 index 1d0d162fcf9..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_batch_low_level_drive_operations/mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::collections::HashMap; - -impl Drive { - /// Applies a batch of Drive operations to groveDB depending on the drive version. - /// - /// This method checks the drive version and calls the appropriate versioned method. - /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. - /// - /// # Arguments - /// - /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. - /// * `transaction` - The transaction argument to pass to the groveDB. - /// * `batch_operations` - A vector of low-level drive operations to apply to the groveDB. - /// * `drive_operations` - A mutable reference to a vector of drive operations. - /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. - /// - pub fn apply_batch_low_level_drive_operations( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - batch_operations: Vec, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .methods - .operations - .apply_batch_low_level_drive_operations - { - 0 => self.apply_batch_low_level_drive_operations_v0( - estimated_costs_only_with_layer_info, - transaction, - batch_operations, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "apply_batch_low_level_drive_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_batch_low_level_drive_operations/v0/mod.rs b/packages/rs-drive/src/drive/operations/apply_batch_low_level_drive_operations/v0/mod.rs deleted file mode 100644 index 2a9dfae40da..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_batch_low_level_drive_operations/v0/mod.rs +++ /dev/null @@ -1,37 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::collections::HashMap; - -impl Drive { - /// Applies a batch of Drive operations to groveDB. - pub(super) fn apply_batch_low_level_drive_operations_v0( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - batch_operations: Vec, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - let grove_db_operations = - LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); - self.apply_batch_grovedb_operations( - estimated_costs_only_with_layer_info, - transaction, - grove_db_operations, - drive_operations, - drive_version, - )?; - batch_operations.into_iter().for_each(|op| match op { - GroveOperation(_) => (), - _ => drive_operations.push(op), - }); - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_partial_batch_grovedb_operations/mod.rs b/packages/rs-drive/src/drive/operations/apply_partial_batch_grovedb_operations/mod.rs deleted file mode 100644 index 064aed9089b..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_partial_batch_grovedb_operations/mod.rs +++ /dev/null @@ -1,69 +0,0 @@ -mod v0; - -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::{drive::DriveError, Error}; -use crate::fee::op::LowLevelDriveOperation; -use crate::query::GroveError; - -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::{GroveDbOp, KeyInfoPath, OpsByLevelPath}; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use grovedb_costs::OperationCost; -use std::collections::HashMap; - -impl Drive { - /// Applies a partial batch of groveDB operations depending on the drive version. - /// - /// This method checks the drive version and calls the appropriate versioned method. - /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. - /// - /// # Arguments - /// - /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. - /// * `transaction` - The transaction argument to pass to the groveDB. - /// * `batch_operations` - A groveDB operation batch. - /// * `add_on_operations` - A closure that processes additional operations. - /// * `drive_operations` - A mutable reference to a vector of drive operations. - /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. - /// - #[allow(dead_code)] - pub(crate) fn apply_partial_batch_grovedb_operations( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - batch_operations: GroveDbOpBatch, - add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .methods - .operations - .apply_partial_batch_grovedb_operations - { - 0 => self.apply_partial_batch_grovedb_operations_v0( - estimated_costs_only_with_layer_info, - transaction, - batch_operations, - add_on_operations, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "apply_partial_batch_grovedb_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_partial_batch_grovedb_operations/v0/mod.rs b/packages/rs-drive/src/drive/operations/apply_partial_batch_grovedb_operations/v0/mod.rs deleted file mode 100644 index e206fd17c44..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_partial_batch_grovedb_operations/v0/mod.rs +++ /dev/null @@ -1,75 +0,0 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::query::GroveError; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::{GroveDbOp, KeyInfoPath, OpsByLevelPath}; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use grovedb_costs::storage_cost::StorageCost; -use grovedb_costs::OperationCost; -use std::collections::HashMap; - -impl Drive { - #[allow(dead_code)] - /// Applies a partial batch of groveDB operations if apply is True, otherwise gets the cost of the operations. - pub(super) fn apply_partial_batch_grovedb_operations_v0( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - mut batch_operations: GroveDbOpBatch, - mut add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - if let Some(estimated_layer_info) = estimated_costs_only_with_layer_info { - // Leave this for future debugging - // for (k, v) in estimated_layer_info.iter() { - // let path = k - // .to_path() - // .iter() - // .map(|k| hex::encode(k.as_slice())) - // .join("/"); - // dbg!(path, v); - // } - // the estimated fees are the same for partial batches - let additional_operations = add_on_operations( - &OperationCost { - seek_count: 1, - storage_cost: StorageCost { - added_bytes: 1, - replaced_bytes: 1, - removed_bytes: Default::default(), - }, - storage_loaded_bytes: 1, - hash_node_calls: 1, - }, - &None, - )?; - batch_operations.extend(additional_operations); - self.grove_batch_operations_costs( - batch_operations, - estimated_layer_info, - false, - drive_operations, - drive_version, - )?; - } else { - self.grove_apply_partial_batch_with_add_costs( - batch_operations, - false, - transaction, - add_on_operations, - drive_operations, - drive_version, - )?; - } - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_partial_batch_low_level_drive_operations/mod.rs b/packages/rs-drive/src/drive/operations/apply_partial_batch_low_level_drive_operations/mod.rs deleted file mode 100644 index 0f93c267b75..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_partial_batch_low_level_drive_operations/mod.rs +++ /dev/null @@ -1,69 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; - -use crate::query::GroveError; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::{KeyInfoPath, OpsByLevelPath}; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use grovedb_costs::OperationCost; -use std::collections::HashMap; - -impl Drive { - /// Applies a partial batch of low level drive operations depending on the drive version. - /// - /// This method checks the drive version and calls the appropriate versioned method. - /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. - /// - /// # Arguments - /// - /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. - /// * `transaction` - The transaction argument to pass to the groveDB. - /// * `batch_operations` - A vector of low level drive operations. - /// * `add_on_operations` - A closure that processes additional operations. - /// * `drive_operations` - A mutable reference to a vector of drive operations. - /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. - /// - #[allow(dead_code)] - pub(crate) fn apply_partial_batch_low_level_drive_operations( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - batch_operations: Vec, - add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .methods - .operations - .apply_partial_batch_low_level_drive_operations - { - 0 => self.apply_partial_batch_low_level_drive_operations_v0( - estimated_costs_only_with_layer_info, - transaction, - batch_operations, - add_on_operations, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "apply_partial_batch_low_level_drive_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/operations/apply_partial_batch_low_level_drive_operations/v0/mod.rs b/packages/rs-drive/src/drive/operations/apply_partial_batch_low_level_drive_operations/v0/mod.rs deleted file mode 100644 index 5e6dbb28a21..00000000000 --- a/packages/rs-drive/src/drive/operations/apply_partial_batch_low_level_drive_operations/v0/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; -use crate::query::GroveError; -use dpp::version::drive_versions::DriveVersion; -use grovedb::batch::{KeyInfoPath, OpsByLevelPath}; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use grovedb_costs::OperationCost; -use std::collections::HashMap; - -impl Drive { - //this will be used later - /// Applies a batch of Drive operations to groveDB. - #[allow(dead_code)] - pub(super) fn apply_partial_batch_low_level_drive_operations_v0( - &self, - estimated_costs_only_with_layer_info: Option< - HashMap, - >, - transaction: TransactionArg, - batch_operations: Vec, - mut add_on_operations: impl FnMut( - &OperationCost, - &Option, - ) -> Result, GroveError>, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - let grove_db_operations = - LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); - self.apply_partial_batch_grovedb_operations( - estimated_costs_only_with_layer_info, - transaction, - grove_db_operations, - |cost, left_over_ops| { - let additional_low_level_drive_operations = add_on_operations(cost, left_over_ops)?; - let new_grove_db_operations = LowLevelDriveOperation::grovedb_operations_batch( - &additional_low_level_drive_operations, - ) - .operations; - Ok(new_grove_db_operations) - }, - drive_operations, - drive_version, - )?; - batch_operations.into_iter().for_each(|op| match op { - GroveOperation(_) => (), - _ => drive_operations.push(op), - }); - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/operations/commit_transaction/v0/mod.rs b/packages/rs-drive/src/drive/operations/commit_transaction/v0/mod.rs deleted file mode 100644 index 37b5f0f9f1f..00000000000 --- a/packages/rs-drive/src/drive/operations/commit_transaction/v0/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use grovedb::Transaction; - -impl Drive { - /// Commits a transaction. - pub(super) fn commit_transaction_v0(&self, transaction: Transaction) -> Result<(), Error> { - self.grove - .commit_transaction(transaction) - .unwrap() // TODO: discuss what to do with transaction cost as costs are - // returned in advance on transaction operations not on commit - .map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/operations/drop_cache/v0/mod.rs b/packages/rs-drive/src/drive/operations/drop_cache/v0/mod.rs deleted file mode 100644 index 90791990d08..00000000000 --- a/packages/rs-drive/src/drive/operations/drop_cache/v0/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::drive::cache::{DataContractCache, ProtocolVersionsCache}; -use crate::drive::Drive; - -impl Drive { - /// Drops the drive cache - pub(super) fn drop_cache_v0(&self) { - let genesis_time_ms = self.config.default_genesis_time; - let data_contracts_global_cache_size = self.config.data_contracts_global_cache_size; - let data_contracts_block_cache_size = self.config.data_contracts_block_cache_size; - let mut cache = self.cache.write().unwrap(); - cache.cached_contracts = DataContractCache::new( - data_contracts_global_cache_size, - data_contracts_block_cache_size, - ); - cache.genesis_time_ms = genesis_time_ms; - cache.protocol_versions_counter = ProtocolVersionsCache::new(); - } -} diff --git a/packages/rs-drive/src/drive/operations/rollback_transaction/v0/mod.rs b/packages/rs-drive/src/drive/operations/rollback_transaction/v0/mod.rs deleted file mode 100644 index 18bb65cc653..00000000000 --- a/packages/rs-drive/src/drive/operations/rollback_transaction/v0/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -use crate::drive::Drive; -use crate::error::Error; -use grovedb::Transaction; - -impl Drive { - /// Rolls back a transaction. - pub(super) fn rollback_transaction_v0(&self, transaction: &Transaction) -> Result<(), Error> { - self.grove - .rollback_transaction(transaction) - .map_err(Error::GroveDB) - } -} diff --git a/packages/rs-drive/src/drive/platform_state/fetch_platform_state_bytes/mod.rs b/packages/rs-drive/src/drive/platform_state/fetch_platform_state_bytes/mod.rs new file mode 100644 index 00000000000..1f341d57eab --- /dev/null +++ b/packages/rs-drive/src/drive/platform_state/fetch_platform_state_bytes/mod.rs @@ -0,0 +1,30 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +mod v0; + +impl Drive { + /// Fetches execution state from grovedb storage + pub fn fetch_platform_state_bytes( + &self, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .platform_state + .fetch_platform_state_bytes + { + 0 => self.fetch_platform_state_bytes_v0(transaction), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_platform_state_bytes".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/platform_state/fetch_platform_state_bytes/v0/mod.rs b/packages/rs-drive/src/drive/platform_state/fetch_platform_state_bytes/v0/mod.rs new file mode 100644 index 00000000000..7a0bf1f18c2 --- /dev/null +++ b/packages/rs-drive/src/drive/platform_state/fetch_platform_state_bytes/v0/mod.rs @@ -0,0 +1,16 @@ +use crate::drive::platform_state::PLATFORM_STATE_KEY; +use crate::drive::Drive; +use crate::error::Error; +use grovedb::TransactionArg; + +impl Drive { + pub(super) fn fetch_platform_state_bytes_v0( + &self, + transaction: TransactionArg, + ) -> Result>, Error> { + self.grove + .get_aux(PLATFORM_STATE_KEY, transaction) + .unwrap() + .map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/drive/platform_state/mod.rs b/packages/rs-drive/src/drive/platform_state/mod.rs new file mode 100644 index 00000000000..d6a0ce16c49 --- /dev/null +++ b/packages/rs-drive/src/drive/platform_state/mod.rs @@ -0,0 +1,4 @@ +mod fetch_platform_state_bytes; +mod store_platform_state_bytes; + +const PLATFORM_STATE_KEY: &[u8; 11] = b"saved_state"; diff --git a/packages/rs-drive/src/drive/platform_state/store_platform_state_bytes/mod.rs b/packages/rs-drive/src/drive/platform_state/store_platform_state_bytes/mod.rs new file mode 100644 index 00000000000..4b5bb4be29c --- /dev/null +++ b/packages/rs-drive/src/drive/platform_state/store_platform_state_bytes/mod.rs @@ -0,0 +1,31 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Store the execution state in grovedb storage + pub fn store_platform_state_bytes( + &self, + state_bytes: &[u8], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .platform_state + .store_platform_state_bytes + { + 0 => self.store_platform_state_bytes_v0(state_bytes, transaction), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "store_platform_state_bytes".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/platform_state/store_platform_state_bytes/v0/mod.rs b/packages/rs-drive/src/drive/platform_state/store_platform_state_bytes/v0/mod.rs new file mode 100644 index 00000000000..57401f43a61 --- /dev/null +++ b/packages/rs-drive/src/drive/platform_state/store_platform_state_bytes/v0/mod.rs @@ -0,0 +1,17 @@ +use crate::drive::platform_state::PLATFORM_STATE_KEY; +use crate::drive::Drive; +use crate::error::Error; +use grovedb::TransactionArg; + +impl Drive { + pub(super) fn store_platform_state_bytes_v0( + &self, + state_bytes: &[u8], + transaction: TransactionArg, + ) -> Result<(), Error> { + self.grove + .put_aux(PLATFORM_STATE_KEY, state_bytes, None, transaction) + .unwrap() + .map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance/mod.rs new file mode 100644 index 00000000000..5caa730926d --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Adds a new prefunded specialized balance + /// + /// # Arguments + /// + /// * `amount` - The amount of credits to be added to the prefunded balance. + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + pub fn add_prefunded_specialized_balance( + &self, + specialized_balance_id: Identifier, + amount: u64, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .add_prefunded_specialized_balance + { + 0 => self.add_prefunded_specialized_balance_v0( + specialized_balance_id, + amount, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_prefunded_specialized_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance/v0/mod.rs new file mode 100644 index 00000000000..2aeebed137d --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance/v0/mod.rs @@ -0,0 +1,51 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Adds a new prefunded specialized balance + /// + /// # Arguments + /// + /// * `amount` - The amount of credits to be added to the prefunded balance. + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + #[inline(always)] + pub(super) fn add_prefunded_specialized_balance_v0( + &self, + specialized_balance_id: Identifier, + amount: u64, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut drive_operations = vec![]; + let batch_operations = self.add_prefunded_specialized_balance_operations( + specialized_balance_id, + amount, + &mut None, + transaction, + platform_version, + )?; + let grove_db_operations = + LowLevelDriveOperation::grovedb_operations_batch_consume(batch_operations); + self.grove_apply_batch_with_add_costs( + grove_db_operations, + false, + transaction, + &mut drive_operations, + &platform_version.drive, + ) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/mod.rs new file mode 100644 index 00000000000..18fd27d1039 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/mod.rs @@ -0,0 +1,60 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use grovedb::batch::KeyInfoPath; +use std::collections::HashMap; + +use crate::fees::op::LowLevelDriveOperation; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +impl Drive { + /// Adds a new prefunded specialized balance + /// + /// # Arguments + /// + /// * `amount` - The amount of credits to be added to the prefunded balance. + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + pub fn add_prefunded_specialized_balance_operations( + &self, + specialized_balance_id: Identifier, + amount: u64, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .add_prefunded_specialized_balance_operations + { + 0 => self.add_prefunded_specialized_balance_operations_v0( + specialized_balance_id, + amount, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_prefunded_specialized_balance_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/v0/mod.rs new file mode 100644 index 00000000000..25d0abc4833 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/v0/mod.rs @@ -0,0 +1,80 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::DirectQueryType; + +use crate::drive::prefunded_specialized_balances::{ + prefunded_specialized_balances_for_voting_path, + prefunded_specialized_balances_for_voting_path_vec, +}; +use crate::error::identity::IdentityError; +use dpp::balances::credits::MAX_CREDITS; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// The operations to add to the specialized balance + #[inline(always)] + pub(super) fn add_prefunded_specialized_balance_operations_v0( + &self, + specialized_balance_id: Identifier, + amount: u64, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations = vec![]; + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_prefunded_specialized_balance_update( + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + let path_holding_specialized_balances = prefunded_specialized_balances_for_voting_path(); + let previous_credits_in_specialized_balance = self + .grove_get_raw_value_u64_from_encoded_var_vec( + (&path_holding_specialized_balances).into(), + specialized_balance_id.as_slice(), + DirectQueryType::StatefulDirectQuery, + transaction, + &mut drive_operations, + &platform_version.drive, + )?; + let had_previous_balance = previous_credits_in_specialized_balance.is_some(); + let new_total = previous_credits_in_specialized_balance + .unwrap_or_default() + .checked_add(amount) + .ok_or(Error::Drive(DriveError::CriticalCorruptedState( + "trying to add an amount that would overflow credits", + )))?; + // while i64::MAX could potentially work, best to avoid it. + if new_total >= MAX_CREDITS { + return Err(Error::Identity(IdentityError::CriticalBalanceOverflow( + "trying to set prefunded specialized balance to over max credits amount (i64::MAX)", + ))); + }; + let path_holding_total_credits_vec = prefunded_specialized_balances_for_voting_path_vec(); + let op = if had_previous_balance { + QualifiedGroveDbOp::replace_op( + path_holding_total_credits_vec, + specialized_balance_id.to_vec(), + Element::new_sum_item(new_total as i64), + ) + } else { + QualifiedGroveDbOp::insert_or_replace_op( + path_holding_total_credits_vec, + specialized_balance_id.to_vec(), + Element::new_sum_item(new_total as i64), + ) + }; + drive_operations.push(GroveOperation(op)); + Ok(drive_operations) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance/mod.rs new file mode 100644 index 00000000000..755c5a510cf --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Deducts from a prefunded specialized balance + /// + /// # Arguments + /// + /// * `amount` - The amount of credits to be removed from the prefunded balance. + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + pub fn deduct_from_prefunded_specialized_balance( + &self, + specialized_balance_id: Identifier, + amount: u64, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .deduct_from_prefunded_specialized_balance + { + 0 => self.deduct_from_prefunded_specialized_balance_v0( + specialized_balance_id, + amount, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "deduct_from_prefunded_specialized_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance/v0/mod.rs new file mode 100644 index 00000000000..4bec9eb3e54 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance/v0/mod.rs @@ -0,0 +1,51 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Adds a new prefunded specialized balance + /// + /// # Arguments + /// + /// * `amount` - The amount of credits to be added to the prefunded balance. + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + #[inline(always)] + pub(super) fn deduct_from_prefunded_specialized_balance_v0( + &self, + specialized_balance_id: Identifier, + amount: u64, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut drive_operations = vec![]; + let batch_operations = self.deduct_from_prefunded_specialized_balance_operations( + specialized_balance_id, + amount, + &mut None, + transaction, + platform_version, + )?; + let grove_db_operations = + LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); + self.grove_apply_batch_with_add_costs( + grove_db_operations, + false, + transaction, + &mut drive_operations, + &platform_version.drive, + ) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/mod.rs new file mode 100644 index 00000000000..d294ec90872 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/mod.rs @@ -0,0 +1,60 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use grovedb::batch::KeyInfoPath; +use std::collections::HashMap; + +use crate::fees::op::LowLevelDriveOperation; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +impl Drive { + /// The operation Deducts from a prefunded specialized balance + /// + /// # Arguments + /// + /// * `amount` - The amount of credits to be removed from the prefunded balance. + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + pub fn deduct_from_prefunded_specialized_balance_operations( + &self, + specialized_balance_id: Identifier, + amount: u64, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .deduct_from_prefunded_specialized_balance + { + 0 => self.deduct_from_prefunded_specialized_balance_operations_v0( + specialized_balance_id, + amount, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "deduct_from_prefunded_specialized_balance_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/v0/mod.rs new file mode 100644 index 00000000000..a6adec95841 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::DirectQueryType; + +use crate::drive::prefunded_specialized_balances::{ + prefunded_specialized_balances_for_voting_path, + prefunded_specialized_balances_for_voting_path_vec, +}; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// The operations to add to the specialized balance + #[inline(always)] + pub(super) fn deduct_from_prefunded_specialized_balance_operations_v0( + &self, + specialized_balance_id: Identifier, + amount: u64, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations = vec![]; + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_prefunded_specialized_balance_update( + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + let path_holding_specialized_balances = prefunded_specialized_balances_for_voting_path(); + let previous_credits_in_specialized_balance = self + .grove_get_raw_value_u64_from_encoded_var_vec( + (&path_holding_specialized_balances).into(), + specialized_balance_id.as_slice(), + DirectQueryType::StatefulDirectQuery, + transaction, + &mut drive_operations, + &platform_version.drive, + )? + .ok_or(Error::Drive( + DriveError::PrefundedSpecializedBalanceDoesNotExist(format!( + "trying to deduct from a prefunded specialized balance {} that does not exist", + specialized_balance_id + )), + ))?; + let new_total = previous_credits_in_specialized_balance + .checked_sub(amount) + .ok_or(Error::Drive( + DriveError::PrefundedSpecializedBalanceNotEnough( + previous_credits_in_specialized_balance, + amount, + ), + ))?; + let path_holding_total_credits_vec = prefunded_specialized_balances_for_voting_path_vec(); + let replace_op = QualifiedGroveDbOp::replace_op( + path_holding_total_credits_vec, + specialized_balance_id.to_vec(), + Element::new_sum_item(new_total as i64), + ); + drive_operations.push(GroveOperation(replace_op)); + Ok(drive_operations) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/mod.rs new file mode 100644 index 00000000000..31eeebb6753 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/mod.rs @@ -0,0 +1,48 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerInformation; +use std::collections::HashMap; + +impl Drive { + /// Adds estimation costs for prefunded specialized balance update. + /// + /// This method operates on the provided HashMap, `estimated_costs_only_with_layer_info`, and adds + /// new entries to it, giving layer info on the prefunded specialized balance trees. + /// + /// # Parameters + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a HashMap storing the `KeyInfoPath` and `EstimatedLayerInformation`. + /// + /// # Returns + /// - `Ok(())` if successful. + /// - `Err(DriveError::UnknownVersionMismatch)` if the method version doesn't match any known versions. + /// + /// # Errors + /// This function will return an error if the method version doesn't match any known versions. + pub(crate) fn add_estimation_costs_for_prefunded_specialized_balance_update( + estimated_costs_only_with_layer_info: &mut HashMap, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .prefunded_specialized_balances + .estimated_cost_for_prefunded_specialized_balance_update + { + 0 => { + Self::add_estimation_costs_for_prefunded_specialized_balance_update_v0( + estimated_costs_only_with_layer_info, + ); + Ok(()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_estimation_costs_for_prefunded_specialized_balance_update".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs new file mode 100644 index 00000000000..3400c9e6a43 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs @@ -0,0 +1,63 @@ +use crate::drive::Drive; + +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; + +use crate::drive::constants::AVERAGE_BALANCE_SIZE; +use crate::drive::prefunded_specialized_balances::{ + prefunded_specialized_balances_for_voting_path_vec, prefunded_specialized_balances_path, +}; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; +use grovedb::EstimatedSumTrees::{AllSumTrees, SomeSumTrees}; +use std::collections::HashMap; + +impl Drive { + /// Adds estimation costs for total system credits update. + /// + /// This method operates on the provided HashMap, `estimated_costs_only_with_layer_info`, and adds + /// new entries to it, representing the estimated costs for the total system credits update. + #[inline(always)] + pub(super) fn add_estimation_costs_for_prefunded_specialized_balance_update_v0( + estimated_costs_only_with_layer_info: &mut HashMap, + ) { + // todo: this will be inserted at the same time as other estimated costs for documents, + // hence we add the full information, but it would be much better that estimated costs would + // be merged instead of overwritten + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path([]), + EstimatedLayerInformation { + is_sum_tree: false, + // We are on the 3rd level + estimated_layer_count: EstimatedLevel(3, false), + estimated_layer_sizes: AllSubtrees( + 1, + SomeSumTrees { + sum_trees_weight: 1, + non_sum_trees_weight: 1, + }, + None, + ), + }, + ); + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(prefunded_specialized_balances_path()), + EstimatedLayerInformation { + is_sum_tree: true, + estimated_layer_count: EstimatedLevel(0, false), + estimated_layer_sizes: AllSubtrees(1, AllSumTrees, None), + }, + ); + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_owned_path(prefunded_specialized_balances_for_voting_path_vec()), + EstimatedLayerInformation { + is_sum_tree: true, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, AVERAGE_BALANCE_SIZE, None), + }, + ); + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/mod.rs new file mode 100644 index 00000000000..012258ecd99 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/mod.rs @@ -0,0 +1 @@ +mod for_prefunded_specialized_balance_update; diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/mod.rs new file mode 100644 index 00000000000..6a2e296c13c --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/mod.rs @@ -0,0 +1 @@ +mod single_balance; diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/mod.rs new file mode 100644 index 00000000000..bd67d17ac93 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/mod.rs @@ -0,0 +1,139 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::fee::Credits; + +use dpp::version::PlatformVersion; + +use grovedb::TransactionArg; + +impl Drive { + /// Fetches a prefunded specialized balance from the backing store, respecting drive versioning. + /// + /// # Arguments + /// + /// * `identity_id` - The ID of the Identity whose balance is to be fetched. + /// * `transaction` - The current transaction. + /// * `platform_version` - The platform version to use. + /// + /// # Returns + /// + /// * `Result, Error>` - The balance of the Identity if successful, or an error. + pub fn fetch_prefunded_specialized_balance( + &self, + prefunded_specialized_balance_id: [u8; 32], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .fetch_single + { + 0 => self.fetch_prefunded_specialized_balance_v0( + prefunded_specialized_balance_id, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_prefunded_specialized_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Fetches a prefunded specialized balance from the backing store, including the estimated costs + /// of the operation. + /// Respects drive versioning. + /// + /// # Arguments + /// + /// * `identity_id` - The ID of the Identity whose balance is to be fetched. + /// * `block_info` - The information about the current block. + /// * `apply` - Whether to actually run the query or just get the estimated costs that the query + /// would use. + /// * `transaction` - The current transaction. + /// * `platform_version` - The platform version to use. + /// + /// # Returns + /// + /// * `Result<(Option, FeeResult), Error>` - The balance of the Identity and the fee if successful, or an error. + pub fn fetch_prefunded_specialized_balance_with_costs( + &self, + prefunded_specialized_balance_id: [u8; 32], + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Option, FeeResult), Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .fetch_single + { + 0 => self.fetch_prefunded_specialized_balance_with_costs_v0( + prefunded_specialized_balance_id, + block_info, + apply, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_prefunded_specialized_balance_with_costs".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Creates operations to get a prefunded specialized balance from the backing store. + /// Operations are created based on the 'apply' argument (stateful vs stateless). + /// + /// # Arguments + /// + /// * `identity_id` - The ID of the Identity whose balance is to be fetched. + /// * `apply` - Whether to create stateful or stateless operations. + /// * `transaction` - The current transaction. + /// * `drive_operations` - The drive operations to be updated. + /// * `platform_version` - The platform version to use. + /// + /// # Returns + /// + /// * `Result, Error>` - The balance of the Identity if successful, or an error. + #[allow(unused)] + pub(crate) fn fetch_prefunded_specialized_balance_operations( + &self, + prefunded_specialized_balance_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .fetch_single + { + 0 => self.fetch_prefunded_specialized_balance_operations_v0( + prefunded_specialized_balance_id, + apply, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_prefunded_specialized_balance_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/v0/mod.rs new file mode 100644 index 00000000000..54c2fd9690f --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/v0/mod.rs @@ -0,0 +1,115 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::fee::Credits; + +use crate::drive::prefunded_specialized_balances::prefunded_specialized_balances_for_voting_path; +use dpp::version::PlatformVersion; +use grovedb::Element::SumItem; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the Prefunded specialized balance from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_prefunded_specialized_balance_v0( + &self, + balance_id: [u8; 32], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations: Vec = vec![]; + self.fetch_prefunded_specialized_balance_operations_v0( + balance_id, + true, + transaction, + &mut drive_operations, + platform_version, + ) + } + + /// Fetches the Prefunded specialized balance from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn fetch_prefunded_specialized_balance_with_costs_v0( + &self, + balance_id: [u8; 32], + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Option, FeeResult), Error> { + let mut drive_operations: Vec = vec![]; + let value = self.fetch_prefunded_specialized_balance_operations_v0( + balance_id, + apply, + transaction, + &mut drive_operations, + platform_version, + )?; + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + Ok((value, fees)) + } + + /// Creates the operations to get Prefunded specialized balance from the backing store + /// This gets operations based on apply flag (stateful vs stateless) + pub(super) fn fetch_prefunded_specialized_balance_operations_v0( + &self, + balance_id: [u8; 32], + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let direct_query_type = if apply { + DirectQueryType::StatefulDirectQuery + } else { + // 8 is the size of a i64 used in sum trees + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: true, + query_target: QueryTargetValue(8), + } + }; + + let balance_path = prefunded_specialized_balances_for_voting_path(); + + match self.grove_get_raw_optional( + (&balance_path).into(), + balance_id.as_slice(), + direct_query_type, + transaction, + drive_operations, + &platform_version.drive, + ) { + Ok(Some(SumItem(balance, _))) if balance >= 0 => Ok(Some(balance as Credits)), + + Ok(None) | Err(Error::GroveDB(grovedb::Error::PathKeyNotFound(_))) => { + if apply { + Ok(None) + } else { + Ok(Some(0)) + } + } + + Ok(Some(SumItem(..))) => Err(Error::Drive(DriveError::CorruptedElementType( + "specialized balance was present but was negative", + ))), + + Ok(Some(_)) => Err(Error::Drive(DriveError::CorruptedElementType( + "specialized balance was present but was not identified as a sum item", + ))), + + Err(e) => Err(e), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs new file mode 100644 index 00000000000..215ac249341 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs @@ -0,0 +1,63 @@ +#[cfg(feature = "server")] +mod add_prefunded_specialized_balance; +#[cfg(feature = "server")] +mod add_prefunded_specialized_balance_operations; +#[cfg(feature = "server")] +mod deduct_from_prefunded_specialized_balance; +#[cfg(feature = "server")] +mod deduct_from_prefunded_specialized_balance_operations; +#[cfg(feature = "server")] +mod estimation_costs; +#[cfg(feature = "server")] +mod fetch; +#[cfg(feature = "server")] +mod prove; + +#[cfg(any(feature = "server", feature = "verify"))] +use crate::drive::{Drive, RootTree}; +#[cfg(feature = "server")] +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +#[cfg(feature = "server")] +use crate::util::batch::GroveDbOpBatch; + +pub const PREFUNDED_BALANCES_FOR_VOTING: u8 = 128; + +/// prefunded specialized balances for voting +pub(crate) fn prefunded_specialized_balances_path() -> [&'static [u8]; 1] { + [Into::<&[u8; 1]>::into( + RootTree::PreFundedSpecializedBalances, + )] +} + +/// prefunded specialized balances for voting +pub(crate) fn prefunded_specialized_balances_for_voting_path() -> [&'static [u8]; 2] { + [ + Into::<&[u8; 1]>::into(RootTree::PreFundedSpecializedBalances), + &[PREFUNDED_BALANCES_FOR_VOTING], + ] +} + +/// prefunded specialized balances for voting vector +pub(crate) fn prefunded_specialized_balances_for_voting_path_vec() -> Vec> { + vec![ + Into::<&[u8; 1]>::into(RootTree::PreFundedSpecializedBalances).to_vec(), + vec![PREFUNDED_BALANCES_FOR_VOTING], + ] +} + +impl Drive { + #[cfg(feature = "server")] + /// Add operations for creating initial prefunded specialized balances state structure + /// In v1 we will only have the prefunded balances for voting + /// In the future, we could use this for allowing for "free" state transitions as long as the + /// state transition matches specific criteria. + /// For example let's say you make a food delivery app, and you want to pay for when your + /// customers make an order, the restaurant or food delivery app might prepay for all documents + /// that make an order + pub fn add_initial_prefunded_specialized_balances_operations(batch: &mut GroveDbOpBatch) { + batch.add_insert_empty_sum_tree( + vec![vec![RootTree::PreFundedSpecializedBalances as u8]], + vec![PREFUNDED_BALANCES_FOR_VOTING], + ); + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/mod.rs new file mode 100644 index 00000000000..6a2e296c13c --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/mod.rs @@ -0,0 +1 @@ +mod single_balance; diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/single_balance/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/single_balance/mod.rs new file mode 100644 index 00000000000..1bd707bff52 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/single_balance/mod.rs @@ -0,0 +1,46 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; + +use dpp::version::PlatformVersion; + +use grovedb::TransactionArg; + +impl Drive { + /// proves a prefunded specialized balance from the backing store, respecting drive versioning. + /// + /// # Arguments + /// + /// * `identity_id` - The ID of the Specialized balance whose amount is to be proved. + /// * `transaction` - The current transaction. + /// * `platform_version` - The platform version to use. + /// + /// # Returns + /// + /// * `Result, Error>` - The proof if successful, or an error. + pub fn prove_prefunded_specialized_balance( + &self, + prefunded_specialized_balance_id: [u8; 32], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .prove_single + { + 0 => self.prove_prefunded_specialized_balance_v0( + prefunded_specialized_balance_id, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "prove_prefunded_specialized_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/single_balance/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/single_balance/v0/mod.rs new file mode 100644 index 00000000000..6877a55467b --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/prove/single_balance/v0/mod.rs @@ -0,0 +1,26 @@ +use crate::drive::Drive; +use crate::error::Error; + +use crate::drive::prefunded_specialized_balances::prefunded_specialized_balances_for_voting_path_vec; +use dpp::version::PlatformVersion; +use grovedb::{PathQuery, TransactionArg}; + +impl Drive { + /// Proves the prefunded specialized balance from the backing store + /// Passing apply as false get the estimated cost instead + pub(super) fn prove_prefunded_specialized_balance_v0( + &self, + balance_id: [u8; 32], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let balance_path = prefunded_specialized_balances_for_voting_path_vec(); + let balance_query = PathQuery::new_single_key(balance_path, balance_id.to_vec()); + self.grove_get_proved_path_query( + &balance_query, + transaction, + &mut vec![], + &platform_version.drive, + ) + } +} diff --git a/packages/rs-drive/src/drive/protocol_upgrade/change_to_new_version_and_clear_version_information/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/change_to_new_version_and_clear_version_information/mod.rs deleted file mode 100644 index 41b91c71c73..00000000000 --- a/packages/rs-drive/src/drive/protocol_upgrade/change_to_new_version_and_clear_version_information/mod.rs +++ /dev/null @@ -1,41 +0,0 @@ -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::util::deserializer::ProtocolVersion; - -use dpp::version::PlatformVersion; -use dpp::ProtocolError; -use grovedb::TransactionArg; - -mod v0; - -impl Drive { - /// Clear all version information from the backing store, this is done on epoch change in - /// execution logic - pub fn change_to_new_version_and_clear_version_information( - &self, - current_version: ProtocolVersion, - next_version: ProtocolVersion, - transaction: TransactionArg, - ) -> Result<(), Error> { - let platform_version = - PlatformVersion::get(current_version).map_err(ProtocolError::PlatformVersionError)?; - match platform_version - .drive - .methods - .protocol_upgrade - .change_to_new_version_and_clear_version_information - { - 0 => self.change_to_new_version_and_clear_version_information_v0( - current_version, - next_version, - transaction, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "change_to_new_version_and_clear_version_information".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/protocol_upgrade/change_to_new_version_and_clear_version_information/v0/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/change_to_new_version_and_clear_version_information/v0/mod.rs deleted file mode 100644 index 42fbb2a643b..00000000000 --- a/packages/rs-drive/src/drive/protocol_upgrade/change_to_new_version_and_clear_version_information/v0/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::Drive; - -use crate::error::Error; - -use crate::fee::op::LowLevelDriveOperation; - -use dpp::util::deserializer::ProtocolVersion; - -use dpp::version::PlatformVersion; -use dpp::ProtocolError; - -use grovedb::TransactionArg; - -impl Drive { - /// Clear all version information from the backing store, this is done on epoch change in - /// execution logic - pub(super) fn change_to_new_version_and_clear_version_information_v0( - &self, - current_version: ProtocolVersion, - next_version: ProtocolVersion, - transaction: TransactionArg, - ) -> Result<(), Error> { - let platform_version = - PlatformVersion::get(current_version).map_err(ProtocolError::PlatformVersionError)?; - let mut batch_operations: Vec = vec![]; - - self.set_current_protocol_version_operations( - current_version, - transaction, - &mut batch_operations, - &platform_version.drive, - )?; - self.set_next_protocol_version_operations( - next_version, - transaction, - &mut batch_operations, - &platform_version.drive, - )?; - let grove_db_operations = - LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); - if !grove_db_operations.is_empty() { - self.apply_batch_grovedb_operations( - None, - transaction, - grove_db_operations, - &mut vec![], - &platform_version.drive, - )?; - } - - self.clear_version_information(transaction, &platform_version.drive)?; - - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/mod.rs index 34667e8c164..aba2c52abb6 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/mod.rs @@ -8,11 +8,11 @@ use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; impl Drive { - /// Fetch validator votes for versions + /// Fetch validator vote_choices for versions /// /// # Arguments /// - /// * `start_protx_hash` - The first identifier to get votes from. If none is set start from the + /// * `start_protx_hash` - The first identifier to get vote_choices from. If none is set start from the /// first item by ordered hash. /// * `count` - How many max items to retrieve. /// * `transaction` - A `TransactionArg` object representing the transaction. diff --git a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/v0/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/v0/mod.rs index 3c172c109ba..e21bfcc6e46 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/v0/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_validator_version_votes/v0/mod.rs @@ -1,7 +1,4 @@ -use crate::drive::protocol_upgrade::{ - desired_version_for_validators_path, desired_version_for_validators_path_vec, - versions_counter_path_vec, -}; +use crate::drive::protocol_upgrade::desired_version_for_validators_path_vec; use crate::drive::Drive; use crate::error::Error; use std::ops::RangeFull; @@ -38,12 +35,6 @@ impl Drive { SizedQuery::new(Query::new_single_query_item(query_item), Some(count), None), ); - self.grove_get_proved_path_query( - &path_query, - false, - transaction, - &mut vec![], - drive_version, - ) + self.grove_get_proved_path_query(&path_query, transaction, &mut vec![], drive_version) } } diff --git a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/mod.rs index b3721f06c63..0ad1ab1260c 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/mod.rs @@ -4,13 +4,10 @@ use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use dpp::util::deserializer::ProtocolVersion; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; -use nohash_hasher::IntMap; - impl Drive { /// Fetch versions by count for the upgrade window /// diff --git a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/v0/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/v0/mod.rs index 45a04852a5f..5ed6a7d3b83 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/v0/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/fetch_proved_versions_with_counter/v0/mod.rs @@ -18,12 +18,6 @@ impl Drive { versions_counter_path_vec(), Query::new_single_query_item(QueryItem::RangeFull(RangeFull)), ); - self.grove_get_proved_path_query( - &path_query, - false, - transaction, - &mut vec![], - drive_version, - ) + self.grove_get_proved_path_query(&path_query, transaction, &mut vec![], drive_version) } } diff --git a/packages/rs-drive/src/drive/protocol_upgrade/fetch_validator_version_votes/v0/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/fetch_validator_version_votes/v0/mod.rs index 2c80fe161b4..b3de7313280 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/fetch_validator_version_votes/v0/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/fetch_validator_version_votes/v0/mod.rs @@ -1,7 +1,4 @@ -use crate::drive::protocol_upgrade::{ - desired_version_for_validators_path, desired_version_for_validators_path_vec, - versions_counter_path_vec, -}; +use crate::drive::protocol_upgrade::desired_version_for_validators_path_vec; use crate::drive::Drive; use crate::error::Error; use std::collections::BTreeMap; diff --git a/packages/rs-drive/src/drive/protocol_upgrade/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/mod.rs index 7030db0bf2b..d2d0800e59e 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/mod.rs @@ -1,34 +1,50 @@ -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::GroveDbOpBatch; +use crate::drive::Drive; +#[cfg(any(feature = "server", feature = "verify"))] use crate::drive::RootTree; +#[cfg(feature = "server")] +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +#[cfg(feature = "server")] +use crate::util::batch::GroveDbOpBatch; -mod change_to_new_version_and_clear_version_information; +#[cfg(feature = "server")] mod clear_version_information; +#[cfg(feature = "server")] mod fetch_proved_validator_version_votes; +#[cfg(feature = "server")] mod fetch_proved_versions_with_counter; +#[cfg(feature = "server")] mod fetch_validator_version_votes; +#[cfg(feature = "server")] mod fetch_versions_with_counter; +#[cfg(feature = "server")] mod remove_validators_proposed_app_versions; +#[cfg(feature = "server")] mod update_validator_proposed_app_version; - +#[cfg(any(feature = "server", feature = "verify"))] /// constant id for various versions counter pub const VERSIONS_COUNTER: [u8; 1] = [0]; + +#[cfg(any(feature = "server", feature = "verify"))] /// constant id for subtree containing the desired versions for each validator pub const VALIDATOR_DESIRED_VERSIONS: [u8; 1] = [1]; -/// Add operations for creating initial versioning state structure -pub fn add_initial_fork_update_structure_operations(batch: &mut GroveDbOpBatch) { - batch.add_insert_empty_tree( - vec![vec![RootTree::Versions as u8]], - VERSIONS_COUNTER.to_vec(), - ); +impl Drive { + #[cfg(feature = "server")] + /// Add operations for creating initial versioning state structure + pub fn add_initial_fork_update_structure_operations(batch: &mut GroveDbOpBatch) { + batch.add_insert_empty_tree( + vec![vec![RootTree::Versions as u8]], + VERSIONS_COUNTER.to_vec(), + ); - batch.add_insert_empty_tree( - vec![vec![RootTree::Versions as u8]], - VALIDATOR_DESIRED_VERSIONS.to_vec(), - ); + batch.add_insert_empty_tree( + vec![vec![RootTree::Versions as u8]], + VALIDATOR_DESIRED_VERSIONS.to_vec(), + ); + } } +#[cfg(any(feature = "server", feature = "verify"))] /// versions counter path pub fn versions_counter_path() -> [&'static [u8]; 2] { [ @@ -37,11 +53,13 @@ pub fn versions_counter_path() -> [&'static [u8]; 2] { ] } +#[cfg(any(feature = "server", feature = "verify"))] /// versions counter path pub fn versions_counter_path_vec() -> Vec> { vec![vec![RootTree::Versions as u8], VERSIONS_COUNTER.to_vec()] } +#[cfg(any(feature = "server", feature = "verify"))] /// desired version for validators path pub fn desired_version_for_validators_path() -> [&'static [u8]; 2] { [ @@ -50,6 +68,7 @@ pub fn desired_version_for_validators_path() -> [&'static [u8]; 2] { ] } +#[cfg(any(feature = "server", feature = "verify"))] /// desired version for validators path pub fn desired_version_for_validators_path_vec() -> Vec> { vec![ diff --git a/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs index 5e8048d6df6..6db3de7a093 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs @@ -1,15 +1,15 @@ -use crate::drive::grove_operations::BatchDeleteApplyType::StatefulBatchDelete; +use crate::util::grove_operations::BatchDeleteApplyType::StatefulBatchDelete; -use crate::drive::object_size_info::PathKeyElementInfo; +use crate::util::object_size_info::PathKeyElementInfo; use std::collections::BTreeMap; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use crate::drive::protocol_upgrade::{desired_version_for_validators_path, versions_counter_path}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; use crate::error::Error::GroveDB; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::util::deserializer::ProtocolVersion; use dpp::version::drive_versions::DriveVersion; @@ -107,8 +107,7 @@ impl Drive { where I: IntoIterator, { - let mut cache = self.cache.write().unwrap(); - let version_counter = &mut cache.protocol_versions_counter; + let mut version_counter = self.cache.protocol_versions_counter.write(); version_counter.load_if_needed(self, transaction, drive_version)?; @@ -147,12 +146,17 @@ impl Drive { } for (previous_version, change) in previous_versions_removals { - let previous_count = *version_counter.get(&previous_version).ok_or(Error::Drive( - DriveError::CorruptedCacheState( + let previous_count = version_counter + .get(&previous_version) + .map_err(|error| { + DriveError::CorruptedCacheState(format!( + "{error}. we should never face with blocked global cache when we get previous count because version counter trees must be empty at this point" + )) + })? + .ok_or(Error::Drive(DriveError::CorruptedCacheState( "trying to lower the count of a version from cache that is not found" .to_string(), - ), - ))?; + )))?; let removed_count = previous_count.checked_sub(change).ok_or(Error::Drive(DriveError::CorruptedDriveState( "trying to lower the count of a version from cache that would result in a negative value" .to_string(), diff --git a/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/mod.rs index 7bf9458cf98..868528288d5 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::util::deserializer::ProtocolVersion; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; diff --git a/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/v0/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/v0/mod.rs index 2bc78626829..6556ce2a411 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/v0/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/update_validator_proposed_app_version/v0/mod.rs @@ -1,17 +1,18 @@ -use crate::drive::grove_operations::BatchInsertApplyType; -use crate::drive::object_size_info::PathKeyElementInfo; +use crate::util::grove_operations::BatchInsertApplyType; +use crate::util::object_size_info::PathKeyElementInfo; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use crate::drive::protocol_upgrade::{desired_version_for_validators_path, versions_counter_path}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; use crate::error::Error::GroveDB; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::util::deserializer::ProtocolVersion; use dpp::version::drive_versions::DriveVersion; +use crate::error::cache::CacheError; use grovedb::{Element, TransactionArg}; use integer_encoding::VarInt; @@ -59,8 +60,7 @@ impl Drive { drive_operations: &mut Vec, drive_version: &DriveVersion, ) -> Result { - let mut cache = self.cache.write().unwrap(); - let version_counter = &mut cache.protocol_versions_counter; + let version_counter = &mut self.cache.protocol_versions_counter.write(); version_counter.load_if_needed(self, transaction, drive_version)?; @@ -91,12 +91,21 @@ impl Drive { ))) .map(|(value, _)| value)?; //we should remove 1 from the previous version - let previous_count = version_counter.get(&previous_version).ok_or(Error::Drive( - DriveError::CorruptedCacheState( - "trying to lower the count of a version from cache that is not found" - .to_string(), - ), - ))?; + let previous_count = + version_counter + .get(&previous_version) + .map_err(|error| { + match error { + Error::Cache(CacheError::GlobalCacheIsBlocked) => Error::Drive(DriveError::CorruptedCacheState( + "global cache is blocked. we should never get into it when we get previous count because version counter trees must be empty at this point".to_string(), + )), + _ => error + } + })? + .ok_or(Error::Drive(DriveError::CorruptedCacheState( + "trying to lower the count of a version from cache that is not found" + .to_string(), + )))?; if previous_count == &0 { return Err(Error::Drive(DriveError::CorruptedCacheState( "trying to lower the count of a version from cache that is already at 0" @@ -116,7 +125,12 @@ impl Drive { )?; } - let mut version_count = version_counter.get(&version).cloned().unwrap_or_default(); + let mut version_count = match version_counter.get(&version) { + Ok(count) => count.copied().unwrap_or_default(), + // if global cache is blocked then it means we are starting from scratch + Err(Error::Cache(CacheError::GlobalCacheIsBlocked)) => 0, + Err(other_error) => return Err(other_error), + }; version_count += 1; diff --git a/packages/rs-drive/src/drive/prove/mod.rs b/packages/rs-drive/src/drive/prove/mod.rs deleted file mode 100644 index 41d5a4b2bae..00000000000 --- a/packages/rs-drive/src/drive/prove/mod.rs +++ /dev/null @@ -1 +0,0 @@ -mod prove_multiple; diff --git a/packages/rs-drive/src/drive/prove/prove_multiple/mod.rs b/packages/rs-drive/src/drive/prove/prove_multiple/mod.rs deleted file mode 100644 index e67785411d2..00000000000 --- a/packages/rs-drive/src/drive/prove/prove_multiple/mod.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::drive::identity::IdentityDriveQuery; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::query::SingleDocumentDriveQuery; - -use dpp::version::PlatformVersion; -use grovedb::TransactionArg; - -mod v0; - -impl Drive { - /// This function calls the versioned `prove_multiple` - /// function based on the version provided in the `DriveVersion` parameter. It panics if the - /// version doesn't match any existing versioned functions. - /// - /// # Parameters - /// - `identity_queries`: A list of [IdentityDriveQuery]. These specify the identities - /// to be proven. - /// - `contract_ids`: A list of Data Contract IDs to prove with an associated bool to represent - /// if the contract is historical. - /// - `document_queries`: A list of [SingleDocumentDriveQuery]. These specify the documents - /// to be proven. - /// - `transaction`: An optional grovedb transaction - /// - `drive_version`: A reference to the [DriveVersion] object that specifies the version of - /// the function to call. - /// - /// # Returns - /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, - /// or an `Error` if the function fails. - pub fn prove_multiple( - &self, - identity_queries: &Vec, - contract_ids: &[([u8; 32], Option)], //bool represents if it is historical - document_queries: &Vec, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match platform_version.drive.methods.prove.prove_multiple { - 0 => self.prove_multiple_v0( - identity_queries, - contract_ids, - document_queries, - transaction, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "prove_multiple".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/prove/prove_multiple/v0/mod.rs b/packages/rs-drive/src/drive/prove/prove_multiple/v0/mod.rs deleted file mode 100644 index ed4013cf183..00000000000 --- a/packages/rs-drive/src/drive/prove/prove_multiple/v0/mod.rs +++ /dev/null @@ -1,110 +0,0 @@ -use crate::drive::identity::{IdentityDriveQuery, IdentityProveRequestType}; -use crate::drive::Drive; -use crate::error::query::QuerySyntaxError; -use crate::error::Error; -use crate::query::SingleDocumentDriveQuery; - -use dpp::version::PlatformVersion; -use grovedb::{PathQuery, TransactionArg}; -use itertools::{Either, Itertools}; - -impl Drive { - /// This function query requested identities, documents and contracts and provide cryptographic proofs - /// - /// # Parameters - /// - `identity_queries`: A list of [IdentityDriveQuery]. These specify the identities - /// to be proven. - /// - `contract_ids`: A list of Data Contract IDs to prove - /// - `document_queries`: A list of [SingleDocumentDriveQuery]. These specify the documents - /// to be proven. - /// - `transaction`: An optional grovedb transaction - /// - `drive_version`: A reference to the [DriveVersion] object that specifies the version of - /// the function to call. - /// - /// # Returns - /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, - /// or an `Error` if the function fails. - pub(super) fn prove_multiple_v0( - &self, - identity_queries: &Vec, - contract_ids: &[([u8; 32], Option)], //bool is history - document_queries: &Vec, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let mut path_queries = vec![]; - let mut count = 0; - if !identity_queries.is_empty() { - for identity_query in identity_queries { - match identity_query.prove_request_type { - IdentityProveRequestType::FullIdentity => { - path_queries.push(Self::full_identity_query(&identity_query.identity_id)?); - } - IdentityProveRequestType::Balance => { - path_queries.push(Self::balance_for_identity_id_query( - identity_query.identity_id, - )); - } - IdentityProveRequestType::Keys => { - path_queries - .push(Self::identity_all_keys_query(&identity_query.identity_id)?); - } - } - } - count += identity_queries.len(); - } - - let (contract_ids, historical_contract_ids): (Vec<_>, Vec<_>) = contract_ids - .iter() - .partition_map(|(contract_id, historical)| { - // TODO: implement None - let history = historical.unwrap_or(false); - if !history { - Either::Left(*contract_id) - } else { - Either::Right(*contract_id) - } - }); - - if !contract_ids.is_empty() { - let mut path_query = - Self::fetch_non_historical_contracts_query(contract_ids.as_slice()); - path_query.query.limit = None; - path_queries.push(path_query); - count += contract_ids.len(); - } - - if !historical_contract_ids.is_empty() { - let mut path_query = - Self::fetch_historical_contracts_query(historical_contract_ids.as_slice()); - path_query.query.limit = None; - path_queries.push(path_query); - count += historical_contract_ids.len(); - } - if !document_queries.is_empty() { - path_queries.extend( - document_queries - .iter() - .map(|drive_query| drive_query.construct_path_query()), - ); - count += document_queries.len(); - } - let verbose = match count { - 0 => { - return Err(Error::Query(QuerySyntaxError::NoQueryItems( - "we are asking to prove nothing", - ))) - } - 1 => false, - _ => true, - }; - let path_query = PathQuery::merge(path_queries.iter().collect()).map_err(Error::GroveDB)?; - self.grove_get_proved_path_query( - &path_query, - verbose, - transaction, - &mut vec![], - &platform_version.drive, - ) - } -} diff --git a/packages/rs-drive/src/drive/shared/mod.rs b/packages/rs-drive/src/drive/shared/mod.rs new file mode 100644 index 00000000000..a1437ac6092 --- /dev/null +++ b/packages/rs-drive/src/drive/shared/mod.rs @@ -0,0 +1,2 @@ +#[cfg(feature = "server")] +mod shared_estimation_costs; diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/mod.rs new file mode 100644 index 00000000000..fe1d0d7b945 --- /dev/null +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/mod.rs @@ -0,0 +1,52 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; + +use grovedb::EstimatedLayerInformation; + +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; +use std::collections::HashMap; + +impl Drive { + /// This function calls the versioned `add_estimation_costs_for_contested_document_tree_levels_up_to_contract_v0` + /// function based on the version provided in the `DriveVersion` parameter. It returns an error if the + /// version doesn't match any existing versioned functions. + /// + /// # Parameters + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a `HashMap` that holds the estimated layer information. + /// - `drive_version`: A reference to the `DriveVersion` object that specifies the version of the function to call. + pub(in crate::drive) fn add_estimation_costs_for_contested_document_tree_levels_up_to_contract< + 'a, + >( + contract: &'a DataContract, + document_type: Option>, + estimated_costs_only_with_layer_info: &mut HashMap, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .estimated_costs + .add_estimation_costs_for_contested_document_tree_levels_up_to_contract + { + 0 => { + Self::add_estimation_costs_for_contested_document_tree_levels_up_to_contract_v0( + contract, + document_type, + estimated_costs_only_with_layer_info, + ); + Ok(()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_estimation_costs_for_contested_document_tree_levels_up_to_contract" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs new file mode 100644 index 00000000000..2257bfae60b --- /dev/null +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs @@ -0,0 +1,162 @@ +use crate::drive::constants::{ + ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, ESTIMATED_AVERAGE_INDEX_NAME_SIZE, +}; + +use crate::drive::Drive; + +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::AllSubtrees; + +use crate::drive::votes::paths::{ + vote_contested_resource_active_polls_contract_document_tree_path, + vote_contested_resource_active_polls_contract_tree_path, + vote_contested_resource_active_polls_tree_path, + vote_contested_resource_contract_documents_indexes_path, vote_contested_resource_tree_path, + vote_root_path, +}; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; +use grovedb::EstimatedSumTrees::{NoSumTrees, SomeSumTrees}; +use std::collections::HashMap; + +impl Drive { + /// Adds estimated costs for layers up to the contract level. + /// + /// This function populates the `estimated_costs_only_with_layer_info` hashmap with estimated layer information for the top level and the contract layer. + /// These estimates are useful for optimizing GroveDB operations. + /// + /// # Parameters + /// + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap that will be populated with estimated layer information for the top level and the contract layer. + /// + /// # Estimated Layer Information + /// + /// The function estimates two layers: + /// + /// 1. The top layer, which is an empty layer. + /// 2. The contract layer, which contains all global contracts. + /// + /// These estimates are useful for optimizing batch insertions, deletions, and other operations in GroveDB. + /// + /// # Usage + /// + /// This function is intended to be used internally within the Drive implementation. + /// + pub(in crate::drive) fn add_estimation_costs_for_contested_document_tree_levels_up_to_contract_v0< + 'a, + >( + contract: &'a DataContract, + document_type: Option>, + estimated_costs_only_with_layer_info: &mut HashMap, + ) { + // we have constructed the top layer so contract/documents tree are at the top + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path([]), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(2, false), //voting is on level 2 + // We have balances in the middle which is a sum tree + estimated_layer_sizes: AllSubtrees( + 1, + SomeSumTrees { + sum_trees_weight: 1, + non_sum_trees_weight: 2, + }, + None, + ), + }, + ); + + // we then need to insert the contract layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_root_path()), + EstimatedLayerInformation { + is_sum_tree: false, + // contested resource tree is a key of "c" so it should be on the top layer of the merk + estimated_layer_count: EstimatedLevel(0, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + + // we then need to insert the contract layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_contested_resource_tree_path()), + EstimatedLayerInformation { + is_sum_tree: false, + // active poll "p", with "e" and "i" first so it should be on the second layer of the merk + estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + + // we then need to insert the contract layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_contested_resource_active_polls_tree_path()), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), + }, + ); + + let document_type_count = contract.document_types().len() as u32; + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_contested_resource_active_polls_contract_tree_path( + contract.id_ref().as_bytes(), + )), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(document_type_count), + estimated_layer_sizes: AllSubtrees( + ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, + NoSumTrees, + None, + ), + }, + ); + + if let Some(document_type) = document_type { + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path( + vote_contested_resource_active_polls_contract_document_tree_path( + contract.id_ref().as_bytes(), + document_type.name().as_str(), + ), + ), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(2), + estimated_layer_sizes: AllSubtrees( + ESTIMATED_AVERAGE_INDEX_NAME_SIZE, + NoSumTrees, + None, + ), + }, + ); + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path( + vote_contested_resource_contract_documents_indexes_path( + contract.id_ref().as_bytes(), + document_type.name().as_str(), + ), + ), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(1024), //Just a guess + estimated_layer_sizes: AllSubtrees( + ESTIMATED_AVERAGE_INDEX_NAME_SIZE, + NoSumTrees, + None, + ), + }, + ); + } + } +} diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/mod.rs new file mode 100644 index 00000000000..ccb294ad2ba --- /dev/null +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/mod.rs @@ -0,0 +1,47 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; + +use grovedb::EstimatedLayerInformation; + +use dpp::data_contract::DataContract; +use std::collections::HashMap; + +impl Drive { + /// This function calls the versioned `add_estimation_costs_for_contested_document_tree_levels_up_to_contract_v0` + /// function based on the version provided in the `DriveVersion` parameter. It returns an error if the + /// version doesn't match any existing versioned functions. + /// + /// # Parameters + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a `HashMap` that holds the estimated layer information. + /// - `drive_version`: A reference to the `DriveVersion` object that specifies the version of the function to call. + pub(in crate::drive) fn add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded( + contract: &DataContract, + estimated_costs_only_with_layer_info: &mut HashMap, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .estimated_costs + .add_estimation_costs_for_contested_document_tree_levels_up_to_contract + { + 0 => { + Self::add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded_v0( + contract, + estimated_costs_only_with_layer_info, + ); + Ok(()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs new file mode 100644 index 00000000000..83f8c8dbc50 --- /dev/null +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs @@ -0,0 +1,115 @@ +use crate::drive::constants::ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE; + +use crate::drive::Drive; + +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::AllSubtrees; + +use crate::drive::votes::paths::{ + vote_contested_resource_active_polls_contract_tree_path, + vote_contested_resource_active_polls_tree_path, vote_contested_resource_tree_path, + vote_root_path, +}; +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::DataContract; +use grovedb::EstimatedSumTrees::{NoSumTrees, SomeSumTrees}; +use std::collections::HashMap; + +impl Drive { + /// Adds estimated costs for layers up to the contract level. + /// + /// This function populates the `estimated_costs_only_with_layer_info` hashmap with estimated layer information for the top level and the contract layer. + /// These estimates are useful for optimizing GroveDB operations. + /// + /// # Parameters + /// + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap that will be populated with estimated layer information for the top level and the contract layer. + /// + /// # Estimated Layer Information + /// + /// The function estimates two layers: + /// + /// 1. The top layer, which is an empty layer. + /// 2. The contract layer, which contains all global contracts. + /// + /// These estimates are useful for optimizing batch insertions, deletions, and other operations in GroveDB. + /// + /// # Usage + /// + /// This function is intended to be used internally within the Drive implementation. + /// + pub(in crate::drive) fn add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded_v0( + contract: &DataContract, + estimated_costs_only_with_layer_info: &mut HashMap, + ) { + // we have constructed the top layer so contract/documents tree are at the top + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path([]), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(2, false), //voting is on level 2 + // We have balances in the middle which is a sum tree + estimated_layer_sizes: AllSubtrees( + 1, + SomeSumTrees { + sum_trees_weight: 1, + non_sum_trees_weight: 2, + }, + None, + ), + }, + ); + + // we then need to insert the contract layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_root_path()), + EstimatedLayerInformation { + is_sum_tree: false, + // contested resource tree is a key of "c" so it should be on the top layer of the merk + estimated_layer_count: EstimatedLevel(0, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + + // we then need to insert the contract layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_contested_resource_tree_path()), + EstimatedLayerInformation { + is_sum_tree: false, + // active poll "p", with "e" and "i" first so it should be on the second layer of the merk + estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + + // we then need to insert the contract layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_contested_resource_active_polls_tree_path()), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), + }, + ); + + let document_type_count = contract.document_types().len() as u32; + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_contested_resource_active_polls_contract_tree_path( + contract.id_ref().as_bytes(), + )), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(document_type_count), + estimated_layer_sizes: AllSubtrees( + ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, + NoSumTrees, + None, + ), + }, + ); + } +} diff --git a/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/mod.rs rename to packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/mod.rs diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs new file mode 100644 index 00000000000..8bae767c7b2 --- /dev/null +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs @@ -0,0 +1,66 @@ +use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; + +use crate::drive::Drive; +use crate::util::storage_flags::StorageFlags; + +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::AllSubtrees; + +use crate::drive::contract::paths::all_contracts_global_root_path; + +use grovedb::EstimatedSumTrees::NoSumTrees; +use std::collections::HashMap; + +impl Drive { + /// Adds estimated costs for layers up to the contract level. + /// + /// This function populates the `estimated_costs_only_with_layer_info` hashmap with estimated layer information for the top level and the contract layer. + /// These estimates are useful for optimizing GroveDB operations. + /// + /// # Parameters + /// + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap that will be populated with estimated layer information for the top level and the contract layer. + /// + /// # Estimated Layer Information + /// + /// The function estimates two layers: + /// + /// 1. The top layer, which is an empty layer. + /// 2. The contract layer, which contains all global contracts. + /// + /// These estimates are useful for optimizing batch insertions, deletions, and other operations in GroveDB. + /// + /// # Usage + /// + /// This function is intended to be used internally within the Drive implementation. + /// + pub(in crate::drive) fn add_estimation_costs_for_levels_up_to_contract_v0( + estimated_costs_only_with_layer_info: &mut HashMap, + ) { + // we have constructed the top layer so contract/documents tree are at the top + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path([]), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(0, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), + }, + ); + + // we then need to insert the contract layer + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(all_contracts_global_root_path()), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: PotentiallyAtMaxElements, + estimated_layer_sizes: AllSubtrees( + DEFAULT_HASH_SIZE_U8, + NoSumTrees, + Some(StorageFlags::approximate_size(true, None)), + ), + }, + ); + } +} diff --git a/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/mod.rs rename to packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/mod.rs diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs new file mode 100644 index 00000000000..e9376cc3850 --- /dev/null +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs @@ -0,0 +1,86 @@ +use crate::drive::constants::ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE; + +use crate::drive::{contract_documents_path, Drive}; +use crate::util::storage_flags::StorageFlags; + +use dpp::data_contract::DataContract; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel}; +use grovedb::EstimatedLayerInformation; +use grovedb::EstimatedLayerSizes::AllSubtrees; + +use crate::drive::contract::paths::contract_root_path; +use crate::error::Error; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::config::v0::DataContractConfigGettersV0; +use dpp::version::drive_versions::DriveVersion; +use grovedb::EstimatedSumTrees::NoSumTrees; +use std::collections::HashMap; + +impl Drive { + /// Adds estimated costs for layers up to the contract layer, excluding document types. + /// + /// This function extends the estimates created by `add_estimation_costs_for_levels_up_to_contract` + /// by adding more specific estimated layer information for the given contract. It updates the + /// `estimated_costs_only_with_layer_info` hashmap to include estimates for the contract root and the + /// document path within the contract. + /// + /// # Parameters + /// + /// - `contract`: A reference to the DataContract for which the estimations are being made. + /// - `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap that holds the estimated layer information. + /// - `drive_version`: A reference to the current version of the Drive. + /// + /// # Returns + /// + /// - `Ok(())` if the operation is successful. + /// - `Err(Error)` if an error occurs, such as failing to add estimation costs for levels up to the contract. + /// + /// # Usage + /// + /// This function is intended to be used internally within the Drive implementation. + /// + pub(in crate::drive) fn add_estimation_costs_for_levels_up_to_contract_document_type_excluded_v0( + contract: &DataContract, + estimated_costs_only_with_layer_info: &mut HashMap, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + Self::add_estimation_costs_for_levels_up_to_contract( + estimated_costs_only_with_layer_info, + drive_version, + )?; + + let document_type_count = contract.document_types().len() as u32; + + // we only store the owner_id storage + let storage_flags = if contract.config().can_be_deleted() { + Some(StorageFlags::approximate_size(true, None)) + } else { + None + }; + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(contract_root_path(contract.id_ref().as_bytes())), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_sizes: AllSubtrees(1, NoSumTrees, storage_flags), + }, + ); + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(contract_documents_path(contract.id_ref().as_bytes())), + EstimatedLayerInformation { + is_sum_tree: false, + estimated_layer_count: ApproximateElements(document_type_count), + estimated_layer_sizes: AllSubtrees( + ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, + NoSumTrees, + storage_flags, + ), + }, + ); + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/mod.rs new file mode 100644 index 00000000000..d0d2bb88ca1 --- /dev/null +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/mod.rs @@ -0,0 +1,4 @@ +mod add_estimation_costs_for_contested_document_tree_levels_up_to_contract; +mod add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded; +mod add_estimation_costs_for_levels_up_to_contract; +mod add_estimation_costs_for_levels_up_to_contract_document_type_excluded; diff --git a/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs b/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs deleted file mode 100644 index c140f4ba779..00000000000 --- a/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs +++ /dev/null @@ -1,66 +0,0 @@ -use crate::drive::defaults::DEFAULT_HASH_SIZE_U8; - -use crate::drive::flags::StorageFlags; -use crate::drive::Drive; - -use grovedb::batch::KeyInfoPath; -use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; -use grovedb::EstimatedLayerSizes::AllSubtrees; - -use crate::drive::contract::paths::all_contracts_global_root_path; - -use grovedb::EstimatedSumTrees::NoSumTrees; -use std::collections::HashMap; - -impl Drive { - /// Adds estimated costs for layers up to the contract level. - /// - /// This function populates the `estimated_costs_only_with_layer_info` hashmap with estimated layer information for the top level and the contract layer. - /// These estimates are useful for optimizing GroveDB operations. - /// - /// # Parameters - /// - /// - `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap that will be populated with estimated layer information for the top level and the contract layer. - /// - /// # Estimated Layer Information - /// - /// The function estimates two layers: - /// - /// 1. The top layer, which is an empty layer. - /// 2. The contract layer, which contains all global contracts. - /// - /// These estimates are useful for optimizing batch insertions, deletions, and other operations in GroveDB. - /// - /// # Usage - /// - /// This function is intended to be used internally within the Drive implementation. - /// - pub(super) fn add_estimation_costs_for_levels_up_to_contract_v0( - estimated_costs_only_with_layer_info: &mut HashMap, - ) { - // we have constructed the top layer so contract/documents tree are at the top - estimated_costs_only_with_layer_info.insert( - KeyInfoPath::from_known_path([]), - EstimatedLayerInformation { - is_sum_tree: false, - estimated_layer_count: EstimatedLevel(0, false), - estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), - }, - ); - - // we then need to insert the contract layer - estimated_costs_only_with_layer_info.insert( - KeyInfoPath::from_known_path(all_contracts_global_root_path()), - EstimatedLayerInformation { - is_sum_tree: false, - estimated_layer_count: PotentiallyAtMaxElements, - estimated_layer_sizes: AllSubtrees( - DEFAULT_HASH_SIZE_U8, - NoSumTrees, - Some(StorageFlags::approximate_size(true, None)), - ), - }, - ); - } -} diff --git a/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs b/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs deleted file mode 100644 index 139dcd5bc44..00000000000 --- a/packages/rs-drive/src/drive/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs +++ /dev/null @@ -1,86 +0,0 @@ -use crate::drive::defaults::ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE; - -use crate::drive::flags::StorageFlags; -use crate::drive::{contract_documents_path, Drive}; - -use dpp::data_contract::DataContract; -use grovedb::batch::KeyInfoPath; -use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel}; -use grovedb::EstimatedLayerInformation; -use grovedb::EstimatedLayerSizes::AllSubtrees; - -use crate::drive::contract::paths::contract_root_path; -use crate::error::Error; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::config::v0::DataContractConfigGettersV0; -use dpp::version::drive_versions::DriveVersion; -use grovedb::EstimatedSumTrees::NoSumTrees; -use std::collections::HashMap; - -impl Drive { - /// Adds estimated costs for layers up to the contract layer, excluding document types. - /// - /// This function extends the estimates created by `add_estimation_costs_for_levels_up_to_contract` - /// by adding more specific estimated layer information for the given contract. It updates the - /// `estimated_costs_only_with_layer_info` hashmap to include estimates for the contract root and the - /// document path within the contract. - /// - /// # Parameters - /// - /// - `contract`: A reference to the DataContract for which the estimations are being made. - /// - `estimated_costs_only_with_layer_info`: A mutable reference to a hashmap that holds the estimated layer information. - /// - `drive_version`: A reference to the current version of the Drive. - /// - /// # Returns - /// - /// - `Ok(())` if the operation is successful. - /// - `Err(Error)` if an error occurs, such as failing to add estimation costs for levels up to the contract. - /// - /// # Usage - /// - /// This function is intended to be used internally within the Drive implementation. - /// - pub(super) fn add_estimation_costs_for_levels_up_to_contract_document_type_excluded_v0( - contract: &DataContract, - estimated_costs_only_with_layer_info: &mut HashMap, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - Self::add_estimation_costs_for_levels_up_to_contract( - estimated_costs_only_with_layer_info, - drive_version, - )?; - - let document_type_count = contract.document_types().len() as u32; - - // we only store the owner_id storage - let storage_flags = if contract.config().can_be_deleted() { - Some(StorageFlags::approximate_size(true, None)) - } else { - None - }; - - estimated_costs_only_with_layer_info.insert( - KeyInfoPath::from_known_path(contract_root_path(contract.id_ref().as_bytes())), - EstimatedLayerInformation { - is_sum_tree: false, - estimated_layer_count: EstimatedLevel(1, false), - estimated_layer_sizes: AllSubtrees(1, NoSumTrees, storage_flags), - }, - ); - - estimated_costs_only_with_layer_info.insert( - KeyInfoPath::from_known_path(contract_documents_path(contract.id_ref().as_bytes())), - EstimatedLayerInformation { - is_sum_tree: false, - estimated_layer_count: ApproximateElements(document_type_count), - estimated_layer_sizes: AllSubtrees( - ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, - NoSumTrees, - storage_flags, - ), - }, - ); - - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/shared_estimation_costs/mod.rs b/packages/rs-drive/src/drive/shared_estimation_costs/mod.rs deleted file mode 100644 index 052c33641a7..00000000000 --- a/packages/rs-drive/src/drive/shared_estimation_costs/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -mod add_estimation_costs_for_levels_up_to_contract; -mod add_estimation_costs_for_levels_up_to_contract_document_type_excluded; diff --git a/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs b/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs index d0ed16345cd..2d8a9d33bcc 100644 --- a/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs +++ b/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs @@ -10,42 +10,49 @@ use crate::drive::system::misc_path_vec; use grovedb::EstimatedSumTrees::SomeSumTrees; use std::collections::HashMap; +// DataContract_Documents 64 +// / \ +// Identities 32 Balances 96 +// / \ / \ +// Token_Balances 16 Pools 48 WithdrawalTransactions 80 Votes 112 +// / \ / / / \ +// NUPKH->I 8 UPKH->I 24 PreFundedSpecializedBalances 40 SpentAssetLockTransactions 72 -> Misc 104 <- Versions 120 + impl Drive { /// Adds estimation costs for total system credits update. /// /// This method operates on the provided HashMap, `estimated_costs_only_with_layer_info`, and adds /// new entries to it, representing the estimated costs for the total system credits update. + #[inline(always)] pub(super) fn add_estimation_costs_for_total_system_credits_update_v0( estimated_costs_only_with_layer_info: &mut HashMap, ) { - //todo: verify (this is wrong) // we have constructed the top layer so contract/documents tree are at the top - // since balance will be on layer 2, updating will mean we will update 1 sum tree - // and 1 normal tree, hence we should give an equal weight to both + // since balance will be on layer 3, updating will mean we will update 1 sum tree + // and 2 normal trees, hence we should give an equal weight to both estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { is_sum_tree: false, - estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( - 1, + 12, // about 32 + 1 + 1 / 3 SomeSumTrees { sum_trees_weight: 1, - non_sum_trees_weight: 1, + non_sum_trees_weight: 2, }, None, ), }, ); - //todo : verify this // we then need to insert the contract layer estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(misc_path_vec()), EstimatedLayerInformation { - is_sum_tree: true, - estimated_layer_count: ApproximateElements(0), - estimated_layer_sizes: AllItems(1, 64, None), + is_sum_tree: false, + estimated_layer_count: ApproximateElements(1), + estimated_layer_sizes: AllItems(1, 8, None), }, ); } diff --git a/packages/rs-drive/src/drive/system/fetch_elements/mod.rs b/packages/rs-drive/src/drive/system/fetch_elements/mod.rs new file mode 100644 index 00000000000..14969b2ea2c --- /dev/null +++ b/packages/rs-drive/src/drive/system/fetch_elements/mod.rs @@ -0,0 +1,41 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::version::PlatformVersion; +use grovedb::{Element, TransactionArg}; + +impl Drive { + /// This function calls the versioned `fetch_elements` + /// function based on the version provided in the `PlatformVersion` parameter. It panics if the + /// version doesn't match any existing versioned functions. + /// + /// # Parameters + /// - `path`: The path at which we want to prove the elements + /// - `keys`: The keys that we want to prove + /// - `transaction`: An optional grovedb transaction + /// - `platform_version`: A reference to the [PlatformVersion] object that specifies the version of + /// the function to call. + /// + /// # Returns + /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, + /// or an `Error` if the function fails. + pub fn fetch_elements( + &self, + path: Vec>, + keys: Vec>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version.drive.methods.fetch.fetch_elements { + 0 => self.fetch_elements_v0(path, keys, transaction, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_elements".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/system/fetch_elements/v0/mod.rs b/packages/rs-drive/src/drive/system/fetch_elements/v0/mod.rs new file mode 100644 index 00000000000..25ad7d4bba7 --- /dev/null +++ b/packages/rs-drive/src/drive/system/fetch_elements/v0/mod.rs @@ -0,0 +1,49 @@ +use crate::drive::Drive; +use crate::error::Error; + +use dpp::version::PlatformVersion; +use grovedb::query_result_type::QueryResultType::QueryElementResultType; +use grovedb::{Element, PathQuery, Query, SizedQuery, TransactionArg}; + +impl Drive { + /// This function fetches elements at keys at a specific path + /// + /// # Parameters + /// - `path`: The path at which we want to prove the elements + /// - `keys`: The keys that we want to prove + /// - `transaction`: An optional grovedb transaction + /// - `platform_version`: A reference to the [PlatformVersion] object that specifies the version of + /// the function to call. + /// + /// # Returns + /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, + /// or an `Error` if the function fails. + #[inline(always)] + pub(super) fn fetch_elements_v0( + &self, + path: Vec>, + keys: Vec>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut query = Query::default(); + query.insert_keys(keys); + let path_query = PathQuery { + path, + query: SizedQuery { + query, + limit: None, + offset: None, + }, + }; + let (result, _) = self.grove_get_path_query( + &path_query, + transaction, + QueryElementResultType, + &mut vec![], + &platform_version.drive, + )?; + + Ok(result.to_elements()) + } +} diff --git a/packages/rs-drive/src/drive/system/genesis_time/mod.rs b/packages/rs-drive/src/drive/system/genesis_time/mod.rs index 1f1d1b11978..cd888ccd313 100644 --- a/packages/rs-drive/src/drive/system/genesis_time/mod.rs +++ b/packages/rs-drive/src/drive/system/genesis_time/mod.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Genesis Time. //! //! This module defines functions relevant to the chain's genesis time. @@ -43,23 +14,23 @@ impl Drive { /// Returns the genesis time. Checks cache first, then storage. pub fn get_genesis_time(&self, transaction: TransactionArg) -> Result, Error> { // let's first check the cache - let cache = self.cache.read().unwrap(); + let genesis_time_ms = self.cache.genesis_time_ms.read(); let platform_version = PlatformVersion::latest(); - if cache.genesis_time_ms.is_some() { - return Ok(cache.genesis_time_ms); + if genesis_time_ms.is_some() { + return Ok(*genesis_time_ms); }; - drop(cache); + drop(genesis_time_ms); let epoch = Epoch::new(GENESIS_EPOCH_INDEX).unwrap(); match self.get_epoch_start_time(&epoch, transaction, platform_version) { Ok(genesis_time_ms) => { - let mut cache = self.cache.write().unwrap(); + let mut genesis_time_ms_cache = self.cache.genesis_time_ms.write(); - cache.genesis_time_ms = Some(genesis_time_ms); + *genesis_time_ms_cache = Some(genesis_time_ms); Ok(Some(genesis_time_ms)) } @@ -72,24 +43,24 @@ impl Drive { /// Sets genesis time pub fn set_genesis_time(&self, genesis_time_ms: u64) { - let mut cache = self.cache.write().unwrap(); - cache.genesis_time_ms = Some(genesis_time_ms); + let mut genesis_time_ms_cache = self.cache.genesis_time_ms.write(); + *genesis_time_ms_cache = Some(genesis_time_ms); } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use super::*; - use crate::tests::helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; + use crate::util::test_helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; mod get_genesis_time { use super::*; - use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; + use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; - use crate::drive::batch::GroveDbOpBatch; - use crate::fee_pools::epochs::operations_factory::EpochOperations; + use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; + use crate::util::batch::GroveDbOpBatch; #[test] fn should_return_none_if_cache_is_empty_and_start_time_is_not_persisted() { @@ -106,13 +77,13 @@ mod tests { fn should_return_some_if_cache_is_set() { let drive = setup_drive(None); - let mut cache = drive.cache.write().unwrap(); + let mut genesis_time_ms_cache = drive.cache.genesis_time_ms.write(); let genesis_time_ms = 100; - cache.genesis_time_ms = Some(genesis_time_ms); + *genesis_time_ms_cache = Some(genesis_time_ms); - drop(cache); + drop(genesis_time_ms_cache); let result = drive .get_genesis_time(None) @@ -138,7 +109,14 @@ mod tests { .add_init_empty_operations(&mut batch) .expect("should add init operations"); - epoch.add_init_current_operations(0.0, 1, 1, genesis_time_ms, &mut batch); + epoch.add_init_current_operations( + 0, + 1, + 1, + genesis_time_ms, + platform_version.protocol_version, + &mut batch, + ); drive .apply_batch_grovedb_operations( @@ -169,9 +147,9 @@ mod tests { drive.set_genesis_time(genesis_time_ms); - let cache = drive.cache.read().unwrap(); + let genesis_time_ms_cache = drive.cache.genesis_time_ms.read(); - assert!(matches!(cache.genesis_time_ms, Some(g) if g == genesis_time_ms)); + assert!(matches!(*genesis_time_ms_cache, Some(g) if g == genesis_time_ms)); } } } diff --git a/packages/rs-drive/src/drive/system/misc_tree_constants.rs b/packages/rs-drive/src/drive/system/misc_tree_constants.rs deleted file mode 100644 index 44a9fa2c23c..00000000000 --- a/packages/rs-drive/src/drive/system/misc_tree_constants.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// Protocol Version Storage key -pub const PROTOCOL_VERSION_STORAGE_KEY: &[u8; 1] = b"v"; - -/// Next Epoch Protocol Version Storage key -pub const NEXT_PROTOCOL_VERSION_STORAGE_KEY: &[u8; 1] = b"n"; diff --git a/packages/rs-drive/src/drive/system/mod.rs b/packages/rs-drive/src/drive/system/mod.rs index 7eaf69a5623..2e0b4d074b3 100644 --- a/packages/rs-drive/src/drive/system/mod.rs +++ b/packages/rs-drive/src/drive/system/mod.rs @@ -1,20 +1,19 @@ mod estimation_costs; +mod fetch_elements; /// Genesis time module -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub mod genesis_time; -/// Constants for the misc tree -pub mod misc_tree_constants; /// Protocol version module pub mod protocol_version; use crate::drive::RootTree; /// misc path -pub(crate) fn misc_path() -> [&'static [u8]; 1] { +pub fn misc_path() -> [&'static [u8]; 1] { [Into::<&[u8; 1]>::into(RootTree::Misc)] } /// misc path vector -pub(crate) fn misc_path_vec() -> Vec> { +pub fn misc_path_vec() -> Vec> { vec![Into::<&[u8; 1]>::into(RootTree::Misc).to_vec()] } diff --git a/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version.rs b/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version.rs new file mode 100644 index 00000000000..5f971c7cdb2 --- /dev/null +++ b/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version.rs @@ -0,0 +1,61 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::system::protocol_version::PROTOCOL_VERSION_AUX_KEY; +use dpp::util::deserializer::ProtocolVersion; +use grovedb::{GroveDb, TransactionArg}; +use integer_encoding::VarInt; + +/// +impl Drive { + /// Gets the current protocol version from aux storage + /// + /// !!!DON'T CHANGE!!!! + /// + /// This function should never be changed !!! since it's using + /// to get protocol version to read the state from the storage. + /// In plain English, this is the first function that we call, + /// so we don't know version yet. + /// + /// # Arguments + /// + /// * `transaction` - A `TransactionArg` object representing the transaction. + /// + /// # Returns + /// + /// * `Result, Error>` - If successful, returns an `Ok(Option)`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the Drive version is unknown. + pub fn fetch_current_protocol_version( + &self, + transaction: TransactionArg, + ) -> Result, Error> { + Drive::fetch_current_protocol_version_with_grovedb(&self.grove, transaction) + } + + pub(crate) fn fetch_current_protocol_version_with_grovedb( + grove: &GroveDb, + transaction: TransactionArg, + ) -> Result, Error> { + grove + .get_aux(PROTOCOL_VERSION_AUX_KEY, transaction) + .unwrap() + .map_err(Error::GroveDB) + .map(|bytes| { + bytes + .map(|bytes| { + let Some((protocol_version, _)) = ProtocolVersion::decode_var(&bytes) + else { + return Err(Error::Drive(DriveError::CorruptedSerialization( + String::from("protocol version incorrectly serialized"), + ))); + }; + Ok(protocol_version) + }) + .transpose() + })? + } +} diff --git a/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version/mod.rs deleted file mode 100644 index 78e654cc382..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version/mod.rs +++ /dev/null @@ -1,44 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; - -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Gets the current protocol version from the backing store - /// - /// # Arguments - /// - /// * `transaction` - A `TransactionArg` object representing the transaction. - /// - /// # Returns - /// - /// * `Result, Error>` - If successful, returns an `Ok(Option)`. If an error occurs during the operation, returns an `Error`. - /// - /// # Errors - /// - /// This function will return an error if the Drive version is unknown. - pub fn fetch_current_protocol_version( - &self, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version - .methods - .platform_system - .protocol_version - .fetch_current_protocol_version - { - 0 => self.fetch_current_protocol_version_v0(transaction), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "fetch_current_protocol_version".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version/v0/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version/v0/mod.rs deleted file mode 100644 index a8035d3049e..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/fetch_current_protocol_version/v0/mod.rs +++ /dev/null @@ -1,40 +0,0 @@ -use crate::drive::system::misc_path; -use crate::drive::system::misc_tree_constants::PROTOCOL_VERSION_STORAGE_KEY; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; - -use dpp::util::deserializer::ProtocolVersion; -use grovedb::TransactionArg; -use integer_encoding::VarInt; - -impl Drive { - /// Gets the current protocol version from the backing store - pub(super) fn fetch_current_protocol_version_v0( - &self, - transaction: TransactionArg, - ) -> Result, Error> { - let misc_path = misc_path(); - self.grove - .get_raw_optional( - (&misc_path).into(), - PROTOCOL_VERSION_STORAGE_KEY, - transaction, - ) - .unwrap() - .map_err(Error::GroveDB) - .map(|maybe_element| { - maybe_element - .map(|e| { - let bytes = e.as_item_bytes()?; - let Some((protocol_version, _)) = ProtocolVersion::decode_var(bytes) else { - return Err(Error::Drive(DriveError::CorruptedSerialization( - String::from("protocol version incorrectly serialized"), - ))); - }; - Ok(protocol_version) - }) - .transpose() - })? - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/fetch_next_protocol_version/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/fetch_next_protocol_version/mod.rs deleted file mode 100644 index 854f35d2594..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/fetch_next_protocol_version/mod.rs +++ /dev/null @@ -1,44 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; - -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Gets the next protocol version from the backing store - /// - /// # Arguments - /// - /// * `transaction` - A `TransactionArg` object representing the transaction. - /// - /// # Returns - /// - /// * `Result, Error>` - If successful, returns an `Ok(Option)`. If an error occurs during the operation, returns an `Error`. - /// - /// # Errors - /// - /// This function will return an error if the Drive version is unknown. - pub fn fetch_next_protocol_version( - &self, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result, Error> { - match drive_version - .methods - .platform_system - .protocol_version - .fetch_next_protocol_version - { - 0 => self.fetch_next_protocol_version_v0(transaction), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "fetch_next_protocol_version".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/fetch_next_protocol_version/v0/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/fetch_next_protocol_version/v0/mod.rs deleted file mode 100644 index 4212321adfb..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/fetch_next_protocol_version/v0/mod.rs +++ /dev/null @@ -1,41 +0,0 @@ -use crate::drive::system::misc_path; -use crate::drive::system::misc_tree_constants::NEXT_PROTOCOL_VERSION_STORAGE_KEY; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; - -use dpp::util::deserializer::ProtocolVersion; - -use grovedb::TransactionArg; -use integer_encoding::VarInt; - -impl Drive { - /// Gets the next protocol version from the backing store - pub(super) fn fetch_next_protocol_version_v0( - &self, - transaction: TransactionArg, - ) -> Result, Error> { - let misc_path = misc_path(); - self.grove - .get_raw_optional( - (&misc_path).into(), - NEXT_PROTOCOL_VERSION_STORAGE_KEY, - transaction, - ) - .unwrap() - .map_err(Error::GroveDB) - .map(|maybe_element| { - maybe_element - .map(|e| { - let bytes = e.as_item_bytes()?; - let Some((protocol_version, _)) = ProtocolVersion::decode_var(bytes) else { - return Err(Error::Drive(DriveError::CorruptedSerialization( - String::from("protocol version incorrectly serialized"), - ))); - }; - Ok(protocol_version) - }) - .transpose() - })? - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/mod.rs index 2f93b44a5c0..779deab3431 100644 --- a/packages/rs-drive/src/drive/system/protocol_version/mod.rs +++ b/packages/rs-drive/src/drive/system/protocol_version/mod.rs @@ -1,8 +1,6 @@ mod fetch_current_protocol_version; -pub use fetch_current_protocol_version::*; -mod fetch_next_protocol_version; -pub use fetch_next_protocol_version::*; -mod set_current_protocol_version_operations; -pub use set_current_protocol_version_operations::*; -mod set_next_protocol_version_operations; -pub use set_next_protocol_version_operations::*; + +mod store_current_protocol_version; + +/// Protocol Version Storage key +const PROTOCOL_VERSION_AUX_KEY: &[u8; 16] = b"protocol_version"; diff --git a/packages/rs-drive/src/drive/system/protocol_version/set_current_protocol_version_operations/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/set_current_protocol_version_operations/mod.rs deleted file mode 100644 index 8e271bb055d..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/set_current_protocol_version_operations/mod.rs +++ /dev/null @@ -1,54 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Sets the current protocol version - /// - /// # Arguments - /// - /// * `protocol_version` - A `ProtocolVersion` object representing the current protocol version. - /// * `transaction` - A `TransactionArg` object representing the transaction. - /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` objects. - /// * `drive_version` - A `DriveVersion` object representing the version of the Drive. - /// - /// # Returns - /// - /// * `Result<(), Error>` - If successful, returns an `Ok(())`. If an error occurs during the operation, returns an `Error`. - /// - /// # Errors - /// - /// This function will return an error if the version of the Drive is unknown. - pub fn set_current_protocol_version_operations( - &self, - protocol_version: ProtocolVersion, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .methods - .platform_system - .protocol_version - .set_current_protocol_version_operations - { - 0 => self.set_current_protocol_version_operations_v0( - protocol_version, - transaction, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "set_current_protocol_version_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/set_current_protocol_version_operations/v0/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/set_current_protocol_version_operations/v0/mod.rs deleted file mode 100644 index c91ec847d9d..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/set_current_protocol_version_operations/v0/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -use crate::drive::grove_operations::BatchInsertApplyType; -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::system::misc_path; -use crate::drive::system::misc_tree_constants::PROTOCOL_VERSION_STORAGE_KEY; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, TransactionArg}; -use integer_encoding::VarInt; - -impl Drive { - /// Sets the current protocol version - pub(super) fn set_current_protocol_version_operations_v0( - &self, - protocol_version: ProtocolVersion, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - self.batch_insert_if_changed_value( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - misc_path(), - PROTOCOL_VERSION_STORAGE_KEY, - Element::new_item(protocol_version.encode_var_vec()), - )), - BatchInsertApplyType::StatefulBatchInsert, - transaction, - drive_operations, - drive_version, - )?; - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/set_next_protocol_version_operations/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/set_next_protocol_version_operations/mod.rs deleted file mode 100644 index 06dd6e5b040..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/set_next_protocol_version_operations/mod.rs +++ /dev/null @@ -1,54 +0,0 @@ -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::drive_versions::DriveVersion; -use grovedb::TransactionArg; - -impl Drive { - /// Sets the next protocol version - /// - /// # Arguments - /// - /// * `protocol_version` - A `ProtocolVersion` object representing the next protocol version. - /// * `transaction` - A `TransactionArg` object representing the transaction. - /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` objects. - /// * `drive_version` - A `DriveVersion` object representing the version of the Drive. - /// - /// # Returns - /// - /// * `Result<(), Error>` - If successful, returns an `Ok(())`. If an error occurs during the operation, returns an `Error`. - /// - /// # Errors - /// - /// This function will return an error if the version of the Drive is unknown. - pub fn set_next_protocol_version_operations( - &self, - protocol_version: ProtocolVersion, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - match drive_version - .methods - .platform_system - .protocol_version - .set_next_protocol_version_operations - { - 0 => self.set_next_protocol_version_operations_v0( - protocol_version, - transaction, - drive_operations, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "set_next_protocol_version_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/set_next_protocol_version_operations/v0/mod.rs b/packages/rs-drive/src/drive/system/protocol_version/set_next_protocol_version_operations/v0/mod.rs deleted file mode 100644 index 451fc5ef430..00000000000 --- a/packages/rs-drive/src/drive/system/protocol_version/set_next_protocol_version_operations/v0/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -use crate::drive::grove_operations::BatchInsertApplyType; -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::drive::system::misc_path; -use crate::drive::system::misc_tree_constants::NEXT_PROTOCOL_VERSION_STORAGE_KEY; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, TransactionArg}; -use integer_encoding::VarInt; - -impl Drive { - /// Sets the next protocol version - pub(super) fn set_next_protocol_version_operations_v0( - &self, - protocol_version: ProtocolVersion, - transaction: TransactionArg, - drive_operations: &mut Vec, - drive_version: &DriveVersion, - ) -> Result<(), Error> { - self.batch_insert_if_changed_value( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - misc_path(), - NEXT_PROTOCOL_VERSION_STORAGE_KEY, - Element::new_item(protocol_version.encode_var_vec()), - )), - BatchInsertApplyType::StatefulBatchInsert, - transaction, - drive_operations, - drive_version, - )?; - Ok(()) - } -} diff --git a/packages/rs-drive/src/drive/system/protocol_version/store_current_protocol_version.rs b/packages/rs-drive/src/drive/system/protocol_version/store_current_protocol_version.rs new file mode 100644 index 00000000000..c63987cd9b0 --- /dev/null +++ b/packages/rs-drive/src/drive/system/protocol_version/store_current_protocol_version.rs @@ -0,0 +1,29 @@ +use crate::drive::system::protocol_version::PROTOCOL_VERSION_AUX_KEY; +use crate::drive::Drive; +use crate::error::Error; +use dpp::util::deserializer::ProtocolVersion; +use grovedb::TransactionArg; +use integer_encoding::VarInt; + +impl Drive { + /// Store the current protocol version in aux storage + /// + /// !!!DON'T CHANGE!!!! + /// This function should never be changed !!! since it must always be compatible + /// with fetch_current_protocol_version which is should never be changed. + pub fn store_current_protocol_version( + &self, + protocol_version: ProtocolVersion, + transaction: TransactionArg, + ) -> Result<(), Error> { + self.grove + .put_aux( + PROTOCOL_VERSION_AUX_KEY, + &protocol_version.encode_var_vec(), + None, + transaction, + ) + .unwrap() + .map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/drive/system_contracts_cache.rs b/packages/rs-drive/src/drive/system_contracts_cache.rs deleted file mode 100644 index 71e95262445..00000000000 --- a/packages/rs-drive/src/drive/system_contracts_cache.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::error::Error; -use dpp::data_contract::DataContract; -use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; - -/// System contracts -pub struct SystemContracts { - /// Withdrawal contract - pub withdrawal_contract: DataContract, - /// DPNS contract - pub dpns_contract: DataContract, - /// Dashpay contract - pub dashpay_contract: DataContract, - /// Masternode reward shares contract - pub masternode_rewards: DataContract, -} - -impl SystemContracts { - /// load genesis system contracts - pub fn load_genesis_system_contracts(protocol_version: u32) -> Result { - Ok(SystemContracts { - withdrawal_contract: load_system_data_contract( - SystemDataContract::Withdrawals, - protocol_version, - )?, - dpns_contract: load_system_data_contract(SystemDataContract::DPNS, protocol_version)?, - dashpay_contract: load_system_data_contract( - SystemDataContract::Dashpay, - protocol_version, - )?, - masternode_rewards: load_system_data_contract( - SystemDataContract::MasternodeRewards, - protocol_version, - )?, - }) - } -} diff --git a/packages/rs-drive/src/drive/test_utils.rs b/packages/rs-drive/src/drive/test_utils.rs deleted file mode 100644 index 8b11a919f45..00000000000 --- a/packages/rs-drive/src/drive/test_utils.rs +++ /dev/null @@ -1,24 +0,0 @@ -use std::cell::RefCell; - -use dpp::util::entropy_generator::EntropyGenerator; -use rand::{rngs::SmallRng, Rng, SeedableRng}; - -/// test entropy generator -pub(crate) struct TestEntropyGenerator { - rng: RefCell, -} - -impl TestEntropyGenerator { - /// new test entropy generator - pub(crate) fn new() -> Self { - Self { - rng: RefCell::new(SmallRng::seed_from_u64(1337)), - } - } -} - -impl EntropyGenerator for TestEntropyGenerator { - fn generate(&self) -> anyhow::Result<[u8; 32]> { - Ok(self.rng.borrow_mut().gen()) - } -} diff --git a/packages/rs-drive/src/drive/verify/contract/verify_contract/mod.rs b/packages/rs-drive/src/drive/verify/contract/verify_contract/mod.rs deleted file mode 100644 index f695635b978..00000000000 --- a/packages/rs-drive/src/drive/verify/contract/verify_contract/mod.rs +++ /dev/null @@ -1,66 +0,0 @@ -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::data_contract::DataContract; -use dpp::version::PlatformVersion; - -mod v0; - -impl Drive { - /// Verifies that the contract is included in the proof. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `contract_known_keeps_history`: An optional boolean indicating whether the contract keeps a history. - /// - `is_proof_subset`: A boolean indicating whether to verify a subset of a larger proof. - /// - `in_multiple_contract_proof_form`: If the contract proof was made by proving many contracts, the form - /// of the proof will be different. We will be querying the contract id with a translation to 0 for non - /// historical and 0/0 for historical contracts. When you query a single contract you query directly on the item - /// 0 under the contract id you care about. - /// - `contract_id`: The contract's unique identifier. - /// - `platform_version`: the platform version, - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` - /// represents the verified contract if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub fn verify_contract( - proof: &[u8], - contract_known_keeps_history: Option, - is_proof_subset: bool, - in_multiple_contract_proof_form: bool, - contract_id: [u8; 32], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - match platform_version - .drive - .methods - .verify - .contract - .verify_contract - { - 0 => Drive::verify_contract_v0( - proof, - contract_known_keeps_history, - is_proof_subset, - in_multiple_contract_proof_form, - contract_id, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_contract".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/contract/verify_contract/v0/mod.rs b/packages/rs-drive/src/drive/verify/contract/verify_contract/v0/mod.rs deleted file mode 100644 index 8fa2eb02d97..00000000000 --- a/packages/rs-drive/src/drive/verify/contract/verify_contract/v0/mod.rs +++ /dev/null @@ -1,255 +0,0 @@ -use std::collections::BTreeMap; - -use crate::drive::contract::paths::{contract_keeping_history_storage_path, contract_root_path}; -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::proof::ProofError; -use crate::error::Error; -use crate::error::Error::GroveDB; -use dpp::prelude::DataContract; -use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; -use platform_version::version::PlatformVersion; - -use crate::error::query::QuerySyntaxError; -use grovedb::GroveDb; - -impl Drive { - /// Verifies that the contract is included in the proof. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `contract_known_keeps_history`: An optional boolean indicating whether the contract keeps a history. - /// - `is_proof_subset`: A boolean indicating whether to verify a subset of a larger proof. - /// - `contract_id`: The contract's unique identifier. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` - /// represents the verified contract if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub(super) fn verify_contract_v0( - proof: &[u8], - contract_known_keeps_history: Option, - is_proof_subset: bool, - in_multiple_contract_proof_form: bool, - contract_id: [u8; 32], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - let path_query = match ( - in_multiple_contract_proof_form, - contract_known_keeps_history.unwrap_or_default(), - ) { - (true, true) => Self::fetch_historical_contracts_query(&[contract_id]), - (true, false) => Self::fetch_non_historical_contracts_query(&[contract_id]), - (false, true) => Self::fetch_contract_with_history_latest_query(contract_id, true), - (false, false) => Self::fetch_contract_query(contract_id, true), - }; - - tracing::trace!(?path_query, "verify contract"); - - let result = if is_proof_subset { - GroveDb::verify_subset_query_with_absence_proof(proof, &path_query) - } else { - GroveDb::verify_query_with_absence_proof(proof, &path_query) - }; - let (root_hash, mut proved_key_values) = match result.map_err(GroveDB) { - Ok(ok_result) => ok_result, - Err(e) => { - return if contract_known_keeps_history.is_none() { - tracing::debug!(?path_query,error=?e, "retrying contract verification with history enabled"); - // most likely we are trying to prove a historical contract - Self::verify_contract( - proof, - Some(true), - is_proof_subset, - in_multiple_contract_proof_form, - contract_id, - platform_version, - ) - } else { - Err(e) - }; - } - }; - if proved_key_values.len() == 0 { - return Err(Error::Proof(ProofError::WrongElementCount { - expected: 1, - got: proved_key_values.len(), - })); - } - if proved_key_values.len() == 1 { - let (path, key, maybe_element) = proved_key_values.remove(0); - if contract_known_keeps_history.unwrap_or_default() { - if path != contract_keeping_history_storage_path(&contract_id) { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct path for the historical contract".to_string(), - ))); - } - } else if path != contract_root_path(&contract_id) { - if key != vec![0] { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct key for the contract" - .to_string(), - ))); - } - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct path for the historical contract".to_string(), - ))); - }; - tracing::trace!(?maybe_element, "verify contract returns proved element"); - - let contract = maybe_element - .map(|element| { - element - .into_item_bytes() - .map_err(Error::GroveDB) - .and_then(|bytes| { - // we don't need to validate the contract locally because it was proved to be in platform - // and hence it is valid - DataContract::versioned_deserialize(&bytes, false, platform_version) - .map_err(Error::Protocol) - }) - }) - .transpose(); - match contract { - Ok(contract) => Ok((root_hash, contract)), - Err(e) => { - if contract_known_keeps_history.is_some() { - // just return error - Err(e) - } else { - tracing::debug!(?path_query,error=?e, "retry contract verification with history enabled"); - Self::verify_contract( - proof, - Some(true), - is_proof_subset, - in_multiple_contract_proof_form, - contract_id, - platform_version, - ) - } - } - } - } else { - Err(Error::Proof(ProofError::TooManyElements( - "expected one contract id", - ))) - } - } - - /// Verifies that the contracts is included in the proof. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `is_proof_subset`: A boolean indicating whether to verify a subset of a larger proof. - /// - `contract_ids_with_keeps_history` a BTreemap with keys being the contract ids we are looking - /// to search for, values being if they keep history. For this call we must know if they keep - /// history. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` - /// represents the verified contract if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub fn verify_contracts( - proof: &[u8], - _is_proof_subset: bool, //this will be used later - contract_ids: &[[u8; 32]], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, BTreeMap<[u8; 32], Option>), Error> { - let request_len = contract_ids.len(); - - if request_len == 0 { - return Err(Error::Query(QuerySyntaxError::NoQueryItems( - "we didn't query anything", - ))); - } - - let mut contracts = BTreeMap::new(); - - let mut returned_root_hash = None; - - for contract_id in contract_ids { - let (root_hash, contract) = - Self::verify_contract(proof, None, true, true, *contract_id, platform_version)?; - returned_root_hash = Some(root_hash); - contracts.insert(*contract_id, contract); - } - - // let mut contracts_query = Self::fetch_contracts_query( - // non_historical_contracts.as_slice(), - // historical_contracts.as_slice(), - // )?; - // - // contracts_query.query.limit = Some(request_len as u16); - // - // //todo: we are currently not proving succintness, a new method is required in grovedb - // let (root_hash, mut proved_key_values) = GroveDb::verify_subset_query_with_absence_proof(proof, &contracts_query)?; - // - // let contracts = proved_key_values.into_iter().map(|(path, key, maybe_element) | { - // let last_part = path.last().ok_or(Error::Proof(ProofError::CorruptedProof( - // "path of a proved item was empty".to_string(), - // )))?; - // let (contract_id, contract_keeps_history) = if last_part.len() == 32 { // non history - // let contract_id : [u8;32] = last_part.clone().try_into().expect("expected 32 bytes"); - // (contract_id, false) - // } else { - // if path.len() == 0 { - // return Err(Error::Proof(ProofError::CorruptedProof( - // "path of a proved item wasn't big enough".to_string(), - // ))); - // } - // let before_last_part = path.get(path.len() - 2).ok_or(Error::Proof(ProofError::CorruptedProof( - // "we got back an invalid proof, the path was empty".to_string(), - // )))?; - // if before_last_part.len() != 32 { - // return Err(Error::Proof(ProofError::CorruptedProof( - // "the contract id wasn't 32 bytes".to_string(), - // ))); - // } - // // otherwise the key is the time and the previous to last member of the path is the contract id - // let before_last_part : [u8;32] = before_last_part.clone().try_into().expect("expected 32 bytes"); - // (before_last_part, true) - // }; - // if contract_keeps_history { - // if path != contract_keeping_history_storage_path(&contract_id) { - // return Err(Error::Proof(ProofError::CorruptedProof( - // format!("we did not get back an element for the correct path for the historical contract, received: ({})", path.iter().map(|a| a.to_hex()).collect::>().join("|")), - // ))); - // } - // } else if path != contract_root_path(&contract_id) { - // return Err(Error::Proof(ProofError::CorruptedProof( - // format!("we did not get back an element for the correct path for the non historical contract, received: ({})", path.iter().map(|a| a.to_hex()).collect::>().join("|")), - // ))); - // }; - // - // let contract = maybe_element - // .map(|element| { - // element - // .into_item_bytes() - // .map_err(Error::GroveDB) - // .and_then(|bytes| { - // DataContract::deserialize_no_limit(&bytes).map_err(Error::Protocol) - // }) - // }) - // .transpose()?; - // Ok((root_hash, contract)) - // }).collect::>, Error>>()?; - - Ok((returned_root_hash.unwrap(), contracts)) - } -} diff --git a/packages/rs-drive/src/drive/verify/contract/verify_contract_history/mod.rs b/packages/rs-drive/src/drive/verify/contract/verify_contract_history/mod.rs deleted file mode 100644 index 1f5bcea124d..00000000000 --- a/packages/rs-drive/src/drive/verify/contract/verify_contract_history/mod.rs +++ /dev/null @@ -1,65 +0,0 @@ -mod v0; - -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::data_contract::DataContract; -use dpp::version::PlatformVersion; -use std::collections::BTreeMap; - -impl Drive { - /// Verifies that the contract's history is included in the proof. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `contract_id`: The contract's unique identifier. - /// - `start_at_date`: The start date for the contract's history. - /// - `limit`: An optional limit for the number of items to be retrieved. - /// - `offset`: An optional offset for the items to be retrieved. - /// - `platform_version`: The platform version. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` - /// represents a mapping from dates to contracts if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - /// - The contract serialization fails. - pub fn verify_contract_history( - proof: &[u8], - contract_id: [u8; 32], - start_at_date: u64, - limit: Option, - offset: Option, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option>), Error> { - match platform_version - .drive - .methods - .verify - .contract - .verify_contract_history - { - 0 => Drive::verify_contract_history_v0( - proof, - contract_id, - start_at_date, - limit, - offset, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_contract_history".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/contract/verify_contract_history/v0/mod.rs b/packages/rs-drive/src/drive/verify/contract/verify_contract_history/v0/mod.rs deleted file mode 100644 index c6fdd207cef..00000000000 --- a/packages/rs-drive/src/drive/verify/contract/verify_contract_history/v0/mod.rs +++ /dev/null @@ -1,91 +0,0 @@ -use crate::drive::contract::paths::contract_storage_path_vec; -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::proof::ProofError; -use crate::error::Error; - -use dpp::prelude::DataContract; -use std::collections::BTreeMap; - -use crate::common::decode; -use crate::error::drive::DriveError; -use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; -use dpp::version::PlatformVersion; -use grovedb::GroveDb; - -impl Drive { - /// Verifies that the contract's history is included in the proof. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `contract_id`: The contract's unique identifier. - /// - `start_at_date`: The start date for the contract's history. - /// - `limit`: An optional limit for the number of items to be retrieved. - /// - `offset`: An optional offset for the items to be retrieved. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` - /// represents a mapping from dates to contracts if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - /// - The contract serialization fails. - pub(super) fn verify_contract_history_v0( - proof: &[u8], - contract_id: [u8; 32], - start_at_date: u64, - limit: Option, - offset: Option, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option>), Error> { - let path_query = - Self::fetch_contract_history_query(contract_id, start_at_date, limit, offset)?; - - let (root_hash, mut proved_key_values) = GroveDb::verify_query(proof, &path_query)?; - - let mut contracts: BTreeMap = BTreeMap::new(); - for (path, key, maybe_element) in proved_key_values.drain(..) { - if path != contract_storage_path_vec(&contract_id) { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct path for the historical contract".to_string(), - ))); - } - - let date = decode::decode_u64(&key).map_err(|_| { - Error::Drive(DriveError::CorruptedContractPath( - "contract key is not a valid u64", - )) - })?; - - let maybe_contract = maybe_element - .map(|element| { - element - .into_item_bytes() - .map_err(Error::GroveDB) - .and_then(|bytes| { - // we don't need to validate the contract locally because it was proved to be in platform - // and hence it is valid - DataContract::versioned_deserialize(&bytes, false, platform_version) - .map_err(Error::Protocol) - }) - }) - .transpose()?; - - if let Some(contract) = maybe_contract { - contracts.insert(date, contract); - } else { - return Err(Error::Drive(DriveError::CorruptedContractPath( - "expected a contract at this path", - ))); - } - } - - Ok((root_hash, Some(contracts))) - } -} diff --git a/packages/rs-drive/src/drive/verify/document/verify_proof/mod.rs b/packages/rs-drive/src/drive/verify/document/verify_proof/mod.rs deleted file mode 100644 index 51d4037b3cb..00000000000 --- a/packages/rs-drive/src/drive/verify/document/verify_proof/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -mod v0; - -use crate::drive::verify::RootHash; -use crate::error::drive::DriveError; - -use crate::error::Error; -use crate::query::DriveQuery; -use dpp::document::Document; - -use dpp::version::PlatformVersion; - -impl<'a> DriveQuery<'a> { - /// Verifies a proof for a collection of documents. - /// - /// This function takes a byte slice representing the serialized proof, verifies it, and returns a tuple consisting of the root hash - /// and a vector of deserialized documents. - /// - /// # Arguments - /// - /// * `proof` - A byte slice representing the proof to be verified. - /// * `platform_version` - The platform version against which to verify the proof. - /// - /// # Returns - /// - /// A `Result` containing: - /// * A tuple with the root hash and a vector of deserialized `Document`s if the proof is valid. - /// * An `Error` variant, in case the proof verification fails or a deserialization error occurs. - /// - /// # Errors - /// - /// This function will return an `Error` variant if: - /// 1. The proof verification fails. - /// 2. A deserialization error occurs when parsing the serialized document(s). - pub fn verify_proof( - &self, - proof: &[u8], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Vec), Error> { - match platform_version.drive.methods.verify.document.verify_proof { - 0 => self.verify_proof_v0(proof, platform_version), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_proof".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/document/verify_proof/v0/mod.rs b/packages/rs-drive/src/drive/verify/document/verify_proof/v0/mod.rs deleted file mode 100644 index 5225ceeb02a..00000000000 --- a/packages/rs-drive/src/drive/verify/document/verify_proof/v0/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -use crate::drive::verify::RootHash; - -use crate::error::Error; -use crate::query::DriveQuery; -use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; -use dpp::document::Document; - -use dpp::version::PlatformVersion; - -impl<'a> DriveQuery<'a> { - /// Verifies a proof for a collection of documents. - /// - /// This function takes a slice of bytes `proof` containing a serialized proof, - /// verifies it, and returns a tuple consisting of the root hash and a vector of deserialized documents. - /// - /// # Arguments - /// - /// * `proof` - A byte slice representing the proof to be verified. - /// * `drive_version` - The current active drive version - /// - /// # Returns - /// - /// A `Result` containing: - /// * A tuple with the root hash and a vector of deserialized `Document`s, if the proof is valid. - /// * An `Error` variant, in case the proof verification fails or deserialization error occurs. - /// - /// # Errors - /// - /// This function will return an `Error` variant if: - /// 1. The proof verification fails. - /// 2. There is a deserialization error when parsing the serialized document(s) into `Document` struct(s). - pub(super) fn verify_proof_v0( - &self, - proof: &[u8], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Vec), Error> { - self.verify_proof_keep_serialized(proof, platform_version) - .map(|(root_hash, documents)| { - let documents = documents - .into_iter() - .map(|serialized| { - Document::from_bytes( - serialized.as_slice(), - self.document_type, - platform_version, - ) - .map_err(Error::Protocol) - }) - .collect::, Error>>()?; - Ok((root_hash, documents)) - })? - } -} diff --git a/packages/rs-drive/src/drive/verify/document/verify_proof_keep_serialized/mod.rs b/packages/rs-drive/src/drive/verify/document/verify_proof_keep_serialized/mod.rs deleted file mode 100644 index a8e5df31820..00000000000 --- a/packages/rs-drive/src/drive/verify/document/verify_proof_keep_serialized/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -mod v0; - -use crate::drive::verify::RootHash; -use crate::error::drive::DriveError; - -use crate::error::Error; -use crate::query::DriveQuery; - -use dpp::version::PlatformVersion; - -impl<'a> DriveQuery<'a> { - /// Verifies the given proof and returns the root hash of the GroveDB tree and a vector - /// of serialized documents if the verification is successful. - /// - /// # Arguments - /// * `proof` - A byte slice representing the proof to be verified. - /// * `platform_version` - The platform version against which to verify the proof. - /// - /// # Returns - /// * On success, returns a tuple containing the root hash of the GroveDB tree and a vector of serialized documents. - /// * On failure, returns an Error. - /// - /// # Errors - /// This function will return an Error if: - /// 1. The start at document is not present in proof and it is expected to be. - /// 2. The path query fails to verify against the given proof. - /// 3. Converting the element into bytes fails. - pub fn verify_proof_keep_serialized( - &self, - proof: &[u8], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Vec>), Error> { - match platform_version - .drive - .methods - .verify - .document - .verify_proof_keep_serialized - { - 0 => self.verify_proof_keep_serialized_v0(proof, platform_version), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_proof_keep_serialized".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/document/verify_proof_keep_serialized/v0/mod.rs b/packages/rs-drive/src/drive/verify/document/verify_proof_keep_serialized/v0/mod.rs deleted file mode 100644 index b7a8f206a98..00000000000 --- a/packages/rs-drive/src/drive/verify/document/verify_proof_keep_serialized/v0/mod.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::drive::verify::RootHash; - -use crate::error::proof::ProofError; -use crate::error::Error; -use crate::query::DriveQuery; - -use dpp::version::PlatformVersion; -use grovedb::GroveDb; - -impl<'a> DriveQuery<'a> { - /// Verifies the given proof and returns the root hash of the GroveDB tree and a vector - /// of serialized documents if the verification is successful. - /// - /// # Arguments - /// * `proof` - A byte slice representing the proof to be verified. - /// - /// # Returns - /// * On success, returns a tuple containing the root hash of the GroveDB tree and a vector of serialized documents. - /// * On failure, returns an Error. - /// - /// # Errors - /// This function will return an Error if: - /// * The start at document is not present in proof and it is expected to be. - /// * The path query fails to verify against the given proof. - /// * Converting the element into bytes fails. - pub(super) fn verify_proof_keep_serialized_v0( - &self, - proof: &[u8], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Vec>), Error> { - let path_query = if let Some(start_at) = &self.start_at { - let (_, start_document) = - self.verify_start_at_document_in_proof(proof, true, *start_at, platform_version)?; - let document = start_document.ok_or(Error::Proof(ProofError::IncompleteProof( - "expected start at document to be present in proof", - )))?; - self.construct_path_query(Some(document), platform_version) - } else { - self.construct_path_query(None, platform_version) - }?; - let (root_hash, proved_key_values) = if self.start_at.is_some() { - GroveDb::verify_subset_query(proof, &path_query)? - } else { - GroveDb::verify_query(proof, &path_query)? - }; - - let documents = proved_key_values - .into_iter() - .filter_map(|(_path, _key, element)| element) - .map(|element| element.into_item_bytes().map_err(Error::GroveDB)) - .collect::>, Error>>()?; - Ok((root_hash, documents)) - } -} diff --git a/packages/rs-drive/src/drive/verify/document/verify_start_at_document_in_proof/mod.rs b/packages/rs-drive/src/drive/verify/document/verify_start_at_document_in_proof/mod.rs deleted file mode 100644 index 7fae3e83b1a..00000000000 --- a/packages/rs-drive/src/drive/verify/document/verify_start_at_document_in_proof/mod.rs +++ /dev/null @@ -1,60 +0,0 @@ -mod v0; - -use crate::drive::verify::RootHash; -use crate::error::drive::DriveError; - -use crate::error::Error; -use crate::query::DriveQuery; -use dpp::document::Document; -use dpp::version::PlatformVersion; - -impl<'a> DriveQuery<'a> { - /// Verifies if a document exists at the beginning of a proof, - /// and returns the root hash and the optionally found document. - /// - /// # Arguments - /// - /// * `proof` - A byte slice containing the proof data. - /// * `is_proof_subset` - A boolean indicating whether the proof is a subset query or not. - /// * `document_id` - A byte_32 array, representing the ID of the document to start at. - /// * `platform_version` - The platform version against which to verify the proof. - /// - /// # Returns - /// - /// A `Result` with a tuple containing: - /// * The root hash of the verified proof. - /// * An `Option` containing the found document if available. - /// - /// # Errors - /// - /// This function returns an Error in the following cases: - /// * If the proof is corrupted (wrong path, wrong key, etc.). - /// * If the provided proof has an incorrect number of elements. - pub fn verify_start_at_document_in_proof( - &self, - proof: &[u8], - is_proof_subset: bool, - document_id: [u8; 32], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - match platform_version - .drive - .methods - .verify - .document - .verify_start_at_document_in_proof - { - 0 => self.verify_start_at_document_in_proof_v0( - proof, - is_proof_subset, - document_id, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_start_at_document_in_proof".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/document/verify_start_at_document_in_proof/v0/mod.rs b/packages/rs-drive/src/drive/verify/document/verify_start_at_document_in_proof/v0/mod.rs deleted file mode 100644 index 5d7594f2c2b..00000000000 --- a/packages/rs-drive/src/drive/verify/document/verify_start_at_document_in_proof/v0/mod.rs +++ /dev/null @@ -1,85 +0,0 @@ -use crate::drive::verify::RootHash; - -use crate::error::proof::ProofError; -use crate::error::Error; -use crate::query::DriveQuery; -use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; -use dpp::document::Document; -use dpp::version::PlatformVersion; -use grovedb::{GroveDb, PathQuery}; - -impl<'a> DriveQuery<'a> { - /// Verifies if a document exists at the beginning of a proof, - /// and returns the root hash and the optionally found document. - /// - /// # Arguments - /// - /// * `proof` - A byte slice containing the proof data. - /// * `is_proof_subset` - A boolean indicating whether the proof is a subset query or not. - /// * `document_id` - A byte_32 array, representing the ID of the document to start at. - /// - /// # Returns - /// - /// A `Result` with a tuple containing: - /// * The root hash of the verified proof. - /// * An `Option` containing the found document if available. - /// - /// # Errors - /// - /// This function returns an Error in the following cases: - /// * If the proof is corrupted (wrong path, wrong key, etc.). - /// * If the provided proof has an incorrect number of elements. - pub(super) fn verify_start_at_document_in_proof_v0( - &self, - proof: &[u8], - is_proof_subset: bool, - document_id: [u8; 32], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - let (start_at_document_path, start_at_document_key) = - self.start_at_document_path_and_key(&document_id); - let path_query = PathQuery::new_single_key( - start_at_document_path.clone(), - start_at_document_key.clone(), - ); - let (root_hash, mut proved_key_values) = if is_proof_subset { - GroveDb::verify_subset_query(proof, &path_query)? - } else { - GroveDb::verify_query(proof, &path_query)? - }; - match proved_key_values.len() { - 1 => { - let (path, key, maybe_element) = proved_key_values.remove(0); - if path != start_at_document_path { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back a document for the correct path".to_string(), - ))); - } - if key != start_at_document_key { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back a document for the correct key".to_string(), - ))); - } - let document = maybe_element - .map(|element| { - let document_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; - Document::from_bytes( - document_bytes.as_slice(), - self.document_type, - platform_version, - ) - .map_err(Error::Protocol) - }) - .transpose()?; - Ok((root_hash, document)) - } - 0 => Err(Error::Proof(ProofError::WrongElementCount { - expected: 1, - got: 0, - })), - _ => Err(Error::Proof(ProofError::TooManyElements( - "expected one document for start at", - ))), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/mod.rs b/packages/rs-drive/src/drive/verify/identity/mod.rs deleted file mode 100644 index e9dd259cfef..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -mod verify_full_identities_by_public_key_hashes; -mod verify_full_identity_by_identity_id; -mod verify_full_identity_by_public_key_hash; -mod verify_identity_balance_and_revision_for_identity_id; -mod verify_identity_balance_for_identity_id; -mod verify_identity_balances_for_identity_ids; -mod verify_identity_id_by_public_key_hash; -mod verify_identity_ids_by_public_key_hashes; -mod verify_identity_keys_by_identity_id; -mod verify_identity_revision_for_identity_id; diff --git a/packages/rs-drive/src/drive/verify/identity/verify_full_identities_by_public_key_hashes/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_full_identities_by_public_key_hashes/mod.rs deleted file mode 100644 index 85274d9d63a..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_full_identities_by_public_key_hashes/mod.rs +++ /dev/null @@ -1,71 +0,0 @@ -mod v0; - -use crate::drive::Drive; - -use crate::error::drive::DriveError; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -use std::iter::FromIterator; - -impl Drive { - /// Verifies the full identities of multiple users by their public key hashes. - /// - /// This function takes a byte slice representing the serialized proof and a list of public key hashes. - /// It verifies the full identities and returns a collection of the public key hash and associated identity for each user. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the users. - /// - `public_key_hashes`: A reference to a slice of 20-byte arrays, each representing a hash of a public key of a user. - /// - `platform_version`: The platform version against which to verify the identities. - /// - /// # Generic Parameters - /// - /// - `T`: The type of the collection to hold the results. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and `T`. - /// - /// # Errors - /// - /// This function returns an `Error` variant if: - /// - The proof of authentication is not valid. - /// - Any of the public key hashes do not correspond to a valid identity ID. - /// - Any of the identity IDs do not correspond to a valid full identity. - /// - An unknown or unsupported platform version is provided. - /// - pub fn verify_full_identities_by_public_key_hashes< - T: FromIterator<([u8; 20], Option)>, - >( - proof: &[u8], - public_key_hashes: &[[u8; 20]], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, T), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_full_identities_by_public_key_hashes - { - 0 => Self::verify_full_identities_by_public_key_hashes_v0( - proof, - public_key_hashes, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_full_identities_by_public_key_hashes".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_full_identities_by_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_full_identities_by_public_key_hashes/v0/mod.rs deleted file mode 100644 index 24c41e34716..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_full_identities_by_public_key_hashes/v0/mod.rs +++ /dev/null @@ -1,78 +0,0 @@ -use crate::drive::Drive; - -use crate::error::proof::ProofError; -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Verifies the full identities of multiple users by their public key hashes. - /// - /// This function is a generalization of `verify_full_identity_by_public_key_hash`, - /// which works with a slice of public key hashes instead of a single hash. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the users. - /// - `public_key_hashes`: A reference to a slice of 20-byte arrays, each representing - /// a hash of a public key of a user. - /// - /// # Generic Parameters - /// - /// - `T`: The type of the collection to hold the results, which must be constructible - /// from an iterator of tuples of a 20-byte array and an optional `Identity`. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and `T`. - /// The `RootHash` represents the root hash of GroveDB, and `T` represents - /// the collection of the public key hash and associated identity (if it exists) for each user. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - Any of the public key hashes do not correspond to a valid identity ID. - /// - Any of the identity IDs do not correspond to a valid full identity. - /// - pub(super) fn verify_full_identities_by_public_key_hashes_v0< - T: FromIterator<([u8; 20], Option)>, - >( - proof: &[u8], - public_key_hashes: &[[u8; 20]], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, T), Error> { - let (root_hash, identity_ids_by_key_hashes) = - Self::verify_identity_ids_by_public_key_hashes::>( - proof, - true, - public_key_hashes, - platform_version, - )?; - let maybe_identity = identity_ids_by_key_hashes - .into_iter() - .map(|(key_hash, identity_id)| match identity_id { - None => Ok((key_hash, None)), - Some(identity_id) => { - let identity = Self::verify_full_identity_by_identity_id( - proof, - true, - identity_id, - platform_version, - ) - .map(|(_, maybe_identity)| maybe_identity)?; - let identity = identity.ok_or(Error::Proof(ProofError::IncompleteProof( - "proof returned an identity id without identity information", - )))?; - Ok((key_hash, Some(identity))) - } - }) - .collect::>()?; - Ok((root_hash, maybe_identity)) - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_identity_id/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_identity_id/mod.rs deleted file mode 100644 index 8a43835193b..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_identity_id/mod.rs +++ /dev/null @@ -1,66 +0,0 @@ -mod v0; - -use crate::drive::Drive; - -use crate::error::drive::DriveError; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Verifies the full identity of a user by their identity ID. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - `platform_version`: The platform version against which to verify the identity. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the full identity of the user if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The identity ID does not correspond to a valid full identity. - /// - The balance, revision, or keys information is missing or incorrect. - /// - An unknown or unsupported platform version is provided. - /// - pub fn verify_full_identity_by_identity_id( - proof: &[u8], - is_proof_subset: bool, - identity_id: [u8; 32], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_full_identity_by_identity_id - { - 0 => Self::verify_full_identity_by_identity_id_v0( - proof, - is_proof_subset, - identity_id, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_full_identity_by_identity_id".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_identity_id/v0/mod.rs deleted file mode 100644 index b2dc8724062..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_identity_id/v0/mod.rs +++ /dev/null @@ -1,139 +0,0 @@ -use crate::drive::balances::balance_path; - -use crate::drive::identity::IdentityRootStructure::IdentityTreeRevision; -use crate::drive::identity::{identity_key_tree_path, identity_path}; -use crate::drive::Drive; - -use crate::error::proof::ProofError; -use crate::error::Error; - -use crate::drive::verify::RootHash; -use dpp::identifier::Identifier; -use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::identity::{IdentityPublicKey, IdentityV0, KeyID}; -pub use dpp::prelude::{Identity, Revision}; -use dpp::serialization::PlatformDeserializable; -use dpp::version::PlatformVersion; -use grovedb::GroveDb; -use std::collections::BTreeMap; - -impl Drive { - /// Verifies the full identity of a user by their identity ID. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the full identity of the user if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The identity ID does not correspond to a valid full identity. - /// - The balance, revision, or keys information is missing or incorrect. - /// - pub(super) fn verify_full_identity_by_identity_id_v0( - proof: &[u8], - is_proof_subset: bool, - identity_id: [u8; 32], - _platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - let path_query = Self::full_identity_query(&identity_id)?; - let (root_hash, proved_key_values) = if is_proof_subset { - GroveDb::verify_subset_query(proof, &path_query)? - } else { - GroveDb::verify_query(proof, &path_query)? - }; - let mut balance = None; - let mut revision = None; - let mut keys = BTreeMap::::new(); - let balance_path = balance_path(); - let identity_path = identity_path(identity_id.as_slice()); - let identity_keys_path = identity_key_tree_path(identity_id.as_slice()); - for proved_key_value in proved_key_values { - let (path, key, maybe_element) = proved_key_value; - if path == balance_path { - if key == identity_id { - if let Some(element) = maybe_element { - //this is the balance - let signed_balance = element.as_sum_item_value().map_err(Error::GroveDB)?; - if signed_balance < 0 { - return Err(Error::Proof(ProofError::Overflow( - "balance can't be negative", - ))); - } - balance = Some(signed_balance as u64); - continue; - } else { - return Err(Error::Proof(ProofError::IncompleteProof( - "balance wasn't provided for the identity requested", - ))); - } - } else { - return Err(Error::Proof(ProofError::CorruptedProof( - "balance wasn't for the identity requested".to_string(), - ))); - } - } else if path == identity_path && key == vec![IdentityTreeRevision as u8] { - if let Some(element) = maybe_element { - let item_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; - //this is the revision - revision = Some(Revision::from_be_bytes(item_bytes.try_into().map_err( - |_| { - Error::Proof(ProofError::IncorrectValueSize( - "revision should be 8 bytes", - )) - }, - )?)); - continue; - } else { - return Err(Error::Proof(ProofError::IncompleteProof( - "revision wasn't provided for the identity requested", - ))); - } - } else if path == identity_keys_path { - if let Some(element) = maybe_element { - let item_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; - let key = IdentityPublicKey::deserialize_from_bytes(&item_bytes)?; - keys.insert(key.id(), key); - } else { - return Err(Error::Proof(ProofError::CorruptedProof( - "we received an absence proof for a key but didn't request one".to_string(), - ))); - } - } else { - return Err(Error::Proof(ProofError::TooManyElements( - "we got back items that we did not request", - ))); - } - } - let maybe_identity = if balance.is_none() && revision.is_none() && keys.is_empty() { - Ok(None) - } else if balance.is_none() || revision.is_none() || keys.is_empty() { - // that means that one has stuff and the others don't - // this is an error - Err(Error::Proof(ProofError::IncompleteProof( - "identity proof is incomplete", - ))) - } else { - Ok(Some( - IdentityV0 { - id: Identifier::from(identity_id), - public_keys: keys, - balance: balance.unwrap(), - revision: revision.unwrap(), - } - .into(), - )) - }?; - Ok((root_hash, maybe_identity)) - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_public_key_hash/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_public_key_hash/mod.rs deleted file mode 100644 index 974d9c41b7d..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_public_key_hash/mod.rs +++ /dev/null @@ -1,63 +0,0 @@ -mod v0; - -use crate::drive::Drive; - -use crate::error::drive::DriveError; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Verifies the full identity of a user by their public key hash. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `public_key_hash`: A 20-byte array representing the hash of the public key of the user. - /// - `platform_version`: The platform version against which to verify the identity. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the full identity of the user if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The public key hash does not correspond to a valid identity ID. - /// - The identity ID does not correspond to a valid full identity. - /// - An unknown or unsupported platform version is provided. - /// - pub fn verify_full_identity_by_public_key_hash( - proof: &[u8], - public_key_hash: [u8; 20], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_full_identity_by_public_key_hash - { - 0 => Self::verify_full_identity_by_public_key_hash_v0( - proof, - public_key_hash, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_full_identity_by_public_key_hash".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_public_key_hash/v0/mod.rs deleted file mode 100644 index 21008f75164..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_full_identity_by_public_key_hash/v0/mod.rs +++ /dev/null @@ -1,65 +0,0 @@ -use crate::drive::Drive; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Verifies the full identity of a user by their public key hash. - /// - /// This function takes a byte slice `proof` and a 20-byte array `public_key_hash` as arguments, - /// then it verifies the identity of the user with the given public key hash. - /// - /// The `proof` should contain the proof of authentication from the user. - /// The `public_key_hash` should contain the hash of the public key of the user. - /// - /// The function first verifies the identity ID associated with the given public key hash - /// by calling `verify_identity_id_by_public_key_hash()`. It then uses this identity ID to verify - /// the full identity by calling `verify_full_identity_by_identity_id()`. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the full identity of the user if it exists. - /// - /// If the verification fails at any point, it will return an `Error`. - /// - /// # Errors - /// - /// This function will return an `Error` if: - /// - /// * The proof of authentication is not valid. - /// * The public key hash does not correspond to a valid identity ID. - /// * The identity ID does not correspond to a valid full identity. - /// - pub(super) fn verify_full_identity_by_public_key_hash_v0( - proof: &[u8], - public_key_hash: [u8; 20], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - let (root_hash, identity_id) = Self::verify_identity_id_by_public_key_hash( - proof, - true, - public_key_hash, - platform_version, - )?; - let maybe_identity = identity_id - .map(|identity_id| { - Self::verify_full_identity_by_identity_id( - proof, - true, - identity_id, - platform_version, - ) - .map(|(_, maybe_identity)| maybe_identity) - }) - .transpose()? - .flatten(); - Ok((root_hash, maybe_identity)) - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_and_revision_for_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_and_revision_for_identity_id/v0/mod.rs deleted file mode 100644 index 0a3eb445291..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_and_revision_for_identity_id/v0/mod.rs +++ /dev/null @@ -1,68 +0,0 @@ -use crate::{ - drive::{verify::RootHash, Drive}, - error::{proof::ProofError, Error}, -}; - -impl Drive { - /// Verifies the balance and the reviof an identity by their identity ID. - /// - /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. - /// For example, if the proof can prove the balance and the revision, but here we are only interested - /// in verifying the balance. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the balance of the user's identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The identity ID does not correspond to a valid balance. - /// - The proved key value is not for the correct path or key in balances. - /// - More than one balance is found. - pub fn verify_identity_balance_and_revision_for_identity_id( - proof: &[u8], - identity_id: [u8; 32], - _verify_subset_of_proof: bool, - ) -> Result<(RootHash, Option<(u64, u64)>), Error> { - let (root_hash_0, signed_balance) = - Self::verify_identity_balance_for_identity_id_v0(proof, identity_id, true)?; - - let (root_hash_1, revision) = - Self::verify_identity_revision_for_identity_id_v0(proof, identity_id, true)?; - - if root_hash_0 != root_hash_1 { - return Err(Error::Proof(ProofError::CorruptedProof( - "root hash of balance and root hash for revision do not match".to_string(), - ))); - } - - if signed_balance.is_some() && revision.is_none() { - return Err(Error::Proof(ProofError::CorruptedProof( - "we got back a balance but no revision".to_string(), - ))); - } - - if revision.is_some() && signed_balance.is_none() { - return Err(Error::Proof(ProofError::CorruptedProof( - "we got back a revision but no balance".to_string(), - ))); - } - - if let Some(signed_balance) = signed_balance { - Ok((root_hash_0, Some((signed_balance, revision.unwrap())))) - } else { - Ok((root_hash_0, None)) - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_for_identity_id/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_for_identity_id/mod.rs deleted file mode 100644 index c2336bc42c5..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_for_identity_id/mod.rs +++ /dev/null @@ -1,64 +0,0 @@ -mod v0; - -use crate::drive::Drive; - -use crate::error::drive::DriveError; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Verifies the balance of an identity by their identity ID. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - `platform_version`: The platform version against which to verify the identity balance. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the balance of the user's identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The identity ID does not correspond to a valid balance. - /// - An unknown or unsupported platform version is provided. - /// - pub fn verify_identity_balance_for_identity_id( - proof: &[u8], - identity_id: [u8; 32], - verify_subset_of_proof: bool, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_identity_balance_for_identity_id - { - 0 => Self::verify_identity_balance_for_identity_id_v0( - proof, - identity_id, - verify_subset_of_proof, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_identity_balance_for_identity_id".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_for_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_for_identity_id/v0/mod.rs deleted file mode 100644 index 93d8c5b228c..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_balance_for_identity_id/v0/mod.rs +++ /dev/null @@ -1,86 +0,0 @@ -use crate::drive::balances::balance_path; - -use crate::drive::Drive; - -use crate::error::proof::ProofError; -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use grovedb::GroveDb; - -impl Drive { - /// Verifies the balance of an identity by their identity ID. - /// - /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. - /// For example, if the proof can prove the balance and the revision, but here we are only interested - /// in verifying the balance. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the balance of the user's identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The identity ID does not correspond to a valid balance. - /// - The proved key value is not for the correct path or key in balances. - /// - More than one balance is found. - /// - pub(crate) fn verify_identity_balance_for_identity_id_v0( - proof: &[u8], - identity_id: [u8; 32], - verify_subset_of_proof: bool, - ) -> Result<(RootHash, Option), Error> { - let mut path_query = Self::identity_balance_query(&identity_id); - path_query.query.limit = Some(1); - let (root_hash, mut proved_key_values) = if verify_subset_of_proof { - GroveDb::verify_subset_query_with_absence_proof(proof, &path_query)? - } else { - GroveDb::verify_query_with_absence_proof(proof, &path_query)? - }; - if proved_key_values.len() == 1 { - let (path, key, maybe_element) = &proved_key_values.remove(0); - if path != &balance_path() { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct path in balances".to_string(), - ))); - } - if key != &identity_id { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct key in balances".to_string(), - ))); - } - - let signed_balance = maybe_element - .as_ref() - .map(|element| { - element - .as_sum_item_value() - .map_err(Error::GroveDB)? - .try_into() - .map_err(|_| { - Error::Proof(ProofError::IncorrectValueSize("value size is incorrect")) - }) - }) - .transpose()?; - Ok((root_hash, signed_balance)) - } else { - Err(Error::Proof(ProofError::TooManyElements( - "expected one identity balance", - ))) - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_balances_for_identity_ids/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_balances_for_identity_ids/mod.rs deleted file mode 100644 index 51da29aab8b..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_balances_for_identity_ids/mod.rs +++ /dev/null @@ -1,69 +0,0 @@ -mod v0; - -use crate::drive::Drive; - -use crate::error::drive::DriveError; - -use crate::error::Error; -use dpp::fee::Credits; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -use std::iter::FromIterator; - -impl Drive { - /// Verifies the balances of multiple identities by their identity IDs. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proofs of authentication from the users. - /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - `identity_ids`: A slice of 32-byte arrays representing the identity IDs of the users. - /// - `platform_version`: The platform version against which to verify the balances. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// a generic collection `T` of tuples. Each tuple in `T` consists of a 32-byte array - /// representing an identity ID and an `Option`. The `Option` represents - /// the balance of the respective identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - An unknown or unsupported platform version is provided. - /// - Any other error as documented in the specific versioned function. - /// - pub fn verify_identity_balances_for_identity_ids< - T: FromIterator<([u8; 32], Option)>, - >( - proof: &[u8], - is_proof_subset: bool, - identity_ids: &[[u8; 32]], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, T), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_identity_balances_for_identity_ids - { - 0 => Self::verify_identity_balances_for_identity_ids_v0::( - proof, - is_proof_subset, - identity_ids, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_identity_balances_for_identity_ids".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_balances_for_identity_ids/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_balances_for_identity_ids/v0/mod.rs deleted file mode 100644 index 588e1ec8651..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_balances_for_identity_ids/v0/mod.rs +++ /dev/null @@ -1,90 +0,0 @@ -use crate::drive::Drive; - -use crate::error::proof::ProofError; -use crate::error::Error; -use dpp::fee::Credits; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use grovedb::GroveDb; - -impl Drive { - /// Verifies the balances of multiple identities by their identity IDs. - /// - /// `is_proof_subset` is used to indicate if we want to verify a subset of a bigger proof. - /// For example, if the proof can prove the balances and revisions, but here we are only - /// interested in verifying the balances. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proofs of authentication from the users. - /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - `identity_ids`: A slice of 32-byte arrays representing the identity IDs of the users. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// a generic collection `T` of tuples. Each tuple in `T` consists of a 32-byte array - /// representing an identity ID and an `Option`. The `Option` represents - /// the balance of the respective identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - Any of the identity IDs does not correspond to a valid balance. - /// - The number of proved key values does not match the number of identity IDs provided. - /// - The value size of the balance is incorrect. - /// - pub(super) fn verify_identity_balances_for_identity_ids_v0< - T: FromIterator<([u8; 32], Option)>, - >( - proof: &[u8], - is_proof_subset: bool, - identity_ids: &[[u8; 32]], - ) -> Result<(RootHash, T), Error> { - let mut path_query = Self::balances_for_identity_ids_query(identity_ids)?; - path_query.query.limit = Some(identity_ids.len() as u16); - let (root_hash, proved_key_values) = if is_proof_subset { - GroveDb::verify_subset_query_with_absence_proof(proof, &path_query)? - } else { - GroveDb::verify_query_with_absence_proof(proof, &path_query)? - }; - if proved_key_values.len() == identity_ids.len() { - let values = proved_key_values - .into_iter() - .map(|proved_key_value| { - let key: [u8; 32] = proved_key_value - .1 - .try_into() - .map_err(|_| Error::Proof(ProofError::IncorrectValueSize("value size")))?; - let maybe_element = proved_key_value.2; - match maybe_element { - None => Ok((key, None)), - Some(element) => { - let balance: Credits = element - .as_sum_item_value() - .map_err(Error::GroveDB)? - .try_into() - .map_err(|_| { - Error::Proof(ProofError::IncorrectValueSize( - "balance was negative", - )) - })?; - Ok((key, Some(balance))) - } - } - }) - .collect::>()?; - Ok((root_hash, values)) - } else { - Err(Error::Proof(ProofError::WrongElementCount { - expected: identity_ids.len(), - got: proved_key_values.len(), - })) - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_id_by_public_key_hash/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_id_by_public_key_hash/mod.rs deleted file mode 100644 index 253b7aeba34..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_id_by_public_key_hash/mod.rs +++ /dev/null @@ -1,63 +0,0 @@ -mod v0; - -use crate::drive::Drive; - -use crate::error::drive::DriveError; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Verifies the identity ID of a user by their public key hash. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. - /// - `public_key_hash`: A 20-byte array representing the hash of the public key of the user. - /// - `platform_version`: The platform version against which to verify the identity ID. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of a 32-byte array. The `RootHash` represents the root hash of GroveDB, - /// and the `Option<[u8; 32]>` represents the identity ID of the user if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - An unknown or unsupported platform version is provided. - /// - Any other error as documented in the specific versioned function. - /// - pub fn verify_identity_id_by_public_key_hash( - proof: &[u8], - is_proof_subset: bool, - public_key_hash: [u8; 20], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option<[u8; 32]>), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_identity_id_by_public_key_hash - { - 0 => Self::verify_identity_id_by_public_key_hash_v0( - proof, - is_proof_subset, - public_key_hash, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_identity_id_by_public_key_hash".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_id_by_public_key_hash/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_id_by_public_key_hash/v0/mod.rs deleted file mode 100644 index 578f508ffac..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_id_by_public_key_hash/v0/mod.rs +++ /dev/null @@ -1,81 +0,0 @@ -use crate::drive::{unique_key_hashes_tree_path_vec, Drive}; - -use crate::error::proof::ProofError; -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use grovedb::GroveDb; - -impl Drive { - /// Verifies the identity ID of a user by their public key hash. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. - /// - `public_key_hash`: A 20-byte array representing the hash of the public key of the user. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of a 32-byte array. The `RootHash` represents the root hash of GroveDB, - /// and the `Option<[u8; 32]>` represents the identity ID of the user if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The public key hash does not correspond to a valid identity ID. - /// - The proved key value is not for the correct path or key in unique key hashes. - /// - More than one identity ID is found. - /// - pub(super) fn verify_identity_id_by_public_key_hash_v0( - proof: &[u8], - is_proof_subset: bool, - public_key_hash: [u8; 20], - ) -> Result<(RootHash, Option<[u8; 32]>), Error> { - let mut path_query = Self::identity_id_by_unique_public_key_hash_query(public_key_hash); - path_query.query.limit = Some(1); - let (root_hash, mut proved_key_values) = if is_proof_subset { - GroveDb::verify_subset_query_with_absence_proof(proof, &path_query)? - } else { - GroveDb::verify_query_with_absence_proof(proof, &path_query)? - }; - - if proved_key_values.len() == 1 { - let (path, key, maybe_element) = proved_key_values.remove(0); - if path != unique_key_hashes_tree_path_vec() { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct path in unique key hashes" - .to_string(), - ))); - } - if key != public_key_hash { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct key in unique key hashes" - .to_string(), - ))); - } - let identity_id = maybe_element - .map(|element| { - element - .into_item_bytes() - .map_err(Error::GroveDB)? - .try_into() - .map_err(|_| { - Error::Proof(ProofError::IncorrectValueSize("value size is incorrect")) - }) - }) - .transpose()?; - Ok((root_hash, identity_id)) - } else { - Err(Error::Proof(ProofError::TooManyElements( - "expected maximum one identity id", - ))) - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_ids_by_public_key_hashes/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_ids_by_public_key_hashes/mod.rs deleted file mode 100644 index 7ea04940313..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_ids_by_public_key_hashes/mod.rs +++ /dev/null @@ -1,68 +0,0 @@ -mod v0; - -use crate::drive::Drive; - -use crate::error::drive::DriveError; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -use std::iter::FromIterator; - -impl Drive { - /// Verifies the identity IDs of multiple identities by their public key hashes. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proofs of authentication from the users. - /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - `public_key_hashes`: A slice of 20-byte arrays representing the public key hashes of the users. - /// - `platform_version`: The platform version against which to verify the identity IDs. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// a generic collection `T` of tuples. Each tuple in `T` consists of a 20-byte array - /// representing a public key hash and an `Option<[u8; 32]>`. The `Option<[u8; 32]>` represents - /// the identity ID of the respective identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - An unknown or unsupported platform version is provided. - /// - Any other error as documented in the specific versioned function. - /// - pub fn verify_identity_ids_by_public_key_hashes< - T: FromIterator<([u8; 20], Option<[u8; 32]>)>, - >( - proof: &[u8], - is_proof_subset: bool, - public_key_hashes: &[[u8; 20]], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, T), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_identity_ids_by_public_key_hashes - { - 0 => Self::verify_identity_ids_by_public_key_hashes_v0( - proof, - is_proof_subset, - public_key_hashes, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_identity_ids_by_public_key_hashes".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_ids_by_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_ids_by_public_key_hashes/v0/mod.rs deleted file mode 100644 index b6d9245e468..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_ids_by_public_key_hashes/v0/mod.rs +++ /dev/null @@ -1,89 +0,0 @@ -use crate::drive::Drive; - -use crate::error::proof::ProofError; -use crate::error::Error; - -use crate::drive::verify::RootHash; - -pub use dpp::prelude::{Identity, Revision}; - -use grovedb::GroveDb; - -impl Drive { - /// Verifies the identity IDs of multiple identities by their public key hashes. - /// - /// `is_proof_subset` is used to indicate if we want to verify a subset of a bigger proof. - /// For example, if the proof can prove the identity IDs and revisions, but here we are only - /// interested in verifying the identity IDs. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proofs of authentication from the users. - /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - `public_key_hashes`: A slice of 20-byte arrays representing the public key hashes of the users. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// a generic collection `T` of tuples. Each tuple in `T` consists of a 20-byte array - /// representing a public key hash and an `Option<[u8; 32]>`. The `Option<[u8; 32]>` represents - /// the identity ID of the respective identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - Any of the public key hashes does not correspond to a valid identity ID. - /// - The number of proved key values does not match the number of public key hashes provided. - /// - The value size of the identity ID is incorrect. - /// - pub(super) fn verify_identity_ids_by_public_key_hashes_v0< - T: FromIterator<([u8; 20], Option<[u8; 32]>)>, - >( - proof: &[u8], - is_proof_subset: bool, - public_key_hashes: &[[u8; 20]], - ) -> Result<(RootHash, T), Error> { - let mut path_query = Self::identity_ids_by_unique_public_key_hash_query(public_key_hashes); - path_query.query.limit = Some(public_key_hashes.len() as u16); - let (root_hash, proved_key_values) = if is_proof_subset { - GroveDb::verify_subset_query_with_absence_proof(proof, &path_query)? - } else { - GroveDb::verify_query_with_absence_proof(proof, &path_query)? - }; - if proved_key_values.len() == public_key_hashes.len() { - let values = proved_key_values - .into_iter() - .map(|proved_key_value| { - let key: [u8; 20] = proved_key_value - .1 - .try_into() - .map_err(|_| Error::Proof(ProofError::IncorrectValueSize("value size")))?; - let maybe_element = proved_key_value.2; - match maybe_element { - None => Ok((key, None)), - Some(element) => { - let identity_id = element - .into_item_bytes() - .map_err(Error::GroveDB)? - .try_into() - .map_err(|_| { - Error::Proof(ProofError::IncorrectValueSize( - "value size is incorrect", - )) - })?; - Ok((key, Some(identity_id))) - } - } - }) - .collect::>()?; - Ok((root_hash, values)) - } else { - Err(Error::Proof(ProofError::WrongElementCount { - expected: public_key_hashes.len(), - got: proved_key_values.len(), - })) - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_keys_by_identity_id/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_keys_by_identity_id/mod.rs deleted file mode 100644 index 934c1ad035f..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_keys_by_identity_id/mod.rs +++ /dev/null @@ -1,65 +0,0 @@ -mod v0; - -use crate::drive::{identity::key::fetch::IdentityKeysRequest, Drive}; - -use crate::error::drive::DriveError; - -use crate::error::Error; - -use crate::drive::verify::RootHash; - -use dpp::identity::PartialIdentity; -pub use dpp::prelude::{Identity, Revision}; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Verifies the identity keys of a user by their identity ID. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - `platform_version`: The platform version against which to verify the identity keys. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of `PartialIdentity`. The `RootHash` represents the root hash of GroveDB, - /// and the `Option` represents the partial identity of the user if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - An unknown or unsupported platform version is provided. - /// - Any other error as documented in the specific versioned function. - /// - pub fn verify_identity_keys_by_identity_id( - proof: &[u8], - key_request: IdentityKeysRequest, - is_proof_subset: bool, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - match platform_version - .drive - .methods - .verify - .identity - .verify_identity_keys_by_identity_id - { - 0 => Self::verify_identity_keys_by_identity_id_v0( - proof, - key_request, - is_proof_subset, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_identity_keys_by_identity_id".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_keys_by_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_keys_by_identity_id/v0/mod.rs deleted file mode 100644 index 280cc8addd8..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_keys_by_identity_id/v0/mod.rs +++ /dev/null @@ -1,87 +0,0 @@ -use crate::drive::identity::identity_key_tree_path; -use crate::drive::Drive; - -use crate::error::proof::ProofError; -use crate::error::Error; - -use crate::drive::identity::key::fetch::IdentityKeysRequest; -use crate::drive::verify::RootHash; -use dpp::identifier::Identifier; -use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::identity::{IdentityPublicKey, KeyID, PartialIdentity}; -pub use dpp::prelude::{Identity, Revision}; -use dpp::serialization::PlatformDeserializable; -use dpp::version::PlatformVersion; -use grovedb::GroveDb; -use std::collections::BTreeMap; - -impl Drive { - /// Verifies the identity keys of a user by their identity ID. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option` of `PartialIdentity`. The `RootHash` represents the root hash of GroveDB, - /// and the `Option` represents the partial identity of the user if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The identity ID does not correspond to a valid partial identity. - /// - The keys information is missing or incorrect. - /// - pub(super) fn verify_identity_keys_by_identity_id_v0( - proof: &[u8], - key_request: IdentityKeysRequest, - is_proof_subset: bool, - _platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - let identity_id = key_request.identity_id; - let path_query = key_request.into_path_query(); - let (root_hash, proved_key_values) = if is_proof_subset { - GroveDb::verify_subset_query(proof, &path_query)? - } else { - GroveDb::verify_query(proof, &path_query)? - }; - let mut keys = BTreeMap::::new(); - let identity_keys_path = identity_key_tree_path(identity_id.as_slice()); - for proved_key_value in proved_key_values { - let (path, _key, maybe_element) = proved_key_value; - if path == identity_keys_path { - if let Some(element) = maybe_element { - let item_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; - let key = IdentityPublicKey::deserialize_from_bytes(&item_bytes)?; - keys.insert(key.id(), key); - } else { - return Err(Error::Proof(ProofError::CorruptedProof( - "we received an absence proof for a key but didn't request one".to_string(), - ))); - } - } else { - return Err(Error::Proof(ProofError::TooManyElements( - "we got back items that we did not request", - ))); - } - } - let maybe_identity = if keys.is_empty() { - Ok::, Error>(None) - } else { - Ok(Some(PartialIdentity { - id: Identifier::from(identity_id), - balance: None, - revision: None, - loaded_public_keys: keys, - not_found_public_keys: Default::default(), - })) - }?; - Ok((root_hash, maybe_identity)) - } -} diff --git a/packages/rs-drive/src/drive/verify/identity/verify_identity_revision_for_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/verify/identity/verify_identity_revision_for_identity_id/v0/mod.rs deleted file mode 100644 index c02dc4971ae..00000000000 --- a/packages/rs-drive/src/drive/verify/identity/verify_identity_revision_for_identity_id/v0/mod.rs +++ /dev/null @@ -1,82 +0,0 @@ -use crate::drive::identity::IdentityRootStructure::IdentityTreeRevision; -use crate::{ - drive::{identity::identity_path_vec, verify::RootHash, Drive}, - error::{proof::ProofError, Error}, -}; -use dpp::prelude::Revision; -use grovedb::GroveDb; - -impl Drive { - /// Verifies the revision of an identity by their identity ID. - /// - /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. - /// For example, if the proof can prove the balance and the revision, but here we are only interested - /// in verifying the balance. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof of authentication from the user. - /// - `identity_id`: A 32-byte array representing the identity ID of the user. - /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. - /// - /// # Returns - /// - /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and - /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the - /// `Option` represents the revision of the user's identity if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof of authentication is not valid. - /// - The identity ID does not correspond to a valid balance. - /// - The proved key value is not for the correct path or key in balances. - /// - More than one balance is found. - /// - pub fn verify_identity_revision_for_identity_id_v0( - proof: &[u8], - identity_id: [u8; 32], - verify_subset_of_proof: bool, - ) -> Result<(RootHash, Option), Error> { - let mut path_query = Self::identity_revision_query(&identity_id); - path_query.query.limit = Some(1); - let (root_hash, mut proved_key_values) = if verify_subset_of_proof { - GroveDb::verify_subset_query_with_absence_proof(proof, &path_query)? - } else { - GroveDb::verify_query_with_absence_proof(proof, &path_query)? - }; - if proved_key_values.len() == 1 { - let (path, key, maybe_element) = &proved_key_values.remove(0); - if path != &identity_path_vec(&identity_id) { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct path in revision".to_string(), - ))); - } - if key != &vec![IdentityTreeRevision as u8] { - return Err(Error::Proof(ProofError::CorruptedProof( - "we did not get back an element for the correct key in revision".to_string(), - ))); - } - - let revision = maybe_element - .as_ref() - .map(|element| { - let encoded_revision = element.as_item_bytes()?; - Ok::(Revision::from_be_bytes( - encoded_revision.try_into().map_err(|_| { - Error::Proof(ProofError::CorruptedProof( - "identity revision was not 8 bytes as expected".to_string(), - )) - })?, - )) - }) - .transpose()?; - Ok((root_hash, revision)) - } else { - Err(Error::Proof(ProofError::TooManyElements( - "expected one identity revision", - ))) - } - } -} diff --git a/packages/rs-drive/src/drive/verify/mod.rs b/packages/rs-drive/src/drive/verify/mod.rs deleted file mode 100644 index 3b1ce6ae854..00000000000 --- a/packages/rs-drive/src/drive/verify/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -///DataContract verification methods on proofs -pub mod contract; -/// Document verification methods on proofs -pub mod document; -/// Identity verification methods on proofs -pub mod identity; -/// Single Document verification methods on proofs -pub mod single_document; - -/// System components (Epoch info etc...) verification methods on proofs -pub mod system; - -/// Represents the root hash of the grovedb tree -pub type RootHash = [u8; 32]; diff --git a/packages/rs-drive/src/drive/verify/single_document/verify_proof/mod.rs b/packages/rs-drive/src/drive/verify/single_document/verify_proof/mod.rs deleted file mode 100644 index 6a0a94bd84f..00000000000 --- a/packages/rs-drive/src/drive/verify/single_document/verify_proof/mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -mod v0; - -use crate::drive::verify::RootHash; - -use crate::error::Error; -use crate::query::SingleDocumentDriveQuery; -use dpp::data_contract::document_type::DocumentTypeRef; -use dpp::document::Document; - -use crate::error::drive::DriveError; - -use dpp::version::PlatformVersion; - -impl SingleDocumentDriveQuery { - /// Verifies the proof of a single document query. - /// - /// `is_subset` indicates if the function should verify a subset of a larger proof. - /// - /// # Parameters - /// - /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. - /// - `proof`: A byte slice representing the proof to be verified. - /// - `document_type`: The type of the document being verified. - /// - `platform_version`: The platform version against which to verify the proof. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` - /// represents the deserialized document if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - An unknown or unsupported platform version is provided. - /// - Any other error as documented in the specific versioned function. - pub fn verify_proof( - &self, - is_subset: bool, - proof: &[u8], - document_type: DocumentTypeRef, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - match platform_version - .drive - .methods - .verify - .single_document - .verify_proof - { - 0 => self.verify_proof_v0(is_subset, proof, document_type, platform_version), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "SingleDocumentDriveQuery::verify_proof".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/single_document/verify_proof/v0/mod.rs b/packages/rs-drive/src/drive/verify/single_document/verify_proof/v0/mod.rs deleted file mode 100644 index f289666a166..00000000000 --- a/packages/rs-drive/src/drive/verify/single_document/verify_proof/v0/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -use crate::drive::verify::RootHash; - -use crate::error::Error; -use crate::query::SingleDocumentDriveQuery; -use dpp::data_contract::document_type::DocumentTypeRef; -use dpp::document::Document; - -use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; -use dpp::version::PlatformVersion; - -impl SingleDocumentDriveQuery { - /// Verifies the proof of a single document query. - /// - /// `is_subset` indicates if the function should verify a subset of a larger proof. - /// - /// # Parameters - /// - /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. - /// - `proof`: A byte slice representing the proof to be verified. - /// - `document_type`: The type of the document being verified. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` - /// represents the deserialized document if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - /// - The document serialization fails. - pub(super) fn verify_proof_v0( - &self, - is_subset: bool, - proof: &[u8], - document_type: DocumentTypeRef, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option), Error> { - self.verify_proof_keep_serialized(is_subset, proof, platform_version) - .map(|(root_hash, serialized)| { - let document = serialized - .map(|serialized| { - Document::from_bytes(serialized.as_slice(), document_type, platform_version) - .map_err(Error::Protocol) - }) - .transpose()?; - Ok((root_hash, document)) - })? - } -} diff --git a/packages/rs-drive/src/drive/verify/single_document/verify_proof_keep_serialized/mod.rs b/packages/rs-drive/src/drive/verify/single_document/verify_proof_keep_serialized/mod.rs deleted file mode 100644 index 74ea254f8bf..00000000000 --- a/packages/rs-drive/src/drive/verify/single_document/verify_proof_keep_serialized/mod.rs +++ /dev/null @@ -1,54 +0,0 @@ -mod v0; - -use crate::drive::verify::RootHash; -use crate::error::drive::DriveError; - -use crate::error::Error; -use crate::query::SingleDocumentDriveQuery; - -use dpp::version::PlatformVersion; - -impl SingleDocumentDriveQuery { - /// Verifies the proof of a document while keeping it serialized. - /// - /// `is_subset` indicates if the function should verify a subset of a larger proof. - /// - /// # Parameters - /// - /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. - /// - `proof`: A byte slice representing the proof to be verified. - /// - `platform_version`: The platform version against which to verify the proof. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` - /// represents the serialized document if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - An unknown or unsupported platform version is provided. - /// - Any other error as documented in the specific versioned function. - pub fn verify_proof_keep_serialized( - &self, - is_subset: bool, - proof: &[u8], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Option>), Error> { - match platform_version - .drive - .methods - .verify - .single_document - .verify_proof_keep_serialized - { - 0 => self.verify_proof_keep_serialized_v0(is_subset, proof), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "SingleDocumentDriveQuery::verify_proof_keep_serialized".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/single_document/verify_proof_keep_serialized/v0/mod.rs b/packages/rs-drive/src/drive/verify/single_document/verify_proof_keep_serialized/v0/mod.rs deleted file mode 100644 index 3cb6b107bea..00000000000 --- a/packages/rs-drive/src/drive/verify/single_document/verify_proof_keep_serialized/v0/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::drive::verify::RootHash; - -use crate::error::proof::ProofError; -use crate::error::Error; -use crate::query::SingleDocumentDriveQuery; - -use grovedb::GroveDb; - -impl SingleDocumentDriveQuery { - /// Verifies the proof of a document while keeping it serialized. - /// - /// `is_subset` indicates if the function should verify a subset of a larger proof. - /// - /// # Parameters - /// - /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. - /// - `proof`: A byte slice representing the proof to be verified. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` - /// represents the serialized document if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb verification fails. - /// - The elements returned are not items, the proof is incorrect. - pub(super) fn verify_proof_keep_serialized_v0( - &self, - is_subset: bool, - proof: &[u8], - ) -> Result<(RootHash, Option>), Error> { - let path_query = self.construct_path_query(); - let (root_hash, mut proved_key_values) = if is_subset { - GroveDb::verify_subset_query_with_absence_proof(proof, &path_query)? - } else { - GroveDb::verify_query_with_absence_proof(proof, &path_query)? - }; - - if proved_key_values.len() != 1 { - return Err(Error::Proof(ProofError::CorruptedProof( - "we should always get back one element".to_string(), - ))); - } - - let element = proved_key_values.remove(0).2; - - let serialized = element - .map(|element| element.into_item_bytes().map_err(Error::GroveDB)) - .transpose()?; - - Ok((root_hash, serialized)) - } -} diff --git a/packages/rs-drive/src/drive/verify/system/mod.rs b/packages/rs-drive/src/drive/verify/system/mod.rs deleted file mode 100644 index f9b5d162451..00000000000 --- a/packages/rs-drive/src/drive/verify/system/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod verify_epoch_infos; -mod verify_upgrade_state; -mod verify_upgrade_vote_status; diff --git a/packages/rs-drive/src/drive/verify/system/verify_epoch_infos/mod.rs b/packages/rs-drive/src/drive/verify/system/verify_epoch_infos/mod.rs deleted file mode 100644 index 2181c2982b2..00000000000 --- a/packages/rs-drive/src/drive/verify/system/verify_epoch_infos/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::block::epoch::EpochIndex; -use dpp::block::extended_epoch_info::ExtendedEpochInfo; -use dpp::version::PlatformVersion; - -mod v0; - -impl Drive { - /// Verifies a proof containing potentially multiple epoch infos. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `current_epoch`: The current epoch index, can be acquired from metadata. - /// - `start_epoch`: The first epoch index. - /// - `count`: The amount of epochs to get. - /// - `ascending`: True if we want to get epochs from oldest to newest. - /// - `platform_version`: the platform version, - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Vec`. The `Vec` - /// represents verified epoch information if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub fn verify_epoch_infos( - proof: &[u8], - current_epoch: EpochIndex, - start_epoch: Option, - count: u16, - ascending: bool, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, Vec), Error> { - match platform_version - .drive - .methods - .verify - .system - .verify_epoch_infos - { - 0 => Drive::verify_epoch_infos_v0(proof, current_epoch, start_epoch, count, ascending), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_epoch_infos".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/system/verify_epoch_infos/v0/mod.rs b/packages/rs-drive/src/drive/verify/system/verify_epoch_infos/v0/mod.rs deleted file mode 100644 index 63e02c0cdc3..00000000000 --- a/packages/rs-drive/src/drive/verify/system/verify_epoch_infos/v0/mod.rs +++ /dev/null @@ -1,231 +0,0 @@ -use crate::drive::credit_pools::pools_vec_path; -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::proof::ProofError; -use crate::error::Error; -use crate::fee_pools::epochs::epoch_key_constants::{ - KEY_FEE_MULTIPLIER, KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, KEY_START_TIME, -}; -use crate::query::{Query, QueryItem}; -use dpp::block::epoch::{EpochIndex, EPOCH_KEY_OFFSET}; -use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0; -use dpp::block::extended_epoch_info::ExtendedEpochInfo; -use dpp::ProtocolError; -use grovedb::{Element, GroveDb, PathQuery, SizedQuery}; -use std::collections::BTreeMap; - -impl Drive { - /// Verifies that the contract is included in the proof. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `current_epoch`: The current epoch index, can be acquired from metadata. - /// - `start_epoch`: The first epoch index. - /// - `count`: The amount of epochs to get. - /// - `ascending`: True if we want to get epochs from oldest to newest. - /// - `platform_version`: the platform version, - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` - /// represents the verified contract if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub(super) fn verify_epoch_infos_v0( - proof: &[u8], - current_epoch: EpochIndex, - start_epoch: Option, - count: u16, - ascending: bool, - ) -> Result<(RootHash, Vec), Error> { - let start_epoch_index = start_epoch.unwrap_or({ - if ascending { - 0 - } else { - current_epoch - } - }); - let index_with_offset = start_epoch_index - .checked_add(EPOCH_KEY_OFFSET) - .ok_or(ProtocolError::Overflow("stored epoch index too high"))?; - let mut subquery = Query::new(); - subquery.insert_keys(vec![ - KEY_START_TIME.to_vec(), - KEY_START_BLOCK_HEIGHT.to_vec(), - KEY_START_BLOCK_CORE_HEIGHT.to_vec(), - KEY_FEE_MULTIPLIER.to_vec(), - ]); - let mut query = if ascending { - Query::new_single_query_item(QueryItem::RangeFrom( - index_with_offset.to_be_bytes().to_vec().., - )) - } else { - Query::new_single_query_item(QueryItem::RangeToInclusive( - ..=index_with_offset.to_be_bytes().to_vec(), - )) - }; - query.left_to_right = ascending; - query.set_subquery(subquery); - let path_query = PathQuery::new( - pools_vec_path(), - SizedQuery::new(query, Some(count * 4), None), - ); - - let (root_hash, elements) = GroveDb::verify_query(proof, &path_query)?; - - let results = elements.into_iter().fold( - BTreeMap::<_, BTreeMap<_, _>>::new(), - |mut acc, result_item| { - let (path, key, element) = result_item; - if path.len() == 2 { - acc.entry(path) - .or_insert_with(BTreeMap::new) - .insert(key, element); - } - acc - }, - ); - - // Convert the BTreeMap entries to ExtendedEpochInfo - let extended_epoch_infos = results - .into_iter() - .filter_map(|(path, inner_map)| { - // Extract the epoch index from the path's last component - // and adjust by subtracting the EPOCH_KEY_OFFSET - let epoch_index_result: Result = path - .last() - .ok_or(Error::Proof(ProofError::CorruptedProof( - "extended epoch info: path can not be empty".to_string(), - ))) - .and_then(|epoch_index_vec| { - epoch_index_vec.as_slice().try_into().map_err(|_| { - Error::Proof(ProofError::CorruptedProof( - "extended epoch info: item has an invalid length".to_string(), - )) - }) - }) - .and_then(|epoch_index_bytes| { - EpochIndex::from_be_bytes(epoch_index_bytes) - .checked_sub(EPOCH_KEY_OFFSET) - .ok_or(Error::Proof(ProofError::CorruptedProof( - "epoch bytes on disk too small, should be over epoch key offset" - .to_string(), - ))) - }); - - let epoch_index = match epoch_index_result { - Ok(value) => value, - Err(e) => return Some(Err(e)), - }; - - let first_block_time_element = inner_map.get(&KEY_START_TIME.to_vec())?; - - let Some(Element::Item(encoded_start_time, _)) = first_block_time_element else { - return Some(Err(Error::Drive(DriveError::UnexpectedElementType( - "start time must be an item", - )))); - }; - - let first_block_time_bytes: [u8; 8] = - match encoded_start_time.as_slice().try_into().map_err(|_| { - Error::Drive(DriveError::CorruptedSerialization( - "extended epoch info: block time must be 8 bytes for a u64".to_string(), - )) - }) { - Ok(value) => value, - Err(e) => return Some(Err(e)), - }; - - let first_block_time = u64::from_be_bytes(first_block_time_bytes); - - let first_block_height_element = inner_map.get(&KEY_START_BLOCK_HEIGHT.to_vec())?; - - let Some(Element::Item(encoded_start_block_height, _)) = first_block_height_element - else { - return Some(Err(Error::Drive(DriveError::UnexpectedElementType( - "extended epoch info: start time must be an item", - )))); - }; - - let first_block_height_bytes: [u8; 8] = match encoded_start_block_height - .as_slice() - .try_into() - .map_err(|_| { - Error::Drive(DriveError::CorruptedSerialization( - "extended epoch info: block height must be 8 bytes for a u64" - .to_string(), - )) - }) { - Ok(value) => value, - Err(e) => return Some(Err(e)), - }; - - let first_block_height = u64::from_be_bytes(first_block_height_bytes); - - let first_core_block_height_element = - inner_map.get(&KEY_START_BLOCK_CORE_HEIGHT.to_vec())?; - - let Some(Element::Item(encoded_start_core_block_height, _)) = - first_core_block_height_element - else { - return Some(Err(Error::Drive(DriveError::UnexpectedElementType( - "start time must be an item", - )))); - }; - - let first_core_block_height_bytes: [u8; 4] = match encoded_start_core_block_height - .as_slice() - .try_into() - .map_err(|_| { - Error::Drive(DriveError::CorruptedSerialization( - "core block height must be 4 bytes for a u32".to_string(), - )) - }) { - Ok(value) => value, - Err(e) => return Some(Err(e)), - }; - - let first_core_block_height = u32::from_be_bytes(first_core_block_height_bytes); - - let fee_multiplier_element = inner_map.get(&KEY_FEE_MULTIPLIER.to_vec())?; - - let Some(Element::Item(encoded_multiplier, _)) = fee_multiplier_element else { - return Some(Err(Error::Drive(DriveError::UnexpectedElementType( - "epochs multiplier must be an item", - )))); - }; - - let fee_multiplier_bytes: [u8; 8] = - match encoded_multiplier.as_slice().try_into().map_err(|_| { - Error::Drive(DriveError::CorruptedSerialization( - "fee multiplier must be 8 bytes for a f64".to_string(), - )) - }) { - Ok(value) => value, - Err(e) => return Some(Err(e)), - }; - - let fee_multiplier = f64::from_be_bytes(fee_multiplier_bytes); - - // Construct the ExtendedEpochInfo - Some(Ok(ExtendedEpochInfoV0 { - index: epoch_index, - first_block_time, - first_block_height, - first_core_block_height, - fee_multiplier, - } - .into())) - }) - .collect::, Error>>()?; - - Ok((root_hash, extended_epoch_infos)) - } -} diff --git a/packages/rs-drive/src/drive/verify/system/verify_upgrade_state/mod.rs b/packages/rs-drive/src/drive/verify/system/verify_upgrade_state/mod.rs deleted file mode 100644 index 7c0838ef5c9..00000000000 --- a/packages/rs-drive/src/drive/verify/system/verify_upgrade_state/mod.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::block::epoch::EpochIndex; -use dpp::block::extended_epoch_info::ExtendedEpochInfo; -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::PlatformVersion; -use nohash_hasher::IntMap; - -mod v0; - -impl Drive { - /// Verifies a proof containing the current upgrade state. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `platform_version`: the platform version, - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `Vec`. The `Vec` - /// represents verified epoch information if it exists. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub fn verify_upgrade_state( - proof: &[u8], - platform_version: &PlatformVersion, - ) -> Result<(RootHash, IntMap), Error> { - match platform_version - .drive - .methods - .verify - .system - .verify_upgrade_state - { - 0 => Drive::verify_upgrade_state_v0(proof), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_upgrade_state".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/system/verify_upgrade_state/v0/mod.rs b/packages/rs-drive/src/drive/verify/system/verify_upgrade_state/v0/mod.rs deleted file mode 100644 index 63ff9e7e556..00000000000 --- a/packages/rs-drive/src/drive/verify/system/verify_upgrade_state/v0/mod.rs +++ /dev/null @@ -1,68 +0,0 @@ -use crate::drive::protocol_upgrade::versions_counter_path_vec; -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::proof::ProofError; -use crate::error::Error; -use crate::query::{Query, QueryItem}; -use dpp::util::deserializer::ProtocolVersion; -use grovedb::{GroveDb, PathQuery}; -use integer_encoding::VarInt; -use nohash_hasher::IntMap; -use std::ops::RangeFull; -impl Drive { - /// Verifies a proof containing the current upgrade state. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `platform_version`: the platform version, - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `IntMap`. The `IntMap` - /// represents vote count of each version in the current epoch. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub(super) fn verify_upgrade_state_v0( - proof: &[u8], - ) -> Result<(RootHash, IntMap), Error> { - let path_query = PathQuery::new_unsized( - versions_counter_path_vec(), - Query::new_single_query_item(QueryItem::RangeFull(RangeFull)), - ); - - let (root_hash, elements) = GroveDb::verify_query(proof, &path_query)?; - - let protocol_version_map = elements - .into_iter() - .map(|(_, key, element)| { - let version = ProtocolVersion::decode_var(key.as_slice()) - .ok_or(ProofError::CorruptedProof( - "protocol version not decodable".to_string(), - ))? - .0; - let element = element.ok_or(ProofError::CorruptedProof( - "expected a count for each version, got none".to_string(), - ))?; - let count_bytes = element.as_item_bytes().map_err(|_| { - ProofError::CorruptedProof( - "expected an item for the element of a version".to_string(), - ) - })?; - let count = u64::decode_var(count_bytes) - .ok_or(ProofError::CorruptedProof( - "version count not decodable".to_string(), - ))? - .0; - Ok((version, count)) - }) - .collect::, Error>>()?; - - Ok((root_hash, protocol_version_map)) - } -} diff --git a/packages/rs-drive/src/drive/verify/system/verify_upgrade_vote_status/mod.rs b/packages/rs-drive/src/drive/verify/system/verify_upgrade_vote_status/mod.rs deleted file mode 100644 index 1a6c3e6295c..00000000000 --- a/packages/rs-drive/src/drive/verify/system/verify_upgrade_vote_status/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -mod v0; - -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use dpp::util::deserializer::ProtocolVersion; -use dpp::version::PlatformVersion; -use std::collections::BTreeMap; - -impl Drive { - /// Verifies a proof containing potentially multiple epoch infos. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `first_pro_tx_hash`: the first pro tx hash that we are querying for. - /// - `count`: the amount of Evonodes that we want to retrieve. - /// - `platform_version`: the platform version, - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `BTreeMap<[u8;32], ProtocolVersion>`. The `BTreeMap<[u8;32], ProtocolVersion>` - /// represents a map of the version that each Evonode has voted for. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub fn verify_upgrade_vote_status( - proof: &[u8], - start_protx_hash: Option<[u8; 32]>, - count: u16, - platform_version: &PlatformVersion, - ) -> Result<(RootHash, BTreeMap<[u8; 32], ProtocolVersion>), Error> { - match platform_version - .drive - .methods - .verify - .system - .verify_upgrade_vote_status - { - 0 => Drive::verify_upgrade_vote_status_v0(proof, start_protx_hash, count), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "verify_upgrade_vote_status".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/verify/system/verify_upgrade_vote_status/v0/mod.rs b/packages/rs-drive/src/drive/verify/system/verify_upgrade_vote_status/v0/mod.rs deleted file mode 100644 index 69aec6844fb..00000000000 --- a/packages/rs-drive/src/drive/verify/system/verify_upgrade_vote_status/v0/mod.rs +++ /dev/null @@ -1,79 +0,0 @@ -use crate::drive::protocol_upgrade::{ - desired_version_for_validators_path_vec, versions_counter_path_vec, -}; -use crate::drive::verify::RootHash; -use crate::drive::Drive; -use crate::error::proof::ProofError; -use crate::error::Error; -use crate::query::{Query, QueryItem}; -use dpp::util::deserializer::ProtocolVersion; -use grovedb::{GroveDb, PathQuery, SizedQuery}; -use integer_encoding::VarInt; -use std::collections::BTreeMap; -use std::ops::RangeFull; -impl Drive { - /// Verifies a proof containing the current upgrade state. - /// - /// # Parameters - /// - /// - `proof`: A byte slice representing the proof to be verified. - /// - `first_pro_tx_hash`: the first pro tx hash that we are querying for. - /// - `count`: the amount of Evonodes that we want to retrieve. - /// - /// # Returns - /// - /// Returns a `Result` with a tuple of `RootHash` and `BTreeMap<[u8;32], ProtocolVersion>`. The `BTreeMap<[u8;32], ProtocolVersion>` - /// represents a map of the version that each Evonode has voted for. - /// - /// # Errors - /// - /// Returns an `Error` if: - /// - /// - The proof is corrupted. - /// - The GroveDb query fails. - pub(super) fn verify_upgrade_vote_status_v0( - proof: &[u8], - start_protx_hash: Option<[u8; 32]>, - count: u16, - ) -> Result<(RootHash, BTreeMap<[u8; 32], ProtocolVersion>), Error> { - let path = desired_version_for_validators_path_vec(); - - let query_item = if let Some(start_protx_hash) = start_protx_hash { - QueryItem::RangeFrom(start_protx_hash.to_vec()..) - } else { - QueryItem::RangeFull(RangeFull) - }; - - let path_query = PathQuery::new( - path, - SizedQuery::new(Query::new_single_query_item(query_item), Some(count), None), - ); - - let (root_hash, elements) = GroveDb::verify_query(proof, &path_query)?; - - let protocol_version_map = elements - .into_iter() - .map(|(_, key, element)| { - let pro_tx_hash: [u8; 32] = key.try_into().map_err(|_| { - ProofError::CorruptedProof("protocol version not decodable".to_string()) - })?; - let element = element.ok_or(ProofError::CorruptedProof( - "expected a count for each version, got none".to_string(), - ))?; - let version_bytes = element.as_item_bytes().map_err(|_| { - ProofError::CorruptedProof( - "expected an item for the element of a version".to_string(), - ) - })?; - let version = u32::decode_var(version_bytes) - .ok_or(ProofError::CorruptedProof( - "version count not decodable".to_string(), - ))? - .0; - Ok((pro_tx_hash, version)) - }) - .collect::, Error>>()?; - - Ok((root_hash, protocol_version_map)) - } -} diff --git a/packages/rs-drive/src/drive/votes/cleanup/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/mod.rs new file mode 100644 index 00000000000..55b79c84459 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/mod.rs @@ -0,0 +1,6 @@ +mod remove_all_votes_given_by_identities; +mod remove_contested_resource_vote_poll_contenders_operations; +mod remove_contested_resource_vote_poll_documents_operations; +mod remove_contested_resource_vote_poll_end_date_query_operations; +mod remove_contested_resource_vote_poll_votes_operations; +mod remove_specific_votes_given_by_identity; diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/mod.rs new file mode 100644 index 00000000000..0f5e0d96040 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/mod.rs @@ -0,0 +1,39 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// We remove votes for identities when those identities have been disabled. Currently there is + /// no way to "disable" identities except for masternodes being removed from the list + pub fn remove_all_votes_given_by_identities( + &self, + identity_ids_as_byte_arrays: Vec>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .cleanup + .remove_specific_vote_references_given_by_identity + { + 0 => self.remove_all_votes_given_by_identities_v0( + identity_ids_as_byte_arrays, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "remove_all_votes_given_by_identities".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/v0/mod.rs new file mode 100644 index 00000000000..3c36b0ec647 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/v0/mod.rs @@ -0,0 +1,126 @@ +use crate::drive::Drive; +use std::ops::RangeFull; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::paths::{ + vote_contested_resource_identity_votes_tree_path_for_identity, + vote_contested_resource_identity_votes_tree_path_vec, +}; +use crate::drive::votes::storage_form::contested_document_resource_reference_storage_form::ContestedDocumentResourceVoteReferenceStorageForm; +use crate::query::QueryItem; +use crate::util::grove_operations::BatchDeleteApplyType; +use dpp::prelude::Identifier; +use dpp::version::PlatformVersion; +use grovedb::query_result_type::QueryResultType::QueryPathKeyElementTrioResultType; +use grovedb::{PathQuery, Query, SizedQuery, TransactionArg}; + +impl Drive { + /// We remove votes for an identity when that identity is somehow disabled. Currently there is + /// no way to "disable" identities except for masternodes being removed from the list + pub(super) fn remove_all_votes_given_by_identities_v0( + &self, + identity_ids_as_byte_arrays: Vec>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // We first query for all vote_choices that the identity has + + let vote_path = vote_contested_resource_identity_votes_tree_path_vec(); + + let mut query = Query::new_with_direction(true); + + query.insert_keys(identity_ids_as_byte_arrays); + + let subquery = Query::new_single_query_item(QueryItem::RangeFull(RangeFull)); + + query.set_subquery(subquery); + + let path_query = PathQuery::new(vote_path.clone(), SizedQuery::new(query, None, None)); + + let votes_to_remove_by_identity_id = self + .grove_get_raw_path_query( + &path_query, + transaction, + QueryPathKeyElementTrioResultType, + &mut vec![], + &platform_version.drive, + )? + .0 + .to_last_path_to_key_elements_btree_map(); + + // Then we take each votes and go looking for it (to remove it) + + let mut deletion_batch = vec![]; + + for (identifier_bytes, votes_to_remove) in votes_to_remove_by_identity_id { + let identity_id = Identifier::from_vec(identifier_bytes.clone())?; + let vote_path_ref = vote_contested_resource_identity_votes_tree_path_for_identity( + identity_id.as_bytes(), + ); + + for (vote_id, vote_to_remove) in votes_to_remove { + // We delete the vote item as reference + self.batch_delete( + vote_path_ref.as_slice().into(), + vote_id.as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + &mut deletion_batch, + &platform_version.drive, + )?; + + let serialized_reference = vote_to_remove.into_item_bytes()?; + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let reference: ContestedDocumentResourceVoteReferenceStorageForm = + bincode::decode_from_slice(&serialized_reference, bincode_config) + .map_err(|e| { + Error::Drive(DriveError::CorruptedSerialization(format!( + "serialization of reference {} is corrupted: {}", + hex::encode(serialized_reference), + e + ))) + })? + .0; + let mut absolute_path = reference + .reference_path_type + .absolute_path(vote_path_ref.as_slice(), Some(vote_id.as_slice()))?; + + // we then need to add to the batch the deletion + + absolute_path.pop(); // we need to get rid of the key (which is the identifier bytes) + + let absolute_path_ref: Vec<_> = + absolute_path.iter().map(|a| a.as_slice()).collect(); + + self.batch_delete( + absolute_path_ref.as_slice().into(), + identifier_bytes.as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + &mut deletion_batch, + &platform_version.drive, + )?; + } + } + + if !deletion_batch.is_empty() { + self.apply_batch_low_level_drive_operations( + None, + None, + deletion_batch, + &mut vec![], + &platform_version.drive, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/mod.rs new file mode 100644 index 00000000000..21dcf70e236 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/mod.rs @@ -0,0 +1,51 @@ +mod v0; + +use crate::drive::Drive; +use std::collections::BTreeMap; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::fees::op::LowLevelDriveOperation; +use dpp::identifier::Identifier; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any votes poll should be closed. This will remove them to recoup space + pub fn remove_contested_resource_vote_poll_contenders_operations( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .cleanup + .remove_contested_resource_vote_poll_contenders_operations + { + 0 => self.remove_contested_resource_vote_poll_contenders_operations_v0( + vote_polls, + batch_operations, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "remove_contested_resource_vote_poll_contenders_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v0/mod.rs new file mode 100644 index 00000000000..5e9127abf65 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v0/mod.rs @@ -0,0 +1,47 @@ +use crate::drive::votes::paths::VotePollPaths; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::votes::ResourceVoteChoiceToKeyTrait; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchDeleteApplyType; +use dpp::identifier::Identifier; +use dpp::identity::TimestampMillis; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any vote polls should be closed. + pub(in crate::drive::votes) fn remove_contested_resource_vote_poll_contenders_operations_v0( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + for (vote_poll, _, votes) in vote_polls { + let path = vote_poll.contenders_path(platform_version)?; + for (resource_vote_choice, _) in *votes { + self.batch_delete( + path.as_slice().into(), + resource_vote_choice.to_key().as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + batch_operations, + &platform_version.drive, + )?; + } + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/mod.rs new file mode 100644 index 00000000000..235010a2362 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/mod.rs @@ -0,0 +1,51 @@ +mod v0; + +use crate::drive::Drive; +use std::collections::BTreeMap; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::fees::op::LowLevelDriveOperation; +use dpp::identifier::Identifier; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// We add documents poll references by end date in order to be able to check on every new block if + /// any documents poll should be closed. This will remove them to recoup space + pub fn remove_contested_resource_vote_poll_documents_operations( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .cleanup + .remove_contested_resource_vote_poll_documents_operations + { + 0 => self.remove_contested_resource_vote_poll_documents_operations_v0( + vote_polls, + batch_operations, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "remove_contested_resource_vote_poll_documents_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v0/mod.rs new file mode 100644 index 00000000000..dba3c5369f1 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v0/mod.rs @@ -0,0 +1,85 @@ +use crate::drive::votes::paths::VotePollPaths; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::QueryItem; +use crate::util::grove_operations::BatchDeleteApplyType; +use dpp::identifier::Identifier; +use dpp::identity::TimestampMillis; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::query_result_type::QueryResultType; +use grovedb::{PathQuery, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; +use std::ops::RangeFull; + +impl Drive { + /// We add documents poll references by end date in order to be able to check on every new block if + /// any vote polls should be closed. + pub(in crate::drive::votes) fn remove_contested_resource_vote_poll_documents_operations_v0( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + for (vote_poll, _, vote_choices) in vote_polls { + let documents_storage_path = vote_poll.documents_storage_path_vec(); + + let path_query = PathQuery::new_single_query_item( + documents_storage_path.clone(), + QueryItem::RangeFull(RangeFull), + ); + + let document_keys = self + .grove_get_raw_path_query( + &path_query, + transaction, + QueryResultType::QueryKeyElementPairResultType, + &mut vec![], + &platform_version.drive, + )? + .0 + .to_keys(); + + for document_key in document_keys { + self.batch_delete( + documents_storage_path.as_slice().into(), + document_key.as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + batch_operations, + &platform_version.drive, + )?; + } + + // We also need to delete all the references + + for resource_vote_choice in vote_choices.keys() { + if matches!(resource_vote_choice, ResourceVoteChoice::TowardsIdentity(_)) { + let contender_path = + vote_poll.contender_path(resource_vote_choice, platform_version)?; + self.batch_delete( + contender_path.as_slice().into(), + vec![0].as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + batch_operations, + &platform_version.drive, + )?; + } + } + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/mod.rs new file mode 100644 index 00000000000..73ef67bc5b5 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/mod.rs @@ -0,0 +1,51 @@ +mod v0; + +use crate::drive::Drive; +use std::collections::BTreeMap; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::fees::op::LowLevelDriveOperation; +use dpp::identifier::Identifier; +use dpp::identity::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any votes poll should be closed. This will remove them to recoup space + pub fn remove_contested_resource_vote_poll_end_date_query_operations( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .cleanup + .remove_contested_resource_vote_poll_end_date_query_operations + { + 0 => self.remove_contested_resource_vote_poll_end_date_query_operations_v0( + vote_polls, + batch_operations, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "remove_contested_resource_vote_poll_end_date_query_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v0/mod.rs new file mode 100644 index 00000000000..1f2a36d353f --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v0/mod.rs @@ -0,0 +1,60 @@ +use crate::drive::votes::paths::vote_contested_resource_end_date_queries_at_time_tree_path_vec; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchDeleteUpTreeApplyType; +use dpp::identifier::Identifier; +use dpp::identity::TimestampMillis; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::batch::KeyInfoPath; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any vote polls should be closed. + pub(in crate::drive::votes) fn remove_contested_resource_vote_poll_end_date_query_operations_v0( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // This is a GroveDB Tree (Not Sub Tree Merk representation) + // End Date queries + // / \ + // 15/08/2025 5PM 15/08/2025 6PM + // / \ | + // VotePoll Info 1 VotePoll Info 2 VotePoll Info 3 + + let delete_apply_type = BatchDeleteUpTreeApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }; + + for (vote_poll, end_date, _) in vote_polls { + let time_path = + vote_contested_resource_end_date_queries_at_time_tree_path_vec(**end_date); + + let unique_id = vote_poll.unique_id()?; + + self.batch_delete_up_tree_while_empty( + KeyInfoPath::from_known_owned_path(time_path), + unique_id.as_bytes(), + Some(2), + delete_apply_type.clone(), + transaction, + &None, + batch_operations, + &platform_version.drive, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/mod.rs new file mode 100644 index 00000000000..7ca1b644a7d --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use std::collections::BTreeMap; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::fees::op::LowLevelDriveOperation; +use dpp::identifier::Identifier; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any votes poll should be closed. This will remove them to recoup space + pub fn remove_contested_resource_vote_poll_votes_operations( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + remove_vote_tree_too: bool, + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .cleanup + .remove_contested_resource_vote_poll_votes_operations + { + 0 => self.remove_contested_resource_vote_poll_votes_operations_v0( + vote_polls, + remove_vote_tree_too, + batch_operations, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "remove_contested_resource_vote_poll_votes_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/v0/mod.rs new file mode 100644 index 00000000000..4bd8edcff97 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/v0/mod.rs @@ -0,0 +1,66 @@ +use crate::drive::votes::paths::{VotePollPaths, VOTING_STORAGE_TREE_KEY}; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchDeleteApplyType; +use dpp::identifier::Identifier; +use dpp::identity::TimestampMillis; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any vote polls should be closed. + pub(in crate::drive::votes) fn remove_contested_resource_vote_poll_votes_operations_v0( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + remove_vote_tree_too: bool, + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + for (vote_poll, _, votes) in vote_polls { + for (resource_vote_choice, votes) in *votes { + let path = + vote_poll.contender_voting_path(resource_vote_choice, platform_version)?; + + for vote in votes { + self.batch_delete( + path.as_slice().into(), + vote.as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + batch_operations, + &platform_version.drive, + )?; + } + + let path = vote_poll.contender_path(resource_vote_choice, platform_version)?; + + if remove_vote_tree_too { + self.batch_delete( + path.as_slice().into(), + vec![VOTING_STORAGE_TREE_KEY].as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + batch_operations, + &platform_version.drive, + )?; + } + } + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/mod.rs new file mode 100644 index 00000000000..191d6a4952d --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/mod.rs @@ -0,0 +1,44 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::fees::op::LowLevelDriveOperation; +use dpp::prelude::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// We remove the references of specific votes given by an identity when the vote poll ends + pub fn remove_specific_vote_references_given_by_identity( + &self, + identity_id: &Identifier, + votes: &[&Identifier], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .cleanup + .remove_specific_vote_references_given_by_identity + { + 0 => self.remove_specific_vote_references_given_by_identity_v0( + identity_id, + votes, + batch_operations, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "remove_specific_votes_given_by_identity".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/v0/mod.rs new file mode 100644 index 00000000000..bc8b4679853 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/v0/mod.rs @@ -0,0 +1,42 @@ +use crate::drive::Drive; +use crate::error::Error; + +use crate::drive::votes::paths::vote_contested_resource_identity_votes_tree_path_for_identity; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchDeleteApplyType; +use dpp::prelude::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// We remove votes for an identity when that identity is somehow disabled. Currently there is + /// no way to "disable" identities except for masternodes being removed from the list + pub(super) fn remove_specific_vote_references_given_by_identity_v0( + &self, + identity_id: &Identifier, + votes: &[&Identifier], + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // Then we take each votes and go looking for it (to remove it) + + let vote_path_ref = + vote_contested_resource_identity_votes_tree_path_for_identity(identity_id.as_bytes()); + + for vote_identifier_to_remove in votes { + self.batch_delete( + vote_path_ref.as_slice().into(), + vote_identifier_to_remove.as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + batch_operations, + &platform_version.drive, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/fetch/fetch_contested_document_vote_poll_stored_info/mod.rs b/packages/rs-drive/src/drive/votes/fetch/fetch_contested_document_vote_poll_stored_info/mod.rs new file mode 100644 index 00000000000..aca035f38e1 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/fetch/fetch_contested_document_vote_poll_stored_info/mod.rs @@ -0,0 +1,50 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::block::epoch::Epoch; +use dpp::fee::fee_result::FeeResult; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches a contested resource contest start info. + pub fn fetch_contested_document_vote_poll_stored_info( + &self, + contested_document_resource_vote_poll_with_contract_info: &ContestedDocumentResourceVotePollWithContractInfo, + epoch: Option<&Epoch>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result< + ( + Option, + Option, + ), + Error, + > { + match platform_version + .drive + .methods + .vote + .fetch + .fetch_contested_document_vote_poll_stored_info + { + 0 => self.fetch_contested_document_vote_poll_stored_info_v0( + contested_document_resource_vote_poll_with_contract_info, + epoch, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_contested_document_vote_poll_stored_info".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/fetch/fetch_contested_document_vote_poll_stored_info/v0/mod.rs b/packages/rs-drive/src/drive/votes/fetch/fetch_contested_document_vote_poll_stored_info/v0/mod.rs new file mode 100644 index 00000000000..39cbe1917e6 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/fetch/fetch_contested_document_vote_poll_stored_info/v0/mod.rs @@ -0,0 +1,61 @@ +use crate::drive::votes::paths::{VotePollPaths, RESOURCE_STORED_INFO_KEY_U8_32}; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::Drive; +use crate::error::Error; +use crate::util::grove_operations::DirectQueryType; +use dpp::block::epoch::Epoch; +use dpp::fee::fee_result::FeeResult; +use dpp::serialization::PlatformDeserializable; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Fetches the contested document vote poll stored info + pub(super) fn fetch_contested_document_vote_poll_stored_info_v0( + &self, + contested_document_resource_vote_poll_with_contract_info: &ContestedDocumentResourceVotePollWithContractInfo, + epoch: Option<&Epoch>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result< + ( + Option, + Option, + ), + Error, + > { + let path = contested_document_resource_vote_poll_with_contract_info + .contenders_path(platform_version)?; + let mut cost_operations = vec![]; + let maybe_element = self.grove_get_raw_optional( + path.as_slice().into(), + RESOURCE_STORED_INFO_KEY_U8_32.as_slice(), + DirectQueryType::StatefulDirectQuery, + transaction, + &mut cost_operations, + &platform_version.drive, + )?; + + let fee_result = epoch + .map(|epoch| { + Drive::calculate_fee( + None, + Some(cost_operations), + epoch, + self.config.epochs_per_era, + platform_version, + None, + ) + }) + .transpose()?; + let Some(element) = maybe_element else { + return Ok((fee_result, None)); + }; + let contested_start_info_bytes = element.into_item_bytes()?; + let start_info = ContestedDocumentVotePollStoredInfo::deserialize_from_bytes( + &contested_start_info_bytes, + )?; + Ok((fee_result, Some(start_info))) + } +} diff --git a/packages/rs-drive/src/drive/votes/fetch/fetch_identities_voting_for_contenders/mod.rs b/packages/rs-drive/src/drive/votes/fetch/fetch_identities_voting_for_contenders/mod.rs new file mode 100644 index 00000000000..6337f21cf82 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/fetch/fetch_identities_voting_for_contenders/mod.rs @@ -0,0 +1,46 @@ +mod v0; + +use crate::drive::Drive; +use std::collections::BTreeMap; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::platform_value::Identifier; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches the identities voting for contenders. + pub fn fetch_identities_voting_for_contenders( + &self, + contested_document_resource_vote_poll_with_contract_info: &ContestedDocumentResourceVotePollWithContractInfo, + fetch_contenders: Vec, + also_fetch_abstaining_and_locked_votes: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .vote + .fetch + .fetch_identities_voting_for_contenders + { + 0 => self.fetch_identities_voting_for_contenders_v0( + contested_document_resource_vote_poll_with_contract_info, + fetch_contenders, + also_fetch_abstaining_and_locked_votes, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identities_voting_for_contenders".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/fetch/fetch_identities_voting_for_contenders/v0/mod.rs b/packages/rs-drive/src/drive/votes/fetch/fetch_identities_voting_for_contenders/v0/mod.rs new file mode 100644 index 00000000000..48b2ba3ba3f --- /dev/null +++ b/packages/rs-drive/src/drive/votes/fetch/fetch_identities_voting_for_contenders/v0/mod.rs @@ -0,0 +1,81 @@ +use crate::drive::votes::paths::{ + VotePollPaths, RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32, RESOURCE_LOCK_VOTE_TREE_KEY_U8_32, + VOTING_STORAGE_TREE_KEY, +}; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::Drive; +use crate::error::Error; +use dpp::identifier::Identifier; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::query_result_type::QueryResultType; +use grovedb::{PathQuery, Query, QueryItem, SizedQuery, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; +use std::ops::RangeFull; + +impl Drive { + /// Fetches the identities voting for contenders. + pub fn fetch_identities_voting_for_contenders_v0( + &self, + contested_document_resource_vote_poll_with_contract_info: &ContestedDocumentResourceVotePollWithContractInfo, + fetch_contenders: Vec, + also_fetch_abstaining_and_locked_votes: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + let path = contested_document_resource_vote_poll_with_contract_info + .contenders_path(platform_version)?; + + let mut query = Query::new_with_direction(true); + + query.insert_keys(fetch_contenders.into_iter().map(|id| id.to_vec()).collect()); + if also_fetch_abstaining_and_locked_votes { + query.insert_keys(vec![ + RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.to_vec(), + RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec(), + ]); + } + + query.set_subquery_path(vec![vec![VOTING_STORAGE_TREE_KEY]]); + query.set_subquery(Query::new_single_query_item(QueryItem::RangeFull( + RangeFull, + ))); + + let path_query = PathQuery { + path, + query: SizedQuery { + query, + limit: None, + offset: None, + }, + }; + + self.grove_get_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + &mut vec![], + &platform_version.drive, + )? + .0 + .to_previous_of_last_path_to_keys_btree_map() + .into_iter() + .map(|(key, value_array)| { + let voters_array = value_array + .into_iter() + .map(|value| value.try_into()) + .collect::, dpp::platform_value::Error>>()?; + if key == RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32 { + Ok((ResourceVoteChoice::Abstain, voters_array)) + } else if key == RESOURCE_LOCK_VOTE_TREE_KEY_U8_32 { + Ok((ResourceVoteChoice::Lock, voters_array)) + } else { + Ok(( + ResourceVoteChoice::TowardsIdentity(key.try_into()?), + voters_array, + )) + } + }) + .collect() + } +} diff --git a/packages/rs-drive/src/drive/votes/fetch/fetch_identity_contested_resource_vote/mod.rs b/packages/rs-drive/src/drive/votes/fetch/fetch_identity_contested_resource_vote/mod.rs new file mode 100644 index 00000000000..abf1b6df6c6 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/fetch/fetch_identity_contested_resource_vote/mod.rs @@ -0,0 +1,46 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::fees::op::LowLevelDriveOperation; +use crate::state_transition_action::identity::masternode_vote::v0::PreviousVoteCount; +use dpp::platform_value::Identifier; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// Fetches a specific identity vote. + pub fn fetch_identity_contested_resource_vote( + &self, + masternode_pro_tx_hash: Identifier, + vote_id: Identifier, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .vote + .fetch + .fetch_identity_contested_resource_vote + { + 0 => self.fetch_identity_contested_resource_vote_v0( + masternode_pro_tx_hash, + vote_id, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_identity_contested_resource_vote".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/fetch/fetch_identity_contested_resource_vote/v0/mod.rs b/packages/rs-drive/src/drive/votes/fetch/fetch_identity_contested_resource_vote/v0/mod.rs new file mode 100644 index 00000000000..911aee600a6 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/fetch/fetch_identity_contested_resource_vote/v0/mod.rs @@ -0,0 +1,67 @@ +use crate::drive::votes::paths::vote_contested_resource_identity_votes_tree_path_for_identity; +use crate::drive::votes::storage_form::contested_document_resource_reference_storage_form::ContestedDocumentResourceVoteReferenceStorageForm; +use crate::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; +use crate::drive::votes::tree_path_storage_form::TreePathStorageForm; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::state_transition_action::identity::masternode_vote::v0::PreviousVoteCount; +use crate::util::grove_operations::DirectQueryType; +use dpp::identifier::Identifier; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Fetches the identities voting for contenders. + pub fn fetch_identity_contested_resource_vote_v0( + &self, + masternode_pro_tx_hash: Identifier, + vote_id: Identifier, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let path = vote_contested_resource_identity_votes_tree_path_for_identity( + masternode_pro_tx_hash.as_bytes(), + ); + + let optional_element = self.grove_get_raw_optional( + (&path).into(), + vote_id.as_slice(), + DirectQueryType::StatefulDirectQuery, + transaction, + drive_operations, + &platform_version.drive, + )?; + + optional_element + .map(|element| { + let serialized_reference = element.into_item_bytes()?; + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let reference: ContestedDocumentResourceVoteReferenceStorageForm = + bincode::decode_from_slice(&serialized_reference, bincode_config) + .map_err(|e| { + Error::Drive(DriveError::CorruptedSerialization(format!( + "serialization of reference {} is corrupted: {}", + hex::encode(serialized_reference), + e + ))) + })? + .0; + let absolute_path = reference + .reference_path_type + .absolute_path(path.as_slice(), Some(vote_id.as_slice()))?; + let vote_storage_form = + ContestedDocumentResourceVoteStorageForm::try_from_tree_path(absolute_path)?; + Ok(( + vote_storage_form.resource_vote_choice, + reference.identity_vote_times, + )) + }) + .transpose() + } +} diff --git a/packages/rs-drive/src/drive/votes/fetch/mod.rs b/packages/rs-drive/src/drive/votes/fetch/mod.rs new file mode 100644 index 00000000000..74748b04f0c --- /dev/null +++ b/packages/rs-drive/src/drive/votes/fetch/mod.rs @@ -0,0 +1,3 @@ +mod fetch_contested_document_vote_poll_stored_info; +mod fetch_identities_voting_for_contenders; +mod fetch_identity_contested_resource_vote; diff --git a/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/mod.rs b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/mod.rs new file mode 100644 index 00000000000..f6a3d69e8c6 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/mod.rs @@ -0,0 +1 @@ +mod register_contested_resource_identity_vote; diff --git a/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/mod.rs b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/mod.rs new file mode 100644 index 00000000000..259f9b45878 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/mod.rs @@ -0,0 +1,140 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::fee::fee_result::FeeResult; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::fees::op::LowLevelDriveOperation; +use crate::state_transition_action::identity::masternode_vote::v0::PreviousVoteCount; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// Registers a vote for a contested resource based on the voter's identifier, + /// vote poll, and the specific vote choice. + /// + /// # Parameters + /// + /// - `voter_pro_tx_hash`: A 32-byte array representing the ProRegTx hash of the voter. + /// - `vote_poll`: The specific contested document resource vote poll context. + /// - `vote_choice`: The choice made by the voter on the contested resource. + /// - `block_info`: Reference to the block information at the time of the vote. + /// - `apply`: Boolean flag indicating whether to apply the vote to the database immediately. + /// - `transaction`: Transaction arguments providing context for this operation. + /// - `platform_version`: Reference to the platform version against which the operation is executed. + /// + /// # Returns + /// + /// Returns a `Result` that, on success, includes the `FeeResult` detailing any fees applied as a result of the vote. + /// On failure, it returns an `Error`. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The platform version is unknown or unsupported. + /// - There is an issue processing the transaction or applying it to the database. + /// + + pub fn register_contested_resource_identity_vote( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + vote_choice: ResourceVoteChoice, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .vote + .contested_resource_insert + .register_contested_resource_identity_vote + { + 0 => self.register_contested_resource_identity_vote_v0( + voter_pro_tx_hash, + strength, + vote_poll, + vote_choice, + previous_resource_vote_choice_to_remove, + block_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "register_contested_resource_identity_vote".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Gathers and returns low-level drive operations needed to register a vote for a contested resource, + /// considering the voter's identifier, vote poll, and vote choice, optionally estimating costs. + /// + /// # Parameters + /// + /// - `voter_pro_tx_hash`: A 32-byte array representing the ProRegTx hash of the voter. + /// - `vote_poll`: The specific contested document resource vote poll context. + /// - `vote_choice`: The choice made by the voter on the contested resource. + /// - `block_info`: Reference to the block information at the time of the vote. + /// - `estimated_costs_only_with_layer_info`: A mutable reference to an optional HashMap that, if provided, + /// will be filled with estimated costs and layer information necessary for processing the vote. + /// - `transaction`: Transaction arguments providing context for this operation. + /// - `platform_version`: Reference to the platform version against which the operation is executed. + /// + /// # Returns + /// + /// Returns a `Result` containing a vector of `LowLevelDriveOperation` detailing the necessary operations + /// to execute the vote registration, or an `Error` if the operation cannot be completed. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The platform version is unknown or unsupported. + /// - Any low-level drive operation fails due to transaction or database inconsistencies. + /// + pub fn register_contested_resource_identity_vote_operations( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + vote_choice: ResourceVoteChoice, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .vote + .contested_resource_insert + .register_contested_resource_identity_vote + { + 0 => self.register_contested_resource_identity_vote_operations_v0( + voter_pro_tx_hash, + strength, + vote_poll, + vote_choice, + previous_resource_vote_choice_to_remove, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "register_contested_resource_identity_vote_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/v0/mod.rs b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/v0/mod.rs new file mode 100644 index 00000000000..c7b284b845c --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/v0/mod.rs @@ -0,0 +1,170 @@ +use crate::drive::votes::paths::{ + vote_contested_resource_identity_votes_tree_path_for_identity_vec, + vote_contested_resource_identity_votes_tree_path_vec, VotePollPaths, +}; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::votes::storage_form::contested_document_resource_reference_storage_form::ContestedDocumentResourceVoteReferenceStorageForm; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::state_transition_action::identity::masternode_vote::v0::PreviousVoteCount; +use crate::util::grove_operations::{BatchDeleteApplyType, BatchInsertTreeApplyType}; +use crate::util::object_size_info::PathKeyElementInfo::PathKeyElement; +use crate::util::object_size_info::PathKeyInfo; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::{bincode, ProtocolError}; +use grovedb::reference_path::ReferencePathType; +use grovedb::{Element, TransactionArg}; +use platform_version::version::PlatformVersion; + +impl Drive { + pub(super) fn register_contested_resource_identity_vote_v0( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + vote_choice: ResourceVoteChoice, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let batch_operations = self.register_contested_resource_identity_vote_operations_v0( + voter_pro_tx_hash, + strength, + vote_poll, + vote_choice, + previous_resource_vote_choice_to_remove, + transaction, + platform_version, + )?; + + let mut drive_operations: Vec = vec![]; + self.apply_batch_low_level_drive_operations( + None, + transaction, + batch_operations, + &mut drive_operations, + &platform_version.drive, + )?; + + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + Ok(fees) + } + + pub(super) fn register_contested_resource_identity_vote_operations_v0( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + vote_choice: ResourceVoteChoice, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // We do not have to do estimated costs because voting does not use them and is fixed cost + let mut drive_operations: Vec = vec![]; + + // The vote at this point will have been verified as valid by rs-drive-abci + + // We start by inserting the main vote as a value of 1 or 4 depending on the strength + + let mut voting_path = vote_poll.contender_voting_path(&vote_choice, platform_version)?; + + self.batch_insert::<0>( + PathKeyElement(( + voting_path.clone(), + voter_pro_tx_hash.to_vec(), + Element::new_sum_item(strength as i64), + )), + &mut drive_operations, + &platform_version.drive, + )?; + + let mut identity_vote_times = 1; + + if let Some((previous_resource_vote_choice_to_remove, previous_vote_count)) = + previous_resource_vote_choice_to_remove + { + let previous_voting_path = vote_poll.contender_voting_path( + &previous_resource_vote_choice_to_remove, + platform_version, + )?; + + self.batch_delete( + previous_voting_path.as_slice().into(), + voter_pro_tx_hash.as_slice(), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, true)), + }, + transaction, + &mut drive_operations, + &platform_version.drive, + )?; + + identity_vote_times += previous_vote_count; + } + + let votes_identities_path = vote_contested_resource_identity_votes_tree_path_vec(); + + self.batch_insert_empty_tree_if_not_exists( + PathKeyInfo::PathKey::<0>((votes_identities_path, voter_pro_tx_hash.to_vec())), + false, + None, + BatchInsertTreeApplyType::StatefulBatchInsertTree, //todo this shouldn't always be stateful + transaction, + &mut None, //we shouldn't have more than one document here + &mut drive_operations, + &platform_version.drive, + )?; + + // Now we create the vote reference + + let path = + vote_contested_resource_identity_votes_tree_path_for_identity_vec(&voter_pro_tx_hash); + + voting_path.remove(0); // we remove the top (root tree vote key) + voting_path.remove(0); // contested resource + + let reference_path_type = + ReferencePathType::UpstreamRootHeightWithParentPathAdditionReference(2, voting_path); + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let storage_form = ContestedDocumentResourceVoteReferenceStorageForm { + reference_path_type, + identity_vote_times, + }; + let encoded_reference = bincode::encode_to_vec(storage_form, config).map_err(|e| { + Error::Protocol(ProtocolError::CorruptedSerialization(format!( + "can not encode reference: {}", + e + ))) + })?; + + self.batch_insert::<0>( + PathKeyElement(( + path, + vote_poll.unique_id()?.to_vec(), + // We store the encoded reference as an item on purpose as we want the advantages of a resolvable + // reference, but at the same time, we don't want the proof to have the value of the followed + // reference, because here there is no point, it being 1 or 4. + Element::new_item(encoded_reference), + )), + &mut drive_operations, + &platform_version.drive, + )?; + + Ok(drive_operations) + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/contested_resource/insert_stored_info_for_contested_resource_vote_poll/mod.rs b/packages/rs-drive/src/drive/votes/insert/contested_resource/insert_stored_info_for_contested_resource_vote_poll/mod.rs new file mode 100644 index 00000000000..6b98c9b9817 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/contested_resource/insert_stored_info_for_contested_resource_vote_poll/mod.rs @@ -0,0 +1,71 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Inserts a record of a finished vote poll that can later be queried + pub fn insert_stored_info_for_contested_resource_vote_poll( + &self, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + finalized_contested_document_vote_poll_stored_info: ContestedDocumentVotePollStoredInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .contested_resource_insert + .insert_stored_info_for_contested_resource_vote_poll + { + 0 => self.insert_stored_info_for_contested_resource_vote_poll_v0( + vote_poll, + finalized_contested_document_vote_poll_stored_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "insert_stored_info_for_contested_resource_vote_poll".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Returns the operations of inserting a record of a finished vote poll that can later be queried + pub fn insert_stored_info_for_contested_resource_vote_poll_operations( + &self, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + finalized_contested_document_vote_poll_stored_info: ContestedDocumentVotePollStoredInfo, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .vote + .contested_resource_insert + .insert_stored_info_for_contested_resource_vote_poll + { + 0 => self.insert_stored_info_for_contested_resource_vote_poll_operations_v0( + vote_poll, + finalized_contested_document_vote_poll_stored_info, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "insert_stored_info_for_contested_resource_vote_poll_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/contested_resource/insert_stored_info_for_contested_resource_vote_poll/v0/mod.rs b/packages/rs-drive/src/drive/votes/insert/contested_resource/insert_stored_info_for_contested_resource_vote_poll/v0/mod.rs new file mode 100644 index 00000000000..96e2e26a41d --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/contested_resource/insert_stored_info_for_contested_resource_vote_poll/v0/mod.rs @@ -0,0 +1,63 @@ +use crate::drive::votes::paths::{VotePollPaths, RESOURCE_STORED_INFO_KEY_U8_32}; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo::PathKeyElement; +use dpp::serialization::PlatformSerializable; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use grovedb::{Element, TransactionArg}; +use platform_version::version::PlatformVersion; + +impl Drive { + pub(super) fn insert_stored_info_for_contested_resource_vote_poll_v0( + &self, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + finalized_contested_document_vote_poll_stored_info: ContestedDocumentVotePollStoredInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let batch_operations = self + .insert_stored_info_for_contested_resource_vote_poll_operations_v0( + vote_poll, + finalized_contested_document_vote_poll_stored_info, + platform_version, + )?; + + let mut drive_operations: Vec = vec![]; + self.apply_batch_low_level_drive_operations( + None, + transaction, + batch_operations, + &mut drive_operations, + &platform_version.drive, + )?; + + Ok(()) + } + + pub(super) fn insert_stored_info_for_contested_resource_vote_poll_operations_v0( + &self, + vote_poll: &ContestedDocumentResourceVotePollWithContractInfo, + finalized_contested_document_vote_poll_stored_info: ContestedDocumentVotePollStoredInfo, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations: Vec = vec![]; + + let serialization = + finalized_contested_document_vote_poll_stored_info.serialize_consume_to_bytes()?; + let vote_poll_root_path = vote_poll.contenders_path(platform_version)?; + + self.batch_insert::<0>( + PathKeyElement(( + vote_poll_root_path.clone(), + RESOURCE_STORED_INFO_KEY_U8_32.to_vec(), + Element::new_item(serialization), + )), + &mut drive_operations, + &platform_version.drive, + )?; + + Ok(drive_operations) + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/contested_resource/mod.rs b/packages/rs-drive/src/drive/votes/insert/contested_resource/mod.rs new file mode 100644 index 00000000000..810a208e76f --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/contested_resource/mod.rs @@ -0,0 +1,2 @@ +mod individual_vote; +mod insert_stored_info_for_contested_resource_vote_poll; diff --git a/packages/rs-drive/src/drive/votes/insert/mod.rs b/packages/rs-drive/src/drive/votes/insert/mod.rs new file mode 100644 index 00000000000..67ea229fe2a --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/mod.rs @@ -0,0 +1,3 @@ +mod contested_resource; +mod register_identity_vote; +mod vote_poll; diff --git a/packages/rs-drive/src/drive/votes/insert/register_identity_vote/mod.rs b/packages/rs-drive/src/drive/votes/insert/register_identity_vote/mod.rs new file mode 100644 index 00000000000..9084376e304 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/register_identity_vote/mod.rs @@ -0,0 +1,133 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::fee::fee_result::FeeResult; + +use crate::drive::votes::resolved::votes::ResolvedVote; +use crate::fees::op::LowLevelDriveOperation; +use crate::state_transition_action::identity::masternode_vote::v0::PreviousVoteCount; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; + +impl Drive { + /// Registers a vote associated with a specific identity using the given voter's ProRegTx hash. + /// This function applies the vote to the blockchain state if specified, within the context of the given block. + /// + /// # Parameters + /// + /// - `voter_pro_tx_hash`: A 32-byte array representing the ProRegTx hash of the voter. + /// - `strength`: the strength of the vote, masternodes have 1, evonodes have 4 + /// - `vote`: The vote to be registered, encapsulating the decision made by the voter. + /// - `block_info`: Reference to the block information at the time of the vote. + /// - `apply`: A boolean flag indicating whether the vote should be immediately applied to the state. + /// - `transaction`: Contextual transaction arguments that may affect the processing of the vote. + /// - `platform_version`: Reference to the platform version to ensure compatibility of the vote registration method. + /// + /// # Returns + /// + /// Returns a `Result`, where `FeeResult` includes any fees applied as a result of registering the vote, + /// and `Error` captures any issues encountered during the process. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// - The platform version is unknown or unsupported, resulting in a version mismatch error. + /// - There is a failure in processing the vote due to transaction or blockchain state issues. + /// + pub fn register_identity_vote( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote: ResolvedVote, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .vote + .contested_resource_insert + .register_identity_vote + { + 0 => self.register_identity_vote_v0( + voter_pro_tx_hash, + strength, + vote, + previous_resource_vote_choice_to_remove, + block_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "register_identity_vote".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Prepares and returns a list of low-level drive operations necessary for registering a vote, + /// based on the voter's ProRegTx hash and current block information. This method can also estimate costs + /// if required, which helps in preparing for the actual application of the vote. + /// + /// # Parameters + /// + /// - `voter_pro_tx_hash`: A 32-byte array representing the ProRegTx hash of the voter. + /// - `vote`: The vote to be registered, detailing the decision made. + /// - `block_info`: Reference to current block information. + /// - `estimated_costs_only_with_layer_info`: A mutable reference to an optional HashMap that, if provided, + /// will be filled with estimated cost and layer information required for processing the vote. + /// - `transaction`: Contextual transaction arguments that may influence the generation of operations. + /// - `platform_version`: Reference to the platform version to ensure compatibility of the operation generation method. + /// + /// # Returns + /// + /// Returns a `Result, Error>`, where `Vec` contains the detailed operations needed, + /// and `Error` captures any issues encountered during the operation preparation. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// - The platform version is unknown or unsupported, resulting in a version mismatch error. + /// - There are issues generating the necessary operations due to transaction inconsistencies or blockchain state errors. + /// + pub fn register_identity_vote_operations( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote: ResolvedVote, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .vote + .contested_resource_insert + .register_identity_vote + { + 0 => self.register_identity_vote_operations_v0( + voter_pro_tx_hash, + strength, + vote, + previous_resource_vote_choice_to_remove, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "register_identity_vote_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/register_identity_vote/v0/mod.rs b/packages/rs-drive/src/drive/votes/insert/register_identity_vote/v0/mod.rs new file mode 100644 index 00000000000..05a488136af --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/register_identity_vote/v0/mod.rs @@ -0,0 +1,74 @@ +use crate::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use crate::drive::votes::resolved::votes::resolved_resource_vote::accessors::v0::ResolvedResourceVoteGettersV0; +use crate::drive::votes::resolved::votes::ResolvedVote; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::state_transition_action::identity::masternode_vote::v0::PreviousVoteCount; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl Drive { + pub(super) fn register_identity_vote_v0( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote: ResolvedVote, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match vote { + ResolvedVote::ResolvedResourceVote(resource_vote) => { + let vote_choice = resource_vote.resource_vote_choice(); + match resource_vote.vote_poll_owned() { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll, + ) => self.register_contested_resource_identity_vote( + voter_pro_tx_hash, + strength, + contested_document_resource_vote_poll, + vote_choice, + previous_resource_vote_choice_to_remove, + block_info, + transaction, + platform_version, + ), + } + } + } + } + + pub(super) fn register_identity_vote_operations_v0( + &self, + voter_pro_tx_hash: [u8; 32], + strength: u8, + vote: ResolvedVote, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match vote { + ResolvedVote::ResolvedResourceVote(resource_vote) => { + let vote_choice = resource_vote.resource_vote_choice(); + match resource_vote.vote_poll_owned() { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll, + ) => self.register_contested_resource_identity_vote_operations( + voter_pro_tx_hash, + strength, + contested_document_resource_vote_poll, + vote_choice, + previous_resource_vote_choice_to_remove, + transaction, + platform_version, + ), + } + } + } + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/mod.rs b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/mod.rs new file mode 100644 index 00000000000..80b2c4fcd18 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/mod.rs @@ -0,0 +1,59 @@ +mod v0; + +use crate::drive::Drive; +use grovedb::batch::KeyInfoPath; +use std::collections::HashMap; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::VotePoll; +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any votes poll should be closed. + pub fn add_vote_poll_end_date_query_operations( + &self, + creator_identity_id: Option<[u8; 32]>, + vote_poll: VotePoll, + end_date: TimestampMillis, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + previous_batch_operations: &mut Option<&mut Vec>, + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .contested_resource_insert + .add_vote_poll_end_date_query_operations + { + 0 => self.add_vote_poll_end_date_query_operations_v0( + creator_identity_id, + vote_poll, + end_date, + block_info, + estimated_costs_only_with_layer_info, + previous_batch_operations, + batch_operations, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_vote_poll_end_date_query_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs new file mode 100644 index 00000000000..ea2fc698ff1 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs @@ -0,0 +1,165 @@ +use crate::drive::constants::AVERAGE_CONTESTED_RESOURCE_ITEM_REFERENCE_SIZE; +use crate::drive::votes::paths::{ + vote_contested_resource_end_date_queries_at_time_tree_path_vec, + vote_end_date_queries_tree_path, vote_end_date_queries_tree_path_vec, +}; +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::common::encode::encode_u64; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use crate::util::grove_operations::{BatchInsertApplyType, BatchInsertTreeApplyType}; +use crate::util::object_size_info::PathKeyElementInfo::{PathKeyElementSize, PathKeyRefElement}; +use crate::util::object_size_info::{DriveKeyInfo, PathInfo, PathKeyElementInfo}; +use crate::util::storage_flags::StorageFlags; +use crate::util::type_constants::{DEFAULT_HASH_SIZE_U8, U64_SIZE_U8}; +use dpp::block::block_info::BlockInfo; +use dpp::identity::TimestampMillis; +use dpp::serialization::PlatformSerializable; +use dpp::voting::vote_polls::VotePoll; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerCount::ApproximateElements; +use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::HashMap; + +impl Drive { + /// We add votes poll references by end date in order to be able to check on every new block if + /// any vote polls should be closed. + pub(in crate::drive::votes::insert) fn add_vote_poll_end_date_query_operations_v0( + &self, + creator_identity_id: Option<[u8; 32]>, + vote_poll: VotePoll, + end_date: TimestampMillis, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + previous_batch_operations: &mut Option<&mut Vec>, + batch_operations: &mut Vec, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let storage_flags = creator_identity_id.map(|creator_identity_id| { + StorageFlags::new_single_epoch(block_info.epoch.index, Some(creator_identity_id)) + }); + + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_path(vote_end_date_queries_tree_path()), + EstimatedLayerInformation { + is_sum_tree: false, + // We can estimate that there is at least a vote concluding every block, and we put blocks at 6 seconds. + estimated_layer_count: ApproximateElements(201_600), + estimated_layer_sizes: AllSubtrees( + U64_SIZE_U8, + NoSumTrees, + Some(StorageFlags::approximate_size(true, None)), + ), + }, + ); + + estimated_costs_only_with_layer_info.insert( + KeyInfoPath::from_known_owned_path( + vote_contested_resource_end_date_queries_at_time_tree_path_vec(end_date), + ), + EstimatedLayerInformation { + is_sum_tree: false, + // We can estimate that there is 2 votes ending per block. + estimated_layer_count: ApproximateElements(2), + estimated_layer_sizes: AllItems( + DEFAULT_HASH_SIZE_U8, + AVERAGE_CONTESTED_RESOURCE_ITEM_REFERENCE_SIZE, + Some(StorageFlags::approximate_size(true, None)), + ), + }, + ); + } + + // This is a GroveDB Tree (Not Sub Tree Merk representation) + // End Date queries + // / \ + // 15/08/2025 5PM 15/08/2025 6PM + // / \ | + // VotePoll Info 1 VotePoll Info 2 VotePoll Info 3 + + // Let's start by inserting a tree for the end date + + let end_date_query_path = vote_end_date_queries_tree_path_vec(); + + let drive_key = DriveKeyInfo::Key(encode_u64(end_date)); + + let path_key_info = drive_key.add_path_info::<0>(PathInfo::PathAsVec(end_date_query_path)); + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertTreeApplyType::StatefulBatchInsertTree + } else { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums: false, + is_sum_tree: false, + flags_len: storage_flags + .as_ref() + .map(|s| s.serialized_size()) + .unwrap_or_default(), + } + }; + + // We check existing operations just because it is possible that we have already inserted the same + // end data in the documents batch transition + self.batch_insert_empty_tree_if_not_exists( + path_key_info.clone(), + false, + storage_flags.as_ref(), + apply_type, + transaction, + previous_batch_operations, + batch_operations, + &platform_version.drive, + )?; + + let time_path = vote_contested_resource_end_date_queries_at_time_tree_path_vec(end_date); + + let item = Element::Item( + vote_poll.serialize_to_bytes()?, + StorageFlags::map_to_some_element_flags(storage_flags.as_ref()), + ); + + let apply_type = if estimated_costs_only_with_layer_info.is_none() { + BatchInsertApplyType::StatefulBatchInsert + } else { + BatchInsertApplyType::StatelessBatchInsert { + in_tree_using_sums: false, + // todo: figure out a default serialized size to make this faster + target: QueryTargetValue( + item.serialized_size(&platform_version.drive.grove_version)? as u32, + ), + } + }; + + let unique_id = vote_poll.unique_id()?; + + let path_key_element_info: PathKeyElementInfo<'_, 0> = + if estimated_costs_only_with_layer_info.is_none() { + PathKeyRefElement((time_path, unique_id.as_bytes(), item)) + } else { + PathKeyElementSize(( + KeyInfoPath::from_known_owned_path(time_path), + KeyInfo::KnownKey(unique_id.to_vec()), + item, + )) + }; + + self.batch_insert_if_not_exists( + path_key_element_info, + apply_type, + transaction, + batch_operations, + &platform_version.drive, + )?; + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/insert/vote_poll/mod.rs b/packages/rs-drive/src/drive/votes/insert/vote_poll/mod.rs new file mode 100644 index 00000000000..26d37fb179b --- /dev/null +++ b/packages/rs-drive/src/drive/votes/insert/vote_poll/mod.rs @@ -0,0 +1 @@ +mod add_vote_poll_end_date_query_operations; diff --git a/packages/rs-drive/src/drive/votes/mod.rs b/packages/rs-drive/src/drive/votes/mod.rs new file mode 100644 index 00000000000..c33ad698924 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/mod.rs @@ -0,0 +1,113 @@ +use crate::drive::document::paths::contract_document_type_path; +use crate::drive::votes::paths::{ + RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32, RESOURCE_LOCK_VOTE_TREE_KEY_U8_32, +}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::DataContract; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; +use dpp::voting::votes::resource_vote::ResourceVote; +use dpp::voting::votes::Vote; +use dpp::ProtocolError; + +#[cfg(feature = "server")] +mod cleanup; + +#[cfg(feature = "server")] +mod insert; + +/// Paths important for the module +#[cfg(any(feature = "server", feature = "verify"))] +pub mod paths; + +#[cfg(feature = "server")] +mod setup; + +#[cfg(any(feature = "server", feature = "verify"))] +/// Resolve contested document resource vote poll module +pub mod resolved; +#[cfg(any(feature = "server", feature = "verify"))] +/// Storage form +pub mod storage_form; +#[cfg(any(feature = "server", feature = "verify"))] +/// Tree path storage form +pub mod tree_path_storage_form; + +#[cfg(feature = "server")] +mod fetch; + +/// A trait to convert the vote to a tree path usable in grovedb +pub trait TreePath { + /// The tree path function + fn tree_path<'a>(&'a self, contract: &'a DataContract) -> Result, ProtocolError>; +} + +impl TreePath for Vote { + fn tree_path<'a>(&'a self, contract: &'a DataContract) -> Result, ProtocolError> { + match self { + Vote::ResourceVote(resource_vote) => resource_vote.tree_path(contract), + } + } +} + +impl TreePath for ResourceVote { + fn tree_path<'a>(&'a self, contract: &'a DataContract) -> Result, ProtocolError> { + let vote_poll = self.vote_poll(); + + match vote_poll { + VotePoll::ContestedDocumentResourceVotePoll(contested_document_vote_poll) => { + if contract.id() != contested_document_vote_poll.contract_id { + return Err(ProtocolError::VoteError(format!( + "contract id of votes {} does not match supplied contract {}", + contested_document_vote_poll.contract_id, + contract.id() + ))); + } + let document_type = contract.document_type_borrowed_for_name( + &contested_document_vote_poll.document_type_name, + )?; + let index = document_type + .indexes() + .get(&contested_document_vote_poll.index_name) + .ok_or(ProtocolError::UnknownContestedIndexResolution(format!( + "no index named {} for document type {} on contract with id {}", + &contested_document_vote_poll.index_name, + document_type.name(), + contract.id() + )))?; + let mut path = contract_document_type_path( + contested_document_vote_poll.contract_id.as_bytes(), + &contested_document_vote_poll.document_type_name, + ) + .to_vec(); + + // at this point the path only contains the parts before the index + + let mut properties_iter = index.properties.iter(); + + while let Some(index_part) = properties_iter.next() { + path.push(index_part.name.as_bytes()); + } + Ok(path) + } + } + } +} + +/// A helper trait to get the key for a resource vote +pub trait ResourceVoteChoiceToKeyTrait { + /// A helper function to get the key for a resource vote + fn to_key(&self) -> Vec; +} + +impl ResourceVoteChoiceToKeyTrait for ResourceVoteChoice { + fn to_key(&self) -> Vec { + match self { + ResourceVoteChoice::TowardsIdentity(identity_id) => identity_id.to_vec(), + ResourceVoteChoice::Abstain => RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.to_vec(), + ResourceVoteChoice::Lock => RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec(), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/paths.rs b/packages/rs-drive/src/drive/votes/paths.rs new file mode 100644 index 00000000000..35874e6f60f --- /dev/null +++ b/packages/rs-drive/src/drive/votes/paths.rs @@ -0,0 +1,518 @@ +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::{ + ContestedDocumentResourceVotePollWithContractInfo, + ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed, +}; +use crate::drive::votes::ResourceVoteChoiceToKeyTrait; +use crate::drive::RootTree; +use crate::error::Error; +use crate::util::common::encode::encode_u64; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::data_contract::document_type::IndexProperty; +use dpp::identity::TimestampMillis; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use platform_version::version::PlatformVersion; + +/// The votes tree structure looks like this +/// +/// ```text +/// Votes +/// +/// |- End date Queries [key: "e"] +/// |- Decisions [key: "d"] +/// |- Contested Resource [key: "c"] +/// |- Active polls [key: "p"] +/// |- Identifier Votes Query [key: "i"] +/// ``` +/// + +/// A subtree made for polls to the network that represent decisions. +pub const VOTE_DECISIONS_TREE_KEY: char = 'd'; + +/// A subtree made for contested resources that will be voted on. +pub const CONTESTED_RESOURCE_TREE_KEY: char = 'c'; + +/// A subtree made for being able to query the end date of votes +pub const END_DATE_QUERIES_TREE_KEY: char = 'e'; + +/// The currently active polls +pub const ACTIVE_POLLS_TREE_KEY: char = 'p'; + +/// A subtree made for being able to query votes that an identity has made +pub const IDENTITY_VOTES_TREE_KEY: char = 'i'; + +/// The finished info +pub const RESOURCE_STORED_INFO_KEY_U8_32: [u8; 32] = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +]; + +/// In the active vote poll this will contain votes for abstaining on the vote for the contested resource +pub const RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32: [u8; 32] = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, +]; + +/// In the active vote poll this will contain votes for locking the contested resource +pub const RESOURCE_LOCK_VOTE_TREE_KEY_U8_32: [u8; 32] = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, +]; + +/// The tree key for storage of contested documents +pub const CONTESTED_DOCUMENT_STORAGE_TREE_KEY: u8 = 0; + +/// The tree key for the indexes of contested documents +pub const CONTESTED_DOCUMENT_INDEXES_TREE_KEY: u8 = 1; + +/// The tree key for storage +pub const VOTING_STORAGE_TREE_KEY: u8 = 1; + +/// Convenience methods to be easily able to get a path when we know the vote poll +pub trait VotePollPaths { + /// The root path, under this there should be the documents area and the contract itself + fn contract_path(&self) -> [&[u8]; 4]; + + /// The root path, under this there should be the documents area and the contract itself as a vec + fn contract_path_vec(&self) -> Vec>; + + /// The documents path, under this you should have the various document types + fn document_type_path(&self) -> [&[u8]; 5]; + + /// The documents path, under this you should have the various document types as a vec + fn document_type_path_vec(&self) -> Vec>; + + /// The documents storage path + fn documents_storage_path(&self) -> [&[u8]; 6]; + + /// The documents storage path as a vec + fn documents_storage_path_vec(&self) -> Vec>; + + /// The contenders path as a vec + fn contenders_path(&self, platform_version: &PlatformVersion) -> Result>, Error>; + + /// The path that would store the contender information for a single contender + fn contender_path( + &self, + vote_choice: &ResourceVoteChoice, + platform_version: &PlatformVersion, + ) -> Result>, Error>; + + /// The path that would store the votes for a single contender + fn contender_voting_path( + &self, + vote_choice: &ResourceVoteChoice, + platform_version: &PlatformVersion, + ) -> Result>, Error>; +} + +impl VotePollPaths for ContestedDocumentResourceVotePollWithContractInfo { + fn contract_path(&self) -> [&[u8]; 4] { + vote_contested_resource_active_polls_contract_tree_path( + self.contract.as_ref().id_ref().as_slice(), + ) + } + + fn contract_path_vec(&self) -> Vec> { + vote_contested_resource_active_polls_contract_tree_path_vec( + self.contract.as_ref().id_ref().as_slice(), + ) + } + + fn document_type_path(&self) -> [&[u8]; 5] { + vote_contested_resource_active_polls_contract_document_tree_path( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn document_type_path_vec(&self) -> Vec> { + vote_contested_resource_active_polls_contract_document_tree_path_vec( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn documents_storage_path(&self) -> [&[u8]; 6] { + vote_contested_resource_contract_documents_storage_path( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn documents_storage_path_vec(&self) -> Vec> { + vote_contested_resource_contract_documents_storage_path_vec( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn contenders_path(&self, platform_version: &PlatformVersion) -> Result>, Error> { + let mut root = vote_contested_resource_contract_documents_indexes_path_vec( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ); + let document_type = self.document_type()?; + root.append( + &mut self + .index()? + .properties + .iter() + .zip(self.index_values.iter()) + .map(|(IndexProperty { name, .. }, value)| { + document_type + .serialize_value_for_key(name, value, platform_version) + .map_err(Error::Protocol) + }) + .collect::>, Error>>()?, + ); + Ok(root) + } + + fn contender_path( + &self, + vote_choice: &ResourceVoteChoice, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + let mut contenders_path = self.contenders_path(platform_version)?; + contenders_path.push(vote_choice.to_key()); + Ok(contenders_path) + } + + fn contender_voting_path( + &self, + vote_choice: &ResourceVoteChoice, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + let key = vote_choice.to_key(); + let mut contender_voting_path = self.contenders_path(platform_version)?; + contender_voting_path.push(key); + contender_voting_path.push(vec![VOTING_STORAGE_TREE_KEY]); + Ok(contender_voting_path) + } +} + +impl<'a> VotePollPaths for ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a> { + fn contract_path(&self) -> [&[u8]; 4] { + vote_contested_resource_active_polls_contract_tree_path( + self.contract.as_ref().id_ref().as_slice(), + ) + } + + fn contract_path_vec(&self) -> Vec> { + vote_contested_resource_active_polls_contract_tree_path_vec( + self.contract.as_ref().id_ref().as_slice(), + ) + } + + fn document_type_path(&self) -> [&[u8]; 5] { + vote_contested_resource_active_polls_contract_document_tree_path( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn document_type_path_vec(&self) -> Vec> { + vote_contested_resource_active_polls_contract_document_tree_path_vec( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn documents_storage_path(&self) -> [&[u8]; 6] { + vote_contested_resource_contract_documents_storage_path( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn documents_storage_path_vec(&self) -> Vec> { + vote_contested_resource_contract_documents_storage_path_vec( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ) + } + + fn contenders_path(&self, platform_version: &PlatformVersion) -> Result>, Error> { + let mut root = vote_contested_resource_contract_documents_indexes_path_vec( + self.contract.as_ref().id_ref().as_slice(), + self.document_type_name.as_str(), + ); + let document_type = self.document_type()?; + root.append( + &mut self + .index()? + .properties + .iter() + .zip(self.index_values.iter()) + .map(|(IndexProperty { name, .. }, value)| { + document_type + .serialize_value_for_key(name, value, platform_version) + .map_err(Error::Protocol) + }) + .collect::>, Error>>()?, + ); + Ok(root) + } + + fn contender_path( + &self, + vote_choice: &ResourceVoteChoice, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + let mut contenders_path = self.contenders_path(platform_version)?; + contenders_path.push(vote_choice.to_key()); + Ok(contenders_path) + } + + fn contender_voting_path( + &self, + vote_choice: &ResourceVoteChoice, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + let key = vote_choice.to_key(); + let mut contender_voting_path = self.contenders_path(platform_version)?; + contender_voting_path.push(key); + contender_voting_path.push(vec![VOTING_STORAGE_TREE_KEY]); + Ok(contender_voting_path) + } +} + +/// the root path of the voting branch +pub fn vote_root_path<'a>() -> [&'a [u8]; 1] { + [Into::<&[u8; 1]>::into(RootTree::Votes)] +} + +/// the root path of the voting branch as a vec +pub fn vote_root_path_vec() -> Vec> { + vec![vec![RootTree::Votes as u8]] +} + +/// the decisions path of the voting branch +pub fn vote_decisions_tree_path<'a>() -> [&'a [u8]; 2] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), + &[VOTE_DECISIONS_TREE_KEY as u8], + ] +} + +/// the decisions path of the voting branch as a vec +pub fn vote_decisions_tree_path_vec() -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![VOTE_DECISIONS_TREE_KEY as u8], + ] +} + +/// the contested resource tree path of the voting branch +pub fn vote_contested_resource_tree_path<'a>() -> [&'a [u8]; 2] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), + &[CONTESTED_RESOURCE_TREE_KEY as u8], + ] +} + +/// the contested resource tree path of the voting branch as a vec +pub fn vote_contested_resource_tree_path_vec() -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + ] +} + +/// the end dates of contested resources +pub fn vote_end_date_queries_tree_path<'a>() -> [&'a [u8]; 2] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), + &[END_DATE_QUERIES_TREE_KEY as u8], + ] +} + +/// the end dates of contested resources as a vec +pub fn vote_end_date_queries_tree_path_vec() -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![END_DATE_QUERIES_TREE_KEY as u8], + ] +} + +/// this is the path where votes are actually kept +pub fn vote_contested_resource_active_polls_tree_path<'a>() -> [&'a [u8]; 3] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), + &[CONTESTED_RESOURCE_TREE_KEY as u8], + &[ACTIVE_POLLS_TREE_KEY as u8], + ] +} + +/// this is the path where votes are actually kept as a vec +pub fn vote_contested_resource_active_polls_tree_path_vec() -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + vec![ACTIVE_POLLS_TREE_KEY as u8], + ] +} + +/// Returns the path to root of a contract in the contested resource active polls. +pub fn vote_contested_resource_active_polls_contract_tree_path(contract_id: &[u8]) -> [&[u8]; 4] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), // 1 + &[CONTESTED_RESOURCE_TREE_KEY as u8], // 1 + &[ACTIVE_POLLS_TREE_KEY as u8], // 1 + contract_id, // 32 + ] +} + +/// Returns the path to root of a contract in the contested resource active polls. +pub fn vote_contested_resource_active_polls_contract_tree_path_vec( + contract_id: &[u8], +) -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + vec![ACTIVE_POLLS_TREE_KEY as u8], + contract_id.to_vec(), + ] +} + +/// Returns the path to the primary keys of a contract document type. +pub fn vote_contested_resource_active_polls_contract_document_tree_path<'a>( + contract_id: &'a [u8], + document_type_name: &'a str, +) -> [&'a [u8]; 5] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), // 1 + &[CONTESTED_RESOURCE_TREE_KEY as u8], // 1 + &[ACTIVE_POLLS_TREE_KEY as u8], // 1 + contract_id, // 32 + document_type_name.as_bytes(), + ] +} + +/// Returns the path to the root of document type in the contested tree +pub fn vote_contested_resource_active_polls_contract_document_tree_path_vec( + contract_id: &[u8], + document_type_name: &str, +) -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + vec![ACTIVE_POLLS_TREE_KEY as u8], + contract_id.to_vec(), + document_type_name.as_bytes().to_vec(), + ] +} + +/// Returns the path to the primary keys of a contract document type. +pub fn vote_contested_resource_contract_documents_storage_path<'a>( + contract_id: &'a [u8], + document_type_name: &'a str, +) -> [&'a [u8]; 6] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), // 1 + &[CONTESTED_RESOURCE_TREE_KEY as u8], // 1 + &[ACTIVE_POLLS_TREE_KEY as u8], // 1 + contract_id, // 32 + document_type_name.as_bytes(), + &[CONTESTED_DOCUMENT_STORAGE_TREE_KEY], // 1 + ] +} + +/// Returns the path to the primary keys of a contract document type as a vec. +pub fn vote_contested_resource_contract_documents_storage_path_vec( + contract_id: &[u8], + document_type_name: &str, +) -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + vec![ACTIVE_POLLS_TREE_KEY as u8], + contract_id.to_vec(), + document_type_name.as_bytes().to_vec(), + vec![CONTESTED_DOCUMENT_STORAGE_TREE_KEY], + ] +} + +/// Returns the path to the primary keys of a contract document type. +pub fn vote_contested_resource_contract_documents_indexes_path<'a>( + contract_id: &'a [u8], + document_type_name: &'a str, +) -> [&'a [u8]; 6] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), // 1 + &[CONTESTED_RESOURCE_TREE_KEY as u8], // 1 + &[ACTIVE_POLLS_TREE_KEY as u8], // 1 + contract_id, // 32 + document_type_name.as_bytes(), + &[CONTESTED_DOCUMENT_INDEXES_TREE_KEY], // 1 + ] +} + +/// Returns the path to the primary keys of a contract document type as a vec. +pub fn vote_contested_resource_contract_documents_indexes_path_vec( + contract_id: &[u8], + document_type_name: &str, +) -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + vec![ACTIVE_POLLS_TREE_KEY as u8], + contract_id.to_vec(), + document_type_name.as_bytes().to_vec(), + vec![CONTESTED_DOCUMENT_INDEXES_TREE_KEY], + ] +} + +/// the specific end date path query of a contested resources as a vec +/// there is no need to ever add a key to this +pub fn vote_contested_resource_end_date_queries_at_time_tree_path_vec( + time: TimestampMillis, +) -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![END_DATE_QUERIES_TREE_KEY as u8], + encode_u64(time), + ] +} + +/// the identity votes of contested resources +pub fn vote_contested_resource_identity_votes_tree_path<'a>() -> [&'a [u8]; 3] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), + &[CONTESTED_RESOURCE_TREE_KEY as u8], + &[IDENTITY_VOTES_TREE_KEY as u8], + ] +} + +/// the identity votes of contested resources as a vec +pub fn vote_contested_resource_identity_votes_tree_path_vec() -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + vec![IDENTITY_VOTES_TREE_KEY as u8], + ] +} + +/// the qualified identity vote of contested resources +/// this is with the identity id at the end already +pub fn vote_contested_resource_identity_votes_tree_path_for_identity( + identity_id: &[u8; 32], +) -> [&[u8]; 4] { + [ + Into::<&[u8; 1]>::into(RootTree::Votes), + &[CONTESTED_RESOURCE_TREE_KEY as u8], + &[IDENTITY_VOTES_TREE_KEY as u8], + identity_id, + ] +} + +/// the qualified identity vote of contested resources as a vec +/// this is with the identity id at the end already +pub fn vote_contested_resource_identity_votes_tree_path_for_identity_vec( + identity_id: &[u8; 32], +) -> Vec> { + vec![ + vec![RootTree::Votes as u8], + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + vec![IDENTITY_VOTES_TREE_KEY as u8], + identity_id.to_vec(), + ] +} diff --git a/packages/rs-drive/src/drive/votes/resolved/mod.rs b/packages/rs-drive/src/drive/votes/resolved/mod.rs new file mode 100644 index 00000000000..4aecfaccdba --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/mod.rs @@ -0,0 +1,4 @@ +/// vote polls module +pub mod vote_polls; +/// votes module +pub mod votes; diff --git a/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/mod.rs b/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/mod.rs new file mode 100644 index 00000000000..1b339b7dba8 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/mod.rs @@ -0,0 +1,344 @@ +/// resolver module +pub mod resolve; + +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::object_size_info::{DataContractOwnedResolvedInfo, DataContractResolvedInfo}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::{DocumentType, DocumentTypeRef, Index}; +use dpp::identifier::Identifier; +use dpp::platform_value::Value; +use dpp::serialization::PlatformSerializable; +use dpp::util::hash::hash_double; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use dpp::ProtocolError; + +/// Represents information related to a contested document resource vote poll, along with +/// associated contract details. +/// +/// This structure holds a reference to the contract, the document type name, +/// the index name, and the index values used for the poll. +#[derive(Debug, PartialEq, Clone)] +pub struct ContestedDocumentResourceVotePollWithContractInfo { + /// The contract information associated with the document. + pub contract: DataContractOwnedResolvedInfo, + /// The name of the document type. + pub document_type_name: String, + /// The name of the index. + pub index_name: String, + /// The values used in the index for the poll. + pub index_values: Vec, +} + +impl From for ContestedDocumentResourceVotePoll { + fn from(value: ContestedDocumentResourceVotePollWithContractInfo) -> Self { + let ContestedDocumentResourceVotePollWithContractInfo { + contract, + document_type_name, + index_name, + index_values, + } = value; + ContestedDocumentResourceVotePoll { + contract_id: contract.id(), + document_type_name, + index_name, + index_values, + } + } +} + +impl From<&ContestedDocumentResourceVotePollWithContractInfo> + for ContestedDocumentResourceVotePoll +{ + fn from(value: &ContestedDocumentResourceVotePollWithContractInfo) -> Self { + let ContestedDocumentResourceVotePollWithContractInfo { + contract, + document_type_name, + index_name, + index_values, + } = value; + ContestedDocumentResourceVotePoll { + contract_id: contract.id(), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + } + } +} + +/// Represents information related to a contested document resource vote poll, along with +/// associated contract details. +/// +/// This structure holds a reference to the contract, the document type name, +/// the index name, and the index values used for the poll. +#[derive(Debug, PartialEq, Clone)] +pub struct ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a> { + /// The contract information associated with the document. + pub contract: DataContractResolvedInfo<'a>, + /// The name of the document type. + pub document_type_name: String, + /// The name of the index. + pub index_name: String, + /// The values used in the index for the poll. + pub index_values: Vec, +} + +impl<'a> From<&'a ContestedDocumentResourceVotePollWithContractInfo> + for ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a> +{ + fn from(value: &'a ContestedDocumentResourceVotePollWithContractInfo) -> Self { + let ContestedDocumentResourceVotePollWithContractInfo { + contract, + document_type_name, + index_name, + index_values, + } = value; + ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: contract.into(), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + } + } +} + +impl<'a> From> + for ContestedDocumentResourceVotePoll +{ + fn from(value: ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed) -> Self { + let ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract, + document_type_name, + index_name, + index_values, + } = value; + + ContestedDocumentResourceVotePoll { + contract_id: contract.id(), + document_type_name, + index_name, + index_values, + } + } +} + +impl<'a> From<&ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a>> + for ContestedDocumentResourceVotePoll +{ + fn from(value: &ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed) -> Self { + let ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract, + document_type_name, + index_name, + index_values, + } = value; + + ContestedDocumentResourceVotePoll { + contract_id: contract.id(), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + } + } +} + +impl ContestedDocumentResourceVotePollWithContractInfo { + /// Serializes the contested document resource vote poll with contract information to bytes. + /// + /// # Returns + /// + /// A `Result` containing a `Vec` with the serialized bytes, or a `ProtocolError` if serialization fails. + pub fn serialize_to_bytes(&self) -> Result, ProtocolError> { + let contested_document_resource_vote_poll: ContestedDocumentResourceVotePoll = self.into(); + contested_document_resource_vote_poll.serialize_to_bytes() + } + + /// Computes the double SHA-256 hash of the serialized contested document resource vote poll. + /// + /// # Returns + /// + /// A `Result` containing a `[u8; 32]` array with the hash, or a `ProtocolError` if hashing fails. + pub fn sha256_2_hash(&self) -> Result<[u8; 32], ProtocolError> { + let encoded = self.serialize_to_bytes()?; + Ok(hash_double(encoded)) + } + + /// Retrieves the specialized balance identifier associated with the contested document resource vote poll. + /// + /// # Returns + /// + /// A `Result` containing the `Identifier`, or a `ProtocolError` if retrieving the balance ID fails. + pub fn specialized_balance_id(&self) -> Result { + self.unique_id() + } + + /// Retrieves the unique identifier associated with the contested document resource vote poll. + /// + /// # Returns + /// + /// A `Result` containing the `Identifier`, or a `ProtocolError` if retrieving the unique ID fails. + pub fn unique_id(&self) -> Result { + self.sha256_2_hash().map(Identifier::new) + } +} + +impl<'a> ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a> { + /// Serializes the contested document resource vote poll with contract information (allowing borrowed data) to bytes. + /// + /// # Returns + /// + /// A `Result` containing a `Vec` with the serialized bytes, or a `ProtocolError` if serialization fails. + pub fn serialize_to_bytes(&self) -> Result, ProtocolError> { + let contested_document_resource_vote_poll: ContestedDocumentResourceVotePoll = self.into(); + contested_document_resource_vote_poll.serialize_to_bytes() + } + + /// Computes the double SHA-256 hash of the serialized contested document resource vote poll (allowing borrowed data). + /// + /// # Returns + /// + /// A `Result` containing a `[u8; 32]` array with the hash, or a `ProtocolError` if hashing fails. + pub fn sha256_2_hash(&self) -> Result<[u8; 32], ProtocolError> { + let encoded = self.serialize_to_bytes()?; + Ok(hash_double(encoded)) + } + + /// Retrieves the specialized balance identifier associated with the contested document resource vote poll (allowing borrowed data). + /// + /// # Returns + /// + /// A `Result` containing the `Identifier`, or a `ProtocolError` if retrieving the balance ID fails. + pub fn specialized_balance_id(&self) -> Result { + self.unique_id() + } + + /// Retrieves the unique identifier associated with the contested document resource vote poll (allowing borrowed data). + /// + /// # Returns + /// + /// A `Result` containing the `Identifier`, or a `ProtocolError` if retrieving the unique ID fails. + pub fn unique_id(&self) -> Result { + self.sha256_2_hash().map(Identifier::new) + } +} + +impl ContestedDocumentResourceVotePollWithContractInfo { + /// Retrieves the index associated with the document type and index name. + /// + /// # Returns + /// + /// * `Ok(&Index)` - A reference to the index if found. + /// * `Err(Error)` - An error if the index is not found or if there is an issue retrieving it. + /// + /// # Errors + /// + /// This method returns an `Error::Drive` variant with `DriveError::ContestedIndexNotFound` + /// if the index cannot be found within the document type. + pub fn index(&self) -> Result<&Index, Error> { + self.contract + .as_ref() + .document_type_borrowed_for_name(self.document_type_name.as_str())? + .indexes() + .get(&self.index_name) + .ok_or(Error::Drive(DriveError::ContestedIndexNotFound( + "contested index not found when trying to get it from the contested document resource vote poll with contract info" + ))) + } + + /// Retrieves the document type reference associated with the document type name. + /// + /// # Returns + /// + /// * `Ok(DocumentTypeRef)` - A reference to the document type if found. + /// * `Err(Error)` - An error if the document type cannot be found or if there is an issue retrieving it. + /// + /// # Errors + /// + /// This method returns an `Error::Protocol` variant with `ProtocolError::DataContractError` + /// if there is an issue retrieving the document type. + pub fn document_type(&self) -> Result { + self.contract + .as_ref() + .document_type_for_name(self.document_type_name.as_str()) + .map_err(|e| Error::Protocol(ProtocolError::DataContractError(e))) + } + + /// Borrows a reference to the document type associated with the document type name. + /// + /// # Returns + /// + /// * `Ok(&DocumentType)` - A borrowed reference to the document type if found. + /// * `Err(Error)` - An error if the document type cannot be found or if there is an issue retrieving it. + /// + /// # Errors + /// + /// This method returns an `Error::Protocol` variant with `ProtocolError::DataContractError` + /// if there is an issue retrieving the document type. + pub fn document_type_borrowed(&self) -> Result<&DocumentType, Error> { + self.contract + .as_ref() + .document_type_borrowed_for_name(self.document_type_name.as_str()) + .map_err(|e| Error::Protocol(ProtocolError::DataContractError(e))) + } +} + +impl<'a> ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a> { + /// Retrieves the index associated with the document type and index name. + /// + /// # Returns + /// + /// * `Ok(&Index)` - A reference to the index if found. + /// * `Err(Error)` - An error if the index is not found or if there is an issue retrieving it. + /// + /// # Errors + /// + /// This method returns an `Error::Drive` variant with `DriveError::ContestedIndexNotFound` + /// if the index cannot be found within the document type. + pub fn index(&self) -> Result<&Index, Error> { + self.contract + .as_ref() + .document_type_borrowed_for_name(self.document_type_name.as_str())? + .indexes() + .get(&self.index_name) + .ok_or(Error::Drive(DriveError::ContestedIndexNotFound( + "contested index not found when trying to get it from the contested document resource vote poll with contract info" + ))) + } + + /// Retrieves the document type reference associated with the document type name. + /// + /// # Returns + /// + /// * `Ok(DocumentTypeRef)` - A reference to the document type if found. + /// * `Err(Error)` - An error if the document type cannot be found or if there is an issue retrieving it. + /// + /// # Errors + /// + /// This method returns an `Error::Protocol` variant with `ProtocolError::DataContractError` + /// if there is an issue retrieving the document type. + pub fn document_type(&self) -> Result { + self.contract + .as_ref() + .document_type_for_name(self.document_type_name.as_str()) + .map_err(|e| Error::Protocol(ProtocolError::DataContractError(e))) + } + + /// Borrows a reference to the document type associated with the document type name. + /// + /// # Returns + /// + /// * `Ok(&DocumentType)` - A borrowed reference to the document type if found. + /// * `Err(Error)` - An error if the document type cannot be found or if there is an issue retrieving it. + /// + /// # Errors + /// + /// This method returns an `Error::Protocol` variant with `ProtocolError::DataContractError` + /// if there is an issue retrieving the document type. + pub fn document_type_borrowed(&self) -> Result<&DocumentType, Error> { + self.contract + .as_ref() + .document_type_borrowed_for_name(self.document_type_name.as_str()) + .map_err(|e| Error::Protocol(ProtocolError::DataContractError(e))) + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/resolve.rs b/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/resolve.rs new file mode 100644 index 00000000000..2ca742ff8f9 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/resolve.rs @@ -0,0 +1,327 @@ +#[cfg(feature = "server")] +use crate::drive::contract::DataContractFetchInfo; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +#[cfg(any(feature = "server", feature = "verify"))] +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; +use crate::drive::Drive; +use crate::error::contract::DataContractError; +use crate::error::Error; +#[cfg(feature = "verify")] +use crate::query::ContractLookupFn; +use crate::util::object_size_info::DataContractOwnedResolvedInfo; +#[cfg(any(feature = "server", feature = "verify"))] +use crate::util::object_size_info::DataContractResolvedInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +#[cfg(any(feature = "server", feature = "verify"))] +use dpp::prelude::DataContract; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +#[cfg(feature = "server")] +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; +#[cfg(any(feature = "server", feature = "verify"))] +use std::sync::Arc; + +/// A trait for resolving information related to a contested document resource vote poll. +/// +/// This trait defines a method to resolve and retrieve the necessary contract and index +/// information associated with a contested document resource vote poll. +pub trait ContestedDocumentResourceVotePollResolver { + #[cfg(feature = "server")] + /// Resolves the contested document resource vote poll information. + /// + /// This method fetches the contract, document type name, index name, and index values + /// required to process a contested document resource vote poll. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ContestedDocumentResourceVotePollWithContractInfo)` - The resolved information needed for the vote poll. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the contested document resource vote poll + /// information. The specific error depends on the underlying problem encountered during resolution. + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; + #[cfg(feature = "server")] + + /// Resolve owned + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; + + #[cfg(feature = "server")] + /// Resolve into a struct that allows for a borrowed contract + fn resolve_allow_borrowed<'a>( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + #[cfg(feature = "verify")] + + /// Resolves into a struct, the contract itself will be held with Arc + fn resolve_with_known_contracts_provider<'a>( + &self, + known_contracts_provider_fn: &ContractLookupFn, + ) -> Result, Error>; + + #[cfg(any(feature = "verify", feature = "server"))] + /// Resolve by providing the contract + fn resolve_with_provided_borrowed_contract<'a>( + &self, + data_contract: &'a DataContract, + ) -> Result, Error>; + + #[cfg(feature = "server")] + /// Resolve owned into a struct that allows for a borrowed contract + fn resolve_owned_allow_borrowed<'a>( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + /// Resolve owned into a struct that allows for a borrowed contract + #[cfg(feature = "server")] + fn resolve_with_provided_arc_contract_fetch_info( + &self, + data_contract: Arc, + ) -> Result; + + /// Resolve owned into a struct that allows for a borrowed contract + #[cfg(feature = "server")] + fn resolve_owned_with_provided_arc_contract_fetch_info( + self, + data_contract: Arc, + ) -> Result; +} + +impl ContestedDocumentResourceVotePollResolver for ContestedDocumentResourceVotePoll { + #[cfg(feature = "server")] + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + let contract = drive.fetch_contract(contract_id.to_buffer(), None, None, transaction, platform_version).unwrap()?.ok_or(Error::DataContract(DataContractError::MissingContract("data contract not found when trying to resolve contested document resource vote poll".to_string())))?; + Ok(ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::DataContractFetchInfo(contract), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + }) + } + + #[cfg(feature = "server")] + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + let contract = drive.fetch_contract(contract_id.to_buffer(), None, None, transaction, platform_version).unwrap()?.ok_or(Error::DataContract(DataContractError::MissingContract("data contract not found when trying to resolve contested document resource vote poll as owned".to_string())))?; + Ok(ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::DataContractFetchInfo(contract), + document_type_name, + index_name, + index_values, + }) + } + + #[cfg(feature = "server")] + fn resolve_allow_borrowed<'a>( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + let contract = drive.fetch_contract(contract_id.to_buffer(), None, None, transaction, platform_version).unwrap()?.ok_or(Error::DataContract(DataContractError::MissingContract("data contract not found when trying to resolve contested document resource vote poll as borrowed".to_string())))?; + Ok( + ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::ArcDataContractFetchInfo(contract), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + }, + ) + } + + #[cfg(feature = "verify")] + fn resolve_with_known_contracts_provider<'a>( + &self, + known_contracts_provider_fn: &ContractLookupFn, + ) -> Result, Error> { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + let contract = known_contracts_provider_fn(contract_id)?.ok_or(Error::DataContract( + DataContractError::MissingContract(format!( + "data contract with id {} can not be provided", + contract_id + )), + ))?; + Ok( + ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::ArcDataContract(contract), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + }, + ) + } + + #[cfg(feature = "server")] + fn resolve_with_provided_arc_contract_fetch_info( + &self, + data_contract: Arc, + ) -> Result { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + if contract_id != data_contract.contract.id_ref() { + return Err(Error::DataContract( + DataContractError::ProvidedContractMismatch(format!( + "data contract provided {} is not the one required {}", + data_contract.contract.id_ref(), + contract_id + )), + )); + } + Ok(ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::DataContractFetchInfo(data_contract), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + }) + } + + #[cfg(feature = "server")] + fn resolve_owned_with_provided_arc_contract_fetch_info( + self, + data_contract: Arc, + ) -> Result { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + if contract_id != data_contract.contract.id_ref() { + return Err(Error::DataContract( + DataContractError::ProvidedContractMismatch(format!( + "data contract provided {} is not the one required {}", + data_contract.contract.id_ref(), + contract_id + )), + )); + } + Ok(ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::DataContractFetchInfo(data_contract), + document_type_name, + index_name, + index_values, + }) + } + + #[cfg(any(feature = "verify", feature = "server"))] + fn resolve_with_provided_borrowed_contract<'a>( + &self, + data_contract: &'a DataContract, + ) -> Result, Error> { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + if contract_id != data_contract.id_ref() { + return Err(Error::DataContract( + DataContractError::ProvidedContractMismatch(format!( + "data contract provided {} is not the one required {}", + data_contract.id_ref(), + contract_id + )), + )); + } + Ok( + ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::BorrowedDataContract(data_contract), + document_type_name: document_type_name.clone(), + index_name: index_name.clone(), + index_values: index_values.clone(), + }, + ) + } + + #[cfg(feature = "server")] + fn resolve_owned_allow_borrowed<'a>( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + } = self; + + let contract = drive.fetch_contract(contract_id.to_buffer(), None, None, transaction, platform_version).unwrap()?.ok_or(Error::DataContract(DataContractError::MissingContract("data contract not found when trying to resolve contested document resource vote poll as owned, but allowing borrowed".to_string())))?; + Ok( + ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed { + contract: DataContractResolvedInfo::ArcDataContractFetchInfo(contract), + document_type_name, + index_name, + index_values, + }, + ) + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/vote_polls/mod.rs b/packages/rs-drive/src/drive/votes/resolved/vote_polls/mod.rs new file mode 100644 index 00000000000..643af76e8a1 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/vote_polls/mod.rs @@ -0,0 +1,86 @@ +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use derive_more::From; +use dpp::identifier::Identifier; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::voting::vote_polls::VotePoll; +use dpp::ProtocolError; +use std::collections::BTreeMap; + +/// Module containing logic for contested document resource vote polls. +pub mod contested_document_resource_vote_poll; + +/// Module containing logic to resolve various components. +#[cfg(feature = "server")] +pub mod resolve; + +/// Represents a resolved vote poll in the system. +#[derive(Debug, Clone, PartialEq, From)] +pub enum ResolvedVotePoll { + /// A resolved vote poll with contract information for a contested document resource. + ContestedDocumentResourceVotePollWithContractInfo( + ContestedDocumentResourceVotePollWithContractInfo, + ), +} + +impl From<&ResolvedVotePoll> for VotePoll { + fn from(value: &ResolvedVotePoll) -> Self { + match value { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll, + ) => VotePoll::ContestedDocumentResourceVotePoll( + contested_document_resource_vote_poll.into(), + ), + } + } +} + +/// Represents a resolved vote poll in the system that also contains votes. +#[derive(Debug, Clone, PartialEq, From)] +pub enum ResolvedVotePollWithVotes { + /// A resolved vote poll with contract information for a contested document resource. + ContestedDocumentResourceVotePollWithContractInfoAndVotes( + ContestedDocumentResourceVotePollWithContractInfo, + BTreeMap>, + ), +} + +impl ResolvedVotePoll { + /// Retrieves the specialized balance identifier associated with the resolved vote poll. + /// + /// # Returns + /// + /// * `Ok(Some(identifier))` if a specialized balance ID is available. + /// * `Ok(None)` if no specialized balance ID is associated. + /// * `Err(ProtocolError)` if there is an error retrieving the balance ID. + /// + /// # Errors + /// + /// Returns a `ProtocolError` if there is an issue retrieving the specialized balance ID. + pub fn specialized_balance_id(&self) -> Result, ProtocolError> { + match self { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll, + ) => Ok(Some( + contested_document_resource_vote_poll.specialized_balance_id()?, + )), + } + } + + /// Retrieves the unique identifier associated with the resolved vote poll. + /// + /// # Returns + /// + /// * `Ok(identifier)` containing the unique identifier. + /// * `Err(ProtocolError)` if there is an error retrieving the unique ID. + /// + /// # Errors + /// + /// Returns a `ProtocolError` if there is an issue retrieving the unique ID. + pub fn unique_id(&self) -> Result { + match self { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll, + ) => contested_document_resource_vote_poll.unique_id(), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/vote_polls/resolve.rs b/packages/rs-drive/src/drive/votes/resolved/vote_polls/resolve.rs new file mode 100644 index 00000000000..eecb852f1b1 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/vote_polls/resolve.rs @@ -0,0 +1,89 @@ +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::resolve::ContestedDocumentResourceVotePollResolver; +use crate::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use crate::drive::Drive; +use crate::error::Error; +use dpp::voting::vote_polls::VotePoll; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +/// The vote poll resolver +pub trait VotePollResolver { + /// Resolves the contested document resource vote poll information. + /// + /// This method fetches the contract, document type name, index name, and index values + /// required to process a contested document resource vote poll. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ContestedDocumentResourceVotePollWithContractInfo)` - The resolved information needed for the vote poll. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the contested document resource vote poll + /// information. The specific error depends on the underlying problem encountered during resolution. + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; + + /// Resolve owned + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl VotePollResolver for VotePoll { + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match self { + VotePoll::ContestedDocumentResourceVotePoll(contested_document_resource_vote_poll) => { + Ok( + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll.resolve( + drive, + transaction, + platform_version, + )?, + ), + ) + } + } + } + + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match self { + VotePoll::ContestedDocumentResourceVotePoll(contested_document_resource_vote_poll) => { + Ok( + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll.resolve( + drive, + transaction, + platform_version, + )?, + ), + ) + } + } + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/mod.rs b/packages/rs-drive/src/drive/votes/resolved/votes/mod.rs new file mode 100644 index 00000000000..99a31f50a69 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/mod.rs @@ -0,0 +1,66 @@ +#[cfg(feature = "server")] +pub(crate) mod resolve; +/// Resolved resource vote module +pub mod resolved_resource_vote; + +use crate::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use crate::drive::votes::resolved::votes::resolved_resource_vote::accessors::v0::ResolvedResourceVoteGettersV0; +use crate::drive::votes::resolved::votes::resolved_resource_vote::ResolvedResourceVote; +use dpp::identifier::Identifier; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::v0::ResourceVoteV0; +use dpp::voting::votes::resource_vote::ResourceVote; +use dpp::voting::votes::Vote; +use dpp::ProtocolError; + +/// Represents the different types of resolved votes within the system. +#[derive(Debug, Clone, PartialEq)] +pub enum ResolvedVote { + /// A resolved vote for a specific resource. + ResolvedResourceVote(ResolvedResourceVote), +} + +impl ResolvedVote { + /// Retrieves the specialized balance identifier associated with the resolved vote. + /// + /// # Returns + /// + /// * `Ok(Some(identifier))` if a specialized balance ID is available. + /// * `Ok(None)` if no specialized balance ID is associated. + /// * `Err(ProtocolError)` if there is an error retrieving the balance ID. + /// + /// # Errors + /// + /// Returns a `ProtocolError` if there is an issue retrieving the specialized balance ID. + pub fn specialized_balance_id(&self) -> Result, ProtocolError> { + match self { + ResolvedVote::ResolvedResourceVote(resource_vote) => { + resource_vote.vote_poll().specialized_balance_id() + } + } + } +} + +impl From for Vote { + fn from(value: ResolvedVote) -> Self { + match value { + ResolvedVote::ResolvedResourceVote(resolved_resource_vote) => { + match resolved_resource_vote { + ResolvedResourceVote::V0(v0) => { + let vote_choice = v0.resource_vote_choice; + match v0.resolved_vote_poll { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource, + ) => Self::ResourceVote(ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + contested_document_resource.into(), + ), + resource_vote_choice: vote_choice, + })), + } + } + } + } + } + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/resolve.rs b/packages/rs-drive/src/drive/votes/resolved/votes/resolve.rs new file mode 100644 index 00000000000..363a29da07f --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/resolve.rs @@ -0,0 +1,71 @@ +use crate::drive::votes::resolved::votes::resolved_resource_vote::resolve::ResourceVoteResolver; +use crate::drive::votes::resolved::votes::ResolvedVote; +use crate::drive::Drive; +use crate::error::Error; +use dpp::voting::votes::Vote; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +pub trait VoteResolver { + /// Resolves the contested document resource vote poll information. + /// + /// This method fetches the contract, document type name, index name, and index values + /// required to process a contested document resource vote poll. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ContestedDocumentResourceVotePollWithContractInfo)` - The resolved information needed for the vote poll. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the contested document resource vote poll + /// information. The specific error depends on the underlying problem encountered during resolution. + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; + + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl VoteResolver for Vote { + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match self { + Vote::ResourceVote(resource_vote) => Ok(ResolvedVote::ResolvedResourceVote( + resource_vote.resolve(drive, transaction, platform_version)?, + )), + } + } + + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match self { + Vote::ResourceVote(resource_vote) => Ok(ResolvedVote::ResolvedResourceVote( + resource_vote.resolve_owned(drive, transaction, platform_version)?, + )), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/accessors/mod.rs b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/accessors/mod.rs new file mode 100644 index 00000000000..85d425a4837 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/accessors/mod.rs @@ -0,0 +1,27 @@ +use crate::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use crate::drive::votes::resolved::votes::resolved_resource_vote::accessors::v0::ResolvedResourceVoteGettersV0; +use crate::drive::votes::resolved::votes::resolved_resource_vote::ResolvedResourceVote; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + +/// Module containing version 0 of the implementation. +pub mod v0; + +impl ResolvedResourceVoteGettersV0 for ResolvedResourceVote { + fn vote_poll(&self) -> &ResolvedVotePoll { + match self { + ResolvedResourceVote::V0(v0) => &v0.resolved_vote_poll, + } + } + + fn vote_poll_owned(self) -> ResolvedVotePoll { + match self { + ResolvedResourceVote::V0(v0) => v0.resolved_vote_poll, + } + } + + fn resource_vote_choice(&self) -> ResourceVoteChoice { + match self { + ResolvedResourceVote::V0(v0) => v0.resource_vote_choice, + } + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/accessors/v0/mod.rs b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/accessors/v0/mod.rs new file mode 100644 index 00000000000..2c6ad5d5cd3 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/accessors/v0/mod.rs @@ -0,0 +1,14 @@ +use crate::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + +/// Trait for getters in Resource Vote +pub trait ResolvedResourceVoteGettersV0 { + /// The vote poll + fn vote_poll(&self) -> &ResolvedVotePoll; + + /// The vote poll as owned + fn vote_poll_owned(self) -> ResolvedVotePoll; + + /// The choice made in the vote + fn resource_vote_choice(&self) -> ResourceVoteChoice; +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/mod.rs b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/mod.rs new file mode 100644 index 00000000000..2ceaf7cc398 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/mod.rs @@ -0,0 +1,18 @@ +use crate::drive::votes::resolved::votes::resolved_resource_vote::v0::ResolvedResourceVoteV0; + +/// Module containing accessors for various components. +pub mod accessors; + +/// Module containing version 0 of the implementation. +pub mod v0; + +/// Module containing logic to resolve resources. +#[cfg(feature = "server")] +pub(crate) mod resolve; + +/// Represents a resolved resource vote in the system. +#[derive(Debug, Clone, PartialEq)] +pub enum ResolvedResourceVote { + /// Version 0 of the resolved resource vote. + V0(ResolvedResourceVoteV0), +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/resolve.rs b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/resolve.rs new file mode 100644 index 00000000000..a52017c0f5d --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/resolve.rs @@ -0,0 +1,71 @@ +use crate::drive::votes::resolved::votes::resolved_resource_vote::v0::resolve::ResourceVoteResolverV0; +use crate::drive::votes::resolved::votes::resolved_resource_vote::ResolvedResourceVote; +use crate::drive::Drive; +use crate::error::Error; +use dpp::voting::votes::resource_vote::ResourceVote; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +pub trait ResourceVoteResolver { + /// Resolves the contested document resource vote poll information. + /// + /// This method fetches the contract, document type name, index name, and index values + /// required to process a contested document resource vote poll. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ContestedDocumentResourceVotePollWithContractInfo)` - The resolved information needed for the vote poll. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the contested document resource vote poll + /// information. The specific error depends on the underlying problem encountered during resolution. + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; + + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl ResourceVoteResolver for ResourceVote { + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match self { + ResourceVote::V0(resource_vote) => Ok(ResolvedResourceVote::V0( + resource_vote.resolve(drive, transaction, platform_version)?, + )), + } + } + + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match self { + ResourceVote::V0(resource_vote) => Ok(ResolvedResourceVote::V0( + resource_vote.resolve_owned(drive, transaction, platform_version)?, + )), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/v0/mod.rs b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/v0/mod.rs new file mode 100644 index 00000000000..b529a427918 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/v0/mod.rs @@ -0,0 +1,14 @@ +#[cfg(feature = "server")] +pub(crate) mod resolve; + +use crate::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + +/// Represents the version 0 of a resolved resource vote. +#[derive(Debug, Clone, PartialEq)] +pub struct ResolvedResourceVoteV0 { + /// The resolved vote poll associated with this resource vote. + pub resolved_vote_poll: ResolvedVotePoll, + /// The choice made in the resource vote. + pub resource_vote_choice: ResourceVoteChoice, +} diff --git a/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/v0/resolve.rs b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/v0/resolve.rs new file mode 100644 index 00000000000..975ccc234c5 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/resolved/votes/resolved_resource_vote/v0/resolve.rs @@ -0,0 +1,83 @@ +use crate::drive::votes::resolved::vote_polls::resolve::VotePollResolver; +use crate::drive::votes::resolved::votes::resolved_resource_vote::v0::ResolvedResourceVoteV0; +use crate::drive::Drive; +use crate::error::Error; +use dpp::voting::votes::resource_vote::v0::ResourceVoteV0; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +pub(in crate::drive::votes::resolved::votes::resolved_resource_vote) trait ResourceVoteResolverV0 { + /// Resolves the contested document resource vote poll information. + /// + /// This method fetches the contract, document type name, index name, and index values + /// required to process a contested document resource vote poll. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ContestedDocumentResourceVotePollWithContractInfo)` - The resolved information needed for the vote poll. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the contested document resource vote poll + /// information. The specific error depends on the underlying problem encountered during resolution. + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; + + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl ResourceVoteResolverV0 for ResourceVoteV0 { + fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let ResourceVoteV0 { + vote_poll, + resource_vote_choice, + } = self; + + let resolved_vote_poll = vote_poll.resolve(drive, transaction, platform_version)?; + + Ok(ResolvedResourceVoteV0 { + resolved_vote_poll, + resource_vote_choice: *resource_vote_choice, + }) + } + + fn resolve_owned( + self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let ResourceVoteV0 { + vote_poll, + resource_vote_choice, + } = self; + + let resolved_vote_poll = vote_poll.resolve_owned(drive, transaction, platform_version)?; + + Ok(ResolvedResourceVoteV0 { + resolved_vote_poll, + resource_vote_choice, + }) + } +} diff --git a/packages/rs-drive/src/drive/votes/setup/mod.rs b/packages/rs-drive/src/drive/votes/setup/mod.rs new file mode 100644 index 00000000000..00eb6e7ec30 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/setup/mod.rs @@ -0,0 +1 @@ +mod setup_initial_vote_tree_main_structure; diff --git a/packages/rs-drive/src/drive/votes/setup/setup_initial_vote_tree_main_structure/mod.rs b/packages/rs-drive/src/drive/votes/setup/setup_initial_vote_tree_main_structure/mod.rs new file mode 100644 index 00000000000..25ece38374d --- /dev/null +++ b/packages/rs-drive/src/drive/votes/setup/setup_initial_vote_tree_main_structure/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::util::batch::GroveDbOpBatch; +use dpp::version::PlatformVersion; + +impl Drive { + /// Initializes the main structure of the vote tree within a GroveDB operation batch. + /// This function is version-controlled to ensure compatibility with different versions of the platform. + /// + /// # Parameters + /// + /// - `batch`: A mutable reference to a GroveDbOpBatch, which will accumulate the necessary operations + /// to set up the main vote tree structure. + /// - `platform_version`: A reference to the platform version to ensure the correct setup operations + /// are applied based on the specified version. + /// + /// # Returns + /// + /// Returns a `Result<(), Error>`, indicating successful setup of the initial vote tree structure + /// within the provided batch or an error in case of failure. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// - The platform version is unknown or unsupported, resulting in a version mismatch error. + /// - Specific operations for the given version fail to be added to the batch, potentially due to + /// constraints or issues within the GroveDB operation batch. + /// + pub fn add_initial_vote_tree_main_structure_operations( + batch: &mut GroveDbOpBatch, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .vote + .setup + .add_initial_vote_tree_main_structure_operations + { + 0 => Drive::add_initial_vote_tree_main_structure_operations_v0(batch), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_initial_vote_tree_main_structure_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/setup/setup_initial_vote_tree_main_structure/v0/mod.rs b/packages/rs-drive/src/drive/votes/setup/setup_initial_vote_tree_main_structure/v0/mod.rs new file mode 100644 index 00000000000..e4699ceb5d7 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/setup/setup_initial_vote_tree_main_structure/v0/mod.rs @@ -0,0 +1,36 @@ +use crate::drive::votes::paths::{ + vote_contested_resource_tree_path_vec, vote_root_path_vec, ACTIVE_POLLS_TREE_KEY, + CONTESTED_RESOURCE_TREE_KEY, END_DATE_QUERIES_TREE_KEY, IDENTITY_VOTES_TREE_KEY, + VOTE_DECISIONS_TREE_KEY, +}; +use crate::drive::Drive; +use crate::error::Error; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; + +impl Drive { + pub(super) fn add_initial_vote_tree_main_structure_operations_v0( + batch: &mut GroveDbOpBatch, + ) -> Result<(), Error> { + batch.add_insert_empty_tree(vote_root_path_vec(), vec![VOTE_DECISIONS_TREE_KEY as u8]); + + batch.add_insert_empty_tree( + vote_root_path_vec(), + vec![CONTESTED_RESOURCE_TREE_KEY as u8], + ); + + batch.add_insert_empty_tree(vote_root_path_vec(), vec![END_DATE_QUERIES_TREE_KEY as u8]); + + batch.add_insert_empty_tree( + vote_contested_resource_tree_path_vec(), + vec![ACTIVE_POLLS_TREE_KEY as u8], + ); + + batch.add_insert_empty_tree( + vote_contested_resource_tree_path_vec(), + vec![IDENTITY_VOTES_TREE_KEY as u8], + ); + + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/votes/storage_form/contested_document_resource_reference_storage_form/mod.rs b/packages/rs-drive/src/drive/votes/storage_form/contested_document_resource_reference_storage_form/mod.rs new file mode 100644 index 00000000000..7a84734a78a --- /dev/null +++ b/packages/rs-drive/src/drive/votes/storage_form/contested_document_resource_reference_storage_form/mod.rs @@ -0,0 +1,12 @@ +use bincode::{Decode, Encode}; +use grovedb::reference_path::ReferencePathType; + +/// Represents the storage form of a reference. +#[derive(Debug, Clone, PartialEq, Encode, Decode)] +pub struct ContestedDocumentResourceVoteReferenceStorageForm { + /// The reference + pub reference_path_type: ReferencePathType, + + /// The amount of times the identity has voted + pub identity_vote_times: u16, +} diff --git a/packages/rs-drive/src/drive/votes/storage_form/contested_document_resource_storage_form/mod.rs b/packages/rs-drive/src/drive/votes/storage_form/contested_document_resource_storage_form/mod.rs new file mode 100644 index 00000000000..35b0d8be8b1 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/storage_form/contested_document_resource_storage_form/mod.rs @@ -0,0 +1,187 @@ +use crate::drive::votes::paths::{ + ACTIVE_POLLS_TREE_KEY, RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32, RESOURCE_LOCK_VOTE_TREE_KEY_U8_32, +}; +use crate::drive::votes::tree_path_storage_form::TreePathStorageForm; +use crate::error::contract::DataContractError::{CorruptedDataContract, ProvidedContractMismatch}; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::type_constants::DEFAULT_HASH_SIZE_USIZE; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::platform_value::Value; +use dpp::prelude::DataContract; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::v0::ResourceVoteV0; +use dpp::voting::votes::resource_vote::ResourceVote; +use dpp::ProtocolError; +use platform_version::version::PlatformVersion; + +/// Represents the storage form of a contested document resource vote. +#[derive(Debug, Clone, PartialEq)] +pub struct ContestedDocumentResourceVoteStorageForm { + /// The identifier of the contract associated with the resource vote. + pub contract_id: Identifier, + + /// The name of the document type associated with the resource vote. + pub document_type_name: String, + + /// The index values associated with the resource vote, stored as a vector of byte vectors. + pub index_values: Vec>, + + /// The choice of the resource vote, represented by a `ResourceVoteChoice` enum. + pub resource_vote_choice: ResourceVoteChoice, +} + +impl ContestedDocumentResourceVoteStorageForm { + /// Resolves to a resource vote + pub fn resolve_with_contract( + self, + data_contract: &DataContract, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .vote + .storage_form + .resolve_with_contract + { + 0 => self.resolve_with_contract_v0(data_contract), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "ContestedDocumentResourceVoteStorageForm::resolve_with_contract" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + fn resolve_with_contract_v0(self, data_contract: &DataContract) -> Result { + let ContestedDocumentResourceVoteStorageForm { + contract_id, + document_type_name, + index_values, + resource_vote_choice, + .. + } = self; + + let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; + + let index = document_type + .find_contested_index() + .ok_or(Error::DataContract(ProvidedContractMismatch( + "no contested index on provided contract".to_string(), + )))?; + + let resolved_index_values = index_values + .into_iter() + .zip(index.properties.iter()) + .map(|(serialized_index_value, property)| { + let document_property = document_type + .flattened_properties() + .get(property.name.as_str()) + .ok_or(Error::DataContract(CorruptedDataContract( + "document type does not have a property of its index".to_string(), + )))?; + let value = document_property + .property_type + .decode_value_for_tree_keys(serialized_index_value.as_slice())?; + Ok(value) + }) + .collect::, Error>>()?; + + let vote_poll = + VotePoll::ContestedDocumentResourceVotePoll(ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name: index.name.clone(), + index_values: resolved_index_values, + }); + + Ok(ResourceVote::V0(ResourceVoteV0 { + vote_poll, + resource_vote_choice, + })) + } +} + +impl TreePathStorageForm for ContestedDocumentResourceVoteStorageForm { + fn try_from_tree_path(mut path: Vec>) -> Result + where + Self: Sized, + { + if path.len() < 10 { + return Err(ProtocolError::VoteError(format!( + "path {} is not long enough to construct vote information", + path.into_iter() + .map(hex::encode) + .collect::>() + .join("/") + ))); + } + + let key_2 = path.get(2).unwrap(); // active_vote_polls + let key_contract_id = path.get(3).unwrap(); // contract_id + let key_document_type_name = path.get(4).unwrap(); // document_type_name + let key_vote_choice = path.get(path.len() - 3).unwrap(); // this is the vote choice + + let Some(key_2_byte) = key_2.get(0) else { + return Err(ProtocolError::VoteError(format!( + "path {} third element must be a byte", + path.into_iter() + .map(hex::encode) + .collect::>() + .join("/") + ))); + }; + + if *key_2_byte != ACTIVE_POLLS_TREE_KEY as u8 { + return Err(ProtocolError::VoteError(format!( + "path {} third element must be a byte for ACTIVE_POLLS_TREE_KEY {}, got {}", + path.iter().map(hex::encode).collect::>().join("/"), + ACTIVE_POLLS_TREE_KEY as u8, + *key_2_byte + ))); + }; + + if key_contract_id.len() != DEFAULT_HASH_SIZE_USIZE { + return Err(ProtocolError::VoteError(format!( + "path {} fourth element must be a contract id but isn't 32 bytes long", + path.into_iter() + .map(hex::encode) + .collect::>() + .join("/") + ))); + } + + let contract_id = Identifier::from_vec(key_contract_id.clone())?; + + let document_type_name = String::from_utf8(key_document_type_name.clone()).map_err(|_| ProtocolError::VoteError(format!("path {} fifth element must be a document type name but couldn't be converted to a string", path.iter().map(hex::encode).collect::>().join("/"))))?; + + let resource_vote_choice = if key_vote_choice.len() == 32 { + if key_vote_choice.as_slice() == RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.as_slice() { + ResourceVoteChoice::Lock + } else if key_vote_choice.as_slice() == RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.as_slice() + { + ResourceVoteChoice::Abstain + } else { + ResourceVoteChoice::TowardsIdentity(Identifier::from_vec(key_vote_choice.clone())?) + } + } else { + return Err(ProtocolError::VoteError(format!("path {} 2 before last element must be an identifier or RESOURCE_ABSTAIN_VOTE_TREE_KEY/RESOURCE_LOCK_VOTE_TREE_KEY", path.into_iter().map(hex::encode).collect::>().join("/")))); + }; + + // 6 is the first index value, then we have 2 at the end that are not index values + let index_values = path.drain(6..path.len() - 3).collect::>(); + + Ok(ContestedDocumentResourceVoteStorageForm { + contract_id, + document_type_name, + index_values, + resource_vote_choice, + }) + } +} diff --git a/packages/rs-drive/src/drive/votes/storage_form/mod.rs b/packages/rs-drive/src/drive/votes/storage_form/mod.rs new file mode 100644 index 00000000000..a797ee8c5ba --- /dev/null +++ b/packages/rs-drive/src/drive/votes/storage_form/mod.rs @@ -0,0 +1,8 @@ +/// Module for handling the storage form of contested document resources. +pub mod contested_document_resource_storage_form; + +/// Module for handling the storage form of votes. +pub mod vote_storage_form; + +/// Module for handling the storage form of the reference of the contested document resources. +pub mod contested_document_resource_reference_storage_form; diff --git a/packages/rs-drive/src/drive/votes/storage_form/vote_storage_form/mod.rs b/packages/rs-drive/src/drive/votes/storage_form/vote_storage_form/mod.rs new file mode 100644 index 00000000000..8bdcdfcb7e3 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/storage_form/vote_storage_form/mod.rs @@ -0,0 +1,74 @@ +use crate::drive::votes::paths::{CONTESTED_RESOURCE_TREE_KEY, VOTE_DECISIONS_TREE_KEY}; +use crate::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; +use crate::drive::votes::tree_path_storage_form::TreePathStorageForm; +use crate::drive::RootTree::Votes; +use dpp::ProtocolError; + +/// Represents the various storage forms of votes. +pub enum VoteStorageForm { + /// Storage form for contested document resource votes. + ContestedDocumentResource(ContestedDocumentResourceVoteStorageForm), +} + +impl TreePathStorageForm for VoteStorageForm { + fn try_from_tree_path(path: Vec>) -> Result + where + Self: Sized, + { + if path.len() < 3 { + return Err(ProtocolError::VoteError(format!( + "path {} is not long enough to construct vote information", + path.into_iter() + .map(hex::encode) + .collect::>() + .join("/") + ))); + } + let key_0 = path.get(0).unwrap(); + let key_1 = path.get(1).unwrap(); + + let Some(key_0_byte) = key_0.get(0) else { + return Err(ProtocolError::VoteError(format!( + "path {} first element must be a byte", + path.into_iter() + .map(hex::encode) + .collect::>() + .join("/") + ))); + }; + + if *key_0_byte != Votes as u8 { + return Err(ProtocolError::VoteError(format!( + "path {} first element must be a byte for voting {}, got {}", + path.iter().map(hex::encode).collect::>().join("/"), + Votes as u8, + *key_0_byte + ))); + }; + + let Some(key_1_byte) = key_1.get(0) else { + return Err(ProtocolError::VoteError(format!( + "path {} second element must be a byte", + path.into_iter() + .map(hex::encode) + .collect::>() + .join("/") + ))); + }; + + match *key_1_byte as char { + CONTESTED_RESOURCE_TREE_KEY => Ok(VoteStorageForm::ContestedDocumentResource( + ContestedDocumentResourceVoteStorageForm::try_from_tree_path(path)?, + )), + VOTE_DECISIONS_TREE_KEY => Err(ProtocolError::NotSupported( + "decision votes not supported yet".to_string(), + )), + _ => Err(ProtocolError::VoteError(format!( + "path {} second element must be a byte for CONTESTED_RESOURCE_TREE_KEY {}, got {}", + path.iter().map(hex::encode).collect::>().join("/"), + CONTESTED_RESOURCE_TREE_KEY as u8, + *key_1_byte + ))), + } + } +} diff --git a/packages/rs-drive/src/drive/votes/tree_path_storage_form.rs b/packages/rs-drive/src/drive/votes/tree_path_storage_form.rs new file mode 100644 index 00000000000..5a22c12d1d1 --- /dev/null +++ b/packages/rs-drive/src/drive/votes/tree_path_storage_form.rs @@ -0,0 +1,9 @@ +use dpp::ProtocolError; + +/// A trait to figure out vote info from a tree path +pub trait TreePathStorageForm { + /// Construction of the resource vote from the tree oath + fn try_from_tree_path(path: Vec>) -> Result + where + Self: Sized; +} diff --git a/packages/rs-drive/src/error/cache.rs b/packages/rs-drive/src/error/cache.rs new file mode 100644 index 00000000000..d4aed54d05f --- /dev/null +++ b/packages/rs-drive/src/error/cache.rs @@ -0,0 +1,7 @@ +/// Cache errors +#[derive(Debug, thiserror::Error)] +pub enum CacheError { + /// Overflow error + #[error("global cache is blocked for block execution")] + GlobalCacheIsBlocked, +} diff --git a/packages/rs-drive/src/error/contract.rs b/packages/rs-drive/src/error/contract.rs index 25f1ee232ff..b677c345ef1 100644 --- a/packages/rs-drive/src/error/contract.rs +++ b/packages/rs-drive/src/error/contract.rs @@ -8,4 +8,20 @@ pub enum DataContractError { /// KeyBoundsExpectedButNotPresent error #[error("key bounds expected but not present error: {0}")] KeyBoundsExpectedButNotPresent(&'static str), + + /// Data contract missing or cannot be retrieved + #[error("data contract cannot be retrieved: {0}")] + MissingContract(String), + + /// Data contract provided is not the one we want + #[error("data contract provided is incorrect: {0}")] + ProvidedContractMismatch(String), + + /// Data contract is corrupted + #[error("data contract is corrupted: {0}")] + CorruptedDataContract(String), + + /// Data contract storage error when data contract is too big + #[error("data contract is too big to be stored: {0}")] + ContractTooBig(String), } diff --git a/packages/rs-drive/src/error/document.rs b/packages/rs-drive/src/error/document.rs index e9062f60867..4b1408226f5 100644 --- a/packages/rs-drive/src/error/document.rs +++ b/packages/rs-drive/src/error/document.rs @@ -11,6 +11,6 @@ pub enum DocumentError { #[error("invalid contract identifier size error")] InvalidContractIdSize(), /// Error - #[error("contact with specified identifier is not found")] + #[error("contract with specified identifier is not found")] DataContractNotFound, } diff --git a/packages/rs-drive/src/error/drive.rs b/packages/rs-drive/src/error/drive.rs index 8af1de92091..74bd830129a 100644 --- a/packages/rs-drive/src/error/drive.rs +++ b/packages/rs-drive/src/error/drive.rs @@ -1,4 +1,5 @@ use crate::drive::contract::MAX_CONTRACT_HISTORY_FETCH_LIMIT; +use dpp::fee::Credits; use dpp::version::FeatureVersion; /// Drive errors @@ -72,6 +73,14 @@ pub enum DriveError { #[error("changing contract keeps history error: {0}")] ChangingContractKeepsHistory(&'static str), + /// Error + #[error("contested index not found error: {0}")] + ContestedIndexNotFound(&'static str), + + /// Error + #[error("contested document missing owner error: {0}")] + ContestedDocumentMissingOwnerId(&'static str), + /// Error #[error("updating contract with history error: {0}")] UpdatingContractWithHistoryError(&'static str), @@ -89,6 +98,10 @@ pub enum DriveError { #[error("changing document type keeps history error: {0}")] ChangingDocumentTypeKeepsHistory(&'static str), + /// Error + #[error("invalid path error: {0}")] + InvalidPath(&'static str), + /// Error #[error("corrupted contract path error: {0}")] CorruptedContractPath(&'static str), @@ -153,8 +166,8 @@ pub enum DriveError { CorruptedGenesisTimeInvalidItemLength(String), /// Error - #[error("batch is empty")] - BatchIsEmpty(), + #[error("batch is empty: {0}")] + BatchIsEmpty(String), /// Error #[error("unexpected element type: {0}")] @@ -163,4 +176,16 @@ pub enum DriveError { /// Error #[error("invalid contract history fetch limit: {0}. The limit must be between 1 and {MAX_CONTRACT_HISTORY_FETCH_LIMIT}")] InvalidContractHistoryFetchLimit(u16), + + /// Error + #[error("prefunded specialized balance does not exist: {0}")] + PrefundedSpecializedBalanceDoesNotExist(String), + + /// Error + #[error("prefunded specialized balance does not have enough credits: we have {0}, we want to deduct {1}")] + PrefundedSpecializedBalanceNotEnough(Credits, Credits), + + /// Data Contract not found + #[error("data contract not found: {0}")] + DataContractNotFound(String), } diff --git a/packages/rs-drive/src/error/fee.rs b/packages/rs-drive/src/error/fee.rs index b7721b17498..cb079cace40 100644 --- a/packages/rs-drive/src/error/fee.rs +++ b/packages/rs-drive/src/error/fee.rs @@ -32,5 +32,5 @@ pub enum FeeError { /// Document type field not found for estimation #[error("document type field not found for estimation error: {0}")] - DocumentTypeFieldNotFoundForEstimation(&'static str), + DocumentTypeFieldNotFoundForEstimation(String), } diff --git a/packages/rs-drive/src/error/identity.rs b/packages/rs-drive/src/error/identity.rs index e2d3823919d..c1a888b6dad 100644 --- a/packages/rs-drive/src/error/identity.rs +++ b/packages/rs-drive/src/error/identity.rs @@ -45,6 +45,10 @@ pub enum IdentityError { #[error("critical balance overflow error: {0}")] CriticalBalanceOverflow(&'static str), + /// Identity Contract revision nonce error + #[error("identity contract revision nonce error: {0}")] + IdentityNonceError(&'static str), + /// Identity key incorrect query missing information error #[error("identity key incorrect query missing information error: {0}")] IdentityKeyIncorrectQueryMissingInformation(&'static str), @@ -54,6 +58,6 @@ pub enum IdentityError { IdentityKeyBoundsError(&'static str), /// Identity Key Data Contract Not Found - #[error("contact with specified identifier is not found for identity key data contract")] + #[error("contract with specified identifier is not found for identity key data contract")] IdentityKeyDataContractNotFound, } diff --git a/packages/rs-drive/src/error/mod.rs b/packages/rs-drive/src/error/mod.rs index c2c50ad8e0c..456e759d0cb 100644 --- a/packages/rs-drive/src/error/mod.rs +++ b/packages/rs-drive/src/error/mod.rs @@ -1,14 +1,18 @@ use self::drive::DriveError; +use crate::error::cache::CacheError; use crate::error::contract::DataContractError; use crate::error::proof::ProofError; use crate::error::storage_flags::StorageFlagsError; use document::DocumentError; +use dpp::data_contract::errors::DataContractError as ProtocolDataContractError; use dpp::platform_value::Error as ValueError; use dpp::ProtocolError; use fee::FeeError; use identity::IdentityError; use query::QuerySyntaxError; +/// Cache errors +pub mod cache; ///DataContract errors pub mod contract; /// Document module @@ -62,4 +66,13 @@ pub enum Error { ///DataContract error #[error("contract: {0}")] DataContract(#[from] DataContractError), + ///Cache error + #[error("contract: {0}")] + Cache(#[from] CacheError), +} + +impl From for Error { + fn from(value: ProtocolDataContractError) -> Self { + Self::Protocol(ProtocolError::DataContractError(value)) + } } diff --git a/packages/rs-drive/src/error/proof.rs b/packages/rs-drive/src/error/proof.rs index 627d114b2b8..504aa11f559 100644 --- a/packages/rs-drive/src/error/proof.rs +++ b/packages/rs-drive/src/error/proof.rs @@ -25,6 +25,31 @@ pub enum ProofError { #[error("corrupted error: {0}")] CorruptedProof(String), + /// The proof returned is said to be valid, data is what we asked for, but is not what was + /// expected, for example if we updated a contract, but we are getting back the old contract + #[error("incorrect proof error: {0}")] + IncorrectProof(String), + + /// The transition we are trying to prove was executed is invalid + #[error("invalid transition error: {0}")] + InvalidTransition(String), + + /// The transition we are trying to prove has an unknown contract + #[error("unknown contract in documents batch transition error: {0}")] + UnknownContract(String), + + /// The metadata we got back from platform is incorrect + #[error("invalid metadata: {0}")] + InvalidMetadata(String), + + /// We are trying to callback to retrieve a contract, but there was an error + #[error("the contract could not be retrieved during verification: {0}")] + ErrorRetrievingContract(String), + + /// We are missing a context requirement + #[error("missing context requirement error: {0}")] + MissingContextRequirement(String), + /// Incomplete proof error #[error("incomplete proof error: {0}")] IncompleteProof(&'static str), @@ -43,6 +68,8 @@ pub enum ProofError { }, } #[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] fn get_error_code(error: &ProofError) -> u32 { match error { ProofError::TooManyElements(_) => 6000, @@ -52,5 +79,11 @@ fn get_error_code(error: &ProofError) -> u32 { ProofError::IncompleteProof(_) => 6004, ProofError::IncorrectValueSize(_) => 6005, ProofError::IncorrectElementPath { .. } => 6006, + ProofError::IncorrectProof(_) => 6007, + ProofError::InvalidTransition(_) => 6008, + ProofError::UnknownContract(_) => 6009, + ProofError::ErrorRetrievingContract(_) => 6010, + ProofError::InvalidMetadata(_) => 6011, + ProofError::MissingContextRequirement(_) => 6012, } } diff --git a/packages/rs-drive/src/error/query.rs b/packages/rs-drive/src/error/query.rs index ac7a6ce6476..1166638edb4 100644 --- a/packages/rs-drive/src/error/query.rs +++ b/packages/rs-drive/src/error/query.rs @@ -1,3 +1,5 @@ +use sqlparser::parser::ParserError; + /// Query errors #[derive(Debug, thiserror::Error)] pub enum QuerySyntaxError { @@ -8,8 +10,11 @@ pub enum QuerySyntaxError { #[error("unsupported error: {0}")] Unsupported(String), /// Invalid SQL error + #[error("sql parsing error: {0}")] + SQLParsingError(#[from] ParserError), + /// Invalid SQL error #[error("invalid sql error: {0}")] - InvalidSQL(&'static str), + InvalidSQL(String), /// We asked for nothing #[error("no query items error: {0}")] @@ -39,7 +44,7 @@ pub enum QuerySyntaxError { InvalidBetweenClause(&'static str), /// Invalid in clause error #[error("invalid IN clause error: {0}")] - InvalidInClause(&'static str), + InvalidInClause(String), /// Invalid starts with clause error #[error("invalid STARTSWITH clause error: {0}")] InvalidStartsWithClause(&'static str), @@ -91,7 +96,7 @@ pub enum QuerySyntaxError { /// Where clause on non indexed property error #[error("where clause on non indexed property error: {0}")] - WhereClauseOnNonIndexedProperty(&'static str), + WhereClauseOnNonIndexedProperty(String), /// Query is too far from index error #[error("query is too far from index: {0}")] QueryTooFarFromIndex(&'static str), @@ -127,4 +132,16 @@ pub enum QuerySyntaxError { /// Invalid identity prove request error #[error("invalid identity prove request error: {0}")] InvalidIdentityProveRequest(&'static str), + + /// Requesting proof with offset error + #[error("requesting proof with offset error: {0}")] + RequestingProofWithOffset(String), + + /// Unknown index error + #[error("unknown error: {0}")] + UnknownIndex(String), + + /// Missing index values for query + #[error("incorrect index values error: {0}")] + IndexValuesError(String), } diff --git a/packages/rs-drive/src/fee/mod.rs b/packages/rs-drive/src/fee/mod.rs deleted file mode 100644 index e137d39fb6b..00000000000 --- a/packages/rs-drive/src/fee/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod op; diff --git a/packages/rs-drive/src/fee/op.rs b/packages/rs-drive/src/fee/op.rs deleted file mode 100644 index 527c55e9f91..00000000000 --- a/packages/rs-drive/src/fee/op.rs +++ /dev/null @@ -1,461 +0,0 @@ -use crate::drive::batch::GroveDbOpBatch; -use grovedb_costs::storage_cost::removal::Identifier; -use grovedb_costs::storage_cost::removal::StorageRemovedBytes::{ - BasicStorageRemoval, NoStorageRemoval, SectionedStorageRemoval, -}; - -use enum_map::Enum; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::KeyInfoPath; -use grovedb::element::MaxReferenceHop; -use grovedb::reference_path::ReferencePathType; -use grovedb::{batch::GroveDbOp, Element, ElementFlags}; -use grovedb_costs::OperationCost; - -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::fee::get_overflow_error; -use crate::drive::flags::StorageFlags; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation::{ - CalculatedCostOperation, FunctionOperation, GroveOperation, PreCalculatedFeeResult, -}; -use dpp::block::epoch::Epoch; -use dpp::fee::default_costs::EpochCosts; -use dpp::fee::default_costs::KnownCostItem::{ - StorageDiskUsageCreditPerByte, StorageLoadCreditPerByte, StorageProcessingCreditPerByte, - StorageSeekCost, -}; -use dpp::fee::fee_result::refunds::FeeRefunds; -use dpp::fee::fee_result::FeeResult; - -/// Base ops -#[derive(Debug, Enum)] -pub enum BaseOp { - /// Stop - Stop, - /// Add - Add, - /// Multiply - Mul, - /// Subtract - Sub, - /// Divide - Div, - /// Sdiv - Sdiv, - /// Modulo - Mod, - /// Smod - Smod, - /// Addmod - Addmod, - /// Mulmod - Mulmod, - /// Signextend - Signextend, - /// Less than - Lt, - /// Greater than - Gt, - /// Slt - Slt, - /// Sgt - Sgt, - /// Equals - Eq, - /// Is zero - Iszero, - /// And - And, - /// Or - Or, - /// Xor - Xor, - /// Not - Not, - /// Byte - Byte, -} - -impl BaseOp { - /// Match the op and get the cost - pub fn cost(&self) -> u64 { - match self { - BaseOp::Stop => 0, - BaseOp::Add => 12, - BaseOp::Mul => 20, - BaseOp::Sub => 12, - BaseOp::Div => 20, - BaseOp::Sdiv => 20, - BaseOp::Mod => 20, - BaseOp::Smod => 20, - BaseOp::Addmod => 32, - BaseOp::Mulmod => 32, - BaseOp::Signextend => 20, - BaseOp::Lt => 12, - BaseOp::Gt => 12, - BaseOp::Slt => 12, - BaseOp::Sgt => 12, - BaseOp::Eq => 12, - BaseOp::Iszero => 12, - BaseOp::And => 12, - BaseOp::Or => 12, - BaseOp::Xor => 12, - BaseOp::Not => 12, - BaseOp::Byte => 12, - } - } -} - -/// Supported Hash Functions -#[derive(Debug, Enum, PartialEq, Eq)] -pub enum HashFunction { - /// Used for crypto addresses - Sha256RipeMD160, - /// Single Sha256 - Sha256, - /// Double Sha256 - Sha256_2, - /// Single Blake3 - Blake3, -} - -impl HashFunction { - fn block_size(&self) -> u16 { - match self { - HashFunction::Sha256 => 64, - HashFunction::Sha256_2 => 64, - HashFunction::Blake3 => 64, - HashFunction::Sha256RipeMD160 => 64, - } - } - - fn rounds(&self) -> u16 { - match self { - HashFunction::Sha256 => 1, - HashFunction::Sha256_2 => 2, - HashFunction::Blake3 => 1, - HashFunction::Sha256RipeMD160 => 1, - } - } - - //todo: put real costs in - fn base_cost(&self, _epoch: &Epoch) -> u64 { - match self { - HashFunction::Sha256 => 30, - HashFunction::Sha256_2 => 30, - HashFunction::Blake3 => 30, - HashFunction::Sha256RipeMD160 => 30, - } - } -} - -/// A Hash Function Operation -#[derive(Debug, PartialEq, Eq)] -pub struct FunctionOp { - /// hash - pub(crate) hash: HashFunction, - /// rounds - pub(crate) rounds: u32, -} - -impl FunctionOp { - /// The cost of the function - fn cost(&self, epoch: &Epoch) -> u64 { - self.rounds as u64 * self.hash.base_cost(epoch) - } - - /// Create a new function operation with the following hash knowing the rounds it will take - /// in advance - pub fn new_with_round_count(hash: HashFunction, rounds: u32) -> Self { - FunctionOp { hash, rounds } - } - - /// Create a new function operation with the following hash knowing the number of bytes - /// it will hash - pub fn new_with_byte_count(hash: HashFunction, byte_count: u16) -> Self { - let blocks = byte_count / hash.block_size() + 1; - let rounds = blocks + hash.rounds() - 1; - FunctionOp { - hash, - rounds: rounds as u32, - } - } -} - -/// Drive operation -#[derive(Debug, Eq, PartialEq)] -pub enum LowLevelDriveOperation { - /// Grove operation - GroveOperation(GroveDbOp), - /// A drive operation - FunctionOperation(FunctionOp), - /// Calculated cost operation - CalculatedCostOperation(OperationCost), - /// Pre Calculated Fee Result - PreCalculatedFeeResult(FeeResult), -} - -impl LowLevelDriveOperation { - /// Returns a list of the costs of the Drive operations. - pub fn consume_to_fees( - drive_operation: Vec, - epoch: &Epoch, - epochs_per_era: u16, - ) -> Result, Error> { - drive_operation - .into_iter() - .map(|operation| match operation { - PreCalculatedFeeResult(f) => Ok(f), - FunctionOperation(op) => Ok(FeeResult { - processing_fee: op.cost(epoch), - ..Default::default() - }), - _ => { - let cost = operation.operation_cost()?; - let storage_fee = cost.storage_cost(epoch)?; - let processing_fee = cost.ephemeral_cost(epoch)?; - let (fee_refunds, removed_bytes_from_system) = - match cost.storage_cost.removed_bytes { - NoStorageRemoval => (FeeRefunds::default(), 0), - BasicStorageRemoval(amount) => { - // this is not always considered an error - (FeeRefunds::default(), amount) - } - SectionedStorageRemoval(mut removal_per_epoch_by_identifier) => { - let system_amount = removal_per_epoch_by_identifier - .remove(&Identifier::default()) - .map_or(0, |a| a.values().sum()); - - ( - FeeRefunds::from_storage_removal( - removal_per_epoch_by_identifier, - epoch.index, - epochs_per_era, - )?, - system_amount, - ) - } - }; - Ok(FeeResult { - storage_fee, - processing_fee, - fee_refunds, - removed_bytes_from_system, - }) - } - }) - .collect() - } - - /// Returns the cost of this operation - pub fn operation_cost(self) -> Result { - match self { - GroveOperation(_) => Err(Error::Drive(DriveError::CorruptedCodeExecution( - "grove operations must be executed, not directly transformed to costs", - ))), - CalculatedCostOperation(c) => Ok(c), - PreCalculatedFeeResult(_) => Err(Error::Drive(DriveError::CorruptedCodeExecution( - "pre calculated fees should not be requested by operation costs", - ))), - FunctionOperation(_) => Err(Error::Drive(DriveError::CorruptedCodeExecution( - "function operations should not be requested by operation costs", - ))), - } - } - - /// Filters the groveDB ops from a list of operations and puts them in a `GroveDbOpBatch`. - pub fn combine_cost_operations(operations: &[LowLevelDriveOperation]) -> OperationCost { - let mut cost = OperationCost::default(); - operations.iter().for_each(|op| { - if let CalculatedCostOperation(operation_cost) = op { - cost += operation_cost.clone() - } - }); - cost - } - - /// Filters the groveDB ops from a list of operations and puts them in a `GroveDbOpBatch`. - pub fn grovedb_operations_batch( - insert_operations: &[LowLevelDriveOperation], - ) -> GroveDbOpBatch { - let operations = insert_operations - .iter() - .filter_map(|op| match op { - GroveOperation(grovedb_op) => Some(grovedb_op.clone()), - _ => None, - }) - .collect(); - GroveDbOpBatch::from_operations(operations) - } - - /// Filters the groveDB ops from a list of operations and collects them in a `Vec`. - pub fn grovedb_operations_consume( - insert_operations: Vec, - ) -> Vec { - insert_operations - .into_iter() - .filter_map(|op| match op { - GroveOperation(grovedb_op) => Some(grovedb_op), - _ => None, - }) - .collect() - } - - /// Sets `GroveOperation` for inserting an empty tree at the given path and key - pub fn for_known_path_key_empty_tree( - path: Vec>, - key: Vec, - storage_flags: Option<&StorageFlags>, - ) -> Self { - let tree = match storage_flags { - Some(storage_flags) => { - Element::empty_tree_with_flags(storage_flags.to_some_element_flags()) - } - None => Element::empty_tree(), - }; - - LowLevelDriveOperation::insert_for_known_path_key_element(path, key, tree) - } - - /// Sets `GroveOperation` for inserting an empty tree at the given path and key - pub fn for_estimated_path_key_empty_tree( - path: KeyInfoPath, - key: KeyInfo, - storage_flags: Option<&StorageFlags>, - ) -> Self { - let tree = match storage_flags { - Some(storage_flags) => { - Element::empty_tree_with_flags(storage_flags.to_some_element_flags()) - } - None => Element::empty_tree(), - }; - - LowLevelDriveOperation::insert_for_estimated_path_key_element(path, key, tree) - } - - /// Sets `GroveOperation` for inserting an element at the given path and key - pub fn insert_for_known_path_key_element( - path: Vec>, - key: Vec, - element: Element, - ) -> Self { - GroveOperation(GroveDbOp::insert_op(path, key, element)) - } - - /// Sets `GroveOperation` for replacement of an element at the given path and key - pub fn replace_for_known_path_key_element( - path: Vec>, - key: Vec, - element: Element, - ) -> Self { - GroveOperation(GroveDbOp::replace_op(path, key, element)) - } - - /// Sets `GroveOperation` for patching of an element at the given path and key - /// This is different from replacement which does not add or delete bytes - pub fn patch_for_known_path_key_element( - path: Vec>, - key: Vec, - element: Element, - change_in_bytes: i32, - ) -> Self { - GroveOperation(GroveDbOp::patch_op(path, key, element, change_in_bytes)) - } - - /// Sets `GroveOperation` for inserting an element at an unknown estimated path and key - pub fn insert_for_estimated_path_key_element( - path: KeyInfoPath, - key: KeyInfo, - element: Element, - ) -> Self { - GroveOperation(GroveDbOp::insert_estimated_op(path, key, element)) - } - - /// Sets `GroveOperation` for replacement of an element at an unknown estimated path and key - pub fn replace_for_estimated_path_key_element( - path: KeyInfoPath, - key: KeyInfo, - element: Element, - ) -> Self { - GroveOperation(GroveDbOp::replace_estimated_op(path, key, element)) - } - - /// Sets `GroveOperation` for refresh of a reference at the given path and key - pub fn refresh_reference_for_known_path_key_reference_info( - path: Vec>, - key: Vec, - reference_path_type: ReferencePathType, - max_reference_hop: MaxReferenceHop, - flags: Option, - trust_refresh_reference: bool, - ) -> Self { - GroveOperation(GroveDbOp::refresh_reference_op( - path, - key, - reference_path_type, - max_reference_hop, - flags, - trust_refresh_reference, - )) - } -} - -/// Drive cost trait -pub trait DriveCost { - /// Ephemeral cost - fn ephemeral_cost(&self, epoch: &Epoch) -> Result; - /// Storage cost - fn storage_cost(&self, epoch: &Epoch) -> Result; -} - -impl DriveCost for OperationCost { - /// Return the ephemeral cost from the operation - fn ephemeral_cost(&self, epoch: &Epoch) -> Result { - //todo: deal with epochs - let OperationCost { - seek_count, - storage_cost, - storage_loaded_bytes, - hash_node_calls, - } = self; - let epoch_cost_for_processing_credit_per_byte = - epoch.cost_for_known_cost_item(StorageProcessingCreditPerByte); - let seek_cost = (*seek_count as u64) - .checked_mul(epoch.cost_for_known_cost_item(StorageSeekCost)) - .ok_or_else(|| get_overflow_error("seek cost overflow"))?; - let storage_added_bytes_ephemeral_cost = (storage_cost.added_bytes as u64) - .checked_mul(epoch_cost_for_processing_credit_per_byte) - .ok_or_else(|| get_overflow_error("storage written bytes cost overflow"))?; - let storage_replaced_bytes_ephemeral_cost = (storage_cost.replaced_bytes as u64) - .checked_mul(epoch_cost_for_processing_credit_per_byte) - .ok_or_else(|| get_overflow_error("storage written bytes cost overflow"))?; - let storage_removed_bytes_ephemeral_cost = - (storage_cost.removed_bytes.total_removed_bytes() as u64) - .checked_mul(epoch_cost_for_processing_credit_per_byte) - .ok_or_else(|| get_overflow_error("storage written bytes cost overflow"))?; - let storage_loaded_bytes_cost = (*storage_loaded_bytes as u64) - .checked_mul(epoch.cost_for_known_cost_item(StorageLoadCreditPerByte)) - .ok_or_else(|| get_overflow_error("storage loaded cost overflow"))?; - // this can't overflow - let hash_node_cost = - FunctionOp::new_with_round_count(HashFunction::Blake3, *hash_node_calls).cost(epoch); - seek_cost - .checked_add(storage_added_bytes_ephemeral_cost) - .and_then(|c| c.checked_add(storage_replaced_bytes_ephemeral_cost)) - .and_then(|c| c.checked_add(storage_loaded_bytes_cost)) - .and_then(|c| c.checked_add(storage_removed_bytes_ephemeral_cost)) - .and_then(|c| c.checked_add(hash_node_cost)) - .ok_or_else(|| get_overflow_error("ephemeral cost addition overflow")) - } - - /// Return the storage cost from the operation - fn storage_cost(&self, epoch: &Epoch) -> Result { - //todo: deal with epochs - let OperationCost { storage_cost, .. } = self; - (storage_cost.added_bytes as u64) - .checked_mul(epoch.cost_for_known_cost_item(StorageDiskUsageCreditPerByte)) - .ok_or_else(|| get_overflow_error("storage written bytes cost overflow")) - } -} diff --git a/packages/rs-drive/src/fee_pools/epochs/epoch_key_constants.rs b/packages/rs-drive/src/fee_pools/epochs/epoch_key_constants.rs deleted file mode 100644 index 208239c1d9d..00000000000 --- a/packages/rs-drive/src/fee_pools/epochs/epoch_key_constants.rs +++ /dev/null @@ -1,14 +0,0 @@ -/// Processing fee pool key -pub const KEY_POOL_PROCESSING_FEES: &[u8; 1] = b"p"; -/// Storage fee pool key -pub const KEY_POOL_STORAGE_FEES: &[u8; 1] = b"s"; -/// Start time key -pub const KEY_START_TIME: &[u8; 1] = b"t"; -/// Start block height key -pub const KEY_START_BLOCK_HEIGHT: &[u8; 1] = b"h"; -/// Start block core chain locked height key -pub const KEY_START_BLOCK_CORE_HEIGHT: &[u8; 1] = b"c"; -/// Proposers key -pub const KEY_PROPOSERS: &[u8; 1] = b"m"; -/// Fee multiplier key -pub const KEY_FEE_MULTIPLIER: &[u8; 1] = b"x"; diff --git a/packages/rs-drive/src/fee_pools/epochs/mod.rs b/packages/rs-drive/src/fee_pools/epochs/mod.rs deleted file mode 100644 index f04253c1e5a..00000000000 --- a/packages/rs-drive/src/fee_pools/epochs/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Epoch pools -//! - -/// Epoch key constants module -pub mod epoch_key_constants; -pub mod operations_factory; -pub mod paths; diff --git a/packages/rs-drive/src/fee_pools/epochs/paths.rs b/packages/rs-drive/src/fee_pools/epochs/paths.rs deleted file mode 100644 index 52ad653f918..00000000000 --- a/packages/rs-drive/src/fee_pools/epochs/paths.rs +++ /dev/null @@ -1,107 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Epoch Paths -//! -//! Defines and implements in `Epoch` functions related to paths related to epochs. -//! - -use crate::drive::RootTree; -use crate::error::drive::DriveError; -use crate::error::fee::FeeError; -use crate::error::Error; -use crate::fee_pools::epochs::epoch_key_constants; -use dpp::block::epoch::{Epoch, EPOCH_KEY_OFFSET}; - -/// Proposer Trait for Epoch -pub trait EpochProposers { - /// Get the path to this epoch as a vector - fn get_path_vec(&self) -> Vec>; - /// Get the path to this epoch as a fixed size path - fn get_path(&self) -> [&[u8]; 2]; - /// Get the path to the proposers tree of this epoch as a vector - fn get_proposers_path_vec(&self) -> Vec>; - /// Get the path to the proposers tree of this epoch as a fixed length path - fn get_proposers_path(&self) -> [&[u8]; 3]; -} - -impl EpochProposers for Epoch { - /// Get the path to the proposers tree of this epoch as a fixed length path - fn get_proposers_path(&self) -> [&[u8]; 3] { - [ - Into::<&[u8; 1]>::into(RootTree::Pools), - &self.key, - epoch_key_constants::KEY_PROPOSERS.as_slice(), - ] - } - - /// Get the path to the proposers tree of this epoch as a vector - fn get_proposers_path_vec(&self) -> Vec> { - vec![ - vec![RootTree::Pools as u8], - self.key.to_vec(), - epoch_key_constants::KEY_PROPOSERS.to_vec(), - ] - } - - /// Get the path to this epoch as a fixed size path - fn get_path(&self) -> [&[u8]; 2] { - [Into::<&[u8; 1]>::into(RootTree::Pools), &self.key] - } - - /// Get the path to this epoch as a vector - fn get_path_vec(&self) -> Vec> { - vec![vec![RootTree::Pools as u8], self.key.to_vec()] - } -} - -/// Encodes an epoch index key with storage offset -pub fn encode_epoch_index_key(index: u16) -> Result<[u8; 2], Error> { - let index_with_offset = - index - .checked_add(EPOCH_KEY_OFFSET) - .ok_or(Error::Fee(FeeError::Overflow( - "stored epoch index too high", - )))?; - - Ok(index_with_offset.to_be_bytes()) -} - -/// Decodes an epoch index key -pub fn decode_epoch_index_key(epoch_key: &[u8]) -> Result { - let index_with_offset = u16::from_be_bytes(epoch_key.try_into().map_err(|_| { - Error::Drive(DriveError::CorruptedSerialization(String::from( - "epoch index must be u16", - ))) - })?); - - index_with_offset - .checked_sub(EPOCH_KEY_OFFSET) - .ok_or(Error::Fee(FeeError::Overflow("stored epoch index too low"))) -} diff --git a/packages/rs-drive/src/fee_pools/epochs_root_tree_key_constants.rs b/packages/rs-drive/src/fee_pools/epochs_root_tree_key_constants.rs deleted file mode 100644 index 1be1cd41835..00000000000 --- a/packages/rs-drive/src/fee_pools/epochs_root_tree_key_constants.rs +++ /dev/null @@ -1,6 +0,0 @@ -/// Storage fee pool key -pub const KEY_STORAGE_FEE_POOL: &[u8; 1] = b"s"; -/// Unpaid epoch index key -pub const KEY_UNPAID_EPOCH_INDEX: &[u8; 1] = b"u"; -/// Pending refunds that will be deducted from epoch storage fee pools -pub const KEY_PENDING_EPOCH_REFUNDS: &[u8; 1] = b"p"; diff --git a/packages/rs-drive/src/fee_pools/mod.rs b/packages/rs-drive/src/fee_pools/mod.rs deleted file mode 100644 index a38c12fd32d..00000000000 --- a/packages/rs-drive/src/fee_pools/mod.rs +++ /dev/null @@ -1,189 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -use crate::drive::batch::GroveDbOpBatch; -use crate::drive::credit_pools::paths::pools_vec_path; -use crate::error::Error; - -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::fee_pools::epochs::operations_factory::EpochOperations; -use crate::fee_pools::epochs_root_tree_key_constants::{ - KEY_PENDING_EPOCH_REFUNDS, KEY_STORAGE_FEE_POOL, KEY_UNPAID_EPOCH_INDEX, -}; -use dpp::balances::credits::Creditable; -use dpp::block::epoch::{Epoch, EpochIndex}; -use dpp::fee::epoch::{perpetual_storage_epochs, GENESIS_EPOCH_INDEX}; -use dpp::fee::Credits; -use grovedb::batch::GroveDbOp; -use grovedb::Element; - -/// Epochs module -pub mod epochs; -/// Epochs root tree key constants module -pub mod epochs_root_tree_key_constants; - -/// Adds the operations to groveDB op batch to create the fee pool trees -pub fn add_create_fee_pool_trees_operations( - batch: &mut GroveDbOpBatch, - epochs_per_era: u16, -) -> Result<(), Error> { - // Init storage credit pool - batch.push(update_storage_fee_distribution_pool_operation(0)?); - - // Init next epoch to pay - batch.push(update_unpaid_epoch_index_operation(GENESIS_EPOCH_INDEX)); - - add_create_pending_epoch_refunds_tree_operations(batch); - - // We need to insert 50 era worth of epochs, - // with 40 epochs per era that's 2000 epochs - // however this is configurable - for i in GENESIS_EPOCH_INDEX..perpetual_storage_epochs(epochs_per_era) { - let epoch = Epoch::new(i)?; - epoch.add_init_empty_operations(batch)?; - } - - Ok(()) -} - -/// Adds operations to batch to create pending pool updates tree -pub fn add_create_pending_epoch_refunds_tree_operations(batch: &mut GroveDbOpBatch) { - batch.add_insert_empty_sum_tree(pools_vec_path(), KEY_PENDING_EPOCH_REFUNDS.to_vec()); -} - -/// Updates the storage fee distribution pool with a new storage fee -pub fn update_storage_fee_distribution_pool_operation( - storage_fee: Credits, -) -> Result { - Ok(GroveDbOp::insert_op( - pools_vec_path(), - KEY_STORAGE_FEE_POOL.to_vec(), - Element::new_sum_item(storage_fee.to_signed()?), - )) -} - -/// Updates the unpaid epoch index -pub fn update_unpaid_epoch_index_operation(epoch_index: EpochIndex) -> GroveDbOp { - GroveDbOp::insert_op( - pools_vec_path(), - KEY_UNPAID_EPOCH_INDEX.to_vec(), - Element::new_item(epoch_index.to_be_bytes().to_vec()), - ) -} - -// TODD: Find tests - -#[cfg(test)] -mod tests { - use super::*; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; - - mod add_create_fee_pool_trees_operations { - use super::*; - use dpp::version::PlatformVersion; - - #[test] - fn test_values_are_set() { - let drive = setup_drive_with_initial_state_structure(); - let transaction = drive.grove.start_transaction(); - let platform_version = PlatformVersion::latest(); - - let storage_fee_pool = drive - .get_storage_fees_from_distribution_pool(Some(&transaction), platform_version) - .expect("should get storage fee pool"); - - assert_eq!(storage_fee_pool, 0u64); - } - - #[test] - fn test_epoch_trees_are_created() { - let drive = setup_drive_with_initial_state_structure(); - let platform_version = PlatformVersion::latest(); - let transaction = drive.grove.start_transaction(); - - let perpetual_storage_epochs = perpetual_storage_epochs(drive.config.epochs_per_era); - - for epoch_index in 0..perpetual_storage_epochs { - let epoch = Epoch::new(epoch_index).unwrap(); - - let storage_fee = drive - .get_epoch_storage_credits_for_distribution( - &epoch, - Some(&transaction), - platform_version, - ) - .expect("should get storage fee"); - - assert_eq!(storage_fee, 0); - } - - let epoch = Epoch::new(perpetual_storage_epochs).unwrap(); // 1001th epochs pool - - let result = drive.get_epoch_storage_credits_for_distribution( - &epoch, - Some(&transaction), - platform_version, - ); - - assert!(matches!(result, Err(Error::GroveDB(_)))); - } - } - - mod update_storage_fee_distribution_pool_operation { - use super::*; - use dpp::version::PlatformVersion; - - #[test] - fn test_update_and_get_value() { - let drive = setup_drive_with_initial_state_structure(); - let transaction = drive.grove.start_transaction(); - - let platform_version = PlatformVersion::latest(); - - let storage_fee = 42; - - let mut batch = GroveDbOpBatch::new(); - - batch.push( - update_storage_fee_distribution_pool_operation(storage_fee) - .expect("should return operation"), - ); - - drive - .grove_apply_batch(batch, false, Some(&transaction), &platform_version.drive) - .expect("should apply batch"); - - let stored_storage_fee = drive - .get_storage_fees_from_distribution_pool(Some(&transaction), platform_version) - .expect("should get storage fee pool"); - - assert_eq!(storage_fee, stored_storage_fee); - } - } -} diff --git a/packages/rs-drive/src/fees/calculate_fee/mod.rs b/packages/rs-drive/src/fees/calculate_fee/mod.rs new file mode 100644 index 00000000000..f2a6516a5ed --- /dev/null +++ b/packages/rs-drive/src/fees/calculate_fee/mod.rs @@ -0,0 +1,57 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::{BaseOp, LowLevelDriveOperation}; +use dpp::block::epoch::Epoch; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::fee::fee_result::FeeResult; +use dpp::version::PlatformVersion; +use enum_map::EnumMap; + +mod v0; + +impl Drive { + /// Calculates fees for the given operations. Returns the storage and processing costs. + // Developer note : If there would ever need to be more parameters, they could be added as an option. + // For example, we could transform + // pub fn calculate_fee( + // base_operations: Option>, + // drive_operations: Option>, + // epoch: &Epoch, + // platform_version: &PlatformVersion, + // ) -> Result { + // into + // pub fn calculate_fee( + // base_operations: Option>, + // drive_operations: Option>, + // new_operations: Option>, + // epoch: &Epoch, + // platform_version: &PlatformVersion, + // ) -> Result { + // All places in old code would just use a None for new_operations + // And calculate_fee_v0 would not use new_operations + pub fn calculate_fee( + base_operations: Option>, + drive_operations: Option>, + epoch: &Epoch, + epochs_per_era: u16, + platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, + ) -> Result { + match platform_version.drive.methods.fees.calculate_fee { + 0 => Self::calculate_fee_v0( + base_operations, + drive_operations, + epoch, + epochs_per_era, + &platform_version.fee_version, + previous_fee_versions, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "Drive::calculate_fee".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/fees/calculate_fee/v0/mod.rs b/packages/rs-drive/src/fees/calculate_fee/v0/mod.rs new file mode 100644 index 00000000000..1bbd9bf7fd3 --- /dev/null +++ b/packages/rs-drive/src/fees/calculate_fee/v0/mod.rs @@ -0,0 +1,51 @@ +use crate::drive::Drive; +use crate::error::fee::FeeError; +use crate::error::Error; +use crate::fees::op::{BaseOp, LowLevelDriveOperation}; +use dpp::block::epoch::Epoch; +use dpp::fee::fee_result::FeeResult; + +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use enum_map::EnumMap; +use platform_version::version::fee::FeeVersion; + +impl Drive { + /// Calculates fees for the given operations. Returns the storage and processing costs. + #[inline(always)] + pub(crate) fn calculate_fee_v0( + base_operations: Option>, + drive_operations: Option>, + epoch: &Epoch, + epochs_per_era: u16, + fee_version: &FeeVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, + ) -> Result { + let mut aggregate_fee_result = FeeResult::default(); + if let Some(base_operations) = base_operations { + for (base_op, count) in base_operations.iter() { + match base_op.cost().checked_mul(*count) { + None => return Err(Error::Fee(FeeError::Overflow("overflow error"))), + Some(cost) => match aggregate_fee_result.processing_fee.checked_add(cost) { + None => return Err(Error::Fee(FeeError::Overflow("overflow error"))), + Some(value) => aggregate_fee_result.processing_fee = value, + }, + } + } + } + + if let Some(drive_operations) = drive_operations { + // println!("{:#?}", drive_operations); + for drive_fee_result in LowLevelDriveOperation::consume_to_fees_v0( + drive_operations, + epoch, + epochs_per_era, + fee_version, + previous_fee_versions, + )? { + aggregate_fee_result.checked_add_assign(drive_fee_result)?; + } + } + + Ok(aggregate_fee_result) + } +} diff --git a/packages/rs-drive/src/fees/mod.rs b/packages/rs-drive/src/fees/mod.rs new file mode 100644 index 00000000000..96e7c996aca --- /dev/null +++ b/packages/rs-drive/src/fees/mod.rs @@ -0,0 +1,10 @@ +use crate::error::fee::FeeError; +use crate::error::Error; + +mod calculate_fee; +pub mod op; + +/// Get overflow error +pub fn get_overflow_error(str: &'static str) -> Error { + Error::Fee(FeeError::Overflow(str)) +} diff --git a/packages/rs-drive/src/fees/op.rs b/packages/rs-drive/src/fees/op.rs new file mode 100644 index 00000000000..c28ea60caa2 --- /dev/null +++ b/packages/rs-drive/src/fees/op.rs @@ -0,0 +1,520 @@ +use crate::util::batch::GroveDbOpBatch; +use grovedb_costs::storage_cost::removal::Identifier; +use grovedb_costs::storage_cost::removal::StorageRemovedBytes::{ + BasicStorageRemoval, NoStorageRemoval, SectionedStorageRemoval, +}; + +use enum_map::Enum; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::element::MaxReferenceHop; +use grovedb::reference_path::ReferencePathType; +use grovedb::{batch::QualifiedGroveDbOp, Element, ElementFlags}; +use grovedb_costs::OperationCost; +use itertools::Itertools; + +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::get_overflow_error; +use crate::fees::op::LowLevelDriveOperation::{ + CalculatedCostOperation, FunctionOperation, GroveOperation, PreCalculatedFeeResult, +}; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::storage_flags::StorageFlags; +use dpp::block::epoch::Epoch; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::fee::fee_result::refunds::FeeRefunds; +use dpp::fee::fee_result::FeeResult; +use dpp::fee::Credits; +use platform_version::version::fee::FeeVersion; + +/// Base ops +#[derive(Debug, Enum)] +pub enum BaseOp { + /// Stop + Stop, + /// Add + Add, + /// Multiply + Mul, + /// Subtract + Sub, + /// Divide + Div, + /// Sdiv + Sdiv, + /// Modulo + Mod, + /// Smod + Smod, + /// Addmod + Addmod, + /// Mulmod + Mulmod, + /// Signextend + Signextend, + /// Less than + Lt, + /// Greater than + Gt, + /// Slt + Slt, + /// Sgt + Sgt, + /// Equals + Eq, + /// Is zero + Iszero, + /// And + And, + /// Or + Or, + /// Xor + Xor, + /// Not + Not, + /// Byte + Byte, +} + +impl BaseOp { + /// Match the op and get the cost + pub fn cost(&self) -> u64 { + match self { + BaseOp::Stop => 0, + BaseOp::Add => 12, + BaseOp::Mul => 20, + BaseOp::Sub => 12, + BaseOp::Div => 20, + BaseOp::Sdiv => 20, + BaseOp::Mod => 20, + BaseOp::Smod => 20, + BaseOp::Addmod => 32, + BaseOp::Mulmod => 32, + BaseOp::Signextend => 20, + BaseOp::Lt => 12, + BaseOp::Gt => 12, + BaseOp::Slt => 12, + BaseOp::Sgt => 12, + BaseOp::Eq => 12, + BaseOp::Iszero => 12, + BaseOp::And => 12, + BaseOp::Or => 12, + BaseOp::Xor => 12, + BaseOp::Not => 12, + BaseOp::Byte => 12, + } + } +} + +/// Supported Hash Functions +#[derive(Debug, Enum, PartialEq, Eq)] +pub enum HashFunction { + /// Used for crypto addresses + Sha256RipeMD160, + /// Single Sha256 + Sha256, + /// Double Sha256 + Sha256_2, + /// Single Blake3 + Blake3, +} + +impl HashFunction { + fn block_size(&self) -> u16 { + match self { + HashFunction::Sha256 => 64, + HashFunction::Sha256_2 => 64, + HashFunction::Blake3 => 64, + HashFunction::Sha256RipeMD160 => 64, + } + } + + fn rounds(&self) -> u16 { + match self { + HashFunction::Sha256 => 1, + HashFunction::Sha256_2 => 2, + HashFunction::Blake3 => 1, + HashFunction::Sha256RipeMD160 => 1, + } + } + + fn block_cost(&self, fee_version: &FeeVersion) -> u64 { + match self { + HashFunction::Sha256 => fee_version.hashing.sha256_per_block, + HashFunction::Sha256_2 => fee_version.hashing.sha256_per_block, + HashFunction::Blake3 => fee_version.hashing.blake3_per_block, + HashFunction::Sha256RipeMD160 => fee_version.hashing.sha256_per_block, + } + } + + fn base_cost(&self, fee_version: &FeeVersion) -> u64 { + match self { + HashFunction::Sha256 => fee_version.hashing.single_sha256_base, + // It's normal that the base cost for a sha256 will have a single sha256 base + // But it has an extra block + HashFunction::Sha256_2 => fee_version.hashing.single_sha256_base, + HashFunction::Blake3 => fee_version.hashing.blake3_base, + HashFunction::Sha256RipeMD160 => fee_version.hashing.sha256_ripe_md160_base, + } + } +} + +/// A Hash Function Operation +#[derive(Debug, PartialEq, Eq)] +pub struct FunctionOp { + /// hash + pub(crate) hash: HashFunction, + /// rounds + pub(crate) rounds: u32, +} + +impl FunctionOp { + /// The cost of the function + fn cost(&self, fee_version: &FeeVersion) -> Credits { + let block_cost = (self.rounds as u64).saturating_mul(self.hash.block_cost(fee_version)); + self.hash.base_cost(fee_version).saturating_add(block_cost) + } + + /// Create a new function operation with the following hash knowing the rounds it will take + /// in advance + pub fn new_with_round_count(hash: HashFunction, rounds: u32) -> Self { + FunctionOp { hash, rounds } + } + + /// Create a new function operation with the following hash knowing the number of bytes + /// it will hash + pub fn new_with_byte_count(hash: HashFunction, byte_count: u16) -> Self { + let blocks = byte_count / hash.block_size() + 1; + let rounds = blocks + hash.rounds() - 1; + FunctionOp { + hash, + rounds: rounds as u32, + } + } +} + +/// Drive operation +#[derive(Debug, Eq, PartialEq)] +pub enum LowLevelDriveOperation { + /// Grove operation + GroveOperation(QualifiedGroveDbOp), + /// A drive operation + FunctionOperation(FunctionOp), + /// Calculated cost operation + CalculatedCostOperation(OperationCost), + /// Pre Calculated Fee Result + PreCalculatedFeeResult(FeeResult), +} + +impl LowLevelDriveOperation { + /// Returns a list of the costs of the Drive operations. + /// Should only be used by Calculate fee + pub fn consume_to_fees_v0( + drive_operations: Vec, + epoch: &Epoch, + epochs_per_era: u16, + fee_version: &FeeVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, + ) -> Result, Error> { + drive_operations + .into_iter() + .map(|operation| match operation { + PreCalculatedFeeResult(f) => Ok(f), + FunctionOperation(op) => Ok(FeeResult { + processing_fee: op.cost(fee_version), + ..Default::default() + }), + _ => { + let cost = operation.operation_cost()?; + // There is no need for a checked multiply here because added bytes are u64 and + // storage disk usage credit per byte should never be high enough to cause an overflow + let storage_fee = cost.storage_cost.added_bytes as u64 * fee_version.storage.storage_disk_usage_credit_per_byte; + let processing_fee = cost.ephemeral_cost(fee_version)?; + let (fee_refunds, removed_bytes_from_system) = + match cost.storage_cost.removed_bytes { + NoStorageRemoval => (FeeRefunds::default(), 0), + BasicStorageRemoval(amount) => { + // this is not always considered an error + (FeeRefunds::default(), amount) + } + SectionedStorageRemoval(mut removal_per_epoch_by_identifier) => { + let previous_fee_versions = previous_fee_versions.ok_or(Error::Drive(DriveError::CorruptedCodeExecution("expected previous epoch index fee versions to be able to offer refunds")))?; + let system_amount = removal_per_epoch_by_identifier + .remove(&Identifier::default()) + .map_or(0, |a| a.values().sum()); + + ( + FeeRefunds::from_storage_removal( + removal_per_epoch_by_identifier, + epoch.index, + epochs_per_era, + previous_fee_versions, + )?, + system_amount, + ) + } + }; + Ok(FeeResult { + storage_fee, + processing_fee, + fee_refunds, + removed_bytes_from_system, + }) + } + }) + .collect() + } + + /// Returns the cost of this operation + pub fn operation_cost(self) -> Result { + match self { + GroveOperation(_) => Err(Error::Drive(DriveError::CorruptedCodeExecution( + "grove operations must be executed, not directly transformed to costs", + ))), + CalculatedCostOperation(c) => Ok(c), + PreCalculatedFeeResult(_) => Err(Error::Drive(DriveError::CorruptedCodeExecution( + "pre calculated fees should not be requested by operation costs", + ))), + FunctionOperation(_) => Err(Error::Drive(DriveError::CorruptedCodeExecution( + "function operations should not be requested by operation costs", + ))), + } + } + + /// Filters the groveDB ops from a list of operations and puts them in a `GroveDbOpBatch`. + pub fn combine_cost_operations(operations: &[LowLevelDriveOperation]) -> OperationCost { + let mut cost = OperationCost::default(); + operations.iter().for_each(|op| { + if let CalculatedCostOperation(operation_cost) = op { + cost += operation_cost.clone() + } + }); + cost + } + + /// Filters the groveDB ops from a list of operations and puts them in a `GroveDbOpBatch`. + pub fn grovedb_operations_batch( + insert_operations: &[LowLevelDriveOperation], + ) -> GroveDbOpBatch { + let operations = insert_operations + .iter() + .filter_map(|op| match op { + GroveOperation(grovedb_op) => Some(grovedb_op.clone()), + _ => None, + }) + .collect(); + GroveDbOpBatch::from_operations(operations) + } + + /// Filters the groveDB ops from a list of operations and puts them in a `GroveDbOpBatch`. + pub fn grovedb_operations_batch_consume( + insert_operations: Vec, + ) -> GroveDbOpBatch { + let operations = insert_operations + .into_iter() + .filter_map(|op| match op { + GroveOperation(grovedb_op) => Some(grovedb_op), + _ => None, + }) + .collect(); + GroveDbOpBatch::from_operations(operations) + } + + /// Filters the groveDB ops from a list of operations and puts them in a `GroveDbOpBatch`. + pub fn grovedb_operations_batch_consume_with_leftovers( + insert_operations: Vec, + ) -> (GroveDbOpBatch, Vec) { + let (grove_operations, other_operations): (Vec<_>, Vec<_>) = + insert_operations.into_iter().partition_map(|op| match op { + GroveOperation(grovedb_op) => itertools::Either::Left(grovedb_op), + _ => itertools::Either::Right(op), + }); + + ( + GroveDbOpBatch::from_operations(grove_operations), + other_operations, + ) + } + + /// Filters the groveDB ops from a list of operations and collects them in a `Vec`. + pub fn grovedb_operations_consume( + insert_operations: Vec, + ) -> Vec { + insert_operations + .into_iter() + .filter_map(|op| match op { + GroveOperation(grovedb_op) => Some(grovedb_op), + _ => None, + }) + .collect() + } + + /// Sets `GroveOperation` for inserting an empty tree at the given path and key + pub fn for_known_path_key_empty_tree( + path: Vec>, + key: Vec, + storage_flags: Option<&StorageFlags>, + ) -> Self { + let tree = match storage_flags { + Some(storage_flags) => { + Element::empty_tree_with_flags(storage_flags.to_some_element_flags()) + } + None => Element::empty_tree(), + }; + + LowLevelDriveOperation::insert_for_known_path_key_element(path, key, tree) + } + + /// Sets `GroveOperation` for inserting an empty sum tree at the given path and key + pub fn for_known_path_key_empty_sum_tree( + path: Vec>, + key: Vec, + storage_flags: Option<&StorageFlags>, + ) -> Self { + let tree = match storage_flags { + Some(storage_flags) => { + Element::empty_sum_tree_with_flags(storage_flags.to_some_element_flags()) + } + None => Element::empty_sum_tree(), + }; + + LowLevelDriveOperation::insert_for_known_path_key_element(path, key, tree) + } + + /// Sets `GroveOperation` for inserting an empty tree at the given path and key + pub fn for_estimated_path_key_empty_tree( + path: KeyInfoPath, + key: KeyInfo, + storage_flags: Option<&StorageFlags>, + ) -> Self { + let tree = match storage_flags { + Some(storage_flags) => { + Element::empty_tree_with_flags(storage_flags.to_some_element_flags()) + } + None => Element::empty_tree(), + }; + + LowLevelDriveOperation::insert_for_estimated_path_key_element(path, key, tree) + } + + /// Sets `GroveOperation` for inserting an element at the given path and key + pub fn insert_for_known_path_key_element( + path: Vec>, + key: Vec, + element: Element, + ) -> Self { + GroveOperation(QualifiedGroveDbOp::insert_or_replace_op(path, key, element)) + } + + /// Sets `GroveOperation` for replacement of an element at the given path and key + pub fn replace_for_known_path_key_element( + path: Vec>, + key: Vec, + element: Element, + ) -> Self { + GroveOperation(QualifiedGroveDbOp::replace_op(path, key, element)) + } + + /// Sets `GroveOperation` for patching of an element at the given path and key + /// This is different from replacement which does not add or delete bytes + pub fn patch_for_known_path_key_element( + path: Vec>, + key: Vec, + element: Element, + change_in_bytes: i32, + ) -> Self { + GroveOperation(QualifiedGroveDbOp::patch_op( + path, + key, + element, + change_in_bytes, + )) + } + + /// Sets `GroveOperation` for inserting an element at an unknown estimated path and key + pub fn insert_for_estimated_path_key_element( + path: KeyInfoPath, + key: KeyInfo, + element: Element, + ) -> Self { + GroveOperation(QualifiedGroveDbOp::insert_estimated_op(path, key, element)) + } + + /// Sets `GroveOperation` for replacement of an element at an unknown estimated path and key + pub fn replace_for_estimated_path_key_element( + path: KeyInfoPath, + key: KeyInfo, + element: Element, + ) -> Self { + GroveOperation(QualifiedGroveDbOp::replace_estimated_op(path, key, element)) + } + + /// Sets `GroveOperation` for refresh of a reference at the given path and key + pub fn refresh_reference_for_known_path_key_reference_info( + path: Vec>, + key: Vec, + reference_path_type: ReferencePathType, + max_reference_hop: MaxReferenceHop, + flags: Option, + trust_refresh_reference: bool, + ) -> Self { + GroveOperation(QualifiedGroveDbOp::refresh_reference_op( + path, + key, + reference_path_type, + max_reference_hop, + flags, + trust_refresh_reference, + )) + } +} + +/// Drive cost trait +pub trait DriveCost { + /// Ephemeral cost + fn ephemeral_cost(&self, fee_version: &FeeVersion) -> Result; +} + +impl DriveCost for OperationCost { + /// Return the ephemeral cost from the operation + fn ephemeral_cost(&self, fee_version: &FeeVersion) -> Result { + let OperationCost { + seek_count, + storage_cost, + storage_loaded_bytes, + hash_node_calls, + } = self; + let epoch_cost_for_processing_credit_per_byte = + fee_version.storage.storage_processing_credit_per_byte; + let seek_cost = (*seek_count as u64) + .checked_mul(fee_version.storage.storage_seek_cost) + .ok_or_else(|| get_overflow_error("seek cost overflow"))?; + let storage_added_bytes_ephemeral_cost = (storage_cost.added_bytes as u64) + .checked_mul(epoch_cost_for_processing_credit_per_byte) + .ok_or_else(|| get_overflow_error("storage written bytes cost overflow"))?; + let storage_replaced_bytes_ephemeral_cost = (storage_cost.replaced_bytes as u64) + .checked_mul(epoch_cost_for_processing_credit_per_byte) + .ok_or_else(|| get_overflow_error("storage written bytes cost overflow"))?; + let storage_removed_bytes_ephemeral_cost = + (storage_cost.removed_bytes.total_removed_bytes() as u64) + .checked_mul(epoch_cost_for_processing_credit_per_byte) + .ok_or_else(|| get_overflow_error("storage written bytes cost overflow"))?; + // not accessible + let storage_loaded_bytes_cost = (*storage_loaded_bytes as u64) + .checked_mul(fee_version.storage.storage_load_credit_per_byte) + .ok_or_else(|| get_overflow_error("storage loaded cost overflow"))?; + + // There is one block per hash node call + let blake3_total = fee_version.hashing.blake3_base + fee_version.hashing.blake3_per_block; + // this can't overflow + let hash_node_cost = blake3_total * (*hash_node_calls as u64); + seek_cost + .checked_add(storage_added_bytes_ephemeral_cost) + .and_then(|c| c.checked_add(storage_replaced_bytes_ephemeral_cost)) + .and_then(|c| c.checked_add(storage_loaded_bytes_cost)) + .and_then(|c| c.checked_add(storage_removed_bytes_ephemeral_cost)) + .and_then(|c| c.checked_add(hash_node_cost)) + .ok_or_else(|| get_overflow_error("ephemeral cost addition overflow")) + } +} diff --git a/packages/rs-drive/src/lib.rs b/packages/rs-drive/src/lib.rs index a0c00f38bfb..a11e8e74bd3 100644 --- a/packages/rs-drive/src/lib.rs +++ b/packages/rs-drive/src/lib.rs @@ -8,35 +8,51 @@ #![forbid(unsafe_code)] #![deny(missing_docs)] -#[cfg(feature = "full")] +#[cfg(feature = "server")] extern crate core; -#[cfg(any(feature = "full", feature = "verify"))] -pub mod common; /// Drive module -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub mod drive; /// Error module -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub mod error; -/// Fee pools module -#[cfg(feature = "full")] -pub mod fee_pools; /// Query module -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub mod query; /// DPP module -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub use dpp; /// GroveDB module -#[cfg(feature = "full")] +#[cfg(any(feature = "server", feature = "verify"))] pub use grovedb; -#[cfg(feature = "full")] -mod fee; + +#[cfg(feature = "server")] +pub use grovedb_path; + +#[cfg(feature = "server")] +pub use grovedb_costs; + +#[cfg(feature = "server")] +pub use grovedb_storage; +/// Drive Cache +#[cfg(feature = "server")] +pub mod cache; +#[cfg(any(feature = "server", feature = "verify"))] +pub mod config; +#[cfg(feature = "server")] +mod fees; +#[cfg(feature = "server")] +mod open; +#[cfg(feature = "server")] +mod prove; /// State transition action module -#[cfg(feature = "full")] +#[cfg(feature = "server")] pub mod state_transition_action; -/// Test helpers -#[cfg(feature = "fixtures-and-mocks")] -pub mod tests; +/// Util module +#[cfg(any(feature = "server", feature = "verify", feature = "fixtures-and-mocks"))] +pub mod util; +/// Contains a set of useful grovedb proof verification functions +#[cfg(feature = "verify")] +pub mod verify; diff --git a/packages/rs-drive/src/open/mod.rs b/packages/rs-drive/src/open/mod.rs new file mode 100644 index 00000000000..8e2c599264c --- /dev/null +++ b/packages/rs-drive/src/open/mod.rs @@ -0,0 +1,71 @@ +use crate::cache::SystemDataContracts; +use crate::cache::{DataContractCache, DriveCache, ProtocolVersionsCache}; +use crate::config::DriveConfig; +use crate::drive::Drive; +use crate::error::Error; +use dpp::errors::ProtocolError; +use dpp::util::deserializer::ProtocolVersion; +use grovedb::GroveDb; +use platform_version::version::{PlatformVersion, INITIAL_PROTOCOL_VERSION}; +use std::path::Path; +use std::sync::Arc; + +impl Drive { + /// Opens GroveDB database + /// + /// This is a non-versioned method which opens a specified path as a GroveDB instance and returns a `Drive` + /// instance with this GroveDB, cache and other configurations. + /// + /// # Arguments + /// + /// * `path` - A reference that implements the `AsRef` trait. This represents the path to the GroveDB. + /// * `config` - An `Option` which contains `DriveConfig`. If not specified, default configuration is used. + /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. + /// + /// # Returns + /// + /// * `Result` - On success, returns `Ok(Self)`, where `Self` is a `Drive` instance. On error, returns an `Error`. + /// + pub fn open>( + path: P, + config: Option, + ) -> Result<(Self, Option), Error> { + let config = config.unwrap_or_default(); + + let grove = Arc::new(GroveDb::open(path)?); + + #[cfg(feature = "grovedbg")] + if config.grovedb_visualizer_enabled { + grove.start_visualizer(config.grovedb_visualizer_address); + } + let genesis_time_ms = config.default_genesis_time; + let data_contracts_global_cache_size = config.data_contracts_global_cache_size; + let data_contracts_block_cache_size = config.data_contracts_block_cache_size; + + let protocol_version = Drive::fetch_current_protocol_version_with_grovedb(&grove, None)?; + + // At this point we don't know the version what we need to process next block or initialize the chain + // so version related data should be updated on init chain or on block execution + let platform_version = + PlatformVersion::get(protocol_version.unwrap_or(INITIAL_PROTOCOL_VERSION)) + .map_err(ProtocolError::PlatformVersionError)?; + + let drive = Drive { + grove, + config, + cache: DriveCache { + data_contracts: DataContractCache::new( + data_contracts_global_cache_size, + data_contracts_block_cache_size, + ), + genesis_time_ms: parking_lot::RwLock::new(genesis_time_ms), + protocol_versions_counter: parking_lot::RwLock::new(ProtocolVersionsCache::new()), + system_data_contracts: SystemDataContracts::load_genesis_system_contracts( + platform_version, + )?, + }, + }; + + Ok((drive, protocol_version)) + } +} diff --git a/packages/rs-drive/src/prove/mod.rs b/packages/rs-drive/src/prove/mod.rs new file mode 100644 index 00000000000..9ef8e6737b1 --- /dev/null +++ b/packages/rs-drive/src/prove/mod.rs @@ -0,0 +1,2 @@ +mod prove_elements; +mod prove_multiple_state_transition_results; diff --git a/packages/rs-drive/src/prove/prove_elements/mod.rs b/packages/rs-drive/src/prove/prove_elements/mod.rs new file mode 100644 index 00000000000..61897db0f3f --- /dev/null +++ b/packages/rs-drive/src/prove/prove_elements/mod.rs @@ -0,0 +1,41 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// This function calls the versioned `prove_elements` + /// function based on the version provided in the `PlatformVersion` parameter. It panics if the + /// version doesn't match any existing versioned functions. + /// + /// # Parameters + /// - `path`: The path at which we want to prove the elements + /// - `keys`: The keys that we want to prove + /// - `transaction`: An optional grovedb transaction + /// - `platform_version`: A reference to the [PlatformVersion] object that specifies the version of + /// the function to call. + /// + /// # Returns + /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, + /// or an `Error` if the function fails. + pub fn prove_elements( + &self, + path: Vec>, + keys: Vec>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version.drive.methods.prove.prove_elements { + 0 => self.prove_elements_v0(path, keys, transaction, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "prove_elements".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/prove/prove_elements/v0/mod.rs b/packages/rs-drive/src/prove/prove_elements/v0/mod.rs new file mode 100644 index 00000000000..f10bdbaa3a0 --- /dev/null +++ b/packages/rs-drive/src/prove/prove_elements/v0/mod.rs @@ -0,0 +1,45 @@ +use crate::drive::Drive; +use crate::error::Error; + +use dpp::version::PlatformVersion; +use grovedb::{PathQuery, Query, SizedQuery, TransactionArg}; + +impl Drive { + /// This function query requested identities, documents and contracts and provide cryptographic proofs + /// + /// # Parameters + /// - `path`: The path at which we want to prove the elements + /// - `keys`: The keys that we want to prove + /// - `transaction`: An optional grovedb transaction + /// - `platform_version`: A reference to the [PlatformVersion] object that specifies the version of + /// the function to call. + /// + /// # Returns + /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, + /// or an `Error` if the function fails. + #[inline(always)] + pub(crate) fn prove_elements_v0( + &self, + path: Vec>, + keys: Vec>, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut query = Query::default(); + query.insert_keys(keys); + let path_query = PathQuery { + path, + query: SizedQuery { + query, + limit: None, + offset: None, + }, + }; + self.grove_get_proved_path_query( + &path_query, + transaction, + &mut vec![], + &platform_version.drive, + ) + } +} diff --git a/packages/rs-drive/src/prove/prove_multiple_state_transition_results/mod.rs b/packages/rs-drive/src/prove/prove_multiple_state_transition_results/mod.rs new file mode 100644 index 00000000000..309cecc47ea --- /dev/null +++ b/packages/rs-drive/src/prove/prove_multiple_state_transition_results/mod.rs @@ -0,0 +1,61 @@ +use crate::drive::identity::IdentityDriveQuery; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::query::{IdentityBasedVoteDriveQuery, SingleDocumentDriveQuery}; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +mod v0; + +impl Drive { + /// This function calls the versioned `prove_multiple_state_transition_results` + /// function based on the version provided in the `DriveVersion` parameter. It panics if the + /// version doesn't match any existing versioned functions. + /// + /// # Parameters + /// - `identity_queries`: A list of [IdentityDriveQuery]. These specify the identities + /// to be proven. + /// - `contract_ids`: A list of Data Contract IDs to prove with an associated bool to represent + /// if the contract is historical. + /// - `document_queries`: A list of [SingleDocumentDriveQuery]. These specify the documents + /// to be proven. + /// - `transaction`: An optional grovedb transaction + /// - `drive_version`: A reference to the [DriveVersion] object that specifies the version of + /// the function to call. + /// + /// # Returns + /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, + /// or an `Error` if the function fails. + pub fn prove_multiple_state_transition_results( + &self, + identity_queries: &[IdentityDriveQuery], + contract_ids: &[([u8; 32], Option)], //bool represents if it is historical + document_queries: &[SingleDocumentDriveQuery], + vote_queries: &[IdentityBasedVoteDriveQuery], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .prove + .prove_multiple_state_transition_results + { + 0 => self.prove_multiple_state_transition_results_v0( + identity_queries, + contract_ids, + document_queries, + vote_queries, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "prove_multiple_state_transition_results".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/prove/prove_multiple_state_transition_results/v0/mod.rs b/packages/rs-drive/src/prove/prove_multiple_state_transition_results/v0/mod.rs new file mode 100644 index 00000000000..a348c2d1400 --- /dev/null +++ b/packages/rs-drive/src/prove/prove_multiple_state_transition_results/v0/mod.rs @@ -0,0 +1,124 @@ +use crate::drive::identity::{IdentityDriveQuery, IdentityProveRequestType}; +use crate::drive::Drive; +use crate::error::Error; +use crate::query::{IdentityBasedVoteDriveQuery, SingleDocumentDriveQuery}; + +use dpp::version::PlatformVersion; +use grovedb::{PathQuery, TransactionArg}; +use itertools::{Either, Itertools}; + +impl Drive { + /// This function query requested identities, documents and contracts and provide cryptographic proofs + /// + /// # Parameters + /// - `identity_queries`: A list of [IdentityDriveQuery]. These specify the identities + /// to be proven. + /// - `contract_ids`: A list of Data Contract IDs to prove + /// - `document_queries`: A list of [SingleDocumentDriveQuery]. These specify the documents + /// to be proven. + /// - `vote_queries`: A list of [IdentityBasedVoteDriveQuery]. These would be to figure out the + /// result of votes based on identities making them. + /// - `transaction`: An optional grovedb transaction + /// - `platform_version`: A reference to the [PlatformVersion] object that specifies the version of + /// the function to call. + /// + /// # Returns + /// Returns a `Result` with a `Vec` containing the proof data if the function succeeds, + /// or an `Error` if the function fails. + #[inline(always)] + pub(crate) fn prove_multiple_state_transition_results_v0( + &self, + identity_queries: &[IdentityDriveQuery], + contract_ids: &[([u8; 32], Option)], //bool is history + document_queries: &[SingleDocumentDriveQuery], + vote_queries: &[IdentityBasedVoteDriveQuery], + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut path_queries = vec![]; + if !identity_queries.is_empty() { + for identity_query in identity_queries { + match identity_query.prove_request_type { + IdentityProveRequestType::FullIdentity => { + path_queries.push(Self::full_identity_query( + &identity_query.identity_id, + &platform_version.drive.grove_version, + )?); + } + IdentityProveRequestType::Balance => { + path_queries.push(Self::balance_for_identity_id_query( + identity_query.identity_id, + )); + } + IdentityProveRequestType::Keys => { + path_queries.push(Self::identity_all_keys_query( + &identity_query.identity_id, + &platform_version.drive.grove_version, + )?); + } + IdentityProveRequestType::Revision => { + path_queries + .push(Self::identity_revision_query(&identity_query.identity_id)); + } + } + } + } + + let (contract_ids, historical_contract_ids): (Vec<_>, Vec<_>) = contract_ids + .iter() + .partition_map(|(contract_id, historical)| { + // TODO: implement None + let history = historical.unwrap_or(false); + if !history { + Either::Left(*contract_id) + } else { + Either::Right(*contract_id) + } + }); + + if !contract_ids.is_empty() { + let mut path_query = + Self::fetch_non_historical_contracts_query(contract_ids.as_slice()); + path_query.query.limit = None; + path_queries.push(path_query); + } + + if !historical_contract_ids.is_empty() { + let mut path_query = + Self::fetch_historical_contracts_query(historical_contract_ids.as_slice()); + path_query.query.limit = None; + path_queries.push(path_query); + } + if !document_queries.is_empty() { + path_queries.extend(document_queries.iter().filter_map(|drive_query| { + // The path query construction can only fail in extremely rare circumstances. + let mut path_query = drive_query.construct_path_query(platform_version).ok()?; + path_query.query.limit = None; + Some(path_query) + })); + } + + if !vote_queries.is_empty() { + path_queries.extend(vote_queries.iter().filter_map(|vote_query| { + // The path query construction can only fail if the serialization fails. + // Because the serialization will pretty much never fail, we can do this. + let mut path_query = vote_query.construct_path_query().ok()?; + path_query.query.limit = None; + Some(path_query) + })); + } + + let path_query = PathQuery::merge( + path_queries.iter().collect(), + &platform_version.drive.grove_version, + ) + .map_err(Error::GroveDB)?; + + self.grove_get_proved_path_query( + &path_query, + transaction, + &mut vec![], + &platform_version.drive, + ) + } +} diff --git a/packages/rs-drive/src/query/conditions.rs b/packages/rs-drive/src/query/conditions.rs index 83519815b2e..2f565968dbf 100644 --- a/packages/rs-drive/src/query/conditions.rs +++ b/packages/rs-drive/src/query/conditions.rs @@ -1,35 +1,7 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Query Conditions //! +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use grovedb::Query; use sqlparser::ast; use std::borrow::Cow; @@ -43,7 +15,7 @@ use WhereOperator::{ use crate::error::query::QuerySyntaxError; use crate::error::Error; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; -use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::document_type::{DocumentPropertyType, DocumentType, DocumentTypeRef}; use dpp::document::document_methods::DocumentMethodsV0; use dpp::document::Document; use dpp::platform_value::Value; @@ -74,7 +46,8 @@ fn sql_value_to_platform_value(sql_value: ast::Value) -> Option { } /// Where operator arguments -#[derive(Copy, Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum WhereOperator { /// Equal Equal, @@ -195,7 +168,6 @@ impl WhereOperator { ast::BinaryOperator::GtEq => Some(WhereOperator::GreaterThanOrEquals), ast::BinaryOperator::Lt => Some(WhereOperator::LessThan), ast::BinaryOperator::LtEq => Some(WhereOperator::LessThanOrEquals), - ast::BinaryOperator::Like => Some(WhereOperator::StartsWith), _ => None, } } @@ -228,7 +200,8 @@ impl From for Value { } /// Where clause struct -#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct WhereClause { /// Field pub field: String, @@ -252,27 +225,27 @@ impl<'a> WhereClause { bytes.iter().map(|int| Value::U8(*int)).collect(), )), _ => Err(Error::Query(QuerySyntaxError::InvalidInClause( - "when using in operator you must provide an array of values", + "when using in operator you must provide an array of values".to_string(), ))), }?; let len = in_values.len(); if len == 0 { return Err(Error::Query(QuerySyntaxError::InvalidInClause( - "in clause must at least 1 value", + "in clause must have at least 1 value".to_string(), ))); } if len > 100 { return Err(Error::Query(QuerySyntaxError::InvalidInClause( - "in clause must at most 100 values", + "in clause must have at most 100 values".to_string(), ))); } // Throw an error if there are duplicates if (1..in_values.len()).any(|i| in_values[i..].contains(&in_values[i - 1])) { return Err(Error::Query(QuerySyntaxError::InvalidInClause( - "there should be no duplicates values for In query", + "there should be no duplicates values for In query".to_string(), ))); } Ok(in_values) @@ -389,7 +362,7 @@ impl<'a> WhereClause { } let field_value = clause_components - .get(0) + .first() .expect("check above enforces it exists"); let field_ref = field_value.as_text().ok_or(Error::Query( QuerySyntaxError::InvalidWhereClauseComponents( @@ -438,7 +411,7 @@ impl<'a> WhereClause { .collect::>(); match lower_range_clauses.len() { 0 => Ok(None), - 1 => Ok(Some(lower_range_clauses.get(0).unwrap())), + 1 => Ok(Some(lower_range_clauses.first().unwrap())), _ => Err(Error::Query(QuerySyntaxError::MultipleRangeClauses( "there can only at most one range clause with a lower bound", ))), @@ -452,7 +425,7 @@ impl<'a> WhereClause { .collect::>(); match upper_range_clauses.len() { 0 => Ok(None), - 1 => Ok(Some(upper_range_clauses.get(0).unwrap())), + 1 => Ok(Some(upper_range_clauses.first().unwrap())), _ => Err(Error::Query(QuerySyntaxError::MultipleRangeClauses( "there can only at most one range clause with a lower bound", ))), @@ -507,7 +480,7 @@ impl<'a> WhereClause { let in_clause = match in_clauses_array.len() { 0 => Ok(None), 1 => { - let clause = in_clauses_array.get(0).expect("there must be a value"); + let clause = in_clauses_array.first().expect("there must be a value"); if known_fields.contains(&clause.field) { Err(Error::Query( QuerySyntaxError::DuplicateNonGroupableClauseSameField( @@ -637,7 +610,7 @@ impl<'a> WhereClause { } } } else if non_groupable_range_clauses.len() == 1 && groupable_range_clauses.is_empty() { - let where_clause = *non_groupable_range_clauses.get(0).unwrap(); + let where_clause = *non_groupable_range_clauses.first().unwrap(); if where_clause.operator == StartsWith { // Starts with must null be against an empty string if let Value::Text(text) = &where_clause.value { @@ -689,7 +662,7 @@ impl<'a> WhereClause { } let left_key = document_type.serialize_value_for_key( self.field.as_str(), - in_values.get(0).unwrap(), + in_values.first().unwrap(), platform_version, )?; let right_key = document_type.serialize_value_for_key( @@ -1075,9 +1048,9 @@ impl<'a> WhereClause { Ok(query) } - /// Build where clauses from operations pub(crate) fn build_where_clauses_from_operations( binary_operation: &ast::Expr, + document_type: &DocumentType, where_clauses: &mut Vec, ) -> Result<(), Error> { match &binary_operation { @@ -1092,26 +1065,51 @@ impl<'a> WhereClause { ))); } - let field_name = if let ast::Expr::Identifier(ident) = &**expr { + let field_name: String = if let ast::Expr::Identifier(ident) = &**expr { ident.value.clone() } else { return Err(Error::Query(QuerySyntaxError::InvalidInClause( - "Invalid query: in clause should start with an identifier", + "Invalid query: in clause should start with an identifier".to_string(), ))); }; + let property_type = match field_name.as_str() { + "$id" | "$ownerId" => Cow::Owned(DocumentPropertyType::Identifier), + "$createdAt" | "$updatedAt" => Cow::Owned(DocumentPropertyType::Date), + "$revision" => Cow::Owned(DocumentPropertyType::U64), + _ => { + let property = document_type + .flattened_properties() + .get(&field_name) + .ok_or_else(|| { + Error::Query(QuerySyntaxError::InvalidSQL(format!( + "Invalid query: property named {} not in document type", + field_name + ))) + })?; + Cow::Borrowed(&property.property_type) + } + }; + let mut in_values: Vec = Vec::new(); for value in list { if let ast::Expr::Value(sql_value) = value { - let cbor_val = sql_value_to_platform_value(sql_value.clone()).ok_or({ - Error::Query(QuerySyntaxError::InvalidSQL( - "Invalid query: unexpected value type", - )) - })?; - in_values.push(cbor_val); + let platform_value = + sql_value_to_platform_value(sql_value.clone()).ok_or({ + Error::Query(QuerySyntaxError::InvalidSQL( + "Invalid query: unexpected value type".to_string(), + )) + })?; + let transformed_value = if let Value::Text(text_value) = &platform_value { + property_type.value_from_string(text_value)? + } else { + platform_value + }; + + in_values.push(transformed_value); } else { return Err(Error::Query(QuerySyntaxError::InvalidSQL( - "Invalid query: expected a list of sql values", + "Invalid query: expected a list of sql values".to_string(), ))); } } @@ -1124,10 +1122,62 @@ impl<'a> WhereClause { Ok(()) } + ast::Expr::Like { + negated, + expr, + pattern, + escape_char: _, + } => { + let where_operator = WhereOperator::StartsWith; + if *negated { + return Err(Error::Query(QuerySyntaxError::Unsupported( + "Negated Like not supported".to_string(), + ))); + } + + let field_name: String = if let ast::Expr::Identifier(ident) = &**expr { + ident.value.clone() + } else { + panic!("unreachable: confirmed it's identifier variant"); + }; + + let transformed_value = if let ast::Expr::Value(value) = &**pattern { + let platform_value = sql_value_to_platform_value(value.clone()).ok_or({ + Error::Query(QuerySyntaxError::InvalidSQL( + "Invalid query: unexpected value type".to_string(), + )) + })?; + + // make sure the value is of the right format i.e prefix% + let inner_text = platform_value.as_text().ok_or({ + Error::Query(QuerySyntaxError::InvalidStartsWithClause( + "Invalid query: startsWith takes text", + )) + })?; + let match_locations: Vec<_> = inner_text.match_indices('%').collect(); + if match_locations.len() == 1 && match_locations[0].0 == inner_text.len() - 1 { + Value::Text(String::from(&inner_text[..(inner_text.len() - 1)])) + } else { + return Err(Error::Query(QuerySyntaxError::Unsupported( + "Invalid query: like can only be used to represent startswith" + .to_string(), + ))); + } + } else { + panic!("unreachable: confirmed it's value variant"); + }; + + where_clauses.push(WhereClause { + field: field_name, + operator: where_operator, + value: transformed_value, + }); + Ok(()) + } ast::Expr::BinaryOp { left, op, right } => { if *op == ast::BinaryOperator::And { - Self::build_where_clauses_from_operations(left, where_clauses)?; - Self::build_where_clauses_from_operations(right, where_clauses)?; + Self::build_where_clauses_from_operations(left, document_type, where_clauses)?; + Self::build_where_clauses_from_operations(right, document_type, where_clauses)?; } else { let mut where_operator = WhereOperator::from_sql_operator(op.clone()).ok_or(Error::Query( @@ -1150,42 +1200,46 @@ impl<'a> WhereClause { where_operator = where_operator.flip()?; } else { return Err(Error::Query(QuerySyntaxError::InvalidSQL( - "Invalid query: where clause should have field name and value", + "Invalid query: where clause should have field name and value" + .to_string(), ))); } - let field_name = if let ast::Expr::Identifier(ident) = identifier { + let field_name: String = if let ast::Expr::Identifier(ident) = identifier { ident.value.clone() } else { panic!("unreachable: confirmed it's identifier variant"); }; - let value = if let ast::Expr::Value(value) = value_expr { - let cbor_val = sql_value_to_platform_value(value.clone()).ok_or({ + let property_type = match field_name.as_str() { + "$id" | "$ownerId" => Cow::Owned(DocumentPropertyType::Identifier), + "$createdAt" | "$updatedAt" => Cow::Owned(DocumentPropertyType::Date), + "$revision" => Cow::Owned(DocumentPropertyType::U64), + _ => { + let property = document_type + .flattened_properties() + .get(&field_name) + .ok_or_else(|| { + Error::Query(QuerySyntaxError::InvalidSQL(format!( + "Invalid query: property named {} not in document type", + field_name + ))) + })?; + Cow::Borrowed(&property.property_type) + } + }; + + let transformed_value = if let ast::Expr::Value(value) = value_expr { + let platform_value = sql_value_to_platform_value(value.clone()).ok_or({ Error::Query(QuerySyntaxError::InvalidSQL( - "Invalid query: unexpected value type", + "Invalid query: unexpected value type".to_string(), )) })?; - if where_operator == StartsWith { - // make sure the value is of the right format i.e prefix% - let inner_text = cbor_val.as_text().ok_or({ - Error::Query(QuerySyntaxError::InvalidStartsWithClause( - "Invalid query: startsWith takes text", - )) - })?; - let match_locations: Vec<_> = inner_text.match_indices('%').collect(); - if match_locations.len() == 1 - && match_locations[0].0 == inner_text.len() - 1 - { - Value::Text(String::from(&inner_text[..(inner_text.len() - 1)])) - } else { - return Err(Error::Query(QuerySyntaxError::Unsupported( - "Invalid query: like can only be used to represent startswith" - .to_string(), - ))); - } + + if let Value::Text(text_value) = &platform_value { + property_type.value_from_string(text_value)? } else { - cbor_val + platform_value } } else { panic!("unreachable: confirmed it's value variant"); @@ -1194,25 +1248,25 @@ impl<'a> WhereClause { where_clauses.push(WhereClause { field: field_name, operator: where_operator, - value, + value: transformed_value, }); } Ok(()) } _ => Err(Error::Query(QuerySyntaxError::InvalidSQL( - "Issue parsing sql: invalid selection format", + "Issue parsing sql: invalid selection format".to_string(), ))), } } } -impl<'a> From for Value { +impl From for Value { fn from(value: WhereClause) -> Self { Value::Array(vec![value.field.into(), value.operator.into(), value.value]) } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use crate::query::conditions::WhereClause; @@ -1232,7 +1286,7 @@ mod tests { let where_clauses = vec![ WhereClause { field: "a".to_string(), - operator: *query_pair.get(0).unwrap(), + operator: *query_pair.first().unwrap(), value: Value::Float(0.0), }, WhereClause { @@ -1258,7 +1312,7 @@ mod tests { let where_clauses = vec![ WhereClause { field: "a".to_string(), - operator: *query_pair.get(0).unwrap(), + operator: *query_pair.first().unwrap(), value: Value::Float(1.0), }, WhereClause { @@ -1280,7 +1334,7 @@ mod tests { let where_clauses = vec![ WhereClause { field: "a".to_string(), - operator: *query_pair.get(0).unwrap(), + operator: *query_pair.first().unwrap(), value: Value::Float(1.0), }, WhereClause { @@ -1331,7 +1385,7 @@ mod tests { let where_clauses = vec![ WhereClause { field: "a".to_string(), - operator: *query_pair.get(0).unwrap(), + operator: *query_pair.first().unwrap(), value: Value::Float(0.0), }, WhereClause { diff --git a/packages/rs-drive/src/query/contested_resource_votes_given_by_identity_query.rs b/packages/rs-drive/src/query/contested_resource_votes_given_by_identity_query.rs new file mode 100644 index 00000000000..b5b6938358d --- /dev/null +++ b/packages/rs-drive/src/query/contested_resource_votes_given_by_identity_query.rs @@ -0,0 +1,260 @@ +use crate::drive::votes::paths::vote_contested_resource_identity_votes_tree_path_for_identity_vec; +use crate::drive::votes::storage_form::contested_document_resource_reference_storage_form::ContestedDocumentResourceVoteReferenceStorageForm; +use crate::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; +use crate::drive::votes::tree_path_storage_form::TreePathStorageForm; +#[cfg(feature = "server")] +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +#[cfg(feature = "server")] +use crate::fees::op::LowLevelDriveOperation; +#[cfg(feature = "server")] +use crate::query::GroveError; +use crate::query::Query; +use dpp::bincode; +#[cfg(feature = "server")] +use dpp::block::block_info::BlockInfo; +use dpp::identifier::Identifier; +#[cfg(feature = "server")] +use grovedb::query_result_type::{QueryResultElements, QueryResultType}; +#[cfg(feature = "server")] +use grovedb::TransactionArg; +use grovedb::{PathQuery, SizedQuery}; +use platform_version::version::PlatformVersion; +#[cfg(feature = "server")] +use std::collections::BTreeMap; + +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct ContestedResourceVotesGivenByIdentityQuery { + /// Which contestant do we want to get the votes for + pub identity_id: Identifier, + /// Offset + pub offset: Option, + /// Limit + pub limit: Option, + /// Start at vote id + pub start_at: Option<([u8; 32], bool)>, + /// Ascending + pub order_ascending: bool, +} + +impl ContestedResourceVotesGivenByIdentityQuery { + #[cfg(feature = "server")] + /// Executes a query with proof and returns the items and fee. + pub fn execute_with_proof( + self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Vec, u64), Error> { + let mut drive_operations = vec![]; + let items = self.execute_with_proof_internal( + drive, + transaction, + &mut drive_operations, + platform_version, + )?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((items, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with proof and returns the items. + pub(crate) fn execute_with_proof_internal( + self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let path_query = self.construct_path_query()?; + drive.grove_get_proved_path_query( + &path_query, + transaction, + drive_operations, + &platform_version.drive, + ) + } + + #[cfg(feature = "server")] + /// Executes a query with no proof and returns the items, skipped items, and fee. + pub fn execute_no_proof_with_cost( + &self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result< + ( + BTreeMap, + u64, + ), + Error, + > { + let mut drive_operations = vec![]; + let result = + self.execute_no_proof(drive, transaction, &mut drive_operations, platform_version)?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((result, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with no proof and returns the values and skipped items. + pub fn execute_no_proof( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let path_query = self.construct_path_query()?; + let query_result = drive.grove_get_raw_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => Ok(BTreeMap::new()), + Err(e) => Err(e), + Ok((query_result_elements, _)) => { + let voters = + query_result_elements + .to_path_key_elements() + .into_iter() + .map(|(path, key, element)| { + let serialized_reference = element.into_item_bytes()?; + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let reference: ContestedDocumentResourceVoteReferenceStorageForm = + bincode::decode_from_slice(&serialized_reference, bincode_config) + .map_err(|e| { + Error::Drive(DriveError::CorruptedSerialization(format!( + "serialization of reference {} is corrupted: {}", + hex::encode(serialized_reference), + e + ))) + })? + .0; + let absolute_path = reference + .reference_path_type + .absolute_path(path.as_slice(), Some(key.as_slice()))?; + let vote_id = Identifier::from_vec(key)?; + Ok(( + vote_id, + ContestedDocumentResourceVoteStorageForm::try_from_tree_path( + absolute_path, + )?, + )) + }) + .collect::, + Error, + >>()?; + + Ok(voters) + } + } + } + + #[cfg(feature = "server")] + #[allow(unused)] + /// Executes an internal query with no proof and returns the values and skipped items. + pub(crate) fn execute_no_proof_internal( + &self, + drive: &Drive, + result_type: QueryResultType, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(QueryResultElements, u16), Error> { + let path_query = self.construct_path_query()?; + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + result_type, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => { + Ok((QueryResultElements::new(), 0)) + } + _ => { + let (data, skipped) = query_result?; + { + Ok((data, skipped)) + } + } + } + } + /// Operations to construct a path query. + pub fn construct_path_query(&self) -> Result { + let path = vote_contested_resource_identity_votes_tree_path_for_identity_vec( + self.identity_id.as_bytes(), + ); + + let mut query = Query::new_with_direction(self.order_ascending); + + // this is a range on all elements + match &self.start_at { + None => { + query.insert_all(); + } + Some((starts_at_key_bytes, start_at_included)) => { + let starts_at_key = starts_at_key_bytes.to_vec(); + match self.order_ascending { + true => match start_at_included { + true => query.insert_range_from(starts_at_key..), + false => query.insert_range_after(starts_at_key..), + }, + false => match start_at_included { + true => query.insert_range_to_inclusive(..=starts_at_key), + false => query.insert_range_to(..starts_at_key), + }, + } + } + } + + Ok(PathQuery { + path, + query: SizedQuery { + query, + limit: self.limit, + offset: self.offset, + }, + }) + } +} diff --git a/packages/rs-drive/src/query/mod.rs b/packages/rs-drive/src/query/mod.rs index decb50aad87..574113ac46c 100644 --- a/packages/rs-drive/src/query/mod.rs +++ b/packages/rs-drive/src/query/mod.rs @@ -1,137 +1,139 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -#[cfg(any(feature = "full", feature = "verify"))] -use std::collections::BTreeMap; -#[cfg(any(feature = "full", feature = "verify"))] -use std::ops::BitXor; - -#[cfg(feature = "full")] -use grovedb::query_result_type::{QueryResultElements, QueryResultType}; -/// Import grovedb -#[cfg(feature = "full")] -pub use grovedb::{Element, Error as GroveError, GroveDb, TransactionArg}; -#[cfg(any(feature = "full", feature = "verify"))] -pub use grovedb::{PathQuery, Query, QueryItem, SizedQuery}; - -#[cfg(any(feature = "full", feature = "verify"))] -use indexmap::IndexMap; - -#[cfg(any(feature = "full", feature = "verify"))] -use sqlparser::ast; -#[cfg(any(feature = "full", feature = "verify"))] -use sqlparser::ast::TableFactor::Table; -#[cfg(any(feature = "full", feature = "verify"))] -use sqlparser::ast::Value::Number; -#[cfg(any(feature = "full", feature = "verify"))] -use sqlparser::ast::{OrderByExpr, Select, Statement}; -#[cfg(any(feature = "full", feature = "verify"))] -use sqlparser::dialect::GenericDialect; -#[cfg(any(feature = "full", feature = "verify"))] -use sqlparser::parser::Parser; - -#[cfg(any(feature = "full", feature = "verify"))] -pub use conditions::WhereClause; -/// Import conditions -#[cfg(any(feature = "full", feature = "verify"))] -pub use conditions::WhereOperator; -#[cfg(feature = "full")] -use dpp::block::block_info::BlockInfo; -use dpp::data_contract::accessors::v0::DataContractV0Getters; - -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::data_contract::document_type::DocumentTypeRef; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::data_contract::document_type::{Index, IndexProperty}; -#[cfg(any(feature = "full", feature = "verify"))] - -/// Import ordering -#[cfg(any(feature = "full", feature = "verify"))] -pub use ordering::OrderClause; - -#[cfg(feature = "full")] -#[cfg(feature = "full")] -use crate::drive::grove_operations::QueryType::StatefulQuery; -#[cfg(feature = "full")] -use crate::drive::Drive; -#[cfg(any(feature = "full", feature = "verify"))] -use crate::error::drive::DriveError; -#[cfg(any(feature = "full", feature = "verify"))] -use crate::error::query::QuerySyntaxError; -#[cfg(any(feature = "full", feature = "verify"))] -use crate::error::Error; -#[cfg(feature = "full")] -use crate::fee::op::LowLevelDriveOperation; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::data_contract::DataContract; - -#[cfg(any(feature = "full", feature = "verify"))] -use crate::drive::contract::paths::DataContractPaths; - -use dpp::document::document_methods::DocumentMethodsV0; -use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::document::Document; - -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; -use dpp::platform_value::platform_value; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::platform_value::Value; - -use crate::common::encode::encode_u64; -use crate::drive::config::DriveConfig; -use crate::error::Error::GroveDB; - -use dpp::version::PlatformVersion; -#[cfg(any(feature = "full", feature = "verify"))] -use dpp::ProtocolError; - -#[cfg(any(feature = "full", feature = "verify"))] +use std::sync::Arc; + +#[cfg(any(feature = "server", feature = "verify"))] +pub use { + conditions::{WhereClause, WhereOperator}, + grovedb::{PathQuery, Query, QueryItem, SizedQuery}, + ordering::OrderClause, + single_document_drive_query::SingleDocumentDriveQuery, + single_document_drive_query::SingleDocumentDriveQueryContestedStatus, + vote_polls_by_end_date_query::VotePollsByEndDateDriveQuery, + vote_query::IdentityBasedVoteDriveQuery, +}; +// Imports available when either "server" or "verify" features are enabled +#[cfg(any(feature = "server", feature = "verify"))] +use { + crate::{ + drive::contract::paths::DataContractPaths, + error::{drive::DriveError, query::QuerySyntaxError, Error}, + }, + dpp::{ + data_contract::{ + accessors::v0::DataContractV0Getters, + document_type::{accessors::DocumentTypeV0Getters, methods::DocumentTypeV0Methods}, + document_type::{DocumentTypeRef, Index, IndexProperty}, + DataContract, + }, + document::{ + document_methods::DocumentMethodsV0, + serialization_traits::DocumentPlatformConversionMethodsV0, Document, DocumentV0Getters, + }, + platform_value::{btreemap_extensions::BTreeValueRemoveFromMapHelper, Value}, + version::PlatformVersion, + ProtocolError, + }, + indexmap::IndexMap, + sqlparser::{ + ast::{self, OrderByExpr, Select, Statement, TableFactor::Table, Value::Number}, + dialect::MySqlDialect, + parser::Parser, + }, + std::{collections::BTreeMap, ops::BitXor}, +}; + +#[cfg(feature = "verify")] +use crate::verify::RootHash; + +#[cfg(feature = "server")] +pub use grovedb::{ + query_result_type::{QueryResultElements, QueryResultType}, + Element, Error as GroveError, TransactionArg, +}; + +#[cfg(feature = "server")] +use { + crate::{drive::Drive, error::Error::GroveDB, fees::op::LowLevelDriveOperation}, + dpp::block::block_info::BlockInfo, +}; + +// Crate-local unconditional imports +use crate::config::DriveConfig; +// Crate-local unconditional imports +use crate::util::common::encode::encode_u64; +#[cfg(feature = "server")] +use crate::util::grove_operations::QueryType::StatefulQuery; + +// Module declarations that are conditional on either "server" or "verify" features +#[cfg(any(feature = "server", feature = "verify"))] pub mod conditions; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] mod defaults; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub mod ordering; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] mod single_document_drive_query; -#[cfg(feature = "full")] + +// Module declarations exclusively for "server" feature +#[cfg(feature = "server")] mod test_index; -#[cfg(any(feature = "full", feature = "verify"))] -pub use single_document_drive_query::SingleDocumentDriveQuery; +#[cfg(any(feature = "server", feature = "verify"))] +/// Vote poll vote state query module +pub mod vote_poll_vote_state_query; +#[cfg(any(feature = "server", feature = "verify"))] +/// Vote Query module +pub mod vote_query; + +#[cfg(any(feature = "server", feature = "verify"))] +/// Vote poll contestant votes query module +pub mod vote_poll_contestant_votes_query; + +#[cfg(any(feature = "server", feature = "verify"))] +/// Vote polls by end date query +pub mod vote_polls_by_end_date_query; + +#[cfg(any(feature = "server", feature = "verify"))] +/// Vote polls by document type query +pub mod vote_polls_by_document_type_query; + +/// Function type for looking up a contract by identifier +/// +/// This function is used to look up a contract by its identifier. +/// It should be implemented by the caller in order to provide data +/// contract required for operations like proof verification. +#[cfg(any(feature = "server", feature = "verify"))] +pub type ContractLookupFn<'a> = dyn Fn(&dpp::identifier::Identifier) -> Result>, crate::error::Error> + + 'a; + +/// Creates a [ContractLookupFn] function that returns provided data contract when requested. +/// +/// # Arguments +/// +/// * `data_contract` - [Arc](DataContract) to return +/// +/// # Returns +/// +/// [ContractLookupFn] that will return the `data_contract`, or `None` if +/// the requested contract is not the same as the provided one. +#[cfg(any(feature = "server", feature = "verify"))] +pub fn contract_lookup_fn_for_contract<'a>( + data_contract: Arc, +) -> Box> { + let func = move + |id: &dpp::identifier::Identifier| -> Result>, crate::error::Error> { + if data_contract.id().ne(id) { + return Ok(None); + } + Ok(Some(Arc::clone(&data_contract))) + }; + Box::new(func) +} -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; -use dpp::document::DocumentV0Getters; +#[cfg(any(feature = "server", feature = "verify"))] +/// A query to get the votes given out by an identity +pub mod contested_resource_votes_given_by_identity_query; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// Internal clauses struct #[derive(Clone, Debug, PartialEq, Default)] pub struct InternalClauses { @@ -148,7 +150,7 @@ pub struct InternalClauses { } impl InternalClauses { - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns true if the clause is a valid format. pub fn verify(&self) -> bool { // There can only be 1 primary key clause, or many other clauses @@ -166,13 +168,13 @@ impl InternalClauses { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns true if the query clause is for primary keys. pub fn is_for_primary_key(&self) -> bool { self.primary_key_in_clause.is_some() || self.primary_key_equal_clause.is_some() } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns true if self is empty. pub fn is_empty(&self) -> bool { self.in_clause.is_none() @@ -182,7 +184,7 @@ impl InternalClauses { && self.primary_key_equal_clause.is_none() } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Extracts the `WhereClause`s and returns them as type `InternalClauses`. pub fn extract_from_clauses(all_where_clauses: Vec) -> Result { let primary_key_equal_clauses_array = all_where_clauses @@ -214,7 +216,7 @@ impl InternalClauses { 0 => Ok(None), 1 => Ok(Some( primary_key_equal_clauses_array - .get(0) + .first() .expect("there must be a value") .clone(), )), @@ -229,7 +231,7 @@ impl InternalClauses { 0 => Ok(None), 1 => Ok(Some( primary_key_in_clauses_array - .get(0) + .first() .expect("there must be a value") .clone(), )), @@ -278,36 +280,10 @@ impl From for Vec { } } -#[cfg(any(feature = "full", feature = "verify"))] -/// The encoding returned by queries -#[derive(Debug, PartialEq)] -pub enum QueryResultEncoding { - /// Cbor encoding - CborEncodedQueryResult, - /// Platform base encoding - PlatformEncodedQueryResult, -} - -#[cfg(any(feature = "full", feature = "verify"))] -impl QueryResultEncoding { - /// Encode the value based on the encoding desired - pub fn encode_value(&self, value: &Value) -> Result, Error> { - let mut buffer = vec![]; - match self { - QueryResultEncoding::CborEncodedQueryResult => { - ciborium::ser::into_writer(value, &mut buffer) - .map_err(|e| ProtocolError::EncodingError(e.to_string()))?; - } - QueryResultEncoding::PlatformEncodedQueryResult => {} - } - Ok(buffer) - } -} - -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] /// Drive query struct #[derive(Debug, PartialEq, Clone)] -pub struct DriveQuery<'a> { +pub struct DriveDocumentQuery<'a> { ///DataContract pub contract: &'a DataContract, /// Document type @@ -320,7 +296,7 @@ pub struct DriveQuery<'a> { pub limit: Option, /// Order by pub order_by: IndexMap, - /// Start at + /// Start at document id pub start_at: Option<[u8; 32]>, /// Start at included pub start_at_included: bool, @@ -328,13 +304,11 @@ pub struct DriveQuery<'a> { pub block_time_ms: Option, } -// TODO: expose this also -// also figure out main export -impl<'a> DriveQuery<'a> { - #[cfg(feature = "full")] +impl<'a> DriveDocumentQuery<'a> { + #[cfg(feature = "server")] /// Returns any item pub fn any_item_query(contract: &'a DataContract, document_type: DocumentTypeRef<'a>) -> Self { - DriveQuery { + DriveDocumentQuery { contract, document_type, internal_clauses: Default::default(), @@ -347,7 +321,27 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(feature = "server")] + /// Returns all items + pub fn all_items_query( + contract: &'a DataContract, + document_type: DocumentTypeRef<'a>, + limit: Option, + ) -> Self { + DriveDocumentQuery { + contract, + document_type, + internal_clauses: Default::default(), + offset: None, + limit, + order_by: Default::default(), + start_at: None, + start_at_included: true, + block_time_ms: None, + } + } + + #[cfg(any(feature = "server", feature = "verify"))] /// Returns true if the query clause if for primary keys. pub fn is_for_primary_key(&self) -> bool { self.internal_clauses.is_for_primary_key() @@ -364,7 +358,7 @@ impl<'a> DriveQuery<'a> { == "$id"))) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(feature = "cbor_query")] /// Converts a query CBOR to a `DriveQuery`. pub fn from_cbor( query_cbor: &[u8], @@ -380,7 +374,7 @@ impl<'a> DriveQuery<'a> { Self::from_value(query_document_value, contract, document_type, config) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Converts a query Value to a `DriveQuery`. pub fn from_value( query_value: Value, @@ -392,7 +386,7 @@ impl<'a> DriveQuery<'a> { Self::from_btree_map_value(query_document, contract, document_type, config) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Converts a query Value to a `DriveQuery`. pub fn from_btree_map_value( mut query_document: BTreeMap, @@ -544,7 +538,7 @@ impl<'a> DriveQuery<'a> { )))); } - Ok(DriveQuery { + Ok(DriveDocumentQuery { contract, document_type, internal_clauses, @@ -557,7 +551,7 @@ impl<'a> DriveQuery<'a> { }) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Converts a query Value to a `DriveQuery`. pub fn from_decomposed_values( where_clause: Value, @@ -625,7 +619,7 @@ impl<'a> DriveQuery<'a> { .map(|order_clause| Ok((order_clause.field.clone(), order_clause.to_owned()))) .collect::, Error>>()?; - Ok(DriveQuery { + Ok(DriveDocumentQuery { contract, document_type, internal_clauses, @@ -638,23 +632,23 @@ impl<'a> DriveQuery<'a> { }) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Converts a SQL expression to a `DriveQuery`. pub fn from_sql_expr( sql_string: &str, contract: &'a DataContract, - config: &DriveConfig, + config: Option<&DriveConfig>, ) -> Result { - let dialect: GenericDialect = sqlparser::dialect::GenericDialect {}; + let dialect: MySqlDialect = MySqlDialect {}; let statements: Vec = Parser::parse_sql(&dialect, sql_string) - .map_err(|_| Error::Query(QuerySyntaxError::InvalidSQL("Issue parsing sql")))?; + .map_err(|e| Error::Query(QuerySyntaxError::SQLParsingError(e)))?; // Should ideally iterate over each statement let first_statement = statements - .get(0) + .first() .ok_or(Error::Query(QuerySyntaxError::InvalidSQL( - "Issue parsing sql", + "Issue parsing sql getting first statement".to_string(), )))?; let query: &ast::Query = match first_statement { @@ -662,23 +656,42 @@ impl<'a> DriveQuery<'a> { _ => None, } .ok_or(Error::Query(QuerySyntaxError::InvalidSQL( - "Issue parsing sql", + "Issue parsing sql: not a query".to_string(), )))?; + let max_limit = config + .map(|config| config.max_query_limit) + .unwrap_or(DriveConfig::default().max_query_limit); + let limit: u16 = if let Some(limit_expr) = &query.limit { match limit_expr { ast::Expr::Value(Number(num_string, _)) => { let cast_num_string: &String = num_string; - cast_num_string.parse::().ok() + let user_limit = cast_num_string.parse::().map_err(|e| { + Error::Query(QuerySyntaxError::InvalidLimit(format!( + "limit could not be parsed {}", + e + ))) + })?; + if user_limit > max_limit { + return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( + "limit {} greater than max limit {}", + user_limit, max_limit + )))); + } + user_limit + } + result => { + return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( + "expression not a limit {}", + result + )))); } - _ => None, } - .ok_or(Error::Query(QuerySyntaxError::InvalidLimit(format!( - "limit greater than max limit {}", - config.max_query_limit - ))))? } else { - config.default_query_limit + config + .map(|config| config.default_query_limit) + .unwrap_or(DriveConfig::default().default_query_limit) }; let order_by: IndexMap = query @@ -692,33 +705,28 @@ impl<'a> DriveQuery<'a> { .collect::>(); // Grab the select section of the query - let select: &Select = match &query.body { + let select: &Select = match &*query.body { ast::SetExpr::Select(select) => Some(select), _ => None, } .ok_or(Error::Query(QuerySyntaxError::InvalidSQL( - "Issue parsing sql", + "Issue parsing sql: Not a select".to_string(), )))?; // Get the document type from the 'from' section let document_type_name = match &select .from - .get(0) + .first() .ok_or(Error::Query(QuerySyntaxError::InvalidSQL( - "Invalid query: missing from section", + "Invalid query: missing from section".to_string(), )))? .relation { - Table { - name, - alias: _, - args: _, - with_hints: _, - } => name.0.get(0).as_ref().map(|identifier| &identifier.value), + Table { name, .. } => name.0.first().as_ref().map(|identifier| &identifier.value), _ => None, } .ok_or(Error::Query(QuerySyntaxError::InvalidSQL( - "Issue parsing sql: invalid from value", + "Issue parsing sql: invalid from value".to_string(), )))?; let document_type = @@ -745,6 +753,7 @@ impl<'a> DriveQuery<'a> { if let Some(selection_tree) = selection_tree { WhereClause::build_where_clauses_from_operations( selection_tree, + document_type, &mut all_where_clauses, )?; } @@ -772,7 +781,7 @@ impl<'a> DriveQuery<'a> { }) .transpose()?; - Ok(DriveQuery { + Ok(DriveDocumentQuery { contract, document_type: document_type.as_ref(), internal_clauses, @@ -787,9 +796,9 @@ impl<'a> DriveQuery<'a> { /// Serialize drive query to CBOR format. /// - /// FIXME: The data contract is only refered as ID, and document type as its name. + /// FIXME: The data contract is only referred as ID, and document type as its name. /// This can change in the future to include full data contract and document type. - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(feature = "cbor_query")] pub fn to_cbor(&self) -> Result, Error> { let data: BTreeMap = self.into(); let cbor: BTreeMap = Value::convert_to_cbor_map(data)?; @@ -800,7 +809,7 @@ impl<'a> DriveQuery<'a> { Ok(output) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Operations to construct a path query. pub fn start_at_document_path_and_key(&self, starts_at: &[u8; 32]) -> (Vec>, Vec) { if self.document_type.documents_keep_history() { @@ -829,7 +838,7 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Operations to construct a path query. pub fn construct_path_query_operations( &self, @@ -919,8 +928,11 @@ impl<'a> DriveQuery<'a> { if let Some(start_at_path_query) = start_at_path_query { let limit = main_path_query.query.limit.take(); - let mut merged = - PathQuery::merge(vec![&start_at_path_query, &main_path_query]).map_err(GroveDB)?; + let mut merged = PathQuery::merge( + vec![&start_at_path_query, &main_path_query], + &platform_version.drive.grove_version, + ) + .map_err(GroveDB)?; merged.query.limit = limit.map(|a| a.saturating_add(1)); Ok(merged) } else { @@ -928,7 +940,7 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Operations to construct a path query. pub fn construct_path_query( &self, @@ -959,7 +971,7 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns a path query given a document type path and starting document. pub fn get_primary_key_path_query( &self, @@ -1127,7 +1139,7 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Finds the best index for the query. pub fn find_best_index(&self, platform_version: &PlatformVersion) -> Result<&Index, Error> { let equal_fields = self @@ -1176,9 +1188,10 @@ impl<'a> DriveQuery<'a> { platform_version, )? .ok_or(Error::Query( - QuerySyntaxError::WhereClauseOnNonIndexedProperty( - "query must be for valid indexes", - ), + QuerySyntaxError::WhereClauseOnNonIndexedProperty(format!( + "query must be for valid indexes, valid indexes are: {:?}", + self.document_type.indexes() + )), ))?; if difference > defaults::MAX_INDEX_DIFFERENCE { return Err(Error::Query(QuerySyntaxError::QueryTooFarFromIndex( @@ -1188,7 +1201,7 @@ impl<'a> DriveQuery<'a> { Ok(index) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns a `QueryItem` given a start key and query direction. pub fn query_item_for_starts_at_key(starts_at_key: Vec, left_to_right: bool) -> QueryItem { if left_to_right { @@ -1198,7 +1211,7 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns a `Query` that either starts at or after the given document ID if given. fn inner_query_from_starts_at_for_id( starts_at_document: &Option<(Document, DocumentTypeRef, &IndexProperty, bool)>, @@ -1221,7 +1234,7 @@ impl<'a> DriveQuery<'a> { inner_query } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns a `Query` that either starts at or after the given key. fn inner_query_starts_from_key( start_at_key: Vec, @@ -1244,7 +1257,7 @@ impl<'a> DriveQuery<'a> { inner_query } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns a `Query` that either starts at or after the given document if given. // We are passing in starts_at_document 4 parameters // The document @@ -1290,7 +1303,7 @@ impl<'a> DriveQuery<'a> { Ok(inner_query) } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Recursively queries as long as there are leftover index properties. fn recursive_insert_on_query( query: Option<&mut Query>, @@ -1360,7 +1373,7 @@ impl<'a> DriveQuery<'a> { left_to_right, platform_version, )?; - DriveQuery::recursive_insert_on_query( + DriveDocumentQuery::recursive_insert_on_query( Some(&mut inner_query), left_over, unique, @@ -1395,7 +1408,7 @@ impl<'a> DriveQuery<'a> { non_conditional_included, ); - DriveQuery::recursive_insert_on_query( + DriveDocumentQuery::recursive_insert_on_query( Some(&mut non_conditional_query), left_over, unique, @@ -1409,7 +1422,7 @@ impl<'a> DriveQuery<'a> { } else { let mut inner_query = Query::new_with_direction(first.ascending); inner_query.insert_all(); - DriveQuery::recursive_insert_on_query( + DriveDocumentQuery::recursive_insert_on_query( Some(&mut inner_query), left_over, unique, @@ -1428,7 +1441,7 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(any(feature = "full", feature = "verify"))] + #[cfg(any(feature = "server", feature = "verify"))] /// Returns a path query for non-primary keys given a document type path and starting document. pub fn get_non_primary_key_path_query( &self, @@ -1636,7 +1649,7 @@ impl<'a> DriveQuery<'a> { )) } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Executes a query with proof and returns the items and fee. pub fn execute_with_proof( self, @@ -1659,6 +1672,7 @@ impl<'a> DriveQuery<'a> { &block_info.epoch, drive.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -1667,7 +1681,7 @@ impl<'a> DriveQuery<'a> { Ok((items, cost)) } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Executes an internal query with proof and returns the items. pub(crate) fn execute_with_proof_internal( self, @@ -1685,14 +1699,13 @@ impl<'a> DriveQuery<'a> { )?; drive.grove_get_proved_path_query( &path_query, - false, transaction, drive_operations, &platform_version.drive, ) } - #[cfg(feature = "full")] + #[cfg(all(feature = "server", feature = "verify"))] /// Executes a query with proof and returns the root hash, items, and fee. pub fn execute_with_proof_only_get_elements( self, @@ -1700,7 +1713,7 @@ impl<'a> DriveQuery<'a> { block_info: Option, transaction: TransactionArg, platform_version: &PlatformVersion, - ) -> Result<([u8; 32], Vec>, u64), Error> { + ) -> Result<(RootHash, Vec>, u64), Error> { let mut drive_operations = vec![]; let (root_hash, items) = self.execute_with_proof_only_get_elements_internal( drive, @@ -1715,6 +1728,7 @@ impl<'a> DriveQuery<'a> { &block_info.epoch, drive.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -1723,7 +1737,7 @@ impl<'a> DriveQuery<'a> { Ok((root_hash, items, cost)) } - #[cfg(feature = "full")] + #[cfg(all(feature = "server", feature = "verify"))] /// Executes an internal query with proof and returns the root hash and values. pub(crate) fn execute_with_proof_only_get_elements_internal( self, @@ -1731,7 +1745,7 @@ impl<'a> DriveQuery<'a> { transaction: TransactionArg, drive_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result<([u8; 32], Vec>), Error> { + ) -> Result<(RootHash, Vec>), Error> { let path_query = self.construct_path_query_operations( drive, true, @@ -1742,7 +1756,6 @@ impl<'a> DriveQuery<'a> { let proof = drive.grove_get_proved_path_query( &path_query, - self.start_at.is_some(), transaction, drive_operations, &platform_version.drive, @@ -1750,32 +1763,7 @@ impl<'a> DriveQuery<'a> { self.verify_proof_keep_serialized(proof.as_slice(), platform_version) } - #[cfg(feature = "full")] - /// Executes a query with no proof and returns the items encoded in a map. - pub fn execute_serialized_as_result_no_proof( - &self, - drive: &Drive, - _block_info: Option, - query_result_encoding: QueryResultEncoding, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let mut drive_operations = vec![]; - let (items, _) = self.execute_no_proof_internal( - drive, - QueryResultType::QueryKeyElementPairResultType, - transaction, - &mut drive_operations, - platform_version, - )?; - //todo: we could probably give better results depending on the query - let result = platform_value!({ - "documents": items.to_key_elements() - }); - query_result_encoding.encode_value(&result) - } - - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Executes a query with no proof and returns the items, skipped items, and fee. pub fn execute_raw_results_no_proof( &self, @@ -1798,6 +1786,7 @@ impl<'a> DriveQuery<'a> { &block_info.epoch, drive.config.epochs_per_era, platform_version, + None, )?; fee_result.processing_fee } else { @@ -1806,7 +1795,7 @@ impl<'a> DriveQuery<'a> { Ok((items, skipped, cost)) } - #[cfg(feature = "full")] + #[cfg(feature = "server")] /// Executes an internal query with no proof and returns the values and skipped items. pub(crate) fn execute_raw_results_no_proof_internal( &self, @@ -1841,7 +1830,8 @@ impl<'a> DriveQuery<'a> { } } - #[cfg(feature = "full")] + #[cfg(feature = "server")] + #[allow(unused)] /// Executes an internal query with no proof and returns the values and skipped items. pub(crate) fn execute_no_proof_internal( &self, @@ -1882,8 +1872,8 @@ impl<'a> DriveQuery<'a> { } /// Convert DriveQuery to a BTreeMap of values -impl<'a> From<&DriveQuery<'a>> for BTreeMap { - fn from(query: &DriveQuery<'a>) -> Self { +impl<'a> From<&DriveDocumentQuery<'a>> for BTreeMap { + fn from(query: &DriveDocumentQuery<'a>) -> Self { let mut response = BTreeMap::::new(); // contract @@ -1942,32 +1932,38 @@ impl<'a> From<&DriveQuery<'a>> for BTreeMap { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { - use dpp::data_contract::data_contract::DataContractV0; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; - use dpp::data_contract::document_type::v0::DocumentTypeV0; - use dpp::data_contract::document_type::DocumentType; + use dpp::prelude::Identifier; + use rand::prelude::StdRng; + use rand::SeedableRng; use serde_json::json; use std::borrow::Cow; + use std::collections::BTreeMap; use std::option::Option::None; use tempfile::TempDir; - use crate::drive::flags::StorageFlags; use crate::drive::Drive; - use crate::query::DriveQuery; + use crate::query::{ + DriveDocumentQuery, InternalClauses, OrderClause, WhereClause, WhereOperator, + }; + use crate::util::storage_flags::StorageFlags; use dpp::data_contract::DataContract; use serde_json::Value::Null; - use crate::drive::config::DriveConfig; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::config::DriveConfig; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::tests::fixtures::get_data_contract_fixture; + use dpp::platform_value::string_encoding::Encoding; + use dpp::platform_value::Value; + use dpp::tests::fixtures::{get_data_contract_fixture, get_dpns_data_contract_fixture}; use dpp::tests::json_document::json_document_to_contract; use dpp::util::cbor_serializer; use dpp::version::PlatformVersion; @@ -1975,10 +1971,9 @@ mod tests { fn setup_family_contract() -> (Drive, DataContract) { let tmp_dir = TempDir::new().unwrap(); - let platform_version = PlatformVersion::latest(); + let (drive, _) = Drive::open(tmp_dir, None).expect("expected to open Drive successfully"); - let drive: Drive = Drive::open(tmp_dir, None, platform_version) - .expect("expected to open Drive successfully"); + let platform_version = PlatformVersion::latest(); drive .create_initial_state_structure(None, platform_version) @@ -2034,7 +2029,7 @@ mod tests { #[test] fn test_drive_query_from_to_cbor() { let config = DriveConfig::default(); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); @@ -2059,18 +2054,19 @@ mod tests { let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor(where_cbor.as_slice(), &contract, document_type, &config) - .expect("deserialize cbor shouldn't fail"); + let query = + DriveDocumentQuery::from_cbor(where_cbor.as_slice(), &contract, document_type, &config) + .expect("deserialize cbor shouldn't fail"); let cbor = query.to_cbor().expect("should serialize cbor"); - let deserialized = DriveQuery::from_cbor(&cbor, &contract, document_type, &config) + let deserialized = DriveDocumentQuery::from_cbor(&cbor, &contract, document_type, &config) .expect("should deserialize cbor"); assert_eq!(query, deserialized); assert_eq!(deserialized.start_at, Some(start_after.to_buffer())); - assert_eq!(deserialized.start_at_included, false); + assert!(!deserialized.start_at_included); assert_eq!(deserialized.block_time_ms, Some(13453432u64)); } @@ -2087,14 +2083,14 @@ mod tests { ["lastName", "asc"], ] }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2116,14 +2112,14 @@ mod tests { ], "invalid": 0, }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2146,14 +2142,14 @@ mod tests { ], }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2176,14 +2172,14 @@ mod tests { ], }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2205,14 +2201,14 @@ mod tests { ["lastName", "asc"], ], }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2221,6 +2217,70 @@ mod tests { .expect("query should be fine for a 255 byte long string"); } + #[test] + fn test_valid_query_drive_document_query() { + let platform_version = PlatformVersion::latest(); + let mut rng = StdRng::seed_from_u64(5); + let contract = + get_dpns_data_contract_fixture(Some(Identifier::random_with_rng(&mut rng)), 0, 1) + .data_contract_owned(); + let domain = contract + .document_type_for_name("domain") + .expect("expected to get domain"); + + let query_asc = DriveDocumentQuery { + contract: &contract, + document_type: domain, + internal_clauses: InternalClauses { + primary_key_in_clause: None, + primary_key_equal_clause: None, + in_clause: None, + range_clause: Some(WhereClause { + field: "records.identity".to_string(), + operator: WhereOperator::LessThan, + value: Value::Identifier( + Identifier::from_string( + "AYN4srupPWDrp833iG5qtmaAsbapNvaV7svAdncLN5Rh", + Encoding::Base58, + ) + .unwrap() + .to_buffer(), + ), + }), + equal_clauses: BTreeMap::new(), + }, + offset: None, + limit: Some(6), + order_by: vec![( + "records.identity".to_string(), + OrderClause { + field: "records.identity".to_string(), + ascending: false, + }, + )] + .into_iter() + .collect(), + start_at: None, + start_at_included: false, + block_time_ms: None, + }; + + let path_query = query_asc + .construct_path_query(None, platform_version) + .expect("expected to create path query"); + + assert_eq!(path_query.to_string(), "PathQuery { path: [@, 0x1da29f488023e306ff9a680bc9837153fb0778c8ee9c934a87dc0de1d69abd3c, 0x01, domain, 0x7265636f7264732e6964656e74697479], query: SizedQuery { query: Query {\n items: [\n RangeTo(.. 8dc201fd7ad7905f8a84d66218e2b387daea7fe4739ae0e21e8c3ee755e6a2c0),\n ],\n default_subquery_branch: SubqueryBranch { subquery_path: [00], subquery: Query {\n items: [\n RangeFull,\n ],\n default_subquery_branch: SubqueryBranch { subquery_path: None subquery: None },\n left_to_right: false,\n} },\n conditional_subquery_branches: {\n Key(): SubqueryBranch { subquery_path: [00], subquery: Query {\n items: [\n RangeFull,\n ],\n default_subquery_branch: SubqueryBranch { subquery_path: None subquery: None },\n left_to_right: false,\n} },\n },\n left_to_right: false,\n}, limit: 6 } }"); + + // Serialize the PathQuery to a Vec + let encoded = bincode::encode_to_vec(&path_query, bincode::config::standard()) + .expect("Failed to serialize PathQuery"); + + // Convert the encoded bytes to a hex string + let hex_string = hex::encode(encoded); + + assert_eq!(hex_string, "050140201da29f488023e306ff9a680bc9837153fb0778c8ee9c934a87dc0de1d69abd3c010106646f6d61696e107265636f7264732e6964656e746974790105208dc201fd7ad7905f8a84d66218e2b387daea7fe4739ae0e21e8c3ee755e6a2c0010101000101030000000001010000010101000101030000000000010600"); + } + #[test] fn test_invalid_query_field_too_long() { let (drive, contract) = setup_family_contract(); @@ -2245,7 +2305,7 @@ mod tests { let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2334,7 +2394,7 @@ mod tests { let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2368,7 +2428,7 @@ mod tests { let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2407,7 +2467,7 @@ mod tests { let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2446,7 +2506,7 @@ mod tests { // The is actually valid, however executing it is not // This is in order to optimize query execution - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2471,14 +2531,14 @@ mod tests { ], }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2499,14 +2559,14 @@ mod tests { ], }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2527,14 +2587,14 @@ mod tests { ], }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, @@ -2555,14 +2615,14 @@ mod tests { ], }); - let contract = get_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_data_contract_fixture(None, 0, 1).data_contract_owned(); let document_type = contract .document_type_for_name("niceDocument") .expect("expected to get nice document"); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - DriveQuery::from_cbor( + DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type, diff --git a/packages/rs-drive/src/query/ordering.rs b/packages/rs-drive/src/query/ordering.rs index eb033ce14de..e177967a2f8 100644 --- a/packages/rs-drive/src/query/ordering.rs +++ b/packages/rs-drive/src/query/ordering.rs @@ -1,32 +1,3 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Query Ordering //! @@ -34,7 +5,8 @@ use dpp::platform_value::Value; use grovedb::Error; /// Order clause struct -#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct OrderClause { /// Field pub field: String, @@ -52,7 +24,7 @@ impl<'a> OrderClause { } let field_value = clause_components - .get(0) + .first() .expect("check above enforces it exists"); let field_ref = field_value.as_text().ok_or(Error::InvalidQuery( "first field of where component should be a string", diff --git a/packages/rs-drive/src/query/single_document_drive_query.rs b/packages/rs-drive/src/query/single_document_drive_query.rs index 0d45086e0e9..8877480d872 100644 --- a/packages/rs-drive/src/query/single_document_drive_query.rs +++ b/packages/rs-drive/src/query/single_document_drive_query.rs @@ -1,8 +1,44 @@ -use crate::common::encode::encode_u64; -use crate::drive::document::contract_document_type_path; +use crate::drive::document::paths::contract_document_type_path_vec; +use crate::util::common::encode::encode_u64; +use crate::drive::votes; +use crate::error::query::QuerySyntaxError; +use crate::error::Error; use crate::query::Query; use grovedb::{PathQuery, SizedQuery}; +use platform_version::version::PlatformVersion; +use platform_version::TryFromPlatformVersioned; + +/// The expected contested status of a document +/// Drives stores the document in either the not contested location (most of the time) +/// Or a temporary contested area while the contest is ongoing +#[derive(Debug, PartialEq, Clone)] +#[repr(u8)] +pub enum SingleDocumentDriveQueryContestedStatus { + /// The document was not contested by the system. + NotContested = 0, + /// We don't know if the document was contested by the system, or we are not sure if the contest + /// is already over or not. + MaybeContested = 1, + /// We know that the document was contested by the system and the contest is not over. + Contested = 2, +} + +impl TryFrom for SingleDocumentDriveQueryContestedStatus { + type Error = Error; + + fn try_from(value: i32) -> Result { + match value { + 0 => Ok(SingleDocumentDriveQueryContestedStatus::NotContested), + 1 => Ok(SingleDocumentDriveQueryContestedStatus::MaybeContested), + 2 => Ok(SingleDocumentDriveQueryContestedStatus::Contested), + n => Err(Error::Query(QuerySyntaxError::Unsupported(format!( + "unsupported contested status {}, only 0, 1 and 2 are supported", + n + )))), + } + } +} /// Drive query struct #[derive(Debug, PartialEq, Clone)] @@ -17,17 +53,40 @@ pub struct SingleDocumentDriveQuery { pub document_id: [u8; 32], /// Block time pub block_time_ms: Option, + /// True if the document might have gone to a contested resolution + pub contested_status: SingleDocumentDriveQueryContestedStatus, } impl SingleDocumentDriveQuery { /// Operations to construct a path query. - pub fn construct_path_query(&self) -> PathQuery { + pub fn construct_path_query( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match self.contested_status { + SingleDocumentDriveQueryContestedStatus::NotContested => { + Ok(self.construct_non_contested_path_query(true)) + } + SingleDocumentDriveQueryContestedStatus::MaybeContested => { + let non_contested = self.construct_non_contested_path_query(true); + let contested = self.construct_contested_path_query(true); + PathQuery::merge( + vec![&non_contested, &contested], + &platform_version.drive.grove_version, + ) + .map_err(Error::GroveDB) + } + SingleDocumentDriveQueryContestedStatus::Contested => { + Ok(self.construct_contested_path_query(true)) + } + } + } + + /// Operations to construct the normal path query. + fn construct_non_contested_path_query(&self, with_limit_1: bool) -> PathQuery { // First we should get the overall document_type_path let mut path = - contract_document_type_path(&self.contract_id, self.document_type_name.as_str()) - .into_iter() - .map(|a| a.to_vec()) - .collect::>>(); + contract_document_type_path_vec(&self.contract_id, self.document_type_name.as_str()); path.push(vec![0]); @@ -46,12 +105,34 @@ impl SingleDocumentDriveQuery { } } - PathQuery::new(path, SizedQuery::new(query, Some(1), None)) + let limit = if with_limit_1 { Some(1) } else { None }; + + PathQuery::new(path, SizedQuery::new(query, limit, None)) + } + + /// Operations to construct the contested path query. + fn construct_contested_path_query(&self, with_limit_1: bool) -> PathQuery { + // First we should get the overall document_type_path + let path = votes::paths::vote_contested_resource_contract_documents_storage_path_vec( + &self.contract_id, + self.document_type_name.as_str(), + ); + + let mut query = Query::new(); + query.insert_key(self.document_id.to_vec()); + + let limit = if with_limit_1 { Some(1) } else { None }; + + PathQuery::new(path, SizedQuery::new(query, limit, None)) } } -impl From for PathQuery { - fn from(value: SingleDocumentDriveQuery) -> Self { - value.construct_path_query() +impl TryFromPlatformVersioned for PathQuery { + type Error = Error; + fn try_from_platform_versioned( + value: SingleDocumentDriveQuery, + platform_version: &PlatformVersion, + ) -> Result { + value.construct_path_query(platform_version) } } diff --git a/packages/rs-drive/src/query/test_index.rs b/packages/rs-drive/src/query/test_index.rs index 16413d72c29..df368eb5c8e 100644 --- a/packages/rs-drive/src/query/test_index.rs +++ b/packages/rs-drive/src/query/test_index.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use dpp::data_contract::document_type::DocumentType; @@ -6,9 +6,9 @@ mod tests { use dpp::util::cbor_serializer; use serde_json::json; - use crate::drive::config::DriveConfig; + use crate::config::DriveConfig; use crate::error::{query::QuerySyntaxError, Error}; - use crate::query::DriveQuery; + use crate::query::DriveDocumentQuery; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::tests::fixtures::get_dpns_data_contract_fixture; @@ -84,7 +84,9 @@ mod tests { None, false, false, + false, true, + &mut vec![], platform_version, ) .expect("expected to create a document type") @@ -93,7 +95,7 @@ mod tests { #[test] fn test_find_best_index() { let document_type = construct_indexed_document_type(); - let contract = get_dpns_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_dpns_data_contract_fixture(None, 0, 1).data_contract_owned(); let platform_version = PlatformVersion::latest(); @@ -105,7 +107,7 @@ mod tests { }); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type.as_ref(), @@ -115,7 +117,10 @@ mod tests { let index = query .find_best_index(platform_version) .expect("expected to find index"); - assert_eq!(index, document_type.indices().get(2).unwrap()); + let mut iter = document_type.indexes().iter(); + iter.next(); + iter.next(); + assert_eq!(index, iter.next().unwrap().1); //position 2 let query_value = json!({ "where": [ @@ -124,7 +129,7 @@ mod tests { }); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type.as_ref(), @@ -134,13 +139,13 @@ mod tests { let index = query .find_best_index(platform_version) .expect("expected to find index"); - assert_eq!(index, document_type.indices().get(0).unwrap()); + assert_eq!(index, document_type.indexes().iter().next().unwrap().1); } #[test] fn test_find_best_index_error() { let document_type = construct_indexed_document_type(); - let contract = get_dpns_data_contract_fixture(None, 1).data_contract_owned(); + let contract = get_dpns_data_contract_fixture(None, 0, 1).data_contract_owned(); let platform_version = PlatformVersion::latest(); @@ -151,7 +156,7 @@ mod tests { }); let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) .expect("expected to serialize to cbor"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, document_type.as_ref(), @@ -162,7 +167,7 @@ mod tests { .find_best_index(platform_version) .expect_err("expected to not find index"); assert!( - matches!(error, Error::Query(QuerySyntaxError::WhereClauseOnNonIndexedProperty(message)) if message == "query must be for valid indexes") + matches!(error, Error::Query(QuerySyntaxError::WhereClauseOnNonIndexedProperty(message)) if message.contains("query must be for valid indexes")) ) } } diff --git a/packages/rs-drive/src/query/vote_poll_contestant_votes_query.rs b/packages/rs-drive/src/query/vote_poll_contestant_votes_query.rs new file mode 100644 index 00000000000..f170d6820dc --- /dev/null +++ b/packages/rs-drive/src/query/vote_poll_contestant_votes_query.rs @@ -0,0 +1,325 @@ +#[cfg(feature = "verify")] +use super::ContractLookupFn; +use crate::drive::votes::paths::VotePollPaths; +#[cfg(any(feature = "server", feature = "verify"))] +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::resolve::ContestedDocumentResourceVotePollResolver; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; +#[cfg(feature = "server")] +use crate::drive::Drive; +use crate::error::Error; +#[cfg(feature = "server")] +use crate::fees::op::LowLevelDriveOperation; +#[cfg(feature = "server")] +use crate::query::GroveError; +use crate::query::Query; +#[cfg(feature = "server")] +use dpp::block::block_info::BlockInfo; +use dpp::identifier::Identifier; +#[cfg(feature = "server")] +use dpp::platform_value; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice::TowardsIdentity; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +#[cfg(feature = "server")] +use grovedb::query_result_type::{QueryResultElements, QueryResultType}; +#[cfg(feature = "server")] +use grovedb::TransactionArg; +use grovedb::{PathQuery, SizedQuery}; +use platform_version::version::PlatformVersion; + +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct ContestedDocumentVotePollVotesDriveQuery { + /// What vote poll are we asking for? + pub vote_poll: ContestedDocumentResourceVotePoll, + /// Which contestant do we want to get the votes for + pub contestant_id: Identifier, + /// Offset + pub offset: Option, + /// Limit + pub limit: Option, + /// Start at identity id + pub start_at: Option<([u8; 32], bool)>, + /// Ascending + pub order_ascending: bool, +} + +impl ContestedDocumentVotePollVotesDriveQuery { + #[cfg(feature = "server")] + /// Resolves the contested document vote poll drive query. + /// + /// This method processes the query by interacting with the drive, using the provided + /// transaction and platform version to ensure consistency and compatibility. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ResolvedContestedDocumentVotePollDriveQuery)` - The resolved query information. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the query. + /// The specific error depends on the underlying problem encountered during resolution. + pub fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let ContestedDocumentVotePollVotesDriveQuery { + vote_poll, + contestant_id, + offset, + limit, + start_at, + order_ascending, + } = self; + Ok(ResolvedContestedDocumentVotePollVotesDriveQuery { + vote_poll: vote_poll.resolve_allow_borrowed(drive, transaction, platform_version)?, + contestant_id: *contestant_id, + offset: *offset, + limit: *limit, + start_at: *start_at, + order_ascending: *order_ascending, + }) + } + + /// Resolves the contested document vote poll drive query. + /// + /// See [ContestedDocumentVotePollVotesDriveQuery::resolve](ContestedDocumentVotePollVotesDriveQuery::resolve) for more information. + #[cfg(feature = "verify")] + pub fn resolve_with_known_contracts_provider<'a>( + &self, + known_contracts_provider: &ContractLookupFn, + ) -> Result, Error> { + let ContestedDocumentVotePollVotesDriveQuery { + vote_poll, + contestant_id, + offset, + limit, + start_at, + order_ascending, + } = self; + Ok(ResolvedContestedDocumentVotePollVotesDriveQuery { + vote_poll: vote_poll.resolve_with_known_contracts_provider(known_contracts_provider)?, + contestant_id: *contestant_id, + offset: *offset, + limit: *limit, + start_at: *start_at, + order_ascending: *order_ascending, + }) + } + + #[cfg(feature = "server")] + /// Executes a query with proof and returns the items and fee. + pub fn execute_with_proof( + self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Vec, u64), Error> { + let mut drive_operations = vec![]; + let items = self.execute_with_proof_internal( + drive, + transaction, + &mut drive_operations, + platform_version, + )?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((items, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with proof and returns the items. + pub(crate) fn execute_with_proof_internal( + self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let resolved = self.resolve(drive, transaction, platform_version)?; + let path_query = resolved.construct_path_query(platform_version)?; + drive.grove_get_proved_path_query( + &path_query, + transaction, + drive_operations, + &platform_version.drive, + ) + } + + #[cfg(feature = "server")] + /// Executes a query with no proof and returns the items, skipped items, and fee. + pub fn execute_no_proof_with_cost( + &self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Vec, u64), Error> { + let mut drive_operations = vec![]; + let result = + self.execute_no_proof(drive, transaction, &mut drive_operations, platform_version)?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((result, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with no proof and returns the values and skipped items. + pub fn execute_no_proof( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let resolved = self.resolve(drive, transaction, platform_version)?; + let path_query = resolved.construct_path_query(platform_version)?; + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => Ok(vec![]), + Err(e) => Err(e), + Ok((query_result_elements, _skipped)) => { + let voters = query_result_elements + .to_keys() + .into_iter() + .map(Identifier::try_from) + .collect::, platform_value::Error>>()?; + + Ok(voters) + } + } + } + + #[cfg(feature = "server")] + #[allow(unused)] + /// Executes an internal query with no proof and returns the values and skipped items. + pub(crate) fn execute_no_proof_internal( + &self, + drive: &Drive, + result_type: QueryResultType, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(QueryResultElements, u16), Error> { + let resolved = self.resolve(drive, transaction, platform_version)?; + let path_query = resolved.construct_path_query(platform_version)?; + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + result_type, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => { + Ok((QueryResultElements::new(), 0)) + } + _ => { + let (data, skipped) = query_result?; + { + Ok((data, skipped)) + } + } + } + } +} +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct ResolvedContestedDocumentVotePollVotesDriveQuery<'a> { + /// What vote poll are we asking for? + pub vote_poll: ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a>, + /// Who's votes are we looking for + pub contestant_id: Identifier, + /// Offset + pub offset: Option, + /// Limit + pub limit: Option, + /// Start at identity id, the bool is if it is also included + pub start_at: Option<([u8; 32], bool)>, + /// Ascending + pub order_ascending: bool, +} + +impl<'a> ResolvedContestedDocumentVotePollVotesDriveQuery<'a> { + /// Operations to construct a path query. + pub fn construct_path_query( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let path = self + .vote_poll + .contender_voting_path(&TowardsIdentity(self.contestant_id), platform_version)?; + + let mut query = Query::new_with_direction(self.order_ascending); + + // this is a range on all elements + match &self.start_at { + None => { + query.insert_all(); + } + Some((starts_at_key_bytes, start_at_included)) => { + let starts_at_key = starts_at_key_bytes.to_vec(); + match self.order_ascending { + true => match start_at_included { + true => query.insert_range_from(starts_at_key..), + false => query.insert_range_after(starts_at_key..), + }, + false => match start_at_included { + true => query.insert_range_to_inclusive(..=starts_at_key), + false => query.insert_range_to(..starts_at_key), + }, + } + } + } + + Ok(PathQuery { + path, + query: SizedQuery { + query, + limit: self.limit, + offset: self.offset, + }, + }) + } +} diff --git a/packages/rs-drive/src/query/vote_poll_vote_state_query.rs b/packages/rs-drive/src/query/vote_poll_vote_state_query.rs new file mode 100644 index 00000000000..949d112a671 --- /dev/null +++ b/packages/rs-drive/src/query/vote_poll_vote_state_query.rs @@ -0,0 +1,796 @@ +use crate::drive::votes::paths::{ + VotePollPaths, RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32, RESOURCE_LOCK_VOTE_TREE_KEY_U8_32, + RESOURCE_STORED_INFO_KEY_U8_32, +}; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::resolve::ContestedDocumentResourceVotePollResolver; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::query::QuerySyntaxError; +use crate::error::Error; +#[cfg(feature = "server")] +use crate::fees::op::LowLevelDriveOperation; +#[cfg(feature = "server")] +use crate::query::GroveError; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::DataContract; +use dpp::identifier::Identifier; +use dpp::serialization::PlatformDeserializable; +use dpp::voting::contender_structs::{ + ContenderWithSerializedDocument, ContenderWithSerializedDocumentV0, + FinalizedContenderWithSerializedDocument, +}; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::{ + ContestedDocumentVotePollStoredInfo, ContestedDocumentVotePollStoredInfoV0Getters, +}; +use dpp::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +#[cfg(feature = "server")] +use grovedb::query_result_type::QueryResultType; +#[cfg(feature = "server")] +use grovedb::{Element, TransactionArg}; +use grovedb::{PathQuery, Query, QueryItem, SizedQuery}; +use platform_version::version::PlatformVersion; + +/// Represents the types of results that can be obtained from a contested document vote poll query. +/// +/// This enum defines the various types of results that can be returned when querying the drive +/// for contested document vote poll information. +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum ContestedDocumentVotePollDriveQueryResultType { + /// The documents associated with the vote poll are returned in the query result. + Documents, + /// The vote tally results are returned in the query result. + VoteTally, + /// Both the documents and the vote tally results are returned in the query result. + DocumentsAndVoteTally, +} + +impl ContestedDocumentVotePollDriveQueryResultType { + /// Helper method to say if this result type should return vote tally + pub fn has_vote_tally(&self) -> bool { + match self { + ContestedDocumentVotePollDriveQueryResultType::Documents => false, + ContestedDocumentVotePollDriveQueryResultType::VoteTally => true, + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => true, + } + } + + /// Helper method to say if this result type should return documents + pub fn has_documents(&self) -> bool { + match self { + ContestedDocumentVotePollDriveQueryResultType::Documents => true, + ContestedDocumentVotePollDriveQueryResultType::VoteTally => false, + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => true, + } + } +} + +impl TryFrom for ContestedDocumentVotePollDriveQueryResultType { + type Error = Error; + + fn try_from(value: i32) -> Result { + match value { + 0 => Ok(ContestedDocumentVotePollDriveQueryResultType::Documents), + 1 => Ok(ContestedDocumentVotePollDriveQueryResultType::VoteTally), + 2 => Ok(ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally), + n => Err(Error::Query(QuerySyntaxError::Unsupported(format!( + "unsupported contested document vote poll drive query result type {}, only 0, 1, 2 and 3 are supported", + n + )))), + } + } +} + +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct ContestedDocumentVotePollDriveQuery { + /// What vote poll are we asking for? + pub vote_poll: ContestedDocumentResourceVotePoll, + /// What result type are we interested in + pub result_type: ContestedDocumentVotePollDriveQueryResultType, + /// Offset + pub offset: Option, + /// Limit for returned contestant info, including locked or abstaining votes does not change this + pub limit: Option, + /// Start at identity id + pub start_at: Option<([u8; 32], bool)>, + /// Include locked and abstaining vote tally + /// This is not automatic, it will just be at the beginning if the order is ascending + /// If the order is descending, we will get a value if we finish the query + pub allow_include_locked_and_abstaining_vote_tally: bool, +} + +/// Represents the result of executing a contested document vote poll drive query. +/// +/// This struct holds the list of contenders and the number of skipped items +/// when an offset is given. +#[derive(Debug, PartialEq, Eq, Clone, Default)] +pub struct ContestedDocumentVotePollDriveQueryExecutionResult { + /// The list of contenders returned by the query. + pub contenders: Vec, + /// Locked tally + pub locked_vote_tally: Option, + /// Abstaining tally + pub abstaining_vote_tally: Option, + /// Finalization info + pub winner: Option<(ContestedDocumentVotePollWinnerInfo, BlockInfo)>, + /// The number of skipped items when an offset is given. + pub skipped: u16, +} + +/// Represents the result of executing a contested document vote poll drive query. +/// +/// This struct holds the list of contenders and the number of skipped items +/// when an offset is given. +#[derive(Debug, PartialEq, Eq, Clone, Default)] +pub struct FinalizedContestedDocumentVotePollDriveQueryExecutionResult { + /// The list of contenders returned by the query. + pub contenders: Vec, + /// Locked tally + pub locked_vote_tally: u32, + /// Abstaining tally + pub abstaining_vote_tally: u32, +} + +impl TryFrom + for FinalizedContestedDocumentVotePollDriveQueryExecutionResult +{ + type Error = Error; + + fn try_from( + value: ContestedDocumentVotePollDriveQueryExecutionResult, + ) -> Result { + let ContestedDocumentVotePollDriveQueryExecutionResult { + contenders, + locked_vote_tally, + abstaining_vote_tally, + .. + } = value; + + let finalized_contenders = contenders + .into_iter() + .map(|contender| { + let finalized: FinalizedContenderWithSerializedDocument = contender.try_into()?; + Ok(finalized) + }) + .collect::, Error>>()?; + + Ok( + FinalizedContestedDocumentVotePollDriveQueryExecutionResult { + contenders: finalized_contenders, + locked_vote_tally: locked_vote_tally.ok_or(Error::Drive( + DriveError::CorruptedCodeExecution("expected a locked tally"), + ))?, + abstaining_vote_tally: abstaining_vote_tally.ok_or(Error::Drive( + DriveError::CorruptedCodeExecution("expected an abstaining tally"), + ))?, + }, + ) + } +} + +impl ContestedDocumentVotePollDriveQuery { + #[cfg(feature = "server")] + /// Resolves the contested document vote poll drive query. + /// + /// This method processes the query by interacting with the drive, using the provided + /// transaction and platform version to ensure consistency and compatibility. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ResolvedContestedDocumentVotePollDriveQuery)` - The resolved query information. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the query. + /// The specific error depends on the underlying problem encountered during resolution. + pub fn resolve( + &self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let ContestedDocumentVotePollDriveQuery { + vote_poll, + result_type, + offset, + limit, + start_at, + allow_include_locked_and_abstaining_vote_tally, + } = self; + Ok(ResolvedContestedDocumentVotePollDriveQuery { + vote_poll: vote_poll.resolve_allow_borrowed(drive, transaction, platform_version)?, + result_type: *result_type, + offset: *offset, + limit: *limit, + start_at: *start_at, + allow_include_locked_and_abstaining_vote_tally: + *allow_include_locked_and_abstaining_vote_tally, + }) + } + + #[cfg(feature = "verify")] + /// Resolves with a known contract provider + pub fn resolve_with_known_contracts_provider<'a>( + &self, + known_contracts_provider_fn: &super::ContractLookupFn, + ) -> Result, Error> { + let ContestedDocumentVotePollDriveQuery { + vote_poll, + result_type, + offset, + limit, + start_at, + allow_include_locked_and_abstaining_vote_tally, + } = self; + Ok(ResolvedContestedDocumentVotePollDriveQuery { + vote_poll: vote_poll + .resolve_with_known_contracts_provider(known_contracts_provider_fn)?, + result_type: *result_type, + offset: *offset, + limit: *limit, + start_at: *start_at, + allow_include_locked_and_abstaining_vote_tally: + *allow_include_locked_and_abstaining_vote_tally, + }) + } + + #[cfg(any(feature = "verify", feature = "server"))] + /// Resolves with a provided borrowed contract + pub fn resolve_with_provided_borrowed_contract<'a>( + &self, + data_contract: &'a DataContract, + ) -> Result, Error> { + let ContestedDocumentVotePollDriveQuery { + vote_poll, + result_type, + offset, + limit, + start_at, + allow_include_locked_and_abstaining_vote_tally, + } = self; + Ok(ResolvedContestedDocumentVotePollDriveQuery { + vote_poll: vote_poll.resolve_with_provided_borrowed_contract(data_contract)?, + result_type: *result_type, + offset: *offset, + limit: *limit, + start_at: *start_at, + allow_include_locked_and_abstaining_vote_tally: + *allow_include_locked_and_abstaining_vote_tally, + }) + } + + #[cfg(feature = "server")] + /// Executes a query with proof and returns the items and fee. + pub fn execute_with_proof( + self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Vec, u64), Error> { + let mut drive_operations = vec![]; + let items = self.execute_with_proof_internal( + drive, + transaction, + &mut drive_operations, + platform_version, + )?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((items, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with proof and returns the items. + pub(crate) fn execute_with_proof_internal( + self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let resolved = self.resolve(drive, transaction, platform_version)?; + let path_query = resolved.construct_path_query(platform_version)?; + // println!("{:?}", &path_query); + drive.grove_get_proved_path_query( + &path_query, + transaction, + drive_operations, + &platform_version.drive, + ) + } + + #[cfg(feature = "server")] + /// Executes a query with no proof and returns the items, skipped items, and fee. + pub fn execute_no_proof_with_cost( + &self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(ContestedDocumentVotePollDriveQueryExecutionResult, u64), Error> { + let mut drive_operations = vec![]; + let result = + self.execute_no_proof(drive, transaction, &mut drive_operations, platform_version)?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((result, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with no proof and returns the values and skipped items. + pub fn execute_no_proof( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + let resolved = self.resolve(drive, transaction, platform_version)?; + resolved.execute(drive, transaction, drive_operations, platform_version) + } +} + +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct ResolvedContestedDocumentVotePollDriveQuery<'a> { + /// What vote poll are we asking for? + pub vote_poll: ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed<'a>, + /// What result type are we interested in + pub result_type: ContestedDocumentVotePollDriveQueryResultType, + /// Offset + pub offset: Option, + /// Limit + pub limit: Option, + /// Start at identity id, the bool is if it is also included + pub start_at: Option<([u8; 32], bool)>, + /// Include locked and abstaining vote tally + pub allow_include_locked_and_abstaining_vote_tally: bool, +} + +impl<'a> ResolvedContestedDocumentVotePollDriveQuery<'a> { + /// Operations to construct a path query. + pub fn construct_path_query( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let path = self.vote_poll.contenders_path(platform_version)?; + + let mut query = Query::new(); + + let allow_include_locked_and_abstaining_vote_tally = self + .allow_include_locked_and_abstaining_vote_tally + && self.result_type.has_vote_tally(); + + // We have the following + // Stored Info [[0;31],0] Abstain votes [[0;31],1] Lock Votes [[0;31],2] + + // this is a range on all elements + let limit = + match &self.start_at { + None => { + if allow_include_locked_and_abstaining_vote_tally { + match &self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents => { + // Documents don't care about the vote tallies + query.insert_range_after(RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec()..); + self.limit + } + ContestedDocumentVotePollDriveQueryResultType::VoteTally => { + query.insert_all(); + self.limit.map(|limit| limit.saturating_add(3)) + } + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => { + query.insert_all(); + self.limit.map(|limit| limit.saturating_mul(2).saturating_add(3)) + } + } + } else { + match &self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents => { + query.insert_range_after(RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec()..); + self.limit + } + ContestedDocumentVotePollDriveQueryResultType::VoteTally => { + query.insert_key(RESOURCE_STORED_INFO_KEY_U8_32.to_vec()); + query.insert_range_after(RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec()..); + self.limit.map(|limit| limit.saturating_add(1)) + } + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => { + query.insert_key(RESOURCE_STORED_INFO_KEY_U8_32.to_vec()); + query.insert_range_after(RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec()..); + self.limit.map(|limit| limit.saturating_mul(2).saturating_add(1)) + } + } + } + } + Some((starts_at_key_bytes, start_at_included)) => { + let starts_at_key = starts_at_key_bytes.to_vec(); + match start_at_included { + true => query.insert_range_from(starts_at_key..), + false => query.insert_range_after(starts_at_key..), + } + match &self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents + | ContestedDocumentVotePollDriveQueryResultType::VoteTally => self.limit, + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => { + self.limit.map(|limit| limit.saturating_mul(2)) + } + } + } + }; + + let (subquery_path, subquery) = match self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents => (Some(vec![vec![0]]), None), + ContestedDocumentVotePollDriveQueryResultType::VoteTally => (Some(vec![vec![1]]), None), + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => { + let mut query = Query::new(); + query.insert_keys(vec![vec![0], vec![1]]); + (None, Some(query.into())) + } + }; + + query.default_subquery_branch.subquery_path = subquery_path; + query.default_subquery_branch.subquery = subquery; + + if allow_include_locked_and_abstaining_vote_tally { + query.add_conditional_subquery( + QueryItem::Key(RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.to_vec()), + Some(vec![vec![1]]), + None, + ); + query.add_conditional_subquery( + QueryItem::Key(RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.to_vec()), + Some(vec![vec![1]]), + None, + ); + } + + query.add_conditional_subquery( + QueryItem::Key(RESOURCE_STORED_INFO_KEY_U8_32.to_vec()), + None, + None, + ); + + Ok(PathQuery { + path, + query: SizedQuery { + query, + limit, + offset: self.offset, + }, + }) + } + + #[cfg(feature = "server")] + /// Executes the query with no proof + pub fn execute( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + let path_query = self.construct_path_query(platform_version)?; + // println!("path_query {:?}", &path_query); + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => { + Ok(ContestedDocumentVotePollDriveQueryExecutionResult::default()) + } + Err(e) => Err(e), + Ok((query_result_elements, skipped)) => { + match self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents => { + // with documents only we don't need to work about lock and abstaining tree + let contenders = query_result_elements + .to_path_key_elements() + .into_iter() + .map(|(mut path, _key, document)| { + let identity_id = path.pop().ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "the path must have a last element".to_string(), + ), + ))?; + Ok(ContenderWithSerializedDocumentV0 { + identity_id: Identifier::try_from(identity_id)?, + serialized_document: Some(document.into_item_bytes()?), + vote_tally: None, + } + .into()) + }) + .collect::, Error>>()?; + + Ok(ContestedDocumentVotePollDriveQueryExecutionResult { + contenders, + locked_vote_tally: None, + abstaining_vote_tally: None, + winner: None, + skipped, + }) + } + ContestedDocumentVotePollDriveQueryResultType::VoteTally => { + let mut contenders = Vec::new(); + let mut locked_vote_tally: Option = None; + let mut abstaining_vote_tally: Option = None; + let mut winner = None; + + for (path, first_key, element) in + query_result_elements.to_path_key_elements().into_iter() + { + let Some(identity_bytes) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "the path must have a last element".to_string(), + ))); + }; + match element { + Element::SumTree(_, sum_tree_value, _) => { + if sum_tree_value < 0 || sum_tree_value > u32::MAX as i64 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "sum tree value for vote tally must be between 0 and u32::Max, received {} from state", + sum_tree_value + )))); + } + + if identity_bytes.as_slice() + == RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.as_slice() + { + locked_vote_tally = Some(sum_tree_value as u32); + } else if identity_bytes.as_slice() + == RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.as_slice() + { + abstaining_vote_tally = Some(sum_tree_value as u32); + } else { + contenders.push( + ContenderWithSerializedDocumentV0 { + identity_id: Identifier::try_from(identity_bytes)?, + serialized_document: None, + vote_tally: Some(sum_tree_value as u32), + } + .into(), + ); + } + } + Element::Item(serialized_item_info, _) => { + if first_key.as_slice() == &RESOURCE_STORED_INFO_KEY_U8_32 { + // this is the stored info, let's check to see if the vote is over + let finalized_contested_document_vote_poll_stored_info = ContestedDocumentVotePollStoredInfo::deserialize_from_bytes(&serialized_item_info)?; + if finalized_contested_document_vote_poll_stored_info + .vote_poll_status() + .awarded_or_locked() + { + locked_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_locked_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last locked votes" + .to_string(), + ), + ))?, + ); + abstaining_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_abstain_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last abstain votes" + .to_string(), + ), + ))?, + ); + winner = Some(( + finalized_contested_document_vote_poll_stored_info.winner(), + finalized_contested_document_vote_poll_stored_info + .last_finalization_block().ok_or(Error::Drive(DriveError::CorruptedDriveState( + "we should have a last finalization block".to_string(), + )))?, + )); + contenders = finalized_contested_document_vote_poll_stored_info + .contender_votes_in_vec_of_contender_with_serialized_document().ok_or(Error::Drive(DriveError::CorruptedDriveState( + "we should have a last contender votes".to_string(), + )))?; + } + } else { + return Err(Error::Drive( + DriveError::CorruptedDriveState( + "the only item that should be returned should be stored info" + .to_string(), + ), + )); + } + } + _ => { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "unexpected element type in result".to_string(), + ))); + } + } + } + Ok(ContestedDocumentVotePollDriveQueryExecutionResult { + contenders, + locked_vote_tally, + abstaining_vote_tally, + winner, + skipped, + }) + } + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => { + let mut elements_iter = + query_result_elements.to_path_key_elements().into_iter(); + let mut contenders = vec![]; + let mut locked_vote_tally: Option = None; + let mut abstaining_vote_tally: Option = None; + let mut winner = None; + + // Handle ascending order + while let Some((path, first_key, element)) = elements_iter.next() { + let Some(identity_bytes) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "the path must have a last element".to_string(), + ))); + }; + + match element { + Element::SumTree(_, sum_tree_value, _) => { + if sum_tree_value < 0 || sum_tree_value > u32::MAX as i64 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "sum tree value for vote tally must be between 0 and u32::Max, received {} from state", + sum_tree_value + )))); + } + + if identity_bytes.as_slice() + == RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.as_slice() + { + locked_vote_tally = Some(sum_tree_value as u32); + } else if identity_bytes.as_slice() + == RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.as_slice() + { + abstaining_vote_tally = Some(sum_tree_value as u32); + } else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "unexpected key for sum tree value".to_string(), + ))); + } + } + Element::Item(serialized_item_info, _) => { + if first_key.as_slice() == &RESOURCE_STORED_INFO_KEY_U8_32 { + // this is the stored info, let's check to see if the vote is over + let finalized_contested_document_vote_poll_stored_info = ContestedDocumentVotePollStoredInfo::deserialize_from_bytes(&serialized_item_info)?; + if finalized_contested_document_vote_poll_stored_info + .vote_poll_status() + .awarded_or_locked() + { + locked_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_locked_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last locked votes" + .to_string(), + ), + ))?, + ); + abstaining_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_abstain_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last abstain votes" + .to_string(), + ), + ))?, + ); + winner = Some(( + finalized_contested_document_vote_poll_stored_info.winner(), + finalized_contested_document_vote_poll_stored_info + .last_finalization_block().ok_or(Error::Drive(DriveError::CorruptedDriveState( + "we should have a last finalization block".to_string(), + )))?, + )); + contenders = finalized_contested_document_vote_poll_stored_info + .contender_votes_in_vec_of_contender_with_serialized_document().ok_or(Error::Drive(DriveError::CorruptedDriveState( + "we should have a last contender votes".to_string(), + )))?; + } + } else { + // We should find a sum tree paired with this document + if let Some(( + path_tally, + second_key, + Element::SumTree(_, sum_tree_value, _), + )) = elements_iter.next() + { + if path != path_tally { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!("the two results in a chunk when requesting documents and vote tally should both have the same path asc, got {}:{}, and {}:{}", path.iter().map(hex::encode).collect::>().join("/"), hex::encode(first_key), path_tally.iter().map(hex::encode).collect::>().join("/"), hex::encode(second_key))))); + } + + if sum_tree_value < 0 + || sum_tree_value > u32::MAX as i64 + { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "sum tree value for vote tally must be between 0 and u32::Max, received {} from state", + sum_tree_value + )))); + } + + let identity_id = + Identifier::from_bytes(identity_bytes)?; + let contender = ContenderWithSerializedDocumentV0 { + identity_id, + serialized_document: Some(serialized_item_info), + vote_tally: Some(sum_tree_value as u32), + } + .into(); + contenders.push(contender); + } else { + return Err(Error::Drive( + DriveError::CorruptedDriveState( + "we should have a sum item after a normal item" + .to_string(), + ), + )); + } + } + } + _ => { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "unexpected element type in result".to_string(), + ))); + } + } + } + + Ok(ContestedDocumentVotePollDriveQueryExecutionResult { + contenders, + locked_vote_tally, + abstaining_vote_tally, + winner, + skipped, + }) + } + } + } + } + } +} diff --git a/packages/rs-drive/src/query/vote_polls_by_document_type_query.rs b/packages/rs-drive/src/query/vote_polls_by_document_type_query.rs new file mode 100644 index 00000000000..f85b882c0a6 --- /dev/null +++ b/packages/rs-drive/src/query/vote_polls_by_document_type_query.rs @@ -0,0 +1,515 @@ +use super::ContractLookupFn; +use crate::drive::votes::paths::vote_contested_resource_contract_documents_indexes_path_vec; +#[cfg(feature = "server")] +use crate::drive::Drive; +use crate::error::contract::DataContractError; +#[cfg(feature = "server")] +use crate::error::drive::DriveError; +use crate::error::query::QuerySyntaxError; +use crate::error::Error; +#[cfg(feature = "server")] +use crate::fees::op::LowLevelDriveOperation; +#[cfg(feature = "server")] +use crate::query::GroveError; +use crate::query::Query; +use crate::util::object_size_info::DataContractResolvedInfo; +#[cfg(feature = "server")] +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::data_contract::document_type::{DocumentTypeRef, Index, IndexProperty}; +use dpp::data_contract::DataContract; +#[cfg(feature = "server")] +use dpp::fee::Credits; +use dpp::identifier::Identifier; +use dpp::platform_value::Value; +#[cfg(feature = "server")] +use grovedb::query_result_type::QueryResultType; +#[cfg(feature = "server")] +use grovedb::TransactionArg; +use grovedb::{PathQuery, SizedQuery}; +use platform_version::version::PlatformVersion; + +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct VotePollsByDocumentTypeQuery { + /// The contract information associated with the document. + pub contract_id: Identifier, + /// The name of the document type. + pub document_type_name: String, + /// The name of the index. + pub index_name: String, + /// All values that are before the missing property number + pub start_index_values: Vec, + /// All values that are after the missing property number + pub end_index_values: Vec, + /// Start at value + pub start_at_value: Option<(Value, bool)>, + /// Limit + pub limit: Option, + /// Ascending + pub order_ascending: bool, +} + +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct ResolvedVotePollsByDocumentTypeQuery<'a> { + /// What vote poll are we asking for? + pub contract: DataContractResolvedInfo<'a>, + /// The name of the document type. + pub document_type_name: &'a String, + /// The name of the index. + pub index_name: &'a String, + /// All values that are before the missing property number + pub start_index_values: &'a Vec, + /// All values that are after the missing property number + pub end_index_values: &'a Vec, + /// Start at value + pub start_at_value: &'a Option<(Value, bool)>, + /// Limit + pub limit: Option, + /// Ascending + pub order_ascending: bool, +} + +impl VotePollsByDocumentTypeQuery { + #[cfg(feature = "server")] + /// Resolves the contested document vote poll drive query. + /// + /// This method processes the query by interacting with the drive, using the provided + /// transaction and platform version to ensure consistency and compatibility. + /// + /// # Parameters + /// + /// * `drive`: A reference to the `Drive` object used for database interactions. + /// * `transaction`: The transaction argument used to ensure consistency during the resolve operation. + /// * `platform_version`: The platform version to ensure compatibility. + /// + /// # Returns + /// + /// * `Ok(ResolvedContestedDocumentVotePollDriveQuery)` - The resolved query information. + /// * `Err(Error)` - An error if the resolution process fails. + /// + /// # Errors + /// + /// This method returns an `Error` variant if there is an issue resolving the query. + /// The specific error depends on the underlying problem encountered during resolution. + pub fn resolve<'a>( + &'a self, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let VotePollsByDocumentTypeQuery { + contract_id, + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value, + limit, + order_ascending, + } = self; + let contract = drive + .fetch_contract( + contract_id.to_buffer(), + None, + None, + transaction, + platform_version, + ) + .unwrap()? + .ok_or(Error::DataContract(DataContractError::MissingContract( + "data contract not found when resolving vote polls by document type query" + .to_string(), + )))?; + + Ok(ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::ArcDataContractFetchInfo(contract), + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value, + limit: *limit, + order_ascending: *order_ascending, + }) + } + + /// Resolves with a known contract provider + pub fn resolve_with_known_contracts_provider( + &self, + known_contracts_provider_fn: &ContractLookupFn, + ) -> Result { + let VotePollsByDocumentTypeQuery { + contract_id, + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value, + limit, + order_ascending, + } = self; + let contract = known_contracts_provider_fn(contract_id)?.ok_or(Error::DataContract( + DataContractError::MissingContract(format!( + "data contract with id {} can not be provided", + contract_id + )), + ))?; + + Ok(ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::ArcDataContract(contract), + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value, + limit: *limit, + order_ascending: *order_ascending, + }) + } + + /// Resolves with a provided borrowed contract + pub fn resolve_with_provided_borrowed_contract<'a>( + &'a self, + data_contract: &'a DataContract, + ) -> Result, Error> { + let VotePollsByDocumentTypeQuery { + contract_id, + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value, + limit, + order_ascending, + } = self; + if contract_id != data_contract.id_ref() { + return Err(Error::DataContract( + DataContractError::ProvidedContractMismatch(format!( + "data contract provided {} is not the one required {}", + data_contract.id_ref(), + contract_id + )), + )); + } + Ok(ResolvedVotePollsByDocumentTypeQuery { + contract: DataContractResolvedInfo::BorrowedDataContract(data_contract), + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value, + limit: *limit, + order_ascending: *order_ascending, + }) + } + + #[cfg(feature = "server")] + /// Executes an internal query with proof and returns the items. + pub fn execute_with_proof( + self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let resolved = self.resolve(drive, transaction, platform_version)?; + resolved.execute_with_proof(drive, transaction, drive_operations, platform_version) + } + #[cfg(feature = "server")] + /// Executes a query with no proof and returns the items, skipped items, and fee. + pub fn execute_no_proof_with_cost( + &self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Vec, Credits), Error> { + let mut drive_operations = vec![]; + let result = + self.execute_no_proof(drive, transaction, &mut drive_operations, platform_version)?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((result, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with no proof and returns the values and skipped items. + pub fn execute_no_proof( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let resolved = self.resolve(drive, transaction, platform_version)?; + resolved.execute_no_proof(drive, transaction, drive_operations, platform_version) + } +} + +impl<'a> ResolvedVotePollsByDocumentTypeQuery<'a> { + pub(crate) fn document_type(&self) -> Result { + Ok(self + .contract + .as_ref() + .document_type_for_name(self.document_type_name.as_str())?) + } + pub(crate) fn index(&self) -> Result<&Index, Error> { + let index = self + .contract + .as_ref() + .document_type_borrowed_for_name(self.document_type_name.as_str())? + .find_contested_index() + .ok_or(Error::Query(QuerySyntaxError::UnknownIndex(format!( + "document type {} does not have a contested index", + self.document_type_name.as_str() + ))))?; + if index.name.as_str() != self.index_name.as_str() { + return Err(Error::Query(QuerySyntaxError::UnknownIndex(format!( + "index with name {} is not the contested index on the document type {}, {} is the name of the only contested index (contested resources query)", + self.index_name.as_str(), self.document_type_name.as_str(), &index.name + )))); + } + Ok(index) + } + + /// Creates the vectors of indexes + fn indexes_vectors<'b>( + &self, + index: &'b Index, + platform_version: &PlatformVersion, + ) -> Result<(Vec>, Vec>, &'b IndexProperty), Error> { + let document_type = self.document_type()?; + let properties_iter = index.properties.iter(); + let mut start_values_iter = self.start_index_values.iter(); + let has_end_index_values = !self.end_index_values.is_empty(); + let mut end_values_iter = self.end_index_values.iter(); + let mut start_values_vec = vec![]; + let mut end_values_vec = vec![]; + let mut ended_start_values = false; + let mut middle_index_property = None; + for index_property in properties_iter { + if !ended_start_values { + if let Some(start_value) = start_values_iter.next() { + let encoded = document_type.serialize_value_for_key( + &index_property.name, + start_value, + platform_version, + )?; + start_values_vec.push(encoded); + } else { + ended_start_values = true; + middle_index_property = Some(index_property); + } + } else if let Some(end_value) = end_values_iter.next() { + let encoded = document_type.serialize_value_for_key( + &index_property.name, + end_value, + platform_version, + )?; + end_values_vec.push(encoded); + } else { + break; + } + } + if end_values_iter.next().is_some() { + return Err(Error::Query(QuerySyntaxError::IndexValuesError( + "too many end index values were provided".to_string(), + ))); + } + let middle_index_property = middle_index_property.ok_or_else(|| { + let error_msg = if has_end_index_values { + "since end index values were provided, the start index values and the end index values must be equal to the amount of properties in the contested index minus one, we could not find a middle property".to_string() + } else { + "too many start index values were provided, since no end index values were provided, the start index values must be less than the amount of properties in the contested index".to_string() + }; + Error::Query(QuerySyntaxError::IndexValuesError(error_msg)) + })?; + Ok((start_values_vec, end_values_vec, middle_index_property)) + } + + pub(crate) fn property_name_being_searched( + &self, + index: &'a Index, + ) -> Result<&'a IndexProperty, Error> { + let offset = self.start_index_values.len(); + index + .properties + .get(offset) + .ok_or(Error::Query(QuerySyntaxError::IndexValuesError(format!( + "there are too many start index values to be able to make a search max is {}, got {}", + index.properties.len() - 1, + offset + )))) + } + + pub(crate) fn result_is_in_key(&self) -> bool { + // this means that the keys are the values that we are interested in + self.end_index_values.is_empty() + } + + pub(crate) fn result_path_index(&self) -> usize { + // 6 because of: + // voting sub tree (112) + // contested ('c') + // voting part + // contract id + // document type name + // 1 + 6 + self.start_index_values.len() + } + + /// Operations to construct a path query. + pub(crate) fn construct_path_query( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let index = self.index()?; + self.construct_path_query_with_known_index(index, platform_version) + } + + /// Operations to construct a path query. + pub(crate) fn construct_path_query_with_known_index( + &self, + index: &Index, + platform_version: &PlatformVersion, + ) -> Result { + let mut path = vote_contested_resource_contract_documents_indexes_path_vec( + self.contract.id().as_ref(), + self.document_type_name, + ); + + let (mut start, end, middle_property) = self.indexes_vectors(index, platform_version)?; + + if !start.is_empty() { + path.append(&mut start); + } + + let mut query = Query::new_with_direction(self.order_ascending); + + // this is a range on all elements + match &self.start_at_value { + None => { + query.insert_all(); + } + Some((starts_at_key_bytes, start_at_included)) => { + let starts_at_key = self.document_type()?.serialize_value_for_key( + &middle_property.name, + starts_at_key_bytes, + platform_version, + )?; + + match self.order_ascending { + true => match start_at_included { + true => query.insert_range_from(starts_at_key..), + false => query.insert_range_after(starts_at_key..), + }, + false => match start_at_included { + true => query.insert_range_to_inclusive(..=starts_at_key), + false => query.insert_range_to(..starts_at_key), + }, + } + } + } + + if !end.is_empty() { + query.default_subquery_branch.subquery_path = Some(end); + } + + Ok(PathQuery { + path, + query: SizedQuery { + query, + limit: self.limit, + offset: None, + }, + }) + } + + #[cfg(feature = "server")] + /// Executes an internal query with proof and returns the items. + pub fn execute_with_proof( + self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let path_query = self.construct_path_query(platform_version)?; + drive.grove_get_proved_path_query( + &path_query, + transaction, + drive_operations, + &platform_version.drive, + ) + } + + #[cfg(feature = "server")] + /// Executes an internal query with no proof and returns the values and skipped items. + pub fn execute_no_proof( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let index = self.index()?; + let path_query = self.construct_path_query_with_known_index(index, platform_version)?; + let query_result = drive.grove_get_raw_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => Ok(vec![]), + Err(e) => Err(e), + Ok((query_result_elements, _)) => { + let result_is_in_key = self.result_is_in_key(); + let result_path_index = if result_is_in_key { + None + } else { + Some(self.result_path_index()) + }; + let document_type = self.document_type()?; + let property_name_being_searched = self.property_name_being_searched(index)?; + query_result_elements.to_path_key_elements() + .into_iter() + .map(|(mut path, key, _)| { + if result_is_in_key { + // the result is in the key because we did not provide any end index values + // like this <------ start index values (path) ---> Key + // properties ------- --------- --------- ---------- ------- + document_type.deserialize_value_for_key(property_name_being_searched.name.as_str(), key.as_slice(), platform_version).map_err(Error::Protocol) + } else if path.len() < result_path_index.unwrap() { + + Err(Error::Drive(DriveError::CorruptedCodeExecution("the path length should always be bigger or equal to the result path index"))) + } else { + // the result is in the path because we did provide end index values + // like this <------ start index values (path) ---> Key + // properties ------- --------- --------- ---------- ------- + let inner_path_value_bytes = path.remove(result_path_index.unwrap()); + document_type.deserialize_value_for_key(property_name_being_searched.name.as_str(), inner_path_value_bytes.as_slice(), platform_version).map_err(Error::Protocol) + } + }).collect::, Error>>() + } + } + } +} diff --git a/packages/rs-drive/src/query/vote_polls_by_end_date_query.rs b/packages/rs-drive/src/query/vote_polls_by_end_date_query.rs new file mode 100644 index 00000000000..0fc4a1ca9fd --- /dev/null +++ b/packages/rs-drive/src/query/vote_polls_by_end_date_query.rs @@ -0,0 +1,402 @@ +use crate::drive::votes::paths::vote_end_date_queries_tree_path_vec; +use crate::drive::Drive; +#[cfg(feature = "server")] +use crate::error::drive::DriveError; +use crate::error::Error; +#[cfg(feature = "server")] +use crate::fees::op::LowLevelDriveOperation; +#[cfg(feature = "server")] +use crate::query::GroveError; +use crate::query::Query; +use crate::util::common::encode::{decode_u64, encode_u64}; +#[cfg(feature = "server")] +use dpp::block::block_info::BlockInfo; +#[cfg(feature = "server")] +use dpp::fee::Credits; +use dpp::prelude::{TimestampIncluded, TimestampMillis}; +#[cfg(feature = "server")] +use dpp::serialization::PlatformDeserializable; +#[cfg(feature = "server")] +use dpp::voting::vote_polls::VotePoll; +#[cfg(feature = "server")] +use grovedb::query_result_type::{QueryResultElements, QueryResultType}; +#[cfg(feature = "server")] +use grovedb::TransactionArg; +use grovedb::{PathQuery, SizedQuery}; +#[cfg(feature = "server")] +use platform_version::version::PlatformVersion; +#[cfg(feature = "server")] +use std::collections::BTreeMap; + +/// Vote Poll Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct VotePollsByEndDateDriveQuery { + /// What is the start time we are asking for + pub start_time: Option<(TimestampMillis, TimestampIncluded)>, + /// What vote poll are we asking for? + pub end_time: Option<(TimestampMillis, TimestampIncluded)>, + /// Limit + pub limit: Option, + /// Offset + pub offset: Option, + /// Ascending + pub order_ascending: bool, +} + +impl VotePollsByEndDateDriveQuery { + /// Get the path query for an abci query that gets vote polls by the end time + pub fn path_query_for_end_time_included(end_time: TimestampMillis, limit: u16) -> PathQuery { + let path = vote_end_date_queries_tree_path_vec(); + + let mut query = Query::new_with_direction(true); + + let encoded_time = encode_u64(end_time); + + query.insert_range_to_inclusive(..=encoded_time); + + let mut sub_query = Query::new(); + + sub_query.insert_all(); + + query.default_subquery_branch.subquery = Some(sub_query.into()); + + PathQuery { + path, + query: SizedQuery { + query, + limit: Some(limit), + offset: None, + }, + } + } + + #[cfg(feature = "server")] + /// Executes a special query with no proof to get contested document resource vote polls. + /// This is meant for platform abci to get votes that have finished + pub fn execute_no_proof_for_specialized_end_time_query( + end_time: TimestampMillis, + limit: u16, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + let path_query = Self::path_query_for_end_time_included(end_time, limit); + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => Ok(BTreeMap::new()), + Err(e) => Err(e), + Ok((query_result_elements, _)) => { + let vote_polls_by_end_date = query_result_elements + .to_path_key_elements() + .into_iter() + .map(|(path, _, element)| { + let Some(last_path_component) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "we should always have a path not be null".to_string(), + ))); + }; + let timestamp = decode_u64(last_path_component).map_err(Error::from)?; + let contested_document_resource_vote_poll_bytes = + element.into_item_bytes().map_err(Error::from)?; + let vote_poll = VotePoll::deserialize_from_bytes( + &contested_document_resource_vote_poll_bytes, + )?; + Ok((timestamp, vote_poll)) + }) + .collect::, Error>>()? + .into_iter() + .fold( + BTreeMap::new(), + |mut acc: BTreeMap>, (timestamp, vote_poll)| { + acc.entry(timestamp).or_default().push(vote_poll); + acc + }, + ); + Ok(vote_polls_by_end_date) + } + } + } + + /// Operations to construct a path query. + pub fn construct_path_query(&self) -> PathQuery { + let path = vote_end_date_queries_tree_path_vec(); + + let mut query = Query::new_with_direction(self.order_ascending); + + // this is a range on all elements + match &(self.start_time, self.end_time) { + (None, None) => { + query.insert_all(); + } + (Some((starts_at_key_bytes, start_at_included)), None) => { + let starts_at_key = encode_u64(*starts_at_key_bytes); + match start_at_included { + true => query.insert_range_from(starts_at_key..), + false => query.insert_range_after(starts_at_key..), + } + } + (None, Some((ends_at_key_bytes, ends_at_included))) => { + let ends_at_key = encode_u64(*ends_at_key_bytes); + match ends_at_included { + true => query.insert_range_to_inclusive(..=ends_at_key), + false => query.insert_range_to(..ends_at_key), + } + } + ( + Some((starts_at_key_bytes, start_at_included)), + Some((ends_at_key_bytes, ends_at_included)), + ) => { + let starts_at_key = encode_u64(*starts_at_key_bytes); + let ends_at_key = encode_u64(*ends_at_key_bytes); + match (start_at_included, ends_at_included) { + (true, true) => query.insert_range_inclusive(starts_at_key..=ends_at_key), + (true, false) => query.insert_range(starts_at_key..ends_at_key), + (false, true) => { + query.insert_range_after_to_inclusive(starts_at_key..=ends_at_key) + } + (false, false) => query.insert_range_after_to(starts_at_key..ends_at_key), + } + } + } + + let mut sub_query = Query::new(); + + sub_query.insert_all(); + + query.default_subquery_branch.subquery = Some(sub_query.into()); + + PathQuery { + path, + query: SizedQuery { + query, + limit: self.limit, + offset: None, + }, + } + } + #[cfg(feature = "server")] + /// Executes a query with proof and returns the items and fee. + pub fn execute_with_proof( + self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Vec, u64), Error> { + let mut drive_operations = vec![]; + let items = self.execute_with_proof_internal( + drive, + transaction, + &mut drive_operations, + platform_version, + )?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((items, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with proof and returns the items. + pub(crate) fn execute_with_proof_internal( + self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let path_query = self.construct_path_query(); + drive.grove_get_proved_path_query( + &path_query, + transaction, + drive_operations, + &platform_version.drive, + ) + } + #[cfg(feature = "server")] + /// Executes a query with no proof and returns the items, skipped items, and fee. + pub fn execute_no_proof_with_cost( + &self, + drive: &Drive, + block_info: Option, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(BTreeMap>, Credits), Error> { + let mut drive_operations = vec![]; + let result = + self.execute_no_proof(drive, transaction, &mut drive_operations, platform_version)?; + let cost = if let Some(block_info) = block_info { + let fee_result = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + drive.config.epochs_per_era, + platform_version, + None, + )?; + fee_result.processing_fee + } else { + 0 + }; + Ok((result, cost)) + } + + #[cfg(feature = "server")] + /// Executes an internal query with no proof and returns the values and skipped items. + pub fn execute_no_proof( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + let path_query = self.construct_path_query(); + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => Ok(BTreeMap::new()), + Err(e) => Err(e), + Ok((query_result_elements, _)) => { + let vote_polls_by_end_date = query_result_elements + .to_path_key_elements() + .into_iter() + .map(|(path, _, element)| { + let Some(last_path_component) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "we should always have a path not be null".to_string(), + ))); + }; + let timestamp = decode_u64(last_path_component).map_err(Error::from)?; + let contested_document_resource_vote_poll_bytes = + element.into_item_bytes().map_err(Error::from)?; + let vote_poll = VotePoll::deserialize_from_bytes( + &contested_document_resource_vote_poll_bytes, + )?; + Ok((timestamp, vote_poll)) + }) + .collect::, Error>>()? + .into_iter() + .fold( + BTreeMap::new(), + |mut acc: BTreeMap>, (timestamp, vote_poll)| { + acc.entry(timestamp).or_default().push(vote_poll); + acc + }, + ); + Ok(vote_polls_by_end_date) + } + } + } + + #[cfg(feature = "server")] + /// Executes an internal query with no proof and returns the values and skipped items. + pub fn execute_no_proof_keep_serialized( + &self, + drive: &Drive, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result>>, Error> { + let path_query = self.construct_path_query(); + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + QueryResultType::QueryPathKeyElementTrioResultType, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => Ok(BTreeMap::new()), + Err(e) => Err(e), + Ok((query_result_elements, _)) => { + let vote_polls_by_end_date = query_result_elements + .to_path_key_elements() + .into_iter() + .map(|(path, _, element)| { + let Some(last_path_component) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "we should always have a path not be null".to_string(), + ))); + }; + let timestamp = decode_u64(last_path_component).map_err(Error::from)?; + let contested_document_resource_vote_poll_bytes = + element.into_item_bytes().map_err(Error::from)?; + Ok((timestamp, contested_document_resource_vote_poll_bytes)) + }) + .collect::, Error>>()? + .into_iter() + .fold( + BTreeMap::new(), + |mut acc: BTreeMap>>, + (timestamp, vote_poll_serialized)| { + acc.entry(timestamp).or_default().push(vote_poll_serialized); + acc + }, + ); + Ok(vote_polls_by_end_date) + } + } + } + + #[cfg(feature = "server")] + #[allow(unused)] + /// Executes an internal query with no proof and returns the values and skipped items. + pub(crate) fn execute_no_proof_internal( + &self, + drive: &Drive, + result_type: QueryResultType, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result { + let path_query = self.construct_path_query(); + let query_result = drive.grove_get_path_query( + &path_query, + transaction, + result_type, + drive_operations, + &platform_version.drive, + ); + match query_result { + Err(Error::GroveDB(GroveError::PathKeyNotFound(_))) + | Err(Error::GroveDB(GroveError::PathNotFound(_))) + | Err(Error::GroveDB(GroveError::PathParentLayerNotFound(_))) => { + Ok(QueryResultElements::new()) + } + _ => { + let (data, _) = query_result?; + { + Ok(data) + } + } + } + } +} diff --git a/packages/rs-drive/src/query/vote_query.rs b/packages/rs-drive/src/query/vote_query.rs new file mode 100644 index 00000000000..e6fb7863c5f --- /dev/null +++ b/packages/rs-drive/src/query/vote_query.rs @@ -0,0 +1,32 @@ +use crate::drive::votes::paths::vote_contested_resource_identity_votes_tree_path_for_identity_vec; +use crate::error::Error; +use crate::query::Query; +use dpp::identifier::Identifier; +use dpp::voting::vote_polls::VotePoll; +use grovedb::{PathQuery, SizedQuery}; + +/// Vote Drive Query struct +#[derive(Debug, PartialEq, Clone)] +pub struct IdentityBasedVoteDriveQuery { + /// The identity who would have made the vote + pub identity_id: Identifier, + /// What vote poll are we asking for? + pub vote_poll: VotePoll, +} + +impl IdentityBasedVoteDriveQuery { + /// Operations to construct a path query. + pub fn construct_path_query(&self) -> Result { + // First we should get the overall document_type_path + let path = vote_contested_resource_identity_votes_tree_path_for_identity_vec( + self.identity_id.as_bytes(), + ); + + let vote_id = self.vote_poll.unique_id()?; + + let mut query = Query::new(); + query.insert_key(vote_id.to_vec()); + + Ok(PathQuery::new(path, SizedQuery::new(query, Some(1), None))) + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/data_contract_create_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/data_contract_create_transition.rs new file mode 100644 index 00000000000..530e0b6109e --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/data_contract_create_transition.rs @@ -0,0 +1,53 @@ +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::state_transition_action::contract::data_contract_create::DataContractCreateTransitionAction; +use crate::util::batch::DriveOperation::{DataContractOperation, IdentityOperation}; +use crate::util::batch::{DataContractOperationType, DriveOperation, IdentityOperationType}; +use dpp::block::epoch::Epoch; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::version::PlatformVersion; +use std::borrow::Cow; + +impl DriveHighLevelOperationConverter for DataContractCreateTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .data_contract_create_transition + { + 0 => { + Ok(vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityNonce { + identity_id: self.data_contract_ref().owner_id().into_buffer(), + nonce: self.identity_nonce(), + }), + // We should add an identity contract nonce now to make it so there are no additional + // bytes used later for bumping the identity data contract nonce for updating the + // contract + IdentityOperation(IdentityOperationType::UpdateIdentityContractNonce { + identity_id: self.data_contract_ref().owner_id().into_buffer(), + contract_id: self.data_contract_ref().id().into_buffer(), + nonce: 1, + }), + DataContractOperation(DataContractOperationType::ApplyContract { + contract: Cow::Owned(self.data_contract()), + storage_flags: None, + }), + ]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "DataContractCreateTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/data_contract_update_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/data_contract_update_transition.rs new file mode 100644 index 00000000000..1fc1b5fd402 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/data_contract_update_transition.rs @@ -0,0 +1,47 @@ +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::state_transition_action::contract::data_contract_update::DataContractUpdateTransitionAction; +use crate::util::batch::DriveOperation::{DataContractOperation, IdentityOperation}; +use crate::util::batch::{DataContractOperationType, DriveOperation, IdentityOperationType}; +use dpp::block::epoch::Epoch; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::version::PlatformVersion; +use std::borrow::Cow; + +impl DriveHighLevelOperationConverter for DataContractUpdateTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .data_contract_update_transition + { + 0 => { + Ok(vec![ + // We must create the contract + IdentityOperation(IdentityOperationType::UpdateIdentityContractNonce { + identity_id: self.data_contract_ref().owner_id().into_buffer(), + contract_id: self.data_contract_ref().id().into_buffer(), + nonce: self.identity_contract_nonce(), + }), + DataContractOperation(DataContractOperationType::ApplyContract { + contract: Cow::Owned(self.data_contract()), + storage_flags: None, + }), + ]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "DataContractUpdateTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/batch/transitions/contract/mod.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/batch/transitions/contract/mod.rs rename to packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/mod.rs diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_create_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_create_transition.rs new file mode 100644 index 00000000000..96c16ed9e36 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_create_transition.rs @@ -0,0 +1,135 @@ +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; +use crate::util::batch::DriveOperation::{ + DocumentOperation, IdentityOperation, PrefundedSpecializedBalanceOperation, +}; +use crate::util::batch::{DocumentOperationType, DriveOperation, IdentityOperationType}; +use crate::util::object_size_info::DocumentInfo::DocumentOwnedInfo; +use crate::util::object_size_info::{DocumentTypeInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; +use dpp::block::epoch::Epoch; + +use dpp::document::Document; +use dpp::prelude::Identifier; +use std::borrow::Cow; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::{DocumentCreateTransitionAction, DocumentCreateTransitionActionAccessorsV0, DocumentFromCreateTransitionAction}; +use dpp::version::PlatformVersion; +use crate::util::batch::drive_op_batch::PrefundedSpecializedBalanceOperationType; +use crate::util::object_size_info::DataContractInfo::DataContractFetchInfo; +use crate::error::drive::DriveError; + +impl DriveHighLevelDocumentOperationConverter for DocumentCreateTransitionAction { + fn into_high_level_document_drive_operations<'b>( + mut self, + epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .document_create_transition + { + 0 => { + let data_contract_id = self.base().data_contract_id(); + + let contract_fetch_info = self.base().data_contract_fetch_info(); + + let document_type_name = self.base().document_type_name().clone(); + + let identity_contract_nonce = self.base().identity_contract_nonce(); + + let maybe_prefunded_voting_balance = self.take_prefunded_voting_balance(); + + let also_insert_vote_poll_stored_info = self.take_should_store_contest_info(); + + let document = Document::try_from_owned_create_transition_action( + self, + owner_id, + platform_version, + )?; + + let storage_flags = + StorageFlags::new_single_epoch(epoch.index, Some(owner_id.to_buffer())); + + let mut ops = vec![IdentityOperation( + IdentityOperationType::UpdateIdentityContractNonce { + identity_id: owner_id.into_buffer(), + contract_id: data_contract_id.into_buffer(), + nonce: identity_contract_nonce, + }, + )]; + + if let Some((contested_document_resource_vote_poll, credits)) = + maybe_prefunded_voting_balance + { + let prefunded_specialized_balance_id = + contested_document_resource_vote_poll.specialized_balance_id()?; + // We are in the situation of a contested document + // We prefund the voting balances first + ops.push(PrefundedSpecializedBalanceOperation( + PrefundedSpecializedBalanceOperationType::CreateNewPrefundedBalance { + prefunded_specialized_balance_id, + add_balance: credits, + }, + )); + + // We remove from the identity balance an equal amount + ops.push(IdentityOperation( + IdentityOperationType::RemoveFromIdentityBalance { + identity_id: owner_id.into_buffer(), + balance_to_remove: credits, + }, + )); + + // We add the contested document + // The contested document resides in a special location in grovedb until a time where the + // resolution expires, at that point it either will be moved to + ops.push(DocumentOperation( + DocumentOperationType::AddContestedDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo(( + document, + Some(Cow::Owned(storage_flags)), + )), + owner_id: Some(owner_id.into_buffer()), + }, + contested_document_resource_vote_poll, + contract_info: DataContractFetchInfo(contract_fetch_info), + document_type_info: DocumentTypeInfo::DocumentTypeName( + document_type_name, + ), + insert_without_check: false, //todo: consider setting to true + also_insert_vote_poll_stored_info, + }, + )); + } else { + // Just add the document + ops.push(DocumentOperation(DocumentOperationType::AddDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo(( + document, + Some(Cow::Owned(storage_flags)), + )), + owner_id: Some(owner_id.into_buffer()), + }, + contract_info: DataContractFetchInfo(contract_fetch_info), + document_type_info: DocumentTypeInfo::DocumentTypeName(document_type_name), + override_document: false, + })); + } + + Ok(ops) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "DocumentCreateTransitionAction::into_high_level_document_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_delete_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_delete_transition.rs new file mode 100644 index 00000000000..799f5857784 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_delete_transition.rs @@ -0,0 +1,63 @@ +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; + +use crate::util::batch::DriveOperation::{DocumentOperation, IdentityOperation}; +use crate::util::batch::{DocumentOperationType, DriveOperation, IdentityOperationType}; + +use crate::error::Error; +use dpp::block::epoch::Epoch; + +use dpp::identifier::Identifier; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; +use crate::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; +use dpp::version::PlatformVersion; +use crate::util::object_size_info::{DataContractInfo, DocumentTypeInfo}; +use crate::error::drive::DriveError; + +impl DriveHighLevelDocumentOperationConverter for DocumentDeleteTransitionAction { + fn into_high_level_document_drive_operations<'b>( + self, + _epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .document_delete_transition + { + 0 => { + let base = self.base_owned(); + + let data_contract_id = base.data_contract_id(); + + let identity_contract_nonce = base.identity_contract_nonce(); + + Ok(vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityContractNonce { + identity_id: owner_id.into_buffer(), + contract_id: data_contract_id.into_buffer(), + nonce: identity_contract_nonce, + }), + DocumentOperation(DocumentOperationType::DeleteDocument { + document_id: base.id(), + contract_info: DataContractInfo::DataContractFetchInfo( + base.data_contract_fetch_info(), + ), + document_type_info: DocumentTypeInfo::DocumentTypeName( + base.document_type_name_owned(), + ), + }), + ]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "DocumentDeleteTransitionAction::into_high_level_document_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_purchase_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_purchase_transition.rs new file mode 100644 index 00000000000..3634442c282 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_purchase_transition.rs @@ -0,0 +1,85 @@ +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; +use crate::util::batch::DriveOperation::{DocumentOperation, IdentityOperation}; +use crate::util::batch::{DocumentOperationType, DriveOperation, IdentityOperationType}; +use crate::util::object_size_info::DocumentInfo::DocumentOwnedInfo; +use crate::util::object_size_info::{DataContractInfo, DocumentTypeInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; +use dpp::block::epoch::Epoch; + +use dpp::prelude::Identifier; +use std::borrow::Cow; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::drive::DriveError; + +impl DriveHighLevelDocumentOperationConverter for DocumentPurchaseTransitionAction { + fn into_high_level_document_drive_operations<'b>( + self, + epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .document_purchase_transition + { + 0 => { + let data_contract_id = self.base().data_contract_id(); + let document_type_name = self.base().document_type_name().clone(); + let identity_contract_nonce = self.base().identity_contract_nonce(); + let original_owner_id = self.original_owner_id(); + let purchase_amount = self.price(); + let contract_fetch_info = self.base().data_contract_fetch_info(); + let document = self.document_owned(); + + // we are purchasing the document so the new storage flags should be on the new owner + + let new_document_owner_id = owner_id; + + let storage_flags = StorageFlags::new_single_epoch( + epoch.index, + Some(new_document_owner_id.to_buffer()), + ); + + Ok(vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityContractNonce { + identity_id: owner_id.into_buffer(), + contract_id: data_contract_id.into_buffer(), + nonce: identity_contract_nonce, + }), + DocumentOperation(DocumentOperationType::UpdateDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo(( + document, + Some(Cow::Owned(storage_flags)), + )), + owner_id: Some(new_document_owner_id.into_buffer()), + }, + contract_info: DataContractInfo::DataContractFetchInfo(contract_fetch_info), + document_type_info: DocumentTypeInfo::DocumentTypeName(document_type_name), + }), + IdentityOperation(IdentityOperationType::RemoveFromIdentityBalance { + identity_id: owner_id.to_buffer(), + balance_to_remove: purchase_amount, + }), + IdentityOperation(IdentityOperationType::AddToIdentityBalance { + identity_id: original_owner_id.to_buffer(), + added_balance: purchase_amount, + }), + ]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: + "DocumentPurchaseTransitionAction::into_high_level_document_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_replace_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_replace_transition.rs new file mode 100644 index 00000000000..19fb9febacf --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_replace_transition.rs @@ -0,0 +1,74 @@ +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; +use crate::util::batch::DriveOperation::{DocumentOperation, IdentityOperation}; +use crate::util::batch::{DocumentOperationType, DriveOperation, IdentityOperationType}; +use crate::util::object_size_info::DocumentInfo::DocumentOwnedInfo; +use crate::util::object_size_info::{DataContractInfo, DocumentTypeInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; +use dpp::block::epoch::Epoch; + +use dpp::document::Document; +use dpp::prelude::Identifier; +use std::borrow::Cow; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentFromReplaceTransitionAction, DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::drive::DriveError; + +impl DriveHighLevelDocumentOperationConverter for DocumentReplaceTransitionAction { + fn into_high_level_document_drive_operations<'b>( + self, + epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .document_replace_transition + { + 0 => { + let data_contract_id = self.base().data_contract_id(); + let document_type_name = self.base().document_type_name().clone(); + let identity_contract_nonce = self.base().identity_contract_nonce(); + let contract_fetch_info = self.base().data_contract_fetch_info(); + let document = Document::try_from_owned_replace_transition_action( + self, + owner_id, + platform_version, + )?; + + let storage_flags = + StorageFlags::new_single_epoch(epoch.index, Some(owner_id.to_buffer())); + + Ok(vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityContractNonce { + identity_id: owner_id.into_buffer(), + contract_id: data_contract_id.into_buffer(), + nonce: identity_contract_nonce, + }), + DocumentOperation(DocumentOperationType::UpdateDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo(( + document, + Some(Cow::Owned(storage_flags)), + )), + owner_id: Some(owner_id.into_buffer()), + }, + contract_info: DataContractInfo::DataContractFetchInfo(contract_fetch_info), + document_type_info: DocumentTypeInfo::DocumentTypeName(document_type_name), + }), + ]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: + "DocumentReplaceTransitionAction::into_high_level_document_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_transfer_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_transfer_transition.rs new file mode 100644 index 00000000000..67ea0f3bd1d --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_transfer_transition.rs @@ -0,0 +1,76 @@ +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; +use crate::util::batch::DriveOperation::{DocumentOperation, IdentityOperation}; +use crate::util::batch::{DocumentOperationType, DriveOperation, IdentityOperationType}; +use crate::util::object_size_info::DocumentInfo::DocumentOwnedInfo; +use crate::util::object_size_info::{DataContractInfo, DocumentTypeInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; +use dpp::block::epoch::Epoch; + +use dpp::document::DocumentV0Getters; +use dpp::prelude::Identifier; +use std::borrow::Cow; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::drive::DriveError; + +impl DriveHighLevelDocumentOperationConverter for DocumentTransferTransitionAction { + fn into_high_level_document_drive_operations<'b>( + self, + epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .document_transfer_transition + { + 0 => { + let data_contract_id = self.base().data_contract_id(); + let document_type_name = self.base().document_type_name().clone(); + let identity_contract_nonce = self.base().identity_contract_nonce(); + let contract_fetch_info = self.base().data_contract_fetch_info(); + let document = self.document_owned(); + + // we are transferring the document so the new storage flags should be on the new owner + + let new_document_owner_id = document.owner_id(); + + let storage_flags = StorageFlags::new_single_epoch( + epoch.index, + Some(new_document_owner_id.to_buffer()), + ); + + Ok(vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityContractNonce { + identity_id: owner_id.into_buffer(), + contract_id: data_contract_id.into_buffer(), + nonce: identity_contract_nonce, + }), + DocumentOperation(DocumentOperationType::UpdateDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo(( + document, + Some(Cow::Owned(storage_flags)), + )), + owner_id: Some(new_document_owner_id.into_buffer()), + }, + contract_info: DataContractInfo::DataContractFetchInfo(contract_fetch_info), + document_type_info: DocumentTypeInfo::DocumentTypeName(document_type_name), + }), + ]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: + "DocumentTransferTransitionAction::into_high_level_document_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_transition.rs new file mode 100644 index 00000000000..38d4baf3ca2 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_transition.rs @@ -0,0 +1,66 @@ +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; +use crate::util::batch::DriveOperation; +use dpp::block::epoch::Epoch; +use dpp::prelude::Identifier; +use dpp::version::PlatformVersion; + +impl DriveHighLevelDocumentOperationConverter for DocumentTransitionAction { + fn into_high_level_document_drive_operations<'b>( + self, + epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match self { + DocumentTransitionAction::CreateAction(document_create_transition) => { + document_create_transition.into_high_level_document_drive_operations( + epoch, + owner_id, + platform_version, + ) + } + DocumentTransitionAction::ReplaceAction(document_replace_transition) => { + document_replace_transition.into_high_level_document_drive_operations( + epoch, + owner_id, + platform_version, + ) + } + DocumentTransitionAction::DeleteAction(document_delete_transition) => { + document_delete_transition.into_high_level_document_drive_operations( + epoch, + owner_id, + platform_version, + ) + } + DocumentTransitionAction::TransferAction(document_transfer_transition) => { + document_transfer_transition.into_high_level_document_drive_operations( + epoch, + owner_id, + platform_version, + ) + } + DocumentTransitionAction::PurchaseAction(document_purchase_transition) => { + document_purchase_transition.into_high_level_document_drive_operations( + epoch, + owner_id, + platform_version, + ) + } + DocumentTransitionAction::UpdatePriceAction(document_update_price_transition) => { + document_update_price_transition.into_high_level_document_drive_operations( + epoch, + owner_id, + platform_version, + ) + } + DocumentTransitionAction::BumpIdentityDataContractNonce( + bump_identity_contract_nonce_action, + ) => bump_identity_contract_nonce_action + .into_high_level_drive_operations(epoch, platform_version), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_update_price_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_update_price_transition.rs new file mode 100644 index 00000000000..abea0ffa630 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/document_update_price_transition.rs @@ -0,0 +1,69 @@ +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; +use crate::util::batch::DriveOperation::{DocumentOperation, IdentityOperation}; +use crate::util::batch::{DocumentOperationType, DriveOperation, IdentityOperationType}; +use crate::util::object_size_info::DocumentInfo::DocumentOwnedInfo; +use crate::util::object_size_info::{DataContractInfo, DocumentTypeInfo, OwnedDocumentInfo}; +use crate::util::storage_flags::StorageFlags; +use dpp::block::epoch::Epoch; + +use dpp::prelude::Identifier; +use std::borrow::Cow; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::drive::DriveError; + +impl DriveHighLevelDocumentOperationConverter for DocumentUpdatePriceTransitionAction { + fn into_high_level_document_drive_operations<'b>( + self, + epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .document_update_price_transition + { + 0 => { + let data_contract_id = self.base().data_contract_id(); + let document_type_name = self.base().document_type_name().clone(); + let identity_contract_nonce = self.base().identity_contract_nonce(); + let fetch_info = self.base().data_contract_fetch_info(); + let document = self.document_owned(); + + let storage_flags = + StorageFlags::new_single_epoch(epoch.index, Some(owner_id.to_buffer())); + + Ok(vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityContractNonce { + identity_id: owner_id.into_buffer(), + contract_id: data_contract_id.into_buffer(), + nonce: identity_contract_nonce, + }), + DocumentOperation(DocumentOperationType::UpdateDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo(( + document, + Some(Cow::Owned(storage_flags)), + )), + owner_id: Some(owner_id.into_buffer()), + }, + contract_info: DataContractInfo::DataContractFetchInfo(fetch_info), + document_type_info: DocumentTypeInfo::DocumentTypeName(document_type_name), + }), + ]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: + "DocumentUpdatePriceTransitionAction::into_high_level_document_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/documents_batch_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/documents_batch_transition.rs new file mode 100644 index 00000000000..eb1371efc27 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/documents_batch_transition.rs @@ -0,0 +1,48 @@ +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::document::DriveHighLevelDocumentOperationConverter; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; +use crate::util::batch::DriveOperation; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for DocumentsBatchTransitionAction { + fn into_high_level_drive_operations<'b>( + self, + epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .documents_batch_transition + { + 0 => { + let owner_id = self.owner_id(); + let transitions = self.transitions_owned(); + Ok(transitions + .into_iter() + .map(|transition| { + transition.into_high_level_document_drive_operations( + epoch, + owner_id, + platform_version, + ) + }) + .collect::>, Error>>()? + .into_iter() + .flatten() + .collect()) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "DocumentsBatchTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/mod.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/mod.rs new file mode 100644 index 00000000000..d473c995af1 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/document/mod.rs @@ -0,0 +1,25 @@ +use crate::error::Error; +use crate::util::batch::DriveOperation; +use dpp::block::epoch::Epoch; +use dpp::platform_value::Identifier; +use dpp::version::PlatformVersion; + +mod document_create_transition; +mod document_delete_transition; +mod document_purchase_transition; +mod document_replace_transition; +mod document_transfer_transition; +mod document_transition; +mod document_update_price_transition; +mod documents_batch_transition; + +/// A converter that will get High Level Drive Operations from State transitions +pub trait DriveHighLevelDocumentOperationConverter { + /// This will get a list of atomic drive operations from a high level operations + fn into_high_level_document_drive_operations<'a>( + self, + epoch: &Epoch, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result>, Error>; +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_create_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_create_transition.rs new file mode 100644 index 00000000000..c888c3a18de --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_create_transition.rs @@ -0,0 +1,64 @@ +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::util::batch::DriveOperation::{IdentityOperation, SystemOperation}; +use crate::util::batch::{DriveOperation, IdentityOperationType, SystemOperationType}; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValueGettersV0, AssetLockValueSettersV0}; + +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::identity::identity_create::{ + IdentityCreateTransitionAction, IdentityFromIdentityCreateTransitionAction, +}; +use dpp::block::epoch::Epoch; +use dpp::prelude::Identity; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for IdentityCreateTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .identity_create_transition + { + 0 => { + let asset_lock_outpoint = self.asset_lock_outpoint(); + + let (identity, mut asset_lock_value) = + Identity::try_from_identity_create_transition_action_returning_asset_lock_value( + self, + platform_version, + )?; + + let initial_balance = asset_lock_value.remaining_credit_value(); + + asset_lock_value.set_remaining_credit_value(0); // We are using the entire value + + let drive_operations = vec![ + IdentityOperation(IdentityOperationType::AddNewIdentity { + identity, + is_masternode_identity: false, + }), + SystemOperation(SystemOperationType::AddToSystemCredits { + amount: initial_balance, + }), + SystemOperation(SystemOperationType::AddUsedAssetLock { + asset_lock_outpoint, + asset_lock_value, + }), + ]; + Ok(drive_operations) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "IdentityCreateTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_credit_transfer_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_credit_transfer_transition.rs new file mode 100644 index 00000000000..a1b1ec96c78 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_credit_transfer_transition.rs @@ -0,0 +1,54 @@ +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::util::batch::DriveOperation::IdentityOperation; +use crate::util::batch::{DriveOperation, IdentityOperationType}; + +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::identity::identity_credit_transfer::IdentityCreditTransferTransitionAction; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for IdentityCreditTransferTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .identity_credit_transfer_transition + { + 0 => { + let recipient_id = self.recipient_id(); + let identity_id = self.identity_id(); + let transfer_amount = self.transfer_amount(); + let nonce = self.nonce(); + + let drive_operations = vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityNonce { + identity_id: identity_id.into_buffer(), + nonce, + }), + IdentityOperation(IdentityOperationType::RemoveFromIdentityBalance { + identity_id: identity_id.to_buffer(), + balance_to_remove: transfer_amount, + }), + IdentityOperation(IdentityOperationType::AddToIdentityBalance { + identity_id: recipient_id.to_buffer(), + added_balance: transfer_amount, + }), + ]; + Ok(drive_operations) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "IdentityCreditTransferTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_credit_withdrawal_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_credit_withdrawal_transition.rs new file mode 100644 index 00000000000..95a3bbf0511 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_credit_withdrawal_transition.rs @@ -0,0 +1,67 @@ +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::util::batch::DriveOperation::{DocumentOperation, IdentityOperation, SystemOperation}; +use crate::util::batch::{ + DocumentOperationType, DriveOperation, IdentityOperationType, SystemOperationType, +}; +use crate::util::object_size_info::{DocumentInfo, OwnedDocumentInfo}; +use dpp::block::epoch::Epoch; + +use crate::error::drive::DriveError; +use crate::state_transition_action::identity::identity_credit_withdrawal::IdentityCreditWithdrawalTransitionAction; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for IdentityCreditWithdrawalTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .identity_credit_withdrawal_transition + { + 0 => { + let identity_id = self.identity_id(); + let nonce = self.nonce(); + let balance_to_remove = self.amount(); + let prepared_withdrawal_document = self.prepared_withdrawal_document_owned(); + + let drive_operations = vec![ + IdentityOperation(IdentityOperationType::RemoveFromIdentityBalance { + identity_id: identity_id.to_buffer(), + balance_to_remove, + }), + IdentityOperation(IdentityOperationType::UpdateIdentityNonce { + identity_id: identity_id.into_buffer(), + nonce, + }), + DocumentOperation(DocumentOperationType::AddWithdrawalDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentInfo::DocumentOwnedInfo(( + prepared_withdrawal_document, + None, + )), + owner_id: None, + }, + }), + SystemOperation(SystemOperationType::RemoveFromSystemCredits { + amount: balance_to_remove, + }), + ]; + + Ok(drive_operations) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: + "IdentityCreditWithdrawalTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_top_up_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_top_up_transition.rs new file mode 100644 index 00000000000..498feacec37 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_top_up_transition.rs @@ -0,0 +1,58 @@ +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::util::batch::DriveOperation::{IdentityOperation, SystemOperation}; +use crate::util::batch::{DriveOperation, IdentityOperationType, SystemOperationType}; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValueGettersV0, AssetLockValueSettersV0}; + +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for IdentityTopUpTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .identity_top_up_transition + { + 0 => { + let identity_id = self.identity_id(); + let asset_lock_outpoint = self.asset_lock_outpoint(); + + let mut asset_lock_value = self.top_up_asset_lock_value_consume(); + + let added_balance = asset_lock_value.remaining_credit_value(); + + asset_lock_value.set_remaining_credit_value(0); + + let drive_operations = vec![ + IdentityOperation(IdentityOperationType::AddToIdentityBalance { + identity_id: identity_id.to_buffer(), + added_balance, + }), + SystemOperation(SystemOperationType::AddToSystemCredits { + amount: added_balance, + }), + SystemOperation(SystemOperationType::AddUsedAssetLock { + asset_lock_outpoint, + asset_lock_value, + }), + ]; + Ok(drive_operations) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "IdentityTopUpTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_update_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_update_transition.rs new file mode 100644 index 00000000000..fb138d379a1 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/identity_update_transition.rs @@ -0,0 +1,77 @@ +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::util::batch::DriveOperation::IdentityOperation; +use crate::util::batch::{DriveOperation, IdentityOperationType}; + +use crate::error::Error; +use dpp::block::epoch::Epoch; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::IdentityPublicKey; + +use crate::error::drive::DriveError; +use crate::state_transition_action::identity::identity_update::IdentityUpdateTransitionAction; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for IdentityUpdateTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .identity_update_transition + { + 0 => { + let identity_id = self.identity_id(); + let revision = self.revision(); + let (add_public_keys, disable_public_keys) = + self.public_keys_to_add_and_disable_owned(); + + let (unique_keys, non_unique_keys): ( + Vec, + Vec, + ) = add_public_keys + .into_iter() + .partition(|key| key.key_type().is_unique_key_type()); + + let mut drive_operations = vec![]; + + drive_operations.push(IdentityOperation( + IdentityOperationType::UpdateIdentityRevision { + identity_id: identity_id.to_buffer(), + revision, + }, + )); + + if !unique_keys.is_empty() || !non_unique_keys.is_empty() { + drive_operations.push(IdentityOperation( + IdentityOperationType::AddNewKeysToIdentity { + identity_id: identity_id.to_buffer(), + unique_keys_to_add: unique_keys, + non_unique_keys_to_add: non_unique_keys, + }, + )); + } + if !disable_public_keys.is_empty() { + drive_operations.push(IdentityOperation( + IdentityOperationType::DisableIdentityKeys { + identity_id: identity_id.to_buffer(), + keys_ids: disable_public_keys, + }, + )); + } + + Ok(drive_operations) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "IdentityUpdateTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/masternode_vote_transition.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/masternode_vote_transition.rs new file mode 100644 index 00000000000..7009429822b --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/masternode_vote_transition.rs @@ -0,0 +1,69 @@ +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::util::batch::DriveOperation::{IdentityOperation, PrefundedSpecializedBalanceOperation}; +use crate::util::batch::{DriveOperation, IdentityOperationType}; + +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::identity::masternode_vote::MasternodeVoteTransitionAction; +use crate::util::batch::drive_op_batch::PrefundedSpecializedBalanceOperationType; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; +use dpp::ProtocolError; + +impl DriveHighLevelOperationConverter for MasternodeVoteTransitionAction { + fn into_high_level_drive_operations<'a>( + mut self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .masternode_vote_transition + { + 0 => { + let voter_identity_id = self.voter_identity_id(); + let pro_tx_hash = self.pro_tx_hash(); + let nonce = self.nonce(); + let strength = self.vote_strength(); + let previous_resource_vote_choice_to_remove = + self.take_previous_resource_vote_choice_to_remove(); + let vote = self.vote_owned(); + let prefunded_specialized_balance_id = vote.specialized_balance_id()?.ok_or(Error::Protocol(ProtocolError::VoteError("vote does not have a specialized balance from where it can use to pay for processing (this should have been caught during validation)".to_string())))?; + + let drive_operations = vec![ + IdentityOperation(IdentityOperationType::UpdateIdentityNonce { + identity_id: voter_identity_id.into_buffer(), + nonce, + }), + IdentityOperation(IdentityOperationType::MasternodeCastVote { + // Votes are cast based on masternode pro_tx_hash, and not the voter identity id + voter_pro_tx_hash: pro_tx_hash.to_buffer(), + strength, + vote, + previous_resource_vote_choice_to_remove, + }), + // Casting a vote has a fixed cost + PrefundedSpecializedBalanceOperation( + PrefundedSpecializedBalanceOperationType::DeductFromPrefundedBalance { + prefunded_specialized_balance_id, + remove_balance: platform_version + .fee_version + .vote_resolution_fund_fees + .contested_document_single_vote_cost, + }, + ), + ]; + Ok(drive_operations) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "MasternodeVoteTransitionAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/mod.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/mod.rs new file mode 100644 index 00000000000..a26d5e7fcc0 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/identity/mod.rs @@ -0,0 +1,6 @@ +mod identity_create_transition; +mod identity_credit_transfer_transition; +mod identity_credit_withdrawal_transition; +mod identity_top_up_transition; +mod identity_update_transition; +mod masternode_vote_transition; diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/mod.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/mod.rs new file mode 100644 index 00000000000..bfc5b55e272 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/mod.rs @@ -0,0 +1,79 @@ +//! Translation of State Transitions to Drive Operations +//! +//! This module defines general, commonly used functions in Drive. +//! + +mod contract; +mod document; +mod identity; +mod system; + +use crate::error::Error; +use crate::state_transition_action::StateTransitionAction; +use crate::util::batch::DriveOperation; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; + +/// A converter that will get High Level Drive Operations from State transitions +pub trait DriveHighLevelOperationConverter { + /// This will get a list of atomic drive operations from a high level operations + fn into_high_level_drive_operations<'a>( + self, + epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error>; +} + +impl DriveHighLevelOperationConverter for StateTransitionAction { + fn into_high_level_drive_operations<'a>( + self, + epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match self { + StateTransitionAction::DataContractCreateAction(data_contract_create_transition) => { + data_contract_create_transition + .into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::DataContractUpdateAction(data_contract_update_transition) => { + data_contract_update_transition + .into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::DocumentsBatchAction(documents_batch_transition) => { + documents_batch_transition.into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::IdentityCreateAction(identity_create_transition) => { + identity_create_transition.into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::IdentityTopUpAction(identity_top_up_transition) => { + identity_top_up_transition.into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::IdentityCreditWithdrawalAction( + identity_credit_withdrawal_transition, + ) => identity_credit_withdrawal_transition + .into_high_level_drive_operations(epoch, platform_version), + StateTransitionAction::IdentityUpdateAction(identity_update_transition) => { + identity_update_transition.into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::IdentityCreditTransferAction( + identity_credit_transfer_transition, + ) => identity_credit_transfer_transition + .into_high_level_drive_operations(epoch, platform_version), + StateTransitionAction::MasternodeVoteAction(masternode_vote_transition) => { + masternode_vote_transition.into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::BumpIdentityNonceAction(bump_identity_nonce_transition) => { + bump_identity_nonce_transition + .into_high_level_drive_operations(epoch, platform_version) + } + StateTransitionAction::BumpIdentityDataContractNonceAction( + bump_identity_data_contract_nonce_transition, + ) => bump_identity_data_contract_nonce_transition + .into_high_level_drive_operations(epoch, platform_version), + StateTransitionAction::PartiallyUseAssetLockAction( + partially_used_asset_lock_action, + ) => partially_used_asset_lock_action + .into_high_level_drive_operations(epoch, platform_version), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/bump_identity_data_contract_nonce.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/bump_identity_data_contract_nonce.rs new file mode 100644 index 00000000000..75ec6eff0e1 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/bump_identity_data_contract_nonce.rs @@ -0,0 +1,46 @@ +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::state_transition_action::system::bump_identity_data_contract_nonce_action::{ + BumpIdentityDataContractNonceAction, BumpIdentityDataContractNonceActionAccessorsV0, +}; +use crate::util::batch::DriveOperation::IdentityOperation; +use crate::util::batch::{DriveOperation, IdentityOperationType}; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; +impl DriveHighLevelOperationConverter for BumpIdentityDataContractNonceAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .bump_identity_data_contract_nonce + { + 0 => { + let identity_id = self.identity_id(); + let data_contract_id = self.data_contract_id(); + + let identity_contract_nonce = self.identity_contract_nonce(); + + Ok(vec![IdentityOperation( + IdentityOperationType::UpdateIdentityContractNonce { + identity_id: identity_id.into_buffer(), + contract_id: data_contract_id.into_buffer(), + nonce: identity_contract_nonce, + }, + )]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "BumpIdentityDataContractNonceAction::into_high_level_drive_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/bump_identity_nonce.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/bump_identity_nonce.rs new file mode 100644 index 00000000000..8a0d626e27a --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/bump_identity_nonce.rs @@ -0,0 +1,44 @@ +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::state_transition_action::system::bump_identity_nonce_action::{ + BumpIdentityNonceAction, BumpIdentityNonceActionAccessorsV0, +}; +use crate::util::batch::DriveOperation::IdentityOperation; +use crate::util::batch::{DriveOperation, IdentityOperationType}; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for BumpIdentityNonceAction { + fn into_high_level_drive_operations<'b>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .bump_identity_nonce + { + 0 => { + let identity_id = self.identity_id(); + + let identity_nonce = self.identity_nonce(); + + Ok(vec![IdentityOperation( + IdentityOperationType::UpdateIdentityNonce { + identity_id: identity_id.into_buffer(), + nonce: identity_nonce, + }, + )]) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "BumpIdentityNonceAction::into_high_level_drive_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/mod.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/mod.rs new file mode 100644 index 00000000000..57160f76396 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/mod.rs @@ -0,0 +1,3 @@ +mod bump_identity_data_contract_nonce; +mod bump_identity_nonce; +mod partially_use_asset_lock; diff --git a/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/partially_use_asset_lock.rs b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/partially_use_asset_lock.rs new file mode 100644 index 00000000000..3768a349904 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/action_convert_to_operations/system/partially_use_asset_lock.rs @@ -0,0 +1,76 @@ +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::action_convert_to_operations::DriveHighLevelOperationConverter; +use crate::state_transition_action::system::partially_use_asset_lock_action::{ + PartiallyUseAssetLockAction, PartiallyUseAssetLockActionAccessorsV0, +}; +use crate::util::batch::DriveOperation::SystemOperation; +use crate::util::batch::{DriveOperation, SystemOperationType}; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::block::epoch::Epoch; +use dpp::version::PlatformVersion; + +impl DriveHighLevelOperationConverter for PartiallyUseAssetLockAction { + fn into_high_level_drive_operations<'a>( + self, + _epoch: &Epoch, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .convert_to_high_level_operations + .partially_use_asset_lock + { + 0 => { + let initial_credit_value = self.initial_credit_value(); + // The remaining credit value is already computed here + let mut remaining_credit_value = self.remaining_credit_value(); + let used_credits = self.used_credits(); + let asset_lock_outpoint = self.asset_lock_outpoint(); + + let previous_transaction_hashes = if self.previous_transaction_hashes_ref().len() + as u16 + >= platform_version + .drive_abci + .validation_and_processing + .state_transitions + .max_asset_lock_usage_attempts + { + // There have been 16 failed attempts at using the asset lock + // In this case the remaining credit value is burned and there is no need to keep around previous + // transaction hashes + remaining_credit_value = 0; + vec![] + } else { + self.previous_transaction_hashes_ref().clone() + }; + + let tx_out_script = self.asset_lock_script_owned(); + + let drive_operations = vec![ + SystemOperation(SystemOperationType::AddToSystemCredits { + amount: used_credits, + }), + SystemOperation(SystemOperationType::AddUsedAssetLock { + asset_lock_outpoint, + asset_lock_value: AssetLockValue::new( + initial_credit_value, + tx_out_script, + remaining_credit_value, + previous_transaction_hashes, + platform_version, + )?, + }), + ]; + Ok(drive_operations) + } + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "PartiallyUseAssetLockAction::into_high_level_drive_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/mod.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/mod.rs index 62005f277a9..f34eca7070f 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/mod.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/mod.rs @@ -6,6 +6,7 @@ pub mod v0; use crate::state_transition_action::contract::data_contract_create::v0::DataContractCreateTransitionActionV0; use derive_more::From; use dpp::data_contract::DataContract; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// data contract create transition action #[derive(Debug, Clone, From)] @@ -27,4 +28,18 @@ impl DataContractCreateTransitionAction { DataContractCreateTransitionAction::V0(transition) => &transition.data_contract, } } + + /// identity nonce + pub fn identity_nonce(&self) -> IdentityNonce { + match self { + DataContractCreateTransitionAction::V0(transition) => transition.identity_nonce, + } + } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DataContractCreateTransitionAction::V0(transition) => transition.user_fee_increase, + } + } } diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/transformer.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/transformer.rs index 4c04b4b762c..c195fc68d9c 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/transformer.rs @@ -1,42 +1,49 @@ use crate::state_transition_action::contract::data_contract_create::v0::DataContractCreateTransitionActionV0; use crate::state_transition_action::contract::data_contract_create::DataContractCreateTransitionAction; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::ProtocolError; use platform_version::version::PlatformVersion; -use platform_version::TryFromPlatformVersioned; -impl TryFromPlatformVersioned for DataContractCreateTransitionAction { - type Error = ProtocolError; - - fn try_from_platform_versioned( +impl DataContractCreateTransitionAction { + /// tries to transform the DataContractCreateTransition into a DataContractCreateTransitionAction + /// if validation is true the data contract transformation verifies that the data contract is valid + /// if validation is false, the data contract base structure is created regardless of if it is valid + pub fn try_from_transition( value: DataContractCreateTransition, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match value { - DataContractCreateTransition::V0(v0) => Ok( - DataContractCreateTransitionActionV0::try_from_platform_versioned( + DataContractCreateTransition::V0(v0) => { + Ok(DataContractCreateTransitionActionV0::try_from_transition( v0, + full_validation, + validation_operations, platform_version, )? - .into(), - ), + .into()) + } } } -} -impl TryFromPlatformVersioned<&DataContractCreateTransition> - for DataContractCreateTransitionAction -{ - type Error = ProtocolError; + /// tries to transform the borrowed DataContractCreateTransition into a DataContractCreateTransitionAction + /// if validation is true the data contract transformation verifies that the data contract is valid + /// if validation is false, the data contract base structure is created regardless of if it is valid - fn try_from_platform_versioned( + pub fn try_from_borrowed_transition( value: &DataContractCreateTransition, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match value { DataContractCreateTransition::V0(v0) => Ok( - DataContractCreateTransitionActionV0::try_from_platform_versioned( + DataContractCreateTransitionActionV0::try_from_borrowed_transition( v0, + full_validation, + validation_operations, platform_version, )? .into(), diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/mod.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/mod.rs index 814cc316465..2bcde179d62 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/mod.rs @@ -2,10 +2,15 @@ pub mod transformer; use dpp::data_contract::DataContract; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// data contract create transition action v0 #[derive(Debug, Clone)] pub struct DataContractCreateTransitionActionV0 { /// data contract pub data_contract: DataContract, + /// identity nonce + pub identity_nonce: IdentityNonce, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, } diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/transformer.rs index 2abf6333244..64a1497b2dd 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_create/v0/transformer.rs @@ -1,44 +1,44 @@ use crate::state_transition_action::contract::data_contract_create::v0::DataContractCreateTransitionActionV0; use dpp::prelude::DataContract; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::ProtocolError; use platform_version::version::PlatformVersion; -use platform_version::TryFromPlatformVersioned; -impl TryFromPlatformVersioned - for DataContractCreateTransitionActionV0 -{ - type Error = ProtocolError; - - fn try_from_platform_versioned( +impl DataContractCreateTransitionActionV0 { + pub(in crate::state_transition_action::contract::data_contract_create) fn try_from_transition( value: DataContractCreateTransitionV0, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { Ok(DataContractCreateTransitionActionV0 { data_contract: DataContract::try_from_platform_versioned( value.data_contract, - true, + full_validation, + validation_operations, platform_version, )?, + identity_nonce: value.identity_nonce, + user_fee_increase: value.user_fee_increase, }) } -} - -impl TryFromPlatformVersioned<&DataContractCreateTransitionV0> - for DataContractCreateTransitionActionV0 -{ - type Error = ProtocolError; - fn try_from_platform_versioned( + pub(in crate::state_transition_action::contract::data_contract_create) fn try_from_borrowed_transition( value: &DataContractCreateTransitionV0, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { Ok(DataContractCreateTransitionActionV0 { data_contract: DataContract::try_from_platform_versioned( value.data_contract.clone(), - true, + full_validation, + validation_operations, platform_version, )?, + identity_nonce: value.identity_nonce, + user_fee_increase: value.user_fee_increase, }) } } diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/mod.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/mod.rs index f75db0aa90e..3ea424e0e62 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/mod.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/mod.rs @@ -6,6 +6,7 @@ pub mod v0; use crate::state_transition_action::contract::data_contract_update::v0::DataContractUpdateTransitionActionV0; use derive_more::From; use dpp::data_contract::DataContract; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// data contract update transition action #[derive(Debug, Clone, From)] @@ -27,4 +28,20 @@ impl DataContractUpdateTransitionAction { DataContractUpdateTransitionAction::V0(transition) => &transition.data_contract, } } + + /// identity contract nonce + pub fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DataContractUpdateTransitionAction::V0(transition) => { + transition.identity_contract_nonce + } + } + } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DataContractUpdateTransitionAction::V0(transition) => transition.user_fee_increase, + } + } } diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/transformer.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/transformer.rs index 8e009f64156..d8ae02dbf59 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/transformer.rs @@ -1,42 +1,49 @@ use crate::state_transition_action::contract::data_contract_update::v0::DataContractUpdateTransitionActionV0; use crate::state_transition_action::contract::data_contract_update::DataContractUpdateTransitionAction; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::ProtocolError; use platform_version::version::PlatformVersion; -use platform_version::TryFromPlatformVersioned; -impl TryFromPlatformVersioned for DataContractUpdateTransitionAction { - type Error = ProtocolError; - - fn try_from_platform_versioned( +impl DataContractUpdateTransitionAction { + /// tries to transform the DataContractUpdateTransition into a DataContractUpdateTransitionAction + /// if validation is true the data contract transformation verifies that the data contract is valid + /// if validation is false, the data contract base structure is created regardless of if it is valid + pub fn try_from_transition( value: DataContractUpdateTransition, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match value { - DataContractUpdateTransition::V0(v0) => Ok( - DataContractUpdateTransitionActionV0::try_from_platform_versioned( + DataContractUpdateTransition::V0(v0) => { + Ok(DataContractUpdateTransitionActionV0::try_from_transition( v0, + full_validation, + validation_operations, platform_version, )? - .into(), - ), + .into()) + } } } -} -impl TryFromPlatformVersioned<&DataContractUpdateTransition> - for DataContractUpdateTransitionAction -{ - type Error = ProtocolError; + /// tries to transform the borrowed DataContractUpdateTransition into a DataContractUpdateTransitionAction + /// if validation is true the data contract transformation verifies that the data contract is valid + /// if validation is false, the data contract base structure is created regardless of if it is valid - fn try_from_platform_versioned( + pub fn try_from_borrowed_transition( value: &DataContractUpdateTransition, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match value { DataContractUpdateTransition::V0(v0) => Ok( - DataContractUpdateTransitionActionV0::try_from_platform_versioned( + DataContractUpdateTransitionActionV0::try_from_borrowed_transition( v0, + full_validation, + validation_operations, platform_version, )? .into(), diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/mod.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/mod.rs index 8d62f0e7654..5b3bfca097a 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/mod.rs @@ -2,10 +2,15 @@ pub mod transformer; use dpp::data_contract::DataContract; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// data contract update transition action v0 #[derive(Debug, Clone)] pub struct DataContractUpdateTransitionActionV0 { /// data contract pub data_contract: DataContract, + /// identity contract nonce + pub identity_contract_nonce: IdentityNonce, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, } diff --git a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/transformer.rs index 4b9996f869b..ced97b3c7ae 100644 --- a/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/contract/data_contract_update/v0/transformer.rs @@ -1,44 +1,44 @@ use crate::state_transition_action::contract::data_contract_update::v0::DataContractUpdateTransitionActionV0; use dpp::data_contract::DataContract; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransitionV0; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::ProtocolError; use platform_version::version::PlatformVersion; -use platform_version::TryFromPlatformVersioned; -impl TryFromPlatformVersioned - for DataContractUpdateTransitionActionV0 -{ - type Error = ProtocolError; - - fn try_from_platform_versioned( +impl DataContractUpdateTransitionActionV0 { + pub(in crate::state_transition_action::contract::data_contract_update) fn try_from_transition( value: DataContractUpdateTransitionV0, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { Ok(DataContractUpdateTransitionActionV0 { data_contract: DataContract::try_from_platform_versioned( value.data_contract, - true, + full_validation, + validation_operations, platform_version, )?, + identity_contract_nonce: value.identity_contract_nonce, + user_fee_increase: value.user_fee_increase, }) } -} - -impl TryFromPlatformVersioned<&DataContractUpdateTransitionV0> - for DataContractUpdateTransitionActionV0 -{ - type Error = ProtocolError; - fn try_from_platform_versioned( + pub(in crate::state_transition_action::contract::data_contract_update) fn try_from_borrowed_transition( value: &DataContractUpdateTransitionV0, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { Ok(DataContractUpdateTransitionActionV0 { data_contract: DataContract::try_from_platform_versioned( value.data_contract.clone(), - true, + full_validation, + validation_operations, platform_version, )?, + identity_contract_nonce: value.identity_contract_nonce, + user_fee_increase: value.user_fee_increase, }) } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/action_type.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/action_type.rs index a46fdae9070..de03698b223 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/action_type.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/action_type.rs @@ -9,6 +9,14 @@ impl TransitionActionTypeGetter for DocumentTransitionAction { DocumentTransitionAction::CreateAction(_) => DocumentTransitionActionType::Create, DocumentTransitionAction::DeleteAction(_) => DocumentTransitionActionType::Delete, DocumentTransitionAction::ReplaceAction(_) => DocumentTransitionActionType::Replace, + DocumentTransitionAction::TransferAction(_) => DocumentTransitionActionType::Transfer, + DocumentTransitionAction::PurchaseAction(_) => DocumentTransitionActionType::Purchase, + DocumentTransitionAction::UpdatePriceAction(_) => { + DocumentTransitionActionType::UpdatePrice + } + DocumentTransitionAction::BumpIdentityDataContractNonce(_) => { + DocumentTransitionActionType::IgnoreWhileBumpingRevision + } } } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/mod.rs index bac11c66b3f..c303da0bfbb 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/mod.rs @@ -2,6 +2,10 @@ use derive_more::From; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::platform_value::Identifier; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::prelude::IdentityNonce; +use dpp::ProtocolError; use std::sync::Arc; /// transformer module @@ -26,6 +30,17 @@ impl DocumentBaseTransitionActionAccessorsV0 for DocumentBaseTransitionAction { } } + fn document_type(&self) -> Result { + Ok(self + .data_contract_fetch_info_ref() + .contract + .document_type_for_name(self.document_type_name())?) + } + + fn document_type_field_is_required(&self, field: &str) -> Result { + Ok(self.document_type()?.required_fields().contains(field)) + } + fn document_type_name(&self) -> &String { match self { DocumentBaseTransitionAction::V0(v0) => &v0.document_type_name, @@ -44,9 +59,20 @@ impl DocumentBaseTransitionActionAccessorsV0 for DocumentBaseTransitionAction { } } + fn data_contract_fetch_info_ref(&self) -> &Arc { + match self { + DocumentBaseTransitionAction::V0(v0) => &v0.data_contract, + } + } fn data_contract_fetch_info(&self) -> Arc { match self { DocumentBaseTransitionAction::V0(v0) => v0.data_contract.clone(), } } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DocumentBaseTransitionAction::V0(v0) => v0.identity_contract_nonce, + } + } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/mod.rs index e713abb4834..4027d10d8ed 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/mod.rs @@ -1,9 +1,12 @@ /// transformer pub mod transformer; +use dpp::data_contract::document_type::DocumentTypeRef; use std::sync::Arc; use dpp::identifier::Identifier; +use dpp::prelude::IdentityNonce; +use dpp::ProtocolError; use crate::drive::contract::DataContractFetchInfo; @@ -12,6 +15,8 @@ use crate::drive::contract::DataContractFetchInfo; pub struct DocumentBaseTransitionActionV0 { /// The document Id pub id: Identifier, + /// The identity contract nonce, this is used to stop replay attacks + pub identity_contract_nonce: IdentityNonce, /// Name of document type found int the data contract associated with the `data_contract_id` pub document_type_name: String, /// A potential data contract @@ -22,12 +27,24 @@ pub struct DocumentBaseTransitionActionV0 { pub trait DocumentBaseTransitionActionAccessorsV0 { /// The document Id fn id(&self) -> Identifier; + + /// The document type + fn document_type(&self) -> Result; + + /// Is a field required on the document type? + fn document_type_field_is_required(&self, field: &str) -> Result; + /// Name of document type found int the data contract associated with the `data_contract_id` fn document_type_name(&self) -> &String; /// document type name owned fn document_type_name_owned(self) -> String; /// Data contract ID generated from the data contract's `owner_id` and `entropy` fn data_contract_id(&self) -> Identifier; + + /// A reference to the data contract fetch info that does not clone the Arc + fn data_contract_fetch_info_ref(&self) -> &Arc; /// Data contract fn data_contract_fetch_info(&self) -> Arc; + /// Identity contract nonce + fn identity_contract_nonce(&self) -> IdentityNonce; } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/transformer.rs index 8ac5a091d29..b639eb421e8 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_base_transition_action/v0/transformer.rs @@ -17,10 +17,11 @@ impl DocumentBaseTransitionActionV0 { id, document_type_name, data_contract_id, - .. + identity_contract_nonce, } = value; Ok(DocumentBaseTransitionActionV0 { id, + identity_contract_nonce, document_type_name, data_contract: get_data_contract(data_contract_id)?, }) @@ -35,10 +36,11 @@ impl DocumentBaseTransitionActionV0 { id, document_type_name, data_contract_id, - .. + identity_contract_nonce, } = value; Ok(DocumentBaseTransitionActionV0 { id: *id, + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type_name.clone(), data_contract: get_data_contract(*data_contract_id)?, }) diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/mod.rs index 08fcd022dfa..352444f8301 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/mod.rs @@ -3,16 +3,21 @@ pub mod transformer; mod v0; use derive_more::From; -use dpp::identity::TimestampMillis; + +use dpp::block::block_info::BlockInfo; use dpp::platform_value::{Identifier, Value}; use std::collections::BTreeMap; use dpp::document::Document; +use dpp::fee::Credits; + use dpp::ProtocolError; pub use v0::*; use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction}; -use dpp::version::{PlatformVersion}; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; /// document create transition action #[derive(Debug, Clone, From)] @@ -34,15 +39,9 @@ impl DocumentCreateTransitionActionAccessorsV0 for DocumentCreateTransitionActio } } - fn created_at(&self) -> Option { - match self { - DocumentCreateTransitionAction::V0(v0) => v0.created_at, - } - } - - fn updated_at(&self) -> Option { + fn block_info(&self) -> BlockInfo { match self { - DocumentCreateTransitionAction::V0(v0) => v0.updated_at, + DocumentCreateTransitionAction::V0(v0) => v0.block_info, } } @@ -63,38 +62,78 @@ impl DocumentCreateTransitionActionAccessorsV0 for DocumentCreateTransitionActio DocumentCreateTransitionAction::V0(v0) => v0.data, } } + + fn take_prefunded_voting_balance( + &mut self, + ) -> Option<(ContestedDocumentResourceVotePollWithContractInfo, Credits)> { + match self { + DocumentCreateTransitionAction::V0(v0) => v0.prefunded_voting_balance.take(), + } + } + + fn prefunded_voting_balance( + &self, + ) -> &Option<(ContestedDocumentResourceVotePollWithContractInfo, Credits)> { + match self { + DocumentCreateTransitionAction::V0(v0) => &v0.prefunded_voting_balance, + } + } + + fn should_store_contest_info(&self) -> &Option { + match self { + DocumentCreateTransitionAction::V0(v0) => &v0.should_store_contest_info, + } + } + + fn take_should_store_contest_info(&mut self) -> Option { + match self { + DocumentCreateTransitionAction::V0(v0) => v0.should_store_contest_info.take(), + } + } + + fn current_store_contest_info(&self) -> &Option { + match self { + DocumentCreateTransitionAction::V0(v0) => &v0.current_store_contest_info, + } + } + + fn take_current_store_contest_info(&mut self) -> Option { + match self { + DocumentCreateTransitionAction::V0(v0) => v0.current_store_contest_info.take(), + } + } } /// document from create transition -pub trait DocumentFromCreateTransition { - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` reference and `owner_id`. +pub trait DocumentFromCreateTransitionAction { + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionAction` reference and `owner_id`. /// /// # Arguments /// - /// * `value` - A reference to the `DocumentCreateTransition` containing information about the document being created. + /// * `value` - A reference to the `DocumentCreateTransitionAction` containing information about the document being created. /// * `owner_id` - The `Identifier` of the document's owner. /// /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_create_transition( + fn try_from_create_transition_action( document_create_transition_action: &DocumentCreateTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result where Self: Sized; - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` instance and `owner_id`. + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionAction` instance and `owner_id`. /// /// # Arguments /// - /// * `value` - A `DocumentCreateTransition` instance containing information about the document being created. + /// * `value` - A `DocumentCreateTransitionAction` instance containing information about the document being created. /// * `owner_id` - The `Identifier` of the document's owner. /// /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_create_transition( + fn try_from_owned_create_transition_action( document_create_transition_action: DocumentCreateTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, @@ -103,47 +142,27 @@ pub trait DocumentFromCreateTransition { Self: Sized; } -impl DocumentFromCreateTransition for Document { - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` reference and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A reference to the `DocumentCreateTransition` containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_create_transition( +impl DocumentFromCreateTransitionAction for Document { + fn try_from_create_transition_action( document_create_transition_action: &DocumentCreateTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { match document_create_transition_action { DocumentCreateTransitionAction::V0(v0) => { - Self::try_from_create_transition_v0(v0, owner_id, platform_version) + Self::try_from_create_transition_action_v0(v0, owner_id, platform_version) } } } - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` instance and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A `DocumentCreateTransition` instance containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_create_transition( + fn try_from_owned_create_transition_action( document_create_transition_action: DocumentCreateTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { match document_create_transition_action { DocumentCreateTransitionAction::V0(v0) => { - Self::try_from_owned_create_transition_v0(v0, owner_id, platform_version) + Self::try_from_owned_create_transition_action_v0(v0, owner_id, platform_version) } } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/transformer.rs index 829d5fbc7ee..50d8b830afa 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/transformer.rs @@ -1,29 +1,49 @@ +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; use dpp::platform_value::Identifier; +use grovedb::TransactionArg; use std::sync::Arc; use dpp::ProtocolError; use dpp::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; +use platform_version::version::PlatformVersion; use crate::drive::contract::DataContractFetchInfo; +use crate::drive::Drive; +use crate::error::Error; use crate::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::{DocumentCreateTransitionAction, DocumentCreateTransitionActionV0}; impl DocumentCreateTransitionAction { /// from_document_create_transition_with_contract_lookup pub fn from_document_create_transition_with_contract_lookup( + drive: &Drive, + transaction: TransactionArg, value: DocumentCreateTransition, + block_info: &BlockInfo, get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, - ) -> Result { + platform_version: &PlatformVersion, + ) -> Result<(Self, FeeResult), Error> { match value { - DocumentCreateTransition::V0(v0) => Ok(DocumentCreateTransitionActionV0::try_from_document_create_transition_with_contract_lookup(v0, get_data_contract)?.into()), + DocumentCreateTransition::V0(v0) => { + let (v0, fee) = DocumentCreateTransitionActionV0::try_from_document_create_transition_with_contract_lookup(drive, transaction, v0, block_info, get_data_contract, platform_version)?; + Ok((v0.into(), fee)) + } } } /// from_document_borrowed_create_transition_with_contract_lookup pub fn from_document_borrowed_create_transition_with_contract_lookup( + drive: &Drive, + transaction: TransactionArg, value: &DocumentCreateTransition, + block_info: &BlockInfo, get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, - ) -> Result { + platform_version: &PlatformVersion, + ) -> Result<(Self, FeeResult), Error> { match value { - DocumentCreateTransition::V0(v0) => Ok(DocumentCreateTransitionActionV0::try_from_borrowed_document_create_transition_with_contract_lookup(v0, get_data_contract)?.into()), + DocumentCreateTransition::V0(v0) => { + let (v0, fee) = DocumentCreateTransitionActionV0::try_from_borrowed_document_create_transition_with_contract_lookup(drive, transaction, v0, block_info, get_data_contract, platform_version)?; + Ok((v0.into(), fee)) + } } } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/mod.rs index d1e8265a117..e61fbb73c9f 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/mod.rs @@ -1,30 +1,46 @@ pub mod transformer; +use dpp::block::block_info::BlockInfo; use dpp::document::{Document, DocumentV0}; -use dpp::identity::TimestampMillis; use dpp::platform_value::{Identifier, Value}; use std::collections::BTreeMap; +use std::vec; use dpp::ProtocolError; use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; +use dpp::fee::Credits; + use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionV0}; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; /// document create transition action v0 #[derive(Debug, Clone)] pub struct DocumentCreateTransitionActionV0 { /// Document Base Transition pub base: DocumentBaseTransitionAction, - /// The creation time of the document - pub created_at: Option, - //todo: remove updated_at - /// The time the document was last updated - pub updated_at: Option, + /// The block_info at the time of creation + pub block_info: BlockInfo, /// Document properties pub data: BTreeMap, + /// Pre funded balance (for unique index conflict resolution voting - the identity will put money + /// aside that will be used by voters to vote) + pub prefunded_voting_balance: + Option<(ContestedDocumentResourceVotePollWithContractInfo, Credits)>, + /// We store contest info only in the case of a new contested document that creates a new contest + pub current_store_contest_info: Option, + /// We store contest info only in the case of a new contested document that creates a new contest + pub should_store_contest_info: Option, } /// document create transition action accessors v0 @@ -33,38 +49,59 @@ pub trait DocumentCreateTransitionActionAccessorsV0 { fn base(&self) -> &DocumentBaseTransitionAction; /// base owned fn base_owned(self) -> DocumentBaseTransitionAction; - /// created at - fn created_at(&self) -> Option; - /// updated at - fn updated_at(&self) -> Option; + /// block info + fn block_info(&self) -> BlockInfo; /// data fn data(&self) -> &BTreeMap; /// data mut fn data_mut(&mut self) -> &mut BTreeMap; /// data owned fn data_owned(self) -> BTreeMap; + + /// Take the prefunded voting balance vec (and replace it with an empty vec). + fn take_prefunded_voting_balance( + &mut self, + ) -> Option<(ContestedDocumentResourceVotePollWithContractInfo, Credits)>; + + /// pre funded balance (for unique index conflict resolution voting - the identity will put money + /// aside that will be used by voters to vote) + fn prefunded_voting_balance( + &self, + ) -> &Option<(ContestedDocumentResourceVotePollWithContractInfo, Credits)>; + + /// Get the should store contest info (if it should be stored) + fn should_store_contest_info(&self) -> &Option; + + /// Take the should store contest info (if it should be stored) and replace it with None. + fn take_should_store_contest_info(&mut self) -> Option; + + /// Get the current store contest info (if it should be stored) + fn current_store_contest_info(&self) -> &Option; + + /// Take the current store contest info (if it should be stored) and replace it with None. + fn take_current_store_contest_info(&mut self) -> Option; } /// documents from create transition v0 -pub trait DocumentFromCreateTransitionV0 { - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` instance and `owner_id`. +pub trait DocumentFromCreateTransitionActionV0 { + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionActionV0` instance and `owner_id`. /// /// # Arguments /// - /// * `value` - A `DocumentCreateTransition` instance containing information about the document being created. + /// * `value` - A `DocumentCreateTransitionActionV0` instance containing information about the document being created. /// * `owner_id` - The `Identifier` of the document's owner. /// /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_create_transition_v0( + fn try_from_owned_create_transition_action_v0( v0: DocumentCreateTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result where Self: Sized; - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` reference and `owner_id`. + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionActionV0` reference and `owner_id`. /// /// # Arguments /// @@ -74,7 +111,7 @@ pub trait DocumentFromCreateTransitionV0 { /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_create_transition_v0( + fn try_from_create_transition_action_v0( v0: &DocumentCreateTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, @@ -83,29 +120,21 @@ pub trait DocumentFromCreateTransitionV0 { Self: Sized; } -impl DocumentFromCreateTransitionV0 for Document { - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` reference and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A reference to the `DocumentCreateTransitionActionV0` containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_create_transition_v0( +impl DocumentFromCreateTransitionActionV0 for Document { + fn try_from_create_transition_action_v0( v0: &DocumentCreateTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { let DocumentCreateTransitionActionV0 { base, - created_at, - updated_at, + block_info, data, + .. } = v0; + let mut data = data.clone(); + match base { DocumentBaseTransitionAction::V0(base_v0) => { let DocumentBaseTransitionActionV0 { @@ -119,6 +148,32 @@ impl DocumentFromCreateTransitionV0 for Document { .contract .document_type_for_name(document_type_name.as_str())?; + let required_fields = document_type.required_fields(); + + let transient_fields = document_type.transient_fields(); + + if !transient_fields.is_empty() { + data.retain(|key, _| !transient_fields.contains(key)); + } + + let is_created_at_required = required_fields.contains(CREATED_AT); + let is_updated_at_required = required_fields.contains(UPDATED_AT); + let is_transferred_at_required = required_fields.contains(TRANSFERRED_AT); + + let is_created_at_block_height_required = + required_fields.contains(CREATED_AT_BLOCK_HEIGHT); + let is_updated_at_block_height_required = + required_fields.contains(UPDATED_AT_BLOCK_HEIGHT); + let is_transferred_at_block_height_required = + required_fields.contains(TRANSFERRED_AT_BLOCK_HEIGHT); + + let is_created_at_core_block_height_required = + required_fields.contains(CREATED_AT_CORE_BLOCK_HEIGHT); + let is_updated_at_core_block_height_required = + required_fields.contains(UPDATED_AT_CORE_BLOCK_HEIGHT); + let is_transferred_at_core_block_height_required = + required_fields.contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT); + match platform_version .dpp .document_versions @@ -127,10 +182,54 @@ impl DocumentFromCreateTransitionV0 for Document { 0 => Ok(DocumentV0 { id: *id, owner_id, - properties: data.clone(), + properties: data, revision: document_type.initial_revision(), - created_at: *created_at, - updated_at: *updated_at, + created_at: if is_created_at_required { + Some(block_info.time_ms) + } else { + None + }, + updated_at: if is_updated_at_required { + Some(block_info.time_ms) + } else { + None + }, + transferred_at: if is_transferred_at_required { + Some(block_info.time_ms) + } else { + None + }, + created_at_block_height: if is_created_at_block_height_required { + Some(block_info.height) + } else { + None + }, + updated_at_block_height: if is_updated_at_block_height_required { + Some(block_info.height) + } else { + None + }, + transferred_at_block_height: if is_transferred_at_block_height_required { + Some(block_info.height) + } else { + None + }, + created_at_core_block_height: if is_created_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, + updated_at_core_block_height: if is_updated_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, + transferred_at_core_block_height: + if is_transferred_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { @@ -143,26 +242,16 @@ impl DocumentFromCreateTransitionV0 for Document { } } - /// Attempts to create a new `Document` from the given `DocumentCreateTransition` instance and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A `DocumentCreateTransition` instance containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_create_transition_v0( + fn try_from_owned_create_transition_action_v0( v0: DocumentCreateTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { let DocumentCreateTransitionActionV0 { base, - created_at, - updated_at, - data, + block_info, + mut data, + .. } = v0; match base { @@ -178,6 +267,32 @@ impl DocumentFromCreateTransitionV0 for Document { .contract .document_type_for_name(document_type_name.as_str())?; + let required_fields = document_type.required_fields(); + + let transient_fields = document_type.transient_fields(); + + if !transient_fields.is_empty() { + data.retain(|key, _| !transient_fields.contains(key)); + } + + let is_created_at_required = required_fields.contains(CREATED_AT); + let is_updated_at_required = required_fields.contains(UPDATED_AT); + let is_transferred_at_required = required_fields.contains(TRANSFERRED_AT); + + let is_created_at_block_height_required = + required_fields.contains(CREATED_AT_BLOCK_HEIGHT); + let is_updated_at_block_height_required = + required_fields.contains(UPDATED_AT_BLOCK_HEIGHT); + let is_transferred_at_block_height_required = + required_fields.contains(TRANSFERRED_AT_BLOCK_HEIGHT); + + let is_created_at_core_block_height_required = + required_fields.contains(CREATED_AT_CORE_BLOCK_HEIGHT); + let is_updated_at_core_block_height_required = + required_fields.contains(UPDATED_AT_CORE_BLOCK_HEIGHT); + let is_transferred_at_core_block_height_required = + required_fields.contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT); + match platform_version .dpp .document_versions @@ -188,8 +303,52 @@ impl DocumentFromCreateTransitionV0 for Document { owner_id, properties: data, revision: document_type.initial_revision(), - created_at, - updated_at, + created_at: if is_created_at_required { + Some(block_info.time_ms) + } else { + None + }, + updated_at: if is_updated_at_required { + Some(block_info.time_ms) + } else { + None + }, + transferred_at: if is_transferred_at_required { + Some(block_info.time_ms) + } else { + None + }, + created_at_block_height: if is_created_at_block_height_required { + Some(block_info.height) + } else { + None + }, + updated_at_block_height: if is_updated_at_block_height_required { + Some(block_info.height) + } else { + None + }, + transferred_at_block_height: if is_transferred_at_block_height_required { + Some(block_info.height) + } else { + None + }, + created_at_core_block_height: if is_created_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, + updated_at_core_block_height: if is_updated_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, + transferred_at_core_block_height: + if is_transferred_at_core_block_height_required { + Some(block_info.core_height) + } else { + None + }, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/transformer.rs index fa3ceea3ff4..2c2aea87bec 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_create_transition_action/v0/transformer.rs @@ -1,57 +1,213 @@ +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::fee::fee_result::FeeResult; use dpp::platform_value::Identifier; +use grovedb::TransactionArg; use std::sync::Arc; use dpp::ProtocolError; use dpp::state_transition::documents_batch_transition::document_create_transition::v0::DocumentCreateTransitionV0; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use platform_version::version::PlatformVersion; use crate::drive::contract::DataContractFetchInfo; -use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; +use crate::drive::Drive; +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::resolve::ContestedDocumentResourceVotePollResolver; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionAccessorsV0}; use crate::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionV0; impl DocumentCreateTransitionActionV0 { /// try from document create transition with contract lookup pub fn try_from_document_create_transition_with_contract_lookup( + drive: &Drive, + transaction: TransactionArg, value: DocumentCreateTransitionV0, + block_info: &BlockInfo, get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, - ) -> Result { + platform_version: &PlatformVersion, + ) -> Result<(Self, FeeResult), Error> { let DocumentCreateTransitionV0 { base, - created_at, - updated_at, data, + prefunded_voting_balance, .. } = value; - Ok(DocumentCreateTransitionActionV0 { - base: DocumentBaseTransitionAction::from_base_transition_with_contract_lookup( + let base = DocumentBaseTransitionAction::from_base_transition_with_contract_lookup( + base, + get_data_contract, + )?; + + let document_type = base.document_type()?; + + let document_type_indexes = document_type.indexes(); + + let prefunded_voting_balances_by_vote_poll = prefunded_voting_balance + .map(|(index_name, credits)| { + let index = document_type_indexes.get(&index_name).ok_or( + ProtocolError::UnknownContestedIndexResolution(format!( + "index {} not found on document type {}", + index_name.clone(), + document_type.name() + )), + )?; + let index_values = index.extract_values(&data); + + let vote_poll = ContestedDocumentResourceVotePoll { + contract_id: base.data_contract_id(), + document_type_name: base.document_type_name().clone(), + index_name, + index_values, + }; + + let resolved_vote_poll = vote_poll + .resolve_owned_with_provided_arc_contract_fetch_info( + base.data_contract_fetch_info(), + )?; + + Ok::<_, Error>((resolved_vote_poll, credits)) + }) + .transpose()?; + + let mut fee_result = FeeResult::default(); + + let (current_store_contest_info, should_store_contest_info) = + if let Some((contested_document_resource_vote_poll, _)) = + &prefunded_voting_balances_by_vote_poll + { + let (fetch_fee_result, maybe_current_store_contest_info) = drive + .fetch_contested_document_vote_poll_stored_info( + contested_document_resource_vote_poll, + Some(&block_info.epoch), + transaction, + platform_version, + )?; + + fee_result = fetch_fee_result.ok_or(Error::Drive( + DriveError::CorruptedCodeExecution("expected fee result"), + ))?; + let should_store_contest_info = if maybe_current_store_contest_info.is_none() { + // We are starting a new contest + Some(ContestedDocumentVotePollStoredInfo::new( + *block_info, + platform_version, + )?) + } else { + None + }; + (maybe_current_store_contest_info, should_store_contest_info) + } else { + (None, None) + }; + + Ok(( + DocumentCreateTransitionActionV0 { base, - get_data_contract, - )?, - created_at, - updated_at, - data, - }) + block_info: *block_info, + data, + prefunded_voting_balance: prefunded_voting_balances_by_vote_poll, + current_store_contest_info, + should_store_contest_info, + }, + fee_result, + )) } - /// try from ... + /// try from borrowed document create transition with contract lookup pub fn try_from_borrowed_document_create_transition_with_contract_lookup( + drive: &Drive, + transaction: TransactionArg, value: &DocumentCreateTransitionV0, + block_info: &BlockInfo, get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, - ) -> Result { + platform_version: &PlatformVersion, + ) -> Result<(Self, FeeResult), Error> { let DocumentCreateTransitionV0 { base, - created_at, - updated_at, data, + prefunded_voting_balance, .. } = value; - Ok(DocumentCreateTransitionActionV0 { - base: DocumentBaseTransitionAction::from_borrowed_base_transition_with_contract_lookup( + let base = + DocumentBaseTransitionAction::from_borrowed_base_transition_with_contract_lookup( base, get_data_contract, - )?, - created_at: *created_at, - updated_at: *updated_at, - //todo: get rid of clone - data: data.clone(), - }) + )?; + + let document_type = base.document_type()?; + + let document_type_indexes = document_type.indexes(); + + let prefunded_voting_balances_by_vote_poll = prefunded_voting_balance + .as_ref() + .map(|(index_name, credits)| { + let index = document_type_indexes.get(index_name).ok_or( + ProtocolError::UnknownContestedIndexResolution(format!( + "index {} not found on document type {}", + index_name.clone(), + document_type.name() + )), + )?; + let index_values = index.extract_values(&data); + + let vote_poll = ContestedDocumentResourceVotePoll { + contract_id: base.data_contract_id(), + document_type_name: base.document_type_name().clone(), + index_name: index_name.clone(), + index_values, + }; + + let resolved_vote_poll = vote_poll + .resolve_owned_with_provided_arc_contract_fetch_info( + base.data_contract_fetch_info(), + )?; + + Ok::<_, Error>((resolved_vote_poll, *credits)) + }) + .transpose()?; + + let mut fee_result = FeeResult::default(); + + let (current_store_contest_info, should_store_contest_info) = + if let Some((contested_document_resource_vote_poll, _)) = + &prefunded_voting_balances_by_vote_poll + { + let (fetch_fee_result, maybe_current_store_contest_info) = drive + .fetch_contested_document_vote_poll_stored_info( + contested_document_resource_vote_poll, + Some(&block_info.epoch), + transaction, + platform_version, + )?; + + fee_result = fetch_fee_result.ok_or(Error::Drive( + DriveError::CorruptedCodeExecution("expected fee result"), + ))?; + let should_store_contest_info = if maybe_current_store_contest_info.is_none() { + // We are starting a new contest + Some(ContestedDocumentVotePollStoredInfo::new( + *block_info, + platform_version, + )?) + } else { + None + }; + (maybe_current_store_contest_info, should_store_contest_info) + } else { + (None, None) + }; + + Ok(( + DocumentCreateTransitionActionV0 { + base, + block_info: *block_info, + data: data.clone(), + prefunded_voting_balance: prefunded_voting_balances_by_vote_poll, + current_store_contest_info, + should_store_contest_info, + }, + fee_result, + )) } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/mod.rs new file mode 100644 index 00000000000..53a84fe1a5d --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/mod.rs @@ -0,0 +1,98 @@ +mod v0; + +use derive_more::From; +use dpp::document::Document; +use dpp::fee::Credits; + +use dpp::platform_value::Identifier; +use dpp::ProtocolError; +pub use v0::*; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; +use dpp::version::PlatformVersion; + +/// transformer +pub mod transformer; + +/// action +#[derive(Debug, Clone, From)] +pub enum DocumentPurchaseTransitionAction { + /// v0 + V0(DocumentPurchaseTransitionActionV0), +} + +impl DocumentPurchaseTransitionActionAccessorsV0 for DocumentPurchaseTransitionAction { + fn base(&self) -> &DocumentBaseTransitionAction { + match self { + DocumentPurchaseTransitionAction::V0(v0) => &v0.base, + } + } + + fn base_owned(self) -> DocumentBaseTransitionAction { + match self { + DocumentPurchaseTransitionAction::V0(v0) => v0.base, + } + } + + fn document(&self) -> &Document { + match self { + DocumentPurchaseTransitionAction::V0(v0) => &v0.document, + } + } + + fn document_owned(self) -> Document { + match self { + DocumentPurchaseTransitionAction::V0(v0) => v0.document, + } + } + + fn original_owner_id(&self) -> Identifier { + match self { + DocumentPurchaseTransitionAction::V0(v0) => v0.original_owner_id, + } + } + + fn price(&self) -> Credits { + match self { + DocumentPurchaseTransitionAction::V0(v0) => v0.price, + } + } +} + +/// document from purchase transition +pub trait DocumentFromPurchaseTransitionAction { + /// Attempts to create a new `Document` from the given `DocumentPurchaseTransitionAction` reference and `owner_id`. + /// + /// # Arguments + /// + /// * `value` - A reference to the `DocumentPurchaseTransitionAction` containing information about the document being purchased. + /// * `owner_id` - The `Identifier` of the document's owner. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_purchase_transition_action( + document_purchase_transition_action: &DocumentPurchaseTransitionAction, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + /// Attempts to create a new `Document` from the given `DocumentPurchaseTransitionAction` instance and `owner_id`. + /// + /// # Arguments + /// + /// * `value` - A `DocumentPurchaseTransitionAction` instance containing information about the document being purchased. + /// * `owner_id` - The `Identifier` of the document's owner. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_owned_purchase_transition_action( + document_purchase_transition_action: DocumentPurchaseTransitionAction, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/transformer.rs new file mode 100644 index 00000000000..894e13b5bdc --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/transformer.rs @@ -0,0 +1,33 @@ +use dpp::block::block_info::BlockInfo; +use dpp::document::Document; +use dpp::platform_value::Identifier; +use std::sync::Arc; + +use dpp::ProtocolError; +use dpp::state_transition::documents_batch_transition::document_transition::DocumentPurchaseTransition; +use crate::drive::contract::DataContractFetchInfo; +use crate::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionV0}; + +impl DocumentPurchaseTransitionAction { + /// try from borrowed + pub fn try_from_borrowed_document_purchase_transition( + document_purchase_transition: &DocumentPurchaseTransition, + original_document: Document, + purchaser_id: Identifier, + block_info: &BlockInfo, + get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, + ) -> Result { + match document_purchase_transition { + DocumentPurchaseTransition::V0(v0) => Ok( + DocumentPurchaseTransitionActionV0::try_from_borrowed_document_purchase_transition( + v0, + original_document, + purchaser_id, + block_info, + get_data_contract, + )? + .into(), + ), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/v0/mod.rs new file mode 100644 index 00000000000..785ccb32b60 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/v0/mod.rs @@ -0,0 +1,37 @@ +pub mod transformer; + +use dpp::document::Document; +use dpp::fee::Credits; +use dpp::identifier::Identifier; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; + +/// document purchase transition action v0 +#[derive(Debug, Clone)] +pub struct DocumentPurchaseTransitionActionV0 { + /// Document Base Transition + pub base: DocumentBaseTransitionAction, + /// The new document to be inserted + pub document: Document, + /// The original owner id + pub original_owner_id: Identifier, + /// Price + pub price: Credits, +} + +/// document purchase transition action accessors v0 +pub trait DocumentPurchaseTransitionActionAccessorsV0 { + /// base + fn base(&self) -> &DocumentBaseTransitionAction; + /// base owned + fn base_owned(self) -> DocumentBaseTransitionAction; + /// the document to be inserted as a ref + fn document(&self) -> &Document; + /// the document to be inserted as owned + fn document_owned(self) -> Document; + + /// The original owner id + fn original_owner_id(&self) -> Identifier; + /// Price + fn price(&self) -> Credits; +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/v0/transformer.rs new file mode 100644 index 00000000000..e888f20d33e --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_purchase_transition_action/v0/transformer.rs @@ -0,0 +1,59 @@ +use dpp::block::block_info::BlockInfo; +use dpp::document::property_names::PRICE; +use dpp::document::{property_names, Document, DocumentV0Getters, DocumentV0Setters}; +use dpp::platform_value::Identifier; +use std::sync::Arc; + +use dpp::ProtocolError; +use dpp::state_transition::documents_batch_transition::document_transition::document_purchase_transition::DocumentPurchaseTransitionV0; +use crate::drive::contract::DataContractFetchInfo; +use crate::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::v0::DocumentPurchaseTransitionActionV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionAccessorsV0}; + +impl DocumentPurchaseTransitionActionV0 { + /// try from borrowed + pub fn try_from_borrowed_document_purchase_transition( + document_purchase_transition: &DocumentPurchaseTransitionV0, + original_document: Document, + purchaser_id: Identifier, + block_info: &BlockInfo, + get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, + ) -> Result { + let DocumentPurchaseTransitionV0 { base, price, .. } = document_purchase_transition; + let base = + DocumentBaseTransitionAction::from_borrowed_base_transition_with_contract_lookup( + base, + get_data_contract, + )?; + + let original_owner_id = original_document.owner_id(); + + let mut modified_document = original_document; + + modified_document.bump_revision(); + + // We must remove the price if there is one + modified_document.properties_mut().remove(PRICE); + + modified_document.set_owner_id(purchaser_id); + + if base.document_type_field_is_required(property_names::TRANSFERRED_AT)? { + modified_document.set_transferred_at(Some(block_info.time_ms)); + } + + if base.document_type_field_is_required(property_names::TRANSFERRED_AT_BLOCK_HEIGHT)? { + modified_document.set_transferred_at_block_height(Some(block_info.height)); + } + + if base.document_type_field_is_required(property_names::TRANSFERRED_AT_CORE_BLOCK_HEIGHT)? { + modified_document.set_transferred_at_core_block_height(Some(block_info.core_height)); + } + + Ok(DocumentPurchaseTransitionActionV0 { + base, + document: modified_document, + original_owner_id, + price: *price, + }) + } +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/mod.rs index 1bc0991e48e..f2dfc222e36 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/mod.rs @@ -4,16 +4,17 @@ use std::collections::BTreeMap; use derive_more::From; -use dpp::platform_value::{Identifier, Value}; -pub use v0::*; use dpp::document::Document; use dpp::identity::TimestampMillis; -use dpp::prelude::Revision; +use dpp::platform_value::{Identifier, Value}; +use dpp::prelude::{BlockHeight, CoreBlockHeight, Revision}; use dpp::ProtocolError; +pub use v0::*; + use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; use dpp::version::PlatformVersion; -/// tranformer +/// transformer pub mod transformer; /// action @@ -54,6 +55,52 @@ impl DocumentReplaceTransitionActionAccessorsV0 for DocumentReplaceTransitionAct } } + fn transferred_at(&self) -> Option { + match self { + DocumentReplaceTransitionAction::V0(v0) => v0.transferred_at, + } + } + + /// Returns the block height at which the document was created. + fn created_at_block_height(&self) -> Option { + match self { + DocumentReplaceTransitionAction::V0(v0) => v0.created_at_block_height, + } + } + + /// Returns the block height at which the document was last updated. + fn updated_at_block_height(&self) -> Option { + match self { + DocumentReplaceTransitionAction::V0(v0) => v0.updated_at_block_height, + } + } + + fn transferred_at_block_height(&self) -> Option { + match self { + DocumentReplaceTransitionAction::V0(v0) => v0.transferred_at_block_height, + } + } + + /// Returns the core block height at which the document was created. + fn created_at_core_block_height(&self) -> Option { + match self { + DocumentReplaceTransitionAction::V0(v0) => v0.created_at_core_block_height, + } + } + + /// Returns the core block height at which the document was last updated. + fn updated_at_core_block_height(&self) -> Option { + match self { + DocumentReplaceTransitionAction::V0(v0) => v0.updated_at_core_block_height, + } + } + + fn transferred_at_core_block_height(&self) -> Option { + match self { + DocumentReplaceTransitionAction::V0(v0) => v0.transferred_at_core_block_height, + } + } + fn data(&self) -> &BTreeMap { match self { DocumentReplaceTransitionAction::V0(v0) => &v0.data, @@ -68,35 +115,35 @@ impl DocumentReplaceTransitionActionAccessorsV0 for DocumentReplaceTransitionAct } /// document from replace transition -pub trait DocumentFromReplaceTransition { - /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` reference and `owner_id`. +pub trait DocumentFromReplaceTransitionAction { + /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionAction` reference and `owner_id`. /// /// # Arguments /// - /// * `value` - A reference to the `DocumentReplaceTransition` containing information about the document being replaced. + /// * `value` - A reference to the `DocumentReplaceTransitionAction` containing information about the document being replaced. /// * `owner_id` - The `Identifier` of the document's owner. /// /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_replace_transition( + fn try_from_replace_transition_action( document_replace_transition_action: &DocumentReplaceTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result where Self: Sized; - /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` instance and `owner_id`. + /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionAction` instance and `owner_id`. /// /// # Arguments /// - /// * `value` - A `DocumentReplaceTransition` instance containing information about the document being replaced. + /// * `value` - A `DocumentReplaceTransitionAction` instance containing information about the document being replaced. /// * `owner_id` - The `Identifier` of the document's owner. /// /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_replace_transition( + fn try_from_owned_replace_transition_action( document_replace_transition_action: DocumentReplaceTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, @@ -105,47 +152,27 @@ pub trait DocumentFromReplaceTransition { Self: Sized; } -impl DocumentFromReplaceTransition for Document { - /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` reference and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A reference to the `DocumentReplaceTransition` containing information about the document being replaced. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_replace_transition( +impl DocumentFromReplaceTransitionAction for Document { + fn try_from_replace_transition_action( document_replace_transition_action: &DocumentReplaceTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { match document_replace_transition_action { DocumentReplaceTransitionAction::V0(v0) => { - Self::try_from_replace_transition_v0(v0, owner_id, platform_version) + Self::try_from_replace_transition_action_v0(v0, owner_id, platform_version) } } } - /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` instance and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A `DocumentReplaceTransition` instance containing information about the document being replaced. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_replace_transition( + fn try_from_owned_replace_transition_action( document_replace_transition_action: DocumentReplaceTransitionAction, owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { match document_replace_transition_action { DocumentReplaceTransitionAction::V0(v0) => { - Self::try_from_owned_replace_transition_v0(v0, owner_id, platform_version) + Self::try_from_owned_replace_transition_action_v0(v0, owner_id, platform_version) } } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/transformer.rs index 81f3d424759..4c5cfa6316f 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/transformer.rs @@ -1,7 +1,9 @@ +use dpp::block::block_info::BlockInfo; use dpp::platform_value::Identifier; use std::sync::Arc; use dpp::identity::TimestampMillis; +use dpp::prelude::{BlockHeight, CoreBlockHeight}; use dpp::ProtocolError; use dpp::state_transition::documents_batch_transition::document_transition::DocumentReplaceTransition; use crate::drive::contract::DataContractFetchInfo; @@ -12,6 +14,12 @@ impl DocumentReplaceTransitionAction { pub fn try_from_borrowed_document_replace_transition( document_replace_transition: &DocumentReplaceTransition, originally_created_at: Option, + originally_created_at_block_height: Option, + originally_created_at_core_block_height: Option, + originally_transferred_at: Option, + originally_transferred_at_block_height: Option, + originally_transferred_at_core_block_height: Option, + block_info: &BlockInfo, get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, ) -> Result { match document_replace_transition { @@ -19,6 +27,12 @@ impl DocumentReplaceTransitionAction { DocumentReplaceTransitionActionV0::try_from_borrowed_document_replace_transition( v0, originally_created_at, + originally_created_at_block_height, + originally_created_at_core_block_height, + originally_transferred_at, + originally_transferred_at_block_height, + originally_transferred_at_core_block_height, + block_info, get_data_contract, )? .into(), diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/mod.rs index 3da9163a221..299d71136f5 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/mod.rs @@ -3,7 +3,7 @@ pub mod transformer; use dpp::document::{Document, DocumentV0}; use dpp::identity::TimestampMillis; use dpp::platform_value::{Identifier, Value}; -use dpp::prelude::Revision; +use dpp::prelude::{BlockHeight, CoreBlockHeight, Revision}; use dpp::ProtocolError; use std::collections::BTreeMap; @@ -22,6 +22,20 @@ pub struct DocumentReplaceTransitionActionV0 { pub created_at: Option, /// The time the document was last updated pub updated_at: Option, + /// The time the document was last transferred + pub transferred_at: Option, + /// The block height at which the document was created + pub created_at_block_height: Option, + /// The block height at which the document was last updated + pub updated_at_block_height: Option, + /// The block height at which the document was last transferred + pub transferred_at_block_height: Option, + /// The core block height at which the document was created + pub created_at_core_block_height: Option, + /// The core block height at which the document was last updated + pub updated_at_core_block_height: Option, + /// The core block height at which the document was last transferred + pub transferred_at_core_block_height: Option, /// Document properties pub data: BTreeMap, } @@ -38,6 +52,26 @@ pub trait DocumentReplaceTransitionActionAccessorsV0 { fn created_at(&self) -> Option; /// updated at fn updated_at(&self) -> Option; + /// transferred at + fn transferred_at(&self) -> Option; + /// Returns the block height at which the document was created. + fn created_at_block_height(&self) -> Option; + + /// Returns the block height at which the document was last updated. + fn updated_at_block_height(&self) -> Option; + + /// Returns the block height at which the document was last transferred. + fn transferred_at_block_height(&self) -> Option; + + /// Returns the core block height at which the document was created. + fn created_at_core_block_height(&self) -> Option; + + /// Returns the core block height at which the document was last updated. + fn updated_at_core_block_height(&self) -> Option; + + /// Returns the core block height at which the document was last transferred. + fn transferred_at_core_block_height(&self) -> Option; + /// data fn data(&self) -> &BTreeMap; /// data owned @@ -45,7 +79,7 @@ pub trait DocumentReplaceTransitionActionAccessorsV0 { } /// document from replace transition v0 -pub trait DocumentFromReplaceTransitionV0 { +pub trait DocumentFromReplaceTransitionActionV0 { /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionAction` reference and `owner_id`. /// /// # Arguments @@ -56,7 +90,7 @@ pub trait DocumentFromReplaceTransitionV0 { /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_replace_transition_v0( + fn try_from_replace_transition_action_v0( value: &DocumentReplaceTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, @@ -73,7 +107,7 @@ pub trait DocumentFromReplaceTransitionV0 { /// # Returns /// /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_replace_transition_v0( + fn try_from_owned_replace_transition_action_v0( value: DocumentReplaceTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, @@ -82,18 +116,8 @@ pub trait DocumentFromReplaceTransitionV0 { Self: Sized; } -impl DocumentFromReplaceTransitionV0 for Document { - /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionAction` reference and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A reference to the `DocumentReplaceTransitionAction` containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_replace_transition_v0( +impl DocumentFromReplaceTransitionActionV0 for Document { + fn try_from_replace_transition_action_v0( value: &DocumentReplaceTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, @@ -103,6 +127,13 @@ impl DocumentFromReplaceTransitionV0 for Document { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, data, } = value; @@ -120,6 +151,13 @@ impl DocumentFromReplaceTransitionV0 for Document { revision: Some(*revision), created_at: *created_at, updated_at: *updated_at, + transferred_at: *transferred_at, + created_at_block_height: *created_at_block_height, + updated_at_block_height: *updated_at_block_height, + transferred_at_block_height: *transferred_at_block_height, + created_at_core_block_height: *created_at_core_block_height, + updated_at_core_block_height: *updated_at_core_block_height, + transferred_at_core_block_height: *transferred_at_core_block_height, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { @@ -130,17 +168,7 @@ impl DocumentFromReplaceTransitionV0 for Document { } } - /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionAction` instance and `owner_id`. - /// - /// # Arguments - /// - /// * `value` - A `DocumentReplaceTransitionAction` instance containing information about the document being created. - /// * `owner_id` - The `Identifier` of the document's owner. - /// - /// # Returns - /// - /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. - fn try_from_owned_replace_transition_v0( + fn try_from_owned_replace_transition_action_v0( value: DocumentReplaceTransitionActionV0, owner_id: Identifier, platform_version: &PlatformVersion, @@ -150,6 +178,13 @@ impl DocumentFromReplaceTransitionV0 for Document { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, data, } = value; @@ -167,6 +202,13 @@ impl DocumentFromReplaceTransitionV0 for Document { revision: Some(revision), created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/transformer.rs index 55681111fe6..8127c39532a 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_replace_transition_action/v0/transformer.rs @@ -1,36 +1,73 @@ +use dpp::block::block_info::BlockInfo; +use dpp::document::property_names; use dpp::platform_value::Identifier; use std::sync::Arc; use dpp::identity::TimestampMillis; +use dpp::prelude::{BlockHeight, CoreBlockHeight}; use dpp::ProtocolError; use dpp::state_transition::documents_batch_transition::document_transition::document_replace_transition::DocumentReplaceTransitionV0; use crate::drive::contract::DataContractFetchInfo; use crate::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::v0::DocumentReplaceTransitionActionV0; -use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionAccessorsV0}; impl DocumentReplaceTransitionActionV0 { /// try from borrowed pub fn try_from_borrowed_document_replace_transition( document_replace_transition: &DocumentReplaceTransitionV0, originally_created_at: Option, + originally_created_at_block_height: Option, + originally_created_at_core_block_height: Option, + originally_transferred_at: Option, + originally_transferred_at_block_height: Option, + originally_transferred_at_core_block_height: Option, + block_info: &BlockInfo, get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, ) -> Result { let DocumentReplaceTransitionV0 { base, revision, - updated_at, data, .. } = document_replace_transition; - Ok(DocumentReplaceTransitionActionV0 { - base: DocumentBaseTransitionAction::from_borrowed_base_transition_with_contract_lookup( + let base = + DocumentBaseTransitionAction::from_borrowed_base_transition_with_contract_lookup( base, get_data_contract, - )?, + )?; + let updated_at = if base.document_type_field_is_required(property_names::UPDATED_AT)? { + Some(block_info.time_ms) + } else { + None + }; + + let updated_at_block_height = + if base.document_type_field_is_required(property_names::UPDATED_AT_BLOCK_HEIGHT)? { + Some(block_info.height) + } else { + None + }; + + let updated_at_core_block_height = if base + .document_type_field_is_required(property_names::UPDATED_AT_CORE_BLOCK_HEIGHT)? + { + Some(block_info.core_height) + } else { + None + }; + + Ok(DocumentReplaceTransitionActionV0 { + base, revision: *revision, created_at: originally_created_at, - updated_at: *updated_at, - //todo: remove clone + updated_at, + transferred_at: originally_transferred_at, + created_at_block_height: originally_created_at_block_height, + updated_at_block_height, + transferred_at_block_height: originally_transferred_at_block_height, + created_at_core_block_height: originally_created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height: originally_transferred_at_core_block_height, data: data.clone(), }) } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/mod.rs new file mode 100644 index 00000000000..d9a38534ca9 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/mod.rs @@ -0,0 +1,85 @@ +mod v0; + +use derive_more::From; +use dpp::document::Document; + +use dpp::platform_value::Identifier; +use dpp::ProtocolError; +pub use v0::*; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; +use dpp::version::PlatformVersion; + +/// transformer +pub mod transformer; + +/// action +#[derive(Debug, Clone, From)] +pub enum DocumentTransferTransitionAction { + /// v0 + V0(DocumentTransferTransitionActionV0), +} + +impl DocumentTransferTransitionActionAccessorsV0 for DocumentTransferTransitionAction { + fn base(&self) -> &DocumentBaseTransitionAction { + match self { + DocumentTransferTransitionAction::V0(v0) => &v0.base, + } + } + + fn base_owned(self) -> DocumentBaseTransitionAction { + match self { + DocumentTransferTransitionAction::V0(v0) => v0.base, + } + } + + fn document(&self) -> &Document { + match self { + DocumentTransferTransitionAction::V0(v0) => &v0.document, + } + } + + fn document_owned(self) -> Document { + match self { + DocumentTransferTransitionAction::V0(v0) => v0.document, + } + } +} + +/// document from transfer transition +pub trait DocumentFromTransferTransitionAction { + /// Attempts to create a new `Document` from the given `DocumentTransferTransitionAction` reference and `owner_id`. + /// + /// # Arguments + /// + /// * `value` - A reference to the `DocumentTransferTransitionAction` containing information about the document being transferd. + /// * `owner_id` - The `Identifier` of the document's owner. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_transfer_transition_action( + document_transfer_transition_action: &DocumentTransferTransitionAction, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + /// Attempts to create a new `Document` from the given `DocumentTransferTransitionAction` instance and `owner_id`. + /// + /// # Arguments + /// + /// * `value` - A `DocumentTransferTransitionAction` instance containing information about the document being transferd. + /// * `owner_id` - The `Identifier` of the document's owner. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_owned_transfer_transition_action( + document_transfer_transition_action: DocumentTransferTransitionAction, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/transformer.rs new file mode 100644 index 00000000000..16bbaa4822a --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/transformer.rs @@ -0,0 +1,31 @@ +use dpp::block::block_info::BlockInfo; +use dpp::document::Document; +use dpp::platform_value::Identifier; +use std::sync::Arc; + +use dpp::ProtocolError; +use dpp::state_transition::documents_batch_transition::document_transition::DocumentTransferTransition; +use crate::drive::contract::DataContractFetchInfo; +use crate::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionV0}; + +impl DocumentTransferTransitionAction { + /// try from borrowed + pub fn try_from_borrowed_document_transfer_transition( + document_transfer_transition: &DocumentTransferTransition, + original_document: Document, + block_info: &BlockInfo, + get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, + ) -> Result { + match document_transfer_transition { + DocumentTransferTransition::V0(v0) => Ok( + DocumentTransferTransitionActionV0::try_from_borrowed_document_transfer_transition( + v0, + original_document, + block_info, + get_data_contract, + )? + .into(), + ), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/v0/mod.rs new file mode 100644 index 00000000000..d23667dd298 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/v0/mod.rs @@ -0,0 +1,26 @@ +pub mod transformer; + +use dpp::document::Document; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; + +/// document transfer transition action v0 +#[derive(Debug, Clone)] +pub struct DocumentTransferTransitionActionV0 { + /// Document Base Transition + pub base: DocumentBaseTransitionAction, + /// The new document to be inserted + pub document: Document, +} + +/// document transfer transition action accessors v0 +pub trait DocumentTransferTransitionActionAccessorsV0 { + /// base + fn base(&self) -> &DocumentBaseTransitionAction; + /// base owned + fn base_owned(self) -> DocumentBaseTransitionAction; + /// the document to be inserted as a ref + fn document(&self) -> &Document; + /// the document to be inserted as owned + fn document_owned(self) -> Document; +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/v0/transformer.rs new file mode 100644 index 00000000000..88f6d0776ab --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_transfer_transition_action/v0/transformer.rs @@ -0,0 +1,58 @@ +use dpp::block::block_info::BlockInfo; +use dpp::document::property_names::PRICE; +use dpp::document::{property_names, Document, DocumentV0Getters, DocumentV0Setters}; +use dpp::platform_value::Identifier; +use std::sync::Arc; + +use dpp::ProtocolError; +use dpp::state_transition::documents_batch_transition::document_transition::document_transfer_transition::DocumentTransferTransitionV0; +use crate::drive::contract::DataContractFetchInfo; +use crate::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::v0::DocumentTransferTransitionActionV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionAccessorsV0}; + +impl DocumentTransferTransitionActionV0 { + /// try from borrowed + pub fn try_from_borrowed_document_transfer_transition( + document_transfer_transition: &DocumentTransferTransitionV0, + original_document: Document, + block_info: &BlockInfo, + get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, + ) -> Result { + let DocumentTransferTransitionV0 { + base, + recipient_owner_id, + .. + } = document_transfer_transition; + let base = + DocumentBaseTransitionAction::from_borrowed_base_transition_with_contract_lookup( + base, + get_data_contract, + )?; + + let mut modified_document = original_document; + + modified_document.set_owner_id(*recipient_owner_id); + + // We must remove the price + modified_document.properties_mut().remove(PRICE); + + modified_document.bump_revision(); + + if base.document_type_field_is_required(property_names::TRANSFERRED_AT)? { + modified_document.set_transferred_at(Some(block_info.time_ms)); + } + + if base.document_type_field_is_required(property_names::TRANSFERRED_AT_BLOCK_HEIGHT)? { + modified_document.set_transferred_at_block_height(Some(block_info.height)); + } + + if base.document_type_field_is_required(property_names::TRANSFERRED_AT_CORE_BLOCK_HEIGHT)? { + modified_document.set_transferred_at_core_block_height(Some(block_info.core_height)); + } + + Ok(DocumentTransferTransitionActionV0 { + base, + document: modified_document, + }) + } +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/mod.rs new file mode 100644 index 00000000000..c206f21da92 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/mod.rs @@ -0,0 +1,85 @@ +mod v0; + +use derive_more::From; +use dpp::document::Document; + +use dpp::platform_value::Identifier; +use dpp::ProtocolError; +pub use v0::*; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; +use dpp::version::PlatformVersion; + +/// transformer +pub mod transformer; + +/// action +#[derive(Debug, Clone, From)] +pub enum DocumentUpdatePriceTransitionAction { + /// v0 + V0(DocumentUpdatePriceTransitionActionV0), +} + +impl DocumentUpdatePriceTransitionActionAccessorsV0 for DocumentUpdatePriceTransitionAction { + fn base(&self) -> &DocumentBaseTransitionAction { + match self { + DocumentUpdatePriceTransitionAction::V0(v0) => &v0.base, + } + } + + fn base_owned(self) -> DocumentBaseTransitionAction { + match self { + DocumentUpdatePriceTransitionAction::V0(v0) => v0.base, + } + } + + fn document(&self) -> &Document { + match self { + DocumentUpdatePriceTransitionAction::V0(v0) => &v0.document, + } + } + + fn document_owned(self) -> Document { + match self { + DocumentUpdatePriceTransitionAction::V0(v0) => v0.document, + } + } +} + +/// document from update price transition +pub trait DocumentFromUpdatePriceTransitionAction { + /// Attempts to create a new `Document` from the given `DocumentUpdatePriceTransitionAction` reference and `owner_id`. + /// + /// # Arguments + /// + /// * `value` - A reference to the `DocumentUpdatePriceTransitionAction` containing information about the document being update_priced. + /// * `owner_id` - The `Identifier` of the document's owner. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_update_price_transition_action( + document_update_price_transition_action: &DocumentUpdatePriceTransitionAction, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + /// Attempts to create a new `Document` from the given `DocumentUpdatePriceTransitionAction` instance and `owner_id`. + /// + /// # Arguments + /// + /// * `value` - A `DocumentUpdatePriceTransitionAction` instance containing information about the document being update_priced. + /// * `owner_id` - The `Identifier` of the document's owner. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_owned_update_price_transition_action( + document_update_price_transition_action: DocumentUpdatePriceTransitionAction, + owner_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/transformer.rs new file mode 100644 index 00000000000..f52e99d0d61 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/transformer.rs @@ -0,0 +1,31 @@ +use dpp::block::block_info::BlockInfo; +use dpp::document::Document; +use dpp::platform_value::Identifier; +use std::sync::Arc; + +use dpp::ProtocolError; +use dpp::state_transition::documents_batch_transition::document_transition::DocumentUpdatePriceTransition; +use crate::drive::contract::DataContractFetchInfo; +use crate::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionV0}; + +impl DocumentUpdatePriceTransitionAction { + /// try from borrowed + pub fn try_from_borrowed_document_update_price_transition( + document_update_price_transition: &DocumentUpdatePriceTransition, + original_document: Document, + block_info: &BlockInfo, + get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, + ) -> Result { + match document_update_price_transition { + DocumentUpdatePriceTransition::V0(v0) => Ok( + DocumentUpdatePriceTransitionActionV0::try_from_borrowed_document_update_price_transition( + v0, + original_document, + block_info, + get_data_contract, + )? + .into(), + ), + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/v0/mod.rs new file mode 100644 index 00000000000..37f3f8100c4 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/v0/mod.rs @@ -0,0 +1,26 @@ +pub mod transformer; + +use dpp::document::Document; + +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; + +/// document transfer transition action v0 +#[derive(Debug, Clone)] +pub struct DocumentUpdatePriceTransitionActionV0 { + /// Document Base Transition + pub base: DocumentBaseTransitionAction, + /// The new document to be updated + pub document: Document, +} + +/// document transfer transition action accessors v0 +pub trait DocumentUpdatePriceTransitionActionAccessorsV0 { + /// base + fn base(&self) -> &DocumentBaseTransitionAction; + /// base owned + fn base_owned(self) -> DocumentBaseTransitionAction; + /// the document with updated price to be reinserted as a ref + fn document(&self) -> &Document; + /// the document with updated price to be reinserted as owned + fn document_owned(self) -> Document; +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/v0/transformer.rs new file mode 100644 index 00000000000..6054d09f9b8 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/document_update_price_transition_action/v0/transformer.rs @@ -0,0 +1,51 @@ +use dpp::block::block_info::BlockInfo; +use dpp::document::property_names::PRICE; +use dpp::document::{property_names, Document, DocumentV0Setters}; +use dpp::platform_value::Identifier; +use std::sync::Arc; + +use dpp::ProtocolError; +use dpp::state_transition::documents_batch_transition::document_transition::document_update_price_transition::DocumentUpdatePriceTransitionV0; +use crate::drive::contract::DataContractFetchInfo; +use crate::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::v0::DocumentUpdatePriceTransitionActionV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionAccessorsV0}; + +impl DocumentUpdatePriceTransitionActionV0 { + /// try from borrowed + pub fn try_from_borrowed_document_update_price_transition( + document_update_price_transition: &DocumentUpdatePriceTransitionV0, + original_document: Document, + block_info: &BlockInfo, + get_data_contract: impl Fn(Identifier) -> Result, ProtocolError>, + ) -> Result { + let DocumentUpdatePriceTransitionV0 { base, price, .. } = document_update_price_transition; + let base = + DocumentBaseTransitionAction::from_borrowed_base_transition_with_contract_lookup( + base, + get_data_contract, + )?; + + let mut modified_document = original_document; + + modified_document.set_u64(PRICE, *price); + + modified_document.bump_revision(); + + if base.document_type_field_is_required(property_names::UPDATED_AT)? { + modified_document.set_updated_at(Some(block_info.time_ms)); + } + + if base.document_type_field_is_required(property_names::UPDATED_AT_BLOCK_HEIGHT)? { + modified_document.set_updated_at_block_height(Some(block_info.height)); + } + + if base.document_type_field_is_required(property_names::UPDATED_AT_CORE_BLOCK_HEIGHT)? { + modified_document.set_updated_at_core_block_height(Some(block_info.core_height)); + } + + Ok(DocumentUpdatePriceTransitionActionV0 { + base, + document: modified_document, + }) + } +} diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/mod.rs index 4888dbc9b7d..51c7f19d2d0 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/document_transition/mod.rs @@ -5,8 +5,14 @@ pub mod document_base_transition_action; pub mod document_create_transition_action; /// document_delete_transition_action pub mod document_delete_transition_action; +/// document_purchase_transition_action +pub mod document_purchase_transition_action; /// document_replace_transition_action pub mod document_replace_transition_action; +/// document_transfer_transition_action +pub mod document_transfer_transition_action; +/// document_update_price_transition_action +pub mod document_update_price_transition_action; pub use dpp::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; @@ -17,6 +23,11 @@ use crate::state_transition_action::document::documents_batch::document_transiti use crate::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; use crate::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; use crate::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionAccessorsV0}; +use crate::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionAccessorsV0}; +use crate::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionAccessorsV0}; +use crate::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; + /// version pub const DOCUMENT_TRANSITION_ACTION_VERSION: u32 = 0; @@ -29,15 +40,40 @@ pub enum DocumentTransitionAction { ReplaceAction(DocumentReplaceTransitionAction), /// delete DeleteAction(DocumentDeleteTransitionAction), + /// transfer + TransferAction(DocumentTransferTransitionAction), + /// purchase + PurchaseAction(DocumentPurchaseTransitionAction), + /// update price + UpdatePriceAction(DocumentUpdatePriceTransitionAction), + /// bump identity data contract nonce + BumpIdentityDataContractNonce(BumpIdentityDataContractNonceAction), } impl DocumentTransitionAction { /// base - pub fn base(&self) -> &DocumentBaseTransitionAction { + pub fn base(&self) -> Option<&DocumentBaseTransitionAction> { + match self { + DocumentTransitionAction::CreateAction(d) => Some(d.base()), + DocumentTransitionAction::DeleteAction(d) => Some(d.base()), + DocumentTransitionAction::ReplaceAction(d) => Some(d.base()), + DocumentTransitionAction::TransferAction(d) => Some(d.base()), + DocumentTransitionAction::PurchaseAction(d) => Some(d.base()), + DocumentTransitionAction::UpdatePriceAction(d) => Some(d.base()), + DocumentTransitionAction::BumpIdentityDataContractNonce(_) => None, + } + } + + /// base owned + pub fn base_owned(self) -> Option { match self { - DocumentTransitionAction::CreateAction(d) => d.base(), - DocumentTransitionAction::DeleteAction(d) => d.base(), - DocumentTransitionAction::ReplaceAction(d) => d.base(), + DocumentTransitionAction::CreateAction(d) => Some(d.base_owned()), + DocumentTransitionAction::DeleteAction(d) => Some(d.base_owned()), + DocumentTransitionAction::ReplaceAction(d) => Some(d.base_owned()), + DocumentTransitionAction::TransferAction(d) => Some(d.base_owned()), + DocumentTransitionAction::PurchaseAction(d) => Some(d.base_owned()), + DocumentTransitionAction::UpdatePriceAction(d) => Some(d.base_owned()), + DocumentTransitionAction::BumpIdentityDataContractNonce(_) => None, } } } diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/mod.rs index 005fb710774..9d5891f0d1f 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/mod.rs @@ -3,8 +3,10 @@ use crate::state_transition_action::document::documents_batch::v0::DocumentsBatc use derive_more::From; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::fee::Credits; use dpp::identity::SecurityLevel; use dpp::platform_value::Identifier; +use dpp::prelude::UserFeeIncrease; use dpp::ProtocolError; use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; @@ -35,15 +37,68 @@ impl DocumentsBatchTransitionAction { } } + /// transitions + pub fn transitions_mut(&mut self) -> &mut Vec { + match self { + DocumentsBatchTransitionAction::V0(v0) => &mut v0.transitions, + } + } + + /// transitions + pub fn transitions_take(&mut self) -> Vec { + match self { + DocumentsBatchTransitionAction::V0(v0) => std::mem::take(&mut v0.transitions), + } + } + /// transitions owned pub fn transitions_owned(self) -> Vec { match self { DocumentsBatchTransitionAction::V0(v0) => v0.transitions, } } + + /// set transitions + pub fn set_transitions(&mut self, transitions: Vec) { + match self { + DocumentsBatchTransitionAction::V0(v0) => v0.transitions = transitions, + } + } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DocumentsBatchTransitionAction::V0(transition) => transition.user_fee_increase, + } + } } impl DocumentsBatchTransitionAction { + /// The sum of all purchases amount and all conflicting index collateral voting funds + pub fn all_used_balances(&self) -> Result, ProtocolError> { + match self { + DocumentsBatchTransitionAction::V0(v0) => v0.all_used_balances(), + } + } + + /// The sum of all purchases amounts for all purchase transitions in the batch + pub fn all_purchases_amount(&self) -> Result, ProtocolError> { + match self { + DocumentsBatchTransitionAction::V0(v0) => v0.all_purchases_amount(), + } + } + + /// The sum of all conflicting index collateral voting funds for all document create transitions in the batch + pub fn all_conflicting_index_collateral_voting_funds( + &self, + ) -> Result, ProtocolError> { + match self { + DocumentsBatchTransitionAction::V0(v0) => { + v0.all_conflicting_index_collateral_voting_funds() + } + } + } + /// Determines the security level requirements for the batch transition action. /// /// This method performs the following steps: @@ -81,8 +136,18 @@ impl DocumentsBatchTransitionAction { let mut highest_security_level = SecurityLevel::lowest_level(); for transition in self.transitions().iter() { - let document_type_name = transition.base().document_type_name(); - let data_contract_info = transition.base().data_contract_fetch_info(); + let document_type_name = transition + .base() + .ok_or(ProtocolError::CorruptedCodeExecution( + "expecting action to have a base".to_string(), + ))? + .document_type_name(); + let data_contract_info = transition + .base() + .ok_or(ProtocolError::CorruptedCodeExecution( + "expecting action to have a base".to_string(), + ))? + .data_contract_fetch_info(); let document_type = data_contract_info .contract diff --git a/packages/rs-drive/src/state_transition_action/document/documents_batch/v0/mod.rs b/packages/rs-drive/src/state_transition_action/document/documents_batch/v0/mod.rs index 62689f8607d..295f0c45b4a 100644 --- a/packages/rs-drive/src/state_transition_action/document/documents_batch/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/document/documents_batch/v0/mod.rs @@ -1,5 +1,10 @@ +use dpp::fee::Credits; use crate::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use dpp::identifier::Identifier; +use dpp::prelude::UserFeeIncrease; +use dpp::ProtocolError; +use crate::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionActionAccessorsV0; /// action v0 #[derive(Default, Debug, Clone)] @@ -8,4 +13,69 @@ pub struct DocumentsBatchTransitionActionV0 { pub owner_id: Identifier, /// The inner transitions pub transitions: Vec, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, +} + +impl DocumentsBatchTransitionActionV0 { + pub(super) fn all_used_balances(&self) -> Result, ProtocolError> { + Ok(match (self.all_purchases_amount()?, self.all_conflicting_index_collateral_voting_funds()?) { + (Some(all_purchases_amount), Some(all_conflicting_index_collateral_voting_funds)) => Some(all_purchases_amount.checked_add(all_conflicting_index_collateral_voting_funds).ok_or(ProtocolError::Overflow("overflow between all_purchases_amount and all_conflicting_index_collateral_voting_funds"))?), + (Some(all_purchases_amount), None) => Some(all_purchases_amount), + (None, Some(all_conflicting_index_collateral_voting_funds)) => Some(all_conflicting_index_collateral_voting_funds), + (None, None) => None, + }) + } + pub(super) fn all_purchases_amount(&self) -> Result, ProtocolError> { + let (total, any_purchases): (Option, bool) = self + .transitions + .iter() + .filter_map(|transition| match transition { + DocumentTransitionAction::PurchaseAction(purchase) => Some(purchase.price()), + _ => None, + }) + .fold((None, false), |(acc, _), price| match acc { + Some(acc_val) => acc_val + .checked_add(price) + .map_or((None, true), |sum| (Some(sum), true)), + None => (Some(price), true), + }); + + match (total, any_purchases) { + (Some(total), _) => Ok(Some(total)), + (None, true) => Err(ProtocolError::Overflow("overflow in all purchases amount")), // Overflow occurred + _ => Ok(None), // No purchases were found + } + } + + pub(super) fn all_conflicting_index_collateral_voting_funds( + &self, + ) -> Result, ProtocolError> { + let (total, any_voting_funds): (Option, bool) = self + .transitions + .iter() + .filter_map(|transition| match transition { + DocumentTransitionAction::CreateAction(document_create_transition_action) => { + document_create_transition_action + .prefunded_voting_balance() + .iter() + .try_fold(0u64, |acc, &(_, val)| acc.checked_add(val)) + } + _ => None, + }) + .fold((None, false), |(acc, _), price| match acc { + Some(acc_val) => acc_val + .checked_add(price) + .map_or((None, true), |sum| (Some(sum), true)), + None => (Some(price), true), + }); + + match (total, any_voting_funds) { + (Some(total), _) => Ok(Some(total)), + (None, true) => Err(ProtocolError::Overflow( + "overflow in all voting funds amount", + )), // Overflow occurred + _ => Ok(None), + } + } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_create/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_create/mod.rs index bafaaeca538..dbc8104d5c7 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_create/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_create/mod.rs @@ -7,8 +7,10 @@ use crate::state_transition_action::identity::identity_create::v0::{ IdentityCreateTransitionActionV0, IdentityFromIdentityCreateTransitionActionV0, }; use derive_more::From; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::identity::{Identity, IdentityPublicKey, PartialIdentity}; use dpp::platform_value::{Bytes36, Identifier}; +use dpp::prelude::UserFeeIncrease; use dpp::version::PlatformVersion; use dpp::ProtocolError; @@ -28,10 +30,23 @@ impl IdentityCreateTransitionAction { } } - /// Initial Balance Amount - pub fn initial_balance_amount(&self) -> u64 { + /// Asset lock value to be consumed + /// The initial balance is equal to the remaining credit value in the asset lock value + pub fn asset_lock_value_to_be_consumed(&self) -> &AssetLockValue { match self { - IdentityCreateTransitionAction::V0(transition) => transition.initial_balance_amount, + IdentityCreateTransitionAction::V0(transition) => { + &transition.asset_lock_value_to_be_consumed + } + } + } + + /// Asset lock value to be consumed + /// The initial balance is equal to the remaining credit value in the asset lock value + pub fn asset_lock_value_to_be_consumed_owned(self) -> AssetLockValue { + match self { + IdentityCreateTransitionAction::V0(transition) => { + transition.asset_lock_value_to_be_consumed + } } } @@ -48,6 +63,13 @@ impl IdentityCreateTransitionAction { IdentityCreateTransitionAction::V0(action) => action.asset_lock_outpoint, } } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreateTransitionAction::V0(transition) => transition.user_fee_increase, + } + } } impl From for PartialIdentity { @@ -69,10 +91,10 @@ impl From<&IdentityCreateTransitionAction> for PartialIdentity { /// action pub trait IdentityFromIdentityCreateTransitionAction { /// try from - fn try_from_identity_create_transition_action( + fn try_from_identity_create_transition_action_returning_asset_lock_value( value: IdentityCreateTransitionAction, platform_version: &PlatformVersion, - ) -> Result + ) -> Result<(Self, AssetLockValue), ProtocolError> where Self: Sized; /// try from borrowed @@ -85,13 +107,16 @@ pub trait IdentityFromIdentityCreateTransitionAction { } impl IdentityFromIdentityCreateTransitionAction for Identity { - fn try_from_identity_create_transition_action( + fn try_from_identity_create_transition_action_returning_asset_lock_value( value: IdentityCreateTransitionAction, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result<(Self, AssetLockValue), ProtocolError> { match value { IdentityCreateTransitionAction::V0(v0) => { - Identity::try_from_identity_create_transition_action_v0(v0, platform_version) + Identity::try_from_identity_create_transition_action_returning_asset_lock_value_v0( + v0, + platform_version, + ) } } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_create/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_create/transformer.rs index 5ba3476ebbe..dc69bfea035 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_create/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_create/transformer.rs @@ -1,32 +1,42 @@ use crate::state_transition_action::identity::identity_create::v0::IdentityCreateTransitionActionV0; use crate::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::consensus::ConsensusError; -use dpp::fee::Credits; use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; impl IdentityCreateTransitionAction { /// try from pub fn try_from( value: IdentityCreateTransition, - initial_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + asset_lock_value_to_be_consumed: AssetLockValue, ) -> Result { match value { - IdentityCreateTransition::V0(v0) => { - Ok(IdentityCreateTransitionActionV0::try_from(v0, initial_balance_amount)?.into()) - } + IdentityCreateTransition::V0(v0) => Ok(IdentityCreateTransitionActionV0::try_from( + v0, + signable_bytes_hasher, + asset_lock_value_to_be_consumed, + )? + .into()), } } /// try from borrowed pub fn try_from_borrowed( value: &IdentityCreateTransition, - initial_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + asset_lock_value_to_be_consumed: AssetLockValue, ) -> Result { match value { - IdentityCreateTransition::V0(v0) => Ok( - IdentityCreateTransitionActionV0::try_from_borrowed(v0, initial_balance_amount)? - .into(), - ), + IdentityCreateTransition::V0(v0) => { + Ok(IdentityCreateTransitionActionV0::try_from_borrowed( + v0, + signable_bytes_hasher, + asset_lock_value_to_be_consumed, + )? + .into()) + } } } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/mod.rs index ad11547937e..d8dda5fe292 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/mod.rs @@ -4,39 +4,45 @@ pub mod transformer; use dpp::identifier::Identifier; use dpp::identity::{IdentityPublicKey, IdentityV0, PartialIdentity}; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::Identity; use dpp::platform_value::Bytes36; +use dpp::prelude::UserFeeIncrease; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; use dpp::version::PlatformVersion; use dpp::ProtocolError; -use serde::{Deserialize, Serialize}; /// action v0 -#[derive(Default, Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] +#[derive(Debug, Clone)] pub struct IdentityCreateTransitionActionV0 { + /// The state transition signable bytes hash + pub signable_bytes_hasher: SignableBytesHasher, /// public keys pub public_keys: Vec, - /// initial balance amount - pub initial_balance_amount: u64, + /// the initial balance amount is equal to the remaining asset lock value + pub asset_lock_value_to_be_consumed: AssetLockValue, /// identity id pub identity_id: Identifier, /// asset lock outpoint pub asset_lock_outpoint: Bytes36, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, } impl From for PartialIdentity { fn from(value: IdentityCreateTransitionActionV0) -> Self { let IdentityCreateTransitionActionV0 { - initial_balance_amount, + asset_lock_value_to_be_consumed, identity_id, .. } = value; PartialIdentity { id: identity_id, loaded_public_keys: Default::default(), //no need to load public keys - balance: Some(initial_balance_amount), + balance: Some(asset_lock_value_to_be_consumed.remaining_credit_value()), revision: None, + not_found_public_keys: Default::default(), } } @@ -45,15 +51,16 @@ impl From for PartialIdentity { impl From<&IdentityCreateTransitionActionV0> for PartialIdentity { fn from(value: &IdentityCreateTransitionActionV0) -> Self { let IdentityCreateTransitionActionV0 { - initial_balance_amount, + asset_lock_value_to_be_consumed, identity_id, .. } = value; PartialIdentity { id: *identity_id, loaded_public_keys: Default::default(), //no need to load public keys - balance: Some(*initial_balance_amount), + balance: Some(asset_lock_value_to_be_consumed.remaining_credit_value()), revision: None, + not_found_public_keys: Default::default(), } } @@ -62,10 +69,10 @@ impl From<&IdentityCreateTransitionActionV0> for PartialIdentity { /// action v0 pub trait IdentityFromIdentityCreateTransitionActionV0 { /// try from - fn try_from_identity_create_transition_action_v0( + fn try_from_identity_create_transition_action_returning_asset_lock_value_v0( value: IdentityCreateTransitionActionV0, platform_version: &PlatformVersion, - ) -> Result + ) -> Result<(Self, AssetLockValue), ProtocolError> where Self: Sized; /// try from borrowed @@ -78,12 +85,12 @@ pub trait IdentityFromIdentityCreateTransitionActionV0 { } impl IdentityFromIdentityCreateTransitionActionV0 for Identity { - fn try_from_identity_create_transition_action_v0( + fn try_from_identity_create_transition_action_returning_asset_lock_value_v0( value: IdentityCreateTransitionActionV0, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result<(Self, AssetLockValue), ProtocolError> { let IdentityCreateTransitionActionV0 { - initial_balance_amount, + asset_lock_value_to_be_consumed, identity_id, public_keys, .. @@ -93,13 +100,16 @@ impl IdentityFromIdentityCreateTransitionActionV0 for Identity { .identity_versions .identity_structure_version { - 0 => Ok(IdentityV0 { - id: identity_id, - public_keys: public_keys.into_iter().map(|key| (key.id(), key)).collect(), - balance: initial_balance_amount, - revision: 0, - } - .into()), + 0 => Ok(( + IdentityV0 { + id: identity_id, + public_keys: public_keys.into_iter().map(|key| (key.id(), key)).collect(), + balance: asset_lock_value_to_be_consumed.remaining_credit_value(), + revision: 0, + } + .into(), + asset_lock_value_to_be_consumed, + )), version => Err(ProtocolError::UnknownVersionMismatch { method: "Identity::try_from_identity_create_transition_action_v0".to_string(), known_versions: vec![0], @@ -112,7 +122,7 @@ impl IdentityFromIdentityCreateTransitionActionV0 for Identity { platform_version: &PlatformVersion, ) -> Result { let IdentityCreateTransitionActionV0 { - initial_balance_amount, + asset_lock_value_to_be_consumed, identity_id, public_keys, .. @@ -128,7 +138,7 @@ impl IdentityFromIdentityCreateTransitionActionV0 for Identity { .iter() .map(|key| (key.id(), key.clone())) .collect(), - balance: *initial_balance_amount, + balance: asset_lock_value_to_be_consumed.remaining_credit_value(), revision: 0, } .into()), diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/transformer.rs index c41f188bbc4..aa2e3796810 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_create/v0/transformer.rs @@ -1,10 +1,9 @@ use crate::state_transition_action::identity::identity_create::v0::IdentityCreateTransitionActionV0; -use dpp::consensus::basic::decode::SerializedObjectParsingError; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutputNotFoundError; use dpp::consensus::ConsensusError; -use dpp::fee::Credits; use dpp::platform_value::Bytes36; -use std::io; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; use dpp::state_transition::state_transitions::identity::identity_create_transition::v0::IdentityCreateTransitionV0; @@ -12,12 +11,14 @@ impl IdentityCreateTransitionActionV0 { /// try from pub fn try_from( value: IdentityCreateTransitionV0, - initial_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + asset_lock_value_to_be_consumed: AssetLockValue, ) -> Result { let IdentityCreateTransitionV0 { public_keys, identity_id, asset_lock_proof, + user_fee_increase, .. } = value; @@ -27,45 +28,44 @@ impl IdentityCreateTransitionActionV0 { ) })?; - let outpoint_bytes = asset_lock_outpoint - .try_into() - .map_err(|e: io::Error| SerializedObjectParsingError::new(e.to_string()))?; - Ok(IdentityCreateTransitionActionV0 { + signable_bytes_hasher, public_keys: public_keys.into_iter().map(|a| a.into()).collect(), - initial_balance_amount, + asset_lock_value_to_be_consumed, identity_id, - asset_lock_outpoint: Bytes36::new(outpoint_bytes), + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + user_fee_increase, }) } /// try from borrowed pub fn try_from_borrowed( value: &IdentityCreateTransitionV0, - initial_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + asset_lock_value_to_be_consumed: AssetLockValue, ) -> Result { let IdentityCreateTransitionV0 { public_keys, identity_id, asset_lock_proof, + user_fee_increase, .. } = value; + // This should already be checked in validate basic let asset_lock_outpoint = asset_lock_proof.out_point().ok_or_else(|| { IdentityAssetLockTransactionOutputNotFoundError::new( asset_lock_proof.output_index() as usize ) })?; - let outpoint_bytes = asset_lock_outpoint - .try_into() - .map_err(|e: io::Error| SerializedObjectParsingError::new(e.to_string()))?; - Ok(IdentityCreateTransitionActionV0 { + signable_bytes_hasher, public_keys: public_keys.iter().map(|key| key.into()).collect(), - initial_balance_amount, + asset_lock_value_to_be_consumed, identity_id: *identity_id, - asset_lock_outpoint: Bytes36::new(outpoint_bytes), + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + user_fee_increase: *user_fee_increase, }) } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/mod.rs index 6491d630230..01dabf088d7 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/mod.rs @@ -7,6 +7,7 @@ use crate::state_transition_action::identity::identity_credit_transfer::v0::Iden use derive_more::From; use dpp::fee::Credits; use dpp::platform_value::Identifier; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// action #[derive(Debug, Clone, From)] @@ -16,6 +17,13 @@ pub enum IdentityCreditTransferTransitionAction { } impl IdentityCreditTransferTransitionAction { + /// Nonce + pub fn nonce(&self) -> IdentityNonce { + match self { + IdentityCreditTransferTransitionAction::V0(transition) => transition.nonce, + } + } + /// Transfer amount pub fn transfer_amount(&self) -> Credits { match self { @@ -36,4 +44,11 @@ impl IdentityCreditTransferTransitionAction { IdentityCreditTransferTransitionAction::V0(transition) => transition.recipient_id, } } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreditTransferTransitionAction::V0(transition) => transition.user_fee_increase, + } + } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/mod.rs index c2eb1ab2d4f..887f05fb19f 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/mod.rs @@ -2,11 +2,10 @@ mod transformer; use dpp::fee::Credits; use dpp::platform_value::Identifier; -use serde::{Deserialize, Serialize}; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// action v0 -#[derive(Default, Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] +#[derive(Default, Debug, Clone)] pub struct IdentityCreditTransferTransitionActionV0 { /// transfer amount pub transfer_amount: Credits, @@ -14,4 +13,8 @@ pub struct IdentityCreditTransferTransitionActionV0 { pub recipient_id: Identifier, /// identity id pub identity_id: Identifier, + /// nonce + pub nonce: IdentityNonce, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/transformer.rs index 346a1c3d184..72f79a34d68 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_transfer/v0/transformer.rs @@ -7,12 +7,16 @@ impl From for IdentityCreditTransferTransiti identity_id, recipient_id, amount, + nonce, + user_fee_increase, .. } = value; IdentityCreditTransferTransitionActionV0 { identity_id, recipient_id, transfer_amount: amount, + nonce, + user_fee_increase, } } } @@ -23,12 +27,16 @@ impl From<&IdentityCreditTransferTransitionV0> for IdentityCreditTransferTransit identity_id, recipient_id, amount, + nonce, + user_fee_increase, .. } = value; IdentityCreditTransferTransitionActionV0 { identity_id: *identity_id, recipient_id: *recipient_id, transfer_amount: *amount, + nonce: *nonce, + user_fee_increase: *user_fee_increase, } } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/mod.rs index d92f86d9b44..ef579b4d5cf 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/mod.rs @@ -8,7 +8,7 @@ use derive_more::From; use dpp::document::Document; use dpp::platform_value::Identifier; -use dpp::prelude::Revision; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// action #[derive(Debug, Clone, From)] @@ -18,10 +18,10 @@ pub enum IdentityCreditWithdrawalTransitionAction { } impl IdentityCreditWithdrawalTransitionAction { - /// Withdrawal amount - pub fn revision(&self) -> Revision { + /// Nonce + pub fn nonce(&self) -> IdentityNonce { match self { - IdentityCreditWithdrawalTransitionAction::V0(transition) => transition.revision, + IdentityCreditWithdrawalTransitionAction::V0(transition) => transition.nonce, } } @@ -32,6 +32,13 @@ impl IdentityCreditWithdrawalTransitionAction { } } + /// Amount + pub fn amount(&self) -> u64 { + match self { + IdentityCreditWithdrawalTransitionAction::V0(transition) => transition.amount, + } + } + /// Recipient Id pub fn prepared_withdrawal_document(&self) -> &Document { match self { @@ -49,4 +56,13 @@ impl IdentityCreditWithdrawalTransitionAction { } } } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreditWithdrawalTransitionAction::V0(transition) => { + transition.user_fee_increase + } + } + } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/mod.rs index e41f127ebc2..7462445a2c0 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/mod.rs @@ -2,18 +2,19 @@ mod transformer; use dpp::document::Document; use dpp::identifier::Identifier; -use dpp::prelude::Revision; - -use serde::{Deserialize, Serialize}; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; /// action v0 -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] +#[derive(Debug, Clone)] pub struct IdentityCreditWithdrawalTransitionActionV0 { /// identity id pub identity_id: Identifier, - /// revision - pub revision: Revision, + /// nonce + pub nonce: IdentityNonce, /// prepared withdrawal document pub prepared_withdrawal_document: Document, + /// amount + pub amount: u64, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs index 0d3b41099de..742476740cc 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs @@ -1,6 +1,6 @@ use crate::state_transition_action::identity::identity_credit_withdrawal::v0::IdentityCreditWithdrawalTransitionActionV0; use dpp::data_contracts::withdrawals_contract; -use dpp::data_contracts::withdrawals_contract::document_types::withdrawal; +use dpp::data_contracts::withdrawals_contract::v1::document_types::withdrawal; use dpp::document::{Document, DocumentV0}; use dpp::platform_value::platform_value; use dpp::state_transition::state_transitions::identity::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; @@ -12,16 +12,21 @@ impl IdentityCreditWithdrawalTransitionActionV0 { identity_credit_withdrawal: &IdentityCreditWithdrawalTransitionV0, creation_time_ms: u64, ) -> Self { + let mut entropy = Vec::new(); + entropy.extend_from_slice(&identity_credit_withdrawal.nonce.to_be_bytes()); + entropy.extend_from_slice(identity_credit_withdrawal.output_script.as_bytes()); + let document_id = Document::generate_document_id_v0( &withdrawals_contract::ID, &identity_credit_withdrawal.identity_id, withdrawal::NAME, - identity_credit_withdrawal.output_script.as_bytes(), + &entropy, ); let document_data = platform_value!({ withdrawal::properties::AMOUNT: identity_credit_withdrawal.amount, withdrawal::properties::CORE_FEE_PER_BYTE: identity_credit_withdrawal.core_fee_per_byte, + // TODO(withdrawals): replace with actual value from state transition once pooling is done withdrawal::properties::POOLING: Pooling::Never, withdrawal::properties::OUTPUT_SCRIPT: identity_credit_withdrawal.output_script.as_bytes(), withdrawal::properties::STATUS: withdrawals_contract::WithdrawalStatus::QUEUED, @@ -34,13 +39,22 @@ impl IdentityCreditWithdrawalTransitionActionV0 { revision: Some(1), created_at: Some(creation_time_ms), updated_at: Some(creation_time_ms), + transferred_at: None, + created_at_block_height: None, + updated_at_block_height: None, + transferred_at_block_height: None, + created_at_core_block_height: None, + updated_at_core_block_height: None, + transferred_at_core_block_height: None, } .into(); IdentityCreditWithdrawalTransitionActionV0 { identity_id: identity_credit_withdrawal.identity_id, - revision: identity_credit_withdrawal.revision, + nonce: identity_credit_withdrawal.nonce, prepared_withdrawal_document: withdrawal_document, + amount: identity_credit_withdrawal.amount, + user_fee_increase: identity_credit_withdrawal.user_fee_increase, } } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_topup/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_topup/mod.rs index 0743a68fb08..09185aae5a5 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_topup/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_topup/mod.rs @@ -5,8 +5,10 @@ pub mod v0; use crate::state_transition_action::identity::identity_topup::v0::IdentityTopUpTransitionActionV0; use derive_more::From; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::platform_value::{Bytes36, Identifier}; +use dpp::prelude::UserFeeIncrease; /// action #[derive(Debug, Clone, From)] @@ -17,9 +19,16 @@ pub enum IdentityTopUpTransitionAction { impl IdentityTopUpTransitionAction { /// The balance being topped up - pub fn top_up_balance_amount(&self) -> u64 { + pub fn top_up_asset_lock_value(&self) -> &AssetLockValue { match self { - IdentityTopUpTransitionAction::V0(transition) => transition.top_up_balance_amount, + IdentityTopUpTransitionAction::V0(transition) => &transition.top_up_asset_lock_value, + } + } + + /// The balance being topped up + pub fn top_up_asset_lock_value_consume(self) -> AssetLockValue { + match self { + IdentityTopUpTransitionAction::V0(transition) => transition.top_up_asset_lock_value, } } @@ -36,4 +45,11 @@ impl IdentityTopUpTransitionAction { IdentityTopUpTransitionAction::V0(action) => action.asset_lock_outpoint, } } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityTopUpTransitionAction::V0(transition) => transition.user_fee_increase, + } + } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_topup/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_topup/transformer.rs index 71195bda6f9..fb5083963b7 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_topup/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_topup/transformer.rs @@ -1,32 +1,42 @@ use crate::state_transition_action::identity::identity_topup::v0::IdentityTopUpTransitionActionV0; use crate::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::consensus::ConsensusError; -use dpp::fee::Credits; use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; impl IdentityTopUpTransitionAction { /// try from pub fn try_from( value: IdentityTopUpTransition, - top_up_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + top_up_asset_lock_value: AssetLockValue, ) -> Result { match value { - IdentityTopUpTransition::V0(v0) => { - Ok(IdentityTopUpTransitionActionV0::try_from(v0, top_up_balance_amount)?.into()) - } + IdentityTopUpTransition::V0(v0) => Ok(IdentityTopUpTransitionActionV0::try_from( + v0, + signable_bytes_hasher, + top_up_asset_lock_value, + )? + .into()), } } /// try from borrowed pub fn try_from_borrowed( value: &IdentityTopUpTransition, - top_up_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + top_up_asset_lock_value: AssetLockValue, ) -> Result { match value { - IdentityTopUpTransition::V0(v0) => Ok( - IdentityTopUpTransitionActionV0::try_from_borrowed(v0, top_up_balance_amount)? - .into(), - ), + IdentityTopUpTransition::V0(v0) => { + Ok(IdentityTopUpTransitionActionV0::try_from_borrowed( + v0, + signable_bytes_hasher, + top_up_asset_lock_value, + )? + .into()) + } } } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/mod.rs index 2c718c420b0..6d76476587e 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/mod.rs @@ -2,17 +2,22 @@ mod transformer; use dpp::identifier::Identifier; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::platform_value::Bytes36; -use serde::{Deserialize, Serialize}; +use dpp::prelude::UserFeeIncrease; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; /// action v0 -#[derive(Default, Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] +#[derive(Debug, Clone)] pub struct IdentityTopUpTransitionActionV0 { - /// top up balance amount - pub top_up_balance_amount: u64, + /// The state transition signable bytes hash + pub signable_bytes_hasher: SignableBytesHasher, + /// we top up the remaining amount of the asset lock value + pub top_up_asset_lock_value: AssetLockValue, /// identity id pub identity_id: Identifier, /// asset lock outpoint pub asset_lock_outpoint: Bytes36, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/transformer.rs index 6a69294fcf2..fb6cd13b9b1 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_topup/v0/transformer.rs @@ -1,22 +1,23 @@ use crate::state_transition_action::identity::identity_topup::v0::IdentityTopUpTransitionActionV0; -use dpp::consensus::basic::decode::SerializedObjectParsingError; use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutputNotFoundError; -use dpp::consensus::basic::BasicError; + +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::consensus::ConsensusError; -use dpp::fee::Credits; use dpp::platform_value::Bytes36; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; use dpp::state_transition::state_transitions::identity::identity_topup_transition::v0::IdentityTopUpTransitionV0; -use std::io; impl IdentityTopUpTransitionActionV0 { /// try from pub fn try_from( value: IdentityTopUpTransitionV0, - top_up_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + top_up_asset_lock_value: AssetLockValue, ) -> Result { let IdentityTopUpTransitionV0 { identity_id, asset_lock_proof, + user_fee_increase, .. } = value; @@ -26,25 +27,25 @@ impl IdentityTopUpTransitionActionV0 { ) })?; - let outpoint_bytes = asset_lock_outpoint - .try_into() - .map_err(|e: io::Error| SerializedObjectParsingError::new(e.to_string()))?; - Ok(IdentityTopUpTransitionActionV0 { - top_up_balance_amount, + signable_bytes_hasher, + top_up_asset_lock_value, identity_id, - asset_lock_outpoint: Bytes36::new(outpoint_bytes), + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + user_fee_increase, }) } /// try from borrowed pub fn try_from_borrowed( value: &IdentityTopUpTransitionV0, - top_up_balance_amount: Credits, + signable_bytes_hasher: SignableBytesHasher, + top_up_asset_lock_value: AssetLockValue, ) -> Result { let IdentityTopUpTransitionV0 { identity_id, asset_lock_proof, + user_fee_increase, .. } = value; @@ -54,14 +55,12 @@ impl IdentityTopUpTransitionActionV0 { ) })?; - let outpoint_bytes = asset_lock_outpoint - .try_into() - .map_err(|e: io::Error| SerializedObjectParsingError::new(e.to_string()))?; - Ok(IdentityTopUpTransitionActionV0 { - top_up_balance_amount, + signable_bytes_hasher, + top_up_asset_lock_value, identity_id: *identity_id, - asset_lock_outpoint: Bytes36::new(outpoint_bytes), + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + user_fee_increase: *user_fee_increase, }) } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_update/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_update/mod.rs index 564fa1a141d..fe9e5312fb3 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_update/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_update/mod.rs @@ -5,9 +5,9 @@ pub mod v0; use crate::state_transition_action::identity::identity_update::v0::IdentityUpdateTransitionActionV0; use derive_more::From; -use dpp::identity::{IdentityPublicKey, KeyID, TimestampMillis}; +use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::platform_value::Identifier; -use dpp::prelude::Revision; +use dpp::prelude::{Revision, UserFeeIncrease}; /// action #[derive(Debug, Clone, From)] @@ -39,13 +39,6 @@ impl IdentityUpdateTransitionAction { } } - /// Public Keys Disabled At - pub fn public_keys_disabled_at(&self) -> Option { - match self { - IdentityUpdateTransitionAction::V0(transition) => transition.public_keys_disabled_at, - } - } - /// Identity Id pub fn identity_id(&self) -> Identifier { match self { @@ -59,4 +52,11 @@ impl IdentityUpdateTransitionAction { IdentityUpdateTransitionAction::V0(transition) => transition.revision, } } + + /// fee multiplier + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityUpdateTransitionAction::V0(transition) => transition.user_fee_increase, + } + } } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/mod.rs b/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/mod.rs index 082ead9868a..0400d538eaf 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/mod.rs @@ -1,22 +1,22 @@ mod transformer; use dpp::identifier::Identifier; -use dpp::identity::{IdentityPublicKey, KeyID, TimestampMillis}; -use dpp::prelude::Revision; -use serde::{Deserialize, Serialize}; +use dpp::identity::{IdentityPublicKey, KeyID}; +use dpp::prelude::{IdentityNonce, Revision, UserFeeIncrease}; /// action v0 -#[derive(Default, Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] +#[derive(Default, Debug, Clone)] pub struct IdentityUpdateTransitionActionV0 { /// add public keys pub add_public_keys: Vec, /// disable public keys pub disable_public_keys: Vec, - /// public keys disabled at - pub public_keys_disabled_at: Option, /// identity id pub identity_id: Identifier, /// revision pub revision: Revision, + /// nonce used to prevent replay attacks + pub nonce: IdentityNonce, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, } diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/transformer.rs index 1b35ba5400c..9d548b9d12b 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_update/v0/transformer.rs @@ -7,16 +7,18 @@ impl From for IdentityUpdateTransitionActionV0 { identity_id, add_public_keys, disable_public_keys, - public_keys_disabled_at, revision, + nonce, + user_fee_increase, .. } = value; IdentityUpdateTransitionActionV0 { add_public_keys: add_public_keys.into_iter().map(|a| a.into()).collect(), disable_public_keys, - public_keys_disabled_at, identity_id, revision, + nonce, + user_fee_increase, } } } @@ -27,8 +29,9 @@ impl From<&IdentityUpdateTransitionV0> for IdentityUpdateTransitionActionV0 { identity_id, add_public_keys, disable_public_keys, - public_keys_disabled_at, revision, + nonce, + user_fee_increase, .. } = value; IdentityUpdateTransitionActionV0 { @@ -37,9 +40,10 @@ impl From<&IdentityUpdateTransitionV0> for IdentityUpdateTransitionActionV0 { .map(|key| key.clone().into()) .collect(), disable_public_keys: disable_public_keys.clone(), - public_keys_disabled_at: *public_keys_disabled_at, identity_id: *identity_id, revision: *revision, + nonce: *nonce, + user_fee_increase: *user_fee_increase, } } } diff --git a/packages/rs-drive/src/state_transition_action/identity/masternode_vote/mod.rs b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/mod.rs new file mode 100644 index 00000000000..53013ef0c12 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/mod.rs @@ -0,0 +1,93 @@ +/// transformer +pub mod transformer; +/// v0 +pub mod v0; + +use crate::drive::votes::resolved::votes::ResolvedVote; +use crate::state_transition_action::identity::masternode_vote::v0::{ + MasternodeVoteTransitionActionV0, PreviousVoteCount, +}; +use derive_more::From; +use dpp::platform_value::Identifier; +use dpp::prelude::IdentityNonce; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + +/// action +#[derive(Debug, Clone, From)] +pub enum MasternodeVoteTransitionAction { + /// v0 + V0(MasternodeVoteTransitionActionV0), +} + +impl MasternodeVoteTransitionAction { + /// the pro tx hash identifier of the masternode + pub fn pro_tx_hash(&self) -> Identifier { + match self { + MasternodeVoteTransitionAction::V0(transition) => transition.pro_tx_hash, + } + } + + /// the voter identity id + pub fn voter_identity_id(&self) -> Identifier { + match self { + MasternodeVoteTransitionAction::V0(transition) => transition.voter_identity_id, + } + } + + /// the masternode list state based voting address + pub fn voting_address(&self) -> [u8; 20] { + match self { + MasternodeVoteTransitionAction::V0(transition) => transition.voting_address, + } + } + + /// Resource votes + pub fn vote_ref(&self) -> &ResolvedVote { + match self { + MasternodeVoteTransitionAction::V0(transition) => &transition.vote, + } + } + + /// Resource votes as owned + pub fn vote_owned(self) -> ResolvedVote { + match self { + MasternodeVoteTransitionAction::V0(transition) => transition.vote, + } + } + + /// Nonce + pub fn nonce(&self) -> IdentityNonce { + match self { + MasternodeVoteTransitionAction::V0(transition) => transition.nonce, + } + } + + /// Vote strength + pub fn vote_strength(&self) -> u8 { + match self { + MasternodeVoteTransitionAction::V0(transition) => transition.vote_strength, + } + } + + /// The previous resource vote choice that needs to be removed + pub fn take_previous_resource_vote_choice_to_remove( + &mut self, + ) -> Option<(ResourceVoteChoice, PreviousVoteCount)> { + match self { + MasternodeVoteTransitionAction::V0(transition) => { + transition.previous_resource_vote_choice_to_remove.take() + } + } + } + + /// The previous resource vote choice that needs to be removed + pub fn previous_resource_vote_choice_to_remove( + &self, + ) -> &Option<(ResourceVoteChoice, PreviousVoteCount)> { + match self { + MasternodeVoteTransitionAction::V0(transition) => { + &transition.previous_resource_vote_choice_to_remove + } + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/identity/masternode_vote/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/transformer.rs new file mode 100644 index 00000000000..cfe706fcd9a --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/transformer.rs @@ -0,0 +1,90 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::state_transition_action::identity::masternode_vote::v0::{ + MasternodeVoteTransitionActionV0, PreviousVoteCount, +}; +use crate::state_transition_action::identity::masternode_vote::MasternodeVoteTransitionAction; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl MasternodeVoteTransitionAction { + /// Transforms an owned `MasternodeVoteTransition` into a `MasternodeVoteTransitionAction`. + /// + /// # Parameters + /// + /// - `value`: The owned `MasternodeVoteTransition` to transform. + /// - `voter_identity_id`: The pre-calculated voter identity id, if it isn't given we will calculate it + /// - `masternode_strength`: The strength of the masternode, normal ones have 1, evonodes have 4 + /// - `drive`: A reference to the `Drive` instance. + /// - `transaction`: The transaction argument. + /// - `platform_version`: A reference to the platform version. + /// + /// # Returns + /// + /// A `Result` containing the transformed `MasternodeVoteTransitionAction`, or an `Error` if the transformation fails. + pub fn transform_from_owned_transition( + value: MasternodeVoteTransition, + voting_address: [u8; 20], + masternode_strength: u8, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match value { + MasternodeVoteTransition::V0(v0) => Ok( + MasternodeVoteTransitionActionV0::transform_from_owned_transition( + v0, + voting_address, + masternode_strength, + previous_resource_vote_choice_to_remove, + drive, + transaction, + platform_version, + )? + .into(), + ), + } + } + + /// Transforms a borrowed `MasternodeVoteTransition` into a `MasternodeVoteTransitionAction`. + /// + /// # Parameters + /// + /// - `value`: A reference to the `MasternodeVoteTransition` to transform. + /// - `voter_identity_id`: The pre-calculated voter identity id, if it isn't given we will calculate it + /// - `masternode_strength`: The strength of the masternode, normal ones have 1, evonodes have 4 + /// - `drive`: A reference to the `Drive` instance. + /// - `transaction`: The transaction argument. + /// - `platform_version`: A reference to the platform version. + /// + /// # Returns + /// + /// A `Result` containing the transformed `MasternodeVoteTransitionAction`, or an `Error` if the transformation fails. + pub fn transform_from_transition( + value: &MasternodeVoteTransition, + voting_address: [u8; 20], + masternode_strength: u8, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match value { + MasternodeVoteTransition::V0(v0) => { + Ok(MasternodeVoteTransitionActionV0::transform_from_transition( + v0, + voting_address, + masternode_strength, + previous_resource_vote_choice_to_remove, + drive, + transaction, + platform_version, + )? + .into()) + } + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/identity/masternode_vote/v0/mod.rs b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/v0/mod.rs new file mode 100644 index 00000000000..9461bb882cb --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/v0/mod.rs @@ -0,0 +1,28 @@ +mod transformer; + +use crate::drive::votes::resolved::votes::ResolvedVote; +use dpp::platform_value::Identifier; +use dpp::prelude::IdentityNonce; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + +/// The previous vote count +pub type PreviousVoteCount = u16; + +/// action v0 +#[derive(Debug, Clone)] +pub struct MasternodeVoteTransitionActionV0 { + /// the pro tx hash identifier of the masternode + pub pro_tx_hash: Identifier, + /// The voter identity id is made by hashing the pro_tx_hash and the voting address + pub voter_identity_id: Identifier, + /// The voting address used + pub voting_address: [u8; 20], + /// masternode type vote strength, masternodes have 1, evonodes have 4 + pub vote_strength: u8, + /// the resource votes + pub vote: ResolvedVote, + /// vote choice to remove + pub previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + /// nonce + pub nonce: IdentityNonce, +} diff --git a/packages/rs-drive/src/state_transition_action/identity/masternode_vote/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/v0/transformer.rs new file mode 100644 index 00000000000..d304791db1f --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/identity/masternode_vote/v0/transformer.rs @@ -0,0 +1,68 @@ +use crate::drive::votes::resolved::votes::resolve::VoteResolver; +use crate::drive::Drive; +use crate::error::Error; +use crate::state_transition_action::identity::masternode_vote::v0::{ + MasternodeVoteTransitionActionV0, PreviousVoteCount, +}; +use dpp::state_transition::state_transitions::identity::masternode_vote_transition::v0::MasternodeVoteTransitionV0; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; + +impl MasternodeVoteTransitionActionV0 { + pub(crate) fn transform_from_owned_transition( + value: MasternodeVoteTransitionV0, + voting_address: [u8; 20], + masternode_strength: u8, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let MasternodeVoteTransitionV0 { + pro_tx_hash, + voter_identity_id, + vote, + nonce, + .. + } = value; + let resolved_vote = vote.resolve_owned(drive, transaction, platform_version)?; + Ok(MasternodeVoteTransitionActionV0 { + pro_tx_hash, + voter_identity_id, + voting_address, + vote_strength: masternode_strength, + vote: resolved_vote, + previous_resource_vote_choice_to_remove, + nonce, + }) + } + + pub(crate) fn transform_from_transition( + value: &MasternodeVoteTransitionV0, + voting_address: [u8; 20], + masternode_strength: u8, + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let MasternodeVoteTransitionV0 { + pro_tx_hash, + voter_identity_id, + vote, + nonce, + .. + } = value; + let resolved_vote = vote.resolve(drive, transaction, platform_version)?; + Ok(MasternodeVoteTransitionActionV0 { + pro_tx_hash: *pro_tx_hash, + voter_identity_id: *voter_identity_id, + voting_address, + vote_strength: masternode_strength, + vote: resolved_vote, + previous_resource_vote_choice_to_remove, + nonce: *nonce, + }) + } +} diff --git a/packages/rs-drive/src/state_transition_action/identity/mod.rs b/packages/rs-drive/src/state_transition_action/identity/mod.rs index 5c7150542e4..b2be1f236bc 100644 --- a/packages/rs-drive/src/state_transition_action/identity/mod.rs +++ b/packages/rs-drive/src/state_transition_action/identity/mod.rs @@ -8,3 +8,5 @@ pub mod identity_credit_withdrawal; pub mod identity_topup; /// identity update pub mod identity_update; +/// masternode votes +pub mod masternode_vote; diff --git a/packages/rs-drive/src/state_transition_action/mod.rs b/packages/rs-drive/src/state_transition_action/mod.rs index a53952f7766..c4e9d8477cf 100644 --- a/packages/rs-drive/src/state_transition_action/mod.rs +++ b/packages/rs-drive/src/state_transition_action/mod.rs @@ -5,6 +5,11 @@ pub mod document; /// identity pub mod identity; +/// system +pub mod system; +// TODO: Must crate only but we need to remove of use it first +pub mod action_convert_to_operations; + use crate::state_transition_action::contract::data_contract_create::DataContractCreateTransitionAction; use crate::state_transition_action::contract::data_contract_update::DataContractUpdateTransitionAction; use crate::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; @@ -13,7 +18,18 @@ use crate::state_transition_action::identity::identity_credit_transfer::Identity use crate::state_transition_action::identity::identity_credit_withdrawal::IdentityCreditWithdrawalTransitionAction; use crate::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; use crate::state_transition_action::identity::identity_update::IdentityUpdateTransitionAction; +use crate::state_transition_action::identity::masternode_vote::MasternodeVoteTransitionAction; +use crate::state_transition_action::system::bump_identity_data_contract_nonce_action::{ + BumpIdentityDataContractNonceAction, BumpIdentityDataContractNonceActionAccessorsV0, +}; +use crate::state_transition_action::system::bump_identity_nonce_action::{ + BumpIdentityNonceAction, BumpIdentityNonceActionAccessorsV0, +}; +use crate::state_transition_action::system::partially_use_asset_lock_action::{ + PartiallyUseAssetLockAction, PartiallyUseAssetLockActionAccessorsV0, +}; use derive_more::From; +use dpp::prelude::UserFeeIncrease; /// ST action #[derive(Debug, Clone, From)] @@ -34,4 +50,47 @@ pub enum StateTransitionAction { IdentityUpdateAction(IdentityUpdateTransitionAction), /// identity credit transfer IdentityCreditTransferAction(IdentityCreditTransferTransitionAction), + /// masternode vote action + MasternodeVoteAction(MasternodeVoteTransitionAction), + /// bump identity nonce action + /// this can only come in this form from identity state transitions that do not use asset locks + /// it will also only happen if the state validation fails + BumpIdentityNonceAction(BumpIdentityNonceAction), + /// bump identity contract nonce action + /// this can only come in this form from the document contract update state transition + /// it will also only happen if the state validation fails + BumpIdentityDataContractNonceAction(BumpIdentityDataContractNonceAction), + /// partially use the asset lock for funding invalid asset lock transactions like + /// identity top up and identity create + PartiallyUseAssetLockAction(PartiallyUseAssetLockAction), +} + +impl StateTransitionAction { + /// The fee multiplier for the action + pub fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + StateTransitionAction::DataContractCreateAction(action) => action.user_fee_increase(), + StateTransitionAction::DataContractUpdateAction(action) => action.user_fee_increase(), + StateTransitionAction::DocumentsBatchAction(action) => action.user_fee_increase(), + StateTransitionAction::IdentityCreateAction(action) => action.user_fee_increase(), + StateTransitionAction::IdentityTopUpAction(action) => action.user_fee_increase(), + StateTransitionAction::IdentityCreditWithdrawalAction(action) => { + action.user_fee_increase() + } + StateTransitionAction::IdentityUpdateAction(action) => action.user_fee_increase(), + StateTransitionAction::IdentityCreditTransferAction(action) => { + action.user_fee_increase() + } + StateTransitionAction::BumpIdentityNonceAction(action) => action.user_fee_increase(), + StateTransitionAction::BumpIdentityDataContractNonceAction(action) => { + action.user_fee_increase() + } + StateTransitionAction::PartiallyUseAssetLockAction(action) => { + action.user_fee_increase() + } + StateTransitionAction::MasternodeVoteAction(_) => { + UserFeeIncrease::default() // 0 (or none) + } + } + } } diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/mod.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/mod.rs new file mode 100644 index 00000000000..bcd59379b31 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/mod.rs @@ -0,0 +1,43 @@ +use derive_more::From; +use dpp::platform_value::Identifier; + +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; + +/// transformer module +pub mod transformer; +mod v0; + +pub use v0::*; + +/// bump identity data contract nonce action +#[derive(Debug, Clone, From)] +pub enum BumpIdentityDataContractNonceAction { + /// v0 + V0(BumpIdentityDataContractNonceActionV0), +} + +impl BumpIdentityDataContractNonceActionAccessorsV0 for BumpIdentityDataContractNonceAction { + fn identity_id(&self) -> Identifier { + match self { + BumpIdentityDataContractNonceAction::V0(v0) => v0.identity_id, + } + } + + fn data_contract_id(&self) -> Identifier { + match self { + BumpIdentityDataContractNonceAction::V0(v0) => v0.data_contract_id, + } + } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + BumpIdentityDataContractNonceAction::V0(v0) => v0.identity_contract_nonce, + } + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + BumpIdentityDataContractNonceAction::V0(transition) => transition.user_fee_increase, + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/transformer.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/transformer.rs new file mode 100644 index 00000000000..e5c8c190740 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/transformer.rs @@ -0,0 +1,125 @@ +use dpp::platform_value::Identifier; +use dpp::prelude::UserFeeIncrease; + +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; +use dpp::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition_action::contract::data_contract_update::DataContractUpdateTransitionAction; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionAction; +use crate::state_transition_action::system::bump_identity_data_contract_nonce_action::{BumpIdentityDataContractNonceAction, BumpIdentityDataContractNonceActionV0}; + +impl BumpIdentityDataContractNonceAction { + /// from base transition + pub fn from_document_base_transition( + value: DocumentBaseTransition, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + match value { + DocumentBaseTransition::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_base_transition( + v0, + identity_id, + user_fee_increase, + ) + .into() + } + } + } + + /// from borrowed base transition + pub fn from_borrowed_document_base_transition( + value: &DocumentBaseTransition, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + match value { + DocumentBaseTransition::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_borrowed_base_transition( + v0, + identity_id, + user_fee_increase, + ) + .into() + } + } + } + + /// from base transition + pub fn from_document_base_transition_action( + value: DocumentBaseTransitionAction, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + match value { + DocumentBaseTransitionAction::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_base_transition_action( + v0, + identity_id, + user_fee_increase, + ) + .into() + } + } + } + + /// from borrowed base transition + pub fn from_borrowed_document_base_transition_action( + value: &DocumentBaseTransitionAction, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + match value { + DocumentBaseTransitionAction::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_borrowed_base_transition_action( + v0, + identity_id, + user_fee_increase, + ) + .into() + } + } + } + + /// from data contract update + pub fn from_data_contract_update_transition(value: DataContractUpdateTransition) -> Self { + match value { + DataContractUpdateTransition::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_data_contract_update(v0).into() + } + } + } + + /// from borrowed data contract update + pub fn from_borrowed_data_contract_update_transition( + value: &DataContractUpdateTransition, + ) -> Self { + match value { + DataContractUpdateTransition::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_borrowed_data_contract_update(v0).into() + } + } + } + + /// from data contract update action + pub fn from_data_contract_update_transition_action( + value: DataContractUpdateTransitionAction, + ) -> Self { + match value { + DataContractUpdateTransitionAction::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_data_contract_update_action(v0).into() + } + } + } + + /// from borrowed data contract update action + pub fn from_borrowed_data_contract_update_transition_action( + value: &DataContractUpdateTransitionAction, + ) -> Self { + match value { + DataContractUpdateTransitionAction::V0(v0) => { + BumpIdentityDataContractNonceActionV0::from_borrowed_data_contract_update_action(v0) + .into() + } + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/v0/mod.rs new file mode 100644 index 00000000000..52780ee2b4b --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/v0/mod.rs @@ -0,0 +1,31 @@ +/// transformer +pub mod transformer; + +use dpp::identifier::Identifier; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; + +#[derive(Debug, Clone)] +/// Version 0 of the bump identity data contract nonce action +/// This action is performed when we want to pay for the state transition +pub struct BumpIdentityDataContractNonceActionV0 { + /// The identity id + pub identity_id: Identifier, + /// The contract id + pub data_contract_id: Identifier, + /// The identity contract nonce, this is used to stop replay attacks + pub identity_contract_nonce: IdentityNonce, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, +} + +/// document base transition action accessors v0 +pub trait BumpIdentityDataContractNonceActionAccessorsV0 { + /// The identity id + fn identity_id(&self) -> Identifier; + /// The contract id + fn data_contract_id(&self) -> Identifier; + /// Identity contract nonce + fn identity_contract_nonce(&self) -> IdentityNonce; + /// Fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease; +} diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/v0/transformer.rs new file mode 100644 index 00000000000..42a99127900 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_data_contract_nonce_action/v0/transformer.rs @@ -0,0 +1,153 @@ +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::platform_value::Identifier; +use dpp::prelude::UserFeeIncrease; + +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransitionV0; +use dpp::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; +use crate::state_transition_action::contract::data_contract_update::v0::DataContractUpdateTransitionActionV0; +use crate::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionV0; +use crate::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceActionV0; + +impl BumpIdentityDataContractNonceActionV0 { + /// from base transition + pub fn from_base_transition( + value: DocumentBaseTransitionV0, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + let DocumentBaseTransitionV0 { + data_contract_id, + identity_contract_nonce, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id, + data_contract_id, + identity_contract_nonce, + user_fee_increase, + } + } + + /// from borrowed base transition + pub fn from_borrowed_base_transition( + value: &DocumentBaseTransitionV0, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + let DocumentBaseTransitionV0 { + data_contract_id, + identity_contract_nonce, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id, + data_contract_id: *data_contract_id, + identity_contract_nonce: *identity_contract_nonce, + user_fee_increase, + } + } + + /// from base transition + pub fn from_base_transition_action( + value: DocumentBaseTransitionActionV0, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + let DocumentBaseTransitionActionV0 { + data_contract, + identity_contract_nonce, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id, + data_contract_id: data_contract.contract.id(), + identity_contract_nonce, + user_fee_increase, + } + } + + /// from borrowed base transition + pub fn from_borrowed_base_transition_action( + value: &DocumentBaseTransitionActionV0, + identity_id: Identifier, + user_fee_increase: UserFeeIncrease, + ) -> Self { + let DocumentBaseTransitionActionV0 { + data_contract, + identity_contract_nonce, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id, + data_contract_id: data_contract.contract.id(), + identity_contract_nonce: *identity_contract_nonce, + user_fee_increase, + } + } + + /// from data contract update + pub fn from_data_contract_update(value: DataContractUpdateTransitionV0) -> Self { + let DataContractUpdateTransitionV0 { + data_contract, + identity_contract_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id: data_contract.owner_id(), + data_contract_id: data_contract.id(), + identity_contract_nonce, + user_fee_increase, + } + } + + /// from borrowed data contract update + pub fn from_borrowed_data_contract_update(value: &DataContractUpdateTransitionV0) -> Self { + let DataContractUpdateTransitionV0 { + data_contract, + identity_contract_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id: data_contract.owner_id(), + data_contract_id: data_contract.id(), + identity_contract_nonce: *identity_contract_nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from data contract update action + pub fn from_data_contract_update_action(value: DataContractUpdateTransitionActionV0) -> Self { + let DataContractUpdateTransitionActionV0 { + data_contract, + identity_contract_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id: data_contract.owner_id(), + data_contract_id: data_contract.id(), + identity_contract_nonce, + user_fee_increase, + } + } + + /// from borrowed data contract update action + pub fn from_borrowed_data_contract_update_action( + value: &DataContractUpdateTransitionActionV0, + ) -> Self { + let DataContractUpdateTransitionActionV0 { + data_contract, + identity_contract_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityDataContractNonceActionV0 { + identity_id: data_contract.owner_id(), + data_contract_id: data_contract.id(), + identity_contract_nonce: *identity_contract_nonce, + user_fee_increase: *user_fee_increase, + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/mod.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/mod.rs new file mode 100644 index 00000000000..c66be8b36a3 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/mod.rs @@ -0,0 +1,37 @@ +use derive_more::From; +use dpp::platform_value::Identifier; + +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; + +/// transformer module +pub mod transformer; +mod v0; + +pub use v0::*; + +/// bump identity nonce action +#[derive(Debug, Clone, From)] +pub enum BumpIdentityNonceAction { + /// v0 + V0(BumpIdentityNonceActionV0), +} + +impl BumpIdentityNonceActionAccessorsV0 for BumpIdentityNonceAction { + fn identity_id(&self) -> Identifier { + match self { + BumpIdentityNonceAction::V0(v0) => v0.identity_id, + } + } + + fn identity_nonce(&self) -> IdentityNonce { + match self { + BumpIdentityNonceAction::V0(v0) => v0.identity_nonce, + } + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + BumpIdentityNonceAction::V0(transition) => transition.user_fee_increase, + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/transformer.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/transformer.rs new file mode 100644 index 00000000000..674fb61d3b7 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/transformer.rs @@ -0,0 +1,180 @@ +use crate::state_transition_action::contract::data_contract_create::DataContractCreateTransitionAction; +use crate::state_transition_action::identity::identity_credit_transfer::IdentityCreditTransferTransitionAction; +use crate::state_transition_action::identity::identity_credit_withdrawal::IdentityCreditWithdrawalTransitionAction; +use crate::state_transition_action::identity::identity_update::IdentityUpdateTransitionAction; +use crate::state_transition_action::system::bump_identity_nonce_action::{ + BumpIdentityNonceAction, BumpIdentityNonceActionV0, +}; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; + +impl BumpIdentityNonceAction { + /// from identity update + pub fn from_identity_update_transition(value: IdentityUpdateTransition) -> Self { + match value { + IdentityUpdateTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_identity_update(v0).into() + } + } + } + + /// from borrowed identity update + pub fn from_borrowed_identity_update_transition(value: &IdentityUpdateTransition) -> Self { + match value { + IdentityUpdateTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_identity_update(v0).into() + } + } + } + + /// from identity update action + pub fn from_identity_update_transition_action(value: IdentityUpdateTransitionAction) -> Self { + match value { + IdentityUpdateTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_identity_update_action(v0).into() + } + } + } + + /// from borrowed identity update action + pub fn from_borrowed_identity_update_transition_action( + value: &IdentityUpdateTransitionAction, + ) -> Self { + match value { + IdentityUpdateTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_identity_update_action(v0).into() + } + } + } + + /// from data contract create transition + pub fn from_data_contract_create_transition(value: DataContractCreateTransition) -> Self { + match value { + DataContractCreateTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_contract_create(v0).into() + } + } + } + + /// from borrowed data contract create transition + pub fn from_borrowed_data_contract_create_transition( + value: &DataContractCreateTransition, + ) -> Self { + match value { + DataContractCreateTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_contract_create(v0).into() + } + } + } + + /// from data contract create transition action + pub fn from_data_contract_create_action(value: DataContractCreateTransitionAction) -> Self { + match value { + DataContractCreateTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_contract_create_action(v0).into() + } + } + } + + /// from borrowed data contract create transition action + pub fn from_borrowed_data_contract_create_action( + value: &DataContractCreateTransitionAction, + ) -> Self { + match value { + DataContractCreateTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_contract_create_action(v0).into() + } + } + } + + /// from identity transfer + pub fn from_identity_credit_transfer_transition( + value: IdentityCreditTransferTransition, + ) -> Self { + match value { + IdentityCreditTransferTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_identity_credit_transfer(v0).into() + } + } + } + + /// from borrowed identity transfer + pub fn from_borrowed_identity_credit_transfer_transition( + value: &IdentityCreditTransferTransition, + ) -> Self { + match value { + IdentityCreditTransferTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_identity_credit_transfer(v0).into() + } + } + } + + /// from identity transfer action + pub fn from_identity_credit_transfer_transition_action( + value: IdentityCreditTransferTransitionAction, + ) -> Self { + match value { + IdentityCreditTransferTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_identity_credit_transfer_action(v0).into() + } + } + } + + /// from borrowed identity transfer action + pub fn from_borrowed_identity_credit_transfer_transition_action( + value: &IdentityCreditTransferTransitionAction, + ) -> Self { + match value { + IdentityCreditTransferTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_identity_credit_transfer_action(v0).into() + } + } + } + + /// from identity withdrawal + pub fn from_identity_credit_withdrawal_transition( + value: IdentityCreditWithdrawalTransition, + ) -> Self { + match value { + IdentityCreditWithdrawalTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_identity_credit_withdrawal(v0).into() + } + } + } + + /// from borrowed identity withdrawal + pub fn from_borrowed_identity_credit_withdrawal_transition( + value: &IdentityCreditWithdrawalTransition, + ) -> Self { + match value { + IdentityCreditWithdrawalTransition::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_identity_credit_withdrawal(v0).into() + } + } + } + + /// from identity withdrawal action + pub fn from_identity_credit_withdrawal_transition_action( + value: IdentityCreditWithdrawalTransitionAction, + ) -> Self { + match value { + IdentityCreditWithdrawalTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_identity_credit_withdrawal_action(v0).into() + } + } + } + + /// from borrowed identity withdrawal action + pub fn from_borrowed_identity_credit_withdrawal_transition_action( + value: &IdentityCreditWithdrawalTransitionAction, + ) -> Self { + match value { + IdentityCreditWithdrawalTransitionAction::V0(v0) => { + BumpIdentityNonceActionV0::from_borrowed_identity_credit_withdrawal_action(v0) + .into() + } + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/v0/mod.rs new file mode 100644 index 00000000000..8437a51f704 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/v0/mod.rs @@ -0,0 +1,29 @@ +/// transformer +pub mod transformer; + +use dpp::identifier::Identifier; +use dpp::prelude::{IdentityNonce, UserFeeIncrease}; + +#[derive(Debug, Clone)] +/// Version 0 of the bump identity nonce action +/// This action is performed when we want to pay for validation of the state transition +/// but not execute it +pub struct BumpIdentityNonceActionV0 { + /// The identity id + pub identity_id: Identifier, + /// The identity contract nonce, this is used to stop replay attacks + pub identity_nonce: IdentityNonce, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, +} + +/// document base transition action accessors v0 +pub trait BumpIdentityNonceActionAccessorsV0 { + /// The identity id + fn identity_id(&self) -> Identifier; + /// Identity contract nonce + fn identity_nonce(&self) -> IdentityNonce; + + /// fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease; +} diff --git a/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/v0/transformer.rs new file mode 100644 index 00000000000..99cb8340328 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/v0/transformer.rs @@ -0,0 +1,266 @@ +use crate::state_transition_action::contract::data_contract_create::v0::DataContractCreateTransitionActionV0; +use crate::state_transition_action::identity::identity_credit_transfer::v0::IdentityCreditTransferTransitionActionV0; +use crate::state_transition_action::identity::identity_credit_withdrawal::v0::IdentityCreditWithdrawalTransitionActionV0; +use crate::state_transition_action::identity::identity_update::v0::IdentityUpdateTransitionActionV0; +use crate::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceActionV0; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; +use dpp::state_transition::identity_credit_transfer_transition::v0::IdentityCreditTransferTransitionV0; +use dpp::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +use dpp::state_transition::identity_update_transition::v0::IdentityUpdateTransitionV0; + +impl BumpIdentityNonceActionV0 { + /// from identity update + pub fn from_identity_update(value: IdentityUpdateTransitionV0) -> Self { + let IdentityUpdateTransitionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id, + identity_nonce: nonce, + user_fee_increase, + } + } + + /// from borrowed identity update + pub fn from_borrowed_identity_update(value: &IdentityUpdateTransitionV0) -> Self { + let IdentityUpdateTransitionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: *identity_id, + identity_nonce: *nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from identity update action + pub fn from_identity_update_action(value: IdentityUpdateTransitionActionV0) -> Self { + let IdentityUpdateTransitionActionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id, + identity_nonce: nonce, + user_fee_increase, + } + } + + /// from borrowed identity update action + pub fn from_borrowed_identity_update_action(value: &IdentityUpdateTransitionActionV0) -> Self { + let IdentityUpdateTransitionActionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: *identity_id, + identity_nonce: *nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from contract create + pub fn from_contract_create(value: DataContractCreateTransitionV0) -> Self { + let DataContractCreateTransitionV0 { + data_contract, + identity_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: data_contract.owner_id(), + identity_nonce, + user_fee_increase, + } + } + + /// from borrowed contract create + pub fn from_borrowed_contract_create(value: &DataContractCreateTransitionV0) -> Self { + let DataContractCreateTransitionV0 { + data_contract, + identity_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: data_contract.owner_id(), + identity_nonce: *identity_nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from contract create action + pub fn from_contract_create_action(value: DataContractCreateTransitionActionV0) -> Self { + let DataContractCreateTransitionActionV0 { + data_contract, + identity_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: data_contract.owner_id(), + identity_nonce, + user_fee_increase, + } + } + + /// from contract create action + pub fn from_borrowed_contract_create_action( + value: &DataContractCreateTransitionActionV0, + ) -> Self { + let DataContractCreateTransitionActionV0 { + data_contract, + identity_nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: data_contract.owner_id(), + identity_nonce: *identity_nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from identity credit transfer + pub fn from_identity_credit_transfer(value: IdentityCreditTransferTransitionV0) -> Self { + let IdentityCreditTransferTransitionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id, + identity_nonce: nonce, + user_fee_increase, + } + } + + /// from borrowed identity credit transfer + pub fn from_borrowed_identity_credit_transfer( + value: &IdentityCreditTransferTransitionV0, + ) -> Self { + let IdentityCreditTransferTransitionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: *identity_id, + identity_nonce: *nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from identity credit transfer action + pub fn from_identity_credit_transfer_action( + value: IdentityCreditTransferTransitionActionV0, + ) -> Self { + let IdentityCreditTransferTransitionActionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id, + identity_nonce: nonce, + user_fee_increase, + } + } + + /// from borrowed identity credit transfer action + pub fn from_borrowed_identity_credit_transfer_action( + value: &IdentityCreditTransferTransitionActionV0, + ) -> Self { + let IdentityCreditTransferTransitionActionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: *identity_id, + identity_nonce: *nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from identity credit withdrawal + pub fn from_identity_credit_withdrawal(value: IdentityCreditWithdrawalTransitionV0) -> Self { + let IdentityCreditWithdrawalTransitionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id, + identity_nonce: nonce, + user_fee_increase, + } + } + + /// from borrowed identity credit withdrawal + pub fn from_borrowed_identity_credit_withdrawal( + value: &IdentityCreditWithdrawalTransitionV0, + ) -> Self { + let IdentityCreditWithdrawalTransitionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: *identity_id, + identity_nonce: *nonce, + user_fee_increase: *user_fee_increase, + } + } + + /// from identity credit withdrawal action + pub fn from_identity_credit_withdrawal_action( + value: IdentityCreditWithdrawalTransitionActionV0, + ) -> Self { + let IdentityCreditWithdrawalTransitionActionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id, + identity_nonce: nonce, + user_fee_increase, + } + } + + /// from borrowed identity credit withdrawal action + pub fn from_borrowed_identity_credit_withdrawal_action( + value: &IdentityCreditWithdrawalTransitionActionV0, + ) -> Self { + let IdentityCreditWithdrawalTransitionActionV0 { + identity_id, + nonce, + user_fee_increase, + .. + } = value; + BumpIdentityNonceActionV0 { + identity_id: *identity_id, + identity_nonce: *nonce, + user_fee_increase: *user_fee_increase, + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/mod.rs b/packages/rs-drive/src/state_transition_action/system/mod.rs new file mode 100644 index 00000000000..38dededd711 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/mod.rs @@ -0,0 +1,8 @@ +/// bump identity data contract nonce action +pub mod bump_identity_data_contract_nonce_action; + +/// bump identity nonce action +pub mod bump_identity_nonce_action; + +/// Partially use an asset lock +pub mod partially_use_asset_lock_action; diff --git a/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/mod.rs b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/mod.rs new file mode 100644 index 00000000000..bd7ad593348 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/mod.rs @@ -0,0 +1,67 @@ +use crate::state_transition_action::system::partially_use_asset_lock_action::v0::PartiallyUseAssetLockActionV0; +use derive_more::From; +use dpp::fee::Credits; +use dpp::platform_value::{Bytes32, Bytes36}; +use dpp::prelude::UserFeeIncrease; + +mod transformer; +mod v0; + +pub use v0::PartiallyUseAssetLockActionAccessorsV0; + +#[derive(Debug, Clone, From)] +/// An action expressing that an asset lock should be partially used +pub enum PartiallyUseAssetLockAction { + /// v0 + V0(PartiallyUseAssetLockActionV0), +} + +impl PartiallyUseAssetLockActionAccessorsV0 for PartiallyUseAssetLockAction { + fn asset_lock_outpoint(&self) -> Bytes36 { + match self { + PartiallyUseAssetLockAction::V0(transition) => transition.asset_lock_outpoint, + } + } + + fn initial_credit_value(&self) -> Credits { + match self { + PartiallyUseAssetLockAction::V0(transition) => transition.initial_credit_value, + } + } + + fn asset_lock_script(&self) -> &Vec { + match self { + PartiallyUseAssetLockAction::V0(transition) => &transition.asset_lock_script, + } + } + + fn asset_lock_script_owned(self) -> Vec { + match self { + PartiallyUseAssetLockAction::V0(transition) => transition.asset_lock_script, + } + } + + fn remaining_credit_value(&self) -> Credits { + match self { + PartiallyUseAssetLockAction::V0(transition) => transition.remaining_credit_value, + } + } + + fn used_credits(&self) -> Credits { + match self { + PartiallyUseAssetLockAction::V0(transition) => transition.used_credits, + } + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + PartiallyUseAssetLockAction::V0(transition) => transition.user_fee_increase, + } + } + + fn previous_transaction_hashes_ref(&self) -> &Vec { + match self { + PartiallyUseAssetLockAction::V0(transition) => &transition.previous_transaction_hashes, + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/transformer.rs b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/transformer.rs new file mode 100644 index 00000000000..973683ed025 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/transformer.rs @@ -0,0 +1,200 @@ +use crate::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; +use crate::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; +use crate::state_transition_action::system::partially_use_asset_lock_action::v0::PartiallyUseAssetLockActionV0; +use crate::state_transition_action::system::partially_use_asset_lock_action::PartiallyUseAssetLockAction; +use dpp::consensus::basic::value_error::ValueError; +use dpp::consensus::basic::BasicError; +use dpp::consensus::ConsensusError; +use dpp::fee::Credits; +use dpp::platform_value::Bytes32; +use dpp::serialization::Signable; +use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; + +impl PartiallyUseAssetLockAction { + /// try from identity create transition + pub fn try_from_identity_create_transition( + value: IdentityCreateTransition, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + previous_transaction_hashes: Vec, + used_credits: Credits, + ) -> Result { + let signable_bytes = value.signable_bytes().map_err(|e| { + ConsensusError::BasicError(BasicError::ValueError(ValueError::new_from_string( + e.to_string(), + ))) + })?; + match value { + IdentityCreateTransition::V0(v0) => Ok( + PartiallyUseAssetLockActionV0::try_from_identity_create_transition( + v0, + signable_bytes, + asset_lock_initial_balance_amount, + asset_lock_output_script, + asset_lock_remaining_balance_amount, + previous_transaction_hashes, + used_credits, + )? + .into(), + ), + } + } + + /// try from borrowed identity create transition + pub fn try_from_borrowed_identity_create_transition( + value: &IdentityCreateTransition, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + previous_transaction_hashes: Vec, + used_credits: Credits, + ) -> Result { + let signable_bytes = value.signable_bytes().map_err(|e| { + ConsensusError::BasicError(BasicError::ValueError(ValueError::new_from_string( + e.to_string(), + ))) + })?; + match value { + IdentityCreateTransition::V0(v0) => Ok( + PartiallyUseAssetLockActionV0::try_from_borrowed_identity_create_transition( + v0, + signable_bytes, + asset_lock_initial_balance_amount, + asset_lock_output_script, + asset_lock_remaining_balance_amount, + previous_transaction_hashes, + used_credits, + )? + .into(), + ), + } + } + + /// from identity create transition action + pub fn from_identity_create_transition_action( + value: IdentityCreateTransitionAction, + used_credits: Credits, + ) -> Self { + match value { + IdentityCreateTransitionAction::V0(v0) => { + PartiallyUseAssetLockActionV0::from_identity_create_transition_action( + v0, + used_credits, + ) + .into() + } + } + } + + /// from borrowed identity create transition action + pub fn from_borrowed_identity_create_transition_action( + value: &IdentityCreateTransitionAction, + used_credits: Credits, + ) -> Self { + match value { + IdentityCreateTransitionAction::V0(v0) => { + PartiallyUseAssetLockActionV0::from_borrowed_identity_create_transition_action( + v0, + used_credits, + ) + .into() + } + } + } + + /// try from identity top up transition + pub fn try_from_identity_top_up_transition( + value: IdentityTopUpTransition, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + previous_transaction_hashes: Vec, + used_credits: Credits, + ) -> Result { + let signable_bytes = value.signable_bytes().map_err(|e| { + ConsensusError::BasicError(BasicError::ValueError(ValueError::new_from_string( + e.to_string(), + ))) + })?; + + match value { + IdentityTopUpTransition::V0(v0) => Ok( + PartiallyUseAssetLockActionV0::try_from_identity_top_up_transition( + v0, + signable_bytes, + asset_lock_initial_balance_amount, + asset_lock_output_script, + asset_lock_remaining_balance_amount, + previous_transaction_hashes, + used_credits, + )? + .into(), + ), + } + } + + /// try from borrowed identity top up transition + pub fn try_from_borrowed_identity_top_up_transition( + value: &IdentityTopUpTransition, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + previous_transaction_hashes: Vec, + used_credits: Credits, + ) -> Result { + let signable_bytes = value.signable_bytes().map_err(|e| { + ConsensusError::BasicError(BasicError::ValueError(ValueError::new_from_string( + e.to_string(), + ))) + })?; + + match value { + IdentityTopUpTransition::V0(v0) => Ok( + PartiallyUseAssetLockActionV0::try_from_borrowed_identity_top_up_transition( + v0, + signable_bytes, + asset_lock_initial_balance_amount, + asset_lock_output_script, + asset_lock_remaining_balance_amount, + previous_transaction_hashes, + used_credits, + )? + .into(), + ), + } + } + + /// from identity top up transition action + pub fn from_identity_top_up_transition_action( + value: IdentityTopUpTransitionAction, + used_credits: Credits, + ) -> Self { + match value { + IdentityTopUpTransitionAction::V0(v0) => { + PartiallyUseAssetLockActionV0::from_identity_top_up_transition_action( + v0, + used_credits, + ) + .into() + } + } + } + + /// from borrowed identity top up transition action + pub fn from_borrowed_identity_top_up_transition_action( + value: &IdentityTopUpTransitionAction, + used_credits: Credits, + ) -> Self { + match value { + IdentityTopUpTransitionAction::V0(v0) => { + PartiallyUseAssetLockActionV0::from_borrowed_identity_top_up_transition_action( + v0, + used_credits, + ) + .into() + } + } + } +} diff --git a/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/v0/mod.rs b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/v0/mod.rs new file mode 100644 index 00000000000..56ff3f5047c --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/v0/mod.rs @@ -0,0 +1,43 @@ +use dpp::fee::Credits; +use dpp::platform_value::{Bytes32, Bytes36}; +use dpp::prelude::UserFeeIncrease; +mod transformer; +#[derive(Default, Debug, Clone)] +pub struct PartiallyUseAssetLockActionV0 { + /// asset lock outpoint + pub asset_lock_outpoint: Bytes36, + /// initial credit value + pub initial_credit_value: Credits, + /// the previous transaction signable bytes hashes that tried to used this asset lock, but failed + pub previous_transaction_hashes: Vec, + /// asset lock script + pub asset_lock_script: Vec, + /// remaining credit value AFTER used credits are deducted + pub remaining_credit_value: Credits, + /// the used credits for processing, this is what will go to Evonodes for processing + /// this is after applying the user fee increase + pub used_credits: Credits, + /// fee multiplier + pub user_fee_increase: UserFeeIncrease, +} + +/// document base transition action accessors v0 +pub trait PartiallyUseAssetLockActionAccessorsV0 { + /// asset lock outpoint + fn asset_lock_outpoint(&self) -> Bytes36; + /// initial credit value + fn initial_credit_value(&self) -> Credits; + /// asset lock script used to very that the asset lock can be used + fn asset_lock_script(&self) -> &Vec; + /// asset lock script used to very that the asset lock can be used, this consumes the action + fn asset_lock_script_owned(self) -> Vec; + /// remaining credit value AFTER used credits are deducted + fn remaining_credit_value(&self) -> Credits; + /// the used credits for processing, this is what will go to Evonodes for processing + fn used_credits(&self) -> Credits; + /// fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease; + + /// the previous transaction signable bytes hashes that tried to used this asset lock, but failed + fn previous_transaction_hashes_ref(&self) -> &Vec; +} diff --git a/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/v0/transformer.rs new file mode 100644 index 00000000000..ced93e1e265 --- /dev/null +++ b/packages/rs-drive/src/state_transition_action/system/partially_use_asset_lock_action/v0/transformer.rs @@ -0,0 +1,339 @@ +use crate::state_transition_action::identity::identity_create::v0::IdentityCreateTransitionActionV0; +use crate::state_transition_action::identity::identity_topup::v0::IdentityTopUpTransitionActionV0; +use crate::state_transition_action::system::partially_use_asset_lock_action::v0::PartiallyUseAssetLockActionV0; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValueGettersV0; +use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutputNotFoundError; +use dpp::consensus::ConsensusError; +use dpp::fee::Credits; +use dpp::platform_value::{Bytes32, Bytes36}; +use dpp::state_transition::identity_create_transition::v0::IdentityCreateTransitionV0; +use dpp::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; +use dpp::util::hash::hash_double; + +impl PartiallyUseAssetLockActionV0 { + /// try from identity create transition + pub fn try_from_identity_create_transition( + value: IdentityCreateTransitionV0, + signable_bytes: Vec, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + mut previous_transaction_hashes: Vec, + desired_used_credits: Credits, + ) -> Result { + let signable_bytes_hash = hash_double(signable_bytes); + previous_transaction_hashes.push(signable_bytes_hash.into()); + + let IdentityCreateTransitionV0 { + asset_lock_proof, + user_fee_increase, + .. + } = value; + + let asset_lock_outpoint = asset_lock_proof.out_point().ok_or_else(|| { + IdentityAssetLockTransactionOutputNotFoundError::new( + asset_lock_proof.output_index() as usize + ) + })?; + + let remaining_balance_after_used_credits_are_deducted = + asset_lock_remaining_balance_amount.saturating_sub(desired_used_credits); + + // In the case that we want to pay for processing on a partially used asset lock, and we have already done that + // processing, and also that the processing was more than the balance on the asset lock it's better just to take + // the remaining balance. + let used_credits = std::cmp::min(asset_lock_remaining_balance_amount, desired_used_credits); + + Ok(PartiallyUseAssetLockActionV0 { + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + initial_credit_value: asset_lock_initial_balance_amount, + previous_transaction_hashes, + asset_lock_script: asset_lock_output_script, + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase, + }) + } + + /// try from borrowed identity create transition + pub fn try_from_borrowed_identity_create_transition( + value: &IdentityCreateTransitionV0, + signable_bytes: Vec, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + mut previous_transaction_hashes: Vec, + desired_used_credits: Credits, + ) -> Result { + let signable_bytes_hash = hash_double(signable_bytes); + previous_transaction_hashes.push(signable_bytes_hash.into()); + + let IdentityCreateTransitionV0 { + asset_lock_proof, + user_fee_increase, + .. + } = value; + + let asset_lock_outpoint = asset_lock_proof.out_point().ok_or_else(|| { + IdentityAssetLockTransactionOutputNotFoundError::new( + asset_lock_proof.output_index() as usize + ) + })?; + + // Saturating because we can only have 0 left + let remaining_balance_after_used_credits_are_deducted = + asset_lock_remaining_balance_amount.saturating_sub(desired_used_credits); + + // In the case that we want to pay for processing on a partially used asset lock, and we have already done that + // processing, and also that the processing was more than the balance on the asset lock it's better just to take + // the remaining balance. + let used_credits = std::cmp::min(asset_lock_remaining_balance_amount, desired_used_credits); + + Ok(PartiallyUseAssetLockActionV0 { + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + initial_credit_value: asset_lock_initial_balance_amount, + previous_transaction_hashes, + asset_lock_script: asset_lock_output_script, + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase: *user_fee_increase, + }) + } + + /// from identity create transition action + pub fn from_identity_create_transition_action( + value: IdentityCreateTransitionActionV0, + desired_used_credits: Credits, + ) -> Self { + let IdentityCreateTransitionActionV0 { + signable_bytes_hasher, + asset_lock_outpoint, + asset_lock_value_to_be_consumed, + user_fee_increase, + .. + } = value; + + let remaining_balance_after_used_credits_are_deducted = asset_lock_value_to_be_consumed + .remaining_credit_value() + .saturating_sub(desired_used_credits); + + let used_credits = std::cmp::min( + asset_lock_value_to_be_consumed.remaining_credit_value(), + desired_used_credits, + ); + + //todo: remove clone + let mut used_tags = asset_lock_value_to_be_consumed.used_tags_ref().clone(); + + used_tags.push(signable_bytes_hasher.into_hashed_bytes()); + + PartiallyUseAssetLockActionV0 { + asset_lock_outpoint, + initial_credit_value: asset_lock_value_to_be_consumed.initial_credit_value(), + previous_transaction_hashes: used_tags, + asset_lock_script: asset_lock_value_to_be_consumed.tx_out_script_owned(), + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase, + } + } + + /// from borrowed identity create transition action + pub fn from_borrowed_identity_create_transition_action( + value: &IdentityCreateTransitionActionV0, + desired_used_credits: Credits, + ) -> Self { + let IdentityCreateTransitionActionV0 { + signable_bytes_hasher, + asset_lock_outpoint, + asset_lock_value_to_be_consumed, + user_fee_increase, + .. + } = value; + + let remaining_balance_after_used_credits_are_deducted = asset_lock_value_to_be_consumed + .remaining_credit_value() + .saturating_sub(desired_used_credits); + + let used_credits = std::cmp::min( + asset_lock_value_to_be_consumed.remaining_credit_value(), + desired_used_credits, + ); + + let mut used_tags = asset_lock_value_to_be_consumed.used_tags_ref().clone(); + + used_tags.push(signable_bytes_hasher.to_hashed_bytes()); + + PartiallyUseAssetLockActionV0 { + asset_lock_outpoint: *asset_lock_outpoint, + initial_credit_value: asset_lock_value_to_be_consumed.initial_credit_value(), + previous_transaction_hashes: used_tags, + asset_lock_script: asset_lock_value_to_be_consumed.tx_out_script().clone(), + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase: *user_fee_increase, + } + } + + /// try from identity top up transition + pub fn try_from_identity_top_up_transition( + value: IdentityTopUpTransitionV0, + signable_bytes: Vec, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + mut previous_transaction_hashes: Vec, + desired_used_credits: Credits, + ) -> Result { + let signable_bytes_hash = hash_double(signable_bytes); + previous_transaction_hashes.push(signable_bytes_hash.into()); + + let IdentityTopUpTransitionV0 { + asset_lock_proof, + user_fee_increase, + .. + } = value; + + let asset_lock_outpoint = asset_lock_proof.out_point().ok_or_else(|| { + IdentityAssetLockTransactionOutputNotFoundError::new( + asset_lock_proof.output_index() as usize + ) + })?; + + let remaining_balance_after_used_credits_are_deducted = + asset_lock_remaining_balance_amount.saturating_sub(desired_used_credits); + + // In the case that we want to pay for processing on a partially used asset lock, and we have already done that + // processing, and also that the processing was more than the balance on the asset lock it's better just to take + // the remaining balance. + let used_credits = std::cmp::min(asset_lock_remaining_balance_amount, desired_used_credits); + + Ok(PartiallyUseAssetLockActionV0 { + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + initial_credit_value: asset_lock_initial_balance_amount, + previous_transaction_hashes, + asset_lock_script: asset_lock_output_script, + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase, + }) + } + + /// try from borrowed identity top up transition + pub fn try_from_borrowed_identity_top_up_transition( + value: &IdentityTopUpTransitionV0, + signable_bytes: Vec, + asset_lock_initial_balance_amount: Credits, + asset_lock_output_script: Vec, + asset_lock_remaining_balance_amount: Credits, + mut previous_transaction_hashes: Vec, + desired_used_credits: Credits, + ) -> Result { + let signable_bytes_hash = hash_double(signable_bytes); + previous_transaction_hashes.push(signable_bytes_hash.into()); + + let IdentityTopUpTransitionV0 { + asset_lock_proof, + user_fee_increase, + .. + } = value; + + let asset_lock_outpoint = asset_lock_proof.out_point().ok_or_else(|| { + IdentityAssetLockTransactionOutputNotFoundError::new( + asset_lock_proof.output_index() as usize + ) + })?; + + let remaining_balance_after_used_credits_are_deducted = + asset_lock_remaining_balance_amount.saturating_sub(desired_used_credits); + + // In the case that we want to pay for processing on a partially used asset lock, and we have already done that + // processing, and also that the processing was more than the balance on the asset lock it's better just to take + // the remaining balance. + let used_credits = std::cmp::min(asset_lock_remaining_balance_amount, desired_used_credits); + + Ok(PartiallyUseAssetLockActionV0 { + asset_lock_outpoint: Bytes36::new(asset_lock_outpoint.into()), + initial_credit_value: asset_lock_initial_balance_amount, + previous_transaction_hashes, + asset_lock_script: asset_lock_output_script, + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase: *user_fee_increase, + }) + } + + /// from identity top up transition action + pub fn from_identity_top_up_transition_action( + value: IdentityTopUpTransitionActionV0, + desired_used_credits: Credits, + ) -> Self { + let IdentityTopUpTransitionActionV0 { + signable_bytes_hasher, + asset_lock_outpoint, + top_up_asset_lock_value, + user_fee_increase, + .. + } = value; + + let remaining_balance_after_used_credits_are_deducted = top_up_asset_lock_value + .remaining_credit_value() + .saturating_sub(desired_used_credits); + + let used_credits = std::cmp::min( + top_up_asset_lock_value.remaining_credit_value(), + desired_used_credits, + ); + + let mut used_tags = top_up_asset_lock_value.used_tags_ref().clone(); + + used_tags.push(signable_bytes_hasher.into_hashed_bytes()); + + PartiallyUseAssetLockActionV0 { + asset_lock_outpoint, + initial_credit_value: top_up_asset_lock_value.initial_credit_value(), + previous_transaction_hashes: used_tags, + asset_lock_script: top_up_asset_lock_value.tx_out_script_owned(), + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase, + } + } + + /// from borrowed identity top up transition + pub fn from_borrowed_identity_top_up_transition_action( + value: &IdentityTopUpTransitionActionV0, + desired_used_credits: Credits, + ) -> Self { + let IdentityTopUpTransitionActionV0 { + signable_bytes_hasher, + asset_lock_outpoint, + top_up_asset_lock_value, + user_fee_increase, + .. + } = value; + + let remaining_balance_after_used_credits_are_deducted = top_up_asset_lock_value + .remaining_credit_value() + .saturating_sub(desired_used_credits); + + let used_credits = std::cmp::min( + top_up_asset_lock_value.remaining_credit_value(), + desired_used_credits, + ); + + let mut used_tags = top_up_asset_lock_value.used_tags_ref().clone(); + + used_tags.push(signable_bytes_hasher.to_hashed_bytes()); + + PartiallyUseAssetLockActionV0 { + asset_lock_outpoint: *asset_lock_outpoint, + initial_credit_value: top_up_asset_lock_value.initial_credit_value(), + previous_transaction_hashes: used_tags, + asset_lock_script: top_up_asset_lock_value.tx_out_script().clone(), + remaining_credit_value: remaining_balance_after_used_credits_are_deducted, + used_credits, + user_fee_increase: *user_fee_increase, + } + } +} diff --git a/packages/rs-drive/src/tests/helpers/mod.rs b/packages/rs-drive/src/tests/helpers/mod.rs deleted file mode 100644 index 138906d09f7..00000000000 --- a/packages/rs-drive/src/tests/helpers/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod setup; diff --git a/packages/rs-drive/src/tests/helpers/setup.rs b/packages/rs-drive/src/tests/helpers/setup.rs deleted file mode 100644 index 15095a15f2f..00000000000 --- a/packages/rs-drive/src/tests/helpers/setup.rs +++ /dev/null @@ -1,134 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Drive Setup Helpers. -//! -//! Defines helper functions pertinent to setting up Drive. -//! - -use crate::drive::config::DriveConfig; -use crate::drive::Drive; -use dpp::block::block_info::BlockInfo; - -use crate::drive::object_size_info::DocumentInfo::DocumentRefInfo; -use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; -use dpp::data_contract::document_type::DocumentTypeRef; -use dpp::data_contract::DataContract; -use dpp::document::Document; - -use dpp::version::PlatformVersion; -use grovedb::TransactionArg; -use tempfile::TempDir; - -/// Struct with options regarding setting up fee pools. -pub struct SetupFeePoolsOptions { - /// Bool indicating whether the fee pool structure should be applied upon setup. - pub apply_fee_pool_structure: bool, -} - -impl Default for SetupFeePoolsOptions { - /// The default is true for applying the fee pool structure upon setting up fee pools. - fn default() -> SetupFeePoolsOptions { - SetupFeePoolsOptions { - apply_fee_pool_structure: true, - } - } -} - -/// Sets up Drive using a temporary directory and the optionally given Drive configuration settings. -pub fn setup_drive(drive_config: Option) -> Drive { - let tmp_dir = TempDir::new().unwrap(); - let platform_version = PlatformVersion::latest(); - let drive: Drive = Drive::open(tmp_dir, drive_config, platform_version) - .expect("should open Drive successfully"); - - drive -} - -/// Sets up Drive using a temporary directory and the default initial state structure. -pub fn setup_drive_with_initial_state_structure() -> Drive { - let drive = setup_drive(Some(DriveConfig { - batching_consistency_verification: true, - ..Default::default() - })); - - let platform_version = PlatformVersion::latest(); - drive - .create_initial_state_structure(None, platform_version) - .expect("should create root tree successfully"); - - drive -} - -/// A function to setup system data contract -pub fn setup_system_data_contract( - drive: &Drive, - data_contract: &DataContract, - transaction: TransactionArg, -) { - let platform_version = PlatformVersion::latest(); - drive - .apply_contract( - data_contract, - BlockInfo::default(), - true, - None, - transaction, - platform_version, - ) - .unwrap(); -} - -/// Setup document for a contract -pub fn setup_document( - drive: &Drive, - document: &Document, - data_contract: &DataContract, - document_type: DocumentTypeRef, - transaction: TransactionArg, -) { - let platform_version = PlatformVersion::latest(); - drive - .add_document_for_contract( - DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo((document, None)), - owner_id: None, - }, - contract: data_contract, - document_type, - }, - false, - BlockInfo::default(), - true, - transaction, - platform_version, - ) - .unwrap(); -} diff --git a/packages/rs-drive/src/tests/mod.rs b/packages/rs-drive/src/tests/mod.rs deleted file mode 100644 index b87c65442fc..00000000000 --- a/packages/rs-drive/src/tests/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -/// Test helpers -pub mod helpers; diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/contract.rs b/packages/rs-drive/src/util/batch/drive_op_batch/contract.rs similarity index 95% rename from packages/rs-drive/src/drive/batch/drive_op_batch/contract.rs rename to packages/rs-drive/src/util/batch/drive_op_batch/contract.rs index b74eedd04c8..59d2b05c670 100644 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/contract.rs +++ b/packages/rs-drive/src/util/batch/drive_op_batch/contract.rs @@ -1,16 +1,17 @@ -use crate::drive::batch::drive_op_batch::DriveLowLevelOperationConverter; -use crate::drive::flags::StorageFlags; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::drive_op_batch::DriveLowLevelOperationConverter; +use crate::util::storage_flags::StorageFlags; use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; -use crate::drive::batch::drive_op_batch::finalize_task::{ +use crate::error::drive::DriveError; +use crate::util::batch::drive_op_batch::finalize_task::{ DriveOperationFinalizationTasks, DriveOperationFinalizeTask, }; -use crate::error::drive::DriveError; use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/document.rs b/packages/rs-drive/src/util/batch/drive_op_batch/document.rs new file mode 100644 index 00000000000..ed95e0c5aaf --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/document.rs @@ -0,0 +1,367 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::drive_op_batch::DriveLowLevelOperationConverter; +use crate::util::object_size_info::DocumentInfo::{DocumentRefAndSerialization, DocumentRefInfo}; +use crate::util::object_size_info::{ + DataContractInfo, DocumentAndContractInfo, DocumentTypeInfo, OwnedDocumentInfo, +}; +use crate::util::storage_flags::StorageFlags; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; +use dpp::document::Document; +use dpp::prelude::Identifier; + +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + +use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use dpp::version::PlatformVersion; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::ContestedDocumentVotePollStoredInfo; +use dpp::ProtocolError; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::borrow::Cow; +use std::collections::HashMap; + +/// A wrapper for a document operation +#[derive(Clone, Debug)] +pub enum DocumentOperation<'a> { + /// An add operation + AddOperation { + /// Document info with maybe the owner id + owned_document_info: OwnedDocumentInfo<'a>, + /// Should we override the document if one already exists? + override_document: bool, + }, + /// An update operation + UpdateOperation(UpdateOperationInfo<'a>), +} + +/// Document and contract info +#[derive(Clone, Debug)] +pub struct DocumentOperationsForContractDocumentType<'a> { + /// Document info + pub operations: Vec>, + ///DataContract + pub contract: &'a DataContract, + /// Document type + pub document_type: DocumentTypeRef<'a>, +} + +/// Operations on Documents +#[derive(Clone, Debug)] +pub enum DocumentOperationType<'a> { + /// Adds a document to a contract matching the desired info. + AddDocument { + /// The document and contract info, also may contain the owner_id + owned_document_info: OwnedDocumentInfo<'a>, + /// Data Contract info to potentially be resolved if needed + contract_info: DataContractInfo<'a>, + /// Document type + document_type_info: DocumentTypeInfo<'a>, + /// Should we override the document if one already exists? + override_document: bool, + }, + /// Adds a contested document to a contract matching the desired info. + /// A contested document is a document that is trying to a acquire a + /// unique index that has a conflict resolution mechanism + AddContestedDocument { + /// The document and contract info, also may contain the owner_id + owned_document_info: OwnedDocumentInfo<'a>, + /// The vote poll in question that will should be created + contested_document_resource_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + /// Data Contract info to potentially be resolved if needed + contract_info: DataContractInfo<'a>, + /// Document type + document_type_info: DocumentTypeInfo<'a>, + /// Should we insert without verifying first that the document doesn't already exist + insert_without_check: bool, + /// Should we also insert the vote poll stored info + also_insert_vote_poll_stored_info: Option, + }, + /// Updates a document and returns the associated fee. + UpdateDocument { + /// The document and contract info, also may contain the owner_id + owned_document_info: OwnedDocumentInfo<'a>, + /// Data Contract info to potentially be resolved if needed + contract_info: DataContractInfo<'a>, + /// Document type + document_type_info: DocumentTypeInfo<'a>, + }, + /// Deletes a document + DeleteDocument { + /// The document id + document_id: Identifier, + /// Data Contract info to potentially be resolved if needed + contract_info: DataContractInfo<'a>, + /// Document type + document_type_info: DocumentTypeInfo<'a>, + }, + /// Convenience method to add a withdrawal document. + AddWithdrawalDocument { + /// The document and contract info, also may contain the owner_id + owned_document_info: OwnedDocumentInfo<'a>, + }, + /// Adds a document to a contract. + MultipleDocumentOperationsForSameContractDocumentType { + /// The document operations + document_operations: DocumentOperationsForContractDocumentType<'a>, + }, +} + +impl DriveLowLevelOperationConverter for DocumentOperationType<'_> { + fn into_low_level_drive_operations( + self, + drive: &Drive, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + DocumentOperationType::AddDocument { + owned_document_info, + contract_info, + document_type_info, + override_document, + } => { + let mut drive_operations: Vec = vec![]; + let contract_resolved_info = contract_info.resolve( + drive, + block_info, + transaction, + &mut drive_operations, + platform_version, + )?; + let contract = contract_resolved_info.as_ref(); + let document_type = document_type_info.resolve(contract)?; + + let document_and_contract_info = DocumentAndContractInfo { + owned_document_info, + contract, + document_type, + }; + let mut operations = drive.add_document_for_contract_operations( + document_and_contract_info, + override_document, + block_info, + &mut None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + drive_operations.append(&mut operations); + Ok(drive_operations) + } + DocumentOperationType::AddContestedDocument { + owned_document_info, + contested_document_resource_vote_poll, + contract_info, + document_type_info, + insert_without_check, + also_insert_vote_poll_stored_info, + } => { + let mut drive_operations: Vec = vec![]; + let contract_resolved_info = contract_info.resolve( + drive, + block_info, + transaction, + &mut drive_operations, + platform_version, + )?; + let contract = contract_resolved_info.as_ref(); + let document_type = document_type_info.resolve(contract)?; + + let document_and_contract_info = DocumentAndContractInfo { + owned_document_info, + contract, + document_type, + }; + let mut operations = drive.add_contested_document_for_contract_operations( + document_and_contract_info, + contested_document_resource_vote_poll, + insert_without_check, + block_info, + also_insert_vote_poll_stored_info, + &mut None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + drive_operations.append(&mut operations); + Ok(drive_operations) + } + DocumentOperationType::AddWithdrawalDocument { + owned_document_info, + } => { + let contract = drive.cache.system_data_contracts.load_withdrawals(); + + let document_type = contract + .document_type_for_name(withdrawal::NAME) + .map_err(ProtocolError::DataContractError)?; + + let document_and_contract_info = DocumentAndContractInfo { + owned_document_info, + contract: &contract, + document_type, + }; + drive.add_document_for_contract_operations( + document_and_contract_info, + false, + block_info, + &mut None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ) + } + DocumentOperationType::UpdateDocument { + owned_document_info, + contract_info, + document_type_info, + } => { + let mut drive_operations = vec![]; + let contract_resolved_info = contract_info.resolve( + drive, + block_info, + transaction, + &mut drive_operations, + platform_version, + )?; + let contract = contract_resolved_info.as_ref(); + let document_type = document_type_info.resolve(contract)?; + + let document_and_contract_info = DocumentAndContractInfo { + owned_document_info, + contract, + document_type, + }; + let mut operations = drive.update_document_for_contract_operations( + document_and_contract_info, + block_info, + &mut None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + drive_operations.append(&mut operations); + Ok(drive_operations) + } + DocumentOperationType::DeleteDocument { + document_id, + contract_info, + document_type_info, + } => { + let mut drive_operations: Vec = vec![]; + let contract_resolved_info = contract_info.resolve( + drive, + block_info, + transaction, + &mut drive_operations, + platform_version, + )?; + let contract = contract_resolved_info.as_ref(); + let document_type = document_type_info.resolve(contract)?; + + drive.delete_document_for_contract_operations( + document_id, + contract, + document_type, + None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ) + } + DocumentOperationType::MultipleDocumentOperationsForSameContractDocumentType { + document_operations, + } => { + let DocumentOperationsForContractDocumentType { + operations, + contract, + document_type, + } = document_operations; + + let mut drive_operations = vec![]; + for document_operation in operations { + match document_operation { + DocumentOperation::AddOperation { + owned_document_info, + override_document, + } => { + let document_and_contract_info = DocumentAndContractInfo { + owned_document_info, + contract, + document_type, + }; + let mut operations = drive.add_document_for_contract_operations( + document_and_contract_info, + override_document, + block_info, + &mut Some(&mut drive_operations), + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + drive_operations.append(&mut operations); + } + DocumentOperation::UpdateOperation(update_operation) => { + let UpdateOperationInfo { + document, + serialized_document, + owner_id, + storage_flags, + } = update_operation; + + let document_info = + if let Some(serialized_document) = serialized_document { + DocumentRefAndSerialization(( + document, + serialized_document, + storage_flags, + )) + } else { + DocumentRefInfo((document, storage_flags)) + }; + let document_and_contract_info = DocumentAndContractInfo { + owned_document_info: OwnedDocumentInfo { + document_info, + owner_id, + }, + contract, + document_type, + }; + let mut operations = drive.update_document_for_contract_operations( + document_and_contract_info, + block_info, + &mut Some(&mut drive_operations), + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + drive_operations.append(&mut operations); + } + } + } + Ok(drive_operations) + } + } + } +} + +/// A wrapper for an update operation +#[derive(Clone, Debug)] +pub struct UpdateOperationInfo<'a> { + /// The document to update + pub document: &'a Document, + /// The document in pre-serialized form + pub serialized_document: Option<&'a [u8]>, + /// The owner id, if none is specified will try to recover from serialized document + pub owner_id: Option<[u8; 32]>, + /// Add storage flags (like epoch, owner id, etc) + pub storage_flags: Option>, +} diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs new file mode 100644 index 00000000000..ad7452524df --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs @@ -0,0 +1,65 @@ +mod v0; + +use crate::util::batch::DriveOperation; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; + +use dpp::block::block_info::BlockInfo; + +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::fee::fee_result::FeeResult; +use grovedb::TransactionArg; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Applies a list of high level DriveOperations to the drive, and calculates the fee for them. + /// + /// This method converts Drive operations to low-level operations, applies them if `apply` is true, + /// and calculates the associated fee. + /// + /// # Arguments + /// + /// * `operations` - A vector of `DriveOperation`s to apply to the drive. + /// * `apply` - A boolean flag indicating whether to apply the changes or only estimate costs. + /// * `block_info` - A reference to information about the current block. + /// * `transaction` - Transaction arguments. + /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. + /// + /// # Returns + /// + /// Returns a `Result` containing the `FeeResult` if the operations are successfully applied, + /// otherwise an `Error`. + /// + pub fn apply_drive_operations( + &self, + operations: Vec, + apply: bool, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, + ) -> Result { + match platform_version + .drive + .methods + .batch_operations + .apply_drive_operations + { + 0 => self.apply_drive_operations_v0( + operations, + apply, + block_info, + transaction, + platform_version, + previous_fee_versions, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "apply_drive_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs new file mode 100644 index 00000000000..0f707af00b8 --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs @@ -0,0 +1,99 @@ +use crate::util::batch::DriveOperation; + +use crate::drive::Drive; +use crate::error::Error; + +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; + +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +use crate::util::batch::drive_op_batch::DriveLowLevelOperationConverter; + +use dpp::version::PlatformVersion; +use grovedb::batch::KeyInfoPath; + +use crate::util::batch::drive_op_batch::finalize_task::{ + DriveOperationFinalizationTasks, DriveOperationFinalizeTask, +}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use std::collections::HashMap; + +impl Drive { + /// Applies a list of high level DriveOperations to the drive, and calculates the fee for them. + /// + /// # Arguments + /// + /// * `operations` - A vector of `DriveOperation`s to apply to the drive. + /// * `apply` - A boolean flag indicating whether to apply the changes or only estimate costs. + /// * `block_info` - A reference to information about the current block. + /// * `transaction` - Transaction arguments. + /// + /// # Returns + /// + /// Returns a `Result` containing the `FeeResult` if the operations are successfully applied, + /// otherwise an `Error`. + /// + /// If `apply` is set to true, it applies the low-level drive operations and updates side info accordingly. + /// If not, it only estimates the costs and updates estimated costs with layer info. + #[inline(always)] + pub(crate) fn apply_drive_operations_v0( + &self, + operations: Vec, + apply: bool, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + previous_fee_versions: Option<&CachedEpochIndexFeeVersions>, + ) -> Result { + if operations.is_empty() { + return Ok(FeeResult::default()); + } + let mut low_level_operations = vec![]; + let mut estimated_costs_only_with_layer_info = if apply { + None::> + } else { + Some(HashMap::new()) + }; + + let mut finalize_tasks: Vec = Vec::new(); + + for drive_op in operations { + if let Some(tasks) = drive_op.finalization_tasks(platform_version)? { + finalize_tasks.extend(tasks); + } + + low_level_operations.append(&mut drive_op.into_low_level_drive_operations( + self, + &mut estimated_costs_only_with_layer_info, + block_info, + transaction, + platform_version, + )?); + } + + let mut cost_operations = vec![]; + + self.apply_batch_low_level_drive_operations( + estimated_costs_only_with_layer_info, + transaction, + low_level_operations, + &mut cost_operations, + &platform_version.drive, + )?; + + // Execute drive operation callbacks after updating state + for task in finalize_tasks { + task.execute(self, platform_version); + } + + Drive::calculate_fee( + None, + Some(cost_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + previous_fee_versions, + ) + } +} diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/mod.rs b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/mod.rs new file mode 100644 index 00000000000..40f84db04b4 --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/mod.rs @@ -0,0 +1,58 @@ +mod v0; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::batch::{DriveOperation, GroveDbOpBatch}; + +use dpp::block::block_info::BlockInfo; + +use dpp::version::PlatformVersion; + +use grovedb::TransactionArg; + +impl Drive { + /// Convert a batch of drive operations to a batch of grove database operations. + /// + /// This function takes drive operations and converts them into grove database operations by + /// processing each operation in the `drive_batch_operations` vector, transforming them to low-level + /// drive operations and finally, into grove database operations. The resulting operations are + /// returned as a `GroveDbOpBatch`. + /// + /// # Arguments + /// + /// * `drive_batch_operations` - A vector of high-level drive operations to be converted. + /// * `block_info` - A reference to the block information associated with these operations. + /// * `transaction` - A transaction argument to be used during processing. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of the method to call. + /// + /// # Returns + /// + /// Returns a `Result` containing a `GroveDbOpBatch` with transformed grove database operations, + /// or an error if any step in the conversion process fails. + pub fn convert_drive_operations_to_grove_operations( + &self, + drive_batch_operations: Vec, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .batch_operations + .convert_drive_operations_to_grove_operations + { + 0 => self.convert_drive_operations_to_grove_operations_v0( + drive_batch_operations, + block_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "convert_drive_operations_to_grove_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/v0/mod.rs b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/v0/mod.rs new file mode 100644 index 00000000000..de4fecc4c41 --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/v0/mod.rs @@ -0,0 +1,58 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::drive_op_batch::DriveLowLevelOperationConverter; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::{DriveOperation, GroveDbOpBatch}; +use dpp::block::block_info::BlockInfo; + +use dpp::version::PlatformVersion; +use grovedb::batch::QualifiedGroveDbOp; +use grovedb::TransactionArg; +use itertools::Itertools; + +impl Drive { + /// Convert a batch of drive operations to a batch of grove database operations. + /// + /// This function takes drive operations and converts them into grove database operations by + /// processing each operation in the `drive_batch_operations` vector, transforming them to low-level + /// drive operations and finally, into grove database operations. The resulting operations are + /// returned as a `GroveDbOpBatch`. + /// + /// # Arguments + /// + /// * `drive_batch_operations` - A vector of high-level drive operations to be converted. + /// * `block_info` - A reference to the block information associated with these operations. + /// * `transaction` - A transaction argument to be used during processing. + /// + /// # Returns + /// + /// Returns a `Result` containing a `GroveDbOpBatch` with transformed grove database operations, + /// or an error if any step in the conversion process fails. + #[inline(always)] + pub(crate) fn convert_drive_operations_to_grove_operations_v0( + &self, + drive_batch_operations: Vec, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let ops = drive_batch_operations + .into_iter() + .map(|drive_op| { + let inner_drive_operations = drive_op.into_low_level_drive_operations( + self, + &mut None, + block_info, + transaction, + platform_version, + )?; + Ok(LowLevelDriveOperation::grovedb_operations_consume( + inner_drive_operations, + )) + }) + .flatten_ok() + .collect::, Error>>()?; + Ok(GroveDbOpBatch::from_operations(ops)) + } +} diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/mod.rs b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/mod.rs new file mode 100644 index 00000000000..b58a435e66e --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/mod.rs @@ -0,0 +1,2 @@ +mod apply_drive_operations; +mod convert_drive_operations_to_grove_operations; diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/finalize_task.rs b/packages/rs-drive/src/util/batch/drive_op_batch/finalize_task.rs similarity index 86% rename from packages/rs-drive/src/drive/batch/drive_op_batch/finalize_task.rs rename to packages/rs-drive/src/util/batch/drive_op_batch/finalize_task.rs index 1264e747b56..b45d7c154d6 100644 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/finalize_task.rs +++ b/packages/rs-drive/src/util/batch/drive_op_batch/finalize_task.rs @@ -20,8 +20,7 @@ impl DriveOperationFinalizeTask { pub fn execute(self, drive: &Drive, _platform_version: &PlatformVersion) { match self { DriveOperationFinalizeTask::RemoveDataContractFromCache { contract_id } => { - let mut drive_cache = drive.cache.write().unwrap(); - drive_cache.cached_contracts.remove(contract_id.to_buffer()); + drive.cache.data_contracts.remove(contract_id.to_buffer()); } } } diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/identity.rs b/packages/rs-drive/src/util/batch/drive_op_batch/identity.rs new file mode 100644 index 00000000000..e3ed135a519 --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/identity.rs @@ -0,0 +1,248 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::drive_op_batch::DriveLowLevelOperationConverter; +use dpp::block::block_info::BlockInfo; +use dpp::identity::{Identity, IdentityPublicKey, KeyID}; +use dpp::prelude::{IdentityNonce, Revision}; + +use crate::drive::identity::update::methods::merge_identity_nonce::MergeIdentityContractNonceResultToResult; +use crate::drive::votes::resolved::votes::ResolvedVote; +use crate::state_transition_action::identity::masternode_vote::v0::PreviousVoteCount; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +/// Operations on Identities +#[derive(Clone, Debug)] +pub enum IdentityOperationType { + /// Inserts a new identity to the `Identities` subtree. + /// A masternode identity is an identity, but can not have unique keys. + /// It also will skip testing for unique keys when adding non unique keys, so no one will + /// take a key, then add it to a masternode + AddNewIdentity { + /// The identity we wish to insert + identity: Identity, + /// Is this identity a masternode identity + /// On Masternode identities we do not add lookup key hashes + is_masternode_identity: bool, + }, + /// Adds balance to an identity + AddToIdentityBalance { + /// The identity id of the identity + identity_id: [u8; 32], + /// The added balance + added_balance: u64, + }, + /// Removes balance from an identity + RemoveFromIdentityBalance { + /// The identity id of the identity + identity_id: [u8; 32], + /// The balance that will be removed from the identity + /// This needs to be verified in advance + balance_to_remove: u64, + }, + /// Adds an array of keys to the identity + AddNewKeysToIdentity { + /// The identity id of the identity + identity_id: [u8; 32], + /// The unique keys to be added + unique_keys_to_add: Vec, + /// The non unique keys to be added + non_unique_keys_to_add: Vec, + }, + /// Disable Identity Keys + DisableIdentityKeys { + /// The identity id of the identity + identity_id: [u8; 32], + /// The keys to be added + keys_ids: Vec, + }, + + /// Re-Enable Identity Keys + /// This should only be used internally in Drive (for masternode identities) + ReEnableIdentityKeys { + /// The identity id of the identity + identity_id: [u8; 32], + /// The keys to be added + keys_ids: Vec, + }, + + /// Updates an identities revision. + UpdateIdentityRevision { + /// The revision id + identity_id: [u8; 32], + /// The revision we are updating to + revision: Revision, + }, + /// Casts a votes as a masternode. + MasternodeCastVote { + /// The pro tx hash of the masternode doing the voting + voter_pro_tx_hash: [u8; 32], + /// The strength of the vote, masternodes have 1, evonodes have 4, + strength: u8, + /// Contested Vote type + vote: ResolvedVote, + /// Remove previous contested resource vote choice + previous_resource_vote_choice_to_remove: Option<(ResourceVoteChoice, PreviousVoteCount)>, + }, + /// Updates an identities nonce for a specific contract. + UpdateIdentityNonce { + /// The revision id + identity_id: [u8; 32], + /// The nonce we are updating to + nonce: IdentityNonce, + }, + + /// Updates an identities nonce for a specific contract. + UpdateIdentityContractNonce { + /// The revision id + identity_id: [u8; 32], + /// The contract id + contract_id: [u8; 32], + /// The nonce we are updating to + nonce: IdentityNonce, + }, +} + +impl DriveLowLevelOperationConverter for IdentityOperationType { + fn into_low_level_drive_operations( + self, + drive: &Drive, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + IdentityOperationType::AddNewIdentity { + identity, + is_masternode_identity, + } => drive.add_new_identity_operations( + identity, + is_masternode_identity, + block_info, + &mut None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + IdentityOperationType::AddToIdentityBalance { + identity_id, + added_balance, + } => drive.add_to_identity_balance_operations( + identity_id, + added_balance, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + IdentityOperationType::RemoveFromIdentityBalance { + identity_id, + balance_to_remove, + } => drive.remove_from_identity_balance_operations( + identity_id, + balance_to_remove, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + IdentityOperationType::AddNewKeysToIdentity { + identity_id, + unique_keys_to_add, + non_unique_keys_to_add, + } => drive.add_new_keys_to_identity_operations( + identity_id, + unique_keys_to_add, + non_unique_keys_to_add, + true, + &block_info.epoch, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + IdentityOperationType::DisableIdentityKeys { + identity_id, + keys_ids, + } => drive.disable_identity_keys_operations( + identity_id, + keys_ids, + block_info.time_ms, + &block_info.epoch, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + IdentityOperationType::ReEnableIdentityKeys { + identity_id, + keys_ids, + } => drive.re_enable_identity_keys_operations( + identity_id, + keys_ids, + &block_info.epoch, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + IdentityOperationType::UpdateIdentityRevision { + identity_id, + revision, + } => Ok(vec![drive.update_identity_revision_operation( + identity_id, + revision, + estimated_costs_only_with_layer_info, + platform_version, + )?]), + IdentityOperationType::MasternodeCastVote { + voter_pro_tx_hash, + strength, + vote, + previous_resource_vote_choice_to_remove, + } => { + // No need to have estimated_costs_only_with_layer_info and block_info here + // This is because voting is a special operation with a fixed cost + drive.register_identity_vote_operations( + voter_pro_tx_hash, + strength, + vote, + previous_resource_vote_choice_to_remove, + transaction, + platform_version, + ) + } + IdentityOperationType::UpdateIdentityContractNonce { + identity_id, + contract_id, + nonce, + } => { + let (result, operations) = drive.merge_identity_contract_nonce_operations( + identity_id, + contract_id, + nonce, + block_info, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + result.to_result()?; + Ok(operations) + } + IdentityOperationType::UpdateIdentityNonce { identity_id, nonce } => { + let (result, operations) = drive.merge_identity_nonce_operations( + identity_id, + nonce, + block_info, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + result.to_result()?; + Ok(operations) + } + } + } +} diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/mod.rs b/packages/rs-drive/src/util/batch/drive_op_batch/mod.rs new file mode 100644 index 00000000000..144bcda787a --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/mod.rs @@ -0,0 +1,1106 @@ +mod contract; +mod document; +mod drive_methods; +mod finalize_task; +mod identity; +mod prefunded_specialized_balance; +mod system; +mod withdrawals; + +use crate::util::batch::GroveDbOpBatch; + +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; + +pub use contract::DataContractOperationType; +pub use document::DocumentOperation; +pub use document::DocumentOperationType; +pub use document::DocumentOperationsForContractDocumentType; +pub use document::UpdateOperationInfo; +pub use identity::IdentityOperationType; +pub use prefunded_specialized_balance::PrefundedSpecializedBalanceOperationType; +pub use system::SystemOperationType; +pub use withdrawals::WithdrawalOperationType; + +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +use crate::fees::op::LowLevelDriveOperation::GroveOperation; + +use dpp::version::PlatformVersion; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; + +use crate::error::drive::DriveError; +use crate::util::batch::drive_op_batch::finalize_task::{ + DriveOperationFinalizationTasks, DriveOperationFinalizeTask, +}; + +use std::collections::{BTreeMap, HashMap}; + +/// A converter that will get Drive Operations from High Level Operations +pub trait DriveLowLevelOperationConverter { + /// This will get a list of atomic drive operations from a high level operations + fn into_low_level_drive_operations( + self, + drive: &Drive, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +/// The drive operation context keeps track of changes that might affect other operations +/// Notably Identity balance changes are kept track of +pub struct DriveOperationContext { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + identity_balance_changes: BTreeMap<[u8; 32], i64>, +} + +/// All types of Drive Operations +#[derive(Clone, Debug)] +pub enum DriveOperation<'a> { + /// A contract operation + DataContractOperation(DataContractOperationType<'a>), + /// A document operation + DocumentOperation(DocumentOperationType<'a>), + /// Withdrawal operation + WithdrawalOperation(WithdrawalOperationType), + /// An identity operation + IdentityOperation(IdentityOperationType), + /// An operation on prefunded balances + PrefundedSpecializedBalanceOperation(PrefundedSpecializedBalanceOperationType), + /// A system operation + SystemOperation(SystemOperationType), + /// A single low level groveDB operation + GroveDBOperation(QualifiedGroveDbOp), + /// Multiple low level groveDB operations + GroveDBOpBatch(GroveDbOpBatch), +} + +impl DriveLowLevelOperationConverter for DriveOperation<'_> { + fn into_low_level_drive_operations( + self, + drive: &Drive, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + DriveOperation::DataContractOperation(contract_operation_type) => { + contract_operation_type.into_low_level_drive_operations( + drive, + estimated_costs_only_with_layer_info, + block_info, + transaction, + platform_version, + ) + } + DriveOperation::DocumentOperation(document_operation_type) => document_operation_type + .into_low_level_drive_operations( + drive, + estimated_costs_only_with_layer_info, + block_info, + transaction, + platform_version, + ), + DriveOperation::WithdrawalOperation(withdrawal_operation_type) => { + withdrawal_operation_type.into_low_level_drive_operations( + drive, + estimated_costs_only_with_layer_info, + block_info, + transaction, + platform_version, + ) + } + DriveOperation::IdentityOperation(identity_operation_type) => identity_operation_type + .into_low_level_drive_operations( + drive, + estimated_costs_only_with_layer_info, + block_info, + transaction, + platform_version, + ), + DriveOperation::PrefundedSpecializedBalanceOperation( + prefunded_balance_operation_type, + ) => prefunded_balance_operation_type.into_low_level_drive_operations( + drive, + estimated_costs_only_with_layer_info, + block_info, + transaction, + platform_version, + ), + DriveOperation::SystemOperation(system_operation_type) => system_operation_type + .into_low_level_drive_operations( + drive, + estimated_costs_only_with_layer_info, + block_info, + transaction, + platform_version, + ), + DriveOperation::GroveDBOperation(op) => Ok(vec![GroveOperation(op)]), + DriveOperation::GroveDBOpBatch(operations) => Ok(operations + .operations + .into_iter() + .map(GroveOperation) + .collect()), + } + } +} + +impl DriveOperationFinalizationTasks for DriveOperation<'_> { + fn finalization_tasks( + &self, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match platform_version + .drive + .methods + .state_transitions + .operations + .finalization_tasks + { + 0 => self.finalization_tasks_v0(platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "DriveOperation.finalization_tasks".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +impl DriveOperation<'_> { + fn finalization_tasks_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result>, Error> { + match self { + DriveOperation::DataContractOperation(o) => o.finalization_tasks(platform_version), + _ => Ok(None), + } + } +} + +#[cfg(feature = "server")] +#[cfg(test)] +mod tests { + use grovedb::Element; + use std::borrow::Cow; + use std::option::Option::None; + + use super::*; + + use dpp::block::block_info::BlockInfo; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::serialization::PlatformSerializableWithPlatformVersion; + use dpp::tests::json_document::{json_document_to_contract, json_document_to_document}; + use dpp::util::cbor_serializer; + use rand::Rng; + use serde_json::json; + + use crate::util::test_helpers::setup_contract; + + use crate::util::batch::drive_op_batch::document::DocumentOperation::{ + AddOperation, UpdateOperation, + }; + use crate::util::batch::drive_op_batch::document::DocumentOperationType::MultipleDocumentOperationsForSameContractDocumentType; + use crate::util::batch::drive_op_batch::document::{ + DocumentOperationsForContractDocumentType, UpdateOperationInfo, + }; + use crate::util::batch::DataContractOperationType::ApplyContract; + use crate::util::batch::DocumentOperationType::AddDocument; + use crate::util::batch::DriveOperation::{DataContractOperation, DocumentOperation}; + + use crate::drive::contract::paths::contract_root_path; + use crate::drive::Drive; + use crate::util::object_size_info::DocumentInfo::DocumentRefInfo; + use crate::util::object_size_info::{DataContractInfo, DocumentTypeInfo, OwnedDocumentInfo}; + use crate::util::storage_flags::StorageFlags; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + + #[test] + fn test_add_dashpay_documents() { + let drive: Drive = setup_drive_with_initial_state_structure(); + let platform_version = PlatformVersion::latest(); + + let mut drive_operations = vec![]; + let db_transaction = drive.grove.start_transaction(); + + let contract = json_document_to_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + false, + platform_version, + ) + .expect("expected to get contract"); + + let _document_type = contract + .document_type_for_name("contactRequest") + .expect("expected to get document type"); + + drive_operations.push(DataContractOperation(ApplyContract { + contract: Cow::Borrowed(&contract), + storage_flags: None, + })); + + let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + + let document_type = contract + .document_type_for_name("contactRequest") + .expect("expected to get document type"); + + let dashpay_cr_document = json_document_to_document( + "tests/supporting_files/contract/dashpay/contact-request0.json", + Some(random_owner_id.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + drive_operations.push(DocumentOperation(AddDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &dashpay_cr_document, + StorageFlags::optional_default_as_cow(), + )), + owner_id: None, + }, + contract_info: DataContractInfo::BorrowedDataContract(&contract), + document_type_info: DocumentTypeInfo::DocumentTypeRef(document_type), + override_document: false, + })); + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to insert contract and document"); + + let element = drive + .grove + .get( + &contract_root_path(&contract.id().to_buffer()), + &[0], + Some(&db_transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("expected to get contract back"); + + assert_eq!( + element, + Element::Item( + contract + .serialize_to_bytes_with_platform_version(platform_version) + .expect("expected to serialize contract"), + None + ) + ); + + let query_value = json!({ + "where": [ + ], + "limit": 100, + "orderBy": [ + ["$ownerId", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 1); + } + + #[test] + fn test_add_multiple_dashpay_documents_individually_should_succeed() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let mut drive_operations = vec![]; + let db_transaction = drive.grove.start_transaction(); + + let contract = json_document_to_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + false, + platform_version, + ) + .expect("expected to get contract"); + + let document_type = contract + .document_type_for_name("contactRequest") + .expect("expected to get document type"); + + drive_operations.push(DataContractOperation(ApplyContract { + contract: Cow::Borrowed(&contract), + storage_flags: None, + })); + let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + + let dashpay_cr_document = json_document_to_document( + "tests/supporting_files/contract/dashpay/contact-request0.json", + Some(random_owner_id.into()), + document_type, + platform_version, + ) + .expect("expected to get contract"); + + drive_operations.push(DocumentOperation(AddDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo((&dashpay_cr_document, None)), + owner_id: None, + }, + contract_info: DataContractInfo::BorrowedDataContract(&contract), + document_type_info: DocumentTypeInfo::DocumentTypeNameAsStr("contactRequest"), + override_document: false, + })); + + let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + + let dashpay_cr_1_document = json_document_to_document( + "tests/supporting_files/contract/dashpay/contact-request1.json", + Some(random_owner_id.into()), + document_type, + platform_version, + ) + .expect("expected to get contract"); + + drive_operations.push(DocumentOperation(AddDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo((&dashpay_cr_1_document, None)), + owner_id: None, + }, + contract_info: DataContractInfo::BorrowedDataContract(&contract), + document_type_info: DocumentTypeInfo::DocumentTypeNameAsStr("contactRequest"), + override_document: false, + })); + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to be able to insert documents"); + + let query_value = json!({ + "where": [ + ], + "limit": 100, + "orderBy": [ + ["$ownerId", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 2); + } + + #[test] + fn test_add_multiple_dashpay_documents() { + let drive: Drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let mut drive_operations = vec![]; + let db_transaction = drive.grove.start_transaction(); + + let contract = json_document_to_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + false, + platform_version, + ) + .expect("expected to get contract"); + + let document_type = contract + .document_type_for_name("contactRequest") + .expect("expected to get document type"); + + drive_operations.push(DataContractOperation(ApplyContract { + contract: Cow::Borrowed(&contract), + storage_flags: None, + })); + + let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); + + let document0 = json_document_to_document( + "tests/supporting_files/contract/dashpay/contact-request0.json", + Some(random_owner_id.into()), + document_type, + platform_version, + ) + .expect("expected to get document 0"); + + let document1 = json_document_to_document( + "tests/supporting_files/contract/dashpay/contact-request1.json", + Some(random_owner_id.into()), + document_type, + platform_version, + ) + .expect("expected to get document 1"); + + let mut operations = vec![]; + + operations.push(AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &document0, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id), + }, + override_document: false, + }); + + operations.push(AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &document1, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id), + }, + override_document: false, + }); + + drive_operations.push(DocumentOperation( + MultipleDocumentOperationsForSameContractDocumentType { + document_operations: DocumentOperationsForContractDocumentType { + operations, + contract: &contract, + document_type, + }, + }, + )); + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to be able to insert documents"); + + let element = drive + .grove + .get( + &contract_root_path(&contract.id().to_buffer()), + &[0], + Some(&db_transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("expected to get contract back"); + + assert_eq!( + element, + Element::Item( + contract + .serialize_to_bytes_with_platform_version(platform_version) + .expect("expected to serialize contract"), + None + ) + ); + + let query_value = json!({ + "where": [ + ], + "limit": 100, + "orderBy": [ + ["$ownerId", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 2); + } + + #[test] + fn test_add_multiple_family_documents() { + let drive: Drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let mut drive_operations = vec![]; + let db_transaction = drive.grove.start_transaction(); + + let contract = setup_contract( + &drive, + "tests/supporting_files/contract/family/family-contract.json", + None, + Some(&db_transaction), + ); + + let document_type = contract + .document_type_for_name("person") + .expect("expected to get document type"); + + let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document0 = json_document_to_document( + "tests/supporting_files/contract/family/person0.json", + Some(random_owner_id0.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document1 = json_document_to_document( + "tests/supporting_files/contract/family/person3.json", + Some(random_owner_id1.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let mut operations = vec![]; + + operations.push(AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &person_document0, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id0), + }, + override_document: false, + }); + + let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); + + operations.push(AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &person_document1, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id1), + }, + override_document: false, + }); + + drive_operations.push(DocumentOperation( + MultipleDocumentOperationsForSameContractDocumentType { + document_operations: DocumentOperationsForContractDocumentType { + operations, + contract: &contract, + document_type, + }, + }, + )); + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to be able to insert documents"); + + let query_value = json!({ + "where": [ + ], + "limit": 100, + "orderBy": [ + ["$ownerId", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 2); + } + + #[test] + fn test_update_multiple_family_documents() { + let drive: Drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let mut drive_operations = vec![]; + let db_transaction = drive.grove.start_transaction(); + + let contract = setup_contract( + &drive, + "tests/supporting_files/contract/family/family-contract-only-age-index.json", + None, + Some(&db_transaction), + ); + + let document_type = contract + .document_type_for_name("person") + .expect("expected to get document type"); + + let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document0 = json_document_to_document( + "tests/supporting_files/contract/family/person0.json", + Some(random_owner_id0.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document1 = json_document_to_document( + "tests/supporting_files/contract/family/person3.json", + Some(random_owner_id1.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let mut operations = vec![]; + + operations.push(AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &person_document0, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id0), + }, + override_document: false, + }); + + operations.push(AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &person_document1, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id1), + }, + override_document: false, + }); + + drive_operations.push(DocumentOperation( + MultipleDocumentOperationsForSameContractDocumentType { + document_operations: DocumentOperationsForContractDocumentType { + operations, + contract: &contract, + document_type, + }, + }, + )); + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to be able to insert documents"); + + // This was the setup now let's do the update + + drive_operations = vec![]; + + let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document0 = json_document_to_document( + "tests/supporting_files/contract/family/person0-older.json", + Some(random_owner_id0.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document1 = json_document_to_document( + "tests/supporting_files/contract/family/person3-older.json", + Some(random_owner_id1.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let mut operations = vec![]; + + operations.push(UpdateOperation(UpdateOperationInfo { + document: &person_document0, + serialized_document: None, + owner_id: Some(random_owner_id0), + storage_flags: None, + })); + + operations.push(UpdateOperation(UpdateOperationInfo { + document: &person_document1, + serialized_document: None, + owner_id: Some(random_owner_id1), + storage_flags: None, + })); + + drive_operations.push(DocumentOperation( + MultipleDocumentOperationsForSameContractDocumentType { + document_operations: DocumentOperationsForContractDocumentType { + operations, + contract: &contract, + document_type, + }, + }, + )); + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to be able to update documents"); + + let query_value = json!({ + "where": [ + ], + "limit": 100, + "orderBy": [ + ["age", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 2); + + let query_value = json!({ + "where": [ + ["age", "==", 35] + ], + "limit": 100, + "orderBy": [ + ["age", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 0); + + let query_value = json!({ + "where": [ + ["age", "==", 36] + ], + "limit": 100, + "orderBy": [ + ["age", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 2); + } + + #[test] + fn test_update_multiple_family_documents_with_index_being_removed_and_added() { + let drive: Drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let db_transaction = drive.grove.start_transaction(); + + let contract = setup_contract( + &drive, + "tests/supporting_files/contract/family/family-contract-only-age-index.json", + None, + Some(&db_transaction), + ); + + let document_type = contract + .document_type_for_name("person") + .expect("expected to get document type"); + + let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document0 = json_document_to_document( + "tests/supporting_files/contract/family/person0.json", + Some(random_owner_id0.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); + + let person_document1 = json_document_to_document( + "tests/supporting_files/contract/family/person3-older.json", + Some(random_owner_id1.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let operations = vec![ + AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &person_document0, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id0), + }, + override_document: false, + }, + AddOperation { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo(( + &person_document1, + StorageFlags::optional_default_as_cow(), + )), + owner_id: Some(random_owner_id1), + }, + override_document: false, + }, + ]; + let drive_operations = vec![DocumentOperation( + MultipleDocumentOperationsForSameContractDocumentType { + document_operations: DocumentOperationsForContractDocumentType { + operations, + contract: &contract, + document_type, + }, + }, + )]; + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to be able to insert documents"); + + // This was the setup now let's do the update + + let person_document0 = json_document_to_document( + "tests/supporting_files/contract/family/person0-older.json", + Some(random_owner_id0.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let person_document1 = json_document_to_document( + "tests/supporting_files/contract/family/person3.json", + Some(random_owner_id1.into()), + document_type, + platform_version, + ) + .expect("expected to get document"); + + let operations = vec![ + UpdateOperation(UpdateOperationInfo { + document: &person_document0, + serialized_document: None, + owner_id: Some(random_owner_id0), + storage_flags: None, + }), + UpdateOperation(UpdateOperationInfo { + document: &person_document1, + serialized_document: None, + owner_id: Some(random_owner_id1), + storage_flags: None, + }), + ]; + + let drive_operations = vec![DocumentOperation( + MultipleDocumentOperationsForSameContractDocumentType { + document_operations: DocumentOperationsForContractDocumentType { + operations, + contract: &contract, + document_type, + }, + }, + )]; + + drive + .apply_drive_operations( + drive_operations, + true, + &BlockInfo::default(), + Some(&db_transaction), + platform_version, + None, + ) + .expect("expected to be able to update documents"); + + let query_value = json!({ + "where": [ + ["age", ">=", 5] + ], + "limit": 100, + "orderBy": [ + ["age", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 2); + + let query_value = json!({ + "where": [ + ["age", "==", 35] + ], + "limit": 100, + "orderBy": [ + ["age", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 1); + + let query_value = json!({ + "where": [ + ["age", "==", 36] + ], + "limit": 100, + "orderBy": [ + ["age", "asc"], + ] + }); + let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + + let (docs, _, _) = drive + .query_documents_cbor_from_contract( + &contract, + document_type, + where_cbor.as_slice(), + None, + Some(&db_transaction), + Some(platform_version.protocol_version), + ) + .expect("expected to query"); + assert_eq!(docs.len(), 1); + } +} diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/prefunded_specialized_balance.rs b/packages/rs-drive/src/util/batch/drive_op_batch/prefunded_specialized_balance.rs new file mode 100644 index 00000000000..35562585e7c --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/prefunded_specialized_balance.rs @@ -0,0 +1,65 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::drive_op_batch::DriveLowLevelOperationConverter; +use dpp::block::block_info::BlockInfo; +use dpp::identifier::Identifier; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::HashMap; + +/// Operations on Prefunded balances +#[derive(Clone, Debug)] +pub enum PrefundedSpecializedBalanceOperationType { + /// Creates a new prefunded balance + CreateNewPrefundedBalance { + /// The id of the prefunded balance + prefunded_specialized_balance_id: Identifier, + /// The added balance + add_balance: u64, + }, + /// Deducts from a prefunded balance + DeductFromPrefundedBalance { + /// The identity id of the identity + prefunded_specialized_balance_id: Identifier, + /// The removed balance + remove_balance: u64, + }, +} + +impl DriveLowLevelOperationConverter for PrefundedSpecializedBalanceOperationType { + fn into_low_level_drive_operations( + self, + drive: &Drive, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + _block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + PrefundedSpecializedBalanceOperationType::CreateNewPrefundedBalance { + prefunded_specialized_balance_id: specialized_balance_id, + add_balance: added_balance, + } => drive.add_prefunded_specialized_balance_operations( + specialized_balance_id, + added_balance, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + PrefundedSpecializedBalanceOperationType::DeductFromPrefundedBalance { + prefunded_specialized_balance_id: specialized_balance_id, + remove_balance: removed_balance, + } => drive.deduct_from_prefunded_specialized_balance_operations( + specialized_balance_id, + removed_balance, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + } + } +} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/system.rs b/packages/rs-drive/src/util/batch/drive_op_batch/system.rs similarity index 82% rename from packages/rs-drive/src/drive/batch/drive_op_batch/system.rs rename to packages/rs-drive/src/util/batch/drive_op_batch/system.rs index c38e36ca065..7a6afbedacf 100644 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/system.rs +++ b/packages/rs-drive/src/util/batch/drive_op_batch/system.rs @@ -1,11 +1,13 @@ -use crate::drive::batch::drive_op_batch::DriveLowLevelOperationConverter; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::drive_op_batch::DriveLowLevelOperationConverter; use dpp::block::block_info::BlockInfo; use dpp::fee::Credits; use dpp::platform_value::Bytes36; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; + use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; @@ -24,10 +26,13 @@ pub enum SystemOperationType { /// The amount of credits we are seeking to remove amount: Credits, }, - /// Adding a used asset lock + /// Adding a used asset lock, if it is only partially used the asset_lock_value + /// will have a non 0 remaining_credit_value AddUsedAssetLock { /// The asset lock outpoint that should be added asset_lock_outpoint: Bytes36, + /// The asset lock value, both initial and remaining + asset_lock_value: AssetLockValue, }, } @@ -59,8 +64,10 @@ impl DriveLowLevelOperationConverter for SystemOperationType { ), SystemOperationType::AddUsedAssetLock { asset_lock_outpoint, + asset_lock_value, } => drive.add_asset_lock_outpoint_operations( &asset_lock_outpoint, + asset_lock_value, estimated_costs_only_with_layer_info, platform_version, ), diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs b/packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs new file mode 100644 index 00000000000..972f6be00e8 --- /dev/null +++ b/packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs @@ -0,0 +1,112 @@ +use std::collections::HashMap; + +use crate::drive::identity::withdrawals::paths::{ + get_withdrawal_root_path_vec, get_withdrawal_transactions_queue_path, + get_withdrawal_transactions_queue_path_vec, WITHDRAWAL_TRANSACTIONS_NEXT_INDEX_KEY, +}; +use crate::drive::identity::withdrawals::{ + WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes, +}; +use crate::util::grove_operations::BatchDeleteApplyType; +use crate::util::object_size_info::PathKeyElementInfo; +use crate::{drive::Drive, error::Error, fees::op::LowLevelDriveOperation}; +use dpp::block::block_info::BlockInfo; + +use dpp::version::PlatformVersion; +use grovedb::Element; +use grovedb::{batch::KeyInfoPath, EstimatedLayerInformation, TransactionArg}; + +use super::DriveLowLevelOperationConverter; + +/// Operations for Withdrawals +#[derive(Clone, Debug)] +pub enum WithdrawalOperationType { + /// Update index counter + UpdateIndexCounter { + /// index counter value + index: WithdrawalTransactionIndex, + }, + /// Insert Core Transaction into queue + InsertTransactions { + /// transaction id bytes + withdrawal_transactions: Vec, + }, + /// Delete withdrawal + DeleteWithdrawalTransaction { + /// withdrawal transaction tuple with id and bytes + index: WithdrawalTransactionIndex, + }, +} + +impl DriveLowLevelOperationConverter for WithdrawalOperationType { + fn into_low_level_drive_operations( + self, + drive: &Drive, + _estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + _block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + WithdrawalOperationType::UpdateIndexCounter { index } => { + let mut drive_operations = vec![]; + + let path = get_withdrawal_root_path_vec(); + + drive.batch_insert( + PathKeyElementInfo::PathKeyRefElement::<'_, 1>(( + path, + &WITHDRAWAL_TRANSACTIONS_NEXT_INDEX_KEY, + Element::Item(index.to_be_bytes().to_vec(), None), + )), + &mut drive_operations, + &platform_version.drive, + )?; + + Ok(drive_operations) + } + WithdrawalOperationType::InsertTransactions { + withdrawal_transactions, + } => { + let mut drive_operations = vec![]; + + let path = get_withdrawal_transactions_queue_path_vec(); + + for (index, bytes) in withdrawal_transactions { + drive.batch_insert( + PathKeyElementInfo::PathKeyElement::<'_, 1>(( + path.clone(), + index.to_be_bytes().to_vec(), + Element::Item(bytes, None), + )), + &mut drive_operations, + &platform_version.drive, + )?; + } + + Ok(drive_operations) + } + WithdrawalOperationType::DeleteWithdrawalTransaction { index } => { + let mut drive_operations = vec![]; + + let path = get_withdrawal_transactions_queue_path(); + + drive.batch_delete( + (&path).into(), + &index.to_be_bytes(), + // we know that we are not deleting a subtree + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum: Some((false, false)), + }, + transaction, + &mut drive_operations, + &platform_version.drive, + )?; + + Ok(drive_operations) + } + } + } +} diff --git a/packages/rs-drive/src/util/batch/grovedb_op_batch/mod.rs b/packages/rs-drive/src/util/batch/grovedb_op_batch/mod.rs new file mode 100644 index 00000000000..67d5f8908ea --- /dev/null +++ b/packages/rs-drive/src/util/batch/grovedb_op_batch/mod.rs @@ -0,0 +1,641 @@ +//! GroveDB Operations Batch. +//! +//! This module defines the GroveDbOpBatch struct and implements its functions. +//! + +use crate::drive::credit_pools::epochs; +use crate::drive::identity::IdentityRootStructure; +use crate::drive::{credit_pools, RootTree}; +use crate::util::storage_flags::StorageFlags; +use dpp::block::epoch::Epoch; +use dpp::identity::{Purpose, SecurityLevel}; +use dpp::prelude::Identifier; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::{GroveDbOpConsistencyResults, GroveOp, KeyInfoPath, QualifiedGroveDbOp}; +use grovedb::operations::proof::util::hex_to_ascii; +use grovedb::Element; +use std::borrow::Cow; +use std::fmt; + +/// A batch of GroveDB operations as a vector. +// TODO move to GroveDB +#[derive(Debug, Default, Clone)] +pub struct GroveDbOpBatch { + /// Operations + pub(crate) operations: Vec, +} + +#[derive(Debug, PartialEq, Eq, Copy, Clone)] +enum KnownPath { + Root, //Level 0 + DataContractAndDocumentsRoot, //Level 1 + DataContractStorage, //Level 2 + DocumentsRoot, //Level 2 + IdentitiesRoot, //Level 1 + IdentityTreeRevisionRoot, //Level 2 + IdentityTreeNonceRoot, //Level 2 + IdentityTreeKeysRoot, //Level 2 + IdentityTreeKeyReferencesRoot, //Level 2 + IdentityTreeKeyReferencesInPurpose(Purpose), //Level 3 + IdentityTreeKeyReferencesInSecurityLevel(Purpose, SecurityLevel), //Level 4 + IdentityTreeNegativeCreditRoot, //Level 2 + IdentityContractInfoRoot, //Level 2 + UniquePublicKeyHashesToIdentitiesRoot, //Level 1 + NonUniquePublicKeyKeyHashesToIdentitiesRoot, //Level 1 + PoolsRoot, //Level 1 + PoolsInsideEpoch(Epoch), //Level 2 + PreFundedSpecializedBalancesRoot, //Level 1 + SpentAssetLockTransactionsRoot, //Level 1 + MiscRoot, //Level 1 + WithdrawalTransactionsRoot, //Level 1 + BalancesRoot, //Level 1 + TokenBalancesRoot, //Level 1 + VersionsRoot, //Level 1 + VotesRoot, //Level 1 +} + +impl From for KnownPath { + fn from(value: RootTree) -> Self { + match value { + RootTree::DataContractDocuments => KnownPath::DataContractAndDocumentsRoot, + RootTree::Identities => KnownPath::IdentitiesRoot, + RootTree::UniquePublicKeyHashesToIdentities => { + KnownPath::UniquePublicKeyHashesToIdentitiesRoot + } + RootTree::NonUniquePublicKeyKeyHashesToIdentities => { + KnownPath::NonUniquePublicKeyKeyHashesToIdentitiesRoot + } + RootTree::Pools => KnownPath::PoolsRoot, + RootTree::PreFundedSpecializedBalances => KnownPath::PreFundedSpecializedBalancesRoot, + RootTree::SpentAssetLockTransactions => KnownPath::SpentAssetLockTransactionsRoot, + RootTree::Misc => KnownPath::MiscRoot, + RootTree::WithdrawalTransactions => KnownPath::WithdrawalTransactionsRoot, + RootTree::Balances => KnownPath::BalancesRoot, + RootTree::TokenBalances => KnownPath::TokenBalancesRoot, + RootTree::Versions => KnownPath::VersionsRoot, + RootTree::Votes => KnownPath::VotesRoot, + } + } +} + +impl From for KnownPath { + fn from(value: IdentityRootStructure) -> Self { + match value { + IdentityRootStructure::IdentityTreeRevision => KnownPath::IdentityTreeRevisionRoot, + IdentityRootStructure::IdentityTreeNonce => KnownPath::IdentityTreeNonceRoot, + IdentityRootStructure::IdentityTreeKeys => KnownPath::IdentityTreeKeysRoot, + IdentityRootStructure::IdentityTreeKeyReferences => { + KnownPath::IdentityTreeKeyReferencesRoot + } + IdentityRootStructure::IdentityTreeNegativeCredit => { + KnownPath::IdentityTreeNegativeCreditRoot + } + IdentityRootStructure::IdentityContractInfo => KnownPath::IdentityContractInfoRoot, + } + } +} + +fn readable_key_info(known_path: KnownPath, key_info: &KeyInfo) -> (String, Option) { + match key_info { + KeyInfo::KnownKey(key) => { + match known_path { + KnownPath::Root => { + if let Ok(root_tree) = RootTree::try_from(key[0]) { + ( + format!("{}({})", root_tree.to_string(), key[0]), + Some(root_tree.into()), + ) + } else { + (hex_to_ascii(key), None) + } + } + KnownPath::BalancesRoot | KnownPath::IdentitiesRoot if key.len() == 32 => ( + format!( + "IdentityId(bs58::{})", + Identifier::from_vec(key.clone()).unwrap() + ), + None, + ), + KnownPath::DataContractAndDocumentsRoot if key.len() == 32 => ( + format!( + "ContractId(bs58::{})", + Identifier::from_vec(key.clone()).unwrap() + ), + None, + ), + KnownPath::DataContractAndDocumentsRoot if key.len() == 1 => match key[0] { + 0 => ( + "DataContractStorage(0)".to_string(), + Some(KnownPath::DataContractStorage), + ), + 1 => ( + "DataContractDocuments(1)".to_string(), + Some(KnownPath::DocumentsRoot), + ), + _ => (hex_to_ascii(key), None), + }, + KnownPath::IdentitiesRoot if key.len() == 1 => { + if let Ok(root_tree) = IdentityRootStructure::try_from(key[0]) { + ( + format!("{}({})", root_tree.to_string(), key[0]), + Some(root_tree.into()), + ) + } else { + (hex_to_ascii(key), None) + } + } + KnownPath::IdentityTreeKeyReferencesRoot if key.len() == 1 => { + if let Ok(purpose) = Purpose::try_from(key[0]) { + ( + format!("Purpose::{}({})", purpose, key[0]), + Some(KnownPath::IdentityTreeKeyReferencesInPurpose(purpose)), + ) + } else { + (hex_to_ascii(key), None) + } + } + KnownPath::IdentityTreeKeyReferencesInPurpose(purpose) if key.len() == 1 => { + if let Ok(security_level) = SecurityLevel::try_from(key[0]) { + ( + format!("SecurityLevel::{}({})", security_level, key[0]), + Some(KnownPath::IdentityTreeKeyReferencesInSecurityLevel( + purpose, + security_level, + )), + ) + } else { + (hex_to_ascii(key), None) + } + } + + KnownPath::PoolsRoot if key.len() == 1 => match key[0] { + epochs::epochs_root_tree_key_constants::KEY_STORAGE_FEE_POOL_U8 => { + ("StorageFeePool(ascii:'s')".to_string(), None) + } + epochs::epochs_root_tree_key_constants::KEY_UNPAID_EPOCH_INDEX_U8 => { + ("UnpaidEpochIndex(ascii:'u')".to_string(), None) + } + epochs::epochs_root_tree_key_constants::KEY_PENDING_EPOCH_REFUNDS_U8 => { + ("PendingEpochRefunds(ascii:'p')".to_string(), None) + } + _ => (hex_to_ascii(key), None), + }, + KnownPath::PoolsRoot if key.len() == 2 => { + // this is an epoch + if let Ok(epoch) = Epoch::try_from(key) { + ( + format!("Epoch::{}({})", epoch.index, hex::encode(key)), + Some(KnownPath::PoolsInsideEpoch(epoch)), + ) + } else { + (hex_to_ascii(key), None) + } + } + KnownPath::PoolsInsideEpoch(_) if key.len() == 1 => { + // this is an epoch + match key[0] { + credit_pools::epochs::epoch_key_constants::KEY_POOL_PROCESSING_FEES_U8 => { + ("PoolProcessingFees(ascii:'p')".to_string(), None) + } + credit_pools::epochs::epoch_key_constants::KEY_POOL_STORAGE_FEES_U8 => { + ("PoolStorageFees(ascii:'s')".to_string(), None) + } + credit_pools::epochs::epoch_key_constants::KEY_START_TIME_U8 => { + ("StartTime(ascii:'t')".to_string(), None) + } + credit_pools::epochs::epoch_key_constants::KEY_PROTOCOL_VERSION_U8 => { + ("ProtocolVersion(ascii:'v')".to_string(), None) + } + credit_pools::epochs::epoch_key_constants::KEY_START_BLOCK_HEIGHT_U8 => { + ("StartBlockHeight(ascii:'h')".to_string(), None) + } + credit_pools::epochs::epoch_key_constants::KEY_START_BLOCK_CORE_HEIGHT_U8 => { + ("StartBlockCoreHeight(ascii:'c')".to_string(), None) + } + credit_pools::epochs::epoch_key_constants::KEY_PROPOSERS_U8 => { + ("Proposers(ascii:'m')".to_string(), None) + } + credit_pools::epochs::epoch_key_constants::KEY_FEE_MULTIPLIER_U8 => { + ("FeeMultiplier(ascii:'x')".to_string(), None) + } + _ => (hex_to_ascii(key), None), + } + } + _ => (hex_to_ascii(key), None), + } + } + KeyInfo::MaxKeySize { + unique_id, + max_size, + } => ( + format!( + "MaxKeySize(unique_id: {:?}, max_size: {})", + unique_id, max_size + ), + None, + ), + } +} + +fn readable_path(path: &KeyInfoPath) -> (String, KnownPath) { + let mut known_path = KnownPath::Root; + let string = path + .0 + .iter() + .map(|key_info| { + let (string, new_known_path) = readable_key_info(known_path, key_info); + if let Some(new_known_path) = new_known_path { + known_path = new_known_path; + } + string + }) + .collect::>() + .join("/"); + (string, known_path) +} + +impl fmt::Display for GroveDbOpBatch { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + for op in &self.operations { + let (path_string, known_path) = readable_path(&op.path); + let (key_string, _) = readable_key_info(known_path, &op.key); + writeln!(f, "{{")?; + writeln!(f, " Path: {}", path_string)?; + writeln!(f, " Key: {}", key_string)?; + match &op.op { + GroveOp::InsertOrReplace { element } | GroveOp::InsertOnly { element } => { + let flags = element.get_flags(); + let flag_info = match flags { + None => "No Flags".to_string(), + Some(flags) => format!("Flags are 0x{}", hex::encode(flags)), + }; + match element { + Element::Item(data, _) => { + let num = match data.len() { + 8 => format!( + " u64({})", + u64::from_be_bytes(data.clone().try_into().unwrap()) + ), + 4 => format!( + " u32({})", + u32::from_be_bytes(data.clone().try_into().unwrap()) + ), + _ => String::new(), + }; + writeln!( + f, + " Operation: Insert Item with length: {}{} {}", + data.len(), + num, + flag_info + )? + } + Element::Tree(None, _) => { + writeln!(f, " Operation: Insert Empty Tree {}", flag_info)? + } + Element::SumTree(None, _, _) => { + writeln!(f, " Operation: Insert Empty Sum Tree {}", flag_info)? + } + _ => writeln!(f, " Operation: Insert {}", element)?, + } + } + _ => { + writeln!(f, " Operation: {:?}", op.op)?; + } + } + writeln!(f, "}}")?; + } + Ok(()) + } +} + +/// Trait defining a batch of GroveDB operations. +pub trait GroveDbOpBatchV0Methods { + /// Creates a new empty batch of GroveDB operations. + fn new() -> Self; + + /// Gets the number of operations from a list of GroveDB ops. + fn len(&self) -> usize; + + /// Checks to see if the operation batch is empty. + fn is_empty(&self) -> bool; + + /// Pushes an operation into a list of GroveDB ops. + fn push(&mut self, op: QualifiedGroveDbOp); + + /// Appends operations into a list of GroveDB ops. + fn append(&mut self, other: &mut Self); + + /// Extend operations into a list of GroveDB ops. + fn extend>(&mut self, other_ops: I); + + /// Puts a list of GroveDB operations into a batch. + fn from_operations(operations: Vec) -> Self; + + /// Adds an `Insert` operation with an empty tree at the specified path and key to a list of GroveDB ops. + fn add_insert_empty_tree(&mut self, path: Vec>, key: Vec); + + /// Adds an `Insert` operation with an empty tree with storage flags to a list of GroveDB ops. + fn add_insert_empty_tree_with_flags( + &mut self, + path: Vec>, + key: Vec, + storage_flags: &Option>, + ); + + /// Adds an `Insert` operation with an empty sum tree at the specified path and key to a list of GroveDB ops. + fn add_insert_empty_sum_tree(&mut self, path: Vec>, key: Vec); + + /// Adds an `Insert` operation with an empty sum tree with storage flags to a list of GroveDB ops. + fn add_insert_empty_sum_tree_with_flags( + &mut self, + path: Vec>, + key: Vec, + storage_flags: &Option>, + ); + + /// Adds a `Delete` operation to a list of GroveDB ops. + fn add_delete(&mut self, path: Vec>, key: Vec); + + /// Adds a `Delete` tree operation to a list of GroveDB ops. + fn add_delete_tree(&mut self, path: Vec>, key: Vec, is_sum_tree: bool); + + /// Adds an `Insert` operation with an element to a list of GroveDB ops. + fn add_insert(&mut self, path: Vec>, key: Vec, element: Element); + + /// Verify consistency of operations + fn verify_consistency_of_operations(&self) -> GroveDbOpConsistencyResults; + + /// Check if the batch contains a specific path and key. + /// + /// # Arguments + /// + /// * `path` - The path to search for. + /// * `key` - The key to search for. + /// + /// # Returns + /// + /// * `Option<&Op>` - Returns a reference to the `Op` if found, or `None` otherwise. + fn contains<'c, P>(&self, path: P, key: &[u8]) -> Option<&GroveOp> + where + P: IntoIterator, +

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone; + + /// Remove a specific path and key from the batch and return the removed `Op`. + /// + /// # Arguments + /// + /// * `path` - The path to search for. + /// * `key` - The key to search for. + /// + /// # Returns + /// + /// * `Option` - Returns the removed `Op` if found, or `None` otherwise. + fn remove<'c, P>(&mut self, path: P, key: &[u8]) -> Option + where + P: IntoIterator, +

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone; + + /// Find and remove a specific path and key from the batch if it is an + /// `GroveOp::InsertOrReplace`, `GroveOp::Replace`, or `GroveOp::Patch`. Return the found `Op` regardless of whether it was removed. + /// + /// # Arguments + /// + /// * `path` - The path to search for. + /// * `key` - The key to search for. + /// + /// # Returns + /// + /// * `Option` - Returns the found `Op` if it exists. If the `Op` is an `GroveOp::InsertOrReplace`, `GroveOp::Replace`, + /// or `GroveOp::Patch`, it will be removed from the batch. + fn remove_if_insert(&mut self, path: Vec>, key: &[u8]) -> Option; +} + +impl GroveDbOpBatchV0Methods for GroveDbOpBatch { + /// Creates a new empty batch of GroveDB operations. + fn new() -> Self { + GroveDbOpBatch { + operations: Vec::new(), + } + } + + /// Gets the number of operations from a list of GroveDB ops. + fn len(&self) -> usize { + self.operations.len() + } + + /// Checks to see if the operation batch is empty + fn is_empty(&self) -> bool { + self.operations.is_empty() + } + + /// Pushes an operation into a list of GroveDB ops. + fn push(&mut self, op: QualifiedGroveDbOp) { + self.operations.push(op); + } + + /// Appends operations into a list of GroveDB ops. + fn append(&mut self, other: &mut Self) { + self.operations.append(&mut other.operations); + } + + /// Extend operations into a list of GroveDB ops. + fn extend>(&mut self, other_ops: I) { + self.operations.extend(other_ops); + } + + /// Puts a list of GroveDB operations into a batch. + fn from_operations(operations: Vec) -> Self { + GroveDbOpBatch { operations } + } + + /// Adds an `Insert` operation with an empty tree at the specified path and key to a list of GroveDB ops. + fn add_insert_empty_tree(&mut self, path: Vec>, key: Vec) { + self.operations + .push(QualifiedGroveDbOp::insert_or_replace_op( + path, + key, + Element::empty_tree(), + )) + } + + /// Adds an `Insert` operation with an empty tree with storage flags to a list of GroveDB ops. + fn add_insert_empty_tree_with_flags( + &mut self, + path: Vec>, + key: Vec, + storage_flags: &Option>, + ) { + self.operations + .push(QualifiedGroveDbOp::insert_or_replace_op( + path, + key, + Element::empty_tree_with_flags( + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ), + )) + } + + /// Adds an `Insert` operation with an empty sum tree at the specified path and key to a list of GroveDB ops. + fn add_insert_empty_sum_tree(&mut self, path: Vec>, key: Vec) { + self.operations + .push(QualifiedGroveDbOp::insert_or_replace_op( + path, + key, + Element::empty_sum_tree(), + )) + } + + /// Adds an `Insert` operation with an empty sum tree with storage flags to a list of GroveDB ops. + fn add_insert_empty_sum_tree_with_flags( + &mut self, + path: Vec>, + key: Vec, + storage_flags: &Option>, + ) { + self.operations + .push(QualifiedGroveDbOp::insert_or_replace_op( + path, + key, + Element::empty_sum_tree_with_flags( + StorageFlags::map_borrowed_cow_to_some_element_flags(storage_flags), + ), + )) + } + + /// Adds a `Delete` operation to a list of GroveDB ops. + fn add_delete(&mut self, path: Vec>, key: Vec) { + self.operations + .push(QualifiedGroveDbOp::delete_op(path, key)) + } + + /// Adds a `Delete` tree operation to a list of GroveDB ops. + fn add_delete_tree(&mut self, path: Vec>, key: Vec, is_sum_tree: bool) { + self.operations + .push(QualifiedGroveDbOp::delete_tree_op(path, key, is_sum_tree)) + } + + /// Adds an `Insert` operation with an element to a list of GroveDB ops. + fn add_insert(&mut self, path: Vec>, key: Vec, element: Element) { + self.operations + .push(QualifiedGroveDbOp::insert_or_replace_op(path, key, element)) + } + + /// Verify consistency of operations + fn verify_consistency_of_operations(&self) -> GroveDbOpConsistencyResults { + QualifiedGroveDbOp::verify_consistency_of_operations(&self.operations) + } + + /// Check if the batch contains a specific path and key. + /// + /// # Arguments + /// + /// * `path` - The path to search for. + /// * `key` - The key to search for. + /// + /// # Returns + /// + /// * `Option<&Op>` - Returns a reference to the `Op` if found, or `None` otherwise. + fn contains<'c, P>(&self, path: P, key: &[u8]) -> Option<&GroveOp> + where + P: IntoIterator, +

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, + { + let path = KeyInfoPath( + path.into_iter() + .map(|item| KeyInfo::KnownKey(item.to_vec())) + .collect(), + ); + + self.operations.iter().find_map(|op| { + if op.path == path && op.key == KeyInfo::KnownKey(key.to_vec()) { + Some(&op.op) + } else { + None + } + }) + } + + /// Remove a specific path and key from the batch and return the removed `Op`. + /// + /// # Arguments + /// + /// * `path` - The path to search for. + /// * `key` - The key to search for. + /// + /// # Returns + /// + /// * `Option` - Returns the removed `Op` if found, or `None` otherwise. + fn remove<'c, P>(&mut self, path: P, key: &[u8]) -> Option + where + P: IntoIterator, +

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, + { + let path = KeyInfoPath( + path.into_iter() + .map(|item| KeyInfo::KnownKey(item.to_vec())) + .collect(), + ); + + if let Some(index) = self + .operations + .iter() + .position(|op| op.path == path && op.key == KeyInfo::KnownKey(key.to_vec())) + { + Some(self.operations.remove(index).op) + } else { + None + } + } + + /// Find and remove a specific path and key from the batch if it is an + /// `GroveOp::InsertOrReplace`, `GroveOp::Replace`, or `GroveOp::Patch`. Return the found `Op` regardless of whether it was removed. + /// + /// # Arguments + /// + /// * `path` - The path to search for. + /// * `key` - The key to search for. + /// + /// # Returns + /// + /// * `Option` - Returns the found `Op` if it exists. If the `Op` is an `GroveOp::InsertOrReplace`, `GroveOp::Replace`, + /// or `GroveOp::Patch`, it will be removed from the batch. + fn remove_if_insert(&mut self, path: Vec>, key: &[u8]) -> Option { + let path = KeyInfoPath( + path.into_iter() + .map(|item| KeyInfo::KnownKey(item.to_vec())) + .collect(), + ); + + if let Some(index) = self + .operations + .iter() + .position(|op| op.path == path && op.key == KeyInfo::KnownKey(key.to_vec())) + { + let op = &self.operations[index].op; + let op = if matches!( + op, + &GroveOp::InsertOrReplace { .. } + | &GroveOp::InsertOnly { .. } + | &GroveOp::Replace { .. } + | &GroveOp::Patch { .. } + ) { + self.operations.remove(index).op + } else { + op.clone() + }; + Some(op) + } else { + None + } + } +} + +impl IntoIterator for GroveDbOpBatch { + type Item = QualifiedGroveDbOp; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.operations.into_iter() + } +} diff --git a/packages/rs-drive/src/util/batch/mod.rs b/packages/rs-drive/src/util/batch/mod.rs new file mode 100644 index 00000000000..ffe081c893f --- /dev/null +++ b/packages/rs-drive/src/util/batch/mod.rs @@ -0,0 +1,15 @@ +//! GroveDB Operations Batch. +//! +//! This module defines the GroveDbOpBatch struct and implements its functions. +//! + +/// Operation module +pub mod drive_op_batch; +pub mod grovedb_op_batch; + +pub use drive_op_batch::DataContractOperationType; +pub use drive_op_batch::DocumentOperationType; +pub use drive_op_batch::DriveOperation; +pub use drive_op_batch::IdentityOperationType; +pub use drive_op_batch::SystemOperationType; +pub use grovedb_op_batch::GroveDbOpBatch; diff --git a/packages/rs-drive/src/util/common/decode.rs b/packages/rs-drive/src/util/common/decode.rs new file mode 100644 index 00000000000..acf19384c98 --- /dev/null +++ b/packages/rs-drive/src/util/common/decode.rs @@ -0,0 +1,44 @@ +//! Decoding. +//! +//! This module defines decoding functions. +//! + +use byteorder::{BigEndian, ReadBytesExt}; +use std::io; + +/// Decoding error. +#[derive(Debug, thiserror::Error)] +pub enum DecodeError { + /// Slice passed to decode_u64 is not 8 bytes long. + #[error("can't create a u64 from &[u8]: expected size 8, got {0}")] + InvalidLength(usize), + /// Unexpected IO error. + #[error("can't create a u64 from &[u8]: expected size 8, got {0}")] + ReadFailed(io::Error), +} + +/// Decodes an unsigned integer on 64 bits. +pub fn decode_u64(val: &[u8]) -> Result { + if val.len() != 8 { + return Err(DecodeError::InvalidLength(val.len())); + } + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + let mut val = val.to_vec(); + val[0] ^= 0b1000_0000; + + // Decode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut rdr = val.as_slice(); + rdr.read_u64::().map_err(DecodeError::ReadFailed) +} diff --git a/packages/rs-drive/src/util/common/encode.rs b/packages/rs-drive/src/util/common/encode.rs new file mode 100644 index 00000000000..005e701719a --- /dev/null +++ b/packages/rs-drive/src/util/common/encode.rs @@ -0,0 +1,220 @@ +//! Encoding. +//! +//! This module defines encoding functions. +//! + +use crate::error::drive::DriveError; +use crate::error::Error; +use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; + +/// Encodes an unsigned integer on 64 bits. +pub fn encode_u64(val: u64) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u64::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr +} + +/// Decodes a 64-bit unsigned integer from a vector of bytes encoded with `encode_u64`. +/// +/// # Arguments +/// +/// * `bytes` - A vector of bytes representing the encoded 64-bit unsigned integer. +/// +/// # Returns +/// +/// * A 64-bit unsigned integer decoded from the input bytes. +/// +/// # Panics +/// +/// This function will panic if the input vector does not have exactly 8 bytes. +pub fn decode_u64_owned(mut bytes: Vec) -> Result { + // Ensure the input vector has exactly 8 bytes + if bytes.len() != 8 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "Trying to decode a u64 from {} bytes {}", + bytes.len(), + hex::encode(bytes) + )))); + } + + // Flip the sign bit back to its original state + // This reverses the transformation done in `encode_u64` + bytes[0] ^= 0b1000_0000; + + // Read the integer from the modified bytes + // The bytes are in big endian form, which preserves the correct order + // when they were written in the encode function + Ok(BigEndian::read_u64(&bytes)) +} + +/// Decodes a 64-bit unsigned integer from a vector of bytes encoded with `encode_u64`. +/// +/// # Arguments +/// +/// * `bytes` - A vector of bytes representing the encoded 64-bit unsigned integer. +/// +/// # Returns +/// +/// * A 64-bit unsigned integer decoded from the input bytes. +/// +/// # Panics +/// +/// This function will panic if the input vector does not have exactly 8 bytes. +pub fn decode_u64(bytes: &[u8]) -> Result { + // Ensure the input vector has exactly 8 bytes + if bytes.len() != 8 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "Trying to decode a u64 from {} bytes {}", + bytes.len(), + hex::encode(bytes) + )))); + } + + let mut wtr = bytes.to_vec(); + + // Flip the sign bit back to its original state + // This reverses the transformation done in `encode_u64` + wtr[0] ^= 0b1000_0000; + + // Read the integer from the modified bytes + // The bytes are in big endian form, which preserves the correct order + // when they were written in the encode function + Ok(BigEndian::read_u64(&wtr)) +} + +/// Encodes a signed integer on 64 bits. +pub fn encode_i64(val: i64) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_i64::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr +} + +/// Encodes a float. +pub fn encode_float(val: f64) -> Vec { + // Floats are represented based on the IEEE 754-2008 standard + // [sign bit] [biased exponent] [mantissa] + + // when comparing floats, the sign bit has the greatest impact + // any positive number is greater than all negative numbers + // if the numbers come from the same domain then the exponent is the next factor to consider + // the exponent gives a sense of how many digits are in the non fractional part of the number + // for example in base 10, 10 has an exponent of 1 (1.0 * 10^1) + // while 5000 (5.0 * 10^3) has an exponent of 3 + // for the positive domain, the bigger the exponent the larger the number i.e 5000 > 10 + // for the negative domain, the bigger the exponent the smaller the number i.e -10 > -5000 + // if the exponents are the same, then the mantissa is used to determine the greater number + // the inverse relationship still holds + // i.e bigger mantissa (bigger number in positive domain but smaller number in negative domain) + + // There are two things to fix to achieve total sort order + // 1. Place positive domain above negative domain (i.e flip the sign bit) + // 2. Exponent and mantissa for a smaller number like -5000 is greater than that of -10 + // so bit level comparison would say -5000 is greater than -10 + // we fix this by flipping the exponent and mantissa values, which has the effect of reversing + // the order (0000 [smallest] -> 1111 [largest]) + + // Encode in big endian form, so most significant bits are compared first + let mut wtr = vec![]; + wtr.write_f64::(val).unwrap(); + + // Check if the value is negative, if it is + // flip all the bits i.e sign, exponent and mantissa + if val < 0.0 { + wtr = wtr.iter().map(|byte| !byte).collect(); + } else { + // for positive values, just flip the sign bit + wtr[0] ^= 0b1000_0000; + } + + wtr +} + +/// Encodes an unsigned integer on 16 bits. +pub fn encode_u16(val: u16) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u16::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr +} + +/// Encodes an unsigned integer on 32 bits. +pub fn encode_u32(val: u32) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u32::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr +} diff --git a/packages/rs-drive/src/util/common/mod.rs b/packages/rs-drive/src/util/common/mod.rs new file mode 100644 index 00000000000..1c80d24e06b --- /dev/null +++ b/packages/rs-drive/src/util/common/mod.rs @@ -0,0 +1,2 @@ +pub mod decode; +pub mod encode; diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete/mod.rs new file mode 100644 index 00000000000..744e1a47ab4 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_delete/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchDeleteApplyType; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; + +impl Drive { + /// Pushes a "delete element" operation to `drive_operations`. + /// + /// # Parameters + /// * `path`: The path to delete. + /// * `key`: The key of the item to delete. + /// * `apply_type`: The apply type for the delete operation. + /// * `transaction`: The transaction argument. + /// * `drive_operations`: The vector containing low-level drive operations. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn batch_delete>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + apply_type: BatchDeleteApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.batch.batch_delete { + 0 => self.batch_delete_v0( + path, + key, + apply_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_delete".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs new file mode 100644 index 00000000000..25a083ced3c --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::{push_drive_operation_result, BatchDeleteApplyType}; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::operations::delete::DeleteOptions; +use grovedb::{GroveDb, TransactionArg}; +use grovedb_path::SubtreePath; +use grovedb_storage::rocksdb_storage::RocksDbStorage; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes a "delete element" operation to `drive_operations`. + pub(crate) fn batch_delete_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + apply_type: BatchDeleteApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let current_batch_operations = + LowLevelDriveOperation::grovedb_operations_batch(drive_operations); + let options = DeleteOptions { + allow_deleting_non_empty_trees: false, + deleting_non_empty_trees_returns_error: true, + base_root_storage_is_free: true, + validate_tree_at_path_exists: false, //todo: not sure about this one + }; + let delete_operation = match apply_type { + BatchDeleteApplyType::StatelessBatchDelete { + is_sum_tree, + estimated_key_size, + estimated_value_size, + } => GroveDb::average_case_delete_operation_for_delete::( + &KeyInfoPath::from_known_owned_path(path.to_vec()), + &KeyInfo::KnownKey(key.to_vec()), + is_sum_tree, + false, + true, + 0, + (estimated_key_size, estimated_value_size), + &drive_version.grove_version, + ) + .map(|r| r.map(Some)), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum, + } => self.grove.delete_operation_for_delete_internal( + path, + key, + &options, + is_known_to_be_subtree_with_sum, + ¤t_batch_operations.operations, + transaction, + &drive_version.grove_version, + ), + }; + + if let Some(delete_operation) = + push_drive_operation_result(delete_operation, drive_operations)? + { + // we also add the actual delete operation + drive_operations.push(GroveOperation(delete_operation)) + } + + Ok(()) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete_up_tree_while_empty/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete_up_tree_while_empty/mod.rs new file mode 100644 index 00000000000..429d042bef9 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_delete_up_tree_while_empty/mod.rs @@ -0,0 +1,64 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchDeleteUpTreeApplyType; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::batch::KeyInfoPath; + +use grovedb::TransactionArg; + +impl Drive { + /// Pushes a "delete up tree while empty" operation to `drive_operations`. + /// + /// # Parameters + /// * `path`: The path to delete. + /// * `key`: The key of the item to delete. + /// * `stop_path_height`: The maximum height to delete up the tree. + /// * `apply_type`: The apply type for the delete operation. + /// * `transaction`: The transaction argument. + /// * `check_existing_operations`: The existing operations to check. + /// * `drive_operations`: The vector containing low-level drive operations. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn batch_delete_up_tree_while_empty( + &self, + path: KeyInfoPath, + key: &[u8], + stop_path_height: Option, + apply_type: BatchDeleteUpTreeApplyType, + transaction: TransactionArg, + check_existing_operations: &Option<&mut Vec>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .grove_methods + .batch + .batch_delete_up_tree_while_empty + { + 0 => self.batch_delete_up_tree_while_empty_v0( + path, + key, + stop_path_height, + apply_type, + transaction, + check_existing_operations, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_delete_up_tree_while_empty".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete_up_tree_while_empty/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete_up_tree_while_empty/v0/mod.rs new file mode 100644 index 00000000000..3895889a190 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_delete_up_tree_while_empty/v0/mod.rs @@ -0,0 +1,78 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::grove_operations::{push_drive_operation_result, BatchDeleteUpTreeApplyType}; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::operations::delete::DeleteUpTreeOptions; +use grovedb::{GroveDb, TransactionArg}; +use grovedb_storage::rocksdb_storage::RocksDbStorage; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes a "delete up tree while empty" operation to `drive_operations`. + pub(crate) fn batch_delete_up_tree_while_empty_v0( + &self, + path: KeyInfoPath, + key: &[u8], + stop_path_height: Option, + apply_type: BatchDeleteUpTreeApplyType, + transaction: TransactionArg, + check_existing_operations: &Option<&mut Vec>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + //these are the operations in the current operations (eg, delete/add) + let mut current_batch_operations = + LowLevelDriveOperation::grovedb_operations_batch(drive_operations); + + //These are the operations in the same batch, but in a different operation + if let Some(existing_operations) = check_existing_operations { + let mut other_batch_operations = + LowLevelDriveOperation::grovedb_operations_batch(existing_operations); + current_batch_operations.append(&mut other_batch_operations); + } + let cost_context = match apply_type { + BatchDeleteUpTreeApplyType::StatelessBatchDelete { + estimated_layer_info, + } => GroveDb::average_case_delete_operations_for_delete_up_tree_while_empty::< + RocksDbStorage, + >( + &path, + &KeyInfo::KnownKey(key.to_vec()), + stop_path_height, + true, + estimated_layer_info, + &drive_version.grove_version, + ), + BatchDeleteUpTreeApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum, + } => { + let options = DeleteUpTreeOptions { + allow_deleting_non_empty_trees: false, + deleting_non_empty_trees_returns_error: true, + base_root_storage_is_free: true, + validate_tree_at_path_exists: false, + stop_path_height, + }; + self.grove.delete_operations_for_delete_up_tree_while_empty( + path.to_path_refs().as_slice().into(), + key, + &options, + is_known_to_be_subtree_with_sum, + current_batch_operations.operations, + transaction, + &drive_version.grove_version, + ) + } + }; + let delete_operations = push_drive_operation_result(cost_context, drive_operations)?; + delete_operations + .into_iter() + .for_each(|op| drive_operations.push(GroveOperation(op))); + + Ok(()) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert/mod.rs new file mode 100644 index 00000000000..45c9ec6bd3a --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert/mod.rs @@ -0,0 +1,36 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo; +use dpp::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes an "insert element" operation to `drive_operations`. + /// + /// # Parameters + /// * `path_key_element_info`: The key information of the document and element to insert. + /// * `drive_operations`: The vector containing low-level drive operations. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn batch_insert( + &self, + path_key_element_info: PathKeyElementInfo, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.batch.batch_insert { + 0 => self.batch_insert_v0(path_key_element_info, drive_operations), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_insert".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert/v0/mod.rs new file mode 100644 index 00000000000..6f2912c2590 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert/v0/mod.rs @@ -0,0 +1,57 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo; +use crate::util::object_size_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyElement, PathKeyElementSize, PathKeyRefElement, + PathKeyUnknownElementSize, +}; + +impl Drive { + /// Pushes an "insert element" operation to `drive_operations`. + pub(crate) fn batch_insert_v0( + &self, + path_key_element_info: PathKeyElementInfo, + drive_operations: &mut Vec, + ) -> Result<(), Error> { + match path_key_element_info { + PathKeyRefElement((path, key, element)) => { + drive_operations.push(LowLevelDriveOperation::insert_for_known_path_key_element( + path, + key.to_vec(), + element, + )); + Ok(()) + } + PathKeyElement((path, key, element)) => { + drive_operations.push(LowLevelDriveOperation::insert_for_known_path_key_element( + path, key, element, + )); + Ok(()) + } + PathKeyElementSize((key_info_path, key_info, element)) => { + drive_operations.push( + LowLevelDriveOperation::insert_for_estimated_path_key_element( + key_info_path, + key_info, + element, + ), + ); + Ok(()) + } + PathKeyUnknownElementSize(_) => Err(Error::Drive(DriveError::NotSupportedPrivate( + "inserting unsized documents into a batch is not currently supported", + ))), + PathFixedSizeKeyRefElement((path, key, element)) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + drive_operations.push(LowLevelDriveOperation::insert_for_known_path_key_element( + path_items, + key.to_vec(), + element, + )); + Ok(()) + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree/mod.rs new file mode 100644 index 00000000000..2a2aaf74f04 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree/mod.rs @@ -0,0 +1,46 @@ +mod v0; + +use crate::util::object_size_info::DriveKeyInfo; +use crate::util::storage_flags::StorageFlags; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes an "insert empty tree" operation to `drive_operations`. + /// + /// # Parameters + /// * `path`: The path to insert an empty tree. + /// * `key_info`: The key information of the document. + /// * `storage_flags`: Storage options for the operation. + /// * `drive_operations`: The vector containing low-level drive operations. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn batch_insert_empty_tree<'a, 'c, P>( + &'a self, + path: P, + key_info: DriveKeyInfo<'c>, + storage_flags: Option<&StorageFlags>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> + where + P: IntoIterator, +

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, + { + match drive_version.grove_methods.batch.batch_insert_empty_tree { + 0 => self.batch_insert_empty_tree_v0(path, key_info, storage_flags, drive_operations), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_insert_empty_tree".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree/v0/mod.rs new file mode 100644 index 00000000000..560a5864664 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree/v0/mod.rs @@ -0,0 +1,51 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DriveKeyInfo; +use crate::util::object_size_info::DriveKeyInfo::{Key, KeyRef, KeySize}; +use crate::util::storage_flags::StorageFlags; +use grovedb::batch::KeyInfoPath; + +impl Drive { + /// Pushes an "insert empty tree" operation to `drive_operations`. + pub(crate) fn batch_insert_empty_tree_v0<'a, 'c, P>( + &'a self, + path: P, + key_info: DriveKeyInfo<'c>, + storage_flags: Option<&StorageFlags>, + drive_operations: &mut Vec, + ) -> Result<(), Error> + where + P: IntoIterator, +

::IntoIter: ExactSizeIterator + DoubleEndedIterator + Clone, + { + match key_info { + KeyRef(key) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + drive_operations.push(LowLevelDriveOperation::for_known_path_key_empty_tree( + path_items, + key.to_vec(), + storage_flags, + )); + Ok(()) + } + KeySize(key) => { + drive_operations.push(LowLevelDriveOperation::for_estimated_path_key_empty_tree( + KeyInfoPath::from_known_path(path), + key, + storage_flags, + )); + Ok(()) + } + Key(key) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + drive_operations.push(LowLevelDriveOperation::for_known_path_key_empty_tree( + path_items, + key, + storage_flags, + )); + Ok(()) + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/mod.rs new file mode 100644 index 00000000000..a4f630e691e --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/mod.rs @@ -0,0 +1,52 @@ +mod v0; + +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::PathKeyInfo; +use crate::util::storage_flags::StorageFlags; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. + /// Will also check the current drive operations + /// Returns true if we inserted + pub fn batch_insert_empty_tree_if_not_exists( + &self, + path_key_info: PathKeyInfo, + use_sum_tree: bool, + storage_flags: Option<&StorageFlags>, + apply_type: BatchInsertTreeApplyType, + transaction: TransactionArg, + check_existing_operations: &mut Option<&mut Vec>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match drive_version + .grove_methods + .batch + .batch_insert_empty_tree_if_not_exists + { + 0 => self.batch_insert_empty_tree_if_not_exists_v0( + path_key_info, + use_sum_tree, + storage_flags, + apply_type, + transaction, + check_existing_operations, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_insert_empty_tree_if_not_exists".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs new file mode 100644 index 00000000000..4f2c30664c7 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs @@ -0,0 +1,327 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::PathKeyInfo; +use crate::util::object_size_info::PathKeyInfo::{ + PathFixedSizeKey, PathFixedSizeKeyRef, PathKey, PathKeyRef, PathKeySize, +}; +use crate::util::storage_flags::StorageFlags; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::GroveOp; +use grovedb::TransactionArg; + +impl Drive { + /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. + /// Will also check the current drive operations + pub(crate) fn batch_insert_empty_tree_if_not_exists_v0( + &self, + path_key_info: PathKeyInfo, + use_sum_tree: bool, + storage_flags: Option<&StorageFlags>, + apply_type: BatchInsertTreeApplyType, + transaction: TransactionArg, + check_existing_operations: &mut Option<&mut Vec>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + //todo: clean up the duplication + match path_key_info { + PathKeyRef((path, key)) => { + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if let Some(existing_operations) = check_existing_operations { + let mut i = 0; + let mut found = false; + while i < existing_operations.len() { + // we need to check every drive operation + // if it already exists then just ignore things + // if we had a delete then we need to remove the delete + let previous_drive_operation = &existing_operations[i]; + if previous_drive_operation == &drive_operation { + found = true; + break; + } else if let GroveOperation(grove_op) = previous_drive_operation { + if grove_op.key == key + && grove_op.path == path + && matches!(grove_op.op, GroveOp::DeleteTree) + { + found = true; + existing_operations.remove(i); + break; + } else { + i += 1; + } + } else { + i += 1; + } + } + if !found { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } else { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } + } + PathKeySize(_key_path_info, _key_info) => Err(Error::Drive( + DriveError::NotSupportedPrivate("document sizes in batch operations not supported"), + )), + PathKey((path, key)) => { + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if let Some(existing_operations) = check_existing_operations { + let mut i = 0; + let mut found = false; + while i < existing_operations.len() { + // we need to check every drive operation + // if it already exists then just ignore things + // if we had a delete then we need to remove the delete + let previous_drive_operation = &existing_operations[i]; + if previous_drive_operation == &drive_operation { + found = true; + break; + } else if let GroveOperation(grove_op) = previous_drive_operation { + if grove_op.key == key + && grove_op.path == path + && matches!(grove_op.op, GroveOp::DeleteTree) + { + found = true; + existing_operations.remove(i); + break; + } else { + i += 1; + } + } else { + i += 1; + } + } + if !found { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } else { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } + } + PathFixedSizeKey((path, key)) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path_items, + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path_items, + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if let Some(existing_operations) = check_existing_operations { + let mut i = 0; + let mut found = false; + while i < existing_operations.len() { + // we need to check every drive operation + // if it already exists then just ignore things + // if we had a delete then we need to remove the delete + let previous_drive_operation = &existing_operations[i]; + if previous_drive_operation == &drive_operation { + found = true; + break; + } else if let GroveOperation(grove_op) = previous_drive_operation { + if grove_op.key == key + && grove_op.path == path + && matches!(grove_op.op, GroveOp::DeleteTree) + { + found = true; + existing_operations.remove(i); + break; + } else { + i += 1; + } + } else { + i += 1; + } + } + if !found { + let has_raw = self.grove_has_raw( + path.as_ref().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } else { + let has_raw = self.grove_has_raw( + path.as_ref().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } + } + PathFixedSizeKeyRef((path, key)) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path_items, + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path_items, + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if let Some(existing_operations) = check_existing_operations { + let mut i = 0; + let mut found = false; + while i < existing_operations.len() { + // we need to check every drive operation + // if it already exists then just ignore things + // if we had a delete then we need to remove the delete + let previous_drive_operation = &existing_operations[i]; + if previous_drive_operation == &drive_operation { + found = true; + break; + } else if let GroveOperation(grove_op) = previous_drive_operation { + if grove_op.key == key + && grove_op.path == path + && matches!(grove_op.op, GroveOp::DeleteTree) + { + found = true; + existing_operations.remove(i); + break; + } else { + i += 1; + } + } else { + i += 1; + } + } + if !found { + let has_raw = self.grove_has_raw( + path.as_ref().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } else { + let has_raw = self.grove_has_raw( + path.as_ref().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/mod.rs new file mode 100644 index 00000000000..896a36f2b13 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/mod.rs @@ -0,0 +1,63 @@ +mod v0; + +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::PathKeyInfo; +use crate::util::storage_flags::StorageFlags; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. + /// Will also check the current drive operations. + /// + /// # Parameters + /// * `path_key_info`: Information about the path and key. + /// * `storage_flags`: Optional flags for the storage. + /// * `apply_type`: The apply type for the operation. + /// * `transaction`: The transaction argument for the operation. + /// * `drive_operations`: The list of drive operations to append to. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(bool)` if the operation was successful. Returns true if the path key already exists without references. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + /// * `Err(DriveError::CorruptedCodeExecution)` if the operation is not supported. + pub fn batch_insert_empty_tree_if_not_exists_check_existing_operations( + &self, + path_key_info: PathKeyInfo, + use_sum_tree: bool, + storage_flags: Option<&StorageFlags>, + apply_type: BatchInsertTreeApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match drive_version + .grove_methods + .batch + .batch_insert_empty_tree_if_not_exists_check_existing_operations + { + 0 => self.batch_insert_empty_tree_if_not_exists_check_existing_operations_v0( + path_key_info, + use_sum_tree, + storage_flags, + apply_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_insert_empty_tree_if_not_exists_check_existing_operations" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/v0/mod.rs new file mode 100644 index 00000000000..06e8a460e3f --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists_check_existing_operations/v0/mod.rs @@ -0,0 +1,166 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchInsertTreeApplyType; +use crate::util::object_size_info::PathKeyInfo; +use crate::util::object_size_info::PathKeyInfo::{ + PathFixedSizeKey, PathFixedSizeKeyRef, PathKey, PathKeyRef, PathKeySize, +}; +use crate::util::storage_flags::StorageFlags; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. + /// Will also check the current drive operations + pub(crate) fn batch_insert_empty_tree_if_not_exists_check_existing_operations_v0< + const N: usize, + >( + &self, + path_key_info: PathKeyInfo, + use_sum_tree: bool, + storage_flags: Option<&StorageFlags>, + apply_type: BatchInsertTreeApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match path_key_info { + PathKeyRef((path, key)) => { + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if !drive_operations.contains(&drive_operation) { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } + PathKeySize(_key_path_info, _key_info) => Err(Error::Drive( + DriveError::NotSupportedPrivate("document sizes in batch operations not supported"), + )), + PathKey((path, key)) => { + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path.clone(), + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if !drive_operations.contains(&drive_operation) { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } + PathFixedSizeKey((path, key)) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path_items, + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path_items, + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if !drive_operations.contains(&drive_operation) { + let has_raw = self.grove_has_raw( + path.as_ref().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } + PathFixedSizeKeyRef((path, key)) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + let drive_operation = if use_sum_tree { + LowLevelDriveOperation::for_known_path_key_empty_sum_tree( + path_items, + key.to_vec(), + storage_flags, + ) + } else { + LowLevelDriveOperation::for_known_path_key_empty_tree( + path_items, + key.to_vec(), + storage_flags, + ) + }; + // we only add the operation if it doesn't already exist in the current batch + if !drive_operations.contains(&drive_operation) { + let has_raw = self.grove_has_raw( + path.as_ref().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push(drive_operation); + } + Ok(!has_raw) + } else { + Ok(false) + } + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/mod.rs new file mode 100644 index 00000000000..6a2256a6277 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/mod.rs @@ -0,0 +1,56 @@ +mod v0; + +use crate::util::grove_operations::BatchInsertApplyType; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::{Element, TransactionArg}; + +impl Drive { + /// Pushes an "insert element if element was changed or is new" operation to `drive_operations`. + /// Returns true if the path key already exists without references. + /// + /// # Parameters + /// * `path_key_element_info`: Information about the path, key and element. + /// * `apply_type`: The apply type for the operation. + /// * `transaction`: The transaction argument for the operation. + /// * `drive_operations`: The list of drive operations to append to. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok((bool, Option))` if the operation was successful. Returns true if the path key already exists without references. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + /// * `Err(DriveError::CorruptedCodeExecution)` if the operation is not supported. + pub fn batch_insert_if_changed_value( + &self, + path_key_element_info: PathKeyElementInfo, + apply_type: BatchInsertApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(bool, Option), Error> { + match drive_version + .grove_methods + .batch + .batch_insert_if_changed_value + { + 0 => self.batch_insert_if_changed_value_v0( + path_key_element_info, + apply_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_insert_if_changed_value".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/v0/mod.rs new file mode 100644 index 00000000000..de5431d8f1f --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/v0/mod.rs @@ -0,0 +1,135 @@ +use crate::util::grove_operations::BatchInsertApplyType; +use crate::util::object_size_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyElement, PathKeyElementSize, PathKeyRefElement, + PathKeyUnknownElementSize, +}; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::util::object_size_info::PathKeyElementInfo; +use dpp::version::drive_versions::DriveVersion; +use grovedb::{Element, GroveDb, TransactionArg}; + +impl Drive { + /// Pushes an "insert element if element was changed or is new" operation to `drive_operations`. + /// Returns true if the path key already exists without references. + pub(crate) fn batch_insert_if_changed_value_v0( + &self, + path_key_element_info: PathKeyElementInfo, + apply_type: BatchInsertApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(bool, Option), Error> { + match path_key_element_info { + PathKeyRefElement((path, key, element)) => { + let previous_element = self.grove_get_raw_optional( + path.as_slice().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + let needs_insert = match &previous_element { + None => true, + Some(previous_element) => previous_element != &element, + }; + if needs_insert { + drive_operations.push( + LowLevelDriveOperation::insert_for_known_path_key_element( + path, + key.to_vec(), + element, + ), + ); + } + Ok((needs_insert, previous_element)) + } + PathKeyElement((path, key, element)) => { + let previous_element = self.grove_get_raw_optional( + path.as_slice().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + let needs_insert = match &previous_element { + None => true, + Some(previous_element) => previous_element != &element, + }; + if needs_insert { + drive_operations.push( + LowLevelDriveOperation::insert_for_known_path_key_element( + path, key, element, + ), + ); + } + Ok((needs_insert, previous_element)) + } + PathFixedSizeKeyRefElement((path, key, element)) => { + let previous_element = self.grove_get_raw_optional( + (&path).into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + let needs_insert = match &previous_element { + None => true, + Some(previous_element) => previous_element != &element, + }; + if needs_insert { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + drive_operations.push( + LowLevelDriveOperation::insert_for_known_path_key_element( + path_items, + key.to_vec(), + element, + ), + ); + } + Ok((needs_insert, previous_element)) + } + PathKeyElementSize((key_info_path, key_info, element)) => { + match apply_type { + BatchInsertApplyType::StatelessBatchInsert { + in_tree_using_sums, .. + } => { + // we can estimate that the element was the same size + drive_operations.push(CalculatedCostOperation( + GroveDb::average_case_for_get_raw( + &key_info_path, + &key_info, + element.serialized_size(&drive_version.grove_version)? as u32, + in_tree_using_sums, + &drive_version.grove_version, + )?, + )); + drive_operations.push( + LowLevelDriveOperation::insert_for_estimated_path_key_element( + key_info_path, + key_info, + element, + ), + ); + Ok((true, None)) + } + BatchInsertApplyType::StatefulBatchInsert => { + Err(Error::Drive(DriveError::NotSupportedPrivate( + "document sizes for stateful insert in batch operations not supported", + ))) + } + } + } + PathKeyUnknownElementSize(_) => Err(Error::Drive(DriveError::NotSupportedPrivate( + "document sizes in batch operations not supported", + ))), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/mod.rs new file mode 100644 index 00000000000..d14f1e2773b --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/mod.rs @@ -0,0 +1,52 @@ +mod v0; + +use crate::util::grove_operations::BatchInsertApplyType; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Pushes an "insert element if the path key does not yet exist" operation to `drive_operations`. + /// Returns true if the path key already exists without references. + /// + /// # Parameters + /// * `path_key_element_info`: Information about the path, key and element. + /// * `apply_type`: The apply type for the operation. + /// * `transaction`: The transaction argument for the operation. + /// * `drive_operations`: The list of drive operations to append to. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(bool)` if the operation was successful. Returns true if the path key already exists without references. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + /// * `Err(DriveError::CorruptedCodeExecution)` if the operation is not supported. + pub fn batch_insert_if_not_exists( + &self, + path_key_element_info: PathKeyElementInfo, + apply_type: BatchInsertApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match drive_version.grove_methods.batch.batch_insert_if_not_exists { + 0 => self.batch_insert_if_not_exists_v0( + path_key_element_info, + apply_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_insert_if_not_exists".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/v0/mod.rs new file mode 100644 index 00000000000..8bacd806062 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/v0/mod.rs @@ -0,0 +1,123 @@ +use crate::util::grove_operations::BatchInsertApplyType; +use crate::util::object_size_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyElement, PathKeyElementSize, PathKeyRefElement, + PathKeyUnknownElementSize, +}; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::util::object_size_info::PathKeyElementInfo; +use dpp::version::drive_versions::DriveVersion; +use grovedb::{GroveDb, TransactionArg}; + +impl Drive { + /// Pushes an "insert element if the path key does not yet exist" operation to `drive_operations`. + /// Returns true if the path key already exists without references. + pub(crate) fn batch_insert_if_not_exists_v0( + &self, + path_key_element_info: PathKeyElementInfo, + apply_type: BatchInsertApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match path_key_element_info { + PathKeyRefElement((path, key, element)) => { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push( + LowLevelDriveOperation::insert_for_known_path_key_element( + path, + key.to_vec(), + element, + ), + ); + } + Ok(!has_raw) + } + PathKeyElement((path, key, element)) => { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key.as_slice(), + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + drive_operations.push( + LowLevelDriveOperation::insert_for_known_path_key_element( + path, key, element, + ), + ); + } + Ok(!has_raw) + } + PathFixedSizeKeyRefElement((path, key, element)) => { + let has_raw = self.grove_has_raw( + path.as_slice().into(), + key, + apply_type.to_direct_query_type(), + transaction, + drive_operations, + drive_version, + )?; + if !has_raw { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + drive_operations.push( + LowLevelDriveOperation::insert_for_known_path_key_element( + path_items, + key.to_vec(), + element, + ), + ); + } + Ok(!has_raw) + } + PathKeyElementSize((key_info_path, key_info, element)) => { + match apply_type { + BatchInsertApplyType::StatelessBatchInsert { + in_tree_using_sums, .. + } => { + // we can estimate that the element was the same size + drive_operations.push(CalculatedCostOperation( + GroveDb::average_case_for_has_raw( + &key_info_path, + &key_info, + element.serialized_size(&drive_version.grove_version)? as u32, + in_tree_using_sums, + &drive_version.grove_version, + )?, + )); + drive_operations.push( + LowLevelDriveOperation::insert_for_estimated_path_key_element( + key_info_path, + key_info, + element, + ), + ); + Ok(true) + } + BatchInsertApplyType::StatefulBatchInsert => { + Err(Error::Drive(DriveError::NotSupportedPrivate( + "document sizes for stateful insert in batch operations not supported", + ))) + } + } + } + PathKeyUnknownElementSize(_) => Err(Error::Drive(DriveError::NotSupportedPrivate( + "document sizes in batch operations not supported", + ))), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_refresh_reference/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_refresh_reference/mod.rs new file mode 100644 index 00000000000..27fb7665b22 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_refresh_reference/mod.rs @@ -0,0 +1,49 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::Element; + +impl Drive { + /// Pushes an "refresh reference" operation to `drive_operations`. + /// + /// # Parameters + /// * `path`: The path of the reference to be refreshed. + /// * `key`: The key of the reference to be refreshed. + /// * `document_reference`: The element to be referenced. + /// * `trust_refresh_reference`: Flag to trust the refresh reference. + /// * `drive_operations`: The list of drive operations to append to. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the reference was successfully refreshed. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + /// * `Err(DriveError::CorruptedCodeExecution)` if expected a reference on refresh. + pub fn batch_refresh_reference( + &self, + path: Vec>, + key: Vec, + document_reference: Element, + trust_refresh_reference: bool, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.batch.batch_refresh_reference { + 0 => self.batch_refresh_reference_v0( + path, + key, + document_reference, + trust_refresh_reference, + drive_operations, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_refresh_reference".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_refresh_reference/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_refresh_reference/v0/mod.rs new file mode 100644 index 00000000000..f9758fd2870 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_refresh_reference/v0/mod.rs @@ -0,0 +1,35 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use grovedb::Element; + +impl Drive { + /// Pushes an "refresh reference" operation to `drive_operations`. + pub(crate) fn batch_refresh_reference_v0( + &self, + path: Vec>, + key: Vec, + document_reference: Element, + trust_refresh_reference: bool, + drive_operations: &mut Vec, + ) -> Result<(), Error> { + let Element::Reference(reference_path_type, max_reference_hop, flags) = document_reference + else { + return Err(Error::Drive(DriveError::CorruptedCodeExecution( + "expected a reference on refresh", + ))); + }; + drive_operations.push( + LowLevelDriveOperation::refresh_reference_for_known_path_key_reference_info( + path, + key, + reference_path_type, + max_reference_hop, + flags, + trust_refresh_reference, + ), + ); + Ok(()) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/mod.rs new file mode 100644 index 00000000000..a85f405c502 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/mod.rs @@ -0,0 +1,56 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::BatchDeleteApplyType; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; + +impl Drive { + /// Pushes a "delete element" operation to `drive_operations` and returns the current element. + /// If the element didn't exist does nothing. + /// It is raw, because it does not use references. + /// + /// # Parameters + /// * `path`: The path to the element to delete. + /// * `key`: The key of the element to delete. + /// * `apply_type`: The delete operation type. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: The list of drive operations to append to. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Some(Element))` if the element was successfully deleted. + /// * `Ok(None)` if the element does not exist. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn batch_remove_raw>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + apply_type: BatchDeleteApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version.grove_methods.batch.batch_remove_raw { + 0 => self.batch_remove_raw_v0( + path, + key, + apply_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_remove_raw".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs new file mode 100644 index 00000000000..d6ef95dad2c --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs @@ -0,0 +1,110 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::grove_operations::{push_drive_operation_result, BatchDeleteApplyType}; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::{GroveOp, KeyInfoPath}; +use grovedb::operations::delete::DeleteOptions; +use grovedb::{Element, GroveDb, TransactionArg}; +use grovedb_path::SubtreePath; +use grovedb_storage::rocksdb_storage::RocksDbStorage; + +impl Drive { + /// Pushes a "delete element" operation to `drive_operations` and returns the current element. + /// If the element didn't exist does nothing. + /// It is raw, because it does not use references. + pub(crate) fn batch_remove_raw_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + apply_type: BatchDeleteApplyType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + let mut current_batch_operations = + LowLevelDriveOperation::grovedb_operations_batch(drive_operations); + let options = DeleteOptions { + allow_deleting_non_empty_trees: false, + deleting_non_empty_trees_returns_error: true, + base_root_storage_is_free: true, + validate_tree_at_path_exists: false, //todo: not sure about this one + }; + + let needs_removal_from_state = + match current_batch_operations.remove_if_insert(path.to_vec(), key) { + Some(GroveOp::InsertOrReplace { element }) + | Some(GroveOp::Replace { element }) + | Some(GroveOp::Patch { element, .. }) => return Ok(Some(element)), + Some(GroveOp::InsertTreeWithRootHash { .. }) => { + return Err(Error::Drive(DriveError::CorruptedCodeExecution( + "we should not be seeing internal grovedb operations", + ))); + } + Some(GroveOp::Delete { .. }) + | Some(GroveOp::DeleteTree { .. }) + | Some(GroveOp::DeleteSumTree { .. }) => false, + _ => true, + }; + + let maybe_element = self.grove_get_raw_optional( + path.clone(), + key, + (&apply_type).into(), + transaction, + drive_operations, + drive_version, + )?; + if maybe_element.is_none() + && matches!( + &apply_type, + &BatchDeleteApplyType::StatefulBatchDelete { .. } + ) + { + return Ok(None); + } + if needs_removal_from_state { + let delete_operation = match apply_type { + BatchDeleteApplyType::StatelessBatchDelete { + is_sum_tree, + estimated_key_size, + estimated_value_size, + } => GroveDb::average_case_delete_operation_for_delete::( + &KeyInfoPath::from_known_owned_path(path.to_vec()), + &KeyInfo::KnownKey(key.to_vec()), + is_sum_tree, + false, + true, + 0, + (estimated_key_size, estimated_value_size), + &drive_version.grove_version, + ) + .map(|r| r.map(Some)), + BatchDeleteApplyType::StatefulBatchDelete { + is_known_to_be_subtree_with_sum, + } => self.grove.delete_operation_for_delete_internal( + path, + key, + &options, + is_known_to_be_subtree_with_sum, + ¤t_batch_operations.operations, + transaction, + &drive_version.grove_version, + ), + }; + + if let Some(delete_operation) = + push_drive_operation_result(delete_operation, drive_operations)? + { + // we also add the actual delete operation + drive_operations.push(GroveOperation(delete_operation)) + } + } + + Ok(maybe_element) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_replace/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_replace/mod.rs new file mode 100644 index 00000000000..47524c8fa66 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_replace/mod.rs @@ -0,0 +1,36 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo; +use dpp::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes a "replace element" operation to `drive_operations`. + /// + /// # Parameters + /// * `path_key_element_info`: The key information of the document and element to insert. + /// * `drive_operations`: The vector containing low-level drive operations. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn batch_replace( + &self, + path_key_element_info: PathKeyElementInfo, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.batch.batch_replace { + 0 => self.batch_replace_v0(path_key_element_info, drive_operations), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "batch_replace".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/batch_replace/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_replace/v0/mod.rs new file mode 100644 index 00000000000..76b2092f0f1 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/batch_replace/v0/mod.rs @@ -0,0 +1,57 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo; +use crate::util::object_size_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyElement, PathKeyElementSize, PathKeyRefElement, + PathKeyUnknownElementSize, +}; + +impl Drive { + /// Pushes a "replace element" operation to `drive_operations`. + pub(crate) fn batch_replace_v0( + &self, + path_key_element_info: PathKeyElementInfo, + drive_operations: &mut Vec, + ) -> Result<(), Error> { + match path_key_element_info { + PathKeyRefElement((path, key, element)) => { + drive_operations.push(LowLevelDriveOperation::replace_for_known_path_key_element( + path, + key.to_vec(), + element, + )); + Ok(()) + } + PathKeyElement((path, key, element)) => { + drive_operations.push(LowLevelDriveOperation::replace_for_known_path_key_element( + path, key, element, + )); + Ok(()) + } + PathKeyElementSize((key_info_path, key_info, element)) => { + drive_operations.push( + LowLevelDriveOperation::replace_for_estimated_path_key_element( + key_info_path, + key_info, + element, + ), + ); + Ok(()) + } + PathKeyUnknownElementSize(_) => Err(Error::Drive(DriveError::NotSupportedPrivate( + "inserting unsized documents into a batch is not currently supported", + ))), + PathFixedSizeKeyRefElement((path, key, element)) => { + let path_items: Vec> = path.into_iter().map(Vec::from).collect(); + drive_operations.push(LowLevelDriveOperation::replace_for_known_path_key_element( + path_items, + key.to_vec(), + element, + )); + Ok(()) + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_batch/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_batch/mod.rs new file mode 100644 index 00000000000..ecc212e1e23 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_batch/mod.rs @@ -0,0 +1,34 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::util::batch::GroveDbOpBatch; +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Applies the given groveDB operations batch. + /// + /// # Parameters + /// * `ops`: The groveDB operations batch. + /// * `validate`: Specifies whether to validate that insertions do not override existing entries. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn grove_apply_batch( + &self, + ops: GroveDbOpBatch, + validate: bool, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + self.grove_apply_batch_with_add_costs( + ops, + validate, + transaction, + &mut vec![], + drive_version, + ) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/mod.rs new file mode 100644 index 00000000000..ccea6a9242a --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/mod.rs @@ -0,0 +1,50 @@ +mod v0; + +use crate::util::batch::GroveDbOpBatch; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::TransactionArg; + +impl Drive { + /// Applies the given groveDB operations batch and gets and passes the costs to `push_drive_operation_result`. + /// + /// # Parameters + /// * `ops`: The groveDB operations batch. + /// * `validate`: Specifies whether to validate that insertions do not override existing entries. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector of operations on the drive. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn grove_apply_batch_with_add_costs( + &self, + ops: GroveDbOpBatch, + validate: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.apply.grove_apply_batch { + 0 => self.grove_apply_batch_with_add_costs_v0( + ops, + validate, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_apply_batch_with_add_costs".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs new file mode 100644 index 00000000000..ce9333f0b76 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs @@ -0,0 +1,196 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::GroveError; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; +use crate::util::grove_operations::push_drive_operation_result; +use crate::util::storage_flags::{MergingOwnersStrategy, StorageFlags}; +use grovedb::batch::{BatchApplyOptions, QualifiedGroveDbOp}; +use grovedb::TransactionArg; +use grovedb_costs::storage_cost::removal::StorageRemovedBytes::BasicStorageRemoval; +use grovedb_costs::storage_cost::transition::OperationStorageTransitionType; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Applies the given groveDB operations batch and gets and passes the costs to `push_drive_operation_result`. + pub(crate) fn grove_apply_batch_with_add_costs_v0( + &self, + ops: GroveDbOpBatch, + validate: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + if ops.is_empty() { + return Err(Error::Drive(DriveError::BatchIsEmpty( + "batch is empty when trying to apply batch with add costs".to_string(), + ))); + } + // if ops.operations.len() < 500 { + // //no initialization + // println!("batch {}", &ops); + // } + + if self.config.batching_consistency_verification { + let consistency_results = + QualifiedGroveDbOp::verify_consistency_of_operations(&ops.operations); + if !consistency_results.is_empty() { + tracing::error!( + ?consistency_results, + "grovedb consistency verification failed" + ); + return Err(Error::Drive(DriveError::GroveDBInsertion( + "insertion order error", + ))); + } + } + + // Clone ops only if we log them + #[cfg(feature = "grovedb_operations_logging")] + let maybe_params_for_logs = if tracing::event_enabled!(target: "drive_grovedb_operations", tracing::Level::TRACE) + { + let root_hash = self + .grove + .root_hash(transaction, &drive_version.grove_version) + .unwrap() + .map_err(Error::GroveDB)?; + + Some((ops.clone(), root_hash)) + } else { + None + }; + + let cost_context = self.grove.apply_batch_with_element_flags_update( + ops.operations, + Some(BatchApplyOptions { + validate_insertion_does_not_override: validate, + validate_insertion_does_not_override_tree: validate, + allow_deleting_non_empty_trees: false, + deleting_non_empty_trees_returns_error: true, + disable_operation_consistency_check: !self.config.batching_consistency_verification, + base_root_storage_is_free: true, + batch_pause_height: None, + }), + |cost, old_flags, new_flags| { + // if there were no flags before then the new flags are used + if old_flags.is_none() { + return Ok(false); + } + // This could be none only because the old element didn't exist + // If they were empty we get an error + let maybe_old_storage_flags = StorageFlags::map_some_element_flags_ref(&old_flags) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive did not understand flags of old item being updated: {}", e) + ) + })?; + let new_storage_flags = StorageFlags::from_element_flags_ref(new_flags) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive did not understand updated item flag information: {}",e) + ) + })? + .ok_or(GroveError::JustInTimeElementFlagsClientError( + "removing flags from an item with flags is not allowed".to_string() + ))?; + match &cost.transition_type() { + OperationStorageTransitionType::OperationUpdateBiggerSize => { + // In the case that the owners do not match up this means that there has been a transfer + // of ownership of the underlying document, the value held is transferred to the new owner + let combined_storage_flags = StorageFlags::optional_combine_added_bytes( + maybe_old_storage_flags, + new_storage_flags, + cost.added_bytes, + MergingOwnersStrategy::UseTheirs, + ) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive could not combine storage flags (new flags were bigger): {}",e) + ) + })?; + let combined_flags = combined_storage_flags.to_element_flags(); + // it's possible they got bigger in the same epoch + if combined_flags == *new_flags { + // they are the same there was no update + Ok(false) + } else { + *new_flags = combined_flags; + Ok(true) + } + } + OperationStorageTransitionType::OperationUpdateSmallerSize => { + // In the case that the owners do not match up this means that there has been a transfer + // of ownership of the underlying document, the value held is transferred to the new owner + let combined_storage_flags = StorageFlags::optional_combine_removed_bytes( + maybe_old_storage_flags, + new_storage_flags, + &cost.removed_bytes, + MergingOwnersStrategy::UseTheirs, + ) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive could not combine storage flags (new flags were smaller): {}", e) + ) + })?; + let combined_flags = combined_storage_flags.to_element_flags(); + // it's possible they got bigger in the same epoch + if combined_flags == *new_flags { + // they are the same there was no update + Ok(false) + } else { + *new_flags = combined_flags; + Ok(true) + } + } + _ => Ok(false), + } + }, + |flags, removed_key_bytes, removed_value_bytes| { + let maybe_storage_flags = + StorageFlags::from_element_flags_ref(flags).map_err(|e| { + GroveError::SplitRemovalBytesClientError( + format!("drive did not understand flags of item being updated: {}",e) + ) + })?; + // if there were no flags before then the new flags are used + match maybe_storage_flags { + None => Ok(( + BasicStorageRemoval(removed_key_bytes), + BasicStorageRemoval(removed_value_bytes), + )), + Some(storage_flags) => storage_flags + .split_storage_removed_bytes(removed_key_bytes, removed_value_bytes), + } + }, + transaction, + &drive_version.grove_version, + ); + + #[cfg(feature = "grovedb_operations_logging")] + if tracing::event_enabled!(target: "drive_grovedb_operations", tracing::Level::TRACE) + && cost_context.value.is_ok() + { + let root_hash = self + .grove + .root_hash(transaction, &drive_version.grove_version) + .unwrap() + .map_err(Error::GroveDB)?; + + let (ops, previous_root_hash) = + maybe_params_for_logs.expect("log params should be set above"); + + tracing::trace!( + target: "drive_grovedb_operations", + ?ops, + ?root_hash, + ?previous_root_hash, + is_transactional = transaction.is_some(), + "grovedb batch applied", + ); + } + + push_drive_operation_result(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_operation/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_operation/mod.rs new file mode 100644 index 00000000000..f77862a3591 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_operation/mod.rs @@ -0,0 +1,38 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::QualifiedGroveDbOp; +use grovedb::TransactionArg; + +impl Drive { + /// Applies the given groveDB operation. + /// + /// # Parameters + /// * `operation`: The groveDB operation to apply. + /// * `validate`: Specifies whether to validate that insertions do not override existing entries. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn grove_apply_operation( + &self, + operation: QualifiedGroveDbOp, + validate: bool, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.apply.grove_apply_operation { + 0 => self.grove_apply_operation_v0(operation, validate, transaction, drive_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_apply_operation".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_operation/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_operation/v0/mod.rs new file mode 100644 index 00000000000..dbbb7613493 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_operation/v0/mod.rs @@ -0,0 +1,27 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::util::batch::GroveDbOpBatch; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::QualifiedGroveDbOp; +use grovedb::TransactionArg; + +impl Drive { + /// Applies the given groveDB operation + pub(crate) fn grove_apply_operation_v0( + &self, + operation: QualifiedGroveDbOp, + validate: bool, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + self.grove_apply_batch_with_add_costs( + GroveDbOpBatch { + operations: vec![operation], + }, + validate, + transaction, + &mut vec![], + drive_version, + ) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch/mod.rs new file mode 100644 index 00000000000..8174d224c34 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch/mod.rs @@ -0,0 +1,44 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::query::GroveError; +use crate::util::batch::GroveDbOpBatch; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::{OpsByLevelPath, QualifiedGroveDbOp}; +use grovedb::TransactionArg; +use grovedb_costs::OperationCost; + +impl Drive { + /// Applies the given groveDB operations batch. + /// + /// # Parameters + /// * `ops`: The batch of groveDB operations to apply. + /// * `validate`: Specifies whether to validate that insertions do not override existing entries. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `add_on_operations`: A closure that takes in the operation cost and optional operation by level path + /// and returns a result of groveDB operations or a grove error. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn grove_apply_partial_batch( + &self, + ops: GroveDbOpBatch, + validate: bool, + transaction: TransactionArg, + add_on_operations: impl FnMut( + &OperationCost, + &Option, + ) -> Result, GroveError>, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + self.grove_apply_partial_batch_with_add_costs( + ops, + validate, + transaction, + add_on_operations, + &mut vec![], + drive_version, + ) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/mod.rs new file mode 100644 index 00000000000..7ba94976f5b --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/mod.rs @@ -0,0 +1,59 @@ +mod v0; + +use crate::util::batch::GroveDbOpBatch; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::GroveError; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::{OpsByLevelPath, QualifiedGroveDbOp}; +use grovedb::TransactionArg; +use grovedb_costs::OperationCost; + +impl Drive { + /// Applies the given groveDB operations batch, gets and passes the costs to `push_drive_operation_result`. + /// + /// # Parameters + /// * `ops`: The batch of groveDB operations to retrieve costs for. + /// * `validate`: Specifies whether to validate that insertions do not override existing entries. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `add_on_operations`: A closure that takes in the operation cost and optional operation by level path + /// and returns a result of groveDB operations or a grove error. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn grove_apply_partial_batch_with_add_costs( + &self, + ops: GroveDbOpBatch, + validate: bool, + transaction: TransactionArg, + add_on_operations: impl FnMut( + &OperationCost, + &Option, + ) -> Result, GroveError>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.apply.grove_apply_partial_batch { + 0 => self.grove_apply_partial_batch_with_add_costs_v0( + ops, + validate, + transaction, + add_on_operations, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_apply_partial_batch_with_add_costs".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs new file mode 100644 index 00000000000..82dad9f0357 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs @@ -0,0 +1,152 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::GroveError; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; +use crate::util::grove_operations::push_drive_operation_result; +use crate::util::storage_flags::{MergingOwnersStrategy, StorageFlags}; +use grovedb::batch::{BatchApplyOptions, OpsByLevelPath, QualifiedGroveDbOp}; +use grovedb::TransactionArg; +use grovedb_costs::storage_cost::removal::StorageRemovedBytes::BasicStorageRemoval; +use grovedb_costs::storage_cost::transition::OperationStorageTransitionType; +use grovedb_costs::OperationCost; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Applies the given groveDB operations batch and gets and passes the costs to `push_drive_operation_result`. + pub(crate) fn grove_apply_partial_batch_with_add_costs_v0( + &self, + ops: GroveDbOpBatch, + validate: bool, + transaction: TransactionArg, + add_on_operations: impl FnMut( + &OperationCost, + &Option, + ) -> Result, GroveError>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + if ops.is_empty() { + return Err(Error::Drive(DriveError::BatchIsEmpty( + "batch is empty when trying to apply partial batch with add costs".to_string(), + ))); + } + // println!("batch {:#?}", ops); + if self.config.batching_consistency_verification { + let consistency_results = + QualifiedGroveDbOp::verify_consistency_of_operations(&ops.operations); + if !consistency_results.is_empty() { + // println!("consistency_results {:#?}", consistency_results); + return Err(Error::Drive(DriveError::GroveDBInsertion( + "insertion order error", + ))); + } + } + + let cost_context = self.grove.apply_partial_batch_with_element_flags_update( + ops.operations, + Some(BatchApplyOptions { + validate_insertion_does_not_override: validate, + validate_insertion_does_not_override_tree: validate, + allow_deleting_non_empty_trees: false, + deleting_non_empty_trees_returns_error: true, + disable_operation_consistency_check: false, + base_root_storage_is_free: true, + batch_pause_height: None, + }), + |cost, old_flags, new_flags| { + // if there were no flags before then the new flags are used + if old_flags.is_none() { + return Ok(false); + } + // This could be none only because the old element didn't exist + // If they were empty we get an error + let maybe_old_storage_flags = StorageFlags::map_some_element_flags_ref(&old_flags) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive did not understand flags of old item being updated {}",e) + ) + })?; + let new_storage_flags = StorageFlags::from_element_flags_ref(new_flags) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive did not understand updated item flag information {}", e) + ) + })? + .ok_or(GroveError::JustInTimeElementFlagsClientError( + "removing flags from an item with flags is not allowed".to_string() + ))?; + match &cost.transition_type() { + OperationStorageTransitionType::OperationUpdateBiggerSize => { + let combined_storage_flags = StorageFlags::optional_combine_added_bytes( + maybe_old_storage_flags, + new_storage_flags, + cost.added_bytes, + MergingOwnersStrategy::RaiseIssue, + ) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive could not combine storage flags (new flags were bigger): {}", e) + ) + })?; + let combined_flags = combined_storage_flags.to_element_flags(); + // it's possible they got bigger in the same epoch + if combined_flags == *new_flags { + // they are the same there was no update + Ok(false) + } else { + *new_flags = combined_flags; + Ok(true) + } + } + OperationStorageTransitionType::OperationUpdateSmallerSize => { + let combined_storage_flags = StorageFlags::optional_combine_removed_bytes( + maybe_old_storage_flags, + new_storage_flags, + &cost.removed_bytes, + MergingOwnersStrategy::RaiseIssue, + ) + .map_err(|e| { + GroveError::JustInTimeElementFlagsClientError( + format!("drive could not combine storage flags (new flags were smaller): {}",e) + ) + })?; + let combined_flags = combined_storage_flags.to_element_flags(); + // it's possible they got bigger in the same epoch + if combined_flags == *new_flags { + // they are the same there was no update + Ok(false) + } else { + *new_flags = combined_flags; + Ok(true) + } + } + _ => Ok(false), + } + }, + |flags, removed_key_bytes, removed_value_bytes| { + let maybe_storage_flags = + StorageFlags::from_element_flags_ref(flags).map_err(|e| { + GroveError::SplitRemovalBytesClientError( + format!("drive did not understand flags of item being updated: {}",e) + ) + })?; + // if there were no flags before then the new flags are used + match maybe_storage_flags { + None => Ok(( + BasicStorageRemoval(removed_key_bytes), + BasicStorageRemoval(removed_value_bytes), + )), + Some(storage_flags) => storage_flags + .split_storage_removed_bytes(removed_key_bytes, removed_value_bytes), + } + }, + add_on_operations, + transaction, + &drive_version.grove_version + ); + push_drive_operation_result(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/mod.rs new file mode 100644 index 00000000000..05e8b12c751 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/mod.rs @@ -0,0 +1,57 @@ +mod v0; + +use crate::util::batch::GroveDbOpBatch; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::batch::KeyInfoPath; +use grovedb::EstimatedLayerInformation; +use std::collections::HashMap; + +impl Drive { + /// Retrieves the costs for the given batch of groveDB operations. + /// The costs are then added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `ops`: The batch of groveDB operations to retrieve costs for. + /// * `estimated_layer_info`: A map with estimated layer information. + /// * `validate`: Specifies whether to validate that insertions do not override existing entries. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `drive_version`: The drive version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the drive version does not match known versions. + pub fn grove_batch_operations_costs( + &self, + ops: GroveDbOpBatch, + estimated_layer_info: HashMap, + validate: bool, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .grove_methods + .costs + .grove_batch_operations_costs + { + 0 => self.grove_batch_operations_costs_v0( + ops, + estimated_layer_info, + validate, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_batch_operations_costs".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs new file mode 100644 index 00000000000..146db3487e4 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs @@ -0,0 +1,41 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::GroveError; +use crate::util::batch::GroveDbOpBatch; +use crate::util::grove_operations::push_drive_operation_result; +use grovedb::batch::estimated_costs::EstimatedCostsType::AverageCaseCostsType; +use grovedb::batch::{BatchApplyOptions, KeyInfoPath}; +use grovedb::{EstimatedLayerInformation, GroveDb}; +use platform_version::version::drive_versions::DriveVersion; +use std::collections::HashMap; + +impl Drive { + /// Gets the costs for the given groveDB op batch and passes them to `push_drive_operation_result`. + pub(crate) fn grove_batch_operations_costs_v0( + &self, + ops: GroveDbOpBatch, + estimated_layer_info: HashMap, + validate: bool, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let cost_context = GroveDb::estimated_case_operations_for_batch( + AverageCaseCostsType(estimated_layer_info), + ops.operations, + Some(BatchApplyOptions { + validate_insertion_does_not_override: validate, + validate_insertion_does_not_override_tree: validate, + allow_deleting_non_empty_trees: false, + deleting_non_empty_trees_returns_error: true, + disable_operation_consistency_check: false, + base_root_storage_is_free: true, + batch_pause_height: None, + }), + |_, _, _| Ok(false), + |_, _, _| Err(GroveError::InternalError("not implemented".to_string())), + &drive_version.grove_version, + ); + push_drive_operation_result(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_clear/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_clear/mod.rs new file mode 100644 index 00000000000..868112b08eb --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_clear/mod.rs @@ -0,0 +1,40 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; + +impl Drive { + /// Handles the deletion of an element in GroveDB at the specified path and key. + /// The operation cost is added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the subtree is to be cleared. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_clear>( + &self, + path: SubtreePath<'_, B>, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.basic.grove_clear { + 0 => self.grove_clear_v0(path, transaction, drive_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_clear".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs new file mode 100644 index 00000000000..ad3152f8957 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs @@ -0,0 +1,74 @@ +use crate::drive::Drive; +use crate::error::Error; +use grovedb::operations::delete::ClearOptions; +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes the `OperationCost` of deleting an element in groveDB to `drive_operations`. + pub(crate) fn grove_clear_v0>( + &self, + path: SubtreePath<'_, B>, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let options = ClearOptions { + check_for_subtrees: false, + allow_deleting_subtrees: false, + trying_to_clear_with_subtrees_returns_error: false, + }; + + #[cfg(feature = "grovedb_operations_logging")] + let maybe_params_for_logs = if tracing::event_enabled!(target: "drive_grovedb_operations", tracing::Level::TRACE) + { + let root_hash = self + .grove + .root_hash(transaction, &drive_version.grove_version) + .unwrap() + .map_err(Error::GroveDB)?; + + Some((path.clone(), root_hash)) + } else { + None + }; + + // we will always return true if there is no error when we don't check for subtrees + #[allow(clippy::let_and_return)] // due to feature below; we must allow this lint here + let result = self + .grove + .clear_subtree( + path, + Some(options), + transaction, + &drive_version.grove_version, + ) + .map_err(Error::GroveDB) + .map(|_| ()); + + #[cfg(feature = "grovedb_operations_logging")] + if tracing::event_enabled!(target: "drive_grovedb_operations", tracing::Level::TRACE) + && result.is_ok() + { + let root_hash = self + .grove + .root_hash(transaction, &drive_version.grove_version) + .unwrap() + .map_err(Error::GroveDB)?; + + let (path, previous_root_hash) = + maybe_params_for_logs.expect("log params should be set above"); + + tracing::trace!( + target: "drive_grovedb_operations", + path = ?path.to_vec(), + ?root_hash, + ?previous_root_hash, + is_transactional = transaction.is_some(), + "grovedb clear", + ); + } + + result + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_delete/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_delete/mod.rs new file mode 100644 index 00000000000..55290ee483d --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_delete/mod.rs @@ -0,0 +1,43 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; + +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; + +impl Drive { + /// Handles the deletion of an element in GroveDB at the specified path and key. + /// The operation cost is added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the element is to be deleted. + /// * `key`: The key of the element to be deleted from the subtree. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_delete>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.basic.grove_delete { + 0 => self.grove_delete_v0(path, key, transaction, drive_operations, drive_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_delete".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs new file mode 100644 index 00000000000..13c8a0776eb --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs @@ -0,0 +1,35 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::push_drive_operation_result; +use grovedb::operations::delete::DeleteOptions; +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes the `OperationCost` of deleting an element in groveDB to `drive_operations`. + pub(crate) fn grove_delete_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let options = DeleteOptions { + allow_deleting_non_empty_trees: false, + deleting_non_empty_trees_returns_error: true, + base_root_storage_is_free: true, + validate_tree_at_path_exists: false, + }; + let cost_context = self.grove.delete( + path, + key, + Some(options), + transaction, + &drive_version.grove_version, + ); + push_drive_operation_result(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get/mod.rs new file mode 100644 index 00000000000..e4082ad71f6 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::QueryType; +use dpp::version::drive_versions::DriveVersion; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; + +impl Drive { + /// Retrieves an element from GroveDB. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. + /// * `key`: The key of the element to be retrieved from the subtree. + /// * `query_type`: The type of query to perform, whether stateless or stateful. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Some(Element))` if the operation was successful and the element was found. + /// * `Ok(None)` if the operation was successful but the element was not found. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. + pub fn grove_get>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + query_type: QueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version.grove_methods.basic.grove_get { + 0 => self.grove_get_v0( + path, + key, + query_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get/v0/mod.rs new file mode 100644 index 00000000000..c5d473ea6d2 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get/v0/mod.rs @@ -0,0 +1,68 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::util::grove_operations::{QueryTarget, QueryType}; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{Element, GroveDb, TransactionArg}; +use grovedb_costs::CostContext; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the element at the given path from groveDB. + /// Pushes the `OperationCost` of getting the element to `drive_operations`. + pub(crate) fn grove_get_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + query_type: QueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match query_type { + QueryType::StatelessQuery { + in_tree_using_sums, + query_target, + estimated_reference_sizes, + } => { + let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); + let key_info = KeyInfo::KnownKey(key.to_vec()); + let cost = match query_target { + QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + GroveDb::average_case_for_get_tree( + &key_info_path, + &key_info, + flags_size, + is_sum_tree, + in_tree_using_sums, + &drive_version.grove_version, + ) + } + QueryTarget::QueryTargetValue(estimated_value_size) => { + GroveDb::average_case_for_get( + &key_info_path, + &key_info, + in_tree_using_sums, + estimated_value_size, + estimated_reference_sizes, + &drive_version.grove_version, + ) + } + }?; + + drive_operations.push(CalculatedCostOperation(cost)); + Ok(None) + } + QueryType::StatefulQuery => { + let CostContext { value, cost } = + self.grove + .get(path, key, transaction, &drive_version.grove_version); + drive_operations.push(CalculatedCostOperation(cost)); + Ok(Some(value.map_err(Error::GroveDB)?)) + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query/mod.rs new file mode 100644 index 00000000000..e863b6ad3a3 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query/mod.rs @@ -0,0 +1,48 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::query_result_type::{QueryResultElements, QueryResultType}; +use grovedb::{PathQuery, TransactionArg}; + +impl Drive { + /// Retrieves the results of a path query from GroveDB. + /// + /// # Parameters + /// * `path_query`: The path query to execute. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `result_type`: The expected type of result of the path query. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok((QueryResultElements, u16))` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. + pub fn grove_get_path_query( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + result_type: QueryResultType, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(QueryResultElements, u16), Error> { + match drive_version.grove_methods.basic.grove_get_path_query { + 0 => self.grove_get_path_query_v0( + path_query, + transaction, + result_type, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_path_query".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query/v0/mod.rs new file mode 100644 index 00000000000..9997184f5fa --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query/v0/mod.rs @@ -0,0 +1,33 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::query_result_type::{QueryResultElements, QueryResultType}; +use grovedb::{PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB path query. + /// Pushes the cost to `drive_operations` and returns the return value. + pub(crate) fn grove_get_path_query_v0( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + result_type: QueryResultType, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(QueryResultElements, u16), Error> { + let CostContext { value, cost } = self.grove.query( + path_query, + transaction.is_some(), + true, + false, + result_type, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_or_sum_results/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_or_sum_results/mod.rs new file mode 100644 index 00000000000..b728098a960 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_or_sum_results/mod.rs @@ -0,0 +1,50 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::operations::QueryItemOrSumReturnType; +use grovedb::PathQuery; +use grovedb::TransactionArg; + +impl Drive { + /// Retrieves the serialized or sum results of a path query from GroveDB. + /// + /// # Parameters + /// * `path_query`: The path query to execute. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok((Vec>, u16))` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. + pub fn grove_get_path_query_serialized_or_sum_results( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(Vec, u16), Error> { + match drive_version + .grove_methods + .basic + .grove_get_path_query_serialized_or_sum_results + { + 0 => self.grove_get_path_query_serialized_or_sum_results_v0( + path_query, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_path_query_serialized_or_sum_results".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_or_sum_results/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_or_sum_results/v0/mod.rs new file mode 100644 index 00000000000..18753f813b3 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_or_sum_results/v0/mod.rs @@ -0,0 +1,31 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::operations::QueryItemOrSumReturnType; +use grovedb::{PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB path query. + /// Pushes the cost to `drive_operations` and returns the return value. + pub(crate) fn grove_get_path_query_serialized_or_sum_results_v0( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(Vec, u16), Error> { + let CostContext { value, cost } = self.grove.query_item_value_or_sum( + path_query, + transaction.is_some(), + true, + true, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_results/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_results/mod.rs new file mode 100644 index 00000000000..c552903ddaf --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_results/mod.rs @@ -0,0 +1,49 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::PathQuery; +use grovedb::TransactionArg; + +impl Drive { + /// Retrieves the serialized results of a path query from GroveDB. + /// + /// # Parameters + /// * `path_query`: The path query to execute. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok((Vec>, u16))` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. + pub fn grove_get_path_query_serialized_results( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(Vec>, u16), Error> { + match drive_version + .grove_methods + .basic + .grove_get_path_query_serialized_results + { + 0 => self.grove_get_path_query_serialized_results_v0( + path_query, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_path_query_serialized_results".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_results/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_results/v0/mod.rs new file mode 100644 index 00000000000..584f36d4d63 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_serialized_results/v0/mod.rs @@ -0,0 +1,30 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::{PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB path query. + /// Pushes the cost to `drive_operations` and returns the return value. + pub(crate) fn grove_get_path_query_serialized_results_v0( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(Vec>, u16), Error> { + let CostContext { value, cost } = self.grove.query_item_value( + path_query, + transaction.is_some(), + true, + true, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query_with_optional/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_with_optional/mod.rs new file mode 100644 index 00000000000..4490d0a2866 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_with_optional/mod.rs @@ -0,0 +1,50 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::query_result_type::PathKeyOptionalElementTrio; +use grovedb::PathQuery; +use grovedb::TransactionArg; + +impl Drive { + /// Retrieves the results of a path query from GroveDB with optional elements. + /// + /// # Parameters + /// * `path_query`: The path query to execute. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Vec)` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. + pub fn grove_get_path_query_with_optional( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version + .grove_methods + .basic + .grove_get_path_query_with_optional + { + 0 => self.grove_get_path_query_with_optional_v0( + path_query, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_path_query_with_optional".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_path_query_with_optional/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_with_optional/v0/mod.rs new file mode 100644 index 00000000000..bd914b73b8d --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_path_query_with_optional/v0/mod.rs @@ -0,0 +1,31 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::query_result_type::PathKeyOptionalElementTrio; +use grovedb::{PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB path query. + /// Pushes the cost to `drive_operations` and returns the return value. + pub(crate) fn grove_get_path_query_with_optional_v0( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + let CostContext { value, cost } = self.grove.query_keys_optional( + path_query, + true, + true, + true, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query/mod.rs new file mode 100644 index 00000000000..9ab34a4dff1 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query/mod.rs @@ -0,0 +1,52 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::{PathQuery, TransactionArg}; + +impl Drive { + /// Retrieves a proof of the specified path query in groveDB. + /// The operation's cost is then added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path_query`: The groveDB path query to retrieve a proof for. + /// * `verbose`: Specifies whether to include all paths in the proof (when set to `true`) or only those that were + /// affected by changes (when set to `false`). + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Vec)` if the operation was successful, returning the proof data. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_get_proved_path_query( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version + .grove_methods + .basic + .grove_get_proved_path_query + { + 0 => self.grove_get_proved_path_query_v0( + path_query, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_proved_path_query".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query/v0/mod.rs new file mode 100644 index 00000000000..3b9a9614a5f --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query/v0/mod.rs @@ -0,0 +1,30 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::{PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB proved path query. + /// Pushes the cost to `drive_operations` and returns the return value. + /// Verbose should be generally set to false unless one needs to prove + /// subsets of a proof. + pub(crate) fn grove_get_proved_path_query_v0( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + let CostContext { value, cost } = self.grove.get_proved_path_query( + path_query, + None, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query_with_conditional/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query_with_conditional/mod.rs new file mode 100644 index 00000000000..4fd62bffa35 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query_with_conditional/mod.rs @@ -0,0 +1,57 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::{Element, PathQuery, TransactionArg}; +use grovedb_path::SubtreePath; + +impl Drive { + /// Retrieves a proof of the specified path query in groveDB. + /// The operation's cost is then added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path_query`: The groveDB path query to retrieve a proof for. + /// * `verbose`: Specifies whether to include all paths in the proof (when set to `true`) or only those that were + /// affected by changes (when set to `false`). + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Vec)` if the operation was successful, returning the proof data. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_get_proved_path_query_with_conditional>( + &self, + root_path: SubtreePath<'_, B>, + key: &[u8], + path_query_resolver: &impl Fn(Option) -> PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version + .grove_methods + .basic + .grove_get_proved_path_query_with_conditional + { + 0 => self.grove_get_proved_path_query_with_conditional_v0( + root_path, + key, + path_query_resolver, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_proved_path_query_with_conditional".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query_with_conditional/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query_with_conditional/v0/mod.rs new file mode 100644 index 00000000000..3d3d4aad5d2 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_proved_path_query_with_conditional/v0/mod.rs @@ -0,0 +1,40 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::{Element, PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB proved path query. + /// Pushes the cost to `drive_operations` and returns the return value. + /// Verbose should be generally set to false unless one needs to prove + /// subsets of a proof. + pub(crate) fn grove_get_proved_path_query_with_conditional_v0>( + &self, + root_path: SubtreePath, + key: &[u8], + path_query_resolver: &impl Fn(Option) -> PathQuery, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + let CostContext { value, cost } = + self.grove + .get_raw_optional(root_path, key, transaction, &drive_version.grove_version); + drive_operations.push(CalculatedCostOperation(cost)); + let maybe_element = value.map_err(Error::GroveDB)?; + let path_query = path_query_resolver(maybe_element); + + let CostContext { value, cost } = self.grove.get_proved_path_query( + &path_query, + None, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw/mod.rs new file mode 100644 index 00000000000..17b74e3966c --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw/mod.rs @@ -0,0 +1,55 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; + +impl Drive { + /// Handles the retrieval of a raw element from GroveDB at the specified path and key. + /// The operation cost is added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. + /// * `key`: The key of the element to be retrieved from the subtree. + /// * `direct_query_type`: The type of query to perform, whether stateless or stateful. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Some(Element))` if the operation was successful and the element was found. + /// * `Ok(None)` if the operation was successful but the element was not found. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_get_raw>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + direct_query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version.grove_methods.basic.grove_get_raw { + 0 => self.grove_get_raw_v0( + path, + key, + direct_query_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_raw".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw/v0/mod.rs new file mode 100644 index 00000000000..a564abc2730 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw/v0/mod.rs @@ -0,0 +1,66 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::util::grove_operations::{DirectQueryType, QueryTarget}; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{Element, GroveDb, TransactionArg}; +use grovedb_costs::CostContext; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// grove_get_raw basically means that there are no reference hops, this only matters + /// when calculating worst case costs + pub(crate) fn grove_get_raw_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + direct_query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match direct_query_type { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums, + query_target, + } => { + let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); + let key_info = KeyInfo::KnownKey(key.to_vec()); + let cost = match query_target { + QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + GroveDb::average_case_for_get_tree( + &key_info_path, + &key_info, + flags_size, + is_sum_tree, + in_tree_using_sums, + &drive_version.grove_version, + ) + } + QueryTarget::QueryTargetValue(estimated_value_size) => { + GroveDb::average_case_for_get_raw( + &key_info_path, + &key_info, + estimated_value_size, + in_tree_using_sums, + &drive_version.grove_version, + ) + } + }?; + + drive_operations.push(CalculatedCostOperation(cost)); + Ok(None) + } + DirectQueryType::StatefulDirectQuery => { + let CostContext { value, cost } = + self.grove + .get_raw(path, key, transaction, &drive_version.grove_version); + drive_operations.push(CalculatedCostOperation(cost)); + Ok(Some(value.map_err(Error::GroveDB)?)) + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/mod.rs new file mode 100644 index 00000000000..aa441c739b2 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/mod.rs @@ -0,0 +1,57 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; + +impl Drive { + /// Handles the retrieval of a raw element from GroveDB at the specified path and key, + /// if it exists, without causing an error if the element is not found. + /// + /// The operation cost is added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. + /// * `key`: The key of the element to be retrieved from the subtree. + /// * `direct_query_type`: The type of query to perform, whether stateless or stateful. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Some(Element))` if the operation was successful and the element was found. + /// * `Ok(None)` if the operation was successful but the element was not found. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_get_raw_optional>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + direct_query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version.grove_methods.basic.grove_get_raw_optional { + 0 => self.grove_get_raw_optional_v0( + path, + key, + direct_query_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_raw_optional".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs new file mode 100644 index 00000000000..9b9a5be3bbb --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs @@ -0,0 +1,69 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::util::grove_operations::{DirectQueryType, QueryTarget}; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{Element, GroveDb, TransactionArg}; +use grovedb_costs::CostContext; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// grove_get_raw basically means that there are no reference hops, this only matters + /// when calculating worst case costs + pub(crate) fn grove_get_raw_optional_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + direct_query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match direct_query_type { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums, + query_target, + } => { + let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); + let key_info = KeyInfo::KnownKey(key.to_vec()); + let cost = match query_target { + QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + GroveDb::average_case_for_get_tree( + &key_info_path, + &key_info, + flags_size, + is_sum_tree, + in_tree_using_sums, + &drive_version.grove_version, + ) + } + QueryTarget::QueryTargetValue(estimated_value_size) => { + GroveDb::average_case_for_get_raw( + &key_info_path, + &key_info, + estimated_value_size, + in_tree_using_sums, + &drive_version.grove_version, + ) + } + }?; + + drive_operations.push(CalculatedCostOperation(cost)); + Ok(None) + } + DirectQueryType::StatefulDirectQuery => { + let CostContext { value, cost } = self.grove.get_raw_optional( + path, + key, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + Ok(value.map_err(Error::GroveDB)?) + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query/mod.rs new file mode 100644 index 00000000000..39c1927c236 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query/mod.rs @@ -0,0 +1,49 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; + +use grovedb::query_result_type::{QueryResultElements, QueryResultType}; +use grovedb::{PathQuery, TransactionArg}; + +impl Drive { + /// Retrieves the raw results of a path query from GroveDB. + /// + /// # Parameters + /// * `path_query`: The path query to execute. + /// * `transaction`: The GroveDB transaction associated with this operation. + /// * `result_type`: The desired result type of the query. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok((QueryResultElements, u16))` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. + pub fn grove_get_raw_path_query( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + result_type: QueryResultType, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(QueryResultElements, u16), Error> { + match drive_version.grove_methods.basic.grove_get_raw_path_query { + 0 => self.grove_get_raw_path_query_v0( + path_query, + transaction, + result_type, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_raw_path_query".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query/v0/mod.rs new file mode 100644 index 00000000000..eebeb4b5241 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query/v0/mod.rs @@ -0,0 +1,33 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::query_result_type::{QueryResultElements, QueryResultType}; +use grovedb::{PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB raw path query. + /// Pushes the cost to `drive_operations` and returns the return value. + pub(crate) fn grove_get_raw_path_query_v0( + &self, + path_query: &PathQuery, + transaction: TransactionArg, + result_type: QueryResultType, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(QueryResultElements, u16), Error> { + let CostContext { value, cost } = self.grove.query_raw( + path_query, + transaction.is_some(), + true, + true, + result_type, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query_with_optional/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query_with_optional/mod.rs new file mode 100644 index 00000000000..fe0689a7e6b --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query_with_optional/mod.rs @@ -0,0 +1,51 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::query_result_type::PathKeyOptionalElementTrio; +use grovedb::{PathQuery, TransactionArg}; + +impl Drive { + /// Retrieves the raw results of a path query from GroveDB with optional elements. + /// + /// # Parameters + /// * `path_query`: The path query to execute. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Vec)` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::GroveDB)` if the GroveDB operation returned an error. + pub fn grove_get_raw_path_query_with_optional( + &self, + path_query: &PathQuery, + error_if_intermediate_path_tree_not_present: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version + .grove_methods + .basic + .grove_get_raw_path_query_with_optional + { + 0 => self.grove_get_raw_path_query_with_optional_v0( + path_query, + error_if_intermediate_path_tree_not_present, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_raw_path_query_with_optional".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query_with_optional/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query_with_optional/v0/mod.rs new file mode 100644 index 00000000000..add7c65d917 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_path_query_with_optional/v0/mod.rs @@ -0,0 +1,32 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use grovedb::query_result_type::PathKeyOptionalElementTrio; +use grovedb::{PathQuery, TransactionArg}; +use grovedb_costs::CostContext; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB path query. + /// Pushes the cost to `drive_operations` and returns the return value. + pub(crate) fn grove_get_raw_path_query_with_optional_v0( + &self, + path_query: &PathQuery, + error_if_intermediate_path_tree_not_present: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + let CostContext { value, cost } = self.grove.query_raw_keys_optional( + path_query, + true, + true, + error_if_intermediate_path_tree_not_present, + transaction, + &drive_version.grove_version, + ); + drive_operations.push(CalculatedCostOperation(cost)); + value.map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/mod.rs new file mode 100644 index 00000000000..4afcc024a09 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/mod.rs @@ -0,0 +1,59 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; + +use grovedb_path::SubtreePath; + +impl Drive { + /// Retrieves a u64 value from GroveDB that was originally encoded as a varint. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path from where the element is to be retrieved. + /// * `key`: The key of the element to be retrieved from the subtree. + /// * `direct_query_type`: The type of query to perform, whether stateless or stateful. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(Some(u64))` if the operation was successful and the element was found and could be decoded to a u64. + /// * `Ok(None)` if the operation was successful but the element was not found. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::CorruptedElementType)` if the element was found but could not be decoded to a u64. + /// * `Err(DriveError::CorruptedQueryReturnedNonItem)` if the query returned an unexpected non-item element. + pub fn grove_get_raw_value_u64_from_encoded_var_vec>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + direct_query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + match drive_version + .grove_methods + .basic + .grove_get_raw_value_u64_from_encoded_var_vec + { + 0 => self.grove_get_raw_value_u64_from_encoded_var_vec_v0( + path, + key, + direct_query_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_raw_value_u64_from_encoded_var_vec".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/v0/mod.rs new file mode 100644 index 00000000000..368a7d29330 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_value_u64_from_encoded_var_vec/v0/mod.rs @@ -0,0 +1,44 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use dpp::version::drive_versions::DriveVersion; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; +use integer_encoding::VarInt; + +impl Drive { + /// grove_get_direct_u64 is a helper function to get a + pub(crate) fn grove_get_raw_value_u64_from_encoded_var_vec_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + direct_query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result, Error> { + let element = self.grove_get_raw_optional( + path, + key, + direct_query_type, + transaction, + drive_operations, + drive_version, + )?; + element + .map(|element| match element { + Element::Item(value, ..) => u64::decode_var(value.as_slice()) + .ok_or(Error::Drive(DriveError::CorruptedElementType( + "encoded value could not be decoded", + ))) + .map(|(value, _)| value), + Element::SumItem(value, ..) => Ok(value as u64), + _ => Err(Error::Drive(DriveError::CorruptedQueryReturnedNonItem( + "expected an item", + ))), + }) + .transpose() + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/mod.rs new file mode 100644 index 00000000000..e4b06913dff --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/mod.rs @@ -0,0 +1,58 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use dpp::version::drive_versions::DriveVersion; +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; + +impl Drive { + /// Retrieves the total value from a sum tree within groveDB at the specified path and key. + /// The cost of the operation is then appended to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the sum tree is located. + /// * `key`: The key where the sum tree resides within the subtree. + /// * `query_type`: The type of query to perform, either `StatelessDirectQuery` or `StatefulDirectQuery`. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(i64)` if the operation was successful, returning the total value of the sum tree. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + /// * `Err(DriveError::CorruptedBalancePath)` if the balance path does not refer to a sum tree. + /// * `Err(DriveError::CorruptedCodeExecution)` if trying to query a non-tree element. + pub fn grove_get_sum_tree_total_value>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match drive_version + .grove_methods + .basic + .grove_get_sum_tree_total_value + { + 0 => self.grove_get_sum_tree_total_value_v0( + path, + key, + query_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_get_sum_tree_total_value".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs new file mode 100644 index 00000000000..a2a27c7c641 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs @@ -0,0 +1,67 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::util::grove_operations::{DirectQueryType, QueryTarget}; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{Element, GroveDb, TransactionArg}; +use grovedb_costs::CostContext; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the element at the given path from groveDB. + /// Pushes the `OperationCost` of getting the element to `drive_operations`. + pub(crate) fn grove_get_sum_tree_total_value_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match query_type { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums, + query_target, + } => { + let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); + let key_info = KeyInfo::KnownKey(key.to_vec()); + let cost = match query_target { + QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + Ok(GroveDb::average_case_for_get_tree( + &key_info_path, + &key_info, + flags_size, + is_sum_tree, + in_tree_using_sums, + &drive_version.grove_version, + )?) + } + _ => Err(Error::Drive(DriveError::CorruptedCodeExecution( + "can not query a non tree", + ))), + }?; + + drive_operations.push(CalculatedCostOperation(cost)); + Ok(0) + } + DirectQueryType::StatefulDirectQuery => { + let CostContext { value, cost } = + self.grove + .get_raw(path, key, transaction, &drive_version.grove_version); + drive_operations.push(CalculatedCostOperation(cost)); + let element = value.map_err(Error::GroveDB)?; + match element { + Element::SumTree(_, value, _) => Ok(value), + _ => Err(Error::Drive(DriveError::CorruptedBalancePath( + "balance path does not refer to a sum tree", + ))), + } + } + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_has_raw/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_has_raw/mod.rs new file mode 100644 index 00000000000..4f8f5bf6abd --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_has_raw/mod.rs @@ -0,0 +1,54 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; + +use dpp::version::drive_versions::DriveVersion; + +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; + +impl Drive { + /// Checks whether an element exists in groveDB at the specified path and key. + /// The operation's cost is then appended to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the element resides. + /// * `key`: The key where the element resides within the subtree. + /// * `query_type`: The type of query to perform, either `StatelessDirectQuery` or `StatefulDirectQuery`. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(bool)` if the operation was successful, returning `true` if the element exists and `false` otherwise. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_has_raw>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + match drive_version.grove_methods.basic.grove_has_raw { + 0 => self.grove_has_raw_v0( + path, + key, + query_type, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_has_raw".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_has_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_has_raw/v0/mod.rs new file mode 100644 index 00000000000..52b3eaaa969 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_has_raw/v0/mod.rs @@ -0,0 +1,80 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; +use crate::query::GroveError; +use crate::util::grove_operations::{DirectQueryType, QueryTarget}; +use grovedb::batch::key_info::KeyInfo; +use grovedb::batch::KeyInfoPath; +use grovedb::{GroveDb, TransactionArg}; +use grovedb_costs::CostContext; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Gets the return value and the cost of a groveDB `has_raw` operation. + /// Pushes the cost to `drive_operations` and returns the return value. + pub(crate) fn grove_has_raw_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + query_type: DirectQueryType, + transaction: TransactionArg, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result { + let CostContext { value, cost } = match query_type { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums, + query_target, + } => { + let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); + let key_info = KeyInfo::KnownKey(key.to_vec()); + let cost = match query_target { + QueryTarget::QueryTargetTree(flags_len, is_sum_tree) => { + GroveDb::average_case_for_has_raw_tree( + &key_info_path, + &key_info, + flags_len, + is_sum_tree, + in_tree_using_sums, + &drive_version.grove_version, + )? + } + QueryTarget::QueryTargetValue(estimated_value_size) => { + GroveDb::average_case_for_has_raw( + &key_info_path, + &key_info, + estimated_value_size, + in_tree_using_sums, + &drive_version.grove_version, + )? + } + }; + + CostContext { + value: Ok(false), + cost, + } + } + DirectQueryType::StatefulDirectQuery => { + if self.config.has_raw_enabled { + self.grove + .has_raw(path, key, transaction, &drive_version.grove_version) + } else { + self.grove + .get_raw(path, key, transaction, &drive_version.grove_version) + .map(|r| match r { + Err(GroveError::PathKeyNotFound(_)) + | Err(GroveError::PathNotFound(_)) + | Err(GroveError::PathParentLayerNotFound(_)) => Ok(false), + Err(e) => Err(e), + Ok(_) => Ok(true), + }) + } + } + }; + drive_operations.push(CalculatedCostOperation(cost)); + Ok(value?) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert/mod.rs new file mode 100644 index 00000000000..0d9f8f7a7ee --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert/mod.rs @@ -0,0 +1,55 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::operations::insert::InsertOptions; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; + +impl Drive { + /// Inserts an element into groveDB at the specified path and key. + /// The operation's cost is then added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. + /// * `key`: The key where the new element should be inserted in the subtree. + /// * `element`: The element to be inserted. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `options`: Optional insert options to further configure the operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_insert>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + element: Element, + transaction: TransactionArg, + options: Option, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.basic.grove_insert { + 0 => self.grove_insert_v0( + path, + key, + element, + transaction, + options, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_insert".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert/v0/mod.rs new file mode 100644 index 00000000000..f9c81c65c7c --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert/v0/mod.rs @@ -0,0 +1,32 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::push_drive_operation_result; +use grovedb::operations::insert::InsertOptions; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes the `OperationCost` of inserting an element in groveDB to `drive_operations`. + pub(crate) fn grove_insert_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + element: Element, + transaction: TransactionArg, + options: Option, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let cost_context = self.grove.insert( + path, + key, + element, + options, + transaction, + &drive_version.grove_version, + ); + push_drive_operation_result(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert_empty_sum_tree/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_sum_tree/mod.rs new file mode 100644 index 00000000000..db17722d1a8 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_sum_tree/mod.rs @@ -0,0 +1,56 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::operations::insert::InsertOptions; +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; + +impl Drive { + /// Inserts an empty sum tree into groveDB at the specified path and key. + /// The operation's cost is then added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. + /// * `key`: The key where the new element should be inserted in the subtree. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `options`: Optional insert options to further configure the operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_insert_empty_sum_tree>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + transaction: TransactionArg, + options: Option, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .grove_methods + .basic + .grove_insert_empty_sum_tree + { + 0 => self.grove_insert_empty_sum_tree_v0( + path, + key, + transaction, + options, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_insert_empty_sum_tree".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert_empty_sum_tree/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_sum_tree/v0/mod.rs new file mode 100644 index 00000000000..a025023bf33 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_sum_tree/v0/mod.rs @@ -0,0 +1,31 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::push_drive_operation_result; +use grovedb::operations::insert::InsertOptions; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes the `OperationCost` of inserting an empty sum tree in groveDB to `drive_operations`. + pub fn grove_insert_empty_sum_tree_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + transaction: TransactionArg, + options: Option, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let cost_context = self.grove.insert( + path, + key, + Element::empty_sum_tree(), + options, + transaction, + &drive_version.grove_version, + ); + push_drive_operation_result(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert_empty_tree/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_tree/mod.rs new file mode 100644 index 00000000000..95a3fe8e7ba --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_tree/mod.rs @@ -0,0 +1,52 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::operations::insert::InsertOptions; +use grovedb::TransactionArg; +use grovedb_path::SubtreePath; + +impl Drive { + /// Inserts an empty tree into groveDB at the specified path and key. + /// The operation's cost is then added to `drive_operations` for later processing. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. + /// * `key`: The key where the new element should be inserted in the subtree. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `options`: Optional insert options to further configure the operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(())` if the operation was successful. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_insert_empty_tree>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + transaction: TransactionArg, + options: Option, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version.grove_methods.basic.grove_insert_empty_tree { + 0 => self.grove_insert_empty_tree_v0( + path, + key, + transaction, + options, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_insert_empty_tree".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert_empty_tree/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_tree/v0/mod.rs new file mode 100644 index 00000000000..6628036899f --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert_empty_tree/v0/mod.rs @@ -0,0 +1,31 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::push_drive_operation_result; +use grovedb::operations::insert::InsertOptions; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes the `OperationCost` of inserting an empty tree in groveDB to `drive_operations`. + pub(crate) fn grove_insert_empty_tree_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + transaction: TransactionArg, + options: Option, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let cost_context = self.grove.insert( + path, + key, + Element::empty_tree(), + options, + transaction, + &drive_version.grove_version, + ); + push_drive_operation_result(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert_if_not_exists/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert_if_not_exists/mod.rs new file mode 100644 index 00000000000..20152647792 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert_if_not_exists/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; + +impl Drive { + /// Inserts an element into groveDB only if the specified path and key do not exist. + /// This operation costs are then stored in `drive_operations`. + /// + /// # Parameters + /// * `path`: The groveDB hierarchical authenticated structure path where the new element is to be inserted. + /// * `key`: The key where the new element should be inserted in the subtree. + /// * `element`: The element to be inserted. + /// * `transaction`: The groveDB transaction associated with this operation. + /// * `drive_operations`: A vector to collect the costs of operations for later computation. In this case, + /// it collects the cost of this insert operation if the path and key did not exist. + /// * `platform_version`: The platform version to select the correct function version to run. + /// + /// # Returns + /// * `Ok(true)` if the insertion was successful. + /// * `Ok(false)` if the path and key already existed. + /// * `Err(DriveError::UnknownVersionMismatch)` if the platform version does not match known versions. + pub fn grove_insert_if_not_exists>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + element: Element, + transaction: TransactionArg, + drive_operations: Option<&mut Vec>, + drive_version: &DriveVersion, + ) -> Result { + match drive_version.grove_methods.basic.grove_insert_if_not_exists { + 0 => self.grove_insert_if_not_exists_v0( + path, + key, + element, + transaction, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "grove_insert_if_not_exists".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/grove_operations/grove_insert_if_not_exists/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_insert_if_not_exists/v0/mod.rs new file mode 100644 index 00000000000..b03297457cd --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/grove_insert_if_not_exists/v0/mod.rs @@ -0,0 +1,30 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::push_drive_operation_result_optional; +use grovedb::{Element, TransactionArg}; +use grovedb_path::SubtreePath; +use platform_version::version::drive_versions::DriveVersion; + +impl Drive { + /// Pushes the `OperationCost` of inserting an element in groveDB where the path key does not yet exist + /// to `drive_operations`. + pub(crate) fn grove_insert_if_not_exists_v0>( + &self, + path: SubtreePath<'_, B>, + key: &[u8], + element: Element, + transaction: TransactionArg, + drive_operations: Option<&mut Vec>, + drive_version: &DriveVersion, + ) -> Result { + let cost_context = self.grove.insert_if_not_exists( + path, + key, + element, + transaction, + &drive_version.grove_version, + ); + push_drive_operation_result_optional(cost_context, drive_operations) + } +} diff --git a/packages/rs-drive/src/util/grove_operations/mod.rs b/packages/rs-drive/src/util/grove_operations/mod.rs new file mode 100644 index 00000000000..a328aa8efb1 --- /dev/null +++ b/packages/rs-drive/src/util/grove_operations/mod.rs @@ -0,0 +1,456 @@ +//! Grove Operations. +//! +//! Defines and implements in Drive functions pertinent to groveDB operations. +//! + +/// Grove insert operation +pub mod grove_insert; + +/// Grove insert operation into an empty tree +pub mod grove_insert_empty_tree; + +/// Grove insert operation into an empty sum tree +pub mod grove_insert_empty_sum_tree; + +/// Grove insert operation, but only if it doesn't already exist +pub mod grove_insert_if_not_exists; + +/// Grove delete operation +pub mod grove_delete; + +/// Fetch raw grove data +pub mod grove_get_raw; + +/// Fetch raw grove data if it exists +pub mod grove_get_raw_optional; + +/// Fetch u64 value from encoded variable vector in raw grove data +pub mod grove_get_raw_value_u64_from_encoded_var_vec; + +/// Grove get operation +pub mod grove_get; + +/// Serialized results from grove path query +pub mod grove_get_path_query_serialized_results; + +/// Grove path query operation +pub mod grove_get_path_query; + +/// Grove path query operation with optional return value +pub mod grove_get_path_query_with_optional; + +/// Fetch raw data from grove path query with optional return value +pub mod grove_get_raw_path_query_with_optional; + +/// Fetch raw data from grove path query +pub mod grove_get_raw_path_query; + +/// Proved path query in grove +pub mod grove_get_proved_path_query; + +/// Get total value from sum tree in grove +pub mod grove_get_sum_tree_total_value; + +/// Check if raw data exists in grove +pub mod grove_has_raw; + +/// Batch insert operation into empty tree +pub mod batch_insert_empty_tree; + +/// Batch insert operation into empty tree, but only if it doesn't already exist +pub mod batch_insert_empty_tree_if_not_exists; + +/// Batch insert operation into empty tree, but only if it doesn't exist and check existing operations +pub mod batch_insert_empty_tree_if_not_exists_check_existing_operations; + +/// Batch insert operation +pub mod batch_insert; + +/// Batch replace operation +pub mod batch_replace; + +/// Batch insert operation, but only if it doesn't already exist +pub mod batch_insert_if_not_exists; + +/// Batch insert operation, but only if the value has changed +pub mod batch_insert_if_changed_value; + +/// Batch delete operation +pub mod batch_delete; + +/// Batch remove raw data operation +pub mod batch_remove_raw; + +/// Batch delete operation up the tree while it's empty +pub mod batch_delete_up_tree_while_empty; + +/// Batch refresh reference operation +pub mod batch_refresh_reference; + +/// Apply grove operation +pub mod grove_apply_operation; + +/// Apply batch grove operation +pub mod grove_apply_batch; + +/// Apply batch grove operation with additional costs +pub mod grove_apply_batch_with_add_costs; + +/// Apply partial batch grove operation +pub mod grove_apply_partial_batch; + +/// Apply partial batch grove operation with additional costs +pub mod grove_apply_partial_batch_with_add_costs; + +/// Get cost of grove batch operations +pub mod grove_batch_operations_costs; + +/// Clear a subtree in grovedb +pub mod grove_clear; + +mod grove_get_path_query_serialized_or_sum_results; +/// Proved path query in grovedb with a conditional query +pub mod grove_get_proved_path_query_with_conditional; + +use grovedb_costs::CostContext; + +use grovedb::EstimatedLayerInformation; + +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::CalculatedCostOperation; + +use grovedb::Error as GroveError; + +use intmap::IntMap; + +/// Pushes an operation's `OperationCost` to `drive_operations` given its `CostContext` +/// and returns the operation's return value. +fn push_drive_operation_result( + cost_context: CostContext>, + drive_operations: &mut Vec, +) -> Result { + let CostContext { value, cost } = cost_context; + if !cost.is_nothing() { + drive_operations.push(CalculatedCostOperation(cost)); + } + value.map_err(Error::GroveDB) +} + +/// Pushes an operation's `OperationCost` to `drive_operations` given its `CostContext` +/// if `drive_operations` is given. Returns the operation's return value. +fn push_drive_operation_result_optional( + cost_context: CostContext>, + drive_operations: Option<&mut Vec>, +) -> Result { + let CostContext { value, cost } = cost_context; + if let Some(drive_operations) = drive_operations { + drive_operations.push(CalculatedCostOperation(cost)); + } + value.map_err(Error::GroveDB) +} +/// Is subtree? +pub type IsSubTree = bool; +/// Is sum subtree? +pub type IsSumSubTree = bool; +/// Is sum tree? +pub type IsSumTree = bool; + +/// Batch delete apply type +#[derive(Debug, Copy, Clone)] +pub enum BatchDeleteApplyType { + /// Stateless batch delete + StatelessBatchDelete { + /// Are we deleting in a sum tree + is_sum_tree: bool, + /// What is the estimated value size + estimated_key_size: u32, + /// What is the estimated value size + estimated_value_size: u32, + }, + /// Stateful batch delete + StatefulBatchDelete { + /// Are we known to be in a subtree and does this subtree have sums + is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, + }, +} + +#[derive(Clone)] +/// Batch delete up tree apply type +pub enum BatchDeleteUpTreeApplyType { + /// Stateless batch delete + StatelessBatchDelete { + /// The estimated layer info + estimated_layer_info: IntMap, + }, + /// Stateful batch delete + StatefulBatchDelete { + /// Are we known to be in a subtree and does this subtree have sums + is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, + }, +} + +/// batch insert tree apply type +#[derive(Clone, Copy)] +/// Batch insert tree apply type +pub enum BatchInsertTreeApplyType { + /// Stateless batch insert tree + StatelessBatchInsertTree { + /// Does this tree use sums? + in_tree_using_sums: bool, + /// Are we inserting in a sum tree + is_sum_tree: bool, + /// The flags length + flags_len: FlagsLen, + }, + /// Stateful batch insert tree + StatefulBatchInsertTree, +} + +/// Represents the types for batch insert operations in a tree structure. +impl BatchInsertTreeApplyType { + /// Converts the current `BatchInsertTreeApplyType` into a corresponding `DirectQueryType`. + /// + /// # Returns + /// + /// - A variant of `DirectQueryType::StatelessDirectQuery` if the current type is `BatchInsertTreeApplyType::StatelessBatchInsertTree`. + /// - `DirectQueryType::StatefulDirectQuery` if the current type is `BatchInsertTreeApplyType::StatefulBatchInsertTree`. + /// ``` + pub(crate) fn to_direct_query_type(self) -> DirectQueryType { + match self { + BatchInsertTreeApplyType::StatelessBatchInsertTree { + in_tree_using_sums, + is_sum_tree, + flags_len, + } => DirectQueryType::StatelessDirectQuery { + in_tree_using_sums, + query_target: QueryTarget::QueryTargetTree(flags_len, is_sum_tree), + }, + BatchInsertTreeApplyType::StatefulBatchInsertTree => { + DirectQueryType::StatefulDirectQuery + } + } + } +} + +/// Batch insert apply type +pub enum BatchInsertApplyType { + /// Stateless batch insert + StatelessBatchInsert { + /// Does this tree use sums? + in_tree_using_sums: bool, + /// the type of Target (Tree or Value) + target: QueryTarget, + }, + /// Stateful batch insert + StatefulBatchInsert, +} + +impl BatchInsertApplyType { + /// Converts the current `BatchInsertApplyType` into a corresponding `DirectQueryType`. + /// + /// # Returns + /// + /// - A variant of `DirectQueryType::StatelessDirectQuery` if the current type is `BatchInsertApplyType::StatelessBatchInsert`. + /// - `DirectQueryType::StatefulDirectQuery` if the current type is `BatchInsertApplyType::StatefulBatchInsert`. + /// ``` + pub(crate) fn to_direct_query_type(&self) -> DirectQueryType { + match self { + BatchInsertApplyType::StatelessBatchInsert { + in_tree_using_sums, + target, + } => DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: *in_tree_using_sums, + query_target: *target, + }, + BatchInsertApplyType::StatefulBatchInsert => DirectQueryType::StatefulDirectQuery, + } + } +} + +/// Flags length +pub type FlagsLen = u32; + +/// query target +#[derive(Clone, Copy)] +/// Query target +pub enum QueryTarget { + /// tree + QueryTargetTree(FlagsLen, IsSumTree), + /// value + QueryTargetValue(u32), +} + +impl QueryTarget { + /// Length + pub(crate) fn len(&self) -> u32 { + match self { + QueryTarget::QueryTargetTree(flags_len, is_sum_tree) => { + let len = if *is_sum_tree { 11 } else { 3 }; + *flags_len + len + } + QueryTarget::QueryTargetValue(len) => *len, + } + } +} + +/// direct query type +#[derive(Clone, Copy)] +/// Direct query type +pub enum DirectQueryType { + /// Stateless direct query + StatelessDirectQuery { + /// Does this tree use sums? + in_tree_using_sums: bool, + /// the type of Target (Tree or Value) + query_target: QueryTarget, + }, + /// Stateful direct query + StatefulDirectQuery, +} + +impl From for QueryType { + fn from(value: DirectQueryType) -> Self { + match value { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums, + query_target, + } => QueryType::StatelessQuery { + in_tree_using_sums, + query_target, + estimated_reference_sizes: vec![], + }, + DirectQueryType::StatefulDirectQuery => QueryType::StatefulQuery, + } + } +} + +impl DirectQueryType { + /// Converts the current `DirectQueryType` into a corresponding `QueryType` + /// while associating it with the given reference sizes. + /// + /// # Parameters + /// + /// * `reference_sizes`: A vector of `u32` values representing the reference sizes + /// associated with the query. + /// + /// # Returns + /// + /// - A variant of `QueryType::StatelessQuery` with the provided reference sizes if + /// the current type is `DirectQueryType::StatelessDirectQuery`. + /// - `QueryType::StatefulQuery` if the current type is `DirectQueryType::StatefulDirectQuery`. + /// + /// # Example + /// + /// ```ignore + /// let direct_query = DirectQueryType::StatelessDirectQuery { + /// in_tree_using_sums: true, + /// query_target: SomeTarget, // Replace with an actual target instance. + /// }; + /// + /// let ref_sizes = vec![100, 200, 300]; + /// let query_type = direct_query.add_reference_sizes(ref_sizes); + /// ``` + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub(crate) fn add_reference_sizes(self, reference_sizes: Vec) -> QueryType { + match self { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums, + query_target, + } => QueryType::StatelessQuery { + in_tree_using_sums, + query_target, + estimated_reference_sizes: reference_sizes, + }, + DirectQueryType::StatefulDirectQuery => QueryType::StatefulQuery, + } + } +} + +/// Query type +#[derive(Clone)] +pub enum QueryType { + /// Stateless query + StatelessQuery { + /// Does this tree use sums? + in_tree_using_sums: bool, + /// the type of Target (Tree or Value) + query_target: QueryTarget, + /// The estimated sizes of references + estimated_reference_sizes: Vec, + }, + /// Stateful query + StatefulQuery, +} + +impl From for QueryType { + fn from(value: BatchDeleteApplyType) -> Self { + match value { + BatchDeleteApplyType::StatelessBatchDelete { + is_sum_tree, + estimated_value_size, + .. + } => QueryType::StatelessQuery { + in_tree_using_sums: is_sum_tree, + query_target: QueryTarget::QueryTargetValue(estimated_value_size), + estimated_reference_sizes: vec![], + }, + BatchDeleteApplyType::StatefulBatchDelete { .. } => QueryType::StatefulQuery, + } + } +} + +impl From<&BatchDeleteApplyType> for QueryType { + fn from(value: &BatchDeleteApplyType) -> Self { + match value { + BatchDeleteApplyType::StatelessBatchDelete { + is_sum_tree, + estimated_value_size, + .. + } => QueryType::StatelessQuery { + in_tree_using_sums: *is_sum_tree, + query_target: QueryTarget::QueryTargetValue(*estimated_value_size), + estimated_reference_sizes: vec![], + }, + BatchDeleteApplyType::StatefulBatchDelete { .. } => QueryType::StatefulQuery, + } + } +} + +impl From for DirectQueryType { + fn from(value: BatchDeleteApplyType) -> Self { + match value { + BatchDeleteApplyType::StatelessBatchDelete { + is_sum_tree, + estimated_value_size, + .. + } => DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: is_sum_tree, + query_target: QueryTarget::QueryTargetValue(estimated_value_size), + }, + BatchDeleteApplyType::StatefulBatchDelete { .. } => { + DirectQueryType::StatefulDirectQuery + } + } + } +} + +impl From<&BatchDeleteApplyType> for DirectQueryType { + fn from(value: &BatchDeleteApplyType) -> Self { + match value { + BatchDeleteApplyType::StatelessBatchDelete { + is_sum_tree, + estimated_value_size, + .. + } => DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: *is_sum_tree, + query_target: QueryTarget::QueryTargetValue(*estimated_value_size), + }, + BatchDeleteApplyType::StatefulBatchDelete { .. } => { + DirectQueryType::StatefulDirectQuery + } + } + } +} diff --git a/packages/rs-drive/src/util/mod.rs b/packages/rs-drive/src/util/mod.rs new file mode 100644 index 00000000000..bbf86f059e9 --- /dev/null +++ b/packages/rs-drive/src/util/mod.rs @@ -0,0 +1,22 @@ +/// Batch module +#[cfg(feature = "server")] +pub mod batch; +/// Low level GroveDB operations +#[cfg(feature = "server")] +pub mod grove_operations; +/// Structures used by drive +#[cfg(any(feature = "server", feature = "verify"))] +pub mod object_size_info; + +/// Common +#[cfg(any(feature = "server", feature = "verify"))] +pub mod common; +#[cfg(feature = "server")] +mod operations; +#[cfg(any(feature = "server", feature = "verify"))] +pub mod storage_flags; +/// Test helpers +#[cfg(any(test, feature = "server", feature = "fixtures-and-mocks"))] +pub mod test_helpers; +#[cfg(any(feature = "server", feature = "verify"))] +pub(crate) mod type_constants; diff --git a/packages/rs-drive/src/util/object_size_info/contract_info.rs b/packages/rs-drive/src/util/object_size_info/contract_info.rs new file mode 100644 index 00000000000..d5bde596fae --- /dev/null +++ b/packages/rs-drive/src/util/object_size_info/contract_info.rs @@ -0,0 +1,228 @@ +#[cfg(feature = "server")] +use crate::drive::contract::DataContractFetchInfo; +use crate::drive::Drive; +use crate::error::document::DocumentError; +use crate::error::Error; +#[cfg(feature = "server")] +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; +use dpp::identifier::Identifier; +use dpp::ProtocolError; +#[cfg(feature = "server")] +use grovedb::TransactionArg; +use platform_version::version::PlatformVersion; +use std::sync::Arc; + +/// Represents various forms of accessing or representing a data contract. +/// This enum is used to handle different scenarios in which data contracts +/// might be needed, providing a unified interface to access their data. +#[derive(Clone, Debug)] +pub enum DataContractInfo<'a> { + /// A unique identifier for a data contract. This variant is typically used + /// when only the identity of the data contract is required without needing + /// to access the full contract itself. + DataContractId(Identifier), + + #[cfg(feature = "server")] + /// Information necessary for fetching a data contract, encapsulated in an + /// `Arc` for thread-safe shared ownership. This variant is used when the + /// data needs to be fetched or is not immediately available. + DataContractFetchInfo(Arc), + + /// A borrowed reference to a data contract. This variant is used for temporary, + /// read-only access to a data contract, avoiding ownership transfer. + BorrowedDataContract(&'a DataContract), + + /// An owned version of a data contract. This variant is used when full ownership + /// and possibly mutability of the data contract is necessary. + OwnedDataContract(DataContract), +} + +impl<'a> DataContractInfo<'a> { + #[cfg(feature = "server")] + /// Resolve the data contract info into an object that contains the data contract + pub(crate) fn resolve( + self, + drive: &Drive, + block_info: &BlockInfo, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + DataContractInfo::DataContractId(contract_id) => { + let contract_fetch_info = drive + .get_contract_with_fetch_info_and_add_to_operations( + contract_id.into_buffer(), + Some(&block_info.epoch), + true, + transaction, + drive_operations, + platform_version, + )? + .ok_or(Error::Document(DocumentError::DataContractNotFound))?; + Ok(DataContractResolvedInfo::ArcDataContractFetchInfo( + contract_fetch_info, + )) + } + DataContractInfo::DataContractFetchInfo(contract_fetch_info) => Ok( + DataContractResolvedInfo::ArcDataContractFetchInfo(contract_fetch_info), + ), + DataContractInfo::BorrowedDataContract(contract) => { + Ok(DataContractResolvedInfo::BorrowedDataContract(contract)) + } + DataContractInfo::OwnedDataContract(contract) => { + Ok(DataContractResolvedInfo::OwnedDataContract(contract)) + } + } + } +} + +/// Contains resolved data contract information, typically used after initial +/// fetching or retrieval steps have been completed. This enum simplifies handling +/// of data contract states post-retrieval. +#[derive(Clone, Debug, PartialEq)] +pub enum DataContractOwnedResolvedInfo { + #[cfg(feature = "server")] + /// Information necessary for fetched data contracts, encapsulated in an + /// `Arc` to ensure thread-safe shared ownership and access. + DataContractFetchInfo(Arc), + + /// An owned instance of a data contract. This variant provides full control + /// and mutability over the data contract, suitable for scenarios requiring + /// modifications or extended operations on the data contract. + OwnedDataContract(DataContract), +} + +impl DataContractOwnedResolvedInfo { + /// The id of the contract + pub fn id(&self) -> Identifier { + match self { + #[cfg(feature = "server")] + DataContractOwnedResolvedInfo::DataContractFetchInfo(fetch_info) => { + fetch_info.contract.id() + } + DataContractOwnedResolvedInfo::OwnedDataContract(data_contract) => data_contract.id(), + } + } +} +impl AsRef for DataContractOwnedResolvedInfo { + /// The ref of the contract + fn as_ref(&self) -> &DataContract { + match self { + #[cfg(feature = "server")] + DataContractOwnedResolvedInfo::DataContractFetchInfo(fetch_info) => { + &fetch_info.contract + } + DataContractOwnedResolvedInfo::OwnedDataContract(owned) => owned, + } + } +} + +impl DataContractOwnedResolvedInfo { + /// Get the contract as owned + pub fn into_owned(self) -> DataContract { + match self { + #[cfg(feature = "server")] + DataContractOwnedResolvedInfo::DataContractFetchInfo(fetch_info) => { + fetch_info.contract.clone() + } + DataContractOwnedResolvedInfo::OwnedDataContract(owned) => owned, + } + } +} + +/// Contains resolved data contract information, typically used after initial +/// fetching or retrieval steps have been completed. This enum simplifies handling +/// of data contract states post-retrieval. +#[derive(Clone, Debug, PartialEq)] +pub enum DataContractResolvedInfo<'a> { + #[cfg(feature = "server")] + /// Information necessary for fetched data contracts, encapsulated in an + /// `Arc` to ensure thread-safe shared ownership and access. + ArcDataContractFetchInfo(Arc), + + /// Arc Data contract + ArcDataContract(Arc), + + /// A borrowed reference to a resolved data contract. This variant is suitable + /// for scenarios where temporary, read-only access to a data contract is required. + BorrowedDataContract(&'a DataContract), + + /// An owned instance of a data contract. This variant provides full control + /// and mutability over the data contract, suitable for scenarios requiring + /// modifications or extended operations on the data contract. + OwnedDataContract(DataContract), +} + +impl<'a> From<&'a DataContractOwnedResolvedInfo> for DataContractResolvedInfo<'a> { + fn from(value: &'a DataContractOwnedResolvedInfo) -> Self { + match value { + #[cfg(feature = "server")] + DataContractOwnedResolvedInfo::DataContractFetchInfo(fetch_info) => { + DataContractResolvedInfo::ArcDataContractFetchInfo(fetch_info.clone()) + } + DataContractOwnedResolvedInfo::OwnedDataContract(data_contract) => { + DataContractResolvedInfo::BorrowedDataContract(data_contract) + } + } + } +} + +impl<'a> DataContractResolvedInfo<'a> { + /// The id of the contract + pub fn id(&self) -> Identifier { + match self { + #[cfg(feature = "server")] + DataContractResolvedInfo::ArcDataContractFetchInfo(fetch_info) => { + fetch_info.contract.id() + } + DataContractResolvedInfo::BorrowedDataContract(data_contract) => data_contract.id(), + DataContractResolvedInfo::OwnedDataContract(data_contract) => data_contract.id(), + DataContractResolvedInfo::ArcDataContract(data_contract) => data_contract.id(), + } + } +} +impl<'a> AsRef for DataContractResolvedInfo<'a> { + /// The ref of the contract + fn as_ref(&self) -> &DataContract { + match self { + #[cfg(feature = "server")] + DataContractResolvedInfo::ArcDataContractFetchInfo(fetch_info) => &fetch_info.contract, + DataContractResolvedInfo::BorrowedDataContract(borrowed) => borrowed, + DataContractResolvedInfo::OwnedDataContract(owned) => owned, + DataContractResolvedInfo::ArcDataContract(data_contract) => data_contract.as_ref(), + } + } +} + +/// Enumerates methods for identifying or referencing document types, accommodating various application needs. +#[derive(Clone, Debug)] +pub enum DocumentTypeInfo<'a> { + /// Contains the document type name as an owned `String`, suitable for dynamic or mutable scenarios. + DocumentTypeName(String), + + /// References the document type name via a borrowed `&'a str`, ideal for static or temporary usage. + DocumentTypeNameAsStr(&'a str), + + /// References a document type that has already been resolved through `DocumentTypeRef`. + DocumentTypeRef(DocumentTypeRef<'a>), +} + +impl<'a> DocumentTypeInfo<'a> { + /// Resolve the data contract info into an object that contains the data contract + pub fn resolve(self, contract: &'a DataContract) -> Result, ProtocolError> { + match self { + DocumentTypeInfo::DocumentTypeName(document_type_name) => contract + .document_type_for_name(document_type_name.as_str()) + .map_err(ProtocolError::DataContractError), + DocumentTypeInfo::DocumentTypeNameAsStr(document_type_name) => contract + .document_type_for_name(document_type_name) + .map_err(ProtocolError::DataContractError), + DocumentTypeInfo::DocumentTypeRef(document_type_ref) => Ok(document_type_ref), + } + } +} diff --git a/packages/rs-drive/src/drive/object_size_info/document_and_contract_info.rs b/packages/rs-drive/src/util/object_size_info/document_and_contract_info.rs similarity index 87% rename from packages/rs-drive/src/drive/object_size_info/document_and_contract_info.rs rename to packages/rs-drive/src/util/object_size_info/document_and_contract_info.rs index cee140732b7..bc022211068 100644 --- a/packages/rs-drive/src/drive/object_size_info/document_and_contract_info.rs +++ b/packages/rs-drive/src/util/object_size_info/document_and_contract_info.rs @@ -1,4 +1,4 @@ -use crate::drive::object_size_info::OwnedDocumentInfo; +use crate::util::object_size_info::OwnedDocumentInfo; use dpp::data_contract::document_type::DocumentTypeRef; use dpp::data_contract::DataContract; diff --git a/packages/rs-drive/src/drive/object_size_info/document_info.rs b/packages/rs-drive/src/util/object_size_info/document_info.rs similarity index 82% rename from packages/rs-drive/src/drive/object_size_info/document_info.rs rename to packages/rs-drive/src/util/object_size_info/document_info.rs index 6e7eb209b2e..e2ad23c4f5a 100644 --- a/packages/rs-drive/src/drive/object_size_info/document_info.rs +++ b/packages/rs-drive/src/util/object_size_info/document_info.rs @@ -1,13 +1,14 @@ -use crate::drive::defaults::{ - DEFAULT_FLOAT_SIZE, DEFAULT_FLOAT_SIZE_U16, DEFAULT_HASH_SIZE_U16, DEFAULT_HASH_SIZE_U8, -}; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DriveKeyInfo::{Key, KeySize}; -use crate::drive::object_size_info::KeyValueInfo::{KeyRefRequest, KeyValueMaxSize}; -use crate::drive::object_size_info::{DriveKeyInfo, KeyValueInfo}; use crate::error::drive::DriveError; use crate::error::fee::FeeError; use crate::error::Error; +use crate::util::object_size_info::DriveKeyInfo::{Key, KeySize}; +use crate::util::object_size_info::KeyValueInfo::{KeyRefRequest, KeyValueMaxSize}; +use crate::util::object_size_info::{DriveKeyInfo, KeyValueInfo}; +use crate::util::storage_flags::StorageFlags; +use crate::util::type_constants::{ + DEFAULT_HASH_SIZE_U16, DEFAULT_HASH_SIZE_U8, U32_SIZE_U16, U32_SIZE_U8, U64_SIZE_U16, + U64_SIZE_U8, +}; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::data_contract::document_type::{DocumentTypeRef, IndexLevel}; @@ -113,12 +114,19 @@ impl<'a> DocumentInfoV0Methods for DocumentInfo<'a> { ) -> Result { match key_path { "$ownerId" | "$id" => Ok(DEFAULT_HASH_SIZE_U16), - "$createdAt" | "$updatedAt" => Ok(DEFAULT_FLOAT_SIZE_U16), - _ => { + "$createdAt" | "$updatedAt" | "$transferredAt" => Ok(U64_SIZE_U16), + "$createdAtBlockHeight" | "$updatedAtBlockHeight" | "$transferredAtBlockHeight" => { + Ok(U64_SIZE_U16) + } + "$createdAtCoreBlockHeight" + | "$updatedAtCoreBlockHeight" + | "$transferredAtCoreBlockHeight" => Ok(U32_SIZE_U16), + key_path => { let property = document_type.flattened_properties().get(key_path).ok_or({ - Error::Fee(FeeError::DocumentTypeFieldNotFoundForEstimation( - "incorrect key path for document type for estimated sizes", - )) + Error::Fee(FeeError::DocumentTypeFieldNotFoundForEstimation(format!( + "incorrect key path [{}] for document type for estimated sizes", + key_path + ))) })?; let estimated_size = property.property_type.middle_byte_size_ceil().ok_or({ Error::Drive(DriveError::CorruptedCodeExecution( @@ -177,17 +185,35 @@ impl<'a> DocumentInfoV0Methods for DocumentInfo<'a> { .to_vec(), max_size: DEFAULT_HASH_SIZE_U8, }))), - "$createdAt" | "$updatedAt" => Ok(Some(KeySize(KeyInfo::MaxKeySize { + "$createdAt" | "$updatedAt" | "$transferredAt" => { + Ok(Some(KeySize(KeyInfo::MaxKeySize { + unique_id: document_type + .unique_id_for_document_field(index_level, base_event) + .to_vec(), + max_size: U64_SIZE_U8, + }))) + } + "$createdAtBlockHeight" + | "$updatedAtBlockHeight" + | "$transferredAtBlockHeight" => Ok(Some(KeySize(KeyInfo::MaxKeySize { + unique_id: document_type + .unique_id_for_document_field(index_level, base_event) + .to_vec(), + max_size: U64_SIZE_U8, + }))), + "$createdAtCoreBlockHeight" + | "$updatedAtCoreBlockHeight" + | "$transferredAtCoreBlockHeight" => Ok(Some(KeySize(KeyInfo::MaxKeySize { unique_id: document_type .unique_id_for_document_field(index_level, base_event) .to_vec(), - max_size: DEFAULT_FLOAT_SIZE as u8, + max_size: U32_SIZE_U8, }))), - _ => { + key_path => { let property = document_type.flattened_properties().get(key_path).ok_or({ Error::Fee(FeeError::DocumentTypeFieldNotFoundForEstimation( - "incorrect key path for document type", + format!("incorrect key path [{}] for document type for get_raw_for_document_type", key_path) )) })?; diff --git a/packages/rs-drive/src/drive/object_size_info/drive_key_info.rs b/packages/rs-drive/src/util/object_size_info/drive_key_info.rs similarity index 80% rename from packages/rs-drive/src/drive/object_size_info/drive_key_info.rs rename to packages/rs-drive/src/util/object_size_info/drive_key_info.rs index 82fa24f7f75..17ea6c08c99 100644 --- a/packages/rs-drive/src/drive/object_size_info/drive_key_info.rs +++ b/packages/rs-drive/src/util/object_size_info/drive_key_info.rs @@ -1,11 +1,9 @@ -use crate::drive::object_size_info::path_key_info::PathKeyInfo; -use crate::drive::object_size_info::path_key_info::PathKeyInfo::{ +use crate::util::object_size_info::path_key_info::PathKeyInfo; +use crate::util::object_size_info::path_key_info::PathKeyInfo::{ PathFixedSizeKey, PathFixedSizeKeyRef, PathKey, PathKeyRef, PathKeySize, }; -use crate::drive::object_size_info::PathInfo; -use crate::drive::object_size_info::PathInfo::{ - PathFixedSizeIterator, PathIterator, PathWithSizes, -}; +use crate::util::object_size_info::PathInfo; +use crate::util::object_size_info::PathInfo::{PathAsVec, PathFixedSizeArray, PathWithSizes}; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::key_info::KeyInfo::KnownKey; use grovedb::batch::KeyInfoPath; @@ -52,24 +50,22 @@ impl<'a> DriveKeyInfo<'a> { pub fn add_path_info(self, path_info: PathInfo<'a, N>) -> PathKeyInfo<'a, N> { match self { Key(key) => match path_info { - PathFixedSizeIterator(iter) => PathFixedSizeKey((iter, key)), - PathIterator(iter) => PathKey((iter, key)), + PathFixedSizeArray(iter) => PathFixedSizeKey((iter, key)), + PathAsVec(iter) => PathKey((iter, key)), PathWithSizes(key_info_path) => PathKeySize(key_info_path, KnownKey(key)), }, KeyRef(key_ref) => match path_info { - PathFixedSizeIterator(iter) => PathFixedSizeKeyRef((iter, key_ref)), - PathIterator(iter) => PathKeyRef((iter, key_ref)), + PathFixedSizeArray(iter) => PathFixedSizeKeyRef((iter, key_ref)), + PathAsVec(iter) => PathKeyRef((iter, key_ref)), PathWithSizes(key_info_path) => { PathKeySize(key_info_path, KnownKey(key_ref.to_vec())) } }, KeySize(key_info) => match path_info { - PathFixedSizeIterator(iter) => { + PathFixedSizeArray(iter) => { PathKeySize(KeyInfoPath::from_known_path(iter), key_info) } - PathIterator(iter) => { - PathKeySize(KeyInfoPath::from_known_owned_path(iter), key_info) - } + PathAsVec(iter) => PathKeySize(KeyInfoPath::from_known_owned_path(iter), key_info), PathWithSizes(key_info_path) => PathKeySize(key_info_path, key_info), }, } diff --git a/packages/rs-drive/src/drive/object_size_info/element_info.rs b/packages/rs-drive/src/util/object_size_info/element_info.rs similarity index 100% rename from packages/rs-drive/src/drive/object_size_info/element_info.rs rename to packages/rs-drive/src/util/object_size_info/element_info.rs diff --git a/packages/rs-drive/src/drive/object_size_info/key_element_info.rs b/packages/rs-drive/src/util/object_size_info/key_element_info.rs similarity index 100% rename from packages/rs-drive/src/drive/object_size_info/key_element_info.rs rename to packages/rs-drive/src/util/object_size_info/key_element_info.rs diff --git a/packages/rs-drive/src/drive/object_size_info/key_value_info.rs b/packages/rs-drive/src/util/object_size_info/key_value_info.rs similarity index 89% rename from packages/rs-drive/src/drive/object_size_info/key_value_info.rs rename to packages/rs-drive/src/util/object_size_info/key_value_info.rs index f80025eb72c..43dc454588e 100644 --- a/packages/rs-drive/src/drive/object_size_info/key_value_info.rs +++ b/packages/rs-drive/src/util/object_size_info/key_value_info.rs @@ -1,8 +1,6 @@ -use crate::drive::object_size_info::key_value_info::KeyValueInfo::{ - KeyRefRequest, KeyValueMaxSize, -}; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::object_size_info::key_value_info::KeyValueInfo::{KeyRefRequest, KeyValueMaxSize}; /// Key value info #[derive(Clone)] diff --git a/packages/rs-drive/src/util/object_size_info/mod.rs b/packages/rs-drive/src/util/object_size_info/mod.rs new file mode 100644 index 00000000000..045cf7c3579 --- /dev/null +++ b/packages/rs-drive/src/util/object_size_info/mod.rs @@ -0,0 +1,52 @@ +//! Object Size Info +//! +//! This module defines enums and implements functions relevant to the sizes of objects. +//! + +#[cfg(any(feature = "server", feature = "verify"))] +mod contract_info; +#[cfg(feature = "server")] +mod document_and_contract_info; +#[cfg(feature = "server")] +mod document_info; +#[cfg(feature = "server")] +mod drive_key_info; +#[cfg(feature = "server")] +mod element_info; +#[cfg(feature = "server")] +mod key_element_info; +#[cfg(feature = "server")] +mod key_value_info; +#[cfg(feature = "server")] +mod owned_document_info; +#[cfg(feature = "server")] +mod path_info; +#[cfg(feature = "server")] +mod path_key_element_info; +#[cfg(feature = "server")] +mod path_key_info; + +#[cfg(feature = "server")] +pub use contract_info::*; +#[cfg(all(feature = "verify", not(feature = "server")))] +pub use contract_info::{DataContractOwnedResolvedInfo, DataContractResolvedInfo}; +#[cfg(feature = "server")] +pub use document_and_contract_info::*; +#[cfg(feature = "server")] +pub use document_info::*; +#[cfg(feature = "server")] +pub use drive_key_info::*; +#[cfg(feature = "server")] +pub use element_info::*; +#[cfg(feature = "server")] +pub use key_element_info::*; +#[cfg(feature = "server")] +pub use key_value_info::*; +#[cfg(feature = "server")] +pub use owned_document_info::*; +#[cfg(feature = "server")] +pub use path_info::*; +#[cfg(feature = "server")] +pub use path_key_element_info::*; +#[cfg(feature = "server")] +pub use path_key_info::*; diff --git a/packages/rs-drive/src/drive/object_size_info/owned_document_info.rs b/packages/rs-drive/src/util/object_size_info/owned_document_info.rs similarity index 76% rename from packages/rs-drive/src/drive/object_size_info/owned_document_info.rs rename to packages/rs-drive/src/util/object_size_info/owned_document_info.rs index 8e2c61a96a3..4cceb570cbc 100644 --- a/packages/rs-drive/src/drive/object_size_info/owned_document_info.rs +++ b/packages/rs-drive/src/util/object_size_info/owned_document_info.rs @@ -1,4 +1,4 @@ -use crate::drive::object_size_info::document_info::DocumentInfo; +use crate::util::object_size_info::document_info::DocumentInfo; /// Document and contract info #[derive(Clone, Debug)] diff --git a/packages/rs-drive/src/util/object_size_info/path_info.rs b/packages/rs-drive/src/util/object_size_info/path_info.rs new file mode 100644 index 00000000000..221d1006a11 --- /dev/null +++ b/packages/rs-drive/src/util/object_size_info/path_info.rs @@ -0,0 +1,81 @@ +use grovedb::batch::key_info::KeyInfo::KnownKey; +use grovedb::batch::KeyInfoPath; + +use grovedb_storage::worst_case_costs::WorstKeyLength; + +use DriveKeyInfo::{Key, KeyRef, KeySize}; +use PathInfo::{PathAsVec, PathFixedSizeArray, PathWithSizes}; + +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::object_size_info::drive_key_info::DriveKeyInfo; + +/// Info about a path. +#[derive(Clone, Debug)] +pub enum PathInfo<'a, const N: usize> { + /// An into iter Path + PathFixedSizeArray([&'a [u8]; N]), + + /// An into iter Path + PathAsVec(Vec>), + + /// A path size + PathWithSizes(KeyInfoPath), +} + +impl<'a, const N: usize> PathInfo<'a, N> { + /// Returns the length of the path as a usize. + pub fn len(&self) -> u32 { + match self { + PathFixedSizeArray(path_iterator) => { + (*path_iterator).into_iter().map(|a| a.len() as u32).sum() + } + PathAsVec(path_iterator) => path_iterator.iter().map(|a| a.len() as u32).sum(), + PathWithSizes(path_size) => path_size.iterator().map(|a| a.max_length() as u32).sum(), + } + } + + /// Returns true if the path is empty. + pub fn is_empty(&self) -> bool { + match self { + PathFixedSizeArray(path_iterator) => (*path_iterator).is_empty(), + PathAsVec(path_iterator) => path_iterator.is_empty(), + PathWithSizes(path_size) => path_size.is_empty(), + } + } + + /// Pushes the given key into the path. + pub fn push(&mut self, key_info: DriveKeyInfo<'a>) -> Result<(), Error> { + match self { + PathFixedSizeArray(_) => { + return Err(Error::Drive(DriveError::CorruptedCodeExecution( + "can not add a key to a fixed size path iterator", + ))) + } + PathAsVec(path_iterator) => match key_info { + Key(key) => path_iterator.push(key), + KeyRef(key_ref) => path_iterator.push(key_ref.to_vec()), + KeySize(..) => { + return Err(Error::Drive(DriveError::CorruptedCodeExecution( + "can not add a key size to path iterator", + ))) + } + }, + PathWithSizes(key_info_path) => match key_info { + Key(key) => key_info_path.push(KnownKey(key)), + KeyRef(key_ref) => key_info_path.push(KnownKey(key_ref.to_vec())), + KeySize(key_info) => key_info_path.push(key_info), + }, + } + Ok(()) + } + + /// Get the KeyInfoPath for grovedb estimated costs + pub(crate) fn convert_to_key_info_path(self) -> KeyInfoPath { + match self { + PathFixedSizeArray(path) => KeyInfoPath::from_known_path(path), + PathAsVec(path) => KeyInfoPath::from_known_owned_path(path), + PathWithSizes(key_info_path) => key_info_path, + } + } +} diff --git a/packages/rs-drive/src/drive/object_size_info/path_key_element_info.rs b/packages/rs-drive/src/util/object_size_info/path_key_element_info.rs similarity index 92% rename from packages/rs-drive/src/drive/object_size_info/path_key_element_info.rs rename to packages/rs-drive/src/util/object_size_info/path_key_element_info.rs index a59e8137c4f..e461209a0d1 100644 --- a/packages/rs-drive/src/drive/object_size_info/path_key_element_info.rs +++ b/packages/rs-drive/src/util/object_size_info/path_key_element_info.rs @@ -1,18 +1,17 @@ -use crate::drive::object_size_info::path_key_element_info::PathKeyElementInfo::{ - PathFixedSizeKeyRefElement, PathKeyElementSize, PathKeyRefElement, PathKeyUnknownElementSize, -}; -use crate::drive::object_size_info::PathInfo::{ - PathFixedSizeIterator, PathIterator, PathWithSizes, -}; -use crate::drive::object_size_info::{KeyElementInfo, PathInfo}; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::object_size_info::path_key_element_info::PathKeyElementInfo::{ + PathFixedSizeKeyRefElement, PathKeyElementSize, PathKeyRefElement, PathKeyUnknownElementSize, +}; +use crate::util::object_size_info::PathInfo::{PathAsVec, PathFixedSizeArray, PathWithSizes}; +use crate::util::object_size_info::{KeyElementInfo, PathInfo}; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::key_info::KeyInfo::KnownKey; use grovedb::batch::KeyInfoPath; use grovedb::Element; /// Path key element info +#[derive(Debug)] pub enum PathKeyElementInfo<'a, const N: usize> { /// A triple Path Key and Element PathFixedSizeKeyRefElement(([&'a [u8]; N], &'a [u8], Element)), @@ -33,7 +32,7 @@ impl<'a, const N: usize> PathKeyElementInfo<'a, N> { key_element: KeyElementInfo<'a>, ) -> Result { match path_info { - PathIterator(path) => match key_element { + PathAsVec(path) => match key_element { KeyElementInfo::KeyElement((key, element)) => { Ok(PathKeyRefElement((path, key, element))) } @@ -59,7 +58,7 @@ impl<'a, const N: usize> PathKeyElementInfo<'a, N> { PathKeyUnknownElementSize((path_size, key_len, element_size)), ), }, - PathFixedSizeIterator(path) => match key_element { + PathFixedSizeArray(path) => match key_element { KeyElementInfo::KeyElement((key, element)) => { Ok(PathFixedSizeKeyRefElement((path, key, element))) } diff --git a/packages/rs-drive/src/drive/object_size_info/path_key_info.rs b/packages/rs-drive/src/util/object_size_info/path_key_info.rs similarity index 91% rename from packages/rs-drive/src/drive/object_size_info/path_key_info.rs rename to packages/rs-drive/src/util/object_size_info/path_key_info.rs index b3dad9d3a4c..c417ef602d0 100644 --- a/packages/rs-drive/src/drive/object_size_info/path_key_info.rs +++ b/packages/rs-drive/src/util/object_size_info/path_key_info.rs @@ -1,7 +1,8 @@ -use crate::drive::object_size_info::path_key_info::PathKeyInfo::{ +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::util::object_size_info::path_key_info::PathKeyInfo::{ PathFixedSizeKey, PathFixedSizeKeyRef, PathKey, PathKeyRef, PathKeySize, }; -use crate::error::Error; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::key_info::KeyInfo::KnownKey; use grovedb::batch::KeyInfoPath; @@ -9,7 +10,7 @@ use grovedb_storage::worst_case_costs::WorstKeyLength; use std::collections::HashSet; /// Path key info -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum PathKeyInfo<'a, const N: usize> { /// An into iter Path with a Key PathFixedSizeKey(([&'a [u8]; N], Vec)), @@ -24,6 +25,21 @@ pub enum PathKeyInfo<'a, const N: usize> { PathKeySize(KeyInfoPath, KeyInfo), } +impl<'a> TryFrom>> for PathKeyInfo<'a, 0> { + type Error = Error; + + fn try_from(mut value: Vec>) -> Result { + if value.is_empty() { + Err(Error::Drive(DriveError::InvalidPath( + "path must not be none to convert into a path key info", + ))) + } else { + let last = value.remove(value.len() - 1); + Ok(PathKey((value, last))) + } + } +} + impl<'a, const N: usize> PathKeyInfo<'a, N> { /// Returns the length of the path with key as a usize. pub fn len(&'a self) -> u32 { @@ -132,7 +148,6 @@ impl<'a, const N: usize> PathKeyInfo<'a, N> { } /// Get the KeyInfoPath for grovedb estimated costs - #[allow(dead_code)] pub(crate) fn convert_to_key_info_path(self) -> Result { match self { PathKey((path, key)) => { diff --git a/packages/rs-drive/src/util/operations/apply_batch_grovedb_operations/mod.rs b/packages/rs-drive/src/util/operations/apply_batch_grovedb_operations/mod.rs new file mode 100644 index 00000000000..53c1334cabc --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_batch_grovedb_operations/mod.rs @@ -0,0 +1,59 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::GroveDbOpBatch; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Applies a batch of groveDB operations, or estimates the cost of operations depending on the arguments provided. + /// + /// This method checks the drive version and calls the appropriate versioned method. + /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. + /// + /// # Arguments + /// + /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. + /// * `transaction` - The transaction argument to pass to the groveDB. + /// * `batch_operations` - A batch of operations to apply to the groveDB. + /// * `drive_operations` - A mutable reference to a vector of drive operations. + /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. + /// + /// # Returns + /// + /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. + /// + pub(crate) fn apply_batch_grovedb_operations( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: GroveDbOpBatch, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .operations + .apply_batch_grovedb_operations + { + 0 => self.apply_batch_grovedb_operations_v0( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "apply_batch_grovedb_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/operations/apply_batch_grovedb_operations/v0/mod.rs b/packages/rs-drive/src/util/operations/apply_batch_grovedb_operations/v0/mod.rs new file mode 100644 index 00000000000..af240c94907 --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_batch_grovedb_operations/v0/mod.rs @@ -0,0 +1,50 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::GroveDbOpBatch; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Applies a batch of groveDB operations if apply is True, otherwise gets the cost of the operations. + pub(crate) fn apply_batch_grovedb_operations_v0( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: GroveDbOpBatch, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + if let Some(estimated_layer_info) = estimated_costs_only_with_layer_info { + // Leave this for future debugging + // for (k, v) in estimated_layer_info.iter() { + // let path = k + // .to_path() + // .iter() + // .map(|k| hex::encode(k.as_slice())) + // .join("/"); + // dbg!(path, v); + // } + self.grove_batch_operations_costs( + batch_operations, + estimated_layer_info, + false, + drive_operations, + drive_version, + )?; + } else { + self.grove_apply_batch_with_add_costs( + batch_operations, + false, + transaction, + drive_operations, + drive_version, + )?; + } + Ok(()) + } +} diff --git a/packages/rs-drive/src/util/operations/apply_batch_low_level_drive_operations/mod.rs b/packages/rs-drive/src/util/operations/apply_batch_low_level_drive_operations/mod.rs new file mode 100644 index 00000000000..64537fa5444 --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_batch_low_level_drive_operations/mod.rs @@ -0,0 +1,59 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Applies a batch of Drive operations to groveDB depending on the drive version. + /// + /// This method checks the drive version and calls the appropriate versioned method. + /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. + /// + /// # Arguments + /// + /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. + /// * `transaction` - The transaction argument to pass to the groveDB. + /// * `batch_operations` - A vector of low-level drive operations to apply to the groveDB. + /// * `drive_operations` - A mutable reference to a vector of drive operations. + /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. + /// + /// # Returns + /// + /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. + /// + pub fn apply_batch_low_level_drive_operations( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: Vec, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .operations + .apply_batch_low_level_drive_operations + { + 0 => self.apply_batch_low_level_drive_operations_v0( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "apply_batch_low_level_drive_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/operations/apply_batch_low_level_drive_operations/v0/mod.rs b/packages/rs-drive/src/util/operations/apply_batch_low_level_drive_operations/v0/mod.rs new file mode 100644 index 00000000000..74c318ee83e --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_batch_low_level_drive_operations/v0/mod.rs @@ -0,0 +1,38 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// Applies a batch of Drive operations to groveDB. + pub(crate) fn apply_batch_low_level_drive_operations_v0( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: Vec, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let (grove_db_operations, mut other_operations) = + LowLevelDriveOperation::grovedb_operations_batch_consume_with_leftovers( + batch_operations, + ); + if !grove_db_operations.is_empty() { + self.apply_batch_grovedb_operations( + estimated_costs_only_with_layer_info, + transaction, + grove_db_operations, + drive_operations, + drive_version, + )?; + } + drive_operations.append(&mut other_operations); + Ok(()) + } +} diff --git a/packages/rs-drive/src/util/operations/apply_partial_batch_grovedb_operations/mod.rs b/packages/rs-drive/src/util/operations/apply_partial_batch_grovedb_operations/mod.rs new file mode 100644 index 00000000000..20230350437 --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_partial_batch_grovedb_operations/mod.rs @@ -0,0 +1,71 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::{drive::DriveError, Error}; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::GroveError; +use crate::util::batch::GroveDbOpBatch; + +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::{KeyInfoPath, OpsByLevelPath, QualifiedGroveDbOp}; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb_costs::OperationCost; +use std::collections::HashMap; + +impl Drive { + /// Applies a partial batch of groveDB operations depending on the drive version. + /// + /// This method checks the drive version and calls the appropriate versioned method. + /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. + /// + /// # Arguments + /// + /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. + /// * `transaction` - The transaction argument to pass to the groveDB. + /// * `batch_operations` - A groveDB operation batch. + /// * `add_on_operations` - A closure that processes additional operations. + /// * `drive_operations` - A mutable reference to a vector of drive operations. + /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. + /// + /// # Returns + /// + /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. + /// + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub(crate) fn apply_partial_batch_grovedb_operations( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: GroveDbOpBatch, + add_on_operations: impl FnMut( + &OperationCost, + &Option, + ) -> Result, GroveError>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .operations + .apply_partial_batch_grovedb_operations + { + 0 => self.apply_partial_batch_grovedb_operations_v0( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + add_on_operations, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "apply_partial_batch_grovedb_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/operations/apply_partial_batch_grovedb_operations/v0/mod.rs b/packages/rs-drive/src/util/operations/apply_partial_batch_grovedb_operations/v0/mod.rs new file mode 100644 index 00000000000..129f74eb746 --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_partial_batch_grovedb_operations/v0/mod.rs @@ -0,0 +1,77 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::query::GroveError; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::{KeyInfoPath, OpsByLevelPath, QualifiedGroveDbOp}; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb_costs::storage_cost::StorageCost; +use grovedb_costs::OperationCost; +use std::collections::HashMap; + +impl Drive { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + /// Applies a partial batch of groveDB operations if apply is True, otherwise gets the cost of the operations. + pub(crate) fn apply_partial_batch_grovedb_operations_v0( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + mut batch_operations: GroveDbOpBatch, + mut add_on_operations: impl FnMut( + &OperationCost, + &Option, + ) -> Result, GroveError>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + if let Some(estimated_layer_info) = estimated_costs_only_with_layer_info { + // Leave this for future debugging + // for (k, v) in estimated_layer_info.iter() { + // let path = k + // .to_path() + // .iter() + // .map(|k| hex::encode(k.as_slice())) + // .join("/"); + // dbg!(path, v); + // } + // the estimated fees are the same for partial batches + let additional_operations = add_on_operations( + &OperationCost { + seek_count: 1, + storage_cost: StorageCost { + added_bytes: 1, + replaced_bytes: 1, + removed_bytes: Default::default(), + }, + storage_loaded_bytes: 1, + hash_node_calls: 1, + }, + &None, + )?; + batch_operations.extend(additional_operations); + self.grove_batch_operations_costs( + batch_operations, + estimated_layer_info, + false, + drive_operations, + drive_version, + )?; + } else { + self.grove_apply_partial_batch_with_add_costs( + batch_operations, + false, + transaction, + add_on_operations, + drive_operations, + drive_version, + )?; + } + Ok(()) + } +} diff --git a/packages/rs-drive/src/util/operations/apply_partial_batch_low_level_drive_operations/mod.rs b/packages/rs-drive/src/util/operations/apply_partial_batch_low_level_drive_operations/mod.rs new file mode 100644 index 00000000000..e97d8d7145a --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_partial_batch_low_level_drive_operations/mod.rs @@ -0,0 +1,71 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use crate::query::GroveError; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::{KeyInfoPath, OpsByLevelPath}; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb_costs::OperationCost; +use std::collections::HashMap; + +impl Drive { + /// Applies a partial batch of low level drive operations depending on the drive version. + /// + /// This method checks the drive version and calls the appropriate versioned method. + /// If an unsupported version is passed, the function will return an `Error::Drive` with a `DriveError::UnknownVersionMismatch` error. + /// + /// # Arguments + /// + /// * `estimated_costs_only_with_layer_info` - An optional hashmap containing estimated layer information. + /// * `transaction` - The transaction argument to pass to the groveDB. + /// * `batch_operations` - A vector of low level drive operations. + /// * `add_on_operations` - A closure that processes additional operations. + /// * `drive_operations` - A mutable reference to a vector of drive operations. + /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. + /// + /// # Returns + /// + /// * `Result<(), Error>` - On success, returns `Ok(())`. On error, returns an `Error`. + /// + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub(crate) fn apply_partial_batch_low_level_drive_operations( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: Vec, + add_on_operations: impl FnMut( + &OperationCost, + &Option, + ) -> Result, GroveError>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + match drive_version + .methods + .operations + .apply_partial_batch_low_level_drive_operations + { + 0 => self.apply_partial_batch_low_level_drive_operations_v0( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + add_on_operations, + drive_operations, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "apply_partial_batch_low_level_drive_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/util/operations/apply_partial_batch_low_level_drive_operations/v0/mod.rs b/packages/rs-drive/src/util/operations/apply_partial_batch_low_level_drive_operations/v0/mod.rs new file mode 100644 index 00000000000..c0b7b295c0f --- /dev/null +++ b/packages/rs-drive/src/util/operations/apply_partial_batch_low_level_drive_operations/v0/mod.rs @@ -0,0 +1,55 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::query::GroveError; +use dpp::version::drive_versions::DriveVersion; +use grovedb::batch::{KeyInfoPath, OpsByLevelPath}; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb_costs::OperationCost; +use std::collections::HashMap; + +impl Drive { + //this will be used later + /// Applies a batch of Drive operations to groveDB. + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub(crate) fn apply_partial_batch_low_level_drive_operations_v0( + &self, + estimated_costs_only_with_layer_info: Option< + HashMap, + >, + transaction: TransactionArg, + batch_operations: Vec, + mut add_on_operations: impl FnMut( + &OperationCost, + &Option, + ) -> Result, GroveError>, + drive_operations: &mut Vec, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + let grove_db_operations = + LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); + self.apply_partial_batch_grovedb_operations( + estimated_costs_only_with_layer_info, + transaction, + grove_db_operations, + |cost, left_over_ops| { + let additional_low_level_drive_operations = add_on_operations(cost, left_over_ops)?; + let new_grove_db_operations = LowLevelDriveOperation::grovedb_operations_batch( + &additional_low_level_drive_operations, + ) + .operations; + Ok(new_grove_db_operations) + }, + drive_operations, + drive_version, + )?; + batch_operations.into_iter().for_each(|op| match op { + GroveOperation(_) => (), + _ => drive_operations.push(op), + }); + Ok(()) + } +} diff --git a/packages/rs-drive/src/drive/operations/commit_transaction/mod.rs b/packages/rs-drive/src/util/operations/commit_transaction/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/operations/commit_transaction/mod.rs rename to packages/rs-drive/src/util/operations/commit_transaction/mod.rs diff --git a/packages/rs-drive/src/util/operations/commit_transaction/v0/mod.rs b/packages/rs-drive/src/util/operations/commit_transaction/v0/mod.rs new file mode 100644 index 00000000000..c144485b843 --- /dev/null +++ b/packages/rs-drive/src/util/operations/commit_transaction/v0/mod.rs @@ -0,0 +1,14 @@ +use crate::drive::Drive; +use crate::error::Error; +use grovedb::Transaction; + +impl Drive { + /// Commits a transaction. + pub(crate) fn commit_transaction_v0(&self, transaction: Transaction) -> Result<(), Error> { + self.grove + .commit_transaction(transaction) + .unwrap() // TODO: discuss what to do with transaction cost as costs are + // returned in advance on transaction operations not on commit + .map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/drive/operations/drop_cache/mod.rs b/packages/rs-drive/src/util/operations/drop_cache/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/operations/drop_cache/mod.rs rename to packages/rs-drive/src/util/operations/drop_cache/mod.rs diff --git a/packages/rs-drive/src/util/operations/drop_cache/v0/mod.rs b/packages/rs-drive/src/util/operations/drop_cache/v0/mod.rs new file mode 100644 index 00000000000..489018b34b8 --- /dev/null +++ b/packages/rs-drive/src/util/operations/drop_cache/v0/mod.rs @@ -0,0 +1,20 @@ +use crate::cache::ProtocolVersionsCache; +use crate::drive::Drive; + +impl Drive { + /// Drops the drive cache + pub(crate) fn drop_cache_v0(&self) { + let genesis_time_ms = self.config.default_genesis_time; + self.cache.data_contracts.clear(); + + let mut genesis_time_ms_cache = self.cache.genesis_time_ms.write(); + + *genesis_time_ms_cache = genesis_time_ms; + + drop(genesis_time_ms_cache); + + let mut protocol_versions_counter_cache = self.cache.protocol_versions_counter.write(); + + *protocol_versions_counter_cache = ProtocolVersionsCache::new(); + } +} diff --git a/packages/rs-drive/src/drive/operations/mod.rs b/packages/rs-drive/src/util/operations/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/operations/mod.rs rename to packages/rs-drive/src/util/operations/mod.rs diff --git a/packages/rs-drive/src/drive/operations/rollback_transaction/mod.rs b/packages/rs-drive/src/util/operations/rollback_transaction/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/operations/rollback_transaction/mod.rs rename to packages/rs-drive/src/util/operations/rollback_transaction/mod.rs diff --git a/packages/rs-drive/src/util/operations/rollback_transaction/v0/mod.rs b/packages/rs-drive/src/util/operations/rollback_transaction/v0/mod.rs new file mode 100644 index 00000000000..57b1e26959b --- /dev/null +++ b/packages/rs-drive/src/util/operations/rollback_transaction/v0/mod.rs @@ -0,0 +1,12 @@ +use crate::drive::Drive; +use crate::error::Error; +use grovedb::Transaction; + +impl Drive { + /// Rolls back a transaction. + pub(crate) fn rollback_transaction_v0(&self, transaction: &Transaction) -> Result<(), Error> { + self.grove + .rollback_transaction(transaction) + .map_err(Error::GroveDB) + } +} diff --git a/packages/rs-drive/src/util/storage_flags/mod.rs b/packages/rs-drive/src/util/storage_flags/mod.rs new file mode 100644 index 00000000000..3f85b2602de --- /dev/null +++ b/packages/rs-drive/src/util/storage_flags/mod.rs @@ -0,0 +1,786 @@ +//! Flags +//! + +#[cfg(feature = "server")] +use crate::util::storage_flags::StorageFlags::{ + MultiEpoch, MultiEpochOwned, SingleEpoch, SingleEpochOwned, +}; +#[cfg(feature = "server")] +use crate::util::type_constants::DEFAULT_HASH_SIZE; +#[cfg(feature = "server")] +use grovedb::ElementFlags; +#[cfg(feature = "server")] +use grovedb_costs::storage_cost::removal::StorageRemovedBytes::SectionedStorageRemoval; +#[cfg(feature = "server")] +use grovedb_costs::storage_cost::removal::{ + StorageRemovalPerEpochByIdentifier, StorageRemovedBytes, +}; +#[cfg(feature = "server")] +use integer_encoding::VarInt; +#[cfg(feature = "server")] +use intmap::IntMap; +#[cfg(feature = "server")] +use std::borrow::Cow; +#[cfg(feature = "server")] +use std::cmp::Ordering; +#[cfg(any(feature = "server", feature = "verify"))] +use std::collections::BTreeMap; + +#[cfg(feature = "server")] +use crate::error::storage_flags::StorageFlagsError; +#[cfg(feature = "server")] +use crate::error::Error; + +#[cfg(any(feature = "server", feature = "verify"))] +type EpochIndex = u16; + +#[cfg(any(feature = "server", feature = "verify"))] +type BaseEpoch = EpochIndex; + +#[cfg(any(feature = "server", feature = "verify"))] +type BytesAddedInEpoch = u32; + +#[cfg(any(feature = "server", feature = "verify"))] +type OwnerId = [u8; 32]; + +#[cfg(feature = "server")] +/// The size of single epoch flags +pub const SINGLE_EPOCH_FLAGS_SIZE: u32 = 3; + +#[cfg(any(feature = "server", feature = "verify"))] +/// Storage flags +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum StorageFlags { + /// Single epoch + /// represented as byte 0 + SingleEpoch(BaseEpoch), + + /// Multi epoch + /// represented as byte 1 + MultiEpoch(BaseEpoch, BTreeMap), + + /// Single epoch owned + /// represented as byte 2 + SingleEpochOwned(BaseEpoch, OwnerId), + + /// Multi epoch owned + /// represented as byte 3 + MultiEpochOwned(BaseEpoch, BTreeMap, OwnerId), +} + +#[cfg(any(feature = "server", feature = "verify"))] +/// MergingOwnersStrategy decides which owner to keep during a merge +#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)] +pub enum MergingOwnersStrategy { + #[default] + /// Raise an issue that owners of nodes are different + RaiseIssue, + /// Use the original owner id + UseOurs, + /// Use the new owner id + UseTheirs, +} + +#[cfg(feature = "server")] +impl StorageFlags { + /// Create new single epoch storage flags + pub fn new_single_epoch(epoch: BaseEpoch, maybe_owner_id: Option) -> Self { + match maybe_owner_id { + None => SingleEpoch(epoch), + Some(owner_id) => SingleEpochOwned(epoch, owner_id), + } + } + + fn combine_owner_id<'a>( + &'a self, + rhs: &'a Self, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result, Error> { + if let Some(our_owner_id) = self.owner_id() { + if let Some(other_owner_id) = rhs.owner_id() { + if our_owner_id != other_owner_id { + match merging_owners_strategy { + MergingOwnersStrategy::RaiseIssue => Err(Error::StorageFlags( + StorageFlagsError::MergingStorageFlagsFromDifferentOwners( + "can not merge from different owners", + ), + )), + MergingOwnersStrategy::UseOurs => Ok(Some(our_owner_id)), + MergingOwnersStrategy::UseTheirs => Ok(Some(other_owner_id)), + } + } else { + Ok(Some(our_owner_id)) + } + } else { + Ok(Some(our_owner_id)) + } + } else if let Some(other_owner_id) = rhs.owner_id() { + Ok(Some(other_owner_id)) + } else { + Ok(None) + } + } + + fn combine_non_base_epoch_bytes( + &self, + rhs: &Self, + ) -> Option> { + if let Some(our_epoch_index_map) = self.epoch_index_map() { + if let Some(other_epoch_index_map) = rhs.epoch_index_map() { + let mut combined_index_map = our_epoch_index_map.clone(); + other_epoch_index_map + .iter() + .for_each(|(epoch_index, bytes_added)| { + let original_value = combined_index_map.remove(epoch_index); + match original_value { + None => combined_index_map.insert(*epoch_index, *bytes_added), + Some(original_bytes) => combined_index_map + .insert(*epoch_index, original_bytes + *bytes_added), + }; + }); + Some(combined_index_map) + } else { + Some(our_epoch_index_map.clone()) + } + } else { + rhs.epoch_index_map().cloned() + } + } + + fn combine_same_base_epoch( + &self, + rhs: Self, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result { + let base_epoch = *self.base_epoch(); + let owner_id = self.combine_owner_id(&rhs, merging_owners_strategy)?; + let other_epoch_bytes = self.combine_non_base_epoch_bytes(&rhs); + + match (owner_id, other_epoch_bytes) { + (None, None) => Ok(SingleEpoch(base_epoch)), + (Some(owner_id), None) => Ok(SingleEpochOwned(base_epoch, *owner_id)), + (None, Some(other_epoch_bytes)) => Ok(MultiEpoch(base_epoch, other_epoch_bytes)), + (Some(owner_id), Some(other_epoch_bytes)) => { + Ok(MultiEpochOwned(base_epoch, other_epoch_bytes, *owner_id)) + } + } + } + + fn combine_with_higher_base_epoch( + &self, + rhs: Self, + added_bytes: u32, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result { + let base_epoch = *self.base_epoch(); + let epoch_with_adding_bytes = rhs.base_epoch(); + let owner_id = self.combine_owner_id(&rhs, merging_owners_strategy)?; + let mut other_epoch_bytes = self.combine_non_base_epoch_bytes(&rhs).unwrap_or_default(); + let original_value = other_epoch_bytes.remove(epoch_with_adding_bytes); + match original_value { + None => other_epoch_bytes.insert(*epoch_with_adding_bytes, added_bytes), + Some(original_bytes) => { + other_epoch_bytes.insert(*epoch_with_adding_bytes, original_bytes + added_bytes) + } + }; + + match owner_id { + None => Ok(MultiEpoch(base_epoch, other_epoch_bytes)), + Some(owner_id) => Ok(MultiEpochOwned(base_epoch, other_epoch_bytes, *owner_id)), + } + } + + fn combine_with_higher_base_epoch_remove_bytes( + self, + rhs: Self, + removed_bytes: &StorageRemovedBytes, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result { + if matches!(&self, &SingleEpoch(_) | &SingleEpochOwned(..)) { + return Ok(self); + } + let base_epoch = *self.base_epoch(); + let owner_id = self.combine_owner_id(&rhs, merging_owners_strategy)?; + let mut other_epoch_bytes = self.combine_non_base_epoch_bytes(&rhs).unwrap_or_default(); + if let SectionedStorageRemoval(sectioned_bytes_by_identifier) = removed_bytes { + if sectioned_bytes_by_identifier.len() > 1 { + return Err(Error::StorageFlags( + StorageFlagsError::MergingStorageFlagsFromDifferentOwners( + "can not remove bytes when there is no epoch", + ), + )); + } + let identifier = owner_id.copied().unwrap_or_default(); + let sectioned_bytes = + sectioned_bytes_by_identifier + .get(&identifier) + .ok_or(Error::StorageFlags( + StorageFlagsError::MergingStorageFlagsFromDifferentOwners( + "can not remove bytes when there is no epoch", + ), + ))?; + sectioned_bytes + .iter() + .try_for_each(|(epoch, removed_bytes)| { + let bytes_added_in_epoch = + other_epoch_bytes + .get_mut(&(*epoch as u16)) + .ok_or(Error::StorageFlags( + StorageFlagsError::RemovingAtEpochWithNoAssociatedStorage( + "can not remove bytes when there is no epoch", + ), + ))?; + *bytes_added_in_epoch = + bytes_added_in_epoch.checked_sub(*removed_bytes).ok_or( + Error::StorageFlags(StorageFlagsError::StorageFlagsOverflow( + "can't remove more bytes than exist at that epoch", + )), + )?; + Ok::<(), Error>(()) + })?; + } + + match owner_id { + None => Ok(MultiEpoch(base_epoch, other_epoch_bytes)), + Some(owner_id) => Ok(MultiEpochOwned(base_epoch, other_epoch_bytes, *owner_id)), + } + } + + /// Optional combine added bytes + pub fn optional_combine_added_bytes( + ours: Option, + theirs: Self, + added_bytes: u32, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result { + match ours { + None => Ok(theirs), + Some(ours) => { + Ok(ours.combine_added_bytes(theirs, added_bytes, merging_owners_strategy)?) + } + } + } + + /// Optional combine removed bytes + pub fn optional_combine_removed_bytes( + ours: Option, + theirs: Self, + removed_bytes: &StorageRemovedBytes, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result { + match ours { + None => Ok(theirs), + Some(ours) => { + Ok(ours.combine_removed_bytes(theirs, removed_bytes, merging_owners_strategy)?) + } + } + } + + /// Combine added bytes + pub fn combine_added_bytes( + self, + rhs: Self, + added_bytes: u32, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result { + match self.base_epoch().cmp(rhs.base_epoch()) { + Ordering::Equal => self.combine_same_base_epoch(rhs, merging_owners_strategy), + Ordering::Less => { + self.combine_with_higher_base_epoch(rhs, added_bytes, merging_owners_strategy) + } + Ordering::Greater => Err(Error::StorageFlags( + StorageFlagsError::MergingStorageFlagsWithDifferentBaseEpoch( + "can not merge with new item in older base epoch", + ), + )), + } + } + + /// Combine removed bytes + pub fn combine_removed_bytes( + self, + rhs: Self, + removed_bytes: &StorageRemovedBytes, + merging_owners_strategy: MergingOwnersStrategy, + ) -> Result { + match self.base_epoch().cmp(rhs.base_epoch()) { + Ordering::Equal => self.combine_same_base_epoch(rhs, merging_owners_strategy), + Ordering::Less => self.combine_with_higher_base_epoch_remove_bytes( + rhs, + removed_bytes, + merging_owners_strategy, + ), + Ordering::Greater => Err(Error::StorageFlags( + StorageFlagsError::MergingStorageFlagsWithDifferentBaseEpoch( + "can not merge with new item in older base epoch", + ), + )), + } + } + + /// Returns base epoch + pub fn base_epoch(&self) -> &BaseEpoch { + match self { + SingleEpoch(base_epoch) + | MultiEpoch(base_epoch, _) + | SingleEpochOwned(base_epoch, _) + | MultiEpochOwned(base_epoch, _, _) => base_epoch, + } + } + + /// Returns owner id + pub fn owner_id(&self) -> Option<&OwnerId> { + match self { + SingleEpochOwned(_, owner_id) | MultiEpochOwned(_, _, owner_id) => Some(owner_id), + _ => None, + } + } + + /// Returns epoch index map + pub fn epoch_index_map(&self) -> Option<&BTreeMap> { + match self { + MultiEpoch(_, epoch_int_map) | MultiEpochOwned(_, epoch_int_map, _) => { + Some(epoch_int_map) + } + _ => None, + } + } + + /// Returns optional default storage flags + pub fn optional_default() -> Option { + None + } + + /// Returns default optional storage flag as ref + pub fn optional_default_as_ref() -> Option<&'static Self> { + None + } + + /// Returns default optional storage flag as ref + pub fn optional_default_as_cow() -> Option> { + None + } + + /// Returns type byte + pub fn type_byte(&self) -> u8 { + match self { + SingleEpoch(_) => 0, + MultiEpoch(..) => 1, + SingleEpochOwned(..) => 2, + MultiEpochOwned(..) => 3, + } + } + + fn append_to_vec_base_epoch(&self, buffer: &mut Vec) { + match self { + SingleEpoch(base_epoch) + | MultiEpoch(base_epoch, ..) + | SingleEpochOwned(base_epoch, ..) + | MultiEpochOwned(base_epoch, ..) => buffer.extend(base_epoch.to_be_bytes()), + } + } + + fn maybe_append_to_vec_epoch_map(&self, buffer: &mut Vec) { + match self { + MultiEpoch(_, epoch_map) | MultiEpochOwned(_, epoch_map, _) => { + if epoch_map.is_empty() { + panic!("this should not be empty"); + } + epoch_map.iter().for_each(|(epoch_index, bytes_added)| { + buffer.extend(epoch_index.to_be_bytes()); + buffer.extend(bytes_added.encode_var_vec()); + }) + } + _ => {} + } + } + + fn maybe_epoch_map_size(&self) -> u32 { + let mut size = 0; + match self { + MultiEpoch(_, epoch_map) | MultiEpochOwned(_, epoch_map, _) => { + epoch_map.iter().for_each(|(_epoch_index, bytes_added)| { + size += 2; + size += bytes_added.encode_var_vec().len() as u32; + }) + } + _ => {} + } + size + } + + fn maybe_append_to_vec_owner_id(&self, buffer: &mut Vec) { + match self { + SingleEpochOwned(_, owner_id) | MultiEpochOwned(_, _, owner_id) => { + buffer.extend(owner_id); + } + _ => {} + } + } + + fn maybe_owner_id_size(&self) -> u32 { + match self { + SingleEpochOwned(..) | MultiEpochOwned(..) => DEFAULT_HASH_SIZE, + _ => 0, + } + } + + /// ApproximateSize + pub fn approximate_size( + has_owner_id: bool, + approximate_changes_and_bytes_count: Option<(u16, u8)>, + ) -> u32 { + let mut size = 3; // 1 for type byte, 2 for epoch number + if has_owner_id { + size += DEFAULT_HASH_SIZE; + } + if let Some((approximate_change_count, bytes_changed_required_size)) = + approximate_changes_and_bytes_count + { + size += (approximate_change_count as u32) * (2 + bytes_changed_required_size as u32) + } + size + } + + /// Serialize storage flags + pub fn serialize(&self) -> Vec { + let mut buffer = vec![self.type_byte()]; + self.maybe_append_to_vec_owner_id(&mut buffer); + self.append_to_vec_base_epoch(&mut buffer); + self.maybe_append_to_vec_epoch_map(&mut buffer); + buffer + } + + /// Serialize storage flags + pub fn serialized_size(&self) -> u32 { + let mut buffer_len = 3; //for type byte and base epoch + buffer_len += self.maybe_owner_id_size(); + buffer_len += self.maybe_epoch_map_size(); + buffer_len + } + + /// Deserialize single epoch storage flags from bytes + pub fn deserialize_single_epoch(data: &[u8]) -> Result { + if data.len() != 3 { + Err(Error::StorageFlags( + StorageFlagsError::StorageFlagsWrongSize("single epoch must be 3 bytes total"), + )) + } else { + let epoch = u16::from_be_bytes(data[1..3].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "single epoch must be 3 bytes total", + )) + })?); + Ok(SingleEpoch(epoch)) + } + } + + /// Deserialize multi epoch storage flags from bytes + pub fn deserialize_multi_epoch(data: &[u8]) -> Result { + let len = data.len(); + if len < 6 { + Err(Error::StorageFlags( + StorageFlagsError::StorageFlagsWrongSize( + "multi epoch must be at least 6 bytes total", + ), + )) + } else { + let base_epoch = u16::from_be_bytes(data[1..3].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "multi epoch must have enough bytes for the base epoch", + )) + })?); + let mut offset = 3; + let mut bytes_per_epoch: BTreeMap = BTreeMap::default(); + while offset + 2 < len { + // 2 for epoch size + let epoch_index = + u16::from_be_bytes(data[offset..offset + 2].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "multi epoch must have enough bytes epoch indexes", + )) + })?); + offset += 2; + let (bytes_at_epoch, bytes_used) = u32::decode_var(&data[offset..]).ok_or( + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "multi epoch must have enough bytes for the amount of bytes used", + )), + )?; + offset += bytes_used; + bytes_per_epoch.insert(epoch_index, bytes_at_epoch); + } + Ok(MultiEpoch(base_epoch, bytes_per_epoch)) + } + } + + /// Deserialize single epoch owned storage flags from bytes + pub fn deserialize_single_epoch_owned(data: &[u8]) -> Result { + if data.len() != 35 { + Err(Error::StorageFlags( + StorageFlagsError::StorageFlagsWrongSize( + "single epoch owned must be 35 bytes total", + ), + )) + } else { + let owner_id: OwnerId = data[1..33].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "single epoch owned must be 35 bytes total for owner id", + )) + })?; + let epoch = u16::from_be_bytes(data[33..35].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "single epoch owned must be 35 bytes total for epoch", + )) + })?); + Ok(SingleEpochOwned(epoch, owner_id)) + } + } + + /// Deserialize multi epoch owned storage flags from bytes + pub fn deserialize_multi_epoch_owned(data: &[u8]) -> Result { + let len = data.len(); + if len < 38 { + Err(Error::StorageFlags( + StorageFlagsError::StorageFlagsWrongSize( + "multi epoch owned must be at least 38 bytes total", + ), + )) + } else { + let owner_id: OwnerId = data[1..33].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "multi epoch owned must be 38 bytes total for owner id", + )) + })?; + let base_epoch = u16::from_be_bytes(data[33..35].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "multi epoch must have enough bytes for the base epoch", + )) + })?); + let mut offset = 35; + let mut bytes_per_epoch: BTreeMap = BTreeMap::default(); + while offset + 2 < len { + // 2 for epoch size + let epoch_index = + u16::from_be_bytes(data[offset..offset + 2].try_into().map_err(|_| { + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "multi epoch must have enough bytes epoch indexes", + )) + })?); + offset += 2; + let (bytes_at_epoch, bytes_used) = u32::decode_var(&data[offset..]).ok_or( + Error::StorageFlags(StorageFlagsError::StorageFlagsWrongSize( + "multi epoch must have enough bytes for the amount of bytes used", + )), + )?; + offset += bytes_used; + bytes_per_epoch.insert(epoch_index, bytes_at_epoch); + } + Ok(MultiEpochOwned(base_epoch, bytes_per_epoch, owner_id)) + } + } + + /// Deserialize storage flags from bytes + pub fn deserialize(data: &[u8]) -> Result, Error> { + let first_byte = data.first(); + match first_byte { + None => Ok(None), + Some(first_byte) => match *first_byte { + 0 => Ok(Some(Self::deserialize_single_epoch(data)?)), + 1 => Ok(Some(Self::deserialize_multi_epoch(data)?)), + 2 => Ok(Some(Self::deserialize_single_epoch_owned(data)?)), + 3 => Ok(Some(Self::deserialize_multi_epoch_owned(data)?)), + _ => Err(Error::StorageFlags( + StorageFlagsError::DeserializeUnknownStorageFlagsType( + "unknown storage flags serialization", + ), + )), + }, + } + } + + /// Creates storage flags from a slice. + pub fn from_slice(data: &[u8]) -> Result, Error> { + Self::deserialize(data) + } + + /// Creates storage flags from element flags. + pub fn from_element_flags_ref(data: &ElementFlags) -> Result, Error> { + Self::from_slice(data.as_slice()) + } + + /// Create Storage flags from optional element flags ref + pub fn map_some_element_flags_ref(data: &Option) -> Result, Error> { + match data { + None => Ok(None), + Some(data) => Self::from_slice(data.as_slice()), + } + } + + /// Create Storage flags from optional element flags ref + pub fn map_cow_some_element_flags_ref( + data: &Option, + ) -> Result>, Error> { + match data { + None => Ok(None), + Some(data) => Self::from_slice(data.as_slice()).map(|option| option.map(Cow::Owned)), + } + } + + /// Map to owned optional element flags + pub fn map_owned_to_element_flags(maybe_storage_flags: Option) -> ElementFlags { + maybe_storage_flags + .map(|storage_flags| storage_flags.serialize()) + .unwrap_or_default() + } + + /// Map to optional element flags + pub fn map_to_some_element_flags(maybe_storage_flags: Option<&Self>) -> Option { + maybe_storage_flags.map(|storage_flags| storage_flags.serialize()) + } + + /// Map to optional element flags + pub fn map_cow_to_some_element_flags( + maybe_storage_flags: Option>, + ) -> Option { + maybe_storage_flags.map(|storage_flags| storage_flags.serialize()) + } + + /// Map to optional element flags + pub fn map_borrowed_cow_to_some_element_flags( + maybe_storage_flags: &Option>, + ) -> Option { + maybe_storage_flags + .as_ref() + .map(|storage_flags| storage_flags.serialize()) + } + + /// Creates optional element flags + pub fn to_some_element_flags(&self) -> Option { + Some(self.serialize()) + } + + /// Creates element flags. + pub fn to_element_flags(&self) -> ElementFlags { + self.serialize() + } + + /// split_storage_removed_bytes removes bytes as LIFO + pub fn split_storage_removed_bytes( + &self, + removed_key_bytes: u32, + removed_value_bytes: u32, + ) -> Result<(StorageRemovedBytes, StorageRemovedBytes), grovedb::Error> { + fn single_storage_removal( + removed_bytes: u32, + base_epoch: &BaseEpoch, + owner_id: Option<&OwnerId>, + ) -> StorageRemovedBytes { + let bytes_left = removed_bytes; + let mut sectioned_storage_removal: IntMap = IntMap::default(); + if bytes_left > 0 { + // We need to take some from the base epoch + sectioned_storage_removal.insert(*base_epoch as u64, removed_bytes); + } + let mut sectioned_storage_removal_by_identifier: StorageRemovalPerEpochByIdentifier = + BTreeMap::new(); + if let Some(owner_id) = owner_id { + sectioned_storage_removal_by_identifier + .insert(*owner_id, sectioned_storage_removal); + } else { + let default = [0u8; 32]; + sectioned_storage_removal_by_identifier.insert(default, sectioned_storage_removal); + } + SectionedStorageRemoval(sectioned_storage_removal_by_identifier) + } + + fn sectioned_storage_removal( + removed_bytes: u32, + base_epoch: &BaseEpoch, + other_epoch_bytes: &BTreeMap, + owner_id: Option<&OwnerId>, + ) -> StorageRemovedBytes { + let mut bytes_left = removed_bytes; + let mut rev_iter = other_epoch_bytes.iter().rev(); + let mut sectioned_storage_removal: IntMap = IntMap::default(); + while bytes_left > 0 { + if let Some((epoch_index, bytes_in_epoch)) = rev_iter.next_back() { + if *bytes_in_epoch < bytes_left { + bytes_left -= bytes_in_epoch; + sectioned_storage_removal.insert(*epoch_index as u64, *bytes_in_epoch); + } else if *bytes_in_epoch >= bytes_left { + //take all bytes + bytes_left = 0; + sectioned_storage_removal.insert(*epoch_index as u64, bytes_left); + } + } else { + break; + } + } + if bytes_left > 0 { + // We need to take some from the base epoch + sectioned_storage_removal.insert(*base_epoch as u64, bytes_left); + } + let mut sectioned_storage_removal_by_identifier: StorageRemovalPerEpochByIdentifier = + BTreeMap::new(); + if let Some(owner_id) = owner_id { + sectioned_storage_removal_by_identifier + .insert(*owner_id, sectioned_storage_removal); + } else { + let default = [0u8; 32]; + sectioned_storage_removal_by_identifier.insert(default, sectioned_storage_removal); + } + SectionedStorageRemoval(sectioned_storage_removal_by_identifier) + } + match self { + SingleEpoch(base_epoch) => { + let value_storage_removal = + single_storage_removal(removed_value_bytes, base_epoch, None); + let key_storage_removal = + single_storage_removal(removed_key_bytes, base_epoch, None); + Ok((key_storage_removal, value_storage_removal)) + } + SingleEpochOwned(base_epoch, owner_id) => { + let value_storage_removal = + single_storage_removal(removed_value_bytes, base_epoch, Some(owner_id)); + let key_storage_removal = + single_storage_removal(removed_key_bytes, base_epoch, Some(owner_id)); + Ok((key_storage_removal, value_storage_removal)) + } + MultiEpoch(base_epoch, other_epoch_bytes) => { + let value_storage_removal = sectioned_storage_removal( + removed_value_bytes, + base_epoch, + other_epoch_bytes, + None, + ); + let key_storage_removal = sectioned_storage_removal( + removed_key_bytes, + base_epoch, + other_epoch_bytes, + None, + ); + Ok((key_storage_removal, value_storage_removal)) + } + MultiEpochOwned(base_epoch, other_epoch_bytes, owner_id) => { + let value_storage_removal = sectioned_storage_removal( + removed_value_bytes, + base_epoch, + other_epoch_bytes, + Some(owner_id), + ); + let key_storage_removal = sectioned_storage_removal( + removed_key_bytes, + base_epoch, + other_epoch_bytes, + Some(owner_id), + ); + Ok((key_storage_removal, value_storage_removal)) + } + } + } + + /// Wrap Storage Flags into optional owned cow + pub fn into_optional_cow<'a>(self) -> Option> { + Some(Cow::Owned(self)) + } +} diff --git a/packages/rs-drive/src/util/test_helpers/mod.rs b/packages/rs-drive/src/util/test_helpers/mod.rs new file mode 100644 index 00000000000..81447b46915 --- /dev/null +++ b/packages/rs-drive/src/util/test_helpers/mod.rs @@ -0,0 +1,111 @@ +#[cfg(feature = "server")] +use std::fs::File; +#[cfg(feature = "server")] +use std::io; +#[cfg(feature = "server")] +use std::io::BufRead; +#[cfg(feature = "server")] +use std::path::Path; + +#[cfg(feature = "fixtures-and-mocks")] +use grovedb::TransactionArg; + +#[cfg(feature = "fixtures-and-mocks")] +use crate::drive::Drive; +#[cfg(feature = "fixtures-and-mocks")] +use dpp::data_contract::DataContract; + +#[cfg(feature = "fixtures-and-mocks")] +use dpp::block::block_info::BlockInfo; +#[cfg(feature = "fixtures-and-mocks")] +use dpp::prelude::Identifier; + +#[cfg(feature = "fixtures-and-mocks")] +use dpp::tests::json_document::json_document_to_contract_with_ids; +#[cfg(feature = "fixtures-and-mocks")] +use dpp::version::PlatformVersion; + +#[cfg(test)] +use ciborium::value::Value; + +#[cfg(any(test, feature = "server"))] +pub mod setup; +#[cfg(any(test, feature = "fixtures-and-mocks"))] +/// test utils +pub mod test_utils; + +#[cfg(feature = "fixtures-and-mocks")] +/// Applies to Drive a JSON contract from the file system. +pub fn setup_contract( + drive: &Drive, + path: &str, + contract_id: Option<[u8; 32]>, + transaction: TransactionArg, +) -> DataContract { + let platform_version = PlatformVersion::latest(); + let contract = json_document_to_contract_with_ids( + path, + contract_id.map(Identifier::from), + None, + false, //no need to validate the data contracts in tests for drive + platform_version, + ) + .expect("expected to get json based contract"); + + drive + .apply_contract( + &contract, + BlockInfo::default(), + true, + None, + transaction, + platform_version, + ) + .expect("contract should be applied"); + contract +} + +#[cfg(test)] +/// Serializes a hex string to CBOR. +pub fn cbor_from_hex(hex_string: String) -> Vec { + hex::decode(hex_string).expect("Decoding failed") +} + +#[cfg(feature = "server")] +/// Takes a file and returns the lines as a list of strings. +pub fn text_file_strings(path: impl AsRef) -> Vec { + let file = File::open(path).expect("file not found"); + let reader = io::BufReader::new(file).lines(); + reader.into_iter().map(|a| a.unwrap()).collect() +} + +#[cfg(test)] +/// Retrieves the value of a key from a CBOR map. +pub fn get_key_from_cbor_map<'a>( + cbor_map: &'a [(Value, Value)], + key: &'a str, +) -> Option<&'a Value> { + for (cbor_key, cbor_value) in cbor_map.iter() { + if !cbor_key.is_text() { + continue; + } + + if cbor_key.as_text().expect("confirmed as text") == key { + return Some(cbor_value); + } + } + None +} + +#[cfg(test)] +/// Retrieves the value of a key from a CBOR map if it's a map itself. +pub fn cbor_inner_map_value<'a>( + document_type: &'a [(Value, Value)], + key: &'a str, +) -> Option<&'a Vec<(Value, Value)>> { + let key_value = get_key_from_cbor_map(document_type, key)?; + if let Value::Map(map_value) = key_value { + return Some(map_value); + } + None +} diff --git a/packages/rs-drive/src/util/test_helpers/setup.rs b/packages/rs-drive/src/util/test_helpers/setup.rs new file mode 100644 index 00000000000..a9e4cb6aad8 --- /dev/null +++ b/packages/rs-drive/src/util/test_helpers/setup.rs @@ -0,0 +1,109 @@ +//! Drive Setup Helpers. +//! +//! Defines helper functions pertinent to setting up Drive. +//! + +#[cfg(feature = "full")] +use crate::config::DriveConfig; +use crate::drive::Drive; +use dpp::block::block_info::BlockInfo; + +use crate::util::object_size_info::DocumentInfo::DocumentRefInfo; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::data_contract::DataContract; +use dpp::document::Document; + +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; +#[cfg(feature = "full")] +use tempfile::TempDir; + +/// Struct with options regarding setting up fee pools. +pub struct SetupFeePoolsOptions { + /// Bool indicating whether the fee pool structure should be applied upon setup. + pub apply_fee_pool_structure: bool, +} + +impl Default for SetupFeePoolsOptions { + /// The default is true for applying the fee pool structure upon setting up fee pools. + fn default() -> SetupFeePoolsOptions { + SetupFeePoolsOptions { + apply_fee_pool_structure: true, + } + } +} + +#[cfg(feature = "full")] +/// Sets up Drive using a temporary directory and the optionally given Drive configuration settings. +pub fn setup_drive(drive_config: Option) -> Drive { + let tmp_dir = TempDir::new().unwrap(); + + let (drive, _) = Drive::open(tmp_dir, drive_config).expect("should open Drive successfully"); + + drive +} + +#[cfg(feature = "full")] +/// Sets up Drive using a temporary directory and the default initial state structure. +pub fn setup_drive_with_initial_state_structure() -> Drive { + let drive = setup_drive(Some(DriveConfig { + batching_consistency_verification: true, + ..Default::default() + })); + + let platform_version = PlatformVersion::latest(); + drive + .create_initial_state_structure(None, platform_version) + .expect("should create root tree successfully"); + + drive +} + +/// A function to setup system data contract +pub fn setup_system_data_contract( + drive: &Drive, + data_contract: &DataContract, + transaction: TransactionArg, +) { + let platform_version = PlatformVersion::latest(); + drive + .apply_contract( + data_contract, + BlockInfo::default(), + true, + None, + transaction, + platform_version, + ) + .unwrap(); +} + +/// Setup document for a contract +pub fn setup_document( + drive: &Drive, + document: &Document, + data_contract: &DataContract, + document_type: DocumentTypeRef, + transaction: TransactionArg, +) { + let platform_version = PlatformVersion::latest(); + drive + .add_document_for_contract( + DocumentAndContractInfo { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefInfo((document, None)), + owner_id: None, + }, + contract: data_contract, + document_type, + }, + false, + BlockInfo::default(), + true, + transaction, + platform_version, + None, + ) + .unwrap(); +} diff --git a/packages/rs-drive/src/common/identities.rs b/packages/rs-drive/src/util/test_helpers/test_utils/identities.rs similarity index 82% rename from packages/rs-drive/src/common/identities.rs rename to packages/rs-drive/src/util/test_helpers/test_utils/identities.rs index 27f3bcc2b80..ac82a03462b 100644 --- a/packages/rs-drive/src/common/identities.rs +++ b/packages/rs-drive/src/util/test_helpers/test_utils/identities.rs @@ -1,42 +1,13 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Drive Identity Helpers. //! //! This module defines helper functions pertinent to identities in Drive. //! -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::GroveDbOpBatch; +use crate::drive::credit_pools::epochs::operations_factory::EpochOperations; use crate::drive::Drive; use crate::error::Error; -use crate::fee_pools::epochs::operations_factory::EpochOperations; +use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +use crate::util::batch::GroveDbOpBatch; use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; use dpp::identifier::Identifier; diff --git a/packages/rs-drive/src/util/test_helpers/test_utils/mod.rs b/packages/rs-drive/src/util/test_helpers/test_utils/mod.rs new file mode 100644 index 00000000000..c37264c43a4 --- /dev/null +++ b/packages/rs-drive/src/util/test_helpers/test_utils/mod.rs @@ -0,0 +1 @@ +pub mod identities; diff --git a/packages/rs-drive/src/util/type_constants.rs b/packages/rs-drive/src/util/type_constants.rs new file mode 100644 index 00000000000..bd551f6a5c3 --- /dev/null +++ b/packages/rs-drive/src/util/type_constants.rs @@ -0,0 +1,28 @@ +/// Default hash size +pub const DEFAULT_HASH_SIZE: u32 = 32; +/// Default hash size +pub const DEFAULT_HASH_SIZE_USIZE: usize = 32; +/// Default hash 160 size as u8 +pub const DEFAULT_HASH_160_SIZE_U8: u8 = 20; +/// Default hash size as u8 +pub const DEFAULT_HASH_SIZE_U8: u8 = 32; +/// Default hash size as u16 +pub const DEFAULT_HASH_SIZE_U16: u16 = 32; +/// Default hash size as u32 +pub const DEFAULT_HASH_SIZE_U32: u32 = 32; +/// Default float size +pub const DEFAULT_FLOAT_SIZE: u32 = 8; +/// u64 size +pub const U64_SIZE_U16: u16 = 8; +/// u64 size +pub const U64_SIZE_U8: u8 = 8; +/// u32 size +pub const U32_SIZE_U16: u16 = 4; +/// u8 size +pub const U8_SIZE_U8: u8 = 1; +/// u32 size +pub const U8_SIZE_U32: u32 = 1; +/// u32 size +pub const U32_SIZE_U8: u8 = 4; +/// Default float size as u8 +pub const DEFAULT_FLOAT_SIZE_U8: u8 = 8; diff --git a/packages/rs-drive/src/drive/verify/contract/mod.rs b/packages/rs-drive/src/verify/contract/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/verify/contract/mod.rs rename to packages/rs-drive/src/verify/contract/mod.rs diff --git a/packages/rs-drive/src/verify/contract/verify_contract/mod.rs b/packages/rs-drive/src/verify/contract/verify_contract/mod.rs new file mode 100644 index 00000000000..441ccd755ba --- /dev/null +++ b/packages/rs-drive/src/verify/contract/verify_contract/mod.rs @@ -0,0 +1,66 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; +use dpp::data_contract::DataContract; +use dpp::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Verifies that the contract is included in the proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `contract_known_keeps_history`: An optional boolean indicating whether the contract keeps a history. + /// - `is_proof_subset`: A boolean indicating whether to verify a subset of a larger proof. + /// - `in_multiple_contract_proof_form`: If the contract proof was made by proving many contracts, the form + /// of the proof will be different. We will be querying the contract id with a translation to 0 for non + /// historical and 0/0 for historical contracts. When you query a single contract you query directly on the item + /// 0 under the contract id you care about. + /// - `contract_id`: The contract's unique identifier. + /// - `platform_version`: the platform version, + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` + /// represents the verified contract if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + pub fn verify_contract( + proof: &[u8], + contract_known_keeps_history: Option, + is_proof_subset: bool, + in_multiple_contract_proof_form: bool, + contract_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .contract + .verify_contract + { + 0 => Drive::verify_contract_v0( + proof, + contract_known_keeps_history, + is_proof_subset, + in_multiple_contract_proof_form, + contract_id, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_contract".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/contract/verify_contract/v0/mod.rs b/packages/rs-drive/src/verify/contract/verify_contract/v0/mod.rs new file mode 100644 index 00000000000..3d47e9504ee --- /dev/null +++ b/packages/rs-drive/src/verify/contract/verify_contract/v0/mod.rs @@ -0,0 +1,264 @@ +use std::collections::BTreeMap; + +use crate::drive::contract::paths::{contract_keeping_history_root_path, contract_root_path}; +use crate::drive::Drive; +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::error::Error::GroveDB; +use crate::verify::RootHash; +use dpp::prelude::DataContract; +use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; +use platform_version::version::PlatformVersion; + +use crate::error::query::QuerySyntaxError; +use grovedb::GroveDb; + +impl Drive { + /// Verifies that the contract is included in the proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `contract_known_keeps_history`: An optional boolean indicating whether the contract keeps a history. + /// - `is_proof_subset`: A boolean indicating whether to verify a subset of a larger proof. + /// - `contract_id`: The contract's unique identifier. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` + /// represents the verified contract if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + #[inline(always)] + pub(crate) fn verify_contract_v0( + proof: &[u8], + contract_known_keeps_history: Option, + is_proof_subset: bool, + in_multiple_contract_proof_form: bool, + contract_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let path_query = match ( + in_multiple_contract_proof_form, + contract_known_keeps_history.unwrap_or_default(), + ) { + (true, true) => Self::fetch_historical_contracts_query(&[contract_id]), + (true, false) => Self::fetch_non_historical_contracts_query(&[contract_id]), + (false, true) => Self::fetch_contract_with_history_latest_query(contract_id, true), + (false, false) => Self::fetch_contract_query(contract_id, true), + }; + + tracing::trace!(?path_query, "verify contract"); + + let result = if is_proof_subset { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + ) + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + ) + }; + let (root_hash, mut proved_key_values) = match result.map_err(GroveDB) { + Ok(ok_result) => ok_result, + Err(e) => { + return if contract_known_keeps_history.is_none() { + tracing::debug!(?path_query,error=?e, "retrying contract verification with history enabled"); + // most likely we are trying to prove a historical contract + Self::verify_contract( + proof, + Some(true), + is_proof_subset, + in_multiple_contract_proof_form, + contract_id, + platform_version, + ) + } else { + Err(e) + }; + } + }; + if proved_key_values.is_empty() { + return Err(Error::Proof(ProofError::WrongElementCount { + expected: 1, + got: proved_key_values.len(), + })); + } + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = proved_key_values.remove(0); + if contract_known_keeps_history.unwrap_or_default() { + if path != contract_keeping_history_root_path(&contract_id) { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path for the historical contract".to_string(), + ))); + } + } else if path != contract_root_path(&contract_id) { + if key != vec![0] { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct key for the contract" + .to_string(), + ))); + } + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path for the historical contract".to_string(), + ))); + }; + tracing::trace!(?maybe_element, "verify contract returns proved element"); + + let contract = maybe_element + .map(|element| { + element + .into_item_bytes() + .map_err(Error::GroveDB) + .and_then(|bytes| { + // we don't need to validate the contract locally because it was proved to be in platform + // and hence it is valid + DataContract::versioned_deserialize(&bytes, false, platform_version) + .map_err(Error::Protocol) + }) + }) + .transpose(); + match contract { + Ok(contract) => Ok((root_hash, contract)), + Err(e) => { + if contract_known_keeps_history.is_some() { + // just return error + Err(e) + } else { + tracing::debug!(?path_query,error=?e, "retry contract verification with history enabled"); + Self::verify_contract( + proof, + Some(true), + is_proof_subset, + in_multiple_contract_proof_form, + contract_id, + platform_version, + ) + } + } + } + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected one contract id", + ))) + } + } + + /// Verifies that the contracts is included in the proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `is_proof_subset`: A boolean indicating whether to verify a subset of a larger proof. + /// - `contract_ids_with_keeps_history` a BTreemap with keys being the contract ids we are looking + /// to search for, values being if they keep history. For this call we must know if they keep + /// history. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` + /// represents the verified contract if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + pub fn verify_contracts( + proof: &[u8], + _is_proof_subset: bool, //this will be used later + contract_ids: &[[u8; 32]], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, BTreeMap<[u8; 32], Option>), Error> { + let request_len = contract_ids.len(); + + if request_len == 0 { + return Err(Error::Query(QuerySyntaxError::NoQueryItems( + "we didn't query anything", + ))); + } + + let mut contracts = BTreeMap::new(); + + let mut returned_root_hash = None; + + for contract_id in contract_ids { + let (root_hash, contract) = + Self::verify_contract(proof, None, true, true, *contract_id, platform_version)?; + returned_root_hash = Some(root_hash); + contracts.insert(*contract_id, contract); + } + + // let mut contracts_query = Self::fetch_contracts_query( + // non_historical_contracts.as_slice(), + // historical_contracts.as_slice(), + // )?; + // + // contracts_query.query.limit = Some(request_len as u16); + // + // //todo: we are currently not proving succintness, a new method is required in grovedb + // let (root_hash, mut proved_key_values) = GroveDb::verify_subset_query_with_absence_proof(proof, &contracts_query)?; + // + // let contracts = proved_key_values.into_iter().map(|(path, key, maybe_element) | { + // let last_part = path.last().ok_or(Error::Proof(ProofError::CorruptedProof( + // "path of a proved item was empty".to_string(), + // )))?; + // let (contract_id, contract_keeps_history) = if last_part.len() == 32 { // non history + // let contract_id : [u8;32] = last_part.clone().try_into().expect("expected 32 bytes"); + // (contract_id, false) + // } else { + // if path.len() == 0 { + // return Err(Error::Proof(ProofError::CorruptedProof( + // "path of a proved item wasn't big enough".to_string(), + // ))); + // } + // let before_last_part = path.get(path.len() - 2).ok_or(Error::Proof(ProofError::CorruptedProof( + // "we got back an invalid proof, the path was empty".to_string(), + // )))?; + // if before_last_part.len() != 32 { + // return Err(Error::Proof(ProofError::CorruptedProof( + // "the contract id wasn't 32 bytes".to_string(), + // ))); + // } + // // otherwise the key is the time and the previous to last member of the path is the contract id + // let before_last_part : [u8;32] = before_last_part.clone().try_into().expect("expected 32 bytes"); + // (before_last_part, true) + // }; + // if contract_keeps_history { + // if path != contract_keeping_history_storage_path(&contract_id) { + // return Err(Error::Proof(ProofError::CorruptedProof( + // format!("we did not get back an element for the correct path for the historical contract, received: ({})", path.iter().map(|a| a.to_hex()).collect::>().join("|")), + // ))); + // } + // } else if path != contract_root_path(&contract_id) { + // return Err(Error::Proof(ProofError::CorruptedProof( + // format!("we did not get back an element for the correct path for the non historical contract, received: ({})", path.iter().map(|a| a.to_hex()).collect::>().join("|")), + // ))); + // }; + // + // let contract = maybe_element + // .map(|element| { + // element + // .into_item_bytes() + // .map_err(Error::GroveDB) + // .and_then(|bytes| { + // DataContract::deserialize_no_limit(&bytes).map_err(Error::Protocol) + // }) + // }) + // .transpose()?; + // Ok((root_hash, contract)) + // }).collect::>, Error>>()?; + + Ok((returned_root_hash.unwrap(), contracts)) + } +} diff --git a/packages/rs-drive/src/verify/contract/verify_contract_history/mod.rs b/packages/rs-drive/src/verify/contract/verify_contract_history/mod.rs new file mode 100644 index 00000000000..3dcd0ed3389 --- /dev/null +++ b/packages/rs-drive/src/verify/contract/verify_contract_history/mod.rs @@ -0,0 +1,65 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; +use dpp::data_contract::DataContract; +use dpp::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// Verifies that the contract's history is included in the proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `contract_id`: The contract's unique identifier. + /// - `start_at_date`: The start date for the contract's history. + /// - `limit`: An optional limit for the number of items to be retrieved. + /// - `offset`: An optional offset for the items to be retrieved. + /// - `platform_version`: The platform version. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` + /// represents a mapping from dates to contracts if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + /// - The contract serialization fails. + pub fn verify_contract_history( + proof: &[u8], + contract_id: [u8; 32], + start_at_date: u64, + limit: Option, + offset: Option, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option>), Error> { + match platform_version + .drive + .methods + .verify + .contract + .verify_contract_history + { + 0 => Drive::verify_contract_history_v0( + proof, + contract_id, + start_at_date, + limit, + offset, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_contract_history".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/contract/verify_contract_history/v0/mod.rs b/packages/rs-drive/src/verify/contract/verify_contract_history/v0/mod.rs new file mode 100644 index 00000000000..9ce908c3cd5 --- /dev/null +++ b/packages/rs-drive/src/verify/contract/verify_contract_history/v0/mod.rs @@ -0,0 +1,93 @@ +use crate::drive::contract::paths::contract_storage_path_vec; +use crate::drive::Drive; +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::verify::RootHash; + +use dpp::prelude::DataContract; +use std::collections::BTreeMap; + +use crate::error::drive::DriveError; +use crate::util::common::decode; +use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; +use dpp::version::PlatformVersion; +use grovedb::GroveDb; + +impl Drive { + /// Verifies that the contract's history is included in the proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `contract_id`: The contract's unique identifier. + /// - `start_at_date`: The start date for the contract's history. + /// - `limit`: An optional limit for the number of items to be retrieved. + /// - `offset`: An optional offset for the items to be retrieved. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` + /// represents a mapping from dates to contracts if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + /// - The contract serialization fails. + #[inline(always)] + pub(crate) fn verify_contract_history_v0( + proof: &[u8], + contract_id: [u8; 32], + start_at_date: u64, + limit: Option, + offset: Option, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option>), Error> { + let path_query = + Self::fetch_contract_history_query(contract_id, start_at_date, limit, offset)?; + + let (root_hash, mut proved_key_values) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + + let mut contracts: BTreeMap = BTreeMap::new(); + for (path, key, maybe_element) in proved_key_values.drain(..) { + if path != contract_storage_path_vec(&contract_id) { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path for the historical contract".to_string(), + ))); + } + + let date = decode::decode_u64(&key).map_err(|_| { + Error::Drive(DriveError::CorruptedContractPath( + "contract key is not a valid u64", + )) + })?; + + let maybe_contract = maybe_element + .map(|element| { + element + .into_item_bytes() + .map_err(Error::GroveDB) + .and_then(|bytes| { + // we don't need to validate the contract locally because it was proved to be in platform + // and hence it is valid + DataContract::versioned_deserialize(&bytes, false, platform_version) + .map_err(Error::Protocol) + }) + }) + .transpose()?; + + if let Some(contract) = maybe_contract { + contracts.insert(date, contract); + } else { + return Err(Error::Drive(DriveError::CorruptedContractPath( + "expected a contract at this path", + ))); + } + } + + Ok((root_hash, Some(contracts))) + } +} diff --git a/packages/rs-drive/src/drive/verify/document/mod.rs b/packages/rs-drive/src/verify/document/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/verify/document/mod.rs rename to packages/rs-drive/src/verify/document/mod.rs diff --git a/packages/rs-drive/src/verify/document/verify_proof/mod.rs b/packages/rs-drive/src/verify/document/verify_proof/mod.rs new file mode 100644 index 00000000000..efa55178df7 --- /dev/null +++ b/packages/rs-drive/src/verify/document/verify_proof/mod.rs @@ -0,0 +1,48 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; + +use crate::error::Error; +use crate::query::DriveDocumentQuery; +use dpp::document::Document; + +use dpp::version::PlatformVersion; + +impl<'a> DriveDocumentQuery<'a> { + /// Verifies a proof for a collection of documents. + /// + /// This function takes a byte slice representing the serialized proof, verifies it, and returns a tuple consisting of the root hash + /// and a vector of deserialized documents. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `platform_version` - The platform version against which to verify the proof. + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or a deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. A deserialization error occurs when parsing the serialized document(s). + pub fn verify_proof( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + match platform_version.drive.methods.verify.document.verify_proof { + 0 => self.verify_proof_v0(proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/document/verify_proof/v0/mod.rs b/packages/rs-drive/src/verify/document/verify_proof/v0/mod.rs new file mode 100644 index 00000000000..a9e5d2771c4 --- /dev/null +++ b/packages/rs-drive/src/verify/document/verify_proof/v0/mod.rs @@ -0,0 +1,54 @@ +use crate::verify::RootHash; + +use crate::error::Error; +use crate::query::DriveDocumentQuery; +use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use dpp::document::Document; + +use dpp::version::PlatformVersion; + +impl<'a> DriveDocumentQuery<'a> { + /// Verifies a proof for a collection of documents. + /// + /// This function takes a slice of bytes `proof` containing a serialized proof, + /// verifies it, and returns a tuple consisting of the root hash and a vector of deserialized documents. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `drive_version` - The current active drive version + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s, if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. There is a deserialization error when parsing the serialized document(s) into `Document` struct(s). + #[inline(always)] + pub(crate) fn verify_proof_v0( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + self.verify_proof_keep_serialized(proof, platform_version) + .map(|(root_hash, documents)| { + let documents = documents + .into_iter() + .map(|serialized| { + Document::from_bytes( + serialized.as_slice(), + self.document_type, + platform_version, + ) + .map_err(Error::Protocol) + }) + .collect::, Error>>()?; + Ok((root_hash, documents)) + })? + } +} diff --git a/packages/rs-drive/src/verify/document/verify_proof_keep_serialized/mod.rs b/packages/rs-drive/src/verify/document/verify_proof_keep_serialized/mod.rs new file mode 100644 index 00000000000..19eaf2daba4 --- /dev/null +++ b/packages/rs-drive/src/verify/document/verify_proof_keep_serialized/mod.rs @@ -0,0 +1,48 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; + +use crate::error::Error; +use crate::query::DriveDocumentQuery; + +use dpp::version::PlatformVersion; + +impl<'a> DriveDocumentQuery<'a> { + /// Verifies the given proof and returns the root hash of the GroveDB tree and a vector + /// of serialized documents if the verification is successful. + /// + /// # Arguments + /// * `proof` - A byte slice representing the proof to be verified. + /// * `platform_version` - The platform version against which to verify the proof. + /// + /// # Returns + /// * On success, returns a tuple containing the root hash of the GroveDB tree and a vector of serialized documents. + /// * On failure, returns an Error. + /// + /// # Errors + /// This function will return an Error if: + /// 1. The start at document is not present in proof and it is expected to be. + /// 2. The path query fails to verify against the given proof. + /// 3. Converting the element into bytes fails. + pub fn verify_proof_keep_serialized( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec>), Error> { + match platform_version + .drive + .methods + .verify + .document + .verify_proof_keep_serialized + { + 0 => self.verify_proof_keep_serialized_v0(proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_proof_keep_serialized".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/document/verify_proof_keep_serialized/v0/mod.rs b/packages/rs-drive/src/verify/document/verify_proof_keep_serialized/v0/mod.rs new file mode 100644 index 00000000000..31bcdc941bf --- /dev/null +++ b/packages/rs-drive/src/verify/document/verify_proof_keep_serialized/v0/mod.rs @@ -0,0 +1,55 @@ +use crate::verify::RootHash; + +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::query::DriveDocumentQuery; + +use dpp::version::PlatformVersion; +use grovedb::GroveDb; + +impl<'a> DriveDocumentQuery<'a> { + /// Verifies the given proof and returns the root hash of the GroveDB tree and a vector + /// of serialized documents if the verification is successful. + /// + /// # Arguments + /// * `proof` - A byte slice representing the proof to be verified. + /// + /// # Returns + /// * On success, returns a tuple containing the root hash of the GroveDB tree and a vector of serialized documents. + /// * On failure, returns an Error. + /// + /// # Errors + /// This function will return an Error if: + /// * The start at document is not present in proof and it is expected to be. + /// * The path query fails to verify against the given proof. + /// * Converting the element into bytes fails. + #[inline(always)] + pub(crate) fn verify_proof_keep_serialized_v0( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec>), Error> { + let path_query = if let Some(start_at) = &self.start_at { + let (_, start_document) = + self.verify_start_at_document_in_proof(proof, true, *start_at, platform_version)?; + let document = start_document.ok_or(Error::Proof(ProofError::IncompleteProof( + "expected start at document to be present in proof", + )))?; + self.construct_path_query(Some(document), platform_version) + } else { + self.construct_path_query(None, platform_version) + }?; + let (root_hash, proved_key_values) = if self.start_at.is_some() { + GroveDb::verify_subset_query(proof, &path_query, &platform_version.drive.grove_version)? + } else { + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)? + }; + + let documents = proved_key_values + .into_iter() + .filter_map(|(_path, _key, element)| element) + .map(|element| element.into_item_bytes().map_err(Error::GroveDB)) + .collect::>, Error>>()?; + Ok((root_hash, documents)) + } +} diff --git a/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/mod.rs b/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/mod.rs new file mode 100644 index 00000000000..686be773af5 --- /dev/null +++ b/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/mod.rs @@ -0,0 +1,60 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; + +use crate::error::Error; +use crate::query::DriveDocumentQuery; +use dpp::document::Document; +use dpp::version::PlatformVersion; + +impl<'a> DriveDocumentQuery<'a> { + /// Verifies if a document exists at the beginning of a proof, + /// and returns the root hash and the optionally found document. + /// + /// # Arguments + /// + /// * `proof` - A byte slice containing the proof data. + /// * `is_proof_subset` - A boolean indicating whether the proof is a subset query or not. + /// * `document_id` - A byte_32 array, representing the ID of the document to start at. + /// * `platform_version` - The platform version against which to verify the proof. + /// + /// # Returns + /// + /// A `Result` with a tuple containing: + /// * The root hash of the verified proof. + /// * An `Option` containing the found document if available. + /// + /// # Errors + /// + /// This function returns an Error in the following cases: + /// * If the proof is corrupted (wrong path, wrong key, etc.). + /// * If the provided proof has an incorrect number of elements. + pub fn verify_start_at_document_in_proof( + &self, + proof: &[u8], + is_proof_subset: bool, + document_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .document + .verify_start_at_document_in_proof + { + 0 => self.verify_start_at_document_in_proof_v0( + proof, + is_proof_subset, + document_id, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_start_at_document_in_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/v0/mod.rs b/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/v0/mod.rs new file mode 100644 index 00000000000..592b04ee9db --- /dev/null +++ b/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/v0/mod.rs @@ -0,0 +1,86 @@ +use crate::verify::RootHash; + +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::query::DriveDocumentQuery; +use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use dpp::document::Document; +use dpp::version::PlatformVersion; +use grovedb::{GroveDb, PathQuery}; + +impl<'a> DriveDocumentQuery<'a> { + /// Verifies if a document exists at the beginning of a proof, + /// and returns the root hash and the optionally found document. + /// + /// # Arguments + /// + /// * `proof` - A byte slice containing the proof data. + /// * `is_proof_subset` - A boolean indicating whether the proof is a subset query or not. + /// * `document_id` - A byte_32 array, representing the ID of the document to start at. + /// + /// # Returns + /// + /// A `Result` with a tuple containing: + /// * The root hash of the verified proof. + /// * An `Option` containing the found document if available. + /// + /// # Errors + /// + /// This function returns an Error in the following cases: + /// * If the proof is corrupted (wrong path, wrong key, etc.). + /// * If the provided proof has an incorrect number of elements. + #[inline(always)] + pub(crate) fn verify_start_at_document_in_proof_v0( + &self, + proof: &[u8], + is_proof_subset: bool, + document_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let (start_at_document_path, start_at_document_key) = + self.start_at_document_path_and_key(&document_id); + let path_query = PathQuery::new_single_key( + start_at_document_path.clone(), + start_at_document_key.clone(), + ); + let (root_hash, mut proved_key_values) = if is_proof_subset { + GroveDb::verify_subset_query(proof, &path_query, &platform_version.drive.grove_version)? + } else { + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)? + }; + match proved_key_values.len() { + 1 => { + let (path, key, maybe_element) = proved_key_values.remove(0); + if path != start_at_document_path { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back a document for the correct path".to_string(), + ))); + } + if key != start_at_document_key { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back a document for the correct key".to_string(), + ))); + } + let document = maybe_element + .map(|element| { + let document_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; + Document::from_bytes( + document_bytes.as_slice(), + self.document_type, + platform_version, + ) + .map_err(Error::Protocol) + }) + .transpose()?; + Ok((root_hash, document)) + } + 0 => Err(Error::Proof(ProofError::WrongElementCount { + expected: 1, + got: 0, + })), + _ => Err(Error::Proof(ProofError::TooManyElements( + "expected one document for start at", + ))), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/mod.rs b/packages/rs-drive/src/verify/identity/mod.rs new file mode 100644 index 00000000000..dd24b00f678 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/mod.rs @@ -0,0 +1,13 @@ +mod verify_full_identities_by_public_key_hashes; +mod verify_full_identity_by_identity_id; +mod verify_full_identity_by_public_key_hash; +mod verify_identities_contract_keys; +mod verify_identity_balance_and_revision_for_identity_id; +mod verify_identity_balance_for_identity_id; +mod verify_identity_balances_for_identity_ids; +mod verify_identity_contract_nonce; +mod verify_identity_id_by_public_key_hash; +mod verify_identity_ids_by_public_key_hashes; +mod verify_identity_keys_by_identity_id; +mod verify_identity_nonce; +mod verify_identity_revision_for_identity_id; diff --git a/packages/rs-drive/src/verify/identity/verify_full_identities_by_public_key_hashes/mod.rs b/packages/rs-drive/src/verify/identity/verify_full_identities_by_public_key_hashes/mod.rs new file mode 100644 index 00000000000..7892c47a6c5 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_full_identities_by_public_key_hashes/mod.rs @@ -0,0 +1,71 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +pub use dpp::prelude::Identity; + +use dpp::version::PlatformVersion; + +use std::iter::FromIterator; + +impl Drive { + /// Verifies the full identities of multiple users by their public key hashes. + /// + /// This function takes a byte slice representing the serialized proof and a list of public key hashes. + /// It verifies the full identities and returns a collection of the public key hash and associated identity for each user. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the users. + /// - `public_key_hashes`: A reference to a slice of 20-byte arrays, each representing a hash of a public key of a user. + /// - `platform_version`: The platform version against which to verify the identities. + /// + /// # Generic Parameters + /// + /// - `T`: The type of the collection to hold the results. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and `T`. + /// + /// # Errors + /// + /// This function returns an `Error` variant if: + /// - The proof of authentication is not valid. + /// - Any of the public key hashes do not correspond to a valid identity ID. + /// - Any of the identity IDs do not correspond to a valid full identity. + /// - An unknown or unsupported platform version is provided. + /// + pub fn verify_full_identities_by_public_key_hashes< + T: FromIterator<([u8; 20], Option)>, + >( + proof: &[u8], + public_key_hashes: &[[u8; 20]], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, T), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_full_identities_by_public_key_hashes + { + 0 => Self::verify_full_identities_by_public_key_hashes_v0( + proof, + public_key_hashes, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_full_identities_by_public_key_hashes".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_full_identities_by_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_full_identities_by_public_key_hashes/v0/mod.rs new file mode 100644 index 00000000000..939b76b5a89 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_full_identities_by_public_key_hashes/v0/mod.rs @@ -0,0 +1,78 @@ +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; + +pub use dpp::prelude::Identity; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the full identities of multiple users by their public key hashes. + /// + /// This function is a generalization of `verify_full_identity_by_public_key_hash`, + /// which works with a slice of public key hashes instead of a single hash. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the users. + /// - `public_key_hashes`: A reference to a slice of 20-byte arrays, each representing + /// a hash of a public key of a user. + /// + /// # Generic Parameters + /// + /// - `T`: The type of the collection to hold the results, which must be constructible + /// from an iterator of tuples of a 20-byte array and an optional `Identity`. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and `T`. + /// The `RootHash` represents the root hash of GroveDB, and `T` represents + /// the collection of the public key hash and associated identity (if it exists) for each user. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - Any of the public key hashes do not correspond to a valid identity ID. + /// - Any of the identity IDs do not correspond to a valid full identity. + /// + pub(crate) fn verify_full_identities_by_public_key_hashes_v0< + T: FromIterator<([u8; 20], Option)>, + >( + proof: &[u8], + public_key_hashes: &[[u8; 20]], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, T), Error> { + let (root_hash, identity_ids_by_key_hashes) = + Self::verify_identity_ids_by_public_key_hashes::>( + proof, + true, + public_key_hashes, + platform_version, + )?; + let maybe_identity = identity_ids_by_key_hashes + .into_iter() + .map(|(key_hash, identity_id)| match identity_id { + None => Ok((key_hash, None)), + Some(identity_id) => { + let identity = Self::verify_full_identity_by_identity_id( + proof, + true, + identity_id, + platform_version, + ) + .map(|(_, maybe_identity)| maybe_identity)?; + let identity = identity.ok_or(Error::Proof(ProofError::IncompleteProof( + "proof returned an identity id without identity information", + )))?; + Ok((key_hash, Some(identity))) + } + }) + .collect::>()?; + Ok((root_hash, maybe_identity)) + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_full_identity_by_identity_id/mod.rs b/packages/rs-drive/src/verify/identity/verify_full_identity_by_identity_id/mod.rs new file mode 100644 index 00000000000..5a3059d91e4 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_full_identity_by_identity_id/mod.rs @@ -0,0 +1,66 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +pub use dpp::prelude::Identity; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the full identity of a user by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `platform_version`: The platform version against which to verify the identity. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the full identity of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid full identity. + /// - The balance, revision, or keys information is missing or incorrect. + /// - An unknown or unsupported platform version is provided. + /// + pub fn verify_full_identity_by_identity_id( + proof: &[u8], + is_proof_subset: bool, + identity_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_full_identity_by_identity_id + { + 0 => Self::verify_full_identity_by_identity_id_v0( + proof, + is_proof_subset, + identity_id, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_full_identity_by_identity_id".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_full_identity_by_identity_id/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_full_identity_by_identity_id/v0/mod.rs new file mode 100644 index 00000000000..84e5a768300 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_full_identity_by_identity_id/v0/mod.rs @@ -0,0 +1,141 @@ +use crate::drive::balances::balance_path; + +use crate::drive::identity::IdentityRootStructure::IdentityTreeRevision; +use crate::drive::identity::{identity_key_tree_path, identity_path}; +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; +use dpp::identifier::Identifier; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::{IdentityPublicKey, IdentityV0, KeyID}; +pub use dpp::prelude::{Identity, Revision}; +use dpp::serialization::PlatformDeserializable; +use dpp::version::PlatformVersion; +use grovedb::GroveDb; +use std::collections::BTreeMap; + +impl Drive { + /// Verifies the full identity of a user by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the full identity of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid full identity. + /// - The balance, revision, or keys information is missing or incorrect. + /// + #[inline(always)] + pub(crate) fn verify_full_identity_by_identity_id_v0( + proof: &[u8], + is_proof_subset: bool, + identity_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let path_query = + Self::full_identity_query(&identity_id, &platform_version.drive.grove_version)?; + let (root_hash, proved_key_values) = if is_proof_subset { + GroveDb::verify_subset_query(proof, &path_query, &platform_version.drive.grove_version)? + } else { + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)? + }; + let mut balance = None; + let mut revision = None; + let mut keys = BTreeMap::::new(); + let balance_path = balance_path(); + let identity_path = identity_path(identity_id.as_slice()); + let identity_keys_path = identity_key_tree_path(identity_id.as_slice()); + for proved_key_value in proved_key_values { + let (path, key, maybe_element) = proved_key_value; + if path == balance_path { + if key == identity_id { + if let Some(element) = maybe_element { + //this is the balance + let signed_balance = element.as_sum_item_value().map_err(Error::GroveDB)?; + if signed_balance < 0 { + return Err(Error::Proof(ProofError::Overflow( + "balance can't be negative", + ))); + } + balance = Some(signed_balance as u64); + continue; + } else { + return Err(Error::Proof(ProofError::IncompleteProof( + "balance wasn't provided for the identity requested", + ))); + } + } else { + return Err(Error::Proof(ProofError::CorruptedProof( + "balance wasn't for the identity requested".to_string(), + ))); + } + } else if path == identity_path && key == vec![IdentityTreeRevision as u8] { + if let Some(element) = maybe_element { + let item_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; + //this is the revision + revision = Some(Revision::from_be_bytes(item_bytes.try_into().map_err( + |_| { + Error::Proof(ProofError::IncorrectValueSize( + "revision should be 8 bytes", + )) + }, + )?)); + continue; + } else { + return Err(Error::Proof(ProofError::IncompleteProof( + "revision wasn't provided for the identity requested", + ))); + } + } else if path == identity_keys_path { + if let Some(element) = maybe_element { + let item_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; + let key = IdentityPublicKey::deserialize_from_bytes(&item_bytes)?; + keys.insert(key.id(), key); + } else { + return Err(Error::Proof(ProofError::CorruptedProof( + "we received an absence proof for a key but didn't request one".to_string(), + ))); + } + } else { + return Err(Error::Proof(ProofError::TooManyElements( + "we got back items that we did not request", + ))); + } + } + let maybe_identity = if balance.is_none() && revision.is_none() && keys.is_empty() { + Ok(None) + } else if balance.is_none() || revision.is_none() || keys.is_empty() { + // that means that one has stuff and the others don't + // this is an error + Err(Error::Proof(ProofError::IncompleteProof( + "identity proof is incomplete", + ))) + } else { + Ok(Some( + IdentityV0 { + id: Identifier::from(identity_id), + public_keys: keys, + balance: balance.unwrap(), + revision: revision.unwrap(), + } + .into(), + )) + }?; + Ok((root_hash, maybe_identity)) + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_full_identity_by_public_key_hash/mod.rs b/packages/rs-drive/src/verify/identity/verify_full_identity_by_public_key_hash/mod.rs new file mode 100644 index 00000000000..6ce7cc6f263 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_full_identity_by_public_key_hash/mod.rs @@ -0,0 +1,63 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +pub use dpp::prelude::Identity; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the full identity of a user by their public key hash. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `public_key_hash`: A 20-byte array representing the hash of the public key of the user. + /// - `platform_version`: The platform version against which to verify the identity. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the full identity of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The public key hash does not correspond to a valid identity ID. + /// - The identity ID does not correspond to a valid full identity. + /// - An unknown or unsupported platform version is provided. + /// + pub fn verify_full_identity_by_public_key_hash( + proof: &[u8], + public_key_hash: [u8; 20], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_full_identity_by_public_key_hash + { + 0 => Self::verify_full_identity_by_public_key_hash_v0( + proof, + public_key_hash, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_full_identity_by_public_key_hash".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_full_identity_by_public_key_hash/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_full_identity_by_public_key_hash/v0/mod.rs new file mode 100644 index 00000000000..dd5c1f1ee00 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_full_identity_by_public_key_hash/v0/mod.rs @@ -0,0 +1,66 @@ +use crate::drive::Drive; + +use crate::error::Error; + +use crate::verify::RootHash; + +pub use dpp::prelude::Identity; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the full identity of a user by their public key hash. + /// + /// This function takes a byte slice `proof` and a 20-byte array `public_key_hash` as arguments, + /// then it verifies the identity of the user with the given public key hash. + /// + /// The `proof` should contain the proof of authentication from the user. + /// The `public_key_hash` should contain the hash of the public key of the user. + /// + /// The function first verifies the identity ID associated with the given public key hash + /// by calling `verify_identity_id_by_public_key_hash()`. It then uses this identity ID to verify + /// the full identity by calling `verify_full_identity_by_identity_id()`. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `Identity`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the full identity of the user if it exists. + /// + /// If the verification fails at any point, it will return an `Error`. + /// + /// # Errors + /// + /// This function will return an `Error` if: + /// + /// * The proof of authentication is not valid. + /// * The public key hash does not correspond to a valid identity ID. + /// * The identity ID does not correspond to a valid full identity. + /// + #[inline(always)] + pub(crate) fn verify_full_identity_by_public_key_hash_v0( + proof: &[u8], + public_key_hash: [u8; 20], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let (root_hash, identity_id) = Self::verify_identity_id_by_public_key_hash( + proof, + true, + public_key_hash, + platform_version, + )?; + let maybe_identity = identity_id + .map(|identity_id| { + Self::verify_full_identity_by_identity_id( + proof, + true, + identity_id, + platform_version, + ) + .map(|(_, maybe_identity)| maybe_identity) + }) + .transpose()? + .flatten(); + Ok((root_hash, maybe_identity)) + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identities_contract_keys/mod.rs b/packages/rs-drive/src/verify/identity/verify_identities_contract_keys/mod.rs new file mode 100644 index 00000000000..9e18c30cf9b --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identities_contract_keys/mod.rs @@ -0,0 +1,71 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::identity::identities_contract_keys::IdentitiesContractKeys; +use dpp::identity::Purpose; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the identity keys of a user by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `platform_version`: The platform version against which to verify the identity keys. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `PartialIdentity`. The `RootHash` represents the root hash of GroveDB, + /// and the `Option` represents the partial identity of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - An unknown or unsupported platform version is provided. + /// - Any other error as documented in the specific versioned function. + /// + pub fn verify_identities_contract_keys( + proof: &[u8], + identity_ids: &[[u8; 32]], + contract_id: &[u8; 32], + document_type_name: Option, + purposes: Vec, + is_proof_subset: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, IdentitiesContractKeys), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identities_contract_keys + { + 0 => Self::verify_identities_contract_keys_v0( + proof, + identity_ids, + contract_id, + document_type_name, + purposes, + is_proof_subset, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identities_contract_keys".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identities_contract_keys/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identities_contract_keys/v0/mod.rs new file mode 100644 index 00000000000..1b8cc605eb3 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identities_contract_keys/v0/mod.rs @@ -0,0 +1,123 @@ +use crate::drive::Drive; + +use crate::error::Error; + +use crate::verify::RootHash; +use dpp::identifier::Identifier; +use dpp::identity::{IdentityPublicKey, Purpose}; + +use crate::error::drive::DriveError; +use dpp::identity::identities_contract_keys::IdentitiesContractKeys; +use dpp::serialization::PlatformDeserializable; +use dpp::version::PlatformVersion; +use grovedb::GroveDb; +use std::collections::BTreeMap; + +impl Drive { + /// Verifies the identity keys of a user by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `PartialIdentity`. The `RootHash` represents the root hash of GroveDB, + /// and the `Option` represents the partial identity of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid partial identity. + /// - The keys information is missing or incorrect. + /// + #[inline(always)] + pub(crate) fn verify_identities_contract_keys_v0( + proof: &[u8], + identity_ids: &[[u8; 32]], + contract_id: &[u8; 32], + document_type_name: Option, + purposes: Vec, + is_proof_subset: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, IdentitiesContractKeys), Error> { + let path_query = Self::identities_contract_keys_query( + identity_ids, + contract_id, + &document_type_name, + &purposes, + Some((identity_ids.len() * purposes.len()) as u16), + ); + + let (root_hash, proved_values) = if is_proof_subset { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + + let mut group_id = contract_id.to_vec(); + if let Some(document_type_name) = document_type_name { + group_id.extend(document_type_name.as_bytes()); + } + + let mut values = BTreeMap::new(); + + for (path, _, maybe_element) in proved_values { + if let Some(identity_id_bytes) = path.get(1) { + let identity_id = Identifier::from_vec(identity_id_bytes.to_owned())?; + // We can use expect here because we have already shown that the path must have + // at least 2 sub parts as we get index 1 + let purpose_bytes = path.last().expect("last path element is the purpose"); + if purpose_bytes.len() != 1 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "purpose for identifier {} at path {} is {}, should be 1 byte", + identity_id, + path.iter().map(hex::encode).collect::>().join("/"), + hex::encode(purpose_bytes) + )))); + } + + let purpose_first_byte = purpose_bytes + .first() + .expect("we have already shown there is 1 byte"); + + let purpose = Purpose::try_from(*purpose_first_byte).map_err(|e| { + Error::Drive(DriveError::CorruptedDriveState(format!( + "purpose for identifier {} at path {} has error : {}", + identity_id, + path.iter().map(hex::encode).collect::>().join("/"), + e + ))) + })?; + + let entry = values.entry(identity_id).or_insert(BTreeMap::new()); + + let maybe_item_bytes = maybe_element + .as_ref() + .map(|element| element.as_item_bytes()) + .transpose()?; + + let maybe_identity_public_key = maybe_item_bytes + .map(IdentityPublicKey::deserialize_from_bytes) + .transpose()?; + + entry.insert(purpose, maybe_identity_public_key); + } + } + + Ok((root_hash, values)) + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_balance_and_revision_for_identity_id/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_balance_and_revision_for_identity_id/mod.rs new file mode 100644 index 00000000000..e084dffc38f --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_balance_and_revision_for_identity_id/mod.rs @@ -0,0 +1 @@ +mod v0; diff --git a/packages/rs-drive/src/verify/identity/verify_identity_balance_and_revision_for_identity_id/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_balance_and_revision_for_identity_id/v0/mod.rs new file mode 100644 index 00000000000..88f7350d900 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_balance_and_revision_for_identity_id/v0/mod.rs @@ -0,0 +1,79 @@ +use crate::verify::RootHash; +use crate::{ + drive::Drive, + error::{proof::ProofError, Error}, +}; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the balance and the reviof an identity by their identity ID. + /// + /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the balance and the revision, but here we are only interested + /// in verifying the balance. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid balance. + /// - The proved key value is not for the correct path or key in balances. + /// - More than one balance is found. + pub fn verify_identity_balance_and_revision_for_identity_id( + proof: &[u8], + identity_id: [u8; 32], + _verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option<(u64, u64)>), Error> { + let (root_hash_0, signed_balance) = Self::verify_identity_balance_for_identity_id_v0( + proof, + identity_id, + true, + platform_version, + )?; + + let (root_hash_1, revision) = Self::verify_identity_revision_for_identity_id_v0( + proof, + identity_id, + true, + platform_version, + )?; + + if root_hash_0 != root_hash_1 { + return Err(Error::Proof(ProofError::CorruptedProof( + "root hash of balance and root hash for revision do not match".to_string(), + ))); + } + + if signed_balance.is_some() && revision.is_none() { + return Err(Error::Proof(ProofError::CorruptedProof( + "we got back a balance but no revision".to_string(), + ))); + } + + if revision.is_some() && signed_balance.is_none() { + return Err(Error::Proof(ProofError::CorruptedProof( + "we got back a revision but no balance".to_string(), + ))); + } + + if let Some(signed_balance) = signed_balance { + Ok((root_hash_0, Some((signed_balance, revision.unwrap())))) + } else { + Ok((root_hash_0, None)) + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_balance_for_identity_id/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_balance_for_identity_id/mod.rs new file mode 100644 index 00000000000..5dc2788f85b --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_balance_for_identity_id/mod.rs @@ -0,0 +1,63 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an identity by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `platform_version`: The platform version against which to verify the identity balance. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid balance. + /// - An unknown or unsupported platform version is provided. + /// + pub fn verify_identity_balance_for_identity_id( + proof: &[u8], + identity_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identity_balance_for_identity_id + { + 0 => Self::verify_identity_balance_for_identity_id_v0( + proof, + identity_id, + verify_subset_of_proof, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_balance_for_identity_id".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_balance_for_identity_id/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_balance_for_identity_id/v0/mod.rs new file mode 100644 index 00000000000..91712e7d409 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_balance_for_identity_id/v0/mod.rs @@ -0,0 +1,94 @@ +use crate::drive::balances::balance_path; + +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; + +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an identity by their identity ID. + /// + /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the balance and the revision, but here we are only interested + /// in verifying the balance. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid balance. + /// - The proved key value is not for the correct path or key in balances. + /// - More than one balance is found. + /// + pub(crate) fn verify_identity_balance_for_identity_id_v0( + proof: &[u8], + identity_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let mut path_query = Self::identity_balance_query(&identity_id); + path_query.query.limit = Some(1); + let (root_hash, mut proved_key_values) = if verify_subset_of_proof { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = &proved_key_values.remove(0); + if path != &balance_path() { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path in balances".to_string(), + ))); + } + if key != &identity_id { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct key in balances".to_string(), + ))); + } + + let signed_balance = maybe_element + .as_ref() + .map(|element| { + element + .as_sum_item_value() + .map_err(Error::GroveDB)? + .try_into() + .map_err(|_| { + Error::Proof(ProofError::IncorrectValueSize("value size is incorrect")) + }) + }) + .transpose()?; + Ok((root_hash, signed_balance)) + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected one identity balance", + ))) + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_balances_for_identity_ids/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_balances_for_identity_ids/mod.rs new file mode 100644 index 00000000000..108efea2378 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_balances_for_identity_ids/mod.rs @@ -0,0 +1,68 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; +use dpp::fee::Credits; + +use crate::verify::RootHash; + +use dpp::version::PlatformVersion; + +use std::iter::FromIterator; + +impl Drive { + /// Verifies the balances of multiple identities by their identity IDs. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proofs of authentication from the users. + /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `identity_ids`: A slice of 32-byte arrays representing the identity IDs of the users. + /// - `platform_version`: The platform version against which to verify the balances. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// a generic collection `T` of tuples. Each tuple in `T` consists of a 32-byte array + /// representing an identity ID and an `Option`. The `Option` represents + /// the balance of the respective identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - An unknown or unsupported platform version is provided. + /// - Any other error as documented in the specific versioned function. + /// + pub fn verify_identity_balances_for_identity_ids< + T: FromIterator<([u8; 32], Option)>, + >( + proof: &[u8], + is_proof_subset: bool, + identity_ids: &[[u8; 32]], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, T), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identity_balances_for_identity_ids + { + 0 => Self::verify_identity_balances_for_identity_ids_v0::( + proof, + is_proof_subset, + identity_ids, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_balances_for_identity_ids".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_balances_for_identity_ids/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_balances_for_identity_ids/v0/mod.rs new file mode 100644 index 00000000000..ac5d2114708 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_balances_for_identity_ids/v0/mod.rs @@ -0,0 +1,101 @@ +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; +use dpp::fee::Credits; + +use crate::verify::RootHash; + +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the balances of multiple identities by their identity IDs. + /// + /// `is_proof_subset` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the balances and revisions, but here we are only + /// interested in verifying the balances. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proofs of authentication from the users. + /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `identity_ids`: A slice of 32-byte arrays representing the identity IDs of the users. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// a generic collection `T` of tuples. Each tuple in `T` consists of a 32-byte array + /// representing an identity ID and an `Option`. The `Option` represents + /// the balance of the respective identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - Any of the identity IDs does not correspond to a valid balance. + /// - The number of proved key values does not match the number of identity IDs provided. + /// - The value size of the balance is incorrect. + /// + pub(crate) fn verify_identity_balances_for_identity_ids_v0< + T: FromIterator<([u8; 32], Option)>, + >( + proof: &[u8], + is_proof_subset: bool, + identity_ids: &[[u8; 32]], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, T), Error> { + let mut path_query = Self::balances_for_identity_ids_query( + identity_ids, + &platform_version.drive.grove_version, + )?; + path_query.query.limit = Some(identity_ids.len() as u16); + let (root_hash, proved_key_values) = if is_proof_subset { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == identity_ids.len() { + let values = proved_key_values + .into_iter() + .map(|proved_key_value| { + let key: [u8; 32] = proved_key_value + .1 + .try_into() + .map_err(|_| Error::Proof(ProofError::IncorrectValueSize("value size")))?; + let maybe_element = proved_key_value.2; + match maybe_element { + None => Ok((key, None)), + Some(element) => { + let balance: Credits = element + .as_sum_item_value() + .map_err(Error::GroveDB)? + .try_into() + .map_err(|_| { + Error::Proof(ProofError::IncorrectValueSize( + "balance was negative", + )) + })?; + Ok((key, Some(balance))) + } + } + }) + .collect::>()?; + Ok((root_hash, values)) + } else { + Err(Error::Proof(ProofError::WrongElementCount { + expected: identity_ids.len(), + got: proved_key_values.len(), + })) + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_contract_nonce/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..8b43d5bfe07 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_contract_nonce/mod.rs @@ -0,0 +1,64 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an identity by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `contract_id`: A 32-byte array representing the contract ID that the nonce is for. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `platform_version`: The platform version against which to verify the identity balance. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// + pub fn verify_identity_contract_nonce( + proof: &[u8], + identity_id: [u8; 32], + contract_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identity_contract_nonce + { + 0 => Self::verify_identity_contract_nonce_v0( + proof, + identity_id, + contract_id, + verify_subset_of_proof, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_contract_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_contract_nonce/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..8e8da0eb938 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_contract_nonce/v0/mod.rs @@ -0,0 +1,95 @@ +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; + +use crate::drive::identity::contract_info::ContractInfoStructure::IdentityContractNonceKey; +use crate::drive::identity::identity_contract_info_group_path_vec; +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an identity by their identity ID. + /// + /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the balance and the revision, but here we are only interested + /// in verifying the balance. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `contract_id`: A 32-byte array representing the contract ID that the nonce is for. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid identity. + /// + pub(crate) fn verify_identity_contract_nonce_v0( + proof: &[u8], + identity_id: [u8; 32], + contract_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let mut path_query = Self::identity_contract_nonce_query(identity_id, contract_id); + path_query.query.limit = Some(1); + let (root_hash, mut proved_key_values) = if verify_subset_of_proof { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = proved_key_values.remove(0); + if path != identity_contract_info_group_path_vec(&identity_id, contract_id.as_slice()) { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path for the identity contract nonce".to_string(), + ))); + } + if key != vec![IdentityContractNonceKey as u8] { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct key for the identity contract nonce".to_string(), + ))); + } + + let identity_contract_nonce = maybe_element + .map(|element| { + let bytes: [u8; 8] = element + .into_item_bytes() + .map_err(Error::GroveDB)? + .try_into() + .map_err(|_| { + Error::Proof(ProofError::IncorrectValueSize("value size is incorrect")) + })?; + + Ok::(u64::from_be_bytes(bytes)) + }) + .transpose()?; + Ok((root_hash, identity_contract_nonce)) + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected one identity contract nonce", + ))) + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_id_by_public_key_hash/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_id_by_public_key_hash/mod.rs new file mode 100644 index 00000000000..75182ffeefc --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_id_by_public_key_hash/mod.rs @@ -0,0 +1,62 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the identity ID of a user by their public key hash. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `public_key_hash`: A 20-byte array representing the hash of the public key of the user. + /// - `platform_version`: The platform version against which to verify the identity ID. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of a 32-byte array. The `RootHash` represents the root hash of GroveDB, + /// and the `Option<[u8; 32]>` represents the identity ID of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - An unknown or unsupported platform version is provided. + /// - Any other error as documented in the specific versioned function. + /// + pub fn verify_identity_id_by_public_key_hash( + proof: &[u8], + is_proof_subset: bool, + public_key_hash: [u8; 20], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option<[u8; 32]>), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identity_id_by_public_key_hash + { + 0 => Self::verify_identity_id_by_public_key_hash_v0( + proof, + is_proof_subset, + public_key_hash, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_id_by_public_key_hash".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_id_by_public_key_hash/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_id_by_public_key_hash/v0/mod.rs new file mode 100644 index 00000000000..1f586154044 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_id_by_public_key_hash/v0/mod.rs @@ -0,0 +1,90 @@ +use crate::drive::{unique_key_hashes_tree_path_vec, Drive}; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; + +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the identity ID of a user by their public key hash. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `public_key_hash`: A 20-byte array representing the hash of the public key of the user. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of a 32-byte array. The `RootHash` represents the root hash of GroveDB, + /// and the `Option<[u8; 32]>` represents the identity ID of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The public key hash does not correspond to a valid identity ID. + /// - The proved key value is not for the correct path or key in unique key hashes. + /// - More than one identity ID is found. + /// + #[inline(always)] + pub(crate) fn verify_identity_id_by_public_key_hash_v0( + proof: &[u8], + is_proof_subset: bool, + public_key_hash: [u8; 20], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option<[u8; 32]>), Error> { + let mut path_query = Self::identity_id_by_unique_public_key_hash_query(public_key_hash); + path_query.query.limit = Some(1); + let (root_hash, mut proved_key_values) = if is_proof_subset { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = proved_key_values.remove(0); + if path != unique_key_hashes_tree_path_vec() { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path in unique key hashes" + .to_string(), + ))); + } + if key != public_key_hash { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct key in unique key hashes" + .to_string(), + ))); + } + let identity_id = maybe_element + .map(|element| { + element + .into_item_bytes() + .map_err(Error::GroveDB)? + .try_into() + .map_err(|_| { + Error::Proof(ProofError::IncorrectValueSize("value size is incorrect")) + }) + }) + .transpose()?; + Ok((root_hash, identity_id)) + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected maximum one identity id", + ))) + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_ids_by_public_key_hashes/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_ids_by_public_key_hashes/mod.rs new file mode 100644 index 00000000000..20a9d98c3d8 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_ids_by_public_key_hashes/mod.rs @@ -0,0 +1,67 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::version::PlatformVersion; + +use std::iter::FromIterator; + +impl Drive { + /// Verifies the identity IDs of multiple identities by their public key hashes. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proofs of authentication from the users. + /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `public_key_hashes`: A slice of 20-byte arrays representing the public key hashes of the users. + /// - `platform_version`: The platform version against which to verify the identity IDs. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// a generic collection `T` of tuples. Each tuple in `T` consists of a 20-byte array + /// representing a public key hash and an `Option<[u8; 32]>`. The `Option<[u8; 32]>` represents + /// the identity ID of the respective identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - An unknown or unsupported platform version is provided. + /// - Any other error as documented in the specific versioned function. + /// + pub fn verify_identity_ids_by_public_key_hashes< + T: FromIterator<([u8; 20], Option<[u8; 32]>)>, + >( + proof: &[u8], + is_proof_subset: bool, + public_key_hashes: &[[u8; 20]], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, T), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identity_ids_by_public_key_hashes + { + 0 => Self::verify_identity_ids_by_public_key_hashes_v0( + proof, + is_proof_subset, + public_key_hashes, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_ids_by_public_key_hashes".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_ids_by_public_key_hashes/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_ids_by_public_key_hashes/v0/mod.rs new file mode 100644 index 00000000000..6d1c6dc7d85 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_ids_by_public_key_hashes/v0/mod.rs @@ -0,0 +1,97 @@ +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; + +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the identity IDs of multiple identities by their public key hashes. + /// + /// `is_proof_subset` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the identity IDs and revisions, but here we are only + /// interested in verifying the identity IDs. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proofs of authentication from the users. + /// - `is_proof_subset`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `public_key_hashes`: A slice of 20-byte arrays representing the public key hashes of the users. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// a generic collection `T` of tuples. Each tuple in `T` consists of a 20-byte array + /// representing a public key hash and an `Option<[u8; 32]>`. The `Option<[u8; 32]>` represents + /// the identity ID of the respective identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - Any of the public key hashes does not correspond to a valid identity ID. + /// - The number of proved key values does not match the number of public key hashes provided. + /// - The value size of the identity ID is incorrect. + /// + pub(crate) fn verify_identity_ids_by_public_key_hashes_v0< + T: FromIterator<([u8; 20], Option<[u8; 32]>)>, + >( + proof: &[u8], + is_proof_subset: bool, + public_key_hashes: &[[u8; 20]], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, T), Error> { + let mut path_query = Self::identity_ids_by_unique_public_key_hash_query(public_key_hashes); + path_query.query.limit = Some(public_key_hashes.len() as u16); + let (root_hash, proved_key_values) = if is_proof_subset { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == public_key_hashes.len() { + let values = proved_key_values + .into_iter() + .map(|proved_key_value| { + let key: [u8; 20] = proved_key_value + .1 + .try_into() + .map_err(|_| Error::Proof(ProofError::IncorrectValueSize("value size")))?; + let maybe_element = proved_key_value.2; + match maybe_element { + None => Ok((key, None)), + Some(element) => { + let identity_id = element + .into_item_bytes() + .map_err(Error::GroveDB)? + .try_into() + .map_err(|_| { + Error::Proof(ProofError::IncorrectValueSize( + "value size is incorrect", + )) + })?; + Ok((key, Some(identity_id))) + } + } + }) + .collect::>()?; + Ok((root_hash, values)) + } else { + Err(Error::Proof(ProofError::WrongElementCount { + expected: public_key_hashes.len(), + got: proved_key_values.len(), + })) + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_keys_by_identity_id/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_keys_by_identity_id/mod.rs new file mode 100644 index 00000000000..8ccbcb74654 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_keys_by_identity_id/mod.rs @@ -0,0 +1,68 @@ +mod v0; + +use crate::drive::{identity::key::fetch::IdentityKeysRequest, Drive}; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::identity::PartialIdentity; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the identity keys of a user by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `platform_version`: The platform version against which to verify the identity keys. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `PartialIdentity`. The `RootHash` represents the root hash of GroveDB, + /// and the `Option` represents the partial identity of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - An unknown or unsupported platform version is provided. + /// - Any other error as documented in the specific versioned function. + /// + pub fn verify_identity_keys_by_identity_id( + proof: &[u8], + key_request: IdentityKeysRequest, + with_revision: bool, + with_balance: bool, + is_proof_subset: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identity_keys_by_identity_id + { + 0 => Self::verify_identity_keys_by_identity_id_v0( + proof, + key_request, + with_revision, + with_balance, + is_proof_subset, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_keys_by_identity_id".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_keys_by_identity_id/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_keys_by_identity_id/v0/mod.rs new file mode 100644 index 00000000000..1348cea2839 --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_keys_by_identity_id/v0/mod.rs @@ -0,0 +1,136 @@ +use crate::drive::balances::balance_path; +use crate::drive::identity::{identity_key_tree_path, identity_path_vec, IdentityRootStructure}; +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::drive::identity::key::fetch::IdentityKeysRequest; +use crate::verify::RootHash; +use dpp::identifier::Identifier; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::{IdentityPublicKey, KeyID, PartialIdentity}; + +use dpp::prelude::Revision; +use dpp::serialization::PlatformDeserializable; +use dpp::version::PlatformVersion; +use grovedb::{GroveDb, PathQuery}; +use std::collections::BTreeMap; + +impl Drive { + /// Verifies the identity keys of a user by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `is_proof_subset`: A boolean indicating whether the proof is a subset. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option` of `PartialIdentity`. The `RootHash` represents the root hash of GroveDB, + /// and the `Option` represents the partial identity of the user if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid partial identity. + /// - The keys information is missing or incorrect. + /// + #[inline(always)] + pub(crate) fn verify_identity_keys_by_identity_id_v0( + proof: &[u8], + key_request: IdentityKeysRequest, + with_revision: bool, + with_balance: bool, + is_proof_subset: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let identity_id = key_request.identity_id; + let keys_path_query = key_request.into_path_query(); + let mut path_queries = vec![&keys_path_query]; + + let revision_path_query = Drive::identity_revision_query(&identity_id); + let balance_path_query = Drive::balance_for_identity_id_query(identity_id); + + if with_balance { + path_queries.push(&balance_path_query); + } + if with_revision { + path_queries.push(&revision_path_query); + } + + let path_query = PathQuery::merge(path_queries, &platform_version.drive.grove_version)?; + let (root_hash, proved_values) = if is_proof_subset { + GroveDb::verify_subset_query(proof, &path_query, &platform_version.drive.grove_version)? + } else { + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)? + }; + + let mut loaded_public_keys = BTreeMap::::new(); + let mut balance = None; + let mut revision = None; + + let identity_keys_path = identity_key_tree_path(identity_id.as_slice()); + let identity_balance_path = balance_path(); + let identity_path = identity_path_vec(&identity_id); + + for proved_key_value in proved_values { + let (path, key, maybe_element) = proved_key_value; + if path == identity_keys_path { + if let Some(element) = maybe_element { + let item_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; + let key = IdentityPublicKey::deserialize_from_bytes(&item_bytes)?; + loaded_public_keys.insert(key.id(), key); + } else { + return Err(Error::Proof(ProofError::CorruptedProof( + "we received an absence proof for a key but didn't request one".to_string(), + ))); + } + } else if path == identity_balance_path && key == identity_id { + if let Some(grovedb::Element::SumItem(identity_balance, _)) = maybe_element { + balance = Some(identity_balance as u64); + } else { + return Err(Error::Proof(ProofError::CorruptedProof( + "balance proof must be an existing sum item".to_string(), + ))); + } + } else if path == identity_path + && key == [IdentityRootStructure::IdentityTreeRevision as u8] + { + if let Some(element) = maybe_element { + let item_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; + revision = Some(Revision::from_be_bytes( + item_bytes.as_slice().try_into().map_err(|_| { + Error::GroveDB(grovedb::Error::WrongElementType( + "expecting 8 bytes of data for revision", + )) + })?, + )); + } else { + return Err(Error::Proof(ProofError::CorruptedProof( + "we received an absence proof for a revision but didn't request one" + .to_string(), + ))); + } + } else { + return Err(Error::Proof(ProofError::TooManyElements( + "we got back items that we did not request", + ))); + } + } + + let maybe_identity = Some(PartialIdentity { + id: Identifier::from(identity_id), + balance, + revision, + loaded_public_keys, + not_found_public_keys: Default::default(), + }); + + Ok((root_hash, maybe_identity)) + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_nonce/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_nonce/mod.rs new file mode 100644 index 00000000000..5f568fa059c --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_nonce/mod.rs @@ -0,0 +1,62 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an identity by their identity ID. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `id`: A 32-byte array representing the contract ID that the nonce is for. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `platform_version`: The platform version against which to verify the identity balance. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// + pub fn verify_identity_nonce( + proof: &[u8], + identity_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .identity + .verify_identity_nonce + { + 0 => Self::verify_identity_nonce_v0( + proof, + identity_id, + verify_subset_of_proof, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_nonce".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_nonce/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_nonce/v0/mod.rs new file mode 100644 index 00000000000..ba512647f4c --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_nonce/v0/mod.rs @@ -0,0 +1,95 @@ +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; + +use crate::drive::identity::identity_path_vec; +use crate::drive::identity::IdentityRootStructure::IdentityTreeNonce; +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an identity by their identity ID. + /// + /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the balance and the revision, but here we are only interested + /// in verifying the balance. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `id`: A 32-byte array representing the contract ID that the nonce is for. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid identity. + /// + pub(crate) fn verify_identity_nonce_v0( + proof: &[u8], + identity_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let mut path_query = Self::identity_nonce_query(identity_id); + path_query.query.limit = Some(1); + let (root_hash, mut proved_key_values) = if verify_subset_of_proof { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = proved_key_values.remove(0); + if path != identity_path_vec(&identity_id) { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path for the identity contract nonce".to_string(), + ))); + } + if key != vec![IdentityTreeNonce as u8] { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct key for the identity nonce" + .to_string(), + ))); + } + + let identity_nonce = maybe_element + .map(|element| { + let bytes: [u8; 8] = element + .into_item_bytes() + .map_err(Error::GroveDB)? + .try_into() + .map_err(|_| { + Error::Proof(ProofError::IncorrectValueSize("value size is incorrect")) + })?; + + Ok::(u64::from_be_bytes(bytes)) + }) + .transpose()?; + Ok((root_hash, identity_nonce)) + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected one identity contract nonce", + ))) + } + } +} diff --git a/packages/rs-drive/src/verify/identity/verify_identity_revision_for_identity_id/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_revision_for_identity_id/mod.rs new file mode 100644 index 00000000000..e084dffc38f --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_revision_for_identity_id/mod.rs @@ -0,0 +1 @@ +mod v0; diff --git a/packages/rs-drive/src/verify/identity/verify_identity_revision_for_identity_id/v0/mod.rs b/packages/rs-drive/src/verify/identity/verify_identity_revision_for_identity_id/v0/mod.rs new file mode 100644 index 00000000000..42700b4fc0e --- /dev/null +++ b/packages/rs-drive/src/verify/identity/verify_identity_revision_for_identity_id/v0/mod.rs @@ -0,0 +1,93 @@ +use crate::drive::identity::IdentityRootStructure::IdentityTreeRevision; +use crate::verify::RootHash; +use crate::{ + drive::{identity::identity_path_vec, Drive}, + error::{proof::ProofError, Error}, +}; +use dpp::prelude::Revision; +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the revision of an identity by their identity ID. + /// + /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the balance and the revision, but here we are only interested + /// in verifying the balance. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the revision of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid balance. + /// - The proved key value is not for the correct path or key in balances. + /// - More than one balance is found. + /// + pub fn verify_identity_revision_for_identity_id_v0( + proof: &[u8], + identity_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let mut path_query = Self::identity_revision_query(&identity_id); + path_query.query.limit = Some(1); + let (root_hash, mut proved_key_values) = if verify_subset_of_proof { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = &proved_key_values.remove(0); + if path != &identity_path_vec(&identity_id) { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path in revision".to_string(), + ))); + } + if key != &vec![IdentityTreeRevision as u8] { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct key in revision".to_string(), + ))); + } + + let revision = maybe_element + .as_ref() + .map(|element| { + let encoded_revision = element.as_item_bytes()?; + Ok::(Revision::from_be_bytes( + encoded_revision.try_into().map_err(|_| { + Error::Proof(ProofError::CorruptedProof( + "identity revision was not 8 bytes as expected".to_string(), + )) + })?, + )) + }) + .transpose()?; + Ok((root_hash, revision)) + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected one identity revision", + ))) + } + } +} diff --git a/packages/rs-drive/src/verify/mod.rs b/packages/rs-drive/src/verify/mod.rs new file mode 100644 index 00000000000..b4c627718e2 --- /dev/null +++ b/packages/rs-drive/src/verify/mod.rs @@ -0,0 +1,18 @@ +///DataContract verification methods on proofs +pub mod contract; +/// Document verification methods on proofs +pub mod document; +/// Identity verification methods on proofs +pub mod identity; +/// Single Document verification methods on proofs +pub mod single_document; + +/// System components (Epoch info etc...) verification methods on proofs +pub mod system; + +/// Verifies that a state transition contents exist in the proof +pub mod state_transition; +pub mod voting; + +/// Represents the root hash of the grovedb tree +pub type RootHash = [u8; 32]; diff --git a/packages/rs-drive/src/drive/verify/single_document/mod.rs b/packages/rs-drive/src/verify/single_document/mod.rs similarity index 100% rename from packages/rs-drive/src/drive/verify/single_document/mod.rs rename to packages/rs-drive/src/verify/single_document/mod.rs diff --git a/packages/rs-drive/src/verify/single_document/verify_proof/mod.rs b/packages/rs-drive/src/verify/single_document/verify_proof/mod.rs new file mode 100644 index 00000000000..6d82dd32377 --- /dev/null +++ b/packages/rs-drive/src/verify/single_document/verify_proof/mod.rs @@ -0,0 +1,59 @@ +mod v0; + +use crate::verify::RootHash; + +use crate::error::Error; +use crate::query::SingleDocumentDriveQuery; +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::document::Document; + +use crate::error::drive::DriveError; + +use dpp::version::PlatformVersion; + +impl SingleDocumentDriveQuery { + /// Verifies the proof of a single document query. + /// + /// `is_subset` indicates if the function should verify a subset of a larger proof. + /// + /// # Parameters + /// + /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. + /// - `proof`: A byte slice representing the proof to be verified. + /// - `document_type`: The type of the document being verified. + /// - `platform_version`: The platform version against which to verify the proof. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` + /// represents the deserialized document if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - An unknown or unsupported platform version is provided. + /// - Any other error as documented in the specific versioned function. + pub fn verify_proof( + &self, + is_subset: bool, + proof: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .single_document + .verify_proof + { + 0 => self.verify_proof_v0(is_subset, proof, document_type, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "SingleDocumentDriveQuery::verify_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/single_document/verify_proof/v0/mod.rs b/packages/rs-drive/src/verify/single_document/verify_proof/v0/mod.rs new file mode 100644 index 00000000000..aa9937819c4 --- /dev/null +++ b/packages/rs-drive/src/verify/single_document/verify_proof/v0/mod.rs @@ -0,0 +1,53 @@ +use crate::verify::RootHash; + +use crate::error::Error; +use crate::query::SingleDocumentDriveQuery; +use dpp::data_contract::document_type::DocumentTypeRef; +use dpp::document::Document; + +use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use dpp::version::PlatformVersion; + +impl SingleDocumentDriveQuery { + /// Verifies the proof of a single document query. + /// + /// `is_subset` indicates if the function should verify a subset of a larger proof. + /// + /// # Parameters + /// + /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. + /// - `proof`: A byte slice representing the proof to be verified. + /// - `document_type`: The type of the document being verified. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` + /// represents the deserialized document if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + /// - The document serialization fails. + #[inline(always)] + pub(crate) fn verify_proof_v0( + &self, + is_subset: bool, + proof: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + self.verify_proof_keep_serialized(is_subset, proof, platform_version) + .map(|(root_hash, serialized)| { + let document = serialized + .map(|serialized| { + Document::from_bytes(serialized.as_slice(), document_type, platform_version) + .map_err(Error::Protocol) + }) + .transpose()?; + Ok((root_hash, document)) + })? + } +} diff --git a/packages/rs-drive/src/verify/single_document/verify_proof_keep_serialized/mod.rs b/packages/rs-drive/src/verify/single_document/verify_proof_keep_serialized/mod.rs new file mode 100644 index 00000000000..53d5be3c597 --- /dev/null +++ b/packages/rs-drive/src/verify/single_document/verify_proof_keep_serialized/mod.rs @@ -0,0 +1,54 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; + +use crate::error::Error; +use crate::query::SingleDocumentDriveQuery; + +use dpp::version::PlatformVersion; + +impl SingleDocumentDriveQuery { + /// Verifies the proof of a document while keeping it serialized. + /// + /// `is_subset` indicates if the function should verify a subset of a larger proof. + /// + /// # Parameters + /// + /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. + /// - `proof`: A byte slice representing the proof to be verified. + /// - `platform_version`: The platform version against which to verify the proof. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` + /// represents the serialized document if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - An unknown or unsupported platform version is provided. + /// - Any other error as documented in the specific versioned function. + pub fn verify_proof_keep_serialized( + &self, + is_subset: bool, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option>), Error> { + match platform_version + .drive + .methods + .verify + .single_document + .verify_proof_keep_serialized + { + 0 => self.verify_proof_keep_serialized_v0(is_subset, proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "SingleDocumentDriveQuery::verify_proof_keep_serialized".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/single_document/verify_proof_keep_serialized/v0/mod.rs b/packages/rs-drive/src/verify/single_document/verify_proof_keep_serialized/v0/mod.rs new file mode 100644 index 00000000000..39f16f49cef --- /dev/null +++ b/packages/rs-drive/src/verify/single_document/verify_proof_keep_serialized/v0/mod.rs @@ -0,0 +1,68 @@ +use crate::verify::RootHash; + +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::query::SingleDocumentDriveQuery; + +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl SingleDocumentDriveQuery { + /// Verifies the proof of a document while keeping it serialized. + /// + /// `is_subset` indicates if the function should verify a subset of a larger proof. + /// + /// # Parameters + /// + /// - `is_subset`: A boolean indicating whether to verify a subset of a larger proof. + /// - `proof`: A byte slice representing the proof to be verified. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option>`. The `Option>` + /// represents the serialized document if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb verification fails. + /// - The elements returned are not items, the proof is incorrect. + #[inline(always)] + pub(crate) fn verify_proof_keep_serialized_v0( + &self, + is_subset: bool, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option>), Error> { + let path_query = self.construct_path_query(platform_version)?; + let (root_hash, mut proved_key_values) = if is_subset { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + + if proved_key_values.len() != 1 { + return Err(Error::Proof(ProofError::CorruptedProof( + "we should always get back one element".to_string(), + ))); + } + + let element = proved_key_values.remove(0).2; + + let serialized = element + .map(|element| element.into_item_bytes().map_err(Error::GroveDB)) + .transpose()?; + + Ok((root_hash, serialized)) + } +} diff --git a/packages/rs-drive/src/verify/state_transition/mod.rs b/packages/rs-drive/src/verify/state_transition/mod.rs new file mode 100644 index 00000000000..cc466d86d2f --- /dev/null +++ b/packages/rs-drive/src/verify/state_transition/mod.rs @@ -0,0 +1 @@ +pub mod verify_state_transition_was_executed_with_proof; diff --git a/packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/mod.rs b/packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/mod.rs new file mode 100644 index 00000000000..c03ca05c168 --- /dev/null +++ b/packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/mod.rs @@ -0,0 +1,71 @@ +//! Verifies the execution of a state transition using a provided proof. +//! +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::query::ContractLookupFn; +use crate::verify::RootHash; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; +use dpp::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Verifies the execution of a state transition using a provided proof. + /// + /// This method checks if the state transition has been executed and is included in the proof. + /// It supports different versions of the verification process, which are handled based on the + /// platform version specified. + /// + /// # Parameters + /// + /// - `state_transition`: A reference to the `StateTransition` that needs to be verified. + /// - `proof`: A byte slice representing the cryptographic proof to be verified. + /// - `known_contracts`: A `HashMap` mapping `Identifier`s to references of `DataContract`s that are known. + /// - `platform_version`: A reference to the `PlatformVersion` which dictates the verification method to be used. + /// + /// # Returns + /// + /// A `Result` containing either: + /// - On success: a tuple of `RootHash` and `StateTransitionProofResult`, where `RootHash` is the root hash of the + /// proof and `StateTransitionProofResult` contains the result of the proof verification. + /// - On failure: an `Error` encapsulating the reason for failure, such as proof corruption or a database query error. + /// + /// # Errors + /// + /// This function can return an `Error` in several cases, including but not limited to: + /// - The proof is invalid or corrupted. + /// - The verification process for the given platform version is not implemented. + /// - The database query required for the verification fails. + /// + pub fn verify_state_transition_was_executed_with_proof( + state_transition: &StateTransition, + block_info: &BlockInfo, + proof: &[u8], + known_contracts_provider_fn: &ContractLookupFn, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, StateTransitionProofResult), Error> { + match platform_version + .drive + .methods + .verify + .state_transition + .verify_state_transition_was_executed_with_proof + { + 0 => Drive::verify_state_transition_was_executed_with_proof_v0( + state_transition, + block_info, + proof, + known_contracts_provider_fn, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_state_transition_was_executed_with_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs b/packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs new file mode 100644 index 00000000000..09af028c47d --- /dev/null +++ b/packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs @@ -0,0 +1,427 @@ +use std::collections::BTreeMap; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::serialized_version::DataContractInSerializationFormat; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::document::document_methods::DocumentMethodsV0; +use dpp::document::property_names::PRICE; +use dpp::fee::Credits; +use dpp::identity::PartialIdentity; +use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; +use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; +use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::{DocumentTransition, DocumentTransitionV0Methods}; +use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; +use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0; +use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; +use dpp::state_transition::{StateTransition, StateTransitionLike}; +use dpp::state_transition::documents_batch_transition::document_create_transition::DocumentFromCreateTransition; +use dpp::state_transition::documents_batch_transition::document_delete_transition::v0::v0_methods::DocumentDeleteTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_replace_transition::DocumentFromReplaceTransition; +use dpp::state_transition::documents_batch_transition::document_replace_transition::v0::v0_methods::DocumentReplaceTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods; +use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::proof_result::StateTransitionProofResult::{VerifiedBalanceTransfer, VerifiedDataContract, VerifiedDocuments, VerifiedIdentity, VerifiedMasternodeVote, VerifiedPartialIdentity}; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; +use dpp::voting::votes::Vote; +use platform_version::TryIntoPlatformVersioned; +use platform_version::version::PlatformVersion; +use crate::drive::Drive; +use crate::drive::identity::key::fetch::IdentityKeysRequest; +use crate::verify::RootHash; +use crate::error::Error; +use crate::error::proof::ProofError; +use crate::query::{ContractLookupFn, SingleDocumentDriveQuery, SingleDocumentDriveQueryContestedStatus}; + +impl Drive { + #[inline(always)] + pub(crate) fn verify_state_transition_was_executed_with_proof_v0( + state_transition: &StateTransition, + block_info: &BlockInfo, + proof: &[u8], + known_contracts_provider_fn: &ContractLookupFn, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, StateTransitionProofResult), Error> { + match state_transition { + StateTransition::DataContractCreate(data_contract_create) => { + // we expect to get a contract that matches the state transition + let (root_hash, contract) = Drive::verify_contract( + proof, + None, + false, + true, + data_contract_create.data_contract().id().into_buffer(), + platform_version, + )?; + let contract = contract.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain contract with id {} expected to exist because of state transition (create)", data_contract_create.data_contract().id()))))?; + let contract_for_serialization: DataContractInSerializationFormat = contract + .clone() + .try_into_platform_versioned(platform_version)?; + if &contract_for_serialization != data_contract_create.data_contract() { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not contain exact expected contract after create with id {}", data_contract_create.data_contract().id())))); + } + Ok((root_hash, VerifiedDataContract(contract))) + } + StateTransition::DataContractUpdate(data_contract_update) => { + // we expect to get a contract that matches the state transition + let (root_hash, contract) = Drive::verify_contract( + proof, + None, + false, + true, + data_contract_update.data_contract().id().into_buffer(), + platform_version, + )?; + let contract = contract.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain contract with id {} expected to exist because of state transition (update", data_contract_update.data_contract().id()))))?; + let contract_for_serialization: DataContractInSerializationFormat = contract + .clone() + .try_into_platform_versioned(platform_version)?; + if &contract_for_serialization != data_contract_update.data_contract() { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not contain exact expected contract after update with id {}", data_contract_update.data_contract().id())))); + } + Ok((root_hash, VerifiedDataContract(contract))) + } + StateTransition::DocumentsBatch(documents_batch_transition) => { + if documents_batch_transition.transitions().len() > 1 { + return Err(Error::Proof(ProofError::InvalidTransition(format!("version {} does not support more than one document in a document batch transition", platform_version.protocol_version)))); + } + let Some(transition) = documents_batch_transition.transitions().first() else { + return Err(Error::Proof(ProofError::InvalidTransition( + "no transition in a document batch transition".to_string(), + ))); + }; + + let owner_id = documents_batch_transition.owner_id(); + + let data_contract_id = transition.data_contract_id(); + + let contract = known_contracts_provider_fn(&data_contract_id)?.ok_or( + Error::Proof(ProofError::UnknownContract(format!( + "unknown contract with id {}", + data_contract_id + ))), + )?; + + let document_type = contract + .document_type_for_name(transition.document_type_name()) + .map_err(|e| { + Error::Proof(ProofError::UnknownContract(format!( + "cannot fetch contract for document {} with id {}: {}", + transition.document_type_name(), + transition.data_contract_id(), + e + ))) + })?; + + let contested_status = + if let DocumentTransition::Create(create_transition) = transition { + if create_transition.prefunded_voting_balance().is_some() { + SingleDocumentDriveQueryContestedStatus::Contested + } else { + SingleDocumentDriveQueryContestedStatus::NotContested + } + } else { + SingleDocumentDriveQueryContestedStatus::NotContested + }; + + match transition { + DocumentTransition::Create(_) => {} + DocumentTransition::Replace(_) => {} + DocumentTransition::Delete(_) => {} + DocumentTransition::Transfer(_) => {} + DocumentTransition::UpdatePrice(_) => {} + DocumentTransition::Purchase(_) => {} + } + + let query = SingleDocumentDriveQuery { + contract_id: transition.data_contract_id().into_buffer(), + document_type_name: transition.document_type_name().clone(), + document_type_keeps_history: document_type.documents_keep_history(), + document_id: transition.base().id().into_buffer(), + block_time_ms: None, //None because we want latest + contested_status, + }; + let (root_hash, document) = + query.verify_proof(false, proof, document_type, platform_version)?; + + match transition { + DocumentTransition::Create(create_transition) => { + let document = document.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain document with id {} expected to exist because of state transition (create)", create_transition.base().id()))))?; + let expected_document = Document::try_from_create_transition( + create_transition, + documents_batch_transition.owner_id(), + block_info, + &document_type, + platform_version, + )?; + + let transient_fields = document_type + .transient_fields() + .iter() + .map(|a| a.as_str()) + .collect(); + + if !document.is_equal_ignoring_time_based_fields( + &expected_document, + Some(transient_fields), + platform_version, + )? { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not contain expected document (time fields were not checked) after create with id {}", create_transition.base().id())))); + } + Ok(( + root_hash, + VerifiedDocuments(BTreeMap::from([(document.id(), Some(document))])), + )) + } + DocumentTransition::Replace(replace_transition) => { + let document = document.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain document with id {} expected to exist because of state transition (replace)", replace_transition.base().id()))))?; + let expected_document = Document::try_from_replace_transition( + replace_transition, + documents_batch_transition.owner_id(), + document.created_at(), //we can trust the created at (as we don't care) + document.created_at_block_height(), //we can trust the created at block height (as we don't care) + document.created_at_core_block_height(), //we can trust the created at core block height (as we don't care) + document.created_at(), //we can trust the created at (as we don't care) + document.created_at_block_height(), //we can trust the created at block height (as we don't care) + document.created_at_core_block_height(), //we can trust the created at core block height (as we don't care) + block_info, + &document_type, + platform_version, + )?; + + let transient_fields = document_type + .transient_fields() + .iter() + .map(|a| a.as_str()) + .collect(); + + if !document.is_equal_ignoring_time_based_fields( + &expected_document, + Some(transient_fields), + platform_version, + )? { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not contain expected document (time fields were not checked) after replace with id {}", replace_transition.base().id())))); + } + + Ok(( + root_hash, + VerifiedDocuments(BTreeMap::from([(document.id(), Some(document))])), + )) + } + DocumentTransition::Transfer(transfer_transition) => { + let document = document.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain document with id {} expected to exist because of state transition (transfer)", transfer_transition.base().id()))))?; + let recipient_owner_id = transfer_transition.recipient_owner_id(); + + if document.owner_id() != recipient_owner_id { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not have the transfer executed after expected transfer with id {}", transfer_transition.base().id())))); + } + + Ok(( + root_hash, + VerifiedDocuments(BTreeMap::from([(document.id(), Some(document))])), + )) + } + DocumentTransition::Delete(delete_transition) => { + if document.is_some() { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution contained document after delete with id {}", delete_transition.base().id())))); + } + Ok(( + root_hash, + VerifiedDocuments(BTreeMap::from([( + delete_transition.base().id(), + None, + )])), + )) + } + DocumentTransition::UpdatePrice(update_price_transition) => { + let document = document.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain document with id {} expected to exist because of state transition (update price)", update_price_transition.base().id()))))?; + let new_document_price : Credits = document.properties().get_integer(PRICE).map_err(|e| Error::Proof(ProofError::IncorrectProof(format!("proof did not contain a document that contained a price field with id {} expected to exist because of state transition (update price): {}", update_price_transition.base().id(), e))))?; + if new_document_price != update_price_transition.price() { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not contain expected document update of price after price update with id {}", update_price_transition.base().id())))); + } + Ok(( + root_hash, + VerifiedDocuments(BTreeMap::from([(document.id(), Some(document))])), + )) + } + DocumentTransition::Purchase(purchase_transition) => { + let document = document.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain document with id {} expected to exist because of state transition (purchase)", purchase_transition.base().id()))))?; + + if document.owner_id() != owner_id { + return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not have the transfer executed after expected transfer with id {}", purchase_transition.base().id())))); + } + + Ok(( + root_hash, + VerifiedDocuments(BTreeMap::from([(document.id(), Some(document))])), + )) + } + } + } + StateTransition::IdentityCreate(identity_create_transition) => { + // we expect to get an identity that matches the state transition + let (root_hash, identity) = Drive::verify_full_identity_by_identity_id( + proof, + false, + identity_create_transition.identity_id().into_buffer(), + platform_version, + )?; + let identity = identity.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain identity {} expected to exist because of state transition (create)", identity_create_transition.identity_id()))))?; + Ok((root_hash, VerifiedIdentity(identity))) + } + StateTransition::IdentityTopUp(identity_top_up_transition) => { + // we expect to get a new balance and revision + let identity_id = identity_top_up_transition.identity_id(); + let (root_hash, Some((balance, revision))) = + Drive::verify_identity_balance_and_revision_for_identity_id( + proof, + identity_id.into_buffer(), + false, + platform_version, + )? + else { + return Err(Error::Proof(ProofError::IncorrectProof( + format!("proof did not contain balance for identity {} expected to exist because of state transition (top up)", identity_id)))); + }; + Ok(( + root_hash, + VerifiedPartialIdentity(PartialIdentity { + id: *identity_top_up_transition.identity_id(), + loaded_public_keys: Default::default(), + balance: Some(balance), + revision: Some(revision), + + not_found_public_keys: Default::default(), + }), + )) + } + StateTransition::IdentityCreditWithdrawal(identity_credit_withdrawal_transition) => { + // we expect to get an identity that matches the state transition + let (root_hash, balance) = Drive::verify_identity_balance_for_identity_id( + proof, + identity_credit_withdrawal_transition + .identity_id() + .into_buffer(), + false, + platform_version, + )?; + let balance = balance.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain balance for identity {} expected to exist because of state transition (withdrawal)", identity_credit_withdrawal_transition.identity_id()))))?; + Ok(( + root_hash, + VerifiedPartialIdentity(PartialIdentity { + id: identity_credit_withdrawal_transition.identity_id(), + loaded_public_keys: Default::default(), + balance: Some(balance), + revision: None, + + not_found_public_keys: Default::default(), + }), + )) + } + StateTransition::IdentityUpdate(identity_update_transition) => { + // we expect to get an identity that matches the state transition + let (root_hash, identity) = Drive::verify_identity_keys_by_identity_id( + proof, + IdentityKeysRequest::new_all_keys_query( + &identity_update_transition.identity_id().into_buffer(), + None, + ), + true, + true, + false, + platform_version, + )?; + let identity = identity.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain update for identity {} expected to exist because of state transition (update)", identity_update_transition.identity_id()))))?; + Ok((root_hash, VerifiedPartialIdentity(identity))) + } + StateTransition::IdentityCreditTransfer(identity_credit_transfer) => { + // we expect to get an identity that matches the state transition + let (root_hash_identity, balance_identity) = + Drive::verify_identity_balance_for_identity_id( + proof, + identity_credit_transfer.identity_id().into_buffer(), + true, + platform_version, + )?; + + let (root_hash_recipient, balance_recipient) = + Drive::verify_identity_balance_for_identity_id( + proof, + identity_credit_transfer.recipient_id().into_buffer(), + true, + platform_version, + )?; + + if root_hash_identity != root_hash_recipient { + return Err(Error::Proof(ProofError::CorruptedProof("proof is expected to have same root hash for all subsets (identity transfer)".to_string()))); + } + + let balance_identity = balance_identity.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain balance for identity sender {} expected to exist because of state transition (transfer)", identity_credit_transfer.identity_id()))))?; + let balance_recipient = balance_recipient.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain balance for identity recipient {} expected to exist because of state transition (transfer)", identity_credit_transfer.recipient_id()))))?; + + Ok(( + root_hash_identity, + VerifiedBalanceTransfer( + PartialIdentity { + id: identity_credit_transfer.identity_id(), + loaded_public_keys: Default::default(), + balance: Some(balance_identity), + revision: None, + + not_found_public_keys: Default::default(), + }, + PartialIdentity { + id: identity_credit_transfer.recipient_id(), + loaded_public_keys: Default::default(), + balance: Some(balance_recipient), + revision: None, + + not_found_public_keys: Default::default(), + }, + ), + )) + } + StateTransition::MasternodeVote(masternode_vote) => { + let pro_tx_hash = masternode_vote.pro_tx_hash(); + let vote = masternode_vote.vote(); + let contract = match vote { + Vote::ResourceVote(resource_vote) => match resource_vote.vote_poll() { + VotePoll::ContestedDocumentResourceVotePoll( + contested_document_resource_vote_poll, + ) => known_contracts_provider_fn( + &contested_document_resource_vote_poll.contract_id, + )? + .ok_or(Error::Proof( + ProofError::UnknownContract(format!( + "unknown contract with id {}", + contested_document_resource_vote_poll.contract_id + )), + ))?, + }, + }; + + // we expect to get a vote that matches the state transition + let (root_hash, vote) = Drive::verify_masternode_vote( + proof, + pro_tx_hash.to_buffer(), + vote, + &contract, + false, + platform_version, + )?; + let vote = vote.ok_or(Error::Proof(ProofError::IncorrectProof(format!("proof did not contain actual vote for masternode {} expected to exist because of state transition (masternode vote)", masternode_vote.pro_tx_hash()))))?; + Ok((root_hash, VerifiedMasternodeVote(vote))) + } + } + } +} diff --git a/packages/rs-drive/src/verify/system/mod.rs b/packages/rs-drive/src/verify/system/mod.rs new file mode 100644 index 00000000000..e0362df4371 --- /dev/null +++ b/packages/rs-drive/src/verify/system/mod.rs @@ -0,0 +1,5 @@ +mod verify_elements; +mod verify_epoch_infos; +mod verify_total_credits_in_system; +mod verify_upgrade_state; +mod verify_upgrade_vote_status; diff --git a/packages/rs-drive/src/verify/system/verify_elements/mod.rs b/packages/rs-drive/src/verify/system/verify_elements/mod.rs new file mode 100644 index 00000000000..ddddd08d677 --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_elements/mod.rs @@ -0,0 +1,47 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; +use dpp::version::PlatformVersion; +use grovedb::Element; +use std::collections::BTreeMap; + +mod v0; + +impl Drive { + /// Verifies a proof and returns elements matching keys for a path. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `path`: The path where elements should be. + /// - `keys`: The requested keyes. + /// - `platform_version`: the platform version, + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `BTreeMap, Option>`. The `BTreeMap, Option>` + /// is the map of elements we get back. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + pub fn verify_elements( + proof: &[u8], + path: Vec>, + keys: Vec>, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, BTreeMap, Option>), Error> { + match platform_version.drive.methods.verify.system.verify_elements { + 0 => Drive::verify_elements_v0(proof, path, keys, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_elements".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/system/verify_elements/v0/mod.rs b/packages/rs-drive/src/verify/system/verify_elements/v0/mod.rs new file mode 100644 index 00000000000..70c4b15f7ac --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_elements/v0/mod.rs @@ -0,0 +1,54 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::query::Query; +use crate::verify::RootHash; +use grovedb::query_result_type::PathKeyOptionalElementTrio; +use grovedb::{Element, GroveDb, PathQuery, SizedQuery}; +use grovedb_version::TryIntoVersioned; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// Verifies a proof and returns elements matching keys for a path. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `path`: The path where elements should be. + /// - `keys`: The requested keys. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `BTreeMap, Option>`. The `BTreeMap, Option>` + /// represent the elements we were trying to fetch. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + #[inline(always)] + pub(crate) fn verify_elements_v0( + proof: &[u8], + path: Vec>, + keys: Vec>, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, BTreeMap, Option>), Error> { + let mut query = Query::new(); + query.insert_keys(keys); + let path_query = PathQuery::new(path, SizedQuery::new(query, None, None)); + + let (root_hash, proved_path_key_values) = + GroveDb::verify_query_raw(proof, &path_query, &platform_version.drive.grove_version)?; + let path_key_optional_elements = proved_path_key_values + .into_iter() + .map(|pkv| { + let key_element_pair: PathKeyOptionalElementTrio = + pkv.try_into_versioned(&platform_version.drive.grove_version)?; + Ok((key_element_pair.1, key_element_pair.2)) + }) + .collect::, Option>, grovedb::Error>>()?; + Ok((root_hash, path_key_optional_elements)) + } +} diff --git a/packages/rs-drive/src/verify/system/verify_epoch_infos/mod.rs b/packages/rs-drive/src/verify/system/verify_epoch_infos/mod.rs new file mode 100644 index 00000000000..a75ea834f88 --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_epoch_infos/mod.rs @@ -0,0 +1,64 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; +use dpp::block::epoch::EpochIndex; +use dpp::block::extended_epoch_info::ExtendedEpochInfo; +use dpp::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Verifies a proof containing potentially multiple epoch infos. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `current_epoch`: The current epoch index, can be acquired from metadata. + /// - `start_epoch`: The first epoch index. + /// - `count`: The amount of epochs to get. + /// - `ascending`: True if we want to get epochs from oldest to newest. + /// - `platform_version`: the platform version, + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Vec`. The `Vec` + /// represents verified epoch information if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + pub fn verify_epoch_infos( + proof: &[u8], + current_epoch: EpochIndex, + start_epoch: Option, + count: u16, + ascending: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + match platform_version + .drive + .methods + .verify + .system + .verify_epoch_infos + { + 0 => Drive::verify_epoch_infos_v0( + proof, + current_epoch, + start_epoch, + count, + ascending, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_epoch_infos".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/system/verify_epoch_infos/v0/mod.rs b/packages/rs-drive/src/verify/system/verify_epoch_infos/v0/mod.rs new file mode 100644 index 00000000000..41185817d2a --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_epoch_infos/v0/mod.rs @@ -0,0 +1,258 @@ +use crate::drive::credit_pools::epochs::epoch_key_constants::{ + KEY_FEE_MULTIPLIER, KEY_PROTOCOL_VERSION, KEY_START_BLOCK_CORE_HEIGHT, KEY_START_BLOCK_HEIGHT, + KEY_START_TIME, +}; +use crate::drive::credit_pools::pools_vec_path; +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::query::{Query, QueryItem}; +use crate::verify::RootHash; +use dpp::block::epoch::{EpochIndex, EPOCH_KEY_OFFSET}; +use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0; +use dpp::block::extended_epoch_info::ExtendedEpochInfo; +use dpp::ProtocolError; +use grovedb::{Element, GroveDb, PathQuery, SizedQuery}; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// Verifies that the contract is included in the proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `current_epoch`: The current epoch index, can be acquired from metadata. + /// - `start_epoch`: The first epoch index. + /// - `count`: The amount of epochs to get. + /// - `ascending`: True if we want to get epochs from oldest to newest. + /// - `platform_version`: the platform version, + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Option`. The `Option` + /// represents the verified contract if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + #[inline(always)] + pub(crate) fn verify_epoch_infos_v0( + proof: &[u8], + current_epoch: EpochIndex, + start_epoch: Option, + count: u16, + ascending: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + let start_epoch_index = start_epoch.unwrap_or({ + if ascending { + 0 + } else { + current_epoch + } + }); + let index_with_offset = start_epoch_index + .checked_add(EPOCH_KEY_OFFSET) + .ok_or(ProtocolError::Overflow("stored epoch index too high"))?; + let mut subquery = Query::new(); + subquery.insert_keys(vec![ + KEY_START_TIME.to_vec(), + KEY_START_BLOCK_HEIGHT.to_vec(), + KEY_START_BLOCK_CORE_HEIGHT.to_vec(), + KEY_FEE_MULTIPLIER.to_vec(), + KEY_PROTOCOL_VERSION.to_vec(), + ]); + let mut query = if ascending { + Query::new_single_query_item(QueryItem::RangeFrom( + index_with_offset.to_be_bytes().to_vec().., + )) + } else { + Query::new_single_query_item(QueryItem::RangeToInclusive( + ..=index_with_offset.to_be_bytes().to_vec(), + )) + }; + query.left_to_right = ascending; + query.set_subquery(subquery); + let path_query = PathQuery::new( + pools_vec_path(), + // The multiplier must be equal to requested keys count + SizedQuery::new(query, Some(count * 5), None), + ); + + let (root_hash, elements) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + + let results = elements.into_iter().fold( + BTreeMap::<_, BTreeMap<_, _>>::new(), + |mut acc, result_item| { + let (path, key, element) = result_item; + if path.len() == 2 { + acc.entry(path).or_default().insert(key, element); + } + acc + }, + ); + + // Convert the BTreeMap entries to ExtendedEpochInfo + let extended_epoch_infos = results + .into_iter() + .filter_map(|(path, inner_map)| { + // Extract the epoch index from the path's last component + // and adjust by subtracting the EPOCH_KEY_OFFSET + let epoch_index_result: Result = path + .last() + .ok_or(Error::Proof(ProofError::CorruptedProof( + "extended epoch info: path can not be empty".to_string(), + ))) + .and_then(|epoch_index_vec| { + epoch_index_vec.as_slice().try_into().map_err(|_| { + Error::Proof(ProofError::CorruptedProof( + "extended epoch info: item has an invalid length".to_string(), + )) + }) + }) + .and_then(|epoch_index_bytes| { + EpochIndex::from_be_bytes(epoch_index_bytes) + .checked_sub(EPOCH_KEY_OFFSET) + .ok_or(Error::Proof(ProofError::CorruptedProof( + "epoch bytes on disk too small, should be over epoch key offset" + .to_string(), + ))) + }); + + let epoch_index = match epoch_index_result { + Ok(value) => value, + Err(e) => return Some(Err(e)), + }; + + let first_block_time_element = inner_map.get(&KEY_START_TIME.to_vec())?; + + let Some(Element::Item(encoded_start_time, _)) = first_block_time_element else { + return Some(Err(Error::Drive(DriveError::UnexpectedElementType( + "start time must be an item", + )))); + }; + + let first_block_time_bytes: [u8; 8] = + match encoded_start_time.as_slice().try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "extended epoch info: block time must be 8 bytes for a u64".to_string(), + )) + }) { + Ok(value) => value, + Err(e) => return Some(Err(e)), + }; + + let first_block_time = u64::from_be_bytes(first_block_time_bytes); + + let first_block_height_element = inner_map.get(&KEY_START_BLOCK_HEIGHT.to_vec())?; + + let Some(Element::Item(encoded_start_block_height, _)) = first_block_height_element + else { + return Some(Err(Error::Drive(DriveError::UnexpectedElementType( + "extended epoch info: start time must be an item", + )))); + }; + + let first_block_height_bytes: [u8; 8] = match encoded_start_block_height + .as_slice() + .try_into() + .map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "extended epoch info: block height must be 8 bytes for a u64" + .to_string(), + )) + }) { + Ok(value) => value, + Err(e) => return Some(Err(e)), + }; + + let first_block_height = u64::from_be_bytes(first_block_height_bytes); + + let first_core_block_height_element = + inner_map.get(&KEY_START_BLOCK_CORE_HEIGHT.to_vec())?; + + let Some(Element::Item(encoded_start_core_block_height, _)) = + first_core_block_height_element + else { + return Some(Err(Error::Drive(DriveError::UnexpectedElementType( + "start time must be an item", + )))); + }; + + let first_core_block_height_bytes: [u8; 4] = match encoded_start_core_block_height + .as_slice() + .try_into() + .map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "core block height must be 4 bytes for a u32".to_string(), + )) + }) { + Ok(value) => value, + Err(e) => return Some(Err(e)), + }; + + let first_core_block_height = u32::from_be_bytes(first_core_block_height_bytes); + + let fee_multiplier_element = inner_map.get(&KEY_FEE_MULTIPLIER.to_vec())?; + + let Some(Element::Item(encoded_multiplier, _)) = fee_multiplier_element else { + return Some(Err(Error::Drive(DriveError::UnexpectedElementType( + "epochs multiplier must be an item", + )))); + }; + + let fee_multiplier_bytes: [u8; 8] = + match encoded_multiplier.as_slice().try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "fee multiplier must be 8 bytes for a u64".to_string(), + )) + }) { + Ok(value) => value, + Err(e) => return Some(Err(e)), + }; + + let fee_multiplier = u64::from_be_bytes(fee_multiplier_bytes); + + let protocol_version_element = inner_map.get(&KEY_PROTOCOL_VERSION.to_vec())?; + + let Some(Element::Item(encoded_protocol_version, _)) = protocol_version_element + else { + return Some(Err(Error::Drive(DriveError::UnexpectedElementType( + "protocol version must be an item", + )))); + }; + + let protocol_version_bytes: [u8; 4] = + match encoded_protocol_version.as_slice().try_into().map_err(|_| { + Error::Drive(DriveError::CorruptedSerialization( + "protocol version must be 4 bytes for a u32".to_string(), + )) + }) { + Ok(value) => value, + Err(e) => return Some(Err(e)), + }; + + let protocol_version = u32::from_be_bytes(protocol_version_bytes); + + // Construct the ExtendedEpochInfo + Some(Ok(ExtendedEpochInfoV0 { + index: epoch_index, + first_block_time, + first_block_height, + first_core_block_height, + fee_multiplier_permille: fee_multiplier, + protocol_version, + } + .into())) + }) + .collect::, Error>>()?; + + Ok((root_hash, extended_epoch_infos)) + } +} diff --git a/packages/rs-drive/src/verify/system/verify_total_credits_in_system/mod.rs b/packages/rs-drive/src/verify/system/verify_total_credits_in_system/mod.rs new file mode 100644 index 00000000000..337cf536296 --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_total_credits_in_system/mod.rs @@ -0,0 +1,60 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; +use dpp::fee::Credits; +use dpp::prelude::CoreBlockHeight; +use dpp::version::PlatformVersion; + +mod v0; + +impl Drive { + /// Verifies a proof containing the total credits in the platform. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `core_distribution_multiplier`: A multiplier for the core distribution. This is 1 for mainnet. And 10 for testnet. + /// - `current_core_height`: The current core block height. + /// - `platform_version`: The platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing a tuple of `RootHash` and `Credits`. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + /// - The platform version is unknown. + pub fn verify_total_credits_in_system( + proof: &[u8], + core_subsidy_halving_interval: u32, + request_activation_core_height: impl Fn() -> Result, + current_core_height: CoreBlockHeight, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Credits), Error> { + match platform_version + .drive + .methods + .verify + .system + .verify_total_credits_in_system + { + 0 => Drive::verify_total_credits_in_system_v0( + proof, + core_subsidy_halving_interval, + request_activation_core_height, + current_core_height, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_total_credits_in_system".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/system/verify_total_credits_in_system/v0/mod.rs b/packages/rs-drive/src/verify/system/verify_total_credits_in_system/v0/mod.rs new file mode 100644 index 00000000000..353a115dc53 --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_total_credits_in_system/v0/mod.rs @@ -0,0 +1,199 @@ +use crate::drive::balances::{ + total_credits_on_platform_path_query, TOTAL_SYSTEM_CREDITS_STORAGE_KEY, +}; +use crate::drive::credit_pools::epochs::epoch_key_constants::KEY_START_BLOCK_CORE_HEIGHT; +use crate::drive::credit_pools::epochs::epochs_root_tree_key_constants::KEY_UNPAID_EPOCH_INDEX; +use crate::drive::credit_pools::epochs::paths::EpochProposers; +use crate::drive::{Drive, RootTree}; +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::query::Query; +use crate::verify::RootHash; +use dpp::block::epoch::{Epoch, EpochIndex}; +use dpp::core_subsidy::epoch_core_reward_credits_for_distribution::epoch_core_reward_credits_for_distribution; +use dpp::fee::Credits; +use dpp::prelude::CoreBlockHeight; +use grovedb::{Element, GroveDb, PathQuery, SizedQuery}; +use integer_encoding::VarInt; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies a proof for the total credits in the system and returns + /// them if they are in the proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `path`: The path where elements should be. + /// - `keys`: The requested keys. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Credits`. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + #[inline(always)] + pub(crate) fn verify_total_credits_in_system_v0( + proof: &[u8], + core_subsidy_halving_interval: u32, + request_activation_core_height: impl Fn() -> Result, + current_core_height: CoreBlockHeight, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Credits), Error> { + let total_credits_on_platform_path_query = total_credits_on_platform_path_query(); + + let (root_hash, mut proved_path_key_values) = GroveDb::verify_subset_query( + proof, + &total_credits_on_platform_path_query, + &platform_version.drive.grove_version, + )?; + if proved_path_key_values.len() > 1 { + return Err(Error::Proof(ProofError::TooManyElements("We should only get back at most 1 element in the proof for the total credits in the system"))); + } + + let Some(proved_path_key_value) = proved_path_key_values.pop() else { + return Err(Error::Proof(ProofError::IncorrectProof( + "This proof would show that Platform has not yet been initialized".to_string(), + ))); + }; + + if proved_path_key_value.0 != total_credits_on_platform_path_query.path { + return Err(Error::Proof(ProofError::CorruptedProof( + "The result of this proof is not what we asked for (path)".to_string(), + ))); + } + + if proved_path_key_value.1 != TOTAL_SYSTEM_CREDITS_STORAGE_KEY.to_vec() { + return Err(Error::Proof(ProofError::CorruptedProof( + "The result of this proof is not what we asked for (key)".to_string(), + ))); + } + + let Some(Element::Item(bytes, _)) = proved_path_key_value.2 else { + return Err(Error::Proof(ProofError::CorruptedProof( + "We are expecting an item for the total credits in platform field".to_string(), + ))); + }; + + let credits = Credits::decode_var(bytes.as_slice()).ok_or(Error::Proof(ProofError::CorruptedProof("The result of this proof does not contain an encoded var integer for total credits".to_string())))?.0; + + // we also need the path_query for the start_core_height of this unpaid epoch + let unpaid_epoch_index = PathQuery { + path: vec![vec![RootTree::Pools as u8]], + query: SizedQuery { + query: Query::new_single_key(KEY_UNPAID_EPOCH_INDEX.to_vec()), + limit: Some(1), + offset: None, + }, + }; + + let (_, mut proved_path_key_values) = GroveDb::verify_subset_query( + proof, + &unpaid_epoch_index, + &platform_version.drive.grove_version, + )?; + + let Some(proved_path_key_value) = proved_path_key_values.pop() else { + return Err(Error::Proof(ProofError::IncorrectProof("This proof would show that Platform has not yet been initialized as we can not find a start index".to_string()))); + }; + + if proved_path_key_value.0 != unpaid_epoch_index.path { + return Err(Error::Proof(ProofError::CorruptedProof( + "The result of this proof is not what we asked for (unpaid epoch path)".to_string(), + ))); + } + + if proved_path_key_value.1 != KEY_UNPAID_EPOCH_INDEX.to_vec() { + return Err(Error::Proof(ProofError::CorruptedProof( + "The result of this proof is not what we asked for (unpaid epoch key)".to_string(), + ))); + } + + let Some(Element::Item(bytes, _)) = proved_path_key_value.2 else { + return Err(Error::Proof(ProofError::CorruptedProof( + "We are expecting an item for the epoch index".to_string(), + ))); + }; + + let epoch_index = EpochIndex::from_be_bytes(bytes.as_slice().try_into().map_err(|_| { + Error::Proof(ProofError::CorruptedProof( + "epoch index invalid length".to_string(), + )) + })?); + + let start_core_height = if epoch_index == 0 { + request_activation_core_height()? + } else { + let epoch = Epoch::new(epoch_index).map_err(|_| { + Error::Proof(ProofError::CorruptedProof( + "Epoch index out of bounds".to_string(), + )) + })?; + + let start_core_height_query = PathQuery { + path: epoch.get_path_vec(), + query: SizedQuery { + query: Query::new_single_key(KEY_START_BLOCK_CORE_HEIGHT.to_vec()), + limit: None, + offset: None, + }, + }; + + let (_, mut proved_path_key_values) = GroveDb::verify_subset_query( + proof, + &start_core_height_query, + &platform_version.drive.grove_version, + )?; + + let Some(proved_path_key_value) = proved_path_key_values.pop() else { + return Err(Error::Proof(ProofError::IncorrectProof( + "We can not find the start core height of the unpaid epoch".to_string(), + ))); + }; + + if proved_path_key_value.0 != start_core_height_query.path { + return Err(Error::Proof(ProofError::CorruptedProof( + "The result of this proof is not what we asked for (start core height path)" + .to_string(), + ))); + } + + if proved_path_key_value.1 != KEY_START_BLOCK_CORE_HEIGHT.to_vec() { + return Err(Error::Proof(ProofError::CorruptedProof( + "The result of this proof is not what we asked for (start core height key)" + .to_string(), + ))); + } + + let Some(Element::Item(bytes, _)) = proved_path_key_value.2 else { + return Err(Error::Proof(ProofError::CorruptedProof( + "We are expecting an item for the start core height of the unpaid epoch" + .to_string(), + ))); + }; + + u32::from_be_bytes(bytes.as_slice().try_into().map_err(|_| { + Error::Proof(ProofError::CorruptedProof( + "start core height invalid length".to_string(), + )) + })?) + 1 // We need a plus one here, because we already distribute the first block on epoch change + }; + + let reward_credits_accumulated_during_current_epoch = + epoch_core_reward_credits_for_distribution( + start_core_height, + current_core_height, + core_subsidy_halving_interval, + platform_version, + )?; + + let total_credits = credits.checked_add(reward_credits_accumulated_during_current_epoch).ok_or(Error::Proof(ProofError::CorruptedProof("overflow while adding platform credits with reward credits accumulated during current epoch".to_string())))?; + + Ok((root_hash, total_credits)) + } +} diff --git a/packages/rs-drive/src/verify/system/verify_upgrade_state/mod.rs b/packages/rs-drive/src/verify/system/verify_upgrade_state/mod.rs new file mode 100644 index 00000000000..2cce2235c8b --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_upgrade_state/mod.rs @@ -0,0 +1,50 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; + +use dpp::util::deserializer::ProtocolVersion; +use dpp::version::PlatformVersion; +use nohash_hasher::IntMap; + +mod v0; + +impl Drive { + /// Verifies a proof containing the current upgrade state. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `platform_version`: the platform version, + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `Vec`. The `Vec` + /// represents verified epoch information if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + pub fn verify_upgrade_state( + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, IntMap), Error> { + match platform_version + .drive + .methods + .verify + .system + .verify_upgrade_state + { + 0 => Drive::verify_upgrade_state_v0(proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_upgrade_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/system/verify_upgrade_state/v0/mod.rs b/packages/rs-drive/src/verify/system/verify_upgrade_state/v0/mod.rs new file mode 100644 index 00000000000..17d447a549d --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_upgrade_state/v0/mod.rs @@ -0,0 +1,73 @@ +use crate::drive::protocol_upgrade::versions_counter_path_vec; +use crate::drive::Drive; +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::query::{Query, QueryItem}; +use crate::verify::RootHash; +use dpp::util::deserializer::ProtocolVersion; +use grovedb::{GroveDb, PathQuery}; +use integer_encoding::VarInt; +use nohash_hasher::IntMap; +use platform_version::version::PlatformVersion; +use std::ops::RangeFull; + +impl Drive { + /// Verifies a proof containing the current upgrade state. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `platform_version`: the platform version, + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `IntMap`. The `IntMap` + /// represents votes count of each version in the current epoch. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + #[inline(always)] + pub(crate) fn verify_upgrade_state_v0( + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, IntMap), Error> { + let path_query = PathQuery::new_unsized( + versions_counter_path_vec(), + Query::new_single_query_item(QueryItem::RangeFull(RangeFull)), + ); + + let (root_hash, elements) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + + let protocol_version_map = elements + .into_iter() + .map(|(_, key, element)| { + let version = ProtocolVersion::decode_var(key.as_slice()) + .ok_or(ProofError::CorruptedProof( + "protocol version not decodable".to_string(), + ))? + .0; + let element = element.ok_or(ProofError::CorruptedProof( + "expected a count for each version, got none".to_string(), + ))?; + let count_bytes = element.as_item_bytes().map_err(|_| { + ProofError::CorruptedProof( + "expected an item for the element of a version".to_string(), + ) + })?; + let count = u64::decode_var(count_bytes) + .ok_or(ProofError::CorruptedProof( + "version count not decodable".to_string(), + ))? + .0; + Ok((version, count)) + }) + .collect::, Error>>()?; + + Ok((root_hash, protocol_version_map)) + } +} diff --git a/packages/rs-drive/src/verify/system/verify_upgrade_vote_status/mod.rs b/packages/rs-drive/src/verify/system/verify_upgrade_vote_status/mod.rs new file mode 100644 index 00000000000..9a6e6a12abc --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_upgrade_vote_status/mod.rs @@ -0,0 +1,58 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; +use dpp::util::deserializer::ProtocolVersion; +use dpp::version::PlatformVersion; +use std::collections::BTreeMap; + +impl Drive { + /// Verifies a proof containing potentially multiple epoch infos. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `first_pro_tx_hash`: the first pro tx hash that we are querying for. + /// - `count`: the amount of Evonodes that we want to retrieve. + /// - `platform_version`: the platform version, + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `BTreeMap<[u8;32], ProtocolVersion>`. The `BTreeMap<[u8;32], ProtocolVersion>` + /// represents a map of the version that each Evonode has voted for. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + pub fn verify_upgrade_vote_status( + proof: &[u8], + start_protx_hash: Option<[u8; 32]>, + count: u16, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, BTreeMap<[u8; 32], ProtocolVersion>), Error> { + match platform_version + .drive + .methods + .verify + .system + .verify_upgrade_vote_status + { + 0 => Drive::verify_upgrade_vote_status_v0( + proof, + start_protx_hash, + count, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_upgrade_vote_status".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/system/verify_upgrade_vote_status/v0/mod.rs b/packages/rs-drive/src/verify/system/verify_upgrade_vote_status/v0/mod.rs new file mode 100644 index 00000000000..8f6a4361999 --- /dev/null +++ b/packages/rs-drive/src/verify/system/verify_upgrade_vote_status/v0/mod.rs @@ -0,0 +1,82 @@ +use crate::drive::protocol_upgrade::desired_version_for_validators_path_vec; +use crate::drive::Drive; +use crate::error::proof::ProofError; +use crate::error::Error; +use crate::query::{Query, QueryItem}; +use crate::verify::RootHash; +use dpp::util::deserializer::ProtocolVersion; +use grovedb::{GroveDb, PathQuery, SizedQuery}; +use integer_encoding::VarInt; +use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; +use std::ops::RangeFull; + +impl Drive { + /// Verifies a proof containing the current upgrade state. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof to be verified. + /// - `first_pro_tx_hash`: the first pro tx hash that we are querying for. + /// - `count`: the amount of Evonodes that we want to retrieve. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple of `RootHash` and `BTreeMap<[u8;32], ProtocolVersion>`. The `BTreeMap<[u8;32], ProtocolVersion>` + /// represents a map of the version that each Evonode has voted for. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is corrupted. + /// - The GroveDb query fails. + #[inline(always)] + pub(crate) fn verify_upgrade_vote_status_v0( + proof: &[u8], + start_protx_hash: Option<[u8; 32]>, + count: u16, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, BTreeMap<[u8; 32], ProtocolVersion>), Error> { + let path = desired_version_for_validators_path_vec(); + + let query_item = if let Some(start_protx_hash) = start_protx_hash { + QueryItem::RangeFrom(start_protx_hash.to_vec()..) + } else { + QueryItem::RangeFull(RangeFull) + }; + + let path_query = PathQuery::new( + path, + SizedQuery::new(Query::new_single_query_item(query_item), Some(count), None), + ); + + let (root_hash, elements) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + + let protocol_version_map = elements + .into_iter() + .map(|(_, key, element)| { + let pro_tx_hash: [u8; 32] = key.try_into().map_err(|_| { + ProofError::CorruptedProof("protocol version not decodable".to_string()) + })?; + let element = element.ok_or(ProofError::CorruptedProof( + "expected a count for each version, got none".to_string(), + ))?; + let version_bytes = element.as_item_bytes().map_err(|_| { + ProofError::CorruptedProof( + "expected an item for the element of a version".to_string(), + ) + })?; + let version = u32::decode_var(version_bytes) + .ok_or(ProofError::CorruptedProof( + "version count not decodable".to_string(), + ))? + .0; + Ok((pro_tx_hash, version)) + }) + .collect::, Error>>()?; + + Ok((root_hash, protocol_version_map)) + } +} diff --git a/packages/rs-drive/src/verify/voting/mod.rs b/packages/rs-drive/src/verify/voting/mod.rs new file mode 100644 index 00000000000..b3839b625cd --- /dev/null +++ b/packages/rs-drive/src/verify/voting/mod.rs @@ -0,0 +1,10 @@ +//! Voting verification + +mod verify_contests_proof; +mod verify_identity_votes_given_proof; +mod verify_masternode_vote; +mod verify_specialized_balance; +mod verify_vote_poll_vote_state_proof; +mod verify_vote_poll_votes_proof; +mod verify_vote_polls_end_date_query; +// mod verify_start_at_contender_in_proof; diff --git a/packages/rs-drive/src/verify/voting/verify_contests_proof/mod.rs b/packages/rs-drive/src/verify/voting/verify_contests_proof/mod.rs new file mode 100644 index 00000000000..610745f036b --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_contests_proof/mod.rs @@ -0,0 +1,54 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; +use dpp::platform_value::Value; + +use crate::error::Error; + +use crate::query::vote_polls_by_document_type_query::ResolvedVotePollsByDocumentTypeQuery; +use dpp::version::PlatformVersion; + +impl<'a> ResolvedVotePollsByDocumentTypeQuery<'a> { + /// Verifies a proof for the vote poll vote state proof. + /// + /// This function takes a byte slice representing the serialized proof, verifies it, and returns a tuple consisting of the root hash + /// and a vector of deserialized contenders. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `platform_version` - The platform version against which to verify the proof. + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or a deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. A deserialization error occurs when parsing the serialized document(s). + pub fn verify_contests_proof( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + match platform_version + .drive + .methods + .verify + .voting + .verify_contests_proof + { + 0 => self.verify_contests_proof_v0(proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_contests_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_contests_proof/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_contests_proof/v0/mod.rs new file mode 100644 index 00000000000..6bdcfde8ab0 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_contests_proof/v0/mod.rs @@ -0,0 +1,89 @@ +use crate::verify::RootHash; +use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; +use dpp::platform_value::Value; +use grovedb::GroveDb; + +use crate::error::Error; + +use crate::error::drive::DriveError; +use crate::query::vote_polls_by_document_type_query::ResolvedVotePollsByDocumentTypeQuery; +use dpp::version::PlatformVersion; + +impl<'a> ResolvedVotePollsByDocumentTypeQuery<'a> { + /// Verifies a proof for a collection of documents. + /// + /// This function takes a slice of bytes `proof` containing a serialized proof, + /// verifies it, and returns a tuple consisting of the root hash and a vector of deserialized documents. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `drive_version` - The current active drive version + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s, if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. There is a deserialization error when parsing the serialized document(s) into `Document` struct(s). + #[inline(always)] + pub(crate) fn verify_contests_proof_v0( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + let index = self.index()?; + let path_query = self.construct_path_query_with_known_index(index, platform_version)?; + let (root_hash, proved_key_values) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + + let result_is_in_key = self.result_is_in_key(); + let result_path_index = if result_is_in_key { + None + } else { + Some(self.result_path_index()) + }; + let document_type = self.document_type()?; + let property_name_being_searched = self.property_name_being_searched(index)?; + let values = proved_key_values + .into_iter() + .map(|(mut path, key, _)| { + if result_is_in_key { + // the result is in the key because we did not provide any end index values + // like this <------ start index values (path) ---> Key + // properties ------- --------- --------- ---------- ------- + document_type + .deserialize_value_for_key( + property_name_being_searched.name.as_str(), + key.as_slice(), + platform_version, + ) + .map_err(Error::Protocol) + } else if path.len() < result_path_index.unwrap() { + Err(Error::Drive(DriveError::CorruptedCodeExecution( + "the path length should always be bigger or equal to the result path index", + ))) + } else { + // the result is in the path because we did not provide any end index values + // like this <------ start index values (path) ---> Key + // properties ------- --------- --------- ---------- ------- + let inner_path_value_bytes = path.remove(result_path_index.unwrap()); + document_type + .deserialize_value_for_key( + property_name_being_searched.name.as_str(), + inner_path_value_bytes.as_slice(), + platform_version, + ) + .map_err(Error::Protocol) + } + }) + .collect::, Error>>()?; + + Ok((root_hash, values)) + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_identity_votes_given_proof/mod.rs b/packages/rs-drive/src/verify/voting/verify_identity_votes_given_proof/mod.rs new file mode 100644 index 00000000000..66d077e6b1f --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_identity_votes_given_proof/mod.rs @@ -0,0 +1,64 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::query::ContractLookupFn; +use crate::verify::RootHash; +use dpp::identifier::Identifier; + +use crate::error::Error; + +use crate::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; +use dpp::version::PlatformVersion; +use dpp::voting::votes::resource_vote::ResourceVote; + +impl ContestedResourceVotesGivenByIdentityQuery { + /// Verifies a proof for the vote poll vote state proof. + /// + /// This function verifies a given serialized proof and returns the root hash along with a collection of deserialized identifiers and their corresponding resource votes. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the serialized proof to be verified. + /// * `contract_lookup_fn` - Function that retrieves data contract based on its identifier. + /// * `platform_version` - A reference to the platform version to be used for verification. + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a collection of `(Identifier, ResourceVote)` pairs if the proof is valid. The collection type is flexible and determined by the generic parameter `I`. + /// * An `Error` variant if the proof verification fails or a deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` if: + /// * The proof verification fails. + /// * A deserialization error occurs when parsing the serialized document(s). + pub fn verify_identity_votes_given_proof( + &self, + proof: &[u8], + contract_lookup_fn: &ContractLookupFn, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, I), Error> + where + I: FromIterator<(Identifier, ResourceVote)>, + { + match platform_version + .drive + .methods + .verify + .voting + .verify_identity_votes_given_proof + { + 0 => self.verify_identity_votes_given_proof_v0( + proof, + contract_lookup_fn, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_identity_votes_given_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_identity_votes_given_proof/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_identity_votes_given_proof/v0/mod.rs new file mode 100644 index 00000000000..5dd598e2720 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_identity_votes_given_proof/v0/mod.rs @@ -0,0 +1,68 @@ +use crate::drive::votes::storage_form::contested_document_resource_reference_storage_form::ContestedDocumentResourceVoteReferenceStorageForm; +use crate::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; +use crate::drive::votes::tree_path_storage_form::TreePathStorageForm; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; +use crate::query::ContractLookupFn; +use crate::verify::RootHash; +use dpp::bincode; +use dpp::identifier::Identifier; +use dpp::voting::votes::resource_vote::ResourceVote; +use grovedb::GroveDb; +use platform_version::version::PlatformVersion; + +impl ContestedResourceVotesGivenByIdentityQuery { + #[inline(always)] + pub(crate) fn verify_identity_votes_given_proof_v0( + &self, + proof: &[u8], + contract_lookup_fn: &ContractLookupFn, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, I), Error> + where + I: FromIterator<(Identifier, ResourceVote)>, + { + let path_query = self.construct_path_query()?; + let (root_hash, proved_key_values) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + + let voters = proved_key_values + .into_iter() + .filter_map(|(path, key, element)| element.map(|element| (path, key, element))) + .map(|(path, key, element)| { + let serialized_reference = element.into_item_bytes()?; + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let reference_storage_form: ContestedDocumentResourceVoteReferenceStorageForm = + bincode::decode_from_slice(&serialized_reference, bincode_config) + .map_err(|e| { + Error::Drive(DriveError::CorruptedSerialization(format!( + "serialization of reference {} is corrupted: {}", + hex::encode(serialized_reference), + e + ))) + })? + .0; + let absolute_path = reference_storage_form + .reference_path_type + .absolute_path(path.as_slice(), Some(key.as_slice()))?; + let vote_id = Identifier::from_vec(key)?; + let vote_storage_form = + ContestedDocumentResourceVoteStorageForm::try_from_tree_path(absolute_path)?; + let data_contract = contract_lookup_fn(&vote_storage_form.contract_id)?.ok_or( + Error::Drive(DriveError::DataContractNotFound(format!( + "data contract with id {} not found when verifying vote {}", + vote_storage_form.contract_id, vote_id + ))), + )?; + let resource_vote = + vote_storage_form.resolve_with_contract(&data_contract, platform_version)?; + Ok((vote_id, resource_vote)) + }) + .collect::>()?; + + Ok((root_hash, voters)) + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_masternode_vote/mod.rs b/packages/rs-drive/src/verify/voting/verify_masternode_vote/mod.rs new file mode 100644 index 00000000000..92a063b8a95 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_masternode_vote/mod.rs @@ -0,0 +1,69 @@ +//! Masternode vote proof verification + +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::verify::RootHash; +use dpp::prelude::DataContract; +use dpp::version::PlatformVersion; +use dpp::voting::votes::Vote; + +impl Drive { + /// Verifies the authenticity of a masternode vote using the provided proof. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the grovedb proof of authenticity for the vote. + /// - `masternode_pro_tx_hash`: A 32-byte array representing the masternode identifier. + /// - `vote`: A reference to the vote being verified. + /// - `verify_subset_of_proof`: A boolean indicating whether a subset of a larger proof is being verified. + /// - `platform_version`: A reference to the platform version against which to verify the vote. + /// + /// # Returns + /// + /// Returns a `Result` with a tuple containing `RootHash` and an `Option`. The `RootHash` represents + /// the root hash of GroveDB, and the `Option` contains the vote if the proved vote differs from the + /// one provided; otherwise, it returns `None`. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof is invalid or does not authenticate the vote. + /// - The `masternode_pro_tx_hash` does not correspond to a valid masternode. + /// - The vote details are incorrect or manipulated. + /// - An unknown or unsupported platform version is provided. + /// + pub fn verify_masternode_vote( + proof: &[u8], + masternode_pro_tx_hash: [u8; 32], + vote: &Vote, + data_contract: &DataContract, + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .voting + .verify_masternode_vote + { + 0 => Self::verify_masternode_vote_v0( + proof, + masternode_pro_tx_hash, + vote, + data_contract, + verify_subset_of_proof, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_masternode_vote".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_masternode_vote/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_masternode_vote/v0/mod.rs new file mode 100644 index 00000000000..cf00e602c3e --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_masternode_vote/v0/mod.rs @@ -0,0 +1,125 @@ +use crate::drive::Drive; +use dpp::data_contract::DataContract; +use grovedb::{GroveDb, PathQuery, SizedQuery}; + +use crate::error::Error; + +use crate::verify::RootHash; + +use crate::drive::votes::paths::vote_contested_resource_identity_votes_tree_path_for_identity_vec; +use crate::drive::votes::storage_form::contested_document_resource_reference_storage_form::ContestedDocumentResourceVoteReferenceStorageForm; +use crate::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; +use crate::drive::votes::tree_path_storage_form::TreePathStorageForm; +use crate::error::drive::DriveError; +use crate::error::proof::ProofError; +use crate::query::Query; +use dpp::voting::votes::Vote; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the masternode vote. + /// + /// This function checks the authenticity of a masternode vote by verifying the provided proof. + /// It can also verify a subset of a larger proof, if specified. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `masternode_pro_tx_hash`: A 32-byte array representing the ProTxHash of the masternode. + /// - `vote`: A reference to the `Vote` struct containing the vote details. + /// - `data_contract`: A reference to the `DataContract` associated with the vote. + /// - `verify_subset_of_proof`: A boolean indicating whether to verify a subset of a larger proof. + /// - `platform_version`: A reference to the `PlatformVersion` struct representing the platform version. + /// + /// # Returns + /// + /// Returns a `Result` containing a tuple of `RootHash` and an `Option`. The `RootHash` represents + /// the root hash of GroveDB, and the `Option` contains the verified vote if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid balance. + /// - The proved key value is not for the correct path or key in balances. + /// - More than one balance is found. + pub(crate) fn verify_masternode_vote_v0( + proof: &[u8], + masternode_pro_tx_hash: [u8; 32], + vote: &Vote, + data_contract: &DataContract, + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + // First we should get the overall document_type_path + let path = vote_contested_resource_identity_votes_tree_path_for_identity_vec( + &masternode_pro_tx_hash, + ); + + let vote_id = vote.vote_poll_unique_id()?; + + let mut query = Query::new(); + query.insert_key(vote_id.to_vec()); + + let path_query = PathQuery::new(path, SizedQuery::new(query, Some(1), None)); + + let (root_hash, mut proved_key_values) = if verify_subset_of_proof { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = proved_key_values.remove(0); + let maybe_vote = maybe_element + .map(|element| { + let serialized_reference = element.into_item_bytes()?; + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let reference_storage_form: ContestedDocumentResourceVoteReferenceStorageForm = + bincode::decode_from_slice(&serialized_reference, bincode_config) + .map_err(|e| { + Error::Drive(DriveError::CorruptedSerialization(format!( + "serialization of reference {} is corrupted: {}", + hex::encode(serialized_reference), + e + ))) + })? + .0; + let absolute_path = reference_storage_form + .reference_path_type + .absolute_path(path.as_slice(), Some(key.as_slice()))?; + let vote_storage_form = + ContestedDocumentResourceVoteStorageForm::try_from_tree_path( + absolute_path, + )?; + let resource_vote = + vote_storage_form.resolve_with_contract(data_contract, platform_version)?; + let proved_vote = resource_vote.into(); + if &proved_vote != vote { + Err(Error::Proof(ProofError::IncorrectProof(format!( + "returned vote {:?} does not match the vote that was sent {:?}", + &proved_vote, vote + )))) + } else { + Ok::(proved_vote) + } + }) + .transpose()?; + Ok((root_hash, maybe_vote)) + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected one masternode vote", + ))) + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_specialized_balance/mod.rs b/packages/rs-drive/src/verify/voting/verify_specialized_balance/mod.rs new file mode 100644 index 00000000000..f92622fd67f --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_specialized_balance/mod.rs @@ -0,0 +1,63 @@ +mod v0; + +use crate::drive::Drive; + +use crate::error::drive::DriveError; + +use crate::error::Error; + +use crate::verify::RootHash; + +use dpp::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an specialized balance. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `specialized_balance_id`: A 32-byte array representing the specialized balance. A method for getting this exists on vote polls. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// - `platform_version`: The platform version against which to verify the identity balance. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid balance. + /// - An unknown or unsupported platform version is provided. + /// + pub fn verify_specialized_balance( + proof: &[u8], + specialized_balance_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .voting + .verify_specialized_balance + { + 0 => Self::verify_specialized_balance_v0( + proof, + specialized_balance_id, + verify_subset_of_proof, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_specialized_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_specialized_balance/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_specialized_balance/v0/mod.rs new file mode 100644 index 00000000000..35fb2cdcf51 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_specialized_balance/v0/mod.rs @@ -0,0 +1,94 @@ +use crate::drive::Drive; + +use crate::error::proof::ProofError; +use crate::error::Error; + +use crate::verify::RootHash; + +use crate::drive::prefunded_specialized_balances::prefunded_specialized_balances_for_voting_path_vec; +use grovedb::{GroveDb, PathQuery}; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Verifies the balance of an identity by their identity ID. + /// + /// `verify_subset_of_proof` is used to indicate if we want to verify a subset of a bigger proof. + /// For example, if the proof can prove the balance and the revision, but here we are only interested + /// in verifying the balance. + /// + /// # Parameters + /// + /// - `proof`: A byte slice representing the proof of authentication from the user. + /// - `identity_id`: A 32-byte array representing the identity ID of the user. + /// - `verify_subset_of_proof`: A boolean indicating whether we are verifying a subset of a larger proof. + /// + /// # Returns + /// + /// If the verification is successful, it returns a `Result` with a tuple of `RootHash` and + /// an `Option`. The `RootHash` represents the root hash of GroveDB, and the + /// `Option` represents the balance of the user's identity if it exists. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// + /// - The proof of authentication is not valid. + /// - The identity ID does not correspond to a valid balance. + /// - The proved key value is not for the correct path or key in balances. + /// - More than one balance is found. + /// + pub(crate) fn verify_specialized_balance_v0( + proof: &[u8], + balance_id: [u8; 32], + verify_subset_of_proof: bool, + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let balance_path = prefunded_specialized_balances_for_voting_path_vec(); + let mut path_query = PathQuery::new_single_key(balance_path.clone(), balance_id.to_vec()); + path_query.query.limit = Some(1); + let (root_hash, mut proved_key_values) = if verify_subset_of_proof { + GroveDb::verify_subset_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + } else { + GroveDb::verify_query_with_absence_proof( + proof, + &path_query, + &platform_version.drive.grove_version, + )? + }; + if proved_key_values.len() == 1 { + let (path, key, maybe_element) = &proved_key_values.remove(0); + if path != &balance_path { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct path in balances".to_string(), + ))); + } + if key != &balance_id { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back an element for the correct key in balances".to_string(), + ))); + } + + let signed_balance = maybe_element + .as_ref() + .map(|element| { + element + .as_sum_item_value() + .map_err(Error::GroveDB)? + .try_into() + .map_err(|_| { + Error::Proof(ProofError::IncorrectValueSize("value size is incorrect")) + }) + }) + .transpose()?; + Ok((root_hash, signed_balance)) + } else { + Err(Error::Proof(ProofError::TooManyElements( + "expected one specialized balance", + ))) + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_start_at_contender_in_proof/mod.rs b/packages/rs-drive/src/verify/voting/verify_start_at_contender_in_proof/mod.rs new file mode 100644 index 00000000000..a4b383eab78 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_start_at_contender_in_proof/mod.rs @@ -0,0 +1,61 @@ +mod v0; + +use crate::verify::RootHash; +use crate::error::drive::DriveError; + +use crate::error::Error; +use dpp::document::Document; +use dpp::version::PlatformVersion; +use crate::query::vote_poll_contestant_votes_query::ResolvedContestedDocumentVotePollVotesDriveQuery; +use crate::query::vote_poll_vote_state_query::Contender; + +impl<'a> ResolvedContestedDocumentVotePollVotesDriveQuery<'a> { + /// Verifies if a document exists at the beginning of a proof, + /// and returns the root hash and the optionally found document. + /// + /// # Arguments + /// + /// * `proof` - A byte slice containing the proof data. + /// * `is_proof_subset` - A boolean indicating whether the proof is a subset query or not. + /// * `document_id` - A byte_32 array, representing the ID of the document to start at. + /// * `platform_version` - The platform version against which to verify the proof. + /// + /// # Returns + /// + /// A `Result` with a tuple containing: + /// * The root hash of the verified proof. + /// * An `Option` containing the found document if available. + /// + /// # Errors + /// + /// This function returns an Error in the following cases: + /// * If the proof is corrupted (wrong path, wrong key, etc.). + /// * If the provided proof has an incorrect number of elements. + pub fn verify_start_at_contender_in_proof( + &self, + proof: &[u8], + is_proof_subset: bool, + document_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + match platform_version + .drive + .methods + .verify + .voting + .verify_start_at_contender_in_proof + { + 0 => self.verify_start_at_contender_in_proof_v0( + proof, + is_proof_subset, + document_id, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_start_at_contender_in_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_start_at_contender_in_proof/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_start_at_contender_in_proof/v0/mod.rs new file mode 100644 index 00000000000..884b3fac2b9 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_start_at_contender_in_proof/v0/mod.rs @@ -0,0 +1,87 @@ +use crate::verify::RootHash; + +use crate::error::proof::ProofError; +use crate::error::Error; +use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; +use dpp::document::Document; +use dpp::version::PlatformVersion; +use grovedb::{GroveDb, PathQuery}; +use crate::query::vote_poll_contestant_votes_query::ResolvedContestedDocumentVotePollVotesDriveQuery; +use crate::query::vote_poll_vote_state_query::Contender; + +impl<'a> ResolvedContestedDocumentVotePollVotesDriveQuery<'a> { + /// Verifies if a document exists at the beginning of a proof, + /// and returns the root hash and the optionally found document. + /// + /// # Arguments + /// + /// * `proof` - A byte slice containing the proof data. + /// * `is_proof_subset` - A boolean indicating whether the proof is a subset query or not. + /// * `document_id` - A byte_32 array, representing the ID of the document to start at. + /// + /// # Returns + /// + /// A `Result` with a tuple containing: + /// * The root hash of the verified proof. + /// * An `Option` containing the found document if available. + /// + /// # Errors + /// + /// This function returns an Error in the following cases: + /// * If the proof is corrupted (wrong path, wrong key, etc.). + /// * If the provided proof has an incorrect number of elements. + #[inline(always)] + pub(super) fn verify_start_at_contender_in_proof_v0( + &self, + proof: &[u8], + is_proof_subset: bool, + contender_identity_id: [u8; 32], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Option), Error> { + let start_at_document_path = ; + let start_at_document_key = contender_identity_id.to_vec(); + let path_query = PathQuery::new_single_key( + start_at_document_path.clone(), + start_at_document_key.clone(), + ); + let (root_hash, mut proved_key_values) = if is_proof_subset { + GroveDb::verify_subset_query(proof, &path_query)? + } else { + GroveDb::verify_query(proof, &path_query)? + }; + match proved_key_values.len() { + 1 => { + let (path, key, maybe_element) = proved_key_values.remove(0); + if path != start_at_document_path { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back a contender for the correct path".to_string(), + ))); + } + if key != start_at_document_key { + return Err(Error::Proof(ProofError::CorruptedProof( + "we did not get back a contender for the correct key".to_string(), + ))); + } + let document = maybe_element + .map(|element| { + let document_bytes = element.into_item_bytes().map_err(Error::GroveDB)?; + Document::from_bytes( + document_bytes.as_slice(), + self.document_type, + platform_version, + ) + .map_err(Error::Protocol) + }) + .transpose()?; + Ok((root_hash, document)) + } + 0 => Err(Error::Proof(ProofError::WrongElementCount { + expected: 1, + got: 0, + })), + _ => Err(Error::Proof(ProofError::TooManyElements( + "expected one contender for start at", + ))), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_vote_poll_vote_state_proof/mod.rs b/packages/rs-drive/src/verify/voting/verify_vote_poll_vote_state_proof/mod.rs new file mode 100644 index 00000000000..1ee300ff607 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_vote_poll_vote_state_proof/mod.rs @@ -0,0 +1,57 @@ +//! Verification of the vote poll proofs + +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; + +use crate::error::Error; + +use crate::query::vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQueryExecutionResult, ResolvedContestedDocumentVotePollDriveQuery, +}; +use dpp::version::PlatformVersion; + +impl<'a> ResolvedContestedDocumentVotePollDriveQuery<'a> { + /// Verifies a proof for the vote poll vote state proof. + /// + /// This function takes a byte slice representing the serialized proof, verifies it, and returns a tuple consisting of the root hash + /// and a vector of deserialized contenders. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `platform_version` - The platform version against which to verify the proof. + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or a deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. A deserialization error occurs when parsing the serialized document(s). + pub fn verify_vote_poll_vote_state_proof( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, ContestedDocumentVotePollDriveQueryExecutionResult), Error> { + match platform_version + .drive + .methods + .verify + .voting + .verify_vote_poll_vote_state_proof + { + 0 => self.verify_vote_poll_vote_state_proof_v0(proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_vote_poll_vote_state_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_vote_poll_vote_state_proof/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_vote_poll_vote_state_proof/v0/mod.rs new file mode 100644 index 00000000000..100e7b827a5 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_vote_poll_vote_state_proof/v0/mod.rs @@ -0,0 +1,347 @@ +use crate::verify::RootHash; +use dpp::identifier::Identifier; +use dpp::serialization::PlatformDeserializable; +use grovedb::{Element, GroveDb}; + +use crate::error::Error; + +use crate::drive::votes::paths::{ + RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32, RESOURCE_LOCK_VOTE_TREE_KEY_U8_32, + RESOURCE_STORED_INFO_KEY_U8_32, +}; +use crate::error::drive::DriveError; +use crate::query::vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQueryExecutionResult, + ContestedDocumentVotePollDriveQueryResultType, ResolvedContestedDocumentVotePollDriveQuery, +}; +use dpp::version::PlatformVersion; +use dpp::voting::contender_structs::{ + ContenderWithSerializedDocument, ContenderWithSerializedDocumentV0, +}; +use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::{ + ContestedDocumentVotePollStoredInfo, ContestedDocumentVotePollStoredInfoV0Getters, +}; + +impl<'a> ResolvedContestedDocumentVotePollDriveQuery<'a> { + /// Verifies a proof for a collection of documents. + /// + /// This function takes a slice of bytes `proof` containing a serialized proof, + /// verifies it, and returns a tuple consisting of the root hash and a vector of deserialized documents. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `drive_version` - The current active drive version + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s, if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. There is a deserialization error when parsing the serialized document(s) into `Document` struct(s). + #[inline(always)] + pub(crate) fn verify_vote_poll_vote_state_proof_v0( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, ContestedDocumentVotePollDriveQueryExecutionResult), Error> { + let path_query = self.construct_path_query(platform_version)?; + // println!("{:?}", &path_query); + let (root_hash, proved_key_values) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + + match self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents => { + let contenders = proved_key_values + .into_iter() + .map(|(mut path, _key, document)| { + let identity_id = + path.pop() + .ok_or(Error::Drive(DriveError::CorruptedDriveState( + "the path must have a last element".to_string(), + )))?; + Ok(ContenderWithSerializedDocumentV0 { + identity_id: Identifier::try_from(identity_id)?, + serialized_document: document + .map(|document| document.into_item_bytes()) + .transpose()?, + vote_tally: None, + } + .into()) + }) + .collect::, Error>>()?; + + Ok(( + root_hash, + ContestedDocumentVotePollDriveQueryExecutionResult { + contenders, + locked_vote_tally: None, + abstaining_vote_tally: None, + winner: None, + skipped: 0, + }, + )) + } + ContestedDocumentVotePollDriveQueryResultType::VoteTally => { + let mut elements_iter = proved_key_values.into_iter(); + let mut contenders = vec![]; + let mut locked_vote_tally: Option = None; + let mut abstaining_vote_tally: Option = None; + let mut winner = None; + + // Handle ascending order + while let Some((path, first_key, element)) = elements_iter.next() { + let Some(element) = element else { + continue; + }; + let Some(identity_bytes) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "the path must have a last element".to_string(), + ))); + }; + + match element { + Element::SumTree(_, sum_tree_value, _) => { + if sum_tree_value < 0 || sum_tree_value > u32::MAX as i64 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "sum tree value for vote tally must be between 0 and u32::Max, received {} from state", + sum_tree_value + )))); + } + + if identity_bytes.as_slice() + == RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.as_slice() + { + locked_vote_tally = Some(sum_tree_value as u32); + } else if identity_bytes.as_slice() + == RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.as_slice() + { + abstaining_vote_tally = Some(sum_tree_value as u32); + } else { + contenders.push( + ContenderWithSerializedDocumentV0 { + identity_id: Identifier::try_from(identity_bytes)?, + serialized_document: None, + vote_tally: Some(sum_tree_value as u32), + } + .into(), + ); + } + } + Element::Item(serialized_item_info, _) => { + if first_key.as_slice() == &RESOURCE_STORED_INFO_KEY_U8_32 { + // this is the stored info, let's check to see if the vote is over + let finalized_contested_document_vote_poll_stored_info = + ContestedDocumentVotePollStoredInfo::deserialize_from_bytes( + &serialized_item_info, + )?; + if finalized_contested_document_vote_poll_stored_info + .vote_poll_status() + .awarded_or_locked() + { + locked_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_locked_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last locked votes".to_string(), + ), + ))?, + ); + abstaining_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_abstain_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last abstain votes".to_string(), + ), + ))?, + ); + winner = Some(( + finalized_contested_document_vote_poll_stored_info.winner(), + finalized_contested_document_vote_poll_stored_info + .last_finalization_block() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have a last finalization block" + .to_string(), + ), + ))?, + )); + contenders = finalized_contested_document_vote_poll_stored_info + .contender_votes_in_vec_of_contender_with_serialized_document().ok_or(Error::Drive(DriveError::CorruptedDriveState( + "we should have a last contender votes".to_string(), + )))?; + } + } else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "the only item that should be returned should be stored info" + .to_string(), + ))); + } + } + _ => { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "unexpected element type in result".to_string(), + ))); + } + } + } + Ok(( + root_hash, + ContestedDocumentVotePollDriveQueryExecutionResult { + contenders, + locked_vote_tally, + abstaining_vote_tally, + winner, + skipped: 0, + }, + )) + } + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => { + let mut elements_iter = proved_key_values.into_iter(); + let mut contenders = vec![]; + let mut locked_vote_tally: Option = None; + let mut abstaining_vote_tally: Option = None; + let mut winner = None; + + // Handle ascending order + while let Some((path, first_key, element)) = elements_iter.next() { + let Some(element) = element else { + continue; + }; + let Some(identity_bytes) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "the path must have a last element".to_string(), + ))); + }; + + match element { + Element::SumTree(_, sum_tree_value, _) => { + if sum_tree_value < 0 || sum_tree_value > u32::MAX as i64 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "sum tree value for vote tally must be between 0 and u32::Max, received {} from state", + sum_tree_value + )))); + } + + if identity_bytes.as_slice() + == RESOURCE_LOCK_VOTE_TREE_KEY_U8_32.as_slice() + { + locked_vote_tally = Some(sum_tree_value as u32); + } else if identity_bytes.as_slice() + == RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32.as_slice() + { + abstaining_vote_tally = Some(sum_tree_value as u32); + } else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "unexpected key for sum tree value in verification".to_string(), + ))); + } + } + Element::Item(serialized_item_info, _) => { + if first_key.as_slice() == &RESOURCE_STORED_INFO_KEY_U8_32 { + // this is the stored info, let's check to see if the vote is over + let finalized_contested_document_vote_poll_stored_info = + ContestedDocumentVotePollStoredInfo::deserialize_from_bytes( + &serialized_item_info, + )?; + if finalized_contested_document_vote_poll_stored_info + .vote_poll_status() + .awarded_or_locked() + { + locked_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_locked_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last locked votes".to_string(), + ), + ))?, + ); + abstaining_vote_tally = Some( + finalized_contested_document_vote_poll_stored_info + .last_abstain_votes() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have last abstain votes".to_string(), + ), + ))?, + ); + winner = Some(( + finalized_contested_document_vote_poll_stored_info.winner(), + finalized_contested_document_vote_poll_stored_info + .last_finalization_block() + .ok_or(Error::Drive( + DriveError::CorruptedDriveState( + "we should have a last finalization block" + .to_string(), + ), + ))?, + )); + contenders = finalized_contested_document_vote_poll_stored_info + .contender_votes_in_vec_of_contender_with_serialized_document().ok_or(Error::Drive(DriveError::CorruptedDriveState( + "we should have a last contender votes".to_string(), + )))?; + } + } else { + // We should find a sum tree paired with this document + if let Some(( + path_tally, + _, + Some(Element::SumTree(_, sum_tree_value, _)), + )) = elements_iter.next() + { + if path != path_tally { + return Err(Error::Drive(DriveError::CorruptedDriveState("the two results in a chunk when requesting documents and vote tally should both have the same path when in item verifying vote vote state proof".to_string()))); + } + + if sum_tree_value < 0 || sum_tree_value > u32::MAX as i64 { + return Err(Error::Drive(DriveError::CorruptedDriveState(format!( + "sum tree value for vote tally must be between 0 and u32::Max, received {} from state", + sum_tree_value + )))); + } + + let identity_id = Identifier::from_bytes(identity_bytes)?; + let contender = ContenderWithSerializedDocumentV0 { + identity_id, + serialized_document: Some(serialized_item_info), + vote_tally: Some(sum_tree_value as u32), + } + .into(); + contenders.push(contender); + } else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "we should have a sum item after a normal item".to_string(), + ))); + } + } + } + _ => { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "unexpected element type in result".to_string(), + ))); + } + } + } + + Ok(( + root_hash, + ContestedDocumentVotePollDriveQueryExecutionResult { + contenders, + locked_vote_tally, + abstaining_vote_tally, + winner, + skipped: 0, + }, + )) + } + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_vote_poll_votes_proof/mod.rs b/packages/rs-drive/src/verify/voting/verify_vote_poll_votes_proof/mod.rs new file mode 100644 index 00000000000..e41f2cd8dd7 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_vote_poll_votes_proof/mod.rs @@ -0,0 +1,54 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; +use dpp::identifier::Identifier; + +use crate::error::Error; + +use crate::query::vote_poll_contestant_votes_query::ResolvedContestedDocumentVotePollVotesDriveQuery; +use dpp::version::PlatformVersion; + +impl<'a> ResolvedContestedDocumentVotePollVotesDriveQuery<'a> { + /// Verifies a proof for the vote poll vote state proof. + /// + /// This function takes a byte slice representing the serialized proof, verifies it, and returns a tuple consisting of the root hash + /// and a vector of deserialized contenders. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `platform_version` - The platform version against which to verify the proof. + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or a deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. A deserialization error occurs when parsing the serialized document(s). + pub fn verify_vote_poll_votes_proof( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + match platform_version + .drive + .methods + .verify + .voting + .verify_vote_poll_votes_proof + { + 0 => self.verify_vote_poll_votes_proof_v0(proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_vote_poll_votes_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_vote_poll_votes_proof/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_vote_poll_votes_proof/v0/mod.rs new file mode 100644 index 00000000000..f46732d4f3e --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_vote_poll_votes_proof/v0/mod.rs @@ -0,0 +1,49 @@ +use crate::verify::RootHash; +use dpp::identifier::Identifier; +use dpp::platform_value; +use grovedb::GroveDb; + +use crate::error::Error; + +use crate::query::vote_poll_contestant_votes_query::ResolvedContestedDocumentVotePollVotesDriveQuery; +use dpp::version::PlatformVersion; + +impl<'a> ResolvedContestedDocumentVotePollVotesDriveQuery<'a> { + /// Verifies a proof for a collection of documents. + /// + /// This function takes a slice of bytes `proof` containing a serialized proof, + /// verifies it, and returns a tuple consisting of the root hash and a vector of deserialized documents. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the proof to be verified. + /// * `drive_version` - The current active drive version + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with the root hash and a vector of deserialized `Document`s, if the proof is valid. + /// * An `Error` variant, in case the proof verification fails or deserialization error occurs. + /// + /// # Errors + /// + /// This function will return an `Error` variant if: + /// 1. The proof verification fails. + /// 2. There is a deserialization error when parsing the serialized document(s) into `Document` struct(s). + #[inline(always)] + pub(crate) fn verify_vote_poll_votes_proof_v0( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, Vec), Error> { + let path_query = self.construct_path_query(platform_version)?; + let (root_hash, proved_key_values) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + let voters = proved_key_values + .into_iter() + .map(|(_, voter_id, _)| Identifier::try_from(voter_id)) + .collect::, platform_value::Error>>()?; + + Ok((root_hash, voters)) + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_vote_polls_end_date_query/mod.rs b/packages/rs-drive/src/verify/voting/verify_vote_polls_end_date_query/mod.rs new file mode 100644 index 00000000000..8fe3b8c4d7f --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_vote_polls_end_date_query/mod.rs @@ -0,0 +1,62 @@ +mod v0; + +use crate::error::drive::DriveError; +use crate::verify::RootHash; +use dpp::prelude::TimestampMillis; + +use crate::error::Error; + +use crate::query::VotePollsByEndDateDriveQuery; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::VotePoll; + +impl VotePollsByEndDateDriveQuery { + /// Verifies the serialized proof for a vote poll based on the end date. + /// + /// This function analyzes a byte slice which contains the serialized proof, performs verification, and returns + /// the results, which include the root hash of the proof and a structured collection of the contests. + /// + /// # Arguments + /// + /// * `proof` - A byte slice of the serialized proof that needs to be verified. + /// * `platform_version` - The version of the platform which defines how the proof should be verified. + /// + /// # Returns + /// + /// A `Result` which is either: + /// * `Ok((RootHash, I))` if the proof is verified successfully, where `I` is a collection of items with + /// keys as timestamps (in milliseconds since the epoch) and values as vectors of `ContestedDocumentResourceVotePoll` + /// objects, representing voting polls ending at those times. The collection type is flexible and determined by the + /// generic parameter `I`. + /// * `Err(Error)` if there is a failure in proof verification or during the deserialization of documents. + /// + /// # Errors + /// + /// Returns an `Error` if: + /// 1. Proof verification fails due to invalid data or signature issues. + /// 2. Deserialization error occurs due to malformed data or incompatible types in the document(s). + /// + pub fn verify_vote_polls_by_end_date_proof( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, I), Error> + where + I: FromIterator<(TimestampMillis, Vec)>, + { + match platform_version + .drive + .methods + .verify + .voting + .verify_vote_polls_by_end_date_proof + { + 0 => self.verify_vote_polls_by_end_date_proof_v0(proof, platform_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "verify_vote_polls_by_end_date_proof".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/verify/voting/verify_vote_polls_end_date_query/v0/mod.rs b/packages/rs-drive/src/verify/voting/verify_vote_polls_end_date_query/v0/mod.rs new file mode 100644 index 00000000000..bb5e25f9a80 --- /dev/null +++ b/packages/rs-drive/src/verify/voting/verify_vote_polls_end_date_query/v0/mod.rs @@ -0,0 +1,85 @@ +use crate::verify::RootHash; +use dpp::prelude::TimestampMillis; +use dpp::serialization::PlatformDeserializable; +use grovedb::GroveDb; +use std::collections::BTreeMap; + +use crate::error::Error; + +use crate::error::drive::DriveError; +use crate::query::VotePollsByEndDateDriveQuery; +use crate::util::common::encode::decode_u64; +use dpp::voting::vote_polls::VotePoll; +use platform_version::version::PlatformVersion; + +impl VotePollsByEndDateDriveQuery { + /// Verifies a proof and extracts voting poll documents based on their end date. + /// + /// This function takes a slice of bytes `proof` containing a serialized proof, + /// verifies the proof against a constructed path query, and deserializes the documents associated + /// with each proof into `ContestedDocumentResourceVotePoll` instances organized by their + /// timestamps. + /// + /// # Arguments + /// + /// * `proof` - A byte slice representing the serialized proof to be verified. + /// + /// # Returns + /// + /// A `Result` containing: + /// * A tuple with a root hash and a collection of items where the keys are timestamps (in milliseconds since + /// the epoch) and the values are vectors of `ContestedDocumentResourceVotePoll` objects, + /// representing voting polls ending at those times. The collection is flexible and determined by the + /// generic parameter `I`. + /// * An `Error` variant, in case the proof verification fails or if there are deserialization + /// errors while parsing the documents. + /// + /// # Errors + /// + /// This function may return an `Error` if: + /// 1. The proof verification against the constructed path query fails. + /// 2. There is an error in deserializing the byte slices into `ContestedDocumentResourceVotePoll` + /// instances. + /// 3. A required path component (timestamp) is missing in any of the paths returned in the proof, + /// indicating a potentially corrupted state. + #[inline(always)] + pub(crate) fn verify_vote_polls_by_end_date_proof_v0( + &self, + proof: &[u8], + platform_version: &PlatformVersion, + ) -> Result<(RootHash, I), Error> + where + I: FromIterator<(TimestampMillis, Vec)>, + { + let path_query = self.construct_path_query(); + let (root_hash, proved_key_values) = + GroveDb::verify_query(proof, &path_query, &platform_version.drive.grove_version)?; + let vote_polls_by_end_date = proved_key_values + .into_iter() + .filter_map(|(path, _, element)| Some((path, element?))) + .map(|(path, element)| { + let Some(last_path_component) = path.last() else { + return Err(Error::Drive(DriveError::CorruptedDriveState( + "we should always have a path not be null".to_string(), + ))); + }; + let timestamp = decode_u64(last_path_component).map_err(Error::from)?; + let vote_poll_bytes = element.into_item_bytes().map_err(Error::from)?; + let vote_poll = VotePoll::deserialize_from_bytes(&vote_poll_bytes)?; + Ok((timestamp, vote_poll)) + }) + .collect::, Error>>()? + .into_iter() + .fold( + BTreeMap::new(), + |mut acc: BTreeMap>, (timestamp, vote_poll)| { + acc.entry(timestamp).or_default().push(vote_poll); + acc + }, + ) + .into_iter() + .collect::(); + + Ok((root_hash, vote_polls_by_end_date)) + } +} diff --git a/packages/rs-drive/tests/dashpay.rs b/packages/rs-drive/tests/dashpay.rs new file mode 100644 index 00000000000..f00008712cd --- /dev/null +++ b/packages/rs-drive/tests/dashpay.rs @@ -0,0 +1,192 @@ +use dpp::block::block_info::BlockInfo; +use dpp::data_contracts::SystemDataContract; +use dpp::identifier::Identifier; +use dpp::system_data_contracts::load_system_data_contract; +use drive::query::DriveDocumentQuery; +use drive::util::test_helpers::setup::setup_drive_with_initial_state_structure; +use platform_version::version::PlatformVersion; + +mod contact_request { + use super::*; + + #[test] + fn test_user_id_query() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::Dashpay, platform_version) + .expect("failed to load system data contract"); + + drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("should apply contract"); + + let query = DriveDocumentQuery::from_sql_expr( + &format!( + "SELECT * FROM contactRequest WHERE toUserId == '{}'", + Identifier::random() + ), + &data_contract, + None, + ) + .expect("failed to create query"); + + drive + .query_documents(query, None, false, None, None) + .expect("failed to query documents"); + } + + #[test] + fn test_user_id_by_created_at_query() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::Dashpay, platform_version) + .expect("failed to load system data contract"); + + drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("should apply contract"); + + let query = DriveDocumentQuery::from_sql_expr( + &format!( + "SELECT * FROM contactRequest WHERE toUserId == '{}' AND $createdAt > 100 ORDER BY $createdAt asc", + Identifier::random() + ), + &data_contract, + None, + ) + .expect("failed to create query"); + + drive + .query_documents(query, None, false, None, None) + .expect("failed to query documents"); + } + + #[test] + fn test_owner_id_query() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::Dashpay, platform_version) + .expect("failed to load system data contract"); + + drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("should apply contract"); + + let query = DriveDocumentQuery::from_sql_expr( + &format!( + "SELECT * FROM contactRequest WHERE $ownerId == '{}'", + Identifier::random() + ), + &data_contract, + None, + ) + .expect("failed to create query"); + + drive + .query_documents(query, None, false, None, None) + .expect("failed to query documents"); + } + + #[test] + fn test_owner_id_by_created_at_query() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::Dashpay, platform_version) + .expect("failed to load system data contract"); + + drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("should apply contract"); + + let query = DriveDocumentQuery::from_sql_expr( + &format!( + "SELECT * FROM contactRequest WHERE $ownerId == '{}' AND $createdAt > 100 ORDER BY $createdAt asc", + Identifier::random() + ), + &data_contract, + None, + ) + .expect("failed to create query"); + + drive + .query_documents(query, None, false, None, None) + .expect("failed to query documents"); + } + + #[test] + fn test_owner_id_and_to_user_id_query() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::Dashpay, platform_version) + .expect("failed to load system data contract"); + + drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("should apply contract"); + + let query = DriveDocumentQuery::from_sql_expr( + &format!( + "SELECT * FROM contactRequest WHERE $ownerId == '{}' AND toUserId == '{}'", + Identifier::random(), + Identifier::random() + ), + &data_contract, + None, + ) + .expect("failed to create query"); + + drive + .query_documents(query, None, false, None, None) + .expect("failed to query documents"); + } +} diff --git a/packages/rs-drive/tests/deterministic_root_hash.rs b/packages/rs-drive/tests/deterministic_root_hash.rs index 8dd89527748..e2cd8cc75e4 100644 --- a/packages/rs-drive/tests/deterministic_root_hash.rs +++ b/packages/rs-drive/tests/deterministic_root_hash.rs @@ -1,475 +1,321 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Deterministic Root Hash Tests -use grovedb_path::SubtreePath; - -#[cfg(feature = "full")] -use std::borrow::Cow; -#[cfg(feature = "full")] -use std::option::Option::None; - -#[cfg(feature = "full")] -use dpp::document::Document; -#[cfg(feature = "full")] -use dpp::util::cbor_serializer; -#[cfg(feature = "full")] -use drive::common; - -#[cfg(feature = "full")] -use grovedb::{Element, Transaction, TransactionArg}; -#[cfg(feature = "full")] -use rand::seq::SliceRandom; -#[cfg(feature = "full")] -use rand::{Rng, SeedableRng}; -#[cfg(feature = "full")] -use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] -use tempfile::TempDir; - -#[cfg(feature = "full")] -use drive::drive::config::DriveConfig; -#[cfg(feature = "full")] -use drive::drive::flags::StorageFlags; - -#[cfg(feature = "full")] -use drive::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; -#[cfg(feature = "full")] -use drive::drive::{Drive, RootTree}; - -#[cfg(feature = "full")] -use dpp::block::block_info::BlockInfo; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::DataContract; -use dpp::document::serialization_traits::DocumentCborMethodsV0; -use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; -use dpp::version::PlatformVersion; - -use drive::drive::object_size_info::DocumentInfo::DocumentRefInfo; -use drive::tests::helpers::setup::setup_drive; - -#[cfg(feature = "full")] -/// Contains the unique ID for a Dash identity. -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -struct Records { - dash_unique_identity_id: Vec, -} +#[cfg(test)] +mod tests { + use grovedb_path::SubtreePath; -#[cfg(feature = "full")] -/// Info about a DPNS name. -// In the real dpns label is required, we make it optional here for a test -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -struct Domain { - #[serde(rename = "$id")] - id: Vec, - #[serde(rename = "$ownerId")] - owner_id: Vec, - label: Option, - normalized_label: Option, - normalized_parent_domain_name: String, - records: Records, - preorder_salt: Vec, - subdomain_rules: bool, -} + use std::option::Option::None; -#[cfg(feature = "full")] -impl Domain { - /// Creates domains with random data for a given normalized parent domain name. - fn random_domains_in_parent( - count: u32, - seed: u64, - normalized_parent_domain_name: &str, - ) -> Vec { - let first_names = - common::text_file_strings("tests/supporting_files/contract/family/first-names.txt"); - let mut vec: Vec = Vec::with_capacity(count as usize); - - let mut rng = rand::rngs::StdRng::seed_from_u64(seed); - for _i in 0..count { - let label = first_names.choose(&mut rng).unwrap(); - let domain = Domain { - id: Vec::from(rng.gen::<[u8; 32]>()), - owner_id: Vec::from(rng.gen::<[u8; 32]>()), - label: Some(label.clone()), - normalized_label: Some(label.to_lowercase()), - normalized_parent_domain_name: normalized_parent_domain_name.to_string(), - records: Records { - dash_unique_identity_id: Vec::from(rng.gen::<[u8; 32]>()), - }, - preorder_salt: Vec::from(rng.gen::<[u8; 32]>()), - subdomain_rules: false, - }; - vec.push(domain); - } - vec - } -} + use grovedb::{Element, Transaction}; + + use drive::util::storage_flags::StorageFlags; + + use drive::drive::{Drive, RootTree}; + + use dpp::block::block_info::BlockInfo; + use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; + use dpp::version::PlatformVersion; + use drive::util::test_helpers::setup::setup_drive; + + /// Tests that the root hash is being calculated correctly after inserting empty subtrees into + /// the root tree and the DPNS contract. + fn test_root_hash_with_batches(drive: &Drive, db_transaction: &Transaction) { + let platform_version = PlatformVersion::latest(); -#[cfg(feature = "full")] -/// Creates and adds to a contract domains with random data. -pub fn add_domains_to_contract( - drive: &Drive, - contract: &DataContract, - transaction: TransactionArg, - count: u32, - seed: u64, -) { - let platform_version = PlatformVersion::latest(); - let domains = Domain::random_domains_in_parent(count, seed, "dash"); - for domain in domains { - let value = serde_json::to_value(domain).expect("serialized domain"); - let document_cbor = cbor_serializer::serializable_value_to_cbor(&value, Some(0)) - .expect("expected to serialize to cbor"); - let document = Document::from_cbor(document_cbor.as_slice(), None, None, platform_version) - .expect("document should be properly deserialized"); - let document_type = contract - .document_type_for_name("domain") - .expect("expected to get document type"); - - let storage_flags = Some(Cow::Owned(StorageFlags::SingleEpoch(0))); + // [1644293142180] INFO (35 on bf3bb2a2796a): createTree + // path: [] + // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + // key: "00" + // value: "0000000000000000000000000000000000000000000000000000000000000000" + // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + // useTransaction: true + // type: "tree" + // method: "insert" + // appHash: "0000000000000000000000000000000000000000000000000000000000000000" drive - .add_document_for_contract( - DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo((&document, storage_flags)), - owner_id: None, - }, - contract, - document_type, - }, - true, - BlockInfo::genesis(), - true, - transaction, - platform_version, + .grove + .insert( + SubtreePath::empty(), + Into::<&[u8; 1]>::into(RootTree::Identities), + Element::empty_tree(), + None, + Some(db_transaction), + &platform_version.drive.grove_version, ) - .expect("document should be inserted"); - } -} + .unwrap() + .expect("should insert tree"); -#[cfg(feature = "full")] -/// Tests that the root hash is being calculated correctly after inserting empty subtrees into -/// the root tree and the DPNS contract. -fn test_root_hash_with_batches(drive: &Drive, db_transaction: &Transaction) { - let platform_version = PlatformVersion::latest(); - - // [1644293142180] INFO (35 on bf3bb2a2796a): createTree - // path: [] - // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - // key: "00" - // value: "0000000000000000000000000000000000000000000000000000000000000000" - // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" - // useTransaction: true - // type: "tree" - // method: "insert" - // appHash: "0000000000000000000000000000000000000000000000000000000000000000" - - drive - .grove - .insert( - SubtreePath::empty(), - Into::<&[u8; 1]>::into(RootTree::Identities), - Element::empty_tree(), - None, - Some(db_transaction), - ) - .unwrap() - .expect("should insert tree"); - - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - assert_eq!( - hex::encode(app_hash), - "1e4cda5099f53c9accd6e68321b93519ee998fa2ec754002b0e0f1407953bc58" - ); - - //[1644293142181] INFO (35 on bf3bb2a2796a): createTree - // path: [] - // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - // key: "02" - // value: "0000000000000000000000000000000000000000000000000000000000000000" - // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" - // useTransaction: true - // type: "tree" - // method: "insert" - // appHash: "f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b" - - drive - .grove - .insert( - SubtreePath::empty(), - Into::<&[u8; 1]>::into(RootTree::UniquePublicKeyHashesToIdentities), - Element::empty_tree(), - None, - Some(db_transaction), - ) - .unwrap() - .expect("should insert tree"); - - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - assert_eq!( - hex::encode(app_hash), - "f48c73a70469df637f0683b8341479c8561aceb7ebeb2c95200f5788a7387cd6" - ); - - // [1644293142181] INFO (35 on bf3bb2a2796a): createTree - // path: [] - // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - // key: "01" - // value: "0000000000000000000000000000000000000000000000000000000000000000" - // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" - // useTransaction: true - // type: "tree" - // method: "insert" - // appHash: "7a0501f5957bdf9cb3a8ff4966f02265f968658b7a9c62642cba1165e86642f5" - - drive - .grove - .insert( - SubtreePath::empty(), - Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), - Element::empty_tree(), - None, - Some(db_transaction), - ) - .unwrap() - .expect("should insert tree"); - - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - assert_eq!( - hex::encode(app_hash), - "4238e5fe09b99e0f7ea2a4bcea60efd37cf2638743883da547e8fbe254427073" - ); - - // [1644293142182] INFO (35 on bf3bb2a2796a): createTree - // path: [] - // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - // key: "03" - // value: "0000000000000000000000000000000000000000000000000000000000000000" - // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" - // useTransaction: true - // type: "tree" - // method: "insert" - // appHash: "db56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71" - - drive - .grove - .insert( - SubtreePath::empty(), - Into::<&[u8; 1]>::into(RootTree::SpentAssetLockTransactions), - Element::empty_tree(), - None, - Some(db_transaction), - ) - .unwrap() - .expect("should insert tree"); - - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - assert_eq!( - hex::encode(app_hash), - "8d03a90f52a625e711b8edd47f05ae0e6fff3c7ed72ce2fa5e017a9a07792ee0" - ); - - // [1644293142182] INFO (35 on bf3bb2a2796a): createTree - // path: [ - // "03" - // ] - // pathHash: "084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5" - // key: "00" - // value: "0000000000000000000000000000000000000000000000000000000000000000" - // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" - // useTransaction: true - // type: "tree" - // method: "insert" - // appHash: "2bca13b0f7e68d9c0be5c7352484f8bfba5be6c78f094551c1a0f849f4d7cde0" - - drive - .grove - .insert( - &[Into::<&[u8; 1]>::into(RootTree::SpentAssetLockTransactions).as_slice()], - &[0], - Element::empty_tree(), - None, - Some(db_transaction), - ) - .unwrap() - .expect("should insert tree"); - - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - assert_eq!( - hex::encode(app_hash), - "8971441ae66a2f198260930fb6f4f259eda94cbe2be136b63939e4b46f8be730" - ); - - // [1644295643055] INFO (36 on a5bc48c228d6): put - // path: [ - // "00" - // ] - // pathHash: "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" - // key: "f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715" - // value: "01a46269645820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a7156762616c616e636500687265766973696f6e006a7075626c69634b65797381a662696400646461746158210328f474ce2d61d6fdb45c1fb437ddbf167924e6af3303c167f64d8c8857e39ca564747970650067707572706f73650068726561644f6e6c79f76d73656375726974794c6576656c00" - // valueHash: "d7fef03318e2db119a9f5a2d6bcbf9a03fc280b4f4a3f94307736be193c320d4" - // useTransaction: true - // type: "item" - // method: "insert" - // appHash: "76c595401762ddbaa0393dda2068327aab60585242483da3388f3af221bb65c4" - - drive.grove.insert( - &[Into::<&[u8; 1]>::into(RootTree::Identities).as_slice()], - hex::decode("f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715").unwrap().as_slice(), - Element::new_item(hex::decode("01a46269645820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a7156762616c616e636500687265766973696f6e006a7075626c69634b65797381a662696400646461746158210328f474ce2d61d6fdb45c1fb437ddbf167924e6af3303c167f64d8c8857e39ca564747970650067707572706f73650068726561644f6e6c79f76d73656375726974794c6576656c00").unwrap()), - None, - Some(db_transaction), - ).unwrap().expect("should insert"); - - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - assert_eq!( - hex::encode(app_hash), - "76c595401762ddbaa0393dda2068327aab60585242483da3388f3af221bb65c4" - ); - - // [1644295643057] INFO (36 on a5bc48c228d6): put - // path: [ - // "02" - // ] - // pathHash: "dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986" - // key: "6198bae2a577044d7975f4d1a06a8d13a9eab9b0" - // value: "815820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715" - // valueHash: "d8c99c5e59a7c1a1cd47aeeef820585df42a21070d0ece24f316061328212636" - // useTransaction: true - // type: "item" - // method: "insert" - // appHash: "e34e316e84c4639f44c512c5e602ee7d674d33ce69f02237de87af5f6151cdf6" - - drive - .grove - .insert( - &[Into::<&[u8; 1]>::into(RootTree::UniquePublicKeyHashesToIdentities).as_slice()], - hex::decode("6198bae2a577044d7975f4d1a06a8d13a9eab9b0") - .unwrap() - .as_slice(), - Element::new_item( - hex::decode( - "815820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715", - ) - .unwrap(), - ), + let app_hash = drive + .grove + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); + + assert_eq!( + hex::encode(app_hash), + "1e4cda5099f53c9accd6e68321b93519ee998fa2ec754002b0e0f1407953bc58" + ); + + //[1644293142181] INFO (35 on bf3bb2a2796a): createTree + // path: [] + // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + // key: "02" + // value: "0000000000000000000000000000000000000000000000000000000000000000" + // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + // useTransaction: true + // type: "tree" + // method: "insert" + // appHash: "f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b" + + drive + .grove + .insert( + SubtreePath::empty(), + Into::<&[u8; 1]>::into(RootTree::UniquePublicKeyHashesToIdentities), + Element::empty_tree(), + None, + Some(db_transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should insert tree"); + + let app_hash = drive + .grove + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); + + assert_eq!( + hex::encode(app_hash), + "f48c73a70469df637f0683b8341479c8561aceb7ebeb2c95200f5788a7387cd6" + ); + + // [1644293142181] INFO (35 on bf3bb2a2796a): createTree + // path: [] + // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + // key: "01" + // value: "0000000000000000000000000000000000000000000000000000000000000000" + // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + // useTransaction: true + // type: "tree" + // method: "insert" + // appHash: "7a0501f5957bdf9cb3a8ff4966f02265f968658b7a9c62642cba1165e86642f5" + + drive + .grove + .insert( + SubtreePath::empty(), + Into::<&[u8; 1]>::into(RootTree::DataContractDocuments), + Element::empty_tree(), + None, + Some(db_transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should insert tree"); + + let app_hash = drive + .grove + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); + + assert_eq!( + hex::encode(app_hash), + "4238e5fe09b99e0f7ea2a4bcea60efd37cf2638743883da547e8fbe254427073" + ); + + // [1644293142182] INFO (35 on bf3bb2a2796a): createTree + // path: [] + // pathHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + // key: "03" + // value: "0000000000000000000000000000000000000000000000000000000000000000" + // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + // useTransaction: true + // type: "tree" + // method: "insert" + // appHash: "db56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71" + + drive + .grove + .insert( + SubtreePath::empty(), + Into::<&[u8; 1]>::into(RootTree::SpentAssetLockTransactions), + Element::empty_tree(), + None, + Some(db_transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should insert tree"); + + let app_hash = drive + .grove + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); + + assert_eq!( + hex::encode(app_hash), + "8d03a90f52a625e711b8edd47f05ae0e6fff3c7ed72ce2fa5e017a9a07792ee0" + ); + + // [1644293142182] INFO (35 on bf3bb2a2796a): createTree + // path: [ + // "03" + // ] + // pathHash: "084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5" + // key: "00" + // value: "0000000000000000000000000000000000000000000000000000000000000000" + // valueHash: "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + // useTransaction: true + // type: "tree" + // method: "insert" + // appHash: "2bca13b0f7e68d9c0be5c7352484f8bfba5be6c78f094551c1a0f849f4d7cde0" + + drive + .grove + .insert( + &[Into::<&[u8; 1]>::into(RootTree::SpentAssetLockTransactions).as_slice()], + &[0], + Element::empty_tree(), + None, + Some(db_transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should insert tree"); + + let app_hash = drive + .grove + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); + + assert_eq!( + hex::encode(app_hash), + "8971441ae66a2f198260930fb6f4f259eda94cbe2be136b63939e4b46f8be730" + ); + + // [1644295643055] INFO (36 on a5bc48c228d6): put + // path: [ + // "00" + // ] + // pathHash: "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + // key: "f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715" + // value: "01a46269645820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a7156762616c616e636500687265766973696f6e006a7075626c69634b65797381a662696400646461746158210328f474ce2d61d6fdb45c1fb437ddbf167924e6af3303c167f64d8c8857e39ca564747970650067707572706f73650068726561644f6e6c79f76d73656375726974794c6576656c00" + // valueHash: "d7fef03318e2db119a9f5a2d6bcbf9a03fc280b4f4a3f94307736be193c320d4" + // useTransaction: true + // type: "item" + // method: "insert" + // appHash: "76c595401762ddbaa0393dda2068327aab60585242483da3388f3af221bb65c4" + + drive.grove.insert( + &[Into::<&[u8; 1]>::into(RootTree::Identities).as_slice()], + hex::decode("f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715").unwrap().as_slice(), + Element::new_item(hex::decode("01a46269645820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a7156762616c616e636500687265766973696f6e006a7075626c69634b65797381a662696400646461746158210328f474ce2d61d6fdb45c1fb437ddbf167924e6af3303c167f64d8c8857e39ca564747970650067707572706f73650068726561644f6e6c79f76d73656375726974794c6576656c00").unwrap()), None, Some(db_transaction), - ) - .unwrap() - .expect("should insert"); - - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - assert_eq!( - hex::encode(app_hash), - "e34e316e84c4639f44c512c5e602ee7d674d33ce69f02237de87af5f6151cdf6" - ); - - let dpns_contract = - load_system_data_contract(SystemDataContract::DPNS, platform_version.protocol_version) - .expect("should load dpns contract"); - - drive - .apply_contract( - &dpns_contract, - BlockInfo::genesis(), - true, - StorageFlags::optional_default_as_cow(), - Some(db_transaction), - platform_version, - ) - .expect("apply contract"); + &platform_version.drive.grove_version, + ).unwrap().expect("should insert"); - let app_hash = drive - .grove - .root_hash(Some(db_transaction)) - .unwrap() - .expect("should return app hash"); - - let expected_app_hash = "6b8bbf1f069858abf57573f43a62e27d60e6139c4d23e1fe572fa3fe34057973"; + let app_hash = drive + .grove + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); + + assert_eq!( + hex::encode(app_hash), + "76c595401762ddbaa0393dda2068327aab60585242483da3388f3af221bb65c4" + ); + + // [1644295643057] INFO (36 on a5bc48c228d6): put + // path: [ + // "02" + // ] + // pathHash: "dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986" + // key: "6198bae2a577044d7975f4d1a06a8d13a9eab9b0" + // value: "815820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715" + // valueHash: "d8c99c5e59a7c1a1cd47aeeef820585df42a21070d0ece24f316061328212636" + // useTransaction: true + // type: "item" + // method: "insert" + // appHash: "e34e316e84c4639f44c512c5e602ee7d674d33ce69f02237de87af5f6151cdf6" - assert_eq!(hex::encode(app_hash), expected_app_hash); -} + drive + .grove + .insert( + &[Into::<&[u8; 1]>::into(RootTree::UniquePublicKeyHashesToIdentities).as_slice()], + hex::decode("6198bae2a577044d7975f4d1a06a8d13a9eab9b0") + .unwrap() + .as_slice(), + Element::new_item( + hex::decode( + "815820f00100b0c1e3762b8bc1421e113c76b2a635c5930b9abf2b336583be5987a715", + ) + .unwrap(), + ), + None, + Some(db_transaction), + &platform_version.drive.grove_version, + ) + .unwrap() + .expect("should insert"); -#[cfg(feature = "full")] -/// Runs `test_root_hash_with_batches` 10 times. -#[test] -fn test_deterministic_root_hash_with_batches() { - let drive = setup_drive(None); + let app_hash = drive + .grove + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); - let db_transaction = drive.grove.start_transaction(); + assert_eq!( + hex::encode(app_hash), + "e34e316e84c4639f44c512c5e602ee7d674d33ce69f02237de87af5f6151cdf6" + ); - for _ in 0..10 { - test_root_hash_with_batches(&drive, &db_transaction); + let dashpay_contract = + load_system_data_contract(SystemDataContract::Dashpay, platform_version) + .expect("should load dpns contract"); drive + .apply_contract( + &dashpay_contract, + BlockInfo::genesis(), + true, + StorageFlags::optional_default_as_cow(), + Some(db_transaction), + platform_version, + ) + .expect("apply contract"); + + let app_hash = drive .grove - .rollback_transaction(&db_transaction) - .expect("transaction should be rolled back"); + .root_hash(Some(db_transaction), &platform_version.drive.grove_version) + .unwrap() + .expect("should return app hash"); + + let expected_app_hash = "1b80f4a9f00597b3f1ddca904b3cee67576868adcdd802c0a3f91e14209bb402"; + + assert_eq!(hex::encode(app_hash), expected_app_hash); + } + + /// Runs `test_root_hash_with_batches` 10 times. + #[test] + fn test_deterministic_root_hash_with_batches() { + let drive = setup_drive(None); + + let db_transaction = drive.grove.start_transaction(); + + for _ in 0..10 { + test_root_hash_with_batches(&drive, &db_transaction); + + drive + .grove + .rollback_transaction(&db_transaction) + .expect("transaction should be rolled back"); + } } } diff --git a/packages/rs-drive/tests/masternode_rewards.rs b/packages/rs-drive/tests/masternode_rewards.rs new file mode 100644 index 00000000000..56464bbae54 --- /dev/null +++ b/packages/rs-drive/tests/masternode_rewards.rs @@ -0,0 +1,84 @@ +use dpp::block::block_info::BlockInfo; +use dpp::data_contracts::SystemDataContract; +use dpp::identifier::Identifier; +use dpp::system_data_contracts::load_system_data_contract; +use drive::query::DriveDocumentQuery; +use drive::util::test_helpers::setup::setup_drive_with_initial_state_structure; +use platform_version::version::PlatformVersion; + +mod reward_share { + use super::*; + + #[test] + fn test_owner_id_query() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) + .expect("failed to load system data contract"); + + drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("should apply contract"); + + let query = DriveDocumentQuery::from_sql_expr( + &format!( + "SELECT * FROM rewardShare WHERE $ownerId == '{}'", + Identifier::random() + ), + &data_contract, + None, + ) + .expect("failed to create query"); + + drive + .query_documents(query, None, false, None, None) + .expect("failed to query documents"); + } + + #[test] + fn test_owner_id_and_pay_to_id_query() { + let drive = setup_drive_with_initial_state_structure(); + + let platform_version = PlatformVersion::latest(); + + let data_contract = + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) + .expect("failed to load system data contract"); + + drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("should apply contract"); + + let query = DriveDocumentQuery::from_sql_expr( + &format!( + "SELECT * FROM rewardShare WHERE $ownerId == '{}' AND payToId == '{}'", + Identifier::random(), + Identifier::random() + ), + &data_contract, + None, + ) + .expect("failed to create query"); + + drive + .query_documents(query, None, false, None, None) + .expect("failed to query documents"); + } +} diff --git a/packages/rs-drive/tests/query_tests.rs b/packages/rs-drive/tests/query_tests.rs index 3f0340141ae..f29741e83d1 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -1,91 +1,62 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Query Tests //! use ciborium::cbor; -#[cfg(feature = "full")] -use grovedb::TransactionArg; -#[cfg(feature = "full")] -use std::borrow::Cow; -#[cfg(feature = "full")] -use std::collections::HashMap; -#[cfg(feature = "full")] -use std::fs::File; -#[cfg(feature = "full")] -use std::io::{self, BufRead}; -#[cfg(feature = "full")] -use std::option::Option::None; -#[cfg(feature = "full")] -use std::sync::Arc; - -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::data_contract::DataContractFactory; -#[cfg(feature = "full")] -use drive::common; -#[cfg(feature = "full")] -use drive::common::setup_contract; -#[cfg(feature = "full")] -use drive::drive::batch::GroveDbOpBatch; -#[cfg(feature = "full")] -use drive::drive::config::DriveConfig; -#[cfg(feature = "full")] -use drive::drive::flags::StorageFlags; -#[cfg(feature = "full")] -use drive::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] +use drive::config::DriveConfig; +#[cfg(feature = "server")] use drive::drive::Drive; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use drive::error::{query::QuerySyntaxError, Error}; -#[cfg(feature = "full")] -use drive::query::DriveQuery; -#[cfg(feature = "full")] +#[cfg(feature = "server")] +use drive::query::DriveDocumentQuery; +#[cfg(feature = "server")] +use drive::util::batch::GroveDbOpBatch; +#[cfg(feature = "server")] +use drive::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +#[cfg(feature = "server")] +use drive::util::storage_flags::StorageFlags; +#[cfg(feature = "server")] #[cfg(test)] -use drive::tests::helpers::setup::setup_drive; +use drive::util::test_helpers::setup::setup_drive; +#[cfg(feature = "server")] +use drive::util::test_helpers::setup_contract; +#[cfg(feature = "server")] +use grovedb::TransactionArg; use rand::random; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use rand::seq::SliceRandom; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use rand::{Rng, SeedableRng}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use serde_json::json; +#[cfg(feature = "server")] +use std::borrow::Cow; +use std::collections::BTreeMap; +#[cfg(feature = "server")] +use std::collections::HashMap; +#[cfg(feature = "server")] +use std::fs::File; +#[cfg(feature = "server")] +use std::io::{self, BufRead}; +#[cfg(feature = "server")] +use std::option::Option::None; +#[cfg(feature = "server")] +use std::sync::Arc; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::document::Document; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::platform_value::Value; use dpp::platform_value::{platform_value, Bytes32, Identifier}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] +use base64::Engine; +#[cfg(feature = "server")] use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; @@ -94,32 +65,33 @@ use dpp::document::serialization_traits::{ DocumentCborMethodsV0, DocumentPlatformConversionMethodsV0, DocumentPlatformValueMethodsV0, }; use dpp::document::{DocumentV0Getters, DocumentV0Setters}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::identity::TimestampMillis; use dpp::platform_value; - -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::prelude::DataContract; - use dpp::tests::json_document::json_document_to_contract; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::util::cbor_serializer; +use once_cell::sync::Lazy; use dpp::version::PlatformVersion; -use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use drive::drive::contract::test_helpers::add_init_contracts_structure_operations; +use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use drive::drive::document::query::QuerySerializedDocumentsOutcome; -use drive::drive::object_size_info::DocumentInfo; -use drive::drive::object_size_info::DocumentInfo::DocumentRefInfo; +use drive::util::object_size_info::DocumentInfo; +use drive::util::object_size_info::DocumentInfo::DocumentRefInfo; use drive::query::{WhereClause, WhereOperator}; -use drive::tests::helpers::setup::setup_drive_with_initial_state_structure; +use drive::util::test_helpers; +use drive::util::test_helpers::setup::setup_drive_with_initial_state_structure; -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] struct Person { @@ -133,15 +105,18 @@ struct Person { age: u8, } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl Person { fn random_people(count: u32, seed: u64) -> Vec { - let first_names = - common::text_file_strings("tests/supporting_files/contract/family/first-names.txt"); - let middle_names = - common::text_file_strings("tests/supporting_files/contract/family/middle-names.txt"); - let last_names = - common::text_file_strings("tests/supporting_files/contract/family/last-names.txt"); + let first_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/first-names.txt", + ); + let middle_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/middle-names.txt", + ); + let last_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/last-names.txt", + ); let mut vec: Vec = Vec::with_capacity(count as usize); let mut rng = rand::rngs::StdRng::seed_from_u64(seed); @@ -160,7 +135,7 @@ impl Person { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] struct PersonWithOptionalValues { @@ -174,15 +149,18 @@ struct PersonWithOptionalValues { age: u8, } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl PersonWithOptionalValues { fn random_people(count: u32, seed: u64) -> Vec { - let first_names = - common::text_file_strings("tests/supporting_files/contract/family/first-names.txt"); - let middle_names = - common::text_file_strings("tests/supporting_files/contract/family/middle-names.txt"); - let last_names = - common::text_file_strings("tests/supporting_files/contract/family/last-names.txt"); + let first_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/first-names.txt", + ); + let middle_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/middle-names.txt", + ); + let last_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/last-names.txt", + ); let mut vec: Vec = Vec::with_capacity(count as usize); let mut rng = rand::rngs::StdRng::seed_from_u64(seed); @@ -214,7 +192,7 @@ impl PersonWithOptionalValues { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Inserts the test "family" contract and adds `count` documents containing randomly named people to it. pub fn setup_family_tests(count: u32, seed: u64) -> (Drive, DataContract) { let drive_config = DriveConfig::default(); @@ -235,7 +213,7 @@ pub fn setup_family_tests(count: u32, seed: u64) -> (Drive, DataContract) { .expect("expected to create contracts tree successfully"); // setup code - let contract = common::setup_contract( + let contract = test_helpers::setup_contract( &drive, "tests/supporting_files/contract/family/family-contract.json", None, @@ -271,6 +249,7 @@ pub fn setup_family_tests(count: u32, seed: u64) -> (Drive, DataContract) { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); } @@ -283,7 +262,7 @@ pub fn setup_family_tests(count: u32, seed: u64) -> (Drive, DataContract) { (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Same as `setup_family_tests` but with null values in the documents. pub fn setup_family_tests_with_nulls(count: u32, seed: u64) -> (Drive, DataContract) { let drive_config = DriveConfig::default(); @@ -304,7 +283,7 @@ pub fn setup_family_tests_with_nulls(count: u32, seed: u64) -> (Drive, DataContr .expect("expected to create contracts tree successfully"); // setup code - let contract = common::setup_contract( + let contract = test_helpers::setup_contract( &drive, "tests/supporting_files/contract/family/family-contract-fields-optional.json", None, @@ -339,6 +318,7 @@ pub fn setup_family_tests_with_nulls(count: u32, seed: u64) -> (Drive, DataContr true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); } @@ -351,7 +331,7 @@ pub fn setup_family_tests_with_nulls(count: u32, seed: u64) -> (Drive, DataContr (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Inserts the test "family" contract and adds `count` documents containing randomly named people to it. pub fn setup_family_tests_only_first_name_index(count: u32, seed: u64) -> (Drive, DataContract) { let drive_config = DriveConfig::default(); @@ -372,7 +352,7 @@ pub fn setup_family_tests_only_first_name_index(count: u32, seed: u64) -> (Drive .expect("expected to create contracts tree successfully"); // setup code - let contract = common::setup_contract( + let contract = test_helpers::setup_contract( &drive, "tests/supporting_files/contract/family/family-contract-only-first-name-index.json", None, @@ -408,6 +388,7 @@ pub fn setup_family_tests_only_first_name_index(count: u32, seed: u64) -> (Drive true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); } @@ -420,21 +401,21 @@ pub fn setup_family_tests_only_first_name_index(count: u32, seed: u64) -> (Drive (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] struct Records { dash_unique_identity_id: Identifier, } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] struct SubdomainRules { allow_subdomains: bool, } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// DPNS domain info // In the real dpns, label is required. We make it optional here for a test. #[derive(Serialize, Deserialize)] @@ -452,7 +433,7 @@ struct Domain { subdomain_rules: SubdomainRules, } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_serialization_and_deserialization() { let platform_version = PlatformVersion::latest(); @@ -485,7 +466,7 @@ fn test_serialization_and_deserialization() { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_serialization_and_deserialization_with_null_values_should_fail_if_required() { let platform_version = PlatformVersion::latest(); @@ -531,7 +512,7 @@ fn test_serialization_and_deserialization_with_null_values_should_fail_if_requir .expect_err("expected to not be able to serialize domain document"); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_serialization_and_deserialization_with_null_values() { let platform_version = PlatformVersion::latest(); @@ -581,7 +562,7 @@ fn test_serialization_and_deserialization_with_null_values() { .expect("expected to deserialize domain document"); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl Domain { /// Creates `count` random names as domain names for the given parent domain fn random_domains_in_parent( @@ -589,8 +570,9 @@ impl Domain { seed: u64, normalized_parent_domain_name: &str, ) -> Vec { - let first_names = - common::text_file_strings("tests/supporting_files/contract/family/first-names.txt"); + let first_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/first-names.txt", + ); let mut vec: Vec = Vec::with_capacity(count as usize); let mut rng = rand::rngs::StdRng::seed_from_u64(seed); @@ -616,7 +598,7 @@ impl Domain { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Adds `count` random domain names to the given contract pub fn add_domains_to_contract( drive: &Drive, @@ -652,12 +634,13 @@ pub fn add_domains_to_contract( true, transaction, platform_version, + None, ) .expect("document should be inserted"); } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Sets up and inserts random domain name data to the DPNS contract to test queries on. pub fn setup_dpns_tests_with_batches(count: u32, seed: u64) -> (Drive, DataContract) { let drive = setup_drive(Some(DriveConfig::default())); @@ -693,7 +676,7 @@ pub fn setup_dpns_tests_with_batches(count: u32, seed: u64) -> (Drive, DataContr (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Sets up the References contract to test queries on. pub fn setup_references_tests(_count: u32, _seed: u64) -> (Drive, DataContract) { let drive = setup_drive(Some(DriveConfig::default())); @@ -728,7 +711,7 @@ pub fn setup_references_tests(_count: u32, _seed: u64) -> (Drive, DataContract) (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Sets up and inserts random domain name data to the DPNS contract to test queries on. pub fn setup_dpns_tests_label_not_required(count: u32, seed: u64) -> (Drive, DataContract) { let drive = setup_drive(Some(DriveConfig::default())); @@ -764,7 +747,7 @@ pub fn setup_dpns_tests_label_not_required(count: u32, seed: u64) -> (Drive, Dat (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] /// Sets up the DPNS contract and inserts data from the given path to test queries on. pub fn setup_dpns_test_with_data(path: &str) -> (Drive, DataContract) { let drive = setup_drive(None); @@ -791,7 +774,7 @@ pub fn setup_dpns_test_with_data(path: &str) -> (Drive, DataContract) { let file = File::open(path).expect("should read domains from file"); - for domain_json in io::BufReader::new(file).lines().flatten() { + for domain_json in io::BufReader::new(file).lines().map_while(Result::ok) { let domain_json: serde_json::Value = serde_json::from_str(&domain_json).expect("should parse json"); @@ -822,6 +805,7 @@ pub fn setup_dpns_test_with_data(path: &str) -> (Drive, DataContract) { true, Some(&db_transaction), platform_version, + None, ) .expect("expected to insert a document successfully"); } @@ -834,7 +818,7 @@ pub fn setup_dpns_test_with_data(path: &str) -> (Drive, DataContract) { (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] #[ignore] fn test_query_many() { @@ -871,6 +855,7 @@ fn test_query_many() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); } @@ -881,7 +866,7 @@ fn test_query_many() { .expect("transaction should be committed"); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_reference_proof_single_index() { let (drive, contract) = setup_family_tests_only_first_name_index(1, 73509); @@ -892,7 +877,7 @@ fn test_reference_proof_single_index() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); @@ -911,7 +896,7 @@ fn test_reference_proof_single_index() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -929,7 +914,7 @@ fn test_reference_proof_single_index() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_non_existence_reference_proof_single_index() { let (drive, contract) = setup_family_tests_only_first_name_index(0, 73509); @@ -940,7 +925,7 @@ fn test_non_existence_reference_proof_single_index() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); @@ -959,7 +944,7 @@ fn test_non_existence_reference_proof_single_index() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -977,7 +962,7 @@ fn test_non_existence_reference_proof_single_index() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_family_basic_queries() { let (drive, contract) = setup_family_tests(10, 73509); @@ -987,13 +972,13 @@ fn test_family_basic_queries() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 89, 169, 192, 133, 222, 85, 217, 165, 166, 122, 195, 124, 55, 108, 16, 158, 1, 80, 226, 24, - 74, 1, 201, 200, 22, 166, 46, 239, 191, 250, 138, 149, + 32, 210, 24, 196, 148, 43, 20, 34, 0, 116, 183, 136, 32, 210, 163, 183, 214, 6, 152, 86, + 46, 45, 88, 13, 23, 41, 37, 70, 129, 119, 211, 12, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -1026,7 +1011,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1357,7 +1342,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1413,7 +1398,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1464,7 +1449,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1516,7 +1501,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1576,7 +1561,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1624,7 +1609,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1684,7 +1669,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1743,7 +1728,7 @@ fn test_family_basic_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1857,6 +1842,7 @@ fn test_family_basic_queries() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -1901,6 +1887,7 @@ fn test_family_basic_queries() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -2297,26 +2284,29 @@ fn test_family_basic_queries() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); assert_eq!( root_hash.as_slice(), vec![ - 193, 111, 116, 17, 191, 90, 126, 227, 215, 15, 15, 21, 221, 30, 4, 212, 128, 169, 25, - 12, 86, 63, 246, 220, 225, 182, 234, 142, 99, 33, 154, 220 + 251, 69, 177, 93, 128, 236, 106, 87, 205, 123, 80, 61, 44, 107, 186, 193, 22, 192, 239, + 7, 107, 110, 97, 197, 59, 245, 26, 12, 63, 91, 248, 231, ], ); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_family_person_update() { let (drive, contract) = setup_family_tests(10, 73509); let platform_version = PlatformVersion::latest(); + let epoch_change_fee_version_test: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); + let db_transaction = drive.grove.start_transaction(); let mut rng = rand::rngs::StdRng::seed_from_u64(84594); @@ -2363,6 +2353,7 @@ fn test_family_person_update() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -2391,6 +2382,7 @@ fn test_family_person_update() { None, Some(&db_transaction), platform_version, + Some(&epoch_change_fee_version_test), ) .expect("expected to override document"); assert!(fee.storage_fee > 0); @@ -2406,7 +2398,7 @@ fn test_family_person_update() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -2435,7 +2427,7 @@ fn test_family_person_update() { assert_eq!(documents.len(), 1); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_family_starts_at_queries() { let (drive, contract) = setup_family_tests(10, 73509); @@ -2446,13 +2438,13 @@ fn test_family_starts_at_queries() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 89, 169, 192, 133, 222, 85, 217, 165, 166, 122, 195, 124, 55, 108, 16, 158, 1, 80, 226, 24, - 74, 1, 201, 200, 22, 166, 46, 239, 191, 250, 138, 149, + 32, 210, 24, 196, 148, 43, 20, 34, 0, 116, 183, 136, 32, 210, 163, 183, 214, 6, 152, 86, + 46, 45, 88, 13, 23, 41, 37, 70, 129, 119, 211, 12, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -2488,7 +2480,7 @@ fn test_family_starts_at_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -2547,7 +2539,7 @@ fn test_family_starts_at_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -2600,7 +2592,7 @@ fn test_family_starts_at_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -2659,7 +2651,7 @@ fn test_family_starts_at_queries() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -2698,7 +2690,7 @@ fn test_family_starts_at_queries() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_family_sql_query() { // These helpers confirm that sql statements produce the same drive query @@ -2721,7 +2713,7 @@ fn test_family_sql_query() { None, ) .expect("expected to serialize to cbor"); - let query1 = DriveQuery::from_cbor( + let query1 = DriveDocumentQuery::from_cbor( query_cbor.as_slice(), &contract, person_document_type, @@ -2730,8 +2722,9 @@ fn test_family_sql_query() { .expect("should build query"); let sql_string = "select * from person order by firstName asc limit 100"; - let query2 = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query2 = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); assert_eq!(query1, query2); @@ -2745,7 +2738,7 @@ fn test_family_sql_query() { None, ) .expect("expected to serialize to cbor"); - let query1 = DriveQuery::from_cbor( + let query1 = DriveDocumentQuery::from_cbor( query_cbor.as_slice(), &contract, person_document_type, @@ -2754,8 +2747,9 @@ fn test_family_sql_query() { .expect("should build query"); let sql_string = "select * from person where firstName = 'Chris'"; - let query2 = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query2 = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); assert_eq!(query1, query2); @@ -2773,7 +2767,7 @@ fn test_family_sql_query() { None, ) .expect("expected to serialize to cbor"); - let query1 = DriveQuery::from_cbor( + let query1 = DriveDocumentQuery::from_cbor( query_cbor.as_slice(), &contract, person_document_type, @@ -2783,8 +2777,9 @@ fn test_family_sql_query() { let sql_string = "select * from person where firstName < 'Chris' order by firstName asc limit 100"; - let query2 = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query2 = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); assert_eq!(query1, query2); @@ -2802,7 +2797,7 @@ fn test_family_sql_query() { None, ) .expect("expected to serialize to cbor"); - let query1 = DriveQuery::from_cbor( + let query1 = DriveDocumentQuery::from_cbor( query_cbor.as_slice(), &contract, person_document_type, @@ -2812,8 +2807,9 @@ fn test_family_sql_query() { let sql_string = "select * from person where firstName like 'C%' order by firstName asc limit 100"; - let query2 = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query2 = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); assert_eq!(query1, query2); @@ -2832,7 +2828,7 @@ fn test_family_sql_query() { None, ) .expect("expected to serialize to cbor"); - let query1 = DriveQuery::from_cbor( + let query1 = DriveDocumentQuery::from_cbor( query_cbor.as_slice(), &contract, person_document_type, @@ -2841,8 +2837,9 @@ fn test_family_sql_query() { .expect("should build query"); let sql_string = "select * from person where firstName > 'Chris' and firstName <= 'Noellyn' order by firstName asc limit 100"; - let query2 = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query2 = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); assert_eq!(query1, query2); @@ -2861,7 +2858,7 @@ fn test_family_sql_query() { None, ) .expect("expected to serialize to cbor"); - let query1 = DriveQuery::from_cbor( + let query1 = DriveDocumentQuery::from_cbor( query_cbor.as_slice(), &contract, person_document_type, @@ -2871,30 +2868,34 @@ fn test_family_sql_query() { let sql_string = "select * from person where firstName in ('a', 'b') order by firstName limit 100"; - let query2 = DriveQuery::from_sql_expr(sql_string, &contract, &DriveConfig::default()) - .expect("should build query"); + let query2 = + DriveDocumentQuery::from_sql_expr(sql_string, &contract, Some(&DriveConfig::default())) + .expect("should build query"); assert_eq!(query1, query2); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_family_with_nulls_query() { let (drive, contract) = setup_family_tests_with_nulls(10, 30004); let platform_version = PlatformVersion::latest(); + let epoch_change_fee_version_test: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); + let db_transaction = drive.grove.start_transaction(); let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 100, 192, 55, 56, 28, 89, 114, 51, 246, 239, 246, 155, 157, 46, 242, 255, 61, 30, 111, 226, - 252, 227, 130, 243, 99, 202, 83, 249, 253, 202, 142, 36, + 92, 186, 224, 49, 242, 195, 32, 14, 46, 55, 244, 57, 55, 191, 10, 119, 228, 132, 91, 235, + 170, 114, 36, 41, 126, 136, 180, 51, 132, 17, 26, 182, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -2927,7 +2928,7 @@ fn test_family_with_nulls_query() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -2970,14 +2971,15 @@ fn test_family_with_nulls_query() { let document = Document::from_bytes(result.as_slice(), person_document_type, platform_version) .expect("we should be able to deserialize the document"); - base64::encode(document.id().as_slice()) + base64::engine::general_purpose::STANDARD.encode(document.id().as_slice()) }) .collect(); for i in 0..10 { drive .delete_document_for_contract( - base64::decode(ids.get(i).unwrap()) + base64::engine::general_purpose::STANDARD + .decode(ids.get(i).unwrap()) .expect("expected to decode from base64") .try_into() .expect("expected to get 32 bytes"), @@ -2987,6 +2989,7 @@ fn test_family_with_nulls_query() { true, Some(&db_transaction), platform_version, + Some(&epoch_change_fee_version_test), ) .expect("expected to be able to delete the document"); } @@ -2998,7 +3001,7 @@ fn test_family_with_nulls_query() { .expect("unable to commit transaction"); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_query_with_cached_contract() { let (drive, contract) = setup_family_tests(10, 73509); @@ -3009,14 +3012,14 @@ fn test_query_with_cached_contract() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); // Make sure the state is deterministic let expected_app_hash = vec![ - 89, 169, 192, 133, 222, 85, 217, 165, 166, 122, 195, 124, 55, 108, 16, 158, 1, 80, 226, 24, - 74, 1, 201, 200, 22, 166, 46, 239, 191, 250, 138, 149, + 32, 210, 24, 196, 148, 43, 20, 34, 0, 116, 183, 136, 32, 210, 163, 183, 214, 6, 152, 86, + 46, 45, 88, 13, 23, 41, 37, 70, 129, 119, 211, 12, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -3071,7 +3074,7 @@ fn test_query_with_cached_contract() { assert_eq!(Arc::strong_count(&contract_ref), 2); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_contract_verification() { let (drive, contract) = setup_dpns_tests_with_batches(10, 11456); @@ -3080,7 +3083,7 @@ fn test_dpns_query_contract_verification() { let root_hash = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); @@ -3112,7 +3115,7 @@ fn test_contract_keeps_history_fetch_and_verification() { let root_hash = drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); @@ -3148,7 +3151,7 @@ fn test_contract_keeps_history_fetch_and_verification() { ); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query() { let (drive, contract) = setup_dpns_tests_with_batches(10, 11456); @@ -3159,13 +3162,13 @@ fn test_dpns_query() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 88, 200, 104, 25, 220, 137, 57, 167, 129, 211, 38, 203, 187, 175, 80, 226, 238, 54, 203, - 58, 54, 63, 242, 12, 23, 205, 202, 0, 188, 153, 218, 1, + 142, 246, 25, 166, 52, 184, 158, 102, 192, 111, 173, 255, 155, 125, 53, 233, 98, 241, 201, + 233, 2, 58, 47, 90, 209, 207, 147, 204, 83, 68, 183, 143, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -3199,7 +3202,7 @@ fn test_dpns_query() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3250,7 +3253,7 @@ fn test_dpns_query() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3330,7 +3333,7 @@ fn test_dpns_query() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3388,7 +3391,7 @@ fn test_dpns_query() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3447,7 +3450,7 @@ fn test_dpns_query() { assert_eq!(record_id_base68, a_record_id_base58); - // A query getting elements by the dashUniqueIdentityId desc + // A query getting elements by the identity desc let query_value = json!({ "where": [ @@ -3463,7 +3466,7 @@ fn test_dpns_query() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3503,7 +3506,7 @@ fn test_dpns_query() { assert_eq!(root_hash, proof_root_hash); assert_eq!(results, proof_results); - // A query getting 2 elements asc by the dashUniqueIdentityId + // A query getting 2 elements asc by the identity let query_value = json!({ "where": [ @@ -3519,7 +3522,7 @@ fn test_dpns_query() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3567,7 +3570,7 @@ fn test_dpns_query() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3587,7 +3590,7 @@ fn test_dpns_query() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_insertion_no_aliases() { // using ascending order with rangeTo operators @@ -3635,7 +3638,7 @@ fn test_dpns_insertion_no_aliases() { assert_eq!( drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should get root hash"), proof_root_hash @@ -3643,7 +3646,7 @@ fn test_dpns_insertion_no_aliases() { assert_eq!(result.0, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_insertion_with_aliases() { // using ascending order with rangeTo operators @@ -3691,7 +3694,7 @@ fn test_dpns_insertion_with_aliases() { assert_eq!( drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should get root hash"), proof_root_hash @@ -3699,7 +3702,7 @@ fn test_dpns_insertion_with_aliases() { assert_eq!(result.0, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_start_at() { // The point of this test is to test the situation where we have a start at a certain value for the DPNS query. @@ -3711,13 +3714,13 @@ fn test_dpns_query_start_at() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 88, 200, 104, 25, 220, 137, 57, 167, 129, 211, 38, 203, 187, 175, 80, 226, 238, 54, 203, - 58, 54, 63, 242, 12, 23, 205, 202, 0, 188, 153, 218, 1, + 142, 246, 25, 166, 52, 184, 158, 102, 192, 111, 173, 255, 155, 125, 53, 233, 98, 241, 201, + 233, 2, 58, 47, 90, 209, 207, 147, 204, 83, 68, 183, 143, ]; assert_eq!(root_hash.as_slice(), expected_app_hash,); @@ -3756,7 +3759,7 @@ fn test_dpns_query_start_at() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3793,7 +3796,7 @@ fn test_dpns_query_start_at() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_start_after() { // The point of this test is to test the situation where we have a start at a certain value for the DPNS query. @@ -3805,13 +3808,13 @@ fn test_dpns_query_start_after() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 88, 200, 104, 25, 220, 137, 57, 167, 129, 211, 38, 203, 187, 175, 80, 226, 238, 54, 203, - 58, 54, 63, 242, 12, 23, 205, 202, 0, 188, 153, 218, 1, + 142, 246, 25, 166, 52, 184, 158, 102, 192, 111, 173, 255, 155, 125, 53, 233, 98, 241, 201, + 233, 2, 58, 47, 90, 209, 207, 147, 204, 83, 68, 183, 143, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -3850,7 +3853,7 @@ fn test_dpns_query_start_after() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3887,7 +3890,7 @@ fn test_dpns_query_start_after() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_start_at_desc() { // The point of this test is to test the situation where we have a start at a certain value for the DPNS query. @@ -3899,13 +3902,13 @@ fn test_dpns_query_start_at_desc() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 88, 200, 104, 25, 220, 137, 57, 167, 129, 211, 38, 203, 187, 175, 80, 226, 238, 54, 203, - 58, 54, 63, 242, 12, 23, 205, 202, 0, 188, 153, 218, 1, + 142, 246, 25, 166, 52, 184, 158, 102, 192, 111, 173, 255, 155, 125, 53, 233, 98, 241, 201, + 233, 2, 58, 47, 90, 209, 207, 147, 204, 83, 68, 183, 143, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -3944,7 +3947,7 @@ fn test_dpns_query_start_at_desc() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -3981,7 +3984,7 @@ fn test_dpns_query_start_at_desc() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_start_after_desc() { // The point of this test is to test the situation where we have a start at a certain value for the DPNS query. @@ -3993,13 +3996,13 @@ fn test_dpns_query_start_after_desc() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 88, 200, 104, 25, 220, 137, 57, 167, 129, 211, 38, 203, 187, 175, 80, 226, 238, 54, 203, - 58, 54, 63, 242, 12, 23, 205, 202, 0, 188, 153, 218, 1, + 142, 246, 25, 166, 52, 184, 158, 102, 192, 111, 173, 255, 155, 125, 53, 233, 98, 241, 201, + 233, 2, 58, 47, 90, 209, 207, 147, 204, 83, 68, 183, 143, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -4038,7 +4041,7 @@ fn test_dpns_query_start_after_desc() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -4075,7 +4078,7 @@ fn test_dpns_query_start_after_desc() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_start_at_with_null_id() { // The point of this test is to test the situation where we have a start at inside an index with a null value @@ -4130,6 +4133,7 @@ fn test_dpns_query_start_at_with_null_id() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -4172,6 +4176,7 @@ fn test_dpns_query_start_at_with_null_id() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -4185,13 +4190,13 @@ fn test_dpns_query_start_at_with_null_id() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 196, 88, 107, 126, 145, 188, 9, 93, 124, 49, 144, 228, 194, 46, 199, 188, 22, 167, 13, 218, - 20, 0, 30, 204, 160, 186, 48, 189, 240, 106, 14, 108, + 72, 138, 172, 70, 225, 95, 64, 122, 142, 96, 131, 223, 154, 119, 132, 79, 182, 97, 202, 63, + 120, 116, 39, 217, 25, 208, 176, 49, 242, 138, 67, 112, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -4229,7 +4234,7 @@ fn test_dpns_query_start_at_with_null_id() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -4273,7 +4278,7 @@ fn test_dpns_query_start_at_with_null_id() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_start_after_with_null_id() { // The point of this test is to test the situation where we have a start at inside an index with a null value @@ -4330,6 +4335,7 @@ fn test_dpns_query_start_after_with_null_id() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -4373,6 +4379,7 @@ fn test_dpns_query_start_after_with_null_id() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -4386,13 +4393,13 @@ fn test_dpns_query_start_after_with_null_id() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 196, 88, 107, 126, 145, 188, 9, 93, 124, 49, 144, 228, 194, 46, 199, 188, 22, 167, 13, 218, - 20, 0, 30, 204, 160, 186, 48, 189, 240, 106, 14, 108, + 72, 138, 172, 70, 225, 95, 64, 122, 142, 96, 131, 223, 154, 119, 132, 79, 182, 97, 202, 63, + 120, 116, 39, 217, 25, 208, 176, 49, 242, 138, 67, 112, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -4430,7 +4437,7 @@ fn test_dpns_query_start_after_with_null_id() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -4478,7 +4485,7 @@ fn test_dpns_query_start_after_with_null_id() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_dpns_query_start_after_with_null_id_desc() { // The point of this test is to test the situation where we have a start at inside an index with a null value @@ -4535,6 +4542,7 @@ fn test_dpns_query_start_after_with_null_id_desc() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -4578,6 +4586,7 @@ fn test_dpns_query_start_after_with_null_id_desc() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -4591,13 +4600,13 @@ fn test_dpns_query_start_after_with_null_id_desc() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); let expected_app_hash = vec![ - 196, 88, 107, 126, 145, 188, 9, 93, 124, 49, 144, 228, 194, 46, 199, 188, 22, 167, 13, 218, - 20, 0, 30, 204, 160, 186, 48, 189, 240, 106, 14, 108, + 72, 138, 172, 70, 225, 95, 64, 122, 142, 96, 131, 223, 154, 119, 132, 79, 182, 97, 202, 63, + 120, 116, 39, 217, 25, 208, 176, 49, 242, 138, 67, 112, ]; assert_eq!(root_hash.as_slice(), expected_app_hash,); @@ -4645,7 +4654,7 @@ fn test_dpns_query_start_after_with_null_id_desc() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -4699,7 +4708,7 @@ fn test_dpns_query_start_after_with_null_id_desc() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -4753,7 +4762,7 @@ fn test_dpns_query_start_after_with_null_id_desc() { let domain_document_type = contract .document_type_for_name("domain") .expect("contract should have a domain document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, domain_document_type, @@ -4792,7 +4801,7 @@ fn test_dpns_query_start_after_with_null_id_desc() { assert_eq!(results, proof_results); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_query_a_b_c_d_e_contract() { let drive: Drive = setup_drive_with_initial_state_structure(); @@ -4855,11 +4864,11 @@ fn test_query_a_b_c_d_e_contract() { } }); - let factory = DataContractFactory::new(platform_version.protocol_version, None) - .expect("should create factory"); + let factory = + DataContractFactory::new(platform_version.protocol_version).expect("should create factory"); let contract = factory - .create_with_value_config(owner_id, documents, None, None) + .create_with_value_config(owner_id, 0, documents, None, None) .expect("data in fixture should be correct") .data_contract_owned(); @@ -4907,7 +4916,7 @@ fn test_query_a_b_c_d_e_contract() { .expect("should perform query"); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_query_documents_by_created_at() { let drive = setup_drive_with_initial_state_structure(); @@ -4980,6 +4989,8 @@ fn test_query_documents_by_created_at() { document_value, Identifier::random(), random(), + random(), + random(), platform_version, ) .expect("should create document"); @@ -5003,6 +5014,7 @@ fn test_query_documents_by_created_at() { true, None, platform_version, + None, ) .expect("should add document"); @@ -5022,7 +5034,7 @@ fn test_query_documents_by_created_at() { .document_type_for_name("indexedDocument") .expect("should get document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( &query_bytes, &contract, document_type, @@ -5052,7 +5064,7 @@ fn test_query_documents_by_created_at() { assert_eq!(query_result.documents().len(), 1); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] #[ignore] fn pwd() { diff --git a/packages/rs-drive/tests/query_tests_history.rs b/packages/rs-drive/tests/query_tests_history.rs index dbd756b7c18..2d609f0c2bb 100644 --- a/packages/rs-drive/tests/query_tests_history.rs +++ b/packages/rs-drive/tests/query_tests_history.rs @@ -1,81 +1,49 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Query Tests History //! -#[cfg(feature = "full")] -use std::borrow::Cow; -#[cfg(feature = "full")] -use std::collections::{BTreeMap, HashMap}; -#[cfg(feature = "full")] -use std::fmt::{Debug, Formatter}; -#[cfg(feature = "full")] -use std::option::Option::None; - -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::document::Document; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use dpp::util::cbor_serializer; -#[cfg(feature = "full")] +use once_cell::sync::Lazy; +#[cfg(feature = "server")] use rand::seq::SliceRandom; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use rand::{Rng, SeedableRng}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use serde_json::json; +#[cfg(feature = "server")] +use std::borrow::Cow; +#[cfg(feature = "server")] +use std::collections::{BTreeMap, HashMap}; +#[cfg(feature = "server")] +use std::fmt::{Debug, Formatter}; +#[cfg(feature = "server")] +use std::option::Option::None; -#[cfg(feature = "full")] -use drive::common; - -#[cfg(feature = "full")] -use drive::tests::helpers::setup::setup_drive; +#[cfg(test)] +use drive::util::test_helpers::setup::setup_drive; -#[cfg(feature = "full")] -use drive::drive::batch::GroveDbOpBatch; -#[cfg(feature = "full")] -use drive::drive::config::DriveConfig; -#[cfg(feature = "full")] +#[cfg(feature = "server")] +use drive::config::DriveConfig; +#[cfg(test)] use drive::drive::contract::test_helpers::add_init_contracts_structure_operations; -#[cfg(feature = "full")] -use drive::drive::flags::StorageFlags; -#[cfg(feature = "full")] -use drive::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use drive::drive::Drive; -#[cfg(feature = "full")] +#[cfg(feature = "server")] use drive::error::{query::QuerySyntaxError, Error}; -#[cfg(feature = "full")] -use drive::query::DriveQuery; - -#[cfg(feature = "full")] +#[cfg(feature = "server")] +use drive::query::DriveDocumentQuery; +#[cfg(feature = "server")] +use drive::util::batch::GroveDbOpBatch; +#[cfg(feature = "server")] +use drive::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +#[cfg(feature = "server")] +use drive::util::storage_flags::StorageFlags; + +#[cfg(feature = "server")] use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::DataContract; @@ -83,13 +51,15 @@ use dpp::document::serialization_traits::{ DocumentCborMethodsV0, DocumentPlatformConversionMethodsV0, }; use dpp::document::DocumentV0Getters; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::tests::json_document::json_document_to_contract; use dpp::version::PlatformVersion; -use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -#[cfg(feature = "full")] -use drive::drive::object_size_info::DocumentInfo::DocumentRefInfo; +use drive::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; +#[cfg(feature = "server")] +use drive::util::object_size_info::DocumentInfo::DocumentRefInfo; +use drive::util::test_helpers; -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] struct Person { @@ -104,7 +74,7 @@ struct Person { age: u8, } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl Debug for Person { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("Person") @@ -119,20 +89,24 @@ impl Debug for Person { } } -#[cfg(feature = "full")] +#[cfg(feature = "server")] impl Person { fn random_people_for_block_times( count: usize, seed: u64, block_times: Vec, ) -> BTreeMap> { - let first_names = - common::text_file_strings("tests/supporting_files/contract/family/first-names.txt"); - let middle_names = - common::text_file_strings("tests/supporting_files/contract/family/middle-names.txt"); - let last_names = - common::text_file_strings("tests/supporting_files/contract/family/last-names.txt"); - let quotes = common::text_file_strings("tests/supporting_files/contract/family/quotes.txt"); + let first_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/first-names.txt", + ); + let middle_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/middle-names.txt", + ); + let last_names = test_helpers::text_file_strings( + "tests/supporting_files/contract/family/last-names.txt", + ); + let quotes = + test_helpers::text_file_strings("tests/supporting_files/contract/family/quotes.txt"); let mut people: Vec = Vec::with_capacity(count); let mut rng = rand::rngs::StdRng::seed_from_u64(seed); @@ -180,7 +154,7 @@ impl Person { } } -#[cfg(feature = "full")] +#[cfg(test)] /// Sets up the `family-contract-with-history` contract to test queries on. pub fn setup( count: usize, @@ -191,6 +165,9 @@ pub fn setup( let platform_version = PlatformVersion::latest(); + let epoch_change_fee_version_test: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); + let drive = setup_drive(Some(drive_config)); let db_transaction = drive.grove.start_transaction(); @@ -205,7 +182,7 @@ pub fn setup( .expect("expected to create contracts tree successfully"); // setup code - let contract = common::setup_contract( + let contract = test_helpers::setup_contract( &drive, "tests/supporting_files/contract/family/family-contract-with-history.json", None, @@ -254,6 +231,7 @@ pub fn setup( true, Some(&db_transaction), platform_version, + Some(&epoch_change_fee_version_test), ) .expect("expected to add document"); } @@ -267,32 +245,35 @@ pub fn setup( (drive, contract) } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_setup() { let range_inserts = vec![0, 2]; setup(10, Some(range_inserts), 73509); } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[test] fn test_query_historical() { let (drive, contract) = setup(10, None, 73509); let platform_version = PlatformVersion::latest(); + let epoch_change_fee_version_test: Lazy = + Lazy::new(|| BTreeMap::from([(0, PlatformVersion::first().fee_version.clone())])); + let db_transaction = drive.grove.start_transaction(); let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); assert_eq!( root_hash.as_slice(), vec![ - 102, 136, 207, 211, 64, 180, 182, 231, 135, 104, 94, 128, 232, 166, 229, 141, 193, 34, - 150, 114, 64, 54, 125, 7, 88, 34, 175, 191, 184, 19, 0, 80 + 205, 118, 170, 4, 239, 225, 106, 241, 143, 230, 171, 5, 197, 170, 225, 149, 239, 45, + 35, 136, 84, 164, 166, 81, 187, 142, 122, 51, 132, 168, 39, 71, ] ); @@ -324,7 +305,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -573,7 +554,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -623,7 +604,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -669,7 +650,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -749,7 +730,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -803,7 +784,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -851,7 +832,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -893,7 +874,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -968,7 +949,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1022,7 +1003,7 @@ fn test_query_historical() { let person_document_type = contract .document_type_for_name("person") .expect("contract should have a person document type"); - let query = DriveQuery::from_cbor( + let query = DriveDocumentQuery::from_cbor( where_cbor.as_slice(), &contract, person_document_type, @@ -1131,6 +1112,7 @@ fn test_query_historical() { true, Some(&db_transaction), platform_version, + Some(&epoch_change_fee_version_test), ) .expect("document should be inserted"); @@ -1176,6 +1158,7 @@ fn test_query_historical() { true, Some(&db_transaction), platform_version, + None, ) .expect("document should be inserted"); @@ -1615,7 +1598,7 @@ fn test_query_historical() { matches!(result, Err(Error::Query(QuerySyntaxError::StartDocumentNotFound(message))) if message == "startAt document not found") ); - // using non existing document in startAfter + // using non-existing document in startAfter let query_value = json!({ "where": [ @@ -1649,14 +1632,14 @@ fn test_query_historical() { let root_hash = drive .grove - .root_hash(Some(&db_transaction)) + .root_hash(Some(&db_transaction), &platform_version.drive.grove_version) .unwrap() .expect("there is always a root hash"); assert_eq!( root_hash.as_slice(), vec![ - 167, 173, 50, 226, 194, 111, 161, 168, 48, 247, 9, 139, 1, 108, 131, 162, 190, 115, - 218, 47, 154, 236, 223, 8, 43, 17, 147, 206, 255, 237, 64, 109 + 244, 130, 19, 188, 172, 179, 227, 194, 92, 1, 134, 232, 193, 67, 100, 136, 45, 64, 180, + 42, 178, 247, 49, 199, 194, 104, 96, 89, 146, 82, 46, 196 ] ); } diff --git a/packages/rs-drive/tests/supporting_files/contract/dpns/domain0.json b/packages/rs-drive/tests/supporting_files/contract/dpns/domain0.json index e06db44a998..7432ca43bd1 100644 --- a/packages/rs-drive/tests/supporting_files/contract/dpns/domain0.json +++ b/packages/rs-drive/tests/supporting_files/contract/dpns/domain0.json @@ -8,7 +8,7 @@ "normalizedParentDomainName": "dashpay", "preorderSalt": "SysX9ol1uoyAaEbFzImAcPP2JCO+ydh/Lb6ES0wU8Tc=", "records": { - "dashUniqueIdentityId": "AYjYxDqLy2hvGQADqE6FAkBnQEpJSzNd3CRw1tpS6vZ7" + "identity": "AYjYxDqLy2hvGQADqE6FAkBnQEpJSzNd3CRw1tpS6vZ7" }, "subdomainRules": { "allowSubdomains": false diff --git a/packages/rs-drive/tests/supporting_files/contract/dpns/domains-no-alias.json b/packages/rs-drive/tests/supporting_files/contract/dpns/domains-no-alias.json index ae83c66e53b..a296ea78f10 100644 --- a/packages/rs-drive/tests/supporting_files/contract/dpns/domains-no-alias.json +++ b/packages/rs-drive/tests/supporting_files/contract/dpns/domains-no-alias.json @@ -1,15 +1,15 @@ -{"$id":"2HCQ3QgktL5tfCuUu4xhu9i5VW92eHVt5cZ6jBabwFGG","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ","$revision":1,"label":"RT-Jedediah-47528","records":{"dashUniqueIdentityId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ"},"preorderSalt":"Z83UCDxOABjdcqI+dR98pc6zTsbtxqXu8Bl3KnxIceY=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jedediah-47528","normalizedParentDomainName":"dash"} -{"$id":"2R9tFPCwDSMMYwbfB4A48XSoq2U5X3nNgwF52r4qihDs","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca","$revision":1,"label":"hashengineering","records":{"dashUniqueIdentityId":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca"},"preorderSalt":"a9C399pRllqBfa9FWfOuZZz/KPBlKMk+6eylyKe7Dj4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashengineering","normalizedParentDomainName":"dash"} -{"$id":"38vXTn9FumExznoHNe4qZdsUT3mKCgg1d5S1Fkt5eyd3","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy","$revision":1,"label":"RT-Alta-70919","records":{"dashUniqueIdentityId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy"},"preorderSalt":"WWPIhvivw3W2v6gQEZCI00SiipAWMySKa/bVTrvUDYA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-alta-70919","normalizedParentDomainName":"dash"} -{"$id":"3DWLuFmCHY6NDgWjrXjQTfyS9ZbUi7mjx9wxhPEt4D7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U","$revision":1,"label":"RT-Estell-99471","records":{"dashUniqueIdentityId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U"},"preorderSalt":"dnhq+WWF1ANM12/zQHTnHKHG02pp8TCGgnR5F8bzk80=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-estell-99471","normalizedParentDomainName":"dash"} -{"$id":"41LDvKuqVr41iL4EWU3akg3jZnYzXZmpsGqfYvspSdSA","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde","$revision":1,"label":"asd3","records":{"dashUniqueIdentityId":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde"},"preorderSalt":"iXcdrXRu30Pvwc+ZrQz2LpcNq4BxXT4Lz7eD3elAOOA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd3","normalizedParentDomainName":"dash"} -{"$id":"4nSpskBnwxis3UTcSwCkbVxNQY1fGS1W7KDBKB7B6DKu","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2","$revision":1,"label":"RT-Taya-58833","records":{"dashUniqueIdentityId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2"},"preorderSalt":"eaTqXniy9+6zp+VthiSjXJj5yxZRuvPcf78Za+h3tNc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-taya-58833","normalizedParentDomainName":"dash"} -{"$id":"5xu7tGM4phqbo2gsqLhPqQcE6rMQwX7DgpHdebYsWY7o","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3","$revision":1,"label":"RT-Jaylin-1631","records":{"dashUniqueIdentityId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3"},"preorderSalt":"8z5uJDgukshjYyJg5vlkNoj2VnIyGnXOvdIV1yaArtA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jaylin-1631","normalizedParentDomainName":"dash"} -{"$id":"7dLjvs5Yq9HP3gKu55QMhtfS1MyVTsgfyEoYPzKhoJZb","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2","$revision":1,"label":"asd1","records":{"dashUniqueIdentityId":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2"},"preorderSalt":"QjL1p6aRqHUigJVDty4xNqMbpzdk0vVrJUBaEdVGgrw=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd1","normalizedParentDomainName":"dash"} -{"$id":"8ixRzw8p8AXAuxzmMLjNQEjX82nHbrwHBP7Z8mPh1WCW","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm","$revision":1,"label":"RT-Lessie-54694","records":{"dashUniqueIdentityId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm"},"preorderSalt":"yzS0UdomizuVdTGpJRGTAc5LnAy/uMsHeSy8Me7+OF4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-lessie-54694","normalizedParentDomainName":"dash"} -{"$id":"CLQWPJbD83seWkTsVgwFsfBFoJNcpUoVw5cdKfvCSRaT","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3","$revision":1,"label":"RT-Kelli-12496","records":{"dashUniqueIdentityId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3"},"preorderSalt":"3JTrcf/fwnXF5eFZGIH0gG4Bfx4gqX8iq5W/Tgq0WDc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-kelli-12496","normalizedParentDomainName":"dash"} -{"$id":"EATdWbRvUW6ku8QkYSzQAA6ptjD3TkiHmB7jRLxNXFje","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz","$revision":1,"label":"hashalgorithm","records":{"dashUniqueIdentityId":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz"},"preorderSalt":"JBW3GK+RH48O/x9EXQGPrk1EBrU5gDxRhL/mc0sf+6M=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashalgorithm","normalizedParentDomainName":"dash"} -{"$id":"F88sCqKELoK5xRmJdb6PrY1yzRNDFZaBMvrnk6V6i8up","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J","$revision":1,"label":"RT-Hipolito-3704","records":{"dashUniqueIdentityId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J"},"preorderSalt":"H3IlKGdiXWK7luuP+OtT4xEPdAyEyFTL6/V7biUmK5U=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-hipolito-3704","normalizedParentDomainName":"dash"} -{"$id":"FXyN2NZAdRFADgBQfb1XM1Qq7pWoEcgSWj1GaiQJqcrS","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","$revision":1,"label":"dash","records":{"dashUniqueIdentityId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF"},"preorderSalt":"4LUIxaNoJaIGaTofQUqhPtvs9DxB48eZ6p5ze0+aoiY=","subdomainRules":{"allowSubdomains":true},"normalizedLabel":"dash","normalizedParentDomainName":"","$createdAt":1640872805000} -{"$id":"GCCMoVogQWanv81cJbhyirneUbAdBvBsq3Q5N2L79Bss","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9","$revision":1,"label":"asd2","records":{"dashUniqueIdentityId":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9"},"preorderSalt":"20A81OSpsxzPVmeGv6xrSa118cWK5EsbTaLJni0zoOk=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd2","normalizedParentDomainName":"dash"} -{"$id":"HqCR7WWDZPhmq1Tm4dM5sag9kp19ZfLY8BLdizdXWa7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2","$revision":1,"label":"RT-Deontae-75806","records":{"dashUniqueIdentityId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2"},"preorderSalt":"+cjZQ09K7o6K234fNaL/6gwca4izTmwenyZDnwATbto=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-deontae-75806","normalizedParentDomainName":"dash"} \ No newline at end of file +{"$id":"2HCQ3QgktL5tfCuUu4xhu9i5VW92eHVt5cZ6jBabwFGG","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ","$revision":1,"label":"RT-Jedediah-47528","records":{"identity":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ"},"preorderSalt":"Z83UCDxOABjdcqI+dR98pc6zTsbtxqXu8Bl3KnxIceY=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jedediah-47528","normalizedParentDomainName":"dash"} +{"$id":"2R9tFPCwDSMMYwbfB4A48XSoq2U5X3nNgwF52r4qihDs","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca","$revision":1,"label":"hashengineering","records":{"identity":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca"},"preorderSalt":"a9C399pRllqBfa9FWfOuZZz/KPBlKMk+6eylyKe7Dj4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashengineering","normalizedParentDomainName":"dash"} +{"$id":"38vXTn9FumExznoHNe4qZdsUT3mKCgg1d5S1Fkt5eyd3","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy","$revision":1,"label":"RT-Alta-70919","records":{"identity":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy"},"preorderSalt":"WWPIhvivw3W2v6gQEZCI00SiipAWMySKa/bVTrvUDYA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-alta-70919","normalizedParentDomainName":"dash"} +{"$id":"3DWLuFmCHY6NDgWjrXjQTfyS9ZbUi7mjx9wxhPEt4D7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U","$revision":1,"label":"RT-Estell-99471","records":{"identity":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U"},"preorderSalt":"dnhq+WWF1ANM12/zQHTnHKHG02pp8TCGgnR5F8bzk80=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-estell-99471","normalizedParentDomainName":"dash"} +{"$id":"41LDvKuqVr41iL4EWU3akg3jZnYzXZmpsGqfYvspSdSA","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde","$revision":1,"label":"asd3","records":{"identity":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde"},"preorderSalt":"iXcdrXRu30Pvwc+ZrQz2LpcNq4BxXT4Lz7eD3elAOOA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd3","normalizedParentDomainName":"dash"} +{"$id":"4nSpskBnwxis3UTcSwCkbVxNQY1fGS1W7KDBKB7B6DKu","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2","$revision":1,"label":"RT-Taya-58833","records":{"identity":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2"},"preorderSalt":"eaTqXniy9+6zp+VthiSjXJj5yxZRuvPcf78Za+h3tNc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-taya-58833","normalizedParentDomainName":"dash"} +{"$id":"5xu7tGM4phqbo2gsqLhPqQcE6rMQwX7DgpHdebYsWY7o","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3","$revision":1,"label":"RT-Jaylin-1631","records":{"identity":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3"},"preorderSalt":"8z5uJDgukshjYyJg5vlkNoj2VnIyGnXOvdIV1yaArtA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jaylin-1631","normalizedParentDomainName":"dash"} +{"$id":"7dLjvs5Yq9HP3gKu55QMhtfS1MyVTsgfyEoYPzKhoJZb","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2","$revision":1,"label":"asd1","records":{"identity":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2"},"preorderSalt":"QjL1p6aRqHUigJVDty4xNqMbpzdk0vVrJUBaEdVGgrw=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd1","normalizedParentDomainName":"dash"} +{"$id":"8ixRzw8p8AXAuxzmMLjNQEjX82nHbrwHBP7Z8mPh1WCW","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm","$revision":1,"label":"RT-Lessie-54694","records":{"identity":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm"},"preorderSalt":"yzS0UdomizuVdTGpJRGTAc5LnAy/uMsHeSy8Me7+OF4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-lessie-54694","normalizedParentDomainName":"dash"} +{"$id":"CLQWPJbD83seWkTsVgwFsfBFoJNcpUoVw5cdKfvCSRaT","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3","$revision":1,"label":"RT-Kelli-12496","records":{"identity":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3"},"preorderSalt":"3JTrcf/fwnXF5eFZGIH0gG4Bfx4gqX8iq5W/Tgq0WDc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-kelli-12496","normalizedParentDomainName":"dash"} +{"$id":"EATdWbRvUW6ku8QkYSzQAA6ptjD3TkiHmB7jRLxNXFje","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz","$revision":1,"label":"hashalgorithm","records":{"identity":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz"},"preorderSalt":"JBW3GK+RH48O/x9EXQGPrk1EBrU5gDxRhL/mc0sf+6M=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashalgorithm","normalizedParentDomainName":"dash"} +{"$id":"F88sCqKELoK5xRmJdb6PrY1yzRNDFZaBMvrnk6V6i8up","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J","$revision":1,"label":"RT-Hipolito-3704","records":{"identity":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J"},"preorderSalt":"H3IlKGdiXWK7luuP+OtT4xEPdAyEyFTL6/V7biUmK5U=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-hipolito-3704","normalizedParentDomainName":"dash"} +{"$id":"FXyN2NZAdRFADgBQfb1XM1Qq7pWoEcgSWj1GaiQJqcrS","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","$revision":1,"label":"dash","records":{"identity":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF"},"preorderSalt":"4LUIxaNoJaIGaTofQUqhPtvs9DxB48eZ6p5ze0+aoiY=","subdomainRules":{"allowSubdomains":true},"normalizedLabel":"dash","normalizedParentDomainName":"","$createdAt":1640872805000} +{"$id":"GCCMoVogQWanv81cJbhyirneUbAdBvBsq3Q5N2L79Bss","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9","$revision":1,"label":"asd2","records":{"identity":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9"},"preorderSalt":"20A81OSpsxzPVmeGv6xrSa118cWK5EsbTaLJni0zoOk=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd2","normalizedParentDomainName":"dash"} +{"$id":"HqCR7WWDZPhmq1Tm4dM5sag9kp19ZfLY8BLdizdXWa7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2","$revision":1,"label":"RT-Deontae-75806","records":{"identity":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2"},"preorderSalt":"+cjZQ09K7o6K234fNaL/6gwca4izTmwenyZDnwATbto=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-deontae-75806","normalizedParentDomainName":"dash"} \ No newline at end of file diff --git a/packages/rs-drive/tests/supporting_files/contract/dpns/domains.json b/packages/rs-drive/tests/supporting_files/contract/dpns/domains.json index 6d754f0b810..68ec447c937 100644 --- a/packages/rs-drive/tests/supporting_files/contract/dpns/domains.json +++ b/packages/rs-drive/tests/supporting_files/contract/dpns/domains.json @@ -1,24 +1,24 @@ {"$id":"H4beHoyZrZqXkb5NF76fToAJ5xtBd4bdUsxNV5ynpEq","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2","$revision":1,"label":"RT-Taya-58833-alias","records":{"dashAliasIdentityId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2"},"preorderSalt":"Nyt1RTwTtVMfZsFg7tF7HniTKjiRMAnULpAm1aDBoug=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-taya-58833-alias","normalizedParentDomainName":"dash"} {"$id":"jWE9BhZ7TE6SgpTS8eg31vxWc4kt5VahMDezA4vYyQc","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2","$revision":1,"label":"RT-Deontae-75806-alias","records":{"dashAliasIdentityId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2"},"preorderSalt":"Nb8zvE4zzpbiGUx2jj6e4T+HnoyDvMG/wtMqUWSURxk=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-deontae-75806-alias","normalizedParentDomainName":"dash"} -{"$id":"2HCQ3QgktL5tfCuUu4xhu9i5VW92eHVt5cZ6jBabwFGG","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ","$revision":1,"label":"RT-Jedediah-47528","records":{"dashUniqueIdentityId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ"},"preorderSalt":"Z83UCDxOABjdcqI+dR98pc6zTsbtxqXu8Bl3KnxIceY=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jedediah-47528","normalizedParentDomainName":"dash"} -{"$id":"2R9tFPCwDSMMYwbfB4A48XSoq2U5X3nNgwF52r4qihDs","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca","$revision":1,"label":"hashengineering","records":{"dashUniqueIdentityId":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca"},"preorderSalt":"a9C399pRllqBfa9FWfOuZZz/KPBlKMk+6eylyKe7Dj4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashengineering","normalizedParentDomainName":"dash"} +{"$id":"2HCQ3QgktL5tfCuUu4xhu9i5VW92eHVt5cZ6jBabwFGG","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ","$revision":1,"label":"RT-Jedediah-47528","records":{"identity":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ"},"preorderSalt":"Z83UCDxOABjdcqI+dR98pc6zTsbtxqXu8Bl3KnxIceY=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jedediah-47528","normalizedParentDomainName":"dash"} +{"$id":"2R9tFPCwDSMMYwbfB4A48XSoq2U5X3nNgwF52r4qihDs","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca","$revision":1,"label":"hashengineering","records":{"identity":"7XKBbdV8ssVEq6kAKkHp6kBjPGg1x6GBqRRXkcnRZeca"},"preorderSalt":"a9C399pRllqBfa9FWfOuZZz/KPBlKMk+6eylyKe7Dj4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashengineering","normalizedParentDomainName":"dash"} {"$id":"2n3a5fuJdMdB6QPwaJiCe9mW9onQZgMzfhi33NZctTqJ","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U","$revision":1,"label":"RT-Estell-99471-alias","records":{"dashAliasIdentityId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U"},"preorderSalt":"fq64gibUhBxp0GerizGgVQNEFRiMb/GYDmkBoLb2h8w=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-estell-99471-alias","normalizedParentDomainName":"dash"} -{"$id":"38vXTn9FumExznoHNe4qZdsUT3mKCgg1d5S1Fkt5eyd3","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy","$revision":1,"label":"RT-Alta-70919","records":{"dashUniqueIdentityId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy"},"preorderSalt":"WWPIhvivw3W2v6gQEZCI00SiipAWMySKa/bVTrvUDYA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-alta-70919","normalizedParentDomainName":"dash"} +{"$id":"38vXTn9FumExznoHNe4qZdsUT3mKCgg1d5S1Fkt5eyd3","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy","$revision":1,"label":"RT-Alta-70919","records":{"identity":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy"},"preorderSalt":"WWPIhvivw3W2v6gQEZCI00SiipAWMySKa/bVTrvUDYA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-alta-70919","normalizedParentDomainName":"dash"} {"$id":"3C5SvB62rAJeGwchMbwbBpUyFzHXAvHjjRAYcreex74M","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3","$revision":1,"label":"RT-Jaylin-1631-alias","records":{"dashAliasIdentityId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3"},"preorderSalt":"7P1Sk5kk10b9DYMByveBsof0SpbfHRb5UBbUfVtqV48=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jaylin-1631-alias","normalizedParentDomainName":"dash"} -{"$id":"3DWLuFmCHY6NDgWjrXjQTfyS9ZbUi7mjx9wxhPEt4D7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U","$revision":1,"label":"RT-Estell-99471","records":{"dashUniqueIdentityId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U"},"preorderSalt":"dnhq+WWF1ANM12/zQHTnHKHG02pp8TCGgnR5F8bzk80=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-estell-99471","normalizedParentDomainName":"dash"} -{"$id":"41LDvKuqVr41iL4EWU3akg3jZnYzXZmpsGqfYvspSdSA","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde","$revision":1,"label":"asd3","records":{"dashUniqueIdentityId":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde"},"preorderSalt":"iXcdrXRu30Pvwc+ZrQz2LpcNq4BxXT4Lz7eD3elAOOA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd3","normalizedParentDomainName":"dash"} -{"$id":"4nSpskBnwxis3UTcSwCkbVxNQY1fGS1W7KDBKB7B6DKu","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2","$revision":1,"label":"RT-Taya-58833","records":{"dashUniqueIdentityId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2"},"preorderSalt":"eaTqXniy9+6zp+VthiSjXJj5yxZRuvPcf78Za+h3tNc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-taya-58833","normalizedParentDomainName":"dash"} -{"$id":"5xu7tGM4phqbo2gsqLhPqQcE6rMQwX7DgpHdebYsWY7o","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3","$revision":1,"label":"RT-Jaylin-1631","records":{"dashUniqueIdentityId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3"},"preorderSalt":"8z5uJDgukshjYyJg5vlkNoj2VnIyGnXOvdIV1yaArtA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jaylin-1631","normalizedParentDomainName":"dash"} +{"$id":"3DWLuFmCHY6NDgWjrXjQTfyS9ZbUi7mjx9wxhPEt4D7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U","$revision":1,"label":"RT-Estell-99471","records":{"identity":"3VwD23t6Sn5SPHfbh3NkaWUJeKVuxPqD9PHKHQkD3D9U"},"preorderSalt":"dnhq+WWF1ANM12/zQHTnHKHG02pp8TCGgnR5F8bzk80=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-estell-99471","normalizedParentDomainName":"dash"} +{"$id":"41LDvKuqVr41iL4EWU3akg3jZnYzXZmpsGqfYvspSdSA","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde","$revision":1,"label":"asd3","records":{"identity":"5MFdCrwbALwjqjF9PqzZqQL4p9BW8CnGUa6QwNVsccde"},"preorderSalt":"iXcdrXRu30Pvwc+ZrQz2LpcNq4BxXT4Lz7eD3elAOOA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd3","normalizedParentDomainName":"dash"} +{"$id":"4nSpskBnwxis3UTcSwCkbVxNQY1fGS1W7KDBKB7B6DKu","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2","$revision":1,"label":"RT-Taya-58833","records":{"identity":"GaJYCnEBmzQupp7HQh1cW2j4pzjsJKbD1nbhX2gXvhM2"},"preorderSalt":"eaTqXniy9+6zp+VthiSjXJj5yxZRuvPcf78Za+h3tNc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-taya-58833","normalizedParentDomainName":"dash"} +{"$id":"5xu7tGM4phqbo2gsqLhPqQcE6rMQwX7DgpHdebYsWY7o","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3","$revision":1,"label":"RT-Jaylin-1631","records":{"identity":"8H8MsSTjYCk16aoEbkHbRnUbLQBeH8h8bhuCm4SoAPC3"},"preorderSalt":"8z5uJDgukshjYyJg5vlkNoj2VnIyGnXOvdIV1yaArtA=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jaylin-1631","normalizedParentDomainName":"dash"} {"$id":"7QUT57KxZkL1zrZdWgo1VnCssvnr5AMm1krtaafL2KVL","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy","$revision":1,"label":"RT-Alta-70919-alias","records":{"dashAliasIdentityId":"3k9UhUNPJqm7fDTFb7D8LZd33MsQFTbyZFiwPNGLZvdy"},"preorderSalt":"5DURDOV+eB/nv+M7PPryYJLs8n8zVrx+ymr6+prX0LY=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-alta-70919-alias","normalizedParentDomainName":"dash"} -{"$id":"7dLjvs5Yq9HP3gKu55QMhtfS1MyVTsgfyEoYPzKhoJZb","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2","$revision":1,"label":"asd1","records":{"dashUniqueIdentityId":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2"},"preorderSalt":"QjL1p6aRqHUigJVDty4xNqMbpzdk0vVrJUBaEdVGgrw=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd1","normalizedParentDomainName":"dash"} +{"$id":"7dLjvs5Yq9HP3gKu55QMhtfS1MyVTsgfyEoYPzKhoJZb","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2","$revision":1,"label":"asd1","records":{"identity":"5BhfbUG2tYRoGiQPfVAX5vc9ZdHy1DsmZKCvFGgrAoc2"},"preorderSalt":"QjL1p6aRqHUigJVDty4xNqMbpzdk0vVrJUBaEdVGgrw=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd1","normalizedParentDomainName":"dash"} {"$id":"8Vf4mGV5q3uxU51bSA5NEPzDkxeTAVAmGd8fuDXLKRSu","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm","$revision":1,"label":"RT-Lessie-54694-alias","records":{"dashAliasIdentityId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm"},"preorderSalt":"b7o9Zx2wk01q0V+9tT/8vgGs/v+NAaXaqC+G2ADLmAI=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-lessie-54694-alias","normalizedParentDomainName":"dash"} -{"$id":"8ixRzw8p8AXAuxzmMLjNQEjX82nHbrwHBP7Z8mPh1WCW","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm","$revision":1,"label":"RT-Lessie-54694","records":{"dashUniqueIdentityId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm"},"preorderSalt":"yzS0UdomizuVdTGpJRGTAc5LnAy/uMsHeSy8Me7+OF4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-lessie-54694","normalizedParentDomainName":"dash"} +{"$id":"8ixRzw8p8AXAuxzmMLjNQEjX82nHbrwHBP7Z8mPh1WCW","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm","$revision":1,"label":"RT-Lessie-54694","records":{"identity":"AhxHSKuT7zv3XU3nVBjyxhee1XWMJLmSHDU7TQDtxMkm"},"preorderSalt":"yzS0UdomizuVdTGpJRGTAc5LnAy/uMsHeSy8Me7+OF4=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-lessie-54694","normalizedParentDomainName":"dash"} {"$id":"8rCzrJX6VC3JYnUQUW2guM7SMsLjQyUheomgs992XXe6","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ","$revision":1,"label":"RT-Jedediah-47528-alias","records":{"dashAliasIdentityId":"14oSa4dp8DoZsyQv353z2UtV9RUMt2SmSin7mMNP6NMQ"},"preorderSalt":"1jUL8ZROb3qbeXxhhyD4AFkPbjksHLc1VEVBX6wNnWw=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-jedediah-47528-alias","normalizedParentDomainName":"dash"} {"$id":"BxS8vPEnbqY4ViRrw5JDwMUE7yqSrnuHW2ye5BpaXyEH","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J","$revision":1,"label":"RT-Hipolito-3704-alias","records":{"dashAliasIdentityId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J"},"preorderSalt":"cGAhl+rKc3Eh0A6whzoJ2of02BF6Ze9wFtWuYZYBkCc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-hipolito-3704-alias","normalizedParentDomainName":"dash"} -{"$id":"CLQWPJbD83seWkTsVgwFsfBFoJNcpUoVw5cdKfvCSRaT","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3","$revision":1,"label":"RT-Kelli-12496","records":{"dashUniqueIdentityId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3"},"preorderSalt":"3JTrcf/fwnXF5eFZGIH0gG4Bfx4gqX8iq5W/Tgq0WDc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-kelli-12496","normalizedParentDomainName":"dash"} -{"$id":"EATdWbRvUW6ku8QkYSzQAA6ptjD3TkiHmB7jRLxNXFje","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz","$revision":1,"label":"hashalgorithm","records":{"dashUniqueIdentityId":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz"},"preorderSalt":"JBW3GK+RH48O/x9EXQGPrk1EBrU5gDxRhL/mc0sf+6M=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashalgorithm","normalizedParentDomainName":"dash"} -{"$id":"F88sCqKELoK5xRmJdb6PrY1yzRNDFZaBMvrnk6V6i8up","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J","$revision":1,"label":"RT-Hipolito-3704","records":{"dashUniqueIdentityId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J"},"preorderSalt":"H3IlKGdiXWK7luuP+OtT4xEPdAyEyFTL6/V7biUmK5U=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-hipolito-3704","normalizedParentDomainName":"dash"} +{"$id":"CLQWPJbD83seWkTsVgwFsfBFoJNcpUoVw5cdKfvCSRaT","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3","$revision":1,"label":"RT-Kelli-12496","records":{"identity":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3"},"preorderSalt":"3JTrcf/fwnXF5eFZGIH0gG4Bfx4gqX8iq5W/Tgq0WDc=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-kelli-12496","normalizedParentDomainName":"dash"} +{"$id":"EATdWbRvUW6ku8QkYSzQAA6ptjD3TkiHmB7jRLxNXFje","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz","$revision":1,"label":"hashalgorithm","records":{"identity":"CNgFhr7PcRCyv35mvtjnXSSFHTb1Go9cj5QhKxJFu9cz"},"preorderSalt":"JBW3GK+RH48O/x9EXQGPrk1EBrU5gDxRhL/mc0sf+6M=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"hashalgorithm","normalizedParentDomainName":"dash"} +{"$id":"F88sCqKELoK5xRmJdb6PrY1yzRNDFZaBMvrnk6V6i8up","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J","$revision":1,"label":"RT-Hipolito-3704","records":{"identity":"Ftz3RptpL6cve2trop7MFS9gadZTCux9AvPuk8kYnZ8J"},"preorderSalt":"H3IlKGdiXWK7luuP+OtT4xEPdAyEyFTL6/V7biUmK5U=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-hipolito-3704","normalizedParentDomainName":"dash"} {"$id":"FXyN2NZAdRFADgBQfb1XM1Qq7pWoEcgSWj1GaiQJqcrS","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","$revision":1,"label":"dash","records":{"dashAliasIdentityId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF"},"preorderSalt":"4LUIxaNoJaIGaTofQUqhPtvs9DxB48eZ6p5ze0+aoiY=","subdomainRules":{"allowSubdomains":true},"normalizedLabel":"dash","normalizedParentDomainName":"","$createdAt":1640872805000} {"$id":"G8egwJgxMXo7FAwf3tujtHULxJSRPuHBc9pk8REQPjjh","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3","$revision":1,"label":"RT-Kelli-12496-alias","records":{"dashAliasIdentityId":"CL7uN4mh1HfBXFenyck8LUZof2KvsbTwLwivYmk6nQE3"},"preorderSalt":"qZdKJ+Pp+RCzhBWsmGy4gOR83PGSyff3tzbiKNBNbT8=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-kelli-12496-alias","normalizedParentDomainName":"dash"} -{"$id":"GCCMoVogQWanv81cJbhyirneUbAdBvBsq3Q5N2L79Bss","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9","$revision":1,"label":"asd2","records":{"dashUniqueIdentityId":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9"},"preorderSalt":"20A81OSpsxzPVmeGv6xrSa118cWK5EsbTaLJni0zoOk=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd2","normalizedParentDomainName":"dash"} -{"$id":"HqCR7WWDZPhmq1Tm4dM5sag9kp19ZfLY8BLdizdXWa7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2","$revision":1,"label":"RT-Deontae-75806","records":{"dashUniqueIdentityId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2"},"preorderSalt":"+cjZQ09K7o6K234fNaL/6gwca4izTmwenyZDnwATbto=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-deontae-75806","normalizedParentDomainName":"dash"} \ No newline at end of file +{"$id":"GCCMoVogQWanv81cJbhyirneUbAdBvBsq3Q5N2L79Bss","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9","$revision":1,"label":"asd2","records":{"identity":"D9GuSxitfyiF3MUPoA8VfRtbPo618dd5eXGe8koSNdX9"},"preorderSalt":"20A81OSpsxzPVmeGv6xrSa118cWK5EsbTaLJni0zoOk=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"asd2","normalizedParentDomainName":"dash"} +{"$id":"HqCR7WWDZPhmq1Tm4dM5sag9kp19ZfLY8BLdizdXWa7g","$type":"domain","$dataContractId":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","$ownerId":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2","$revision":1,"label":"RT-Deontae-75806","records":{"identity":"6DQQzyhurRmimQ6bVLKyFT3SGzeaWkDxEhhYUQwoXwA2"},"preorderSalt":"+cjZQ09K7o6K234fNaL/6gwca4izTmwenyZDnwATbto=","subdomainRules":{"allowSubdomains":false},"normalizedLabel":"rt-deontae-75806","normalizedParentDomainName":"dash"} \ No newline at end of file diff --git a/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-label-not-required.json b/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-label-not-required.json index 9208047e468..020255c4d40 100644 --- a/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-label-not-required.json +++ b/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-label-not-required.json @@ -95,7 +95,7 @@ "$comment": "Must be equal to the document owner" } }, - "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`", + "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `identity` or a `dashAliasIdentityId`", "minProperties": 1, "maxProperties": 1, "position": 4, diff --git a/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-update-v2-test.json b/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-update-v2-test.json index f852e7a63fa..ab68c409449 100644 --- a/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-update-v2-test.json +++ b/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract-update-v2-test.json @@ -103,7 +103,7 @@ "description": "A new property to test serialization/deserialization" } }, - "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`", + "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `identity` or a `dashAliasIdentityId`", "minProperties": 1, "maxProperties": 1, "position": 4, diff --git a/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract.json b/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract.json index ef11e3d8e41..852bf5b0317 100644 --- a/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract.json +++ b/packages/rs-drive/tests/supporting_files/contract/dpns/dpns-contract.json @@ -95,7 +95,7 @@ "$comment": "Must be equal to the document owner" } }, - "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`", + "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `identity` or a `dashAliasIdentityId`", "minProperties": 1, "maxProperties": 1, "position": 4, diff --git a/packages/rs-json-schema-compatibility-validator/Cargo.toml b/packages/rs-json-schema-compatibility-validator/Cargo.toml new file mode 100644 index 00000000000..a4764f481e6 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "json-schema-compatibility-validator" +version = "1.1.0-dev.1" +edition = "2021" +rust-version = "1.76" +authors = [ + "Ivan Shumkov ", +] + +[dependencies] +json-patch = "1.2.0" +serde_json = "1.0.115" +thiserror = "1.0.58" +once_cell = "1.19.0" + +[dev-dependencies] +# enable "examples" for integration tests +json-schema-compatibility-validator = { path = ".", features = ["examples"] } +assert_matches = "1.5.0" + +[features] +examples = [] diff --git a/packages/rs-json-schema-compatibility-validator/src/change.rs b/packages/rs-json-schema-compatibility-validator/src/change.rs new file mode 100644 index 00000000000..8c70063a7c7 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/change.rs @@ -0,0 +1,70 @@ +use crate::error::{Error, UnexpectedPatchOperationError}; +use json_patch::{AddOperation, PatchOperation, RemoveOperation, ReplaceOperation}; + +/// This structure represents a change in a JSON schema +/// It contains corresponding [PatchOperation] +#[derive(Debug, PartialEq, Clone)] +pub enum JsonSchemaChange { + /// Addition of JSON Schema element + Add(AddOperation), + /// Removal of JSON Schema element + Remove(RemoveOperation), + /// Replacement of JSON Schema element + Replace(ReplaceOperation), +} + +impl JsonSchemaChange { + /// Returns the name of the operation + pub fn name(&self) -> &str { + match self { + JsonSchemaChange::Add(_) => "add", + JsonSchemaChange::Remove(_) => "remove", + JsonSchemaChange::Replace(_) => "replace", + } + } + + /// Returns the json path where the operation is applied + pub fn path(&self) -> &str { + match self { + JsonSchemaChange::Add(op) => &op.path, + JsonSchemaChange::Remove(op) => &op.path, + JsonSchemaChange::Replace(op) => &op.path, + } + } +} + +/// Converts a [PatchOperation] into a [JsonSchemaChange] +/// Since [PatchOperation] goes from the [json_patch::diff] function, +/// we don't expect [PatchOperation::Move], [PatchOperation::Copy] and [PatchOperation::Test] operations. +impl TryFrom for JsonSchemaChange { + type Error = Error; + + fn try_from(value: PatchOperation) -> Result { + match value { + PatchOperation::Add(o) => Ok(Self::Add(o)), + PatchOperation::Remove(o) => Ok(Self::Remove(o)), + PatchOperation::Replace(o) => Ok(Self::Replace(o)), + PatchOperation::Move(_) | PatchOperation::Copy(_) | PatchOperation::Test(_) => Err( + Error::UnexpectedJsonPatchOperation(UnexpectedPatchOperationError(value)), + ), + } + } +} + +/// The trait that provides a method to get the path of the [PatchOperation] +pub(crate) trait PatchOperationPath { + fn path(&self) -> &str; +} + +impl PatchOperationPath for PatchOperation { + fn path(&self) -> &str { + match self { + PatchOperation::Add(op) => &op.path, + PatchOperation::Remove(op) => &op.path, + PatchOperation::Replace(op) => &op.path, + PatchOperation::Move(op) => &op.path, + PatchOperation::Copy(op) => &op.path, + PatchOperation::Test(op) => &op.path, + } + } +} diff --git a/packages/rs-json-schema-compatibility-validator/src/error.rs b/packages/rs-json-schema-compatibility-validator/src/error.rs new file mode 100644 index 00000000000..e5c2f911699 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/error.rs @@ -0,0 +1,106 @@ +use crate::CompatibilityRules; +use json_patch::PatchOperation; +use serde_json::Value; + +/// Compatibility validation errors. +#[derive(thiserror::Error, Debug, Clone)] +pub enum Error { + /// An unexpected patch operation was encountered. + #[error(transparent)] + UnexpectedJsonPatchOperation(UnexpectedPatchOperationError), + /// The JSON Pointer path doesn't exist in the JSON value. + #[error(transparent)] + JsonPointerPathNotFound(JsonPointerPathNotFoundError), + /// There is no compatibility rules are defined for the encountered schema keyword + #[error(transparent)] + UnsupportedSchemaKeyword(UnsupportedSchemaKeywordError), + /// The JSON patch operation path is too small and doesn't contain keywords. + #[error(transparent)] + InvalidJsonPatchOperationPath(InvalidJsonPatchOperationPathError), + /// The [IsReplacementAllowedCallback] is not defined for the encountered keyword and [ReplaceOperation]. + #[error(transparent)] + UndefinedReplaceCallback(UndefinedReplacementAllowedCallbackError), + /// The JSON value type is not as expected. + #[error(transparent)] + UnexpectedJsonValueType(UnexpectedJsonValueTypeError), +} + +/// An unexpected patch operation was encountered. +#[derive(thiserror::Error, Debug, Clone)] +#[error("unexpected patch operation: {0}")] +pub struct UnexpectedPatchOperationError(pub PatchOperation); + +impl From for Error { + fn from(e: UnexpectedPatchOperationError) -> Self { + Error::UnexpectedJsonPatchOperation(e) + } +} + +/// The JSON Pointer path doesn't exist in the JSON value. +#[derive(thiserror::Error, Debug, Clone)] +#[error("JSON Pointer path '{path}' doesn't exist in JSON value")] +pub struct JsonPointerPathNotFoundError { + pub path: String, + pub value: Value, +} + +impl From for Error { + fn from(e: JsonPointerPathNotFoundError) -> Self { + Error::JsonPointerPathNotFound(e) + } +} + +/// There is no compatibility rules are defined for the encountered schema keyword +#[derive(thiserror::Error, Debug, Clone)] +#[error("schema keyword '{keyword}' at path '{path}' is not supported")] +pub struct UnsupportedSchemaKeywordError { + pub keyword: String, + pub path: String, +} + +impl From for Error { + fn from(e: UnsupportedSchemaKeywordError) -> Self { + Error::UnsupportedSchemaKeyword(e) + } +} + +/// The JSON patch operation path is too small and doesn't contain keywords. +#[derive(thiserror::Error, Debug, Clone)] +#[error("json patch operation path '{path}' is too small and doesn't contain keywords")] +pub struct InvalidJsonPatchOperationPathError { + pub path: String, +} + +impl From for Error { + fn from(e: InvalidJsonPatchOperationPathError) -> Self { + Error::InvalidJsonPatchOperationPath(e) + } +} + +/// The [IsReplacementAllowedCallback] is not defined for the encountered keyword and [ReplaceOperation]. +#[derive(thiserror::Error, Debug, Clone)] +#[error("undefined allow replacement callback for path '{path}'")] +pub struct UndefinedReplacementAllowedCallbackError { + pub path: String, + pub rules: CompatibilityRules, +} + +impl From for Error { + fn from(e: UndefinedReplacementAllowedCallbackError) -> Self { + Error::UndefinedReplaceCallback(e) + } +} + +/// The JSON value type is not as expected. +#[derive(thiserror::Error, Debug, Clone)] +#[error("expected JSON value type '{expected_type}', but got '{value}'")] +pub struct UnexpectedJsonValueTypeError { + pub expected_type: String, + pub value: Value, +} + +impl From for Error { + fn from(e: UnexpectedJsonValueTypeError) -> Self { + Error::UnexpectedJsonValueType(e) + } +} diff --git a/packages/rs-json-schema-compatibility-validator/src/lib.rs b/packages/rs-json-schema-compatibility-validator/src/lib.rs new file mode 100644 index 00000000000..16040d1cc7e --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/lib.rs @@ -0,0 +1,10 @@ +mod change; +pub mod error; +mod rules; +mod validate; + +pub use crate::change::*; +pub use crate::rules::*; +pub use json_patch::{AddOperation, RemoveOperation, ReplaceOperation}; +pub use validate::{validate_schemas_compatibility, CompatibilityValidationResult, Options}; +pub use KEYWORD_COMPATIBILITY_RULES; diff --git a/packages/rs-json-schema-compatibility-validator/src/rules/compatibility_rules.rs b/packages/rs-json-schema-compatibility-validator/src/rules/compatibility_rules.rs new file mode 100644 index 00000000000..c5d627dc565 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/rules/compatibility_rules.rs @@ -0,0 +1,120 @@ +#[cfg(any(test, feature = "examples"))] +use crate::change::JsonSchemaChange; +use crate::error::Error; +use json_patch::ReplaceOperation; +use serde_json::Value; +use std::fmt; +use std::fmt::{Debug, Formatter}; +use std::sync::Arc; + +/// Type alias for an optional callback function that is called when [ReplaceOperation] is applied to a schema. +/// It takes the original schema as a reference to a [Value] and a [ReplaceOperation], +/// and returns a `Result`. `True` means that the operation is compatible, +/// `False` means that the operation is incompatible. +// This function is wrapped in an `Arc` for lazy evaluation. +pub type IsReplacementAllowedCallback = + Option Result + Send + Sync>>; + +/// Struct representing a compatibility rules in a JSON schema, such as allowing +/// adding, removing, and replacing of the schema elements. It also optionally contains inner structure rule, +/// and a list of examples. +#[derive(Clone)] +pub struct CompatibilityRules { + /// Boolean indicating whether adding is allowed. + pub allow_addition: bool, + /// Boolean indicating whether removing is allowed. + pub allow_removal: bool, + /// Compatibility for replacing is often based on the previous state and new value, + /// so [IsReplacementAllowedCallback] is used to define this dynamic logic. + /// The callback is optional because replacing is impossible for some schema elements + /// due to inner structure. + pub allow_replacement_callback: IsReplacementAllowedCallback, + /// Optional number of levels to an inner subschema in case if the element + /// contains a subschema inside. + /// When the next subschema is reached, the new next compatibility rules will be applied + /// based the rule finding algorithm. + pub subschema_levels_depth: Option, + /// Compatibility rules for inner structure (until the next subschema defined in `levels_to_subschema`). + pub inner: Option>, + /// Examples (vector of [CompatibilityRuleExample]) of the compatibility rules. + /// Only available when testing or when the `examples` feature is enabled. + #[cfg(any(test, feature = "examples"))] + pub examples: Vec, +} + +impl Debug for CompatibilityRules { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + let mut debug = f.debug_struct("CompatibilityRules"); + + let replace_callback = if self.allow_replacement_callback.is_some() { + Some("ReplaceCallback") + } else { + None + }; + + debug + .field("allow_adding", &self.allow_addition) + .field("allow_removing", &self.allow_removal) + .field("allow_replacing", &replace_callback) + .field("subschema_levels_depth", &self.subschema_levels_depth) + .field("inner", &self.inner); + + #[cfg(any(test, feature = "examples"))] + let debug = debug.field("examples", &self.examples); + + debug.finish() + } +} + +impl PartialEq for CompatibilityRules { + fn eq(&self, other: &Self) -> bool { + #[allow(unused_mut, unused_assignments)] + let mut examples = true; + + #[cfg(any(test, feature = "examples"))] + { + examples = self.examples == other.examples; + } + + self.allow_addition == other.allow_addition + && self.allow_removal == other.allow_removal + && self.allow_replacement_callback.is_some() + == other.allow_replacement_callback.is_some() + && self.inner == other.inner + && self.subschema_levels_depth == other.subschema_levels_depth + && examples + } +} + +/// Struct representing an example of a compatibility rule. +/// Only available when testing or when the "examples" feature is enabled. +#[cfg(any(test, feature = "examples"))] +#[derive(Debug, PartialEq, Clone)] +pub struct CompatibilityRuleExample { + /// The original JSON schema. + pub original_schema: Value, + /// The new JSON schema. + pub new_schema: Value, + /// Incompatible [JsonSchemaChange] in the JSON schema if it has a place. + /// `None` if the change is compatible. + pub incompatible_change: Option, +} + +/// Implementation of the [From] trait for [CompatibilityRuleExample]. Allows for creating a [CompatibilityRuleExample] +/// from a tuple of values, and an optional [JsonSchemaChange] in case if we expect an incompatible change. +#[cfg(any(test, feature = "examples"))] +impl From<(Value, Value, Option)> for CompatibilityRuleExample { + fn from( + (original_schema, new_schema, incompatible_change): ( + Value, + Value, + Option, + ), + ) -> Self { + Self { + original_schema, + new_schema, + incompatible_change, + } + } +} diff --git a/packages/rs-json-schema-compatibility-validator/src/rules/mod.rs b/packages/rs-json-schema-compatibility-validator/src/rules/mod.rs new file mode 100644 index 00000000000..84bfa0bdaf1 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/rules/mod.rs @@ -0,0 +1,9 @@ +mod compatibility_rules; +mod rule_set; +mod value; + +#[cfg(any(test, feature = "examples"))] +pub use compatibility_rules::CompatibilityRuleExample; +pub use compatibility_rules::{CompatibilityRules, IsReplacementAllowedCallback}; +pub use rule_set::CompatibilityRulesCollection; +pub use rule_set::KEYWORD_COMPATIBILITY_RULES; diff --git a/packages/rs-json-schema-compatibility-validator/src/rules/rule_set.rs b/packages/rs-json-schema-compatibility-validator/src/rules/rule_set.rs new file mode 100644 index 00000000000..2962395889a --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/rules/rule_set.rs @@ -0,0 +1,1730 @@ +use super::compatibility_rules::CompatibilityRules; +use super::value::ValueTryMethods; +use super::IsReplacementAllowedCallback; +#[cfg(any(test, feature = "examples"))] +use crate::change::JsonSchemaChange; +use crate::error::{Error, InvalidJsonPatchOperationPathError, UnexpectedJsonValueTypeError}; +#[cfg(any(test, feature = "examples"))] +use json_patch::{AddOperation, RemoveOperation, ReplaceOperation}; +use once_cell::sync::Lazy; +#[cfg(any(test, feature = "examples"))] +use serde_json::json; +use std::collections::HashMap; +use std::path::PathBuf; +use std::sync::Arc; + +/// Replacement is never allowed +static FALSE_CALLBACK: Lazy = + Lazy::new(|| Some(Arc::new(|_, _| Ok(false)))); + +/// Replacement is always allowed +static TRUE_CALLBACK: Lazy = + Lazy::new(|| Some(Arc::new(|_, _| Ok(true)))); + +/// Replacement is allowed if a new u64 value is bigger than original +static U64_BIGGER_CALLBACK: Lazy = Lazy::new(|| { + Some(Arc::new(|schema, op| { + let original_value = schema.try_pointer(&op.path)?.try_to_u64()?; + let new_value = op.value.try_to_u64()?; + + Ok(original_value < new_value) + })) +}); + +/// Replacement is allowed if a new u64 value is smaller than original +static U64_SMALLER_CALLBACK: Lazy = Lazy::new(|| { + Some(Arc::new(|schema, op| { + let original_value = schema.try_pointer(&op.path)?.try_to_u64()?; + let new_value = op.value.try_to_u64()?; + + Ok(original_value > new_value) + })) +}); + +/// Replacement is allowed if a new f64 value is bigger than original +static F64_BIGGER_CALLBACK: Lazy = Lazy::new(|| { + Some(Arc::new(|schema, op| { + let original_value = schema.try_pointer(&op.path)?.try_to_f64()?; + let new_value = op.value.try_to_f64()?; + + Ok(original_value < new_value) + })) +}); + +/// Replacement is allowed if a new f64 value is smaller than original +static F64_SMALLER_CALLBACK: Lazy = Lazy::new(|| { + Some(Arc::new(|schema, op| { + let original_value = schema.try_pointer(&op.path)?.try_to_f64()?; + let new_value = op.value.try_to_f64()?; + + Ok(original_value > new_value) + })) +}); + +/// Replacement is allowed if a new value is an existing element in the original array +static EXISTING_ELEMENT_CALLBACK: Lazy = Lazy::new(|| { + Some(Arc::new(|schema, op| { + // One segment back to required array + let path = PathBuf::from(&op.path); + let required_path = path.parent().and_then(|p| p.to_str()).ok_or_else(|| { + InvalidJsonPatchOperationPathError { + path: op.path.clone(), + } + })?; + + let original_required_value = schema.try_pointer(required_path)?; + + let original_required_array_of_values = + original_required_value.as_array().ok_or_else(|| { + Error::UnexpectedJsonValueType(UnexpectedJsonValueTypeError { + expected_type: "array".to_string(), + value: original_required_value.clone(), + }) + })?; + + Ok(original_required_array_of_values.contains(&op.value)) + })) +}); + +pub type CompatibilityRulesCollection = HashMap<&'static str, CompatibilityRules>; + +/// The rules define, which change in JSON Schema for a keyword and its inner structure is compatible or not. +/// Important note: Not all keywords are supported, and some rules are +/// implemented based on Data Contract schema validation requirements +pub static KEYWORD_COMPATIBILITY_RULES: Lazy = Lazy::new(|| { + HashMap::from_iter([ + ( + "$id", + CompatibilityRules { + allow_addition: true, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + (json!({}), json!({ "$id": "foo" }), None).into(), + ( + json!({ "$id": "foo" }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/$id".to_string(), + })), + ) + .into(), + ( + json!({ "$id": "foo" }), + json!({ "$id": "bar" }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/$id".to_string(), + value: json!("bar"), + })), + ) + .into(), + ], + }, + ), + ( + "$ref", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "$ref": "/foo" }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/$ref".to_string(), + value: json!("/foo"), + })), + ) + .into(), + ( + json!({ "$ref": "/foo" }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/$ref".to_string(), + })), + ) + .into(), + ( + json!({ "$ref": "/foo" }), + json!({ "$ref": "/bar" }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/$ref".to_string(), + value: json!("/bar"), + })), + ) + .into(), + ], + }, + ), + ( + "$comment", + CompatibilityRules { + allow_addition: true, + allow_removal: true, + allow_replacement_callback: TRUE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + (json!({}), json!({ "$comment": "foo" }), None).into(), + (json!({ "$comment": "foo" }), json!({}), None).into(), + ( + json!({ "$comment": "foo" }), + json!({ "$comment": "bar" }), + None, + ) + .into(), + ], + }, + ), + ( + "description", + CompatibilityRules { + allow_addition: true, + allow_removal: true, + allow_replacement_callback: TRUE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + (json!({}), json!({ "description": "foo" }), None).into(), + (json!({ "description": "foo" }), json!({}), None).into(), + ( + json!({ "description": "foo" }), + json!({ "description": "bar" }), + None, + ) + .into(), + ], + }, + ), + ( + "examples", + CompatibilityRules { + allow_addition: true, + allow_removal: true, + allow_replacement_callback: TRUE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + (json!({}), json!({ "examples": ["foo"] }), None).into(), + (json!({ "examples": ["foo"] }), json!({}), None).into(), + ( + json!({ "examples": ["foo"] }), + json!({ "examples": ["foo","bar"] }), + None, + ) + .into(), + ( + json!({ "examples": ["foo","bar"] }), + json!({ "examples": ["foo"] }), + None, + ) + .into(), + ( + json!({ "examples": ["foo"] }), + json!({ "examples": ["bar"] }), + None, + ) + .into(), + ], + }, + ), + ( + "multipleOf", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "multipleOf": 1.0 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/multipleOf".to_string(), + value: json!(1.0), + })), + ) + .into(), + ( + json!({ "multipleOf": 1.0 }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/multipleOf".to_string(), + })), + ) + .into(), + ( + json!({ "multipleOf": 1.0 }), + json!({ "multipleOf": 2.0 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/multipleOf".to_string(), + value: json!(2.0), + })), + ) + .into(), + ], + }, + ), + ( + "maximum", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: F64_BIGGER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "maximum": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/maximum".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "maximum": 1 }), json!({}), None).into(), + (json!({ "maximum": 1 }), json!({ "maximum": 2 }), None).into(), + ( + json!({ "maximum": 2 }), + json!({ "maximum": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/maximum".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "exclusiveMaximum", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: F64_BIGGER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "exclusiveMaximum": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/exclusiveMaximum".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "exclusiveMaximum": 1 }), json!({}), None).into(), + ( + json!({ "exclusiveMaximum": 1 }), + json!({ "exclusiveMaximum": 2 }), + None, + ) + .into(), + ( + json!({ "exclusiveMaximum": 2 }), + json!({ "exclusiveMaximum": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/exclusiveMaximum".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "minimum", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: F64_SMALLER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "minimum": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/minimum".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "minimum": 1 }), json!({}), None).into(), + ( + json!({ "minimum": 1 }), + json!({ "minimum": 2 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/minimum".to_string(), + value: json!(2), + })), + ) + .into(), + (json!({ "minimum": 2 }), json!({ "minimum": 1 }), None).into(), + ], + }, + ), + ( + "exclusiveMinimum", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: F64_SMALLER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "exclusiveMinimum": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/exclusiveMinimum".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "exclusiveMinimum": 1 }), json!({}), None).into(), + ( + json!({ "exclusiveMinimum": 1 }), + json!({ "exclusiveMinimum": 2 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/exclusiveMinimum".to_string(), + value: json!(2), + })), + ) + .into(), + ( + json!({ "exclusiveMinimum": 2 }), + json!({ "exclusiveMinimum": 1 }), + None, + ) + .into(), + ], + }, + ), + ( + "maxLength", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: U64_BIGGER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "maxLength": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/maxLength".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "maxLength": 1 }), json!({}), None).into(), + (json!({ "maxLength": 1 }), json!({ "maxLength": 2 }), None).into(), + ( + json!({ "maxLength": 2 }), + json!({ "maxLength": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/maxLength".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "minLength", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: U64_SMALLER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "minLength": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/minLength".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "minLength": 1 }), json!({}), None).into(), + ( + json!({ "minLength": 1 }), + json!({ "minLength": 2 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/minLength".to_string(), + value: json!(2), + })), + ) + .into(), + (json!({ "minLength": 2 }), json!({ "minLength": 1 }), None).into(), + ], + }, + ), + ( + "pattern", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "pattern": "[a-z]" }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/pattern".to_string(), + value: json!("[a-z]"), + })), + ) + .into(), + (json!({ "pattern": "[a-z]" }), json!({}), None).into(), + ( + json!({ "pattern": "[a-z]" }), + json!({ "pattern": "[0-9]" }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/pattern".to_string(), + value: json!("[0-9]"), + })), + ) + .into(), + ], + }, + ), + ( + "maxItems", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: U64_BIGGER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "maxItems": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/maxItems".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "maxItems": 1 }), json!({}), None).into(), + (json!({ "maxItems": 1 }), json!({ "maxItems": 2 }), None).into(), + ( + json!({ "maxItems": 2 }), + json!({ "maxItems": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/maxItems".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "minItems", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: U64_SMALLER_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "minItems": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/minItems".to_string(), + value: json!(1), + })), + ) + .into(), + (json!({ "minItems": 1 }), json!({}), None).into(), + ( + json!({ "minItems": 1 }), + json!({ "minItems": 2 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/minItems".to_string(), + value: json!(2), + })), + ) + .into(), + (json!({ "minItems": 2 }), json!({ "minItems": 1 }), None).into(), + ], + }, + ), + ( + "uniqueItems", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: Some(Arc::new(|schema, op| { + let original_value = schema.try_pointer(&op.path)?.try_to_bool()?; + let new_value = op.value.try_to_bool()?; + + Ok(original_value && !new_value) + })), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "uniqueItems": true }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/uniqueItems".to_string(), + value: json!(true), + })), + ) + .into(), + (json!({ "uniqueItems": true }), json!({}), None).into(), + (json!({ "uniqueItems": false }), json!({}), None).into(), + ( + json!({ "uniqueItems": false }), + json!({ "uniqueItems": true }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/uniqueItems".to_string(), + value: json!(true), + })), + ) + .into(), + ( + json!({ "uniqueItems": true }), + json!({ "uniqueItems": false }), + None, + ) + .into(), + ], + }, + ), + ( + "required", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: None, + subschema_levels_depth: None, + inner: Some(Box::new(CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: EXISTING_ELEMENT_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "required": ["foo"] }), + json!({ "required": ["foo", "bar"] }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/required/1".to_string(), + value: json!("bar"), + })), + ) + .into(), + ( + json!({ "required": ["foo", "bar"] }), + json!({ "required": ["foo"] }), + None, + ) + .into(), + ( + json!({ "required": ["foo", "bar"] }), + json!({ "required": ["bar"] }), + None, + ) + .into(), + ( + json!({ "required": ["foo"] }), + json!({ "required": ["bar"] }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/required/0".to_string(), + value: json!("bar"), + })), + ) + .into(), + ( + json!({ "required": ["foo", "bar"] }), + json!({ "required": ["bar", "foo"] }), + None, + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "required": ["foo"] }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/required".to_string(), + value: json!(["foo"]), + })), + ) + .into(), + (json!({ "required": ["foo"] }), json!({}), None).into(), + ], + }, + ), + ( + "properties", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: None, + subschema_levels_depth: Some(2), + inner: Some(Box::new(CompatibilityRules { + allow_addition: true, + allow_removal: false, + allow_replacement_callback: None, + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "properties": {"foo": {}} }), + json!({ "properties": {"foo": {}, "bar": {}} }), + None, + ) + .into(), + ( + json!({ "properties": {"foo": {}, "bar": {}} }), + json!({ "properties": {"foo": {}} }), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/properties/bar".to_string(), + })), + ) + .into(), + ( + json!({ "properties": {"foo": {}} }), + json!({ "properties": {"foo": {}, "type": {}} }), + None, + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "properties": {"foo": {}} }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/properties".to_string(), + value: json!({"foo": {}} ), + })), + ) + .into(), + ( + json!({ "properties": {"foo": {}} }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/properties".to_string(), + })), + ) + .into(), + ], + }, + ), + ( + "additionalProperties", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "additionalProperties": false }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/additionalProperties".to_string(), + value: json!(false), + })), + ) + .into(), + ( + json!({ "additionalProperties": false }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/additionalProperties".to_string(), + })), + ) + .into(), + ( + json!({ "additionalProperties": false }), + json!({ "additionalProperties": true }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/additionalProperties".to_string(), + value: json!(true), + })), + ) + .into(), + ], + }, + ), + ( + "dependentRequired", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: None, + subschema_levels_depth: None, + inner: Some(Box::new(CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: EXISTING_ELEMENT_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "dependentRequired": {"foo": []} }), + json!({ "dependentRequired": {"foo": [], "bar": []} }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/dependentRequired/bar".to_string(), + value: json!([]), + })), + ) + .into(), + ( + json!({ "dependentRequired": {"foo": [], "bar": []} }), + json!({ "dependentRequired": {"foo": []} }), + None, + ) + .into(), + ( + json!({ "dependentRequired": {"foo": ["bar"]} }), + json!({ "dependentRequired": {"foo": ["bar", "baz"]} }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/dependentRequired/foo/1".to_string(), + value: json!("baz"), + })), + ) + .into(), + ( + json!({ "dependentRequired": {"foo": ["bar", "baz"]} }), + json!({ "dependentRequired": {"foo": ["bar"]} }), + None, + ) + .into(), + ( + json!({ "dependentRequired": {"foo": ["bar", "baz"]} }), + json!({ "dependentRequired": {"foo": ["baz"]} }), + None, + ) + .into(), + ( + json!({ "dependentRequired": {"foo": ["bar"]} }), + json!({ "dependentRequired": {"foo": ["baz"]} }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/dependentRequired/foo/0".to_string(), + value: json!("baz"), + })), + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "dependentRequired": {"foo": ["bar"]} }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/dependentRequired".to_string(), + value: json!({"foo": ["bar"]}), + })), + ) + .into(), + ( + json!({ "dependentRequired": {"foo": ["bar"]} }), + json!({}), + None, + ) + .into(), + ], + }, + ), + ( + "const", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: Some(Box::new(CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "const": { "property": { "inner": true } }}), + json!({ "const": { "property": { "inner": true, "second": true } }}), + Some(JsonSchemaChange::Add(AddOperation { + path: "/const/property/second".to_string(), + value: json!(true), + })), + ) + .into(), + (json!({ "const": "foo" }), json!({}), None).into(), + ( + json!({ "const": { "property": { "inner": true, "second": true } }}), + json!({ "const": { "property": { "inner": true } }}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/const/property/second".to_string(), + })), + ) + .into(), + ( + json!({ "const": [ "item1" ]}), + json!({ "const": [ "item1", "item2" ]}), + Some(JsonSchemaChange::Add(AddOperation { + path: "/const/1".to_string(), + value: json!("item2"), + })), + ) + .into(), + ( + json!({ "const": [ "item1", "item2" ]}), + json!({ "const": [ "item1" ]}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/const/1".to_string(), + })), + ) + .into(), + ( + json!({ "const": [ "item1" ]}), + json!({ "const": [ "item2" ]}), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/const/0".to_string(), + value: json!("item2"), + })), + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "const": "foo" }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/const".to_string(), + value: json!("foo"), + })), + ) + .into(), + (json!({ "const": "foo" }), json!({}), None).into(), + ( + json!({ "const": "foo" }), + json!({ "const": "bar" }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/const".to_string(), + value: json!("bar"), + })), + ) + .into(), + ], + }, + ), + ( + "enum", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: None, + subschema_levels_depth: None, + inner: Some(Box::new(CompatibilityRules { + allow_addition: true, + allow_removal: false, + allow_replacement_callback: EXISTING_ELEMENT_CALLBACK.clone(), + subschema_levels_depth: None, + inner: Some(Box::new(CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "enum": [{ "property": ["foo"]}] }), + json!({ "enum": [{ "property": ["foo", "bar"]}] }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/enum/0/property/1".to_string(), + value: json!("bar"), + })), + ) + .into(), + ( + json!({ "enum": [{ "property": ["foo", "bar"]}] }), + json!({ "enum": [{ "property": ["foo"]}] }), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/enum/0/property/bar".to_string(), + })), + ) + .into(), + ( + json!({ "enum": [{ "property": ["foo"]}] }), + json!({ "enum": [{ "property": ["bar"]}] }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/enum/0/property/0".to_string(), + value: json!("bar"), + })), + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "enum": ["foo"] }), + json!({ "enum": ["foo", "bar"] }), + None, + ) + .into(), + ( + json!({ "enum": ["foo", "bar"] }), + json!({ "enum": ["foo"] }), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/enum/1".to_string(), + })), + ) + .into(), + ( + json!({ "enum": ["foo"] }), + json!({ "enum": ["bar"] }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/enum/0".to_string(), + value: json!("bar"), + })), + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "enum": ["foo"] }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/enum".to_string(), + value: json!(["foo"]), + })), + ) + .into(), + (json!({ "enum": ["foo"] }), json!({}), None).into(), + ], + }, + ), + ( + "type", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "type": "string" }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/type".to_string(), + value: json!("string"), + })), + ) + .into(), + ( + json!({ "type": "string" }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/type".to_string(), + })), + ) + .into(), + ( + json!({ "type": "string" }), + json!({ "type": "object" }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/type".to_string(), + value: json!("object"), + })), + ) + .into(), + ], + }, + ), + ( + "format", + CompatibilityRules { + allow_addition: false, + allow_removal: true, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "format": "date" }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/format".to_string(), + value: json!("date"), + })), + ) + .into(), + (json!({ "format": "date" }), json!({}), None).into(), + ( + json!({ "format": "date" }), + json!({ "format": "time" }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/format".to_string(), + value: json!("time"), + })), + ) + .into(), + ], + }, + ), + ( + "contentMediaType", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "contentMediaType": "application/x.dash.dpp.identifier" }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/contentMediaType".to_string(), + value: json!("application/x.dash.dpp.identifier"), + })), + ) + .into(), + ( + json!({ "contentMediaType": "application/x.dash.dpp.identifier" }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/contentMediaType".to_string(), + })), + ) + .into(), + ( + json!({ "contentMediaType": "application/x.dash.dpp.identifier" }), + json!({ "contentMediaType": "application/unknown" }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/contentMediaType".to_string(), + value: json!("application/unknown"), + })), + ) + .into(), + ], + }, + ), + ( + "byteArray", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "byteArray": true }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/byteArray".to_string(), + value: json!(true), + })), + ) + .into(), + ( + json!({ "byteArray": true }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/byteArray".to_string(), + })), + ) + .into(), + ( + json!({ "byteArray": true }), + json!({ "byteArray": false }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/byteArray".to_string(), + value: json!(false), + })), + ) + .into(), + ], + }, + ), + ( + "prefixItems", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: None, + subschema_levels_depth: Some(2), + inner: Some(Box::new(CompatibilityRules { + allow_addition: true, + allow_removal: false, + allow_replacement_callback: None, + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "prefixItems": [{ "type": "string" }] }), + json!({ "prefixItems": [{ "type": "string" }, { "type": "number"}] }), + None, + ) + .into(), + ( + json!({ "prefixItems": [{ "type": "string" }, { "type": "number"}] }), + json!({ "prefixItems": [{ "type": "string" }] }), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/prefixItems/1".to_string(), + })), + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "prefixItems": [{ "type": "string" }] }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/prefixItems".to_string(), + value: json!([{ "type": "string" }]), + })), + ) + .into(), + ( + json!({ "prefixItems": [{ "type": "string" }] }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/prefixItems".to_string(), + })), + ) + .into(), + ], + }, + ), + ( + "items", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: Some(1), + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "items": { "type": "string" } }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/items".to_string(), + value: json!({ "type": "string" }), + })), + ) + .into(), + ( + json!({ "items": { "type": "string" } }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/items".to_string(), + })), + ) + .into(), + ( + json!({ "items": { "type": "string" } }), + json!({ "items": false }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/items".to_string(), + value: json!(false), + })), + ) + .into(), + ], + }, + ), + ( + "position", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "position": 0 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/position".to_string(), + value: json!(0), + })), + ) + .into(), + ( + json!({ "position": 0 }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/position".to_string(), + })), + ) + .into(), + ( + json!({ "position": 0 }), + json!({ "position": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/position".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "$defs", + CompatibilityRules { + allow_addition: true, + allow_removal: false, + allow_replacement_callback: None, + subschema_levels_depth: Some(2), + inner: Some(Box::new(CompatibilityRules { + allow_addition: true, + allow_removal: false, + allow_replacement_callback: None, + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({ "$defs": {"definition1": {}} }), + json!({ "$defs": {"definition1": {}, "definition2": {}} }), + None, + ) + .into(), + ( + json!({ "$defs": {"definition1": {}, "definition2": {}} }), + json!({ "$defs": {"definition1": {}} }), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/$defs/definition2".to_string(), + })), + ) + .into(), + ], + })), + #[cfg(any(test, feature = "examples"))] + examples: vec![ + (json!({}), json!({ "$defs": {"definition": {}} }), None).into(), + ( + json!({ "$defs": {"definition": {}} }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/$defs".to_string(), + })), + ) + .into(), + ], + }, + ), + ( + "documentsMutable", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "documentsMutable": false }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/documentsMutable".to_string(), + value: json!(false), + })), + ) + .into(), + ( + json!({ "documentsMutable": false }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/documentsMutable".to_string(), + })), + ) + .into(), + ( + json!({ "documentsMutable": false }), + json!({ "documentsMutable": true }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/documentsMutable".to_string(), + value: json!(true), + })), + ) + .into(), + ], + }, + ), + ( + "documentsKeepHistory", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "documentsKeepHistory": false }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/documentsKeepHistory".to_string(), + value: json!(false), + })), + ) + .into(), + ( + json!({ "documentsKeepHistory": false }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/documentsKeepHistory".to_string(), + })), + ) + .into(), + ( + json!({ "documentsKeepHistory": false }), + json!({ "documentsKeepHistory": true }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/documentsKeepHistory".to_string(), + value: json!(true), + })), + ) + .into(), + ], + }, + ), + ( + "canBeDeleted", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "canBeDeleted": false }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/canBeDeleted".to_string(), + value: json!(false), + })), + ) + .into(), + ( + json!({ "canBeDeleted": false }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/canBeDeleted".to_string(), + })), + ) + .into(), + ( + json!({ "canBeDeleted": false }), + json!({ "canBeDeleted": true }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/canBeDeleted".to_string(), + value: json!(true), + })), + ) + .into(), + ], + }, + ), + ( + "transferable", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "transferable": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/transferable".to_string(), + value: json!(1), + })), + ) + .into(), + ( + json!({ "transferable": 1 }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/transferable".to_string(), + })), + ) + .into(), + ( + json!({ "transferable": 0 }), + json!({ "transferable": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/transferable".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "tradeMode", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "tradeMode": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/tradeMode".to_string(), + value: json!(1), + })), + ) + .into(), + ( + json!({ "tradeMode": 1 }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/tradeMode".to_string(), + })), + ) + .into(), + ( + json!({ "tradeMode": 0 }), + json!({ "tradeMode": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/tradeMode".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "creationRestrictionMode", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "creationRestrictionMode": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/creationRestrictionMode".to_string(), + value: json!(1), + })), + ) + .into(), + ( + json!({ "creationRestrictionMode": 1 }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/creationRestrictionMode".to_string(), + })), + ) + .into(), + ( + json!({ "creationRestrictionMode": 0 }), + json!({ "creationRestrictionMode": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/creationRestrictionMode".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "requiresIdentityEncryptionBoundedKey", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "requiresIdentityEncryptionBoundedKey": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/requiresIdentityEncryptionBoundedKey".to_string(), + value: json!(1), + })), + ) + .into(), + ( + json!({ "requiresIdentityEncryptionBoundedKey": 1 }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/requiresIdentityEncryptionBoundedKey".to_string(), + })), + ) + .into(), + ( + json!({ "requiresIdentityEncryptionBoundedKey": 0 }), + json!({ "requiresIdentityEncryptionBoundedKey": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/requiresIdentityEncryptionBoundedKey".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "requiresIdentityDecryptionBoundedKey", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "requiresIdentityDecryptionBoundedKey": 1 }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/requiresIdentityDecryptionBoundedKey".to_string(), + value: json!(1), + })), + ) + .into(), + ( + json!({ "requiresIdentityDecryptionBoundedKey": 1 }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/requiresIdentityDecryptionBoundedKey".to_string(), + })), + ) + .into(), + ( + json!({ "requiresIdentityDecryptionBoundedKey": 0 }), + json!({ "requiresIdentityDecryptionBoundedKey": 1 }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/requiresIdentityDecryptionBoundedKey".to_string(), + value: json!(1), + })), + ) + .into(), + ], + }, + ), + ( + "signatureSecurityLevelRequirement", + CompatibilityRules { + allow_addition: false, + allow_removal: false, + allow_replacement_callback: FALSE_CALLBACK.clone(), + subschema_levels_depth: None, + inner: None, + #[cfg(any(test, feature = "examples"))] + examples: vec![ + ( + json!({}), + json!({ "signatureSecurityLevelRequirement": false }), + Some(JsonSchemaChange::Add(AddOperation { + path: "/signatureSecurityLevelRequirement".to_string(), + value: json!(false), + })), + ) + .into(), + ( + json!({ "signatureSecurityLevelRequirement": false }), + json!({}), + Some(JsonSchemaChange::Remove(RemoveOperation { + path: "/signatureSecurityLevelRequirement".to_string(), + })), + ) + .into(), + ( + json!({ "signatureSecurityLevelRequirement": false }), + json!({ "signatureSecurityLevelRequirement": true }), + Some(JsonSchemaChange::Replace(ReplaceOperation { + path: "/signatureSecurityLevelRequirement".to_string(), + value: json!(true), + })), + ) + .into(), + ], + }, + ), + ]) +}); diff --git a/packages/rs-json-schema-compatibility-validator/src/rules/value.rs b/packages/rs-json-schema-compatibility-validator/src/rules/value.rs new file mode 100644 index 00000000000..6b173c34632 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/rules/value.rs @@ -0,0 +1,75 @@ +use crate::error::{Error, JsonPointerPathNotFoundError, UnexpectedJsonValueTypeError}; +use serde_json::Value; + +/// Trait that provides methods for trying to convert a `Value` into different types. +pub trait ValueTryMethods { + /// Tries to get a reference to a `Value` at a given JSON Pointer path. + /// + /// # Arguments + /// + /// * `path` - A JSON Pointer path as a string. + /// + /// # Returns + /// + /// * `Result<&Self, Error>` - A result that contains a reference to the `Value` at the given path, or an error if the path does not exist. + fn try_pointer(&self, path: &str) -> Result<&Self, Error>; + + /// Tries to convert the `Value` into a `f64`. + /// + /// # Returns + /// + /// * `Result` - A result that contains the `Value` as a `f64`, or an error if the `Value` is not a `f64`. + fn try_to_f64(&self) -> Result; + + /// Tries to convert the `Value` into a `u64`. + /// + /// # Returns + /// + /// * `Result` - A result that contains the `Value` as a `u64`, or an error if the `Value` is not a `u64`. + fn try_to_u64(&self) -> Result; + + /// Tries to convert the `Value` into a `bool`. + /// + /// # Returns + /// + /// * `Result` - A result that contains the `Value` as a `bool`, or an error if the `Value` is not a `bool`. + fn try_to_bool(&self) -> Result; +} + +impl ValueTryMethods for Value { + fn try_pointer(&self, path: &str) -> Result<&Self, Error> { + self.pointer(path).ok_or_else(|| { + Error::JsonPointerPathNotFound(JsonPointerPathNotFoundError { + path: path.to_string(), + value: self.clone(), + }) + }) + } + + fn try_to_f64(&self) -> Result { + self.as_f64().ok_or_else(|| { + Error::UnexpectedJsonValueType(UnexpectedJsonValueTypeError { + expected_type: "f64".to_string(), + value: self.clone(), + }) + }) + } + + fn try_to_u64(&self) -> Result { + self.as_u64().ok_or_else(|| { + Error::UnexpectedJsonValueType(UnexpectedJsonValueTypeError { + expected_type: "u64".to_string(), + value: self.clone(), + }) + }) + } + + fn try_to_bool(&self) -> Result { + self.as_bool().ok_or_else(|| { + Error::UnexpectedJsonValueType(UnexpectedJsonValueTypeError { + expected_type: "bool".to_string(), + value: self.clone(), + }) + }) + } +} diff --git a/packages/rs-json-schema-compatibility-validator/src/validate.rs b/packages/rs-json-schema-compatibility-validator/src/validate.rs new file mode 100644 index 00000000000..70a4ffa6d7c --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/src/validate.rs @@ -0,0 +1,274 @@ +use crate::change::PatchOperationPath; +use crate::error::{ + Error, InvalidJsonPatchOperationPathError, UndefinedReplacementAllowedCallbackError, + UnsupportedSchemaKeywordError, +}; +use crate::{ + CompatibilityRules, CompatibilityRulesCollection, JsonSchemaChange, KEYWORD_COMPATIBILITY_RULES, +}; +use json_patch::PatchOperation; +use serde_json::Value; + +/// The result of JSON Schema compatibility validation between two schemas. +/// Returned by [validate_schemas_compatibility] function. +pub struct CompatibilityValidationResult { + incompatible_changes: Vec, +} + +impl CompatibilityValidationResult { + /// Returns `true` if the schemas are compatible. + pub fn is_compatible(&self) -> bool { + self.incompatible_changes.is_empty() + } + + /// Returns a list of incompatible changes between the schemas. + pub fn incompatible_changes(&self) -> &[JsonSchemaChange] { + &self.incompatible_changes + } + + /// Consumes the result and returns a list of incompatible changes between the schemas. + pub fn into_changes(self) -> Vec { + self.incompatible_changes + } +} + +/// Options for the compatibility validation. +#[derive(Debug, Clone, Default)] +pub struct Options { + /// Allows to override or add a new schema keyword compatibility rules. + pub override_rules: CompatibilityRulesCollection, +} + +impl AsRef for Options { + fn as_ref(&self) -> &Options { + self + } +} +/// Validates the backward compatibility of two JSON schemas and returns +/// the [CompatibilityValidationResult]. If two schemas are compatible, +/// it means that data that valid for the original schema is also valid +/// for the new schema. +/// +/// ``` +/// use serde_json::json; +/// use json_schema_compatibility_validator::{validate_schemas_compatibility, Options}; +/// +/// let original_schema = json!({ +/// "type": "object", +/// "properties": { +/// "name": { "type": "string" }, +/// "age": { "type": "integer" } +/// }, +/// "required": ["name"] +/// }); +/// +/// let new_schema = json!({ +/// "type": "object", +/// "properties": { +/// "name": { "type": "string" }, +/// "age": { "type": "integer" }, +/// "email": { "type": "string" } +/// }, +/// "required": ["name"] +/// }); +/// +/// let result = validate_schemas_compatibility(&original_schema, &new_schema, Options::default()) +/// .expect("compatibility validation failed"); +/// +/// assert!(result.is_compatible()); +/// ``` +/// +/// The validator accepts options to customize the behavior: +/// +/// ``` +/// use serde_json::json; +/// use assert_matches::assert_matches; +/// use json_schema_compatibility_validator::{ +/// validate_schemas_compatibility, +/// KEYWORD_COMPATIBILITY_RULES, +/// Options, +/// CompatibilityRulesCollection, +/// JsonSchemaChange, +/// RemoveOperation, +/// }; +/// +/// let mut required_rule = KEYWORD_COMPATIBILITY_RULES +/// .get("required") +/// .expect("required rule must be present") +/// .clone(); +/// +/// required_rule.allow_removal = false; +/// +/// required_rule +/// .inner +/// .as_mut() +/// .expect("required rule must have inner rules") +/// .allow_removal = false;/// +/// +/// let mut override_rules = CompatibilityRulesCollection::new(); +/// override_rules.insert("required", required_rule); +/// +/// let options = Options { override_rules }; +/// +/// let original_schema = json!({ +/// "required": ["first_name", "last_name"] +/// }); +/// +/// let new_schema = json!({ +/// "required": ["first_name"] +/// }); +/// +/// let result = validate_schemas_compatibility(&original_schema, &new_schema, options) +/// .expect("compatibility validation shouldn't fail"); +/// +/// assert_matches!( +/// result.incompatible_changes(), +/// [JsonSchemaChange::Remove(RemoveOperation { path })] if path == "/required/1" +/// ); +/// ``` +/// +pub fn validate_schemas_compatibility>( + original_schema: &Value, + new_schema: &Value, + options: O, +) -> Result { + let patch = json_patch::diff(original_schema, new_schema); + + let mut incompatible_changes: Vec = Vec::new(); + + for operation in patch.0.into_iter() { + let path = operation.path(); + + let Some(rules) = find_compatibility_rules(path, options.as_ref())? else { + return Err(Error::InvalidJsonPatchOperationPath( + InvalidJsonPatchOperationPathError { + path: path.to_string(), + }, + )); + }; + + if !is_compatible_operation(original_schema, &operation, rules)? { + incompatible_changes.push(operation.try_into()?); + } + } + + Ok(CompatibilityValidationResult { + incompatible_changes, + }) +} + +/// Returns `true` if the operation is compatible with the schema +/// according to provided compatibility rules, otherwise `false`. +fn is_compatible_operation( + original_schema: &Value, + operation: &PatchOperation, + rules: &CompatibilityRules, +) -> Result { + match &operation { + PatchOperation::Add(_) => Ok(rules.allow_addition), + PatchOperation::Remove(_) => Ok(rules.allow_removal), + PatchOperation::Replace(op) => { + let callback = rules.allow_replacement_callback.as_ref().ok_or_else(|| { + UndefinedReplacementAllowedCallbackError { + path: op.path.clone(), + rules: rules.clone(), + } + })?; + + callback(original_schema, op) + } + PatchOperation::Test(_) | PatchOperation::Copy(_) | PatchOperation::Move(_) => { + unreachable!("json_patch diff doesn't return decorative operations test, copy, move") + } + } +} + +/// Travers through the JSON Pointer path and find corresponding compatibility rules +fn find_compatibility_rules<'a>( + path: &str, + options: &'a Options, +) -> Result, Error> { + let mut path_segments = path.split('/'); + + // Remove the first empty segment + path_segments.next(); + + let mut latest_keyword_compatibility_rules: Option<&CompatibilityRules> = None; + let mut levels_to_subschema: Option = None; + for segment in path_segments { + // On the second iteration we look at the inner levels under the keyword. + // Switch to inner structure rules if they are present + if let Some(rule) = latest_keyword_compatibility_rules { + if let Some(inner_rule) = &rule.inner { + latest_keyword_compatibility_rules = Some(inner_rule); + } + } + + // Skip some levels to a next keyword if we expect an inner subschema + if let Some(levels) = levels_to_subschema { + if levels - 1 > 0 { + levels_to_subschema = levels.checked_sub(1); + + continue; + } + } else if latest_keyword_compatibility_rules.is_some() { + // Continue if we don't expect an inner subschema + continue; + } + + // The first segment is always a keyword + let rules = options + .override_rules + .get(segment) + .or_else(|| KEYWORD_COMPATIBILITY_RULES.get(segment)) + .ok_or_else(|| UnsupportedSchemaKeywordError { + keyword: segment.to_string(), + path: path.to_string(), + })?; + + levels_to_subschema = rules.subschema_levels_depth; + + latest_keyword_compatibility_rules = Some(rules); + } + + Ok(latest_keyword_compatibility_rules) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_find_compatibility_rules() { + let options = Options::default(); + let result = find_compatibility_rules("/properties/prop1", &options) + .expect("should find keyword without failure"); + + assert_eq!( + result, + Some( + KEYWORD_COMPATIBILITY_RULES + .get("properties") + .unwrap() + .inner + .as_deref() + .unwrap() + ) + ); + + let result = find_compatibility_rules("/properties/prop1/properties/type", &options) + .expect("failed to find a keyword rule"); + + assert_eq!( + result, + Some( + KEYWORD_COMPATIBILITY_RULES + .get("properties") + .unwrap() + .inner + .as_deref() + .unwrap() + ) + ); + } +} diff --git a/packages/rs-json-schema-compatibility-validator/tests/reorder.rs b/packages/rs-json-schema-compatibility-validator/tests/reorder.rs new file mode 100644 index 00000000000..ae7b8e3a3e5 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/tests/reorder.rs @@ -0,0 +1,170 @@ +use json_schema_compatibility_validator::{validate_schemas_compatibility, Options}; +use serde_json::json; + +#[test] +fn test_properties_reordering() { + let original_schema = json!({ + "properties": { + "prop1": { + "type": "string" + }, + "prop2": { + "type": "string" + }, + "prop3": { + "type": "number" + } + } + }); + + let new_schema = json!({ + "properties": { + "prop2": { + "type": "string" + }, + "prop1": { + "type": "string" + }, + "prop3": { + "type": "number" + }, + } + }); + + let result = validate_schemas_compatibility(&original_schema, &new_schema, Options::default()) + .expect("schema compatibility validation error"); + + assert!( + result.is_compatible(), + "assertion failed: incompatible changes: {:?}", + result.incompatible_changes() + ); +} + +#[test] +fn test_reordering_from_string() { + let original_schema_string = r#"{ + "properties": { + "prop1": { + "type": "string" + }, + "prop2": { + "type": "string" + }, + "prop3": { + "type": "number" + } + } + }"#; + + let original_schema = serde_json::from_str(original_schema_string) + .expect("failed to decode from string to json value"); + + let new_schema_string = r#"{ + "properties": { + "prop2": { + "type": "string" + }, + "prop1": { + "type": "string" + }, + "prop3": { + "type": "number" + } + } + }"#; + + let new_schema = serde_json::from_str(new_schema_string) + .expect("failed to decode from string to json value"); + + let result = validate_schemas_compatibility(&original_schema, &new_schema, Options::default()) + .expect("schema compatibility validation error"); + + assert!( + result.is_compatible(), + "assertion failed: incompatible changes: {:?}", + result.incompatible_changes() + ); +} + +#[test] +fn test_keywords_reordering() { + let original_schema = json!({ + "type": "array", + "items": false, + "prefixItems": [ + { + "type": "string", + }, + { + "type": "number" + } + ] + }); + + let new_schema = json!({ + "type": "array", + "prefixItems": [ + { + "type": "string", + }, + { + "type": "number" + } + ], + "items": false, + }); + + let result = validate_schemas_compatibility(&original_schema, &new_schema, Options::default()) + .expect("schema compatibility validation error"); + + assert!( + result.is_compatible(), + "assertion failed: incompatible changes: {:?}", + result.incompatible_changes() + ); +} + +#[test] +fn test_inner_keywords_reordering() { + let original_schema = json!({ + "type": "array", + "items": false, + "prefixItems": [ + { + "type": "string", + "minLength": 1, + "maxLength": 20, + "pattern": "^[a-z]$", + }, + { + "type": "number" + } + ] + }); + + let new_schema = json!({ + "type": "array", + "items": false, + "prefixItems": [ + { + "type": "string", + "maxLength": 20, + "minLength": 1, + "pattern": "^[a-z]$", + }, + { + "type": "number" + } + ] + }); + + let result = validate_schemas_compatibility(&original_schema, &new_schema, Options::default()) + .expect("schema compatibility validation error"); + + assert!( + result.is_compatible(), + "assertion failed: incompatible changes: {:?}", + result.incompatible_changes() + ); +} diff --git a/packages/rs-json-schema-compatibility-validator/tests/rules.rs b/packages/rs-json-schema-compatibility-validator/tests/rules.rs new file mode 100644 index 00000000000..f7e69758ff7 --- /dev/null +++ b/packages/rs-json-schema-compatibility-validator/tests/rules.rs @@ -0,0 +1,51 @@ +use json_schema_compatibility_validator::{ + validate_schemas_compatibility, CompatibilityRuleExample, Options, KEYWORD_COMPATIBILITY_RULES, +}; + +#[test] +fn test_schema_keyword_rules() { + for (keyword, rule) in KEYWORD_COMPATIBILITY_RULES.iter() { + println!("Testing `{}` keyword", keyword); + + assert_examples(keyword, &rule.examples); + + if let Some(inner_rule) = &rule.inner { + assert_examples(keyword, &inner_rule.examples); + } + } +} + +fn assert_examples(keyword: &str, examples: &[CompatibilityRuleExample]) { + let options = Options::default(); + for example in examples { + let result = + validate_schemas_compatibility(&example.original_schema, &example.new_schema, &options) + .expect("should not fail"); + + if let Some(change) = &example.incompatible_change { + let expected_change = vec![change.clone()]; + + assert_eq!( + result.incompatible_changes(), + &expected_change, + r"assertion failed: expected incompatible change of '{}' + +From: {:?} +To: {:?}", + keyword, + &example.original_schema, + &example.new_schema + ); + } else { + assert!( + result.is_compatible(), + r"assertion failed: '{keyword}' modification is not compatible: {:?} +From: {:?} +To: {:?}", + result.incompatible_changes(), + &example.original_schema, + &example.new_schema + ); + } + } +} diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index fe767766c7e..58810354baa 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,11 +2,10 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -private = true [lib] proc-macro = true diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_33_46-3251.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_33_46-3251.txt new file mode 100644 index 00000000000..2bf8ae6a830 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_33_46-3251.txt @@ -0,0 +1,58 @@ +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + 0: 0x105792da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10dec6208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1057ab528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x1057ab2e4 - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4 + 4: 0x1057a8a18 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7 + 5: 0x1057ab06c - _rust_begin_unwind + 6: 0x105804bd0 - core::panicking::panic_fmt::h33e40d2a93cab78f + 7: 0x105804b9c - core::option::expect_failed::h8c59d9d921ed2136 + 8: 0x10e1603ec - rustc_codegen_ssa[b392610c019ec31b]::back::write::execute_copy_from_cache_work_item:: + 9: 0x10e142508 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()> + 10: 0x10e161244 - <::spawn_unchecked_<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1057b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x105792da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10dec6208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1057ab528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x112041168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1120410ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x1125da040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x111fba9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x111fb1c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x111fb1be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1125d53c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10e144270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10e16151c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x1057b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x105792da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10dec6208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1057ab528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x112041168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1120410ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x1125da040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x111fba9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x111fb1c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x111fb1be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1125d53c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10e13df48 - ::time::>::join::{closure#0}> + 11: 0x10e163284 - >::join + 12: 0x10e152d48 - ::join_codegen + 13: 0x10e06e64c - ::link + 14: 0x10deb311c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10dee9628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10debbd7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x1057b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_00-10108.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_00-10108.txt new file mode 100644 index 00000000000..d5294ffb6b9 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_00-10108.txt @@ -0,0 +1,58 @@ +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + 0: 0x103aeeda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c222208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x103b07528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x103b072e4 - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4 + 4: 0x103b04a18 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7 + 5: 0x103b0706c - _rust_begin_unwind + 6: 0x103b60bd0 - core::panicking::panic_fmt::h33e40d2a93cab78f + 7: 0x103b60b9c - core::option::expect_failed::h8c59d9d921ed2136 + 8: 0x10c4bc3ec - rustc_codegen_ssa[b392610c019ec31b]::back::write::execute_copy_from_cache_work_item:: + 9: 0x10c49e508 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()> + 10: 0x10c4bd244 - <::spawn_unchecked_<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x103b0f7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x103aeeda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c222208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x103b07528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x11039d168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x11039d0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x110936040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x1103169f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x11030dc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x11030dbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1109313c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c4a0270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10c4bd51c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x103b0f7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x103aeeda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c222208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x103b07528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x11039d168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x11039d0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x110936040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x1103169f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x11030dc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x11030dbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1109313c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c499f48 - ::time::>::join::{closure#0}> + 11: 0x10c4bf284 - >::join + 12: 0x10c4aed48 - ::join_codegen + 13: 0x10c3ca64c - ::link + 14: 0x10c20f11c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10c245628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10c217d7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x103b0f7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_04-10384.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_04-10384.txt new file mode 100644 index 00000000000..e63382aedb6 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_04-10384.txt @@ -0,0 +1,58 @@ +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + 0: 0x100dfeda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x109532208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x100e17528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x100e172e4 - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4 + 4: 0x100e14a18 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7 + 5: 0x100e1706c - _rust_begin_unwind + 6: 0x100e70bd0 - core::panicking::panic_fmt::h33e40d2a93cab78f + 7: 0x100e70b9c - core::option::expect_failed::h8c59d9d921ed2136 + 8: 0x1097cc3ec - rustc_codegen_ssa[b392610c019ec31b]::back::write::execute_copy_from_cache_work_item:: + 9: 0x1097ae508 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()> + 10: 0x1097cd244 - <::spawn_unchecked_<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x100e1f7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x100dfeda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x109532208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x100e17528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10d6ad168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10d6ad0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x10dc46040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10d6269f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10d61dc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10d61dbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x10dc413c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x1097b0270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x1097cd51c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x100e1f7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x100dfeda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x109532208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x100e17528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10d6ad168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10d6ad0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x10dc46040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10d6269f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10d61dc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10d61dbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x10dc413c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x1097a9f48 - ::time::>::join::{closure#0}> + 11: 0x1097cf284 - >::join + 12: 0x1097bed48 - ::join_codegen + 13: 0x1096da64c - ::link + 14: 0x10951f11c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x109555628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x109527d7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x100e1f7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_08-10643.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_08-10643.txt new file mode 100644 index 00000000000..c9bc88270b3 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_08-10643.txt @@ -0,0 +1,58 @@ +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + 0: 0x1036e6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10be1a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1036ff528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x1036ff2e4 - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4 + 4: 0x1036fca18 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7 + 5: 0x1036ff06c - _rust_begin_unwind + 6: 0x103758bd0 - core::panicking::panic_fmt::h33e40d2a93cab78f + 7: 0x103758b9c - core::option::expect_failed::h8c59d9d921ed2136 + 8: 0x10c0b43ec - rustc_codegen_ssa[b392610c019ec31b]::back::write::execute_copy_from_cache_work_item:: + 9: 0x10c096508 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()> + 10: 0x10c0b5244 - <::spawn_unchecked_<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1037077d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x1036e6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10be1a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1036ff528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10ff95168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10ff950ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x11052e040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10ff0e9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10ff05c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10ff05be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1105293c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c098270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10c0b551c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x1037077d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x1036e6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10be1a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1036ff528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10ff95168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10ff950ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x11052e040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10ff0e9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10ff05c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10ff05be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1105293c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c091f48 - ::time::>::join::{closure#0}> + 11: 0x10c0b7284 - >::join + 12: 0x10c0a6d48 - ::join_codegen + 13: 0x10bfc264c - ::link + 14: 0x10be0711c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10be3d628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10be0fd7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x1037077d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_12-10937.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_12-10937.txt new file mode 100644 index 00000000000..4b01eb28688 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_12-10937.txt @@ -0,0 +1,58 @@ +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + 0: 0x1031cada8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10b8fe208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1031e3528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x1031e32e4 - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4 + 4: 0x1031e0a18 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7 + 5: 0x1031e306c - _rust_begin_unwind + 6: 0x10323cbd0 - core::panicking::panic_fmt::h33e40d2a93cab78f + 7: 0x10323cb9c - core::option::expect_failed::h8c59d9d921ed2136 + 8: 0x10bb983ec - rustc_codegen_ssa[b392610c019ec31b]::back::write::execute_copy_from_cache_work_item:: + 9: 0x10bb7a508 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()> + 10: 0x10bb99244 - <::spawn_unchecked_<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1031eb7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x1031cada8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10b8fe208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1031e3528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10fa79168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10fa790ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x110012040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10f9f29f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10f9e9c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10f9e9be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x11000d3c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10bb7c270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10bb9951c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x1031eb7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x1031cada8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10b8fe208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1031e3528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10fa79168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10fa790ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x110012040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10f9f29f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10f9e9c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10f9e9be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x11000d3c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10bb75f48 - ::time::>::join::{closure#0}> + 11: 0x10bb9b284 - >::join + 12: 0x10bb8ad48 - ::join_codegen + 13: 0x10baa664c - ::link + 14: 0x10b8eb11c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10b921628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10b8f3d7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x1031eb7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_20-11458.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_20-11458.txt new file mode 100644 index 00000000000..dae6da51bf2 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_20-11458.txt @@ -0,0 +1,58 @@ +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + 0: 0x1039e6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c11a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1039ff528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x1039ff2e4 - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4 + 4: 0x1039fca18 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7 + 5: 0x1039ff06c - _rust_begin_unwind + 6: 0x103a58bd0 - core::panicking::panic_fmt::h33e40d2a93cab78f + 7: 0x103a58b9c - core::option::expect_failed::h8c59d9d921ed2136 + 8: 0x10c3b43ec - rustc_codegen_ssa[b392610c019ec31b]::back::write::execute_copy_from_cache_work_item:: + 9: 0x10c396508 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()> + 10: 0x10c3b5244 - <::spawn_unchecked_<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x103a077d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x1039e6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c11a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1039ff528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x110295168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1102950ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x11082e040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x11020e9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x110205c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x110205be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1108293c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c398270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10c3b551c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x103a077d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x1039e6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c11a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1039ff528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x110295168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1102950ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x11082e040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x11020e9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x110205c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x110205be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1108293c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c391f48 - ::time::>::join::{closure#0}> + 11: 0x10c3b7284 - >::join + 12: 0x10c3a6d48 - ::join_codegen + 13: 0x10c2c264c - ::link + 14: 0x10c10711c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10c13d628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10c10fd7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x103a077d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_23-11733.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_23-11733.txt new file mode 100644 index 00000000000..87aede658a9 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_23-11733.txt @@ -0,0 +1,106 @@ +thread 'cpy oxxcwsebgx1733i' panicked at thread 'cpy 5fuhladjlcxb67o9' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:44913: +:no saved object file in work product44 +stack backtrace: +: +no saved object file in work product +stack backtrace: +thread 'cpy vhs4c6sj2h4xpaq' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + 0: 0x103926da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c05a208thread ' - cpy ebti8ycrnjshmsw as core [018650a1770591c75: ] :: ops :: function :: Fn <0x(103926da8& - dyn stdfor<:: 0: 0x103926da8 - stdbacktrace::::backtraceBacktrace::::Backtracecreate::::create :: h8af6f7a25d8a3749 +0 : h8af6f7a25d8a3749 +1 : 0x 103926da8 0x 10c05a2081' - astd, ::'backtraceb::> Backtracecore::[create - ::18650a1770591c75h8af6f7a25d8a3749< +: alloc [ 37ddc2533ea56b7b1]: :: boxed :: ] :: ops Box < ::rustc_driver_impl [ function ::0x d723ad74a265baf3 ]0x::10c05a208install_ice_hookFn::{ as corecore[[18650a1770591c7518650a1770591c75]]::::panicops::::panic_infofunction::::Fn10c05a208PanicInfo - << - alloc<[alloc37ddc2533ea56b7b']b::>boxed,::)Box, ] + ::coreinstall_ice_hook[::{18650a1770591c75closure]#::0marker}::>Sync as + corecore[18650a1770591c75]::marker::Send, &core[18650a1770591c75<](::&panicdyn ::for]'::bops> ::corefunction[::18650a1770591c7537ddc2533ea56b7b]::boxed::Box::{::closurecall# +0 } > as 2core: [ 18650a1770591c75 ] :: ops :: function ::0xFn<(&dyn for<'a, 'b> core[10393f52818650a1770591c75 - ]std::::opspanicking::function::Fn<(&'a core[18650a1770591c75]::panic::::rust_panic_with_hookpanic_info::::h1e70c5d905e30e9dPanicInfo<'b>,), Output = ()> + core[ +18650a1770591c75 ] :: marker3::Sync + core[18650a1770591c75]::marker::Send, &: core [ 18650a1770591c75 ] :: panic :: panic_info::Fn0xPanicInfo])::10393f2e4ops>::>< - functionstd::::Fnpanicking<::(begin_panic_handler&::'({&{dyn closurea} }core::[h399e32952efd26a4:: +call + 418650a1770591c75: 2 : ]for< ' a , 0x 10393ca18 - std ::'::sys_commonpanic::::backtracepanic_info::::b__rust_end_short_backtrace :: h2ab87f841a2323e7PanicInfo +< ' b 0x> 10393f528core - [std18650a1770591c75::]panicking::::opsrust_panic_with_hook::::functionh1e70c5d905e30e9d:: +Fn < ( &3': a core [ 18650a1770591c75 ] :: panic0x::10393f2e4panic_info - ::stdPanicInfo::::,{){, closureOutput} = }()::>h399e32952efd26a4 + +core [ 18650a1770591c75 ]4::: marker :: Sync >5 : , + )core, [Output 0x 10393ca18 - std :: sys_common0x10393f06c:: = backtrace()::>__rust_end_short_backtrace + - core_rust_begin_unwind[ +18650a1770591c75 ::18650a1770591c75]]::::markermarker::Send h2ab87f841a2323e7 +6 : 5 : 0x 103998bd0 - , 0x&10393f06c:: - core_rust_begin_unwindSync +:: + panicking ::6core: core [ panic_fmt 18650a1770591c75 ::]h33e40d2a93cab78f:: + [ 18650a1770591c75 ]7::: marker :: Send , 0x&103998bd0core - [core18650a1770591c75::]panicking::::panicpanic_fmt::::panich33e40d2a93cab78f panic_info :: PanicInfo ::)>panic_info>::::PanicInfocall) +> 2: + > 0x 103998b9c :: call + 0x 10393f528 - 2 : std :: panicking :: rust_panic_with_hook7 : :: h1e70c5d905e30e9d + 0x3103998b9c: - core :: option ::expect_failed - 0x 10393f528 - 0xstd10393f2e4:: - panickingstd::::rust_panic_with_hookpanicking::::h1e70c5d905e30e9dbegin_panic_handler +:: { { closure3core: } }:: h8c59d9d921ed2136 + ::8h399e32952efd26a4 : :: option :: expect_failed :: h8c59d9d921ed2136 + 0x 10c2f43ec +80x: 10393f2e4 - std :: panicking :: begin_panic_handler - 0x:: {4{: closure 10c2f43ec - }rustc_codegen_ssarustc_codegen_ssa}[[::b392610c019ec31bh399e32952efd26a4]b392610c019ec31b +:: back :: write]4::::: execute_copy_from_cache_work_item back::::< writerustc_codegen_llvm::[execute_copy_from_cache_work_itemb70b0e52460f9a66::]<::rustc_codegen_llvmLlvmCodegenBackend[>b70b0e52460f9a66 +]:: LlvmCodegenBackend > +9 : 9 : 0x 10393ca180x - 10c2d6508std - ::stdsys_common[::fcd23fca98dce159backtrace]::::__rust_end_short_backtracesys_common::::h2ab87f841a2323e7backtrace +:: __rust_begin_short_backtrace :: <5: 0x10393f06c - _rust_begin_unwind + < rustc_codegen_llvm [6b70b0e52460f9a66: ] :: LlvmCodegenBackend as rustc_codegen_ssa 0x0x10393ca18103998bd0[ - - stdcore::::sys_commonpanicking::panic_fmt::h33e40d2a93cab78fb392610c019ec31b +] :: traits ::7backend: :: ExtraBackendMethods > :: spawn_named_thread < rustc_codegen_ssa [0xb392610c019ec31b103998b9c] - ::coreback::::optionwrite::::expect_failedspawn_work::h8c59d9d921ed2136 <::rustc_codegen_llvmbacktrace:: + __rust_end_short_backtrace :: h2ab87f841a2323e70x +10c2d6508 - std[fcd23fca98dce159 ] :: sys_common8::: backtrace :: __rust_begin_short_backtrace ::5<: < rustc_codegen_llvm [ b70b0e52460f9a66 ] :: LlvmCodegenBackend as 0xrustc_codegen_ssa10393f06c[ - b392610c019ec31b_rust_begin_unwind] + [ :: traits :: backend ::b70b0e52460f9a66ExtraBackendMethods0x>10c2f43ec:: - spawn_named_threadrustc_codegen_ssa<]rustc_codegen_ssa::[LlvmCodegenBackendb392610c019ec31b>]::{::closureback#::0write}::, spawn_work()<>rustc_codegen_llvm::{[closureb70b0e52460f9a66#]0::}LlvmCodegenBackend, >()::{>closure +# 10: 0x10c2f5244 - <}::, spawn_unchecked_()<><::{rustc_codegen_llvmclosure[#[0b392610c019ec31bb70b0e52460f9a66 ]]:: LlvmCodegenBackend6 as : rustc_codegen_ssa[b392610c019ec31b]::::traitsback::::backendwrite::::} execute_copy_from_cache_work_item :: < rustc_codegen_llvm ExtraBackendMethods , >()0x>103998bd0 + - core ::::panicking10::: panic_fmtspawn_named_thread:: h33e40d2a93cab78f + < rustc_codegen_ssa [7b392610c019ec31b: ] :: back :: write :: spawn_work <0xrustc_codegen_llvm103998b9c[ - b70b0e52460f9a66core]:: ::[ b70b0e52460f9a66 ]0x::10c2f5244optionLlvmCodegenBackend:: - >< + :: spawn_unchecked_ < <8rustc_codegen_llvm: [ b70b0e52460f9a66 ] :: LlvmCodegenBackend as rustc_codegen_ssa [ b392610c019ec31b ]0x::10c2d6508traits - ::stdbackend[::ExtraBackendMethods>0xfcd23fca98dce159LlvmCodegenBackend10c2f43ec]> - ::{rustc_codegen_ssaclosure[#b392610c019ec31b]::::0sys_common}::, backtrace()>::::{closure::#spawn_named_thread0<}rustc_codegen_ssa, [()b392610c019ec31b>]::{::closureback#::1write}:: as spawn_workcore<[rustc_codegen_llvm18650a1770591c75[]back::::opsb70b0e52460f9a66]::::function__rust_begin_short_backtracewrite::::FnOnce<<<()rustc_codegen_llvm>[>b70b0e52460f9a66::]execute_copy_from_cache_work_item::::LlvmCodegenBackend< as rustc_codegen_llvmrustc_codegen_ssa[[b70b0e52460f9a66b392610c019ec31b]]::::LlvmCodegenBackendtraits>:: +backend :: ExtraBackendMethods >9::: spawn_named_thread < rustc_codegen_ssa [ b392610c019ec31b ] :: back0x::10c2d6508write - ::stdspawn_work[__rust_begin_short_backtrace::{::<0::{}closure, #()0>}::{, closure()#>0::{}closure, #()0>}::{, closure()#>1 +} as core10[: 18650a1770591c75 ]:: + 11 as : rustc_codegen_ssa 0x 10c2f5244 - < <0xstd1039477d0[ - fcd23fca98dce159std]::::systhread::::unixBuilder::>thread::::spawn_unchecked_Thread<::]::::spawn_named_threadtraits<::rustc_codegen_ssabackend[::b392610c019ec31bExtraBackendMethods]>::::backspawn_named_thread::<::{rustc_codegen_llvmclosureops[::b70b0e52460f9a66#]0::}, LlvmCodegenBackend()>>::{::{closureclosure##0function}::, FnOnce()<>()::{>closure>#::0call_once}::{, shim():>vtable::{#closure0#}1 +} as core11[: 18650a1770591c75 ] :: ops :: function :: FnOnce0x<1039477d0() - >std>::::syscall_once::::{unixshim:::threadvtable::#Thread0::}new +:: thread_start ::11h8dda2af345bab446: + 12 : 0x 1039477d0 - std ::0xsys1813c506c:: - unix__pthread_deallocate:: +thread::Thread::new::thread_start::h8dda2af345bab446 + 12: new :: thread_start ::0xh8dda2af345bab4461813c506c + - __pthread_deallocate +12: 0x1813c506c - __pthread_deallocate +0}, ()> + 10: 0x10c2f5244 - <::spawn_unchecked_<::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1039477d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x103926da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c05a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x10393f528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x1101d5168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1101d50ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x11076e040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x11014e9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x110145c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x110145be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1107693c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c2d8270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10c2f551c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x1039477d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x103926da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c05a208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x10393f528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x1101d5168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1101d50ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x11076e040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x11014e9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x110145c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x110145be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1107693c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c2d1f48 - ::time::>::join::{closure#0}> + 11: 0x10c2f7284 - >::join + 12: 0x10c2e6d48 - ::join_codegen + 13: 0x10c20264c - ::link + 14: 0x10c04711c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10c07d628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10c04fd7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x1039477d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_25-11999.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_25-11999.txt new file mode 100644 index 00000000000..8adce894dc3 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_25-11999.txt @@ -0,0 +1,138 @@ +thread 'cpy k5jtp3uu1e1wr25' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: +thread 'cpy oxxcwsebgx1733i' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs : 913thread ':044: cpy 5fuhladjlcxb67o9 : +' panicked at no saved object file in work product/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs +stack backtrace: +:thread '913cpy 4orp8g2x23rgnt3a: 44 : + ' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs :0x913:no saved object file in work product44 +stack backtrace: +: + 1055ceda8no saved object file in work product - thread ' +stack backtrace: +cpy vhs4c6sj2h4xpaqstdthread ' cpy ebti8ycrnjshmsw0' panicked at : ' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:::backtrace913:::Backtrace44: +no saved object file in work product:: /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rscreate:::h8af6f7a25d8a3749 913 :044: : + + +stack backtrace: + no saved object file in work product +stack backtrace: + 10: : 0 : 0x 1055ceda8 - std 0x 1055ceda8 - std0x:: backtrace::0xbacktrace::::BacktraceBacktrace10dd02208:: - create<::alloch8af6f7a25d8a3749[ 37ddc2533ea56b7b01055ceda8: ] - :: create0xstd::1055ceda8:: - backtraceh8af6f7a25d8a3749 + + :: :: Backtrace1::: std :: 1boxed: :: Box < rustc_driver_impl [create ::backtraceh8af6f7a25d8a3749:: +Backtrace :: 0x 1055ceda8 - std :: d723ad74a265baf30x]10dd02208:: - install_ice_hook<::{allocclosure[#37ddc2533ea56b7b0]}::>boxed as createcorebacktrace[ 18650a1770591c75::]1 :: ops ::: function :: Fn:: + - core [ 00x<10dd02208alloc - [<1alloc18650a1770591c751]: ::[ops}::>function :: Fn < ( 37ddc2533ea56b7b as &core]: 37ddc2533ea56b7b:: ]'0xboxed::::boxedBox[10dd0220818650a1770591c75 - ] <:: allocopsa::< ::core[Box[<37ddc2533ea56b7brustc_driver_impl][::rustc_driver_implboxedfunction[ ::18650a1770591c75Box]d723ad74a265baf3:: panic<::0xpanic_inforustc_driver_impl::10dd02208Fn - <](<&::dyn allocfor ::[core::0]boxed::::install_ice_hookBox::{<[rustc_driver_implPanicInfod723ad74a265baf3<18650a1770591c75closure}'>b as >],])::, coreinstall_ice_hook[#d723ad74a265baf3]::{0::[ops18650a1770591c75::function}]Output> = as closure::()ops>::core + ::core[[Fn#::<018650a1770591c75(]function::::markerinstall_ice_hook18650a1770591c75::{]::}opsclosure>::&::'a as # coreSync0 + functioncore::[[Fn18650a1770591c75}core18650a1770591c75[<18650a1770591c75Fn]](::>&markerdyn :: as , &'coreb> > [corepanic[18650a1770591c7518650a1770591c75]]dyn ::::::opspanic_info::::corePanicInfo'for<[bops>::,18650a1770591c75)], ::functionops::::Fn'<)(Outputa = , &'function()>>function> + ::coreb::::'Fn> <[acall +core18650a1770591c75[(&]core ::[markerFn::<(18650a1770591c75Sync18650a1770591c75 + ]& 'core'[a18650a1770591c75 ::acore]panic::::markerpanic_info ]::::[2 : core [ 18650a1770591c75 ]18650a1770591c75::opspanic]::::::::panicfunctionSend::, Fn&PanicInfocore::[ panic_info <::'18650a1770591c75b ,(::&PanicInfo'panic_infob::>,0x)1055e7528PanicInfo - )std>, >a<::'callOutputb) = , +> , coreOutput [218650a1770591c75: ])() = , ::::Output ()>> + paniccorepanicking + core = [()::>panic_info + ::::[rust_panic_with_hookPanicInfocore 18650a1770591c75< 18650a1770591c750x]1055e7528[::18650a1770591c75 - ::']markerstd]h1e70c5d905e30e9d::::Syncpanicking + bcore:::: +:: rust_panic_with_hook marker[>::markerh1e70c5d905e30e9d::,Sync + 18650a1770591c75::)Sync, + Outputcore = [()18650a1770591c75]3 ::]marker::: ::marker Send> + 3core, [&18650a1770591c75: ]core:: + marker core::[Sync::[ 18650a1770591c75 + Sendcore [ 18650a1770591c75 , &0x]1055e72e4:: - markerstd::core::Send[18650a1770591c75 ] 18650a1770591c75 ], ::] :: markerpanic0x::::panic_infopanicking::::PanicInfoSend1055e72e4) - &stdcore::[panicking::18650a1770591c75, ]::begin_panic_handler::::panic>::{&{panicclosure::}corepanic_info[}::18650a1770591c75PanicInfo>)::]::call> +begin_panic_handler :: panic_info {h399e32952efd26a42>{:: +PanicInfo:: ) >::: closurepanic}::}panic_info::::h399e32952efd26a4PanicInfo + 4 ): >call> +:: call > + 4 :: 0x 1055e4a18call - 2 +: : 20x : 0x 1055e4a18 1055e7528 - - stdstd::sys_common2::panicking std:: :: sys_common ::0x1055e7528 - rust_panic_with_hookbacktrace :: __rust_end_short_backtrace:::::: h2ab87f841a2323e7backtrace +:: __rust_end_short_backtrace :: std5: : h2ab87f841a2323e7:: panicking +0x::1055e7528rust_panic_with_hook - ::stdh1e70c5d905e30e9d:: + 53: : 0xh1e70c5d905e30e9d + 1055e7528 - 30x: 1055e706c - _rust_begin_unwind std :: panicking :: rust_panic_with_hook0x::1055e72e4h1e70c5d905e30e9d - + panickingstd::::rust_panic_with_hookpanicking:::: 0xh1e70c5d905e30e9d1055e706c + - _rust_begin_unwind + 3 : + begin_panic_handler0x:: { {6closure: } 1055e72e4 - std :: panicking ::3begin_panic_handler: :: { 6 }{::closureh399e32952efd26a4} +}: :: h399e32952efd26a4 +4 : 0x 0x 105640bd01055e72e4 0x 1055e4a18 - 0xstd105640bd0 - - stdcore::::panickingpanicking - core :::: panicking0x::1055e72e4panic_fmt - begin_panic_handler::stdh33e40d2a93cab78f:: +panicking:: :: begin_panic_handler ::7{ {{4{closureclosure}: }}}::::h399e32952efd26a4h399e32952efd26a4 + +: 4 : 0x 1055e4a18 - std:: :: sys_common :: backtrace::__rust_end_short_backtrace0x::105640b9ch2ab87f841a2323e7 - +core ::panic_fmtoption::::h33e40d2a93cab78fexpect_failed + 5 : 7 : 0x 1055e4a18 - std :: sys_common :: backtrace :::: ::4h8c59d9d921ed2136: + 8 sys_common 0x0x1055e4a18105640b9c - - : ::corebacktrace::::option__rust_end_short_backtrace::0x __rust_end_short_backtrace :: h2ab87f841a2323e7 + :: h2ab87f841a2323e7 +0x 10df9c3ec - 1055e706crustc_codegen_ssa5[: b392610c019ec31b ] - _rust_begin_unwind + std expect_failed5 ::: h8c59d9d921ed2136 6 + : 0x81055e706c - _rust_begin_unwind + :: : sys_common :: backtrace0x::105640bd0__rust_end_short_backtrace - ::coreh2ab87f841a2323e7:: +panicking :: back 5 : ::0xwrite10df9c3ec:: - execute_copy_from_cache_work_item :::: 0x 1055e706c0x 1055e706c6 - : _rust_begin_unwind +panic_fmt - rustc_codegen_ssa_rust_begin_unwind[ +b392610c019ec31b ] :: 6< rustc_codegen_llvm: [ b70b0e52460f9a66 ] :: LlvmCodegenBackend ::backh33e40d2a93cab78f::> +write :: execute_copy_from_cache_work_item 7 : ::< +0xrustc_codegen_llvm 105640bd0 - 0x [ 6core9: : :: panicking :: 0x 105640bd0 - core 0x:: panickingb70b0e52460f9a66::]panic_fmt::0xLlvmCodegenBackend::>h33e40d2a93cab78f + +105640b9c panic_fmt 97: : 105640bd0 - 10df7e508 - core :: - corestd::[::optionfcd23fca98dce159::]expect_failed::::sys_common ::panickingh33e40d2a93cab78fh8c59d9d921ed2136:: + + backtrace panic_fmt 80x::: 10df7e508h33e40d2a93cab78f - 0xstd +105640b9c[ - fcd23fca98dce159core]::::::sys_common __rust_begin_short_backtraceoption :: expect_failed7: :: ::h8c59d9d921ed2136 +:: < < rustc_codegen_llvm[ b70b0e52460f9a66 backtrace 8 : 0x 10df9c3ec ] - ::rustc_codegen_ssa7::: [ b392610c019ec31b LlvmCodegenBackend__rust_begin_short_backtrace ] :: 0x 10df9c3ec back0x as 105640b9c:: - - corerustc_codegen_ssa::[optionb392610c019ec31b::writeexpect_failedrustc_codegen_ssa ::::h8c59d9d921ed2136:: +<: :: spawn_named_thread execute_copy_from_cache_work_itemb392610c019ec31bb70b0e52460f9a66<] :: LlvmCodegenBackend > +:: - core ::option9::]LlvmCodegenBackend ::rustc_codegen_ssa spawn_named_thread > + <:: write ::0xspawn_work10df7e508rustc_codegen_ssa - 9 : 0x[ 10df9c3ec [ - b392610c019ec31brustc_codegen_ssa ][<::rustc_codegen_llvmback[b392610c019ec31bb70b0e52460f9a66::]]::std::write[b392610c019ec31bfcd23fca98dce159]LlvmCodegenBackend::]backback::>write ::::{::execute_copy_from_cache_work_itemclosure::# write0xspawn_work10df7e508:: - __rust_begin_short_backtrace, ::]LlvmCodegenBackend<><::{ +#closurerustc_codegen_llvmLlvmCodegenBackend[#b70b0e52460f9a66>0 +]} [, b392610c019ec31b ]():: traits ::9backend> +0::: LlvmCodegenBackend as 9rustc_codegen_ssa: }[ b392610c019ec31b ] , :: () 0x>10df7e50810 - : std [ fcd23fca98dce159 traits :::: ExtraBackendMethodsbackend>:::: spawn_named_thread ::{ExtraBackendMethodsclosure>#0x::0spawn_named_thread10df9d244]<::rustc_codegen_ssasys_common - ::[b392610c019ec31b - b392610c019ec31b]]::::backstdback::::writewrite::::spawn_workstd[LlvmCodegenBackend::< as spawn_unchecked_<ExtraBackendMethods::{>closure::#spawn_named_thread::fcd23fca98dce159]]::::LlvmCodegenBackendrustc_codegen_ssa::::{[[0b392610c019ec31b}]b392610c019ec31bclosure, rustc_codegen_ssa()[>#::]0b392610c019ec31bBuilder]>::::backtraits::{}::::::traitsspawn_unchecked_::b70b0e52460f9a66backend]::::spawn_named_threadLlvmCodegenBackend< as rustc_codegen_ssarustc_codegen_ssa::ExtraBackendMethods[>closurespawn_work[>::]backend::::[ +ExtraBackendMethodsback::{, ::closure()#>0 +write>}::::spawn_named_threadb70b0e52460f9a66>::{::{closureclosure#rustc_codegen_llvm[0b70b0e52460f9a66 # 0x 10df9d244] - b70b0e52460f9a66<]<::stdLlvmCodegenBackend>[::{}closure::#LlvmCodegenBackend0>, ()::{}0x, 10df9d244() - fcd23fca98dce159<0closure>#::{0closure}>}<# +, ]std, ::()thread>::::{[Builder()>>::closure0spawn_unchecked_}<, <()fcd23fca98dce159rustc_codegen_llvm>[ #b70b0e52460f9a660]}] :: +::LlvmCodegenBackend as ::{closure10, : thread()#rustc_codegen_ssa::0 Builder}>, >()::>::{::{spawn_unchecked_closureclosure#<1#}< as 1corerustc_codegen_llvm[} as [ b392610c019ec31b 10[18650a1770591c75: b70b0e52460f9a66 ] :: ] ] ::core [traitsops ::::function 0x 18650a1770591c7510df9d244:: - LlvmCodegenBackend< as FnOnce::<::0x::10df9d244traits - ::]::::spawn_named_threadthreadbackend<>rustc_codegen_ssa::[b70b0e52460f9a66b392610c019ec31b]]::::LlvmCodegenBackendback as ::rustc_codegen_ssawrite[::b392610c019ec31bspawn_work]<::rustc_codegen_llvmtraits[::b70b0e52460f9a66backend]::::ExtraBackendMethodsLlvmCodegenBackend>>::::{spawn_named_threadclosure<#rustc_codegen_ssa0[}b392610c019ec31b, ]()::>back::{::closurewrite#::0spawn_work}<, rustc_codegen_llvm()[>b70b0e52460f9a66::{]closure::#LlvmCodegenBackend1>}::{ as closurecore#[018650a1770591c75}], ::()ops>::::{closure#0}functionExtraBackendMethods, >()::>()>spawn_named_thread::b392610c019ec31bclosure]>::#::backcall_once1::{::}::::{writeshim::Builder>>spawn_work as < function::{::closureFnOnce#<0()>11>: :: call_once ::{ shim : vtable # 00x}1055ef7d0 + - std ::11sys: 11 : <}rustc_codegen_llvm, [ :: ()b70b0e52460f9a66>] unix ::{ closure # 0:: thread0x11}::, LlvmCodegenBackend:: ()1055ef7d0 as - : stdrustc_codegen_ssa [::b392610c019ec31b ]Thread ::::newtraits::0xthread_start::::>h8dda2af345bab446backend +:: ::{ ExtraBackendMethods12closure>: # ::1spawn_named_thread}< as syscore::rustc_codegen_ssa[unix18650a1770591c75:: thread]:: Thread:::: newops:: thread_start::::functionh8dda2af345bab446:: +FnOnce < 1055ef7d0()0x>1055ef7d0 - > - stdstd::::::call_oncesyssys::{::::shimunix:::unixthread::::vtableThreadthread::#new::::0thread_startThread::::h8dda2af345bab446new + ::}thread_start :: +h8dda2af345bab44612 + 11: 12: : 0x 1813c506c - __pthread_deallocate + 0x 1055ef7d00x - 1813c506cstd - ::__pthread_deallocatesys +::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + [ b392610c019ec31b ] :: back ::0xwrite1813c506c:: - spawn_work__pthread_deallocate< +rustc_codegen_llvm[b70b0e52460f9a66]::LlvmCodegenBackend>::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1055ef7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 12 : 0x 1813c506c - __pthread_deallocate + 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x1055ceda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10dd02208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1055e7528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x111e7d168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x111e7d0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x112416040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x111df69f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x111dedc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x111dedbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1124113c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10df80270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10df9d51c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x1055ef7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x1055ceda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10dd02208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1055e7528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x111e7d168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x111e7d0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x112416040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x111df69f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x111dedc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x111dedbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1124113c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10df79f48 - ::time::>::join::{closure#0}> + 11: 0x10df9f284 - >::join + 12: 0x10df8ed48 - ::join_codegen + 13: 0x10deaa64c - ::link + 14: 0x10dcef11c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10dd25628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10dcf7d7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x1055ef7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_26-12247.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_26-12247.txt new file mode 100644 index 00000000000..605d873bdf1 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_26-12247.txt @@ -0,0 +1,170 @@ +thread 'cpy vhs4c6sj2h4xpaq' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:thread '44cpy oxxcwsebgx1733i: +' panicked at no saved object file in work product/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs +stack backtrace: +:913:44: +no saved object file in work product +stack backtrace: +thread ' cpy 4orp8g2x23rgnt3a ' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs0:: 913 : thread '44 cpy k5jtp3uu1e1wr25 ' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs: +: no saved object file in work product +stack backtrace: +0x913100ca6da8: - 44std: +::no saved object file in work productbacktracethread '::cpy 4uzg6vrmxwsbl425Backtrace' panicked at :: +stack backtrace: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rscreate:::913h8af6f7a25d8a3749: +44 : + no saved object file in work product thread '1cpy sz32l9e0944h5s3: ' panicked at +stack backtrace: + /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs : 913 : 44 : +0x 1093da208no saved object file in work product - +stack backtrace: +0 : as 0:: 00x: Backtrace 100ca6da8: - ::std0 :: core : 0x 100ca6da8create - [ backtrace:: ::h8af6f7a25d8a3749 Backtrace + std 18650a1770591c75:: create]:: h8af6f7a25d8a3749 + 0x ::0x 100ca6da8100ca6da8 :: backtrace0x:: Backtrace1::100ca6da8 ops :: : - 0x - function - :: stdcreate Fn core::::::createh8af6f7a25d8a3749:: +h8af6f7a25d8a3749h8af6f7a25d8a3749 - +[< ::alloch8af6f7a25d8a3749[ +18650a1770591c75 + 37ddc2533ea56b7b 1]: 1]::0x 1093da208::1ops :: function: : 1 : - < 0x 1093da208alloc - boxed[::37ddc2533ea56b7b < alloc[ Fn 0x ::< Box0x]37ddc2533ea56b7b::( 0x 1093da2081093da208 ]0x1093da208< - rustc_driver_impl<& - 'boxedalloc[a - d723ad74a265baf3:: as [boxedinstall_ice_hook,::)<, ::Output::install_ice_hookinstall_ice_hookrustc_driver_impl::{[::install_ice_hookFn< = d723ad74a265baf3closure]#::0<::{install_ice_hook::{rustc_driver_impl::{(}()closure>closure&closure::{> + as dyn #closure#corecore0[#}18650a1770591c75#[for::0']>install_ice_hook as ::{aclosure0} as >core as core[#}::coreops[::18650a1770591c75function]::0, [}::>18650a1770591c75[']18650a1770591c75Fn>18650a1770591c75::]b]> ops:: as opsmarkercore[ as for > &18650a1770591c75]Fn]corecore[::]for opscoreops[Fn18650a1770591c75::panic]::::panic_info::::functionPanicInfoops)'PanicInfo>aa<>', , ::function'::bFnFn> > &function,::'Fn::core<[(callcore +[&18650a1770591c75) 18650a1770591c75 ]:::: (opsops::&::function'::, Fnafunction]2::: apanic:: :: panic_infoFn ::< (&'< 'aOutputPanicInfocorecore( a< [core18650a1770591c75[ '18650a1770591c75& = []() >0x + 100cbf528core[18650a1770591c75]coreb:: - >std,::)panic, panicking::Output::marker]'::apanic:: ::18650a1770591c75[Syncrust_panic_with_hook = :: + ]core()h1e70c5d905e30e9dpanic_info::core18650a1770591c75[panic]::::::[ +::>18650a1770591c7518650a1770591c75panic]:: + core]panic_info::panic_infomarker :::: Send:: , [&core::PanicInfoPanicInfo>18650a1770591c75[panic]::::panic_info18650a1770591c75: , 'marker::,PanicInfoPanicInfo<<]'')b::)b>panic , , :: panic_info::, ) >::OutputSyncPanicInfo, 0x)OutputOutputb = = >100cbf2e4> - = + ,,())(), >Output + )core, = >()>stdOutput::() + [core = panicking()18650a1770591c75[>> + :: + corecall>] + corecore +18650a1770591c75[ :: begin_panic_handler ::218650a1770591c75]]::{: core{markerclosure ::::}Sync}[[ 18650a1770591c75[::marker18650a1770591c75 + ] 18650a1770591c75::]] ::h399e32952efd26a4::marker +:: Sync marker marker core:::: + ::::core0xSend[100cbf528Sync18650a1770591c75, ] + &[ - Synccore18650a1770591c75 + ]core::[:: marker18650a1770591c75markercore4[]::::markerpanicSend, ::&[::stdSend: , :: &:: coreSyncpanicking + 18650a1770591c75[core 18650a1770591c75core][[::18650a1770591c75panic_infomarker]:::::: panicSend::rust_panic_with_hook]PanicInfo, ::&18650a1770591c75coremarker18650a1770591c75]][ ::)18650a1770591c75 panic_info ::0x]PanicInfo)::>>::100cbca18::panic - std::Sendmarker, ::>Send&, ::&core::[call::h1e70c5d905e30e9dpanic:: +>:: panic_info :: ::18650a1770591c75panic_info3sys_common]:: +callcorePanicInfo ) > [218650a1770591c75backtrace +::: >:: __rust_end_short_backtracePanicInfo ):: :: paniccall>]> +::: :: ::h2ab87f841a2323e7 2 +panic panic_info :: panic_info:::: PanicInfo ) call 2 : : > >:: PanicInfo ) > > 5 ::: 0xcall + + :: 100cbf2e4call 2 - std +2:: panicking0x ::: begin_panic_handler ::0x 0x : { { 100cbf528100cbf528100cbf528 0x 100cbf06c - closure - } _rust_begin_unwind 0x0x +100cbf528 - - stdstd::2panicking::::panickingrust_panic_with_hook::::rust_panic_with_hookstd - }std: h1e70c5d905e30e9d::::100cbf528 :: panicking - ::h1e70c5d905e30e9dstd +:: panicking :: 6 : 3 : :: panickingrust_panic_with_hook :: h1e70c5d905e30e9d:: + + rust_panic_with_hook :: 33h399e32952efd26a4rust_panic_with_hook: h1e70c5d905e30e9d: + 3 : + 0x 100cbf2e4 - 4:: std : 0x:: 100cbf2e4panicking - ::stdbegin_panic_handler:: panicking0x:: 0x 100d18bd0{ - h1e70c5d905e30e9d0x +100cbca18 {100cbf2e4 core 0xclosure - } - ::::}std ::0xh399e32952efd26a4100cbf2e4 +:: - 100cbf528panicking begin_panic_handler - :: {4stdpanicking: :: 3 ::std :: panickingbegin_panic_handler ::sys_commonstd{::{::panickingclosure{::backtracebegin_panic_handler::::__rust_end_short_backtrace:: ::{closurepanic_fmt ::::}0xh2ab87f841a2323e7h33e40d2a93cab78f100cbca18 + - : }std}::::} { ::sys_common ::7backtrace: h399e32952efd26a4 rust_panic_with_hookclosure +:::: h1e70c5d905e30e9d} __rust_end_short_backtrace h399e32952efd26a4 +5 :: } ::4h399e32952efd26a4: + + +h2ab87f841a2323e7: + 0x 4 0x 5 : 3 : 0x 4 : 100d18b9c 100cbca18100cbf2e4 - : 0x 100cbf06c - std - :: std - ::0xcore100cbca18sys_common::::optionbacktrace::::expect_failed__rust_end_short_backtracepanicking:: - std :: sys_commonh8c59d9d921ed21360x:: +100cbf06cbacktrace - ::::0xh2ab87f841a2323e7__rust_end_short_backtrace100cbf2e4:: - h2ab87f841a2323e7std +::0x panicking + :: begin_panic_handler:: ::_rust_begin_unwind begin_panic_handler _rust_begin_unwind8{: { + closure } } 5::100cbca18: :: 6 + : 5{: { - std :: sys_common :: closure 0xh399e32952efd26a4}100cbf06c} - ::_rust_begin_unwindh399e32952efd26a4 + + 6 backtrace : :: __rust_end_short_backtrace 40x: 100d18bd0 +0x::100cbf06ch2ab87f841a2323e7 - +_rust_begin_unwind +0x 1096743ec - rustc_codegen_ssa6[: b392610c019ec31b ] :: back :: 0xwrite100d18bd0:: - execute_copy_from_cache_work_itemcore :: panicking :: panic_fmt :: h33e40d2a93cab78f0x +100d18bd05 - core :: panicking :: panic_fmt :: h33e40d2a93cab78f - ::core +<:: 4panicking6::: panic_fmt :: h33e40d2a93cab78f + : rustc_codegen_llvm0x [100d18bd0 b70b0e52460f9a66 - : core]::::panickingLlvmCodegenBackend:: > +panic_fmt 7 9 0x: 100cbca18 - 7std : : :: sys_common 7:: h33e40d2a93cab78f:: backtrace :: 0x: 100cbca18 0x - 100d18b9cstd - ::coresys_common:: +option :: expect_failed0x::100d18b9ch8c59d9d921ed2136 - +core :: option :: expect_failed :: h8c59d9d921ed2136 __rust_end_short_backtrace:: + 0x 100cbf06c8 - : _rust_begin_unwind + backtrace ::6__rust_end_short_backtrace: :: 7:: h2ab87f841a2323e7: + 0x5100d18bd0 - core8 0x: :: 0x 100d18b9c - panicking109656508core:: :: - optionstd::[expect_failedfcd23fca98dce159]panic_fmt ::::sys_commonh8c59d9d921ed2136:: +backtrace ::h2ab87f841a2323e7__rust_begin_short_backtrace :: +< < rustc_codegen_llvm [ 0xb70b0e52460f9a665]: :: 100d18b9c LlvmCodegenBackend8 as : rustc_codegen_ssa - [ b392610c019ec31b ]0x 1096743ec:: - traits rustc_codegen_ssa::[backendb392610c019ec31b::]ExtraBackendMethods::>core :: ::spawn_named_threadoption< ::rustc_codegen_ssa0xexpect_failed[::b392610c019ec31b100cbf06ch8c59d9d921ed2136] +:: - back _rust_begin_unwind:: +write8 : :: spawn_work < rustc_codegen_llvm: 6 : 0x 0x0x100cbf06c100d18bd0 - - _rust_begin_unwindcore0x +::1096743ecpanicking - ::1096743ecrustc_codegen_ssapanic_fmt[::b392610c019ec31bh33e40d2a93cab78f] +:: - back :: write7::: rustc_codegen_ssa execute_copy_from_cache_work_item[ b392610c019ec31b :: < ] :: back0x::100d18b9cwrite6 - ::coreexecute_copy_from_cache_work_item::::option<::rustc_codegen_llvm: rustc_codegen_llvm[expect_failed[:: b70b0e52460f9a66h8c59d9d921ed2136] + :: b70b0e52460f9a66 ]8 ::: LlvmCodegenBackend > + 9 : 0x 1096743ec - rustc_codegen_ssa [::0xb392610c019ec31b100d18bd0h33e40d2a93cab78f] - ::coreback:::: +panickingwrite :::: panic_fmtexecute_copy_from_cache_work_item ::::<7h33e40d2a93cab78frustc_codegen_llvm: +[ b70b0e52460f9a66 ] 7::: LlvmCodegenBackend > + 9 : 0x 100d18b9c0x - core :: option 100d18b9c:: - expect_failedcore ::::h8c59d9d921ed21360xoption +::109656508 expect_failed :: h8c59d9d921ed21368 +: [ - std [8fcd23fca98dce159: ] :: LlvmCodegenBackend sys_commonb70b0e52460f9a66 :: ]backtrace :: __rust_begin_short_backtraceback::::LlvmCodegenBackend::>< < 0x rustc_codegen_llvm [ 1096743ecwrite - 0xb70b0e52460f9a66 ]> :: + execute_copy_from_cache_work_item :: ::{ +rustc_codegen_ssa [:: traits b392610c019ec31b - :: ] b70b0e52460f9a660x]::backend109656508:: rustc_codegen_ssa, ExtraBackendMethods ()>[>::::{spawn_named_threadb392610c019ec31b<::9rustc_codegen_ssaLlvmCodegenBackend: backclosure[::b392610c019ec31bwrite]::::execute_copy_from_cache_work_itemback>]::std:: - backstd::#backtrace +b70b0e52460f9a66 :: 90x]109656508write - ::: LlvmCodegenBackendstd>[ +fcd23fca98dce1590 +]:: :: }sys_common ::9backtrace: :: , () > +spawn_worksys_common :: backtrace ::9 :: __rust_begin_short_backtrace 0x:: < 109656508<__rust_begin_short_backtracerustc_codegen_llvm - __rust_begin_short_backtrace[::b70b0e52460f9a66<]<::::LlvmCodegenBackend< as rustc_codegen_llvmrustc_codegen_ssa[[rustc_codegen_llvmb70b0e52460f9a66<] :: LlvmCodegenBackend10b392610c019ec31b>: std< rustc_codegen_llvm[::{[ b70b0e52460f9a66fcd23fca98dce159: ]closure :: LlvmCodegenBackend as # 0 } ][:: sys_commonb70b0e52460f9a66, 0x()109656508> - ::]std::{::[closurefcd23fca98dce159# backtrace0::}__rust_begin_short_backtrace, ::()LlvmCodegenBackend]>0x:: +109656508traits - std as [ rustc_codegen_ssafcd23fca98dce159[10]: b392610c019ec31b:: ] backend :: ExtraBackendMethods > ::rustc_codegen_ssa :: [spawn_named_thread <0xb392610c019ec31b109675244]traits - ::[::fcd23fca98dce159std::[fcd23fca98dce159[]]::::backspawn_named_threadthread::::writeBuilder::>traits::{::closurebackend::::#ExtraBackendMethods0>}::, <()rustc_codegen_llvm>]::{::[back::closurerustc_codegen_llvm#[0b70b0e52460f9a66}]b70b0e52460f9a66, traits()::>backend +::spawn_named_thread ExtraBackendMethods >10::]rustc_codegen_ssaBuilder: [ b392610c019ec31b ] :: < rustc_codegen_ssa [ b392610c019ec31b0xwrite]109675244:: - back<::>::writeLlvmCodegenBackend:: as spawn_work::]<::{]rustc_codegen_llvmclosure[#b70b0e52460f9a660LlvmCodegenBackend]::::>::LlvmCodegenBackendLlvmCodegenBackend>::{rustc_codegen_ssa:: as LlvmCodegenBackendclosurerustc_codegen_ssa>[#::{b392610c019ec31b[[]b392610c019ec31b::]traitsfcd23fca98dce1590::::]}traitsbackend::::backendExtraBackendMethods::>ExtraBackendMethods::>, ::()spawn_named_thread>, #()::0spawn_named_thread>}::{::, closure()#>0<::::{writeclosure::}spawn_work::{#<0rustc_codegen_llvm}[, closureb70b0e52460f9a66()spawn_named_thread, >() +>< + # 100rustc_codegen_ssa , 10[(): > : } , ()>>b392610c019ec31b + ] :: spawn_unchecked_10::: < < rustc_codegen_llvm [ b70b0e52460f9a66 ] :: LlvmCodegenBackend0x109675244] - back< < std [ as ::{::::closurewrite#::0spawn_work}rustc_codegen_ssafcd23fca98dce159, ]()LlvmCodegenBackend>:: +>thread :: Builder10>: ::[ spawn_unchecked_b392610c019ec31b::{ < < rustc_codegen_llvm [ closure #0x0109675244} - , <]()<::std [ >fcd23fca98dce159 ]0x::{back::::closurethreadwrite#::::spawn_workBuilder<>rustc_codegen_llvm::[spawn_unchecked_rustc_codegen_ssab70b0e52460f9a660x0]109675244[:: - LlvmCodegenBackend<><}::{stdclosure[b392610c019ec31bfcd23fca98dce159, ]]::::()traitsthread::::backendBuilder<::><::ExtraBackendMethodsrustc_codegen_llvmspawn_unchecked_>[::[::fcd23fca98dce159LlvmCodegenBackend]>::::{#closurethread#::0Builder}>]::<::{rustc_codegen_llvmclosure[#, 1b70b0e52460f9a66::}] as ::coreLlvmCodegenBackend[ as 18650a1770591c75writerustc_codegen_ssa]LlvmCodegenBackend[::b392610c019ec31bops]:: as ::::traitsspawn_work::backend::]::::spawn_named_thread}traits<::rustc_codegen_ssabackend[spawn_unchecked_>b392610c019ec31b::{]closure::#, 0back}<::, write()::><::{spawn_workclosure<#rustc_codegen_llvm[[rustc_codegen_llvmfunction[::b70b0e52460f9a66FnOnceb70b0e52460f9a66]b70b0e52460f9a66::ExtraBackendMethods>>::::call_oncespawn_named_thread::{()>0::}:: +backspawn_named_thread:: write ::{1::11spawn_work: LlvmCodegenBackend::[LlvmCodegenBackend>>18650a1770591c75 ::{]::{ closure # 0 closureLlvmCodegenBackend< ::rustc_codegen_ssa0x[100cc77d0ops - #b392610c019ec31b0 as }], rustc_codegen_ssa()}, >, ::{()closure>#::{0::}closure, ()()#>std0::}sys, ::()>unix[::{b392610c019ec31bclosure]#::0traits::::>function::{::}closureFnOnce#<1()}>threadback, as ()core>[::{::closure18650a1770591c75#]0::}backendops::::writefunction::::spawn_workFnOnce< +::rustc_codegen_llvmThread[::b70b0e52460f9a66new]::::ExtraBackendMethods::{LlvmCodegenBackend>>::::{closure closure #100#, <>()::>call_once>::{::shim1: : vtable # call_once0()::{} > as core [::{ 18650a1770591c75::shim]thread_start:::opsspawn_named_thread::::vtablefunctionclosure::##FnOnce1<}0rustc_codegen_ssa as [}core +h8dda2af345bab446 + [110x: 109675244} - < +<}(), >()>>::b392610c019ec31b ]call_once<11std: [ ::{18650a1770591c75 fcd23fca98dce159 shim:: back :: write ] :0x::100cc77d0vtable - #stdspawn_work0::<12sys: rustc_codegen_llvm ::{::closure unix :: thread ::] Thread ::0xnew100cc77d0::::#::0opsthread}::::, functionBuilder}[ +> :: b70b0e52460f9a66spawn_unchecked_::<11<: rustc_codegen_llvmFnOnce[ b70b0e52460f9a66<]]::::()LlvmCodegenBackendthread_start as ::rustc_codegen_ssah8dda2af345bab446[LlvmCodegenBackend + 0x121813c506c> - - std__pthread_deallocate:: +sys ::::{ unixclosure:: thread#:: Thread0 ::}0xnew, ::100cc77d0thread_start()::> - h8dda2af345bab446::{std +closure # ::120sys}: , ::() unix >:: thread ::{ :: closureThread0x#::1813c506c1new - }::__pthread_deallocate as +thread_startcore::[h8dda2af345bab44618650a1770591c75 +] :: ops12::: function :: FnOnce < () > > ::0xcall_once1813c506c::{ - shim__pthread_deallocate: +vtable#0} + 11: 0x100cc77d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +()>>>::{::closurecall_once#::{1shim}:vtable#0} + 11: 0x100cc77d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x100cc77d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +b392610c019ec31b]::traits::backend::ExtraBackendMethods>::: spawn_named_thread < rustc_codegen_ssa [ b392610c019ec31b ] :: back0x::1813c506cwrite - ::__pthread_deallocatespawn_work +::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x100cc77d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinthread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x100ca6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x1093da208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x100cbf528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10d555168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10d5550ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x10daee040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10d4ce9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10d4c5c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10d4c5be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x10dae93c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x109658270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10967551c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x100cc77d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x100ca6da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x1093da208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x100cbf528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10d555168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10d5550ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x10daee040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10d4ce9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10d4c5c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10d4c5be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x10dae93c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x109651f48 - ::time::>::join::{closure#0}> + 11: 0x109677284 - >::join + 12: 0x109666d48 - ::join_codegen + 13: 0x10958264c - ::link + 14: 0x1093c711c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x1093fd628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x1093cfd7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x100cc77d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_28-12710.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_28-12710.txt new file mode 100644 index 00000000000..943139e3f9e --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_28-12710.txt @@ -0,0 +1,170 @@ +thread 'cpy oxxcwsebgx1733i' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: +thread 'cpy ebti8ycrnjshmsw' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: + thread '0cpy 5fuhladjlcxb67o9: ' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs : 913 : 44 : + no saved object file in work product0x +stack backtrace: +thread 'cpy 4orp8g2x23rgnt3a' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44thread ': +cpy k5jtp3uu1e1wr25no saved object file in work product' panicked at +stack backtrace: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs1036aeda8: - 913std:::44backtrace: +::Backtraceno saved object file in work productthread '::cpy 4uzg6vrmxwsbl425thread '' panicked at cpy sz32l9e0944h5s3 +stack backtrace: +' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs::913create:91344: : +44no saved object file in work product: + +stack backtrace: + ::no saved object file in work producth8af6f7a25d8a3749 +0 +stack backtrace: + : thread ' cpy vhs4c6sj2h4xpaq1' panicked at : /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs : 913 :44 : + no saved object file in work product 0 +stack backtrace: + 0 : : 0x 10bde2208 - <0x alloc 0 : [ 37ddc2533ea56b7b1036aeda8 ] - std 0::0x0x :: boxed1036aeda80 - : backtrace 1036aeda8 : 0x::1036aeda8Backtrace 0:: - : std std:: :::: Boxcreatebacktracebacktrace - std :: backtrace<::rustc_driver_impl [0xd723ad74a265baf3::1036aeda8::Backtrace - Backtrace ::Backtrace:: :: ] create ::::h8af6f7a25d8a3749create:: +stdcreate0xh8af6f7a25d8a3749h8af6f7a25d8a37490x 1036aeda8:: +1036aeda8 +:: backtrace - ::Backtrace - install_ice_hook ::{ closure #10:: }h8af6f7a25d8a3749 1>: :: +std std : as core 1create: :: h8af6f7a25d8a3749 + [ :: 18650a1770591c75backtrace:::: ]backtrace1Backtrace: :: ::0x 1opsBacktrace:::::: 10bde2208 : functioncreate::::Fnh8af6f7a25d8a3749< +( & dyn for< ' 1 create a0x, - :: : <' h8af6f7a25d8a3749 b0x > 0x +10bde2208 alloc 1 - 10bde2208< - alloc[10bde2208core[ - : <[alloc18650a1770591c75[ 37ddc2533ea56b7b37ddc2533ea56b7b< ]alloc][ 37ddc2533ea56b7b37ddc2533ea56b7b:::: ops:: ]]0x::]boxed::0xboxed10bde2208::function::::Box::boxedBox10bde2208boxed - - Fn<::Box >[::closure::{#closured723ad74a265baf3b[::0[ as install_ice_hook as >}core::{d723ad74a265baf3core0[>,18650a1770591c75[18650a1770591c75) as closurecore]18650a1770591c75], ::[Output]ops::#}::>ops18650a1770591c750::ops} as >] as core::[ = install_ice_hookcore::::{function[closurefunction#()18650a1770591c75::]18650a1770591c75]::0::::>function:::: + FnopsopsFn<]::<(::}(Fn>&< as corecore[ops18650a1770591c75function]dyn [(18650a1770591c75&::&for<::dyn ::::functionFn]dyn ::'::amarkerfor< > dyn bbfor core''> &coredyn core[corea18650a1770591c75, ][::[b'18650a1770591c75core[for 'ba[> 18650a1770591c75, ]::core18650a1770591c75[]'function18650a1770591c75b::> corecore::::18650a1770591c75ops]::]function::[ops[marker18650a1770591c75]Fn::]ops::::::functionFn::function::18650a1770591c75ops::::panic>::PanicInfo'::::PanicInfoPanicInfo<<''panic,::)panic_info, ::OutputPanicInfo = <()b'ab >core,[)18650a1770591c75, 'Output]b = ::()>>panic, + ::)::::call> +PanicInfo < + core2': [ b 18650a1770591c75 > ] :: , marker)0x::1036c7528, - SyncstdOutput:: = + panicking()::core>rust_panic_with_hook[:: + h1e70c5d905e30e9d18650a1770591c75 +core ] [ ::3marker: :: Send 18650a1770591c75 , ] & core ::[0xmarker1036c72e418650a1770591c75 - ::std]Sync:::: + panickingpanic::corebegin_panic_handler::::[{panic_info{18650a1770591c75closure]}::}PanicInfo::::h399e32952efd26a4) +marker> :: >Send ::4, : call & + core [ 18650a1770591c75 0x]1036c4a18 - ::stdpanic2::::sys_common: >::,backtrace) corepanic_info[::18650a1770591c75PanicInfo::, panic_info]Output:: = marker()::__rust_end_short_backtraceSync::>PanicInfo + h2ab87f841a2323e7, +panic_info, + Outputcore = [):: 18650a1770591c75PanicInfo() )]18650a1770591c75 ::::OutputSync> + core [ 18650a1770591c75]]>:::: callmarker +::5 ': 0xSend , 1036c7528& core - [ 18650a1770591c75std] ::::panicpanicking::::panic_inforust_panic_with_hook:::: h1e70c5d905e30e9d + 0x 1036c706c - 3_rust_begin_unwind: + 6 : 0x 1036c72e4 - std :: panicking0x::103720bd0begin_panic_handler - ::core{::{panickingclosure::}panic_fmt}::::h33e40d2a93cab78fh399e32952efd26a4 + + 74: : 0x0x103720b9c1036c4a18 - - corestd::::optionsys_common::::expect_failedbacktrace::::h8c59d9d921ed2136__rust_end_short_backtrace +:: h2ab87f841a2323e7 + 8 : 5 : 0x 10c07c3ec - 0xrustc_codegen_ssa1036c706c[ - b392610c019ec31b_rust_begin_unwind] +:: back :: write6::: execute_copy_from_cache_work_item :: < rustc_codegen_llvm [ b70b0e52460f9a66 ] ::0xLlvmCodegenBackend103720bd0> - +core :: panicking ::9panic_fmt: :: h33e40d2a93cab78f + 7 : 0x 10c05e508 - std [ fcd23fca98dce159 ] ::0xsys_common103720b9c:: - backtracecore::::__rust_begin_short_backtraceoption::::rustc_codegen_ssa::[spawn_named_threadb392610c019ec31b<]rustc_codegen_ssa::[backb392610c019ec31b::]write::::backexecute_copy_from_cache_work_item::::write<::rustc_codegen_llvmspawn_work[:: +LlvmCodegenBackend > ::{ closure9#: 0 } , () > ::{ closure #0x010c05e508} - , std()[>fcd23fca98dce159 +] :: sys_common10::: backtrace :: __rust_begin_short_backtrace :: < < rustc_codegen_llvm [0xb70b0e52460f9a6610c07d244] - ::::::ExtraBackendMethodsspawn_unchecked_><::rustc_codegen_ssa>[::b392610c019ec31bcall] + :: +traits :: = backend ]core2()[::: 18650a1770591c75 ] :: marker>::backSync:: + writecore::[spawn_work::b + > core18650a1770591c75: [0x::{::[]closureOutput18650a1770591c75# ExtraBackendMethods1036c7528::> - 0std}::18650a1770591c75 panicking]:::: = spawn_named_thread()<>rustc_codegen_ssa + , marker::rust_panic_with_hook][:: core::panic::h1e70c5d905e30e9dmarker [:: ()Sendpanic_info +:::: b392610c019ec31b, ]&18650a1770591c75 core>[0x18650a1770591c751036c7528] - ::stdSyncPanicInfo:: + ) >] >::3::: callcore + [ 18650a1770591c75 marker ::{ backpanic]closure::::::#marker2::0Send}panicking: 0x :: Sync1036c72e4, :: () panic_info, :: + &rust_panic_with_hookcore - >::[write +std::corePanicInfo 18650a1770591c75[ )h1e70c5d905e30e9d::]>spawn_work><0xrustc_codegen_llvm::call10 +[:: panicking b70b0e52460f9a66] ::18650a1770591c75::]marker3: ::1036c7528:: begin_panic_handler : panic :::: + ::LlvmCodegenBackend panic_info{ - std :: panicking{::closurerust_panic_with_hook>::Sendh1e70c5d905e30e9d::, + } PanicInfo &::{ )closure 0xcore> } [ 0x18650a1770591c7510c07d244]2 - ::1036c72e4< - <::stdstd[h399e32952efd26a4fcd23fca98dce159::] +:: threadpanicking::::Builder #panic0begin_panic_handler >::}: panic_info3::>, ::spawn_unchecked_():: PanicInfo<4<::rustc_codegen_llvm {>)::{: : > 0x {1036c7528 - closure std>call[ +:: #call + :: panickingclosure20}: 0x::} ::}b70b0e52460f9a66 1036c4a18h399e32952efd26a4rust_panic_with_hook - +:: h1e70c5d905e30e9d, std :: sys_common +2]4() ::: 0x1036c72e4 - >::: backtrace::{LlvmCodegenBackend::closure# 1std __rust_end_short_backtrace :: as h2ab87f841a2323e7} +3 :: panicking as rustc_codegen_ssa: core:: begin_panic_handler[5 :: : 0x [ 0x18650a1770591c75 b392610c019ec31b {1036c75281036c4a18{]] ::::ops ::traits - function:: std ::::backendclosure - panicking } ::0x::rust_panic_with_hook1036c706cExtraBackendMethods - ::FnOnceh1e70c5d905e30e9d< +() > >0x >std ::::1036c7528spawn_named_threadsys_common<::::_rust_begin_unwind +0x}1036c72e4backtrace3:: - ::rustc_codegen_ssa__rust_end_short_backtrace[ ::b392610c019ec31bh2ab87f841a2323e7 - call_oncestd::{ +shim::: vtablepanicking# 0::} +begin_panic_handler 5 ::11: : h399e32952efd26a4] : std::::back +{panicking { ::::writerust_panic_with_hook :: :: closure 6h1e70c5d905e30e9d: +4 : spawn_work } <0x 1036c706c0x - 1036cf7d0_rust_begin_unwind - + rustc_codegen_llvm [ b70b0e52460f9a66 ]6:: LlvmCodegenBackend: > ::{ closure# std 3} : 0 } , ()0x>1036c72e4 0x - 1036c72e4std - ::stdpanicking::::panickingbegin_panic_handler::::begin_panic_handler{::::{ { {0xclosure103720bd0} - }core::closure::h399e32952efd26a4panicking +:: panic_fmt :: ::#40: }sys , () > ::{ closure ::#unix1 }:: as threadcore::[Thread18650a1770591c75::]new::::opsthread_start::::::h8dda2af345bab446h399e32952efd26a4 + + { closure4}: } :: h399e32952efd26a4 + 40x120x1036c4a181036c4a18: - - h33e40d2a93cab78fstd +:: sys_common :: backtracefunction :: __rust_end_short_backtrace :: 0xh2ab87f841a2323e7:: + FnOnce < std()1036c4a18 > - >std::: call_once::{shim0x:: 57 ::: sys_common :: backtrace :: __rust_end_short_backtrace: :: h2ab87f841a2323e7 + 5 : 0x 1036c706c - _rust_begin_unwind + 0x61036c706c: - _rust_begin_unwind + 6 : 0x 103720bd0 - core :: panicking :: panic_fmt0x::103720bd0h33e40d2a93cab78f - +core :: panicking ::7panic_fmt: :: h33e40d2a93cab78f + 7 : 0x 103720b9c - core :: option :: expect_failed0x::103720b9ch8c59d9d921ed2136 - +core :: option ::8expect_failed: :: h8c59d9d921ed2136 + :8 : vtable0x 10c07c3ec - rustc_codegen_ssa#[0 } + 103720bd0 b392610c019ec31b - 11coresys_common]::::::panicking backtraceback::: panic_fmt ::::::write :: 0x __rust_end_short_backtraceh33e40d2a93cab78f +::1813c506c - h2ab87f841a2323e7execute_copy_from_cache_work_item0x:: 10c07c3ec< - rustc_codegen_ssa [rustc_codegen_llvmb392610c019ec31b[]::__pthread_deallocateb70b0e52460f9a66back]::::write :: +execute_copy_from_cache_work_item 0x +103720b9c LlvmCodegenBackend >:: <75 + - : : core rustc_codegen_llvm [ b70b0e52460f9a66 ] 0x 0x1036c4a18 1036cf7d0 - - stdstd::::sys_common::backtrace:: __rust_end_short_backtrace9::sys: h2ab87f841a2323e7 + :: :: option::5 unix: 0x LlvmCodegenBackend > 0x +103720b9c - :: expect_failedcore:: h8c59d9d921ed213690x +: ::1036c706c option :: - expect_failed :: h8c59d9d921ed21368::: _rust_begin_unwind + + thread::Thread80x: 10c05e5081036c706c - :: - new std::[thread_startfcd23fca98dce159::]::sys_commonh8dda2af345bab446 + 0x1210c05e508 - std [ fcd23fca98dce159 ] :: sys_common ::0xbacktrace10c07c3ec:: - __rust_begin_short_backtracerustc_codegen_ssa::[option +:: expect_failed 9 : 0x 103720bd0 - core ::0xpanicking10c05e508:: - panic_fmtstd[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{::closureh33e40d2a93cab78f#0::b70b0e52460f9a66:: +}]h8c59d9d921ed2136, :: +backend :: ExtraBackendMethods>:: ()8>: ::{ closure # 0 0x10c07c3ec - rustc_codegen_ssa[b392610c019ec31b]::back::write::execute_copy_from_cache_work_item::::[ +b70b0e52460f9a66] :: LlvmCodegenBackend >9 +: 9 : backend :: ExtraBackendMethods >0x 0x10c05e508 10c05e508 - - stdstd[[fcd23fca98dce159spawn_named_thread]fcd23fca98dce159::::]sys_common< }rustc_codegen_ssaspawn_named_thread, [b392610c019ec31b7()]: ::] +::LlvmCodegenBackend > ::{10closure: # 0 } , () > ::{ closure0x#10c07d2440 - }<, <()std>[ +fcd23fca98dce159 ] ::10thread: :: Builder > :: spawn_unchecked_ < < rustc_codegen_llvm0x[10c07d244b70b0e52460f9a66 - ]<::sys_common::::spawn_unchecked_backtrace<::<__rust_begin_short_backtracebacktrace:: ExtraBackendMethods]>::::::spawn_named_threadspawn_named_threadLlvmCodegenBackend<rustc_codegen_ssa[::{b392610c019ec31bclosure][::#backb392610c019ec31b::0write]::}spawn_work::<, rustc_codegen_llvmback[::b70b0e52460f9a66()]write::>LlvmCodegenBackend::>::{::{spawn_workclosureclosure#<0#}rustc_codegen_llvm, 0()[>}::{b70b0e52460f9a66closure, #()0]}::, >()LlvmCodegenBackend +>> + ::{ closure 10#: 0 10} : , () 0x>10c07d244 - ::{< closure< std [#0xfcd23fca98dce1590]10c07d244::}thread - ::, Builder<>()::<::{traits18650a1770591c75::::backend]::spawn_unchecked_ExtraBackendMethods::><::opsspawn_named_thread<<::rustc_codegen_ssarustc_codegen_llvm[functionb392610c019ec31b[]::::b70b0e52460f9a66backFnOnce::]write<::()spawn_work::<>rustc_codegen_llvmLlvmCodegenBackend[>b70b0e52460f9a66 as ::]rustc_codegen_ssa::call_onceLlvmCodegenBackend[>b392610c019ec31b::{::{closure]#shim0::}:, traits()vtable>::::{#closurebackend#0::0ExtraBackendMethods}}, >() +> ::{::closure #spawn_named_thread1<}rustc_codegen_ssa as corerustc_codegen_llvm[11b392610c019ec31b[]: ::b70b0e52460f9a66back ::]write:::: spawn_workLlvmCodegenBackend< rustc_codegen_llvm as [rustc_codegen_ssab70b0e52460f9a66[]b392610c019ec31b::]LlvmCodegenBackend >::::{ closuretraits# 0::} , backend()0x>::::{1036cf7d0closureExtraBackendMethods# - 0std}::, sys()>>::::{spawn_named_threadclosure__rust_begin_short_backtrace#<1::}rustc_codegen_ssa as LlvmCodegenBackend>write:: as call_once::::{rustc_codegen_ssashimspawn_work:[vtable<#b392610c019ec31b0rustc_codegen_llvm}] +[ :: b70b0e52460f9a6611traits: ] :: :: LlvmCodegenBackend backend :: > ExtraBackendMethods0x>1036cf7d0:: - spawn_named_threadstd<::::{sysrustc_codegen_ssa::closureunix[::#threadb392610c019ec31b::0Thread]::}new::::backthread_start::::h8dda2af345bab446, +write :: ()12spawn_work: > < ::{ rustc_codegen_llvm closure [ # b70b0e52460f9a660x01813c506c] - }__pthread_deallocate:: +, LlvmCodegenBackend()>>::{::{closureclosure##01}}, as ()core>[::{18650a1770591c75closure]#::0ops}::, function()::>FnOnce +< () >10>: :: call_once ::{ shim : vtable # 00x}10c07d244 + - < <11std: [ fcd23fca98dce159 ] :: thread :: Builder >0x::1036cf7d0spawn_unchecked_ - :: spawn_named_thread <0xrustc_codegen_ssa10c07c3ec[ - b392610c019ec31brustc_codegen_ssa][::b392610c019ec31bback]::::writeback::::spawn_workwrite<::rustc_codegen_llvmexecute_copy_from_cache_work_item[::b70b0e52460f9a66<]rustc_codegen_llvm::[LlvmCodegenBackendb70b0e52460f9a66>]::{::closureLlvmCodegenBackend#>0 +} , () >9::{: closure # 0 } , () > ::{0x[10c05e508closure - #std1[} as fcd23fca98dce159::]18650a1770591c75::unix]sys_common:::: + +rustc version: backtrace1.76.0 (07dca489a 2024-02-04):: +platform: __rust_begin_short_backtrace::aarch64-apple-darwin<<::rustc_codegen_llvmthread[::b70b0e52460f9a66Thread]::::unixnew::::threadthread_start::::Threadh8dda2af345bab446:: +new :: thread_start12::: h8dda2af345bab446 + 12 : 0x 1813c506c - __pthread_deallocate + 0x1813c506c - __pthread_deallocate +core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1036cf7d0 - std::sys::unix::thread::::Threadops::::newfunction::::thread_startFnOnce:: > ::12call_once: ::{ shim : vtable # 0 } +0x 1813c506c - 11__pthread_deallocate: +LlvmCodegenBackend as 0x1036cf7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +thread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:rustc_codegen_ssa26[: +b392610c019ec31b/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked] +stack backtrace: +::traits::backend::ExtraBackendMethods>::spawn_named_thread::{closure#0}, ()>::{closure#0}, ()> + 10: 0x10c07d244 - < :: spawn_unchecked_ < < rustc_codegen_llvm0x[1036aeda8b70b0e52460f9a66 - ]std::::LlvmCodegenBackendbacktrace as ::rustc_codegen_ssaBacktrace[::b392610c019ec31bcreate]::::h8af6f7a25d8a3749traits +:: backend :: ExtraBackendMethods1>: :: spawn_named_thread < rustc_codegen_ssa [ b392610c019ec31b ] ::0xback10bde2208:: - write<::allocspawn_work[<37ddc2533ea56b7brustc_codegen_llvm]::[b70b0e52460f9a66]::LlvmCodegenBackend>::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1036cf7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +boxed::Box as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1036c7528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10ff5d168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10ff5d0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x1104f6040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10fed69f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10fecdc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10fecdbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1104f13c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c060270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10c07d51c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x1036cf7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x1036aeda8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10bde2208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1036c7528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10ff5d168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10ff5d0ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x1104f6040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10fed69f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10fecdc14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10fecdbe0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1104f13c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c059f48 - ::time::>::join::{closure#0}> + 11: 0x10c07f284 - >::join + 12: 0x10c06ed48 - ::join_codegen + 13: 0x10bf8a64c - ::link + 14: 0x10bdcf11c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10be05628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10bdd7d7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x1036cf7d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_29-12958.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_29-12958.txt new file mode 100644 index 00000000000..e7cfeca5673 --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_29-12958.txt @@ -0,0 +1,170 @@ +thread 'cpy sz32l9e0944h5s3' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:thread '913cpy oxxcwsebgx1733i:' panicked at 44/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs: +:no saved object file in work product913 +stack backtrace: +:44: +no saved object file in work product +stack backtrace: +thread 'cpy vhs4c6sj2h4xpaq' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +thread 'no saved object file in work productcpy 5fuhladjlcxb67o9 +stack backtrace: +' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: +thread 'cpy 4orp8g2x23rgnt3a' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44thread ': +cpy k5jtp3uu1e1wr25no saved object file in work product' panicked at +stack backtrace: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: +thread 'cpy 4uzg6vrmxwsbl425' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:thread '44cpy ebti8ycrnjshmsw: +' panicked at no saved object file in work product/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs +stack backtrace: +:913:44: +no saved object file in work product +stack backtrace: + 0: 00x: 103992da8 - std :: backtrace :: Backtrace ::0xcreate103992da8 :: - h8af6f7a25d8a3749 std0 +:: backtrace : 0::: 1 : Backtrace :: create :: h8af6f7a25d8a3749 + 0x 103992da8 - 0xstd0 : 0x 10c0c62080 10 : - <:: backtrace0::: : : 103992da8 - alloc [ 37ddc2533ea56b7bstd ] :: Backtrace boxed ::0xbacktrace103992da80x 103992da8 - :: - :: stdBox 0x<::103992da8 :: backtrace Backtrace createrustc_driver_impl - std::::createbacktrace::std:: ::h8af6f7a25d8a3749Backtrace::0xBacktrace +::[::d723ad74a265baf3backtrace]:: 103992da8h8af6f7a25d8a3749 create +0x :: - std ::Backtrace110c0c6208:: h8af6f7a25d8a3749::1install_ice_hook +: - : backtracecreate :: h8af6f7a25d8a3749::{ as +alloccore0x < [1 [ : 18650a1770591c75 ]10c0c6208:: 10c0c6208 - <1alloc: - 37ddc2533ea56b7b < alloc[[rustc_driver_impl37ddc2533ea56b7b[opsd723ad74a265baf3 37ddc2533ea56b7b]]:: boxed::::]0x :::: boxed]functionBox::< as rustc_driver_impl<[ d723ad74a265baf3]install_ice_hook[37ddc2533ea56b7b alloc]0x(10c0c6208&core[dyn ::{forBox as , ::coreops[::<18650a1770591c75][::::'rustc_driver_impl#functioninstall_ice_hook37ddc2533ea56b7b::::{0[Fnbd723ad74a265baf3> ]install_ice_hook'::{aclosure::, 0'>b18650a1770591c75Box#<} as ]Fn::coreops[::18650a1770591c75function as ::0rustc_driver_impl> >]core::[ as <18650a1770591c75(]core::[}d723ad74a265baf3Fn]core::[install_ice_hook18650a1770591c75::{]>:: as closure#&ops<[::18650a1770591c75functionops::::(function&core'dyn a0[}>] as opscore::18650a1770591c75function::::FnFn::Fn<<((& [<18650a1770591c75(]&coredyn []18650a1770591c75ops&::dyn functionfor<::'']for<::::a::for adyn , core::'panic_infob::for [corefor [a<, 18650a1770591c75'']core::[]18650a1770591c75a], ::'opsb::> Fnb(,&)]ops::[dyn bfor<> ::core::[Fn, <18650a1770591c75(]&::'opspanic::::panic_infofunction18650a1770591c75afunction::::FnPanicInfo'::afunction ]corea[,18650a1770591c75, ']::b) = > '()Fn::>a + corecore[18650a1770591c75core, <[Output18650a1770591c75 = ]()::([&18650a1770591c75::]panic::::markeropspanic_info18650a1770591c75::>]] + ::::panic'::::panica:: functioncorecoreSync:::: + panic_infoFncore::[PanicInfo18650a1770591c75[<](::&marker'panic_infoa:: opsPanicInfo18650a1770591c75<]'::::[coremarker18650a1770591c75::::PanicInfo]::panicSync&:: + Fnpanic_infocore<::bpanicPanicInfo,<,')b(::)panic_info>, ::,PanicInfo)Output, = )core, ()>,>) + &core'[a18650a1770591c75Output, = [, 18650a1770591c75Output] = :: = ()Output> ()18650a1770591c75core][> = ()>:: + 18650a1770591c75core][::18650a1770591c75panic + paniccoremarker]::::Send + marker][, ::18650a1770591c75marker]::&Sync:: + ()::corepanic_info[>18650a1770591c75 + ]::::PanicInfomarker<::'core::[panic_info18650a1770591c75::]PanicInfo::panic)::>panic_info>::::PanicInfo)markerSendcall, +& ::core>>core::coreb > ,2[: ) , Output Sync[ + 18650a1770591c75 = core18650a1770591c75()::>call + +]core [ 18650a1770591c75 ]2[][::Sync18650a1770591c75marker:: + marker::::SyncSync + + ::core: corecore [ 18650a1770591c75 ] ::[18650a1770591c75marker :: Send , ] & core [ ::0x18650a1770591c751039ab528] - ::stdpanic0x[1039ab528]::::panickingmarker:::: - rust_panic_with_hookSync:: + h1e70c5d905e30e9dcore +[ 18650a1770591c75marker]panic::::marker::18650a1770591c75::]Send::stdmarker, ::::panickingSend::, rust_panic_with_hook&panic_infocore::18650a1770591c75::PanicInfo]h1e70c5d905e30e9d:: +marker ::Send, [&)core18650a1770591c75:: panic_info >3 &3coreSend: [ 18650a1770591c75 , :: PanicInfo ) > ][18650a1770591c75&]]core::[panic::::>panic::18650a1770591c75panic_info>::]PanicInfo::::)call> +> ::::call + : 2 : 2 : 0x 0x 1039ab5280x - 1039ab528std - ::stdpanickingpanicpanic::::1039ab2e4panicking::::callrust_panic_with_hook +:::: h1e70c5d905e30e9d panic_info - rust_panic_with_hookstd::::h1e70c5d905e30e9d:: +panicking :: begin_panic_handler +:: :: panic_infoPanicInfo )3::: { panic_info{>closure } }> :: ::h399e32952efd26a4 + call +4 20x: 1039ab2e4 - std :: : PanicInfo 3 ) >0x>: :: call +2 : 1039ab528 panicking :: PanicInfo ) > - std 0x:: 1039ab2e4begin_panic_handler - :::: >0x{1039a8a18 panicking{ std 2::closure - }callstd +::}sys_common :: h399e32952efd26a40x 1039ab2e4 +::2 - : ::std panicking :: ::: ::begin_panic_handler backtrace0x::1039ab528__rust_end_short_backtrace - ::panickingh2ab87f841a2323e7:: +{ { stdrust_panic_with_hook :: h1e70c5d905e30e9d + 0x41039ab528: - std ::closure 5 : 3:::: panicking :: rust_panic_with_hook0x::1039ab528 - std :: : begin_panic_handler h1e70c5d905e30e9d 0x 1039ab06c0x - 1039ab2e4panicking - panicking +std :: panicking ::::{::}rust_panic_with_hook}::::h1e70c5d905e30e9dh399e32952efd26a4 +_rust_begin_unwind3 : + begin_panic_handler{ closure } ::} :: h399e32952efd26a40x + 1039ab2e4 - std :: +6 { {0xclosure1039a8a18::} 4 - : std rust_panic_with_hook: 4 : :: 3 : panicking :: h1e70c5d905e30e9d + } 0x::103a04bd03h399e32952efd26a4: + 4 : ::sys_common :: backtrace :: __rust_end_short_backtracebegin_panic_handler ::0xh2ab87f841a2323e71039a8a18 + - std0x:: sys_common::::{backtrace {:: closure - }core5}::::panickingh399e32952efd26a4:: +panic_fmt ::1039ab2e4h33e40d2a93cab78f: - 0x 40x: 1039ab2e4__rust_end_short_backtrace - 1039a8a18::stdh2ab87f841a2323e7:: - +panicking std ::0x +5sys_common: ::std 0x 1039ab06c - 1039a8a18 backtrace - 0x::::1039ab06c panicking_rust_begin_unwind - ::std:: begin_panic_handler__rust_end_short_backtrace_rust_begin_unwind:: +begin_panic_handler7::h2ab87f841a2323e7:: +sys_common {:: {{ +: :: {backtrace closure closure ::}__rust_end_short_backtrace} 5 :: h2ab87f841a2323e70x +: 6 : 6} 1039a8a18} - std:::: :: sys_common :: 0x: backtrace ::5 __rust_end_short_backtrace h399e32952efd26a4: 0x:: + h2ab87f841a2323e7 + 1039ab06c h399e32952efd26a4 103a04b9c + - 4 - _rust_begin_unwind4core +: 0x 1039ab06c 5 - 0x_rust_begin_unwind: : + 0x6:: 0x option :: expect_failed ::103a04bd0 - h8c59d9d921ed2136core 103a04bd0 6 : 0x 1039a8a18 + - - :: 1039ab06c panicking :: 0x: - std _rust_begin_unwind + core8 : :: panic_fmt::panicking sys_common::1039a8a18:: - backtracestdpanic_fmt:: :: __rust_end_short_backtrace :: 0x 103a04bd0 - ::h2ab87f841a2323e7 +:: h33e40d2a93cab78fh33e40d2a93cab78f +6 coresys_common ::0xbacktrace:: ::panicking__rust_end_short_backtrace +::::h2ab87f841a2323e7: panic_fmt 10c3603ec ::0x + - 103a04bd0 - core rustc_codegen_ssa:: panicking[ ::panic_fmt h33e40d2a93cab78f b392610c019ec31b 7]: ::5 back:: +::h33e40d2a93cab78fwrite +:: : execute_copy_from_cache_work_item 5 7 : 0x 103a04b9c 70x 0x103a04b9c103a04bd0 - - 7core: :: panicking :: panic_fmt :: ::core<::rustc_codegen_llvmoption::: expect_failed - ::[h8c59d9d921ed2136b70b0e52460f9a66 ] +:: LlvmCodegenBackend >0x + 1039ab06c - 9 _rust_begin_unwind : 0x +1039ab06c 0x 103a04b9c - - 6core: :: optionh33e40d2a93cab78f::coreexpect_failed:::: h8c59d9d921ed2136option + :: 8 : 0x 103a04b9c - expect_failed core ::8 : h8c59d9d921ed2136 _rust_begin_unwind + : 0x + 6 : 7 : 0x + :: option :: expect_failed :: 10c3603ec0x - 10c3603ecrustc_codegen_ssa - [rustc_codegen_ssab392610c019ec31b[]b392610c019ec31b:: back 103a04bd0 0x 103a04bd0 - - ] ::coreback :: panicking8::: panic_fmtcore::::writewrite::::execute_copy_from_cache_work_item ::execute_copy_from_cache_work_item<::rustc_codegen_llvm<[rustc_codegen_llvm :: panicking0x::103a04b9cpanic_fmth8c59d9d921ed2136:: - h33e40d2a93cab78fcore +:: option ::b70b0e52460f9a66h33e40d2a93cab78f ] :: LlvmCodegenBackend > + ::0x expect_failed 10c3603ec - 9rustc_codegen_ssa: [ +[::b392610c019ec31bh8c59d9d921ed2136] + :: b70b0e52460f9a66 ] ::8LlvmCodegenBackend: 0x > +10c342508 - 79: std + [ 7 0x 103a04b9c 8: 0xback10c3603ec - core ::0xoptionfcd23fca98dce159: :: expect_failed :: h8c59d9d921ed213610c342508 + - rustc_codegen_ssa [ b392610c019ec31b ] :: back : 0x::103a04b9cwrite - core - ]std::[execute_copy_from_cache_work_itemfcd23fca98dce159::::]__rust_begin_short_backtrace10c342508option :: sys_common expect_failed0x::10c3603ec:: - backtracerustc_codegen_ssah8c59d9d921ed2136[ - b392610c019ec31b:: + < rustc_codegen_llvm [ b70b0e52460f9a660x::]10c3603ec:: - LlvmCodegenBackendrustc_codegen_ssa>__rust_begin_short_backtrace[ b392610c019ec31b :::: ]8< +: < < 9 : ]0xrustc_codegen_llvm10c3603ec[ - b70b0e52460f9a66rustc_codegen_ssa] :: LlvmCodegenBackend as ::rustc_codegen_ssa [ b392610c019ec31b ]0x +std10c342508[ - fcd23fca98dce159std]<::[sys_common[b392610c019ec31b::]backtracefcd23fca98dce159 back::::backwrite::::::writeexecute_copy_from_cache_work_item::::execute_copy_from_cache_work_item<::back::]rustc_codegen_llvmtraits:: [ b70b0e52460f9a669]write::::execute_copy_from_cache_work_item::LlvmCodegenBackend::>__rust_begin_short_backtrace +:: : :: :: <9<: rustc_codegen_llvm<<[rustc_codegen_llvmrustc_codegen_llvm backend :: ExtraBackendMethodssys_common>[rustc_codegen_llvm[ b70b0e52460f9a66 ] :: b70b0e52460f9a66LlvmCodegenBackend 0x ::10c342508 b70b0e52460f9a660x[backtrace - b70b0e52460f9a66]]::::spawn_named_thread::LlvmCodegenBackend<>__rust_begin_short_backtrace +]rustc_codegen_ssa::::LlvmCodegenBackendLlvmCodegenBackend>[ +::b392610c019ec31b < < rustc_codegen_llvm9[: b70b0e52460f9a66 as ]]::::backrustc_codegen_ssaLlvmCodegenBackend::[write as ::rustc_codegen_ssaspawn_work[stdb392610c019ec31b[<]rustc_codegen_llvm::[traitsb70b0e52460f9a66::b392610c019ec31b]backend::::LlvmCodegenBackendExtraBackendMethods>>::{::closure10c342508# - 0std}[, fcd23fca98dce159()]>::::{sys_commonclosure::#backtrace0::}__rust_begin_short_backtrace, ::()<>< +rustc_codegen_llvm [ b70b0e52460f9a6610]: :: LlvmCodegenBackend as rustc_codegen_ssa [ b392610c019ec31b ] ::0xtraits10c361244:: - backend<::[::fcd23fca98dce159spawn_named_thread]<::rustc_codegen_ssathread[::Builder>]fcd23fca98dce159 as b392610c019ec31b :: traitsrustc_codegen_ssa:: [backendb392610c019ec31b spawn_named_thread]<:: rustc_codegen_ssa] ] ::9::[: ::b392610c019ec31bsys_commonExtraBackendMethods back> ::::spawn_named_thread ::::{spawn_workclosure::]sys_common[::b70b0e52460f9a66b70b0e52460f9a66::{ExtraBackendMethods]]:: - ::stdLlvmCodegenBackend[[fcd23fca98dce159::backtrace>>closure::::{spawn_named_threadclosure<#rustc_codegen_ssa]#::LlvmCodegenBackendsys_common as ::rustc_codegen_ssa0b70b0e52460f9a66[}b392610c019ec31b::, ]()::>traits]LlvmCodegenBackend::[backendb392610c019ec31b::]ExtraBackendMethods::0}back, +::writebacktrace::>::spawn_work__rust_begin_short_backtrace<::::()>::{::::{spawn_named_thread__rust_begin_short_backtraceclosure<::b392610c019ec31bclosure]# +0][b392610c019ec31b::rustc_codegen_llvm::LlvmCodegenBackendtraits as ::rustc_codegen_ssabackend]} [ b70b0e52460f9a6610[]: b392610c019ec31b ] ::] traits ::, LlvmCodegenBackend::()::back ::::writeExtraBackendMethods> as > :: spawn_named_thread rustc_codegen_ssa[ <0xrustc_codegen_ssa10c361244[::b392610c019ec31b::{ - backend]< < std::traitsb392610c019ec31b[0x::LlvmCodegenBackendExtraBackendMethods>10c361244::{closure>#::fcd23fca98dce1590backend}::, ExtraBackendMethods]()>>::::]:: +spawn_work - << rustc_codegen_llvmclosure[::spawn_named_threadthread<::rustc_codegen_ssaBuilderspawn_named_thread>#<< b70b0e52460f9a66::][0b392610c019ec31b::}LlvmCodegenBackend, ]10()back::rustc_codegen_ssaspawn_unchecked_[::::{thread::closure::::#: ]::::>LlvmCodegenBackend::{ as closurerustc_codegen_ssa#[0back Builder > ::::write spawn_work}<, rustc_codegen_llvm::b392610c019ec31b[0 () >0x::{backspawn_unchecked_]10c361244::b70b0e52460f9a66 - ]b70b0e52460f9a66 +] 0 spawn_work10[::: traits} fcd23fca98dce159:: backend :: ExtraBackendMethods, b70b0e52460f9a66 LlvmCodegenBackend>::::LlvmCodegenBackendspawn_named_thread>> ]<()]rustc_codegen_ssa::[ >::b392610c019ec31b::{thread]::::Builderback<>::::write::{closure::#spawn_unchecked_::{0closure<}<#LlvmCodegenBackendrustc_codegen_llvm as 1rustc_codegen_ssaspawn_work[closureb392610c019ec31b0x][::b70b0e52460f9a66traits]::10c361244::backendLlvmCodegenBackend - rustc_codegen_llvm as [[#b70b0e52460f9a660::}()traits] as std::{}coreclosure[spawn_named_thread18650a1770591c75<]rustc_codegen_ssa, ::[ops::::::()>functionLlvmCodegenBackend#::0::{backendFnOnce::]>>>::{::closurecall_once#closure#0::>::{::{b392610c019ec31bclosure}], ::()back#::>shim::thread:::vtableBuilder#>write0::}spawn_unchecked_ +0<} < rustc_codegen_llvm11[, b70b0e52460f9a66: ]()::>LlvmCodegenBackend:: as spawn_workrustc_codegen_ssa<[rustc_codegen_llvmb392610c019ec31b][ ::b70b0e52460f9a66traits]::::backend +LlvmCodegenBackend0>:: ::{spawn_named_threadclosure<#rustc_codegen_ssa0}, ()ExtraBackendMethods[> b392610c019ec31b ] ::::>spawn_named_thread ::{ closure0x#1039b37d00}}::{back}::, write()closure::>spawn_work - < std10rustc_codegen_llvm: <, rustc_codegen_ssa #[::0, +} , ()b392610c019ec31b>10 : ::{ [()sys > :: +]() 10 b70b0e52460f9a66 >]unix :: threadclosure::{:: closureLlvmCodegenBackend::#back0::}>#, 0x1write: }:: as spawn_work core :: Thread 0x0x10c36124410c361244 - - <<<[std18650a1770591c75[]fcd23fca98dce159::]::::newthread::::thread_startBuilderops>::::h8dda2af345bab446spawn_unchecked_ +< 10c361244<::rustc_codegen_llvmfunction[12::b70b0e52460f9a66FnOnce]<::()LlvmCodegenBackend as ::{rustc_codegen_ssaclosure: # - 0 []<::thread>[:: ExtraBackendMethods > ::::LlvmCodegenBackendfcd23fca98dce159>spawn_named_thread::{spawn_work:: as , >1813c506c::{call_once - ::{__pthread_deallocateclosure +()::>LlvmCodegenBackend::{>shimclosure:#::{0closure}#, 0()spawn_unchecked_>vtable::{#closure0#}1 +}< as : 0::{ rustc_codegen_ssa18650a1770591c75 ] :: closure opsb70b0e52460f9a66[#b392610c019ec31b0]}::, ::{()traits>::::{]}::, ::function()::>closure::{#closure1FnOnce#}1 as }< as core0x[1039b37d018650a1770591c75 - ]std::::opssys::()function::::unixFnOnce::core>[::18650a1770591c75call_once] as closure::{#::1Thread}shim as ::core:[newvtablebackend#::0ExtraBackendMethods::>thread_start::}spawn_named_thread::< +rustc_codegen_ssah8dda2af345bab446[ b392610c019ec31b +] :: back ::11write12::: spawn_work: < rustc_codegen_llvm [ b70b0e52460f9a66 ] :: LlvmCodegenBackend > ::{ closure # 0 }0x, 1813c506c() - >0x::{1039b37d0closure - #>rustc_codegen_ssa__pthread_deallocate[ +b392610c019ec31bstd]::::systraits::::unixbackend::::threadExtraBackendMethods::>Thread::::spawn_named_threadnew<::rustc_codegen_ssathread_start[::b392610c019ec31bh8dda2af345bab446] +:: back ::12write: :: spawn_work < rustc_codegen_llvm [ b70b0e52460f9a66 ] ::0xLlvmCodegenBackend1813c506c> - ::{__pthread_deallocateclosure +#0}, ()>::{closure#0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1039b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1039b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwin>::call_once::{shim:vtable#0} + 11: 0x1039b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1039b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +0}, ()>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 11: 0x1039b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +thread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x103992da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c0c6208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1039ab528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x110241168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1102410ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x1107da040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x1101ba9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x1101b1c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x1101b1be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1107d53c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c344270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10c36151c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x1039b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x103992da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x10c0c6208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x1039ab528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x110241168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x1102410ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x1107da040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x1101ba9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x1101b1c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x1101b1be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x1107d53c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10c33df48 - ::time::>::join::{closure#0}> + 11: 0x10c363284 - >::join + 12: 0x10c352d48 - ::join_codegen + 13: 0x10c26e64c - ::link + 14: 0x10c0b311c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x10c0e9628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x10c0bbd7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x1039b37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_30-13195.txt b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_30-13195.txt new file mode 100644 index 00000000000..45d240d02ef --- /dev/null +++ b/packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_30-13195.txt @@ -0,0 +1,170 @@ +thread 'cpy 4orp8g2x23rgnt3a' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:44: +no saved object file in work product +stack backtrace: +thread 'cpy 4uzg6vrmxwsbl425' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rsthread ':cpy ebti8ycrnjshmsw913' panicked at :/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rsthread ':cpy oxxcwsebgx1733i913' panicked at :/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs44: +44:no saved object file in work product913 +stack backtrace: +:: +44no saved object file in work product: + +stack backtrace: +no saved object file in work product +stack backtrace: +thread 'cpy vhs4c6sj2h4xpaq' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:913:thread '44cpy 5fuhladjlcxb67o9: +' panicked at no saved object file in work product/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs +stack backtrace: +:913:44: +no saved object file in work product +stack backtrace: + 0: 0x100bb2da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0 : 0x01092e6208: - < alloc [0x 37ddc2533ea56b7b100bb2da8 - ]0xstd100bb2da8:: - backtracestd:: :: boxedBacktrace:: Box thread ' :: backtrace0<:: Backtrace0cpy k5jtp3uu1e1wr25rustc_driver_impl:::: createcreate::0::: h8af6f7a25d8a3749' panicked at : [ d723ad74a265baf3thread '] /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rsh8af6f7a25d8a3749 +cpy sz32l9e0944h5s3 ' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs :: +1 : :install_ice_hook1::{913closure: : 913 : # : :0 44 : + no saved object file in work product 44 0x : +0xno saved object file in work product1092e6208} +stack backtrace: + - 100bb2da8 +stack backtrace: + > - std as :: backtrace <::coreBacktrace 0x0x 1092e6208 100bb2da8 - alloc<0x - 100bb2da8 [ std::::create backtrace37ddc2533ea56b7b::[ - std0alloc ]::::Backtraceh8af6f7a25d8a3749:: +create::::018650a1770591c75 [: h8af6f7a25d8a3749: ] +:: boxedops37ddc2533ea56b7b:::: Box ]backtrace :: boxed1 function::<::Backtracerustc_driver_impl::[ Box created723ad74a265baf3::< rustc_driver_impl1Fn: <[::] h8af6f7a25d8a3749 (d723ad74a265baf3 &: dyn for< ':: a +, '] b 1install_ice_hook> ::{core[closure: #18650a1770591c75 ] :::: 0x00x 100bb2da8install_ice_hook - ::{}ops std :: >1092e6208 - as closurebacktrace<#::0x0}0x::allocfunction[ 37ddc2533ea56b7b1092e6208core]::Backtrace0x100bb2da8::[ - 18650a1770591c75std::Fn]< - ::>1092e6208boxed as ::core:: - createbacktraceBox<::::alloc core::[ install_ice_hook( ::{ }closure #<>' as b0xcore>18650a1770591c75[& as 0core18650a1770591c751092e6208}] dyn - >> as ::]for<<::opscore::[function18650a1770591c75[ 18650a1770591c75']::,Fn)<, (Output&:: alloc = 0xa[]ops::::ops'ops1092e6208a::, functionfunction37ddc2533ea56b7b ::corefunction::'::][()Fn - <><(b + ::::boxed18650a1770591c75corealloc[&::]> FnFncore18650a1770591c75Box]<[dyn ::for, + b',Box'])#core0[> <::}ops>b::rustc_driver_impl18650a1770591c75 as , ]core::[bmarkercore::[[18650a1770591c75> ]> functionSend::cored723ad74a265baf318650a1770591c75]][::OutputcoreFn = [::<()ops, 18650a1770591c75install_ice_hook18650a1770591c75::{::closure>#::]0]}(function>::ops as ops::&& + core'[corea[::18650a1770591c75ops]::18650a1770591c75 Fncore::corefunction<::(function[::[::18650a1770591c7518650a1770591c75]]::Fnmarker<::functionpanic::::Fn::panic_info<&::::PanicInfoSync]< + ::Fndyn core'([18650a1770591c75]panic(b<&('::&a'for&::'::amarker::a', function, ::::coreFn)<, SendPanicInfoOutputa core'[18650a1770591c75[ = core()()&>dyn + >>core18650a1770591c75for [::core, call::[ +18650a1770591c75:: ] panic::&'::bpaniccore> ::18650a1770591c75[panic]panic_info::18650a1770591c75::panic_infoops::::]panic_infoPanicInfomarker:::: function::Fn2PanicInfo<::core<[::18650a1770591c75panic_info]( ::,::b18650a1770591c75 ) >, marker&Output PanicInfo::)Send> ]>, >& = :: ',::core,()call + a0x 100bcb528 ) - , stdOutput:: = panicking2()core[>[ops + 18650a1770591c75core][)::18650a1770591c75panic]::::panic_info::18650a1770591c75::, ::marker>:: + Outputrust_panic_with_hookSynccore = + []corefunction: PanicInfo::::h1e70c5d905e30e9dFn +< :: (3&: <'panica:: [() 18650a1770591c75panic_info']:: ::PanicInfo marker b 18650a1770591c75> )>]> + >core::::[core18650a1770591c75 call, ) , + ::Syncmarker Output:: Send = , 0x() + 100bcb528core - [][>& + core18650a1770591c75::std marker[ ::core18650a1770591c75]::::panickingpanic::Syncrust_panic_with_hook18650a1770591c75::20x: h1e70c5d905e30e9d][ +] 100bcb2e4 :: - marker:: :: std:: + ::Send318650a1770591c75panic_info]:: PanicInfo, core: marker :: ::[&,core) + , ::core]PanicInfo::)begin_panic_handlerOutput[ = [18650a1770591c75 18650a1770591c75]]():: :: > > >0x::markercall::100bcb2e40xmarker100bcb528:: - - Sendstd, {&stdcore +::::panic + Send::core, [::&18650a1770591c75{[panic_infopanicking::::PanicInfobegin_panic_handlerpanickingclosure):::: { { >closure]2::18650a1770591c75corerust_panic_with_hook}}::marker[::}18650a1770591c75h1e70c5d905e30e9d>] +:: call}::]Sync::: + core [ +::panich399e32952efd26a418650a1770591c75 ::]panic_info:::: markerPanicInfo::)Send>3, >:::: call + h399e32952efd26a4 + panic& :: 0xpanic_info: +:: PanicInfo 100bcb528core - [std :: 4 : 18650a1770591c75 2 : )]>2 :: panic :: panicking4 : panic_info 0x : 100bc8a18:::: > ::0xcall +100bcb528 - - std std :: sys_common::PanicInfo 0x 2::) >rust_panic_with_hookbacktracepanicking::::::rust_panic_with_hook__rust_end_short_backtrace0x100bcb528:: : h2ab87f841a2323e7100bcb2e4 +:: >h1e70c5d905e30e9d - - std :: std::panicking + h1e70c5d905e30e9d :: ::call begin_panic_handler +:: { panicking :: 0x{100bc8a18 - std 2 5 +closure } }::: :: sys_common ::: backtrace30x : :: 3 rust_panic_with_hook h399e32952efd26a4__rust_end_short_backtrace ::0x: 100bcb2e4h2ab87f841a2323e70x +100bcb528 - :: 5 - : std :: panicking :: rust_panic_with_hook0x 100bcb06c:: - 0x_rust_begin_unwindh1e70c5d905e30e9d +100bcb06c - + _rust_begin_unwind6 + +h1e70c5d905e30e9d 100bcb528 - : + stdstd :: panicking :::: 4 : 3 : rust_panic_with_hook 0x 0x6100bcb2e4panicking:: - :: : 3 : 100c24bd0 begin_panic_handler :: { std - core:: ::panickingpanicking0x0x::{panic_fmt100bcb2e4:: :: h33e40d2a93cab78f - h1e70c5d905e30e9d + +stdclosure begin_panic_handler ::::panicking{::{begin_panic_handler 100bc8a18:: { closure0x} }} - ::3h399e32952efd26a4} + 100c24bd0 : std :: sys_common :: - ::core7 backtrace40x: 100bcb2e4:: - : {h399e32952efd26a4 :: closure } __rust_end_short_backtracepanicking std :: } + ::panic_fmt:::: h33e40d2a93cab78f0x +100bcb2e4panicking :: :: h399e32952efd26a4 - 4h2ab87f841a2323e7begin_panic_handler0xstd +::{: {:: closure100c24b9c} panicking} ::7h399e32952efd26a4: - + +core :: :: begin_panic_handler4:: : { option ::5expect_failed: :: { closureh8c59d9d921ed2136} }4 ::: + h399e32952efd26a4 +0x 100bc8a18 - 0x0x100c24b9c100bcb06c - 8std: ::core sys_common :: backtrace - ::::__rust_end_short_backtraceoption:::: h2ab87f841a2323e7 + _rust_begin_unwind expect_failed 4 +50x: 1095803ec - 0x 100bc8a18 - 6: 0x : :: rustc_codegen_ssa0xh8c59d9d921ed2136100bc8a18 + 8100bc8a18 std - [std ::: 0x 100bcb06c b392610c019ec31b - 0x ::_rust_begin_unwind sys_common]100bc8a18:: +back sys_common0x - 1095803ec0x - - 100c24bd0::::backtrace::rustc_codegen_ssa [ b392610c019ec31bstd write6::]: :: back sys_common:: :::: backtrace execute_copy_from_cache_work_item ::::__rust_end_short_backtrace< rustc_codegen_llvm:: - 0x::100c24bd0h2ab87f841a2323e7core - backtracecore:::: +panicking[ std__rust_end_short_backtrace ::::h2ab87f841a2323e7::write__rust_end_short_backtraceb70b0e52460f9a66::]panicking +:: panic_fmt sys_common5::: h2ab87f841a2323e7:: LlvmCodegenBackend::>5 +h33e40d2a93cab78fpanic_fmt +:: h33e40d2a93cab78f +: :: execute_copy_from_cache_work_item7::: 9 < rustc_codegen_llvm:: [ : 5 + : backtrace b70b0e52460f9a66 ] :: LlvmCodegenBackend > + 7 : 0x 9 : ::0x__rust_end_short_backtrace100c24b9c :: - h2ab87f841a2323e7 0x 109562508 - 100bcb06c + 0x0x100c24b9c100bcb06c - - core:: - _rust_begin_unwind + std option core_rust_begin_unwind0x:: +option :: expect_failed ::109562508 h8c59d9d921ed2136 - +std6 [ fcd23fca98dce1598] : 6 ::: [ expect_failed :: h8c59d9d921ed2136 + 0x 1095803ecfcd23fca98dce159: 8] : ::5sys_common : :: sys_common 0x :: backtrace - :: ::0x rustc_codegen_ssa100c24bd0backtrace[ 100bcb06c 0x - 100bcb06c0x - 1095803ec_rust_begin_unwind - + - rustc_codegen_ssa__rust_begin_short_backtrace[:::: <__rust_begin_short_backtrace <:: 0x b392610c019ec31b100c24bd06 - : core ]:: panicking :::: backpanic_fmt ::::h33e40d2a93cab78fwrite + :: 0xexecute_copy_from_cache_work_item 100c24bd07 - : :: core :: panicking rustc_codegen_llvm::[_rust_begin_unwindpanic_fmtb70b0e52460f9a66::] +h33e40d2a93cab78f< +rustc_codegen_llvm [ b70b0e52460f9a66 ]b392610c019ec31b7::: LlvmCodegenBackend]> +core :: 9 : 6 : < <:: back :: rustc_codegen_llvmpanicking [::b70b0e52460f9a66 ]panic_fmt ::::h33e40d2a93cab78f0x +109562508 - std 7LlvmCodegenBackend: [ fcd23fca98dce159 as ]0x ::rustc_codegen_ssasys_common[ :: b392610c019ec31b::backtrace100c24b9cLlvmCodegenBackend:: - __rust_begin_short_backtrace as ::core<:: - - LlvmCodegenBackendcore>:: +b392610c019ec31b ] option ::9expect_failed: ::8 h8c59d9d921ed2136 +:: : traits 0xtraits109562508 - std [ fcd23fca98dce159 ::] ::8sys_common: backend:: backtrace::::ExtraBackendMethods __rust_begin_short_backtrace> :: < ::< spawn_named_threadrustc_codegen_llvm<[rustc_codegen_ssab70b0e52460f9a66[ ::b392610c019ec31bpanicking]] :::: panic_fmtback::::0xspawn_named_thread1095803eccore:: - spawn_work::write:::: ::{execute_copy_from_cache_work_itemclosure #::80<: rustc_codegen_llvm [ b70b0e52460f9a66} ], :: LlvmCodegenBackend > +backend() 0x> 1095803ec::{ closure9# - : 0rustc_codegen_ssa} , ()[ b392610c019ec31b ] > +:: 0x back10956250810 - : std ::[ writefcd23fca98dce159 ] :: ::sys_common execute_copy_from_cache_work_item ::0xbacktrace109581244:: - __rust_begin_short_backtrace<::<<::std::[rustc_codegen_llvm::::threadspawn_named_thread::::LlvmCodegenBackendb392610c019ec31bBuilder<>]::::::spawn_unchecked_back<::h33e40d2a93cab78f< as +writeLlvmCodegenBackend :: spawn_work <9 +rustc_codegen_llvm: [ b70b0e52460f9a66 ] rustc_codegen_ssa:: LlvmCodegenBackend > [::{b392610c019ec31b closure 0x#1095625080 - }std][::fcd23fca98dce159::, ]traits::::sys_commonbackend::()rustc_codegen_llvmbacktrace::::ExtraBackendMethods__rust_begin_short_backtracetraits>::::<::][>::{:: +]back :: ::writeLlvmCodegenBackend::closureclosurespawn_work#<0rustc_codegen_llvm}[#, 0()b70b0e52460f9a66>] +::9 : LlvmCodegenBackend >}10::{: closure7, () : as rustc_codegen_ssa [ ># b392610c019ec31b ::]b70b0e52460f9a66::]ExtraBackendMethodstraits::::>LlvmCodegenBackendbackend as :: rustc_codegen_ssa0[::{}b392610c019ec31b, ]ExtraBackendMethods:: ()traits>::::{>backendclosure:: #ExtraBackendMethods::0>}::, spawn_named_threadspawn_named_thread<() rustc_codegen_ssa><[ +b392610c019ec31brustc_codegen_ssa] [:: back 10b392610c019ec31b: ::] write :::: spawn_work <0xrustc_codegen_llvm109562508back[ - b70b0e52460f9a66std][::::fcd23fca98dce159LlvmCodegenBackendwrite]>::::{sys_commonclosure::::#backtrace0::}spawn_work__rust_begin_short_backtrace, <::rustc_codegen_llvm<[()[::{b70b0e52460f9a66closure]]#::0::}LlvmCodegenBackend, as LlvmCodegenBackend()rustc_codegen_ssa>>[ +b392610c019ec31b::{ closure] #10::: traits :: backend :: ExtraBackendMethods0>}::, spawn_named_thread()<>rustc_codegen_ssa::{[closureb392610c019ec31b#]0::back:: write :: spawn_work < } , 0x()109581244>0x - ::{109581244closure - #<<1<}< as stdcore[[fcd23fca98dce15918650a1770591c75]closurestd#::[threadfcd23fca98dce159::]Builder::thread::::0Builder}>>spawn_named_thread, ::()::<>spawn_unchecked_ spawn_unchecked_rustc_codegen_ssa<[<[::]spawn_named_threadb70b0e52460f9a66::spawn_workstd<::rustc_codegen_llvmrustc_codegen_llvmspawn_named_thread[[b70b0e52460f9a66b70b0e52460f9a66<]]rustc_codegen_ssa::[LlvmCodegenBackend]> +b392610c019ec31b [ fcd23fca98dce159] ]10 ] ::: back:: write::::::spawn_workops[::b70b0e52460f9a66::{]::{closure::LlvmCodegenBackendclosureLlvmCodegenBackend#>>0::{#closure::#}00}}, , , ()()thread>::>::{Builderclosure>::{ closure# #0 }0 , ::{ () >closure ::{0xclosure1095812440xfunction - #<}1<}std as [corefcd23fca98dce159, ]()::()thread::>:: +Builder > ::::>spawn_unchecked_10<: < spawn_unchecked_ FnOnce #< () ::{ closure 100c24b9c#0x0<}<, rustc_codegen_llvm()[> - ::{18650a1770591c75closure]#::10>core>::::ops[rustc_codegen_llvmb70b0e52460f9a66109581244[]b70b0e52460f9a66 - }optioncall_once::::::{expect_failedshimLlvmCodegenBackend: as vtable > ::, : () >>LlvmCodegenBackend::{ as thread rustc_codegen_ssa [ b392610c019ec31b ] 0::::BuilderExtraBackendMethods }> :::: spawn_unchecked_ < call_once< ::{0xrustc_codegen_llvm100bd37d0shim> - :::stdspawn_named_threadvtable< +rustc_codegen_ssa::[sys b392610c019ec31b:: ::11traits: :: backendclosure[unixb70b0e52460f9a66::]thread:: ::LlvmCodegenBackendThread as 0x::1095803ecrustc_codegen_ssanew[:: - thread_start#::b392610c019ec31bh8dda2af345bab446rustc_codegen_ssa] +:: [traits b392610c019ec31b120: ] ] } :: + :: back0x::1813c506cback:: - ::write__pthread_deallocate:: +backendExtraBackendMethodsspawn_work::::<>writeExtraBackendMethods::rustc_codegen_llvmexecute_copy_from_cache_work_item>::[::#:: spawn_named_thread < 11<0rustc_codegen_llvmrustc_codegen_ssa}[, [()b70b0e52460f9a66>] +b392610c019ec31b:: ] LlvmCodegenBackend10>: :: +back ::: write :: spawn_work < rustc_codegen_llvm [ b70b0e52460f9a66 0x 109581244 - < <]std ::0x[LlvmCodegenBackendfcd23fca98dce159>]100bd37d0::{:: - closurestdthread::#::sys0Builder::>}::, spawn_unchecked_unix()<::><::{rustc_codegen_llvmclosure[#threadb70b0e52460f9a660]}::, LlvmCodegenBackend::() as >rustc_codegen_ssa::{[closureb392610c019ec31b#]1Thread::}traits as ::::corenewbackend[::18650a1770591c75ExtraBackendMethods::]thread_start::>ops::::::spawn_named_threadfunctionh8dda2af345bab446::back>::::writecall_once 120x::{: 100bd37d0shim - : vtable # 0 } +std ::0x 1813c506c11 - sys: __pthread_deallocate:: + unix :: thread :: Thread ::0xnew100bd37d0:: - thread_startstd::::h8dda2af345bab446sys +:: unix ::12thread: :: Thread ::new::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate + + +rustc version: 1.76.0 (07dca489a 2024-02-04) +platform: aarch64-apple-darwinb70b0e52460f9a66]::LlvmCodegenBackend>::{closure#0}, ()>::{spawn_named_thread closure #90: ::<}spawn_workrustc_codegen_ssa, [()b392610c019ec31b>::{ ]closure # 1 } as 0xcore1813c506c[ - 18650a1770591c75__pthread_deallocate] +::ops :: function :: FnOnce <0x()109562508> - backtrace::{::closure__rust_begin_short_backtrace#::0<}<, rustc_codegen_llvm()[>b70b0e52460f9a66::{]closure::#LlvmCodegenBackend0 as }rustc_codegen_ssa, [()b392610c019ec31b>]::{::closuretraits#::1backend}:: as ExtraBackendMethodscore>[::18650a1770591c75spawn_named_thread]<::rustc_codegen_ssaops[::b392610c019ec31bfunction]::::FnOnceback<::()write>::>spawn_work::}::{ +closure # 011}: , () > ::{ closure # 0 }0x, 100bd37d0() - >std +:: sys ::10unix: :: thread 0x109581244 - <::spawn_unchecked_<::spawn_named_thread::::{backclosure::#write0::}spawn_work, <()rustc_codegen_llvm>[::{b70b0e52460f9a66closure]#::0LlvmCodegenBackend}>, ::{()closure>#::{0closure}#, 1()}> as ::{coreclosure[#18650a1770591c750]}::, ops()::>function::{::closureFnOnce#<1()}> as >core::[call_once18650a1770591c75::{]shim:::opsvtable::#function0::}FnOnce +< () >11>: :: call_once ::{ shim : vtable # 0>0x}::call_once::{shim:vtable#0} + 11: 100bd37d0 - 0xstd100bd37d0:: - sysstd::::Threadsys::::newunix::thread_start::::unixh8dda2af345bab446:: +thread :: Thread::::new12:: +thread_startthread:: h8dda2af345bab446:: + Thread :: : 12new 11: : 0x 100bd37d0 - 0x 1813c506c - 0x__pthread_deallocate1813c506c + - __pthread_deallocate +::thread_start::h8dda2af345bab446 + 12: 0x1813c506c - __pthread_deallocate +thread 'coordinator' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1586:29: worker thread panicked +stack backtrace: + 0: 0x100bb2da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x1092e6208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panicstd::::panic_infosys::::PanicInfounix<::'threadb::>Thread,::)new, ::Outputthread_start = ::()h8dda2af345bab446> + + core [1218650a1770591c75: ] :: marker :: Sync + core [0x18650a1770591c751813c506c] - ::__pthread_deallocatemarker +::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x100bcb528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10d461168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10d4610ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x10d9fa040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10d3da9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10d3d1c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10d3d1be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x10d9f53c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x109564270 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result> + 11: 0x10958151c - <::spawn_unchecked_<::spawn_named_thread::{closure#5}, core[18650a1770591c75]::result::Result>::{closure#0}, core[18650a1770591c75]::result::Result>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 12: 0x100bd37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 13: 0x1813c506c - __pthread_deallocate +thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:36:26: +/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:1959:17: panic during codegen/LLVM phase +stack backtrace: + 0: 0x100bb2da8 - std::backtrace::Backtrace::create::h8af6f7a25d8a3749 + 1: 0x1092e6208 - as core[18650a1770591c75]::ops::function::Fn<(&dyn for<'a, 'b> core[18650a1770591c75]::ops::function::Fn<(&'a core[18650a1770591c75]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[18650a1770591c75]::marker::Sync + core[18650a1770591c75]::marker::Send, &core[18650a1770591c75]::panic::panic_info::PanicInfo)>>::call + 2: 0x100bcb528 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d + 3: 0x10d461168 - std[fcd23fca98dce159]::panicking::begin_panic::::{closure#0} + 4: 0x10d4610ec - std[fcd23fca98dce159]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 5: 0x10d9fa040 - std[fcd23fca98dce159]::panicking::begin_panic:: + 6: 0x10d3da9f4 - rustc_middle[35a781f9bda42497]::util::bug::opt_span_bug_fmt::::{closure#0} + 7: 0x10d3d1c14 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 8: 0x10d3d1be0 - rustc_middle[35a781f9bda42497]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 9: 0x10d9f53c4 - rustc_middle[35a781f9bda42497]::util::bug::bug_fmt + 10: 0x10955df48 - ::time::>::join::{closure#0}> + 11: 0x109583284 - >::join + 12: 0x109572d48 - ::join_codegen + 13: 0x10948e64c - ::link + 14: 0x1092d311c - rustc_span[d844dabcc0d15e78]::create_session_globals_then::, rustc_interface[9ecbacebda51131]::interface::run_compiler, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}> + 15: 0x109309628 - std[fcd23fca98dce159]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>> + 16: 0x1092dbd7c - <::spawn_unchecked_, rustc_driver_impl[d723ad74a265baf3]::run_compiler::{closure#0}>::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[18650a1770591c75]::result::Result<(), rustc_span[d844dabcc0d15e78]::ErrorGuaranteed>>::{closure#1} as core[18650a1770591c75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 17: 0x100bd37d0 - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446 + 18: 0x1813c506c - __pthread_deallocate diff --git a/packages/rs-platform-serialization-derive/src/derive_bincode.rs b/packages/rs-platform-serialization-derive/src/derive_bincode.rs index 9583f9fb97f..74af5c330b9 100644 --- a/packages/rs-platform-serialization-derive/src/derive_bincode.rs +++ b/packages/rs-platform-serialization-derive/src/derive_bincode.rs @@ -59,6 +59,9 @@ pub(crate) fn derive_decode_inner(input: TokenStream) -> Result { generator.finish() } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub(crate) fn derive_borrow_decode_inner(input: TokenStream) -> Result { let parse = Parse::new(input)?; let (mut generator, attributes, body) = parse.into_generator(); diff --git a/packages/rs-platform-serialization-derive/src/lib.rs b/packages/rs-platform-serialization-derive/src/lib.rs index 46b8f0ce6e0..e78576cb034 100644 --- a/packages/rs-platform-serialization-derive/src/lib.rs +++ b/packages/rs-platform-serialization-derive/src/lib.rs @@ -26,7 +26,9 @@ struct VersionAttributes { unversioned: bool, platform_serialize_into: Option, platform_version_path: Option, + #[allow(dead_code)] // TODO this is never read allow_prepend_version: bool, + #[allow(dead_code)] // TODO this is never read force_prepend_version: bool, } diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index e79eef94c97..43739e0d9ef 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,11 +2,10 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -private = true [dependencies] bincode = { version = "2.0.0-rc.3", features = ["serde"] } diff --git a/packages/rs-platform-serialization/src/de/impls.rs b/packages/rs-platform-serialization/src/de/impls.rs index 59bcaeb90d3..36ed3cb3fdd 100644 --- a/packages/rs-platform-serialization/src/de/impls.rs +++ b/packages/rs-platform-serialization/src/de/impls.rs @@ -689,6 +689,9 @@ where } } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] const UTF8_CHAR_WIDTH: [u8; 256] = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1F @@ -709,6 +712,9 @@ const UTF8_CHAR_WIDTH: [u8; 256] = [ ]; // This function is a copy of core::str::utf8_char_width +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] const fn utf8_char_width(b: u8) -> usize { UTF8_CHAR_WIDTH[b as usize] as usize } diff --git a/packages/rs-platform-serialization/src/de/mod.rs b/packages/rs-platform-serialization/src/de/mod.rs index 3cdaf926194..b71ace8f6e1 100644 --- a/packages/rs-platform-serialization/src/de/mod.rs +++ b/packages/rs-platform-serialization/src/de/mod.rs @@ -105,7 +105,10 @@ macro_rules! impl_platform_versioned_borrow_decode { decoder: &mut D, platform_version: &PlatformVersion, ) -> core::result::Result { - $crate::PlatformVersionedBorrowDecode::platform_versioned_borrow_decode( + // Here we directly call the platform_versioned_decode method from + // PlatformVersionedDecode, assuming it correctly handles decoding based + // on the platform version. + <$ty as $crate::PlatformVersionedDecode>::platform_versioned_decode( decoder, platform_version, ) diff --git a/packages/rs-platform-serialization/src/enc/mod.rs b/packages/rs-platform-serialization/src/enc/mod.rs index 6db99cda0fe..75bcf2c758d 100644 --- a/packages/rs-platform-serialization/src/enc/mod.rs +++ b/packages/rs-platform-serialization/src/enc/mod.rs @@ -12,6 +12,9 @@ pub(crate) struct VecWriter { impl VecWriter { /// Create a new vec writer with the given capacity + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub fn with_capacity(cap: usize) -> Self { Self { inner: Vec::with_capacity(cap), @@ -19,6 +22,8 @@ impl VecWriter { } // May not be used in all feature combinations #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub(crate) fn collect(self) -> Vec { self.inner } diff --git a/packages/rs-platform-serialization/src/features/impl_alloc.rs b/packages/rs-platform-serialization/src/features/impl_alloc.rs index 79eeb5b6410..dea7ca64f6c 100644 --- a/packages/rs-platform-serialization/src/features/impl_alloc.rs +++ b/packages/rs-platform-serialization/src/features/impl_alloc.rs @@ -335,8 +335,7 @@ where if core::any::TypeId::of::() == core::any::TypeId::of::() { decoder.claim_container_read::(len)?; // optimize for reading u8 vecs - let mut vec = Vec::new(); - vec.resize(len, 0u8); + let mut vec = vec![0u8; len]; decoder.reader().read(&mut vec)?; // Safety: Vec is Vec return Ok(unsafe { core::mem::transmute(vec) }); diff --git a/packages/rs-platform-serialization/src/features/impl_std.rs b/packages/rs-platform-serialization/src/features/impl_std.rs index 119fe7dce0c..8f2f00ad6a7 100644 --- a/packages/rs-platform-serialization/src/features/impl_std.rs +++ b/packages/rs-platform-serialization/src/features/impl_std.rs @@ -14,7 +14,6 @@ use std::{ collections::{HashMap, HashSet}, ffi::{CStr, CString}, hash::Hash, - io::Read, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}, path::{Path, PathBuf}, sync::{Mutex, RwLock}, @@ -27,6 +26,9 @@ use std::{ /// /// [config]: config/index.html #[cfg_attr(docsrs, doc(cfg(feature = "std")))] +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub fn platform_versioned_decode_from_std_read( src: &mut R, config: C, @@ -41,6 +43,9 @@ pub(crate) struct IoReader { } impl IoReader { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub fn new(reader: R) -> Self { Self { reader } } @@ -67,6 +72,9 @@ where /// /// [config]: config/index.html #[cfg_attr(docsrs, doc(cfg(feature = "std")))] +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub fn encode_into_std_write( val: E, dst: &mut W, @@ -84,13 +92,18 @@ pub(crate) struct IoWriter<'a, W: std::io::Write> { } impl<'a, W: std::io::Write> IoWriter<'a, W> { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub fn new(writer: &'a mut W) -> Self { Self { writer, bytes_written: 0, } } - + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub fn bytes_written(&self) -> usize { self.bytes_written } diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index a1e891a1a2f..2339afce87b 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,11 +2,10 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -private = true [lib] proc-macro = true diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 123454bcafd..dfa51e74bf5 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,23 +2,22 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -private = true [dependencies] bincode = { version = "2.0.0-rc.3", features = ["serde"] } -ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" } -thiserror = "1.0.30" -bs58 = "0.4.0" -base64 = "0.13.0" +ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined", optional = true } +thiserror = "1.0.58" +bs58 = "0.5.1" +base64 = "0.22.1" hex = "0.4.3" -serde = { version = "1.0.152", features = ["derive"] } -serde_json = { version = "1.0", features = ["preserve_order"] } +serde = { version = "1.0.197", features = ["derive"] } +serde_json = { version = "1.0", features = ["preserve_order"], optional = true } rand = { version = "0.8.4", features = ["small_rng"] } -treediff = "4.0.2" +treediff = "5.0.0" regex = "1.7.1" lazy_static = "1.4.0" platform-serialization = { path = "../rs-platform-serialization" } @@ -29,5 +28,7 @@ indexmap = "2.0.2" [features] default = ["std"] +cbor = ["ciborium"] +json = ["serde_json"] std = ["serde/std"] diff --git a/packages/rs-platform-value/src/btreemap_extensions/btreemap_field_replacement.rs b/packages/rs-platform-value/src/btreemap_extensions/btreemap_field_replacement.rs index 8424b50f7c0..c4e1f2fc1d4 100644 --- a/packages/rs-platform-value/src/btreemap_extensions/btreemap_field_replacement.rs +++ b/packages/rs-platform-value/src/btreemap_extensions/btreemap_field_replacement.rs @@ -2,6 +2,8 @@ use crate::value_map::ValueMapHelper; use crate::{Error, Value}; use std::collections::BTreeMap; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use std::iter::Peekable; use std::vec::IntoIter; @@ -56,7 +58,7 @@ impl ReplacementType { } ReplacementType::BinaryBytes => Ok(Value::Bytes(bytes)), ReplacementType::TextBase58 => Ok(Value::Text(bs58::encode(bytes).into_string())), - ReplacementType::TextBase64 => Ok(Value::Text(base64::encode(bytes))), + ReplacementType::TextBase64 => Ok(Value::Text(BASE64_STANDARD.encode(bytes))), } } @@ -64,7 +66,7 @@ impl ReplacementType { match self { ReplacementType::BinaryBytes => Ok(Value::Bytes20(bytes)), ReplacementType::TextBase58 => Ok(Value::Text(bs58::encode(bytes).into_string())), - ReplacementType::TextBase64 => Ok(Value::Text(base64::encode(bytes))), + ReplacementType::TextBase64 => Ok(Value::Text(BASE64_STANDARD.encode(bytes))), _ => Err(Error::ByteLengthNot36BytesError( "trying to replace 36 bytes into an identifier".to_string(), )), @@ -76,7 +78,7 @@ impl ReplacementType { ReplacementType::Identifier => Ok(Value::Identifier(bytes)), ReplacementType::BinaryBytes => Ok(Value::Bytes32(bytes)), ReplacementType::TextBase58 => Ok(Value::Text(bs58::encode(bytes).into_string())), - ReplacementType::TextBase64 => Ok(Value::Text(base64::encode(bytes))), + ReplacementType::TextBase64 => Ok(Value::Text(BASE64_STANDARD.encode(bytes))), } } @@ -84,7 +86,7 @@ impl ReplacementType { match self { ReplacementType::BinaryBytes => Ok(Value::Bytes36(bytes)), ReplacementType::TextBase58 => Ok(Value::Text(bs58::encode(bytes).into_string())), - ReplacementType::TextBase64 => Ok(Value::Text(base64::encode(bytes))), + ReplacementType::TextBase64 => Ok(Value::Text(BASE64_STANDARD.encode(bytes))), _ => Err(Error::ByteLengthNot36BytesError( "trying to replace 36 bytes into an identifier".to_string(), )), diff --git a/packages/rs-platform-value/src/btreemap_extensions/btreemap_path_extensions.rs b/packages/rs-platform-value/src/btreemap_extensions/btreemap_path_extensions.rs index dbb2caaf58e..e104e15e6c2 100644 --- a/packages/rs-platform-value/src/btreemap_extensions/btreemap_path_extensions.rs +++ b/packages/rs-platform-value/src/btreemap_extensions/btreemap_path_extensions.rs @@ -1,9 +1,12 @@ +#[cfg(feature = "json")] use serde_json::Value as JsonValue; use std::borrow::Borrow; use std::convert::TryFrom; use std::iter::FromIterator; -use std::{collections::BTreeMap, convert::TryInto}; +use std::collections::BTreeMap; +#[cfg(feature = "json")] +use std::convert::TryInto; use crate::value_map::ValueMapHelper; use crate::{Error, Identifier, Value}; @@ -73,10 +76,12 @@ pub trait BTreeValueMapPathHelper { &'a self, path: &str, ) -> Result; + #[cfg(feature = "json")] fn get_optional_inner_str_json_value_map_at_path>( &self, path: &str, ) -> Result, Error>; + #[cfg(feature = "json")] fn get_inner_str_json_value_map_at_path>( &self, path: &str, @@ -179,7 +184,7 @@ where fn get_optional_identifier_at_path(&self, path: &str) -> Result, Error> { self.get_optional_at_path(path)? - .map(|v| v.borrow().to_hash256()) + .map(|v| v.to_hash256()) .transpose() } @@ -192,8 +197,7 @@ where fn get_optional_string_at_path(&self, path: &str) -> Result, Error> { self.get_optional_at_path(path)? .map(|v| { - v.borrow() - .as_text() + v.as_text() .map(|str| str.to_string()) .ok_or_else(|| Error::StructureError(format!("{path} must be a string"))) }) @@ -208,8 +212,7 @@ where fn get_optional_str_at_path(&self, path: &str) -> Result, Error> { self.get_optional_at_path(path)? .map(|v| { - v.borrow() - .as_text() + v.as_text() .ok_or_else(|| Error::StructureError(format!("{path} must be a string"))) }) .transpose() @@ -235,11 +238,10 @@ where { self.get_optional_at_path(path)? .and_then(|v| { - let borrowed = v.borrow(); - if borrowed.is_null() { + if v.is_null() { None } else { - Some(v.borrow().to_integer()) + Some(v.to_integer()) } }) .transpose() @@ -307,14 +309,7 @@ where fn get_optional_bool_at_path(&self, path: &str) -> Result, Error> { self.get_optional_at_path(path)? - .and_then(|v| { - let borrowed = v.borrow(); - if borrowed.is_null() { - None - } else { - Some(v.borrow().to_bool()) - } - }) + .and_then(|v| if v.is_null() { None } else { Some(v.to_bool()) }) .transpose() } @@ -329,8 +324,7 @@ where ) -> Result, Error> { self.get_optional_at_path(path)? .map(|v| { - v.borrow() - .as_array() + v.as_array() .map(|vec| vec.iter().collect()) .ok_or_else(|| Error::StructureError(format!("{path} must be a bool"))) }) @@ -353,8 +347,7 @@ where ) -> Result, Error> { self.get_optional_at_path(path)? .map(|v| { - v.borrow() - .as_array() + v.as_array() .map(|inner| { inner .iter() @@ -390,8 +383,7 @@ where ) -> Result>, Error> { self.get_optional_at_path(path)? .map(|v| { - v.borrow() - .as_map() + v.as_map() .ok_or_else(|| Error::StructureError(format!("{path} must be a map"))) }) .transpose() @@ -406,8 +398,7 @@ where ) -> Result, Error> { self.get_optional_at_path(path)? .map(|v| { - v.borrow() - .as_map() + v.as_map() .map(|inner| { inner .iter() @@ -432,14 +423,14 @@ where }) } + #[cfg(feature = "json")] fn get_optional_inner_str_json_value_map_at_path>( &self, path: &str, ) -> Result, Error> { self.get_optional_at_path(path)? .map(|v| { - v.borrow() - .as_map() + v.as_map() .map(|inner| { inner .iter() @@ -452,6 +443,7 @@ where .transpose() } + #[cfg(feature = "json")] fn get_inner_str_json_value_map_at_path>( &self, path: &str, @@ -466,7 +458,7 @@ where fn get_optional_hash256_bytes_at_path(&self, path: &str) -> Result, Error> { self.get_optional_at_path(path)? - .map(|v| v.borrow().to_hash256()) + .map(|v| v.to_hash256()) .transpose() } @@ -477,7 +469,7 @@ where fn get_optional_bytes_at_path(&self, path: &str) -> Result>, Error> { self.get_optional_at_path(path)? - .map(|v| v.borrow().to_bytes()) + .map(|v| v.to_bytes()) .transpose() } @@ -489,7 +481,7 @@ where fn get_optional_identifier_bytes_at_path(&self, path: &str) -> Result>, Error> { self.get_optional_at_path(path)? - .map(|v| v.borrow().to_identifier_bytes()) + .map(|v| v.to_identifier_bytes()) .transpose() } @@ -502,7 +494,7 @@ where fn get_optional_binary_bytes_at_path(&self, path: &str) -> Result>, Error> { self.get_optional_at_path(path)? - .map(|v| v.borrow().to_binary_bytes()) + .map(|v| v.to_binary_bytes()) .transpose() } @@ -576,11 +568,10 @@ where fn get_optional_float_at_path(&self, path: &str) -> Result, Error> { self.get_optional_at_path(path)? .and_then(|v| { - let borrowed = v.borrow(); - if borrowed.is_null() { + if v.is_null() { None } else { - Some(v.borrow().to_float()) + Some(v.to_float()) } }) .transpose() diff --git a/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_extensions.rs b/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_extensions.rs index d1c4dd28656..8b2b2daa250 100644 --- a/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_extensions.rs +++ b/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_extensions.rs @@ -48,6 +48,28 @@ pub trait BTreeValueRemoveFromMapHelper { fn remove_hash256s(&mut self, key: &str) -> Result, Error>; fn remove_identifiers(&mut self, key: &str) -> Result, Error>; fn remove_optional_identifiers(&mut self, key: &str) -> Result>, Error>; + fn remove_map_as_btree_map(&mut self, key: &str) -> Result, Error> + where + K: TryFrom + Ord, + V: TryFrom; + fn remove_optional_map_as_btree_map( + &mut self, + key: &str, + ) -> Result>, Error> + where + K: TryFrom + Ord, + V: TryFrom; +} + +pub trait BTreeValueRemoveTupleFromMapHelper { + fn remove_tuple(&mut self, key: &str) -> Result<(K, V), Error> + where + K: TryFrom + Ord, + V: TryFrom; + fn remove_optional_tuple(&mut self, key: &str) -> Result, Error> + where + K: TryFrom + Ord, + V: TryFrom; } impl BTreeValueRemoveFromMapHelper for BTreeMap { @@ -283,6 +305,42 @@ impl BTreeValueRemoveFromMapHelper for BTreeMap { }) .transpose() } + + fn remove_map_as_btree_map(&mut self, key: &str) -> Result, Error> + where + K: TryFrom + Ord, + V: TryFrom, + { + self.remove_optional_map_as_btree_map(key)? + .ok_or_else(|| Error::StructureError(format!("unable to remove map property {key}"))) + } + + fn remove_optional_map_as_btree_map( + &mut self, + key: &str, + ) -> Result>, Error> + where + K: TryFrom + Ord, + V: TryFrom, + { + self.remove(key) + .and_then(|v| { + if v.is_null() { + None + } else if let Value::Map(map) = v { + Some( + map.iter() + .map(|(key, value)| { + Ok((key.clone().try_into()?, value.clone().try_into()?)) + }) + .collect(), + ) + } else { + None + } + }) + .transpose() + } } impl BTreeValueRemoveFromMapHelper for BTreeMap { @@ -529,4 +587,83 @@ impl BTreeValueRemoveFromMapHelper for BTreeMap { }) .transpose() } + + fn remove_map_as_btree_map(&mut self, key: &str) -> Result, Error> + where + K: TryFrom + Ord, + V: TryFrom, + { + self.remove_optional_map_as_btree_map(key)? + .ok_or_else(|| Error::StructureError(format!("unable to remove map property {key}"))) + } + + fn remove_optional_map_as_btree_map( + &mut self, + key: &str, + ) -> Result>, Error> + where + K: TryFrom + Ord, + V: TryFrom, + { + self.remove(key) + .and_then(|v| { + if v.is_null() { + None + } else if let Value::Map(map) = v { + Some( + map.into_iter() + .map(|(key, value)| Ok((key.try_into()?, value.try_into()?))) + .collect(), + ) + } else { + None + } + }) + .transpose() + } +} + +impl BTreeValueRemoveTupleFromMapHelper for BTreeMap { + fn remove_tuple(&mut self, key: &str) -> Result<(K, V), Error> + where + K: TryFrom + Ord, + V: TryFrom, + { + self.remove_optional_tuple(key)? + .ok_or_else(|| Error::StructureError(format!("unable to remove tuple property {key}"))) + } + + fn remove_optional_tuple(&mut self, key: &str) -> Result, Error> + where + K: TryFrom + Ord, + V: TryFrom, + { + self.remove(key) + .and_then(|v| { + if v.is_null() { + None + } else if let Value::Array(mut arr) = v { + if arr.len() == 2 { + let key_value = match arr.remove(0).try_into() { + Ok(key_value) => key_value, + Err(e) => return Some(Err(e)), + }; + let value_value: V = match arr.remove(1).try_into() { + Ok(key_value) => key_value, + Err(e) => return Some(Err(e)), + }; + Some(Ok((key_value, value_value))) + } else { + Some(Err(Error::StructureError(format!( + "Value for key {key} is not a tuple of length 2" + )))) + } + } else { + Some(Err(Error::StructureError(format!( + "Value for key {key} is not an array" + )))) + } + }) + .transpose() + } } diff --git a/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_inner_value_extensions.rs b/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_inner_value_extensions.rs index 7af5130201c..240f3a60d0a 100644 --- a/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_inner_value_extensions.rs +++ b/packages/rs-platform-value/src/btreemap_extensions/btreemap_removal_inner_value_extensions.rs @@ -7,6 +7,15 @@ pub trait BTreeValueRemoveInnerValueFromMapHelper { key: &str, ) -> Result, Error>; fn remove_inner_value_array>(&mut self, key: &str) -> Result; + + fn remove_optional_inner_value_map>( + &mut self, + key: &str, + ) -> Result, Error>; + fn remove_inner_value_map>( + &mut self, + key: &str, + ) -> Result; } impl BTreeValueRemoveInnerValueFromMapHelper for BTreeMap { @@ -20,7 +29,26 @@ impl BTreeValueRemoveInnerValueFromMapHelper for BTreeMap { } fn remove_inner_value_array>(&mut self, key: &str) -> Result { - self.remove_optional_inner_value_array(key)? - .ok_or_else(|| Error::StructureError(format!("unable to remove float property {key}"))) + self.remove_optional_inner_value_array(key)?.ok_or_else(|| { + Error::StructureError(format!("unable to remove inner value array property {key}")) + }) + } + + fn remove_optional_inner_value_map>( + &mut self, + key: &str, + ) -> Result, Error> { + self.remove(key) + .map(|v| v.into_map().map(|vec| vec.into_iter().collect())) + .transpose() + } + + fn remove_inner_value_map>( + &mut self, + key: &str, + ) -> Result { + self.remove_optional_inner_value_map(key)?.ok_or_else(|| { + Error::StructureError(format!("unable to remove inner value map property {key}")) + }) } } diff --git a/packages/rs-platform-value/src/btreemap_extensions/mod.rs b/packages/rs-platform-value/src/btreemap_extensions/mod.rs index 8660ca99396..1f84c53d03d 100644 --- a/packages/rs-platform-value/src/btreemap_extensions/mod.rs +++ b/packages/rs-platform-value/src/btreemap_extensions/mod.rs @@ -1,8 +1,11 @@ +#[cfg(feature = "json")] use serde_json::Value as JsonValue; use std::borrow::Borrow; +use std::collections::BTreeMap; use std::convert::TryFrom; +#[cfg(feature = "json")] +use std::convert::TryInto; use std::iter::FromIterator; -use std::{collections::BTreeMap, convert::TryInto}; use crate::{BinaryData, Error, Identifier, Value, ValueMap}; @@ -18,6 +21,7 @@ pub use btreemap_mut_value_extensions::BTreeMutValueMapHelper; pub use btreemap_path_extensions::BTreeValueMapPathHelper; pub use btreemap_path_insertion_extensions::BTreeValueMapInsertionPathHelper; pub use btreemap_removal_extensions::BTreeValueRemoveFromMapHelper; +pub use btreemap_removal_extensions::BTreeValueRemoveTupleFromMapHelper; pub use btreemap_removal_inner_value_extensions::BTreeValueRemoveInnerValueFromMapHelper; pub trait BTreeValueMapHelper { @@ -89,10 +93,12 @@ pub trait BTreeValueMapHelper { &'a self, key: &str, ) -> Result; + #[cfg(feature = "json")] fn get_optional_inner_str_json_value_map>( &self, key: &str, ) -> Result, Error>; + #[cfg(feature = "json")] fn get_inner_str_json_value_map>( &self, key: &str, @@ -356,6 +362,7 @@ where }) } + #[cfg(feature = "json")] fn get_optional_inner_str_json_value_map>( &self, key: &str, @@ -377,6 +384,7 @@ where .transpose() } + #[cfg(feature = "json")] fn get_inner_str_json_value_map>( &self, key: &str, diff --git a/packages/rs-platform-value/src/converter/ciborium.rs b/packages/rs-platform-value/src/converter/ciborium.rs index 8703fed88b9..d6f0b8247b3 100644 --- a/packages/rs-platform-value/src/converter/ciborium.rs +++ b/packages/rs-platform-value/src/converter/ciborium.rs @@ -129,8 +129,16 @@ impl TryInto for Value { ) } Value::Identifier(bytes) => CborValue::Bytes(bytes.to_vec()), - Value::EnumU8(_) => todo!(), - Value::EnumString(_) => todo!(), + Value::EnumU8(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumU8 to JSONValue".to_string(), + )) + } + Value::EnumString(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumString to JSONValue".to_string(), + )) + } }) } } diff --git a/packages/rs-platform-value/src/converter/mod.rs b/packages/rs-platform-value/src/converter/mod.rs index 02cf95f907a..10734da70ff 100644 --- a/packages/rs-platform-value/src/converter/mod.rs +++ b/packages/rs-platform-value/src/converter/mod.rs @@ -1,2 +1,4 @@ +#[cfg(feature = "cbor")] pub mod ciborium; +#[cfg(feature = "json")] pub mod serde_json; diff --git a/packages/rs-platform-value/src/converter/serde_json.rs b/packages/rs-platform-value/src/converter/serde_json.rs index f064c831d4b..43f90ea8756 100644 --- a/packages/rs-platform-value/src/converter/serde_json.rs +++ b/packages/rs-platform-value/src/converter/serde_json.rs @@ -1,5 +1,7 @@ use crate::value_map::ValueMap; use crate::{Error, Value}; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use serde_json::{Map, Number, Value as JsonValue}; use std::collections::BTreeMap; @@ -90,8 +92,16 @@ impl Value { .map(|byte| JsonValue::Number(byte.into())) .collect(), ), - Value::EnumU8(_) => todo!(), - Value::EnumString(_) => todo!(), + Value::EnumU8(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumU8 to JSONValue".to_string(), + )) + } + Value::EnumString(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumString to JSONValue".to_string(), + )) + } }) } @@ -178,8 +188,16 @@ impl Value { .map(|byte| JsonValue::Number((*byte).into())) .collect(), ), - Value::EnumU8(_) => todo!(), - Value::EnumString(_) => todo!(), + Value::EnumU8(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumU8 to JSONValue".to_string(), + )) + } + Value::EnumString(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumString to JSONValue".to_string(), + )) + } }) } } @@ -294,10 +312,10 @@ impl TryInto for Value { Value::I16(i) => JsonValue::Number(i.into()), Value::U8(i) => JsonValue::Number(i.into()), Value::I8(i) => JsonValue::Number(i.into()), - Value::Bytes(bytes) => JsonValue::String(base64::encode(bytes.as_slice())), - Value::Bytes20(bytes) => JsonValue::String(base64::encode(bytes.as_slice())), - Value::Bytes32(bytes) => JsonValue::String(base64::encode(bytes.as_slice())), - Value::Bytes36(bytes) => JsonValue::String(base64::encode(bytes.as_slice())), + Value::Bytes(bytes) => JsonValue::String(BASE64_STANDARD.encode(bytes.as_slice())), + Value::Bytes20(bytes) => JsonValue::String(BASE64_STANDARD.encode(bytes.as_slice())), + Value::Bytes32(bytes) => JsonValue::String(BASE64_STANDARD.encode(bytes.as_slice())), + Value::Bytes36(bytes) => JsonValue::String(BASE64_STANDARD.encode(bytes.as_slice())), Value::Float(float) => JsonValue::Number(Number::from_f64(float).unwrap_or(0.into())), Value::Text(string) => JsonValue::String(string), Value::Bool(value) => JsonValue::Bool(value), @@ -319,8 +337,16 @@ impl TryInto for Value { Value::Identifier(bytes) => { JsonValue::String(bs58::encode(bytes.as_slice()).into_string()) } - Value::EnumU8(_) => todo!(), - Value::EnumString(_) => todo!(), + Value::EnumU8(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumU8 to JSONValue".to_string(), + )) + } + Value::EnumString(_) => { + return Err(Error::Unsupported( + "No support for conversion of EnumString to JSONValue".to_string(), + )) + } }) } } @@ -413,7 +439,6 @@ mod tests { "revision": 0, "signature": "HxtcTSpRdACokorvpx/f4ezM40e0WtgW2GUvjiwNkHPwKDppkIoS2cirhqpZURlhDuYdu+E0KllbHNlYghcK9Bg=", "signaturePublicKeyId": 1, - "publicKeysDisabledAt": 1234567, "addPublicKeys": [ { "id": 0, @@ -435,7 +460,7 @@ mod tests { .expect("expected to get array slice") .unwrap(); assert_eq!(array.len(), 1); - assert!(array.get(0).unwrap().is_map()); + assert!(array.first().unwrap().is_map()); let array = value .get_optional_array_slice("disablePublicKeys") .expect("expected to get array slice") diff --git a/packages/rs-platform-value/src/display.rs b/packages/rs-platform-value/src/display.rs index 273029f7fca..e7807fbdf63 100644 --- a/packages/rs-platform-value/src/display.rs +++ b/packages/rs-platform-value/src/display.rs @@ -1,4 +1,6 @@ use crate::Value; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use std::fmt::{Display, Formatter}; impl Display for Value { @@ -45,15 +47,21 @@ impl Value { Value::I16(i) => format!("{}", i), Value::U8(i) => format!("{}", i), Value::I8(i) => format!("{}", i), - Value::Bytes20(bytes20) => format!("bytes20 {}", base64::encode(bytes20.as_slice())), - Value::Bytes32(bytes32) => format!("bytes32 {}", base64::encode(bytes32.as_slice())), - Value::Bytes36(bytes36) => format!("bytes36 {}", base64::encode(bytes36.as_slice())), + Value::Bytes20(bytes20) => { + format!("bytes20 {}", BASE64_STANDARD.encode(bytes20.as_slice())) + } + Value::Bytes32(bytes32) => { + format!("bytes32 {}", BASE64_STANDARD.encode(bytes32.as_slice())) + } + Value::Bytes36(bytes36) => { + format!("bytes36 {}", BASE64_STANDARD.encode(bytes36.as_slice())) + } Value::Identifier(identifier) => format!( "identifier {}", bs58::encode(identifier.as_slice()).into_string() ), - Value::EnumU8(_) => todo!(), - Value::EnumString(_) => todo!(), + Value::EnumU8(_) => "enum u8".to_string(), + Value::EnumString(_) => "enum string".to_string(), } } @@ -102,15 +110,21 @@ impl Value { Value::I16(i) => format!("(i16){}", i), Value::U8(i) => format!("(u8){}", i), Value::I8(i) => format!("(i8){}", i), - Value::Bytes20(bytes20) => format!("bytes20 {}", base64::encode(bytes20.as_slice())), - Value::Bytes32(bytes32) => format!("bytes32 {}", base64::encode(bytes32.as_slice())), - Value::Bytes36(bytes36) => format!("bytes36 {}", base64::encode(bytes36.as_slice())), + Value::Bytes20(bytes20) => { + format!("bytes20 {}", BASE64_STANDARD.encode(bytes20.as_slice())) + } + Value::Bytes32(bytes32) => { + format!("bytes32 {}", BASE64_STANDARD.encode(bytes32.as_slice())) + } + Value::Bytes36(bytes36) => { + format!("bytes36 {}", BASE64_STANDARD.encode(bytes36.as_slice())) + } Value::Identifier(identifier) => format!( "identifier {}", bs58::encode(identifier.as_slice()).into_string() ), - Value::EnumU8(_) => todo!(), - Value::EnumString(_) => todo!(), + Value::EnumU8(_) => "enum u8".to_string(), + Value::EnumString(_) => "enum string".to_string(), } } } diff --git a/packages/rs-platform-value/src/inner_value.rs b/packages/rs-platform-value/src/inner_value.rs index 9d6dc182a9d..c92828e91c0 100644 --- a/packages/rs-platform-value/src/inner_value.rs +++ b/packages/rs-platform-value/src/inner_value.rs @@ -79,7 +79,7 @@ impl Value { map.remove_key(key) } - pub fn remove_many(&mut self, keys: &Vec<&str>) -> Result<(), Error> { + pub fn remove_many(&mut self, keys: &[&str]) -> Result<(), Error> { let map = self.as_map_mut_ref()?; keys.iter() .try_for_each(|key| map.remove_key(key).map(|_| ())) @@ -646,7 +646,7 @@ impl Value { Ok(None) } - /// Gets the inner index map sorted my a special + /// Gets the inner index map sorted by a specified property pub fn inner_optional_index_map<'a, T>( document_type: &'a [(Value, Value)], key: &'a str, diff --git a/packages/rs-platform-value/src/inner_value_at_path.rs b/packages/rs-platform-value/src/inner_value_at_path.rs index 885f76a4912..d98dc7cc6b8 100644 --- a/packages/rs-platform-value/src/inner_value_at_path.rs +++ b/packages/rs-platform-value/src/inner_value_at_path.rs @@ -333,18 +333,22 @@ impl Value { )); }; // We are setting the value of just member of the array - if number_part < array.len() { - //this already exists - current_value = array.get_mut(number_part).unwrap() - } else if array.len() == number_part { - //we should create a new map - array.push(Value::Map(ValueMap::new())); - current_value = array.get_mut(number_part).unwrap(); - } else { - return Err(Error::StructureError( - "trying to insert into an array path higher than current array length" - .to_string(), - )); + match number_part.cmp(&array.len()) { + std::cmp::Ordering::Less => { + //this already exists + current_value = array.get_mut(number_part).unwrap(); + } + std::cmp::Ordering::Equal => { + //we should create a new map + array.push(Value::Map(ValueMap::new())); + current_value = array.get_mut(number_part).unwrap(); + } + std::cmp::Ordering::Greater => { + return Err(Error::StructureError( + "trying to insert into an array path higher than current array length" + .to_string(), + )); + } } } else { let map = current_value.to_map_mut()?; diff --git a/packages/rs-platform-value/src/lib.rs b/packages/rs-platform-value/src/lib.rs index 420504ff437..ea3530a3f40 100644 --- a/packages/rs-platform-value/src/lib.rs +++ b/packages/rs-platform-value/src/lib.rs @@ -1264,6 +1264,180 @@ impl Value { _other => Err(Error::StructureError("value is not a map".to_string())), } } + + /// can determine if there is any very big data in a value + pub fn has_data_larger_than(&self, size: u32) -> Option<(Option, u32)> { + match self { + Value::U128(_) => { + if size < 16 { + Some((None, 16)) + } else { + None + } + } + Value::I128(_) => { + if size < 16 { + Some((None, 16)) + } else { + None + } + } + Value::U64(_) => { + if size < 8 { + Some((None, 8)) + } else { + None + } + } + Value::I64(_) => { + if size < 8 { + Some((None, 8)) + } else { + None + } + } + Value::U32(_) => { + if size < 4 { + Some((None, 4)) + } else { + None + } + } + Value::I32(_) => { + if size < 4 { + Some((None, 4)) + } else { + None + } + } + Value::U16(_) => { + if size < 2 { + Some((None, 2)) + } else { + None + } + } + Value::I16(_) => { + if size < 2 { + Some((None, 2)) + } else { + None + } + } + Value::U8(_) => { + if size < 1 { + Some((None, 1)) + } else { + None + } + } + Value::I8(_) => { + if size < 1 { + Some((None, 1)) + } else { + None + } + } + Value::Bytes(bytes) => { + if (size as usize) < bytes.len() { + Some((None, bytes.len() as u32)) + } else { + None + } + } + Value::Bytes20(_) => { + if size < 20 { + Some((None, 20)) + } else { + None + } + } + Value::Bytes32(_) => { + if size < 32 { + Some((None, 32)) + } else { + None + } + } + Value::Bytes36(_) => { + if size < 36 { + Some((None, 36)) + } else { + None + } + } + Value::EnumU8(_) => { + if size < 1 { + Some((None, 1)) + } else { + None + } + } + Value::EnumString(strings) => { + let max_len = strings.iter().map(|string| string.as_bytes().len()).max(); + if let Some(max) = max_len { + if max > size as usize { + Some((None, max as u32)) + } else { + None + } + } else { + None + } + } + Value::Identifier(_) => { + if size < 32 { + Some((None, 32)) + } else { + None + } + } + Value::Float(_) => { + if size < 8 { + Some((None, 8)) + } else { + None + } + } + Value::Text(string) => { + if string.as_bytes().len() > size as usize { + Some((None, string.as_bytes().len() as u32)) + } else { + None + } + } + Value::Bool(_) => { + if size < 1 { + Some((None, 1)) + } else { + None + } + } + Value::Null => { + if size < 1 { + Some((None, 1)) + } else { + None + } + } + Value::Array(values) => { + for value in values { + if let Some(result) = value.has_data_larger_than(size) { + return Some((Some(value.clone()), result.1)); + } + } + None + } + Value::Map(map) => { + for (key, value) in map { + if let Some(result) = value.has_data_larger_than(size) { + return Some((Some(key.clone()), result.1)); + } + } + None + } + } + } } macro_rules! implfrom { @@ -1282,11 +1456,11 @@ macro_rules! implfrom { macro_rules! impltryinto { ($($t:ty),+ $(,)?) => { $( - impl TryInto<$t> for Value { + impl TryFrom for $t { type Error = Error; #[inline] - fn try_into(self) -> Result<$t, Self::Error> { - self.to_integer() + fn try_from(value: Value) -> Result { + value.to_integer() } } )+ @@ -1493,19 +1667,18 @@ impl From<&[&str]> for Value { ) } } - -impl TryInto> for Value { +impl TryFrom for Vec { type Error = Error; - fn try_into(self) -> Result, Self::Error> { - self.to_bytes() + fn try_from(value: Value) -> Result { + value.into_bytes() } } -impl TryInto for Value { +impl TryFrom for String { type Error = Error; - fn try_into(self) -> Result { - self.into_text() + fn try_from(value: Value) -> Result { + value.into_text() } } diff --git a/packages/rs-platform-value/src/pointer.rs b/packages/rs-platform-value/src/pointer.rs index 79cbd5b2c1f..fa42add829e 100644 --- a/packages/rs-platform-value/src/pointer.rs +++ b/packages/rs-platform-value/src/pointer.rs @@ -71,24 +71,22 @@ impl Value { /// ``` /// use platform_value::Value; /// - /// fn main() { - /// use platform_value::platform_value; - /// let mut value: Value = platform_value!({"x": 1.0, "y": 2.0}); + /// use platform_value::platform_value; + /// let mut value: Value = platform_value!({"x": 1.0, "y": 2.0}); /// - /// // Check value using read-only pointer - /// assert_eq!(value.pointer("/x"), Some(&1.0.into())); - /// // Change value with direct assignment - /// *value.pointer_mut("/x").unwrap() = 1.5.into(); - /// // Check that new value was written - /// assert_eq!(value.pointer("/x"), Some(&1.5.into())); - /// // Or change the value only if it exists - /// value.pointer_mut("/x").map(|v| *v = 1.5.into()); + /// // Check value using read-only pointer + /// assert_eq!(value.pointer("/x"), Some(&1.0.into())); + /// // Change value with direct assignment + /// *value.pointer_mut("/x").unwrap() = 1.5.into(); + /// // Check that new value was written + /// assert_eq!(value.pointer("/x"), Some(&1.5.into())); + /// // Or change the value only if it exists + /// value.pointer_mut("/x").map(|v| *v = 1.5.into()); /// - /// // "Steal" ownership of a value. Can replace with any valid Value. - /// let old_x = value.pointer_mut("/x").map(Value::take).unwrap(); - /// assert_eq!(old_x, 1.5); - /// assert_eq!(value.pointer("/x").unwrap(), &Value::Null); - /// } + /// // "Steal" ownership of a value. Can replace with any valid Value. + /// let old_x = value.pointer_mut("/x").map(Value::take).unwrap(); + /// assert_eq!(old_x, 1.5); + /// assert_eq!(value.pointer("/x").unwrap(), &Value::Null); /// ``` pub fn pointer_mut(&mut self, pointer: &str) -> Option<&mut Value> { if pointer.is_empty() { diff --git a/packages/rs-platform-value/src/string_encoding.rs b/packages/rs-platform-value/src/string_encoding.rs index f411e2b3754..c31d1728393 100644 --- a/packages/rs-platform-value/src/string_encoding.rs +++ b/packages/rs-platform-value/src/string_encoding.rs @@ -1,5 +1,7 @@ use crate::Error; use base64; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use bs58; pub enum Encoding { @@ -13,10 +15,9 @@ pub fn decode(encoded_value: &str, encoding: Encoding) -> Result, Error> Encoding::Base58 => Ok(bs58::decode(encoded_value) .into_vec() .map_err(|e| Error::StringDecodingError(e.to_string()))?), - Encoding::Base64 => { - Ok(base64::decode(encoded_value) - .map_err(|e| Error::StringDecodingError(e.to_string()))?) - } + Encoding::Base64 => Ok(BASE64_STANDARD + .decode(encoded_value) + .map_err(|e| Error::StringDecodingError(e.to_string()))?), Encoding::Hex => Ok( hex::decode(encoded_value).map_err(|e| Error::StringDecodingError(e.to_string()))? ), @@ -26,7 +27,7 @@ pub fn decode(encoded_value: &str, encoding: Encoding) -> Result, Error> pub fn encode(value: &[u8], encoding: Encoding) -> String { match encoding { Encoding::Base58 => bs58::encode(value).into_string(), - Encoding::Base64 => base64::encode(value), + Encoding::Base64 => BASE64_STANDARD.encode(value), Encoding::Hex => hex::encode(value), } } diff --git a/packages/rs-platform-value/src/system_bytes.rs b/packages/rs-platform-value/src/system_bytes.rs index 0ffdd7d76ca..d8c95ec3451 100644 --- a/packages/rs-platform-value/src/system_bytes.rs +++ b/packages/rs-platform-value/src/system_bytes.rs @@ -1,5 +1,12 @@ +use base64::engine::{DecodePaddingMode, GeneralPurpose, GeneralPurposeConfig}; +use base64::{alphabet, Engine}; + use crate::{BinaryData, Bytes20, Bytes32, Bytes36, Error, Identifier, Value}; +pub const PADDING_INDIFFERENT: GeneralPurposeConfig = GeneralPurposeConfig::new() + .with_encode_padding(false) + .with_decode_padding_mode(DecodePaddingMode::Indifferent); + impl Value { /// If the `Value` is a `Bytes`, a `Text` using base 58 or Vector of `U8`, returns the /// associated `Vec` data as `Ok`. @@ -117,9 +124,9 @@ impl Value { /// ``` pub fn into_binary_bytes(self) -> Result, Error> { match self { - Value::Text(text) => base64::decode(text).map_err(|_| { + Value::Text(text) => GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT).decode(text).map_err(|e| { Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), + format!("value was a string, but could not be decoded from base 64 into binary bytes, error: {}", e), ) }), Value::Array(array) => array @@ -189,11 +196,14 @@ impl Value { /// ``` pub fn to_binary_bytes(&self) -> Result, Error> { match self { - Value::Text(text) => base64::decode(text).map_err(|_| { - Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), - ) - }), + Value::Text(text) => GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT) + .decode(text) + .map_err(|e| { + Error::StructureError(format!( + "value was a string, but could not be decoded from base 64, error: {}", + e + )) + }), Value::Array(array) => array .iter() .map(|byte| match byte { @@ -344,7 +354,7 @@ impl Value { /// assert_eq!(value.into_bytes_20(), Err(Error::ByteLengthNot20BytesError("buffer was not 20 bytes long".to_string()))); /// /// let value = Value::Text("a811Ii".to_string()); - /// assert_eq!(value.into_bytes_20(), Err(Error::StructureError("value was a string, but could not be decoded from base 64".to_string()))); + /// assert_eq!(value.into_bytes_20(), Err(Error::StructureError("value was a string, but could not be decoded from base 64 into bytes 20, error: Invalid last symbol 105, offset 5.".to_string()))); /// /// let value = Value::Array(vec![Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104)]); /// assert_eq!(value.into_bytes_20(), Ok(Bytes20([104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104]))); @@ -354,9 +364,9 @@ impl Value { /// ``` pub fn into_bytes_20(self) -> Result { match self { - Value::Text(text) => Bytes20::from_vec(base64::decode(text).map_err(|_| { + Value::Text(text) => Bytes20::from_vec(GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT).decode(text).map_err(|e| { Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), + format!("value was a string, but could not be decoded from base 64 into bytes 20, error: {}", e), ) })?), Value::Array(array) => Bytes20::from_vec( @@ -392,7 +402,7 @@ impl Value { /// assert_eq!(value.to_bytes_20(), Err(Error::ByteLengthNot20BytesError("buffer was not 20 bytes long".to_string()))); /// /// let value = Value::Text("a811Ii".to_string()); - /// assert_eq!(value.to_bytes_20(), Err(Error::StructureError("value was a string, but could not be decoded from base 64".to_string()))); + /// assert_eq!(value.to_bytes_20(), Err(Error::StructureError("value was a string, but could not be decoded from base 64 to bytes 20, error: Invalid last symbol 105, offset 5.".to_string()))); /// /// let value = Value::Array(vec![Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104)]); /// assert_eq!(value.to_bytes_20(), Ok(Bytes20([104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104]))); @@ -402,9 +412,9 @@ impl Value { /// ``` pub fn to_bytes_20(&self) -> Result { match self { - Value::Text(text) => Bytes20::from_vec(base64::decode(text).map_err(|_| { + Value::Text(text) => Bytes20::from_vec(GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT).decode(text).map_err(|e| { Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), + format!("value was a string, but could not be decoded from base 64 to bytes 20, error: {}", e), ) })?), Value::Array(array) => Bytes20::from_vec( @@ -440,7 +450,7 @@ impl Value { /// assert_eq!(value.into_bytes_32(), Err(Error::ByteLengthNot32BytesError("buffer was not 32 bytes long".to_string()))); /// /// let value = Value::Text("a811Ii".to_string()); - /// assert_eq!(value.into_bytes_32(), Err(Error::StructureError("value was a string, but could not be decoded from base 64".to_string()))); + /// assert_eq!(value.into_bytes_32(), Err(Error::StructureError("value was a string, but could not be decoded from base 64 into bytes 32, error: Invalid last symbol 105, offset 5.".to_string()))); /// /// let value = Value::Array(vec![Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101)]); /// assert_eq!(value.into_bytes_32(), Ok(Bytes32([104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101]))); @@ -453,9 +463,9 @@ impl Value { /// ``` pub fn into_bytes_32(self) -> Result { match self { - Value::Text(text) => Bytes32::from_vec(base64::decode(text).map_err(|_| { + Value::Text(text) => Bytes32::from_vec(GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT).decode(text).map_err(|e| { Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), + format!("value was a string, but could not be decoded from base 64 into bytes 32, error: {}", e), ) })?), Value::Array(array) => Bytes32::from_vec( @@ -491,7 +501,7 @@ impl Value { /// assert_eq!(value.to_bytes_32(), Err(Error::ByteLengthNot32BytesError("buffer was not 32 bytes long".to_string()))); /// /// let value = Value::Text("a811Ii".to_string()); - /// assert_eq!(value.to_bytes_32(), Err(Error::StructureError("value was a string, but could not be decoded from base 64".to_string()))); + /// assert_eq!(value.to_bytes_32(), Err(Error::StructureError("value was a string, but could not be decoded from base 64 to bytes 32, error: Invalid last symbol 105, offset 5.".to_string()))); /// /// let value = Value::Array(vec![Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101)]); /// assert_eq!(value.to_bytes_32(), Ok(Bytes32::new([104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101]))); @@ -504,9 +514,9 @@ impl Value { /// ``` pub fn to_bytes_32(&self) -> Result { match self { - Value::Text(text) => Bytes32::from_vec(base64::decode(text).map_err(|_| { + Value::Text(text) => Bytes32::from_vec(GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT).decode(text).map_err(|e| { Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), + format!("value was a string, but could not be decoded from base 64 to bytes 32, error: {}", e), ) })?), Value::Array(array) => Bytes32::from_vec( @@ -543,7 +553,7 @@ impl Value { /// assert_eq!(value.into_bytes_36(), Err(Error::ByteLengthNot36BytesError("buffer was not 36 bytes long".to_string()))); /// /// let value = Value::Text("a811Ii".to_string()); - /// assert_eq!(value.into_bytes_36(), Err(Error::StructureError("value was a string, but could not be decoded from base 64".to_string()))); + /// assert_eq!(value.into_bytes_36(), Err(Error::StructureError("value was a string, but could not be decoded from base 64 into bytes 36, error: Invalid last symbol 105, offset 5.".to_string()))); /// /// let value = Value::Array(vec![Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(101), Value::U8(101), Value::U8(101), Value::U8(101)]); /// assert_eq!(value.into_bytes_36(), Ok(Bytes36([104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 101, 101, 101, 101]))); @@ -553,9 +563,9 @@ impl Value { /// ``` pub fn into_bytes_36(self) -> Result { match self { - Value::Text(text) => Bytes36::from_vec(base64::decode(text).map_err(|_| { + Value::Text(text) => Bytes36::from_vec(GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT).decode(text).map_err(|e| { Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), + format!("value was a string, but could not be decoded from base 64 into bytes 36, error: {}", e), ) })?), Value::Array(array) => Bytes36::from_vec( @@ -591,7 +601,7 @@ impl Value { /// assert_eq!(value.to_bytes_36(), Err(Error::ByteLengthNot36BytesError("buffer was not 36 bytes long".to_string()))); /// /// let value = Value::Text("a811Ii".to_string()); - /// assert_eq!(value.to_bytes_36(), Err(Error::StructureError("value was a string, but could not be decoded from base 64".to_string()))); + /// assert_eq!(value.to_bytes_36(), Err(Error::StructureError("value was a string, but could not be decoded from base 64 to bytes 36, error: Invalid last symbol 105, offset 5.".to_string()))); /// /// let value = Value::Array(vec![Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(108),Value::U8(104), Value::U8(101), Value::U8(101), Value::U8(101), Value::U8(101), Value::U8(101)]); /// assert_eq!(value.to_bytes_36(), Ok(Bytes36([104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 108, 104, 101, 101, 101, 101, 101]))); @@ -601,9 +611,9 @@ impl Value { /// ``` pub fn to_bytes_36(&self) -> Result { match self { - Value::Text(text) => Bytes36::from_vec(base64::decode(text).map_err(|_| { + Value::Text(text) => Bytes36::from_vec(GeneralPurpose::new(&alphabet::STANDARD, PADDING_INDIFFERENT).decode(text).map_err(|e| { Error::StructureError( - "value was a string, but could not be decoded from base 64".to_string(), + format!("value was a string, but could not be decoded from base 64 to bytes 36, error: {}", e), ) })?), Value::Array(array) => Bytes36::from_vec( diff --git a/packages/rs-platform-value/src/types/binary_data.rs b/packages/rs-platform-value/src/types/binary_data.rs index cd42cd415c4..538978425a9 100644 --- a/packages/rs-platform-value/src/types/binary_data.rs +++ b/packages/rs-platform-value/src/types/binary_data.rs @@ -1,21 +1,29 @@ use crate::string_encoding::Encoding; use crate::types::encoding_string_to_encoding; use crate::{string_encoding, Error, Value}; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use bincode::{Decode, Encode}; use serde::de::Visitor; use serde::{Deserialize, Serialize}; use std::fmt; -#[derive(Default, Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Encode, Decode)] +#[derive(Default, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Encode, Decode)] pub struct BinaryData(pub Vec); +impl fmt::Debug for BinaryData { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&format!("BinaryData(0x{})", hex::encode(&self.0))) + } +} + impl Serialize for BinaryData { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { if serializer.is_human_readable() { - serializer.serialize_str(&base64::encode(self.0.as_slice())) + serializer.serialize_str(&BASE64_STANDARD.encode(self.0.as_slice())) } else { serializer.serialize_bytes(&self.0) } @@ -41,7 +49,9 @@ impl<'de> Deserialize<'de> for BinaryData { where E: serde::de::Error, { - let bytes = base64::decode(v).map_err(|e| E::custom(format!("{}", e)))?; + let bytes = BASE64_STANDARD + .decode(v) + .map_err(|e| E::custom(format!("{}", e)))?; Ok(BinaryData(bytes)) } } diff --git a/packages/rs-platform-value/src/types/bytes_20.rs b/packages/rs-platform-value/src/types/bytes_20.rs index 16c9af731d8..49c53f64fa2 100644 --- a/packages/rs-platform-value/src/types/bytes_20.rs +++ b/packages/rs-platform-value/src/types/bytes_20.rs @@ -1,6 +1,8 @@ use crate::string_encoding::Encoding; use crate::types::encoding_string_to_encoding; use crate::{string_encoding, Error, Value}; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use bincode::{Decode, Encode}; use serde::de::Visitor; use serde::{Deserialize, Serialize}; @@ -14,6 +16,11 @@ impl AsRef<[u8]> for Bytes20 { &self.0 } } +impl std::fmt::Display for Bytes20 { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.to_string(Encoding::Base58)) + } +} impl Bytes20 { pub fn new(buffer: [u8; 20]) -> Self { @@ -75,7 +82,7 @@ impl Serialize for Bytes20 { S: serde::Serializer, { if serializer.is_human_readable() { - serializer.serialize_str(&base64::encode(self.0)) + serializer.serialize_str(&BASE64_STANDARD.encode(self.0)) } else { serializer.serialize_bytes(&self.0) } @@ -101,7 +108,9 @@ impl<'de> Deserialize<'de> for Bytes20 { where E: serde::de::Error, { - let bytes = base64::decode(v).map_err(|e| E::custom(format!("{}", e)))?; + let bytes = BASE64_STANDARD + .decode(v) + .map_err(|e| E::custom(format!("{}", e)))?; if bytes.len() != 20 { return Err(E::invalid_length(bytes.len(), &self)); } diff --git a/packages/rs-platform-value/src/types/bytes_32.rs b/packages/rs-platform-value/src/types/bytes_32.rs index 077e98ef679..c8139157df0 100644 --- a/packages/rs-platform-value/src/types/bytes_32.rs +++ b/packages/rs-platform-value/src/types/bytes_32.rs @@ -1,6 +1,8 @@ use crate::string_encoding::Encoding; use crate::types::encoding_string_to_encoding; use crate::{string_encoding, Error, Value}; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use bincode::{Decode, Encode}; use rand::rngs::StdRng; use rand::Rng; @@ -77,7 +79,7 @@ impl Serialize for Bytes32 { S: serde::Serializer, { if serializer.is_human_readable() { - serializer.serialize_str(&base64::encode(self.0)) + serializer.serialize_str(&BASE64_STANDARD.encode(self.0)) } else { serializer.serialize_bytes(&self.0) } @@ -103,7 +105,9 @@ impl<'de> Deserialize<'de> for Bytes32 { where E: serde::de::Error, { - let bytes = base64::decode(v).map_err(|e| E::custom(format!("{}", e)))?; + let bytes = BASE64_STANDARD + .decode(v) + .map_err(|e| E::custom(format!("{}", e)))?; if bytes.len() != 32 { return Err(E::invalid_length(bytes.len(), &self)); } diff --git a/packages/rs-platform-value/src/types/bytes_36.rs b/packages/rs-platform-value/src/types/bytes_36.rs index 57cdc91fe16..abf220bec26 100644 --- a/packages/rs-platform-value/src/types/bytes_36.rs +++ b/packages/rs-platform-value/src/types/bytes_36.rs @@ -1,6 +1,8 @@ use crate::string_encoding::Encoding; use crate::types::encoding_string_to_encoding; use crate::{string_encoding, Error, Value}; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use bincode::{Decode, Encode}; use serde::de::Visitor; use serde::{Deserialize, Serialize}; @@ -71,7 +73,7 @@ impl Serialize for Bytes36 { S: serde::Serializer, { if serializer.is_human_readable() { - serializer.serialize_str(&base64::encode(self.0)) + serializer.serialize_str(&BASE64_STANDARD.encode(self.0)) } else { serializer.serialize_bytes(&self.0) } @@ -97,7 +99,9 @@ impl<'de> Deserialize<'de> for Bytes36 { where E: serde::de::Error, { - let bytes = base64::decode(v).map_err(|e| E::custom(format!("{}", e)))?; + let bytes = BASE64_STANDARD + .decode(v) + .map_err(|e| E::custom(format!("{}", e)))?; if bytes.len() != 36 { return Err(E::invalid_length(bytes.len(), &self)); } diff --git a/packages/rs-platform-value/src/types/identifier.rs b/packages/rs-platform-value/src/types/identifier.rs index 012a472dae9..07bdcbd425e 100644 --- a/packages/rs-platform-value/src/types/identifier.rs +++ b/packages/rs-platform-value/src/types/identifier.rs @@ -8,6 +8,7 @@ use std::fmt; use serde::de::Visitor; use serde::{Deserialize, Serialize}; +#[cfg(feature = "json")] use serde_json::Value as JsonValue; use crate::string_encoding::Encoding; @@ -46,6 +47,16 @@ impl platform_serialization::PlatformVersionEncode for Identifier { } } +impl platform_serialization::PlatformVersionedDecode for Identifier { + fn platform_versioned_decode( + decoder: &mut D, + _platform_version: &platform_version::version::PlatformVersion, + ) -> Result { + let bytes = <[u8; 32]>::decode(decoder)?; + Ok(Identifier::new(bytes)) + } +} + impl AsRef<[u8]> for Identifier { fn as_ref(&self) -> &[u8] { &(self.0 .0) @@ -172,7 +183,7 @@ impl Identifier { pub fn from_bytes(bytes: &[u8]) -> Result { if bytes.len() != 32 { return Err(Error::ByteLengthNot32BytesError(String::from( - "Identifier must be 32 bytes long", + "Identifier must be 32 bytes long from bytes", ))); } @@ -180,6 +191,18 @@ impl Identifier { Ok(Identifier::new(bytes.try_into().unwrap())) } + pub fn from_vec(vec: Vec) -> Result { + if vec.len() != 32 { + return Err(Error::ByteLengthNot32BytesError(String::from( + "Identifier must be 32 bytes long from vec", + ))); + } + + // Since we checked that vector size is 32, we can use unwrap + Ok(Identifier::new(vec.try_into().unwrap())) + } + + #[cfg(feature = "json")] pub fn to_json_value_vec(&self) -> Vec { self.to_buffer() .iter() @@ -228,6 +251,14 @@ impl TryFrom<&[u8]> for Identifier { } } +impl TryFrom<&Vec> for Identifier { + type Error = Error; + + fn try_from(bytes: &Vec) -> Result { + Self::from_bytes(bytes.as_slice()) + } +} + impl TryFrom> for Identifier { type Error = Error; diff --git a/packages/rs-platform-value/src/value_map.rs b/packages/rs-platform-value/src/value_map.rs index 39be2e60834..a067b87efba 100644 --- a/packages/rs-platform-value/src/value_map.rs +++ b/packages/rs-platform-value/src/value_map.rs @@ -22,6 +22,7 @@ pub trait ValueMapHelper { fn remove_optional_key_if_null(&mut self, search_key: &str); fn remove_optional_key_if_empty_array(&mut self, search_key: &str); fn remove_optional_key_value(&mut self, search_key_value: &Value) -> Option; + fn from_btree_map + Ord, V: Into>(btree_map: BTreeMap) -> Self; } impl ValueMapHelper for ValueMap { @@ -214,6 +215,12 @@ impl ValueMapHelper for ValueMap { .position(|(key, _)| search_key_value == key) .map(|pos| self.remove(pos).1) } + fn from_btree_map + Ord, V: Into>(btree_map: BTreeMap) -> Self { + btree_map + .into_iter() + .map(|(k, v)| (k.into(), v.into())) + .collect() + } } impl Value { @@ -345,9 +352,9 @@ impl Value { /// The index map is in the order sorted by the sort key /// The type T is the type of the value of the sort key /// Returns `Err(Error::Structure("reason"))` otherwise. - pub fn map_ref_into_indexed_string_map<'a, 'b, T>( + pub fn map_ref_into_indexed_string_map<'a, T>( map: &'a ValueMap, - sort_key: &'b str, + sort_key: &str, ) -> Result, Error> where T: TryFrom diff --git a/packages/rs-platform-value/src/value_serialization/de.rs b/packages/rs-platform-value/src/value_serialization/de.rs index 34ab78ec228..9028fa8de52 100644 --- a/packages/rs-platform-value/src/value_serialization/de.rs +++ b/packages/rs-platform-value/src/value_serialization/de.rs @@ -1,3 +1,5 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use core::{fmt, slice}; use std::iter::Peekable; @@ -134,7 +136,7 @@ impl<'de> de::Visitor<'de> for Visitor { } fn visit_seq>(self, mut acc: A) -> Result { match acc.size_hint() { - Some(size) if size == 1 => { + Some(1) => { let tag: u8 = acc .next_element()? .ok_or_else(|| de::Error::custom("expected tag"))?; @@ -177,7 +179,7 @@ impl<'de> de::Deserializer<'de> for Deserializer { match self.0 { Value::Bytes(x) => { if human_readable { - visitor.visit_str(base64::encode(x).as_str()) + visitor.visit_str(BASE64_STANDARD.encode(x).as_str()) } else { visitor.visit_bytes(&x) } @@ -200,21 +202,21 @@ impl<'de> de::Deserializer<'de> for Deserializer { Value::I8(x) => visitor.visit_i8(x), Value::Bytes20(x) => { if human_readable { - visitor.visit_str(base64::encode(x).as_str()) + visitor.visit_str(BASE64_STANDARD.encode(x).as_str()) } else { visitor.visit_bytes(&x) } } Value::Bytes32(x) => { if human_readable { - visitor.visit_str(base64::encode(x).as_str()) + visitor.visit_str(BASE64_STANDARD.encode(x).as_str()) } else { visitor.visit_bytes(&x) } } Value::Bytes36(x) => { if human_readable { - visitor.visit_str(base64::encode(x).as_str()) + visitor.visit_str(BASE64_STANDARD.encode(x).as_str()) } else { visitor.visit_bytes(&x) } @@ -453,7 +455,7 @@ impl<'de> de::Deserializer<'de> for Deserializer { } Value::EnumString(x) => { let variant_name = x - .get(0) + .first() .ok_or_else(|| de::Error::invalid_length(0, &"at least one variant expected"))? .clone(); visitor.visit_enum(variant_name.into_deserializer()) @@ -514,7 +516,7 @@ impl<'a, 'de> de::MapAccess<'de> for ValueMapDeserializer<'a> { } } -impl<'a, 'de> de::VariantAccess<'de> for Deserializer { +impl<'de> de::VariantAccess<'de> for Deserializer { type Error = Error; fn unit_variant(self) -> Result<(), Self::Error> { diff --git a/packages/rs-platform-value/src/value_serialization/mod.rs b/packages/rs-platform-value/src/value_serialization/mod.rs index e3af45fdba9..05666781a5e 100644 --- a/packages/rs-platform-value/src/value_serialization/mod.rs +++ b/packages/rs-platform-value/src/value_serialization/mod.rs @@ -52,13 +52,11 @@ pub mod ser; /// ``` /// use std::collections::BTreeMap; /// -/// fn main() { -/// // The keys in this map are vectors, not strings. -/// let mut map = BTreeMap::new(); -/// map.insert(vec![32, 64], "x86"); +/// // The keys in this map are vectors, not strings. +/// let mut map = BTreeMap::new(); +/// map.insert(vec![32, 64], "x86"); /// -/// println!("{}", platform_value::to_value(map).unwrap_err()); -/// } +/// println!("{}", platform_value::to_value(map).unwrap_err()); /// ``` pub fn to_value(value: T) -> Result where @@ -81,16 +79,14 @@ where /// location: String, /// } /// -/// fn main() { -/// // The type of `j` is `serde_json::Value` -/// let j = platform_value!({ -/// "fingerprint": "0xF9BA143B95FF6D82", -/// "location": "Menlo Park, CA" -/// }); +/// // The type of `j` is `serde_json::Value` +/// let j = platform_value!({ +/// "fingerprint": "0xF9BA143B95FF6D82", +/// "location": "Menlo Park, CA" +/// }); /// -/// let u: User = platform_value::from_value(j).unwrap(); -/// println!("{:#?}", u); -/// } +/// let u: User = platform_value::from_value(j).unwrap(); +/// println!("{:#?}", u); /// ``` /// /// # Errors diff --git a/packages/rs-platform-value/src/value_serialization/ser.rs b/packages/rs-platform-value/src/value_serialization/ser.rs index 2a4dde959f1..525d60300c2 100644 --- a/packages/rs-platform-value/src/value_serialization/ser.rs +++ b/packages/rs-platform-value/src/value_serialization/ser.rs @@ -1,6 +1,8 @@ use crate::error::Error; use crate::value_map::ValueMap; use crate::{to_value, Value}; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use serde::ser::{Impossible, Serialize}; use std::fmt::Display; @@ -45,28 +47,28 @@ impl Serialize for Value { Value::I8(i) => serializer.serialize_i8(*i), Value::Bytes(bytes) => { if serializer.is_human_readable() { - serializer.serialize_str(base64::encode(bytes).as_str()) + serializer.serialize_str(BASE64_STANDARD.encode(bytes).as_str()) } else { serializer.serialize_bytes(bytes) } } Value::Bytes20(bytes) => { if serializer.is_human_readable() { - serializer.serialize_str(base64::encode(bytes).as_str()) + serializer.serialize_str(BASE64_STANDARD.encode(bytes).as_str()) } else { serializer.serialize_bytes(bytes) } } Value::Bytes32(bytes) => { if serializer.is_human_readable() { - serializer.serialize_str(base64::encode(bytes).as_str()) + serializer.serialize_str(BASE64_STANDARD.encode(bytes).as_str()) } else { serializer.serialize_bytes(bytes) } } Value::Bytes36(bytes) => { if serializer.is_human_readable() { - serializer.serialize_str(base64::encode(bytes).as_str()) + serializer.serialize_str(BASE64_STANDARD.encode(bytes).as_str()) } else { serializer.serialize_bytes(bytes) } @@ -253,9 +255,10 @@ impl serde::Serializer for Serializer { where T: ?Sized + Serialize, { - let mut values = ValueMap::new(); - values.push((Value::Text(String::from(variant)), tri!(to_value(value)))); - Ok(Value::Map(values)) + Ok(Value::Map(vec![( + Value::Text(String::from(variant)), + tri!(to_value(value)), + )])) } #[inline] @@ -445,11 +448,10 @@ impl serde::ser::SerializeTupleVariant for SerializeTupleVariant { } fn end(self) -> Result { - let mut object = Vec::new(); - - object.push((Value::Text(self.name), Value::Array(self.vec))); - - Ok(Value::Map(object)) + Ok(Value::Map(vec![( + Value::Text(self.name), + Value::Array(self.vec), + )])) } } @@ -712,10 +714,9 @@ impl serde::ser::SerializeStructVariant for SerializeStructVariant { } fn end(self) -> Result { - let mut object = Vec::new(); - - object.push((Value::Text(self.name), Value::Map(self.map))); - - Ok(Value::Map(object)) + Ok(Value::Map(vec![( + Value::Text(self.name), + Value::Map(self.map), + )])) } } diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 48ba80a54a7..55e6458b23f 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -1,15 +1,18 @@ [package] name = "platform-version" authors = ["Samuel Westrich "] -description = "Bincode based serialization and deserialization" -version = "0.25.21" +description = "Versioning library for Platform" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -private = true [dependencies] -thiserror = { version = "1.0" } +thiserror = { version = "1.0.59" } +bincode = { version = "2.0.0-rc.3"} +versioned-feature-core = { git = "https://github.com/dashpay/versioned-feature-core", version = "1.0.0" } +grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "2c14841e95b4222d489f0655c85238bc05267b91" } +once_cell = "1.19.0" [features] mock-versions = [] diff --git a/packages/rs-platform-version/src/version/contracts.rs b/packages/rs-platform-version/src/version/contracts.rs new file mode 100644 index 00000000000..84c0d874b1d --- /dev/null +++ b/packages/rs-platform-version/src/version/contracts.rs @@ -0,0 +1,10 @@ +use crate::version::FeatureVersion; + +#[derive(Clone, Debug, Default)] +pub struct SystemDataContractVersions { + pub withdrawals: FeatureVersion, + pub dpns: FeatureVersion, + pub dashpay: FeatureVersion, + pub masternode_reward_shares: FeatureVersion, + pub feature_flags: FeatureVersion, +} diff --git a/packages/rs-platform-version/src/version/dpp_versions.rs b/packages/rs-platform-version/src/version/dpp_versions.rs index 6c271f17f2e..6a64561f6e1 100644 --- a/packages/rs-platform-version/src/version/dpp_versions.rs +++ b/packages/rs-platform-version/src/version/dpp_versions.rs @@ -12,6 +12,9 @@ pub struct DPPVersion { pub contract_versions: ContractVersions, pub document_versions: DocumentVersions, pub identity_versions: IdentityVersions, + pub voting_versions: VotingVersions, + pub asset_lock_versions: AssetLockVersions, + pub methods: DPPMethodVersions, } #[derive(Clone, Debug, Default)] @@ -22,11 +25,14 @@ pub struct StateTransitionVersions { #[derive(Clone, Debug, Default)] pub struct IdentityTransitionVersions { + pub max_public_keys_in_creation: u16, pub asset_locks: IdentityTransitionAssetLockVersions, } #[derive(Clone, Debug, Default)] pub struct IdentityTransitionAssetLockVersions { + pub required_asset_lock_duff_balance_for_processing_start_for_identity_create: u64, + pub required_asset_lock_duff_balance_for_processing_start_for_identity_top_up: u64, pub validate_asset_lock_transaction_structure: FeatureVersion, pub validate_instant_asset_lock_proof_structure: FeatureVersion, } @@ -54,9 +60,10 @@ pub struct CostVersions { #[derive(Clone, Debug, Default)] pub struct DPPValidationVersions { - pub validate_time_in_block_time_window: FeatureVersion, pub json_schema_validator: JsonSchemaValidatorVersions, pub data_contract: DataContractValidationVersions, + pub document_type: DocumentTypeValidationVersions, + pub voting: VotingValidationVersions, } #[derive(Clone, Debug, Default)] @@ -69,11 +76,27 @@ pub struct DataContractValidationVersions { pub validate_property_definition: FeatureVersion, } +#[derive(Clone, Debug, Default)] +pub struct VotingValidationVersions { + /// How long do we allow other contenders to join a contest after the first contender + pub allow_other_contenders_time_ms: u64, + /// How many votes do we allow from the same masternode? + pub votes_allowed_per_masternode: u16, +} + +#[derive(Clone, Debug, Default)] +pub struct DocumentTypeValidationVersions { + pub validate_update: FeatureVersion, + pub unique_index_limit: u16, + pub contested_index_limit: u16, +} + #[derive(Clone, Debug, Default)] pub struct JsonSchemaValidatorVersions { pub new: FeatureVersion, pub validate: FeatureVersion, pub compile: FeatureVersion, + pub compile_and_validate: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -94,6 +117,8 @@ pub struct PublicKeyInCreationMethodVersions { #[derive(Clone, Debug, Default)] pub struct StateTransitionConversionVersions { pub identity_to_identity_create_transition: FeatureVersion, + pub identity_to_identity_top_up_transition: FeatureVersion, + pub identity_to_identity_withdrawal_transition: FeatureVersion, pub identity_to_identity_create_transition_with_signer: FeatureVersion, } @@ -105,6 +130,7 @@ pub struct StateTransitionSerializationVersions { pub identity_top_up_state_transition: FeatureVersionBounds, pub identity_credit_withdrawal_state_transition: FeatureVersionBounds, pub identity_credit_transfer_state_transition: FeatureVersionBounds, + pub masternode_vote_state_transition: FeatureVersionBounds, pub contract_create_state_transition: FeatureVersionBounds, pub contract_update_state_transition: FeatureVersionBounds, pub documents_batch_state_transition: FeatureVersionBounds, @@ -112,6 +138,9 @@ pub struct StateTransitionSerializationVersions { pub document_create_state_transition: DocumentFeatureVersionBounds, pub document_replace_state_transition: DocumentFeatureVersionBounds, pub document_delete_state_transition: DocumentFeatureVersionBounds, + pub document_transfer_state_transition: DocumentFeatureVersionBounds, + pub document_update_price_state_transition: DocumentFeatureVersionBounds, + pub document_purchase_state_transition: DocumentFeatureVersionBounds, } #[derive(Clone, Debug, Default)] @@ -121,6 +150,10 @@ pub struct DocumentFeatureVersionBounds { #[derive(Clone, Debug, Default)] pub struct ContractVersions { + /// The maximum that we can store a data contract in the state. There is a possibility that a client + /// sends a state transition serialized in a specific version and that the system re-serializes it + /// to the current version, and in so doing increases it's size. + pub max_serialized_size: u32, /// This is how we serialize and deserialize a contract pub contract_serialization_version: FeatureVersionBounds, /// This is the structure of the Contract as it is defined for code paths @@ -134,6 +167,7 @@ pub struct ContractVersions { #[derive(Clone, Debug, Default)] pub struct DataContractMethodVersions { pub validate_document: FeatureVersion, + pub validate_update: FeatureVersion, pub schema: FeatureVersion, } @@ -162,10 +196,13 @@ pub struct DocumentTypeVersions { pub struct DocumentTypeMethodVersions { pub create_document_from_data: FeatureVersion, pub create_document_with_prevalidated_properties: FeatureVersion, + pub prefunded_voting_balance_for_document: FeatureVersion, + pub contested_vote_poll_for_document: FeatureVersion, pub estimated_size: FeatureVersion, pub index_for_types: FeatureVersion, pub max_size: FeatureVersion, pub serialize_value_for_key: FeatureVersion, + pub deserialize_value_for_key: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -173,6 +210,7 @@ pub struct DocumentTypeSchemaVersions { pub enrich_with_base_schema: FeatureVersion, pub find_identifier_and_binary_paths: FeatureVersion, pub validate_max_depth: FeatureVersion, + pub max_depth: u16, pub recursive_schema_validator_versions: RecursiveSchemaValidatorVersions, pub validate_schema_compatibility: FeatureVersion, } @@ -180,8 +218,11 @@ pub struct DocumentTypeSchemaVersions { #[derive(Clone, Debug, Default)] pub struct RecursiveSchemaValidatorVersions { pub traversal_validator: FeatureVersion, - pub byte_array_has_no_items_as_parent_validator: FeatureVersion, - pub pattern_is_valid_regex_validator: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct AssetLockVersions { + pub reduced_asset_lock_value: FeatureVersionBounds, } #[derive(Clone, Debug, Default)] @@ -192,6 +233,12 @@ pub struct IdentityVersions { pub identity_key_type_method_versions: IdentityKeyTypeMethodVersions, } +#[derive(Clone, Debug, Default)] +pub struct VotingVersions { + pub default_vote_poll_time_duration_ms: u64, + pub contested_document_vote_poll_stored_info_version: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct IdentityKeyTypeMethodVersions { pub random_public_key_data: FeatureVersion, @@ -211,7 +258,13 @@ pub struct DocumentVersions { #[derive(Clone, Debug, Default)] pub struct DocumentMethodVersions { + pub is_equal_ignoring_timestamps: FeatureVersion, pub hash: FeatureVersion, pub get_raw_for_contract: FeatureVersion, pub get_raw_for_document_type: FeatureVersion, } + +#[derive(Clone, Debug, Default)] +pub struct DPPMethodVersions { + pub epoch_core_reward_credits_for_distribution: FeatureVersion, +} diff --git a/packages/rs-platform-version/src/version/drive_abci_versions.rs b/packages/rs-platform-version/src/version/drive_abci_versions.rs index a3e9d9a4420..a23a5c6e02b 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions.rs @@ -10,24 +10,41 @@ pub struct DriveAbciVersion { #[derive(Clone, Debug, Default)] pub struct DriveAbciQueryVersions { + pub max_returned_elements: u16, pub response_metadata: FeatureVersion, - pub base_query_structure: FeatureVersion, pub proofs_query: FeatureVersionBounds, pub document_query: FeatureVersionBounds, + pub prefunded_specialized_balances: DriveAbciQueryPrefundedSpecializedBalancesVersions, pub identity_based_queries: DriveAbciQueryIdentityVersions, pub data_contract_based_queries: DriveAbciQueryDataContractVersions, + pub voting_based_queries: DriveAbciQueryVotingVersions, pub system: DriveAbciQuerySystemVersions, } +#[derive(Clone, Debug, Default)] +pub struct DriveAbciQueryPrefundedSpecializedBalancesVersions { + pub balance: FeatureVersionBounds, +} + #[derive(Clone, Debug, Default)] pub struct DriveAbciQueryIdentityVersions { pub identity: FeatureVersionBounds, - pub identities: FeatureVersionBounds, + pub identities_contract_keys: FeatureVersionBounds, pub keys: FeatureVersionBounds, + pub identity_nonce: FeatureVersionBounds, + pub identity_contract_nonce: FeatureVersionBounds, pub balance: FeatureVersionBounds, pub balance_and_revision: FeatureVersionBounds, pub identity_by_public_key_hash: FeatureVersionBounds, - pub identities_by_public_key_hashes: FeatureVersionBounds, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveAbciQueryVotingVersions { + pub vote_polls_by_end_date_query: FeatureVersionBounds, + pub contested_resource_vote_state: FeatureVersionBounds, + pub contested_resource_voters_for_identity: FeatureVersionBounds, + pub contested_resource_identity_vote_status: FeatureVersionBounds, + pub contested_resources: FeatureVersionBounds, } #[derive(Clone, Debug, Default)] @@ -42,6 +59,8 @@ pub struct DriveAbciQuerySystemVersions { pub version_upgrade_state: FeatureVersionBounds, pub version_upgrade_vote_status: FeatureVersionBounds, pub epoch_infos: FeatureVersionBounds, + pub path_elements: FeatureVersionBounds, + pub total_credits_in_platform: FeatureVersionBounds, } #[derive(Clone, Debug, Default)] @@ -51,6 +70,7 @@ pub struct DriveAbciStructureVersions { pub state_transition_execution_context: FeatureVersion, pub commit: FeatureVersion, pub masternode: FeatureVersion, + pub signature_verification_quorum_set: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -60,35 +80,70 @@ pub struct DriveAbciMethodVersions { pub core_based_updates: DriveAbciCoreBasedUpdatesMethodVersions, pub protocol_upgrade: DriveAbciProtocolUpgradeMethodVersions, pub block_fee_processing: DriveAbciBlockFeeProcessingMethodVersions, - pub core_subsidy: DriveAbciCoreSubsidyMethodVersions, + pub core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants, + pub core_instant_send_lock: DriveAbciCoreInstantSendLockMethodVersions, pub fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions, pub fee_pool_outwards_distribution: DriveAbciFeePoolOutwardsDistributionMethodVersions, - pub identity_credit_withdrawal: DriveAbciIdentityCreditWithdrawalMethodVersions, + pub withdrawals: DriveAbciIdentityCreditWithdrawalMethodVersions, + pub voting: DriveAbciVotingMethodVersions, pub state_transition_processing: DriveAbciStateTransitionProcessingMethodVersions, - pub withdrawals: DriveAbciWithdrawalsMethodVersions, pub epoch: DriveAbciEpochMethodVersions, pub block_start: DriveAbciBlockStartMethodVersions, pub block_end: DriveAbciBlockEndMethodVersions, + pub platform_state_storage: DriveAbciPlatformStateStorageMethodVersions, } #[derive(Clone, Debug, Default)] pub struct DriveAbciValidationVersions { pub state_transitions: DriveAbciStateTransitionValidationVersions, pub process_state_transition: FeatureVersion, + pub state_transition_to_execution_event_for_check_tx: FeatureVersion, + pub penalties: PenaltyAmounts, + pub event_constants: DriveAbciValidationConstants, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveAbciValidationConstants { + pub maximum_vote_polls_to_process: u16, + pub maximum_contenders_to_consider: u16, +} + +/// All of these penalty amounts are in credits +#[derive(Clone, Debug, Default)] +pub struct PenaltyAmounts { + pub identity_id_not_correct: u64, + pub unique_key_already_present: u64, + pub validation_of_added_keys_structure_failure: u64, + pub validation_of_added_keys_proof_of_possession_failure: u64, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveAbciPlatformStateStorageMethodVersions { + pub fetch_platform_state: FeatureVersion, + pub store_platform_state: FeatureVersion, } #[derive(Clone, Debug, Default)] pub struct DriveAbciDocumentsStateTransitionValidationVersions { - pub structure: FeatureVersion, + pub balance_pre_check: FeatureVersion, + pub basic_structure: FeatureVersion, + pub advanced_structure: FeatureVersion, + pub revision: FeatureVersion, pub state: FeatureVersion, pub transform_into_action: FeatureVersion, pub data_triggers: DriveAbciValidationDataTriggerAndBindingVersions, pub document_create_transition_structure_validation: FeatureVersion, pub document_delete_transition_structure_validation: FeatureVersion, pub document_replace_transition_structure_validation: FeatureVersion, + pub document_transfer_transition_structure_validation: FeatureVersion, + pub document_purchase_transition_structure_validation: FeatureVersion, + pub document_update_price_transition_structure_validation: FeatureVersion, pub document_create_transition_state_validation: FeatureVersion, pub document_delete_transition_state_validation: FeatureVersion, pub document_replace_transition_state_validation: FeatureVersion, + pub document_transfer_transition_state_validation: FeatureVersion, + pub document_purchase_transition_state_validation: FeatureVersion, + pub document_update_price_transition_state_validation: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -110,8 +165,11 @@ pub struct DriveAbciValidationDataTriggerVersions { #[derive(Clone, Debug, Default)] pub struct DriveAbciStateTransitionValidationVersion { - pub structure: FeatureVersion, + pub basic_structure: OptionalFeatureVersion, + pub advanced_structure: OptionalFeatureVersion, pub identity_signatures: OptionalFeatureVersion, + pub advanced_minimum_balance_pre_check: OptionalFeatureVersion, + pub nonce: OptionalFeatureVersion, pub state: FeatureVersion, pub transform_into_action: FeatureVersion, } @@ -119,11 +177,13 @@ pub struct DriveAbciStateTransitionValidationVersion { #[derive(Clone, Debug, Default)] pub struct DriveAbciStateTransitionValidationVersions { pub common_validation_methods: DriveAbciStateTransitionCommonValidationVersions, + pub max_asset_lock_usage_attempts: u16, pub identity_create_state_transition: DriveAbciStateTransitionValidationVersion, pub identity_update_state_transition: DriveAbciStateTransitionValidationVersion, pub identity_top_up_state_transition: DriveAbciStateTransitionValidationVersion, pub identity_credit_withdrawal_state_transition: DriveAbciStateTransitionValidationVersion, pub identity_credit_transfer_state_transition: DriveAbciStateTransitionValidationVersion, + pub masternode_vote_state_transition: DriveAbciStateTransitionValidationVersion, pub contract_create_state_transition: DriveAbciStateTransitionValidationVersion, pub contract_update_state_transition: DriveAbciStateTransitionValidationVersion, pub documents_batch_state_transition: DriveAbciDocumentsStateTransitionValidationVersions, @@ -137,11 +197,14 @@ pub struct DriveAbciStateTransitionCommonValidationVersions { pub validate_identity_public_key_ids_exist_in_state: FeatureVersion, pub validate_state_transition_identity_signed: FeatureVersion, pub validate_unique_identity_public_key_hashes_in_state: FeatureVersion, + pub validate_master_key_uniqueness: FeatureVersion, + pub validate_simple_pre_check_balance: FeatureVersion, } #[derive(Clone, Copy, Debug, Default)] pub struct DriveAbciAssetLockValidationVersions { pub fetch_asset_lock_transaction_output_sync: FeatureVersion, + pub verify_asset_lock_is_not_spent_and_has_enough_balance: FeatureVersion, } #[derive(Clone, Copy, Debug, Default)] @@ -165,12 +228,11 @@ pub struct DriveAbciMasternodeIdentitiesUpdatesMethodVersions { pub get_voter_identity_key: FeatureVersion, pub get_operator_identity_keys: FeatureVersion, pub get_owner_identity_key: FeatureVersion, - pub get_voter_identifier: FeatureVersion, - pub get_operator_identifier: FeatureVersion, + pub get_voter_identifier_from_masternode_list_item: FeatureVersion, + pub get_operator_identifier_from_masternode_list_item: FeatureVersion, pub create_operator_identity: FeatureVersion, pub create_owner_identity: FeatureVersion, pub create_voter_identity: FeatureVersion, - pub hash_protxhash_with_key_data: FeatureVersion, pub disable_identity_keys: FeatureVersion, pub update_masternode_identities: FeatureVersion, pub update_operator_identity: FeatureVersion, @@ -180,7 +242,7 @@ pub struct DriveAbciMasternodeIdentitiesUpdatesMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveAbciInitializationMethodVersions { - pub initial_core_height: FeatureVersion, + pub initial_core_height_and_time: FeatureVersion, pub create_genesis_state: FeatureVersion, } @@ -191,8 +253,18 @@ pub struct DriveAbciBlockFeeProcessingMethodVersions { } #[derive(Clone, Debug, Default)] -pub struct DriveAbciCoreSubsidyMethodVersions { - pub epoch_core_reward_credits_for_distribution: FeatureVersion, +pub struct DriveAbciCoreInstantSendLockMethodVersions { + pub verify_recent_signature_locally: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveAbciCoreChainLockMethodVersionsAndConstants { + pub choose_quorum: FeatureVersion, + pub verify_chain_lock: FeatureVersion, + pub verify_chain_lock_locally: FeatureVersion, + pub verify_chain_lock_through_core: FeatureVersion, + pub make_sure_core_is_synced_to_chain_lock: FeatureVersion, + pub recent_block_count_amount: u32, //what constitutes a recent block, for v0 it's 2. } #[derive(Clone, Debug, Default)] @@ -222,34 +294,45 @@ pub struct DriveAbciBlockStartMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveAbciBlockEndMethodVersions { - pub store_ephemeral_state: FeatureVersion, pub update_state_cache: FeatureVersion, pub update_drive_cache: FeatureVersion, pub validator_set_update: FeatureVersion, } +#[derive(Clone, Debug, Default)] +pub struct DriveAbciVotingMethodVersions { + pub keep_record_of_finished_contested_resource_vote_poll: FeatureVersion, + pub clean_up_after_vote_poll_end: FeatureVersion, + pub clean_up_after_contested_resources_vote_poll_end: FeatureVersion, + pub check_for_ended_vote_polls: FeatureVersion, + pub tally_votes_for_contested_document_resource_vote_poll: FeatureVersion, + pub award_document_to_winner: FeatureVersion, + pub delay_vote_poll: FeatureVersion, + pub run_dao_platform_events: FeatureVersion, + pub remove_votes_for_removed_masternodes: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct DriveAbciIdentityCreditWithdrawalMethodVersions { - pub build_withdrawal_transactions_from_documents: FeatureVersion, - pub fetch_and_prepare_unsigned_withdrawal_transactions: FeatureVersion, + pub build_untied_withdrawal_transactions_from_documents: FeatureVersion, + pub dequeue_and_build_unsigned_withdrawal_transactions: FeatureVersion, pub fetch_transactions_block_inclusion_status: FeatureVersion, pub pool_withdrawals_into_transactions_queue: FeatureVersion, - pub update_broadcasted_withdrawal_transaction_statuses: FeatureVersion, + pub update_broadcasted_withdrawal_statuses: FeatureVersion, + pub append_signatures_and_broadcast_withdrawal_transactions: FeatureVersion, } #[derive(Clone, Debug, Default)] pub struct DriveAbciProtocolUpgradeMethodVersions { pub check_for_desired_protocol_upgrade: FeatureVersion, + pub upgrade_protocol_version_on_epoch_change: FeatureVersion, + pub protocol_version_upgrade_percentage_needed: u64, } #[derive(Clone, Debug, Default)] pub struct DriveAbciStateTransitionProcessingMethodVersions { pub execute_event: FeatureVersion, pub process_raw_state_transitions: FeatureVersion, + pub decode_raw_state_transitions: FeatureVersion, pub validate_fees_of_event: FeatureVersion, } - -#[derive(Clone, Debug, Default)] -pub struct DriveAbciWithdrawalsMethodVersions { - pub check_withdrawals: FeatureVersion, -} diff --git a/packages/rs-platform-version/src/version/drive_versions.rs b/packages/rs-platform-version/src/version/drive_versions.rs index eb8d6f7da77..1cfcf764e1c 100644 --- a/packages/rs-platform-version/src/version/drive_versions.rs +++ b/packages/rs-platform-version/src/version/drive_versions.rs @@ -1,16 +1,12 @@ use crate::version::{FeatureVersion, FeatureVersionBounds, OptionalFeatureVersion}; +use grovedb_version::version::GroveVersion; #[derive(Clone, Debug, Default)] pub struct DriveVersion { pub structure: DriveStructureVersion, pub methods: DriveMethodVersions, pub grove_methods: DriveGroveMethodVersions, -} - -impl DriveVersion { - pub fn latest() -> DriveVersion { - DriveVersion::default() - } + pub grove_version: GroveVersion, } #[derive(Clone, Debug, Default)] @@ -18,8 +14,10 @@ pub struct DriveMethodVersions { pub initialization: DriveInitializationMethodVersions, pub credit_pools: DriveCreditPoolMethodVersions, pub protocol_upgrade: DriveProtocolUpgradeVersions, + pub prefunded_specialized_balances: DrivePrefundedSpecializedMethodVersions, pub balances: DriveBalancesMethodVersions, pub document: DriveDocumentMethodVersions, + pub vote: DriveVoteMethodVersions, pub contract: DriveContractMethodVersions, pub fees: DriveFeesMethodVersions, pub estimated_costs: DriveEstimatedCostsMethodVersions, @@ -29,13 +27,45 @@ pub struct DriveMethodVersions { pub platform_system: DrivePlatformSystemMethodVersions, pub operations: DriveOperationsMethodVersion, pub batch_operations: DriveBatchOperationsMethodVersion, + pub fetch: DriveFetchMethodVersions, pub prove: DriveProveMethodVersions, pub state_transitions: DriveStateTransitionMethodVersions, + pub platform_state: DrivePlatformStateMethodVersions, +} + +#[derive(Clone, Debug, Default)] +pub struct DrivePlatformStateMethodVersions { + pub fetch_platform_state_bytes: FeatureVersion, + pub store_platform_state_bytes: FeatureVersion, } #[derive(Clone, Debug, Default)] pub struct DriveStateTransitionMethodVersions { pub operations: DriveStateTransitionOperationMethodVersions, + pub convert_to_high_level_operations: + DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions { + pub data_contract_create_transition: FeatureVersion, + pub data_contract_update_transition: FeatureVersion, + pub document_create_transition: FeatureVersion, + pub document_delete_transition: FeatureVersion, + pub document_purchase_transition: FeatureVersion, + pub document_replace_transition: FeatureVersion, + pub document_transfer_transition: FeatureVersion, + pub document_update_price_transition: FeatureVersion, + pub documents_batch_transition: FeatureVersion, + pub identity_create_transition: FeatureVersion, + pub identity_credit_transfer_transition: FeatureVersion, + pub identity_credit_withdrawal_transition: FeatureVersion, + pub identity_top_up_transition: FeatureVersion, + pub identity_update_transition: FeatureVersion, + pub masternode_vote_transition: FeatureVersion, + pub bump_identity_data_contract_nonce: FeatureVersion, + pub bump_identity_nonce: FeatureVersion, + pub partially_use_asset_lock: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -49,9 +79,15 @@ pub struct DriveDataContractOperationMethodVersions { pub finalization_tasks: FeatureVersion, } +#[derive(Clone, Debug, Default)] +pub struct DriveFetchMethodVersions { + pub fetch_elements: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct DriveProveMethodVersions { - pub prove_multiple: FeatureVersion, + pub prove_elements: FeatureVersion, + pub prove_multiple_state_transition_results: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -61,6 +97,8 @@ pub struct DriveVerifyMethodVersions { pub identity: DriveVerifyIdentityMethodVersions, pub single_document: DriveVerifySingleDocumentMethodVersions, pub system: DriveVerifySystemMethodVersions, + pub voting: DriveVerifyVoteMethodVersions, + pub state_transition: DriveVerifyStateTransitionMethodVersions, } #[derive(Clone, Debug, Default)] @@ -86,11 +124,28 @@ pub struct DriveVerifyIdentityMethodVersions { pub verify_identity_id_by_public_key_hash: FeatureVersion, pub verify_identity_ids_by_public_key_hashes: FeatureVersion, pub verify_identity_keys_by_identity_id: FeatureVersion, + pub verify_identity_nonce: FeatureVersion, + pub verify_identity_contract_nonce: FeatureVersion, + pub verify_identities_contract_keys: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveVerifyVoteMethodVersions { + pub verify_masternode_vote: FeatureVersion, + pub verify_start_at_contender_in_proof: FeatureVersion, + pub verify_vote_poll_votes_proof: FeatureVersion, + pub verify_identity_votes_given_proof: FeatureVersion, + pub verify_vote_poll_vote_state_proof: FeatureVersion, + pub verify_contests_proof: FeatureVersion, + pub verify_vote_polls_by_end_date_proof: FeatureVersion, + pub verify_specialized_balance: FeatureVersion, } #[derive(Clone, Debug, Default)] pub struct DriveVerifySystemMethodVersions { pub verify_epoch_infos: FeatureVersion, + pub verify_elements: FeatureVersion, + pub verify_total_credits_in_system: FeatureVersion, pub verify_upgrade_state: FeatureVersion, pub verify_upgrade_vote_status: FeatureVersion, } @@ -101,6 +156,11 @@ pub struct DriveVerifySingleDocumentMethodVersions { pub verify_proof_keep_serialized: FeatureVersion, } +#[derive(Clone, Debug, Default)] +pub struct DriveVerifyStateTransitionMethodVersions { + pub verify_state_transition_was_executed_with_proof: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct DriveGroveMethodVersions { pub basic: DriveGroveBasicMethodVersions, @@ -109,6 +169,17 @@ pub struct DriveGroveMethodVersions { pub costs: DriveGroveCostMethodVersions, } +#[derive(Clone, Debug, Default)] +pub struct DrivePrefundedSpecializedMethodVersions { + pub fetch_single: FeatureVersion, + pub prove_single: FeatureVersion, + pub add_prefunded_specialized_balance: FeatureVersion, + pub add_prefunded_specialized_balance_operations: FeatureVersion, + pub deduct_from_prefunded_specialized_balance: FeatureVersion, + pub deduct_from_prefunded_specialized_balance_operations: FeatureVersion, + pub estimated_cost_for_prefunded_specialized_balance_update: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct DriveBalancesMethodVersions { pub add_to_system_credits: FeatureVersion, @@ -122,7 +193,7 @@ pub struct DriveBalancesMethodVersions { pub struct DriveAssetLockMethodVersions { pub add_asset_lock_outpoint: FeatureVersion, pub add_estimation_costs_for_adding_asset_lock: FeatureVersion, - pub has_asset_lock_outpoint: FeatureVersion, + pub fetch_asset_lock_outpoint_info: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -188,7 +259,6 @@ pub struct DriveContractCostsMethodVersions { #[derive(Clone, Debug, Default)] pub struct DrivePlatformSystemMethodVersions { - pub protocol_version: DriveSystemProtocolVersionMethodVersions, pub estimation_costs: DriveSystemEstimationCostsMethodVersions, } @@ -210,16 +280,58 @@ pub struct DriveBatchOperationsMethodVersion { } #[derive(Clone, Debug, Default)] -pub struct DriveSystemProtocolVersionMethodVersions { - pub fetch_current_protocol_version: FeatureVersion, - pub set_current_protocol_version_operations: FeatureVersion, - pub fetch_next_protocol_version: FeatureVersion, - pub set_next_protocol_version_operations: FeatureVersion, +pub struct DriveSystemEstimationCostsMethodVersions { + pub for_total_system_credits_update: FeatureVersion, } #[derive(Clone, Debug, Default)] -pub struct DriveSystemEstimationCostsMethodVersions { - pub for_total_system_credits_update: FeatureVersion, +pub struct DriveVoteMethodVersions { + pub insert: DriveVoteInsertMethodVersions, + pub contested_resource_insert: DriveVoteContestedResourceInsertMethodVersions, + pub cleanup: DriveVoteCleanupMethodVersions, + pub setup: DriveVoteSetupMethodVersions, + pub storage_form: DriveVoteStorageFormMethodVersions, + pub fetch: DriveVoteFetchMethodVersions, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveVoteFetchMethodVersions { + pub fetch_identities_voting_for_contenders: FeatureVersion, + pub fetch_contested_document_vote_poll_stored_info: FeatureVersion, + pub fetch_identity_contested_resource_vote: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveVoteStorageFormMethodVersions { + pub resolve_with_contract: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveVoteSetupMethodVersions { + pub add_initial_vote_tree_main_structure_operations: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveVoteCleanupMethodVersions { + pub remove_specific_vote_references_given_by_identity: FeatureVersion, + pub remove_specific_votes_given_by_identity: FeatureVersion, + pub remove_contested_resource_vote_poll_end_date_query_operations: FeatureVersion, + pub remove_contested_resource_vote_poll_votes_operations: FeatureVersion, + pub remove_contested_resource_vote_poll_documents_operations: FeatureVersion, + pub remove_contested_resource_vote_poll_contenders_operations: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveVoteInsertMethodVersions { + pub register_identity_vote: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveVoteContestedResourceInsertMethodVersions { + pub register_contested_resource_identity_vote: FeatureVersion, + pub insert_stored_info_for_contested_resource_vote_poll: FeatureVersion, + pub register_identity_vote: FeatureVersion, + pub add_vote_poll_end_date_query_operations: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -227,6 +339,7 @@ pub struct DriveDocumentMethodVersions { pub query: DriveDocumentQueryMethodVersions, pub delete: DriveDocumentDeleteMethodVersions, pub insert: DriveDocumentInsertMethodVersions, + pub insert_contested: DriveDocumentInsertContestedMethodVersions, pub update: DriveDocumentUpdateMethodVersions, pub estimation_costs: DriveDocumentEstimationCostsMethodVersions, pub index_uniqueness: DriveDocumentIndexUniquenessMethodVersions, @@ -240,6 +353,7 @@ pub struct DriveDocumentQueryMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveDocumentEstimationCostsMethodVersions { pub add_estimation_costs_for_add_document_to_primary_storage: FeatureVersion, + pub add_estimation_costs_for_add_contested_document_to_primary_storage: FeatureVersion, pub stateless_delete_of_non_tree_for_costs: FeatureVersion, } @@ -255,6 +369,18 @@ pub struct DriveDocumentInsertMethodVersions { pub add_reference_for_index_level_for_contract_operations: FeatureVersion, } +#[derive(Clone, Debug, Default)] +pub struct DriveDocumentInsertContestedMethodVersions { + pub add_contested_document: FeatureVersion, + pub add_contested_document_for_contract: FeatureVersion, + pub add_contested_document_for_contract_apply_and_add_to_operations: FeatureVersion, + pub add_contested_document_for_contract_operations: FeatureVersion, + pub add_contested_document_to_primary_storage: FeatureVersion, + pub add_contested_indices_for_contract_operations: FeatureVersion, + pub add_contested_reference_and_vote_subtree_to_document_operations: FeatureVersion, + pub add_contested_vote_subtree_for_non_identities_operations: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct DriveDocumentUpdateMethodVersions { pub add_update_multiple_documents_operations: FeatureVersion, @@ -286,6 +412,9 @@ pub struct DriveDocumentIndexUniquenessMethodVersions { pub validate_document_uniqueness: FeatureVersion, pub validate_document_create_transition_action_uniqueness: FeatureVersion, pub validate_document_replace_transition_action_uniqueness: FeatureVersion, + pub validate_document_transfer_transition_action_uniqueness: FeatureVersion, + pub validate_document_purchase_transition_action_uniqueness: FeatureVersion, + pub validate_document_update_price_transition_action_uniqueness: FeatureVersion, pub validate_uniqueness_of_data: FeatureVersion, } @@ -302,11 +431,13 @@ pub struct DriveGroveBasicMethodVersions { pub grove_get_raw_value_u64_from_encoded_var_vec: FeatureVersion, pub grove_get: FeatureVersion, pub grove_get_path_query_serialized_results: FeatureVersion, + pub grove_get_path_query_serialized_or_sum_results: FeatureVersion, pub grove_get_path_query: FeatureVersion, pub grove_get_path_query_with_optional: FeatureVersion, pub grove_get_raw_path_query_with_optional: FeatureVersion, pub grove_get_raw_path_query: FeatureVersion, pub grove_get_proved_path_query: FeatureVersion, + pub grove_get_proved_path_query_with_conditional: FeatureVersion, pub grove_get_sum_tree_total_value: FeatureVersion, pub grove_has_raw: FeatureVersion, } @@ -319,6 +450,7 @@ pub struct DriveGroveBatchMethodVersions { pub batch_insert: FeatureVersion, pub batch_insert_if_not_exists: FeatureVersion, pub batch_insert_if_changed_value: FeatureVersion, + pub batch_replace: FeatureVersion, pub batch_delete: FeatureVersion, pub batch_remove_raw: FeatureVersion, pub batch_delete_up_tree_while_empty: FeatureVersion, @@ -329,9 +461,7 @@ pub struct DriveGroveBatchMethodVersions { pub struct DriveGroveApplyMethodVersions { pub grove_apply_operation: FeatureVersion, pub grove_apply_batch: FeatureVersion, - pub grove_apply_batch_with_add_costs: FeatureVersion, pub grove_apply_partial_batch: FeatureVersion, - pub grove_apply_partial_batch_with_add_costs: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -349,11 +479,13 @@ pub struct DriveCreditPoolMethodVersions { pub epochs: DriveCreditPoolEpochsMethodVersions, pub pending_epoch_refunds: DriveCreditPoolPendingEpochRefundsMethodVersions, pub storage_fee_distribution_pool: DriveCreditPoolStorageFeeDistributionPoolMethodVersions, + pub unpaid_epoch: DriveCreditPoolUnpaidEpochMethodVersions, } #[derive(Clone, Debug, Default)] pub struct DriveCreditPoolEpochsMethodVersions { pub get_epochs_infos: FeatureVersion, + pub get_epochs_protocol_versions: FeatureVersion, pub prove_epochs_infos: FeatureVersion, pub get_epoch_fee_multiplier: FeatureVersion, pub get_epoch_processing_credits_for_distribution: FeatureVersion, @@ -370,6 +502,11 @@ pub struct DriveCreditPoolEpochsMethodVersions { pub is_epochs_proposers_tree_empty: FeatureVersion, } +#[derive(Clone, Debug, Default)] +pub struct DriveCreditPoolUnpaidEpochMethodVersions { + pub get_unpaid_epoch_index: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct DriveCreditPoolPendingEpochRefundsMethodVersions { pub add_delete_pending_epoch_refunds_except_specified: FeatureVersion, @@ -386,7 +523,6 @@ pub struct DriveCreditPoolStorageFeeDistributionPoolMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveProtocolUpgradeVersions { pub clear_version_information: FeatureVersion, - pub change_to_new_version_and_clear_version_information: FeatureVersion, pub fetch_versions_with_counter: FeatureVersion, pub fetch_proved_versions_with_counter: FeatureVersion, pub fetch_validator_version_votes: FeatureVersion, @@ -411,11 +547,44 @@ pub struct DriveIdentityMethodVersions { pub insert: DriveIdentityInsertMethodVersions, pub contract_info: DriveIdentityContractInfoMethodVersions, pub cost_estimation: DriveIdentityCostEstimationMethodVersions, + pub withdrawals: DriveIdentityWithdrawalMethodVersions, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveIdentityWithdrawalMethodVersions { + pub document: DriveIdentityWithdrawalDocumentMethodVersions, + pub transaction: DriveIdentityWithdrawalTransactionMethodVersions, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveIdentityWithdrawalDocumentMethodVersions { + pub fetch_oldest_withdrawal_documents_by_status: FeatureVersion, + pub find_up_to_100_withdrawal_documents_by_status_and_transaction_indices: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveIdentityWithdrawalTransactionMethodVersions { + pub index: DriveIdentityWithdrawalTransactionIndexMethodVersions, + pub queue: DriveIdentityWithdrawalTransactionQueueMethodVersions, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveIdentityWithdrawalTransactionIndexMethodVersions { + pub fetch_next_withdrawal_transaction_index: FeatureVersion, + pub add_update_next_withdrawal_transaction_index_operation: FeatureVersion, +} + +#[derive(Clone, Debug, Default)] +pub struct DriveIdentityWithdrawalTransactionQueueMethodVersions { + pub add_enqueue_untied_withdrawal_transaction_operations: FeatureVersion, + pub dequeue_untied_withdrawal_transactions: FeatureVersion, } #[derive(Clone, Debug, Default)] pub struct DriveIdentityContractInfoMethodVersions { pub add_potential_contract_info_for_contract_bounded_key: FeatureVersion, + pub refresh_potential_contract_info_key_references: FeatureVersion, + pub merge_identity_contract_nonce: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -424,6 +593,7 @@ pub struct DriveIdentityCostEstimationMethodVersions { pub for_balances: FeatureVersion, pub for_contract_info: FeatureVersion, pub for_contract_info_group: FeatureVersion, + pub for_contract_info_group_keys: FeatureVersion, pub for_contract_info_group_key_purpose: FeatureVersion, pub for_keys_for_identity_id: FeatureVersion, pub for_negative_credit: FeatureVersion, @@ -457,6 +627,8 @@ pub struct DriveIdentityFetchPublicKeyHashesMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveIdentityFetchAttributesMethodVersions { pub revision: FeatureVersion, + pub nonce: FeatureVersion, + pub identity_contract_nonce: FeatureVersion, pub balance: FeatureVersion, pub balance_include_debt: FeatureVersion, pub negative_balance: FeatureVersion, @@ -470,15 +642,20 @@ pub struct DriveIdentityFetchFullIdentityMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveIdentityFetchPartialIdentityMethodVersions { + pub fetch_identity_revision_with_keys: FeatureVersion, pub fetch_identity_balance_with_keys: FeatureVersion, pub fetch_identity_balance_with_keys_and_revision: FeatureVersion, pub fetch_identity_with_balance: FeatureVersion, + pub fetch_identity_keys: FeatureVersion, } #[derive(Clone, Debug, Default)] pub struct DriveIdentityProveMethodVersions { pub full_identity: FeatureVersion, pub full_identities: FeatureVersion, + pub identity_nonce: FeatureVersion, + pub identity_contract_nonce: FeatureVersion, + pub identities_contract_keys: FeatureVersion, pub prove_full_identities_by_unique_public_key_hashes: FeatureVersion, pub prove_full_identity_by_unique_public_key_hash: FeatureVersion, pub prove_identity_id_by_unique_public_key_hash: FeatureVersion, @@ -499,6 +676,7 @@ pub struct DriveIdentityKeysFetchMethodVersions { pub fetch_all_identity_keys: FeatureVersion, pub fetch_identities_all_keys: FeatureVersion, pub fetch_identity_keys: FeatureVersion, + pub fetch_identities_contract_keys: FeatureVersion, } #[derive(Clone, Debug, Default)] @@ -536,6 +714,7 @@ pub struct DriveIdentityInsertMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveIdentityUpdateMethodVersions { pub update_identity_revision: FeatureVersion, + pub merge_identity_nonce: FeatureVersion, pub update_identity_negative_credit_operation: FeatureVersion, pub initialize_identity_revision: FeatureVersion, pub disable_identity_keys: FeatureVersion, @@ -549,10 +728,14 @@ pub struct DriveIdentityUpdateMethodVersions { pub add_to_previous_balance: FeatureVersion, pub apply_balance_change_from_fee_to_identity: FeatureVersion, pub remove_from_identity_balance: FeatureVersion, + pub refresh_identity_key_reference_operations: FeatureVersion, } #[derive(Clone, Debug, Default)] pub struct DriveEstimatedCostsMethodVersions { pub add_estimation_costs_for_levels_up_to_contract: FeatureVersion, pub add_estimation_costs_for_levels_up_to_contract_document_type_excluded: FeatureVersion, + pub add_estimation_costs_for_contested_document_tree_levels_up_to_contract: FeatureVersion, + pub add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded: + FeatureVersion, } diff --git a/packages/rs-platform-version/src/version/fee/data_contract/mod.rs b/packages/rs-platform-version/src/version/fee/data_contract/mod.rs new file mode 100644 index 00000000000..96921030e1c --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/data_contract/mod.rs @@ -0,0 +1,46 @@ +use bincode::{Decode, Encode}; + +pub mod v1; + +#[derive(Clone, Debug, Default, Encode, Decode, PartialEq, Eq)] +pub struct FeeDataContractValidationVersion { + pub document_type_base_fee: u64, + pub document_type_size_fee: u64, + pub document_type_per_property_fee: u64, + pub document_type_base_non_unique_index_fee: u64, + pub document_type_non_unique_index_per_property_fee: u64, + pub document_type_base_unique_index_fee: u64, + pub document_type_unique_index_per_property_fee: u64, +} + +#[cfg(test)] +mod tests { + use super::FeeDataContractValidationVersion; + + #[test] + // If this test failed, then a new field was added in FeeDataContractValidationVersion. And the corresponding eq needs to be updated as well + fn test_fee_data_contract_validation_fees_version_equality() { + let version1 = FeeDataContractValidationVersion { + document_type_base_fee: 1, + document_type_size_fee: 2, + document_type_per_property_fee: 3, + document_type_base_non_unique_index_fee: 4, + document_type_non_unique_index_per_property_fee: 5, + document_type_base_unique_index_fee: 6, + document_type_unique_index_per_property_fee: 7, + }; + + let version2 = FeeDataContractValidationVersion { + document_type_base_fee: 1, + document_type_size_fee: 2, + document_type_per_property_fee: 3, + document_type_base_non_unique_index_fee: 4, + document_type_non_unique_index_per_property_fee: 5, + document_type_base_unique_index_fee: 6, + document_type_unique_index_per_property_fee: 7, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "FeeDataContractValidationVersion equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/data_contract/v1.rs b/packages/rs-platform-version/src/version/fee/data_contract/v1.rs new file mode 100644 index 00000000000..516da472cfd --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/data_contract/v1.rs @@ -0,0 +1,12 @@ +use crate::version::fee::data_contract::FeeDataContractValidationVersion; + +pub const FEE_DATA_CONTRACT_VALIDATION_VERSION1: FeeDataContractValidationVersion = + FeeDataContractValidationVersion { + document_type_base_fee: 500, + document_type_size_fee: 10, + document_type_per_property_fee: 40, + document_type_base_non_unique_index_fee: 50, + document_type_non_unique_index_per_property_fee: 30, + document_type_base_unique_index_fee: 100, + document_type_unique_index_per_property_fee: 60, + }; diff --git a/packages/rs-platform-version/src/version/fee/hashing/mod.rs b/packages/rs-platform-version/src/version/fee/hashing/mod.rs new file mode 100644 index 00000000000..2d403156019 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/hashing/mod.rs @@ -0,0 +1,40 @@ +use bincode::{Decode, Encode}; + +pub mod v1; + +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] +pub struct FeeHashingVersion { + pub blake3_base: u64, + pub blake3_per_block: u64, + pub sha256_per_block: u64, + pub sha256_ripe_md160_base: u64, + pub single_sha256_base: u64, +} + +#[cfg(test)] +mod tests { + use super::FeeHashingVersion; + + #[test] + // If this test failed, then a new field was added in FeeHashingVersion. And the corresponding eq needs to be updated as well + fn test_fee_hashing_version_equality() { + let version1 = FeeHashingVersion { + single_sha256_base: 1, + blake3_base: 2, + sha256_ripe_md160_base: 3, + sha256_per_block: 4, + blake3_per_block: 5, + }; + + let version2 = FeeHashingVersion { + single_sha256_base: 1, + blake3_base: 2, + sha256_ripe_md160_base: 3, + sha256_per_block: 4, + blake3_per_block: 5, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "FeeHashingVersion equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/hashing/v1.rs b/packages/rs-platform-version/src/version/fee/hashing/v1.rs new file mode 100644 index 00000000000..d7bc98fb9b1 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/hashing/v1.rs @@ -0,0 +1,9 @@ +use crate::version::fee::hashing::FeeHashingVersion; + +pub const FEE_HASHING_VERSION1: FeeHashingVersion = FeeHashingVersion { + single_sha256_base: 100, + blake3_base: 100, + sha256_ripe_md160_base: 6000, + sha256_per_block: 5000, + blake3_per_block: 300, +}; diff --git a/packages/rs-platform-version/src/version/fee/mod.rs b/packages/rs-platform-version/src/version/fee/mod.rs new file mode 100644 index 00000000000..c868a3028d6 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/mod.rs @@ -0,0 +1,163 @@ +use crate::version::fee::data_contract::FeeDataContractValidationVersion; +use crate::version::fee::hashing::FeeHashingVersion; +use crate::version::fee::processing::FeeProcessingVersion; +use crate::version::fee::signature::FeeSignatureVersion; +use crate::version::fee::state_transition_min_fees::StateTransitionMinFees; +use crate::version::fee::storage::FeeStorageVersion; +use crate::version::fee::vote_resolution_fund_fees::VoteResolutionFundFees; +use bincode::{Decode, Encode}; + +mod data_contract; +mod hashing; +mod processing; +pub mod signature; +pub mod state_transition_min_fees; +pub mod storage; +pub mod v1; +pub mod vote_resolution_fund_fees; + +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] +pub struct FeeVersion { + // Permille means devise by 1000 + pub uses_version_fee_multiplier_permille: Option, + pub storage: FeeStorageVersion, + pub signature: FeeSignatureVersion, + pub hashing: FeeHashingVersion, + pub processing: FeeProcessingVersion, + pub data_contract: FeeDataContractValidationVersion, + pub state_transition_min_fees: StateTransitionMinFees, + pub vote_resolution_fund_fees: VoteResolutionFundFees, +} + +#[cfg(test)] +mod tests { + use super::FeeVersion; + use crate::version::fee::data_contract::FeeDataContractValidationVersion; + use crate::version::fee::hashing::FeeHashingVersion; + use crate::version::fee::processing::FeeProcessingVersion; + use crate::version::fee::signature::FeeSignatureVersion; + use crate::version::fee::state_transition_min_fees::StateTransitionMinFees; + use crate::version::fee::storage::FeeStorageVersion; + use crate::version::fee::vote_resolution_fund_fees::VoteResolutionFundFees; + + #[test] + // If this test failed, then a new field was added in FeeVersion. And the corresponding eq needs to be updated as well + fn test_fee_version_equality() { + let version1 = FeeVersion { + uses_version_fee_multiplier_permille: None, + storage: FeeStorageVersion { + storage_disk_usage_credit_per_byte: 1, + storage_processing_credit_per_byte: 2, + storage_load_credit_per_byte: 3, + non_storage_load_credit_per_byte: 4, + storage_seek_cost: 5, + }, + signature: FeeSignatureVersion { + verify_signature_ecdsa_secp256k1: 1, + verify_signature_bls12_381: 2, + verify_signature_ecdsa_hash160: 3, + verify_signature_bip13_script_hash: 4, + verify_signature_eddsa25519_hash160: 5, + }, + hashing: FeeHashingVersion { + single_sha256_base: 1, + blake3_base: 2, + sha256_ripe_md160_base: 3, + sha256_per_block: 4, + blake3_per_block: 5, + }, + processing: FeeProcessingVersion { + fetch_identity_balance_processing_cost: 1, + fetch_identity_revision_processing_cost: 2, + fetch_identity_balance_and_revision_processing_cost: 3, + fetch_identity_cost_per_look_up_key_by_id: 4, + fetch_single_identity_key_processing_cost: 5, + validate_key_structure: 6, + fetch_prefunded_specialized_balance_processing_cost: 7, + }, + data_contract: FeeDataContractValidationVersion { + document_type_base_fee: 1, + document_type_size_fee: 2, + document_type_per_property_fee: 3, + document_type_base_non_unique_index_fee: 4, + document_type_non_unique_index_per_property_fee: 5, + document_type_base_unique_index_fee: 6, + document_type_unique_index_per_property_fee: 7, + }, + state_transition_min_fees: StateTransitionMinFees { + credit_transfer: 1, + credit_withdrawal: 2, + identity_update: 3, + document_batch_sub_transition: 4, + contract_create: 5, + contract_update: 6, + masternode_vote: 7, + }, + vote_resolution_fund_fees: VoteResolutionFundFees { + contested_document_vote_resolution_fund_required_amount: 1, + contested_document_vote_resolution_unlock_fund_required_amount: 2, + contested_document_single_vote_cost: 3, + }, + }; + + let version2 = FeeVersion { + uses_version_fee_multiplier_permille: None, + storage: FeeStorageVersion { + storage_disk_usage_credit_per_byte: 1, + storage_processing_credit_per_byte: 2, + storage_load_credit_per_byte: 3, + non_storage_load_credit_per_byte: 4, + storage_seek_cost: 5, + }, + signature: FeeSignatureVersion { + verify_signature_ecdsa_secp256k1: 1, + verify_signature_bls12_381: 2, + verify_signature_ecdsa_hash160: 3, + verify_signature_bip13_script_hash: 4, + verify_signature_eddsa25519_hash160: 5, + }, + hashing: FeeHashingVersion { + single_sha256_base: 1, + blake3_base: 2, + sha256_ripe_md160_base: 3, + sha256_per_block: 4, + blake3_per_block: 5, + }, + processing: FeeProcessingVersion { + fetch_identity_balance_processing_cost: 1, + fetch_identity_revision_processing_cost: 2, + fetch_identity_balance_and_revision_processing_cost: 3, + fetch_identity_cost_per_look_up_key_by_id: 4, + fetch_single_identity_key_processing_cost: 5, + validate_key_structure: 6, + fetch_prefunded_specialized_balance_processing_cost: 7, + }, + data_contract: FeeDataContractValidationVersion { + document_type_base_fee: 1, + document_type_size_fee: 2, + document_type_per_property_fee: 3, + document_type_base_non_unique_index_fee: 4, + document_type_non_unique_index_per_property_fee: 5, + document_type_base_unique_index_fee: 6, + document_type_unique_index_per_property_fee: 7, + }, + state_transition_min_fees: StateTransitionMinFees { + credit_transfer: 1, + credit_withdrawal: 2, + identity_update: 3, + document_batch_sub_transition: 4, + contract_create: 5, + contract_update: 6, + masternode_vote: 7, + }, + vote_resolution_fund_fees: VoteResolutionFundFees { + contested_document_vote_resolution_fund_required_amount: 1, + contested_document_vote_resolution_unlock_fund_required_amount: 2, + contested_document_single_vote_cost: 3, + }, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "FeeVersion equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/processing/mod.rs b/packages/rs-platform-version/src/version/fee/processing/mod.rs new file mode 100644 index 00000000000..0427cd09167 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/processing/mod.rs @@ -0,0 +1,46 @@ +use bincode::{Decode, Encode}; + +pub mod v1; + +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] +pub struct FeeProcessingVersion { + pub fetch_identity_balance_processing_cost: u64, + pub fetch_identity_revision_processing_cost: u64, + pub fetch_identity_balance_and_revision_processing_cost: u64, + pub fetch_identity_cost_per_look_up_key_by_id: u64, + pub fetch_prefunded_specialized_balance_processing_cost: u64, + pub fetch_single_identity_key_processing_cost: u64, + pub validate_key_structure: u64, +} + +#[cfg(test)] +mod tests { + use super::FeeProcessingVersion; + + #[test] + // If this test failed, then a new field was added in FeeProcessingVersion. And the corresponding eq needs to be updated as well + fn test_fee_processing_version_equality() { + let version1 = FeeProcessingVersion { + fetch_identity_balance_processing_cost: 1, + fetch_identity_revision_processing_cost: 2, + fetch_identity_balance_and_revision_processing_cost: 3, + fetch_identity_cost_per_look_up_key_by_id: 4, + fetch_single_identity_key_processing_cost: 5, + validate_key_structure: 6, + fetch_prefunded_specialized_balance_processing_cost: 7, + }; + + let version2 = FeeProcessingVersion { + fetch_identity_balance_processing_cost: 1, + fetch_identity_revision_processing_cost: 2, + fetch_identity_balance_and_revision_processing_cost: 3, + fetch_identity_cost_per_look_up_key_by_id: 4, + fetch_single_identity_key_processing_cost: 5, + validate_key_structure: 6, + fetch_prefunded_specialized_balance_processing_cost: 7, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "FeeProcessingVersion equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/processing/v1.rs b/packages/rs-platform-version/src/version/fee/processing/v1.rs new file mode 100644 index 00000000000..dbedd153d9c --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/processing/v1.rs @@ -0,0 +1,11 @@ +use crate::version::fee::processing::FeeProcessingVersion; + +pub const FEE_PROCESSING_VERSION1: FeeProcessingVersion = FeeProcessingVersion { + fetch_identity_balance_processing_cost: 10000, + fetch_identity_revision_processing_cost: 9000, + fetch_identity_balance_and_revision_processing_cost: 15000, + fetch_identity_cost_per_look_up_key_by_id: 9000, + fetch_prefunded_specialized_balance_processing_cost: 10000, + fetch_single_identity_key_processing_cost: 10000, + validate_key_structure: 50, +}; diff --git a/packages/rs-platform-version/src/version/fee/signature/mod.rs b/packages/rs-platform-version/src/version/fee/signature/mod.rs new file mode 100644 index 00000000000..6a667bd574d --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/signature/mod.rs @@ -0,0 +1,40 @@ +use bincode::{Decode, Encode}; + +pub mod v1; + +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] +pub struct FeeSignatureVersion { + pub verify_signature_ecdsa_secp256k1: u64, + pub verify_signature_bls12_381: u64, + pub verify_signature_ecdsa_hash160: u64, + pub verify_signature_bip13_script_hash: u64, + pub verify_signature_eddsa25519_hash160: u64, +} + +#[cfg(test)] +mod tests { + use super::FeeSignatureVersion; + + #[test] + // If this test failed, then a new field was added in FeeSignatureVersion. And the corresponding eq needs to be updated as well + fn test_fee_signature_version_equality() { + let version1 = FeeSignatureVersion { + verify_signature_ecdsa_secp256k1: 1, + verify_signature_bls12_381: 2, + verify_signature_ecdsa_hash160: 3, + verify_signature_bip13_script_hash: 4, + verify_signature_eddsa25519_hash160: 5, + }; + + let version2 = FeeSignatureVersion { + verify_signature_ecdsa_secp256k1: 1, + verify_signature_bls12_381: 2, + verify_signature_ecdsa_hash160: 3, + verify_signature_bip13_script_hash: 4, + verify_signature_eddsa25519_hash160: 5, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "FeeSignatureVersion equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/signature/v1.rs b/packages/rs-platform-version/src/version/fee/signature/v1.rs new file mode 100644 index 00000000000..9e9ba2b2de1 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/signature/v1.rs @@ -0,0 +1,9 @@ +use crate::version::fee::signature::FeeSignatureVersion; + +pub const FEE_SIGNATURE_VERSION1: FeeSignatureVersion = FeeSignatureVersion { + verify_signature_ecdsa_secp256k1: 15_000, + verify_signature_bls12_381: 300_000, + verify_signature_ecdsa_hash160: 15_500, + verify_signature_bip13_script_hash: 300_000, + verify_signature_eddsa25519_hash160: 3_500, +}; diff --git a/packages/rs-platform-version/src/version/fee/state_transition_min_fees/mod.rs b/packages/rs-platform-version/src/version/fee/state_transition_min_fees/mod.rs new file mode 100644 index 00000000000..2b099d7143b --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/state_transition_min_fees/mod.rs @@ -0,0 +1,45 @@ +use bincode::{Decode, Encode}; + +pub mod v1; +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] +pub struct StateTransitionMinFees { + pub credit_transfer: u64, + pub credit_withdrawal: u64, + pub identity_update: u64, + pub document_batch_sub_transition: u64, + pub contract_create: u64, + pub contract_update: u64, + pub masternode_vote: u64, +} + +#[cfg(test)] +mod tests { + use super::StateTransitionMinFees; + + #[test] + // If this test failed, then a new field was added in StateTransitionMinFees. And the corresponding eq needs to be updated as well + fn test_fee_state_transition_min_fees_version_equality() { + let version1 = StateTransitionMinFees { + credit_transfer: 1, + credit_withdrawal: 2, + identity_update: 3, + document_batch_sub_transition: 4, + contract_create: 5, + contract_update: 6, + masternode_vote: 7, + }; + + let version2 = StateTransitionMinFees { + credit_transfer: 1, + credit_withdrawal: 2, + identity_update: 3, + document_batch_sub_transition: 4, + contract_create: 5, + contract_update: 6, + masternode_vote: 7, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "StateTransitionMinFees equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/state_transition_min_fees/v1.rs b/packages/rs-platform-version/src/version/fee/state_transition_min_fees/v1.rs new file mode 100644 index 00000000000..5f759e50fc0 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/state_transition_min_fees/v1.rs @@ -0,0 +1,11 @@ +use crate::version::fee::state_transition_min_fees::StateTransitionMinFees; + +pub const STATE_TRANSITION_MIN_FEES_VERSION1: StateTransitionMinFees = StateTransitionMinFees { + credit_transfer: 100000, + credit_withdrawal: 100000, + identity_update: 100000, + document_batch_sub_transition: 100000, + contract_create: 100000, + contract_update: 100000, + masternode_vote: 100000, +}; diff --git a/packages/rs-platform-version/src/version/fee/storage/mod.rs b/packages/rs-platform-version/src/version/fee/storage/mod.rs new file mode 100644 index 00000000000..f6121321ba5 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/storage/mod.rs @@ -0,0 +1,40 @@ +use bincode::{Decode, Encode}; + +pub mod v1; + +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] +pub struct FeeStorageVersion { + pub storage_disk_usage_credit_per_byte: u64, + pub storage_processing_credit_per_byte: u64, + pub storage_load_credit_per_byte: u64, + pub non_storage_load_credit_per_byte: u64, + pub storage_seek_cost: u64, +} + +#[cfg(test)] +mod tests { + use super::FeeStorageVersion; + + #[test] + // If this test failed, then a new field was added in FeeProcessingVersion. And the corresponding eq needs to be updated as well + fn test_fee_storage_version_equality() { + let version1 = FeeStorageVersion { + storage_disk_usage_credit_per_byte: 1, + storage_processing_credit_per_byte: 2, + storage_load_credit_per_byte: 3, + non_storage_load_credit_per_byte: 4, + storage_seek_cost: 5, + }; + + let version2 = FeeStorageVersion { + storage_disk_usage_credit_per_byte: 1, + storage_processing_credit_per_byte: 2, + storage_load_credit_per_byte: 3, + non_storage_load_credit_per_byte: 4, + storage_seek_cost: 5, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "FeeStorageVersion equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/storage/v1.rs b/packages/rs-platform-version/src/version/fee/storage/v1.rs new file mode 100644 index 00000000000..dcc30327ac4 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/storage/v1.rs @@ -0,0 +1,11 @@ +use crate::version::fee::storage::FeeStorageVersion; + +// these fees were originally calculated based on a cost of 30 $ / Dash + +pub const FEE_STORAGE_VERSION1: FeeStorageVersion = FeeStorageVersion { + storage_disk_usage_credit_per_byte: 27000, + storage_processing_credit_per_byte: 400, + storage_load_credit_per_byte: 20, + non_storage_load_credit_per_byte: 10, + storage_seek_cost: 2000, +}; diff --git a/packages/rs-platform-version/src/version/fee/v1.rs b/packages/rs-platform-version/src/version/fee/v1.rs new file mode 100644 index 00000000000..dc5a976e114 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/v1.rs @@ -0,0 +1,19 @@ +use crate::version::fee::data_contract::v1::FEE_DATA_CONTRACT_VALIDATION_VERSION1; +use crate::version::fee::hashing::v1::FEE_HASHING_VERSION1; +use crate::version::fee::processing::v1::FEE_PROCESSING_VERSION1; +use crate::version::fee::signature::v1::FEE_SIGNATURE_VERSION1; +use crate::version::fee::state_transition_min_fees::v1::STATE_TRANSITION_MIN_FEES_VERSION1; +use crate::version::fee::storage::v1::FEE_STORAGE_VERSION1; +use crate::version::fee::vote_resolution_fund_fees::v1::VOTE_RESOLUTION_FUND_FEES_VERSION1; +use crate::version::fee::FeeVersion; + +pub const FEE_VERSION1: FeeVersion = FeeVersion { + uses_version_fee_multiplier_permille: Some(1000), //No action + storage: FEE_STORAGE_VERSION1, + signature: FEE_SIGNATURE_VERSION1, + hashing: FEE_HASHING_VERSION1, + processing: FEE_PROCESSING_VERSION1, + data_contract: FEE_DATA_CONTRACT_VALIDATION_VERSION1, + state_transition_min_fees: STATE_TRANSITION_MIN_FEES_VERSION1, + vote_resolution_fund_fees: VOTE_RESOLUTION_FUND_FEES_VERSION1, +}; diff --git a/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs b/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs new file mode 100644 index 00000000000..ba594961d40 --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs @@ -0,0 +1,36 @@ +use bincode::{Decode, Encode}; + +pub mod v1; +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] +pub struct VoteResolutionFundFees { + /// This is the amount that will be deducted from an identity and used to pay for voting + pub contested_document_vote_resolution_fund_required_amount: u64, + /// This is the amount that will be deducted from an identity and used to pay for voting if we are currently locked + pub contested_document_vote_resolution_unlock_fund_required_amount: u64, + /// This is the amount that a single vote will cost + pub contested_document_single_vote_cost: u64, +} + +#[cfg(test)] +mod tests { + use super::VoteResolutionFundFees; + + #[test] + // If this test failed, then a new field was added in VoteResolutionFundFees. And the corresponding eq needs to be updated as well + fn test_fee_storage_version_equality() { + let version1 = VoteResolutionFundFees { + contested_document_vote_resolution_fund_required_amount: 1, + contested_document_vote_resolution_unlock_fund_required_amount: 2, + contested_document_single_vote_cost: 3, + }; + + let version2 = VoteResolutionFundFees { + contested_document_vote_resolution_fund_required_amount: 1, + contested_document_vote_resolution_unlock_fund_required_amount: 2, + contested_document_single_vote_cost: 3, + }; + + // This assertion will check if all fields are considered in the equality comparison + assert_eq!(version1, version2, "VoteResolutionFundFees equality test failed. If a field was added or removed, update the Eq implementation."); + } +} diff --git a/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/v1.rs b/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/v1.rs new file mode 100644 index 00000000000..4275b122c5c --- /dev/null +++ b/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/v1.rs @@ -0,0 +1,7 @@ +use crate::version::fee::vote_resolution_fund_fees::VoteResolutionFundFees; + +pub const VOTE_RESOLUTION_FUND_FEES_VERSION1: VoteResolutionFundFees = VoteResolutionFundFees { + contested_document_vote_resolution_fund_required_amount: 20000000000, // 0.2 Dash + contested_document_vote_resolution_unlock_fund_required_amount: 400000000000, // 4 Dash + contested_document_single_vote_cost: 10000000, // 0.0001 Dash +}; diff --git a/packages/rs-platform-version/src/version/limits.rs b/packages/rs-platform-version/src/version/limits.rs new file mode 100644 index 00000000000..7035d6ae7c1 --- /dev/null +++ b/packages/rs-platform-version/src/version/limits.rs @@ -0,0 +1,7 @@ +#[derive(Clone, Debug, Default)] +pub struct SystemLimits { + pub estimated_contract_max_serialized_size: u16, + pub max_field_value_size: u32, + pub max_state_transition_size: u64, + pub max_transitions_in_documents_batch: u16, +} diff --git a/packages/rs-platform-version/src/version/mocks/mod.rs b/packages/rs-platform-version/src/version/mocks/mod.rs index dd77c1a8ef9..aef47dea3d5 100644 --- a/packages/rs-platform-version/src/version/mocks/mod.rs +++ b/packages/rs-platform-version/src/version/mocks/mod.rs @@ -1,4 +1,4 @@ pub mod v2_test; pub mod v3_test; -pub(crate) const TEST_BYTES: u32 = 28; +pub const TEST_PROTOCOL_VERSION_SHIFT_BYTES: u32 = 28; diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 481b2b0a6a3..5cc03cec93c 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -1,30 +1,37 @@ +use crate::version::contracts::SystemDataContractVersions; use crate::version::dpp_versions::{ - ContractVersions, CostVersions, DPPValidationVersions, DPPVersion, DataContractMethodVersions, - DataContractValidationVersions, DocumentFeatureVersionBounds, DocumentMethodVersions, - DocumentTransitionVersions, DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, - DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeVersions, DocumentVersions, - DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, + AssetLockVersions, ContractVersions, CostVersions, DPPMethodVersions, DPPValidationVersions, + DPPVersion, DataContractMethodVersions, DataContractValidationVersions, + DocumentFeatureVersionBounds, DocumentMethodVersions, DocumentTransitionVersions, + DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, + DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, + DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, + VotingValidationVersions, VotingVersions, }; use crate::version::drive_abci_versions::{ DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreSubsidyMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersionsAndConstants, + DriveAbciCoreInstantSendLockMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, - DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, - DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, + DriveAbciPlatformStateStorageMethodVersions, DriveAbciProtocolUpgradeMethodVersions, + DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, + DriveAbciQueryPrefundedSpecializedBalancesVersions, DriveAbciQuerySystemVersions, + DriveAbciQueryVersions, DriveAbciQueryVotingVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, - DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, - DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, + DriveAbciValidationConstants, DriveAbciValidationDataTriggerAndBindingVersions, + DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, + DriveAbciVotingMethodVersions, PenaltyAmounts, }; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, @@ -34,43 +41,51 @@ use crate::version::drive_versions::{ DriveCreditPoolEpochsMethodVersions, DriveCreditPoolMethodVersions, DriveCreditPoolPendingEpochRefundsMethodVersions, DriveCreditPoolStorageFeeDistributionPoolMethodVersions, - DriveDataContractOperationMethodVersions, DriveDocumentDeleteMethodVersions, - DriveDocumentEstimationCostsMethodVersions, DriveDocumentIndexUniquenessMethodVersions, + DriveCreditPoolUnpaidEpochMethodVersions, DriveDataContractOperationMethodVersions, + DriveDocumentDeleteMethodVersions, DriveDocumentEstimationCostsMethodVersions, + DriveDocumentIndexUniquenessMethodVersions, DriveDocumentInsertContestedMethodVersions, DriveDocumentInsertMethodVersions, DriveDocumentMethodVersions, DriveDocumentQueryMethodVersions, DriveDocumentUpdateMethodVersions, - DriveEstimatedCostsMethodVersions, DriveFeesMethodVersions, DriveGroveApplyMethodVersions, - DriveGroveBasicMethodVersions, DriveGroveBatchMethodVersions, DriveGroveCostMethodVersions, - DriveGroveMethodVersions, DriveIdentityContractInfoMethodVersions, - DriveIdentityCostEstimationMethodVersions, DriveIdentityFetchAttributesMethodVersions, - DriveIdentityFetchFullIdentityMethodVersions, DriveIdentityFetchMethodVersions, - DriveIdentityFetchPartialIdentityMethodVersions, + DriveEstimatedCostsMethodVersions, DriveFeesMethodVersions, DriveFetchMethodVersions, + DriveGroveApplyMethodVersions, DriveGroveBasicMethodVersions, DriveGroveBatchMethodVersions, + DriveGroveCostMethodVersions, DriveGroveMethodVersions, + DriveIdentityContractInfoMethodVersions, DriveIdentityCostEstimationMethodVersions, + DriveIdentityFetchAttributesMethodVersions, DriveIdentityFetchFullIdentityMethodVersions, + DriveIdentityFetchMethodVersions, DriveIdentityFetchPartialIdentityMethodVersions, DriveIdentityFetchPublicKeyHashesMethodVersions, DriveIdentityInsertMethodVersions, DriveIdentityKeyHashesToIdentityInsertMethodVersions, DriveIdentityKeysFetchMethodVersions, DriveIdentityKeysInsertMethodVersions, DriveIdentityKeysMethodVersions, DriveIdentityKeysProveMethodVersions, DriveIdentityMethodVersions, DriveIdentityProveMethodVersions, DriveIdentityUpdateMethodVersions, - DriveInitializationMethodVersions, DriveMethodVersions, DriveOperationsMethodVersion, - DrivePlatformSystemMethodVersions, DriveProtocolUpgradeVersions, DriveProveMethodVersions, + DriveIdentityWithdrawalDocumentMethodVersions, DriveIdentityWithdrawalMethodVersions, + DriveIdentityWithdrawalTransactionIndexMethodVersions, + DriveIdentityWithdrawalTransactionMethodVersions, + DriveIdentityWithdrawalTransactionQueueMethodVersions, DriveInitializationMethodVersions, + DriveMethodVersions, DriveOperationsMethodVersion, DrivePlatformStateMethodVersions, + DrivePlatformSystemMethodVersions, DrivePrefundedSpecializedMethodVersions, + DriveProtocolUpgradeVersions, DriveProveMethodVersions, + DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions, DriveStateTransitionMethodVersions, DriveStateTransitionOperationMethodVersions, DriveStructureVersion, DriveSystemEstimationCostsMethodVersions, - DriveSystemProtocolVersionMethodVersions, DriveVerifyContractMethodVersions, - DriveVerifyDocumentMethodVersions, DriveVerifyIdentityMethodVersions, - DriveVerifyMethodVersions, DriveVerifySingleDocumentMethodVersions, - DriveVerifySystemMethodVersions, DriveVersion, + DriveVerifyContractMethodVersions, DriveVerifyDocumentMethodVersions, + DriveVerifyIdentityMethodVersions, DriveVerifyMethodVersions, + DriveVerifySingleDocumentMethodVersions, DriveVerifyStateTransitionMethodVersions, + DriveVerifySystemMethodVersions, DriveVerifyVoteMethodVersions, DriveVersion, + DriveVoteCleanupMethodVersions, DriveVoteContestedResourceInsertMethodVersions, + DriveVoteFetchMethodVersions, DriveVoteInsertMethodVersions, DriveVoteMethodVersions, + DriveVoteSetupMethodVersions, DriveVoteStorageFormMethodVersions, }; -use crate::version::mocks::TEST_BYTES; +use crate::version::fee::v1::FEE_VERSION1; +use crate::version::limits::SystemLimits; +use crate::version::mocks::TEST_PROTOCOL_VERSION_SHIFT_BYTES; use crate::version::protocol_version::{FeatureVersionBounds, PlatformVersion}; -use crate::version::{AbciStructureVersion, PlatformArchitectureVersion}; +use crate::version::PlatformArchitectureVersion; +use grovedb_version::version::v1::GROVE_V1; -pub const TEST_PROTOCOL_VERSION_2: u32 = (1 << TEST_BYTES) + 2; +pub const TEST_PROTOCOL_VERSION_2: u32 = (1 << TEST_PROTOCOL_VERSION_SHIFT_BYTES) + 2; -pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { +pub const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { protocol_version: TEST_PROTOCOL_VERSION_2, - identity: FeatureVersionBounds { - min_version: 0, - max_version: 0, - default_current_version: 0, - }, proofs: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -101,6 +116,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { credit_pools: DriveCreditPoolMethodVersions { epochs: DriveCreditPoolEpochsMethodVersions { get_epochs_infos: 0, + get_epochs_protocol_versions: 0, prove_epochs_infos: 0, get_epoch_fee_multiplier: 0, get_epoch_processing_credits_for_distribution: 0, @@ -126,10 +142,12 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { DriveCreditPoolStorageFeeDistributionPoolMethodVersions { get_storage_fees_from_distribution_pool: 0, }, + unpaid_epoch: DriveCreditPoolUnpaidEpochMethodVersions { + get_unpaid_epoch_index: 0, + }, }, protocol_upgrade: DriveProtocolUpgradeVersions { clear_version_information: 0, - change_to_new_version_and_clear_version_information: 0, fetch_versions_with_counter: 0, fetch_proved_versions_with_counter: 0, fetch_validator_version_votes: 0, @@ -137,7 +155,10 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { remove_validators_proposed_app_versions: 0, update_validator_proposed_app_version: 0, }, - prove: DriveProveMethodVersions { prove_multiple: 0 }, + prove: DriveProveMethodVersions { + prove_elements: 0, + prove_multiple_state_transition_results: 0, + }, balances: DriveBalancesMethodVersions { add_to_system_credits: 0, add_to_system_credits_operations: 0, @@ -170,6 +191,16 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { add_indices_for_top_index_level_for_contract_operations: 0, add_reference_for_index_level_for_contract_operations: 0, }, + insert_contested: DriveDocumentInsertContestedMethodVersions { + add_contested_document: 0, + add_contested_document_for_contract: 0, + add_contested_document_for_contract_apply_and_add_to_operations: 0, + add_contested_document_for_contract_operations: 0, + add_contested_document_to_primary_storage: 0, + add_contested_indices_for_contract_operations: 0, + add_contested_reference_and_vote_subtree_to_document_operations: 0, + add_contested_vote_subtree_for_non_identities_operations: 0, + }, update: DriveDocumentUpdateMethodVersions { add_update_multiple_documents_operations: 0, update_document_for_contract: 0, @@ -181,15 +212,49 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { }, estimation_costs: DriveDocumentEstimationCostsMethodVersions { add_estimation_costs_for_add_document_to_primary_storage: 0, + add_estimation_costs_for_add_contested_document_to_primary_storage: 0, stateless_delete_of_non_tree_for_costs: 0, }, index_uniqueness: DriveDocumentIndexUniquenessMethodVersions { validate_document_uniqueness: 0, validate_document_create_transition_action_uniqueness: 0, validate_document_replace_transition_action_uniqueness: 0, + validate_document_transfer_transition_action_uniqueness: 0, + validate_document_purchase_transition_action_uniqueness: 0, + validate_document_update_price_transition_action_uniqueness: 0, validate_uniqueness_of_data: 0, }, }, + vote: DriveVoteMethodVersions { + insert: DriveVoteInsertMethodVersions { + register_identity_vote: 0, + }, + contested_resource_insert: DriveVoteContestedResourceInsertMethodVersions { + register_contested_resource_identity_vote: 0, + insert_stored_info_for_contested_resource_vote_poll: 0, + register_identity_vote: 0, + add_vote_poll_end_date_query_operations: 0, + }, + cleanup: DriveVoteCleanupMethodVersions { + remove_specific_vote_references_given_by_identity: 0, + remove_specific_votes_given_by_identity: 0, + remove_contested_resource_vote_poll_end_date_query_operations: 0, + remove_contested_resource_vote_poll_votes_operations: 0, + remove_contested_resource_vote_poll_documents_operations: 0, + remove_contested_resource_vote_poll_contenders_operations: 0, + }, + setup: DriveVoteSetupMethodVersions { + add_initial_vote_tree_main_structure_operations: 0, + }, + storage_form: DriveVoteStorageFormMethodVersions { + resolve_with_contract: 0, + }, + fetch: DriveVoteFetchMethodVersions { + fetch_identities_voting_for_contenders: 0, + fetch_contested_document_vote_poll_stored_info: 0, + fetch_identity_contested_resource_vote: 0, + }, + }, contract: DriveContractMethodVersions { prove: DriveContractProveMethodVersions { prove_contract: 0, @@ -220,11 +285,13 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { estimated_costs: DriveEstimatedCostsMethodVersions { add_estimation_costs_for_levels_up_to_contract: 0, add_estimation_costs_for_levels_up_to_contract_document_type_excluded: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded: 0, }, asset_lock: DriveAssetLockMethodVersions { add_asset_lock_outpoint: 0, add_estimation_costs_for_adding_asset_lock: 0, - has_asset_lock_outpoint: 0, + fetch_asset_lock_outpoint_info: 0, }, verify: DriveVerifyMethodVersions { contract: DriveVerifyContractMethodVersions { @@ -245,6 +312,9 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { verify_identity_id_by_public_key_hash: 0, verify_identity_ids_by_public_key_hashes: 0, verify_identity_keys_by_identity_id: 0, + verify_identity_nonce: 0, + verify_identity_contract_nonce: 0, + verify_identities_contract_keys: 0, }, single_document: DriveVerifySingleDocumentMethodVersions { verify_proof: 0, @@ -252,9 +322,24 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { }, system: DriveVerifySystemMethodVersions { verify_epoch_infos: 0, + verify_elements: 0, + verify_total_credits_in_system: 0, verify_upgrade_state: 0, verify_upgrade_vote_status: 0, }, + voting: DriveVerifyVoteMethodVersions { + verify_masternode_vote: 0, + verify_start_at_contender_in_proof: 0, + verify_vote_poll_votes_proof: 0, + verify_identity_votes_given_proof: 0, + verify_vote_poll_vote_state_proof: 0, + verify_contests_proof: 0, + verify_vote_polls_by_end_date_proof: 0, + verify_specialized_balance: 0, + }, + state_transition: DriveVerifyStateTransitionMethodVersions { + verify_state_transition_was_executed_with_proof: 0, + }, }, identity: DriveIdentityMethodVersions { fetch: DriveIdentityFetchMethodVersions { @@ -272,14 +357,18 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { }, attributes: DriveIdentityFetchAttributesMethodVersions { revision: 0, + nonce: 0, + identity_contract_nonce: 0, balance: 0, balance_include_debt: 0, negative_balance: 0, }, partial_identity: DriveIdentityFetchPartialIdentityMethodVersions { + fetch_identity_revision_with_keys: 0, fetch_identity_balance_with_keys: 0, fetch_identity_balance_with_keys_and_revision: 0, fetch_identity_with_balance: 0, + fetch_identity_keys: 0, }, full_identity: DriveIdentityFetchFullIdentityMethodVersions { fetch_full_identity: Some(0), @@ -289,6 +378,9 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { prove: DriveIdentityProveMethodVersions { full_identity: 0, full_identities: 0, + identity_nonce: 0, + identity_contract_nonce: 0, + identities_contract_keys: 0, prove_full_identities_by_unique_public_key_hashes: 0, prove_full_identity_by_unique_public_key_hash: 0, prove_identity_id_by_unique_public_key_hash: 0, @@ -300,6 +392,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { fetch_all_identity_keys: 0, fetch_identities_all_keys: 0, fetch_identity_keys: 0, + fetch_identities_contract_keys: 0, }, prove: DriveIdentityKeysProveMethodVersions { prove_identities_all_keys: 0, @@ -326,6 +419,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { }, update: DriveIdentityUpdateMethodVersions { update_identity_revision: 0, + merge_identity_nonce: 0, update_identity_negative_credit_operation: 0, initialize_identity_revision: 0, disable_identity_keys: 0, @@ -339,18 +433,22 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { add_to_previous_balance: 0, apply_balance_change_from_fee_to_identity: 0, remove_from_identity_balance: 0, + refresh_identity_key_reference_operations: 0, }, insert: DriveIdentityInsertMethodVersions { add_new_identity: 0, }, contract_info: DriveIdentityContractInfoMethodVersions { add_potential_contract_info_for_contract_bounded_key: 0, + refresh_potential_contract_info_key_references: 0, + merge_identity_contract_nonce: 0, }, cost_estimation: DriveIdentityCostEstimationMethodVersions { for_authentication_keys_security_level_in_key_reference_tree: 0, for_balances: 0, for_contract_info: 0, for_contract_info_group: 0, + for_contract_info_group_keys: 0, for_contract_info_group_key_purpose: 0, for_keys_for_identity_id: 0, for_negative_credit: 0, @@ -358,14 +456,24 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { for_root_key_reference_tree: 0, for_update_revision: 0, }, + withdrawals: DriveIdentityWithdrawalMethodVersions { + document: DriveIdentityWithdrawalDocumentMethodVersions { + fetch_oldest_withdrawal_documents_by_status: 0, + find_up_to_100_withdrawal_documents_by_status_and_transaction_indices: 0, + }, + transaction: DriveIdentityWithdrawalTransactionMethodVersions { + index: DriveIdentityWithdrawalTransactionIndexMethodVersions { + fetch_next_withdrawal_transaction_index: 0, + add_update_next_withdrawal_transaction_index_operation: 0, + }, + queue: DriveIdentityWithdrawalTransactionQueueMethodVersions { + add_enqueue_untied_withdrawal_transaction_operations: 0, + dequeue_untied_withdrawal_transactions: 0, + }, + }, + }, }, platform_system: DrivePlatformSystemMethodVersions { - protocol_version: DriveSystemProtocolVersionMethodVersions { - fetch_current_protocol_version: 0, - set_current_protocol_version_operations: 0, - fetch_next_protocol_version: 0, - set_next_protocol_version_operations: 0, - }, estimation_costs: DriveSystemEstimationCostsMethodVersions { for_total_system_credits_update: 0, }, @@ -390,6 +498,41 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { finalization_tasks: 0, }, }, + convert_to_high_level_operations: + DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions { + data_contract_create_transition: 0, + data_contract_update_transition: 0, + document_create_transition: 0, + document_delete_transition: 0, + document_purchase_transition: 0, + document_replace_transition: 0, + document_transfer_transition: 0, + document_update_price_transition: 0, + documents_batch_transition: 0, + identity_create_transition: 0, + identity_credit_transfer_transition: 0, + identity_credit_withdrawal_transition: 0, + identity_top_up_transition: 0, + identity_update_transition: 0, + masternode_vote_transition: 0, + bump_identity_data_contract_nonce: 0, + bump_identity_nonce: 0, + partially_use_asset_lock: 0, + }, + }, + platform_state: DrivePlatformStateMethodVersions { + fetch_platform_state_bytes: 0, + store_platform_state_bytes: 0, + }, + fetch: DriveFetchMethodVersions { fetch_elements: 0 }, + prefunded_specialized_balances: DrivePrefundedSpecializedMethodVersions { + fetch_single: 0, + prove_single: 0, + add_prefunded_specialized_balance: 0, + add_prefunded_specialized_balance_operations: 0, + deduct_from_prefunded_specialized_balance: 0, + deduct_from_prefunded_specialized_balance_operations: 0, + estimated_cost_for_prefunded_specialized_balance_update: 0, }, }, grove_methods: DriveGroveMethodVersions { @@ -405,11 +548,13 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { grove_get_raw_value_u64_from_encoded_var_vec: 0, grove_get: 0, grove_get_path_query_serialized_results: 0, + grove_get_path_query_serialized_or_sum_results: 0, grove_get_path_query: 0, grove_get_path_query_with_optional: 0, grove_get_raw_path_query_with_optional: 0, grove_get_raw_path_query: 0, grove_get_proved_path_query: 0, + grove_get_proved_path_query_with_conditional: 0, grove_get_sum_tree_total_value: 0, grove_has_raw: 0, }, @@ -420,6 +565,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { batch_insert: 0, batch_insert_if_not_exists: 0, batch_insert_if_changed_value: 0, + batch_replace: 0, batch_delete: 0, batch_remove_raw: 0, batch_delete_up_tree_while_empty: 0, @@ -428,21 +574,13 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { apply: DriveGroveApplyMethodVersions { grove_apply_operation: 0, grove_apply_batch: 0, - grove_apply_batch_with_add_costs: 0, grove_apply_partial_batch: 0, - grove_apply_partial_batch_with_add_costs: 0, }, costs: DriveGroveCostMethodVersions { grove_batch_operations_costs: 0, }, }, - }, - abci_structure: AbciStructureVersion { - extended_block_info: FeatureVersionBounds { - min_version: 0, - max_version: 0, - default_current_version: 0, - }, + grove_version: GROVE_V1, }, platform_architecture: PlatformArchitectureVersion { data_contract_factory_structure_version: 0, @@ -455,6 +593,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { state_transition_execution_context: 0, commit: 0, masternode: 0, + signature_verification_quorum_set: 0, }, methods: DriveAbciMethodVersions { engine: DriveAbciEngineMethodVersions { @@ -464,7 +603,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { finalize_block_proposal: 0, }, initialization: DriveAbciInitializationMethodVersions { - initial_core_height: 0, + initial_core_height_and_time: 0, create_genesis_state: 0, }, core_based_updates: DriveAbciCoreBasedUpdatesMethodVersions { @@ -475,12 +614,11 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { get_voter_identity_key: 0, get_operator_identity_keys: 0, get_owner_identity_key: 0, - get_voter_identifier: 0, - get_operator_identifier: 0, + get_voter_identifier_from_masternode_list_item: 0, + get_operator_identifier_from_masternode_list_item: 0, create_operator_identity: 0, create_owner_identity: 0, create_voter_identity: 0, - hash_protxhash_with_key_data: 0, disable_identity_keys: 0, update_masternode_identities: 0, update_operator_identity: 0, @@ -490,13 +628,23 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { }, protocol_upgrade: DriveAbciProtocolUpgradeMethodVersions { check_for_desired_protocol_upgrade: 0, + upgrade_protocol_version_on_epoch_change: 0, + protocol_version_upgrade_percentage_needed: 75, }, block_fee_processing: DriveAbciBlockFeeProcessingMethodVersions { add_process_epoch_change_operations: 0, process_block_fees: 0, }, - core_subsidy: DriveAbciCoreSubsidyMethodVersions { - epoch_core_reward_credits_for_distribution: 0, + core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants { + choose_quorum: 0, + verify_chain_lock: 0, + verify_chain_lock_locally: 0, + verify_chain_lock_through_core: 0, + make_sure_core_is_synced_to_chain_lock: 0, + recent_block_count_amount: 2, + }, + core_instant_send_lock: DriveAbciCoreInstantSendLockMethodVersions { + verify_recent_signature_locally: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, @@ -508,21 +656,31 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { find_oldest_epoch_needing_payment: 0, fetch_reward_shares_list_for_masternode: 0, }, - identity_credit_withdrawal: DriveAbciIdentityCreditWithdrawalMethodVersions { - build_withdrawal_transactions_from_documents: 0, - fetch_and_prepare_unsigned_withdrawal_transactions: 0, + withdrawals: DriveAbciIdentityCreditWithdrawalMethodVersions { + build_untied_withdrawal_transactions_from_documents: 0, + dequeue_and_build_unsigned_withdrawal_transactions: 0, fetch_transactions_block_inclusion_status: 0, pool_withdrawals_into_transactions_queue: 0, - update_broadcasted_withdrawal_transaction_statuses: 0, + update_broadcasted_withdrawal_statuses: 0, + append_signatures_and_broadcast_withdrawal_transactions: 0, + }, + voting: DriveAbciVotingMethodVersions { + keep_record_of_finished_contested_resource_vote_poll: 0, + clean_up_after_vote_poll_end: 0, + clean_up_after_contested_resources_vote_poll_end: 0, + check_for_ended_vote_polls: 0, + tally_votes_for_contested_document_resource_vote_poll: 0, + award_document_to_winner: 0, + delay_vote_poll: 0, + run_dao_platform_events: 0, + remove_votes_for_removed_masternodes: 0, }, state_transition_processing: DriveAbciStateTransitionProcessingMethodVersions { execute_event: 0, process_raw_state_transitions: 0, + decode_raw_state_transitions: 0, validate_fees_of_event: 0, }, - withdrawals: DriveAbciWithdrawalsMethodVersions { - check_withdrawals: 0, - }, epoch: DriveAbciEpochMethodVersions { gather_epoch_info: 0, get_genesis_time: 0, @@ -531,72 +689,112 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { clear_drive_block_cache: 0, }, block_end: DriveAbciBlockEndMethodVersions { - store_ephemeral_state: 0, update_state_cache: 0, update_drive_cache: 0, validator_set_update: 0, }, + platform_state_storage: DriveAbciPlatformStateStorageMethodVersions { + fetch_platform_state: 0, + store_platform_state: 0, + }, }, validation_and_processing: DriveAbciValidationVersions { state_transitions: DriveAbciStateTransitionValidationVersions { common_validation_methods: DriveAbciStateTransitionCommonValidationVersions { asset_locks: DriveAbciAssetLockValidationVersions { fetch_asset_lock_transaction_output_sync: 0, + verify_asset_lock_is_not_spent_and_has_enough_balance: 0, }, validate_identity_public_key_contract_bounds: 0, validate_identity_public_key_ids_dont_exist_in_state: 0, validate_identity_public_key_ids_exist_in_state: 0, validate_state_transition_identity_signed: 0, validate_unique_identity_public_key_hashes_in_state: 0, + validate_master_key_uniqueness: 0, + validate_simple_pre_check_balance: 0, }, + max_asset_lock_usage_attempts: 16, identity_create_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: Some(0), identity_signatures: Some(0), + advanced_minimum_balance_pre_check: None, + nonce: None, state: 0, transform_into_action: 0, }, identity_update_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: Some(0), identity_signatures: Some(0), + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, identity_top_up_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, - identity_signatures: Some(0), + basic_structure: Some(0), + advanced_structure: None, + identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: None, state: 0, transform_into_action: 0, }, identity_credit_withdrawal_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), state: 0, transform_into_action: 0, }, identity_credit_transfer_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), state: 0, transform_into_action: 0, }, + masternode_vote_state_transition: DriveAbciStateTransitionValidationVersion { + basic_structure: None, + advanced_structure: Some(0), + identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), + state: 0, + transform_into_action: 0, + }, contract_create_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, contract_update_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: None, + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, documents_batch_state_transition: DriveAbciDocumentsStateTransitionValidationVersions { - structure: 0, + balance_pre_check: 0, + basic_structure: 0, + advanced_structure: 0, state: 0, + revision: 0, transform_into_action: 0, data_triggers: DriveAbciValidationDataTriggerAndBindingVersions { bindings: 0, @@ -613,16 +811,33 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { document_create_transition_structure_validation: 0, document_delete_transition_structure_validation: 0, document_replace_transition_structure_validation: 0, + document_transfer_transition_structure_validation: 0, + document_purchase_transition_structure_validation: 0, + document_update_price_transition_structure_validation: 0, document_create_transition_state_validation: 0, document_delete_transition_state_validation: 0, document_replace_transition_state_validation: 0, + document_transfer_transition_state_validation: 0, + document_purchase_transition_state_validation: 0, + document_update_price_transition_state_validation: 0, }, }, process_state_transition: 0, + state_transition_to_execution_event_for_check_tx: 0, + penalties: PenaltyAmounts { + identity_id_not_correct: 50000000, + unique_key_already_present: 10000000, + validation_of_added_keys_structure_failure: 10000000, + validation_of_added_keys_proof_of_possession_failure: 50000000, + }, + event_constants: DriveAbciValidationConstants { + maximum_vote_polls_to_process: 2, + maximum_contenders_to_consider: 100, + }, }, query: DriveAbciQueryVersions { + max_returned_elements: 100, response_metadata: 0, - base_query_structure: 0, proofs_query: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -633,18 +848,30 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + prefunded_specialized_balances: DriveAbciQueryPrefundedSpecializedBalancesVersions { + balance: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, identity_based_queries: DriveAbciQueryIdentityVersions { identity: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - identities: FeatureVersionBounds { + keys: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - keys: FeatureVersionBounds { + identity_nonce: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + identity_contract_nonce: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, @@ -664,7 +891,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, - identities_by_public_key_hashes: FeatureVersionBounds { + identities_contract_keys: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, @@ -687,6 +914,33 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { default_current_version: 0, }, }, + voting_based_queries: DriveAbciQueryVotingVersions { + vote_polls_by_end_date_query: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_vote_state: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_voters_for_identity: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_identity_vote_status: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resources: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, system: DriveAbciQuerySystemVersions { version_upgrade_state: FeatureVersionBounds { min_version: 0, @@ -703,6 +957,16 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + path_elements: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + total_credits_in_platform: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, }, }, }, @@ -711,11 +975,11 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { signature_verify: 0, }, validation: DPPValidationVersions { - validate_time_in_block_time_window: 0, json_schema_validator: JsonSchemaValidatorVersions { new: 0, validate: 0, compile: 0, + compile_and_validate: 0, }, data_contract: DataContractValidationVersions { validate: 0, @@ -725,6 +989,15 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { validate_not_defined_properties: 0, validate_property_definition: 0, }, + document_type: DocumentTypeValidationVersions { + validate_update: 0, + contested_index_limit: 1, + unique_index_limit: 10, + }, + voting: VotingValidationVersions { + allow_other_contenders_time_ms: 604_800_000, // 1 week in ms + votes_allowed_per_masternode: 5, + }, }, state_transition_serialization_versions: StateTransitionSerializationVersions { identity_public_key_in_creation: FeatureVersionBounds { @@ -757,6 +1030,11 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + masternode_vote_state_transition: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, contract_create_state_transition: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -798,9 +1076,32 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { default_current_version: 0, }, }, + document_transfer_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + document_update_price_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + document_purchase_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, }, state_transition_conversion_versions: StateTransitionConversionVersions { identity_to_identity_create_transition: 0, + identity_to_identity_top_up_transition: 0, + identity_to_identity_withdrawal_transition: 0, identity_to_identity_create_transition_with_signer: 0, }, state_transition_method_versions: StateTransitionMethodVersions { @@ -823,13 +1124,19 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { }, }, identities: IdentityTransitionVersions { + max_public_keys_in_creation: 6, asset_locks: IdentityTransitionAssetLockVersions { + required_asset_lock_duff_balance_for_processing_start_for_identity_create: + 200000, + required_asset_lock_duff_balance_for_processing_start_for_identity_top_up: + 50000, validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, }, }, contract_versions: ContractVersions { + max_serialized_size: 65000, contract_serialization_version: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -840,6 +1147,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { config: 0, methods: DataContractMethodVersions { validate_document: 0, + validate_update: 0, schema: 0, }, document_type_versions: DocumentTypeVersions { @@ -855,20 +1163,22 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { enrich_with_base_schema: 0, find_identifier_and_binary_paths: 0, validate_max_depth: 0, + max_depth: 256, recursive_schema_validator_versions: RecursiveSchemaValidatorVersions { traversal_validator: 0, - byte_array_has_no_items_as_parent_validator: 0, - pattern_is_valid_regex_validator: 0, }, validate_schema_compatibility: 0, }, methods: DocumentTypeMethodVersions { create_document_from_data: 0, create_document_with_prevalidated_properties: 0, + prefunded_voting_balance_for_document: 0, + contested_vote_poll_for_document: 0, estimated_size: 0, index_for_types: 0, max_size: 0, serialize_value_for_key: 0, + deserialize_value_for_key: 0, }, }, }, @@ -891,6 +1201,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { default_current_version: 0, }, document_method_versions: DocumentMethodVersions { + is_equal_ignoring_timestamps: 0, hash: 0, get_raw_for_contract: 0, get_raw_for_document_type: 0, @@ -904,5 +1215,31 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { random_public_and_private_key_data: 0, }, }, + voting_versions: VotingVersions { + default_vote_poll_time_duration_ms: 1_209_600_000, //2 weeks + contested_document_vote_poll_stored_info_version: 0, + }, + asset_lock_versions: AssetLockVersions { + reduced_asset_lock_value: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + methods: DPPMethodVersions { epoch_core_reward_credits_for_distribution: 0 }, + }, + system_data_contracts: SystemDataContractVersions { + withdrawals: 1, + dpns: 1, + dashpay: 1, + masternode_reward_shares: 1, + feature_flags: 1, + }, + fee_version: FEE_VERSION1, + system_limits: SystemLimits { + estimated_contract_max_serialized_size: 16384, + max_field_value_size: 5000, + max_state_transition_size: 20000, + max_transitions_in_documents_batch: 1, }, }; diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index 846fbf9b013..19209abad66 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -1,30 +1,37 @@ +use crate::version::contracts::SystemDataContractVersions; use crate::version::dpp_versions::{ - ContractVersions, CostVersions, DPPValidationVersions, DPPVersion, DataContractMethodVersions, - DataContractValidationVersions, DocumentFeatureVersionBounds, DocumentMethodVersions, - DocumentTransitionVersions, DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, - DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeVersions, DocumentVersions, - DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, + AssetLockVersions, ContractVersions, CostVersions, DPPMethodVersions, DPPValidationVersions, + DPPVersion, DataContractMethodVersions, DataContractValidationVersions, + DocumentFeatureVersionBounds, DocumentMethodVersions, DocumentTransitionVersions, + DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, + DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, + DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, + VotingValidationVersions, VotingVersions, }; use crate::version::drive_abci_versions::{ DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreSubsidyMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersionsAndConstants, + DriveAbciCoreInstantSendLockMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, - DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, - DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, + DriveAbciPlatformStateStorageMethodVersions, DriveAbciProtocolUpgradeMethodVersions, + DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, + DriveAbciQueryPrefundedSpecializedBalancesVersions, DriveAbciQuerySystemVersions, + DriveAbciQueryVersions, DriveAbciQueryVotingVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, - DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, - DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, + DriveAbciValidationConstants, DriveAbciValidationDataTriggerAndBindingVersions, + DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, + DriveAbciVotingMethodVersions, PenaltyAmounts, }; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, @@ -34,43 +41,51 @@ use crate::version::drive_versions::{ DriveCreditPoolEpochsMethodVersions, DriveCreditPoolMethodVersions, DriveCreditPoolPendingEpochRefundsMethodVersions, DriveCreditPoolStorageFeeDistributionPoolMethodVersions, - DriveDataContractOperationMethodVersions, DriveDocumentDeleteMethodVersions, - DriveDocumentEstimationCostsMethodVersions, DriveDocumentIndexUniquenessMethodVersions, + DriveCreditPoolUnpaidEpochMethodVersions, DriveDataContractOperationMethodVersions, + DriveDocumentDeleteMethodVersions, DriveDocumentEstimationCostsMethodVersions, + DriveDocumentIndexUniquenessMethodVersions, DriveDocumentInsertContestedMethodVersions, DriveDocumentInsertMethodVersions, DriveDocumentMethodVersions, DriveDocumentQueryMethodVersions, DriveDocumentUpdateMethodVersions, - DriveEstimatedCostsMethodVersions, DriveFeesMethodVersions, DriveGroveApplyMethodVersions, - DriveGroveBasicMethodVersions, DriveGroveBatchMethodVersions, DriveGroveCostMethodVersions, - DriveGroveMethodVersions, DriveIdentityContractInfoMethodVersions, - DriveIdentityCostEstimationMethodVersions, DriveIdentityFetchAttributesMethodVersions, - DriveIdentityFetchFullIdentityMethodVersions, DriveIdentityFetchMethodVersions, - DriveIdentityFetchPartialIdentityMethodVersions, + DriveEstimatedCostsMethodVersions, DriveFeesMethodVersions, DriveFetchMethodVersions, + DriveGroveApplyMethodVersions, DriveGroveBasicMethodVersions, DriveGroveBatchMethodVersions, + DriveGroveCostMethodVersions, DriveGroveMethodVersions, + DriveIdentityContractInfoMethodVersions, DriveIdentityCostEstimationMethodVersions, + DriveIdentityFetchAttributesMethodVersions, DriveIdentityFetchFullIdentityMethodVersions, + DriveIdentityFetchMethodVersions, DriveIdentityFetchPartialIdentityMethodVersions, DriveIdentityFetchPublicKeyHashesMethodVersions, DriveIdentityInsertMethodVersions, DriveIdentityKeyHashesToIdentityInsertMethodVersions, DriveIdentityKeysFetchMethodVersions, DriveIdentityKeysInsertMethodVersions, DriveIdentityKeysMethodVersions, DriveIdentityKeysProveMethodVersions, DriveIdentityMethodVersions, DriveIdentityProveMethodVersions, DriveIdentityUpdateMethodVersions, - DriveInitializationMethodVersions, DriveMethodVersions, DriveOperationsMethodVersion, - DrivePlatformSystemMethodVersions, DriveProtocolUpgradeVersions, DriveProveMethodVersions, + DriveIdentityWithdrawalDocumentMethodVersions, DriveIdentityWithdrawalMethodVersions, + DriveIdentityWithdrawalTransactionIndexMethodVersions, + DriveIdentityWithdrawalTransactionMethodVersions, + DriveIdentityWithdrawalTransactionQueueMethodVersions, DriveInitializationMethodVersions, + DriveMethodVersions, DriveOperationsMethodVersion, DrivePlatformStateMethodVersions, + DrivePlatformSystemMethodVersions, DrivePrefundedSpecializedMethodVersions, + DriveProtocolUpgradeVersions, DriveProveMethodVersions, + DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions, DriveStateTransitionMethodVersions, DriveStateTransitionOperationMethodVersions, DriveStructureVersion, DriveSystemEstimationCostsMethodVersions, - DriveSystemProtocolVersionMethodVersions, DriveVerifyContractMethodVersions, - DriveVerifyDocumentMethodVersions, DriveVerifyIdentityMethodVersions, - DriveVerifyMethodVersions, DriveVerifySingleDocumentMethodVersions, - DriveVerifySystemMethodVersions, DriveVersion, + DriveVerifyContractMethodVersions, DriveVerifyDocumentMethodVersions, + DriveVerifyIdentityMethodVersions, DriveVerifyMethodVersions, + DriveVerifySingleDocumentMethodVersions, DriveVerifyStateTransitionMethodVersions, + DriveVerifySystemMethodVersions, DriveVerifyVoteMethodVersions, DriveVersion, + DriveVoteCleanupMethodVersions, DriveVoteContestedResourceInsertMethodVersions, + DriveVoteFetchMethodVersions, DriveVoteInsertMethodVersions, DriveVoteMethodVersions, + DriveVoteSetupMethodVersions, DriveVoteStorageFormMethodVersions, }; -use crate::version::mocks::TEST_BYTES; +use crate::version::fee::v1::FEE_VERSION1; +use crate::version::limits::SystemLimits; +use crate::version::mocks::TEST_PROTOCOL_VERSION_SHIFT_BYTES; use crate::version::protocol_version::{FeatureVersionBounds, PlatformVersion}; -use crate::version::{AbciStructureVersion, PlatformArchitectureVersion}; +use crate::version::PlatformArchitectureVersion; +use grovedb_version::version::v1::GROVE_V1; -pub const TEST_PROTOCOL_VERSION_3: u32 = (1 << TEST_BYTES) + 3; +pub const TEST_PROTOCOL_VERSION_3: u32 = (1 << TEST_PROTOCOL_VERSION_SHIFT_BYTES) + 3; -pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { +pub const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { protocol_version: TEST_PROTOCOL_VERSION_3, - identity: FeatureVersionBounds { - min_version: 0, - max_version: 0, - default_current_version: 0, - }, proofs: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -101,6 +116,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { credit_pools: DriveCreditPoolMethodVersions { epochs: DriveCreditPoolEpochsMethodVersions { get_epochs_infos: 0, + get_epochs_protocol_versions: 0, prove_epochs_infos: 0, get_epoch_fee_multiplier: 0, get_epoch_processing_credits_for_distribution: 0, @@ -126,10 +142,12 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { DriveCreditPoolStorageFeeDistributionPoolMethodVersions { get_storage_fees_from_distribution_pool: 0, }, + unpaid_epoch: DriveCreditPoolUnpaidEpochMethodVersions { + get_unpaid_epoch_index: 0, + }, }, protocol_upgrade: DriveProtocolUpgradeVersions { clear_version_information: 0, - change_to_new_version_and_clear_version_information: 0, fetch_versions_with_counter: 0, fetch_proved_versions_with_counter: 0, fetch_validator_version_votes: 0, @@ -137,7 +155,10 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { remove_validators_proposed_app_versions: 0, update_validator_proposed_app_version: 0, }, - prove: DriveProveMethodVersions { prove_multiple: 0 }, + prove: DriveProveMethodVersions { + prove_elements: 0, + prove_multiple_state_transition_results: 0, + }, balances: DriveBalancesMethodVersions { add_to_system_credits: 0, add_to_system_credits_operations: 0, @@ -152,6 +173,27 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { finalization_tasks: 0, }, }, + convert_to_high_level_operations: + DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions { + data_contract_create_transition: 0, + data_contract_update_transition: 0, + document_create_transition: 0, + document_delete_transition: 0, + document_purchase_transition: 0, + document_replace_transition: 0, + document_transfer_transition: 0, + document_update_price_transition: 0, + documents_batch_transition: 0, + identity_create_transition: 0, + identity_credit_transfer_transition: 0, + identity_credit_withdrawal_transition: 0, + identity_top_up_transition: 0, + identity_update_transition: 0, + masternode_vote_transition: 0, + bump_identity_data_contract_nonce: 0, + bump_identity_nonce: 0, + partially_use_asset_lock: 0, + }, }, document: DriveDocumentMethodVersions { query: DriveDocumentQueryMethodVersions { query_documents: 0 }, @@ -178,6 +220,16 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { add_indices_for_top_index_level_for_contract_operations: 0, add_reference_for_index_level_for_contract_operations: 0, }, + insert_contested: DriveDocumentInsertContestedMethodVersions { + add_contested_document: 0, + add_contested_document_for_contract: 0, + add_contested_document_for_contract_apply_and_add_to_operations: 0, + add_contested_document_for_contract_operations: 0, + add_contested_document_to_primary_storage: 0, + add_contested_indices_for_contract_operations: 0, + add_contested_reference_and_vote_subtree_to_document_operations: 0, + add_contested_vote_subtree_for_non_identities_operations: 0, + }, update: DriveDocumentUpdateMethodVersions { add_update_multiple_documents_operations: 0, update_document_for_contract: 0, @@ -189,15 +241,49 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { }, estimation_costs: DriveDocumentEstimationCostsMethodVersions { add_estimation_costs_for_add_document_to_primary_storage: 0, + add_estimation_costs_for_add_contested_document_to_primary_storage: 0, stateless_delete_of_non_tree_for_costs: 0, }, index_uniqueness: DriveDocumentIndexUniquenessMethodVersions { validate_document_uniqueness: 0, validate_document_create_transition_action_uniqueness: 0, validate_document_replace_transition_action_uniqueness: 0, + validate_document_transfer_transition_action_uniqueness: 0, + validate_document_purchase_transition_action_uniqueness: 0, + validate_document_update_price_transition_action_uniqueness: 0, validate_uniqueness_of_data: 0, }, }, + vote: DriveVoteMethodVersions { + insert: DriveVoteInsertMethodVersions { + register_identity_vote: 0, + }, + contested_resource_insert: DriveVoteContestedResourceInsertMethodVersions { + register_contested_resource_identity_vote: 0, + insert_stored_info_for_contested_resource_vote_poll: 0, + register_identity_vote: 0, + add_vote_poll_end_date_query_operations: 0, + }, + cleanup: DriveVoteCleanupMethodVersions { + remove_specific_vote_references_given_by_identity: 0, + remove_specific_votes_given_by_identity: 0, + remove_contested_resource_vote_poll_end_date_query_operations: 0, + remove_contested_resource_vote_poll_votes_operations: 0, + remove_contested_resource_vote_poll_documents_operations: 0, + remove_contested_resource_vote_poll_contenders_operations: 0, + }, + setup: DriveVoteSetupMethodVersions { + add_initial_vote_tree_main_structure_operations: 0, + }, + storage_form: DriveVoteStorageFormMethodVersions { + resolve_with_contract: 0, + }, + fetch: DriveVoteFetchMethodVersions { + fetch_identities_voting_for_contenders: 0, + fetch_contested_document_vote_poll_stored_info: 0, + fetch_identity_contested_resource_vote: 0, + }, + }, contract: DriveContractMethodVersions { prove: DriveContractProveMethodVersions { prove_contract: 0, @@ -228,11 +314,13 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { estimated_costs: DriveEstimatedCostsMethodVersions { add_estimation_costs_for_levels_up_to_contract: 0, add_estimation_costs_for_levels_up_to_contract_document_type_excluded: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded: 0, }, asset_lock: DriveAssetLockMethodVersions { add_asset_lock_outpoint: 0, add_estimation_costs_for_adding_asset_lock: 0, - has_asset_lock_outpoint: 0, + fetch_asset_lock_outpoint_info: 0, }, verify: DriveVerifyMethodVersions { contract: DriveVerifyContractMethodVersions { @@ -253,6 +341,9 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { verify_identity_id_by_public_key_hash: 0, verify_identity_ids_by_public_key_hashes: 0, verify_identity_keys_by_identity_id: 0, + verify_identity_nonce: 0, + verify_identity_contract_nonce: 0, + verify_identities_contract_keys: 0, }, single_document: DriveVerifySingleDocumentMethodVersions { verify_proof: 0, @@ -260,9 +351,24 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { }, system: DriveVerifySystemMethodVersions { verify_epoch_infos: 0, + verify_elements: 0, + verify_total_credits_in_system: 0, verify_upgrade_state: 0, verify_upgrade_vote_status: 0, }, + voting: DriveVerifyVoteMethodVersions { + verify_masternode_vote: 0, + verify_start_at_contender_in_proof: 0, + verify_vote_poll_votes_proof: 0, + verify_identity_votes_given_proof: 0, + verify_vote_poll_vote_state_proof: 0, + verify_contests_proof: 0, + verify_vote_polls_by_end_date_proof: 0, + verify_specialized_balance: 0, + }, + state_transition: DriveVerifyStateTransitionMethodVersions { + verify_state_transition_was_executed_with_proof: 0, + }, }, identity: DriveIdentityMethodVersions { fetch: DriveIdentityFetchMethodVersions { @@ -280,14 +386,18 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { }, attributes: DriveIdentityFetchAttributesMethodVersions { revision: 0, + nonce: 0, + identity_contract_nonce: 0, balance: 0, balance_include_debt: 0, negative_balance: 0, }, partial_identity: DriveIdentityFetchPartialIdentityMethodVersions { + fetch_identity_revision_with_keys: 0, fetch_identity_balance_with_keys: 0, fetch_identity_balance_with_keys_and_revision: 0, fetch_identity_with_balance: 0, + fetch_identity_keys: 0, }, full_identity: DriveIdentityFetchFullIdentityMethodVersions { fetch_full_identity: Some(0), @@ -297,6 +407,9 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { prove: DriveIdentityProveMethodVersions { full_identity: 0, full_identities: 0, + identity_nonce: 0, + identity_contract_nonce: 0, + identities_contract_keys: 0, prove_full_identities_by_unique_public_key_hashes: 0, prove_full_identity_by_unique_public_key_hash: 0, prove_identity_id_by_unique_public_key_hash: 0, @@ -308,6 +421,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { fetch_all_identity_keys: 0, fetch_identities_all_keys: 0, fetch_identity_keys: 0, + fetch_identities_contract_keys: 0, }, prove: DriveIdentityKeysProveMethodVersions { prove_identities_all_keys: 0, @@ -334,6 +448,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { }, update: DriveIdentityUpdateMethodVersions { update_identity_revision: 0, + merge_identity_nonce: 0, update_identity_negative_credit_operation: 0, initialize_identity_revision: 0, disable_identity_keys: 0, @@ -347,18 +462,22 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { add_to_previous_balance: 0, apply_balance_change_from_fee_to_identity: 0, remove_from_identity_balance: 0, + refresh_identity_key_reference_operations: 0, }, insert: DriveIdentityInsertMethodVersions { add_new_identity: 0, }, contract_info: DriveIdentityContractInfoMethodVersions { add_potential_contract_info_for_contract_bounded_key: 0, + refresh_potential_contract_info_key_references: 0, + merge_identity_contract_nonce: 0, }, cost_estimation: DriveIdentityCostEstimationMethodVersions { for_authentication_keys_security_level_in_key_reference_tree: 0, for_balances: 0, for_contract_info: 0, for_contract_info_group: 0, + for_contract_info_group_keys: 0, for_contract_info_group_key_purpose: 0, for_keys_for_identity_id: 0, for_negative_credit: 0, @@ -366,14 +485,24 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { for_root_key_reference_tree: 0, for_update_revision: 0, }, + withdrawals: DriveIdentityWithdrawalMethodVersions { + document: DriveIdentityWithdrawalDocumentMethodVersions { + fetch_oldest_withdrawal_documents_by_status: 0, + find_up_to_100_withdrawal_documents_by_status_and_transaction_indices: 0, + }, + transaction: DriveIdentityWithdrawalTransactionMethodVersions { + index: DriveIdentityWithdrawalTransactionIndexMethodVersions { + fetch_next_withdrawal_transaction_index: 0, + add_update_next_withdrawal_transaction_index_operation: 0, + }, + queue: DriveIdentityWithdrawalTransactionQueueMethodVersions { + add_enqueue_untied_withdrawal_transaction_operations: 0, + dequeue_untied_withdrawal_transactions: 0, + }, + }, + }, }, platform_system: DrivePlatformSystemMethodVersions { - protocol_version: DriveSystemProtocolVersionMethodVersions { - fetch_current_protocol_version: 0, - set_current_protocol_version_operations: 0, - fetch_next_protocol_version: 0, - set_next_protocol_version_operations: 0, - }, estimation_costs: DriveSystemEstimationCostsMethodVersions { for_total_system_credits_update: 0, }, @@ -391,6 +520,20 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { convert_drive_operations_to_grove_operations: 0, apply_drive_operations: 0, }, + platform_state: DrivePlatformStateMethodVersions { + fetch_platform_state_bytes: 0, + store_platform_state_bytes: 0, + }, + fetch: DriveFetchMethodVersions { fetch_elements: 0 }, + prefunded_specialized_balances: DrivePrefundedSpecializedMethodVersions { + fetch_single: 0, + prove_single: 0, + add_prefunded_specialized_balance: 0, + add_prefunded_specialized_balance_operations: 0, + deduct_from_prefunded_specialized_balance: 0, + deduct_from_prefunded_specialized_balance_operations: 0, + estimated_cost_for_prefunded_specialized_balance_update: 0, + }, }, grove_methods: DriveGroveMethodVersions { basic: DriveGroveBasicMethodVersions { @@ -405,11 +548,13 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { grove_get_raw_value_u64_from_encoded_var_vec: 0, grove_get: 0, grove_get_path_query_serialized_results: 0, + grove_get_path_query_serialized_or_sum_results: 0, grove_get_path_query: 0, grove_get_path_query_with_optional: 0, grove_get_raw_path_query_with_optional: 0, grove_get_raw_path_query: 0, grove_get_proved_path_query: 0, + grove_get_proved_path_query_with_conditional: 0, grove_get_sum_tree_total_value: 0, grove_has_raw: 0, }, @@ -420,6 +565,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { batch_insert: 0, batch_insert_if_not_exists: 0, batch_insert_if_changed_value: 0, + batch_replace: 0, batch_delete: 0, batch_remove_raw: 0, batch_delete_up_tree_while_empty: 0, @@ -428,21 +574,13 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { apply: DriveGroveApplyMethodVersions { grove_apply_operation: 0, grove_apply_batch: 0, - grove_apply_batch_with_add_costs: 0, grove_apply_partial_batch: 0, - grove_apply_partial_batch_with_add_costs: 0, }, costs: DriveGroveCostMethodVersions { grove_batch_operations_costs: 0, }, }, - }, - abci_structure: AbciStructureVersion { - extended_block_info: FeatureVersionBounds { - min_version: 0, - max_version: 0, - default_current_version: 0, - }, + grove_version: GROVE_V1, }, platform_architecture: PlatformArchitectureVersion { data_contract_factory_structure_version: 0, @@ -455,6 +593,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { state_transition_execution_context: 0, commit: 0, masternode: 0, + signature_verification_quorum_set: 0, }, methods: DriveAbciMethodVersions { engine: DriveAbciEngineMethodVersions { @@ -464,7 +603,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { finalize_block_proposal: 0, }, initialization: DriveAbciInitializationMethodVersions { - initial_core_height: 0, + initial_core_height_and_time: 0, create_genesis_state: 0, }, core_based_updates: DriveAbciCoreBasedUpdatesMethodVersions { @@ -475,12 +614,11 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { get_voter_identity_key: 0, get_operator_identity_keys: 0, get_owner_identity_key: 0, - get_voter_identifier: 0, - get_operator_identifier: 0, + get_voter_identifier_from_masternode_list_item: 0, + get_operator_identifier_from_masternode_list_item: 0, create_operator_identity: 0, create_owner_identity: 0, create_voter_identity: 0, - hash_protxhash_with_key_data: 0, disable_identity_keys: 0, update_masternode_identities: 0, update_operator_identity: 0, @@ -490,13 +628,23 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { }, protocol_upgrade: DriveAbciProtocolUpgradeMethodVersions { check_for_desired_protocol_upgrade: 0, + upgrade_protocol_version_on_epoch_change: 0, + protocol_version_upgrade_percentage_needed: 75, }, block_fee_processing: DriveAbciBlockFeeProcessingMethodVersions { add_process_epoch_change_operations: 0, process_block_fees: 0, }, - core_subsidy: DriveAbciCoreSubsidyMethodVersions { - epoch_core_reward_credits_for_distribution: 0, + core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants { + choose_quorum: 0, + verify_chain_lock: 0, + verify_chain_lock_locally: 0, + verify_chain_lock_through_core: 0, + make_sure_core_is_synced_to_chain_lock: 0, + recent_block_count_amount: 2, + }, + core_instant_send_lock: DriveAbciCoreInstantSendLockMethodVersions { + verify_recent_signature_locally: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, @@ -508,21 +656,31 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { find_oldest_epoch_needing_payment: 0, fetch_reward_shares_list_for_masternode: 0, }, - identity_credit_withdrawal: DriveAbciIdentityCreditWithdrawalMethodVersions { - build_withdrawal_transactions_from_documents: 0, - fetch_and_prepare_unsigned_withdrawal_transactions: 0, + withdrawals: DriveAbciIdentityCreditWithdrawalMethodVersions { + build_untied_withdrawal_transactions_from_documents: 0, + dequeue_and_build_unsigned_withdrawal_transactions: 0, fetch_transactions_block_inclusion_status: 0, pool_withdrawals_into_transactions_queue: 0, - update_broadcasted_withdrawal_transaction_statuses: 0, + update_broadcasted_withdrawal_statuses: 0, + append_signatures_and_broadcast_withdrawal_transactions: 0, + }, + voting: DriveAbciVotingMethodVersions { + keep_record_of_finished_contested_resource_vote_poll: 0, + clean_up_after_vote_poll_end: 0, + clean_up_after_contested_resources_vote_poll_end: 0, + check_for_ended_vote_polls: 0, + tally_votes_for_contested_document_resource_vote_poll: 0, + award_document_to_winner: 0, + delay_vote_poll: 0, + run_dao_platform_events: 0, + remove_votes_for_removed_masternodes: 0, }, state_transition_processing: DriveAbciStateTransitionProcessingMethodVersions { execute_event: 0, process_raw_state_transitions: 0, + decode_raw_state_transitions: 0, validate_fees_of_event: 0, }, - withdrawals: DriveAbciWithdrawalsMethodVersions { - check_withdrawals: 0, - }, epoch: DriveAbciEpochMethodVersions { gather_epoch_info: 0, get_genesis_time: 0, @@ -531,72 +689,112 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { clear_drive_block_cache: 0, }, block_end: DriveAbciBlockEndMethodVersions { - store_ephemeral_state: 0, update_state_cache: 0, update_drive_cache: 0, validator_set_update: 0, }, + platform_state_storage: DriveAbciPlatformStateStorageMethodVersions { + fetch_platform_state: 0, + store_platform_state: 0, + }, }, validation_and_processing: DriveAbciValidationVersions { state_transitions: DriveAbciStateTransitionValidationVersions { common_validation_methods: DriveAbciStateTransitionCommonValidationVersions { asset_locks: DriveAbciAssetLockValidationVersions { fetch_asset_lock_transaction_output_sync: 0, + verify_asset_lock_is_not_spent_and_has_enough_balance: 0, }, validate_identity_public_key_contract_bounds: 0, validate_identity_public_key_ids_dont_exist_in_state: 0, validate_identity_public_key_ids_exist_in_state: 0, validate_state_transition_identity_signed: 0, validate_unique_identity_public_key_hashes_in_state: 0, + validate_master_key_uniqueness: 0, + validate_simple_pre_check_balance: 0, }, + max_asset_lock_usage_attempts: 16, identity_create_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: Some(0), identity_signatures: Some(0), + advanced_minimum_balance_pre_check: None, + nonce: None, state: 0, transform_into_action: 0, }, identity_update_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: Some(0), identity_signatures: Some(0), + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, identity_top_up_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, - identity_signatures: Some(0), + basic_structure: Some(0), + advanced_structure: None, + identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: None, state: 0, transform_into_action: 0, }, identity_credit_withdrawal_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), state: 0, transform_into_action: 0, }, identity_credit_transfer_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), state: 0, transform_into_action: 0, }, + masternode_vote_state_transition: DriveAbciStateTransitionValidationVersion { + basic_structure: None, + advanced_structure: Some(0), + identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), + state: 0, + transform_into_action: 0, + }, contract_create_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, contract_update_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: None, + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, documents_batch_state_transition: DriveAbciDocumentsStateTransitionValidationVersions { - structure: 0, + balance_pre_check: 0, + basic_structure: 0, + advanced_structure: 0, state: 0, + revision: 0, transform_into_action: 0, data_triggers: DriveAbciValidationDataTriggerAndBindingVersions { bindings: 0, @@ -613,16 +811,33 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { document_create_transition_structure_validation: 0, document_delete_transition_structure_validation: 0, document_replace_transition_structure_validation: 0, + document_transfer_transition_structure_validation: 0, + document_purchase_transition_structure_validation: 0, + document_update_price_transition_structure_validation: 0, document_create_transition_state_validation: 0, document_delete_transition_state_validation: 0, document_replace_transition_state_validation: 0, + document_transfer_transition_state_validation: 0, + document_purchase_transition_state_validation: 0, + document_update_price_transition_state_validation: 0, }, }, process_state_transition: 0, + state_transition_to_execution_event_for_check_tx: 0, + penalties: PenaltyAmounts { + identity_id_not_correct: 50000000, + unique_key_already_present: 10000000, + validation_of_added_keys_structure_failure: 10000000, + validation_of_added_keys_proof_of_possession_failure: 50000000, + }, + event_constants: DriveAbciValidationConstants { + maximum_vote_polls_to_process: 2, + maximum_contenders_to_consider: 100, + }, }, query: DriveAbciQueryVersions { + max_returned_elements: 100, response_metadata: 0, - base_query_structure: 0, proofs_query: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -633,18 +848,30 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + prefunded_specialized_balances: DriveAbciQueryPrefundedSpecializedBalancesVersions { + balance: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, identity_based_queries: DriveAbciQueryIdentityVersions { identity: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - identities: FeatureVersionBounds { + keys: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - keys: FeatureVersionBounds { + identity_nonce: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + identity_contract_nonce: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, @@ -664,7 +891,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, - identities_by_public_key_hashes: FeatureVersionBounds { + identities_contract_keys: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, @@ -687,6 +914,33 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { default_current_version: 0, }, }, + voting_based_queries: DriveAbciQueryVotingVersions { + vote_polls_by_end_date_query: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_vote_state: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_voters_for_identity: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_identity_vote_status: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resources: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, system: DriveAbciQuerySystemVersions { version_upgrade_state: FeatureVersionBounds { min_version: 0, @@ -703,6 +957,16 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + path_elements: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + total_credits_in_platform: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, }, }, }, @@ -711,11 +975,11 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { signature_verify: 0, }, validation: DPPValidationVersions { - validate_time_in_block_time_window: 0, json_schema_validator: JsonSchemaValidatorVersions { new: 0, validate: 0, compile: 0, + compile_and_validate: 0, }, data_contract: DataContractValidationVersions { validate: 0, @@ -725,6 +989,15 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { validate_not_defined_properties: 0, validate_property_definition: 0, }, + document_type: DocumentTypeValidationVersions { + validate_update: 0, + contested_index_limit: 1, + unique_index_limit: 10, + }, + voting: VotingValidationVersions { + allow_other_contenders_time_ms: 604_800_000, // 1 week in ms + votes_allowed_per_masternode: 5, + }, }, state_transition_serialization_versions: StateTransitionSerializationVersions { identity_public_key_in_creation: FeatureVersionBounds { @@ -757,6 +1030,11 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + masternode_vote_state_transition: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, contract_create_state_transition: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -798,9 +1076,32 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { default_current_version: 0, }, }, + document_transfer_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + document_update_price_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + document_purchase_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, }, state_transition_conversion_versions: StateTransitionConversionVersions { identity_to_identity_create_transition: 0, + identity_to_identity_top_up_transition: 0, + identity_to_identity_withdrawal_transition: 0, identity_to_identity_create_transition_with_signer: 0, }, state_transition_method_versions: StateTransitionMethodVersions { @@ -823,13 +1124,19 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { }, }, identities: IdentityTransitionVersions { + max_public_keys_in_creation: 6, asset_locks: IdentityTransitionAssetLockVersions { + required_asset_lock_duff_balance_for_processing_start_for_identity_create: + 200000, + required_asset_lock_duff_balance_for_processing_start_for_identity_top_up: + 50000, validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, }, }, contract_versions: ContractVersions { + max_serialized_size: 65000, contract_serialization_version: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -840,6 +1147,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { config: 0, methods: DataContractMethodVersions { validate_document: 0, + validate_update: 0, schema: 0, }, document_type_versions: DocumentTypeVersions { @@ -855,20 +1163,22 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { enrich_with_base_schema: 0, find_identifier_and_binary_paths: 0, validate_max_depth: 0, + max_depth: 256, recursive_schema_validator_versions: RecursiveSchemaValidatorVersions { traversal_validator: 0, - byte_array_has_no_items_as_parent_validator: 0, - pattern_is_valid_regex_validator: 0, }, validate_schema_compatibility: 0, }, methods: DocumentTypeMethodVersions { create_document_from_data: 0, create_document_with_prevalidated_properties: 0, + prefunded_voting_balance_for_document: 0, + contested_vote_poll_for_document: 0, estimated_size: 0, index_for_types: 0, max_size: 0, serialize_value_for_key: 0, + deserialize_value_for_key: 0, }, }, }, @@ -891,6 +1201,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { default_current_version: 0, }, document_method_versions: DocumentMethodVersions { + is_equal_ignoring_timestamps: 0, hash: 0, get_raw_for_contract: 0, get_raw_for_document_type: 0, @@ -904,5 +1215,33 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { random_public_and_private_key_data: 0, }, }, + voting_versions: VotingVersions { + default_vote_poll_time_duration_ms: 1_209_600_000, //2 weeks + contested_document_vote_poll_stored_info_version: 0, + }, + asset_lock_versions: AssetLockVersions { + reduced_asset_lock_value: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + methods: DPPMethodVersions { + epoch_core_reward_credits_for_distribution: 0, + } + }, + system_data_contracts: SystemDataContractVersions { + withdrawals: 1, + dpns: 1, + dashpay: 1, + masternode_reward_shares: 1, + feature_flags: 1, + }, + fee_version: FEE_VERSION1, + system_limits: SystemLimits { + estimated_contract_max_serialized_size: 16384, + max_field_value_size: 5000, + max_state_transition_size: 20000, + max_transitions_in_documents_batch: 1, }, }; diff --git a/packages/rs-platform-version/src/version/mod.rs b/packages/rs-platform-version/src/version/mod.rs index 040c413e509..6422228b1d0 100644 --- a/packages/rs-platform-version/src/version/mod.rs +++ b/packages/rs-platform-version/src/version/mod.rs @@ -1,10 +1,19 @@ mod protocol_version; +use crate::version::v1::PROTOCOL_VERSION_1; pub use protocol_version::*; + +pub mod contracts; pub mod dpp_versions; pub mod drive_abci_versions; pub mod drive_versions; +pub mod fee; +mod limits; #[cfg(feature = "mock-versions")] pub mod mocks; -mod v1; +pub mod patches; +pub mod v1; + +pub type ProtocolVersion = u32; -pub const LATEST_VERSION: u32 = 1; +pub const LATEST_VERSION: ProtocolVersion = PROTOCOL_VERSION_1; +pub const INITIAL_PROTOCOL_VERSION: ProtocolVersion = 1; diff --git a/packages/rs-platform-version/src/version/patches/mod.rs b/packages/rs-platform-version/src/version/patches/mod.rs new file mode 100644 index 00000000000..ef079268ac1 --- /dev/null +++ b/packages/rs-platform-version/src/version/patches/mod.rs @@ -0,0 +1,13 @@ +use crate::version::{PlatformVersion, ProtocolVersion}; +use once_cell::sync::Lazy; +use std::collections::{BTreeMap, HashMap}; +use std::sync::RwLock; + +/// Patch function signature. It uses to dynamically modify platform version +pub type PatchFn = fn(PlatformVersion) -> PlatformVersion; + +type HeightToPatchRanges = BTreeMap; + +/// Patch function per height, per protocol version +pub static PATCHES: Lazy>> = + Lazy::new(|| RwLock::new(HashMap::new())); diff --git a/packages/rs-platform-version/src/version/protocol_version.rs b/packages/rs-platform-version/src/version/protocol_version.rs index e6577486066..dcb62784b23 100644 --- a/packages/rs-platform-version/src/version/protocol_version.rs +++ b/packages/rs-platform-version/src/version/protocol_version.rs @@ -1,36 +1,22 @@ use crate::error::PlatformVersionError; +use crate::version::contracts::SystemDataContractVersions; use crate::version::dpp_versions::DPPVersion; use crate::version::drive_abci_versions::DriveAbciVersion; use crate::version::drive_versions::DriveVersion; +use crate::version::fee::FeeVersion; #[cfg(feature = "mock-versions")] use crate::version::mocks::v2_test::TEST_PLATFORM_V2; #[cfg(feature = "mock-versions")] use crate::version::mocks::v3_test::TEST_PLATFORM_V3; #[cfg(feature = "mock-versions")] -use crate::version::mocks::TEST_BYTES; +use crate::version::mocks::TEST_PROTOCOL_VERSION_SHIFT_BYTES; use crate::version::v1::PLATFORM_V1; +#[cfg(feature = "mock-versions")] +use std::sync::OnceLock; -pub type FeatureVersion = u16; -pub type OptionalFeatureVersion = Option; //This is a feature that didn't always exist - -#[derive(Clone, Debug, Default)] -pub struct FeatureVersionBounds { - pub min_version: FeatureVersion, - pub max_version: FeatureVersion, - pub default_current_version: FeatureVersion, -} - -impl FeatureVersionBounds { - /// Will get a protocol error if the version is unknown - pub fn check_version(&self, version: FeatureVersion) -> bool { - version >= self.min_version && version <= self.max_version - } -} - -#[derive(Clone, Debug, Default)] -pub struct AbciStructureVersion { - pub extended_block_info: FeatureVersionBounds, -} +use crate::version::limits::SystemLimits; +use crate::version::ProtocolVersion; +pub use versioned_feature_core::*; #[derive(Clone, Debug, Default)] pub struct PlatformArchitectureVersion { @@ -40,31 +26,40 @@ pub struct PlatformArchitectureVersion { #[derive(Clone, Debug)] pub struct PlatformVersion { - pub protocol_version: u32, - pub identity: FeatureVersionBounds, + pub protocol_version: ProtocolVersion, pub proofs: FeatureVersionBounds, pub dpp: DPPVersion, pub drive: DriveVersion, pub drive_abci: DriveAbciVersion, - pub abci_structure: AbciStructureVersion, + pub fee_version: FeeVersion, pub platform_architecture: PlatformArchitectureVersion, + pub system_data_contracts: SystemDataContractVersions, + pub system_limits: SystemLimits, } pub const PLATFORM_VERSIONS: &[PlatformVersion] = &[PLATFORM_V1]; #[cfg(feature = "mock-versions")] -pub const PLATFORM_TEST_VERSIONS: &[PlatformVersion] = &[TEST_PLATFORM_V2, TEST_PLATFORM_V3]; //this starts at 2 +// We use OnceLock to be able to modify the version mocks +pub static PLATFORM_TEST_VERSIONS: OnceLock> = OnceLock::new(); +#[cfg(feature = "mock-versions")] +const DEFAULT_PLATFORM_TEST_VERSIONS: &[PlatformVersion] = &[TEST_PLATFORM_V2, TEST_PLATFORM_V3]; pub const LATEST_PLATFORM_VERSION: &PlatformVersion = &PLATFORM_V1; impl PlatformVersion { - pub fn get<'a>(version: u32) -> Result<&'a Self, PlatformVersionError> { + pub fn get<'a>(version: ProtocolVersion) -> Result<&'a Self, PlatformVersionError> { if version > 0 { #[cfg(feature = "mock-versions")] { - if version >> TEST_BYTES > 0 { - let test_version = version - (1 << TEST_BYTES); - return PLATFORM_TEST_VERSIONS.get(test_version as usize - 2).ok_or( + if version >> TEST_PROTOCOL_VERSION_SHIFT_BYTES > 0 { + let test_version = version - (1 << TEST_PROTOCOL_VERSION_SHIFT_BYTES); + + // Init default set of test versions + let versions = PLATFORM_TEST_VERSIONS + .get_or_init(|| vec![TEST_PLATFORM_V2, TEST_PLATFORM_V3]); + + return versions.get(test_version as usize - 2).ok_or( PlatformVersionError::UnknownVersionError(format!( "no test platform version {test_version}" )), @@ -82,15 +77,20 @@ impl PlatformVersion { } pub fn get_version_or_latest<'a>( - version: Option, + version: Option, ) -> Result<&'a Self, PlatformVersionError> { if let Some(version) = version { if version > 0 { #[cfg(feature = "mock-versions")] { - if version >> TEST_BYTES > 0 { - let test_version = version - (1 << TEST_BYTES); - return PLATFORM_TEST_VERSIONS.get(test_version as usize - 2).ok_or( + if version >> TEST_PROTOCOL_VERSION_SHIFT_BYTES > 0 { + let test_version = version - (1 << TEST_PROTOCOL_VERSION_SHIFT_BYTES); + + // Init default set of test versions + let versions = PLATFORM_TEST_VERSIONS + .get_or_init(|| Vec::from(DEFAULT_PLATFORM_TEST_VERSIONS)); + + return versions.get(test_version as usize - 2).ok_or( PlatformVersionError::UnknownVersionError(format!( "no test platform version {test_version}" )), @@ -123,4 +123,12 @@ impl PlatformVersion { .last() .expect("expected to have a platform version") } + + #[cfg(feature = "mock-versions")] + /// Set mock versions for testing + pub fn replace_test_versions(versions: Vec) { + PLATFORM_TEST_VERSIONS + .set(versions) + .expect("failed to set test versions") + } } diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index f53927ca66f..bc99fdcd41e 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -1,30 +1,37 @@ +use crate::version::contracts::SystemDataContractVersions; use crate::version::dpp_versions::{ - ContractVersions, CostVersions, DPPValidationVersions, DPPVersion, DataContractMethodVersions, - DataContractValidationVersions, DocumentFeatureVersionBounds, DocumentMethodVersions, - DocumentTransitionVersions, DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, - DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeVersions, DocumentVersions, - DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, + AssetLockVersions, ContractVersions, CostVersions, DPPMethodVersions, DPPValidationVersions, + DPPVersion, DataContractMethodVersions, DataContractValidationVersions, + DocumentFeatureVersionBounds, DocumentMethodVersions, DocumentTransitionVersions, + DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, + DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, + DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, + VotingValidationVersions, VotingVersions, }; use crate::version::drive_abci_versions::{ DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreSubsidyMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersionsAndConstants, + DriveAbciCoreInstantSendLockMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, - DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, - DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, + DriveAbciPlatformStateStorageMethodVersions, DriveAbciProtocolUpgradeMethodVersions, + DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, + DriveAbciQueryPrefundedSpecializedBalancesVersions, DriveAbciQuerySystemVersions, + DriveAbciQueryVersions, DriveAbciQueryVotingVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, - DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, - DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, + DriveAbciValidationConstants, DriveAbciValidationDataTriggerAndBindingVersions, + DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, + DriveAbciVotingMethodVersions, PenaltyAmounts, }; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, @@ -34,40 +41,50 @@ use crate::version::drive_versions::{ DriveCreditPoolEpochsMethodVersions, DriveCreditPoolMethodVersions, DriveCreditPoolPendingEpochRefundsMethodVersions, DriveCreditPoolStorageFeeDistributionPoolMethodVersions, - DriveDataContractOperationMethodVersions, DriveDocumentDeleteMethodVersions, - DriveDocumentEstimationCostsMethodVersions, DriveDocumentIndexUniquenessMethodVersions, + DriveCreditPoolUnpaidEpochMethodVersions, DriveDataContractOperationMethodVersions, + DriveDocumentDeleteMethodVersions, DriveDocumentEstimationCostsMethodVersions, + DriveDocumentIndexUniquenessMethodVersions, DriveDocumentInsertContestedMethodVersions, DriveDocumentInsertMethodVersions, DriveDocumentMethodVersions, DriveDocumentQueryMethodVersions, DriveDocumentUpdateMethodVersions, - DriveEstimatedCostsMethodVersions, DriveFeesMethodVersions, DriveGroveApplyMethodVersions, - DriveGroveBasicMethodVersions, DriveGroveBatchMethodVersions, DriveGroveCostMethodVersions, - DriveGroveMethodVersions, DriveIdentityContractInfoMethodVersions, - DriveIdentityCostEstimationMethodVersions, DriveIdentityFetchAttributesMethodVersions, - DriveIdentityFetchFullIdentityMethodVersions, DriveIdentityFetchMethodVersions, - DriveIdentityFetchPartialIdentityMethodVersions, + DriveEstimatedCostsMethodVersions, DriveFeesMethodVersions, DriveFetchMethodVersions, + DriveGroveApplyMethodVersions, DriveGroveBasicMethodVersions, DriveGroveBatchMethodVersions, + DriveGroveCostMethodVersions, DriveGroveMethodVersions, + DriveIdentityContractInfoMethodVersions, DriveIdentityCostEstimationMethodVersions, + DriveIdentityFetchAttributesMethodVersions, DriveIdentityFetchFullIdentityMethodVersions, + DriveIdentityFetchMethodVersions, DriveIdentityFetchPartialIdentityMethodVersions, DriveIdentityFetchPublicKeyHashesMethodVersions, DriveIdentityInsertMethodVersions, DriveIdentityKeyHashesToIdentityInsertMethodVersions, DriveIdentityKeysFetchMethodVersions, DriveIdentityKeysInsertMethodVersions, DriveIdentityKeysMethodVersions, DriveIdentityKeysProveMethodVersions, DriveIdentityMethodVersions, DriveIdentityProveMethodVersions, DriveIdentityUpdateMethodVersions, - DriveInitializationMethodVersions, DriveMethodVersions, DriveOperationsMethodVersion, - DrivePlatformSystemMethodVersions, DriveProtocolUpgradeVersions, DriveProveMethodVersions, + DriveIdentityWithdrawalDocumentMethodVersions, DriveIdentityWithdrawalMethodVersions, + DriveIdentityWithdrawalTransactionIndexMethodVersions, + DriveIdentityWithdrawalTransactionMethodVersions, + DriveIdentityWithdrawalTransactionQueueMethodVersions, DriveInitializationMethodVersions, + DriveMethodVersions, DriveOperationsMethodVersion, DrivePlatformStateMethodVersions, + DrivePlatformSystemMethodVersions, DrivePrefundedSpecializedMethodVersions, + DriveProtocolUpgradeVersions, DriveProveMethodVersions, + DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions, DriveStateTransitionMethodVersions, DriveStateTransitionOperationMethodVersions, DriveStructureVersion, DriveSystemEstimationCostsMethodVersions, - DriveSystemProtocolVersionMethodVersions, DriveVerifyContractMethodVersions, - DriveVerifyDocumentMethodVersions, DriveVerifyIdentityMethodVersions, - DriveVerifyMethodVersions, DriveVerifySingleDocumentMethodVersions, - DriveVerifySystemMethodVersions, DriveVersion, + DriveVerifyContractMethodVersions, DriveVerifyDocumentMethodVersions, + DriveVerifyIdentityMethodVersions, DriveVerifyMethodVersions, + DriveVerifySingleDocumentMethodVersions, DriveVerifyStateTransitionMethodVersions, + DriveVerifySystemMethodVersions, DriveVerifyVoteMethodVersions, DriveVersion, + DriveVoteCleanupMethodVersions, DriveVoteContestedResourceInsertMethodVersions, + DriveVoteFetchMethodVersions, DriveVoteInsertMethodVersions, DriveVoteMethodVersions, + DriveVoteSetupMethodVersions, DriveVoteStorageFormMethodVersions, }; +use crate::version::fee::v1::FEE_VERSION1; +use crate::version::limits::SystemLimits; use crate::version::protocol_version::{FeatureVersionBounds, PlatformVersion}; -use crate::version::{AbciStructureVersion, PlatformArchitectureVersion}; +use crate::version::{PlatformArchitectureVersion, ProtocolVersion}; +use grovedb_version::version::v1::GROVE_V1; -pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { +pub const PROTOCOL_VERSION_1: ProtocolVersion = 1; + +pub const PLATFORM_V1: PlatformVersion = PlatformVersion { protocol_version: 1, - identity: FeatureVersionBounds { - min_version: 0, - max_version: 0, - default_current_version: 0, - }, proofs: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -98,6 +115,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { credit_pools: DriveCreditPoolMethodVersions { epochs: DriveCreditPoolEpochsMethodVersions { get_epochs_infos: 0, + get_epochs_protocol_versions: 0, prove_epochs_infos: 0, get_epoch_fee_multiplier: 0, get_epoch_processing_credits_for_distribution: 0, @@ -123,10 +141,12 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { DriveCreditPoolStorageFeeDistributionPoolMethodVersions { get_storage_fees_from_distribution_pool: 0, }, + unpaid_epoch: DriveCreditPoolUnpaidEpochMethodVersions { + get_unpaid_epoch_index: 0, + }, }, protocol_upgrade: DriveProtocolUpgradeVersions { clear_version_information: 0, - change_to_new_version_and_clear_version_information: 0, fetch_versions_with_counter: 0, fetch_proved_versions_with_counter: 0, fetch_validator_version_votes: 0, @@ -134,7 +154,10 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { remove_validators_proposed_app_versions: 0, update_validator_proposed_app_version: 0, }, - prove: DriveProveMethodVersions { prove_multiple: 0 }, + prove: DriveProveMethodVersions { + prove_elements: 0, + prove_multiple_state_transition_results: 0, + }, balances: DriveBalancesMethodVersions { add_to_system_credits: 0, add_to_system_credits_operations: 0, @@ -167,6 +190,16 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { add_indices_for_top_index_level_for_contract_operations: 0, add_reference_for_index_level_for_contract_operations: 0, }, + insert_contested: DriveDocumentInsertContestedMethodVersions { + add_contested_document: 0, + add_contested_document_for_contract: 0, + add_contested_document_for_contract_apply_and_add_to_operations: 0, + add_contested_document_for_contract_operations: 0, + add_contested_document_to_primary_storage: 0, + add_contested_indices_for_contract_operations: 0, + add_contested_reference_and_vote_subtree_to_document_operations: 0, + add_contested_vote_subtree_for_non_identities_operations: 0, + }, update: DriveDocumentUpdateMethodVersions { add_update_multiple_documents_operations: 0, update_document_for_contract: 0, @@ -178,15 +211,49 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { }, estimation_costs: DriveDocumentEstimationCostsMethodVersions { add_estimation_costs_for_add_document_to_primary_storage: 0, + add_estimation_costs_for_add_contested_document_to_primary_storage: 0, stateless_delete_of_non_tree_for_costs: 0, }, index_uniqueness: DriveDocumentIndexUniquenessMethodVersions { validate_document_uniqueness: 0, validate_document_create_transition_action_uniqueness: 0, validate_document_replace_transition_action_uniqueness: 0, + validate_document_transfer_transition_action_uniqueness: 0, + validate_document_purchase_transition_action_uniqueness: 0, + validate_document_update_price_transition_action_uniqueness: 0, validate_uniqueness_of_data: 0, }, }, + vote: DriveVoteMethodVersions { + insert: DriveVoteInsertMethodVersions { + register_identity_vote: 0, + }, + contested_resource_insert: DriveVoteContestedResourceInsertMethodVersions { + register_contested_resource_identity_vote: 0, + insert_stored_info_for_contested_resource_vote_poll: 0, + register_identity_vote: 0, + add_vote_poll_end_date_query_operations: 0, + }, + cleanup: DriveVoteCleanupMethodVersions { + remove_specific_vote_references_given_by_identity: 0, + remove_specific_votes_given_by_identity: 0, + remove_contested_resource_vote_poll_end_date_query_operations: 0, + remove_contested_resource_vote_poll_votes_operations: 0, + remove_contested_resource_vote_poll_documents_operations: 0, + remove_contested_resource_vote_poll_contenders_operations: 0, + }, + setup: DriveVoteSetupMethodVersions { + add_initial_vote_tree_main_structure_operations: 0, + }, + storage_form: DriveVoteStorageFormMethodVersions { + resolve_with_contract: 0, + }, + fetch: DriveVoteFetchMethodVersions { + fetch_identities_voting_for_contenders: 0, + fetch_contested_document_vote_poll_stored_info: 0, + fetch_identity_contested_resource_vote: 0, + }, + }, contract: DriveContractMethodVersions { prove: DriveContractProveMethodVersions { prove_contract: 0, @@ -217,11 +284,13 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { estimated_costs: DriveEstimatedCostsMethodVersions { add_estimation_costs_for_levels_up_to_contract: 0, add_estimation_costs_for_levels_up_to_contract_document_type_excluded: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded: 0, }, asset_lock: DriveAssetLockMethodVersions { add_asset_lock_outpoint: 0, add_estimation_costs_for_adding_asset_lock: 0, - has_asset_lock_outpoint: 0, + fetch_asset_lock_outpoint_info: 0, }, verify: DriveVerifyMethodVersions { contract: DriveVerifyContractMethodVersions { @@ -242,6 +311,9 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { verify_identity_id_by_public_key_hash: 0, verify_identity_ids_by_public_key_hashes: 0, verify_identity_keys_by_identity_id: 0, + verify_identity_nonce: 0, + verify_identity_contract_nonce: 0, + verify_identities_contract_keys: 0, }, single_document: DriveVerifySingleDocumentMethodVersions { verify_proof: 0, @@ -249,9 +321,24 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { }, system: DriveVerifySystemMethodVersions { verify_epoch_infos: 0, + verify_elements: 0, + verify_total_credits_in_system: 0, verify_upgrade_state: 0, verify_upgrade_vote_status: 0, }, + voting: DriveVerifyVoteMethodVersions { + verify_masternode_vote: 0, + verify_start_at_contender_in_proof: 0, + verify_vote_poll_votes_proof: 0, + verify_identity_votes_given_proof: 0, + verify_vote_poll_vote_state_proof: 0, + verify_contests_proof: 0, + verify_vote_polls_by_end_date_proof: 0, + verify_specialized_balance: 0, + }, + state_transition: DriveVerifyStateTransitionMethodVersions { + verify_state_transition_was_executed_with_proof: 0, + }, }, identity: DriveIdentityMethodVersions { fetch: DriveIdentityFetchMethodVersions { @@ -269,14 +356,18 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { }, attributes: DriveIdentityFetchAttributesMethodVersions { revision: 0, + nonce: 0, + identity_contract_nonce: 0, balance: 0, balance_include_debt: 0, negative_balance: 0, }, partial_identity: DriveIdentityFetchPartialIdentityMethodVersions { + fetch_identity_revision_with_keys: 0, fetch_identity_balance_with_keys: 0, fetch_identity_balance_with_keys_and_revision: 0, fetch_identity_with_balance: 0, + fetch_identity_keys: 0, }, full_identity: DriveIdentityFetchFullIdentityMethodVersions { fetch_full_identity: Some(0), @@ -286,6 +377,9 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { prove: DriveIdentityProveMethodVersions { full_identity: 0, full_identities: 0, + identity_nonce: 0, + identity_contract_nonce: 0, + identities_contract_keys: 0, prove_full_identities_by_unique_public_key_hashes: 0, prove_full_identity_by_unique_public_key_hash: 0, prove_identity_id_by_unique_public_key_hash: 0, @@ -297,6 +391,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { fetch_all_identity_keys: 0, fetch_identities_all_keys: 0, fetch_identity_keys: 0, + fetch_identities_contract_keys: 0, }, prove: DriveIdentityKeysProveMethodVersions { prove_identities_all_keys: 0, @@ -323,6 +418,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { }, update: DriveIdentityUpdateMethodVersions { update_identity_revision: 0, + merge_identity_nonce: 0, update_identity_negative_credit_operation: 0, initialize_identity_revision: 0, disable_identity_keys: 0, @@ -336,18 +432,22 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { add_to_previous_balance: 0, apply_balance_change_from_fee_to_identity: 0, remove_from_identity_balance: 0, + refresh_identity_key_reference_operations: 0, }, insert: DriveIdentityInsertMethodVersions { add_new_identity: 0, }, contract_info: DriveIdentityContractInfoMethodVersions { add_potential_contract_info_for_contract_bounded_key: 0, + refresh_potential_contract_info_key_references: 0, + merge_identity_contract_nonce: 0, }, cost_estimation: DriveIdentityCostEstimationMethodVersions { for_authentication_keys_security_level_in_key_reference_tree: 0, for_balances: 0, for_contract_info: 0, for_contract_info_group: 0, + for_contract_info_group_keys: 0, for_contract_info_group_key_purpose: 0, for_keys_for_identity_id: 0, for_negative_credit: 0, @@ -355,14 +455,24 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { for_root_key_reference_tree: 0, for_update_revision: 0, }, + withdrawals: DriveIdentityWithdrawalMethodVersions { + document: DriveIdentityWithdrawalDocumentMethodVersions { + fetch_oldest_withdrawal_documents_by_status: 0, + find_up_to_100_withdrawal_documents_by_status_and_transaction_indices: 0, + }, + transaction: DriveIdentityWithdrawalTransactionMethodVersions { + index: DriveIdentityWithdrawalTransactionIndexMethodVersions { + fetch_next_withdrawal_transaction_index: 0, + add_update_next_withdrawal_transaction_index_operation: 0, + }, + queue: DriveIdentityWithdrawalTransactionQueueMethodVersions { + add_enqueue_untied_withdrawal_transaction_operations: 0, + dequeue_untied_withdrawal_transactions: 0, + }, + }, + }, }, platform_system: DrivePlatformSystemMethodVersions { - protocol_version: DriveSystemProtocolVersionMethodVersions { - fetch_current_protocol_version: 0, - set_current_protocol_version_operations: 0, - fetch_next_protocol_version: 0, - set_next_protocol_version_operations: 0, - }, estimation_costs: DriveSystemEstimationCostsMethodVersions { for_total_system_credits_update: 0, }, @@ -383,11 +493,46 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { finalization_tasks: 0, }, }, + convert_to_high_level_operations: + DriveStateTransitionActionConvertToHighLevelOperationsMethodVersions { + data_contract_create_transition: 0, + data_contract_update_transition: 0, + document_create_transition: 0, + document_delete_transition: 0, + document_purchase_transition: 0, + document_replace_transition: 0, + document_transfer_transition: 0, + document_update_price_transition: 0, + documents_batch_transition: 0, + identity_create_transition: 0, + identity_credit_transfer_transition: 0, + identity_credit_withdrawal_transition: 0, + identity_top_up_transition: 0, + identity_update_transition: 0, + masternode_vote_transition: 0, + bump_identity_data_contract_nonce: 0, + bump_identity_nonce: 0, + partially_use_asset_lock: 0, + }, }, batch_operations: DriveBatchOperationsMethodVersion { convert_drive_operations_to_grove_operations: 0, apply_drive_operations: 0, }, + platform_state: DrivePlatformStateMethodVersions { + fetch_platform_state_bytes: 0, + store_platform_state_bytes: 0, + }, + fetch: DriveFetchMethodVersions { fetch_elements: 0 }, + prefunded_specialized_balances: DrivePrefundedSpecializedMethodVersions { + fetch_single: 0, + prove_single: 0, + add_prefunded_specialized_balance: 0, + add_prefunded_specialized_balance_operations: 0, + deduct_from_prefunded_specialized_balance: 0, + deduct_from_prefunded_specialized_balance_operations: 0, + estimated_cost_for_prefunded_specialized_balance_update: 0, + }, }, grove_methods: DriveGroveMethodVersions { basic: DriveGroveBasicMethodVersions { @@ -402,11 +547,13 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { grove_get_raw_value_u64_from_encoded_var_vec: 0, grove_get: 0, grove_get_path_query_serialized_results: 0, + grove_get_path_query_serialized_or_sum_results: 0, grove_get_path_query: 0, grove_get_path_query_with_optional: 0, grove_get_raw_path_query_with_optional: 0, grove_get_raw_path_query: 0, grove_get_proved_path_query: 0, + grove_get_proved_path_query_with_conditional: 0, grove_get_sum_tree_total_value: 0, grove_has_raw: 0, }, @@ -417,6 +564,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { batch_insert: 0, batch_insert_if_not_exists: 0, batch_insert_if_changed_value: 0, + batch_replace: 0, batch_delete: 0, batch_remove_raw: 0, batch_delete_up_tree_while_empty: 0, @@ -425,21 +573,13 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { apply: DriveGroveApplyMethodVersions { grove_apply_operation: 0, grove_apply_batch: 0, - grove_apply_batch_with_add_costs: 0, grove_apply_partial_batch: 0, - grove_apply_partial_batch_with_add_costs: 0, }, costs: DriveGroveCostMethodVersions { grove_batch_operations_costs: 0, }, }, - }, - abci_structure: AbciStructureVersion { - extended_block_info: FeatureVersionBounds { - min_version: 0, - max_version: 0, - default_current_version: 0, - }, + grove_version: GROVE_V1, }, platform_architecture: PlatformArchitectureVersion { data_contract_factory_structure_version: 0, @@ -452,6 +592,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { state_transition_execution_context: 0, commit: 0, masternode: 0, + signature_verification_quorum_set: 0, }, methods: DriveAbciMethodVersions { engine: DriveAbciEngineMethodVersions { @@ -461,7 +602,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { finalize_block_proposal: 0, }, initialization: DriveAbciInitializationMethodVersions { - initial_core_height: 0, + initial_core_height_and_time: 0, create_genesis_state: 0, }, core_based_updates: DriveAbciCoreBasedUpdatesMethodVersions { @@ -472,12 +613,11 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { get_voter_identity_key: 0, get_operator_identity_keys: 0, get_owner_identity_key: 0, - get_voter_identifier: 0, - get_operator_identifier: 0, + get_voter_identifier_from_masternode_list_item: 0, + get_operator_identifier_from_masternode_list_item: 0, create_operator_identity: 0, create_owner_identity: 0, create_voter_identity: 0, - hash_protxhash_with_key_data: 0, disable_identity_keys: 0, update_masternode_identities: 0, update_operator_identity: 0, @@ -487,13 +627,23 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { }, protocol_upgrade: DriveAbciProtocolUpgradeMethodVersions { check_for_desired_protocol_upgrade: 0, + upgrade_protocol_version_on_epoch_change: 0, + protocol_version_upgrade_percentage_needed: 75, }, block_fee_processing: DriveAbciBlockFeeProcessingMethodVersions { add_process_epoch_change_operations: 0, process_block_fees: 0, }, - core_subsidy: DriveAbciCoreSubsidyMethodVersions { - epoch_core_reward_credits_for_distribution: 0, + core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants { + choose_quorum: 0, + verify_chain_lock: 0, + verify_chain_lock_locally: 0, + verify_chain_lock_through_core: 0, + make_sure_core_is_synced_to_chain_lock: 0, + recent_block_count_amount: 2, + }, + core_instant_send_lock: DriveAbciCoreInstantSendLockMethodVersions { + verify_recent_signature_locally: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, @@ -505,21 +655,31 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { find_oldest_epoch_needing_payment: 0, fetch_reward_shares_list_for_masternode: 0, }, - identity_credit_withdrawal: DriveAbciIdentityCreditWithdrawalMethodVersions { - build_withdrawal_transactions_from_documents: 0, - fetch_and_prepare_unsigned_withdrawal_transactions: 0, + withdrawals: DriveAbciIdentityCreditWithdrawalMethodVersions { + build_untied_withdrawal_transactions_from_documents: 0, + dequeue_and_build_unsigned_withdrawal_transactions: 0, fetch_transactions_block_inclusion_status: 0, pool_withdrawals_into_transactions_queue: 0, - update_broadcasted_withdrawal_transaction_statuses: 0, + update_broadcasted_withdrawal_statuses: 0, + append_signatures_and_broadcast_withdrawal_transactions: 0, + }, + voting: DriveAbciVotingMethodVersions { + keep_record_of_finished_contested_resource_vote_poll: 0, + clean_up_after_vote_poll_end: 0, + clean_up_after_contested_resources_vote_poll_end: 0, + check_for_ended_vote_polls: 0, + tally_votes_for_contested_document_resource_vote_poll: 0, + award_document_to_winner: 0, + delay_vote_poll: 0, + run_dao_platform_events: 0, + remove_votes_for_removed_masternodes: 0, }, state_transition_processing: DriveAbciStateTransitionProcessingMethodVersions { execute_event: 0, process_raw_state_transitions: 0, + decode_raw_state_transitions: 0, validate_fees_of_event: 0, }, - withdrawals: DriveAbciWithdrawalsMethodVersions { - check_withdrawals: 0, - }, epoch: DriveAbciEpochMethodVersions { gather_epoch_info: 0, get_genesis_time: 0, @@ -528,72 +688,112 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { clear_drive_block_cache: 0, }, block_end: DriveAbciBlockEndMethodVersions { - store_ephemeral_state: 0, update_state_cache: 0, update_drive_cache: 0, validator_set_update: 0, }, + platform_state_storage: DriveAbciPlatformStateStorageMethodVersions { + fetch_platform_state: 0, + store_platform_state: 0, + }, }, validation_and_processing: DriveAbciValidationVersions { state_transitions: DriveAbciStateTransitionValidationVersions { common_validation_methods: DriveAbciStateTransitionCommonValidationVersions { asset_locks: DriveAbciAssetLockValidationVersions { fetch_asset_lock_transaction_output_sync: 0, + verify_asset_lock_is_not_spent_and_has_enough_balance: 0, }, validate_identity_public_key_contract_bounds: 0, validate_identity_public_key_ids_dont_exist_in_state: 0, validate_identity_public_key_ids_exist_in_state: 0, validate_state_transition_identity_signed: 0, validate_unique_identity_public_key_hashes_in_state: 0, + validate_master_key_uniqueness: 0, + validate_simple_pre_check_balance: 0, }, + max_asset_lock_usage_attempts: 16, identity_create_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: Some(0), identity_signatures: Some(0), + advanced_minimum_balance_pre_check: None, + nonce: None, state: 0, transform_into_action: 0, }, identity_update_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: Some(0), identity_signatures: Some(0), + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, identity_top_up_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, - identity_signatures: Some(0), + basic_structure: Some(0), + advanced_structure: None, + identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: None, state: 0, transform_into_action: 0, }, identity_credit_withdrawal_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), state: 0, transform_into_action: 0, }, identity_credit_transfer_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), state: 0, transform_into_action: 0, }, + masternode_vote_state_transition: DriveAbciStateTransitionValidationVersion { + basic_structure: None, + advanced_structure: Some(0), + identity_signatures: None, + advanced_minimum_balance_pre_check: Some(0), + nonce: Some(0), + state: 0, + transform_into_action: 0, + }, contract_create_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: Some(0), + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, contract_update_state_transition: DriveAbciStateTransitionValidationVersion { - structure: 0, + basic_structure: None, + advanced_structure: None, identity_signatures: None, + advanced_minimum_balance_pre_check: None, + nonce: Some(0), state: 0, transform_into_action: 0, }, documents_batch_state_transition: DriveAbciDocumentsStateTransitionValidationVersions { - structure: 0, + balance_pre_check: 0, + basic_structure: 0, + advanced_structure: 0, state: 0, + revision: 0, transform_into_action: 0, data_triggers: DriveAbciValidationDataTriggerAndBindingVersions { bindings: 0, @@ -610,16 +810,33 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { document_create_transition_structure_validation: 0, document_delete_transition_structure_validation: 0, document_replace_transition_structure_validation: 0, + document_transfer_transition_structure_validation: 0, + document_purchase_transition_structure_validation: 0, + document_update_price_transition_structure_validation: 0, document_create_transition_state_validation: 0, document_delete_transition_state_validation: 0, document_replace_transition_state_validation: 0, + document_transfer_transition_state_validation: 0, + document_purchase_transition_state_validation: 0, + document_update_price_transition_state_validation: 0, }, }, process_state_transition: 0, + state_transition_to_execution_event_for_check_tx: 0, + penalties: PenaltyAmounts { + identity_id_not_correct: 50000000, + unique_key_already_present: 10000000, + validation_of_added_keys_structure_failure: 10000000, + validation_of_added_keys_proof_of_possession_failure: 50000000, + }, + event_constants: DriveAbciValidationConstants { + maximum_vote_polls_to_process: 2, + maximum_contenders_to_consider: 100, + }, }, query: DriveAbciQueryVersions { + max_returned_elements: 100, response_metadata: 0, - base_query_structure: 0, proofs_query: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -630,38 +847,50 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + prefunded_specialized_balances: DriveAbciQueryPrefundedSpecializedBalancesVersions { + balance: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, identity_based_queries: DriveAbciQueryIdentityVersions { identity: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - identities: FeatureVersionBounds { + keys: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - keys: FeatureVersionBounds { + identities_contract_keys: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - balance: FeatureVersionBounds { + identity_nonce: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - balance_and_revision: FeatureVersionBounds { + identity_contract_nonce: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - identity_by_public_key_hash: FeatureVersionBounds { + balance: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, }, - identities_by_public_key_hashes: FeatureVersionBounds { + balance_and_revision: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + identity_by_public_key_hash: FeatureVersionBounds { min_version: 0, max_version: 0, default_current_version: 0, @@ -684,6 +913,33 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { default_current_version: 0, }, }, + voting_based_queries: DriveAbciQueryVotingVersions { + vote_polls_by_end_date_query: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_vote_state: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_voters_for_identity: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resource_identity_vote_status: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + contested_resources: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, system: DriveAbciQuerySystemVersions { version_upgrade_state: FeatureVersionBounds { min_version: 0, @@ -700,6 +956,16 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + path_elements: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + total_credits_in_platform: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, }, }, }, @@ -708,11 +974,11 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { signature_verify: 0, }, validation: DPPValidationVersions { - validate_time_in_block_time_window: 0, json_schema_validator: JsonSchemaValidatorVersions { new: 0, validate: 0, compile: 0, + compile_and_validate: 0, }, data_contract: DataContractValidationVersions { validate: 0, @@ -722,6 +988,15 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { validate_not_defined_properties: 0, validate_property_definition: 0, }, + document_type: DocumentTypeValidationVersions { + validate_update: 0, + contested_index_limit: 1, + unique_index_limit: 10, + }, + voting: VotingValidationVersions { + allow_other_contenders_time_ms: 604_800_000, // 1 week in ms + votes_allowed_per_masternode: 5, + }, }, state_transition_serialization_versions: StateTransitionSerializationVersions { identity_public_key_in_creation: FeatureVersionBounds { @@ -754,6 +1029,11 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { max_version: 0, default_current_version: 0, }, + masternode_vote_state_transition: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, contract_create_state_transition: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -795,9 +1075,32 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { default_current_version: 0, }, }, + document_transfer_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + document_update_price_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + document_purchase_state_transition: DocumentFeatureVersionBounds { + bounds: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, }, state_transition_conversion_versions: StateTransitionConversionVersions { identity_to_identity_create_transition: 0, + identity_to_identity_top_up_transition: 0, + identity_to_identity_withdrawal_transition: 0, identity_to_identity_create_transition_with_signer: 0, }, state_transition_method_versions: StateTransitionMethodVersions { @@ -820,13 +1123,19 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { }, }, identities: IdentityTransitionVersions { + max_public_keys_in_creation: 6, asset_locks: IdentityTransitionAssetLockVersions { + required_asset_lock_duff_balance_for_processing_start_for_identity_create: + 200000, + required_asset_lock_duff_balance_for_processing_start_for_identity_top_up: + 50000, validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, }, }, contract_versions: ContractVersions { + max_serialized_size: 65000, contract_serialization_version: FeatureVersionBounds { min_version: 0, max_version: 0, @@ -837,6 +1146,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { config: 0, methods: DataContractMethodVersions { validate_document: 0, + validate_update: 0, schema: 0, }, document_type_versions: DocumentTypeVersions { @@ -852,20 +1162,22 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { enrich_with_base_schema: 0, find_identifier_and_binary_paths: 0, validate_max_depth: 0, + max_depth: 256, recursive_schema_validator_versions: RecursiveSchemaValidatorVersions { traversal_validator: 0, - byte_array_has_no_items_as_parent_validator: 0, - pattern_is_valid_regex_validator: 0, }, validate_schema_compatibility: 0, }, methods: DocumentTypeMethodVersions { create_document_from_data: 0, create_document_with_prevalidated_properties: 0, + prefunded_voting_balance_for_document: 0, + contested_vote_poll_for_document: 0, estimated_size: 0, index_for_types: 0, max_size: 0, serialize_value_for_key: 0, + deserialize_value_for_key: 0, }, }, }, @@ -888,6 +1200,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { default_current_version: 0, }, document_method_versions: DocumentMethodVersions { + is_equal_ignoring_timestamps: 0, hash: 0, get_raw_for_contract: 0, get_raw_for_document_type: 0, @@ -901,5 +1214,33 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { random_public_and_private_key_data: 0, }, }, + voting_versions: VotingVersions { + default_vote_poll_time_duration_ms: 1_209_600_000, //2 weeks + contested_document_vote_poll_stored_info_version: 0, + }, + asset_lock_versions: AssetLockVersions { + reduced_asset_lock_value: FeatureVersionBounds { + min_version: 0, + max_version: 0, + default_current_version: 0, + }, + }, + methods: DPPMethodVersions { + epoch_core_reward_credits_for_distribution: 0, + }, + }, + system_data_contracts: SystemDataContractVersions { + withdrawals: 1, + dpns: 1, + dashpay: 1, + masternode_reward_shares: 1, + feature_flags: 1, + }, + fee_version: FEE_VERSION1, + system_limits: SystemLimits { + estimated_contract_max_serialized_size: 16384, + max_field_value_size: 5120, //5 KiB + max_state_transition_size: 20480, //20 KiB + max_transitions_in_documents_batch: 1, }, }; diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index 9c0f76cf03a..7ef41ff106b 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,11 +2,10 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -private = true [lib] proc-macro = true diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 9eea015d118..9945784b52d 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,66 +1,74 @@ [package] -name = "rs-sdk" -version = "0.25.21" +name = "dash-sdk" +version = "1.1.0-dev.1" edition = "2021" [dependencies] -dpp = { path = "../rs-dpp", features = [ - "client", - "validation", - "identity-value-conversion", +arc-swap = { version = "1.7.1" } +dpp = { path = "../rs-dpp", default-features = false, features = [ + "dash-sdk-features", ] } -dapi-grpc = { path = "../dapi-grpc", features = ["client"] } +dapi-grpc = { path = "../dapi-grpc" } rs-dapi-client = { path = "../rs-dapi-client", default-features = false } drive = { path = "../rs-drive", default-features = false, features = [ - "verify", + "verify", ] } drive-proof-verifier = { path = "../rs-drive-proof-verifier" } -# drive-abci is only needed for core rpc; TODO remove once we have correct core rpc impl -drive-abci = { path = "../rs-drive-abci", default-features = false } - -bincode = { version = "2.0.0-rc.3", features = ["serde"], optional = true } -thiserror = "1.0.47" -tokio = { version = "1.32.0", features = ["macros"] } -async-trait = { version = "0.1.73" } -http = { version = "0.2.9" } +dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" } +thiserror = "1.0.58" +tokio = { version = "1.36.0", features = ["macros"] } +tokio-util = { version = "0.7.10" } +async-trait = { version = "0.1.79" } +http = { version = "0.2.12" } ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" } -serde = { version = "1.0.152", default-features = false, features = ["rc"] } +serde = { version = "1.0.197", default-features = false, features = [ + "rc", +], optional = true } serde_json = { version = "1.0", features = ["preserve_order"], optional = true } -tracing = { version = "0.1.37" } -hex = { version = "0.4.3", optional = true } +tracing = { version = "0.1.40" } +hex = { version = "0.4.3"} dotenvy = { version = "0.15.7", optional = true } envy = { version = "0.4.2", optional = true } -futures = { version = "0.3.28" } -derive_more = { version = "0.99.16" } +futures = { version = "0.3.30" } +derive_more = { version = "0.99.17" } # dashcore-rpc is only needed for core rpc; TODO remove once we have correct core rpc impl -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", branch = "master" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.4" } +lru = { version = "0.12.3", optional = true } +bip37-bloom-filter = { git = "https://github.com/dashpay/rs-bip37-bloom-filter", branch = "develop" } +pollster = { version = "0.3.0" } [dev-dependencies] +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } rs-dapi-client = { path = "../rs-dapi-client", features = ["mocks"] } -base64 = { version = "0.21.0" } -tracing-subscriber = { version = "0.3.16" } +base64 = { version = "0.22.1" } +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } dpp = { path = "../rs-dpp", features = [ - "client", - "validation", - "random-documents", + "client", + "validation", + "random-documents", ] } data-contracts = { path = "../data-contracts" } -tokio-test = { version = "0.4.3" } +tokio-test = { version = "0.4.4" } +clap = { version = "4.5.4", features = ["derive"] } +sanitize-filename = { version = "0.5.0" } +chrono = { version = "0.4.38" } +test-case = { version = "3.3.1" } [features] default = ["mocks", "offline-testing"] + mocks = [ - "dep:serde_json", - "rs-dapi-client/mocks", - "rs-dapi-client/dump", - "dpp/document-cbor-conversion", - "dpp/identity-value-conversion", - "dpp/random-identities", - "drive-proof-verifier/mocks", - "dep:bincode", - "dep:hex", - "dep:dotenvy", - "dep:envy", + "dep:serde", + "dep:serde_json", + "rs-dapi-client/mocks", + "rs-dapi-client/dump", + "dpp/document-cbor-conversion", + "dpp/random-identities", + "drive/serde", + "drive-proof-verifier/mocks", + "dep:dotenvy", + "dep:envy", + "dep:lru", ] # Run integration tests using test vectors from `tests/vectors/` instead of connecting to live Dash Platform. @@ -85,3 +93,12 @@ network-testing = ["mocks"] # dump all requests and responses to `tests/vectors/`, # so that they can be used later for `offline-testing`. generate-test-vectors = ["network-testing"] + +# Have the system data contracts inside the dpp crate + +system-data-contracts = ["dpp/data-contracts"] + +[[example]] + +name = "read_contract" +required-features = ["mocks"] diff --git a/packages/rs-sdk/README.md b/packages/rs-sdk/README.md index 0d6bba8dce4..4d543c5857b 100644 --- a/packages/rs-sdk/README.md +++ b/packages/rs-sdk/README.md @@ -4,12 +4,52 @@ This is the official Rust SDK for the Dash Platform. Dash Platform is a Layer 2 See Rust documentation of this crate for more details. +## Quick start + +### Cargo.toml + +To use this crate, define it as a dependency in your `Cargo.toml`: + +```toml +[dependencies] + +dash-platform-sdk = { git="https://github.com/dashpay/platform"0 } +``` + +### Implementing Dash Platform SDK application + +In order to build application that uses Dash Platform SDK, you need to: + +1. Implement a [Wallet](src/wallet.rs) that will store, manage and use your keys to sign transactions and state transitions. + An example implementation of wallet can be found in [src/mock/wallet.rs](src/mock/wallet.rs). +2. Implement Dash SPV client that will sync your application with Dash Core state, including quorum public keys. + + TODO: Add more details here. + + For testing and development purposes, while you don't have your SPV client implementation ready, you can setup local Dash Core node and access it using RPC interface (see below). + +3. Implement `ContextProvider` gives Dash Platform SDK access to state of your application, like: + * quorum public keys retrieved using SPV, + * data contracts configured and/or fetched from the server. + + See [GrpcContextProvider](../rs-sdk/src/mock/provider.rs) for an example implementation. + +### Mocking + +Dash Platform SDK supports mocking with `mocks` feature which provides a +convenient way to define mock expectations and use the SDK without actual +connection to Platform. + +You can see examples of mocking in [mock_fetch.rs](tests/fetch/mock_fetch.rs) and [mock_fetch_many.rs](tests/fetch/mock_fetch_many.rs). + ## Examples You can find quick start example in `examples/` folder. Examples must be configured by setting constants. You can also inspect tests in `tests/` folder for more detailed examples. +Also refer to [Platform Explorer](https://github.com/dashpay/rs-platform-explorer/) which uses the SDK to execute various state transitions. + ## Tests This section provides instructions on how to test the RS-SDK for Dash Platform. The tests can be run in two modes: **offline** (without connectivity to the Dash Platform) and **network** (with connectivity to the Dash Platform). **Offline** mode is the default one. @@ -28,7 +68,7 @@ Follow these steps to conduct network testing: ```bash cd packages/rs-sdk -cargo test -p rs-sdk --no-default-features --features network-testing +cargo test -p dash-sdk --no-default-features --features network-testing ``` ## Offline Testing @@ -54,7 +94,7 @@ To generate test vectors: Run the offline test using the following command: ```bash -cargo test -p rs-sdk +cargo test -p dash-platform-sdk ``` ## Implementing Fetch and FetchAny on new objects @@ -69,6 +109,7 @@ Definitions: 2. `Response` - gRPC response type, as generated in `packages/dapi-grpc/protos/platform/v0/platform.proto`. 3. `Object` - object type that should be returned by rs-sdk, most likely defined in `dpp` crate. In some cases, it can be defined in `packages/rs-drive-proof-verifier/src/types.rs`. +4. `Key` - some unique identifier of the `Object`, for example `platform_value::Identifier` Checklist: @@ -85,8 +126,10 @@ in `packages/rs-dapi-client/src/transport/grpc.rs`. that will store collection of returned objects, indexd by some key. 5. [ ] Implement `FromProof` trait for the `Object` (or type defined in `types.rs`) in `packages/rs-drive-proof-verifier/src/proof.rs`. 6. [ ] Implement `Query` trait for the `Request` in `packages/rs-sdk/src/platform/query.rs`. -7. [ ] Implement `Fetch\` trait for the `Object` (or type defined in `types.rs`) in `packages/rs-sdk/src/platform/fetch.rs`. -8. [ ] Implement `FetchMany\` trait for the `Object` (or type defined in `types.rs`) in `packages/rs-sdk/src/platform/fetch_many.rs`. +7. [ ] Implement `Fetch` trait for the `Object` (or type defined in `types.rs`), with inner type Request = `Request`, + in `packages/rs-sdk/src/platform/fetch.rs`. +8. [ ] Implement `FetchMany\` trait for the `Object` (or type defined in `types.rs`), + with inner type Request = `Request`, in `packages/rs-sdk/src/platform/fetch_many.rs`. 9. [ ] Add `mod ...;` clause to `packages/rs-sdk/tests/fetch/main.rs` 10. [ ] Implement unit tests in `packages/rs-sdk/tests/fetch/*object*.rs` 11. [ ] Add name of request type to match clause in `packages/rs-sdk/src/mock/sdk.rs` : `load_expectations()` diff --git a/packages/rs-sdk/examples/read_contract.rs b/packages/rs-sdk/examples/read_contract.rs index 03c7ed76a40..ca37f1cfa7d 100644 --- a/packages/rs-sdk/examples/read_contract.rs +++ b/packages/rs-sdk/examples/read_contract.rs @@ -1,41 +1,98 @@ -use std::str::FromStr; +use std::{num::NonZeroUsize, str::FromStr}; +use clap::Parser; +use dash_sdk::{mock::provider::GrpcContextProvider, platform::Fetch, Sdk, SdkBuilder}; use dpp::prelude::{DataContract, Identifier}; use rs_dapi_client::AddressList; -use rs_sdk::platform::Fetch; -pub const PLATFORM_IP: &str = "127.0.0.1"; -pub const CORE_PORT: u16 = 20002; -pub const CORE_USER: &str = "someuser"; -pub const CORE_PASSWORD: &str = "verysecretpassword"; -pub const PLATFORM_PORT: u16 = 2443; +#[derive(clap::Parser, Debug)] +#[command(version)] +pub struct Config { + /// Dash Platform server hostname or IPv4 address + #[arg(short = 'i', long = "address")] + pub server_address: String, + + /// Dash Core IP port + #[arg(short = 'c', long)] + pub core_port: u16, + + // Dash Core RPC user + #[arg(short = 'u', long)] + pub core_user: String, + + // Dash Core RPC password + #[arg(short = 'p', long)] + pub core_password: String, + + /// Dash Platform DAPI port + #[arg(short = 'd', long)] + pub platform_port: u16, +} /// Read data contract. /// /// This example demonstrates how to connect to running platform and try to read a data contract. +/// TODO: add wallet, context provider, etc. #[tokio::main(flavor = "multi_thread", worker_threads = 1)] async fn main() { // Replace const below with data contract identifier of data contract, 32 bytes const DATA_CONTRACT_ID_BYTES: [u8; 32] = [1; 32]; - // Configure the SDK to connect to the Platform. - // Note that in future versions of the SDK, core user and password will not be needed. - let uri = http::Uri::from_str(&format!("http://{}:{}", PLATFORM_IP, PLATFORM_PORT)) - .expect("platform address uri"); - let mut sdk = rs_sdk::SdkBuilder::new(AddressList::from_iter([uri])) - .with_core(PLATFORM_IP, CORE_PORT, CORE_USER, CORE_PASSWORD) - .build() - .expect("cannot initialize api"); + // Read configuration + let config = Config::parse(); + // Configure the Sdk + let sdk = setup_sdk(&config); + + // read data contract // Convert bytes to identifier object that can be used as a Query let id = Identifier::from_bytes(&DATA_CONTRACT_ID_BYTES).expect("parse data contract id"); - // Fetch identity from the Platform - let contract: Option = DataContract::fetch(&mut sdk, id) - .await - .expect("fetch identity"); + // Fetch identity from Platform + let contract: Option = + DataContract::fetch(&sdk, id).await.expect("fetch identity"); // Check the result; note that in our case, we expect to not find the data contract, as the // identifier is not valid. assert!(contract.is_none(), "result: {:?}", contract); } + +/// Setup Rust SDK +fn setup_sdk(config: &Config) -> Sdk { + // We need to implement a ContextProvider. + // Here, we will just use a mock implementation. + // Tricky thing here is that this implementation requires SDK, so we have a + // circular dependency between SDK and ContextProvider. + // We'll first provide `None` Sdk, and then update it later. + // + // To modify context provider, we need locks and Arc to overcome ownership rules. + let context_provider = GrpcContextProvider::new( + None, + &config.server_address, + config.core_port, + &config.core_user, + &config.core_password, + NonZeroUsize::new(100).expect("data contracts cache size"), + NonZeroUsize::new(100).expect("quorum public keys cache size"), + ) + .expect("context provider"); + + // Let's build the Sdk. + // First, we need an URI of some Dash Platform DAPI host to connect to and use as seed. + let uri = http::Uri::from_str(&format!( + "http://{}:{}", + config.server_address, config.platform_port + )) + .expect("parse uri"); + + // Now, we create the Sdk with the wallet and context provider. + let mut sdk = SdkBuilder::new(AddressList::from_iter([uri])) + .build() + .expect("cannot build sdk"); + + // Reconfigure context provider with Sdk + context_provider.set_sdk(Some(sdk.clone())); + sdk.set_context_provider(context_provider); + // Return the SDK we created + sdk +} diff --git a/packages/rs-sdk/scripts/generate_test_vectors.sh b/packages/rs-sdk/scripts/generate_test_vectors.sh index 240b1a8e4a4..a5530e7d93e 100755 --- a/packages/rs-sdk/scripts/generate_test_vectors.sh +++ b/packages/rs-sdk/scripts/generate_test_vectors.sh @@ -20,13 +20,9 @@ CARGO_DIR="$(realpath "$(dirname "$0")/..")" pushd "$CARGO_DIR" -if [ -z "$1" ]; then - rm -f "${CARGO_DIR}"/tests/vectors/* -fi - -cargo test -p rs-sdk \ +cargo test -p dash-sdk \ --no-default-features \ --features generate-test-vectors \ - "$1" + "$@" popd diff --git a/packages/rs-sdk/src/core.rs b/packages/rs-sdk/src/core.rs deleted file mode 100644 index 16e5f6f9fbd..00000000000 --- a/packages/rs-sdk/src/core.rs +++ /dev/null @@ -1,79 +0,0 @@ -//! Core RPC client used to retrieve quorum keys from core. -//! -//! TODO: This is a temporary implementation, effective until we integrate SPV -//! into rs-sdk. - -use dashcore_rpc::{ - dashcore::{hashes::Hash, QuorumHash}, - dashcore_rpc_json::QuorumType, -}; -use drive_abci::rpc::core::{CoreRPCLike, DefaultCoreRPC}; -use drive_proof_verifier::QuorumInfoProvider; -use std::sync::Mutex; - -use crate::error::Error; - -/// Core RPC client that can be used to retrieve quorum keys from core. -/// -/// Implements [`QuorumInfoProvider`] trait. -/// -/// TODO: This is a temporary implementation, effective until we integrate SPV. -pub struct CoreClient { - core: Mutex>, -} - -impl CoreClient { - /// Create new Dash Core client. - /// - /// # Arguments - /// - /// * `server_address` - Dash Core server address. - /// * `core_port` - Dash Core port. - /// * `core_user` - Dash Core user. - /// * `core_password` - Dash Core password. - pub fn new( - server_address: &str, - core_port: u16, - core_user: &str, - core_password: &str, - ) -> Result { - let core_addr = format!("http://{}:{}", server_address, core_port); - let core = - DefaultCoreRPC::open(&core_addr, core_user.to_string(), core_password.to_string())?; - - Ok(Self { - core: Mutex::new(Box::new(core)), - }) - } -} - -impl QuorumInfoProvider for CoreClient { - fn get_quorum_public_key( - &self, - quorum_type: u32, - quorum_hash: [u8; 32], - _core_chain_locked_height: u32, - ) -> Result<[u8; 48], drive_proof_verifier::Error> { - let quorum_hash = QuorumHash::from_slice(&quorum_hash).map_err(|e| { - drive_proof_verifier::Error::InvalidQuorum { - error: e.to_string(), - } - })?; - - let core = self.core.lock().expect("Core lock poisoned"); - let quorum_info = core - .get_quorum_info(QuorumType::from(quorum_type), &quorum_hash, None) - .map_err( - |e: dashcore_rpc::Error| drive_proof_verifier::Error::InvalidQuorum { - error: e.to_string(), - }, - )?; - let key = quorum_info.quorum_public_key; - let pubkey = as TryInto<[u8; 48]>>::try_into(key).map_err(|_e| { - drive_proof_verifier::Error::InvalidQuorum { - error: "quorum public key is not 48 bytes long".to_string(), - } - })?; - Ok(pubkey) - } -} diff --git a/packages/rs-sdk/src/core/mod.rs b/packages/rs-sdk/src/core/mod.rs new file mode 100644 index 00000000000..ed7d4726cfd --- /dev/null +++ b/packages/rs-sdk/src/core/mod.rs @@ -0,0 +1,4 @@ +//! Dash Core SDK implementation. +//! +//! TODO: This is work in progress. +mod transaction; diff --git a/packages/rs-sdk/src/core/transaction.rs b/packages/rs-sdk/src/core/transaction.rs new file mode 100644 index 00000000000..a7046a2fdb6 --- /dev/null +++ b/packages/rs-sdk/src/core/transaction.rs @@ -0,0 +1,275 @@ +use crate::{Error, Sdk}; +use bip37_bloom_filter::{BloomFilter, BloomFilterData}; +use dapi_grpc::core::v0::{ + transactions_with_proofs_request, transactions_with_proofs_response, GetTransactionRequest, + GetTransactionResponse, TransactionsWithProofsRequest, TransactionsWithProofsResponse, +}; +use dapi_grpc::platform::v0::{ + get_epochs_info_request, get_epochs_info_response, GetEpochsInfoRequest, GetEpochsInfoResponse, +}; +use dpp::dashcore::consensus::Decodable; +use dpp::dashcore::{Address, InstantLock, MerkleBlock, OutPoint, Transaction, Txid}; +use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; +use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +use dpp::prelude::AssetLockProof; + +use rs_dapi_client::{DapiRequestExecutor, RequestSettings}; +use std::time::Duration; +use tokio::time::{sleep, timeout}; + +impl Sdk { + /// Starts the stream to listen for instant send lock messages + pub async fn start_instant_send_lock_stream( + &self, + from_block_hash: Vec, + address: &Address, + ) -> Result, Error> { + let address_bytes = address.as_unchecked().payload_to_vec(); + + // create the bloom filter + let bloom_filter = BloomFilter::builder(1, 0.001) + .expect("this FP rate allows up to 10000 items") + .add_element(&address_bytes) + .build(); + + let bloom_filter_proto = { + let BloomFilterData { + v_data, + n_hash_funcs, + n_tweak, + n_flags, + } = bloom_filter.into(); + dapi_grpc::core::v0::BloomFilter { + v_data, + n_hash_funcs, + n_tweak, + n_flags, + } + }; + + let core_transactions_stream = TransactionsWithProofsRequest { + bloom_filter: Some(bloom_filter_proto), + count: 0, // Subscribing to new transactions as well + send_transaction_hashes: true, + from_block: Some(transactions_with_proofs_request::FromBlock::FromBlockHash( + from_block_hash, + )), + }; + self.execute(core_transactions_stream, RequestSettings::default()) + .await + .map_err(|e| Error::DapiClientError(e.to_string())) + } + + /// Waits for a response for the asset lock proof + pub async fn wait_for_asset_lock_proof_for_transaction( + &self, + mut stream: dapi_grpc::tonic::Streaming, + transaction: &Transaction, + time_out: Option, + ) -> Result { + let transaction_id = transaction.txid(); + + let _span = tracing::debug_span!( + "wait_for_asset_lock_proof_for_transaction", + transaction_id = transaction_id.to_string(), + ) + .entered(); + + tracing::debug!("waiting for messages from stream"); + + // Define an inner async block to handle the stream processing. + let stream_processing = async { + loop { + // TODO: We should retry if Err is returned + let message = stream + .message() + .await + .map_err(|e| Error::DapiClientError(format!("can't receive message: {e}")))?; + + let Some(TransactionsWithProofsResponse { responses }) = message else { + return Err(Error::DapiClientError( + "stream closed unexpectedly".to_string(), + )); + }; + + match responses { + Some( + transactions_with_proofs_response::Responses::InstantSendLockMessages( + instant_send_lock_messages, + ), + ) => { + tracing::debug!( + "received {} instant lock message(s)", + instant_send_lock_messages.messages.len() + ); + + for instant_lock_bytes in instant_send_lock_messages.messages { + let instant_lock = + InstantLock::consensus_decode(&mut instant_lock_bytes.as_slice()) + .map_err(|e| { + tracing::error!("invalid asset lock: {}", e); + + Error::CoreError(e.into()) + })?; + + if instant_lock.txid == transaction_id { + let asset_lock_proof = + AssetLockProof::Instant(InstantAssetLockProof { + instant_lock, + transaction: transaction.clone(), + output_index: 0, + }); + + tracing::debug!( + ?asset_lock_proof, + "instant lock is matching to the broadcasted transaction, returning instant asset lock proof" + ); + + return Ok(asset_lock_proof); + } else { + tracing::debug!( + "instant lock is not matching, waiting for the next message" + ); + } + } + } + Some(transactions_with_proofs_response::Responses::RawMerkleBlock( + raw_merkle_block, + )) => { + tracing::debug!("received merkle block"); + + let merkle_block = + MerkleBlock::consensus_decode(&mut raw_merkle_block.as_slice()) + .map_err(|e| { + tracing::error!("can't decode merkle block: {}", e); + + Error::CoreError(e.into()) + })?; + + let mut matches: Vec = vec![]; + let mut index: Vec = vec![]; + + merkle_block.extract_matches(&mut matches, &mut index)?; + + // Continue receiving messages until we find the transaction + if !matches.contains(&transaction_id) { + tracing::debug!( + "merkle block doesn't contain the transaction, waiting for the next message" + ); + + continue; + } + + tracing::debug!( + "merkle block contains the transaction, obtaining core chain locked height" + ); + + // TODO: This a temporary implementation until we have headers stream running in background + // so we can always get actual height and chain locks + + // Wait until the block is chainlocked + let mut core_chain_locked_height; + loop { + let GetTransactionResponse { + height, + is_chain_locked, + .. + } = self + .execute( + GetTransactionRequest { + id: transaction_id.to_string(), + }, + RequestSettings::default(), + ) + .await?; + + core_chain_locked_height = height; + + if is_chain_locked { + break; + } + + tracing::trace!("the transaction is on height {} but not chainlocked. try again in 1 sec", height); + + sleep(Duration::from_secs(1)).await; + } + + tracing::debug!( + "the transaction is chainlocked on height {}, waiting platform for reaching the same core height", + core_chain_locked_height + ); + + // Wait until platform chain is on the block's chain locked height + loop { + let request = GetEpochsInfoRequest { + version: Some(get_epochs_info_request::Version::V0( + get_epochs_info_request::GetEpochsInfoRequestV0 { + start_epoch: Some(0), + count: 1, + ..Default::default() + }, + )), + }; + + let GetEpochsInfoResponse { + version: + Some(get_epochs_info_response::Version::V0( + get_epochs_info_response::GetEpochsInfoResponseV0 { + metadata: Some(metadata), + .. + }, + )), + } = self.execute(request, RequestSettings::default()).await? + else { + return Err(Error::DapiClientError(String::from( + "missing V0 `metadata` field", + ))); + }; + + if metadata.core_chain_locked_height >= core_chain_locked_height { + break; + } + + tracing::trace!( + "platform chain locked core height {} but we need {}. try again in 1 sec", + metadata.core_chain_locked_height, + core_chain_locked_height, + ); + + sleep(Duration::from_secs(1)).await; + } + + let asset_lock_proof = AssetLockProof::Chain(ChainAssetLockProof { + core_chain_locked_height, + out_point: OutPoint { + txid: transaction.txid(), + vout: 0, + }, + }); + + tracing::debug!( + ?asset_lock_proof, + "merkle block contains the broadcasted transaction, returning chain asset lock proof" + ); + + return Ok(asset_lock_proof); + } + Some(transactions_with_proofs_response::Responses::RawTransactions(_)) => { + tracing::trace!("received transaction(s), ignoring") + } + None => tracing::trace!( + "received empty response as a workaround for the bug in tonic, ignoring" + ), + } + } + }; + + // Apply the timeout if `time_out_ms` is Some, otherwise just await the processing. + match time_out { + Some(duration) => timeout(duration, stream_processing).await.map_err(|_| { + Error::TimeoutReached(duration, String::from("receiving asset lock proof")) + })?, + None => stream_processing.await, + } + } +} diff --git a/packages/rs-sdk/src/core_client.rs b/packages/rs-sdk/src/core_client.rs new file mode 100644 index 00000000000..e68bb6166d3 --- /dev/null +++ b/packages/rs-sdk/src/core_client.rs @@ -0,0 +1,172 @@ +//! Core RPC client used to retrieve quorum keys from core. +//! +//! TODO: This is a temporary implementation, effective until we integrate SPV +//! into dash-platform-sdk. + +use crate::error::Error; +use dashcore_rpc::{ + dashcore::{hashes::Hash, Amount, QuorumHash}, + dashcore_rpc_json as json, + json::{ProTxList, ProTxListType}, + Auth, Client, RpcApi, +}; +use dpp::dashcore::ProTxHash; +use dpp::prelude::CoreBlockHeight; +use drive_proof_verifier::error::ContextProviderError; +use std::{fmt::Debug, sync::Mutex}; + +/// Core RPC client that can be used to retrieve quorum keys from core. +/// +/// Implements [`ContextProvider`] trait. +/// +/// TODO: This is a temporary implementation, effective until we integrate SPV. +pub struct CoreClient { + core: Mutex, + server_address: String, + core_user: String, + core_port: u16, +} + +impl Debug for CoreClient { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("CoreClient") + .field("server_address", &self.server_address) + .field("core_user", &self.core_user) + .field("core_port", &self.core_port) + .finish() + } +} + +impl CoreClient { + /// Create new Dash Core client. + /// + /// # Arguments + /// + /// * `server_address` - Dash Core server address. + /// * `core_port` - Dash Core port. + /// * `core_user` - Dash Core user. + /// * `core_password` - Dash Core password. + pub fn new( + server_address: &str, + core_port: u16, + core_user: &str, + core_password: &str, + ) -> Result { + let addr = format!("http://{}:{}", server_address, core_port); + let core = Client::new( + &addr, + Auth::UserPass(core_user.to_string(), core_password.to_string()), + ) + .map_err(Error::CoreClientError)?; + + Ok(Self { + core: Mutex::new(core), + server_address: server_address.to_string(), + core_user: core_user.to_string(), + core_port, + }) + } +} + +// Wallet functions +impl CoreClient { + /// List unspent transactions + /// + /// ## Arguments + /// + /// * `minimum_sum_satoshi` - Minimum total sum of all returned unspent transactions + /// + /// ## See also + /// + /// * [Dash Core documentation](https://docs.dash.org/projects/core/en/stable/docs/api/remote-procedure-calls-wallet.html#listunspent) + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + pub fn list_unspent( + &self, + minimum_sum_satoshi: Option, + ) -> Result, Error> { + let options = json::ListUnspentQueryOptions { + minimum_sum_amount: minimum_sum_satoshi.map(Amount::from_sat), + ..Default::default() + }; + + self.core + .lock() + .expect("Core lock poisoned") + .list_unspent(None, None, None, None, Some(options)) + .map_err(Error::CoreClientError) + } + + /// Return address to which change of transaction can be sent. + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + pub fn get_balance(&self) -> Result { + self.core + .lock() + .expect("Core lock poisoned") + .get_balance(None, None) + .map_err(Error::CoreClientError) + } + + /// Retrieve quorum public key from core. + pub fn get_quorum_public_key( + &self, + quorum_type: u32, + quorum_hash: [u8; 32], + ) -> Result<[u8; 48], ContextProviderError> { + let quorum_hash = QuorumHash::from_slice(&quorum_hash) + .map_err(|e| ContextProviderError::InvalidQuorum(e.to_string()))?; + + let core = self.core.lock().expect("Core lock poisoned"); + let quorum_info = core + .get_quorum_info(json::QuorumType::from(quorum_type), &quorum_hash, None) + .map_err(|e: dashcore_rpc::Error| ContextProviderError::Generic(e.to_string()))?; + let key = quorum_info.quorum_public_key; + let pubkey = as TryInto<[u8; 48]>>::try_into(key).map_err(|_e| { + ContextProviderError::InvalidQuorum( + "quorum public key is not 48 bytes long".to_string(), + ) + })?; + Ok(pubkey) + } + + /// Retrieve platform activation height from core. + pub fn get_platform_activation_height(&self) -> Result { + let core = self.core.lock().expect("Core lock poisoned"); + + let fork_info = core + .get_blockchain_info() + .map(|blockchain_info| blockchain_info.softforks.get("mn_rr").cloned()) + .map_err(|e: dashcore_rpc::Error| ContextProviderError::Generic(e.to_string()))? + .ok_or(ContextProviderError::ActivationForkError( + "no fork info for mn_rr".to_string(), + ))?; + + fork_info + .height + .ok_or(ContextProviderError::ActivationForkError( + "unknown fork height".to_string(), + )) + } + + /// Require list of validators from Core. + /// + /// See also [Dash Core documentation](https://docs.dash.org/projects/core/en/stable/docs/api/remote-procedure-calls-evo.html#protx-list) + #[allow(unused)] + pub fn protx_list( + &self, + height: Option, + protx_type: Option, + ) -> Result, Error> { + let core = self.core.lock().expect("Core lock poisoned"); + + let pro_tx_hashes = + core.get_protx_list(protx_type, Some(false), height) + .map(|x| match x { + ProTxList::Hex(hex) => hex, + ProTxList::Info(info) => info.into_iter().map(|v| v.pro_tx_hash).collect(), + })?; + + Ok(pro_tx_hashes) + } +} diff --git a/packages/rs-sdk/src/error.rs b/packages/rs-sdk/src/error.rs index 76ce45b22f2..ce8b3f309ad 100644 --- a/packages/rs-sdk/src/error.rs +++ b/packages/rs-sdk/src/error.rs @@ -1,9 +1,14 @@ //! Definitions of errors use std::fmt::Debug; +use std::time::Duration; +use dapi_grpc::mock::Mockable; +use dpp::version::PlatformVersionError; use dpp::ProtocolError; use rs_dapi_client::DapiClientError; +pub use drive_proof_verifier::error::ContextProviderError; + /// Error type for the SDK #[derive(Debug, thiserror::Error)] pub enum Error { @@ -19,19 +24,59 @@ pub enum Error { /// Proof verification error #[error("Proof verification error: {0}")] Proof(#[from] drive_proof_verifier::Error), + /// Invalid Proved Response error + #[error("Invalid Proved Response error: {0}")] + InvalidProvedResponse(String), /// DAPI client error, for example, connection error #[error("Dapi client error: {0}")] DapiClientError(String), + #[cfg(feature = "mocks")] + /// DAPI mocks error + #[error("Dapi mocks error: {0}")] + DapiMocksError(#[from] rs_dapi_client::mock::MockError), + /// Dash core error + #[error("Dash core error: {0}")] + CoreError(#[from] dpp::dashcore::Error), + /// MerkleBlockError + #[error("Dash core error: {0}")] + MerkleBlockError(#[from] dpp::dashcore::merkle_tree::MerkleBlockError), /// Core client error, for example, connection error #[error("Core client error: {0}")] CoreClientError(#[from] dashcore_rpc::Error), /// Dependency not found, for example data contract for a document not found #[error("Required {0} not found: {1}")] MissingDependency(String, String), + /// Total credits in Platform are not found; we must always have credits in Platform + #[error("Total credits in Platform are not found; it should never happen")] + TotalCreditsNotFound, + /// Epoch not found; we must have at least one epoch + #[error("No epoch found on Platform; it should never happen")] + EpochNotFound, + /// SDK operation timeout reached error + #[error("SDK operation timeout {} secs reached: {1}", .0.as_secs())] + TimeoutReached(Duration, String), + /// Generic error + // TODO: Use domain specific errors instead of generic ones + #[error("SDK error: {0}")] + Generic(String), + + /// Context provider error + #[error("Context provider error: {0}")] + ContextProviderError(#[from] ContextProviderError), + + /// Operation cancelled - cancel token was triggered, timeout, etc. + #[error("Operation cancelled: {0}")] + Cancelled(String), } -impl From> for Error { +impl From> for Error { fn from(value: DapiClientError) -> Self { Self::DapiClientError(format!("{:?}", value)) } } + +impl From for Error { + fn from(value: PlatformVersionError) -> Self { + Self::Protocol(value.into()) + } +} diff --git a/packages/rs-sdk/src/internal_cache/mod.rs b/packages/rs-sdk/src/internal_cache/mod.rs new file mode 100644 index 00000000000..9a07ce72d91 --- /dev/null +++ b/packages/rs-sdk/src/internal_cache/mod.rs @@ -0,0 +1,44 @@ +use crate::platform::Identifier; +use crate::sdk::LastQueryTimestamp; +use dpp::prelude; +use dpp::prelude::IdentityNonce; +use std::collections::BTreeMap; +use tokio::sync::Mutex; + +/// This is a cache that is internal to the SDK that the user does not have to worry about +pub struct InternalSdkCache { + /// This is the identity nonce counter for the sdk + /// The sdk will automatically manage this counter for the user. + /// When the sdk user requests to update identities, withdraw or transfer + /// this will be automatically updated + /// This update can involve querying Platform for the current identity nonce + /// If the sdk user requests to put a state transition the counter is checked and either + /// returns an error or is updated. + pub(crate) identity_nonce_counter: + tokio::sync::Mutex>, + + /// This is the identity contract nonce counter for the sdk + /// The sdk will automatically manage this counter for the user. + /// When the sdk user requests to put documents this will be automatically updated + /// This update can involve querying Platform for the current identity contract nonce + /// If the sdk user requests to put a state transition the counter is checked and either + /// returns an error or is updated. + pub(crate) identity_contract_nonce_counter: tokio::sync::Mutex< + BTreeMap<(Identifier, Identifier), (prelude::IdentityNonce, LastQueryTimestamp)>, + >, +} + +impl Default for InternalSdkCache { + fn default() -> Self { + InternalSdkCache { + identity_nonce_counter: Mutex::new(BTreeMap::< + Identifier, + (IdentityNonce, LastQueryTimestamp), + >::new()), + identity_contract_nonce_counter: Mutex::new(BTreeMap::< + (Identifier, Identifier), + (IdentityNonce, LastQueryTimestamp), + >::new()), + } + } +} diff --git a/packages/rs-sdk/src/lib.rs b/packages/rs-sdk/src/lib.rs index f7d66d3ab47..14b65a58c2c 100644 --- a/packages/rs-sdk/src/lib.rs +++ b/packages/rs-sdk/src/lib.rs @@ -15,7 +15,7 @@ //! 2. [`Data Contract`](crate::platform::DataContract) //! 3. [`Document`](crate::platform::Document) //! -//! To define document search conditions, you can use [`DriveQuery`](crate::platform::DriveQuery) and convert it +//! To define document search conditions, you can use [`DriveQuery`](crate::platform::DriveDocumentQuery) and convert it //! to [`DocumentQuery`](crate::platform::DocumentQuery) with the [`From`] trait. //! //! Basic DPP objects are re-exported in the [`platform`] module. @@ -34,7 +34,7 @@ //! 2. [`DocumentQuery`](crate::platform::DocumentQuery) - fetches documents based on search conditions; see //! [query syntax documentation](https://docs.dash.org/projects/platform/en/stable/docs/reference/query-syntax.html) //! for more details. -//! 3. [`DriveQuery`](crate::platform::DriveQuery) - can be used to build more complex queries +//! 3. [`DriveQuery`](crate::platform::DriveDocumentQuery) - can be used to build more complex queries //! //! ## Testability //! @@ -44,7 +44,7 @@ //! //! ## Error handling //! -//! Errors of type [Error] are returned by the rs-sdk. Note that missing objects ("not found") are not +//! Errors of type [Error] are returned by the dash-platform-sdk. Note that missing objects ("not found") are not //! treated as errors; `Ok(None)` is returned instead. //! //! Mocking functions often panic instead of returning an error. @@ -57,16 +57,24 @@ //! To enable logging, you can use the `tracing_subscriber` crate which allows applications to customize how events are processed and recorded. //! An example can be found in `tests/common.rs:setup_logs()`. //! -#![warn(missing_docs)] +// TODO re-enable when docs are complete +// #![warn(missing_docs)] #![allow(rustdoc::private_intra_doc_links)] pub mod core; +#[cfg(feature = "mocks")] +mod core_client; pub mod error; +mod internal_cache; pub mod mock; pub mod platform; pub mod sdk; + pub use error::Error; -pub use sdk::{Sdk, SdkBuilder}; +pub use sdk::{RequestSettings, Sdk, SdkBuilder}; + +pub use dpp; +pub use rs_dapi_client as dapi_client; /// Version of the SDK pub const VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/packages/rs-sdk/src/mock.rs b/packages/rs-sdk/src/mock.rs index 7fb0ac974af..b3f1b69c639 100644 --- a/packages/rs-sdk/src/mock.rs +++ b/packages/rs-sdk/src/mock.rs @@ -12,25 +12,31 @@ //! ## Example //! //! ```no_run -//! let mut sdk = rs_sdk::Sdk::new_mock(); -//! let query = rs_sdk::platform::Identifier::random(); -//! sdk.mock().expect_fetch(query, None as Option); +//! let mut sdk = dash_sdk::Sdk::new_mock(); +//! let query = dash_sdk::platform::Identifier::random(); +//! sdk.mock().expect_fetch(query, None as Option); //! ``` //! //! See tests/mock_*.rs for more detailed examples. +#[cfg(not(feature = "mocks"))] +mod noop; +#[cfg(feature = "mocks")] +pub mod provider; #[cfg(feature = "mocks")] mod requests; #[cfg(feature = "mocks")] pub mod sdk; -#[cfg(not(feature = "mocks"))] -mod noop; +// Mockable reexport is needed even if mocks feature is disabled - it just does nothing. +// Otherwise dapi_grpc_macros::Mockable fails. +// TODO: move Mockable to some crate that can be shared between dapi-grpc, rs-dapi-client, and dash-sdk +pub use dapi_grpc::mock::Mockable; +// MockResponse is needed even if mocks feature is disabled - it just does nothing. +#[cfg(not(feature = "mocks"))] +pub use noop::MockResponse; #[cfg(feature = "mocks")] -pub use requests::*; +pub use requests::MockResponse; #[cfg(feature = "mocks")] pub use sdk::MockDashPlatformSdk; - -#[cfg(not(feature = "mocks"))] -pub use noop::*; diff --git a/packages/rs-sdk/src/mock/noop.rs b/packages/rs-sdk/src/mock/noop.rs index 2c0d878152d..f99054c762a 100644 --- a/packages/rs-sdk/src/mock/noop.rs +++ b/packages/rs-sdk/src/mock/noop.rs @@ -1,7 +1,3 @@ -/// Noop mock request trait; used only when `mocks` feature is disabled. -pub trait MockRequest {} -impl MockRequest for T {} - /// Noop mock response trait; used only when `mocks` feature is disabled. pub trait MockResponse {} impl MockResponse for T {} diff --git a/packages/rs-sdk/src/mock/provider.rs b/packages/rs-sdk/src/mock/provider.rs new file mode 100644 index 00000000000..8c0297bf475 --- /dev/null +++ b/packages/rs-sdk/src/mock/provider.rs @@ -0,0 +1,250 @@ +//! Example ContextProvider that uses the Core gRPC API to fetch data from Platform. + +use crate::core_client::CoreClient; +use crate::platform::Fetch; +use crate::{Error, Sdk}; +use arc_swap::ArcSwapAny; +use dpp::prelude::{CoreBlockHeight, DataContract, Identifier}; +use drive_proof_verifier::error::ContextProviderError; +use drive_proof_verifier::ContextProvider; +use pollster::FutureExt; +use std::hash::Hash; +use std::num::NonZeroUsize; +use std::sync::Arc; + +/// Context provider that uses the Core gRPC API to fetch data from Platform. +/// +/// Example [ContextProvider] used by the Sdk for testing purposes. +pub struct GrpcContextProvider { + /// Core client + core: CoreClient, + /// [Sdk] to use when fetching data from Platform + /// + /// Note that if the `sdk` is `None`, the context provider will not be able to fetch data itself and will rely on + /// values set by the user in the caches: `data_contracts_cache`, `quorum_public_keys_cache`. + /// + /// We use [Arc] as we have circular dependencies between Sdk and ContextProvider. + sdk: ArcSwapAny>>, + + /// Data contracts cache. + /// + /// Users can insert new data contracts into the cache using [`Cache::put`]. + pub data_contracts_cache: Cache, + + /// Quorum public keys cache. + /// + /// Key is a tuple of quorum hash and quorum type. Value is a quorum public key. + /// + /// Users can insert new quorum public keys into the cache using [`Cache::put`]. + pub quorum_public_keys_cache: Cache<([u8; 32], u32), [u8; 48]>, + + /// Directory where to store dumped data. + /// + /// This is used to store data that is fetched from Platform and can be used for testing purposes. + #[cfg(feature = "mocks")] + pub dump_dir: Option, +} + +impl GrpcContextProvider { + /// Create new context provider. + /// + /// Note that if the `sdk` is `None`, the context provider will not be able to fetch data itself and will rely on + /// values set by the user in the caches: `data_contracts_cache`, `quorum_public_keys_cache`. + /// + /// Sdk can be set later with [`GrpcContextProvider::set_sdk`]. + pub fn new( + sdk: Option, + core_ip: &str, + core_port: u16, + core_user: &str, + core_password: &str, + + data_contracts_cache_size: NonZeroUsize, + quorum_public_keys_cache_size: NonZeroUsize, + ) -> Result { + let core_client = CoreClient::new(core_ip, core_port, core_user, core_password)?; + Ok(Self { + core: core_client, + sdk: ArcSwapAny::new(Arc::new(sdk)), + data_contracts_cache: Cache::new(data_contracts_cache_size), + quorum_public_keys_cache: Cache::new(quorum_public_keys_cache_size), + #[cfg(feature = "mocks")] + dump_dir: None, + }) + } + + /// Set the Sdk to use when fetching data from Platform. + /// This is useful when the Sdk is created after the ContextProvider. + /// + /// Note that if the `sdk` is `None`, the context provider will not be able to fetch data itself and will rely on + /// values set by the user in the caches: `data_contracts_cache`, `quorum_public_keys_cache`. + pub fn set_sdk(&self, sdk: Option) { + self.sdk.store(Arc::new(sdk)); + } + /// Set the directory where to store dumped data. + /// + /// When set, the context provider will store data fetched from Platform into this directory. + #[cfg(feature = "mocks")] + pub fn set_dump_dir(&mut self, dump_dir: Option) { + self.dump_dir = dump_dir; + } + + /// Save quorum public key to disk. + /// + /// Files are named: `quorum_pubkey--.json` + /// + /// Note that this will overwrite files with the same quorum type and quorum hash. + /// + /// Any errors are logged on `warn` level and ignored. + #[cfg(feature = "mocks")] + fn dump_quorum_public_key( + &self, + quorum_type: u32, + quorum_hash: [u8; 32], + _core_chain_locked_height: u32, + public_key: &[u8], + ) { + use hex::ToHex; + + let path = match &self.dump_dir { + Some(p) => p, + None => return, + }; + + let encoded = hex::encode(public_key); + + let file = path.join(format!( + "quorum_pubkey-{}-{}.json", + quorum_type, + quorum_hash.encode_hex::() + )); + + if let Err(e) = std::fs::write(file, encoded) { + tracing::warn!("Unable to write dump file {:?}: {}", path, e); + } + } + + /// Save data contract to disk. + /// + /// Files are named: `quorum_pubkey--.json` + /// + /// Note that this will overwrite files with the same quorum type and quorum hash. + /// + /// Any errors are logged on `warn` level and ignored. + #[cfg(feature = "mocks")] + fn dump_data_contract(&self, data_contract: &DataContract) { + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use hex::ToHex; + + let path = match &self.dump_dir { + Some(p) => p, + None => return, + }; + let id = data_contract.id(); + + let file = path.join(format!("data_contract-{}.json", id.encode_hex::())); + + let encoded = serde_json::to_vec(data_contract).expect("serialize data contract"); + if let Err(e) = std::fs::write(file, encoded) { + tracing::warn!("Unable to write dump file {:?}: {}", path, e); + } + } +} + +impl ContextProvider for GrpcContextProvider { + fn get_quorum_public_key( + &self, + quorum_type: u32, + quorum_hash: [u8; 32], // quorum hash is 32 bytes + core_chain_locked_height: u32, + ) -> Result<[u8; 48], ContextProviderError> { + if let Some(key) = self + .quorum_public_keys_cache + .get(&(quorum_hash, quorum_type)) + { + return Ok(*key); + }; + + let key = self.core.get_quorum_public_key(quorum_type, quorum_hash)?; + + self.quorum_public_keys_cache + .put((quorum_hash, quorum_type), key); + + #[cfg(feature = "mocks")] + self.dump_quorum_public_key(quorum_type, quorum_hash, core_chain_locked_height, &key); + + Ok(key) + } + + fn get_data_contract( + &self, + data_contract_id: &Identifier, + ) -> Result>, ContextProviderError> { + if let Some(contract) = self.data_contracts_cache.get(data_contract_id) { + return Ok(Some(contract)); + }; + let sdk_guard = self.sdk.load(); + + let sdk = match sdk_guard.as_ref() { + Some(sdk) => sdk, + None => { + tracing::warn!("data contract cache miss and no sdk provided, skipping fetch"); + return Ok(None); + } + }; + + let contract_id = *data_contract_id; + + let sdk_cloned = sdk.clone(); + + let data_contract: Option = DataContract::fetch(&sdk_cloned, contract_id) + .block_on() + .map_err(|e| ContextProviderError::DataContractFailure(e.to_string()))?; + + if let Some(ref dc) = data_contract { + self.data_contracts_cache.put(*data_contract_id, dc.clone()); + }; + + #[cfg(feature = "mocks")] + if let Some(ref dc) = data_contract { + self.dump_data_contract(dc); + } + + Ok(data_contract.map(Arc::new)) + } + + fn get_platform_activation_height(&self) -> Result { + self.core.get_platform_activation_height() + } +} + +/// Thread-safe cache of various objects inside the SDK. +/// +/// This is used to cache objects that are expensive to fetch from Platform, like data contracts. +pub struct Cache { + // We use a Mutex to allow access to the cache when we don't have mutable &self + // And we use Arc to allow multiple threads to access the cache without having to clone it + inner: std::sync::RwLock>>, +} + +impl Cache { + /// Create new cache + pub fn new(capacity: NonZeroUsize) -> Self { + Self { + // inner: std::sync::Mutex::new(lru::LruCache::new(capacity)), + inner: std::sync::RwLock::new(lru::LruCache::new(capacity)), + } + } + + /// Get a reference to the value stored under `k`. + pub fn get(&self, k: &K) -> Option> { + let mut guard = self.inner.write().expect("cache lock poisoned"); + guard.get(k).map(Arc::clone) + } + + /// Insert a new value into the cache. + pub fn put(&self, k: K, v: V) { + let mut guard = self.inner.write().expect("cache lock poisoned"); + guard.put(k, Arc::new(v)); + } +} diff --git a/packages/rs-sdk/src/mock/requests.rs b/packages/rs-sdk/src/mock/requests.rs index ffc816aea65..6cb4dde30de 100644 --- a/packages/rs-sdk/src/mock/requests.rs +++ b/packages/rs-sdk/src/mock/requests.rs @@ -1,40 +1,27 @@ -use std::collections::BTreeMap; - +use super::MockDashPlatformSdk; use dpp::{ + bincode, block::extended_epoch_info::ExtendedEpochInfo, - document::serialization_traits::DocumentCborMethodsV0, - document::Document, - platform_serialization::{ - platform_encode_to_vec, platform_versioned_decode_from_slice, PlatformVersionEncode, - PlatformVersionedDecode, - }, + dashcore::{hashes::Hash, ProTxHash}, + document::{serialization_traits::DocumentCborMethodsV0, Document}, + identifier::Identifier, + identity::IdentityPublicKey, + platform_serialization::{platform_encode_to_vec, platform_versioned_decode_from_slice}, prelude::{DataContract, Identity}, serialization::{ PlatformDeserializableWithPotentialValidationFromVersionedStructure, PlatformSerializableWithPlatformVersion, }, + voting::votes::{resource_vote::ResourceVote, Vote}, }; +use drive_proof_verifier::types::{ + Contenders, ContestedResources, ElementFetchRequestItem, IdentityBalanceAndRevision, + MasternodeProtocolVote, PrefundedSpecializedBalance, TotalCreditsInPlatform, + VotePollsGroupedByTimestamp, Voters, +}; +use std::collections::BTreeMap; -use rs_dapi_client::mock::Key; -use serde::{Deserialize, Serialize}; - -use super::MockDashPlatformSdk; - -/// Trait implemented by objects that can be used as requests in mock expectations. -pub trait MockRequest { - /// Format the object as a key that will be used to match the request with the expectation. - /// - /// ## Panics - /// - /// Can panic on errors. - fn mock_key(&self) -> Key; -} - -impl MockRequest for T { - fn mock_key(&self) -> Key { - Key::new(self) - } -} +static BINCODE_CONFIG: bincode::config::Configuration = bincode::config::standard(); /// Trait implemented by objects that can be used in mock expectation responses. /// @@ -83,7 +70,7 @@ impl MockResponse for Vec { where Self: Sized, { - let items: Vec> = bincode::decode_from_slice(buf, bincode::config::standard()) + let items: Vec> = bincode::decode_from_slice(buf, BINCODE_CONFIG) .expect("decode vec of data") .0; items @@ -98,44 +85,54 @@ impl MockResponse for Vec { .map(|item| item.mock_serialize(mock_sdk)) .collect(); - bincode::encode_to_vec(data, bincode::config::standard()).expect("encode vec of data") + bincode::encode_to_vec(data, BINCODE_CONFIG).expect("encode vec of data") } } -impl Deserialize<'de>, V: Serialize + for<'de> Deserialize<'de>> - MockResponse for BTreeMap -{ - fn mock_deserialize(_sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self + +impl MockResponse for BTreeMap { + fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self where Self: Sized, { - serde_json::from_slice(buf).expect("decode vec of data") - } + let (data, _): (BTreeMap, Vec>, _) = + bincode::decode_from_slice(buf, BINCODE_CONFIG).expect("decode BTreeMap"); - fn mock_serialize(&self, _sdk: &MockDashPlatformSdk) -> Vec { - serde_json::to_vec(self).expect("encode vec of data") + data.into_iter() + .map(|(k, v)| (K::mock_deserialize(sdk, &k), V::mock_deserialize(sdk, &v))) + .collect() } -} -impl MockResponse for Identity -where - Self: PlatformVersionedDecode + PlatformVersionEncode, -{ fn mock_serialize(&self, sdk: &MockDashPlatformSdk) -> Vec { - // self.clone().serialize_to_bytes().expect("serialize data") - platform_encode_to_vec(self, bincode::config::standard(), sdk.version()) - .expect("serialize data") - } + let data: BTreeMap, Vec> = self + .iter() + .map(|(k, v)| (k.mock_serialize(sdk), v.mock_serialize(sdk))) + .collect(); - fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self - where - Self: Sized + PlatformVersionedDecode, - { - // Self::deserialize_from_bytes(buf).expect("deserialize data") - platform_versioned_decode_from_slice(buf, bincode::config::standard(), sdk.version()) - .expect("deserialize data") + bincode::encode_to_vec(data, BINCODE_CONFIG).expect("encode BTreeMap") } } +/// Serialize and deserialize the object for mocking using bincode. +/// +/// Use this macro when the object implements platform serialization. +macro_rules! impl_mock_response { + ($name:ident) => { + impl MockResponse for $name { + fn mock_serialize(&self, sdk: &MockDashPlatformSdk) -> Vec { + platform_encode_to_vec(self, BINCODE_CONFIG, sdk.version()) + .expect(concat!("encode ", stringify!($name))) + } + fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self + where + Self: Sized, + { + platform_versioned_decode_from_slice(buf, BINCODE_CONFIG, sdk.version()) + .expect(concat!("decode ", stringify!($name))) + } + } + }; +} + // FIXME: Seems that DataContract doesn't implement PlatformVersionedDecode + PlatformVersionEncode, // so we just use some methods implemented directly on these objects. impl MockResponse for DataContract { @@ -167,45 +164,68 @@ impl MockResponse for Document { } } -impl MockResponse for drive_proof_verifier::types::IdentityBalance { +impl MockResponse for drive_proof_verifier::types::IdentityNonceFetcher { fn mock_serialize(&self, _sdk: &MockDashPlatformSdk) -> Vec { - (*self).to_le_bytes().to_vec() + (self.0).to_be_bytes().to_vec() } fn mock_deserialize(_sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self where Self: Sized, { - Self::from_le_bytes(buf.try_into().expect("balance should be 8 bytes")) + drive_proof_verifier::types::IdentityNonceFetcher(u64::from_be_bytes( + buf.try_into() + .expect("identity contract nonce should be should be 8 bytes"), + )) } } -impl MockResponse for drive_proof_verifier::types::IdentityBalanceAndRevision { +impl MockResponse for drive_proof_verifier::types::IdentityContractNonceFetcher { fn mock_serialize(&self, _sdk: &MockDashPlatformSdk) -> Vec { - bincode::encode_to_vec(self, bincode::config::standard()) - .expect("encode IdentityBalanceAndRevision") + (self.0).to_be_bytes().to_vec() } fn mock_deserialize(_sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self where Self: Sized, { - let (item, _len) = bincode::decode_from_slice(buf, bincode::config::standard()) - .expect("decode IdentityBalanceAndRevision"); - item + drive_proof_verifier::types::IdentityContractNonceFetcher(u64::from_be_bytes( + buf.try_into() + .expect("identity contract nonce should be should be 8 bytes"), + )) } } - -impl MockResponse for ExtendedEpochInfo { +impl MockResponse for ProTxHash { fn mock_serialize(&self, sdk: &MockDashPlatformSdk) -> Vec { - platform_encode_to_vec(self, bincode::config::standard(), sdk.version()) - .expect("encode ExtendedEpochInfo") + let data = self.as_raw_hash().as_byte_array(); + platform_encode_to_vec(data, BINCODE_CONFIG, sdk.version()).expect("encode ProTxHash") } fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self where Self: Sized, { - platform_versioned_decode_from_slice(buf, bincode::config::standard(), sdk.version()) - .expect("decode ExtendedEpochInfo") + let data = platform_versioned_decode_from_slice(buf, BINCODE_CONFIG, sdk.version()) + .expect("decode ProTxHash"); + ProTxHash::from_raw_hash(Hash::from_byte_array(data)) } } + +impl_mock_response!(Identity); +impl_mock_response!(IdentityPublicKey); +impl_mock_response!(Identifier); +impl_mock_response!(MasternodeProtocolVote); +impl_mock_response!(ResourceVote); +impl_mock_response!(u8); +impl_mock_response!(u16); +impl_mock_response!(u32); +impl_mock_response!(u64); +impl_mock_response!(Vote); +impl_mock_response!(ExtendedEpochInfo); +impl_mock_response!(ContestedResources); +impl_mock_response!(IdentityBalanceAndRevision); +impl_mock_response!(Contenders); +impl_mock_response!(Voters); +impl_mock_response!(VotePollsGroupedByTimestamp); +impl_mock_response!(PrefundedSpecializedBalance); +impl_mock_response!(TotalCreditsInPlatform); +impl_mock_response!(ElementFetchRequestItem); diff --git a/packages/rs-sdk/src/mock/sdk.rs b/packages/rs-sdk/src/mock/sdk.rs index 81760166b17..0f37c7dd364 100644 --- a/packages/rs-sdk/src/mock/sdk.rs +++ b/packages/rs-sdk/src/mock/sdk.rs @@ -1,24 +1,29 @@ //! Mocking mechanisms for Dash Platform SDK. //! //! See [MockDashPlatformSdk] for more details. -use dapi_grpc::platform::v0::{self as proto}; +use crate::{ + platform::{types::identity::IdentityRequest, DocumentQuery, Fetch, FetchMany, Query}, + Error, Sdk, +}; +use arc_swap::ArcSwapOption; +use dapi_grpc::platform::v0::{Proof, ResponseMetadata}; +use dapi_grpc::{ + mock::Mockable, + platform::v0::{self as proto}, +}; +use dpp::dashcore::Network; use dpp::version::PlatformVersion; -use drive_proof_verifier::{FromProof, MockQuorumInfoProvider}; +use drive_proof_verifier::{error::ContextProviderError, ContextProvider, FromProof}; +use rs_dapi_client::mock::MockError; use rs_dapi_client::{ mock::{Key, MockDapiClient}, transport::TransportRequest, DapiClient, DumpData, }; -use serde::Deserialize; use std::{collections::BTreeMap, path::PathBuf, sync::Arc}; use tokio::sync::Mutex; -use crate::{ - platform::{types::identity::IdentityRequest, DocumentQuery, Fetch, FetchMany, Query}, - Error, -}; - -use super::{MockRequest, MockResponse}; +use super::MockResponse; /// Mechanisms to mock Dash Platform SDK. /// @@ -30,46 +35,55 @@ use super::{MockRequest, MockResponse}; /// ## Panics /// /// Can panic on errors. +#[derive(Debug)] pub struct MockDashPlatformSdk { from_proof_expectations: BTreeMap>, platform_version: &'static PlatformVersion, dapi: Arc>, - prove: bool, - quorum_provider: Option, + sdk: ArcSwapOption, } impl MockDashPlatformSdk { - pub(crate) fn new( - version: &'static PlatformVersion, - dapi: Arc>, - prove: bool, - ) -> Self { + /// Returns true when requests should use proofs. + /// + /// ## Panics + /// + /// Panics when sdk is not set during initialization. + pub fn prove(&self) -> bool { + if let Some(sdk) = self.sdk.load().as_ref() { + sdk.prove() + } else { + panic!("sdk must be set when creating mock ") + } + } + + /// Create new mock SDK. + /// + /// ## Note + /// + /// You have to call [MockDashPlatformSdk::with_sdk()] to set sdk, otherwise Mock SDK will panic. + pub(crate) fn new(version: &'static PlatformVersion, dapi: Arc>) -> Self { Self { from_proof_expectations: Default::default(), platform_version: version, dapi, - prove, - quorum_provider: None, + sdk: ArcSwapOption::new(None), } } - pub(crate) fn version<'v>(&self) -> &'v PlatformVersion { - self.platform_version + pub(crate) fn set_sdk(&mut self, sdk: Sdk) { + self.sdk.store(Some(Arc::new(sdk))); } - /// Define a directory where files containing quorum information, like quorum public keys, are stored. - /// - /// This directory will be used to load quorum information from files. - /// You can use [SdkBuilder::with_dump_dir()](crate::SdkBuilder::with_dump_dir()) to generate these files. - pub fn quorum_info_dir>(&mut self, dir: P) -> &mut Self { - let mut provider = MockQuorumInfoProvider::new(); - provider.quorum_keys_dir(Some(dir.as_ref().to_path_buf())); - self.quorum_provider = Some(provider); - self + pub(crate) fn version<'v>(&self) -> &'v PlatformVersion { + self.platform_version } /// Load all expectations from files in a directory. /// + /// + /// By default, mock expectations are loaded when Sdk is built with [SdkBuilder::build()](crate::SdkBuilder::build()). + /// This function can be used to load expectations after the Sdk is created, or use alternative location. /// Expectation files must be prefixed with [DapiClient::DUMP_FILE_PREFIX] and /// have `.json` extension. pub async fn load_expectations>( @@ -99,7 +113,7 @@ impl MockDashPlatformSdk { for filename in &files { let basename = filename.file_name().unwrap().to_str().unwrap(); - let request_type = basename.split('_').nth(2).unwrap_or_default(); + let request_type = basename.split('_').nth(1).unwrap_or_default(); match request_type { "DocumentQuery" => self.load_expectation::(filename).await?, @@ -115,6 +129,10 @@ impl MockDashPlatformSdk { self.load_expectation::(filename) .await? } + "GetDataContractHistoryRequest" => { + self.load_expectation::(filename) + .await? + } "IdentityRequest" => self.load_expectation::(filename).await?, "GetIdentityRequest" => { self.load_expectation::(filename) @@ -125,6 +143,10 @@ impl MockDashPlatformSdk { self.load_expectation::(filename) .await? } + "GetIdentityContractNonceRequest" => { + self.load_expectation::(filename) + .await? + } "GetIdentityBalanceAndRevisionRequest" => { self.load_expectation::(filename) .await? @@ -143,6 +165,42 @@ impl MockDashPlatformSdk { ) .await? } + "GetContestedResourcesRequest" => { + self.load_expectation::(filename) + .await? + } + "GetContestedResourceVoteStateRequest" => { + self.load_expectation::(filename) + .await? + } + "GetContestedResourceVotersForIdentityRequest" => { + self.load_expectation::( + filename, + ) + .await? + } + "GetContestedResourceIdentityVotesRequest" => { + self.load_expectation::( + filename, + ) + .await? + } + "GetVotePollsByEndDateRequest" => { + self.load_expectation::(filename) + .await? + } + "GetPrefundedSpecializedBalanceRequest" => { + self.load_expectation::(filename) + .await? + } + "GetPathElementsRequest" => { + self.load_expectation::(filename) + .await? + } + "GetTotalCreditsInPlatformRequest" => { + self.load_expectation::(filename) + .await? + } _ => { return Err(Error::Config(format!( "unknown request type {} in {}", @@ -156,19 +214,18 @@ impl MockDashPlatformSdk { Ok(self) } - async fn load_expectation Deserialize<'de> + MockRequest>( - &mut self, - path: &PathBuf, - ) -> Result<(), Error> { - let data = DumpData::::load(path).map_err(|e| { - Error::Config(format!( - "cannot load mock expectations from {}: {}", - path.display(), - e - )) - })?; + async fn load_expectation(&mut self, path: &PathBuf) -> Result<(), Error> { + let data = DumpData::::load(path) + .map_err(|e| { + Error::Config(format!( + "cannot load mock expectations from {}: {}", + path.display(), + e + )) + })? + .deserialize(); - self.dapi.lock().await.expect(&data.request, &data.response); + self.dapi.lock().await.expect(&data.0, &data.1)?; Ok(()) } @@ -179,17 +236,17 @@ impl MockDashPlatformSdk { /// ## Generic Parameters /// /// - `O`: Type of the object that will be returned in response to the query. Must implement [Fetch] and [MockResponse]. - /// - `Q`: Type of the query that will be sent to the platform. Must implement [Query] and [MockRequest]. + /// - `Q`: Type of the query that will be sent to Platform. Must implement [Query] and [Mockable]. /// /// ## Arguments /// - /// - `query`: Query that will be sent to the platform. + /// - `query`: Query that will be sent to Platform. /// - `object`: Object that will be returned in response to `query`, or None if the object is expected to not exist. /// /// ## Returns /// - /// * Some(O): If the object is expected to exist. - /// * None: If the object is expected to not exist. + /// * Reference to self on success, to allow chaining + /// * Error when expectation cannot be set or is already defined for this request /// /// ## Panics /// @@ -201,7 +258,7 @@ impl MockDashPlatformSdk { /// # let r = tokio::runtime::Runtime::new().unwrap(); /// # /// # r.block_on(async { - /// use rs_sdk::{Sdk, platform::{Identity, Fetch, dpp::identity::accessors::IdentityGettersV0}}; + /// use dash_sdk::{Sdk, platform::{Identity, Fetch, dpp::identity::accessors::IdentityGettersV0}}; /// /// let mut api = Sdk::new_mock(); /// // Define expected response @@ -210,10 +267,10 @@ impl MockDashPlatformSdk { /// // Define query that will be sent /// let query = expected.id(); /// // Expect that in response to `query`, `expected` will be returned - /// api.mock().expect_fetch(query, Some(expected.clone())).await; + /// api.mock().expect_fetch(query, Some(expected.clone())).await.unwrap(); /// /// // Fetch the identity - /// let retrieved = dpp::prelude::Identity::fetch(&mut api, query) + /// let retrieved = dpp::prelude::Identity::fetch(&api, query) /// .await /// .unwrap() /// .expect("object should exist"); @@ -222,22 +279,18 @@ impl MockDashPlatformSdk { /// assert_eq!(retrieved, expected); /// # }); /// ``` - pub async fn expect_fetch< - O: Fetch + MockResponse, - Q: Query<::Request> + MockRequest, - >( + pub async fn expect_fetch::Request>>( &mut self, query: Q, object: Option, - ) -> &mut Self + ) -> Result<&mut Self, Error> where - ::Request: MockRequest, <::Request as TransportRequest>::Response: Default, { - let grpc_request = query.query(self.prove).expect("query must be correct"); - self.expect(grpc_request, object).await; + let grpc_request = query.query(self.prove()).expect("query must be correct"); + self.expect(grpc_request, object).await?; - self + Ok(self) } /// Expect a [FetchMany] request and return provided object. @@ -248,17 +301,17 @@ impl MockDashPlatformSdk { /// /// - `O`: Type of the object that will be returned in response to the query. /// Must implement [FetchMany]. `Vec` must implement [MockResponse]. - /// - `Q`: Type of the query that will be sent to the platform. Must implement [Query] and [MockRequest]. + /// - `Q`: Type of the query that will be sent to Platform. Must implement [Query] and [Mockable]. /// /// ## Arguments /// - /// - `query`: Query that will be sent to the platform. + /// - `query`: Query that will be sent to Platform. /// - `objects`: Vector of objects that will be returned in response to `query`, or None if no objects are expected. /// /// ## Returns /// - /// * `Some(Vec)`: If the objects are expected to exist. - /// * `None`: If the objects are expected to not exist. + /// * Reference to self on success, to allow chaining + /// * Error when expectation cannot be set or is already defined for this request /// /// ## Panics /// @@ -271,38 +324,50 @@ impl MockDashPlatformSdk { /// object must be a vector of objects. pub async fn expect_fetch_many< K: Ord, - O: FetchMany, - Q: Query<>::Request> + MockRequest, + O: FetchMany, + Q: Query<>::Request>, + R: FromIterator<(K, Option)> + MockResponse + Send + Default, >( &mut self, query: Q, - objects: Option>>, - ) -> &mut Self + objects: Option, + ) -> Result<&mut Self, Error> where - BTreeMap>: MockResponse, - >::Request: MockRequest, - <>::Request as TransportRequest>::Response: Default, - BTreeMap>: FromProof< - >::Request, - Request = >::Request, - Response = <>::Request as TransportRequest>::Response, + R: MockResponse, + <>::Request as TransportRequest>::Response: Default, + R: FromProof< + >::Request, + Request = >::Request, + Response = <>::Request as TransportRequest>::Response, > + Sync, { - let grpc_request = query.query(self.prove).expect("query must be correct"); - self.expect(grpc_request, objects).await; + let grpc_request = query.query(self.prove()).expect("query must be correct"); + self.expect(grpc_request, objects).await?; - self + Ok(self) } /// Save expectations for a request. - async fn expect( + async fn expect( &mut self, grpc_request: I, returned_object: Option, - ) where + ) -> Result<(), Error> + where I::Response: Default, { - let key = grpc_request.mock_key(); + let key = Key::new(&grpc_request); + + // detect duplicates + if self.from_proof_expectations.contains_key(&key) { + return Err(MockError::MockExpectationConflict(format!( + "proof expectation key {} already defined for {} request: {:?}", + key, + std::any::type_name::(), + grpc_request + )) + .into()); + } // This expectation will work for from_proof self.from_proof_expectations @@ -310,32 +375,55 @@ impl MockDashPlatformSdk { // This expectation will work for execute let mut dapi_guard = self.dapi.lock().await; - // We don't really care about the response, as it will be mocked by from_proof - dapi_guard.expect(&grpc_request, &Default::default()); + // We don't really care about the response, as it will be mocked by from_proof, so we provide default() + dapi_guard.expect(&grpc_request, &Ok(Default::default()))?; + + Ok(()) } /// Wrapper around [FromProof] that uses mock expectations instead of executing [FromProof] trait. - pub(crate) fn parse_proof>( + pub(crate) fn parse_proof_with_metadata>( &self, request: O::Request, response: O::Response, - ) -> Result, drive_proof_verifier::Error> + ) -> Result<(Option, ResponseMetadata, Proof), drive_proof_verifier::Error> where - O::Request: MockRequest, + O::Request: Mockable, Option: MockResponse, // O: FromProof<>::Request>, { - let data = match self.from_proof_expectations.get(&request.mock_key()) { - Some(d) => Option::::mock_deserialize(self, d), + let key = Key::new(&request); + + let data = match self.from_proof_expectations.get(&key) { + Some(d) => ( + Option::::mock_deserialize(self, d), + ResponseMetadata::default(), + Proof::default(), + ), None => { - let provider = self.quorum_provider.as_ref() - .ok_or(drive_proof_verifier::Error::InvalidQuorum{ - error:"expectation not found and quorum info provider not initialized with sdk.mock().quorum_info_dir()".to_string() - })?; - O::maybe_from_proof(request, response, self.version(), provider)? + let version = self.version(); + let provider = self.context_provider() + .ok_or(ContextProviderError::InvalidQuorum( + "expectation not found and quorum info provider not initialized with sdk.mock().quorum_info_dir()".to_string() + ))?; + O::maybe_from_proof_with_metadata( + request, + response, + Network::Regtest, + version, + &provider, + )? } }; Ok(data) } + /// Return context provider implementation defined for upstreeam Sdk object. + fn context_provider(&self) -> Option { + if let Some(sdk) = self.sdk.load_full() { + sdk.clone().context_provider() + } else { + None + } + } } diff --git a/packages/rs-sdk/src/platform.rs b/packages/rs-sdk/src/platform.rs index 34609ffdff2..47662016205 100644 --- a/packages/rs-sdk/src/platform.rs +++ b/packages/rs-sdk/src/platform.rs @@ -1,31 +1,35 @@ //! Platform DAPI requests. -// TODO: rs-sdk should define a proper user-facing API hiding transport and serialization +// TODO: dash-platform-sdk should define a proper user-facing API hiding transport and serialization // details, however we don't have any data model yet, so for now it will re-export proto -// generated types. Later these re-exports could be swapped with actual rs-sdk's requests +// generated types. Later these re-exports could be swapped with actual dash-platform-sdk's requests // and while it will change the substance, the API structure will remain the same. +pub mod block_info_from_metadata; mod delegate; mod document_query; mod fetch; +pub mod fetch_current_no_parameters; mod fetch_many; +mod identities_contract_keys_query; mod query; +pub mod transition; pub mod types; pub use dapi_grpc::platform::v0::{self as proto}; -pub use drive::{ - dpp::{ - self as dpp, - document::Document, - prelude::{DataContract, Identifier, Identity, IdentityPublicKey, Revision}, - }, - query::DriveQuery, +pub use dpp::{ + self as dpp, + document::Document, + prelude::{DataContract, Identifier, Identity, IdentityPublicKey, Revision}, }; +pub use drive::query::DriveDocumentQuery; +pub use drive_proof_verifier::ContextProvider; +#[cfg(feature = "mocks")] +pub use drive_proof_verifier::MockContextProvider; +pub use rs_dapi_client as dapi; pub use { document_query::DocumentQuery, fetch::Fetch, fetch_many::FetchMany, - query::{LimitQuery, Query, DEFAULT_EPOCH_QUERY_LIMIT}, + query::{LimitQuery, Query, QueryStartInfo, DEFAULT_EPOCH_QUERY_LIMIT}, }; - -pub use rs_dapi_client as dapi; diff --git a/packages/rs-sdk/src/platform/block_info_from_metadata.rs b/packages/rs-sdk/src/platform/block_info_from_metadata.rs new file mode 100644 index 00000000000..713e1e176d4 --- /dev/null +++ b/packages/rs-sdk/src/platform/block_info_from_metadata.rs @@ -0,0 +1,47 @@ +use crate::Error; +use dapi_grpc::platform::v0::ResponseMetadata; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::MAX_EPOCH; +use drive::error::proof::ProofError; + +/// Constructs a `BlockInfo` structure from the provided response metadata. This function +/// translates metadata received from a platform response into a format that is specific to the +/// application's needs, particularly focusing on block-related information. It ensures that +/// the epoch value from the metadata does not exceed the maximum allowed for a 16-bit integer, +/// as this is a constraint for the `BlockInfo` structure. +/// +/// # Parameters +/// - `response_metadata`: A reference to `ResponseMetadata` obtained from a platform response. +/// This metadata includes various block-related information such as time in milliseconds, +/// height, core chain locked height, and epoch. +/// +/// # Returns +/// If successful, returns `Ok(BlockInfo)` where `BlockInfo` contains: +/// - `time_ms`: The timestamp of the block in milliseconds. +/// - `height`: The height of the block. +/// - `core_height`: The core chain locked height, indicating the height of the block in the core blockchain that is considered final and securely linked to this block. +/// - `epoch`: The epoch number, converted to a 16-bit integer. +/// +/// # Errors +/// Returns an error if: +/// - The `epoch` value in the response metadata exceeds the maximum value that can be represented by a 16-bit integer. This is considered a data validity error as it indicates Platform returned an unexpectedly high epoch number. +/// +/// The function encapsulates errors into the application's own `Error` type, providing a unified interface for error handling across the application. +pub fn block_info_from_metadata(response_metadata: &ResponseMetadata) -> Result { + if response_metadata.epoch > MAX_EPOCH as u32 { + return Err( + drive::error::Error::Proof(ProofError::InvalidMetadata(format!( + "platform returned an epoch {} that was higher that maximum of a 16 bit integer", + response_metadata.epoch + ))) + .into(), + ); + } + + Ok(BlockInfo { + time_ms: response_metadata.time_ms, + height: response_metadata.height, + core_height: response_metadata.core_chain_locked_height, + epoch: (response_metadata.epoch as u16).try_into()?, + }) +} diff --git a/packages/rs-sdk/src/platform/delegate.rs b/packages/rs-sdk/src/platform/delegate.rs index 733a29c23fc..9b77b751e66 100644 --- a/packages/rs-sdk/src/platform/delegate.rs +++ b/packages/rs-sdk/src/platform/delegate.rs @@ -34,6 +34,11 @@ macro_rules! delegate_transport_request_variant { const SETTINGS_OVERRIDES: $crate::platform::dapi::RequestSettings = $crate::platform::dapi::RequestSettings::default(); + /// TODO: Not sure how to do that + fn method_name(&self) -> &'static str { + "" + } + fn execute_transport<'c>( self, client: &'c mut Self::Client, @@ -73,12 +78,13 @@ macro_rules! delegate_from_proof_variant { type Request = $request; type Response = $response; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + network: dpp::dashcore::Network, version: &dpp::version::PlatformVersion, - provider: &'a dyn drive_proof_verifier::QuorumInfoProvider, - ) -> Result, drive_proof_verifier::Error> + provider: &'a dyn drive_proof_verifier::ContextProvider, + ) -> Result<(Option, ResponseMetadata, dapi_grpc::platform::v0::Proof), drive_proof_verifier::Error> where Self: Sized + 'a, { @@ -91,8 +97,8 @@ macro_rules! delegate_from_proof_variant { match request {$( req::$variant(request) => { if let resp::$variant(response) = response { - >::maybe_from_proof( - request, response, version, provider, + >::maybe_from_proof_with_metadata( + request, response, network, version, provider, ) } else { Err(drive_proof_verifier::Error::ResponseDecodeError { @@ -103,13 +109,14 @@ macro_rules! delegate_from_proof_variant { ), }) } - }, + } )* } } } }; } + #[macro_export] /// Define enums that will wrap multiple requests/responses for one object. /// @@ -129,7 +136,8 @@ macro_rules! delegate_from_proof_variant { macro_rules! delegate_enum { ($request:ident, $response:ident, $object:ty, $(($variant:ident, $req: ty, $resp: ty)),+) => { /// Wrapper around multiple requests for one object type. - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, derive_more::From)] + #[derive(Debug, Clone, derive_more::From, dapi_grpc_macros::Mockable)] + #[cfg_attr(feature="mocks", derive(serde::Serialize, serde::Deserialize))] #[allow(missing_docs)] pub enum $request { $( @@ -138,7 +146,8 @@ macro_rules! delegate_enum { } /// Wrapper around multiple responses for one object type. - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default, derive_more::From)] + #[derive(Debug, Clone, Default, derive_more::From, dapi_grpc_macros::Mockable)] + #[cfg_attr(feature="mocks", derive(serde::Serialize, serde::Deserialize))] #[allow(missing_docs)] pub enum $response { #[default] @@ -153,9 +162,6 @@ macro_rules! delegate_enum { )+ } - impl $crate::platform::dapi::transport::TransportResponse for $response {} - - $crate::delegate_transport_request_variant! { $request, $response, diff --git a/packages/rs-sdk/src/platform/document_query.rs b/packages/rs-sdk/src/platform/document_query.rs index b30e235e279..9c61f943760 100644 --- a/packages/rs-sdk/src/platform/document_query.rs +++ b/packages/rs-sdk/src/platform/document_query.rs @@ -8,8 +8,10 @@ use dapi_grpc::platform::v0::get_documents_request::Version::V0; use dapi_grpc::platform::v0::{ self as platform_proto, get_documents_request::{get_documents_request_v0::Start, GetDocumentsRequestV0}, - GetDocumentsRequest, + GetDocumentsRequest, Proof, ResponseMetadata, }; +use dpp::dashcore::Network; +use dpp::version::PlatformVersion; use dpp::{ data_contract::{ accessors::v0::DataContractV0Getters, document_type::accessors::DocumentTypeV0Getters, @@ -17,9 +19,10 @@ use dpp::{ document::Document, platform_value::{platform_value, Value}, prelude::{DataContract, Identifier}, + ProtocolError, }; -use drive::query::{DriveQuery, InternalClauses, OrderClause, WhereClause, WhereOperator}; -use drive_proof_verifier::{types::Documents, FromProof}; +use drive::query::{DriveDocumentQuery, InternalClauses, OrderClause, WhereClause, WhereOperator}; +use drive_proof_verifier::{types::Documents, ContextProvider, FromProof}; use rs_dapi_client::transport::{ AppliedRequestSettings, BoxFuture, TransportClient, TransportRequest, }; @@ -33,8 +36,9 @@ use super::fetch::Fetch; /// This is an abstraction layer built on top of [GetDocumentsRequest] to address issues with missing details /// required to correctly verify proofs returned by the Dash Platform. /// -/// Conversions are implemented between this type, [GetDocumentsRequest] and [DriveQuery] using [TryFrom] trait. -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +/// Conversions are implemented between this type, [GetDocumentsRequest] and [DriveDocumentQuery] using [TryFrom] trait. +#[derive(Debug, Clone, dapi_grpc_macros::Mockable)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] pub struct DocumentQuery { /// Data contract ID pub data_contract: Arc, @@ -58,7 +62,9 @@ impl DocumentQuery { ) -> Result { let contract = contract.into(); // ensure document type name is correct - contract.document_type_for_name(document_type_name)?; + contract + .document_type_for_name(document_type_name) + .map_err(ProtocolError::DataContractError)?; Ok(Self { data_contract: Arc::clone(&contract), @@ -70,8 +76,8 @@ impl DocumentQuery { }) } - /// Create new document query based on a [DriveQuery]. - pub fn new_with_drive_query(d: &DriveQuery) -> Self { + /// Create new document query based on a [DriveDocumentQuery]. + pub fn new_with_drive_query(d: &DriveDocumentQuery) -> Self { Self::from(d) } @@ -79,7 +85,7 @@ impl DocumentQuery { /// /// Note that this method will fetch data contract first. pub async fn new_with_data_contract_id( - api: &mut Sdk, + api: &Sdk, data_contract_id: Identifier, document_type_name: &str, ) -> Result { @@ -130,6 +136,14 @@ impl TransportRequest for DocumentQuery { const SETTINGS_OVERRIDES: rs_dapi_client::RequestSettings = ::SETTINGS_OVERRIDES; + fn request_name(&self) -> &'static str { + "GetDocumentsRequest" + } + + fn method_name(&self) -> &'static str { + "get_documents" + } + fn execute_transport<'c>( self, client: &'c mut Self::Client, @@ -145,26 +159,35 @@ impl TransportRequest for DocumentQuery { impl FromProof for Document { type Request = DocumentQuery; type Response = platform_proto::GetDocumentsResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, - version: &dpp::version::PlatformVersion, - provider: &'a dyn drive_proof_verifier::QuorumInfoProvider, - ) -> Result, drive_proof_verifier::Error> + network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), drive_proof_verifier::Error> where Self: Sized + 'a, { let request: Self::Request = request.into(); - let documents: Option = - >::maybe_from_proof( - request, response, version, provider, + let (documents, metadata, proof): (Option, ResponseMetadata, Proof) = + >::maybe_from_proof_with_metadata( + request, + response, + network, + platform_version, + provider, )?; match documents { - None => Ok(None), + None => Ok((None, metadata, proof)), Some(docs) => match docs.len() { - 0 | 1 => Ok(docs.into_iter().next().and_then(|(_, v)| v)), + 0 | 1 => Ok(( + docs.into_iter().next().and_then(|(_, v)| v), + metadata, + proof, + )), n => Err(drive_proof_verifier::Error::ResponseDecodeError { error: format!("expected 1 element, got {}", n), }), @@ -176,27 +199,29 @@ impl FromProof for Document { impl FromProof for drive_proof_verifier::types::Documents { type Request = DocumentQuery; type Response = platform_proto::GetDocumentsResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, - version: &dpp::version::PlatformVersion, - provider: &'a dyn drive_proof_verifier::QuorumInfoProvider, - ) -> Result, drive_proof_verifier::Error> + network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), drive_proof_verifier::Error> where Self: Sized + 'a, { let request: Self::Request = request.into(); - let drive_query: DriveQuery = + let drive_query: DriveDocumentQuery = (&request) .try_into() - .map_err(|e| drive_proof_verifier::Error::RequestDecodeError { + .map_err(|e| drive_proof_verifier::Error::RequestError { error: format!("Failed to convert DocumentQuery to DriveQuery: {}", e), })?; - >::maybe_from_proof( + >::maybe_from_proof_with_metadata( drive_query, response, - version, + network, + platform_version, provider, ) } @@ -227,8 +252,36 @@ impl TryFrom for platform_proto::GetDocumentsRequest { } } -impl<'a> From<&'a DriveQuery<'a>> for DocumentQuery { - fn from(value: &'a DriveQuery<'a>) -> Self { +impl<'a> From<&'a DriveDocumentQuery<'a>> for DocumentQuery { + fn from(value: &'a DriveDocumentQuery<'a>) -> Self { + let data_contract = value.contract.clone(); + let document_type_name = value.document_type.name(); + let where_clauses = value.internal_clauses.clone().into(); + let order_by_clauses = value.order_by.iter().map(|(_, v)| v.clone()).collect(); + let limit = value.limit.unwrap_or(0) as u32; + + let start = if let Some(start_at) = value.start_at { + match value.start_at_included { + true => Some(Start::StartAt(start_at.to_vec())), + false => Some(Start::StartAfter(start_at.to_vec())), + } + } else { + None + }; + + Self { + data_contract: Arc::new(data_contract), + document_type_name: document_type_name.to_string(), + where_clauses, + order_by_clauses, + limit, + start, + } + } +} + +impl<'a> From> for DocumentQuery { + fn from(value: DriveDocumentQuery<'a>) -> Self { let data_contract = value.contract.clone(); let document_type_name = value.document_type.name(); let where_clauses = value.internal_clauses.clone().into(); @@ -255,14 +308,15 @@ impl<'a> From<&'a DriveQuery<'a>> for DocumentQuery { } } -impl<'a> TryFrom<&'a DocumentQuery> for DriveQuery<'a> { +impl<'a> TryFrom<&'a DocumentQuery> for DriveDocumentQuery<'a> { type Error = crate::error::Error; fn try_from(request: &'a DocumentQuery) -> Result { // let data_contract = request.data_contract.clone(); let document_type = request .data_contract - .document_type_for_name(&request.document_type_name)?; + .document_type_for_name(&request.document_type_name) + .map_err(ProtocolError::DataContractError)?; let internal_clauses = InternalClauses::extract_from_clauses(request.where_clauses.clone()) .map_err(Error::Drive)?; diff --git a/packages/rs-sdk/src/platform/fetch.rs b/packages/rs-sdk/src/platform/fetch.rs index 292adec9a75..109140bdb7c 100644 --- a/packages/rs-sdk/src/platform/fetch.rs +++ b/packages/rs-sdk/src/platform/fetch.rs @@ -4,16 +4,18 @@ //! It allows fetching of various types of data such as `Identity`, `DataContract`, and `Document`. //! //! ## Traits -//! - [Fetch]: An asynchronous trait that defines how to fetch data from the platform. +//! - [Fetch]: An asynchronous trait that defines how to fetch data from Platform. //! It requires the implementing type to also implement [Debug] and [FromProof] //! traits. The associated [Fetch::Request]` type needs to implement [TransportRequest]. -use crate::mock::{MockRequest, MockResponse}; +use crate::mock::MockResponse; use crate::{error::Error, platform::query::Query, Sdk}; -use dapi_grpc::platform::v0::{self as platform_proto}; -use dpp::block::extended_epoch_info::ExtendedEpochInfo; -use dpp::platform_value::Identifier; -use dpp::{document::Document, prelude::Identity}; +use dapi_grpc::platform::v0::{self as platform_proto, Proof, ResponseMetadata}; +use dpp::voting::votes::Vote; +use dpp::{ + block::extended_epoch_info::ExtendedEpochInfo, document::Document, platform_value::Identifier, + prelude::Identity, +}; use drive_proof_verifier::FromProof; use rs_dapi_client::{transport::TransportRequest, DapiRequest, RequestSettings}; use std::fmt::Debug; @@ -21,11 +23,14 @@ use std::fmt::Debug; use super::types::identity::IdentityRequest; use super::DocumentQuery; -/// Trait implemented by objects that can be fetched from the platform. +/// Trait implemented by objects that can be fetched from Platform. /// -/// To fetch an object from the platform, you need to define some query (criteria that fetched object must match) and +/// To fetch an object from Platform, you need to define some query (criteria that fetched object must match) and /// use [Fetch::fetch()] for your object type. /// +/// Implementators of this trait should implement at least the [fetch_with_metadata()](Fetch::fetch_with_metadata) +/// method, as other methods are convenience methods that call it with default settings. +/// /// ## Example /// /// A common use case is to fetch an [Identity] object by its [Identifier]. As [Identifier] implements [Query] for @@ -34,13 +39,13 @@ use super::DocumentQuery; /// * call [Identity::fetch()] with the query and an instance of [Sdk]. /// /// ```rust -/// use rs_sdk::{Sdk, platform::{Query, Identifier, Fetch, Identity}}; +/// use dash_sdk::{Sdk, platform::{Query, Identifier, Fetch, Identity}}; /// /// # const SOME_IDENTIFIER : [u8; 32] = [0; 32]; -/// let mut sdk = Sdk::new_mock(); +/// let sdk = Sdk::new_mock(); /// let query = Identifier::new(SOME_IDENTIFIER); /// -/// let identity = Identity::fetch(&mut sdk, query); +/// let identity = Identity::fetch(&sdk, query); /// ``` #[async_trait::async_trait] pub trait Fetch @@ -54,18 +59,16 @@ where Response = <::Request as DapiRequest>::Response, >, { - /// Type of request used to fetch data from the platform. + /// Type of request used to fetch data from Platform. /// /// Most likely, one of the types defined in [`dapi_grpc::platform::v0`]. /// /// This type must implement [`TransportRequest`] and [`MockRequest`]. - type Request: TransportRequest - + MockRequest - + Into<::Request>>::Request>; + type Request: TransportRequest + Into<::Request>>::Request>; - /// Fetch single object from the Platfom. + /// Fetch single object from Platform. /// - /// Fetch object from the platform that satisfies provided [Query]. + /// Fetch object from Platform that satisfies provided [Query]. /// Most often, the Query is an [Identifier] of the object to be fetched. /// /// ## Parameters @@ -84,30 +87,139 @@ where /// /// Any errors encountered during the execution are returned as [Error] instances. async fn fetch::Request>>( - sdk: &mut Sdk, + sdk: &Sdk, query: Q, ) -> Result, Error> { + Self::fetch_with_settings(sdk, query, RequestSettings::default()).await + } + + /// Fetch single object from Platform with metadata. + /// + /// Fetch object from Platform that satisfies provided [Query]. + /// Most often, the Query is an [Identifier] of the object to be fetched. + /// + /// ## Parameters + /// + /// - `sdk`: An instance of [Sdk]. + /// - `query`: A query parameter implementing [`crate::platform::query::Query`] to specify the data to be fetched. + /// - `settings`: An optional `RequestSettings` to give greater flexibility on the request. + /// + /// ## Returns + /// + /// Returns: + /// * `Ok(Some(Self))` when object is found + /// * `Ok(None)` when object is not found + /// * [`Err(Error)`](Error) when an error occurs + /// + /// ## Error Handling + /// + /// Any errors encountered during the execution are returned as [Error] instances. + async fn fetch_with_metadata::Request>>( + sdk: &Sdk, + query: Q, + settings: Option, + ) -> Result<(Option, ResponseMetadata), Error> { let request = query.query(sdk.prove())?; let response = request .clone() - .execute(sdk, RequestSettings::default()) + .execute(sdk, settings.unwrap_or_default()) .await?; let object_type = std::any::type_name::().to_string(); tracing::trace!(request = ?request, response = ?response, object_type, "fetched object from platform"); - let object: Option = sdk.parse_proof(request, response)?; + let (object, response_metadata): (Option, ResponseMetadata) = + sdk.parse_proof_with_metadata(request, response).await?; match object { - Some(item) => Ok(item.into()), - None => Ok(None), + Some(item) => Ok((item.into(), response_metadata)), + None => Ok((None, response_metadata)), } } - /// Fetch single object from the Platfom by identifier. + /// Fetch single object from Platform with metadata and underlying proof. + /// + /// Fetch object from Platform that satisfies provided [Query]. + /// Most often, the Query is an [Identifier] of the object to be fetched. + /// + /// This method is meant to give the user library a way to see the underlying proof + /// for educational purposes. This method should most likely only be used for debugging. + /// + /// ## Parameters + /// + /// - `sdk`: An instance of [Sdk]. + /// - `query`: A query parameter implementing [`crate::platform::query::Query`] to specify the data to be fetched. + /// - `settings`: An optional `RequestSettings` to give greater flexibility on the request. /// - /// Conveniance method that allows fetching objects by identifier for types that implement [Query] for [Identifier]. + /// ## Returns + /// + /// Returns: + /// * `Ok(Some(Self))` when object is found + /// * `Ok(None)` when object is not found + /// * [`Err(Error)`](Error) when an error occurs + /// + /// ## Error Handling + /// + /// Any errors encountered during the execution are returned as [Error] instances. + async fn fetch_with_metadata_and_proof::Request>>( + sdk: &Sdk, + query: Q, + settings: Option, + ) -> Result<(Option, ResponseMetadata, Proof), Error> { + let request = query.query(sdk.prove())?; + + let response = request + .clone() + .execute(sdk, settings.unwrap_or_default()) + .await?; + + let object_type = std::any::type_name::().to_string(); + tracing::trace!(request = ?request, response = ?response, object_type, "fetched object from platform"); + + let (object, response_metadata, proof): (Option, ResponseMetadata, Proof) = sdk + .parse_proof_with_metadata_and_proof(request, response) + .await?; + + match object { + Some(item) => Ok((item.into(), response_metadata, proof)), + None => Ok((None, response_metadata, proof)), + } + } + + /// Fetch single object from Platform. + /// + /// Fetch object from Platform that satisfies provided [Query]. + /// Most often, the Query is an [Identifier] of the object to be fetched. + /// + /// ## Parameters + /// + /// - `sdk`: An instance of [Sdk]. + /// - `query`: A query parameter implementing [`crate::platform::query::Query`] to specify the data to be fetched. + /// - `settings`: Request settings for the connection to Platform. + /// + /// ## Returns + /// + /// Returns: + /// * `Ok(Some(Self))` when object is found + /// * `Ok(None)` when object is not found + /// * [`Err(Error)`](Error) when an error occurs + /// + /// ## Error Handling + /// + /// Any errors encountered during the execution are returned as [Error] instances. + async fn fetch_with_settings::Request>>( + sdk: &Sdk, + query: Q, + settings: RequestSettings, + ) -> Result, Error> { + let (object, _) = Self::fetch_with_metadata(sdk, query, Some(settings)).await?; + Ok(object) + } + + /// Fetch single object from Platform by identifier. + /// + /// Convenience method that allows fetching objects by identifier for types that implement [Query] for [Identifier]. /// /// See [`Fetch::fetch()`] for more details. /// @@ -115,7 +227,7 @@ where /// /// - `sdk`: An instance of [Sdk]. /// - `id`: An [Identifier] of the object to be fetched. - async fn fetch_by_identifier(sdk: &mut Sdk, id: Identifier) -> Result, Error> + async fn fetch_by_identifier(sdk: &Sdk, id: Identifier) -> Result, Error> where Identifier: Query<::Request>, { @@ -139,10 +251,34 @@ impl Fetch for drive_proof_verifier::types::IdentityBalance { type Request = platform_proto::GetIdentityBalanceRequest; } +impl Fetch for drive_proof_verifier::types::TotalCreditsInPlatform { + type Request = platform_proto::GetTotalCreditsInPlatformRequest; +} + +impl Fetch for drive_proof_verifier::types::IdentityNonceFetcher { + type Request = platform_proto::GetIdentityNonceRequest; +} + +impl Fetch for drive_proof_verifier::types::IdentityContractNonceFetcher { + type Request = platform_proto::GetIdentityContractNonceRequest; +} + impl Fetch for drive_proof_verifier::types::IdentityBalanceAndRevision { type Request = platform_proto::GetIdentityBalanceAndRevisionRequest; } +impl Fetch for drive_proof_verifier::types::DataContractHistory { + type Request = platform_proto::GetDataContractHistoryRequest; +} + impl Fetch for ExtendedEpochInfo { type Request = platform_proto::GetEpochsInfoRequest; } + +impl Fetch for drive_proof_verifier::types::PrefundedSpecializedBalance { + type Request = platform_proto::GetPrefundedSpecializedBalanceRequest; +} + +impl Fetch for Vote { + type Request = platform_proto::GetContestedResourceIdentityVotesRequest; +} diff --git a/packages/rs-sdk/src/platform/fetch_current_no_parameters.rs b/packages/rs-sdk/src/platform/fetch_current_no_parameters.rs new file mode 100644 index 00000000000..9d87bc9ea86 --- /dev/null +++ b/packages/rs-sdk/src/platform/fetch_current_no_parameters.rs @@ -0,0 +1,17 @@ +use crate::{Error, Sdk}; +use async_trait::async_trait; +use dapi_grpc::platform::v0::{Proof, ResponseMetadata}; + +#[async_trait] + +/// Helper trait for managing Epoch information +pub trait FetchCurrent: Sized { + /// Fetch current (the latest) epoch from Platform. + async fn fetch_current(sdk: &Sdk) -> Result; + /// Fetch current (the latest) epoch from Platform with metadata. + async fn fetch_current_with_metadata(sdk: &Sdk) -> Result<(Self, ResponseMetadata), Error>; + /// Fetch current (the latest) epoch from Platform with metadata and proof. + async fn fetch_current_with_metadata_and_proof( + sdk: &Sdk, + ) -> Result<(Self, ResponseMetadata, Proof), Error>; +} diff --git a/packages/rs-sdk/src/platform/fetch_many.rs b/packages/rs-sdk/src/platform/fetch_many.rs index b39e2012f71..b2891412c7b 100644 --- a/packages/rs-sdk/src/platform/fetch_many.rs +++ b/packages/rs-sdk/src/platform/fetch_many.rs @@ -1,30 +1,37 @@ -//! Fetch multiple objects from the Platform. +//! Fetch multiple objects from Platform. //! -//! This module provides a trait to fetch multiple objects from the platform. +//! This module provides a trait to fetch multiple objects from Platform. //! //! ## Traits -//! - `[FetchMany]`: An async trait that fetches multiple items of a specific type from the platform. - -use crate::mock::MockResponse; +//! - `[FetchMany]`: An async trait that fetches multiple items of a specific type from Platform. use crate::{ error::Error, + mock::MockResponse, platform::{document_query::DocumentQuery, query::Query}, Sdk, }; use dapi_grpc::platform::v0::{ + GetContestedResourceIdentityVotesRequest, GetContestedResourceVoteStateRequest, + GetContestedResourceVotersForIdentityRequest, GetContestedResourcesRequest, GetDataContractsRequest, GetDocumentsResponse, GetEpochsInfoRequest, GetIdentityKeysRequest, GetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeVoteStatusRequest, + GetVotePollsByEndDateRequest, }; use dashcore_rpc::dashcore::ProTxHash; -use dpp::block::epoch::EpochIndex; -use dpp::block::extended_epoch_info::ExtendedEpochInfo; use dpp::data_contract::DataContract; -use dpp::document::Document; use dpp::identity::KeyID; use dpp::prelude::{Identifier, IdentityPublicKey}; use dpp::util::deserializer::ProtocolVersion; +use dpp::version::ProtocolVersionVoteCount; +use dpp::{block::epoch::EpochIndex, prelude::TimestampMillis, voting::vote_polls::VotePoll}; +use dpp::{ + block::extended_epoch_info::ExtendedEpochInfo, voting::votes::resource_vote::ResourceVote, +}; +use dpp::{document::Document, voting::contender_structs::ContenderWithSerializedDocument}; use drive_proof_verifier::types::{ - MasternodeProtocolVote, ProtocolVersionVoteCount, RetrievedObjects, + Contenders, ContestedResource, ContestedResources, DataContracts, ExtendedEpochInfos, + IdentityPublicKeys, MasternodeProtocolVote, MasternodeProtocolVotes, ProtocolVersionUpgrades, + ResourceVotesByIdentity, VotePollsGroupedByTimestamp, Voter, Voters, }; use drive_proof_verifier::{types::Documents, FromProof}; use rs_dapi_client::{transport::TransportRequest, DapiRequest, RequestSettings}; @@ -32,18 +39,19 @@ use std::collections::BTreeMap; use super::LimitQuery; -/// Fetch multiple objects from the Platform. +/// Fetch multiple objects from Platform. /// -/// To fetch multiple objects from the platform, you need to define some query (criteria that fetched objects must match) +/// To fetch multiple objects from Platform, you need to define some query (criteria that fetched objects must match) /// and use [FetchMany::fetch_many()] for your object type. /// -/// You can also use conveniance methods: +/// You can also use convenience methods: /// * [FetchMany::fetch_many_by_identifiers()] - to fetch multiple objects by their identifiers, /// * [FetchMany::fetch_many_with_limit()] - to fetch not more than `limit` objects. /// /// ## Generic Parameters /// /// - `K`: The type of the key used to index the object +/// - `O`: The type of returned container (eg. map) that holds the fetched objects /// /// ## Example /// @@ -55,37 +63,38 @@ use super::LimitQuery; /// * call [DataContract::fetch_many()](FetchMany::fetch_many()) with the query and an instance of [Sdk]. /// /// ```rust -/// use rs_sdk::{Sdk, platform::{Query, Identifier, FetchMany, DataContract}}; +/// use dash_sdk::{Sdk, platform::{Query, Identifier, FetchMany, DataContract}}; /// /// # const SOME_IDENTIFIER_1 : [u8; 32] = [1; 32]; /// # const SOME_IDENTIFIER_2 : [u8; 32] = [2; 32]; -/// let mut sdk = Sdk::new_mock(); +/// let sdk = Sdk::new_mock(); /// /// let id1 = Identifier::new(SOME_IDENTIFIER_1); /// let id2 = Identifier::new(SOME_IDENTIFIER_2); /// /// let query = vec![id1, id2]; /// -/// let data_contract = DataContract::fetch_many(&mut sdk, query); +/// let data_contract = DataContract::fetch_many(&sdk, query); /// ``` #[async_trait::async_trait] -pub trait FetchMany +pub trait FetchMany)>> where Self: Sized, - BTreeMap>: MockResponse + O: MockResponse + FromProof< Self::Request, Request = Self::Request, - Response = <>::Request as TransportRequest>::Response, - > + Sync, + Response = <>::Request as TransportRequest>::Response, + > + Send + + Default, { - /// Type of request used to fetch multiple objects from the platform. + /// Type of request used to fetch multiple objects from Platform. /// /// Most likely, one of the types defined in [`dapi_grpc::platform::v0`]. /// /// This type must implement [`TransportRequest`] and [`MockRequest`](crate::mock::MockRequest). type Request: TransportRequest - + Into<> as FromProof<>::Request>>::Request>; + + Into<>::Request>>::Request>; /// Fetch (or search) multiple objects on the Dash Platform /// @@ -101,7 +110,7 @@ where /// /// ## Generic Parameters /// - /// - `K`: The type of the key used to index the object in the returned collection + /// - `Q`: The type of [Query] used to generate a request /// /// ## Parameters /// @@ -110,7 +119,7 @@ where /// /// ## Returns /// - /// Returns a `Result` containing either : + /// Returns a `Result` containing either: /// /// * list of objects matching the [Query] indexed by a key type `K`, where an item can be None of /// the object was not found for provided key @@ -125,10 +134,10 @@ where /// ## Error Handling /// /// Any errors encountered during the execution are returned as [`Error`](crate::error::Error) instances. - async fn fetch_many>::Request>>( - sdk: &mut Sdk, + async fn fetch_many>::Request>>( + sdk: &Sdk, query: Q, - ) -> Result, Error> { + ) -> Result { let request = query.query(sdk.prove())?; let response = request @@ -139,18 +148,17 @@ where let object_type = std::any::type_name::().to_string(); tracing::trace!(request = ?request, response = ?response, object_type, "fetched object from platform"); - let object: BTreeMap> = sdk - .parse_proof::<>::Request, BTreeMap>>( - request, response, - )? + let object: O = sdk + .parse_proof::<>::Request, O>(request, response) + .await? .unwrap_or_default(); Ok(object) } - /// Fetch multiple objects from the Platform by their identifiers. + /// Fetch multiple objects from Platform by their identifiers. /// - /// Conveniance method to fetch multiple objects by their identifiers. + /// Convenience method to fetch multiple objects by their identifiers. /// See [FetchMany] and [FetchMany::fetch_many()] for more detailed documentation. /// /// ## Parameters @@ -162,17 +170,17 @@ where /// /// `Vec` must implement [Query] for [Self::Request]. async fn fetch_by_identifiers + Send>( - sdk: &mut Sdk, + sdk: &Sdk, identifiers: I, - ) -> Result, Error> + ) -> Result where - Vec: Query<>::Request>, + Vec: Query<>::Request>, { let ids = identifiers.into_iter().collect::>(); Self::fetch_many(sdk, ids).await } - /// Fetch multiple objects from the Platform with limit. + /// Fetch multiple objects from Platform with limit. /// /// Fetches up to `limit` objects matching the `query`. /// See [FetchMany] and [FetchMany::fetch_many()] for more detailed documentation. @@ -182,41 +190,42 @@ where /// - `sdk`: An instance of [Sdk]. /// - `query`: A query parameter implementing [`Query`](crate::platform::query::Query) to specify the data to be retrieved. /// - `limit`: Maximum number of objects to fetch. - async fn fetch_many_with_limit>::Request>>( - sdk: &mut Sdk, + async fn fetch_many_with_limit>::Request>>( + sdk: &Sdk, query: Q, limit: u32, - ) -> Result, Error> + ) -> Result where - LimitQuery: Query<>::Request>, + LimitQuery: Query<>::Request>, { let limit_query = LimitQuery { limit: Some(limit), query, + start_info: None, }; Self::fetch_many(sdk, limit_query).await } } -/// Fetch documents from the Platform. +/// Fetch documents from Platform. /// /// Returns [Documents](dpp::document::Document) indexed by their [Identifier](dpp::prelude::Identifier). /// /// ## Supported query types /// -/// * [DriveQuery](crate::platform::DriveQuery) - query that specifies document matching criteria -/// * [DocumentQuery](crate::platform::document_query::DocumentQuery) - +/// * [DriveQuery](crate::platform::DriveDocumentQuery) - query that specifies document matching criteria +/// * [DocumentQuery](crate::platform::document_query::DocumentQuery) #[async_trait::async_trait] -impl FetchMany for Document { +impl FetchMany for Document { // We need to use the DocumentQuery type here because the DocumentQuery // type stores full contract, which is missing in the GetDocumentsRequest type. // TODO: Refactor to use ContextProvider type Request = DocumentQuery; - async fn fetch_many>::Request>>( - sdk: &mut Sdk, + async fn fetch_many>::Request>>( + sdk: &Sdk, query: Q, - ) -> Result>, Error> { + ) -> Result { let document_query: DocumentQuery = query.query(sdk.prove())?; let request = document_query.clone(); @@ -227,7 +236,8 @@ impl FetchMany for Document { // let object: Option> = sdk let documents: BTreeMap> = sdk - .parse_proof::(document_query, response)? + .parse_proof::(document_query, response) + .await? .unwrap_or_default(); Ok(documents) @@ -242,7 +252,7 @@ impl FetchMany for Document { /// ## Supported query types /// /// * [Identifier] - [Identity](crate::platform::Identity) ID for which to retrieve keys -impl FetchMany for IdentityPublicKey { +impl FetchMany for IdentityPublicKey { type Request = GetIdentityKeysRequest; } @@ -252,12 +262,12 @@ impl FetchMany for IdentityPublicKey { /// /// ## Supported query types /// +/// * [EpochQuery](super::types::epoch::EpochQuery) - query that specifies epoch matching criteria /// * [EpochIndex](dpp::block::epoch::EpochIndex) - epoch index of first object to find; will return up to /// [DEFAULT_EPOCH_QUERY_LIMIT](super::query::DEFAULT_EPOCH_QUERY_LIMIT) objects starting from this index -/// * [`LimitQuery`](super::LimitQuery) - limit query that allows to specify maximum number of objects -/// to fetch; see also [FetchMany::fetch_many_with_limit()]. -/// -impl FetchMany for ExtendedEpochInfo { +/// * [`LimitQuery`](super::LimitQuery), [`LimitQuery`](super::LimitQuery) - limit query +/// that allows to specify maximum number of objects to fetch; see also [FetchMany::fetch_many_with_limit()]. +impl FetchMany for ExtendedEpochInfo { type Request = GetEpochsInfoRequest; } @@ -273,15 +283,15 @@ impl FetchMany for ExtendedEpochInfo { /// ## Example /// /// ```rust -/// use rs_sdk::{Sdk, platform::FetchMany}; +/// use dash_sdk::{Sdk, platform::FetchMany}; /// use drive_proof_verifier::types::ProtocolVersionVoteCount; /// /// # tokio_test::block_on(async { -/// let mut sdk = Sdk::new_mock(); -/// let result = ProtocolVersionVoteCount::fetch_many(&mut sdk, ()).await; +/// let sdk = Sdk::new_mock(); +/// let result = ProtocolVersionVoteCount::fetch_many(&sdk, ()).await; /// # }); /// ``` -impl FetchMany for ProtocolVersionVoteCount { +impl FetchMany for ProtocolVersionVoteCount { type Request = GetProtocolVersionUpgradeStateRequest; } @@ -299,13 +309,67 @@ impl FetchMany for ProtocolVersionVoteCount { /// the query will return all objects /// * [`LimitQuery`](super::LimitQuery) - limit query that allows to specify maximum number of objects /// to fetch; see also [FetchMany::fetch_many_with_limit()]. -impl FetchMany for MasternodeProtocolVote { +impl FetchMany for MasternodeProtocolVote { type Request = GetProtocolVersionUpgradeVoteStatusRequest; } /// Fetch multiple data contracts. /// /// Returns [DataContracts](drive_proof_verifier::types::DataContracts) indexed by [Identifier](dpp::prelude::Identifier). -impl FetchMany for DataContract { +/// +/// ## Supported query types +/// +/// * [Vec](dpp::prelude::Identifier) - list of identifiers of data contracts to fetch +/// +impl FetchMany for DataContract { type Request = GetDataContractsRequest; } + +/// Fetch multiple [ContestedResource], indexed by Identifier. +/// +/// ## Supported query types +/// +/// * [VotePollsByDocumentTypeQuery] +impl FetchMany for ContestedResource { + type Request = GetContestedResourcesRequest; +} + +/// Fetch multiple contenders for a contested document resource vote poll. +/// +/// Returns [Contender](drive_proof_verifier::types::Contenders) indexed by [Identifier](dpp::prelude::Identifier). +/// +/// ## Supported query types +/// +/// * [ContestedDocumentVotePollDriveQuery] +#[async_trait::async_trait] +impl FetchMany for ContenderWithSerializedDocument { + type Request = GetContestedResourceVoteStateRequest; +} + +///  Fetch voters +/// ## Supported query types +/// +/// * [ContestedDocumentVotePollVotesDriveQuery] +impl FetchMany for Voter { + type Request = GetContestedResourceVotersForIdentityRequest; +} + +// GetContestedResourceIdentityVoteStatus +/// Fetch votes of some identity for a contested document resource vote poll. +/// +/// ## Supported query types +/// +/// * [ContestedResourceVotesGivenByIdentityQuery] +impl FetchMany for ResourceVote { + type Request = GetContestedResourceIdentityVotesRequest; +} + +// +/// Fetch multiple vote polls grouped by timestamp. +/// +/// ## Supported query types +/// +/// * [VotePollsByEndDateDriveQuery] +impl FetchMany for VotePoll { + type Request = GetVotePollsByEndDateRequest; +} diff --git a/packages/rs-sdk/src/platform/identities_contract_keys_query.rs b/packages/rs-sdk/src/platform/identities_contract_keys_query.rs new file mode 100644 index 00000000000..15570d23a71 --- /dev/null +++ b/packages/rs-sdk/src/platform/identities_contract_keys_query.rs @@ -0,0 +1,90 @@ +use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; +use dapi_grpc::platform::v0::get_identities_contract_keys_request::Version::V0; +use dapi_grpc::platform::v0::GetIdentitiesContractKeysRequest; +use dpp::identity::Purpose; +use rs_dapi_client::transport::{ + AppliedRequestSettings, BoxFuture, TransportClient, TransportRequest, +}; + +use crate::platform::Identifier; +use crate::Error; + +/// Request that is used to query identities' contract keys +#[derive(Debug, Clone, dapi_grpc_macros::Mockable)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] +pub struct IdentitiesContractKeysQuery { + /// The identities' identifiers that we want to query + pub identities_ids: Vec, + /// The contract identifier + pub contract_id: Identifier, + /// An optional document type if the keys are on a document type instead of the contract + pub document_type_name: Option, + /// The purposes we want to query for + pub purposes: Vec, +} + +impl IdentitiesContractKeysQuery { + /// Create new IdentitiesContractKeysQuery for provided identities ids, contract id, the document + /// type (if we want to make the query on the document type level), and purposes + pub fn new( + identities_ids: Vec, + contract_id: Identifier, + document_type_name: Option, + purposes: Vec, + ) -> Result { + Ok(Self { + identities_ids, + contract_id, + document_type_name, + purposes, + }) + } +} + +impl TryFrom for GetIdentitiesContractKeysRequest { + type Error = Error; + fn try_from(dapi_request: IdentitiesContractKeysQuery) -> Result { + let IdentitiesContractKeysQuery { + identities_ids, + contract_id, + document_type_name, + purposes, + } = dapi_request; + //todo: transform this into PlatformVersionedTryFrom + Ok(GetIdentitiesContractKeysRequest { + version: Some(V0(GetIdentitiesContractKeysRequestV0 { + identities_ids: identities_ids.into_iter().map(|a| a.to_vec()).collect(), + contract_id: contract_id.to_vec(), + document_type_name, + purposes: purposes.into_iter().map(|purpose| purpose as i32).collect(), + prove: true, + })), + }) + } +} + +impl TransportRequest for IdentitiesContractKeysQuery { + type Client = ::Client; + type Response = ::Response; + const SETTINGS_OVERRIDES: rs_dapi_client::RequestSettings = + ::SETTINGS_OVERRIDES; + + fn request_name(&self) -> &'static str { + "getIdentitiesContractKeysRequest" + } + + fn method_name(&self) -> &'static str { + "get_identities_contract_keys" + } + + fn execute_transport<'c>( + self, + client: &'c mut Self::Client, + settings: &AppliedRequestSettings, + ) -> BoxFuture<'c, Result::Error>> { + let request: GetIdentitiesContractKeysRequest = self + .try_into() + .expect("IdentitiesContractKeysQuery should always be valid"); + request.execute_transport(client, settings) + } +} diff --git a/packages/rs-sdk/src/platform/query.rs b/packages/rs-sdk/src/platform/query.rs index 0b53e4990e3..6e7de72013e 100644 --- a/packages/rs-sdk/src/platform/query.rs +++ b/packages/rs-sdk/src/platform/query.rs @@ -1,28 +1,47 @@ -//! Query trait representing criteria for fetching data from the platform. +//! Query trait representing criteria for fetching data from Platform. //! -//! [Query] trait is used to specify individual objects as well as search criteria for fetching multiple objects from the platform. -use std::fmt::Debug; - +//! [Query] trait is used to specify individual objects as well as search criteria for fetching multiple objects from Platform. +use crate::{error::Error, platform::document_query::DocumentQuery}; +use dapi_grpc::mock::Mockable; +use dapi_grpc::platform::v0::get_contested_resource_identity_votes_request::GetContestedResourceIdentityVotesRequestV0; +use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_request::GetContestedResourceVotersForIdentityRequestV0; +use dapi_grpc::platform::v0::get_contested_resources_request::GetContestedResourcesRequestV0; +use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; +use dapi_grpc::platform::v0::get_total_credits_in_platform_request::GetTotalCreditsInPlatformRequestV0; use dapi_grpc::platform::v0::{ self as proto, get_identity_keys_request, get_identity_keys_request::GetIdentityKeysRequestV0, - AllKeys, GetEpochsInfoRequest, GetIdentityKeysRequest, GetProtocolVersionUpgradeStateRequest, - GetProtocolVersionUpgradeVoteStatusRequest, KeyRequestType, + get_path_elements_request, get_total_credits_in_platform_request, AllKeys, + GetContestedResourceVoteStateRequest, GetContestedResourceVotersForIdentityRequest, + GetContestedResourcesRequest, GetEpochsInfoRequest, GetIdentityKeysRequest, + GetPathElementsRequest, GetProtocolVersionUpgradeStateRequest, + GetProtocolVersionUpgradeVoteStatusRequest, GetTotalCreditsInPlatformRequest, KeyRequestType, +}; +use dapi_grpc::platform::v0::{ + GetContestedResourceIdentityVotesRequest, GetPrefundedSpecializedBalanceRequest, + GetVotePollsByEndDateRequest, }; use dashcore_rpc::dashcore::{hashes::Hash, ProTxHash}; +use dpp::version::PlatformVersionError; use dpp::{block::epoch::EpochIndex, prelude::Identifier}; -use drive::query::DriveQuery; +use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; +use drive::query::vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery; +use drive::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQuery; +use drive::query::vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery; +use drive::query::{DriveDocumentQuery, VotePollsByEndDateDriveQuery}; +use drive_proof_verifier::from_request::TryFromRequest; +use drive_proof_verifier::types::{KeysInPath, NoParamQuery}; use rs_dapi_client::transport::TransportRequest; +use std::fmt::Debug; -use crate::{error::Error, platform::document_query::DocumentQuery}; - -/// Default limit of epoch records returned by the platform. +use super::types::epoch::EpochQuery; +/// Default limit of epoch records returned by Platform. pub const DEFAULT_EPOCH_QUERY_LIMIT: u32 = 100; -/// Default limit of epoch records returned by the platform. +/// Default limit of epoch records returned by Platform. pub const DEFAULT_NODES_VOTING_LIMIT: u32 = 100; /// Trait implemented by objects that can be used as queries. /// -/// [Query] trait is used to specify criteria for fetching data from the platform. -/// It can be used to specify individual objects as well as search criteria for fetching multiple objects from the platform. +/// [Query] trait is used to specify criteria for fetching data from Platform. +/// It can be used to specify individual objects as well as search criteria for fetching multiple objects from Platform. /// /// Some examples of queries include: /// @@ -40,18 +59,18 @@ pub const DEFAULT_NODES_VOTING_LIMIT: u32 = 100; /// or [FetchMany](crate::platform::FetchMany) trait: /// /// ```rust -/// use rs_sdk::{Sdk, platform::{Query, Identifier, Fetch, Identity}}; +/// use dash_sdk::{Sdk, platform::{Query, Identifier, Fetch, Identity}}; /// /// # const SOME_IDENTIFIER : [u8; 32] = [0; 32]; -/// let mut sdk = Sdk::new_mock(); +/// let sdk = Sdk::new_mock(); /// let query = Identifier::new(SOME_IDENTIFIER); -/// let identity = Identity::fetch(&mut sdk, query); +/// let identity = Identity::fetch(&sdk, query); /// ``` /// /// As [Identifier](crate::platform::Identifier) implements [Query], the `query` variable in the code /// above can be used as a parameter for [Fetch::fetch()](crate::platform::Fetch::fetch()) /// and [FetchMany::fetch_many()](crate::platform::FetchMany::fetch_many()) methods. -pub trait Query: Send + Debug + Clone { +pub trait Query: Send + Debug + Clone { /// Converts the current instance into an instance of the `TransportRequest` type. /// /// This method takes ownership of the instance upon which it's called (hence `self`), and attempts to perform the conversion. @@ -111,6 +130,27 @@ impl Query for Vec { } } +impl Query for LimitQuery<(Identifier, u64)> { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + let (id, start_at_ms) = self.query; + + Ok(proto::GetDataContractHistoryRequest { + version: Some(proto::get_data_contract_history_request::Version::V0( + proto::get_data_contract_history_request::GetDataContractHistoryRequestV0 { + id: id.to_vec(), + limit: self.limit, + offset: None, + start_at_ms, + prove, + }, + )), + }) + } +} + impl Query for Identifier { /// Get all keys for an identity with provided identifier. fn query(self, prove: bool) -> Result { @@ -134,7 +174,7 @@ impl Query for Identifier { } } -impl<'a> Query for DriveQuery<'a> { +impl<'a> Query for DriveDocumentQuery<'a> { fn query(self, prove: bool) -> Result { if !prove { unimplemented!("queries without proofs are not supported yet"); @@ -144,52 +184,66 @@ impl<'a> Query for DriveQuery<'a> { } } +#[derive(Debug, Clone)] +pub struct QueryStartInfo { + pub start_key: Vec, + pub start_included: bool, +} + /// Wrapper around query that allows to specify limit. /// -/// A query that can be used specify limit when fetching multiple objects from the platform +/// A query that can be used specify limit when fetching multiple objects from Platform /// using [`FetchMany`](crate::platform::FetchMany) trait. /// /// ## Example /// /// ```rust -/// use rs_sdk::{Sdk, platform::{Query, LimitQuery, Identifier, FetchMany, Identity}}; +/// use dash_sdk::{Sdk, platform::{Query, LimitQuery, Identifier, FetchMany, Identity}}; /// use drive_proof_verifier::types::ExtendedEpochInfos; /// use dpp::block::extended_epoch_info::ExtendedEpochInfo; /// /// # const SOME_IDENTIFIER : [u8; 32] = [0; 32]; -/// let mut sdk = Sdk::new_mock(); +/// let sdk = Sdk::new_mock(); /// let query = LimitQuery { /// query: 1, +/// start_info: None, /// limit: Some(10), /// }; -/// let epoch = ExtendedEpochInfo::fetch_many(&mut sdk, query); +/// let epoch = ExtendedEpochInfo::fetch_many(&sdk, query); /// ``` #[derive(Debug, Clone)] pub struct LimitQuery { /// Actual query to execute pub query: Q, + /// Start info + pub start_info: Option, /// Max number of records returned pub limit: Option, } impl From for LimitQuery { fn from(query: Q) -> Self { - Self { query, limit: None } + Self { + query, + start_info: None, + limit: None, + } } } -impl Query for LimitQuery { +impl + Clone + Debug + Send> Query for LimitQuery { fn query(self, prove: bool) -> Result { if !prove { unimplemented!("queries without proofs are not supported yet"); } + let inner: EpochQuery = self.query.into(); Ok(GetEpochsInfoRequest { version: Some(proto::get_epochs_info_request::Version::V0( proto::get_epochs_info_request::GetEpochsInfoRequestV0 { prove, - start_epoch: Some(self.query.into()), + start_epoch: inner.start.map(|v| v as u32), count: self.limit.unwrap_or(DEFAULT_EPOCH_QUERY_LIMIT), - ascending: true, + ascending: inner.ascending, }, )), }) @@ -198,7 +252,12 @@ impl Query for LimitQuery { impl Query for EpochIndex { fn query(self, prove: bool) -> Result { - LimitQuery::from(self).query(prove) + LimitQuery { + query: self, + start_info: None, + limit: Some(1), + } + .query(prove) } } @@ -228,26 +287,299 @@ impl Query for LimitQuery for Option { fn query(self, prove: bool) -> Result { LimitQuery::from(self).query(prove) } } -/// Conveniance method that allows direct use of a ProTxHash +/// Convenience method that allows direct use of a ProTxHash impl Query for ProTxHash { fn query(self, prove: bool) -> Result { Some(self).query(prove) } } -/// Conveniance method that allows direct use of a ProTxHash +/// Convenience method that allows direct use of a ProTxHash impl Query for LimitQuery { fn query(self, prove: bool) -> Result { LimitQuery { query: Some(self.query), + start_info: None, limit: self.limit, } .query(prove) } } + +impl Query for VotePollsByDocumentTypeQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query for LimitQuery { + fn query(self, prove: bool) -> Result { + use proto::get_contested_resources_request::{ + get_contested_resources_request_v0::StartAtValueInfo, Version, + }; + let query = match self.query.query(prove)?.version { + Some(Version::V0(v0)) => GetContestedResourcesRequestV0 { + start_at_value_info: self.start_info.map(|v| StartAtValueInfo { + start_value: v.start_key, + start_value_included: v.start_included, + }), + ..v0 + } + .into(), + None => { + return Err(Error::Protocol( + PlatformVersionError::UnknownVersionError( + "version not present in request".into(), + ) + .into(), + )) + } + }; + + Ok(query) + } +} + +impl Query for ContestedDocumentVotePollDriveQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + if self.offset.is_some() { + return Err(Error::Generic("ContestedDocumentVotePollDriveQuery.offset field is internal and must be set to None".into())); + } + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query + for LimitQuery +{ + fn query(self, prove: bool) -> Result { + use proto::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0::StartAtIdentifierInfo; + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + let result = match self.query.query(prove)?.version { + Some(proto::get_contested_resource_vote_state_request::Version::V0(v0)) => + proto::get_contested_resource_vote_state_request::GetContestedResourceVoteStateRequestV0 { + start_at_identifier_info: self.start_info.map(|v| StartAtIdentifierInfo { + start_identifier: v.start_key, + start_identifier_included: v.start_included, + }), + ..v0 + }.into(), + + None =>return Err(Error::Protocol( + PlatformVersionError::UnknownVersionError("version not present in request".into()).into(), + )), + }; + + Ok(result) + } +} + +impl Query + for ContestedDocumentVotePollVotesDriveQuery +{ + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + if self.offset.is_some() { + return Err(Error::Generic("ContestedDocumentVotePollVotesDriveQuery.offset field is internal and must be set to None".into())); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query + for LimitQuery +{ + fn query(self, prove: bool) -> Result { + use proto::get_contested_resource_voters_for_identity_request::{ + get_contested_resource_voters_for_identity_request_v0::StartAtIdentifierInfo, Version, + }; + let query = match self.query.query(prove)?.version { + Some(Version::V0(v0)) => GetContestedResourceVotersForIdentityRequestV0 { + start_at_identifier_info: self.start_info.map(|v| StartAtIdentifierInfo { + start_identifier: v.start_key, + start_identifier_included: v.start_included, + }), + ..v0 + } + .into(), + None => { + return Err(Error::Protocol( + PlatformVersionError::UnknownVersionError( + "version not present in request".into(), + ) + .into(), + )) + } + }; + + Ok(query) + } +} + +impl Query + for ContestedResourceVotesGivenByIdentityQuery +{ + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + if self.offset.is_some() { + return Err(Error::Generic("ContestedResourceVotesGivenByIdentityQuery.offset field is internal and must be set to None".into())); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query for ProTxHash { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + Ok(GetContestedResourceIdentityVotesRequestV0 { + identity_id: self.to_byte_array().to_vec(), + prove, + limit: None, + offset: None, + order_ascending: true, + start_at_vote_poll_id_info: None, + } + .into()) + } +} + +impl Query for VotePollsByEndDateDriveQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query for Identifier { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + self.try_to_request().map_err(|e| e.into()) + } +} + +/// Query for single vote. +#[derive(Debug, Clone)] +pub struct VoteQuery { + pub identity_id: Identifier, + pub vote_poll_id: Identifier, +} +impl VoteQuery { + pub fn new(identity_id: Identifier, vote_poll_id: Identifier) -> Self { + Self { + identity_id, + vote_poll_id, + } + } +} + +impl Query for VoteQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + use proto::get_contested_resource_identity_votes_request::get_contested_resource_identity_votes_request_v0::StartAtVotePollIdInfo; + + Ok(GetContestedResourceIdentityVotesRequestV0 { + identity_id: self.identity_id.to_vec(), + prove, + limit: Some(1), + offset: None, + order_ascending: true, + start_at_vote_poll_id_info: Some(StartAtVotePollIdInfo { + start_at_poll_identifier: self.vote_poll_id.to_vec(), + start_poll_identifier_included: true, + }), + } + .into()) + } +} + +impl Query for LimitQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + use proto::get_contested_resource_identity_votes_request::{ + get_contested_resource_identity_votes_request_v0::StartAtVotePollIdInfo, Version, + }; + + Ok(match self.query.query(prove)?.version { + None => return Err(Error::Protocol(dpp::ProtocolError::NoProtocolVersionError)), + Some(Version::V0(v0)) => GetContestedResourceIdentityVotesRequestV0 { + limit: self.limit, + start_at_vote_poll_id_info: self.start_info.map(|v| StartAtVotePollIdInfo { + start_at_poll_identifier: v.start_key.to_vec(), + start_poll_identifier_included: v.start_included, + }), + ..v0 + }, + } + .into()) + } +} + +impl Query for KeysInPath { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + let request: GetPathElementsRequest = GetPathElementsRequest { + version: Some(get_path_elements_request::Version::V0( + GetPathElementsRequestV0 { + path: self.path, + keys: self.keys, + prove, + }, + )), + }; + + Ok(request) + } +} + +impl Query for NoParamQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + let request: GetTotalCreditsInPlatformRequest = GetTotalCreditsInPlatformRequest { + version: Some(get_total_credits_in_platform_request::Version::V0( + GetTotalCreditsInPlatformRequestV0 { prove }, + )), + }; + + Ok(request) + } +} diff --git a/packages/rs-sdk/src/platform/transition.rs b/packages/rs-sdk/src/platform/transition.rs new file mode 100644 index 00000000000..490bc40090d --- /dev/null +++ b/packages/rs-sdk/src/platform/transition.rs @@ -0,0 +1,20 @@ +//! State transitions used to put changed objects to the Dash Platform. +pub mod broadcast; +pub(crate) mod broadcast_identity; +pub mod broadcast_request; +pub(crate) mod context; +pub mod purchase_document; +pub mod put_contract; +pub mod put_document; +pub mod put_identity; +pub mod put_settings; +pub mod top_up_identity; +pub mod transfer_document; +mod txid; +pub mod update_price_of_document; +pub mod vote; +pub mod withdraw_from_identity; + +pub use context::*; + +pub use txid::TxId; diff --git a/packages/rs-sdk/src/platform/transition/broadcast.rs b/packages/rs-sdk/src/platform/transition/broadcast.rs new file mode 100644 index 00000000000..5c050ce8cff --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/broadcast.rs @@ -0,0 +1,68 @@ +use super::broadcast_request::BroadcastRequestForStateTransition; +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::{Error, Sdk}; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; +use drive::drive::Drive; +use drive_proof_verifier::error::ContextProviderError; +use drive_proof_verifier::DataContractProvider; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +pub trait BroadcastStateTransition { + async fn broadcast(&self, sdk: &Sdk) -> Result<(), Error>; + async fn broadcast_and_wait( + &self, + sdk: &Sdk, + time_out_ms: Option, + ) -> Result; +} + +#[async_trait::async_trait] +impl BroadcastStateTransition for StateTransition { + async fn broadcast(&self, sdk: &Sdk) -> Result<(), Error> { + let request = self.broadcast_request_for_state_transition()?; + + request.execute(sdk, RequestSettings::default()).await?; + + // response is empty for a broadcast, result comes from the stream wait for state transition result + + Ok(()) + } + + async fn broadcast_and_wait( + &self, + sdk: &Sdk, + _time_out_ms: Option, + ) -> Result { + let request = self.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, RequestSettings::default()) + .await?; + + let request = self.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + let proof = response.proof_owned()?; + let context_provider = + sdk.context_provider() + .ok_or(Error::from(ContextProviderError::Config( + "Context provider not initialized".to_string(), + )))?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + self, + &block_info, + proof.grovedb_proof.as_slice(), + &context_provider.as_contract_lookup_fn(), + sdk.version(), + )?; + + Ok(result) + } +} diff --git a/packages/rs-sdk/src/platform/transition/broadcast_identity.rs b/packages/rs-sdk/src/platform/transition/broadcast_identity.rs new file mode 100644 index 00000000000..5bce4205cfe --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/broadcast_identity.rs @@ -0,0 +1,119 @@ +//! Broadcast trait representing the action of broadcasting a new identity state transition to Platform. +//! +//! The [BroadcastRequestForNewIdentity] trait is designed for the creation and broadcasting of new identity state transitions. +//! This involves the generation of a state transition object, signing it, and then broadcasting it to Platform. +//! +//! This trait is expected to be implemented by objects that encapsulate the necessary data and logic to perform +//! these operations, including the handling of asset lock proof and signing operations. +use std::fmt::Debug; + +use dapi_grpc::platform::v0::{self as proto, BroadcastStateTransitionRequest}; +use dpp::dashcore::PrivateKey; +use dpp::identity::signer::Signer; +use dpp::native_bls::NativeBlsModule; +use dpp::prelude::{AssetLockProof, Identity}; +use dpp::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; +use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::state_transition::StateTransition; +use dpp::version::PlatformVersion; +use rs_dapi_client::transport::TransportRequest; + +use super::broadcast_request::BroadcastRequestForStateTransition; +use crate::error::Error; + +/// Trait implemented by objects that can be used to broadcast new identity state transitions. +/// +/// [BroadcastRequestForNewIdentity] trait is used when a new identity needs to be created and broadcasted on Platform. +/// It encapsulates the data, the signing process, and the logic required to perform the broadcast operation. +/// +/// Implementors of this trait will typically be responsible for creating an identity state transition, +/// signing it with the provided private key and signer, and preparing it for transport to Platform. +/// +/// ## Example +/// +/// To broadcast a new [Identity](dpp::prelude::Identity) state transition, you would typically +/// create an [IdentityCreateTransition](dpp::state_transition::identity_create_transition::IdentityCreateTransition), +/// sign it, and use the `broadcast_new_identity` method provided by this trait: +/// +/// ```rust, ignore +/// +/// use dash_sdk::{Sdk, platform::{BroadcastNewIdentity, IdentityCreateTransition}}; +/// use dpp::identity::signer::Signer; +/// use dpp::prelude::{AssetLockProof, PrivateKey}; +/// use dpp::version::PlatformVersion; +/// +/// let mut sdk = Sdk::new_mock(); +/// let asset_lock_proof = AssetLockProof::new(/* parameters for the asset lock proof */); +/// let private_key = PrivateKey::from(/* private key data */); +/// let signer = /* implementation of Signer trait */; +/// let platform_version = PlatformVersion::latest(); +/// +/// let identity_transition = IdentityCreateTransition::new(/* parameters for the transition */); +/// let result = identity_transition.broadcast_new_identity(asset_lock_proof, private_key, &signer, &platform_version); +/// +/// match result { +/// Ok(transport_request) => { +/// // The transport_request can now be sent to Platform to broadcast the new identity. +/// } +/// Err(e) => { +/// // Handle the error +/// } +/// } +/// ``` +/// +/// As [BroadcastRequestForNewIdentity] is a trait, it can be implemented for any type that represents +/// a new identity creation operation, allowing for flexibility in how new identities are broadcasted. +pub(crate) trait BroadcastRequestForNewIdentity: + Send + Debug + Clone +{ + /// Converts the current instance into an instance of the `TransportRequest` type, ready for broadcasting. + /// + /// This method takes ownership of the instance upon which it's called (hence `self`), and attempts to perform the conversion, + /// including signing the state transition with the provided private key and signer. + /// + /// # Arguments + /// + /// * `asset_lock_proof` - The proof that locks the asset which is used to create the identity. + /// * `asset_lock_proof_private_key` - The private key associated with the asset lock proof. + /// * `signer` - The signer to be used for signing the state transition. + /// * `platform_version` - The version of Platform for which the state transition is intended. + /// + /// # Returns + /// On success, this method yields an instance of the `TransportRequest` type (`T`), which can be used to broadcast the new identity state transition to Platform. + /// On failure, it yields an [`Error`]. + /// + /// # Error Handling + /// This method propagates any errors encountered during the signing or conversion process. + /// These are returned as [`Error`] instances. + fn broadcast_request_for_new_identity( + &self, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + signer: &S, + platform_version: &PlatformVersion, + ) -> Result<(StateTransition, BroadcastStateTransitionRequest), Error>; +} + +impl BroadcastRequestForNewIdentity + for Identity +{ + fn broadcast_request_for_new_identity( + &self, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + signer: &S, + platform_version: &PlatformVersion, + ) -> Result<(StateTransition, BroadcastStateTransitionRequest), Error> { + let identity_create_transition = IdentityCreateTransition::try_from_identity_with_signer( + self, + asset_lock_proof, + asset_lock_proof_private_key.inner.as_ref(), + signer, + &NativeBlsModule, + 0, + platform_version, + )?; + let request = identity_create_transition.broadcast_request_for_state_transition()?; + Ok((identity_create_transition, request)) + } +} diff --git a/packages/rs-sdk/src/platform/transition/broadcast_request.rs b/packages/rs-sdk/src/platform/transition/broadcast_request.rs new file mode 100644 index 00000000000..4218b4dbd5f --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/broadcast_request.rs @@ -0,0 +1,113 @@ +//! Broadcast trait representing the action of broadcasting a new identity state transition to Platform. +//! +//! The [BroadcastRequestForNewIdentity] trait is designed for the creation and broadcasting of new identity state transitions. +//! This involves the generation of a state transition object, signing it, and then broadcasting it to Platform. +//! +//! This trait is expected to be implemented by objects that encapsulate the necessary data and logic to perform +//! these operations, including the handling of asset lock proof and signing operations. +use std::fmt::Debug; + +use dapi_grpc::platform::v0::wait_for_state_transition_result_request::{ + Version, WaitForStateTransitionResultRequestV0, +}; +use dapi_grpc::platform::v0::{ + BroadcastStateTransitionRequest, WaitForStateTransitionResultRequest, +}; + +use dpp::serialization::PlatformSerializable; + +use dpp::state_transition::StateTransition; + +use crate::error::Error; + +/// Trait implemented by objects that can be used to broadcast new identity state transitions. +/// +/// [BroadcastRequestForNewIdentity] trait is used when a new identity needs to be created and broadcasted on Platform. +/// It encapsulates the data, the signing process, and the logic required to perform the broadcast operation. +/// +/// Implementors of this trait will typically be responsible for creating an identity state transition, +/// signing it with the provided private key and signer, and preparing it for transport to Platform. +/// +/// ## Example +/// +/// To broadcast a new [Identity](dpp::prelude::Identity) state transition, you would typically +/// create an [IdentityCreateTransition](dpp::state_transition::identity_create_transition::IdentityCreateTransition), +/// sign it, and use the `broadcast_new_identity` method provided by this trait: +/// +/// ```rust, ignore +/// +/// use dash_sdk::{Sdk, platform::{BroadcastNewIdentity, IdentityCreateTransition}}; +/// use dpp::identity::signer::Signer; +/// use dpp::prelude::{AssetLockProof, PrivateKey}; +/// use dpp::version::PlatformVersion; +/// +/// let mut sdk = Sdk::new_mock(); +/// let asset_lock_proof = AssetLockProof::new(/* parameters for the asset lock proof */); +/// let private_key = PrivateKey::from(/* private key data */); +/// let signer = /* implementation of Signer trait */; +/// let platform_version = PlatformVersion::latest(); +/// +/// let identity_transition = IdentityCreateTransition::new(/* parameters for the transition */); +/// let result = identity_transition.broadcast_new_identity(asset_lock_proof, private_key, &signer, &platform_version); +/// +/// match result { +/// Ok(transport_request) => { +/// // The transport_request can now be sent to Platform to broadcast the new identity. +/// } +/// Err(e) => { +/// // Handle the error +/// } +/// } +/// ``` +/// +/// As [BroadcastRequestForStateTransition] is a trait, it can be implemented for any type that represents +/// a new identity creation operation, allowing for flexibility in how new identities are broadcasted. +pub trait BroadcastRequestForStateTransition: Send + Debug + Clone { + /// Converts the current instance into an instance of the `TransportRequest` type, ready for broadcasting. + /// + /// This method takes ownership of the instance upon which it's called (hence `self`), and attempts to perform the conversion, + /// including signing the state transition with the provided private key and signer. + /// + /// # Arguments + /// + /// * `asset_lock_proof` - The proof that locks the asset which is used to create the identity. + /// * `asset_lock_proof_private_key` - The private key associated with the asset lock proof. + /// * `signer` - The signer to be used for signing the state transition. + /// * `platform_version` - The version of Platform for which the state transition is intended. + /// + /// # Returns + /// On success, this method yields an instance of the `TransportRequest` type (`T`), which can be used to broadcast the new identity state transition to Platform. + /// On failure, it yields an [`Error`]. + /// + /// # Error Handling + /// This method propagates any errors encountered during the signing or conversion process. + /// These are returned as [`Error`] instances. + fn broadcast_request_for_state_transition( + &self, + ) -> Result; + + fn wait_for_state_transition_result_request( + &self, + ) -> Result; +} + +impl BroadcastRequestForStateTransition for StateTransition { + fn broadcast_request_for_state_transition( + &self, + ) -> Result { + Ok(BroadcastStateTransitionRequest { + state_transition: self.serialize_to_bytes()?, + }) + } + + fn wait_for_state_transition_result_request( + &self, + ) -> Result { + Ok(WaitForStateTransitionResultRequest { + version: Some(Version::V0(WaitForStateTransitionResultRequestV0 { + state_transition_hash: self.transaction_id()?.to_vec(), + prove: true, + })), + }) + } +} diff --git a/packages/rs-sdk/src/platform/transition/context.rs b/packages/rs-sdk/src/platform/transition/context.rs new file mode 100644 index 00000000000..c2d3f27e82d --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/context.rs @@ -0,0 +1,5 @@ +//! Not sure if we need it at all + +pub enum TransitionContext { + Todo, +} diff --git a/packages/rs-sdk/src/platform/transition/purchase_document.rs b/packages/rs-sdk/src/platform/transition/purchase_document.rs new file mode 100644 index 00000000000..aa58b63b324 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/purchase_document.rs @@ -0,0 +1,181 @@ +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use std::sync::Arc; + +use crate::{Error, Sdk}; + +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::transition::put_settings::PutSettings; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::DocumentType; +use dpp::data_contract::DataContract; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::fee::Credits; +use dpp::identity::signer::Signer; +use dpp::identity::IdentityPublicKey; +use dpp::prelude::Identifier; +use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; +use drive::drive::Drive; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +/// A trait for purchasing a document on Platform +pub trait PurchaseDocument { + /// Tries to purchase a document on platform + /// Setting settings to `None` sets default connection behavior + async fn purchase_document( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + purchaser_id: Identifier, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result; + + /// Waits for the response of a state transition after it has been broadcast + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result; + + /// Tries to purchase a document on platform and waits for the response + async fn purchase_document_and_wait_for_response( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + purchaser_id: Identifier, + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result; +} + +#[async_trait::async_trait] +impl PurchaseDocument for Document { + async fn purchase_document( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + purchaser_id: Identifier, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result { + let new_identity_contract_nonce = sdk + .get_identity_contract_nonce( + purchaser_id, + document_type.data_contract_id(), + true, + settings, + ) + .await?; + + let settings = settings.unwrap_or_default(); + + let transition = DocumentsBatchTransition::new_document_purchase_transition_from_document( + self.clone(), + document_type.as_ref(), + purchaser_id, + price, + &identity_public_key, + new_identity_contract_nonce, + settings.user_fee_increase.unwrap_or_default(), + signer, + sdk.version(), + None, + None, + None, + )?; + + let request = transition.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, settings.request_settings) + .await?; + + // response is empty for a broadcast, result comes from the stream wait for state transition result + + Ok(transition) + } + + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result { + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + + let proof = response.proof_owned()?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &|_| Ok(Some(data_contract.clone())), + sdk.version(), + )?; + + match result { + StateTransitionProofResult::VerifiedDocuments(mut documents) => { + let document = documents + .remove(self.id_ref()) + .ok_or(Error::InvalidProvedResponse( + "did not prove the sent document".to_string(), + ))? + .ok_or(Error::InvalidProvedResponse( + "expected there to actually be a document".to_string(), + ))?; + Ok(document) + } + _ => Err(Error::DapiClientError("proved a non document".to_string())), + } + } + + async fn purchase_document_and_wait_for_response( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + purchaser_id: Identifier, + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result { + let state_transition = self + .purchase_document( + price, + sdk, + document_type, + purchaser_id, + identity_public_key, + signer, + None, + ) + .await?; + + let document = >::wait_for_response( + self, + sdk, + state_transition, + data_contract, + ) + .await?; + + Ok(document) + } +} diff --git a/packages/rs-sdk/src/platform/transition/put_contract.rs b/packages/rs-sdk/src/platform/transition/put_contract.rs new file mode 100644 index 00000000000..fb7e55b5bc0 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/put_contract.rs @@ -0,0 +1,145 @@ +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use std::collections::BTreeMap; + +use crate::{Error, Sdk}; + +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::transition::put_settings::PutSettings; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::DataContract; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::signer::Signer; +use dpp::identity::{IdentityPublicKey, PartialIdentity}; +use dpp::state_transition::data_contract_create_transition::methods::DataContractCreateTransitionMethodsV0; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; +use drive::drive::Drive; +use drive_proof_verifier::error::ContextProviderError; +use drive_proof_verifier::DataContractProvider; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +/// A trait for putting a contract to platform +pub trait PutContract { + /// Puts a document on platform + /// setting settings to `None` sets default connection behavior + async fn put_to_platform( + &self, + sdk: &Sdk, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result; + + /// Waits for the response of a state transition after it has been broadcast + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + ) -> Result; + + /// Puts a contract on platform and waits for the confirmation proof + async fn put_to_platform_and_wait_for_response( + &self, + sdk: &Sdk, + identity_public_key: IdentityPublicKey, + signer: &S, + ) -> Result; +} + +#[async_trait::async_trait] +impl PutContract for DataContract { + async fn put_to_platform( + &self, + sdk: &Sdk, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result { + let new_identity_nonce = sdk + .get_identity_nonce(self.owner_id(), true, settings) + .await?; + + let key_id = identity_public_key.id(); + + let partial_identity = PartialIdentity { + id: self.owner_id(), + loaded_public_keys: BTreeMap::from([(key_id, identity_public_key)]), + balance: None, + revision: None, + not_found_public_keys: Default::default(), + }; + let transition = DataContractCreateTransition::new_from_data_contract( + self.clone(), + new_identity_nonce, + &partial_identity, + key_id, + signer, + sdk.version(), + None, + )?; + + let request = transition.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, settings.unwrap_or_default().request_settings) + .await?; + + // response is empty for a broadcast, result comes from the stream wait for state transition result + + Ok(transition) + } + + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + ) -> Result { + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + + let proof = response.proof_owned()?; + let context_provider = + sdk.context_provider() + .ok_or(Error::from(ContextProviderError::Config( + "Context provider not initialized".to_string(), + )))?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &context_provider.as_contract_lookup_fn(), + sdk.version(), + )?; + + //todo verify + + match result { + StateTransitionProofResult::VerifiedDataContract(data_contract) => Ok(data_contract), + _ => Err(Error::DapiClientError("proved a non document".to_string())), + } + } + + async fn put_to_platform_and_wait_for_response( + &self, + sdk: &Sdk, + identity_public_key: IdentityPublicKey, + signer: &S, + ) -> Result { + let state_transition = self + .put_to_platform(sdk, identity_public_key, signer, None) + .await?; + + let data_contract = + >::wait_for_response(self, sdk, state_transition).await?; + + Ok(data_contract) + } +} diff --git a/packages/rs-sdk/src/platform/transition/put_document.rs b/packages/rs-sdk/src/platform/transition/put_document.rs new file mode 100644 index 00000000000..7c9fecac3a7 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/put_document.rs @@ -0,0 +1,172 @@ +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use std::sync::Arc; + +use crate::{Error, Sdk}; + +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::transition::put_settings::PutSettings; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::DocumentType; +use dpp::data_contract::DataContract; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::identity::signer::Signer; +use dpp::identity::IdentityPublicKey; +use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; +use drive::drive::Drive; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +/// A trait for putting a document to platform +pub trait PutDocument { + /// Puts a document on platform + /// setting settings to `None` sets default connection behavior + async fn put_to_platform( + &self, + sdk: &Sdk, + document_type: DocumentType, + document_state_transition_entropy: [u8; 32], + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result; + + /// Waits for the response of a state transition after it has been broadcast + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result; + + /// Puts an identity on platform and waits for the confirmation proof + async fn put_to_platform_and_wait_for_response( + &self, + sdk: &Sdk, + document_type: DocumentType, + document_state_transition_entropy: [u8; 32], + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result; +} + +#[async_trait::async_trait] +impl PutDocument for Document { + async fn put_to_platform( + &self, + sdk: &Sdk, + document_type: DocumentType, + document_state_transition_entropy: [u8; 32], + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result { + let new_identity_contract_nonce = sdk + .get_identity_contract_nonce( + self.owner_id(), + document_type.data_contract_id(), + true, + settings, + ) + .await?; + + let settings = settings.unwrap_or_default(); + + let transition = DocumentsBatchTransition::new_document_creation_transition_from_document( + self.clone(), + document_type.as_ref(), + document_state_transition_entropy, + &identity_public_key, + new_identity_contract_nonce, + settings.user_fee_increase.unwrap_or_default(), + signer, + sdk.version(), + None, + None, + None, + )?; + + let request = transition.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, settings.request_settings) + .await?; + + // response is empty for a broadcast, result comes from the stream wait for state transition result + + Ok(transition) + } + + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result { + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + + let proof = response.proof_owned()?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &|_| Ok(Some(data_contract.clone())), + sdk.version(), + )?; + + //todo verify + + match result { + StateTransitionProofResult::VerifiedDocuments(mut documents) => { + let document = documents + .remove(self.id_ref()) + .ok_or(Error::InvalidProvedResponse( + "did not prove the sent document".to_string(), + ))? + .ok_or(Error::InvalidProvedResponse( + "expected there to actually be a document".to_string(), + ))?; + Ok(document) + } + _ => Err(Error::DapiClientError("proved a non document".to_string())), + } + } + + async fn put_to_platform_and_wait_for_response( + &self, + sdk: &Sdk, + document_type: DocumentType, + document_state_transition_entropy: [u8; 32], + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result { + let state_transition = self + .put_to_platform( + sdk, + document_type, + document_state_transition_entropy, + identity_public_key, + signer, + None, + ) + .await?; + + // TODO: Why do we need full type annotation? + let document = + >::wait_for_response(self, sdk, state_transition, data_contract) + .await?; + + Ok(document) + } +} diff --git a/packages/rs-sdk/src/platform/transition/put_identity.rs b/packages/rs-sdk/src/platform/transition/put_identity.rs new file mode 100644 index 00000000000..59422aa6b2b --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/put_identity.rs @@ -0,0 +1,129 @@ +use crate::platform::transition::broadcast_identity::BroadcastRequestForNewIdentity; +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use crate::platform::Fetch; +use crate::{Error, Sdk}; + +use dapi_grpc::platform::VersionedGrpcResponse; +use dapi_grpc::tonic::Code; +use dpp::dashcore::PrivateKey; +use dpp::identity::signer::Signer; +use dpp::prelude::{AssetLockProof, Identity}; +use drive_proof_verifier::error::ContextProviderError; +use drive_proof_verifier::DataContractProvider; + +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use drive::drive::Drive; +use rs_dapi_client::{DapiClientError, DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +/// A trait for putting an identity to platform +pub trait PutIdentity { + /// Puts an identity on platform + async fn put_to_platform( + &self, + sdk: &Sdk, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + signer: &S, + ) -> Result<(), Error>; + /// Puts an identity on platform and waits for the confirmation proof + async fn put_to_platform_and_wait_for_response( + &self, + sdk: &Sdk, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + signer: &S, + ) -> Result; +} + +#[async_trait::async_trait] +impl PutIdentity for Identity { + async fn put_to_platform( + &self, + sdk: &Sdk, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + signer: &S, + ) -> Result<(), Error> { + let (_, request) = self.broadcast_request_for_new_identity( + asset_lock_proof, + asset_lock_proof_private_key, + signer, + sdk.version(), + )?; + + request + .clone() + .execute(sdk, RequestSettings::default()) + .await?; + + // response is empty for a broadcast, result comes from the stream wait for state transition result + + Ok(()) + } + + async fn put_to_platform_and_wait_for_response( + &self, + sdk: &Sdk, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + signer: &S, + ) -> Result { + let identity_id = asset_lock_proof.create_identifier()?; + let (state_transition, request) = self.broadcast_request_for_new_identity( + asset_lock_proof, + asset_lock_proof_private_key, + signer, + sdk.version(), + )?; + + let response_result = request + .clone() + .execute(sdk, RequestSettings::default()) + .await; + + match response_result { + Ok(_) => {} + //todo make this more reliable + Err(DapiClientError::Transport(te, _)) if te.code() == Code::AlreadyExists => { + tracing::debug!( + ?identity_id, + "attempt to create identity that already exists" + ); + let identity = Identity::fetch(sdk, identity_id).await?; + return identity.ok_or(Error::DapiClientError( + "identity was proved to not exist but was said to exist".to_string(), + )); + } + Err(e) => return Err(e.into()), + } + + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + let proof = response.proof_owned()?; + let context_provider = + sdk.context_provider() + .ok_or(Error::from(ContextProviderError::Config( + "Context provider not initialized".to_string(), + )))?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &context_provider.as_contract_lookup_fn(), + sdk.version(), + )?; + + //todo verify + + match result { + StateTransitionProofResult::VerifiedIdentity(identity) => Ok(identity), + _ => Err(Error::DapiClientError("proved a non identity".to_string())), + } + } +} diff --git a/packages/rs-sdk/src/platform/transition/put_settings.rs b/packages/rs-sdk/src/platform/transition/put_settings.rs new file mode 100644 index 00000000000..7ddaef7a687 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/put_settings.rs @@ -0,0 +1,10 @@ +use dpp::prelude::UserFeeIncrease; +use rs_dapi_client::RequestSettings; + +/// The options when putting something to platform +#[derive(Debug, Clone, Copy, Default)] +pub struct PutSettings { + pub request_settings: RequestSettings, + pub identity_nonce_stale_time_s: Option, + pub user_fee_increase: Option, +} diff --git a/packages/rs-sdk/src/platform/transition/top_up_identity.rs b/packages/rs-sdk/src/platform/transition/top_up_identity.rs new file mode 100644 index 00000000000..48145234f49 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/top_up_identity.rs @@ -0,0 +1,82 @@ +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use crate::{Error, Sdk}; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::dashcore::PrivateKey; +use dpp::identity::Identity; +use dpp::prelude::{AssetLockProof, UserFeeIncrease}; +use dpp::state_transition::identity_topup_transition::methods::IdentityTopUpTransitionMethodsV0; +use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use drive::drive::Drive; +use drive_proof_verifier::error::ContextProviderError; +use drive_proof_verifier::DataContractProvider; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +pub trait TopUpIdentity { + async fn top_up_identity( + &self, + sdk: &Sdk, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + user_fee_increase: Option, + ) -> Result; +} + +#[async_trait::async_trait] +impl TopUpIdentity for Identity { + async fn top_up_identity( + &self, + sdk: &Sdk, + asset_lock_proof: AssetLockProof, + asset_lock_proof_private_key: &PrivateKey, + user_fee_increase: Option, + ) -> Result { + let state_transition = IdentityTopUpTransition::try_from_identity( + self, + asset_lock_proof, + asset_lock_proof_private_key.inner.as_ref(), + user_fee_increase.unwrap_or_default(), + sdk.version(), + None, + )?; + + let request = state_transition.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, RequestSettings::default()) + .await?; + + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + + let proof = response.proof_owned()?; + let context_provider = + sdk.context_provider() + .ok_or(Error::from(ContextProviderError::Config( + "Context provider not initialized".to_string(), + )))?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &context_provider.as_contract_lookup_fn(), + sdk.version(), + )?; + + match result { + StateTransitionProofResult::VerifiedPartialIdentity(identity) => { + identity.balance.ok_or(Error::DapiClientError( + "expected an identity balance".to_string(), + )) + } + _ => Err(Error::DapiClientError("proved a non identity".to_string())), + } + } +} diff --git a/packages/rs-sdk/src/platform/transition/transfer_document.rs b/packages/rs-sdk/src/platform/transition/transfer_document.rs new file mode 100644 index 00000000000..140a6e31663 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/transfer_document.rs @@ -0,0 +1,174 @@ +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use std::sync::Arc; + +use crate::{Error, Sdk}; + +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::transition::put_settings::PutSettings; +use crate::platform::Identifier; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::DocumentType; +use dpp::data_contract::DataContract; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::identity::signer::Signer; +use dpp::identity::IdentityPublicKey; +use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; +use drive::drive::Drive; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +/// A trait for transferring a document on Platform +pub trait TransferDocument { + /// Transfers a document on platform + /// Setting settings to `None` sets default connection behavior + async fn transfer_document_to_identity( + &self, + recipient_id: Identifier, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result; + + /// Waits for the response of a state transition after it has been broadcast + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result; + + /// Transfers a document on platform and waits for the response + async fn transfer_document_to_identity_and_wait_for_response( + &self, + recipient_id: Identifier, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result; +} + +#[async_trait::async_trait] +impl TransferDocument for Document { + async fn transfer_document_to_identity( + &self, + recipient_id: Identifier, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result { + let new_identity_contract_nonce = sdk + .get_identity_contract_nonce( + self.owner_id(), + document_type.data_contract_id(), + true, + settings, + ) + .await?; + + let settings = settings.unwrap_or_default(); + + let transition = DocumentsBatchTransition::new_document_transfer_transition_from_document( + self.clone(), + document_type.as_ref(), + recipient_id, + &identity_public_key, + new_identity_contract_nonce, + settings.user_fee_increase.unwrap_or_default(), + signer, + sdk.version(), + None, + None, + None, + )?; + + let request = transition.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, settings.request_settings) + .await?; + + // response is empty for a broadcast, result comes from the stream wait for state transition result + + Ok(transition) + } + + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result { + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + + let proof = response.proof_owned()?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &|_| Ok(Some(data_contract.clone())), + sdk.version(), + )?; + + match result { + StateTransitionProofResult::VerifiedDocuments(mut documents) => { + let document = documents + .remove(self.id_ref()) + .ok_or(Error::InvalidProvedResponse( + "did not prove the sent document".to_string(), + ))? + .ok_or(Error::InvalidProvedResponse( + "expected there to actually be a document".to_string(), + ))?; + Ok(document) + } + _ => Err(Error::DapiClientError("proved a non document".to_string())), + } + } + + async fn transfer_document_to_identity_and_wait_for_response( + &self, + recipient_id: Identifier, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result { + let state_transition = self + .transfer_document_to_identity( + recipient_id, + sdk, + document_type, + identity_public_key, + signer, + None, + ) + .await?; + + let document = >::wait_for_response( + self, + sdk, + state_transition, + data_contract, + ) + .await?; + + Ok(document) + } +} diff --git a/packages/rs-sdk/src/platform/transition/txid.rs b/packages/rs-sdk/src/platform/transition/txid.rs new file mode 100644 index 00000000000..8bca9b7ba18 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/txid.rs @@ -0,0 +1,22 @@ +use crate::Sdk; + +/// State transition identifier +pub struct TxId([u8; 32]); +impl TxId { + /// Checks if the state transition is confirmed + pub fn is_confirmed(&self, _sdk: &Sdk) -> bool { + todo!("Not implemented") + } +} + +impl From for [u8; 32] { + fn from(tx_id: TxId) -> Self { + tx_id.0 + } +} + +impl From<[u8; 32]> for TxId { + fn from(value: [u8; 32]) -> Self { + TxId(value) + } +} diff --git a/packages/rs-sdk/src/platform/transition/update_price_of_document.rs b/packages/rs-sdk/src/platform/transition/update_price_of_document.rs new file mode 100644 index 00000000000..93da9aaf2b7 --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/update_price_of_document.rs @@ -0,0 +1,168 @@ +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use std::sync::Arc; + +use crate::{Error, Sdk}; + +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::transition::put_settings::PutSettings; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::DocumentType; +use dpp::data_contract::DataContract; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::fee::Credits; +use dpp::identity::signer::Signer; +use dpp::identity::IdentityPublicKey; +use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; +use drive::drive::Drive; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +/// A trait for updating the price of a document on Platform +pub trait UpdatePriceOfDocument { + /// Updates the price of a document on platform + /// Setting settings to `None` sets default connection behavior + async fn update_price_of_document( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result; + + /// Waits for the response of a state transition after it has been broadcast + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result; + + /// Updates the price of a document on platform and waits for the response + async fn update_price_of_document_and_wait_for_response( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result; +} + +#[async_trait::async_trait] +impl UpdatePriceOfDocument for Document { + async fn update_price_of_document( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + signer: &S, + settings: Option, + ) -> Result { + let new_identity_contract_nonce = sdk + .get_identity_contract_nonce( + self.owner_id(), + document_type.data_contract_id(), + true, + settings, + ) + .await?; + + let settings = settings.unwrap_or_default(); + + let transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + self.clone(), + document_type.as_ref(), + price, + &identity_public_key, + new_identity_contract_nonce, + settings.user_fee_increase.unwrap_or_default(), + signer, + sdk.version(), + None, + None, + None, + )?; + + let request = transition.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, settings.request_settings) + .await?; + + // response is empty for a broadcast, result comes from the stream wait for state transition result + + Ok(transition) + } + + async fn wait_for_response( + &self, + sdk: &Sdk, + state_transition: StateTransition, + data_contract: Arc, + ) -> Result { + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + + let proof = response.proof_owned()?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &|_| Ok(Some(data_contract.clone())), + sdk.version(), + )?; + + match result { + StateTransitionProofResult::VerifiedDocuments(mut documents) => { + let document = documents + .remove(self.id_ref()) + .ok_or(Error::InvalidProvedResponse( + "did not prove the sent document".to_string(), + ))? + .ok_or(Error::InvalidProvedResponse( + "expected there to actually be a document".to_string(), + ))?; + Ok(document) + } + _ => Err(Error::DapiClientError("proved a non document".to_string())), + } + } + + async fn update_price_of_document_and_wait_for_response( + &self, + price: Credits, + sdk: &Sdk, + document_type: DocumentType, + identity_public_key: IdentityPublicKey, + data_contract: Arc, + signer: &S, + ) -> Result { + let state_transition = self + .update_price_of_document(price, sdk, document_type, identity_public_key, signer, None) + .await?; + + let document = >::wait_for_response( + self, + sdk, + state_transition, + data_contract, + ) + .await?; + + Ok(document) + } +} diff --git a/packages/rs-sdk/src/platform/transition/vote.rs b/packages/rs-sdk/src/platform/transition/vote.rs new file mode 100644 index 00000000000..56864a760ca --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/vote.rs @@ -0,0 +1,167 @@ +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::query::VoteQuery; +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use crate::platform::transition::put_settings::PutSettings; +use crate::platform::Fetch; +use crate::{Error, Sdk}; +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::identifier::MasternodeIdentifiers; +use dpp::identity::hash::IdentityPublicKeyHashMethodsV0; +use dpp::identity::signer::Signer; +use dpp::identity::IdentityPublicKey; +use dpp::prelude::Identifier; +use dpp::state_transition::masternode_vote_transition::methods::MasternodeVoteTransitionMethodsV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; +use dpp::voting::votes::Vote; +use drive::drive::Drive; +use drive_proof_verifier::{error::ContextProviderError, DataContractProvider}; +use rs_dapi_client::DapiRequest; + +#[async_trait::async_trait] +/// A trait for putting a vote on platform +pub trait PutVote { + /// Puts an identity on platform + async fn put_to_platform( + &self, + voter_pro_tx_hash: Identifier, + voting_public_key: &IdentityPublicKey, + sdk: &Sdk, + signer: &S, + settings: Option, + ) -> Result<(), Error>; + /// Puts an identity on platform and waits for the confirmation proof + async fn put_to_platform_and_wait_for_response( + &self, + voter_pro_tx_hash: Identifier, + voting_public_key: &IdentityPublicKey, + sdk: &Sdk, + signer: &S, + settings: Option, + ) -> Result; +} + +#[async_trait::async_trait] +impl PutVote for Vote { + async fn put_to_platform( + &self, + voter_pro_tx_hash: Identifier, + voting_public_key: &IdentityPublicKey, + sdk: &Sdk, + signer: &S, + settings: Option, + ) -> Result<(), Error> { + let voting_identity_id = get_voting_identity_id(voter_pro_tx_hash, voting_public_key)?; + + let new_masternode_voting_nonce = sdk + .get_identity_nonce(voting_identity_id, true, settings) + .await?; + + let settings = settings.unwrap_or_default(); + + let masternode_vote_transition = MasternodeVoteTransition::try_from_vote_with_signer( + self.clone(), + signer, + voter_pro_tx_hash, + voting_public_key, + new_masternode_voting_nonce, + sdk.version(), + None, + )?; + let request = masternode_vote_transition.broadcast_request_for_state_transition()?; + + request.execute(sdk, settings.request_settings).await?; + + Ok(()) + } + + async fn put_to_platform_and_wait_for_response( + &self, + voter_pro_tx_hash: Identifier, + voting_public_key: &IdentityPublicKey, + sdk: &Sdk, + signer: &S, + settings: Option, + ) -> Result { + let voting_identity_id = get_voting_identity_id(voter_pro_tx_hash, voting_public_key)?; + + let new_masternode_voting_nonce = sdk + .get_identity_nonce(voting_identity_id, true, settings) + .await?; + + let settings = settings.unwrap_or_default(); + + let Vote::ResourceVote(resource_vote) = self; + let vote_poll_id = resource_vote.vote_poll().unique_id()?; + + let masternode_vote_transition = MasternodeVoteTransition::try_from_vote_with_signer( + self.clone(), + signer, + voter_pro_tx_hash, + voting_public_key, + new_masternode_voting_nonce, + sdk.version(), + None, + )?; + let request = masternode_vote_transition.broadcast_request_for_state_transition()?; + + let response_result = request.execute(sdk, settings.request_settings).await; + + match response_result { + Ok(_) => {} + //todo make this more reliable + Err(e) => { + return if e.to_string().contains("already exists") { + let vote = + Vote::fetch(sdk, VoteQuery::new(voter_pro_tx_hash, vote_poll_id)).await?; + vote.ok_or(Error::DapiClientError( + "vote was proved to not exist but was said to exist".to_string(), + )) + } else { + Err(e.into()) + } + } + } + + let request = masternode_vote_transition.wait_for_state_transition_result_request()?; + let response = request.execute(sdk, settings.request_settings).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + let proof = response.proof_owned()?; + let context_provider = + sdk.context_provider() + .ok_or(Error::from(ContextProviderError::Config( + "Context provider not initialized".to_string(), + )))?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &masternode_vote_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &context_provider.as_contract_lookup_fn(), + sdk.version(), + )?; + + //todo verify + + match result { + StateTransitionProofResult::VerifiedMasternodeVote(vote) => Ok(vote), + _ => Err(Error::DapiClientError( + "proved something that was not a vote".to_string(), + )), + } + } +} + +fn get_voting_identity_id( + voter_pro_tx_hash: Identifier, + voting_public_key: &IdentityPublicKey, +) -> Result { + let pub_key_hash = voting_public_key.public_key_hash()?; + + Ok(Identifier::create_voter_identifier( + voter_pro_tx_hash.as_bytes(), + &pub_key_hash, + )) +} diff --git a/packages/rs-sdk/src/platform/transition/withdraw_from_identity.rs b/packages/rs-sdk/src/platform/transition/withdraw_from_identity.rs new file mode 100644 index 00000000000..1dbff8c3ead --- /dev/null +++ b/packages/rs-sdk/src/platform/transition/withdraw_from_identity.rs @@ -0,0 +1,103 @@ +use dapi_grpc::platform::VersionedGrpcResponse; +use dpp::dashcore::Address; +use dpp::identity::accessors::IdentityGettersV0; + +use dpp::identity::core_script::CoreScript; +use dpp::identity::signer::Signer; +use dpp::identity::Identity; +use dpp::prelude::UserFeeIncrease; + +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use drive_proof_verifier::error::ContextProviderError; +use drive_proof_verifier::DataContractProvider; + +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use crate::platform::transition::put_settings::PutSettings; +use crate::{Error, Sdk}; +use dpp::state_transition::identity_credit_withdrawal_transition::methods::IdentityCreditWithdrawalTransitionMethodsV0; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::withdrawal::Pooling; +use drive::drive::Drive; +use rs_dapi_client::{DapiRequest, RequestSettings}; + +#[async_trait::async_trait] +pub trait WithdrawFromIdentity { + /// Function to withdraw credits from an identity. Returns the final identity balance. + async fn withdraw( + &self, + sdk: &Sdk, + address: Address, + amount: u64, + core_fee_per_byte: Option, + user_fee_increase: Option, + signer: S, + settings: Option, + ) -> Result; +} + +#[async_trait::async_trait] +impl WithdrawFromIdentity for Identity { + async fn withdraw( + &self, + sdk: &Sdk, + address: Address, + amount: u64, + core_fee_per_byte: Option, + user_fee_increase: Option, + signer: S, + settings: Option, + ) -> Result { + let new_identity_nonce = sdk.get_identity_nonce(self.id(), true, settings).await?; + let state_transition = IdentityCreditWithdrawalTransition::try_from_identity( + self, + None, + CoreScript::new(address.script_pubkey()), + amount, + Pooling::Never, + core_fee_per_byte.unwrap_or(1), + user_fee_increase.unwrap_or_default(), + signer, + new_identity_nonce, + sdk.version(), + None, + )?; + + let request = state_transition.broadcast_request_for_state_transition()?; + + request + .clone() + .execute(sdk, settings.unwrap_or_default().request_settings) + .await?; + + let request = state_transition.wait_for_state_transition_result_request()?; + + let response = request.execute(sdk, RequestSettings::default()).await?; + + let block_info = block_info_from_metadata(response.metadata()?)?; + + let proof = response.proof_owned()?; + let context_provider = + sdk.context_provider() + .ok_or(Error::from(ContextProviderError::Config( + "Context provider not initialized".to_string(), + )))?; + + let (_, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + proof.grovedb_proof.as_slice(), + &context_provider.as_contract_lookup_fn(), + sdk.version(), + )?; + + match result { + StateTransitionProofResult::VerifiedPartialIdentity(identity) => { + identity.balance.ok_or(Error::DapiClientError( + "expected an identity balance".to_string(), + )) + } + _ => Err(Error::DapiClientError("proved a non identity".to_string())), + } + } +} diff --git a/packages/rs-sdk/src/platform/types.rs b/packages/rs-sdk/src/platform/types.rs index 4b4aa76427f..13e49fafed2 100644 --- a/packages/rs-sdk/src/platform/types.rs +++ b/packages/rs-sdk/src/platform/types.rs @@ -1,3 +1,5 @@ //! Type-specific implementation for various dpp object types to make queries more convenient and intuitive. +pub mod epoch; pub mod identity; +mod total_credits_in_platform; pub mod version_votes; diff --git a/packages/rs-sdk/src/platform/types/epoch.rs b/packages/rs-sdk/src/platform/types/epoch.rs new file mode 100644 index 00000000000..7026f2e5516 --- /dev/null +++ b/packages/rs-sdk/src/platform/types/epoch.rs @@ -0,0 +1,90 @@ +//! Epoch-related types and helpers +use async_trait::async_trait; +use dapi_grpc::platform::v0::{GetEpochsInfoRequest, Proof, ResponseMetadata}; +use dpp::block::{epoch::EpochIndex, extended_epoch_info::ExtendedEpochInfo}; + +use crate::platform::fetch_current_no_parameters::FetchCurrent; +use crate::{ + platform::{Fetch, LimitQuery, Query}, + Error, Sdk, +}; + +#[async_trait] +impl FetchCurrent for ExtendedEpochInfo { + async fn fetch_current(sdk: &Sdk) -> Result { + let (epoch, _) = Self::fetch_current_with_metadata(sdk).await?; + Ok(epoch) + } + + async fn fetch_current_with_metadata(sdk: &Sdk) -> Result<(Self, ResponseMetadata), Error> { + let query = LimitQuery { + query: EpochQuery { + start: None, + ascending: false, + }, + limit: Some(1), + start_info: None, + }; + + let (epoch, metadata) = Self::fetch_with_metadata(sdk, query, None).await?; + + Ok((epoch.ok_or(Error::EpochNotFound)?, metadata)) + } + + async fn fetch_current_with_metadata_and_proof( + sdk: &Sdk, + ) -> Result<(Self, ResponseMetadata, Proof), Error> { + let query = LimitQuery { + query: EpochQuery { + start: None, + ascending: false, + }, + limit: Some(1), + start_info: None, + }; + + let (epoch, metadata, proof) = + Self::fetch_with_metadata_and_proof(sdk, query, None).await?; + + Ok((epoch.ok_or(Error::EpochNotFound)?, metadata, proof)) + } +} +/// Query used to fetch multiple epochs from Platform. +#[derive(Clone, Debug)] +pub struct EpochQuery { + /// Starting number of epoch to fetch. + /// + /// It is first returned epoch in the set. + /// + /// Value of `None` has the following meaning: + /// + /// * if ascending is true, then it is the first epoch on Platform (eg. epoch 0). + /// * if ascending is false, then it is the last epoch on Platform (eg. most recent epoch). + pub start: Option, + /// Sort order. Default is ascending (true), which means that the first returned epoch is the oldest one. + pub ascending: bool, +} + +impl Default for EpochQuery { + fn default() -> Self { + Self { + start: None, + ascending: true, + } + } +} + +impl From for EpochQuery { + fn from(start: EpochIndex) -> Self { + Self { + start: Some(start), + ascending: true, + } + } +} + +impl Query for EpochQuery { + fn query(self, prove: bool) -> Result { + LimitQuery::from(self).query(prove) + } +} diff --git a/packages/rs-sdk/src/platform/types/identity.rs b/packages/rs-sdk/src/platform/types/identity.rs index d64e8e6c252..01599307c1a 100644 --- a/packages/rs-sdk/src/platform/types/identity.rs +++ b/packages/rs-sdk/src/platform/types/identity.rs @@ -1,23 +1,25 @@ //! Identity related types and functions +use crate::delegate_enum; +use crate::{ + platform::{proto, Query}, + Error, +}; use dapi_grpc::platform::v0::get_identity_balance_and_revision_request::GetIdentityBalanceAndRevisionRequestV0; use dapi_grpc::platform::v0::get_identity_balance_request::GetIdentityBalanceRequestV0; use dapi_grpc::platform::v0::get_identity_by_public_key_hash_request::GetIdentityByPublicKeyHashRequestV0; +use dapi_grpc::platform::v0::get_identity_contract_nonce_request::GetIdentityContractNonceRequestV0; +use dapi_grpc::platform::v0::get_identity_nonce_request::GetIdentityNonceRequestV0; use dapi_grpc::platform::v0::get_identity_request::GetIdentityRequestV0; use dapi_grpc::platform::v0::{ get_identity_balance_and_revision_request, get_identity_balance_request, - get_identity_by_public_key_hash_request, get_identity_request, - GetIdentityBalanceAndRevisionRequest, GetIdentityBalanceRequest, - GetIdentityByPublicKeyHashRequest, GetIdentityRequest, + get_identity_by_public_key_hash_request, get_identity_contract_nonce_request, + get_identity_nonce_request, get_identity_request, GetIdentityBalanceAndRevisionRequest, + GetIdentityBalanceRequest, GetIdentityByPublicKeyHashRequest, GetIdentityContractNonceRequest, + GetIdentityNonceRequest, GetIdentityRequest, ResponseMetadata, }; use dpp::prelude::Identity; -use crate::delegate_enum; -use crate::{ - platform::{proto, Query}, - Error, -}; - // Create enum [IdentityRequest] and [IdentityResponse] that will wrap all possible // request/response types for [Identity] object. delegate_enum! { @@ -85,6 +87,48 @@ impl Query for dpp::prelude::Identifier { } } +impl Query for dpp::prelude::Identifier { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + let request: GetIdentityNonceRequest = GetIdentityNonceRequest { + version: Some(get_identity_nonce_request::Version::V0( + GetIdentityNonceRequestV0 { + identity_id: self.to_vec(), + prove, + }, + )), + }; + + Ok(request) + } +} + +impl Query + for (dpp::prelude::Identifier, dpp::prelude::Identifier) +{ + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + let (identity_id, contract_id) = self; + + let request: GetIdentityContractNonceRequest = GetIdentityContractNonceRequest { + version: Some(get_identity_contract_nonce_request::Version::V0( + GetIdentityContractNonceRequestV0 { + identity_id: identity_id.to_vec(), + contract_id: contract_id.to_vec(), + prove, + }, + )), + }; + + Ok(request) + } +} + impl Query for dpp::prelude::Identifier { fn query(self, prove: bool) -> Result { if !prove { diff --git a/packages/rs-sdk/src/platform/types/total_credits_in_platform.rs b/packages/rs-sdk/src/platform/types/total_credits_in_platform.rs new file mode 100644 index 00000000000..ebfd7879674 --- /dev/null +++ b/packages/rs-sdk/src/platform/types/total_credits_in_platform.rs @@ -0,0 +1,33 @@ +//! Epoch-related types and helpers +use crate::platform::fetch_current_no_parameters::FetchCurrent; +use crate::{platform::Fetch, Error, Sdk}; +use async_trait::async_trait; +use dapi_grpc::platform::v0::{Proof, ResponseMetadata}; +use drive_proof_verifier::types::{NoParamQuery, TotalCreditsInPlatform}; + +#[async_trait] +impl FetchCurrent for TotalCreditsInPlatform { + async fn fetch_current(sdk: &Sdk) -> Result { + let (total_credits_on_platform, _) = Self::fetch_current_with_metadata(sdk).await?; + Ok(total_credits_on_platform) + } + + async fn fetch_current_with_metadata(sdk: &Sdk) -> Result<(Self, ResponseMetadata), Error> { + let (total_credits_on_platform, metadata) = + Self::fetch_with_metadata(sdk, NoParamQuery {}, None).await?; + + Ok(( + total_credits_on_platform.ok_or(Error::TotalCreditsNotFound)?, + metadata, + )) + } + + async fn fetch_current_with_metadata_and_proof( + sdk: &Sdk, + ) -> Result<(Self, ResponseMetadata, Proof), Error> { + let (epoch, metadata, proof) = + Self::fetch_with_metadata_and_proof(sdk, NoParamQuery {}, None).await?; + + Ok((epoch.ok_or(Error::TotalCreditsNotFound)?, metadata, proof)) + } +} diff --git a/packages/rs-sdk/src/platform/types/version_votes.rs b/packages/rs-sdk/src/platform/types/version_votes.rs index 92338ec98d7..36beda102c3 100644 --- a/packages/rs-sdk/src/platform/types/version_votes.rs +++ b/packages/rs-sdk/src/platform/types/version_votes.rs @@ -11,7 +11,7 @@ use drive_proof_verifier::types::{MasternodeProtocolVote, MasternodeProtocolVote /// Helper trait for managing MasternodeProtocolVote objects #[async_trait] pub trait MasternodeProtocolVoteEx { - /// Fetch masternode votes for version update from the platform. + /// Fetch masternode votes for version update from Platform. /// /// ## Parameters /// @@ -26,7 +26,7 @@ pub trait MasternodeProtocolVoteEx { /// - [MasternodeProtocolVote::fetch_many()] /// - [MasternodeProtocolVote::fetch_many_with_limit()] async fn fetch_votes( - sdk: &mut Sdk, + sdk: &Sdk, start_protxhash: Option, limit: Option, ) -> Result; @@ -35,7 +35,7 @@ pub trait MasternodeProtocolVoteEx { #[async_trait] impl MasternodeProtocolVoteEx for MasternodeProtocolVote { async fn fetch_votes( - sdk: &mut Sdk, + sdk: &Sdk, start_protxhash: Option, limit: Option, ) -> Result { @@ -44,6 +44,7 @@ impl MasternodeProtocolVoteEx for MasternodeProtocolVote { LimitQuery { query: start_protxhash, limit, + start_info: None, }, ) .await @@ -53,7 +54,7 @@ impl MasternodeProtocolVoteEx for MasternodeProtocolVote { #[async_trait] impl MasternodeProtocolVoteEx for MasternodeProtocolVotes { async fn fetch_votes( - sdk: &mut Sdk, + sdk: &Sdk, start_protxhash: Option, limit: Option, ) -> Result { diff --git a/packages/rs-sdk/src/sdk.rs b/packages/rs-sdk/src/sdk.rs index 2408d2e69d9..fb8bd7fed8b 100644 --- a/packages/rs-sdk/src/sdk.rs +++ b/packages/rs-sdk/src/sdk.rs @@ -1,31 +1,58 @@ //! [Sdk] entrypoint to Dash Platform. +use crate::error::Error; +use crate::internal_cache::InternalSdkCache; +use crate::mock::MockResponse; #[cfg(feature = "mocks")] -use std::{ - path::{Path, PathBuf}, - sync::Arc, -}; - -#[cfg(feature = "mocks")] -use crate::mock::MockDashPlatformSdk; -use crate::mock::{MockRequest, MockResponse}; -use crate::{core::CoreClient, error::Error}; +use crate::mock::{provider::GrpcContextProvider, MockDashPlatformSdk}; +use crate::platform::transition::put_settings::PutSettings; +use crate::platform::{Fetch, Identifier}; +use dapi_grpc::mock::Mockable; +use dapi_grpc::platform::v0::{Proof, ResponseMetadata}; +use dpp::bincode; +use dpp::bincode::error::DecodeError; +use dpp::dashcore::Network; +use dpp::identity::identity_nonce::IDENTITY_NONCE_VALUE_FILTER; +use dpp::prelude::IdentityNonce; use dpp::version::{PlatformVersion, PlatformVersionCurrentVersion}; +use drive::grovedb::operations::proof::GroveDBProof; +use drive_proof_verifier::types::{IdentityContractNonceFetcher, IdentityNonceFetcher}; #[cfg(feature = "mocks")] -use drive_proof_verifier::MockQuorumInfoProvider; -use drive_proof_verifier::{FromProof, QuorumInfoProvider}; -#[cfg(feature = "mocks")] -use hex::ToHex; +use drive_proof_verifier::MockContextProvider; +use drive_proof_verifier::{ContextProvider, FromProof}; pub use http::Uri; #[cfg(feature = "mocks")] use rs_dapi_client::mock::MockDapiClient; pub use rs_dapi_client::AddressList; +pub use rs_dapi_client::RequestSettings; use rs_dapi_client::{ transport::{TransportClient, TransportRequest}, - Dapi, DapiClient, DapiClientError, RequestSettings, + DapiClient, DapiClientError, DapiRequestExecutor, }; +use std::collections::btree_map::Entry; +use std::fmt::Debug; +#[cfg(feature = "mocks")] +use std::num::NonZeroUsize; #[cfg(feature = "mocks")] -use tokio::sync::Mutex; +use std::path::{Path, PathBuf}; +use std::sync::Arc; +use std::time::{SystemTime, UNIX_EPOCH}; +#[cfg(feature = "mocks")] +use tokio::sync::{Mutex, MutexGuard}; +use tokio_util::sync::{CancellationToken, WaitForCancellationFuture}; + +/// How many data contracts fit in the cache. +pub const DEFAULT_CONTRACT_CACHE_SIZE: usize = 100; +/// How many quorum public keys fit in the cache. +pub const DEFAULT_QUORUM_PUBLIC_KEYS_CACHE_SIZE: usize = 100; +/// The default identity nonce stale time in seconds +pub const DEFAULT_IDENTITY_NONCE_STALE_TIME_S: u64 = 1200; //20 mins + +/// a type to represent staleness in seconds +pub type StalenessInSeconds = u64; + +/// The last query timestamp +pub type LastQueryTimestamp = u64; /// Dash Platform SDK /// @@ -42,41 +69,87 @@ use tokio::sync::Mutex; /// * [`SdkBuilder::new_mock()`] Create a mock [SdkBuilder]. /// * [`Sdk::new_mock()`] Create a mock [Sdk]. /// +/// ## Thread safety +/// +/// Sdk is thread safe and can be shared between threads. +/// It uses internal locking when needed. +/// +/// It is also safe to clone the Sdk. +/// /// ## Examples /// /// See tests/ for examples of using the SDK. +#[derive(Clone)] pub struct Sdk { + /// The network that the sdk is configured for (Dash (mainnet), Testnet, Devnet, Regtest) + pub network: Network, inner: SdkInstance, - /// Use proofs when retrieving data from the platform. + /// Use proofs when retrieving data from Platform. /// /// This is set to `true` by default. `false` is not implemented yet. proofs: bool, + + /// An internal SDK cache managed exclusively by the SDK + internal_cache: Arc, + + /// Context provider used by the SDK. + /// + /// ## Panics + /// + /// Note that setting this to None can panic. + context_provider: Option>>, + + /// Cancellation token; once cancelled, all pending requests should be aborted. + pub(crate) cancel_token: CancellationToken, + #[cfg(feature = "mocks")] dump_dir: Option, } +impl Debug for Sdk { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match &self.inner { + SdkInstance::Dapi { dapi, .. } => f + .debug_struct("Sdk") + .field("dapi", dapi) + .field("proofs", &self.proofs) + .finish(), + #[cfg(feature = "mocks")] + SdkInstance::Mock { mock, .. } => f + .debug_struct("Sdk") + .field("mock", mock) + .field("proofs", &self.proofs) + .finish(), + } + } +} + /// Internal Sdk instance. /// /// This is used to store the actual Sdk instance, which can be either a real Sdk or a mock Sdk. /// We use it to avoid exposing internals defined below to the public. +#[derive(Debug, Clone)] enum SdkInstance { /// Real Sdk, using DAPI with gRPC transport Dapi { /// DAPI client used to communicate with Dash Platform. dapi: DapiClient, - /// Core client used to retrieve quorum keys from core. - core: CoreClient, + /// Platform version configured for this Sdk version: &'static PlatformVersion, }, - #[cfg(feature = "mocks")] /// Mock SDK + #[cfg(feature = "mocks")] Mock { /// Mock DAPI client used to communicate with Dash Platform. + /// + /// Dapi client is wrapped in a tokio [Mutex](tokio::sync::Mutex) as it's used in async context. dapi: Arc>, /// Mock SDK implementation processing mock expectations and responses. - mock: MockDashPlatformSdk, - quorum_provider: MockQuorumInfoProvider, + mock: Arc>, + + /// Platform version configured for this Sdk + version: &'static PlatformVersion, }, } @@ -100,22 +173,98 @@ impl Sdk { /// /// - `R`: Type of the request that was used to fetch the proof. /// - `O`: Type of the object to be retrieved from the proof. - pub(crate) fn parse_proof + MockResponse>( + pub(crate) async fn parse_proof + MockResponse>( &self, request: O::Request, response: O::Response, ) -> Result, drive_proof_verifier::Error> where - O::Request: MockRequest, + O::Request: Mockable, { + self.parse_proof_with_metadata(request, response) + .await + .map(|result| result.0) + } + + /// Retrieve object `O` from proof contained in `request` (of type `R`) and `response`. + /// + /// This method is used to retrieve objects from proofs returned by Dash Platform. + /// + /// ## Generic Parameters + /// + /// - `R`: Type of the request that was used to fetch the proof. + /// - `O`: Type of the object to be retrieved from the proof. + pub(crate) async fn parse_proof_with_metadata + MockResponse>( + &self, + request: O::Request, + response: O::Response, + ) -> Result<(Option, ResponseMetadata), drive_proof_verifier::Error> + where + O::Request: Mockable, + { + let provider = self + .context_provider + .as_ref() + .ok_or(drive_proof_verifier::Error::ContextProviderNotSet)?; + match self.inner { - SdkInstance::Dapi { .. } => { - O::maybe_from_proof(request, response, self.version(), self) + SdkInstance::Dapi { .. } => O::maybe_from_proof_with_metadata( + request, + response, + self.network, + self.version(), + &provider, + ) + .map(|(a, b, _)| (a, b)), + #[cfg(feature = "mocks")] + SdkInstance::Mock { ref mock, .. } => { + let guard = mock.lock().await; + guard + .parse_proof_with_metadata(request, response) + .map(|(a, b, _)| (a, b)) } + } + } + + /// Retrieve object `O` from proof contained in `request` (of type `R`) and `response`. + /// + /// This method is used to retrieve objects from proofs returned by Dash Platform. + /// + /// ## Generic Parameters + /// + /// - `R`: Type of the request that was used to fetch the proof. + /// - `O`: Type of the object to be retrieved from the proof. + pub(crate) async fn parse_proof_with_metadata_and_proof + MockResponse>( + &self, + request: O::Request, + response: O::Response, + ) -> Result<(Option, ResponseMetadata, Proof), drive_proof_verifier::Error> + where + O::Request: Mockable, + { + let provider = self + .context_provider + .as_ref() + .ok_or(drive_proof_verifier::Error::ContextProviderNotSet)?; + + match self.inner { + SdkInstance::Dapi { .. } => O::maybe_from_proof_with_metadata( + request, + response, + self.network, + self.version(), + &provider, + ), #[cfg(feature = "mocks")] - SdkInstance::Mock { ref mock, .. } => mock.parse_proof(request, response), + SdkInstance::Mock { ref mock, .. } => { + let guard = mock.lock().await; + guard.parse_proof_with_metadata(request, response) + } } } + pub fn context_provider(&self) -> Option { + self.context_provider.as_ref().map(Arc::clone) + } /// Returns a mutable reference to the `MockDashPlatformSdk` instance. /// @@ -123,31 +272,214 @@ impl Sdk { /// /// # Panics /// - /// Panics if the `self` instance is not a `Mock` variant. + /// Panics when: + /// + /// * the `self` instance is not a `Mock` variant, + /// * the `self` instance is in use by another thread. #[cfg(feature = "mocks")] - pub fn mock(&mut self) -> &mut MockDashPlatformSdk { + pub fn mock(&mut self) -> MutexGuard { if let Sdk { - inner: SdkInstance::Mock { ref mut mock, .. }, + inner: SdkInstance::Mock { ref mock, .. }, .. } = self { - mock + mock.try_lock() + .expect("mock sdk is in use by another thread and connot be reconfigured") } else { panic!("not a mock") } } + /// Updates or fetches the nonce for a given identity from the cache, + /// querying Platform if the cached value is stale or absent. Optionally + /// increments the nonce before storing it, based on the provided settings. + pub async fn get_identity_nonce( + &self, + identity_id: Identifier, + bump_first: bool, + settings: Option, + ) -> Result { + let settings = settings.unwrap_or_default(); + let current_time_s = match SystemTime::now().duration_since(UNIX_EPOCH) { + Ok(n) => n.as_secs(), + Err(_) => panic!("SystemTime before UNIX EPOCH!"), + }; + + // we start by only using a read lock, as this speeds up the system + let mut identity_nonce_counter = self.internal_cache.identity_nonce_counter.lock().await; + let entry = identity_nonce_counter.entry(identity_id); + + let should_query_platform = match &entry { + Entry::Vacant(_) => true, + Entry::Occupied(e) => { + let (_, last_query_time) = e.get(); + *last_query_time + < current_time_s.saturating_sub( + settings + .identity_nonce_stale_time_s + .unwrap_or(DEFAULT_IDENTITY_NONCE_STALE_TIME_S), + ) + } + }; + + if should_query_platform { + let platform_nonce = IdentityNonceFetcher::fetch_with_settings( + self, + identity_id, + settings.request_settings, + ) + .await? + .unwrap_or(IdentityNonceFetcher(0)) + .0; + match entry { + Entry::Vacant(e) => { + let insert_nonce = if bump_first { + platform_nonce + 1 + } else { + platform_nonce + }; + e.insert((insert_nonce, current_time_s)); + Ok(insert_nonce & IDENTITY_NONCE_VALUE_FILTER) + } + Entry::Occupied(mut e) => { + let (current_nonce, _) = e.get(); + let insert_nonce = if platform_nonce > *current_nonce { + if bump_first { + platform_nonce + 1 + } else { + platform_nonce + } + } else if bump_first { + *current_nonce + 1 + } else { + *current_nonce + }; + e.insert((insert_nonce, current_time_s)); + Ok(insert_nonce & IDENTITY_NONCE_VALUE_FILTER) + } + } + } else { + match entry { + Entry::Vacant(_) => { + panic!("this can not happen, vacant entry not possible"); + } + Entry::Occupied(mut e) => { + let (current_nonce, _) = e.get(); + if bump_first { + let insert_nonce = current_nonce + 1; + e.insert((insert_nonce, current_time_s)); + Ok(insert_nonce & IDENTITY_NONCE_VALUE_FILTER) + } else { + Ok(*current_nonce & IDENTITY_NONCE_VALUE_FILTER) + } + } + } + } + } + + /// Updates or fetches the nonce for a given identity and contract pair from a cache, + /// querying Platform if the cached value is stale or absent. Optionally + /// increments the nonce before storing it, based on the provided settings. + pub async fn get_identity_contract_nonce( + &self, + identity_id: Identifier, + contract_id: Identifier, + bump_first: bool, + settings: Option, + ) -> Result { + let settings = settings.unwrap_or_default(); + let current_time_s = match SystemTime::now().duration_since(UNIX_EPOCH) { + Ok(n) => n.as_secs(), + Err(_) => panic!("SystemTime before UNIX EPOCH!"), + }; + + // we start by only using a read lock, as this speeds up the system + let mut identity_contract_nonce_counter = self + .internal_cache + .identity_contract_nonce_counter + .lock() + .await; + let entry = identity_contract_nonce_counter.entry((identity_id, contract_id)); + + let should_query_platform = match &entry { + Entry::Vacant(_) => true, + Entry::Occupied(e) => { + let (_, last_query_time) = e.get(); + *last_query_time + < current_time_s.saturating_sub( + settings + .identity_nonce_stale_time_s + .unwrap_or(DEFAULT_IDENTITY_NONCE_STALE_TIME_S), + ) + } + }; + + if should_query_platform { + let platform_nonce = IdentityContractNonceFetcher::fetch_with_settings( + self, + (identity_id, contract_id), + settings.request_settings, + ) + .await? + .unwrap_or(IdentityContractNonceFetcher(0)) + .0; + match entry { + Entry::Vacant(e) => { + let insert_nonce = if bump_first { + platform_nonce + 1 + } else { + platform_nonce + }; + e.insert((insert_nonce, current_time_s)); + Ok(insert_nonce & IDENTITY_NONCE_VALUE_FILTER) + } + Entry::Occupied(mut e) => { + let (current_nonce, _) = e.get(); + let insert_nonce = if platform_nonce > *current_nonce { + if bump_first { + platform_nonce + 1 + } else { + platform_nonce + } + } else if bump_first { + *current_nonce + 1 + } else { + *current_nonce + }; + e.insert((insert_nonce, current_time_s)); + Ok(insert_nonce & IDENTITY_NONCE_VALUE_FILTER) + } + } + } else { + match entry { + Entry::Vacant(_) => { + panic!("this can not happen, vacant entry not possible"); + } + Entry::Occupied(mut e) => { + let (current_nonce, _) = e.get(); + if bump_first { + let insert_nonce = current_nonce + 1; + e.insert((insert_nonce, current_time_s)); + Ok(insert_nonce & IDENTITY_NONCE_VALUE_FILTER) + } else { + Ok(*current_nonce & IDENTITY_NONCE_VALUE_FILTER) + } + } + } + } + } + /// Return [Dash Platform version](PlatformVersion) information used by this SDK. /// /// /// /// This is the version configured in [`SdkBuilder`]. /// Useful whenever you need to provide [PlatformVersion] to other SDK and DPP methods. - pub fn version<'a>(&self) -> &'a PlatformVersion { + pub fn version<'v>(&self) -> &'v PlatformVersion { match &self.inner { SdkInstance::Dapi { version, .. } => version, #[cfg(feature = "mocks")] - SdkInstance::Mock { mock, .. } => mock.version(), + SdkInstance::Mock { version, .. } => version, } } @@ -156,78 +488,39 @@ impl Sdk { self.proofs } - /// Save quorum public key to disk. - /// - /// Files are named: `quorum_pubkey--.json` + /// Set the [ContextProvider] to use. /// - /// Note that this will overwrite files with the same quorum type and quorum hash. + /// [ContextProvider] is used to access state information, like data contracts and quorum public keys. /// - /// Any errors are logged on `warn` level and ignored. - #[cfg(feature = "mocks")] - fn dump_quorum_public_key( - &self, - quorum_type: u32, - quorum_hash: [u8; 32], - _core_chain_locked_height: u32, - public_key: &[u8], - ) { - let path = match &self.dump_dir { - Some(p) => p, - None => return, - }; - - let encoded = serde_json::to_vec(public_key).expect("encode quorum hash to json"); - - let file = path.join(format!( - "quorum_pubkey-{}-{}.json", - quorum_type, - quorum_hash.encode_hex::() - )); - - if let Err(e) = std::fs::write(file, encoded) { - tracing::warn!("Unable to write dump file {:?}: {}", path, e); - } + /// Note that this will overwrite any previous context provider. + pub fn set_context_provider(&mut self, context_provider: C) { + self.context_provider + .replace(Arc::new(Box::new(context_provider))); } -} -impl QuorumInfoProvider for Sdk { - fn get_quorum_public_key( - &self, - quorum_type: u32, - quorum_hash: [u8; 32], - core_chain_locked_height: u32, - ) -> Result<[u8; 48], drive_proof_verifier::Error> { - let provider: &dyn QuorumInfoProvider = match self.inner { - SdkInstance::Dapi { ref core, .. } => core, - #[cfg(feature = "mocks")] - SdkInstance::Mock { - ref quorum_provider, - .. - } => quorum_provider, - }; - - let key = - provider.get_quorum_public_key(quorum_type, quorum_hash, core_chain_locked_height)?; - - #[cfg(feature = "mocks")] - self.dump_quorum_public_key(quorum_type, quorum_hash, core_chain_locked_height, &key); + /// Returns a future that resolves when the Sdk is cancelled (eg. shutdown was requested). + pub fn cancelled(&self) -> WaitForCancellationFuture { + self.cancel_token.cancelled() + } - Ok(key) + /// Request shutdown of the Sdk and all related operation. + pub fn shutdown(&self) { + self.cancel_token.cancel(); } } #[async_trait::async_trait] -impl Dapi for Sdk { +impl DapiRequestExecutor for Sdk { async fn execute( - &mut self, + &self, request: R, settings: RequestSettings, ) -> Result::Error>> { match self.inner { - SdkInstance::Dapi { ref mut dapi, .. } => dapi.execute(request, settings).await, + SdkInstance::Dapi { ref dapi, .. } => dapi.execute(request, settings).await, #[cfg(feature = "mocks")] - SdkInstance::Mock { ref mut dapi, .. } => { - let mut dapi_guard = dapi.lock().await; + SdkInstance::Mock { ref dapi, .. } => { + let dapi_guard = dapi.lock().await; dapi_guard.execute(request, settings).await } } @@ -253,6 +546,8 @@ pub struct SdkBuilder { addresses: Option, settings: RequestSettings, + network: Network, + core_ip: String, core_port: u16, core_user: String, @@ -261,11 +556,26 @@ pub struct SdkBuilder { /// If true, request and verify proofs of the responses. proofs: bool, + /// Platform version to use in this Sdk version: &'static PlatformVersion, + /// Cache size for data contracts. Used by mock [GrpcContextProvider]. + #[cfg(feature = "mocks")] + data_contract_cache_size: NonZeroUsize, + + /// Cache size for quorum public keys. Used by mock [GrpcContextProvider]. + #[cfg(feature = "mocks")] + quorum_public_keys_cache_size: NonZeroUsize, + + /// Context provider used by the SDK. + context_provider: Option>, + /// directory where dump files will be stored #[cfg(feature = "mocks")] dump_dir: Option, + + /// Cancellation token; once cancelled, all pending requests should be aborted. + pub(crate) cancel_token: CancellationToken, } impl Default for SdkBuilder { @@ -274,6 +584,7 @@ impl Default for SdkBuilder { Self { addresses: None, settings: RequestSettings::default(), + network: Network::Dash, core_ip: "".to_string(), core_port: 0, core_password: "".to_string(), @@ -281,7 +592,19 @@ impl Default for SdkBuilder { proofs: true, + #[cfg(feature = "mocks")] + data_contract_cache_size: NonZeroUsize::new(DEFAULT_CONTRACT_CACHE_SIZE) + .expect("data conttact cache size must be positive"), + #[cfg(feature = "mocks")] + quorum_public_keys_cache_size: NonZeroUsize::new(DEFAULT_QUORUM_PUBLIC_KEYS_CACHE_SIZE) + .expect("quorum public keys cache size must be positive"), + + context_provider: None, + + cancel_token: CancellationToken::new(), + version: PlatformVersion::latest(), + #[cfg(feature = "mocks")] dump_dir: None, } @@ -323,6 +646,14 @@ impl SdkBuilder { ) } + /// Configure network type. + /// + /// Defaults to Network::Dash which is mainnet. + pub fn with_network(mut self, network: Network) -> Self { + self.network = network; + self + } + /// Configure request settings. /// /// Tune request settings used to connect to the Dash Platform. @@ -345,9 +676,36 @@ impl SdkBuilder { self } - /// Configure connection to Dash Core + /// Configure context provider to use. + /// + /// Context provider is used to retrieve data contracts and quorum public keys from application state. + /// It should be implemented by the user of this SDK to provide stateful information about the application. + /// + /// See [ContextProvider] for more information and [GrpcContextProvider] for an example implementation. + pub fn with_context_provider( + mut self, + context_provider: C, + ) -> Self { + self.context_provider = Some(Box::new(context_provider)); + + self + } + + /// Set cancellation token that will be used by the Sdk. /// - /// TODO: This is temporary implementation, effective until we integrate SPV into rs-sdk. + /// Once that cancellation token is cancelled, all pending requests shall teriminate. + pub fn with_cancellation_token(mut self, cancel_token: CancellationToken) -> Self { + self.cancel_token = cancel_token; + self + } + + /// Use Dash Core as a wallet and context provider. + /// + /// This is a convenience method that configures the SDK to use Dash Core as a wallet and context provider. + /// + /// For more control over the configuration, use [SdkBuilder::with_wallet()] and [SdkBuilder::with_context_provider()]. + /// + /// This is temporary implementation, intended for development purposes. pub fn with_core(mut self, ip: &str, port: u16, user: &str, password: &str) -> Self { self.core_ip = ip.to_string(); self.core_port = port; @@ -363,8 +721,7 @@ impl SdkBuilder { /// This function will create the directory if it does not exist and save dumps of /// * all requests and responses - in files named `msg-*.json` /// * retrieved quorum public keys - in files named `quorum_pubkey-*.json` - /// - /// Data is saved in JSON format. + /// * retrieved data contracts - in files named `data_contract-*.json` /// /// These files can be used together with [MockDashPlatformSdk] to replay the requests and responses. /// See [MockDashPlatformSdk::load_expectations()] for more information. @@ -386,46 +743,124 @@ impl SdkBuilder { pub fn build(self) -> Result { PlatformVersion::set_current(self.version); - match self.addresses { + let sdk= match self.addresses { + // non-mock mode Some(addresses) => { - if self.core_ip.is_empty() || self.core_port == 0 { - return Err(Error::Config( - "Core must be configured with SdkBuilder::with_core".to_string(), - )); - } let dapi = DapiClient::new(addresses, self.settings); #[cfg(feature = "mocks")] let dapi = dapi.dump_dir(self.dump_dir.clone()); - let core = CoreClient::new( - &self.core_ip, - self.core_port, - &self.core_user, - &self.core_password, - )?; - - Ok(Sdk{ - inner:SdkInstance::Dapi { dapi, core, version:self.version }, + #[allow(unused_mut)] // needs to be mutable for #[cfg(feature = "mocks")] + let mut sdk= Sdk{ + network: self.network, + inner:SdkInstance::Dapi { dapi, version:self.version }, proofs:self.proofs, + context_provider: self.context_provider.map(Arc::new), + cancel_token: self.cancel_token, #[cfg(feature = "mocks")] dump_dir: self.dump_dir, - }) + internal_cache: Default::default(), + }; + // if context provider is not set correctly (is None), it means we need to fallback to core wallet + if sdk.context_provider.is_none() { + #[cfg(feature = "mocks")] + if !self.core_ip.is_empty() { + tracing::warn!("ContextProvider not set; mocking with Dash Core. \ + Please provide your own ContextProvider with SdkBuilder::with_context_provider()."); + + let mut context_provider = GrpcContextProvider::new(None, + &self.core_ip, self.core_port, &self.core_user, &self.core_password, + self.data_contract_cache_size, self.quorum_public_keys_cache_size)?; + #[cfg(feature = "mocks")] + if sdk.dump_dir.is_some() { + context_provider.set_dump_dir(sdk.dump_dir.clone()); + } + // We have cyclical dependency Sdk <-> GrpcContextProvider, so we just do some + // workaround using additional Arc. + let context_provider= Arc::new(context_provider); + sdk.context_provider.replace(Arc::new(Box::new(context_provider.clone()))); + context_provider.set_sdk(Some(sdk.clone())); + } else{ + tracing::warn!( + "Configure ContextProvider with Sdk::with_context_provider(); otherwise Sdk will fail"); + } + #[cfg(not(feature = "mocks"))] + tracing::warn!( + "Configure ContextProvider with Sdk::with_context_provider(); otherwise Sdk will fail"); + }; + + sdk }, #[cfg(feature = "mocks")] - None =>{ let dapi =Arc::new(Mutex::new( MockDapiClient::new())); - Ok(Sdk{ + // mock mode + None => { + let dapi =Arc::new(tokio::sync::Mutex::new( MockDapiClient::new())); + // We create mock context provider that will use the mock DAPI client to retrieve data contracts. + let context_provider = self.context_provider.unwrap_or_else(||{ + let mut cp=MockContextProvider::new(); + if let Some(ref dump_dir) = self.dump_dir { + cp.quorum_keys_dir(Some(dump_dir.clone())); + } + Box::new(cp) + } + ); + let mock_sdk = MockDashPlatformSdk::new(self.version, Arc::clone(&dapi)); + let mock_sdk = Arc::new(Mutex::new(mock_sdk)); + let sdk= Sdk { + network: self.network, inner:SdkInstance::Mock { - mock: MockDashPlatformSdk::new(self.version, Arc::clone(&dapi), self.proofs), + mock:mock_sdk.clone(), dapi, - quorum_provider: MockQuorumInfoProvider::new(), + version:self.version, + }, - dump_dir: self.dump_dir, + dump_dir: self.dump_dir.clone(), proofs:self.proofs, - })}, + internal_cache: Default::default(), + context_provider:Some(Arc::new(context_provider)), + cancel_token: self.cancel_token, + }; + let mut guard = mock_sdk.try_lock().expect("mock sdk is in use by another thread and connot be reconfigured"); + guard.set_sdk(sdk.clone()); + if let Some(ref dump_dir) = self.dump_dir { + pollster::block_on( guard.load_expectations(dump_dir))?; + }; + + sdk + }, #[cfg(not(feature = "mocks"))] - None => Err(Error::Config( - "Mock mode is not available. Please enable `mocks` feature or provide address list.".to_string(), - )), - } + None => return Err(Error::Config("Mock mode is not available. Please enable `mocks` feature or provide address list.".to_string())), + }; + + Ok(sdk) } } + +pub fn prettify_proof(proof: &Proof) -> String { + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let grovedb_proof: Result = + bincode::decode_from_slice(&proof.grovedb_proof, config).map(|(a, _)| a); + + let grovedb_proof_string = match grovedb_proof { + Ok(proof) => format!("{}", proof), + Err(_) => "Invalid GroveDBProof".to_string(), + }; + format!( + "Proof {{ + grovedb_proof: {}, + quorum_hash: 0x{}, + signature: 0x{}, + round: {}, + block_id_hash: 0x{}, + quorum_type: {}, + }}", + grovedb_proof_string, + hex::encode(&proof.quorum_hash), + hex::encode(&proof.signature), + proof.round, + hex::encode(&proof.block_id_hash), + proof.quorum_type, + ) +} diff --git a/packages/rs-sdk/tests/.env.example b/packages/rs-sdk/tests/.env.example index f5348104f93..1a9222032eb 100644 --- a/packages/rs-sdk/tests/.env.example +++ b/packages/rs-sdk/tests/.env.example @@ -1,8 +1,12 @@ # Configuration of tests and examples -RS_SDK_PLATFORM_HOST="127.0.0.1" -RS_SDK_PLATFORM_PORT=2443 +DASH_SDK_PLATFORM_HOST="127.0.0.1" +DASH_SDK_PLATFORM_PORT=2443 +DASH_SDK_PLATFORM_SSL=false -RS_SDK_CORE_PORT=20002 -RS_SDK_CORE_USER="someuser" -RS_SDK_CORE_PASSWORD="verysecretpassword" +# ProTxHash of masternode that has at least 1 vote casted for DPNS name `testname` +DASH_SDK_MASTERNODE_OWNER_PRO_REG_TX_HASH="6ac88f64622d9bc0cb79ad0f69657aa9488b213157d20ae0ca371fa5f04fb222" + +DASH_SDK_CORE_PORT=20002 +DASH_SDK_CORE_USER="someuser" +DASH_SDK_CORE_PASSWORD="verysecretpassword" diff --git a/packages/rs-sdk/tests/fetch/broadcast.rs b/packages/rs-sdk/tests/fetch/broadcast.rs new file mode 100644 index 00000000000..56e26f457e3 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/broadcast.rs @@ -0,0 +1,46 @@ +#[cfg(all(feature = "network-testing", not(feature = "offline-testing")))] +/// Tests that require connectivity to the server +mod online { + use crate::fetch::{common::setup_logs, config::Config}; + use dapi_grpc::platform::v0::{ + wait_for_state_transition_result_request::WaitForStateTransitionResultRequestV0, + WaitForStateTransitionResultRequest, + }; + use rs_dapi_client::{DapiRequest, RequestSettings}; + use std::time::Duration; + + /// Send streaming request to the server and time out after 1 second (because we don't expect to receive anything) + #[tokio::test(flavor = "multi_thread", worker_threads = 1)] + #[cfg(all(feature = "network-testing", not(feature = "offline-testing")))] + async fn test_wait_timeout() { + setup_logs(); + + const TIMEOUT: std::time::Duration = std::time::Duration::from_millis(400); + + let cfg = Config::new(); + let sdk = cfg.setup_api("test_wait_timeout").await; + + let request: WaitForStateTransitionResultRequest = WaitForStateTransitionResultRequestV0 { + prove: false, + state_transition_hash: [0u8; 32].to_vec(), + } + .into(); + + let settings = RequestSettings { + timeout: Some(TIMEOUT), + ..Default::default() + }; + + // we add few millis to duration to give chance to the server to time out before we kill request + let response = tokio::time::timeout( + TIMEOUT + Duration::from_millis(100), + request.execute(&sdk, settings), + ) + .await + .expect("expected request timeout, got tokio timeout"); + + assert!(response.is_err(), "expected timeout, got {:?}", response); + tracing::info!(response = ?response, "received timeout"); + // assert!(response.version.is_some()); + } +} diff --git a/packages/rs-sdk/tests/fetch/common.rs b/packages/rs-sdk/tests/fetch/common.rs index b757eb58e03..da109c4da0b 100644 --- a/packages/rs-sdk/tests/fetch/common.rs +++ b/packages/rs-sdk/tests/fetch/common.rs @@ -1,4 +1,12 @@ +use dash_sdk::{mock::Mockable, platform::Query, Sdk}; use dpp::{data_contract::DataContractFactory, prelude::Identifier}; +use hex::ToHex; +use rs_dapi_client::transport::TransportRequest; + +use super::config::Config; + +/// Test DPNS name for testing of the Sdk; at least 3 identities should request this name to be reserved +pub(crate) const TEST_DPNS_NAME: &str = "testname"; /// Create a mock document type for testing of mock API pub fn mock_document_type() -> dpp::data_contract::document_type::DocumentType { @@ -29,7 +37,9 @@ pub fn mock_document_type() -> dpp::data_contract::document_type::DocumentType { None, false, false, + false, true, + &mut vec![], platform_version, ) .expect("expected to create a document type") @@ -59,9 +69,9 @@ pub fn mock_data_contract( document_types.insert(doc.name().to_string(), schema.clone()); } - DataContractFactory::new(protocol_version, None) + DataContractFactory::new(protocol_version) .unwrap() - .create(owner_id, platform_value!(document_types), None, None) + .create(owner_id, 0, platform_value!(document_types), None, None) .expect("create data contract") .data_contract_owned() } @@ -70,7 +80,7 @@ pub fn mock_data_contract( pub fn setup_logs() { tracing_subscriber::fmt::fmt() .with_env_filter(tracing_subscriber::EnvFilter::new( - "info,rs_sdk=trace,h2=info", + "info,dash_sdk=trace,dash_sdk::platform::fetch=debug,drive_proof_verifier=debug,main=debug,h2=info", )) .pretty() .with_ansi(true) @@ -78,3 +88,24 @@ pub fn setup_logs() { .try_init() .ok(); } + +/// Configure test case generated with [::test_case] crate. +/// +/// This function is intended to use with multiple test cases in a single function. +/// As a test case shares function body, we need to generate unique name for each of them to isolate generated +/// test vectors. It is done by hashing query and using it as a suffix for test case name. +/// +/// ## Returns +/// +/// Returns unique name of test case (generated from `name_prefix` and hash of query) and configured SDK. +pub(crate) async fn setup_sdk_for_test_case>( + cfg: Config, + query: Q, + name_prefix: &str, +) -> (String, Sdk) { + let key = rs_dapi_client::mock::Key::new(&query.query(true).expect("valid query")); + let test_case_id = format!("{}_{}", name_prefix, key.encode_hex::()); + + // create new sdk to ensure that test cases don't interfere with each other + (test_case_id.clone(), cfg.setup_api(&test_case_id).await) +} diff --git a/packages/rs-sdk/tests/fetch/config.rs b/packages/rs-sdk/tests/fetch/config.rs index 6dd9010f5c7..445904795d6 100644 --- a/packages/rs-sdk/tests/fetch/config.rs +++ b/packages/rs-sdk/tests/fetch/config.rs @@ -1,9 +1,13 @@ -//! Configuration helpers for mocking of rs-sdk. +//! Configuration helpers for mocking of dash-platform-sdk. //! -//! This module contains [Config] struct that can be used to configure rs-sdk. +//! This module contains [Config] struct that can be used to configure dash-platform-sdk. //! It's mainly used for testing. -use dpp::prelude::Identifier; +use dpp::platform_value::string_encoding::Encoding; +use dpp::{ + dashcore::{hashes::Hash, ProTxHash}, + prelude::Identifier, +}; use rs_dapi_client::AddressList; use serde::Deserialize; use std::{path::PathBuf, str::FromStr}; @@ -18,12 +22,12 @@ const DPNS_DASH_TLD_DOCUMENT_ID: [u8; 32] = [ ]; #[derive(Debug, Deserialize)] -/// Configuration for rs-sdk. +/// Configuration for dash-platform-sdk. /// /// Content of this configuration is loaded from environment variables or `${CARGO_MANIFEST_DIR}/.env` file /// when the [Config::new()] is called. -/// Variable names in the enviroment and `.env` file must be prefixed with [RS_SDK_](Config::CONFIG_PREFIX) -/// and written as SCREAMING_SNAKE_CASE (e.g. `RS_SDK_PLATFORM_HOST`). +/// Variable names in the enviroment and `.env` file must be prefixed with [DASH_SDK_](Config::CONFIG_PREFIX) +/// and written as SCREAMING_SNAKE_CASE (e.g. `DASH_SDK_PLATFORM_HOST`). pub struct Config { /// Hostname of the Dash Platform node to connect to #[serde(default)] @@ -40,6 +44,9 @@ pub struct Config { /// Password for Dash Core RPC interface #[serde(default)] pub core_password: String, + /// When true, use SSL for the Dash Platform node grpc interface + #[serde(default)] + pub platform_ssl: bool, /// Directory where all generated test vectors will be saved. /// @@ -65,16 +72,19 @@ pub struct Config { /// in [`existing_data_contract_id`](Config::existing_data_contract_id). #[serde(default = "Config::default_document_id")] pub existing_document_id: Identifier, + // Hex-encoded ProTxHash of the existing HP masternode + #[serde(default = "Config::default_protxhash")] + pub masternode_owner_pro_reg_tx_hash: String, } impl Config { /// Prefix of configuration options in the environment variables and `.env` file. - pub const CONFIG_PREFIX: &str = "RS_SDK_"; + pub const CONFIG_PREFIX: &'static str = "DASH_SDK_"; /// Load configuration from operating system environment variables and `.env` file. /// /// Create new [Config] with data from environment variables and `${CARGO_MANIFEST_DIR}/tests/.env` file. /// Variable names in the environment and `.env` file must be converted to SCREAMING_SNAKE_CASE and - /// prefixed with [RS_SDK_](Config::CONFIG_PREFIX). + /// prefixed with [DASH_SDK_](Config::CONFIG_PREFIX). pub fn new() -> Self { // load config from .env file, ignore errors @@ -114,7 +124,12 @@ impl Config { #[allow(unused)] /// Create list of Platform addresses from the configuration pub fn address_list(&self) -> AddressList { - let address: String = format!("http://{}:{}", self.platform_host, self.platform_port); + let scheme = match self.platform_ssl { + true => "https", + false => "http", + }; + + let address: String = format!("{}://{}:{}", scheme, self.platform_host, self.platform_port); AddressList::from_iter(vec![http::Uri::from_str(&address).expect("valid uri")]) } @@ -125,16 +140,43 @@ impl Config { /// /// ## Feature flags /// - /// * `offline-testing` is not set - connect to the platform and generate + /// * `offline-testing` is not set - connect to Platform and generate /// new test vectors during execution /// * `offline-testing` is set - use mock implementation and /// load existing test vectors from disk - pub async fn setup_api(&self) -> rs_sdk::Sdk { + /// + /// ## Arguments + /// + /// * namespace - namespace to use when storing mock expectations; this is used to separate + /// expectations from different tests. + /// + /// When empty string is provided, expectations are stored in the root of the dump directory. + pub async fn setup_api(&self, namespace: &str) -> dash_sdk::Sdk { + let dump_dir = match namespace.is_empty() { + true => self.dump_dir.clone(), + false => { + // looks like spaces are not replaced by sanitize_filename, and we don't want them as they are confusing + let namespace = namespace.replace(' ', "_"); + self.dump_dir.join(sanitize_filename::sanitize(namespace)) + } + }; + + if dump_dir.is_relative() { + panic!( + "dump dir must be absolute path to avoid mistakes, got: {}", + dump_dir.display() + ); + } + + if dump_dir.as_os_str().eq("/") { + panic!("cannot use namespace with root dump dir"); + } + // offline testing takes precedence over network testing #[cfg(all(feature = "network-testing", not(feature = "offline-testing")))] let sdk = { // Dump all traffic to disk - let builder = rs_sdk::SdkBuilder::new(self.address_list()).with_core( + let builder = dash_sdk::SdkBuilder::new(self.address_list()).with_core( &self.platform_host, self.core_port, &self.core_user, @@ -142,7 +184,23 @@ impl Config { ); #[cfg(feature = "generate-test-vectors")] - let builder = builder.with_dump_dir(&self.dump_dir); + let builder = { + // When we use namespaces, clean up the namespaced dump dir before starting + // to avoid mixing expectations from different test runs + if !namespace.is_empty() { + if let Err(err) = std::fs::remove_dir_all(&dump_dir) { + tracing::warn!(?err, ?dump_dir, "failed to remove dump dir"); + } + std::fs::create_dir_all(&dump_dir) + .expect(format!("create dump dir {}", dump_dir.display()).as_str()); + // ensure dump dir is committed to git + let gitkeep = dump_dir.join(".gitkeep"); + std::fs::write(&gitkeep, "") + .expect(format!("create {} file", gitkeep.display()).as_str()); + } + + builder.with_dump_dir(&dump_dir) + }; builder.build().expect("cannot initialize api") }; @@ -150,33 +208,29 @@ impl Config { // offline testing takes precedence over network testing #[cfg(feature = "offline-testing")] let sdk = { - let mut mock_sdk = rs_sdk::SdkBuilder::new_mock() + dash_sdk::SdkBuilder::new_mock() + .with_dump_dir(&dump_dir) .build() - .expect("initialize api"); - - mock_sdk - .mock() - .quorum_info_dir(&self.dump_dir) - .load_expectations(&self.dump_dir) - .await - .expect("load expectations"); - - mock_sdk + .expect("initialize api") }; sdk } fn default_identity_id() -> Identifier { - data_contracts::SystemDataContract::DPNS - .source() - .expect("data contract source") - .owner_id_bytes - .into() + // TODO: We don't have default system identities anymore. + // So now I used this manually created identity to populate test vectors. + // Next time we need to do it again and update this value :(. This is terrible. + // We should automate creation of identity for SDK tests when we have time. + Identifier::from_string( + "a1534e47f60be71e823a9dbc9ceb6d3ea9f1ebde7a3773f03e49ef31c7d9c044", + Encoding::Hex, + ) + .unwrap() } fn default_data_contract_id() -> Identifier { - data_contracts::SystemDataContract::DPNS.id() + data_contracts::dpns_contract::ID_BYTES.into() } fn default_document_type_name() -> String { @@ -191,6 +245,28 @@ impl Config { .join("tests") .join("vectors") } + + /// Existing masternode proTxHash. Must be updated every time test vectors are regenerated. + /// + /// See documentation of [contested_resource_identity_votes_ok](super::contested_resource_identity_votes::contested_resource_identity_votes_ok). + fn default_protxhash() -> String { + String::from("d10bf435af7c75f5b07b09486af1212469d69fdc787589548e315776bc1052a1") + } + + /// Return ProTxHash of an existing evo node, or None if not set + pub fn existing_protxhash(&self) -> Result { + hex::decode(&self.masternode_owner_pro_reg_tx_hash) + .map_err(|e| e.to_string()) + .and_then(|b| ProTxHash::from_slice(&b).map_err(|e| e.to_string())) + .map_err(|e| { + format!( + "Invalid {}MASTERNODE_OWNER_PRO_REG_TX_HASH {}: {}", + Self::CONFIG_PREFIX, + self.masternode_owner_pro_reg_tx_hash, + e + ) + }) + } } impl Default for Config { diff --git a/packages/rs-sdk/tests/fetch/contested_resource.rs b/packages/rs-sdk/tests/fetch/contested_resource.rs new file mode 100644 index 00000000000..4f899c21261 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource.rs @@ -0,0 +1,423 @@ +//! Tests of ContestedResource object + +use crate::fetch::{ + common::{setup_logs, setup_sdk_for_test_case, TEST_DPNS_NAME}, + config::Config, +}; +use dash_sdk::{platform::FetchMany, Error}; +use dpp::{ + platform_value::Value, + voting::{ + contender_structs::ContenderWithSerializedDocument, + vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll, + }, +}; +use drive::query::{ + vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, ContestedDocumentVotePollDriveQueryResultType, + }, + vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery, +}; +use drive_proof_verifier::types::ContestedResource; +use std::panic::catch_unwind; + +/// Test that we can fetch contested resources +/// +/// ## Preconditions +/// +/// 1. At least one contested resource (DPNS name) exists +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +async fn test_contested_resources_ok() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg.setup_api("test_contested_resources_ok").await; + check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + let query = base_query(&cfg); + + let rss = ContestedResource::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + tracing::debug!(contested_resources=?rss, "Contested resources"); + assert!(!rss.0.is_empty()); +} + +fn base_query(cfg: &Config) -> VotePollsByDocumentTypeQuery { + VotePollsByDocumentTypeQuery { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name.clone(), + index_name: "parentNameAndLabel".to_string(), + start_at_value: None, + start_index_values: vec![Value::Text("dash".to_string())], + end_index_values: vec![], + limit: None, + order_ascending: false, + } +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +/// Test [ContestedResource] start index (`start_at_value`) +/// +/// ## Preconditions +/// +/// 1. At least 2 contested resources (eg. different DPNS names) exist +async fn contested_resources_start_at_value() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg.setup_api("contested_resources_start_at_value").await; + check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + // Given all contested resources sorted ascending + let index_name = "parentNameAndLabel"; + for order_ascending in [true, false] { + let query_all = VotePollsByDocumentTypeQuery { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name.clone(), + index_name: index_name.to_string(), + start_at_value: None, + start_index_values: vec![Value::Text("dash".into())], + end_index_values: vec![], + limit: Some(50), + order_ascending, + }; + + let all = ContestedResource::fetch_many(&sdk, query_all.clone()) + .await + .expect("fetch contested resources"); + + tracing::debug!(contested_resources=?all, order_ascending, "All contested resources"); + for inclusive in [true, false] { + // when I set start_at_value to some value, + for (i, start) in all.0.iter().enumerate() { + let ContestedResource::Value(start_value) = start.clone(); + + let query = VotePollsByDocumentTypeQuery { + start_at_value: Some((start_value, inclusive)), + ..query_all.clone() + }; + + let rss = ContestedResource::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + tracing::debug!(?start, contested_resources=?rss, "Contested resources"); + + for (j, fetched) in rss.0.into_iter().enumerate() { + let all_index = if inclusive { i + j } else { i + j + 1 }; + + assert_eq!( + fetched, + (all.0[all_index]), + "when starting with {:?} order ascending {} with inclusive {}, fetched element {} ({:?}) must equal all element {} ({:?})", + start, + order_ascending, + inclusive, + j, + fetched, + all_index, + all.0[all_index] + ); + } + } + } + } +} + +/// Test that we can fetch contested resources with a limit +/// +/// ## Preconditions +/// +/// 1. At least 3 contested resources (eg. different DPNS names) exist +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +#[allow(non_snake_case)] +async fn contested_resources_limit_PLAN_656() { + // TODO: fails due to PLAN-656, not tested enough so it can be faulty + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg.setup_api("contested_resources_limit").await; + check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + const LIMIT: u16 = 2; + const LIMIT_ALL: u16 = 100; + let index_name = "parentNameAndLabel"; + + for order_ascending in [true, false] { + let query_all = VotePollsByDocumentTypeQuery { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name.clone(), + index_name: index_name.to_string(), + start_at_value: None, + start_index_values: vec![Value::Text("dash".into())], + end_index_values: vec![], + limit: Some(LIMIT_ALL), + order_ascending, + }; + let all = ContestedResource::fetch_many(&sdk, query_all.clone()) + .await + .expect("fetch contested resources"); + let count_all = all.0.len() as u16; + + // When we query for 2 contested values at a time, we get all of them + let mut i = 0; + let mut start_at_value = None; + while i < count_all && i < LIMIT_ALL { + let query = VotePollsByDocumentTypeQuery { + limit: Some(LIMIT), + start_at_value, + order_ascending, + ..query_all.clone() + }; + + let rss = ContestedResource::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + tracing::debug!(contested_resources=?rss, "Contested resources"); + let length = rss.0.len(); + let expected = if i + LIMIT > count_all { + count_all - i + } else { + LIMIT + }; + assert_eq!(length, expected as usize); + tracing::debug!(contested_resources=?rss, i, "Contested resources"); + + for (j, fetched) in rss.0.iter().enumerate() { + let all_index = i + j as u16; + assert_eq!( + fetched, + &(all.0[all_index as usize]), + "fetched element {} ({:?}) must equal all element {} ({:?}) when ascending {}", + j, + fetched, + all_index, + all.0[all_index as usize], + order_ascending, + ); + } + + let ContestedResource::Value(last) = + rss.0.into_iter().last().expect("last contested resource"); + start_at_value = Some((last, false)); + + i += length as u16; + } + assert_eq!(i, count_all, "all contested resources fetched"); + } +} +/// Check various queries for [ContestedResource] that contain invalid field values +/// +/// ## Preconditions +/// +/// None +#[test_case::test_case(|_q| {}, Ok("ContestedResources([Value(Text(".into()); "unmodified base query is Ok")] +#[test_case::test_case(|q| q.start_index_values = vec![Value::Text("".to_string())], Ok("".into()); "index value empty string is Ok")] +#[test_case::test_case(|q| q.document_type_name = "some random non-existing name".to_string(), Err(r#"code: InvalidArgument, message: "document type some random non-existing name not found"#); "non existing document type returns InvalidArgument")] +#[test_case::test_case(|q| q.index_name = "nx index".to_string(), Err(r#"code: InvalidArgument, message: "index with name nx index is not the contested index"#); "non existing index returns InvalidArgument")] +#[test_case::test_case(|q| q.index_name = "dashIdentityId".to_string(), Err(r#"code: InvalidArgument, message: "index with name dashIdentityId is not the contested index"#); "existing non-contested index returns InvalidArgument")] +// Disabled due to bug PLAN-653 +// #[test_case::test_case(|q| q.start_at_value = Some((Value::Array(vec![]), true)), Err(r#"code: InvalidArgument"#); "start_at_value wrong index type returns InvalidArgument PLAN-653")] +#[test_case::test_case(|q| q.start_index_values = vec![], Ok(r#"ContestedResources([Value(Text("dash"))])"#.into()); "start_index_values empty vec returns top-level keys")] +#[test_case::test_case(|q| q.start_index_values = vec![Value::Text("".to_string())], Ok(r#"ContestedResources([])"#.into()); "start_index_values empty string returns zero results")] +#[test_case::test_case(|q| { + q.start_index_values = vec![ + Value::Text("dash".to_string()), + Value::Text(TEST_DPNS_NAME.to_string()), + ] +}, Err("incorrect index values error: too many start index values were provided, since no end index values were provided, the start index values must be less than the amount of properties in the contested index"); "start_index_values with two values returns error")] +#[test_case::test_case(|q| { + q.start_index_values = vec![]; + q.end_index_values = vec![Value::Text(TEST_DPNS_NAME.to_string())]; +}, Ok(r#"ContestedResources([Value(Text("dash"))])"#.into()); "end_index_values one value with empty start_index_values returns 'dash'")] +#[test_case::test_case(|q| { + q.start_index_values = vec![]; + q.end_index_values = vec![Value::Text(TEST_DPNS_NAME.to_string()), Value::Text("non existing".to_string())]; +}, Err("too many end index values were provided"); "end_index_values two values (1 nx) with empty start_index_values returns error")] +#[test_case::test_case(|q| { + q.start_index_values = vec![]; + q.end_index_values = vec![Value::Text("aaa non existing".to_string())]; +}, Ok(r#"ContestedResources([])"#.into()); "end_index_values with 1 nx value 'aaa*' and empty start_index_values returns zero objects")] +#[test_case::test_case(|q| { + q.start_index_values = vec![]; + q.end_index_values = vec![Value::Text("zzz non existing".to_string())]; +}, Ok(r#"ContestedResources([])"#.into()); "end_index_values with 1 nx value 'zzz*' and empty start_index_values returns zero objects")] +#[test_case::test_case(|q| { + q.start_index_values = vec![ + Value::Text("dash".to_string()), + Value::Text(TEST_DPNS_NAME.to_string()), + Value::Text("eee".to_string()), + ] +}, Err("incorrect index values error: too many start index values were provided, since no end index values were provided, the start index values must be less than the amount of properties in the contested index"); "too many items in start_index_values returns error")] +#[test_case::test_case(|q| { + q.end_index_values = vec![Value::Text("zzz non existing".to_string())] +}, Err("incorrect index values error: too many end index values were provided"); "Both start_ and end_index_values returns error")] +#[test_case::test_case(|q| { + q.start_index_values = vec![]; + q.end_index_values = vec![Value::Text("zzz non existing".to_string())] +}, Ok("ContestedResources([])".into()); "Non-existing end_index_values returns error")] +#[test_case::test_case(|q| q.end_index_values = vec![Value::Array(vec![0.into(), 1.into()])], Err("incorrect index values error: too many end index values were provided"); "wrong type of end_index_values should return InvalidArgument")] +#[test_case::test_case(|q| q.limit = Some(0), Err(r#"code: InvalidArgument"#); "limit 0 returns InvalidArgument")] +#[test_case::test_case(|q| q.limit = Some(std::u16::MAX), Err(r#"code: InvalidArgument"#); "limit std::u16::MAX returns InvalidArgument")] +// Disabled due to bug PLAN-656 +// #[test_case::test_case(|q| { +// q.start_index_values = vec![Value::Text("dash".to_string())]; +// q.start_at_value = Some((Value::Text(TEST_DPNS_NAME.to_string()), true)); +// q.limit = Some(1); +// }, Ok(format!(r#"ContestedResources([Value(Text({}))])"#, TEST_DPNS_NAME)); "exact match query returns one object PLAN-656")] +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +async fn contested_resources_fields( + query_mut_fn: fn(&mut VotePollsByDocumentTypeQuery), + expect: Result, +) -> Result<(), String> { + setup_logs(); + + let cfg = Config::new(); + + check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + tracing::debug!(?expect, "Running test case"); + // handle panics to not stop other test cases from running + let unwinded = catch_unwind(|| { + { + pollster::block_on(async { + let mut query = base_query(&cfg); + query_mut_fn(&mut query); + + let (test_case_id, sdk) = + setup_sdk_for_test_case(cfg, query.clone(), "contested_resources_fields").await; + tracing::debug!(test_case_id, ?query, "Executing query"); + + ContestedResource::fetch_many(&sdk, query).await + }) + } + }); + let result = match unwinded { + Ok(r) => r, + Err(e) => { + let msg = if let Some(s) = e.downcast_ref::<&str>() { + s.to_string() + } else if let Some(s) = e.downcast_ref::() { + s.to_string() + } else { + format!("unknown panic type: {:?}", std::any::type_name_of_val(&e)) + }; + + tracing::error!("PANIC: {}", msg); + Err(Error::Generic(msg)) + } + }; + + match expect { + Ok(expected) if result.is_ok() => { + let result_string = format!("{:?}", result.as_ref().expect("result")); + if !result_string.contains(&expected) { + Err(format!("EXPECTED: {} GOT: {:?}\n", expected, result)) + } else { + Ok(()) + } + } + Err(expected) if result.is_err() => { + let result = result.expect_err("error"); + if !result.to_string().contains(expected) { + Err(format!("EXPECTED: {} GOT: {:?}\n", expected, result)) + } else { + Ok(()) + } + } + expected => Err(format!("EXPECTED: {:?} GOT: {:?}\n", expected, result)), + } +} + +/// Ensure prerequsities for masternode voting tests are met +pub async fn check_mn_voting_prerequisities(cfg: &Config) -> Result<(), Vec> { + let sdk = cfg.setup_api("check_mn_voting_prerequisities").await; + let mut errors = Vec::new(); + + let index_name = "parentNameAndLabel".to_string(); + + let query_contested_resources = VotePollsByDocumentTypeQuery { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name.clone(), + index_name: index_name.to_string(), + start_at_value: None, + start_index_values: vec![Value::Text("dash".into())], + end_index_values: vec![], + limit: None, + order_ascending: true, + }; + + // Check if we have enough contested resources; this implies that we have + // at least 1 vote poll for each of them + let contested_resources = ContestedResource::fetch_many(&sdk, query_contested_resources) + .await + .expect("fetch contested resources"); + if contested_resources.0.len() < 3 { + errors.push(format!( + "Please create at least 3 different DPNS names for masternode voting tests, found {}", + contested_resources.0.len() + )); + } + + // ensure we have enough contenders + let query_all = ContestedDocumentVotePollDriveQuery { + limit: None, + offset: None, + start_at: None, + vote_poll: ContestedDocumentResourceVotePoll { + index_name: "parentNameAndLabel".to_string(), + index_values: vec![ + Value::Text("dash".into()), + Value::Text(TEST_DPNS_NAME.to_string()), + ], + document_type_name: cfg.existing_document_type_name.clone(), + contract_id: cfg.existing_data_contract_id, + }, + allow_include_locked_and_abstaining_vote_tally: true, + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + }; + + let all_contenders = ContenderWithSerializedDocument::fetch_many(&sdk, query_all.clone()) + .await + .expect("fetch many contenders"); + if all_contenders.contenders.len() < 3 { + errors.push(format!( + "Please create 3 identities and create DPNS name `{}` for each of them, found {}", + TEST_DPNS_NAME, + all_contenders.contenders.len() + )); + } + + if errors.is_empty() { + Ok(()) + } else { + tracing::error!(?errors, "Prerequisities for masternode voting tests not met, please configure the network accordingly"); + Err(errors) + } +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_identity_votes.rs b/packages/rs-sdk/tests/fetch/contested_resource_identity_votes.rs new file mode 100644 index 00000000000..e213b6ac2f0 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_identity_votes.rs @@ -0,0 +1,110 @@ +//! Test GetContestedResourceIdentityVotesRequest + +use crate::fetch::{common::setup_logs, config::Config}; +use dash_sdk::platform::FetchMany; +use dpp::{ + dashcore::{hashes::Hash, ProTxHash}, + identifier::Identifier, + voting::votes::resource_vote::ResourceVote, +}; +use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; + +/// When we request votes for a non-existing identity, we should get no votes. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn contested_resource_identity_votes_not_found() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("contested_resource_identity_votes_not_found") + .await; + + // Given some non-existing identity ID + let identity_id = Identifier::new([0xff; 32]); + + // When I query for votes given by this identity + let query = ContestedResourceVotesGivenByIdentityQuery { + identity_id, + limit: None, + offset: None, + order_ascending: true, + start_at: None, + }; + let votes = ResourceVote::fetch_many(&sdk, query) + .await + .expect("fetch votes for identity"); + + // Then I get no votes + assert!(votes.is_empty(), "no votes expected for this query"); +} + +/// When we request votes for an existing identity, we should get some votes. +/// +/// ## Preconditions +/// +/// 1. At least one vote exists for the given masternode identity (protx hash). +/// +/// ## Setup process +/// +/// In order to setup this test, you need to: +/// +/// 0. Ensure you have at least 1 contested DPNS name in the system. +/// See [check_mn_voting_prerequisities](super::contested_resource::check_mn_voting_prerequisities) for more details. +/// +/// 1. Grep log output of `yarn setup` (see logs/setup.log) to find `ProRegTx transaction ID` and `Owner Private Key`: +/// ```bash +/// egrep '(ProRegTx transaction ID|Owner Private Key)' logs/setup.log|head -n2 +/// ``` +/// Hardcode `ProRegTx transaction ID` in [Config::default_protxhash]. +/// +/// 2. Load masternode identity into [rs-platform-explorer](https://github.com/dashpay/rs-platform-explorer/): +/// +/// * ensure `.env` file contains correct configuration +/// * start tui with `cargo run` +/// * select `w - wallet` +/// * ensure a wallet with positive balance is loaded; if not - load it (getting a wallet is out of scope of this document) +/// * select `p - Load Evonode Identity`. +/// * enter `ProRegTx transaction ID` and `Owner Private Key` from step 1. +/// * top up the identity balance using `t - Identity top up` option (1 DASH will be OK). +/// * exit Wallet screen using `q - Back to Main` +/// +/// 3. Vote for some contested resource using the masternode identity: +/// +/// * select `csnq`: `c - Contracts` -> `s - Fetch system contract` -> `n - Fetch DPNS contract` -> `q - Back to Contracts ` +/// * press ENTER to enter the fetched contract, then select `domain` -> `c - Query Contested Resources` +/// * Select one of displayed names, use `v - Vote`, select some identity. +/// +/// Now, vote should be casted and you can run this test. +/// +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see docs of contested_resource_identity_votes_ok()" +)] +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +pub(super) async fn contested_resource_identity_votes_ok() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg.setup_api("contested_resource_identity_votes_ok").await; + + // Given some existing proTxHash of some Validator that already voted + // Note: we hardcode default protxhash for offline testing in github actions + let protx = cfg.existing_protxhash().unwrap_or_else(|_| { + ProTxHash::from_byte_array( + hex::decode("74e26f433328be4b833b8958c04c51615e03853378e0d56fbe5ecf24977f884b") + .expect("valid hex-encoded protx hash") + .try_into() + .expect("valid protx hash length"), + ) + }); + + // When I query for votes given by this identity + let votes = ResourceVote::fetch_many(&sdk, protx) + .await + .expect("fetch votes for identity"); + + tracing::debug!(?protx, ?votes, "votes of masternode"); + + // Then I get some votes + assert!(!votes.is_empty(), "votes expected for this query"); +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_polls_by_ts.rs b/packages/rs-sdk/tests/fetch/contested_resource_polls_by_ts.rs new file mode 100644 index 00000000000..5fab5062f81 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_polls_by_ts.rs @@ -0,0 +1,224 @@ +//! Test VotePollsByEndDateDriveQuery + +use crate::fetch::{common::setup_logs, config::Config}; +use chrono::{DateTime, TimeZone, Utc}; +use dash_sdk::platform::FetchMany; +use dpp::voting::vote_polls::VotePoll; +use drive::query::VotePollsByEndDateDriveQuery; +use std::collections::BTreeMap; + +/// Test that we can fetch vote polls +/// +/// ## Preconditions +/// +/// 1. At least one vote poll exists +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn vote_polls_by_ts_ok() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg.setup_api("vote_polls_by_ts_ok").await; + super::contested_resource::check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + let query = VotePollsByEndDateDriveQuery { + limit: None, + offset: None, + order_ascending: true, + start_time: None, + end_time: None, + }; + + let rss = VotePoll::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + tracing::info!("vote polls retrieved: {:?}", rss); + assert!(!rss.0.is_empty()); +} + +/// Test that we can fetch vote polls ordered by timestamp, ascending and descending +/// +/// ## Preconditions +/// +/// 1. At least 2 vote polls exist +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +#[allow(non_snake_case)] +async fn vote_polls_by_ts_order_PLAN_661() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg.setup_api("vote_polls_by_ts_order").await; + super::contested_resource::check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + let base_query = VotePollsByEndDateDriveQuery { + limit: None, + offset: None, + order_ascending: true, + start_time: None, + end_time: None, + }; + + for order_ascending in [true, false] { + let query = VotePollsByEndDateDriveQuery { + order_ascending, + ..base_query.clone() + }; + + let rss = VotePoll::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + tracing::debug!(order_ascending, ?rss, "vote polls retrieved"); + assert!(!rss.0.is_empty()); + let enumerated = rss.0.iter().enumerate().collect::>(); + for (i, (ts, _)) in &enumerated { + if *i > 0 { + let (prev_ts, _) = &enumerated[&(i - 1)]; + if order_ascending { + assert!( + ts > prev_ts, + "ascending order: item {} ({}) must be > than item {} ({})", + ts, + i, + prev_ts, + i - 1 + ); + } else { + assert!( + ts < prev_ts, + "descending order: item {} ({}) must be < than item {} ({})", + ts, + i, + prev_ts, + i - 1 + ); + } + } + } + } +} + +/// Test that we can fetch vote polls with a limit +/// +/// ## Preconditions +/// +/// 1. At least 3 vote poll exists +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +async fn vote_polls_by_ts_limit() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg.setup_api("vote_polls_by_ts_limit").await; + super::contested_resource::check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + // Given index with more than 2 contested resources; note LIMIT must be > 1 + const LIMIT: usize = 2; + const LIMIT_ALL: usize = 100; + + let end_time: DateTime = Utc.with_ymd_and_hms(2035, 12, 24, 13, 59, 30).unwrap(); + + let query_all = VotePollsByEndDateDriveQuery { + limit: Some(LIMIT_ALL as u16), + offset: None, + order_ascending: true, + start_time: None, + end_time: Some((end_time.timestamp_millis() as u64, true)), // 1 month in future + }; + + let all = VotePoll::fetch_many(&sdk, query_all.clone()) + .await + .expect("fetch vote polls"); + // this counts timestamps, not vote polls themselves + let count_all_timestamps = all.0.len(); + assert_ne!(count_all_timestamps, 0, "at least one vote poll expected"); + + let all_values = all.0.into_iter().collect::>(); + + tracing::debug!( + count = count_all_timestamps, + all = ?all_values, + "All results" + ); + + for inclusive in [true, false] { + // When we query for 2 contested values at a time, we get all of them + let mut checked_count: usize = 0; + let mut start_time = None; + + loop { + let query = VotePollsByEndDateDriveQuery { + limit: Some(LIMIT as u16), + start_time, + ..query_all.clone() + }; + + let rss = VotePoll::fetch_many(&sdk, query) + .await + .expect("fetch vote polls"); + + let Some(last) = rss.0.last() else { + // no more vote polls + break; + }; + + tracing::debug!(polls=?rss, inclusive, ?start_time, checked_count, "Vote pools"); + let length = rss.0.len(); + + for (j, current) in rss.0.iter().enumerate() { + let all_idx = if inclusive && (checked_count > 0) { + j + checked_count - 1 + } else { + j + checked_count + }; + let expected = &all_values[all_idx]; + assert_eq!( + current.0, expected.0, + "inclusive {}: timestamp should match", + inclusive + ); + assert_eq!( + ¤t.1, &expected.1, + "inclusive {}: vote polls should match", + inclusive + ); + } + + tracing::debug!(polls=?rss, checked_count, ?start_time, "Vote polls"); + + start_time = Some((last.0, inclusive)); + // when inclusive, we include the first item in checked_count only on first iteration + checked_count += if inclusive && checked_count != 0 { + length - 1 + } else { + length + }; + + if (inclusive && length == 1) || (!inclusive && length == 0) { + break; + } + } + + assert_eq!( + checked_count, count_all_timestamps, + "all vote polls should be checked when inclusive is {}", + inclusive + ); + } +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs b/packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs new file mode 100644 index 00000000000..59d8770d955 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs @@ -0,0 +1,356 @@ +//! Tests for SDK requests that return one or more [Contender] objects. +use crate::fetch::{ + common::{setup_logs, setup_sdk_for_test_case, TEST_DPNS_NAME}, + config::Config, + contested_resource::check_mn_voting_prerequisities, +}; +use dash_sdk::platform::{Fetch, FetchMany}; +use dpp::{ + data_contract::{accessors::v0::DataContractV0Getters, DataContract}, + document::{ + serialization_traits::DocumentPlatformConversionMethodsV0, Document, DocumentV0Getters, + }, + identifier::Identifier, + platform_value::Value, + util::strings::convert_to_homograph_safe_chars, + voting::{ + contender_structs::ContenderWithSerializedDocument, + vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll, + }, +}; +use drive::query::vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, ContestedDocumentVotePollDriveQueryResultType, +}; +use test_case::test_case; + +/// Ensure we get proof of non-existence when querying for a non-existing index value. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn contested_resource_vote_states_not_found() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("contested_resource_vote_states_not_found") + .await; + // Given some existing data contract ID and non-existing label + let data_contract_id = cfg.existing_data_contract_id; + let label = "non existing name"; + + // When I query for vote poll states + let query = ContestedDocumentVotePollDriveQuery { + limit: None, + offset: None, + start_at: None, + vote_poll: ContestedDocumentResourceVotePoll { + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["nx".into(), label.into()], + document_type_name: cfg.existing_document_type_name, + contract_id: data_contract_id, + }, + allow_include_locked_and_abstaining_vote_tally: true, + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + }; + + let contenders = ContenderWithSerializedDocument::fetch_many(&sdk, query) + .await + .expect("fetch many contenders"); + // Then I get no contenders + assert!( + contenders.contenders.is_empty(), + "no contenders expected for this query" + ); +} + +/// Asking for non-existing contract should return error. +/// +/// Note: due to the way error handling is implemented, this test will not work +/// correctly in offline mode. +#[cfg_attr( + feature = "offline-testing", + ignore = "offline mode does not support this test" +)] +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn contested_resource_vote_states_nx_contract() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("contested_resource_vote_states_nx_contract") + .await; + + // Given some non-existing contract ID + let data_contract_id = Identifier::new([0xff; 32]); + + // When I query for votes referring this contract ID + let query = ContestedDocumentVotePollDriveQuery { + limit: None, + offset: None, + start_at: None, + vote_poll: ContestedDocumentResourceVotePoll { + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["dash".into()], + document_type_name: cfg.existing_document_type_name, + contract_id: data_contract_id, + }, + allow_include_locked_and_abstaining_vote_tally: true, + // TODO test other result types + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + }; + + // Then I get an error + let result = if let Err(e) = ContenderWithSerializedDocument::fetch_many(&sdk, query).await { + e + } else { + panic!("asking for non-existing contract should return error.") + }; + + if let dash_sdk::error::Error::DapiClientError(e) = result { + assert!( + e.contains( + "Transport(Status { code: InvalidArgument, message: \"contract not found error" + ), + "we should get contract not found error" + ); + } else { + panic!("expected 'contract not found' transport error"); + }; +} + +/// Ensure we can successfully query for existing index values. +/// +/// ## Preconditions +/// +/// 1. There must be at least one contender for name "dash" and value "[TEST_DPNS_NAME]". +/// +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn contested_resource_vote_states_ok() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg.setup_api("contested_resource_vote_states_ok").await; + // Given some existing data contract and existing label + + let query = base_query(&cfg); + + let data_contract_id = query.vote_poll.contract_id; + let document_type_name = &query.vote_poll.document_type_name; + + let data_contract = DataContract::fetch_by_identifier(&sdk, data_contract_id) + .await + .expect("fetch data contract") + .expect("found data contract"); + let document_type = data_contract + .document_type_for_name(document_type_name) + .expect("found document type"); + + // When I query for vote poll states with existing index values + + let contenders = ContenderWithSerializedDocument::fetch_many(&sdk, query) + .await + .expect("fetch many contenders"); + tracing::debug!(contenders=?contenders, "Contenders"); + // Then I get contenders + assert!( + !contenders.contenders.is_empty(), + "contenders expected for this query" + ); + + // verify that the contenders have the expected properties and we don't have duplicates + let mut seen = std::collections::BTreeSet::new(); + for contender in contenders.contenders { + let serialized_document = contender + .1 + .serialized_document() + .as_ref() + .expect("serialized doc"); + + let doc = Document::from_bytes(serialized_document, document_type, sdk.version()) + .expect("doc from bytes"); + assert!(seen.insert(doc.id()), "duplicate contender"); + let properties = doc.properties(); + assert_eq!(properties["parentDomainName"], Value::Text("dash".into())); + assert_eq!(properties["label"], Value::Text(TEST_DPNS_NAME.into())); + tracing::debug!(?properties, "document properties"); + } +} + +fn base_query(cfg: &Config) -> ContestedDocumentVotePollDriveQuery { + let index_value_2 = Value::Text(convert_to_homograph_safe_chars(TEST_DPNS_NAME)); + + ContestedDocumentVotePollDriveQuery { + limit: None, + offset: None, + start_at: None, + vote_poll: ContestedDocumentResourceVotePoll { + index_name: "parentNameAndLabel".to_string(), + index_values: vec![Value::Text("dash".into()), index_value_2], + document_type_name: cfg.existing_document_type_name.clone(), + contract_id: cfg.existing_data_contract_id, + }, + allow_include_locked_and_abstaining_vote_tally: true, + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + } +} + +/// Ensure we can limit the number of returned contenders. +/// +/// ## Preconditions +/// +/// 1. There must be at least 3 condenders for name "dash" and value [TEST_DPNS_NAME]. +/// +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +#[allow(non_snake_case)] +async fn contested_resource_vote_states_with_limit_PLAN_674() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("contested_resource_vote_states_with_limit") + .await; + check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisites not met"); + + // Given more contenders for some `label` than the limit + let data_contract_id = cfg.existing_data_contract_id; + let limit: u16 = 2; + let label = Value::Text(TEST_DPNS_NAME.into()); + + // ensure we have enough contenders + let query_all = ContestedDocumentVotePollDriveQuery { + limit: None, + offset: None, + start_at: None, + vote_poll: ContestedDocumentResourceVotePoll { + index_name: "parentNameAndLabel".to_string(), + index_values: vec![Value::Text("dash".into()), label.clone()], + document_type_name: cfg.existing_document_type_name, + contract_id: data_contract_id, + }, + allow_include_locked_and_abstaining_vote_tally: true, + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + }; + + let all_contenders = ContenderWithSerializedDocument::fetch_many(&sdk, query_all.clone()) + .await + .expect("fetch many contenders") + .contenders; + + tracing::debug!(?all_contenders, "All contenders"); + + assert!( + all_contenders.len() > limit as usize, + "we need more than {} contenders for this test", + limit + ); + + // When I query for vote poll states with a limit + let query = ContestedDocumentVotePollDriveQuery { + limit: Some(limit), + ..query_all + }; + + let contenders = ContenderWithSerializedDocument::fetch_many(&sdk, query.clone()) + .await + .expect("fetch many contenders"); + // Then I get no more than the limit of contenders + tracing::debug!(contenders=?contenders, ?query, "Contenders"); + + assert_eq!( + contenders.contenders.len(), + limit as usize, + "number of contenders for {:?} should must be at least {}", + label, + limit + ); +} + +type MutFn = fn(&mut ContestedDocumentVotePollDriveQuery); + +#[test_case(|q| q.limit = Some(0), Err("limit 0 out of bounds of [1, 100]"); "limit 0")] +#[test_case(|q| q.limit = Some(std::u16::MAX), Err("limit 65535 out of bounds of [1, 100]"); "limit std::u16::MAX")] +#[test_case(|q| q.start_at = Some(([0x11; 32], true)), Ok("Contenders { contenders: {Identifier("); "start_at does not exist should return next contenders")] +#[test_case(|q| q.start_at = Some(([0xff; 32], true)), Ok("Contenders { contenders: {}, abstain_vote_tally: None, lock_vote_tally: None }"); "start_at 0xff;32 should return zero contenders")] +#[test_case(|q| q.vote_poll.document_type_name = "nx doctype".to_string(), Err(r#"code: InvalidArgument, message: "document type nx doctype not found"#); "non existing document type returns InvalidArgument")] +#[test_case(|q| q.vote_poll.index_name = "nx index".to_string(), Err(r#"code: InvalidArgument, message: "index with name nx index is not the contested index"#); "non existing index returns InvalidArgument")] +#[test_case(|q| q.vote_poll.index_name = "dashIdentityId".to_string(), Err(r#"code: InvalidArgument, message: "index with name dashIdentityId is not the contested index"#); "existing non-contested index returns InvalidArgument")] +#[test_case(|q| q.vote_poll.index_values = vec![], Err("query uses index parentNameAndLabel, this index has 2 properties, but the query provided 0 index values instead"); "index_values empty vec returns error")] +#[test_case(|q| q.vote_poll.index_values = vec![Value::Text("".to_string())], Err("query uses index parentNameAndLabel, this index has 2 properties, but the query provided 1 index values instead"); "index_values empty string returns error")] +#[test_case(|q| q.vote_poll.index_values = vec![Value::Text("dash".to_string())], Err("query uses index parentNameAndLabel, this index has 2 properties, but the query provided 1 index values instead"); "index_values with one value returns error")] +#[test_case(|q| { + q.vote_poll.index_values = vec![ + Value::Text("dash".to_string()), + Value::Text(TEST_DPNS_NAME.to_string()), + ] +}, Ok("contenders: {Identifier("); "index_values with two values returns contenders")] +#[test_case(|q| { + q.vote_poll.index_values = vec![ + Value::Text("dash".to_string()), + Value::Text(TEST_DPNS_NAME.to_string()), + Value::Text("eee".to_string()), + ] +}, Err("query uses index parentNameAndLabel, this index has 2 properties, but the query provided 3 index values instead"); "index_values too many items should return error")] +#[test_case(|q| q.vote_poll.contract_id = Identifier::from([0xff; 32]), Err(r#"InvalidArgument, message: "contract not found error"#); "invalid contract id should cause InvalidArgument error")] +#[test_case(|q| q.allow_include_locked_and_abstaining_vote_tally = false, Ok(r#"contenders: {Identifier(IdentifierBytes32"#); "allow_include_locked_and_abstaining_vote_tally false should return some contenders")] +#[test_case(|q| { + q.result_type = ContestedDocumentVotePollDriveQueryResultType::Documents +}, Ok(r#"]), vote_tally: None })"#); "result_type Documents")] +#[test_case(|q| { + q.result_type = ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally +}, Ok(r#"]), vote_tally: Some("#); "result_type DocumentsAndVoteTally")] +#[test_case(|q| { + q.result_type = ContestedDocumentVotePollDriveQueryResultType::VoteTally +}, Ok(r#"serialized_document: None, vote_tally: Some"#); "result_type VoteTally")] +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +async fn contested_rss_vote_state_fields( + query_mut_fn: MutFn, + expect: Result<&'static str, &'static str>, +) -> Result<(), String> { + setup_logs(); + + let cfg = Config::new(); + check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisities"); + + let mut query = base_query(&cfg); + query_mut_fn(&mut query); + let (test_case_id, sdk) = + setup_sdk_for_test_case(cfg, query.clone(), "contested_rss_vote_state_fields_").await; + + tracing::debug!(test_case_id, ?query, "Executing test case query"); + + let result = ContenderWithSerializedDocument::fetch_many(&sdk, query).await; + tracing::debug!(?result, "Result of test case"); + match expect { + Ok(expected) if result.is_ok() => { + let result_string = format!("{:?}", result.as_ref().expect("result")); + if !result_string.contains(expected) { + Err(format!("expected: {:#?}\ngot: {:?}\n", expected, result)) + } else { + Ok(()) + } + } + Err(expected) if result.is_err() => { + let result = result.expect_err("error"); + if !result.to_string().contains(expected) { + Err(format!("expected: {:#?}\ngot {:?}\n", expected, result)) + } else { + Ok(()) + } + } + expected => Err(format!("expected: {:#?}\ngot: {:?}\n", expected, result)), + } +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_voters.rs b/packages/rs-sdk/tests/fetch/contested_resource_voters.rs new file mode 100644 index 00000000000..8d984f15f5c --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_voters.rs @@ -0,0 +1,149 @@ +//! Test GetContestedResourceVotersForIdentityRequest + +use dash_sdk::platform::FetchMany; +use dpp::{ + identifier::Identifier, + platform_value::{string_encoding::Encoding, Value}, + voting::contender_structs::ContenderWithSerializedDocument, +}; +use drive::query::{ + vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery, + vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, ContestedDocumentVotePollDriveQueryResultType, + }, +}; +use drive_proof_verifier::types::Voter; + +use crate::fetch::{ + common::{setup_logs, TEST_DPNS_NAME}, + config::Config, +}; + +/// When we request votes for a non-existing identity, we should get no votes. +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see docs of contested_resource_identity_votes_ok()" +)] +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn test_contested_resource_voters_for_identity_not_found() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg + .setup_api("test_contested_resource_voters_for_identity_not_found") + .await; + + let contestant_id = Identifier::new([0xff; 32]); + let index_name = "parentNameAndLabel"; + + let query = ContestedDocumentVotePollVotesDriveQuery { + limit: None, + offset: None, + order_ascending: true, + start_at: None, + vote_poll: dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name, + index_name: index_name.to_string(), + index_values: vec!["dash".into()], + }, + contestant_id, + }; + + let rss = Voter::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + + assert!(rss.0.is_empty()); +} + +/// When we request votes for an existing contestant, we should get some votes. +/// +/// ## Preconditions +/// +/// 1. Votes exist for DPNS name [TEST_DPNS_NAME]. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +async fn contested_resource_voters_for_existing_contestant() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("contested_resource_voters_for_existing_contestant") + .await; + + super::contested_resource::check_mn_voting_prerequisities(&cfg) + .await + .expect("prerequisites"); + + let index_name = "parentNameAndLabel".to_string(); + let index_value = Value::Text(TEST_DPNS_NAME.to_string()); + + // fetch contestant + let contestants_query = ContestedDocumentVotePollDriveQuery { + vote_poll: dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name.clone(), + index_name:index_name.clone(), + index_values: vec![Value::Text("dash".into()),index_value.clone()], + }, + limit: None, // TODO: Change to Some(1) when PLAN-656 is fixed + offset:None, + allow_include_locked_and_abstaining_vote_tally:true, + start_at: None, + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + }; + + let contenders = ContenderWithSerializedDocument::fetch_many(&sdk, contestants_query) + .await + .expect("fetch contenders"); + let contender_ids = contenders + .contenders + .keys() + .map(|id| id.to_string(Encoding::Base58)) + .collect::>(); + tracing::debug!( + contenders = ?contender_ids, + "contenders for {}", + &index_value + ); + + let mut votes = 0; + + for contestant in contenders.contenders.keys() { + let query = ContestedDocumentVotePollVotesDriveQuery { + limit: None, + offset: None, + start_at: None, + order_ascending: true, + vote_poll: dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name.clone(), + index_name: index_name.to_string(), + index_values: vec!["dash".into(), index_value.clone()], + }, + contestant_id:*contestant, + }; + + let rss = Voter::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + + tracing::debug!( + ?rss, + contender = contestant.to_string(Encoding::Base58), + "votes retrieved" + ); + votes += rss.0.len(); + } + + // We expect to find votes for the known contestant + assert_ne!( + votes, 0, + "Expected to find at least one vote for any of the contestants" + ); +} diff --git a/packages/rs-sdk/tests/fetch/data_contract.rs b/packages/rs-sdk/tests/fetch/data_contract.rs index 8d639b2d648..b59acbb97a4 100644 --- a/packages/rs-sdk/tests/fetch/data_contract.rs +++ b/packages/rs-sdk/tests/fetch/data_contract.rs @@ -1,6 +1,9 @@ -use crate::config::Config; +use super::config::Config; +use dash_sdk::platform::{Fetch, FetchMany, LimitQuery}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::platform_value::string_encoding::Encoding; use dpp::prelude::{DataContract, Identifier}; -use rs_sdk::platform::{Fetch, FetchMany}; +use drive_proof_verifier::types::DataContractHistory; /// Given some dummy data contract ID, when I fetch data contract, I get None because it doesn't exist. #[tokio::test(flavor = "multi_thread", worker_threads = 1)] @@ -9,9 +12,9 @@ async fn test_data_contract_read_not_found() { let id = Identifier::from_bytes(&DATA_CONTRACT_ID_BYTES).expect("parse identity id"); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_data_contract_read_not_found").await; - let result = DataContract::fetch(&mut sdk, id).await; + let result = DataContract::fetch(&sdk, id).await; assert!(matches!(result, Ok(None)), "result: {:?}", result); } @@ -23,9 +26,9 @@ async fn test_data_contract_read() { let cfg = Config::new(); let id = cfg.existing_data_contract_id; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_data_contract_read").await; - let result = DataContract::fetch_by_identifier(&mut sdk, id).await; + let result = DataContract::fetch_by_identifier(&sdk, id).await; assert!(matches!(result, Ok(Some(_))), "result: {:?}", result); assert_eq!(result.unwrap().unwrap().id(), id); @@ -40,9 +43,9 @@ async fn test_data_contracts_1_ok_1_nx() { let nx_id = Identifier::from_bytes(&[1; 32]).expect("parse identity id"); let ids = [id, nx_id]; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_data_contracts_1_ok_1_nx").await; - let result = DataContract::fetch_by_identifiers(&mut sdk, ids) + let result = DataContract::fetch_by_identifiers(&sdk, ids) .await .expect("fetch many data contracts"); @@ -73,9 +76,9 @@ async fn test_data_contracts_2_nx() { let nx_id_2 = Identifier::from_bytes(&[1; 32]).expect("parse identity id"); let ids = vec![nx_id_1, nx_id_2]; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_data_contracts_2_nx").await; - let result = DataContract::fetch_many(&mut sdk, ids) + let result = DataContract::fetch_many(&sdk, ids) .await .expect("fetch many data contracts"); @@ -88,3 +91,60 @@ async fn test_data_contracts_2_nx() { "proof of non-existence 2 failed" ); } + +/// Given some existing historical data contract ID, when I fetch the data contract history, I get it. +/// +/// +/// ## Setup +/// +/// It needs Data Contract with `keep_history` set to true, which is not available in the network +/// by default and has to be created manually. +/// At the moment tests in rs-sdk do not provide Core Wallet signer, and unable to create +/// identities and data contracts, so we cannot do that setup automatically. +/// +/// To run this test, you need to create a Data Contract with `keep_history` set to true. +/// You can use `packages/platform-test-suite/test/functional/platform/DataContract.spec.js` test for this. +/// +/// 1. Modify the test to display ID of the created Data Contract, for example: +/// ```diff +/// diff --git a/packages/platform-test-suite/test/functional/platform/DataContract.spec.js b/packages/platform-test-suite/test/functional/platform/DataContract.spec.js +/// index 28fe50b14..5864b3a14 100644 +/// --- a/packages/platform-test-suite/test/functional/platform/DataContract.spec.js +/// +++ b/packages/platform-test-suite/test/functional/platform/DataContract.spec.js +/// @@ -133,7 +133,7 @@ describe('Platform', () => { +/// it('should be able to update an existing data contract', async () => { +/// // Additional wait time to mitigate testnet latency +/// await waitForSTPropagated(); +/// - +/// + console.log(dataContractFixture.getId().toString("hex")); +/// const fetchedDataContract = await client.platform.contracts.get( +/// dataContractFixture.getId(), +/// ); +/// ``` +/// +/// 2. Run the test: +/// ```bash +/// cd packages/platform-test-suite +/// yarn mocha -b test/functional/platform/DataContract.spec.js +/// ``` +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "This test requires special procedure to regenerate test vectors" +)] +async fn test_data_contract_history_read() { + let cfg = Config::new(); + let id = Identifier::from_string( + "20d16030541c0494e84064e2e72b5ec620546305849a2f9d5893a5e65072364d", + Encoding::Hex, + ) + .unwrap(); + + let sdk = cfg.setup_api("test_data_contract_history_read").await; + + let result = DataContractHistory::fetch(&sdk, LimitQuery::from((id, 10))).await; + + assert!(matches!(result, Ok(Some(_))), "result: {:?}", result); + let (_, contract) = result.unwrap().unwrap().pop_first().unwrap(); + assert_eq!(contract.id(), id); +} diff --git a/packages/rs-sdk/tests/fetch/document.rs b/packages/rs-sdk/tests/fetch/document.rs index 6443c415b70..8263250d0b2 100644 --- a/packages/rs-sdk/tests/fetch/document.rs +++ b/packages/rs-sdk/tests/fetch/document.rs @@ -2,15 +2,13 @@ use std::sync::Arc; -use crate::common::setup_logs; -use crate::config::Config; +use super::{common::setup_logs, config::Config}; +use dash_sdk::platform::{DocumentQuery, Fetch, FetchMany}; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::{Document, DocumentV0Getters}; use dpp::platform_value::string_encoding::Encoding; use dpp::prelude::{DataContract, Identifier}; -use drive::query::DriveQuery; -use rs_sdk::platform::DocumentQuery; -use rs_sdk::platform::{Fetch, FetchMany}; +use drive::query::{DriveDocumentQuery, OrderClause, WhereClause}; /// Given some data contract ID, document type and document ID, when I fetch it, then I get it. #[tokio::test(flavor = "multi_thread", worker_threads = 1)] @@ -18,12 +16,12 @@ async fn document_read() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("document_read").await; let data_contract_id = cfg.existing_data_contract_id; let contract = Arc::new( - DataContract::fetch(&mut sdk, data_contract_id) + DataContract::fetch(&sdk, data_contract_id) .await .expect("fetch data contract") .expect("data contract not found"), @@ -33,7 +31,7 @@ async fn document_read() { let all_docs_query = DocumentQuery::new(Arc::clone(&contract), &cfg.existing_document_type_name) .expect("create SdkDocumentQuery"); - let first_doc = Document::fetch_many(&mut sdk, all_docs_query) + let first_doc = Document::fetch_many(&sdk, all_docs_query) .await .expect("fetch many documents") .pop_first() @@ -46,7 +44,7 @@ async fn document_read() { .expect("create SdkDocumentQuery") .with_document_id(&first_doc.id()); - let doc = Document::fetch(&mut sdk, query) + let doc = Document::fetch(&sdk, query) .await .expect("fetch document") .expect("document must be found"); @@ -60,22 +58,20 @@ async fn document_read_no_contract() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("document_read_no_contract").await; let data_contract_id = Identifier::from_bytes(&[0; 32]).expect("create Identifier"); let query = DocumentQuery::new_with_data_contract_id( - &mut sdk, + &sdk, data_contract_id, &cfg.existing_document_type_name, ) .await; - dbg!(&query); - assert!(matches!( query, - Err(rs_sdk::error::Error::MissingDependency(_, _)) + Err(dash_sdk::error::Error::MissingDependency(_, _)) )); } @@ -86,13 +82,13 @@ async fn document_read_no_document() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("document_read_no_document").await; let data_contract_id = cfg.existing_data_contract_id; let document_id = [0; 32].into(); let query = DocumentQuery::new_with_data_contract_id( - &mut sdk, + &sdk, data_contract_id, &cfg.existing_document_type_name, ) @@ -100,27 +96,23 @@ async fn document_read_no_document() { .expect("create SdkDocumentQuery") .with_document_id(&document_id); - let doc = Document::fetch(&mut sdk, query) - .await - .expect("fetch document"); + let doc = Document::fetch(&sdk, query).await.expect("fetch document"); assert!(doc.is_none(), "document must not be found"); } /// Given some data contract ID and document type with at least one document, when I fetch many documents using DriveQuery /// as a query, then I get one or more items. -/// -/// This test is ignored because it requires a running Platform. To run it, set constants in `common.rs` and run: #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn document_list_drive_query() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("document_list_drive_query").await; let data_contract_id = cfg.existing_data_contract_id; - let data_contract = DataContract::fetch(&mut sdk, data_contract_id) + let data_contract = DataContract::fetch(&sdk, data_contract_id) .await .expect("fetch data contract") .expect("data contract not found"); @@ -129,9 +121,19 @@ async fn document_list_drive_query() { .document_type_for_name(&cfg.existing_document_type_name) .expect("document type not found"); - let query = DriveQuery::any_item_query(&data_contract, doctype); - - let docs = ::fetch_many(&mut sdk, query) + let query = DriveDocumentQuery { + contract: &data_contract, + document_type: doctype, + internal_clauses: Default::default(), + offset: None, + limit: Some(1), + order_by: Default::default(), + start_at: None, + start_at_included: true, + block_time_ms: None, + }; + + let docs = ::fetch_many(&sdk, query) .await .expect("fetch many documents"); @@ -151,12 +153,12 @@ async fn document_list_document_query() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("document_list_document_query").await; let data_contract_id = cfg.existing_data_contract_id; let data_contract = Arc::new( - DataContract::fetch(&mut sdk, data_contract_id) + DataContract::fetch(&sdk, data_contract_id) .await .expect("fetch data contract") .expect("data contra)ct not found"), @@ -165,7 +167,7 @@ async fn document_list_document_query() { let query = DocumentQuery::new(Arc::clone(&data_contract), &cfg.existing_document_type_name) .expect("document query created"); - let docs = ::fetch_many(&mut sdk, query) + let docs = ::fetch_many(&sdk, query) .await .expect("fetch many documents"); @@ -177,3 +179,48 @@ async fn document_list_document_query() { tracing::info!(documents=?doc_ids, "fetched documents"); } + +/// Check if bug when processing Where clause containing `Value::Text("l")` string is fixed. +/// +///query: storage: protocol: value error: structure error: value was a string, but could not be decoded from base 58 +/// Given document query with where clause contains to `"l"` string, +/// when I fetch documents, +/// then I don't get error: +/// `query: storage: protocol: value error: structure error: value was a string, but could not be decoded from base 58`. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[allow(non_snake_case)] +#[ignore = "disabled due to bug PLAN-653"] +async fn document_list_bug_value_text_decode_base58_PLAN_653() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("document_list_bug_value_text_decode_base58") + .await; + + let data_contract_id = cfg.existing_data_contract_id; + + let contract = Arc::new( + DataContract::fetch(&sdk, data_contract_id) + .await + .expect("fetch data contract") + .expect("data contract not found"), + ); + + // Fetch multiple documents so that we get document ID + let query = DocumentQuery::new(Arc::clone(&contract), &cfg.existing_document_type_name) + .expect("create SdkDocumentQuery") + .with_where(WhereClause { + field: "records.identity".to_string(), + operator: drive::query::WhereOperator::Equal, + value: dpp::platform_value::Value::Text("l".into()), + }) + .with_order_by(OrderClause { + field: "records.identity".to_string(), + ascending: true, + }); + + let _docs = Document::fetch_many(&sdk, query) + .await + .expect("fetch many documents"); +} diff --git a/packages/rs-sdk/tests/fetch/epoch.rs b/packages/rs-sdk/tests/fetch/epoch.rs index 6bd9eaf431c..8080e3b344b 100644 --- a/packages/rs-sdk/tests/fetch/epoch.rs +++ b/packages/rs-sdk/tests/fetch/epoch.rs @@ -1,21 +1,24 @@ use std::collections::BTreeMap; -use crate::{common::setup_logs, config::Config}; +use super::{common::setup_logs, config::Config}; use dapi_grpc::platform::{ v0::{get_identity_request::GetIdentityRequestV0, GetIdentityRequest}, VersionedGrpcResponse, }; +use dash_sdk::{ + platform::{ + fetch_current_no_parameters::FetchCurrent, Fetch, FetchMany, LimitQuery, + DEFAULT_EPOCH_QUERY_LIMIT, + }, + Sdk, +}; use dpp::block::epoch::EpochIndex; use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0Getters; use dpp::block::extended_epoch_info::ExtendedEpochInfo; -use rs_dapi_client::{Dapi, RequestSettings}; -use rs_sdk::{ - platform::{Fetch, FetchMany, LimitQuery, DEFAULT_EPOCH_QUERY_LIMIT}, - Sdk, -}; +use rs_dapi_client::{DapiRequestExecutor, RequestSettings}; /// Get current epoch index from DAPI response metadata -async fn get_current_epoch(sdk: &mut Sdk, cfg: &Config) -> EpochIndex { +async fn get_current_epoch(sdk: &Sdk, cfg: &Config) -> EpochIndex { // We need existing epoch from metadata, so we'll use low-level API here to get it let identity_request: GetIdentityRequest = GetIdentityRequestV0 { id: cfg.existing_identity_id.to_vec(), @@ -78,15 +81,16 @@ async fn test_epoch_list() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_epoch_list").await; // Given some starting epoch and current epoch - let starting_epoch: EpochIndex = 0; - let current_epoch = get_current_epoch(&mut sdk, &cfg).await; + // Note the devnet does not necessarily start with epoch 0 + let starting_epoch: EpochIndex = 185; + let current_epoch = get_current_epoch(&sdk, &cfg).await; // When we fetch epochs from the server, starting with `starting_epoch` let epochs: BTreeMap> = - ExtendedEpochInfo::fetch_many(&mut sdk, starting_epoch) + ExtendedEpochInfo::fetch_many(&sdk, starting_epoch) .await .expect("list epochs"); @@ -104,19 +108,21 @@ async fn test_epoch_list_limit() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_epoch_list_limit").await; // Given some starting epoch and current epoch - let starting_epoch: EpochIndex = 1; - let current_epoch = get_current_epoch(&mut sdk, &cfg).await; + // Note the devnet does not necessarily start with epoch 0 + let starting_epoch: EpochIndex = 193; + let current_epoch = get_current_epoch(&sdk, &cfg).await; let limit = 2; let query: LimitQuery = LimitQuery { query: starting_epoch, limit: Some(limit), + start_info: None, }; - let epochs = ExtendedEpochInfo::fetch_many(&mut sdk, query) + let epochs = ExtendedEpochInfo::fetch_many(&sdk, query) .await .expect("list epochs"); @@ -129,12 +135,12 @@ async fn test_epoch_fetch() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_epoch_fetch").await; // Given some current epoch - let current_epoch = get_current_epoch(&mut sdk, &cfg).await; + let current_epoch = get_current_epoch(&sdk, &cfg).await; - let epoch = ExtendedEpochInfo::fetch(&mut sdk, current_epoch) + let epoch = ExtendedEpochInfo::fetch(&sdk, current_epoch) .await .expect("list epochs") .expect("epoch found"); @@ -148,14 +154,34 @@ async fn test_epoch_fetch_future() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_epoch_fetch_future").await; // Given some current epoch - let current_epoch = get_current_epoch(&mut sdk, &cfg).await; + let current_epoch = get_current_epoch(&sdk, &cfg).await; - let epoch = ExtendedEpochInfo::fetch(&mut sdk, current_epoch + 10) + let epoch = ExtendedEpochInfo::fetch(&sdk, current_epoch + 10) .await .expect("list epochs"); assert!(epoch.is_none()); } + +/// Fetch current epoch from Platform. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn test_epoch_fetch_current() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg.setup_api("test_epoch_fetch_current").await; + + // Given some current epoch + let expected_epoch = get_current_epoch(&sdk, &cfg).await; + + let epoch = ExtendedEpochInfo::fetch_current(&sdk) + .await + .expect("fetch current epoch"); + + assert_eq!(epoch.index(), expected_epoch); + + tracing::info!(epoch = ?epoch, "current epoch"); +} diff --git a/packages/rs-sdk/tests/fetch/identity.rs b/packages/rs-sdk/tests/fetch/identity.rs index 6fc6d5dbe90..ad5a458960f 100644 --- a/packages/rs-sdk/tests/fetch/identity.rs +++ b/packages/rs-sdk/tests/fetch/identity.rs @@ -1,14 +1,12 @@ +use dash_sdk::platform::types::identity::PublicKeyHash; +use dash_sdk::platform::{Fetch, FetchMany}; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::prelude::IdentityPublicKey; use dpp::{identity::hash::IdentityPublicKeyHashMethodsV0, prelude::Identity}; - use drive_proof_verifier::types::{IdentityBalance, IdentityBalanceAndRevision}; -use rs_sdk::platform::types::identity::PublicKeyHash; -use rs_sdk::platform::{Fetch, FetchMany}; -use crate::common::setup_logs; -use crate::config::Config; +use super::{common::setup_logs, config::Config}; /// Given some existing identity ID, when I fetch the identity, and I get it. #[tokio::test(flavor = "multi_thread", worker_threads = 1)] @@ -19,9 +17,9 @@ async fn test_identity_read() { let cfg = Config::new(); let id: dpp::prelude::Identifier = cfg.existing_identity_id; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_identity_read").await; - let identity = Identity::fetch(&mut sdk, id) + let identity = Identity::fetch(&sdk, id) .await .expect("fetch identity") .expect("found identity"); @@ -35,9 +33,9 @@ async fn test_identity_read_by_key() { let cfg = Config::new(); let id = cfg.existing_identity_id; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_identity_read_by_key").await; - let identity = Identity::fetch(&mut sdk, id) + let identity = Identity::fetch(&sdk, id) .await .expect("fetch identity") .expect("found identity"); @@ -47,10 +45,10 @@ async fn test_identity_read_by_key() { .first_key_value() .expect("need at least one pubkey") .1 - .hash() + .public_key_hash() .expect("public key hash"); - let identity2 = Identity::fetch(&mut sdk, PublicKeyHash(key_hash)) + let identity2 = Identity::fetch(&sdk, PublicKeyHash(key_hash)) .await .expect("fetch identity by key hash") .expect("found identity by key hash"); @@ -65,9 +63,9 @@ async fn test_identity_balance_read() { let cfg = Config::new(); let id: dpp::prelude::Identifier = cfg.existing_identity_id; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_identity_balance_read").await; - let balance = IdentityBalance::fetch(&mut sdk, id) + let balance = IdentityBalance::fetch(&sdk, id) .await .expect("fetch identity balance") .expect("found identity balance"); @@ -83,9 +81,9 @@ async fn test_identity_balance_revision_read() { let cfg = Config::new(); let id: dpp::prelude::Identifier = cfg.existing_identity_id; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_identity_balance_revision_read").await; - let (balance, revision) = IdentityBalanceAndRevision::fetch(&mut sdk, id) + let (balance, revision) = IdentityBalanceAndRevision::fetch(&sdk, id) .await .expect("fetch identity balance") .expect("found identity balance"); @@ -101,9 +99,9 @@ async fn test_identity_public_keys_all_read() { let cfg = Config::new(); let id: dpp::prelude::Identifier = cfg.existing_identity_id; - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_identity_public_keys_all_read").await; - let public_keys = IdentityPublicKey::fetch_many(&mut sdk, id) + let public_keys = IdentityPublicKey::fetch_many(&sdk, id) .await .expect("fetch identity public keys"); diff --git a/packages/rs-sdk/tests/fetch/identity_contract_nonce.rs b/packages/rs-sdk/tests/fetch/identity_contract_nonce.rs new file mode 100644 index 00000000000..26978a733f8 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/identity_contract_nonce.rs @@ -0,0 +1,46 @@ +use dash_sdk::platform::Fetch; +use dpp::prelude::Identifier; +use drive_proof_verifier::types::IdentityContractNonceFetcher; + +use super::{common::setup_logs, config::Config}; + +/// Given some existing identity ID, when I fetch the identity, and I get it. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn test_identity_contract_no_nonce_read() { + setup_logs(); + + let cfg = Config::new(); + let identity_id: dpp::prelude::Identifier = cfg.existing_identity_id; + // We are putting a contract id that does not exist, hence we will never get a nonce + let contract_id: dpp::prelude::Identifier = Identifier::from_bytes(&[5u8; 32]).unwrap(); + + let sdk = cfg.setup_api("test_identity_contract_no_nonce_read").await; + + let identity_contract_nonce = + IdentityContractNonceFetcher::fetch(&sdk, (identity_id, contract_id)) + .await + .expect("fetch identity contract nonce"); + + assert!(identity_contract_nonce.is_none()); +} + +// Todo: add this test when we have a mock wallet +// #[tokio::test(flavor = "multi_thread", worker_threads = 1)] +// async fn test_identity_contract_nonce_read() { +// setup_logs(); +// +// let cfg = Config::new(); +// let identity_id: dpp::prelude::Identifier = cfg.existing_identity_id; +// let contract_id: dpp::prelude::Identifier = cfg.existing_data_contract_id; +// +// let sdk = cfg.setup_api().await; +// +// let identity_contract_nonce = +// IdentityContractNonceFetcher::fetch(&sdk, (identity_id, contract_id)) +// .await +// .expect("fetch identity contract nonce") +// .expect("found identity contract nonce") +// .0; +// +// assert_eq!(identity_contract_nonce, 1); +// } diff --git a/packages/rs-sdk/tests/fetch/main.rs b/packages/rs-sdk/tests/fetch/main.rs deleted file mode 100644 index b5be6bfe821..00000000000 --- a/packages/rs-sdk/tests/fetch/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -#[cfg(not(feature = "mocks"))] -compile_error!("tests require `mocks` feature to be enabled"); - -#[cfg(not(any(feature = "network-testing", feature = "offline-testing")))] -compile_error!("network-testing or offline-testing must be enabled for tests"); - -mod common; -mod config; -mod data_contract; -mod document; -mod epoch; -mod identity; -mod mock_fetch; -mod mock_fetch_many; -mod protocol_version_vote_count; -mod protocol_version_votes; diff --git a/packages/rs-sdk/tests/fetch/mock_fetch.rs b/packages/rs-sdk/tests/fetch/mock_fetch.rs index 7872e1dc012..a5d49160772 100644 --- a/packages/rs-sdk/tests/fetch/mock_fetch.rs +++ b/packages/rs-sdk/tests/fetch/mock_fetch.rs @@ -2,6 +2,10 @@ //! use super::common::{mock_data_contract, mock_document_type}; +use dash_sdk::{ + platform::{DocumentQuery, Fetch}, + Sdk, +}; use dpp::{ data_contract::{ accessors::v0::DataContractV0Getters, @@ -12,10 +16,7 @@ use dpp::{ document::Document, identity::{accessors::IdentityGettersV0, IdentityV0}, prelude::{DataContract, Identifier, Identity}, -}; -use rs_sdk::{ - platform::{DocumentQuery, Fetch}, - Sdk, + version::PlatformVersion, }; #[tokio::test] @@ -26,9 +27,41 @@ async fn test_mock_fetch_identity() { let expected: Identity = Identity::from(IdentityV0::default()); let query = expected.id(); - sdk.mock().expect_fetch(query, Some(expected.clone())).await; + sdk.mock() + .expect_fetch(query, Some(expected.clone())) + .await + .unwrap(); - let retrieved = Identity::fetch(&mut sdk, query) + let retrieved = Identity::fetch(&sdk, query) + .await + .unwrap() + .expect("object should exist"); + + assert_eq!(retrieved, expected); +} + +#[tokio::test] +/// When I define mock expectation twice for the same request, second call ends with error +async fn test_mock_fetch_duplicate_expectation() { + let mut sdk = Sdk::new_mock(); + + let expected: Identity = Identity::from(IdentityV0::default()); + let expected2 = + Identity::random_identity(3, Some(2), PlatformVersion::latest()).expect("random identity"); + + let query = expected.id(); + + sdk.mock() + .expect_fetch(query, Some(expected.clone())) + .await + .expect("first expectation should be added correctly"); + + sdk.mock() + .expect_fetch(query, Some(expected2)) + .await + .expect_err("conflicting expectation should fail"); + + let retrieved = Identity::fetch(&sdk, query) .await .unwrap() .expect("object should exist"); @@ -43,9 +76,12 @@ async fn test_mock_fetch_identity_not_found() { let id = Identifier::random(); - sdk.mock().expect_fetch(id, None as Option).await; + sdk.mock() + .expect_fetch(id, None as Option) + .await + .unwrap(); - let retrieved = Identity::fetch(&mut sdk, id) + let retrieved = Identity::fetch(&sdk, id) .await .expect("fetch should succeed"); @@ -57,12 +93,16 @@ async fn test_mock_fetch_identity_not_found() { async fn test_mock_fetch_data_contract() { let mut sdk = Sdk::new_mock(); - let expected = mock_data_contract(None); + let document_type: DocumentType = mock_document_type(); + let expected = mock_data_contract(Some(&document_type)); let id = expected.id(); - sdk.mock().expect_fetch(id, Some(expected.clone())).await; + sdk.mock() + .expect_fetch(id, Some(expected.clone())) + .await + .unwrap(); - let retrieved = DataContract::fetch(&mut sdk, id) + let retrieved = DataContract::fetch(&sdk, id) .await .unwrap() .expect("object should exist"); @@ -87,19 +127,21 @@ async fn test_mock_fetch_document() { // [DocumentQuery::new_with_data_contract_id] will fetch the data contract first, so we need to define an expectation for it. sdk.mock() .expect_fetch(data_contract.id(), Some(data_contract.clone())) - .await; + .await + .unwrap(); let query = - DocumentQuery::new_with_data_contract_id(&mut sdk, data_contract.id(), document_type_name) + DocumentQuery::new_with_data_contract_id(&sdk, data_contract.id(), document_type_name) .await .expect("create document query") .with_document_id(&document_id); sdk.mock() .expect_fetch(query.clone(), Some(expected.clone())) - .await; + .await + .unwrap(); - let retrieved = Document::fetch(&mut sdk, query) + let retrieved = Document::fetch(&sdk, query) .await .unwrap() .expect("identity should exist"); diff --git a/packages/rs-sdk/tests/fetch/mock_fetch_many.rs b/packages/rs-sdk/tests/fetch/mock_fetch_many.rs index 23964267fb7..fdf3811d8d1 100644 --- a/packages/rs-sdk/tests/fetch/mock_fetch_many.rs +++ b/packages/rs-sdk/tests/fetch/mock_fetch_many.rs @@ -1,5 +1,10 @@ use std::collections::BTreeMap; +use super::common::{mock_data_contract, mock_document_type}; +use dash_sdk::{ + platform::{DocumentQuery, FetchMany}, + Sdk, +}; use dpp::{ data_contract::{ accessors::v0::DataContractV0Getters, @@ -9,12 +14,6 @@ use dpp::{ }, document::{Document, DocumentV0Getters}, }; -use rs_sdk::{ - platform::{DocumentQuery, FetchMany}, - Sdk, -}; - -use crate::common::{mock_data_contract, mock_document_type}; /// Given some data contract, document type and 1 document of this type, when I request multiple documents, I get that /// document. @@ -29,20 +28,33 @@ async fn test_mock_document_fetch_many() { .expect("document should be created"); let expected = BTreeMap::from([(expected_doc.id(), Some(expected_doc.clone()))]); + // document that should not be returned, as it will be defined as a duplicate + let not_expected_doc = document_type + .random_document(None, sdk.version()) + .expect("document 2 should be created"); + let not_expected = BTreeMap::from([(not_expected_doc.id(), Some(not_expected_doc))]); + let document_type_name = document_type.name(); // [DocumentQuery::new_with_document_id] will fetch the data contract first, so we need to define an expectation for it. sdk.mock() .expect_fetch(data_contract.id(), Some(data_contract.clone())) - .await; + .await + .unwrap(); let query = DocumentQuery::new(data_contract, document_type_name).expect("create document query"); sdk.mock() .expect_fetch_many(query.clone(), Some(expected.clone())) - .await; + .await + .unwrap(); + + sdk.mock() + .expect_fetch_many(query.clone(), Some(not_expected)) + .await + .expect_err("duplicate expectations are not allowed"); - let retrieved = Document::fetch_many(&mut sdk, query).await.unwrap(); + let retrieved = Document::fetch_many(&sdk, query).await.unwrap(); assert!(!retrieved.is_empty()); assert_eq!(retrieved, expected); diff --git a/packages/rs-sdk/tests/fetch/mod.rs b/packages/rs-sdk/tests/fetch/mod.rs new file mode 100644 index 00000000000..76e6c84c69c --- /dev/null +++ b/packages/rs-sdk/tests/fetch/mod.rs @@ -0,0 +1,26 @@ +// TODO: Rename this test package from `fetch` to `sdk`, 'integration` or sth similar +#[cfg(not(feature = "mocks"))] +compile_error!("tests require `mocks` feature to be enabled"); + +#[cfg(not(any(feature = "network-testing", feature = "offline-testing")))] +compile_error!("network-testing or offline-testing must be enabled for tests"); + +#[cfg(feature = "mocks")] +mod broadcast; +mod common; +mod config; +mod contested_resource; +mod contested_resource_identity_votes; +mod contested_resource_polls_by_ts; +mod contested_resource_vote_state; +mod contested_resource_voters; +mod data_contract; +mod document; +mod epoch; +mod identity; +mod identity_contract_nonce; +mod mock_fetch; +mod mock_fetch_many; +mod prefunded_specialized_balance; +mod protocol_version_vote_count; +mod protocol_version_votes; diff --git a/packages/rs-sdk/tests/fetch/prefunded_specialized_balance.rs b/packages/rs-sdk/tests/fetch/prefunded_specialized_balance.rs new file mode 100644 index 00000000000..1b7a773f907 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/prefunded_specialized_balance.rs @@ -0,0 +1,79 @@ +//! Test GetPrefundedSpecializedBalanceRequest + +use crate::fetch::{common::setup_logs, config::Config}; +use dash_sdk::platform::{Fetch, FetchMany}; +use dpp::{identifier::Identifier, voting::vote_polls::VotePoll}; +use drive::query::VotePollsByEndDateDriveQuery; +use drive_proof_verifier::types::PrefundedSpecializedBalance; + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn test_prefunded_specialized_balance_not_found() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg + .setup_api("test_prefunded_specialized_balance_not_found") + .await; + + let query = Identifier::from_bytes(&[1u8; 32]).expect("create identifier"); + + let rss = PrefundedSpecializedBalance::fetch(&sdk, query) + .await + .expect("fetch prefunded specialized balance"); + + assert!(rss.is_none()); +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + not(feature = "offline-testing"), + ignore = "requires manual DPNS names setup for masternode voting tests; see fn check_mn_voting_prerequisities()" +)] +async fn test_prefunded_specialized_balance_ok() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg.setup_api("test_prefunded_specialized_balance_ok").await; + + // Given some vote poll + let query = VotePollsByEndDateDriveQuery { + limit: None, + offset: None, + order_ascending: true, + start_time: None, + end_time: None, + }; + + let polls = VotePoll::fetch_many(&sdk, query) + .await + .expect("fetch vote polls"); + tracing::debug!("vote polls retrieved: {:?}", polls); + + let poll = polls + .0 + .first() + .expect("need at least one vote poll timestamp") + .1 + .first() + .expect("need at least one vote poll"); + + // Vote poll specialized balance ID + let balance_id = poll + .specialized_balance_id() + .expect("vote poll specialized balance ID") + .expect("must have specialized balance ID"); + + let balance = PrefundedSpecializedBalance::fetch(&sdk, balance_id) + .await + .expect("fetch prefunded specialized balance") + .expect("prefunded specialized balance expected for this query"); + + tracing::debug!(balance=?balance, "Prefunded specialized balance"); + + assert!( + balance.to_credits() > 0, + "prefunded specialized balance expected for this query" + ); +} diff --git a/packages/rs-sdk/tests/fetch/protocol_version_vote_count.rs b/packages/rs-sdk/tests/fetch/protocol_version_vote_count.rs index d8e0ece0c08..2c31ca7c2f4 100644 --- a/packages/rs-sdk/tests/fetch/protocol_version_vote_count.rs +++ b/packages/rs-sdk/tests/fetch/protocol_version_vote_count.rs @@ -1,6 +1,6 @@ -use crate::{common::setup_logs, config::Config}; -use drive_proof_verifier::types::ProtocolVersionVoteCount; -use rs_sdk::platform::FetchMany; +use super::{common::setup_logs, config::Config}; +use dash_sdk::platform::FetchMany; +use dpp::version::ProtocolVersionVoteCount; /// Given some existing identity ID, when I fetch the identity keys, I get some of them indexed by key ID. #[tokio::test(flavor = "multi_thread", worker_threads = 1)] @@ -8,9 +8,9 @@ async fn test_protocol_version_vote_count() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_protocol_version_vote_count").await; - let votings = ProtocolVersionVoteCount::fetch_many(&mut sdk, ()) + let votings = ProtocolVersionVoteCount::fetch_many(&sdk, ()) .await .expect("fetch protocol version votes"); diff --git a/packages/rs-sdk/tests/fetch/protocol_version_votes.rs b/packages/rs-sdk/tests/fetch/protocol_version_votes.rs index 2bd49019934..558534ebbd4 100644 --- a/packages/rs-sdk/tests/fetch/protocol_version_votes.rs +++ b/packages/rs-sdk/tests/fetch/protocol_version_votes.rs @@ -1,7 +1,7 @@ -use crate::{common::setup_logs, config::Config}; +use super::{common::setup_logs, config::Config}; +use dash_sdk::platform::{types::version_votes::MasternodeProtocolVoteEx, FetchMany}; use dashcore_rpc::dashcore::{hashes::Hash, ProTxHash}; use drive_proof_verifier::types::MasternodeProtocolVote; -use rs_sdk::platform::{types::version_votes::MasternodeProtocolVoteEx, FetchMany}; /// Given protxhash with only zeros, when I fetch protocol version votes for nodes, I can retrieve them. #[tokio::test(flavor = "multi_thread", worker_threads = 1)] @@ -9,10 +9,10 @@ async fn test_protocol_version_votes_zeros() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_protocol_version_votes_zeros").await; let starting_protxhash = ProTxHash::from_slice(&[0u8; 32]).expect("zero protxhash"); - let votings = MasternodeProtocolVote::fetch_many(&mut sdk, starting_protxhash) + let votings = MasternodeProtocolVote::fetch_many(&sdk, starting_protxhash) .await .expect("fetch protocol version votes by node"); @@ -27,9 +27,9 @@ async fn test_protocol_version_votes_none() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_protocol_version_votes_none").await; - let votings = MasternodeProtocolVote::fetch_many(&mut sdk, None) + let votings = MasternodeProtocolVote::fetch_many(&sdk, None) .await .expect("fetch protocol version votes by node"); @@ -44,10 +44,10 @@ async fn test_protocol_version_votes_limit_2() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_protocol_version_votes_limit_2").await; let starting_protxhash = ProTxHash::from_slice(&[0u8; 32]).expect("zero protxhash"); - let votings = MasternodeProtocolVote::fetch_many_with_limit(&mut sdk, starting_protxhash, 2) + let votings = MasternodeProtocolVote::fetch_many_with_limit(&sdk, starting_protxhash, 2) .await .expect("fetch protocol version votes by node"); @@ -62,10 +62,10 @@ async fn test_protocol_version_votes_nx() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_protocol_version_votes_nx").await; let starting_protxhash = Some(ProTxHash::from_slice(&[0xffu8; 32]).expect("zero protxhash")); - let votings = MasternodeProtocolVote::fetch_votes(&mut sdk, starting_protxhash, Some(2)) + let votings = MasternodeProtocolVote::fetch_votes(&sdk, starting_protxhash, Some(2)) .await .expect("fetch protocol version votes by node"); @@ -80,9 +80,9 @@ async fn test_protocol_version_votes_limit_0() { setup_logs(); let cfg = Config::new(); - let mut sdk = cfg.setup_api().await; + let sdk = cfg.setup_api("test_protocol_version_votes_limit_0").await; - let result = MasternodeProtocolVote::fetch_votes(&mut sdk, None, Some(0)).await; + let result = MasternodeProtocolVote::fetch_votes(&sdk, None, Some(0)).await; assert!(result.is_err()); } diff --git a/packages/rs-sdk/tests/main.rs b/packages/rs-sdk/tests/main.rs new file mode 100644 index 00000000000..7f11b913fc5 --- /dev/null +++ b/packages/rs-sdk/tests/main.rs @@ -0,0 +1,9 @@ +//! # SDK tests +//! +//! This module contains tests for the SDK. +//! Tests require `mocks` feature to be enabled. +//! +//! See Cargo.toml for more details. + +#[cfg(feature = "mocks")] +mod fetch; diff --git a/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/.gitkeep b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json new file mode 100644 index 00000000000..300e476a45e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json differ diff --git a/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetContestedResourcesRequest_8f71462d5f438e1b12fedf94ad5799af81392b7b0cbb7e86412da37ab13aef4b.json b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetContestedResourcesRequest_8f71462d5f438e1b12fedf94ad5799af81392b7b0cbb7e86412da37ab13aef4b.json new file mode 100644 index 00000000000..d9c45a55bb2 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetContestedResourcesRequest_8f71462d5f438e1b12fedf94ad5799af81392b7b0cbb7e86412da37ab13aef4b.json differ diff --git a/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/check_mn_voting_prerequisities/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/msg_GetContestedResourceIdentityVotesRequest_e000a8dfb1f42155770acb028f56557d0524384797bb450e22f41f66743d5d11.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/msg_GetContestedResourceIdentityVotesRequest_e000a8dfb1f42155770acb028f56557d0524384797bb450e22f41f66743d5d11.json new file mode 100644 index 00000000000..d1a33e908a8 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/msg_GetContestedResourceIdentityVotesRequest_e000a8dfb1f42155770acb028f56557d0524384797bb450e22f41f66743d5d11.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/msg_GetContestedResourceIdentityVotesRequest_3eae9b60bf6fb0140e51ef4cc1c1b4eb361d64607a75a117ebf3096fafb32a41.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/msg_GetContestedResourceIdentityVotesRequest_3eae9b60bf6fb0140e51ef4cc1c1b4eb361d64607a75a117ebf3096fafb32a41.json new file mode 100644 index 00000000000..a230d7abfea Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/msg_GetContestedResourceIdentityVotesRequest_3eae9b60bf6fb0140e51ef4cc1c1b4eb361d64607a75a117ebf3096fafb32a41.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetContestedResourceVoteStateRequest_8789d5d98ad7f00573a87fd0860dbd43fab2e54a98aa44bc88c049e1cf72f5fb.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetContestedResourceVoteStateRequest_8789d5d98ad7f00573a87fd0860dbd43fab2e54a98aa44bc88c049e1cf72f5fb.json new file mode 100644 index 00000000000..9f6fdc1a411 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetContestedResourceVoteStateRequest_8789d5d98ad7f00573a87fd0860dbd43fab2e54a98aa44bc88c049e1cf72f5fb.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_nx_contract/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_nx_contract/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_nx_contract/msg_GetContestedResourceVoteStateRequest_f700de7bfd247d4f0193fabc530ac956499cf0081eb632e6d84ef4f9c32d8690.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_nx_contract/msg_GetContestedResourceVoteStateRequest_f700de7bfd247d4f0193fabc530ac956499cf0081eb632e6d84ef4f9c32d8690.json new file mode 100644 index 00000000000..e9e6c9759de Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_nx_contract/msg_GetContestedResourceVoteStateRequest_f700de7bfd247d4f0193fabc530ac956499cf0081eb632e6d84ef4f9c32d8690.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json new file mode 100644 index 00000000000..300e476a45e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetContestedResourceVoteStateRequest_7a62b33ce71dec56fbbcb0302eac0041cdc16404006d1b30577292c6ce106cdb.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetContestedResourceVoteStateRequest_7a62b33ce71dec56fbbcb0302eac0041cdc16404006d1b30577292c6ce106cdb.json new file mode 100644 index 00000000000..e88e9376ff7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetContestedResourceVoteStateRequest_7a62b33ce71dec56fbbcb0302eac0041cdc16404006d1b30577292c6ce106cdb.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json new file mode 100644 index 00000000000..300e476a45e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_with_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json new file mode 100644 index 00000000000..300e476a45e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_4698eed49c628d65b930a48286b7b889b486f0341ced46beee35a8693507d319.json b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_4698eed49c628d65b930a48286b7b889b486f0341ced46beee35a8693507d319.json new file mode 100644 index 00000000000..85c6d7ca375 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_4698eed49c628d65b930a48286b7b889b486f0341ced46beee35a8693507d319.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_606cb2d93ca22b6a73e58bca36002e4d9a981806b2efa77c35b08bcffe360bc5.json b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_606cb2d93ca22b6a73e58bca36002e4d9a981806b2efa77c35b08bcffe360bc5.json new file mode 100644 index 00000000000..b5cd7667fde Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_606cb2d93ca22b6a73e58bca36002e4d9a981806b2efa77c35b08bcffe360bc5.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_901f0f04456fd2d03a1d16a56baeb2baad30765e2616aea8a61637690cc28b91.json b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_901f0f04456fd2d03a1d16a56baeb2baad30765e2616aea8a61637690cc28b91.json new file mode 100644 index 00000000000..58a98222fb7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetContestedResourceVotersForIdentityRequest_901f0f04456fd2d03a1d16a56baeb2baad30765e2616aea8a61637690cc28b91.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_voters_for_existing_contestant/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/msg_GetContestedResourcesRequest_25a3f1603510228a22726e0b4c35bce08c84a0cf72b34f6a408982f7babce2c2.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/msg_GetContestedResourcesRequest_25a3f1603510228a22726e0b4c35bce08c84a0cf72b34f6a408982f7babce2c2.json new file mode 100644 index 00000000000..bbfdee7b8e0 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/msg_GetContestedResourcesRequest_25a3f1603510228a22726e0b4c35bce08c84a0cf72b34f6a408982f7babce2c2.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_0760ac4854fc8db803bbcbab8709f390bd31511a05e29cd3f170b48ca6b87584/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_26378250faa97706848b4fee6ed2f2cb0ab194082b611404c4c28b595d5cecdf/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_26378250faa97706848b4fee6ed2f2cb0ab194082b611404c4c28b595d5cecdf/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_26378250faa97706848b4fee6ed2f2cb0ab194082b611404c4c28b595d5cecdf/msg_GetContestedResourcesRequest_77c7328647f3785936dfb2c48dbcf0ed3b40564b35e3ce17ee02d5b15e9bede1.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_26378250faa97706848b4fee6ed2f2cb0ab194082b611404c4c28b595d5cecdf/msg_GetContestedResourcesRequest_77c7328647f3785936dfb2c48dbcf0ed3b40564b35e3ce17ee02d5b15e9bede1.json new file mode 100644 index 00000000000..12c65611a9a Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_26378250faa97706848b4fee6ed2f2cb0ab194082b611404c4c28b595d5cecdf/msg_GetContestedResourcesRequest_77c7328647f3785936dfb2c48dbcf0ed3b40564b35e3ce17ee02d5b15e9bede1.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..e67826094c9 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","documentsMutable":false,"canBeDeleted":false,"indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place."}},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","documentsMutable":false,"canBeDeleted":true,"indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/msg_GetContestedResourcesRequest_e49260f4b2b31f8b6dafa5d51dd06732ed93fe23ffa9b35f6c92d6ef34732aff.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/msg_GetContestedResourcesRequest_e49260f4b2b31f8b6dafa5d51dd06732ed93fe23ffa9b35f6c92d6ef34732aff.json new file mode 100644 index 00000000000..829ff691419 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/msg_GetContestedResourcesRequest_e49260f4b2b31f8b6dafa5d51dd06732ed93fe23ffa9b35f6c92d6ef34732aff.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..22611d5e7e0 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/quorum_pubkey-106-24de77bd1f67e0c3e20a399b6a3e6bfae60312e2f833b302a62be93e181e7a0e.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/quorum_pubkey-106-24de77bd1f67e0c3e20a399b6a3e6bfae60312e2f833b302a62be93e181e7a0e.json new file mode 100644 index 00000000000..37a791a5b2c --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_2dd27fc692c7bf9389f3b48c73a4d2538a4eb72d54c01cc4620b16b06eb31f4c/quorum_pubkey-106-24de77bd1f67e0c3e20a399b6a3e6bfae60312e2f833b302a62be93e181e7a0e.json @@ -0,0 +1 @@ +a245c69b35145a4a4e1ed00b63fc64b6563d4def0cf87be3fe12e49ea6dc6821b2456cd849db635df51f7d466cf7ac6e \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_31d560b1c7927c2052e6d6efe7a00d204f33b4194f3fba7ed0ec5f2387097dac/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_31d560b1c7927c2052e6d6efe7a00d204f33b4194f3fba7ed0ec5f2387097dac/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_31d560b1c7927c2052e6d6efe7a00d204f33b4194f3fba7ed0ec5f2387097dac/msg_GetContestedResourcesRequest_219b7c56aec6474f1bb2eb673898fbd24420cbf27187df52fbb489e70b1c898d.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_31d560b1c7927c2052e6d6efe7a00d204f33b4194f3fba7ed0ec5f2387097dac/msg_GetContestedResourcesRequest_219b7c56aec6474f1bb2eb673898fbd24420cbf27187df52fbb489e70b1c898d.json new file mode 100644 index 00000000000..e49ea35e193 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_31d560b1c7927c2052e6d6efe7a00d204f33b4194f3fba7ed0ec5f2387097dac/msg_GetContestedResourcesRequest_219b7c56aec6474f1bb2eb673898fbd24420cbf27187df52fbb489e70b1c898d.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_3cd5aaa5bb117bd7a79c8f91545dbe469d5140b9e3c994bfcb80e3697cd9381e/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_3cd5aaa5bb117bd7a79c8f91545dbe469d5140b9e3c994bfcb80e3697cd9381e/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_3cd5aaa5bb117bd7a79c8f91545dbe469d5140b9e3c994bfcb80e3697cd9381e/msg_GetContestedResourcesRequest_be10704137c79a7c54b4c392a640353cf7adee1c4b04dc8689afc26031b9b010.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_3cd5aaa5bb117bd7a79c8f91545dbe469d5140b9e3c994bfcb80e3697cd9381e/msg_GetContestedResourcesRequest_be10704137c79a7c54b4c392a640353cf7adee1c4b04dc8689afc26031b9b010.json new file mode 100644 index 00000000000..a3f07928c11 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_3cd5aaa5bb117bd7a79c8f91545dbe469d5140b9e3c994bfcb80e3697cd9381e/msg_GetContestedResourcesRequest_be10704137c79a7c54b4c392a640353cf7adee1c4b04dc8689afc26031b9b010.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_465afbed74842189a7651d5ea128874bbcfcb0dc0e4c32ab8ea2d3c8a4d32a03/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_465afbed74842189a7651d5ea128874bbcfcb0dc0e4c32ab8ea2d3c8a4d32a03/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_465afbed74842189a7651d5ea128874bbcfcb0dc0e4c32ab8ea2d3c8a4d32a03/msg_GetContestedResourcesRequest_6ec2c2e0abfde5adf1d65d2b06ba7401f9ed4ef7493ce9faa08a50e6b4d2c34d.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_465afbed74842189a7651d5ea128874bbcfcb0dc0e4c32ab8ea2d3c8a4d32a03/msg_GetContestedResourcesRequest_6ec2c2e0abfde5adf1d65d2b06ba7401f9ed4ef7493ce9faa08a50e6b4d2c34d.json new file mode 100644 index 00000000000..ecc26853a49 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_465afbed74842189a7651d5ea128874bbcfcb0dc0e4c32ab8ea2d3c8a4d32a03/msg_GetContestedResourcesRequest_6ec2c2e0abfde5adf1d65d2b06ba7401f9ed4ef7493ce9faa08a50e6b4d2c34d.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/msg_GetContestedResourcesRequest_80ba1d11caa6442b39ab0f05e7fd84b9984fd04a4ca40a146aea81c3ea5c39ef.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/msg_GetContestedResourcesRequest_80ba1d11caa6442b39ab0f05e7fd84b9984fd04a4ca40a146aea81c3ea5c39ef.json new file mode 100644 index 00000000000..f4c8ab177bb Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/msg_GetContestedResourcesRequest_80ba1d11caa6442b39ab0f05e7fd84b9984fd04a4ca40a146aea81c3ea5c39ef.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_473cf8e4a270ced75e199e5a3e907b4df4cd66b64365d1ac77c45bcaed443a03/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_8ae090a1b1351d43a2df073800c78374b4bab6d7f26b2f163436712312233554/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_8ae090a1b1351d43a2df073800c78374b4bab6d7f26b2f163436712312233554/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_8ae090a1b1351d43a2df073800c78374b4bab6d7f26b2f163436712312233554/msg_GetContestedResourcesRequest_ad9ea5e65a5302d37eee711c9465a0fc6bf7035276b9ae4be55fb15774eb54e7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_8ae090a1b1351d43a2df073800c78374b4bab6d7f26b2f163436712312233554/msg_GetContestedResourcesRequest_ad9ea5e65a5302d37eee711c9465a0fc6bf7035276b9ae4be55fb15774eb54e7.json new file mode 100644 index 00000000000..92986258bab Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_8ae090a1b1351d43a2df073800c78374b4bab6d7f26b2f163436712312233554/msg_GetContestedResourcesRequest_ad9ea5e65a5302d37eee711c9465a0fc6bf7035276b9ae4be55fb15774eb54e7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_93d82dd3f64ebcd26d544e5e5d2933bfca11e0f2d904628d007ad04a12e66ea1/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_93d82dd3f64ebcd26d544e5e5d2933bfca11e0f2d904628d007ad04a12e66ea1/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_93d82dd3f64ebcd26d544e5e5d2933bfca11e0f2d904628d007ad04a12e66ea1/msg_GetContestedResourcesRequest_45785d2d1a5309b4b29ccfa650f30e457c9e0f5d50a3b8f0f86e1da3420877d7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_93d82dd3f64ebcd26d544e5e5d2933bfca11e0f2d904628d007ad04a12e66ea1/msg_GetContestedResourcesRequest_45785d2d1a5309b4b29ccfa650f30e457c9e0f5d50a3b8f0f86e1da3420877d7.json new file mode 100644 index 00000000000..729ec471237 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_93d82dd3f64ebcd26d544e5e5d2933bfca11e0f2d904628d007ad04a12e66ea1/msg_GetContestedResourcesRequest_45785d2d1a5309b4b29ccfa650f30e457c9e0f5d50a3b8f0f86e1da3420877d7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/msg_GetContestedResourcesRequest_5396ff2dd55051d854e18e406fbbfa6b1eff43954af904bce8f123fed7515132.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/msg_GetContestedResourcesRequest_5396ff2dd55051d854e18e406fbbfa6b1eff43954af904bce8f123fed7515132.json new file mode 100644 index 00000000000..827e98aa3b6 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/msg_GetContestedResourcesRequest_5396ff2dd55051d854e18e406fbbfa6b1eff43954af904bce8f123fed7515132.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_948b5a301af5fc73db7fed418a4fe90f64952b4ddd6b03a7f21d029dc110af50/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/msg_GetContestedResourcesRequest_f06ea270a508a9d9c386b8da170f67620695a23f63dc7376bd4a509e93335ce9.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/msg_GetContestedResourcesRequest_f06ea270a508a9d9c386b8da170f67620695a23f63dc7376bd4a509e93335ce9.json new file mode 100644 index 00000000000..df53609095a Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/msg_GetContestedResourcesRequest_f06ea270a508a9d9c386b8da170f67620695a23f63dc7376bd4a509e93335ce9.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_9f57b982b3e3b0286093d8b48ab27b87b22f67a172579913f2fec7a6b5ea31b7/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_afc96196b7f1e6f82927d852558ac6e2327f8c74d931d667fbe120136ceb5437/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_afc96196b7f1e6f82927d852558ac6e2327f8c74d931d667fbe120136ceb5437/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_afc96196b7f1e6f82927d852558ac6e2327f8c74d931d667fbe120136ceb5437/msg_GetContestedResourcesRequest_533d36b545633f42c839ba9038ec301f2326c1e59739fe07fb863facb5f2b5a8.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_afc96196b7f1e6f82927d852558ac6e2327f8c74d931d667fbe120136ceb5437/msg_GetContestedResourcesRequest_533d36b545633f42c839ba9038ec301f2326c1e59739fe07fb863facb5f2b5a8.json new file mode 100644 index 00000000000..3273894e346 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_afc96196b7f1e6f82927d852558ac6e2327f8c74d931d667fbe120136ceb5437/msg_GetContestedResourcesRequest_533d36b545633f42c839ba9038ec301f2326c1e59739fe07fb863facb5f2b5a8.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json new file mode 100644 index 00000000000..b689eb30423 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_b7df460e812b958de6e703d8ea325df9aab3448d0409ece3f0baf1d26629e44f/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_c1b9b8bbe62a89fc36d21db697688ddf4d34adb509daae02524ac41b312105a4/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_c1b9b8bbe62a89fc36d21db697688ddf4d34adb509daae02524ac41b312105a4/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_c1b9b8bbe62a89fc36d21db697688ddf4d34adb509daae02524ac41b312105a4/msg_GetContestedResourcesRequest_f063860c9156f1eb609f8f0cccf51b74928ffdfac56bc589d217525ce101d35b.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_c1b9b8bbe62a89fc36d21db697688ddf4d34adb509daae02524ac41b312105a4/msg_GetContestedResourcesRequest_f063860c9156f1eb609f8f0cccf51b74928ffdfac56bc589d217525ce101d35b.json new file mode 100644 index 00000000000..f4584c3156c Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_c1b9b8bbe62a89fc36d21db697688ddf4d34adb509daae02524ac41b312105a4/msg_GetContestedResourcesRequest_f063860c9156f1eb609f8f0cccf51b74928ffdfac56bc589d217525ce101d35b.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_ca7552f3c1737e70f4781f101ec9bf73f52ab260cbde3cddcbb38665da1db8f9/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_ca7552f3c1737e70f4781f101ec9bf73f52ab260cbde3cddcbb38665da1db8f9/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_ca7552f3c1737e70f4781f101ec9bf73f52ab260cbde3cddcbb38665da1db8f9/msg_GetContestedResourcesRequest_1935cb975797e6d5dc29cca6923b9c94b8d468da725cc241df1601e630036b97.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_ca7552f3c1737e70f4781f101ec9bf73f52ab260cbde3cddcbb38665da1db8f9/msg_GetContestedResourcesRequest_1935cb975797e6d5dc29cca6923b9c94b8d468da725cc241df1601e630036b97.json new file mode 100644 index 00000000000..4e53c65fa78 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_ca7552f3c1737e70f4781f101ec9bf73f52ab260cbde3cddcbb38665da1db8f9/msg_GetContestedResourcesRequest_1935cb975797e6d5dc29cca6923b9c94b8d468da725cc241df1601e630036b97.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/msg_GetContestedResourcesRequest_7dd3b1061a019dac5fa1f385b8bd5387b9cca48a3062a4db8bf0341a839f2bae.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/msg_GetContestedResourcesRequest_7dd3b1061a019dac5fa1f385b8bd5387b9cca48a3062a4db8bf0341a839f2bae.json new file mode 100644 index 00000000000..4f9cc1a3817 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/msg_GetContestedResourcesRequest_7dd3b1061a019dac5fa1f385b8bd5387b9cca48a3062a4db8bf0341a839f2bae.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_fields_ccb199c48ee58a8bb98742b964cba7bda3b4469b740201d2628f15f926f39347/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_d838e1005b493d45e2b6b39712f4aa144f22b4daa1470657c0ab97ffd4f04455/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_d838e1005b493d45e2b6b39712f4aa144f22b4daa1470657c0ab97ffd4f04455/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_d838e1005b493d45e2b6b39712f4aa144f22b4daa1470657c0ab97ffd4f04455/msg_GetContestedResourcesRequest_6c409367beedcc384cfd90f36b1b38482a11c7731ba150ddc1812e3310013c7a.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_d838e1005b493d45e2b6b39712f4aa144f22b4daa1470657c0ab97ffd4f04455/msg_GetContestedResourcesRequest_6c409367beedcc384cfd90f36b1b38482a11c7731ba150ddc1812e3310013c7a.json new file mode 100644 index 00000000000..69bf65c5aef Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_d838e1005b493d45e2b6b39712f4aa144f22b4daa1470657c0ab97ffd4f04455/msg_GetContestedResourcesRequest_6c409367beedcc384cfd90f36b1b38482a11c7731ba150ddc1812e3310013c7a.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_f7abf9d04f5e79fc1bbc2cc010a229ec4b04185dc80580e7e8dd783b45c4eac6/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_fields_f7abf9d04f5e79fc1bbc2cc010a229ec4b04185dc80580e7e8dd783b45c4eac6/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_fields_f7abf9d04f5e79fc1bbc2cc010a229ec4b04185dc80580e7e8dd783b45c4eac6/msg_GetContestedResourcesRequest_676e45023cbf73697f012bc5ac51a7310d759b9fe67594f3899f1e0485c383f1.json b/packages/rs-sdk/tests/vectors/contested_resources_fields_f7abf9d04f5e79fc1bbc2cc010a229ec4b04185dc80580e7e8dd783b45c4eac6/msg_GetContestedResourcesRequest_676e45023cbf73697f012bc5ac51a7310d759b9fe67594f3899f1e0485c383f1.json new file mode 100644 index 00000000000..08bfc6a9758 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_fields_f7abf9d04f5e79fc1bbc2cc010a229ec4b04185dc80580e7e8dd783b45c4eac6/msg_GetContestedResourcesRequest_676e45023cbf73697f012bc5ac51a7310d759b9fe67594f3899f1e0485c383f1.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_limit/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_limit/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_1501210861eb1ce786ba78ba0d7b68db1c1d188ebf01dca2745102e51d0016e4.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_1501210861eb1ce786ba78ba0d7b68db1c1d188ebf01dca2745102e51d0016e4.json new file mode 100644 index 00000000000..4e733b19449 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_1501210861eb1ce786ba78ba0d7b68db1c1d188ebf01dca2745102e51d0016e4.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_37c394b62a91dfe665432198561649a7d9108f9b96fc074e1da61f0fa19d3b5b.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_37c394b62a91dfe665432198561649a7d9108f9b96fc074e1da61f0fa19d3b5b.json new file mode 100644 index 00000000000..923641d5df7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_37c394b62a91dfe665432198561649a7d9108f9b96fc074e1da61f0fa19d3b5b.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_3b4ade5c7a2d0d346627a4ee2424f404a90172ba46f3ce4973a5f789c7f89cfa.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_3b4ade5c7a2d0d346627a4ee2424f404a90172ba46f3ce4973a5f789c7f89cfa.json new file mode 100644 index 00000000000..07e4176f457 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_3b4ade5c7a2d0d346627a4ee2424f404a90172ba46f3ce4973a5f789c7f89cfa.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_40ef2688b5170b8889257682591fb6f1f5b483c9e0840abcafe5bcc30b9f0bdd.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_40ef2688b5170b8889257682591fb6f1f5b483c9e0840abcafe5bcc30b9f0bdd.json new file mode 100644 index 00000000000..f670b0fb1e9 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_40ef2688b5170b8889257682591fb6f1f5b483c9e0840abcafe5bcc30b9f0bdd.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_41eaedc5b2d0e43291fbc6f3d9bf78e918d684b0f66257a9c7d33e2b62bfcfe8.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_41eaedc5b2d0e43291fbc6f3d9bf78e918d684b0f66257a9c7d33e2b62bfcfe8.json new file mode 100644 index 00000000000..c759b89111e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_41eaedc5b2d0e43291fbc6f3d9bf78e918d684b0f66257a9c7d33e2b62bfcfe8.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_51c71e845c3f579ad3ced0e35efed11f384144320c099f54b2530f0be42f8664.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_51c71e845c3f579ad3ced0e35efed11f384144320c099f54b2530f0be42f8664.json new file mode 100644 index 00000000000..1278507ddd4 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_51c71e845c3f579ad3ced0e35efed11f384144320c099f54b2530f0be42f8664.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_7785e71a6245fd4ec421fef4c411f4a723908b4ee33c4612727d101cf58f3394.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_7785e71a6245fd4ec421fef4c411f4a723908b4ee33c4612727d101cf58f3394.json new file mode 100644 index 00000000000..f626b729033 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_7785e71a6245fd4ec421fef4c411f4a723908b4ee33c4612727d101cf58f3394.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_8f4daadf3e41747492cd381cbbd1cf33dd52735f597de4b4c804effd2600d135.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_8f4daadf3e41747492cd381cbbd1cf33dd52735f597de4b4c804effd2600d135.json new file mode 100644 index 00000000000..84e1f32dedf Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_8f4daadf3e41747492cd381cbbd1cf33dd52735f597de4b4c804effd2600d135.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_f4686bfe637dbe76a6de26e085c3fb36ec9234525729613a7a0a3138baff6d6a.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_f4686bfe637dbe76a6de26e085c3fb36ec9234525729613a7a0a3138baff6d6a.json new file mode 100644 index 00000000000..81e24ba8f75 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_f4686bfe637dbe76a6de26e085c3fb36ec9234525729613a7a0a3138baff6d6a.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_ff56aa1c3d107ee8f232f889ce6d623ba6f340f6953cc1b450631f9e38394fa6.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_ff56aa1c3d107ee8f232f889ce6d623ba6f340f6953cc1b450631f9e38394fa6.json new file mode 100644 index 00000000000..0993f06871c Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetContestedResourcesRequest_ff56aa1c3d107ee8f232f889ce6d623ba6f340f6953cc1b450631f9e38394fa6.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_limit/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_00b7bac855f345476da659743b50939881e64c648abe4ad1313f570e98350d1f.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_00b7bac855f345476da659743b50939881e64c648abe4ad1313f570e98350d1f.json new file mode 100644 index 00000000000..c445831dadf Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_00b7bac855f345476da659743b50939881e64c648abe4ad1313f570e98350d1f.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_061d1caf0f2b50525a3e3506457850dfa046ebabf22c41f663ba73e3d730cf95.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_061d1caf0f2b50525a3e3506457850dfa046ebabf22c41f663ba73e3d730cf95.json new file mode 100644 index 00000000000..fc29731e9cc Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_061d1caf0f2b50525a3e3506457850dfa046ebabf22c41f663ba73e3d730cf95.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_09540b24c4d98960527f45bc20e828d50a4fa7b3230d23ddfac563877efd61e2.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_09540b24c4d98960527f45bc20e828d50a4fa7b3230d23ddfac563877efd61e2.json new file mode 100644 index 00000000000..a5a70d08934 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_09540b24c4d98960527f45bc20e828d50a4fa7b3230d23ddfac563877efd61e2.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_12a83820f10ece0b180bee7d58c1d4e66aec36ada2efbb1072f2196b5b856222.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_12a83820f10ece0b180bee7d58c1d4e66aec36ada2efbb1072f2196b5b856222.json new file mode 100644 index 00000000000..9ebddbd993e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_12a83820f10ece0b180bee7d58c1d4e66aec36ada2efbb1072f2196b5b856222.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_15d5b23b6b2036272bc068779fecda5177deb7014745c4e797a386e792e55fe7.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_15d5b23b6b2036272bc068779fecda5177deb7014745c4e797a386e792e55fe7.json new file mode 100644 index 00000000000..eda9be4b2a5 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_15d5b23b6b2036272bc068779fecda5177deb7014745c4e797a386e792e55fe7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1b0ced62edb21c226e57f54549af899d86a39c5259bdade02cd2e90c72b20388.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1b0ced62edb21c226e57f54549af899d86a39c5259bdade02cd2e90c72b20388.json new file mode 100644 index 00000000000..f071276122e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1b0ced62edb21c226e57f54549af899d86a39c5259bdade02cd2e90c72b20388.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f269e8f7c30fc23f85f4aa8c46214b0f6f6b7280b0ea686c2e0070f330add82.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f269e8f7c30fc23f85f4aa8c46214b0f6f6b7280b0ea686c2e0070f330add82.json new file mode 100644 index 00000000000..7c91cd21e13 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f269e8f7c30fc23f85f4aa8c46214b0f6f6b7280b0ea686c2e0070f330add82.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f4401f226caa8a5d77354422e8e82bd614dd12d29f8041839df02c578fb7ed2.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f4401f226caa8a5d77354422e8e82bd614dd12d29f8041839df02c578fb7ed2.json new file mode 100644 index 00000000000..89b1c78f641 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f4401f226caa8a5d77354422e8e82bd614dd12d29f8041839df02c578fb7ed2.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f5b3258963ef7c64984f0d15bbbadb27060d67cd8420c1101237534133c72e4.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f5b3258963ef7c64984f0d15bbbadb27060d67cd8420c1101237534133c72e4.json new file mode 100644 index 00000000000..2599be886c8 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_1f5b3258963ef7c64984f0d15bbbadb27060d67cd8420c1101237534133c72e4.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_247a25c20366e893f60cc0d9321dd268f3555081d2a3a5e112886b1c78b4009f.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_247a25c20366e893f60cc0d9321dd268f3555081d2a3a5e112886b1c78b4009f.json new file mode 100644 index 00000000000..d118b25e8ad Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_247a25c20366e893f60cc0d9321dd268f3555081d2a3a5e112886b1c78b4009f.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_2aeaf8f528e207ff093c003b46e3c4cd53b525ef27be36077437e8b9b8ffadd8.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_2aeaf8f528e207ff093c003b46e3c4cd53b525ef27be36077437e8b9b8ffadd8.json new file mode 100644 index 00000000000..e6948dc8607 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_2aeaf8f528e207ff093c003b46e3c4cd53b525ef27be36077437e8b9b8ffadd8.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_2b0bd7604b1c5ccc1f01ff0da46a4b98bc0a965fb8b29d1b552d5a29ae192ab9.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_2b0bd7604b1c5ccc1f01ff0da46a4b98bc0a965fb8b29d1b552d5a29ae192ab9.json new file mode 100644 index 00000000000..3c5d236a43f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_2b0bd7604b1c5ccc1f01ff0da46a4b98bc0a965fb8b29d1b552d5a29ae192ab9.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_307328f0782bfb7cdc1e11c92af84e6f2c2b37a1da002e0a485ad7bc30b764bb.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_307328f0782bfb7cdc1e11c92af84e6f2c2b37a1da002e0a485ad7bc30b764bb.json new file mode 100644 index 00000000000..dbbd1e333e0 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_307328f0782bfb7cdc1e11c92af84e6f2c2b37a1da002e0a485ad7bc30b764bb.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_4153546f1e76e6a6c20fb42644192ff55e2434e36b13595910f1c02c9473b680.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_4153546f1e76e6a6c20fb42644192ff55e2434e36b13595910f1c02c9473b680.json new file mode 100644 index 00000000000..b700bfc7fe0 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_4153546f1e76e6a6c20fb42644192ff55e2434e36b13595910f1c02c9473b680.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_43103f757a1b16752bdf92997fe1d98cc81197999226ba2a06e1002b94fa99ba.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_43103f757a1b16752bdf92997fe1d98cc81197999226ba2a06e1002b94fa99ba.json new file mode 100644 index 00000000000..cbd3d73ca3b Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_43103f757a1b16752bdf92997fe1d98cc81197999226ba2a06e1002b94fa99ba.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_49593e41313ee6da1685f4a59d9e8d08982802ad41ae314ebdd902533315d200.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_49593e41313ee6da1685f4a59d9e8d08982802ad41ae314ebdd902533315d200.json new file mode 100644 index 00000000000..396a405b2a3 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_49593e41313ee6da1685f4a59d9e8d08982802ad41ae314ebdd902533315d200.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_4bc3a31c696a234e5ef24e6a1d5f8d622dd35b75e8090c88ddc45fd4e669d448.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_4bc3a31c696a234e5ef24e6a1d5f8d622dd35b75e8090c88ddc45fd4e669d448.json new file mode 100644 index 00000000000..f90eb17e1ac Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_4bc3a31c696a234e5ef24e6a1d5f8d622dd35b75e8090c88ddc45fd4e669d448.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_53acfa6801e8faf3968fcb37b1977aa3058a5e96a54279f3cd7b134ef5efcbb1.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_53acfa6801e8faf3968fcb37b1977aa3058a5e96a54279f3cd7b134ef5efcbb1.json new file mode 100644 index 00000000000..3c675f72e94 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_53acfa6801e8faf3968fcb37b1977aa3058a5e96a54279f3cd7b134ef5efcbb1.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_5685b7b4cb0467fc8d4021fb120b76feb7a8b605c1da4a28fc1fd42e93420169.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_5685b7b4cb0467fc8d4021fb120b76feb7a8b605c1da4a28fc1fd42e93420169.json new file mode 100644 index 00000000000..dedeb51050f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_5685b7b4cb0467fc8d4021fb120b76feb7a8b605c1da4a28fc1fd42e93420169.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_5dd4150344158e77182615c11c9a65ca8a14db4b0950279b5edbf16c6ef5572c.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_5dd4150344158e77182615c11c9a65ca8a14db4b0950279b5edbf16c6ef5572c.json new file mode 100644 index 00000000000..7726ce69365 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_5dd4150344158e77182615c11c9a65ca8a14db4b0950279b5edbf16c6ef5572c.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_61164ed4c833bb713ba73b843a1ac9fe0fc7e82040ccd47c874cd988de5a8574.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_61164ed4c833bb713ba73b843a1ac9fe0fc7e82040ccd47c874cd988de5a8574.json new file mode 100644 index 00000000000..0d8699da07b Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_61164ed4c833bb713ba73b843a1ac9fe0fc7e82040ccd47c874cd988de5a8574.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_6867758e065031acc5e4b6bf5ef3b70df05ee0895f634d3fdffa5e9c7fdee578.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_6867758e065031acc5e4b6bf5ef3b70df05ee0895f634d3fdffa5e9c7fdee578.json new file mode 100644 index 00000000000..a018630dd12 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_6867758e065031acc5e4b6bf5ef3b70df05ee0895f634d3fdffa5e9c7fdee578.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_74477b940a401b9daa770791ce4ffaf2f0b3d1a7ca2598153024a58bdea3b343.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_74477b940a401b9daa770791ce4ffaf2f0b3d1a7ca2598153024a58bdea3b343.json new file mode 100644 index 00000000000..bdfacb50136 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_74477b940a401b9daa770791ce4ffaf2f0b3d1a7ca2598153024a58bdea3b343.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_7e6aba0e36304760488e6c79655130dcb43dda8bfe725b4edb4b10dd8cdd687c.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_7e6aba0e36304760488e6c79655130dcb43dda8bfe725b4edb4b10dd8cdd687c.json new file mode 100644 index 00000000000..6812e095d88 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_7e6aba0e36304760488e6c79655130dcb43dda8bfe725b4edb4b10dd8cdd687c.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_84129be05fe87a6227fd33f6a281e6062b594012b0f6d26dbb54c090b43170cc.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_84129be05fe87a6227fd33f6a281e6062b594012b0f6d26dbb54c090b43170cc.json new file mode 100644 index 00000000000..c0b0ba5a832 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_84129be05fe87a6227fd33f6a281e6062b594012b0f6d26dbb54c090b43170cc.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_8c2e50a4e3c6b6bcce52453520e5d377ddbe6cbdccdff3bb18a89ec8aee7fcec.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_8c2e50a4e3c6b6bcce52453520e5d377ddbe6cbdccdff3bb18a89ec8aee7fcec.json new file mode 100644 index 00000000000..b7f3e9d8985 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_8c2e50a4e3c6b6bcce52453520e5d377ddbe6cbdccdff3bb18a89ec8aee7fcec.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_926a2ab53948280066d8d01e7126cf4557623b124ff6f1e0131ae69643535b3d.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_926a2ab53948280066d8d01e7126cf4557623b124ff6f1e0131ae69643535b3d.json new file mode 100644 index 00000000000..19e2c3381e6 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_926a2ab53948280066d8d01e7126cf4557623b124ff6f1e0131ae69643535b3d.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_98569ec1918d08eb3547ba4c967535066f7babdbf0697172b281e941ef3a648a.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_98569ec1918d08eb3547ba4c967535066f7babdbf0697172b281e941ef3a648a.json new file mode 100644 index 00000000000..33f16b8e2b2 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_98569ec1918d08eb3547ba4c967535066f7babdbf0697172b281e941ef3a648a.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_9a9ab8f7de794f5cbd193c0a79bb64d9a30d277e5438a64f924837c460481679.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_9a9ab8f7de794f5cbd193c0a79bb64d9a30d277e5438a64f924837c460481679.json new file mode 100644 index 00000000000..60b1f041bf9 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_9a9ab8f7de794f5cbd193c0a79bb64d9a30d277e5438a64f924837c460481679.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_9bbca1d0964fff817f0ae605922a2614e9ae55d61ff889a99923b50dacf52c35.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_9bbca1d0964fff817f0ae605922a2614e9ae55d61ff889a99923b50dacf52c35.json new file mode 100644 index 00000000000..2af0811b022 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_9bbca1d0964fff817f0ae605922a2614e9ae55d61ff889a99923b50dacf52c35.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_adad8ba03f57791b0c73db74cfbc98186f8f457f14160313b070d535fbe9aac9.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_adad8ba03f57791b0c73db74cfbc98186f8f457f14160313b070d535fbe9aac9.json new file mode 100644 index 00000000000..809e65d83fe Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_adad8ba03f57791b0c73db74cfbc98186f8f457f14160313b070d535fbe9aac9.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_b799ae8be5055118672da926306fcc750470faf458435db3d7e52a8557e0d52c.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_b799ae8be5055118672da926306fcc750470faf458435db3d7e52a8557e0d52c.json new file mode 100644 index 00000000000..d4fe9e5e750 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_b799ae8be5055118672da926306fcc750470faf458435db3d7e52a8557e0d52c.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_c9d26c216a8382dee66a3be97b6a822571b9076725566d64e35d36a9cbe991eb.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_c9d26c216a8382dee66a3be97b6a822571b9076725566d64e35d36a9cbe991eb.json new file mode 100644 index 00000000000..5c3f4242d5e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_c9d26c216a8382dee66a3be97b6a822571b9076725566d64e35d36a9cbe991eb.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_cbf94dc9a7e25b00b3a6d10a6efa3a5accdb36127a2e88a02f40578b6bebc0bc.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_cbf94dc9a7e25b00b3a6d10a6efa3a5accdb36127a2e88a02f40578b6bebc0bc.json new file mode 100644 index 00000000000..ecc6f4e290f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetContestedResourcesRequest_cbf94dc9a7e25b00b3a6d10a6efa3a5accdb36127a2e88a02f40578b6bebc0bc.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resources_start_at_value/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1dcc38056f4539944947f843fc5f119ce3058e09a215dcdfdd563c9aca6fc4d3/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1dcc38056f4539944947f843fc5f119ce3058e09a215dcdfdd563c9aca6fc4d3/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1dcc38056f4539944947f843fc5f119ce3058e09a215dcdfdd563c9aca6fc4d3/msg_GetContestedResourceVoteStateRequest_cf751de542a527e565d916c33542a952aa4f09be27ca526b34c4a2d6f7ec3f76.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1dcc38056f4539944947f843fc5f119ce3058e09a215dcdfdd563c9aca6fc4d3/msg_GetContestedResourceVoteStateRequest_cf751de542a527e565d916c33542a952aa4f09be27ca526b34c4a2d6f7ec3f76.json new file mode 100644 index 00000000000..cc97903beb5 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1dcc38056f4539944947f843fc5f119ce3058e09a215dcdfdd563c9aca6fc4d3/msg_GetContestedResourceVoteStateRequest_cf751de542a527e565d916c33542a952aa4f09be27ca526b34c4a2d6f7ec3f76.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1df65b498b006bfa52a1c425f30183fdd50ed811f9cd65d2384e688409dfe252/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1df65b498b006bfa52a1c425f30183fdd50ed811f9cd65d2384e688409dfe252/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1df65b498b006bfa52a1c425f30183fdd50ed811f9cd65d2384e688409dfe252/msg_GetContestedResourceVoteStateRequest_b893574a2cd12595446c7084d714266c27c9b0d3c1c6b9dc022c7cf69fde2174.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1df65b498b006bfa52a1c425f30183fdd50ed811f9cd65d2384e688409dfe252/msg_GetContestedResourceVoteStateRequest_b893574a2cd12595446c7084d714266c27c9b0d3c1c6b9dc022c7cf69fde2174.json new file mode 100644 index 00000000000..da2de8910be Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__1df65b498b006bfa52a1c425f30183fdd50ed811f9cd65d2384e688409dfe252/msg_GetContestedResourceVoteStateRequest_b893574a2cd12595446c7084d714266c27c9b0d3c1c6b9dc022c7cf69fde2174.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__27af3929f22f30de9fa0b90a34194699c0d55b6accfc72374026d2d9bc0f9e01/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__27af3929f22f30de9fa0b90a34194699c0d55b6accfc72374026d2d9bc0f9e01/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__27af3929f22f30de9fa0b90a34194699c0d55b6accfc72374026d2d9bc0f9e01/msg_GetContestedResourceVoteStateRequest_c5783e3abe0971640509ed3b5e20092d1597a92997ac79de0ef89f4cde74aefc.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__27af3929f22f30de9fa0b90a34194699c0d55b6accfc72374026d2d9bc0f9e01/msg_GetContestedResourceVoteStateRequest_c5783e3abe0971640509ed3b5e20092d1597a92997ac79de0ef89f4cde74aefc.json new file mode 100644 index 00000000000..8d738521a52 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__27af3929f22f30de9fa0b90a34194699c0d55b6accfc72374026d2d9bc0f9e01/msg_GetContestedResourceVoteStateRequest_c5783e3abe0971640509ed3b5e20092d1597a92997ac79de0ef89f4cde74aefc.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/msg_GetContestedResourceVoteStateRequest_71f48f72373e5db9721e095e8cdc12823a7175b930f49aebb8d9844065da5b44.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/msg_GetContestedResourceVoteStateRequest_71f48f72373e5db9721e095e8cdc12823a7175b930f49aebb8d9844065da5b44.json new file mode 100644 index 00000000000..55e33840e7a Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/msg_GetContestedResourceVoteStateRequest_71f48f72373e5db9721e095e8cdc12823a7175b930f49aebb8d9844065da5b44.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__2c32c08bee77a2d062db8d1cdb999a841b21043ccc5e7fc5ff1507f9703754a9/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__4d228b5af660c840e140560916dee664696a82c2b75fda103a6490a0a0119fea/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__4d228b5af660c840e140560916dee664696a82c2b75fda103a6490a0a0119fea/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__4d228b5af660c840e140560916dee664696a82c2b75fda103a6490a0a0119fea/msg_GetContestedResourceVoteStateRequest_bd857f0f40a11ccbc620754f0b276da7bcf8bb6352f7f5f26cb8af584712e16a.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__4d228b5af660c840e140560916dee664696a82c2b75fda103a6490a0a0119fea/msg_GetContestedResourceVoteStateRequest_bd857f0f40a11ccbc620754f0b276da7bcf8bb6352f7f5f26cb8af584712e16a.json new file mode 100644 index 00000000000..2f16ce90b6d Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__4d228b5af660c840e140560916dee664696a82c2b75fda103a6490a0a0119fea/msg_GetContestedResourceVoteStateRequest_bd857f0f40a11ccbc620754f0b276da7bcf8bb6352f7f5f26cb8af584712e16a.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/msg_GetContestedResourceVoteStateRequest_f7848301c15560f971e007963a349e64e07602f543bda42d5a5d223f0e6102a9.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/msg_GetContestedResourceVoteStateRequest_f7848301c15560f971e007963a349e64e07602f543bda42d5a5d223f0e6102a9.json new file mode 100644 index 00000000000..1dde44a113d Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/msg_GetContestedResourceVoteStateRequest_f7848301c15560f971e007963a349e64e07602f543bda42d5a5d223f0e6102a9.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__67dc63814e035b20ff705840e19ebb329026b51129b8dd9cd029d26a0a77408b/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__863d867345b51a45ba4ec8326f42701a86224b53737b607521f5711340b8ecea/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__863d867345b51a45ba4ec8326f42701a86224b53737b607521f5711340b8ecea/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__863d867345b51a45ba4ec8326f42701a86224b53737b607521f5711340b8ecea/msg_GetContestedResourceVoteStateRequest_b9a737558f8e65f57294ca0f43cb3f1bccd65e01bb860f7648ce860ce03df202.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__863d867345b51a45ba4ec8326f42701a86224b53737b607521f5711340b8ecea/msg_GetContestedResourceVoteStateRequest_b9a737558f8e65f57294ca0f43cb3f1bccd65e01bb860f7648ce860ce03df202.json new file mode 100644 index 00000000000..dd707956b4f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__863d867345b51a45ba4ec8326f42701a86224b53737b607521f5711340b8ecea/msg_GetContestedResourceVoteStateRequest_b9a737558f8e65f57294ca0f43cb3f1bccd65e01bb860f7648ce860ce03df202.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__8693b7b63d4af227f34a1c743e52147d48e775e679e50375df37f30bc707ef95/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__8693b7b63d4af227f34a1c743e52147d48e775e679e50375df37f30bc707ef95/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__8693b7b63d4af227f34a1c743e52147d48e775e679e50375df37f30bc707ef95/msg_GetContestedResourceVoteStateRequest_c6f0fff8a974cf324b6c2a285e0ae85cdc0620cb84d732a686322ae9dd8c5240.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__8693b7b63d4af227f34a1c743e52147d48e775e679e50375df37f30bc707ef95/msg_GetContestedResourceVoteStateRequest_c6f0fff8a974cf324b6c2a285e0ae85cdc0620cb84d732a686322ae9dd8c5240.json new file mode 100644 index 00000000000..81c0610d4f7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__8693b7b63d4af227f34a1c743e52147d48e775e679e50375df37f30bc707ef95/msg_GetContestedResourceVoteStateRequest_c6f0fff8a974cf324b6c2a285e0ae85cdc0620cb84d732a686322ae9dd8c5240.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__90ed25475456fdfd4f2fd676ed5b5f2e9c390cae806202a046fc93153eea6e00/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__90ed25475456fdfd4f2fd676ed5b5f2e9c390cae806202a046fc93153eea6e00/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__90ed25475456fdfd4f2fd676ed5b5f2e9c390cae806202a046fc93153eea6e00/msg_GetContestedResourceVoteStateRequest_6192aa18cf199acc9ca27cbe0377de9b6df87c4df053f3032a3fac93ca2985c2.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__90ed25475456fdfd4f2fd676ed5b5f2e9c390cae806202a046fc93153eea6e00/msg_GetContestedResourceVoteStateRequest_6192aa18cf199acc9ca27cbe0377de9b6df87c4df053f3032a3fac93ca2985c2.json new file mode 100644 index 00000000000..8e7ba32ccda Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__90ed25475456fdfd4f2fd676ed5b5f2e9c390cae806202a046fc93153eea6e00/msg_GetContestedResourceVoteStateRequest_6192aa18cf199acc9ca27cbe0377de9b6df87c4df053f3032a3fac93ca2985c2.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json new file mode 100644 index 00000000000..300e476a45e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/msg_GetContestedResourceVoteStateRequest_aaaa80ce4fdfc75252132a85e6c12bea6a47c9f7bf30133713b6b5cfec3a4d57.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__a39a5f7014a616de3d7002bb4f18772c5b5d3526cb2b3c33566bd64512882669/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__aabb30e955771841251280c0e6a98257882c3b2ee0b73b4aca838fb78918256b/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__aabb30e955771841251280c0e6a98257882c3b2ee0b73b4aca838fb78918256b/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__aabb30e955771841251280c0e6a98257882c3b2ee0b73b4aca838fb78918256b/msg_GetContestedResourceVoteStateRequest_9a43882825cbf3a83a2f623d03ae412662a6acb2d928d56de7a6a67dbf70f80a.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__aabb30e955771841251280c0e6a98257882c3b2ee0b73b4aca838fb78918256b/msg_GetContestedResourceVoteStateRequest_9a43882825cbf3a83a2f623d03ae412662a6acb2d928d56de7a6a67dbf70f80a.json new file mode 100644 index 00000000000..9437bd31328 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__aabb30e955771841251280c0e6a98257882c3b2ee0b73b4aca838fb78918256b/msg_GetContestedResourceVoteStateRequest_9a43882825cbf3a83a2f623d03ae412662a6acb2d928d56de7a6a67dbf70f80a.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/msg_GetContestedResourceVoteStateRequest_23a531bedb32082b8e3bb799790dbc80a6caf537196a9513dae8967f325ab485.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/msg_GetContestedResourceVoteStateRequest_23a531bedb32082b8e3bb799790dbc80a6caf537196a9513dae8967f325ab485.json new file mode 100644 index 00000000000..81cdce36dd6 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/msg_GetContestedResourceVoteStateRequest_23a531bedb32082b8e3bb799790dbc80a6caf537196a9513dae8967f325ab485.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__c71b4f8d63f8a1357936129a226f99e349e7b21b166609cf59062e27ed68a1ee/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cf2a2febe0a535f130d2eaaaba3f002c094511cae2fd57dfaa6e5ee607cd72b6/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cf2a2febe0a535f130d2eaaaba3f002c094511cae2fd57dfaa6e5ee607cd72b6/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cf2a2febe0a535f130d2eaaaba3f002c094511cae2fd57dfaa6e5ee607cd72b6/msg_GetContestedResourceVoteStateRequest_b620c564a9caf806d2a4053efc7a8707f36bc1837a661ca9a4a3aae3ab30da7a.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cf2a2febe0a535f130d2eaaaba3f002c094511cae2fd57dfaa6e5ee607cd72b6/msg_GetContestedResourceVoteStateRequest_b620c564a9caf806d2a4053efc7a8707f36bc1837a661ca9a4a3aae3ab30da7a.json new file mode 100644 index 00000000000..f3c4ba759c0 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cf2a2febe0a535f130d2eaaaba3f002c094511cae2fd57dfaa6e5ee607cd72b6/msg_GetContestedResourceVoteStateRequest_b620c564a9caf806d2a4053efc7a8707f36bc1837a661ca9a4a3aae3ab30da7a.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/msg_GetContestedResourceVoteStateRequest_bf272e62224361f1e7cf91b7f45285016c5d0ac679c299447df687e866154090.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/msg_GetContestedResourceVoteStateRequest_bf272e62224361f1e7cf91b7f45285016c5d0ac679c299447df687e866154090.json new file mode 100644 index 00000000000..e876ff6dd34 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/msg_GetContestedResourceVoteStateRequest_bf272e62224361f1e7cf91b7f45285016c5d0ac679c299447df687e866154090.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__cfe3ebd0f17745be80e4348304fe468f3eb8c2d17e23d310582b0b34f2d5bba7/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__d7532a56162a82dafbbe07d40821db2e8768e2e6a880e7a66018fcd90fa35c71/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__d7532a56162a82dafbbe07d40821db2e8768e2e6a880e7a66018fcd90fa35c71/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__d7532a56162a82dafbbe07d40821db2e8768e2e6a880e7a66018fcd90fa35c71/msg_GetContestedResourceVoteStateRequest_3fede5825779667ef492c2ca1744ae6d7593e5a08c8e0c9971ad1afc8c3e1702.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__d7532a56162a82dafbbe07d40821db2e8768e2e6a880e7a66018fcd90fa35c71/msg_GetContestedResourceVoteStateRequest_3fede5825779667ef492c2ca1744ae6d7593e5a08c8e0c9971ad1afc8c3e1702.json new file mode 100644 index 00000000000..dd1f75831ef Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__d7532a56162a82dafbbe07d40821db2e8768e2e6a880e7a66018fcd90fa35c71/msg_GetContestedResourceVoteStateRequest_3fede5825779667ef492c2ca1744ae6d7593e5a08c8e0c9971ad1afc8c3e1702.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/.gitkeep b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/msg_GetContestedResourceVoteStateRequest_e1399ef22320c9690b1c8e548975839e9ea0c40cd94caac5746b19857d52533a.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/msg_GetContestedResourceVoteStateRequest_e1399ef22320c9690b1c8e548975839e9ea0c40cd94caac5746b19857d52533a.json new file mode 100644 index 00000000000..1877ca2ee64 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/msg_GetContestedResourceVoteStateRequest_e1399ef22320c9690b1c8e548975839e9ea0c40cd94caac5746b19857d52533a.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_rss_vote_state_fields__fbed6654145b9fba061d182cac5a3879bc9bacb92dc9ae64ed2a07ca2ec0392f/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/.gitkeep b/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/msg_DocumentQuery_921ee672cc831bd4e6cdc8efb81f1d89ec6c5359c2f84b27c76526fa608f34c2.json b/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/msg_DocumentQuery_921ee672cc831bd4e6cdc8efb81f1d89ec6c5359c2f84b27c76526fa608f34c2.json new file mode 100644 index 00000000000..6f0d71ec673 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/msg_DocumentQuery_921ee672cc831bd4e6cdc8efb81f1d89ec6c5359c2f84b27c76526fa608f34c2.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_list_bug_value_text_decode_base58/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/.gitkeep b/packages/rs-sdk/tests/vectors/document_list_document_query/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_86beaec40825e436c6a9467bd1af6d2d9dcd58c35b6aa9e85398a105dfdeb9c6.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_86beaec40825e436c6a9467bd1af6d2d9dcd58c35b6aa9e85398a105dfdeb9c6.json new file mode 100644 index 00000000000..a17354f7d71 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_86beaec40825e436c6a9467bd1af6d2d9dcd58c35b6aa9e85398a105dfdeb9c6.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/.gitkeep b/packages/rs-sdk/tests/vectors/document_list_drive_query/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_e731a9066a60d9cee4097f419bbe0f17fb3367987f71c5caf9c045ced8633299.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_e731a9066a60d9cee4097f419bbe0f17fb3367987f71c5caf9c045ced8633299.json new file mode 100644 index 00000000000..1bdafe4e9b4 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_e731a9066a60d9cee4097f419bbe0f17fb3367987f71c5caf9c045ced8633299.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read/.gitkeep b/packages/rs-sdk/tests/vectors/document_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_23b0993681588ca0c66e960ae019dd012ae92b1038a32d1cbb419087d75cc70a.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_23b0993681588ca0c66e960ae019dd012ae92b1038a32d1cbb419087d75cc70a.json new file mode 100644 index 00000000000..243ee061f60 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_23b0993681588ca0c66e960ae019dd012ae92b1038a32d1cbb419087d75cc70a.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_86beaec40825e436c6a9467bd1af6d2d9dcd58c35b6aa9e85398a105dfdeb9c6.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_86beaec40825e436c6a9467bd1af6d2d9dcd58c35b6aa9e85398a105dfdeb9c6.json new file mode 100644 index 00000000000..a17354f7d71 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_86beaec40825e436c6a9467bd1af6d2d9dcd58c35b6aa9e85398a105dfdeb9c6.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/.gitkeep b/packages/rs-sdk/tests/vectors/document_read_no_contract/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json new file mode 100644 index 00000000000..b52ddadb110 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/.gitkeep b/packages/rs-sdk/tests/vectors/document_read_no_document/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_20d68bd71dd4309389f14aed5d610bbf4178e9af8e87ee326576ac2b384d726d.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_20d68bd71dd4309389f14aed5d610bbf4178e9af8e87ee326576ac2b384d726d.json new file mode 100644 index 00000000000..1633caffc3e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_20d68bd71dd4309389f14aed5d610bbf4178e9af8e87ee326576ac2b384d726d.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.335955511Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.335955511Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json deleted file mode 100644 index 51b7e28a49f..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.335955511Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,198,2,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,1,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,127,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,2,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.335957885Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.335957885Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json deleted file mode 100644 index 51b7e28a49f..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.335957885Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,198,2,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,1,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,127,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,2,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342863939Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342863939Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json deleted file mode 100644 index ebc55119189..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342863939Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,255,30,3,1,0,15,88,0,251,83,15,0,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,0,0,0,0,1,0,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,2,6,100,111,109,97,105,110,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,3,22,3,18,4,110,97,109,101,18,18,112,97,114,101,110,116,78,97,109,101,65,110,100,76,97,98,101,108,18,10,112,114,111,112,101,114,116,105,101,115,21,2,22,1,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,3,97,115,99,22,1,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,3,18,4,110,97,109,101,18,14,100,97,115,104,73,100,101,110,116,105,116,121,73,100,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,28,114,101,99,111,114,100,115,46,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,2,18,4,110,97,109,101,18,9,100,97,115,104,65,108,105,97,115,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,10,112,114,111,112,101,114,116,105,101,115,22,7,18,5,108,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,42,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,3,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,25,68,111,109,97,105,110,32,108,97,98,101,108,46,32,101,46,103,46,32,39,66,111,98,39,46,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,60,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,1,18,11,100,101,115,99,114,105,112,116,105,111,110,18,163,68,111,109,97,105,110,32,108,97,98,101,108,32,99,111,110,118,101,114,116,101,100,32,116,111,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,98,48,98,39,18,8,36,99,111,109,109,101,110,116,18,92,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,108,97,98,101,108,32,105,110,32,108,111,119,101,114,99,97,115,101,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,18,16,112,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,45,94,36,124,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,2,18,11,100,101,115,99,114,105,112,116,105,111,110,18,39,65,32,102,117,108,108,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,46,32,101,46,103,46,32,39,100,97,115,104,39,46,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,7,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,65,94,36,124,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,92,46,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,3,18,11,100,101,115,99,114,105,112,116,105,111,110,18,162,65,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,32,105,110,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,100,97,115,104,39,18,8,36,99,111,109,109,101,110,116,18,192,77,117,115,116,32,101,105,116,104,101,114,32,98,101,32,101,113,117,97,108,32,116,111,32,97,110,32,101,120,105,115,116,105,110,103,32,100,111,109,97,105,110,32,111,114,32,101,109,112,116,121,32,116,111,32,99,114,101,97,116,101,32,97,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,32,79,110,108,121,32,116,104,101,32,100,97,116,97,32,99,111,110,116,114,97,99,116,32,111,119,110,101,114,32,99,97,110,32,99,114,101,97,116,101,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,115,46,18,12,112,114,101,111,114,100,101,114,83,97,108,116,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,4,18,11,100,101,115,99,114,105,112,116,105,111,110,18,34,83,97,108,116,32,117,115,101,100,32,105,110,32,116,104,101,32,112,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,18,7,114,101,99,111,114,100,115,22,7,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,2,18,20,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,62,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,112,114,105,109,97,114,121,32,110,97,109,101,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,19,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,1,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,61,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,97,108,105,97,115,32,110,97,109,101,115,32,102,111,114,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,13,109,105,110,80,114,111,112,101,114,116,105,101,115,2,1,18,13,109,97,120,80,114,111,112,101,114,116,105,101,115,2,1,18,8,112,111,115,105,116,105,111,110,2,5,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,144,67,111,110,115,116,114,97,105,110,116,32,119,105,116,104,32,109,97,120,32,97,110,100,32,109,105,110,32,112,114,111,112,101,114,116,105,101,115,32,101,110,115,117,114,101,32,116,104,97,116,32,111,110,108,121,32,111,110,101,32,105,100,101,110,116,105,116,121,32,114,101,99,111,114,100,32,105,115,32,117,115,101,100,32,45,32,101,105,116,104,101,114,32,97,32,96,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,96,32,111,114,32,97,32,96,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,96,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,22,4,18,4,116,121,112,101,18,7,98,111,111,108,101,97,110,18,11,100,101,115,99,114,105,112,116,105,111,110,18,91,84,104,105,115,32,111,112,116,105,111,110,32,100,101,102,105,110,101,115,32,119,104,111,32,99,97,110,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,58,32,116,114,117,101,32,45,32,97,110,121,111,110,101,59,32,102,97,108,115,101,32,45,32,111,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,18,8,36,99,111,109,109,101,110,116,18,79,79,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,32,105,115,32,97,108,108,111,119,101,100,32,116,111,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,32,102,111,114,32,110,111,110,32,116,111,112,45,108,101,118,101,108,32,100,111,109,97,105,110,115,18,8,112,111,115,105,116,105,111,110,2,0,18,8,112,111,115,105,116,105,111,110,2,6,18,11,100,101,115,99,114,105,112,116,105,111,110,18,66,83,117,98,100,111,109,97,105,110,32,114,117,108,101,115,32,97,108,108,111,119,32,100,111,109,97,105,110,32,111,119,110,101,114,115,32,116,111,32,100,101,102,105,110,101,32,114,117,108,101,115,32,102,111,114,32,115,117,98,100,111,109,97,105,110,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,114,101,113,117,105,114,101,100,21,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,18,8,114,101,113,117,105,114,101,100,21,6,18,5,108,97,98,101,108,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,12,112,114,101,111,114,100,101,114,83,97,108,116,18,7,114,101,99,111,114,100,115,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,251,1,55,73,110,32,111,114,100,101,114,32,116,111,32,114,101,103,105,115,116,101,114,32,97,32,100,111,109,97,105,110,32,121,111,117,32,110,101,101,100,32,116,111,32,99,114,101,97,116,101,32,97,32,112,114,101,111,114,100,101,114,46,32,84,104,101,32,112,114,101,111,114,100,101,114,32,115,116,101,112,32,105,115,32,110,101,101,100,101,100,32,116,111,32,112,114,101,118,101,110,116,32,109,97,110,45,105,110,45,116,104,101,45,109,105,100,100,108,101,32,97,116,116,97,99,107,115,46,32,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,32,43,32,39,46,39,32,43,32,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,32,109,117,115,116,32,110,111,116,32,98,101,32,108,111,110,103,101,114,32,116,104,97,110,32,50,53,51,32,99,104,97,114,115,32,108,101,110,103,116,104,32,97,115,32,100,101,102,105,110,101,100,32,98,121,32,82,70,67,32,49,48,51,53,46,32,68,111,109,97,105,110,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,8,112,114,101,111,114,100,101,114,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,1,22,3,18,4,110,97,109,101,18,10,115,97,108,116,101,100,72,97,115,104,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,89,68,111,117,98,108,101,32,115,104,97,45,50,53,54,32,111,102,32,116,104,101,32,99,111,110,99,97,116,101,110,97,116,105,111,110,32,111,102,32,97,32,51,50,32,98,121,116,101,32,114,97,110,100,111,109,32,115,97,108,116,32,97,110,100,32,97,32,110,111,114,109,97,108,105,122,101,100,32,100,111,109,97,105,110,32,110,97,109,101,18,8,114,101,113,117,105,114,101,100,21,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,74,80,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,0,2,213,134,128,207,201,13,236,20,124,137,134,23,200,118,113,53,4,74,177,5,88,90,191,64,210,150,118,119,120,208,33,226,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342864079Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342864079Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json deleted file mode 100644 index ebc55119189..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342864079Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,255,30,3,1,0,15,88,0,251,83,15,0,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,0,0,0,0,1,0,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,2,6,100,111,109,97,105,110,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,3,22,3,18,4,110,97,109,101,18,18,112,97,114,101,110,116,78,97,109,101,65,110,100,76,97,98,101,108,18,10,112,114,111,112,101,114,116,105,101,115,21,2,22,1,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,3,97,115,99,22,1,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,3,18,4,110,97,109,101,18,14,100,97,115,104,73,100,101,110,116,105,116,121,73,100,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,28,114,101,99,111,114,100,115,46,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,2,18,4,110,97,109,101,18,9,100,97,115,104,65,108,105,97,115,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,10,112,114,111,112,101,114,116,105,101,115,22,7,18,5,108,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,42,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,3,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,25,68,111,109,97,105,110,32,108,97,98,101,108,46,32,101,46,103,46,32,39,66,111,98,39,46,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,60,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,1,18,11,100,101,115,99,114,105,112,116,105,111,110,18,163,68,111,109,97,105,110,32,108,97,98,101,108,32,99,111,110,118,101,114,116,101,100,32,116,111,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,98,48,98,39,18,8,36,99,111,109,109,101,110,116,18,92,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,108,97,98,101,108,32,105,110,32,108,111,119,101,114,99,97,115,101,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,18,16,112,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,45,94,36,124,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,2,18,11,100,101,115,99,114,105,112,116,105,111,110,18,39,65,32,102,117,108,108,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,46,32,101,46,103,46,32,39,100,97,115,104,39,46,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,7,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,65,94,36,124,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,92,46,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,3,18,11,100,101,115,99,114,105,112,116,105,111,110,18,162,65,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,32,105,110,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,100,97,115,104,39,18,8,36,99,111,109,109,101,110,116,18,192,77,117,115,116,32,101,105,116,104,101,114,32,98,101,32,101,113,117,97,108,32,116,111,32,97,110,32,101,120,105,115,116,105,110,103,32,100,111,109,97,105,110,32,111,114,32,101,109,112,116,121,32,116,111,32,99,114,101,97,116,101,32,97,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,32,79,110,108,121,32,116,104,101,32,100,97,116,97,32,99,111,110,116,114,97,99,116,32,111,119,110,101,114,32,99,97,110,32,99,114,101,97,116,101,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,115,46,18,12,112,114,101,111,114,100,101,114,83,97,108,116,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,4,18,11,100,101,115,99,114,105,112,116,105,111,110,18,34,83,97,108,116,32,117,115,101,100,32,105,110,32,116,104,101,32,112,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,18,7,114,101,99,111,114,100,115,22,7,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,2,18,20,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,62,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,112,114,105,109,97,114,121,32,110,97,109,101,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,19,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,1,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,61,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,97,108,105,97,115,32,110,97,109,101,115,32,102,111,114,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,13,109,105,110,80,114,111,112,101,114,116,105,101,115,2,1,18,13,109,97,120,80,114,111,112,101,114,116,105,101,115,2,1,18,8,112,111,115,105,116,105,111,110,2,5,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,144,67,111,110,115,116,114,97,105,110,116,32,119,105,116,104,32,109,97,120,32,97,110,100,32,109,105,110,32,112,114,111,112,101,114,116,105,101,115,32,101,110,115,117,114,101,32,116,104,97,116,32,111,110,108,121,32,111,110,101,32,105,100,101,110,116,105,116,121,32,114,101,99,111,114,100,32,105,115,32,117,115,101,100,32,45,32,101,105,116,104,101,114,32,97,32,96,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,96,32,111,114,32,97,32,96,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,96,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,22,4,18,4,116,121,112,101,18,7,98,111,111,108,101,97,110,18,11,100,101,115,99,114,105,112,116,105,111,110,18,91,84,104,105,115,32,111,112,116,105,111,110,32,100,101,102,105,110,101,115,32,119,104,111,32,99,97,110,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,58,32,116,114,117,101,32,45,32,97,110,121,111,110,101,59,32,102,97,108,115,101,32,45,32,111,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,18,8,36,99,111,109,109,101,110,116,18,79,79,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,32,105,115,32,97,108,108,111,119,101,100,32,116,111,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,32,102,111,114,32,110,111,110,32,116,111,112,45,108,101,118,101,108,32,100,111,109,97,105,110,115,18,8,112,111,115,105,116,105,111,110,2,0,18,8,112,111,115,105,116,105,111,110,2,6,18,11,100,101,115,99,114,105,112,116,105,111,110,18,66,83,117,98,100,111,109,97,105,110,32,114,117,108,101,115,32,97,108,108,111,119,32,100,111,109,97,105,110,32,111,119,110,101,114,115,32,116,111,32,100,101,102,105,110,101,32,114,117,108,101,115,32,102,111,114,32,115,117,98,100,111,109,97,105,110,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,114,101,113,117,105,114,101,100,21,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,18,8,114,101,113,117,105,114,101,100,21,6,18,5,108,97,98,101,108,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,12,112,114,101,111,114,100,101,114,83,97,108,116,18,7,114,101,99,111,114,100,115,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,251,1,55,73,110,32,111,114,100,101,114,32,116,111,32,114,101,103,105,115,116,101,114,32,97,32,100,111,109,97,105,110,32,121,111,117,32,110,101,101,100,32,116,111,32,99,114,101,97,116,101,32,97,32,112,114,101,111,114,100,101,114,46,32,84,104,101,32,112,114,101,111,114,100,101,114,32,115,116,101,112,32,105,115,32,110,101,101,100,101,100,32,116,111,32,112,114,101,118,101,110,116,32,109,97,110,45,105,110,45,116,104,101,45,109,105,100,100,108,101,32,97,116,116,97,99,107,115,46,32,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,32,43,32,39,46,39,32,43,32,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,32,109,117,115,116,32,110,111,116,32,98,101,32,108,111,110,103,101,114,32,116,104,97,110,32,50,53,51,32,99,104,97,114,115,32,108,101,110,103,116,104,32,97,115,32,100,101,102,105,110,101,100,32,98,121,32,82,70,67,32,49,48,51,53,46,32,68,111,109,97,105,110,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,8,112,114,101,111,114,100,101,114,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,1,22,3,18,4,110,97,109,101,18,10,115,97,108,116,101,100,72,97,115,104,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,89,68,111,117,98,108,101,32,115,104,97,45,50,53,54,32,111,102,32,116,104,101,32,99,111,110,99,97,116,101,110,97,116,105,111,110,32,111,102,32,97,32,51,50,32,98,121,116,101,32,114,97,110,100,111,109,32,115,97,108,116,32,97,110,100,32,97,32,110,111,114,109,97,108,105,122,101,100,32,100,111,109,97,105,110,32,110,97,109,101,18,8,114,101,113,117,105,114,101,100,21,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,74,80,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,0,2,213,134,128,207,201,13,236,20,124,137,134,23,200,118,113,53,4,74,177,5,88,90,191,64,210,150,118,119,120,208,33,226,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342864230Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342864230Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json deleted file mode 100644 index ebc55119189..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.342864230Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,255,30,3,1,0,15,88,0,251,83,15,0,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,0,0,0,0,1,0,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,2,6,100,111,109,97,105,110,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,3,22,3,18,4,110,97,109,101,18,18,112,97,114,101,110,116,78,97,109,101,65,110,100,76,97,98,101,108,18,10,112,114,111,112,101,114,116,105,101,115,21,2,22,1,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,3,97,115,99,22,1,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,3,18,4,110,97,109,101,18,14,100,97,115,104,73,100,101,110,116,105,116,121,73,100,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,28,114,101,99,111,114,100,115,46,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,2,18,4,110,97,109,101,18,9,100,97,115,104,65,108,105,97,115,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,10,112,114,111,112,101,114,116,105,101,115,22,7,18,5,108,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,42,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,3,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,25,68,111,109,97,105,110,32,108,97,98,101,108,46,32,101,46,103,46,32,39,66,111,98,39,46,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,60,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,1,18,11,100,101,115,99,114,105,112,116,105,111,110,18,163,68,111,109,97,105,110,32,108,97,98,101,108,32,99,111,110,118,101,114,116,101,100,32,116,111,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,98,48,98,39,18,8,36,99,111,109,109,101,110,116,18,92,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,108,97,98,101,108,32,105,110,32,108,111,119,101,114,99,97,115,101,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,18,16,112,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,45,94,36,124,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,2,18,11,100,101,115,99,114,105,112,116,105,111,110,18,39,65,32,102,117,108,108,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,46,32,101,46,103,46,32,39,100,97,115,104,39,46,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,7,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,65,94,36,124,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,92,46,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,3,18,11,100,101,115,99,114,105,112,116,105,111,110,18,162,65,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,32,105,110,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,100,97,115,104,39,18,8,36,99,111,109,109,101,110,116,18,192,77,117,115,116,32,101,105,116,104,101,114,32,98,101,32,101,113,117,97,108,32,116,111,32,97,110,32,101,120,105,115,116,105,110,103,32,100,111,109,97,105,110,32,111,114,32,101,109,112,116,121,32,116,111,32,99,114,101,97,116,101,32,97,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,32,79,110,108,121,32,116,104,101,32,100,97,116,97,32,99,111,110,116,114,97,99,116,32,111,119,110,101,114,32,99,97,110,32,99,114,101,97,116,101,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,115,46,18,12,112,114,101,111,114,100,101,114,83,97,108,116,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,4,18,11,100,101,115,99,114,105,112,116,105,111,110,18,34,83,97,108,116,32,117,115,101,100,32,105,110,32,116,104,101,32,112,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,18,7,114,101,99,111,114,100,115,22,7,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,2,18,20,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,62,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,112,114,105,109,97,114,121,32,110,97,109,101,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,19,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,1,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,61,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,97,108,105,97,115,32,110,97,109,101,115,32,102,111,114,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,13,109,105,110,80,114,111,112,101,114,116,105,101,115,2,1,18,13,109,97,120,80,114,111,112,101,114,116,105,101,115,2,1,18,8,112,111,115,105,116,105,111,110,2,5,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,144,67,111,110,115,116,114,97,105,110,116,32,119,105,116,104,32,109,97,120,32,97,110,100,32,109,105,110,32,112,114,111,112,101,114,116,105,101,115,32,101,110,115,117,114,101,32,116,104,97,116,32,111,110,108,121,32,111,110,101,32,105,100,101,110,116,105,116,121,32,114,101,99,111,114,100,32,105,115,32,117,115,101,100,32,45,32,101,105,116,104,101,114,32,97,32,96,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,96,32,111,114,32,97,32,96,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,96,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,22,4,18,4,116,121,112,101,18,7,98,111,111,108,101,97,110,18,11,100,101,115,99,114,105,112,116,105,111,110,18,91,84,104,105,115,32,111,112,116,105,111,110,32,100,101,102,105,110,101,115,32,119,104,111,32,99,97,110,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,58,32,116,114,117,101,32,45,32,97,110,121,111,110,101,59,32,102,97,108,115,101,32,45,32,111,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,18,8,36,99,111,109,109,101,110,116,18,79,79,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,32,105,115,32,97,108,108,111,119,101,100,32,116,111,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,32,102,111,114,32,110,111,110,32,116,111,112,45,108,101,118,101,108,32,100,111,109,97,105,110,115,18,8,112,111,115,105,116,105,111,110,2,0,18,8,112,111,115,105,116,105,111,110,2,6,18,11,100,101,115,99,114,105,112,116,105,111,110,18,66,83,117,98,100,111,109,97,105,110,32,114,117,108,101,115,32,97,108,108,111,119,32,100,111,109,97,105,110,32,111,119,110,101,114,115,32,116,111,32,100,101,102,105,110,101,32,114,117,108,101,115,32,102,111,114,32,115,117,98,100,111,109,97,105,110,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,114,101,113,117,105,114,101,100,21,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,18,8,114,101,113,117,105,114,101,100,21,6,18,5,108,97,98,101,108,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,12,112,114,101,111,114,100,101,114,83,97,108,116,18,7,114,101,99,111,114,100,115,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,251,1,55,73,110,32,111,114,100,101,114,32,116,111,32,114,101,103,105,115,116,101,114,32,97,32,100,111,109,97,105,110,32,121,111,117,32,110,101,101,100,32,116,111,32,99,114,101,97,116,101,32,97,32,112,114,101,111,114,100,101,114,46,32,84,104,101,32,112,114,101,111,114,100,101,114,32,115,116,101,112,32,105,115,32,110,101,101,100,101,100,32,116,111,32,112,114,101,118,101,110,116,32,109,97,110,45,105,110,45,116,104,101,45,109,105,100,100,108,101,32,97,116,116,97,99,107,115,46,32,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,32,43,32,39,46,39,32,43,32,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,32,109,117,115,116,32,110,111,116,32,98,101,32,108,111,110,103,101,114,32,116,104,97,110,32,50,53,51,32,99,104,97,114,115,32,108,101,110,103,116,104,32,97,115,32,100,101,102,105,110,101,100,32,98,121,32,82,70,67,32,49,48,51,53,46,32,68,111,109,97,105,110,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,8,112,114,101,111,114,100,101,114,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,1,22,3,18,4,110,97,109,101,18,10,115,97,108,116,101,100,72,97,115,104,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,89,68,111,117,98,108,101,32,115,104,97,45,50,53,54,32,111,102,32,116,104,101,32,99,111,110,99,97,116,101,110,97,116,105,111,110,32,111,102,32,97,32,51,50,32,98,121,116,101,32,114,97,110,100,111,109,32,115,97,108,116,32,97,110,100,32,97,32,110,111,114,109,97,108,105,122,101,100,32,100,111,109,97,105,110,32,110,97,109,101,18,8,114,101,113,117,105,114,101,100,21,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,74,80,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,0,2,213,134,128,207,201,13,236,20,124,137,134,23,200,118,113,53,4,74,177,5,88,90,191,64,210,150,118,119,120,208,33,226,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.350064490Z_GetDataContractsRequest_be241f4243faa3a04a20a229a214fc6a27f8e61d6997cf0067a946a712a05e89.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.350064490Z_GetDataContractsRequest_be241f4243faa3a04a20a229a214fc6a27f8e61d6997cf0067a946a712a05e89.json deleted file mode 100644 index ac27d8a01c4..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.350064490Z_GetDataContractsRequest_be241f4243faa3a04a20a229a214fc6a27f8e61d6997cf0067a946a712a05e89.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"ids":["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=","AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE="],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,6,1,1,64,2,1,64,168,1,5,32,12,172,226,5,36,102,147,167,200,21,101,35,98,13,170,147,125,47,34,71,147,68,99,238,176,31,247,33,149,144,149,140,75,34,153,206,135,122,242,216,192,153,213,145,252,19,92,243,151,66,21,82,155,134,59,37,64,187,226,193,3,142,106,137,2,55,87,32,239,83,222,50,100,135,105,253,22,175,40,144,194,215,36,1,135,76,125,3,161,55,118,11,1,246,1,1,185,16,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,1,159,126,94,199,175,65,241,198,165,109,36,136,66,35,181,18,41,141,231,216,15,39,242,103,13,216,198,219,227,247,109,250,17,1,0,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.354440227Z_GetDataContractRequest_ce01e85155ee6482c89778e5214884fc36686387fa18831256ae2ada60474de4.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.354440227Z_GetDataContractRequest_ce01e85155ee6482c89778e5214884fc36686387fa18831256ae2ada60474de4.json deleted file mode 100644 index 4addf065444..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.354440227Z_GetDataContractRequest_ce01e85155ee6482c89778e5214884fc36686387fa18831256ae2ada60474de4.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,5,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17,1,168,1,5,32,12,172,226,5,36,102,147,167,200,21,101,35,98,13,170,147,125,47,34,71,147,68,99,238,176,31,247,33,149,144,149,140,75,34,153,206,135,122,242,216,192,153,213,145,252,19,92,243,151,66,21,82,155,134,59,37,64,187,226,193,3,142,106,137,2,55,87,32,239,83,222,50,100,135,105,253,22,175,40,144,194,215,36,1,135,76,125,3,161,55,118,11,1,246,1,1,185,16,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,1,159,126,94,199,175,65,241,198,165,109,36,136,66,35,181,18,41,141,231,216,15,39,242,103,13,216,198,219,227,247,109,250,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.354440387Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.354440387Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json deleted file mode 100644 index ebc55119189..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.354440387Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,255,30,3,1,0,15,88,0,251,83,15,0,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,0,0,0,0,1,0,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,2,6,100,111,109,97,105,110,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,3,22,3,18,4,110,97,109,101,18,18,112,97,114,101,110,116,78,97,109,101,65,110,100,76,97,98,101,108,18,10,112,114,111,112,101,114,116,105,101,115,21,2,22,1,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,3,97,115,99,22,1,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,3,18,4,110,97,109,101,18,14,100,97,115,104,73,100,101,110,116,105,116,121,73,100,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,28,114,101,99,111,114,100,115,46,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,2,18,4,110,97,109,101,18,9,100,97,115,104,65,108,105,97,115,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,10,112,114,111,112,101,114,116,105,101,115,22,7,18,5,108,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,42,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,3,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,25,68,111,109,97,105,110,32,108,97,98,101,108,46,32,101,46,103,46,32,39,66,111,98,39,46,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,60,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,1,18,11,100,101,115,99,114,105,112,116,105,111,110,18,163,68,111,109,97,105,110,32,108,97,98,101,108,32,99,111,110,118,101,114,116,101,100,32,116,111,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,98,48,98,39,18,8,36,99,111,109,109,101,110,116,18,92,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,108,97,98,101,108,32,105,110,32,108,111,119,101,114,99,97,115,101,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,18,16,112,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,45,94,36,124,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,2,18,11,100,101,115,99,114,105,112,116,105,111,110,18,39,65,32,102,117,108,108,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,46,32,101,46,103,46,32,39,100,97,115,104,39,46,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,7,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,65,94,36,124,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,92,46,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,3,18,11,100,101,115,99,114,105,112,116,105,111,110,18,162,65,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,32,105,110,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,100,97,115,104,39,18,8,36,99,111,109,109,101,110,116,18,192,77,117,115,116,32,101,105,116,104,101,114,32,98,101,32,101,113,117,97,108,32,116,111,32,97,110,32,101,120,105,115,116,105,110,103,32,100,111,109,97,105,110,32,111,114,32,101,109,112,116,121,32,116,111,32,99,114,101,97,116,101,32,97,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,32,79,110,108,121,32,116,104,101,32,100,97,116,97,32,99,111,110,116,114,97,99,116,32,111,119,110,101,114,32,99,97,110,32,99,114,101,97,116,101,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,115,46,18,12,112,114,101,111,114,100,101,114,83,97,108,116,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,4,18,11,100,101,115,99,114,105,112,116,105,111,110,18,34,83,97,108,116,32,117,115,101,100,32,105,110,32,116,104,101,32,112,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,18,7,114,101,99,111,114,100,115,22,7,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,2,18,20,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,62,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,112,114,105,109,97,114,121,32,110,97,109,101,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,19,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,1,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,61,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,97,108,105,97,115,32,110,97,109,101,115,32,102,111,114,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,13,109,105,110,80,114,111,112,101,114,116,105,101,115,2,1,18,13,109,97,120,80,114,111,112,101,114,116,105,101,115,2,1,18,8,112,111,115,105,116,105,111,110,2,5,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,144,67,111,110,115,116,114,97,105,110,116,32,119,105,116,104,32,109,97,120,32,97,110,100,32,109,105,110,32,112,114,111,112,101,114,116,105,101,115,32,101,110,115,117,114,101,32,116,104,97,116,32,111,110,108,121,32,111,110,101,32,105,100,101,110,116,105,116,121,32,114,101,99,111,114,100,32,105,115,32,117,115,101,100,32,45,32,101,105,116,104,101,114,32,97,32,96,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,96,32,111,114,32,97,32,96,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,96,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,22,4,18,4,116,121,112,101,18,7,98,111,111,108,101,97,110,18,11,100,101,115,99,114,105,112,116,105,111,110,18,91,84,104,105,115,32,111,112,116,105,111,110,32,100,101,102,105,110,101,115,32,119,104,111,32,99,97,110,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,58,32,116,114,117,101,32,45,32,97,110,121,111,110,101,59,32,102,97,108,115,101,32,45,32,111,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,18,8,36,99,111,109,109,101,110,116,18,79,79,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,32,105,115,32,97,108,108,111,119,101,100,32,116,111,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,32,102,111,114,32,110,111,110,32,116,111,112,45,108,101,118,101,108,32,100,111,109,97,105,110,115,18,8,112,111,115,105,116,105,111,110,2,0,18,8,112,111,115,105,116,105,111,110,2,6,18,11,100,101,115,99,114,105,112,116,105,111,110,18,66,83,117,98,100,111,109,97,105,110,32,114,117,108,101,115,32,97,108,108,111,119,32,100,111,109,97,105,110,32,111,119,110,101,114,115,32,116,111,32,100,101,102,105,110,101,32,114,117,108,101,115,32,102,111,114,32,115,117,98,100,111,109,97,105,110,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,114,101,113,117,105,114,101,100,21,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,18,8,114,101,113,117,105,114,101,100,21,6,18,5,108,97,98,101,108,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,12,112,114,101,111,114,100,101,114,83,97,108,116,18,7,114,101,99,111,114,100,115,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,251,1,55,73,110,32,111,114,100,101,114,32,116,111,32,114,101,103,105,115,116,101,114,32,97,32,100,111,109,97,105,110,32,121,111,117,32,110,101,101,100,32,116,111,32,99,114,101,97,116,101,32,97,32,112,114,101,111,114,100,101,114,46,32,84,104,101,32,112,114,101,111,114,100,101,114,32,115,116,101,112,32,105,115,32,110,101,101,100,101,100,32,116,111,32,112,114,101,118,101,110,116,32,109,97,110,45,105,110,45,116,104,101,45,109,105,100,100,108,101,32,97,116,116,97,99,107,115,46,32,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,32,43,32,39,46,39,32,43,32,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,32,109,117,115,116,32,110,111,116,32,98,101,32,108,111,110,103,101,114,32,116,104,97,110,32,50,53,51,32,99,104,97,114,115,32,108,101,110,103,116,104,32,97,115,32,100,101,102,105,110,101,100,32,98,121,32,82,70,67,32,49,48,51,53,46,32,68,111,109,97,105,110,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,8,112,114,101,111,114,100,101,114,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,1,22,3,18,4,110,97,109,101,18,10,115,97,108,116,101,100,72,97,115,104,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,89,68,111,117,98,108,101,32,115,104,97,45,50,53,54,32,111,102,32,116,104,101,32,99,111,110,99,97,116,101,110,97,116,105,111,110,32,111,102,32,97,32,51,50,32,98,121,116,101,32,114,97,110,100,111,109,32,115,97,108,116,32,97,110,100,32,97,32,110,111,114,109,97,108,105,122,101,100,32,100,111,109,97,105,110,32,110,97,109,101,18,8,114,101,113,117,105,114,101,100,21,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,74,80,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,0,2,213,134,128,207,201,13,236,20,124,137,134,23,200,118,113,53,4,74,177,5,88,90,191,64,210,150,118,119,120,208,33,226,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.356639993Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.356639993Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json deleted file mode 100644 index ebc55119189..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.356639993Z_GetDataContractRequest_36b3cb705d54b996dccf0f8332c37850589acb5ba186d9aca3b1cf78af19ed50.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,255,30,3,1,0,15,88,0,251,83,15,0,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,0,0,0,0,1,0,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,2,6,100,111,109,97,105,110,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,3,22,3,18,4,110,97,109,101,18,18,112,97,114,101,110,116,78,97,109,101,65,110,100,76,97,98,101,108,18,10,112,114,111,112,101,114,116,105,101,115,21,2,22,1,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,3,97,115,99,22,1,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,3,18,4,110,97,109,101,18,14,100,97,115,104,73,100,101,110,116,105,116,121,73,100,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,28,114,101,99,111,114,100,115,46,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,2,18,4,110,97,109,101,18,9,100,97,115,104,65,108,105,97,115,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,10,112,114,111,112,101,114,116,105,101,115,22,7,18,5,108,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,42,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,3,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,25,68,111,109,97,105,110,32,108,97,98,101,108,46,32,101,46,103,46,32,39,66,111,98,39,46,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,60,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,1,18,11,100,101,115,99,114,105,112,116,105,111,110,18,163,68,111,109,97,105,110,32,108,97,98,101,108,32,99,111,110,118,101,114,116,101,100,32,116,111,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,98,48,98,39,18,8,36,99,111,109,109,101,110,116,18,92,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,108,97,98,101,108,32,105,110,32,108,111,119,101,114,99,97,115,101,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,18,16,112,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,45,94,36,124,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,2,18,11,100,101,115,99,114,105,112,116,105,111,110,18,39,65,32,102,117,108,108,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,46,32,101,46,103,46,32,39,100,97,115,104,39,46,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,7,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,65,94,36,124,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,92,46,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,3,18,11,100,101,115,99,114,105,112,116,105,111,110,18,162,65,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,32,105,110,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,100,97,115,104,39,18,8,36,99,111,109,109,101,110,116,18,192,77,117,115,116,32,101,105,116,104,101,114,32,98,101,32,101,113,117,97,108,32,116,111,32,97,110,32,101,120,105,115,116,105,110,103,32,100,111,109,97,105,110,32,111,114,32,101,109,112,116,121,32,116,111,32,99,114,101,97,116,101,32,97,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,32,79,110,108,121,32,116,104,101,32,100,97,116,97,32,99,111,110,116,114,97,99,116,32,111,119,110,101,114,32,99,97,110,32,99,114,101,97,116,101,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,115,46,18,12,112,114,101,111,114,100,101,114,83,97,108,116,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,4,18,11,100,101,115,99,114,105,112,116,105,111,110,18,34,83,97,108,116,32,117,115,101,100,32,105,110,32,116,104,101,32,112,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,18,7,114,101,99,111,114,100,115,22,7,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,2,18,20,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,62,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,112,114,105,109,97,114,121,32,110,97,109,101,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,19,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,1,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,61,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,97,108,105,97,115,32,110,97,109,101,115,32,102,111,114,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,13,109,105,110,80,114,111,112,101,114,116,105,101,115,2,1,18,13,109,97,120,80,114,111,112,101,114,116,105,101,115,2,1,18,8,112,111,115,105,116,105,111,110,2,5,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,144,67,111,110,115,116,114,97,105,110,116,32,119,105,116,104,32,109,97,120,32,97,110,100,32,109,105,110,32,112,114,111,112,101,114,116,105,101,115,32,101,110,115,117,114,101,32,116,104,97,116,32,111,110,108,121,32,111,110,101,32,105,100,101,110,116,105,116,121,32,114,101,99,111,114,100,32,105,115,32,117,115,101,100,32,45,32,101,105,116,104,101,114,32,97,32,96,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,96,32,111,114,32,97,32,96,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,96,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,22,4,18,4,116,121,112,101,18,7,98,111,111,108,101,97,110,18,11,100,101,115,99,114,105,112,116,105,111,110,18,91,84,104,105,115,32,111,112,116,105,111,110,32,100,101,102,105,110,101,115,32,119,104,111,32,99,97,110,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,58,32,116,114,117,101,32,45,32,97,110,121,111,110,101,59,32,102,97,108,115,101,32,45,32,111,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,18,8,36,99,111,109,109,101,110,116,18,79,79,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,32,105,115,32,97,108,108,111,119,101,100,32,116,111,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,32,102,111,114,32,110,111,110,32,116,111,112,45,108,101,118,101,108,32,100,111,109,97,105,110,115,18,8,112,111,115,105,116,105,111,110,2,0,18,8,112,111,115,105,116,105,111,110,2,6,18,11,100,101,115,99,114,105,112,116,105,111,110,18,66,83,117,98,100,111,109,97,105,110,32,114,117,108,101,115,32,97,108,108,111,119,32,100,111,109,97,105,110,32,111,119,110,101,114,115,32,116,111,32,100,101,102,105,110,101,32,114,117,108,101,115,32,102,111,114,32,115,117,98,100,111,109,97,105,110,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,114,101,113,117,105,114,101,100,21,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,18,8,114,101,113,117,105,114,101,100,21,6,18,5,108,97,98,101,108,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,12,112,114,101,111,114,100,101,114,83,97,108,116,18,7,114,101,99,111,114,100,115,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,251,1,55,73,110,32,111,114,100,101,114,32,116,111,32,114,101,103,105,115,116,101,114,32,97,32,100,111,109,97,105,110,32,121,111,117,32,110,101,101,100,32,116,111,32,99,114,101,97,116,101,32,97,32,112,114,101,111,114,100,101,114,46,32,84,104,101,32,112,114,101,111,114,100,101,114,32,115,116,101,112,32,105,115,32,110,101,101,100,101,100,32,116,111,32,112,114,101,118,101,110,116,32,109,97,110,45,105,110,45,116,104,101,45,109,105,100,100,108,101,32,97,116,116,97,99,107,115,46,32,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,32,43,32,39,46,39,32,43,32,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,32,109,117,115,116,32,110,111,116,32,98,101,32,108,111,110,103,101,114,32,116,104,97,110,32,50,53,51,32,99,104,97,114,115,32,108,101,110,103,116,104,32,97,115,32,100,101,102,105,110,101,100,32,98,121,32,82,70,67,32,49,48,51,53,46,32,68,111,109,97,105,110,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,8,112,114,101,111,114,100,101,114,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,1,22,3,18,4,110,97,109,101,18,10,115,97,108,116,101,100,72,97,115,104,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,89,68,111,117,98,108,101,32,115,104,97,45,50,53,54,32,111,102,32,116,104,101,32,99,111,110,99,97,116,101,110,97,116,105,111,110,32,111,102,32,97,32,51,50,32,98,121,116,101,32,114,97,110,100,111,109,32,115,97,108,116,32,97,110,100,32,97,32,110,111,114,109,97,108,105,122,101,100,32,100,111,109,97,105,110,32,110,97,109,101,18,8,114,101,113,117,105,114,101,100,21,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,74,80,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,0,2,213,134,128,207,201,13,236,20,124,137,134,23,200,118,113,53,4,74,177,5,88,90,191,64,210,150,118,119,120,208,33,226,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.356676471Z_GetDataContractRequest_7536c32e37cebf6071e74b591067a351b90718e7a553fd96ad24988f7942a351.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.356676471Z_GetDataContractRequest_7536c32e37cebf6071e74b591067a351b90718e7a553fd96ad24988f7942a351.json deleted file mode 100644 index 0098c28c25c..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.356676471Z_GetDataContractRequest_7536c32e37cebf6071e74b591067a351b90718e7a553fd96ad24988f7942a351.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,5,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17,1,168,1,5,32,12,172,226,5,36,102,147,167,200,21,101,35,98,13,170,147,125,47,34,71,147,68,99,238,176,31,247,33,149,144,149,140,75,34,153,206,135,122,242,216,192,153,213,145,252,19,92,243,151,66,21,82,155,134,59,37,64,187,226,193,3,142,106,137,2,55,87,32,239,83,222,50,100,135,105,253,22,175,40,144,194,215,36,1,135,76,125,3,161,55,118,11,1,246,1,1,185,16,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,1,159,126,94,199,175,65,241,198,165,109,36,136,66,35,181,18,41,141,231,216,15,39,242,103,13,216,198,219,227,247,109,250,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.357095280Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.357095280Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json deleted file mode 100644 index 51b7e28a49f..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.357095280Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,198,2,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,1,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,127,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,2,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.357095531Z_GetDataContractsRequest_bd87a638d172101113991a534d56150693595e65a199f53e401cb7cd3ac82256.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.357095531Z_GetDataContractsRequest_bd87a638d172101113991a534d56150693595e65a199f53e401cb7cd3ac82256.json deleted file mode 100644 index 1d042bed476..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.357095531Z_GetDataContractsRequest_bd87a638d172101113991a534d56150693595e65a199f53e401cb7cd3ac82256.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"ids":["5mjGWa9mruHnLBht3ntbfgodcSoJxA1XIfYiv1PFMVU=","AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE="],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,6,1,1,64,1,1,64,208,1,5,32,12,172,226,5,36,102,147,167,200,21,101,35,98,13,170,147,125,47,34,71,147,68,99,238,176,31,247,33,149,144,149,140,75,34,153,206,135,122,242,216,192,153,213,145,252,19,92,243,151,66,21,82,155,134,59,37,64,187,226,193,3,142,106,137,2,55,87,32,239,83,222,50,100,135,105,253,22,175,40,144,194,215,36,1,135,76,125,3,161,55,118,11,1,246,1,1,185,16,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,2,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,255,30,3,1,0,15,88,0,251,83,15,0,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,0,0,0,0,1,0,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,2,6,100,111,109,97,105,110,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,3,22,3,18,4,110,97,109,101,18,18,112,97,114,101,110,116,78,97,109,101,65,110,100,76,97,98,101,108,18,10,112,114,111,112,101,114,116,105,101,115,21,2,22,1,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,3,97,115,99,22,1,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,3,18,4,110,97,109,101,18,14,100,97,115,104,73,100,101,110,116,105,116,121,73,100,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,28,114,101,99,111,114,100,115,46,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,22,2,18,4,110,97,109,101,18,9,100,97,115,104,65,108,105,97,115,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,18,3,97,115,99,18,10,112,114,111,112,101,114,116,105,101,115,22,7,18,5,108,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,42,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,3,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,25,68,111,109,97,105,110,32,108,97,98,101,108,46,32,101,46,103,46,32,39,66,111,98,39,46,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,60,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,1,18,11,100,101,115,99,114,105,112,116,105,111,110,18,163,68,111,109,97,105,110,32,108,97,98,101,108,32,99,111,110,118,101,114,116,101,100,32,116,111,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,98,48,98,39,18,8,36,99,111,109,109,101,110,116,18,92,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,108,97,98,101,108,32,105,110,32,108,111,119,101,114,99,97,115,101,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,18,16,112,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,6,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,45,94,36,124,94,91,97,45,122,65,45,90,48,45,57,93,91,97,45,122,65,45,90,48,45,57,45,93,123,48,44,54,49,125,91,97,45,122,65,45,90,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,2,18,11,100,101,115,99,114,105,112,116,105,111,110,18,39,65,32,102,117,108,108,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,46,32,101,46,103,46,32,39,100,97,115,104,39,46,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,22,7,18,4,116,121,112,101,18,6,115,116,114,105,110,103,18,7,112,97,116,116,101,114,110,18,65,94,36,124,94,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,45,92,46,93,123,48,44,54,49,125,91,97,45,104,106,45,107,109,45,110,112,45,122,48,45,57,93,36,18,9,109,105,110,76,101,110,103,116,104,2,0,18,9,109,97,120,76,101,110,103,116,104,2,63,18,8,112,111,115,105,116,105,111,110,2,3,18,11,100,101,115,99,114,105,112,116,105,111,110,18,162,65,32,112,97,114,101,110,116,32,100,111,109,97,105,110,32,110,97,109,101,32,105,110,32,108,111,119,101,114,99,97,115,101,32,102,111,114,32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,32,117,110,105,113,117,101,110,101,115,115,32,118,97,108,105,100,97,116,105,111,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,32,116,111,32,109,105,116,105,103,97,116,101,32,104,111,109,111,103,114,97,112,104,32,97,116,116,97,99,107,46,32,101,46,103,46,32,39,100,97,115,104,39,18,8,36,99,111,109,109,101,110,116,18,192,77,117,115,116,32,101,105,116,104,101,114,32,98,101,32,101,113,117,97,108,32,116,111,32,97,110,32,101,120,105,115,116,105,110,103,32,100,111,109,97,105,110,32,111,114,32,101,109,112,116,121,32,116,111,32,99,114,101,97,116,101,32,97,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,46,32,34,111,34,44,32,34,105,34,32,97,110,100,32,34,108,34,32,109,117,115,116,32,98,101,32,114,101,112,108,97,99,101,100,32,119,105,116,104,32,34,48,34,32,97,110,100,32,34,49,34,46,32,79,110,108,121,32,116,104,101,32,100,97,116,97,32,99,111,110,116,114,97,99,116,32,111,119,110,101,114,32,99,97,110,32,99,114,101,97,116,101,32,116,111,112,32,108,101,118,101,108,32,100,111,109,97,105,110,115,46,18,12,112,114,101,111,114,100,101,114,83,97,108,116,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,4,18,11,100,101,115,99,114,105,112,116,105,111,110,18,34,83,97,108,116,32,117,115,101,100,32,105,110,32,116,104,101,32,112,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,18,7,114,101,99,111,114,100,115,22,7,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,2,18,20,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,62,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,112,114,105,109,97,114,121,32,110,97,109,101,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,19,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,22,8,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,1,18,16,99,111,110,116,101,110,116,77,101,100,105,97,84,121,112,101,18,33,97,112,112,108,105,99,97,116,105,111,110,47,120,46,100,97,115,104,46,100,112,112,46,105,100,101,110,116,105,102,105,101,114,18,11,100,101,115,99,114,105,112,116,105,111,110,18,61,73,100,101,110,116,105,116,121,32,73,68,32,116,111,32,98,101,32,117,115,101,100,32,116,111,32,99,114,101,97,116,101,32,97,108,105,97,115,32,110,97,109,101,115,32,102,111,114,32,116,104,101,32,73,100,101,110,116,105,116,121,18,8,36,99,111,109,109,101,110,116,18,35,77,117,115,116,32,98,101,32,101,113,117,97,108,32,116,111,32,116,104,101,32,100,111,99,117,109,101,110,116,32,111,119,110,101,114,18,13,109,105,110,80,114,111,112,101,114,116,105,101,115,2,1,18,13,109,97,120,80,114,111,112,101,114,116,105,101,115,2,1,18,8,112,111,115,105,116,105,111,110,2,5,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,144,67,111,110,115,116,114,97,105,110,116,32,119,105,116,104,32,109,97,120,32,97,110,100,32,109,105,110,32,112,114,111,112,101,114,116,105,101,115,32,101,110,115,117,114,101,32,116,104,97,116,32,111,110,108,121,32,111,110,101,32,105,100,101,110,116,105,116,121,32,114,101,99,111,114,100,32,105,115,32,117,115,101,100,32,45,32,101,105,116,104,101,114,32,97,32,96,100,97,115,104,85,110,105,113,117,101,73,100,101,110,116,105,116,121,73,100,96,32,111,114,32,97,32,96,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,96,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,22,4,18,4,116,121,112,101,18,7,98,111,111,108,101,97,110,18,11,100,101,115,99,114,105,112,116,105,111,110,18,91,84,104,105,115,32,111,112,116,105,111,110,32,100,101,102,105,110,101,115,32,119,104,111,32,99,97,110,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,58,32,116,114,117,101,32,45,32,97,110,121,111,110,101,59,32,102,97,108,115,101,32,45,32,111,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,18,8,36,99,111,109,109,101,110,116,18,79,79,110,108,121,32,116,104,101,32,100,111,109,97,105,110,32,111,119,110,101,114,32,105,115,32,97,108,108,111,119,101,100,32,116,111,32,99,114,101,97,116,101,32,115,117,98,100,111,109,97,105,110,115,32,102,111,114,32,110,111,110,32,116,111,112,45,108,101,118,101,108,32,100,111,109,97,105,110,115,18,8,112,111,115,105,116,105,111,110,2,0,18,8,112,111,115,105,116,105,111,110,2,6,18,11,100,101,115,99,114,105,112,116,105,111,110,18,66,83,117,98,100,111,109,97,105,110,32,114,117,108,101,115,32,97,108,108,111,119,32,100,111,109,97,105,110,32,111,119,110,101,114,115,32,116,111,32,100,101,102,105,110,101,32,114,117,108,101,115,32,102,111,114,32,115,117,98,100,111,109,97,105,110,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,114,101,113,117,105,114,101,100,21,1,18,15,97,108,108,111,119,83,117,98,100,111,109,97,105,110,115,18,8,114,101,113,117,105,114,101,100,21,6,18,5,108,97,98,101,108,18,15,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,18,26,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,78,97,109,101,18,12,112,114,101,111,114,100,101,114,83,97,108,116,18,7,114,101,99,111,114,100,115,18,14,115,117,98,100,111,109,97,105,110,82,117,108,101,115,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,251,1,55,73,110,32,111,114,100,101,114,32,116,111,32,114,101,103,105,115,116,101,114,32,97,32,100,111,109,97,105,110,32,121,111,117,32,110,101,101,100,32,116,111,32,99,114,101,97,116,101,32,97,32,112,114,101,111,114,100,101,114,46,32,84,104,101,32,112,114,101,111,114,100,101,114,32,115,116,101,112,32,105,115,32,110,101,101,100,101,100,32,116,111,32,112,114,101,118,101,110,116,32,109,97,110,45,105,110,45,116,104,101,45,109,105,100,100,108,101,32,97,116,116,97,99,107,115,46,32,110,111,114,109,97,108,105,122,101,100,76,97,98,101,108,32,43,32,39,46,39,32,43,32,110,111,114,109,97,108,105,122,101,100,80,97,114,101,110,116,68,111,109,97,105,110,32,109,117,115,116,32,110,111,116,32,98,101,32,108,111,110,103,101,114,32,116,104,97,110,32,50,53,51,32,99,104,97,114,115,32,108,101,110,103,116,104,32,97,115,32,100,101,102,105,110,101,100,32,98,121,32,82,70,67,32,49,48,51,53,46,32,68,111,109,97,105,110,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,8,112,114,101,111,114,100,101,114,22,6,18,4,116,121,112,101,18,6,111,98,106,101,99,116,18,7,105,110,100,105,99,101,115,21,1,22,3,18,4,110,97,109,101,18,10,115,97,108,116,101,100,72,97,115,104,18,10,112,114,111,112,101,114,116,105,101,115,21,1,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,3,97,115,99,18,6,117,110,105,113,117,101,19,1,18,10,112,114,111,112,101,114,116,105,101,115,22,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,22,6,18,4,116,121,112,101,18,5,97,114,114,97,121,18,9,98,121,116,101,65,114,114,97,121,19,1,18,8,109,105,110,73,116,101,109,115,2,32,18,8,109,97,120,73,116,101,109,115,2,32,18,8,112,111,115,105,116,105,111,110,2,0,18,11,100,101,115,99,114,105,112,116,105,111,110,18,89,68,111,117,98,108,101,32,115,104,97,45,50,53,54,32,111,102,32,116,104,101,32,99,111,110,99,97,116,101,110,97,116,105,111,110,32,111,102,32,97,32,51,50,32,98,121,116,101,32,114,97,110,100,111,109,32,115,97,108,116,32,97,110,100,32,97,32,110,111,114,109,97,108,105,122,101,100,32,100,111,109,97,105,110,32,110,97,109,101,18,8,114,101,113,117,105,114,101,100,21,1,18,16,115,97,108,116,101,100,68,111,109,97,105,110,72,97,115,104,18,20,97,100,100,105,116,105,111,110,97,108,80,114,111,112,101,114,116,105,101,115,19,0,18,8,36,99,111,109,109,101,110,116,18,74,80,114,101,111,114,100,101,114,32,100,111,99,117,109,101,110,116,115,32,97,114,101,32,105,109,109,117,116,97,98,108,101,58,32,109,111,100,105,102,105,99,97,116,105,111,110,32,97,110,100,32,100,101,108,101,116,105,111,110,32,97,114,101,32,114,101,115,116,114,105,99,116,101,100,0,2,213,134,128,207,201,13,236,20,124,137,134,23,200,118,113,53,4,74,177,5,88,90,191,64,210,150,118,119,120,208,33,226,16,1,0,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.751819754Z_GetEpochsInfoRequest_ef9bdb4da13c406de86be6d66c61454c0d455b5b1be6365d7e3c2bca36dbc42c.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.751819754Z_GetEpochsInfoRequest_ef9bdb4da13c406de86be6d66c61454c0d455b5b1be6365d7e3c2bca36dbc42c.json deleted file mode 100644 index f3f0a4d583f..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:29.751819754Z_GetEpochsInfoRequest_ef9bdb4da13c406de86be6d66c61454c0d455b5b1be6365d7e3c2bca36dbc42c.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_epoch":20,"count":100,"ascending":true,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,248,192,5,1,83,130,202,92,2,193,2,25,2,95,255,51,170,79,44,231,110,158,154,75,226,88,157,4,91,99,78,173,130,128,127,142,2,100,123,12,124,246,245,215,211,9,20,208,5,145,179,6,159,212,55,244,219,114,242,103,240,89,252,195,139,154,208,238,240,16,1,184,99,127,70,228,172,164,251,193,148,25,170,66,21,245,118,251,35,61,92,137,237,163,55,22,211,186,37,201,2,68,150,2,132,161,36,229,153,63,245,118,100,187,61,173,192,187,115,80,140,111,141,89,82,195,141,33,8,211,221,231,235,163,211,33,16,4,2,1,20,0,6,4,1,1,115,0,0,161,19,100,111,42,217,230,29,186,16,48,187,133,94,222,139,100,139,238,137,67,92,70,49,194,217,20,30,8,219,158,237,4,2,1,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,1,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,1,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,1,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,2,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,2,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,3,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,3,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,3,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,4,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,17,4,2,4,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,5,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,5,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,5,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,6,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,6,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,7,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,7,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,7,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,8,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,8,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,208,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,209,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,17,4,2,8,210,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,211,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,212,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,213,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,214,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,215,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,216,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,217,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,218,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,219,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,220,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,221,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,2,8,222,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,223,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,224,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,225,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,226,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,227,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,228,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,1,112,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,1,115,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,3,1,117,0,5,0,2,0,20,0,16,17,17,17,17,17,17,17,17,17,2,165,1,3,1,99,0,7,0,4,0,0,6,86,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,231,0,16,2,60,28,249,153,255,149,174,37,198,91,202,41,29,108,29,92,197,223,42,215,186,204,179,105,137,130,121,168,169,225,217,84,16,1,124,5,5,84,197,79,223,134,77,199,210,177,213,29,127,3,207,81,232,32,223,29,3,226,129,220,208,51,8,53,216,176,17,2,121,45,177,85,164,24,14,126,131,127,68,24,21,95,97,146,155,109,41,179,16,161,60,228,68,62,168,147,142,105,25,73,16,3,1,116,0,11,0,8,0,0,1,139,253,81,193,138,0,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,16,17,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,1,180,1,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,2,238,81,197,66,193,59,172,79,56,196,200,19,94,104,228,220,46,42,34,208,26,22,228,148,175,206,141,51,231,174,100,25,16,4,1,48,0,7,4,1,2,4,233,0,0,126,140,194,235,75,151,172,234,136,23,1,100,14,152,204,209,139,193,3,130,181,93,47,77,35,56,97,121,251,151,185,114,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.080124542Z_GetEpochsInfoRequest_9cce33953db8841b6123b9ed1855b44ad2d78827e5cff18e4aee445ae1517d4d.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.080124542Z_GetEpochsInfoRequest_9cce33953db8841b6123b9ed1855b44ad2d78827e5cff18e4aee445ae1517d4d.json deleted file mode 100644 index 8000a4238b4..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.080124542Z_GetEpochsInfoRequest_9cce33953db8841b6123b9ed1855b44ad2d78827e5cff18e4aee445ae1517d4d.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_epoch":0,"count":100,"ascending":true,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,244,198,5,4,2,1,0,0,6,4,1,1,116,0,0,170,205,100,128,108,115,222,4,225,69,209,249,69,110,17,221,46,200,2,168,60,40,242,144,39,126,207,239,91,109,255,238,4,2,1,1,0,6,4,1,1,116,0,0,169,113,228,29,18,1,255,204,230,209,36,107,177,68,50,65,233,185,100,174,37,144,228,40,53,244,81,156,178,106,185,82,16,4,2,1,2,0,6,4,1,1,116,0,0,199,142,226,92,252,7,100,2,104,134,94,46,85,127,154,201,151,64,111,73,138,209,245,228,32,67,54,161,2,133,160,44,17,4,2,1,3,0,6,4,1,1,116,0,0,233,149,90,145,122,102,109,109,212,177,248,226,66,10,43,198,195,198,218,70,78,152,64,44,22,143,136,87,108,0,239,116,16,4,2,1,4,0,6,4,1,1,116,0,0,142,119,219,26,179,91,114,92,217,60,65,202,231,73,157,214,252,107,231,128,246,76,26,247,77,232,157,232,44,88,219,80,4,2,1,5,0,6,4,1,1,116,0,0,80,185,96,184,80,75,103,105,217,123,2,91,240,181,161,251,42,174,74,98,141,193,54,86,140,86,60,137,93,96,210,51,16,4,2,1,6,0,6,4,1,1,116,0,0,13,33,52,18,188,23,46,29,49,9,242,239,65,13,67,230,166,63,104,100,75,68,144,78,228,82,147,232,191,30,82,24,17,17,4,2,1,7,0,6,4,1,1,116,0,0,97,98,93,169,82,174,59,82,50,103,42,55,195,75,1,82,134,178,31,236,167,213,99,32,57,3,90,252,147,255,217,119,16,4,2,1,8,0,6,4,1,1,116,0,0,106,179,145,38,165,196,22,31,141,47,184,193,102,229,149,178,46,198,138,153,63,37,236,189,20,130,177,86,251,1,188,35,4,2,1,9,0,6,4,1,1,116,0,0,2,154,206,1,126,26,115,40,105,81,11,182,201,110,78,247,16,163,62,28,247,160,150,90,144,197,191,193,194,5,48,184,16,4,2,1,10,0,6,4,1,1,116,0,0,94,170,4,154,97,124,43,67,244,246,100,66,141,136,251,246,102,32,132,179,15,9,223,251,216,98,133,14,206,13,117,170,17,4,2,1,11,0,6,4,1,1,116,0,0,208,187,152,36,63,131,206,162,124,148,106,188,57,25,206,210,133,0,211,188,29,89,199,135,247,23,233,201,89,18,122,53,16,4,2,1,12,0,6,4,1,1,116,0,0,245,86,78,65,213,129,6,194,220,174,234,174,48,30,200,146,221,226,194,67,110,18,156,108,36,233,162,141,10,174,180,201,4,2,1,13,0,6,4,1,1,116,0,0,132,80,178,190,61,183,88,13,69,35,54,194,246,201,93,114,242,248,156,157,138,188,116,99,109,219,34,56,254,123,200,171,16,4,2,1,14,0,6,4,1,1,116,0,0,15,229,12,189,80,235,210,182,202,253,31,17,183,77,153,3,20,137,164,131,157,81,109,140,5,181,65,204,46,112,163,156,17,17,17,4,2,1,15,0,6,4,1,1,116,0,0,231,30,228,93,45,17,46,167,166,147,24,0,95,175,80,206,79,33,240,28,148,189,240,116,92,179,146,62,58,116,239,189,16,4,2,1,16,0,6,4,1,1,116,0,0,46,99,19,149,183,250,167,108,175,86,207,143,251,233,188,80,166,205,31,52,185,9,181,234,66,128,156,9,223,174,146,198,4,2,1,17,0,6,4,1,1,116,0,0,153,187,138,90,65,20,198,64,150,96,167,187,197,180,133,33,30,96,163,144,51,166,3,94,207,214,49,230,144,39,228,149,16,4,2,1,18,0,6,4,1,1,116,0,0,102,84,141,100,138,102,251,89,31,114,253,128,44,240,98,17,94,177,52,109,220,227,120,227,254,70,241,134,25,0,215,127,17,4,2,1,19,0,6,4,1,1,116,0,0,198,71,208,163,201,190,193,12,90,113,149,114,4,108,252,129,193,37,131,85,162,219,39,156,251,25,95,67,99,67,93,162,16,4,2,1,20,0,6,4,1,1,115,0,0,161,19,100,111,42,217,230,29,186,16,48,187,133,94,222,139,100,139,238,137,67,92,70,49,194,217,20,30,8,219,158,237,4,2,1,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,1,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,1,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,1,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,2,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,2,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,3,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,3,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,3,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,4,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,17,4,2,4,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,5,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,5,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,5,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,6,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,6,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,7,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,7,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,7,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,8,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,8,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,208,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,209,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,17,4,2,8,210,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,211,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,212,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,213,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,214,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,215,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,216,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,217,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,218,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,219,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,220,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,221,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,2,8,222,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,223,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,224,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,225,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,226,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,227,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,228,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,1,112,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,1,115,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,3,1,117,0,5,0,2,0,20,0,16,17,17,17,17,17,17,17,17,17,2,63,3,1,99,0,7,0,4,0,0,5,155,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,1,0,16,3,1,116,0,11,0,8,0,0,1,139,252,246,6,216,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,155,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,2,0,16,3,1,116,0,11,0,8,0,0,1,139,252,251,241,24,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,162,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,21,0,16,3,1,116,0,11,0,8,0,0,1,139,252,255,77,231,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,172,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,47,0,16,3,1,116,0,11,0,8,0,0,1,139,253,3,229,143,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,183,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,73,0,16,3,1,116,0,11,0,8,0,0,1,139,253,8,129,167,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,192,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,98,0,16,3,1,116,0,11,0,8,0,0,1,139,253,12,238,205,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,202,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,124,0,16,3,1,116,0,11,0,8,0,0,1,139,253,17,136,34,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,212,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,150,0,16,3,1,116,0,11,0,8,0,0,1,139,253,22,34,177,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,222,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,176,0,16,3,1,116,0,11,0,8,0,0,1,139,253,26,187,233,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,232,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,202,0,16,3,1,116,0,11,0,8,0,0,1,139,253,31,86,208,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,242,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,228,0,16,3,1,116,0,11,0,8,0,0,1,139,253,35,239,76,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,252,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,254,0,16,3,1,116,0,11,0,8,0,0,1,139,253,40,136,203,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,6,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,23,0,16,3,1,116,0,11,0,8,0,0,1,139,253,44,246,89,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,16,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,49,0,16,3,1,116,0,11,0,8,0,0,1,139,253,49,142,130,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,26,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,75,0,16,3,1,116,0,11,0,8,0,0,1,139,253,54,39,60,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,36,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,101,0,16,3,1,116,0,11,0,8,0,0,1,139,253,58,195,6,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,46,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,127,0,16,3,1,116,0,11,0,8,0,0,1,139,253,63,94,120,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,56,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,153,0,16,3,1,116,0,11,0,8,0,0,1,139,253,67,247,22,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,66,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,179,0,16,3,1,116,0,11,0,8,0,0,1,139,253,72,143,190,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,6,76,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,205,0,16,3,1,116,0,11,0,8,0,0,1,139,253,77,39,243,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,165,1,3,1,99,0,7,0,4,0,0,6,86,0,3,1,104,0,11,0,8,0,0,0,0,0,0,1,231,0,16,2,60,28,249,153,255,149,174,37,198,91,202,41,29,108,29,92,197,223,42,215,186,204,179,105,137,130,121,168,169,225,217,84,16,1,124,5,5,84,197,79,223,134,77,199,210,177,213,29,127,3,207,81,232,32,223,29,3,226,129,220,208,51,8,53,216,176,17,2,121,45,177,85,164,24,14,126,131,127,68,24,21,95,97,146,155,109,41,179,16,161,60,228,68,62,168,147,142,105,25,73,16,3,1,116,0,11,0,8,0,0,1,139,253,81,193,138,0,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,16,17,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,1,180,1,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,2,238,81,197,66,193,59,172,79,56,196,200,19,94,104,228,220,46,42,34,208,26,22,228,148,175,206,141,51,231,174,100,25,16,4,1,48,0,7,4,1,2,4,233,0,0,126,140,194,235,75,151,172,234,136,23,1,100,14,152,204,209,139,193,3,130,181,93,47,77,35,56,97,121,251,151,185,114,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.426422030Z_DocumentQuery_93ef8e9afdc1e6a8453c1751ff30274e274af4fcc3a2671cb2d48ad78f095d15.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.426422030Z_DocumentQuery_93ef8e9afdc1e6a8453c1751ff30274e274af4fcc3a2671cb2d48ad78f095d15.json deleted file mode 100644 index 8ed28d01271..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.426422030Z_DocumentQuery_93ef8e9afdc1e6a8453c1751ff30274e274af4fcc3a2671cb2d48ad78f095d15.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"data_contract":{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}},"document_type_name":"domain","where_clauses":[{"field":"$id","operator":"Equal","value":"11111111111111111111111111111111"}],"order_by_clauses":[],"limit":0,"start":null},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,66,5,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,147,75,114,199,152,241,64,189,233,69,209,216,208,173,226,107,85,229,226,252,149,3,98,55,80,101,79,94,183,218,227,108,1,175,1,4,1,0,0,36,2,1,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,65,245,205,250,165,144,58,205,151,231,250,118,68,196,222,33,122,115,202,113,191,174,43,185,18,208,221,98,69,63,190,117,2,243,227,109,203,174,138,132,44,53,44,18,233,29,115,61,1,50,236,193,96,113,27,57,167,78,14,8,132,33,178,91,59,16,2,115,95,123,161,244,153,57,55,29,209,118,68,122,250,87,10,220,178,23,42,98,149,170,101,107,2,4,123,132,80,134,114,16,1,237,176,56,18,90,131,64,146,62,73,218,37,7,80,230,25,195,214,84,107,116,42,161,213,231,99,49,70,109,122,46,221,17,1,107,4,6,100,111,109,97,105,110,0,31,2,1,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,0,204,190,158,105,75,9,25,208,194,91,83,149,12,201,75,109,144,75,99,66,32,51,85,191,175,76,98,75,52,53,85,240,2,38,158,217,247,245,108,64,252,150,230,243,204,75,109,160,249,36,126,63,182,190,232,139,251,233,178,192,48,6,248,191,249,16,1,83,1,54,223,240,31,55,201,49,39,140,69,210,242,185,108,80,68,28,64,36,152,167,122,5,41,10,68,183,75,86,144,179,204,4,1,1,0,12,2,1,8,112,114,101,111,114,100,101,114,0,84,156,7,216,23,176,127,111,115,1,136,38,75,129,30,33,220,29,7,163,198,67,108,238,35,254,220,182,27,62,14,229,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.433229690Z_DocumentQuery_a818ac2a04eea1a026dc55c30ab94f09befdbcd37bf82f70051c8cd3e4eddeba.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.433229690Z_DocumentQuery_a818ac2a04eea1a026dc55c30ab94f09befdbcd37bf82f70051c8cd3e4eddeba.json deleted file mode 100644 index 871ef34ca31..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.433229690Z_DocumentQuery_a818ac2a04eea1a026dc55c30ab94f09befdbcd37bf82f70051c8cd3e4eddeba.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"data_contract":{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}},"document_type_name":"domain","where_clauses":[],"order_by_clauses":[],"limit":1,"start":null},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,189,1,3,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,153,0,150,0,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,0,0,4,100,97,115,104,4,100,97,115,104,1,0,0,224,181,8,197,163,104,37,162,6,105,58,31,65,74,161,62,219,236,244,60,65,227,199,153,234,158,115,123,79,154,162,38,34,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,1,0,1,175,1,4,1,0,0,36,2,1,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,65,245,205,250,165,144,58,205,151,231,250,118,68,196,222,33,122,115,202,113,191,174,43,185,18,208,221,98,69,63,190,117,2,243,227,109,203,174,138,132,44,53,44,18,233,29,115,61,1,50,236,193,96,113,27,57,167,78,14,8,132,33,178,91,59,16,2,115,95,123,161,244,153,57,55,29,209,118,68,122,250,87,10,220,178,23,42,98,149,170,101,107,2,4,123,132,80,134,114,16,1,237,176,56,18,90,131,64,146,62,73,218,37,7,80,230,25,195,214,84,107,116,42,161,213,231,99,49,70,109,122,46,221,17,1,107,4,6,100,111,109,97,105,110,0,31,2,1,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,0,204,190,158,105,75,9,25,208,194,91,83,149,12,201,75,109,144,75,99,66,32,51,85,191,175,76,98,75,52,53,85,240,2,38,158,217,247,245,108,64,252,150,230,243,204,75,109,160,249,36,126,63,182,190,232,139,251,233,178,192,48,6,248,191,249,16,1,83,1,54,223,240,31,55,201,49,39,140,69,210,242,185,108,80,68,28,64,36,152,167,122,5,41,10,68,183,75,86,144,179,204,4,1,1,0,12,2,1,8,112,114,101,111,114,100,101,114,0,84,156,7,216,23,176,127,111,115,1,136,38,75,129,30,33,220,29,7,163,198,67,108,238,35,254,220,182,27,62,14,229,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.433230211Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.433230211Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json deleted file mode 100644 index 51b7e28a49f..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.433230211Z_GetIdentityRequest_286cb4d90a7df242060f38522bb1f53264482cc34d82cf95e06bfa0b608c1dbd.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,198,2,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,1,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,127,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,2,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.444691450Z_DocumentQuery_100720a9c5d8a4f4c5af90b57a848f1e24eeeeb3be5c0022cb5152ede68630e7.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.444691450Z_DocumentQuery_100720a9c5d8a4f4c5af90b57a848f1e24eeeeb3be5c0022cb5152ede68630e7.json deleted file mode 100644 index e4aa49f9bbb..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.444691450Z_DocumentQuery_100720a9c5d8a4f4c5af90b57a848f1e24eeeeb3be5c0022cb5152ede68630e7.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"data_contract":{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}},"document_type_name":"domain","where_clauses":[],"order_by_clauses":[],"limit":0,"start":null},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,189,1,3,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,153,0,150,0,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,0,0,4,100,97,115,104,4,100,97,115,104,1,0,0,224,181,8,197,163,104,37,162,6,105,58,31,65,74,161,62,219,236,244,60,65,227,199,153,234,158,115,123,79,154,162,38,34,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,1,0,1,175,1,4,1,0,0,36,2,1,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,65,245,205,250,165,144,58,205,151,231,250,118,68,196,222,33,122,115,202,113,191,174,43,185,18,208,221,98,69,63,190,117,2,243,227,109,203,174,138,132,44,53,44,18,233,29,115,61,1,50,236,193,96,113,27,57,167,78,14,8,132,33,178,91,59,16,2,115,95,123,161,244,153,57,55,29,209,118,68,122,250,87,10,220,178,23,42,98,149,170,101,107,2,4,123,132,80,134,114,16,1,237,176,56,18,90,131,64,146,62,73,218,37,7,80,230,25,195,214,84,107,116,42,161,213,231,99,49,70,109,122,46,221,17,1,107,4,6,100,111,109,97,105,110,0,31,2,1,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,0,204,190,158,105,75,9,25,208,194,91,83,149,12,201,75,109,144,75,99,66,32,51,85,191,175,76,98,75,52,53,85,240,2,38,158,217,247,245,108,64,252,150,230,243,204,75,109,160,249,36,126,63,182,190,232,139,251,233,178,192,48,6,248,191,249,16,1,83,1,54,223,240,31,55,201,49,39,140,69,210,242,185,108,80,68,28,64,36,152,167,122,5,41,10,68,183,75,86,144,179,204,4,1,1,0,12,2,1,8,112,114,101,111,114,100,101,114,0,84,156,7,216,23,176,127,111,115,1,136,38,75,129,30,33,220,29,7,163,198,67,108,238,35,254,220,182,27,62,14,229,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.447019688Z_GetIdentityBalanceRequest_e91c9897a9689e1986cf1b9579535bcc0c8b470f5df2c4ba8144fde70867ab69.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.447019688Z_GetIdentityBalanceRequest_e91c9897a9689e1986cf1b9579535bcc0c8b470f5df2c4ba8144fde70867ab69.json deleted file mode 100644 index 649ea19245c..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.447019688Z_GetIdentityBalanceRequest_e91c9897a9689e1986cf1b9579535bcc0c8b470f5df2c4ba8144fde70867ab69.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17,1,218,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453685360Z_GetIdentityBalanceAndRevisionRequest_4809aada385f6c04f595ff8b7ecbe02efc1cc57010e9fc2e46ed6bf8a34d2e1c.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453685360Z_GetIdentityBalanceAndRevisionRequest_4809aada385f6c04f595ff8b7ecbe02efc1cc57010e9fc2e46ed6bf8a34d2e1c.json deleted file mode 100644 index c5659f6e8f5..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453685360Z_GetIdentityBalanceAndRevisionRequest_4809aada385f6c04f595ff8b7ecbe02efc1cc57010e9fc2e46ed6bf8a34d2e1c.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,6,0,1,0,198,2,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,1,1,32,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,2,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,118,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,2,254,68,167,129,67,249,107,15,40,221,224,9,139,28,106,17,132,200,185,66,56,75,108,204,214,114,83,149,194,184,60,145,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,1,96,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453726197Z_GetIdentityKeysRequest_105e9b32f84ce4eadea49154f2f433e48d1ccf07e8797bcf89ff8d3941ba3919.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453726197Z_GetIdentityKeysRequest_105e9b32f84ce4eadea49154f2f433e48d1ccf07e8797bcf89ff8d3941ba3919.json deleted file mode 100644 index 0e7e474ed2c..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453726197Z_GetIdentityKeysRequest_105e9b32f84ce4eadea49154f2f433e48d1ccf07e8797bcf89ff8d3941ba3919.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"identity_id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"request_type":{"request":{"all_keys":{}}},"limit":null,"offset":null,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,1,144,1,1,200,20,167,68,4,93,76,240,184,143,173,215,241,79,248,164,80,174,61,145,241,155,104,236,61,45,248,44,128,202,230,8,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,1,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,209,1,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453938207Z_DocumentQuery_100720a9c5d8a4f4c5af90b57a848f1e24eeeeb3be5c0022cb5152ede68630e7.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453938207Z_DocumentQuery_100720a9c5d8a4f4c5af90b57a848f1e24eeeeb3be5c0022cb5152ede68630e7.json deleted file mode 100644 index e4aa49f9bbb..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.453938207Z_DocumentQuery_100720a9c5d8a4f4c5af90b57a848f1e24eeeeb3be5c0022cb5152ede68630e7.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"data_contract":{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}},"document_type_name":"domain","where_clauses":[],"order_by_clauses":[],"limit":0,"start":null},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,189,1,3,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,153,0,150,0,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,0,0,4,100,97,115,104,4,100,97,115,104,1,0,0,224,181,8,197,163,104,37,162,6,105,58,31,65,74,161,62,219,236,244,60,65,227,199,153,234,158,115,123,79,154,162,38,34,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,1,0,1,175,1,4,1,0,0,36,2,1,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,65,245,205,250,165,144,58,205,151,231,250,118,68,196,222,33,122,115,202,113,191,174,43,185,18,208,221,98,69,63,190,117,2,243,227,109,203,174,138,132,44,53,44,18,233,29,115,61,1,50,236,193,96,113,27,57,167,78,14,8,132,33,178,91,59,16,2,115,95,123,161,244,153,57,55,29,209,118,68,122,250,87,10,220,178,23,42,98,149,170,101,107,2,4,123,132,80,134,114,16,1,237,176,56,18,90,131,64,146,62,73,218,37,7,80,230,25,195,214,84,107,116,42,161,213,231,99,49,70,109,122,46,221,17,1,107,4,6,100,111,109,97,105,110,0,31,2,1,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,0,204,190,158,105,75,9,25,208,194,91,83,149,12,201,75,109,144,75,99,66,32,51,85,191,175,76,98,75,52,53,85,240,2,38,158,217,247,245,108,64,252,150,230,243,204,75,109,160,249,36,126,63,182,190,232,139,251,233,178,192,48,6,248,191,249,16,1,83,1,54,223,240,31,55,201,49,39,140,69,210,242,185,108,80,68,28,64,36,152,167,122,5,41,10,68,183,75,86,144,179,204,4,1,1,0,12,2,1,8,112,114,101,111,114,100,101,114,0,84,156,7,216,23,176,127,111,115,1,136,38,75,129,30,33,220,29,7,163,198,67,108,238,35,254,220,182,27,62,14,229,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.454423973Z_IdentityRequest_fa68a24d7c0ef611bc762c3703122903565f51d88dd92e4c366ab2d2a5f49b5a.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.454423973Z_IdentityRequest_fa68a24d7c0ef611bc762c3703122903565f51d88dd92e4c366ab2d2a5f49b5a.json deleted file mode 100644 index d334bff94ba..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.454423973Z_IdentityRequest_fa68a24d7c0ef611bc762c3703122903565f51d88dd92e4c366ab2d2a5f49b5a.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"GetIdentity":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}}},"response":{"GetIdentity":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,198,2,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,1,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,127,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,2,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.467303996Z_IdentityRequest_fa68a24d7c0ef611bc762c3703122903565f51d88dd92e4c366ab2d2a5f49b5a.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.467303996Z_IdentityRequest_fa68a24d7c0ef611bc762c3703122903565f51d88dd92e4c366ab2d2a5f49b5a.json deleted file mode 100644 index d334bff94ba..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.467303996Z_IdentityRequest_fa68a24d7c0ef611bc762c3703122903565f51d88dd92e4c366ab2d2a5f49b5a.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"GetIdentity":{"version":{"v0":{"id":[48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172],"prove":true}}}},"response":{"GetIdentity":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,198,2,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,1,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,127,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,2,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.467325937Z_GetEpochsInfoRequest_9bbde71623deeaa5c2fc1650705cce3ad227e8411eab4d6f28d6250f4996dc21.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.467325937Z_GetEpochsInfoRequest_9bbde71623deeaa5c2fc1650705cce3ad227e8411eab4d6f28d6250f4996dc21.json deleted file mode 100644 index 48db134dcd4..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.467325937Z_GetEpochsInfoRequest_9bbde71623deeaa5c2fc1650705cce3ad227e8411eab4d6f28d6250f4996dc21.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_epoch":30,"count":100,"ascending":true,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,190,190,5,1,83,130,202,92,2,193,2,25,2,95,255,51,170,79,44,231,110,158,154,75,226,88,157,4,91,99,78,173,130,128,127,142,2,100,123,12,124,246,245,215,211,9,20,208,5,145,179,6,159,212,55,244,219,114,242,103,240,89,252,195,139,154,208,238,240,16,1,146,166,244,171,136,19,40,6,25,70,65,25,22,225,3,159,45,138,229,81,71,190,221,24,144,108,225,220,151,223,3,229,2,214,133,214,97,203,126,194,30,3,243,48,119,63,4,90,202,246,179,75,59,177,118,242,68,119,141,22,175,221,127,238,223,16,1,113,7,212,117,2,228,217,183,56,43,184,204,159,148,171,28,213,227,252,69,93,204,164,2,164,53,166,77,19,203,49,4,2,165,73,179,61,173,25,180,248,234,23,228,174,104,21,43,218,187,221,182,197,66,172,201,71,113,88,1,82,252,188,168,195,16,1,218,168,38,111,174,52,234,213,16,164,230,91,90,145,130,148,61,111,125,32,229,13,140,108,49,198,198,91,207,160,217,173,2,125,82,1,81,76,177,32,247,193,156,11,109,54,224,205,110,148,108,249,200,155,70,92,47,22,252,62,177,193,139,70,232,16,4,2,1,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,1,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,1,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,1,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,2,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,2,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,3,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,3,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,3,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,4,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,17,4,2,4,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,5,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,5,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,5,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,6,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,6,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,7,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,7,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,7,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,8,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,8,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,208,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,209,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,17,4,2,8,210,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,211,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,212,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,213,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,214,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,215,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,216,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,217,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,218,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,219,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,220,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,221,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,2,8,222,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,223,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,224,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,225,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,226,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,227,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,228,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,1,112,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,1,115,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,3,1,117,0,5,0,2,0,20,0,16,17,17,17,17,17,17,17,17,17,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,2,35,5,1,115,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,1,180,1,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,2,238,81,197,66,193,59,172,79,56,196,200,19,94,104,228,220,46,42,34,208,26,22,228,148,175,206,141,51,231,174,100,25,16,4,1,48,0,7,4,1,2,4,233,0,0,126,140,194,235,75,151,172,234,136,23,1,100,14,152,204,209,139,193,3,130,181,93,47,77,35,56,97,121,251,151,185,114,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.527888214Z_GetProtocolVersionUpgradeStateRequest_4ed3fce5a29b6727723dc6a61de43efa7bd8ad573b26b5a9c2258707b6130b1a.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.527888214Z_GetProtocolVersionUpgradeStateRequest_4ed3fce5a29b6727723dc6a61de43efa7bd8ad573b26b5a9c2258707b6130b1a.json deleted file mode 100644 index 849f8223b3d..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.527888214Z_GetProtocolVersionUpgradeStateRequest_4ed3fce5a29b6727723dc6a61de43efa7bd8ad573b26b5a9c2258707b6130b1a.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,9,3,1,1,0,4,0,1,3,0,1,76,4,1,0,0,5,2,1,1,1,0,172,118,147,226,99,11,13,181,90,39,101,222,175,254,30,207,198,99,206,96,212,107,42,5,87,62,124,47,142,71,215,124,2,48,255,112,3,100,106,137,48,184,76,179,165,210,182,251,115,152,140,183,121,113,209,160,27,162,213,231,149,213,204,162,103,16,1,212,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,2,175,176,44,68,76,56,6,20,24,225,142,11,24,240,97,207,172,108,43,27,213,168,19,76,75,136,52,164,207,181,28,182,16,2,47,142,242,39,38,151,132,161,102,144,3,59,141,22,75,155,233,170,192,212,68,76,152,175,85,13,163,2,172,135,30,206,4,1,120,0,5,2,1,1,1,0,150,65,61,70,201,175,111,254,234,207,149,180,10,78,122,36,240,226,133,34,18,35,237,29,21,18,206,162,50,132,239,75,17,17,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532752692Z_DocumentQuery_66b0ef1d6b1f37230412b8f86821352f30f654f6503d1d6914867355a203caba.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532752692Z_DocumentQuery_66b0ef1d6b1f37230412b8f86821352f30f654f6503d1d6914867355a203caba.json deleted file mode 100644 index 688c642b073..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532752692Z_DocumentQuery_66b0ef1d6b1f37230412b8f86821352f30f654f6503d1d6914867355a203caba.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"data_contract":{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}},"document_type_name":"domain","where_clauses":[{"field":"$id","operator":"Equal","value":"FXyN2NZAdRFADgBQfb1XM1Qq7pWoEcgSWj1GaiQJqcrS"}],"order_by_clauses":[],"limit":0,"start":null},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,189,1,3,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,153,0,150,0,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,0,0,4,100,97,115,104,4,100,97,115,104,1,0,0,224,181,8,197,163,104,37,162,6,105,58,31,65,74,161,62,219,236,244,60,65,227,199,153,234,158,115,123,79,154,162,38,34,0,1,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,1,1,0,1,175,1,4,1,0,0,36,2,1,32,215,242,197,63,70,169,23,171,110,91,57,162,215,188,38,11,100,146,137,69,55,68,209,224,212,242,106,141,142,255,55,207,0,65,245,205,250,165,144,58,205,151,231,250,118,68,196,222,33,122,115,202,113,191,174,43,185,18,208,221,98,69,63,190,117,2,243,227,109,203,174,138,132,44,53,44,18,233,29,115,61,1,50,236,193,96,113,27,57,167,78,14,8,132,33,178,91,59,16,2,115,95,123,161,244,153,57,55,29,209,118,68,122,250,87,10,220,178,23,42,98,149,170,101,107,2,4,123,132,80,134,114,16,1,237,176,56,18,90,131,64,146,62,73,218,37,7,80,230,25,195,214,84,107,116,42,161,213,231,99,49,70,109,122,46,221,17,1,107,4,6,100,111,109,97,105,110,0,31,2,1,27,114,101,99,111,114,100,115,46,100,97,115,104,65,108,105,97,115,73,100,101,110,116,105,116,121,73,100,0,204,190,158,105,75,9,25,208,194,91,83,149,12,201,75,109,144,75,99,66,32,51,85,191,175,76,98,75,52,53,85,240,2,38,158,217,247,245,108,64,252,150,230,243,204,75,109,160,249,36,126,63,182,190,232,139,251,233,178,192,48,6,248,191,249,16,1,83,1,54,223,240,31,55,201,49,39,140,69,210,242,185,108,80,68,28,64,36,152,167,122,5,41,10,68,183,75,86,144,179,204,4,1,1,0,12,2,1,8,112,114,101,111,114,100,101,114,0,84,156,7,216,23,176,127,111,115,1,136,38,75,129,30,33,220,29,7,163,198,67,108,238,35,254,220,182,27,62,14,229,16,1,141,1,1,53,27,87,37,221,226,28,175,201,185,193,171,161,189,79,11,174,89,129,179,222,243,245,228,182,62,69,51,4,147,15,248,2,1,217,109,238,206,206,168,243,192,236,215,159,163,75,111,52,173,240,242,45,193,69,99,247,92,124,165,253,229,130,228,6,16,4,32,230,104,198,89,175,102,174,225,231,44,24,109,222,123,91,126,10,29,113,42,9,196,13,87,33,246,34,191,83,197,49,85,0,5,2,1,1,1,0,33,138,150,165,224,17,145,179,7,120,169,2,43,51,49,142,79,255,67,7,18,161,70,134,2,167,190,106,29,104,149,81,17,1,141,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,4,1,64,0,36,2,1,32,162,161,180,172,111,239,34,234,42,26,104,232,18,54,68,179,87,135,95,107,65,44,24,16,146,129,193,70,231,178,113,188,0,168,99,211,63,81,56,245,72,156,254,93,201,14,131,171,16,91,237,241,30,32,62,67,128,249,8,196,116,111,157,82,212,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532753684Z_GetProtocolVersionUpgradeVoteStatusRequest_23ba016b971c6bf8861d9be485c6366cd76d51c080ede13275caaa4e495dc40d.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532753684Z_GetProtocolVersionUpgradeVoteStatusRequest_23ba016b971c6bf8861d9be485c6366cd76d51c080ede13275caaa4e495dc40d.json deleted file mode 100644 index b9489daa7ee..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532753684Z_GetProtocolVersionUpgradeVoteStatusRequest_23ba016b971c6bf8861d9be485c6366cd76d51c080ede13275caaa4e495dc40d.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_pro_tx_hash":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"count":2,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,115,3,32,32,61,206,159,132,120,24,255,130,88,128,169,159,65,68,200,248,97,166,108,115,34,32,101,252,57,131,15,0,136,128,136,0,4,0,1,1,0,3,32,116,92,159,20,113,73,103,94,47,194,55,81,85,32,107,47,22,240,65,26,188,84,112,171,23,101,1,233,32,217,211,247,0,4,0,1,1,0,16,1,128,104,3,237,23,39,57,239,32,149,104,103,142,51,205,15,169,60,243,88,78,16,0,13,124,253,95,174,156,178,85,87,17,1,107,1,87,179,244,56,7,185,118,146,239,15,211,218,0,164,145,194,126,141,143,128,151,182,242,30,26,24,123,92,97,194,72,70,4,1,1,0,36,2,1,32,116,92,159,20,113,73,103,94,47,194,55,81,85,32,107,47,22,240,65,26,188,84,112,171,23,101,1,233,32,217,211,247,0,229,149,70,100,255,25,235,252,87,188,224,163,221,159,166,171,225,167,241,8,232,224,215,203,245,176,82,242,42,230,98,252,16,1,212,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,2,175,176,44,68,76,56,6,20,24,225,142,11,24,240,97,207,172,108,43,27,213,168,19,76,75,136,52,164,207,181,28,182,16,2,47,142,242,39,38,151,132,161,102,144,3,59,141,22,75,155,233,170,192,212,68,76,152,175,85,13,163,2,172,135,30,206,4,1,120,0,5,2,1,1,1,0,150,65,61,70,201,175,111,254,234,207,149,180,10,78,122,36,240,226,133,34,18,35,237,29,21,18,206,162,50,132,239,75,17,17,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532766888Z_GetEpochsInfoRequest_1a593ca7a1115a6cb2f60ad11269f61ad490a07e7dd3beb74eece388772bcfbd.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532766888Z_GetEpochsInfoRequest_1a593ca7a1115a6cb2f60ad11269f61ad490a07e7dd3beb74eece388772bcfbd.json deleted file mode 100644 index ccef5337a99..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.532766888Z_GetEpochsInfoRequest_1a593ca7a1115a6cb2f60ad11269f61ad490a07e7dd3beb74eece388772bcfbd.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_epoch":1,"count":2,"ascending":true,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,1,233,198,5,1,131,186,49,101,222,156,65,35,121,138,179,160,147,122,144,51,97,129,30,125,91,82,81,222,86,188,189,15,179,211,32,226,4,2,1,1,0,6,4,1,1,116,0,0,169,113,228,29,18,1,255,204,230,209,36,107,177,68,50,65,233,185,100,174,37,144,228,40,53,244,81,156,178,106,185,82,16,4,2,1,2,0,6,4,1,1,116,0,0,199,142,226,92,252,7,100,2,104,134,94,46,85,127,154,201,151,64,111,73,138,209,245,228,32,67,54,161,2,133,160,44,17,4,2,1,3,0,6,4,1,1,116,0,0,233,149,90,145,122,102,109,109,212,177,248,226,66,10,43,198,195,198,218,70,78,152,64,44,22,143,136,87,108,0,239,116,16,4,2,1,4,0,6,4,1,1,116,0,0,142,119,219,26,179,91,114,92,217,60,65,202,231,73,157,214,252,107,231,128,246,76,26,247,77,232,157,232,44,88,219,80,4,2,1,5,0,6,4,1,1,116,0,0,80,185,96,184,80,75,103,105,217,123,2,91,240,181,161,251,42,174,74,98,141,193,54,86,140,86,60,137,93,96,210,51,16,4,2,1,6,0,6,4,1,1,116,0,0,13,33,52,18,188,23,46,29,49,9,242,239,65,13,67,230,166,63,104,100,75,68,144,78,228,82,147,232,191,30,82,24,17,17,4,2,1,7,0,6,4,1,1,116,0,0,97,98,93,169,82,174,59,82,50,103,42,55,195,75,1,82,134,178,31,236,167,213,99,32,57,3,90,252,147,255,217,119,16,4,2,1,8,0,6,4,1,1,116,0,0,106,179,145,38,165,196,22,31,141,47,184,193,102,229,149,178,46,198,138,153,63,37,236,189,20,130,177,86,251,1,188,35,4,2,1,9,0,6,4,1,1,116,0,0,2,154,206,1,126,26,115,40,105,81,11,182,201,110,78,247,16,163,62,28,247,160,150,90,144,197,191,193,194,5,48,184,16,4,2,1,10,0,6,4,1,1,116,0,0,94,170,4,154,97,124,43,67,244,246,100,66,141,136,251,246,102,32,132,179,15,9,223,251,216,98,133,14,206,13,117,170,17,4,2,1,11,0,6,4,1,1,116,0,0,208,187,152,36,63,131,206,162,124,148,106,188,57,25,206,210,133,0,211,188,29,89,199,135,247,23,233,201,89,18,122,53,16,4,2,1,12,0,6,4,1,1,116,0,0,245,86,78,65,213,129,6,194,220,174,234,174,48,30,200,146,221,226,194,67,110,18,156,108,36,233,162,141,10,174,180,201,4,2,1,13,0,6,4,1,1,116,0,0,132,80,178,190,61,183,88,13,69,35,54,194,246,201,93,114,242,248,156,157,138,188,116,99,109,219,34,56,254,123,200,171,16,4,2,1,14,0,6,4,1,1,116,0,0,15,229,12,189,80,235,210,182,202,253,31,17,183,77,153,3,20,137,164,131,157,81,109,140,5,181,65,204,46,112,163,156,17,17,17,4,2,1,15,0,6,4,1,1,116,0,0,231,30,228,93,45,17,46,167,166,147,24,0,95,175,80,206,79,33,240,28,148,189,240,116,92,179,146,62,58,116,239,189,16,4,2,1,16,0,6,4,1,1,116,0,0,46,99,19,149,183,250,167,108,175,86,207,143,251,233,188,80,166,205,31,52,185,9,181,234,66,128,156,9,223,174,146,198,4,2,1,17,0,6,4,1,1,116,0,0,153,187,138,90,65,20,198,64,150,96,167,187,197,180,133,33,30,96,163,144,51,166,3,94,207,214,49,230,144,39,228,149,16,4,2,1,18,0,6,4,1,1,116,0,0,102,84,141,100,138,102,251,89,31,114,253,128,44,240,98,17,94,177,52,109,220,227,120,227,254,70,241,134,25,0,215,127,17,4,2,1,19,0,6,4,1,1,116,0,0,198,71,208,163,201,190,193,12,90,113,149,114,4,108,252,129,193,37,131,85,162,219,39,156,251,25,95,67,99,67,93,162,16,4,2,1,20,0,6,4,1,1,115,0,0,161,19,100,111,42,217,230,29,186,16,48,187,133,94,222,139,100,139,238,137,67,92,70,49,194,217,20,30,8,219,158,237,4,2,1,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,1,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,1,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,1,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,1,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,1,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,1,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,1,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,1,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,1,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,1,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,2,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,2,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,2,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,2,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,2,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,2,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,2,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,2,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,2,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,2,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,3,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,3,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,3,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,3,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,3,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,3,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,3,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,3,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,3,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,3,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,4,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,4,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,4,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,4,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,17,4,2,4,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,4,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,4,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,4,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,4,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,4,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,5,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,5,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,5,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,5,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,5,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,5,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,5,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,5,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,5,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,5,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,6,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,6,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,6,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,17,4,2,6,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,6,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,6,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,6,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,6,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,6,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,6,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,7,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,7,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,7,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,208,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,209,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,210,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,211,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,212,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,213,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,214,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,215,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,216,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,17,4,2,7,217,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,218,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,219,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,220,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,221,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,222,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,223,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,224,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,225,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,226,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,227,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,228,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,229,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,230,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,231,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,232,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,7,233,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,234,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,235,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,236,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,237,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,238,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,239,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,240,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,7,241,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,242,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,243,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,244,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,245,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,246,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,247,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,248,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,7,249,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,250,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,251,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,252,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,7,253,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,7,254,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,7,255,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,0,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,1,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,2,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,3,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,4,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,5,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,6,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,7,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,8,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,9,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,10,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,11,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,12,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,13,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,14,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,15,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,16,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,17,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,18,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,19,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,20,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,21,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,22,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,23,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,24,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,25,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,26,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,27,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,28,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,29,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,30,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,31,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,32,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,33,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,34,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,35,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,36,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,37,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,38,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,39,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,40,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,41,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,42,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,43,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,44,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,45,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,46,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,47,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,48,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,49,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,50,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,51,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,52,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,53,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,54,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,55,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,56,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,57,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,58,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,59,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,60,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,61,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,62,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,63,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,64,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,65,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,66,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,67,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,68,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,69,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,70,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,71,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,72,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,73,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,74,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,75,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,76,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,77,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,78,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,79,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,80,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,81,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,82,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,83,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,84,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,85,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,17,4,2,8,86,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,87,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,88,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,89,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,90,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,91,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,92,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,93,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,94,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,95,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,96,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,97,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,98,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,99,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,100,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,101,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,102,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,103,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,104,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,105,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,106,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,107,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,108,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,109,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,110,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,111,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,112,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,113,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,114,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,115,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,116,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,117,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,17,4,2,8,118,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,119,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,120,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,121,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,122,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,123,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,124,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,125,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,126,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,127,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,128,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,129,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,130,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,131,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,132,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,133,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,134,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,135,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,136,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,137,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,138,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,139,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,140,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,141,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,142,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,143,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,144,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,145,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,146,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,147,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,148,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,17,4,2,8,149,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,150,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,151,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,152,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,153,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,154,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,155,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,156,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,157,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,158,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,159,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,160,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,161,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,162,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,163,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,164,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,165,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,166,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,167,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,168,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,169,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,170,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,171,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,172,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,173,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,174,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,175,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,176,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,177,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,178,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,179,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,17,17,17,4,2,8,180,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,181,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,182,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,183,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,184,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,185,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,186,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,187,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,188,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,189,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,190,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,191,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,192,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,193,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,194,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,195,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,17,4,2,8,196,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,197,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,198,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,199,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,200,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,201,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,202,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,203,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,17,4,2,8,204,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,205,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,4,2,8,206,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,16,4,2,8,207,0,6,4,1,1,115,0,0,182,80,10,127,238,212,239,8,162,112,103,32,122,185,170,113,53,160,165,3,150,47,26,33,60,74,139,64,54,229,57,209,17,4,2,8,208,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,209,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,17,4,2,8,210,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,211,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,212,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,213,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,214,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,215,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,216,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,217,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,218,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,219,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,220,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,221,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,2,8,222,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,223,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,224,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,225,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,4,2,8,226,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,2,8,227,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,4,2,8,228,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,17,17,4,1,112,0,4,4,0,0,0,128,36,254,85,240,173,208,27,171,58,171,128,38,98,102,100,20,24,4,69,10,165,239,206,227,95,233,100,181,217,58,193,16,4,1,115,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,3,1,117,0,5,0,2,0,20,0,16,17,17,17,17,17,17,17,17,17,2,63,3,1,99,0,7,0,4,0,0,5,155,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,2,0,16,3,1,116,0,11,0,8,0,0,1,139,252,251,241,24,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,2,63,3,1,99,0,7,0,4,0,0,5,162,0,3,1,104,0,11,0,8,0,0,0,0,0,0,0,21,0,16,3,1,116,0,11,0,8,0,0,1,139,252,255,77,231,0,16,3,1,120,0,11,0,8,64,0,0,0,0,0,0,0,0,17,1,180,1,1,191,111,198,73,20,169,78,87,218,51,25,198,58,172,28,1,183,8,209,14,63,217,17,124,131,92,143,52,144,15,78,211,2,238,81,197,66,193,59,172,79,56,196,200,19,94,104,228,220,46,42,34,208,26,22,228,148,175,206,141,51,231,174,100,25,16,4,1,48,0,7,4,1,2,4,233,0,0,126,140,194,235,75,151,172,234,136,23,1,100,14,152,204,209,139,193,3,130,181,93,47,77,35,56,97,121,251,151,185,114,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,151,170,133,85,12,8,231,83,83,8,28,221,26,134,85,126,234,104,22,231,103,54,180,118,34,209,31,166,11,144,174,155,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.535104374Z_GetProtocolVersionUpgradeVoteStatusRequest_b48106c894c1a70687d01655ff8f38dd6669a50d8640eebb79d1c86be24e176a.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.535104374Z_GetProtocolVersionUpgradeVoteStatusRequest_b48106c894c1a70687d01655ff8f38dd6669a50d8640eebb79d1c86be24e176a.json deleted file mode 100644 index 65265450a0b..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.535104374Z_GetProtocolVersionUpgradeVoteStatusRequest_b48106c894c1a70687d01655ff8f38dd6669a50d8640eebb79d1c86be24e176a.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_pro_tx_hash":[],"count":100,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,122,3,32,32,61,206,159,132,120,24,255,130,88,128,169,159,65,68,200,248,97,166,108,115,34,32,101,252,57,131,15,0,136,128,136,0,4,0,1,1,0,3,32,116,92,159,20,113,73,103,94,47,194,55,81,85,32,107,47,22,240,65,26,188,84,112,171,23,101,1,233,32,217,211,247,0,4,0,1,1,0,16,3,32,249,3,128,182,199,88,47,32,155,199,150,145,142,156,213,89,1,46,71,34,22,95,107,145,132,103,162,32,104,134,47,187,0,4,0,1,1,0,17,1,107,1,87,179,244,56,7,185,118,146,239,15,211,218,0,164,145,194,126,141,143,128,151,182,242,30,26,24,123,92,97,194,72,70,4,1,1,0,36,2,1,32,116,92,159,20,113,73,103,94,47,194,55,81,85,32,107,47,22,240,65,26,188,84,112,171,23,101,1,233,32,217,211,247,0,229,149,70,100,255,25,235,252,87,188,224,163,221,159,166,171,225,167,241,8,232,224,215,203,245,176,82,242,42,230,98,252,16,1,212,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,2,175,176,44,68,76,56,6,20,24,225,142,11,24,240,97,207,172,108,43,27,213,168,19,76,75,136,52,164,207,181,28,182,16,2,47,142,242,39,38,151,132,161,102,144,3,59,141,22,75,155,233,170,192,212,68,76,152,175,85,13,163,2,172,135,30,206,4,1,120,0,5,2,1,1,1,0,150,65,61,70,201,175,111,254,234,207,149,180,10,78,122,36,240,226,133,34,18,35,237,29,21,18,206,162,50,132,239,75,17,17,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.541183290Z_IdentityRequest_4c846d4b578d59c6520ad92e6c58ad4aecd97420126c4ae060b535732724e5ad.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.541183290Z_IdentityRequest_4c846d4b578d59c6520ad92e6c58ad4aecd97420126c4ae060b535732724e5ad.json deleted file mode 100644 index 61ba228f31b..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.541183290Z_IdentityRequest_4c846d4b578d59c6520ad92e6c58ad4aecd97420126c4ae060b535732724e5ad.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"GetIdentityByPublicKeyHash":{"version":{"v0":{"public_key_hash":[53,219,206,109,80,5,25,167,122,103,225,59,203,129,65,83,198,16,97,168],"prove":true}}}},"response":{"GetIdentityByPublicKeyHash":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,6,0,1,0,166,3,1,74,117,207,63,83,94,129,196,104,15,129,55,162,32,141,188,178,101,47,253,126,113,91,212,41,12,197,197,96,178,204,97,2,207,190,5,53,189,45,239,229,134,184,99,185,204,185,45,13,102,251,43,129,13,115,14,123,162,203,126,47,179,2,97,59,16,4,1,24,0,24,2,1,20,217,72,55,80,12,1,42,21,85,50,101,124,102,223,74,4,10,18,60,227,0,213,95,68,55,191,178,14,185,176,36,109,169,177,120,209,225,36,39,216,56,9,52,243,253,122,172,171,127,103,0,211,115,17,4,1,32,0,36,2,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,0,13,64,223,85,121,82,184,247,105,138,111,225,252,17,37,52,199,109,212,114,11,182,154,158,138,46,128,38,94,56,44,75,16,1,152,212,6,9,60,7,90,253,67,26,190,161,178,33,173,49,219,116,125,214,117,45,147,115,13,155,156,78,63,108,225,152,17,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,4,1,96,0,45,4,1,32,65,63,57,243,204,9,106,71,187,2,94,221,190,127,141,114,137,209,243,50,60,215,90,101,229,15,115,5,44,117,182,217,253,0,252,58,4,253,198,0,0,0,215,47,92,117,235,141,133,44,48,214,12,62,47,215,91,223,175,142,93,105,201,4,90,48,197,143,175,65,178,238,25,177,16,1,3,102,208,132,81,115,249,124,23,227,212,165,35,129,203,40,98,153,173,147,241,172,234,117,80,118,110,48,147,229,217,204,17,17,2,1,24,195,1,1,213,139,207,177,56,73,43,216,231,168,151,75,13,113,88,132,134,16,208,201,103,21,195,181,249,17,73,236,130,153,124,156,3,20,53,219,206,109,80,5,25,167,122,103,225,59,203,129,65,83,198,16,97,168,0,35,0,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,16,1,166,252,57,172,29,29,151,5,155,43,21,72,236,229,137,83,168,59,178,52,83,124,130,87,7,151,20,103,49,52,133,225,17,2,160,101,118,230,251,158,7,50,90,160,208,69,158,85,232,130,209,238,188,106,22,230,134,149,114,94,72,55,20,11,61,19,16,1,200,223,119,2,251,29,190,138,186,198,182,120,164,162,195,42,35,137,150,55,241,180,128,201,211,251,54,4,7,150,249,78,17,1,1,32,213,1,1,9,167,197,156,150,76,38,98,18,45,25,134,65,26,81,2,72,149,153,251,218,203,242,173,241,123,237,134,82,6,190,146,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,9,2,1,1,2,1,3,0,0,0,171,118,116,140,89,137,208,170,37,136,27,102,222,157,117,207,45,148,61,93,130,167,132,211,240,170,230,21,29,108,130,62,16,1,241,250,101,61,30,82,179,252,126,130,148,173,29,96,30,67,18,189,43,72,252,116,9,131,224,85,218,95,15,54,16,29,17,2,146,193,239,158,94,16,174,90,0,59,138,176,91,102,207,210,103,170,233,107,147,127,32,96,164,144,172,13,95,207,189,178,16,1,40,2,136,3,190,247,219,224,31,248,84,34,220,218,23,168,225,228,134,141,144,132,203,66,28,176,28,148,183,88,245,1,17,1,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,127,3,1,0,0,11,0,8,0,0,0,0,0,0,0,0,0,4,1,1,0,5,2,1,1,1,0,187,26,123,178,92,236,140,47,217,118,80,42,43,3,193,68,145,37,2,103,11,198,208,127,224,171,198,45,214,95,25,26,16,2,215,214,150,50,43,118,190,187,1,88,134,141,135,77,213,209,41,110,212,148,5,246,114,94,88,218,204,50,211,88,61,48,16,1,70,25,123,162,209,216,154,230,95,14,56,180,32,113,102,210,182,213,32,20,204,112,76,86,112,130,191,29,189,101,249,223,17,2,1,1,101,3,1,0,0,45,0,42,0,0,0,0,0,0,0,33,2,96,85,184,126,82,70,165,44,218,228,249,30,215,58,128,247,39,29,20,204,189,174,59,90,252,220,150,204,253,32,73,64,0,0,3,1,1,0,45,0,42,0,1,0,2,0,0,0,33,3,7,21,241,88,44,241,135,226,119,224,56,235,17,233,143,14,28,189,253,211,35,40,147,25,128,209,34,253,208,94,150,219,0,0,16,2,1,96,207,1,1,64,73,194,113,147,86,152,163,39,150,106,40,80,207,123,140,201,1,246,45,227,178,215,197,145,40,24,178,120,212,204,100,4,32,48,18,193,155,152,236,0,51,173,219,54,205,100,183,245,16,103,15,42,53,26,67,4,181,246,153,65,68,40,110,253,172,0,3,3,0,0,40,216,51,144,146,203,150,14,133,148,245,43,195,81,47,10,14,155,208,214,193,1,83,251,228,85,71,23,134,145,122,217,16,1,3,207,237,208,175,160,108,250,127,37,214,46,113,97,201,53,9,166,164,192,39,188,142,215,119,204,230,134,77,40,94,174,17,2,137,55,32,169,123,196,47,111,55,237,142,237,212,151,35,145,129,149,32,86,123,54,68,188,209,146,213,120,53,25,205,45,16,1,180,58,29,170,183,13,81,20,135,106,232,131,28,200,44,132,42,156,91,80,30,203,234,113,102,241,237,57,22,156,161,36,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.856697924Z_GetProtocolVersionUpgradeVoteStatusRequest_44e38c7d942ddc931c62af824bd8b82332900ef1b64ea14bca39c294407dfce1.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.856697924Z_GetProtocolVersionUpgradeVoteStatusRequest_44e38c7d942ddc931c62af824bd8b82332900ef1b64ea14bca39c294407dfce1.json deleted file mode 100644 index 1240e0353b4..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.856697924Z_GetProtocolVersionUpgradeVoteStatusRequest_44e38c7d942ddc931c62af824bd8b82332900ef1b64ea14bca39c294407dfce1.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_pro_tx_hash":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"count":100,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,122,3,32,32,61,206,159,132,120,24,255,130,88,128,169,159,65,68,200,248,97,166,108,115,34,32,101,252,57,131,15,0,136,128,136,0,4,0,1,1,0,3,32,116,92,159,20,113,73,103,94,47,194,55,81,85,32,107,47,22,240,65,26,188,84,112,171,23,101,1,233,32,217,211,247,0,4,0,1,1,0,16,3,32,249,3,128,182,199,88,47,32,155,199,150,145,142,156,213,89,1,46,71,34,22,95,107,145,132,103,162,32,104,134,47,187,0,4,0,1,1,0,17,1,107,1,87,179,244,56,7,185,118,146,239,15,211,218,0,164,145,194,126,141,143,128,151,182,242,30,26,24,123,92,97,194,72,70,4,1,1,0,36,2,1,32,116,92,159,20,113,73,103,94,47,194,55,81,85,32,107,47,22,240,65,26,188,84,112,171,23,101,1,233,32,217,211,247,0,229,149,70,100,255,25,235,252,87,188,224,163,221,159,166,171,225,167,241,8,232,224,215,203,245,176,82,242,42,230,98,252,16,1,212,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,2,175,176,44,68,76,56,6,20,24,225,142,11,24,240,97,207,172,108,43,27,213,168,19,76,75,136,52,164,207,181,28,182,16,2,47,142,242,39,38,151,132,161,102,144,3,59,141,22,75,155,233,170,192,212,68,76,152,175,85,13,163,2,172,135,30,206,4,1,120,0,5,2,1,1,1,0,150,65,61,70,201,175,111,254,234,207,149,180,10,78,122,36,240,226,133,34,18,35,237,29,21,18,206,162,50,132,239,75,17,17,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.857223575Z_GetProtocolVersionUpgradeVoteStatusRequest_cba09aff3f31ba1e6ec0092c331cd7c8b0ccf4a3b7755f5e0c013bfcc6fdd875.json b/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.857223575Z_GetProtocolVersionUpgradeVoteStatusRequest_cba09aff3f31ba1e6ec0092c331cd7c8b0ccf4a3b7755f5e0c013bfcc6fdd875.json deleted file mode 100644 index a3ca4d421cc..00000000000 --- a/packages/rs-sdk/tests/vectors/msg_2023-11-23T17:56:30.857223575Z_GetProtocolVersionUpgradeVoteStatusRequest_cba09aff3f31ba1e6ec0092c331cd7c8b0ccf4a3b7755f5e0c013bfcc6fdd875.json +++ /dev/null @@ -1 +0,0 @@ -{"request":{"version":{"v0":{"start_pro_tx_hash":[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],"count":2,"prove":true}}},"response":{"version":{"v0":{"metadata":{"height":"496","core_chain_locked_height":1626,"epoch":20,"time_ms":"1700762179839","protocol_version":1,"chain_id":"dashmate_local_36"},"result":{"proof":{"grovedb_proof":[1,2,134,1,1,161,219,22,0,66,99,196,6,243,54,207,249,53,252,200,187,124,207,150,6,22,152,19,251,93,137,154,53,69,178,98,29,2,56,191,208,4,142,126,182,39,196,192,118,7,244,184,110,57,78,171,160,9,112,207,130,95,189,244,144,144,80,35,71,138,16,5,32,249,3,128,182,199,88,47,32,155,199,150,145,142,156,213,89,1,46,71,34,22,95,107,145,132,103,162,32,104,134,47,187,134,208,129,143,44,58,251,182,33,149,93,185,128,19,188,203,221,6,231,146,203,222,239,97,167,187,155,105,222,240,200,215,17,1,107,1,87,179,244,56,7,185,118,146,239,15,211,218,0,164,145,194,126,141,143,128,151,182,242,30,26,24,123,92,97,194,72,70,4,1,1,0,36,2,1,32,116,92,159,20,113,73,103,94,47,194,55,81,85,32,107,47,22,240,65,26,188,84,112,171,23,101,1,233,32,217,211,247,0,229,149,70,100,255,25,235,252,87,188,224,163,221,159,166,171,225,167,241,8,232,224,215,203,245,176,82,242,42,230,98,252,16,1,212,1,1,62,210,128,237,157,173,255,118,46,120,226,35,148,9,65,38,159,144,75,61,235,31,132,201,170,187,200,81,86,89,44,191,2,204,254,253,193,45,87,201,63,108,140,98,61,225,223,229,34,208,158,221,141,103,228,168,52,16,123,83,68,64,77,155,5,16,1,195,54,53,19,110,80,46,154,197,36,75,21,162,10,117,126,7,89,206,10,144,130,60,211,127,137,63,106,73,85,109,38,2,175,176,44,68,76,56,6,20,24,225,142,11,24,240,97,207,172,108,43,27,213,168,19,76,75,136,52,164,207,181,28,182,16,2,47,142,242,39,38,151,132,161,102,144,3,59,141,22,75,155,233,170,192,212,68,76,152,175,85,13,163,2,172,135,30,206,4,1,120,0,5,2,1,1,1,0,150,65,61,70,201,175,111,254,234,207,149,180,10,78,122,36,240,226,133,34,18,35,237,29,21,18,206,162,50,132,239,75,17,17,17],"quorum_hash":[34,153,131,64,66,147,240,32,92,27,189,141,240,96,197,152,58,71,115,107,141,84,31,116,141,45,108,40,72,130,129,16],"signature":[174,87,124,110,58,18,45,93,176,103,34,219,129,77,125,251,0,53,179,205,179,163,119,132,75,182,206,115,169,66,222,75,198,129,190,101,113,107,51,62,162,87,240,206,131,7,138,231,23,70,191,154,140,213,120,181,9,103,29,43,59,23,216,243,250,247,119,189,35,250,91,188,166,212,93,12,141,145,56,165,17,132,55,145,100,16,15,244,67,185,168,147,200,242,10,127],"round":0,"block_id_hash":[243,30,197,193,10,25,24,84,159,94,166,75,60,223,157,239,84,145,165,182,253,74,253,86,248,192,23,123,178,91,13,143],"quorum_type":106}}}}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/quorum_pubkey-106-229983404293f0205c1bbd8df060c5983a47736b8d541f748d2d6c2848828110.json b/packages/rs-sdk/tests/vectors/quorum_pubkey-106-229983404293f0205c1bbd8df060c5983a47736b8d541f748d2d6c2848828110.json deleted file mode 100644 index 8b5e6bc01ab..00000000000 --- a/packages/rs-sdk/tests/vectors/quorum_pubkey-106-229983404293f0205c1bbd8df060c5983a47736b8d541f748d2d6c2848828110.json +++ /dev/null @@ -1 +0,0 @@ -[171,13,238,72,178,194,244,145,244,25,53,212,14,213,36,140,137,45,55,192,173,115,171,41,56,246,189,13,12,154,233,99,73,223,71,159,152,175,221,219,229,246,228,207,100,188,7,189] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetContestedResourceVotersForIdentityRequest_365e8cc19afcc569d90d85a2a371ad49d3ae7bc38d217d85b1570274493c4d7e.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetContestedResourceVotersForIdentityRequest_365e8cc19afcc569d90d85a2a371ad49d3ae7bc38d217d85b1570274493c4d7e.json new file mode 100644 index 00000000000..7a88bd92e08 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetContestedResourceVotersForIdentityRequest_365e8cc19afcc569d90d85a2a371ad49d3ae7bc38d217d85b1570274493c4d7e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/.gitkeep b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..8598b1cbcc5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"11111111111111111111111111111111","schemaDefs":null,"documentSchemas":{"domain":{"documentsMutable":false,"canBeDeleted":true,"transferable":1,"tradeMode":1,"type":"object","indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01-]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"}},{"name":"identityId","nullSearchable":false,"properties":[{"records.identity":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"identity":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identifier name record that refers to an Identity"}},"minProperties":1,"position":5,"additionalProperties":false},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["$createdAt","$updatedAt","$transferredAt","label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"transient":["preorderSalt"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"documentsMutable":false,"canBeDeleted":true,"type":"object","indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json new file mode 100644 index 00000000000..b689eb30423 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_history_read/.gitkeep b/packages/rs-sdk/tests/vectors/test_data_contract_history_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_history_read/msg_GetDataContractHistoryRequest_2bd2bfc3193745cf05fb33fd3e56d1c377e5a79c8bbfad2b8607feeb2743c37c.json b/packages/rs-sdk/tests/vectors/test_data_contract_history_read/msg_GetDataContractHistoryRequest_2bd2bfc3193745cf05fb33fd3e56d1c377e5a79c8bbfad2b8607feeb2743c37c.json new file mode 100644 index 00000000000..a3e90897235 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_data_contract_history_read/msg_GetDataContractHistoryRequest_2bd2bfc3193745cf05fb33fd3e56d1c377e5a79c8bbfad2b8607feeb2743c37c.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_history_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_data_contract_history_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contract_history_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/.gitkeep b/packages/rs-sdk/tests/vectors/test_data_contract_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..808b4f01189 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json new file mode 100644 index 00000000000..5bd4cd1d789 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/.gitkeep b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json new file mode 100644 index 00000000000..d25fa5b1a5e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/.gitkeep b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json new file mode 100644 index 00000000000..66d946dbd8b Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/.gitkeep b/packages/rs-sdk/tests/vectors/test_epoch_fetch/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetEpochsInfoRequest_00f51345e161bde17d0b008310d7acebec137640ed9cf550876fa1ec438bbcd0.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetEpochsInfoRequest_00f51345e161bde17d0b008310d7acebec137640ed9cf550876fa1ec438bbcd0.json new file mode 100644 index 00000000000..bb2962a8d17 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetEpochsInfoRequest_00f51345e161bde17d0b008310d7acebec137640ed9cf550876fa1ec438bbcd0.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json new file mode 100644 index 00000000000..5ba64857789 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/.gitkeep b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json new file mode 100644 index 00000000000..9a75187088b Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json new file mode 100644 index 00000000000..5ba64857789 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/.gitkeep b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetEpochsInfoRequest_cdea72fd4e08834ef8a3e6a0730fbcae54b0dd1b499fbc91c2c29685e132a339.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetEpochsInfoRequest_cdea72fd4e08834ef8a3e6a0730fbcae54b0dd1b499fbc91c2c29685e132a339.json new file mode 100644 index 00000000000..7e140b09a55 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetEpochsInfoRequest_cdea72fd4e08834ef8a3e6a0730fbcae54b0dd1b499fbc91c2c29685e132a339.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json new file mode 100644 index 00000000000..5ba64857789 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/.gitkeep b/packages/rs-sdk/tests/vectors/test_epoch_list/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json new file mode 100644 index 00000000000..476c2a5fd64 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json new file mode 100644 index 00000000000..5ba64857789 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/.gitkeep b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json new file mode 100644 index 00000000000..f61518a9d44 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json new file mode 100644 index 00000000000..5ba64857789 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetIdentityRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_read/.gitkeep b/packages/rs-sdk/tests/vectors/test_identity_balance_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_GetIdentityBalanceRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json b/packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_GetIdentityBalanceRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json new file mode 100644 index 00000000000..d8dff0972b7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_GetIdentityBalanceRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/.gitkeep b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_GetIdentityBalanceAndRevisionRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_GetIdentityBalanceAndRevisionRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json new file mode 100644 index 00000000000..3a8d1cbcc09 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_GetIdentityBalanceAndRevisionRequest_24b7371202615ecd290e0fe7496676f04dc30c79eec5a5df1ab5b8d8671ac38e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/.gitkeep b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_GetIdentityContractNonceRequest_815e2b4de88fb56ce7ec833ffe8901b95a32865deb2645934954725fbd1cca03.json b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_GetIdentityContractNonceRequest_815e2b4de88fb56ce7ec833ffe8901b95a32865deb2645934954725fbd1cca03.json new file mode 100644 index 00000000000..57897bf779e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_GetIdentityContractNonceRequest_815e2b4de88fb56ce7ec833ffe8901b95a32865deb2645934954725fbd1cca03.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/.gitkeep b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_GetIdentityKeysRequest_c9aa65558b4f8ba10bd7509498105dac7fab00a65264648889a477f081e30ced.json b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_GetIdentityKeysRequest_c9aa65558b4f8ba10bd7509498105dac7fab00a65264648889a477f081e30ced.json new file mode 100644 index 00000000000..6cdcab983da Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_GetIdentityKeysRequest_c9aa65558b4f8ba10bd7509498105dac7fab00a65264648889a477f081e30ced.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_read/.gitkeep b/packages/rs-sdk/tests/vectors/test_identity_read/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_identity_read/msg_IdentityRequest_da9cbb7a9f245221fe2a5d7fe5dd40a692960262df24a300d226046c57048de7.json b/packages/rs-sdk/tests/vectors/test_identity_read/msg_IdentityRequest_da9cbb7a9f245221fe2a5d7fe5dd40a692960262df24a300d226046c57048de7.json new file mode 100644 index 00000000000..973d06ba4c7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_identity_read/msg_IdentityRequest_da9cbb7a9f245221fe2a5d7fe5dd40a692960262df24a300d226046c57048de7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/.gitkeep b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_da9cbb7a9f245221fe2a5d7fe5dd40a692960262df24a300d226046c57048de7.json b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_da9cbb7a9f245221fe2a5d7fe5dd40a692960262df24a300d226046c57048de7.json new file mode 100644 index 00000000000..973d06ba4c7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_da9cbb7a9f245221fe2a5d7fe5dd40a692960262df24a300d226046c57048de7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_ec8288b622e659eee0ea5c67d54eaa7b41821696e9131d8bec0e3b4c9cbb6ed4.json b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_ec8288b622e659eee0ea5c67d54eaa7b41821696e9131d8bec0e3b4c9cbb6ed4.json new file mode 100644 index 00000000000..abe3c317df4 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_ec8288b622e659eee0ea5c67d54eaa7b41821696e9131d8bec0e3b4c9cbb6ed4.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/msg_GetPrefundedSpecializedBalanceRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/msg_GetPrefundedSpecializedBalanceRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json new file mode 100644 index 00000000000..e0f0b7f4df5 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/msg_GetPrefundedSpecializedBalanceRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json differ diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/.gitkeep b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/msg_GetPrefundedSpecializedBalanceRequest_0a917fd6c7841682776fa2800a49fbd646666cf92a70e4954bdeab26f75f3049.json b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/msg_GetPrefundedSpecializedBalanceRequest_0a917fd6c7841682776fa2800a49fbd646666cf92a70e4954bdeab26f75f3049.json new file mode 100644 index 00000000000..48fd17ef44c Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/msg_GetPrefundedSpecializedBalanceRequest_0a917fd6c7841682776fa2800a49fbd646666cf92a70e4954bdeab26f75f3049.json differ diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json new file mode 100644 index 00000000000..a6610834d71 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json differ diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/.gitkeep b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json new file mode 100644 index 00000000000..ab25ca978df Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_0/.gitkeep b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_0/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_0/msg_GetProtocolVersionUpgradeVoteStatusRequest_bee99cec3d45f1cfa5d6d14692042ea65bb18fc0ba699ce26a6d88b7c7e914c3.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_0/msg_GetProtocolVersionUpgradeVoteStatusRequest_bee99cec3d45f1cfa5d6d14692042ea65bb18fc0ba699ce26a6d88b7c7e914c3.json new file mode 100644 index 00000000000..669437dbb29 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_0/msg_GetProtocolVersionUpgradeVoteStatusRequest_bee99cec3d45f1cfa5d6d14692042ea65bb18fc0ba699ce26a6d88b7c7e914c3.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/.gitkeep b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json new file mode 100644 index 00000000000..5d2c7891797 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/.gitkeep b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json new file mode 100644 index 00000000000..f65662394ee Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/.gitkeep b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json new file mode 100644 index 00000000000..3b399bc398b Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/.gitkeep b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json new file mode 100644 index 00000000000..b1065b770a7 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_wait_timeout/.gitkeep b/packages/rs-sdk/tests/vectors/test_wait_timeout/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_wait_timeout/msg_WaitForStateTransitionResultRequest_e93eaef1608b936cd09c7367b3ec10729e79bf48cc1e4e8daf6bf5940466ec6c.json b/packages/rs-sdk/tests/vectors/test_wait_timeout/msg_WaitForStateTransitionResultRequest_e93eaef1608b936cd09c7367b3ec10729e79bf48cc1e4e8daf6bf5940466ec6c.json new file mode 100644 index 00000000000..85fac8cb656 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_wait_timeout/msg_WaitForStateTransitionResultRequest_e93eaef1608b936cd09c7367b3ec10729e79bf48cc1e4e8daf6bf5940466ec6c.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/.gitkeep b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_0329cf0b8851d09d91160eb04ba78d45ac35df7c4a541f2fd79c4e53af000a92.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_0329cf0b8851d09d91160eb04ba78d45ac35df7c4a541f2fd79c4e53af000a92.json new file mode 100644 index 00000000000..b06a885243e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_0329cf0b8851d09d91160eb04ba78d45ac35df7c4a541f2fd79c4e53af000a92.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_0e309af16c3957b15807f1741084729771183f61b1ba73796ee966df7ce206e8.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_0e309af16c3957b15807f1741084729771183f61b1ba73796ee966df7ce206e8.json new file mode 100644 index 00000000000..ec7ffa5bea1 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_0e309af16c3957b15807f1741084729771183f61b1ba73796ee966df7ce206e8.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_142e6c253c01773656823e7299ccac0d096683e15280eced19ef5ad75e670062.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_142e6c253c01773656823e7299ccac0d096683e15280eced19ef5ad75e670062.json new file mode 100644 index 00000000000..59530fd57d1 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_142e6c253c01773656823e7299ccac0d096683e15280eced19ef5ad75e670062.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_2e98e756bbec29c5a8bb6db95209822a2c4f59abefee6ac70309345adad1c202.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_2e98e756bbec29c5a8bb6db95209822a2c4f59abefee6ac70309345adad1c202.json new file mode 100644 index 00000000000..2efaa4da152 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_2e98e756bbec29c5a8bb6db95209822a2c4f59abefee6ac70309345adad1c202.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_4cb42e1877d46573cade78a050501448ade8c60e56c8d4b739ff8d6808694f33.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_4cb42e1877d46573cade78a050501448ade8c60e56c8d4b739ff8d6808694f33.json new file mode 100644 index 00000000000..475f92631ee Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_4cb42e1877d46573cade78a050501448ade8c60e56c8d4b739ff8d6808694f33.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_61f016345ec587c57ec95cd35ca21e65356ecde06e41dad1c5f4221f2021ff65.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_61f016345ec587c57ec95cd35ca21e65356ecde06e41dad1c5f4221f2021ff65.json new file mode 100644 index 00000000000..319bc61225f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_61f016345ec587c57ec95cd35ca21e65356ecde06e41dad1c5f4221f2021ff65.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_62753b0c8caf599658c8a6becb2a0c949e21b06d4ba0ba04902ed9dd3cf9c180.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_62753b0c8caf599658c8a6becb2a0c949e21b06d4ba0ba04902ed9dd3cf9c180.json new file mode 100644 index 00000000000..4ec9e25724c Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_62753b0c8caf599658c8a6becb2a0c949e21b06d4ba0ba04902ed9dd3cf9c180.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_6324f0ce91119010ab60300a78dc362866cbab6d8388743fdcf5d797910561df.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_6324f0ce91119010ab60300a78dc362866cbab6d8388743fdcf5d797910561df.json new file mode 100644 index 00000000000..aa5a28ec90c Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_6324f0ce91119010ab60300a78dc362866cbab6d8388743fdcf5d797910561df.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_8af1fe2b83fc914ad833914a6f47686a168bd79e8751279ec53efb41381dd431.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_8af1fe2b83fc914ad833914a6f47686a168bd79e8751279ec53efb41381dd431.json new file mode 100644 index 00000000000..fbb1cfb284e Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_8af1fe2b83fc914ad833914a6f47686a168bd79e8751279ec53efb41381dd431.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_9085af05cad5f81e4684b91c4b6edc3a3ee50e58b0617b9da04faad767a7414e.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_9085af05cad5f81e4684b91c4b6edc3a3ee50e58b0617b9da04faad767a7414e.json new file mode 100644 index 00000000000..027fe03684a Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_9085af05cad5f81e4684b91c4b6edc3a3ee50e58b0617b9da04faad767a7414e.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_a2a3107907325a7d7da45018edd1415b05c514461090693b709359fd10719e64.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_a2a3107907325a7d7da45018edd1415b05c514461090693b709359fd10719e64.json new file mode 100644 index 00000000000..13f98326965 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_a2a3107907325a7d7da45018edd1415b05c514461090693b709359fd10719e64.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_c2737f6ccc2ac5cc79e28d4b29fb414d7808274b04acfe789740e18ecf0991c7.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_c2737f6ccc2ac5cc79e28d4b29fb414d7808274b04acfe789740e18ecf0991c7.json new file mode 100644 index 00000000000..6635850ad05 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_c2737f6ccc2ac5cc79e28d4b29fb414d7808274b04acfe789740e18ecf0991c7.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_edb3ea19c943e4ccd318d2742a9ecfc2f026b8a6be6443de638da69f0b4c87b0.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_edb3ea19c943e4ccd318d2742a9ecfc2f026b8a6be6443de638da69f0b4c87b0.json new file mode 100644 index 00000000000..d3dc6481cee Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/msg_GetVotePollsByEndDateRequest_edb3ea19c943e4ccd318d2742a9ecfc2f026b8a6be6443de638da69f0b4c87b0.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_limit/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/.gitkeep b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json new file mode 100644 index 00000000000..a6610834d71 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_ok/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/.gitkeep b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/msg_GetVotePollsByEndDateRequest_4959b488e99ae1bd41af47fdecce942470ee2b9dff806909798d12c40bc6cf8b.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/msg_GetVotePollsByEndDateRequest_4959b488e99ae1bd41af47fdecce942470ee2b9dff806909798d12c40bc6cf8b.json new file mode 100644 index 00000000000..ebae4be65ba Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/msg_GetVotePollsByEndDateRequest_4959b488e99ae1bd41af47fdecce942470ee2b9dff806909798d12c40bc6cf8b.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json new file mode 100644 index 00000000000..a6610834d71 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json differ diff --git a/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json new file mode 100644 index 00000000000..9d31d601d50 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/vote_polls_by_ts_order/quorum_pubkey-106-74bc78bfed100cb1c7da3b1aeeaff1e5767efb0daf93c69cc8294ee246526a09.json @@ -0,0 +1 @@ +8fdaad8ac39e23c5b9e773184f5f54523f4bc7b1ed68a66b43c011ecfe8c6f3c38b5e8bae650b2b4434f4ff9f15e7417 \ No newline at end of file diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index e05c3565eae..9337d46a92a 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "simple-signer" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = { version = "1.0.70" } bincode = { version = "2.0.0-rc.3", features = ["serde"] } -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", branch = "master" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.4" } dpp = { path = "../rs-dpp", features = ["abci"] } +base64 = { version = "0.22.1"} diff --git a/packages/simple-signer/src/signer.rs b/packages/simple-signer/src/signer.rs index 6f35621b651..f8f8f92f3b8 100644 --- a/packages/simple-signer/src/signer.rs +++ b/packages/simple-signer/src/signer.rs @@ -1,4 +1,5 @@ -use anyhow::anyhow; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use dashcore_rpc::dashcore::signer; use dpp::bincode::{Decode, Encode}; use dpp::ed25519_dalek::Signer as BlsSigner; @@ -6,19 +7,41 @@ use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV use dpp::identity::signer::Signer; use dpp::identity::{IdentityPublicKey, KeyType}; use dpp::platform_value::BinaryData; -use dpp::state_transition::errors::{ - InvalidIdentityPublicKeyTypeError, InvalidSignaturePublicKeyError, -}; +use dpp::state_transition::errors::InvalidIdentityPublicKeyTypeError; use dpp::{bls_signatures, ed25519_dalek, ProtocolError}; -use std::collections::HashMap; +use std::collections::BTreeMap; +use std::fmt::{Debug, Formatter}; /// This simple signer is only to be used in tests -#[derive(Default, Clone, Debug, PartialEq, Encode, Decode)] +#[derive(Default, Clone, PartialEq, Encode, Decode)] pub struct SimpleSigner { /// Private keys is a map from the public key to the Private key bytes - pub private_keys: HashMap>, + pub private_keys: BTreeMap>, /// Private keys to be added at the end of a block - pub private_keys_in_creation: HashMap>, + pub private_keys_in_creation: BTreeMap>, +} + +impl Debug for SimpleSigner { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("SimpleSigner") + .field( + "private_keys", + &self + .private_keys + .iter() + .map(|(k, v)| (k, format!("sk: {}", BASE64_STANDARD.encode(v)))) + .collect::>(), + ) + .field( + "private_keys_in_creation", + &self + .private_keys_in_creation + .iter() + .map(|(k, v)| (k, format!("sk: {}", BASE64_STANDARD.encode(v)))) + .collect::>(), + ) + .finish() + } } impl SimpleSigner { @@ -34,8 +57,7 @@ impl SimpleSigner { /// Commit keys in creation pub fn commit_block_keys(&mut self) { - self.private_keys - .extend(self.private_keys_in_creation.drain()) + self.private_keys.append(&mut self.private_keys_in_creation) } } @@ -49,9 +71,10 @@ impl Signer for SimpleSigner { .private_keys .get(identity_public_key) .or_else(|| self.private_keys_in_creation.get(identity_public_key)) - .ok_or(ProtocolError::InvalidSignaturePublicKeyError( - InvalidSignaturePublicKeyError::new(identity_public_key.data().to_vec()), - ))?; + .ok_or(ProtocolError::Generic(format!( + "{:?} not found in {:?}", + identity_public_key, self + )))?; match identity_public_key.key_type() { KeyType::ECDSA_SECP256K1 | KeyType::ECDSA_HASH160 => { let signature = signer::sign(data, private_key)?; @@ -60,16 +83,18 @@ impl Signer for SimpleSigner { KeyType::BLS12_381 => { let pk = bls_signatures::PrivateKey::from_bytes(private_key, false).map_err(|_e| { - ProtocolError::Error(anyhow!("bls private key from bytes isn't correct")) + ProtocolError::Generic( + "bls private key from bytes isn't correct".to_string(), + ) })?; Ok(pk.sign(data).to_bytes().to_vec().into()) } KeyType::EDDSA_25519_HASH160 => { let key: [u8; 32] = private_key.clone().try_into().expect("expected 32 bytes"); let pk = ed25519_dalek::SigningKey::try_from(&key).map_err(|_e| { - ProtocolError::Error(anyhow!( - "eddsa 25519 private key from bytes isn't correct" - )) + ProtocolError::Generic( + "eddsa 25519 private key from bytes isn't correct".to_string(), + ) })?; Ok(pk.sign(data).to_vec().into()) } diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 2390dd7462e..29aef67b897 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,44 +1,49 @@ [package] name = "strategy-tests" -version = "0.25.21" +version = "1.1.0-dev.1" authors = [ - "Samuel Westrich ", - "Ivan Shumkov ", - "Paul DeLucia ", + "Samuel Westrich ", + "Ivan Shumkov ", + "Paul DeLucia ", ] edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] +tracing = "0.1.4" +futures = "0.3" bincode = { version = "2.0.0-rc.3", features = ["serde"] } -drive = { path = "../rs-drive" } +drive = { path = "../rs-drive", default-features = false, features = [ + "verify", +] } rand = "0.8.5" hex = "0.4.3" +serde_json = "1.0" dpp = { path = "../rs-dpp", features = [ - "abci", - "random-documents", - "state-transition-signing", - "random-identities", - "random-public-keys", - "random-document-types", - "fixtures-and-mocks", - "identity-value-conversion", - "data-contract-json-conversion", - "data-contract-cbor-conversion", + "abci", + "bls-signatures", + "client", + "random-documents", + "state-transitions", + "state-transition-signing", + "random-identities", + "random-public-keys", + "random-document-types", + "fixtures-and-mocks", + "identity-value-conversion", + "data-contract-json-conversion", + "data-contract-cbor-conversion", ] } simple-signer = { path = "../simple-signer" } platform-version = { path = "../rs-platform-version" } +platform-serialization = { path = "../rs-platform-serialization" } platform-serialization-derive = { path = "../rs-platform-serialization-derive" } [dev-dependencies] platform-version = { path = "../rs-platform-version", features = [ - "mock-versions", + "mock-versions", ] } -drive = { path = "../rs-drive" } - # For tests of grovedb verify -rocksdb = { version = "0.21.0" } +rocksdb = { version = "0.22.0" } diff --git a/packages/strategy-tests/README.md b/packages/strategy-tests/README.md new file mode 100644 index 00000000000..9d9b40e6fa7 --- /dev/null +++ b/packages/strategy-tests/README.md @@ -0,0 +1,29 @@ + +# Dash Platform Strategy Testing Library + +## Overview +This library offers a robust framework for developers and testers to simulate a wide range of blockchain activities on Dash Platform through comprehensive testing strategies. Utilizing the `Strategy` struct, it facilitates the simulation of various operations including balance transfers, contract interactions, and identity management with detailed control over state transitions on a per-block basis. + +## Key Features +- **State Transition Focused**: Designed to simulate every type of state transition possible on the Dash Platform, providing a comprehensive test environment. +- **Flexible Strategy Design**: Enables the crafting of complex strategies that can include operations like contract registration, document submissions, identity management, and credit transfers across blocks. +- **Dynamic Entity Management**: Allows for the seamless introduction and management of entities such as contracts and identities at any simulation stage without prior setup. +- **Accessible through Dash Platform's UI**: While directly accessible as part of the Dash Platform repository for integration and development, the library can also be conveniently used via the `Strategies` section of the Dash Platform terminal user interface found at `github.com/dashpay/rs-platform-explorer`. + +### Usage +Define your testing strategy within your application by instantiating the `Strategy` struct with the desired configurations and operations. For an interactive experience, use the `Strategies` module within the Dash Platform's terminal user interface: + +1. Navigate to `github.com/dashpay/rs-platform-explorer`, clone the repo, and run it via `cargo run`. +2. Use the interface to define and manage your strategies. +3. Execute and observe the simulation of blockchain activities as per your defined strategy. + +## Example +```rust +let strategy = Strategy { + contracts_with_updates: vec![...], + operations: vec![...], + start_identities: StartIdentities::new(...), + identities_inserts: Frequency::new(...), + signer: Some(SimpleSigner::new(...)), +}; +``` diff --git a/packages/strategy-tests/src/frequency.rs b/packages/strategy-tests/src/frequency.rs index a846a27f316..8b46d8ec7f2 100644 --- a/packages/strategy-tests/src/frequency.rs +++ b/packages/strategy-tests/src/frequency.rs @@ -64,6 +64,10 @@ impl Frequency { } } + pub fn max_event_count(&self) -> u16 { + self.times_per_block_range.end + } + pub fn pick_in_range(&self, rng: &mut impl Rng, range: Range) -> Vec { if !self.is_set() || range.is_empty() { return vec![]; diff --git a/packages/strategy-tests/src/lib.rs b/packages/strategy-tests/src/lib.rs index edb7c9c14d5..126538a64a0 100644 --- a/packages/strategy-tests/src/lib.rs +++ b/packages/strategy-tests/src/lib.rs @@ -1,18 +1,32 @@ +//! This library facilitates the creation and execution of comprehensive testing strategies for Dash Platform, leveraging the `Strategy` struct as its core. +//! It is designed to simulate a wide range of blockchain activities, offering detailed control over the generation of state transitions, contract interactions, and identity management across blocks. +//! +//! Utilizing this library, users can craft scenarios that encompass every conceivable state transition on Dash Platform, with precise timing control on a block-by-block basis. +//! Strategies can be as simple or complex as needed, from initializing contracts and identities at the start of a simulation to conducting intricate operations like document submissions, credit transfers, and more throughout the lifespan of the blockchain. +//! +//! This tool does not require any preliminary setup for the entities involved in the strategies; identities, contracts, and documents can be introduced at any point in the simulation. +//! This flexibility ensures users can test against both new and existing blockchain states, adapting the scenarios as Dash Platform evolves. +//! +//! As of March 2024, the recommended approach to leverage this library's capabilities is through the `Strategies` module within Dash Platform's terminal user interface, located at `dashpay/rs-platform-explorer`. +//! This interface provides an accessible and streamlined way to define, manage, and execute your testing strategies against Dash Platform. + use crate::frequency::Frequency; use crate::operations::FinalizeBlockOperation::IdentityAddKeys; use crate::operations::{ - DocumentAction, DocumentOp, FinalizeBlockOperation, IdentityUpdateOp, Operation, - OperationInSerializationFormat, OperationType, + DocumentAction, DocumentOp, FinalizeBlockOperation, IdentityUpdateOp, Operation, OperationType, }; use dpp::block::block_info::BlockInfo; -use dpp::data_contract::created_data_contract::{ - CreatedDataContract, CreatedDataContractInSerializationFormat, -}; +use dpp::dashcore::PrivateKey; +use dpp::data_contract::created_data_contract::CreatedDataContract; use dpp::data_contract::document_type::random_document::CreateRandomDocument; -use dpp::data_contract::DataContract; - -use dpp::document::DocumentV0Getters; -use dpp::identity::{Identity, KeyType, Purpose, SecurityLevel}; +use dpp::data_contract::document_type::v0::DocumentTypeV0; +use dpp::data_contract::{DataContract, DataContractFactory}; + +use dpp::document::{Document, DocumentV0Getters}; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::state_transition::asset_lock_proof::AssetLockProof; +use dpp::identity::{Identity, KeyID, KeyType, PartialIdentity, Purpose, SecurityLevel}; +use dpp::platform_value::string_encoding::Encoding; use dpp::serialization::{ PlatformDeserializableWithPotentialValidationFromVersionedStructure, PlatformSerializableWithPlatformVersion, @@ -21,21 +35,22 @@ use dpp::state_transition::data_contract_create_transition::DataContractCreateTr use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; use dpp::state_transition::StateTransition; use dpp::version::PlatformVersion; -use drive::drive::flags::StorageFlags::SingleEpoch; use drive::drive::identity::key::fetch::{IdentityKeysRequest, KeyRequestType}; -use drive::drive::Drive; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::state_transition::data_contract_update_transition::methods::DataContractUpdateTransitionMethodsV0; -use drive::query::DriveQuery; -use rand::prelude::{IteratorRandom, StdRng}; +use operations::{DataContractUpdateAction, DataContractUpdateOp}; +use platform_version::TryFromPlatformVersioned; +use rand::prelude::StdRng; +use rand::seq::{IteratorRandom, SliceRandom}; use rand::Rng; -use std::borrow::Cow; -use std::collections::{BTreeMap, HashSet}; +use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use bincode::{Decode, Encode}; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::data_contract::document_type::DocumentType; use dpp::identity::accessors::IdentityGettersV0; -use dpp::platform_value::BinaryData; +use dpp::platform_value::{BinaryData, Bytes32, Value}; use dpp::ProtocolError; use dpp::ProtocolError::{PlatformDeserializationError, PlatformSerializationError}; use dpp::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; @@ -43,78 +58,131 @@ use dpp::state_transition::documents_batch_transition::document_create_transitio use dpp::state_transition::documents_batch_transition::document_transition::document_delete_transition::DocumentDeleteTransitionV0; use dpp::state_transition::documents_batch_transition::document_transition::document_replace_transition::DocumentReplaceTransitionV0; use dpp::state_transition::documents_batch_transition::{DocumentsBatchTransition, DocumentsBatchTransitionV0}; -use dpp::state_transition::documents_batch_transition::document_transition::{DocumentDeleteTransition, DocumentReplaceTransition}; -use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::{DocumentDeleteTransition, DocumentReplaceTransition, DocumentTransferTransition}; use dpp::state_transition::data_contract_create_transition::methods::v0::DataContractCreateTransitionMethodsV0; -use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use dpp::state_transition::documents_batch_transition::document_transition::document_transfer_transition::DocumentTransferTransitionV0; use simple_signer::signer::SimpleSigner; pub mod frequency; pub mod operations; pub mod transitions; +pub type KeyMaps = BTreeMap>>; -/// Represents a comprehensive strategy used for simulations or testing in a blockchain context. +/// Defines a detailed strategy for conducting simulations or tests on Dash Platform. +/// +/// This struct serves as the core framework for designing and executing comprehensive simulations or automated testing scenarios on Dash Platform. It encompasses a wide array of operations, state transitions, and data contract manipulations, enabling users to craft intricate strategies that mimic real-world blockchain dynamics or test specific functionalities. /// -/// The `Strategy` struct encapsulates various operations, state transitions, and data contracts to provide a structured plan or set of procedures for specific purposes such as simulations, automated tests, or other blockchain-related workflows. +/// The strategy allows for the specification of initial conditions, such as contracts to be created and identities to be registered, as well as dynamic actions that unfold over the simulation's lifespan, including contract updates and identity transactions. This versatile structure supports a broad spectrum of blockchain-related activities, from simple transfer operations to complex contract lifecycle management. /// /// # Fields -/// - `contracts_with_updates`: A list of tuples containing: -/// 1. `CreatedDataContract`: A data contract that was created. -/// 2. `Option>`: An optional mapping where the key is the block height (or other sequential integer identifier) and the value is a data contract that corresponds to an update. If `None`, it signifies that there are no updates. +/// - `start_identities`: Specifies identities to be established at the simulation's outset, including their initial attributes and balances. This setup allows for immediate participation of these identities in the blockchain's simulated activities. /// -/// - `operations`: A list of `Operation`s which define individual tasks or actions that are part of the strategy. Operations could encompass a range of blockchain-related actions like transfers, state changes, contract creations, etc. +/// - `start_contracts`: Maps each created data contract to potential updates, enabling the simulation of contract evolution. Each tuple consists of a `CreatedDataContract` and an optional mapping of block heights to subsequent contract versions, facilitating time-sensitive contract transformations. /// -/// - `start_identities`: A list of tuples representing the starting state of identities. Each tuple contains: -/// 1. `Identity`: The initial identity state. -/// 2. `StateTransition`: The state transition that led to the current state of the identity. +/// - `operations`: Enumerates discrete operations to be executed within the strategy. These operations represent individual actions or sequences of actions, such as document manipulations, identity updates, or contract interactions, each contributing to the overarching simulation narrative. /// -/// - `identities_inserts`: Defines the frequency distribution of identity inserts. `Frequency` might encapsulate statistical data like mean, median, variance, etc., for understanding or predicting the frequency of identity insertions. +/// - `identity_inserts`: Controls the stochastic introduction of new identities into the simulation, based on a defined frequency distribution. This field allows the strategy to dynamically expand the set of participants, reflecting organic growth or specific testing requirements. /// -/// - `signer`: An optional instance of `SimpleSigner`. The `SimpleSigner` is responsible for generating and managing cryptographic signatures, and might be used to authenticate or validate various operations or state transitions. +/// - `identity_contract_nonce_gaps`: Optionally defines intervals at which nonce values for identities and contracts may be artificially incremented, introducing realistic entropy or testing specific edge cases. /// -/// # Usage +/// - `signer`: Provides an optional `SimpleSigner` instance responsible for generating cryptographic signatures for various transactions within the strategy. While optional, a signer is critical for authenticating state transitions and operations that require verification. +/// +/// # Usage Example /// ```ignore /// let strategy = Strategy { -/// contracts_with_updates: vec![...], -/// operations: vec![...], -/// start_identities: vec![...], -/// identities_inserts: Frequency::new(...), -/// signer: Some(SimpleSigner::new(...)), +/// contracts_with_updates: vec![...], // Initial contracts and their planned updates +/// operations: vec![...], // Defined operations to simulate blockchain interactions +/// start_identities: StartIdentities::new(...), // Identities to initialize +/// identities_inserts: Frequency::new(...), // Frequency of new identity introduction +/// identity_contract_nonce_gaps: Some(Frequency::new(...)), // Optional nonce gaps +/// signer: Some(SimpleSigner::new(...)), // Optional signer for authenticating transactions /// }; /// ``` /// -/// # Note -/// Ensure that when using or updating the `Strategy`, all associated operations, identities, and contracts are coherent with the intended workflow or simulation. Inconsistencies might lead to unexpected behaviors or simulation failures. -#[derive(Clone, Debug, PartialEq)] +/// # Implementation Note +/// It's imperative to maintain coherence among the specified operations, identities, and contracts within the `Strategy` to ensure the simulated scenarios accurately reflect intended behaviors or test conditions. Discrepancies or inconsistencies may result in unexpected outcomes or hinder the simulation's effectiveness in achieving its objectives. +#[derive(Clone, Debug, PartialEq, Default)] pub struct Strategy { - pub contracts_with_updates: Vec<( + pub start_identities: StartIdentities, + pub start_contracts: Vec<( CreatedDataContract, Option>, )>, pub operations: Vec, - pub start_identities: Vec<(Identity, StateTransition)>, - pub identities_inserts: Frequency, + pub identity_inserts: IdentityInsertInfo, + pub identity_contract_nonce_gaps: Option, pub signer: Option, } -impl Default for Strategy { +impl Strategy { + pub fn max_document_operation_count_without_inserts(&self) -> u16 { + self.operations + .iter() + .filter(|operation| match &operation.op_type { + OperationType::Document(document_op) => match &document_op.action { + DocumentAction::DocumentActionInsertRandom(_, _) => false, + DocumentAction::DocumentActionInsertSpecific(_, _, _, _) => false, + _ => true, + }, + _ => false, + }) + .count() as u16 + } +} + +/// Config stuff for a Strategy +#[derive(Clone, Debug, PartialEq)] +pub struct StrategyConfig { + pub start_block_height: u64, + pub number_of_blocks: u64, +} + +/// Identities to register on the first block of the strategy +#[derive(Clone, Debug, PartialEq, Default, Encode, Decode)] +pub struct StartIdentities { + pub number_of_identities: u16, + pub keys_per_identity: u8, + pub starting_balances: u64, // starting balance in duffs + pub extra_keys: KeyMaps, + pub hard_coded: Vec<(Identity, StateTransition)>, +} + +/// Identities to register on the first block of the strategy +#[derive(Clone, Debug, PartialEq, Encode, Decode)] +pub struct IdentityInsertInfo { + pub frequency: Frequency, + pub start_keys: u8, + pub extra_keys: KeyMaps, +} + +impl Default for IdentityInsertInfo { fn default() -> Self { - Strategy { - contracts_with_updates: vec![], - operations: vec![], - start_identities: vec![], - identities_inserts: Frequency::default(), - signer: None, + Self { + frequency: Default::default(), + start_keys: 5, + extra_keys: Default::default(), } } } +#[derive(Clone, Debug, PartialEq)] +pub struct RandomDocumentQuery<'a> { + pub data_contract: &'a DataContract, + pub document_type: &'a DocumentType, +} + +#[derive(Clone, Debug, PartialEq)] +pub enum LocalDocumentQuery<'a> { + RandomDocumentQuery(RandomDocumentQuery<'a>), +} + #[derive(Clone, Debug, Encode, Decode)] struct StrategyInSerializationFormat { pub contracts_with_updates: Vec<(Vec, Option>>)>, pub operations: Vec>, - pub start_identities: Vec<(Identity, StateTransition)>, - pub identities_inserts: Frequency, + pub start_identities: StartIdentities, + pub identities_inserts: IdentityInsertInfo, + pub identity_contract_nonce_gaps: Option, pub signer: Option, } @@ -134,10 +202,11 @@ impl PlatformSerializableWithPlatformVersion for Strategy { platform_version: &PlatformVersion, ) -> Result, ProtocolError> { let Strategy { - contracts_with_updates, + start_contracts: contracts_with_updates, operations, start_identities, - identities_inserts, + identity_inserts: identities_inserts, + identity_contract_nonce_gaps, signer, } = self; @@ -176,6 +245,7 @@ impl PlatformSerializableWithPlatformVersion for Strategy { operations: operations_in_serialization_format, start_identities, identities_inserts, + identity_contract_nonce_gaps, signer, }; @@ -190,7 +260,7 @@ impl PlatformSerializableWithPlatformVersion for Strategy { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Strategy { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -211,6 +281,7 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Str operations, start_identities, identities_inserts, + identity_contract_nonce_gaps, signer, } = strategy; @@ -219,7 +290,7 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Str .map(|(serialized_contract, maybe_updates)| { let contract = CreatedDataContract::versioned_deserialize( serialized_contract.as_slice(), - validate, + full_validation, platform_version, )?; let maybe_updates = maybe_updates @@ -229,7 +300,7 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Str .map(|(key, serialized_contract_update)| { let update = CreatedDataContract::versioned_deserialize( serialized_contract_update.as_slice(), - validate, + full_validation, platform_version, )?; Ok((key, update)) @@ -250,321 +321,311 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Str let operations = operations .into_iter() .map(|operation| { - Operation::versioned_deserialize(operation.as_slice(), validate, platform_version) + Operation::versioned_deserialize( + operation.as_slice(), + full_validation, + platform_version, + ) }) .collect::, ProtocolError>>()?; Ok(Strategy { - contracts_with_updates, + start_contracts: contracts_with_updates, operations, start_identities, - identities_inserts, + identity_inserts: identities_inserts, + identity_contract_nonce_gaps, signer, }) } } -impl Strategy { - /// Adds strategy contracts from the current operations into a specified Drive. - /// - /// This method iterates over the operations present in the current strategy. For each operation - /// of type `Document`, it serializes the associated contract and applies it to the provided drive. - /// - /// # Parameters - /// - `drive`: The Drive where contracts should be added. - /// - `platform_version`: The current Platform version used for serializing the contract. - /// - /// # Panics - /// This method may panic in the following situations: - /// - If serialization of a contract fails. - /// - If applying a contract with serialization to the drive fails. - /// - /// # Examples - /// ```ignore - /// // Assuming `strategy` is an instance of `Strategy` - /// // and `drive` and `platform_version` are appropriately initialized. - /// strategy.add_strategy_contracts_into_drive(&drive, &platform_version); - /// ``` - // TODO: This belongs to `DocumentOp` - pub fn add_strategy_contracts_into_drive( - &mut self, - drive: &Drive, - platform_version: &PlatformVersion, - ) { - for op in &self.operations { - if let OperationType::Document(doc_op) = &op.op_type { - let serialize = doc_op - .contract - .serialize_to_bytes_with_platform_version(platform_version) - .expect("expected to serialize"); - drive - .apply_contract_with_serialization( - &doc_op.contract, - serialize, - BlockInfo::default(), - true, - Some(Cow::Owned(SingleEpoch(0))), - None, - platform_version, - ) - .expect("expected to be able to add contract"); +pub type MempoolDocumentCounter<'c> = BTreeMap<(Identifier, Identifier), u64>; + +fn choose_capable_identities<'i>( + identities: &'i [Identity], + contract: &DataContract, + mempool_document_counter: &MempoolDocumentCounter, + count: usize, + rng: &mut StdRng, +) -> Vec<&'i Identity> { + // Filter out those that already have 24 documents in the mempool for this contract + let mut all_capable_identities: Vec<&'i Identity> = identities + .iter() + .filter(|identity| { + mempool_document_counter + .get(&(identity.id(), contract.id())) + .unwrap_or(&0) + < &24u64 + }) + .collect(); + + // If we need more documents than we have eligible identities, we will need to use some identities more than once + if all_capable_identities.len() < count { + let mut additional_identities_count = count - all_capable_identities.len(); + + let mut additional_identities = Vec::with_capacity(additional_identities_count); + let mut index = 0; + while additional_identities_count > 0 && index < all_capable_identities.len() { + // Iterate through the identities only one time, using as many documents as each identity can submit + // We should see if this often causes identities to max out their mempool count, which could potentially + // lead to issues, even though this function should really only be covering an edge case + let identity = all_capable_identities[index]; + + // How many documents are in the mempool for this (identity, contract) plus the one that we are already planning to use + let mempool_documents_count = mempool_document_counter + .get(&(identity.id(), contract.id())) + .unwrap_or(&0) + + 1; + + let identity_capacity = 24 - mempool_documents_count; + + if identity_capacity > 0 { + for _ in 0..identity_capacity { + additional_identities.push(identity); + additional_identities_count -= 1; + if additional_identities_count == 0 { + break; + } + } } - } - } - /// Generates state transitions for identities based on the block information provided. - /// - /// This method creates a list of state transitions associated with identities. If the block height - /// is `1` and there are starting identities present in the strategy, these identities are directly - /// added to the state transitions list. - /// - /// Additionally, based on a frequency criterion, this method can generate and append more state transitions - /// related to the creation of identities. - /// - /// # Parameters - /// - `block_info`: Information about the current block, used to decide on which state transitions should be generated. - /// - `signer`: A mutable reference to a signer instance used during the creation of identities state transitions. - /// - `rng`: A mutable reference to a random number generator. - /// - `platform_version`: The current platform version. - /// - /// # Returns - /// A vector of tuples containing `Identity` and its associated `StateTransition`. - /// - /// # Examples - /// ```ignore - /// // Assuming `strategy` is an instance of `Strategy`, - /// // and `block_info`, `signer`, `rng`, and `platform_version` are appropriately initialized. - /// let state_transitions = strategy.identity_state_transitions_for_block(&block_info, &mut signer, &mut rng, &platform_version); - /// ``` - pub fn identity_state_transitions_for_block( - &self, - block_info: &BlockInfo, - signer: &mut SimpleSigner, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Vec<(Identity, StateTransition)> { - let mut state_transitions = vec![]; - if block_info.height == 1 && !self.start_identities.is_empty() { - state_transitions.append(&mut self.start_identities.clone()); + index += 1; } - let frequency = &self.identities_inserts; - if frequency.check_hit(rng) { - let count = frequency.events(rng); - state_transitions.append( - &mut crate::transitions::create_identities_state_transitions( - count, - 5, - signer, - rng, - platform_version, - ), - ) - } - state_transitions + + all_capable_identities.extend(additional_identities); + all_capable_identities + } else { + all_capable_identities + .iter() + .choose_multiple(rng, count) + .into_iter() + .cloned() + .collect() } +} - /// Generates state transitions for data contracts based on the current set of identities. +impl Strategy { + /// Generates comprehensive state transitions for a given block, including handling new identities and contracts. /// - /// This method creates state transitions for data contracts by iterating over the contracts with updates - /// present in the strategy. For each contract: - /// 1. An identity is randomly selected from the provided list of current identities. - /// 2. The owner ID of the contract is set to the selected identity's ID. - /// 3. The ID of the contract is updated based on the selected identity's ID and entropy used during its creation. - /// 4. Any contract updates associated with the main contract are adjusted to reflect these changes. - /// 5. All operations in the strategy that match the old contract ID are updated with the new contract ID. + /// This primary function orchestrates the generation of state transitions for a block, accounting for + /// new identities, document operations, contract creations, and updates. It serves as the main entry point + /// for simulating activities on the Dash Platform based on the defined strategy. The function integrates + /// the creation and management of identities, their related transactions, and the dynamics of contracts and + /// document operations to provide a holistic view of block activities. /// - /// Finally, a new data contract create state transition is generated using the modified contract. + /// Internally, it calls `operations_based_transitions` to process specific operations and generates + /// additional transitions related to identities and contracts. It's designed to simulate a realistic + /// blockchain environment, enabling the testing of complex scenarios and strategies. /// /// # Parameters - /// - `current_identities`: A reference to a list of current identities. - /// - `signer`: A reference to a signer instance used during the creation of state transitions. - /// - `rng`: A mutable reference to a random number generator. - /// - `platform_version`: The current platform version. + /// - `document_query_callback`: Callback for querying documents based on specified criteria. + /// - `identity_fetch_callback`: Callback for fetching identity details, including public keys. + /// - `asset_lock_proofs`: A vector of asset lock proofs and associated private keys. + /// - `block_info`: Information about the current block, such as its height and timestamp. + /// - `current_identities`: A mutable list of identities present in the simulation, potentially expanded with new identities. + /// - `known_contracts`: A mutable map of contracts known in the simulation, including any updates. + /// - `signer`: A mutable reference to a signer instance for signing transactions. + /// - `identity_nonce_counter`: Tracks nonce values for identities, crucial for transaction uniqueness. + /// - `contract_nonce_counter`: Tracks nonce values for contract interactions. + /// - `rng`: A mutable random number generator for creating randomized elements in transactions. + /// - `config`: Configuration details for the strategy, including block start height and number of blocks. + /// - `platform_version`: Specifies the platform version for compatibility with Dash Platform features. /// /// # Returns - /// A vector of `StateTransition` for data contracts. + /// A tuple containing: + /// 1. `Vec`: A collection of state transitions generated for the block. + /// 2. `Vec`: Operations that need to be finalized at the block's end, often related to identity updates. + /// + /// # Usage + /// This function is typically called once per block during simulation, with its output used to apply transactions + /// and operations within the simulated Dash Platform environment. /// - /// # Examples /// ```ignore - /// // Assuming `strategy` is an instance of `Strategy`, - /// // and `current_identities`, `signer`, `rng`, and `platform_version` are appropriately initialized. - /// let contract_transitions = strategy.contract_state_transitions(¤t_identities, &signer, &mut rng, &platform_version); + /// let (state_transitions, finalize_ops) = strategy.state_transitions_for_block( + /// &mut document_query_callback, + /// &mut identity_fetch_callback, + /// &mut asset_lock_proofs, + /// &block_info, + /// &mut current_identities, + /// &mut known_contracts, + /// &mut signer, + /// &mut identity_nonce_counter, + /// &mut contract_nonce_counter, + /// &mut rng, + /// &config, + /// &platform_version, + /// ); /// ``` - pub fn contract_state_transitions( + /// + /// # Note + /// This function is central to simulating the lifecycle of block processing and strategy execution + /// on the Dash Platform. It encapsulates the complexity of transaction generation, identity management, + /// and contract dynamics within a block's context. + pub fn state_transitions_for_block( &mut self, - current_identities: &Vec, - signer: &SimpleSigner, + document_query_callback: &mut impl FnMut(LocalDocumentQuery) -> Vec, + identity_fetch_callback: &mut impl FnMut( + Identifier, + Option, + ) -> PartialIdentity, + asset_lock_proofs: &mut Vec<(AssetLockProof, PrivateKey)>, + block_info: &BlockInfo, + current_identities: &mut Vec, + known_contracts: &mut BTreeMap, + signer: &mut SimpleSigner, + identity_nonce_counter: &mut BTreeMap, + contract_nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, + mempool_document_counter: &MempoolDocumentCounter, rng: &mut StdRng, + config: &StrategyConfig, platform_version: &PlatformVersion, - ) -> Vec { - self.contracts_with_updates - .iter_mut() - .map(|(created_contract, contract_updates)| { - let identity_num = rng.gen_range(0..current_identities.len()); - let identity = current_identities - .get(identity_num) - .unwrap() - .clone() - .into_partial_identity_info(); - - let entropy_used = *created_contract.entropy_used(); - - let contract = created_contract.data_contract_mut(); - - contract.set_owner_id(identity.id); - let old_id = contract.id(); - let new_id = DataContract::generate_data_contract_id_v0(identity.id, entropy_used); - contract.set_id(new_id); + ) -> ( + Vec, + Vec, + Vec, + ) { + let mut finalize_block_operations = vec![]; - if let Some(contract_updates) = contract_updates { - for (_, updated_contract) in contract_updates.iter_mut() { - updated_contract.data_contract_mut().set_id(contract.id()); - updated_contract - .data_contract_mut() - .set_owner_id(contract.owner_id()); - } - } + // Get identity state transitions + // Start identities are done on the 1st block, identity inserts are done on 3rd+ blocks + let identity_state_transitions = match self.identity_state_transitions_for_block( + block_info, + self.start_identities.starting_balances, + signer, + rng, + asset_lock_proofs, + config, + platform_version, + ) { + Ok(transitions) => transitions, + Err(e) => { + tracing::error!("identity_state_transitions_for_block error: {}", e); + return (vec![], finalize_block_operations, vec![]); + } + }; - // since we are changing the id, we need to update all the strategy - self.operations.iter_mut().for_each(|operation| { - if let OperationType::Document(document_op) = &mut operation.op_type { - if document_op.contract.id() == old_id { - document_op.contract.set_id(contract.id()); - document_op.document_type = document_op - .contract - .document_type_for_name(document_op.document_type.name()) - .expect("document type must exist") - .to_owned_document_type(); - } - } - }); + // Create state_transitions vec and identities vec based on identity_state_transitions outcome + let (identities, mut state_transitions): (Vec, Vec) = + identity_state_transitions.into_iter().unzip(); - let state_transition = DataContractCreateTransition::new_from_data_contract( - contract.clone(), - *created_contract.entropy_used(), - &identity, - 1, //key id 1 should always be a high or critical auth key in these tests + // Add initial contracts for contracts_with_updates on 2nd block of strategy + if block_info.height == config.start_block_height + 1 { + let mut contract_state_transitions = self.initial_contract_state_transitions( + current_identities, + identity_nonce_counter, + signer, + rng, + platform_version, + ); + state_transitions.append(&mut contract_state_transitions); + } else if block_info.height > config.start_block_height + 1 { + // Do operations and contract updates after the first two blocks + let (mut operations_state_transitions, mut add_to_finalize_block_operations) = self + .operations_based_transitions( + document_query_callback, + identity_fetch_callback, + asset_lock_proofs, + block_info, + current_identities, + known_contracts, signer, + identity_nonce_counter, + contract_nonce_counter, + mempool_document_counter, + rng, platform_version, - None, - ) - .expect("expected to create a create state transition from a data contract"); - state_transition - }) - .collect() - } + ); + finalize_block_operations.append(&mut add_to_finalize_block_operations); + state_transitions.append(&mut operations_state_transitions); - /// Generates state transitions for updating data contracts based on the current set of identities and block height. - /// - /// This method creates update state transitions for data contracts by iterating over the contracts with updates - /// present in the strategy. For each contract: - /// 1. It checks for any contract updates associated with the provided block height. - /// 2. For each matching update, it locates the corresponding identity based on the owner ID in the update. - /// 3. A new data contract update state transition is then generated using the located identity and the updated contract. - /// - /// # Parameters - /// - `current_identities`: A reference to a list of current identities. - /// - `block_height`: The height of the current block. - /// - `signer`: A reference to a signer instance used during the creation of state transitions. - /// - `platform_version`: The current platform version. - /// - /// # Returns - /// A vector of `StateTransition` for updating data contracts. - /// - /// # Panics - /// The method will panic if it doesn't find an identity matching the owner ID from the data contract update. - /// - /// # Examples - /// ```ignore - /// // Assuming `strategy` is an instance of `Strategy`, - /// // and `current_identities`, `block_height`, `signer`, and `platform_version` are appropriately initialized. - /// let update_transitions = strategy.contract_update_state_transitions(¤t_identities, block_height, &signer, &platform_version); - /// ``` - pub fn contract_update_state_transitions( - &mut self, - current_identities: &Vec, - block_height: u64, - signer: &SimpleSigner, - platform_version: &PlatformVersion, - ) -> Vec { - self.contracts_with_updates - .iter_mut() - .filter_map(|(_, contract_updates)| { - let Some(contract_updates) = contract_updates else { - return None; - }; - let Some(contract_update) = contract_updates.get(&block_height) else { - return None; - }; - let identity = current_identities - .iter() - .find(|identity| identity.id() == contract_update.data_contract().owner_id()) - .expect("expected to find an identity") - .clone() - .into_partial_identity_info(); - - let state_transition = DataContractUpdateTransition::new_from_data_contract( - contract_update.data_contract().clone(), - &identity, - 1, //key id 1 should always be a high or critical auth key in these tests + // Contract updates for contracts_with_updates + let mut initial_contract_update_state_transitions = self + .initial_contract_update_state_transitions( + current_identities, + block_info.height, + config.start_block_height, signer, + contract_nonce_counter, platform_version, - None, - ) - .expect("expected to create a create state transition from a data contract"); - Some(state_transition) - }) - .collect() + ); + state_transitions.append(&mut initial_contract_update_state_transitions); + } + + (state_transitions, finalize_block_operations, identities) } - /// Generates state transitions for a given block. + /// Processes strategy operations to generate state transitions specific to operations for a given block. /// - /// The `state_transitions_for_block` function processes state transitions based on the provided - /// block information, platform, identities, and other input parameters. It facilitates - /// the creation of state transitions for both new documents and updated documents in the system. + /// This function is responsible for generating state transitions based on the operations defined within + /// the strategy. It evaluates each operation's conditions and frequency to determine if a transition should + /// be created for the current block. The function supports a variety of operations, including document + /// creation, updates, deletions, identity-related transactions, and more, each tailored to the specifics + /// of the Dash Platform. + /// + /// `operations_based_transitions` is called internally by `state_transitions_for_block` + /// to handle the operational aspects of the strategy. While it focuses on the execution of operations, + /// it is part of a larger workflow that includes managing new identities, contracts, and their updates + /// across blocks. /// /// # Parameters - /// - `platform`: A reference to the platform, which provides access to various blockchain - /// related functionalities and data. - /// - `block_info`: Information about the block for which the state transitions are being generated. - /// This contains data such as its height and time. - /// - `current_identities`: A mutable reference to the list of current identities in the system. - /// This list is used to facilitate state transitions related to the involved identities. - /// - `signer`: A mutable reference to a signer, which aids in creating cryptographic signatures - /// for the state transitions. - /// - `rng`: A mutable reference to a random number generator, used for generating random values - /// during state transition creation. - /// - `platform_version`: The version of the platform being used. This information is crucial - /// to ensure compatibility and consistency in state transition generation. + /// - `document_query_callback`: A callback function for querying existing documents based on specified criteria. + /// - `identity_fetch_callback`: A callback function for fetching identity information, including public keys. + /// - `asset_lock_proofs`: A vector of asset lock proofs and associated private keys. + /// - `block_info`: Information about the current block, including height and time. + /// - `current_identities`: A mutable reference to the list of current identities involved in the operations. + /// - `known_contracts`: A mutable reference to a map of known contracts and their updates. + /// - `signer`: A mutable reference to a signer instance used for transaction signatures. + /// - `identity_nonce_counter`: A mutable reference to a map tracking nonce values for identities. + /// - `contract_nonce_counter`: A mutable reference to a map tracking nonce values for contract interactions. + /// - `rng`: A mutable reference to a random number generator for random value generation in operations. + /// - `platform_version`: The platform version, ensuring compatibility with Dash Platform features. /// /// # Returns /// A tuple containing: - /// 1. `Vec`: A vector of state transitions generated for the given block. - /// These transitions encompass both new document state transitions and document update transitions. - /// 2. `Vec`: A vector of finalize block operations which may be necessary - /// to conclude the block's processing. + /// 1. `Vec`: A vector of state transitions generated based on the operations for the current block. + /// 2. `Vec`: A vector of operations that need to be finalized by the end of the block processing. + /// + /// # Usage + /// This function is a critical component of the strategy execution process, providing detailed control over + /// the generation and management of operations-specific state transitions within a block's context. It is not + /// typically called directly by external code but is an essential part of the internal mechanics of generating + /// state transitions for simulation or testing purposes. /// - /// # Examples /// ```ignore - /// let (state_transitions, finalize_ops) = obj.state_transitions_for_block( - /// &platform, + /// let (state_transitions, finalize_ops) = strategy.operations_based_transitions( + /// &mut document_query_callback, + /// &mut identity_fetch_callback, + /// &mut asset_lock_proofs, /// &block_info, /// &mut current_identities, + /// &mut known_contracts, /// &mut signer, + /// &mut identity_nonce_counter, + /// &mut contract_nonce_counter, /// &mut rng, - /// platform_version, + /// &platform_version, /// ); /// ``` /// - /// # Panics - /// This function may panic under unexpected conditions, for example, when unable to generate state - /// transitions for the given block. - pub fn state_transitions_for_block( + /// # Note + /// This function plays a pivotal role in simulating realistic blockchain operations, allowing for the + /// detailed and nuanced execution of a wide range of actions on the Dash Platform as defined by the strategy. + pub fn operations_based_transitions( &self, - drive: &Drive, + document_query_callback: &mut impl FnMut(LocalDocumentQuery) -> Vec, + identity_fetch_callback: &mut impl FnMut( + Identifier, + Option, + ) -> PartialIdentity, + asset_lock_proofs: &mut Vec<(AssetLockProof, PrivateKey)>, block_info: &BlockInfo, - current_identities: &mut Vec, + current_identities: &mut [Identity], + known_contracts: &mut BTreeMap, signer: &mut SimpleSigner, + identity_nonce_counter: &mut BTreeMap, + contract_nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, + mempool_document_counter: &MempoolDocumentCounter, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> (Vec, Vec) { @@ -574,11 +635,14 @@ impl Strategy { // Lists to keep track of replaced and deleted documents let mut replaced = vec![]; + let mut transferred = vec![]; let mut deleted = vec![]; // Loop through the operations and generate state transitions based on frequency and type for op in &self.operations { + // Check if the op frequency hits for this block if op.frequency.check_hit(rng) { + // Get times_per_block let count = rng.gen_range(op.frequency.times_per_block_range.clone()); match &op.op_type { // Generate state transition for document insert operation with random data @@ -587,38 +651,67 @@ impl Strategy { document_type, contract, }) => { - let documents = document_type - .random_documents_with_params( - count as u32, - current_identities, - block_info.time_ms, - *fill_type, - *fill_size, - rng, - platform_version, - ) - .expect("expected random_documents_with_params"); - documents - .into_iter() - .for_each(|(document, identity, entropy)| { - let updated_at = - if document_type.required_fields().contains("$updatedAt") { - document.created_at() + let eligible_identities = choose_capable_identities( + current_identities, + contract, + mempool_document_counter, + count as usize, + rng, + ); + + // TO-DO: these documents should be created according to the data contract's validation rules + let mut documents_with_identity_and_entropy: Vec<( + Document, + &Identity, + Bytes32, + )> = Vec::new(); + match document_type.random_documents_with_params( + count as u32, + &eligible_identities, + Some(block_info.time_ms), + Some(block_info.height), + Some(block_info.core_height), + *fill_type, + *fill_size, + rng, + platform_version, + ) { + Ok(documents) => documents_with_identity_and_entropy = documents, + Err(e) => tracing::warn!("Failed to create random documents: {}", e), + } + + documents_with_identity_and_entropy.into_iter().for_each( + |(document, identity, entropy)| { + let identity_contract_nonce = + if contract.owner_id() == identity.id() { + contract_nonce_counter + .entry((identity.id(), contract.id())) + .or_insert(1) } else { - None + contract_nonce_counter + .entry((identity.id(), contract.id())) + .or_default() }; + + let gap = self + .identity_contract_nonce_gaps + .as_ref() + .map_or(0, |gap_amount| gap_amount.events_if_hit(rng)) + as u64; + *identity_contract_nonce += 1 + gap; + let document_create_transition: DocumentCreateTransition = DocumentCreateTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } .into(), entropy: entropy.to_buffer(), - created_at: document.created_at(), - updated_at, data: document.properties_consumed(), + prefunded_voting_balance: Default::default(), } .into(); @@ -626,7 +719,8 @@ impl Strategy { DocumentsBatchTransitionV0 { owner_id: identity.id(), transitions: vec![document_create_transition.into()], - signature_public_key_id: 0, + user_fee_increase: 0, + signature_public_key_id: 2, signature: BinaryData::default(), } .into(); @@ -636,14 +730,12 @@ impl Strategy { let identity_public_key = identity .get_first_public_key_matching( Purpose::AUTHENTICATION, - HashSet::from([ - SecurityLevel::HIGH, - SecurityLevel::CRITICAL, - ]), + HashSet::from([SecurityLevel::CRITICAL]), HashSet::from([ KeyType::ECDSA_SECP256K1, KeyType::BLS12_381, ]), + false, ) .expect("expected to get a signing key"); @@ -652,13 +744,14 @@ impl Strategy { identity_public_key, signer, Some(|_data_contract_id, _document_type_name| { - Ok(SecurityLevel::HIGH) + Ok(SecurityLevel::CRITICAL) }), ) .expect("expected to sign"); operations.push(document_batch_transition); - }); + }, + ); } // Generate state transition for specific document insert operation @@ -674,16 +767,23 @@ impl Strategy { contract, }) => { let documents = if let Some(identifier) = identifier { - let held_identity = vec![current_identities + let held_identity = current_identities .iter() .find(|identity| identity.id() == identifier) - .expect("expected to find identifier, review strategy params") - .clone()]; + .expect("expected to find identifier, review strategy params"); + + let mut eligible_identities = Vec::with_capacity(count as usize); + for _ in 0..count { + eligible_identities.push(held_identity); + } + document_type .random_documents_with_params( count as u32, - &held_identity, - block_info.time_ms, + &eligible_identities, + Some(block_info.time_ms), + Some(block_info.height), + Some(block_info.core_height), *fill_type, *fill_size, rng, @@ -691,11 +791,21 @@ impl Strategy { ) .expect("expected random_documents_with_params") } else { + let eligible_identities = choose_capable_identities( + current_identities, + contract, + mempool_document_counter, + count as usize, + rng, + ); + document_type .random_documents_with_params( count as u32, - current_identities, - block_info.time_ms, + &eligible_identities, + Some(block_info.time_ms), + Some(block_info.height), + Some(block_info.core_height), *fill_type, *fill_size, rng, @@ -710,24 +820,24 @@ impl Strategy { document .properties_mut() .append(&mut specific_document_key_value_pairs.clone()); - let updated_at = - if document_type.required_fields().contains("$updatedAt") { - document.created_at() - } else { - None - }; + + let identity_contract_nonce = contract_nonce_counter + .entry((identity.id(), contract.id())) + .or_default(); + *identity_contract_nonce += 1; + let document_create_transition: DocumentCreateTransition = DocumentCreateTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } .into(), entropy: entropy.to_buffer(), - created_at: document.created_at(), - updated_at, data: document.properties_consumed(), + prefunded_voting_balance: Default::default(), } .into(); @@ -735,7 +845,8 @@ impl Strategy { DocumentsBatchTransitionV0 { owner_id: identity.id(), transitions: vec![document_create_transition.into()], - signature_public_key_id: 0, + user_fee_increase: 0, + signature_public_key_id: 1, signature: BinaryData::default(), } .into(); @@ -753,6 +864,7 @@ impl Strategy { KeyType::ECDSA_SECP256K1, KeyType::BLS12_381, ]), + false, ) .expect("expected to get a signing key"); @@ -776,23 +888,19 @@ impl Strategy { document_type, contract, }) => { - let any_item_query = - DriveQuery::any_item_query(contract, document_type.as_ref()); - let mut items = drive - .query_documents( - any_item_query, - Some(&block_info.epoch), - false, - None, - Some(platform_version.protocol_version), - ) - .expect("expect to execute query") - .documents_owned(); + let mut items = document_query_callback( + LocalDocumentQuery::RandomDocumentQuery(RandomDocumentQuery { + data_contract: contract, + document_type, + }), + ); items.retain(|item| !deleted.contains(&item.id())); items.retain(|item| !replaced.contains(&item.id())); + items.retain(|item| !transferred.contains(&item.id())); + if !items.is_empty() { let document = items.remove(0); @@ -801,20 +909,21 @@ impl Strategy { //todo: fix this into a search key request for the following //let search_key_request = BTreeMap::from([(Purpose::AUTHENTICATION as u8, BTreeMap::from([(SecurityLevel::HIGH as u8, AllKeysOfKindRequest)]))]); - let request = IdentityKeysRequest { - identity_id: document.owner_id().to_buffer(), - request_type: KeyRequestType::SpecificKeys(vec![1]), - limit: Some(1), - offset: None, - }; - let identity = drive - .fetch_identity_balance_with_keys(request, None, platform_version) - .expect("expected to be able to get identity") - .expect("expected to get an identity"); + let identity_id = document.owner_id(); + let identity = current_identities + .iter() + .find(|&identity| identity.id() == identity_id) + .expect("Expected to find the identity in current_identities"); + let identity_contract_nonce = contract_nonce_counter + .entry((identity.id(), contract.id())) + .or_default(); + *identity_contract_nonce += 1; + let document_delete_transition: DocumentDeleteTransition = DocumentDeleteTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } @@ -824,9 +933,10 @@ impl Strategy { let document_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { - owner_id: identity.id, + owner_id: identity.id(), transitions: vec![document_delete_transition.into()], - signature_public_key_id: 0, + user_fee_increase: 0, + signature_public_key_id: 1, signature: BinaryData::default(), } .into(); @@ -835,10 +945,13 @@ impl Strategy { document_batch_transition.into(); let identity_public_key = identity - .loaded_public_keys - .values() - .next() - .expect("expected a key"); + .get_first_public_key_matching( + Purpose::AUTHENTICATION, + HashSet::from([SecurityLevel::CRITICAL]), + HashSet::from([KeyType::ECDSA_SECP256K1, KeyType::BLS12_381]), + false, + ) + .expect("expected to get a signing key"); document_batch_transition .sign_external( @@ -856,27 +969,23 @@ impl Strategy { // Generate state transition for document replace operation OperationType::Document(DocumentOp { - action: DocumentAction::DocumentActionReplace, + action: DocumentAction::DocumentActionReplaceRandom, document_type, contract, }) => { - let any_item_query = - DriveQuery::any_item_query(contract, document_type.as_ref()); - let mut items = drive - .query_documents( - any_item_query, - Some(&block_info.epoch), - false, - None, - Some(platform_version.protocol_version), - ) - .expect("expect to execute query") - .documents_owned(); + let mut items = document_query_callback( + LocalDocumentQuery::RandomDocumentQuery(RandomDocumentQuery { + data_contract: contract, + document_type, + }), + ); items.retain(|item| !deleted.contains(&item.id())); items.retain(|item| !replaced.contains(&item.id())); + items.retain(|item| !transferred.contains(&item.id())); + if !items.is_empty() { let document = items.remove(0); @@ -894,14 +1003,20 @@ impl Strategy { limit: Some(1), offset: None, }; - let identity = drive - .fetch_identity_balance_with_keys(request, None, platform_version) - .expect("expected to be able to get identity") - .expect("expected to get an identity"); + let identity = + identity_fetch_callback(request.identity_id.into(), Some(request)); + let identity_contract_nonce = contract_nonce_counter + .get_mut(&(identity.id, contract.id())) + .expect( + "the identity should already have a nonce for that contract", + ); + *identity_contract_nonce += 1; + let document_replace_transition: DocumentReplaceTransition = DocumentReplaceTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } @@ -910,7 +1025,6 @@ impl Strategy { .revision() .expect("expected to unwrap revision") + 1, - updated_at: Some(block_info.time_ms), data: random_new_document.properties_consumed(), } .into(); @@ -919,7 +1033,112 @@ impl Strategy { DocumentsBatchTransitionV0 { owner_id: identity.id, transitions: vec![document_replace_transition.into()], - signature_public_key_id: 0, + user_fee_increase: 0, + signature_public_key_id: 1, + signature: BinaryData::default(), + } + .into(); + + let mut document_batch_transition: StateTransition = + document_batch_transition.into(); + + let identity_public_key = identity + .loaded_public_keys + .values() + .next() + .expect("expected a key"); + + document_batch_transition + .sign_external( + identity_public_key, + signer, + Some(|_data_contract_id, _document_type_name| { + Ok(SecurityLevel::HIGH) + }), + ) + .expect("expected to sign"); + + operations.push(document_batch_transition); + } + } + + // Generate state transition for document transfer operation + OperationType::Document(DocumentOp { + action: DocumentAction::DocumentActionTransferRandom, + document_type, + contract, + }) => { + let mut items = document_query_callback( + LocalDocumentQuery::RandomDocumentQuery(RandomDocumentQuery { + data_contract: contract, + document_type, + }), + ); + + items.retain(|item| !deleted.contains(&item.id())); + + items.retain(|item| !replaced.contains(&item.id())); + + items.retain(|item| !transferred.contains(&item.id())); + + if !items.is_empty() { + let document = items.remove(0); + + let random_index = rng.gen_range(0..current_identities.len()); + let mut random_identity_id = current_identities[random_index].id(); + + if random_identity_id == document.owner_id() { + if current_identities.len() == 1 { + continue; + } + if random_index == current_identities.len() - 1 { + // we are at the end + random_identity_id = current_identities[random_index - 1].id(); + } else { + random_identity_id = current_identities[random_index + 1].id(); + } + } + + transferred.push(document.id()); + + let request = IdentityKeysRequest { + identity_id: document.owner_id().to_buffer(), + request_type: KeyRequestType::SpecificKeys(vec![1]), + limit: Some(1), + offset: None, + }; + let identity = + identity_fetch_callback(request.identity_id.into(), Some(request)); + let identity_contract_nonce = contract_nonce_counter + .get_mut(&(identity.id, contract.id())) + .expect( + "the identity should already have a nonce for that contract", + ); + *identity_contract_nonce += 1; + + let document_transfer_transition: DocumentTransferTransition = + DocumentTransferTransitionV0 { + base: DocumentBaseTransitionV0 { + id: document.id(), + identity_contract_nonce: *identity_contract_nonce, + document_type_name: document_type.name().clone(), + data_contract_id: contract.id(), + } + .into(), + revision: document + .revision() + .expect("expected to unwrap revision") + + 1, + recipient_owner_id: random_identity_id, + } + .into(); + + let document_batch_transition: DocumentsBatchTransition = + DocumentsBatchTransitionV0 { + owner_id: identity.id, + transitions: vec![document_transfer_transition.into()], + user_fee_increase: 0, + signature_public_key_id: 1, signature: BinaryData::default(), } .into(); @@ -949,71 +1168,107 @@ impl Strategy { // Generate state transition for identity top-up operation OperationType::IdentityTopUp if !current_identities.is_empty() => { - let indices: Vec = - (0..current_identities.len()).choose_multiple(rng, count as usize); - let random_identities: Vec<&Identity> = indices - .into_iter() - .map(|index| ¤t_identities[index]) - .collect(); + // Use a cyclic iterator over the identities to ensure we can create 'count' transitions + let cyclic_identities = current_identities.iter().cycle(); - for random_identity in random_identities { - operations.push(crate::transitions::create_identity_top_up_transition( - rng, + // Iterate 'count' times to create the required number of state transitions. + for random_identity in cyclic_identities.take(count.into()) { + match crate::transitions::create_identity_top_up_transition( random_identity, + asset_lock_proofs, platform_version, - )); + ) { + Ok(transition) => operations.push(transition), + Err(_) => { + tracing::error!("Error creating asset lock proof for identity top up transition"); + continue; + } + } } } - // Generate state transition for identity update operation OperationType::IdentityUpdate(update_op) if !current_identities.is_empty() => { - let indices: Vec = - (0..current_identities.len()).choose_multiple(rng, count as usize); - for index in indices { - let random_identity = current_identities.get_mut(index).unwrap(); - match update_op { - IdentityUpdateOp::IdentityUpdateAddKeys(count) => { - let (state_transition, keys_to_add_at_end_block) = - crate::transitions::create_identity_update_transition_add_keys( + match update_op { + IdentityUpdateOp::IdentityUpdateAddKeys(keys_count) => { + // Map the count of keys already added this block to each identity + // This prevents adding duplicate KeyIDs in the same block + let mut keys_already_added_count_map = HashMap::new(); + for id in &*current_identities { + keys_already_added_count_map.insert(id.id(), 0); + } + + // Create `count` state transitions + for _ in 0..count { + let identities_count = current_identities.len(); + if identities_count == 0 { + break; + } + + // Select a random identity from the current_identities + let random_index = rng.gen_range(0..identities_count); + let random_identity = &mut current_identities[random_index]; + + // Get keys already added + let keys_already_added = keys_already_added_count_map.get(&random_identity.id()) + .expect("Expected to get keys_already_added in IdentityAddKeys ST creation"); + + // Create transition + let (state_transition, keys_to_add_at_end_block) = crate::transitions::create_identity_update_transition_add_keys( random_identity, - *count, + *keys_count, + *keys_already_added, + identity_nonce_counter, signer, rng, platform_version, ); + + // Push to operations vectors operations.push(state_transition); finalize_block_operations.push(IdentityAddKeys( keys_to_add_at_end_block.0, keys_to_add_at_end_block.1, - )) - } - IdentityUpdateOp::IdentityUpdateDisableKey(count) => { - let state_transition = - crate::transitions::create_identity_update_transition_disable_keys( - random_identity, - *count, - block_info.time_ms, - signer, - rng, - platform_version, - ); - if let Some(state_transition) = state_transition { - operations.push(state_transition); - } + )); + + // Increment keys_already_added count + keys_already_added_count_map.insert( + random_identity.id(), + keys_already_added + *keys_count as u32, + ); } } + IdentityUpdateOp::IdentityUpdateDisableKey(keys_count) => { + (0..count).for_each(|_| { + current_identities.iter_mut().enumerate().for_each(|(i, random_identity)| { + if i >= count.into() { return; } + + if let Some(state_transition) = + crate::transitions::create_identity_update_transition_disable_keys( + random_identity, + *keys_count, + identity_nonce_counter, + block_info.time_ms, + signer, + rng, + platform_version, + ) { + operations.push(state_transition); + } + }); + }); + } } } // Generate state transition for identity withdrawal operation OperationType::IdentityWithdrawal if !current_identities.is_empty() => { - let indices: Vec = - (0..current_identities.len()).choose_multiple(rng, count as usize); - for index in indices { - let random_identity = current_identities.get_mut(index).unwrap(); + for i in 0..count { + let index = (i as usize) % current_identities.len(); + let random_identity = &mut current_identities[index]; let state_transition = crate::transitions::create_identity_withdrawal_transition( random_identity, + identity_nonce_counter, signer, rng, ); @@ -1023,37 +1278,229 @@ impl Strategy { // Generate state transition for identity transfer operation OperationType::IdentityTransfer if current_identities.len() > 1 => { - // chose 2 last identities - let indices: Vec = - vec![current_identities.len() - 2, current_identities.len() - 1]; - - let owner = current_identities.get(indices[0]).unwrap(); - let recipient = current_identities.get(indices[1]).unwrap(); - - let fetched_owner_balance = drive - .fetch_identity_balance(owner.id().to_buffer(), None, platform_version) - .expect("expected to be able to get identity") - .expect("expected to get an identity"); - - let state_transition = - crate::transitions::create_identity_credit_transfer_transition( - owner, - recipient, - signer, - fetched_owner_balance - 100, + for _ in 0..count { + let identities_count = current_identities.len(); + if identities_count == 0 { + break; + } + + // Select a random identity from the current_identities for the sender + let random_index_sender = rng.gen_range(0..identities_count); + + // Clone current_identities to a Vec for manipulation + let mut unused_identities: Vec<_> = + current_identities.iter().cloned().collect(); + unused_identities.remove(random_index_sender); // Remove the sender + let unused_identities_count = unused_identities.len(); + + // Select a random identity from the remaining ones for the recipient + let random_index_recipient = rng.gen_range(0..unused_identities_count); + let recipient = &unused_identities[random_index_recipient]; + + // Use the sender index on the original slice + let sender = &mut current_identities[random_index_sender]; + + let state_transition = + crate::transitions::create_identity_credit_transfer_transition( + sender, + recipient, + identity_nonce_counter, + signer, + 300000, + ); + operations.push(state_transition); + } + } + + OperationType::ContractCreate(params, doc_type_range) + if !current_identities.is_empty() => + { + let contract_factory = match DataContractFactory::new( + platform_version.protocol_version, + ) { + Ok(contract_factory) => contract_factory, + Err(e) => { + tracing::error!("Failed to get DataContractFactory while creating random contract: {e}"); + continue; + } + }; + + // Create `count` ContractCreate transitions and push to operations vec + for _ in 0..count { + // Get the contract owner_id from a random current_identity and identity nonce + let identity = current_identities + .choose(rng) + .expect("Expected to get an identity for ContractCreate"); + let identity_nonce = + identity_nonce_counter.entry(identity.id()).or_default(); + *identity_nonce += 1; + let owner_id = identity.id(); + + // Generate a contract id + let contract_id = DataContract::generate_data_contract_id_v0( + owner_id, + *identity_nonce, ); - operations.push(state_transition); + + // Create `doc_type_count` doc types + let doc_types = + Value::Map( + doc_type_range + .clone() + .filter_map(|_| match DocumentTypeV0::random_document_type( + params.clone(), + contract_id, + rng, + platform_version, + ) { + Ok(new_document_type) => { + let doc_type_clone = + new_document_type.schema().clone(); + Some(( + Value::Text(new_document_type.name().clone()), + doc_type_clone, + )) + } + Err(e) => { + tracing::error!( + "Error generating random document type: {:?}", + e + ); + None + } + }) + .collect(), + ); + + let created_data_contract = match contract_factory.create( + owner_id, + *identity_nonce, + doc_types, + None, + None, + ) { + Ok(contract) => contract, + Err(e) => { + tracing::error!("Failed to create random data contract: {e}"); + continue; + } + }; + + let transition = match contract_factory + .create_data_contract_create_transition(created_data_contract) + { + Ok(transition) => transition, + Err(e) => { + tracing::error!( + "Failed to create ContractCreate transition: {e}" + ); + continue; + } + }; + + // Sign transition + let public_key = identity + .get_first_public_key_matching( + Purpose::AUTHENTICATION, + HashSet::from([SecurityLevel::HIGH, SecurityLevel::CRITICAL]), + HashSet::from([KeyType::ECDSA_SECP256K1]), + false, + ) + .expect("Expected to get identity public key in ContractCreate"); + let mut state_transition = + StateTransition::DataContractCreate(transition); + if let Err(e) = state_transition.sign_external( + public_key, + signer, + None::< + fn(Identifier, String) -> Result, + >, + ) { + tracing::error!("Error signing state transition: {:?}", e); + } + + operations.push(state_transition); + } + } + OperationType::ContractUpdate(DataContractUpdateOp { + action: DataContractUpdateAction::DataContractNewDocumentTypes(params), + contract, + document_type: None, + }) if !current_identities.is_empty() => { + let contract_key = contract.id().to_string(Encoding::Base58); + + for _ in 0..count { + if let Some(DataContract::V0(contract_ref)) = + known_contracts.get_mut(&contract_key) + { + match DocumentTypeV0::random_document_type( + params.clone(), + contract_ref.id(), + rng, + platform_version, + ) { + Ok(new_document_type) => { + let document_type_name = + format!("doc_type_{}", rng.gen::()); + + // Update the document types and increment the version + contract_ref.document_types.insert( + document_type_name, + DocumentType::V0(new_document_type), + ); + contract_ref.increment_version(); + + let identity = current_identities + .iter() + .find(|identity| { + identity.id() == contract_ref.owner_id() + }) + .or_else(|| current_identities.choose(rng)).expect("Expected to get an identity for DataContractUpdate"); + + let identity_contract_nonce = contract_nonce_counter + .entry((identity.id(), contract_ref.id())) + .or_default(); + *identity_contract_nonce += 1; + + // Prepare the DataContractUpdateTransition with the updated contract_ref + match DataContractUpdateTransition::try_from_platform_versioned((DataContract::V0(contract_ref.clone()), *identity_contract_nonce), platform_version) { + Ok(data_contract_update_transition) => { + let identity_public_key = identity + .get_first_public_key_matching( + Purpose::AUTHENTICATION, + HashSet::from([SecurityLevel::CRITICAL]), + HashSet::from([KeyType::ECDSA_SECP256K1, KeyType::BLS12_381]), + false + ) + .expect("expected to get a signing key with CRITICAL security level"); + + let mut state_transition = StateTransition::DataContractUpdate(data_contract_update_transition); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_data_contract_id, _document_type_name| { + Ok(SecurityLevel::CRITICAL) + }), + ) + .expect("expected to sign the contract update transition with a CRITICAL level key"); + + operations.push(state_transition); + }, + Err(e) => tracing::error!("Error converting data contract to update transition: {:?}", e), + } + } + Err(e) => { + tracing::error!( + "Error generating random document type: {:?}", + e + ) + } + } + } else { + tracing::error!("Contract not found in known_contracts"); + } + } } - // OperationType::ContractCreate(new_fields_optional_count_range, new_fields_required_count_range, new_index_count_range, document_type_count) - // if !current_identities.is_empty() => { - // DataContract::; - // - // DocumentType::random_document() - // } - // OperationType::ContractUpdate(DataContractNewDocumentTypes(count)) - // if !current_identities.is_empty() => { - // - // } _ => {} } } @@ -1061,83 +1508,342 @@ impl Strategy { (operations, finalize_block_operations) } - /// Generates state transitions for a block by considering new identities. + /// Generates identity-related state transitions for a specified block, considering new and existing identities. /// - /// This function processes state transitions with respect to identities, contracts, - /// and document operations. The state transitions are generated based on the - /// given block's height and other parameters, with special handling for block height `1`. + /// This function orchestrates the creation of state transitions associated with identities, leveraging + /// the `start_identities` field to initialize identities at the strategy's start block, and the `identities_inserts` + /// field to dynamically insert new identities based on a defined frequency. It is essential for simulating + /// identity actions within the blockchain, such as identity creation, throughout the lifecycle of the strategy. + /// + /// The function intelligently handles the initial setup of identities at the beginning of the strategy and + /// supports the continuous introduction of new identities into the simulation, reflecting a more realistic + /// blockchain environment. /// /// # Parameters - /// - `platform`: A reference to the platform, which is parameterized with a mock core RPC type. - /// - `block_info`: Information about the current block, like its height and time. - /// - `current_identities`: A mutable reference to the current set of identities. This list - /// may be appended with new identities during processing. - /// - `signer`: A mutable reference to a signer used for creating cryptographic signatures. - /// - `rng`: A mutable reference to a random number generator. + /// - `block_info`: Provides details about the current block, such as height, to guide the generation of state transitions. + /// - `signer`: A mutable reference to a signer instance, used for signing the state transitions of identities. + /// - `rng`: A mutable reference to a random number generator, for creating randomized elements where necessary. + /// - `asset_lock_proofs`: A vector of asset lock proofs and associated private keys. + /// - `config`: Configuration details of the strategy, including the start block height. + /// - `platform_version`: Specifies the version of the Dash Platform, ensuring compatibility with its features and behaviors. /// /// # Returns - /// A tuple containing two vectors: - /// 1. `Vec`: A vector of state transitions generated during processing. - /// 2. `Vec`: A vector of finalize block operations derived during processing. + /// A vector of tuples, each containing an `Identity` and its associated `StateTransition`, representing the actions taken by or on behalf of that identity within the block. /// /// # Examples /// ```ignore - /// let (state_transitions, finalize_ops) = obj.state_transitions_for_block_with_new_identities( - /// &platform, + /// // Assuming `strategy` is an instance of `Strategy`, with `block_info`, `signer`, `rng`, + /// // `asset_lock_proofs`, `config`, and `platform_version` properly initialized: + /// let identity_transitions = strategy.identity_state_transitions_for_block( /// &block_info, - /// &mut current_identities, /// &mut signer, /// &mut rng, - /// platform_version - /// ); + /// &mut create_asset_lock, + /// &config, + /// &platform_version, + /// ).expect("Expected to generate identity state transitions without error"); /// ``` - pub fn state_transitions_for_block_with_new_identities( - &mut self, - drive: &Drive, + /// + /// # Notes + /// This function plays a crucial role in simulating the dynamic nature of identity management on the Dash Platform, + /// allowing for a nuanced and detailed representation of identity-related activities within a blockchain simulation environment. + pub fn identity_state_transitions_for_block( + &self, block_info: &BlockInfo, - current_identities: &mut Vec, + amount: u64, signer: &mut SimpleSigner, rng: &mut StdRng, + asset_lock_proofs: &mut Vec<(AssetLockProof, PrivateKey)>, + config: &StrategyConfig, platform_version: &PlatformVersion, - ) -> (Vec, Vec) { - let mut finalize_block_operations = vec![]; - let identity_state_transitions = - self.identity_state_transitions_for_block(block_info, signer, rng, platform_version); - let (mut identities, mut state_transitions): (Vec, Vec) = - identity_state_transitions.into_iter().unzip(); - current_identities.append(&mut identities); + ) -> Result, ProtocolError> { + let mut state_transitions = vec![]; - if block_info.height == 1 { - // add contracts on block 1 - let mut contract_state_transitions = - self.contract_state_transitions(current_identities, signer, rng, platform_version); - state_transitions.append(&mut contract_state_transitions); - } else { - // Don't do any state transitions on block 1 - let (mut document_state_transitions, mut add_to_finalize_block_operations) = self - .state_transitions_for_block( - drive, - block_info, - current_identities, + // Add start_identities + if block_info.height == config.start_block_height + && self.start_identities.number_of_identities > 0 + { + let mut new_transitions = crate::transitions::create_identities_state_transitions( + self.start_identities.number_of_identities.into(), + self.start_identities.keys_per_identity.into(), + &self.start_identities.extra_keys, + amount, + signer, + rng, + asset_lock_proofs, + platform_version, + )?; + state_transitions.append(&mut new_transitions); + } + + // Add identities_inserts + // Don't do this on first two blocks (per design but also we need to skip utxo refresh) + if block_info.height > config.start_block_height + 1 { + let frequency = &self.identity_inserts.frequency; + if frequency.check_hit(rng) { + let count = frequency.events(rng); // number of identities to create + + let mut new_transitions = crate::transitions::create_identities_state_transitions( + count, + self.identity_inserts.start_keys as KeyID, + &self.identity_inserts.extra_keys, + 200000, // 0.002 dash signer, rng, + asset_lock_proofs, platform_version, - ); - finalize_block_operations.append(&mut add_to_finalize_block_operations); - state_transitions.append(&mut document_state_transitions); + )?; + state_transitions.append(&mut new_transitions); + } + } - // There can also be contract updates + Ok(state_transitions) + } - let mut contract_update_state_transitions = self.contract_update_state_transitions( - current_identities, - block_info.height, - signer, - platform_version, - ); - state_transitions.append(&mut contract_update_state_transitions); - } + /// Initializes contracts and generates their creation state transitions based on the `contracts_with_updates` field. + /// + /// This function orchestrates the setup of initial data contracts specified in the strategy, applying any predefined updates + /// based on the simulation's block height. It assigns ownership of these contracts to identities randomly selected from the + /// current identities list, ensuring dynamic interaction within the simulated environment. Additionally, the function + /// updates the ID of each contract to reflect the ownership and creation details, maintaining the integrity of contract + /// relationships throughout the simulation. + /// + /// For contracts designated with updates, this process also prepares the contracts by adjusting their details to match + /// the simulated block height, ensuring that updates are accurately reflected in the simulation. Operations related to + /// these contracts are updated accordingly to maintain consistency. + /// + /// # Parameters + /// - `current_identities`: A list of current identities available in the simulation. + /// - `identity_nonce_counter`: Tracks nonce values for each identity to ensure unique contract identifiers. + /// - `signer`: A reference to a signer instance for signing the contract creation transactions. + /// - `rng`: A random number generator for selecting identities and generating contract details. + /// - `platform_version`: Indicates the platform version to ensure compatibility with Dash Platform features. + /// + /// # Returns + /// A vector of `StateTransition`, each representing the creation of a data contract within the simulated environment. + /// + /// # Examples + /// ```ignore + /// let initial_contract_transitions = strategy.initial_contract_state_transitions( + /// ¤t_identities, + /// &mut identity_nonce_counter, + /// &signer, + /// &mut rng, + /// &platform_version, + /// ); + /// ``` + /// + /// This function is pivotal for setting up the simulated environment's initial state, providing a foundation for + /// subsequent operations and updates within the strategy. + pub fn initial_contract_state_transitions( + &mut self, + current_identities: &[Identity], + identity_nonce_counter: &mut BTreeMap, + signer: &SimpleSigner, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Vec { + let mut id_mapping = HashMap::new(); // Maps old IDs to new IDs - (state_transitions, finalize_block_operations) + self.start_contracts + .iter_mut() + .map(|(created_contract, contract_updates)| { + // Select a random identity from current_identities to be the contract owner + let identity_num = rng.gen_range(0..current_identities.len()); + + let identity = current_identities + .get(identity_num) + .expect("Expected to find the identity in the current_identities"); + + let identity_public_key = identity.get_first_public_key_matching( + Purpose::AUTHENTICATION, + HashSet::from([SecurityLevel::HIGH, SecurityLevel::CRITICAL]), + HashSet::from([KeyType::ECDSA_SECP256K1]), + false + ) + .expect("Expected to get identity public key in initial_contract_state_transitions"); + let key_id = identity_public_key.id(); + + let partial_identity = identity.clone().into_partial_identity_info(); + let partial_identity_public_key = partial_identity.loaded_public_keys.values() + .find(|&public_key| public_key.id() == key_id) + .expect("No public key with matching id found"); + + let contract = created_contract.data_contract_mut(); + + // Get and bump the identity nonce + let identity_nonce = identity_nonce_counter.entry(partial_identity.id).or_default(); + *identity_nonce += 1; + + // Set the contract ID and owner ID with the random identity + contract.set_owner_id(partial_identity.id); + let old_id = contract.id(); + let new_id = + DataContract::generate_data_contract_id_v0(partial_identity.id, *identity_nonce); + contract.set_id(new_id); + + id_mapping.insert(old_id, new_id); // Store the mapping + + // If there are contract updates, use the mapping to update their ID and owner ID too + if let Some(contract_updates) = contract_updates { + for (_, updated_contract) in contract_updates.iter_mut() { + let updated_contract_data = updated_contract.data_contract_mut(); + // Use the new ID from the mapping + if let Some(new_updated_id) = id_mapping.get(&updated_contract_data.id()) { + updated_contract_data.set_id(*new_updated_id); + } + updated_contract_data.set_owner_id(contract.owner_id()); + } + } + + // Update any document transitions that registered to the old contract id + for op in self.operations.iter_mut() { + if let OperationType::Document(document_op) = &mut op.op_type { + if document_op.contract.id() == old_id { + document_op.contract = contract.clone(); + let document_type = contract.document_type_cloned_for_name(document_op.document_type.name()) + .expect("Expected to get a document type for name while creating initial strategy contracts"); + document_op.document_type = document_type; + } + } + } + + match DataContractCreateTransition::new_from_data_contract( + contract.clone(), + *identity_nonce, + &partial_identity, + partial_identity_public_key.id(), + signer, + platform_version, + None, + ) { + Ok(transition) => transition, + Err(e) => { + tracing::error!("Error creating DataContractCreateTransition: {e}"); + panic!(); + } + } + }) + .collect() + } + + /// Generates state transitions for updating contracts based on the current set of identities and the block height. + /// + /// This function identifies and processes updates for data contracts as specified in the strategy, taking into account + /// the current block height to determine which updates to apply. Each eligible update is matched with its corresponding + /// identity based on ownership, ensuring that contract state transitions reflect the intended changes within the simulation. + /// + /// The function dynamically adjusts contract versions and ownership details, generating update state transitions that + /// are applied to the simulated blockchain environment. This process enables the simulation of contract evolution over + /// time, reflecting real-world scenarios where contracts may be updated in response to changing requirements or conditions. + /// + /// # Parameters + /// - `current_identities`: The list of identities involved in the simulation, used to match contract ownership. + /// - `block_height`: The current block height, used to determine eligibility for contract updates. + /// - `initial_block_height`: The block height at which the simulation or strategy begins, for calculating update timing. + /// - `signer`: A reference to a signer instance for signing contract update transactions. + /// - `contract_nonce_counter`: Tracks nonce values for contract interactions, ensuring uniqueness. + /// - `platform_version`: The platform version, for compatibility with Dash Platform features. + /// + /// # Returns + /// A vector of `StateTransition`, each representing an update to a data contract within the simulation. + /// + /// # Examples + /// ```ignore + /// let contract_update_transitions = strategy.initial_contract_update_state_transitions( + /// ¤t_identities, + /// block_height, + /// initial_block_height, + /// &signer, + /// &mut contract_nonce_counter, + /// &platform_version, + /// ); + /// ``` + /// + /// Through these updates, the simulation accurately mirrors the lifecycle of contracts on the Dash Platform, incorporating + /// changes that may occur over time. + pub fn initial_contract_update_state_transitions( + &mut self, + current_identities: &[Identity], + block_height: u64, + initial_block_height: u64, + signer: &SimpleSigner, + contract_nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, + platform_version: &PlatformVersion, + ) -> Vec { + // Collect updates + let updates: Vec<_> = self + .start_contracts + .iter() + .flat_map(|(_, contract_updates_option)| { + contract_updates_option + .as_ref() + .map_or_else(Vec::new, |contract_updates| { + contract_updates + .iter() + .filter_map(move |(update_height, contract_update)| { + let adjusted_update_height = + initial_block_height + update_height * 3; + if adjusted_update_height != block_height { + return None; + } + current_identities + .iter() + .find(|identity| { + identity.id() == contract_update.data_contract().owner_id() + }) + .map(|identity| { + (identity.clone(), *update_height, contract_update) + }) + }) + .collect::>() + }) + .into_iter() + }) + .collect(); + + // Increment nonce counter, update data contract version, and create state transitions + updates + .into_iter() + .map(|(identity, update_height, contract_update)| { + let identity_info = identity.into_partial_identity_info(); + let contract_id = contract_update.data_contract().id(); + let nonce = contract_nonce_counter + .entry((identity_info.id, contract_id)) + .and_modify(|e| *e += 1) + .or_insert(1); + + // Set the version number on the data contract + let mut contract_update_clone = contract_update.clone(); + let data_contract = contract_update_clone.data_contract_mut(); + data_contract.set_version(update_height as u32); + + // Create the state transition + DataContractUpdateTransition::new_from_data_contract( + data_contract.clone(), + &identity_info, + 2, // Assuming key id 2 is a high or critical auth key + *nonce, + 0, + signer, + platform_version, + None, + ) + .expect("expected to create a state transition from a data contract") + }) + .collect() + } + + /// Convenience method to get all contract ids that are in operations + pub fn used_contract_ids(&self) -> BTreeSet { + self.operations + .iter() + .filter_map(|operation| match &operation.op_type { + OperationType::Document(document) => Some(document.contract.id()), + OperationType::ContractUpdate(op) => Some(op.contract.id()), + _ => None, + }) + .collect() } } @@ -1146,7 +1852,7 @@ mod tests { use crate::frequency::Frequency; use crate::operations::{DocumentAction, DocumentOp, Operation, OperationType}; use crate::transitions::create_state_transitions_for_identities; - use crate::Strategy; + use crate::{StartIdentities, Strategy}; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::random_document::{ DocumentFieldFillSize, DocumentFieldFillType, @@ -1201,9 +1907,8 @@ mod tests { platform_version, ); - let dpns_contract = - load_system_data_contract(SystemDataContract::DPNS, platform_version.protocol_version) - .expect("data contract"); + let dpns_contract = load_system_data_contract(SystemDataContract::DPNS, platform_version) + .expect("data contract"); let document_op_1 = DocumentOp { contract: dpns_contract.clone(), @@ -1256,7 +1961,7 @@ mod tests { }; let strategy = Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![ Operation { op_type: OperationType::Document(document_op_1), @@ -1273,11 +1978,15 @@ mod tests { }, }, ], - start_identities, - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, + start_identities: StartIdentities { + number_of_identities: 2, + keys_per_identity: 3, + starting_balances: 100_000_000, + extra_keys: BTreeMap::new(), + hard_coded: vec![], }, + identity_inserts: Default::default(), + identity_contract_nonce_gaps: None, signer: Some(simple_signer), }; diff --git a/packages/strategy-tests/src/operations.rs b/packages/strategy-tests/src/operations.rs index c11341fad67..c3e52414cd1 100644 --- a/packages/strategy-tests/src/operations.rs +++ b/packages/strategy-tests/src/operations.rs @@ -16,10 +16,15 @@ use dpp::serialization::{ PlatformDeserializableWithPotentialValidationFromVersionedStructure, PlatformSerializableWithPlatformVersion, }; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; use dpp::ProtocolError; use dpp::ProtocolError::{PlatformDeserializationError, PlatformSerializationError}; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::util::object_size_info::DataContractOwnedResolvedInfo; use platform_version::version::PlatformVersion; -use platform_version::TryIntoPlatformVersioned; +use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; +use rand::distributions::{Distribution, WeightedIndex}; +use rand::prelude::StdRng; use std::collections::BTreeMap; use std::ops::Range; @@ -37,7 +42,8 @@ pub enum DocumentAction { DocumentFieldFillSize, ), DocumentActionDelete, - DocumentActionReplace, + DocumentActionReplaceRandom, + DocumentActionTransferRandom, } #[derive(Clone, Debug, PartialEq)] @@ -93,7 +99,7 @@ impl PlatformSerializableWithPlatformVersion for DocumentOp { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for DocumentOp { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -113,8 +119,12 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Doc document_type_name, action, } = document_op_in_serialization_format; - let data_contract = - DataContract::try_from_platform_versioned(contract, validate, platform_version)?; + let data_contract = DataContract::try_from_platform_versioned( + contract, + full_validation, + &mut vec![], + platform_version, + )?; let document_type = data_contract.document_type_cloned_for_name(document_type_name.as_str())?; Ok(DocumentOp { @@ -172,7 +182,7 @@ impl PlatformSerializableWithPlatformVersion for Operation { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Operation { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -189,8 +199,11 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Ope .0; let OperationInSerializationFormat { op_type, frequency } = operation_in_serialization_format; - let op_type = - OperationType::versioned_deserialize(op_type.as_slice(), validate, platform_version)?; + let op_type = OperationType::versioned_deserialize( + op_type.as_slice(), + full_validation, + platform_version, + )?; Ok(Operation { op_type, frequency }) } } @@ -204,12 +217,283 @@ pub enum IdentityUpdateOp { pub type DocumentTypeNewFieldsOptionalCountRange = Range; pub type DocumentTypeCount = Range; +#[derive(Clone, Debug, PartialEq)] +pub struct DataContractUpdateOp { + pub action: DataContractUpdateAction, + pub contract: DataContract, + pub document_type: Option, +} + #[derive(Clone, Debug, PartialEq, Encode, Decode)] -pub enum DataContractUpdateOp { +pub struct DataContractUpdateOpInSerializationFormat { + action: DataContractUpdateAction, + contract: DataContractInSerializationFormat, + document_type: Option, +} + +#[derive(Clone, Debug, PartialEq, Encode, Decode)] +pub enum DataContractUpdateAction { DataContractNewDocumentTypes(RandomDocumentTypeParameters), // How many fields should it have DataContractNewOptionalFields(DocumentTypeNewFieldsOptionalCountRange, DocumentTypeCount), // How many new fields on how many document types } +impl PlatformSerializableWithPlatformVersion for DataContractUpdateOp { + type Error = ProtocolError; + + fn serialize_to_bytes_with_platform_version( + &self, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + self.clone() + .serialize_consume_to_bytes_with_platform_version(platform_version) + } + + fn serialize_consume_to_bytes_with_platform_version( + self, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let DataContractUpdateOp { + action, + contract, + document_type, + } = self; + + // Serialize contract and optionally document type + let contract_in_serialization_format: DataContractInSerializationFormat = + contract.try_into_platform_versioned(platform_version)?; + + // Convert DocumentType to its serializable schema representation + let document_type_in_serialization_format = document_type.map(|dt| { + // Assuming `schema_owned` or a similar method returns a serializable representation + dt.schema_owned() + }); + + let update_op_in_serialization_format = DataContractUpdateOpInSerializationFormat { + action, + contract: contract_in_serialization_format, + document_type: document_type_in_serialization_format, + }; + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + bincode::encode_to_vec(update_op_in_serialization_format, config).map_err(|e| { + PlatformSerializationError(format!("Unable to serialize DataContractUpdateOp: {}", e)) + }) + } +} + +impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for DataContractUpdateOp { + fn versioned_deserialize( + data: &[u8], + full_validation: bool, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let deserialized: DataContractUpdateOpInSerializationFormat = + bincode::borrow_decode_from_slice(data, config) + .map_err(|e| { + PlatformDeserializationError(format!( + "Unable to deserialize DataContractUpdateOp: {}", + e + )) + })? + .0; + + let contract = DataContract::try_from_platform_versioned( + deserialized.contract, + full_validation, + &mut vec![], + platform_version, + )?; + + let action = deserialized.action; + + let document_type = deserialized.document_type.and_then(|value| { + match value { + Value::Map(map) => { + map.into_iter() + .map(|(name, schema_json)| { + let name_str = name.to_str().expect( + "Couldn't convert document type name to str in deserialization", + ); + let schema = Value::try_from(schema_json).unwrap(); + let owner_id = contract.owner_id(); // Assuming you have a method to get the owner_id from the contract + DocumentType::try_from_schema( + owner_id, + name_str, + schema, + None, + true, + true, + true, + full_validation, + &mut vec![], + platform_version, + ) + .expect("Failed to reconstruct DocumentType from schema") + }) + .next() // Assumes only one document type is being deserialized + } + _ => None, + } + }); + + Ok(DataContractUpdateOp { + action, + contract, + document_type, + }) + } +} + +#[derive(Debug, PartialEq, Clone, Encode, Decode)] +pub struct ContestedDocumentResourceVotePollWithSerializableContract { + /// The contract information associated with the document. + pub contract: DataContractInSerializationFormat, + /// The name of the document type. + pub document_type_name: String, + /// The name of the index. + pub index_name: String, + /// The values used in the index for the poll. + pub index_values: Vec, +} + +impl TryFromPlatformVersioned + for ContestedDocumentResourceVotePollWithSerializableContract +{ + type Error = ProtocolError; + fn try_from_platform_versioned( + value: ContestedDocumentResourceVotePollWithContractInfo, + platform_version: &PlatformVersion, + ) -> Result { + let ContestedDocumentResourceVotePollWithContractInfo { + contract, + document_type_name, + index_name, + index_values, + } = value; + Ok(ContestedDocumentResourceVotePollWithSerializableContract { + contract: contract + .into_owned() + .try_into_platform_versioned(platform_version)?, + document_type_name, + index_name, + index_values, + }) + } +} + +impl TryFromPlatformVersioned + for ContestedDocumentResourceVotePollWithContractInfo +{ + type Error = ProtocolError; + fn try_from_platform_versioned( + value: ContestedDocumentResourceVotePollWithSerializableContract, + platform_version: &PlatformVersion, + ) -> Result { + let ContestedDocumentResourceVotePollWithSerializableContract { + contract, + document_type_name, + index_name, + index_values, + } = value; + Ok(ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::OwnedDataContract( + DataContract::try_from_platform_versioned( + contract, + false, + &mut vec![], + platform_version, + )?, + ), + document_type_name, + index_name, + index_values, + }) + } +} + +#[derive(Clone, Debug, PartialEq)] +pub struct ResourceVoteOp { + pub resolved_vote_poll: ContestedDocumentResourceVotePollWithContractInfo, + pub action: VoteAction, +} + +#[derive(Clone, Debug, PartialEq, Encode, Decode)] +pub struct ResourceVoteOpSerializable { + pub resolved_vote_poll: ContestedDocumentResourceVotePollWithSerializableContract, + pub action: VoteAction, +} + +impl TryFromPlatformVersioned for ResourceVoteOp { + type Error = ProtocolError; + + fn try_from_platform_versioned( + value: ResourceVoteOpSerializable, + platform_version: &PlatformVersion, + ) -> Result { + let ResourceVoteOpSerializable { + resolved_vote_poll, + action, + } = value; + + Ok(ResourceVoteOp { + resolved_vote_poll: resolved_vote_poll.try_into_platform_versioned(platform_version)?, + action, + }) + } +} + +impl TryFromPlatformVersioned for ResourceVoteOpSerializable { + type Error = ProtocolError; + + fn try_from_platform_versioned( + value: ResourceVoteOp, + platform_version: &PlatformVersion, + ) -> Result { + let ResourceVoteOp { + resolved_vote_poll, + action, + } = value; + + Ok(ResourceVoteOpSerializable { + resolved_vote_poll: resolved_vote_poll.try_into_platform_versioned(platform_version)?, + action, + }) + } +} + +#[derive(Clone, Debug, PartialEq, Encode, Decode)] +pub struct VoteAction { + pub vote_choices_with_weights: Vec<(ResourceVoteChoice, u8)>, +} + +impl VoteAction { + // Function to choose a ResourceVoteChoice based on weights + pub fn choose_weighted_choice(&self, rng: &mut StdRng) -> ResourceVoteChoice { + if self.vote_choices_with_weights.is_empty() { + ResourceVoteChoice::Abstain + } else if self.vote_choices_with_weights.len() == 1 { + self.vote_choices_with_weights[0].0 + } else { + let weights: Vec = self + .vote_choices_with_weights + .iter() + .map(|(_, weight)| *weight) + .collect(); + let dist = WeightedIndex::new(weights).unwrap(); + let index = dist.sample(rng); + self.vote_choices_with_weights[index].0 + } + } +} + #[derive(Clone, Debug, PartialEq)] pub enum OperationType { Document(DocumentOp), @@ -219,20 +503,19 @@ pub enum OperationType { ContractCreate(RandomDocumentTypeParameters, DocumentTypeCount), ContractUpdate(DataContractUpdateOp), IdentityTransfer, + ResourceVote(ResourceVoteOp), } #[derive(Clone, Debug, Encode, Decode)] enum OperationTypeInSerializationFormat { - OperationTypeInSerializationFormatDocument(Vec), - OperationTypeInSerializationFormatIdentityTopUp, - OperationTypeInSerializationFormatIdentityUpdate(IdentityUpdateOp), - OperationTypeInSerializationFormatIdentityWithdrawal, - OperationTypeInSerializationFormatContractCreate( - RandomDocumentTypeParameters, - DocumentTypeCount, - ), - OperationTypeInSerializationFormatContractUpdate(DataContractUpdateOp), - OperationTypeInSerializationFormatIdentityTransfer, + Document(Vec), + IdentityTopUp, + IdentityUpdate(IdentityUpdateOp), + IdentityWithdrawal, + ContractCreate(RandomDocumentTypeParameters, DocumentTypeCount), + ContractUpdate(Vec), + IdentityTransfer, + ResourceVote(ResourceVoteOpSerializable), } impl PlatformSerializableWithPlatformVersion for OperationType { @@ -253,26 +536,33 @@ impl PlatformSerializableWithPlatformVersion for OperationType { let op = match self { OperationType::Document(document_op) => { // let's just serialize it to make things easier - let document_op_in_serialization_format = document_op.serialize_consume_to_bytes_with_platform_version(platform_version)?; - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatDocument(document_op_in_serialization_format) - } - OperationType::IdentityTopUp => { - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityTopUp + let document_op_in_serialization_format = document_op + .serialize_consume_to_bytes_with_platform_version(platform_version)?; + OperationTypeInSerializationFormat::Document(document_op_in_serialization_format) } + OperationType::IdentityTopUp => OperationTypeInSerializationFormat::IdentityTopUp, OperationType::IdentityUpdate(identity_update_op) => { - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityUpdate(identity_update_op) + OperationTypeInSerializationFormat::IdentityUpdate(identity_update_op) } OperationType::IdentityWithdrawal => { - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityWithdrawal + OperationTypeInSerializationFormat::IdentityWithdrawal } OperationType::ContractCreate(p, c) => { - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatContractCreate(p,c) + OperationTypeInSerializationFormat::ContractCreate(p, c) } OperationType::ContractUpdate(update_op) => { - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatContractUpdate(update_op) + // let's just serialize it to make things easier + let contract_op_in_serialization_format = + update_op.serialize_consume_to_bytes_with_platform_version(platform_version)?; + OperationTypeInSerializationFormat::ContractUpdate( + contract_op_in_serialization_format, + ) } - OperationType::IdentityTransfer => { - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityTransfer + OperationType::IdentityTransfer => OperationTypeInSerializationFormat::IdentityTransfer, + OperationType::ResourceVote(resource_vote_op) => { + let vote_op_in_serialization_format = + resource_vote_op.try_into_platform_versioned(platform_version)?; + OperationTypeInSerializationFormat::ResourceVote(vote_op_in_serialization_format) } }; let config = bincode::config::standard() @@ -287,7 +577,7 @@ impl PlatformSerializableWithPlatformVersion for OperationType { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for OperationType { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -303,27 +593,36 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Ope })? .0; Ok(match operation_type { - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatDocument(serialized_op) => { - let document_op = DocumentOp::versioned_deserialize(serialized_op.as_slice(), validate, platform_version)?; + OperationTypeInSerializationFormat::Document(serialized_op) => { + let document_op = DocumentOp::versioned_deserialize( + serialized_op.as_slice(), + full_validation, + platform_version, + )?; OperationType::Document(document_op) } - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityTopUp => { - OperationType::IdentityTopUp - } - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityUpdate(identity_update_op) => { + OperationTypeInSerializationFormat::IdentityTopUp => OperationType::IdentityTopUp, + OperationTypeInSerializationFormat::IdentityUpdate(identity_update_op) => { OperationType::IdentityUpdate(identity_update_op) } - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityWithdrawal => { + OperationTypeInSerializationFormat::IdentityWithdrawal => { OperationType::IdentityWithdrawal } - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatContractCreate(p, c) => { + OperationTypeInSerializationFormat::ContractCreate(p, c) => { OperationType::ContractCreate(p, c) } - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatContractUpdate(update_op) => { + OperationTypeInSerializationFormat::ContractUpdate(serialized_op) => { + let update_op = DataContractUpdateOp::versioned_deserialize( + serialized_op.as_slice(), + full_validation, + platform_version, + )?; OperationType::ContractUpdate(update_op) } - OperationTypeInSerializationFormat::OperationTypeInSerializationFormatIdentityTransfer => { - OperationType::IdentityTransfer + OperationTypeInSerializationFormat::IdentityTransfer => OperationType::IdentityTransfer, + OperationTypeInSerializationFormat::ResourceVote(resource_vote_op) => { + let vote_op = resource_vote_op.try_into_platform_versioned(platform_version)?; + OperationType::ResourceVote(vote_op) } }) } diff --git a/packages/strategy-tests/src/transitions.rs b/packages/strategy-tests/src/transitions.rs index 558e1b2cf77..5a456afa3a8 100644 --- a/packages/strategy-tests/src/transitions.rs +++ b/packages/strategy-tests/src/transitions.rs @@ -13,16 +13,20 @@ use dpp::identity::identity_public_key::accessors::v0::{ }; use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; use dpp::identity::KeyType::ECDSA_SECP256K1; -use dpp::identity::Purpose::AUTHENTICATION; +use dpp::identity::Purpose::{AUTHENTICATION, TRANSFER}; use dpp::identity::SecurityLevel::{CRITICAL, MASTER}; use dpp::identity::{Identity, IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; use dpp::prelude::AssetLockProof; use dpp::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; use dpp::state_transition::identity_create_transition::IdentityCreateTransition; use dpp::state_transition::identity_credit_transfer_transition::v0::IdentityCreditTransferTransitionV0; +use dpp::ProtocolError; -use dpp::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +use dpp::state_transition::identity_credit_withdrawal_transition::v0::{ + IdentityCreditWithdrawalTransitionV0, MIN_CORE_FEE_PER_BYTE, +}; +use dpp::native_bls::NativeBlsModule; use dpp::state_transition::identity_topup_transition::methods::IdentityTopUpTransitionMethodsV0; use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; use dpp::state_transition::identity_update_transition::methods::IdentityUpdateTransitionMethodsV0; @@ -30,13 +34,13 @@ use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; use dpp::state_transition::{GetDataContractSecurityLevelRequirementFn, StateTransition}; use dpp::version::PlatformVersion; use dpp::withdrawal::Pooling; -use dpp::NativeBlsModule; use rand::prelude::{IteratorRandom, StdRng}; use simple_signer::signer::SimpleSigner; +use crate::KeyMaps; use dpp::dashcore::transaction::special_transaction::asset_lock::AssetLockPayload; use dpp::dashcore::transaction::special_transaction::TransactionPayload; -use std::collections::HashSet; +use std::collections::{BTreeMap, HashSet}; use std::str::FromStr; /// Constructs an `AssetLockProof` representing an instant asset lock proof. @@ -219,27 +223,28 @@ pub fn instant_asset_lock_is_lock_fixture(tx_id: Txid) -> InstantLock { /// - If there's an error in converting the generated public key to its private counterpart. /// - If there's an error during the creation of the identity top-up transition. pub fn create_identity_top_up_transition( - rng: &mut StdRng, identity: &Identity, + asset_lock_proofs: &mut Vec<(AssetLockProof, PrivateKey)>, platform_version: &PlatformVersion, -) -> StateTransition { - let (_, pk) = ECDSA_SECP256K1 - .random_public_and_private_key_data(rng, platform_version) - .unwrap(); - let sk: [u8; 32] = pk.try_into().unwrap(); - let secret_key = SecretKey::from_str(hex::encode(sk).as_str()).unwrap(); - let asset_lock_proof = - instant_asset_lock_proof_fixture(PrivateKey::new(secret_key, Network::Dash)); - - IdentityTopUpTransition::try_from_identity( - identity.clone(), - asset_lock_proof, - secret_key.as_ref(), - &NativeBlsModule, - platform_version, - None, - ) - .expect("expected to create top up transition") +) -> Result { + if let Some(proof_and_pk) = asset_lock_proofs.pop() { + let (asset_lock_proof, private_key) = proof_and_pk; + let pk_bytes = private_key.to_bytes(); + + IdentityTopUpTransition::try_from_identity( + identity, + asset_lock_proof, + pk_bytes.as_ref(), + 0, + platform_version, + None, + ) + .map_err(|e| ProtocolError::Generic(format!("Error creating top up transition: {:?}", e))) + } else { + Err(ProtocolError::Generic( + "No asset lock proofs available for create_identity_top_up_transition".to_string(), + )) + } } /// Creates a state transition for updating an identity by adding a specified number of new public authentication keys. @@ -282,13 +287,25 @@ pub fn create_identity_top_up_transition( pub fn create_identity_update_transition_add_keys( identity: &mut Identity, count: u16, + keys_already_added_this_block_count: u32, + identity_nonce_counter: &mut BTreeMap, signer: &mut SimpleSigner, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> (StateTransition, (Identifier, Vec)) { identity.bump_revision(); + + let start_id = (identity + .public_keys() + .values() + .map(|pk| pk.id()) + .max() + .expect("Expected a max public key id") as u32 + + keys_already_added_this_block_count + + 1) as KeyID; + let keys = IdentityPublicKey::random_authentication_keys_with_private_keys_with_rng( - identity.public_keys().len() as KeyID, + start_id, count as u32, rng, platform_version, @@ -303,17 +320,21 @@ pub fn create_identity_update_transition_add_keys( .find(|(_, key)| key.security_level() == MASTER) .expect("expected to have a master key"); + let identity_nonce = identity_nonce_counter.entry(identity.id()).or_default(); + *identity_nonce += 1; + let state_transition = IdentityUpdateTransition::try_from_identity_with_signer( identity, key_id, add_public_keys.clone(), vec![], - None, + *identity_nonce, + 0, signer, platform_version, None, ) - .expect("expected to create top up transition"); + .expect("expected to create an AddKeys transition"); (state_transition, (identity.id(), add_public_keys)) } @@ -360,6 +381,7 @@ pub fn create_identity_update_transition_add_keys( pub fn create_identity_update_transition_disable_keys( identity: &mut Identity, count: u16, + identity_nonce_counter: &mut BTreeMap, block_time: u64, signer: &mut SimpleSigner, rng: &mut StdRng, @@ -376,6 +398,7 @@ pub fn create_identity_update_transition_disable_keys( && !(key.security_level() == CRITICAL && key.purpose() == AUTHENTICATION && key.key_type() == ECDSA_SECP256K1)) + && key.purpose() != TRANSFER }) .map(|(key_id, _)| *key_id) .collect::>(); @@ -406,17 +429,21 @@ pub fn create_identity_update_transition_disable_keys( .find(|(_, key)| key.security_level() == MASTER) .expect("expected to have a master key"); + let identity_nonce = identity_nonce_counter.entry(identity.id()).or_default(); + *identity_nonce += 1; + let state_transition = IdentityUpdateTransition::try_from_identity_with_signer( identity, key_id, vec![], key_ids_to_disable, - Some(block_time), + *identity_nonce, + 0, signer, platform_version, None, ) - .expect("expected to create top up transition"); + .expect("expected to create a DisableKeys transition"); Some(state_transition) } @@ -452,17 +479,20 @@ pub fn create_identity_update_transition_disable_keys( /// - If there's an error during the signing process. pub fn create_identity_withdrawal_transition( identity: &mut Identity, + identity_nonce_counter: &mut BTreeMap, signer: &mut SimpleSigner, rng: &mut StdRng, ) -> StateTransition { - identity.bump_revision(); + let nonce = identity_nonce_counter.entry(identity.id()).or_default(); + *nonce += 1; let mut withdrawal: StateTransition = IdentityCreditWithdrawalTransitionV0 { identity_id: identity.id(), - amount: 100000000, // 0.001 Dash - core_fee_per_byte: 1, + amount: 1000000, // 1 duff + core_fee_per_byte: MIN_CORE_FEE_PER_BYTE, pooling: Pooling::Never, output_script: CoreScript::random_p2sh(rng), - revision: identity.revision(), + nonce: *nonce, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } @@ -470,9 +500,16 @@ pub fn create_identity_withdrawal_transition( let identity_public_key = identity .get_first_public_key_matching( - Purpose::AUTHENTICATION, + Purpose::TRANSFER, HashSet::from([SecurityLevel::CRITICAL]), - HashSet::from([KeyType::ECDSA_SECP256K1, KeyType::BLS12_381]), + HashSet::from([ + KeyType::ECDSA_SECP256K1, + KeyType::BLS12_381, + KeyType::ECDSA_HASH160, + KeyType::BIP13_SCRIPT_HASH, + KeyType::EDDSA_25519_HASH160, + ]), + false, ) .expect("expected to get a signing key"); @@ -520,15 +557,20 @@ pub fn create_identity_withdrawal_transition( /// - If the sender's identity does not have a suitable authentication key available for signing. /// - If there's an error during the signing process. pub fn create_identity_credit_transfer_transition( - identity: &Identity, + identity: &mut Identity, recipient: &Identity, + identity_nonce_counter: &mut BTreeMap, signer: &mut SimpleSigner, amount: u64, ) -> StateTransition { + let nonce = identity_nonce_counter.entry(identity.id()).or_default(); + *nonce += 1; let mut transition: StateTransition = IdentityCreditTransferTransitionV0 { identity_id: identity.id(), recipient_id: recipient.id(), amount, + nonce: *nonce, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } @@ -536,9 +578,10 @@ pub fn create_identity_credit_transfer_transition( let identity_public_key = identity .get_first_public_key_matching( - Purpose::AUTHENTICATION, + Purpose::TRANSFER, HashSet::from([SecurityLevel::CRITICAL]), HashSet::from([KeyType::ECDSA_SECP256K1, KeyType::BLS12_381]), + false, ) .expect("expected to get a signing key"); @@ -593,19 +636,105 @@ pub fn create_identity_credit_transfer_transition( pub fn create_identities_state_transitions( count: u16, key_count: KeyID, + extra_keys: &KeyMaps, + _balance: u64, signer: &mut SimpleSigner, rng: &mut StdRng, + asset_lock_proofs: &mut Vec<(AssetLockProof, PrivateKey)>, platform_version: &PlatformVersion, -) -> Vec<(Identity, StateTransition)> { - let (identities, keys) = Identity::random_identities_with_private_keys_with_rng::>( - count, - key_count, - rng, - platform_version, - ) - .expect("expected to create identities"); +) -> Result, ProtocolError> { + let (mut identities, mut keys) = + Identity::random_identities_with_private_keys_with_rng::>( + count, + key_count, + rng, + platform_version, + ) + .expect("Expected to create identities and keys"); + + let starting_id_num = signer + .private_keys + .keys() + .max() + .map_or(0, |max_key| max_key.id() + 1); + + for (i, identity) in identities.iter_mut().enumerate() { + // TODO: deal with the case where there's more than one extra key + for (_, (purpose, security_to_key_type_map)) in extra_keys.iter().enumerate() { + for (security_level, key_types) in security_to_key_type_map { + for key_type in key_types { + let (key, private_key) = IdentityPublicKey::random_key_with_known_attributes( + (identity.public_keys().len() + 1) as KeyID, + rng, + *purpose, + *security_level, + *key_type, + None, + platform_version, + )?; + identity.add_public_key(key.clone()); + let key_num = key_count as usize * (i + 1) + i; + keys.insert(key_num, (key, private_key)) + } + } + } + } + + // Update keys with new KeyIDs and add them to signer + let mut current_id_num = starting_id_num; + for (key, _) in &mut keys { + let IdentityPublicKey::V0(ref mut id_pub_key_v0) = key; + id_pub_key_v0.set_id(current_id_num); + current_id_num += 1; // Increment for each key + } signer.add_keys(keys); - create_state_transitions_for_identities(identities, signer, rng, platform_version) + + // Generate state transitions for each identity + identities + .into_iter() + .enumerate() + .map(|(index, mut identity)| { + // Calculate the starting KeyID for this identity + let identity_starting_id = + starting_id_num + index as u32 * (key_count + extra_keys.len() as u32); + + // Update the identity with the new KeyIDs + let public_keys_map = identity.public_keys_mut(); + public_keys_map + .values_mut() + .enumerate() + .for_each(|(key_index, public_key)| { + let IdentityPublicKey::V0(ref mut id_pub_key_v0) = public_key; + let new_id = identity_starting_id + key_index as u32; + id_pub_key_v0.set_id(new_id); + }); + + if let Some(proof_and_pk) = asset_lock_proofs.pop() { + let (asset_lock_proof, private_key) = proof_and_pk; + let pk = private_key.to_bytes(); + match IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + &pk, + signer, + &NativeBlsModule, + 0, + platform_version, + ) { + Ok(identity_create_transition) => { + identity.set_id(identity_create_transition.owner_id()); + Ok((identity, identity_create_transition)) + } + Err(e) => Err(e), + } + } else { + Err(ProtocolError::Generic( + "No asset lock proofs available for create_identities_state_transitions" + .to_string(), + )) + } + }) + .collect::, ProtocolError>>() } /// Generates state transitions for the creation of new identities. @@ -646,7 +775,7 @@ pub fn create_identities_state_transitions( /// - Conversion and encoding errors related to the cryptographic data. pub fn create_state_transitions_for_identities( identities: Vec, - signer: &mut SimpleSigner, + signer: &SimpleSigner, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> Vec<(Identity, StateTransition)> { @@ -656,17 +785,44 @@ pub fn create_state_transitions_for_identities( let (_, pk) = ECDSA_SECP256K1 .random_public_and_private_key_data(rng, platform_version) .unwrap(); - let sk: [u8; 32] = pk.clone().try_into().unwrap(); + let sk: [u8; 32] = pk.try_into().unwrap(); let secret_key = SecretKey::from_str(hex::encode(sk).as_str()).unwrap(); let asset_lock_proof = instant_asset_lock_proof_fixture(PrivateKey::new(secret_key, Network::Dash)); let identity_create_transition = IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), + &identity.clone(), + asset_lock_proof, + &sk, + signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected to transform identity into identity create transition"); + identity.set_id(identity_create_transition.owner_id()); + + (identity, identity_create_transition) + }) + .collect() +} + +pub fn create_state_transitions_for_identities_and_proofs( + identities_with_proofs: Vec<(Identity, [u8; 32], AssetLockProof)>, + signer: &mut SimpleSigner, + platform_version: &PlatformVersion, +) -> Vec<(Identity, StateTransition)> { + identities_with_proofs + .into_iter() + .map(|(mut identity, private_key, asset_lock_proof)| { + let identity_create_transition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity.clone(), asset_lock_proof, - pk.as_slice(), + &private_key, signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected to transform identity into identity create transition"); diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 9b4475b932e..5906e098d1f 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "7.25.21", + "version": "8.1.0-dev.1", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", @@ -29,10 +29,6 @@ "examples", "src" ], - "repository": { - "type": "git", - "url": "git+https://github.com/dashevo/wallet-lib.git" - }, "keywords": [ "cryptocurrency", "dash", @@ -40,13 +36,17 @@ ], "author": "Dash Core Team", "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, "bugs": { - "url": "https://github.com/dashevo/wallet-lib/issues" + "url": "https://github.com/dashpay/platform/issues" }, - "homepage": "https://github.com/dashevo/wallet-lib#readme", + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/wallet-lib#readme", "dependencies": { "@dashevo/dapi-client": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.3", "@dashevo/grpc-common": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", "@yarnpkg/pnpify": "^4.0.0-rc.42", @@ -72,7 +72,7 @@ "eslint-plugin-import": "^2.29.0", "events": "^3.3.0", "https-browserify": "^1.0.0", - "karma": "^6.4.1", + "karma": "^6.4.3", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.1.2", diff --git a/packages/wallet-lib/src/plugins/Plugins/ChainPlugin.js b/packages/wallet-lib/src/plugins/Plugins/ChainPlugin.js index 87739b3bc98..66edb59a25b 100644 --- a/packages/wallet-lib/src/plugins/Plugins/ChainPlugin.js +++ b/packages/wallet-lib/src/plugins/Plugins/ChainPlugin.js @@ -26,7 +26,8 @@ class ChainPlugin extends StandardPlugin { /** * Used on ChainPlugin to be able to report on BLOCKHEIGHT_CHANGED. - * Neither Block or Blockheader contains blockheight, we need to fetch it from getStatus.blocks + * Neither Block or Blockheader contains blockheight, we need to fetch it + * from getBlockchainStatus.blocks * @return {Promise} */ async execStatusFetch() { diff --git a/packages/wallet-lib/src/plugins/Workers/IdentitySyncWorker.js b/packages/wallet-lib/src/plugins/Workers/IdentitySyncWorker.js index 2cc17bd8301..f9ed5183b6a 100644 --- a/packages/wallet-lib/src/plugins/Workers/IdentitySyncWorker.js +++ b/packages/wallet-lib/src/plugins/Workers/IdentitySyncWorker.js @@ -1,4 +1,5 @@ const { default: loadDpp, Identity } = require('@dashevo/wasm-dpp'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); const Worker = require('../Worker'); @@ -68,28 +69,29 @@ class IdentitySyncWorker extends Worker { const { privateKey } = this.identities.getIdentityHDKeyByIndex(index, 0); const publicKey = privateKey.toPublicKey(); - // TODO: rework with singular `getIdentityByPublicKeyHash`? - // (needs to be implemented in the transport and dapi) - // eslint-disable-next-line no-await-in-loop - const identityBuffers = await this.transport.getIdentitiesByPublicKeyHashes( - [publicKey.hash], - ); - - // if identity is not preset then increment gap count - // and stop sync if gap limit is reached - if (!identityBuffers[0]) { - gapCount += 1; - - if (gapCount >= this.gapLimit) { - break; + let identityBuffer; + try { + // eslint-disable-next-line no-await-in-loop + identityBuffer = await this.transport.getIdentityByPublicKeyHash( + publicKey.hash, + ); + } catch (e) { + // if identity is not preset then increment gap count + // and stop sync if gap limit is reached + if (e.code === GrpcErrorCodes.NOT_FOUND) { + gapCount += 1; + + if (gapCount >= this.gapLimit) { + break; + } + + // eslint-disable-next-line no-continue + continue; + } else { + throw e; } - - // eslint-disable-next-line no-continue - continue; } - const [identityBuffer] = identityBuffers; - // If it's not an undefined and not a buffer or Identifier (which inherits Buffer), // this method will loop forever. // This check prevents this from happening diff --git a/packages/wallet-lib/src/test/mocks/TransportMock.js b/packages/wallet-lib/src/test/mocks/TransportMock.js index e52d659e46b..d4ea750e076 100644 --- a/packages/wallet-lib/src/test/mocks/TransportMock.js +++ b/packages/wallet-lib/src/test/mocks/TransportMock.js @@ -1,5 +1,6 @@ const EventEmitter = require('events'); -const getStatus = require('../../transport/FixtureTransport/methods/getStatus'); +const NotFoundError = require('@dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError'); +const getBlockchainStatus = require('../../transport/FixtureTransport/methods/getBlockchainStatus'); class TransportMock extends EventEmitter { constructor(sinon, transactionStreamMock) { @@ -21,11 +22,12 @@ class TransportMock extends EventEmitter { nonce: 351770, }); this.subscribeToBlocks = sinon.stub(); - this.getIdentitiesByPublicKeyHashes = sinon.stub().returns([]); + this.getIdentityByPublicKeyHash = sinon.stub() + .rejects(new NotFoundError('Identity not found', {}, null)); this.sendTransaction = sinon.stub(); this.getTransaction = sinon.stub(); this.getBlockHeaderByHash = sinon.stub(); - this.getStatus = sinon.stub().resolves(getStatus.call(this)); + this.getBlockchainStatus = sinon.stub().resolves(getBlockchainStatus.call(this)); const provider = new EventEmitter(); provider.stop = sinon.stub().callsFake(() => { diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/DAPIClientTransport.js b/packages/wallet-lib/src/transport/DAPIClientTransport/DAPIClientTransport.js index b120486e387..7e8f6f2663c 100644 --- a/packages/wallet-lib/src/transport/DAPIClientTransport/DAPIClientTransport.js +++ b/packages/wallet-lib/src/transport/DAPIClientTransport/DAPIClientTransport.js @@ -11,6 +11,7 @@ class DAPIClientTransport extends AbstractTransport { } } +DAPIClientTransport.prototype.disconnect = require('./methods/disconnect'); DAPIClientTransport.prototype.getBestBlock = require('./methods/getBestBlock'); DAPIClientTransport.prototype.getBestBlockHeader = require('./methods/getBestBlockHeader'); DAPIClientTransport.prototype.getBestBlockHash = require('./methods/getBestBlockHash'); @@ -19,10 +20,10 @@ DAPIClientTransport.prototype.getBlockByHash = require('./methods/getBlockByHash DAPIClientTransport.prototype.getBlockByHeight = require('./methods/getBlockByHeight'); DAPIClientTransport.prototype.getBlockHeaderByHash = require('./methods/getBlockHeaderByHash'); DAPIClientTransport.prototype.getBlockHeaderByHeight = require('./methods/getBlockHeaderByHeight'); -DAPIClientTransport.prototype.getStatus = require('./methods/getStatus'); +DAPIClientTransport.prototype.getBlockchainStatus = require('./methods/getBlockchainStatus'); DAPIClientTransport.prototype.getTransaction = require('./methods/getTransaction'); DAPIClientTransport.prototype.sendTransaction = require('./methods/sendTransaction'); -DAPIClientTransport.prototype.getIdentitiesByPublicKeyHashes = require('./methods/getIdentitiesByPublicKeyHashes'); +DAPIClientTransport.prototype.getIdentityByPublicKeyHash = require('./methods/getIdentityByPublicKeyHash'); DAPIClientTransport.prototype.subscribeToTransactionsWithProofs = require('./methods/subscribeToTransactionsWithProofs'); module.exports = DAPIClientTransport; diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/disconnect.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/disconnect.js new file mode 100644 index 00000000000..9bb5812019e --- /dev/null +++ b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/disconnect.js @@ -0,0 +1,7 @@ +const logger = require('../../../logger'); + +module.exports = async function disconnect() { + logger.silly('DAPIClientTransport.disconnect'); + + return this.client.disconnect(); +}; diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.js index ffabc94492d..e36257f6d15 100644 --- a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.js +++ b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.js @@ -3,8 +3,5 @@ const logger = require('../../../logger'); module.exports = async function getBestBlockHeight() { logger.silly('DAPIClientTransport.getBestBlockHeight'); - // Previously we would have done getBlock(hash).height - const { chain: { blocksCount } } = await this.getStatus(); - - return blocksCount; + return this.client.core.getBestBlockHeight(); }; diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.spec.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.spec.js index 298d867090c..81d6d505da6 100644 --- a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.spec.js +++ b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBestBlockHeight.spec.js @@ -2,7 +2,7 @@ const { expect } = require('chai'); const DAPIClientTransport = require('../DAPIClientTransport'); -const getStatus = require('../../FixtureTransport/methods/getStatus'); +const getBlockchainStatus = require('../../FixtureTransport/methods/getBlockchainStatus'); describe('transports - DAPIClientTransport - .getBestBlockHeight', function suite() { let fixture; @@ -10,11 +10,11 @@ describe('transports - DAPIClientTransport - .getBestBlockHeight', function suit let clientMock; beforeEach(() => { - fixture = getStatus(); + fixture = getBlockchainStatus(); clientMock = { core: { - getStatus: () => fixture, + getBestBlockHeight: () => 1, } } @@ -28,6 +28,6 @@ describe('transports - DAPIClientTransport - .getBestBlockHeight', function suit it('should work', async () => { const res = await transport.getBestBlockHeight(); - expect(res).to.deep.equal(fixture.blocks); + expect(res).to.deep.equal(1); }); }); diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBlockchainStatus.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBlockchainStatus.js new file mode 100644 index 00000000000..44faa64ada8 --- /dev/null +++ b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBlockchainStatus.js @@ -0,0 +1,7 @@ +const logger = require('../../../logger'); + +module.exports = async function getBlockchainStatus() { + logger.silly('DAPIClientTransport.getBlockchainStatus'); + + return this.client.core.getBlockchainStatus(); +}; diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBlockchainStatus.spec.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBlockchainStatus.spec.js new file mode 100644 index 00000000000..705462a5187 --- /dev/null +++ b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getBlockchainStatus.spec.js @@ -0,0 +1,33 @@ +const { expect } = require('chai'); + +const DAPIClientTransport = require('../DAPIClientTransport'); + +describe('transports - DAPIClientTransport - .getBlockchainStatus', function suite() { + let fixture; + let transport; + let clientMock; + + beforeEach(() => { + fixture = { + coreVersion: 150000, protocolVersion: 70216, blocks: 9495, timeOffset: 0, connections: 16, proxy: '', difficulty: 0.001447319555790497, testnet: false, relayFee: 0.00001, errors: '', network: 'testnet', + }; + + clientMock = { + core: { + getBlockchainStatus: () => fixture, + } + } + + transport = new DAPIClientTransport(clientMock); + }) + + afterEach(() => { + transport.disconnect(); + }) + + it('should work', async () => { + const res = await transport.getBlockchainStatus(); + + expect(res).to.deep.equal(fixture); + }); +}); diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getIdentitiesByPublicKeyHashes.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getIdentitiesByPublicKeyHashes.js deleted file mode 100644 index e193f16ee3b..00000000000 --- a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getIdentitiesByPublicKeyHashes.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @param {Buffer[]} publicKeyHashes - * @return {Promise} - */ -module.exports = async function getIdentitiesByPublicKeyHashes(publicKeyHashes) { - const response = await this.client.platform.getIdentitiesByPublicKeyHashes( - publicKeyHashes, - ); - - return response.getIdentities(); -}; diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getIdentityByPublicKeyHash.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getIdentityByPublicKeyHash.js new file mode 100644 index 00000000000..00fa5e1286c --- /dev/null +++ b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getIdentityByPublicKeyHash.js @@ -0,0 +1,11 @@ +/** + * @param {Buffer} publicKeyHash + * @return {Promise} + */ +module.exports = async function getIdentityByPublicKeyHash(publicKeyHash) { + const response = await this.client.platform.getIdentityByPublicKeyHash( + publicKeyHash, + ); + + return response.getIdentity(); +}; diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getStatus.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getStatus.js deleted file mode 100644 index 0e1d021a2ea..00000000000 --- a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getStatus.js +++ /dev/null @@ -1,7 +0,0 @@ -const logger = require('../../../logger'); - -module.exports = async function getStatus() { - logger.silly('DAPIClientTransport.getStatus'); - - return this.client.core.getStatus(); -}; diff --git a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getStatus.spec.js b/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getStatus.spec.js deleted file mode 100644 index fd43867d538..00000000000 --- a/packages/wallet-lib/src/transport/DAPIClientTransport/methods/getStatus.spec.js +++ /dev/null @@ -1,33 +0,0 @@ -const { expect } = require('chai'); - -const DAPIClientTransport = require('../DAPIClientTransport'); - -describe('transports - DAPIClientTransport - .getStatus', function suite() { - let fixture; - let transport; - let clientMock; - - beforeEach(() => { - fixture = { - coreVersion: 150000, protocolVersion: 70216, blocks: 9495, timeOffset: 0, connections: 16, proxy: '', difficulty: 0.001447319555790497, testnet: false, relayFee: 0.00001, errors: '', network: 'testnet', - }; - - clientMock = { - core: { - getStatus: () => fixture, - } - } - - transport = new DAPIClientTransport(clientMock); - }) - - afterEach(() => { - transport.disconnect(); - }) - - it('should work', async () => { - const res = await transport.getStatus(); - - expect(res).to.deep.equal(fixture); - }); -}); diff --git a/packages/wallet-lib/src/transport/FixtureTransport/FixtureTransport.js b/packages/wallet-lib/src/transport/FixtureTransport/FixtureTransport.js index 94a0d96ebad..d6c98b0c652 100644 --- a/packages/wallet-lib/src/transport/FixtureTransport/FixtureTransport.js +++ b/packages/wallet-lib/src/transport/FixtureTransport/FixtureTransport.js @@ -63,7 +63,7 @@ FixtureTransport.prototype.getBlockByHash = require('./methods/getBlockByHash'); FixtureTransport.prototype.getBlockByHeight = require('./methods/getBlockByHeight'); FixtureTransport.prototype.getBlockHeaderByHash = require('./methods/getBlockHeaderByHash'); FixtureTransport.prototype.getBlockHeaderByHeight = require('./methods/getBlockHeaderByHeight'); -FixtureTransport.prototype.getStatus = require('./methods/getStatus'); +FixtureTransport.prototype.getBlockchainStatus = require('./methods/getBlockchainStatus'); FixtureTransport.prototype.getTransaction = require('./methods/getTransaction'); FixtureTransport.prototype.sendTransaction = require('./methods/sendTransaction'); FixtureTransport.prototype.subscribeToAddressesTransactions = require('./methods/subscribeToAddressesTransactions'); diff --git a/packages/wallet-lib/src/transport/FixtureTransport/methods/getBlockchainStatus.js b/packages/wallet-lib/src/transport/FixtureTransport/methods/getBlockchainStatus.js new file mode 100644 index 00000000000..eb36aa8e0ad --- /dev/null +++ b/packages/wallet-lib/src/transport/FixtureTransport/methods/getBlockchainStatus.js @@ -0,0 +1,42 @@ +module.exports = async function getBlockchainStatus() { + const { height, relayFee, network } = this; + + return { + version: { + protocol: 70218, + software: 170000, + agent: '/Dash Core:0.17.0/', + }, + time: { + now: 1616495891, + offset: 0, + median: 1615546573, + }, + status: 'READY', + syncProgress: 0.9999993798366165, + chain: { + name: network, + headersCount: height, + blocksCount: height, + bestBlockHash: '0000007464fd8cae97830d794bf03efbeaa4b8c3258a3def67a89cdbd060f827', + difficulty: 0.002261509525429119, + chainWork: '000000000000000000000000000000000000000000000000022f149b98e063dc', + isSynced: true, + syncProgress: 0.9999993798366165, + }, + masternode: { + status: 'READY', + proTxHash: '04d06d16b3eca2f104ef9749d0c1c17d183eb1b4fe3a16808fd70464f03bcd63', + posePenalty: 0, + isSynced: true, + syncProgress: 1, + }, + network: { + peersCount: 8, + fee: { + relay: relayFee, + incremental: 0.00001, + }, + }, + }; +}; diff --git a/packages/wallet-lib/src/transport/FixtureTransport/methods/getStatus.js b/packages/wallet-lib/src/transport/FixtureTransport/methods/getStatus.js deleted file mode 100644 index 32b4997dad6..00000000000 --- a/packages/wallet-lib/src/transport/FixtureTransport/methods/getStatus.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = async function getStatus() { - const { height, relayFee, network } = this; - - return { - version: { - protocol: 70218, - software: 170000, - agent: '/Dash Core:0.17.0/', - }, - time: { - now: 1616495891, - offset: 0, - median: 1615546573, - }, - status: 'READY', - syncProgress: 0.9999993798366165, - chain: { - name: network, - headersCount: height, - blocksCount: height, - bestBlockHash: '0000007464fd8cae97830d794bf03efbeaa4b8c3258a3def67a89cdbd060f827', - difficulty: 0.002261509525429119, - chainWork: '000000000000000000000000000000000000000000000000022f149b98e063dc', - isSynced: true, - syncProgress: 0.9999993798366165, - }, - masternode: { - status: 'READY', - proTxHash: '04d06d16b3eca2f104ef9749d0c1c17d183eb1b4fe3a16808fd70464f03bcd63', - posePenalty: 0, - isSynced: true, - syncProgress: 1, - }, - network: { - peersCount: 8, - fee: { - relay: relayFee, - incremental: 0.00001, - }, - }, - }; -}; diff --git a/packages/wallet-lib/src/transport/Transport.d.ts b/packages/wallet-lib/src/transport/Transport.d.ts index adaf221c141..9a9697c8975 100644 --- a/packages/wallet-lib/src/transport/Transport.d.ts +++ b/packages/wallet-lib/src/transport/Transport.d.ts @@ -20,9 +20,9 @@ export declare interface Transport { getBlockHeaderByHeight(height: number): Promise - getIdentitiesByPublicKeyHashes(publicKeyHashes: Buffer[]): Promise + getIdentityByPublicKeyHash(publicKeyHash: Buffer): Promise - getStatus(): Promise + getBlockchainStatus(): Promise getTransaction(txid: string): Promise diff --git a/packages/wallet-lib/src/types/Account/Account.d.ts b/packages/wallet-lib/src/types/Account/Account.d.ts index 68e07f2b3c4..974440babe9 100644 --- a/packages/wallet-lib/src/types/Account/Account.d.ts +++ b/packages/wallet-lib/src/types/Account/Account.d.ts @@ -88,6 +88,7 @@ export declare interface getUTXOSOptions { export declare namespace Account { interface Options { index?: number, + synchronize?: boolean, network?: Network; debug?: boolean; label?: string; diff --git a/packages/wallet-lib/src/types/Account/Account.js b/packages/wallet-lib/src/types/Account/Account.js index a51a0145794..b8240f621b2 100644 --- a/packages/wallet-lib/src/types/Account/Account.js +++ b/packages/wallet-lib/src/types/Account/Account.js @@ -56,6 +56,7 @@ class Account extends EventEmitter { if (!wallet || wallet.constructor.name !== Wallet.name) throw new Error('Expected wallet to be passed as param'); if (!_.has(wallet, 'walletId')) throw new Error('Missing walletID to create an account'); this.walletId = wallet.walletId; + this.wallet = wallet; this.logger = logger.getForWallet(this.walletId); this.logger.debug(`Loading up wallet ${this.walletId}`); @@ -223,16 +224,12 @@ class Account extends EventEmitter { return `${EVENTS.INSTANT_LOCK}:${transactionHash}`; } - // It's actually Account that mutates wallet.accounts to add itself. - // We might want to get rid of that as it can be really confusing. - // It would gives that responsability to createAccount to create - // (and therefore push to accounts). async init(wallet) { if (this.state.isInitialized) { return true; } await _addAccountToWallet(this, wallet); - await _initializeAccount(this, wallet.plugins); + await _initializeAccount(this, wallet ? wallet.plugins : this.wallet.plugins); return true; } diff --git a/packages/wallet-lib/src/types/Account/_initializeAccount.js b/packages/wallet-lib/src/types/Account/_initializeAccount.js index 3a034f21e6f..65c69b7a207 100644 --- a/packages/wallet-lib/src/types/Account/_initializeAccount.js +++ b/packages/wallet-lib/src/types/Account/_initializeAccount.js @@ -6,22 +6,6 @@ const preparePlugins = require('./_preparePlugins'); async function _initializeAccount(account, userUnsafePlugins) { const self = account; - // Add default derivation paths - account.addDefaultPaths(); - - // Issue additional derivation paths in case we have transactions in the store - // at the moment of initialization (from persistent storage) - account.createPathsForTransactions(); - - // Add block headers from storage into the SPV chain if there are any - const chainStore = self.storage.getDefaultChainStore(); - const { blockHeaders, lastSyncedHeaderHeight } = chainStore.state; - if (!self.offlineMode) { - const { blockHeadersProvider } = self.transport.client; - const firstHeaderHeight = lastSyncedHeaderHeight - blockHeaders.length + 1; - await blockHeadersProvider.initializeChainWith(blockHeaders, firstHeaderHeight); - } - // We run faster in offlineMode to speed up the process when less happens. const readinessIntervalTime = (account.offlineMode) ? 50 : 200; // TODO: perform rejection with a timeout diff --git a/packages/wallet-lib/src/types/Account/methods/fetchStatus.js b/packages/wallet-lib/src/types/Account/methods/fetchStatus.js index c7727b9f795..9299f3d6e51 100644 --- a/packages/wallet-lib/src/types/Account/methods/fetchStatus.js +++ b/packages/wallet-lib/src/types/Account/methods/fetchStatus.js @@ -8,7 +8,7 @@ async function fetchStatus() { throw new ValidTransportLayerRequired('fetchStatus'); } - return this.transport.getStatus(); + return this.transport.getBlockchainStatus(); } module.exports = fetchStatus; diff --git a/packages/wallet-lib/src/types/Storage/Storage.d.ts b/packages/wallet-lib/src/types/Storage/Storage.d.ts index 58894833008..7e10ad2acab 100644 --- a/packages/wallet-lib/src/types/Storage/Storage.d.ts +++ b/packages/wallet-lib/src/types/Storage/Storage.d.ts @@ -1,9 +1,12 @@ import { WalletStore } from '../WalletStore/WalletStore' +import {ChainStore} from "../ChainStore/ChainStore"; export declare class Storage { constructor(options?: Storage.Options); getWalletStore(walletId: string): WalletStore + getChainStore(network: string): ChainStore + getDefaultChainStore(): ChainStore } export declare namespace Storage { diff --git a/packages/wallet-lib/src/types/Wallet/methods/createAccount.js b/packages/wallet-lib/src/types/Wallet/methods/createAccount.js index 8f49c6ec83b..f74c4bb885c 100644 --- a/packages/wallet-lib/src/types/Wallet/methods/createAccount.js +++ b/packages/wallet-lib/src/types/Wallet/methods/createAccount.js @@ -28,8 +28,29 @@ async function createAccount(accountOpts) { const opts = Object.assign(baseOpts, accountOpts); const account = new Account(this, opts); + + // Add default derivation paths + account.addDefaultPaths(); + + // Issue additional derivation paths in case we have transactions in the store + // at the moment of initialization (from persistent storage) + account.createPathsForTransactions(); + + // Add block headers from storage into the SPV chain if there are any + const chainStore = this.storage.getDefaultChainStore(); + const { blockHeaders, lastSyncedHeaderHeight } = chainStore.state; + if (!this.offlineMode && blockHeaders.length > 0) { + const { blockHeadersProvider } = this.transport.client; + blockHeadersProvider.initializeChainWith(blockHeaders, lastSyncedHeaderHeight); + } + + this.accounts.push(account); + try { - await account.init(this); + if (opts.synchronize) { + await account.init(this); + } + return account; } catch (e) { await account.disconnect(); diff --git a/packages/wallet-lib/src/types/Wallet/methods/getAccount.js b/packages/wallet-lib/src/types/Wallet/methods/getAccount.js index d333c1209ff..8e3f33c7128 100644 --- a/packages/wallet-lib/src/types/Wallet/methods/getAccount.js +++ b/packages/wallet-lib/src/types/Wallet/methods/getAccount.js @@ -2,14 +2,19 @@ const _ = require('lodash'); const { is } = require('../../../utils'); const EVENTS = require('../../../EVENTS'); +const defaultOpts = { + index: 0, + synchronize: true, +}; + /** * Get a specific account per accounts index * @param accountOpts - If the account doesn't exist yet, we create it passing these options * @param accountOpts.index - Default: 0, set a specific index to get + * @param accountOpts.synchronize - Default: true, specifies whether account has to be synchronized * @return {Account} */ - -async function getAccount(accountOpts = {}) { +async function getAccount(accountOpts = defaultOpts) { if (!this.storage.configured) { await new Promise((resolve) => { this.storage.once(EVENTS.CONFIGURED, resolve); }); } @@ -27,7 +32,7 @@ async function getAccount(accountOpts = {}) { const baseOpts = { index: accountIndex }; const opts = Object.assign(baseOpts, accountOpts); - return (acc[0]) || this.createAccount(opts); + return acc[0] || this.createAccount(opts); } module.exports = getAccount; diff --git a/packages/wallet-lib/src/types/types.d.ts b/packages/wallet-lib/src/types/types.d.ts index 950c5491b3e..063ca3912ee 100644 --- a/packages/wallet-lib/src/types/types.d.ts +++ b/packages/wallet-lib/src/types/types.d.ts @@ -106,7 +106,7 @@ export declare type Strategy = "simpleDescendingAccumulator" | 'simpleTransactionOptimizedAccumulator' | Function; export declare type AddressType = "external" | "internal" | "misc"; -// todo: actually, I would vote to move hdextpublic to hdextpubkey +// todo: actually, I would votes to move hdextpublic to hdextpubkey export declare type WalletType = "single_address" | "hdwallet" | "hdextpublic"; export declare type WalletObj = { network?: Network; diff --git a/packages/wallet-lib/tests/integration/types/Wallet.spec.js b/packages/wallet-lib/tests/integration/types/Wallet.spec.js index c3f1069e5c2..8c087ef7c5c 100644 --- a/packages/wallet-lib/tests/integration/types/Wallet.spec.js +++ b/packages/wallet-lib/tests/integration/types/Wallet.spec.js @@ -60,7 +60,7 @@ describe('Wallet', () => { return streamMock; }); - this.sinon.stub(wallet.transport.client.core, 'getStatus') + this.sinon.stub(wallet.transport.client.core, 'getBlockchainStatus') .resolves({ chain: { blocksCount: bestBlockHeight }, network: { fee: 237 } diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index d7c2556c4d2..cf14fc9d130 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "wasm-dpp" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" authors = ["Anton Suprunchuk "] [lib] crate-type = ["cdylib"] [dependencies] -serde = { version = "1.0.152", features = ["derive"] } +serde = { version = "1.0.197", features = ["derive"] } serde_json = { version = "1.0", features = ["preserve_order"] } # TODO: Build wasm with build.rs # Meantime if you want to update wasm-bindgen you also need to update version in: @@ -18,7 +18,7 @@ serde_json = { version = "1.0", features = ["preserve_order"] } wasm-bindgen = { version = "=0.2.86" } js-sys = "0.3.53" web-sys = { version = "0.3.6", features = ["console"] } -thiserror = { version = "1.0" } +thiserror = { version = "1.0.59" } serde-wasm-bindgen = { git = "https://github.com/QuantumExplorer/serde-wasm-bindgen", branch = "feat/not_human_readable" } dpp = { path = "../rs-dpp", default-features = false, features = [ "state-transition-serde-conversion", @@ -46,11 +46,12 @@ log = { version = "0.4.6" } wasm-logger = { version = "0.2.0" } num_enum = "0.5.7" hex = { version = "0.4" } - +paste = "1.0.14" +anyhow = { version = "1.0.75" } +# required, cargo-machete false positive wasm-bindgen-futures = "0.4.33" async-trait = "0.1.59" -anyhow = "1.0.70" - +bincode = "2.0.0-rc.3" [profile.release] lto = true opt-level = 's' diff --git a/packages/wasm-dpp/lib/test/fixtures/getDataContractFixture.js b/packages/wasm-dpp/lib/test/fixtures/getDataContractFixture.js index 76ef763590f..de60dce4f18 100644 --- a/packages/wasm-dpp/lib/test/fixtures/getDataContractFixture.js +++ b/packages/wasm-dpp/lib/test/fixtures/getDataContractFixture.js @@ -280,5 +280,6 @@ module.exports = async function getDataContractFixture(ownerId = randomOwnerId) documentsMutableContractDefault: true, }; - return factory.create(ownerId, documents, config); + // eslint-disable-next-line + return factory.create(ownerId, BigInt(1), documents, config); }; diff --git a/packages/wasm-dpp/lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture.js b/packages/wasm-dpp/lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture.js new file mode 100644 index 00000000000..892acc55c1d --- /dev/null +++ b/packages/wasm-dpp/lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture.js @@ -0,0 +1,20 @@ +const { Script, PrivateKey } = require('@dashevo/dashcore-lib'); +const { IdentityCreditWithdrawalTransition } = require('../../..'); +const generateRandomIdentifier = require('../utils/generateRandomIdentifier'); + +module.exports = function getIdentityCreditWithdrawalTransitionFixture() { + const privateKey = new PrivateKey('cSBnVM4xvxarwGQuAfQFwqDg9k5tErHUHzgWsEfD4zdwUasvqRVY'); + const address = privateKey.toAddress(); + + const stateTransition = new IdentityCreditWithdrawalTransition(1); + stateTransition.setIdentityId(generateRandomIdentifier()); + // eslint-disable-next-line + stateTransition.setAmount(BigInt(1000)); + stateTransition.setCoreFeePerByte(1000); + stateTransition.setPooling(0); + stateTransition.setOutputScript(Script.buildPublicKeyHashOut(address).toBuffer()); + // eslint-disable-next-line + stateTransition.setNonce(BigInt(1)); + + return stateTransition; +}; diff --git a/packages/wasm-dpp/lib/test/fixtures/getIdentityUpdateTransitionFixture.js b/packages/wasm-dpp/lib/test/fixtures/getIdentityUpdateTransitionFixture.js index 64a839fbb89..f94537b6647 100644 --- a/packages/wasm-dpp/lib/test/fixtures/getIdentityUpdateTransitionFixture.js +++ b/packages/wasm-dpp/lib/test/fixtures/getIdentityUpdateTransitionFixture.js @@ -14,7 +14,6 @@ module.exports = async function getIdentityUpdateTransitionFixture() { stateTransition.setPublicKeysToAdd([key]); stateTransition.setPublicKeyIdsToDisable([0]); - stateTransition.setPublicKeysDisabledAt(new Date()); return stateTransition; }; diff --git a/packages/wasm-dpp/lib/test/utils/generateRandomIdentifier.js b/packages/wasm-dpp/lib/test/utils/generateRandomIdentifier.js new file mode 100644 index 00000000000..18f67540a53 --- /dev/null +++ b/packages/wasm-dpp/lib/test/utils/generateRandomIdentifier.js @@ -0,0 +1,13 @@ +const crypto = require('crypto'); +const { Identifier } = require('../../..'); + +/** + * Generate random identity ID + * + * @return {Identifier} + */ +function generateRandomIdentifier() { + return new Identifier(crypto.randomBytes(32)); +} + +module.exports = generateRandomIdentifier; diff --git a/packages/wasm-dpp/lib/utils/hash.js b/packages/wasm-dpp/lib/utils/hash.js index fb58965876f..718dfa77a10 100644 --- a/packages/wasm-dpp/lib/utils/hash.js +++ b/packages/wasm-dpp/lib/utils/hash.js @@ -15,4 +15,4 @@ function hash(buffer) { return sha256(sha256(buffer)); } -module.exports = { hash }; +module.exports = { hash, sha256 }; diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 51b6b8af6de..0a15a967c8c 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -24,6 +24,14 @@ ] }, "author": "Dash Core Team", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/wasm-dpp#readme", "contributors": [ { "name": "Anton Suprunchuk", @@ -43,7 +51,7 @@ "@babel/cli": "^7.23.0", "@babel/core": "^7.23.3", "@babel/preset-env": "^7.23.3", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.3", "@dashevo/dpns-contract": "workspace:*", "@types/bs58": "^4.0.1", "@types/node": "^14.6.0", @@ -64,7 +72,7 @@ "fast-json-patch": "^3.1.1", "https-browserify": "^1.0.0", "json-schema-diff-validator": "^0.4.1", - "karma": "^6.4.1", + "karma": "^6.4.3", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.1.2", diff --git a/packages/wasm-dpp/src/dash_platform_protocol.rs b/packages/wasm-dpp/src/dash_platform_protocol.rs index 4affd36c155..ba7d920d579 100644 --- a/packages/wasm-dpp/src/dash_platform_protocol.rs +++ b/packages/wasm-dpp/src/dash_platform_protocol.rs @@ -6,9 +6,7 @@ use crate::document::factory::DocumentFactoryWASM; use crate::document_facade::DocumentFacadeWasm; use dpp::dash_platform_protocol::DashPlatformProtocol; use dpp::data_contract::DataContractFacade; -use dpp::identity::IdentityFacade; -use dpp::prelude::DataContract; -use dpp::state_transition::state_transition_factory::StateTransitionFactory; + use dpp::version::LATEST_VERSION; use crate::entropy_generator::ExternalEntropyGenerator; @@ -45,10 +43,7 @@ impl DashPlatformProtocolWasm { let protocol_version = maybe_protocol_version.unwrap_or(LATEST_VERSION); let protocol = DashPlatformProtocol::new(protocol_version); - let data_contracts = Arc::new( - DataContractFacade::new(protocol_version, Some(Box::new(entropy_generator.clone()))) - .with_js_error()?, - ); + let data_contracts = Arc::new(DataContractFacade::new(protocol_version).with_js_error()?); let document_factory = DocumentFactoryWASM::new(protocol_version, Some(entropy_generator))?; diff --git a/packages/wasm-dpp/src/data_contract/data_contract.rs b/packages/wasm-dpp/src/data_contract/data_contract.rs index 603a027098c..e0b2232f52b 100644 --- a/packages/wasm-dpp/src/data_contract/data_contract.rs +++ b/packages/wasm-dpp/src/data_contract/data_contract.rs @@ -7,8 +7,8 @@ pub use serde::{Deserialize, Serialize}; use wasm_bindgen::prelude::*; use dpp::data_contract::schema::DataContractSchemaMethodsV0; -use dpp::data_contract::{DataContract, DocumentName, JsonValue}; -use dpp::platform_value::{platform_value, Bytes32, Value}; +use dpp::data_contract::DataContract; +use dpp::platform_value::{platform_value, Value}; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::config::DataContractConfig; @@ -17,23 +17,24 @@ use dpp::data_contract::conversion::value::v0::DataContractValueConversionMethod use dpp::data_contract::created_data_contract::CreatedDataContract; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::data_contract::serialized_version::DataContractInSerializationFormat; -use dpp::serialization::{PlatformSerializable, PlatformSerializableWithPlatformVersion}; +use dpp::prelude::IdentityNonce; +use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::version::PlatformVersion; -use dpp::{platform_value, ProtocolError}; +use dpp::ProtocolError; use crate::identifier::identifier_from_js_value; use crate::metadata::MetadataWasm; use crate::utils::get_bool_from_options; use crate::utils::SKIP_VALIDATION_PROPERTY_NAME; use crate::utils::{Inner, IntoWasm, ToSerdeJSONExt, WithJsError}; -use crate::{bail_js, console_log, with_js_error}; +use crate::with_js_error; use crate::{buffer::Buffer, identifier::IdentifierWrapper}; #[wasm_bindgen(js_name=DataContract)] #[derive(Debug, Clone)] pub struct DataContractWasm { inner: DataContract, - entropy_used: Option>, + identity_nonce: Option, } /// CreatedDataContract contains entropy and is used to create @@ -42,7 +43,7 @@ impl From for DataContractWasm { fn from(v: CreatedDataContract) -> Self { DataContractWasm { inner: v.data_contract().clone(), - entropy_used: Some(v.entropy_used().to_vec()), + identity_nonce: Some(v.identity_nonce()), } } } @@ -53,7 +54,7 @@ impl From for DataContractWasm { fn from(v: DataContract) -> Self { DataContractWasm { inner: v, - entropy_used: None, + identity_nonce: None, } } } @@ -67,17 +68,13 @@ impl From<&DataContractWasm> for DataContract { impl TryFrom<&DataContractWasm> for CreatedDataContract { type Error = ProtocolError; fn try_from(v: &DataContractWasm) -> Result { - let entropy = if let Some(entropy_used) = &v.entropy_used { - Bytes32::from_vec(entropy_used.to_owned())? - } else { - Bytes32::default() - }; + let identity_nonce = v.identity_nonce.unwrap_or_default(); let platform_version = PlatformVersion::first(); - CreatedDataContract::from_contract_and_entropy( + CreatedDataContract::from_contract_and_identity_nonce( v.to_owned().into(), - entropy, + identity_nonce, platform_version, ) } @@ -154,28 +151,23 @@ impl DataContractWasm { let document_type = self .inner .document_type_for_name(doc_type) + .map_err(ProtocolError::DataContractError) .with_js_error()?; - let binary_paths_o = document_type.binary_paths(); - let mut binary_paths = BTreeMap::new(); - document_type.binary_paths().iter().for_each( - (|path| { - binary_paths.insert(path.to_owned(), platform_value!({})); - }), - ); - - document_type.identifier_paths().iter().for_each( - (|path| { - binary_paths.insert( - path.to_owned(), - platform_value!({ - "contentMediaType": "application/x.dash.dpp.identifier" - }), - ); - }), - ); + document_type.binary_paths().iter().for_each(|path| { + binary_paths.insert(path.to_owned(), platform_value!({})); + }); + + document_type.identifier_paths().iter().for_each(|path| { + binary_paths.insert( + path.to_owned(), + platform_value!({ + "contentMediaType": "application/x.dash.dpp.identifier" + }), + ); + }); with_js_error!(binary_paths.serialize(&serializer)) } @@ -214,7 +206,8 @@ impl DataContractWasm { document_schemas_map, defs, !skip_validation, - &platform_version, + &mut vec![], + platform_version, ) .with_js_error() } @@ -226,7 +219,7 @@ impl DataContractWasm { schema: JsValue, options: Option, ) -> Result<(), JsValue> { - let (skip_validation) = if let Some(options) = options { + let skip_validation = if let Some(options) = options { get_bool_from_options(options.into(), SKIP_VALIDATION_PROPERTY_NAME, false)? } else { false @@ -237,13 +230,23 @@ impl DataContractWasm { let platform_version = PlatformVersion::first(); self.inner - .set_document_schema(name, schema_value, !skip_validation, &platform_version) + .set_document_schema( + name, + schema_value, + !skip_validation, + &mut vec![], + platform_version, + ) .with_js_error() } #[wasm_bindgen(js_name=getDocumentSchema)] pub fn document_schema(&mut self, name: &str) -> Result { - let document_type = self.inner.document_type_for_name(name).with_js_error()?; + let document_type = self + .inner + .document_type_for_name(name) + .map_err(ProtocolError::DataContractError) + .with_js_error()?; let serializer = serde_wasm_bindgen::Serializer::json_compatible(); @@ -280,7 +283,7 @@ impl DataContractWasm { defs: Option, options: Option, ) -> Result<(), JsValue> { - let (skip_validation) = if let Some(options) = options { + let skip_validation = if let Some(options) = options { get_bool_from_options(options.into(), SKIP_VALIDATION_PROPERTY_NAME, false)? } else { false @@ -293,7 +296,12 @@ impl DataContractWasm { .transpose()?; self.inner - .set_schema_defs(maybe_schema_defs, !skip_validation, platform_version) + .set_schema_defs( + maybe_schema_defs, + !skip_validation, + &mut vec![], + platform_version, + ) .with_js_error()?; Ok(()) @@ -304,18 +312,15 @@ impl DataContractWasm { self.inner.has_document_type_for_name(&doc_type) } - #[wasm_bindgen(js_name=setEntropy)] - pub fn set_entropy(&mut self, e: Vec) -> Result<(), JsValue> { - self.entropy_used = Some(e); + #[wasm_bindgen(js_name=setIdentityNonce)] + pub fn set_identity_nonce(&mut self, e: u64) -> Result<(), JsValue> { + self.identity_nonce = Some(e); Ok(()) } - #[wasm_bindgen(js_name=getEntropy)] - pub fn entropy(&mut self) -> JsValue { - self.entropy_used - .as_ref() - .map(|e| Buffer::from_bytes(e.as_slice()).into()) - .unwrap_or(JsValue::undefined()) + #[wasm_bindgen(js_name=getIdentityNonce)] + pub fn identity_nonce(&mut self) -> u64 { + self.identity_nonce.unwrap_or_default() } #[wasm_bindgen(js_name=getMetadata)] @@ -430,13 +435,18 @@ impl DataContractWasm { pub(crate) fn try_from_serialization_format( value: DataContractInSerializationFormat, - validate: bool, + full_validation: bool, ) -> Result { let platform_version = PlatformVersion::first(); - DataContract::try_from_platform_versioned(value, validate, platform_version) - .with_js_error() - .map(Into::into) + DataContract::try_from_platform_versioned( + value, + full_validation, + &mut vec![], + platform_version, + ) + .with_js_error() + .map(Into::into) } } diff --git a/packages/wasm-dpp/src/data_contract/data_contract_facade.rs b/packages/wasm-dpp/src/data_contract/data_contract_facade.rs index cea432427b8..1f7b1066cf7 100644 --- a/packages/wasm-dpp/src/data_contract/data_contract_facade.rs +++ b/packages/wasm-dpp/src/data_contract/data_contract_facade.rs @@ -1,24 +1,22 @@ use std::convert::TryFrom; use dpp::data_contract::created_data_contract::CreatedDataContract; -use dpp::data_contract::DataContract; + use dpp::data_contract::DataContractFacade; use dpp::identifier::Identifier; use crate::data_contract::state_transition::DataContractCreateTransitionWasm; use crate::data_contract::state_transition::DataContractUpdateTransitionWasm; use crate::data_contract::DataContractWasm; -use crate::entropy_generator::ExternalEntropyGenerator; use crate::errors::protocol_error::from_protocol_error; use crate::utils::{ - get_bool_from_options, IntoWasm, ToSerdeJSONExt, WithJsError, SKIP_VALIDATION_PROPERTY_NAME, + get_bool_from_options, ToSerdeJSONExt, WithJsError, SKIP_VALIDATION_PROPERTY_NAME, }; use dpp::ProtocolError; use std::sync::Arc; -use crate::identity::identity_facade::IdentityFacadeWasm; -use dpp::identity::IdentityFacade; +use dpp::prelude::IdentityNonce; use wasm_bindgen::prelude::*; impl From for DataContractFacadeWasm { @@ -32,9 +30,8 @@ impl From for DataContractFacadeWasm { pub struct DataContractFacadeWasm(pub(crate) Arc); impl DataContractFacadeWasm { - pub fn new(protocol_version: u32, entropy_generator: ExternalEntropyGenerator) -> Self { - let inner = DataContractFacade::new(protocol_version, Some(Box::new(entropy_generator))) - .expect("should create facade"); + pub fn new(protocol_version: u32) -> Self { + let inner = DataContractFacade::new(protocol_version).expect("should create facade"); Self(Arc::new(inner)) } @@ -47,6 +44,7 @@ impl DataContractFacadeWasm { pub fn create( &self, owner_id: Vec, + identity_nonce: IdentityNonce, documents: JsValue, definitions: Option, ) -> Result { @@ -58,6 +56,7 @@ impl DataContractFacadeWasm { self.0 .create( id, + identity_nonce, serde_wasm_bindgen::from_value(documents)?, None, definitions @@ -127,9 +126,13 @@ impl DataContractFacadeWasm { pub fn create_data_contract_update_transition( &self, data_contract: &DataContractWasm, + identity_contract_nonce: IdentityNonce, ) -> Result { self.0 - .create_data_contract_update_transition(data_contract.to_owned().into()) + .create_data_contract_update_transition( + data_contract.to_owned().into(), + identity_contract_nonce, + ) .map(Into::into) .map_err(from_protocol_error) } diff --git a/packages/wasm-dpp/src/data_contract/errors/mod.rs b/packages/wasm-dpp/src/data_contract/errors/mod.rs index 93bedd6c77e..95609c0f89e 100644 --- a/packages/wasm-dpp/src/data_contract/errors/mod.rs +++ b/packages/wasm-dpp/src/data_contract/errors/mod.rs @@ -6,20 +6,9 @@ use wasm_bindgen::prelude::*; pub use data_contract_generic_error::*; use dpp::data_contract::errors::DataContractError; -use dpp::ProtocolError; -pub use invalid_data_contract::*; pub fn from_data_contract_to_js_error(e: DataContractError) -> JsValue { match e { - DataContractError::InvalidDataContractError { - errors, - raw_data_contract, - } => InvalidDataContractError::new( - errors, - serde_wasm_bindgen::to_value(&raw_data_contract) - .expect("statically known structure should be a valid JSON"), - ) - .into(), DataContractError::InvalidDocumentTypeError(err) => { invalid_document_type::InvalidDocumentTypeInDataContractError::new( err.document_type(), diff --git a/packages/wasm-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs b/packages/wasm-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs index 79765f37a06..536995f2b1a 100644 --- a/packages/wasm-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs +++ b/packages/wasm-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs @@ -1,21 +1,19 @@ // mod validation; -use std::collections::HashMap; - // pub use validation::*; use crate::errors::protocol_error::from_protocol_error; -use dpp::data_contract::JsonValue; + use dpp::errors::consensus::signature::SignatureError; use dpp::errors::consensus::ConsensusError; -use dpp::platform_value::Value; + use dpp::serialization::{PlatformDeserializable, PlatformSerializable}; use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; use dpp::state_transition::StateTransitionIdentitySigned; -use dpp::state_transition::{JsonStateTransitionSerializationOptions, StateTransitionJsonConvert}; + use dpp::state_transition::{StateTransition, StateTransitionValueConvert}; -use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; +use dpp::version::PlatformVersion; use dpp::{state_transition::StateTransitionLike, ProtocolError}; use serde::Serialize; use wasm_bindgen::prelude::*; @@ -24,7 +22,7 @@ use crate::bls_adapter::{BlsAdapter, JsBlsAdapter}; use crate::data_contract::DataContractWasm; use crate::identity::IdentityPublicKeyWasm; use crate::utils::{ToSerdeJSONExt, WithJsError}; -use crate::{buffer::Buffer, identifier::IdentifierWrapper, with_js_error}; +use crate::{buffer::Buffer, identifier::IdentifierWrapper}; #[derive(Clone)] #[wasm_bindgen(js_name=DataContractCreateTransition)] @@ -69,9 +67,9 @@ impl DataContractCreateTransitionWasm { // Ok(()) // } - #[wasm_bindgen(js_name=getEntropy)] - pub fn get_entropy(&self) -> Buffer { - Buffer::from_bytes_owned(self.0.entropy().to_vec()) + #[wasm_bindgen(js_name=getIdentityNonce)] + pub fn get_identity_nonce(&self) -> u64 { + self.0.identity_nonce() } #[wasm_bindgen(js_name=getOwnerId)] @@ -143,6 +141,11 @@ impl DataContractCreateTransitionWasm { self.0.is_identity_state_transition() } + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + #[wasm_bindgen(js_name=toObject)] pub fn to_object(&self, skip_signature: Option) -> Result { let serde_object = self diff --git a/packages/wasm-dpp/src/data_contract/state_transition/data_contract_update_transition/mod.rs b/packages/wasm-dpp/src/data_contract/state_transition/data_contract_update_transition/mod.rs index 2763fb6b2b2..02fa59c0b1c 100644 --- a/packages/wasm-dpp/src/data_contract/state_transition/data_contract_update_transition/mod.rs +++ b/packages/wasm-dpp/src/data_contract/state_transition/data_contract_update_transition/mod.rs @@ -1,12 +1,8 @@ // mod validation; -use std::collections::HashMap; -use std::hash::Hash; - // pub use validation::*; use dpp::consensus::ConsensusError; -use dpp::ed25519_dalek::ed25519::signature::SignerMut; use dpp::serialization::{PlatformDeserializable, PlatformSerializable}; use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; @@ -14,10 +10,9 @@ use dpp::state_transition::StateTransitionIdentitySigned; use dpp::state_transition::{StateTransition, StateTransitionValueConvert}; use dpp::version::PlatformVersion; use dpp::{ - consensus::signature::SignatureError, platform_value, state_transition::StateTransitionLike, - ProtocolError, + consensus::signature::SignatureError, state_transition::StateTransitionLike, ProtocolError, }; -use serde::{Deserialize, Serialize}; +use serde::Serialize; use wasm_bindgen::prelude::*; use crate::data_contract::DataContractWasm; @@ -28,7 +23,7 @@ use crate::{ bls_adapter::{BlsAdapter, JsBlsAdapter}, utils::WithJsError, }; -use crate::{buffer::Buffer, identifier::IdentifierWrapper, with_js_error}; +use crate::{buffer::Buffer, identifier::IdentifierWrapper}; #[derive(Clone)] #[wasm_bindgen(js_name=DataContractUpdateTransition)] @@ -62,8 +57,6 @@ impl DataContractUpdateTransitionWasm { #[wasm_bindgen(js_name=getDataContract)] pub fn get_data_contract(&self) -> DataContractWasm { - let platform_version = PlatformVersion::first(); - DataContractWasm::try_from_serialization_format(self.0.data_contract().clone(), false) .expect("should create data contract from serialized format") } @@ -139,6 +132,11 @@ impl DataContractUpdateTransitionWasm { self.0.is_identity_state_transition() } + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + // #[wasm_bindgen(js_name=hash)] // pub fn hash(&self, skip_signature: Option) -> Result { // let bytes = self diff --git a/packages/wasm-dpp/src/data_contract_factory/data_contract_factory.rs b/packages/wasm-dpp/src/data_contract_factory/data_contract_factory.rs index 569bf8ae018..d8b183ae9cb 100644 --- a/packages/wasm-dpp/src/data_contract_factory/data_contract_factory.rs +++ b/packages/wasm-dpp/src/data_contract_factory/data_contract_factory.rs @@ -1,21 +1,13 @@ use std::convert::TryFrom; -use std::sync::Arc; use dpp::data_contract::created_data_contract::CreatedDataContract; use dpp::{data_contract::DataContractFactory, platform_value, prelude::Identifier, ProtocolError}; use wasm_bindgen::prelude::*; -use crate::entropy_generator::ExternalEntropyGenerator; use crate::utils::{ToSerdeJSONExt, WithJsError}; use crate::data_contract::{DataContractCreateTransitionWasm, DataContractWasm}; -use crate::{ - data_contract::errors::InvalidDataContractError, - errors::{from_dpp_err, protocol_error::from_protocol_error}, - with_js_error, -}; - -use dpp::util::entropy_generator::EntropyGenerator; +use crate::{errors::protocol_error::from_protocol_error, with_js_error}; #[wasm_bindgen(js_name=DataContractFactory)] pub struct DataContractFactoryWasm(DataContractFactory); @@ -35,24 +27,18 @@ impl From for DataContractFactory { #[wasm_bindgen(js_class=DataContractFactory)] impl DataContractFactoryWasm { #[wasm_bindgen(constructor)] - pub fn new( - protocol_version: u32, - external_entropy_generator_arg: Option, - ) -> DataContractFactoryWasm { - if let Some(external_entropy_generator) = external_entropy_generator_arg { - DataContractFactory::new(protocol_version, Some(Box::new(external_entropy_generator))) - } else { - DataContractFactory::new(protocol_version, None) - } - .with_js_error() - .expect("should create a factory") - .into() + pub fn new(protocol_version: u32) -> DataContractFactoryWasm { + DataContractFactory::new(protocol_version) + .with_js_error() + .expect("should create a factory") + .into() } #[wasm_bindgen(js_name=create)] pub fn create( &self, owner_id: Vec, + identity_nonce: u64, documents: JsValue, config: JsValue, ) -> Result { @@ -71,7 +57,13 @@ impl DataContractFactoryWasm { .with_js_error()?; //todo: contract config self.0 - .create_with_value_config(identifier, documents_object, contract_config, None) + .create_with_value_config( + identifier, + identity_nonce, + documents_object, + contract_config, + None, + ) .map(Into::into) .with_js_error() } diff --git a/packages/wasm-dpp/src/document/document_facade.rs b/packages/wasm-dpp/src/document/document_facade.rs index 028ad6aefef..609794eaa99 100644 --- a/packages/wasm-dpp/src/document/document_facade.rs +++ b/packages/wasm-dpp/src/document/document_facade.rs @@ -1,12 +1,8 @@ -use std::sync::Arc; - +use std::rc::Rc; use wasm_bindgen::{prelude::*, JsValue}; use crate::document::factory::DocumentFactoryWASM; -use crate::{ - utils::{get_class_name, IntoWasm}, - DataContractWasm, ExtendedDocumentWasm, -}; +use crate::{DataContractWasm, ExtendedDocumentWasm}; use crate::document::state_transition::document_batch_transition::DocumentsBatchTransitionWasm; @@ -14,14 +10,14 @@ use crate::document::state_transition::document_batch_transition::DocumentsBatch #[wasm_bindgen(js_name=DocumentFacade)] pub struct DocumentFacadeWasm { // validator: Arc, - factory: Arc, + factory: Rc, // data_contract_fetcher_and_validator: Arc, } impl DocumentFacadeWasm { pub fn new_with_arc( // document_validator: Arc, - document_factory: Arc, + document_factory: Rc, // data_contract_fetcher_and_validator: Arc, ) -> Self { Self { @@ -36,7 +32,7 @@ impl DocumentFacadeWasm { #[wasm_bindgen(constructor)] pub fn new(document_factory: DocumentFactoryWASM) -> Self { Self { - factory: Arc::new(document_factory), + factory: Rc::new(document_factory), } } @@ -99,8 +95,10 @@ impl DocumentFacadeWasm { pub fn create_state_transition( &self, documents: &JsValue, + nonce_counter_value: &js_sys::Object, //IdentityID/ContractID -> nonce ) -> Result { - self.factory.create_state_transition(documents) + self.factory + .create_state_transition(documents, nonce_counter_value) } // /// Creates Documents State Transition diff --git a/packages/wasm-dpp/src/document/errors/document_no_revision_error.rs b/packages/wasm-dpp/src/document/errors/document_no_revision_error.rs index 2743e4fc7a9..2b94d2d82b8 100644 --- a/packages/wasm-dpp/src/document/errors/document_no_revision_error.rs +++ b/packages/wasm-dpp/src/document/errors/document_no_revision_error.rs @@ -1,6 +1,5 @@ use thiserror::Error; -use crate::data_contract::DataContractWasm; use crate::DocumentWasm; use super::*; diff --git a/packages/wasm-dpp/src/document/errors/mod.rs b/packages/wasm-dpp/src/document/errors/mod.rs index afddf092e08..7b90ac63dbd 100644 --- a/packages/wasm-dpp/src/document/errors/mod.rs +++ b/packages/wasm-dpp/src/document/errors/mod.rs @@ -75,7 +75,7 @@ pub fn from_document_to_js_error(e: DocumentError) -> JsValue { TryingToReplaceImmutableDocumentError::new((*document).into()).into() } DocumentError::InvalidActionError(action) => InvalidActionError::new(action.into()).into(), - DocumentError::TryingToDeleteImmutableDocument { document } => { + DocumentError::TryingToDeleteIndelibleDocument { document } => { TryingToDeleteImmutableDocumentError::new((*document).into()).into() } } diff --git a/packages/wasm-dpp/src/document/extended_document.rs b/packages/wasm-dpp/src/document/extended_document.rs index 81d149c060e..08d81ff81cd 100644 --- a/packages/wasm-dpp/src/document/extended_document.rs +++ b/packages/wasm-dpp/src/document/extended_document.rs @@ -5,13 +5,12 @@ use serde_json::Value as JsonValue; use dpp::platform_value::{Bytes32, Value}; use dpp::prelude::{Identifier, Revision, TimestampMillis}; -use dpp::util::json_schema::JsonSchemaExt; + use dpp::util::json_value::JsonValueExt; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::document::serialization_traits::ExtendedDocumentPlatformConversionMethodsV0; use dpp::platform_value::converter::serde_json::BTreeValueJsonConverter; -use dpp::serialization::PlatformSerializable; use dpp::version::PlatformVersion; use dpp::ProtocolError; use serde::{Deserialize, Serialize}; @@ -20,6 +19,7 @@ use wasm_bindgen::prelude::*; use crate::buffer::Buffer; use crate::data_contract::DataContractWasm; +#[allow(deprecated)] // BinaryType is unsed in unused code below use crate::document::BinaryType; use crate::document::{ConversionOptions, DocumentWasm}; use crate::errors::RustConversionError; @@ -191,7 +191,7 @@ impl ExtendedDocumentWasm { #[wasm_bindgen(js_name=set)] pub fn set(&mut self, path: String, js_value_to_set: JsValue) -> Result<(), JsValue> { - let mut value: Value = js_value_to_set.with_serde_to_platform_value()?; + let value: Value = js_value_to_set.with_serde_to_platform_value()?; self.0.set_untrusted(&path, value).with_js_error() } @@ -260,7 +260,7 @@ impl ExtendedDocumentWasm { #[wasm_bindgen(js_name=getMetadata)] pub fn get_metadata(&self) -> Option { - self.0.metadata().clone().map(Into::into) + (*self.0.metadata()).map(Into::into) } #[wasm_bindgen(js_name=setMetadata)] @@ -363,6 +363,9 @@ impl ExtendedDocumentWasm { } impl ExtendedDocumentWasm { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] fn get_binary_type_of_path(&self, path: &String) -> Result { let document_type = self.0.document_type().with_js_error()?; diff --git a/packages/wasm-dpp/src/document/factory.rs b/packages/wasm-dpp/src/document/factory.rs index a81a33e52b1..0b927a60803 100644 --- a/packages/wasm-dpp/src/document/factory.rs +++ b/packages/wasm-dpp/src/document/factory.rs @@ -1,10 +1,7 @@ use anyhow::anyhow; -use dpp::platform_value::ReplacementType; -use dpp::{ - document::{document_factory::DocumentFactory, extended_document}, - ProtocolError, -}; -use std::collections::HashMap; + +use dpp::document::document_factory::DocumentFactory; +use std::collections::{BTreeMap, HashMap, HashSet}; use wasm_bindgen::prelude::*; @@ -13,13 +10,13 @@ use crate::document::platform_value::Bytes32; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::DocumentTypeRef; use dpp::document::Document; -use dpp::platform_value::btreemap_extensions::BTreeValueMapReplacementPathHelper; + use dpp::prelude::ExtendedDocument; -use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; + +use dpp::identifier::Identifier; use dpp::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; use dpp::version::PlatformVersion; use std::convert::TryFrom; -use std::sync::Arc; use crate::document_batch_transition::DocumentsBatchTransitionWasm; use crate::entropy_generator::ExternalEntropyGenerator; @@ -111,9 +108,48 @@ impl DocumentFactoryWASM { pub fn create_state_transition( &self, documents: &JsValue, + nonce_counter_value: &js_sys::Object, //IdentityID/ContractID -> nonce ) -> Result { + let mut nonce_counter = BTreeMap::new(); + let mut contract_ids_to_check = HashSet::<&Identifier>::new(); + + // TODO: move to a function and handle errors instead of doing unwraps + { + js_sys::Object::entries(nonce_counter_value) + .iter() + .for_each(|entry| { + let key_value = js_sys::Array::from(&entry); + let identity_id = identifier_from_js_value(&key_value.get(0)).unwrap(); + let contract_ids = key_value.get(1); + let contract_ids = js_sys::Object::try_from(&contract_ids).unwrap(); + + js_sys::Object::entries(contract_ids) + .iter() + .for_each(|entry| { + let key_value = js_sys::Array::from(&entry); + let contract_id = identifier_from_js_value(&key_value.get(0)).unwrap(); + let nonce = key_value.get(1).as_f64().unwrap() as u64; + nonce_counter.insert((identity_id, contract_id), nonce); + }); + }); + } + + nonce_counter.iter().for_each(|((_, contract_id), _)| { + contract_ids_to_check.insert(contract_id); + }); + let documents_by_action = extract_documents_by_action(documents)?; + for (_, documents) in documents_by_action.iter() { + for document in documents.iter() { + if !contract_ids_to_check.contains(&document.data_contract().id()) { + return Err(JsValue::from_str( + "Document's data contract is not in the nonce counter", + )); + } + } + } + let documents: Vec<( DocumentTransitionActionType, Vec<(Document, DocumentTypeRef, Bytes32)>, @@ -134,11 +170,14 @@ impl DocumentFactoryWASM { }) .collect(); - (action_type.clone(), documents_with_refs) + (*action_type, documents_with_refs) }) .collect(); - let batch_transition = self.0.create_state_transition(documents).with_js_error()?; + let batch_transition = self + .0 + .create_state_transition(documents, &mut nonce_counter) + .with_js_error()?; Ok(batch_transition.into()) } @@ -273,33 +312,29 @@ fn extract_documents_of_action( documents: &JsValue, action: &str, ) -> Result, anyhow::Error> { - let mut extracted_documents: Vec = vec![]; - let documents_with_action = js_sys::Reflect::get(documents, &action.to_string().into()).unwrap_or(JsValue::NULL); if documents_with_action.is_null() || documents_with_action.is_undefined() { - return Ok(extracted_documents); + return Ok(vec![]); } let documents_array = js_sys::Array::try_from(documents_with_action) .map_err(|e| anyhow!("property '{}' isn't an array: {}", action, e))?; - for js_document in documents_array.iter() { - let document: ExtendedDocument = js_document - .to_wasm::("ExtendedDocument") - .map_err(|e| { - anyhow!( - "Element in '{}' isn't an Extended Document instance: {:#?}", - action, - e - ) - })? - .clone() - .into(); - - extracted_documents.push(document) - } - - Ok(extracted_documents) + documents_array + .iter() + .map(|js_document| { + js_document + .to_wasm::("ExtendedDocument") + .map_err(|e| { + anyhow!( + "Element in '{}' isn't an Extended Document instance: {:#?}", + action, + e + ) + }) + .map(|wasm_doc| wasm_doc.clone().into()) + }) + .collect() } diff --git a/packages/wasm-dpp/src/document/generate_document_id.rs b/packages/wasm-dpp/src/document/generate_document_id.rs index 058fae5831d..4f18d303e98 100644 --- a/packages/wasm-dpp/src/document/generate_document_id.rs +++ b/packages/wasm-dpp/src/document/generate_document_id.rs @@ -1,4 +1,4 @@ -use dpp::document::{generate_document_id, Document}; +use dpp::document::Document; use wasm_bindgen::prelude::*; use crate::identifier::{identifier_from_js_value, IdentifierWrapper}; diff --git a/packages/wasm-dpp/src/document/mod.rs b/packages/wasm-dpp/src/document/mod.rs index 725abe78eb7..3c6892249d0 100644 --- a/packages/wasm-dpp/src/document/mod.rs +++ b/packages/wasm-dpp/src/document/mod.rs @@ -1,5 +1,4 @@ -use dpp::prelude::{DataContract, Identifier}; -use dpp::util::json_schema::JsonSchemaExt; +use dpp::prelude::Identifier; use anyhow::anyhow; use serde::{Deserialize, Serialize}; @@ -10,10 +9,10 @@ use crate::buffer::Buffer; use crate::data_contract::DataContractWasm; use crate::identifier::IdentifierWrapper; -use crate::lodash::lodash_set; + use crate::utils::WithJsError; use crate::utils::{with_serde_to_json_value, ToSerdeJSONExt}; -use crate::with_js_error; + use dpp::document::document_methods::DocumentMethodsV0; use dpp::document::DocumentV0Getters; pub mod errors; @@ -28,15 +27,11 @@ pub mod state_transition; // pub use document_batch_transition::DocumentsBatchTransitionWasm; -use dpp::document::{ - Document, DocumentV0Setters, EXTENDED_DOCUMENT_IDENTIFIER_FIELDS, IDENTIFIER_FIELDS, -}; +use dpp::document::{Document, DocumentV0Setters, EXTENDED_DOCUMENT_IDENTIFIER_FIELDS}; pub use extended_document::ExtendedDocumentWasm; -use dpp::document::extended_document::property_names; use dpp::identity::TimestampMillis; -use dpp::platform_value::btreemap_extensions::BTreeValueMapReplacementPathHelper; use dpp::platform_value::converter::serde_json::BTreeValueJsonConverter; use dpp::platform_value::ReplacementType; use dpp::platform_value::Value; @@ -55,6 +50,9 @@ pub(crate) struct ConversionOptions { pub skip_identifiers_conversion: bool, } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub(super) enum BinaryType { Identifier, Buffer, @@ -86,6 +84,7 @@ impl DocumentWasm { let document_type = js_data_contract .inner() .document_type_for_name(document_type_name.as_str()) + .map_err(ProtocolError::DataContractError) .with_js_error()?; let identifier_paths = document_type.identifier_paths().iter().map(|s| s.as_str()); @@ -300,6 +299,7 @@ impl DocumentWasm { let document_type = data_contract .inner() .document_type_for_name(document_type_name.as_str()) + .map_err(ProtocolError::DataContractError) .with_js_error()?; let bytes = self .0 @@ -319,6 +319,9 @@ impl DocumentWasm { } impl DocumentWasm { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] fn get_binary_type_of_path( &self, path: &String, @@ -328,6 +331,7 @@ impl DocumentWasm { let document_type = data_contract .inner() .document_type_for_name(document_type_name.as_str()) + .map_err(ProtocolError::DataContractError) .with_js_error()?; if document_type.binary_paths().contains(path) { diff --git a/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs b/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs index 69493bd8d26..8cf7b5d0b97 100644 --- a/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs +++ b/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs @@ -1,43 +1,10 @@ -use std::convert; -use std::convert::TryInto; - -use serde_json::Value as JsonValue; - -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::platform_value::btreemap_extensions::{ - BTreeValueMapHelper, BTreeValueMapPathHelper, BTreeValueMapReplacementPathHelper, -}; -use dpp::platform_value::converter::serde_json::BTreeValueJsonConverter; -use dpp::platform_value::ReplacementType; use dpp::prelude::Revision; -use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; -use dpp::state_transition::documents_batch_transition::document_base_transition::v0::DocumentTransitionObjectLike; -use dpp::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; + use dpp::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; -use dpp::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use dpp::{ - document::INITIAL_REVISION, - prelude::{DataContract, Identifier}, - state_transition::documents_batch_transition::{ - document_create_transition, DocumentsBatchTransition, - }, - util::json_schema::JsonSchemaExt, - ProtocolError, -}; -use serde::Serialize; -use wasm_bindgen::prelude::*; -use crate::{ - buffer::Buffer, - document::document_batch_transition::document_transition::to_object, - identifier::IdentifierWrapper, - lodash::lodash_set, - utils::{ToSerdeJSONExt, WithJsError}, -}; +use dpp::document::INITIAL_REVISION; -use crate::data_contract::DataContractWasm; -use crate::document::BinaryType; +use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DocumentCreateTransition)] #[derive(Debug, Clone)] diff --git a/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs b/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs index c3e89f5078b..a26d579d7de 100644 --- a/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs +++ b/packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs @@ -6,20 +6,13 @@ mod document_create_transition; // pub use document_delete_transition::*; // pub use document_replace_transition::*; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::platform_value::Value; -use dpp::prelude::TimestampMillis; +use dpp::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; use dpp::state_transition::documents_batch_transition::document_transition::action_type::TransitionActionTypeGetter; use dpp::state_transition::documents_batch_transition::document_transition::DocumentTransitionV0Methods; use dpp::{ - prelude::Identifier, - state_transition::documents_batch_transition::{ - document_transition::DocumentTransition, DocumentCreateTransition, - DocumentDeleteTransition, DocumentReplaceTransition, - }, - util::{json_schema::JsonSchemaExt, json_value::JsonValueExt}, - ProtocolError, + state_transition::documents_batch_transition::document_transition::DocumentTransition, + util::json_value::JsonValueExt, ProtocolError, }; use serde::Serialize; use serde_json::Value as JsonValue; @@ -30,7 +23,7 @@ use crate::{ identifier::{identifier_from_js_value, IdentifierWrapper}, lodash::lodash_set, utils::{Inner, ToSerdeJSONExt, WithJsError}, - with_js_error, BinaryType, ConversionOptions, DataContractWasm, + ConversionOptions, }; #[wasm_bindgen(js_name=DocumentTransition)] @@ -54,11 +47,6 @@ impl DocumentTransitionWasm { self.0.action_type() as u8 } - // #[wasm_bindgen(js_name=getDataContract)] - // pub fn get_data_contract(&self) -> DataContractWasm { - // self.0.data_contract().to_owned().into() - // } - #[wasm_bindgen(js_name=getDataContractId)] pub fn get_data_contract_id(&self) -> IdentifierWrapper { self.0.data_contract_id().to_owned().into() @@ -85,161 +73,16 @@ impl DocumentTransitionWasm { self.0.set_revision(revision as u64); } - #[wasm_bindgen(js_name=getCreatedAt)] - pub fn get_created_at(&self) -> JsValue { - if let Some(created_at) = self.0.created_at() { - js_sys::Date::new(&JsValue::from_f64(created_at as f64)).into() - } else { - JsValue::NULL - } - } - - #[wasm_bindgen(js_name=getUpdatedAt)] - pub fn get_updated_at(&self) -> JsValue { - if let Some(updated_at) = self.0.updated_at() { - js_sys::Date::new(&JsValue::from_f64(updated_at as f64)).into() - } else { - JsValue::NULL + #[wasm_bindgen(js_name=hasPrefundedBalance)] + pub fn has_prefunded_balance(&self) -> bool { + match &self.0 { + DocumentTransition::Create(create_transition) => { + create_transition.prefunded_voting_balance().is_some() + } + _ => false, } } - - #[wasm_bindgen(js_name=setUpdatedAt)] - pub fn set_updated_at(&mut self, updated_at: Option) -> Result<(), JsValue> { - self.0 - .set_updated_at(updated_at.map(|timestamp| timestamp.get_time() as TimestampMillis)); - - Ok(()) - } - - #[wasm_bindgen(js_name=setCreatedAt)] - pub fn set_created_at(&mut self, created_at: Option) { - self.0 - .set_created_at(created_at.map(|timestamp| timestamp.get_time() as TimestampMillis)); - } - - // #[wasm_bindgen(js_name=getData)] - // pub fn get_data(&self) -> Result { - // if let Some(data) = self.0.data() { - // let (identifier_paths, binary_paths) = self - // .0 - // .data_contract() - // .get_identifiers_and_binary_paths(self.0.document_type_name()) - // .with_js_error()?; - // - // let js_value = to_object( - // data.clone().into(), - // &JsValue::NULL, - // identifier_paths, - // binary_paths, - // )?; - // Ok(js_value) - // } else { - // Ok(JsValue::NULL) - // } - // } - // - // #[wasm_bindgen(js_name=get)] - // pub fn get(&self, path: &str, data_contract: &DataContractWasm) -> JsValue { - // let binary_type = self.get_binary_type_of_path(path, data_contract); - // - // if let Some(value) = self.0.get_dynamic_property(path) { - // match binary_type { - // BinaryType::Identifier => { - // if let Ok(bytes) = value.to_identifier_bytes() { - // let id: IdentifierWrapper = Identifier::from_bytes(&bytes).unwrap().into(); - // return id.into(); - // } - // } - // BinaryType::Buffer => { - // if let Ok(bytes) = value.to_binary_bytes() { - // return Buffer::from_bytes(&bytes).into(); - // } - // } - // BinaryType::None => { - // let serializer = serde_wasm_bindgen::Serializer::json_compatible(); - // if let Ok(js_value) = value.serialize(&serializer) { - // return js_value; - // } - // } - // } - // } - // - // JsValue::undefined() - // } - - // #[wasm_bindgen(js_name=toObject)] - // pub fn to_object( - // &self, - // options: &JsValue, - // data_contract: &DataContractWasm, - // ) -> Result { - // match self.0 { - // DocumentTransition::Create(ref t) => DocumentCreateTransitionWasm::from(t.to_owned()) - // .to_object(options, data_contract.inner()), - // DocumentTransition::Replace(ref t) => DocumentReplaceTransitionWasm::from(t.to_owned()) - // .to_object(options, data_contract.inner()), - // DocumentTransition::Delete(ref t) => DocumentDeleteTransitionWasm::from(t.to_owned()) - // .to_object(options, data_contract.inner()), - // } - // } - - // #[wasm_bindgen(js_name=toJSON)] - // pub fn to_json(&self) -> Result { - // let json_value = self.0.to_json().with_js_error()?; - // with_js_error!(json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible())) - // } - // - // #[wasm_bindgen(js_name=fromTransitionCreate)] - // pub fn from_transition_create( - // js_create_transition: DocumentCreateTransitionWasm, - // ) -> DocumentTransitionWasm { - // let transition_create: DocumentCreateTransition = js_create_transition.into(); - // let document_transition = DocumentTransition::Create(transition_create); - // - // document_transition.into() - // } - // - // #[wasm_bindgen(js_name=fromTransitionReplace)] - // pub fn from_transition_replace( - // js_replace_transition: DocumentReplaceTransitionWasm, - // ) -> DocumentTransitionWasm { - // let transition_replace: DocumentReplaceTransition = js_replace_transition.into(); - // let document_transition = DocumentTransition::Replace(transition_replace); - // - // document_transition.into() - // } - // - // #[wasm_bindgen(js_name=fromTransitionDelete)] - // pub fn from_transition_delete( - // js_delete_transition: DocumentDeleteTransitionWasm, - // ) -> DocumentTransitionWasm { - // let transition_delete: DocumentDeleteTransition = js_delete_transition.into(); - // let document_transition = DocumentTransition::Delete(transition_delete); - // - // document_transition.into() - // } } -// -// impl DocumentTransitionWasm { -// fn get_binary_type_of_path( -// &self, -// path: impl AsRef, -// data_contract: DataContractWasm, -// ) -> Result { -// let document_type = data_contract -// .inner() -// .document_type_for_name(self.0.document_type_name().as_str()) -// .with_js_error()?; -// -// if document_type.binary_paths().contains(&path) { -// Ok(BinaryType::Buffer) -// } else if document_type.identifier_paths().contains(&path) { -// Ok(BinaryType::Identifier) -// } else { -// Ok(BinaryType::None) -// } -// } -// } impl From for DocumentTransitionWasm { fn from(v: DocumentTransition) -> Self { @@ -283,6 +126,9 @@ impl Inner for DocumentTransitionWasm { // } // } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub(crate) fn to_object<'a>( value: Value, options: &JsValue, @@ -304,7 +150,7 @@ pub(crate) fn to_object<'a>( let js_value = value.serialize(&serializer)?; for path in identifiers_paths.into_iter() { - if let Ok(bytes) = value.remove_value_at_path_into::>(path.clone()) { + if let Ok(bytes) = value.remove_value_at_path_into::>(path) { let buffer = Buffer::from_bytes_owned(bytes); if !options.skip_identifiers_conversion { lodash_set(&js_value, path, buffer.into()); diff --git a/packages/wasm-dpp/src/document/state_transition/document_batch_transition/mod.rs b/packages/wasm-dpp/src/document/state_transition/document_batch_transition/mod.rs index 559be4cbe0e..8904162c21f 100644 --- a/packages/wasm-dpp/src/document/state_transition/document_batch_transition/mod.rs +++ b/packages/wasm-dpp/src/document/state_transition/document_batch_transition/mod.rs @@ -1,17 +1,16 @@ use dpp::identity::KeyID; use dpp::{ - prelude::{DataContract, Identifier}, - state_transition::{StateTransitionFieldTypes, StateTransitionLike, StateTransitionType}, - util::json_value::JsonValueExt, + prelude::Identifier, + state_transition::{StateTransitionLike, StateTransitionType}, ProtocolError, }; -use js_sys::{Array, Reflect}; +use js_sys::Array; use serde::{Deserialize, Serialize}; use dpp::consensus::signature::SignatureError; use dpp::consensus::ConsensusError; -use dpp::platform_value::{BinaryData, ReplacementType}; +use dpp::platform_value::BinaryData; use dpp::serialization::PlatformSerializable; use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; use dpp::state_transition::documents_batch_transition::document_transition::DocumentTransition; @@ -23,8 +22,7 @@ use crate::{ bls_adapter::{BlsAdapter, JsBlsAdapter}, buffer::Buffer, identifier::IdentifierWrapper, - lodash::lodash_set, - utils::{Inner, IntoWasm, ToSerdeJSONExt, WithJsError}, + utils::{IntoWasm, WithJsError}, IdentityPublicKeyWasm, }; @@ -129,6 +127,11 @@ impl DocumentsBatchTransitionWasm { Ok(()) } + #[wasm_bindgen(js_name=setIdentityContractNonce)] + pub fn set_identity_contract_nonce(&mut self, nonce: u32) { + self.0.set_identity_contract_nonce(nonce as u64); + } + // #[wasm_bindgen(js_name=toJSON)] // pub fn to_json(&self) -> Result { // let value = self.0.to_json(false).with_js_error()?; @@ -277,7 +280,7 @@ impl DocumentsBatchTransitionWasm { state_transition .sign( &identity_public_key.to_owned().into(), - &private_key, + private_key, &bls_adapter, ) .with_js_error()?; @@ -382,6 +385,11 @@ impl DocumentsBatchTransitionWasm { self.0.is_identity_state_transition() } + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + #[wasm_bindgen(js_name=toBuffer)] pub fn to_buffer(&self) -> Result { let bytes = PlatformSerializable::serialize_to_bytes(&StateTransition::DocumentsBatch( diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_error.rs new file mode 100644 index 00000000000..fe2b0e356fa --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_error.rs @@ -0,0 +1,29 @@ +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use dpp::data_contract::errors::DataContractError; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=DataContractError)] +pub struct DataContractErrorWasm { + inner: DataContractError, +} + +impl From<&DataContractError> for DataContractErrorWasm { + fn from(e: &DataContractError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=DataContractError)] +impl DataContractErrorWasm { + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_have_new_unique_index_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_have_new_unique_index_error.rs index c652285833e..6b5a9bfb135 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_have_new_unique_index_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_have_new_unique_index_error.rs @@ -1,9 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::DataContractHaveNewUniqueIndexError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; -use serde::Serialize; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataContractHaveNewUniqueIndexError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs index 1f548f3400b..dfeb62ea537 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::DataContractImmutablePropertiesUpdateError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataContractImmutablePropertiesUpdateError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs index 02d3cd989c6..a1e040ea2bc 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::DataContractInvalidIndexDefinitionUpdateError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataContractInvalidIndexDefinitionUpdateError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs index 3ae3b67e1b1..97cb522ed15 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::data_contract_max_depth_exceed_error::DataContractMaxDepthExceedError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataContractMaxDepthExceedError)] @@ -23,11 +22,6 @@ impl DataContractMaxDepthExceedErrorWasm { self.inner.max_depth() } - #[wasm_bindgen(js_name=getSchemaDepth)] - pub fn get_schema_depth(&self) -> usize { - self.inner.schema_depth() - } - #[wasm_bindgen(js_name=getCode)] pub fn get_code(&self) -> u32 { ConsensusError::from(self.inner.clone()).code() diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_unique_indices_changed_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_unique_indices_changed_error.rs index c120d64cab3..20e2c698844 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_unique_indices_changed_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/data_contract_unique_indices_changed_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::DataContractUniqueIndicesChangedError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataContractUniqueIndicesChangedError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs new file mode 100644 index 00000000000..1d0c68edbe4 --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs @@ -0,0 +1,35 @@ +use crate::buffer::Buffer; +use dpp::consensus::basic::data_contract::DocumentTypesAreMissingError; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=DataContractEmptySchemaError)] +pub struct DocumentTypesAreMissingErrorWasm { + inner: DocumentTypesAreMissingError, +} + +impl From<&DocumentTypesAreMissingError> for DocumentTypesAreMissingErrorWasm { + fn from(e: &DocumentTypesAreMissingError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=DataContractEmptySchemaError)] +impl DocumentTypesAreMissingErrorWasm { + #[wasm_bindgen(js_name=getDataContractId)] + pub fn get_data_contract_id(&self) -> Buffer { + Buffer::from_bytes(self.inner.data_contract_id().as_bytes()) + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/duplicate_index_name_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/duplicate_index_name_error.rs index 15513194a0e..ba918fac1e5 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/duplicate_index_name_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/duplicate_index_name_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::DuplicateIndexNameError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DuplicateIndexNameError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs index 3813a0456e7..e3668bef0bf 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::IncompatibleDataContractSchemaError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IncompatibleDataContractSchemaError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs new file mode 100644 index 00000000000..9eb61c9467c --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs @@ -0,0 +1,39 @@ +use dpp::consensus::basic::data_contract::IncompatibleDocumentTypeSchemaError; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=IncompatibleDocumentTypeSchemaError)] +pub struct IncompatibleDocumentTypeSchemaErrorWasm { + inner: IncompatibleDocumentTypeSchemaError, +} + +impl From<&IncompatibleDocumentTypeSchemaError> for IncompatibleDocumentTypeSchemaErrorWasm { + fn from(e: &IncompatibleDocumentTypeSchemaError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=IncompatibleDocumentTypeSchemaError)] +impl IncompatibleDocumentTypeSchemaErrorWasm { + #[wasm_bindgen(js_name=getOperation)] + pub fn get_operation(&self) -> String { + self.inner.operation().to_string() + } + + #[wasm_bindgen(js_name=getPropertyPath)] + pub fn get_property_path(&self) -> String { + self.inner.property_path().to_string() + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_re2_pattern_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_re2_pattern_error.rs index 6c9713d8ec4..43965f817da 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_re2_pattern_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/incompatible_re2_pattern_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::IncompatibleRe2PatternError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IncompatibleRe2PatternError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/duplicate_index_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/duplicate_index_error.rs index 49ea7b32cd8..1f6bbffc4aa 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/duplicate_index_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/duplicate_index_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::DuplicateIndexError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DuplicateIndexError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_compound_index_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_compound_index_error.rs index 277d48852b8..efaceff0218 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_compound_index_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_compound_index_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::InvalidCompoundIndexError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidCompoundIndexError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_index_property_type_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_index_property_type_error.rs index 1020cb1c846..2f646ca6116 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_index_property_type_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_index_property_type_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::InvalidIndexPropertyTypeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIndexPropertyTypeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_indexed_property_constraint_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_indexed_property_constraint_error.rs index 76d16926ce1..dca2fc0da85 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_indexed_property_constraint_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/invalid_indexed_property_constraint_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::InvalidIndexedPropertyConstraintError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIndexedPropertyConstraintError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/system_property_index_already_present_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/system_property_index_already_present_error.rs index 0e4c7ce7ef2..5c3a9b7e671 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/system_property_index_already_present_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/system_property_index_already_present_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::SystemPropertyIndexAlreadyPresentError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=SystemPropertyIndexAlreadyPresentError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/undefined_index_property_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/undefined_index_property_error.rs index 320e125fef2..57a3b18642d 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/undefined_index_property_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/undefined_index_property_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::UndefinedIndexPropertyError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=UndefinedIndexPropertyError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/unique_indices_limit_reached_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/unique_indices_limit_reached_error.rs index 28e59aaa1b7..2f0b6095200 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/unique_indices_limit_reached_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/index_error/unique_indices_limit_reached_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::UniqueIndicesLimitReachedError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=UniqueIndicesLimitReachedError)] @@ -24,7 +23,7 @@ impl UniqueIndicesLimitReachedErrorWasm { } #[wasm_bindgen(js_name=getIndexLimit)] - pub fn get_index_limit(&self) -> usize { + pub fn get_index_limit(&self) -> u16 { self.inner.index_limit() } diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_id_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_id_error.rs index bbb268e6832..fbb5b85e076 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_id_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_id_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::InvalidDataContractIdError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidDataContractIdError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs index fac4faea028..a8302ebd5c8 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::InvalidDataContractVersionError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidDataContractVersionError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs new file mode 100644 index 00000000000..10f366a4206 --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs @@ -0,0 +1,34 @@ +use dpp::consensus::basic::data_contract::InvalidDocumentTypeNameError; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=InvalidDocumentTypeNameError)] +pub struct InvalidDocumentTypeNameErrorWasm { + inner: InvalidDocumentTypeNameError, +} + +#[wasm_bindgen] +impl InvalidDocumentTypeNameErrorWasm { + #[wasm_bindgen(js_name=getName)] + pub fn get_name(&self) -> String { + self.inner.name().to_string() + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} + +impl From<&InvalidDocumentTypeNameError> for InvalidDocumentTypeNameErrorWasm { + fn from(e: &InvalidDocumentTypeNameError) -> Self { + Self { inner: e.clone() } + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_json_schema_ref_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_json_schema_ref_error.rs index acfc5649d4b..ba9850c3ff3 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_json_schema_ref_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/invalid_json_schema_ref_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::data_contract::InvalidJsonSchemaRefError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidJsonSchemaRefError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/mod.rs b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/mod.rs index 6e462400e2a..0648bf0ea97 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/data_contract/mod.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/data_contract/mod.rs @@ -1,25 +1,33 @@ +mod data_contract_error; mod data_contract_have_new_unique_index_error; mod data_contract_immutable_properties_update_error; mod data_contract_invalid_index_definition_update_error; mod data_contract_max_depth_exceed_error; mod data_contract_unique_indices_changed_error; +mod document_types_are_missing_error; mod duplicate_index_name_error; mod incompatible_data_contract_schema_error; +mod incompatible_document_type_schema_error; mod incompatible_re2_pattern_error; mod index_error; mod invalid_data_contract_id_error; mod invalid_data_contract_version_error; +mod invalid_document_type_name_error; mod invalid_json_schema_ref_error; +pub use data_contract_error::*; pub use data_contract_have_new_unique_index_error::*; pub use data_contract_immutable_properties_update_error::*; pub use data_contract_invalid_index_definition_update_error::*; pub use data_contract_max_depth_exceed_error::*; pub use data_contract_unique_indices_changed_error::*; +pub use document_types_are_missing_error::*; pub use duplicate_index_name_error::*; pub use incompatible_data_contract_schema_error::*; +pub use incompatible_document_type_schema_error::*; pub use incompatible_re2_pattern_error::*; pub use index_error::*; pub use invalid_data_contract_id_error::*; pub use invalid_data_contract_version_error::*; +pub use invalid_document_type_name_error::*; pub use invalid_json_schema_ref_error::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs index 7dbe9697351..2ead008957b 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs @@ -1,9 +1,9 @@ use crate::buffer::Buffer; -use dpp::bincode::Decode; + use dpp::consensus::basic::decode::ProtocolVersionParsingError; use dpp::errors::consensus::codes::ErrorWithCode; use dpp::errors::consensus::ConsensusError; -use dpp::serialization::{PlatformSerializable, PlatformSerializableWithPlatformVersion}; +use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::version::PlatformVersion; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs index 7f6a305adb5..e6b61079152 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::decode::SerializedObjectParsingError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=SerializedObjectParsingError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/data_contract_not_present_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/data_contract_not_present_error.rs index f4c9ba08291..84d71151c1d 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/data_contract_not_present_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/data_contract_not_present_error.rs @@ -1,7 +1,7 @@ use dpp::consensus::basic::document::DataContractNotPresentError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; use crate::buffer::Buffer; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_ids_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_ids_error.rs index df745055ad6..5a181d38257 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_ids_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_ids_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::basic::document::DuplicateDocumentTransitionsWithIdsError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use std::iter::FromIterator; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_indices_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_indices_error.rs index ecad3fa37b0..c3b3ad159b2 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_indices_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/duplicate_document_transitions_with_indices_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::basic::document::DuplicateDocumentTransitionsWithIndicesError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use std::iter::FromIterator; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs new file mode 100644 index 00000000000..8254d685ecb --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs @@ -0,0 +1,34 @@ +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=IdentityContractNonceOutOfBoundsError)] +pub struct IdentityContractNonceOutOfBoundsErrorWasm { + inner: NonceOutOfBoundsError, +} + +impl From<&NonceOutOfBoundsError> for IdentityContractNonceOutOfBoundsErrorWasm { + fn from(e: &NonceOutOfBoundsError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=IdentityContractNonceOutOfBoundsError)] +impl IdentityContractNonceOutOfBoundsErrorWasm { + #[wasm_bindgen(js_name=getIdentityContractNonce)] + pub fn get_identity_contract_nonce(&self) -> u64 { + self.inner.identity_contract_nonce() + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/inconsistent_compound_index_data_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/inconsistent_compound_index_data_error.rs index daa7ae7179b..6277f2713f0 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/inconsistent_compound_index_data_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/inconsistent_compound_index_data_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::document::InconsistentCompoundIndexDataError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use js_sys::JsString; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_action_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_action_error.rs index cb328b4e824..a144198bc08 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_action_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_action_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::document::InvalidDocumentTransitionActionError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidDocumentTransitionActionError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_id_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_id_error.rs index c5692f3c38a..86510ecc874 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_id_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_transition_id_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::basic::document::InvalidDocumentTransitionIdError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidDocumentTransitionIdError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_type_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_type_error.rs index 4a862b23a93..c78ef8f13f3 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_type_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/invalid_document_type_error.rs @@ -1,7 +1,7 @@ use dpp::consensus::basic::document::InvalidDocumentTypeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; use crate::buffer::Buffer; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_data_contract_id_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_data_contract_id_error.rs index 8c0f1a45b06..7a4ca857a63 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_data_contract_id_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_data_contract_id_error.rs @@ -1,10 +1,8 @@ use dpp::consensus::basic::document::MissingDataContractIdBasicError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; -use wasm_bindgen::prelude::*; -use crate::buffer::Buffer; +use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MissingDataContractIdError)] pub struct MissingDataContractIdErrorWasm { diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_action_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_action_error.rs index 9bcd1e6152e..90c1cdfd5f0 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_action_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_action_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::document::MissingDocumentTransitionActionError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MissingDocumentTransitionActionError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_type_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_type_error.rs index 65e3bdbda39..6c46f957239 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_type_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_transition_type_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::document::MissingDocumentTransitionTypeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MissingDocumentTransitionTypeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_type_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_type_error.rs index b11a4b3a25c..f1ff0c35d7f 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_type_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/missing_document_type_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::document::MissingDocumentTypeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MissingDocumentTypeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/document/mod.rs b/packages/wasm-dpp/src/errors/consensus/basic/document/mod.rs index 9015719ebc0..fedc3b69b75 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/document/mod.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/document/mod.rs @@ -2,6 +2,7 @@ mod data_contract_not_present_error; mod document_transitions_are_absent_error; mod duplicate_document_transitions_with_ids_error; mod duplicate_document_transitions_with_indices_error; +mod identity_contract_nonce_out_of_bounds_error; mod inconsistent_compound_index_data_error; mod invalid_document_transition_action_error; mod invalid_document_transition_id_error; @@ -15,6 +16,7 @@ pub use data_contract_not_present_error::*; pub use document_transitions_are_absent_error::*; pub use duplicate_document_transitions_with_ids_error::*; pub use duplicate_document_transitions_with_indices_error::*; +pub use identity_contract_nonce_out_of_bounds_error::*; pub use inconsistent_compound_index_data_error::*; pub use invalid_document_transition_action_error::*; pub use invalid_document_transition_id_error::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/duplicated_identity_public_key_id_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/duplicated_identity_public_key_id_error.rs index 9e1139970d2..5dbead8bbfd 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/duplicated_identity_public_key_id_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/duplicated_identity_public_key_id_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::DuplicatedIdentityPublicKeyIdBasicError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DuplicatedIdentityPublicKeyIdError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_proof_locked_transaction_mismatch_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_proof_locked_transaction_mismatch_error.rs index ec835f215be..565392603e6 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_proof_locked_transaction_mismatch_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_proof_locked_transaction_mismatch_error.rs @@ -2,7 +2,7 @@ use dpp::consensus::basic::identity::IdentityAssetLockProofLockedTransactionMism use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; use dpp::dashcore::hashes::Hash; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; use crate::buffer::Buffer; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs new file mode 100644 index 00000000000..997414b434a --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs @@ -0,0 +1,47 @@ +use dpp::consensus::basic::identity::IdentityAssetLockStateTransitionReplayError; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use dpp::dashcore::hashes::Hash; +use wasm_bindgen::prelude::*; + +use crate::buffer::Buffer; + +#[wasm_bindgen(js_name=IdentityAssetLockTransactionReplayError)] +pub struct IdentityAssetLockStateTransitionReplayErrorWasm { + inner: IdentityAssetLockStateTransitionReplayError, +} + +impl From<&IdentityAssetLockStateTransitionReplayError> + for IdentityAssetLockStateTransitionReplayErrorWasm +{ + fn from(e: &IdentityAssetLockStateTransitionReplayError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=IdentityAssetLockTransactionReplayError)] +impl IdentityAssetLockStateTransitionReplayErrorWasm { + #[wasm_bindgen(js_name=getTransactionId)] + pub fn transaction_id(&self) -> Buffer { + let tx_id = self.inner.transaction_id(); + let mut tx_id_bytes = tx_id.to_byte_array(); + tx_id_bytes.reverse(); + Buffer::from_bytes(&tx_id_bytes) + } + + #[wasm_bindgen(js_name=getCode)] + pub fn code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + #[wasm_bindgen(js_name=getStateTransitionId)] + pub fn state_transition_id(&self) -> Buffer { + let state_transition_id = self.inner.state_transition_id(); + let state_transition_id_bytes = state_transition_id.to_buffer(); + Buffer::from_bytes(&state_transition_id_bytes) + } + #[wasm_bindgen(js_name=getOutputIndex)] + pub fn output_index(&self) -> usize { + self.inner.output_index() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_is_not_found_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_is_not_found_error.rs index ebd0e63f9f6..774828ff7cc 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_is_not_found_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_is_not_found_error.rs @@ -1,7 +1,7 @@ use dpp::consensus::basic::identity::IdentityAssetLockTransactionIsNotFoundError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; use crate::buffer::Buffer; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs index aa2631aa2ed..39a5262f92d 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs @@ -1,21 +1,21 @@ -use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointAlreadyExistsError; +use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointAlreadyConsumedError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; use dpp::dashcore::hashes::Hash; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; use crate::buffer::Buffer; #[wasm_bindgen(js_name=IdentityAssetLockTransactionOutPointAlreadyExistsError)] pub struct IdentityAssetLockTransactionOutPointAlreadyExistsErrorWasm { - inner: IdentityAssetLockTransactionOutPointAlreadyExistsError, + inner: IdentityAssetLockTransactionOutPointAlreadyConsumedError, } -impl From<&IdentityAssetLockTransactionOutPointAlreadyExistsError> +impl From<&IdentityAssetLockTransactionOutPointAlreadyConsumedError> for IdentityAssetLockTransactionOutPointAlreadyExistsErrorWasm { - fn from(e: &IdentityAssetLockTransactionOutPointAlreadyExistsError) -> Self { + fn from(e: &IdentityAssetLockTransactionOutPointAlreadyConsumedError) -> Self { Self { inner: e.clone() } } } diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_output_not_found_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_output_not_found_error.rs index 4dd51e32983..c95d911371a 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_output_not_found_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_output_not_found_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutputNotFoundError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IdentityAssetLockTransactionOutputNotFoundError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_insufficient_balance_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_insufficient_balance_error.rs index c6f09e7400a..d6b16a71862 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_insufficient_balance_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/identity_insufficient_balance_error.rs @@ -1,10 +1,7 @@ -use crate::buffer::Buffer; use crate::identifier::IdentifierWrapper; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::IdentityInsufficientBalanceError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; -use std::ops::Deref; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IdentityInsufficientBalanceError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_core_chain_height_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_core_chain_height_error.rs index 462ed2971be..a9af7ffae2d 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_core_chain_height_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_core_chain_height_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidAssetLockProofCoreChainHeightError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidAssetLockProofCoreChainHeightError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs index 28c4026c207..a1dccbd7f0b 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidAssetLockProofTransactionHeightError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidAssetLockProofTransactionHeightError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_transaction_output_return_size_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_transaction_output_return_size_error.rs index 6c2501792e8..f206d0814f5 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_transaction_output_return_size_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_lock_transaction_output_return_size_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidAssetLockTransactionOutputReturnSizeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidAssetLockTransactionOutputReturnSizeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_transaction_out_point_not_enough_balance_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_transaction_out_point_not_enough_balance_error.rs new file mode 100644 index 00000000000..61728ed533e --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_asset_transaction_out_point_not_enough_balance_error.rs @@ -0,0 +1,61 @@ +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use crate::buffer::Buffer; +use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointNotEnoughBalanceError; +use dpp::dashcore::hashes::Hash; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=IdentityAssetLockTransactionOutPointNotEnoughBalanceError)] +pub struct IdentityAssetLockTransactionOutPointNotEnoughBalanceErrorWasm { + inner: IdentityAssetLockTransactionOutPointNotEnoughBalanceError, +} + +impl From<&IdentityAssetLockTransactionOutPointNotEnoughBalanceError> + for IdentityAssetLockTransactionOutPointNotEnoughBalanceErrorWasm +{ + fn from(e: &IdentityAssetLockTransactionOutPointNotEnoughBalanceError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=IdentityAssetLockTransactionOutPointNotEnoughBalanceError)] +impl IdentityAssetLockTransactionOutPointNotEnoughBalanceErrorWasm { + #[wasm_bindgen(js_name=getTransactionId)] + pub fn transaction_id(&self) -> Buffer { + let tx_id = self.inner.transaction_id(); + let mut tx_id_bytes = tx_id.to_byte_array(); + tx_id_bytes.reverse(); + Buffer::from_bytes(&tx_id_bytes) + } + + #[wasm_bindgen(js_name=getOutputIndex)] + pub fn output_index(&self) -> usize { + self.inner.output_index() + } + + #[wasm_bindgen(js_name=getInitialAssetLockCredits)] + pub fn initial_asset_lock_credits(&self) -> u64 { + self.inner.initial_asset_lock_credits() + } + + #[wasm_bindgen(js_name=getCreditsLeft)] + pub fn credits_left(&self) -> u64 { + self.inner.credits_left() + } + + #[wasm_bindgen(js_name=getCreditsRequired)] + pub fn credits_required(&self) -> u64 { + self.inner.credits_required() + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs index 7ba3c5dbb74..195121ffd10 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidIdentityAssetLockTransactionError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityAssetLockTransactionError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_output_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_output_error.rs index 3c9f165960a..b87c2491675 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_output_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_output_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidIdentityAssetLockTransactionOutputError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityAssetLockTransactionOutputError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_transfer_amount_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_transfer_amount_error.rs new file mode 100644 index 00000000000..8a27502bf86 --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_transfer_amount_error.rs @@ -0,0 +1,41 @@ +use dpp::consensus::basic::identity::InvalidIdentityCreditTransferAmountError; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=InvalidIdentityCreditTransferAmountError)] +pub struct InvalidIdentityCreditTransferAmountErrorWasm { + inner: InvalidIdentityCreditTransferAmountError, +} + +impl From<&InvalidIdentityCreditTransferAmountError> + for InvalidIdentityCreditTransferAmountErrorWasm +{ + fn from(e: &InvalidIdentityCreditTransferAmountError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=InvalidIdentityCreditTransferAmountError)] +impl InvalidIdentityCreditTransferAmountErrorWasm { + #[wasm_bindgen(js_name=getAmount)] + pub fn amount(&self) -> u64 { + self.inner.amount() + } + + #[wasm_bindgen(js_name=getMinAmount)] + pub fn min_amount(&self) -> u64 { + self.inner.min_amount() + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs index 7472cd9c71f..fa0a40a52f2 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidIdentityCreditWithdrawalTransitionCoreFeeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityCreditWithdrawalTransitionCoreFeeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_output_script_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_output_script_error.rs index bada2052da3..055c644d085 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_output_script_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_output_script_error.rs @@ -1,10 +1,8 @@ use dpp::consensus::basic::identity::InvalidIdentityCreditWithdrawalTransitionOutputScriptError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; -use wasm_bindgen::prelude::*; -use crate::buffer::Buffer; +use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityCreditWithdrawalTransitionOutputScriptError)] pub struct InvalidIdentityCreditWithdrawalTransitionOutputScriptErrorWasm { diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_pooling_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_pooling_error.rs index 46882b76b1f..2fed16a2b97 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_pooling_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_pooling_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::NotImplementedIdentityCreditWithdrawalTransitionPoolingError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=NotImplementedIdentityCreditWithdrawalTransitionPoolingError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_key_signature_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_key_signature_error.rs index 98d3034409b..74bafedc23c 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_key_signature_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_key_signature_error.rs @@ -1,9 +1,8 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidIdentityKeySignatureError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; use dpp::identity::KeyID; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityKeySignatureError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_data_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_data_error.rs index 1e1f1090f7a..2a5c502479b 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_data_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_data_error.rs @@ -1,10 +1,8 @@ use dpp::consensus::basic::identity::InvalidIdentityPublicKeyDataError; use dpp::errors::consensus::codes::ErrorWithCode; -use crate::buffer::Buffer; -use dpp::consensus::ConsensusError; use dpp::errors::consensus::ConsensusError as DPPConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityPublicKeyDataError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs index 66339af4e7b..ed739d25e38 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs @@ -1,10 +1,8 @@ use dpp::consensus::basic::identity::InvalidIdentityPublicKeySecurityLevelError; use dpp::errors::consensus::codes::ErrorWithCode; -use crate::buffer::Buffer; -use dpp::consensus::ConsensusError; use dpp::errors::consensus::ConsensusError as DPPConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityPublicKeySecurityLevelError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_type_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_type_error.rs index 211404737aa..b3c306f649f 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_type_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_identity_public_key_type_error.rs @@ -1,12 +1,11 @@ use std::convert::TryFrom; -use crate::buffer::Buffer; use crate::utils::WithJsError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::InvalidIdentityPublicKeyTypeError; use dpp::consensus::ConsensusError; use dpp::identity::KeyType; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityPublicKeyTypeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_error.rs index 78abcca9cbd..6aac1644064 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidInstantAssetLockProofError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidInstantAssetLockProofError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs index 992aa652f77..8637f55f00b 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::InvalidInstantAssetLockProofSignatureError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidInstantAssetLockProofSignatureError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_master_public_key_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_master_public_key_error.rs index a353a6123de..1d3eb91f2bf 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_master_public_key_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_master_public_key_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::identity::MissingMasterPublicKeyError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MissingMasterPublicKeyError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_public_key_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_public_key_error.rs index 886d4b05f6b..b1ee253aa5b 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_public_key_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/missing_public_key_error.rs @@ -1,9 +1,8 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::MissingPublicKeyError; use dpp::consensus::ConsensusError; use dpp::identity::KeyID; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MissingPublicKeyError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/identity/mod.rs b/packages/wasm-dpp/src/errors/consensus/basic/identity/mod.rs index 87dfbdc1ba6..7508eccc970 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/identity/mod.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/identity/mod.rs @@ -1,6 +1,7 @@ mod duplicated_identity_public_key_error; mod duplicated_identity_public_key_id_error; mod identity_asset_lock_proof_locked_transaction_mismatch_error; +mod identity_asset_lock_state_transition_replay_error; mod identity_asset_lock_transaction_is_not_found_error; mod identity_asset_lock_transaction_out_point_already_exists_error; mod identity_asset_lock_transaction_output_not_found_error; @@ -9,9 +10,11 @@ mod identity_insufficient_balance_error; mod invalid_asset_lock_proof_core_chain_height_error; mod invalid_asset_lock_proof_transaction_height_error; mod invalid_asset_lock_transaction_output_return_size_error; +mod invalid_asset_transaction_out_point_not_enough_balance_error; mod invalid_identity_asset_lock_proof_chain_lock_validation_error; mod invalid_identity_asset_lock_transaction_error; mod invalid_identity_asset_lock_transaction_output_error; +mod invalid_identity_credit_transfer_amount_error; mod invalid_identity_credit_withdrawal_transition_core_fee_error; mod invalid_identity_credit_withdrawal_transition_output_script_error; mod invalid_identity_credit_withdrawal_transition_pooling_error; @@ -27,6 +30,7 @@ mod missing_public_key_error; pub use duplicated_identity_public_key_error::*; pub use duplicated_identity_public_key_id_error::*; pub use identity_asset_lock_proof_locked_transaction_mismatch_error::*; +pub use identity_asset_lock_state_transition_replay_error::*; pub use identity_asset_lock_transaction_is_not_found_error::*; pub use identity_asset_lock_transaction_out_point_already_exists_error::*; pub use identity_asset_lock_transaction_output_not_found_error::*; @@ -35,9 +39,11 @@ pub use identity_insufficient_balance_error::*; pub use invalid_asset_lock_proof_core_chain_height_error::*; pub use invalid_asset_lock_proof_transaction_height_error::*; pub use invalid_asset_lock_transaction_output_return_size_error::*; +pub use invalid_asset_transaction_out_point_not_enough_balance_error::*; pub use invalid_identity_asset_lock_proof_chain_lock_validation_error::*; pub use invalid_identity_asset_lock_transaction_error::*; pub use invalid_identity_asset_lock_transaction_output_error::*; +pub use invalid_identity_credit_transfer_amount_error::*; pub use invalid_identity_credit_withdrawal_transition_core_fee_error::*; pub use invalid_identity_credit_withdrawal_transition_output_script_error::*; pub use invalid_identity_credit_withdrawal_transition_pooling_error::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/incompatible_protocol_version_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/incompatible_protocol_version_error.rs index de0754a754a..34beb02237c 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/incompatible_protocol_version_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/incompatible_protocol_version_error.rs @@ -1,9 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::IncompatibleProtocolVersionError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IncompatibleProtocolVersionError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/invalid_identifier_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/invalid_identifier_error.rs index 77abe190db9..b364d38462f 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/invalid_identifier_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/invalid_identifier_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::invalid_identifier_error::InvalidIdentifierError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentifierError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/invalid_signature_public_key_purpose_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/invalid_signature_public_key_purpose_error.rs new file mode 100644 index 00000000000..835d9559a83 --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/basic/invalid_signature_public_key_purpose_error.rs @@ -0,0 +1,39 @@ +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::signature::InvalidSignaturePublicKeyPurposeError; +use dpp::consensus::ConsensusError; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=InvalidSignaturePublicKeyPurposeError)] +pub struct InvalidSignaturePublicKeyPurposeErrorWasm { + inner: InvalidSignaturePublicKeyPurposeError, +} + +impl From<&InvalidSignaturePublicKeyPurposeError> for InvalidSignaturePublicKeyPurposeErrorWasm { + fn from(e: &InvalidSignaturePublicKeyPurposeError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=InvalidSignaturePublicKeyPurposeError)] +impl InvalidSignaturePublicKeyPurposeErrorWasm { + #[wasm_bindgen(js_name=getPublicKeyPurpose)] + pub fn get_public_key_purpose(&self) -> u8 { + self.inner.public_key_purpose() as u8 + } + + #[wasm_bindgen(js_name=getKeyPurposeRequirement)] + pub fn get_allowed_key_purpose(&self) -> u8 { + self.inner.allowed_key_purpose() as u8 + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/basic/invalid_signature_public_key_security_level_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/invalid_signature_public_key_security_level_error.rs index eb2985b4590..64c9afdb307 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/invalid_signature_public_key_security_level_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/invalid_signature_public_key_security_level_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::InvalidSignaturePublicKeySecurityLevelError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidSignaturePublicKeySecurityLevelError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/invalid_state_transition_signature_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/invalid_state_transition_signature_error.rs index 769f00041e6..ae335afaf45 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/invalid_state_transition_signature_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/invalid_state_transition_signature_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::InvalidStateTransitionSignatureError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidStateTransitionSignatureError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/json_schema_compilation_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/json_schema_compilation_error.rs index e011a1d1cd1..ba7529fb6d8 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/json_schema_compilation_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/json_schema_compilation_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::json_schema_compilation_error::JsonSchemaCompilationError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=JsonSchemaCompilationError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/json_schema_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/json_schema_error.rs index 27a96e4d836..e46691ad39a 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/json_schema_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/json_schema_error.rs @@ -5,8 +5,6 @@ use dpp::errors::consensus::codes::ErrorWithCode; use dpp::errors::consensus::ConsensusError; -use crate::buffer::Buffer; -use dpp::serialization::PlatformSerializable; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=JsonSchemaError, inspectable)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/mod.rs b/packages/wasm-dpp/src/errors/consensus/basic/mod.rs index d1bc60b4c35..a67ecbcb529 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/mod.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/mod.rs @@ -4,6 +4,7 @@ pub mod document; pub mod identity; mod incompatible_protocol_version_error; mod invalid_identifier_error; +mod invalid_signature_public_key_purpose_error; mod invalid_signature_public_key_security_level_error; mod invalid_state_transition_signature_error; mod json_schema_compilation_error; @@ -19,14 +20,13 @@ mod wrong_public_key_purpose_error; pub use incompatible_protocol_version_error::*; pub use invalid_identifier_error::*; +pub use invalid_signature_public_key_purpose_error::*; pub use invalid_signature_public_key_security_level_error::*; pub use invalid_state_transition_signature_error::*; pub use json_schema_compilation_error::*; pub use json_schema_error::*; pub use public_key_is_disabled_error::*; pub use public_key_security_level_not_met_error::*; -#[cfg(test)] -pub use test_consensus_error::*; pub use unsupported_protocol_version_error::*; pub use unsupported_version_error::*; pub use wrong_public_key_purpose_error::*; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/public_key_is_disabled_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/public_key_is_disabled_error.rs index 8dedd5ce4bb..86959138e93 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/public_key_is_disabled_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/public_key_is_disabled_error.rs @@ -1,9 +1,8 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::PublicKeyIsDisabledError; use dpp::consensus::ConsensusError; use dpp::identity::KeyID; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=PublicKeyIsDisabledError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/public_key_security_level_not_met_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/public_key_security_level_not_met_error.rs index dfa02bf8fbb..eb69de4fefa 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/public_key_security_level_not_met_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/public_key_security_level_not_met_error.rs @@ -1,10 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::PublicKeySecurityLevelNotMetError; use dpp::consensus::ConsensusError; -use serde::Serialize; -use dpp::serialization::PlatformSerializable; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=PublicKeySecurityLevelNotMetError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/state_transition/invalid_state_transition_type_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/state_transition/invalid_state_transition_type_error.rs index e26e03e5432..2da6a6ba061 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/state_transition/invalid_state_transition_type_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/state_transition/invalid_state_transition_type_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::state_transition::InvalidStateTransitionTypeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidStateTransitionTypeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/state_transition/missing_state_transition_type_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/state_transition/missing_state_transition_type_error.rs index 03781fd2a32..d0ea289fc74 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/state_transition/missing_state_transition_type_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/state_transition/missing_state_transition_type_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::state_transition::MissingStateTransitionTypeError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MissingStateTransitionTypeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs index 210cd09b5e2..ac0f5a009df 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::state_transition::StateTransitionMaxSizeExceededError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=StateTransitionMaxSizeExceededError)] @@ -18,14 +17,14 @@ impl From<&StateTransitionMaxSizeExceededError> for StateTransitionMaxSizeExceed #[wasm_bindgen(js_class=StateTransitionMaxSizeExceededError)] impl StateTransitionMaxSizeExceededErrorWasm { - #[wasm_bindgen(js_name=getActualSizeKBytes)] - pub fn get_actual_size_kbytes(&self) -> usize { - self.inner.actual_size_kbytes() + #[wasm_bindgen(js_name=getActualSizeBytes)] + pub fn get_actual_size_bytes(&self) -> u64 { + self.inner.actual_size_bytes() } - #[wasm_bindgen(js_name=getMaxSizeKBytes)] - pub fn get_max_size_kbytes(&self) -> usize { - self.inner.max_size_kbytes() + #[wasm_bindgen(js_name=getMaxSizeBytes)] + pub fn get_max_size_bytes(&self) -> u64 { + self.inner.max_size_bytes() } #[wasm_bindgen(js_name=getCode)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs index dfdd049508e..e675a146ff2 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::UnsupportedProtocolVersionError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=UnsupportedProtocolVersionError)] diff --git a/packages/wasm-dpp/src/errors/consensus/basic/unsupported_version_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/unsupported_version_error.rs index 2066353bf64..9e48c407dff 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/unsupported_version_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/unsupported_version_error.rs @@ -1,4 +1,3 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::UnsupportedVersionError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; diff --git a/packages/wasm-dpp/src/errors/consensus/basic/wrong_public_key_purpose_error.rs b/packages/wasm-dpp/src/errors/consensus/basic/wrong_public_key_purpose_error.rs index 95724268b1e..ff07e997011 100644 --- a/packages/wasm-dpp/src/errors/consensus/basic/wrong_public_key_purpose_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/basic/wrong_public_key_purpose_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::WrongPublicKeyPurposeError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=WrongPublicKeyPurposeError)] diff --git a/packages/wasm-dpp/src/errors/consensus/consensus_error.rs b/packages/wasm-dpp/src/errors/consensus/consensus_error.rs index 89df1a6d09a..c9262628e85 100644 --- a/packages/wasm-dpp/src/errors/consensus/consensus_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/consensus_error.rs @@ -1,15 +1,17 @@ use crate::errors::consensus::basic::{ - IncompatibleProtocolVersionErrorWasm, InvalidIdentifierErrorWasm, JsonSchemaErrorWasm, + IncompatibleProtocolVersionErrorWasm, InvalidIdentifierErrorWasm, + InvalidSignaturePublicKeyPurposeErrorWasm, JsonSchemaErrorWasm, UnsupportedProtocolVersionErrorWasm, UnsupportedVersionErrorWasm, }; use dpp::consensus::ConsensusError as DPPConsensusError; -use std::ops::Deref; use crate::errors::consensus::basic::identity::{ DuplicatedIdentityPublicKeyErrorWasm, DuplicatedIdentityPublicKeyIdErrorWasm, IdentityAssetLockProofLockedTransactionMismatchErrorWasm, + IdentityAssetLockStateTransitionReplayErrorWasm, IdentityAssetLockTransactionIsNotFoundErrorWasm, IdentityAssetLockTransactionOutPointAlreadyExistsErrorWasm, + IdentityAssetLockTransactionOutPointNotEnoughBalanceErrorWasm, IdentityAssetLockTransactionOutputNotFoundErrorWasm, IdentityCreditTransferToSelfErrorWasm, IdentityInsufficientBalanceErrorWasm, InvalidAssetLockProofCoreChainHeightErrorWasm, InvalidAssetLockProofTransactionHeightErrorWasm, @@ -17,6 +19,7 @@ use crate::errors::consensus::basic::identity::{ InvalidIdentityAssetLockProofChainLockValidationErrorWasm, InvalidIdentityAssetLockTransactionErrorWasm, InvalidIdentityAssetLockTransactionOutputErrorWasm, + InvalidIdentityCreditTransferAmountErrorWasm, InvalidIdentityCreditWithdrawalTransitionCoreFeeErrorWasm, InvalidIdentityCreditWithdrawalTransitionOutputScriptErrorWasm, InvalidIdentityKeySignatureErrorWasm, InvalidIdentityPublicKeyDataErrorWasm, @@ -27,42 +30,69 @@ use crate::errors::consensus::basic::identity::{ use crate::errors::consensus::state::identity::{ DuplicatedIdentityPublicKeyIdStateErrorWasm, DuplicatedIdentityPublicKeyStateErrorWasm, - MissingIdentityPublicKeyIdsErrorWasm, + InvalidIdentityNonceErrorWasm, MissingIdentityPublicKeyIdsErrorWasm, }; -use dpp::consensus::basic::BasicError; +use dpp::consensus::basic::decode::VersionError; use dpp::consensus::basic::BasicError::{ DuplicatedIdentityPublicKeyBasicError, DuplicatedIdentityPublicKeyIdBasicError, IdentityAssetLockProofLockedTransactionMismatchError, - IdentityAssetLockTransactionIsNotFoundError, - IdentityAssetLockTransactionOutPointAlreadyExistsError, + IdentityAssetLockStateTransitionReplayError, IdentityAssetLockTransactionIsNotFoundError, + IdentityAssetLockTransactionOutPointAlreadyConsumedError, + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, IdentityAssetLockTransactionOutputNotFoundError, IncompatibleProtocolVersionError, IncompatibleRe2PatternError, InvalidAssetLockProofCoreChainHeightError, InvalidAssetLockProofTransactionHeightError, InvalidAssetLockTransactionOutputReturnSizeError, InvalidIdentityAssetLockProofChainLockValidationError, InvalidIdentityAssetLockTransactionError, InvalidIdentityAssetLockTransactionOutputError, + InvalidIdentityCreditTransferAmountError, InvalidIdentityCreditWithdrawalTransitionCoreFeeError, InvalidIdentityCreditWithdrawalTransitionOutputScriptError, InvalidIdentityPublicKeyDataError, InvalidIdentityPublicKeySecurityLevelError, InvalidInstantAssetLockProofError, - InvalidInstantAssetLockProofSignatureError, JsonSchemaError, MissingMasterPublicKeyError, + InvalidInstantAssetLockProofSignatureError, MissingMasterPublicKeyError, NotImplementedIdentityCreditWithdrawalTransitionPoolingError, ProtocolVersionParsingError, - SerializedObjectParsingError, UnsupportedProtocolVersionError, UnsupportedVersionError, + UnsupportedProtocolVersionError, UnsupportedVersionError, }; +use dpp::consensus::basic::{BasicError, UnsupportedFeatureError}; use dpp::consensus::fee::fee_error::FeeError; use dpp::consensus::signature::SignatureError; - -// TODO(versioning): remove -// use dpp::consensus::state::data_trigger::data_trigger_error::DataTriggerError; use dpp::consensus::state::state_error::StateError; +use dpp::consensus::state::data_trigger::DataTriggerError::{ + DataTriggerConditionError, DataTriggerExecutionError, DataTriggerInvalidResultError, +}; use wasm_bindgen::{JsError, JsValue}; +use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, ContestedUniqueIndexWithUniqueIndexError, InvalidDocumentTypeRequiredSecurityLevelError, UnknownDocumentCreationRestrictionModeError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError}; +use dpp::consensus::basic::document::{DocumentCreationNotAllowedError, DocumentFieldMaxSizeExceededError, MaxDocumentsTransitionsExceededError, MissingPositionsInDocumentTypePropertiesError}; +use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, TooManyMasterPublicKeyError}; +use dpp::consensus::basic::overflow_error::OverflowError; +use dpp::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError; +use dpp::consensus::state::document::document_contest_currently_locked_error::DocumentContestCurrentlyLockedError; +use dpp::consensus::state::document::document_contest_identity_already_contestant::DocumentContestIdentityAlreadyContestantError; +use dpp::consensus::state::document::document_contest_not_joinable_error::DocumentContestNotJoinableError; +use dpp::consensus::state::document::document_incorrect_purchase_price_error::DocumentIncorrectPurchasePriceError; +use dpp::consensus::state::document::document_not_for_sale_error::DocumentNotForSaleError; +use dpp::consensus::state::identity::identity_public_key_already_exists_for_unique_contract_bounds_error::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError; +use dpp::consensus::state::identity::master_public_key_update_error::MasterPublicKeyUpdateError; +use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_insufficient_error::PrefundedSpecializedBalanceInsufficientError; +use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError; +use dpp::consensus::state::voting::masternode_incorrect_voter_identity_id_error::MasternodeIncorrectVoterIdentityIdError; +use dpp::consensus::state::voting::masternode_incorrect_voting_address_error::MasternodeIncorrectVotingAddressError; +use dpp::consensus::state::voting::masternode_not_found_error::MasternodeNotFoundError; +use dpp::consensus::state::voting::masternode_vote_already_present_error::MasternodeVoteAlreadyPresentError; +use dpp::consensus::state::voting::masternode_voted_too_many_times::MasternodeVotedTooManyTimesError; +use dpp::consensus::state::voting::vote_poll_not_available_for_voting_error::VotePollNotAvailableForVotingError; +use dpp::consensus::state::voting::vote_poll_not_found_error::VotePollNotFoundError; use crate::errors::consensus::basic::data_contract::{ - DataContractHaveNewUniqueIndexErrorWasm, DataContractImmutablePropertiesUpdateErrorWasm, + DataContractErrorWasm, DataContractHaveNewUniqueIndexErrorWasm, + DataContractImmutablePropertiesUpdateErrorWasm, DataContractInvalidIndexDefinitionUpdateErrorWasm, DataContractUniqueIndicesChangedErrorWasm, - IncompatibleDataContractSchemaErrorWasm, InvalidDataContractIdErrorWasm, + IncompatibleDataContractSchemaErrorWasm, IncompatibleDocumentTypeSchemaErrorWasm, + InvalidDataContractIdErrorWasm, InvalidDocumentTypeNameErrorWasm, }; use crate::errors::consensus::basic::document::{ - DuplicateDocumentTransitionsWithIdsErrorWasm, DuplicateDocumentTransitionsWithIndicesErrorWasm, + DocumentTransitionsAreAbsentErrorWasm, DuplicateDocumentTransitionsWithIdsErrorWasm, + DuplicateDocumentTransitionsWithIndicesErrorWasm, IdentityContractNonceOutOfBoundsErrorWasm, InvalidDocumentTransitionActionErrorWasm, InvalidDocumentTransitionIdErrorWasm, MissingDataContractIdErrorWasm, MissingDocumentTypeErrorWasm, }; @@ -74,12 +104,12 @@ use crate::errors::consensus::signature::{ BasicBLSErrorWasm, BasicECDSAErrorWasm, IdentityNotFoundErrorWasm, SignatureShouldNotBePresentErrorWasm, }; -// use crate::errors::consensus::state::data_contract::data_trigger::{ -// DataTriggerConditionErrorWasm, DataTriggerExecutionErrorWasm, -// }; +use crate::errors::consensus::state::data_contract::data_trigger::{ + DataTriggerConditionErrorWasm, DataTriggerExecutionErrorWasm, DataTriggerInvalidResultErrorWasm, +}; use crate::errors::consensus::state::data_contract::{ DataContractAlreadyPresentErrorWasm, DataContractConfigUpdateErrorWasm, - DataContractIsReadonlyErrorWasm, + DataContractIsReadonlyErrorWasm, DataContractUpdatePermissionErrorWasm, }; use crate::errors::consensus::state::document::{ DocumentAlreadyPresentErrorWasm, DocumentNotFoundErrorWasm, DocumentOwnerIdMismatchErrorWasm, @@ -87,10 +117,9 @@ use crate::errors::consensus::state::document::{ DuplicateUniqueIndexErrorWasm, InvalidDocumentRevisionErrorWasm, }; use crate::errors::consensus::state::identity::{ - IdentityAlreadyExistsErrorWasm, IdentityPublicKeyDisabledAtWindowViolationErrorWasm, - IdentityPublicKeyIsDisabledErrorWasm, IdentityPublicKeyIsReadOnlyErrorWasm, - InvalidIdentityPublicKeyIdErrorWasm, InvalidIdentityRevisionErrorWasm, - MaxIdentityPublicKeyLimitReachedErrorWasm, + IdentityAlreadyExistsErrorWasm, IdentityPublicKeyIsDisabledErrorWasm, + IdentityPublicKeyIsReadOnlyErrorWasm, InvalidIdentityPublicKeyIdErrorWasm, + InvalidIdentityRevisionErrorWasm, MaxIdentityPublicKeyLimitReachedErrorWasm, }; use crate::errors::consensus::basic::data_contract::{ @@ -119,8 +148,8 @@ use crate::errors::consensus::basic::{ }; use crate::errors::consensus::fee::BalanceIsNotEnoughErrorWasm; -// use crate::errors::consensus::state::data_contract::data_trigger::DataTriggerInvalidResultErrorWasm; use crate::errors::consensus::value_error::ValueErrorWasm; +use crate::generic_consensus_error; use super::state::document::DocumentTimestampsAreEqualErrorWasm; @@ -133,11 +162,14 @@ pub fn from_consensus_error_ref(e: &DPPConsensusError) -> JsValue { DPPConsensusError::StateError(state_error) => from_state_error(state_error), DPPConsensusError::BasicError(basic_error) => from_basic_error(basic_error), DPPConsensusError::DefaultError => JsError::new("DefaultError").into(), + #[cfg(test)] + #[allow(unreachable_patterns)] + e => JsError::new(&format!("unsupported error: {:?}", e)).into(), } } pub fn from_state_error(state_error: &StateError) -> JsValue { - match state_error.deref() { + match state_error { StateError::DuplicatedIdentityPublicKeyIdStateError(e) => { DuplicatedIdentityPublicKeyIdStateErrorWasm::from(e).into() } @@ -167,9 +199,6 @@ pub fn from_state_error(state_error: &StateError) -> JsValue { StateError::InvalidIdentityRevisionError(e) => { InvalidIdentityRevisionErrorWasm::from(e).into() } - StateError::IdentityPublicKeyDisabledAtWindowViolationError(e) => { - IdentityPublicKeyDisabledAtWindowViolationErrorWasm::from(e).into() - } StateError::IdentityPublicKeyIsReadOnlyError(e) => { IdentityPublicKeyIsReadOnlyErrorWasm::from(e).into() } @@ -185,20 +214,11 @@ pub fn from_state_error(state_error: &StateError) -> JsValue { StateError::MissingIdentityPublicKeyIdsError(e) => { MissingIdentityPublicKeyIdsErrorWasm::from(e).into() } - // TODO(versioning): restore - // StateError::DataTriggerError(data_trigger_error) => match data_trigger_error.deref() { - // DataTriggerError::DataTriggerConditionError(e) => { - // DataTriggerConditionErrorWasm::from(e).into() - // } - // DataTriggerError::DataTriggerExecutionError(e) => { - // DataTriggerExecutionErrorWasm::from(e).into() - // } - // DataTriggerError::DataTriggerInvalidResultError(e) => { - // DataTriggerInvalidResultErrorWasm::from(e).into() - // } - // }, - // TODO(versioning): restore - // StateError::DataTriggerActionError(_) => JsError::new("Data Trigger action error").into(), + StateError::DataTriggerError(data_trigger_error) => match data_trigger_error { + DataTriggerConditionError(e) => DataTriggerConditionErrorWasm::from(e).into(), + DataTriggerExecutionError(e) => DataTriggerExecutionErrorWasm::from(e).into(), + DataTriggerInvalidResultError(e) => DataTriggerInvalidResultErrorWasm::from(e).into(), + }, StateError::IdentityAlreadyExistsError(e) => { let wasm_error: IdentityAlreadyExistsErrorWasm = e.into(); wasm_error.into() @@ -216,14 +236,68 @@ pub fn from_state_error(state_error: &StateError) -> JsValue { StateError::DataContractConfigUpdateError(e) => { DataContractConfigUpdateErrorWasm::from(e).into() } - // TODO(versioning): restore - _ => todo!(), + StateError::InvalidIdentityNonceError(e) => InvalidIdentityNonceErrorWasm::from(e).into(), + StateError::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError(e) => { + generic_consensus_error!( + IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError, + e + ) + .into() + } + StateError::DocumentTypeUpdateError(e) => { + generic_consensus_error!(DocumentTypeUpdateError, e).into() + } + StateError::DocumentNotForSaleError(e) => { + generic_consensus_error!(DocumentNotForSaleError, e).into() + } + StateError::DocumentIncorrectPurchasePriceError(e) => { + generic_consensus_error!(DocumentIncorrectPurchasePriceError, e).into() + } + StateError::PrefundedSpecializedBalanceInsufficientError(e) => { + generic_consensus_error!(PrefundedSpecializedBalanceInsufficientError, e).into() + } + StateError::PrefundedSpecializedBalanceNotFoundError(e) => { + generic_consensus_error!(PrefundedSpecializedBalanceNotFoundError, e).into() + } + StateError::DataContractUpdatePermissionError(e) => { + DataContractUpdatePermissionErrorWasm::from(e).into() + } + StateError::MasternodeNotFoundError(e) => { + generic_consensus_error!(MasternodeNotFoundError, e).into() + } + StateError::DocumentContestCurrentlyLockedError(e) => { + generic_consensus_error!(DocumentContestCurrentlyLockedError, e).into() + } + StateError::DocumentContestNotJoinableError(e) => { + generic_consensus_error!(DocumentContestNotJoinableError, e).into() + } + StateError::DocumentContestIdentityAlreadyContestantError(e) => { + generic_consensus_error!(DocumentContestIdentityAlreadyContestantError, e).into() + } + StateError::VotePollNotFoundError(e) => { + generic_consensus_error!(VotePollNotFoundError, e).into() + } + StateError::VotePollNotAvailableForVotingError(e) => { + generic_consensus_error!(VotePollNotAvailableForVotingError, e).into() + } + StateError::MasternodeVotedTooManyTimesError(e) => { + generic_consensus_error!(MasternodeVotedTooManyTimesError, e).into() + } + StateError::MasternodeVoteAlreadyPresentError(e) => { + generic_consensus_error!(MasternodeVoteAlreadyPresentError, e).into() + } + StateError::MasternodeIncorrectVotingAddressError(e) => { + generic_consensus_error!(MasternodeIncorrectVotingAddressError, e).into() + } + StateError::MasternodeIncorrectVoterIdentityIdError(e) => { + generic_consensus_error!(MasternodeIncorrectVoterIdentityIdError, e).into() + } } } // TODO: Move as From/TryInto trait implementation to wasm error modules fn from_basic_error(basic_error: &BasicError) -> JsValue { - match basic_error.deref() { + match basic_error { BasicError::ValueError(value_error) => ValueErrorWasm::from(value_error).into(), BasicError::DataContractNotPresentError(err) => { DataContractNotPresentErrorWasm::from(err).into() @@ -311,6 +385,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue { BasicError::IncompatibleDataContractSchemaError(err) => { IncompatibleDataContractSchemaErrorWasm::from(err).into() } + BasicError::IncompatibleDocumentTypeSchemaError(err) => { + IncompatibleDocumentTypeSchemaErrorWasm::from(err).into() + } BasicError::InvalidIdentityKeySignatureError(err) => { InvalidIdentityKeySignatureErrorWasm::from(err).into() } @@ -320,9 +397,17 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue { BasicError::IdentityCreditTransferToSelfError(err) => { IdentityCreditTransferToSelfErrorWasm::from(err).into() } + BasicError::NonceOutOfBoundsError(err) => { + IdentityContractNonceOutOfBoundsErrorWasm::from(err).into() + } + BasicError::InvalidDocumentTypeNameError(err) => { + InvalidDocumentTypeNameErrorWasm::from(err).into() + } ProtocolVersionParsingError(e) => ProtocolVersionParsingErrorWasm::from(e).into(), - SerializedObjectParsingError(e) => SerializedObjectParsingErrorWasm::from(e).into(), - JsonSchemaError(e) => JsonSchemaErrorWasm::from(e).into(), + BasicError::SerializedObjectParsingError(e) => { + SerializedObjectParsingErrorWasm::from(e).into() + } + BasicError::JsonSchemaError(e) => JsonSchemaErrorWasm::from(e).into(), UnsupportedProtocolVersionError(e) => UnsupportedProtocolVersionErrorWasm::from(e).into(), UnsupportedVersionError(e) => UnsupportedVersionErrorWasm::from(e).into(), IncompatibleProtocolVersionError(e) => IncompatibleProtocolVersionErrorWasm::from(e).into(), @@ -339,12 +424,18 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue { DuplicatedIdentityPublicKeyErrorWasm::from(e).into() } MissingMasterPublicKeyError(e) => MissingMasterPublicKeyErrorWasm::from(e).into(), - IdentityAssetLockTransactionOutPointAlreadyExistsError(e) => { + IdentityAssetLockTransactionOutPointAlreadyConsumedError(e) => { IdentityAssetLockTransactionOutPointAlreadyExistsErrorWasm::from(e).into() } + IdentityAssetLockTransactionOutPointNotEnoughBalanceError(e) => { + IdentityAssetLockTransactionOutPointNotEnoughBalanceErrorWasm::from(e).into() + } InvalidIdentityAssetLockTransactionOutputError(e) => { InvalidIdentityAssetLockTransactionOutputErrorWasm::from(e).into() } + IdentityAssetLockStateTransitionReplayError(e) => { + IdentityAssetLockStateTransitionReplayErrorWasm::from(e).into() + } InvalidAssetLockTransactionOutputReturnSizeError(e) => { InvalidAssetLockTransactionOutputReturnSizeErrorWasm::from(e).into() } @@ -375,6 +466,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue { InvalidAssetLockProofTransactionHeightError(e) => { InvalidAssetLockProofTransactionHeightErrorWasm::from(e).into() } + InvalidIdentityCreditTransferAmountError(e) => { + InvalidIdentityCreditTransferAmountErrorWasm::from(e).into() + } InvalidIdentityCreditWithdrawalTransitionCoreFeeError(e) => { InvalidIdentityCreditWithdrawalTransitionCoreFeeErrorWasm::from(e).into() } @@ -385,13 +479,77 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue { NotImplementedIdentityCreditWithdrawalTransitionPoolingErrorWasm::from(e).into() } IncompatibleRe2PatternError(err) => IncompatibleRe2PatternErrorWasm::from(err).into(), - // TODO(versioning): cover other errors - _ => todo!(), + BasicError::VersionError(err) => generic_consensus_error!(VersionError, err).into(), + BasicError::ContractError(e) => DataContractErrorWasm::from(e).into(), + BasicError::UnknownSecurityLevelError(e) => { + generic_consensus_error!(UnknownSecurityLevelError, e).into() + } + BasicError::UnknownStorageKeyRequirementsError(e) => { + generic_consensus_error!(UnknownStorageKeyRequirementsError, e).into() + } + BasicError::DataContractBoundsNotPresentError(e) => { + generic_consensus_error!(DataContractBoundsNotPresentError, e).into() + } + BasicError::MissingPositionsInDocumentTypePropertiesError(e) => { + generic_consensus_error!(MissingPositionsInDocumentTypePropertiesError, e).into() + } + BasicError::MaxDocumentsTransitionsExceededError(e) => { + generic_consensus_error!(MaxDocumentsTransitionsExceededError, e).into() + } + BasicError::DisablingKeyIdAlsoBeingAddedInSameTransitionError(e) => { + generic_consensus_error!(DisablingKeyIdAlsoBeingAddedInSameTransitionError, e).into() + } + BasicError::TooManyMasterPublicKeyError(e) => { + generic_consensus_error!(TooManyMasterPublicKeyError, e).into() + } + BasicError::MasterPublicKeyUpdateError(e) => { + generic_consensus_error!(MasterPublicKeyUpdateError, e).into() + } + BasicError::InvalidDocumentTypeRequiredSecurityLevelError(e) => { + generic_consensus_error!(InvalidDocumentTypeRequiredSecurityLevelError, e).into() + } + BasicError::InvalidIdentityCreditWithdrawalTransitionAmountError(e) => { + generic_consensus_error!(InvalidIdentityCreditWithdrawalTransitionAmountError, e).into() + } + BasicError::InvalidIdentityUpdateTransitionEmptyError(e) => { + generic_consensus_error!(InvalidIdentityUpdateTransitionEmptyError, e).into() + } + BasicError::InvalidIdentityUpdateTransitionDisableKeysError(e) => { + generic_consensus_error!(InvalidIdentityUpdateTransitionDisableKeysError, e).into() + } + BasicError::DocumentTransitionsAreAbsentError(e) => { + DocumentTransitionsAreAbsentErrorWasm::from(e).into() + } + BasicError::UnknownTransferableTypeError(e) => { + generic_consensus_error!(UnknownTransferableTypeError, e).into() + } + BasicError::UnknownTradeModeError(e) => { + generic_consensus_error!(UnknownTradeModeError, e).into() + } + BasicError::UnknownDocumentCreationRestrictionModeError(e) => { + generic_consensus_error!(UnknownDocumentCreationRestrictionModeError, e).into() + } + BasicError::DocumentCreationNotAllowedError(e) => { + generic_consensus_error!(DocumentCreationNotAllowedError, e).into() + } + BasicError::OverflowError(e) => generic_consensus_error!(OverflowError, e).into(), + BasicError::ContestedUniqueIndexOnMutableDocumentTypeError(e) => { + generic_consensus_error!(ContestedUniqueIndexOnMutableDocumentTypeError, e).into() + } + BasicError::UnsupportedFeatureError(e) => { + generic_consensus_error!(UnsupportedFeatureError, e).into() + } + BasicError::DocumentFieldMaxSizeExceededError(e) => { + generic_consensus_error!(DocumentFieldMaxSizeExceededError, e).into() + } + BasicError::ContestedUniqueIndexWithUniqueIndexError(e) => { + generic_consensus_error!(ContestedUniqueIndexWithUniqueIndexError, e).into() + } } } fn from_signature_error(signature_error: &SignatureError) -> JsValue { - match signature_error.deref() { + match signature_error { SignatureError::MissingPublicKeyError(err) => MissingPublicKeyErrorWasm::from(err).into(), SignatureError::InvalidIdentityPublicKeyTypeError(err) => { InvalidIdentityPublicKeyTypeErrorWasm::from(err).into() @@ -417,6 +575,9 @@ fn from_signature_error(signature_error: &SignatureError) -> JsValue { } SignatureError::BasicECDSAError(err) => BasicECDSAErrorWasm::from(err).into(), SignatureError::BasicBLSError(err) => BasicBLSErrorWasm::from(err).into(), + SignatureError::InvalidSignaturePublicKeyPurposeError(err) => { + InvalidSignaturePublicKeyPurposeErrorWasm::from(err).into() + } } } diff --git a/packages/wasm-dpp/src/errors/consensus/fee/balance_is_not_enough_error.rs b/packages/wasm-dpp/src/errors/consensus/fee/balance_is_not_enough_error.rs index 2cb9b1f5231..e5599fe3bde 100644 --- a/packages/wasm-dpp/src/errors/consensus/fee/balance_is_not_enough_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/fee/balance_is_not_enough_error.rs @@ -3,7 +3,7 @@ use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::fee::balance_is_not_enough_error::BalanceIsNotEnoughError; use dpp::consensus::ConsensusError; use dpp::fee::Credits; -use dpp::serialization::PlatformSerializable; + use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::version::PlatformVersion; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/errors/consensus/signature/basic_bls_error.rs b/packages/wasm-dpp/src/errors/consensus/signature/basic_bls_error.rs index dacd14fd54a..c004c978c70 100644 --- a/packages/wasm-dpp/src/errors/consensus/signature/basic_bls_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/signature/basic_bls_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::BasicBLSError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=BasicBLSError)] diff --git a/packages/wasm-dpp/src/errors/consensus/signature/basic_ecdsa_error.rs b/packages/wasm-dpp/src/errors/consensus/signature/basic_ecdsa_error.rs index ab98140205b..9d62bcfd317 100644 --- a/packages/wasm-dpp/src/errors/consensus/signature/basic_ecdsa_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/signature/basic_ecdsa_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::BasicECDSAError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=BasicECDSAError)] diff --git a/packages/wasm-dpp/src/errors/consensus/signature/identity_not_found_error.rs b/packages/wasm-dpp/src/errors/consensus/signature/identity_not_found_error.rs index acbffc75222..91e6d2780e1 100644 --- a/packages/wasm-dpp/src/errors/consensus/signature/identity_not_found_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/signature/identity_not_found_error.rs @@ -1,7 +1,7 @@ use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::IdentityNotFoundError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; use crate::buffer::Buffer; diff --git a/packages/wasm-dpp/src/errors/consensus/signature/signature_should_not_be_present_error.rs b/packages/wasm-dpp/src/errors/consensus/signature/signature_should_not_be_present_error.rs index 2e9706b11ae..b48919fcefd 100644 --- a/packages/wasm-dpp/src/errors/consensus/signature/signature_should_not_be_present_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/signature/signature_should_not_be_present_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::signature::SignatureShouldNotBePresentError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=SignatureShouldNotBePresentError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_already_present_error.rs b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_already_present_error.rs index e4d0c38e8db..72d9f5c2440 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_already_present_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_already_present_error.rs @@ -4,7 +4,7 @@ use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::data_contract::data_contract_already_present_error::DataContractAlreadyPresentError; use dpp::consensus::ConsensusError; -use dpp::serialization::{PlatformSerializable, PlatformSerializableWithPlatformVersion}; +use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::version::PlatformVersion; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataContractAlreadyPresentError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_is_readonly_error.rs b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_is_readonly_error.rs index d2fdfccdb2d..ddd18c3090e 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_is_readonly_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_is_readonly_error.rs @@ -1,10 +1,8 @@ -use crate::buffer::Buffer; use crate::identifier::IdentifierWrapper; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::data_contract::data_contract_is_readonly_error::DataContractIsReadonlyError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataContractIsReadonlyError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs new file mode 100644 index 00000000000..a979c9f176d --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs @@ -0,0 +1,50 @@ +use crate::identifier::IdentifierWrapper; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; + +use dpp::consensus::state::data_contract::data_contract_update_permission_error::DataContractUpdatePermissionError; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=DataContractUpdatePermissionError)] +pub struct DataContractUpdatePermissionErrorWasm { + inner: DataContractUpdatePermissionError, +} + +impl From<&DataContractUpdatePermissionError> for DataContractUpdatePermissionErrorWasm { + fn from(e: &DataContractUpdatePermissionError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=DataContractUpdatePermissionError)] +impl DataContractUpdatePermissionErrorWasm { + #[wasm_bindgen(constructor)] + pub fn new(data_contract_id: IdentifierWrapper, identity_id: IdentifierWrapper) -> Self { + Self { + inner: DataContractUpdatePermissionError::new( + data_contract_id.into(), + identity_id.into(), + ), + } + } + + #[wasm_bindgen(js_name=getDataContractId)] + pub fn data_contract_id(&self) -> IdentifierWrapper { + self.inner.data_contract_id().to_owned().into() + } + + #[wasm_bindgen(js_name=getIdentityId)] + pub fn identity_id(&self) -> IdentifierWrapper { + self.inner.identity_id().to_owned().into() + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_condition_error.rs b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_condition_error.rs index 626e126e798..d38e84fdb3f 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_condition_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_condition_error.rs @@ -4,7 +4,8 @@ use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError; use dpp::consensus::ConsensusError; use dpp::identifier::Identifier; -use dpp::serialization::PlatformSerializable; +use dpp::serialization::PlatformSerializableWithPlatformVersion; +use dpp::version::PlatformVersion; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataTriggerConditionError)] @@ -48,7 +49,7 @@ impl DataTriggerConditionErrorWasm { #[wasm_bindgen(js_name=serialize)] pub fn serialize(&self) -> Result { let bytes = ConsensusError::from(self.inner.clone()) - .serialize_to_bytes() + .serialize_to_bytes_with_platform_version(PlatformVersion::first()) .map_err(JsError::from)?; Ok(Buffer::from_bytes(bytes.as_slice())) diff --git a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_execution_error.rs b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_execution_error.rs index f3ff1b4b767..b4a928db3c7 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_execution_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_execution_error.rs @@ -3,7 +3,8 @@ use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::data_trigger::data_trigger_execution_error::DataTriggerExecutionError; use dpp::consensus::ConsensusError; use dpp::identifier::Identifier; -use dpp::serialization::PlatformSerializable; +use dpp::serialization::PlatformSerializableWithPlatformVersion; +use dpp::version::PlatformVersion; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataTriggerExecutionError)] @@ -47,7 +48,7 @@ impl DataTriggerExecutionErrorWasm { #[wasm_bindgen(js_name=serialize)] pub fn serialize(&self) -> Result { let bytes = ConsensusError::from(self.inner.clone()) - .serialize_to_bytes() + .serialize_to_bytes_with_platform_version(PlatformVersion::first()) .map_err(JsError::from)?; Ok(Buffer::from_bytes(bytes.as_slice())) diff --git a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_invalid_result_error.rs b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_invalid_result_error.rs index 909c57b637a..ea7dc0d5e71 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_invalid_result_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/data_contract/data_trigger/data_trigger_invalid_result_error.rs @@ -4,7 +4,8 @@ use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::data_trigger::data_trigger_invalid_result_error::DataTriggerInvalidResultError; use dpp::consensus::ConsensusError; use dpp::identifier::Identifier; -use dpp::serialization::PlatformSerializable; +use dpp::serialization::PlatformSerializableWithPlatformVersion; +use dpp::version::PlatformVersion; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DataTriggerInvalidResultError)] @@ -43,7 +44,7 @@ impl DataTriggerInvalidResultErrorWasm { #[wasm_bindgen(js_name=serialize)] pub fn serialize(&self) -> Result { let bytes = ConsensusError::from(self.inner.clone()) - .serialize_to_bytes() + .serialize_to_bytes_with_platform_version(PlatformVersion::first()) .map_err(JsError::from)?; Ok(Buffer::from_bytes(bytes.as_slice())) diff --git a/packages/wasm-dpp/src/errors/consensus/state/data_contract/mod.rs b/packages/wasm-dpp/src/errors/consensus/state/data_contract/mod.rs index 78ef7460acb..3635ee2a946 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/data_contract/mod.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/data_contract/mod.rs @@ -2,9 +2,10 @@ mod data_contract_already_present_error; mod data_contract_config_update_error; mod data_contract_is_readonly_error; -// TODO(versioning): remove -// pub mod data_trigger; +mod data_contract_update_permission_error; +pub mod data_trigger; pub use data_contract_already_present_error::*; pub use data_contract_config_update_error::*; pub use data_contract_is_readonly_error::*; +pub use data_contract_update_permission_error::*; diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/document_already_present_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/document_already_present_error.rs index 0864112eb74..c95e3805045 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/document_already_present_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/document_already_present_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::document_already_present_error::DocumentAlreadyPresentError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DocumentAlreadyPresentError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/document_not_found_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/document_not_found_error.rs index bf157cc9a0b..a46f7e7e8fe 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/document_not_found_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/document_not_found_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::document_not_found_error::DocumentNotFoundError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DocumentNotFoundError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/document_owner_id_mismatch_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/document_owner_id_mismatch_error.rs index 9f209c30888..a02e7b45a50 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/document_owner_id_mismatch_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/document_owner_id_mismatch_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::document_owner_id_mismatch_error::DocumentOwnerIdMismatchError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DocumentOwnerIdMismatchError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamp_window_violation_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamp_window_violation_error.rs index 774a2cee745..7da7e2f260f 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamp_window_violation_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamp_window_violation_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::document_timestamp_window_violation_error::DocumentTimestampWindowViolationError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DocumentTimestampWindowViolationError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_are_equal_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_are_equal_error.rs index 153ec1a1ed5..543e5dfeafc 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_are_equal_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_are_equal_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::document_timestamps_are_equal_error::DocumentTimestampsAreEqualError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DocumentTimestampsAreEqualError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_mismatch_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_mismatch_error.rs index 0784c3f6b3d..fb4c26994b5 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_mismatch_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/document_timestamps_mismatch_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::document_timestamps_mismatch_error::DocumentTimestampsMismatchError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DocumentTimestampsMismatchError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/duplicate_unique_index_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/duplicate_unique_index_error.rs index 0b3de84e1b5..5583ef0d254 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/duplicate_unique_index_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/duplicate_unique_index_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::duplicate_unique_index_error::DuplicateUniqueIndexError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use js_sys::JsString; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/errors/consensus/state/document/invalid_document_revision_error.rs b/packages/wasm-dpp/src/errors/consensus/state/document/invalid_document_revision_error.rs index bb511b52963..6636ed0d142 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/document/invalid_document_revision_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/document/invalid_document_revision_error.rs @@ -3,7 +3,7 @@ use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::document::invalid_document_revision_error::InvalidDocumentRevisionError; use dpp::consensus::ConsensusError; use dpp::prelude::Revision; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidDocumentRevisionError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_id_state_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_id_state_error.rs index cadc9ad13b3..74cdbe96de0 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_id_state_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_id_state_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::duplicated_identity_public_key_id_state_error::DuplicatedIdentityPublicKeyIdStateError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DuplicatedIdentityPublicKeyIdStateError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_state_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_state_error.rs index fcc463a53e9..69ae1ade999 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_state_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/duplicated_identity_public_key_state_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::duplicated_identity_public_key_state_error::DuplicatedIdentityPublicKeyStateError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=DuplicatedIdentityPublicKeyStateError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_already_exists_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/identity_already_exists_error.rs index 91746d23c41..9396e42fa02 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_already_exists_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/identity_already_exists_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::IdentityAlreadyExistsError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IdentityAlreadyExistsError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs deleted file mode 100644 index b33a1554527..00000000000 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs +++ /dev/null @@ -1,50 +0,0 @@ -use crate::buffer::Buffer; -use dpp::consensus::codes::ErrorWithCode; -use dpp::consensus::state::identity::identity_public_key_disabled_at_window_violation_error::IdentityPublicKeyDisabledAtWindowViolationError; -use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; -use wasm_bindgen::prelude::*; - -#[wasm_bindgen(js_name=IdentityPublicKeyDisabledAtWindowViolationError)] -pub struct IdentityPublicKeyDisabledAtWindowViolationErrorWasm { - inner: IdentityPublicKeyDisabledAtWindowViolationError, -} - -impl From<&IdentityPublicKeyDisabledAtWindowViolationError> - for IdentityPublicKeyDisabledAtWindowViolationErrorWasm -{ - fn from(e: &IdentityPublicKeyDisabledAtWindowViolationError) -> Self { - Self { inner: e.clone() } - } -} - -#[wasm_bindgen(js_class=IdentityPublicKeyDisabledAtWindowViolationError)] -impl IdentityPublicKeyDisabledAtWindowViolationErrorWasm { - #[wasm_bindgen(js_name=getDisabledAt)] - pub fn disabled_at(&self) -> js_sys::Date { - // TODO: Figure out how to match rust timestamps with JS timestamps - js_sys::Date::new(&JsValue::from_f64(self.inner.disabled_at() as f64)) - } - - #[wasm_bindgen(js_name=getTimeWindowStart)] - pub fn time_window_start(&self) -> js_sys::Date { - // TODO: Figure out how to match rust timestamps with JS timestamps - js_sys::Date::new(&JsValue::from_f64(self.inner.time_window_start() as f64)) - } - - #[wasm_bindgen(js_name=getTimeWindowEnd)] - pub fn time_window_end(&self) -> js_sys::Date { - // TODO: Figure out how to match rust timestamps with JS timestamps - js_sys::Date::new(&JsValue::from_f64(self.inner.time_window_end() as f64)) - } - - #[wasm_bindgen(js_name=getCode)] - pub fn get_code(&self) -> u32 { - ConsensusError::from(self.inner.clone()).code() - } - - #[wasm_bindgen(getter)] - pub fn message(&self) -> String { - self.inner.to_string() - } -} diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_disabled_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_disabled_error.rs index 8b7f64eb422..e8a4588aed3 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_disabled_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_disabled_error.rs @@ -1,9 +1,8 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::identity_public_key_is_disabled_error::IdentityPublicKeyIsDisabledError; use dpp::consensus::ConsensusError; use dpp::identity::KeyID; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IdentityPublicKeyIsDisabledError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_read_only_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_read_only_error.rs index 1296df94719..a842cc29e9b 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_read_only_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/identity_public_key_is_read_only_error.rs @@ -1,9 +1,8 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::identity_public_key_is_read_only_error::IdentityPublicKeyIsReadOnlyError; use dpp::consensus::ConsensusError; use dpp::identity::KeyID; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=IdentityPublicKeyIsReadOnlyError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs new file mode 100644 index 00000000000..ef4f2e9266f --- /dev/null +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs @@ -0,0 +1,68 @@ +use crate::buffer::Buffer; + +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::state::identity::invalid_identity_contract_nonce_error::InvalidIdentityNonceError; +use dpp::consensus::ConsensusError; +use dpp::identity::identity_nonce::MergeIdentityNonceResult; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(js_name=InvalidIdentityNonceError)] +pub struct InvalidIdentityNonceErrorWasm { + inner: InvalidIdentityNonceError, +} + +impl From<&InvalidIdentityNonceError> for InvalidIdentityNonceErrorWasm { + fn from(e: &InvalidIdentityNonceError) -> Self { + Self { inner: e.clone() } + } +} + +#[wasm_bindgen(js_class=InvalidIdentityNonceError)] +impl InvalidIdentityNonceErrorWasm { + #[wasm_bindgen(js_name=getIdentityId)] + pub fn identity_id(&self) -> Buffer { + Buffer::from_bytes(self.inner.identity_id().as_bytes()) + } + + #[wasm_bindgen(js_name=getCurrentIdentityContractNonce)] + pub fn current_identity_contract_nonce(&self) -> Option { + self.inner.current_identity_contract_nonce().copied() + } + + #[wasm_bindgen(js_name=getSettingIdentityContractNonce)] + pub fn setting_identity_contract_nonce(&self) -> u64 { + *self.inner.setting_identity_contract_nonce() as u64 + } + + #[wasm_bindgen(js_name=getError)] + pub fn error(&self) -> js_sys::Error { + match self.inner.error() { + MergeIdentityNonceResult::NonceTooFarInFuture => { + js_sys::Error::new("nonce too far in future") + } + MergeIdentityNonceResult::NonceTooFarInPast => { + js_sys::Error::new("nonce too far in past") + } + MergeIdentityNonceResult::NonceAlreadyPresentAtTip => { + js_sys::Error::new("nonce already present at tip") + } + MergeIdentityNonceResult::NonceAlreadyPresentInPast(nonce) => { + js_sys::Error::new(&format!("nonce already present in past: {}", nonce)) + } + MergeIdentityNonceResult::MergeIdentityNonceSuccess(_) => { + js_sys::Error::new("no error") + } + MergeIdentityNonceResult::InvalidNonce => js_sys::Error::new("invalid nonce"), + } + } + + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } +} diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_public_key_id_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_public_key_id_error.rs index 92aa350ca19..da7eb35ac8f 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_public_key_id_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_public_key_id_error.rs @@ -1,10 +1,8 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::invalid_identity_public_key_id_error::InvalidIdentityPublicKeyIdError; use dpp::consensus::ConsensusError; use dpp::identity::KeyID; -use dpp::serialization::{PlatformSerializable, PlatformSerializableWithPlatformVersion}; -use dpp::version::PlatformVersion; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=InvalidIdentityPublicKeyIdError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_revision_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_revision_error.rs index c8a587056cc..8db6b8973d0 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_revision_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/invalid_identity_revision_error.rs @@ -2,7 +2,7 @@ use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::invalid_identity_revision_error::InvalidIdentityRevisionError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use js_sys::Number; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/max_identity_public_key_limit_reached_error.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/max_identity_public_key_limit_reached_error.rs index f8fdd04d190..7c22271951e 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/max_identity_public_key_limit_reached_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/max_identity_public_key_limit_reached_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=MaxIdentityPublicKeyLimitReachedError)] diff --git a/packages/wasm-dpp/src/errors/consensus/state/identity/mod.rs b/packages/wasm-dpp/src/errors/consensus/state/identity/mod.rs index 73172810de3..9ac274fbdfd 100644 --- a/packages/wasm-dpp/src/errors/consensus/state/identity/mod.rs +++ b/packages/wasm-dpp/src/errors/consensus/state/identity/mod.rs @@ -1,9 +1,9 @@ mod duplicated_identity_public_key_id_state_error; mod duplicated_identity_public_key_state_error; mod identity_already_exists_error; -mod identity_public_key_disabled_at_window_violation_error; mod identity_public_key_is_disabled_error; mod identity_public_key_is_read_only_error; +mod invalid_identity_contract_nonce_error; mod invalid_identity_public_key_id_error; mod invalid_identity_revision_error; mod max_identity_public_key_limit_reached_error; @@ -12,9 +12,9 @@ mod missing_identity_public_key_ids_error; pub use duplicated_identity_public_key_id_state_error::*; pub use duplicated_identity_public_key_state_error::*; pub use identity_already_exists_error::*; -pub use identity_public_key_disabled_at_window_violation_error::*; pub use identity_public_key_is_disabled_error::*; pub use identity_public_key_is_read_only_error::*; +pub use invalid_identity_contract_nonce_error::*; pub use invalid_identity_public_key_id_error::*; pub use invalid_identity_revision_error::*; pub use max_identity_public_key_limit_reached_error::*; diff --git a/packages/wasm-dpp/src/errors/consensus/value_error.rs b/packages/wasm-dpp/src/errors/consensus/value_error.rs index d3cfb69f295..3b0dec5c0d4 100644 --- a/packages/wasm-dpp/src/errors/consensus/value_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/value_error.rs @@ -1,8 +1,7 @@ -use crate::buffer::Buffer; use dpp::consensus::basic::value_error::ValueError; use dpp::consensus::codes::ErrorWithCode; use dpp::consensus::ConsensusError; -use dpp::serialization::PlatformSerializable; + use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=ValueError, inspectable)] diff --git a/packages/wasm-dpp/src/errors/from.rs b/packages/wasm-dpp/src/errors/from.rs index b53dfeccbe8..6806d6e2ddb 100644 --- a/packages/wasm-dpp/src/errors/from.rs +++ b/packages/wasm-dpp/src/errors/from.rs @@ -38,7 +38,6 @@ pub fn from_dpp_err(pe: ProtocolError) -> JsValue { pub fn from_dpp_init_error(e: DashPlatformProtocolInitError) -> JsValue { match e { DashPlatformProtocolInitError::SchemaDeserializationError(e) => e.to_string().into(), - DashPlatformProtocolInitError::ValidationError(e) => e.to_string().into(), DashPlatformProtocolInitError::InvalidSchemaError(e) => e.to_string().into(), // TODO(versioning): add rest erros _ => JsValue::from_str(&format!("Error conversion not implemented: {e:#}",)), diff --git a/packages/wasm-dpp/src/errors/generic_consensus_error.rs b/packages/wasm-dpp/src/errors/generic_consensus_error.rs new file mode 100644 index 00000000000..57e8f43bb2b --- /dev/null +++ b/packages/wasm-dpp/src/errors/generic_consensus_error.rs @@ -0,0 +1,54 @@ +#[macro_export] +macro_rules! generic_consensus_error { + ($error_type:ident, $error_instance:expr) => {{ + use { + dpp::{ + consensus::{codes::ErrorWithCode, ConsensusError}, + serialization::PlatformSerializableWithPlatformVersion, + version::PlatformVersion, + }, + paste::paste, + wasm_bindgen::prelude::wasm_bindgen, + $crate::buffer::Buffer, + }; + + paste! { + #[derive(Debug)] + #[wasm_bindgen(js_name=$error_type)] + pub struct [<$error_type Wasm>] { + inner: $error_type + } + + impl From<&$error_type> for [<$error_type Wasm>] { + fn from(e: &$error_type) -> Self { + Self { + inner: e.clone() + } + } + } + + #[wasm_bindgen(js_class=$error_type)] + impl [<$error_type Wasm>] { + #[wasm_bindgen(js_name=getCode)] + pub fn get_code(&self) -> u32 { + ConsensusError::from(self.inner.clone()).code() + } + + #[wasm_bindgen(getter)] + pub fn message(&self) -> String { + self.inner.to_string() + } + + pub fn serialize(&self) -> Result { + let bytes = ConsensusError::from(self.inner.clone()) + .serialize_to_bytes_with_platform_version(PlatformVersion::first()) + .map_err(JsError::from)?; + + Ok(Buffer::from_bytes(bytes.as_slice())) + } + } + + [<$error_type Wasm>]::from($error_instance) + } + }}; +} diff --git a/packages/wasm-dpp/src/errors/mod.rs b/packages/wasm-dpp/src/errors/mod.rs index af1360fcf2a..23f13a24c2e 100644 --- a/packages/wasm-dpp/src/errors/mod.rs +++ b/packages/wasm-dpp/src/errors/mod.rs @@ -13,5 +13,6 @@ pub mod protocol_error; // mod compatible_protocol_version_is_not_defined_error; pub mod data_contract_not_present_error; // pub mod dpp_error; +mod generic_consensus_error; pub mod value_error; // pub use compatible_protocol_version_is_not_defined_error::*; diff --git a/packages/wasm-dpp/src/errors/protocol_error.rs b/packages/wasm-dpp/src/errors/protocol_error.rs index ec88edc6863..a91e8820a55 100644 --- a/packages/wasm-dpp/src/errors/protocol_error.rs +++ b/packages/wasm-dpp/src/errors/protocol_error.rs @@ -1,4 +1,3 @@ -use crate::data_contract::errors::InvalidDataContractError; use wasm_bindgen::JsValue; use crate::errors::consensus::consensus_error::from_consensus_error; @@ -8,13 +7,6 @@ pub fn from_protocol_error(protocol_error: dpp::ProtocolError) -> JsValue { dpp::ProtocolError::ConsensusError(consensus_error) => { from_consensus_error(*consensus_error) } - dpp::ProtocolError::InvalidDataContractError(err) => { - let raw_data_contract = err.raw_data_contract(); - let protocol = serde_wasm_bindgen::to_value(&raw_data_contract); - protocol.map_or_else(JsValue::from, |raw_contract| { - InvalidDataContractError::new(err.errors, raw_contract).into() - }) - } dpp::ProtocolError::Error(anyhow_error) => { format!("Non-protocol error: {}", anyhow_error).into() } diff --git a/packages/wasm-dpp/src/identifier/mod.rs b/packages/wasm-dpp/src/identifier/mod.rs index a4da431e029..ea6c5b95a66 100644 --- a/packages/wasm-dpp/src/identifier/mod.rs +++ b/packages/wasm-dpp/src/identifier/mod.rs @@ -1,6 +1,5 @@ use dpp::prelude::Identifier; use itertools::Itertools; -pub use serde::{Deserialize, Serialize}; use serde_json::Value; use wasm_bindgen::prelude::*; diff --git a/packages/wasm-dpp/src/identity/errors/mod.rs b/packages/wasm-dpp/src/identity/errors/mod.rs index 857500f06d4..32ce0974de9 100644 --- a/packages/wasm-dpp/src/identity/errors/mod.rs +++ b/packages/wasm-dpp/src/identity/errors/mod.rs @@ -1,5 +1,3 @@ -pub use asset_lock_output_not_found_error::*; -pub use asset_lock_transaction_is_not_found_error::*; pub use invalid_identity_error::*; pub use unknown_asset_lock_proof_type_error::*; diff --git a/packages/wasm-dpp/src/identity/factory_utils.rs b/packages/wasm-dpp/src/identity/factory_utils.rs index e0f1e902930..18e19428423 100644 --- a/packages/wasm-dpp/src/identity/factory_utils.rs +++ b/packages/wasm-dpp/src/identity/factory_utils.rs @@ -1,10 +1,10 @@ use crate::errors::RustConversionError; -use crate::identity::state_transition::create_asset_lock_proof_from_wasm_instance; + use crate::identity::state_transition::identity_public_key_transitions::IdentityPublicKeyWithWitnessWasm; use crate::identity::IdentityPublicKeyWasm; use crate::utils::{generic_of_js_val, to_vec_of_platform_values}; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::identity::state_transition::asset_lock_proof::AssetLockProof; + use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::serialization::ValueConvertible; use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; diff --git a/packages/wasm-dpp/src/identity/identity.rs b/packages/wasm-dpp/src/identity/identity.rs index ba9372c7f00..d6c22dacec3 100644 --- a/packages/wasm-dpp/src/identity/identity.rs +++ b/packages/wasm-dpp/src/identity/identity.rs @@ -3,19 +3,19 @@ use crate::errors::from_dpp_err; use crate::identifier::IdentifierWrapper; use crate::identity::IdentityPublicKeyWasm; use crate::metadata::MetadataWasm; -use crate::utils::{IntoWasm, WithJsError}; -use crate::{utils, with_js_error}; +use crate::utils::{Inner, IntoWasm, WithJsError}; +use crate::with_js_error; use dpp::identity::accessors::{IdentityGettersV0, IdentitySettersV0}; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::{Identity, IdentityPublicKey, KeyID}; use dpp::metadata::Metadata; -use dpp::platform_value::{ReplacementType, Value}; +use dpp::platform_value::ReplacementType; use dpp::serialization::PlatformDeserializable; use dpp::serialization::PlatformSerializable; use dpp::serialization::ValueConvertible; use dpp::version::PlatformVersion; use serde::Serialize; -use serde_json::Value as JsonValue; + use wasm_bindgen::prelude::*; use wasm_bindgen::JsValue; @@ -47,7 +47,7 @@ impl IdentityWasm { let platform_version = &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; - Identity::default_versioned(&platform_version) + Identity::default_versioned(platform_version) .map(Into::into) .map_err(from_dpp_err) } @@ -70,7 +70,6 @@ impl IdentityWasm { let public_keys = public_keys .iter() - .into_iter() .map(|key| { key.to_wasm::("IdentityPublicKey") .map(|key| { @@ -249,7 +248,6 @@ impl IdentityWasm { let public_keys: Vec = public_keys .iter() - .into_iter() .map(|key| { key.to_wasm::("IdentityPublicKey") .map(|key| key.to_owned().into()) @@ -273,3 +271,19 @@ impl IdentityWasm { Ok(identity.into()) } } + +impl Inner for IdentityWasm { + type InnerItem = Identity; + + fn into_inner(self) -> Self::InnerItem { + self.inner + } + + fn inner(&self) -> &Self::InnerItem { + &self.inner + } + + fn inner_mut(&mut self) -> &mut Self::InnerItem { + &mut self.inner + } +} diff --git a/packages/wasm-dpp/src/identity/identity_facade.rs b/packages/wasm-dpp/src/identity/identity_facade.rs index 5ecf1070215..d14892d4f9f 100644 --- a/packages/wasm-dpp/src/identity/identity_facade.rs +++ b/packages/wasm-dpp/src/identity/identity_facade.rs @@ -12,14 +12,20 @@ use crate::identity::errors::InvalidIdentityError; use crate::identity::state_transition::{ create_asset_lock_proof_from_wasm_instance, ChainAssetLockProofWasm, IdentityCreateTransitionWasm, IdentityCreditTransferTransitionWasm, - IdentityTopUpTransitionWasm, IdentityUpdateTransitionWasm, InstantAssetLockProofWasm, + IdentityCreditWithdrawalTransitionWasm, IdentityTopUpTransitionWasm, + IdentityUpdateTransitionWasm, InstantAssetLockProofWasm, }; +use crate::utils::Inner; + use crate::utils::WithJsError; use crate::with_js_error; use dpp::dashcore::{consensus, InstantLock, Transaction}; use crate::identity::IdentityWasm; +use dpp::identity::core_script::CoreScript; +use dpp::prelude::IdentityNonce; +use dpp::withdrawal::Pooling; use dpp::NonConsensusError; use serde::Deserialize; @@ -172,7 +178,7 @@ impl IdentityFacadeWasm { self.0 .create_identity_create_transition( - Identity::from(identity.to_owned()), + &Identity::from(identity.to_owned()), asset_lock_proof, ) .map(Into::into) @@ -193,18 +199,50 @@ impl IdentityFacadeWasm { .with_js_error() } + #[wasm_bindgen(js_name=createIdentityCreditWithdrawalTransition)] + pub fn create_identity_credit_withdrawal_transition( + &self, + identity_id: &IdentifierWrapper, + amount: u64, + core_fee_per_byte: u32, + pooling: u8, + output_script: Vec, + identity_nonce: u64, + ) -> Result { + let pooling = match pooling { + 0 => Pooling::Never, + 1 => Pooling::IfAvailable, + 2 => Pooling::Standard, + _ => return Err(JsError::new("Invalid pooling value").into()), + }; + + self.0 + .create_identity_credit_withdrawal_transition( + identity_id.to_owned().into(), + amount, + core_fee_per_byte, + pooling, + CoreScript::from_bytes(output_script), + identity_nonce as IdentityNonce, + ) + .map(Into::into) + .with_js_error() + } + #[wasm_bindgen(js_name=createIdentityCreditTransferTransition)] pub fn create_identity_credit_transfer_transition( &self, - identity_id: &IdentifierWrapper, + identity: &IdentityWasm, recipient_id: &IdentifierWrapper, amount: u64, + identity_nonce: u64, ) -> Result { self.0 .create_identity_credit_transfer_transition( - identity_id.to_owned().into(), + identity.inner(), recipient_id.to_owned().into(), amount, + identity_nonce, ) .map(Into::into) .with_js_error() @@ -214,18 +252,18 @@ impl IdentityFacadeWasm { pub fn create_identity_update_transition( &self, identity: &IdentityWasm, + identity_nonce: u64, public_keys: &JsValue, ) -> Result { let (add_public_keys, disable_public_keys) = super::factory_utils::parse_create_identity_update_transition_keys(public_keys)?; - let now = js_sys::Date::now() as u64; self.0 .create_identity_update_transition( identity.to_owned().into(), + identity_nonce, add_public_keys, disable_public_keys, - Some(now), ) .map(Into::into) .with_js_error() diff --git a/packages/wasm-dpp/src/identity/identity_factory.rs b/packages/wasm-dpp/src/identity/identity_factory.rs index a284715f8a7..b4fcf35d551 100644 --- a/packages/wasm-dpp/src/identity/identity_factory.rs +++ b/packages/wasm-dpp/src/identity/identity_factory.rs @@ -4,9 +4,11 @@ use crate::identifier::IdentifierWrapper; use crate::identity::errors::InvalidIdentityError; use crate::identity::identity::IdentityWasm; -use crate::identity::state_transition::ChainAssetLockProofWasm; use crate::identity::state_transition::IdentityCreditTransferTransitionWasm; use crate::identity::state_transition::InstantAssetLockProofWasm; +use crate::identity::state_transition::{ + ChainAssetLockProofWasm, IdentityCreditWithdrawalTransitionWasm, +}; use crate::{ identity::state_transition::create_asset_lock_proof_from_wasm_instance, @@ -16,16 +18,18 @@ use crate::{ }; use dpp::dashcore::{consensus, InstantLock, Transaction}; -use dpp::prelude::Identity; +use dpp::prelude::{Identity, IdentityNonce}; use serde::Deserialize; use std::convert::TryInto; -use crate::utils::WithJsError; +use crate::utils::{Inner, WithJsError}; use dpp::identity::identity_factory::IdentityFactory; +use dpp::identity::core_script::CoreScript; +use dpp::withdrawal::Pooling; use wasm_bindgen::prelude::wasm_bindgen; -use wasm_bindgen::JsValue; +use wasm_bindgen::{JsError, JsValue}; #[wasm_bindgen(js_name=IdentityFactory)] pub struct IdentityFactoryWasm(IdentityFactory); @@ -155,11 +159,11 @@ impl IdentityFactoryWasm { identity: &IdentityWasm, asset_lock_proof: &JsValue, ) -> Result { - let asset_lock_proof = create_asset_lock_proof_from_wasm_instance(&asset_lock_proof)?; + let asset_lock_proof = create_asset_lock_proof_from_wasm_instance(asset_lock_proof)?; self.0 .create_identity_create_transition( - Identity::from(identity.to_owned()), + &Identity::from(identity.to_owned()), asset_lock_proof, ) .map(Into::into) @@ -183,15 +187,47 @@ impl IdentityFactoryWasm { #[wasm_bindgen(js_name=createIdentityCreditTransferTransition)] pub fn create_identity_credit_transfer_transition( &self, - identity_id: &IdentifierWrapper, + identity: &IdentityWasm, recipient_id: &IdentifierWrapper, amount: u64, + identity_nonce: u64, ) -> Result { self.0 .create_identity_credit_transfer_transition( - identity_id.to_owned().into(), + identity.inner(), recipient_id.to_owned().into(), amount, + identity_nonce, + ) + .map(Into::into) + .with_js_error() + } + + #[wasm_bindgen(js_name=createIdentityCreditWithdrawalTransition)] + pub fn create_identity_credit_withdrawal_transition( + &self, + identity_id: &IdentifierWrapper, + amount: u64, + core_fee_per_byte: u32, + pooling: u8, + output_script: Vec, + identity_nonce: u64, + ) -> Result { + let pooling = match pooling { + 0 => Pooling::Never, + 1 => Pooling::IfAvailable, + 2 => Pooling::Standard, + _ => return Err(JsError::new("Invalid pooling value").into()), + }; + + self.0 + .create_identity_credit_withdrawal_transition( + identity_id.to_owned().into(), + amount, + core_fee_per_byte, + pooling, + CoreScript::from_bytes(output_script), + identity_nonce as IdentityNonce, ) .map(Into::into) .with_js_error() @@ -201,19 +237,18 @@ impl IdentityFactoryWasm { pub fn create_identity_update_transition( &self, identity: &IdentityWasm, + identity_nonce: u64, public_keys: &JsValue, ) -> Result { let (add_public_keys, disable_public_keys) = super::factory_utils::parse_create_identity_update_transition_keys(public_keys)?; - let now = js_sys::Date::now() as u64; - self.0 .create_identity_update_transition( identity.to_owned().into(), + identity_nonce, add_public_keys, disable_public_keys, - Some(now), ) .map(Into::into) .with_js_error() diff --git a/packages/wasm-dpp/src/identity/identity_public_key/mod.rs b/packages/wasm-dpp/src/identity/identity_public_key/mod.rs index 39ce59be5e4..cf91b4e404c 100644 --- a/packages/wasm-dpp/src/identity/identity_public_key/mod.rs +++ b/packages/wasm-dpp/src/identity/identity_public_key/mod.rs @@ -1,19 +1,19 @@ -use js_sys::Reflect::delete_property; -pub use serde::{Deserialize, Serialize}; -use serde_json::Value as JsonValue; +pub use serde::Serialize; + use std::convert::TryInto; use wasm_bindgen::prelude::*; use crate::utils::WithJsError; -use crate::{buffer::Buffer, utils, with_js_error}; +use crate::{buffer::Buffer, with_js_error}; use dpp::identity::identity_public_key::accessors::v0::{ IdentityPublicKeyGettersV0, IdentityPublicKeySettersV0, }; use dpp::identity::identity_public_key::hash::IdentityPublicKeyHashMethodsV0; use dpp::identity::{IdentityPublicKey, KeyID, TimestampMillis}; -use dpp::platform_value::{BinaryData, ReplacementType, Value}; -use dpp::serialization::ValueConvertible; -use dpp::state_transition::public_key_in_creation::v0::BINARY_DATA_FIELDS; +use dpp::platform_value::{BinaryData, ReplacementType}; +use dpp::serialization::{PlatformDeserializable, PlatformSerializable, ValueConvertible}; +use dpp::ProtocolError; + use dpp::version::PlatformVersion; mod purpose; pub use purpose::*; @@ -37,7 +37,7 @@ impl IdentityPublicKeyWasm { let platform_version = &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; - IdentityPublicKey::default_versioned(&platform_version) + IdentityPublicKey::default_versioned(platform_version) .map(Into::into) .map_err(from_dpp_err) } @@ -98,7 +98,7 @@ impl IdentityPublicKeyWasm { self.0.set_security_level( security_level .try_into() - .map_err(|e: anyhow::Error| e.to_string())?, + .map_err(|e: ProtocolError| e.to_string())?, ); Ok(()) } @@ -133,7 +133,10 @@ impl IdentityPublicKeyWasm { #[wasm_bindgen(js_name=hash)] pub fn hash(&self) -> Result, JsValue> { - self.0.hash().map(|result| result.to_vec()).with_js_error() + self.0 + .public_key_hash() + .map(|result| result.to_vec()) + .with_js_error() } #[wasm_bindgen(js_name=isMaster)] @@ -183,6 +186,19 @@ impl IdentityPublicKeyWasm { Ok(js_object) } + + #[wasm_bindgen(js_name=toBuffer)] + pub fn to_buffer(&self) -> Result { + let bytes = PlatformSerializable::serialize_to_bytes(&self.0.clone()).with_js_error()?; + Ok(Buffer::from_bytes(&bytes)) + } + + #[wasm_bindgen(js_name=fromBuffer)] + pub fn from_buffer(buffer: Vec) -> Result { + let key: IdentityPublicKey = + PlatformDeserializable::deserialize_from_bytes(buffer.as_slice()).with_js_error()?; + Ok(key.into()) + } } // impl Inner for IdentityPublicKeyWasm { diff --git a/packages/wasm-dpp/src/identity/identity_public_key/purpose.rs b/packages/wasm-dpp/src/identity/identity_public_key/purpose.rs index 0623438ef2c..5e598ffa523 100644 --- a/packages/wasm-dpp/src/identity/identity_public_key/purpose.rs +++ b/packages/wasm-dpp/src/identity/identity_public_key/purpose.rs @@ -10,7 +10,7 @@ pub enum PurposeWasm { /// this key cannot be used for signing documents DECRYPTION = 2, /// this key cannot be used for signing documents - WITHDRAW = 3, + TRANSFER = 3, /// this key cannot be used for signing documents SYSTEM = 4, /// this key cannot be used for signing documents @@ -23,7 +23,7 @@ impl From for PurposeWasm { Purpose::AUTHENTICATION => PurposeWasm::AUTHENTICATION, Purpose::ENCRYPTION => PurposeWasm::ENCRYPTION, Purpose::DECRYPTION => PurposeWasm::DECRYPTION, - Purpose::WITHDRAW => PurposeWasm::WITHDRAW, + Purpose::TRANSFER => PurposeWasm::TRANSFER, Purpose::SYSTEM => PurposeWasm::SYSTEM, Purpose::VOTING => PurposeWasm::VOTING, } diff --git a/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs b/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs index 70ad57c21ce..4176b09af57 100644 --- a/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs +++ b/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs @@ -7,10 +7,7 @@ use wasm_bindgen::prelude::*; use crate::utils::WithJsError; use crate::{ - buffer::Buffer, - errors::{from_dpp_err, RustConversionError}, - identifier::IdentifierWrapper, - with_js_error, + buffer::Buffer, errors::RustConversionError, identifier::IdentifierWrapper, with_js_error, }; use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; use dpp::platform_value::string_encoding; @@ -137,11 +134,7 @@ impl ChainAssetLockProofWasm { } #[wasm_bindgen(js_name=createIdentifier)] - pub fn create_identifier(&self) -> Result { - let identifier = self - .0 - .create_identifier() - .map_err(|e| from_dpp_err(e.into()))?; - Ok(identifier.into()) + pub fn create_identifier(&self) -> IdentifierWrapper { + self.0.create_identifier().into() } } diff --git a/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs b/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs index 9c580235ad6..244bc89e2ff 100644 --- a/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs +++ b/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs @@ -10,12 +10,7 @@ use std::convert::TryInto; use wasm_bindgen::prelude::*; use crate::utils::WithJsError; -use crate::{ - buffer::Buffer, - errors::{from_dpp_err, RustConversionError}, - identifier::IdentifierWrapper, - with_js_error, -}; +use crate::{buffer::Buffer, errors::from_dpp_err, identifier::IdentifierWrapper, with_js_error}; use dpp::identity::state_transition::asset_lock_proof::instant::{ InstantAssetLockProof, RawInstantLockProof, }; @@ -102,10 +97,7 @@ impl InstantAssetLockProofWasm { #[wasm_bindgen(js_name=createIdentifier)] pub fn create_identifier(&self) -> Result { - let identifier = self - .0 - .create_identifier() - .map_err(|e| from_dpp_err(e.into()))?; + let identifier = self.0.create_identifier().map_err(from_dpp_err)?; Ok(identifier.into()) } diff --git a/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/mod.rs b/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/mod.rs index 81e0cb84ede..861188d0ca4 100644 --- a/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/mod.rs +++ b/packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/mod.rs @@ -7,8 +7,6 @@ use std::convert::TryInto; use wasm_bindgen::JsCast; use wasm_bindgen::__rt::Ref; -use crate::errors::RustConversionError; - use dpp::identity::errors::UnknownAssetLockProofTypeError; use wasm_bindgen::prelude::*; @@ -75,7 +73,9 @@ impl AssetLockProofWasm { InstantAssetLockProofWasm::from(instant.to_owned()).create_identifier() } AssetLockProof::Chain(chain) => { - ChainAssetLockProofWasm::from(chain.to_owned()).create_identifier() + let identifier = + ChainAssetLockProofWasm::from(chain.to_owned()).create_identifier(); + Ok(identifier) } } } diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_create_transition/identity_create_transition.rs b/packages/wasm-dpp/src/identity/state_transition/identity_create_transition/identity_create_transition.rs index e3428684788..86681592df3 100644 --- a/packages/wasm-dpp/src/identity/state_transition/identity_create_transition/identity_create_transition.rs +++ b/packages/wasm-dpp/src/identity/state_transition/identity_create_transition/identity_create_transition.rs @@ -1,5 +1,3 @@ -use dpp::platform_value::Value; -use serde_json::Value as JsonValue; use std::default::Default; use wasm_bindgen::__rt::Ref; @@ -23,14 +21,14 @@ use crate::{ ChainAssetLockProofWasm, InstantAssetLockProofWasm, }, identity::state_transition::identity_public_key_transitions::IdentityPublicKeyWithWitnessWasm, - utils, with_js_error, + with_js_error, }; use crate::bls_adapter::JsBlsAdapter; use crate::utils::{generic_of_js_val, WithJsError}; use dpp::platform_value::string_encoding; use dpp::platform_value::string_encoding::Encoding; -use dpp::serialization::{PlatformSerializable, ValueConvertible}; +use dpp::serialization::PlatformSerializable; use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; use dpp::state_transition::StateTransition; use dpp::{ @@ -63,7 +61,7 @@ impl IdentityCreateTransitionWasm { let platform_version = &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; - IdentityCreateTransition::default_versioned(&platform_version) + IdentityCreateTransition::default_versioned(platform_version) .map(Into::into) .map_err(from_dpp_err) } @@ -318,6 +316,11 @@ impl IdentityCreateTransitionWasm { self.0.is_identity_state_transition() } + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + #[wasm_bindgen(js_name=signByPrivateKey)] pub fn sign_by_private_key( &mut self, @@ -361,6 +364,6 @@ impl IdentityCreateTransitionWasm { #[wasm_bindgen(js_name=setSignature)] pub fn set_signature(&mut self, signature: Option>) { self.0 - .set_signature(BinaryData::new(signature.unwrap_or(vec![]))) + .set_signature(BinaryData::new(signature.unwrap_or_default())) } } diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs b/packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs index f68057fdde4..40fcf84fb96 100644 --- a/packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs +++ b/packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs @@ -1,6 +1,5 @@ use crate::utils::WithJsError; -use dpp::platform_value::{ReplacementType, Value}; -use serde_json::Value as JsonValue; + use std::convert::TryInto; use std::default::Default; @@ -11,14 +10,14 @@ use crate::bls_adapter::{BlsAdapter, JsBlsAdapter}; use crate::errors::from_dpp_err; use crate::identifier::IdentifierWrapper; use crate::identity::IdentityPublicKeyWasm; -use crate::{buffer::Buffer, utils, with_js_error}; +use crate::{buffer::Buffer, with_js_error}; use dpp::identifier::Identifier; use dpp::identity::KeyType; use dpp::platform_value::string_encoding::Encoding; use dpp::platform_value::{string_encoding, BinaryData}; -use dpp::serialization::{PlatformSerializable, ValueConvertible}; +use dpp::serialization::PlatformSerializable; use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0; -use dpp::state_transition::identity_credit_transfer_transition::fields::IDENTIFIER_FIELDS; + use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use dpp::state_transition::StateTransitionLike; use dpp::state_transition::{StateTransition, StateTransitionIdentitySigned}; @@ -45,7 +44,7 @@ impl IdentityCreditTransferTransitionWasm { let platform_version = &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; - IdentityCreditTransferTransition::default_versioned(&platform_version) + IdentityCreditTransferTransition::default_versioned(platform_version) .map(Into::into) .map_err(from_dpp_err) } @@ -267,6 +266,11 @@ impl IdentityCreditTransferTransitionWasm { self.0.is_identity_state_transition() } + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + #[wasm_bindgen(js_name=signByPrivateKey)] pub fn sign_by_private_key( &mut self, @@ -311,7 +315,7 @@ impl IdentityCreditTransferTransitionWasm { #[wasm_bindgen(js_name=setSignature)] pub fn set_signature(&mut self, signature: Option>) { self.0 - .set_signature(BinaryData::new(signature.unwrap_or(vec![]))) + .set_signature(BinaryData::new(signature.unwrap_or_default())) } #[wasm_bindgen] diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/mod.rs b/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/mod.rs new file mode 100644 index 00000000000..ea05af1cf5f --- /dev/null +++ b/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/mod.rs @@ -0,0 +1,3 @@ +pub use transition::*; +mod to_object; +pub mod transition; diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/to_object.rs b/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/to_object.rs new file mode 100644 index 00000000000..b0dc0002c83 --- /dev/null +++ b/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/to_object.rs @@ -0,0 +1,58 @@ +use dpp::identity::KeyID; + +use dpp::identity::core_script::CoreScript; +use dpp::prelude::IdentityNonce; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::state_transition::StateTransitionIdentitySigned; +use dpp::withdrawal::Pooling; +use dpp::{identifier::Identifier, state_transition::StateTransitionLike}; +use serde::Deserialize; +use std::default::Default; + +#[derive(Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct ToObjectOptions { + pub skip_signature: Option, +} + +#[derive(Default)] +pub struct ToObject { + pub transition_type: u8, + pub identity_id: Identifier, + pub amount: u64, + pub core_fee_per_byte: u32, + pub pooling: Pooling, + pub output_script: CoreScript, + pub nonce: IdentityNonce, + pub signature: Option>, + pub signature_public_key_id: Option, +} + +pub fn to_object_struct( + transition: &IdentityCreditWithdrawalTransition, + options: ToObjectOptions, +) -> ToObject { + let mut to_object = ToObject { + transition_type: transition.state_transition_type() as u8, + identity_id: transition.identity_id(), + amount: transition.amount(), + core_fee_per_byte: transition.core_fee_per_byte(), + pooling: transition.pooling(), + output_script: transition.output_script(), + nonce: transition.nonce(), + ..ToObject::default() + }; + + if !options.skip_signature.unwrap_or(false) { + let signature = Some(transition.signature().to_vec()); + if let Some(signature) = &signature { + if !signature.is_empty() { + to_object.signature_public_key_id = Some(transition.signature_public_key_id()) + } + } + to_object.signature = signature; + } + + to_object +} diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs b/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs new file mode 100644 index 00000000000..9d751495192 --- /dev/null +++ b/packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs @@ -0,0 +1,423 @@ +use crate::utils::WithJsError; +use std::convert::TryInto; +use std::default::Default; + +use dpp::version::PlatformVersion; +use wasm_bindgen::prelude::*; + +use crate::bls_adapter::{BlsAdapter, JsBlsAdapter}; +use crate::errors::from_dpp_err; +use crate::identifier::IdentifierWrapper; +use crate::identity::IdentityPublicKeyWasm; +use crate::{buffer::Buffer, with_js_error}; +use dpp::identifier::Identifier; +use dpp::identity::core_script::CoreScript; +use dpp::identity::KeyType; +use dpp::platform_value; +use dpp::platform_value::string_encoding::Encoding; +use dpp::platform_value::{string_encoding, BinaryData}; +use dpp::serialization::PlatformSerializable; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::state_transition::StateTransitionLike; +use dpp::state_transition::{StateTransition, StateTransitionIdentitySigned}; +use dpp::withdrawal::Pooling; + +#[wasm_bindgen(js_name=IdentityCreditWithdrawalTransition)] +#[derive(Clone)] +pub struct IdentityCreditWithdrawalTransitionWasm(IdentityCreditWithdrawalTransition); + +impl From for IdentityCreditWithdrawalTransitionWasm { + fn from(v: IdentityCreditWithdrawalTransition) -> Self { + IdentityCreditWithdrawalTransitionWasm(v) + } +} + +impl From for IdentityCreditWithdrawalTransition { + fn from(v: IdentityCreditWithdrawalTransitionWasm) -> Self { + v.0 + } +} + +#[wasm_bindgen(js_class = IdentityCreditWithdrawalTransition)] +impl IdentityCreditWithdrawalTransitionWasm { + #[wasm_bindgen(constructor)] + pub fn new(platform_version: u32) -> Result { + let platform_version = + &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; + + IdentityCreditWithdrawalTransition::default_versioned(platform_version) + .map(Into::into) + .map_err(from_dpp_err) + } + + #[wasm_bindgen(js_name=getType)] + pub fn get_type(&self) -> u8 { + self.0.state_transition_type() as u8 + } + + #[wasm_bindgen(getter, js_name=identityId)] + pub fn identity_id(&self) -> IdentifierWrapper { + self.get_identity_id() + } + + #[wasm_bindgen(getter, js_name=amount)] + pub fn amount(&self) -> u64 { + self.0.amount() + } + + #[wasm_bindgen(js_name=getIdentityId)] + pub fn get_identity_id(&self) -> IdentifierWrapper { + self.0.identity_id().into() + } + + #[wasm_bindgen(js_name=setIdentityId)] + pub fn set_identity_id(&mut self, identity_id: &IdentifierWrapper) { + self.0.set_identity_id(identity_id.into()); + } + + #[wasm_bindgen(js_name=getAmount)] + pub fn get_amount(&self) -> u64 { + self.0.amount() + } + + #[wasm_bindgen(js_name=setAmount)] + pub fn set_amount(&mut self, amount: u64) { + self.0.set_amount(amount); + } + + #[wasm_bindgen(js_name=getCoreFeePerByte)] + pub fn get_core_fee_per_byte(&self) -> u32 { + self.0.core_fee_per_byte() + } + + #[wasm_bindgen(js_name=setCoreFeePerByte)] + pub fn set_core_fee_per_byte(&mut self, core_fee_per_byte: u32) { + self.0.set_core_fee_per_byte(core_fee_per_byte); + } + + #[wasm_bindgen(js_name=getPooling)] + pub fn get_pooling(&self) -> u8 { + self.0.pooling() as u8 + } + + #[wasm_bindgen(js_name=setPooling)] + pub fn set_pooling(&mut self, pooling: u8) -> Result<(), JsError> { + match pooling { + 0 => self.0.set_pooling(Pooling::Never), + 1 => self.0.set_pooling(Pooling::IfAvailable), + 2 => self.0.set_pooling(Pooling::Standard), + _ => return Err(JsError::new("Invalid pooling value")), + } + + Ok(()) + } + + #[wasm_bindgen(js_name=getOutputScript)] + pub fn get_output_script(&self) -> Buffer { + Buffer::from_bytes(self.0.output_script().as_bytes()) + } + + #[wasm_bindgen(js_name=setOutputScript)] + pub fn set_output_script(&mut self, output_script: Vec) { + self.0 + .set_output_script(CoreScript::from_bytes(output_script)); + } + + #[wasm_bindgen(js_name=getNonce)] + pub fn get_nonce(&self) -> u64 { + self.0.nonce() + } + + #[wasm_bindgen(js_name=setNonce)] + pub fn set_nonce(&mut self, revision: u64) { + self.0.set_nonce(revision); + } + + #[wasm_bindgen(js_name=toObject)] + pub fn to_object(&self, options: JsValue) -> Result { + let opts: super::to_object::ToObjectOptions = if options.is_object() { + with_js_error!(serde_wasm_bindgen::from_value(options))? + } else { + Default::default() + }; + + let object = super::to_object::to_object_struct(&self.0, opts); + let js_object = js_sys::Object::new(); + + js_sys::Reflect::set( + &js_object, + &"type".to_owned().into(), + &object.transition_type.into(), + )?; + + let version = match self.0 { + IdentityCreditWithdrawalTransition::V0(_) => "0", + }; + + js_sys::Reflect::set(&js_object, &"$version".to_owned().into(), &version.into())?; + + if let Some(signature) = object.signature { + let signature_value: JsValue = if signature.is_empty() { + JsValue::undefined() + } else { + Buffer::from_bytes(signature.as_slice()).into() + }; + + js_sys::Reflect::set(&js_object, &"signature".to_owned().into(), &signature_value)?; + + if let Some(signature_public_key_id) = object.signature_public_key_id { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &JsValue::from(signature_public_key_id), + )?; + } else { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &JsValue::undefined(), + )?; + } + } + + js_sys::Reflect::set( + &js_object, + &"identityId".to_owned().into(), + &Buffer::from_bytes(object.identity_id.to_buffer().as_slice()), + )?; + + js_sys::Reflect::set( + &js_object, + &"amount".to_owned().into(), + &JsValue::from(object.amount), + )?; + + js_sys::Reflect::set( + &js_object, + &"coreFeePerByte".to_owned().into(), + &JsValue::from_f64(object.core_fee_per_byte as f64), + )?; + + js_sys::Reflect::set( + &js_object, + &"pooling".to_owned().into(), + &JsValue::from_f64((object.pooling as u8) as f64), + )?; + + let output_script = Buffer::from_bytes(object.output_script.as_bytes()); + js_sys::Reflect::set( + &js_object, + &"outputScript".to_owned().into(), + &output_script.into(), + )?; + + js_sys::Reflect::set( + &js_object, + &"nonce".to_owned().into(), + &JsValue::from(object.nonce), + )?; + + Ok(js_object.into()) + } + + #[wasm_bindgen(js_name=toBuffer)] + pub fn to_buffer(&self) -> Result { + let bytes = PlatformSerializable::serialize_to_bytes( + &StateTransition::IdentityCreditWithdrawal(self.0.clone()), + ) + .with_js_error()?; + Ok(Buffer::from_bytes(&bytes)) + } + + #[wasm_bindgen(js_name=toJSON)] + pub fn to_json(&self) -> Result { + let object = super::to_object::to_object_struct(&self.0, Default::default()); + let js_object = js_sys::Object::new(); + + js_sys::Reflect::set( + &js_object, + &"type".to_owned().into(), + &object.transition_type.into(), + )?; + + let version = match self.0 { + IdentityCreditWithdrawalTransition::V0(_) => "0", + }; + + js_sys::Reflect::set(&js_object, &"$version".to_owned().into(), &version.into())?; + + if let Some(signature) = object.signature { + let signature_value: JsValue = if signature.is_empty() { + JsValue::undefined() + } else { + string_encoding::encode(signature.as_slice(), Encoding::Base64).into() + }; + + js_sys::Reflect::set(&js_object, &"signature".to_owned().into(), &signature_value)?; + + if let Some(signature_public_key_id) = object.signature_public_key_id { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &signature_public_key_id.into(), + )?; + } else { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &JsValue::undefined(), + )?; + } + } + + let identity_id = object.identity_id.to_string(Encoding::Base58); + + js_sys::Reflect::set( + &js_object, + &"identityId".to_owned().into(), + &identity_id.into(), + )?; + + js_sys::Reflect::set( + &js_object, + &"amount".to_owned().into(), + &JsValue::from(&format!("{}", object.amount)), + )?; + + js_sys::Reflect::set( + &js_object, + &"coreFeePerByte".to_owned().into(), + &JsValue::from_f64(object.core_fee_per_byte as f64), + )?; + + js_sys::Reflect::set( + &js_object, + &"pooling".to_owned().into(), + &JsValue::from_f64((object.pooling as u8) as f64), + )?; + + let output_script = platform_value::string_encoding::encode( + object.output_script.as_bytes(), + Encoding::Base64, + ); + + js_sys::Reflect::set( + &js_object, + &"outputScript".to_owned().into(), + &output_script.into(), + )?; + + js_sys::Reflect::set( + &js_object, + &"nonce".to_owned().into(), + &JsValue::from(&format!("{}", object.nonce)), + )?; + + Ok(js_object.into()) + } + + #[wasm_bindgen(js_name=getModifiedDataIds)] + pub fn modified_data_ids(&self) -> Vec { + let ids = self.0.modified_data_ids(); + + ids.into_iter() + .map(|id| >::from(id).into()) + .collect() + } + + #[wasm_bindgen(js_name=isDataContractStateTransition)] + pub fn is_data_contract_state_transition(&self) -> bool { + self.0.is_data_contract_state_transition() + } + + #[wasm_bindgen(js_name=isDocumentStateTransition)] + pub fn is_document_state_transition(&self) -> bool { + self.0.is_document_state_transition() + } + + #[wasm_bindgen(js_name=isIdentityStateTransition)] + pub fn is_identity_state_transition(&self) -> bool { + self.0.is_identity_state_transition() + } + + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + + #[wasm_bindgen(js_name=signByPrivateKey)] + pub fn sign_by_private_key( + &mut self, + private_key: Vec, + key_type: u8, + bls: Option, + ) -> Result<(), JsValue> { + let key_type = key_type + .try_into() + .map_err(|e: anyhow::Error| e.to_string())?; + + if bls.is_none() && key_type == KeyType::BLS12_381 { + return Err(JsError::new( + format!("BLS adapter is required for BLS key type '{}'", key_type).as_str(), + ) + .into()); + } + + let bls_adapter = if let Some(adapter) = bls { + BlsAdapter(adapter) + } else { + BlsAdapter(JsValue::undefined().into()) + }; + + // TODO: not the best approach because it involves cloning the transition + // Probably it worth to return `sign_by_private_key` per state transition + let mut wrapper = StateTransition::IdentityCreditWithdrawal(self.0.clone()); + wrapper + .sign_by_private_key(private_key.as_slice(), key_type, &bls_adapter) + .with_js_error()?; + + self.0.set_signature(wrapper.signature().to_owned()); + + Ok(()) + } + + #[wasm_bindgen(js_name=getSignature)] + pub fn get_signature(&self) -> Buffer { + Buffer::from_bytes(self.0.signature().as_slice()) + } + + #[wasm_bindgen(js_name=setSignature)] + pub fn set_signature(&mut self, signature: Option>) { + self.0 + .set_signature(BinaryData::new(signature.unwrap_or_default())) + } + + #[wasm_bindgen] + pub fn sign( + &mut self, + identity_public_key: &IdentityPublicKeyWasm, + private_key: Vec, + bls: JsBlsAdapter, + ) -> Result<(), JsValue> { + let bls_adapter = BlsAdapter(bls); + + // TODO: come up with a better way to set signature to the binding. + let mut state_transition = StateTransition::IdentityCreditWithdrawal(self.0.clone()); + state_transition + .sign( + &identity_public_key.to_owned().into(), + &private_key, + &bls_adapter, + ) + .with_js_error()?; + + let signature = state_transition.signature().to_owned(); + let signature_public_key_id = state_transition.signature_public_key_id().unwrap_or(0); + + self.0.set_signature(signature); + self.0.set_signature_public_key_id(signature_public_key_id); + + Ok(()) + } +} diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_public_key_transitions.rs b/packages/wasm-dpp/src/identity/state_transition/identity_public_key_transitions.rs index d380d2a2574..e6eb7bd4818 100644 --- a/packages/wasm-dpp/src/identity/state_transition/identity_public_key_transitions.rs +++ b/packages/wasm-dpp/src/identity/state_transition/identity_public_key_transitions.rs @@ -1,24 +1,30 @@ //todo: move this file to transition -use dpp::platform_value::{BinaryData, ReplacementType, Value}; +use dpp::platform_value::{BinaryData, ReplacementType}; use dpp::serialization::ValueConvertible; use dpp::state_transition::public_key_in_creation::accessors::{ IdentityPublicKeyInCreationV0Getters, IdentityPublicKeyInCreationV0Setters, }; -use dpp::state_transition::public_key_in_creation::v0::BINARY_DATA_FIELDS; + use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use js_sys::Reflect::delete_property; pub use serde::{Deserialize, Serialize}; -use serde_json::Value as JsonValue; + +use dpp::identity::contract_bounds::ContractBounds; +use dpp::ProtocolError; use std::convert::TryInto; use wasm_bindgen::prelude::*; use crate::errors::from_dpp_err; +use crate::identifier::IdentifierWrapper; use crate::utils::WithJsError; -use crate::{buffer::Buffer, utils, with_js_error}; +use crate::{buffer::Buffer, with_js_error}; use dpp::version::PlatformVersion; + #[derive(Deserialize, Default)] #[serde(rename_all = "camelCase")] struct ToObjectOptions { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] pub skip_signature: Option, } @@ -33,7 +39,7 @@ impl IdentityPublicKeyWithWitnessWasm { let platform_version = &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; - IdentityPublicKeyInCreation::default_versioned(&platform_version) + IdentityPublicKeyInCreation::default_versioned(platform_version) .map(Into::into) .map_err(from_dpp_err) } @@ -94,11 +100,30 @@ impl IdentityPublicKeyWithWitnessWasm { self.0.set_security_level( security_level .try_into() - .map_err(|e: anyhow::Error| e.to_string())?, + .map_err(|e: ProtocolError| e.to_string())?, ); Ok(()) } + #[wasm_bindgen(js_name=setContractBounds)] + pub fn set_contract_bounds( + &mut self, + contract_id: IdentifierWrapper, + document_type_name: Option, + ) { + let contract_bounds = if document_type_name.is_some() { + ContractBounds::SingleContractDocumentType { + id: contract_id.into(), + document_type_name: document_type_name.unwrap(), + } + } else { + ContractBounds::SingleContract { + id: contract_id.into(), + } + }; + self.0.set_contract_bounds(Some(contract_bounds)) + } + #[wasm_bindgen(js_name=getSecurityLevel)] pub fn get_security_level(&self) -> u8 { self.0.security_level() as u8 diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs b/packages/wasm-dpp/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs index c725337be3d..5455e12edca 100644 --- a/packages/wasm-dpp/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs +++ b/packages/wasm-dpp/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs @@ -7,10 +7,9 @@ use crate::errors::from_dpp_err; use dpp::identity::state_transition::AssetLockProved; use dpp::identity::KeyType; use dpp::platform_value::BinaryData; -use dpp::serialization::ValueConvertible; -use dpp::state_transition::identity_topup_transition::fields::IDENTIFIER_FIELDS; + use dpp::version::PlatformVersion; -use serde_json::Value as JsonValue; + use wasm_bindgen::prelude::*; use crate::identifier::IdentifierWrapper; @@ -20,12 +19,12 @@ use crate::{ identity::state_transition::asset_lock_proof::{ ChainAssetLockProofWasm, InstantAssetLockProofWasm, }, - utils, with_js_error, + with_js_error, }; use crate::identity::state_transition::create_asset_lock_proof_from_wasm_instance; +use dpp::platform_value::string_encoding; use dpp::platform_value::string_encoding::Encoding; -use dpp::platform_value::{string_encoding, ReplacementType, Value}; use dpp::serialization::PlatformSerializable; use dpp::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0; use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; @@ -58,7 +57,7 @@ impl IdentityTopUpTransitionWasm { let platform_version = &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; - IdentityTopUpTransition::default_versioned(&platform_version) + IdentityTopUpTransition::default_versioned(platform_version) .map(Into::into) .map_err(from_dpp_err) } @@ -67,9 +66,9 @@ impl IdentityTopUpTransitionWasm { pub fn set_asset_lock_proof(&mut self, asset_lock_proof: JsValue) -> Result<(), JsValue> { let asset_lock_proof = create_asset_lock_proof_from_wasm_instance(&asset_lock_proof)?; - self.0.set_asset_lock_proof(asset_lock_proof); - - Ok(()) + self.0 + .set_asset_lock_proof(asset_lock_proof) + .map_err(from_dpp_err) } #[wasm_bindgen(getter, js_name=assetLockProof)] @@ -259,6 +258,11 @@ impl IdentityTopUpTransitionWasm { self.0.is_identity_state_transition() } + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + #[wasm_bindgen(js_name=signByPrivateKey)] pub fn sign_by_private_key( &mut self, @@ -303,6 +307,6 @@ impl IdentityTopUpTransitionWasm { #[wasm_bindgen(js_name=setSignature)] pub fn set_signature(&mut self, signature: Option>) { self.0 - .set_signature(BinaryData::new(signature.unwrap_or(vec![]))) + .set_signature(BinaryData::new(signature.unwrap_or_default())) } } diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/identity_update_transition.rs b/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/identity_update_transition.rs index 3218fe754ea..1d8988ba6f9 100644 --- a/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/identity_update_transition.rs +++ b/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/identity_update_transition.rs @@ -2,7 +2,7 @@ use std::convert::TryInto; use std::default::Default; use serde::{Deserialize, Serialize}; -use serde_json::Value as JsonValue; + use wasm_bindgen::__rt::Ref; use wasm_bindgen::prelude::*; @@ -11,7 +11,7 @@ use crate::identifier::IdentifierWrapper; use crate::{ buffer::Buffer, identity::state_transition::identity_public_key_transitions::IdentityPublicKeyWithWitnessWasm, - identity::IdentityPublicKeyWasm, utils, with_js_error, + identity::IdentityPublicKeyWasm, with_js_error, }; use crate::bls_adapter::{BlsAdapter, JsBlsAdapter}; @@ -24,10 +24,9 @@ use dpp::errors::consensus::ConsensusError; use dpp::errors::ProtocolError; use dpp::identity::{KeyID, KeyType, TimestampMillis}; use dpp::platform_value::string_encoding::Encoding; -use dpp::platform_value::{string_encoding, BinaryData, ReplacementType, Value}; +use dpp::platform_value::{string_encoding, BinaryData}; use dpp::prelude::Revision; use dpp::serialization::PlatformSerializable; -use dpp::serialization::ValueConvertible; use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; @@ -79,7 +78,7 @@ impl IdentityUpdateTransitionWasm { let platform_version = &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; - IdentityUpdateTransition::default_versioned(&platform_version) + IdentityUpdateTransition::default_versioned(platform_version) .map(Into::into) .map_err(from_dpp_err) } @@ -145,23 +144,6 @@ impl IdentityUpdateTransitionWasm { self.0.set_public_key_ids_to_disable(keys); } - #[wasm_bindgen(js_name=getPublicKeysDisabledAt)] - pub fn get_public_keys_disabled_at(&self) -> Option { - self.0 - .public_keys_disabled_at() - .map(|timestamp| js_sys::Date::new(&JsValue::from_f64(timestamp as f64))) - } - - #[wasm_bindgen(js_name=setPublicKeysDisabledAt)] - pub fn set_public_keys_disabled_at(&mut self, timestamp: Option) { - if let Some(timestamp) = timestamp { - self.0 - .set_public_keys_disabled_at(Some(timestamp.get_time() as TimestampMillis)); - } else { - self.0.set_public_keys_disabled_at(None); - } - } - #[wasm_bindgen(js_name=getType)] pub fn get_type(&self) -> u8 { self.0.state_transition_type() as u8 @@ -232,14 +214,6 @@ impl IdentityUpdateTransitionWasm { )?; } - if let Some(timestamp) = object.public_keys_disabled_at { - js_sys::Reflect::set( - &js_object, - &"publicKeysDisabledAt".to_owned().into(), - &js_sys::Date::new(&JsValue::from_f64(timestamp as f64)).into(), - )?; - } - if let Some(public_keys_to_add) = object.public_keys_to_add { let keys_objects = public_keys_to_add .into_iter() @@ -326,14 +300,6 @@ impl IdentityUpdateTransitionWasm { )?; } - if let Some(timestamp) = object.public_keys_disabled_at { - js_sys::Reflect::set( - &js_object, - &"publicKeysDisabledAt".to_owned().into(), - &JsValue::from_f64(timestamp as f64), - )?; - } - if let Some(public_keys_to_add) = object.public_keys_to_add { let keys_objects = public_keys_to_add .into_iter() @@ -395,6 +361,11 @@ impl IdentityUpdateTransitionWasm { self.0.is_identity_state_transition() } + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + #[wasm_bindgen(js_name=signByPrivateKey)] pub fn sign_by_private_key( &mut self, @@ -444,7 +415,7 @@ impl IdentityUpdateTransitionWasm { #[wasm_bindgen(js_name=setSignature)] pub fn set_signature(&mut self, signature: Option>) { self.0 - .set_signature(BinaryData::new(signature.unwrap_or(vec![]))) + .set_signature(BinaryData::new(signature.unwrap_or_default())) } #[wasm_bindgen(js_name=getRevision)] diff --git a/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/to_object.rs b/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/to_object.rs index 82ea33c2a16..bf343c15808 100644 --- a/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/to_object.rs +++ b/packages/wasm-dpp/src/identity/state_transition/identity_update_transition/to_object.rs @@ -19,7 +19,6 @@ pub struct ToObject { pub revision: u32, pub signature: Option>, pub signature_public_key_id: KeyID, - pub public_keys_disabled_at: Option, pub public_keys_to_add: Option>, pub public_key_ids_to_disable: Option>, pub identity_id: Identifier, @@ -46,8 +45,6 @@ pub fn to_object_struct( to_object.signature = signature; } - to_object.public_keys_disabled_at = transition.public_keys_disabled_at(); - let public_keys_to_add = transition.public_keys_to_add(); if !public_keys_to_add.is_empty() { to_object.public_keys_to_add = Some(public_keys_to_add.to_owned()); diff --git a/packages/wasm-dpp/src/identity/state_transition/mod.rs b/packages/wasm-dpp/src/identity/state_transition/mod.rs index d724e9743ca..27e8ae4113a 100644 --- a/packages/wasm-dpp/src/identity/state_transition/mod.rs +++ b/packages/wasm-dpp/src/identity/state_transition/mod.rs @@ -1,6 +1,7 @@ pub use asset_lock_proof::*; pub use identity_create_transition::*; pub use identity_credit_transfer_transition::*; +pub use identity_credit_withdrawal_transition::*; pub use identity_topup_transition::*; pub use identity_update_transition::*; // pub use validate_public_key_signatures::*; @@ -8,6 +9,7 @@ pub use identity_update_transition::*; mod asset_lock_proof; mod identity_create_transition; mod identity_credit_transfer_transition; +mod identity_credit_withdrawal_transition; pub(crate) mod identity_public_key_transitions; mod identity_topup_transition; mod identity_update_transition; diff --git a/packages/wasm-dpp/src/identity/state_transition/transition_types.rs b/packages/wasm-dpp/src/identity/state_transition/transition_types.rs index fec6d183f7f..1a4942726e0 100644 --- a/packages/wasm-dpp/src/identity/state_transition/transition_types.rs +++ b/packages/wasm-dpp/src/identity/state_transition/transition_types.rs @@ -12,6 +12,7 @@ pub enum StateTransitionTypeWasm { IdentityUpdate = 5, IdentityCreditWithdrawal = 6, IdentityCreditTransfer = 7, + MasternodeVote = 8, } impl From for StateTransitionTypeWasm { @@ -29,6 +30,7 @@ impl From for StateTransitionTypeWasm { StateTransitionType::IdentityCreditTransfer => { StateTransitionTypeWasm::IdentityCreditTransfer } + StateTransitionType::MasternodeVote => StateTransitionTypeWasm::MasternodeVote, } } } diff --git a/packages/wasm-dpp/src/lib.rs b/packages/wasm-dpp/src/lib.rs index 48cc4281670..6d0aa9c50c1 100644 --- a/packages/wasm-dpp/src/lib.rs +++ b/packages/wasm-dpp/src/lib.rs @@ -19,7 +19,7 @@ mod identifier; mod identity; mod metadata; // mod state_repository; -mod state_transition; +pub mod state_transition; // mod version; mod utils; @@ -31,3 +31,4 @@ mod entropy_generator; mod lodash; mod protocol_version; mod validation; +mod voting; diff --git a/packages/wasm-dpp/src/metadata.rs b/packages/wasm-dpp/src/metadata.rs index 488ba9e10a9..e2a19afdf01 100644 --- a/packages/wasm-dpp/src/metadata.rs +++ b/packages/wasm-dpp/src/metadata.rs @@ -1,6 +1,6 @@ #![allow(clippy::from_over_into)] -pub use serde::{Deserialize, Serialize}; +pub use serde::Serialize; use wasm_bindgen::prelude::*; use crate::utils::ToSerdeJSONExt; @@ -20,7 +20,7 @@ impl From for MetadataWasm { impl From<&MetadataWasm> for Metadata { fn from(v: &MetadataWasm) -> Self { - v.0.clone() + v.0 } } diff --git a/packages/wasm-dpp/src/protocol_version.rs b/packages/wasm-dpp/src/protocol_version.rs index be8ea4da808..605e58c2fb7 100644 --- a/packages/wasm-dpp/src/protocol_version.rs +++ b/packages/wasm-dpp/src/protocol_version.rs @@ -1,4 +1,4 @@ -use dpp::version::{PlatformVersion, LATEST_VERSION}; +use dpp::version::PlatformVersion; use wasm_bindgen::prelude::wasm_bindgen; #[wasm_bindgen(js_name = getLatestProtocolVersion)] diff --git a/packages/wasm-dpp/src/state_transition/errors/invalid_state_transition_error.rs b/packages/wasm-dpp/src/state_transition/errors/invalid_state_transition_error.rs index b2726378e58..2c09e469abd 100644 --- a/packages/wasm-dpp/src/state_transition/errors/invalid_state_transition_error.rs +++ b/packages/wasm-dpp/src/state_transition/errors/invalid_state_transition_error.rs @@ -1,6 +1,6 @@ use dpp::consensus::ConsensusError; -use serde::Serialize; -use wasm_bindgen::{prelude::wasm_bindgen, JsError, JsValue}; + +use wasm_bindgen::{prelude::wasm_bindgen, JsValue}; use crate::{ buffer::Buffer, errors::consensus::consensus_error::from_consensus_error_ref, diff --git a/packages/wasm-dpp/src/state_transition/state_transition_factory.rs b/packages/wasm-dpp/src/state_transition/state_transition_factory.rs index 73abb163483..8b3f8bfa863 100644 --- a/packages/wasm-dpp/src/state_transition/state_transition_factory.rs +++ b/packages/wasm-dpp/src/state_transition/state_transition_factory.rs @@ -3,9 +3,11 @@ use crate::document_batch_transition::DocumentsBatchTransitionWasm; use crate::errors::from_dpp_err; use crate::identity::state_transition::{ IdentityCreateTransitionWasm, IdentityCreditTransferTransitionWasm, - IdentityTopUpTransitionWasm, IdentityUpdateTransitionWasm, + IdentityCreditWithdrawalTransitionWasm, IdentityTopUpTransitionWasm, + IdentityUpdateTransitionWasm, }; use crate::state_transition::errors::invalid_state_transition_error::InvalidStateTransitionErrorWasm; +use crate::voting::state_transition::masternode_vote_transition::MasternodeVoteTransitionWasm; use dpp::state_transition::errors::StateTransitionError; use dpp::state_transition::state_transition_factory::StateTransitionFactory; use dpp::state_transition::StateTransition; @@ -51,10 +53,15 @@ impl StateTransitionFactoryWasm { StateTransition::IdentityCreditTransfer(st) => { Ok(IdentityCreditTransferTransitionWasm::from(st).into()) } + StateTransition::IdentityCreditWithdrawal(st) => { + Ok(IdentityCreditWithdrawalTransitionWasm::from(st).into()) + } StateTransition::DocumentsBatch(st) => { Ok(DocumentsBatchTransitionWasm::from(st).into()) } - _ => Err("Unsupported state transition type".into()), + StateTransition::MasternodeVote(st) => { + Ok(MasternodeVoteTransitionWasm::from(st).into()) + } }, Err(dpp::ProtocolError::StateTransitionError(e)) => match e { StateTransitionError::InvalidStateTransitionError { diff --git a/packages/wasm-dpp/src/utils.rs b/packages/wasm-dpp/src/utils.rs index 5ea7f849ab3..2e2879a723e 100644 --- a/packages/wasm-dpp/src/utils.rs +++ b/packages/wasm-dpp/src/utils.rs @@ -66,6 +66,9 @@ where iter.into_iter().map(|v| v.into()).collect() } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub fn to_vec_of_serde_values( values: impl IntoIterator>, ) -> Result, JsValue> { @@ -229,6 +232,9 @@ pub fn get_bool_from_options( } } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub fn get_class_name(value: &JsValue) -> String { js_sys::Object::get_prototype_of(value) .constructor() @@ -236,6 +242,9 @@ pub fn get_class_name(value: &JsValue) -> String { .into() } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub fn try_to_u64(value: JsValue) -> Result { if value.is_bigint() { js_sys::BigInt::new(&value) diff --git a/packages/wasm-dpp/src/validation/validation_result.rs b/packages/wasm-dpp/src/validation/validation_result.rs index 78743cf9672..bc2f7b13d92 100644 --- a/packages/wasm-dpp/src/validation/validation_result.rs +++ b/packages/wasm-dpp/src/validation/validation_result.rs @@ -1,11 +1,10 @@ use crate::{ - buffer::Buffer, - errors::consensus::consensus_error::from_consensus_error_ref, - utils::{consensus_errors_from_buffers, WithJsError}, + buffer::Buffer, errors::consensus::consensus_error::from_consensus_error_ref, + utils::consensus_errors_from_buffers, }; -use dpp::serialization::PlatformDeserializable; + use dpp::{consensus::ConsensusError, validation::ConsensusValidationResult}; -use js_sys::{JsString, Uint8Array}; +use js_sys::JsString; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name=ValidationResult)] diff --git a/packages/wasm-dpp/src/voting/mod.rs b/packages/wasm-dpp/src/voting/mod.rs new file mode 100644 index 00000000000..189974a343a --- /dev/null +++ b/packages/wasm-dpp/src/voting/mod.rs @@ -0,0 +1 @@ +pub mod state_transition; diff --git a/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs b/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs new file mode 100644 index 00000000000..4ee92d0023d --- /dev/null +++ b/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs @@ -0,0 +1,354 @@ +mod to_object; + +use crate::bls_adapter::{BlsAdapter, JsBlsAdapter}; +use crate::buffer::Buffer; +use crate::errors::from_dpp_err; +use crate::identifier::IdentifierWrapper; +use crate::utils::WithJsError; +use crate::{with_js_error, IdentityPublicKeyWasm}; +use dpp::identifier::Identifier; +use dpp::identity::KeyType; +use dpp::platform_value::string_encoding::Encoding; +use dpp::platform_value::{string_encoding, BinaryData}; +use dpp::serialization::PlatformSerializable; +use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::state_transition::{StateTransition, StateTransitionIdentitySigned, StateTransitionLike}; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; +use dpp::voting::votes::Vote; +use js_sys::{Array, Object, Reflect}; +use wasm_bindgen::prelude::wasm_bindgen; +use wasm_bindgen::{JsError, JsValue}; + +#[derive(Clone)] +#[wasm_bindgen(js_name=MasternodeVoteTransition)] +pub struct MasternodeVoteTransitionWasm(MasternodeVoteTransition); + +impl From for MasternodeVoteTransitionWasm { + fn from(v: MasternodeVoteTransition) -> Self { + MasternodeVoteTransitionWasm(v) + } +} + +impl From for MasternodeVoteTransition { + fn from(val: MasternodeVoteTransitionWasm) -> Self { + val.0 + } +} + +#[wasm_bindgen(js_class=MasternodeVoteTransition)] +impl MasternodeVoteTransitionWasm { + #[wasm_bindgen(constructor)] + pub fn new(platform_version: u32) -> Result { + let platform_version = + &PlatformVersion::get(platform_version).map_err(|e| JsValue::from(e.to_string()))?; + + MasternodeVoteTransition::default_versioned(platform_version) + .map(Into::into) + .map_err(from_dpp_err) + } + + #[wasm_bindgen(js_name=getOwnerId)] + pub fn get_owner_id(&self) -> IdentifierWrapper { + self.0.owner_id().to_owned().into() + } + + #[wasm_bindgen(js_name=getType)] + pub fn get_type(&self) -> u8 { + self.0.state_transition_type() as u8 + } + + #[wasm_bindgen(js_name=getProTxHash)] + pub fn get_pro_tx_hash(&self) -> IdentifierWrapper { + self.0.pro_tx_hash().into() + } + + #[wasm_bindgen(js_name=setProTxHash)] + pub fn set_pro_tx_hash(&mut self, pro_tx_hash: &IdentifierWrapper) { + self.0.set_pro_tx_hash(pro_tx_hash.into()); + } + + #[wasm_bindgen(js_name=toObject)] + pub fn to_object(&self, options: JsValue) -> Result { + let opts: self::to_object::ToObjectOptions = if options.is_object() { + with_js_error!(serde_wasm_bindgen::from_value(options))? + } else { + Default::default() + }; + + let object = self::to_object::to_object_struct(&self.0, opts); + let js_object = js_sys::Object::new(); + + js_sys::Reflect::set( + &js_object, + &"type".to_owned().into(), + &object.transition_type.into(), + )?; + + let version = match self.0 { + MasternodeVoteTransition::V0(_) => "0", + }; + + js_sys::Reflect::set(&js_object, &"$version".to_owned().into(), &version.into())?; + + if let Some(signature) = object.signature { + let signature_value: JsValue = if signature.is_empty() { + JsValue::undefined() + } else { + Buffer::from_bytes(signature.as_slice()).into() + }; + + js_sys::Reflect::set(&js_object, &"signature".to_owned().into(), &signature_value)?; + + if let Some(signature_public_key_id) = object.signature_public_key_id { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &JsValue::from(signature_public_key_id), + )?; + } else { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &JsValue::undefined(), + )?; + } + } + + js_sys::Reflect::set( + &js_object, + &"proTxHash".to_owned().into(), + &Buffer::from_bytes(object.pro_tx_hash.to_buffer().as_slice()), + )?; + + //todo: reflect vote + + Ok(js_object.into()) + } + + #[wasm_bindgen(js_name=toBuffer)] + pub fn to_buffer(&self) -> Result { + let bytes = PlatformSerializable::serialize_to_bytes(&StateTransition::MasternodeVote( + self.0.clone(), + )) + .with_js_error()?; + Ok(Buffer::from_bytes(&bytes)) + } + + #[wasm_bindgen(js_name=toJSON)] + pub fn to_json(&self) -> Result { + let object = self::to_object::to_object_struct(&self.0, Default::default()); + let js_object = js_sys::Object::new(); + + js_sys::Reflect::set( + &js_object, + &"type".to_owned().into(), + &object.transition_type.into(), + )?; + + let version = match self.0 { + MasternodeVoteTransition::V0(_) => "0", + }; + + js_sys::Reflect::set(&js_object, &"$version".to_owned().into(), &version.into())?; + + if let Some(signature) = object.signature { + let signature_value: JsValue = if signature.is_empty() { + JsValue::undefined() + } else { + string_encoding::encode(signature.as_slice(), Encoding::Base64).into() + }; + + js_sys::Reflect::set(&js_object, &"signature".to_owned().into(), &signature_value)?; + + if let Some(signature_public_key_id) = object.signature_public_key_id { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &signature_public_key_id.into(), + )?; + } else { + js_sys::Reflect::set( + &js_object, + &"signaturePublicKeyId".to_owned().into(), + &JsValue::undefined(), + )?; + } + } + + let pro_tx_hash = object.pro_tx_hash.to_string(Encoding::Base58); + + js_sys::Reflect::set( + &js_object, + &"proTxHash".to_owned().into(), + &pro_tx_hash.into(), + )?; + + // todo: reflect vote + + Ok(js_object.into()) + } + + #[wasm_bindgen(js_name=getModifiedDataIds)] + pub fn modified_data_ids(&self) -> Vec { + let ids = self.0.modified_data_ids(); + + ids.into_iter() + .map(|id| >::from(id).into()) + .collect() + } + + #[wasm_bindgen(js_name=isDataContractStateTransition)] + pub fn is_data_contract_state_transition(&self) -> bool { + self.0.is_data_contract_state_transition() + } + + #[wasm_bindgen(js_name=isDocumentStateTransition)] + pub fn is_document_state_transition(&self) -> bool { + self.0.is_document_state_transition() + } + + #[wasm_bindgen(js_name=isIdentityStateTransition)] + pub fn is_identity_state_transition(&self) -> bool { + self.0.is_identity_state_transition() + } + + #[wasm_bindgen(js_name=isVotingStateTransition)] + pub fn is_voting_state_transition(&self) -> bool { + self.0.is_voting_state_transition() + } + + #[wasm_bindgen(js_name=getContestedDocumentResourceVotePoll)] + pub fn contested_document_resource_vote_poll(&self) -> Option { + match self.0.vote() { + Vote::ResourceVote(vote) => match vote.vote_poll() { + VotePoll::ContestedDocumentResourceVotePoll( + contested_document_resource_vote_poll, + ) => { + let js_object = Object::new(); + + let contract_id = IdentifierWrapper::from( + contested_document_resource_vote_poll.contract_id.clone(), + ); + + Reflect::set(&js_object, &"contractId".into(), &contract_id.into()).unwrap(); + Reflect::set( + &js_object, + &"documentTypeName".into(), + &contested_document_resource_vote_poll + .document_type_name + .clone() + .into(), + ) + .unwrap(); + Reflect::set( + &js_object, + &"indexName".into(), + &contested_document_resource_vote_poll + .index_name + .clone() + .into(), + ) + .unwrap(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let serialized_index_values = contested_document_resource_vote_poll + .index_values + .iter() + .map(|value| { + JsValue::from(Buffer::from_bytes_owned( + bincode::encode_to_vec(value, config) + .expect("expected to encode value in path"), + )) + }); + + let js_array = Array::from_iter(serialized_index_values); + + Reflect::set(&js_object, &"indexValues".into(), &js_array.into()).unwrap(); + + Some(js_object) + } + }, + } + } + + #[wasm_bindgen(js_name=signByPrivateKey)] + pub fn sign_by_private_key( + &mut self, + private_key: Vec, + key_type: u8, + bls: Option, + ) -> Result<(), JsValue> { + let key_type = key_type + .try_into() + .map_err(|e: anyhow::Error| e.to_string())?; + + if bls.is_none() && key_type == KeyType::BLS12_381 { + return Err(JsError::new( + format!("BLS adapter is required for BLS key type '{}'", key_type).as_str(), + ) + .into()); + } + + let bls_adapter = if let Some(adapter) = bls { + BlsAdapter(adapter) + } else { + BlsAdapter(JsValue::undefined().into()) + }; + + // TODO: not the best approach because it involves cloning the transition + // Probably it worth to return `sign_by_private_key` per state transition + let mut wrapper = StateTransition::MasternodeVote(self.0.clone()); + wrapper + .sign_by_private_key(private_key.as_slice(), key_type, &bls_adapter) + .with_js_error()?; + + self.0.set_signature(wrapper.signature().to_owned()); + + Ok(()) + } + + #[wasm_bindgen(js_name=getSignature)] + pub fn get_signature(&self) -> Buffer { + Buffer::from_bytes(self.0.signature().as_slice()) + } + + #[wasm_bindgen(js_name=setSignature)] + pub fn set_signature(&mut self, signature: Option>) { + self.0 + .set_signature(BinaryData::new(signature.unwrap_or_default())) + } + + #[wasm_bindgen] + pub fn sign( + &mut self, + identity_public_key: &IdentityPublicKeyWasm, + private_key: Vec, + bls: JsBlsAdapter, + ) -> Result<(), JsValue> { + let bls_adapter = BlsAdapter(bls); + + // TODO: come up with a better way to set signature to the binding. + let mut state_transition = StateTransition::MasternodeVote(self.0.clone()); + state_transition + .sign( + &identity_public_key.to_owned().into(), + &private_key, + &bls_adapter, + ) + .with_js_error()?; + + let signature = state_transition.signature().to_owned(); + let signature_public_key_id = state_transition.signature_public_key_id().unwrap_or(0); + + self.0.set_signature(signature); + self.0.set_signature_public_key_id(signature_public_key_id); + + Ok(()) + } +} diff --git a/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/to_object.rs b/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/to_object.rs new file mode 100644 index 00000000000..bdc8ba6d14e --- /dev/null +++ b/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/to_object.rs @@ -0,0 +1,47 @@ +use dpp::identity::KeyID; + +use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::state_transition::StateTransitionIdentitySigned; +use dpp::voting::votes::Vote; +use dpp::{identifier::Identifier, state_transition::StateTransitionLike}; +use serde::Deserialize; +use std::default::Default; + +#[derive(Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct ToObjectOptions { + pub skip_signature: Option, +} + +#[derive(Default)] +pub struct ToObject { + pub transition_type: u8, + pub pro_tx_hash: Identifier, + pub vote: Vote, + pub signature: Option>, + pub signature_public_key_id: Option, +} + +pub fn to_object_struct( + transition: &MasternodeVoteTransition, + options: ToObjectOptions, +) -> ToObject { + let mut to_object = ToObject { + transition_type: transition.state_transition_type() as u8, + vote: transition.vote().clone(), + ..ToObject::default() + }; + + if !options.skip_signature.unwrap_or(false) { + let signature = Some(transition.signature().to_vec()); + if let Some(signature) = &signature { + if !signature.is_empty() { + to_object.signature_public_key_id = Some(transition.signature_public_key_id()) + } + } + to_object.signature = signature; + } + + to_object +} diff --git a/packages/wasm-dpp/src/voting/state_transition/mod.rs b/packages/wasm-dpp/src/voting/state_transition/mod.rs new file mode 100644 index 00000000000..e7283f9c79d --- /dev/null +++ b/packages/wasm-dpp/src/voting/state_transition/mod.rs @@ -0,0 +1 @@ +pub mod masternode_vote_transition; diff --git a/packages/wasm-dpp/test/integration/dataContract/DataContractFacade.spec.js b/packages/wasm-dpp/test/integration/dataContract/DataContractFacade.spec.js index 961ade24b24..48a06e099b3 100644 --- a/packages/wasm-dpp/test/integration/dataContract/DataContractFacade.spec.js +++ b/packages/wasm-dpp/test/integration/dataContract/DataContractFacade.spec.js @@ -41,6 +41,8 @@ describe('DataContractFacade', () => { it('should create DataContract', () => { const result = dpp.dataContract.create( dataContract.getOwnerId(), + // eslint-disable-next-line + BigInt(1), dataContract.getDocumentSchemas(), ); @@ -65,6 +67,8 @@ describe('DataContractFacade', () => { it('should create DataContract from string', async () => { const contract = dpp.dataContract.create( dataContract.getOwnerId(), + // eslint-disable-next-line + BigInt(1), dataContract.getDocumentSchemas(), ); @@ -101,7 +105,8 @@ describe('DataContractFacade', () => { updatedDataContract.incrementVersion(); const dataContractUpdateTransition = dpp.dataContract - .createDataContractUpdateTransition(updatedDataContract); + // eslint-disable-next-line + .createDataContractUpdateTransition(updatedDataContract, BigInt(1)); const { identityPublicKey, privateKey } = await getPrivateAndPublicKeyForSigningFixture(); diff --git a/packages/wasm-dpp/test/integration/dataContract/validation/validateDataContractFactory.spec.js b/packages/wasm-dpp/test/integration/dataContract/validation/validateDataContractFactory.spec.js index fb18dd6ef8c..b2c1a582e63 100644 --- a/packages/wasm-dpp/test/integration/dataContract/validation/validateDataContractFactory.spec.js +++ b/packages/wasm-dpp/test/integration/dataContract/validation/validateDataContractFactory.spec.js @@ -1133,7 +1133,7 @@ describe.skip('validateDataContractFactory', () => { const [error] = result.getErrors(); - expect(error.getCode()).to.equal(1009); + expect(error.getCode()).to.equal(10202); expect(error.getPattern()).to.equal('^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$'); expect(error.getPath()).to.equal('/documents/indexedDocument/properties/something'); }); diff --git a/packages/wasm-dpp/test/integration/document/Document.spec.js b/packages/wasm-dpp/test/integration/document/Document.spec.js index 213d8c0fcc8..f3f4b8f2e50 100644 --- a/packages/wasm-dpp/test/integration/document/Document.spec.js +++ b/packages/wasm-dpp/test/integration/document/Document.spec.js @@ -55,7 +55,14 @@ describe('ExtendedDocument', () => { expect(result).to.deep.equal({ $createdAt: null, // TODO: it should be omitted + $createdAtBlockHeight: null, + $createdAtCoreBlockHeight: null, $updatedAt: null, + $updatedAtBlockHeight: null, + $updatedAtCoreBlockHeight: null, + $transferredAt: null, + $transferredAtBlockHeight: null, + $transferredAtCoreBlockHeight: null, $dataContractId: dataContract.getId().toBuffer(), $id: document.getId().toBuffer(), $ownerId: document.getOwnerId().toBuffer(), diff --git a/packages/wasm-dpp/test/integration/document/DocumentFacade.spec.js b/packages/wasm-dpp/test/integration/document/DocumentFacade.spec.js index bef3cd71e9b..1fccf76acdf 100644 --- a/packages/wasm-dpp/test/integration/document/DocumentFacade.spec.js +++ b/packages/wasm-dpp/test/integration/document/DocumentFacade.spec.js @@ -96,8 +96,15 @@ describe('DocumentFacade', () => { describe('createStateTransition', () => { it('should create DocumentsBatchTransition with passed documents - Rust', () => { + const identityId = documents[0].getOwnerId(); + const contractId = documents[0].getDataContractId(); + const result = dpp.document.createStateTransition({ create: documents, + }, { + [identityId.toString()]: { + [contractId.toString()]: 1, + }, }); expect(result).to.be.instanceOf(DocumentsBatchTransition); diff --git a/packages/wasm-dpp/test/integration/error/consensus/deserializeConsensusError.spec.js b/packages/wasm-dpp/test/integration/error/consensus/deserializeConsensusError.spec.js index 338b0af1206..68a3272a5f9 100644 --- a/packages/wasm-dpp/test/integration/error/consensus/deserializeConsensusError.spec.js +++ b/packages/wasm-dpp/test/integration/error/consensus/deserializeConsensusError.spec.js @@ -18,14 +18,14 @@ describe('deserializeConsensusError', () => { const message = 'Can\'t read protocol version from serialized object: test'; expect(consensusError).to.be.instanceOf(ProtocolVersionParsingError); - expect(consensusError.getCode()).to.equals(1000); + expect(consensusError.getCode()).to.equals(10001); expect(consensusError.message).to.equals(message); const serializedConsensusError = consensusError.serialize(); const recoveredError = deserializeConsensusError(serializedConsensusError); expect(recoveredError).to.be.instanceOf(ProtocolVersionParsingError); - expect(recoveredError.getCode()).to.equals(1000); + expect(recoveredError.getCode()).to.equals(10001); expect(recoveredError.message).to.equals(message); }); }); diff --git a/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js b/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js index f3fa71fbbd1..90778aa72e9 100644 --- a/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js +++ b/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js @@ -5,10 +5,12 @@ const getInstantAssetLockProofFixture = require('../../../lib/test/fixtures/getI const getChainAssetLockProofFixture = require('../../../lib/test/fixtures/getChainAssetLockProofFixture'); const { + default: loadWasmDpp, Identity, InstantAssetLockProof, ChainAssetLockProof, IdentityUpdateTransition, IdentityCreateTransition, IdentityTopUpTransition, IdentityPublicKeyWithWitness, DashPlatformProtocol, ValidationResult, } = require('../../..'); +const getIdentityCreditWithdrawalTransitionFixture = require('../../../lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture'); describe('IdentityFacade', () => { let dpp; @@ -17,6 +19,8 @@ describe('IdentityFacade', () => { let instantAssetLockProof; let chainAssetLockProof; + before(loadWasmDpp); + beforeEach(async () => { dpp = new DashPlatformProtocol( { generate: () => crypto.randomBytes(32) }, @@ -173,6 +177,8 @@ describe('IdentityFacade', () => { const stateTransition = dpp.identity .createIdentityUpdateTransition( identity, + // eslint-disable-next-line + BigInt(1), publicKeys, ); @@ -186,7 +192,26 @@ describe('IdentityFacade', () => { stateTransition.getPublicKeysToAdd().map((pk) => pk.toObject()), ).to.deep.equal(publicKeys.add.map((k) => k.toObject())); expect(stateTransition.getPublicKeyIdsToDisable()).to.deep.equal([]); - expect(stateTransition.getPublicKeysDisabledAt()).to.equal(undefined); + }); + }); + + describe('createIdentityCreditWithdrawalTransition', () => { + it('should create IdentityCreditWithdrawalTransition', () => { + const stateTransitionFixture = getIdentityCreditWithdrawalTransitionFixture(); + const stateTransition = dpp.identity + .createIdentityCreditWithdrawalTransition( + stateTransitionFixture.getIdentityId(), + stateTransitionFixture.getAmount(), + stateTransitionFixture.getCoreFeePerByte(), + stateTransitionFixture.getPooling(), + stateTransitionFixture.getOutputScript(), + stateTransitionFixture.getNonce(), + ); + + expect(stateTransition.toObject()) + .to.deep.equal( + stateTransitionFixture.toObject(), + ); }); }); }); diff --git a/packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js b/packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js index 13673211ee2..19d40b4ff84 100644 --- a/packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js +++ b/packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js @@ -24,7 +24,6 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { let IdentityPublicKeyIsDisabledError; let InvalidIdentityPublicKeyIdError; let MissingMasterPublicKeyError; - let IdentityPublicKeyDisabledAtWindowViolationError; let MaxIdentityPublicKeyLimitReachedError; let StateTransitionExecutionContext; let IdentityUpdateTransitionStateValidator; @@ -37,7 +36,6 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { IdentityPublicKeyIsReadOnlyError, IdentityPublicKeyIsDisabledError, InvalidIdentityPublicKeyIdError, - IdentityPublicKeyDisabledAtWindowViolationError, MaxIdentityPublicKeyLimitReachedError, StateTransitionExecutionContext, IdentityUpdateTransitionStateValidator, @@ -68,7 +66,6 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { stateTransition.setRevision(identity.getRevision() + 1); stateTransition.setPublicKeyIdsToDisable(undefined); - stateTransition.setPublicKeysDisabledAt(undefined); const privateKey = '9b67f852093bc61cea0eeca38599dbfba0de28574d2ed9b99d10d33dc1bde7b2'; @@ -116,35 +113,8 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { expect(error.getPublicKeyIndex()).to.equal(0); }); - it('should return invalid result if disabledAt has violated time window', async () => { - stateTransition.setPublicKeyIdsToDisable([1]); - // blockTime - 10 minutes - const disabledAt = new Date(blockTime - 1000 * 60 * 60 * 10); - stateTransition.setPublicKeysDisabledAt(disabledAt); - - const timeWindowStart = new Date(blockTime); - timeWindowStart.setMinutes( - timeWindowStart.getMinutes() - 5, - ); - - const timeWindowEnd = new Date(blockTime); - timeWindowEnd.setMinutes( - timeWindowEnd.getMinutes() + 5, - ); - - const result = await validateIdentityUpdateTransitionState(stateTransition); - - await expectValidationError(result, IdentityPublicKeyDisabledAtWindowViolationError); - - const [error] = result.getErrors(); - expect(error.getDisabledAt()).to.deep.equal(disabledAt); - expect(error.getTimeWindowStart()).to.be.instanceOf(Date); - expect(error.getTimeWindowEnd()).to.be.instanceOf(Date); - }); - it('should throw InvalidIdentityPublicKeyIdError if identity does not contain public key with disabling ID', async () => { stateTransition.setPublicKeyIdsToDisable([3]); - stateTransition.setPublicKeysDisabledAt(new Date()); const result = await validateIdentityUpdateTransitionState(stateTransition); @@ -156,7 +126,6 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { it('should pass when disabling public key', async function () { stateTransition.setPublicKeyIdsToDisable([1]); - stateTransition.setPublicKeysDisabledAt(new Date()); stateTransition.setPublicKeysToAdd(undefined); const result = await validateIdentityUpdateTransitionState(stateTransition); @@ -176,7 +145,6 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { it('should pass when adding public key', async function () { stateTransition.setPublicKeyIdsToDisable(undefined); - stateTransition.setPublicKeysDisabledAt(undefined); const result = await validateIdentityUpdateTransitionState(stateTransition); @@ -195,7 +163,6 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { it('should pass when both adding and disabling public keys', async function () { stateTransition.setPublicKeyIdsToDisable([1]); - stateTransition.setPublicKeysDisabledAt(new Date()); const result = await validateIdentityUpdateTransitionState(stateTransition); @@ -262,7 +229,6 @@ describe.skip('validateIdentityUpdateTransitionStateFactory', () => { it('should return valid result on dry run', async function () { stateTransition.setPublicKeyIdsToDisable([3]); - stateTransition.setPublicKeysDisabledAt(new Date()); // Make code that executes after dry run check to fail stateRepositoryMock.fetchLatestPlatformBlockTime.resolves({}); diff --git a/packages/wasm-dpp/test/integration/stateTransition/StateTransitionFacade.spec.js b/packages/wasm-dpp/test/integration/stateTransition/StateTransitionFacade.spec.js index 9873a5633a2..d155a4b742d 100644 --- a/packages/wasm-dpp/test/integration/stateTransition/StateTransitionFacade.spec.js +++ b/packages/wasm-dpp/test/integration/stateTransition/StateTransitionFacade.spec.js @@ -97,8 +97,13 @@ describe('StateTransitionFacade', () => { identityPublicKey.setPurpose(IdentityPublicKey.PURPOSES.AUTHENTICATION); identityPublicKey.setReadOnly(false); + const documents = await getDocumentsFixture(dataContract); documentsBatchTransition = documentFactory.createStateTransition({ - create: await getDocumentsFixture(dataContract), + create: documents, + }, { + [documents[0].getOwnerId().toString()]: { + [documents[0].getDataContractId().toString()]: 0, + }, }); await documentsBatchTransition.sign(identityPublicKey, privateKey); diff --git a/packages/wasm-dpp/test/unit/dataContract/DataContract.spec.js b/packages/wasm-dpp/test/unit/dataContract/DataContract.spec.js index 9b42f3b81ac..4726cb31cd5 100644 --- a/packages/wasm-dpp/test/unit/dataContract/DataContract.spec.js +++ b/packages/wasm-dpp/test/unit/dataContract/DataContract.spec.js @@ -9,7 +9,7 @@ describe('DataContract', () => { let documentSchema; let documentSchemas; let ownerId; - let entropy; + let identityNonce; let contractId; let dataContract; let schemaDefs; @@ -48,7 +48,8 @@ describe('DataContract', () => { }; ownerId = (await generateRandomIdentifier()).toBuffer(); - entropy = Buffer.alloc(32, 420); + // eslint-disable-next-line + identityNonce = BigInt(1); contractId = (await generateRandomIdentifier()).toBuffer(); schemaDefs = { something: { type: 'string' } }; @@ -222,6 +223,7 @@ describe('DataContract', () => { config: { $format_version: '0', canBeDeleted: false, + documentsCanBeDeletedContractDefault: true, documentsKeepHistoryContractDefault: false, documentsMutableContractDefault: true, keepsHistory: false, @@ -251,6 +253,7 @@ describe('DataContract', () => { config: { $format_version: '0', canBeDeleted: false, + documentsCanBeDeletedContractDefault: true, documentsKeepHistoryContractDefault: false, documentsMutableContractDefault: true, keepsHistory: false, @@ -271,7 +274,7 @@ describe('DataContract', () => { it('should return DataContract as a Buffer', () => { const result = dataContract.toBuffer(); expect(result).to.be.instanceOf(Buffer); - expect(result).to.have.lengthOf(235); + expect(result).to.have.lengthOf(236); }); }); @@ -287,11 +290,11 @@ describe('DataContract', () => { }); }); - describe('#setEntropy', () => { + describe('#setIdentityNonce', () => { it('should set entropy', () => { - dataContract.setEntropy(entropy); + dataContract.setIdentityNonce(identityNonce); - expect(dataContract.getEntropy()).to.deep.equal(entropy); + expect(dataContract.getIdentityNonce()).to.deep.equal(identityNonce); }); }); diff --git a/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js b/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js index 05dff347b73..dc394aee3c6 100644 --- a/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js +++ b/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js @@ -20,7 +20,7 @@ describe('DataContractCreateTransition', () => { stateTransition = new DataContractCreateTransition({ protocolVersion: 1, dataContract: dataContract.toObject(), - entropy: dataContract.getEntropy(), + identityNonce: 1, }); }); // @@ -66,7 +66,7 @@ describe('DataContractCreateTransition', () => { it('should return serialized State Transition', () => { const result = stateTransition.toBuffer(); expect(result).to.be.instanceOf(Buffer); - expect(result).to.have.lengthOf(2388); + expect(result).to.have.lengthOf(2359); }); it('should be able to restore contract config from bytes', () => { diff --git a/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js b/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js index 7c455ec4048..444f695113c 100644 --- a/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js +++ b/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js @@ -20,6 +20,7 @@ describe('DataContractUpdateTransition', () => { stateTransition = new DataContractUpdateTransition({ protocolVersion: 1, dataContract: dataContract.toObject(), + identityContractNonce: 1, }); }); @@ -64,7 +65,7 @@ describe('DataContractUpdateTransition', () => { it('should return serialized State Transition', () => { const result = stateTransition.toBuffer(); expect(result).to.be.instanceOf(Buffer); - expect(result).to.have.lengthOf(2356); + expect(result).to.have.lengthOf(2359); }); it('should be able to restore contract config from bytes', () => { diff --git a/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/state/validateDataContractUpdateTransitionStateFactory.spec.js b/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/state/validateDataContractUpdateTransitionStateFactory.spec.js index af71bb1ecb8..2addf1f98d0 100644 --- a/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/state/validateDataContractUpdateTransitionStateFactory.spec.js +++ b/packages/wasm-dpp/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/state/validateDataContractUpdateTransitionStateFactory.spec.js @@ -97,7 +97,7 @@ describe.skip('validateDataContractUpdateTransitionStateFactory', () => { const [error] = result.getErrors(); expect(error).to.be.an.instanceOf(InvalidDataContractVersionError); - expect(error.getCode()).to.equal(1050); + expect(error.getCode()).to.equal(10212); }); it('should return valid result', async () => { diff --git a/packages/wasm-dpp/test/unit/dataContract/validation/validateDataContractPatterns.spec.js b/packages/wasm-dpp/test/unit/dataContract/validation/validateDataContractPatterns.spec.js index d9020ce0655..f7f09bc5122 100644 --- a/packages/wasm-dpp/test/unit/dataContract/validation/validateDataContractPatterns.spec.js +++ b/packages/wasm-dpp/test/unit/dataContract/validation/validateDataContractPatterns.spec.js @@ -66,7 +66,7 @@ describe.skip('validateDataContractPatterns', () => { const [error] = result.getErrors(); expect(error).to.be.instanceOf(IncompatibleRe2PatternError); - expect(error.getCode()).to.equal(1009); + expect(error.getCode()).to.equal(10202); expect(error.getPattern()).to.equal('^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$'); expect(error.getPath()).to.equal('/documents/notFineDocument/properties/bar'); }); diff --git a/packages/wasm-dpp/test/unit/document/Document.spec.js b/packages/wasm-dpp/test/unit/document/Document.spec.js index 3723dc3ce0c..3caa3750ccf 100644 --- a/packages/wasm-dpp/test/unit/document/Document.spec.js +++ b/packages/wasm-dpp/test/unit/document/Document.spec.js @@ -74,7 +74,8 @@ describe('Document', () => { }, }; - dataContract = dataContractFactory.create(ownerId, rawDataContract); + // eslint-disable-next-line + dataContract = dataContractFactory.create(ownerId, BigInt(1), rawDataContract); rawDocument = { $protocolVersion: getLatestProtocolVersion(), @@ -84,7 +85,14 @@ describe('Document', () => { $ownerId: ownerId, $revision: DocumentCreateTransition.INITIAL_REVISION, $createdAt: now, + $createdAtBlockHeight: 1, + $createdAtCoreBlockHeight: 1, $updatedAt: now, + $updatedAtBlockHeight: 1, + $updatedAtCoreBlockHeight: 1, + $transferredAt: null, + $transferredAtBlockHeight: null, + $transferredAtCoreBlockHeight: null, }; rawDocumentWithBuffers = { @@ -95,7 +103,14 @@ describe('Document', () => { $ownerId: ownerId.toBuffer(), $revision: DocumentCreateTransition.INITIAL_REVISION, $createdAt: now, + $createdAtBlockHeight: 1, + $createdAtCoreBlockHeight: 1, $updatedAt: now, + $updatedAtBlockHeight: 1, + $updatedAtCoreBlockHeight: 1, + $transferredAt: null, + $transferredAtBlockHeight: null, + $transferredAtCoreBlockHeight: null, }; document = new ExtendedDocument(rawDocument, dataContract); @@ -282,6 +297,9 @@ describe('Document', () => { $ownerId: await generateRandomIdentifierAsync(), $id: await generateRandomIdentifierAsync(), $updatedAt: updatedAt, + $transferredAt: null, + $transferredAtBlockHeight: null, + $transferredAtCoreBlockHeight: null, $type: 'test', ...data, }; @@ -406,7 +424,7 @@ describe('Document', () => { it('should return serialized Document', () => { const buffer = document.toBuffer(); expect(buffer).to.be.instanceOf(Buffer); - expect(buffer.length).to.equal(624); + expect(buffer.length).to.equal(649); }); // TODO: remove or replace? diff --git a/packages/wasm-dpp/test/unit/document/DocumentFactory.spec.js b/packages/wasm-dpp/test/unit/document/DocumentFactory.spec.js index ce348958b00..fa74dfd88fa 100644 --- a/packages/wasm-dpp/test/unit/document/DocumentFactory.spec.js +++ b/packages/wasm-dpp/test/unit/document/DocumentFactory.spec.js @@ -233,7 +233,7 @@ describe('DocumentFactory', () => { try { factory.createStateTransition({ unknown: documents, - }); + }, {}); expect.fail('Error was not thrown'); } catch (e) { @@ -245,7 +245,7 @@ describe('DocumentFactory', () => { it('should throw and error if no documents were supplied', async () => { try { - factory.createStateTransition({}); + factory.createStateTransition({}, {}); expect.fail('Error was not thrown'); } catch (e) { expect(e).to.be.an.instanceOf(NoDocumentsSuppliedError); @@ -287,9 +287,15 @@ describe('DocumentFactory', () => { const [newDocument] = await getDocumentsFixture(dataContract); newDocument.setData({ lastName: 'Keck' }); + const identityId = newDocument.getOwnerId(); + const stateTransition = factory.createStateTransition({ create: documents, replace: [newDocument], + }, { + [identityId.toString()]: { + [dataContract.getId().toString()]: 1, + }, }); const replaceDocuments = stateTransition.getTransitions() diff --git a/packages/wasm-dpp/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsUniquenessByIndicesFactory.spec.js b/packages/wasm-dpp/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsUniquenessByIndicesFactory.spec.js index df48283ad06..3bd09da5bcd 100644 --- a/packages/wasm-dpp/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsUniquenessByIndicesFactory.spec.js +++ b/packages/wasm-dpp/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsUniquenessByIndicesFactory.spec.js @@ -201,7 +201,7 @@ describe.skip('validateDocumentsUniquenessByIndices', () => { await expectValidationError(result, DuplicateUniqueIndexError, 4); const errors = result.getErrors(); const [error] = result.getErrors(); - expect(error.getCode()).to.equal(4009); + expect(error.getCode()).to.equal(40105); expect(errors.map((e) => e.getDocumentId())).to.have.deep.members([ documentTransitionsJs[3].getId().toBuffer(), diff --git a/packages/wasm-dpp/test/unit/identity/Identity.spec.js b/packages/wasm-dpp/test/unit/identity/Identity.spec.js index eff3e1da06d..dbff88969bf 100644 --- a/packages/wasm-dpp/test/unit/identity/Identity.spec.js +++ b/packages/wasm-dpp/test/unit/identity/Identity.spec.js @@ -80,7 +80,7 @@ describe('Identity', () => { type: KeyType.ECDSA_SECP256K1, data: Buffer.alloc(36).fill('a'), purpose: KeyPurpose.AUTHENTICATION, - securityLevel: KeySecurityLevel.MASTER, + securityLevel: KeySecurityLevel.HIGH, readOnly: false, disabledAt: null, contractBounds: null, @@ -159,7 +159,7 @@ describe('Identity', () => { type: KeyType.ECDSA_SECP256K1, data: rawIdentity.publicKeys[0].data.toString('base64'), purpose: KeyPurpose.AUTHENTICATION, - securityLevel: KeySecurityLevel.MASTER, + securityLevel: KeySecurityLevel.HIGH, readOnly: false, disabledAt: null, contractBounds: null, diff --git a/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js b/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js index 240088e4412..25c23be0c91 100644 --- a/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js +++ b/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js @@ -1,6 +1,8 @@ const getInstantAssetLockProofFixture = require('../../../lib/test/fixtures/getInstantAssetLockProofFixture'); const getIdentityFixture = require('../../../lib/test/fixtures/getIdentityFixture'); const getChainAssetLockProofFixture = require('../../../lib/test/fixtures/getChainAssetLockProofFixture'); +const getIdentityCreditWithdrawalTransitionFixture = require('../../../lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture'); + const { Identity, IdentityFactory, InstantAssetLockProof, ChainAssetLockProof, IdentityUpdateTransition, @@ -234,6 +236,8 @@ describe('IdentityFactory', () => { const stateTransition = factory .createIdentityUpdateTransition( identity, + // eslint-disable-next-line + BigInt(1), { add: addPublicKeys, disable: disablePublicKeys, @@ -246,7 +250,26 @@ describe('IdentityFactory', () => { expect(stateTransition.getPublicKeysToAdd().map((k) => k.toObject())) .to.deep.equal(addPublicKeys.map((k) => k.toObject())); expect(stateTransition.getPublicKeyIdsToDisable()).to.deep.equal([0]); - expect(stateTransition.getPublicKeysDisabledAt()).to.deep.equal(new Date()); + }); + }); + + describe('createIdentityCreditWithdrawalTransition', () => { + it('should create IdentityCreditWithdrawalTransition', () => { + const stateTransitionFixture = getIdentityCreditWithdrawalTransitionFixture(); + const stateTransition = factory + .createIdentityCreditWithdrawalTransition( + stateTransitionFixture.getIdentityId(), + stateTransitionFixture.getAmount(), + stateTransitionFixture.getCoreFeePerByte(), + stateTransitionFixture.getPooling(), + stateTransitionFixture.getOutputScript(), + stateTransitionFixture.getNonce(), + ); + + expect(stateTransition.toObject()) + .to.deep.equal( + stateTransitionFixture.toObject(), + ); }); }); }); diff --git a/packages/wasm-dpp/test/unit/identity/IdentityPublicKey.spec.js b/packages/wasm-dpp/test/unit/identity/IdentityPublicKey.spec.js index bbf4496928d..f726c5869c8 100644 --- a/packages/wasm-dpp/test/unit/identity/IdentityPublicKey.spec.js +++ b/packages/wasm-dpp/test/unit/identity/IdentityPublicKey.spec.js @@ -12,7 +12,7 @@ describe('IdentityPublicKey', () => { type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, data: keyData, purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER, + securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, readOnly: false, contractBounds: null, }; @@ -194,7 +194,7 @@ describe('IdentityPublicKey', () => { type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, data: 'AkVuTKyF3YgKLAQlLEtaUL2HTditwGILfWUVqjzYnIgH', purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER, + securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, readOnly: false, disabledAt: now.getTime(), contractBounds: null, @@ -215,7 +215,7 @@ describe('IdentityPublicKey', () => { type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, data: Buffer.from('AkVuTKyF3YgKLAQlLEtaUL2HTditwGILfWUVqjzYnIgH', 'base64'), purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER, + securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, readOnly: false, disabledAt: now.getTime(), contractBounds: null, diff --git a/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityCreditWithdrawalTransition/IdentityCreditWithdrawalTransition.spec.js b/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityCreditWithdrawalTransition/IdentityCreditWithdrawalTransition.spec.js new file mode 100644 index 00000000000..b80c611116e --- /dev/null +++ b/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityCreditWithdrawalTransition/IdentityCreditWithdrawalTransition.spec.js @@ -0,0 +1,155 @@ +const getIdentityCreditWithdrawalTransitionFixture = require('../../../../../lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture'); + +const { + default: loadWasmDpp, + Identifier, StateTransitionTypes, +} = require('../../../../..'); + +describe('IdentityCreditWithdrawalTransition', () => { + let rawStateTransition; + let stateTransition; + + before(loadWasmDpp); + + beforeEach(async () => { + stateTransition = await getIdentityCreditWithdrawalTransitionFixture(); + rawStateTransition = stateTransition.toObject(); + }); + + describe('#getType', () => { + it('should return IDENTITY_CREDIT_WITHDRAWAL type', () => { + expect(stateTransition.getType()).to.equal(StateTransitionTypes.IdentityCreditWithdrawal); + }); + }); + + describe('#getIdentityId', () => { + it('should return identity id', () => { + expect(stateTransition.getIdentityId().toBuffer()).to.deep.equal( + rawStateTransition.identityId, + ); + }); + }); + + describe('#getAmount', () => { + it('should return amount', () => { + expect(stateTransition.getAmount()).to.be.equal( + rawStateTransition.amount, + ); + }); + }); + + describe('#getCoreFeePerByte', () => { + it('should return core fee per byte', () => { + expect(stateTransition.getCoreFeePerByte()).to.be.equal( + rawStateTransition.coreFeePerByte, + ); + }); + }); + + describe('#getPooling', () => { + it('should return pooling', () => { + expect(stateTransition.getPooling()).to.be.equal( + rawStateTransition.pooling, + ); + }); + }); + + describe('#getOutputScript', () => { + it('should return output script', () => { + expect(stateTransition.getOutputScript()).to.be.deep.equal( + rawStateTransition.outputScript, + ); + }); + }); + + describe('#getNonce', () => { + it('should return revision', () => { + expect(stateTransition.getNonce()).to.be.equal( + rawStateTransition.nonce, + ); + }); + }); + + describe('#toObject', () => { + it('should return raw state transition', () => { + rawStateTransition = stateTransition.toObject(); + + expect(rawStateTransition).to.deep.equal({ + $version: '0', + type: StateTransitionTypes.IdentityCreditWithdrawal, + identityId: stateTransition.getIdentityId().toBuffer(), + amount: stateTransition.getAmount(), + coreFeePerByte: stateTransition.getCoreFeePerByte(), + pooling: stateTransition.getPooling(), + outputScript: stateTransition.getOutputScript(), + nonce: stateTransition.getNonce(), + signature: undefined, + signaturePublicKeyId: undefined, + }); + }); + + it('should return raw state transition without signature', () => { + rawStateTransition = stateTransition.toObject({ skipSignature: true }); + + expect(rawStateTransition).to.deep.equal({ + $version: '0', + type: StateTransitionTypes.IdentityCreditWithdrawal, + identityId: stateTransition.getIdentityId().toBuffer(), + amount: stateTransition.getAmount(), + coreFeePerByte: stateTransition.getCoreFeePerByte(), + pooling: stateTransition.getPooling(), + outputScript: stateTransition.getOutputScript(), + nonce: stateTransition.getNonce(), + }); + }); + }); + + describe('#toJSON', () => { + it('should return JSON representation of state transition', () => { + const jsonStateTransition = stateTransition.toJSON(); + + expect(jsonStateTransition).to.deep.equal({ + $version: '0', + type: StateTransitionTypes.IdentityCreditWithdrawal, + identityId: stateTransition.getIdentityId().toString(), + amount: stateTransition.getAmount().toString(), + coreFeePerByte: stateTransition.getCoreFeePerByte(), + pooling: stateTransition.getPooling(), + outputScript: stateTransition.getOutputScript().toString('base64'), + nonce: stateTransition.getNonce().toString(), + signature: undefined, + signaturePublicKeyId: undefined, + }); + }); + }); + + describe('#getModifiedDataIds', () => { + it('should return ids of topped up identity', () => { + const result = stateTransition.getModifiedDataIds(); + + expect(result.length).to.be.equal(1); + const [identityId] = result; + + expect(identityId).to.be.an.instanceOf(Identifier); + expect(identityId.toBuffer()).to.be.deep.equal(rawStateTransition.identityId); + }); + }); + + describe('#isDataContractStateTransition', () => { + it('should return false', () => { + expect(stateTransition.isDataContractStateTransition()).to.be.false(); + }); + }); + + describe('#isDocumentStateTransition', () => { + it('should return false', () => { + expect(stateTransition.isDocumentStateTransition()).to.be.false(); + }); + }); + + describe('#isIdentityStateTransition', () => { + it('should return true', () => { + expect(stateTransition.isIdentityStateTransition()).to.be.true(); + }); + }); +}); diff --git a/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityUpdateTransition/IdentityUpdateTransition.spec.js b/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityUpdateTransition/IdentityUpdateTransition.spec.js index 1a65bba88a4..178ab4d865a 100644 --- a/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityUpdateTransition/IdentityUpdateTransition.spec.js +++ b/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityUpdateTransition/IdentityUpdateTransition.spec.js @@ -99,23 +99,6 @@ describe('IdentityUpdateTransition', () => { }); }); - describe('#getPublicKeysDisabledAt', () => { - it('should return time to disable public keys', () => { - expect(stateTransition.getPublicKeysDisabledAt()) - .to.deep.equal(rawStateTransition.publicKeysDisabledAt); - }); - }); - - describe('#setPublicKeysDisabledAt', () => { - it('should set time to disable public keys', () => { - const now = new Date(); - - stateTransition.setPublicKeysDisabledAt(now); - - expect(stateTransition.getPublicKeysDisabledAt()).to.deep.equal(new Date(now)); - }); - }); - describe('#toObject', () => { it('should return raw state transition', () => { rawStateTransition = stateTransition.toObject(); @@ -126,7 +109,6 @@ describe('IdentityUpdateTransition', () => { signature: undefined, identityId: rawStateTransition.identityId, revision: rawStateTransition.revision, - publicKeysDisabledAt: rawStateTransition.publicKeysDisabledAt, addPublicKeys: rawStateTransition.addPublicKeys, disablePublicKeys: rawStateTransition.disablePublicKeys, signaturePublicKeyId: 0, @@ -141,7 +123,6 @@ describe('IdentityUpdateTransition', () => { type: StateTransitionTypes.IdentityUpdate, identityId: rawStateTransition.identityId, revision: rawStateTransition.revision, - publicKeysDisabledAt: rawStateTransition.publicKeysDisabledAt, addPublicKeys: rawStateTransition.addPublicKeys, disablePublicKeys: rawStateTransition.disablePublicKeys, }); @@ -149,7 +130,6 @@ describe('IdentityUpdateTransition', () => { it('should return raw state transition without optional properties', () => { stateTransition.setPublicKeyIdsToDisable(undefined); - stateTransition.setPublicKeysDisabledAt(undefined); stateTransition.setPublicKeysToAdd(undefined); rawStateTransition = stateTransition.toObject(); @@ -175,7 +155,6 @@ describe('IdentityUpdateTransition', () => { signature: undefined, identityId: stateTransition.getIdentityId().toString(), revision: rawStateTransition.revision, - publicKeysDisabledAt: rawStateTransition.publicKeysDisabledAt.getTime(), addPublicKeys: stateTransition.getPublicKeysToAdd().map((k) => k.toJSON()), disablePublicKeys: rawStateTransition.disablePublicKeys, signaturePublicKeyId: 0, diff --git a/packages/withdrawals-contract/.eslintrc b/packages/withdrawals-contract/.eslintrc index eec7881491c..cb6c7636b60 100644 --- a/packages/withdrawals-contract/.eslintrc +++ b/packages/withdrawals-contract/.eslintrc @@ -1,15 +1,18 @@ { - "extends": "airbnb-base", - "rules": { - "no-plusplus": 0, - "eol-last": [ - "error", - "always" - ], - "class-methods-use-this": "off", - "curly": [ - "error", - "all" - ] - } -} \ No newline at end of file + "extends": "airbnb-base", + "rules": { + "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "class-methods-use-this": "off", + "curly": [ + "error", + "all" + ] + }, + "globals": { + "BigInt": true + } +} diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 21335cfa286..e96a28d9595 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,15 +1,18 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } platform-value = { path = "../rs-platform-value" } num_enum = "0.5.7" -serde = { version = "1.0.152", features = ["derive"] } +# serde is required, `cargo machete` false positive +serde = { version = "1.0.197", features = ["derive"] } serde_json = "1.0" serde_repr = "0.1.7" diff --git a/packages/withdrawals-contract/lib/systemIds.js b/packages/withdrawals-contract/lib/systemIds.js index 8406a2fe5aa..45849561322 100644 --- a/packages/withdrawals-contract/lib/systemIds.js +++ b/packages/withdrawals-contract/lib/systemIds.js @@ -1,4 +1,4 @@ module.exports = { - ownerId: 'CUjAw7eD64wmaznNrfC5sKdn4Lpr1wBvWKMjGLrmEs5h', + ownerId: '11111111111111111111111111111111', contractId: '4fJLR2GYTPFdomuTVvNy3VRrvWgvkKPzqehEBpNf2nk6', }; diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 0d4b1112835..f662eb30f87 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,7 +1,15 @@ { "name": "@dashevo/withdrawals-contract", - "version": "0.25.21", + "version": "1.1.0-dev.1", "description": "Data Contract to manipulate and track withdrawals", + "repository": { + "type": "git", + "url": "git+https://github.com/dashpay/platform.git" + }, + "bugs": { + "url": "https://github.com/dashpay/platform/issues" + }, + "homepage": "https://github.com/dashpay/platform/tree/v1.1-dev/packages/withdrawals-contract#readme", "scripts": { "build": "", "lint": "eslint .", diff --git a/packages/withdrawals-contract/schema/withdrawals-documents.json b/packages/withdrawals-contract/schema/v1/withdrawals-documents.json similarity index 83% rename from packages/withdrawals-contract/schema/withdrawals-documents.json rename to packages/withdrawals-contract/schema/v1/withdrawals-documents.json index b51b2a8360e..43ac22b78b7 100644 --- a/packages/withdrawals-contract/schema/withdrawals-documents.json +++ b/packages/withdrawals-contract/schema/v1/withdrawals-documents.json @@ -1,6 +1,7 @@ { "withdrawal": { - "description": "Withdrawal document to track underlying transaction", + "description": "Withdrawal document to track underlying withdrawal transactions. Withdrawals should be created with IdentityWithdrawalTransition", + "creationRestrictionMode": 2, "type": "object", "indices": [ { @@ -58,19 +59,17 @@ "status": "asc" }, { - "transactionId": "asc" + "transactionIndex": "asc" } ], "unique": false } ], "properties": { - "transactionId": { - "description": "Hash of asset unlock transaction. Populated with untied transaction hash on “pooled” stage and with signed transaction on “broadcasted” stage", - "type": "array", - "byteArray": true, - "minItems": 32, - "maxItems": 32, + "transactionIndex": { + "type": "integer", + "description": "Sequential index of asset unlock (withdrawal) transaction. Populated when a withdrawal pooled into withdrawal transaction", + "minimum": 1, "position": 0 }, "transactionSignHeight": { @@ -79,24 +78,18 @@ "minimum": 1, "position": 1 }, - "transactionIndex": { - "type": "integer", - "description": "Sequential index used to create withdrawal transaction", - "minimum": 1, - "position": 2 - }, "amount": { "type": "integer", "description": "The amount to be withdrawn", "minimum": 1000, - "position": 3 + "position": 2 }, "coreFeePerByte": { "type": "integer", "description": "This is the fee that you are willing to spend for this transaction in Duffs/Byte", "minimum": 1, "maximum": 4294967295, - "position": 4 + "position": 3 }, "pooling": { "type": "integer", @@ -106,14 +99,14 @@ 1, 2 ], - "position": 5 + "position": 4 }, "outputScript": { "type": "array", "byteArray": true, "minItems": 23, "maxItems": 25, - "position": 6 + "position": 5 }, "status": { "type": "integer", @@ -124,7 +117,8 @@ 3, 4 ], - "position": 7 + "description": "0 - Pending, 1 - Signed, 2 - Broadcasted, 3 - Complete, 4 - Expired", + "position": 6 } }, "additionalProperties": false, diff --git a/packages/withdrawals-contract/src/error.rs b/packages/withdrawals-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/withdrawals-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/withdrawals-contract/src/lib.rs b/packages/withdrawals-contract/src/lib.rs index f041acc820d..0eece0b61b8 100644 --- a/packages/withdrawals-contract/src/lib.rs +++ b/packages/withdrawals-contract/src/lib.rs @@ -1,28 +1,22 @@ +pub use crate::error::Error; use num_enum::{IntoPrimitive, TryFromPrimitive}; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::Error; +use platform_version::version::PlatformVersion; use serde_json::Value; use serde_repr::{Deserialize_repr, Serialize_repr}; -pub mod document_types { - pub mod withdrawal { - pub const NAME: &str = "withdrawal"; +mod error; +pub mod v1; - pub mod properties { - pub const TRANSACTION_ID: &str = "transactionId"; - pub const TRANSACTION_SIGN_HEIGHT: &str = "transactionSignHeight"; - pub const TRANSACTION_INDEX: &str = "transactionIndex"; - pub const AMOUNT: &str = "amount"; - pub const CORE_FEE_PER_BYTE: &str = "coreFeePerByte"; - pub const POOLING: &str = "pooling"; - pub const OUTPUT_SCRIPT: &str = "outputScript"; - pub const STATUS: &str = "status"; - pub const CREATED_AT: &str = "$createdAt"; - pub const UPDATED_AT: &str = "$updatedAt"; - pub const OWNER_ID: &str = "$ownerId"; - } - } -} +pub const ID_BYTES: [u8; 32] = [ + 54, 98, 187, 97, 225, 127, 174, 62, 162, 148, 207, 96, 49, 151, 251, 10, 171, 109, 81, 24, 11, + 216, 182, 16, 76, 73, 68, 166, 47, 226, 217, 127, +]; + +pub const OWNER_ID_BYTES: [u8; 32] = [0; 32]; + +pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); +pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); // @append_only #[repr(u8)] @@ -45,19 +39,23 @@ pub enum WithdrawalStatus { EXPIRED = 4, } -pub const ID_BYTES: [u8; 32] = [ - 54, 98, 187, 97, 225, 127, 174, 62, 162, 148, 207, 96, 49, 151, 251, 10, 171, 109, 81, 24, 11, - 216, 182, 16, 76, 73, 68, 166, 47, 226, 217, 127, -]; - -pub const OWNER_ID_BYTES: [u8; 32] = [ - 170, 138, 235, 213, 173, 122, 202, 36, 243, 48, 61, 185, 146, 50, 146, 255, 194, 133, 221, 176, - 188, 82, 144, 69, 234, 198, 106, 35, 245, 167, 46, 192, -]; - -pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); -pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); - -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!("../schema/withdrawals-documents.json")) +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.withdrawals { + 1 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "withdrawals_contract::load_definitions".to_string(), + known_versions: vec![1], + received: version, + }), + } +} +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.withdrawals { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "withdrawals_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/withdrawals-contract/src/v1/mod.rs b/packages/withdrawals-contract/src/v1/mod.rs new file mode 100644 index 00000000000..826ec9a40ff --- /dev/null +++ b/packages/withdrawals-contract/src/v1/mod.rs @@ -0,0 +1,26 @@ +use crate::error::Error; +use serde_json::Value; + +pub mod document_types { + pub mod withdrawal { + pub const NAME: &str = "withdrawal"; + + pub mod properties { + pub const TRANSACTION_SIGN_HEIGHT: &str = "transactionSignHeight"; + pub const TRANSACTION_INDEX: &str = "transactionIndex"; + pub const AMOUNT: &str = "amount"; + pub const CORE_FEE_PER_BYTE: &str = "coreFeePerByte"; + pub const POOLING: &str = "pooling"; + pub const OUTPUT_SCRIPT: &str = "outputScript"; + pub const STATUS: &str = "status"; + pub const CREATED_AT: &str = "$createdAt"; + pub const UPDATED_AT: &str = "$updatedAt"; + pub const OWNER_ID: &str = "$ownerId"; + } + } +} + +pub(super) fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!("../../schema/v1/withdrawals-documents.json")) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/withdrawals-contract/test/unit/withdrawalsContract.spec.js b/packages/withdrawals-contract/test/unit/withdrawalsContract.spec.js index 61c8c064516..bf891a74857 100644 --- a/packages/withdrawals-contract/test/unit/withdrawalsContract.spec.js +++ b/packages/withdrawals-contract/test/unit/withdrawalsContract.spec.js @@ -1,17 +1,26 @@ -const { DashPlatformProtocol, JsonSchemaError } = require('@dashevo/wasm-dpp'); +const { + DashPlatformProtocol, + JsonSchemaError, +} = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); const { expect } = require('chai'); const crypto = require('crypto'); -const withdrawalContractDocumentsSchema = require('../../schema/withdrawals-documents.json'); +const withdrawalContractDocumentsSchema = require('../../schema/v1/withdrawals-documents.json'); const expectJsonSchemaError = (validationResult, errorCount = 1) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(errorCount); + expect(errors) + .to + .have + .length(errorCount); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -28,12 +37,18 @@ describe('Withdrawals contract', () => { identityId = await generateRandomIdentifier(); - dataContract = dpp.dataContract.create(identityId, withdrawalContractDocumentsSchema); + dataContract = dpp.dataContract.create( + identityId, + BigInt(1), + withdrawalContractDocumentsSchema, + ); }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, withdrawalContractDocumentsSchema)) - .to.not.throw(); + expect(() => dpp.dataContract.create(identityId, BigInt(1), withdrawalContractDocumentsSchema)) + .to + .not + .throw(); }); describe('documents', () => { @@ -42,7 +57,6 @@ describe('Withdrawals contract', () => { beforeEach(() => { rawWithdrawalDocument = { - transactionId: Buffer.alloc(32, 1), transactionIndex: 42, amount: 1000, coreFeePerByte: 1, @@ -52,63 +66,6 @@ describe('Withdrawals contract', () => { }; }); - it('should have at least five properties', () => { - rawWithdrawalDocument = {}; - - const document = dpp.document.create(dataContract, identityId, 'withdrawal', rawWithdrawalDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult, 5); - - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('amount'); - }); - - it('should not have additional properties', async () => { - rawWithdrawalDocument.someOtherProperty = 42; - - const document = dpp.document.create(dataContract, identityId, 'withdrawal', rawWithdrawalDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); - }); - - describe('transactionId', () => { - it('should be byte array', () => { - rawWithdrawalDocument.transactionId = 1; - - const document = dpp.document.create(dataContract, identityId, 'withdrawal', rawWithdrawalDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('array'); - }); - - it('should be not less then 32 bytes long', () => { - rawWithdrawalDocument.transactionId = [0]; - - const document = dpp.document.create(dataContract, identityId, 'withdrawal', rawWithdrawalDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword).to.equal('minItems'); - expect(error.params.minItems).to.equal(32); - }); - - it('should be not more then 32 bytes long', () => { - rawWithdrawalDocument.transactionId = Buffer.alloc(33); - - const document = dpp.document.create(dataContract, identityId, 'withdrawal', rawWithdrawalDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword).to.equal('maxItems'); - expect(error.params.maxItems).to.equal(32); - }); - }); - describe('amount', () => { it('should be present', async () => { delete rawWithdrawalDocument.amount; @@ -117,8 +74,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('amount'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('amount'); }); it('should be integer', () => { @@ -128,8 +89,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1000', () => { @@ -139,8 +104,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1000); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1000); }); }); @@ -152,8 +121,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', () => { @@ -163,8 +136,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -176,8 +153,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', () => { @@ -187,8 +168,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -200,8 +185,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('coreFeePerByte'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('coreFeePerByte'); }); it('should be integer', () => { @@ -211,8 +200,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', () => { @@ -222,8 +215,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -235,8 +232,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('pooling'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('pooling'); }); it('should be integer', () => { @@ -246,8 +247,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be within enum range', () => { @@ -257,7 +262,9 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('enum'); + expect(error.keyword) + .to + .equal('enum'); }); }); @@ -269,8 +276,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('outputScript'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('outputScript'); }); it('should be byte array', () => { @@ -278,10 +289,14 @@ describe('Withdrawals contract', () => { const document = dpp.document.create(dataContract, identityId, 'withdrawal', rawWithdrawalDocument); const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); + const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('array'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('array'); }); it('should be not less then 23 bytes long', () => { @@ -291,8 +306,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.params.minItems).to.equal(23); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.params.minItems) + .to + .equal(23); }); it('should be not more then 25 bytes long', () => { @@ -302,8 +321,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.params.maxItems).to.equal(25); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.params.maxItems) + .to + .equal(25); }); }); @@ -315,8 +338,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('status'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('status'); }); it('should be integer', () => { @@ -326,8 +353,12 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be within enum range', () => { @@ -337,7 +368,9 @@ describe('Withdrawals contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('enum'); + expect(error.keyword) + .to + .equal('enum'); }); }); @@ -346,7 +379,10 @@ describe('Withdrawals contract', () => { const result = await withdrawal.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); }); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0b9461857bd..6ff0f74bf9f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] # Rust version the same as in /README.md -channel = "stable" +channel = "1.76" targets = ["wasm32-unknown-unknown"] diff --git a/scripts/configure_dotenv.sh b/scripts/configure_dotenv.sh index 2074b73ca3b..e0d9fb16b4a 100755 --- a/scripts/configure_dotenv.sh +++ b/scripts/configure_dotenv.sh @@ -8,11 +8,11 @@ PROJECT_ROOT_PATH=$(dirname "$SCRIPT_DIRECTORY_PATH") PACKAGES_PATH="$PROJECT_ROOT_PATH/packages" LOGS_PATH="$PROJECT_ROOT_PATH/logs" -CONFIG=local +CONFIG=local_seed DAPI_PATH="${PACKAGES_PATH}"/dapi DRIVE_PATH="${PACKAGES_PATH}"/rs-drive-abci SDK_PATH="${PACKAGES_PATH}"/js-dash-sdk -RS_SDK_PATH="${PACKAGES_PATH}"/rs-sdk +DASH_SDK_PATH="${PACKAGES_PATH}"/rs-sdk WALLET_LIB_PATH="${PACKAGES_PATH}"/wallet-lib # Get configuration option from dashmate config for 1st node @@ -23,7 +23,7 @@ WALLET_LIB_PATH="${PACKAGES_PATH}"/wallet-lib # get_config core.rpc.port function get_config() { # We use `jq` because it's much faster than `yarn dashmate config get` - jq ".configs.${CONFIG}_1.$1" <"${HOME}"/.dashmate/config.json + jq ".configs.${CONFIG}.$1" <"${HOME}"/.dashmate/config.json } touch "${LOGS_PATH}"/mint.log @@ -34,8 +34,6 @@ cp "${DAPI_PATH}"/.env.example "${DAPI_PATH}"/.env # JS-SDK: FAUCET_ADDRESS=$(grep -m 1 "Address:" "${LOGS_PATH}"/mint.log | awk '{printf $3}') FAUCET_PRIVATE_KEY=$(grep -m 1 "Private key:" "${LOGS_PATH}"/mint.log | awk '{printf $4}') -# TODO This will be removed from dashmate. Please use hardcoded ID from contract crates -DPNS_CONTRACT_ID=$(get_config platform.dpns.contract.id) SDK_ENV_FILE_PATH=${SDK_PATH}/.env rm -f "${SDK_ENV_FILE_PATH}" @@ -45,12 +43,11 @@ touch "${SDK_ENV_FILE_PATH}" echo "DAPI_SEED=127.0.0.1:2443:self-signed FAUCET_ADDRESS=${FAUCET_ADDRESS} FAUCET_PRIVATE_KEY=${FAUCET_PRIVATE_KEY} -DPNS_CONTRACT_ID=${DPNS_CONTRACT_ID} NETWORK=regtest" >>"${SDK_ENV_FILE_PATH}" #EOF # DRIVE: -cp "${DRIVE_PATH}"/.env.example "${DRIVE_PATH}"/.env +cp "${DRIVE_PATH}"/.env.local "${DRIVE_PATH}"/.env # WALLET-LIB: WALLET_LIB_ENV_FILE_PATH=${WALLET_LIB_PATH}/.env @@ -63,22 +60,22 @@ FAUCET_PRIVATE_KEY=${FAUCET_PRIVATE_KEY} NETWORK=regtest" >>"${WALLET_LIB_ENV_FILE_PATH}" #EOF -# RS_SDK tests config +# DASH_SDK tests config CORE_RPC_PORT=$(get_config core.rpc.port) -CORE_RPC_USER=$(get_config core.rpc.user) -CORE_RPC_PASSWORD=$(get_config core.rpc.password) -PLATFORM_RPC_PORT=$(get_config platform.dapi.envoy.http.port) +CORE_RPC_USER=dashmate +CORE_RPC_PASSWORD=$(get_config core.rpc.users.dashmate.password) +PLATFORM_RPC_PORT=$(get_config platform.gateway.listeners.dapiAndDrive.port) -cat <"${RS_SDK_PATH}"/tests/.env -# Configuration of rs-sdk network tests +cat <"${DASH_SDK_PATH}"/tests/.env +# Configuration of dash-sdk network tests # Generated by configure_dotenv.sh -RS_SDK_PLATFORM_HOST="127.0.0.1" -RS_SDK_PLATFORM_PORT="$PLATFORM_RPC_PORT" +DASH_SDK_PLATFORM_HOST="127.0.0.1" +DASH_SDK_PLATFORM_PORT="$PLATFORM_RPC_PORT" -RS_SDK_CORE_PORT="$CORE_RPC_PORT" -RS_SDK_CORE_USER="$CORE_RPC_USER" -RS_SDK_CORE_PASSWORD="$CORE_RPC_PASSWORD" +DASH_SDK_CORE_PORT="$CORE_RPC_PORT" +DASH_SDK_CORE_USER=$CORE_RPC_USER +DASH_SDK_CORE_PASSWORD=$CORE_RPC_PASSWORD EOF diff --git a/scripts/configure_test_suite.sh b/scripts/configure_test_suite.sh index 8c9d5040a00..057ae2816d0 100755 --- a/scripts/configure_test_suite.sh +++ b/scripts/configure_test_suite.sh @@ -14,10 +14,6 @@ CONFIG="local" SETUP_FILE_PATH=${PATH_TO_PROJECT_ROOT}/logs/setup.log -DPNS_OWNER_PRIVATE_KEY=$(grep -m 1 "DPNS Private Key:" ${SETUP_FILE_PATH} | awk '{$1="";printf $5}') -FEATURE_FLAGS_OWNER_PRIVATE_KEY=$(grep -m 1 "Feature Flags Private Key:" ${SETUP_FILE_PATH} | awk '{$1="";printf $6}') -DASHPAY_OWNER_PRIVATE_KEY=$(grep -m 1 "Dashpay Private Key:" ${SETUP_FILE_PATH} | awk '{$1="";printf $5}') -MASTERNODE_REWARD_SHARES_OWNER_PRIVATE_KEY=$(grep -m 1 "Masternode Reward Shares Private Key:" "${SETUP_FILE_PATH}" | awk '{$1="";printf $7}') MASTERNODE_OWNER_PRO_REG_TX_HASH=$(grep -m 1 "ProRegTx transaction ID:" "${SETUP_FILE_PATH}" | awk '{printf $5}') MASTERNODE_OWNER_MASTER_PRIVATE_KEY=$(grep -m 1 "Owner Private Key:" "${SETUP_FILE_PATH}" | awk '{printf $5}') @@ -42,12 +38,8 @@ if [ -z "$FAUCET_1_ADDRESS" ] || \ [ -z "$FAUCET_1_PRIVATE_KEY" ] || \ [ -z "$FAUCET_2_ADDRESS" ] || \ [ -z "$FAUCET_2_PRIVATE_KEY" ] || \ - [ -z "$DPNS_OWNER_PRIVATE_KEY" ] || \ - [ -z "$FEATURE_FLAGS_OWNER_PRIVATE_KEY" ] || \ - [ -z "$DASHPAY_OWNER_PRIVATE_KEY" ] || \ [ -z "$MASTERNODE_OWNER_PRO_REG_TX_HASH" ] || \ - [ -z "$MASTERNODE_OWNER_MASTER_PRIVATE_KEY" ] || \ - [ -z "$MASTERNODE_REWARD_SHARES_OWNER_PRIVATE_KEY" ] + [ -z "$MASTERNODE_OWNER_MASTER_PRIVATE_KEY" ] then echo "Internal error. Some of the env variables are empty. Please check logs above." exit 1 @@ -65,9 +57,6 @@ FAUCET_2_ADDRESS=${FAUCET_2_ADDRESS} FAUCET_2_PRIVATE_KEY=${FAUCET_2_PRIVATE_KEY} FAUCET_WALLET_USE_STORAGE=${FAUCET_WALLET_USE_STORAGE} FAUCET_WALLET_STORAGE_DIR="${PATH_TO_PROJECT_ROOT}/db" -DPNS_OWNER_PRIVATE_KEY=${DPNS_OWNER_PRIVATE_KEY} -FEATURE_FLAGS_OWNER_PRIVATE_KEY=${FEATURE_FLAGS_OWNER_PRIVATE_KEY} -DASHPAY_OWNER_PRIVATE_KEY=${DASHPAY_OWNER_PRIVATE_KEY} MASTERNODE_OWNER_PRO_REG_TX_HASH=${MASTERNODE_OWNER_PRO_REG_TX_HASH} MASTERNODE_OWNER_MASTER_PRIVATE_KEY=${MASTERNODE_OWNER_MASTER_PRIVATE_KEY} NETWORK=regtest diff --git a/scripts/configure_test_suite_network.sh b/scripts/configure_test_suite_network.sh index 91d712368a7..54e6f99349a 100755 --- a/scripts/configure_test_suite_network.sh +++ b/scripts/configure_test_suite_network.sh @@ -49,9 +49,6 @@ echo "Running against node ${DAPI_SEED}" FAUCET_ADDRESS=$(yq .faucet_address "$CONFIG") FAUCET_PRIVATE_KEY=$(yq .faucet_privkey "$CONFIG") -DPNS_OWNER_PRIVATE_KEY=$(yq .dpns_hd_private_key "$CONFIG") -DASHPAY_OWNER_PRIVATE_KEY=$(yq .dashpay_hd_private_key "$CONFIG") -FEATURE_FLAGS_OWNER_PRIVATE_KEY=$(yq .feature_flags_hd_private_key "$CONFIG") MASTERNODE_NAME=$(grep "$DAPI_SEED" "$INVENTORY" | awk '{print $1;}') @@ -73,10 +70,7 @@ SKIP_SYNC_BEFORE_HEIGHT=$(curl -s $INSIGHT_URL | jq '.height - 200') # check variables are not empty if [ -z "$FAUCET_ADDRESS" ] || \ - [ -z "$FAUCET_PRIVATE_KEY" ] || \ - [ -z "$DPNS_OWNER_PRIVATE_KEY" ] || \ - [ -z "$FEATURE_FLAGS_OWNER_PRIVATE_KEY" ] || \ - [ -z "$DASHPAY_OWNER_PRIVATE_KEY" ] || \ + [ -z "$MASTERNODE_OWNER_PRO_REG_TX_HASH" ] || \ [ -z "$MASTERNODE_OWNER_MASTER_PRIVATE_KEY" ] || \ [ -z "$NETWORK" ] || \ [ -z "$SKIP_SYNC_BEFORE_HEIGHT" ] @@ -90,9 +84,6 @@ FAUCET_1_ADDRESS=${FAUCET_ADDRESS} FAUCET_1_PRIVATE_KEY=${FAUCET_PRIVATE_KEY} FAUCET_2_ADDRESS=${FAUCET_ADDRESS} FAUCET_2_PRIVATE_KEY=${FAUCET_PRIVATE_KEY} -DPNS_OWNER_PRIVATE_KEY=${DPNS_OWNER_PRIVATE_KEY} -FEATURE_FLAGS_OWNER_PRIVATE_KEY=${FEATURE_FLAGS_OWNER_PRIVATE_KEY} -DASHPAY_OWNER_PRIVATE_KEY=${DASHPAY_OWNER_PRIVATE_KEY} MASTERNODE_OWNER_PRO_REG_TX_HASH=${MASTERNODE_OWNER_PRO_REG_TX_HASH} MASTERNODE_OWNER_MASTER_PRIVATE_KEY=${MASTERNODE_OWNER_MASTER_PRIVATE_KEY} NETWORK=${NETWORK} diff --git a/scripts/setup_local_network.sh b/scripts/setup_local_network.sh index 298d0ec965d..543262b3ab2 100755 --- a/scripts/setup_local_network.sh +++ b/scripts/setup_local_network.sh @@ -2,7 +2,7 @@ set -e -MINING_INTERVAL_IN_SECONDS=30 +MINING_INTERVAL_IN_SECONDS=60 MASTERNODES_COUNT=3 FULL_PATH=$(realpath $0) diff --git a/yarn.lock b/yarn.lock index 5da1b042488..b17e25241ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -80,16 +80,7 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/code-frame@npm:7.16.7" - dependencies: - "@babel/highlight": "npm:^7.16.7" - checksum: db2f7faa31bc2c9cf63197b481b30ea57147a5fc1a6fab60e5d6c02cdfbf6de8e17b5121f99917b3dabb5eeb572da078312e70697415940383efc140d4e0808b - languageName: node - linkType: hard - -"@babel/code-frame@npm:^7.22.13": +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.22.13": version: 7.22.13 resolution: "@babel/code-frame@npm:7.22.13" dependencies: @@ -143,17 +134,6 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.17.3": - version: 7.17.3 - resolution: "@babel/generator@npm:7.17.3" - dependencies: - "@babel/types": "npm:^7.17.0" - jsesc: "npm:^2.5.1" - source-map: "npm:^0.5.0" - checksum: 9a102a87b4e477aace1febc89a3692faf09c442015f24c3dffc1f54691498a73bd97a9eda9120be5626ede62728e15f7942ce841ff96c5b464703c701a7ab82a - languageName: node - linkType: hard - "@babel/generator@npm:^7.23.3": version: 7.23.3 resolution: "@babel/generator@npm:7.23.3" @@ -244,15 +224,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-environment-visitor@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/helper-environment-visitor@npm:7.16.7" - dependencies: - "@babel/types": "npm:^7.16.7" - checksum: c03a10105d9ebd1fe632a77356b2e6e2f3c44edba9a93b0dc3591b6a66bd7a2e323dd9502f9ce96fc6401234abff1907aa877b6674f7826b61c953f7c8204bbe - languageName: node - linkType: hard - "@babel/helper-environment-visitor@npm:^7.22.20, @babel/helper-environment-visitor@npm:^7.22.5": version: 7.22.20 resolution: "@babel/helper-environment-visitor@npm:7.22.20" @@ -260,17 +231,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-function-name@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/helper-function-name@npm:7.16.7" - dependencies: - "@babel/helper-get-function-arity": "npm:^7.16.7" - "@babel/template": "npm:^7.16.7" - "@babel/types": "npm:^7.16.7" - checksum: 12e2678236f4c708ab0a4235f0e3559906c1461b3644c6a0d1993652193c1c272c4bd4627a8d550b088f24d1df2f4683dee7ba15c1c643061cc5e768fafa78fa - languageName: node - linkType: hard - "@babel/helper-function-name@npm:^7.22.5, @babel/helper-function-name@npm:^7.23.0": version: 7.23.0 resolution: "@babel/helper-function-name@npm:7.23.0" @@ -281,24 +241,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-get-function-arity@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/helper-get-function-arity@npm:7.16.7" - dependencies: - "@babel/types": "npm:^7.16.7" - checksum: 25d969fb207ff2ad5f57a90d118f6c42d56a0171022e200aaa919ba7dc95ae7f92ec71cdea6c63ef3629a0dc962ab4c78e09ca2b437185ab44539193f796e0c3 - languageName: node - linkType: hard - -"@babel/helper-hoist-variables@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/helper-hoist-variables@npm:7.16.7" - dependencies: - "@babel/types": "npm:^7.16.7" - checksum: 6ae1641f4a751cd9045346e3f61c3d9ec1312fd779ab6d6fecfe2a96e59a481ad5d7e40d2a840894c13b3fd6114345b157f9e3062fc5f1580f284636e722de60 - languageName: node - linkType: hard - "@babel/helper-hoist-variables@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-hoist-variables@npm:7.22.5" @@ -350,14 +292,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": - version: 7.14.5 - resolution: "@babel/helper-plugin-utils@npm:7.14.5" - checksum: fe20e90a24d02770a60ebe80ab9f0dfd7258503cea8006c71709ac9af1aa3e47b0de569499673f11ea6c99597f8c0e4880ae1d505986e61101b69716820972fe - languageName: node - linkType: hard - -"@babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.22.5": +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": version: 7.22.5 resolution: "@babel/helper-plugin-utils@npm:7.22.5" checksum: ab220db218089a2aadd0582f5833fd17fa300245999f5f8784b10f5a75267c4e808592284a29438a0da365e702f05acb369f99e1c915c02f9f9210ec60eab8ea @@ -408,15 +343,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-split-export-declaration@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/helper-split-export-declaration@npm:7.16.7" - dependencies: - "@babel/types": "npm:^7.16.7" - checksum: e10aaf135465c55114627951b79115f24bc7af72ecbb58d541d66daf1edaee5dde7cae3ec8c3639afaf74526c03ae3ce723444e3b5b3dc77140c456cd84bcaa1 - languageName: node - linkType: hard - "@babel/helper-split-export-declaration@npm:^7.22.6": version: 7.22.6 resolution: "@babel/helper-split-export-declaration@npm:7.22.6" @@ -433,13 +359,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/helper-validator-identifier@npm:7.16.7" - checksum: 42b9b56c3543ded08992e8c118cb017dbde258895bd6a2e69186cb98f4f5811cd94ceedf4b5ace4877e7be07a7280aa9b9de65d1cb416064a1e0e1fd5a89fcca - languageName: node - linkType: hard - "@babel/helper-validator-identifier@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-validator-identifier@npm:7.22.20" @@ -476,17 +395,6 @@ __metadata: languageName: node linkType: hard -"@babel/highlight@npm:^7.16.7": - version: 7.16.10 - resolution: "@babel/highlight@npm:7.16.10" - dependencies: - "@babel/helper-validator-identifier": "npm:^7.16.7" - chalk: "npm:^2.0.0" - js-tokens: "npm:^4.0.0" - checksum: 1f1bdd752a90844f4efc22166a46303fb651ba0fd75a06daba3ebae2575ab3edc1da9827c279872a3aaf305f50a18473c5fa1966752726a2b253065fd4c0745e - languageName: node - linkType: hard - "@babel/highlight@npm:^7.22.13": version: 7.22.20 resolution: "@babel/highlight@npm:7.22.20" @@ -498,16 +406,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.16.7, @babel/parser@npm:^7.17.3, @babel/parser@npm:^7.7.0": - version: 7.17.3 - resolution: "@babel/parser@npm:7.17.3" - bin: - parser: ./bin/babel-parser.js - checksum: 2d45750cdf0565842a1210928534f73dacfbfd3c45be6e85961e34e8c7d74643721f802d331fad3bfdcc783fb5ab8703432e43c9e7b460588ec6ee26242793be - languageName: node - linkType: hard - -"@babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.3": +"@babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.3, @babel/parser@npm:^7.7.0": version: 7.23.3 resolution: "@babel/parser@npm:7.23.3" bin: @@ -1459,17 +1358,6 @@ __metadata: languageName: node linkType: hard -"@babel/template@npm:^7.16.7": - version: 7.16.7 - resolution: "@babel/template@npm:7.16.7" - dependencies: - "@babel/code-frame": "npm:^7.16.7" - "@babel/parser": "npm:^7.16.7" - "@babel/types": "npm:^7.16.7" - checksum: f35836a8cd53663508bc5e0b13e7fe3d646197fc1baa74c21d3a713c0c91d39fe6f6c5be8ec1ec139b3d0a00443ab1b8cc7ddf88c6ceb6f9fcf7ea0ae7594eca - languageName: node - linkType: hard - "@babel/template@npm:^7.22.15": version: 7.22.15 resolution: "@babel/template@npm:7.22.15" @@ -1481,7 +1369,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.23.3": +"@babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.23.3, @babel/traverse@npm:^7.7.0": version: 7.23.3 resolution: "@babel/traverse@npm:7.23.3" dependencies: @@ -1499,35 +1387,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.7.0": - version: 7.17.3 - resolution: "@babel/traverse@npm:7.17.3" - dependencies: - "@babel/code-frame": "npm:^7.16.7" - "@babel/generator": "npm:^7.17.3" - "@babel/helper-environment-visitor": "npm:^7.16.7" - "@babel/helper-function-name": "npm:^7.16.7" - "@babel/helper-hoist-variables": "npm:^7.16.7" - "@babel/helper-split-export-declaration": "npm:^7.16.7" - "@babel/parser": "npm:^7.17.3" - "@babel/types": "npm:^7.17.0" - debug: "npm:^4.1.0" - globals: "npm:^11.1.0" - checksum: 03aed531e0baf999ef96deda702f48479d638cb1b172844953221c2244b9c2112f40706b42205e1b12bca06d14afe107ce388a9b9042ebbacd6a64e0e20ab37d - languageName: node - linkType: hard - -"@babel/types@npm:^7.16.7, @babel/types@npm:^7.17.0, @babel/types@npm:^7.4.4, @babel/types@npm:^7.7.0, @babel/types@npm:^7.8.3": - version: 7.17.0 - resolution: "@babel/types@npm:7.17.0" - dependencies: - "@babel/helper-validator-identifier": "npm:^7.16.7" - to-fast-properties: "npm:^2.0.0" - checksum: 535ccef360d0c74e2bb685050f3a45e6ab30f66c740bbdd0858148ed502043f1ae2006a9d0269ac3b7356b690091ae313efd912e408bc0198d80a14b2a6f1537 - languageName: node - linkType: hard - -"@babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3": +"@babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.7.0, @babel/types@npm:^7.8.3": version: 7.23.3 resolution: "@babel/types@npm:7.23.3" dependencies: @@ -1552,22 +1412,6 @@ __metadata: languageName: node linkType: hard -"@cspotcode/source-map-consumer@npm:0.8.0": - version: 0.8.0 - resolution: "@cspotcode/source-map-consumer@npm:0.8.0" - checksum: dfe1399712e4d54e1d53b0c7782f929647ff8675c37ae7637ce2ffdbcc8bad06fea969bcbec6147e7ea70a89257cfc86695a3702c1946a1c334454480937b966 - languageName: node - linkType: hard - -"@cspotcode/source-map-support@npm:0.7.0": - version: 0.7.0 - resolution: "@cspotcode/source-map-support@npm:0.7.0" - dependencies: - "@cspotcode/source-map-consumer": "npm:0.8.0" - checksum: d58b31640c4b1438c0caf8ed7eb46647674c042a625919660d9fb2d76f3621875520082934bae88ef54a75d53e8f9cafb506160bb02403a19e7155aa5f4ac59b - languageName: node - linkType: hard - "@cspotcode/source-map-support@npm:^0.8.0": version: 0.8.1 resolution: "@cspotcode/source-map-support@npm:0.8.1" @@ -1592,7 +1436,7 @@ __metadata: version: 0.0.0-use.local resolution: "@dashevo/bench-suite@workspace:packages/bench-suite" dependencies: - "@dashevo/dashcore-lib": "npm:~0.21.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" "@dashevo/dpns-contract": "workspace:*" "@dashevo/wallet-lib": "workspace:*" "@dashevo/wasm-dpp": "workspace:*" @@ -1625,7 +1469,7 @@ __metadata: "@babel/core": "npm:^7.23.3" "@dashevo/dapi-grpc": "workspace:*" "@dashevo/dash-spv": "workspace:*" - "@dashevo/dashcore-lib": "npm:~0.21.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" "@dashevo/grpc-common": "workspace:*" "@dashevo/wasm-dpp": "workspace:*" assert-browserify: "npm:^2.0.0" @@ -1646,7 +1490,7 @@ __metadata: eslint-plugin-jsdoc: "npm:^46.9.0" events: "npm:^3.3.0" google-protobuf: "npm:^3.12.2" - karma: "npm:^6.4.1" + karma: "npm:^6.4.3" karma-chai: "npm:^0.1.0" karma-chrome-launcher: "npm:^3.1.0" karma-firefox-launcher: "npm:^2.1.2" @@ -1702,11 +1546,13 @@ __metadata: version: 0.0.0-use.local resolution: "@dashevo/dapi@workspace:packages/dapi" dependencies: + "@babel/core": "npm:^7.23.3" + "@babel/eslint-parser": "npm:^7.23.3" "@dashevo/bls": "npm:~1.2.9" "@dashevo/dapi-client": "workspace:*" "@dashevo/dapi-grpc": "workspace:*" - "@dashevo/dashcore-lib": "npm:~0.21.0" - "@dashevo/dashd-rpc": "npm:^18.2.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" + "@dashevo/dashd-rpc": "npm:^19.0.0" "@dashevo/dp-services-ctl": "github:dashevo/js-dp-services-ctl#v0.19-dev" "@dashevo/grpc-common": "workspace:*" "@dashevo/wasm-dpp": "workspace:*" @@ -1737,7 +1583,7 @@ __metadata: sinon: "npm:^17.0.1" sinon-chai: "npm:^3.7.0" swagger-jsdoc: "npm:^3.5.0" - ws: "npm:^7.5.3" + ws: "npm:^8.17.1" languageName: unknown linkType: soft @@ -1754,7 +1600,7 @@ __metadata: dependencies: "@dashevo/dark-gravity-wave": "npm:^1.1.1" "@dashevo/dash-util": "npm:^2.0.3" - "@dashevo/dashcore-lib": "npm:~0.21.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" chai: "npm:^4.3.10" eslint: "npm:^8.53.0" eslint-config-airbnb-base: "npm:^15.0.0" @@ -1778,9 +1624,9 @@ __metadata: languageName: node linkType: hard -"@dashevo/dashcore-lib@npm:~0.21.0": - version: 0.21.0 - resolution: "@dashevo/dashcore-lib@npm:0.21.0" +"@dashevo/dashcore-lib@npm:~0.21.3": + version: 0.21.3 + resolution: "@dashevo/dashcore-lib@npm:0.21.3" dependencies: "@dashevo/bls": "npm:~1.2.9" "@dashevo/x11-hash-js": "npm:^1.0.2" @@ -1794,17 +1640,17 @@ __metadata: ripemd160: "npm:^2.0.2" tsd: "npm:^0.28.1" unorm: "npm:^1.6.0" - checksum: fb4419623f0e98e9c32e8f567ad1eb7f8f68c9e89c1f0216362771bf08cbf5e7115ea3c6eea722f6992d4460de7c6c5b1abca5c1c1790a8f5a1987baef78cbbb + checksum: 28e2731ac66c34a7b5e160d270b810456dce3a3e1b5227649845aca510f38f441574d154ed8f0a79b26724124f311a87c8f57d53bfb5fd816223e571484fcc2a languageName: node linkType: hard -"@dashevo/dashd-rpc@npm:^18.2.0": - version: 18.2.0 - resolution: "@dashevo/dashd-rpc@npm:18.2.0" +"@dashevo/dashd-rpc@npm:^19.0.0": + version: 19.0.0 + resolution: "@dashevo/dashd-rpc@npm:19.0.0" dependencies: async: "npm:^3.2.4" bluebird: "npm:^3.7.2" - checksum: 38341b8d5a82f75f6d71cb691d7f908dee7dc619fc1f468d859b373805249622972c04233928310325937867e4ac133c687a3094a521e9f5291134b8cde86e50 + checksum: 2eab84af3e9e654601b6bdf02b670352e4a6aec5ee0cdb3b4d0fd81655ff9b4792dbec0fd02cdc72dc54b1867103f53e17264cf5b966a4c51f2d691088d783d1 languageName: node linkType: hard @@ -1934,13 +1780,14 @@ __metadata: resolution: "@dashevo/platform-test-suite@workspace:packages/platform-test-suite" dependencies: "@dashevo/dapi-client": "workspace:*" - "@dashevo/dashcore-lib": "npm:~0.21.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" "@dashevo/dpns-contract": "workspace:*" "@dashevo/feature-flags-contract": "workspace:*" "@dashevo/grpc-common": "workspace:*" "@dashevo/masternode-reward-shares-contract": "workspace:*" "@dashevo/wallet-lib": "workspace:*" "@dashevo/wasm-dpp": "workspace:*" + "@dashevo/withdrawals-contract": "workspace:*" assert: "npm:^2.0.0" assert-browserify: "npm:^2.0.0" browserify-zlib: "npm:^0.2.0" @@ -1959,7 +1806,7 @@ __metadata: glob: "npm:^10.3.4" https-browserify: "npm:^1.0.0" js-merkle: "npm:^0.1.5" - karma: "npm:^6.4.1" + karma: "npm:^6.4.3" karma-chai: "npm:^0.1.0" karma-chrome-launcher: "npm:^3.1.0" karma-firefox-launcher: "npm:^2.1.2" @@ -1975,6 +1822,7 @@ __metadata: path-browserify: "npm:^1.0.1" process: "npm:^0.11.10" semver: "npm:^7.5.3" + setimmediate: "npm:^1.0.5" sinon: "npm:^17.0.1" sinon-chai: "npm:^3.7.0" stream-browserify: "npm:^3.0.0" @@ -1985,7 +1833,7 @@ __metadata: utf-8-validate: "npm:^5.0.9" util: "npm:^0.12.4" webpack: "npm:^5.76.1" - ws: "npm:^7.5.3" + ws: "npm:^8.17.1" bin: test: bin/test.sh languageName: unknown @@ -2036,7 +1884,7 @@ __metadata: dependencies: "@dashevo/dapi-client": "workspace:*" "@dashevo/dash-spv": "workspace:*" - "@dashevo/dashcore-lib": "npm:~0.21.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" "@dashevo/grpc-common": "workspace:*" "@dashevo/wasm-dpp": "workspace:*" "@yarnpkg/pnpify": "npm:^4.0.0-rc.42" @@ -2055,7 +1903,7 @@ __metadata: eslint-plugin-import: "npm:^2.29.0" events: "npm:^3.3.0" https-browserify: "npm:^1.0.0" - karma: "npm:^6.4.1" + karma: "npm:^6.4.3" karma-chai: "npm:^0.1.0" karma-chrome-launcher: "npm:^3.1.0" karma-firefox-launcher: "npm:^2.1.2" @@ -2096,7 +1944,7 @@ __metadata: "@babel/core": "npm:^7.23.3" "@babel/preset-env": "npm:^7.23.3" "@dashevo/bls": "npm:~1.2.9" - "@dashevo/dashcore-lib": "npm:~0.21.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" "@dashevo/dpns-contract": "workspace:*" "@types/bs58": "npm:^4.0.1" "@types/node": "npm:^14.6.0" @@ -2118,7 +1966,7 @@ __metadata: fast-json-patch: "npm:^3.1.1" https-browserify: "npm:^1.0.0" json-schema-diff-validator: "npm:^0.4.1" - karma: "npm:^6.4.1" + karma: "npm:^6.4.3" karma-chai: "npm:^0.1.0" karma-chrome-launcher: "npm:^3.1.0" karma-firefox-launcher: "npm:^2.1.2" @@ -2187,18 +2035,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0": - version: 4.2.0 - resolution: "@eslint-community/eslint-utils@npm:4.2.0" - dependencies: - eslint-visitor-keys: "npm:^3.3.0" - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - checksum: ef8b20b0c70b06c3396663d485a96b6c1f52c48d40dec07c6369f90d79a6feeb1bc8230cb7fd672dd03486c4f224c1f6d8ba35844cd1168f537c559d0a72903d - languageName: node - linkType: hard - -"@eslint-community/eslint-utils@npm:^4.4.0": +"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" dependencies: @@ -2209,14 +2046,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.4.0": - version: 4.4.0 - resolution: "@eslint-community/regexpp@npm:4.4.0" - checksum: 3d9b740479088dc12e1d7f03f45dbb792dcbc7deb17432b0e1eae1a99eb0adbe4e60df8b0519a03bc35f56562b1ad0a09c004e14fbd1ee8bc2759702c9239643 - languageName: node - linkType: hard - -"@eslint-community/regexpp@npm:^4.6.1": +"@eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.6.1": version: 4.10.0 resolution: "@eslint-community/regexpp@npm:4.10.0" checksum: 8c36169c815fc5d726078e8c71a5b592957ee60d08c6470f9ce0187c8046af1a00afbda0a065cc40ff18d5d83f82aed9793c6818f7304a74a7488dc9f3ecbd42 @@ -2382,18 +2212,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/gen-mapping@npm:^0.3.0": - version: 0.3.2 - resolution: "@jridgewell/gen-mapping@npm:0.3.2" - dependencies: - "@jridgewell/set-array": "npm:^1.0.1" - "@jridgewell/sourcemap-codec": "npm:^1.4.10" - "@jridgewell/trace-mapping": "npm:^0.3.9" - checksum: 7ba0070be1aeda7d7694b09d847c3b95879409b26559b9d7e97a88ec94b838fb380df43ae328ee2d2df4d79e75d7afe6ba315199d18d79aa20839ebdfb739420 - languageName: node - linkType: hard - -"@jridgewell/gen-mapping@npm:^0.3.2": +"@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.2": version: 0.3.3 resolution: "@jridgewell/gen-mapping@npm:0.3.3" dependencies: @@ -2404,20 +2223,13 @@ __metadata: languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:3.1.0": +"@jridgewell/resolve-uri@npm:3.1.0, @jridgewell/resolve-uri@npm:^3.0.3": version: 3.1.0 resolution: "@jridgewell/resolve-uri@npm:3.1.0" checksum: 320ceb37af56953757b28e5b90c34556157676d41e3d0a3ff88769274d62373582bb0f0276a4f2d29c3f4fdd55b82b8be5731f52d391ad2ecae9b321ee1c742d languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:^3.0.3": - version: 3.0.8 - resolution: "@jridgewell/resolve-uri@npm:3.0.8" - checksum: ba6bb26baed68bb3fdcbbcbb754587ad6256e424343b1959c58962354ee8513f9dd6fbf8243f7382b01e9e1cba4d713a0389ad2ac545fafe31dbbc2cf5b0181f - languageName: node - linkType: hard - "@jridgewell/set-array@npm:^1.0.1": version: 1.1.2 resolution: "@jridgewell/set-array@npm:1.1.2" @@ -2452,7 +2264,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.17": +"@jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.7, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.18 resolution: "@jridgewell/trace-mapping@npm:0.3.18" dependencies: @@ -2462,16 +2274,6 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.7, @jridgewell/trace-mapping@npm:^0.3.9": - version: 0.3.15 - resolution: "@jridgewell/trace-mapping@npm:0.3.15" - dependencies: - "@jridgewell/resolve-uri": "npm:^3.0.3" - "@jridgewell/sourcemap-codec": "npm:^1.4.10" - checksum: c889039e050a1f3b679e5ecbb1719e2ecbef0d4b3385085af4a0402d51ecaba47b5d2afc6ecd8915c324423be0741b235fdbc5be7c6c28e6019e984d17258a18 - languageName: node - linkType: hard - "@jsdevtools/ono@npm:^7.1.0": version: 7.1.3 resolution: "@jsdevtools/ono@npm:7.1.3" @@ -2792,7 +2594,7 @@ __metadata: languageName: node linkType: hard -"@oclif/core@npm:^3.0.4, @oclif/core@npm:^3.10.8, @oclif/core@npm:^3.3.1, @oclif/core@npm:^3.9.1": +"@oclif/core@npm:^3.0.4, @oclif/core@npm:^3.3.1, @oclif/core@npm:^3.9.1": version: 3.10.8 resolution: "@oclif/core@npm:3.10.8" dependencies: @@ -2826,6 +2628,42 @@ __metadata: languageName: node linkType: hard +"@oclif/core@npm:^3.10.8": + version: 3.26.5 + resolution: "@oclif/core@npm:3.26.5" + dependencies: + "@types/cli-progress": "npm:^3.11.5" + ansi-escapes: "npm:^4.3.2" + ansi-styles: "npm:^4.3.0" + cardinal: "npm:^2.1.1" + chalk: "npm:^4.1.2" + clean-stack: "npm:^3.0.1" + cli-progress: "npm:^3.12.0" + color: "npm:^4.2.3" + debug: "npm:^4.3.4" + ejs: "npm:^3.1.10" + get-package-type: "npm:^0.1.0" + globby: "npm:^11.1.0" + hyperlinker: "npm:^1.0.0" + indent-string: "npm:^4.0.0" + is-wsl: "npm:^2.2.0" + js-yaml: "npm:^3.14.1" + minimatch: "npm:^9.0.4" + natural-orderby: "npm:^2.0.3" + object-treeify: "npm:^1.1.33" + password-prompt: "npm:^1.1.3" + slice-ansi: "npm:^4.0.0" + string-width: "npm:^4.2.3" + strip-ansi: "npm:^6.0.1" + supports-color: "npm:^8.1.1" + supports-hyperlinks: "npm:^2.2.0" + widest-line: "npm:^3.1.0" + wordwrap: "npm:^1.0.0" + wrap-ansi: "npm:^7.0.0" + checksum: 4e2aa1a9453d15e6bbb1b321b4b0e556ab36b02bd65d80632722e497e25baf661547993bf410a41e4a129518e66771a8608b18c9a16601be2be516eb5397f5e6 + languageName: node + linkType: hard + "@oclif/plugin-help@npm:^5.2.14": version: 5.2.20 resolution: "@oclif/plugin-help@npm:5.2.20" @@ -3353,7 +3191,7 @@ __metadata: languageName: node linkType: hard -"@types/cli-progress@npm:^3.11.0": +"@types/cli-progress@npm:^3.11.0, @types/cli-progress@npm:^3.11.5": version: 3.11.5 resolution: "@types/cli-progress@npm:3.11.5" dependencies: @@ -3453,14 +3291,7 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": - version: 7.0.11 - resolution: "@types/json-schema@npm:7.0.11" - checksum: e50864a93f4dcb9de64c0c605d836f5416341c824d7a8cde1aa15a5fc68bed44b33cdcb2e04e5098339e9121848378f2d0cc5b124dec41c89203c6f67d6f344a - languageName: node - linkType: hard - -"@types/json-schema@npm:^7.0.12": +"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" checksum: 1a3c3e06236e4c4aab89499c428d585527ce50c24fe8259e8b3926d3df4cfbbbcf306cfc73ddfb66cbafc973116efd15967020b0f738f63e09e64c7d260519e7 @@ -3504,10 +3335,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:>=10.0.0, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0": - version: 17.0.21 - resolution: "@types/node@npm:17.0.21" - checksum: 2beae12b0240834801d45d1f6afec1905325054ba0768ba8fa60144eea62ac3751cb2b787a32795c1611a870b2cb4bf4d58caf21f20b126b2bb2454fe6e2437c +"@types/node@npm:*, @types/node@npm:>=10.0.0, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0, @types/node@npm:^18.11.11": + version: 18.16.1 + resolution: "@types/node@npm:18.16.1" + checksum: d77a82fa404153804b916b31ea652507428a8076b447d4cbfe5da057fc3dd9abe26c2ac4b41d758d7287adaacc2d16a877e474105024b880aaaa2e193bebb356 languageName: node linkType: hard @@ -3546,13 +3377,6 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^18.11.11": - version: 18.16.1 - resolution: "@types/node@npm:18.16.1" - checksum: d77a82fa404153804b916b31ea652507428a8076b447d4cbfe5da057fc3dd9abe26c2ac4b41d758d7287adaacc2d16a877e474105024b880aaaa2e193bebb356 - languageName: node - linkType: hard - "@types/normalize-package-data@npm:^2.4.0": version: 2.4.1 resolution: "@types/normalize-package-data@npm:2.4.1" @@ -3569,14 +3393,7 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.1.0, @types/semver@npm:^7.3.12": - version: 7.3.13 - resolution: "@types/semver@npm:7.3.13" - checksum: 0064efd7a0515a539062b71630c72ca2b058501b957326c285cdff82f42c1716d9f9f831332ccf719d5ee8cc3ef24f9ff62122d7a7140c73959a240b49b0f62d - languageName: node - linkType: hard - -"@types/semver@npm:^7.5.0": +"@types/semver@npm:^7.1.0, @types/semver@npm:^7.3.12, @types/semver@npm:^7.5.0": version: 7.5.5 resolution: "@types/semver@npm:7.5.5" checksum: 1b0be2c4d830f5ef002a305308e06e3616fc38a41c9a2c5b4267df82a038d9bd0ba32ec1da82a52db84a720be7e4b69bac7593797d8dc1400a69069af8f19219 @@ -4225,7 +4042,7 @@ __metadata: languageName: node linkType: hard -"acorn-jsx@npm:^5.3.1, acorn-jsx@npm:^5.3.2": +"acorn-jsx@npm:^5.3.2": version: 5.3.2 resolution: "acorn-jsx@npm:5.3.2" peerDependencies: @@ -4241,16 +4058,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.6.0, acorn@npm:^8.7.1": - version: 8.8.2 - resolution: "acorn@npm:8.8.2" - bin: - acorn: bin/acorn - checksum: b4e77d56d24d3e11a45d9ac8ae661b4e14a4af04ae33edbf1e6bf910887e5bb352cc60e9ea06a0944880e6b658f58c095d3b54e88e1921cb9319608b51085dd7 - languageName: node - linkType: hard - -"acorn@npm:^8.9.0": +"acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.7.1, acorn@npm:^8.9.0": version: 8.11.2 resolution: "acorn@npm:8.11.2" bin: @@ -4284,18 +4092,7 @@ __metadata: languageName: node linkType: hard -"agentkeepalive@npm:^4.2.0": - version: 4.2.0 - resolution: "agentkeepalive@npm:4.2.0" - dependencies: - debug: "npm:^4.1.0" - depd: "npm:^1.1.2" - humanize-ms: "npm:^1.2.1" - checksum: cc6e1b4f1cba6f93d30c02adae3b0e1b05c88dad0c39837467d8ee364aeb7bb85588252144bbd33649ac60322f955ec772a459ec165fcf7520a3fad1c8b77faf - languageName: node - linkType: hard - -"agentkeepalive@npm:^4.2.1": +"agentkeepalive@npm:^4.2.0, agentkeepalive@npm:^4.2.1": version: 4.3.0 resolution: "agentkeepalive@npm:4.3.0" dependencies: @@ -4372,19 +4169,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^8.0.0, ajv@npm:^8.0.1, ajv@npm:^8.6.0": - version: 8.8.1 - resolution: "ajv@npm:8.8.1" - dependencies: - fast-deep-equal: "npm:^3.1.1" - json-schema-traverse: "npm:^1.0.0" - require-from-string: "npm:^2.0.2" - uri-js: "npm:^4.2.2" - checksum: fc52cd18c97a8e9bee23e951a0b4c82d045cb7ad60904a0222cc5bcc2c6165ebab714d0ed9e4c80e08140184a2a078838dae4820d0fe9706133290ae4e871a7a - languageName: node - linkType: hard - -"ajv@npm:^8.9.0": +"ajv@npm:^8.0.0, ajv@npm:^8.0.1, ajv@npm:^8.6.0, ajv@npm:^8.9.0": version: 8.12.0 resolution: "ajv@npm:8.12.0" dependencies: @@ -5137,22 +4922,7 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.14.5": - version: 4.18.1 - resolution: "browserslist@npm:4.18.1" - dependencies: - caniuse-lite: "npm:^1.0.30001280" - electron-to-chromium: "npm:^1.3.896" - escalade: "npm:^3.1.1" - node-releases: "npm:^2.0.1" - picocolors: "npm:^1.0.0" - bin: - browserslist: cli.js - checksum: 83bb8dd04c23248a63a7b008dfb77472a1b19989efc1b0c9f3fab69b459d0c38bdf2bf3c0c4d47a714963ee266f75b2f3fa0aa4d703865ff7f90aca181a25f56 - languageName: node - linkType: hard - -"browserslist@npm:^4.21.9, browserslist@npm:^4.22.1": +"browserslist@npm:^4.14.5, browserslist@npm:^4.21.9, browserslist@npm:^4.22.1": version: 4.22.1 resolution: "browserslist@npm:4.22.1" dependencies: @@ -5357,17 +5127,7 @@ __metadata: languageName: node linkType: hard -"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2": - version: 1.0.2 - resolution: "call-bind@npm:1.0.2" - dependencies: - function-bind: "npm:^1.1.1" - get-intrinsic: "npm:^1.0.2" - checksum: ca787179c1cbe09e1697b56ad499fd05dc0ae6febe5081d728176ade699ea6b1589240cb1ff1fe11fcf9f61538c1af60ad37e8eb2ceb4ef21cd6085dfd3ccedd - languageName: node - linkType: hard - -"call-bind@npm:^1.0.4, call-bind@npm:^1.0.5": +"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2, call-bind@npm:^1.0.4, call-bind@npm:^1.0.5": version: 1.0.5 resolution: "call-bind@npm:1.0.5" dependencies: @@ -5427,13 +5187,6 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001280": - version: 1.0.30001282 - resolution: "caniuse-lite@npm:1.0.30001282" - checksum: 7802b8e0999b3bb01da5a291b6f33cba98f1819ff43f7318adb2df1d63f213a751ab32fa8c66a6d53c953be16e710cd82a110286c3bd7c0b5c7ea83a70211816 - languageName: node - linkType: hard - "caniuse-lite@npm:^1.0.30001541": version: 1.0.30001561 resolution: "caniuse-lite@npm:1.0.30001561" @@ -5519,7 +5272,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^2.0.0, chalk@npm:^2.0.1, chalk@npm:^2.1.0, chalk@npm:^2.4.2": +"chalk@npm:^2.0.1, chalk@npm:^2.1.0, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -5591,14 +5344,7 @@ __metadata: languageName: node linkType: hard -"check-error@npm:^1.0.2": - version: 1.0.2 - resolution: "check-error@npm:1.0.2" - checksum: 011e74b2eac49bd42c5610f15d6949d982e7ec946247da0276278a90e7476e6b88d25d3c605a4115d5e3575312e1f5a11e91c82290c8a47ca275c92f5d0981db - languageName: node - linkType: hard - -"check-error@npm:^1.0.3": +"check-error@npm:^1.0.2, check-error@npm:^1.0.3": version: 1.0.3 resolution: "check-error@npm:1.0.3" dependencies: @@ -5890,6 +5636,16 @@ __metadata: languageName: node linkType: hard +"color-string@npm:^1.9.0": + version: 1.9.1 + resolution: "color-string@npm:1.9.1" + dependencies: + color-name: "npm:^1.0.0" + simple-swizzle: "npm:^0.2.2" + checksum: 72aa0b81ee71b3f4fb1ac9cd839cdbd7a011a7d318ef58e6cb13b3708dca75c7e45029697260488709f1b1c7ac4e35489a87e528156c1e365917d1c4ccb9b9cd + languageName: node + linkType: hard + "color-support@npm:^1.1.2": version: 1.1.3 resolution: "color-support@npm:1.1.3" @@ -5909,14 +5665,17 @@ __metadata: languageName: node linkType: hard -"colorette@npm:^2.0.14, colorette@npm:^2.0.19": - version: 2.0.19 - resolution: "colorette@npm:2.0.19" - checksum: 6e2606435cd30e1cae8fc6601b024fdd809e20515c57ce1e588d0518403cff0c98abf807912ba543645a9188af36763b69b67e353d47397f24a1c961aba300bd +"color@npm:^4.2.3": + version: 4.2.3 + resolution: "color@npm:4.2.3" + dependencies: + color-convert: "npm:^2.0.1" + color-string: "npm:^1.9.0" + checksum: b23f5e500a79ea22428db43d1a70642d983405c0dd1f95ef59dbdb9ba66afbb4773b334fa0b75bb10b0552fd7534c6b28d4db0a8b528f91975976e70973c0152 languageName: node linkType: hard -"colorette@npm:^2.0.7": +"colorette@npm:^2.0.14, colorette@npm:^2.0.19, colorette@npm:^2.0.7": version: 2.0.20 resolution: "colorette@npm:2.0.20" checksum: 0b8de48bfa5d10afc160b8eaa2b9938f34a892530b2f7d7897e0458d9535a066e3998b49da9d21161c78225b272df19ae3a64d6df28b4c9734c0e55bbd02406f @@ -6482,13 +6241,14 @@ __metadata: "@dashevo/bls": "npm:~1.2.9" "@dashevo/dapi-client": "workspace:*" "@dashevo/dapi-grpc": "workspace:*" - "@dashevo/dashcore-lib": "npm:~0.21.0" + "@dashevo/dashcore-lib": "npm:~0.21.3" "@dashevo/dashpay-contract": "workspace:*" "@dashevo/dpns-contract": "workspace:*" "@dashevo/grpc-common": "workspace:*" "@dashevo/masternode-reward-shares-contract": "workspace:*" "@dashevo/wallet-lib": "workspace:*" "@dashevo/wasm-dpp": "workspace:*" + "@dashevo/withdrawals-contract": "workspace:*" "@types/chai": "npm:^4.2.12" "@types/dirty-chai": "npm:^2.0.2" "@types/mocha": "npm:^8.0.3" @@ -6514,7 +6274,7 @@ __metadata: eslint-plugin-import: "npm:^2.29.0" events: "npm:^3.3.0" https-browserify: "npm:^1.0.0" - karma: "npm:^6.4.1" + karma: "npm:^6.4.3" karma-chai: "npm:^0.1.0" karma-chrome-launcher: "npm:^3.1.0" karma-firefox-launcher: "npm:^2.1.2" @@ -6557,13 +6317,10 @@ __metadata: "@babel/core": "npm:^7.23.3" "@babel/eslint-parser": "npm:^7.23.3" "@dashevo/bls": "npm:~1.2.9" - "@dashevo/dashcore-lib": "npm:~0.21.0" - "@dashevo/dashd-rpc": "npm:^18.2.0" - "@dashevo/dashpay-contract": "workspace:*" + "@dashevo/dapi-client": "workspace:*" + "@dashevo/dashcore-lib": "npm:~0.21.3" + "@dashevo/dashd-rpc": "npm:^19.0.0" "@dashevo/docker-compose": "npm:^0.24.4" - "@dashevo/dpns-contract": "workspace:*" - "@dashevo/feature-flags-contract": "workspace:*" - "@dashevo/masternode-reward-shares-contract": "workspace:*" "@dashevo/wallet-lib": "workspace:*" "@dashevo/withdrawals-contract": "workspace:*" "@oclif/core": "npm:^3.10.8" @@ -6572,11 +6329,13 @@ __metadata: ajv-formats: "npm:^2.1.1" awilix: "npm:^4.2.6" begoo: "npm:^2.0.2" + bs58: "npm:^4.0.1" chai: "npm:^4.3.10" chai-as-promised: "npm:^7.1.1" chalk: "npm:^4.1.0" cron: "npm:^2.1.0" dirty-chai: "npm:^2.0.1" + diskusage: "npm:^1.2.0" dockerode: "npm:^3.3.5" dot: "npm:^1.1.3" dotenv: "npm:^8.6.0" @@ -6606,6 +6365,7 @@ __metadata: semver: "npm:^7.5.3" sinon: "npm:^17.0.1" sinon-chai: "npm:^3.7.0" + systeminformation: "npm:^5.22.11" table: "npm:^6.8.1" wrap-ansi: "npm:^7.0.0" bin: @@ -6676,6 +6436,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:~4.3.4": + version: 4.3.5 + resolution: "debug@npm:4.3.5" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: cb6eab424c410e07813ca1392888589972ce9a32b8829c6508f5e1f25f3c3e70a76731610ae55b4bbe58d1a2fffa1424b30e97fa8d394e49cd2656a9643aedd2 + languageName: node + linkType: hard + "debuglog@npm:^1.0.1": version: 1.0.1 resolution: "debuglog@npm:1.0.1" @@ -6792,17 +6564,7 @@ __metadata: languageName: node linkType: hard -"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4": - version: 1.2.0 - resolution: "define-properties@npm:1.2.0" - dependencies: - has-property-descriptors: "npm:^1.0.0" - object-keys: "npm:^1.1.1" - checksum: e60aee6a19b102df4e2b1f301816804e81ab48bb91f00d0d935f269bf4b3f79c88b39e4f89eaa132890d23267335fd1140dfcd8d5ccd61031a0a2c41a54e33a6 - languageName: node - linkType: hard - -"define-properties@npm:^1.2.0": +"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4, define-properties@npm:^1.2.0": version: 1.2.1 resolution: "define-properties@npm:1.2.1" dependencies: @@ -6834,13 +6596,6 @@ __metadata: languageName: node linkType: hard -"depd@npm:^1.1.2, depd@npm:~1.1.2": - version: 1.1.2 - resolution: "depd@npm:1.1.2" - checksum: 2ed6966fc14463a9e85451db330ab8ba041efed0b9a1a472dbfc6fbf2f82bab66491915f996b25d8517dddc36c8c74e24c30879b34877f3c4410733444a51d1d - languageName: node - linkType: hard - "depd@npm:^2.0.0": version: 2.0.0 resolution: "depd@npm:2.0.0" @@ -6848,6 +6603,13 @@ __metadata: languageName: node linkType: hard +"depd@npm:~1.1.2": + version: 1.1.2 + resolution: "depd@npm:1.1.2" + checksum: 2ed6966fc14463a9e85451db330ab8ba041efed0b9a1a472dbfc6fbf2f82bab66491915f996b25d8517dddc36c8c74e24c30879b34877f3c4410733444a51d1d + languageName: node + linkType: hard + "deprecation@npm:^2.0.0, deprecation@npm:^2.3.1": version: 2.3.1 resolution: "deprecation@npm:2.3.1" @@ -6889,7 +6651,7 @@ __metadata: languageName: node linkType: hard -"diff@npm:5.0.0, diff@npm:^5.0.0": +"diff@npm:5.0.0": version: 5.0.0 resolution: "diff@npm:5.0.0" checksum: 4a179a75b17cbb420eb9145be913f9ddb34b47cb2ba4301e80ae745122826a468f02ca8f5e56945958de26ace594899c8381acb6659c88e7803ef078b53d690c @@ -6910,7 +6672,7 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.1.0": +"diff@npm:^5.0.0, diff@npm:^5.1.0": version: 5.1.0 resolution: "diff@npm:5.1.0" checksum: f4557032a98b2967fe27b1a91dfcf8ebb6b9a24b1afe616b5c2312465100b861e9b8d4da374be535f2d6b967ce2f53826d7f6edc2a0d32b2ab55abc96acc2f9d @@ -6946,6 +6708,17 @@ __metadata: languageName: node linkType: hard +"diskusage@npm:^1.2.0": + version: 1.2.0 + resolution: "diskusage@npm:1.2.0" + dependencies: + es6-promise: "npm:^4.2.8" + nan: "npm:^2.18.0" + node-gyp: "npm:latest" + checksum: cf37552dd9b2731f44d802a6b4d9ea7fbff4f6d33d3f67ce736538fd09fbb276d146a61be0d3e40e27afe232c7cd54d91487c5ca3770f1fe11c865ac240b9674 + languageName: node + linkType: hard + "dns-packet@npm:^5.4.0": version: 5.4.0 resolution: "dns-packet@npm:5.4.0" @@ -7082,21 +6855,14 @@ __metadata: languageName: node linkType: hard -"ejs@npm:^3.1.7": - version: 3.1.8 - resolution: "ejs@npm:3.1.8" +"ejs@npm:^3.1.10, ejs@npm:^3.1.8, ejs@npm:^3.1.9": + version: 3.1.10 + resolution: "ejs@npm:3.1.10" dependencies: jake: "npm:^10.8.5" bin: ejs: bin/cli.js - checksum: 879f84c8ee56d06dea7b47a8b493e1b398dba578ec7a701660cf77c8a6d565b932c5896639d1dc4a3be29204eccdb70ee4e1bdf634647c2490227f727d5d6a3d - languageName: node - linkType: hard - -"electron-to-chromium@npm:^1.3.896": - version: 1.3.903 - resolution: "electron-to-chromium@npm:1.3.903" - checksum: 12a0c5ba72d3d5cbc6ae2a1fed33873c9e4b45f9c6e66b9f4ce1f4a6cddfcdc1e485701fffefb380c790b8f1414e67cfca3b24b67f0992c8caec8a9ad5612bcc + checksum: a9cb7d7cd13b7b1cd0be5c4788e44dd10d92f7285d2f65b942f33e127230c054f99a42db4d99f766d8dbc6c57e94799593ee66a14efd7c8dd70c4812bf6aa384 languageName: node linkType: hard @@ -7193,7 +6959,7 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.0.0": +"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.10.0": version: 5.15.0 resolution: "enhanced-resolve@npm:5.15.0" dependencies: @@ -7203,16 +6969,6 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.10.0": - version: 5.12.0 - resolution: "enhanced-resolve@npm:5.12.0" - dependencies: - graceful-fs: "npm:^4.2.4" - tapable: "npm:^2.2.0" - checksum: ea5b49a0641827c6a083eaa3a625f953f4bd4e8f015bf70b9fb8cf60a35aaeb44e567df2da91ed28efaea3882845016e1d22a3152c2fdf773ea14f39cbe3d8a9 - languageName: node - linkType: hard - "enquirer@github:dashpay/enquirer#patch-1": version: 2.3.6 resolution: "enquirer@https://github.com/dashpay/enquirer.git#commit=86aaef0b1c82dfaa3436775e6b37de310eeb94f5" @@ -7279,60 +7035,18 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.19.0, es-abstract@npm:^1.20.4": - version: 1.21.2 - resolution: "es-abstract@npm:1.21.2" +"es-abstract@npm:^1.20.4, es-abstract@npm:^1.22.1": + version: 1.22.3 + resolution: "es-abstract@npm:1.22.3" dependencies: array-buffer-byte-length: "npm:^1.0.0" + arraybuffer.prototype.slice: "npm:^1.0.2" available-typed-arrays: "npm:^1.0.5" - call-bind: "npm:^1.0.2" + call-bind: "npm:^1.0.5" es-set-tostringtag: "npm:^2.0.1" es-to-primitive: "npm:^1.2.1" - function.prototype.name: "npm:^1.1.5" - get-intrinsic: "npm:^1.2.0" - get-symbol-description: "npm:^1.0.0" - globalthis: "npm:^1.0.3" - gopd: "npm:^1.0.1" - has: "npm:^1.0.3" - has-property-descriptors: "npm:^1.0.0" - has-proto: "npm:^1.0.1" - has-symbols: "npm:^1.0.3" - internal-slot: "npm:^1.0.5" - is-array-buffer: "npm:^3.0.2" - is-callable: "npm:^1.2.7" - is-negative-zero: "npm:^2.0.2" - is-regex: "npm:^1.1.4" - is-shared-array-buffer: "npm:^1.0.2" - is-string: "npm:^1.0.7" - is-typed-array: "npm:^1.1.10" - is-weakref: "npm:^1.0.2" - object-inspect: "npm:^1.12.3" - object-keys: "npm:^1.1.1" - object.assign: "npm:^4.1.4" - regexp.prototype.flags: "npm:^1.4.3" - safe-regex-test: "npm:^1.0.0" - string.prototype.trim: "npm:^1.2.7" - string.prototype.trimend: "npm:^1.0.6" - string.prototype.trimstart: "npm:^1.0.6" - typed-array-length: "npm:^1.0.4" - unbox-primitive: "npm:^1.0.2" - which-typed-array: "npm:^1.1.9" - checksum: 2e1d6922c9a03d90f5a45fa56574a14f9436d9711ed424ace23ae87f79d0190dbffda1c0564980f6048dc2348f0390427a1fbae309fdb16a9ed42cd5c79dce6e - languageName: node - linkType: hard - -"es-abstract@npm:^1.22.1": - version: 1.22.3 - resolution: "es-abstract@npm:1.22.3" - dependencies: - array-buffer-byte-length: "npm:^1.0.0" - arraybuffer.prototype.slice: "npm:^1.0.2" - available-typed-arrays: "npm:^1.0.5" - call-bind: "npm:^1.0.5" - es-set-tostringtag: "npm:^2.0.1" - es-to-primitive: "npm:^1.2.1" - function.prototype.name: "npm:^1.1.6" - get-intrinsic: "npm:^1.2.2" + function.prototype.name: "npm:^1.1.6" + get-intrinsic: "npm:^1.2.2" get-symbol-description: "npm:^1.0.0" globalthis: "npm:^1.0.3" gopd: "npm:^1.0.1" @@ -7420,7 +7134,7 @@ __metadata: languageName: node linkType: hard -"es6-promise@npm:^4.0.3": +"es6-promise@npm:^4.0.3, es6-promise@npm:^4.2.8": version: 4.2.8 resolution: "es6-promise@npm:4.2.8" checksum: b250c55523c496c43c9216c2646e58ec182b819e036fe5eb8d83fa16f044ecc6b8dcefc88ace2097be3d3c4d02b6aa8eeae1a66deeaf13e7bee905ebabb350a3 @@ -7542,17 +7256,7 @@ __metadata: languageName: node linkType: hard -"eslint-import-resolver-node@npm:^0.3.6": - version: 0.3.6 - resolution: "eslint-import-resolver-node@npm:0.3.6" - dependencies: - debug: "npm:^3.2.7" - resolve: "npm:^1.20.0" - checksum: c35c6edb7e77980a90922be8aedfacde572839b817146ab9fbed01195cb173cc40aa02d44ba0950170cfd41add11bc652dda8efed7ca766d733dc1eefc174614 - languageName: node - linkType: hard - -"eslint-import-resolver-node@npm:^0.3.9": +"eslint-import-resolver-node@npm:^0.3.6, eslint-import-resolver-node@npm:^0.3.9": version: 0.3.9 resolution: "eslint-import-resolver-node@npm:0.3.9" dependencies: @@ -7688,14 +7392,7 @@ __metadata: languageName: node linkType: hard -"eslint-visitor-keys@npm:^3.1.0, eslint-visitor-keys@npm:^3.3.0": - version: 3.3.0 - resolution: "eslint-visitor-keys@npm:3.3.0" - checksum: 37a1a5912a0b1de0f6d26237d8903af8a3af402bbef6e4181aeda1ace12a67348a0356c677804cfc839f62e68c3845b3eb96bb8f334d30d5ce96348d482567ed - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3": +"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3": version: 3.4.3 resolution: "eslint-visitor-keys@npm:3.4.3" checksum: 3f357c554a9ea794b094a09bd4187e5eacd1bc0d0653c3adeb87962c548e6a1ab8f982b86963ae1337f5d976004146536dcee5d0e2806665b193fbfbf1a9231b @@ -7750,18 +7447,7 @@ __metadata: languageName: node linkType: hard -"espree@npm:^9.1.0": - version: 9.1.0 - resolution: "espree@npm:9.1.0" - dependencies: - acorn: "npm:^8.6.0" - acorn-jsx: "npm:^5.3.1" - eslint-visitor-keys: "npm:^3.1.0" - checksum: 8ade225f2423d94cac6a2ba65d966263a4b2f167eba8367954c96644453a4bf60d1f04c3ba92d9deb9f904fa56bf5e2fee600e45fe2af9dbb8f32a722a501490 - languageName: node - linkType: hard - -"espree@npm:^9.6.0, espree@npm:^9.6.1": +"espree@npm:^9.1.0, espree@npm:^9.6.0, espree@npm:^9.6.1": version: 9.6.1 resolution: "espree@npm:9.6.1" dependencies: @@ -7923,7 +7609,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.2": +"fast-glob@npm:^3.2.2, fast-glob@npm:^3.2.5, fast-glob@npm:^3.2.9": version: 3.2.12 resolution: "fast-glob@npm:3.2.12" dependencies: @@ -7936,19 +7622,6 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.5, fast-glob@npm:^3.2.9": - version: 3.2.11 - resolution: "fast-glob@npm:3.2.11" - dependencies: - "@nodelib/fs.stat": "npm:^2.0.2" - "@nodelib/fs.walk": "npm:^1.2.3" - glob-parent: "npm:^5.1.2" - merge2: "npm:^1.3.0" - micromatch: "npm:^4.0.4" - checksum: 6b736d92a47f27218a85bf184a4ccab9f707398f86711bf84d730243b10a999a85f79afc526133c044ebebfcb42a68d09f769fdbedcc00680ddd56e56a56483a - languageName: node - linkType: hard - "fast-json-patch@npm:^3.1.1": version: 3.1.1 resolution: "fast-json-patch@npm:3.1.1" @@ -8195,13 +7868,13 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.0.0": - version: 1.15.2 - resolution: "follow-redirects@npm:1.15.2" +"follow-redirects@npm:^1.15.5": + version: 1.15.6 + resolution: "follow-redirects@npm:1.15.6" peerDependenciesMeta: debug: optional: true - checksum: 8be0d39919770054812537d376850ccde0b4762b0501c440bd08724971a078123b55f57704f2984e0664fecc0c86adea85add63295804d9dce401cd9604c91d3 + checksum: 70c7612c4cab18e546e36b991bbf8009a1a41cf85354afe04b113d1117569abf760269409cb3eb842d9f7b03d62826687086b081c566ea7b1e6613cf29030bf7 languageName: node linkType: hard @@ -8331,32 +8004,13 @@ __metadata: languageName: node linkType: hard -"function-bind@npm:^1.1.1": - version: 1.1.1 - resolution: "function-bind@npm:1.1.1" - checksum: d83f2968030678f0b8c3f2183d63dcd969344eb8b55b4eb826a94ccac6de8b87c95bebffda37a6386c74f152284eb02956ff2c496897f35d32bdc2628ac68ac5 - languageName: node - linkType: hard - -"function-bind@npm:^1.1.2": +"function-bind@npm:^1.1.1, function-bind@npm:^1.1.2": version: 1.1.2 resolution: "function-bind@npm:1.1.2" checksum: 185e20d20f10c8d661d59aac0f3b63b31132d492e1b11fcc2a93cb2c47257ebaee7407c38513efd2b35cafdf972d9beb2ea4593c1e0f3bf8f2744836928d7454 languageName: node linkType: hard -"function.prototype.name@npm:^1.1.5": - version: 1.1.5 - resolution: "function.prototype.name@npm:1.1.5" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.3" - es-abstract: "npm:^1.19.0" - functions-have-names: "npm:^1.2.2" - checksum: 5d426e5a38ac41747bcfce6191e0ec818ed18678c16cfc36b5d1ca87f56ff98c4ce958ee2c1ea2a18dc3da989844a37b1065311e2d2ae4cf12da8f82418b686b - languageName: node - linkType: hard - "function.prototype.name@npm:^1.1.6": version: 1.1.6 resolution: "function.prototype.name@npm:1.1.6" @@ -8376,7 +8030,7 @@ __metadata: languageName: node linkType: hard -"functions-have-names@npm:^1.2.2, functions-have-names@npm:^1.2.3": +"functions-have-names@npm:^1.2.3": version: 1.2.3 resolution: "functions-have-names@npm:1.2.3" checksum: 0ddfd3ed1066a55984aaecebf5419fbd9344a5c38dd120ffb0739fac4496758dcf371297440528b115e4367fc46e3abc86a2cc0ff44612181b175ae967a11a05 @@ -8421,18 +8075,7 @@ __metadata: languageName: node linkType: hard -"get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.0": - version: 1.2.0 - resolution: "get-intrinsic@npm:1.2.0" - dependencies: - function-bind: "npm:^1.1.1" - has: "npm:^1.0.3" - has-symbols: "npm:^1.0.3" - checksum: f57c5fe67a96adace4f8e80c288728bcd0ccfdc82c9cc53e4a5ef1ec857b5f7ef4b1c289e39649b1df226bace81103630bf7e128c821f82cd603450036e54f97 - languageName: node - linkType: hard - -"get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.2": +"get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.0, get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.2": version: 1.2.2 resolution: "get-intrinsic@npm:1.2.2" dependencies: @@ -8599,7 +8242,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:7.2.0, glob@npm:^7.0.0, glob@npm:^7.0.5, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.1.7, glob@npm:^7.2.0": +"glob@npm:7.2.0": version: 7.2.0 resolution: "glob@npm:7.2.0" dependencies: @@ -8613,33 +8256,32 @@ __metadata: languageName: node linkType: hard -"glob@npm:^10.2.2, glob@npm:^10.3.10": - version: 10.3.10 - resolution: "glob@npm:10.3.10" +"glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.3.4": + version: 10.4.1 + resolution: "glob@npm:10.4.1" dependencies: foreground-child: "npm:^3.1.0" - jackspeak: "npm:^2.3.5" - minimatch: "npm:^9.0.1" - minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0" - path-scurry: "npm:^1.10.1" + jackspeak: "npm:^3.1.2" + minimatch: "npm:^9.0.4" + minipass: "npm:^7.1.2" + path-scurry: "npm:^1.11.1" bin: glob: dist/esm/bin.mjs - checksum: 38bdb2c9ce75eb5ed168f309d4ed05b0798f640b637034800a6bf306f39d35409bf278b0eaaffaec07591085d3acb7184a201eae791468f0f617771c2486a6a8 + checksum: d7bb49d2b413f77bdd59fea4ca86dcc12450deee221af0ca93e09534b81b9ef68fe341345751d8ff0c5b54bad422307e0e44266ff8ad7fbbd0c200e8ec258b16 languageName: node linkType: hard -"glob@npm:^10.3.4": - version: 10.3.4 - resolution: "glob@npm:10.3.4" +"glob@npm:^7.0.0, glob@npm:^7.0.5, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.1.7, glob@npm:^7.2.0": + version: 7.2.3 + resolution: "glob@npm:7.2.3" dependencies: - foreground-child: "npm:^3.1.0" - jackspeak: "npm:^2.0.3" - minimatch: "npm:^9.0.1" - minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0" - path-scurry: "npm:^1.10.1" - bin: - glob: dist/cjs/src/bin.js - checksum: 6375721bcd0c615fe4c1d61faaf9eb93e15d428f26bac6e85739221a84659b42601b2a085b20915142c0eb3d8a7155914884ff80f145d8c9f2397c8b771b8b60 + fs.realpath: "npm:^1.0.0" + inflight: "npm:^1.0.4" + inherits: "npm:2" + minimatch: "npm:^3.1.1" + once: "npm:^1.3.0" + path-is-absolute: "npm:^1.0.0" + checksum: 59452a9202c81d4508a43b8af7082ca5c76452b9fcc4a9ab17655822e6ce9b21d4f8fbadabe4fe3faef448294cec249af305e2cd824b7e9aaf689240e5e96a7b languageName: node linkType: hard @@ -8681,7 +8323,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11, globby@npm:^11.0.1, globby@npm:^11.0.3, globby@npm:^11.1.0": +"globby@npm:^11, globby@npm:^11.0.1, globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -9362,6 +9004,16 @@ __metadata: languageName: node linkType: hard +"ip-address@npm:^9.0.5": + version: 9.0.5 + resolution: "ip-address@npm:9.0.5" + dependencies: + jsbn: "npm:1.1.0" + sprintf-js: "npm:^1.1.3" + checksum: 1ed81e06721af012306329b31f532b5e24e00cb537be18ddc905a84f19fe8f83a09a1699862bf3a1ec4b9dea93c55a3fa5faf8b5ea380431469df540f38b092c + languageName: node + linkType: hard + "ip-regex@npm:^5.0.0": version: 5.0.0 resolution: "ip-regex@npm:5.0.0" @@ -9369,20 +9021,6 @@ __metadata: languageName: node linkType: hard -"ip@npm:^1.1.5": - version: 1.1.5 - resolution: "ip@npm:1.1.5" - checksum: 40a00572cf06b53f4c7b7fe6270a8427ef4c6c0820a380f9f1eb48a323eb09c7dbd16245b472cf5a2d083911d0deae4d712b6e6c88b346fa274e8ce07756a7d6 - languageName: node - linkType: hard - -"ip@npm:^2.0.0": - version: 2.0.0 - resolution: "ip@npm:2.0.0" - checksum: 1270b11e534a466fb4cf4426cbcc3a907c429389f7f4e4e3b288b42823562e88d6a509ceda8141a507de147ca506141f745005c0aa144569d94cf24a54eb52bc - languageName: node - linkType: hard - "irregular-plurals@npm:^3.2.0": version: 3.5.0 resolution: "irregular-plurals@npm:3.5.0" @@ -9469,7 +9107,7 @@ __metadata: languageName: node linkType: hard -"is-core-module@npm:^2.13.0, is-core-module@npm:^2.13.1": +"is-core-module@npm:^2.13.0, is-core-module@npm:^2.13.1, is-core-module@npm:^2.5.0, is-core-module@npm:^2.8.1": version: 2.13.1 resolution: "is-core-module@npm:2.13.1" dependencies: @@ -9478,15 +9116,6 @@ __metadata: languageName: node linkType: hard -"is-core-module@npm:^2.5.0, is-core-module@npm:^2.8.1": - version: 2.8.1 - resolution: "is-core-module@npm:2.8.1" - dependencies: - has: "npm:^1.0.3" - checksum: 80b33fbd450c3b7070a8ea101b730a8ae0aee326bb665cdb067220edbc98fb847d1294f8ded036d5b022827fb8d3e6fcf30313a601785c5d902db7660f6cd7b1 - languageName: node - linkType: hard - "is-date-object@npm:^1.0.1": version: 1.0.5 resolution: "is-date-object@npm:1.0.5" @@ -9706,20 +9335,7 @@ __metadata: languageName: node linkType: hard -"is-typed-array@npm:^1.1.10, is-typed-array@npm:^1.1.3, is-typed-array@npm:^1.1.9": - version: 1.1.10 - resolution: "is-typed-array@npm:1.1.10" - dependencies: - available-typed-arrays: "npm:^1.0.5" - call-bind: "npm:^1.0.2" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-tostringtag: "npm:^1.0.0" - checksum: 2392b2473bbc994f5c30d6848e32bab3cab6c80b795aaec3020baf5419ff7df38fc11b3a043eb56d50f842394c578dbb204a7a29398099f895cf111c5b27f327 - languageName: node - linkType: hard - -"is-typed-array@npm:^1.1.12": +"is-typed-array@npm:^1.1.10, is-typed-array@npm:^1.1.12, is-typed-array@npm:^1.1.3, is-typed-array@npm:^1.1.9": version: 1.1.12 resolution: "is-typed-array@npm:1.1.12" dependencies: @@ -9839,14 +9455,7 @@ __metadata: languageName: node linkType: hard -"istanbul-lib-coverage@npm:^3.0.0": - version: 3.2.0 - resolution: "istanbul-lib-coverage@npm:3.2.0" - checksum: 31621b84ad29339242b63d454243f558a7958ee0b5177749bacf1f74be7d95d3fd93853738ef7eebcddfaf3eab014716e51392a8dbd5aa1bdc1b15c2ebc53c24 - languageName: node - linkType: hard - -"istanbul-lib-coverage@npm:^3.2.0": +"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0": version: 3.2.2 resolution: "istanbul-lib-coverage@npm:3.2.2" checksum: 40bbdd1e937dfd8c830fa286d0f665e81b7a78bdabcd4565f6d5667c99828bda3db7fb7ac6b96a3e2e8a2461ddbc5452d9f8bc7d00cb00075fa6a3e99f5b6a81 @@ -9920,29 +9529,16 @@ __metadata: languageName: node linkType: hard -"jackspeak@npm:^2.0.3": - version: 2.3.3 - resolution: "jackspeak@npm:2.3.3" - dependencies: - "@isaacs/cliui": "npm:^8.0.2" - "@pkgjs/parseargs": "npm:^0.11.0" - dependenciesMeta: - "@pkgjs/parseargs": - optional: true - checksum: a4c7c1a3ffea90bbcaa2f7a0d2885861e94138982aef0ced8efd299b32ccb69645b49d27f5e3e81c57005002674dd7e2b5d08a4287e9110534e512ada53557b2 - languageName: node - linkType: hard - -"jackspeak@npm:^2.3.5": - version: 2.3.6 - resolution: "jackspeak@npm:2.3.6" +"jackspeak@npm:^3.1.2": + version: 3.1.2 + resolution: "jackspeak@npm:3.1.2" dependencies: "@isaacs/cliui": "npm:^8.0.2" "@pkgjs/parseargs": "npm:^0.11.0" dependenciesMeta: "@pkgjs/parseargs": optional: true - checksum: 6e6490d676af8c94a7b5b29b8fd5629f21346911ebe2e32931c2a54210134408171c24cee1a109df2ec19894ad04a429402a8438cbf5cc2794585d35428ace76 + checksum: 7e6b94103e5fea5e6311aacf45fe80e98583df55c39b9d8478dd0ce02f1f8f0a11fc419311c277aca959b95635ec9a6be97445a31794254946c679dd0a19f007 languageName: node linkType: hard @@ -10100,6 +9696,13 @@ __metadata: languageName: node linkType: hard +"jsbn@npm:1.1.0": + version: 1.1.0 + resolution: "jsbn@npm:1.1.0" + checksum: bebe7ae829bbd586ce8cbe83501dd8cb8c282c8902a8aeeed0a073a89dc37e8103b1244f3c6acd60278bcbfe12d93a3f83c9ac396868a3b3bbc3c5e5e3b648ef + languageName: node + linkType: hard + "jsdoc-type-pratt-parser@npm:~4.0.0": version: 4.0.0 resolution: "jsdoc-type-pratt-parser@npm:4.0.0" @@ -10220,18 +9823,7 @@ __metadata: languageName: node linkType: hard -"json5@npm:^2.2.0": - version: 2.2.0 - resolution: "json5@npm:2.2.0" - dependencies: - minimist: "npm:^1.2.5" - bin: - json5: lib/cli.js - checksum: d72ea87423a250c7912e4f28fc489d210a7becbae38e6d1d82efd02b5fe1cd1b61a3a9eacd21771fb50c3fa975e262af3df975b43f20b64b0e77af793c1d44aa - languageName: node - linkType: hard - -"json5@npm:^2.2.2, json5@npm:^2.2.3": +"json5@npm:^2.2.0, json5@npm:^2.2.2, json5@npm:^2.2.3": version: 2.2.3 resolution: "json5@npm:2.2.3" bin: @@ -10353,9 +9945,9 @@ __metadata: languageName: node linkType: hard -"karma@npm:^6.4.1": - version: 6.4.1 - resolution: "karma@npm:6.4.1" +"karma@npm:^6.4.3": + version: 6.4.3 + resolution: "karma@npm:6.4.3" dependencies: "@colors/colors": "npm:1.5.0" body-parser: "npm:^1.19.0" @@ -10376,14 +9968,14 @@ __metadata: qjobs: "npm:^1.2.0" range-parser: "npm:^1.2.1" rimraf: "npm:^3.0.2" - socket.io: "npm:^4.4.1" + socket.io: "npm:^4.7.2" source-map: "npm:^0.6.1" tmp: "npm:^0.2.1" ua-parser-js: "npm:^0.7.30" yargs: "npm:^16.1.1" bin: karma: bin/karma - checksum: 24faabfaf05fbef1bb3a7b218549ace55566c59f64e3602c55e5fc221c3fcec69f80ec43901f64225d0020fd3f9d756e947df609530ef0a5565020096bf6a056 + checksum: 7fc194f5d4b0dae27e97375d0e005a7b74a6bee3c6ad676c3e21ec7c6309f32202d62cf0f0645ea99aa5adea455d79afe1d32e8aa28ac3c09609f16d0e2120ca languageName: node linkType: hard @@ -10801,6 +10393,13 @@ __metadata: languageName: node linkType: hard +"lru-cache@npm:^10.2.0": + version: 10.2.2 + resolution: "lru-cache@npm:10.2.2" + checksum: ff1a496d30b5eaec2c9079080965bb0cede203cf878371f7033a007f1e54cd4aa13cc8abf7ccec4c994a83a22ed5476e83a55bb57cc07e6c1547a42937e42c37 + languageName: node + linkType: hard + "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -10819,27 +10418,13 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^7.3.1": - version: 7.3.1 - resolution: "lru-cache@npm:7.3.1" - checksum: 83adf549d8136bd7d39e04d7aaf1f4b7445e6a6675be19e27750c9014065fcfd49c155929e575c9e3dc1902fc0b381061494cd09980cbdd11fffcd5062203140 - languageName: node - linkType: hard - -"lru-cache@npm:^7.4.4, lru-cache@npm:^7.5.1, lru-cache@npm:^7.7.1": +"lru-cache@npm:^7.3.1, lru-cache@npm:^7.4.4, lru-cache@npm:^7.5.1, lru-cache@npm:^7.7.1": version: 7.18.3 resolution: "lru-cache@npm:7.18.3" checksum: 6029ca5aba3aacb554e919d7ef804fffd4adfc4c83db00fac8248c7c78811fb6d4b6f70f7fd9d55032b3823446546a007edaa66ad1f2377ae833bd983fac5d98 languageName: node linkType: hard -"lru-cache@npm:^9.1.1 || ^10.0.0": - version: 10.0.1 - resolution: "lru-cache@npm:10.0.1" - checksum: 5bb91a97a342a41fd049c3494b44d9e21a7d4843f9284d0a0b26f00bb0e436f1f627d0641c78f88be16b86b4231546c5ee4f284733fb530c7960f0bcd7579026 - languageName: node - linkType: hard - "ltgt@npm:~2.2.0": version: 2.2.1 resolution: "ltgt@npm:2.2.1" @@ -10997,30 +10582,7 @@ __metadata: languageName: node linkType: hard -"mem-fs-editor@npm:^8.1.2 || ^9.0.0": - version: 9.4.0 - resolution: "mem-fs-editor@npm:9.4.0" - dependencies: - binaryextensions: "npm:^4.16.0" - commondir: "npm:^1.0.1" - deep-extend: "npm:^0.6.0" - ejs: "npm:^3.1.6" - globby: "npm:^11.0.3" - isbinaryfile: "npm:^4.0.8" - minimatch: "npm:^3.0.4" - multimatch: "npm:^5.0.0" - normalize-path: "npm:^3.0.0" - textextensions: "npm:^5.13.0" - peerDependencies: - mem-fs: ^2.1.0 - peerDependenciesMeta: - mem-fs: - optional: true - checksum: b196c50010c4a2ccf26581b931953b090470a895bd2c5118e9c11e2dd6785e223b0a303d5286bc9779143f4b639264aed30dc980f7c137620181854ef63c6a0c - languageName: node - linkType: hard - -"mem-fs-editor@npm:^9.0.0": +"mem-fs-editor@npm:^8.1.2 || ^9.0.0, mem-fs-editor@npm:^9.0.0": version: 9.7.0 resolution: "mem-fs-editor@npm:9.7.0" dependencies: @@ -11259,7 +10821,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.2": +"minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" dependencies: @@ -11268,16 +10830,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^5.0.0": - version: 5.0.0 - resolution: "minimatch@npm:5.0.0" - dependencies: - brace-expansion: "npm:^2.0.1" - checksum: ee05bf8c1830bd85100522f655ca0df35ff633cf76ceff7bdfa21597c2085a38e36a9c31cc069097d6c9a126f7486ccf97a187aca07b695d799ae20f54e2e9c3 - languageName: node - linkType: hard - -"minimatch@npm:^5.0.1": +"minimatch@npm:^5.0.0, minimatch@npm:^5.0.1": version: 5.1.6 resolution: "minimatch@npm:5.1.6" dependencies: @@ -11295,7 +10848,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.0, minimatch@npm:^9.0.1, minimatch@npm:^9.0.3": +"minimatch@npm:^9.0.0, minimatch@npm:^9.0.3": version: 9.0.3 resolution: "minimatch@npm:9.0.3" dependencies: @@ -11304,6 +10857,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^9.0.4": + version: 9.0.4 + resolution: "minimatch@npm:9.0.4" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: 4cdc18d112b164084513e890d6323370db14c22249d536ad1854539577a895e690a27513dc346392f61a4a50afbbd8abc88f3f25558bfbbbb862cd56508b20f5 + languageName: node + linkType: hard + "minimist-options@npm:4.1.0": version: 4.1.0 resolution: "minimist-options@npm:4.1.0" @@ -11407,13 +10969,6 @@ __metadata: languageName: node linkType: hard -"minipass@npm:^4.0.0": - version: 4.2.8 - resolution: "minipass@npm:4.2.8" - checksum: e148eb6dcb85c980234cad889139ef8ddf9d5bdac534f4f0268446c8792dd4c74f4502479be48de3c1cce2f6450f6da4d0d4a86405a8a12be04c1c36b339569a - languageName: node - linkType: hard - "minipass@npm:^5.0.0": version: 5.0.0 resolution: "minipass@npm:5.0.0" @@ -11421,10 +10976,10 @@ __metadata: languageName: node linkType: hard -"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0": - version: 7.0.3 - resolution: "minipass@npm:7.0.3" - checksum: 04d72c8a437de54a024f3758ff17c0226efb532ef37dbdaca1ea6039c7b9b1704e612abbd2e3a0d2c825c64eb0a9ab266c843baa71d18ad1a279baecee28ed97 +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.1.2": + version: 7.1.2 + resolution: "minipass@npm:7.1.2" + checksum: c25f0ee8196d8e6036661104bacd743785b2599a21de5c516b32b3fa2b83113ac89a2358465bc04956baab37ffb956ae43be679b2262bf7be15fce467ccd7950 languageName: node linkType: hard @@ -11647,6 +11202,15 @@ __metadata: languageName: node linkType: hard +"nan@npm:^2.18.0": + version: 2.20.0 + resolution: "nan@npm:2.20.0" + dependencies: + node-gyp: "npm:latest" + checksum: 5f16e4c9953075d9920229c703c1d781c0b74118ce3d9e926b448a4eef92b7d8be5ac6adc748a13a5fafb594436cbfe63250e3471aefdd78e3a0cd14603b9ba7 + languageName: node + linkType: hard + "nanoid@npm:3.3.1": version: 3.3.1 resolution: "nanoid@npm:3.3.1" @@ -11828,13 +11392,6 @@ __metadata: languageName: node linkType: hard -"node-releases@npm:^2.0.1": - version: 2.0.1 - resolution: "node-releases@npm:2.0.1" - checksum: b20dd8d4bced11f75060f0387e05e76b9dc4a0451f7bb3516eade6f50499ea7768ba95d8a60d520c193402df1e58cb3fe301510cc1c1ad68949c3d57b5149866 - languageName: node - linkType: hard - "node-releases@npm:^2.0.13": version: 2.0.13 resolution: "node-releases@npm:2.0.13" @@ -12175,14 +11732,7 @@ __metadata: languageName: node linkType: hard -"object-inspect@npm:^1.12.3, object-inspect@npm:^1.9.0": - version: 1.12.3 - resolution: "object-inspect@npm:1.12.3" - checksum: 532b0036f0472f561180fac0d04fe328ee01f57637624c83fb054f81b5bfe966cdf4200612a499ed391a7ca3c46b20a0bc3a55fc8241d944abe687c556a32b39 - languageName: node - linkType: hard - -"object-inspect@npm:^1.13.1": +"object-inspect@npm:^1.13.1, object-inspect@npm:^1.9.0": version: 1.13.1 resolution: "object-inspect@npm:1.13.1" checksum: 92f4989ed83422d56431bc39656d4c780348eb15d397ce352ade6b7fec08f973b53744bd41b94af021901e61acaf78fcc19e65bf464ecc0df958586a672700f0 @@ -12766,6 +12316,16 @@ __metadata: languageName: node linkType: hard +"password-prompt@npm:^1.1.3": + version: 1.1.3 + resolution: "password-prompt@npm:1.1.3" + dependencies: + ansi-escapes: "npm:^4.3.2" + cross-spawn: "npm:^7.0.3" + checksum: 1cf7001e66868b2ed7a03e036bc2f1dd45eb6dc8fee7e3e2056370057c484be25e7468fee00a1378e1ee8eca77ba79f48bee5ce15dcb464413987ace63c68b35 + languageName: node + linkType: hard + "path-browserify@npm:^1.0.1": version: 1.0.1 resolution: "path-browserify@npm:1.0.1" @@ -12832,13 +12392,13 @@ __metadata: languageName: node linkType: hard -"path-scurry@npm:^1.10.1": - version: 1.10.1 - resolution: "path-scurry@npm:1.10.1" +"path-scurry@npm:^1.11.1": + version: 1.11.1 + resolution: "path-scurry@npm:1.11.1" dependencies: - lru-cache: "npm:^9.1.1 || ^10.0.0" + lru-cache: "npm:^10.2.0" minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0" - checksum: eebfb8304fef1d4f7e1486df987e4fd77413de4fce16508dea69fcf8eb318c09a6b15a7a2f4c22877cec1cb7ecbd3071d18ca9de79eeece0df874a00f1f0bdc8 + checksum: 5e8845c159261adda6f09814d7725683257fcc85a18f329880ab4d7cc1d12830967eae5d5894e453f341710d5484b8fdbbd4d75181b4d6e1eb2f4dc7aeadc434 languageName: node linkType: hard @@ -13445,14 +13005,14 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:3, readable-stream@npm:^3.0.0, readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.5.0, readable-stream@npm:^3.6.0": - version: 3.6.0 - resolution: "readable-stream@npm:3.6.0" +"readable-stream@npm:3, readable-stream@npm:^3.0.0, readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.5.0, readable-stream@npm:^3.6.0, readable-stream@npm:^3.6.2": + version: 3.6.2 + resolution: "readable-stream@npm:3.6.2" dependencies: inherits: "npm:^2.0.3" string_decoder: "npm:^1.1.1" util-deprecate: "npm:^1.0.1" - checksum: b80b3e6a7fafb1c79de7db541de357f4a5ee73bd70c21672f5a7c840d27bb27bdb0151e7ba2fd82c4a888df22ce0c501b0d9f3e4dfe51688876701c437d59536 + checksum: d9e3e53193adcdb79d8f10f2a1f6989bd4389f5936c6f8b870e77570853561c362bee69feca2bbb7b32368ce96a85504aa4cedf7cf80f36e6a9de30d64244048 languageName: node linkType: hard @@ -13471,17 +13031,6 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^3.6.2": - version: 3.6.2 - resolution: "readable-stream@npm:3.6.2" - dependencies: - inherits: "npm:^2.0.3" - string_decoder: "npm:^1.1.1" - util-deprecate: "npm:^1.0.1" - checksum: d9e3e53193adcdb79d8f10f2a1f6989bd4389f5936c6f8b870e77570853561c362bee69feca2bbb7b32368ce96a85504aa4cedf7cf80f36e6a9de30d64244048 - languageName: node - linkType: hard - "readable-stream@npm:^4.0.0, readable-stream@npm:^4.3.0": version: 4.4.2 resolution: "readable-stream@npm:4.4.2" @@ -13604,17 +13153,6 @@ __metadata: languageName: node linkType: hard -"regexp.prototype.flags@npm:^1.4.3": - version: 1.4.3 - resolution: "regexp.prototype.flags@npm:1.4.3" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.3" - functions-have-names: "npm:^1.2.2" - checksum: 3cde7cd22f0cf9d04db0b77c825b14824c6e7d2ec77e17e8dba707ad1b3c70bb3f2ac5b4cad3c0932045ba61cb2fd1b8ef84a49140e952018bdae065cc001670 - languageName: node - linkType: hard - "regexp.prototype.flags@npm:^1.5.1": version: 1.5.1 resolution: "regexp.prototype.flags@npm:1.5.1" @@ -13746,20 +13284,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.14.2, resolve@npm:^1.20.0, resolve@npm:^1.9.0": - version: 1.22.0 - resolution: "resolve@npm:1.22.0" - dependencies: - is-core-module: "npm:^2.8.1" - path-parse: "npm:^1.0.7" - supports-preserve-symlinks-flag: "npm:^1.0.0" - bin: - resolve: bin/resolve - checksum: b2f7405d3092f8bb537105b364378698dd0e7428dd3e76a3f00424cdc0bf8a1d85c3f5dab036fd04154e29c8fc221a591697ec699eb1cbd37d9a628b8bb7ccf5 - languageName: node - linkType: hard - -"resolve@npm:^1.22.4": +"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.14.2, resolve@npm:^1.22.4, resolve@npm:^1.9.0": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -13772,20 +13297,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.12.0#optional!builtin, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.9.0#optional!builtin": - version: 1.22.0 - resolution: "resolve@patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d" - dependencies: - is-core-module: "npm:^2.8.1" - path-parse: "npm:^1.0.7" - supports-preserve-symlinks-flag: "npm:^1.0.0" - bin: - resolve: bin/resolve - checksum: cb53ccafb067fb04989dbff2ce7186d03f4a55b7283eab91b545d614b336dc509faa5c71210ce77ab1a4b0f7de4ffbccc170febcbeef40bf5a09b9ddb05bf447 - languageName: node - linkType: hard - -"resolve@patch:resolve@npm%3A^1.22.4#optional!builtin": +"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.12.0#optional!builtin, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin, resolve@patch:resolve@npm%3A^1.9.0#optional!builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d" dependencies: @@ -13911,16 +13423,7 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^7.2.0": - version: 7.8.0 - resolution: "rxjs@npm:7.8.0" - dependencies: - tslib: "npm:^2.1.0" - checksum: ff9359cc7875edecc8fc487481366b876b488901178cca8f2bdad03e00d2b5a19b01d2b02d3b4ebd47e574264db8460c6c2386076c3189b359b5e8c70a6e51e3 - languageName: node - linkType: hard - -"rxjs@npm:^7.8.0": +"rxjs@npm:^7.2.0, rxjs@npm:^7.8.0": version: 7.8.1 resolution: "rxjs@npm:7.8.1" dependencies: @@ -14406,7 +13909,7 @@ __metadata: languageName: node linkType: hard -"smart-buffer@npm:^4.1.0, smart-buffer@npm:^4.2.0": +"smart-buffer@npm:^4.2.0": version: 4.2.0 resolution: "smart-buffer@npm:4.2.0" checksum: 927484aa0b1640fd9473cee3e0a0bcad6fce93fd7bbc18bac9ad0c33686f5d2e2c422fba24b5899c184524af01e11dd2bd051c2bf2b07e47aff8ca72cbfc60d2 @@ -14423,10 +13926,13 @@ __metadata: languageName: node linkType: hard -"socket.io-adapter@npm:~2.4.0": - version: 2.4.0 - resolution: "socket.io-adapter@npm:2.4.0" - checksum: e10c8c36a1b0744432d9fb7266c69268fb11cacb548e95f5feb7708c1438c4c1e034abf3eee56dc3fd4d5524aba4e5a306a402f0c15efb1334be364a05bfad04 +"socket.io-adapter@npm:~2.5.2": + version: 2.5.5 + resolution: "socket.io-adapter@npm:2.5.5" + dependencies: + debug: "npm:~4.3.4" + ws: "npm:~8.17.1" + checksum: e364733a4c34ff1d4a02219e409bd48074fd614b7f5b0568ccfa30dd553252a5b9a41056931306a276891d13ea76a19e2c6f2128a4675c37323f642896874d80 languageName: node linkType: hard @@ -14440,17 +13946,18 @@ __metadata: languageName: node linkType: hard -"socket.io@npm:^4.4.1": - version: 4.5.2 - resolution: "socket.io@npm:4.5.2" +"socket.io@npm:^4.7.2": + version: 4.7.5 + resolution: "socket.io@npm:4.7.5" dependencies: accepts: "npm:~1.3.4" base64id: "npm:~2.0.0" + cors: "npm:~2.8.5" debug: "npm:~4.3.2" - engine.io: "npm:~6.2.0" - socket.io-adapter: "npm:~2.4.0" - socket.io-parser: "npm:~4.2.0" - checksum: 872605db0f8bb3fa78c54ba13b22dced2270a7a52967ef215c3121b93312606ec5e0862a6cde058a63ba23c404733e52d560c3ca73dc3d0c8cbed35bbae65731 + engine.io: "npm:~6.5.2" + socket.io-adapter: "npm:~2.5.2" + socket.io-parser: "npm:~4.2.4" + checksum: 911528f5bfdf83dbe2b154866884b736a7498f112f294a6f8420418fa11baadf08578869dab3e220c943094ff0d17b7f4587de3b1ad39679d9c12ed4cb226900 languageName: node linkType: hard @@ -14487,23 +13994,13 @@ __metadata: languageName: node linkType: hard -"socks@npm:^2.6.1": - version: 2.6.1 - resolution: "socks@npm:2.6.1" - dependencies: - ip: "npm:^1.1.5" - smart-buffer: "npm:^4.1.0" - checksum: 6ae166bd1ac4556618cd7d4034561174eda062cfbc1a8d1a214968c1cfb7861ab51f2e651175b5a168148505a3b7250bcec67eb0110878e2258a932aa0497204 - languageName: node - linkType: hard - -"socks@npm:^2.6.2, socks@npm:^2.7.1": - version: 2.7.1 - resolution: "socks@npm:2.7.1" +"socks@npm:^2.8.1": + version: 2.8.3 + resolution: "socks@npm:2.8.3" dependencies: - ip: "npm:^2.0.0" + ip-address: "npm:^9.0.5" smart-buffer: "npm:^4.2.0" - checksum: 5074f7d6a13b3155fa655191df1c7e7a48ce3234b8ccf99afa2ccb56591c195e75e8bb78486f8e9ea8168e95a29573cbaad55b2b5e195160ae4d2ea6811ba833 + checksum: ffcb622c22481dfcd7589aae71fbfd71ca34334064d181df64bf8b7feaeee19706aba4cffd1de35cc7bbaeeaa0af96be2d7f40fcbc7bc0ab69533a7ae9ffc4fb languageName: node linkType: hard @@ -14535,13 +14032,6 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.5.0": - version: 0.5.7 - resolution: "source-map@npm:0.5.7" - checksum: 9b4ac749ec5b5831cad1f8cc4c19c4298ebc7474b24a0acf293e2f040f03f8eeccb3d01f12aa0f90cf46d555c887e03912b83a042c627f419bda5152d89c5269 - languageName: node - linkType: hard - "source-map@npm:^0.6.0, source-map@npm:^0.6.1, source-map@npm:~0.6.1": version: 0.6.1 resolution: "source-map@npm:0.6.1" @@ -14645,6 +14135,13 @@ __metadata: languageName: node linkType: hard +"sprintf-js@npm:^1.1.3": + version: 1.1.3 + resolution: "sprintf-js@npm:1.1.3" + checksum: e7587128c423f7e43cc625fe2f87e6affdf5ca51c1cc468e910d8aaca46bb44a7fbcfa552f787b1d3987f7043aeb4527d1b99559e6621e01b42b3f45e5a24cbb + languageName: node + linkType: hard + "sprintf-js@npm:~1.0.2": version: 1.0.3 resolution: "sprintf-js@npm:1.0.3" @@ -14756,17 +14253,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trim@npm:^1.2.7": - version: 1.2.7 - resolution: "string.prototype.trim@npm:1.2.7" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.4" - es-abstract: "npm:^1.20.4" - checksum: a1b795bdb4b4b7d9399e99771e8a36493a30cf18095b0e8b36bcb211aad42dc59186c9a833c774f7a70429dbd3862818133d7e0da1547a0e9f0e1ebddf995635 - languageName: node - linkType: hard - "string.prototype.trim@npm:^1.2.8": version: 1.2.8 resolution: "string.prototype.trim@npm:1.2.8" @@ -14778,17 +14264,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trimend@npm:^1.0.6": - version: 1.0.6 - resolution: "string.prototype.trimend@npm:1.0.6" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.4" - es-abstract: "npm:^1.20.4" - checksum: 3893db9267e0b8a16658c3947738536e90c400a9b7282de96925d4e210174cfe66c59d6b7eb5b4a9aaa78ef7f5e46afb117e842d93112fbd105c8d19206d8092 - languageName: node - linkType: hard - "string.prototype.trimend@npm:^1.0.7": version: 1.0.7 resolution: "string.prototype.trimend@npm:1.0.7" @@ -14800,17 +14275,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trimstart@npm:^1.0.6": - version: 1.0.6 - resolution: "string.prototype.trimstart@npm:1.0.6" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.4" - es-abstract: "npm:^1.20.4" - checksum: 05e2cd06fa5311b17f5b2c7af0a60239fa210f4bb07bbcfce4995215dce330e2b1dd2d8030d371f46252ab637522e14b6e9a78384e8515945b72654c14261d54 - languageName: node - linkType: hard - "string.prototype.trimstart@npm:^1.0.7": version: 1.0.7 resolution: "string.prototype.trimstart@npm:1.0.7" @@ -14966,7 +14430,7 @@ __metadata: languageName: node linkType: hard -"supports-hyperlinks@npm:^2.0.0": +"supports-hyperlinks@npm:^2.0.0, supports-hyperlinks@npm:^2.2.0": version: 2.3.0 resolution: "supports-hyperlinks@npm:2.3.0" dependencies: @@ -14976,16 +14440,6 @@ __metadata: languageName: node linkType: hard -"supports-hyperlinks@npm:^2.2.0": - version: 2.2.0 - resolution: "supports-hyperlinks@npm:2.2.0" - dependencies: - has-flag: "npm:^4.0.0" - supports-color: "npm:^7.0.0" - checksum: a63f2acba5ba8088b155fb28fb6fed7de10c7dfe0593fe49c94b1f720031271df9dd917ddecb0cc68f69be678488c0f40697f2f1ae9ee969250af887115b15d0 - languageName: node - linkType: hard - "supports-preserve-symlinks-flag@npm:^1.0.0": version: 1.0.0 resolution: "supports-preserve-symlinks-flag@npm:1.0.0" @@ -15030,6 +14484,16 @@ __metadata: languageName: node linkType: hard +"systeminformation@npm:^5.22.11": + version: 5.22.11 + resolution: "systeminformation@npm:5.22.11" + bin: + systeminformation: lib/cli.js + checksum: 315cd3f2cc2aefbee9201fac043521d073e8c94a77f8900617dad67fdb798116fd2963a365d4d3da81dbca6da360d1f7008c61e1fe33ef9f8f3b77aa4f506014 + conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android) + languageName: node + linkType: hard + "table@npm:^6.8.1": version: 6.8.1 resolution: "table@npm:6.8.1" @@ -15085,31 +14549,17 @@ __metadata: languageName: node linkType: hard -"tar@npm:^6.0.5, tar@npm:^6.1.11": - version: 6.1.13 - resolution: "tar@npm:6.1.13" - dependencies: - chownr: "npm:^2.0.0" - fs-minipass: "npm:^2.0.0" - minipass: "npm:^4.0.0" - minizlib: "npm:^2.1.1" - mkdirp: "npm:^1.0.3" - yallist: "npm:^4.0.0" - checksum: add2c3c6d0d71192186ec118d265b92d94be5cd57a0b8fdf0d29ee46dc846574925a5fc57170eefffd78201eda4c45d7604070b5a4b0648e4d6e1d65918b5a82 - languageName: node - linkType: hard - -"tar@npm:^6.1.0, tar@npm:^6.1.2": - version: 6.1.11 - resolution: "tar@npm:6.1.11" +"tar@npm:^6.2.1": + version: 6.2.1 + resolution: "tar@npm:6.2.1" dependencies: chownr: "npm:^2.0.0" fs-minipass: "npm:^2.0.0" - minipass: "npm:^3.0.0" + minipass: "npm:^5.0.0" minizlib: "npm:^2.1.1" mkdirp: "npm:^1.0.3" yallist: "npm:^4.0.0" - checksum: 0e6789e66475922b8e0d1ee648cb26e0ede9a0635284269ca71b2d8acd507bc59ad5557032f0192f8ff22680b50cb66792b56f0240f484fe0d7d8cef81c1b959 + checksum: bfbfbb2861888077fc1130b84029cdc2721efb93d1d1fb80f22a7ac3a98ec6f8972f29e564103bbebf5e97be67ebc356d37fa48dbc4960600a1eb7230fbd1ea0 languageName: node linkType: hard @@ -15418,43 +14868,7 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:^10.4.0": - version: 10.4.0 - resolution: "ts-node@npm:10.4.0" - dependencies: - "@cspotcode/source-map-support": "npm:0.7.0" - "@tsconfig/node10": "npm:^1.0.7" - "@tsconfig/node12": "npm:^1.0.7" - "@tsconfig/node14": "npm:^1.0.0" - "@tsconfig/node16": "npm:^1.0.2" - acorn: "npm:^8.4.1" - acorn-walk: "npm:^8.1.1" - arg: "npm:^4.1.0" - create-require: "npm:^1.1.0" - diff: "npm:^4.0.1" - make-error: "npm:^1.1.1" - yn: "npm:3.1.1" - peerDependencies: - "@swc/core": ">=1.2.50" - "@swc/wasm": ">=1.2.50" - "@types/node": "*" - typescript: ">=2.7" - peerDependenciesMeta: - "@swc/core": - optional: true - "@swc/wasm": - optional: true - bin: - ts-node: dist/bin.js - ts-node-cwd: dist/bin-cwd.js - ts-node-script: dist/bin-script.js - ts-node-transpile-only: dist/bin-transpile.js - ts-script: dist/bin-script-deprecated.js - checksum: 5874ac27f66b684b24aa199105d347a8fa3e037b8737ff5918a2f94175ad0df5e426bb2f0f37727cdfdb4b15886d336c31fa1c28c71a4912fee0cddead02fc42 - languageName: node - linkType: hard - -"ts-node@npm:^10.9.1": +"ts-node@npm:^10.4.0, ts-node@npm:^10.9.1": version: 10.9.1 resolution: "ts-node@npm:10.9.1" dependencies: @@ -15548,21 +14962,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.3, tslib@npm:^2.1.0": - version: 2.4.1 - resolution: "tslib@npm:2.4.1" - checksum: e14311d5392ec0e3519feb9afdb54483d7f3aa2d3def6f1a1a30bd3deca5dfeadd106e80bee9ba880bce86a2e50854c9fe5958572cd188d7ac6f8625101a6a8f - languageName: node - linkType: hard - -"tslib@npm:^2.4.0": - version: 2.5.0 - resolution: "tslib@npm:2.5.0" - checksum: ea556fbdf396fe15dbd45e242754e86e7c36e0dce8644404a7c8a81ae1e940744dc639569aeca1ae370a7f804d82872f3fd8564eb23be9adb7618201d0314dac - languageName: node - linkType: hard - -"tslib@npm:^2.5.0": +"tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.5.0": version: 2.6.2 resolution: "tslib@npm:2.6.2" checksum: bd26c22d36736513980091a1e356378e8b662ded04204453d353a7f34a4c21ed0afc59b5f90719d4ba756e581a162ecbf93118dc9c6be5acf70aa309188166ca @@ -16313,7 +15713,7 @@ __metadata: languageName: node linkType: hard -"which-typed-array@npm:^1.1.11, which-typed-array@npm:^1.1.13": +"which-typed-array@npm:^1.1.11, which-typed-array@npm:^1.1.13, which-typed-array@npm:^1.1.2": version: 1.1.13 resolution: "which-typed-array@npm:1.1.13" dependencies: @@ -16326,20 +15726,6 @@ __metadata: languageName: node linkType: hard -"which-typed-array@npm:^1.1.2, which-typed-array@npm:^1.1.9": - version: 1.1.9 - resolution: "which-typed-array@npm:1.1.9" - dependencies: - available-typed-arrays: "npm:^1.0.5" - call-bind: "npm:^1.0.2" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-tostringtag: "npm:^1.0.0" - is-typed-array: "npm:^1.1.10" - checksum: 90ef760a09dcffc479138a6bc77fd2933a81a41d531f4886ae212f6edb54a0645a43a6c24de2c096aea910430035ac56b3d22a06f3d64e5163fa178d0f24e08e - languageName: node - linkType: hard - "which@npm:2.0.2, which@npm:^2.0.1, which@npm:^2.0.2": version: 2.0.2 resolution: "which@npm:2.0.2" @@ -16526,33 +15912,18 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7.4.5, ws@npm:^7.5.3": - version: 7.5.5 - resolution: "ws@npm:7.5.5" - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - checksum: 2e91fd634b470f3a39bd6a9ada5e398a411bd9a32bd10d11c4ceabb2e4fd28835aeb5187fd2fc489c3e65bfdab4c29187f083d6672d7aeba014ab8a3f5f1ece2 - languageName: node - linkType: hard - -"ws@npm:~8.11.0": - version: 8.11.0 - resolution: "ws@npm:8.11.0" +"ws@npm:^8.17.1": + version: 8.17.1 + resolution: "ws@npm:8.17.1" peerDependencies: bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 + utf-8-validate: ">=5.0.2" peerDependenciesMeta: bufferutil: optional: true utf-8-validate: optional: true - checksum: f759ea19e42f6d94727b3d8590693f2d92521a78ec2de5c6064c3356f50d4815d427b7ddb10bf39596cc67d3b18232a1b2dfbc3b6361d4772bdfec69d4c130f4 + checksum: 4264ae92c0b3e59c7e309001e93079b26937aab181835fb7af79f906b22cd33b6196d96556dafb4e985742dd401e99139572242e9847661fdbc96556b9e6902d languageName: node linkType: hard

( + drive, + core_rpc, + config, + INITIAL_PROTOCOL_VERSION, + INITIAL_PROTOCOL_VERSION, + ) } /// Open Platform with Drive and block execution context from saved state. @@ -218,23 +213,32 @@ impl Platform { drive: Drive, core_rpc: C, config: PlatformConfig, - serialized_platform_state: Vec, + mut platform_state: PlatformState, ) -> Result, Error> where C: CoreRPCLike, { - let platform_state = - PlatformState::deserialize_from_bytes_no_limit(&serialized_platform_state)?; + let height = platform_state.last_committed_block_height(); - PlatformVersion::set_current(PlatformVersion::get( - platform_state.current_protocol_version_in_consensus(), - )?); + // Set patched or original platform version as current + let platform_version = platform_state + .apply_all_patches_to_platform_version_up_to_height(height) + .transpose() + .unwrap_or_else(|| { + let platform_version = + PlatformVersion::get(platform_state.current_protocol_version_in_consensus()) + .map_err(Error::from); + + platform_version + })?; + + PlatformVersion::set_current(platform_version); let platform: Platform = Platform { drive, - state: RwLock::new(platform_state), + state: ArcSwap::new(Arc::new(platform_state)), + committed_block_height_guard: AtomicU64::from(height), config, - block_execution_context: RwLock::new(None), core_rpc, }; @@ -255,15 +259,18 @@ impl Platform { let platform_state = PlatformState::default_with_protocol_versions( current_protocol_version_in_consensus, next_epoch_protocol_version, - ); + &config, + )?; + + let height = platform_state.last_committed_block_height(); PlatformVersion::set_current(PlatformVersion::get(current_protocol_version_in_consensus)?); Ok(Platform { drive, - state: RwLock::new(platform_state), + state: ArcSwap::new(Arc::new(platform_state)), + committed_block_height_guard: AtomicU64::from(height), config, - block_execution_context: RwLock::new(None), core_rpc, }) } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index d4b08b9ecb8..626cf365010 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -1,9 +1,11 @@ +mod patch_platform_version; /// Version 0 pub mod v0; use crate::error::Error; use crate::platform_types::platform_state::v0::{ - PlatformStateForSavingV0, PlatformStateV0, PlatformStateV0Methods, + MasternodeListChanges, PlatformStateForSavingV0, PlatformStateV0, PlatformStateV0Methods, + PlatformStateV0PrivateMethods, }; use crate::platform_types::validator_set::ValidatorSet; @@ -13,19 +15,19 @@ use dpp::bincode::{config, Decode, Encode}; use dpp::block::epoch::Epoch; use dpp::block::extended_block_info::ExtendedBlockInfo; use dpp::dashcore::{ProTxHash, QuorumHash}; -use dpp::serialization::{ - PlatformDeserializable, PlatformDeserializableFromVersionedStructure, PlatformSerializable, -}; +use dpp::serialization::{PlatformDeserializableFromVersionedStructure, PlatformSerializable}; use dpp::util::deserializer::ProtocolVersion; use dpp::version::{PlatformVersion, TryFromPlatformVersioned, TryIntoPlatformVersioned}; use dpp::ProtocolError; -use dpp::ProtocolError::{PlatformDeserializationError, PlatformSerializationError}; use indexmap::IndexMap; +use crate::config::PlatformConfig; use crate::error::execution::ExecutionError; +use crate::platform_types::signature_verification_quorum_set::SignatureVerificationQuorumSet; use dpp::block::block_info::BlockInfo; -use dpp::util::hash::hash; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::util::hash::hash_double; use std::collections::BTreeMap; /// Platform state @@ -37,12 +39,21 @@ pub enum PlatformState { /// Platform state #[derive(Clone, Debug, Encode, Decode, From)] -enum PlatformStateForSaving { +pub enum PlatformStateForSaving { /// Version 0 V0(PlatformStateForSavingV0), } impl PlatformStateForSaving { + /// Retrieves the current protocol version used in consensus. + /// + /// Matches against `PlatformStateForSaving` variants to extract the protocol version. + /// + /// # Returns + /// A `ProtocolVersion` indicating the current consensus protocol version. + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub fn current_protocol_version_in_consensus(&self) -> ProtocolVersion { match self { PlatformStateForSaving::V0(v0) => v0.current_protocol_version_in_consensus, @@ -54,39 +65,20 @@ impl PlatformSerializable for PlatformState { type Error = Error; fn serialize_to_bytes(&self) -> Result, Self::Error> { - let platform_version = PlatformVersion::get(self.current_protocol_version_in_consensus())?; + let platform_version = self.current_platform_version()?; let config = config::standard().with_big_endian().with_no_limit(); let platform_state_for_saving: PlatformStateForSaving = self.clone().try_into_platform_versioned(platform_version)?; bincode::encode_to_vec(platform_state_for_saving, config).map_err(|e| { - PlatformSerializationError(format!("unable to serialize PlatformState: {}", e)).into() + ProtocolError::PlatformSerializationError(format!( + "unable to serialize PlatformState: {}", + e + )) + .into() }) } } -// The version we should deserialize this into is determined by the actual saved state -impl PlatformDeserializable for PlatformState { - fn deserialize_from_bytes_no_limit(data: &[u8]) -> Result - where - Self: Sized, - { - let config = config::standard().with_big_endian().with_no_limit(); - let platform_state_in_save_format: PlatformStateForSaving = - bincode::decode_from_slice(data, config) - .map_err(|e| { - PlatformDeserializationError(format!( - "unable to deserialize PlatformStateForSaving: {}", - e - )) - })? - .0; - let platform_version = PlatformVersion::get( - platform_state_in_save_format.current_protocol_version_in_consensus(), - )?; - platform_state_in_save_format.try_into_platform_versioned(platform_version) - } -} - impl PlatformDeserializableFromVersionedStructure for PlatformState { fn versioned_deserialize( data: &[u8], @@ -99,42 +91,40 @@ impl PlatformDeserializableFromVersionedStructure for PlatformState { let platform_state_in_save_format: PlatformStateForSaving = bincode::decode_from_slice(data, config) .map_err(|e| { - PlatformDeserializationError(format!( + ProtocolError::PlatformDeserializationError(format!( "unable to deserialize PlatformStateForSaving: {}", e )) })? .0; - platform_state_in_save_format.try_into_platform_versioned(platform_version) + + platform_state_in_save_format + .try_into_platform_versioned(platform_version) + .map_err(|e: Error| ProtocolError::Generic(e.to_string())) } } impl PlatformState { /// Get the state fingerprint - pub fn fingerprint(&self) -> [u8; 32] { - hash( - self.serialize_to_bytes() - .expect("expected to serialize state"), - ) - } - /// Get the current platform version - pub fn current_platform_version(&self) -> Result<&'static PlatformVersion, Error> { - Ok(PlatformVersion::get( - self.current_protocol_version_in_consensus(), - )?) + pub fn fingerprint(&self) -> Result<[u8; 32], Error> { + Ok(hash_double(self.serialize_to_bytes()?)) } /// The default state at platform start pub fn default_with_protocol_versions( current_protocol_version_in_consensus: ProtocolVersion, next_epoch_protocol_version: ProtocolVersion, - ) -> PlatformState { + config: &PlatformConfig, + ) -> Result { //todo find the current Platform state for the protocol version - PlatformStateV0::default_with_protocol_versions( + let state = PlatformStateV0::default_with_protocol_versions( current_protocol_version_in_consensus, next_epoch_protocol_version, - ) - .into() + config, + )? + .into(); + + Ok(state) } /// Retrieve version 0, or an error if not currently on version 0 @@ -183,7 +173,7 @@ impl TryFromPlatformVersioned for PlatformStateForSaving { } impl TryFromPlatformVersioned for PlatformState { - type Error = ProtocolError; + type Error = Error; fn try_from_platform_versioned( value: PlatformStateForSaving, @@ -193,92 +183,97 @@ impl TryFromPlatformVersioned for PlatformState { PlatformStateForSaving::V0(v0) => { match platform_version.drive_abci.structs.platform_state_structure { 0 => { - let platform_state_v0: PlatformStateV0 = v0.into(); + let platform_state_v0 = PlatformStateV0::from(v0); + Ok(platform_state_v0.into()) } - version => Err(ProtocolError::UnknownVersionMismatch { + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "PlatformState::try_from_platform_versioned(PlatformStateForSaving)" .to_string(), known_versions: vec![0], received: version, - }), + })), } } } } } -impl PlatformStateV0Methods for PlatformState { - fn height(&self) -> u64 { +impl PlatformStateV0PrivateMethods for PlatformState { + /// Set patched platform version. It's using to fix urgent bugs as not a part of normal upgrade process + /// The patched version returns from the public current_platform_version getter in case if present. + fn set_patched_platform_version(&mut self, version: Option<&'static PlatformVersion>) { match self { - PlatformState::V0(v0) => v0.height(), + PlatformState::V0(v0) => v0.patched_platform_version = version, } } +} - fn known_height_or(&self, default: u64) -> u64 { +impl PlatformStateV0Methods for PlatformState { + fn last_committed_block_height(&self) -> u64 { match self { - PlatformState::V0(v0) => v0.known_height_or(default), + PlatformState::V0(v0) => v0.last_committed_block_height(), } } - fn core_height(&self) -> u32 { + fn last_committed_known_block_height_or(&self, default: u64) -> u64 { match self { - PlatformState::V0(v0) => v0.core_height(), + PlatformState::V0(v0) => v0.last_committed_known_block_height_or(default), } } - fn known_core_height_or(&self, default: u32) -> u32 { + fn last_committed_core_height(&self) -> u32 { match self { - PlatformState::V0(v0) => v0.known_core_height_or(default), + PlatformState::V0(v0) => v0.last_committed_core_height(), } } - fn last_block_time_ms(&self) -> Option { + fn last_committed_known_core_height_or(&self, default: u32) -> u32 { match self { - PlatformState::V0(v0) => v0.last_block_time_ms(), + PlatformState::V0(v0) => v0.last_committed_known_core_height_or(default), } } - fn last_quorum_hash(&self) -> [u8; 32] { + fn last_committed_block_time_ms(&self) -> Option { match self { - PlatformState::V0(v0) => v0.last_quorum_hash(), + PlatformState::V0(v0) => v0.last_committed_block_time_ms(), } } - fn last_block_signature(&self) -> [u8; 96] { + fn last_committed_quorum_hash(&self) -> [u8; 32] { match self { - PlatformState::V0(v0) => v0.last_block_signature(), + PlatformState::V0(v0) => v0.last_committed_quorum_hash(), } } - fn last_block_app_hash(&self) -> Option<[u8; 32]> { + fn last_committed_block_proposer_pro_tx_hash(&self) -> [u8; 32] { match self { - PlatformState::V0(v0) => v0.last_block_app_hash(), + PlatformState::V0(v0) => v0.last_committed_block_proposer_pro_tx_hash(), } } - fn last_block_height(&self) -> u64 { + fn last_committed_block_signature(&self) -> [u8; 96] { match self { - PlatformState::V0(v0) => v0.last_block_height(), + PlatformState::V0(v0) => v0.last_committed_block_signature(), } } - fn last_block_round(&self) -> u32 { + fn last_committed_block_app_hash(&self) -> Option<[u8; 32]> { match self { - PlatformState::V0(v0) => v0.last_block_round(), + PlatformState::V0(v0) => v0.last_committed_block_app_hash(), } } - fn epoch(&self) -> Epoch { + fn last_committed_block_round(&self) -> u32 { match self { - PlatformState::V0(v0) => v0.epoch(), + PlatformState::V0(v0) => v0.last_committed_block_round(), } } - fn epoch_ref(&self) -> &Epoch { + fn last_committed_block_epoch(&self) -> Epoch { match self { - PlatformState::V0(v0) => v0.epoch_ref(), + PlatformState::V0(v0) => v0.last_committed_block_epoch(), } } @@ -294,15 +289,23 @@ impl PlatformStateV0Methods for PlatformState { } } + fn last_committed_block_info(&self) -> &Option { + match self { + PlatformState::V0(v0) => &v0.last_committed_block_info, + } + } + fn current_protocol_version_in_consensus(&self) -> ProtocolVersion { match self { PlatformState::V0(v0) => v0.current_protocol_version_in_consensus(), } } - fn last_committed_block_info(&self) -> &Option { + /// Patched platform version. Used to fix urgent bugs as not part of normal upgrade process. + /// The patched version returns from the public current_platform_version getter in case if present. + fn patched_platform_version(&self) -> Option<&'static PlatformVersion> { match self { - PlatformState::V0(v0) => &v0.last_committed_block_info, + PlatformState::V0(v0) => v0.patched_platform_version, } } @@ -324,12 +327,30 @@ impl PlatformStateV0Methods for PlatformState { } } + fn take_next_validator_set_quorum_hash(&mut self) -> Option { + match self { + PlatformState::V0(v0) => v0.take_next_validator_set_quorum_hash(), + } + } + fn validator_sets(&self) -> &IndexMap { match self { PlatformState::V0(v0) => &v0.validator_sets, } } + fn chain_lock_validating_quorums(&self) -> &SignatureVerificationQuorumSet { + match self { + PlatformState::V0(v0) => &v0.chain_lock_validating_quorums, + } + } + + fn instant_lock_validating_quorums(&self) -> &SignatureVerificationQuorumSet { + match self { + PlatformState::V0(v0) => v0.instant_lock_validating_quorums(), + } + } + fn full_masternode_list(&self) -> &BTreeMap { match self { PlatformState::V0(v0) => &v0.full_masternode_list, @@ -348,6 +369,12 @@ impl PlatformStateV0Methods for PlatformState { } } + fn last_block_info(&self) -> &BlockInfo { + match self { + PlatformState::V0(v0) => v0.last_block_info(), + } + } + fn set_last_committed_block_info(&mut self, info: Option) { match self { PlatformState::V0(v0) => v0.set_last_committed_block_info(info), @@ -384,6 +411,18 @@ impl PlatformStateV0Methods for PlatformState { } } + fn set_chain_lock_validating_quorums(&mut self, quorums: SignatureVerificationQuorumSet) { + match self { + PlatformState::V0(v0) => v0.set_chain_lock_validating_quorums(quorums), + } + } + + fn set_instant_lock_validating_quorums(&mut self, quorums: SignatureVerificationQuorumSet) { + match self { + PlatformState::V0(v0) => v0.set_instant_lock_validating_quorums(quorums), + } + } + fn set_full_masternode_list(&mut self, list: BTreeMap) { match self { PlatformState::V0(v0) => v0.set_full_masternode_list(list), @@ -438,6 +477,18 @@ impl PlatformStateV0Methods for PlatformState { } } + fn chain_lock_validating_quorums_mut(&mut self) -> &mut SignatureVerificationQuorumSet { + match self { + PlatformState::V0(v0) => v0.chain_lock_validating_quorums_mut(), + } + } + + fn instant_lock_validating_quorums_mut(&mut self) -> &mut SignatureVerificationQuorumSet { + match self { + PlatformState::V0(v0) => v0.instant_lock_validating_quorums_mut(), + } + } + fn full_masternode_list_mut(&mut self) -> &mut BTreeMap { match self { PlatformState::V0(v0) => v0.full_masternode_list_mut(), @@ -450,21 +501,43 @@ impl PlatformStateV0Methods for PlatformState { } } - fn take_next_validator_set_quorum_hash(&mut self) -> Option { + fn last_committed_block_epoch_ref(&self) -> &Epoch { match self { - PlatformState::V0(v0) => v0.take_next_validator_set_quorum_hash(), + PlatformState::V0(v0) => v0.last_committed_block_epoch_ref(), + } + } + + fn last_committed_block_id_hash(&self) -> [u8; 32] { + match self { + PlatformState::V0(v0) => v0.last_committed_block_id_hash(), + } + } + + fn full_masternode_list_changes(&self, previous: &PlatformState) -> MasternodeListChanges { + match (self, previous) { + (PlatformState::V0(v0), PlatformState::V0(v0_previous)) => { + v0.full_masternode_list_changes(v0_previous) + } + } + } + + fn hpmn_masternode_list_changes(&self, previous: &PlatformState) -> MasternodeListChanges { + match (self, previous) { + (PlatformState::V0(v0), PlatformState::V0(v0_previous)) => { + v0.hpmn_masternode_list_changes(v0_previous) + } } } - fn last_block_id_hash(&self) -> [u8; 32] { + fn previous_fee_versions(&self) -> &CachedEpochIndexFeeVersions { match self { - PlatformState::V0(v0) => v0.last_block_id_hash(), + PlatformState::V0(v0) => v0.previous_fee_versions(), } } - fn any_block_info(&self) -> &BlockInfo { + fn previous_fee_versions_mut(&mut self) -> &mut CachedEpochIndexFeeVersions { match self { - PlatformState::V0(v0) => v0.any_block_info(), + PlatformState::V0(v0) => v0.previous_fee_versions_mut(), } } } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/patch_platform_version.rs b/packages/rs-drive-abci/src/platform_types/platform_state/patch_platform_version.rs new file mode 100644 index 00000000000..ea85c30256a --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/platform_state/patch_platform_version.rs @@ -0,0 +1,144 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::prelude::BlockHeight; +use dpp::version::patches::PATCHES; +use dpp::version::PlatformVersion; +use dpp::version::INITIAL_PROTOCOL_VERSION; +use std::sync::atomic::{AtomicU32, Ordering}; + +use crate::platform_types::platform_state::v0::{ + PlatformStateV0Methods, PlatformStateV0PrivateMethods, +}; +use crate::platform_types::platform_state::PlatformState; + +static PATCHED_PROTOCOL_VERSION: AtomicU32 = AtomicU32::new(INITIAL_PROTOCOL_VERSION); + +impl PlatformState { + /// Apply all patches to platform version up to specified height + /// It changes protocol version to function version mapping to apply hotfixes + /// PlatformVersion can be already patched, so a patch will be applied on the top + /// + /// This function appends the patch to PlatformState and returns patched version + pub fn apply_all_patches_to_platform_version_up_to_height( + &mut self, + height: BlockHeight, + ) -> Result, Error> { + if self.patched_platform_version().is_some() { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "platform version already patched", + ))); + } + + let protocol_version = self.current_protocol_version_in_consensus(); + + let patches = PATCHES.read().unwrap(); + + // Find a patch that matches protocol version first + let Some(patches_per_heights) = patches.get(&protocol_version) else { + return Ok(None); + }; + + if patches_per_heights.is_empty() { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "patches per height can't be empty", + ))); + } + + let platform_version_to_patch = self.current_platform_version()?; + + let mut patched_version = platform_version_to_patch.clone(); + + // Apply all patches up to specified height + for (height, patch_fn) in patches_per_heights.range(..=height) { + patched_version = patch_fn(patched_version); + + tracing::debug!( + protocol_version, + height, + "Applied patch for platform version {} and height {:?}", + protocol_version, + height + ); + } + + // Make patch version as static ref to transparently replace original version + let boxed_version = Box::new(patched_version); + let static_patched_version: &'static PlatformVersion = Box::leak(boxed_version); + + // Set patched version to the Platform (execution) state that will be used + // instead of the current version + self.set_patched_platform_version(Some(static_patched_version)); + + Ok(Some(static_patched_version)) + } + + /// Apply a patch to platform version based on specified height + /// It changes protocol version to function version mapping to apply hotfixes + /// PlatformVersion can be already patched, so a patch will be applied on the top + /// + /// This function appends the patch to PlatformState and returns patched version + pub fn apply_platform_version_patch_for_height( + &mut self, + height: BlockHeight, + ) -> Result, Error> { + let protocol_version = self.current_protocol_version_in_consensus(); + + // If we switched protocol version we need to + // drop patched version from PlatformState + if self.patched_platform_version().is_some() { + let previous_protocol_version = PATCHED_PROTOCOL_VERSION.load(Ordering::Relaxed); + if previous_protocol_version != protocol_version { + tracing::debug!( + protocol_version, + height, + "Disable patches for platform version {} because we switched to version {}", + previous_protocol_version, + protocol_version, + ); + + self.set_patched_platform_version(None); + } + } + + let patches = PATCHES.read().unwrap(); + + // Find a patch that matches protocol version first + let Some(patches_per_heights) = patches.get(&protocol_version) else { + return Ok(None); + }; + + // Find a patch that matches block height + let Some(patch_fn) = patches_per_heights.get(&height) else { + return Ok(None); + }; + + // Potentially already patched version + let platform_version_to_patch = self.current_platform_version()?; + + // Apply the patch + let patched_version = patch_fn(platform_version_to_patch.clone()); + + // Make patch version as static ref to transparently replace original version + let boxed_version = Box::new(patched_version); + let static_patched_version: &'static PlatformVersion = Box::leak(boxed_version); + + // Set current protocol version if not set yet + if self.patched_platform_version().is_none() { + PATCHED_PROTOCOL_VERSION.store(protocol_version, Ordering::Relaxed); + } + + // Set patched version to the Platform (execution) state that will be used + // instead of the current version + self.set_patched_platform_version(Some(static_patched_version)); + + tracing::debug!( + protocol_version, + height, + "Applied patch for platform version {} and height {:?}", + protocol_version, + height + ); + + Ok(Some(static_patched_version)) + } +} diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index b15dce4743d..0ad2f2c179e 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -18,6 +18,13 @@ use crate::platform_types::validator_set::ValidatorSet; use dpp::block::block_info::{BlockInfo, DEFAULT_BLOCK_INFO}; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; + +use crate::config::PlatformConfig; +use crate::platform_types::signature_verification_quorum_set::{ + SignatureVerificationQuorumSet, SignatureVerificationQuorumSetForSaving, +}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use itertools::Itertools; use std::collections::BTreeMap; use std::fmt::{Debug, Formatter}; @@ -25,7 +32,7 @@ use std::fmt::{Debug, Formatter}; #[derive(Clone)] pub struct PlatformStateV0 { /// Information about the genesis block - pub genesis_block_info: Option, + pub genesis_block_info: Option, // TODO: we already have it in epoch 0 /// Information about the last block pub last_committed_block_info: Option, /// Current Version @@ -36,21 +43,35 @@ pub struct PlatformStateV0 { pub current_validator_set_quorum_hash: QuorumHash, /// next quorum pub next_validator_set_quorum_hash: Option, + /// This is a modified current platform version based on + /// `current_protocol_version_in_consensus` with some function versions + /// changed to fix an urgent bug that is not a part of normal upgrade process + pub patched_platform_version: Option<&'static PlatformVersion>, /// current validator set quorums /// The validator set quorums are a subset of the quorums, but they also contain the list of /// all members pub validator_sets: IndexMap, + /// Quorums used for validating chain locks (400 60 for mainnet) + pub chain_lock_validating_quorums: SignatureVerificationQuorumSet, + + /// Quorums used for validating instant locks + pub instant_lock_validating_quorums: SignatureVerificationQuorumSet, + /// current full masternode list pub full_masternode_list: BTreeMap, /// current HPMN masternode list pub hpmn_masternode_list: BTreeMap, + + /// previous Fee Versions + pub previous_fee_versions: CachedEpochIndexFeeVersions, } impl Debug for PlatformStateV0 { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("PlatformStateV0") + .field("genesis_block_info", &self.genesis_block_info) .field("last_committed_block_info", &self.last_committed_block_info) .field( "current_protocol_version_in_consensus", @@ -78,6 +99,14 @@ impl Debug for PlatformStateV0 { .field("full_masternode_list", &self.full_masternode_list) .field("hpmn_masternode_list", &self.hpmn_masternode_list) .field("initialization_information", &self.genesis_block_info) + .field( + "chain_lock_validating_quorums", + &self.chain_lock_validating_quorums, + ) + .field( + "instant_lock_validating_quorums", + &self.instant_lock_validating_quorums, + ) .finish() } } @@ -92,7 +121,7 @@ fn hex_encoded_validator_sets(validator_sets: &IndexMap, /// Information about the last block @@ -111,18 +140,27 @@ pub(super) struct PlatformStateForSavingV0 { #[bincode(with_serde)] pub validator_sets: Vec<(Bytes32, ValidatorSet)>, + /// The quorums used for validating chain locks + pub chain_lock_validating_quorums: SignatureVerificationQuorumSetForSaving, + + /// The quorums used for validating instant locks + pub instant_lock_validating_quorums: SignatureVerificationQuorumSetForSaving, + /// current full masternode list pub full_masternode_list: BTreeMap, /// current HPMN masternode list pub hpmn_masternode_list: BTreeMap, + + /// previous FeeVersions + pub previous_fee_versions: CachedEpochIndexFeeVersions, } impl TryFrom for PlatformStateForSavingV0 { type Error = Error; fn try_from(value: PlatformStateV0) -> Result { - let platform_version = PlatformVersion::get(value.current_protocol_version_in_consensus)?; + let platform_version = value.current_platform_version()?; Ok(PlatformStateForSavingV0 { genesis_block_info: value.genesis_block_info, last_committed_block_info: value.last_committed_block_info, @@ -140,6 +178,8 @@ impl TryFrom for PlatformStateForSavingV0 { .into_iter() .map(|(k, v)| (k.to_byte_array().into(), v)) .collect(), + chain_lock_validating_quorums: value.chain_lock_validating_quorums.into(), + instant_lock_validating_quorums: value.instant_lock_validating_quorums.into(), full_masternode_list: value .full_masternode_list .into_iter() @@ -160,6 +200,7 @@ impl TryFrom for PlatformStateForSavingV0 { )) }) .collect::, Error>>()?, + previous_fee_versions: value.previous_fee_versions, }) } } @@ -177,11 +218,14 @@ impl From for PlatformStateV0 { next_validator_set_quorum_hash: value .next_validator_set_quorum_hash .map(|bytes| QuorumHash::from_byte_array(bytes.to_buffer())), + patched_platform_version: None, validator_sets: value .validator_sets .into_iter() .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) .collect(), + chain_lock_validating_quorums: value.chain_lock_validating_quorums.into(), + instant_lock_validating_quorums: value.instant_lock_validating_quorums.into(), full_masternode_list: value .full_masternode_list .into_iter() @@ -192,6 +236,7 @@ impl From for PlatformStateV0 { .into_iter() .map(|(k, v)| (ProTxHash::from_byte_array(k.to_buffer()), v.into())) .collect(), + previous_fee_versions: value.previous_fee_versions, } } } @@ -201,45 +246,81 @@ impl PlatformStateV0 { pub(super) fn default_with_protocol_versions( current_protocol_version_in_consensus: ProtocolVersion, next_epoch_protocol_version: ProtocolVersion, - ) -> PlatformStateV0 { - PlatformStateV0 { + config: &PlatformConfig, + ) -> Result { + let platform_version = PlatformVersion::get(current_protocol_version_in_consensus)?; + + let state = PlatformStateV0 { last_committed_block_info: None, current_protocol_version_in_consensus, next_epoch_protocol_version, current_validator_set_quorum_hash: QuorumHash::all_zeros(), next_validator_set_quorum_hash: None, + patched_platform_version: None, validator_sets: Default::default(), + chain_lock_validating_quorums: SignatureVerificationQuorumSet::new( + &config.chain_lock, + platform_version, + )?, + instant_lock_validating_quorums: SignatureVerificationQuorumSet::new( + &config.instant_lock, + platform_version, + )?, full_masternode_list: Default::default(), hpmn_masternode_list: Default::default(), genesis_block_info: None, - } + previous_fee_versions: Default::default(), + }; + + Ok(state) } } +/// Masternode list Changes +#[derive(Debug, Clone)] +pub struct MasternodeListChanges { + /// The new masternodes + pub new_masternodes: Vec, + /// The removed masternodes + pub removed_masternodes: Vec, + /// The banned masternodes + pub banned_masternodes: Vec, + /// The unbanned masternodes + pub unbanned_masternodes: Vec, + /// the new masternodes that come in as banned + pub new_banned_masternodes: Vec, +} + +pub(super) trait PlatformStateV0PrivateMethods { + /// Set patched platform version. It's using to fix urgent bugs as not a part of normal upgrade process + /// The patched version returns from the public current_platform_version getter in case if present. + fn set_patched_platform_version(&mut self, version: Option<&'static PlatformVersion>); +} + /// Platform state methods introduced in version 0 of Platform State Struct pub trait PlatformStateV0Methods { + /// The last block height or 0 for genesis + fn last_committed_block_height(&self) -> u64; /// The height of the platform, only committed blocks increase height - fn height(&self) -> u64; - /// The height of the platform, only committed blocks increase height - fn known_height_or(&self, default: u64) -> u64; + fn last_committed_known_block_height_or(&self, default: u64) -> u64; /// The height of the core blockchain that Platform knows about through chain locks - fn core_height(&self) -> u32; + fn last_committed_core_height(&self) -> u32; /// The height of the core blockchain that Platform knows about through chain locks - fn known_core_height_or(&self, default: u32) -> u32; + fn last_committed_known_core_height_or(&self, default: u32) -> u32; /// The last block time in milliseconds - fn last_block_time_ms(&self) -> Option; + fn last_committed_block_time_ms(&self) -> Option; /// The last quorum hash - fn last_quorum_hash(&self) -> [u8; 32]; + fn last_committed_quorum_hash(&self) -> [u8; 32]; + /// The last block proposer pro tx hash + fn last_committed_block_proposer_pro_tx_hash(&self) -> [u8; 32]; /// The last block signature - fn last_block_signature(&self) -> [u8; 96]; + fn last_committed_block_signature(&self) -> [u8; 96]; /// The last block app hash - fn last_block_app_hash(&self) -> Option<[u8; 32]>; - /// The last block height or 0 for genesis - fn last_block_height(&self) -> u64; + fn last_committed_block_app_hash(&self) -> Option<[u8; 32]>; /// The last block round - fn last_block_round(&self) -> u32; + fn last_committed_block_round(&self) -> u32; /// The current epoch - fn epoch(&self) -> Epoch; + fn last_committed_block_epoch(&self) -> Epoch; /// HPMN list len fn hpmn_list_len(&self) -> usize; /// Get the current quorum @@ -248,7 +329,15 @@ pub trait PlatformStateV0Methods { fn last_committed_block_info(&self) -> &Option; /// Returns the current protocol version that is in consensus. fn current_protocol_version_in_consensus(&self) -> ProtocolVersion; - + /// Patched platform version. Used to fix urgent bugs as not part of normal upgrade process. + /// The patched version returns from the public current_platform_version getter in case if present. + fn patched_platform_version(&self) -> Option<&'static PlatformVersion>; + /// Get the current platform version or patched if present + fn current_platform_version(&self) -> Result<&'static PlatformVersion, Error> { + self.patched_platform_version().map(Ok).unwrap_or_else(|| { + PlatformVersion::get(self.current_protocol_version_in_consensus()).map_err(Error::from) + }) + } /// Returns the upcoming protocol version for the next epoch. fn next_epoch_protocol_version(&self) -> ProtocolVersion; @@ -264,6 +353,12 @@ pub trait PlatformStateV0Methods { /// Returns the current validator sets. fn validator_sets(&self) -> &IndexMap; + /// Returns the quorums used to validate chain locks. + fn chain_lock_validating_quorums(&self) -> &SignatureVerificationQuorumSet; + + /// Returns quorums used to validate instant locks. + fn instant_lock_validating_quorums(&self) -> &SignatureVerificationQuorumSet; + /// Returns the full list of masternodes. fn full_masternode_list(&self) -> &BTreeMap; @@ -274,7 +369,7 @@ pub trait PlatformStateV0Methods { fn genesis_block_info(&self) -> Option<&BlockInfo>; /// Returns the last committed block info if present or the genesis block info if not or default one - fn any_block_info(&self) -> &BlockInfo; + fn last_block_info(&self) -> &BlockInfo; /// Sets the last committed block info. fn set_last_committed_block_info(&mut self, info: Option); @@ -294,6 +389,12 @@ pub trait PlatformStateV0Methods { /// Sets the current validator sets. fn set_validator_sets(&mut self, sets: IndexMap); + /// Sets the current chain lock validating quorums. + fn set_chain_lock_validating_quorums(&mut self, quorums: SignatureVerificationQuorumSet); + + /// Sets the current instant lock validating quorums. + fn set_instant_lock_validating_quorums(&mut self, quorums: SignatureVerificationQuorumSet); + /// Sets the full masternode list. fn set_full_masternode_list(&mut self, list: BTreeMap); @@ -320,6 +421,12 @@ pub trait PlatformStateV0Methods { /// Returns a mutable reference to the current validator sets. fn validator_sets_mut(&mut self) -> &mut IndexMap; + /// Returns a mutable reference to the chain lock validating quorums. + fn chain_lock_validating_quorums_mut(&mut self) -> &mut SignatureVerificationQuorumSet; + + /// Returns a mutable reference to the instant lock validating quorums. + fn instant_lock_validating_quorums_mut(&mut self) -> &mut SignatureVerificationQuorumSet; + /// Returns a mutable reference to the full masternode list. fn full_masternode_list_mut(&mut self) -> &mut BTreeMap; @@ -327,14 +434,38 @@ pub trait PlatformStateV0Methods { fn hpmn_masternode_list_mut(&mut self) -> &mut BTreeMap; /// The epoch ref - fn epoch_ref(&self) -> &Epoch; + fn last_committed_block_epoch_ref(&self) -> &Epoch; /// The last block id hash - fn last_block_id_hash(&self) -> [u8; 32]; + fn last_committed_block_id_hash(&self) -> [u8; 32]; + + /// Returns reference to the previous feeversions + fn previous_fee_versions(&self) -> &CachedEpochIndexFeeVersions; + + /// Returns a mutable reference to the previous feeversions + fn previous_fee_versions_mut(&mut self) -> &mut CachedEpochIndexFeeVersions; + + /// The changes in the full masternode list between two platform states + fn full_masternode_list_changes(&self, previous: &Self) -> MasternodeListChanges + where + Self: Sized; + + /// The changes in the high performance masternode list (evonodes) between two platform states + fn hpmn_masternode_list_changes(&self, previous: &Self) -> MasternodeListChanges + where + Self: Sized; +} + +impl PlatformStateV0PrivateMethods for PlatformStateV0 { + /// Set patched platform version. It's using to fix urgent bugs as not a part of normal upgrade process + /// The patched version returns from the public current_platform_version getter in case if present. + fn set_patched_platform_version(&mut self, version: Option<&'static PlatformVersion>) { + self.patched_platform_version = version; + } } impl PlatformStateV0Methods for PlatformStateV0 { - /// The height of the platform, only committed blocks increase height - fn height(&self) -> u64 { + /// The last block height or 0 for genesis + fn last_committed_block_height(&self) -> u64 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().height) @@ -342,7 +473,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The height of the platform, only committed blocks increase height - fn known_height_or(&self, default: u64) -> u64 { + fn last_committed_known_block_height_or(&self, default: u64) -> u64 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().height) @@ -350,7 +481,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The height of the core blockchain that Platform knows about through chain locks - fn core_height(&self) -> u32 { + fn last_committed_core_height(&self) -> u32 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().core_height) @@ -363,7 +494,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The height of the core blockchain that Platform knows about through chain locks - fn known_core_height_or(&self, default: u32) -> u32 { + fn last_committed_known_core_height_or(&self, default: u32) -> u32 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().core_height) @@ -376,30 +507,30 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The last block time in milliseconds - fn last_block_time_ms(&self) -> Option { + fn last_committed_block_time_ms(&self) -> Option { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().time_ms) } /// The last quorum hash - fn last_quorum_hash(&self) -> [u8; 32] { + fn last_committed_quorum_hash(&self) -> [u8; 32] { self.last_committed_block_info .as_ref() .map(|block_info| *block_info.quorum_hash()) .unwrap_or_default() } - /// The last block id hash - fn last_block_id_hash(&self) -> [u8; 32] { + /// The last committed block proposer's pro tx hash + fn last_committed_block_proposer_pro_tx_hash(&self) -> [u8; 32] { self.last_committed_block_info .as_ref() - .map(|block_info| *block_info.block_id_hash()) + .map(|block_info| *block_info.proposer_pro_tx_hash()) .unwrap_or_default() } /// The last block signature - fn last_block_signature(&self) -> [u8; 96] { + fn last_committed_block_signature(&self) -> [u8; 96] { self.last_committed_block_info .as_ref() .map(|block_info| *block_info.signature()) @@ -407,22 +538,14 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The last block app hash - fn last_block_app_hash(&self) -> Option<[u8; 32]> { + fn last_committed_block_app_hash(&self) -> Option<[u8; 32]> { self.last_committed_block_info .as_ref() .map(|block_info| *block_info.app_hash()) } - /// The last block height or 0 for genesis - fn last_block_height(&self) -> u64 { - self.last_committed_block_info - .as_ref() - .map(|block_info| block_info.basic_info().height) - .unwrap_or_default() - } - /// The last block round - fn last_block_round(&self) -> u32 { + fn last_committed_block_round(&self) -> u32 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.round()) @@ -430,20 +553,13 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The current epoch - fn epoch(&self) -> Epoch { + fn last_committed_block_epoch(&self) -> Epoch { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().epoch) .unwrap_or_default() } - fn epoch_ref(&self) -> &Epoch { - self.last_committed_block_info - .as_ref() - .map(|block_info| &block_info.basic_info().epoch) - .unwrap_or(&EPOCH_0) - } - /// HPMN list len fn hpmn_list_len(&self) -> usize { self.hpmn_masternode_list.len() @@ -454,18 +570,25 @@ impl PlatformStateV0Methods for PlatformStateV0 { self.validator_sets .get(&self.current_validator_set_quorum_hash) .ok_or(Error::Execution(ExecutionError::CorruptedCachedState( - "current validator quorum hash not in current known validator sets", + format!("current_validator_set: current validator quorum hash {} not in current known validator sets {} last committed block is {} (we might be processing new block)", self.current_validator_set_quorum_hash.to_string(), self.validator_sets.keys().into_iter().map(|quorum_hash| quorum_hash.to_string()).join(" | "), + self.last_committed_block_info.as_ref().map(|block_info| block_info.basic_info().height).unwrap_or_default()), ))) } + /// Returns information about the last committed block. + fn last_committed_block_info(&self) -> &Option { + &self.last_committed_block_info + } + /// Get the current protocol version in consensus fn current_protocol_version_in_consensus(&self) -> ProtocolVersion { self.current_protocol_version_in_consensus } - /// Returns information about the last committed block. - fn last_committed_block_info(&self) -> &Option { - &self.last_committed_block_info + /// Patched platform version. Used to fix urgent bugs as not part of normal upgrade process. + /// The patched version returns from the public current_platform_version getter in case if present. + fn patched_platform_version(&self) -> Option<&'static PlatformVersion> { + self.patched_platform_version } /// Returns the upcoming protocol version for the next epoch. @@ -473,6 +596,11 @@ impl PlatformStateV0Methods for PlatformStateV0 { self.next_epoch_protocol_version } + /// Returns the quorum hash of the current validator set. + fn current_validator_set_quorum_hash(&self) -> QuorumHash { + self.current_validator_set_quorum_hash + } + /// Returns the quorum hash of the next validator set, if it exists. fn next_validator_set_quorum_hash(&self) -> &Option { &self.next_validator_set_quorum_hash @@ -488,24 +616,40 @@ impl PlatformStateV0Methods for PlatformStateV0 { &self.validator_sets } + /// Returns the quorums used to validate chain locks. + fn chain_lock_validating_quorums(&self) -> &SignatureVerificationQuorumSet { + &self.chain_lock_validating_quorums + } + + /// Returns the quorums used to validate instant locks. + fn instant_lock_validating_quorums(&self) -> &SignatureVerificationQuorumSet { + &self.instant_lock_validating_quorums + } + /// Returns the full list of masternodes. fn full_masternode_list(&self) -> &BTreeMap { &self.full_masternode_list } + /// Returns the list of high performance masternodes. + fn hpmn_masternode_list(&self) -> &BTreeMap { + &self.hpmn_masternode_list + } + /// Returns information about the platform initialization state, if it exists. fn genesis_block_info(&self) -> Option<&BlockInfo> { self.genesis_block_info.as_ref() } - /// Returns the quorum hash of the current validator set. - fn current_validator_set_quorum_hash(&self) -> QuorumHash { - self.current_validator_set_quorum_hash - } - - /// Returns the list of high performance masternodes. - fn hpmn_masternode_list(&self) -> &BTreeMap { - &self.hpmn_masternode_list + fn last_block_info(&self) -> &BlockInfo { + self.last_committed_block_info + .as_ref() + .map(|b| b.basic_info()) + .unwrap_or_else(|| { + self.genesis_block_info + .as_ref() + .unwrap_or(&DEFAULT_BLOCK_INFO) + }) } /// Sets the last committed block info. @@ -538,6 +682,16 @@ impl PlatformStateV0Methods for PlatformStateV0 { self.validator_sets = sets; } + /// Sets the current chain lock validating quorums. + fn set_chain_lock_validating_quorums(&mut self, quorums: SignatureVerificationQuorumSet) { + self.chain_lock_validating_quorums = quorums; + } + + /// Sets the current instant lock validating quorums. + fn set_instant_lock_validating_quorums(&mut self, quorums: SignatureVerificationQuorumSet) { + self.instant_lock_validating_quorums = quorums; + } + /// Sets the full masternode list. fn set_full_masternode_list(&mut self, list: BTreeMap) { self.full_masternode_list = list; @@ -577,6 +731,14 @@ impl PlatformStateV0Methods for PlatformStateV0 { &mut self.validator_sets } + fn chain_lock_validating_quorums_mut(&mut self) -> &mut SignatureVerificationQuorumSet { + &mut self.chain_lock_validating_quorums + } + + fn instant_lock_validating_quorums_mut(&mut self) -> &mut SignatureVerificationQuorumSet { + &mut self.instant_lock_validating_quorums + } + fn full_masternode_list_mut(&mut self) -> &mut BTreeMap { &mut self.full_masternode_list } @@ -585,14 +747,128 @@ impl PlatformStateV0Methods for PlatformStateV0 { &mut self.hpmn_masternode_list } - fn any_block_info(&self) -> &BlockInfo { + fn last_committed_block_epoch_ref(&self) -> &Epoch { self.last_committed_block_info .as_ref() - .map(|b| b.basic_info()) - .unwrap_or_else(|| { - self.genesis_block_info - .as_ref() - .unwrap_or(&DEFAULT_BLOCK_INFO) - }) + .map(|block_info| &block_info.basic_info().epoch) + .unwrap_or(&EPOCH_0) + } + + /// The last block id hash + fn last_committed_block_id_hash(&self) -> [u8; 32] { + self.last_committed_block_info + .as_ref() + .map(|block_info| *block_info.block_id_hash()) + .unwrap_or_default() + } + + /// Returns a reference to the previous feeversions + fn previous_fee_versions(&self) -> &CachedEpochIndexFeeVersions { + &self.previous_fee_versions + } + + /// Returns a mutable reference to the previous feeversions + fn previous_fee_versions_mut(&mut self) -> &mut CachedEpochIndexFeeVersions { + &mut self.previous_fee_versions + } + + fn full_masternode_list_changes(&self, previous: &PlatformStateV0) -> MasternodeListChanges { + let mut new_masternodes = Vec::new(); + let mut removed_masternodes = Vec::new(); + let mut banned_masternodes = Vec::new(); + let mut unbanned_masternodes = Vec::new(); + let mut new_banned_masternodes = Vec::new(); + + // Check for new, banned/unbanned, and new banned masternodes + for (pro_tx_hash, current_item) in &self.full_masternode_list { + if let Some(previous_item) = previous.full_masternode_list.get(pro_tx_hash) { + let current_ban_height = current_item.state.pose_ban_height; + let previous_ban_height = previous_item.state.pose_ban_height; + + if current_ban_height.is_some() && previous_ban_height.is_none() { + // Masternode was banned + banned_masternodes.push(*pro_tx_hash); + if previous_item.state.pose_ban_height.is_none() { + // New banned masternode + new_banned_masternodes.push(*pro_tx_hash); + } + } else if current_ban_height.is_none() && previous_ban_height.is_some() { + // Masternode was unbanned + unbanned_masternodes.push(*pro_tx_hash); + } + } else { + // New masternode + new_masternodes.push(*pro_tx_hash); + if current_item.state.pose_ban_height.is_some() { + // New banned masternode + new_banned_masternodes.push(*pro_tx_hash); + } + } + } + + // Check for removed masternodes + for pro_tx_hash in previous.full_masternode_list.keys() { + if !self.full_masternode_list.contains_key(pro_tx_hash) { + removed_masternodes.push(*pro_tx_hash); + } + } + + MasternodeListChanges { + new_masternodes, + removed_masternodes, + banned_masternodes, + unbanned_masternodes, + new_banned_masternodes, + } + } + + fn hpmn_masternode_list_changes(&self, previous: &PlatformStateV0) -> MasternodeListChanges { + let mut new_masternodes = Vec::new(); + let mut removed_masternodes = Vec::new(); + let mut banned_masternodes = Vec::new(); + let mut unbanned_masternodes = Vec::new(); + let mut new_banned_masternodes = Vec::new(); + + // Check for new, banned/unbanned, and new banned masternodes + for (pro_tx_hash, current_item) in &self.hpmn_masternode_list { + if let Some(previous_item) = previous.hpmn_masternode_list.get(pro_tx_hash) { + let current_ban_height = current_item.state.pose_ban_height; + let previous_ban_height = previous_item.state.pose_ban_height; + + if current_ban_height.is_some() && previous_ban_height.is_none() { + // Masternode was banned + banned_masternodes.push(*pro_tx_hash); + if previous_item.state.pose_ban_height.is_none() { + // New banned masternode + new_banned_masternodes.push(*pro_tx_hash); + } + } else if current_ban_height.is_none() && previous_ban_height.is_some() { + // Masternode was unbanned + unbanned_masternodes.push(*pro_tx_hash); + } + } else { + // New masternode + new_masternodes.push(*pro_tx_hash); + if current_item.state.pose_ban_height.is_some() { + // New banned masternode + new_banned_masternodes.push(*pro_tx_hash); + } + } + } + + // Check for removed masternodes + for pro_tx_hash in previous.hpmn_masternode_list.keys() { + if !self.hpmn_masternode_list.contains_key(pro_tx_hash) { + removed_masternodes.push(*pro_tx_hash); + } + } + + MasternodeListChanges { + new_masternodes, + removed_masternodes, + banned_masternodes, + unbanned_masternodes, + new_banned_masternodes, + } } } diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs new file mode 100644 index 00000000000..8d0eac3c0a3 --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs @@ -0,0 +1,141 @@ +mod v0; + +use crate::config::QuorumLikeConfig; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::signature_verification_quorum_set::v0::for_saving::SignatureVerificationQuorumSetForSavingV0; +pub use crate::platform_types::signature_verification_quorum_set::v0::quorum_set::{ + QuorumConfig, QuorumsWithConfig, SelectedQuorumSetIterator, SignatureVerificationQuorumSetV0, + SignatureVerificationQuorumSetV0Methods, SIGN_OFFSET, +}; +pub use crate::platform_types::signature_verification_quorum_set::v0::quorums::{ + Quorum, Quorums, SigningQuorum, ThresholdBlsPublicKey, VerificationQuorum, +}; +use bincode::{Decode, Encode}; +use derive_more::From; +use dpp::version::PlatformVersion; + +/// Quorums with keys for signature verification +#[derive(Debug, Clone, From)] +pub enum SignatureVerificationQuorumSet { + /// Version 0 of the signature verification quorums + V0(SignatureVerificationQuorumSetV0), +} + +impl SignatureVerificationQuorumSet { + /// Create a default SignatureVerificationQuorums + pub fn new( + config: &impl QuorumLikeConfig, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .structs + .signature_verification_quorum_set + { + 0 => Ok(SignatureVerificationQuorumSetV0::new(config).into()), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "SignatureVerificationQuorumSet.new".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +impl SignatureVerificationQuorumSetV0Methods for SignatureVerificationQuorumSet { + fn config(&self) -> &QuorumConfig { + match self { + Self::V0(v0) => v0.config(), + } + } + + fn set_current_quorums(&mut self, quorums: Quorums) { + match self { + Self::V0(v0) => v0.set_current_quorums(quorums), + } + } + + fn current_quorums(&self) -> &Quorums { + match self { + Self::V0(v0) => v0.current_quorums(), + } + } + + fn current_quorums_mut(&mut self) -> &mut Quorums { + match self { + Self::V0(v0) => v0.current_quorums_mut(), + } + } + + fn has_previous_past_quorums(&self) -> bool { + match self { + Self::V0(v0) => v0.has_previous_past_quorums(), + } + } + + fn replace_quorums( + &mut self, + quorums: Quorums, + last_active_core_height: u32, + updated_at_core_height: u32, + ) { + match self { + Self::V0(v0) => { + v0.replace_quorums(quorums, last_active_core_height, updated_at_core_height) + } + } + } + + fn set_previous_past_quorums( + &mut self, + previous_quorums: Quorums, + last_active_core_height: u32, + updated_at_core_height: u32, + ) { + match self { + Self::V0(v0) => v0.set_previous_past_quorums( + previous_quorums, + last_active_core_height, + updated_at_core_height, + ), + } + } + + fn select_quorums( + &self, + signing_height: u32, + verification_height: u32, + ) -> SelectedQuorumSetIterator { + match self { + Self::V0(v0) => v0.select_quorums(signing_height, verification_height), + } + } +} + +/// Core Quorum Set structure for saving to the database +#[derive(Debug, Clone, Encode, Decode)] +pub enum SignatureVerificationQuorumSetForSaving { + /// Version 0 of the signature verification quorums + V0(SignatureVerificationQuorumSetForSavingV0), +} + +impl From for SignatureVerificationQuorumSetForSaving { + fn from(value: SignatureVerificationQuorumSet) -> Self { + match value { + SignatureVerificationQuorumSet::V0(v0) => { + SignatureVerificationQuorumSetForSaving::V0(v0.into()) + } + } + } +} + +impl From for SignatureVerificationQuorumSet { + fn from(value: SignatureVerificationQuorumSetForSaving) -> Self { + match value { + SignatureVerificationQuorumSetForSaving::V0(v0) => { + SignatureVerificationQuorumSet::V0(v0.into()) + } + } + } +} diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs new file mode 100644 index 00000000000..a1ce283885a --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs @@ -0,0 +1,167 @@ +use crate::platform_types::signature_verification_quorum_set::v0::quorum_set::{ + PreviousPastQuorumsV0, QuorumConfig, +}; +use crate::platform_types::signature_verification_quorum_set::{ + Quorums, SignatureVerificationQuorumSetForSaving, SignatureVerificationQuorumSetV0, + ThresholdBlsPublicKey, VerificationQuorum, +}; +use dashcore_rpc::dashcore::hashes::Hash; +use dashcore_rpc::dashcore::QuorumHash; +use dashcore_rpc::json::QuorumType; +use dpp::identity::state_transition::asset_lock_proof::Encode; +use dpp::platform_serialization::de::Decode; +use dpp::platform_value::Bytes32; + +#[derive(Debug, Clone, Encode, Decode)] +pub struct SignatureVerificationQuorumSetForSavingV0 { + config: QuorumConfigForSavingV0, + current_quorums: Vec, + previous_quorums: Option, +} + +impl From for SignatureVerificationQuorumSetForSaving { + fn from(value: SignatureVerificationQuorumSetForSavingV0) -> Self { + SignatureVerificationQuorumSetForSaving::V0(value) + } +} + +impl From for SignatureVerificationQuorumSetForSavingV0 { + fn from(value: SignatureVerificationQuorumSetV0) -> Self { + let SignatureVerificationQuorumSetV0 { + config, + current_quorums, + previous, + } = value; + + Self { + config: config.into(), + current_quorums: current_quorums.into(), + previous_quorums: previous.map(|previous| previous.into()), + } + } +} + +impl From for SignatureVerificationQuorumSetV0 { + fn from(value: SignatureVerificationQuorumSetForSavingV0) -> Self { + let SignatureVerificationQuorumSetForSavingV0 { + config, + current_quorums, + previous_quorums, + } = value; + + Self { + config: config.into(), + current_quorums: current_quorums.into(), + previous: previous_quorums.map(|previous| previous.into()), + } + } +} + +#[derive(Debug, Clone, Encode, Decode)] +pub struct QuorumConfigForSavingV0 { + quorum_type: QuorumType, + active_signers: u16, + rotation: bool, + window: u32, +} + +impl From for QuorumConfigForSavingV0 { + fn from(config: QuorumConfig) -> Self { + Self { + quorum_type: config.quorum_type, + active_signers: config.active_signers, + rotation: config.rotation, + window: config.window, + } + } +} + +impl From for QuorumConfig { + fn from(config: QuorumConfigForSavingV0) -> Self { + Self { + quorum_type: config.quorum_type, + active_signers: config.active_signers, + rotation: config.rotation, + window: config.window, + } + } +} + +#[derive(Debug, Clone, Encode, Decode)] +pub struct PreviousPastQuorumsForSavingV0 { + quorums: Vec, + last_active_core_height: u32, + updated_at_core_height: u32, + previous_change_height: Option, +} + +impl From for PreviousPastQuorumsForSavingV0 { + fn from(value: PreviousPastQuorumsV0) -> Self { + let PreviousPastQuorumsV0 { + quorums, + last_active_core_height, + updated_at_core_height, + previous_change_height, + } = value; + + Self { + quorums: quorums.into(), + last_active_core_height, + updated_at_core_height, + previous_change_height, + } + } +} + +impl From for PreviousPastQuorumsV0 { + fn from(value: PreviousPastQuorumsForSavingV0) -> Self { + let PreviousPastQuorumsForSavingV0 { + quorums, + last_active_core_height: active_core_height, + updated_at_core_height, + previous_change_height, + } = value; + + Self { + quorums: quorums.into(), + last_active_core_height: active_core_height, + updated_at_core_height, + previous_change_height, + } + } +} + +#[derive(Debug, Clone, Encode, Decode)] +pub struct QuorumForSavingV0 { + hash: Bytes32, + #[bincode(with_serde)] + public_key: ThresholdBlsPublicKey, + index: Option, +} + +impl From> for Quorums { + fn from(value: Vec) -> Self { + Quorums::from_iter(value.into_iter().map(|quorum| { + ( + QuorumHash::from_byte_array(quorum.hash.to_buffer()), + VerificationQuorum { + public_key: quorum.public_key, + index: quorum.index, + }, + ) + })) + } +} + +#[allow(clippy::from_over_into)] +impl Into> for Quorums { + fn into(self) -> Vec { + self.into_iter() + .map(|(hash, quorum)| QuorumForSavingV0 { + hash: Bytes32::from(hash.as_byte_array()), + public_key: quorum.public_key, + index: quorum.index, + }) + .collect() + } +} diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs new file mode 100644 index 00000000000..e78d6c1c7f4 --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs @@ -0,0 +1,3 @@ +pub mod for_saving; +pub mod quorum_set; +pub mod quorums; diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorum_set.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorum_set.rs new file mode 100644 index 00000000000..93580229113 --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorum_set.rs @@ -0,0 +1,300 @@ +use crate::config::{ChainLockConfig, QuorumLikeConfig}; +use crate::platform_types::signature_verification_quorum_set::v0::quorums::Quorums; +use crate::platform_types::signature_verification_quorum_set::VerificationQuorum; +use dashcore_rpc::json::QuorumType; +use dpp::dashcore::QuorumHash; +use std::vec::IntoIter; + +/// Offset for signature verification +pub const SIGN_OFFSET: u32 = 8; + +/// Previously obtained quorums and heights. Required for signature verification +#[derive(Debug, Clone)] +pub(super) struct PreviousPastQuorumsV0 { + pub(super) quorums: Quorums, + + /// The core height at which these quorums were last active + pub(super) last_active_core_height: u32, + + /// The core height when the quorums were changed + pub(super) updated_at_core_height: u32, + + /// The core height the previous chain lock validating quorums became active + pub(super) previous_change_height: Option, +} + +/// Quorums with keys for signature verification +#[derive(Debug, Clone)] +pub struct SignatureVerificationQuorumSetV0 { + /// Quorum configuration + pub(super) config: QuorumConfig, + + /// Current quorums + pub(super) current_quorums: Quorums, + + /// The slightly old quorums used for validating ch ain locks (or instant locks), it's important to keep + /// these because validation of signatures happens for the quorums that are 8 blocks before the + /// height written in the chain lock. The same for instant locks + pub(super) previous: Option, +} + +/// The trait defines methods for the signature verification quorums structure v0 +pub trait SignatureVerificationQuorumSetV0Methods { + /// Config + fn config(&self) -> &QuorumConfig; + + /// Set current quorum keys + fn set_current_quorums(&mut self, quorums: Quorums); + + /// Current quorum + fn current_quorums(&self) -> &Quorums; + + /// Last quorum keys mutable + fn current_quorums_mut(&mut self) -> &mut Quorums; + + /// Has previous quorums? + fn has_previous_past_quorums(&self) -> bool; + + /// Set last quorums keys and update previous quorums + fn replace_quorums( + &mut self, + quorums: Quorums, + last_active_core_height: u32, + updated_at_core_height: u32, + ); + + /// Update previous quorums + fn set_previous_past_quorums( + &mut self, + previous_quorums: Quorums, + last_active_core_height: u32, + updated_at_core_height: u32, + ); + + /// Select quorums for signature verification based on sign and verification heights + fn select_quorums( + &self, + signing_height: u32, + verification_height: u32, + ) -> SelectedQuorumSetIterator; +} + +/// Iterator over selected quorum sets and specific quorums based on request_id and quorum configuration +#[derive(Clone)] +pub struct SelectedQuorumSetIterator<'q> { + /// Quorum configuration + config: &'q QuorumConfig, + /// Appropriate quorum sets + quorum_set: IntoIter<&'q Quorums>, + /// Should we expect signature verification to be successful + should_be_verifiable: bool, +} + +impl<'q> Iterator for SelectedQuorumSetIterator<'q> { + type Item = QuorumsWithConfig<'q>; + + fn next(&mut self) -> Option { + self.quorum_set.next().map(|quorums| QuorumsWithConfig { + quorums, + config: self.config, + }) + } +} + +/// Quorums with configuration +#[derive(Debug)] +pub struct QuorumsWithConfig<'q> { + /// Quorums + pub quorums: &'q Quorums, + /// Config + pub config: &'q QuorumConfig, +} + +impl<'q> QuorumsWithConfig<'q> { + /// Choose pseudorandom DIP8 or DIP24 quorum based on quorum config + /// and request_id + pub fn choose_quorum( + &self, + request_id: &[u8; 32], + ) -> Option<(QuorumHash, &VerificationQuorum)> { + self.quorums.choose_quorum(self.config, request_id) + } +} + +impl<'q> SelectedQuorumSetIterator<'q> { + /// Number of quorum sets + pub fn len(&self) -> usize { + self.quorum_set.len() + } + + /// Does the iterator have any quorum sets + pub fn is_empty(&self) -> bool { + self.quorum_set.len() == 0 + } + + /// Should we expect signature verification to be successful + pub fn should_be_verifiable(&self) -> bool { + self.should_be_verifiable + } +} + +/// Quorum configuration +#[derive(Debug, Clone)] +pub struct QuorumConfig { + /// Type + pub quorum_type: QuorumType, + /// Active quorum signers count + pub active_signers: u16, + /// Is it a DIP24 rotating quorum or classic + pub rotation: bool, + /// DKG interval + pub window: u32, +} + +impl SignatureVerificationQuorumSetV0Methods for SignatureVerificationQuorumSetV0 { + fn config(&self) -> &QuorumConfig { + &self.config + } + + fn set_current_quorums(&mut self, quorums: Quorums) { + self.current_quorums = quorums; + } + + fn current_quorums(&self) -> &Quorums { + &self.current_quorums + } + + fn current_quorums_mut(&mut self) -> &mut Quorums { + &mut self.current_quorums + } + + fn has_previous_past_quorums(&self) -> bool { + self.previous.is_some() + } + + fn replace_quorums( + &mut self, + quorums: Quorums, + last_active_height: u32, + updated_at_core_height: u32, + ) { + let previous_quorums = std::mem::replace(&mut self.current_quorums, quorums); + + self.set_previous_past_quorums( + previous_quorums, + last_active_height, + updated_at_core_height, + ); + } + + fn set_previous_past_quorums( + &mut self, + previous_quorums: Quorums, + last_active_core_height: u32, + updated_at_core_height: u32, + ) { + let previous_change_height = self + .previous + .as_ref() + .map(|previous| previous.updated_at_core_height); + + self.previous = Some(PreviousPastQuorumsV0 { + quorums: previous_quorums, + last_active_core_height, + updated_at_core_height, + previous_change_height, + }); + } + + fn select_quorums( + &self, + signing_height: u32, + verification_height: u32, + ) -> SelectedQuorumSetIterator { + let mut quorums = Vec::new(); + let mut should_be_verifiable = false; + + if let Some(previous) = &self.previous { + let previous_quorum_height = previous.last_active_core_height; + let change_quorum_height = previous.updated_at_core_height; + let previous_quorums_change_height = previous.previous_change_height; + + if signing_height > SIGN_OFFSET && verification_height >= change_quorum_height { + // in this case we are sure that we should be targeting the current quorum + // We updated core chain lock height from 100 to 105, new chain lock comes in for block 114 + // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 106 (new chain lock verification height 114 - 8) + // We are sure that we should use current quorums + // If we have + // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 105 (new chain lock verification height 113 - 8) + // We should also use current quorums, this is because at 105 we are sure new chain lock validating quorums are active + quorums.push(&self.current_quorums); + should_be_verifiable = true; + } else if signing_height > SIGN_OFFSET && verification_height <= previous_quorum_height + { + should_be_verifiable = previous_quorums_change_height + .map(|previous_quorums_change_height| { + verification_height > previous_quorums_change_height + }) + .unwrap_or(false); + // In this case the quorums were changed recently meaning that we should use the previous quorums to verify the chain lock + // We updated core chain lock height from 100 to 105, new chain lock comes in for block 106 + // -------- 98 (new chain lock verification height 106 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) + // We are sure that we should use previous quorums + // If we have + // -------- 100 (new chain lock verification height 108 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) + // We should also use previous quorums, this is because at 100 we are sure the old quorum set was active + quorums.push(&previous.quorums); + } else { + should_be_verifiable = previous_quorums_change_height + .map(|previous_quorums_change_height| { + verification_height > previous_quorums_change_height + }) + .unwrap_or(false); + // we are in between, so we don't actually know if it was the old one or the new one to be used. + // ------- 100 (previous_quorum_height) ------ 104 (new chain lock verification height 112 - 8) -------105 (change_quorum_height) + // we should just try both, starting with the current quorums + quorums.push(&self.current_quorums); + quorums.push(&previous.quorums); + } + } else { + quorums.push(&self.current_quorums); + } + + SelectedQuorumSetIterator { + config: &self.config, + quorum_set: quorums.into_iter(), + should_be_verifiable, + } + } +} + +impl SignatureVerificationQuorumSetV0 { + /// New empty quorum set based on quorum configuration + pub fn new(config: &impl QuorumLikeConfig) -> Self { + SignatureVerificationQuorumSetV0 { + config: QuorumConfig { + quorum_type: config.quorum_type(), + active_signers: config.quorum_active_signers(), + rotation: config.quorum_rotation(), + window: config.quorum_window(), + }, + current_quorums: Quorums::default(), + previous: None, + } + } +} + +impl From for SignatureVerificationQuorumSetV0 { + fn from(value: ChainLockConfig) -> Self { + SignatureVerificationQuorumSetV0 { + config: QuorumConfig { + quorum_type: value.quorum_type, + active_signers: value.quorum_active_signers, + rotation: value.quorum_rotation, + window: value.quorum_window, + }, + current_quorums: Quorums::default(), + previous: None, + } + } +} diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs new file mode 100644 index 00000000000..112b877a9b8 --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs @@ -0,0 +1,220 @@ +use derive_more::{Deref, DerefMut, From}; +use dpp::bls_signatures::PrivateKey; +use dpp::dashcore::bls_sig_utils::BLSSignature; +use dpp::dashcore::{QuorumHash, Txid}; +use std::collections::BTreeMap; +use std::convert::TryInto; +use std::fmt::Debug; + +pub use dpp::bls_signatures::PublicKey as ThresholdBlsPublicKey; + +use crate::error::Error; +use crate::platform_types::signature_verification_quorum_set::QuorumConfig; +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; + +/// Quorum per hash +#[derive(Clone, Deref, DerefMut, From)] +pub struct Quorums(BTreeMap); + +impl Default for Quorums { + fn default() -> Self { + Quorums::(BTreeMap::new()) + } +} + +impl FromIterator<(QuorumHash, Q)> for Quorums { + fn from_iter>(iter: T) -> Self { + Quorums::(BTreeMap::from_iter(iter)) + } +} + +impl IntoIterator for Quorums { + type Item = (QuorumHash, Q); + type IntoIter = std::collections::btree_map::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } +} + +impl Quorums { + /// Choose pseudorandom DIP8 or DIP24 quorum based on quorum config + /// and request_id + pub fn choose_quorum( + &self, + quorum_config: &QuorumConfig, + request_id: &[u8; 32], + ) -> Option<(QuorumHash, &Q)> { + if quorum_config.rotation { + self.choose_rotating_quorum(quorum_config, request_id) + } else { + self.choose_classic_quorum(quorum_config, request_id) + } + } + + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + fn choose_classic_quorum( + &self, + quorum_config: &QuorumConfig, + request_id: &[u8; 32], + ) -> Option<(QuorumHash, &Q)> { + // Scoring system logic + let mut scores: Vec<(&QuorumHash, &Q, [u8; 32])> = Vec::new(); + + for (quorum_hash, quorum) in self.0.iter() { + let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash_bytes.reverse(); + + let mut hasher = sha256d::Hash::engine(); + + // Serialize and hash the LLMQ type + hasher.input(&[quorum_config.quorum_type as u8]); + + // Serialize and add the quorum hash + hasher.input(quorum_hash_bytes.as_slice()); + + // Serialize and add the selection hash from the chain lock + hasher.input(request_id.as_slice()); + + // Finalize the hash + let hash_result = sha256d::Hash::from_engine(hasher); + scores.push((quorum_hash, quorum, hash_result.into())); + } + + if scores.is_empty() { + return None; + } + + scores.sort_by_key(|k| k.2); + + let (quorum_hash, quorum, _) = scores.remove(0); + + Some((*quorum_hash, quorum)) + } + + /// Based on DIP24 deterministically chooses a pseudorandom quorum from the list of quorums + fn choose_rotating_quorum( + &self, + quorum_config: &QuorumConfig, + request_id: &[u8; 32], + ) -> Option<(QuorumHash, &Q)> { + let active_signers = quorum_config.active_signers as u32; + + // binary (base-2) logarithm from active_signers + let n = 31 - active_signers.leading_zeros(); + + // Extract last 64 bits of request_id + let b = u64::from_le_bytes( + request_id[24..32] + .try_into() + .expect("request_id is [u8; 32]"), + ); + + // Take last n bits of b + let mask = (1u64 << n) - 1; + let signer = (mask & (b >> (64 - n - 1))) as u32; + + self.0 + .iter() + .find(|(_, quorum)| quorum.index() == Some(signer)) + .map(|(quorum_hash, quorum)| (*quorum_hash, quorum)) + } +} + +impl Debug for Quorums { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_map() + .entries( + self.0 + .iter() + .map(|(quorum_hash, quorum)| (quorum_hash.to_string(), quorum)), + ) + .finish() + } +} + +/// Quorum trait for Quorums collection +pub trait Quorum { + /// Index is present only for rotated quorums (DIP24) + fn index(&self) -> Option; +} + +/// Quorum for signature verification +#[derive(Clone)] +pub struct VerificationQuorum { + /// Index is present only for rotated quorums (DIP24) + pub index: Option, + + /// Quorum threshold public key is used to verify + /// signatures produced by corresponding quorum + pub public_key: ThresholdBlsPublicKey, +} + +impl Debug for VerificationQuorum { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("VerificationQuorum") + .field("index", &self.index) + .field( + "public_key", + &hex::encode(*self.public_key.to_bytes()).to_string(), + ) + .finish() + } +} + +impl Quorum for VerificationQuorum { + fn index(&self) -> Option { + self.index + } +} + +/// Quorum for signature verification +#[derive(Debug, Clone)] +pub struct SigningQuorum { + /// Index is present only for rotated quorums (DIP24) + pub index: Option, + + /// Quorum private key for signing + pub private_key: [u8; 32], +} + +impl Quorum for SigningQuorum { + fn index(&self) -> Option { + self.index + } +} + +impl SigningQuorum { + /// Signs a transition for instant lock + pub fn sign_for_instant_lock( + &self, + quorum_config: &QuorumConfig, + quorum_hash: &QuorumHash, + request_id: &[u8; 32], + transaction_id: &Txid, + ) -> Result { + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), txId). + // llmqType and quorumHash must be taken from the quorum selected in 1. + let mut engine = sha256d::Hash::engine(); + + let mut reversed_quorum_hash = quorum_hash.to_byte_array().to_vec(); + reversed_quorum_hash.reverse(); + + engine.input(&[quorum_config.quorum_type as u8]); + engine.input(reversed_quorum_hash.as_slice()); + engine.input(request_id); + engine.input(transaction_id.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + let private_key = + PrivateKey::from_bytes(&self.private_key, false).map_err(Error::BLSError)?; + + let g2element = private_key.sign(message_digest.as_ref()); + let g2element_bytes = *g2element.to_bytes(); + + Ok(BLSSignature::from(g2element_bytes)) + } +} diff --git a/packages/rs-drive-abci/src/platform_types/state_transition_execution_result/mod.rs b/packages/rs-drive-abci/src/platform_types/state_transition_execution_result/mod.rs deleted file mode 100644 index 7e1f072c3cd..00000000000 --- a/packages/rs-drive-abci/src/platform_types/state_transition_execution_result/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -use dpp::validation::SimpleConsensusValidationResult; - -use dpp::fee::fee_result::FeeResult; - -/// The Fee Result for a Dry Run (without state) -pub type DryRunFeeResult = FeeResult; - -/// An execution result -#[derive(Debug, Clone)] -pub enum StateTransitionExecutionResult { - /// Successfully executed a paid event - SuccessfulPaidExecution(DryRunFeeResult, FeeResult), - /// Successfully executed a free event - SuccessfulFreeExecution, - /// There were consensus errors when trying to execute an event - ConsensusExecutionError(SimpleConsensusValidationResult), -} - -// impl From> for ExecutionResult { -// fn from(value: ValidationResult) -> Self { -// let ValidationResult { errors, data } = value; -// if let Some(result) = data { -// if !errors.is_empty() { -// ConsensusExecutionError(SimpleValidationResult::new_with_errors(errors)) -// } else { -// result -// } -// } else { -// ConsensusExecutionError(SimpleValidationResult::new_with_errors(errors)) -// } -// } -// } diff --git a/packages/rs-drive-abci/src/platform_types/state_transitions_processing_result/mod.rs b/packages/rs-drive-abci/src/platform_types/state_transitions_processing_result/mod.rs new file mode 100644 index 00000000000..fdcfa1ed93d --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/state_transitions_processing_result/mod.rs @@ -0,0 +1,112 @@ +use dpp::consensus::ConsensusError; + +use crate::error::Error; +use crate::platform_types::event_execution_result::EstimatedFeeResult; +use dpp::fee::fee_result::FeeResult; + +/// The reason the state transition was not executed +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum NotExecutedReason { + /// The proposer ran out of time + ProposerRanOutOfTime, +} + +/// State Transition Execution Result represents a result of the single state transition execution. +/// There are five possible outcomes of the state transition execution described by this enum +#[derive(Debug, Clone, PartialEq)] +pub enum StateTransitionExecutionResult { + /// State Transition is invalid, but we have a proved identity associated with it, + /// and we can deduct processing fees calculated until this validation error happened + PaidConsensusError(ConsensusError, FeeResult), + /// State Transition is invalid, and is not paid for because we either : + /// * don't have a proved identity associated with it so we can't deduct balance. + /// * the state transition revision causes this transaction to not be valid + /// These state transitions can appear in prepare proposal but must never appear in process + /// proposal. + UnpaidConsensusError(ConsensusError), + /// State Transition execution failed due to the internal drive-abci error + InternalError(String), + /// State Transition was successfully executed + SuccessfulExecution(Option, FeeResult), + /// State Transition was not executed at all. + /// The only current reason for this is that the proposer reached the maximum time limit + NotExecuted(NotExecutedReason), +} + +/// State Transitions Processing Result produced by [process_raw_state_transitions] and represents +/// a result of a batch state transitions execution. It contains [StateTransitionExecutionResult] for +/// each state transition and aggregated fees. +#[derive(Debug, Default, Clone)] +pub struct StateTransitionsProcessingResult { + execution_results: Vec, + invalid_paid_count: usize, + invalid_unpaid_count: usize, + valid_count: usize, + failed_count: usize, + fees: FeeResult, +} + +impl StateTransitionsProcessingResult { + /// Add a new execution result + pub fn add(&mut self, execution_result: StateTransitionExecutionResult) -> Result<(), Error> { + match &execution_result { + StateTransitionExecutionResult::InternalError(_) => { + self.failed_count += 1; + } + StateTransitionExecutionResult::PaidConsensusError(_, actual_fees) => { + self.invalid_paid_count += 1; + self.fees.checked_add_assign(actual_fees.clone())?; + } + StateTransitionExecutionResult::UnpaidConsensusError(_) => { + self.invalid_unpaid_count += 1; + } + StateTransitionExecutionResult::SuccessfulExecution(_, actual_fees) => { + self.valid_count += 1; + + self.fees.checked_add_assign(actual_fees.clone())?; + } + StateTransitionExecutionResult::NotExecuted(_) => { + self.failed_count += 1; + } + } + + self.execution_results.push(execution_result); + + Ok(()) + } + + /// Returns the number of paid invalid state transitions + pub fn invalid_paid_count(&self) -> usize { + self.invalid_paid_count + } + + /// Returns the number of unpaid invalid state transitions + pub fn invalid_unpaid_count(&self) -> usize { + self.invalid_unpaid_count + } + + /// Returns the number of valid state transitions + pub fn valid_count(&self) -> usize { + self.valid_count + } + + /// Returns the number of failed state transitions + pub fn failed_count(&self) -> usize { + self.failed_count + } + + /// Returns the aggregated fees + pub fn aggregated_fees(&self) -> &FeeResult { + &self.fees + } + + /// Transform into the state transition execution results + pub fn into_execution_results(self) -> Vec { + self.execution_results + } + + /// State Transition execution results + pub fn execution_results(&self) -> &Vec { + &self.execution_results + } +} diff --git a/packages/rs-drive-abci/src/platform_types/system_identity_public_keys/mod.rs b/packages/rs-drive-abci/src/platform_types/system_identity_public_keys/mod.rs deleted file mode 100644 index ebeb142f0e9..00000000000 --- a/packages/rs-drive-abci/src/platform_types/system_identity_public_keys/mod.rs +++ /dev/null @@ -1,91 +0,0 @@ -use crate::platform_types::required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet; -use crate::platform_types::system_identity_public_keys::v0::{ - SystemIdentityPublicKeysV0, SystemIdentityPublicKeysV0Getters, - SystemIdentityPublicKeysV0Setters, -}; -use derive_more::From; -use serde::{Deserialize, Serialize}; - -/// Version 0 -pub mod v0; - -/// System identity public keys -#[derive(Serialize, Deserialize, Clone, Debug, From)] -pub enum SystemIdentityPublicKeys { - /// Version 0 - V0(SystemIdentityPublicKeysV0), -} - -impl SystemIdentityPublicKeysV0Getters for SystemIdentityPublicKeys { - fn masternode_reward_shares_contract_owner(&self) -> &RequiredIdentityPublicKeysSet { - match self { - SystemIdentityPublicKeys::V0(v0) => &v0.masternode_reward_shares_contract_owner, - } - } - - fn feature_flags_contract_owner(&self) -> &RequiredIdentityPublicKeysSet { - match self { - SystemIdentityPublicKeys::V0(v0) => &v0.feature_flags_contract_owner, - } - } - - fn dpns_contract_owner(&self) -> &RequiredIdentityPublicKeysSet { - match self { - SystemIdentityPublicKeys::V0(v0) => &v0.dpns_contract_owner, - } - } - - fn withdrawals_contract_owner(&self) -> &RequiredIdentityPublicKeysSet { - match self { - SystemIdentityPublicKeys::V0(v0) => &v0.withdrawals_contract_owner, - } - } - - fn dashpay_contract_owner(&self) -> &RequiredIdentityPublicKeysSet { - match self { - SystemIdentityPublicKeys::V0(v0) => &v0.dashpay_contract_owner, - } - } -} - -impl SystemIdentityPublicKeysV0Setters for SystemIdentityPublicKeys { - fn set_masternode_reward_shares_contract_owner(&mut self, keys: RequiredIdentityPublicKeysSet) { - match self { - SystemIdentityPublicKeys::V0(v0) => { - v0.masternode_reward_shares_contract_owner = keys; - } - } - } - - fn set_feature_flags_contract_owner(&mut self, keys: RequiredIdentityPublicKeysSet) { - match self { - SystemIdentityPublicKeys::V0(v0) => { - v0.feature_flags_contract_owner = keys; - } - } - } - - fn set_dpns_contract_owner(&mut self, keys: RequiredIdentityPublicKeysSet) { - match self { - SystemIdentityPublicKeys::V0(v0) => { - v0.dpns_contract_owner = keys; - } - } - } - - fn set_withdrawals_contract_owner(&mut self, keys: RequiredIdentityPublicKeysSet) { - match self { - SystemIdentityPublicKeys::V0(v0) => { - v0.withdrawals_contract_owner = keys; - } - } - } - - fn set_dashpay_contract_owner(&mut self, keys: RequiredIdentityPublicKeysSet) { - match self { - SystemIdentityPublicKeys::V0(v0) => { - v0.dashpay_contract_owner = keys; - } - } - } -} diff --git a/packages/rs-drive-abci/src/platform_types/system_identity_public_keys/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/system_identity_public_keys/v0/mod.rs deleted file mode 100644 index d80ba0b00d7..00000000000 --- a/packages/rs-drive-abci/src/platform_types/system_identity_public_keys/v0/mod.rs +++ /dev/null @@ -1,176 +0,0 @@ -use crate::abci::config::Keys; -use crate::platform_types::required_identity_public_key_set; -use serde::{Deserialize, Serialize}; - -/// System identity public keys -#[derive(Serialize, Deserialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -pub struct SystemIdentityPublicKeysV0 { - /// Required public key set for masternode reward shares contract owner identity - pub masternode_reward_shares_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - /// Required public key set for feature flags contract owner identity - pub feature_flags_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - /// Required public key set for dpns contract owner identity - pub dpns_contract_owner: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - /// Required public key set for withdrawals contract owner identity - pub withdrawals_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - /// Required public key set for dashpay contract owner identity - pub dashpay_contract_owner: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, -} - -impl From for SystemIdentityPublicKeysV0 { - fn from(keys: Keys) -> Self { - Self { - masternode_reward_shares_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - master: keys.masternode_reward_shares_master_public_key, - high: keys.masternode_reward_shares_second_public_key, - }, - feature_flags_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - master: keys.feature_flags_master_public_key, - high: keys.feature_flags_second_public_key, - }, - dpns_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - master: keys.dpns_master_public_key, - high: keys.dpns_second_public_key, - }, - withdrawals_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - master: keys.withdrawals_master_public_key, - high: keys.withdrawals_second_public_key, - }, - dashpay_contract_owner: - required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - master: keys.dashpay_master_public_key, - high: keys.dashpay_second_public_key, - }, - } - } -} - -/// Trait to get the fields of SystemIdentityPublicKeysV0 -pub trait SystemIdentityPublicKeysV0Getters { - /// Returns the required public key set for masternode reward shares contract owner identity - fn masternode_reward_shares_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet; - /// Returns the required public key set for feature flags contract owner identity - fn feature_flags_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet; - /// Returns the required public key set for dpns contract owner identity - fn dpns_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet; - /// Returns the required public key set for withdrawals contract owner identity - fn withdrawals_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet; - /// Returns the required public key set for dashpay contract owner identity - fn dashpay_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet; -} - -/// Trait to set the fields of SystemIdentityPublicKeysV0 -pub trait SystemIdentityPublicKeysV0Setters { - /// Sets the required public key set for masternode reward shares contract owner identity - fn set_masternode_reward_shares_contract_owner( - &mut self, - keys: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ); - /// Sets the required public key set for feature flags contract owner identity - fn set_feature_flags_contract_owner( - &mut self, - keys: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ); - /// Sets the required public key set for dpns contract owner identity - fn set_dpns_contract_owner( - &mut self, - keys: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ); - /// Sets the required public key set for withdrawals contract owner identity - fn set_withdrawals_contract_owner( - &mut self, - keys: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ); - /// Sets the required public key set for dashpay contract owner identity - fn set_dashpay_contract_owner( - &mut self, - keys: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ); -} - -impl SystemIdentityPublicKeysV0Getters for SystemIdentityPublicKeysV0 { - fn masternode_reward_shares_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - &self.masternode_reward_shares_contract_owner - } - - fn feature_flags_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - &self.feature_flags_contract_owner - } - - fn dpns_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - &self.dpns_contract_owner - } - - fn withdrawals_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - &self.withdrawals_contract_owner - } - - fn dashpay_contract_owner( - &self, - ) -> &required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet { - &self.dashpay_contract_owner - } -} - -impl SystemIdentityPublicKeysV0Setters for SystemIdentityPublicKeysV0 { - fn set_masternode_reward_shares_contract_owner( - &mut self, - owner: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ) { - self.masternode_reward_shares_contract_owner = owner; - } - - fn set_feature_flags_contract_owner( - &mut self, - owner: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ) { - self.feature_flags_contract_owner = owner; - } - - fn set_dpns_contract_owner( - &mut self, - owner: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ) { - self.dpns_contract_owner = owner; - } - - fn set_withdrawals_contract_owner( - &mut self, - owner: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ) { - self.withdrawals_contract_owner = owner; - } - - fn set_dashpay_contract_owner( - &mut self, - owner: required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet, - ) { - self.dashpay_contract_owner = owner; - } -} diff --git a/packages/rs-drive-abci/src/platform_types/validator_set/mod.rs b/packages/rs-drive-abci/src/platform_types/validator_set/mod.rs index 70fd7fe1067..5dd9adb1f83 100644 --- a/packages/rs-drive-abci/src/platform_types/validator_set/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/validator_set/mod.rs @@ -26,6 +26,12 @@ impl ValidatorSetV0Getters for ValidatorSet { } } + fn quorum_index(&self) -> Option { + match self { + ValidatorSet::V0(v0) => v0.quorum_index(), + } + } + fn core_height(&self) -> u32 { match self { ValidatorSet::V0(v0) => v0.core_height(), @@ -64,6 +70,12 @@ impl ValidatorSetV0Setters for ValidatorSet { } } + fn set_quorum_index(&mut self, index: Option) { + match self { + ValidatorSet::V0(v0) => v0.set_quorum_index(index), + } + } + fn set_core_height(&mut self, core_height: u32) { match self { ValidatorSet::V0(v0) => v0.set_core_height(core_height), diff --git a/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs index b8745e96fa9..7574a5d31db 100644 --- a/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs @@ -21,6 +21,8 @@ use tenderdash_abci::proto::{abci, crypto}; pub struct ValidatorSetV0 { /// The quorum hash pub quorum_hash: QuorumHash, + /// Rotation quorum index is available only for DIP24 quorums + pub quorum_index: Option, /// Active height pub core_height: u32, /// The list of masternodes @@ -57,19 +59,29 @@ impl ValidatorSetV0 { ) -> Result { if self.quorum_hash != rhs.quorum_hash { return Err(Error::Execution(ExecutionError::CorruptedCachedState( - "updating validator set doesn't match quorum hash", + format!( + "updating validator set doesn't match quorum hash ours: {} theirs: {}", + self.quorum_hash, rhs.quorum_hash + ), ))); } if self.core_height != rhs.core_height { return Err(Error::Execution(ExecutionError::CorruptedCachedState( - "updating validator set doesn't match core height", + format!( + "updating validator set doesn't match core height ours: {} theirs: {}", + self.core_height, rhs.core_height + ), ))); } if self.threshold_public_key != rhs.threshold_public_key { return Err(Error::Execution(ExecutionError::CorruptedCachedState( - "updating validator set doesn't match threshold public key", + format!( + "updating validator set doesn't match threshold public key ours: {} theirs: {}", + hex::encode(*self.threshold_public_key.to_bytes()), + hex::encode(*rhs.threshold_public_key.to_bytes()) + ), ))); } @@ -80,7 +92,10 @@ impl ValidatorSetV0 { rhs.members.get(pro_tx_hash).map_or_else( || { Some(Err(Error::Execution(ExecutionError::CorruptedCachedState( - "validator set does not contain all same members", + format!( + "validator set does not contain all same members, missing {}", + pro_tx_hash + ), )))) }, |new_validator_state| { @@ -284,6 +299,7 @@ impl ValidatorSetV0 { let QuorumInfoResult { height, quorum_hash, + quorum_index, quorum_public_key, members, .. @@ -319,8 +335,15 @@ impl ValidatorSetV0 { let threshold_public_key = BlsPublicKey::from_bytes(quorum_public_key.as_slice()) .map_err(ExecutionError::BlsErrorFromDashCoreResponse)?; + let optional_quorum_index = if quorum_index == 0 { + None + } else { + Some(quorum_index) + }; + Ok(ValidatorSetV0 { quorum_hash, + quorum_index: optional_quorum_index, core_height: height, members: validator_set, threshold_public_key, @@ -332,6 +355,8 @@ impl ValidatorSetV0 { pub trait ValidatorSetV0Getters { /// Returns the quorum hash of the validator set. fn quorum_hash(&self) -> &QuorumHash; + /// Returns rotation quorum index. It's available only for DIP24 quorums + fn quorum_index(&self) -> Option; /// Returns the active height of the validator set. fn core_height(&self) -> u32; /// Returns the members of the validator set. @@ -348,6 +373,8 @@ pub trait ValidatorSetV0Getters { pub trait ValidatorSetV0Setters { /// Sets the quorum hash of the validator set. fn set_quorum_hash(&mut self, quorum_hash: QuorumHash); + /// Sets the quorum index of the validator set. + fn set_quorum_index(&mut self, index: Option); /// Sets the active height of the validator set. fn set_core_height(&mut self, core_height: u32); /// Sets the members of the validator set. @@ -361,6 +388,10 @@ impl ValidatorSetV0Getters for ValidatorSetV0 { &self.quorum_hash } + fn quorum_index(&self) -> Option { + self.quorum_index + } + fn core_height(&self) -> u32 { self.core_height } @@ -387,6 +418,10 @@ impl ValidatorSetV0Setters for ValidatorSetV0 { self.quorum_hash = quorum_hash; } + fn set_quorum_index(&mut self, index: Option) { + self.quorum_index = index; + } + fn set_core_height(&mut self, core_height: u32) { self.core_height = core_height; } diff --git a/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/mod.rs b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/mod.rs new file mode 100644 index 00000000000..d09310b584f --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/mod.rs @@ -0,0 +1,2 @@ +/// V0 +pub mod v0; diff --git a/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs new file mode 100644 index 00000000000..57d0293ba8b --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs @@ -0,0 +1,12 @@ +/// A structure for returning the result of verification of a chain lock +pub struct VerifyChainLockResult { + /// If the chain lock signature represents a valid G2 BLS Element + pub(crate) chain_lock_signature_is_deserializable: bool, + /// If the chain lock was found to be valid based on platform state + pub(crate) found_valid_locally: Option, + /// If we were not able to validate based on platform state - ie the chain lock is too far in + /// the future + pub(crate) found_valid_by_core: Option, + /// Core is synced + pub(crate) core_is_synced: Option, +} diff --git a/packages/rs-drive-abci/src/platform_types/withdrawal/mod.rs b/packages/rs-drive-abci/src/platform_types/withdrawal/mod.rs index 39627a36d3d..ec9a669431d 100644 --- a/packages/rs-drive-abci/src/platform_types/withdrawal/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/withdrawal/mod.rs @@ -1 +1,2 @@ -pub(crate) mod withdrawal_txs; +/// Collection of unsigned withdrawal transactions +pub mod unsigned_withdrawal_txs; diff --git a/packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/mod.rs b/packages/rs-drive-abci/src/platform_types/withdrawal/unsigned_withdrawal_txs/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/mod.rs rename to packages/rs-drive-abci/src/platform_types/withdrawal/unsigned_withdrawal_txs/mod.rs diff --git a/packages/rs-drive-abci/src/platform_types/withdrawal/unsigned_withdrawal_txs/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/withdrawal/unsigned_withdrawal_txs/v0/mod.rs new file mode 100644 index 00000000000..0d61d4e471e --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/withdrawal/unsigned_withdrawal_txs/v0/mod.rs @@ -0,0 +1,142 @@ +//! Withdrawal transactions definitions and processing +use dpp::dashcore::consensus::Encodable; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::transaction::special_transaction::TransactionPayload::AssetUnlockPayloadType; +use dpp::dashcore::{Transaction, VarInt}; +use std::fmt::Display; +use tenderdash_abci::proto::types::VoteExtension; +use tenderdash_abci::proto::{abci::ExtendVoteExtension, types::VoteExtensionType}; + +/// Collection of withdrawal transactions processed at some height/round +#[derive(Debug, Default, Clone)] +pub struct UnsignedWithdrawalTxs(Vec); + +impl UnsignedWithdrawalTxs { + /// Returns iterator over borrowed withdrawal transactions + pub fn iter(&self) -> std::slice::Iter { + self.0.iter() + } + /// Returns a number of withdrawal transactions + pub fn len(&self) -> usize { + self.0.len() + } + /// Returns a reference to the first withdrawal transaction + pub fn first(&self) -> Option<&Transaction> { + self.0.first() + } + /// Returns a reference to the last withdrawal transaction + pub fn last(&self) -> Option<&Transaction> { + self.0.last() + } + /// Returns true if there are no withdrawal transactions + pub fn is_empty(&self) -> bool { + self.0.is_empty() + } + /// Creates a new collection of withdrawal transactions for Vec + pub fn from_vec(transactions: Vec) -> Self { + Self(transactions) + } + /// Drains all withdrawal transactions from the collection + + pub fn drain(&mut self) -> UnsignedWithdrawalTxs { + Self(self.0.drain(..).collect()) + } + + /// Appends another collection of unsigned withdrawal transactions + pub fn append(&mut self, mut other: Self) { + self.0.append(&mut other.0); + } + + /// Verifies that the collection of unsigned withdrawal transactions matches the given votes extensions + /// created based on these transactions + pub fn are_matching_with_vote_extensions(&self, other: &[VoteExtension]) -> bool { + if self.0.len() != other.len() { + return false; + }; + + !self.0.iter().zip(other.iter()).any(|(tx, vote_extension)| { + let extend_vote_extension = tx_to_extend_vote_extension(tx); + + vote_extension.r#type != extend_vote_extension.r#type + || vote_extension.sign_request_id != extend_vote_extension.sign_request_id + || vote_extension.extension != extend_vote_extension.extension + }) + } +} + +impl IntoIterator for UnsignedWithdrawalTxs { + type Item = Transaction; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } +} + +impl Display for UnsignedWithdrawalTxs { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_fmt(format_args!("txs:["))?; + for tx in &self.0 { + f.write_fmt(format_args!("{}", tx.txid().to_hex()))?; + } + f.write_str("]\n")?; + Ok(()) + } +} + +impl PartialEq<[ExtendVoteExtension]> for UnsignedWithdrawalTxs { + fn eq(&self, other: &[ExtendVoteExtension]) -> bool { + if self.0.len() != other.len() { + return false; + }; + + !self + .0 + .iter() + .zip(other.iter()) + .any(|(tx, other_vote_extension)| { + let self_vote_extension = tx_to_extend_vote_extension(tx); + + &self_vote_extension != other_vote_extension + }) + } +} + +impl From<&UnsignedWithdrawalTxs> for Vec { + fn from(value: &UnsignedWithdrawalTxs) -> Self { + value + .0 + .iter() + .map(tx_to_extend_vote_extension) + .collect::>() + } +} + +fn tx_to_extend_vote_extension(tx: &Transaction) -> ExtendVoteExtension { + let request_id = make_extend_vote_request_id(tx); + let extension = tx.txid().as_byte_array().to_vec(); + + ExtendVoteExtension { + r#type: VoteExtensionType::ThresholdRecoverRaw as i32, + extension, + sign_request_id: Some(request_id), + } +} + +pub(crate) fn make_extend_vote_request_id(asset_unlock_tx: &Transaction) -> Vec { + let Some(AssetUnlockPayloadType(ref payload)) = asset_unlock_tx.special_transaction_payload + else { + panic!("expected to get AssetUnlockPayloadType"); + }; + + let mut request_id = vec![]; + const ASSET_UNLOCK_REQUEST_ID_PREFIX: &str = "plwdtx"; + let prefix_len = VarInt(ASSET_UNLOCK_REQUEST_ID_PREFIX.len() as u64); + let index = payload.base.index.to_le_bytes(); + + prefix_len.consensus_encode(&mut request_id).unwrap(); + request_id.extend_from_slice(ASSET_UNLOCK_REQUEST_ID_PREFIX.as_bytes()); + request_id.extend_from_slice(&index); + + request_id +} diff --git a/packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs deleted file mode 100644 index 0293eb65f12..00000000000 --- a/packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs +++ /dev/null @@ -1,290 +0,0 @@ -//! Withdrawal transactions definitions and processing -use crate::abci::AbciError; -use dashcore_rpc::dashcore_rpc_json::QuorumType; -use dpp::block::block_info::BlockInfo; -use dpp::bls_signatures; -use dpp::fee::fee_result::FeeResult; -use dpp::validation::SimpleValidationResult; -use dpp::version::PlatformVersion; -use drive::{ - drive::{batch::DriveOperation, Drive}, - query::TransactionArg, -}; -use std::fmt::Display; -use tenderdash_abci::proto::{ - abci::ExtendVoteExtension, - types::{VoteExtension, VoteExtensionType}, -}; -use tenderdash_abci::signatures::SignDigest; - -const MAX_WITHDRAWAL_TXS: u16 = 16; - -/// Collection of withdrawal transactions processed at some height/round -#[derive(Debug)] -pub struct WithdrawalTxs<'a> { - inner: Vec, - drive_operations: Vec>, -} - -impl<'a> WithdrawalTxs<'a> { - /// Load pending withdrawal transactions from database - pub fn load(transaction: TransactionArg, drive: &Drive) -> Result { - let mut drive_operations = Vec::::new(); - - let inner = drive - .dequeue_withdrawal_transactions(MAX_WITHDRAWAL_TXS, transaction, &mut drive_operations) - .map_err(|e| AbciError::WithdrawalTransactionsDBLoadError(e.to_string()))? - .into_iter() - .map(|(_k, v)| VoteExtension { - r#type: VoteExtensionType::ThresholdRecover.into(), - extension: v, - signature: Default::default(), - }) - .collect::>(); - - Ok(Self { - drive_operations, - inner, - }) - } - - /// Basic validation of withdrawals. - /// - /// TODO: validate signature, etc. - pub fn validate(&self) -> Result<(), AbciError> { - if self.drive_operations.len() != self.inner.len() { - return Err(AbciError::InvalidState(format!( - "num of drive operations {} must match num of withdrawal transactions {}", - self.drive_operations.len(), - self.inner.len(), - ))); - } - - Ok(()) - } - - /// Finalize operations related to this withdrawal, as part of FinalizeBlock logic. - /// - /// Deletes withdrawal transactions that were executed. - pub fn finalize( - &self, - transaction: TransactionArg, - drive: &Drive, - block_info: &BlockInfo, - platform_version: &PlatformVersion, - ) -> Result { - self.validate()?; - // TODO: Do we need to do sth with withdrawal txs to actually execute them? - // FIXME: check if this is correct, esp. "apply" arg - drive - .apply_drive_operations( - self.drive_operations.clone(), - true, - block_info, - transaction, - platform_version, - ) - .map_err(|e| AbciError::WithdrawalTransactionsDBLoadError(e.to_string())) - } -} - -impl<'a> WithdrawalTxs<'a> { - /// Convert withdrawal transactions to vector of ExtendVoteExtension - pub fn to_vec(&self) -> Vec { - self.inner - .iter() - .map(|v| ExtendVoteExtension { - r#type: v.r#type, - extension: v.extension.clone(), - }) - .collect::>() - } - /// Convert withdrawal transactions to vector of ExtendVoteExtension - pub fn into_vec(self) -> Vec { - self.inner - .into_iter() - .map(|v| ExtendVoteExtension { - r#type: v.r#type, - extension: v.extension, - }) - .collect::>() - } - - /// Verify signatures of all withdrawal TXs - /// - /// ## Return value - /// - /// There are the following types of errors during verification: - /// - /// 1. The signature was invalid, most likely due to change in the data; in this case, - /// [AbciError::VoteExtensionsSignatureInvalid] is returned. - /// 2. Signature or public key is malformed - in this case, [AbciError::BlsErrorOfTenderdashThresholdMechanism] is returned - /// 3. Provided data is invalid - [AbciError::TenderdashProto] is returned - /// - /// As all these conditions, in normal circumstances, should cause processing to be terminated, they are all - /// treated as errors. - pub fn verify_signatures( - &self, - chain_id: &str, - quorum_type: QuorumType, - quorum_hash: &[u8], - height: u64, - round: u32, - public_key: &bls_signatures::PublicKey, - ) -> SimpleValidationResult { - for s in &self.inner { - let hash = match s.sign_digest( - chain_id, - quorum_type as u8, - quorum_hash.try_into().expect("invalid quorum hash length"), - height as i64, - round as i32, - ) { - Ok(h) => h, - Err(e) => return SimpleValidationResult::new_with_error(AbciError::Tenderdash(e)), - }; - - let signature = match bls_signatures::Signature::from_bytes(&s.signature) { - Ok(s) => s, - Err(e) => { - return SimpleValidationResult::new_with_error( - AbciError::BlsErrorOfTenderdashThresholdMechanism( - e, - "signature withdrawal verification".to_string(), - ), - ) - } - }; - - if !public_key.verify(&signature, &hash) { - return SimpleValidationResult::new_with_error( - AbciError::VoteExtensionsSignatureInvalid, - ); - } - } - - SimpleValidationResult::default() - } -} - -impl<'a> Display for WithdrawalTxs<'a> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!("txs:["))?; - for item in &self.inner { - f.write_fmt(format_args!( - "tx:{},sig:{}\n", - hex::encode(&item.extension), - hex::encode(&item.signature) - ))?; - } - f.write_str("]\n")?; - Ok(()) - } -} -impl<'a> From> for WithdrawalTxs<'a> { - fn from(value: Vec) -> Self { - WithdrawalTxs { - inner: value - .into_iter() - .map(|v| VoteExtension { - r#type: v.r#type, - extension: v.extension, - signature: Default::default(), - }) - .collect::>(), - drive_operations: Vec::::new(), - } - } -} - -impl<'a> From<&Vec> for WithdrawalTxs<'a> { - fn from(value: &Vec) -> Self { - WithdrawalTxs { - inner: value.clone(), - drive_operations: Vec::::new(), - } - } -} - -impl<'a> PartialEq for WithdrawalTxs<'a> { - /// Two sets of withdrawal transactions are equal if all their inner raw transactions are equal. - /// - /// ## Notes - /// - /// 1. We don't compare `drive_operations`, as this is internal utility fields - /// 2. For a transaction, we don't compare signatures if at least one of them is empty - fn eq(&self, other: &Self) -> bool { - if self.inner.len() != other.inner.len() { - return false; - } - - std::iter::zip(&self.inner, &other.inner).all(|(left, right)| { - left.r#type == right.r#type - && left.extension == right.extension - && (left.signature.is_empty() - || right.signature.is_empty() - || left.signature == right.signature) - }) - } -} -#[cfg(test)] -mod test { - use dashcore_rpc::dashcore_rpc_json::QuorumType; - use dpp::bls_signatures; - use tenderdash_abci::proto::types::{VoteExtension, VoteExtensionType}; - - #[test] - fn verify_signature() { - const HEIGHT: u64 = 100; - const ROUND: u32 = 0; - const CHAIN_ID: &str = "test-chain"; - - let quorum_hash = - hex::decode("D6711FA18C7DA6D3FF8615D3CD3C14500EE91DA5FA942425B8E2B79A30FD8E6C") - .unwrap(); - - let mut wt = super::WithdrawalTxs { - inner: Vec::new(), - drive_operations: Vec::new(), - }; - let pubkey = hex::decode("8280cb6694f181db486c59dfa0c6d12d1c4ca26789340aebad0540ffe2edeac387aceec979454c2cfbe75fd8cf04d56d").unwrap(); - let pubkey = bls_signatures::PublicKey::from_bytes(&pubkey).unwrap(); - - let signature = hex::decode("A1022D9503CCAFC94FF76FA2E58E10A0474E6EB46305009274FAFCE57E28C7DE57602277777D07855567FAEF6A2F27590258858A875707F4DA32936DDD556BA28455AB04D9301E5F6F0762AC5B9FC036A302EE26116B1F89B74E1457C2D7383A").unwrap(); - // check if signature is correct - bls_signatures::Signature::from_bytes(&signature).unwrap(); - wt.inner.push(VoteExtension { - extension: [ - 82u8, 79, 29, 3, 209, 216, 30, 148, 160, 153, 4, 39, 54, 212, 11, 217, 104, 27, - 134, 115, 33, 68, 63, 245, 138, 69, 104, 226, 116, 219, 216, 59, - ] - .into(), - signature, - r#type: VoteExtensionType::ThresholdRecover.into(), - }); - - assert!(wt - .verify_signatures( - CHAIN_ID, - QuorumType::LlmqTest, - &quorum_hash, - HEIGHT, - ROUND, - &pubkey - ) - .is_valid()); - - // Now break the data - wt.inner[0].extension[3] = 0; - assert!(!wt - .verify_signatures( - CHAIN_ID, - QuorumType::LlmqTest, - &quorum_hash, - HEIGHT, - ROUND, - &pubkey - ) - .is_valid()); - } -} diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/mod.rs index 7573974aee4..288e55f3bfe 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/mod.rs @@ -3,28 +3,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_data_contract_request::Version; -use dapi_grpc::platform::v0::GetDataContractRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_data_contract_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_data_contract_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetDataContractRequest, GetDataContractResponse}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of a data contract - pub(in crate::query) fn query_data_contract( + pub fn query_data_contract( &self, - state: &PlatformState, - query_data: &[u8], + GetDataContractRequest { version }: GetDataContractRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetDataContractRequest { version } = - check_validation_result_with_data!(GetDataContractRequest::decode(query_data).map_err( - |e| QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - )); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode data contract query".to_string()), @@ -38,7 +31,7 @@ impl Platform { .data_contract; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -52,8 +45,13 @@ impl Platform { )); } match version { - Version::V0(get_data_contract_request) => { - self.query_data_contract_v0(state, get_data_contract_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = + self.query_data_contract_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetDataContractResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs index ab9cb627f2d..83b8fea5f77 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs @@ -1,54 +1,43 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_data_contract_request::GetDataContractRequestV0; -use dapi_grpc::platform::v0::get_data_contract_response::GetDataContractResponseV0; -use dapi_grpc::platform::v0::{get_data_contract_response, GetDataContractResponse, Proof}; +use dapi_grpc::platform::v0::get_data_contract_response::{ + get_data_contract_response_v0, GetDataContractResponseV0, +}; use dpp::check_validation_result_with_data; use dpp::identifier::Identifier; use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { pub(super) fn query_data_contract_v0( &self, - state: &PlatformState, - request: GetDataContractRequestV0, + GetDataContractRequestV0 { id, prove }: GetDataContractRequestV0, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetDataContractRequestV0 { id, prove } = request; + ) -> Result, Error> { let contract_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { QueryError::InvalidArgument( "id must be a valid identifier (32 bytes long)".to_string(), ) })); - let response_data = if prove { + + let response = if prove { let proof = self.drive .prove_contract(contract_id.into_buffer(), None, platform_version)?; - GetDataContractResponse { - version: Some(get_data_contract_response::Version::V0(GetDataContractResponseV0 { - result: Some(get_data_contract_response::get_data_contract_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), + GetDataContractResponseV0 { + result: Some(get_data_contract_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let maybe_data_contract_fetch_info = self .drive @@ -71,14 +60,78 @@ impl Platform { .serialize_to_bytes_with_platform_version(platform_version) .map_err(Error::Protocol)?; - GetDataContractResponse { - version: Some(get_data_contract_response::Version::V0(GetDataContractResponseV0 { - result: Some(get_data_contract_response::get_data_contract_response_v0::Result::DataContract(serialized_data_contract)), - metadata: Some(metadata), - })), + GetDataContractResponseV0 { + result: Some(get_data_contract_response_v0::Result::DataContract( + serialized_data_contract, + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_data_contract_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetDataContractRequestV0 { + id: vec![0; 8], + prove: false, + }; + + let result = platform.query_data_contract_v0(request, &state, version); + + assert_invalid_identifier(result.unwrap()); + } + + #[test] + fn test_data_contract_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + let request = GetDataContractRequestV0 { + id: id.clone(), + prove: false, + }; + + let result = platform + .query_data_contract_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::NotFound(msg)] if msg.contains("data contract") + )); + } + + #[test] + fn test_data_contract_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + let request = GetDataContractRequestV0 { + id: id.clone(), + prove: true, + }; + + let validation_result = platform + .query_data_contract_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + validation_result.data, + Some(GetDataContractResponseV0 { + result: Some(get_data_contract_response_v0::Result::Proof(_)), + metadata: Some(_), + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/mod.rs index 82d09027b1f..e6e1bdf0814 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/mod.rs @@ -1,34 +1,24 @@ -use crate::error::execution::ExecutionError; use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_data_contract_history_request::Version; -use dapi_grpc::platform::v0::{GetDataContractHistoryRequest, GetDataContractRequest}; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; -use dpp::version::FeatureVersion; +use dapi_grpc::platform::v0::get_data_contract_history_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_data_contract_history_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetDataContractHistoryRequest, GetDataContractHistoryResponse}; + +use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of a data contract history - pub(in crate::query) fn query_data_contract_history( + pub fn query_data_contract_history( &self, - state: &PlatformState, - query_data: &[u8], + GetDataContractHistoryRequest { version }: GetDataContractHistoryRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetDataContractHistoryRequest { version } = - check_validation_result_with_data!(GetDataContractHistoryRequest::decode(query_data) - .map_err(|e| QueryError::InvalidArgument(format!( - "invalid query proto message: {}", - e - )))); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode data contract query".to_string()), @@ -42,7 +32,7 @@ impl Platform { .data_contract_history; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -56,11 +46,17 @@ impl Platform { )); } match version { - Version::V0(get_data_contract_history_request) => self.query_data_contract_history_v0( - state, - get_data_contract_history_request, - platform_version, - ), + RequestVersion::V0(request_v0) => { + let result = self.query_data_contract_history_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok(result.map(|response_v0| GetDataContractHistoryResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } } } } diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs index fad0100be91..0611a3ccc10 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs @@ -1,38 +1,30 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_data_contract_history_request::GetDataContractHistoryRequestV0; -use dapi_grpc::platform::v0::get_data_contract_history_response::GetDataContractHistoryResponseV0; -use dapi_grpc::platform::v0::{ - get_data_contract_history_response, GetDataContractHistoryResponse, Proof, -}; +use dapi_grpc::platform::v0::get_data_contract_history_response::{get_data_contract_history_response_v0, GetDataContractHistoryResponseV0}; use dpp::identifier::Identifier; use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; use dpp::{check_validation_result_with_data, ProtocolError}; -use prost::Message; use dapi_grpc::platform::v0::get_data_contract_history_response::get_data_contract_history_response_v0::DataContractHistoryEntry; +use crate::platform_types::platform_state::PlatformState; impl Platform { pub(super) fn query_data_contract_history_v0( &self, - state: &PlatformState, - request: GetDataContractHistoryRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetDataContractHistoryRequestV0 { + GetDataContractHistoryRequestV0 { id, limit, offset, start_at_ms, prove, - } = request; + }: GetDataContractHistoryRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { let contract_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { QueryError::InvalidArgument( @@ -46,6 +38,7 @@ impl Platform { .map_err(|_| QueryError::InvalidArgument("limit out of bounds".to_string())) }) .transpose()); + let offset = check_validation_result_with_data!(offset .map(|offset| { u16::try_from(offset) @@ -53,7 +46,7 @@ impl Platform { }) .transpose()); - let response_data = if prove { + let response = if prove { let proof = self.drive.prove_contract_history( contract_id.to_buffer(), None, @@ -62,20 +55,13 @@ impl Platform { offset, platform_version, )?; - GetDataContractHistoryResponse { - version: Some(get_data_contract_history_response::Version::V0(GetDataContractHistoryResponseV0 { - result: Some(get_data_contract_history_response::get_data_contract_history_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), + + GetDataContractHistoryResponseV0 { + result: Some(get_data_contract_history_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let contracts = self.drive.fetch_contract_with_history( contract_id.to_buffer(), @@ -103,18 +89,407 @@ impl Platform { }) .collect::, ProtocolError>>()?; - GetDataContractHistoryResponse { - version: Some(get_data_contract_history_response::Version::V0(GetDataContractHistoryResponseV0 { - result: Some(get_data_contract_history_response::get_data_contract_history_response_v0::Result::DataContractHistory( - get_data_contract_history_response::get_data_contract_history_response_v0::DataContractHistory { + GetDataContractHistoryResponseV0 { + result: Some( + get_data_contract_history_response_v0::Result::DataContractHistory( + get_data_contract_history_response_v0::DataContractHistory { data_contract_entries: contract_historical_entries, - } - )), - metadata: Some(metadata), - })), + }, + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; + use dpp::block::block_info::BlockInfo; + use dpp::dashcore::Network; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::config::v0::DataContractConfigSettersV0; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use dpp::data_contract::schema::DataContractSchemaMethodsV0; + use dpp::data_contract::DataContract; + use dpp::platform_value::platform_value; + use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; + use dpp::tests::fixtures::get_data_contract_fixture; + use drive::drive::Drive; + use std::sync::Arc; + + fn default_request_v0() -> GetDataContractHistoryRequestV0 { + GetDataContractHistoryRequestV0 { + id: vec![1; 32], + limit: Some(10), + offset: Some(0), + start_at_ms: 0, + prove: false, + } + } + + /// Set up simple contract history with one update + fn set_up_history(platform: &TempPlatform) -> DataContract { + let state = platform.platform.state.load(); + let current_protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(current_protocol_version) + .expect("expected to get platform version"); + drop(state); + let mut data_contract = + get_data_contract_fixture(None, 0, current_protocol_version).data_contract_owned(); + data_contract.config_mut().set_keeps_history(true); + data_contract.config_mut().set_readonly(false); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo { + time_ms: 1000, + height: 10, + core_height: 20, + epoch: Default::default(), + }, + true, + None, + None, + platform_version, + ) + .expect("To apply contract"); + + let mut updated_data_contract = data_contract.clone(); + + let updated_document_schema = platform_value!({ + "type": "object", + "properties": { + "name": { + "type": "string", + "position": 0 + }, + "newProp": { + "type": "integer", + "minimum": 0, + "position": 1 + } + }, + "required": [ + "$createdAt" + ], + "additionalProperties": false + }); + + updated_data_contract + .set_document_schema( + "niceDocument", + updated_document_schema, + true, + &mut vec![], + platform_version, + ) + .expect("to be able to set document schema"); + + platform + .drive + .apply_contract( + &updated_data_contract, + BlockInfo { + time_ms: 2000, + height: 11, + core_height: 21, + epoch: Default::default(), + }, + true, + None, + None, + platform_version, + ) + .expect("To apply contract"); + + data_contract + } + + struct TestData<'a> { + platform: TempPlatform, + original_data_contract: DataContract, + version: &'a PlatformVersion, + state: Arc, + } + + fn set_up_test<'a>() -> TestData<'a> { + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let original_data_contract = set_up_history(&platform); + + // We can't return a reference to Arc (`load` method) so we clone Arc (`load_full`). + // This is a bit slower but we don't care since we are in test environment + let platform_state = platform.platform.state.load_full(); + + TestData { + platform, + original_data_contract, + version: PlatformVersion::latest(), + state: platform_state, + } + } + + #[test] + fn test_invalid_data_contract_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetDataContractHistoryRequestV0 { + id: vec![0; 8], + limit: None, + offset: None, + start_at_ms: 0, + prove: false, + }; + + let result = platform + .query_data_contract_history_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_invalid_limit_overflow() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetDataContractHistoryRequestV0 { + id: vec![0; 32], + limit: Some(u32::MAX), + offset: None, + start_at_ms: 0, + prove: false, + }; + + let result = platform + .query_data_contract_history_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg == "limit out of bounds" + )); + } + + #[test] + fn test_invalid_offset_overflow() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetDataContractHistoryRequestV0 { + id: vec![0; 32], + limit: None, + offset: Some(u32::MAX), + start_at_ms: 0, + prove: false, + }; + + let result = platform + .query_data_contract_history_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!( + matches!(result.errors.as_slice(), [QueryError::InvalidArgument(msg)] if msg == "offset out of bounds") + ); + } + + #[test] + fn test_data_contract_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + + let request = GetDataContractHistoryRequestV0 { + id, + limit: None, + offset: None, + start_at_ms: 0, + prove: false, + }; + + let result = platform + .query_data_contract_history_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::NotFound(msg)] if msg.contains("data contract") + )); + } + + #[test] + pub fn should_return_contract_history_with_no_errors_if_parameters_are_valid() { + let TestData { + platform, + original_data_contract, + version, + state, + } = set_up_test(); + + let request = GetDataContractHistoryRequestV0 { + id: original_data_contract.id().to_vec(), + ..default_request_v0() + }; + + let result = platform + .query_data_contract_history_v0(request, &state, version) + .expect("To return result"); + + let ValidationResult { errors, data } = result; + + assert!( + errors.is_empty(), + "expect no errors to be returned from the query" + ); + + let response = data.expect("expect data to be returned from the query"); + + let GetDataContractHistoryResponseV0 { + result: + Some(get_data_contract_history_response_v0::Result::DataContractHistory( + data_contract_history, + )), + metadata: Some(_), + } = response + else { + panic!("expect result to be DataContractHistory"); + }; + + let mut history_entries = data_contract_history.data_contract_entries; + assert_eq!(history_entries.len(), 2); + + let second_entry = history_entries.pop().unwrap(); + let first_entry = history_entries.pop().unwrap(); + + assert_eq!(first_entry.date, 1000); + let first_entry_data_contract = first_entry.value; + let first_data_contract_update = + DataContract::versioned_deserialize(&first_entry_data_contract, true, version) + .expect("To decode data contract"); + assert_eq!(first_data_contract_update, original_data_contract); + + assert_eq!(second_entry.date, 2000); + + let second_entry_data_contract = second_entry.value; + + let second_data_contract_update = + DataContract::versioned_deserialize(&second_entry_data_contract, true, version) + .expect("To decode data contract"); + + let updated_doc = second_data_contract_update + .document_type_for_name("niceDocument") + .expect("should return document type"); + + assert!( + updated_doc.properties().contains_key("newProp"), + "expect data contract to have newProp field", + ); + } + + #[test] + pub fn should_return_contract_history_proofs_with_no_errors_if_parameters_are_valid() { + let TestData { + platform, + original_data_contract, + version, + state, + } = set_up_test(); + + let request_v0 = GetDataContractHistoryRequestV0 { + id: original_data_contract.id().to_vec(), + prove: true, + ..default_request_v0() + }; + + let start_at_ms = request_v0.start_at_ms; + + let result = platform + .query_data_contract_history_v0(request_v0, &state, version) + .expect("To return result"); + + let ValidationResult { errors, data } = result; + + assert!( + errors.is_empty(), + "expect no errors to be returned from the query" + ); + + let response = data.expect("expect data to be returned from the query"); + + let GetDataContractHistoryResponseV0 { + result: Some(get_data_contract_history_response_v0::Result::Proof(proof)), + metadata: Some(_), + } = response + else { + panic!("expect result to be Proof"); + }; + + // Check that the proof has correct values inside + let (_root_hash, contract_history) = Drive::verify_contract_history( + &proof.grovedb_proof, + original_data_contract.id().to_buffer(), + start_at_ms, + Some(10), + None, + version, + ) + .expect("To verify contract history"); + + let mut history_entries = contract_history.expect("history to exist"); + + assert_eq!(history_entries.len(), 2); + + // Taking entries by date + let first_data_contract_update = + history_entries.remove(&1000).expect("first entry to exist"); + let second_data_contract_update = history_entries + .remove(&2000) + .expect("second entry to exist"); + + assert_eq!(first_data_contract_update, original_data_contract); + + let updated_doc = second_data_contract_update + .document_type_for_name("niceDocument") + .expect("To have niceDocument document"); + + assert!( + updated_doc.properties().contains_key("newProp"), + "expect data contract to have newProp field", + ); + } + + #[test] + fn test_data_contract_history_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetDataContractHistoryRequestV0 { + id: vec![0; 32], + limit: None, + offset: None, + start_at_ms: 0, + prove: true, + }; + + let result = platform + .query_data_contract_history_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetDataContractHistoryResponseV0 { + result: Some(get_data_contract_history_response_v0::Result::Proof(_)), + metadata: Some(_), + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/mod.rs index e38af0ac8cd..c2087c825ed 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/mod.rs @@ -3,30 +3,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_data_contracts_request::Version; -use dapi_grpc::platform::v0::GetDataContractsRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_data_contracts_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_data_contracts_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetDataContractsRequest, GetDataContractsResponse}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of data contracts - pub(in crate::query) fn query_data_contracts( + pub fn query_data_contracts( &self, - state: &PlatformState, - query_data: &[u8], + GetDataContractsRequest { version }: GetDataContractsRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetDataContractsRequest { version } = - check_validation_result_with_data!(GetDataContractsRequest::decode(query_data) - .map_err(|e| QueryError::InvalidArgument(format!( - "invalid query proto message: {}", - e - )))); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode data contracts query".to_string()), @@ -40,8 +31,9 @@ impl Platform { .data_contracts; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; + if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( QueryError::UnsupportedQueryVersion( @@ -53,9 +45,15 @@ impl Platform { ), )); } + match version { - Version::V0(get_data_contracts_request) => { - self.query_data_contracts_v0(state, get_data_contracts_request, platform_version) + RequestVersion::V0(request_v0) => { + let request = + self.query_data_contracts_v0(request_v0, platform_state, platform_version)?; + + Ok(request.map(|response_v0| GetDataContractsResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs index b5f3e7f78ef..f1533b24736 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs @@ -1,30 +1,27 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_data_contracts_request::GetDataContractsRequestV0; -use dapi_grpc::platform::v0::get_data_contracts_response::DataContractEntry; +use dapi_grpc::platform::v0::get_data_contracts_response; use dapi_grpc::platform::v0::get_data_contracts_response::GetDataContractsResponseV0; -use dapi_grpc::platform::v0::{get_data_contracts_response, GetDataContractsResponse, Proof}; +use dapi_grpc::platform::v0::get_data_contracts_response::{ + get_data_contracts_response_v0, DataContractEntry, +}; use dpp::platform_value::Bytes32; use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; use dpp::{check_validation_result_with_data, ProtocolError}; -use prost::Message; impl Platform { pub(super) fn query_data_contracts_v0( &self, - state: &PlatformState, - request: GetDataContractsRequestV0, + GetDataContractsRequestV0 { ids, prove }: GetDataContractsRequestV0, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetDataContractsRequestV0 { ids, prove } = request; + ) -> Result, Error> { let contract_ids = check_validation_result_with_data!(ids .into_iter() .map(|contract_id_vec| { @@ -37,24 +34,18 @@ impl Platform { }) }) .collect::, QueryError>>()); - let response_data = if prove { + + let response = if prove { let proof = self.drive .prove_contracts(contract_ids.as_slice(), None, platform_version)?; - GetDataContractsResponse { - version: Some(get_data_contracts_response::Version::V0(GetDataContractsResponseV0 { - result: Some(get_data_contracts_response::get_data_contracts_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), + + GetDataContractsResponseV0 { + result: Some(get_data_contracts_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let contracts = self.drive.get_contracts_with_fetch_info( contract_ids.as_slice(), @@ -79,15 +70,85 @@ impl Platform { }) .collect::, ProtocolError>>()?; - GetDataContractsResponse { - version: Some(get_data_contracts_response::Version::V0(GetDataContractsResponseV0 { - result: Some(get_data_contracts_response::get_data_contracts_response_v0::Result::DataContracts(get_data_contracts_response::DataContracts { data_contract_entries: contracts } - )), - metadata: Some(metadata), - })), + GetDataContractsResponseV0 { + result: Some(get_data_contracts_response_v0::Result::DataContracts( + get_data_contracts_response::DataContracts { + data_contract_entries: contracts, + }, + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_data_contract_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetDataContractsRequestV0 { + ids: vec![vec![0; 8]], + prove: false, + }; + + let result = platform + .query_data_contracts_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_data_contracts_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + let request = GetDataContractsRequestV0 { + ids: vec![id.clone()], + prove: false, + }; + + let result = platform + .query_data_contracts_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetDataContractsResponseV0 { + result: Some(get_data_contracts_response_v0::Result::DataContracts(contracts)), + metadata: Some(_), + }) if contracts.data_contract_entries.len() == 1 && contracts.data_contract_entries[0].data_contract.is_none() + )); + } + + #[test] + fn test_data_contracts_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + let request = GetDataContractsRequestV0 { + ids: vec![id.clone()], + prove: true, + }; + + let result = platform + .query_data_contracts_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetDataContractsResponseV0 { + result: Some(get_data_contracts_response_v0::Result::Proof(_)), + metadata: Some(_), + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/document_query/mod.rs b/packages/rs-drive-abci/src/query/document_query/mod.rs index c2b6270324e..417e1b9112d 100644 --- a/packages/rs-drive-abci/src/query/document_query/mod.rs +++ b/packages/rs-drive-abci/src/query/document_query/mod.rs @@ -1,32 +1,23 @@ -use crate::error::execution::ExecutionError; use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_documents_request::Version; -use dapi_grpc::platform::v0::GetDocumentsRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; -use dpp::version::FeatureVersion; +use dapi_grpc::platform::v0::get_documents_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_documents_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetDocumentsRequest, GetDocumentsResponse}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of documents - pub(in crate::query) fn query_documents( + pub fn query_documents( &self, - state: &PlatformState, - query_data: &[u8], + GetDocumentsRequest { version }: GetDocumentsRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetDocumentsRequest { version } = - check_validation_result_with_data!(GetDocumentsRequest::decode(query_data).map_err( - |e| QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - )); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode data contracts query".to_string()), @@ -36,7 +27,7 @@ impl Platform { let feature_version_bounds = &platform_version.drive_abci.query.document_query; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -50,8 +41,13 @@ impl Platform { )); } match version { - Version::V0(get_documents_request) => { - self.query_documents_v0(state, get_documents_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = + self.query_documents_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetDocumentsResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/document_query/v0/mod.rs b/packages/rs-drive-abci/src/query/document_query/v0/mod.rs index 02c7747a248..307919493c0 100644 --- a/packages/rs-drive-abci/src/query/document_query/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/document_query/v0/mod.rs @@ -1,14 +1,12 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_documents_request::get_documents_request_v0::Start; use dapi_grpc::platform::v0::get_documents_request::GetDocumentsRequestV0; -use dapi_grpc::platform::v0::get_documents_response::GetDocumentsResponseV0; -use dapi_grpc::platform::v0::{ - get_documents_response, GetDocumentsRequest, GetDocumentsResponse, Proof, +use dapi_grpc::platform::v0::get_documents_response::{ + get_documents_response_v0, GetDocumentsResponseV0, }; use dpp::check_validation_result_with_data; use dpp::data_contract::accessors::v0::DataContractV0Getters; @@ -17,19 +15,12 @@ use dpp::platform_value::Value; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; use drive::error::query::QuerySyntaxError; -use drive::query::DriveQuery; -use prost::Message; +use drive::query::DriveDocumentQuery; impl Platform { pub(super) fn query_documents_v0( &self, - state: &PlatformState, - request: GetDocumentsRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetDocumentsRequestV0 { + GetDocumentsRequestV0 { data_contract_id, document_type: document_type_name, r#where, @@ -37,12 +28,16 @@ impl Platform { limit, prove, start, - } = request; + }: GetDocumentsRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { let contract_id: Identifier = check_validation_result_with_data!(data_contract_id .try_into() .map_err(|_| QueryError::InvalidArgument( "id must be a valid identifier (32 bytes long)".to_string() ))); + let (_, contract) = self.drive.get_contract_with_fetch_info_and_fee( contract_id.to_buffer(), None, @@ -50,12 +45,15 @@ impl Platform { None, platform_version, )?; + let contract = check_validation_result_with_data!(contract.ok_or(QueryError::Query( QuerySyntaxError::DataContractNotFound( "contract not found when querying from value with contract info", ) ))); + let contract_ref = &contract.contract; + let document_type = check_validation_result_with_data!(contract_ref .document_type_for_name(document_type_name.as_str()) .map_err(|_| QueryError::InvalidArgument(format!( @@ -116,22 +114,24 @@ impl Platform { ))); } - let drive_query = check_validation_result_with_data!(DriveQuery::from_decomposed_values( - where_clause, - order_by, - Some(if limit == 0 { - self.config.drive.default_query_limit - } else { - limit as u16 - }), - start_at, - start_at_included, - None, - contract_ref, - document_type, - &self.config.drive, - )); - let response_data = if prove { + let drive_query = + check_validation_result_with_data!(DriveDocumentQuery::from_decomposed_values( + where_clause, + order_by, + Some(if limit == 0 { + self.config.drive.default_query_limit + } else { + limit as u16 + }), + start_at, + start_at_included, + None, + contract_ref, + document_type, + &self.config.drive, + )); + + let response = if prove { let proof = match drive_query.execute_with_proof(&self.drive, None, None, platform_version) { Ok(result) => result.0, @@ -142,26 +142,13 @@ impl Platform { } Err(e) => return Err(e.into()), }; - GetDocumentsResponse { - version: Some(get_documents_response::Version::V0( - GetDocumentsResponseV0 { - result: Some( - get_documents_response::get_documents_response_v0::Result::Proof( - Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - }, - ), - ), - metadata: Some(metadata), - }, + + GetDocumentsResponseV0 { + result: Some(get_documents_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let results = match drive_query.execute_raw_results_no_proof( &self.drive, @@ -178,22 +165,318 @@ impl Platform { Err(e) => return Err(e.into()), }; - GetDocumentsResponse { - version: Some(get_documents_response::Version::V0( - GetDocumentsResponseV0 { - result: Some( - get_documents_response::get_documents_response_v0::Result::Documents( - get_documents_response::get_documents_response_v0::Documents { - documents: results, - }, - ), - ), - metadata: Some(metadata), - }, + GetDocumentsResponseV0 { + result: Some(get_documents_response_v0::Result::Documents( + get_documents_response_v0::Documents { documents: results }, )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform, store_data_contract}; + use dpp::dashcore::Network; + use dpp::tests::fixtures::get_data_contract_fixture; + + #[test] + fn test_invalid_document_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetDocumentsRequestV0 { + data_contract_id: vec![0; 8], + document_type: "niceDocument".to_string(), + r#where: vec![], + limit: 0, + order_by: vec![], + prove: false, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_data_contract_not_found_in_documents_request() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let data_contract_id = vec![0; 32]; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.clone(), + document_type: "niceDocument".to_string(), + r#where: vec![], + limit: 0, + order_by: vec![], + prove: false, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::DataContractNotFound(msg))] if msg == &"contract not found when querying from value with contract info" + )); + } + + #[test] + fn test_absent_document_type() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "fakeDocument"; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![], + limit: 0, + order_by: vec![], + prove: false, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg.contains(format!( + "document type {} not found for contract", + document_type, + ).as_str()))) + } + + #[test] + fn test_invalid_where_clause() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "niceDocument"; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![0x9F], // Incomplete CBOR array + limit: 0, + order_by: vec![], + prove: false, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::DeserializationError(msg))] if msg == "unable to decode 'where' query from cbor" + )) + } + + #[test] + fn test_invalid_order_by_clause() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "niceDocument"; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![], + limit: 0, + order_by: vec![0x9F], // Incomplete CBOR array + prove: false, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::DeserializationError(msg))] if msg == "unable to decode 'order_by' query from cbor" + )); + } + + #[test] + fn test_invalid_start_at_clause() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "niceDocument"; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![], + limit: 0, + order_by: vec![], + prove: false, + start: Some(Start::StartAt(vec![0; 8])), + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidStartsWithClause(msg))] if msg == &"start at should be a 32 byte identifier" + )) + } + + #[test] + fn test_invalid_start_after_clause() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "niceDocument"; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![], + limit: 0, + order_by: vec![], + prove: false, + start: Some(Start::StartAfter(vec![0; 8])), + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidStartsWithClause(msg))] if msg == &"start after should be a 32 byte identifier" + )); + } + + #[test] + fn test_invalid_limit() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "niceDocument"; + let limit = u32::MAX; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![], + limit, + order_by: vec![], + prove: false, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidLimit(msg))] if msg == &format!("limit {} out of bounds", limit) + )) + } + + #[test] + fn test_documents_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "niceDocument"; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![], + limit: 0, + order_by: vec![], + prove: false, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetDocumentsResponseV0 { + result: Some(get_documents_response_v0::Result::Documents(documents)), + metadata: Some(_), + }) if documents.documents.is_empty() + )); + } + + #[test] + fn test_documents_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let created_data_contract = get_data_contract_fixture(None, 0, version.protocol_version); + store_data_contract(&platform, created_data_contract.data_contract(), version); + + let data_contract_id = created_data_contract.data_contract().id(); + let document_type = "niceDocument"; + + let request = GetDocumentsRequestV0 { + data_contract_id: data_contract_id.to_vec(), + document_type: document_type.to_string(), + r#where: vec![], + limit: 0, + order_by: vec![], + prove: true, + start: None, + }; + + let result = platform + .query_documents_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetDocumentsResponseV0 { + result: Some(get_documents_response_v0::Result::Proof(_)), + metadata: Some(_), + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance/mod.rs index 6ed590f3687..04c575aa168 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance/mod.rs @@ -3,28 +3,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identity_request::Version; -use dapi_grpc::platform::v0::GetIdentityRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_identity_balance_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identity_balance_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetIdentityBalanceRequest, GetIdentityBalanceResponse}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of an identity by a public key hash - pub(in crate::query) fn query_balance( + pub fn query_balance( &self, - state: &PlatformState, - query_data: &[u8], + GetIdentityBalanceRequest { version }: GetIdentityBalanceRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetIdentityRequest { version } = - check_validation_result_with_data!(GetIdentityRequest::decode(query_data).map_err( - |e| QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - )); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode identity balance query".to_string()), @@ -38,7 +31,7 @@ impl Platform { .balance; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -52,8 +45,12 @@ impl Platform { )); } match version { - Version::V0(get_identity_request) => { - self.query_balance_v0(state, get_identity_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = self.query_balance_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetIdentityBalanceResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs index 8865f6c46a8..5f6718eb139 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs @@ -1,55 +1,43 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_identity_balance_request::GetIdentityBalanceRequestV0; +use dapi_grpc::platform::v0::get_identity_balance_response::get_identity_balance_response_v0; use dapi_grpc::platform::v0::get_identity_balance_response::GetIdentityBalanceResponseV0; -use dapi_grpc::platform::v0::get_identity_request::GetIdentityRequestV0; -use dapi_grpc::platform::v0::{get_identity_balance_response, GetIdentityBalanceResponse, Proof}; use dpp::check_validation_result_with_data; use dpp::identifier::Identifier; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { pub(super) fn query_balance_v0( &self, - state: &PlatformState, - get_identity_request: GetIdentityRequestV0, + GetIdentityBalanceRequestV0 { id, prove }: GetIdentityBalanceRequestV0, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetIdentityRequestV0 { id, prove } = get_identity_request; + ) -> Result, Error> { let identity_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { QueryError::InvalidArgument( "id must be a valid identifier (32 bytes long)".to_string(), ) })); - let response_data = if prove { + + let response = if prove { let proof = check_validation_result_with_data!(self.drive.prove_identity_balance( identity_id.into_buffer(), None, &platform_version.drive )); - GetIdentityBalanceResponse { - version: Some(get_identity_balance_response::Version::V0(GetIdentityBalanceResponseV0 { - result: Some(get_identity_balance_response::get_identity_balance_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), - } - .encode_to_vec() + GetIdentityBalanceResponseV0 { + result: Some(get_identity_balance_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } } else { let maybe_balance = self.drive.fetch_identity_balance( identity_id.into_buffer(), @@ -63,14 +51,80 @@ impl Platform { ))); }; - GetIdentityBalanceResponse { - version: Some(get_identity_balance_response::Version::V0(GetIdentityBalanceResponseV0 { - result: Some(get_identity_balance_response::get_identity_balance_response_v0::Result::Balance(balance)), - metadata: Some(metadata), - })), - } - .encode_to_vec() + GetIdentityBalanceResponseV0 { + result: Some(get_identity_balance_response_v0::Result::Balance(balance)), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_identity_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityBalanceRequestV0 { + id: vec![0; 8], + prove: false, + }; + + let result = platform + .query_balance_v0(request, &state, version) + .expect("should query balance"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_identity_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + + let request = GetIdentityBalanceRequestV0 { + id: id.clone(), + prove: false, + }; + + let result = platform + .query_balance_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::NotFound(_)] + )); + } + + #[test] + fn test_identity_balance_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + + let request = GetIdentityBalanceRequestV0 { + id: id.clone(), + prove: true, }; - Ok(QueryValidationResult::new_with_data(response_data)) + + let result = platform + .query_balance_v0(request, &state, version) + .expect("should query balance"); + + assert!(matches!( + result.data, + Some(GetIdentityBalanceResponseV0 { + result: Some(get_identity_balance_response_v0::Result::Proof(_)), + metadata: Some(_) + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/mod.rs index 2f82f7b6e22..7259411c9c2 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/mod.rs @@ -3,28 +3,23 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identity_request::Version; -use dapi_grpc::platform::v0::GetIdentityRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_identity_balance_and_revision_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identity_balance_and_revision_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetIdentityBalanceAndRevisionRequest, GetIdentityBalanceAndRevisionResponse, +}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of an identity by a public key hash - pub(in crate::query) fn query_balance_and_revision( + pub fn query_balance_and_revision( &self, - state: &PlatformState, - query_data: &[u8], + GetIdentityBalanceAndRevisionRequest { version }: GetIdentityBalanceAndRevisionRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetIdentityRequest { version } = - check_validation_result_with_data!(GetIdentityRequest::decode(query_data).map_err( - |e| QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - )); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError( @@ -40,7 +35,7 @@ impl Platform { .balance_and_revision; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -54,8 +49,18 @@ impl Platform { )); } match version { - Version::V0(get_identity_request) => { - self.query_balance_and_revision_v0(state, get_identity_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = self.query_balance_and_revision_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok( + result.map(|response_v0| GetIdentityBalanceAndRevisionResponse { + version: Some(ResponseVersion::V0(response_v0)), + }), + ) } } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs index 20b851ed4d6..d4f8233e21e 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs @@ -1,59 +1,45 @@ use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; use crate::query::QueryError; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identity_balance_and_revision_response::{GetIdentityBalanceAndRevisionResponseV0}; -use dapi_grpc::platform::v0::{ - get_identity_balance_and_revision_response, - GetIdentityBalanceAndRevisionResponse, Proof, -}; +use dapi_grpc::platform::v0::get_identity_balance_and_revision_response::{get_identity_balance_and_revision_response_v0, GetIdentityBalanceAndRevisionResponseV0}; use dpp::check_validation_result_with_data; use dpp::identifier::Identifier; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; +use dapi_grpc::platform::v0::get_identity_balance_and_revision_request::GetIdentityBalanceAndRevisionRequestV0; use dapi_grpc::platform::v0::get_identity_balance_and_revision_response::get_identity_balance_and_revision_response_v0::BalanceAndRevision; -use dapi_grpc::platform::v0::get_identity_request::GetIdentityRequestV0; +use crate::platform_types::platform_state::PlatformState; impl Platform { pub(super) fn query_balance_and_revision_v0( &self, - state: &PlatformState, - get_identity_request: GetIdentityRequestV0, + GetIdentityBalanceAndRevisionRequestV0 { id, prove }: GetIdentityBalanceAndRevisionRequestV0, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetIdentityRequestV0 { id, prove } = get_identity_request; + ) -> Result, Error> { let identity_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { QueryError::InvalidArgument( "id must be a valid identifier (32 bytes long)".to_string(), ) })); - let response_data = if prove { + + let response = if prove { let proof = self.drive.prove_identity_balance_and_revision( identity_id.into_buffer(), None, &platform_version.drive, )?; - GetIdentityBalanceAndRevisionResponse { - version: Some(get_identity_balance_and_revision_response::Version::V0(GetIdentityBalanceAndRevisionResponseV0 { - result: Some(get_identity_balance_and_revision_response::get_identity_balance_and_revision_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), + GetIdentityBalanceAndRevisionResponseV0 { + result: Some( + get_identity_balance_and_revision_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let maybe_balance = self.drive.fetch_identity_balance( identity_id.into_buffer(), @@ -80,18 +66,84 @@ impl Platform { ))); }; - GetIdentityBalanceAndRevisionResponse { - version: Some(get_identity_balance_and_revision_response::Version::V0(GetIdentityBalanceAndRevisionResponseV0 { - result: Some( - get_identity_balance_and_revision_response::get_identity_balance_and_revision_response_v0::Result::BalanceAndRevision( - BalanceAndRevision { balance, revision }, - ), + GetIdentityBalanceAndRevisionResponseV0 { + result: Some( + get_identity_balance_and_revision_response_v0::Result::BalanceAndRevision( + BalanceAndRevision { balance, revision }, ), - metadata: Some(metadata), - })), + ), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_identity_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityBalanceAndRevisionRequestV0 { + id: vec![0; 8], + prove: false, + }; + + let result = platform + .query_balance_and_revision_v0(request, &state, version) + .expect("should query balance and revision"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_identity_not_found_when_querying_balance_and_revision() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + + let request = GetIdentityBalanceAndRevisionRequestV0 { + id: id.clone(), + prove: false, + }; + + let result = platform + .query_balance_and_revision_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::NotFound(_)] + )); + } + + #[test] + fn test_identity_balance_and_revision_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + + let request = GetIdentityBalanceAndRevisionRequestV0 { + id: id.clone(), + prove: true, + }; + + let result = platform + .query_balance_and_revision_v0(request, &state, version) + .expect("should query balance and revision"); + + assert!(matches!( + result.data, + Some(GetIdentityBalanceAndRevisionResponseV0 { + result: Some(get_identity_balance_and_revision_response_v0::Result::Proof(_)), + metadata: Some(_) + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities/mod.rs deleted file mode 100644 index 9577c9986eb..00000000000 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities/mod.rs +++ /dev/null @@ -1,60 +0,0 @@ -use crate::error::query::QueryError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::PlatformState; -use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identities_request::Version; -use dapi_grpc::platform::v0::GetIdentitiesRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; -use dpp::version::PlatformVersion; -use prost::Message; - -mod v0; - -impl Platform { - /// Querying of an identity by a public key hash - pub(in crate::query) fn query_identities( - &self, - state: &PlatformState, - query_data: &[u8], - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetIdentitiesRequest { version } = - check_validation_result_with_data!(GetIdentitiesRequest::decode(query_data).map_err( - |e| QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - )); - - let Some(version) = version else { - return Ok(QueryValidationResult::new_with_error( - QueryError::DecodingError("could not decode identities query".to_string()), - )); - }; - - let feature_version_bounds = &platform_version - .drive_abci - .query - .identity_based_queries - .identities; - - let feature_version = match &version { - Version::V0(_) => 0, - }; - if !feature_version_bounds.check_version(feature_version) { - return Ok(QueryValidationResult::new_with_error( - QueryError::UnsupportedQueryVersion( - "identities".to_string(), - feature_version_bounds.min_version, - feature_version_bounds.max_version, - platform_version.protocol_version, - feature_version, - ), - )); - } - match version { - Version::V0(get_identity_request) => { - self.query_identities_v0(state, get_identity_request, platform_version) - } - } - } -} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs deleted file mode 100644 index d585053f717..00000000000 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs +++ /dev/null @@ -1,109 +0,0 @@ -use crate::error::query::QueryError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; -use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identities_request::GetIdentitiesRequestV0; -use dapi_grpc::platform::v0::get_identities_response::{GetIdentitiesResponseV0, IdentityEntry}; -use dapi_grpc::platform::v0::{get_identities_response, GetIdentitiesResponse, Proof}; -use dpp::platform_value::Bytes32; -use dpp::serialization::PlatformSerializable; -use dpp::validation::ValidationResult; -use dpp::version::PlatformVersion; -use dpp::{check_validation_result_with_data, ProtocolError}; -use prost::Message; - -impl Platform { - pub(super) fn query_identities_v0( - &self, - state: &PlatformState, - get_identities_request: GetIdentitiesRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetIdentitiesRequestV0 { ids, prove } = get_identities_request; - let identity_ids = check_validation_result_with_data!(ids - .into_iter() - .map(|identity_id_vec| { - Bytes32::from_vec(identity_id_vec) - .map(|bytes| bytes.0) - .map_err(|_| { - QueryError::InvalidArgument( - "id must be a valid identifier (32 bytes long)".to_string(), - ) - }) - }) - .collect::, QueryError>>()); - let response_data = if prove { - let proof = self.drive.prove_full_identities( - identity_ids.as_slice(), - None, - &platform_version.drive, - )?; - - GetIdentitiesResponse { - version: Some(get_identities_response::Version::V0( - GetIdentitiesResponseV0 { - result: Some( - get_identities_response::get_identities_response_v0::Result::Proof( - Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - }, - ), - ), - metadata: Some(metadata), - }, - )), - } - .encode_to_vec() - } else { - let identities = self.drive.fetch_full_identities( - identity_ids.as_slice(), - None, - platform_version, - )?; - - let identities = identities - .into_iter() - .map(|(key, maybe_identity)| { - Ok::(IdentityEntry { - key: key.to_vec(), - value: maybe_identity - .map(|identity| { - Ok::( - get_identities_response::IdentityValue { - value: identity.serialize_consume_to_bytes()?, - }, - ) - }) - .transpose()?, - }) - }) - .collect::, ProtocolError>>()?; - - GetIdentitiesResponse { - version: Some(get_identities_response::Version::V0( - GetIdentitiesResponseV0 { - result: Some( - get_identities_response::get_identities_response_v0::Result::Identities( - get_identities_response::Identities { - identity_entries: identities, - }, - ), - ), - metadata: Some(metadata), - }, - )), - } - .encode_to_vec() - }; - Ok(QueryValidationResult::new_with_data(response_data)) - } -} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/mod.rs deleted file mode 100644 index c28a84220cb..00000000000 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/mod.rs +++ /dev/null @@ -1,65 +0,0 @@ -use crate::error::query::QueryError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::PlatformState; -use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identities_by_public_key_hashes_request::Version; -use dapi_grpc::platform::v0::GetIdentitiesByPublicKeyHashesRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; -use dpp::version::PlatformVersion; -use prost::Message; - -mod v0; - -impl Platform { - /// Querying of an identity by a public key hash - pub(in crate::query) fn query_identities_by_public_key_hashes( - &self, - state: &PlatformState, - query_data: &[u8], - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetIdentitiesByPublicKeyHashesRequest { version } = check_validation_result_with_data!( - GetIdentitiesByPublicKeyHashesRequest::decode(query_data).map_err(|e| { - QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - }) - ); - - let Some(version) = version else { - return Ok(QueryValidationResult::new_with_error( - QueryError::DecodingError( - "could not decode identities by public key hashes query".to_string(), - ), - )); - }; - - let feature_version_bounds = &platform_version - .drive_abci - .query - .identity_based_queries - .identities_by_public_key_hashes; - - let feature_version = match &version { - Version::V0(_) => 0, - }; - if !feature_version_bounds.check_version(feature_version) { - return Ok(QueryValidationResult::new_with_error( - QueryError::UnsupportedQueryVersion( - "identities_by_public_key_hashes".to_string(), - feature_version_bounds.min_version, - feature_version_bounds.max_version, - platform_version.protocol_version, - feature_version, - ), - )); - } - match version { - Version::V0(get_identity_request) => self.query_identities_by_public_key_hashes_v0( - state, - get_identity_request, - platform_version, - ), - } - } -} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs deleted file mode 100644 index 7235e4adbe6..00000000000 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs +++ /dev/null @@ -1,103 +0,0 @@ -use crate::error::query::QueryError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; -use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identities_by_public_key_hashes_request::GetIdentitiesByPublicKeyHashesRequestV0; -use dapi_grpc::platform::v0::get_identities_by_public_key_hashes_response::{ - GetIdentitiesByPublicKeyHashesResponseV0, PublicKeyHashIdentityEntry, -}; -use dapi_grpc::platform::v0::{ - get_identities_by_public_key_hashes_response, GetIdentitiesByPublicKeyHashesResponse, Proof, -}; -use dpp::platform_value::Bytes20; -use dpp::serialization::PlatformSerializable; -use dpp::validation::ValidationResult; -use dpp::version::PlatformVersion; -use dpp::{check_validation_result_with_data, ProtocolError}; -use prost::Message; - -impl Platform { - pub(super) fn query_identities_by_public_key_hashes_v0( - &self, - state: &PlatformState, - get_identities_by_public_key_hashes_request: GetIdentitiesByPublicKeyHashesRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetIdentitiesByPublicKeyHashesRequestV0 { - public_key_hashes, - prove, - } = get_identities_by_public_key_hashes_request; - let public_key_hashes = check_validation_result_with_data!(public_key_hashes - .into_iter() - .map(|pub_key_hash_vec| { - Bytes20::from_vec(pub_key_hash_vec) - .map(|bytes| bytes.0) - .map_err(|_| { - QueryError::InvalidArgument( - "public key hash must be 20 bytes long".to_string(), - ) - }) - }) - .collect::, QueryError>>()); - let response_data = if prove { - let proof = self - .drive - .prove_full_identities_by_unique_public_key_hashes( - &public_key_hashes, - None, - platform_version, - )?; - - GetIdentitiesByPublicKeyHashesResponse { - version: Some(get_identities_by_public_key_hashes_response::Version::V0(GetIdentitiesByPublicKeyHashesResponseV0 { - result: Some(get_identities_by_public_key_hashes_response::get_identities_by_public_key_hashes_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), - } - .encode_to_vec() - } else { - let identities = self - .drive - .fetch_full_identities_by_unique_public_key_hashes( - public_key_hashes.as_slice(), - None, - platform_version, - )?; - let identities = identities - .into_iter() - .map(|(hash, maybe_identity)| { - Ok(PublicKeyHashIdentityEntry { - public_key_hash: hash.to_vec(), - value: maybe_identity - .map(|identity| identity.serialize_consume_to_bytes()) - .transpose()?, - }) - }) - .collect::, ProtocolError>>()?; - - GetIdentitiesByPublicKeyHashesResponse { - version: Some(get_identities_by_public_key_hashes_response::Version::V0(GetIdentitiesByPublicKeyHashesResponseV0 { - metadata: Some(metadata), - result: Some(get_identities_by_public_key_hashes_response::get_identities_by_public_key_hashes_response_v0::Result::Identities( - get_identities_by_public_key_hashes_response::IdentitiesByPublicKeyHashes { - identity_entries: identities, - }, - )), - })), - } - .encode_to_vec() - }; - Ok(QueryValidationResult::new_with_data(response_data)) - } -} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities_contract_keys/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities_contract_keys/mod.rs new file mode 100644 index 00000000000..97636fcbfe0 --- /dev/null +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identities_contract_keys/mod.rs @@ -0,0 +1,63 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_identities_contract_keys_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identities_contract_keys_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetIdentitiesContractKeysRequest, GetIdentitiesContractKeysResponse, +}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying identities keys bound to specified contract + pub fn query_identities_contract_keys( + &self, + GetIdentitiesContractKeysRequest { version }: GetIdentitiesContractKeysRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError("could not decode identities query".to_string()), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .identity_based_queries + .identities_contract_keys; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "identities_contract_keys".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_identities_contract_keys_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok(result.map(|response_v0| GetIdentitiesContractKeysResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities_contract_keys/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities_contract_keys/v0/mod.rs new file mode 100644 index 00000000000..12f840d9d93 --- /dev/null +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identities_contract_keys/v0/mod.rs @@ -0,0 +1,1146 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; +use dapi_grpc::platform::v0::get_identities_contract_keys_response::{ + get_identities_contract_keys_response_v0, GetIdentitiesContractKeysResponseV0, +}; +use dpp::check_validation_result_with_data; +use dpp::identity::Purpose; +use dpp::platform_value::Bytes32; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; +use drive::error::query::QuerySyntaxError; + +impl Platform { + #[inline(always)] + pub(super) fn query_identities_contract_keys_v0( + &self, + GetIdentitiesContractKeysRequestV0 { + identities_ids, + contract_id, + document_type_name, + purposes, + prove, + }: GetIdentitiesContractKeysRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let identities_ids = check_validation_result_with_data!(identities_ids + .into_iter() + .map(|identity_id| { + let identity_id = Bytes32::from_vec(identity_id) + .map(|bytes| bytes.0) + .map_err(|_| { + QueryError::InvalidArgument( + "id must be a valid identifier (32 bytes long)".to_string(), + ) + })?; + + Ok(identity_id) + }) + .collect::, QueryError>>()); + + let contract_id = check_validation_result_with_data!(Bytes32::from_vec(contract_id) + .map(|bytes| bytes.0) + .map_err(|_| { + QueryError::InvalidArgument( + "contract_id must be a valid identifier (32 bytes long)".to_string(), + ) + })); + + let purposes = check_validation_result_with_data!(purposes + .into_iter() + .map( + |purpose| Purpose::try_from(purpose as u8).map_err(|_| QueryError::Query( + QuerySyntaxError::InvalidKeyParameter(format!( + "purpose {} not recognized", + purpose + )) + )) + ) + .collect::, QueryError>>()); + + let response = if prove { + let proof = self.drive.prove_identities_contract_keys( + identities_ids.as_slice(), + &contract_id, + document_type_name, + purposes, + None, + &platform_version.drive, + )?; + + GetIdentitiesContractKeysResponseV0 { + result: Some(get_identities_contract_keys_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + use get_identities_contract_keys_response_v0::IdentitiesKeys; + use get_identities_contract_keys_response_v0::IdentityKeys; + use get_identities_contract_keys_response_v0::PurposeKeys; + use get_identities_contract_keys_response_v0::Result; + + let keys = self.drive.fetch_identities_contract_keys( + identities_ids.as_slice(), + &contract_id, + document_type_name, + purposes, + None, + platform_version, + )?; + + let identities_keys = keys + .iter() + .map(|(identity_id, keys)| { + let keys = keys + .iter() + .map(|(purpose, key)| PurposeKeys { + purpose: *purpose as i32, + keys_bytes: vec![key.to_owned()], + }) + .collect::>(); + + IdentityKeys { + identity_id: identity_id.to_vec(), + keys, + } + }) + .collect::>(); + + GetIdentitiesContractKeysResponseV0 { + result: Some(Result::IdentitiesKeys(IdentitiesKeys { + entries: identities_keys, + })), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use crate::query::tests::setup_platform; + use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; + use dapi_grpc::platform::v0::get_identities_contract_keys_response::{ + GetIdentitiesContractKeysResponseV0, + }; + use dpp::block::block_info::BlockInfo; + use dpp::block::epoch::Epoch; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::contract_bounds::ContractBounds; + use dpp::identity::{Identity, KeyID, KeyType, Purpose, SecurityLevel}; + use dpp::prelude::{Identifier, IdentityPublicKey}; + use dpp::serialization::PlatformDeserializable; + use drive::util::test_helpers::test_utils::identities::create_test_identity_with_rng; + use rand::prelude::StdRng; + use rand::{Rng, SeedableRng}; + use itertools::Itertools; + use dapi_grpc::platform::v0::get_identities_contract_keys_response::get_identities_contract_keys_response_v0::{IdentitiesKeys, IdentityKeys, Result}; + use dpp::dashcore::Network; + use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + use drive::drive::Drive; + + #[test] + fn test_identities_contract_keys_missing_identity() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![vec![1; 32]], + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: false, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::IdentitiesKeys(IdentitiesKeys { entries: keys }) = + result.expect("expected result") + else { + panic!("expected IdentitiesKeys"); + }; + + assert_eq!(keys.len(), 0); + } + + #[test] + fn test_identities_contract_keys_missing_identity_proved() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let identity_ids = vec![vec![1; 32]]; + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: identity_ids.clone(), + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: true, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::Proof(proof) = result.expect("expected proof") else { + panic!("expected IdentitiesKeys"); + }; + + let (_, results) = Drive::verify_identities_contract_keys( + proof.grovedb_proof.as_slice(), + vec![[1u8; 32]].as_slice(), + dashpay.id().as_bytes(), + Some("contactRequest".to_string()), + vec![Purpose::ENCRYPTION, Purpose::DECRYPTION], + false, + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!(results.len(), 1); + + assert_eq!( + results + .get(&Identifier::from([1u8; 32])) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![None, None] + ); + } + + #[test] + fn test_identities_contract_keys_missing_identity_absent_contract() { + let (platform, state, platform_version) = setup_platform(None, Network::Testnet); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![vec![1; 32]], + contract_id: vec![2; 32], + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: false, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::IdentitiesKeys(IdentitiesKeys { entries: keys }) = + result.expect("expected result") + else { + panic!("expected IdentitiesKeys"); + }; + + assert_eq!(keys.len(), 0); + } + + #[test] + fn test_identities_contract_keys_missing_identity_absent_contract_proved() { + let (platform, state, platform_version) = setup_platform(None, Network::Testnet); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![vec![1; 32]], + contract_id: vec![2; 32], + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: true, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::Proof(proof) = result.expect("expected proof") else { + panic!("expected IdentitiesKeys"); + }; + + let (_, results) = Drive::verify_identities_contract_keys( + proof.grovedb_proof.as_slice(), + vec![[1u8; 32]].as_slice(), + &[2; 32], + Some("contactRequest".to_string()), + vec![Purpose::ENCRYPTION, Purpose::DECRYPTION], + false, + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!(results.len(), 1); + + assert_eq!( + results + .get(&Identifier::from([1u8; 32])) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![None, None] + ); + } + + #[test] + fn test_identities_contract_keys_with_identity_absent_contract() { + let (platform, state, platform_version) = setup_platform(None, Network::Testnet); + + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + + // Create alice identity + let alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec()], + contract_id: vec![2; 32], + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: false, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::IdentitiesKeys(IdentitiesKeys { entries: keys }) = + result.expect("expected result") + else { + panic!("expected IdentitiesKeys"); + }; + + assert_eq!(keys.len(), 0); + } + + #[test] + fn test_identities_contract_keys_with_identity_absent_contract_proved() { + let (platform, state, platform_version) = setup_platform(None, Network::Testnet); + + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + + // Create alice identity + let alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec()], + contract_id: vec![2; 32], + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: true, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::Proof(proof) = result.expect("expected proof") else { + panic!("expected IdentitiesKeys"); + }; + + let (_, results) = Drive::verify_identities_contract_keys( + proof.grovedb_proof.as_slice(), + &[alice.id().to_buffer()], + &[2; 32], + Some("contactRequest".to_string()), + vec![Purpose::ENCRYPTION, Purpose::DECRYPTION], + false, + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!(results.len(), 1); + + assert_eq!( + results + .get(&alice.id()) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![None, None] + ); + } + + #[test] + fn test_identities_contract_keys_missing_identity_keys() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + + // Create alice identity + let alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec()], + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: false, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::IdentitiesKeys(IdentitiesKeys { entries: keys }) = + result.expect("expected result") + else { + panic!("expected IdentitiesKeys"); + }; + + assert_eq!(keys.len(), 0); + } + + #[test] + fn test_identities_contract_keys_missing_identity_keys_proved() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + + // Create alice identity + let alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec()], + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: true, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::Proof(proof) = result.expect("expected proof") else { + panic!("expected IdentitiesKeys"); + }; + + let (_, results) = Drive::verify_identities_contract_keys( + proof.grovedb_proof.as_slice(), + &[alice.id().to_buffer()], + dashpay.id().as_bytes(), + Some("contactRequest".to_string()), + vec![Purpose::ENCRYPTION, Purpose::DECRYPTION], + false, + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!(results.len(), 1); + + assert_eq!( + results + .get(&alice.id()) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![None, None] + ); + } + + #[test] + fn test_identities_contract_keys() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + // Create alice and bob identities with encryption and decryption keys + let (alice, bob) = { + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + let bob_id = rng.gen::<[u8; 32]>(); + + // Create alice and bob identities + let (mut alice, mut bob) = { + let alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let bob = create_test_identity_with_rng( + &platform.drive, + bob_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + (alice, bob) + }; + + // Add keys to alice and bob + { + let block = BlockInfo::default_with_epoch(Epoch::new(0).unwrap()); + let db_transaction = platform.drive.grove.start_transaction(); + + let mut add_key_to_identity = + |identity: &mut Identity, key_id: KeyID, purpose: Purpose| { + let (key, _) = IdentityPublicKey::random_key_with_known_attributes( + key_id, + &mut rng, + purpose, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + platform + .drive + .add_new_unique_keys_to_identity( + identity.id().to_buffer(), + vec![key.clone()], + &block, + true, + Some(&db_transaction), + platform_version, + ) + .expect("expected to add a new key"); + + identity.public_keys_mut().insert(key.id(), key); + }; + + add_key_to_identity(&mut alice, 2, Purpose::ENCRYPTION); + add_key_to_identity(&mut alice, 3, Purpose::DECRYPTION); + add_key_to_identity(&mut bob, 2, Purpose::ENCRYPTION); + add_key_to_identity(&mut bob, 3, Purpose::DECRYPTION); + + platform + .drive + .grove + .commit_transaction(db_transaction) + .unwrap() + .expect("expected to be able to commit a transaction"); + } + + (alice, bob) + }; + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec(), bob.id().to_vec()], + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: false, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::IdentitiesKeys(IdentitiesKeys { entries: keys }) = + result.expect("expected result") + else { + panic!("expected IdentitiesKeys"); + }; + fn assert_keys(identity: &Identity, result_keys: &Vec) { + let identity_keys_result = result_keys + .iter() + .find(|key| key.identity_id == identity.id().to_vec()); + assert_eq!(identity_keys_result.is_some(), true); + let identity_keys_result = identity_keys_result.unwrap(); + + let get_expected_keys = |identity: &Identity, purpose: Purpose| { + identity + .public_keys() + .iter() + .filter(|(_, key)| key.purpose() == purpose) + .map(|(key_id, _)| *key_id) + .sorted() + .collect::>() + }; + + let get_keys_from_result = |keys: &IdentityKeys, purpose: Purpose| { + let mut keys_result = keys + .keys + .iter() + .filter(|key| key.purpose == purpose as i32) + .fold(vec![], |mut acc, keys| { + let keys = keys.keys_bytes.iter().map(|key_bytes| { + IdentityPublicKey::deserialize_from_bytes(key_bytes.as_slice()) + .unwrap() + .id() + }); + acc.extend(keys); + acc + }); + + keys_result.sort(); + keys_result + }; + + let enc_keys_expected = get_expected_keys(identity, Purpose::ENCRYPTION); + let dec_keys_expected = get_expected_keys(identity, Purpose::DECRYPTION); + + let enc_keys_result = get_keys_from_result(identity_keys_result, Purpose::ENCRYPTION); + let dec_keys_result = get_keys_from_result(identity_keys_result, Purpose::DECRYPTION); + + assert_eq!(enc_keys_result, enc_keys_expected); + assert_eq!(dec_keys_result, dec_keys_expected); + } + + assert_keys(&alice, &keys); + assert_keys(&bob, &keys); + } + + #[test] + fn test_identities_contract_keys_proof() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + let alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let block = BlockInfo::default_with_epoch(Epoch::new(0).unwrap()); + + let (alice_enc_key, _) = IdentityPublicKey::random_key_with_known_attributes( + 2, + &mut rng, + Purpose::ENCRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + let db_transaction = platform.drive.grove.start_transaction(); + + platform + .drive + .add_new_unique_keys_to_identity( + alice.id().to_buffer(), + vec![alice_enc_key.clone()], + &block, + true, + Some(&db_transaction), + platform_version, + ) + .expect("expected to add a new key"); + platform + .drive + .grove + .commit_transaction(db_transaction) + .unwrap() + .expect("expected to be able to commit a transaction"); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec()], + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: true, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::Proof(proof) = result.expect("expected proof") else { + panic!("expected IdentitiesKeys"); + }; + + let (_, results) = Drive::verify_identities_contract_keys( + proof.grovedb_proof.as_slice(), + &[alice.id().to_buffer()], + dashpay.id().as_bytes(), + Some("contactRequest".to_string()), + vec![Purpose::ENCRYPTION, Purpose::DECRYPTION], + false, + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!( + results + .get(&alice.id()) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![Some(alice_enc_key), None] + ); + } + + #[test] + fn test_multiple_identities_contract_keys() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + let bob_id = rng.gen::<[u8; 32]>(); + let carol_id = rng.gen::<[u8; 32]>(); + let mut alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let mut bob = create_test_identity_with_rng( + &platform.drive, + bob_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let carol = create_test_identity_with_rng( + &platform.drive, + carol_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let block = BlockInfo::default_with_epoch(Epoch::new(0).unwrap()); + + let (alice_enc_key, _) = IdentityPublicKey::random_key_with_known_attributes( + 2, + &mut rng, + Purpose::ENCRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + let (alice_dec_key, _) = IdentityPublicKey::random_key_with_known_attributes( + 3, + &mut rng, + Purpose::DECRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + let (bob_enc_key, _) = IdentityPublicKey::random_key_with_known_attributes( + 2, + &mut rng, + Purpose::ENCRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + let db_transaction = platform.drive.grove.start_transaction(); + + platform + .drive + .add_new_unique_keys_to_identity( + alice.id().to_buffer(), + vec![alice_enc_key.clone(), alice_dec_key.clone()], + &block, + true, + Some(&db_transaction), + platform_version, + ) + .expect("expected to add a new key"); + + alice.public_keys_mut().insert(2, alice_enc_key.clone()); + alice.public_keys_mut().insert(3, alice_dec_key.clone()); + + platform + .drive + .add_new_unique_keys_to_identity( + bob.id().to_buffer(), + vec![bob_enc_key.clone()], + &block, + true, + Some(&db_transaction), + platform_version, + ) + .expect("expected to add a new key"); + + bob.public_keys_mut().insert(2, bob_enc_key.clone()); + + platform + .drive + .grove + .commit_transaction(db_transaction) + .unwrap() + .expect("expected to be able to commit a transaction"); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec(), bob.id().to_vec(), carol.id().to_vec()], + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: false, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::IdentitiesKeys(IdentitiesKeys { entries: keys }) = + result.expect("expected result") + else { + panic!("expected IdentitiesKeys"); + }; + fn assert_keys(identity: &Identity, result_keys: &Vec) { + let identity_keys_result = result_keys + .iter() + .find(|key| key.identity_id == identity.id().to_vec()); + + let get_expected_keys = |identity: &Identity, purpose: Purpose| { + identity + .public_keys() + .iter() + .filter(|(_, key)| key.purpose() == purpose) + .map(|(key_id, _)| *key_id) + .sorted() + .collect::>() + }; + + let enc_keys_expected = get_expected_keys(identity, Purpose::ENCRYPTION); + let dec_keys_expected = get_expected_keys(identity, Purpose::DECRYPTION); + + if enc_keys_expected.is_empty() + && dec_keys_expected.is_empty() + && identity_keys_result.is_none() + { + return; + } + + let get_keys_from_result = |keys: &IdentityKeys, purpose: Purpose| { + let mut keys_result = keys + .keys + .iter() + .filter(|key| key.purpose == purpose as i32) + .fold(vec![], |mut acc, keys| { + let keys = keys.keys_bytes.iter().map(|key_bytes| { + IdentityPublicKey::deserialize_from_bytes(key_bytes.as_slice()) + .unwrap() + .id() + }); + acc.extend(keys); + acc + }); + + keys_result.sort(); + keys_result + }; + + assert_eq!(identity_keys_result.is_some(), true); + + let identity_keys_result = identity_keys_result.unwrap(); + + let enc_keys_result = get_keys_from_result(identity_keys_result, Purpose::ENCRYPTION); + let dec_keys_result = get_keys_from_result(identity_keys_result, Purpose::DECRYPTION); + + assert_eq!(enc_keys_result, enc_keys_expected); + assert_eq!(dec_keys_result, dec_keys_expected); + } + + assert_keys(&alice, &keys); + assert_keys(&bob, &keys); + assert_keys(&carol, &keys); + } + + #[test] + fn test_multiple_identities_contract_keys_proof() { + let (platform, state, platform_version) = setup_platform(Some((1, 1)), Network::Testnet); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + let mut rng = StdRng::seed_from_u64(10); + + let alice_id = rng.gen::<[u8; 32]>(); + let bob_id = rng.gen::<[u8; 32]>(); + let carol_id = rng.gen::<[u8; 32]>(); + let alice = create_test_identity_with_rng( + &platform.drive, + alice_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let bob = create_test_identity_with_rng( + &platform.drive, + bob_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let carol = create_test_identity_with_rng( + &platform.drive, + carol_id, + &mut rng, + None, + platform_version, + ) + .expect("expected to create a test identity"); + + let block = BlockInfo::default_with_epoch(Epoch::new(0).unwrap()); + + let (alice_enc_key, _) = IdentityPublicKey::random_key_with_known_attributes( + 2, + &mut rng, + Purpose::ENCRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + let (alice_dec_key, _) = IdentityPublicKey::random_key_with_known_attributes( + 3, + &mut rng, + Purpose::DECRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + let (bob_enc_key, _) = IdentityPublicKey::random_key_with_known_attributes( + 2, + &mut rng, + Purpose::ENCRYPTION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: dashpay.id(), + document_type_name: "contactRequest".to_string(), + }), + platform_version, + ) + .unwrap(); + + let db_transaction = platform.drive.grove.start_transaction(); + + platform + .drive + .add_new_unique_keys_to_identity( + alice.id().to_buffer(), + vec![alice_enc_key.clone(), alice_dec_key.clone()], + &block, + true, + Some(&db_transaction), + platform_version, + ) + .expect("expected to add a new key"); + + platform + .drive + .add_new_unique_keys_to_identity( + bob.id().to_buffer(), + vec![bob_enc_key.clone()], + &block, + true, + Some(&db_transaction), + platform_version, + ) + .expect("expected to add a new key"); + platform + .drive + .grove + .commit_transaction(db_transaction) + .unwrap() + .expect("expected to be able to commit a transaction"); + + let request = GetIdentitiesContractKeysRequestV0 { + identities_ids: vec![alice.id().to_vec(), bob.id().to_vec(), carol.id().to_vec()], + contract_id: dashpay.id().to_vec(), + document_type_name: Some("contactRequest".to_string()), + purposes: vec![Purpose::ENCRYPTION as i32, Purpose::DECRYPTION as i32], + prove: true, + }; + + let result = platform + .query_identities_contract_keys_v0(request, &state, platform_version) + .expect("query failed"); + + let GetIdentitiesContractKeysResponseV0 { result, .. } = + result.data.expect("expected data"); + + let Result::Proof(proof) = result.expect("expected proof") else { + panic!("expected IdentitiesKeys"); + }; + + let (_, results) = Drive::verify_identities_contract_keys( + proof.grovedb_proof.as_slice(), + &[ + alice.id().to_buffer(), + bob.id().to_buffer(), + carol.id().to_buffer(), + ], + dashpay.id().as_bytes(), + Some("contactRequest".to_string()), + vec![Purpose::ENCRYPTION, Purpose::DECRYPTION], + false, + platform_version, + ) + .expect("expected to verify proof"); + + assert_eq!( + results + .get(&alice.id()) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![Some(alice_enc_key), Some(alice_dec_key)] + ); + assert_eq!( + results + .get(&bob.id()) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![Some(bob_enc_key), None] + ); + assert_eq!( + results + .get(&carol.id()) + .expect("expected this identifier") + .values() + .cloned() + .collect::>(), + vec![None, None] + ); + } +} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity/mod.rs index cd465ff771f..00bb4a21391 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity/mod.rs @@ -3,28 +3,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identity_request::Version; -use dapi_grpc::platform::v0::GetIdentityRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_identity_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identity_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetIdentityRequest, GetIdentityResponse}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of an identity - pub(in crate::query) fn query_identity( + pub fn query_identity( &self, - state: &PlatformState, - query_data: &[u8], + GetIdentityRequest { version }: GetIdentityRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetIdentityRequest { version } = - check_validation_result_with_data!(GetIdentityRequest::decode(query_data).map_err( - |e| QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - )); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode identity query".to_string()), @@ -38,7 +31,7 @@ impl Platform { .identity; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -52,8 +45,13 @@ impl Platform { )); } match version { - Version::V0(get_identity_request) => { - self.query_identity_v0(state, get_identity_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = + self.query_identity_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response| GetIdentityResponse { + version: Some(ResponseVersion::V0(response)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs index 358ebd142bc..9ead1303bfb 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs @@ -1,58 +1,45 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_identity_request::GetIdentityRequestV0; -use dapi_grpc::platform::v0::get_identity_response::GetIdentityResponseV0; -use dapi_grpc::platform::v0::{get_identity_response, GetIdentityResponse, Proof}; +use dapi_grpc::platform::v0::get_identity_response::{ + get_identity_response_v0, GetIdentityResponseV0, +}; use dpp::check_validation_result_with_data; use dpp::identifier::Identifier; use dpp::serialization::PlatformSerializable; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { pub(super) fn query_identity_v0( &self, - state: &PlatformState, - get_identity_request: GetIdentityRequestV0, + GetIdentityRequestV0 { id, prove }: GetIdentityRequestV0, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetIdentityRequestV0 { id, prove } = get_identity_request; + ) -> Result, Error> { let identity_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { QueryError::InvalidArgument( "id must be a valid identifier (32 bytes long)".to_string(), ) })); - let response_data = if prove { + + let response = if prove { let proof = self.drive.prove_full_identity( identity_id.into_buffer(), None, &platform_version.drive, )?; - GetIdentityResponse { - version: Some(get_identity_response::Version::V0(GetIdentityResponseV0 { - result: Some( - get_identity_response::get_identity_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - }), - ), - metadata: Some(metadata), - })), + GetIdentityResponseV0 { + result: Some(get_identity_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let maybe_identity = self.drive.fetch_full_identity( identity_id.into_buffer(), @@ -68,18 +55,84 @@ impl Platform { .serialize_consume_to_bytes() .map_err(Error::Protocol)?; - GetIdentityResponse { - version: Some(get_identity_response::Version::V0(GetIdentityResponseV0 { - result: Some( - get_identity_response::get_identity_response_v0::Result::Identity( - serialized_identity, - ), - ), - metadata: Some(metadata), - })), + GetIdentityResponseV0 { + result: Some(get_identity_response_v0::Result::Identity( + serialized_identity, + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_identity_id() { + let (platform, state, _unused_version) = setup_platform(None, Network::Testnet); + + let version = PlatformVersion::latest(); + + let request = GetIdentityRequestV0 { + id: vec![0; 8], + prove: false, + }; + + let result = platform + .query_identity_v0(request, &state, version) + .expect("should execute query"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_identity_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + let request = GetIdentityRequestV0 { + id: id.clone(), + prove: false, + }; + + let result = platform + .query_identity_v0(request, &state, version) + .expect("should execute query"); + + let validation_error = result.first_error().unwrap(); + + assert!(matches!( + validation_error, + QueryError::NotFound(msg) if msg.contains("identity") + )); + } + + #[test] + fn test_identity_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + let request = GetIdentityRequestV0 { + id: id.clone(), + prove: true, + }; + + let result = platform + .query_identity_v0(request, &state, version) + .expect("should execute query"); + + assert!(matches!( + result.data, + Some(GetIdentityResponseV0 { + result: Some(get_identity_response_v0::Result::Proof(_)), + metadata: Some(_) + }) + )) } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/mod.rs index 009705453e0..db20b658b6f 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/mod.rs @@ -3,29 +3,23 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identity_by_public_key_hash_request::Version; -use dapi_grpc::platform::v0::GetIdentityByPublicKeyHashRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_identity_by_public_key_hash_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identity_by_public_key_hash_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetIdentityByPublicKeyHashRequest, GetIdentityByPublicKeyHashResponse, +}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of an identity by a public key hash - pub(in crate::query) fn query_identity_by_public_key_hash( + pub fn query_identity_by_public_key_hash( &self, - state: &PlatformState, - query_data: &[u8], + GetIdentityByPublicKeyHashRequest { version }: GetIdentityByPublicKeyHashRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetIdentityByPublicKeyHashRequest { version } = check_validation_result_with_data!( - GetIdentityByPublicKeyHashRequest::decode(query_data).map_err(|e| { - QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - }) - ); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError( @@ -41,8 +35,9 @@ impl Platform { .identity_by_public_key_hash; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; + if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( QueryError::UnsupportedQueryVersion( @@ -54,13 +49,21 @@ impl Platform { ), )); } + match version { - Version::V0(get_identity_by_public_key_hash_request) => self - .query_identity_by_public_key_hash_v0( - state, - get_identity_by_public_key_hash_request, + RequestVersion::V0(request_v0) => { + let request = self.query_identity_by_public_key_hash_v0( + request_v0, + platform_state, platform_version, - ), + )?; + + Ok( + request.map(|response_v0| GetIdentityByPublicKeyHashResponse { + version: Some(ResponseVersion::V0(response_v0)), + }), + ) + } } } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs index 988a3e5d855..e3249f25376 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs @@ -1,61 +1,48 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_identity_by_public_key_hash_request::GetIdentityByPublicKeyHashRequestV0; -use dapi_grpc::platform::v0::get_identity_by_public_key_hash_response::GetIdentityByPublicKeyHashResponseV0; -use dapi_grpc::platform::v0::{ - get_identity_by_public_key_hash_response, GetIdentityByPublicKeyHashResponse, Proof, +use dapi_grpc::platform::v0::get_identity_by_public_key_hash_response::{ + get_identity_by_public_key_hash_response_v0, GetIdentityByPublicKeyHashResponseV0, }; use dpp::check_validation_result_with_data; use dpp::platform_value::Bytes20; use dpp::serialization::PlatformSerializable; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { pub(super) fn query_identity_by_public_key_hash_v0( &self, - state: &PlatformState, - request: GetIdentityByPublicKeyHashRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetIdentityByPublicKeyHashRequestV0 { + GetIdentityByPublicKeyHashRequestV0 { public_key_hash, prove, - } = request; + }: GetIdentityByPublicKeyHashRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { let public_key_hash = check_validation_result_with_data!(Bytes20::from_vec(public_key_hash) .map(|bytes| bytes.0) .map_err(|_| QueryError::InvalidArgument( "public key hash must be 20 bytes long".to_string() ))); - let response_data = if prove { + + let response = if prove { let proof = self.drive.prove_full_identity_by_unique_public_key_hash( public_key_hash, None, platform_version, )?; - GetIdentityByPublicKeyHashResponse { - version: Some(get_identity_by_public_key_hash_response::Version::V0(GetIdentityByPublicKeyHashResponseV0 { - result: Some(get_identity_by_public_key_hash_response::get_identity_by_public_key_hash_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), + GetIdentityByPublicKeyHashResponseV0 { + result: Some(get_identity_by_public_key_hash_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let maybe_identity = self.drive.fetch_full_identity_by_unique_public_key_hash( public_key_hash, @@ -74,14 +61,87 @@ impl Platform { .serialize_consume_to_bytes() .map_err(Error::Protocol)?; - GetIdentityByPublicKeyHashResponse { - version: Some(get_identity_by_public_key_hash_response::Version::V0(GetIdentityByPublicKeyHashResponseV0 { - metadata: Some(metadata), - result: Some(get_identity_by_public_key_hash_response::get_identity_by_public_key_hash_response_v0::Result::Identity(serialized_identity)), - })), + GetIdentityByPublicKeyHashResponseV0 { + metadata: Some(self.response_metadata_v0(platform_state)), + result: Some( + get_identity_by_public_key_hash_response_v0::Result::Identity( + serialized_identity, + ), + ), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_public_key_hash() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityByPublicKeyHashRequestV0 { + public_key_hash: vec![0; 8], + prove: false, + }; + + let result = platform + .query_identity_by_public_key_hash_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg == &"public key hash must be 20 bytes long".to_string() + )); + } + + #[test] + fn test_identity_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let public_key_hash = vec![0; 20]; + let request = GetIdentityByPublicKeyHashRequestV0 { + public_key_hash: public_key_hash.clone(), + prove: false, + }; + + let result = platform + .query_identity_by_public_key_hash_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::NotFound(msg)] if msg.contains("identity for public key hash") + )) + } + + #[test] + fn test_identity_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let public_key_hash = vec![0; 20]; + let request = GetIdentityByPublicKeyHashRequestV0 { + public_key_hash: public_key_hash.clone(), + prove: true, + }; + + let result = platform + .query_identity_by_public_key_hash_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetIdentityByPublicKeyHashResponseV0 { + result: Some(get_identity_by_public_key_hash_response_v0::Result::Proof( + _ + )), + metadata: Some(_), + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_contract_nonce/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..dc25837dfc2 --- /dev/null +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_contract_nonce/mod.rs @@ -0,0 +1,63 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_identity_contract_nonce_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identity_contract_nonce_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetIdentityContractNonceRequest, GetIdentityContractNonceResponse}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying of an identity by a public key hash + pub fn query_identity_contract_nonce( + &self, + GetIdentityContractNonceRequest { version }: GetIdentityContractNonceRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError( + "could not decode identity contract nonce query".to_string(), + ), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .identity_based_queries + .identity_contract_nonce; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "identity_contract_nonce".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_identity_contract_nonce_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok(result.map(|response_v0| GetIdentityContractNonceResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_contract_nonce/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..6db26c62f85 --- /dev/null +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_contract_nonce/v0/mod.rs @@ -0,0 +1,398 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_identity_contract_nonce_request::GetIdentityContractNonceRequestV0; +use dapi_grpc::platform::v0::get_identity_contract_nonce_response::{ + get_identity_contract_nonce_response_v0, GetIdentityContractNonceResponseV0, +}; +use dpp::check_validation_result_with_data; +use dpp::platform_value::Identifier; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; + +impl Platform { + pub(super) fn query_identity_contract_nonce_v0( + &self, + GetIdentityContractNonceRequestV0 { + identity_id, + contract_id, + prove, + }: GetIdentityContractNonceRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let identity_id = check_validation_result_with_data!(Identifier::from_vec(identity_id) + .map(|bytes| bytes.0) + .map_err(|_| QueryError::InvalidArgument( + "identity id must be 32 bytes long".to_string() + ))); + + let contract_id = check_validation_result_with_data!(Identifier::from_vec(contract_id) + .map(|bytes| bytes.0) + .map_err(|_| QueryError::InvalidArgument( + "contract id must be 32 bytes long".to_string() + ))); + + let response = if prove { + let proof = self.drive.prove_identity_contract_nonce( + identity_id.0, + contract_id.0, + None, + &platform_version.drive, + )?; + + GetIdentityContractNonceResponseV0 { + result: Some(get_identity_contract_nonce_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let maybe_identity = self.drive.fetch_identity_contract_nonce( + identity_id.0, + contract_id.0, + true, + None, + platform_version, + )?; + + // default here is 0; + let identity_contract_nonce = maybe_identity.unwrap_or_default(); + + GetIdentityContractNonceResponseV0 { + metadata: Some(self.response_metadata_v0(platform_state)), + result: Some( + get_identity_contract_nonce_response_v0::Result::IdentityContractNonce( + identity_contract_nonce, + ), + ), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use dpp::block::block_info::BlockInfo; + use dpp::dashcore::Network; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::identity_nonce::{ + IDENTITY_NONCE_VALUE_FILTER, IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES, + }; + use drive::util::test_helpers::test_utils::identities::create_test_identity_with_rng; + use rand::rngs::StdRng; + use rand::{Rng, SeedableRng}; + + #[test] + fn test_invalid_identity_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: vec![0; 8], + prove: false, + contract_id: vec![1; 32], + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg.contains("identity id must be 32 bytes long"))); + } + + #[test] + fn test_invalid_contract_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: vec![0; 32], + prove: false, + contract_id: vec![1; 8], + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg.contains("contract id must be 32 bytes long"))); + } + + #[test] + fn test_identity_not_found_when_querying_identity_nonce() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: vec![0; 32], + prove: false, + contract_id: vec![0; 32], + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityContractNonceResponseV0 { + result: Some( + get_identity_contract_nonce_response_v0::Result::IdentityContractNonce(0) + ), + metadata: Some(_), + }) + )); + } + + #[test] + fn test_contract_info_not_found_when_querying_identity_nonce_with_known_identity() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + let mut rng = StdRng::seed_from_u64(45); + let id = rng.gen::<[u8; 32]>(); + let _unused_identity = + create_test_identity_with_rng(&platform.drive, id, &mut rng, None, version) + .expect("expected to create a test identity"); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: id.to_vec(), + prove: false, + contract_id: vec![0; 32], + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityContractNonceResponseV0 { + result: Some( + get_identity_contract_nonce_response_v0::Result::IdentityContractNonce(0) + ), + metadata: Some(_), + }) + )); + } + + #[test] + fn test_identity_is_found_when_querying_identity_nonce() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + let mut rng = StdRng::seed_from_u64(10); + let id = rng.gen::<[u8; 32]>(); + let identity = create_test_identity_with_rng(&platform.drive, id, &mut rng, None, version) + .expect("expected to create a test identity"); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + platform + .drive + .merge_identity_contract_nonce( + identity.id().to_buffer(), + dashpay.id().to_buffer(), + 1, + &BlockInfo::default(), + true, + None, + &mut vec![], + version, + ) + .expect("expected to set nonce"); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: id.to_vec(), + prove: false, + contract_id: dashpay.id().to_vec(), + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityContractNonceResponseV0 { + result: Some( + get_identity_contract_nonce_response_v0::Result::IdentityContractNonce(1) + ), + metadata: Some(_), + }) + )); + } + + #[test] + fn test_identity_is_found_when_querying_identity_nonce_after_update() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + let mut rng = StdRng::seed_from_u64(10); + let id = rng.gen::<[u8; 32]>(); + let identity = create_test_identity_with_rng(&platform.drive, id, &mut rng, None, version) + .expect("expected to create a test identity"); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + platform + .drive + .merge_identity_contract_nonce( + identity.id().to_buffer(), + dashpay.id().to_buffer(), + 1, + &BlockInfo::default(), + true, + None, + &mut vec![], + version, + ) + .expect("expected to set nonce"); + + platform + .drive + .merge_identity_contract_nonce( + identity.id().to_buffer(), + dashpay.id().to_buffer(), + 3, + &BlockInfo::default(), + true, + None, + &mut vec![], + version, + ) + .expect("expected to set nonce"); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: id.to_vec(), + prove: false, + contract_id: dashpay.id().to_vec(), + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityContractNonceResponseV0 { + result: Some( + get_identity_contract_nonce_response_v0::Result::IdentityContractNonce(nonce) + ), + metadata: Some(_), + }) if nonce & IDENTITY_NONCE_VALUE_FILTER == 3 && nonce >> IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES == 1 + )); + } + + #[test] + fn test_identity_is_found_when_querying_identity_nonce_after_update_for_past() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + let mut rng = StdRng::seed_from_u64(10); + let id = rng.gen::<[u8; 32]>(); + let identity = create_test_identity_with_rng(&platform.drive, id, &mut rng, None, version) + .expect("expected to create a test identity"); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + + platform + .drive + .merge_identity_contract_nonce( + identity.id().to_buffer(), + dashpay.id().to_buffer(), + 1, + &BlockInfo::default(), + true, + None, + &mut vec![], + version, + ) + .expect("expected to set nonce"); + + platform + .drive + .merge_identity_contract_nonce( + identity.id().to_buffer(), + dashpay.id().to_buffer(), + 3, + &BlockInfo::default(), + true, + None, + &mut vec![], + version, + ) + .expect("expected to set nonce"); + + // we already added 3, and now are adding 2 + platform + .drive + .merge_identity_contract_nonce( + identity.id().to_buffer(), + dashpay.id().to_buffer(), + 2, + &BlockInfo::default(), + true, + None, + &mut vec![], + version, + ) + .expect("expected to set nonce"); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: id.to_vec(), + prove: false, + contract_id: dashpay.id().to_vec(), + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityContractNonceResponseV0 { + result: Some( + get_identity_contract_nonce_response_v0::Result::IdentityContractNonce(3) + ), + metadata: Some(_), + }) + )); + } + + #[test] + fn test_identity_contract_nonce_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityContractNonceRequestV0 { + identity_id: vec![0; 32], + prove: true, + contract_id: vec![0; 32], + }; + + let result = platform + .query_identity_contract_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityContractNonceResponseV0 { + result: Some(get_identity_contract_nonce_response_v0::Result::Proof(_)), + metadata: Some(_), + }) + )); + } +} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_nonce/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_nonce/mod.rs new file mode 100644 index 00000000000..e5cf40cac31 --- /dev/null +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_nonce/mod.rs @@ -0,0 +1,58 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_identity_nonce_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identity_nonce_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetIdentityNonceRequest, GetIdentityNonceResponse}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying of an identity by the nonce + pub fn query_identity_nonce( + &self, + GetIdentityNonceRequest { version }: GetIdentityNonceRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError("could not decode identity nonce query".to_string()), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .identity_based_queries + .identity_nonce; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "identity_nonce".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = + self.query_identity_nonce_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetIdentityNonceResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_nonce/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_nonce/v0/mod.rs new file mode 100644 index 00000000000..4c6874cf270 --- /dev/null +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_nonce/v0/mod.rs @@ -0,0 +1,282 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_identity_nonce_request::GetIdentityNonceRequestV0; +use dapi_grpc::platform::v0::get_identity_nonce_response::{ + get_identity_nonce_response_v0, GetIdentityNonceResponseV0, +}; +use dpp::check_validation_result_with_data; +use dpp::platform_value::Identifier; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; + +impl Platform { + pub(super) fn query_identity_nonce_v0( + &self, + GetIdentityNonceRequestV0 { identity_id, prove }: GetIdentityNonceRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let identity_id = check_validation_result_with_data!(Identifier::from_vec(identity_id) + .map(|bytes| bytes.0) + .map_err(|_| QueryError::InvalidArgument( + "identity id must be 32 bytes long".to_string() + ))); + + let response = if prove { + let proof = self + .drive + .prove_identity_nonce(identity_id.0, None, platform_version)?; + + GetIdentityNonceResponseV0 { + result: Some(get_identity_nonce_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let maybe_identity = + self.drive + .fetch_identity_nonce(identity_id.0, true, None, platform_version)?; + + // default here is 0; + let identity_nonce = maybe_identity.unwrap_or_default(); + + GetIdentityNonceResponseV0 { + metadata: Some(self.response_metadata_v0(platform_state)), + result: Some(get_identity_nonce_response_v0::Result::IdentityNonce( + identity_nonce, + )), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use dpp::block::block_info::BlockInfo; + use dpp::dashcore::Network; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::identity_nonce::{ + IDENTITY_NONCE_VALUE_FILTER, IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES, + }; + use drive::util::test_helpers::test_utils::identities::create_test_identity_with_rng; + use rand::prelude::StdRng; + use rand::{Rng, SeedableRng}; + + #[test] + fn test_invalid_identity_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityNonceRequestV0 { + identity_id: vec![0; 8], + prove: false, + }; + + let result = platform + .query_identity_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg.contains("identity id must be 32 bytes long"))); + } + + #[test] + fn test_identity_not_found_when_querying_identity_nonce() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityNonceRequestV0 { + identity_id: vec![0; 32], + prove: false, + }; + + let result = platform + .query_identity_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityNonceResponseV0 { + result: Some(get_identity_nonce_response_v0::Result::IdentityNonce(0)), + metadata: Some(_), + }) + )); + } + + #[test] + fn test_identity_is_found_when_querying_identity_nonce() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + let mut rng = StdRng::seed_from_u64(10); + let id = rng.gen::<[u8; 32]>(); + let _unused_identity = + create_test_identity_with_rng(&platform.drive, id, &mut rng, None, version) + .expect("expected to create a test identity"); + + let request = GetIdentityNonceRequestV0 { + identity_id: id.to_vec(), + prove: false, + }; + + let result = platform + .query_identity_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityNonceResponseV0 { + result: Some(get_identity_nonce_response_v0::Result::IdentityNonce(0)), + metadata: Some(_), + }) + )); + } + + #[test] + fn test_identity_is_found_when_querying_identity_nonce_after_update() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + let mut rng = StdRng::seed_from_u64(10); + let id = rng.gen::<[u8; 32]>(); + let identity = create_test_identity_with_rng(&platform.drive, id, &mut rng, None, version) + .expect("expected to create a test identity"); + + platform + .drive + .merge_identity_nonce( + identity.id().to_buffer(), + 1, + &BlockInfo::genesis(), + true, + None, + version, + ) + .expect("expected to set nonce"); + + platform + .drive + .merge_identity_nonce( + identity.id().to_buffer(), + 3, + &BlockInfo::genesis(), + true, + None, + version, + ) + .expect("expected to set nonce"); + + let request = GetIdentityNonceRequestV0 { + identity_id: id.to_vec(), + prove: false, + }; + + let result = platform + .query_identity_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityNonceResponseV0 { + result: Some(get_identity_nonce_response_v0::Result::IdentityNonce(nonce)), + metadata: Some(_), + }) if nonce & IDENTITY_NONCE_VALUE_FILTER == 3 && nonce >> IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES == 1 + )); + } + + #[test] + fn test_identity_is_found_when_querying_identity_nonce_after_update_for_past() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + let mut rng = StdRng::seed_from_u64(10); + let id = rng.gen::<[u8; 32]>(); + let identity = create_test_identity_with_rng(&platform.drive, id, &mut rng, None, version) + .expect("expected to create a test identity"); + + platform + .drive + .merge_identity_nonce( + identity.id().to_buffer(), + 1, + &BlockInfo::default(), + true, + None, + version, + ) + .expect("expected to set nonce"); + + platform + .drive + .merge_identity_nonce( + identity.id().to_buffer(), + 3, + &BlockInfo::default(), + true, + None, + version, + ) + .expect("expected to set nonce"); + + // we already added 3, and now are adding 2 + platform + .drive + .merge_identity_nonce( + identity.id().to_buffer(), + 2, + &BlockInfo::default(), + true, + None, + version, + ) + .expect("expected to set nonce"); + + let request = GetIdentityNonceRequestV0 { + identity_id: id.to_vec(), + prove: false, + }; + + let result = platform + .query_identity_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(result.is_valid()); + + assert!(matches!( + result.data, + Some(GetIdentityNonceResponseV0 { + result: Some(get_identity_nonce_response_v0::Result::IdentityNonce(3)), + metadata: Some(_), + }) + )); + } + + #[test] + fn test_identity_contract_nonce_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityNonceRequestV0 { + identity_id: vec![0; 32], + prove: true, + }; + + let result = platform + .query_identity_nonce_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetIdentityNonceResponseV0 { + result: Some(get_identity_nonce_response_v0::Result::Proof(_)), + metadata: Some(_), + }) + )); + } +} diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/keys/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/keys/mod.rs index fa87f7ba8a6..51ba2bd9bdb 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/keys/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/keys/mod.rs @@ -3,28 +3,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_identity_keys_request::Version; -use dapi_grpc::platform::v0::GetIdentityKeysRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_identity_keys_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_identity_keys_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetIdentityKeysRequest, GetIdentityKeysResponse}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of an identity's keys - pub(in crate::query) fn query_keys( + pub fn query_keys( &self, - state: &PlatformState, - query_data: &[u8], + GetIdentityKeysRequest { version }: GetIdentityKeysRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetIdentityKeysRequest { version } = - check_validation_result_with_data!(GetIdentityKeysRequest::decode(query_data).map_err( - |e| QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - )); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode identity keys query".to_string()), @@ -38,7 +31,7 @@ impl Platform { .keys; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -52,8 +45,12 @@ impl Platform { )); } match version { - Version::V0(get_identity_request) => { - self.query_keys_v0(state, get_identity_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = self.query_keys_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetIdentityKeysResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs index 80b3bbb6088..7079dacf093 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs @@ -1,18 +1,17 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_identity_keys_request::GetIdentityKeysRequestV0; -use dapi_grpc::platform::v0::get_identity_keys_response::GetIdentityKeysResponseV0; -use dapi_grpc::platform::v0::{get_identity_keys_response, GetIdentityKeysResponse, Proof}; +use dapi_grpc::platform::v0::get_identity_keys_response::{ + get_identity_keys_response_v0, GetIdentityKeysResponseV0, +}; use dpp::check_validation_result_with_data; use dpp::identifier::Identifier; use drive::error::query::QuerySyntaxError; -use prost::Message; use std::collections::BTreeMap; +use crate::platform_types::platform_state::PlatformState; use dpp::identity::{KeyID, Purpose, SecurityLevel}; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; @@ -74,24 +73,22 @@ fn convert_key_request_type( impl Platform { pub(super) fn query_keys_v0( &self, - state: &PlatformState, - request: GetIdentityKeysRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetIdentityKeysRequestV0 { + GetIdentityKeysRequestV0 { identity_id, request_type, limit, offset, prove, - } = request; + }: GetIdentityKeysRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { let identity_id: Identifier = check_validation_result_with_data!(identity_id .try_into() .map_err(|_| QueryError::InvalidArgument( "id must be a valid identifier (32 bytes long)".to_string() ))); + if let Some(limit) = limit { if limit > u16::MAX as u32 { return Ok(QueryValidationResult::new_with_error(QueryError::Query( @@ -115,64 +112,283 @@ impl Platform { ))); } } + let Some(request_type) = request_type else { return Ok(QueryValidationResult::new_with_error(QueryError::Query( QuerySyntaxError::InvalidParameter("key request must be defined".to_string()), ))); }; + let Some(request) = request_type.request else { return Ok(QueryValidationResult::new_with_error(QueryError::Query( QuerySyntaxError::InvalidParameter("key request must be defined".to_string()), ))); }; + let key_request_type = check_validation_result_with_data!(convert_key_request_type(request)); + let key_request = IdentityKeysRequest { identity_id: identity_id.into_buffer(), request_type: key_request_type, limit: limit.map(|l| l as u16), offset: offset.map(|o| o as u16), }; - let response_data = if prove { + + let response = if prove { let proof = self .drive .prove_identity_keys(key_request, None, platform_version)?; - GetIdentityKeysResponse { - version: Some(get_identity_keys_response::Version::V0(GetIdentityKeysResponseV0 { - result: Some(get_identity_keys_response::get_identity_keys_response_v0::Result::Proof(Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - })), - metadata: Some(metadata), - })), + GetIdentityKeysResponseV0 { + result: Some(get_identity_keys_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let keys: SerializedKeyVec = self.drive .fetch_identity_keys(key_request, None, platform_version)?; - GetIdentityKeysResponse { - version: Some(get_identity_keys_response::Version::V0( - GetIdentityKeysResponseV0 { - result: Some( - get_identity_keys_response::get_identity_keys_response_v0::Result::Keys( - get_identity_keys_response::get_identity_keys_response_v0::Keys { - keys_bytes: keys, - }, - ), - ), - metadata: Some(metadata), - }, + GetIdentityKeysResponseV0 { + result: Some(get_identity_keys_response_v0::Result::Keys( + get_identity_keys_response_v0::Keys { keys_bytes: keys }, )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dapi_grpc::platform::v0::key_request_type::Request; + use dapi_grpc::platform::v0::{AllKeys, KeyRequestType, SearchKey, SecurityLevelMap}; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_identity_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 8], + request_type: None, + limit: None, + offset: None, + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_invalid_limit_u16_overflow() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: None, + limit: Some(u32::MAX), + offset: None, + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidParameter(msg))] if msg == "limit out of bounds" + )); + } + + #[test] + fn test_invalid_limit_max() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: None, + limit: Some((platform.config.drive.max_query_limit + 1) as u32), + offset: None, + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + let error_message = format!( + "limit greater than max limit {}", + platform.config.drive.max_query_limit + ); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidLimit(msg))] if msg == &error_message + )); + } + + #[test] + fn test_invalid_offset_u16_overflow() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: None, + limit: None, + offset: Some(u32::MAX), + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidParameter(msg))] if msg == "offset out of bounds" + )); + } + + #[test] + fn test_missing_request_type() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: None, + limit: None, + offset: None, + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidParameter(msg))] if msg == "key request must be defined" + )); + } + + #[test] + fn test_missing_request() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: Some(KeyRequestType { request: None }), + limit: None, + offset: None, + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidParameter(msg))] if msg == "key request must be defined" + )); + } + + #[test] + fn test_invalid_key_request_type() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: Some(KeyRequestType { + request: Some(Request::SearchKey(SearchKey { + purpose_map: [( + 0, + SecurityLevelMap { + security_level_map: [(u32::MAX, 0)].into_iter().collect(), + }, + )] + .into_iter() + .collect(), + })), + }), + limit: None, + offset: None, + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::Query(QuerySyntaxError::InvalidKeyParameter(msg))] if msg == "security level out of bounds" + )); + } + + #[test] + fn test_absent_keys() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: Some(KeyRequestType { + request: Some(Request::AllKeys(AllKeys {})), + }), + limit: None, + offset: None, + prove: false, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetIdentityKeysResponseV0 { + result: Some(get_identity_keys_response_v0::Result::Keys(keys)), + .. + }) if keys.keys_bytes.is_empty() + )); + } + + #[test] + fn test_absent_keys_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetIdentityKeysRequestV0 { + identity_id: vec![0; 32], + request_type: Some(KeyRequestType { + request: Some(Request::AllKeys(AllKeys {})), + }), + limit: None, + offset: None, + prove: true, + }; + + let result = platform + .query_keys_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetIdentityKeysResponseV0 { + result: Some(get_identity_keys_response_v0::Result::Proof(_)), + metadata: Some(_) + }) + )); } } diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/mod.rs index e636cc4e59c..3a9d833283d 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/mod.rs @@ -1,7 +1,8 @@ mod balance; mod balance_and_revision; -mod identities; -mod identities_by_public_key_hashes; +mod identities_contract_keys; mod identity; mod identity_by_public_key_hash; +mod identity_contract_nonce; +mod identity_nonce; mod keys; diff --git a/packages/rs-drive-abci/src/query/mod.rs b/packages/rs-drive-abci/src/query/mod.rs index 9d3225e6749..197cb4dd267 100644 --- a/packages/rs-drive-abci/src/query/mod.rs +++ b/packages/rs-drive-abci/src/query/mod.rs @@ -1,103 +1,73 @@ mod data_contract_based_queries; mod document_query; mod identity_based_queries; +mod prefunded_specialized_balances; mod proofs; mod response_metadata; +mod service; mod system; -mod v0; +mod voting; use crate::error::query::QueryError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::error::execution::ExecutionError; use dpp::validation::ValidationResult; -use dpp::version::PlatformVersion; + +pub use service::QueryService; /// A query validation result pub type QueryValidationResult = ValidationResult; -impl Platform { - /// Querying - pub fn query( - &self, - query_path: &str, - query_data: &[u8], - platform_version: &PlatformVersion, - ) -> Result>, Error> { - match platform_version.drive_abci.query.base_query_structure { - 0 => self.query_v0(query_path, query_data, platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "Platform::query".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} - #[cfg(test)] mod tests { - #[macro_export] - macro_rules! extract_single_variant_or_panic { - ($expression:expr, $pattern:pat, $binding:ident) => { - match $expression { - $pattern => $binding, - // _ => panic!( - // "Expected pattern {} but got another variant", - // stringify!($pattern) - // ), - } - }; - } - - #[macro_export] - macro_rules! extract_variant_or_panic { - ($expression:expr, $pattern:pat, $binding:ident) => { - match $expression { - $pattern => $binding, - _ => panic!( - "Expected pattern {} but got another variant", - stringify!($pattern) - ), - } - }; - } - - use crate::config::PlatformConfig; use crate::error::query::QueryError; use crate::platform_types::platform::Platform; + use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use crate::rpc::core::MockCoreRPCLike; use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; use dpp::block::block_info::BlockInfo; - use dpp::block::epoch::Epoch; - use dpp::prelude::DataContract; - use drive::drive::batch::DataContractOperationType; - use drive::drive::batch::DriveOperation::DataContractOperation; + use dpp::data_contract::DataContract; + + use crate::config::PlatformConfig; + use dpp::dashcore::Network; + use dpp::prelude::{CoreBlockHeight, TimestampMillis}; + use drive::util::batch::DataContractOperationType; + use drive::util::batch::DriveOperation::DataContractOperation; use platform_version::version::PlatformVersion; use std::borrow::Cow; + use std::sync::Arc; + + pub fn setup_platform<'a>( + with_genesis_state: Option<(TimestampMillis, CoreBlockHeight)>, + network: Network, + ) -> ( + TempPlatform, + Arc, + &'a PlatformVersion, + ) { + let platform = if let Some((timestamp, activation_core_block_height)) = with_genesis_state { + TestPlatformBuilder::new() + .with_config(PlatformConfig::default_for_network(network)) + .build_with_mock_rpc() + .set_genesis_state_with_activation_info(timestamp, activation_core_block_height) + } else { + TestPlatformBuilder::new() + .with_config(PlatformConfig::default_for_network(network)) + .build_with_mock_rpc() + .set_initial_state_structure() + }; - fn setup_platform<'a>() -> (TempPlatform, &'a PlatformVersion) { - let platform = TestPlatformBuilder::new() - .with_config(PlatformConfig { - ..Default::default() - }) - .build_with_mock_rpc(); - let platform = platform.set_initial_state_structure(); + // We can't return a reference to Arc (`load` method) so we clone Arc (`load_full`). + // This is a bit slower but we don't care since we are in test environment + let platform_state = platform.platform.state.load_full(); - let platform_version = platform - .platform - .state - .read() - .unwrap() - .current_platform_version() - .unwrap(); + let platform_version = platform_state.current_platform_version().unwrap(); - (platform, platform_version) + (platform, platform_state, platform_version) } - fn store_data_contract( + pub fn store_data_contract( platform: &Platform, data_contract: &DataContract, platform_version: &PlatformVersion, @@ -107,2607 +77,27 @@ mod tests { storage_flags: None, }); - let block_info = BlockInfo { - time_ms: 0, - height: 0, - core_height: 0, - epoch: Epoch::default(), - }; + let block_info = BlockInfo::genesis(); platform .drive - .apply_drive_operations(vec![operation], true, &block_info, None, platform_version) + .apply_drive_operations( + vec![operation], + true, + &block_info, + None, + platform_version, + None, + ) .expect("expected to apply drive operations"); } - fn assert_invalid_identifier(validation_result: QueryValidationResult>) { - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!( - validation_error, - QueryError::InvalidArgument(msg) if msg.contains("id must be a valid identifier (32 bytes long)") - )); - } - - #[test] - fn test_invalid_path() { - let (platform, platform_version) = setup_platform(); - - let data = vec![0; 32]; - let path = "/invalid_path"; - let result = platform.query(path, &data, platform_version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); + pub fn assert_invalid_identifier( + validation_result: QueryValidationResult, + ) { assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::InvalidArgument(msg) if msg == &format!("query path '{}' is not supported", path).to_string() + validation_result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg.contains("id must be a valid identifier (32 bytes long)") )); } - - #[test] - fn test_invalid_query_data() { - let (platform, version) = setup_platform(); - - let paths = vec![ - "/identity", - "/identities", - "/identity/balance", - "/identity/balanceAndRevision", - "/identity/keys", - "/dataContract", - "/dataContracts", - "/dataContractHistory", - "/documents", - "/dataContract/documents", - "/identity/by-public-key-hash", - "/identities/by-public-key-hash", - "/proofs", - ]; - - paths.iter().for_each(|path| { - let result = platform.query(path, &[0; 8], version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - assert!( - matches!(validation_error, QueryError::InvalidArgument(msg) if msg.contains("invalid query proto message")) - ); - }) - } - - mod identity { - use crate::error::query::QueryError; - use crate::query::tests::assert_invalid_identifier; - use bs58::encode; - use dapi_grpc::platform::v0::get_identity_request::GetIdentityRequestV0; - use dapi_grpc::platform::v0::{ - get_identity_request, get_identity_response, GetIdentityRequest, GetIdentityResponse, - }; - use prost::Message; - - const QUERY_PATH: &str = "/identity"; - - #[test] - fn test_invalid_identity_id() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityRequest { - version: Some(get_identity_request::Version::V0(GetIdentityRequestV0 { - id: vec![0; 8], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_identity_not_found() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - let request = GetIdentityRequest { - version: Some(get_identity_request::Version::V0(GetIdentityRequestV0 { - id: id.clone(), - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - let error_message = format!("identity {} not found", encode(id).into_string()); - - assert!(matches!( - validation_error, - QueryError::NotFound(msg) if msg.contains(&error_message) - )); - } - - #[test] - fn test_identity_absence_proof() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - let request = GetIdentityRequest { - version: Some(get_identity_request::Version::V0(GetIdentityRequestV0 { - id: id.clone(), - prove: true, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let response = - GetIdentityResponse::decode(validation_result.data.unwrap().as_slice()).unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_identity_response::Version::V0(inner), - inner - ) - .result - .unwrap(), - get_identity_response::get_identity_response_v0::Result::Proof(_) - )); - } - } - - mod identities { - use dapi_grpc::platform::v0::get_identities_request::GetIdentitiesRequestV0; - use dapi_grpc::platform::v0::{ - get_identities_request, get_identities_response, GetIdentitiesRequest, - GetIdentitiesResponse, - }; - use prost::Message; - - const QUERY_PATH: &str = "/identities"; - - #[test] - fn test_invalid_identity_id() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentitiesRequest { - version: Some(get_identities_request::Version::V0( - GetIdentitiesRequestV0 { - ids: vec![vec![0; 8]], - prove: false, - }, - )), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_identities_not_found() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - - let request = GetIdentitiesRequest { - version: Some(get_identities_request::Version::V0( - GetIdentitiesRequestV0 { - ids: vec![id.clone()], - prove: false, - }, - )), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); - let data = validation_result.data.unwrap(); - let response = GetIdentitiesResponse::decode(data.as_slice()).unwrap(); - - let get_identities_response::get_identities_response_v0::Result::Identities(identities) = - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_identities_response::Version::V0(inner), - inner - ) - .result - .unwrap() - else { - panic!("invalid response") - }; - - assert!(identities.identity_entries[0].value.is_none()); - } - - #[test] - fn test_identities_absence_proof() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - let request = GetIdentitiesRequest { - version: Some(get_identities_request::Version::V0( - GetIdentitiesRequestV0 { - ids: vec![id.clone()], - prove: true, - }, - )), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let response = - GetIdentitiesResponse::decode(validation_result.data.unwrap().as_slice()).unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_identities_response::Version::V0(inner), - inner - ) - .result - .unwrap(), - get_identities_response::get_identities_response_v0::Result::Proof(_) - )); - } - } - - mod identity_balance { - use crate::error::query::QueryError; - use bs58::encode; - use dapi_grpc::platform::v0::get_identity_balance_request::{ - GetIdentityBalanceRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_identity_balance_response, GetIdentityBalanceRequest, GetIdentityBalanceResponse, - }; - use prost::Message; - - const QUERY_PATH: &str = "/identity/balance"; - - #[test] - fn test_invalid_identity_id() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityBalanceRequest { - version: Some(Version::V0(GetIdentityBalanceRequestV0 { - id: vec![0; 8], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_identity_not_found() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - - let request = GetIdentityBalanceRequest { - version: Some(Version::V0(GetIdentityBalanceRequestV0 { - id: id.clone(), - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let validation_error = validation_result.first_error().unwrap(); - - assert_eq!( - validation_error.to_string(), - "not found error: No Identity found".to_string() - ); - - assert!(matches!(validation_error, QueryError::NotFound(_))); - } - - #[test] - fn test_identity_balance_absence_proof() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - - let request = GetIdentityBalanceRequest { - version: Some(Version::V0(GetIdentityBalanceRequestV0 { - id: id.clone(), - prove: true, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - let validation_result = result.unwrap(); - let response = - GetIdentityBalanceResponse::decode(validation_result.data.unwrap().as_slice()) - .unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_identity_balance_response::Version::V0(inner), - inner - ) - .result - .unwrap(), - get_identity_balance_response::get_identity_balance_response_v0::Result::Proof(_) - )); - } - } - - mod identity_balance_and_revision { - use crate::error::query::QueryError; - use bs58::encode; - use dapi_grpc::platform::v0::get_identity_balance_and_revision_request::{ - GetIdentityBalanceAndRevisionRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_identity_balance_and_revision_response, GetIdentityBalanceAndRevisionRequest, - GetIdentityBalanceAndRevisionResponse, - }; - use prost::Message; - - const QUERY_PATH: &str = "/identity/balanceAndRevision"; - - #[test] - fn test_invalid_identity_id() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityBalanceAndRevisionRequest { - version: Some(Version::V0(GetIdentityBalanceAndRevisionRequestV0 { - id: vec![0; 8], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_identity_not_found_when_querying_balance_and_revision() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - - let request = GetIdentityBalanceAndRevisionRequest { - version: Some(Version::V0(GetIdentityBalanceAndRevisionRequestV0 { - id: id.clone(), - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let validation_error = validation_result.first_error().unwrap(); - - assert_eq!( - validation_error.to_string(), - "not found error: No Identity balance found".to_string() - ); - - assert!(matches!(validation_error, QueryError::NotFound(_))); - } - - #[test] - fn test_identity_balance_and_revision_absence_proof() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - - let request = GetIdentityBalanceAndRevisionRequest { - version: Some(Version::V0(GetIdentityBalanceAndRevisionRequestV0 { - id: id.clone(), - prove: true, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let response = GetIdentityBalanceAndRevisionResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!(response.version.expect("expected a versioned response"), get_identity_balance_and_revision_response::Version::V0(inner), inner).result.unwrap(), - get_identity_balance_and_revision_response::get_identity_balance_and_revision_response_v0::Result::Proof(_) - )); - } - } - - mod identity_keys { - use crate::error::query::QueryError; - use dapi_grpc::platform::v0::get_identity_keys_request::{ - GetIdentityKeysRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_identity_keys_response, key_request_type::Request, AllKeys, GetIdentityKeysRequest, - GetIdentityKeysResponse, KeyRequestType, SearchKey, SecurityLevelMap, - }; - use drive::error::query::QuerySyntaxError; - use prost::Message; - - const QUERY_PATH: &str = "/identity/keys"; - - #[test] - fn test_invalid_identity_id() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 8], - request_type: None, - limit: None, - offset: None, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_invalid_limit_u16_overflow() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: None, - limit: Some(u32::MAX), - offset: None, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!( - validation_error, - QueryError::Query(QuerySyntaxError::InvalidParameter(msg)) if msg == "limit out of bounds" - )); - } - - #[test] - fn test_invalid_limit_max() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: None, - limit: Some((platform.config.drive.max_query_limit + 1) as u32), - offset: None, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - let error_message = format!( - "limit greater than max limit {}", - platform.config.drive.max_query_limit - ); - - assert!(matches!( - validation_error, - QueryError::Query(QuerySyntaxError::InvalidLimit(msg)) if msg == &error_message - )); - } - - #[test] - fn test_invalid_offset_u16_overflow() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: None, - limit: None, - offset: Some(u32::MAX), - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!( - validation_error, - QueryError::Query(QuerySyntaxError::InvalidParameter(msg)) if msg == "offset out of bounds" - )); - } - - #[test] - fn test_missing_request_type() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: None, - limit: None, - offset: None, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!( - validation_error, - QueryError::Query(QuerySyntaxError::InvalidParameter(msg)) if msg == "key request must be defined" - )); - } - - #[test] - fn test_missing_request() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: Some(KeyRequestType { request: None }), - limit: None, - offset: None, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!( - validation_error, - QueryError::Query(QuerySyntaxError::InvalidParameter(msg)) if msg == "key request must be defined" - )); - } - - #[test] - fn test_invalid_key_request_type() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: Some(KeyRequestType { - request: Some(Request::SearchKey(SearchKey { - purpose_map: [( - 0, - SecurityLevelMap { - security_level_map: [(u32::MAX, 0)].into_iter().collect(), - }, - )] - .into_iter() - .collect(), - })), - }), - limit: None, - offset: None, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!( - validation_error, - QueryError::Query(QuerySyntaxError::InvalidKeyParameter(msg)) if msg == "security level out of bounds" - )); - } - - #[test] - fn test_absent_keys() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: Some(KeyRequestType { - request: Some(Request::AllKeys(AllKeys {})), - }), - limit: None, - offset: None, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); - let data = validation_result.data.unwrap(); - - let response = GetIdentityKeysResponse::decode(data.as_slice()).unwrap(); - let get_identity_keys_response::get_identity_keys_response_v0::Result::Keys(keys) = - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_identity_keys_response::Version::V0(inner), - inner - ) - .result - .unwrap() - else { - panic!("invalid response") - }; - - assert_eq!(keys.keys_bytes.len(), 0); - } - - #[test] - fn test_absent_keys_proof() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityKeysRequest { - version: Some(Version::V0(GetIdentityKeysRequestV0 { - identity_id: vec![0; 32], - request_type: Some(KeyRequestType { - request: Some(Request::AllKeys(AllKeys {})), - }), - limit: None, - offset: None, - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let response = - GetIdentityKeysResponse::decode(validation_result.data.unwrap().as_slice()) - .unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_identity_keys_response::Version::V0(inner), - inner - ) - .result - .unwrap(), - get_identity_keys_response::get_identity_keys_response_v0::Result::Proof(_) - )); - } - } - - mod data_contract { - use crate::error::query::QueryError; - use bs58::encode; - use dapi_grpc::platform::v0::get_data_contract_request::{ - GetDataContractRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_data_contract_response, GetDataContractRequest, GetDataContractResponse, - }; - use prost::Message; - - const QUERY_PATH: &str = "/dataContract"; - - #[test] - fn test_invalid_data_contract_id() { - let (platform, version) = super::setup_platform(); - - let request = GetDataContractRequest { - version: Some(Version::V0(GetDataContractRequestV0 { - id: vec![0; 8], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_data_contract_not_found() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - let request = GetDataContractRequest { - version: Some(Version::V0(GetDataContractRequestV0 { - id: id.clone(), - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - let error_message = format!("data contract {} not found", encode(id).into_string()); - - assert!(matches!( - validation_error, - QueryError::NotFound(msg) if msg.contains(&error_message) - )); - } - - #[test] - fn test_data_contract_absence_proof() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - let request = GetDataContractRequest { - version: Some(Version::V0(GetDataContractRequestV0 { - id: id.clone(), - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let response = - GetDataContractResponse::decode(validation_result.data.unwrap().as_slice()) - .unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_data_contract_response::Version::V0(inner), - inner - ) - .result - .unwrap(), - get_data_contract_response::get_data_contract_response_v0::Result::Proof(_) - )); - } - } - - mod data_contracts { - use dapi_grpc::platform::v0::get_data_contracts_request::{ - GetDataContractsRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_data_contracts_response, GetDataContractsRequest, GetDataContractsResponse, - }; - use prost::Message; - - const QUERY_PATH: &str = "/dataContracts"; - - #[test] - fn test_invalid_data_contract_id() { - let (platform, version) = super::setup_platform(); - - let request = GetDataContractsRequest { - version: Some(Version::V0(GetDataContractsRequestV0 { - ids: vec![vec![0; 8]], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_data_contracts_not_found() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - let request = GetDataContractsRequest { - version: Some(Version::V0(GetDataContractsRequestV0 { - ids: vec![id.clone()], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); - let data = validation_result.data.unwrap(); - let response = GetDataContractsResponse::decode(data.as_slice()).unwrap(); - - let get_data_contracts_response::get_data_contracts_response_v0::Result::DataContracts( - contracts, - ) = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_data_contracts_response::Version::V0(inner), - inner - ) - .result - .expect("expected a response") - else { - panic!("invalid response") - }; - - assert!(contracts.data_contract_entries[0].data_contract.is_none()); - } - - #[test] - fn test_data_contracts_absence_proof() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - let request = GetDataContractsRequest { - version: Some(Version::V0(GetDataContractsRequestV0 { - ids: vec![id.clone()], - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let response = - GetDataContractsResponse::decode(validation_result.data.unwrap().as_slice()) - .unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_data_contracts_response::Version::V0(inner), - inner - ) - .result - .unwrap(), - get_data_contracts_response::get_data_contracts_response_v0::Result::Proof(_) - )); - } - } - - mod data_contract_history { - use crate::error::query::QueryError; - use bs58::encode; - use dapi_grpc::platform::v0::get_data_contract_history_request::{ - GetDataContractHistoryRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_data_contract_history_response, GetDataContractHistoryRequest, - GetDataContractHistoryResponse, - }; - use prost::Message; - - const QUERY_PATH: &str = "/dataContractHistory"; - - #[test] - fn test_invalid_data_contract_id() { - let (platform, version) = super::setup_platform(); - - let request = GetDataContractHistoryRequest { - version: Some(Version::V0(GetDataContractHistoryRequestV0 { - id: vec![0; 8], - limit: None, - offset: None, - start_at_ms: 0, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_invalid_limit_overflow() { - let (platform, version) = super::setup_platform(); - - let request = GetDataContractHistoryRequest { - version: Some(Version::V0(GetDataContractHistoryRequestV0 { - id: vec![0; 32], - limit: Some(u32::MAX), - offset: None, - start_at_ms: 0, - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!(validation_error, QueryError::InvalidArgument(_))); - assert_eq!( - validation_error.to_string().as_str(), - "invalid argument error: limit out of bounds" - ) - } - - #[test] - fn test_invalid_offset_overflow() { - let (platform, version) = super::setup_platform(); - - let request = GetDataContractHistoryRequest { - version: Some(Version::V0(GetDataContractHistoryRequestV0 { - id: vec![0; 32], - limit: None, - offset: Some(u32::MAX), - start_at_ms: 0, - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let validation_error = validation_result.first_error().unwrap(); - - assert!(matches!(validation_error, QueryError::InvalidArgument(_))); - assert_eq!( - validation_error.to_string().as_str(), - "invalid argument error: offset out of bounds" - ); - } - - #[test] - fn test_data_contract_not_found() { - let (platform, version) = super::setup_platform(); - - let id = vec![0; 32]; - - let request = GetDataContractHistoryRequest { - version: Some(Version::V0(GetDataContractHistoryRequestV0 { - id: vec![0; 32], - limit: None, - offset: None, - start_at_ms: 0, - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - let validation_error = validation_result.first_error().unwrap(); - - let error_message = format!( - "data contract {} history not found", - encode(id).into_string() - ); - - assert!(matches!( - validation_error, - QueryError::NotFound(msg) if msg.contains(&error_message) - )); - } - - #[test] - fn test_data_contract_history_absence_proof() { - let (platform, version) = super::setup_platform(); - - let request = GetDataContractHistoryRequest { - version: Some(Version::V0(GetDataContractHistoryRequestV0 { - id: vec![0; 32], - limit: None, - offset: None, - start_at_ms: 0, - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let response = - GetDataContractHistoryResponse::decode(validation_result.data.unwrap().as_slice()) - .unwrap(); - - assert!(matches!( - extract_single_variant_or_panic!(response.version.expect("expected a versioned response"), get_data_contract_history_response::Version::V0(inner), inner).result.unwrap(), - get_data_contract_history_response::get_data_contract_history_response_v0::Result::Proof(_) - )); - } - } - - mod documents { - use crate::error::query::QueryError; - use crate::query::tests::store_data_contract; - use dapi_grpc::platform::v0::{ - get_documents_response, GetDocumentsRequest, GetDocumentsResponse, - }; - - use dapi_grpc::platform::v0::get_documents_request::get_documents_request_v0::Start; - use dapi_grpc::platform::v0::get_documents_request::{GetDocumentsRequestV0, Version}; - use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::platform_value::string_encoding::Encoding; - use dpp::tests::fixtures::get_data_contract_fixture; - use drive::error::query::QuerySyntaxError; - use prost::Message; - - const QUERY_PATH: &str = "/documents"; - - #[test] - fn test_invalid_document_id() { - let (platform, version) = super::setup_platform(); - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: vec![0; 8], - document_type: "niceDocument".to_string(), - r#where: vec![], - limit: 0, - order_by: vec![], - prove: false, - start: None, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_data_contract_not_found_in_documents_request() { - let (platform, version) = super::setup_platform(); - - let data_contract_id = vec![0; 32]; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.clone(), - document_type: "niceDocument".to_string(), - r#where: vec![], - limit: 0, - order_by: vec![], - prove: false, - start: None, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(QUERY_PATH, &request, version) - .expect("expected query to succeed"); - let validation_error = validation_result.first_error().expect("expected an error"); - assert_eq!(validation_error.to_string().as_str(), "query syntax error: contract not found error: contract not found when querying from value with contract info"); - assert!(matches!( - validation_error, - QueryError::Query(QuerySyntaxError::DataContractNotFound(_)) - )); - } - - #[test] - fn test_absent_document_type() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "fakeDocument"; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![], - limit: 0, - order_by: vec![], - prove: false, - start: None, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - let validation_result = result.unwrap(); - - let message = format!( - "document type {} not found for contract {}", - document_type, - data_contract_id.to_string(Encoding::Base58) - ); - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::InvalidArgument(msg) if msg.contains(message.as_str()) - )) - } - - #[test] - fn test_invalid_where_clause() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "niceDocument"; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![0x9F], // Incomplete CBOR array - limit: 0, - order_by: vec![], - prove: false, - start: None, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::Query(QuerySyntaxError::DeserializationError(msg)) if msg == &"unable to decode 'where' query from cbor".to_string() - )) - } - - #[test] - fn test_invalid_order_by_clause() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "niceDocument"; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![], - limit: 0, - order_by: vec![0x9F], // Incomplete CBOR array - prove: false, - start: None, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::Query(QuerySyntaxError::DeserializationError(msg)) if msg == &"unable to decode 'order_by' query from cbor".to_string() - )) - } - - #[test] - fn test_invalid_start_at_clause() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "niceDocument"; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![], - limit: 0, - order_by: vec![], - prove: false, - start: Some(Start::StartAt(vec![0; 8])), - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::Query(QuerySyntaxError::InvalidStartsWithClause(msg)) if msg == &"start at should be a 32 byte identifier".to_string() - )) - } - - #[test] - fn test_invalid_start_after_clause() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "niceDocument"; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![], - limit: 0, - order_by: vec![], - prove: false, - start: Some(Start::StartAfter(vec![0; 8])), - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::Query(QuerySyntaxError::InvalidStartsWithClause(msg)) if msg == &"start after should be a 32 byte identifier".to_string() - )) - } - - #[test] - fn test_invalid_limit() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "niceDocument"; - let limit = u32::MAX; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![], - limit, - order_by: vec![], - prove: false, - start: None, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::Query(QuerySyntaxError::InvalidLimit(msg)) if msg == &format!("limit {} out of bounds", limit).to_string() - )) - } - - #[test] - fn test_documents_not_found() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "niceDocument"; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![], - limit: 0, - order_by: vec![], - prove: false, - start: None, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - assert!(validation_result.is_valid()); - let response = GetDocumentsResponse::decode( - validation_result.data.expect("data must exist").as_slice(), - ) - .expect("response decoded"); - - let Some(result) = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_documents_response::Version::V0(inner), - inner - ) - .result - else { - panic!("invalid response") - }; - - let get_documents_response::get_documents_response_v0::Result::Documents(documents) = - result - else { - panic!("invalid response") - }; - - assert_eq!(documents.documents.len(), 0); - } - - #[test] - fn test_documents_absence_proof() { - let (platform, version) = super::setup_platform(); - - let created_data_contract = get_data_contract_fixture(None, version.protocol_version); - store_data_contract(&platform, created_data_contract.data_contract(), version); - - let data_contract_id = created_data_contract.data_contract().id(); - let document_type = "niceDocument"; - - let request = GetDocumentsRequest { - version: Some(Version::V0(GetDocumentsRequestV0 { - data_contract_id: data_contract_id.to_vec(), - document_type: document_type.to_string(), - r#where: vec![], - limit: 0, - order_by: vec![], - prove: true, - start: None, - })), - } - .encode_to_vec(); - - let result = platform.query(QUERY_PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - assert!(validation_result.is_valid()); - let response = GetDocumentsResponse::decode( - validation_result.data.expect("data must exist").as_slice(), - ) - .expect("response decoded"); - - assert!(matches!( - extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_documents_response::Version::V0(inner), - inner - ) - .result - .unwrap(), - get_documents_response::get_documents_response_v0::Result::Proof(_) - )); - } - } - - mod identity_by_public_key_hash { - use crate::query::QueryError; - use dapi_grpc::platform::v0::get_identity_by_public_key_hash_request::{ - GetIdentityByPublicKeyHashRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_identity_by_public_key_hash_response, GetIdentityByPublicKeyHashRequest, - GetIdentityByPublicKeyHashResponse, - }; - use prost::Message; - - const PATH: &str = "/identity/by-public-key-hash"; - - #[test] - fn test_invalid_public_key_hash() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentityByPublicKeyHashRequest { - version: Some(Version::V0(GetIdentityByPublicKeyHashRequestV0 { - public_key_hash: vec![0; 8], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::InvalidArgument(msg) if msg == &"public key hash must be 20 bytes long".to_string() - )); - } - - #[test] - fn test_identity_not_found() { - let (platform, version) = super::setup_platform(); - - let public_key_hash = vec![0; 20]; - let request = GetIdentityByPublicKeyHashRequest { - version: Some(Version::V0(GetIdentityByPublicKeyHashRequestV0 { - public_key_hash: public_key_hash.clone(), - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::NotFound(msg) if msg == &format!("identity for public key hash {} not found", hex::encode(public_key_hash.as_slice())).to_string() - )) - } - - #[test] - fn test_identity_absence_proof() { - let (platform, version) = super::setup_platform(); - - let public_key_hash = vec![0; 20]; - let request = GetIdentityByPublicKeyHashRequest { - version: Some(Version::V0(GetIdentityByPublicKeyHashRequestV0 { - public_key_hash: public_key_hash.clone(), - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - - let response = GetIdentityByPublicKeyHashResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .expect("response decoded"); - - assert!(matches!( - extract_single_variant_or_panic!(response.version.expect("expected a versioned response"), get_identity_by_public_key_hash_response::Version::V0(inner), inner).result.unwrap(), - get_identity_by_public_key_hash_response::get_identity_by_public_key_hash_response_v0::Result::Proof(_) - )); - } - } - - mod identities_by_public_key_hash { - use crate::query::QueryError; - use dapi_grpc::platform::v0::get_identities_by_public_key_hashes_request::{ - GetIdentitiesByPublicKeyHashesRequestV0, Version, - }; - use dapi_grpc::platform::v0::{ - get_identities_by_public_key_hashes_response, GetIdentitiesByPublicKeyHashesRequest, - GetIdentitiesByPublicKeyHashesResponse, - }; - use prost::Message; - - const PATH: &str = "/identities/by-public-key-hash"; - - #[test] - fn test_invalid_public_key_hash() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentitiesByPublicKeyHashesRequest { - version: Some(Version::V0(GetIdentitiesByPublicKeyHashesRequestV0 { - public_key_hashes: vec![vec![0; 8]], - prove: false, - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::InvalidArgument(msg) if msg == &"public key hash must be 20 bytes long".to_string() - )); - } - - #[test] - fn test_identities_not_found() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentitiesByPublicKeyHashesRequest { - version: Some(Version::V0(GetIdentitiesByPublicKeyHashesRequestV0 { - public_key_hashes: vec![vec![0; 20]], - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetIdentitiesByPublicKeyHashesResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .expect("response decoded"); - - let get_identities_by_public_key_hashes_response::get_identities_by_public_key_hashes_response_v0::Result::Identities(identities) = - extract_single_variant_or_panic!(response.version.expect("expected a versioned response"), get_identities_by_public_key_hashes_response::Version::V0(inner), inner).result.expect("expected a versioned result") - else { - panic!("invalid response") - }; - - assert!(identities.identity_entries.first().unwrap().value.is_none()); - } - - #[test] - fn test_identities_absence_proof() { - let (platform, version) = super::setup_platform(); - - let request = GetIdentitiesByPublicKeyHashesRequest { - version: Some(Version::V0(GetIdentitiesByPublicKeyHashesRequestV0 { - public_key_hashes: vec![vec![0; 20]], - prove: true, - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - - let validation_result = result.unwrap(); - let response = GetIdentitiesByPublicKeyHashesResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .expect("response decoded"); - - assert!(matches!( - extract_single_variant_or_panic!(response.version.expect("expected a versioned response"), get_identities_by_public_key_hashes_response::Version::V0(inner), inner).result.unwrap(), - get_identities_by_public_key_hashes_response::get_identities_by_public_key_hashes_response_v0::Result::Proof(_) - )); - } - } - - mod proofs { - use crate::query::QueryError; - use dapi_grpc::platform::v0::get_proofs_request::get_proofs_request_v0::{ - ContractRequest, DocumentRequest, IdentityRequest, - }; - use dapi_grpc::platform::v0::get_proofs_request::{GetProofsRequestV0, Version}; - use dapi_grpc::platform::v0::{get_proofs_response, GetProofsRequest, GetProofsResponse}; - use dapi_grpc::platform::VersionedGrpcResponse; - use prost::Message; - - const PATH: &str = "/proofs"; - - #[test] - fn test_invalid_identity_ids() { - let (platform, version) = super::setup_platform(); - - let request = GetProofsRequest { - version: Some(Version::V0(GetProofsRequestV0 { - identities: vec![IdentityRequest { - identity_id: vec![0; 8], - request_type: 0, - }], - contracts: vec![], - documents: vec![], - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_invalid_identity_prove_request_type() { - let (platform, version) = super::setup_platform(); - - let request_type = 10; - - let request = GetProofsRequest { - version: Some(Version::V0(GetProofsRequestV0 { - identities: vec![IdentityRequest { - identity_id: vec![0; 32], - request_type, - }], - contracts: vec![], - documents: vec![], - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - let validation_result = result.unwrap(); - - assert!(matches!( - validation_result.first_error().unwrap(), - QueryError::InvalidArgument(msg) if msg == &format!( - "invalid prove request type '{}'", - request_type - ).to_string() - )) - } - - #[test] - fn test_invalid_contract_ids() { - let (platform, version) = super::setup_platform(); - - let request = GetProofsRequest { - version: Some(Version::V0(GetProofsRequestV0 { - identities: vec![], - contracts: vec![ContractRequest { - contract_id: vec![0; 8], - }], - documents: vec![], - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_invalid_contract_id_for_documents_proof() { - let (platform, version) = super::setup_platform(); - - let request = GetProofsRequest { - version: Some(Version::V0(GetProofsRequestV0 { - identities: vec![], - contracts: vec![], - documents: vec![DocumentRequest { - contract_id: vec![0; 8], - document_type: "niceDocument".to_string(), - document_type_keeps_history: false, - document_id: vec![0; 32], - }], - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_invalid_document_id() { - let (platform, version) = super::setup_platform(); - - let request = GetProofsRequest { - version: Some(Version::V0(GetProofsRequestV0 { - identities: vec![], - contracts: vec![], - documents: vec![DocumentRequest { - contract_id: vec![0; 32], - document_type: "niceDocument".to_string(), - document_type_keeps_history: false, - document_id: vec![0; 8], - }], - })), - } - .encode_to_vec(); - - let result = platform.query(PATH, &request, version); - assert!(result.is_ok()); - super::assert_invalid_identifier(result.unwrap()); - } - - #[test] - fn test_proof_of_absence() { - let (platform, version) = super::setup_platform(); - - let request = GetProofsRequest { - version: Some(Version::V0(GetProofsRequestV0 { - identities: vec![], - contracts: vec![], - documents: vec![DocumentRequest { - contract_id: vec![0; 32], - document_type: "niceDocument".to_string(), - document_type_keeps_history: false, - document_id: vec![0; 32], - }], - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = - GetProofsResponse::decode(validation_result.data.unwrap().as_slice()).unwrap(); - - let proof = response - .proof() - .expect("expected a proof in versioned response"); - - assert!(!proof.grovedb_proof.is_empty()) - } - } - - mod version_upgrade_state { - use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_request::{ - GetProtocolVersionUpgradeStateRequestV0, Version, - }; - use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_response::get_protocol_version_upgrade_state_response_v0; - use dapi_grpc::platform::v0::{ - get_protocol_version_upgrade_state_response, GetProtocolVersionUpgradeStateRequest, - GetProtocolVersionUpgradeStateResponse, - }; - use drive::drive::grove_operations::BatchInsertApplyType; - use drive::drive::object_size_info::PathKeyElementInfo; - use drive::drive::protocol_upgrade::{ - desired_version_for_validators_path, versions_counter_path, versions_counter_path_vec, - }; - use drive::drive::Drive; - use drive::grovedb::{Element, PathQuery, Query, QueryItem}; - use drive::query::GroveDb; - use integer_encoding::VarInt; - use prost::Message; - use rand::rngs::StdRng; - use rand::{Rng, SeedableRng}; - use std::ops::RangeFull; - - const PATH: &str = "/versionUpgrade/state"; - - #[test] - fn test_query_empty_upgrade_state() { - let (platform, version) = super::setup_platform(); - - let request = GetProtocolVersionUpgradeStateRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeStateRequestV0 { - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeStateResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_state_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let versions = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_state_response_v0::Result::Versions(inner), - inner - ); - - // we just started chain, there should be no versions - - assert!(versions.versions.is_empty()) - } - - #[test] - fn test_query_upgrade_state() { - let (platform, version) = super::setup_platform(); - - let mut rand = StdRng::seed_from_u64(10); - - let drive = &platform.drive; - - let mut cache = drive.cache.write().unwrap(); - let version_counter = &mut cache.protocol_versions_counter; - - let transaction = drive.grove.start_transaction(); - - version_counter - .load_if_needed(drive, Some(&transaction), &version.drive) - .expect("expected to load version counter"); - - let path = desired_version_for_validators_path(); - let version_bytes = version.protocol_version.encode_var_vec(); - let version_element = Element::new_item(version_bytes.clone()); - - let validator_pro_tx_hash: [u8; 32] = rand.gen(); - - let mut operations = vec![]; - drive - .batch_insert_if_changed_value( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - path, - validator_pro_tx_hash.as_slice(), - version_element, - )), - BatchInsertApplyType::StatefulBatchInsert, - Some(&transaction), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - let mut version_count = version_counter - .get(&version.protocol_version) - .cloned() - .unwrap_or_default(); - - version_count += 1; - - version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache - - drive - .batch_insert( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - versions_counter_path(), - version_bytes.as_slice(), - Element::new_item(version_count.encode_var_vec()), - )), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - drive - .apply_batch_low_level_drive_operations( - None, - Some(&transaction), - operations, - &mut vec![], - &version.drive, - ) - .expect("expected to apply operations"); - - drive - .commit_transaction(transaction, &version.drive) - .expect("expected to commit"); - - cache.protocol_versions_counter.merge_block_cache(); - - drop(cache); - - let request = GetProtocolVersionUpgradeStateRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeStateRequestV0 { - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeStateResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_state_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let versions = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_state_response_v0::Result::Versions(inner), - inner - ); - - assert_eq!(versions.versions.len(), 1) - } - - #[test] - fn test_prove_empty_upgrade_state() { - let (platform, version) = super::setup_platform(); - - let request = GetProtocolVersionUpgradeStateRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeStateRequestV0 { - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeStateResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_state_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let proof = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_state_response_v0::Result::Proof(inner), - inner - ); - - let path_query = PathQuery::new_unsized( - versions_counter_path_vec(), - Query::new_single_query_item(QueryItem::RangeFull(RangeFull)), - ); - - let elements = GroveDb::verify_query(proof.grovedb_proof.as_slice(), &path_query) - .expect("expected to be able to verify query") - .1; - - // we just started chain, there should be no versions - - assert!(elements.is_empty()) - } - - #[test] - fn test_prove_upgrade_state() { - let (platform, version) = super::setup_platform(); - - let mut rand = StdRng::seed_from_u64(10); - - let drive = &platform.drive; - - let mut cache = drive.cache.write().unwrap(); - let version_counter = &mut cache.protocol_versions_counter; - - let transaction = drive.grove.start_transaction(); - - version_counter - .load_if_needed(drive, Some(&transaction), &version.drive) - .expect("expected to load version counter"); - - let path = desired_version_for_validators_path(); - let version_bytes = version.protocol_version.encode_var_vec(); - let version_element = Element::new_item(version_bytes.clone()); - - let validator_pro_tx_hash: [u8; 32] = rand.gen(); - - let mut operations = vec![]; - drive - .batch_insert_if_changed_value( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - path, - validator_pro_tx_hash.as_slice(), - version_element, - )), - BatchInsertApplyType::StatefulBatchInsert, - Some(&transaction), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - let mut version_count = version_counter - .get(&version.protocol_version) - .cloned() - .unwrap_or_default(); - - version_count += 1; - - version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache - - drive - .batch_insert( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - versions_counter_path(), - version_bytes.as_slice(), - Element::new_item(version_count.encode_var_vec()), - )), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - drive - .apply_batch_low_level_drive_operations( - None, - Some(&transaction), - operations, - &mut vec![], - &version.drive, - ) - .expect("expected to apply operations"); - - drive - .commit_transaction(transaction, &version.drive) - .expect("expected to commit"); - - cache.protocol_versions_counter.merge_block_cache(); - - drop(cache); - - let request = GetProtocolVersionUpgradeStateRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeStateRequestV0 { - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeStateResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_state_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let proof = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_state_response_v0::Result::Proof(inner), - inner - ); - - let path_query = PathQuery::new_unsized( - versions_counter_path_vec(), - Query::new_single_query_item(QueryItem::RangeFull(RangeFull)), - ); - - let elements = GroveDb::verify_query(proof.grovedb_proof.as_slice(), &path_query) - .expect("expected to be able to verify query") - .1; - - // we just started chain, there should be no versions - - assert_eq!(elements.len(), 1); - - let (_, _, element) = elements.first().unwrap(); - - assert!(element.is_some()); - - let element = element.clone().unwrap(); - - let count_bytes = element.as_item_bytes().expect("expected item bytes"); - - let count = u16::decode_var(count_bytes) - .expect("expected to decode var int") - .0; - - assert_eq!(count, 1); - - let upgrade = Drive::verify_upgrade_state(proof.grovedb_proof.as_slice(), version) - .expect("expected to verify the upgrade counts") - .1; - - assert_eq!(upgrade.len(), 1); - assert_eq!(upgrade.get(&1), Some(1).as_ref()); - } - } - - mod version_upgrade_vote_status { - use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::Version; - - use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::GetProtocolVersionUpgradeVoteStatusRequestV0; - use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_response::get_protocol_version_upgrade_vote_status_response_v0; - use dapi_grpc::platform::v0::{ - get_protocol_version_upgrade_vote_status_response, - GetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeVoteStatusResponse, - }; - use drive::drive::grove_operations::BatchInsertApplyType; - use drive::drive::object_size_info::PathKeyElementInfo; - use drive::drive::protocol_upgrade::{ - desired_version_for_validators_path, desired_version_for_validators_path_vec, - versions_counter_path, - }; - use drive::drive::Drive; - use drive::grovedb::{Element, PathQuery, Query, QueryItem, SizedQuery}; - use drive::query::GroveDb; - use integer_encoding::VarInt; - use prost::Message; - use rand::rngs::StdRng; - use rand::{Rng, SeedableRng}; - - const PATH: &str = "/versionUpgrade/voteStatus"; - - #[test] - fn test_query_empty_upgrade_vote_status() { - let (platform, version) = super::setup_platform(); - - let mut rand = StdRng::seed_from_u64(10); - - let validator_pro_tx_hash: [u8; 32] = rand.gen(); - - let request = GetProtocolVersionUpgradeVoteStatusRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeVoteStatusRequestV0 { - start_pro_tx_hash: validator_pro_tx_hash.to_vec(), - count: 5, - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeVoteStatusResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_vote_status_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let version_signals = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_vote_status_response::get_protocol_version_upgrade_vote_status_response_v0::Result::Versions(inner), - inner - ); - - // we just started chain, there should be no versions - - assert!(version_signals.version_signals.is_empty()) - } - - #[test] - fn test_query_upgrade_vote_status() { - let (platform, version) = super::setup_platform(); - - let mut rand = StdRng::seed_from_u64(10); - - let validator_pro_tx_hash: [u8; 32] = rand.gen(); - - let drive = &platform.drive; - - let mut cache = drive.cache.write().unwrap(); - let version_counter = &mut cache.protocol_versions_counter; - - let transaction = drive.grove.start_transaction(); - - version_counter - .load_if_needed(drive, Some(&transaction), &version.drive) - .expect("expected to load version counter"); - - let path = desired_version_for_validators_path(); - let version_bytes = version.protocol_version.encode_var_vec(); - let version_element = Element::new_item(version_bytes.clone()); - - let mut operations = vec![]; - drive - .batch_insert_if_changed_value( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - path, - validator_pro_tx_hash.as_slice(), - version_element, - )), - BatchInsertApplyType::StatefulBatchInsert, - Some(&transaction), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - let mut version_count = version_counter - .get(&version.protocol_version) - .cloned() - .unwrap_or_default(); - - version_count += 1; - - version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache - - drive - .batch_insert( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - versions_counter_path(), - version_bytes.as_slice(), - Element::new_item(version_count.encode_var_vec()), - )), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - drive - .apply_batch_low_level_drive_operations( - None, - Some(&transaction), - operations, - &mut vec![], - &version.drive, - ) - .expect("expected to apply operations"); - - drive - .commit_transaction(transaction, &version.drive) - .expect("expected to commit"); - - cache.protocol_versions_counter.merge_block_cache(); - - drop(cache); - - let request = GetProtocolVersionUpgradeVoteStatusRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeVoteStatusRequestV0 { - start_pro_tx_hash: validator_pro_tx_hash.to_vec(), - count: 5, - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeVoteStatusResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_vote_status_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let version_signals = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_vote_status_response::get_protocol_version_upgrade_vote_status_response_v0::Result::Versions(inner), - inner - ); - - assert_eq!(version_signals.version_signals.len(), 1) - } - - #[test] - fn test_prove_empty_upgrade_vote_status() { - let (platform, version) = super::setup_platform(); - - let mut rand = StdRng::seed_from_u64(10); - - let validator_pro_tx_hash: [u8; 32] = rand.gen(); - - let request = GetProtocolVersionUpgradeVoteStatusRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeVoteStatusRequestV0 { - start_pro_tx_hash: validator_pro_tx_hash.to_vec(), - count: 5, - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeVoteStatusResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_vote_status_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let proof = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_vote_status_response_v0::Result::Proof(inner), - inner - ); - - let path = desired_version_for_validators_path_vec(); - - let query_item = QueryItem::RangeFrom(validator_pro_tx_hash.to_vec()..); - - let path_query = PathQuery::new( - path, - SizedQuery::new(Query::new_single_query_item(query_item), Some(5), None), - ); - - let elements = GroveDb::verify_query(proof.grovedb_proof.as_slice(), &path_query) - .expect("expected to be able to verify query") - .1; - - // we just started chain, there should be no versions - - assert!(elements.is_empty()) - } - - #[test] - fn test_prove_upgrade_vote_status() { - let (platform, version) = super::setup_platform(); - - let mut rand = StdRng::seed_from_u64(10); - - let drive = &platform.drive; - - let mut cache = drive.cache.write().unwrap(); - let version_counter = &mut cache.protocol_versions_counter; - - let transaction = drive.grove.start_transaction(); - - version_counter - .load_if_needed(drive, Some(&transaction), &version.drive) - .expect("expected to load version counter"); - - let path = desired_version_for_validators_path(); - let version_bytes = version.protocol_version.encode_var_vec(); - let version_element = Element::new_item(version_bytes.clone()); - - let validator_pro_tx_hash: [u8; 32] = rand.gen(); - - let mut operations = vec![]; - drive - .batch_insert_if_changed_value( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - path, - validator_pro_tx_hash.as_slice(), - version_element, - )), - BatchInsertApplyType::StatefulBatchInsert, - Some(&transaction), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - let mut version_count = version_counter - .get(&version.protocol_version) - .cloned() - .unwrap_or_default(); - - version_count += 1; - - version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache - - drive - .batch_insert( - PathKeyElementInfo::PathFixedSizeKeyRefElement(( - versions_counter_path(), - version_bytes.as_slice(), - Element::new_item(version_count.encode_var_vec()), - )), - &mut operations, - &version.drive, - ) - .expect("expected batch to insert"); - - drive - .apply_batch_low_level_drive_operations( - None, - Some(&transaction), - operations, - &mut vec![], - &version.drive, - ) - .expect("expected to apply operations"); - - drive - .commit_transaction(transaction, &version.drive) - .expect("expected to commit"); - - cache.protocol_versions_counter.merge_block_cache(); - - drop(cache); - - let request = GetProtocolVersionUpgradeVoteStatusRequest { - version: Some(Version::V0(GetProtocolVersionUpgradeVoteStatusRequestV0 { - start_pro_tx_hash: validator_pro_tx_hash.to_vec(), - count: 5, - prove: true, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetProtocolVersionUpgradeVoteStatusResponse::decode( - validation_result.data.unwrap().as_slice(), - ) - .unwrap(); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_protocol_version_upgrade_vote_status_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let proof = extract_variant_or_panic!( - result, - get_protocol_version_upgrade_vote_status_response_v0::Result::Proof(inner), - inner - ); - - let path = desired_version_for_validators_path_vec(); - - let query_item = QueryItem::RangeFrom(validator_pro_tx_hash.to_vec()..); - - let path_query = PathQuery::new( - path, - SizedQuery::new(Query::new_single_query_item(query_item), Some(5), None), - ); - - let elements = GroveDb::verify_query(proof.grovedb_proof.as_slice(), &path_query) - .expect("expected to be able to verify query") - .1; - - // we just started chain, there should be no versions - - assert_eq!(elements.len(), 1); - - let (_, _, element) = elements.first().unwrap(); - - assert!(element.is_some()); - - let element = element.clone().unwrap(); - - let count_bytes = element.as_item_bytes().expect("expected item bytes"); - - let count = u16::decode_var(count_bytes) - .expect("expected to decode var int") - .0; - - assert_eq!(count, 1); - - let upgrade = Drive::verify_upgrade_vote_status( - proof.grovedb_proof.as_slice(), - Some(validator_pro_tx_hash), - 5, - version, - ) - .expect("expected to verify the upgrade counts") - .1; - - assert_eq!(upgrade.len(), 1); - assert_eq!(upgrade.get(&validator_pro_tx_hash), Some(1).as_ref()); - } - } - - mod epoch_infos { - use dapi_grpc::platform::v0::get_epochs_info_request::{GetEpochsInfoRequestV0, Version}; - use dapi_grpc::platform::v0::{ - get_epochs_info_response, GetEpochsInfoRequest, GetEpochsInfoResponse, - }; - use prost::Message; - - const PATH: &str = "/epochInfos"; - - #[test] - fn test_query_empty_epoch_infos() { - let (platform, version) = super::setup_platform(); - - let request = GetEpochsInfoRequest { - version: Some(Version::V0(GetEpochsInfoRequestV0 { - start_epoch: None, // 0 - count: 5, - ascending: true, - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetEpochsInfoResponse::decode( - validation_result.data.expect("expected data").as_slice(), - ) - .expect("expected to decode response"); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_epochs_info_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let epoch_infos = extract_variant_or_panic!( - result, - get_epochs_info_response::get_epochs_info_response_v0::Result::Epochs(inner), - inner - ); - - // we just started chain, there should be only 1 epoch info for the first epoch - - assert!(epoch_infos.epoch_infos.is_empty()) - } - - #[test] - fn test_query_empty_epoch_infos_descending() { - let (platform, version) = super::setup_platform(); - - let request = GetEpochsInfoRequest { - version: Some(Version::V0(GetEpochsInfoRequestV0 { - start_epoch: None, // 0 - count: 5, - ascending: false, - prove: false, - })), - } - .encode_to_vec(); - - let validation_result = platform - .query(PATH, &request, version) - .expect("expected query to succeed"); - let response = GetEpochsInfoResponse::decode( - validation_result.data.expect("expected data").as_slice(), - ) - .expect("expected to decode response"); - - let result = extract_single_variant_or_panic!( - response.version.expect("expected a versioned response"), - get_epochs_info_response::Version::V0(inner), - inner - ) - .result - .expect("expected a result"); - - let epoch_infos = extract_variant_or_panic!( - result, - get_epochs_info_response::get_epochs_info_response_v0::Result::Epochs(inner), - inner - ); - - // we just started chain, there should be only 1 epoch info for the first epoch - - assert!(epoch_infos.epoch_infos.is_empty()) - } - } } diff --git a/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/mod.rs b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/mod.rs new file mode 100644 index 00000000000..54a0cd6bf3e --- /dev/null +++ b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/mod.rs @@ -0,0 +1,67 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_prefunded_specialized_balance_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_prefunded_specialized_balance_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetPrefundedSpecializedBalanceRequest, GetPrefundedSpecializedBalanceResponse, +}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying the value of a prefunded specialized balance + pub fn query_prefunded_specialized_balance( + &self, + GetPrefundedSpecializedBalanceRequest { version }: GetPrefundedSpecializedBalanceRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError( + "could not decode prefunded specialized balance query".to_string(), + ), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .prefunded_specialized_balances + .balance; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "balance".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_prefunded_specialized_balance_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok( + result.map(|response_v0| GetPrefundedSpecializedBalanceResponse { + version: Some(ResponseVersion::V0(response_v0)), + }), + ) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/v0/mod.rs b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/v0/mod.rs new file mode 100644 index 00000000000..4684c64658c --- /dev/null +++ b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/v0/mod.rs @@ -0,0 +1,135 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_prefunded_specialized_balance_request::GetPrefundedSpecializedBalanceRequestV0; +use dapi_grpc::platform::v0::get_prefunded_specialized_balance_response::get_prefunded_specialized_balance_response_v0; +use dapi_grpc::platform::v0::get_prefunded_specialized_balance_response::GetPrefundedSpecializedBalanceResponseV0; +use dpp::check_validation_result_with_data; +use dpp::identifier::Identifier; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; + +impl Platform { + pub(super) fn query_prefunded_specialized_balance_v0( + &self, + GetPrefundedSpecializedBalanceRequestV0 { id, prove }: GetPrefundedSpecializedBalanceRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let balance_id: Identifier = + check_validation_result_with_data!(id.try_into().map_err(|_| { + QueryError::InvalidArgument( + "id must be a valid identifier (32 bytes long)".to_string(), + ) + })); + + let response = if prove { + let proof = + check_validation_result_with_data!(self.drive.prove_prefunded_specialized_balance( + balance_id.into_buffer(), + None, + platform_version, + )); + + GetPrefundedSpecializedBalanceResponseV0 { + result: Some( + get_prefunded_specialized_balance_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let maybe_balance = self.drive.fetch_prefunded_specialized_balance( + balance_id.into_buffer(), + None, + platform_version, + )?; + + let Some(balance) = maybe_balance else { + return Ok(ValidationResult::new_with_error(QueryError::NotFound( + "No Identity found".to_string(), + ))); + }; + + GetPrefundedSpecializedBalanceResponseV0 { + result: Some( + get_prefunded_specialized_balance_response_v0::Result::Balance(balance), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dpp::dashcore::Network; + + #[test] + fn test_invalid_identity_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetPrefundedSpecializedBalanceRequestV0 { + id: vec![0; 8], + prove: false, + }; + + let result = platform + .query_prefunded_specialized_balance_v0(request, &state, version) + .expect("should query balance"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_identity_not_found() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + + let request = GetPrefundedSpecializedBalanceRequestV0 { + id: id.clone(), + prove: false, + }; + + let result = platform + .query_prefunded_specialized_balance_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::NotFound(_)] + )); + } + + #[test] + fn test_identity_balance_absence_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let id = vec![0; 32]; + + let request = GetPrefundedSpecializedBalanceRequestV0 { + id: id.clone(), + prove: true, + }; + + let result = platform + .query_prefunded_specialized_balance_v0(request, &state, version) + .expect("should query balance"); + + assert!(matches!( + result.data, + Some(GetPrefundedSpecializedBalanceResponseV0 { + result: Some(get_prefunded_specialized_balance_response_v0::Result::Proof(_)), + metadata: Some(_) + }) + )); + } +} diff --git a/packages/rs-drive-abci/src/query/prefunded_specialized_balances/mod.rs b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/mod.rs new file mode 100644 index 00000000000..b95ce78b5a1 --- /dev/null +++ b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/mod.rs @@ -0,0 +1 @@ +mod balance; diff --git a/packages/rs-drive-abci/src/query/proofs/mod.rs b/packages/rs-drive-abci/src/query/proofs/mod.rs index ca9ed6b0636..6921e014d53 100644 --- a/packages/rs-drive-abci/src/query/proofs/mod.rs +++ b/packages/rs-drive-abci/src/query/proofs/mod.rs @@ -3,28 +3,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_proofs_request::Version; -use dapi_grpc::platform::v0::GetProofsRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_proofs_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_proofs_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetProofsRequest, GetProofsResponse}; use dpp::version::PlatformVersion; -use prost::Message; mod v0; impl Platform { /// Querying of platform proofs - pub(in crate::query) fn query_proofs( + pub fn query_proofs( &self, - state: &PlatformState, - query_data: &[u8], + GetProofsRequest { version }: GetProofsRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetProofsRequest { version } = - check_validation_result_with_data!(GetProofsRequest::decode(query_data).map_err(|e| { - QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - })); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode identity keys query".to_string()), @@ -34,7 +27,7 @@ impl Platform { let feature_version_bounds = &platform_version.drive_abci.query.proofs_query; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -48,8 +41,12 @@ impl Platform { )); } match version { - Version::V0(get_identity_request) => { - self.query_proofs_v0(state, get_identity_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = self.query_proofs_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetProofsResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/proofs/v0/mod.rs b/packages/rs-drive-abci/src/query/proofs/v0/mod.rs index 7969042161f..3152ecf4c82 100644 --- a/packages/rs-drive-abci/src/query/proofs/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/proofs/v0/mod.rs @@ -1,35 +1,32 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_proofs_request::get_proofs_request_v0::vote_status_request::RequestType; use dapi_grpc::platform::v0::get_proofs_request::GetProofsRequestV0; -use dapi_grpc::platform::v0::get_proofs_response::GetProofsResponseV0; -use dapi_grpc::platform::v0::{get_proofs_response, GetProofsResponse, Proof}; +use dapi_grpc::platform::v0::get_proofs_response::{get_proofs_response_v0, GetProofsResponseV0}; use dpp::check_validation_result_with_data; use dpp::platform_value::Bytes32; use dpp::prelude::Identifier; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; use drive::drive::identity::{IdentityDriveQuery, IdentityProveRequestType}; -use drive::query::SingleDocumentDriveQuery; -use prost::Message; +use drive::query::{IdentityBasedVoteDriveQuery, SingleDocumentDriveQuery}; impl Platform { pub(super) fn query_proofs_v0( &self, - state: &PlatformState, - request: GetProofsRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetProofsRequestV0 { + GetProofsRequestV0 { identities, contracts, documents, - } = request; + votes, + }: GetProofsRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { let contract_ids = check_validation_result_with_data!(contracts .into_iter() .map(|contract_request| { @@ -86,41 +83,327 @@ impl Platform { ) })?; + let contested_status = document_proof_request + .document_contested_status + .try_into()?; + Ok(SingleDocumentDriveQuery { contract_id: contract_id.into_buffer(), document_type_name: document_proof_request.document_type, document_type_keeps_history: document_proof_request.document_type_keeps_history, document_id: document_id.into_buffer(), block_time_ms: None, //None because we want latest + contested_status, }) }) - .collect::, QueryError>>()); + .collect::, QueryError>>()); - let proof = self.drive.prove_multiple( + let vote_queries = check_validation_result_with_data!(votes + .into_iter() + .filter_map(|vote_proof_request| { + if let Some(request_type) = vote_proof_request.request_type { + match request_type { + RequestType::ContestedResourceVoteStatusRequest(contested_resource_vote_status_request) => { + let identity_id = match contested_resource_vote_status_request.voter_identifier.try_into() { + Ok(identity_id) => identity_id, + Err(_) => return Some(Err(QueryError::InvalidArgument( + "voter_identifier must be a valid identifier (32 bytes long)".to_string(), + ))), + }; + let contract_id = match contested_resource_vote_status_request.contract_id.try_into() { + Ok(contract_id) => contract_id, + Err(_) => return Some(Err(QueryError::InvalidArgument( + "contract_id must be a valid identifier (32 bytes long)".to_string(), + ))), + }; + let document_type_name = contested_resource_vote_status_request.document_type_name; + let index_name = contested_resource_vote_status_request.index_name; + let index_values = match contested_resource_vote_status_request.index_values.into_iter().enumerate().map(|(pos, serialized_value)| + Ok(bincode::decode_from_slice(serialized_value.as_slice(), bincode::config::standard().with_big_endian() + .with_no_limit()).map_err(|_| QueryError::InvalidArgument( + format!("could not convert {:?} to a value in the index values at position {}", serialized_value, pos), + ))?.0) + ).collect::, QueryError>>() { + Ok(index_values) => index_values, + Err(e) => return Some(Err(e)), + }; + let vote_poll = ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + }.into(); + Some(Ok(IdentityBasedVoteDriveQuery { + identity_id, + vote_poll, + })) + } + } + } else { + None + } + }) + .collect::, QueryError>>()); + + let proof = self.drive.prove_multiple_state_transition_results( &identity_requests, &contract_ids, &document_queries, + &vote_queries, None, platform_version, )?; - let response_data = GetProofsResponse { - version: Some(get_proofs_response::Version::V0(GetProofsResponseV0 { - result: Some(get_proofs_response::get_proofs_response_v0::Result::Proof( - Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + let response = GetProofsResponseV0 { + result: Some(get_proofs_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::{assert_invalid_identifier, setup_platform}; + use dapi_grpc::platform::v0::get_proofs_request::get_proofs_request_v0::vote_status_request::ContestedResourceVoteStatusRequest; + use dapi_grpc::platform::v0::get_proofs_request::get_proofs_request_v0::{ + ContractRequest, DocumentRequest, IdentityRequest, VoteStatusRequest, + }; + use dpp::dashcore::Network; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::platform_value::Value; + use dpp::util::strings::convert_to_homograph_safe_chars; + + #[test] + fn test_invalid_identity_ids() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProofsRequestV0 { + identities: vec![IdentityRequest { + identity_id: vec![0; 8], + request_type: 0, + }], + contracts: vec![], + documents: vec![], + votes: vec![], + }; + + let result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_invalid_identity_prove_request_type() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request_type = 10; + + let request = GetProofsRequestV0 { + identities: vec![IdentityRequest { + identity_id: vec![0; 32], + request_type, + }], + contracts: vec![], + documents: vec![], + votes: vec![], + }; + + let result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.errors.as_slice(), + [QueryError::InvalidArgument(msg)] if msg == &format!( + "invalid prove request type '{}'", + request_type + ) + )) + } + + #[test] + fn test_invalid_contract_ids() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProofsRequestV0 { + identities: vec![], + contracts: vec![ContractRequest { + contract_id: vec![0; 8], + }], + documents: vec![], + votes: vec![], + }; + + let result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_invalid_contract_id_for_documents_proof() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProofsRequestV0 { + identities: vec![], + contracts: vec![], + documents: vec![DocumentRequest { + contract_id: vec![0; 8], + document_type: "niceDocument".to_string(), + document_type_keeps_history: false, + document_id: vec![0; 32], + document_contested_status: 0, + }], + votes: vec![], + }; + + let result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_invalid_document_id() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProofsRequestV0 { + identities: vec![], + contracts: vec![], + documents: vec![DocumentRequest { + contract_id: vec![0; 32], + document_type: "niceDocument".to_string(), + document_type_keeps_history: false, + document_id: vec![0; 8], + document_contested_status: 0, + }], + votes: vec![], + }; + + let result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); + + assert_invalid_identifier(result); + } + + #[test] + fn test_proof_of_absence() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProofsRequestV0 { + identities: vec![], + contracts: vec![], + documents: vec![DocumentRequest { + contract_id: vec![0; 32], + document_type: "niceDocument".to_string(), + document_type_keeps_history: false, + document_id: vec![0; 32], + document_contested_status: 0, + }], + votes: vec![], + }; + + let validation_result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!(validation_result.data, Some(GetProofsResponseV0 { + result: Some(get_proofs_response_v0::Result::Proof(proof)), + metadata: Some(_), + }) if !proof.grovedb_proof.is_empty())); + } + + #[test] + fn test_proof_of_absence_of_vote() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let dpns_contract = platform + .drive + .cache + .system_data_contracts + .load_dpns() + .as_ref() + .clone(); + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let serialized_index_values = [ + Value::Text("dash".to_string()), + Value::Text(convert_to_homograph_safe_chars("quantum")), + ] + .iter() + .map(|value| { + bincode::encode_to_vec(value, config).expect("expected to encode value in path") + }) + .collect(); + + let request = GetProofsRequestV0 { + identities: vec![], + contracts: vec![], + documents: vec![], + votes: vec![VoteStatusRequest { + request_type: Some(RequestType::ContestedResourceVoteStatusRequest( + ContestedResourceVoteStatusRequest { + contract_id: dpns_contract.id().to_vec(), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: serialized_index_values, + voter_identifier: [0u8; 32].to_vec(), }, )), - metadata: Some(metadata), - })), - } - .encode_to_vec(); + }], + }; + + let validation_result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!(validation_result.data, Some(GetProofsResponseV0 { + result: Some(get_proofs_response_v0::Result::Proof(proof)), + metadata: Some(_), + }) if !proof.grovedb_proof.is_empty())); + } + + #[test] + fn test_prove_all() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProofsRequestV0 { + identities: vec![IdentityRequest { + identity_id: vec![0; 32], + request_type: 0, + }], + contracts: vec![ContractRequest { + contract_id: vec![0; 32], + }], + documents: vec![DocumentRequest { + contract_id: vec![0; 32], + document_type: "niceDocument".to_string(), + document_type_keeps_history: false, + document_id: vec![1; 32], + document_contested_status: 0, + }], + votes: vec![], + }; + + let validation_result = platform + .query_proofs_v0(request, &state, version) + .expect("expected query to succeed"); - Ok(QueryValidationResult::new_with_data(response_data)) + assert!(matches!(validation_result.data, Some(GetProofsResponseV0 { + result: Some(get_proofs_response_v0::Result::Proof(proof)), + metadata: Some(_), + }) if !proof.grovedb_proof.is_empty())); } } diff --git a/packages/rs-drive-abci/src/query/response_metadata/mod.rs b/packages/rs-drive-abci/src/query/response_metadata/mod.rs index 7fd1ef5a894..8efee43e905 100644 --- a/packages/rs-drive-abci/src/query/response_metadata/mod.rs +++ b/packages/rs-drive-abci/src/query/response_metadata/mod.rs @@ -3,19 +3,22 @@ mod v0; use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + use crate::platform_types::platform_state::PlatformState; use dapi_grpc::platform::v0::ResponseMetadata; use dpp::version::PlatformVersion; impl Platform { + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub(in crate::query) fn response_metadata( &self, - state: &PlatformState, + platform_state: &PlatformState, platform_version: &PlatformVersion, ) -> Result { match platform_version.drive_abci.query.response_metadata { - 0 => Ok(self.response_metadata_v0(state)), + 0 => Ok(self.response_metadata_v0(platform_state)), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "response_metadata".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs b/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs index a13e0878c53..edd234ab2d4 100644 --- a/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs @@ -1,17 +1,37 @@ use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; -use dapi_grpc::platform::v0::ResponseMetadata; +use dapi_grpc::platform::v0::{Proof, ResponseMetadata}; impl Platform { - pub(in crate::query) fn response_metadata_v0(&self, state: &PlatformState) -> ResponseMetadata { + pub(in crate::query) fn response_metadata_v0( + &self, + platform_state: &PlatformState, + ) -> ResponseMetadata { ResponseMetadata { - height: state.height(), - core_chain_locked_height: state.core_height(), - epoch: state.epoch().index as u32, - time_ms: state.last_block_time_ms().unwrap_or_default(), + height: platform_state.last_committed_block_height(), + core_chain_locked_height: platform_state.last_committed_core_height(), + epoch: platform_state.last_committed_block_epoch().index as u32, + time_ms: platform_state + .last_committed_block_time_ms() + .unwrap_or_default(), chain_id: self.config.abci.chain_id.clone(), - protocol_version: state.current_protocol_version_in_consensus(), + protocol_version: platform_state.current_protocol_version_in_consensus(), + } + } + + pub(in crate::query) fn response_proof_v0( + &self, + platform_state: &PlatformState, + proof: Vec, + ) -> Proof { + Proof { + grovedb_proof: proof, + quorum_hash: platform_state.last_committed_quorum_hash().to_vec(), + quorum_type: self.config.validator_set.quorum_type as u32, + block_id_hash: platform_state.last_committed_block_id_hash().to_vec(), + signature: platform_state.last_committed_block_signature().to_vec(), + round: platform_state.last_committed_block_round(), } } } diff --git a/packages/rs-drive-abci/src/query/service.rs b/packages/rs-drive-abci/src/query/service.rs new file mode 100644 index 00000000000..af8d1b840a2 --- /dev/null +++ b/packages/rs-drive-abci/src/query/service.rs @@ -0,0 +1,565 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::metrics::{abci_response_code_metric_label, query_duration_metric}; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use crate::rpc::core::DefaultCoreRPC; +use crate::utils::spawn_blocking_task_with_name_if_supported; +use async_trait::async_trait; +use dapi_grpc::platform::v0::platform_server::Platform as PlatformService; +use dapi_grpc::platform::v0::{ + BroadcastStateTransitionRequest, BroadcastStateTransitionResponse, GetConsensusParamsRequest, + GetConsensusParamsResponse, GetContestedResourceIdentityVotesRequest, + GetContestedResourceIdentityVotesResponse, GetContestedResourceVoteStateRequest, + GetContestedResourceVoteStateResponse, GetContestedResourceVotersForIdentityRequest, + GetContestedResourceVotersForIdentityResponse, GetContestedResourcesRequest, + GetContestedResourcesResponse, GetDataContractHistoryRequest, GetDataContractHistoryResponse, + GetDataContractRequest, GetDataContractResponse, GetDataContractsRequest, + GetDataContractsResponse, GetDocumentsRequest, GetDocumentsResponse, GetEpochsInfoRequest, + GetEpochsInfoResponse, GetIdentitiesContractKeysRequest, GetIdentitiesContractKeysResponse, + GetIdentityBalanceAndRevisionRequest, GetIdentityBalanceAndRevisionResponse, + GetIdentityBalanceRequest, GetIdentityBalanceResponse, GetIdentityByPublicKeyHashRequest, + GetIdentityByPublicKeyHashResponse, GetIdentityContractNonceRequest, + GetIdentityContractNonceResponse, GetIdentityKeysRequest, GetIdentityKeysResponse, + GetIdentityNonceRequest, GetIdentityNonceResponse, GetIdentityRequest, GetIdentityResponse, + GetPathElementsRequest, GetPathElementsResponse, GetPrefundedSpecializedBalanceRequest, + GetPrefundedSpecializedBalanceResponse, GetProofsRequest, GetProofsResponse, + GetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeStateResponse, + GetProtocolVersionUpgradeVoteStatusRequest, GetProtocolVersionUpgradeVoteStatusResponse, + GetTotalCreditsInPlatformRequest, GetTotalCreditsInPlatformResponse, + GetVotePollsByEndDateRequest, GetVotePollsByEndDateResponse, + WaitForStateTransitionResultRequest, WaitForStateTransitionResultResponse, +}; +use dapi_grpc::tonic::{Code, Request, Response, Status}; +use dpp::version::PlatformVersion; +use std::fmt::Debug; +use std::sync::atomic::Ordering; +use std::sync::Arc; +use std::thread::sleep; +use std::time::Duration; +use tracing::Instrument; + +/// Service to handle platform queries +pub struct QueryService { + platform: Arc>, +} + +type QueryMethod = fn( + &Platform, + RQ, + &PlatformState, + &PlatformVersion, +) -> Result, Error>; + +impl QueryService { + /// Creates new QueryService + pub fn new(platform: Arc>) -> Self { + Self { platform } + } + + async fn handle_blocking_query<'a, RQ, RS>( + &self, + request: Request, + query_method: QueryMethod, + endpoint_name: &str, + ) -> Result, Status> + where + RS: Clone + Send + 'static, + RQ: Debug + Send + Clone + 'static, + { + let mut response_duration_metric = query_duration_metric(endpoint_name); + + let platform = Arc::clone(&self.platform); + + let request_debug = format!("{:?}", &request); + + let result = spawn_blocking_task_with_name_if_supported("query", move || { + let mut result; + + let query_request = request.into_inner(); + + let mut query_counter = 0; + + loop { + let platform_state = platform.state.load(); + + let platform_version = platform_state + .current_platform_version() + .map_err(|_| Status::unavailable("platform is not initialized"))?; + + // Query is using Platform execution state and Drive state to during the execution. + // They are updating every block in finalize block ABCI handler. + // The problem is that these two operations aren't atomic and some latency between + // them could lead to data races. `committed_block_height_guard` counter that represents + // the latest the height of latest committed Drive state and logic bellow ensures + // that query is executed only after/before both states are updated. + let mut needs_restart = false; + + loop { + let committed_block_height_guard = platform + .committed_block_height_guard + .load(Ordering::Relaxed); + let mut counter = 0; + if platform_state.last_committed_block_height() == committed_block_height_guard + { + break; + } else { + counter += 1; + sleep(Duration::from_millis(10)) + } + + // We try for up to 1 second + if counter >= 100 { + query_counter += 1; + needs_restart = true; + break; + } + } + + if query_counter > 3 { + return Err(query_error_into_status(QueryError::NotServiceable( + "platform is saturated (did not attempt query)".to_string(), + ))); + } + + if needs_restart { + continue; + } + + result = query_method( + &platform, + query_request.clone(), + &platform_state, + platform_version, + ); + + let committed_block_height_guard = platform + .committed_block_height_guard + .load(Ordering::Relaxed); + + if platform_state.last_committed_block_height() == committed_block_height_guard { + // in this case the query almost certainly executed correctly + break; + } else { + query_counter += 1; + + if query_counter > 2 { + // This should never be possible + return Err(query_error_into_status(QueryError::NotServiceable( + "platform is saturated".to_string(), + ))); + } + } + } + + let mut query_result = result.map_err(error_into_status)?; + + if query_result.is_valid() { + let response = query_result + .into_data() + .map_err(|error| error_into_status(error.into()))?; + + Ok(Response::new(response)) + } else { + let error = query_result.errors.swap_remove(0); + + Err(query_error_into_status(error)) + } + })? + .instrument(tracing::trace_span!("query", endpoint_name)) + .await + .map_err(|error| Status::internal(format!("query thread failed: {}", error)))?; + + // Query logging and metrics + let code = match &result { + Ok(_) => Code::Ok, + Err(status) => status.code(), + }; + + let code_label = format!("{:?}", code).to_lowercase(); + + // Add code to response duration metric + let label = abci_response_code_metric_label(code); + response_duration_metric.add_label(label); + + match code { + // User errors + Code::Ok + | Code::InvalidArgument + | Code::NotFound + | Code::AlreadyExists + | Code::ResourceExhausted + | Code::PermissionDenied + | Code::Unavailable + | Code::Aborted + | Code::FailedPrecondition + | Code::OutOfRange + | Code::Cancelled + | Code::DeadlineExceeded + | Code::Unauthenticated => { + let elapsed_time = response_duration_metric.elapsed().as_secs_f64(); + + tracing::trace!( + request = request_debug, + elapsed_time, + endpoint_name, + code = code_label, + "query '{}' executed with code {:?} in {} secs", + endpoint_name, + code, + elapsed_time + ); + } + // System errors + Code::Unknown | Code::Unimplemented | Code::Internal | Code::DataLoss => { + tracing::error!( + request = request_debug, + endpoint_name, + code = code_label, + "query '{}' execution failed with code {:?}", + endpoint_name, + code + ); + } + } + + result + } +} + +fn respond_with_unimplemented(name: &str) -> Result, Status> { + tracing::error!("{} endpoint is called but it's not supported", name); + + Err(Status::unimplemented("the endpoint is not supported")) +} + +#[async_trait] +impl PlatformService for QueryService { + async fn broadcast_state_transition( + &self, + _request: Request, + ) -> Result, Status> { + respond_with_unimplemented("broadcast_state_transition") + } + + async fn get_identity( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_identity, + "get_identity", + ) + .await + } + + async fn get_identities_contract_keys( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_identities_contract_keys, + "get_identities_contract_keys", + ) + .await + } + + async fn get_identity_keys( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_keys, + "get_identity_keys", + ) + .await + } + + async fn get_identity_nonce( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_identity_nonce, + "get_identity_nonce", + ) + .await + } + + async fn get_identity_contract_nonce( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_identity_contract_nonce, + "get_identity_contract_nonce", + ) + .await + } + + async fn get_identity_balance( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_balance, + "get_identity_balance", + ) + .await + } + + async fn get_identity_balance_and_revision( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_balance_and_revision, + "get_identity_balance_and_revision", + ) + .await + } + + async fn get_proofs( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_proofs, + "get_proofs", + ) + .await + } + + async fn get_data_contract( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_data_contract, + "get_data_contract", + ) + .await + } + + async fn get_data_contract_history( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_data_contract_history, + "get_data_contract_history", + ) + .await + } + + async fn get_data_contracts( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_data_contracts, + "get_data_contracts", + ) + .await + } + + async fn get_documents( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_documents, + "get_documents", + ) + .await + } + + async fn get_identity_by_public_key_hash( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_identity_by_public_key_hash, + "get_identity_by_public_key_hash", + ) + .await + } + + async fn wait_for_state_transition_result( + &self, + _request: Request, + ) -> Result, Status> { + respond_with_unimplemented("wait_for_state_transition_result") + } + + async fn get_consensus_params( + &self, + _request: Request, + ) -> Result, Status> { + respond_with_unimplemented("get_consensus_params") + } + + async fn get_protocol_version_upgrade_state( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_version_upgrade_state, + "get_protocol_version_upgrade_state", + ) + .await + } + + async fn get_protocol_version_upgrade_vote_status( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_version_upgrade_vote_status, + "get_protocol_version_upgrade_vote_status", + ) + .await + } + + async fn get_epochs_info( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_epoch_infos, + "get_epochs_info", + ) + .await + } + + async fn get_path_elements( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_path_elements, + "get_path_elements", + ) + .await + } + + async fn get_contested_resources( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_contested_resources, + "get_contested_resources", + ) + .await + } + + async fn get_contested_resource_vote_state( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_contested_resource_vote_state, + "get_contested_resource_vote_state", + ) + .await + } + + async fn get_contested_resource_voters_for_identity( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_contested_resource_voters_for_identity, + "get_contested_resource_voters_for_identity", + ) + .await + } + + async fn get_contested_resource_identity_votes( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_contested_resource_identity_votes, + "get_contested_resource_identity_votes", + ) + .await + } + + async fn get_vote_polls_by_end_date( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_vote_polls_by_end_date_query, + "get_vote_polls_by_end_date", + ) + .await + } + + async fn get_prefunded_specialized_balance( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_prefunded_specialized_balance, + "get_prefunded_specialized_balance", + ) + .await + } + + async fn get_total_credits_in_platform( + &self, + request: Request, + ) -> Result, Status> { + self.handle_blocking_query( + request, + Platform::::query_total_credits_in_platform, + "get_total_credits_in_platform", + ) + .await + } +} + +fn query_error_into_status(error: QueryError) -> Status { + match error { + QueryError::NotFound(message) => Status::not_found(message), + QueryError::InvalidArgument(message) => Status::invalid_argument(message), + QueryError::Query(error) => Status::invalid_argument(error.to_string()), + _ => { + tracing::error!("unexpected query error: {:?}", error); + + Status::unknown(error.to_string()) + } + } +} + +fn error_into_status(error: Error) -> Status { + Status::internal(format!("query: {}", error)) +} diff --git a/packages/rs-drive-abci/src/query/system/epoch_infos/mod.rs b/packages/rs-drive-abci/src/query/system/epoch_infos/mod.rs index ac50348d9f6..bf3fc6497d2 100644 --- a/packages/rs-drive-abci/src/query/system/epoch_infos/mod.rs +++ b/packages/rs-drive-abci/src/query/system/epoch_infos/mod.rs @@ -5,26 +5,19 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_epochs_info_request::Version; -use dapi_grpc::platform::v0::GetEpochsInfoRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_epochs_info_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_epochs_info_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetEpochsInfoRequest, GetEpochsInfoResponse}; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { /// Querying of version upgrade state - pub(in crate::query) fn query_epoch_infos( + pub fn query_epoch_infos( &self, - state: &PlatformState, - query_data: &[u8], + GetEpochsInfoRequest { version }: GetEpochsInfoRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetEpochsInfoRequest { version } = - check_validation_result_with_data!(GetEpochsInfoRequest::decode(query_data).map_err( - |e| { QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) } - )); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode epoch info request".to_string()), @@ -34,7 +27,7 @@ impl Platform { let feature_version_bounds = &platform_version.drive_abci.query.system.epoch_infos; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -48,8 +41,13 @@ impl Platform { )); } match version { - Version::V0(get_epoch_infos_request) => { - self.query_epoch_infos_v0(state, get_epoch_infos_request, platform_version) + RequestVersion::V0(request_v0) => { + let result = + self.query_epoch_infos_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetEpochsInfoResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) } } } diff --git a/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs b/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs index 8fb355e59aa..48f32c88475 100644 --- a/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs @@ -2,42 +2,36 @@ use crate::error::query::QueryError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; use dapi_grpc::platform::v0::get_epochs_info_request::GetEpochsInfoRequestV0; use dapi_grpc::platform::v0::get_epochs_info_response::get_epochs_info_response_v0::EpochInfos; -use dapi_grpc::platform::v0::get_epochs_info_response::GetEpochsInfoResponseV0; -use dapi_grpc::platform::v0::{ - get_epochs_info_response, GetEpochsInfoRequest, GetEpochsInfoResponse, Proof, +use dapi_grpc::platform::v0::get_epochs_info_response::{ + get_epochs_info_response_v0, GetEpochsInfoResponseV0, }; use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0Getters; use dpp::check_validation_result_with_data; -use dpp::serialization::PlatformSerializableWithPlatformVersion; + +use crate::platform_types::platform_state::PlatformState; use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { pub(super) fn query_epoch_infos_v0( &self, - state: &PlatformState, - request: GetEpochsInfoRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetEpochsInfoRequestV0 { + GetEpochsInfoRequestV0 { start_epoch, count, ascending, prove, - } = request; - + }: GetEpochsInfoRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { let start_epoch = start_epoch.unwrap_or_else(|| { if ascending { 0 } else { - state.epoch_ref().index as u32 + platform_state.last_committed_block_epoch_ref().index as u32 } }); @@ -56,7 +50,7 @@ impl Platform { )); } - let response_data = if prove { + let response = if prove { let proof = check_validation_result_with_data!(self.drive.prove_epochs_infos( start_epoch as u16, count as u16, @@ -65,26 +59,12 @@ impl Platform { platform_version )); - GetEpochsInfoResponse { - version: Some(get_epochs_info_response::Version::V0( - GetEpochsInfoResponseV0 { - result: Some( - get_epochs_info_response::get_epochs_info_response_v0::Result::Proof( - Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - }, - ), - ), - metadata: Some(metadata), - }, + GetEpochsInfoResponseV0 { + result: Some(get_epochs_info_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), )), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let result = check_validation_result_with_data!(self.drive.get_epochs_infos( start_epoch as u16, @@ -93,33 +73,82 @@ impl Platform { None, platform_version )); + let epoch_infos = result .into_iter() - .map(|epoch_info| { - get_epochs_info_response::get_epochs_info_response_v0::EpochInfo { - number: epoch_info.index() as u32, - first_block_height: epoch_info.first_block_height(), - first_core_block_height: epoch_info.first_core_block_height(), - start_time: epoch_info.first_block_time(), - fee_multiplier: epoch_info.fee_multiplier(), - } + .map(|epoch_info| get_epochs_info_response_v0::EpochInfo { + number: epoch_info.index() as u32, + first_block_height: epoch_info.first_block_height(), + first_core_block_height: epoch_info.first_core_block_height(), + start_time: epoch_info.first_block_time(), + fee_multiplier: epoch_info.fee_multiplier_permille() as f64 / 1000.0, + protocol_version: epoch_info.protocol_version(), }) .collect(); - GetEpochsInfoResponse { - version: Some(get_epochs_info_response::Version::V0( - GetEpochsInfoResponseV0 { - result: Some( - get_epochs_info_response::get_epochs_info_response_v0::Result::Epochs( - EpochInfos { epoch_infos }, - ), - ), - metadata: Some(metadata), - }, - )), + GetEpochsInfoResponseV0 { + result: Some(get_epochs_info_response_v0::Result::Epochs(EpochInfos { + epoch_infos, + })), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use dpp::dashcore::Network; + + #[test] + fn test_query_empty_epoch_infos() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetEpochsInfoRequestV0 { + start_epoch: None, // 0 + count: 5, + ascending: true, + prove: false, + }; + + let result = platform + .query_epoch_infos_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + result.data, + Some(GetEpochsInfoResponseV0 { + result: Some(get_epochs_info_response_v0::Result::Epochs(EpochInfos { epoch_infos })), + metadata: Some(_), + }) if epoch_infos.is_empty() + )); + } + + #[test] + fn test_query_empty_epoch_infos_descending() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetEpochsInfoRequestV0 { + start_epoch: None, // 0 + count: 5, + ascending: false, + prove: false, + }; + + let validation_result = platform + .query_epoch_infos_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + validation_result.data, + Some(GetEpochsInfoResponseV0 { + result: Some(get_epochs_info_response_v0::Result::Epochs(EpochInfos { epoch_infos })), + metadata: Some(_), + }) if epoch_infos.is_empty() + )); } } diff --git a/packages/rs-drive-abci/src/query/system/mod.rs b/packages/rs-drive-abci/src/query/system/mod.rs index 620d66c1871..b317be8edf3 100644 --- a/packages/rs-drive-abci/src/query/system/mod.rs +++ b/packages/rs-drive-abci/src/query/system/mod.rs @@ -1,3 +1,5 @@ mod epoch_infos; +mod path_elements; +mod total_credits_in_platform; mod version_upgrade_state; mod version_upgrade_vote_status; diff --git a/packages/rs-drive-abci/src/query/system/path_elements/mod.rs b/packages/rs-drive-abci/src/query/system/path_elements/mod.rs new file mode 100644 index 00000000000..1a915236024 --- /dev/null +++ b/packages/rs-drive-abci/src/query/system/path_elements/mod.rs @@ -0,0 +1,54 @@ +mod v0; + +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_path_elements_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_path_elements_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetPathElementsRequest, GetPathElementsResponse}; +use dpp::version::PlatformVersion; + +impl Platform { + /// Querying of version upgrade state + pub fn query_path_elements( + &self, + GetPathElementsRequest { version }: GetPathElementsRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError("could not decode epoch info request".to_string()), + )); + }; + + let feature_version_bounds = &platform_version.drive_abci.query.system.path_elements; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "path_elements".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = + self.query_path_elements_v0(request_v0, platform_state, platform_version)?; + + Ok(result.map(|response_v0| GetPathElementsResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/system/path_elements/v0/mod.rs b/packages/rs-drive-abci/src/query/system/path_elements/v0/mod.rs new file mode 100644 index 00000000000..f3d63cb6e56 --- /dev/null +++ b/packages/rs-drive-abci/src/query/system/path_elements/v0/mod.rs @@ -0,0 +1,131 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; +use dapi_grpc::platform::v0::get_path_elements_response::get_path_elements_response_v0::Elements; +use dapi_grpc::platform::v0::get_path_elements_response::{ + get_path_elements_response_v0, GetPathElementsResponseV0, +}; +use dpp::check_validation_result_with_data; + +use crate::error::query::QueryError; +use crate::platform_types::platform_state::PlatformState; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; +use drive::error::query::QuerySyntaxError; + +impl Platform { + pub(super) fn query_path_elements_v0( + &self, + GetPathElementsRequestV0 { path, keys, prove }: GetPathElementsRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + if keys.len() > platform_version.drive_abci.query.max_returned_elements as usize { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + QuerySyntaxError::InvalidLimit(format!( + "trying to get {} values, maximum is {}", + keys.len(), + platform_version.drive_abci.query.max_returned_elements + )), + ))); + } + let response = if prove { + let proof = check_validation_result_with_data!(self.drive.prove_elements( + path, + keys, + None, + platform_version + )); + + GetPathElementsResponseV0 { + result: Some(get_path_elements_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let result = check_validation_result_with_data!(self.drive.fetch_elements( + path, + keys, + None, + platform_version + )); + + let serialized = result + .into_iter() + .map(|element| { + element + .serialize(&platform_version.drive.grove_version) + .map_err(|e| Error::Drive(drive::error::Error::GroveDB(e))) + }) + .collect::>, Error>>()?; + + GetPathElementsResponseV0 { + result: Some(get_path_elements_response_v0::Result::Elements(Elements { + elements: serialized, + })), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use dpp::dashcore::Network; + use drive::drive::balances::TOTAL_SYSTEM_CREDITS_STORAGE_KEY; + use drive::drive::RootTree; + use drive::grovedb::Element; + use integer_encoding::VarInt; + + #[test] + fn test_query_total_system_credits_from_path_elements_query() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let platform_version = PlatformVersion::latest(); + + platform + .drive + .add_to_system_credits(100, None, platform_version) + .expect("expected to insert identity"); + + let request = GetPathElementsRequestV0 { + path: vec![vec![RootTree::Misc as u8]], + keys: vec![TOTAL_SYSTEM_CREDITS_STORAGE_KEY.to_vec()], + prove: false, + }; + + let response = platform + .query_path_elements_v0(request, &state, version) + .expect("expected query to succeed"); + + let response_data = response.into_data().expect("expected data"); + + let get_path_elements_response_v0::Result::Elements(mut elements) = + response_data.result.expect("expected a result") + else { + panic!("expected elements") + }; + + assert_eq!(elements.elements.len(), 1); + + let element = Element::deserialize( + elements.elements.remove(0).as_slice(), + &platform_version.drive.grove_version, + ) + .expect("expected to deserialize element"); + + let Element::Item(value, _) = element else { + panic!("expected item") + }; + + let (amount, _) = u64::decode_var(value.as_slice()).expect("expected amount"); + + assert_eq!(amount, 100); + } +} diff --git a/packages/rs-drive-abci/src/query/system/total_credits_in_platform/mod.rs b/packages/rs-drive-abci/src/query/system/total_credits_in_platform/mod.rs new file mode 100644 index 00000000000..1bb352103f3 --- /dev/null +++ b/packages/rs-drive-abci/src/query/system/total_credits_in_platform/mod.rs @@ -0,0 +1,63 @@ +mod v0; + +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_total_credits_in_platform_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_total_credits_in_platform_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetTotalCreditsInPlatformRequest, GetTotalCreditsInPlatformResponse, +}; +use dpp::version::PlatformVersion; + +impl Platform { + /// Querying the total credits in platform + pub fn query_total_credits_in_platform( + &self, + GetTotalCreditsInPlatformRequest { version }: GetTotalCreditsInPlatformRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError("could not decode epoch info request".to_string()), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .system + .total_credits_in_platform; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "total_credits_in_platform".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_total_credits_in_platform_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok(result.map(|response_v0| GetTotalCreditsInPlatformResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/system/total_credits_in_platform/v0/mod.rs b/packages/rs-drive-abci/src/query/system/total_credits_in_platform/v0/mod.rs new file mode 100644 index 00000000000..890ca588282 --- /dev/null +++ b/packages/rs-drive-abci/src/query/system/total_credits_in_platform/v0/mod.rs @@ -0,0 +1,333 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_total_credits_in_platform_request::GetTotalCreditsInPlatformRequestV0; +use dapi_grpc::platform::v0::get_total_credits_in_platform_response::{ + get_total_credits_in_platform_response_v0, GetTotalCreditsInPlatformResponseV0, +}; +use dpp::block::epoch::Epoch; +use dpp::check_validation_result_with_data; +use dpp::core_subsidy::epoch_core_reward_credits_for_distribution::epoch_core_reward_credits_for_distribution; +use dpp::core_subsidy::NetworkCoreSubsidy; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; +use drive::drive::balances::{ + total_credits_on_platform_path_query, TOTAL_SYSTEM_CREDITS_STORAGE_KEY, +}; +use drive::drive::credit_pools::epochs::epoch_key_constants::KEY_START_BLOCK_CORE_HEIGHT; +use drive::drive::credit_pools::epochs::epochs_root_tree_key_constants::KEY_UNPAID_EPOCH_INDEX; +use drive::drive::credit_pools::epochs::paths::EpochProposers; +use drive::drive::system::misc_path; +use drive::drive::RootTree; +use drive::error::proof::ProofError; +use drive::grovedb::{PathQuery, Query, SizedQuery}; +use drive::util::grove_operations::DirectQueryType; + +impl Platform { + pub(super) fn query_total_credits_in_platform_v0( + &self, + GetTotalCreditsInPlatformRequestV0 { prove }: GetTotalCreditsInPlatformRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let response = if prove { + let mut total_credits_on_platform_path_query = total_credits_on_platform_path_query(); + + total_credits_on_platform_path_query.query.limit = None; + + let unpaid_epoch = self.drive.get_unpaid_epoch_index(None, platform_version)?; + + // we also need the path_query for the start_core_height of this unpaid epoch + let unpaid_epoch_index_path_query = PathQuery { + path: vec![vec![RootTree::Pools as u8]], + query: SizedQuery { + query: Query::new_single_key(KEY_UNPAID_EPOCH_INDEX.to_vec()), + limit: None, + offset: None, + }, + }; + + let epoch = Epoch::new(unpaid_epoch)?; + + let start_core_height_query = PathQuery { + path: epoch.get_path_vec(), + query: SizedQuery { + query: Query::new_single_key(KEY_START_BLOCK_CORE_HEIGHT.to_vec()), + limit: None, + offset: None, + }, + }; + + let path_query = PathQuery::merge( + vec![ + &total_credits_on_platform_path_query, + &unpaid_epoch_index_path_query, + &start_core_height_query, + ], + &platform_version.drive.grove_version, + )?; + + let proof = check_validation_result_with_data!(self.drive.grove_get_proved_path_query( + &path_query, + None, + &mut vec![], + &platform_version.drive, + )); + + GetTotalCreditsInPlatformResponseV0 { + result: Some(get_total_credits_in_platform_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let path_holding_total_credits = misc_path(); + let total_credits_in_platform = self + .drive + .grove_get_raw_value_u64_from_encoded_var_vec( + (&path_holding_total_credits).into(), + TOTAL_SYSTEM_CREDITS_STORAGE_KEY, + DirectQueryType::StatefulDirectQuery, + None, + &mut vec![], + &platform_version.drive, + )? + .unwrap_or_default(); // 0 would mean we haven't initialized yet + + let unpaid_epoch_index = self.drive.get_unpaid_epoch_index(None, platform_version)?; + + let unpaid_epoch = Epoch::new(unpaid_epoch_index)?; + + let start_block_core_height = if unpaid_epoch.index == 0 { + self.drive + .fetch_genesis_core_height(None, platform_version)? + } else { + self.drive.get_epoch_start_block_core_height( + &unpaid_epoch, + None, + platform_version, + )? + 1 + }; + + let reward_credits_accumulated_during_current_epoch = + epoch_core_reward_credits_for_distribution( + start_block_core_height, + platform_state.last_committed_core_height(), + self.config.network.core_subsidy_halving_interval(), + platform_version, + )?; + + let total_credits_with_rewards = total_credits_in_platform.checked_add(reward_credits_accumulated_during_current_epoch).ok_or(drive::error::Error::Proof(ProofError::CorruptedProof("overflow while adding platform credits with reward credits accumulated during current epoch".to_string())))?; + + GetTotalCreditsInPlatformResponseV0 { + result: Some(get_total_credits_in_platform_response_v0::Result::Credits( + total_credits_with_rewards, + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use crate::test::helpers::fast_forward_to_block::fast_forward_to_block; + use dashcore_rpc::dashcore::Network; + use dpp::block::epoch::EpochIndex; + use dpp::fee::Credits; + use dpp::prelude::CoreBlockHeight; + use drive::drive::Drive; + + fn test_query_total_system_credits( + epoch_index: EpochIndex, + activation_core_height: CoreBlockHeight, + epoch_core_start_height: CoreBlockHeight, + current_core_height: CoreBlockHeight, + ) -> Credits { + let (platform, _state, platform_version) = + setup_platform(Some((1, activation_core_height)), Network::Regtest); + + platform + .drive + .add_to_system_credits(100, None, platform_version) + .expect("expected to insert identity"); + + fast_forward_to_block( + &platform, + 5000 * epoch_index as u64, + 100 * epoch_index as u64, + epoch_core_start_height, + epoch_index, + true, + ); + + if current_core_height > epoch_core_start_height { + fast_forward_to_block( + &platform, + 5000 * epoch_index as u64 + 10000, + 100 * epoch_index as u64 + 50, + current_core_height, + epoch_index, + false, + ); + } + + let request = GetTotalCreditsInPlatformRequestV0 { prove: false }; + + let state = platform.state.load(); + + let response = platform + .query_total_credits_in_platform_v0(request, &state, platform_version) + .expect("expected query to succeed"); + + let response_data = response.into_data().expect("expected data"); + + let get_total_credits_in_platform_response_v0::Result::Credits(credits) = + response_data.result.expect("expected a result") + else { + panic!("expected credits") + }; + + let rewards = epoch_core_reward_credits_for_distribution( + if epoch_index == 0 { + activation_core_height + } else { + epoch_core_start_height + 1 + }, + current_core_height, + Network::Regtest.core_subsidy_halving_interval(), + platform_version, + ) + .expect("expected to get rewards"); + + assert_eq!(credits, 100 + rewards); + + credits + } + + fn test_proved_query_total_system_credits( + epoch_index: EpochIndex, + activation_core_height: CoreBlockHeight, + epoch_core_start_height: CoreBlockHeight, + current_core_height: CoreBlockHeight, + ) -> Credits { + let (platform, _state, platform_version) = + setup_platform(Some((1, activation_core_height)), Network::Regtest); + + platform + .drive + .add_to_system_credits(100, None, platform_version) + .expect("expected to insert identity"); + + fast_forward_to_block( + &platform, + 5000 * epoch_index as u64, + 100 * epoch_index as u64, + epoch_core_start_height, + epoch_index, + true, + ); + + if current_core_height > epoch_core_start_height { + fast_forward_to_block( + &platform, + 5000 * epoch_index as u64 + 10000, + 100 * epoch_index as u64 + 50, + current_core_height, + epoch_index, + false, + ); + } + + let request = GetTotalCreditsInPlatformRequestV0 { prove: true }; + + let state = platform.state.load(); + + let response = platform + .query_total_credits_in_platform_v0(request, &state, platform_version) + .expect("expected query to succeed"); + + let response_data = response.into_data().expect("expected data"); + + let get_total_credits_in_platform_response_v0::Result::Proof(proof) = + response_data.result.expect("expected a result") + else { + panic!("expected proof") + }; + + let network = Network::Regtest; + + let core_subsidy_halving_interval = network.core_subsidy_halving_interval(); + + let (_, credits) = Drive::verify_total_credits_in_system( + &proof.grovedb_proof, + core_subsidy_halving_interval, + || Ok(activation_core_height), + current_core_height, + platform_version, + ) + .expect("expected to verify total credits in platform"); + + let rewards = epoch_core_reward_credits_for_distribution( + if epoch_index == 0 { + activation_core_height + } else { + epoch_core_start_height + 1 + }, + current_core_height, + core_subsidy_halving_interval, + platform_version, + ) + .expect("expected to get rewards"); + + assert_eq!(credits, 100 + rewards); + + credits + } + + #[test] + fn test_query_total_system_credits_at_genesis_platform_immediate_start() { + // the fork height is 1500, the genesis core height is 1500 and we are asking for credits after this first block was committed + let non_proved = test_query_total_system_credits(0, 1500, 1500, 1500); + let proved = test_proved_query_total_system_credits(0, 1500, 1500, 1500); + assert_eq!(non_proved, proved); + } + + #[test] + fn test_query_total_system_credits_at_genesis_platform_later_start() { + // the fork height was 1320, the genesis core height is 1500 and we are asking for credits after this first block was committed + let non_proved = test_query_total_system_credits(0, 1320, 1500, 1500); + let proved = test_proved_query_total_system_credits(0, 1320, 1500, 1500); + assert_eq!(non_proved, proved); + } + + #[test] + fn test_query_total_system_credits_on_first_epoch_not_genesis_immediate_start() { + // the fork height is 1500, the genesis core height is 1500 and we are at height 1550 + let non_proved = test_query_total_system_credits(0, 1500, 1500, 1550); + let proved = test_proved_query_total_system_credits(0, 1500, 1500, 1550); + assert_eq!(non_proved, proved); + } + + #[test] + fn test_query_total_system_credits_on_first_epoch_not_genesis_later_start() { + // the fork height was 1320, the genesis core height is 1500 and we are at height 1550 + let non_proved = test_query_total_system_credits(0, 1320, 1500, 1550); + let proved = test_proved_query_total_system_credits(0, 1320, 1500, 1550); + assert_eq!(non_proved, proved); + } + + #[test] + fn test_query_total_system_credits_not_genesis_epoch() { + // the fork height was 1500, the genesis core height is 1500 and we are at height 2500 + let non_proved = test_query_total_system_credits(1, 1500, 2000, 2500); + let proved = test_proved_query_total_system_credits(1, 1500, 2000, 2500); + assert_eq!(non_proved, proved); + } +} diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_state/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_state/mod.rs index 7f6c18414da..d5d9e901059 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_state/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_state/mod.rs @@ -5,27 +5,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_request::Version; -use dapi_grpc::platform::v0::GetProtocolVersionUpgradeStateRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeStateResponse, +}; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { /// Querying of version upgrade state - pub(in crate::query) fn query_version_upgrade_state( + pub fn query_version_upgrade_state( &self, - state: &PlatformState, - query_data: &[u8], + GetProtocolVersionUpgradeStateRequest { version }: GetProtocolVersionUpgradeStateRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetProtocolVersionUpgradeStateRequest { version } = check_validation_result_with_data!( - GetProtocolVersionUpgradeStateRequest::decode(query_data).map_err(|e| { - QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - }) - ); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode identity keys query".to_string()), @@ -39,7 +33,7 @@ impl Platform { .version_upgrade_state; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -53,12 +47,19 @@ impl Platform { )); } match version { - Version::V0(get_protocol_version_upgrade_state_request) => self - .query_version_upgrade_state_v0( - state, - get_protocol_version_upgrade_state_request, + RequestVersion::V0(request_v0) => { + let result = self.query_version_upgrade_state_v0( + request_v0, + platform_state, platform_version, - ), + )?; + + Ok( + result.map(|response_v0| GetProtocolVersionUpgradeStateResponse { + version: Some(ResponseVersion::V0(response_v0)), + }), + ) + } } } } diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs index efba1e9fe7b..44e6f7a6855 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs @@ -1,61 +1,39 @@ use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::{ - get_protocol_version_upgrade_state_response, GetProtocolVersionUpgradeStateRequest, - GetProtocolVersionUpgradeStateResponse, Proof, -}; use dpp::check_validation_result_with_data; -use dpp::serialization::PlatformSerializableWithPlatformVersion; + use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_request::GetProtocolVersionUpgradeStateRequestV0; use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_response::get_protocol_version_upgrade_state_response_v0::{VersionEntry, Versions}; -use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_response::GetProtocolVersionUpgradeStateResponseV0; +use dapi_grpc::platform::v0::get_protocol_version_upgrade_state_response::{get_protocol_version_upgrade_state_response_v0, GetProtocolVersionUpgradeStateResponseV0}; +use crate::platform_types::platform_state::PlatformState; impl Platform { pub(super) fn query_version_upgrade_state_v0( &self, - state: &PlatformState, - request: GetProtocolVersionUpgradeStateRequestV0, + GetProtocolVersionUpgradeStateRequestV0 { prove }: GetProtocolVersionUpgradeStateRequestV0, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetProtocolVersionUpgradeStateRequestV0 { prove } = request; - - let response_data = if prove { + ) -> Result, Error> { + let response = if prove { let proof = check_validation_result_with_data!(self .drive .fetch_proved_versions_with_counter(None, &platform_version.drive)); - GetProtocolVersionUpgradeStateResponse { - version: Some(get_protocol_version_upgrade_state_response::Version::V0( - GetProtocolVersionUpgradeStateResponseV0 { - result: Some( - get_protocol_version_upgrade_state_response::get_protocol_version_upgrade_state_response_v0::Result::Proof( - Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - }, - ), - ), - metadata: Some(metadata), - }, - )), + GetProtocolVersionUpgradeStateResponseV0 { + result: Some( + get_protocol_version_upgrade_state_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { - let drive_cache = self.drive.cache.read().unwrap(); - let versions = drive_cache - .protocol_versions_counter + let protocol_versions_counter = self.drive.cache.protocol_versions_counter.read(); + + let versions = protocol_versions_counter .global_cache .iter() .map(|(protocol_version, count)| VersionEntry { @@ -64,20 +42,313 @@ impl Platform { }) .collect(); - GetProtocolVersionUpgradeStateResponse { - version: Some(get_protocol_version_upgrade_state_response::Version::V0( - GetProtocolVersionUpgradeStateResponseV0 { - result: Some( - get_protocol_version_upgrade_state_response::get_protocol_version_upgrade_state_response_v0::Result::Versions( - Versions { versions }, - ), - ), - metadata: Some(metadata), - }, - )), + drop(protocol_versions_counter); + + GetProtocolVersionUpgradeStateResponseV0 { + result: Some( + get_protocol_version_upgrade_state_response_v0::Result::Versions(Versions { + versions, + }), + ), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() }; - Ok(QueryValidationResult::new_with_data(response_data)) + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use dpp::dashcore::Network; + use drive::drive::protocol_upgrade::{ + desired_version_for_validators_path, versions_counter_path, versions_counter_path_vec, + }; + use drive::drive::Drive; + use drive::grovedb::{Element, GroveDb, PathQuery}; + use drive::query::{Query, QueryItem}; + use drive::util::grove_operations::BatchInsertApplyType; + use drive::util::object_size_info::PathKeyElementInfo; + use integer_encoding::VarInt; + use rand::rngs::StdRng; + use rand::{Rng, SeedableRng}; + use std::ops::RangeFull; + + #[test] + fn test_query_empty_upgrade_state() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProtocolVersionUpgradeStateRequestV0 { prove: false }; + + let validation_result = platform + .query_version_upgrade_state_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + validation_result.data, + Some(GetProtocolVersionUpgradeStateResponseV0 { + result: Some(get_protocol_version_upgrade_state_response_v0::Result::Versions(versions)), + metadata: Some(_) + }) if versions.versions.is_empty() + )); + } + + #[test] + fn test_query_upgrade_state() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let mut rand = StdRng::seed_from_u64(10); + + let drive = &platform.drive; + + let mut version_counter = drive.cache.protocol_versions_counter.write(); + + let transaction = drive.grove.start_transaction(); + + version_counter + .load_if_needed(drive, Some(&transaction), &version.drive) + .expect("expected to load version counter"); + + let path = desired_version_for_validators_path(); + let version_bytes = version.protocol_version.encode_var_vec(); + let version_element = Element::new_item(version_bytes.clone()); + + let validator_pro_tx_hash: [u8; 32] = rand.gen(); + + let mut operations = vec![]; + drive + .batch_insert_if_changed_value( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + path, + validator_pro_tx_hash.as_slice(), + version_element, + )), + BatchInsertApplyType::StatefulBatchInsert, + Some(&transaction), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + let mut version_count = version_counter + .get(&version.protocol_version) + .expect("expected to get version count") + .cloned() + .unwrap_or_default(); + + version_count += 1; + + version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache + + drive + .batch_insert( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + versions_counter_path(), + version_bytes.as_slice(), + Element::new_item(version_count.encode_var_vec()), + )), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + drive + .apply_batch_low_level_drive_operations( + None, + Some(&transaction), + operations, + &mut vec![], + &version.drive, + ) + .expect("expected to apply operations"); + + drive + .commit_transaction(transaction, &version.drive) + .expect("expected to commit"); + + version_counter.merge_block_cache(); + drop(version_counter); + + let request = GetProtocolVersionUpgradeStateRequestV0 { prove: false }; + + let validation_result = platform + .query_version_upgrade_state_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!( + validation_result.data, + Some(GetProtocolVersionUpgradeStateResponseV0 { + result: Some(get_protocol_version_upgrade_state_response_v0::Result::Versions(versions)), + metadata: Some(_) + }) if versions.versions.len() == 1 + )); + } + + #[test] + fn test_prove_empty_upgrade_state() { + let platform_version = PlatformVersion::latest(); + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let request = GetProtocolVersionUpgradeStateRequestV0 { prove: true }; + + let validation_result = platform + .query_version_upgrade_state_v0(request, &state, version) + .expect("expected query to succeed"); + + let path_query = PathQuery::new_unsized( + versions_counter_path_vec(), + Query::new_single_query_item(QueryItem::RangeFull(RangeFull)), + ); + + // we just started chain, there should be no versions + + if let Some(GetProtocolVersionUpgradeStateResponseV0 { + result: Some(get_protocol_version_upgrade_state_response_v0::Result::Proof(proof)), + metadata: Some(_), + }) = validation_result.data + { + let elements = GroveDb::verify_query( + proof.grovedb_proof.as_slice(), + &path_query, + &platform_version.drive.grove_version, + ) + .expect("expected to be able to verify query") + .1; + + assert!(elements.is_empty()); + } else { + panic!("expected a proof"); + } + } + + #[test] + fn test_prove_upgrade_state() { + let platform_version = PlatformVersion::latest(); + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let mut rand = StdRng::seed_from_u64(10); + + let drive = &platform.drive; + + let version_counter = &mut drive.cache.protocol_versions_counter.write(); + + let transaction = drive.grove.start_transaction(); + + version_counter + .load_if_needed(drive, Some(&transaction), &version.drive) + .expect("expected to load version counter"); + + let path = desired_version_for_validators_path(); + let version_bytes = version.protocol_version.encode_var_vec(); + let version_element = Element::new_item(version_bytes.clone()); + + let validator_pro_tx_hash: [u8; 32] = rand.gen(); + + let mut operations = vec![]; + drive + .batch_insert_if_changed_value( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + path, + validator_pro_tx_hash.as_slice(), + version_element, + )), + BatchInsertApplyType::StatefulBatchInsert, + Some(&transaction), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + let mut version_count = version_counter + .get(&version.protocol_version) + .expect("expected to get version count") + .cloned() + .unwrap_or_default(); + + version_count += 1; + + version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache + + drive + .batch_insert( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + versions_counter_path(), + version_bytes.as_slice(), + Element::new_item(version_count.encode_var_vec()), + )), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + drive + .apply_batch_low_level_drive_operations( + None, + Some(&transaction), + operations, + &mut vec![], + &version.drive, + ) + .expect("expected to apply operations"); + + drive + .commit_transaction(transaction, &version.drive) + .expect("expected to commit"); + + version_counter.merge_block_cache(); + + let request = GetProtocolVersionUpgradeStateRequestV0 { prove: true }; + + let validation_result = platform + .query_version_upgrade_state_v0(request, &state, version) + .expect("expected query to succeed"); + + let Some(GetProtocolVersionUpgradeStateResponseV0 { + result: Some(get_protocol_version_upgrade_state_response_v0::Result::Proof(proof)), + metadata: Some(_), + }) = validation_result.data + else { + panic!("expected a proof"); + }; + + let path_query = PathQuery::new_unsized( + versions_counter_path_vec(), + Query::new_single_query_item(QueryItem::RangeFull(RangeFull)), + ); + + let elements = GroveDb::verify_query( + proof.grovedb_proof.as_slice(), + &path_query, + &platform_version.drive.grove_version, + ) + .expect("expected to be able to verify query") + .1; + + // we just started chain, there should be no versions + + assert_eq!(elements.len(), 1); + + let (_, _, element) = elements.first().unwrap(); + + assert!(element.is_some()); + + let element = element.clone().unwrap(); + + let count_bytes = element.as_item_bytes().expect("expected item bytes"); + + let count = u16::decode_var(count_bytes) + .expect("expected to decode var int") + .0; + + assert_eq!(count, 1); + + let upgrade = Drive::verify_upgrade_state(proof.grovedb_proof.as_slice(), version) + .expect("expected to verify the upgrade counts") + .1; + + assert_eq!(upgrade.len(), 1); + assert_eq!(upgrade.get(&1), Some(1).as_ref()); } } diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/mod.rs index 92fb1b1c2aa..48dbacbd9ba 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/mod.rs @@ -5,27 +5,21 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::Version; -use dapi_grpc::platform::v0::GetProtocolVersionUpgradeVoteStatusRequest; -use dpp::check_validation_result_with_data; -use dpp::validation::ValidationResult; +use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetProtocolVersionUpgradeVoteStatusRequest, GetProtocolVersionUpgradeVoteStatusResponse, +}; use dpp::version::PlatformVersion; -use prost::Message; impl Platform { - /// Querying of version upgrade vote status - pub(in crate::query) fn query_version_upgrade_vote_status( + /// Querying of version upgrade votes status + pub fn query_version_upgrade_vote_status( &self, - state: &PlatformState, - query_data: &[u8], + GetProtocolVersionUpgradeVoteStatusRequest { version } : GetProtocolVersionUpgradeVoteStatusRequest, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result>, Error> { - let GetProtocolVersionUpgradeVoteStatusRequest { version } = check_validation_result_with_data!( - GetProtocolVersionUpgradeVoteStatusRequest::decode(query_data).map_err(|e| { - QueryError::InvalidArgument(format!("invalid query proto message: {}", e)) - }) - ); - + ) -> Result, Error> { let Some(version) = version else { return Ok(QueryValidationResult::new_with_error( QueryError::DecodingError("could not decode identity keys query".to_string()), @@ -39,7 +33,7 @@ impl Platform { .version_upgrade_vote_status; let feature_version = match &version { - Version::V0(_) => 0, + RequestVersion::V0(_) => 0, }; if !feature_version_bounds.check_version(feature_version) { return Ok(QueryValidationResult::new_with_error( @@ -53,12 +47,19 @@ impl Platform { )); } match version { - Version::V0(get_protocol_version_upgrade_vote_status_request) => self - .query_version_upgrade_vote_status_v0( - state, - get_protocol_version_upgrade_vote_status_request, + RequestVersion::V0(request_v0) => { + let result = self.query_version_upgrade_vote_status_v0( + request_v0, + platform_state, platform_version, - ), + )?; + + Ok( + result.map(|response_v0| GetProtocolVersionUpgradeVoteStatusResponse { + version: Some(ResponseVersion::V0(response_v0)), + }), + ) + } } } } diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs index 02eb9debfb1..08b598fb313 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs @@ -1,38 +1,27 @@ use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; use crate::query::QueryValidationResult; -use dapi_grpc::platform::v0::{ - get_protocol_version_upgrade_vote_status_response, GetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeVoteStatusResponse, Proof, -}; use dpp::check_validation_result_with_data; -use dpp::platform_value::Bytes32; -use dpp::serialization::PlatformSerializableWithPlatformVersion; + use dpp::validation::ValidationResult; use dpp::version::PlatformVersion; -use prost::Message; use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::GetProtocolVersionUpgradeVoteStatusRequestV0; use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_response::get_protocol_version_upgrade_vote_status_response_v0::{VersionSignal, VersionSignals}; -use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_response::GetProtocolVersionUpgradeVoteStatusResponseV0; +use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_response::{get_protocol_version_upgrade_vote_status_response_v0, GetProtocolVersionUpgradeVoteStatusResponseV0}; use crate::error::query::QueryError; +use crate::platform_types::platform_state::PlatformState; impl Platform { pub(super) fn query_version_upgrade_vote_status_v0( &self, - state: &PlatformState, - request: GetProtocolVersionUpgradeVoteStatusRequestV0, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; - let GetProtocolVersionUpgradeVoteStatusRequestV0 { + GetProtocolVersionUpgradeVoteStatusRequestV0 { start_pro_tx_hash, count, prove, - } = request; - + }: GetProtocolVersionUpgradeVoteStatusRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { let start_pro_tx_hash: Option<[u8; 32]> = if start_pro_tx_hash.is_empty() { None } else { @@ -55,7 +44,7 @@ impl Platform { )); } - let response_data = if prove { + let response = if prove { let proof = check_validation_result_with_data!(self .drive .fetch_proved_validator_version_votes( @@ -65,26 +54,14 @@ impl Platform { &platform_version.drive )); - GetProtocolVersionUpgradeVoteStatusResponse { - version: Some(get_protocol_version_upgrade_vote_status_response::Version::V0( - GetProtocolVersionUpgradeVoteStatusResponseV0 { - result: Some( - get_protocol_version_upgrade_vote_status_response::get_protocol_version_upgrade_vote_status_response_v0::Result::Proof( - Proof { - grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), - quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), - }, - ), - ), - metadata: Some(metadata), - }, - )), + GetProtocolVersionUpgradeVoteStatusResponseV0 { + result: Some( + get_protocol_version_upgrade_vote_status_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), } - .encode_to_vec() } else { let result = check_validation_result_with_data!(self.drive.fetch_validator_version_votes( @@ -101,22 +78,346 @@ impl Platform { }) .collect(); - GetProtocolVersionUpgradeVoteStatusResponse { - version: Some(get_protocol_version_upgrade_vote_status_response::Version::V0( - GetProtocolVersionUpgradeVoteStatusResponseV0 { - result: Some( - get_protocol_version_upgrade_vote_status_response::get_protocol_version_upgrade_vote_status_response_v0::Result::Versions( - VersionSignals { - version_signals: versions, - }, - ), - ), - metadata: Some(metadata), - }, + GetProtocolVersionUpgradeVoteStatusResponseV0 { + result: Some( + get_protocol_version_upgrade_vote_status_response_v0::Result::Versions( + VersionSignals { + version_signals: versions, + }, + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::query::tests::setup_platform; + use dpp::dashcore::Network; + use drive::drive::protocol_upgrade::{ + desired_version_for_validators_path, desired_version_for_validators_path_vec, + versions_counter_path, + }; + use drive::drive::Drive; + use drive::grovedb::{Element, GroveDb, QueryItem, SizedQuery}; + use drive::query::{PathQuery, Query}; + use drive::util::grove_operations::BatchInsertApplyType; + use drive::util::object_size_info::PathKeyElementInfo; + use integer_encoding::VarInt; + use rand::rngs::StdRng; + use rand::{Rng, SeedableRng}; + + #[test] + fn test_query_empty_upgrade_vote_status() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let mut rand = StdRng::seed_from_u64(10); + + let validator_pro_tx_hash: [u8; 32] = rand.gen(); + + let request = GetProtocolVersionUpgradeVoteStatusRequestV0 { + start_pro_tx_hash: validator_pro_tx_hash.to_vec(), + count: 5, + prove: false, + }; + + let validation_result = platform + .query_version_upgrade_vote_status_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!(validation_result.data, Some( + GetProtocolVersionUpgradeVoteStatusResponseV0 { + result: Some(get_protocol_version_upgrade_vote_status_response_v0::Result::Versions(VersionSignals { version_signals })) , + metadata: Some(_), + } + ) if version_signals.is_empty())); + } + + #[test] + fn test_query_upgrade_vote_status() { + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let mut rand = StdRng::seed_from_u64(10); + + let validator_pro_tx_hash: [u8; 32] = rand.gen(); + + let drive = &platform.drive; + + let version_counter = &mut drive.cache.protocol_versions_counter.write(); + let transaction = drive.grove.start_transaction(); + + version_counter + .load_if_needed(drive, Some(&transaction), &version.drive) + .expect("expected to load version counter"); + + let path = desired_version_for_validators_path(); + let version_bytes = version.protocol_version.encode_var_vec(); + let version_element = Element::new_item(version_bytes.clone()); + + let mut operations = vec![]; + drive + .batch_insert_if_changed_value( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + path, + validator_pro_tx_hash.as_slice(), + version_element, )), + BatchInsertApplyType::StatefulBatchInsert, + Some(&transaction), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + let mut version_count = version_counter + .get(&version.protocol_version) + .expect("expected to get version count") + .cloned() + .unwrap_or_default(); + + version_count += 1; + + version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache + + drive + .batch_insert( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + versions_counter_path(), + version_bytes.as_slice(), + Element::new_item(version_count.encode_var_vec()), + )), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + drive + .apply_batch_low_level_drive_operations( + None, + Some(&transaction), + operations, + &mut vec![], + &version.drive, + ) + .expect("expected to apply operations"); + + drive + .commit_transaction(transaction, &version.drive) + .expect("expected to commit"); + + version_counter.merge_block_cache(); + + let request = GetProtocolVersionUpgradeVoteStatusRequestV0 { + start_pro_tx_hash: validator_pro_tx_hash.to_vec(), + count: 5, + prove: false, + }; + + let validation_result = platform + .query_version_upgrade_vote_status_v0(request, &state, version) + .expect("expected query to succeed"); + + assert!(matches!(validation_result.data, Some( + GetProtocolVersionUpgradeVoteStatusResponseV0 { + result: Some(get_protocol_version_upgrade_vote_status_response_v0::Result::Versions(VersionSignals { version_signals })) , + metadata: Some(_), } - .encode_to_vec() + ) if version_signals.len() == 1)); + } + + #[test] + fn test_prove_empty_upgrade_vote_status() { + let platform_version = PlatformVersion::latest(); + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let mut rand = StdRng::seed_from_u64(10); + + let validator_pro_tx_hash: [u8; 32] = rand.gen(); + + let request = GetProtocolVersionUpgradeVoteStatusRequestV0 { + start_pro_tx_hash: validator_pro_tx_hash.to_vec(), + count: 5, + prove: true, }; - Ok(QueryValidationResult::new_with_data(response_data)) + + let validation_result = platform + .query_version_upgrade_vote_status_v0(request, &state, version) + .expect("expected query to succeed"); + + let Some(GetProtocolVersionUpgradeVoteStatusResponseV0 { + result: Some(get_protocol_version_upgrade_vote_status_response_v0::Result::Proof(proof)), + metadata: Some(_), + }) = validation_result.data + else { + panic!("expected a proof") + }; + + let path = desired_version_for_validators_path_vec(); + + let query_item = QueryItem::RangeFrom(validator_pro_tx_hash.to_vec()..); + + let path_query = PathQuery::new( + path, + SizedQuery::new(Query::new_single_query_item(query_item), Some(5), None), + ); + + let elements = GroveDb::verify_query( + proof.grovedb_proof.as_slice(), + &path_query, + &platform_version.drive.grove_version, + ) + .expect("expected to be able to verify query") + .1; + + // we just started chain, there should be no versions + + assert!(elements.is_empty()) + } + + #[test] + fn test_prove_upgrade_vote_status() { + let platform_version = PlatformVersion::latest(); + let (platform, state, version) = setup_platform(None, Network::Testnet); + + let mut rand = StdRng::seed_from_u64(10); + + let drive = &platform.drive; + + let version_counter = &mut drive.cache.protocol_versions_counter.write(); + + let transaction = drive.grove.start_transaction(); + + version_counter + .load_if_needed(drive, Some(&transaction), &version.drive) + .expect("expected to load version counter"); + + let path = desired_version_for_validators_path(); + let version_bytes = version.protocol_version.encode_var_vec(); + let version_element = Element::new_item(version_bytes.clone()); + + let validator_pro_tx_hash: [u8; 32] = rand.gen(); + + let mut operations = vec![]; + drive + .batch_insert_if_changed_value( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + path, + validator_pro_tx_hash.as_slice(), + version_element, + )), + BatchInsertApplyType::StatefulBatchInsert, + Some(&transaction), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + let mut version_count = version_counter + .get(&version.protocol_version) + .expect("expected to get version count") + .cloned() + .unwrap_or_default(); + + version_count += 1; + + version_counter.set_block_cache_version_count(version.protocol_version, version_count); // push to block_cache + + drive + .batch_insert( + PathKeyElementInfo::PathFixedSizeKeyRefElement(( + versions_counter_path(), + version_bytes.as_slice(), + Element::new_item(version_count.encode_var_vec()), + )), + &mut operations, + &version.drive, + ) + .expect("expected batch to insert"); + + drive + .apply_batch_low_level_drive_operations( + None, + Some(&transaction), + operations, + &mut vec![], + &version.drive, + ) + .expect("expected to apply operations"); + + drive + .commit_transaction(transaction, &version.drive) + .expect("expected to commit"); + + version_counter.merge_block_cache(); + + let request = GetProtocolVersionUpgradeVoteStatusRequestV0 { + start_pro_tx_hash: validator_pro_tx_hash.to_vec(), + count: 5, + prove: true, + }; + + let validation_result = platform + .query_version_upgrade_vote_status_v0(request, &state, version) + .expect("expected query to succeed"); + + let Some(GetProtocolVersionUpgradeVoteStatusResponseV0 { + result: Some(get_protocol_version_upgrade_vote_status_response_v0::Result::Proof(proof)), + metadata: Some(_), + }) = validation_result.data + else { + panic!("expected a proof") + }; + + let path = desired_version_for_validators_path_vec(); + + let query_item = QueryItem::RangeFrom(validator_pro_tx_hash.to_vec()..); + + let path_query = PathQuery::new( + path, + SizedQuery::new(Query::new_single_query_item(query_item), Some(5), None), + ); + + let elements = GroveDb::verify_query( + proof.grovedb_proof.as_slice(), + &path_query, + &platform_version.drive.grove_version, + ) + .expect("expected to be able to verify query") + .1; + + // we just started chain, there should be no versions + + assert_eq!(elements.len(), 1); + + let (_, _, element) = elements.first().unwrap(); + + assert!(element.is_some()); + + let element = element.clone().unwrap(); + + let count_bytes = element.as_item_bytes().expect("expected item bytes"); + + let count = u16::decode_var(count_bytes) + .expect("expected to decode var int") + .0; + + assert_eq!(count, 1); + + let upgrade = Drive::verify_upgrade_vote_status( + proof.grovedb_proof.as_slice(), + Some(validator_pro_tx_hash), + 5, + version, + ) + .expect("expected to verify the upgrade counts") + .1; + + assert_eq!(upgrade.len(), 1); + assert_eq!(upgrade.get(&validator_pro_tx_hash), Some(1).as_ref()); } } diff --git a/packages/rs-drive-abci/src/query/v0/mod.rs b/packages/rs-drive-abci/src/query/v0/mod.rs deleted file mode 100644 index c4588b4cde3..00000000000 --- a/packages/rs-drive-abci/src/query/v0/mod.rs +++ /dev/null @@ -1,454 +0,0 @@ -use crate::error::query::QueryError; -use crate::error::Error; -use crate::platform_types::platform::Platform; - -use crate::query::QueryValidationResult; -use dpp::serialization::{PlatformSerializable, PlatformSerializableWithPlatformVersion}; - -use dpp::version::PlatformVersion; - -impl Platform { - /// Querying - pub(super) fn query_v0( - &self, - query_path: &str, - query_data: &[u8], - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let state = self.state.read().unwrap(); - match query_path { - "/identity" => self.query_identity(&state, query_data, platform_version), - "/identities" => self.query_identities(&state, query_data, platform_version), - "/identity/balance" => self.query_balance(&state, query_data, platform_version), - "/identity/balanceAndRevision" => { - self.query_balance_and_revision(&state, query_data, platform_version) - } - "/identity/keys" => self.query_keys(&state, query_data, platform_version), - "/identity/by-public-key-hash" => { - self.query_identity_by_public_key_hash(&state, query_data, platform_version) - } - "/identities/by-public-key-hash" => { - self.query_identities_by_public_key_hashes(&state, query_data, platform_version) - } - "/dataContract" => self.query_data_contract(&state, query_data, platform_version), - "/dataContracts" => self.query_data_contracts(&state, query_data, platform_version), - "/dataContractHistory" => { - self.query_data_contract_history(&state, query_data, platform_version) - } - "/documents" | "/dataContract/documents" => { - self.query_documents(&state, query_data, platform_version) - } - "/proofs" => self.query_proofs(&state, query_data, platform_version), - "/versionUpgrade/state" => { - self.query_version_upgrade_state(&state, query_data, platform_version) - } - "/versionUpgrade/voteStatus" => { - self.query_version_upgrade_vote_status(&state, query_data, platform_version) - } - "/epochInfos" => self.query_epoch_infos(&state, query_data, platform_version), - other => Ok(QueryValidationResult::new_with_error( - QueryError::InvalidArgument(format!("query path '{}' is not supported", other)), - )), - } - } -} - -#[cfg(test)] -mod test { - pub mod query_data_contract_history { - use crate::rpc::core::MockCoreRPCLike; - use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; - use dapi_grpc::platform::v0::{ - get_data_contract_history_request, get_data_contract_history_response, - GetDataContractHistoryRequest, GetDataContractHistoryResponse, - }; - use dpp::block::block_info::BlockInfo; - - use crate::platform_types::platform_state::v0::PlatformStateV0Methods; - use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::data_contract::config::v0::DataContractConfigSettersV0; - - use crate::error::query::QueryError; - use dapi_grpc::platform::v0::get_data_contract_history_request::GetDataContractHistoryRequestV0; - use dapi_grpc::platform::v0::get_data_contract_history_response::{ - get_data_contract_history_response_v0, GetDataContractHistoryResponseV0, - }; - use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; - use dpp::data_contract::schema::DataContractSchemaMethodsV0; - use dpp::data_contract::DataContract; - use dpp::platform_value::platform_value; - use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; - use dpp::tests::fixtures::get_data_contract_fixture; - use dpp::validation::ValidationResult; - use dpp::version::PlatformVersion; - use drive::drive::Drive; - use prost::Message; - - fn default_request_v0() -> GetDataContractHistoryRequestV0 { - GetDataContractHistoryRequestV0 { - id: vec![1; 32], - limit: Some(10), - offset: Some(0), - start_at_ms: 0, - prove: false, - } - } - - /// Set up simple contract history with one update - fn set_up_history(platform: &TempPlatform) -> DataContract { - let state = platform.platform.state.read().unwrap(); - let current_protocol_version = state.current_protocol_version_in_consensus(); - let platform_version = PlatformVersion::get(current_protocol_version) - .expect("expected to get platform version"); - drop(state); - let mut data_contract = - get_data_contract_fixture(None, current_protocol_version).data_contract_owned(); - data_contract.config_mut().set_keeps_history(true); - data_contract.config_mut().set_readonly(false); - - platform - .drive - .apply_contract( - &data_contract, - BlockInfo { - time_ms: 1000, - height: 10, - core_height: 20, - epoch: Default::default(), - }, - true, - None, - None, - platform_version, - ) - .expect("To apply contract"); - - let mut updated_data_contract = data_contract.clone(); - - let updated_document_schema = platform_value!({ - "type": "object", - "properties": { - "name": { - "type": "string", - "position": 0 - }, - "newProp": { - "type": "integer", - "minimum": 0, - "position": 1 - } - }, - "required": [ - "$createdAt" - ], - "additionalProperties": false - }); - - updated_data_contract - .set_document_schema( - "niceDocument", - updated_document_schema, - true, - platform_version, - ) - .expect("to be able to set document schema"); - - platform - .drive - .apply_contract( - &updated_data_contract, - BlockInfo { - time_ms: 2000, - height: 11, - core_height: 21, - epoch: Default::default(), - }, - true, - None, - None, - platform_version, - ) - .expect("To apply contract"); - - data_contract - } - - struct TestData { - platform: TempPlatform, - original_data_contract: DataContract, - } - - fn set_up_test() -> TestData { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let original_data_contract = set_up_history(&platform); - - TestData { - platform, - original_data_contract, - } - } - - #[test] - pub fn should_return_contract_history_with_no_errors_if_parameters_are_valid() { - let platform_version = PlatformVersion::latest(); - - let TestData { - platform, - original_data_contract, - } = set_up_test(); - - let request = GetDataContractHistoryRequest { - version: Some(get_data_contract_history_request::Version::V0( - GetDataContractHistoryRequestV0 { - id: original_data_contract.id().to_vec(), - ..default_request_v0() - }, - )), - }; - - let request_data = request.encode_to_vec(); - - let result = platform - .query_v0("/dataContractHistory", &request_data, platform_version) - .expect("To return result"); - - let ValidationResult { errors, data } = result; - - assert!( - errors.is_empty(), - "expect no errors to be returned from the query" - ); - - let data = data.expect("expect data to be returned from the query"); - let _data_ref = data.as_slice(); - - let response = GetDataContractHistoryResponse::decode(data.as_slice()) - .expect("To decode response"); - - let GetDataContractHistoryResponse { version } = response; - - let get_data_contract_history_response::Version::V0(GetDataContractHistoryResponseV0 { - result, - metadata: _, - }) = version.expect("expected a versioned response"); - - let res = result.expect("expect result to be returned from the query"); - - let contract_history = match res { - get_data_contract_history_response_v0::Result::DataContractHistory( - data_contract_history, - ) => data_contract_history, - get_data_contract_history_response_v0::Result::Proof(_) => { - panic!("expect result to be DataContractHistory"); - } - }; - - let mut history_entries = contract_history.data_contract_entries; - assert_eq!(history_entries.len(), 2); - - let second_entry = history_entries.pop().unwrap(); - let first_entry = history_entries.pop().unwrap(); - - assert_eq!(first_entry.date, 1000); - let first_entry_data_contract = first_entry.value; - let first_data_contract_update = DataContract::versioned_deserialize( - &first_entry_data_contract, - true, - platform_version, - ) - .expect("To decode data contract"); - assert_eq!(first_data_contract_update, original_data_contract); - - assert_eq!(second_entry.date, 2000); - - let second_entry_data_contract = second_entry.value; - - let second_data_contract_update = DataContract::versioned_deserialize( - &second_entry_data_contract, - true, - platform_version, - ) - .expect("To decode data contract"); - - let updated_doc = second_data_contract_update - .document_type_for_name("niceDocument") - .expect("should return document type"); - - assert!( - updated_doc.properties().contains_key("newProp"), - "expect data contract to have newProp field", - ); - } - - #[test] - pub fn should_return_contract_history_proofs_with_no_errors_if_parameters_are_valid() { - let platform_version = PlatformVersion::latest(); - let TestData { - platform, - original_data_contract, - } = set_up_test(); - - let request_v0 = GetDataContractHistoryRequestV0 { - id: original_data_contract.id().to_vec(), - prove: true, - ..default_request_v0() - }; - - let start_at_ms = request_v0.start_at_ms; - - let request = GetDataContractHistoryRequest { - version: Some(get_data_contract_history_request::Version::V0(request_v0)), - }; - - let request_data = request.encode_to_vec(); - - let result = platform - .query_v0("/dataContractHistory", &request_data, platform_version) - .expect("To return result"); - - let ValidationResult { errors, data } = result; - - assert!( - errors.is_empty(), - "expect no errors to be returned from the query" - ); - - let data = data.expect("expect data to be returned from the query"); - let _data_ref = data.as_slice(); - - let response = GetDataContractHistoryResponse::decode(data.as_slice()) - .expect("To decode response"); - - let GetDataContractHistoryResponse { version } = response; - - let get_data_contract_history_response::Version::V0(GetDataContractHistoryResponseV0 { - result, - metadata: _, - }) = version.expect("expected a versioned response"); - - let res = result.expect("expect result to be returned from the query"); - - let contract_proof = match res { - get_data_contract_history_response_v0::Result::DataContractHistory(_) => { - panic!("expect result to be Proof"); - } - get_data_contract_history_response_v0::Result::Proof(proof) => proof, - }; - - // Check that the proof has correct values inside - let (_root_hash, contract_history) = Drive::verify_contract_history( - &contract_proof.grovedb_proof, - original_data_contract.id().to_buffer(), - start_at_ms, - Some(10), - Some(0), - platform_version, - ) - .expect("To verify contract history"); - - let mut history_entries = contract_history.expect("history to exist"); - - assert_eq!(history_entries.len(), 2); - - // Taking entries by date - let first_data_contract_update = - history_entries.remove(&1000).expect("first entry to exist"); - let second_data_contract_update = history_entries - .remove(&2000) - .expect("second entry to exist"); - - assert_eq!(first_data_contract_update, original_data_contract); - - let updated_doc = second_data_contract_update - .document_type_for_name("niceDocument") - .expect("To have niceDocument document"); - - assert!( - updated_doc.properties().contains_key("newProp"), - "expect data contract to have newProp field", - ); - } - - #[test] - pub fn should_return_error_when_limit_is_larger_than_u16() { - let platform_version = PlatformVersion::latest(); - let TestData { - platform, - original_data_contract, - } = set_up_test(); - - let request = GetDataContractHistoryRequest { - version: Some(get_data_contract_history_request::Version::V0( - GetDataContractHistoryRequestV0 { - id: original_data_contract.id().to_vec(), - limit: Some(100000), - ..default_request_v0() - }, - )), - }; - - let request_data = request.encode_to_vec(); - - let validation_result = platform - .query_v0("/dataContractHistory", &request_data, platform_version) - .expect("To return validation result with an error"); - - assert!(!validation_result.is_valid()); - - let error = validation_result - .errors - .first() - .expect("expect error to exist"); - - assert!(matches!(error, QueryError::InvalidArgument(_))); - - assert_eq!( - error.to_string(), - "invalid argument error: limit out of bounds" - ); - } - - #[test] - pub fn should_return_error_when_offset_is_larger_than_u16() { - let platform_version = PlatformVersion::latest(); - - let TestData { - platform, - original_data_contract, - } = set_up_test(); - - let request = GetDataContractHistoryRequest { - version: Some(get_data_contract_history_request::Version::V0( - GetDataContractHistoryRequestV0 { - id: original_data_contract.id().to_vec(), - offset: Some(100000), - ..default_request_v0() - }, - )), - }; - - let request_data = request.encode_to_vec(); - - let validation_result = platform - .query_v0("/dataContractHistory", &request_data, platform_version) - .expect("To return validation result with an error"); - - assert!(!validation_result.is_valid()); - - let error = validation_result - .errors - .first() - .expect("expect error to exist"); - - assert!(matches!(error, QueryError::InvalidArgument(_))); - - assert_eq!( - error.to_string(), - "invalid argument error: offset out of bounds" - ); - } - } -} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resource_identity_votes/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resource_identity_votes/mod.rs new file mode 100644 index 00000000000..d5d8f687926 --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resource_identity_votes/mod.rs @@ -0,0 +1,67 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_contested_resource_identity_votes_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_contested_resource_identity_votes_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetContestedResourceIdentityVotesRequest, GetContestedResourceIdentityVotesResponse, +}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying of a how an identity voted for a specific contested resource + pub fn query_contested_resource_identity_votes( + &self, + GetContestedResourceIdentityVotesRequest { version }: GetContestedResourceIdentityVotesRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError( + "could not decode contested resource vote state query".to_string(), + ), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .voting_based_queries + .contested_resource_identity_vote_status; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "query_contested_resource_identity_votes".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_contested_resource_identity_votes_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok( + result.map(|response_v0| GetContestedResourceIdentityVotesResponse { + version: Some(ResponseVersion::V0(response_v0)), + }), + ) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resource_identity_votes/v0/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resource_identity_votes/v0/mod.rs new file mode 100644 index 00000000000..52a19d22d1c --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resource_identity_votes/v0/mod.rs @@ -0,0 +1,198 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_contested_resource_identity_votes_request::GetContestedResourceIdentityVotesRequestV0; +use dapi_grpc::platform::v0::get_contested_resource_identity_votes_response::{ + get_contested_resource_identity_votes_response_v0, GetContestedResourceIdentityVotesResponseV0, +}; +use dpp::identifier::Identifier; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::{check_validation_result_with_data, platform_value, ProtocolError}; +use drive::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; +use drive::error::query::QuerySyntaxError; +use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; + +impl Platform { + pub(super) fn query_contested_resource_identity_votes_v0( + &self, + GetContestedResourceIdentityVotesRequestV0 { + identity_id, + limit, + offset, + order_ascending, + start_at_vote_poll_id_info, + prove, + }: GetContestedResourceIdentityVotesRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let config = &self.config.drive; + let identity_id: Identifier = + check_validation_result_with_data!(identity_id.try_into().map_err(|_| { + QueryError::InvalidArgument( + "identity_id must be a valid identifier (32 bytes long)".to_string(), + ) + })); + + let limit = limit + .map_or(Some(config.default_query_limit), |limit_value| { + if limit_value == 0 + || limit_value > u16::MAX as u32 + || limit_value as u16 > config.default_query_limit + { + None + } else { + Some(limit_value as u16) + } + }) + .ok_or(drive::error::Error::Query(QuerySyntaxError::InvalidLimit( + format!("limit greater than max limit {}", config.max_query_limit), + )))?; + + let offset = check_validation_result_with_data!(offset + .map(|offset| { + u16::try_from(offset) + .map_err(|_| QueryError::InvalidArgument("offset out of bounds".to_string())) + }) + .transpose()); + + let query = ContestedResourceVotesGivenByIdentityQuery { + identity_id, + offset, + limit: Some(limit), + start_at: start_at_vote_poll_id_info + .map(|start_at_vote_poll_id_info| { + Ok::<([u8; 32], bool), platform_value::Error>(( + Identifier::from_vec(start_at_vote_poll_id_info.start_at_poll_identifier)? + .to_buffer(), + start_at_vote_poll_id_info.start_poll_identifier_included, + )) + }) + .transpose()?, + order_ascending, + }; + + let response = if prove { + let proof = match query.execute_with_proof(&self.drive, None, None, platform_version) { + Ok(result) => result.0, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + GetContestedResourceIdentityVotesResponseV0 { + result: Some( + get_contested_resource_identity_votes_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let votes = + match query.execute_no_proof(&self.drive, None, &mut vec![], platform_version) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + let finished_results = if votes.len() == limit as usize && limit > 0 { + let start_at = if order_ascending { + votes + .iter() + .next_back() + .map(|(id, _)| (id.to_buffer(), false)) + } else { + votes.iter().next().map(|(id, _)| (id.to_buffer(), false)) + }; + let extra_query = ContestedResourceVotesGivenByIdentityQuery { + identity_id, + offset: None, + limit: Some(1), + start_at, + order_ascending, + }; + let another_result = match extra_query.execute_no_proof( + &self.drive, + None, + &mut vec![], + platform_version, + ) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + another_result.is_empty() + } else { + true + }; + + let contested_resource_identity_votes = votes + .into_values() + .map(|resource_vote| { + let ContestedDocumentResourceVoteStorageForm { + contract_id, document_type_name, index_values, resource_vote_choice + } = resource_vote; + let vote_choice = match resource_vote_choice { + ResourceVoteChoice::TowardsIdentity(towards_identity) => { + get_contested_resource_identity_votes_response_v0::ResourceVoteChoice { + vote_choice_type: 0, + identity_id: Some(towards_identity.to_vec()), + } + } + ResourceVoteChoice::Abstain => { + get_contested_resource_identity_votes_response_v0::ResourceVoteChoice { + vote_choice_type: 1, + identity_id: None, + } + } + ResourceVoteChoice::Lock => { + get_contested_resource_identity_votes_response_v0::ResourceVoteChoice { + vote_choice_type: 2, + identity_id: None, + } + } + }; + Ok(get_contested_resource_identity_votes_response_v0::ContestedResourceIdentityVote { + contract_id: contract_id.to_vec(), + document_type_name, + serialized_index_storage_values: index_values, + vote_choice: Some(vote_choice), + }) + }) + .collect::, + ProtocolError, + >>()?; + + GetContestedResourceIdentityVotesResponseV0 { + result: Some( + get_contested_resource_identity_votes_response_v0::Result::Votes( + get_contested_resource_identity_votes_response_v0::ContestedResourceIdentityVotes { + contested_resource_identity_votes, + finished_results, + }, + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resource_vote_state/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resource_vote_state/mod.rs new file mode 100644 index 00000000000..f72d1c3b8b5 --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resource_vote_state/mod.rs @@ -0,0 +1,68 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetContestedResourceVoteStateRequest, GetContestedResourceVoteStateResponse, +}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying of a contested resource's vote status + /// This basically gives who is winning the vote + pub fn query_contested_resource_vote_state( + &self, + GetContestedResourceVoteStateRequest { version }: GetContestedResourceVoteStateRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError( + "could not decode contested resource vote state query".to_string(), + ), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .voting_based_queries + .contested_resource_vote_state; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "contested_resource_vote_state".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_contested_resource_vote_state_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok( + result.map(|response_v0| GetContestedResourceVoteStateResponse { + version: Some(ResponseVersion::V0(response_v0)), + }), + ) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resource_vote_state/v0/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resource_vote_state/v0/mod.rs new file mode 100644 index 00000000000..c61800dd49a --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resource_vote_state/v0/mod.rs @@ -0,0 +1,258 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::GetContestedResourceVoteStateRequestV0; +use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::{ + get_contested_resource_vote_state_response_v0, GetContestedResourceVoteStateResponseV0, +}; +use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::finished_vote_info::FinishedVoteOutcome; +use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::FinishedVoteInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use dpp::{check_validation_result_with_data, platform_value}; +use dpp::voting::contender_structs::{ContenderWithSerializedDocument, ContenderWithSerializedDocumentV0}; +use dpp::voting::vote_info_storage::contested_document_vote_poll_winner_info::ContestedDocumentVotePollWinnerInfo; +use drive::error::query::QuerySyntaxError; +use drive::query::vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, +}; + +impl Platform { + pub(super) fn query_contested_resource_vote_state_v0( + &self, + GetContestedResourceVoteStateRequestV0 { + contract_id, + document_type_name, + index_name, + index_values, + result_type, + allow_include_locked_and_abstaining_vote_tally, + start_at_identifier_info, + count, + prove, + }: GetContestedResourceVoteStateRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let config = &self.config.drive; + let contract_id: Identifier = + check_validation_result_with_data!(contract_id.try_into().map_err(|_| { + QueryError::InvalidArgument( + "contract_id must be a valid identifier (32 bytes long)".to_string(), + ) + })); + + let (_, contract) = self.drive.get_contract_with_fetch_info_and_fee( + contract_id.to_buffer(), + None, + true, + None, + platform_version, + )?; + + let contract = check_validation_result_with_data!(contract.ok_or(QueryError::Query( + QuerySyntaxError::DataContractNotFound( + "contract not found when querying from value with contract info", + ) + ))); + + let contract_ref = &contract.contract; + + let document_type = check_validation_result_with_data!(contract_ref + .document_type_for_name(document_type_name.as_str()) + .map_err(|_| QueryError::InvalidArgument(format!( + "document type {} not found for contract {}", + document_type_name, contract_id + )))); + + let index = check_validation_result_with_data!(document_type.find_contested_index().ok_or( + QueryError::InvalidArgument(format!( + "document type {} does not have a contested index", + document_type_name + )) + )); + + if index.name != index_name { + return Ok(QueryValidationResult::new_with_error(QueryError::InvalidArgument(format!( + "index with name {} is not the contested index on the document type {}, {} is the name of the only contested index", + index_name, document_type_name, index.name + )))); + } + + if index.properties.len() != index_values.len() { + return Ok(QueryValidationResult::new_with_error(QueryError::InvalidArgument(format!( + "query uses index {}, this index has {} properties, but the query provided {} index values instead", + index_name, index.properties.len(), index_values.len() + )))); + } + + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let index_values = match index_values + .into_iter() + .enumerate() + .map(|(pos, serialized_value)| { + Ok( + bincode::decode_from_slice(serialized_value.as_slice(), bincode_config) + .map_err(|_| { + QueryError::InvalidArgument(format!( + "could not convert {:?} to a value in the index values at position {}", + serialized_value, pos + )) + })? + .0, + ) + }) + .collect::, QueryError>>() + { + Ok(index_values) => index_values, + Err(e) => return Ok(QueryValidationResult::new_with_error(e)), + }; + + let vote_poll = ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + }; + + let limit = check_validation_result_with_data!(count.map_or( + Ok(config.default_query_limit), + |limit| { + let limit = u16::try_from(limit) + .map_err(|_| QueryError::InvalidArgument("limit out of bounds".to_string()))?; + if limit == 0 || limit > config.default_query_limit { + Err(QueryError::InvalidArgument(format!( + "limit {} out of bounds of [1, {}]", + limit, config.default_query_limit + ))) + } else { + Ok(limit) + } + } + )); + + let query = ContestedDocumentVotePollDriveQuery { + vote_poll, + result_type: result_type.try_into()?, + offset: None, + limit: Some(limit), + start_at: start_at_identifier_info + .map(|start_at_identifier_info| { + Ok::<([u8; 32], bool), platform_value::Error>(( + Identifier::from_vec(start_at_identifier_info.start_identifier)? + .to_buffer(), + start_at_identifier_info.start_identifier_included, + )) + }) + .transpose()?, + allow_include_locked_and_abstaining_vote_tally, + }; + + let response = if prove { + let proof = match query.execute_with_proof(&self.drive, None, None, platform_version) { + Ok(result) => result.0, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + GetContestedResourceVoteStateResponseV0 { + result: Some( + get_contested_resource_vote_state_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let results = + match query.execute_no_proof(&self.drive, None, &mut vec![], platform_version) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + let abstain_vote_tally = results.abstaining_vote_tally; + let lock_vote_tally = results.locked_vote_tally; + let finished_vote_info = + results + .winner + .map(|(winner_info, finished_at_block_info)| match winner_info { + ContestedDocumentVotePollWinnerInfo::NoWinner => FinishedVoteInfo { + finished_vote_outcome: FinishedVoteOutcome::NoPreviousWinner as i32, + won_by_identity_id: None, + finished_at_block_height: finished_at_block_info.height, + finished_at_core_block_height: finished_at_block_info.core_height, + finished_at_block_time_ms: finished_at_block_info.time_ms, + finished_at_epoch: finished_at_block_info.epoch.index as u32, + }, + ContestedDocumentVotePollWinnerInfo::WonByIdentity(identity_id) => { + FinishedVoteInfo { + finished_vote_outcome: FinishedVoteOutcome::TowardsIdentity as i32, + won_by_identity_id: Some(identity_id.to_vec()), + finished_at_block_height: finished_at_block_info.height, + finished_at_core_block_height: finished_at_block_info.core_height, + finished_at_block_time_ms: finished_at_block_info.time_ms, + finished_at_epoch: finished_at_block_info.epoch.index as u32, + } + } + ContestedDocumentVotePollWinnerInfo::Locked => FinishedVoteInfo { + finished_vote_outcome: FinishedVoteOutcome::Locked as i32, + won_by_identity_id: None, + finished_at_block_height: finished_at_block_info.height, + finished_at_core_block_height: finished_at_block_info.core_height, + finished_at_block_time_ms: finished_at_block_info.time_ms, + finished_at_epoch: finished_at_block_info.epoch.index as u32, + }, + }); + + let contenders = results + .contenders + .into_iter() + .map(|contender| match contender { + ContenderWithSerializedDocument::V0(ContenderWithSerializedDocumentV0 { + identity_id, + serialized_document, + vote_tally, + }) => get_contested_resource_vote_state_response_v0::Contender { + identifier: identity_id.to_vec(), + vote_count: vote_tally, + document: serialized_document, + }, + }) + .collect(); + + GetContestedResourceVoteStateResponseV0 { + result: Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + }, + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resource_voters_for_identity/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resource_voters_for_identity/mod.rs new file mode 100644 index 00000000000..98039a5d3d7 --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resource_voters_for_identity/mod.rs @@ -0,0 +1,67 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{ + GetContestedResourceVotersForIdentityRequest, GetContestedResourceVotersForIdentityResponse, +}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying of a how an identity voted for a specific contested resource + pub fn query_contested_resource_voters_for_identity( + &self, + GetContestedResourceVotersForIdentityRequest { version }: GetContestedResourceVotersForIdentityRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError( + "could not decode contested resource vote state query".to_string(), + ), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .voting_based_queries + .contested_resource_voters_for_identity; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "query_contested_resource_voters_for_identity".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_contested_resource_voters_for_identity_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok(result.map( + |response_v0| GetContestedResourceVotersForIdentityResponse { + version: Some(ResponseVersion::V0(response_v0)), + }, + )) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resource_voters_for_identity/v0/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resource_voters_for_identity/v0/mod.rs new file mode 100644 index 00000000000..b1f36702659 --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resource_voters_for_identity/v0/mod.rs @@ -0,0 +1,248 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_request::GetContestedResourceVotersForIdentityRequestV0; +use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_response::{ + get_contested_resource_voters_for_identity_response_v0, + GetContestedResourceVotersForIdentityResponseV0, +}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use dpp::{check_validation_result_with_data, platform_value}; +use drive::error::query::QuerySyntaxError; +use drive::query::vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery; + +impl Platform { + pub(super) fn query_contested_resource_voters_for_identity_v0( + &self, + GetContestedResourceVotersForIdentityRequestV0 { + contract_id, + document_type_name, + index_name, + index_values, + contestant_id, + start_at_identifier_info, + count, + order_ascending, + prove, + }: GetContestedResourceVotersForIdentityRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let config = &self.config.drive; + let contract_id: Identifier = + check_validation_result_with_data!(contract_id.try_into().map_err(|_| { + QueryError::InvalidArgument( + "contract_id must be a valid identifier (32 bytes long)".to_string(), + ) + })); + + let contestant_id: Identifier = + check_validation_result_with_data!(contestant_id.try_into().map_err(|_| { + QueryError::InvalidArgument( + "voter_id must be a valid identifier (32 bytes long)".to_string(), + ) + })); + + let (_, contract) = self.drive.get_contract_with_fetch_info_and_fee( + contract_id.to_buffer(), + None, + true, + None, + platform_version, + )?; + + let contract = check_validation_result_with_data!(contract.ok_or(QueryError::Query( + QuerySyntaxError::DataContractNotFound( + "contract not found when querying from value with contract info", + ) + ))); + + let contract_ref = &contract.contract; + + let document_type = check_validation_result_with_data!(contract_ref + .document_type_for_name(document_type_name.as_str()) + .map_err(|_| QueryError::InvalidArgument(format!( + "document type {} not found for contract {}", + document_type_name, contract_id + )))); + + let index = check_validation_result_with_data!(document_type.find_contested_index().ok_or( + QueryError::InvalidArgument(format!( + "document type {} does not have a contested index", + document_type_name + )) + )); + + if &index.name != &index_name { + return Ok(QueryValidationResult::new_with_error(QueryError::InvalidArgument(format!( + "index with name {} is not the contested index on the document type {}, {} is the name of the only contested index", + index_name, document_type_name, index.name + )))); + } + + let index_values = match index_values + .into_iter() + .enumerate() + .map(|(pos, serialized_value)| { + Ok(bincode::decode_from_slice( + serialized_value.as_slice(), + bincode::config::standard() + .with_big_endian() + .with_no_limit(), + ) + .map_err(|_| { + QueryError::InvalidArgument(format!( + "could not convert {:?} to a value in the index values at position {}", + serialized_value, pos + )) + })? + .0) + }) + .collect::, QueryError>>() + { + Ok(index_values) => index_values, + Err(e) => return Ok(QueryValidationResult::new_with_error(e)), + }; + + let vote_poll = ContestedDocumentResourceVotePoll { + contract_id, + document_type_name, + index_name, + index_values, + }; + + let limit = check_validation_result_with_data!(count.map_or( + Ok(config.default_query_limit), + |limit| { + let limit = u16::try_from(limit) + .map_err(|_| QueryError::InvalidArgument("limit out of bounds".to_string()))?; + if limit == 0 || limit > config.default_query_limit { + Err(QueryError::InvalidArgument(format!( + "limit {} out of bounds of [1, {}]", + limit, config.default_query_limit + ))) + } else { + Ok(limit) + } + } + )); + + let response = if prove { + let query = ContestedDocumentVotePollVotesDriveQuery { + vote_poll, + contestant_id, + offset: None, + limit: Some(limit), + start_at: start_at_identifier_info + .map(|start_at_identifier_info| { + Ok::<([u8; 32], bool), platform_value::Error>(( + Identifier::from_vec(start_at_identifier_info.start_identifier)? + .to_buffer(), + start_at_identifier_info.start_identifier_included, + )) + }) + .transpose()?, + order_ascending, + }; + + let proof = match query.execute_with_proof(&self.drive, None, None, platform_version) { + Ok(result) => result.0, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + GetContestedResourceVotersForIdentityResponseV0 { + result: Some( + get_contested_resource_voters_for_identity_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let query = ContestedDocumentVotePollVotesDriveQuery { + vote_poll: vote_poll.clone(), + contestant_id, + offset: None, + limit: Some(limit), + start_at: start_at_identifier_info + .clone() + .map(|start_at_identifier_info| { + Ok::<([u8; 32], bool), platform_value::Error>(( + Identifier::from_vec(start_at_identifier_info.start_identifier)? + .to_buffer(), + start_at_identifier_info.start_identifier_included, + )) + }) + .transpose()?, + order_ascending, + }; + + let voters = + match query.execute_no_proof(&self.drive, None, &mut vec![], platform_version) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + let finished_results = if voters.len() == limit as usize && limit > 0 { + let extra_query = ContestedDocumentVotePollVotesDriveQuery { + vote_poll, + contestant_id, + offset: None, + limit: Some(1), + start_at: Some((voters.last().unwrap().to_buffer(), false)), + order_ascending, + }; + let another_result = match extra_query.execute_no_proof( + &self.drive, + None, + &mut vec![], + platform_version, + ) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + another_result.is_empty() + } else { + true + }; + + let voters = voters.into_iter().map(|voter| voter.to_vec()).collect(); + + GetContestedResourceVotersForIdentityResponseV0 { + result: Some( + get_contested_resource_voters_for_identity_response_v0::Result::ContestedResourceVoters( + get_contested_resource_voters_for_identity_response_v0::ContestedResourceVoters { + voters, + finished_results, + }, + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resources/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resources/mod.rs new file mode 100644 index 00000000000..97de6da6745 --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resources/mod.rs @@ -0,0 +1,63 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_contested_resources_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_contested_resources_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetContestedResourcesRequest, GetContestedResourcesResponse}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying of the contested resources + pub fn query_contested_resources( + &self, + GetContestedResourcesRequest { version }: GetContestedResourcesRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError( + "could not decode contested resource vote state query".to_string(), + ), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .voting_based_queries + .contested_resources; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "query_contested_resources".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_contested_resources_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok(result.map(|response_v0| GetContestedResourcesResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/voting/contested_resources/v0/mod.rs b/packages/rs-drive-abci/src/query/voting/contested_resources/v0/mod.rs new file mode 100644 index 00000000000..d61cfb24e7a --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/contested_resources/v0/mod.rs @@ -0,0 +1,235 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use bincode::error::EncodeError; +use dapi_grpc::platform::v0::get_contested_resources_request::GetContestedResourcesRequestV0; +use dapi_grpc::platform::v0::get_contested_resources_response::get_contested_resources_response_v0; +use dapi_grpc::platform::v0::get_contested_resources_response::GetContestedResourcesResponseV0; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::platform_value::Value; +use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; +use dpp::{check_validation_result_with_data, ProtocolError}; +use drive::error::query::QuerySyntaxError; +use drive::query::vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery; + +impl Platform { + pub(super) fn query_contested_resources_v0( + &self, + GetContestedResourcesRequestV0 { + contract_id, + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value_info, + count, + order_ascending, + prove, + }: GetContestedResourcesRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let config = &self.config.drive; + let contract_id: Identifier = + check_validation_result_with_data!(contract_id.try_into().map_err(|_| { + QueryError::InvalidArgument( + "contract_id must be a valid identifier (32 bytes long) (contested resources query)".to_string(), + ) + })); + + let (_, contract) = self.drive.get_contract_with_fetch_info_and_fee( + contract_id.to_buffer(), + None, + true, + None, + platform_version, + )?; + + let contract = check_validation_result_with_data!(contract.ok_or(QueryError::Query( + QuerySyntaxError::DataContractNotFound( + "contract not found when querying from value with contract info (contested resources query)", + ) + ))); + + let contract_ref = &contract.contract; + + let document_type = check_validation_result_with_data!(contract_ref + .document_type_for_name(document_type_name.as_str()) + .map_err(|_| QueryError::InvalidArgument(format!( + "document type {} not found for contract {} (contested resources query)", + document_type_name, contract_id + )))); + + let index = check_validation_result_with_data!(document_type.find_contested_index().ok_or( + QueryError::InvalidArgument(format!( + "document type {} does not have a contested index (contested resources query)", + document_type_name + )) + )); + + if index.name != index_name { + return Ok(QueryValidationResult::new_with_error(QueryError::InvalidArgument(format!( + "index with name {} is not the contested index on the document type {}, {} is the name of the only contested index (contested resources query)", + index_name, document_type_name, index.name + )))); + } + + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let start_index_values = match start_index_values + .into_iter() + .enumerate() + .map(|(pos, serialized_value)| { + Ok(bincode::decode_from_slice( + serialized_value.as_slice(), + bincode_config, + ) + .map_err(|_| { + QueryError::InvalidArgument(format!( + "could not convert {:?} to a value in the start index values at position {}", + serialized_value, pos + )) + })? + .0) + }) + .collect::, QueryError>>() + { + Ok(index_values) => index_values, + Err(e) => return Ok(QueryValidationResult::new_with_error(e)), + }; + + let end_index_values = match end_index_values + .into_iter() + .enumerate() + .map(|(pos, serialized_value)| { + Ok(bincode::decode_from_slice( + serialized_value.as_slice(), + bincode_config, + ) + .map_err(|_| { + QueryError::InvalidArgument(format!( + "could not convert {:?} to a value in the end index values at position {}", + serialized_value, pos + start_index_values.len() + 1 + )) + })? + .0) + }) + .collect::, QueryError>>() + { + Ok(index_values) => index_values, + Err(e) => return Ok(QueryValidationResult::new_with_error(e)), + }; + + let limit = check_validation_result_with_data!(count.map_or( + Ok(config.default_query_limit), + |limit| { + let limit = u16::try_from(limit) + .map_err(|_| QueryError::InvalidArgument("limit out of bounds".to_string()))?; + if limit == 0 || limit > config.default_query_limit { + Err(QueryError::InvalidArgument(format!( + "limit {} out of bounds of [1, {}]", + limit, config.default_query_limit + ))) + } else { + Ok(limit) + } + } + )); + + let result = start_at_value_info + .map(|start_at_value_info| { + let start = bincode::decode_from_slice( + start_at_value_info.start_value.as_slice(), + bincode_config, + ) + .map_err(|_| { + QueryError::InvalidArgument(format!( + "could not convert {:?} to a value for start at", + start_at_value_info.start_value + )) + })? + .0; + + Ok::<(dpp::platform_value::Value, bool), QueryError>(( + start, + start_at_value_info.start_value_included, + )) + }) + .transpose(); + + let start_at_value_info = match result { + Ok(start_at_value_info) => start_at_value_info, + Err(e) => return Ok(QueryValidationResult::new_with_error(e)), + }; + + let query = VotePollsByDocumentTypeQuery { + contract_id, + document_type_name, + index_name, + start_index_values, + end_index_values, + start_at_value: start_at_value_info, + limit: Some(limit), + order_ascending, + }; + + let response = if prove { + let proof = + match query.execute_with_proof(&self.drive, None, &mut vec![], platform_version) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + GetContestedResourcesResponseV0 { + result: Some(get_contested_resources_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let results = + match query.execute_no_proof(&self.drive, None, &mut vec![], platform_version) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + let contested_resource_values = results + .into_iter() + .map(|value| bincode::encode_to_vec(value, bincode_config)) + .collect::>, EncodeError>>() + .map_err(|e| { + Error::Protocol(ProtocolError::CorruptedSerialization(e.to_string())) + })?; + + GetContestedResourcesResponseV0 { + result: Some( + get_contested_resources_response_v0::Result::ContestedResourceValues( + get_contested_resources_response_v0::ContestedResourceValues { + contested_resource_values, + }, + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} diff --git a/packages/rs-drive-abci/src/query/voting/mod.rs b/packages/rs-drive-abci/src/query/voting/mod.rs new file mode 100644 index 00000000000..e0beb4cb748 --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/mod.rs @@ -0,0 +1,5 @@ +mod contested_resource_identity_votes; +mod contested_resource_vote_state; +mod contested_resource_voters_for_identity; +mod contested_resources; +mod vote_polls_by_end_date_query; diff --git a/packages/rs-drive-abci/src/query/voting/vote_polls_by_end_date_query/mod.rs b/packages/rs-drive-abci/src/query/voting/vote_polls_by_end_date_query/mod.rs new file mode 100644 index 00000000000..08672504eaa --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/vote_polls_by_end_date_query/mod.rs @@ -0,0 +1,64 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_vote_polls_by_end_date_request::Version as RequestVersion; +use dapi_grpc::platform::v0::get_vote_polls_by_end_date_response::Version as ResponseVersion; +use dapi_grpc::platform::v0::{GetVotePollsByEndDateRequest, GetVotePollsByEndDateResponse}; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform { + /// Querying of the contested vote polls by a query targeting the end date + /// This is for querying what votes are ending soon, but can be for other time based queries + pub fn query_vote_polls_by_end_date_query( + &self, + GetVotePollsByEndDateRequest { version }: GetVotePollsByEndDateRequest, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let Some(version) = version else { + return Ok(QueryValidationResult::new_with_error( + QueryError::DecodingError( + "could not decode contested vote polls by end date query".to_string(), + ), + )); + }; + + let feature_version_bounds = &platform_version + .drive_abci + .query + .voting_based_queries + .vote_polls_by_end_date_query; + + let feature_version = match &version { + RequestVersion::V0(_) => 0, + }; + if !feature_version_bounds.check_version(feature_version) { + return Ok(QueryValidationResult::new_with_error( + QueryError::UnsupportedQueryVersion( + "vote_polls_by_end_date_query".to_string(), + feature_version_bounds.min_version, + feature_version_bounds.max_version, + platform_version.protocol_version, + feature_version, + ), + )); + } + match version { + RequestVersion::V0(request_v0) => { + let result = self.query_vote_polls_by_end_date_query_v0( + request_v0, + platform_state, + platform_version, + )?; + + Ok(result.map(|response_v0| GetVotePollsByEndDateResponse { + version: Some(ResponseVersion::V0(response_v0)), + })) + } + } + } +} diff --git a/packages/rs-drive-abci/src/query/voting/vote_polls_by_end_date_query/v0/mod.rs b/packages/rs-drive-abci/src/query/voting/vote_polls_by_end_date_query/v0/mod.rs new file mode 100644 index 00000000000..b7f034533c3 --- /dev/null +++ b/packages/rs-drive-abci/src/query/voting/vote_polls_by_end_date_query/v0/mod.rs @@ -0,0 +1,215 @@ +use crate::error::query::QueryError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::query::QueryValidationResult; +use dapi_grpc::platform::v0::get_vote_polls_by_end_date_request::GetVotePollsByEndDateRequestV0; +use dapi_grpc::platform::v0::get_vote_polls_by_end_date_response::{get_vote_polls_by_end_date_response_v0, GetVotePollsByEndDateResponseV0}; +use dapi_grpc::platform::v0::get_vote_polls_by_end_date_response::get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamp; +use dpp::check_validation_result_with_data; +use dpp::version::PlatformVersion; +use dpp::validation::ValidationResult; + +use drive::error::query::QuerySyntaxError; +use drive::query::VotePollsByEndDateDriveQuery; + +impl Platform { + pub(super) fn query_vote_polls_by_end_date_query_v0( + &self, + GetVotePollsByEndDateRequestV0 { + start_time_info, + end_time_info, + limit, + offset, + ascending, + prove, + }: GetVotePollsByEndDateRequestV0, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let config = &self.config.drive; + + let start_time = start_time_info.map(|start_time_info| { + ( + start_time_info.start_time_ms, + start_time_info.start_time_included, + ) + }); + + let end_time = end_time_info + .map(|end_time_info| (end_time_info.end_time_ms, end_time_info.end_time_included)); + + if let ( + Some((start_time_ms, start_time_included)), + Some((end_time_ms, end_time_included)), + ) = (start_time, end_time) + { + if start_time_ms > end_time_ms { + return Ok(QueryValidationResult::new_with_error( + QueryError::InvalidArgument(format!( + "start time {} must be before end time {}", + start_time_ms, end_time_ms + )), + )); + } + if start_time_ms == end_time_ms && (!start_time_included || !end_time_included) { + return Ok(QueryValidationResult::new_with_error(QueryError::InvalidArgument("if start time is equal to end time the start and end times must be included".to_string()))); + } + }; + + let limit = check_validation_result_with_data!(limit.map_or( + Ok(config.default_query_limit), + |limit| { + let limit = u16::try_from(limit) + .map_err(|_| QueryError::InvalidArgument("limit out of bounds".to_string()))?; + if limit == 0 || limit > config.default_query_limit { + Err(QueryError::InvalidArgument(format!( + "limit {} out of bounds of [1, {}]", + limit, config.default_query_limit + ))) + } else { + Ok(limit) + } + } + )); + + let offset = check_validation_result_with_data!(offset + .map(|offset| { + u16::try_from(offset) + .map_err(|_| QueryError::InvalidArgument("offset out of bounds".to_string())) + }) + .transpose()); + + if prove && offset.is_some() && offset != Some(0) { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + QuerySyntaxError::RequestingProofWithOffset(format!( + "requesting proved contested vote polls by end date with an offset {}", + offset.unwrap() + )), + ))); + } + + let query = VotePollsByEndDateDriveQuery { + start_time, + limit: Some(limit), + offset, + order_ascending: ascending, + end_time, + }; + + let response = if prove { + let proof = match query.execute_with_proof(&self.drive, None, None, platform_version) { + Ok(result) => result.0, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + GetVotePollsByEndDateResponseV0 { + result: Some(get_vote_polls_by_end_date_response_v0::Result::Proof( + self.response_proof_v0(platform_state, proof), + )), + metadata: Some(self.response_metadata_v0(platform_state)), + } + } else { + let results = match query.execute_no_proof_keep_serialized( + &self.drive, + None, + &mut vec![], + platform_version, + ) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + + let (vote_polls_by_timestamps, counts): ( + Vec, + Vec, + ) = if query.order_ascending { + results + .into_iter() + .map(|(timestamp, contested_document_resource_vote_polls)| { + let len = contested_document_resource_vote_polls.len(); + ( + SerializedVotePollsByTimestamp { + timestamp, + serialized_vote_polls: contested_document_resource_vote_polls, + }, + len, + ) + }) + .unzip() + } else { + results + .into_iter() + .rev() + .map(|(timestamp, contested_document_resource_vote_polls)| { + let len = contested_document_resource_vote_polls.len(); + ( + SerializedVotePollsByTimestamp { + timestamp, + serialized_vote_polls: contested_document_resource_vote_polls, + }, + len, + ) + }) + .unzip() + }; + + let count: usize = counts.into_iter().sum(); + + let finished_results = if count as u16 == limit { + let last = vote_polls_by_timestamps + .last() + .expect("there should be a last one if count exists"); + let next_query = VotePollsByEndDateDriveQuery { + start_time: Some((last.timestamp, false)), + limit: Some(1), + offset: None, + order_ascending: ascending, + end_time, + }; + + let next_query_results = match next_query.execute_no_proof_keep_serialized( + &self.drive, + None, + &mut vec![], + platform_version, + ) { + Ok(result) => result, + Err(drive::error::Error::Query(query_error)) => { + return Ok(QueryValidationResult::new_with_error(QueryError::Query( + query_error, + ))); + } + Err(e) => return Err(e.into()), + }; + next_query_results.len() == 0 + } else { + true + }; + + GetVotePollsByEndDateResponseV0 { + result: Some( + get_vote_polls_by_end_date_response_v0::Result::VotePollsByTimestamps( + get_vote_polls_by_end_date_response_v0::SerializedVotePollsByTimestamps { + vote_polls_by_timestamps, + finished_results, + }, + ), + ), + metadata: Some(self.response_metadata_v0(platform_state)), + } + }; + + Ok(QueryValidationResult::new_with_data(response)) + } +} diff --git a/packages/rs-drive-abci/src/rpc/core.rs b/packages/rs-drive-abci/src/rpc/core.rs index ab0c9b59a5f..46e16a2e0b9 100644 --- a/packages/rs-drive-abci/src/rpc/core.rs +++ b/packages/rs-drive-abci/src/rpc/core.rs @@ -1,17 +1,16 @@ use dashcore_rpc::dashcore::ephemerealdata::chain_lock::ChainLock; use dashcore_rpc::dashcore::{Block, BlockHash, QuorumHash, Transaction, Txid}; use dashcore_rpc::dashcore_rpc_json::{ - ExtendedQuorumDetails, ExtendedQuorumListResult, GetBestChainLockResult, GetChainTipsResult, - GetTransactionLockedResult, MasternodeListDiff, MnSyncStatus, QuorumInfoResult, QuorumType, - SoftforkInfo, + AssetUnlockStatusResult, ExtendedQuorumDetails, ExtendedQuorumListResult, GetChainTipsResult, + MasternodeListDiff, MnSyncStatus, QuorumInfoResult, QuorumType, SoftforkInfo, }; use dashcore_rpc::json::GetRawTransactionResult; use dashcore_rpc::{Auth, Client, Error, RpcApi}; -use dpp::dashcore::{hashes::Hash, InstantLock}; +use dpp::dashcore::{Header, InstantLock}; +use dpp::prelude::TimestampMillis; use serde_json::Value; use std::collections::HashMap; use std::time::Duration; -use tenderdash_abci::proto::types::CoreChainLock; /// Information returned by QuorumListExtended pub type QuorumListExtendedInfo = HashMap; @@ -25,16 +24,26 @@ pub trait CoreRPCLike { fn get_block_hash(&self, height: CoreHeight) -> Result; /// Get block hash by height - fn get_best_chain_lock(&self) -> Result; + fn get_block_header(&self, block_hash: &BlockHash) -> Result; + + /// Get block time of a chain locked core height + fn get_block_time_from_height(&self, height: CoreHeight) -> Result; + + /// Get the best chain lock + fn get_best_chain_lock(&self) -> Result; + + /// Submit a chain lock + fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result; /// Get transaction fn get_transaction(&self, tx_id: &Txid) -> Result; - /// Get transaction finalization status - fn get_transactions_are_chain_locked( + /// Get asset unlock statuses + fn get_asset_unlock_statuses( &self, - tx_ids: Vec, - ) -> Result, Error>; + indices: &[u64], + core_chain_locked_height: u32, + ) -> Result, Error>; /// Get transaction fn get_transaction_extended_info(&self, tx_id: &Txid) @@ -109,16 +118,13 @@ pub trait CoreRPCLike { ) -> Result; /// Verify a chain lock signature - /// If `max_height` is provided the chain lock will be verified - /// against quorums available at this height - fn verify_chain_lock( - &self, - chain_lock: &ChainLock, - max_height: Option, - ) -> Result; + fn verify_chain_lock(&self, chain_lock: &ChainLock) -> Result; /// Returns masternode sync status fn masternode_sync_status(&self) -> Result; + + /// Sends raw transaction to the network + fn send_raw_transaction(&self, transaction: &[u8]) -> Result; } #[derive(Debug)] @@ -127,6 +133,12 @@ pub struct DefaultCoreRPC { inner: Client, } +// TODO: Create errors for these error codes in dashcore_rpc + +/// TX is invalid due to consensus rules +pub const CORE_RPC_TX_CONSENSUS_ERROR: i32 = -26; +/// Tx already broadcasted and included in the chain +pub const CORE_RPC_TX_ALREADY_IN_CHAIN: i32 = -27; /// Client still warming up pub const CORE_RPC_ERROR_IN_WARMUP: i32 = -28; /// Dash is not connected @@ -140,6 +152,11 @@ pub const CORE_RPC_INVALID_ADDRESS_OR_KEY: i32 = -5; /// Invalid, missing or duplicate parameter pub const CORE_RPC_INVALID_PARAMETER: i32 = -8; +/// Asset Unlock consenus error "bad-assetunlock-not-active-quorum" +pub const CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM: &str = "bad-assetunlock-not-active-quorum"; +/// Asset Unlock consenus error "bad-assetunlock-not-active-quorum" +pub const CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED: &str = "bad-assetunlock-too-late"; + macro_rules! retry { ($action:expr) => {{ /// Maximum number of retry attempts @@ -202,30 +219,27 @@ impl CoreRPCLike for DefaultCoreRPC { retry!(self.inner.get_block_hash(height)) } - fn get_best_chain_lock(&self) -> Result { - //no need to retry on this one - let GetBestChainLockResult { - blockhash, - height, - signature, - known_block: _, - } = self.inner.get_best_chain_lock()?; - Ok(CoreChainLock { - core_block_height: height, - core_block_hash: blockhash.to_byte_array().to_vec(), - signature, - }) + fn get_block_header(&self, block_hash: &BlockHash) -> Result { + retry!(self.inner.get_block_header(block_hash)) } - fn get_transaction(&self, tx_id: &Txid) -> Result { - retry!(self.inner.get_raw_transaction(tx_id, None)) + fn get_block_time_from_height(&self, height: CoreHeight) -> Result { + let block_hash = self.get_block_hash(height)?; + let block_header = self.get_block_header(&block_hash)?; + let block_time = block_header.time as u64 * 1000; + Ok(block_time) } - fn get_transactions_are_chain_locked( - &self, - tx_ids: Vec, - ) -> Result, Error> { - retry!(self.inner.get_transaction_are_locked(&tx_ids)) + fn get_best_chain_lock(&self) -> Result { + retry!(self.inner.get_best_chain_lock()) + } + + fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result { + retry!(self.inner.submit_chain_lock(chain_lock)) + } + + fn get_transaction(&self, tx_id: &Txid) -> Result { + retry!(self.inner.get_raw_transaction(tx_id, None)) } fn get_transaction_extended_info( @@ -300,23 +314,33 @@ impl CoreRPCLike for DefaultCoreRPC { } /// Verify a chain lock signature - /// If `max_height` is provided the chain lock will be verified - /// against quorums available at this height - fn verify_chain_lock( - &self, - chain_lock: &ChainLock, - max_height: Option, - ) -> Result { + fn verify_chain_lock(&self, chain_lock: &ChainLock) -> Result { let block_hash = chain_lock.block_hash.to_string(); let signature = hex::encode(chain_lock.signature); - retry!(self - .inner - .get_verifychainlock(block_hash.as_str(), &signature, max_height)) + retry!(self.inner.get_verifychainlock( + block_hash.as_str(), + &signature, + Some(chain_lock.block_height) + )) } /// Returns masternode sync status fn masternode_sync_status(&self) -> Result { retry!(self.inner.mnsync_status()) } + + fn send_raw_transaction(&self, transaction: &[u8]) -> Result { + retry!(self.inner.send_raw_transaction(transaction)) + } + + fn get_asset_unlock_statuses( + &self, + indices: &[u64], + core_chain_locked_height: u32, + ) -> Result, Error> { + retry!(self + .inner + .get_asset_unlock_statuses(indices, Some(core_chain_locked_height))) + } } diff --git a/packages/rs-drive-abci/src/server.rs b/packages/rs-drive-abci/src/server.rs new file mode 100644 index 00000000000..a24fc7495d8 --- /dev/null +++ b/packages/rs-drive-abci/src/server.rs @@ -0,0 +1,82 @@ +//! This module implements Drive ABCI server. +//! + +use crate::abci::app::CheckTxAbciApplication; +use crate::abci::app::ConsensusAbciApplication; +use crate::config::PlatformConfig; +use crate::platform_types::platform::Platform; +use crate::query::QueryService; +use crate::rpc::core::DefaultCoreRPC; +use std::sync::Arc; +use tokio::runtime::Runtime; +use tokio_util::sync::CancellationToken; + +/// Starts gRPC and ABCI servers to serve Query, CheckTx and Consensus applications +/// +/// Should only return when server is stopped +pub fn start( + runtime: &Runtime, + platform: Arc>, + config: PlatformConfig, + cancel: CancellationToken, +) { + let query_service = QueryService::new(Arc::clone(&platform)); + + let check_tx_core_rpc = DefaultCoreRPC::open( + &config.core.check_tx_rpc.url(), + config.core.check_tx_rpc.username, + config.core.check_tx_rpc.password, + ) + .expect("failed to open check tx core rpc"); + + let check_tx_service = + CheckTxAbciApplication::new(Arc::clone(&platform), Arc::new(check_tx_core_rpc)); + + let grpc_server = dapi_grpc::tonic::transport::Server::builder() + .add_service(dapi_grpc::platform::v0::platform_server::PlatformServer::new(query_service)) + .add_service( + tenderdash_abci::proto::abci::abci_application_server::AbciApplicationServer::new( + check_tx_service, + ), + ); + + let grpc_server_cancel = cancel.clone(); + + runtime.spawn(async move { + tracing::info!("gRPC server is listening on {}", &config.grpc_bind_address); + + grpc_server + .serve_with_shutdown( + config + .grpc_bind_address + .parse() + .expect("invalid grpc address"), + grpc_server_cancel.cancelled(), + ) + .await + .expect("gRPC server failed"); + + tracing::info!("gRPC server is stopped"); + }); + + // Start blocking ABCI socket-server that process consensus requests sequentially + + let app = ConsensusAbciApplication::new(platform.as_ref()); + + let server = tenderdash_abci::ServerBuilder::new(app, &config.abci.consensus_bind_address) + .with_cancel_token(cancel.clone()) + .with_runtime(runtime.handle().clone()) + .build() + .expect("failed to build ABCI server"); + + while !cancel.is_cancelled() { + tracing::info!( + "ABCI app is waiting for new connection on {}", + config.abci.consensus_bind_address + ); + match server.next_client() { + Err(e) => tracing::error!("ABCI connection terminated: {:?}", e), + Ok(_) => tracing::info!("ABCI connection closed"), + } + } +} diff --git a/packages/rs-drive-abci/src/test/fixture/abci.rs b/packages/rs-drive-abci/src/test/fixture/abci.rs index afe4f6fb0c6..0d2db3608e5 100644 --- a/packages/rs-drive-abci/src/test/fixture/abci.rs +++ b/packages/rs-drive-abci/src/test/fixture/abci.rs @@ -1,164 +1,28 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Execution Tests //! -use crate::platform_types::required_identity_public_key_set::v0::RequiredIdentityPublicKeysSet; -use crate::platform_types::system_identity_public_keys::v0::SystemIdentityPublicKeysV0; -use dpp::version::PlatformVersion; -use drive::dpp::identity::KeyType::ECDSA_SECP256K1; -use rand::rngs::StdRng; -use rand::SeedableRng; +use crate::config::PlatformConfig; use tenderdash_abci::proto::abci::RequestInitChain; use tenderdash_abci::proto::google::protobuf::Timestamp; +use tenderdash_abci::proto::types::{ConsensusParams, VersionParams}; /// Creates static init chain request fixture -pub fn static_init_chain_request() -> RequestInitChain { +pub fn static_init_chain_request(config: &PlatformConfig) -> RequestInitChain { RequestInitChain { time: Some(Timestamp { seconds: 0, nanos: 0, }), chain_id: "strategy_tests".to_string(), - consensus_params: None, + consensus_params: Some(ConsensusParams { + version: Some(VersionParams { + app_version: config.initial_protocol_version as u64, + }), + ..Default::default() + }), validator_set: None, app_state_bytes: [0u8; 32].to_vec(), - initial_height: 0, - initial_core_height: 1, - } -} - -/// Creates static system identity public keys fixture -pub fn static_system_identity_public_keys_v0() -> SystemIdentityPublicKeysV0 { - SystemIdentityPublicKeysV0 { - masternode_reward_shares_contract_owner: RequiredIdentityPublicKeysSet { - master: vec![ - 3, 51, 164, 44, 98, 142, 140, 147, 206, 3, 134, 133, 111, 143, 34, 57, 200, 75, - 248, 22, 207, 133, 144, 113, 108, 120, 145, 253, 201, 129, 164, 223, 11, - ], - high: vec![ - 3, 163, 0, 40, 86, 173, 145, 102, 45, 195, 75, 102, 80, 162, 199, 248, 178, 114, - 108, 148, 122, 65, 158, 11, 136, 15, 179, 172, 195, 135, 99, 162, 113, - ], - }, - feature_flags_contract_owner: RequiredIdentityPublicKeysSet { - master: vec![ - 2, 35, 147, 72, 99, 130, 165, 187, 38, 40, 86, 196, 159, 134, 152, 39, 161, 199, - 154, 58, 60, 56, 116, 127, 60, 184, 195, 45, 215, 189, 25, 23, 151, - ], - high: vec![ - 3, 193, 10, 192, 138, 119, 223, 223, 205, 199, 6, 234, 67, 217, 101, 26, 192, 134, - 97, 129, 184, 53, 65, 21, 135, 236, 164, 210, 213, 71, 127, 57, 247, - ], - }, - dpns_contract_owner: RequiredIdentityPublicKeysSet { - master: vec![ - 3, 125, 7, 78, 176, 10, 162, 134, 196, 56, 181, 209, 43, 124, 108, 162, 81, 4, 214, - 27, 3, 230, 96, 27, 106, 206, 125, 94, 176, 54, 251, 188, 35, - ], - high: vec![ - 2, 88, 82, 223, 97, 26, 34, 139, 14, 127, 188, 207, 244, 234, 161, 23, 80, 14, 173, - 132, 98, 40, 9, 234, 127, 192, 93, 207, 109, 45, 187, 193, 212, - ], - }, - withdrawals_contract_owner: RequiredIdentityPublicKeysSet { - master: vec![ - 2, 197, 113, 255, 12, 219, 114, 99, 77, 228, 253, 35, 244, 12, 78, 213, 48, 179, - 211, 29, 239, 201, 135, 165, 84, 121, 214, 94, 126, 140, 30, 36, 154, - ], - high: vec![ - 3, 131, 79, 146, 162, 19, 46, 85, 39, 60, 183, 19, 232, 85, 166, 251, 242, 23, 151, - 4, 131, 12, 25, 9, 68, 112, 114, 13, 100, 52, 206, 69, 71, - ], - }, - dashpay_contract_owner: RequiredIdentityPublicKeysSet { - master: vec![ - 2, 238, 109, 155, 21, 237, 28, 49, 5, 53, 41, 119, 57, 230, 153, 115, 64, 109, 189, - 26, 103, 155, 231, 250, 210, 189, 210, 224, 134, 133, 3, 48, 119, - ], - high: vec![ - 2, 113, 28, 225, 254, 218, 253, 230, 118, 148, 215, 113, 149, 12, 71, 79, 227, 0, - 228, 100, 212, 246, 124, 42, 100, 71, 249, 182, 30, 144, 250, 1, 243, - ], - }, - } -} - -/// Creates random system identity public keys fixture -pub fn random_system_identity_public_keys(seed: Option) -> SystemIdentityPublicKeysV0 { - let platform_version = PlatformVersion::latest(); - let mut rng = match seed { - None => StdRng::from_entropy(), - Some(seed_value) => StdRng::seed_from_u64(seed_value), - }; - - SystemIdentityPublicKeysV0 { - masternode_reward_shares_contract_owner: RequiredIdentityPublicKeysSet { - master: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - high: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - }, - feature_flags_contract_owner: RequiredIdentityPublicKeysSet { - master: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - high: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - }, - dpns_contract_owner: RequiredIdentityPublicKeysSet { - master: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - high: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - }, - withdrawals_contract_owner: RequiredIdentityPublicKeysSet { - master: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - high: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - }, - dashpay_contract_owner: RequiredIdentityPublicKeysSet { - master: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - high: ECDSA_SECP256K1 - .random_public_key_data(&mut rng, platform_version) - .unwrap(), - }, + initial_height: config.abci.genesis_height as i64, + initial_core_height: config.abci.genesis_core_height, } } diff --git a/packages/rs-drive-abci/src/test/helpers/fast_forward_to_block.rs b/packages/rs-drive-abci/src/test/helpers/fast_forward_to_block.rs new file mode 100644 index 00000000000..9cbc8bec210 --- /dev/null +++ b/packages/rs-drive-abci/src/test/helpers/fast_forward_to_block.rs @@ -0,0 +1,151 @@ +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::execution::types::block_fees::v0::BlockFeesV0Methods; +use crate::execution::types::block_fees::BlockFees; +use crate::execution::types::block_state_info::v0::BlockStateInfoV0; +use crate::platform_types::epoch_info::v0::EpochInfoV0; +use crate::platform_types::epoch_info::EpochInfo; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::MockCoreRPCLike; +use crate::test::helpers::setup::TempPlatform; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; +use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0; +use drive::drive::credit_pools::operations::update_unpaid_epoch_index_operation; +use platform_version::version::PlatformVersion; +use std::sync::Arc; + +pub(crate) fn fast_forward_to_block( + platform: &TempPlatform, + time_ms: u64, + height: u64, + core_block_height: u32, + epoch_index: u16, + should_process_epoch_change: bool, +) { + let platform_state = platform.state.load(); + + let mut platform_state = (**platform_state).clone(); + + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let block_info = BlockInfo { + time_ms, //less than 2 weeks + height, + core_height: core_block_height, + epoch: Epoch::new(epoch_index).unwrap(), + }; + + platform_state.set_last_committed_block_info(Some( + ExtendedBlockInfoV0 { + basic_info: block_info, + app_hash: platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap(), + quorum_hash: [0u8; 32], + block_id_hash: [0u8; 32], + proposer_pro_tx_hash: [0u8; 32], + signature: [0u8; 96], + round: 0, + } + .into(), + )); + + platform.state.store(Arc::new(platform_state.clone())); + + if should_process_epoch_change { + process_epoch_change( + platform, + Some(platform_state), + time_ms, + height, + core_block_height, + epoch_index, + ) + } +} + +pub(crate) fn process_epoch_change( + platform: &TempPlatform, + platform_state: Option, + time_ms: u64, + height: u64, + core_block_height: u32, + epoch_index: u16, +) { + let platform_state = platform_state.unwrap_or_else(|| { + let platform_state = platform.state.load(); + + (**platform_state).clone() + }); + + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let block_execution_context: BlockExecutionContext = BlockExecutionContextV0 { + block_state_info: BlockStateInfoV0 { + height, + round: 0, + block_time_ms: time_ms, + previous_block_time_ms: time_ms.checked_sub(3000), + proposer_pro_tx_hash: [0; 32], + core_chain_locked_height: core_block_height, + block_hash: Some([0; 32]), + app_hash: None, + } + .into(), + epoch_info: EpochInfo::V0(EpochInfoV0 { + current_epoch_index: epoch_index, + previous_epoch_index: epoch_index.checked_sub(1), + is_epoch_change: true, + }), + // TODO: It doesn't seem correct to use previous block count of hpmns. + // We currently not using this field in the codebase. We probably should just remove it. + hpmn_count: 100, + unsigned_withdrawal_transactions: UnsignedWithdrawalTxs::default(), + block_platform_state: platform_state, + proposer_results: None, + } + .into(); + + let block_fees: BlockFees = BlockFees::from_fees(0, 0); + + let mut operations = vec![]; + + platform + .add_process_epoch_change_operations( + &block_execution_context, + &block_fees, + None, + &mut operations, + platform_version, + ) + .expect("expected to process change operations"); + + operations.push(drive::util::batch::DriveOperation::GroveDBOperation( + update_unpaid_epoch_index_operation(epoch_index), + )); + + platform + .drive + .apply_drive_operations( + operations, + true, + &BlockInfo { + time_ms, + height, + core_height: core_block_height, + epoch: Epoch::new(epoch_index).unwrap(), + }, + None, + platform_version, + None, + ) + .expect("expected to apply drive operations"); +} diff --git a/packages/rs-drive-abci/src/test/helpers/fee_pools.rs b/packages/rs-drive-abci/src/test/helpers/fee_pools.rs index ea323d94c82..443cc03b900 100644 --- a/packages/rs-drive-abci/src/test/helpers/fee_pools.rs +++ b/packages/rs-drive-abci/src/test/helpers/fee_pools.rs @@ -47,15 +47,15 @@ use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::DataContract; use dpp::document::{DocumentV0, INITIAL_REVISION}; use dpp::identity::accessors::IdentityGettersV0; -use dpp::system_data_contracts::masternode_reward_shares_contract::document_types; +use dpp::system_data_contracts::masternode_reward_shares_contract::v1::document_types; use dpp::version::PlatformVersion; -use drive::common::identities::create_test_identity_with_rng; use drive::dpp::document::Document; -use drive::drive::flags::StorageFlags; -use drive::drive::object_size_info::DocumentInfo::DocumentRefInfo; -use drive::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; use drive::drive::Drive; use drive::grovedb::TransactionArg; +use drive::util::object_size_info::DocumentInfo::DocumentRefInfo; +use drive::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +use drive::util::storage_flags::StorageFlags; +use drive::util::test_helpers::test_utils::identities::create_test_identity_with_rng; /// A function which creates a test MN_REWARD_SHARES_DOCUMENT_TYPE document. fn create_test_mn_share_document( @@ -84,6 +84,13 @@ fn create_test_mn_share_document( revision: Some(INITIAL_REVISION), created_at: None, updated_at: None, + transferred_at: None, + created_at_block_height: None, + updated_at_block_height: None, + transferred_at_block_height: None, + created_at_core_block_height: None, + updated_at_core_block_height: None, + transferred_at_core_block_height: None, } .into(); @@ -108,6 +115,7 @@ fn create_test_mn_share_document( true, transaction, platform_version, + None, ) .expect("expected to insert a document successfully"); @@ -129,7 +137,7 @@ pub fn create_test_masternode_share_identities_and_documents( Some(seed_value) => StdRng::seed_from_u64(seed_value), }; let all_exist = drive - .verify_all_identities_exist(pro_tx_hashes, transaction) + .verify_all_identities_exist(pro_tx_hashes, transaction, platform_version) .expect("expected that all identities existed"); if all_exist { pro_tx_hashes diff --git a/packages/rs-drive-abci/src/test/helpers/mod.rs b/packages/rs-drive-abci/src/test/helpers/mod.rs index ba5a25f76b5..11a8dc90c9c 100644 --- a/packages/rs-drive-abci/src/test/helpers/mod.rs +++ b/packages/rs-drive-abci/src/test/helpers/mod.rs @@ -1,6 +1,8 @@ +/// Test helpers +#[cfg(test)] +pub mod fast_forward_to_block; pub mod fee_pools; pub mod setup; - // TODO: Move tests to appropriate place #[cfg(test)] diff --git a/packages/rs-drive-abci/src/test/helpers/setup.rs b/packages/rs-drive-abci/src/test/helpers/setup.rs index 3f647d44f4d..a557c2e9152 100644 --- a/packages/rs-drive-abci/src/test/helpers/setup.rs +++ b/packages/rs-drive-abci/src/test/helpers/setup.rs @@ -35,11 +35,17 @@ use std::ops::{Deref, DerefMut}; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; #[cfg(any(feature = "mocks", test))] use crate::rpc::core::MockCoreRPCLike; -use crate::test::fixture::abci::static_system_identity_public_keys_v0; use crate::{config::PlatformConfig, rpc::core::DefaultCoreRPC}; +use dpp::block::block_info::BlockInfo; +use dpp::document::transfer::Transferable; +use dpp::nft::TradeMode; +use dpp::prelude::{CoreBlockHeight, DataContract, TimestampMillis}; +use dpp::tests::json_document::json_document_to_contract; use dpp::version::PlatformVersion; +use drive::util::storage_flags::StorageFlags; use tempfile::TempDir; /// A test platform builder. @@ -110,8 +116,7 @@ impl TempPlatform { None, self.platform .state - .read() - .unwrap() + .load() .current_platform_version() .expect("expected to get current platform version"), ) @@ -120,12 +125,90 @@ impl TempPlatform { self } + /// A function which adds the crypto card game to the state and returns it. + pub fn with_crypto_card_game_transfer_only( + self, + transferable: Transferable, + ) -> (Self, DataContract) { + let card_game_path = match transferable { + Transferable::Never => "tests/supporting_files/contract/crypto-card-game/crypto-card-game-not-transferable.json", + Transferable::Always => "tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable.json", + }; + + let platform_version = self + .platform + .state + .load() + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let card_game_contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + self.drive + .apply_contract( + &card_game_contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + (self, card_game_contract) + } + + /// A function which adds the crypto card game to the state and returns it. + pub fn with_crypto_card_game_nft(self, marketplace: TradeMode) -> (Self, DataContract) { + let card_game_path = match marketplace { + TradeMode::DirectPurchase => "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json", + _ => panic!("not yet supported") + }; + + let platform_version = self + .platform + .state + .load() + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let card_game_contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + self.drive + .apply_contract( + &card_game_contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + (self, card_game_contract) + } + /// Sets Platform to genesis state. pub fn set_genesis_state(self) -> Self { self.platform - .create_genesis_state_v0( - Default::default(), - static_system_identity_public_keys_v0().into(), + .create_genesis_state(1, Default::default(), None, PlatformVersion::latest()) + .expect("should create root tree successfully"); + + self + } + + /// Sets Platform to genesis state with information that came at activation. + pub fn set_genesis_state_with_activation_info( + self, + genesis_time: TimestampMillis, + start_core_block_height: CoreBlockHeight, + ) -> Self { + self.platform + .create_genesis_state( + start_core_block_height, + genesis_time, None, PlatformVersion::latest(), ) diff --git a/packages/rs-drive-abci/src/test/mod.rs b/packages/rs-drive-abci/src/test/mod.rs index 84af42a9cb9..6212545dca6 100644 --- a/packages/rs-drive-abci/src/test/mod.rs +++ b/packages/rs-drive-abci/src/test/mod.rs @@ -2,3 +2,71 @@ pub mod fixture; /// Test helpers module pub mod helpers; + +/// The `expect_match` macro is used to match a value against a specified pattern. +/// If the pattern matches, it returns the result specified in the macro. +/// If the pattern does not match, it panics with a message indicating the expected pattern. +/// +/// # Arguments +/// +/// * `$value:expr` - The value to match against the pattern. +/// * `$pattern:pat` - The pattern to match the value against. +/// * `$result:expr` - The result to return if the pattern matches. +/// +/// # Panics +/// +/// This macro will panic with a message containing the pattern if the value does not match the pattern. +/// +/// # Examples +/// +/// ``` +/// #[derive(Debug)] +/// struct FeeResult { +/// // fields +/// } +/// +/// #[derive(Debug)] +/// enum StateTransitionExecutionResult { +/// SuccessfulExecution(u32, FeeResult), +/// FailedExecution(String), +/// } +/// +/// struct ProcessingResult { +/// results: Vec, +/// } +/// +/// impl ProcessingResult { +/// fn execution_results(&self) -> &[StateTransitionExecutionResult] { +/// &self.results +/// } +/// } +/// +/// fn main() { +/// use drive_abci::expect_match; +/// let fee_result = FeeResult {}; +/// let mut processing_result = ProcessingResult { +/// results: vec![StateTransitionExecutionResult::SuccessfulExecution(42, fee_result)], +/// }; +/// +/// let fee_result = expect_match!( +/// &processing_result.execution_results()[0], +/// StateTransitionExecutionResult::SuccessfulExecution(_, fee_result) => fee_result +/// ); +/// +/// // Use fee_result here +/// println!("{:?}", fee_result); +/// } +/// ``` +#[macro_export] +macro_rules! expect_match { + ($value:expr, $pattern:pat => $result:expr) => { + match $value { + $pattern => $result, + e => panic!( + "expected pattern to match: {:?}, got {:?}", + stringify!($pattern), + e + ), + } + }; +} diff --git a/packages/rs-drive-abci/src/utils/mod.rs b/packages/rs-drive-abci/src/utils/mod.rs new file mode 100644 index 00000000000..b7292f50cff --- /dev/null +++ b/packages/rs-drive-abci/src/utils/mod.rs @@ -0,0 +1,6 @@ +mod serialization; +mod spawn; + +pub use serialization::from_opt_str_or_number; +pub use serialization::from_str_or_number; +pub use spawn::spawn_blocking_task_with_name_if_supported; diff --git a/packages/rs-drive-abci/src/utils/serialization.rs b/packages/rs-drive-abci/src/utils/serialization.rs new file mode 100644 index 00000000000..8259ff1dce3 --- /dev/null +++ b/packages/rs-drive-abci/src/utils/serialization.rs @@ -0,0 +1,36 @@ +use serde::Deserialize; + +/// Deserialize a value from a string or a number. +pub fn from_str_or_number<'de, D, T>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de> + std::str::FromStr, + ::Err: std::fmt::Display, +{ + use serde::de::Error; + + let s = String::deserialize(deserializer)?; + s.parse::().map_err(Error::custom) +} + +/// Deserialize a value from an optional string or a number +pub fn from_opt_str_or_number<'de, D, T>(deserializer: D) -> Result, D::Error> +where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de> + std::str::FromStr, + ::Err: std::fmt::Display, +{ + use serde::de::Error; + + let s = Option::::deserialize(deserializer)?; + match s { + Some(s) => { + if s.is_empty() { + Ok(None) + } else { + s.parse::().map(Some).map_err(Error::custom) + } + } + None => Ok(None), + } +} diff --git a/packages/rs-drive-abci/src/utils/spawn.rs b/packages/rs-drive-abci/src/utils/spawn.rs new file mode 100644 index 00000000000..40ff8cb5509 --- /dev/null +++ b/packages/rs-drive-abci/src/utils/spawn.rs @@ -0,0 +1,24 @@ +use std::io; +use tokio::task::JoinHandle; + +/// Spawn a blocking tokio task with name if tokio_unstable flag is set +pub fn spawn_blocking_task_with_name_if_supported( + _sometimes_used_name: &str, + function: Function, +) -> io::Result> +where + Function: FnOnce() -> Output + Send + 'static, + Output: Send + 'static, +{ + #[cfg(all(tokio_unstable, feature = "console"))] + { + tokio::task::Builder::new() + .name(_sometimes_used_name) + .spawn_blocking(function) + } + + #[cfg(not(all(tokio_unstable, feature = "console")))] + { + Ok(tokio::task::spawn_blocking(function)) + } +} diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs new file mode 100644 index 00000000000..9318c7c2995 --- /dev/null +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -0,0 +1,85 @@ +#[cfg(test)] +mod tests { + + use crate::execution::run_chain_for_strategy; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; + use crate::strategy::{MasternodeListChangesStrategy, NetworkStrategy}; + use drive_abci::config::{ + ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig, + }; + + use drive_abci::test::helpers::setup::TestPlatformBuilder; + use strategy_tests::frequency::Frequency; + use strategy_tests::{IdentityInsertInfo, StartIdentities, Strategy}; + + #[test] + fn run_chain_lock_update_quorums_not_changing() { + // The point of this test is to check that chain locks can be validated in the + // simple case where quorums do not change + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![], + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 400, + validator_quorum_count: 24, + chain_lock_quorum_count: 4, + upgrading_info: None, + core_height_increase: RandomCoreHeightIncrease(Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }), + proposer_strategy: MasternodeListChangesStrategy { + new_hpmns: Default::default(), + removed_hpmns: Default::default(), + updated_hpmns: Default::default(), + banned_hpmns: Default::default(), + unbanned_hpmns: Default::default(), + changed_ip_hpmns: Default::default(), + changed_p2p_port_hpmns: Default::default(), + changed_http_port_hpmns: Default::default(), + new_masternodes: Default::default(), + removed_masternodes: Default::default(), + updated_masternodes: Default::default(), + banned_masternodes: Default::default(), + unbanned_masternodes: Default::default(), + changed_ip_masternodes: Default::default(), + }, + rotate_quorums: true, + failure_testing: None, + query_testing: None, + verify_state_transition_results: false, + independent_process_proposal_verification: true, + sign_chain_locks: true, + ..Default::default() + }; + + let config = PlatformConfig { + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + ..Default::default() + }, + block_spacing_ms: 3000, + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + run_chain_for_strategy(&mut platform, 50, strategy, config, 13, &mut None); + } +} diff --git a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs index eb6e8c1ad0c..a52276d717a 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs @@ -1,37 +1,40 @@ #[cfg(test)] mod tests { - use tenderdash_abci::proto::types::CoreChainLock; use crate::execution::run_chain_for_strategy; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; use crate::strategy::{MasternodeListChangesStrategy, NetworkStrategy}; - use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; + use drive_abci::config::{ + ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig, + ValidatorSetConfig, + }; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; use drive_abci::platform_types::validator_set::v0::ValidatorSetV0Getters; use drive_abci::test::helpers::setup::TestPlatformBuilder; use strategy_tests::frequency::Frequency; - use strategy_tests::Strategy; + use strategy_tests::{IdentityInsertInfo, StartIdentities, Strategy}; #[test] fn run_chain_random_bans() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Default::default(), removed_hpmns: Default::default(), @@ -61,35 +64,30 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set: ValidatorSetConfig { + quorum_size, + ..Default::default() + }, + + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 1, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); + let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13, &mut None); // we expect to see quorums with banned members - let state = outcome.abci_app.platform.state.read().unwrap(); + let state = outcome.abci_app.platform.state.load(); let banned_count = state .validator_sets() @@ -121,23 +119,23 @@ mod tests { fn run_chain_random_removals() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Default::default(), removed_hpmns: Frequency { @@ -167,35 +165,30 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set: ValidatorSetConfig { + quorum_size, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 1, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); + let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13, &mut None); // we expect to see quorums with banned members - let _state = outcome.abci_app.platform.state.read().unwrap(); + let _state = outcome.abci_app.platform.state.load(); // We should also see validator sets with less than the quorum size @@ -213,34 +206,36 @@ mod tests { fn run_chain_random_bans_and_unbans() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Default::default(), removed_hpmns: Default::default(), updated_hpmns: Default::default(), banned_hpmns: Frequency { times_per_block_range: 1..2, - chance_per_block: Some(0.1), //lower chance of banning + chance_per_block: Some(0.1), + //lower chance of banning }, unbanned_hpmns: Frequency { times_per_block_range: 1..2, - chance_per_block: Some(0.3), //higher chance of unbanning + chance_per_block: Some(0.3), + //higher chance of unbanning }, changed_ip_hpmns: Default::default(), changed_p2p_port_hpmns: Default::default(), @@ -262,31 +257,26 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig { + quorum_size, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 1, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 26, strategy, config, 13); + let outcome = run_chain_for_strategy(&mut platform, 26, strategy, config, 13, &mut None); // We should also see validator sets with less than the quorum size diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index 0fe56c965cd..66f2735db7d 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -2,8 +2,8 @@ use crate::masternodes; use crate::masternodes::{GenerateTestMasternodeUpdates, MasternodeListItemWithUpdates}; use crate::query::ProofVerification; use crate::strategy::{ - ChainExecutionOutcome, ChainExecutionParameters, NetworkStrategy, StrategyRandomness, - ValidatorVersionMigration, + ChainExecutionOutcome, ChainExecutionParameters, CoreHeightIncrease, NetworkStrategy, + StrategyRandomness, ValidatorVersionMigration, }; use crate::verify_state_transitions::verify_state_transitions_were_or_were_not_executed; use dashcore_rpc::dashcore::hashes::Hash; @@ -18,20 +18,27 @@ use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use strategy_tests::operations::FinalizeBlockOperation::IdentityAddKeys; -use strategy_tests::Strategy; use dashcore_rpc::json::{ExtendedQuorumListResult, SoftforkInfo}; -use drive_abci::abci::AbciApplication; +use dpp::bls_signatures::PrivateKey; +use dpp::dashcore::consensus::Encodable; +use dpp::dashcore::hashes::{sha256d, HashEngine}; +use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; +use drive_abci::abci::app::FullAbciApplication; use drive_abci::config::PlatformConfig; use drive_abci::mimic::test_quorum::TestQuorumInfo; use drive_abci::mimic::{MimicExecuteBlockOptions, MimicExecuteBlockOutcome}; use drive_abci::platform_types::epoch_info::v0::EpochInfoV0; use drive_abci::platform_types::platform::Platform; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; +use drive_abci::platform_types::signature_verification_quorum_set::{Quorums, SigningQuorum}; +use drive_abci::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; use drive_abci::rpc::core::MockCoreRPCLike; use drive_abci::test::fixture::abci::static_init_chain_request; +use platform_version::version::PlatformVersion; use rand::prelude::{SliceRandom, StdRng}; -use rand::SeedableRng; +use rand::{Rng, SeedableRng}; +use simple_signer::signer::SimpleSigner; use std::collections::{BTreeMap, HashMap}; use tenderdash_abci::proto::abci::{ResponseInitChain, ValidatorSetUpdate}; use tenderdash_abci::proto::crypto::public_key::Sum::Bls12381; @@ -39,30 +46,55 @@ use tenderdash_abci::proto::google::protobuf::Timestamp; use tenderdash_abci::proto::serializers::timestamp::FromMilis; use tenderdash_abci::Application; -pub(crate) fn run_chain_for_strategy( - platform: &mut Platform, +pub const GENESIS_TIME_MS: u64 = 1681094380000; + +pub(crate) fn run_chain_for_strategy<'a>( + platform: &'a mut Platform, block_count: u64, strategy: NetworkStrategy, config: PlatformConfig, seed: u64, -) -> ChainExecutionOutcome { - let quorum_count = strategy.quorum_count; // We assume 24 quorums - let quorum_size = config.quorum_size; + add_voting_keys_to_signer: &mut Option, +) -> ChainExecutionOutcome<'a> { + // TODO: Do we want to sign instant locks or just disable verification? + + let validator_quorum_count = strategy.validator_quorum_count; // In most tests 24 quorums + let chain_lock_quorum_count = strategy.chain_lock_quorum_count; // In most tests 4 quorums when not the same as validator + let instant_lock_quorum_count = strategy.instant_lock_quorum_count; // In most tests 24 quorums when not the same as validator + let validator_set_quorum_size = config.validator_set.quorum_size; + let chain_lock_quorum_size = config.chain_lock.quorum_size; let mut rng = StdRng::seed_from_u64(seed); let any_changes_in_strategy = strategy.proposer_strategy.any_is_set(); let updated_proposers_in_strategy = strategy.proposer_strategy.any_kind_of_update_is_set(); + let core_height_increase = strategy.core_height_increase.clone(); + + let max_core_height = + core_height_increase.max_core_height(block_count, strategy.initial_core_height); + + let chain_lock_quorum_type = config.chain_lock.quorum_type; + + let sign_chain_locks = strategy.sign_chain_locks; + + let mut core_blocks = BTreeMap::new(); + let mut block_rng = StdRng::seed_from_u64(rng.gen()); // so we don't need to regenerate tests + + for x in strategy.initial_core_height..max_core_height + 1 { + let block_hash: [u8; 32] = block_rng.gen(); + core_blocks.insert(x, block_hash); + } + let ( initial_masternodes_with_updates, initial_hpmns_with_updates, with_extra_masternodes_with_updates, with_extra_hpmns_with_updates, ) = if any_changes_in_strategy { - let approximate_end_core_height = - ((block_count as f64) * strategy.core_height_increase.average_event_count()) as u32; - let end_core_height = approximate_end_core_height * 2; //let's be safe + let end_core_height = strategy + .core_height_increase + .max_core_height(block_count, strategy.initial_core_height); let generate_updates = if updated_proposers_in_strategy { Some(GenerateTestMasternodeUpdates { start_core_height: config.abci.genesis_core_height, @@ -89,6 +121,7 @@ pub(crate) fn run_chain_for_strategy( strategy.total_hpmns, generate_updates, &mut rng, + add_voting_keys_to_signer, ); let mut all_masternodes = initial_masternodes.clone(); @@ -139,6 +172,7 @@ pub(crate) fn run_chain_for_strategy( new_hpmns, generate_updates, &mut rng, + add_voting_keys_to_signer, ); if strategy.proposer_strategy.removed_masternodes.is_set() { @@ -181,6 +215,7 @@ pub(crate) fn run_chain_for_strategy( strategy.total_hpmns, None, &mut rng, + add_voting_keys_to_signer, ); ( initial_masternodes, @@ -190,28 +225,33 @@ pub(crate) fn run_chain_for_strategy( ) }; + let initial_all_masternodes: Vec<_> = initial_masternodes_with_updates + .into_iter() + .chain(initial_hpmns_with_updates.clone()) + .collect(); + let all_hpmns_with_updates = with_extra_hpmns_with_updates .iter() .max_by_key(|(key, _)| *key) .map(|(_, v)| v.clone()) .unwrap_or(initial_hpmns_with_updates.clone()); - let total_quorums = if strategy.rotate_quorums { - quorum_count * 10 + let total_validator_quorums = if strategy.rotate_quorums { + validator_quorum_count * 10 } else { - quorum_count + validator_quorum_count }; - let quorums = masternodes::generate_test_quorums( - total_quorums as usize, + let validator_quorums = masternodes::generate_test_quorums( + total_validator_quorums as usize, initial_hpmns_with_updates .iter() .map(|hpmn| &hpmn.masternode), - quorum_size as usize, + validator_set_quorum_size as usize, &mut rng, ); - let mut quorums_details: Vec<(QuorumHash, ExtendedQuorumDetails)> = quorums + let mut validator_quorums_details: Vec<(QuorumHash, ExtendedQuorumDetails)> = validator_quorums .keys() .map(|quorum_hash| { ( @@ -227,7 +267,137 @@ pub(crate) fn run_chain_for_strategy( }) .collect(); - quorums_details.shuffle(&mut rng); + validator_quorums_details.shuffle(&mut rng); + + let (chain_lock_quorums, chain_lock_quorums_details) = + if config.validator_set.quorum_type != config.chain_lock.quorum_type { + let total_chain_lock_quorums = if strategy.rotate_quorums { + chain_lock_quorum_count * 10 + } else { + chain_lock_quorum_count + }; + + let chain_lock_quorums = masternodes::generate_test_quorums( + total_chain_lock_quorums as usize, + initial_all_masternodes + .iter() + .map(|masternode| &masternode.masternode), + chain_lock_quorum_size as usize, + &mut rng, + ); + + let mut chain_lock_quorums_details: Vec<(QuorumHash, ExtendedQuorumDetails)> = + chain_lock_quorums + .keys() + .map(|quorum_hash| { + ( + *quorum_hash, + ExtendedQuorumDetails { + creation_height: 0, + quorum_index: None, + mined_block_hash: BlockHash::all_zeros(), + num_valid_members: 0, + health_ratio: 0.0, + }, + ) + }) + .collect(); + + chain_lock_quorums_details.shuffle(&mut rng); + + (chain_lock_quorums, chain_lock_quorums_details) + } else { + (BTreeMap::new(), vec![]) + }; + + let (instant_lock_quorum_infos, instant_lock_quorums_details, instant_lock_signing_quorums) = + if config.validator_set.quorum_type != config.instant_lock.quorum_type { + // TODO: Implement instant lock quorums rotation? + let total_instant_lock_quorums = if strategy.rotate_quorums { + instant_lock_quorum_count * 10 + } else { + instant_lock_quorum_count + }; + + let instant_lock_quorums_infos = masternodes::generate_test_quorums( + total_instant_lock_quorums as usize, + initial_all_masternodes + .iter() + .map(|masternode| &masternode.masternode), + config.instant_lock.quorum_size as usize, + &mut rng, + ); + + let mut instant_lock_quorums_details: Vec<(QuorumHash, ExtendedQuorumDetails)> = + instant_lock_quorums_infos + .iter() + .map(|(hash, quorum)| { + ( + *hash, + ExtendedQuorumDetails { + creation_height: 0, + quorum_index: quorum.quorum_index, + mined_block_hash: BlockHash::all_zeros(), + num_valid_members: 0, + health_ratio: 0.0, + }, + ) + }) + .collect(); + + instant_lock_quorums_details.shuffle(&mut rng); + + let instant_lock_signing_quorums: Quorums = + if strategy.sign_instant_locks { + instant_lock_quorums_infos + .iter() + .map(|(quorum_hash, info)| { + let bytes = info.private_key.to_bytes(); + let fixed_bytes: [u8; 32] = bytes + .as_slice() + .try_into() + .expect("Expected a byte array of length 32"); + ( + *quorum_hash, + SigningQuorum { + index: info.quorum_index, + private_key: fixed_bytes, + }, + ) + }) + .collect() + } else { + Default::default() + }; + + ( + instant_lock_quorums_infos, + instant_lock_quorums_details, + instant_lock_signing_quorums, + ) + } else if strategy.sign_instant_locks { + let signing_quorums = validator_quorums + .iter() + .map(|(quorum_hash, info)| { + let bytes = info.private_key.to_bytes(); + let fixed_bytes: [u8; 32] = bytes + .as_slice() + .try_into() + .expect("Expected a byte array of length 32"); + ( + *quorum_hash, + SigningQuorum { + index: info.quorum_index, + private_key: fixed_bytes, + }, + ) + }) + .collect(); + + (Default::default(), Default::default(), signing_quorums) + } else { + Default::default() + }; let start_core_height = platform.config.abci.genesis_core_height; @@ -258,38 +428,33 @@ pub(crate) fn run_chain_for_strategy( })) }); - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); - platform .core_rpc .expect_get_quorum_listextended() .returning(move |core_height: Option| { - let extended_info = if !strategy.rotate_quorums { - quorums_details.clone().into_iter().collect() + let validator_set_extended_info = if !strategy.rotate_quorums { + validator_quorums_details.clone().into_iter().collect() } else { let core_height = core_height.expect("expected a core height"); // if we rotate quorums we shouldn't give back the same ones every time let start_range = core_height / 24; - let end_range = start_range + quorum_count as u32; - let start_range = start_range % total_quorums as u32; - let end_range = end_range % total_quorums as u32; + let end_range = start_range + validator_quorum_count as u32; + let start_range = start_range % total_validator_quorums as u32; + let end_range = end_range % total_validator_quorums as u32; if end_range > start_range { - quorums_details + validator_quorums_details .iter() .skip(start_range as usize) .take((end_range - start_range) as usize) .map(|(quorum_hash, quorum)| (*quorum_hash, quorum.clone())) .collect() } else { - let first_range = quorums_details + let first_range = validator_quorums_details .iter() .skip(start_range as usize) - .take((total_quorums as u32 - start_range) as usize); - let second_range = quorums_details.iter().take(end_range as usize); + .take((total_validator_quorums as u32 - start_range) as usize); + let second_range = validator_quorums_details.iter().take(end_range as usize); first_range .chain(second_range) .map(|(quorum_hash, quorum)| (*quorum_hash, quorum.clone())) @@ -297,15 +462,32 @@ pub(crate) fn run_chain_for_strategy( } }; - let result = ExtendedQuorumListResult { - quorums_by_type: HashMap::from([(QuorumType::Llmq100_67, extended_info)]), - }; + let mut quorums_by_type = + HashMap::from([(QuorumType::Llmq100_67, validator_set_extended_info)]); + + if !chain_lock_quorums_details.is_empty() { + quorums_by_type.insert( + QuorumType::Llmq400_60, + chain_lock_quorums_details.clone().into_iter().collect(), + ); + } + + if !instant_lock_quorums_details.is_empty() { + quorums_by_type.insert( + QuorumType::Llmq60_75, + instant_lock_quorums_details.clone().into_iter().collect(), + ); + } + + let result = ExtendedQuorumListResult { quorums_by_type }; Ok(result) }); - let quorums_info: HashMap = quorums + let all_quorums_info: HashMap = validator_quorums .iter() + .chain(chain_lock_quorums.iter()) + .chain(instant_lock_quorum_infos.iter()) .map(|(quorum_hash, test_quorum_info)| (*quorum_hash, test_quorum_info.into())) .collect(); @@ -313,17 +495,12 @@ pub(crate) fn run_chain_for_strategy( .core_rpc .expect_get_quorum_info() .returning(move |_, quorum_hash: &QuorumHash, _| { - Ok(quorums_info + Ok(all_quorums_info .get::(quorum_hash) .unwrap_or_else(|| panic!("expected to get quorum {}", hex::encode(quorum_hash))) .clone()) }); - let initial_all_masternodes: Vec<_> = initial_masternodes_with_updates - .into_iter() - .chain(initial_hpmns_with_updates.clone().into_iter()) - .collect(); - platform .core_rpc .expect_get_protx_diff_with_masternodes() @@ -468,11 +645,129 @@ pub(crate) fn run_chain_for_strategy( Ok(diff) }); + let mut core_height = strategy.initial_core_height; + + let mut core_height_increase = strategy.core_height_increase.clone(); + let mut core_height_rng = rng.clone(); + + let chain_lock_quorums_private_keys: BTreeMap = chain_lock_quorums + .iter() + .map(|(quorum_hash, info)| { + let bytes = info.private_key.to_bytes(); + let fixed_bytes: [u8; 32] = bytes + .as_slice() + .try_into() + .expect("Expected a byte array of length 32"); + (*quorum_hash, fixed_bytes) + }) + .collect(); + + platform + .core_rpc + .expect_get_block_time_from_height() + .returning(|_| Ok(GENESIS_TIME_MS)); + + platform + .core_rpc + .expect_get_best_chain_lock() + .returning(move || { + let block_height = match &mut core_height_increase { + CoreHeightIncrease::NoCoreHeightIncrease + | CoreHeightIncrease::RandomCoreHeightIncrease(_) => core_height, + CoreHeightIncrease::KnownCoreHeightIncreases(core_block_heights) => { + if core_block_heights.len() == 1 { + *core_block_heights.first().unwrap() + } else { + core_block_heights.remove(0) + } + } + }; + + let Some(block_hash) = core_blocks.get(&block_height) else { + panic!("expected a block hash to be known for {}", block_height); + }; + + let chain_lock = if sign_chain_locks { + // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks + // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. + + let mut engine = QuorumSigningRequestId::engine(); + + // Prefix + let prefix_len = VarInt("clsig".len() as u64); + prefix_len + .consensus_encode(&mut engine) + .expect("expected to encode the prefix"); + + engine.input("clsig".as_bytes()); + engine.input(block_height.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined + + let quorum = Platform::::choose_quorum_thread_safe( + chain_lock_quorum_type, + &chain_lock_quorums_private_keys, + request_id.as_ref(), + PlatformVersion::latest(), //it should be okay to use latest here + ) + .expect("expected a quorum"); + + let (quorum_hash, quorum_private_key) = quorum.expect("expected to find a quorum"); + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[chain_lock_quorum_type as u8]); + engine.input(quorum_hash.as_slice()); + engine.input(request_id.as_byte_array()); + engine.input(block_hash); + + let message_digest = sha256d::Hash::from_engine(engine); + + let quorum_private_key = + PrivateKey::from_bytes(quorum_private_key.as_slice(), false) + .expect("expected to have a valid private key"); + let signature = quorum_private_key.sign(message_digest.as_byte_array()); + let chain_lock = ChainLock { + block_height, + block_hash: BlockHash::from_byte_array(*block_hash), + signature: (*signature.to_bytes()).into(), + }; + + Ok(chain_lock) + } else { + let chain_lock = ChainLock { + block_height, + block_hash: BlockHash::from_byte_array(*block_hash), + signature: [2; 96].into(), + }; + + Ok(chain_lock) + }; + + if let CoreHeightIncrease::RandomCoreHeightIncrease(core_height_increase) = + &core_height_increase + { + core_height += core_height_increase.events_if_hit(&mut core_height_rng) as u32; + }; + + chain_lock + }); + + platform + .core_rpc + .expect_submit_chain_lock() + .returning(move |chain_lock: &ChainLock| Ok(chain_lock.block_height)); + create_chain_for_strategy( platform, block_count, all_hpmns_with_updates, - quorums, + validator_quorums, + instant_lock_signing_quorums, strategy, config, rng, @@ -483,12 +778,14 @@ pub(crate) fn create_chain_for_strategy( platform: &Platform, block_count: u64, proposers_with_updates: Vec, - quorums: BTreeMap, + validator_quorums: BTreeMap, + instant_lock_quorums: Quorums, strategy: NetworkStrategy, config: PlatformConfig, rng: StdRng, ) -> ChainExecutionOutcome { - let abci_application = AbciApplication::new(platform).expect("expected new abci application"); + let abci_application = FullAbciApplication::new(platform); + let seed = strategy .failure_testing .as_ref() @@ -499,7 +796,8 @@ pub(crate) fn create_chain_for_strategy( abci_application, block_count, proposers_with_updates, - quorums, + validator_quorums, + instant_lock_quorums, strategy, config, seed, @@ -507,10 +805,11 @@ pub(crate) fn create_chain_for_strategy( } pub(crate) fn start_chain_for_strategy( - abci_application: AbciApplication, + abci_application: FullAbciApplication, block_count: u64, proposers_with_updates: Vec, - quorums: BTreeMap, + validator_quorums: BTreeMap, + instant_lock_quorums: Quorums, strategy: NetworkStrategy, config: PlatformConfig, seed: StrategyRandomness, @@ -520,18 +819,18 @@ pub(crate) fn start_chain_for_strategy( StrategyRandomness::RNGEntropy(rng) => rng, }; - let quorum_hashes: Vec<&QuorumHash> = quorums.keys().collect(); + let quorum_hashes: Vec<&QuorumHash> = validator_quorums.keys().collect(); - let mut current_quorum_hash = **quorum_hashes + let mut current_validator_quorum_hash = **quorum_hashes .choose(&mut rng) .expect("expected quorums to be initialized"); - let current_quorum_with_test_info = quorums - .get::(¤t_quorum_hash) + let current_quorum_with_test_info = validator_quorums + .get::(¤t_validator_quorum_hash) .expect("expected a quorum to be found"); // init chain - let mut init_chain_request = static_init_chain_request(); + let mut init_chain_request = static_init_chain_request(&config); init_chain_request.initial_core_height = config.abci.genesis_core_height; init_chain_request.validator_set = Some(ValidatorSetUpdate { @@ -554,7 +853,7 @@ pub(crate) fn start_chain_for_strategy( current_quorum_with_test_info.public_key.to_bytes().to_vec(), )), }), - quorum_hash: current_quorum_hash.to_byte_array().to_vec(), + quorum_hash: current_validator_quorum_hash.to_byte_array().to_vec(), }); let ResponseInitChain { @@ -565,11 +864,10 @@ pub(crate) fn start_chain_for_strategy( .expect("should init chain"); // initialization will change the current quorum hash - current_quorum_hash = abci_application + current_validator_quorum_hash = abci_application .platform .state - .read() - .unwrap() + .load() .current_validator_set_quorum_hash(); continue_chain_for_strategy( @@ -579,11 +877,15 @@ pub(crate) fn start_chain_for_strategy( core_height_start: initial_core_height, block_count, proposers: proposers_with_updates, - quorums, - current_quorum_hash, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, current_proposer_versions: None, - start_time_ms: 1681094380000, - current_time_ms: 1681094380000, + current_identity_nonce_counter: Default::default(), + current_identity_contract_nonce_counter: Default::default(), + current_votes: Default::default(), + start_time_ms: GENESIS_TIME_MS, + current_time_ms: GENESIS_TIME_MS, }, strategy, config, @@ -592,7 +894,7 @@ pub(crate) fn start_chain_for_strategy( } pub(crate) fn continue_chain_for_strategy( - abci_app: AbciApplication, + abci_app: FullAbciApplication, chain_execution_parameters: ChainExecutionParameters, mut strategy: NetworkStrategy, config: PlatformConfig, @@ -601,20 +903,24 @@ pub(crate) fn continue_chain_for_strategy( let platform = abci_app.platform; let ChainExecutionParameters { block_start, - core_height_start, + core_height_start: _, block_count, proposers: proposers_with_updates, - quorums, - mut current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: mut current_quorum_hash, current_proposer_versions, + mut current_identity_nonce_counter, + mut current_identity_contract_nonce_counter, + mut current_votes, start_time_ms, mut current_time_ms, + instant_lock_quorums, } = chain_execution_parameters; let mut rng = match seed { StrategyRandomness::SeedEntropy(seed) => StdRng::seed_from_u64(seed), StrategyRandomness::RNGEntropy(rng) => rng, }; - let quorum_size = config.quorum_size; + let quorum_size = config.validator_set.quorum_size; let first_block_time = start_time_ms; let mut current_identities = vec![]; let mut signer = strategy.strategy.signer.clone().unwrap_or_default(); @@ -635,9 +941,7 @@ pub(crate) fn continue_chain_for_strategy( }), ); - let mut current_core_height = core_height_start; - - let mut total_withdrawals = vec![]; + let mut total_withdrawals = UnsignedWithdrawalTxs::default(); let mut current_quorum_with_test_info = quorums.get::(¤t_quorum_hash).unwrap(); @@ -648,13 +952,11 @@ pub(crate) fn continue_chain_for_strategy( let mut state_transition_results_per_block = BTreeMap::new(); for block_height in block_start..(block_start + block_count) { + let state = platform.state.load(); let epoch_info = EpochInfoV0::calculate( first_block_time, current_time_ms, - platform - .state - .read() - .expect("lock is poisoned") + state .last_committed_block_info() .as_ref() .map(|block_info| block_info.basic_info().time_ms), @@ -662,7 +964,9 @@ pub(crate) fn continue_chain_for_strategy( ) .expect("should calculate epoch info"); - current_core_height += strategy.core_height_increase.events_if_hit(&mut rng) as u32; + let current_core_height = state.last_committed_core_height(); + + drop(state); let block_info = BlockInfo { time_ms: current_time_ms, @@ -676,17 +980,21 @@ pub(crate) fn continue_chain_for_strategy( } let proposer = current_quorum_with_test_info - .validator_set - .get(i as usize) + .validator_map + .values() + .nth(i as usize) .unwrap(); - let (state_transitions, finalize_block_operations) = strategy - .state_transitions_for_block_with_new_identities( - platform, - &block_info, - &mut current_identities, - &mut signer, - &mut rng, - ); + let (state_transitions, finalize_block_operations) = strategy.state_transitions_for_block( + platform, + &block_info, + &mut current_identities, + &mut current_identity_nonce_counter, + &mut current_identity_contract_nonce_counter, + &mut current_votes, + &mut signer, + &mut rng, + &instant_lock_quorums, + ); state_transitions_per_block.insert(block_height, state_transitions.clone()); @@ -743,17 +1051,19 @@ pub(crate) fn continue_chain_for_strategy( proposer.pro_tx_hash.into(), current_quorum_with_test_info, proposed_version, - block_info.clone(), + block_info, round, expected_validation_errors.as_slice(), false, state_transitions.clone(), - strategy.max_tx_bytes_per_block, MimicExecuteBlockOptions { dont_finalize_block: strategy.dont_finalize_block(), rounds_before_finalization: strategy.failure_testing.as_ref().and_then( |failure_testing| failure_testing.rounds_before_successful_block, ), + max_tx_bytes_per_block: strategy.max_tx_bytes_per_block, + independent_process_proposal_verification: strategy + .independent_process_proposal_verification, }, ) .expect("expected to execute a block"), @@ -762,7 +1072,7 @@ pub(crate) fn continue_chain_for_strategy( let MimicExecuteBlockOutcome { state_transaction_results, - withdrawal_transactions: mut withdrawals_this_block, + withdrawal_transactions: withdrawals_this_block, validator_set_update, next_validator_set_hash, root_app_hash, @@ -780,11 +1090,11 @@ pub(crate) fn continue_chain_for_strategy( continue; } - let platform_state = platform.state.read().expect("lock is poisoned"); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); - total_withdrawals.append(&mut withdrawals_this_block); + total_withdrawals.append(withdrawals_this_block); for finalize_block_operation in finalize_block_operations { match finalize_block_operation { @@ -809,7 +1119,6 @@ pub(crate) fn continue_chain_for_strategy( &abci_app, &root_app_hash, &state_transaction_results, - &block_info, &expected_validation_errors, platform_version, ); @@ -821,7 +1130,7 @@ pub(crate) fn continue_chain_for_strategy( query_strategy.query_chain_for_strategy( &ProofVerification { quorum_hash: ¤t_quorum_with_test_info.quorum_hash.into(), - quorum_type: config.quorum_type(), + quorum_type: config.validator_set.quorum_type, app_version, chain_id: drive_abci::mimic::CHAIN_ID.to_string(), core_chain_locked_height: state_id.core_chain_locked_height, @@ -853,6 +1162,8 @@ pub(crate) fn continue_chain_for_strategy( let masternode_identity_balances = if strategy.dont_finalize_block() && i == 0 { BTreeMap::new() } else { + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version().unwrap(); platform .drive .fetch_identities_balances( @@ -861,6 +1172,7 @@ pub(crate) fn continue_chain_for_strategy( .map(|proposer| proposer.pro_tx_hash().into()) .collect(), None, + platform_version, ) .expect("expected to get balances") }; @@ -870,8 +1182,7 @@ pub(crate) fn continue_chain_for_strategy( } else { platform .state - .read() - .expect("lock is poisoned") + .load() .last_committed_block_info() .as_ref() .unwrap() @@ -885,14 +1196,17 @@ pub(crate) fn continue_chain_for_strategy( masternode_identity_balances, identities: current_identities, proposers: proposers_with_updates, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: proposer_versions, + identity_nonce_counter: current_identity_nonce_counter, + identity_contract_nonce_counter: current_identity_contract_nonce_counter, end_epoch_index, end_time_ms: current_time_ms, strategy, withdrawals: total_withdrawals, validator_set_updates, state_transition_results_per_block, + instant_lock_quorums, } } diff --git a/packages/rs-drive-abci/tests/strategy_tests/failures.rs b/packages/rs-drive-abci/tests/strategy_tests/failures.rs index 465b20321db..9c2cb59c924 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/failures.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/failures.rs @@ -1,35 +1,31 @@ #[cfg(test)] mod tests { use crate::execution::run_chain_for_strategy; - use rand::rngs::StdRng; - use rand::SeedableRng; - use std::collections::{BTreeMap, BTreeSet, HashMap}; + use std::collections::{BTreeMap, HashMap}; use strategy_tests::frequency::Frequency; use crate::strategy::{FailureStrategy, NetworkStrategy}; - use strategy_tests::Strategy; + use strategy_tests::{IdentityInsertInfo, StartIdentities, Strategy}; - use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; + use drive_abci::config::{ + ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig, + ValidatorSetConfig, + }; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::{BlockHash, ChainLock}; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; - use dpp::data_contract::document_type::random_document::{ - DocumentFieldFillSize, DocumentFieldFillType, - }; - use dpp::identity::accessors::IdentityGettersV0; - use dpp::platform_value::Value; - use dpp::prelude::{Identifier, Identity}; + use dpp::tests::json_document::json_document_to_created_contract; use dpp::version::PlatformVersion; use drive_abci::test::helpers::setup::TestPlatformBuilder; - use simple_signer::signer::SimpleSigner; - use strategy_tests::operations::{DocumentAction, DocumentOp, Operation, OperationType}; - use tenderdash_abci::proto::types::CoreChainLock; #[test] fn run_chain_insert_one_new_identity_and_a_contract_with_bad_update() { let platform_version = PlatformVersion::latest(); let contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -37,6 +33,7 @@ mod tests { let mut contract_update_1 = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable-bad-update-skipped-position.json", + 2, false, platform_version, ) @@ -47,26 +44,26 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![( - contract, - Some(BTreeMap::from([(3, contract_update_1)])), - )], + start_contracts: vec![(contract, Some(BTreeMap::from([(3, contract_update_1)])))], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: Some(FailureStrategy { @@ -74,37 +71,35 @@ mod tests { dont_finalize_block: false, expect_every_block_errors_with_codes: vec![], rounds_before_successful_block: None, - expect_specific_block_errors_with_codes: HashMap::from([(3, vec![1067])]), //missing position (we skipped pos 6) + expect_specific_block_errors_with_codes: HashMap::from([(3, vec![10411])]), //missing position (we skipped pos 6) }), query_testing: None, verify_state_transition_results: true, ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15, &mut None); outcome .abci_app @@ -114,7 +109,7 @@ mod tests { outcome .strategy .strategy - .contracts_with_updates + .start_contracts .first() .unwrap() .0 @@ -135,23 +130,20 @@ mod tests { fn run_chain_block_failure_on_genesis_block_correctly_fixes_itself() { let mut strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: Some(FailureStrategy { @@ -166,14 +158,16 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() @@ -186,223 +180,216 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - let core_block_height = if core_block_heights.len() == 1 { + let block_height = if core_block_heights.len() == 1 { *core_block_heights.first().unwrap() } else { core_block_heights.remove(0) }; - Ok(CoreChainLock { - core_block_height, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); - run_chain_for_strategy(&mut platform, 1, strategy.clone(), config.clone(), 15); + run_chain_for_strategy( + &mut platform, + 1, + strategy.clone(), + config.clone(), + 15, + &mut None, + ); //platform block didn't complete, so it should get another init chain strategy.failure_testing = None; - run_chain_for_strategy(&mut platform, 15, strategy, config, 15); + run_chain_for_strategy(&mut platform, 15, strategy, config, 15, &mut None); } - #[test] - fn run_chain_block_two_state_transitions_conflicting_unique_index() { - // In this test we try to insert two state transitions with the same unique index - // We use the dpns contract and we insert two documents both with the same "name" - // This is a common scenario we should see quite often - let config = PlatformConfig { - quorum_size: 100, - execution: ExecutionConfig { - //we disable document triggers because we are using dpns and dpns needs a preorder - use_document_triggers: false, - validator_set_quorum_rotation_block_count: 25, - ..Default::default() - }, - block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), - ..Default::default() - }; - let mut platform = TestPlatformBuilder::new() - .with_config(config.clone()) - .build_with_mock_rpc(); - - let platform_version = PlatformVersion::latest(); - - let mut rng = StdRng::seed_from_u64(567); - - let mut simple_signer = SimpleSigner::default(); - - let (identity1, keys) = - Identity::random_identity_with_main_keys_with_private_key::>( - 2, - &mut rng, - platform_version, - ) - .unwrap(); - - simple_signer.add_keys(keys); - - let (identity2, keys) = - Identity::random_identity_with_main_keys_with_private_key::>( - 2, - &mut rng, - platform_version, - ) - .unwrap(); - - simple_signer.add_keys(keys); - - let start_identities = strategy_tests::transitions::create_state_transitions_for_identities( - vec![identity1, identity2], - &mut simple_signer, - &mut rng, - platform_version, - ); - - let document_op_1 = DocumentOp { - contract: platform.drive.system_contracts.dpns_contract.clone(), - action: DocumentAction::DocumentActionInsertSpecific( - BTreeMap::from([ - ("label".into(), "simon1".into()), - ("normalizedLabel".into(), "s1m0n1".into()), - ("normalizedParentDomainName".into(), "dash".into()), - ( - "records".into(), - BTreeMap::from([( - "dashUniqueIdentityId", - Value::from(start_identities.first().unwrap().0.id()), - )]) - .into(), - ), - ]), - Some(start_identities.first().unwrap().0.id()), - DocumentFieldFillType::FillIfNotRequired, - DocumentFieldFillSize::AnyDocumentFillSize, - ), - document_type: platform - .drive - .system_contracts - .dpns_contract - .document_type_for_name("domain") - .expect("expected a profile document type") - .to_owned_document_type(), - }; - - let document_op_2 = DocumentOp { - contract: platform.drive.system_contracts.dpns_contract.clone(), - action: DocumentAction::DocumentActionInsertSpecific( - BTreeMap::from([ - ("label".into(), "simon1".into()), - ("normalizedLabel".into(), "s1m0n1".into()), - ("normalizedParentDomainName".into(), "dash".into()), - ( - "records".into(), - BTreeMap::from([( - "dashUniqueIdentityId", - Value::from(start_identities.last().unwrap().0.id()), - )]) - .into(), - ), - ]), - Some(start_identities.last().unwrap().0.id()), - DocumentFieldFillType::FillIfNotRequired, - DocumentFieldFillSize::AnyDocumentFillSize, - ), - document_type: platform - .drive - .system_contracts - .dpns_contract - .document_type_for_name("domain") - .expect("expected a profile document type") - .to_owned_document_type(), - }; - - let strategy = NetworkStrategy { - strategy: Strategy { - contracts_with_updates: vec![], - operations: vec![ - Operation { - op_type: OperationType::Document(document_op_1), - frequency: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, - }, - }, - Operation { - op_type: OperationType::Document(document_op_2), - frequency: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, - }, - }, - ], - start_identities, - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, - signer: Some(simple_signer), - }, - total_hpmns: 100, - extra_normal_mns: 0, - quorum_count: 24, - upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, - - proposer_strategy: Default::default(), - rotate_quorums: false, - failure_testing: Some(FailureStrategy { - deterministic_start_seed: None, - dont_finalize_block: false, - expect_every_block_errors_with_codes: vec![4009], //duplicate unique index - rounds_before_successful_block: None, - expect_specific_block_errors_with_codes: Default::default(), - }), - query_testing: None, - verify_state_transition_results: true, - ..Default::default() - }; - - let mut core_block_heights = vec![10, 11]; - - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - let core_block_height = if core_block_heights.len() == 1 { - *core_block_heights.first().unwrap() - } else { - core_block_heights.remove(0) - }; - Ok(CoreChainLock { - core_block_height, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - // On the first block we only have identities and contracts - let outcome = - run_chain_for_strategy(&mut platform, 2, strategy.clone(), config.clone(), 15); - - let state_transitions_block_2 = &outcome - .state_transition_results_per_block - .get(&2) - .expect("expected to get block 2"); - - let first_document_insert_result = &state_transitions_block_2 - .first() - .as_ref() - .expect("expected a document insert") - .1; - assert_eq!(first_document_insert_result.code, 0); - - let second_document_insert_result = &state_transitions_block_2.get(1); - - // Second document should not be present - assert!(second_document_insert_result.is_none()); - } + // #[test] + // fn run_chain_block_two_state_transitions_conflicting_unique_index() { + // // In this test we try to insert two state transitions with the same unique index + // // We use the dpns contract and we insert two documents both with the same "name" + // // This is a common scenario we should see quite often + // let config = PlatformConfig { + // validator_set_quorum_quorum_size: 100, + // validator_set_quorum_type: QuorumType::Llmq100_67, + // chain_lock_quorum_type: QuorumType::Llmq100_67, + // execution: ExecutionConfig { + // //we disable document triggers because we are using dpns and dpns needs a preorder + // use_document_triggers: false, + // ..Default::default() + // }, + // block_spacing_ms: 3000, + // testing_configs: PlatformTestConfig::default_with_no_block_signing(), + // ..Default::default() + // }; + // let mut platform = TestPlatformBuilder::new() + // .with_config(config.clone()) + // .build_with_mock_rpc(); + + // let platform_version = PlatformVersion::latest(); + + // let mut rng = StdRng::seed_from_u64(567); + + // let mut simple_signer = SimpleSigner::default(); + + // let (identity1, keys) = + // Identity::random_identity_with_main_keys_with_private_key::>( + // 2, + // &mut rng, + // platform_version, + // ) + // .unwrap(); + + // simple_signer.add_keys(keys); + + // let (identity2, keys) = + // Identity::random_identity_with_main_keys_with_private_key::>( + // 2, + // &mut rng, + // platform_version, + // ) + // .unwrap(); + + // simple_signer.add_keys(keys); + + // let start_identities = strategy_tests::transitions::create_state_transitions_for_identities( + // vec![identity1, identity2], + // &mut simple_signer, + // &mut rng, + // platform_version, + // ); + + // let dpns_contract = platform + // .drive + // .cache + // .system_data_contracts + // .read_dpns() + // .clone(); + + // let dpns_contract_for_type = dpns_contract.clone(); + + // let domain_document_type_ref = dpns_contract_for_type + // .document_type_for_name("domain") + // .expect("expected a profile document type"); + + // let document_op_1 = DocumentOp { + // contract: dpns_contract.clone(), + // action: DocumentAction::DocumentActionInsertSpecific( + // BTreeMap::from([ + // ("label".into(), "simon1".into()), + // ("normalizedLabel".into(), "s1m0n1".into()), + // ("normalizedParentDomainName".into(), "dash".into()), + // ( + // "records".into(), + // BTreeMap::from([( + // "identity", + // Value::from(start_identities.first().unwrap().0.id()), + // )]) + // .into(), + // ), + // ]), + // Some(start_identities.first().unwrap().0.id()), + // DocumentFieldFillType::FillIfNotRequired, + // DocumentFieldFillSize::AnyDocumentFillSize, + // ), + // document_type: domain_document_type_ref.to_owned_document_type(), + // }; + + // let document_op_2 = DocumentOp { + // contract: dpns_contract, + // action: DocumentAction::DocumentActionInsertSpecific( + // BTreeMap::from([ + // ("label".into(), "simon1".into()), + // ("normalizedLabel".into(), "s1m0n1".into()), + // ("normalizedParentDomainName".into(), "dash".into()), + // ( + // "records".into(), + // BTreeMap::from([( + // "identity", + // Value::from(start_identities.last().unwrap().0.id()), + // )]) + // .into(), + // ), + // ]), + // Some(start_identities.last().unwrap().0.id()), + // DocumentFieldFillType::FillIfNotRequired, + // DocumentFieldFillSize::AnyDocumentFillSize, + // ), + // document_type: domain_document_type_ref.to_owned_document_type(), + // }; + + // let strategy = NetworkStrategy { + // strategy: Strategy { + // contracts_with_updates: vec![], + // operations: vec![ + // Operation { + // op_type: OperationType::Document(document_op_1), + // frequency: Frequency { + // times_per_block_range: 1..2, + // chance_per_block: None, + // }, + // }, + // Operation { + // op_type: OperationType::Document(document_op_2), + // frequency: Frequency { + // times_per_block_range: 1..2, + // chance_per_block: None, + // }, + // }, + // ], + // start_identities, + // identities_inserts: Frequency { + // times_per_block_range: Default::default(), + // chance_per_block: None, + // }, + // identity_contract_nonce_gaps: None, + // signer: Some(simple_signer), + // }, + // total_hpmns: 100, + // extra_normal_mns: 0, + // validator_quorum_count: 24, + // chain_lock_quorum_count: 24, + // upgrading_info: None, + // core_height_increase: KnownCoreHeightIncreases(vec![10, 11]), + // proposer_strategy: Default::default(), + // rotate_quorums: false, + // failure_testing: Some(FailureStrategy { + // deterministic_start_seed: None, + // dont_finalize_block: false, + // expect_every_block_errors_with_codes: vec![4009], //duplicate unique index + // rounds_before_successful_block: None, + // expect_specific_block_errors_with_codes: Default::default(), + // }), + // query_testing: None, + // verify_state_transition_results: true, + // ..Default::default() + // }; + + // // On the first block we only have identities and contracts + // let outcome = + // run_chain_for_strategy(&mut platform, 2, strategy.clone(), config.clone(), 15); + + // let state_transitions_block_2 = &outcome + // .state_transition_results_per_block + // .get(&2) + // .expect("expected to get block 2"); + + // let first_document_insert_result = &state_transitions_block_2 + // .first() + // .expect("expected a document insert") + // .1; + + // assert_eq!(first_document_insert_result.code, 0); + + // let second_document_insert_result = &state_transitions_block_2 + // .get(1) + // .expect("expected an invalid state transition") + // .1; + + // // Second document should fail with DuplicateUniqueIndexError + // assert_eq!(second_document_insert_result.code, 4009); + // } } diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index c5183dabe1a..ed4b1655b1f 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -1,45 +1,16 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - //! Execution Tests //! extern crate core; -use dashcore_rpc::dashcore::QuorumHash; - use dpp::bls_signatures::PrivateKey as BlsPrivateKey; use drive_abci::test::helpers::setup::TestPlatformBuilder; use drive_abci::{config::PlatformConfig, test::helpers::setup::TempPlatform}; use strategy_tests::frequency::Frequency; +use dpp::dashcore::transaction::special_transaction::TransactionPayload::AssetUnlockPayloadType; +use dpp::dashcore::Transaction; use std::collections::BTreeMap; use strategy::{ @@ -47,96 +18,101 @@ use strategy::{ }; use strategy_tests::Strategy; +mod chain_lock_update; mod core_update_tests; mod execution; mod failures; mod masternode_list_item_helpers; mod masternodes; +mod patch_platform_tests; mod query; mod strategy; mod upgrade_fork_tests; mod verify_state_transitions; +mod voting_tests; pub type BlockHeight = u64; +fn asset_unlock_index(tx: &Transaction) -> u64 { + let Some(AssetUnlockPayloadType(ref payload)) = tx.special_transaction_payload else { + panic!("expected to get AssetUnlockPayloadType"); + }; + payload.base.index +} + #[cfg(test)] mod tests { use super::*; - use crate::execution::{continue_chain_for_strategy, run_chain_for_strategy}; + use crate::execution::{continue_chain_for_strategy, run_chain_for_strategy, GENESIS_TIME_MS}; use crate::query::QueryStrategy; use crate::strategy::{FailureStrategy, MasternodeListChangesStrategy}; use dashcore_rpc::dashcore::hashes::Hash; use dashcore_rpc::dashcore::BlockHash; - use dashcore_rpc::dashcore_rpc_json::ExtendedQuorumDetails; + use dashcore_rpc::dashcore_rpc_json::AssetUnlockStatus; + use dashcore_rpc::json::{AssetUnlockStatusResult, QuorumType}; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; - use strategy_tests::operations::DocumentAction::DocumentActionReplace; + use std::sync::{Arc, Mutex}; + use strategy_tests::operations::DocumentAction::{ + DocumentActionReplaceRandom, DocumentActionTransferRandom, + }; use strategy_tests::operations::{ DocumentAction, DocumentOp, IdentityUpdateOp, Operation, OperationType, }; + use strategy_tests::{IdentityInsertInfo, StartIdentities}; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; + use dpp::dashcore::bls_sig_utils::BLSSignature; + use dpp::dashcore::ChainLock; + use dpp::dashcore::Txid; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::document_type::random_document::{ DocumentFieldFillSize, DocumentFieldFillType, }; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + use dpp::system_data_contracts::withdrawals_contract; use dpp::tests::json_document::json_document_to_created_contract; use dpp::util::hash::hash_to_hex_string; use dpp::version::PlatformVersion; - use drive_abci::config::{ExecutionConfig, PlatformTestConfig}; + use drive::config::DEFAULT_QUERY_LIMIT; + use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; + use drive_abci::config::{ + ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformTestConfig, ValidatorSetConfig, + }; + use drive_abci::logging::LogLevel; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; - use drive_abci::rpc::core::QuorumListExtendedInfo; use itertools::Itertools; - use rand::distributions::uniform::SampleBorrow; + use rand::prelude::StdRng; + use rand::SeedableRng; use tenderdash_abci::proto::abci::{RequestInfo, ResponseInfo}; - use tenderdash_abci::proto::types::CoreChainLock; - use tenderdash_abci::Application; - - pub fn generate_quorums_extended_info(n: u32) -> QuorumListExtendedInfo { - let mut quorums = QuorumListExtendedInfo::new(); - - for i in 0..n { - let i_bytes = [i as u8; 32]; - - let hash = QuorumHash::from_byte_array(i_bytes); - let details = ExtendedQuorumDetails { - creation_height: i, - health_ratio: (i as f32) / (n as f32), - mined_block_hash: BlockHash::from_slice(&i_bytes).unwrap(), - num_valid_members: i, - quorum_index: Some(i), - }; - - if let Some(v) = quorums.insert(hash, details) { - panic!("duplicate record {:?}={:?}", hash, v) - } - } - quorums - } + use dpp::data_contract::document_type::v0::random_document_type::{ + FieldMinMaxBounds, FieldTypeWeights, RandomDocumentTypeParameters, + }; + use dpp::identity::{Identity, KeyType, Purpose, SecurityLevel}; + use dpp::state_transition::StateTransition; + use simple_signer::signer::SimpleSigner; + use strategy_tests::transitions::create_state_transitions_for_identities; + use tenderdash_abci::Application; #[test] fn run_chain_nothing_happening() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -145,54 +121,43 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..ExecutionConfig::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - run_chain_for_strategy(&mut platform, 100, strategy, config, 15); + run_chain_for_strategy(&mut platform, 100, strategy, config, 15, &mut None); } #[test] fn run_chain_block_signing() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -201,10 +166,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..ExecutionConfig::default() }, block_spacing_ms: 3000, @@ -215,40 +182,27 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - run_chain_for_strategy(&mut platform, 50, strategy, config, 13); + run_chain_for_strategy(&mut platform, 50, strategy, config, 13, &mut None); } #[test] fn run_chain_stop_and_restart() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -257,10 +211,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..ExecutionConfig::default() }, block_spacing_ms: 3000, @@ -274,45 +230,44 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. - } = run_chain_for_strategy(&mut platform, 15, strategy.clone(), config.clone(), 40); + } = run_chain_for_strategy( + &mut platform, + 15, + strategy.clone(), + config.clone(), + 40, + &mut None, + ); + + let state = abci_app.platform.state.load(); + + let protocol_version = state.current_protocol_version_in_consensus(); + + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); let known_root_hash = abci_app .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("expected root hash"); - let state = abci_app.platform.state.read().unwrap(); - - let protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = - PlatformVersion::get(protocol_version).expect("expected platform version"); - abci_app .platform - .recreate_state(platform_version) + .reload_state_from_storage(platform_version) .expect("expected to recreate state"); let ResponseInfo { @@ -333,11 +288,9 @@ mod tests { assert_eq!(last_block_height, 15); assert_eq!(last_block_app_hash, known_root_hash); - let block_start = abci_app - .platform - .state - .read() - .unwrap() + let state = abci_app.platform.state.load(); + + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -352,11 +305,15 @@ mod tests { core_height_start: 1, block_count: 30, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config, @@ -368,23 +325,20 @@ mod tests { fn run_chain_stop_and_restart_multiround() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: Some(FailureStrategy { @@ -399,10 +353,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..ExecutionConfig::default() }, block_spacing_ms: 3000, @@ -416,45 +372,44 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. - } = run_chain_for_strategy(&mut platform, 15, strategy.clone(), config.clone(), 40); + } = run_chain_for_strategy( + &mut platform, + 15, + strategy.clone(), + config.clone(), + 40, + &mut None, + ); + + let state = abci_app.platform.state.load(); + + let protocol_version = state.current_protocol_version_in_consensus(); + + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); let known_root_hash = abci_app .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("expected root hash"); - let state = abci_app.platform.state.read().unwrap(); - - let protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = - PlatformVersion::get(protocol_version).expect("expected platform version"); - abci_app .platform - .recreate_state(platform_version) + .reload_state_from_storage(platform_version) .expect("expected to recreate state"); let ResponseInfo { @@ -475,11 +430,9 @@ mod tests { assert_eq!(last_block_height, 15); assert_eq!(last_block_app_hash, known_root_hash); - let block_start = abci_app - .platform - .state - .read() - .unwrap() + let state = abci_app.platform.state.load(); + + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -494,11 +447,15 @@ mod tests { core_height_start: 1, block_count: 30, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config, @@ -511,23 +468,26 @@ mod tests { let platform_version = PlatformVersion::latest(); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -536,30 +496,28 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15, &mut None); let balance = outcome .abci_app @@ -573,30 +531,30 @@ mod tests { .expect("expected to fetch balances") .expect("expected to have an identity to get balance from"); - assert_eq!(balance, 99869098220) + assert_eq!(balance, 99864012200) } #[test] fn run_chain_core_height_randomly_increasing() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.01), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -605,54 +563,46 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); + run_chain_for_strategy(&mut platform, 1000, strategy, config, 15, &mut None); } #[test] fn run_chain_core_height_randomly_increasing_with_epoch_change() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -662,31 +612,24 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: hour_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15, &mut None); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome .masternode_identity_balances @@ -699,23 +642,23 @@ mod tests { fn run_chain_core_height_randomly_increasing_with_quick_epoch_change() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -726,32 +669,25 @@ mod tests { let hour_in_s = 60 * 60; let three_mins_in_ms = 1000 * 60 * 3; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + epoch_time_length_s: hour_in_s, ..Default::default() }, block_spacing_ms: three_mins_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15, &mut None); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome .masternode_identity_balances @@ -767,23 +703,22 @@ mod tests { let platform_version = PlatformVersion::latest(); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 5..6, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -792,50 +727,56 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 300, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); let ChainExecutionOutcome { abci_app, .. } = - run_chain_for_strategy(&mut platform, 2000, strategy, config, 40); + run_chain_for_strategy(&mut platform, 2000, strategy, config, 40, &mut None); // With these params if we didn't rotate we would have at most 240 // of the 500 hpmns that could get paid, however we are expecting that most // will be able to propose a block (and then get paid later on). let platform = abci_app.platform; - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); platform .drive .fetch_versions_with_counter(None, &platform_version.drive) .expect("expected to get versions"); + let state = abci_app.platform.state.load(); + assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -844,30 +785,30 @@ mod tests { .index, 0 ); - assert!(counter.get(&1).unwrap() > &240); + assert!(counter.get(&1).unwrap().unwrap() > &240); } #[test] fn run_chain_core_height_randomly_increasing_with_quorum_updates_new_proposers() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: Some(0.2), - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Frequency { times_per_block_range: 1..3, @@ -882,38 +823,46 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 300, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); let ChainExecutionOutcome { abci_app, .. } = - run_chain_for_strategy(&mut platform, 300, strategy, config, 43); + run_chain_for_strategy(&mut platform, 300, strategy, config, 43, &mut None); // With these params if we add new mns the hpmn masternode list would be 100, but we // can expect it to be much higher. let platform = abci_app.platform; - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); assert!(platform_state.hpmn_masternode_list().len() > 100); } @@ -922,23 +871,23 @@ mod tests { fn run_chain_core_height_randomly_increasing_with_quorum_updates_changing_proposers() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: Some(0.2), - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Frequency { times_per_block_range: 1..3, @@ -957,37 +906,45 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 300, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); let ChainExecutionOutcome { abci_app, .. } = - run_chain_for_strategy(&mut platform, 300, strategy, config, 43); + run_chain_for_strategy(&mut platform, 300, strategy, config, 43, &mut None); // With these params if we add new mns the hpmn masternode list would be randomly different than 100. let platform = abci_app.platform; - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); assert_ne!(platform_state.hpmn_masternode_list().len(), 100); } @@ -996,23 +953,23 @@ mod tests { fn run_chain_core_height_randomly_increasing_with_quorum_updates_updating_proposers() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: Some(0.2), - }, + }), proposer_strategy: MasternodeListChangesStrategy { updated_hpmns: Frequency { times_per_block_range: 1..3, @@ -1027,41 +984,49 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 10, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 300, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); let ChainExecutionOutcome { abci_app, proposers, .. - } = run_chain_for_strategy(&mut platform, 300, strategy, config, 43); + } = run_chain_for_strategy(&mut platform, 300, strategy, config, 43, &mut None); // With these params if we add new mns the hpmn masternode list would be randomly different than 100. let platform_version = PlatformVersion::latest(); let platform = abci_app.platform; - let _platform_state = platform.state.read().unwrap(); + let _platform_state = platform.state.load(); // We need to find if any masternode has ever had their keys disabled. @@ -1094,26 +1059,30 @@ mod tests { #[test] fn run_chain_insert_one_new_identity_per_block_with_block_signing() { - // drive_abci::logging::Loggers::default().try_install().ok(); + drive_abci::logging::init_for_tests(LogLevel::Silent); + let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1124,13 +1093,16 @@ mod tests { }, }), verify_state_transition_results: true, + sign_instant_locks: true, ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, @@ -1140,17 +1112,8 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15, &mut None); assert_eq!(outcome.identities.len(), 100); } @@ -1159,23 +1122,26 @@ mod tests { fn run_chain_insert_one_new_identity_per_block_with_epoch_change() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1185,31 +1151,29 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 150, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 150, strategy, config, 15, &mut None); assert_eq!(outcome.identities.len(), 150); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -1217,6 +1181,12 @@ mod tests { .iter() .all(|(_, balance)| *balance != 0); assert!(all_have_balances, "all masternodes should have a balance"); + + let state = outcome.abci_app.platform.state.load(); + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); + assert_eq!( hex::encode( outcome @@ -1224,11 +1194,11 @@ mod tests { .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .unwrap() ), - "3fcae6c74a7c0cf2ed8613a6e110f3bdc544a4a7b5b51a2620108f845241c65b".to_string() + "975735252c11cea7ef3fbba86928077e37ebe1926972e6ae38e237ce0864100c".to_string() ) } @@ -1237,6 +1207,7 @@ mod tests { let platform_version = PlatformVersion::latest(); let contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1244,23 +1215,26 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![(contract, None)], + start_contracts: vec![(contract, None)], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1269,30 +1243,28 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 1, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 1, strategy, config, 15, &mut None); outcome .abci_app @@ -1302,7 +1274,7 @@ mod tests { outcome .strategy .strategy - .contracts_with_updates + .start_contracts .first() .unwrap() .0 @@ -1319,11 +1291,107 @@ mod tests { .expect("expected to get a contract"); } + #[test] + fn run_chain_insert_one_new_identity_and_many_big_contracts() { + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![Operation { + op_type: OperationType::ContractCreate( + RandomDocumentTypeParameters { + new_fields_optional_count_range: 1..30, + new_fields_required_count_range: 1..40, + new_indexes_count_range: 10..11, + field_weights: FieldTypeWeights { + string_weight: 50, + float_weight: 50, + integer_weight: 50, + date_weight: 50, + boolean_weight: 20, + byte_array_weight: 70, + }, + field_bounds: FieldMinMaxBounds { + string_min_len: 1..10, + string_has_min_len_chance: 0.5, + string_max_len: 10..63, + string_has_max_len_chance: 0.5, + integer_min: 1..10, + integer_has_min_chance: 0.5, + integer_max: 10..10000, + integer_has_max_chance: 0.5, + float_min: 0.1..10.0, + float_has_min_chance: 0.5, + float_max: 10.0..1000.0, + float_has_max_chance: 0.5, + date_min: 0, + date_max: 0, + byte_array_min_len: 1..10, + byte_array_has_min_len_chance: 0.0, + byte_array_max_len: 10..255, + byte_array_has_max_len_chance: 0.0, + }, + keep_history_chance: 1.0, + documents_mutable_chance: 1.0, + documents_can_be_deleted_chance: 1.0, + }, + 30..31, + ), + frequency: Frequency { + times_per_block_range: 30..31, + chance_per_block: None, + }, + }], + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() + }, + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + let config = PlatformConfig { + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + ..Default::default() + }, + block_spacing_ms: 3000, + testing_configs: PlatformTestConfig::default_minimal_verifications(), + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + run_chain_for_strategy(&mut platform, 30, strategy, config, 15, &mut None); + } + #[test] fn run_chain_insert_one_new_identity_and_a_contract_with_updates() { let platform_version = PlatformVersion::latest(); let contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1331,6 +1399,7 @@ mod tests { let mut contract_update_1 = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable-update-1.json", + 1, true, platform_version, ) @@ -1341,6 +1410,7 @@ mod tests { let mut contract_update_2 = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable-update-2.json", + 1, true, platform_version, ) @@ -1350,7 +1420,7 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![( + start_contracts: vec![( contract, Some(BTreeMap::from([ (3, contract_update_1), @@ -1358,21 +1428,24 @@ mod tests { ])), )], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1381,30 +1454,28 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15, &mut None); outcome .abci_app @@ -1414,7 +1485,7 @@ mod tests { outcome .strategy .strategy - .contracts_with_updates + .start_contracts .first() .unwrap() .0 @@ -1436,6 +1507,7 @@ mod tests { let platform_version = PlatformVersion::latest(); let created_contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1457,7 +1529,7 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![(created_contract, None)], + start_contracts: vec![(created_contract, None)], operations: vec![Operation { op_type: OperationType::Document(document_op), frequency: Frequency { @@ -1465,21 +1537,24 @@ mod tests { chance_per_block: None, }, }], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1488,30 +1563,23 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - run_chain_for_strategy(&mut platform, 100, strategy, config, 15); + + run_chain_for_strategy(&mut platform, 100, strategy, config, 15, &mut None); } #[test] @@ -1519,6 +1587,7 @@ mod tests { let platform_version = PlatformVersion::latest(); let created_contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1540,7 +1609,7 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![(created_contract, None)], + start_contracts: vec![(created_contract, None)], operations: vec![Operation { op_type: OperationType::Document(document_op), frequency: Frequency { @@ -1548,21 +1617,24 @@ mod tests { chance_per_block: None, }, }], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1572,31 +1644,30 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let block_count = 120; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); assert_eq!(outcome.identities.len() as u64, block_count); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -1612,6 +1683,7 @@ mod tests { let platform_version = PlatformVersion::latest(); let created_contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1642,7 +1714,7 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![(created_contract, None)], + start_contracts: vec![(created_contract, None)], operations: vec![ Operation { op_type: OperationType::Document(document_insertion_op), @@ -1659,21 +1731,24 @@ mod tests { }, }, ], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1683,31 +1758,30 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let block_count = 120; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); assert_eq!(outcome.identities.len() as u64, block_count); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -1715,6 +1789,25 @@ mod tests { .iter() .all(|(_, balance)| *balance != 0); assert!(all_have_balances, "all masternodes should have a balance"); + + let issues = outcome + .abci_app + .platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); } #[test] @@ -1723,6 +1816,7 @@ mod tests { let platform_version = PlatformVersion::latest(); let created_contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1753,38 +1847,41 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![(created_contract, None)], + start_contracts: vec![(created_contract, None)], operations: vec![ Operation { op_type: OperationType::Document(document_insertion_op), frequency: Frequency { - times_per_block_range: 1..10, + times_per_block_range: 1..7, chance_per_block: None, }, }, Operation { op_type: OperationType::Document(document_deletion_op), frequency: Frequency { - times_per_block_range: 1..10, + times_per_block_range: 1..7, chance_per_block: None, }, }, ], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1794,14 +1891,21 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; @@ -1809,17 +1913,9 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); assert_eq!(outcome.identities.len() as u64, block_count); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -1827,6 +1923,10 @@ mod tests { .iter() .all(|(_, balance)| *balance != 0); assert!(all_have_balances, "all masternodes should have a balance"); + let state = outcome.abci_app.platform.state.load(); + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); assert_eq!( hex::encode( outcome @@ -1834,20 +1934,21 @@ mod tests { .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .unwrap() ), - "a19831eae73cfd6cb4fcb405e4725495b71f855842761312108c1bfc658417ba".to_string() + "0cc2c7a7749a0ce47a4abcd1f4db21d07734f96d09ffe08d6500a8d09a3455a1".to_string() ) } #[test] - fn run_chain_insert_many_new_identity_per_block_many_document_insertions_and_deletions_with_epoch_change( + fn run_chain_insert_one_new_identity_per_block_many_document_insertions_and_deletions_with_nonce_gaps_with_epoch_change( ) { let platform_version = PlatformVersion::latest(); let created_contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1878,38 +1979,44 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![(created_contract, None)], + start_contracts: vec![(created_contract, None)], operations: vec![ Operation { op_type: OperationType::Document(document_insertion_op), frequency: Frequency { - times_per_block_range: 1..40, + times_per_block_range: 1..7, chance_per_block: None, }, }, Operation { op_type: OperationType::Document(document_deletion_op), frequency: Frequency { - times_per_block_range: 1..15, + times_per_block_range: 1..7, chance_per_block: None, }, }, ], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..30, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: Some(Frequency { + times_per_block_range: 1..3, + chance_per_block: Some(0.5), + }), signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1917,52 +2024,66 @@ mod tests { verify_state_transition_results: true, ..Default::default() }; - let day_in_ms = 1000 * 60 * 60 * 24; - let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, - epoch_time_length_s: 1576800, + ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; - let block_count = 30; + + let block_count = 120; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); - assert_eq!(outcome.identities.len() as u64, 421); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + assert_eq!(outcome.identities.len() as u64, block_count); assert_eq!(outcome.masternode_identity_balances.len(), 100); - let balance_count = outcome + let all_have_balances = outcome .masternode_identity_balances - .into_iter() - .filter(|(_, balance)| *balance != 0) - .count(); - assert_eq!(balance_count, 19); // 1 epoch worth of proposers + .iter() + .all(|(_, balance)| *balance != 0); + assert!(all_have_balances, "all masternodes should have a balance"); + let state = outcome.abci_app.platform.state.load(); + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); + assert_eq!( + hex::encode( + outcome + .abci_app + .platform + .drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .unwrap() + ), + "5a08b133a19b11b09eaba6763ad2893c2bcbcc645fb698298790bb5d26e551e0".to_string() + ) } #[test] - fn run_chain_insert_many_new_identity_per_block_many_document_insertions_updates_and_deletions_with_epoch_change( + fn run_chain_insert_one_new_identity_per_block_many_document_insertions_and_deletions_with_max_nonce_gaps_with_epoch_change( ) { let platform_version = PlatformVersion::latest(); let created_contract = json_document_to_created_contract( "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, true, platform_version, ) @@ -1982,15 +2103,6 @@ mod tests { .to_owned_document_type(), }; - let document_replace_op = DocumentOp { - contract: contract.clone(), - action: DocumentActionReplace, - document_type: contract - .document_type_for_name("contactRequest") - .expect("expected a profile document type") - .to_owned_document_type(), - }; - let document_deletion_op = DocumentOp { contract: contract.clone(), action: DocumentAction::DocumentActionDelete, @@ -2002,45 +2114,44 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![(created_contract, None)], + start_contracts: vec![(created_contract, None)], operations: vec![ Operation { op_type: OperationType::Document(document_insertion_op), frequency: Frequency { - times_per_block_range: 1..40, - chance_per_block: None, - }, - }, - Operation { - op_type: OperationType::Document(document_replace_op), - frequency: Frequency { - times_per_block_range: 1..5, + times_per_block_range: 1..7, chance_per_block: None, }, }, Operation { op_type: OperationType::Document(document_deletion_op), frequency: Frequency { - times_per_block_range: 1..5, + times_per_block_range: 1..7, chance_per_block: None, }, }, ], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..6, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: Some(Frequency { + times_per_block_range: 24..25, + chance_per_block: Some(1.0), + }), signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2048,37 +2159,874 @@ mod tests { verify_state_transition_results: true, ..Default::default() }; - let day_in_ms = 1000 * 60 * 60 * 24; - let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, - epoch_time_length_s: 1576800, + ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), + ..Default::default() + }; + + let block_count = 10; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + for tx_results_per_block in outcome.state_transition_results_per_block.values() { + for (state_transition, result) in tx_results_per_block { + assert_eq!( + result.code, 0, + "state transition got code {} : {:?}", + result.code, state_transition + ); + } + } + } + + #[test] + fn run_chain_insert_one_new_identity_per_block_many_document_insertions_and_deletions_with_higher_than_max_nonce_gaps_with_epoch_change( + ) { + let platform_version = PlatformVersion::latest(); + let created_contract = json_document_to_created_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, + true, + platform_version, + ) + .expect("expected to get contract from a json document"); + + let contract = created_contract.data_contract(); + + let document_insertion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionInsertRandom( + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_deletion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionDelete, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![(created_contract, None)], + operations: vec![ + Operation { + op_type: OperationType::Document(document_insertion_op), + frequency: Frequency { + times_per_block_range: 1..7, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_deletion_op), + frequency: Frequency { + times_per_block_range: 1..7, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() + }, + + identity_contract_nonce_gaps: Some(Frequency { + times_per_block_range: 25..26, + chance_per_block: Some(1.0), + }), + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + let day_in_ms = 1000 * 60 * 60 * 24; + let config = PlatformConfig { + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + ..Default::default() + }, + block_spacing_ms: day_in_ms, + testing_configs: PlatformTestConfig::default_minimal_verifications(), + ..Default::default() + }; + + let block_count = 10; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + for tx_results_per_block in outcome.state_transition_results_per_block.values() { + for (state_transition, _unused_result) in tx_results_per_block { + // We can't ever get a documents batch transition, because the proposer will remove it from a block + assert!(!matches!( + state_transition, + StateTransition::DocumentsBatch(_) + )); + } + } + } + + #[test] + fn run_chain_insert_many_new_identity_per_block_many_document_insertions_and_deletions_with_epoch_change( + ) { + let platform_version = PlatformVersion::latest(); + let created_contract = json_document_to_created_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, + true, + platform_version, + ) + .expect("expected to get contract from a json document"); + + let contract = created_contract.data_contract(); + + let document_insertion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionInsertRandom( + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_deletion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionDelete, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![(created_contract, None)], + operations: vec![ + Operation { + op_type: OperationType::Document(document_insertion_op), + frequency: Frequency { + times_per_block_range: 1..40, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_deletion_op), + frequency: Frequency { + times_per_block_range: 1..15, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..30, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), + }, + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let day_in_ms = 1000 * 60 * 60 * 24; + + let config = PlatformConfig { + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + epoch_time_length_s: 1576800, + ..Default::default() + }, + block_spacing_ms: day_in_ms, + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + ..Default::default() + }; + let block_count = 30; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + assert_eq!(outcome.identities.len() as u64, 472); + assert_eq!(outcome.masternode_identity_balances.len(), 100); + let balance_count = outcome + .masternode_identity_balances + .into_iter() + .filter(|(_, balance)| *balance != 0) + .count(); + assert_eq!(balance_count, 19); // 1 epoch worth of proposers + + let issues = outcome + .abci_app + .platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn run_chain_insert_many_new_identity_per_block_many_document_insertions_and_updates_with_epoch_change( + ) { + let platform_version = PlatformVersion::latest(); + let created_contract = json_document_to_created_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, + true, + platform_version, + ) + .expect("expected to get contract from a json document"); + + let contract = created_contract.data_contract(); + + let document_insertion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionInsertRandom( + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_replace_op = DocumentOp { + contract: contract.clone(), + action: DocumentActionReplaceRandom, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![(created_contract, None)], + operations: vec![ + Operation { + op_type: OperationType::Document(document_insertion_op), + frequency: Frequency { + times_per_block_range: 1..40, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_replace_op), + frequency: Frequency { + times_per_block_range: 1..5, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..6, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), + }, + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let day_in_ms = 1000 * 60 * 60 * 24; + + let config = PlatformConfig { + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + epoch_time_length_s: 1576800, + ..Default::default() + }, + block_spacing_ms: day_in_ms, + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + ..Default::default() + }; + let block_count = 21; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + + let issues = outcome + .abci_app + .platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn run_chain_insert_many_document_updates_with_epoch_change() { + let platform_version = PlatformVersion::latest(); + let created_contract = json_document_to_created_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, + true, + platform_version, + ) + .expect("expected to get contract from a json document"); + + let contract = created_contract.data_contract(); + + let document_insertion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionInsertRandom( + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_replace_op = DocumentOp { + contract: contract.clone(), + action: DocumentActionReplaceRandom, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let mut rng = StdRng::seed_from_u64(567); + + let mut simple_signer = SimpleSigner::default(); + + let (identity1, keys1) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys1); + + let (identity2, keys2) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys2); + + let start_identities = create_state_transitions_for_identities( + vec![identity1, identity2], + &simple_signer, + &mut rng, + platform_version, + ); + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![(created_contract, None)], + operations: vec![ + Operation { + op_type: OperationType::Document(document_insertion_op), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_replace_op), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities { + hard_coded: start_identities, + ..Default::default() + }, + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer), + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let day_in_ms = 1000 * 60 * 60 * 24; + + let config = PlatformConfig { + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + epoch_time_length_s: 1576800, + ..Default::default() + }, + block_spacing_ms: day_in_ms, + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + ..Default::default() + }; + let block_count = 21; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + + let issues = outcome + .abci_app + .platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn run_chain_insert_many_new_identity_per_block_many_document_insertions_updates_and_deletions_with_epoch_change( + ) { + let platform_version = PlatformVersion::latest(); + let created_contract = json_document_to_created_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, + true, + platform_version, + ) + .expect("expected to get contract from a json document"); + + let contract = created_contract.data_contract(); + + let document_insertion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionInsertRandom( + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_replace_op = DocumentOp { + contract: contract.clone(), + action: DocumentActionReplaceRandom, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_deletion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionDelete, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![(created_contract, None)], + operations: vec![ + Operation { + op_type: OperationType::Document(document_insertion_op), + frequency: Frequency { + times_per_block_range: 1..40, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_replace_op), + frequency: Frequency { + times_per_block_range: 1..5, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_deletion_op), + frequency: Frequency { + times_per_block_range: 1..5, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..6, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), + }, + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let day_in_ms = 1000 * 60 * 60 * 24; + + let config = PlatformConfig { + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + epoch_time_length_s: 1576800, + ..Default::default() + }, + block_spacing_ms: day_in_ms, + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let block_count = 30; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); - assert_eq!(outcome.identities.len() as u64, 86); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + assert_eq!(outcome.identities.len() as u64, 83); + assert_eq!(outcome.masternode_identity_balances.len(), 100); + let balance_count = outcome + .masternode_identity_balances + .into_iter() + .filter(|(_, balance)| *balance != 0) + .count(); + assert_eq!(balance_count, 19); // 1 epoch worth of proposers + + let issues = outcome + .abci_app + .platform + .drive + .grove + .visualize_verify_grovedb(None, true, false, &platform_version.drive.grove_version) + .expect("expected to have no issues"); + + assert_eq!( + issues.len(), + 0, + "issues are {}", + issues + .iter() + .map(|(hash, (a, b, c))| format!("{}: {} {} {}", hash, a, b, c)) + .collect::>() + .join(" | ") + ); + } + + #[test] + fn run_chain_insert_many_new_identity_per_block_many_document_insertions_updates_transfers_and_deletions_with_epoch_change( + ) { + let platform_version = PlatformVersion::latest(); + let created_contract = json_document_to_created_contract( + "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", + 1, + true, + platform_version, + ) + .expect("expected to get contract from a json document"); + + let contract = created_contract.data_contract(); + + let document_insertion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionInsertRandom( + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_replace_op = DocumentOp { + contract: contract.clone(), + action: DocumentActionReplaceRandom, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_transfer_op = DocumentOp { + contract: contract.clone(), + action: DocumentActionTransferRandom, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let document_deletion_op = DocumentOp { + contract: contract.clone(), + action: DocumentAction::DocumentActionDelete, + document_type: contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type") + .to_owned_document_type(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![(created_contract, None)], + operations: vec![ + Operation { + op_type: OperationType::Document(document_insertion_op), + frequency: Frequency { + times_per_block_range: 1..40, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_replace_op), + frequency: Frequency { + times_per_block_range: 1..5, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_transfer_op), + frequency: Frequency { + times_per_block_range: 1..5, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_deletion_op), + frequency: Frequency { + times_per_block_range: 1..5, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..6, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), + }, + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let day_in_ms = 1000 * 60 * 60 * 24; + + let config = PlatformConfig { + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + verify_sum_trees: true, + + epoch_time_length_s: 1576800, + ..Default::default() + }, + block_spacing_ms: day_in_ms, + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + ..Default::default() + }; + let block_count = 30; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let outcome = + run_chain_for_strategy(&mut platform, block_count, strategy, config, 15, &mut None); + assert_eq!(outcome.identities.len() as u64, 79); assert_eq!(outcome.masternode_identity_balances.len(), 100); let balance_count = outcome .masternode_identity_balances @@ -2090,11 +3038,12 @@ mod tests { #[test] fn run_chain_top_up_identities() { + let platform_version = PlatformVersion::latest(); drive_abci::logging::init_for_tests(LogLevel::Silent); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![Operation { op_type: OperationType::IdentityTopUp, frequency: Frequency { @@ -2102,53 +3051,50 @@ mod tests { chance_per_block: None, }, }], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, query_testing: None, verify_state_transition_results: true, + sign_instant_locks: true, ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15, &mut None); let max_initial_balance = 100000000000u64; // TODO: some centralized way for random test data (`arbitrary` maybe?) let balances = outcome @@ -2162,6 +3108,7 @@ mod tests { .map(|identity| identity.id().to_buffer()) .collect(), None, + platform_version, ) .expect("expected to fetch balances"); @@ -2174,7 +3121,7 @@ mod tests { fn run_chain_update_identities_add_keys() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![Operation { op_type: OperationType::IdentityUpdate( IdentityUpdateOp::IdentityUpdateAddKeys(3), @@ -2184,21 +3131,24 @@ mod tests { chance_per_block: None, }, }], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2209,31 +3159,29 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); - let state = outcome.abci_app.platform.state.read().unwrap(); + + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15, &mut None); + let state = outcome.abci_app.platform.state.load(); let protocol_version = state.current_protocol_version_in_consensus(); let platform_version = PlatformVersion::get(protocol_version).unwrap(); @@ -2263,7 +3211,7 @@ mod tests { let platform_version = PlatformVersion::latest(); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![Operation { op_type: OperationType::IdentityUpdate( IdentityUpdateOp::IdentityUpdateDisableKey(3), @@ -2273,21 +3221,24 @@ mod tests { chance_per_block: None, }, }], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2298,30 +3249,28 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15, &mut None); let identities = outcome .abci_app @@ -2349,10 +3298,12 @@ mod tests { } #[test] + #[ignore] fn run_chain_top_up_and_withdraw_from_identities() { + let platform_version = PlatformVersion::latest(); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![ Operation { op_type: OperationType::IdentityTopUp, @@ -2369,82 +3320,615 @@ mod tests { }, }, ], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + start_keys: 3, + extra_keys: [( + Purpose::TRANSFER, + [(SecurityLevel::CRITICAL, vec![KeyType::ECDSA_SECP256K1])].into(), + )] + .into(), }, + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, query_testing: None, // because we can add an identity and withdraw from it in the same block - // the result would be different then expected + // the result would be different from what would be expected verify_state_transition_results: false, ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; + let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); + platform .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) + .expect_send_raw_transaction() + .returning(move |_| Ok(Txid::all_zeros())); + + struct CoreState { + asset_unlock_statuses: BTreeMap, + chain_lock: ChainLock, + } + + let mut chain_locked_height = 1; + + // Have to go with a complicated shared object for the core state because we need to change + // rpc response along the way but we can't mutate `platform.core_rpc` later + // because platform reference is moved into the AbciApplication. + let shared_core_state = Arc::new(Mutex::new(CoreState { + asset_unlock_statuses: BTreeMap::new(), + chain_lock: ChainLock { + block_height: chain_locked_height, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: BLSSignature::from([2; 96]), + }, + })); + + // Set up Core RPC responses + { + let core_state = shared_core_state.clone(); + + platform + .core_rpc + .expect_get_asset_unlock_statuses() + .returning(move |indices, _| { + Ok(indices + .iter() + .map(|index| { + core_state + .lock() + .unwrap() + .asset_unlock_statuses + .get(index) + .cloned() + .unwrap() + }) + .collect()) + }); + + let core_state = shared_core_state.clone(); + platform + .core_rpc + .expect_get_best_chain_lock() + .returning(move || Ok(core_state.lock().unwrap().chain_lock.clone())); + } + + // Run first two blocks: + // - Block 1: creates identity + // - Block 2: tops up identity and initiates withdrawals + let ( + ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + }, + last_block_pooled_withdrawals_amount, + ) = { + let outcome = run_chain_for_strategy( + &mut platform, + 2, + strategy.clone(), + config.clone(), + 1, + &mut None, + ); + + // Withdrawal transactions are not populated to block execution context yet + assert_eq!(outcome.withdrawals.len(), 0); + + // Withdrawal documents with pooled status should exist. + let withdrawal_documents_pooled = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::POOLED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + assert!(!withdrawal_documents_pooled.is_empty()); + let pooled_withdrawals = withdrawal_documents_pooled.len(); + + (outcome, pooled_withdrawals) + }; + + // Run block 3 + // Should broadcast previously pooled withdrawals to core + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + withdrawals: last_block_withdrawals, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + } = { + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start: 3, + core_height_start: 1, + block_count: 1, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: GENESIS_TIME_MS, + current_time_ms: end_time_ms, + instant_lock_quorums, + }, + strategy.clone(), + config.clone(), + StrategyRandomness::SeedEntropy(2), + ); + + // Withdrawal documents with pooled status should exist. + let withdrawal_documents_broadcasted = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::BROADCASTED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + // In this block all previously pooled withdrawals should be broadcasted + assert_eq!( + outcome.withdrawals.len(), + last_block_pooled_withdrawals_amount + ); + assert_eq!( + withdrawal_documents_broadcasted.len(), + last_block_pooled_withdrawals_amount + ); + + outcome + }; + + // Update core state before running next block. + // Asset unlocks broadcasted in the last block should have Unknown status + { + let mut core_state = shared_core_state.lock().unwrap(); + last_block_withdrawals.iter().for_each(|tx| { + let index = asset_unlock_index(tx); + + core_state.asset_unlock_statuses.insert( + index, + AssetUnlockStatusResult { + index, + status: AssetUnlockStatus::Unknown, + }, + ); + }); + } + + // Run block 4 + // Should change pooled status to broadcasted + let last_block_broadcasted_withdrawals_amount = last_block_withdrawals.len(); + let ( + ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + withdrawals: last_block_withdrawals, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + }, + last_block_broadcased_withdrawals_amount, + ) = { + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start: 4, + core_height_start: 1, + block_count: 1, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: GENESIS_TIME_MS, + current_time_ms: end_time_ms + 1000, + instant_lock_quorums, + }, + strategy.clone(), + config.clone(), + StrategyRandomness::SeedEntropy(3), + ); + + let withdrawal_documents_pooled = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::POOLED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + let withdrawal_documents_broadcasted = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::BROADCASTED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + // In this block we should have new withdrawals pooled + assert!(!withdrawal_documents_pooled.is_empty()); + + // And extra withdrawals broadcasted + let withdrawals_broadcasted_expected = + last_block_broadcasted_withdrawals_amount + outcome.withdrawals.len(); + assert_eq!( + withdrawal_documents_broadcasted.len(), + withdrawals_broadcasted_expected + ); + + (outcome, withdrawal_documents_broadcasted.len()) + }; + + // Update core state for newly broadcasted transactions + { + let mut core_state = shared_core_state.lock().unwrap(); + + // First, set all previously broadcasted transactions to Chainlocked + core_state + .asset_unlock_statuses + .iter_mut() + .for_each(|(index, status_result)| { + // Do not settle yet transactions that were broadcasted in the last block + status_result.index = *index; + status_result.status = AssetUnlockStatus::Chainlocked; + }); + + // Then increase chainlocked height, so that withdrawals for chainlocked transactions + // could be completed in the next block + // TODO: do we need this var? + chain_locked_height += 1; + core_state.chain_lock.block_height = chain_locked_height; + + // Then set all newly broadcasted transactions to Unknown + last_block_withdrawals.iter().for_each(|tx| { + let index = asset_unlock_index(tx); + + core_state.asset_unlock_statuses.insert( + index, + AssetUnlockStatusResult { + index, + status: AssetUnlockStatus::Unknown, + }, + ); + }); + + drop(core_state); + } + + // Run block 5 + // Previously broadcasted transactions should be settled after block 5, + // and their corresponding statuses should be changed to COMPLETED + let ( + ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + withdrawals: last_block_withdrawals, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + }, + last_block_withdrawals_completed_amount, + ) = { + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start: 5, + core_height_start: 1, + block_count: 1, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: GENESIS_TIME_MS, + current_time_ms: end_time_ms + 1000, + instant_lock_quorums, + }, + strategy.clone(), + config.clone(), + StrategyRandomness::SeedEntropy(4), + ); + + let withdrawal_documents_pooled = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::POOLED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + let withdrawal_documents_broadcasted = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::BROADCASTED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + let withdrawal_documents_completed = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::COMPLETE.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + // In this block we should have new withdrawals pooled + assert!(!withdrawal_documents_pooled.is_empty()); + + // And some withdrawals completed + let withdrawals_completed_expected = + // Withdrawals issued on {previous_block - 1} considered completed + last_block_broadcased_withdrawals_amount - last_block_withdrawals.len(); + assert_eq!( + withdrawal_documents_completed.len(), + withdrawals_completed_expected + ); + + // And extra withdrawals broadcasted + let withdrawals_broadcasted_expected = + // Withdrawals issued on previous block + withdrawals from this block are still in broadcasted state + last_block_withdrawals.len() + outcome.withdrawals.len(); + + assert_eq!( + withdrawal_documents_broadcasted.len(), + withdrawals_broadcasted_expected + ); + + (outcome, withdrawal_documents_completed.len()) + }; + + // Update state of the core before proceeding to the next block + { + // Simulate transactions being added to the core mempool + let mut core_state = shared_core_state.lock().unwrap(); + + let number_of_blocks_before_expiration: u32 = 48; + chain_locked_height += number_of_blocks_before_expiration; + + core_state.chain_lock.block_height = chain_locked_height; + + last_block_withdrawals.iter().for_each(|tx| { + let index = asset_unlock_index(tx); + + core_state.asset_unlock_statuses.insert( + index, + AssetUnlockStatusResult { + index, + status: AssetUnlockStatus::Unknown, + }, + ); }); - let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); + } + + // Run block 6. + // Tests withdrawal expiration + let ChainExecutionOutcome { .. } = { + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start: 6, + core_height_start: 1, + block_count: 1, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: GENESIS_TIME_MS, + current_time_ms: end_time_ms + 1000, + instant_lock_quorums, + }, + strategy.clone(), + config.clone(), + StrategyRandomness::SeedEntropy(5), + ); + + let withdrawal_documents_pooled = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::POOLED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + let withdrawal_documents_broadcasted = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::BROADCASTED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + let withdrawal_documents_completed = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::COMPLETE.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + let withdrawal_documents_expired = outcome + .abci_app + .platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::EXPIRED.into(), + DEFAULT_QUERY_LIMIT, + None, + platform_version, + ) + .unwrap(); + + // In this block we should have new withdrawals pooled + assert!(!withdrawal_documents_pooled.is_empty()); + + // Amount of completed withdrawals stays the same as in the last block + assert_eq!( + withdrawal_documents_completed.len(), + last_block_withdrawals_completed_amount + ); + + // And some withdrawals got expired + let withdrawals_expired_expected = + // Withdrawals issued on {previous_block - 1}, but not chainlocked yet, considered expired + last_block_broadcased_withdrawals_amount - last_block_withdrawals.len(); + + assert_eq!( + withdrawal_documents_expired.len(), + withdrawals_expired_expected + ); - assert_eq!(outcome.identities.len(), 10); - assert_eq!(outcome.withdrawals.len(), 18); + // And extra withdrawals broadcasted + let withdrawals_broadcasted_expected = + // Withdrawals issued on previous block + withdrawals from this block are still in broadcasted state + last_block_withdrawals.len() + outcome.withdrawals.len(); + + assert_eq!( + withdrawal_documents_broadcasted.len(), + withdrawals_broadcasted_expected + ); + + outcome + }; } #[test] fn run_chain_rotation_is_deterministic_1_block() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { //we do this to create some paying transactions - times_per_block_range: 1..2, - chance_per_block: None, + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 50, extra_normal_mns: 0, - quorum_count: 10, + validator_quorum_count: 10, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -2454,14 +3938,31 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; @@ -2480,14 +3981,15 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); - let outcome = run_chain_for_strategy(platform, 1, strategy.clone(), config.clone(), 7); + let outcome = + run_chain_for_strategy(platform, 1, strategy.clone(), config.clone(), 7, &mut None); outcomes.push(outcome); } @@ -2557,12 +4059,17 @@ mod tests { first_validator_set_fingerprint == last_validator_set_fingerprint })); + let state = outcomes[0].abci_app.platform.state.load(); + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); + let first_last_app_hash = outcomes[0] .abci_app .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -2572,7 +4079,7 @@ mod tests { .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -2584,24 +4091,30 @@ mod tests { fn run_chain_heavy_rotation_deterministic_before_payout() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { //we do this to create some paying transactions - times_per_block_range: 1..2, - chance_per_block: None, + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -2611,15 +4124,32 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, epoch_time_length_s: 1576800, ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform_a = TestPlatformBuilder::new() @@ -2632,26 +4162,32 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); platform_b .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); - let outcome_a = - run_chain_for_strategy(&mut platform_a, 18, strategy.clone(), config.clone(), 7); - let outcome_b = run_chain_for_strategy(&mut platform_b, 18, strategy, config, 7); + let outcome_a = run_chain_for_strategy( + &mut platform_a, + 18, + strategy.clone(), + config.clone(), + 7, + &mut None, + ); + let outcome_b = run_chain_for_strategy(&mut platform_b, 18, strategy, config, 7, &mut None); assert_eq!(outcome_a.end_epoch_index, outcome_b.end_epoch_index); // 100/18 assert_eq!(outcome_a.masternode_identity_balances.len(), 500); // 500 nodes assert_eq!(outcome_b.masternode_identity_balances.len(), 500); // 500 nodes @@ -2665,7 +4201,7 @@ mod tests { ); assert_eq!( masternodes_fingerprint_a, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); let masternodes_fingerprint_b = hash_to_hex_string( outcome_b @@ -2676,15 +4212,20 @@ mod tests { ); assert_eq!( masternodes_fingerprint_b, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); + let state = outcome_a.abci_app.platform.state.load(); + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); + let last_app_hash_a = outcome_a .abci_app .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -2693,7 +4234,7 @@ mod tests { .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -2712,24 +4253,30 @@ mod tests { ) { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { //we do this to create some paying transactions - times_per_block_range: 1..2, - chance_per_block: None, + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -2739,14 +4286,36 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform_a = TestPlatformBuilder::new() @@ -2759,26 +4328,33 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); platform_b .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); - let outcome_a = - run_chain_for_strategy(&mut platform_a, 100, strategy.clone(), config.clone(), 7); - let outcome_b = run_chain_for_strategy(&mut platform_b, 100, strategy, config, 7); + let outcome_a = run_chain_for_strategy( + &mut platform_a, + 100, + strategy.clone(), + config.clone(), + 7, + &mut None, + ); + let outcome_b = + run_chain_for_strategy(&mut platform_b, 100, strategy, config, 7, &mut None); assert_eq!(outcome_a.end_epoch_index, outcome_b.end_epoch_index); // 100/18 assert_eq!(outcome_a.masternode_identity_balances.len(), 500); // 500 nodes assert_eq!(outcome_b.masternode_identity_balances.len(), 500); // 500 nodes @@ -2792,7 +4368,7 @@ mod tests { ); assert_eq!( masternodes_fingerprint_a, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); let masternodes_fingerprint_b = hash_to_hex_string( outcome_b @@ -2803,15 +4379,20 @@ mod tests { ); assert_eq!( masternodes_fingerprint_b, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); + let state = outcome_a.abci_app.platform.state.load(); + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected platform version"); + let last_app_hash_a = outcome_a .abci_app .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -2820,7 +4401,7 @@ mod tests { .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("should return app hash"); @@ -2831,8 +4412,8 @@ mod tests { .into_iter() .filter(|(_, balance)| *balance != 0) .count(); - // we have a maximum 90 quorums, that could have been used, 4 were used twice - assert_eq!(balance_count, 86); + // we have a maximum 90 quorums, that could have been used, 7 were used twice + assert_eq!(balance_count, 83); } #[test] @@ -2841,23 +4422,19 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2867,15 +4444,32 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set: ValidatorSetConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + ..Default::default() + }, + chain_lock: ChainLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, + instant_lock: InstantLockConfig { + quorum_type: QuorumType::Llmq100_67, + quorum_size: 3, + quorum_window: 24, + quorum_active_signers: 24, + quorum_rotation: false, + }, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, epoch_time_length_s: 1576800, ..Default::default() }, block_spacing_ms: day_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let TempPlatform { @@ -2885,43 +4479,41 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, .. - } = run_chain_for_strategy(&mut platform, 100, strategy.clone(), config.clone(), 89); + } = run_chain_for_strategy( + &mut platform, + 100, + strategy.clone(), + config.clone(), + 89, + &mut None, + ); - let state = abci_app.platform.state.read().unwrap(); + let state = abci_app.platform.state.load(); let protocol_version = state.current_protocol_version_in_consensus(); - drop(state); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); let known_root_hash = abci_app .platform .drive .grove - .root_hash(None) + .root_hash(None, &platform_version.drive.grove_version) .unwrap() .expect("expected root hash"); abci_app .platform - .recreate_state(platform_version) + .reload_state_from_storage(platform_version) .expect("expected to recreate state"); let ResponseInfo { @@ -2942,11 +4534,9 @@ mod tests { assert_eq!(last_block_height, 100); assert_eq!(last_block_app_hash, known_root_hash); - let block_start = abci_app - .platform - .state - .read() - .unwrap() + let state = abci_app.platform.state.load(); + + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -2961,9 +4551,13 @@ mod tests { core_height_start: 10, block_count: 30, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + instant_lock_quorums: Default::default(), current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, }, @@ -2975,31 +4569,41 @@ mod tests { #[test] fn run_chain_transfer_between_identities() { + let platform_version = PlatformVersion::latest(); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![Operation { op_type: OperationType::IdentityTransfer, frequency: Frequency { - times_per_block_range: 1..2, + times_per_block_range: 1..3, chance_per_block: None, }, }], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: 1..2, - chance_per_block: None, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo { + //we do this to create some paying transactions + frequency: Frequency { + times_per_block_range: 6..10, + chance_per_block: None, + }, + start_keys: 3, + extra_keys: [( + Purpose::TRANSFER, + [(SecurityLevel::CRITICAL, vec![KeyType::ECDSA_SECP256K1])].into(), + )] + .into(), }, + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -3009,33 +4613,31 @@ mod tests { }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); - let balances = &outcome + let outcome = run_chain_for_strategy(&mut platform, 15, strategy, config, 15, &mut None); + + let _balances = &outcome .abci_app .platform .drive @@ -3046,24 +4648,11 @@ mod tests { .map(|identity| identity.id().to_buffer()) .collect(), None, + platform_version, ) .expect("expected to fetch balances"); - assert_eq!(outcome.identities.len(), 10); - - let len = outcome.identities.len(); - - for identity in &outcome.identities[..len - 1] { - let new_balance = balances[&identity.id().to_buffer()]; - // All identity balances decreased - // as we transferred funds to the last identity - assert_eq!(new_balance, 0); - } - - let last_identity = &outcome.identities[len - 1]; - let last_identity_balance = balances[&last_identity.id().to_buffer()]; - // We transferred funds to the last identity, so we need to check that last identity balance was increased - assert!(last_identity_balance > 100000000000u64); + assert_eq!(outcome.identities.len(), 106); } // Test should filter out transactions exceeding max tx bytes per block @@ -3071,41 +4660,43 @@ mod tests { fn run_transactions_exceeding_max_block_size() { let strategy = NetworkStrategy { strategy: Strategy { - identities_inserts: Frequency { - times_per_block_range: 5..6, - chance_per_block: None, + identity_inserts: IdentityInsertInfo { + frequency: Frequency { + times_per_block_range: 5..6, + chance_per_block: None, + }, + start_keys: 5, + extra_keys: Default::default(), }, + ..Default::default() }, max_tx_bytes_per_block: 3500, ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + ..Default::default() }, block_spacing_ms: 3000, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 1, strategy, config, 15); + let outcome = run_chain_for_strategy(&mut platform, 1, strategy, config, 15, &mut None); let state_transitions = outcome .state_transition_results_per_block .get(&1) diff --git a/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs b/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs index 75acbf8a117..51693b5b60f 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs @@ -3,9 +3,13 @@ use dashcore_rpc::dashcore::hashes::Hash; use dashcore_rpc::dashcore::{ProTxHash, QuorumHash, Txid}; use dashcore_rpc::dashcore_rpc_json::{DMNState, MasternodeListItem, MasternodeType}; use dpp::bls_signatures::PrivateKey as BlsPrivateKey; +use dpp::identity::hash::IdentityPublicKeyHashMethodsV0; +use dpp::identity::IdentityPublicKey; use drive_abci::mimic::test_quorum::TestQuorumInfo; +use platform_version::version::PlatformVersion; use rand::prelude::{IteratorRandom, StdRng}; use rand::Rng; +use simple_signer::signer::SimpleSigner; use std::collections::{BTreeMap, BTreeSet}; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::str::FromStr; @@ -33,6 +37,7 @@ pub fn generate_test_masternodes( hpmn_count: u16, updates: Option, rng: &mut StdRng, + add_voting_keys_to_signer: &mut Option, ) -> ( Vec, Vec, @@ -188,6 +193,21 @@ pub fn generate_test_masternodes( let hpmn_number_to_heights_http_port_changes = invert_btreemap(block_height_to_list_hpmn_http_port_changes); + fn generate_voting_address( + rng: &mut StdRng, + add_voting_keys_to_signer: &mut Option, + ) -> [u8; 20] { + if let Some(simple_signer) = add_voting_keys_to_signer { + let (identity_public_key, private_key) = + IdentityPublicKey::random_voting_key_with_rng(0, rng, PlatformVersion::latest()) + .expect("expected a random voting key"); + simple_signer.add_key(identity_public_key.clone(), private_key); + identity_public_key.public_key_hash().unwrap() + } else { + rng.gen() + } + } + for i in 0..masternode_count { let private_key_operator = BlsPrivateKey::generate_dash(rng).expect("expected to generate a private key"); @@ -212,7 +232,7 @@ pub fn generate_test_masternodes( pose_ban_height: None, revocation_reason: 0, owner_address: rng.gen::<[u8; 20]>(), - voting_address: rng.gen::<[u8; 20]>(), + voting_address: generate_voting_address(rng, add_voting_keys_to_signer), payout_address: rng.gen::<[u8; 20]>(), pub_key_operator, operator_payout_address: None, @@ -347,7 +367,7 @@ pub fn generate_test_masternodes( pose_ban_height: None, revocation_reason: 0, owner_address: rng.gen::<[u8; 20]>(), - voting_address: rng.gen::<[u8; 20]>(), + voting_address: generate_voting_address(rng, add_voting_keys_to_signer), payout_address: rng.gen::<[u8; 20]>(), pub_key_operator, operator_payout_address: None, @@ -486,18 +506,14 @@ pub fn generate_test_masternodes( SocketAddr::new(IpAddr::V4(random_ip), old_port); } if update.p2p_port { - hpmn_list_item_b - .state - .platform_p2p_port - .as_mut() - .map(|port| *port += 1); + if let Some(port) = hpmn_list_item_b.state.platform_p2p_port.as_mut() { + *port += 1 + } } if update.http_port { - hpmn_list_item_b - .state - .platform_http_port - .as_mut() - .map(|port| *port += 1); + if let Some(port) = hpmn_list_item_b.state.platform_http_port.as_mut() { + *port += 1 + } } latest_masternode_list_item = hpmn_list_item_b.clone(); @@ -541,6 +557,7 @@ where TestQuorumInfo::from_quorum_hash_and_pro_tx_hashes( index as u32 * 24, quorum_hash, + Some(index as u32 + 1), validator_pro_tx_hashes, rng, ), @@ -585,9 +602,9 @@ mod tests { let mut rng2 = StdRng::seed_from_u64(12345); let (masternodes1, hpmn1) = - generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng1); + generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng1, &mut None); let (masternodes2, hpmn2) = - generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng2); + generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng2, &mut None); assert_eq!(masternodes1, masternodes2); assert_eq!(hpmn1, hpmn2); @@ -644,10 +661,20 @@ mod tests { let mut rng1 = StdRng::seed_from_u64(12345); let mut rng2 = StdRng::seed_from_u64(12345); - let (masternodes1, hpmn1) = - generate_test_masternodes(masternode_count, hpmn_count, updates.clone(), &mut rng1); - let (masternodes2, hpmn2) = - generate_test_masternodes(masternode_count, hpmn_count, updates.clone(), &mut rng2); + let (masternodes1, hpmn1) = generate_test_masternodes( + masternode_count, + hpmn_count, + updates.clone(), + &mut rng1, + &mut None, + ); + let (masternodes2, hpmn2) = generate_test_masternodes( + masternode_count, + hpmn_count, + updates.clone(), + &mut rng2, + &mut None, + ); assert_eq!(masternodes1, masternodes2); assert_eq!(hpmn1, hpmn2); @@ -670,9 +697,9 @@ mod tests { let hpmn_count = rng.gen_range(50..=150); let (masternodes1, hpmn1) = - generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng1); + generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng1, &mut None); let (masternodes2, hpmn2) = - generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng2); + generate_test_masternodes(masternode_count, hpmn_count, None, &mut rng2, &mut None); assert_eq!(masternodes1, masternodes2); assert_eq!(hpmn1, hpmn2); @@ -740,10 +767,20 @@ mod tests { }, }); - let (masternodes1, hpmn1) = - generate_test_masternodes(masternode_count, hpmn_count, updates.clone(), &mut rng1); - let (masternodes2, hpmn2) = - generate_test_masternodes(masternode_count, hpmn_count, updates.clone(), &mut rng2); + let (masternodes1, hpmn1) = generate_test_masternodes( + masternode_count, + hpmn_count, + updates.clone(), + &mut rng1, + &mut None, + ); + let (masternodes2, hpmn2) = generate_test_masternodes( + masternode_count, + hpmn_count, + updates.clone(), + &mut rng2, + &mut None, + ); assert_eq!(masternodes1, masternodes2); assert_eq!(hpmn1, hpmn2); diff --git a/packages/rs-drive-abci/tests/strategy_tests/patch_platform_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/patch_platform_tests.rs new file mode 100644 index 00000000000..ee2e087e452 --- /dev/null +++ b/packages/rs-drive-abci/tests/strategy_tests/patch_platform_tests.rs @@ -0,0 +1,428 @@ +#[cfg(test)] +mod tests { + use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; + use drive::config::DriveConfig; + use std::collections::{BTreeMap, HashMap}; + + use crate::execution::{continue_chain_for_strategy, run_chain_for_strategy}; + use crate::strategy::{ + ChainExecutionOutcome, ChainExecutionParameters, NetworkStrategy, StrategyRandomness, + UpgradingInfo, + }; + use drive_abci::config::{ + ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig, + ValidatorSetConfig, + }; + use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; + use drive_abci::test::helpers::setup::TestPlatformBuilder; + use platform_version::version; + use platform_version::version::mocks::v2_test::TEST_PROTOCOL_VERSION_2; + use platform_version::version::patches::PatchFn; + use platform_version::version::PlatformVersion; + + #[test] + fn test_patch_version() { + // Define the desired stack size + let stack_size = 4 * 1024 * 1024; // Let's set the stack size to be higher than the default 2MB + + let builder = std::thread::Builder::new() + .stack_size(stack_size) + .name("custom_stack_size_thread".into()); + + pub fn patch_1_5_test(mut platform_version: PlatformVersion) -> PlatformVersion { + platform_version + .drive_abci + .query + .document_query + .default_current_version = 5; + + platform_version + } + + pub fn patch_1_10_test(mut platform_version: PlatformVersion) -> PlatformVersion { + platform_version.drive_abci.query.document_query.max_version = 10; + + platform_version + } + + pub fn patch_2_30_test(mut platform_version: PlatformVersion) -> PlatformVersion { + platform_version.drive_abci.query.document_query.min_version = 30; + + platform_version + } + + let mut patches = version::patches::PATCHES.write().unwrap(); + + *patches = HashMap::from_iter(vec![ + { + ( + 1, + BTreeMap::from_iter(vec![ + (5, patch_1_5_test as PatchFn), + (10, patch_1_10_test as PatchFn), + ]), + ) + }, + { + ( + TEST_PROTOCOL_VERSION_2, + BTreeMap::from_iter(vec![(30, patch_2_30_test as PatchFn)]), + ) + }, + ]); + + drop(patches); + + let handler = builder + .spawn(|| { + let strategy = NetworkStrategy { + total_hpmns: 4, + upgrading_info: Some(UpgradingInfo { + current_protocol_version: 1, + proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], + upgrade_three_quarters_life: 0.0, + }), + ..Default::default() + }; + + let config = PlatformConfig { + validator_set: ValidatorSetConfig { + quorum_size: 4, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + epoch_time_length_s: 60 * 60, + ..Default::default() + }, + drive: DriveConfig::default(), + block_spacing_ms: 1000 * 60 * 5, + testing_configs: PlatformTestConfig::default_minimal_verifications(), + + ..Default::default() + }; + + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + // Run chain before the first patch + + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + } = run_chain_for_strategy( + &mut platform, + 4, + strategy.clone(), + config.clone(), + 13, + &mut None, + ); + + let platform = abci_app.platform; + + // Make sure patch 1 5 is not applied yet + let state = platform.state.load(); + let platform_version = state + .current_platform_version() + .expect("getting patched version shouldn't fail"); + + assert_eq!(state.last_committed_block_epoch().index, 0); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!( + platform_version + .drive_abci + .query + .document_query + .default_current_version, + 0 + ); + + // Run for 2 more blocks to make sure patch 1 5 is applied, + // and it persists for the further blocks + + let block_start = state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + } = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 2, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + instant_lock_quorums, + }, + strategy.clone(), + config.clone(), + StrategyRandomness::SeedEntropy(7), + ); + + // Make sure patch 1 5 is applied + let state = platform.state.load(); + let platform_version = state + .current_platform_version() + .expect("getting patched version shouldn't fail"); + + assert_eq!(state.last_committed_block_epoch().index, 0); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!( + platform_version + .drive_abci + .query + .document_query + .default_current_version, + 5 + ); + + // Run chain for 9 more blocks to apply patch 1 15 + + let block_start = state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + } = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 4, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + instant_lock_quorums, + }, + strategy.clone(), + config.clone(), + StrategyRandomness::SeedEntropy(7), + ); + + // Make sure patch 1 5 and 10 is applied + let state = platform.state.load(); + let platform_version = state + .current_platform_version() + .expect("getting patched version shouldn't fail"); + + assert_eq!(state.last_committed_block_epoch().index, 0); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!( + platform_version.drive_abci.query.document_query.max_version, + 10 + ); + assert_eq!( + platform_version + .drive_abci + .query + .document_query + .default_current_version, + 5 + ); + + // Run chain for 10 more blocks to upgrade to version 2 + + let block_start = state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, + .. + } = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 15, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + instant_lock_quorums, + }, + strategy.clone(), + config.clone(), + StrategyRandomness::SeedEntropy(18), + ); + + // Make sure we switched version and drop all patches + let state = platform.state.load(); + let platform_version = state + .current_platform_version() + .expect("getting patched version shouldn't fail"); + + assert_eq!(state.last_committed_block_epoch().index, 2); + assert_eq!( + state.current_protocol_version_in_consensus(), + TEST_PROTOCOL_VERSION_2 + ); + assert_eq!( + platform_version + .drive_abci + .query + .document_query + .default_current_version, + 0 + ); + assert_eq!( + platform_version.drive_abci.query.document_query.min_version, + 0 + ); + assert_eq!( + platform_version.drive_abci.query.document_query.max_version, + 0 + ); + + // Run chain for 10 more blocks to apply 2 45 patch + + let block_start = state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + + let ChainExecutionOutcome { .. } = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 10, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + instant_lock_quorums, + }, + strategy, + config, + StrategyRandomness::SeedEntropy(18), + ); + + // Make sure we applied 2 30 and patches for version 1 is ignored + let state = platform.state.load(); + let platform_version = state + .current_platform_version() + .expect("getting patched version shouldn't fail"); + + assert_eq!( + state.current_protocol_version_in_consensus(), + TEST_PROTOCOL_VERSION_2 + ); + assert_eq!( + platform_version + .drive_abci + .query + .document_query + .default_current_version, + 0 + ); + assert_eq!( + platform_version.drive_abci.query.document_query.min_version, + 30 + ); + assert_eq!( + platform_version.drive_abci.query.document_query.max_version, + 0 + ); + }) + .expect("Failed to create thread with custom stack size"); + + fn cleanup_version_patches() { + let mut patches = version::patches::PATCHES.write().unwrap(); + patches.clear(); + } + + // Wait for the thread to finish and assert that it didn't panic. + handler + .join() + .map(|result| { + cleanup_version_patches(); + + result + }) + .map_err(|e| { + cleanup_version_patches(); + + e + }) + .expect("Thread has panicked"); + } +} diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index 8fab53a87ce..a7b035dfdb2 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -1,9 +1,8 @@ use crate::strategy::StrategyRandomness; -use dapi_grpc::platform::v0::get_identities_by_public_key_hashes_request::GetIdentitiesByPublicKeyHashesRequestV0; -use dapi_grpc::platform::v0::get_identities_by_public_key_hashes_response::PublicKeyHashIdentityEntry; +use dapi_grpc::platform::v0::get_identity_by_public_key_hash_request::GetIdentityByPublicKeyHashRequestV0; use dapi_grpc::platform::v0::{ - get_identities_by_public_key_hashes_request, get_identities_by_public_key_hashes_response, - GetIdentitiesByPublicKeyHashesRequest, GetIdentitiesByPublicKeyHashesResponse, Proof, + get_identity_by_public_key_hash_request, get_identity_by_public_key_hash_response, + GetIdentityByPublicKeyHashRequest, Proof, }; use dashcore_rpc::dashcore_rpc_json::QuorumType; use dpp::identity::accessors::IdentityGettersV0; @@ -13,20 +12,20 @@ use dpp::identity::{Identity, PartialIdentity}; use dpp::serialization::PlatformDeserializable; use dpp::validation::SimpleValidationResult; use dpp::version::PlatformVersion; -use drive::drive::verify::RootHash; use drive::drive::Drive; -use drive_abci::abci::{AbciApplication, AbciError}; +use drive::verify::RootHash; +use drive_abci::abci::app::FullAbciApplication; +use drive_abci::abci::AbciError; use drive_abci::rpc::core::MockCoreRPCLike; -use prost::Message; use rand::prelude::SliceRandom; use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; use strategy_tests::frequency::Frequency; use tenderdash_abci::proto::google::protobuf::Timestamp; use tenderdash_abci::proto::serializers::timestamp::ToMilis; use tenderdash_abci::proto::types::{CanonicalVote, SignedMsgType, StateId}; -use tenderdash_abci::signatures::{SignBytes, SignDigest}; +use tenderdash_abci::signatures::{Hashable, Signable}; #[derive(Clone, Debug, Default)] pub struct QueryStrategy { @@ -80,10 +79,11 @@ impl<'a> ProofVerification<'a> { /// Implements algorithm described at: /// https://github.com/dashpay/tenderdash/blob/v0.12-dev/spec/consensus/signing.md#block-signature-verification-on-light-client fn verify_signature(&self, state_id: StateId, round: u32) -> SimpleValidationResult { - let state_id_hash = match state_id.sha256(&self.chain_id, self.height, round as i32) { - Ok(s) => s, - Err(e) => return SimpleValidationResult::new_with_error(AbciError::from(e)), - }; + let state_id_hash = + match state_id.calculate_msg_hash(&self.chain_id, self.height, round as i32) { + Ok(s) => s, + Err(e) => return SimpleValidationResult::new_with_error(AbciError::from(e)), + }; let v = CanonicalVote { block_id: self.block_hash.to_vec(), @@ -94,7 +94,7 @@ impl<'a> ProofVerification<'a> { r#type: SignedMsgType::Precommit.into(), }; - let digest = match v.sign_digest( + let digest = match v.calculate_sign_hash( &self.chain_id, self.quorum_type as u8, self.quorum_hash, @@ -113,7 +113,7 @@ impl<'a> ProofVerification<'a> { e, format!("Malformed signature data: {}", hex::encode(self.signature)), ), - ) + ); } }; tracing::trace!( @@ -168,7 +168,7 @@ impl QueryStrategy { &self, proof_verification: &ProofVerification, current_identities: &Vec, - abci_app: &AbciApplication, + abci_app: &FullAbciApplication, seed: StrategyRandomness, platform_version: &PlatformVersion, ) { @@ -195,12 +195,14 @@ impl QueryStrategy { proof_verification: &ProofVerification, current_identities: &Vec, frequency: &Frequency, - abci_app: &AbciApplication, + abci_app: &FullAbciApplication, rng: &mut StdRng, platform_version: &PlatformVersion, ) { let events = frequency.events_if_hit(rng); + let platform_state = abci_app.platform.state.load(); + for _i in 0..events { let identity_count = rng.gen_range(1..10); let chosen_identities = current_identities.choose_multiple(rng, identity_count); @@ -219,7 +221,7 @@ impl QueryStrategy { let key_num = rng.gen_range(0..unique_public_keys.len()); let public_key = unique_public_keys[key_num].1; Some(( - public_key.hash().unwrap(), + public_key.public_key_hash().unwrap(), identity.clone().into_partial_identity_info_no_balance(), )) } @@ -228,95 +230,63 @@ impl QueryStrategy { let prove: bool = rng.gen(); - let request = GetIdentitiesByPublicKeyHashesRequest { - version: Some(get_identities_by_public_key_hashes_request::Version::V0( - GetIdentitiesByPublicKeyHashesRequestV0 { - public_key_hashes: public_key_hashes - .keys() - .map(|hash| hash.to_vec()) - .collect(), - prove, - }, - )), - }; - let encoded_request = request.encode_to_vec(); - let query_validation_result = abci_app - .platform - .query( - "/identities/by-public-key-hash", - encoded_request.as_slice(), - platform_version, - ) - .expect("expected to run query"); - - assert!( - query_validation_result.errors.is_empty(), - "{:?}", - query_validation_result.errors - ); - - let query_data = query_validation_result - .into_data() - .expect("expected data on query_validation_result"); - let response = GetIdentitiesByPublicKeyHashesResponse::decode(query_data.as_slice()) - .expect("expected to deserialize"); - - let versioned_result = response.version.expect("expected a result"); - match versioned_result { - get_identities_by_public_key_hashes_response::Version::V0(v0) => { - let result = v0.result.expect("expected a result"); - - match result { - get_identities_by_public_key_hashes_response::get_identities_by_public_key_hashes_response_v0::Result::Proof(proof) => { - let (proof_root_hash, identities): ( - RootHash, - HashMap<[u8; 20], Option>, - ) = Drive::verify_full_identities_by_public_key_hashes( - &proof.grovedb_proof, - public_key_hashes - .keys() - .cloned() - .collect::>() - .as_slice(), - platform_version, - ) - .expect("expected to verify proof"); - let identities: HashMap<[u8; 20], PartialIdentity> = identities - .into_iter() - .map(|(k, v)| { - ( - k, - v.expect("expect an identity") - .into_partial_identity_info_no_balance(), - ) - }) - .collect(); - assert_eq!(proof_verification.app_hash, &proof_root_hash); - assert!(proof_verification - .verify_proof(&proof_root_hash, proof) - .is_valid()); - assert_eq!(identities, public_key_hashes); - } - get_identities_by_public_key_hashes_response::get_identities_by_public_key_hashes_response_v0::Result::Identities(data) => { - let identities_returned = data - .identity_entries - .into_iter() - .map(|entry| { - let PublicKeyHashIdentityEntry{ value, .. } = entry; - Identity::deserialize_from_bytes(&value.expect("expected a value")) - .expect("expected to deserialize identity") - .id() - }) - .collect::>(); - assert_eq!( - identities_returned, - public_key_hashes - .values() - .map(|partial_identity| partial_identity.id) - .collect() - ); - } - } + for (key_hash, expected_identity) in public_key_hashes { + let request = GetIdentityByPublicKeyHashRequest { + version: Some(get_identity_by_public_key_hash_request::Version::V0( + GetIdentityByPublicKeyHashRequestV0 { + public_key_hash: key_hash.to_vec(), + prove, + }, + )), + }; + + let query_validation_result = abci_app + .platform + .query_identity_by_public_key_hash(request, &platform_state, platform_version) + .expect("expected to run query"); + + assert!( + query_validation_result.errors.is_empty(), + "{:?}", + query_validation_result.errors + ); + + let response = query_validation_result + .into_data() + .expect("expected data on query_validation_result"); + + let versioned_result = response.version.expect("expected a result"); + match versioned_result { + get_identity_by_public_key_hash_response::Version::V0(v0) => { + let result = v0.result.expect("expected a result"); + + match result { + get_identity_by_public_key_hash_response::get_identity_by_public_key_hash_response_v0::Result::Proof(proof) => { + let (proof_root_hash, identity): ( + RootHash, + Option, + ) = Drive::verify_full_identity_by_public_key_hash( + &proof.grovedb_proof, + key_hash, + platform_version, + ) + .expect("expected to verify proof"); + let identity = identity.expect("expected an identity") + .into_partial_identity_info_no_balance(); + assert_eq!(proof_verification.app_hash, &proof_root_hash); + assert!(proof_verification + .verify_proof(&proof_root_hash, proof) + .is_valid()); + assert_eq!(identity, expected_identity); + } + get_identity_by_public_key_hash_response::get_identity_by_public_key_hash_response_v0::Result::Identity(data) => { + let identity_id = Identity::deserialize_from_bytes(&data) + .expect("expected to deserialize identity").id(); + + assert_eq!(identity_id, expected_identity.id); + } + } + } } } } @@ -326,44 +296,27 @@ impl QueryStrategy { #[cfg(test)] mod tests { use super::*; - use crate::execution::{continue_chain_for_strategy, run_chain_for_strategy}; - use crate::query::QueryStrategy; - use crate::strategy::{FailureStrategy, MasternodeListChangesStrategy, NetworkStrategy}; - use dashcore_rpc::dashcore::hashes::Hash; - use dashcore_rpc::dashcore::BlockHash; - use dashcore_rpc::dashcore_rpc_json::ExtendedQuorumDetails; - use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; - use strategy_tests::operations::DocumentAction::DocumentActionReplace; - use strategy_tests::operations::{ - DocumentAction, DocumentOp, IdentityUpdateOp, Operation, OperationType, - }; + use crate::execution::run_chain_for_strategy; + + use crate::strategy::NetworkStrategy; use dapi_grpc::platform::v0::get_epochs_info_request::{GetEpochsInfoRequestV0, Version}; - use dapi_grpc::platform::v0::{ - get_epochs_info_response, GetEpochsInfoRequest, GetEpochsInfoResponse, - }; + use dapi_grpc::platform::v0::{get_epochs_info_response, GetEpochsInfoRequest}; use dpp::block::epoch::EpochIndex; use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0Getters; - use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; - use dpp::data_contract::document_type::random_document::{ - DocumentFieldFillSize, DocumentFieldFillType, - }; - use dpp::identity::accessors::IdentityGettersV0; - use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; - use dpp::serialization::PlatformDeserializable; - use dpp::tests::json_document::json_document_to_created_contract; - use dpp::util::hash::hash_to_hex_string; + use dpp::version::PlatformVersion; - use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; - use drive_abci::logging::LogLevel; + use drive_abci::config::{ + ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig, + ValidatorSetConfig, + }; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; - use drive_abci::rpc::core::QuorumListExtendedInfo; + use drive_abci::test::helpers::setup::TestPlatformBuilder; - use itertools::Itertools; - use strategy_tests::Strategy; - use tenderdash_abci::proto::abci::{RequestInfo, ResponseInfo}; - use tenderdash_abci::proto::types::CoreChainLock; - use tenderdash_abci::Application; + + use strategy_tests::{IdentityInsertInfo, StartIdentities, Strategy}; + + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; macro_rules! extract_single_variant_or_panic { ($expression:expr, $pattern:pat, $binding:ident) => { @@ -393,23 +346,23 @@ mod tests { fn run_chain_query_epoch_info() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -419,37 +372,35 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: hour_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15, &mut None); assert_eq!(outcome.masternode_identity_balances.len(), 100); - let all_have_balances = outcome + let nodes_with_no_balance = outcome .masternode_identity_balances .iter() - .all(|(_, balance)| *balance != 0); - assert!(all_have_balances, "all masternodes should have a balance"); + .filter(|(_, balance)| *balance == &0) + .collect::>(); + assert_eq!( + nodes_with_no_balance.len(), + 0, + "all masternodes should have a balance" + ); let request = GetEpochsInfoRequest { version: Some(Version::V0(GetEpochsInfoRequestV0 { @@ -458,28 +409,22 @@ mod tests { ascending: true, prove: false, })), - } - .encode_to_vec(); + }; + + let platform_state = outcome.abci_app.platform.state.load(); - let platform_state = outcome - .abci_app - .platform - .state - .read() - .expect("expected to read state"); let protocol_version = platform_state.current_protocol_version_in_consensus(); - drop(platform_state); + let platform_version = PlatformVersion::get(protocol_version) .expect("expected to get current platform version"); + let validation_result = outcome .abci_app .platform - .query("/epochInfos", &request, platform_version) + .query_epoch_infos(request, &platform_state, platform_version) .expect("expected query to succeed"); - let response = GetEpochsInfoResponse::decode( - validation_result.data.expect("expected data").as_slice(), - ) - .expect("expected to decode response"); + + let response = validation_result.into_data().expect("expected data"); let result = extract_single_variant_or_panic!( response.version.expect("expected a versioned response"), @@ -504,23 +449,23 @@ mod tests { fn run_chain_query_epoch_info_latest() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -530,31 +475,24 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: hour_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15, &mut None); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome .masternode_identity_balances @@ -569,28 +507,22 @@ mod tests { ascending: false, prove: false, })), - } - .encode_to_vec(); + }; + + let platform_state = outcome.abci_app.platform.state.load(); - let platform_state = outcome - .abci_app - .platform - .state - .read() - .expect("expected to read state"); let protocol_version = platform_state.current_protocol_version_in_consensus(); - drop(platform_state); + let platform_version = PlatformVersion::get(protocol_version) .expect("expected to get current platform version"); + let validation_result = outcome .abci_app .platform - .query("/epochInfos", &request, platform_version) + .query_epoch_infos(request, &platform_state, platform_version) .expect("expected query to succeed"); - let response = GetEpochsInfoResponse::decode( - validation_result.data.expect("expected data").as_slice(), - ) - .expect("expected to decode response"); + + let response = validation_result.into_data().expect("expected data"); let result = extract_single_variant_or_panic!( response.version.expect("expected a versioned response"), @@ -616,23 +548,23 @@ mod tests { fn run_chain_prove_epoch_info() { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -642,31 +574,24 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + ..Default::default() }, block_spacing_ms: hour_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), - }) - }); - let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); + + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15, &mut None); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome .masternode_identity_balances @@ -681,29 +606,24 @@ mod tests { ascending: true, prove: true, })), - } - .encode_to_vec(); + }; + + let platform_state = outcome.abci_app.platform.state.load(); - let platform_state = outcome - .abci_app - .platform - .state - .read() - .expect("expected to read state"); let protocol_version = platform_state.current_protocol_version_in_consensus(); - let current_epoch = platform_state.epoch_ref().index; - drop(platform_state); + + let current_epoch = platform_state.last_committed_block_epoch_ref().index; + let platform_version = PlatformVersion::get(protocol_version) .expect("expected to get current platform version"); + let validation_result = outcome .abci_app .platform - .query("/epochInfos", &request, platform_version) + .query_epoch_infos(request, &platform_state, platform_version) .expect("expected query to succeed"); - let response = GetEpochsInfoResponse::decode( - validation_result.data.expect("expected data").as_slice(), - ) - .expect("expected to decode response"); + + let response = validation_result.data.expect("expected data"); let result = extract_single_variant_or_panic!( response.version.expect("expected a versioned response"), @@ -741,18 +661,15 @@ mod tests { ascending: false, prove: true, })), - } - .encode_to_vec(); + }; let validation_result = outcome .abci_app .platform - .query("/epochInfos", &request, platform_version) + .query_epoch_infos(request, &platform_state, platform_version) .expect("expected query to succeed"); - let response = GetEpochsInfoResponse::decode( - validation_result.data.expect("expected data").as_slice(), - ) - .expect("expected to decode response"); + + let response = validation_result.data.expect("expected data"); let get_epochs_info_response::Version::V0(response_v0) = response.version.expect("expected a versioned response"); diff --git a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs index 118767b833c..61046f87e6a 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs @@ -1,56 +1,84 @@ use crate::masternodes::MasternodeListItemWithUpdates; use crate::query::QueryStrategy; use crate::BlockHeight; -use dashcore_rpc::dashcore; +use dashcore_rpc::dashcore::{Network, PrivateKey}; use dashcore_rpc::dashcore::{ProTxHash, QuorumHash}; use dpp::block::block_info::BlockInfo; -use dpp::data_contract::created_data_contract::CreatedDataContract; +use dpp::state_transition::identity_topup_transition::methods::IdentityTopUpTransitionMethodsV0; +use dpp::ProtocolError; + +use dpp::dashcore::secp256k1::SecretKey; use dpp::data_contract::document_type::random_document::CreateRandomDocument; -use dpp::data_contract::DataContract; +use dpp::data_contract::{DataContract, DataContractFactory}; +use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; use strategy_tests::frequency::Frequency; use strategy_tests::operations::FinalizeBlockOperation::IdentityAddKeys; use strategy_tests::operations::{ - DocumentAction, DocumentOp, FinalizeBlockOperation, IdentityUpdateOp, Operation, OperationType, + DocumentAction, DocumentOp, FinalizeBlockOperation, IdentityUpdateOp, OperationType, }; use dpp::document::DocumentV0Getters; use dpp::fee::Credits; -use dpp::identity::{Identity, KeyType, Purpose, SecurityLevel}; +use dpp::identity::{Identity, IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; use dpp::state_transition::StateTransition; use dpp::util::deserializer::ProtocolVersion; use dpp::version::PlatformVersion; -use drive::drive::flags::StorageFlags::SingleEpoch; use drive::drive::identity::key::fetch::{IdentityKeysRequest, KeyRequestType}; use drive::drive::Drive; +use drive::util::storage_flags::StorageFlags::SingleEpoch; +use dpp::identity::KeyType::ECDSA_SECP256K1; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::state_transition::data_contract_update_transition::methods::DataContractUpdateTransitionMethodsV0; -use drive::query::DriveQuery; -use drive_abci::abci::AbciApplication; +use drive::query::DriveDocumentQuery; use drive_abci::mimic::test_quorum::TestQuorumInfo; use drive_abci::platform_types::platform::Platform; use drive_abci::rpc::core::MockCoreRPCLike; use rand::prelude::{IteratorRandom, SliceRandom, StdRng}; use rand::Rng; use strategy_tests::Strategy; +use strategy_tests::transitions::{create_state_transitions_for_identities, create_state_transitions_for_identities_and_proofs, instant_asset_lock_proof_fixture}; use std::borrow::Cow; use std::collections::{BTreeMap, HashMap, HashSet}; +use std::str::FromStr; use tenderdash_abci::proto::abci::{ExecTxResult, ValidatorSetUpdate}; -use dpp::data_contract::document_type::accessors::{DocumentTypeV0Getters}; +use dpp::dashcore::hashes::Hash; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::data_contract::document_type::v0::DocumentTypeV0; +use dpp::identifier::MasternodeIdentifiers; use dpp::identity::accessors::IdentityGettersV0; -use dpp::platform_value::BinaryData; +use dpp::identity::identity_public_key::v0::IdentityPublicKeyV0; +use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +use dpp::platform_value::{BinaryData, Value}; +use dpp::prelude::{AssetLockProof, Identifier, IdentityNonce}; use dpp::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; use dpp::state_transition::documents_batch_transition::document_create_transition::{DocumentCreateTransition, DocumentCreateTransitionV0}; use dpp::state_transition::documents_batch_transition::document_transition::document_delete_transition::DocumentDeleteTransitionV0; use dpp::state_transition::documents_batch_transition::document_transition::document_replace_transition::DocumentReplaceTransitionV0; use dpp::state_transition::documents_batch_transition::{DocumentsBatchTransition, DocumentsBatchTransitionV0}; -use dpp::state_transition::documents_batch_transition::document_transition::{DocumentDeleteTransition, DocumentReplaceTransition}; +use dpp::state_transition::documents_batch_transition::document_transition::{DocumentDeleteTransition, DocumentReplaceTransition, DocumentTransferTransition}; use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use dpp::state_transition::data_contract_create_transition::methods::v0::DataContractCreateTransitionMethodsV0; -use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::state_transition::documents_batch_transition::document_transition::document_transfer_transition::DocumentTransferTransitionV0; +use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; +use dpp::state_transition::masternode_vote_transition::methods::MasternodeVoteTransitionMethodsV0; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::ResourceVote; +use dpp::voting::votes::resource_vote::v0::ResourceVoteV0; +use dpp::voting::votes::Vote; +use drive_abci::abci::app::FullAbciApplication; +use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; +use drive_abci::config::PlatformConfig; +use drive_abci::platform_types::signature_verification_quorum_set::{ + QuorumConfig, Quorums, SigningQuorum, +}; +use drive_abci::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; + +use crate::strategy::CoreHeightIncrease::NoCoreHeightIncrease; use simple_signer::signer::SimpleSigner; #[derive(Clone, Debug, Default)] @@ -103,18 +131,6 @@ impl MasternodeListChangesStrategy { || self.changed_ip_masternodes.is_set() } - pub fn removed_any_masternode_types(&self) -> bool { - self.removed_masternodes.is_set() || self.removed_hpmns.is_set() - } - - pub fn updated_any_masternode_types(&self) -> bool { - self.updated_masternodes.is_set() || self.updated_hpmns.is_set() - } - - pub fn added_any_masternode_types(&self) -> bool { - self.new_masternodes.is_set() || self.new_hpmns.is_set() - } - pub fn any_kind_of_update_is_set(&self) -> bool { self.updated_hpmns.is_set() || self.banned_hpmns.is_set() @@ -127,8 +143,30 @@ impl MasternodeListChangesStrategy { || self.unbanned_masternodes.is_set() || self.changed_ip_masternodes.is_set() } + + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub fn removed_any_masternode_types(&self) -> bool { + self.removed_masternodes.is_set() || self.removed_hpmns.is_set() + } + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub fn updated_any_masternode_types(&self) -> bool { + self.updated_masternodes.is_set() || self.updated_hpmns.is_set() + } + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub fn added_any_masternode_types(&self) -> bool { + self.new_masternodes.is_set() || self.new_hpmns.is_set() + } } +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub enum StrategyMode { ProposerOnly, ProposerAndValidatorHashValidationOnly, @@ -154,20 +192,83 @@ pub struct MasternodeChanges { pub masternode_change_port_chance: Frequency, } +#[derive(Clone, Debug, Default)] +pub enum CoreHeightIncrease { + #[default] + NoCoreHeightIncrease, + RandomCoreHeightIncrease(Frequency), + #[allow(dead_code)] // TODO investigate why this is never constructed according to compiler + KnownCoreHeightIncreases(Vec), +} + +impl CoreHeightIncrease { + pub fn max_core_height(&self, block_count: u64, initial_core_height: u32) -> u32 { + match self { + NoCoreHeightIncrease => initial_core_height, + CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { + initial_core_height + frequency.max_event_count() as u32 * block_count as u32 + } + CoreHeightIncrease::KnownCoreHeightIncreases(values) => { + values.last().copied().unwrap_or(initial_core_height) + } + } + } + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub fn average_core_height(&self, block_count: u64, initial_core_height: u32) -> u32 { + match self { + NoCoreHeightIncrease => initial_core_height, + CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { + initial_core_height + frequency.average_event_count() as u32 * block_count as u32 + } + CoreHeightIncrease::KnownCoreHeightIncreases(values) => values + .get(values.len() / 2) + .copied() + .unwrap_or(initial_core_height), + } + } + + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] + pub fn add_events_if_hit(&mut self, core_height: u32, rng: &mut StdRng) -> u32 { + match self { + NoCoreHeightIncrease => 0, + CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { + core_height + frequency.events_if_hit(rng) as u32 + } + CoreHeightIncrease::KnownCoreHeightIncreases(values) => { + if values.len() == 1 { + *values.first().unwrap() + } else { + values.pop().unwrap() + } + } + } + } +} + #[derive(Clone, Debug)] pub struct NetworkStrategy { pub strategy: Strategy, pub total_hpmns: u16, pub extra_normal_mns: u16, - pub quorum_count: u16, + pub validator_quorum_count: u16, + pub chain_lock_quorum_count: u16, + pub instant_lock_quorum_count: u16, + pub initial_core_height: u32, pub upgrading_info: Option, - pub core_height_increase: Frequency, + pub core_height_increase: CoreHeightIncrease, pub proposer_strategy: MasternodeListChangesStrategy, pub rotate_quorums: bool, pub failure_testing: Option, pub query_testing: Option, pub verify_state_transition_results: bool, - pub max_tx_bytes_per_block: i64, + pub max_tx_bytes_per_block: u64, + pub independent_process_proposal_verification: bool, + pub sign_chain_locks: bool, + pub sign_instant_locks: bool, } impl Default for NetworkStrategy { @@ -176,18 +277,21 @@ impl Default for NetworkStrategy { strategy: Default::default(), total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + instant_lock_quorum_count: 24, + initial_core_height: 1, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + core_height_increase: NoCoreHeightIncrease, proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, query_testing: None, verify_state_transition_results: false, max_tx_bytes_per_block: 44800, + independent_process_proposal_verification: false, + sign_chain_locks: false, + sign_instant_locks: false, } } } @@ -247,6 +351,9 @@ impl NetworkStrategy { } // TODO: This belongs to `DocumentOp` + #[allow(dead_code)] + #[deprecated(note = "This function is marked as unused.")] + #[allow(deprecated)] pub fn add_strategy_contracts_into_drive( &mut self, drive: &Drive, @@ -278,37 +385,53 @@ impl NetworkStrategy { block_info: &BlockInfo, signer: &mut SimpleSigner, rng: &mut StdRng, + instant_lock_quorums: &Quorums, + platform_config: &PlatformConfig, platform_version: &PlatformVersion, - ) -> Vec<(Identity, StateTransition)> { + ) -> Result, ProtocolError> { let mut state_transitions = vec![]; - if block_info.height == 1 && !self.strategy.start_identities.is_empty() { - state_transitions.append(&mut self.strategy.start_identities.clone()); - } - let frequency = &self.strategy.identities_inserts; - if frequency.check_hit(rng) { - let count = frequency.events(rng); - state_transitions.append( - &mut strategy_tests::transitions::create_identities_state_transitions( - count, - 5, + if block_info.height == 1 { + if self.strategy.start_identities.number_of_identities > 0 { + let mut new_transitions = self.create_identities_state_transitions( + self.strategy.start_identities.number_of_identities, signer, rng, + instant_lock_quorums, + platform_config, platform_version, - ), - ) + ); + state_transitions.append(&mut new_transitions); + } + if !self.strategy.start_identities.hard_coded.is_empty() { + state_transitions.extend(self.strategy.start_identities.hard_coded.clone()); + } } - state_transitions + let frequency = &self.strategy.identity_inserts.frequency; + if frequency.check_hit(rng) { + let count = frequency.events(rng); + let mut new_transitions = self.create_identities_state_transitions( + count, + signer, + rng, + instant_lock_quorums, + platform_config, + platform_version, + ); + state_transitions.append(&mut new_transitions); + } + Ok(state_transitions) } - pub fn contract_state_transitions( + pub fn initial_contract_state_transitions( &mut self, current_identities: &Vec, signer: &SimpleSigner, + contract_nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> Vec { self.strategy - .contracts_with_updates + .start_contracts .iter_mut() .map(|(created_contract, contract_updates)| { let identity_num = rng.gen_range(0..current_identities.len()); @@ -318,13 +441,14 @@ impl NetworkStrategy { .clone() .into_partial_identity_info(); - let entropy_used = *created_contract.entropy_used(); + let identity_nonce = created_contract.identity_nonce(); let contract = created_contract.data_contract_mut(); contract.set_owner_id(identity.id); let old_id = contract.id(); - let new_id = DataContract::generate_data_contract_id_v0(identity.id, entropy_used); + let new_id = + DataContract::generate_data_contract_id_v0(identity.id, identity_nonce); contract.set_id(new_id); if let Some(contract_updates) = contract_updates { @@ -350,30 +474,35 @@ impl NetworkStrategy { } }); - let state_transition = DataContractCreateTransition::new_from_data_contract( + let identity_contract_nonce = contract_nonce_counter + .entry((identity.id, contract.id())) + .or_default(); + *identity_contract_nonce += 1; + + DataContractCreateTransition::new_from_data_contract( contract.clone(), - *created_contract.entropy_used(), + identity_nonce, &identity, 1, //key id 1 should always be a high or critical auth key in these tests signer, platform_version, None, ) - .expect("expected to create a create state transition from a data contract"); - state_transition + .expect("expected to create a create state transition from a data contract") }) .collect() } - pub fn contract_update_state_transitions( + pub fn initial_contract_update_state_transitions( &mut self, current_identities: &Vec, block_height: u64, signer: &SimpleSigner, + contract_nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, platform_version: &PlatformVersion, ) -> Vec { self.strategy - .contracts_with_updates + .start_contracts .iter_mut() .filter_map(|(_, contract_updates)| { let Some(contract_updates) = contract_updates else { @@ -389,10 +518,17 @@ impl NetworkStrategy { .clone() .into_partial_identity_info(); + let identity_contract_nonce = contract_nonce_counter + .entry((identity.id, contract_update.data_contract().id())) + .or_default(); + *identity_contract_nonce += 1; + let state_transition = DataContractUpdateTransition::new_from_data_contract( contract_update.data_contract().clone(), &identity, 1, //key id 1 should always be a high or critical auth key in these tests + *identity_contract_nonce, + 0, signer, platform_version, None, @@ -405,33 +541,57 @@ impl NetworkStrategy { // TODO: this belongs to `DocumentOp`, also randomization details are common for all operations // and could be moved out of here - pub fn state_transitions_for_block( + pub fn operations_based_transitions( &self, platform: &Platform, block_info: &BlockInfo, current_identities: &mut Vec, signer: &mut SimpleSigner, + identity_nonce_counter: &mut BTreeMap, + contract_nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, + // first identifier is the vote poll id + // second identifier is the identifier + current_votes: &mut BTreeMap>, + instant_lock_quorums: &Quorums, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> (Vec, Vec) { + let mut maybe_state = None; let mut operations = vec![]; let mut finalize_block_operations = vec![]; let mut replaced = vec![]; + let mut transferred = vec![]; let mut deleted = vec![]; + let max_document_operation_count_without_inserts = + self.strategy.max_document_operation_count_without_inserts(); for op in &self.strategy.operations { if op.frequency.check_hit(rng) { - let count = rng.gen_range(op.frequency.times_per_block_range.clone()); + let mut count = rng.gen_range(op.frequency.times_per_block_range.clone()); match &op.op_type { OperationType::Document(DocumentOp { action: DocumentAction::DocumentActionInsertRandom(fill_type, fill_size), document_type, contract, }) => { + if current_identities.len() < count as usize { + count = current_identities.len() as u16; + + tracing::warn!( + "Not enough identities to insert documents, reducing count to {}", + count + ); + } + + let current_identities_as_refs: Vec<&dpp::identity::Identity> = + current_identities.iter().collect(); + let documents = document_type .random_documents_with_params( count as u32, - current_identities, - block_info.time_ms, + current_identities_as_refs.as_ref(), + Some(block_info.time_ms), + Some(block_info.height), + Some(block_info.core_height), *fill_type, *fill_size, rng, @@ -441,24 +601,38 @@ impl NetworkStrategy { documents .into_iter() .for_each(|(document, identity, entropy)| { - let updated_at = - if document_type.required_fields().contains("$updatedAt") { - document.created_at() - } else { - None - }; + let identity_contract_nonce = contract_nonce_counter + .entry((identity.id(), contract.id())) + .or_default(); + let gap = self + .strategy + .identity_contract_nonce_gaps + .as_ref() + .map_or(0, |gap_amount| gap_amount.events_if_hit(rng)) + as u64; + *identity_contract_nonce += 1 + gap; + + let prefunded_voting_balances = document_type + .prefunded_voting_balances_for_document( + &document, + platform_version, + ) + .expect( + "expected to get prefunded voting balances for document", + ); + let document_create_transition: DocumentCreateTransition = DocumentCreateTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } .into(), entropy: entropy.to_buffer(), - created_at: document.created_at(), - updated_at, data: document.properties_consumed(), + prefunded_voting_balance: prefunded_voting_balances, } .into(); @@ -466,6 +640,7 @@ impl NetworkStrategy { DocumentsBatchTransitionV0 { owner_id: identity.id(), transitions: vec![document_create_transition.into()], + user_fee_increase: 0, signature_public_key_id: 0, signature: BinaryData::default(), } @@ -484,6 +659,7 @@ impl NetworkStrategy { KeyType::ECDSA_SECP256K1, KeyType::BLS12_381, ]), + false, ) .expect("expected to get a signing key"); @@ -512,16 +688,23 @@ impl NetworkStrategy { contract, }) => { let documents = if let Some(identifier) = identifier { - let held_identity = vec![current_identities + let held_identity = current_identities .iter() .find(|identity| identity.id() == identifier) - .expect("expected to find identifier, review strategy params") - .clone()]; + .expect("expected to find identifier, review strategy params"); + + let mut eligible_identities = Vec::with_capacity(count as usize); + for _ in 0..count { + eligible_identities.push(held_identity); + } + document_type .random_documents_with_params( count as u32, - &held_identity, - block_info.time_ms, + &eligible_identities, + Some(block_info.time_ms), + Some(block_info.height), + Some(block_info.core_height), *fill_type, *fill_size, rng, @@ -529,11 +712,16 @@ impl NetworkStrategy { ) .expect("expected random_documents_with_params") } else { + let current_identities_as_refs: Vec<&dpp::identity::Identity> = + current_identities.iter().collect(); + document_type .random_documents_with_params( count as u32, - current_identities, - block_info.time_ms, + current_identities_as_refs.as_ref(), + Some(block_info.time_ms), + Some(block_info.height), + Some(block_info.core_height), *fill_type, *fill_size, rng, @@ -548,24 +736,33 @@ impl NetworkStrategy { document .properties_mut() .append(&mut specific_document_key_value_pairs.clone()); - let updated_at = - if document_type.required_fields().contains("$updatedAt") { - document.created_at() - } else { - None - }; + + let identity_contract_nonce = contract_nonce_counter + .entry((identity.id(), contract.id())) + .or_default(); + *identity_contract_nonce += 1; + + let prefunded_voting_balances = document_type + .prefunded_voting_balances_for_document( + &document, + platform_version, + ) + .expect( + "expected to get prefunded voting balances for document", + ); + let document_create_transition: DocumentCreateTransition = DocumentCreateTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } .into(), entropy: entropy.to_buffer(), - created_at: document.created_at(), - updated_at, data: document.properties_consumed(), + prefunded_voting_balance: prefunded_voting_balances, } .into(); @@ -573,6 +770,7 @@ impl NetworkStrategy { DocumentsBatchTransitionV0 { owner_id: identity.id(), transitions: vec![document_create_transition.into()], + user_fee_increase: 0, signature_public_key_id: 0, signature: BinaryData::default(), } @@ -591,6 +789,7 @@ impl NetworkStrategy { KeyType::ECDSA_SECP256K1, KeyType::BLS12_381, ]), + false, ) .expect("expected to get a signing key"); @@ -612,8 +811,11 @@ impl NetworkStrategy { document_type, contract, }) => { - let any_item_query = - DriveQuery::any_item_query(contract, document_type.as_ref()); + let any_item_query = DriveDocumentQuery::all_items_query( + contract, + document_type.as_ref(), + Some(max_document_operation_count_without_inserts), + ); let mut items = platform .drive .query_documents( @@ -630,6 +832,8 @@ impl NetworkStrategy { items.retain(|item| !replaced.contains(&item.id())); + items.retain(|item| !transferred.contains(&item.id())); + if !items.is_empty() { let document = items.remove(0); @@ -649,10 +853,18 @@ impl NetworkStrategy { .fetch_identity_balance_with_keys(request, None, platform_version) .expect("expected to be able to get identity") .expect("expected to get an identity"); + let identity_contract_nonce = contract_nonce_counter + .get_mut(&(identity.id, contract.id())) + .expect( + "the identity should already have a nonce for that contract", + ); + *identity_contract_nonce += 1; + let document_delete_transition: DocumentDeleteTransition = DocumentDeleteTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } @@ -664,6 +876,7 @@ impl NetworkStrategy { DocumentsBatchTransitionV0 { owner_id: identity.id, transitions: vec![document_delete_transition.into()], + user_fee_increase: 0, signature_public_key_id: 0, signature: BinaryData::default(), } @@ -692,12 +905,12 @@ impl NetworkStrategy { } } OperationType::Document(DocumentOp { - action: DocumentAction::DocumentActionReplace, + action: DocumentAction::DocumentActionReplaceRandom, document_type, contract, }) => { let any_item_query = - DriveQuery::any_item_query(contract, document_type.as_ref()); + DriveDocumentQuery::any_item_query(contract, document_type.as_ref()); let mut items = platform .drive .query_documents( @@ -714,6 +927,8 @@ impl NetworkStrategy { items.retain(|item| !replaced.contains(&item.id())); + items.retain(|item| !transferred.contains(&item.id())); + if !items.is_empty() { let document = items.remove(0); @@ -736,10 +951,18 @@ impl NetworkStrategy { .fetch_identity_balance_with_keys(request, None, platform_version) .expect("expected to be able to get identity") .expect("expected to get an identity"); + let identity_contract_nonce = contract_nonce_counter + .get_mut(&(identity.id, contract.id())) + .expect( + "the identity should already have a nonce for that contract", + ); + *identity_contract_nonce += 1; + let document_replace_transition: DocumentReplaceTransition = DocumentReplaceTransitionV0 { base: DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce: *identity_contract_nonce, document_type_name: document_type.name().clone(), data_contract_id: contract.id(), } @@ -748,7 +971,6 @@ impl NetworkStrategy { .revision() .expect("expected to unwrap revision") + 1, - updated_at: Some(block_info.time_ms), data: random_new_document.properties_consumed(), } .into(); @@ -757,6 +979,118 @@ impl NetworkStrategy { DocumentsBatchTransitionV0 { owner_id: identity.id, transitions: vec![document_replace_transition.into()], + user_fee_increase: 0, + signature_public_key_id: 0, + signature: BinaryData::default(), + } + .into(); + + let mut document_batch_transition: StateTransition = + document_batch_transition.into(); + + let identity_public_key = identity + .loaded_public_keys + .values() + .next() + .expect("expected a key"); + + document_batch_transition + .sign_external( + identity_public_key, + signer, + Some(|_data_contract_id, _document_type_name| { + Ok(SecurityLevel::HIGH) + }), + ) + .expect("expected to sign"); + + operations.push(document_batch_transition); + } + } + OperationType::Document(DocumentOp { + action: DocumentAction::DocumentActionTransferRandom, + document_type, + contract, + }) => { + let any_item_query = + DriveDocumentQuery::any_item_query(contract, document_type.as_ref()); + let mut items = platform + .drive + .query_documents( + any_item_query, + Some(&block_info.epoch), + false, + None, + Some(platform_version.protocol_version), + ) + .expect("expect to execute query") + .documents_owned(); + + items.retain(|item| !deleted.contains(&item.id())); + + items.retain(|item| !replaced.contains(&item.id())); + + items.retain(|item| !transferred.contains(&item.id())); + + if !items.is_empty() { + let document = items.remove(0); + + transferred.push(document.id()); + + let random_index = rng.gen_range(0..current_identities.len()); + let mut random_identity_id = current_identities[random_index].id(); + + if random_identity_id == document.owner_id() { + if current_identities.len() == 1 { + continue; + } + if random_index == current_identities.len() - 1 { + // we are at the end + random_identity_id = current_identities[random_index - 1].id(); + } else { + random_identity_id = current_identities[random_index + 1].id(); + } + } + + let request = IdentityKeysRequest { + identity_id: document.owner_id().to_buffer(), + request_type: KeyRequestType::SpecificKeys(vec![1]), + limit: Some(1), + offset: None, + }; + let identity = platform + .drive + .fetch_identity_balance_with_keys(request, None, platform_version) + .expect("expected to be able to get identity") + .expect("expected to get an identity"); + let identity_contract_nonce = contract_nonce_counter + .get_mut(&(identity.id, contract.id())) + .expect( + "the identity should already have a nonce for that contract", + ); + *identity_contract_nonce += 1; + let document_transfer_transition: DocumentTransferTransition = + DocumentTransferTransitionV0 { + base: DocumentBaseTransitionV0 { + id: document.id(), + identity_contract_nonce: *identity_contract_nonce, + document_type_name: document_type.name().clone(), + data_contract_id: contract.id(), + } + .into(), + revision: document + .revision() + .expect("expected to unwrap revision") + + 1, + recipient_owner_id: random_identity_id, + } + .into(); + + let document_batch_transition: DocumentsBatchTransition = + DocumentsBatchTransitionV0 { + owner_id: identity.id, + transitions: vec![document_transfer_transition.into()], + user_fee_increase: 0, signature_public_key_id: 0, signature: BinaryData::default(), } @@ -793,13 +1127,13 @@ impl NetworkStrategy { .collect(); for random_identity in random_identities { - operations.push( - strategy_tests::transitions::create_identity_top_up_transition( - rng, - random_identity, - platform_version, - ), - ); + operations.push(self.create_identity_top_up_transition( + rng, + random_identity, + instant_lock_quorums, + &platform.config, + platform_version, + )); } } OperationType::IdentityUpdate(update_op) if !current_identities.is_empty() => { @@ -813,6 +1147,8 @@ impl NetworkStrategy { strategy_tests::transitions::create_identity_update_transition_add_keys( random_identity, *count, + 0, + identity_nonce_counter, signer, rng, platform_version, @@ -828,6 +1164,7 @@ impl NetworkStrategy { strategy_tests::transitions::create_identity_update_transition_disable_keys( random_identity, *count, + identity_nonce_counter, block_info.time_ms, signer, rng, @@ -848,6 +1185,7 @@ impl NetworkStrategy { let state_transition = strategy_tests::transitions::create_identity_withdrawal_transition( random_identity, + identity_nonce_counter, signer, rng, ); @@ -855,12 +1193,12 @@ impl NetworkStrategy { } } OperationType::IdentityTransfer if current_identities.len() > 1 => { - // chose 2 last identities - let indices: Vec = - vec![current_identities.len() - 2, current_identities.len() - 1]; + let identities_clone = current_identities.clone(); - let owner = current_identities.get(indices[0]).unwrap(); - let recipient = current_identities.get(indices[1]).unwrap(); + // Sender is the first in the list, which should be loaded_identity + let owner = &mut current_identities[0]; + // Recipient is the second in the list + let recipient = &identities_clone[1]; let fetched_owner_balance = platform .drive @@ -872,21 +1210,186 @@ impl NetworkStrategy { strategy_tests::transitions::create_identity_credit_transfer_transition( owner, recipient, + identity_nonce_counter, signer, fetched_owner_balance - 100, ); operations.push(state_transition); } - // OperationType::ContractCreate(new_fields_optional_count_range, new_fields_required_count_range, new_index_count_range, document_type_count) - // if !current_identities.is_empty() => { - // DataContract::; - // - // DocumentType::random_document() - // } - // OperationType::ContractUpdate(DataContractNewDocumentTypes(count)) - // if !current_identities.is_empty() => { - // - // } + OperationType::ContractCreate(params, doc_type_range) + if !current_identities.is_empty() => + { + let contract_factory = match DataContractFactory::new( + platform_version.protocol_version, + ) { + Ok(contract_factory) => contract_factory, + Err(e) => { + panic!("Failed to get DataContractFactory while creating random contract: {e}"); + } + }; + + // Create `count` ContractCreate transitions and push to operations vec + for _ in 0..count { + // Get the contract owner_id from loaded_identity and loaded_identity nonce + let identity = ¤t_identities[0]; + let identity_nonce = + identity_nonce_counter.entry(identity.id()).or_default(); + *identity_nonce += 1; + let owner_id = identity.id(); + + // Generate a contract id + let contract_id = DataContract::generate_data_contract_id_v0( + owner_id, + *identity_nonce, + ); + + // Create `doc_type_count` doc types + let doc_types = Value::Map( + doc_type_range + .clone() + .map(|_| { + match DocumentTypeV0::random_document_type( + params.clone(), + contract_id, + rng, + platform_version, + ) { + Ok(new_document_type) => { + let doc_type_clone = + new_document_type.schema().clone(); + + ( + Value::Text(new_document_type.name().clone()), + doc_type_clone, + ) + } + Err(e) => { + panic!( + "Error generating random document type: {:?}", + e + ); + } + } + }) + .collect(), + ); + + let created_data_contract = match contract_factory.create( + owner_id, + *identity_nonce, + doc_types, + None, + None, + ) { + Ok(contract) => contract, + Err(e) => { + panic!("Failed to create random data contract: {e}"); + } + }; + + let transition = match contract_factory + .create_data_contract_create_transition(created_data_contract) + { + Ok(transition) => transition, + Err(e) => { + panic!("Failed to create ContractCreate transition: {e}"); + } + }; + + // Sign transition + let public_key = identity + .get_first_public_key_matching( + Purpose::AUTHENTICATION, + HashSet::from([SecurityLevel::CRITICAL]), + HashSet::from([KeyType::ECDSA_SECP256K1]), + false, + ) + .expect("Expected to get identity public key in ContractCreate"); + let mut state_transition = + StateTransition::DataContractCreate(transition); + if let Err(e) = state_transition.sign_external( + public_key, + signer, + None::< + fn(Identifier, String) -> Result, + >, + ) { + panic!("Error signing state transition: {:?}", e); + } + + operations.push(state_transition); + } + } + OperationType::ResourceVote(resource_vote_op) => { + let state = maybe_state.get_or_insert(platform.state.load()); + let full_masternode_list = state.full_masternode_list(); + let vote_poll_id = resource_vote_op + .resolved_vote_poll + .unique_id() + .expect("expected a vote poll unique id"); + let vote_poll_votes = current_votes.entry(vote_poll_id).or_default(); + for _ in 0..count { + let rand_index = rng.gen_range(0..full_masternode_list.len()); + let (pro_tx_hash, masternode_list_item) = + full_masternode_list.iter().nth(rand_index).unwrap(); + + let pro_tx_hash_bytes: [u8; 32] = pro_tx_hash.to_raw_hash().into(); + let voting_address = masternode_list_item.state.voting_address; + + let voting_identifier = Identifier::create_voter_identifier( + pro_tx_hash.as_byte_array(), + &voting_address, + ); + + // Choose the resource vote choice based on weights + let resource_vote_choice = + resource_vote_op.action.choose_weighted_choice(rng); + + if vote_poll_votes.get(&voting_identifier) + == Some(&resource_vote_choice) + { + continue; + } + + let identity_public_key = IdentityPublicKey::V0(IdentityPublicKeyV0 { + id: 0, + purpose: Purpose::VOTING, + security_level: SecurityLevel::MEDIUM, + contract_bounds: None, + key_type: KeyType::ECDSA_HASH160, + read_only: false, + data: voting_address.to_vec().into(), + disabled_at: None, + }); + + let vote = Vote::ResourceVote(ResourceVote::V0(ResourceVoteV0 { + vote_poll: VotePoll::ContestedDocumentResourceVotePoll( + resource_vote_op.resolved_vote_poll.clone().into(), + ), + resource_vote_choice, + })); + + let identity_nonce = + identity_nonce_counter.entry(voting_identifier).or_default(); + *identity_nonce += 1; + + let state_transition = + MasternodeVoteTransition::try_from_vote_with_signer( + vote, + signer, + Identifier::from(pro_tx_hash_bytes), + &identity_public_key, + *identity_nonce, + platform_version, + None, + ) + .expect("expected to make a masternode vote transition"); + + vote_poll_votes.insert(voting_identifier, resource_vote_choice); + + operations.push(state_transition); + } + } _ => {} } } @@ -894,38 +1397,66 @@ impl NetworkStrategy { (operations, finalize_block_operations) } - pub fn state_transitions_for_block_with_new_identities( + pub fn state_transitions_for_block( &mut self, platform: &Platform, block_info: &BlockInfo, current_identities: &mut Vec, + identity_nonce_counter: &mut BTreeMap, + contract_nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, + current_votes: &mut BTreeMap>, signer: &mut SimpleSigner, rng: &mut StdRng, + instant_lock_quorums: &Quorums, ) -> (Vec, Vec) { let mut finalize_block_operations = vec![]; - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state .current_platform_version() .expect("expected platform version"); - let identity_state_transitions = - self.identity_state_transitions_for_block(block_info, signer, rng, platform_version); - let (mut identities, mut state_transitions): (Vec, Vec) = - identity_state_transitions.into_iter().unzip(); + + let identity_state_transitions_result = self.identity_state_transitions_for_block( + block_info, + signer, + rng, + instant_lock_quorums, + &platform.config, + platform_version, + ); + + // Handle the Result returned by identity_state_transitions_for_block + let (mut identities, mut state_transitions) = match identity_state_transitions_result { + Ok(transitions) => transitions.into_iter().unzip(), + Err(error) => { + eprintln!("Error creating identity state transitions: {:?}", error); + (vec![], vec![]) + } + }; + current_identities.append(&mut identities); if block_info.height == 1 { // add contracts on block 1 - let mut contract_state_transitions = - self.contract_state_transitions(current_identities, signer, rng, platform_version); + let mut contract_state_transitions = self.initial_contract_state_transitions( + current_identities, + signer, + contract_nonce_counter, + rng, + platform_version, + ); state_transitions.append(&mut contract_state_transitions); } else { // Don't do any state transitions on block 1 let (mut document_state_transitions, mut add_to_finalize_block_operations) = self - .state_transitions_for_block( + .operations_based_transitions( platform, block_info, current_identities, signer, + identity_nonce_counter, + contract_nonce_counter, + current_votes, + instant_lock_quorums, rng, platform_version, ); @@ -934,17 +1465,142 @@ impl NetworkStrategy { // There can also be contract updates - let mut contract_update_state_transitions = self.contract_update_state_transitions( - current_identities, - block_info.height, - signer, - platform_version, - ); + let mut contract_update_state_transitions = self + .initial_contract_update_state_transitions( + current_identities, + block_info.height, + signer, + contract_nonce_counter, + platform_version, + ); state_transitions.append(&mut contract_update_state_transitions); } (state_transitions, finalize_block_operations) } + + // add this because strategy tests library now requires a callback and uses the actual chain. + fn create_identities_state_transitions( + &self, + count: u16, + signer: &mut SimpleSigner, + rng: &mut StdRng, + instant_lock_quorums: &Quorums, + platform_config: &PlatformConfig, + platform_version: &PlatformVersion, + ) -> Vec<(Identity, StateTransition)> { + let key_count = self.strategy.identity_inserts.start_keys as KeyID; + let extra_keys = &self.strategy.identity_inserts.extra_keys; + + let (mut identities, mut keys) = Identity::random_identities_with_private_keys_with_rng::< + Vec<_>, + >(count, key_count, rng, platform_version) + .expect("expected to create identities"); + + for identity in identities.iter_mut() { + for (purpose, security_to_key_type_map) in extra_keys { + for (security_level, key_types) in security_to_key_type_map { + for key_type in key_types { + let (key, private_key) = + IdentityPublicKey::random_key_with_known_attributes( + (identity.public_keys().len() + 1) as KeyID, + rng, + *purpose, + *security_level, + *key_type, + None, + platform_version, + ) + .expect("expected to create key"); + identity.add_public_key(key.clone()); + keys.push((key, private_key)); + } + } + } + } + + signer.add_keys(keys); + + if self.sign_instant_locks { + let identities_with_proofs = create_signed_instant_asset_lock_proofs_for_identities( + identities, + rng, + instant_lock_quorums, + platform_config, + platform_version, + ); + + create_state_transitions_for_identities_and_proofs( + identities_with_proofs, + signer, + platform_version, + ) + } else { + create_state_transitions_for_identities(identities, signer, rng, platform_version) + } + } + + // add this because strategy tests library now requires a callback and uses the actual chain. + fn create_identity_top_up_transition( + &self, + rng: &mut StdRng, + identity: &Identity, + instant_lock_quorums: &Quorums, + platform_config: &PlatformConfig, + platform_version: &PlatformVersion, + ) -> StateTransition { + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(rng, platform_version) + .unwrap(); + let sk: [u8; 32] = pk.try_into().unwrap(); + let secret_key = SecretKey::from_str(hex::encode(sk).as_str()).unwrap(); + let mut asset_lock_proof = + instant_asset_lock_proof_fixture(PrivateKey::new(secret_key, Network::Dash)); + + // Sign transaction and update signature in instant lock proof + if self.sign_instant_locks { + let quorum_config = QuorumConfig { + quorum_type: platform_config.instant_lock.quorum_type, + active_signers: platform_config.instant_lock.quorum_active_signers, + rotation: platform_config.instant_lock.quorum_rotation, + window: platform_config.instant_lock.quorum_window, + }; + + // Sign transaction and update instant lock + let AssetLockProof::Instant(InstantAssetLockProof { instant_lock, .. }) = + &mut asset_lock_proof + else { + panic!("must be instant lock proof"); + }; + + let request_id = instant_lock + .request_id() + .expect("failed to build request id"); + + let (quorum_hash, quorum) = instant_lock_quorums + .choose_quorum(&quorum_config, request_id.as_ref()) + .expect("failed to choose quorum for instant lock transaction signing"); + + instant_lock.signature = quorum + .sign_for_instant_lock( + &quorum_config, + &quorum_hash, + request_id.as_ref(), + &instant_lock.txid, + ) + .expect("failed to sign transaction for instant lock"); + } + + IdentityTopUpTransition::try_from_identity( + identity, + asset_lock_proof, + secret_key.as_ref(), + 0, + platform_version, + None, + ) + .expect("expected to create top up transition") + } } pub enum StrategyRandomness { @@ -961,17 +1617,22 @@ pub struct ValidatorVersionMigration { #[derive(Debug)] pub struct ChainExecutionOutcome<'a> { - pub abci_app: AbciApplication<'a, MockCoreRPCLike>, + pub abci_app: FullAbciApplication<'a, MockCoreRPCLike>, pub masternode_identity_balances: BTreeMap<[u8; 32], Credits>, pub identities: Vec, pub proposers: Vec, - pub quorums: BTreeMap, - pub current_quorum_hash: QuorumHash, + pub validator_quorums: BTreeMap, + pub current_validator_quorum_hash: QuorumHash, pub current_proposer_versions: Option>, + pub instant_lock_quorums: Quorums, + /// Identity nonce counters + pub identity_nonce_counter: BTreeMap, + /// Identity Contract nonce counters + pub identity_contract_nonce_counter: BTreeMap<(Identifier, Identifier), IdentityNonce>, pub end_epoch_index: u16, pub end_time_ms: u64, pub strategy: NetworkStrategy, - pub withdrawals: Vec, + pub withdrawals: UnsignedWithdrawalTxs, /// height to the validator set update at that height pub validator_set_updates: BTreeMap, pub state_transition_results_per_block: BTreeMap>, @@ -979,8 +1640,8 @@ pub struct ChainExecutionOutcome<'a> { impl<'a> ChainExecutionOutcome<'a> { pub fn current_quorum(&self) -> &TestQuorumInfo { - self.quorums - .get::(&self.current_quorum_hash) + self.validator_quorums + .get::(&self.current_validator_quorum_hash) .unwrap() } } @@ -990,11 +1651,72 @@ pub struct ChainExecutionParameters { pub core_height_start: u32, pub block_count: u64, pub proposers: Vec, - pub quorums: BTreeMap, - pub current_quorum_hash: QuorumHash, + pub validator_quorums: BTreeMap, + pub current_validator_quorum_hash: QuorumHash, + pub instant_lock_quorums: Quorums, // the first option is if it is set // the second option is if we are even upgrading pub current_proposer_versions: Option>>, + pub current_identity_nonce_counter: BTreeMap, + pub current_identity_contract_nonce_counter: BTreeMap<(Identifier, Identifier), IdentityNonce>, + pub current_votes: BTreeMap>, pub start_time_ms: u64, pub current_time_ms: u64, } + +fn create_signed_instant_asset_lock_proofs_for_identities( + identities: Vec, + rng: &mut StdRng, + instant_lock_quorums: &Quorums, + platform_config: &PlatformConfig, + platform_version: &PlatformVersion, +) -> Vec<(Identity, [u8; 32], AssetLockProof)> { + let quorum_config = QuorumConfig { + quorum_type: platform_config.instant_lock.quorum_type, + active_signers: platform_config.instant_lock.quorum_active_signers, + rotation: platform_config.instant_lock.quorum_rotation, + window: platform_config.instant_lock.quorum_window, + }; + + identities + .into_iter() + .map(|identity| { + // Create instant asset lock proof + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(rng, platform_version) + .unwrap(); + + let pk_fixed: [u8; 32] = pk.try_into().unwrap(); + let secret_key = SecretKey::from_str(hex::encode(pk_fixed).as_str()).unwrap(); + let private_key = PrivateKey::new(secret_key, Network::Dash); + + let mut asset_lock_proof = instant_asset_lock_proof_fixture(private_key); + + // Sign transaction and update instant lock + let AssetLockProof::Instant(InstantAssetLockProof { instant_lock, .. }) = + &mut asset_lock_proof + else { + panic!("must be instant lock proof"); + }; + + let request_id = instant_lock + .request_id() + .expect("failed to build request id"); + + let (quorum_hash, quorum) = instant_lock_quorums + .choose_quorum(&quorum_config, request_id.as_ref()) + .expect("failed to choose quorum for instant lock transaction signing"); + + instant_lock.signature = quorum + .sign_for_instant_lock( + &quorum_config, + &quorum_hash, + request_id.as_ref(), + &instant_lock.txid, + ) + .expect("failed to sign transaction for instant lock"); + + (identity, pk_fixed, asset_lock_proof) + }) + .collect() +} diff --git a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs index 8fe6259375f..b1fc8e7be8a 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs @@ -1,27 +1,39 @@ #[cfg(test)] mod tests { + use dpp::block::block_info::BlockInfo; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; + use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0Getters; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::{BlockHash, ChainLock}; use dpp::version::PlatformVersion; - use drive::drive::config::DriveConfig; - use tenderdash_abci::proto::types::CoreChainLock; + use drive::config::DriveConfig; + use std::collections::{BTreeMap, HashMap}; use crate::execution::{continue_chain_for_strategy, run_chain_for_strategy}; use crate::strategy::{ - ChainExecutionOutcome, ChainExecutionParameters, NetworkStrategy, StrategyRandomness, - UpgradingInfo, + ChainExecutionOutcome, ChainExecutionParameters, CoreHeightIncrease, + MasternodeListChangesStrategy, NetworkStrategy, StrategyRandomness, UpgradingInfo, }; - use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; + use drive_abci::config::{ + ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig, + ValidatorSetConfig, + }; + use drive_abci::logging::LogLevel; + use drive_abci::mimic::MimicExecuteBlockOptions; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; use drive_abci::test::helpers::setup::TestPlatformBuilder; + use platform_version::version; use platform_version::version::mocks::v2_test::TEST_PROTOCOL_VERSION_2; use platform_version::version::mocks::v3_test::TEST_PROTOCOL_VERSION_3; + use platform_version::version::patches::PatchFn; + use platform_version::version::v1::PROTOCOL_VERSION_1; use strategy_tests::frequency::Frequency; - use strategy_tests::Strategy; + use strategy_tests::{IdentityInsertInfo, StartIdentities, Strategy}; #[test] fn run_chain_version_upgrade() { // Define the desired stack size - let stack_size = 4 * 1024 * 1024; //Lets set the stack size to be higher than the default 2MB + let stack_size = 4 * 1024 * 1024; //Let's set the stack size to be higher than the default 2MB let builder = std::thread::Builder::new() .stack_size(stack_size) @@ -32,27 +44,23 @@ mod tests { let platform_version = PlatformVersion::first(); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 460, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 0.1, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -62,10 +70,11 @@ mod tests { }; let twenty_minutes_in_ms = 1000 * 60 * 20; let mut config = PlatformConfig { - quorum_size: 100, + validator_set: ValidatorSetConfig::default_100_67(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 125, epoch_time_length_s: 1576800, ..Default::default() }, @@ -74,7 +83,7 @@ mod tests { ..Default::default() }, block_spacing_ms: twenty_minutes_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; @@ -85,19 +94,22 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = run_chain_for_strategy( &mut platform, @@ -105,21 +117,21 @@ mod tests { strategy.clone(), config.clone(), 13, + &mut None, ); + + let platform = abci_app.platform; + let state = platform.state.load(); + { - let platform = abci_app.platform; - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = platform.drive.cache.protocol_versions_counter.read(); platform .drive .fetch_versions_with_counter(None, &platform_version.drive) .expect("expected to get versions"); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -128,17 +140,13 @@ mod tests { .index, 0 ); + assert_eq!(state.current_protocol_version_in_consensus(), 1); assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&16), Some(&416)) + ( + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap() + ), + (Some(&11), Some(&435)) ); //most nodes were hit (63 were not) } @@ -146,13 +154,8 @@ mod tests { // we did not yet hit the epoch change // let's go a little longer - let platform = abci_app.platform; - let hour_in_ms = 1000 * 60 * 60; - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -166,9 +169,12 @@ mod tests { let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = continue_chain_for_strategy( abci_app, @@ -177,24 +183,26 @@ mod tests { core_height_start: 1, block_count: 200, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy.clone(), config.clone(), StrategyRandomness::SeedEntropy(7), ); + + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -203,35 +211,23 @@ mod tests { .index, 1 ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - TEST_PROTOCOL_VERSION_2 - ); - assert_eq!(counter.get(&1), None); //no one has proposed 1 yet - assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&157)); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!(state.next_epoch_protocol_version(), TEST_PROTOCOL_VERSION_2); + assert_eq!(counter.get(&1).unwrap(), None); //no one has proposed 1 yet + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), Some(&179)); } // we locked in // let's go a little longer to see activation - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() .basic_info() .height + 1; + let ChainExecutionOutcome { .. } = continue_chain_for_strategy( abci_app, ChainExecutionParameters { @@ -239,24 +235,27 @@ mod tests { core_height_start: 1, block_count: 400, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config, StrategyRandomness::SeedEntropy(18), ); + + let state = platform.state.load(); + { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -266,19 +265,12 @@ mod tests { 2 ); assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - TEST_PROTOCOL_VERSION_2 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), + state.current_protocol_version_in_consensus(), TEST_PROTOCOL_VERSION_2 ); - assert_eq!(counter.get(&1), None); //no one has proposed 1 yet - assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&120)); + assert_eq!(state.next_epoch_protocol_version(), TEST_PROTOCOL_VERSION_2); + assert_eq!(counter.get(&1).unwrap(), None); //no one has proposed 1 yet + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), Some(&147)); } }) .expect("Failed to create thread with custom stack size"); @@ -290,7 +282,7 @@ mod tests { #[test] fn run_chain_quick_version_upgrade() { // Define the desired stack size - let stack_size = 4 * 1024 * 1024; //Lets set the stack size to be higher than the default 2MB + let stack_size = 4 * 1024 * 1024; //Let's set the stack size to be higher than the default 2MB let builder = std::thread::Builder::new() .stack_size(stack_size) @@ -301,27 +293,22 @@ mod tests { let platform_version = PlatformVersion::first(); let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 50, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 0.2, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -332,15 +319,19 @@ mod tests { let one_hour_in_s = 60 * 60; let thirty_seconds_in_ms = 1000 * 30; let config = PlatformConfig { - quorum_size: 30, + validator_set: ValidatorSetConfig { + quorum_size: 30, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 30, epoch_time_length_s: one_hour_in_s, ..Default::default() }, block_spacing_ms: thirty_seconds_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; @@ -351,19 +342,22 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = run_chain_for_strategy( &mut platform, @@ -371,21 +365,21 @@ mod tests { strategy.clone(), config.clone(), 13, + &mut None, ); + + let platform = abci_app.platform; + let state = platform.state.load(); + { - let platform = abci_app.platform; - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); platform .drive .fetch_versions_with_counter(None, &platform_version.drive) .expect("expected to get versions"); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -394,20 +388,14 @@ mod tests { .index, 0 ); + assert_eq!(state.last_committed_block_epoch().index, 0); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!(state.next_epoch_protocol_version(), 1); assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - 1 - ); - assert_eq!( - (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), + ( + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap() + ), (Some(&6), Some(&44)) ); //most nodes were hit (63 were not) @@ -415,10 +403,7 @@ mod tests { let platform = abci_app.platform; - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -429,35 +414,40 @@ mod tests { let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = continue_chain_for_strategy( abci_app, ChainExecutionParameters { block_start, core_height_start: 1, - block_count: 2, + block_count: 1, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy.clone(), config.clone(), StrategyRandomness::SeedEntropy(7), ); + + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -466,29 +456,17 @@ mod tests { .index, 1 ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - TEST_PROTOCOL_VERSION_2 - ); - assert_eq!(counter.get(&1), None); //no one has proposed 1 yet - assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&1)); + assert_eq!(state.last_committed_block_epoch().index, 1); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!(state.next_epoch_protocol_version(), TEST_PROTOCOL_VERSION_2); + assert_eq!(counter.get(&1).unwrap(), None); //no one has proposed 1 yet + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), Some(&1)); } // we locked in // let's go 120 blocks more to see activation - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -502,24 +480,25 @@ mod tests { core_height_start: 1, block_count: 120, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config, StrategyRandomness::SeedEntropy(18), ); + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -529,19 +508,13 @@ mod tests { 2 ); assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - TEST_PROTOCOL_VERSION_2 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), + state.current_protocol_version_in_consensus(), TEST_PROTOCOL_VERSION_2 ); - assert_eq!(counter.get(&1), None); //no one has proposed 1 yet - assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&1)); + assert_eq!(state.last_committed_block_epoch().index, 2); + assert_eq!(state.next_epoch_protocol_version(), TEST_PROTOCOL_VERSION_2); + assert_eq!(counter.get(&1).unwrap(), None); //no one has proposed 1 yet + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), Some(&1)); } }) .expect("Failed to create thread with custom stack size"); @@ -550,10 +523,186 @@ mod tests { handler.join().expect("Thread has panicked"); } + #[test] + fn run_chain_on_epoch_change_with_new_version_and_removing_votes() { + fn patch_upgrade_percentage(mut platform_version: PlatformVersion) -> PlatformVersion { + platform_version + .drive_abci + .methods + .protocol_upgrade + .protocol_version_upgrade_percentage_needed = 1; + + platform_version + } + + let mut patches = version::patches::PATCHES.write().unwrap(); + + *patches = HashMap::from_iter(vec![{ + ( + 1, + BTreeMap::from_iter(vec![(1, patch_upgrade_percentage as PatchFn)]), + ) + }]); + + drop(patches); + + let strategy = NetworkStrategy { + total_hpmns: 50, + upgrading_info: Some(UpgradingInfo { + current_protocol_version: PROTOCOL_VERSION_1, + proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], + upgrade_three_quarters_life: 0.0, + }), + core_height_increase: CoreHeightIncrease::KnownCoreHeightIncreases(vec![1, 2, 3, 4, 5]), + // Remove HPMNs to trigger remove_validators_proposed_app_versions + proposer_strategy: MasternodeListChangesStrategy { + removed_hpmns: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + ..Default::default() + }, + ..Default::default() + }; + + // 1 block is 1 epoch + let epoch_time_length_s = 60; + + let config = PlatformConfig { + validator_set: ValidatorSetConfig { + quorum_size: 30, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + epoch_time_length_s, + ..Default::default() + }, + initial_protocol_version: PROTOCOL_VERSION_1, + block_spacing_ms: epoch_time_length_s * 1000, + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + ..Default::default() + }; + + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + end_time_ms, + .. + } = run_chain_for_strategy( + &mut platform, + 1, + strategy.clone(), + config.clone(), + 13, + &mut None, + ); + + let platform = abci_app.platform; + + let state = platform.state.load(); + let counter = platform.drive.cache.protocol_versions_counter.read(); + + assert_eq!(state.last_committed_block_epoch().index, 0); + assert_eq!( + state.current_protocol_version_in_consensus(), + PROTOCOL_VERSION_1 + ); + assert_eq!(state.next_epoch_protocol_version(), PROTOCOL_VERSION_1); + assert_eq!(state.last_committed_core_height(), 2); + assert_eq!(counter.get(&1).unwrap(), None); + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), Some(&1)); + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_3).unwrap(), None); + assert_eq!(counter.get(&PROTOCOL_VERSION_1).unwrap(), None); + + drop(counter); + + // Next bock is epoch change. We want to test our protocol + // upgrade logic. We will propose a new version and remove HPMN + // to make sure all protocol version count functions are called during block execution. + + let last_committed_block_info = state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info(); + + let proposer_pro_tx_hash = proposers + .first() + .expect("we should have proposers") + .masternode + .pro_tx_hash; + + let current_quorum_with_test_info = + quorums.get(¤t_quorum_hash).expect("expected quorum"); + + // We want to add proposal for a new version + let proposed_version = TEST_PROTOCOL_VERSION_3; + + let block_info = BlockInfo { + time_ms: end_time_ms + epoch_time_length_s + 1, + height: last_committed_block_info.height + 1, + core_height: last_committed_block_info.core_height, + epoch: Default::default(), + }; + + abci_app + .mimic_execute_block( + proposer_pro_tx_hash.into(), + current_quorum_with_test_info, + proposed_version, + block_info, + 0, + &[], + false, + Vec::new(), + MimicExecuteBlockOptions { + dont_finalize_block: strategy.dont_finalize_block(), + rounds_before_finalization: strategy + .failure_testing + .as_ref() + .and_then(|failure_testing| failure_testing.rounds_before_successful_block), + max_tx_bytes_per_block: strategy.max_tx_bytes_per_block, + independent_process_proposal_verification: strategy + .independent_process_proposal_verification, + }, + ) + .expect("expected to execute a block"); + + let state = platform.state.load(); + let counter = platform.drive.cache.protocol_versions_counter.read(); + + assert_eq!(state.last_committed_block_epoch().index, 1); + assert_eq!( + state.current_protocol_version_in_consensus(), + PROTOCOL_VERSION_1 + ); + assert_eq!(state.next_epoch_protocol_version(), TEST_PROTOCOL_VERSION_2); + assert_eq!(counter.get(&1).unwrap(), None); + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), None); + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_3).unwrap(), Some(&1)); + assert_eq!(state.last_committed_core_height(), 3); + + let mut patches = version::patches::PATCHES.write().unwrap(); + patches.clear(); + } + #[test] fn run_chain_version_upgrade_slow_upgrade() { // Define the desired stack size - let stack_size = 4 * 1024 * 1024; //Lets set the stack size to be higher than the default 2MB + let stack_size = 4 * 1024 * 1024; //Let's set the stack size to be higher than the default 2MB let builder = std::thread::Builder::new() .stack_size(stack_size) @@ -563,27 +712,23 @@ mod tests { .spawn(|| { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 120, extra_normal_mns: 0, - quorum_count: 200, + validator_quorum_count: 200, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 5.0, //it will take many epochs before we get enough nodes }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -593,10 +738,14 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 40, + validator_set: ValidatorSetConfig { + quorum_size: 40, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 80, epoch_time_length_s: 1576800, ..Default::default() }, @@ -606,7 +755,7 @@ mod tests { }, block_spacing_ms: hour_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() @@ -616,20 +765,23 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = run_chain_for_strategy( &mut platform, @@ -637,16 +789,13 @@ mod tests { strategy.clone(), config.clone(), 16, + &mut None, ); + let platform = abci_app.platform; + let state = platform.state.load(); { - let platform = abci_app.platform; - let drive_cache = platform.drive.cache.read().unwrap(); - let _counter = &drive_cache.protocol_versions_counter; assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -655,22 +804,15 @@ mod tests { .index, 5 ); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!(state.next_epoch_protocol_version(), 1); + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - 1 - ); - let counter = &drive_cache.protocol_versions_counter; - assert_eq!( - (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&35), Some(&64)) + ( + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap() + ), + (Some(&39), Some(&78)) ); } @@ -678,10 +820,7 @@ mod tests { // let's go a little longer let platform = abci_app.platform; - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -691,68 +830,59 @@ mod tests { let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = continue_chain_for_strategy( abci_app, ChainExecutionParameters { block_start, core_height_start: 1, - block_count: 2500, + block_count: 1400, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy.clone(), config.clone(), StrategyRandomness::SeedEntropy(7), ); + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; - assert_eq!( - platform - .state - .read() - .unwrap() - .last_committed_block_info() - .as_ref() - .unwrap() - .basic_info() - .epoch - .index, - 11 - ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - TEST_PROTOCOL_VERSION_2 - ); - // the counter is for the current voting during that window - assert_eq!( - (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&8), Some(&79)) + ( + state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .epoch + .index, + state.current_protocol_version_in_consensus(), + state.next_epoch_protocol_version(), + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap() + ), + (8, 1, TEST_PROTOCOL_VERSION_2, Some(&19), Some(&98)) ); } // we are now locked in, the current protocol version will change on next epoch - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -766,44 +896,37 @@ mod tests { core_height_start: 1, block_count: 400, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config, StrategyRandomness::SeedEntropy(8), ); - { - let _drive_cache = platform.drive.cache.read().unwrap(); - assert_eq!( - platform - .state - .read() - .unwrap() + + let state = platform.state.load(); + + assert_eq!( + ( + state .last_committed_block_info() .as_ref() .unwrap() .basic_info() .epoch .index, - 12 - ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - TEST_PROTOCOL_VERSION_2 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - TEST_PROTOCOL_VERSION_2 - ); - } + state.current_protocol_version_in_consensus(), + state.next_epoch_protocol_version() + ), + (9, TEST_PROTOCOL_VERSION_2, TEST_PROTOCOL_VERSION_2) + ); }) .expect("Failed to create thread with custom stack size"); @@ -813,8 +936,10 @@ mod tests { #[test] fn run_chain_version_upgrade_slow_upgrade_quick_reversion_after_lock_in() { + drive_abci::logging::init_for_tests(LogLevel::Silent); + // Define the desired stack size - let stack_size = 4 * 1024 * 1024; //Lets set the stack size to be higher than the default 2MB + let stack_size = 4 * 1024 * 1024; //Let's set the stack size to be higher than the default 2MB let builder = std::thread::Builder::new() .stack_size(stack_size) @@ -824,27 +949,23 @@ mod tests { .spawn(|| { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 5.0, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -854,10 +975,14 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let mut config = PlatformConfig { - quorum_size: 50, + validator_set: ValidatorSetConfig { + quorum_size: 50, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 50, epoch_time_length_s: 1576800, ..Default::default() }, @@ -867,7 +992,7 @@ mod tests { }, block_spacing_ms: hour_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() @@ -877,19 +1002,22 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = run_chain_for_strategy( &mut platform, @@ -897,16 +1025,15 @@ mod tests { strategy.clone(), config.clone(), 15, + &mut None, ); + + let platform = abci_app.platform; + let state = platform.state.load(); + { - let platform = abci_app.platform; - let drive_cache = platform.drive.cache.read().unwrap(); - let _counter = &drive_cache.protocol_versions_counter; assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -915,23 +1042,13 @@ mod tests { .index, 4 ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); + assert_eq!(state.current_protocol_version_in_consensus(), 1); } // we still did not yet hit the required threshold to upgrade // let's go a just a little longer let platform = abci_app.platform; - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -941,9 +1058,13 @@ mod tests { let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = continue_chain_for_strategy( abci_app, @@ -952,24 +1073,25 @@ mod tests { core_height_start: 1, block_count: 3000, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config.clone(), StrategyRandomness::SeedEntropy(99), ); + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -978,21 +1100,14 @@ mod tests { .index, 11 ); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!(state.next_epoch_protocol_version(), TEST_PROTOCOL_VERSION_2); assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - TEST_PROTOCOL_VERSION_2 - ); - assert_eq!( - (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&18), Some(&111)) + ( + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap() + ), + (Some(&16), Some(&117)) ); //not all nodes have upgraded } @@ -1002,18 +1117,17 @@ mod tests { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: Some(UpgradingInfo { current_protocol_version: 2, proposed_protocol_versions_with_weight: vec![ @@ -1022,10 +1136,7 @@ mod tests { ], upgrade_three_quarters_life: 0.1, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1034,10 +1145,7 @@ mod tests { ..Default::default() }; - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -1048,10 +1156,14 @@ mod tests { let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. } = continue_chain_for_strategy( abci_app, @@ -1060,29 +1172,33 @@ mod tests { core_height_start: 1, block_count: 2000, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: None, //restart the proposer versions + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy.clone(), config.clone(), StrategyRandomness::SeedEntropy(40), ); + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&170), Some(&24)) + ( + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap() + ), + (Some(&172), Some(&24)) ); - //a lot nodes reverted to previous version, however this won't impact things + //a lot of nodes reverted to previous version, however this won't impact things assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -1092,23 +1208,13 @@ mod tests { 12 ); assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), + state.current_protocol_version_in_consensus(), TEST_PROTOCOL_VERSION_2 ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - 1 - ); + assert_eq!(state.next_epoch_protocol_version(), 1); } - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -1123,28 +1229,32 @@ mod tests { core_height_start: 1, block_count: 100, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: Some(current_proposer_versions), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config, StrategyRandomness::SeedEntropy(40), ); + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( - (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&22), Some(&3)) + ( + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap() + ), + (Some(&24), Some(&2)) ); assert_eq!( - platform - .state - .read() - .unwrap() + state .last_committed_block_info() .as_ref() .unwrap() @@ -1153,18 +1263,8 @@ mod tests { .index, 13 ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - 1 - ); + assert_eq!(state.current_protocol_version_in_consensus(), 1); + assert_eq!(state.next_epoch_protocol_version(), 1); } }) .expect("Failed to create thread with custom stack size"); @@ -1176,7 +1276,7 @@ mod tests { #[test] fn run_chain_version_upgrade_multiple_versions() { // Define the desired stack size - let stack_size = 4 * 1024 * 1024; //Lets set the stack size to be higher than the default 2MB + let stack_size = 4 * 1024 * 1024; //Let's set the stack size to be higher than the default 2MB let builder = std::thread::Builder::new() .stack_size(stack_size) @@ -1186,18 +1286,17 @@ mod tests { .spawn(|| { let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![ @@ -1207,10 +1306,7 @@ mod tests { ], upgrade_three_quarters_life: 0.75, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1220,10 +1316,14 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 50, + validator_set: ValidatorSetConfig { + quorum_size: 50, + ..Default::default() + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 30, epoch_time_length_s: 1576800, ..Default::default() }, @@ -1233,7 +1333,7 @@ mod tests { }, block_spacing_ms: hour_in_ms, - testing_configs: PlatformTestConfig::default_with_no_block_signing(), + testing_configs: PlatformTestConfig::default_minimal_verifications(), ..Default::default() }; let mut platform = TestPlatformBuilder::new() @@ -1243,74 +1343,91 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + instant_lock_quorums, .. - } = run_chain_for_strategy(&mut platform, 1400, strategy, config.clone(), 15); + } = run_chain_for_strategy( + &mut platform, + 1200, + strategy, + config.clone(), + 15, + &mut None, + ); + let state = abci_app.platform.state.load(); { let platform = abci_app.platform; - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; + let counter = &platform.drive.cache.protocol_versions_counter.read(); - assert_eq!( - platform - .state - .read() - .unwrap() - .last_committed_block_info() - .as_ref() - .unwrap() - .basic_info() - .epoch - .index, - 3 - ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - 1 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - TEST_PROTOCOL_VERSION_2 - ); assert_eq!( ( - counter.get(&1), - counter.get(&TEST_PROTOCOL_VERSION_2), - counter.get(&TEST_PROTOCOL_VERSION_3) + state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .epoch + .index, + state.current_protocol_version_in_consensus(), + state.next_epoch_protocol_version(), + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_3).unwrap() ), - (Some(&2), Some(&69), Some(&3)) + ( + 2, + 1, + TEST_PROTOCOL_VERSION_2, + Some(&10), + Some(&153), + Some(&8) + ) ); //some nodes reverted to previous version + + let epochs = platform + .drive + .get_epochs_infos( + 1, + 1, + true, + None, + state + .current_platform_version() + .expect("should have version"), + ) + .expect("should return epochs"); + + assert_eq!(epochs.len(), 1); + assert_eq!(epochs[0].protocol_version(), 1); } let strategy = NetworkStrategy { strategy: Strategy { - contracts_with_updates: vec![], + start_contracts: vec![], operations: vec![], - start_identities: vec![], - identities_inserts: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + start_identities: StartIdentities::default(), + identity_inserts: IdentityInsertInfo::default(), + + identity_contract_nonce_gaps: None, signer: None, }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![ @@ -1319,10 +1436,7 @@ mod tests { ], upgrade_three_quarters_life: 0.5, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1334,10 +1448,7 @@ mod tests { // we hit the required threshold to upgrade // let's go a little longer let platform = abci_app.platform; - let block_start = platform - .state - .read() - .unwrap() + let block_start = state .last_committed_block_info() .as_ref() .unwrap() @@ -1349,54 +1460,65 @@ mod tests { ChainExecutionParameters { block_start, core_height_start: 1, - block_count: 700, + block_count: 800, proposers, - quorums, - current_quorum_hash, + validator_quorums: quorums, + current_validator_quorum_hash: current_quorum_hash, current_proposer_versions: None, + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), start_time_ms: 1681094380000, current_time_ms: end_time_ms, + instant_lock_quorums, }, strategy, config, StrategyRandomness::SeedEntropy(7), ); + let state = platform.state.load(); { - let drive_cache = platform.drive.cache.read().unwrap(); - let counter = &drive_cache.protocol_versions_counter; - assert_eq!( - platform - .state - .read() - .unwrap() - .last_committed_block_info() - .as_ref() - .unwrap() - .basic_info() - .epoch - .index, - 4 - ); - assert_eq!( - platform - .state - .read() - .unwrap() - .current_protocol_version_in_consensus(), - TEST_PROTOCOL_VERSION_2 - ); - assert_eq!( - platform.state.read().unwrap().next_epoch_protocol_version(), - TEST_PROTOCOL_VERSION_3 - ); + let counter = &platform.drive.cache.protocol_versions_counter.read(); assert_eq!( ( - counter.get(&1), - counter.get(&TEST_PROTOCOL_VERSION_2), - counter.get(&TEST_PROTOCOL_VERSION_3) + state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .epoch + .index, + state.current_protocol_version_in_consensus(), + state.next_epoch_protocol_version(), + counter.get(&1).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_2).unwrap(), + counter.get(&TEST_PROTOCOL_VERSION_3).unwrap() ), - (None, Some(&3), Some(&155)) + ( + 4, + TEST_PROTOCOL_VERSION_2, + TEST_PROTOCOL_VERSION_3, + None, + Some(&3), + Some(&149) + ) ); + + let epochs = platform + .drive + .get_epochs_infos( + 3, + 1, + true, + None, + state + .current_platform_version() + .expect("should have version"), + ) + .expect("should return epochs"); + + assert_eq!(epochs.len(), 1); + assert_eq!(epochs[0].protocol_version(), TEST_PROTOCOL_VERSION_2); } }) .expect("Failed to create thread with custom stack size"); diff --git a/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs b/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs index 33313656c7d..57f347f9775 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs @@ -1,49 +1,57 @@ -use dapi_grpc::platform::v0::{get_proofs_request, GetProofsRequest, GetProofsResponse}; -use dapi_grpc::platform::VersionedGrpcResponse; - use dapi_grpc::platform::v0::get_proofs_request::{get_proofs_request_v0, GetProofsRequestV0}; -use dpp::block::block_info::BlockInfo; +use dapi_grpc::platform::v0::{get_proofs_request, GetProofsRequest}; +use dapi_grpc::platform::VersionedGrpcResponse; use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::Document; -use dpp::identity::PartialIdentity; -use dpp::state_transition::{StateTransition, StateTransitionLike}; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + +use dapi_grpc::platform::v0::get_proofs_request::get_proofs_request_v0::vote_status_request; +use dapi_grpc::platform::v0::get_proofs_request::get_proofs_request_v0::vote_status_request::RequestType; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValueGettersV0; +use dpp::document::property_names::PRICE; +use dpp::state_transition::StateTransition; use dpp::version::PlatformVersion; use drive::drive::identity::key::fetch::IdentityKeysRequest; use drive::drive::Drive; -use drive::query::SingleDocumentDriveQuery; +use drive::query::{SingleDocumentDriveQuery, SingleDocumentDriveQueryContestedStatus}; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use drive::state_transition_action::StateTransitionAction; -use drive_abci::abci::AbciApplication; use drive_abci::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; use drive_abci::platform_types::platform::PlatformRef; -use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; use drive_abci::rpc::core::MockCoreRPCLike; -use prost::Message; use tenderdash_abci::proto::abci::ExecTxResult; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::voting::votes::Vote; +use drive::drive::votes::resolved::vote_polls::ResolvedVotePoll; +use drive::drive::votes::resolved::votes::resolved_resource_vote::accessors::v0::ResolvedResourceVoteGettersV0; +use drive::drive::votes::resolved::votes::ResolvedVote; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentFromCreateTransition; -use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::DocumentFromReplaceTransition; +use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::{DocumentCreateTransitionActionAccessorsV0, DocumentFromCreateTransitionAction}; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::DocumentFromReplaceTransitionAction; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::DocumentTransferTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::DocumentUpdatePriceTransitionActionAccessorsV0; +use drive_abci::abci::app::FullAbciApplication; +use drive_abci::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use drive_abci::execution::validation::state_transition::ValidationMode; +use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; +use platform_version::DefaultForPlatformVersion; pub(crate) fn verify_state_transitions_were_or_were_not_executed( - abci_app: &AbciApplication, + abci_app: &FullAbciApplication, expected_root_hash: &[u8; 32], state_transitions: &[(StateTransition, ExecTxResult)], - block_info: &BlockInfo, - expected_validation_errors: &Vec, + expected_validation_errors: &[u32], platform_version: &PlatformVersion, ) -> bool { - let state = abci_app.platform.state.read().unwrap(); + let state = abci_app.platform.state.load(); let platform = PlatformRef { drive: &abci_app.platform.drive, state: &state, config: &abci_app.platform.config, core_rpc: &abci_app.platform.core_rpc, - block_info, }; //actions are easier to transform to queries @@ -57,17 +65,26 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( // dbg!(batch.transitions().len(), hex::encode(first.base().id()), state.height(), first.to_string()); } - let consensus_validation_result = - match state_transition.transform_into_action(&platform, false, None) { - Ok(consensus_validation_result) => consensus_validation_result, - Err(e) => { - if expected_validation_errors.contains(&result.code) { - return (state_transition.clone(), None, false); - } else { - panic!("{}", e) - } + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("expected to get an execution context"); + + let consensus_validation_result = match state_transition.transform_into_action( + &platform, + abci_app.platform.state.load().last_block_info(), + ValidationMode::NoValidation, //using check_tx so we don't validate state + &mut execution_context, + None, + ) { + Ok(consensus_validation_result) => consensus_validation_result, + Err(e) => { + if expected_validation_errors.contains(&result.code) { + return (state_transition.clone(), None, false); + } else { + panic!("{}", e) } - }; + } + }; if !consensus_validation_result.is_valid() { panic!( @@ -85,11 +102,12 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( }) .collect::>(); - for (state_transition, action, was_executed) in &actions { + for (_state_transition, action, was_executed) in &actions { let mut proofs_request = GetProofsRequestV0 { identities: vec![], contracts: vec![], documents: vec![], + votes: vec![], }; if let Some(action) = action { @@ -100,25 +118,19 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( .push(get_proofs_request_v0::ContractRequest { contract_id: data_contract_create.data_contract_ref().id().to_vec(), }); + let versioned_request = GetProofsRequest { version: Some(get_proofs_request::Version::V0(proofs_request)), }; + let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); - let response_proof = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response") - .proof_owned() - .expect("proof should be present"); + let response = result.into_data().expect("expected queries to be valid"); + + let response_proof = response.proof_owned().expect("expected to get proof"); // let fetched_contract = abci_app // .platform.drive.fetch_contract(data_contract_create.data_contract_ref().id().into_buffer(), None, None, None, platform_version).unwrap().unwrap(); @@ -147,7 +159,7 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( } else { //there is the possibility that the state transition was not executed because it already existed, // we can discount that for now in tests - assert!(contract.is_none(),) + assert!(contract.is_none()) } } StateTransitionAction::DataContractUpdateAction(data_contract_update) => { @@ -161,18 +173,9 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( }; let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); - - let response = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response"); + let response = result.into_data().expect("expected queries to be valid"); let response_proof = response.proof_owned().expect("expected to get proof"); @@ -211,21 +214,53 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( .transitions() .iter() .for_each(|transition| { + let document_contested_status = + if let DocumentTransitionAction::CreateAction(create_action) = + transition + { + if create_action.prefunded_voting_balance().is_some() { + SingleDocumentDriveQueryContestedStatus::Contested as u8 + } else { + SingleDocumentDriveQueryContestedStatus::NotContested as u8 + } + } else { + SingleDocumentDriveQueryContestedStatus::NotContested as u8 + }; proofs_request .documents .push(get_proofs_request_v0::DocumentRequest { - contract_id: transition.base().data_contract_id().to_vec(), - document_type: transition.base().document_type_name().clone(), + contract_id: transition + .base() + .expect("expected a base for the document transition") + .data_contract_id() + .to_vec(), + document_type: transition + .base() + .expect("expected a base for the document transition") + .document_type_name() + .clone(), document_type_keeps_history: transition .base() + .expect("expected a base for the document transition") .data_contract_fetch_info() .contract .document_type_for_name( - transition.base().document_type_name().as_str(), + transition + .base() + .expect( + "expected a base for the document transition", + ) + .document_type_name() + .as_str(), ) .expect("get document type") .documents_keep_history(), - document_id: transition.base().id().to_vec(), + document_id: transition + .base() + .expect("expected a base for the document transition") + .id() + .to_vec(), + document_contested_status: document_contested_status as i32, }); }); let versioned_request = GetProofsRequest { @@ -233,48 +268,62 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( }; let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); - - let response = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response"); + let response = result.into_data().expect("expected queries to be valid"); let response_proof = response.proof_owned().expect("proof should be present"); for document_transition_action in documents_batch_transition.transitions().iter() { - let contract_fetch_info = - document_transition_action.base().data_contract_fetch_info(); + let contract_fetch_info = document_transition_action + .base() + .expect("expected a base for the document transition") + .data_contract_fetch_info(); let document_type = contract_fetch_info .contract .document_type_for_name( document_transition_action .base() + .expect("expected a base for the document transition") .document_type_name() .as_str(), ) .expect("get document type"); + let contested_status = + if let DocumentTransitionAction::CreateAction(create_action) = + document_transition_action + { + if create_action.prefunded_voting_balance().is_some() { + SingleDocumentDriveQueryContestedStatus::Contested + } else { + SingleDocumentDriveQueryContestedStatus::NotContested + } + } else { + SingleDocumentDriveQueryContestedStatus::NotContested + }; + let query = SingleDocumentDriveQuery { contract_id: document_transition_action .base() + .expect("expected a base for the document transition") .data_contract_id() .into_buffer(), document_type_name: document_transition_action .base() + .expect("expected a base for the document transition") .document_type_name() .clone(), document_type_keeps_history: document_type.documents_keep_history(), - document_id: document_transition_action.base().id().into_buffer(), + document_id: document_transition_action + .base() + .expect("expected a base for the document transition") + .id() + .into_buffer(), block_time_ms: None, //None because we want latest + contested_status, }; // dbg!( @@ -305,7 +354,12 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( match document_transition_action { DocumentTransitionAction::CreateAction(creation_action) => { if *was_executed { - let document = document.expect("expected a document"); + let document = document.unwrap_or_else(|| { + panic!( + "expected a document on block {}", + platform.state.last_committed_block_height() + ) + }); // dbg!( // &document, // Document::try_from_create_transition( @@ -317,7 +371,7 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( // ); assert_eq!( document, - Document::try_from_create_transition( + Document::try_from_create_transition_action( creation_action, documents_batch_transition.owner_id(), platform_version, @@ -336,7 +390,7 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( if let Some(document) = document { assert_eq!( document, - Document::try_from_replace_transition( + Document::try_from_replace_transition_action( replace_action, documents_batch_transition.owner_id(), platform_version, @@ -350,7 +404,7 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( if let Some(document) = document { assert_ne!( document, - Document::try_from_replace_transition( + Document::try_from_replace_transition_action( replace_action, documents_batch_transition.owner_id(), platform_version, @@ -364,6 +418,67 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( // we expect no document assert!(document.is_none()); } + DocumentTransitionAction::BumpIdentityDataContractNonce(_) => { + panic!("we should not have a bump identity data contract nonce"); + } + DocumentTransitionAction::TransferAction(transfer_action) => { + if *was_executed { + // it's also possible we deleted something we replaced + if let Some(document) = document { + assert_eq!( + document.owner_id(), + transfer_action.document().owner_id() + ); + } + } else { + //there is the possibility that the state transition was not executed and the state is equal to the previous + // state, aka there would have been no change anyways, we can discount that for now + if let Some(document) = document { + assert_ne!( + document.owner_id(), + transfer_action.document().owner_id() + ); + } + } + } + DocumentTransitionAction::PurchaseAction(purchase_action) => { + if *was_executed { + if let Some(document) = document { + assert_eq!( + document.owner_id(), + purchase_action.document().owner_id() + ); + } + } else { + //there is the possibility that the state transition was not executed and the state is equal to the previous + // state, aka there would have been no change anyways, we can discount that for now + if let Some(document) = document { + assert_ne!( + document.owner_id(), + purchase_action.document().owner_id() + ); + } + } + } + DocumentTransitionAction::UpdatePriceAction(update_price_action) => { + if *was_executed { + if let Some(document) = document { + assert_eq!( + document.get(PRICE), + update_price_action.document().get(PRICE) + ); + } + } else { + //there is the possibility that the state transition was not executed and the state is equal to the previous + // state, aka there would have been no change anyways, we can discount that for now + if let Some(document) = document { + assert_ne!( + document.get(PRICE), + update_price_action.document().get(PRICE) + ); + } + } + } } } } @@ -380,18 +495,9 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( }; let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); - - let response = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response"); + let response = result.into_data().expect("expected queries to be valid"); let response_proof = response.proof_owned().expect("proof should be present"); @@ -410,22 +516,12 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( platform.state.last_committed_block_info() ); if *was_executed { - assert_eq!( - identity - .expect("expected an identity") - .into_partial_identity_info_no_balance(), - PartialIdentity { - id: identity_create_transition.identity_id(), - loaded_public_keys: identity_create_transition - .public_keys() - .iter() - .map(|key| (key.id(), key.clone())) - .collect(), - balance: None, - revision: Some(0), - not_found_public_keys: Default::default(), - } - ) + // other state transitions might have happened in the same block the identity + // was created + let proved_identity = identity + .expect("expected an identity") + .into_partial_identity_info_no_balance(); + assert_eq!(proved_identity.id, identity_create_transition.identity_id()); } else { //there is the possibility that the state transition was not executed because it already existed, // we can discount that for now in tests @@ -445,20 +541,11 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( }; let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); + let response = result.into_data().expect("expected queries to be valid"); - let response_proof = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response") - .proof_owned() - .expect("proof should be present"); + let response_proof = response.proof_owned().expect("proof should be present"); // we expect to get an identity that matches the state transition let (root_hash, balance) = Drive::verify_identity_balance_for_identity_id( @@ -467,7 +554,7 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( false, platform_version, ) - .expect("expected to verify balance identity"); + .expect("expected to verify balance identity for top up"); let balance = balance.expect("expected a balance"); assert_eq!( &root_hash, @@ -479,7 +566,12 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( if *was_executed { //while this isn't 100% sure to be true (in the case of debt, // for the tests we have we can use it - assert!(identity_top_up_transition.top_up_balance_amount() <= balance); + assert!( + identity_top_up_transition + .top_up_asset_lock_value() + .remaining_credit_value() + <= balance + ); } } StateTransitionAction::IdentityCreditWithdrawalAction( @@ -508,21 +600,12 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( }; let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); + let response = result.into_data().expect("expected queries to be valid"); - let response_proof = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response") - .proof_owned() - .expect("proof should be present"); + let response_proof = response.proof_owned().expect("proof should be present"); // we expect to get an identity that matches the state transition let (root_hash, balance) = Drive::verify_identity_balance_for_identity_id( @@ -533,7 +616,7 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( false, platform_version, ) - .expect("expected to verify balance identity"); + .expect("expected to verify balance identity for withdrawal"); let _balance = balance.expect("expected a balance"); assert_eq!( &root_hash, @@ -557,20 +640,11 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( }; let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); + let response = result.into_data().expect("expected queries to be valid"); - let response_proof = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response") - .proof_owned() - .expect("proof should be present"); + let response_proof = response.proof_owned().expect("proof should be present"); // we expect to get an identity that matches the state transition let (root_hash, identity) = Drive::verify_identity_keys_by_identity_id( @@ -580,6 +654,8 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( None, ), false, + false, + false, platform_version, ) .expect("expected to verify identity keys"); @@ -627,20 +703,11 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( let result = abci_app .platform - .query( - "/proofs", - &versioned_request.encode_to_vec(), - platform_version, - ) + .query_proofs(versioned_request, &state, platform_version) .expect("expected to query proofs"); - let serialized_get_proofs_response = - result.into_data().expect("expected queries to be valid"); + let response = result.into_data().expect("expected queries to be valid"); - let response_proof = - GetProofsResponse::decode(serialized_get_proofs_response.as_slice()) - .expect("expected to decode proof response") - .proof_owned() - .expect("proof should be present"); + let response_proof = response.proof_owned().expect("proof should be present"); // we expect to get an identity that matches the state transition let (root_hash_identity, _balance_identity) = @@ -650,7 +717,7 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( true, platform_version, ) - .expect("expected to verify balance identity"); + .expect("expected to verify balance identity for credit transfer"); assert_eq!( &root_hash_identity, @@ -683,6 +750,83 @@ pub(crate) fn verify_state_transitions_were_or_were_not_executed( ); } } + StateTransitionAction::MasternodeVoteAction(masternode_vote_action) => { + let data_contract = match masternode_vote_action.vote_ref() { + ResolvedVote::ResolvedResourceVote(resource_vote) => match resource_vote + .vote_poll() + { + ResolvedVotePoll::ContestedDocumentResourceVotePollWithContractInfo( + contested_document_resource_vote_poll, + ) => { + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + let serialized_index_values = contested_document_resource_vote_poll + .index_values + .iter() + .map(|value| { + bincode::encode_to_vec(value, config) + .expect("expected to encode value in path") + }) + .collect(); + + proofs_request + .votes + .push(get_proofs_request_v0::VoteStatusRequest{ + request_type: Some(RequestType::ContestedResourceVoteStatusRequest(vote_status_request::ContestedResourceVoteStatusRequest { + contract_id: contested_document_resource_vote_poll.contract.id().to_vec(), + document_type_name: contested_document_resource_vote_poll.document_type_name.clone(), + index_name: contested_document_resource_vote_poll.index_name.clone(), + voter_identifier: masternode_vote_action.pro_tx_hash().to_vec(), + index_values: serialized_index_values, + })) + }); + contested_document_resource_vote_poll.contract.as_ref() + } + }, + }; + + let versioned_request = GetProofsRequest { + version: Some(get_proofs_request::Version::V0(proofs_request)), + }; + + let result = abci_app + .platform + .query_proofs(versioned_request, &state, platform_version) + .expect("expected to query proofs"); + let response = result.into_data().expect("expected queries to be valid"); + + let response_proof = response.proof_owned().expect("proof should be present"); + + let vote: Vote = masternode_vote_action.vote_ref().clone().into(); + + // we expect to get a vote that matches the state transition + let (root_hash_vote, maybe_vote) = Drive::verify_masternode_vote( + &response_proof.grovedb_proof, + masternode_vote_action.pro_tx_hash().into_buffer(), + &vote, + data_contract, + false, // we are not in a subset, we have just one vote + platform_version, + ) + .expect("expected to verify balance identity"); + + assert_eq!( + &root_hash_vote, + expected_root_hash, + "state last block info {:?}", + platform.state.last_committed_block_info() + ); + + if *was_executed { + let executed_vote = maybe_vote.expect("expected a vote"); + + assert_eq!(&executed_vote, &vote); + } + } + StateTransitionAction::BumpIdentityNonceAction(_) => {} + StateTransitionAction::BumpIdentityDataContractNonceAction(_) => {} + StateTransitionAction::PartiallyUseAssetLockAction(_) => {} } } else { // if we don't have an action this means there was a problem in the validation of the state transition diff --git a/packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs new file mode 100644 index 00000000000..9e1f71fa528 --- /dev/null +++ b/packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs @@ -0,0 +1,1422 @@ +#[cfg(test)] +mod tests { + use crate::execution::{continue_chain_for_strategy, run_chain_for_strategy}; + use crate::strategy::{ChainExecutionOutcome, ChainExecutionParameters, NetworkStrategy, StrategyRandomness}; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::document_type::random_document::{ + DocumentFieldFillSize, DocumentFieldFillType, + }; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::Identity; + use dpp::platform_value::Value; + use drive_abci::config::{ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig}; + use drive_abci::test::helpers::setup::TestPlatformBuilder; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + use simple_signer::signer::SimpleSigner; + use std::collections::BTreeMap; + use dapi_grpc::platform::v0::{get_contested_resource_vote_state_request, get_contested_resource_vote_state_response, GetContestedResourceVoteStateRequest}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0::ResultType; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_request::GetContestedResourceVoteStateRequestV0; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::{get_contested_resource_vote_state_response_v0, GetContestedResourceVoteStateResponseV0}; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::FinishedVoteInfo; + use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::finished_vote_info::FinishedVoteOutcome; + use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; + use drive::util::object_size_info::DataContractOwnedResolvedInfo; + use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; + use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; + use strategy_tests::frequency::Frequency; + use strategy_tests::operations::{DocumentAction, DocumentOp, Operation, OperationType, ResourceVoteOp, VoteAction}; + use strategy_tests::transitions::create_state_transitions_for_identities; + use strategy_tests::{StartIdentities, Strategy}; + + #[test] + fn run_chain_block_two_state_transitions_conflicting_unique_index_inserted_same_block() { + // In this test we try to insert two state transitions with the same unique index + // We use the DPNS contract, and we insert two documents both with the same "name" + // This is a common scenario we should see quite often + let config = PlatformConfig { + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + ..Default::default() + }, + block_spacing_ms: 3000, + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let platform_version = PlatformVersion::latest(); + + let mut rng = StdRng::seed_from_u64(567); + + let mut simple_signer = SimpleSigner::default(); + + let (identity1, keys1) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys1); + + let (identity2, keys2) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys2); + + let start_identities = create_state_transitions_for_identities( + vec![identity1, identity2], + &simple_signer, + &mut rng, + platform_version, + ); + + let dpns_contract = platform + .drive + .cache + .system_data_contracts + .load_dpns() + .as_ref() + .clone(); + + let document_type = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type") + .to_owned_document_type(); + + let identity1_id = start_identities.first().unwrap().0.id(); + let identity2_id = start_identities.last().unwrap().0.id(); + let document_op_1 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity1_id))]).into(), + ), + ]), + Some(start_identities.first().unwrap().0.id()), + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let document_op_2 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([( + "identity", + Value::from(start_identities.last().unwrap().0.id()), + )]) + .into(), + ), + ]), + Some(start_identities.last().unwrap().0.id()), + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![ + Operation { + op_type: OperationType::Document(document_op_1), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_op_2), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities { + hard_coded: start_identities, + ..Default::default() + }, + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer), + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + // On the first block we only have identities and contracts + let outcome = run_chain_for_strategy( + &mut platform, + 2, + strategy.clone(), + config.clone(), + 15, + &mut None, + ); + + let platform = outcome.abci_app.platform; + + let platform_state = platform.state.load(); + + let state_transitions_block_2 = outcome + .state_transition_results_per_block + .get(&2) + .expect("expected to get block 2"); + + let first_document_insert_result = &state_transitions_block_2 + .first() + .as_ref() + .expect("expected a document insert") + .1; + assert_eq!(first_document_insert_result.code, 0); + + let second_document_insert_result = &state_transitions_block_2 + .get(1) + .as_ref() + .expect("expected a document insert") + .1; + + assert_eq!(second_document_insert_result.code, 0); // we expect the second to also be insertable as they are both contested + + // Now let's run a query for the vote totals + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec(Value::Text("quantum".to_string()), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: document_type.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally: _, + lock_vote_tally: _, + finished_vote_info: _, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!( + first_contender.document.as_ref().map(hex::encode), + Some("00177f2479090a0286a67d6a1f67b563b51518edd6eea0461829f7d630fd65708d29124be7e86f97e959894a67a9cc078c3e0106d4bfcfbf34bc403a4f099925b401000700000187690895980000018769089598000001876908959800077175616e74756d077175616e74756d00046461736800210129124be7e86f97e959894a67a9cc078c3e0106d4bfcfbf34bc403a4f099925b40101".to_string()) + ); + + assert_eq!( + second_contender.document.as_ref().map(hex::encode), + Some("00490e212593a1d3cc6ae17bf107ab9cb465175e7877fcf7d085ed2fce27be11d68b8948a6801501bbe0431e3d994dcf71cf5a2a0939fe51b0e600076199aba4fb01000700000187690895980000018769089598000001876908959800077175616e74756d077175616e74756d0004646173680021018b8948a6801501bbe0431e3d994dcf71cf5a2a0939fe51b0e600076199aba4fb0100".to_string()) + ); + + assert_eq!(first_contender.identifier, identity2_id.to_vec()); + + assert_eq!(second_contender.identifier, identity1_id.to_vec()); + + assert_eq!(first_contender.vote_count, Some(0)); + + assert_eq!(second_contender.vote_count, Some(0)); + } + + #[test] + fn run_chain_with_voting_on_conflicting_index_just_abstain_votes() { + // In this test we try to insert two state transitions with the same unique index + // We use the DPNS contract, and we insert two documents both with the same "name" + // This is a common scenario we should see quite often + let config = PlatformConfig { + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + ..Default::default() + }, + block_spacing_ms: 3000, + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let platform_version = PlatformVersion::latest(); + + let mut rng = StdRng::seed_from_u64(567); + + let mut simple_signer = SimpleSigner::default(); + + let (identity1, keys1) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys1); + + let (identity2, keys2) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys2); + + let start_identities = create_state_transitions_for_identities( + vec![identity1, identity2], + &simple_signer, + &mut rng, + platform_version, + ); + + let dpns_contract = platform + .drive + .cache + .system_data_contracts + .load_dpns() + .as_ref() + .clone(); + + let document_type = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type") + .to_owned_document_type(); + + let identity1_id = start_identities.first().unwrap().0.id(); + let identity2_id = start_identities.last().unwrap().0.id(); + let document_op_1 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity1_id))]).into(), + ), + ]), + Some(start_identities.first().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let document_op_2 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([( + "identity", + Value::from(start_identities.last().unwrap().0.id()), + )]) + .into(), + ), + ]), + Some(start_identities.last().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![ + Operation { + op_type: OperationType::Document(document_op_1), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_op_2), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities { + hard_coded: start_identities, + ..Default::default() + }, + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer), + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let mut voting_signer = Some(SimpleSigner::default()); + + // On the first block we only have identities and contracts + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + state_transition_results_per_block, + .. + } = run_chain_for_strategy( + &mut platform, + 2, + strategy.clone(), + config.clone(), + 15, + &mut voting_signer, + ); + + let platform = abci_app.platform; + + let platform_state = platform.state.load(); + + let state_transitions_block_2 = state_transition_results_per_block + .get(&2) + .expect("expected to get block 2"); + + let first_document_insert_result = &state_transitions_block_2 + .first() + .as_ref() + .expect("expected a document insert") + .1; + assert_eq!(first_document_insert_result.code, 0); + + let second_document_insert_result = &state_transitions_block_2 + .get(1) + .as_ref() + .expect("expected a document insert") + .1; + + assert_eq!(second_document_insert_result.code, 0); // we expect the second to also be insertable as they are both contested + + let block_start = platform_state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 30, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![Operation { + op_type: OperationType::ResourceVote(ResourceVoteOp { + resolved_vote_poll: ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::OwnedDataContract( + dpns_contract.clone(), + ), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["dash".into(), "quantum".into()], + }, + action: VoteAction { + vote_choices_with_weights: vec![(ResourceVoteChoice::Abstain, 1)], + }, + }), + frequency: Frequency { + times_per_block_range: 1..3, + chance_per_block: None, + }, + }], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: voting_signer, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(7), + ); + + let platform = outcome.abci_app.platform; + + // Now let's run a query for the vote totals + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec(Value::Text("quantum".to_string()), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: document_type.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally: _, + finished_vote_info: _, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert!(first_contender.document.is_some()); + + assert!(second_contender.document.is_some()); + + assert_eq!(first_contender.identifier, identity2_id.to_vec()); + + assert_eq!(second_contender.identifier, identity1_id.to_vec()); + + assert_eq!(first_contender.vote_count, Some(0)); + + assert_eq!(second_contender.vote_count, Some(0)); + + assert_eq!(abstain_vote_tally, Some(124)); + } + + #[test] + fn run_chain_with_voting_on_conflicting_index_various_votes() { + // In this test we try to insert two state transitions with the same unique index + // We use the DPNS contract, and we insert two documents both with the same "name" + // This is a common scenario we should see quite often + let config = PlatformConfig { + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + ..Default::default() + }, + block_spacing_ms: 3000, + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let platform_version = PlatformVersion::latest(); + + let mut rng = StdRng::seed_from_u64(567); + + let mut simple_signer = SimpleSigner::default(); + + let (identity1, keys1) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys1); + + let (identity2, keys2) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys2); + + let start_identities = create_state_transitions_for_identities( + vec![identity1, identity2], + &simple_signer, + &mut rng, + platform_version, + ); + + let dpns_contract = platform + .drive + .cache + .system_data_contracts + .load_dpns() + .as_ref() + .clone(); + + let document_type = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type") + .to_owned_document_type(); + + let identity1_id = start_identities.first().unwrap().0.id(); + let identity2_id = start_identities.last().unwrap().0.id(); + let document_op_1 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity1_id))]).into(), + ), + ]), + Some(start_identities.first().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let document_op_2 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([( + "identity", + Value::from(start_identities.last().unwrap().0.id()), + )]) + .into(), + ), + ]), + Some(start_identities.last().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![ + Operation { + op_type: OperationType::Document(document_op_1), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_op_2), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities { + hard_coded: start_identities, + ..Default::default() + }, + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer), + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let mut voting_signer = Some(SimpleSigner::default()); + + // On the first block we only have identities and contracts + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + state_transition_results_per_block, + .. + } = run_chain_for_strategy( + &mut platform, + 2, + strategy.clone(), + config.clone(), + 15, + &mut voting_signer, + ); + + let platform = abci_app.platform; + + let platform_state = platform.state.load(); + + let state_transitions_block_2 = state_transition_results_per_block + .get(&2) + .expect("expected to get block 2"); + + let first_document_insert_result = &state_transitions_block_2 + .first() + .as_ref() + .expect("expected a document insert") + .1; + assert_eq!(first_document_insert_result.code, 0); + + let second_document_insert_result = &state_transitions_block_2 + .get(1) + .as_ref() + .expect("expected a document insert") + .1; + + assert_eq!(second_document_insert_result.code, 0); // we expect the second to also be insertable as they are both contested + + let block_start = platform_state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 30, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![Operation { + op_type: OperationType::ResourceVote(ResourceVoteOp { + resolved_vote_poll: ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::OwnedDataContract( + dpns_contract.clone(), + ), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["dash".into(), "quantum".into()], + }, + action: VoteAction { + vote_choices_with_weights: vec![ + (ResourceVoteChoice::Abstain, 1), + (ResourceVoteChoice::Lock, 1), + (ResourceVoteChoice::TowardsIdentity(identity1_id), 5), + (ResourceVoteChoice::TowardsIdentity(identity2_id), 10), + ], + }, + }), + frequency: Frequency { + times_per_block_range: 1..3, + chance_per_block: None, + }, + }], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: voting_signer, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(7), + ); + + let platform = outcome.abci_app.platform; + + // Now let's run a query for the vote totals + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec(Value::Text("quantum".to_string()), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: document_type.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert!(first_contender.document.is_some()); + + assert!(second_contender.document.is_some()); + + assert_eq!(first_contender.identifier, identity2_id.to_vec()); + + assert_eq!(second_contender.identifier, identity1_id.to_vec()); + + // All vote counts are weighted, so for evonodes, these are in multiples of 4 + + assert_eq!(first_contender.vote_count, Some(52)); + + assert_eq!(second_contender.vote_count, Some(56)); + + assert_eq!(lock_vote_tally, Some(16)); + + assert_eq!(abstain_vote_tally, Some(8)); + + assert_eq!(finished_vote_info, None); + } + + #[test] + fn run_chain_with_voting_on_conflicting_index_distribution_after_won_by_identity() { + // In this test we try to insert two state transitions with the same unique index + // We use the DPNS contract, and we insert two documents both with the same "name" + // This is a common scenario we should see quite often + let config = PlatformConfig { + testing_configs: PlatformTestConfig { + block_signing: false, + store_platform_state: false, + block_commit_signature_verification: false, + disable_instant_lock_signature_verification: true, + }, + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + + ..Default::default() + }, + block_spacing_ms: 3000, + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let platform_version = PlatformVersion::latest(); + + let mut rng = StdRng::seed_from_u64(567); + + let mut simple_signer = SimpleSigner::default(); + + let (identity1, keys1) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys1); + + let (identity2, keys2) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys2); + + let start_identities = create_state_transitions_for_identities( + vec![identity1, identity2], + &simple_signer, + &mut rng, + platform_version, + ); + + let dpns_contract = platform + .drive + .cache + .system_data_contracts + .load_dpns() + .as_ref() + .clone(); + + let document_type = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type") + .to_owned_document_type(); + + let identity1_id = start_identities.first().unwrap().0.id(); + let identity2_id = start_identities.last().unwrap().0.id(); + let document_op_1 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity1_id))]).into(), + ), + ]), + Some(start_identities.first().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let document_op_2 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([( + "identity", + Value::from(start_identities.last().unwrap().0.id()), + )]) + .into(), + ), + ]), + Some(start_identities.last().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![ + Operation { + op_type: OperationType::Document(document_op_1), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_op_2), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities { + hard_coded: start_identities, + ..Default::default() + }, + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer), + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let mut voting_signer = Some(SimpleSigner::default()); + + // On the first block we only have identities and contracts + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + state_transition_results_per_block, + .. + } = run_chain_for_strategy( + &mut platform, + 2, + strategy.clone(), + config.clone(), + 15, + &mut voting_signer, + ); + + let platform = abci_app.platform; + + let platform_state = platform.state.load(); + + let state_transitions_block_2 = state_transition_results_per_block + .get(&2) + .expect("expected to get block 2"); + + let first_document_insert_result = &state_transitions_block_2 + .first() + .as_ref() + .expect("expected a document insert") + .1; + assert_eq!(first_document_insert_result.code, 0); + + let second_document_insert_result = &state_transitions_block_2 + .get(1) + .as_ref() + .expect("expected a document insert") + .1; + + assert_eq!(second_document_insert_result.code, 0); // we expect the second to also be insertable as they are both contested + + let block_start = platform_state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + let day_in_ms = 1000 * 60 * 60 * 24; + let config = PlatformConfig { + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + + ..Default::default() + }, + block_spacing_ms: day_in_ms, + ..Default::default() + }; + + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 16, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![Operation { + op_type: OperationType::ResourceVote(ResourceVoteOp { + resolved_vote_poll: ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::OwnedDataContract( + dpns_contract.clone(), + ), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["dash".into(), "quantum".into()], + }, + action: VoteAction { + vote_choices_with_weights: vec![ + (ResourceVoteChoice::Abstain, 1), + (ResourceVoteChoice::Lock, 1), + (ResourceVoteChoice::TowardsIdentity(identity1_id), 2), + (ResourceVoteChoice::TowardsIdentity(identity2_id), 10), + ], + }, + }), + frequency: Frequency { + times_per_block_range: 1..3, + chance_per_block: None, + }, + }], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: voting_signer, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(9), + ); + + let platform = outcome.abci_app.platform; + + // Now let's run a query for the vote totals + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec(Value::Text("quantum".to_string()), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: document_type.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.identifier, identity2_id.to_vec()); + + assert_eq!(second_contender.identifier, identity1_id.to_vec()); + + // All vote counts are weighted, so for evonodes, these are in multiples of 4 + + assert_eq!(first_contender.vote_count, Some(60)); + + assert_eq!(second_contender.vote_count, Some(4)); + + assert_eq!(lock_vote_tally, Some(4)); + + assert_eq!(abstain_vote_tally, Some(8)); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: FinishedVoteOutcome::TowardsIdentity.into(), + won_by_identity_id: Some(identity2_id.to_vec()), + finished_at_block_height: 17, + finished_at_core_block_height: 1, + finished_at_block_time_ms: 1682303986000, + finished_at_epoch: 1 + }) + ); + } +} diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable-no-owner-indexes.json b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable-no-owner-indexes.json new file mode 100644 index 00000000000..aa852c13bbe --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable-no-owner-indexes.json @@ -0,0 +1,114 @@ +{ + "$format_version": "0", + "id": "86LHvdC1Tqx5P97LQUSibGFqf2vnKFpB6VkqQ7oso86e", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "card": { + "type": "object", + "documentsMutable": false, + "canBeDeleted": false, + "transferable": 1, + "properties": { + "name": { + "type": "string", + "description": "Name of the card", + "maxLength": 63, + "position": 0 + }, + "description": { + "type": "string", + "description": "Description of the card", + "maxLength": 256, + "position": 1 + }, + "imageUrl": { + "type": "string", + "description": "URL of the image associated with the card", + "maxLength": 2048, + "format": "uri", + "position": 2 + }, + "imageHash": { + "type": "array", + "description": "SHA256 hash of the bytes of the image specified by imageUrl", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 3 + }, + "imageFingerprint": { + "type": "array", + "description": "dHash of the image specified by imageUrl", + "byteArray": true, + "minItems": 8, + "maxItems": 8, + "position": 4 + }, + "attack": { + "type": "integer", + "description": "Attack power of the card", + "minimum": 0, + "position": 5 + }, + "defense": { + "type": "integer", + "description": "Defense level of the card", + "minimum": 0, + "position": 6 + } + }, + "indices": [ + { + "name": "attack", + "properties": [ + { + "attack": "asc" + } + ] + }, + { + "name": "defense", + "properties": [ + { + "defense": "asc" + } + ] + }, + { + "name": "transferredAt", + "properties": [ + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "transferredAtBlockHeight", + "properties": [ + { + "$transferredAtBlockHeight": "asc" + } + ] + }, + { + "name": "transferredAtCoreBlockHeight", + "properties": [ + { + "$transferredAtCoreBlockHeight": "asc" + } + ] + } + ], + "required": [ + "name", + "$transferredAt", + "$transferredAtBlockHeight", + "$transferredAtCoreBlockHeight", + "attack", + "defense" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable.json b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable.json new file mode 100644 index 00000000000..88a6c22aa98 --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable.json @@ -0,0 +1,133 @@ +{ + "$format_version": "0", + "id": "86LHvdC1Tqx5P97LQUSibGFqf2vnKFpB6VkqQ7oso86e", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "card": { + "type": "object", + "documentsMutable": false, + "canBeDeleted": false, + "transferable": 1, + "properties": { + "name": { + "type": "string", + "description": "Name of the card", + "maxLength": 63, + "position": 0 + }, + "description": { + "type": "string", + "description": "Description of the card", + "maxLength": 256, + "position": 1 + }, + "imageUrl": { + "type": "string", + "description": "URL of the image associated with the card", + "maxLength": 2048, + "format": "uri", + "position": 2 + }, + "imageHash": { + "type": "array", + "description": "SHA256 hash of the bytes of the image specified by imageUrl", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 3 + }, + "imageFingerprint": { + "type": "array", + "description": "dHash of the image specified by imageUrl", + "byteArray": true, + "minItems": 8, + "maxItems": 8, + "position": 4 + }, + "attack": { + "type": "integer", + "description": "Attack power of the card", + "minimum": 0, + "position": 5 + }, + "defense": { + "type": "integer", + "description": "Defense level of the card", + "minimum": 0, + "position": 6 + } + }, + "indices": [ + { + "name": "owner", + "properties": [ + { + "$ownerId": "asc" + } + ] + }, + { + "name": "attack", + "properties": [ + { + "attack": "asc" + } + ] + }, + { + "name": "defense", + "properties": [ + { + "defense": "asc" + } + ] + }, + { + "name": "transferredAt", + "properties": [ + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "ownerTransferredAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "transferredAtBlockHeight", + "properties": [ + { + "$transferredAtBlockHeight": "asc" + } + ] + }, + { + "name": "transferredAtCoreBlockHeight", + "properties": [ + { + "$transferredAtCoreBlockHeight": "asc" + } + ] + } + ], + "required": [ + "name", + "$transferredAt", + "$transferredAtBlockHeight", + "$transferredAtCoreBlockHeight", + "attack", + "defense" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-creation-restricted-to-owner.json b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-creation-restricted-to-owner.json new file mode 100644 index 00000000000..3a1c2daeccd --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-creation-restricted-to-owner.json @@ -0,0 +1,135 @@ +{ + "$format_version": "0", + "id": "86LHvdC1Tqx5P97LQUSibGFqf2vnKFpB6VkqQ7oso86e", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "card": { + "type": "object", + "documentsMutable": false, + "canBeDeleted": true, + "transferable": 1, + "tradeMode": 1, + "creationRestrictionMode": 1, + "properties": { + "name": { + "type": "string", + "description": "Name of the card", + "maxLength": 63, + "position": 0 + }, + "description": { + "type": "string", + "description": "Description of the card", + "maxLength": 256, + "position": 1 + }, + "imageUrl": { + "type": "string", + "description": "URL of the image associated with the card", + "maxLength": 2048, + "format": "uri", + "position": 2 + }, + "imageHash": { + "type": "array", + "description": "SHA256 hash of the bytes of the image specified by imageUrl", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 3 + }, + "imageFingerprint": { + "type": "array", + "description": "dHash of the image specified by imageUrl", + "byteArray": true, + "minItems": 8, + "maxItems": 8, + "position": 4 + }, + "attack": { + "type": "integer", + "description": "Attack power of the card", + "minimum": 0, + "position": 5 + }, + "defense": { + "type": "integer", + "description": "Defense level of the card", + "minimum": 0, + "position": 6 + } + }, + "indices": [ + { + "name": "owner", + "properties": [ + { + "$ownerId": "asc" + } + ] + }, + { + "name": "attack", + "properties": [ + { + "attack": "asc" + } + ] + }, + { + "name": "defense", + "properties": [ + { + "defense": "asc" + } + ] + }, + { + "name": "transferredAt", + "properties": [ + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "ownerTransferredAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "transferredAtBlockHeight", + "properties": [ + { + "$transferredAtBlockHeight": "asc" + } + ] + }, + { + "name": "transferredAtCoreBlockHeight", + "properties": [ + { + "$transferredAtCoreBlockHeight": "asc" + } + ] + } + ], + "required": [ + "name", + "$transferredAt", + "$transferredAtBlockHeight", + "$transferredAtCoreBlockHeight", + "attack", + "defense" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json new file mode 100644 index 00000000000..0dbc7641d5a --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json @@ -0,0 +1,134 @@ +{ + "$format_version": "0", + "id": "86LHvdC1Tqx5P97LQUSibGFqf2vnKFpB6VkqQ7oso86e", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "card": { + "type": "object", + "documentsMutable": false, + "canBeDeleted": true, + "transferable": 1, + "tradeMode": 1, + "properties": { + "name": { + "type": "string", + "description": "Name of the card", + "maxLength": 63, + "position": 0 + }, + "description": { + "type": "string", + "description": "Description of the card", + "maxLength": 256, + "position": 1 + }, + "imageUrl": { + "type": "string", + "description": "URL of the image associated with the card", + "maxLength": 2048, + "format": "uri", + "position": 2 + }, + "imageHash": { + "type": "array", + "description": "SHA256 hash of the bytes of the image specified by imageUrl", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 3 + }, + "imageFingerprint": { + "type": "array", + "description": "dHash of the image specified by imageUrl", + "byteArray": true, + "minItems": 8, + "maxItems": 8, + "position": 4 + }, + "attack": { + "type": "integer", + "description": "Attack power of the card", + "minimum": 0, + "position": 5 + }, + "defense": { + "type": "integer", + "description": "Defense level of the card", + "minimum": 0, + "position": 6 + } + }, + "indices": [ + { + "name": "owner", + "properties": [ + { + "$ownerId": "asc" + } + ] + }, + { + "name": "attack", + "properties": [ + { + "attack": "asc" + } + ] + }, + { + "name": "defense", + "properties": [ + { + "defense": "asc" + } + ] + }, + { + "name": "transferredAt", + "properties": [ + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "ownerTransferredAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "transferredAtBlockHeight", + "properties": [ + { + "$transferredAtBlockHeight": "asc" + } + ] + }, + { + "name": "transferredAtCoreBlockHeight", + "properties": [ + { + "$transferredAtCoreBlockHeight": "asc" + } + ] + } + ], + "required": [ + "name", + "$transferredAt", + "$transferredAtBlockHeight", + "$transferredAtCoreBlockHeight", + "attack", + "defense" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-not-transferable.json b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-not-transferable.json new file mode 100644 index 00000000000..3032f982cd6 --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-not-transferable.json @@ -0,0 +1,132 @@ +{ + "$format_version": "0", + "id": "86LHvdC1Tqx5P97LQUSibGFqf2vnKFpB6VkqQ7oso86e", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "card": { + "type": "object", + "documentsMutable": true, + "transferable": 0, + "properties": { + "name": { + "type": "string", + "description": "Name of the card", + "maxLength": 63, + "position": 0 + }, + "description": { + "type": "string", + "description": "Description of the card", + "maxLength": 256, + "position": 1 + }, + "imageUrl": { + "type": "string", + "description": "URL of the image associated with the card", + "maxLength": 2048, + "format": "uri", + "position": 2 + }, + "imageHash": { + "type": "array", + "description": "SHA256 hash of the bytes of the image specified by imageUrl", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 3 + }, + "imageFingerprint": { + "type": "array", + "description": "dHash of the image specified by imageUrl", + "byteArray": true, + "minItems": 8, + "maxItems": 8, + "position": 4 + }, + "attack": { + "type": "integer", + "description": "Attack power of the card", + "minimum": 0, + "position": 5 + }, + "defense": { + "type": "integer", + "description": "Defense level of the card", + "minimum": 0, + "position": 6 + } + }, + "indices": [ + { + "name": "owner", + "properties": [ + { + "$ownerId": "asc" + } + ] + }, + { + "name": "attack", + "properties": [ + { + "attack": "asc" + } + ] + }, + { + "name": "defense", + "properties": [ + { + "defense": "asc" + } + ] + }, + { + "name": "transferredAt", + "properties": [ + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "ownerTransferredAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$transferredAt": "asc" + } + ] + }, + { + "name": "transferredAtBlockHeight", + "properties": [ + { + "$transferredAtBlockHeight": "asc" + } + ] + }, + { + "name": "transferredAtCoreBlockHeight", + "properties": [ + { + "$transferredAtCoreBlockHeight": "asc" + } + ] + } + ], + "required": [ + "name", + "$transferredAt", + "$transferredAtBlockHeight", + "$transferredAtCoreBlockHeight", + "attack", + "defense" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-mutable-and-can-not-be-deleted.json b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-mutable-and-can-not-be-deleted.json new file mode 100644 index 00000000000..9506e7100e4 --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-mutable-and-can-not-be-deleted.json @@ -0,0 +1,230 @@ +{ + "$format_version": "0", + "id": "8MjTnX7JUbGfYYswyuCtHU7ZqcYU9s1fUaNiqD9s5tEw", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "profile": { + "type": "object", + "indices": [ + { + "name": "ownerId", + "properties": [ + { + "$ownerId": "asc" + } + ], + "unique": true + }, + { + "name": "ownerIdUpdatedAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$updatedAt": "asc" + } + ] + } + ], + "properties": { + "avatarUrl": { + "type": "string", + "format": "uri", + "maxLength": 2048, + "position": 0 + }, + "publicMessage": { + "type": "string", + "maxLength": 140, + "position": 1 + }, + "displayName": { + "type": "string", + "maxLength": 25, + "position": 2 + } + }, + "required": [ + "$createdAt", + "$updatedAt" + ], + "additionalProperties": false + }, + "contactInfo": { + "type": "object", + "indices": [ + { + "name": "ownerIdKeyIndexes", + "properties": [ + { + "$ownerId": "asc" + }, + { + "rootEncryptionKeyIndex": "asc" + }, + { + "derivationEncryptionKeyIndex": "asc" + } + ], + "unique": true + }, + { + "name": "owner_updated", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$updatedAt": "asc" + } + ] + } + ], + "properties": { + "encToUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "rootEncryptionKeyIndex": { + "type": "integer", + "position": 1 + }, + "derivationEncryptionKeyIndex": { + "type": "integer", + "position": 2 + }, + "privateData": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 2048, + "position": 3, + "description": "This is the encrypted values of aliasName + note + displayHidden encoded as an array in cbor" + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "encToUserId", + "privateData", + "rootEncryptionKeyIndex", + "derivationEncryptionKeyIndex" + ], + "additionalProperties": false + }, + "contactRequest": { + "documentsMutable": true, + "canBeDeleted": false, + "requiresIdentityEncryptionBoundedKey": 2, + "requiresIdentityDecryptionBoundedKey": 2, + "type": "object", + "indices": [ + { + "name": "owner_user_ref", + "properties": [ + { + "$ownerId": "asc" + }, + { + "toUserId": "asc" + }, + { + "accountReference": "asc" + } + ], + "unique": true + }, + { + "name": "ownerId_toUserId", + "properties": [ + { + "$ownerId": "asc" + }, + { + "toUserId": "asc" + } + ] + }, + { + "name": "toUserId_$createdAt", + "properties": [ + { + "toUserId": "asc" + }, + { + "$createdAt": "asc" + } + ] + }, + { + "name": "$ownerId_$createdAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$createdAt": "asc" + } + ] + } + ], + "properties": { + "toUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "encryptedPublicKey": { + "type": "array", + "byteArray": true, + "minItems": 96, + "maxItems": 96, + "position": 1 + }, + "senderKeyIndex": { + "type": "integer", + "position": 2 + }, + "recipientKeyIndex": { + "type": "integer", + "position": 3 + }, + "accountReference": { + "type": "integer", + "position": 4 + }, + "encryptedAccountLabel": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 80, + "position": 5 + }, + "autoAcceptProof": { + "type": "array", + "byteArray": true, + "minItems": 38, + "maxItems": 102, + "position": 6 + } + }, + "required": [ + "$createdAt", + "$createdAtCoreBlockHeight", + "toUserId", + "encryptedPublicKey", + "senderKeyIndex", + "recipientKeyIndex", + "accountReference" + ], + "additionalProperties": false + } + } +} diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-not-mutable-and-can-be-deleted.json b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-not-mutable-and-can-be-deleted.json new file mode 100644 index 00000000000..dda929cb975 --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-not-mutable-and-can-be-deleted.json @@ -0,0 +1,230 @@ +{ + "$format_version": "0", + "id": "8MjTnX7JUbGfYYswyuCtHU7ZqcYU9s1fUaNiqD9s5tEw", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "profile": { + "type": "object", + "indices": [ + { + "name": "ownerId", + "properties": [ + { + "$ownerId": "asc" + } + ], + "unique": true + }, + { + "name": "ownerIdUpdatedAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$updatedAt": "asc" + } + ] + } + ], + "properties": { + "avatarUrl": { + "type": "string", + "format": "uri", + "maxLength": 2048, + "position": 0 + }, + "publicMessage": { + "type": "string", + "maxLength": 140, + "position": 1 + }, + "displayName": { + "type": "string", + "maxLength": 25, + "position": 2 + } + }, + "required": [ + "$createdAt", + "$updatedAt" + ], + "additionalProperties": false + }, + "contactInfo": { + "type": "object", + "indices": [ + { + "name": "ownerIdKeyIndexes", + "properties": [ + { + "$ownerId": "asc" + }, + { + "rootEncryptionKeyIndex": "asc" + }, + { + "derivationEncryptionKeyIndex": "asc" + } + ], + "unique": true + }, + { + "name": "owner_updated", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$updatedAt": "asc" + } + ] + } + ], + "properties": { + "encToUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "rootEncryptionKeyIndex": { + "type": "integer", + "position": 1 + }, + "derivationEncryptionKeyIndex": { + "type": "integer", + "position": 2 + }, + "privateData": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 2048, + "position": 3, + "description": "This is the encrypted values of aliasName + note + displayHidden encoded as an array in cbor" + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "encToUserId", + "privateData", + "rootEncryptionKeyIndex", + "derivationEncryptionKeyIndex" + ], + "additionalProperties": false + }, + "contactRequest": { + "documentsMutable": false, + "canBeDeleted": true, + "requiresIdentityEncryptionBoundedKey": 2, + "requiresIdentityDecryptionBoundedKey": 2, + "type": "object", + "indices": [ + { + "name": "owner_user_ref", + "properties": [ + { + "$ownerId": "asc" + }, + { + "toUserId": "asc" + }, + { + "accountReference": "asc" + } + ], + "unique": true + }, + { + "name": "ownerId_toUserId", + "properties": [ + { + "$ownerId": "asc" + }, + { + "toUserId": "asc" + } + ] + }, + { + "name": "toUserId_$createdAt", + "properties": [ + { + "toUserId": "asc" + }, + { + "$createdAt": "asc" + } + ] + }, + { + "name": "$ownerId_$createdAt", + "properties": [ + { + "$ownerId": "asc" + }, + { + "$createdAt": "asc" + } + ] + } + ], + "properties": { + "toUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "encryptedPublicKey": { + "type": "array", + "byteArray": true, + "minItems": 96, + "maxItems": 96, + "position": 1 + }, + "senderKeyIndex": { + "type": "integer", + "position": 2 + }, + "recipientKeyIndex": { + "type": "integer", + "position": 3 + }, + "accountReference": { + "type": "integer", + "position": 4 + }, + "encryptedAccountLabel": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 80, + "position": 5 + }, + "autoAcceptProof": { + "type": "array", + "byteArray": true, + "minItems": 38, + "maxItems": 102, + "position": 6 + } + }, + "required": [ + "$createdAt", + "$createdAtCoreBlockHeight", + "toUserId", + "encryptedPublicKey", + "senderKeyIndex", + "recipientKeyIndex", + "accountReference" + ], + "additionalProperties": false + } + } +} diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json new file mode 100644 index 00000000000..2d4658c3974 --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-no-indexes.json @@ -0,0 +1,121 @@ +{ + "$format_version": "0", + "id": "8MjTnX7JUbGfYYswyuCtHU7ZqcYU9s1fUaNiqD9s5tEw", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "profile": { + "type": "object", + "indices": [], + "properties": { + "avatarUrl": { + "type": "string", + "format": "uri", + "maxLength": 2048, + "position": 0 + }, + "publicMessage": { + "type": "string", + "maxLength": 140, + "position": 1 + }, + "displayName": { + "type": "string", + "maxLength": 25, + "position": 2 + } + }, + "required": [ + "$createdAt", + "$updatedAt" + ], + "additionalProperties": false + }, + "contactInfo": { + "type": "object", + "indices": [], + "properties": { + "encToUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "rootEncryptionKeyIndex": { + "type": "integer", + "position": 1 + }, + "derivationEncryptionKeyIndex": { + "type": "integer", + "position": 2 + }, + "privateData": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 2048, + "position": 3, + "description": "This is the encrypted values of aliasName + note + displayHidden encoded as an array in cbor" + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "encToUserId", + "privateData", + "rootEncryptionKeyIndex", + "derivationEncryptionKeyIndex" + ], + "additionalProperties": false + }, + "contactRequest": { + "type": "object", + "indices": [], + "properties": { + "toUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "encryptedPublicKey": { + "type": "array", + "byteArray": true, + "minItems": 96, + "maxItems": 96, + "position": 1 + }, + "senderKeyIndex": { + "type": "integer", + "position": 2 + }, + "recipientKeyIndex": { + "type": "integer", + "position": 3 + }, + "accountReference": { + "type": "integer", + "position": 4 + }, + "encryptedAccountLabel": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 80, + "position": 5 + } + }, + "required": [ + "$createdAt", + "toUserId", + "encryptedPublicKey", + "senderKeyIndex", + "recipientKeyIndex", + "accountReference" + ], + "additionalProperties": false + } + } +} diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-no-max-length.json b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-no-max-length.json new file mode 100644 index 00000000000..5939d4221d8 --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dashpay/dashpay-contract-no-max-length.json @@ -0,0 +1,120 @@ +{ + "$format_version": "0", + "id": "8MjTnX7JUbGfYYswyuCtHU7ZqcYU9s1fUaNiqD9s5tEw", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "profile": { + "type": "object", + "indices": [], + "properties": { + "avatar": { + "type": "array", + "byteArray": true, + "position": 0 + }, + "publicMessage": { + "type": "string", + "maxLength": 140, + "position": 1 + }, + "displayName": { + "type": "string", + "maxLength": 25, + "position": 2 + } + }, + "required": [ + "$createdAt", + "$updatedAt" + ], + "additionalProperties": false + }, + "contactInfo": { + "type": "object", + "indices": [], + "properties": { + "encToUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "rootEncryptionKeyIndex": { + "type": "integer", + "position": 1 + }, + "derivationEncryptionKeyIndex": { + "type": "integer", + "position": 2 + }, + "privateData": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 2048, + "position": 3, + "description": "This is the encrypted values of aliasName + note + displayHidden encoded as an array in cbor" + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "encToUserId", + "privateData", + "rootEncryptionKeyIndex", + "derivationEncryptionKeyIndex" + ], + "additionalProperties": false + }, + "contactRequest": { + "type": "object", + "indices": [], + "properties": { + "toUserId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0 + }, + "encryptedPublicKey": { + "type": "array", + "byteArray": true, + "minItems": 96, + "maxItems": 96, + "position": 1 + }, + "senderKeyIndex": { + "type": "integer", + "position": 2 + }, + "recipientKeyIndex": { + "type": "integer", + "position": 3 + }, + "accountReference": { + "type": "integer", + "position": 4 + }, + "encryptedAccountLabel": { + "type": "array", + "byteArray": true, + "minItems": 48, + "maxItems": 80, + "position": 5 + } + }, + "required": [ + "$createdAt", + "toUserId", + "encryptedPublicKey", + "senderKeyIndex", + "recipientKeyIndex", + "accountReference" + ], + "additionalProperties": false + } + } +} diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-and-other-unique-index.json b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-and-other-unique-index.json new file mode 100644 index 00000000000..07ceec6a4fb --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-and-other-unique-index.json @@ -0,0 +1,188 @@ +{ + "$format_version": "0", + "id": "DWBXe9EXFPHxvbArQgT45uQR5gMmi8dfMpLhR5KSbwnZ", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "domain": { + "documentsMutable": false, + "canBeDeleted": true, + "transferable": 1, + "tradeMode": 1, + "type": "object", + "indices": [ + { + "name": "parentNameAndLabel", + "properties": [ + { + "normalizedParentDomainName": "asc" + }, + { + "normalizedLabel": "asc" + } + ], + "unique": true, + "contested": { + "fieldMatches": [ + { + "field": "normalizedLabel", + "regexPattern": "^[a-zA-Z01]{3,19}$" + } + ], + "resolution": 0, + "description": "If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place." + } + }, + { + "name": "dashIdentityId", + "properties": [ + { + "records.dashUniqueIdentityId": "asc" + } + ], + "unique": true + }, + { + "name": "dashAlias", + "properties": [ + { + "records.dashAliasIdentityId": "asc" + } + ] + } + ], + "properties": { + "label": { + "type": "string", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 3, + "maxLength": 63, + "position": 0, + "description": "Domain label. e.g. 'Bob'." + }, + "normalizedLabel": { + "type": "string", + "pattern": "^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$", + "maxLength": 63, + "position": 1, + "description": "Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'", + "$comment": "Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"." + }, + "parentDomainName": { + "type": "string", + "pattern": "^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 2, + "description": "A full parent domain name. e.g. 'dash'." + }, + "normalizedParentDomainName": { + "type": "string", + "pattern": "^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 3, + "description": "A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'", + "$comment": "Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains." + }, + "preorderSalt": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 4, + "description": "Salt used in the preorder document" + }, + "records": { + "type": "object", + "properties": { + "dashUniqueIdentityId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0, + "contentMediaType": "application/x.dash.dpp.identifier", + "description": "Identity ID to be used to create the primary name the Identity", + "$comment": "Must be equal to the document owner" + }, + "dashAliasIdentityId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 1, + "contentMediaType": "application/x.dash.dpp.identifier", + "description": "Identity ID to be used to create alias names for the Identity", + "$comment": "Must be equal to the document owner" + } + }, + "minProperties": 1, + "maxProperties": 1, + "position": 5, + "additionalProperties": false, + "$comment": "Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`" + }, + "subdomainRules": { + "type": "object", + "properties": { + "allowSubdomains": { + "type": "boolean", + "description": "This option defines who can create subdomains: true - anyone; false - only the domain owner", + "$comment": "Only the domain owner is allowed to create subdomains for non top-level domains", + "position": 0 + } + }, + "position": 6, + "description": "Subdomain rules allow domain owners to define rules for subdomains", + "additionalProperties": false, + "required": ["allowSubdomains"] + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "$transferredAt", + "label", + "normalizedLabel", + "normalizedParentDomainName", + "preorderSalt", + "records", + "subdomainRules" + ], + "additionalProperties": false, + "$comment": "In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted" + }, + "preorder": { + "documentsMutable": false, + "canBeDeleted": true, + "type": "object", + "indices": [ + { + "name": "saltedHash", + "properties": [ + { + "saltedDomainHash": "asc" + } + ], + "unique": true + } + ], + "properties": { + "saltedDomainHash": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0, + "description": "Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name" + } + }, + "required": [ + "saltedDomainHash" + ], + "additionalProperties": false, + "$comment": "Preorder documents are immutable: modification and deletion are restricted" + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id-null-searchable-true.json b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id-null-searchable-true.json new file mode 100644 index 00000000000..c3135f6aa50 --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id-null-searchable-true.json @@ -0,0 +1,185 @@ +{ + "$format_version": "0", + "id": "DWBXe9EXFPHxvbArQgT45uQR5gMmi8dfMpLhR5KSbwnZ", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "domain": { + "documentsMutable": false, + "canBeDeleted": true, + "transferable": 1, + "tradeMode": 1, + "type": "object", + "indices": [ + { + "name": "parentNameAndLabel", + "properties": [ + { + "normalizedParentDomainName": "asc" + }, + { + "normalizedLabel": "asc" + } + ], + "unique": true, + "contested": { + "fieldMatches": [ + { + "field": "normalizedLabel", + "regexPattern": "^[a-zA-Z01]{3,19}$" + } + ], + "resolution": 0, + "description": "If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place." + } + }, + { + "name": "identityId", + "properties": [ + { + "records.identity": "asc" + } + ] + }, + { + "name": "contractId", + "properties": [ + { + "records.contract": "asc" + } + ] + } + ], + "properties": { + "label": { + "type": "string", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 3, + "maxLength": 63, + "position": 0, + "description": "Domain label. e.g. 'Bob'." + }, + "normalizedLabel": { + "type": "string", + "pattern": "^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$", + "maxLength": 63, + "position": 1, + "description": "Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'", + "$comment": "Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"." + }, + "parentDomainName": { + "type": "string", + "pattern": "^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 2, + "description": "A full parent domain name. e.g. 'dash'." + }, + "normalizedParentDomainName": { + "type": "string", + "pattern": "^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 3, + "description": "A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'", + "$comment": "Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains." + }, + "preorderSalt": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 4, + "description": "Salt used in the preorder document" + }, + "records": { + "type": "object", + "properties": { + "identity": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 1, + "contentMediaType": "application/x.dash.dpp.identifier", + "description": "Identifier name record that refers to an Identity" + }, + "contract": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 1, + "contentMediaType": "application/x.dash.dpp.identifier", + "description": "Identifier name record that refers to a Contract" + } + }, + "minProperties": 1, + "position": 5, + "additionalProperties": false + }, + "subdomainRules": { + "type": "object", + "properties": { + "allowSubdomains": { + "type": "boolean", + "description": "This option defines who can create subdomains: true - anyone; false - only the domain owner", + "$comment": "Only the domain owner is allowed to create subdomains for non top-level domains", + "position": 0 + } + }, + "position": 6, + "description": "Subdomain rules allow domain owners to define rules for subdomains", + "additionalProperties": false, + "required": [ + "allowSubdomains" + ] + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "$transferredAt", + "label", + "normalizedLabel", + "normalizedParentDomainName", + "preorderSalt", + "records", + "subdomainRules" + ], + "additionalProperties": false, + "$comment": "In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted" + }, + "preorder": { + "documentsMutable": false, + "canBeDeleted": true, + "type": "object", + "indices": [ + { + "name": "saltedHash", + "properties": [ + { + "saltedDomainHash": "asc" + } + ], + "unique": true + } + ], + "properties": { + "saltedDomainHash": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0, + "description": "Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name" + } + }, + "required": [ + "saltedDomainHash" + ], + "additionalProperties": false, + "$comment": "Preorder documents are immutable: modification and deletion are restricted" + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id.json b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id.json new file mode 100644 index 00000000000..238c1ad59ee --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index-with-contract-id.json @@ -0,0 +1,187 @@ +{ + "$format_version": "0", + "id": "DWBXe9EXFPHxvbArQgT45uQR5gMmi8dfMpLhR5KSbwnZ", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "domain": { + "documentsMutable": false, + "canBeDeleted": true, + "transferable": 1, + "tradeMode": 1, + "type": "object", + "indices": [ + { + "name": "parentNameAndLabel", + "properties": [ + { + "normalizedParentDomainName": "asc" + }, + { + "normalizedLabel": "asc" + } + ], + "unique": true, + "contested": { + "fieldMatches": [ + { + "field": "normalizedLabel", + "regexPattern": "^[a-zA-Z01]{3,19}$" + } + ], + "resolution": 0, + "description": "If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place." + } + }, + { + "name": "identityId", + "nullSearchable": false, + "properties": [ + { + "records.identity": "asc" + } + ] + }, + { + "name": "contractId", + "nullSearchable": false, + "properties": [ + { + "records.contract": "asc" + } + ] + } + ], + "properties": { + "label": { + "type": "string", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 3, + "maxLength": 63, + "position": 0, + "description": "Domain label. e.g. 'Bob'." + }, + "normalizedLabel": { + "type": "string", + "pattern": "^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$", + "maxLength": 63, + "position": 1, + "description": "Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'", + "$comment": "Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"." + }, + "parentDomainName": { + "type": "string", + "pattern": "^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 2, + "description": "A full parent domain name. e.g. 'dash'." + }, + "normalizedParentDomainName": { + "type": "string", + "pattern": "^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 3, + "description": "A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'", + "$comment": "Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains." + }, + "preorderSalt": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 4, + "description": "Salt used in the preorder document" + }, + "records": { + "type": "object", + "properties": { + "identity": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 1, + "contentMediaType": "application/x.dash.dpp.identifier", + "description": "Identifier name record that refers to an Identity" + }, + "contract": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 1, + "contentMediaType": "application/x.dash.dpp.identifier", + "description": "Identifier name record that refers to a Contract" + } + }, + "minProperties": 1, + "position": 5, + "additionalProperties": false + }, + "subdomainRules": { + "type": "object", + "properties": { + "allowSubdomains": { + "type": "boolean", + "description": "This option defines who can create subdomains: true - anyone; false - only the domain owner", + "$comment": "Only the domain owner is allowed to create subdomains for non top-level domains", + "position": 0 + } + }, + "position": 6, + "description": "Subdomain rules allow domain owners to define rules for subdomains", + "additionalProperties": false, + "required": [ + "allowSubdomains" + ] + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "$transferredAt", + "label", + "normalizedLabel", + "normalizedParentDomainName", + "preorderSalt", + "records", + "subdomainRules" + ], + "additionalProperties": false, + "$comment": "In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted" + }, + "preorder": { + "documentsMutable": false, + "canBeDeleted": true, + "type": "object", + "indices": [ + { + "name": "saltedHash", + "properties": [ + { + "saltedDomainHash": "asc" + } + ], + "unique": true + } + ], + "properties": { + "saltedDomainHash": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0, + "description": "Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name" + } + }, + "required": [ + "saltedDomainHash" + ], + "additionalProperties": false, + "$comment": "Preorder documents are immutable: modification and deletion are restricted" + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index.json b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index.json new file mode 100644 index 00000000000..8e05c7829fc --- /dev/null +++ b/packages/rs-drive-abci/tests/supporting_files/contract/dpns/dpns-contract-contested-unique-index.json @@ -0,0 +1,169 @@ +{ + "$format_version": "0", + "id": "DWBXe9EXFPHxvbArQgT45uQR5gMmi8dfMpLhR5KSbwnZ", + "ownerId": "2QjL594djCH2NyDsn45vd6yQjEDHupMKo7CEGVTHtQxU", + "version": 1, + "documentSchemas": { + "domain": { + "documentsMutable": false, + "canBeDeleted": true, + "transferable": 1, + "tradeMode": 1, + "type": "object", + "indices": [ + { + "name": "parentNameAndLabel", + "properties": [ + { + "normalizedParentDomainName": "asc" + }, + { + "normalizedLabel": "asc" + } + ], + "unique": true, + "contested": { + "fieldMatches": [ + { + "field": "normalizedLabel", + "regexPattern": "^[a-zA-Z01]{3,19}$" + } + ], + "resolution": 0, + "description": "If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place." + } + }, + { + "name": "identityId", + "nullSearchable": false, + "properties": [ + { + "records.identity": "asc" + } + ] + } + ], + "properties": { + "label": { + "type": "string", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 3, + "maxLength": 63, + "position": 0, + "description": "Domain label. e.g. 'Bob'." + }, + "normalizedLabel": { + "type": "string", + "pattern": "^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$", + "maxLength": 63, + "position": 1, + "description": "Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'", + "$comment": "Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"." + }, + "parentDomainName": { + "type": "string", + "pattern": "^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 2, + "description": "A full parent domain name. e.g. 'dash'." + }, + "normalizedParentDomainName": { + "type": "string", + "pattern": "^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$", + "minLength": 0, + "maxLength": 63, + "position": 3, + "description": "A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'", + "$comment": "Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains." + }, + "preorderSalt": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 4, + "description": "Salt used in the preorder document" + }, + "records": { + "type": "object", + "properties": { + "identity": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 1, + "contentMediaType": "application/x.dash.dpp.identifier", + "description": "Identifier name record that refers to an Identity" + } + }, + "minProperties": 1, + "position": 5, + "additionalProperties": false + }, + "subdomainRules": { + "type": "object", + "properties": { + "allowSubdomains": { + "type": "boolean", + "description": "This option defines who can create subdomains: true - anyone; false - only the domain owner", + "$comment": "Only the domain owner is allowed to create subdomains for non top-level domains", + "position": 0 + } + }, + "position": 6, + "description": "Subdomain rules allow domain owners to define rules for subdomains", + "additionalProperties": false, + "required": [ + "allowSubdomains" + ] + } + }, + "required": [ + "$createdAt", + "$updatedAt", + "$transferredAt", + "label", + "normalizedLabel", + "normalizedParentDomainName", + "preorderSalt", + "records", + "subdomainRules" + ], + "additionalProperties": false, + "$comment": "In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted" + }, + "preorder": { + "documentsMutable": false, + "canBeDeleted": true, + "type": "object", + "indices": [ + { + "name": "saltedHash", + "properties": [ + { + "saltedDomainHash": "asc" + } + ], + "unique": true + } + ], + "properties": { + "saltedDomainHash": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0, + "description": "Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name" + } + }, + "required": [ + "saltedDomainHash" + ], + "additionalProperties": false, + "$comment": "Preorder documents are immutable: modification and deletion are restricted" + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index fa889b441e8..8630d0225c5 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,31 +1,44 @@ [package] name = "drive-proof-verifier" -version = "0.25.21" +version = "1.1.0-dev.1" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" crate-type = ["cdylib"] [features] -default = ["mocks", "json"] -mocks = ["dep:serde"] -json = ["dep:serde_json"] - +default = ["mocks"] +mocks = [ + "dep:serde", + "dep:serde_json", + "dep:bincode", + "dep:platform-serialization-derive", + "dep:platform-serialization", + "dpp/document-serde-conversion", +] [dependencies] -thiserror = { version = "1.0.39" } +thiserror = { version = "1.0.59" } dapi-grpc = { path = "../dapi-grpc" } drive = { path = "../rs-drive", default-features = false, features = [ - "verify", + "verify", ] } -dpp = { path = "../rs-dpp" } -tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci" } -# tenderdash-abci = { path = "../../../rs-tenderdash-abci/abci" } +dpp = { path = "../rs-dpp", features = [ + "bls-signatures", + "document-value-conversion", + "extended-document", +], default-features = false } +bincode = { version = "2.0.0-rc.3", features = ["serde"], optional = true } +platform-serialization-derive = { path = "../rs-platform-serialization-derive", optional = true } +platform-serialization = { path = "../rs-platform-serialization", optional = true } +tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "1.1.0", tag = "v1.1.0", features = [ + "crypto", +], default-features = false } tracing = { version = "0.1.37" } -serde = { version = "1.0.171", default-features = false, optional = true } +serde = { version = "1.0.197", default-features = false, optional = true } serde_json = { version = "1.0.103", features = [ - "preserve_order", + "preserve_order", ], optional = true } -lazy_static = { version = "1.4.0" } hex = { version = "0.4.3" } +derive_more = { version = "0.99.11" } diff --git a/packages/rs-drive-proof-verifier/src/error.rs b/packages/rs-drive-proof-verifier/src/error.rs index a76ea2e788a..02752a4b128 100644 --- a/packages/rs-drive-proof-verifier/src/error.rs +++ b/packages/rs-drive-proof-verifier/src/error.rs @@ -37,7 +37,7 @@ pub enum Error { /// Decode protobuf error #[error("decode request: {error}")] - RequestDecodeError { error: String }, + RequestError { error: String }, /// Decode protobuf response error #[error("decode response: {error}")] @@ -55,10 +55,6 @@ pub enum Error { #[error("error during signature verification: {error}")] SignatureVerificationError { error: String }, - /// Provided quorum is invalid - #[error("invalid quorum: {error}")] - InvalidQuorum { error: String }, - /// Signature format is invalid #[error("invalid signature format: {error}")] InvalidSignatureFormat { error: String }, @@ -78,6 +74,38 @@ pub enum Error { /// Invalid version of object in response #[error("invalid version of message")] InvalidVersion(#[from] dpp::version::PlatformVersionError), + + /// Context provider is not set + #[error("context provider is not set")] + ContextProviderNotSet, + + /// Context provider error + #[error("context provider error: {0}")] + ContextProviderError(#[from] ContextProviderError), +} + +/// Errors returned by the context provider +#[derive(Debug, thiserror::Error)] +pub enum ContextProviderError { + /// Generic Context provider error + #[error("Context provider error: {0}")] + Generic(String), + + /// Configuration error + #[error("Configuration error: {0}")] + Config(String), + + /// Data contract is invalid or not found, or some error occurred during data contract retrieval + #[error("cannot get data contract: {0}")] + DataContractFailure(String), + + /// Provided quorum is invalid + #[error("invalid quorum: {0}")] + InvalidQuorum(String), + + /// Core Fork Error + #[error("activation fork error: {0}")] + ActivationForkError(String), } impl From for Error { diff --git a/packages/rs-drive-proof-verifier/src/from_request.rs b/packages/rs-drive-proof-verifier/src/from_request.rs new file mode 100644 index 00000000000..ff2a74de36c --- /dev/null +++ b/packages/rs-drive-proof-verifier/src/from_request.rs @@ -0,0 +1,458 @@ +//! Conversions between Drive queries and dapi-grpc requests. + +use dapi_grpc::platform::v0::{ + self as proto, + get_contested_resource_vote_state_request::{ + self, get_contested_resource_vote_state_request_v0, + }, + get_contested_resources_request::{ + self, get_contested_resources_request_v0, GetContestedResourcesRequestV0, + }, + get_vote_polls_by_end_date_request::{self}, + GetContestedResourceIdentityVotesRequest, GetContestedResourceVoteStateRequest, + GetContestedResourceVotersForIdentityRequest, GetContestedResourcesRequest, + GetPrefundedSpecializedBalanceRequest, GetVotePollsByEndDateRequest, +}; +use dpp::{ + identifier::Identifier, platform_value::Value, + voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll, +}; +use drive::query::{ + contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery, + vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery, + vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, ContestedDocumentVotePollDriveQueryResultType, + }, + vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery, + VotePollsByEndDateDriveQuery, +}; + +use crate::Error; + +const BINCODE_CONFIG: dpp::bincode::config::Configuration = dpp::bincode::config::standard(); + +/// Conver a gRPC request into a query object. +/// +/// This trait is implemented on Drive queries that can be created from gRPC requests. +/// +/// # Generic Type Parameters +/// +/// * `T`: The type of the gRPC request. +pub trait TryFromRequest: Sized { + /// Create based on some `grpc_request`. + fn try_from_request(grpc_request: T) -> Result; + + /// Try to convert the request into a gRPC query. + fn try_to_request(&self) -> Result; +} + +impl TryFromRequest + for ContestedDocumentVotePollDriveQueryResultType +{ + fn try_from_request( + grpc_request: get_contested_resource_vote_state_request_v0::ResultType, + ) -> Result { + use get_contested_resource_vote_state_request_v0::ResultType as GrpcResultType; + use ContestedDocumentVotePollDriveQueryResultType as DriveResultType; + + Ok(match grpc_request { + GrpcResultType::Documents => DriveResultType::Documents, + GrpcResultType::DocumentsAndVoteTally => DriveResultType::DocumentsAndVoteTally, + GrpcResultType::VoteTally => DriveResultType::VoteTally, + }) + } + fn try_to_request( + &self, + ) -> Result { + use get_contested_resource_vote_state_request_v0::ResultType as GrpcResultType; + use ContestedDocumentVotePollDriveQueryResultType as DriveResultType; + + Ok(match self { + DriveResultType::Documents => GrpcResultType::Documents, + DriveResultType::DocumentsAndVoteTally => GrpcResultType::DocumentsAndVoteTally, + DriveResultType::VoteTally => GrpcResultType::VoteTally, + }) + } +} + +impl TryFromRequest for ContestedDocumentVotePollDriveQuery { + fn try_from_request(grpc_request: GetContestedResourceVoteStateRequest) -> Result { + let result = match grpc_request.version.ok_or(Error::EmptyVersion)? { + get_contested_resource_vote_state_request::Version::V0(v) => { + ContestedDocumentVotePollDriveQuery { + limit: v.count.map(|v| v as u16), + vote_poll: ContestedDocumentResourceVotePoll { + contract_id: Identifier::from_bytes(&v.contract_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contract id: {}", e), + } + })?, + document_type_name: v.document_type_name.clone(), + index_name: v.index_name.clone(), + index_values: bincode_decode_values(v.index_values.iter())?, + }, + result_type: match v.result_type() { + get_contested_resource_vote_state_request_v0::ResultType::Documents => { + ContestedDocumentVotePollDriveQueryResultType::Documents + } + get_contested_resource_vote_state_request_v0::ResultType::DocumentsAndVoteTally => { + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally + } + get_contested_resource_vote_state_request_v0::ResultType::VoteTally => { + ContestedDocumentVotePollDriveQueryResultType::VoteTally + } + }, + start_at: v + .start_at_identifier_info + .map(|v| to_bytes32(&v.start_identifier).map(|id| (id, v.start_identifier_included))) + .transpose() + .map_err(|e| { + Error::RequestError { + error: format!( + "cannot decode start_at: {}", + e + )}} + )?, + offset: None, // offset is not supported when we use proofs + allow_include_locked_and_abstaining_vote_tally: v + .allow_include_locked_and_abstaining_vote_tally, + } + } + }; + Ok(result) + } + + fn try_to_request(&self) -> Result { + use proto::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError{error:"ContestedDocumentVotePollDriveQuery.offset field is internal and must be set to None".into()}); + } + + let start_at_identifier_info = self.start_at.map(|v| request_v0::StartAtIdentifierInfo { + start_identifier: v.0.to_vec(), + start_identifier_included: v.1, + }); + + use proto::get_contested_resource_vote_state_request:: get_contested_resource_vote_state_request_v0::ResultType as GrpcResultType; + Ok(proto::get_contested_resource_vote_state_request::GetContestedResourceVoteStateRequestV0 { + prove:true, + contract_id:self.vote_poll.contract_id.to_vec(), + count: self.limit.map(|v| v as u32), + document_type_name: self.vote_poll.document_type_name.clone(), + index_name: self.vote_poll.index_name.clone(), + index_values: self.vote_poll.index_values.iter().map(|v| + dpp::bincode::encode_to_vec(v, BINCODE_CONFIG).map_err(|e|Error::RequestError { error: e.to_string() } )).collect::,_>>()?, + result_type:match self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents => GrpcResultType::Documents.into(), + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => GrpcResultType::DocumentsAndVoteTally.into(), + ContestedDocumentVotePollDriveQueryResultType::VoteTally => GrpcResultType::VoteTally.into(), + }, + start_at_identifier_info, + allow_include_locked_and_abstaining_vote_tally: self.allow_include_locked_and_abstaining_vote_tally, + } + .into()) + } +} + +fn to_bytes32(v: &[u8]) -> Result<[u8; 32], Error> { + let result: Result<[u8; 32], std::array::TryFromSliceError> = v.try_into(); + match result { + Ok(id) => Ok(id), + Err(e) => Err(Error::RequestError { + error: format!("cannot decode id: {}", e), + }), + } +} + +impl TryFromRequest + for ContestedResourceVotesGivenByIdentityQuery +{ + fn try_from_request( + grpc_request: GetContestedResourceIdentityVotesRequest, + ) -> Result { + let proto::get_contested_resource_identity_votes_request::Version::V0(value) = + grpc_request.version.ok_or(Error::EmptyVersion)?; + let start_at = value + .start_at_vote_poll_id_info + .map(|v| { + to_bytes32(&v.start_at_poll_identifier) + .map(|id| (id, v.start_poll_identifier_included)) + }) + .transpose()?; + + Ok(Self { + identity_id: Identifier::from_vec(value.identity_id.to_vec()).map_err(|e| { + Error::RequestError { + error: e.to_string(), + } + })?, + offset: None, + limit: value.limit.map(|x| x as u16), + start_at, + order_ascending: value.order_ascending, + }) + } + + fn try_to_request(&self) -> Result { + use proto::get_contested_resource_identity_votes_request::get_contested_resource_identity_votes_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError{error:"ContestedResourceVotesGivenByIdentityQuery.offset field is internal and must be set to None".into()}); + } + + Ok(proto::get_contested_resource_identity_votes_request::GetContestedResourceIdentityVotesRequestV0 { + prove: true, + identity_id: self.identity_id.to_vec(), + offset: self.offset.map(|x| x as u32), + limit: self.limit.map(|x| x as u32), + start_at_vote_poll_id_info: self.start_at.map(|(id, included)| { + request_v0::StartAtVotePollIdInfo { + start_at_poll_identifier: id.to_vec(), + start_poll_identifier_included: included, + } + }), + order_ascending: self.order_ascending, + }.into() + ) + } +} + +use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_request; + +impl TryFromRequest + for ContestedDocumentVotePollVotesDriveQuery +{ + fn try_from_request( + value: GetContestedResourceVotersForIdentityRequest, + ) -> Result { + let result = match value.version.ok_or(Error::EmptyVersion)? { + get_contested_resource_voters_for_identity_request::Version::V0(v) => { + ContestedDocumentVotePollVotesDriveQuery { + vote_poll: ContestedDocumentResourceVotePoll { + contract_id: Identifier::from_bytes(&v.contract_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contract id: {}", e), + } + })?, + document_type_name: v.document_type_name.clone(), + index_name: v.index_name.clone(), + index_values: bincode_decode_values(v.index_values.iter())?, + }, + contestant_id: Identifier::from_bytes(&v.contestant_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contestant_id: {}", e), + } + })?, + limit: v.count.map(|v| v as u16), + offset: None, + start_at: v + .start_at_identifier_info + .map(|v| { + to_bytes32(&v.start_identifier) + .map(|id| (id, v.start_identifier_included)) + }) + .transpose() + .map_err(|e| Error::RequestError { + error: format!("cannot decode start_at value: {}", e), + })?, + order_ascending: v.order_ascending, + } + } + }; + + Ok(result) + } + fn try_to_request(&self) -> Result { + use proto::get_contested_resource_voters_for_identity_request::get_contested_resource_voters_for_identity_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError{error:"ContestedDocumentVotePollVotesDriveQuery.offset field is internal and must be set to None".into()}); + } + + Ok(proto::get_contested_resource_voters_for_identity_request::GetContestedResourceVotersForIdentityRequestV0 { + prove:true, + contract_id: self.vote_poll.contract_id.to_vec(), + document_type_name: self.vote_poll.document_type_name.clone(), + index_name: self.vote_poll.index_name.clone(), + index_values: self.vote_poll.index_values.iter().map(|v| + dpp::bincode::encode_to_vec(v, BINCODE_CONFIG).map_err(|e| + Error::RequestError { error: e.to_string()})).collect::,_>>()?, + order_ascending: self.order_ascending, + count: self.limit.map(|v| v as u32), + contestant_id: self.contestant_id.to_vec(), + start_at_identifier_info: self.start_at.map(|v| request_v0::StartAtIdentifierInfo{ + start_identifier: v.0.to_vec(), + start_identifier_included: v.1, + }), + } + .into()) + } +} + +impl TryFromRequest for VotePollsByDocumentTypeQuery { + fn try_from_request(value: GetContestedResourcesRequest) -> Result { + let result = match value.version.ok_or(Error::EmptyVersion)? { + get_contested_resources_request::Version::V0(req) => VotePollsByDocumentTypeQuery { + contract_id: Identifier::from_bytes(&req.contract_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contract id: {}", e), + } + })?, + document_type_name: req.document_type_name.clone(), + index_name: req.index_name.clone(), + start_at_value: req + .start_at_value_info + .map(|i| { + let (value, _): (Value, _) = + bincode::decode_from_slice(&i.start_value, BINCODE_CONFIG).map_err( + |e| Error::RequestError { + error: format!("cannot decode start value: {}", e), + }, + )?; + Ok::<_, Error>((value, i.start_value_included)) + }) + .transpose()?, + start_index_values: bincode_decode_values(req.start_index_values.iter())?, + end_index_values: bincode_decode_values(req.end_index_values.iter())?, + limit: req.count.map(|v| v as u16), + order_ascending: req.order_ascending, + }, + }; + Ok(result) + } + + fn try_to_request(&self) -> Result { + Ok(GetContestedResourcesRequestV0 { + prove: true, + contract_id: self.contract_id.to_vec(), + count: self.limit.map(|v| v as u32), + document_type_name: self.document_type_name.clone(), + end_index_values: bincode_encode_values(&self.end_index_values)?, + start_index_values: bincode_encode_values(&self.start_index_values)?, + index_name: self.index_name.clone(), + order_ascending: self.order_ascending, + start_at_value_info: self + .start_at_value + .as_ref() + .map(|(start_value, start_value_included)| { + Ok::<_, Error>(get_contested_resources_request_v0::StartAtValueInfo { + start_value: bincode::encode_to_vec(start_value, BINCODE_CONFIG).map_err( + |e| Error::RequestError { + error: format!("cannot encode start value: {}", e), + }, + )?, + start_value_included: *start_value_included, + }) + }) + .transpose()?, + } + .into()) + } +} + +impl TryFromRequest for VotePollsByEndDateDriveQuery { + fn try_from_request(value: GetVotePollsByEndDateRequest) -> Result { + let result = match value.version.ok_or(Error::EmptyVersion)? { + get_vote_polls_by_end_date_request::Version::V0(v) => VotePollsByEndDateDriveQuery { + start_time: v + .start_time_info + .map(|v| (v.start_time_ms, v.start_time_included)), + end_time: v + .end_time_info + .map(|v| (v.end_time_ms, v.end_time_included)), + limit: v.limit.map(|v| v as u16), + offset: v.offset.map(|v| v as u16), + order_ascending: v.ascending, + }, + }; + Ok(result) + } + + fn try_to_request(&self) -> Result { + use proto::get_vote_polls_by_end_date_request::get_vote_polls_by_end_date_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError { + error: + "VotePollsByEndDateDriveQuery.offset field is internal and must be set to None" + .into(), + }); + } + + Ok( + proto::get_vote_polls_by_end_date_request::GetVotePollsByEndDateRequestV0 { + prove: true, + start_time_info: self.start_time.map(|(start_time_ms, start_time_included)| { + request_v0::StartAtTimeInfo { + start_time_ms, + start_time_included, + } + }), + end_time_info: self.end_time.map(|(end_time_ms, end_time_included)| { + request_v0::EndAtTimeInfo { + end_time_ms, + end_time_included, + } + }), + limit: self.limit.map(|v| v as u32), + offset: self.offset.map(|v| v as u32), + ascending: self.order_ascending, + } + .into(), + ) + } +} + +impl TryFromRequest for Identifier { + fn try_to_request(&self) -> Result { + Ok( + proto::get_prefunded_specialized_balance_request::GetPrefundedSpecializedBalanceRequestV0 { + prove:true, + id: self.to_vec(), + }.into() + ) + } + + fn try_from_request( + grpc_request: GetPrefundedSpecializedBalanceRequest, + ) -> Result { + match grpc_request.version.ok_or(Error::EmptyVersion)? { + proto::get_prefunded_specialized_balance_request::Version::V0(v) => { + Identifier::from_bytes(&v.id).map_err(|e| Error::RequestError { + error: format!("cannot decode id: {}", e), + }) + } + } + } +} + +/// Convert a sequence of byte vectors into a sequence of [values](platform_value::Value). +/// +/// Small utility function to decode a sequence of byte vectors into a sequence of [values](platform_value::Value). +fn bincode_decode_values, T: IntoIterator>( + values: T, +) -> Result, Error> { + values + .into_iter() + .map(|v| { + dpp::bincode::decode_from_slice(v.as_ref(), BINCODE_CONFIG) + .map_err(|e| Error::RequestError { + error: format!("cannot decode value: {}", e), + }) + .map(|(v, _)| v) + }) + .collect() +} + +/// Convert a sequence of [values](platform_value::Value) into a sequence of byte vectors. +/// +/// Small utility function to encode a sequence of [values](platform_value::Value) into a sequence of byte vectors. +fn bincode_encode_values<'a, T: IntoIterator>( + values: T, +) -> Result>, Error> { + values + .into_iter() + .map(|v| { + dpp::bincode::encode_to_vec(v, BINCODE_CONFIG).map_err(|e| Error::RequestError { + error: format!("cannot encode value: {}", e), + }) + }) + .collect::, _>>() +} diff --git a/packages/rs-drive-proof-verifier/src/lib.rs b/packages/rs-drive-proof-verifier/src/lib.rs index 8b2a916b3d1..7e28b6691fe 100644 --- a/packages/rs-drive-proof-verifier/src/lib.rs +++ b/packages/rs-drive-proof-verifier/src/lib.rs @@ -2,14 +2,19 @@ #![warn(missing_docs)] /// Errors that can occur during proof verification -mod error; +pub mod error; /// Implementation of proof verification mod proof; mod provider; pub mod types; mod verify; pub use error::Error; -pub use proof::FromProof; +pub use proof::{FromProof, Length}; #[cfg(feature = "mocks")] -pub use provider::MockQuorumInfoProvider; -pub use provider::QuorumInfoProvider; +pub use provider::MockContextProvider; +pub use provider::{ContextProvider, DataContractProvider}; +pub mod from_request; + +// Needed for #[derive(PlatformSerialize, PlatformDeserialize)] +#[cfg(feature = "mocks")] +use dpp::serialization; diff --git a/packages/rs-drive-proof-verifier/src/proof.rs b/packages/rs-drive-proof-verifier/src/proof.rs index d2efd1f3571..de46f75a1e8 100644 --- a/packages/rs-drive-proof-verifier/src/proof.rs +++ b/packages/rs-drive-proof-verifier/src/proof.rs @@ -1,43 +1,58 @@ -use std::array::TryFromSliceError; -use std::collections::BTreeMap; -use std::num::TryFromIntError; - -use crate::{types::*, Error, QuorumInfoProvider}; +use crate::from_request::TryFromRequest; +use crate::provider::DataContractProvider; +use crate::verify::verify_tenderdash_proof; +use crate::{types, types::*, ContextProvider, Error}; +use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; +use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::{ self, GetProtocolVersionUpgradeVoteStatusRequestV0, }; use dapi_grpc::platform::v0::security_level_map::KeyKindRequestType as GrpcKeyKind; use dapi_grpc::platform::v0::{ - get_data_contract_history_request, get_data_contract_request, get_data_contracts_request, - get_epochs_info_request, get_identity_balance_and_revision_request, + get_contested_resource_identity_votes_request, get_data_contract_history_request, + get_data_contract_request, get_data_contracts_request, get_epochs_info_request, + get_identities_contract_keys_request, get_identity_balance_and_revision_request, get_identity_balance_request, get_identity_by_public_key_hash_request, - get_identity_keys_request, get_identity_request, GetProtocolVersionUpgradeStateRequest, + get_identity_contract_nonce_request, get_identity_keys_request, get_identity_nonce_request, + get_identity_request, get_path_elements_request, get_prefunded_specialized_balance_request, + GetContestedResourceVotersForIdentityRequest, GetContestedResourceVotersForIdentityResponse, + GetPathElementsRequest, GetPathElementsResponse, GetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeStateResponse, GetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeVoteStatusResponse, + GetProtocolVersionUpgradeVoteStatusResponse, Proof, ResponseMetadata, }; use dapi_grpc::platform::{ v0::{self as platform, key_request_type, KeyRequestType as GrpcKeyType}, VersionedGrpcResponse, }; -use dpp::block::epoch::EpochIndex; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::{EpochIndex, MAX_EPOCH}; use dpp::block::extended_epoch_info::ExtendedEpochInfo; +use dpp::core_subsidy::NetworkCoreSubsidy; use dpp::dashcore::hashes::Hash; -use dpp::dashcore::ProTxHash; +use dpp::dashcore::{Network, ProTxHash}; use dpp::document::{Document, DocumentV0Getters}; +use dpp::identity::identities_contract_keys::IdentitiesContractKeys; +use dpp::identity::Purpose; +use dpp::platform_value::{self}; use dpp::prelude::{DataContract, Identifier, Identity}; +use dpp::serialization::PlatformDeserializable; +use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::state_transition::StateTransition; use dpp::version::PlatformVersion; +use dpp::voting::votes::Vote; use drive::drive::identity::key::fetch::{ IdentityKeysRequest, KeyKindRequestType, KeyRequestType, PurposeU8, SecurityLevelU8, }; -pub use drive::drive::verify::RootHash; use drive::drive::Drive; -use drive::query::DriveQuery; - -use crate::verify::verify_tenderdash_proof; - -lazy_static::lazy_static! { - pub static ref PLATFORM_VERSION: PlatformVersion = PlatformVersion::latest().to_owned(); -} +use drive::error::proof::ProofError; +use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; +use drive::query::vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery; +use drive::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQuery; +use drive::query::vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery; +use drive::query::{DriveDocumentQuery, VotePollsByEndDateDriveQuery}; +use std::array::TryFromSliceError; +use std::collections::BTreeMap; +use std::num::TryFromIntError; /// Parse and verify the received proof and retrieve the requested object, if any. /// @@ -57,26 +72,60 @@ pub trait FromProof { type Request; /// Response type for which this trait is implemented. type Response; + /// Parse and verify the received proof and retrieve the requested object, if any. /// /// # Arguments /// /// * `request`: The request sent to the server. /// * `response`: The response received from the server. - /// * `provider`: A callback implementing [QuorumInfoProvider] that provides quorum details required to verify the proof. + /// * `network`: The network we are using, Mainnet/Testnet/Devnet or Regtest + /// * `platform_version`: The platform version that should be used. + /// * `provider`: A callback implementing [ContextProvider] that provides quorum details required to verify the proof. /// /// # Returns /// - /// * `Ok(Some(object))` when the requested object was found in the proof. + /// * `Ok(Some(object, metadata))` when the requested object was found in the proof. /// * `Ok(None)` when the requested object was not found in the proof; this can be interpreted as proof of non-existence. /// For collections, returns Ok(None) if none of the requested objects were found. /// * `Err(Error)` when either the provided data is invalid or proof validation failed. fn maybe_from_proof<'a, I: Into, O: Into>( request: I, response: O, + network: Network, platform_version: &PlatformVersion, - provider: &'a dyn QuorumInfoProvider, + provider: &'a dyn ContextProvider, ) -> Result, Error> + where + Self: Sized + 'a, + { + Self::maybe_from_proof_with_metadata(request, response, network, platform_version, provider) + .map(|maybe_result| maybe_result.0) + } + + /// Parse and verify the received proof and retrieve the requested object, if any. + /// + /// # Arguments + /// + /// * `request`: The request sent to the server. + /// * `response`: The response received from the server. + /// * `network`: The network we are using, Mainnet/Testnet/Devnet or Regtest + /// * `platform_version`: The platform version that should be used. + /// * `provider`: A callback implementing [ContextProvider] that provides quorum details required to verify the proof. + /// + /// # Returns + /// + /// * `Ok(Some((object, metadata)))` when the requested object was found in the proof. + /// * `Ok(None)` when the requested object was not found in the proof; this can be interpreted as proof of non-existence. + /// For collections, returns Ok(None) if none of the requested objects were found. + /// * `Err(Error)` when either the provided data is invalid or proof validation failed. + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Self: Sized + 'a; @@ -91,7 +140,9 @@ pub trait FromProof { /// /// * `request`: The request sent to the server. /// * `response`: The response received from the server. - /// * `provider`: A callback implementing [QuorumInfoProvider] that provides quorum details required to verify the proof. + /// * `network`: The network we are using, Mainnet/Testnet/Devnet or Regtest + /// * `platform_version`: The platform version that should be used. + /// * `provider`: A callback implementing [ContextProvider] that provides quorum details required to verify the proof. /// /// # Returns /// @@ -101,27 +152,109 @@ pub trait FromProof { fn from_proof<'a, I: Into, O: Into>( request: I, response: O, + network: Network, platform_version: &PlatformVersion, - provider: &'a dyn QuorumInfoProvider, + provider: &'a dyn ContextProvider, ) -> Result where Self: Sized + 'a, { - Self::maybe_from_proof(request, response, platform_version, provider)? + Self::maybe_from_proof(request, response, network, platform_version, provider)? .ok_or(Error::NotFound) } + + /// Retrieve the requested object from the proof with metadata. + /// + /// Runs full verification of the proof and retrieves enclosed objects. + /// + /// This method uses [`FromProof::maybe_from_proof_with_metadata()`] internally and throws an error + /// if the requested object does not exist in the proof. + /// + /// # Arguments + /// + /// * `request`: The request sent to the server. + /// * `response`: The response received from the server. + /// * `network`: The network we are using, Mainnet/Testnet/Devnet or Regtest + /// * `platform_version`: The platform version that should be used. + /// * `provider`: A callback implementing [ContextProvider] that provides quorum details required to verify the proof. + /// + /// # Returns + /// + /// * `Ok(Some(object, metadata))` when the requested object was found in the proof. + /// * `Err(Error::DocumentMissingInProof)` when the requested object was not found in the proof. + /// * `Err(Error)` when either the provided data is invalid or proof validation failed. + fn from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Self, ResponseMetadata), Error> + where + Self: Sized + 'a, + { + let (main_item, response_metadata, _) = Self::maybe_from_proof_with_metadata( + request, + response, + network, + platform_version, + provider, + )?; + Ok((main_item.ok_or(Error::NotFound)?, response_metadata)) + } + + /// Retrieve the requested object from the proof with metadata. + /// + /// Runs full verification of the proof and retrieves enclosed objects. + /// + /// This method uses [`FromProof::maybe_from_proof_with_metadata()`] internally and throws an error + /// if the requested object does not exist in the proof. + /// + /// # Arguments + /// + /// * `request`: The request sent to the server. + /// * `response`: The response received from the server. + /// * `network`: The network we are using, Mainnet/Testnet/Devnet or Regtest + /// * `platform_version`: The platform version that should be used. + /// * `provider`: A callback implementing [ContextProvider] that provides quorum details required to verify the proof. + /// + /// # Returns + /// + /// * `Ok(Some(object, metadata, proof))` when the requested object was found in the proof. + /// * `Err(Error::DocumentMissingInProof)` when the requested object was not found in the proof. + /// * `Err(Error)` when either the provided data is invalid or proof validation failed. + fn from_proof_with_metadata_and_proof<'a, I: Into, O: Into>( + request: I, + response: O, + network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Self, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let (main_item, response_metadata, proof) = Self::maybe_from_proof_with_metadata( + request, + response, + network, + platform_version, + provider, + )?; + Ok((main_item.ok_or(Error::NotFound)?, response_metadata, proof)) + } } impl FromProof for Identity { type Request = platform::GetIdentityRequest; type Response = platform::GetIdentityResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Identity: Sized + 'a, { @@ -130,7 +263,6 @@ impl FromProof for Identity { // Parse response to read proof and metadata let proof = response.proof().or(Err(Error::NoProofInResult))?; - let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; let id = match request.version.ok_or(Error::EmptyVersion)? { @@ -146,7 +278,7 @@ impl FromProof for Identity { &proof.grovedb_proof, false, id.into_buffer(), - &PLATFORM_VERSION, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -154,7 +286,7 @@ impl FromProof for Identity { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok(maybe_identity) + Ok((maybe_identity, mtd.clone(), proof.clone())) } } @@ -163,13 +295,13 @@ impl FromProof for Identity { type Request = platform::GetIdentityByPublicKeyHashRequest; type Response = platform::GetIdentityByPublicKeyHashResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Identity: 'a, { @@ -196,7 +328,7 @@ impl FromProof for Identity { let (root_hash, maybe_identity) = Drive::verify_full_identity_by_public_key_hash( &proof.grovedb_proof, public_key_hash, - &PLATFORM_VERSION, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -204,7 +336,7 @@ impl FromProof for Identity { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok(maybe_identity) + Ok((maybe_identity, mtd.clone(), proof.clone())) } } @@ -212,13 +344,13 @@ impl FromProof for IdentityPublicKeys { type Request = platform::GetIdentityKeysRequest; type Response = platform::GetIdentityKeysResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where IdentityPublicKeys: 'a, { @@ -281,7 +413,9 @@ impl FromProof for IdentityPublicKeys { &proof.grovedb_proof, key_request, false, - &PLATFORM_VERSION, + false, + false, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -313,18 +447,18 @@ impl FromProof for IdentityPublicKeys { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok(maybe_keys) + Ok((maybe_keys, mtd.clone(), proof.clone())) } } fn parse_key_request_type(request: &Option) -> Result { let key_request_type = request .to_owned() - .ok_or(Error::RequestDecodeError { + .ok_or(Error::RequestError { error: "missing key request type".to_string(), })? .request - .ok_or(Error::RequestDecodeError { + .ok_or(Error::RequestError { error: "empty request field in key request type".to_string(), })?; @@ -338,18 +472,18 @@ fn parse_key_request_type(request: &Option) -> Result { + .map(|(level, &kind)| { + let kt = match GrpcKeyKind::try_from(kind) { + Ok(GrpcKeyKind::CurrentKeyOfKindRequest) => { Ok(KeyKindRequestType::CurrentKeyOfKindRequest) } - Some(GrpcKeyKind::AllKeysOfKindRequest) => { + Ok(GrpcKeyKind::AllKeysOfKindRequest) => { Ok(KeyKindRequestType::AllKeysOfKindRequest) } - None => Err(Error::RequestDecodeError { - error: format!("missing requested key type: {}", *kind), + _ => Err(Error::RequestError { + error: format!("missing requested key type: {}", kind), }), }; match kt { @@ -373,17 +507,127 @@ fn parse_key_request_type(request: &Option) -> Result for IdentityNonceFetcher { + type Request = platform::GetIdentityNonceRequest; + type Response = platform::GetIdentityNonceResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + IdentityNonceFetcher: 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let identity_id = match request.version.ok_or(Error::EmptyVersion)? { + get_identity_nonce_request::Version::V0(v0) => { + Ok::( + Identifier::from_bytes(&v0.identity_id).map_err(|e| Error::ProtocolError { + error: e.to_string(), + })?, + ) + } + }?; + + // Extract content from proof and verify Drive/GroveDB proofs + let (root_hash, maybe_nonce) = Drive::verify_identity_nonce( + &proof.grovedb_proof, + identity_id.into_buffer(), + false, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + Ok(( + maybe_nonce.map(types::IdentityNonceFetcher), + mtd.clone(), + proof.clone(), + )) + } +} + +impl FromProof for IdentityContractNonceFetcher { + type Request = platform::GetIdentityContractNonceRequest; + type Response = platform::GetIdentityContractNonceResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + IdentityContractNonceFetcher: 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (identity_id, contract_id) = match request.version.ok_or(Error::EmptyVersion)? { + get_identity_contract_nonce_request::Version::V0(v0) => { + Ok::<(dpp::identifier::Identifier, dpp::identifier::Identifier), Error>(( + Identifier::from_bytes(&v0.identity_id).map_err(|e| Error::ProtocolError { + error: e.to_string(), + })?, + Identifier::from_bytes(&v0.contract_id).map_err(|e| Error::ProtocolError { + error: e.to_string(), + })?, + )) + } + }?; + + // Extract content from proof and verify Drive/GroveDB proofs + let (root_hash, maybe_identity) = Drive::verify_identity_contract_nonce( + &proof.grovedb_proof, + identity_id.into_buffer(), + contract_id.into_buffer(), + false, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + Ok(( + maybe_identity.map(types::IdentityContractNonceFetcher), + mtd.clone(), + proof.clone(), + )) + } +} + impl FromProof for IdentityBalance { type Request = platform::GetIdentityBalanceRequest; type Response = platform::GetIdentityBalanceResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where IdentityBalance: 'a, { @@ -407,7 +651,7 @@ impl FromProof for IdentityBalance { &proof.grovedb_proof, id.into_buffer(), false, - &PLATFORM_VERSION, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -415,7 +659,7 @@ impl FromProof for IdentityBalance { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok(maybe_identity) + Ok((maybe_identity, mtd.clone(), proof.clone())) } } @@ -423,13 +667,13 @@ impl FromProof for IdentityBalan type Request = platform::GetIdentityBalanceAndRevisionRequest; type Response = platform::GetIdentityBalanceAndRevisionResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, - _platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where IdentityBalanceAndRevision: 'a, { @@ -455,6 +699,7 @@ impl FromProof for IdentityBalan &proof.grovedb_proof, id.into_buffer(), false, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -462,7 +707,7 @@ impl FromProof for IdentityBalan verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok(maybe_identity) + Ok((maybe_identity, mtd.clone(), proof.clone())) } } @@ -470,13 +715,13 @@ impl FromProof for DataContract { type Request = platform::GetDataContractRequest; type Response = platform::GetDataContractResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where DataContract: 'a, { @@ -503,7 +748,7 @@ impl FromProof for DataContract { false, false, id.into_buffer(), - &PLATFORM_VERSION, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -511,7 +756,7 @@ impl FromProof for DataContract { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok(maybe_contract) + Ok((maybe_contract, mtd.clone(), proof.clone())) } } @@ -519,13 +764,13 @@ impl FromProof for DataContracts { type Request = platform::GetDataContractsRequest; type Response = platform::GetDataContractsResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where DataContracts: 'a, { @@ -544,11 +789,9 @@ impl FromProof for DataContracts { let ids = ids .iter() .map(|id| { - id.clone() - .try_into() - .map_err(|_e| Error::RequestDecodeError { - error: format!("wrong id size: expected: {}, got: {}", 32, id.len()), - }) + id.clone().try_into().map_err(|_e| Error::RequestError { + error: format!("wrong id size: expected: {}, got: {}", 32, id.len()), + }) }) .collect::, Error>>()?; @@ -557,7 +800,7 @@ impl FromProof for DataContracts { &proof.grovedb_proof, false, ids.as_slice(), - &PLATFORM_VERSION, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -584,7 +827,7 @@ impl FromProof for DataContracts { None }; - Ok(maybe_contracts) + Ok((maybe_contracts, mtd.clone(), proof.clone())) } } @@ -592,13 +835,13 @@ impl FromProof for DataContractHistory type Request = platform::GetDataContractHistoryRequest; type Response = platform::GetDataContractHistoryResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Self: Sized + 'a, { @@ -629,7 +872,7 @@ impl FromProof for DataContractHistory start_at_ms, limit, offset, - &PLATFORM_VERSION, + platform_version, ) .map_err(|e| Error::DriveError { error: e.to_string(), @@ -637,7 +880,64 @@ impl FromProof for DataContractHistory verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok(maybe_history) + Ok((maybe_history, mtd.clone(), proof.clone())) + } +} + +impl FromProof for StateTransitionProofResult { + type Request = platform::BroadcastStateTransitionRequest; + type Response = platform::WaitForStateTransitionResultResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + + let state_transition = StateTransition::deserialize_from_bytes(&request.state_transition) + .map_err(|e| Error::ProtocolError { + error: e.to_string(), + })?; + + let metadata = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + if metadata.epoch > MAX_EPOCH as u32 { + return Err(drive::error::Error::Proof(ProofError::InvalidMetadata(format!("platform returned an epoch {} that was higher that maximum of a 16 bit integer", metadata.epoch))).into()); + } + + let block_info = BlockInfo { + time_ms: metadata.time_ms, + height: metadata.height, + core_height: metadata.core_chain_locked_height, + epoch: (metadata.epoch as u16).try_into()?, + }; + + let contracts_provider_fn = provider.as_contract_lookup_fn(); + + let (root_hash, result) = Drive::verify_state_transition_was_executed_with_proof( + &state_transition, + &block_info, + &proof.grovedb_proof, + &contracts_provider_fn, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, metadata, &root_hash, provider)?; + + Ok((Some(result), metadata.clone(), proof.clone())) } } @@ -645,28 +945,34 @@ impl FromProof for ExtendedEpochInfo { type Request = platform::GetEpochsInfoRequest; type Response = platform::GetEpochsInfoResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + network: Network, platform_version: &PlatformVersion, - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Self: Sized + 'a, { - let epochs = - ExtendedEpochInfos::maybe_from_proof(request, response, platform_version, provider)?; + let epochs = ExtendedEpochInfos::maybe_from_proof_with_metadata( + request, + response, + network, + platform_version, + provider, + )?; - if let Some(mut e) = epochs { + if let Some(mut e) = epochs.0 { if e.len() != 1 { - return Err(Error::RequestDecodeError { + return Err(Error::RequestError { error: format!("expected 1 epoch, got {}", e.len()), }); } let epoch = e.pop_first().and_then(|v| v.1); - Ok(epoch) + Ok((epoch, epochs.1, epochs.2)) } else { - Ok(None) + Ok((None, epochs.1, epochs.2)) } } } @@ -675,12 +981,13 @@ impl FromProof for ExtendedEpochInfos { type Request = platform::GetEpochsInfoRequest; type Response = platform::GetEpochsInfoResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Self: Sized + 'a, { @@ -729,19 +1036,13 @@ impl FromProof for ExtendedEpochInfos { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - let maybe_epoch_info = if epoch_info.count_some() > 0 { - Some(epoch_info) - } else { - None - }; - - Ok(maybe_epoch_info) + Ok((epoch_info.into_option(), mtd.clone(), proof.clone())) } } fn try_u32_to_u16(i: u32) -> Result { i.try_into() - .map_err(|e: TryFromIntError| Error::RequestDecodeError { + .map_err(|e: TryFromIntError| Error::RequestError { error: e.to_string(), }) } @@ -750,12 +1051,13 @@ impl FromProof for ProtocolVersionUpgrade type Request = GetProtocolVersionUpgradeStateRequest; type Response = GetProtocolVersionUpgradeStateResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( _request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Self: Sized + 'a, { @@ -764,18 +1066,15 @@ impl FromProof for ProtocolVersionUpgrade let proof = response.proof().or(Err(Error::NoProofInResult))?; let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; - let (root_hash, object) = + let (root_hash, objects) = Drive::verify_upgrade_state(&proof.grovedb_proof, platform_version)?; verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - if object.is_empty() { - return Ok(None); - } + // Convert objects to a map of Option values + let response: Self = objects.into_iter().map(|(k, v)| (k, Some(v))).collect(); - Ok(Some( - object.into_iter().map(|(k, v)| (k, Some(v))).collect(), - )) + Ok((response.into_option(), mtd.clone(), proof.clone())) } } @@ -783,12 +1082,13 @@ impl FromProof for MasternodeProtoco type Request = GetProtocolVersionUpgradeVoteStatusRequest; type Response = GetProtocolVersionUpgradeVoteStatusResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where Self: Sized + 'a, { @@ -808,7 +1108,7 @@ impl FromProof for MasternodeProtoco None } else { Some(request_v0.start_pro_tx_hash[..].try_into().map_err( - |e: TryFromSliceError| Error::RequestDecodeError { + |e: TryFromSliceError| Error::RequestError { error: e.to_string(), }, )?) @@ -824,7 +1124,7 @@ impl FromProof for MasternodeProtoco verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; if objects.is_empty() { - return Ok(None); + return Ok((None, mtd.clone(), proof.clone())); } let votes: MasternodeProtocolVotes = objects .into_iter() @@ -845,47 +1145,84 @@ impl FromProof for MasternodeProtoco }) .collect::>()?; - Ok(Some(votes)) + Ok((votes.into_option(), mtd.clone(), proof.clone())) } } -// #[cfg_attr(feature = "mocks", mockall::automock)] -impl<'dq, Q> FromProof for Documents -where - Q: TryInto> + Clone + 'dq, - Q::Error: std::fmt::Display, -{ - type Request = Q; - type Response = platform::GetDocumentsResponse; +impl FromProof for Elements { + type Request = GetPathElementsRequest; + type Response = GetPathElementsResponse; - fn maybe_from_proof<'a, I: Into, O: Into>( + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, response: O, + _network: Network, platform_version: &PlatformVersion, - - provider: &'a dyn QuorumInfoProvider, - ) -> Result, Error> + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> where - Self: 'a, + Self: Sized + 'a, { - let request: Self::Request = request.into(); + let request = request.into(); let response: Self::Response = response.into(); - - let request: DriveQuery<'dq> = - request - .clone() - .try_into() - .map_err(|e: Q::Error| Error::RequestDecodeError { - error: e.to_string(), - })?; - // Parse response to read proof and metadata let proof = response.proof().or(Err(Error::NoProofInResult))?; - let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; - let (root_hash, documents) = request - .verify_proof(&proof.grovedb_proof, &PLATFORM_VERSION) + let request_v0: GetPathElementsRequestV0 = match request.version { + Some(get_path_elements_request::Version::V0(v0)) => v0, + None => return Err(Error::EmptyVersion), + }; + + let path = request_v0.path; + let keys = request_v0.keys; + + let (root_hash, objects) = + Drive::verify_elements(&proof.grovedb_proof, path, keys, platform_version)?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + Ok((objects.into_option(), mtd.clone(), proof.clone())) + } +} + +// #[cfg_attr(feature = "mocks", mockall::automock)] +impl<'dq, Q> FromProof for Documents +where + Q: TryInto> + Clone + 'dq, + Q::Error: std::fmt::Display, +{ + type Request = Q; + type Response = platform::GetDocumentsResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + let request: DriveDocumentQuery<'dq> = + request + .clone() + .try_into() + .map_err(|e: Q::Error| Error::RequestError { + error: e.to_string(), + })?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, documents) = request + .verify_proof(&proof.grovedb_proof, platform_version) .map_err(|e| Error::DriveError { error: e.to_string(), })?; @@ -896,11 +1233,462 @@ where verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - if documents.is_empty() { - Ok(None) - } else { - Ok(Some(documents)) + Ok((documents.into_option(), mtd.clone(), proof.clone())) + } +} + +impl FromProof for IdentitiesContractKeys { + type Request = platform::GetIdentitiesContractKeysRequest; + type Response = platform::GetIdentitiesContractKeysResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (identities_ids, contract_id, document_type_name, purposes) = + match request.version.ok_or(Error::EmptyVersion)? { + get_identities_contract_keys_request::Version::V0(v0) => { + let GetIdentitiesContractKeysRequestV0 { + identities_ids, + contract_id, + document_type_name, + purposes, + .. + } = v0; + let identifiers = identities_ids + .into_iter() + .map(|identity_id_vec| { + let identifier = Identifier::from_vec(identity_id_vec)?; + Ok(identifier.to_buffer()) + }) + .collect::, platform_value::Error>>() + .map_err(|e| Error::ProtocolError { + error: e.to_string(), + })?; + let contract_id = Identifier::from_vec(contract_id) + .map_err(|e| Error::ProtocolError { + error: e.to_string(), + })? + .into_buffer(); + let purposes = purposes + .into_iter() + .map(|purpose| { + Purpose::try_from(purpose).map_err(|e| Error::ProtocolError { + error: e.to_string(), + }) + }) + .collect::, Error>>()?; + (identifiers, contract_id, document_type_name, purposes) + } + }; + + // Extract content from proof and verify Drive/GroveDB proofs + let (root_hash, identities_contract_keys) = Drive::verify_identities_contract_keys( + &proof.grovedb_proof, + identities_ids.as_slice(), + &contract_id, + document_type_name, + purposes, + false, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + if identities_contract_keys.is_empty() { + return Ok((None, mtd.clone(), proof.clone())); } + + Ok((Some(identities_contract_keys), mtd.clone(), proof.clone())) + } +} + +impl FromProof for ContestedResources { + type Request = platform::GetContestedResourcesRequest; + type Response = platform::GetContestedResourcesResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = VotePollsByDocumentTypeQuery::try_from_request(request)?; + let resolved_request = + drive_query.resolve_with_known_contracts_provider(&provider.as_contract_lookup_fn())?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, items) = resolved_request + .verify_contests_proof(&proof.grovedb_proof, platform_version) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let resources: ContestedResources = + items.into_iter().map(ContestedResource::Value).collect(); + + Ok((resources.into_option(), mtd.clone(), proof.clone())) + } +} + +// rpc getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse); +impl FromProof for Contenders { + type Request = platform::GetContestedResourceVoteStateRequest; + type Response = platform::GetContestedResourceVoteStateResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = ContestedDocumentVotePollDriveQuery::try_from_request(request)?; + + // Resolve request to get verify_*_proof + let contracts_provider = provider.as_contract_lookup_fn(); + let resolved_request = + drive_query.resolve_with_known_contracts_provider(&contracts_provider)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, contested_resource_vote_state) = resolved_request + .verify_vote_poll_vote_state_proof(&proof.grovedb_proof, platform_version) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let contenders = contested_resource_vote_state + .contenders + .into_iter() + .map(|v| (v.identity_id(), v)) + .collect(); + + let response = Contenders { + contenders, + abstain_vote_tally: contested_resource_vote_state.abstaining_vote_tally, + lock_vote_tally: contested_resource_vote_state.locked_vote_tally, + }; + Ok((response.into_option(), mtd.clone(), proof.clone())) + } +} + +impl FromProof for Voters { + type Request = GetContestedResourceVotersForIdentityRequest; + type Response = GetContestedResourceVotersForIdentityResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = ContestedDocumentVotePollVotesDriveQuery::try_from_request(request)?; + + // Parse request to get resolved contract that implements verify_*_proof + let contracts_provider = provider.as_contract_lookup_fn(); + + let resolved_request = + drive_query.resolve_with_known_contracts_provider(&contracts_provider)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, voters) = resolved_request + .verify_vote_poll_votes_proof(&proof.grovedb_proof, platform_version) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + if voters.is_empty() { + return Ok((None, mtd.clone(), proof.clone())); + } + let result: Voters = voters.into_iter().map(Voter::from).collect(); + + Ok((result.into_option(), mtd.clone(), proof.clone())) + } +} + +impl FromProof for ResourceVotesByIdentity { + type Request = platform::GetContestedResourceIdentityVotesRequest; + type Response = platform::GetContestedResourceIdentityVotesResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = ContestedResourceVotesGivenByIdentityQuery::try_from_request(request)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let contract_provider_fn = provider.as_contract_lookup_fn(); + let (root_hash, voters) = drive_query + .verify_identity_votes_given_proof::>( + &proof.grovedb_proof, + &contract_provider_fn, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let response: ResourceVotesByIdentity = voters + .into_iter() + .map(|(id, vote)| (id, Some(vote))) + .collect(); + + Ok((response.into_option(), mtd.clone(), proof.clone())) + } +} + +impl FromProof for VotePollsGroupedByTimestamp { + type Request = platform::GetVotePollsByEndDateRequest; + type Response = platform::GetVotePollsByEndDateResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = VotePollsByEndDateDriveQuery::try_from_request(request)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, vote_polls) = drive_query + .verify_vote_polls_by_end_date_proof::>( + &proof.grovedb_proof, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let response = VotePollsGroupedByTimestamp(vote_polls).sorted(drive_query.order_ascending); + + Ok((response.into_option(), mtd.clone(), proof.clone())) + } +} + +impl FromProof for PrefundedSpecializedBalance { + type Request = platform::GetPrefundedSpecializedBalanceRequest; + type Response = platform::GetPrefundedSpecializedBalanceResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + _network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + let balance_id = match request.version.ok_or(Error::EmptyVersion)? { + get_prefunded_specialized_balance_request::Version::V0(v0) => { + Identifier::from_vec(v0.id).map_err(|e| Error::RequestError { + error: e.to_string(), + })? + } + }; + + let proof = response.proof().or(Err(Error::NoProofInResult))?; + + let (root_hash, balance) = Drive::verify_specialized_balance( + &proof.grovedb_proof, + balance_id.into_buffer(), + false, + platform_version, + )?; + + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + Ok((balance.map(|v| v.into()), mtd.clone(), proof.clone())) + } +} + +impl FromProof for Vote { + type Request = platform::GetContestedResourceIdentityVotesRequest; + type Response = platform::GetContestedResourceIdentityVotesResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let request = request.into(); + let id_in_request = match request.version.as_ref().ok_or(Error::EmptyVersion)? { + get_contested_resource_identity_votes_request::Version::V0(v0) => { + Identifier::from_bytes(&v0.identity_id).map_err(|e| Error::RequestError { + error: e.to_string(), + })? + } + }; + + let (mut maybe_votes, mtd, proof) = + ResourceVotesByIdentity::maybe_from_proof_with_metadata( + request, + response, + network, + platform_version, + provider, + )?; + + let (id, vote) = match maybe_votes.as_mut() { + Some(v) if v.len() > 1 => { + return Err(Error::ResponseDecodeError { + error: format!("expected 1 vote, got {}", v.len()), + }) + } + Some(v) if v.is_empty() => return Ok((None, mtd, proof)), + Some(v) => v.pop_first().expect("is_empty() must detect empty map"), + None => return Ok((None, mtd, proof)), + }; + + if id != id_in_request { + return Err(Error::ResponseDecodeError { + error: format!( + "expected vote for identity {}, got vote for identity {}", + id_in_request, id + ), + }); + } + + Ok((vote.map(Vote::ResourceVote), mtd, proof)) + } +} + +impl FromProof for TotalCreditsInPlatform { + type Request = platform::GetTotalCreditsInPlatformRequest; + type Response = platform::GetTotalCreditsInPlatformResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + _request: I, + response: O, + network: Network, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata, Proof), Error> + where + Self: Sized + 'a, + { + let response: Self::Response = response.into(); + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let core_subsidy_halving_interval = network.core_subsidy_halving_interval(); + + let (root_hash, credits) = Drive::verify_total_credits_in_system( + &proof.grovedb_proof, + core_subsidy_halving_interval, + || { + provider.get_platform_activation_height().map_err(|e| { + drive::error::Error::Proof(ProofError::MissingContextRequirement(e.to_string())) + }) + }, + mtd.core_chain_locked_height, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + Ok(( + Some(TotalCreditsInPlatform(credits)), + mtd.clone(), + proof.clone(), + )) } } @@ -908,11 +1696,11 @@ where /// Errors when value is out of range. fn u32_to_u16_opt(i: u32) -> Result, Error> { let i: Option = if i != 0 { - let i: u16 = - i.try_into() - .map_err(|e: std::num::TryFromIntError| Error::RequestDecodeError { - error: format!("value {} out of range: {}", i, e), - })?; + let i: u16 = i + .try_into() + .map_err(|e: std::num::TryFromIntError| Error::RequestError { + error: format!("value {} out of range: {}", i, e), + })?; Some(i) } else { None @@ -950,7 +1738,7 @@ impl Length for Vec<(K, Option)> { impl Length for BTreeMap> { fn count_some(&self) -> usize { - self.iter().filter(|(_, v)| v.is_some()).count() + self.values().filter(|v| v.is_some()).count() } } @@ -976,10 +1764,38 @@ macro_rules! define_length { define_length!(DataContract); define_length!(DataContractHistory, |d: &DataContractHistory| d.len()); -// define_length!(DataContracts, |d: &DataContracts| d.count_some()); define_length!(Document); -// define_length!(Documents, |x: &Documents| x.len()); define_length!(Identity); define_length!(IdentityBalance); define_length!(IdentityBalanceAndRevision); -// define_length!(IdentityPublicKeys, |d: &IdentityPublicKeys| d.count_some()); +define_length!(IdentitiesContractKeys, |x: &IdentitiesContractKeys| x + .values() + .map(|v| v.count_some()) + .sum()); +define_length!(ContestedResources, |x: &ContestedResources| x.0.len()); +define_length!(Contenders, |x: &Contenders| x.contenders.len()); +define_length!(Voters, |x: &Voters| x.0.len()); +define_length!( + VotePollsGroupedByTimestamp, + |x: &VotePollsGroupedByTimestamp| x.0.iter().map(|v| v.1.len()).sum() +); +trait IntoOption +where + Self: Sized, +{ + /// For zero-length data structures, return None, otherwise return Some(self) + fn into_option(self) -> Option; +} + +impl IntoOption for L { + fn into_option(self) -> Option + where + Self: Sized, + { + if self.count_some() == 0 { + None + } else { + Some(self) + } + } +} diff --git a/packages/rs-drive-proof-verifier/src/provider.rs b/packages/rs-drive-proof-verifier/src/provider.rs index 259b01e54e2..ecead859946 100644 --- a/packages/rs-drive-proof-verifier/src/provider.rs +++ b/packages/rs-drive-proof-verifier/src/provider.rs @@ -1,13 +1,22 @@ +use crate::error::ContextProviderError; +use dpp::prelude::{CoreBlockHeight, DataContract, Identifier}; +use drive::{error::proof::ProofError, query::ContractLookupFn}; +#[cfg(feature = "mocks")] use hex::ToHex; +use std::{io::ErrorKind, ops::Deref, sync::Arc}; -/// `QuorumInfoProvider` trait provides an interface to fetch quorum related information, required to verify the proof. +/// Interface between the Sdk and state of the application. +/// +/// ContextProvider is called by the [FromProof](crate::FromProof) trait (and similar) to get information about +/// the application and/or network state, including data contracts that might be cached by the application or +/// quorum public keys. /// -/// Developers should implement this trait to provide required quorum details to [FromProof](crate::FromProof) -/// implementations. +/// Developers using the Dash Platform SDK should implement this trait to provide required information +/// to the Sdk, especially implementation of [FromProof](crate::FromProof) trait. /// -/// It defines a single method [`get_quorum_public_key()`](QuorumInfoProvider::get_quorum_public_key()) -/// which retrieves the public key of a given quorum. -pub trait QuorumInfoProvider: Send + Sync { +/// A ContextProvider should be thread-safe and manage timeouts and other concurrency-related issues internally, +/// as the [FromProof](crate::FromProof) implementations can block on ContextProvider calls. +pub trait ContextProvider: Send + Sync { /// Fetches the public key for a specified quorum. /// /// # Arguments @@ -25,24 +34,122 @@ pub trait QuorumInfoProvider: Send + Sync { quorum_type: u32, quorum_hash: [u8; 32], // quorum hash is 32 bytes core_chain_locked_height: u32, - ) -> Result<[u8; 48], crate::Error>; // public key is 48 bytes + ) -> Result<[u8; 48], ContextProviderError>; // public key is 48 bytes + + /// Fetches the data contract for a specified data contract ID. + /// This method is used by [FromProof](crate::FromProof) implementations to fetch data contracts + /// referenced in proofs. + /// + /// # Arguments + /// + /// * `data_contract_id`: The ID of the data contract to fetch. + /// + /// # Returns + /// + /// * `Ok(Option>)`: On success, returns the data contract if it exists, or `None` if it does not. + /// We use Arc to avoid copying the data contract. + /// * `Err(Error)`: On failure, returns an error indicating why the operation failed. + fn get_data_contract( + &self, + id: &Identifier, + ) -> Result>, ContextProviderError>; + + /// Gets the platform activation height from core. Once this has happened this can be hardcoded. + /// + /// # Returns + /// + /// * `Ok(CoreBlockHeight)`: On success, returns the platform activation height as defined by mn_rr + /// * `Err(Error)`: On failure, returns an error indicating why the operation failed. + fn get_platform_activation_height(&self) -> Result; +} + +impl + Send + Sync> ContextProvider for C { + fn get_quorum_public_key( + &self, + quorum_type: u32, + quorum_hash: [u8; 32], + core_chain_locked_height: u32, + ) -> Result<[u8; 48], ContextProviderError> { + self.as_ref() + .get_quorum_public_key(quorum_type, quorum_hash, core_chain_locked_height) + } + + fn get_data_contract( + &self, + id: &Identifier, + ) -> Result>, ContextProviderError> { + self.as_ref().get_data_contract(id) + } + + fn get_platform_activation_height(&self) -> Result { + self.as_ref().get_platform_activation_height() + } +} + +impl<'a, T: ContextProvider + 'a> ContextProvider for std::sync::Mutex +where + Self: Sync + Send, +{ + fn get_data_contract( + &self, + id: &Identifier, + ) -> Result>, ContextProviderError> { + let lock = self.lock().expect("lock poisoned"); + lock.get_data_contract(id) + } + fn get_quorum_public_key( + &self, + quorum_type: u32, + quorum_hash: [u8; 32], // quorum hash is 32 bytes + core_chain_locked_height: u32, + ) -> Result<[u8; 48], ContextProviderError> { + let lock = self.lock().expect("lock poisoned"); + lock.get_quorum_public_key(quorum_type, quorum_hash, core_chain_locked_height) + } + + fn get_platform_activation_height(&self) -> Result { + let lock = self.lock().expect("lock poisoned"); + lock.get_platform_activation_height() + } +} + +/// A trait that provides a function that can be used to look up a [DataContract] by its [Identifier]. +/// +/// This trait is automatically implemented for any type that implements [ContextProvider]. +/// It is used internally by the Drive proof verification functions to look up data contracts. +pub trait DataContractProvider: Send + Sync { + /// Returns [ContractLookupFn] function that can be used to look up a [DataContract] by its [Identifier]. + fn as_contract_lookup_fn(&self) -> Box; +} +impl DataContractProvider for C { + /// Returns function that uses [ContextProvider] to provide a [DataContract] to Drive proof verification functions + fn as_contract_lookup_fn(&self) -> Box { + let f = |id: &Identifier| -> Result>, drive::error::Error> { + self.get_data_contract(id).map_err(|e| { + drive::error::Error::Proof(ProofError::ErrorRetrievingContract(e.to_string())) + }) + }; + + Box::new(f) + } } -/// Mock QuorumInfoProvider that can read quorum keys from files. +/// Mock ContextProvider that can read quorum keys from files. /// -/// Use `rs_sdk::SdkBuilder::with_dump_dir()` to generate quorum keys files. +/// Use [dash_sdk::SdkBuilder::with_dump_dir()] to generate quorum keys files. #[cfg(feature = "mocks")] -pub struct MockQuorumInfoProvider { +#[derive(Debug)] +pub struct MockContextProvider { quorum_keys_dir: Option, } #[cfg(feature = "mocks")] -impl MockQuorumInfoProvider { - /// Create a new instance of [MockQuorumInfoProvider]. +impl MockContextProvider { + /// Create a new instance of [MockContextProvider]. /// /// This instance can be used to read quorum keys from files. /// You need to configure quorum keys dir using - /// [MockQuorumInfoProvider::quorum_keys_dir()](MockQuorumInfoProvider::quorum_keys_dir()) + /// [MockContextProvider::quorum_keys_dir()](MockContextProvider::quorum_keys_dir()) /// before using this instance. /// /// In future, we may add more methods to this struct to allow setting expectations. @@ -54,36 +161,33 @@ impl MockQuorumInfoProvider { /// Set the directory where quorum keys are stored. /// - /// This directory should contain quorum keys files generated using `rs_sdk::SdkBuilder::with_dump_dir()`. + /// This directory should contain quorum keys files generated using [dash_sdk::SdkBuilder::with_dump_dir()]. pub fn quorum_keys_dir(&mut self, quorum_keys_dir: Option) { self.quorum_keys_dir = quorum_keys_dir; } } -impl Default for MockQuorumInfoProvider { +#[cfg(feature = "mocks")] +impl Default for MockContextProvider { fn default() -> Self { Self::new() } } #[cfg(feature = "mocks")] -impl QuorumInfoProvider for MockQuorumInfoProvider { - /// Mock implementation of [QuorumInfoProvider] that returns keys from files saved on disk. +impl ContextProvider for MockContextProvider { + /// Mock implementation of [ContextProvider] that returns keys from files saved on disk. /// - /// Use `rs_sdk::SdkBuilder::with_dump_dir()` to generate quorum keys files. + /// Use [dash_sdk::SdkBuilder::with_dump_dir()] to generate quorum keys files. fn get_quorum_public_key( &self, quorum_type: u32, quorum_hash: [u8; 32], _core_chain_locked_height: u32, - ) -> Result<[u8; 48], crate::Error> { + ) -> Result<[u8; 48], ContextProviderError> { let path = match &self.quorum_keys_dir { Some(p) => p, - None => { - return Err(crate::Error::InvalidQuorum { - error: "dump dir not set".to_string(), - }) - } + None => return Err(ContextProviderError::Config("dump dir not set".to_string())), }; let file = path.join(format!( @@ -95,18 +199,60 @@ impl QuorumInfoProvider for MockQuorumInfoProvider { let f = match std::fs::File::open(&file) { Ok(f) => f, Err(e) => { - return Err(crate::Error::InvalidQuorum { - error: format!( - "cannot load quorum key file {}: {}", - file.to_string_lossy(), - e - ), - }) + return Err(ContextProviderError::InvalidQuorum(format!( + "cannot load quorum key file {}: {}", + file.to_string_lossy(), + e + ))) } }; - let key: Vec = serde_json::from_reader(f).expect("cannot parse quorum key"); + let data = std::io::read_to_string(f).expect("cannot read quorum key file"); + let key: Vec = hex::decode(data).expect("cannot parse quorum key"); Ok(key.try_into().expect("quorum key format mismatch")) } + + fn get_data_contract( + &self, + data_contract_id: &Identifier, + ) -> Result>, ContextProviderError> { + let path = match &self.quorum_keys_dir { + Some(p) => p, + None => return Err(ContextProviderError::Config("dump dir not set".to_string())), + }; + + let file = path.join(format!( + "data_contract-{}.json", + data_contract_id.encode_hex::() + )); + + let f = match std::fs::File::open(&file) { + Ok(f) => f, + Err(e) if e.kind() == ErrorKind::NotFound => return Ok(None), + Err(e) => { + return Err(ContextProviderError::DataContractFailure(format!( + "cannot load data contract file {}: {}", + file.to_string_lossy(), + e + ))) + } + }; + + let dc: DataContract = serde_json::from_reader(f).expect("cannot parse data contract"); + + Ok(Some(Arc::new(dc))) + } + + fn get_platform_activation_height(&self) -> Result { + Ok(1320) // This is the default activation height for a Regtest network + } +} + +// the trait `std::convert::AsRef<(dyn drive_proof_verifier::ContextProvider + 'static)>` +// is not implemented for `std::sync::Arc>` +impl<'a, T: ContextProvider + 'a> AsRef for Arc { + fn as_ref(&self) -> &(dyn ContextProvider + 'a) { + self.deref() + } } diff --git a/packages/rs-drive-proof-verifier/src/types.rs b/packages/rs-drive-proof-verifier/src/types.rs index 1aa4a744537..f417d129791 100644 --- a/packages/rs-drive-proof-verifier/src/types.rs +++ b/packages/rs-drive-proof-verifier/src/types.rs @@ -5,8 +5,17 @@ //! In this case, the [FromProof](crate::FromProof) trait is implemented for dedicated object type //! defined in this module. -use std::collections::BTreeMap; - +use dpp::data_contract::document_type::DocumentType; +use dpp::fee::Credits; +use dpp::platform_value::Value; +use dpp::prelude::{IdentityNonce, TimestampMillis}; +use dpp::version::PlatformVersion; +pub use dpp::version::ProtocolVersionVoteCount; +use dpp::voting::contender_structs::{Contender, ContenderWithSerializedDocument}; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::ResourceVote; use dpp::{ block::{epoch::EpochIndex, extended_epoch_info::ExtendedEpochInfo}, dashcore::ProTxHash, @@ -15,11 +24,22 @@ use dpp::{ prelude::{DataContract, Identifier, IdentityPublicKey, Revision}, util::deserializer::ProtocolVersion, }; +use drive::grovedb::Element; +use std::collections::{BTreeMap, BTreeSet}; + +use drive::grovedb::query_result_type::Path; +#[cfg(feature = "mocks")] +use { + bincode::{Decode, Encode}, + dpp::{dashcore::hashes::Hash, version as platform_version, ProtocolError}, + platform_serialization::{PlatformVersionEncode, PlatformVersionedDecode}, + platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}, +}; /// A data structure that holds a set of objects of a generic type `O`, indexed by a key of type `K`. /// /// This type is typically returned by functions that operate on multiple objects, such as fetching multiple objects -/// from a server using [`FetchMany`](rs_sdk::platform::FetchMany) or parsing a proof that contains multiple objects +/// from a server using [`FetchMany`](dash_sdk::platform::FetchMany) or parsing a proof that contains multiple objects /// using [`FromProof`](crate::FromProof). /// /// Each key in the `RetrievedObjects` corresponds to an object of generic type `O`. @@ -42,11 +62,343 @@ pub type DataContractHistory = BTreeMap; /// If data contract is not found, it is represented as `None`. pub type DataContracts = RetrievedObjects; +/// Multiple contenders for a vote resolution. +/// +/// Mapping between the contenders identity IDs and their info. +/// If a contender is not found, it is represented as `None`. +#[derive(Default, Debug, Clone)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize,), + platform_serialize(unversioned) +)] +pub struct Contenders { + /// Contenders indexed by their identity IDs. + pub contenders: BTreeMap, + /// Tally of abstain votes. + pub abstain_vote_tally: Option, + /// Tally of lock votes. + pub lock_vote_tally: Option, +} + +impl Contenders { + /// Return a map of deserialized [Contender] objects indexed by their identity IDs. + pub fn to_contenders( + &self, + document_type: &DocumentType, + platform_version: &PlatformVersion, + ) -> Result, crate::Error> { + self.contenders + .iter() + .map(|(id, v)| { + let contender = v.try_to_contender(document_type.as_ref(), platform_version)?; + Ok((*id, contender)) + }) + .collect::, dpp::ProtocolError>>() + .map_err(Into::into) + } +} + +/// Create Contenders from an iterator of tuples. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(Identifier, Option)> for Contenders { + fn from_iter)>>( + iter: T, + ) -> Self { + Self { + contenders: BTreeMap::from_iter( + iter.into_iter().filter_map(|(k, v)| v.map(|v| (k, v))), + ), + abstain_vote_tally: None, + lock_vote_tally: None, + } + } +} + +/// Identifier of a single voter +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, derive_more::From, Default)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize,), + platform_serialize(unversioned) +)] +pub struct Voter(pub Identifier); + +/// Multiple voters. +#[derive(Debug, Clone, derive_more::From, Default)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize,), + platform_serialize(unversioned) +)] +pub struct Voters(pub BTreeSet); + +/// Create [Voters] from an iterator of tuples. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(A, Option)> for Voters { + fn from_iter)>>(iter: T) -> Self { + Self::from_iter(iter.into_iter().filter_map(|(_, v)| v)) + } +} + +impl FromIterator for Voters { + fn from_iter>(iter: T) -> Self { + iter.into_iter().collect::>().into() + } +} + +/// Multiple grovedb elements. +/// +/// Mapping between the key id and associated elements. +/// If element is not found, it is represented as `None`. +pub type Elements = RetrievedObjects, Element>; + /// Identity balance. pub type IdentityBalance = u64; + +/// Keys in a Path +#[derive(Debug, Clone)] +pub struct KeysInPath { + /// The path of the keys + pub path: Path, + /// The keys + pub keys: Vec>, +} + +/// The total credits on Platform. +#[derive(Debug, derive_more::From, Clone, Copy)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize), + platform_serialize(unversioned) +)] +pub struct TotalCreditsInPlatform(pub Credits); + +/// A query with no parameters +#[derive(Debug, Clone, Copy)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize), + platform_serialize(unversioned) +)] +pub struct NoParamQuery; + +/// The item of an element fetch request +#[derive(Debug, derive_more::From, Clone)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize), + platform_serialize(unversioned) +)] +pub struct ElementFetchRequestItem(pub Element); + /// Identity balance and revision of the identity. pub type IdentityBalanceAndRevision = (u64, Revision); +/// Contested resource values. +#[derive(Debug, derive_more::From, Clone, PartialEq)] +pub enum ContestedResource { + /// Generic [Value] + Value(Value), +} + +impl ContestedResource { + /// Get the value. + pub fn encode_to_vec( + &self, + platform_version: &PlatformVersion, + ) -> Result, bincode::error::EncodeError> { + platform_serialization::platform_encode_to_vec( + self, + bincode::config::standard(), + platform_version, + ) + } +} + +impl TryInto for ContestedResource { + type Error = crate::Error; + + fn try_into(self) -> Result { + match self { + ContestedResource::Value(value) => Ok(value), + } + } +} + +#[cfg(feature = "mocks")] +impl PlatformVersionEncode for ContestedResource { + fn platform_encode( + &self, + encoder: &mut E, + _platform_version: &platform_version::PlatformVersion, + ) -> Result<(), bincode::error::EncodeError> { + match self { + ContestedResource::Value(value) => value.encode(encoder), + } + } +} + +#[cfg(feature = "mocks")] +impl PlatformVersionedDecode for ContestedResource { + fn platform_versioned_decode( + decoder: &mut D, + _platform_version: &platform_version::PlatformVersion, + ) -> Result { + Ok(ContestedResource::Value(Value::decode(decoder)?)) + } +} + +/// Contested resources +#[derive(derive_more::From, Clone, Debug, Default)] +pub struct ContestedResources(pub Vec); + +#[cfg(feature = "mocks")] +impl PlatformVersionEncode for ContestedResources { + fn platform_encode( + &self, + encoder: &mut E, + platform_version: &platform_version::PlatformVersion, + ) -> Result<(), bincode::error::EncodeError> { + self.0.platform_encode(encoder, platform_version) + } +} + +#[cfg(feature = "mocks")] +impl PlatformVersionedDecode for ContestedResources { + fn platform_versioned_decode( + decoder: &mut D, + platform_version: &platform_version::PlatformVersion, + ) -> Result { + let inner = >::platform_versioned_decode(decoder, platform_version)?; + Ok(Self(inner)) + } +} + +/// Create [ContestedResources] from an iterator of tuples. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(A, Option)> for ContestedResources { + fn from_iter)>>(iter: T) -> Self { + Self::from_iter(iter.into_iter().filter_map(|(_k, v)| v)) + } +} + +impl FromIterator for ContestedResources { + fn from_iter>(iter: T) -> Self { + Self(iter.into_iter().collect()) + } +} + +/// A contested vote for querying +#[derive(Debug, derive_more::From, Clone)] +#[cfg_attr( + feature = "mocks", + derive(PlatformSerialize, PlatformDeserialize, Encode, Decode), + platform_serialize(unversioned) +)] +pub struct ContestedVote(ContestedDocumentResourceVotePoll, ResourceVoteChoice); + +/// Votes casted by some identity. +pub type ResourceVotesByIdentity = RetrievedObjects; + +/// Prefunded specialized balance. +#[derive(Debug, derive_more::From, Copy, Clone)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize), + platform_serialize(unversioned) +)] +pub struct PrefundedSpecializedBalance(pub Credits); +impl PrefundedSpecializedBalance { + /// Get the balance. + pub fn to_credits(&self) -> Credits { + Credits::from(self) + } +} + +impl From<&PrefundedSpecializedBalance> for Credits { + fn from(value: &PrefundedSpecializedBalance) -> Self { + value.0 + } +} + +/// Contested document resource vote polls grouped by timestamp. +#[derive(Clone, Debug, Default, derive_more::From)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize), + platform_serialize(unversioned) +)] +pub struct VotePollsGroupedByTimestamp(pub Vec<(TimestampMillis, Vec)>); +impl VotePollsGroupedByTimestamp { + /// Sort the vote polls by timestamp. + pub fn sorted(mut self, ascending: bool) -> Self { + self.0.sort_by(|a, b| { + if ascending { + a.0.cmp(&b.0) + } else { + b.0.cmp(&a.0) + } + }); + + self + } +} + +/// Insert items into the map, appending them to the existing values for the same key. +impl FromIterator<(u64, Vec)> for VotePollsGroupedByTimestamp { + fn from_iter)>>(iter: T) -> Self { + // collect all vote polls for the same timestamp into a single vector + let data = iter + .into_iter() + .fold(BTreeMap::new(), |mut acc, (timestamp, vote_poll)| { + let entry: &mut Vec = acc.entry(timestamp).or_default(); + entry.extend(vote_poll); + acc + }); + + Self(data.into_iter().collect()) + } +} + +/// Insert items into the map, grouping them by timestamp. +impl FromIterator<(u64, VotePoll)> for VotePollsGroupedByTimestamp { + fn from_iter>(iter: T) -> Self { + Self::from_iter(iter.into_iter().map(|(k, v)| (k, vec![v]))) + } +} + +/// Create [VotePollsGroupedByTimestamp] from an iterator of tuples. +/// +/// If multiple vote polls are found for the same timestamp, they are appended to the same vector. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(u64, Option)> for VotePollsGroupedByTimestamp { + fn from_iter)>>(iter: T) -> Self { + Self::from_iter(iter.into_iter().filter_map(|(k, v)| v.map(|v| (k, v)))) + } +} + +impl IntoIterator for VotePollsGroupedByTimestamp { + type Item = (u64, Vec); + type IntoIter = std::vec::IntoIter<(u64, Vec)>; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } +} + +/// An identity nonce +#[derive(Debug)] +pub struct IdentityNonceFetcher(pub IdentityNonce); + +/// An identity contract nonce +#[derive(Debug)] +pub struct IdentityContractNonceFetcher(pub IdentityNonce); + /// Public keys belonging to some identity. /// /// Map of [key IDs](KeyID) to the [public key](IdentityPublicKey). @@ -58,12 +410,6 @@ pub type Documents = RetrievedObjects; /// Collection of epoch information pub type ExtendedEpochInfos = RetrievedObjects; -/// Number of votes for a protocol version upgrade. -/// -/// Number of votes for a protocol version upgrade, returned by [ProtocolVersionVoteCount::fetch_many()]. -/// See [ProtocolVersionUpgrades]. -pub type ProtocolVersionVoteCount = u64; - /// Results of protocol version upgrade voting. /// /// Information about the protocol version upgrade states and number of received votes, indexed by protocol version. @@ -76,8 +422,8 @@ pub type ProtocolVersionVoteCount = u64; pub type ProtocolVersionUpgrades = RetrievedObjects; /// Vote of a masternode for a protocol version. -#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] #[derive(Debug)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] pub struct MasternodeProtocolVote { /// ProTxHash of the masternode pub pro_tx_hash: ProTxHash, @@ -85,6 +431,37 @@ pub struct MasternodeProtocolVote { pub voted_version: ProtocolVersion, } +#[cfg(feature = "mocks")] +impl PlatformVersionEncode for MasternodeProtocolVote { + fn platform_encode( + &self, + encoder: &mut E, + platform_version: &platform_version::PlatformVersion, + ) -> Result<(), bincode::error::EncodeError> { + let protx_bytes: [u8; 32] = self.pro_tx_hash.to_raw_hash().to_byte_array(); + protx_bytes.platform_encode(encoder, platform_version)?; + + self.voted_version + .platform_encode(encoder, platform_version) + } +} + +#[cfg(feature = "mocks")] +impl PlatformVersionedDecode for MasternodeProtocolVote { + fn platform_versioned_decode( + decoder: &mut D, + platform_version: &PlatformVersion, + ) -> Result { + let pro_tx_hash_bytes = <[u8; 32]>::platform_versioned_decode(decoder, platform_version)?; + let pro_tx_hash = ProTxHash::from_byte_array(pro_tx_hash_bytes); + let voted_version = ProtocolVersion::platform_versioned_decode(decoder, platform_version)?; + Ok(Self { + pro_tx_hash, + voted_version, + }) + } +} + /// Information about protocol version voted by each node. /// /// Information about protocol version voted by each node, returned by [ProtocolVersion::fetch_many()]. diff --git a/packages/rs-drive-proof-verifier/src/verify.rs b/packages/rs-drive-proof-verifier/src/verify.rs index 70ea4406601..284efb5a894 100644 --- a/packages/rs-drive-proof-verifier/src/verify.rs +++ b/packages/rs-drive-proof-verifier/src/verify.rs @@ -1,14 +1,14 @@ use dapi_grpc::platform::v0::{Proof, ResponseMetadata}; use dpp::bls_signatures; -pub use drive::drive::verify::RootHash; + use tenderdash_abci::{ proto::types::{CanonicalVote, SignedMsgType, StateId}, - signatures::{SignBytes, SignDigest}, + signatures::{Hashable, Signable}, }; use crate::Error; -use crate::QuorumInfoProvider; +use crate::ContextProvider; /// Verify cryptographic proof generated by Tenderdash /// @@ -32,7 +32,7 @@ pub(crate) fn verify_tenderdash_proof( proof: &Proof, mtd: &ResponseMetadata, root_hash: &[u8], - provider: &dyn QuorumInfoProvider, + provider: &dyn ContextProvider, ) -> Result<(), Error> { let block_id_hash = proof.block_id_hash.to_vec(); @@ -41,7 +41,7 @@ pub(crate) fn verify_tenderdash_proof( let round = proof.round; let core_locked_height = mtd.core_chain_locked_height; let quorum_hash = TryInto::<[u8; 32]>::try_into(proof.quorum_hash.as_slice()).map_err(|e| { - Error::InvalidQuorum { + Error::ResponseDecodeError { error: "invalid quorum hash size: ".to_string() + &e.to_string(), } })?; @@ -61,7 +61,7 @@ pub(crate) fn verify_tenderdash_proof( }; let state_id_hash = state_id - .sha256(&chain_id, mtd.height as i64, proof.round as i32) + .calculate_msg_hash(&chain_id, mtd.height as i64, proof.round as i32) .expect("failed to calculate state id hash"); let commit = CanonicalVote { @@ -75,7 +75,7 @@ pub(crate) fn verify_tenderdash_proof( // Verify signature let sign_digest = commit - .sign_digest( + .calculate_sign_hash( &chain_id, quorum_type.try_into().expect("quorum type out of range"), &quorum_hash, @@ -109,7 +109,12 @@ pub(crate) fn verify_tenderdash_proof( match verify_signature_digest(&sign_digest, &signature, &pubkey)? { true => Ok(()), false => Err(Error::InvalidSignature { - error: "signature mismatch".to_string(), + error: format!( + "signature {} could not be verified with public key {} for sign digest {}", + hex::encode(signature), + hex::encode(pubkey_bytes), + hex::encode(sign_digest) + ), }), } } diff --git a/packages/rs-drive-verify-c-binding/Cargo.toml b/packages/rs-drive-verify-c-binding/Cargo.toml index 0d4d7371242..3a2ccf94a19 100644 --- a/packages/rs-drive-verify-c-binding/Cargo.toml +++ b/packages/rs-drive-verify-c-binding/Cargo.toml @@ -2,7 +2,7 @@ name = "rs-drive-verify-c-binding" version = "0.25.16-rc.3" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index f4acb5c3bae..7635be94c59 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "0.25.21" +version = "1.1.0-dev.1" authors = [ "Samuel Westrich ", "Ivan Shumkov ", @@ -9,49 +9,62 @@ authors = [ "Wisdom Ogwu >, + block_cache: Cache<[u8; 32], Arc>, +} + +impl DataContractCache { + /// Create a new DataContract cache instance + pub fn new(global_cache_max_capacity: u64, block_cache_max_capacity: u64) -> Self { + Self { + global_cache: Cache::new(global_cache_max_capacity), + block_cache: Cache::new(block_cache_max_capacity), + } + } + + /// Inserts DataContract to block cache + /// otherwise to goes to global cache + pub fn insert(&self, fetch_info: Arc, is_block_cache: bool) { + let data_contract_id_bytes = fetch_info.contract.id().to_buffer(); + + if is_block_cache { + self.block_cache.insert(data_contract_id_bytes, fetch_info); + } else { + self.global_cache.insert(data_contract_id_bytes, fetch_info); + } + } + + /// Tries to get a data contract from block cache if present + /// if block cache doesn't have the contract + /// then it tries get the contract from global cache + pub fn get( + &self, + contract_id: [u8; 32], + is_block_cache: bool, + ) -> Option> { + let maybe_fetch_info = if is_block_cache { + self.block_cache.get(&contract_id) + } else { + None + }; + + maybe_fetch_info.or_else(|| self.global_cache.get(&contract_id)) + } + + /// Remove contract from both block and global cache + pub fn remove(&self, contract_id: [u8; 32]) { + self.block_cache.remove(&contract_id); + self.global_cache.remove(&contract_id); + } + + /// Move block cache to global cache + pub fn merge_and_clear_block_cache(&self) { + for (contract_id, fetch_info) in self.block_cache.into_iter() { + self.global_cache + .insert(Arc::unwrap_or_clone(contract_id), fetch_info); + } + self.clear_block_cache(); + } + + /// Clear block cache + pub fn clear_block_cache(&self) { + self.block_cache.invalidate_all(); + } + + /// Clear cache + pub fn clear(&self) { + self.block_cache.invalidate_all(); + self.global_cache.invalidate_all(); + } +} + +#[cfg(test)] +mod tests { + use super::*; + + mod get { + use super::*; + use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; + use dpp::version::PlatformVersion; + + #[test] + fn test_get_from_global_cache_when_block_cache_is_not_requested() { + let data_contract_cache = DataContractCache::new(10, 10); + + let protocol_version = PlatformVersion::latest().protocol_version; + + // Create global contract + let fetch_info_global = Arc::new(DataContractFetchInfo::dpns_contract_fixture( + protocol_version, + )); + + let contract_id = fetch_info_global.contract.id().to_buffer(); + + data_contract_cache + .global_cache + .insert(contract_id, Arc::clone(&fetch_info_global)); + + // Create transactional contract with a new version + let mut fetch_info_block = + DataContractFetchInfo::dpns_contract_fixture(protocol_version); + + fetch_info_block.contract.increment_version(); + + let fetch_info_block_boxed = Arc::new(fetch_info_block); + + data_contract_cache + .block_cache + .insert(contract_id, Arc::clone(&fetch_info_block_boxed)); + + let fetch_info_from_cache = data_contract_cache + .get(contract_id, false) + .expect("should be present"); + + assert_eq!(fetch_info_from_cache, fetch_info_global) + } + + #[test] + fn test_get_from_global_cache_when_block_cache_does_not_have_contract() { + let data_contract_cache = DataContractCache::new(10, 10); + + let protocol_version = PlatformVersion::latest().protocol_version; + + let fetch_info_global = Arc::new(DataContractFetchInfo::dpns_contract_fixture( + protocol_version, + )); + + let contract_id = fetch_info_global.contract.id().to_buffer(); + + data_contract_cache + .global_cache + .insert(contract_id, Arc::clone(&fetch_info_global)); + + let fetch_info_from_cache = data_contract_cache + .get(contract_id, true) + .expect("should be present"); + + assert_eq!(fetch_info_from_cache, fetch_info_global) + } + + #[test] + fn test_get_from_block_cache() { + let data_contract_cache = DataContractCache::new(10, 10); + + let protocol_version = PlatformVersion::latest().protocol_version; + + let fetch_info_block = Arc::new(DataContractFetchInfo::dpns_contract_fixture( + protocol_version, + )); + + let contract_id = fetch_info_block.contract.id().to_buffer(); + + data_contract_cache + .block_cache + .insert(contract_id, Arc::clone(&fetch_info_block)); + + let fetch_info_from_cache = data_contract_cache + .get(contract_id, true) + .expect("should be present"); + + assert_eq!(fetch_info_from_cache, fetch_info_block) + } + } +} diff --git a/packages/rs-drive/src/cache/mod.rs b/packages/rs-drive/src/cache/mod.rs new file mode 100644 index 00000000000..936869cf045 --- /dev/null +++ b/packages/rs-drive/src/cache/mod.rs @@ -0,0 +1,23 @@ +use dpp::identity::TimestampMillis; + +mod data_contract; +mod protocol_version; +mod system_contracts; + +pub use data_contract::DataContractCache; +pub use protocol_version::ProtocolVersionsCache; +pub use system_contracts::SystemDataContracts; + +/// Drive cache struct +pub struct DriveCache { + /// Cached contracts + pub data_contracts: DataContractCache, + // TODO: We probably don't need this since we have it genesis cache in the platform + /// Genesis time in ms + pub genesis_time_ms: parking_lot::RwLock>, + // TODO: Make protocol versions cache thread-safe + /// Lazy loaded counter of votes to upgrade protocol version + pub protocol_versions_counter: parking_lot::RwLock, + /// Versioned system data contracts + pub system_data_contracts: SystemDataContracts, +} diff --git a/packages/rs-drive/src/cache/protocol_version.rs b/packages/rs-drive/src/cache/protocol_version.rs new file mode 100644 index 00000000000..7aa549c5798 --- /dev/null +++ b/packages/rs-drive/src/cache/protocol_version.rs @@ -0,0 +1,107 @@ +use crate::drive::Drive; +use crate::error::cache::CacheError; +use crate::error::Error; +use dpp::util::deserializer::ProtocolVersion; +use grovedb::TransactionArg; +use nohash_hasher::IntMap; +use platform_version::version::drive_versions::DriveVersion; + +/// ProtocolVersion cache that handles both global and block data +#[derive(Default)] +pub struct ProtocolVersionsCache { + /// The current global cache for protocol versions + // TODO: If we persist this in the state and it should be loaded for correct + // use then it's not actually the cache. Move out of cache because it's confusing + pub global_cache: IntMap, + block_cache: IntMap, + loaded: bool, + is_global_cache_blocked: bool, +} + +#[cfg(feature = "server")] +impl ProtocolVersionsCache { + /// Create a new ProtocolVersionsCache instance + pub fn new() -> Self { + Self::default() + } + + /// Load the protocol versions cache from disk if needed + pub fn load_if_needed( + &mut self, + drive: &Drive, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result<(), Error> { + if !self.loaded { + self.global_cache = drive.fetch_versions_with_counter(transaction, drive_version)?; + self.loaded = true; + }; + Ok(()) + } + + /// Sets the protocol version to the block cache + pub fn set_block_cache_version_count(&mut self, version: ProtocolVersion, count: u64) { + self.block_cache.insert(version, count); + } + + /// Tries to get a version from block cache if present + /// if block cache doesn't have the version set + /// then it tries get the version from global cache + pub fn get(&self, version: &ProtocolVersion) -> Result, Error> { + if self.is_global_cache_blocked { + return Err(Error::Cache(CacheError::GlobalCacheIsBlocked)); + } + + let counter = if let Some(count) = self.block_cache.get(version) { + Some(count) + } else { + self.global_cache.get(version) + }; + + Ok(counter) + } + + /// Disable the global cache to do not allow get counters + /// If global cache is blocked then [get] will return an error + pub fn block_global_cache(&mut self) { + self.is_global_cache_blocked = true; + } + + /// Unblock the global cache + /// This function enables the normal behaviour of [get] function + pub fn unblock_global_cache(&mut self) { + self.is_global_cache_blocked = false; + } + + /// Merge block cache to global cache + pub fn merge_block_cache(&mut self) { + self.global_cache.extend(self.block_cache.drain()); + } + + /// Clears the global cache + pub fn clear_global_cache(&mut self) { + self.global_cache.clear(); + } + + /// Clear block cache + pub fn clear_block_cache(&mut self) { + self.block_cache.clear() + } + + /// Collect versions passing threshold + pub fn versions_passing_threshold(&self, required_upgraded_hpmns: u64) -> Vec { + let mut cache = self.global_cache.clone(); + + cache.extend(self.block_cache.iter()); + cache + .into_iter() + .filter_map(|(protocol_version, count)| { + if count >= required_upgraded_hpmns { + Some(protocol_version) + } else { + None + } + }) + .collect::>() + } +} diff --git a/packages/rs-drive/src/cache/system_contracts.rs b/packages/rs-drive/src/cache/system_contracts.rs new file mode 100644 index 00000000000..c1a2785c3c4 --- /dev/null +++ b/packages/rs-drive/src/cache/system_contracts.rs @@ -0,0 +1,64 @@ +use crate::error::Error; +use arc_swap::{ArcSwap, Guard}; +use dpp::data_contract::DataContract; +use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; +use platform_version::version::PlatformVersion; +use std::sync::Arc; + +/// System contracts +pub struct SystemDataContracts { + /// Withdrawal contract + withdrawals: ArcSwap, + /// DPNS contract + dpns: ArcSwap, + /// Dashpay contract + dashpay: ArcSwap, + /// Masternode reward shares contract + masternode_reward_shares: ArcSwap, +} + +impl SystemDataContracts { + /// load genesis system contracts + pub fn load_genesis_system_contracts( + platform_version: &PlatformVersion, + ) -> Result { + Ok(Self { + withdrawals: ArcSwap::from_pointee(load_system_data_contract( + SystemDataContract::Withdrawals, + platform_version, + )?), + dpns: ArcSwap::from_pointee(load_system_data_contract( + SystemDataContract::DPNS, + platform_version, + )?), + dashpay: ArcSwap::from_pointee(load_system_data_contract( + SystemDataContract::Dashpay, + platform_version, + )?), + masternode_reward_shares: ArcSwap::from_pointee(load_system_data_contract( + SystemDataContract::MasternodeRewards, + platform_version, + )?), + }) + } + + /// Returns withdrawals contract + pub fn load_withdrawals(&self) -> Guard> { + self.withdrawals.load() + } + + /// Returns DPNS contract + pub fn load_dpns(&self) -> Guard> { + self.dpns.load() + } + + /// Returns Dashpay contract + pub fn load_dashpay(&self) -> Guard> { + self.dashpay.load() + } + + /// Returns Masternode reward shares contract + pub fn load_masternode_reward_shares(&self) -> Guard> { + self.masternode_reward_shares.load() + } +} diff --git a/packages/rs-drive/src/common/decode.rs b/packages/rs-drive/src/common/decode.rs deleted file mode 100644 index 332764c5d59..00000000000 --- a/packages/rs-drive/src/common/decode.rs +++ /dev/null @@ -1,73 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Decoding. -//! -//! This module defines decoding functions. -//! - -use byteorder::{BigEndian, ReadBytesExt}; -use std::io; - -/// Decoding error. -#[derive(Debug, thiserror::Error)] -pub enum DecodeError { - /// Slice passed to decode_u64 is not 8 bytes long. - #[error("can't create a u64 from &[u8]: expected size 8, got {0}")] - InvalidLength(usize), - /// Unexpected IO error. - #[error("can't create a u64 from &[u8]: expected size 8, got {0}")] - ReadFailed(io::Error), -} - -/// Decodes an unsigned integer on 64 bits. -pub fn decode_u64(val: &[u8]) -> Result { - if val.len() != 8 { - return Err(DecodeError::InvalidLength(val.len())); - } - - // Flip the sign bit - // to deal with interaction between the domains - // 2's complement values have the sign bit set to 1 - // this makes them greater than the positive domain in terms of sort order - // to fix this, we just flip the sign bit - // so positive integers have the high bit and negative integers have the low bit - // the relative order of elements in each domain is still maintained, as the - // change was uniform across all elements - let mut val = val.to_vec(); - val[0] ^= 0b1000_0000; - - // Decode the integer in big endian form - // This ensures that most significant bits are compared first - // a bigger positive number would be greater than a smaller one - // and a bigger negative number would be greater than a smaller one - // maintains sort order for each domain - let mut rdr = val.as_slice(); - rdr.read_u64::().map_err(DecodeError::ReadFailed) -} diff --git a/packages/rs-drive/src/common/encode.rs b/packages/rs-drive/src/common/encode.rs deleted file mode 100644 index db5f5156f78..00000000000 --- a/packages/rs-drive/src/common/encode.rs +++ /dev/null @@ -1,179 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Encoding. -//! -//! This module defines encoding functions. -//! - -use byteorder::{BigEndian, WriteBytesExt}; - -/// Encodes an unsigned integer on 64 bits. -pub fn encode_u64(val: u64) -> Vec { - // Positive integers are represented in binary with the signed bit set to 0 - // Negative integers are represented in 2's complement form - - // Encode the integer in big endian form - // This ensures that most significant bits are compared first - // a bigger positive number would be greater than a smaller one - // and a bigger negative number would be greater than a smaller one - // maintains sort order for each domain - let mut wtr = vec![]; - wtr.write_u64::(val).unwrap(); - - // Flip the sign bit - // to deal with interaction between the domains - // 2's complement values have the sign bit set to 1 - // this makes them greater than the positive domain in terms of sort order - // to fix this, we just flip the sign bit - // so positive integers have the high bit and negative integers have the low bit - // the relative order of elements in each domain is still maintained, as the - // change was uniform across all elements - wtr[0] ^= 0b1000_0000; - - wtr -} - -/// Encodes a signed integer on 64 bits. -pub fn encode_i64(val: i64) -> Vec { - // Positive integers are represented in binary with the signed bit set to 0 - // Negative integers are represented in 2's complement form - - // Encode the integer in big endian form - // This ensures that most significant bits are compared first - // a bigger positive number would be greater than a smaller one - // and a bigger negative number would be greater than a smaller one - // maintains sort order for each domain - let mut wtr = vec![]; - wtr.write_i64::(val).unwrap(); - - // Flip the sign bit - // to deal with interaction between the domains - // 2's complement values have the sign bit set to 1 - // this makes them greater than the positive domain in terms of sort order - // to fix this, we just flip the sign bit - // so positive integers have the high bit and negative integers have the low bit - // the relative order of elements in each domain is still maintained, as the - // change was uniform across all elements - wtr[0] ^= 0b1000_0000; - - wtr -} - -/// Encodes a float. -pub fn encode_float(val: f64) -> Vec { - // Floats are represented based on the IEEE 754-2008 standard - // [sign bit] [biased exponent] [mantissa] - - // when comparing floats, the sign bit has the greatest impact - // any positive number is greater than all negative numbers - // if the numbers come from the same domain then the exponent is the next factor to consider - // the exponent gives a sense of how many digits are in the non fractional part of the number - // for example in base 10, 10 has an exponent of 1 (1.0 * 10^1) - // while 5000 (5.0 * 10^3) has an exponent of 3 - // for the positive domain, the bigger the exponent the larger the number i.e 5000 > 10 - // for the negative domain, the bigger the exponent the smaller the number i.e -10 > -5000 - // if the exponents are the same, then the mantissa is used to determine the greater number - // the inverse relationship still holds - // i.e bigger mantissa (bigger number in positive domain but smaller number in negative domain) - - // There are two things to fix to achieve total sort order - // 1. Place positive domain above negative domain (i.e flip the sign bit) - // 2. Exponent and mantissa for a smaller number like -5000 is greater than that of -10 - // so bit level comparison would say -5000 is greater than -10 - // we fix this by flipping the exponent and mantissa values, which has the effect of reversing - // the order (0000 [smallest] -> 1111 [largest]) - - // Encode in big endian form, so most significant bits are compared first - let mut wtr = vec![]; - wtr.write_f64::(val).unwrap(); - - // Check if the value is negative, if it is - // flip all the bits i.e sign, exponent and mantissa - if val < 0.0 { - wtr = wtr.iter().map(|byte| !byte).collect(); - } else { - // for positive values, just flip the sign bit - wtr[0] ^= 0b1000_0000; - } - - wtr -} - -/// Encodes an unsigned integer on 16 bits. -pub fn encode_u16(val: u16) -> Vec { - // Positive integers are represented in binary with the signed bit set to 0 - // Negative integers are represented in 2's complement form - - // Encode the integer in big endian form - // This ensures that most significant bits are compared first - // a bigger positive number would be greater than a smaller one - // and a bigger negative number would be greater than a smaller one - // maintains sort order for each domain - let mut wtr = vec![]; - wtr.write_u16::(val).unwrap(); - - // Flip the sign bit - // to deal with interaction between the domains - // 2's complement values have the sign bit set to 1 - // this makes them greater than the positive domain in terms of sort order - // to fix this, we just flip the sign bit - // so positive integers have the high bit and negative integers have the low bit - // the relative order of elements in each domain is still maintained, as the - // change was uniform across all elements - wtr[0] ^= 0b1000_0000; - - wtr -} - -/// Encodes an unsigned integer on 32 bits. -pub fn encode_u32(val: u32) -> Vec { - // Positive integers are represented in binary with the signed bit set to 0 - // Negative integers are represented in 2's complement form - - // Encode the integer in big endian form - // This ensures that most significant bits are compared first - // a bigger positive number would be greater than a smaller one - // and a bigger negative number would be greater than a smaller one - // maintains sort order for each domain - let mut wtr = vec![]; - wtr.write_u32::(val).unwrap(); - - // Flip the sign bit - // to deal with interaction between the domains - // 2's complement values have the sign bit set to 1 - // this makes them greater than the positive domain in terms of sort order - // to fix this, we just flip the sign bit - // so positive integers have the high bit and negative integers have the low bit - // the relative order of elements in each domain is still maintained, as the - // change was uniform across all elements - wtr[0] ^= 0b1000_0000; - - wtr -} diff --git a/packages/rs-drive/src/common/mod.rs b/packages/rs-drive/src/common/mod.rs deleted file mode 100644 index 3d5a7aa60a0..00000000000 --- a/packages/rs-drive/src/common/mod.rs +++ /dev/null @@ -1,146 +0,0 @@ -// MIT LICENSE -// -// Copyright (c) 2021 Dash Core Group -// -// 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: -// -// The above copyright notice and this permission notice -// shall be included in all copies or substantial portions -// of the Software. -// -// 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. -// - -//! Common functions -//! -//! This module defines general, commonly used functions in Drive. -//! - -#[cfg(any(feature = "full", feature = "verify"))] -pub mod decode; -#[cfg(any(feature = "full", feature = "verify"))] -pub mod encode; -#[cfg(feature = "full")] -pub mod identities; - -#[cfg(feature = "full")] -use std::fs::File; -#[cfg(feature = "full")] -use std::io; -#[cfg(feature = "full")] -use std::io::BufRead; -#[cfg(feature = "full")] -use std::option::Option::None; -#[cfg(feature = "full")] -use std::path::Path; - -#[cfg(feature = "full")] -use grovedb::TransactionArg; - -#[cfg(feature = "full")] -use crate::drive::Drive; -#[cfg(feature = "full")] -use dpp::data_contract::DataContract; - -#[cfg(feature = "full")] -use dpp::block::block_info::BlockInfo; -use dpp::prelude::Identifier; - -#[cfg(feature = "fixtures-and-mocks")] -use dpp::tests::json_document::json_document_to_contract_with_ids; -use dpp::version::PlatformVersion; - -#[cfg(test)] -use ciborium::value::Value; - -#[cfg(feature = "fixtures-and-mocks")] -/// Serializes to CBOR and applies to Drive a JSON contract from the file system. -pub fn setup_contract( - drive: &Drive, - path: &str, - contract_id: Option<[u8; 32]>, - transaction: TransactionArg, -) -> DataContract { - let platform_version = PlatformVersion::latest(); - let contract = json_document_to_contract_with_ids( - path, - contract_id.map(Identifier::from), - None, - false, //no need to validate the data contracts in tests for drive - platform_version, - ) - .expect("expected to get json based contract"); - - drive - .apply_contract( - &contract, - BlockInfo::default(), - true, - None, - transaction, - platform_version, - ) - .expect("contract should be applied"); - contract -} - -#[cfg(test)] -/// Serializes a hex string to CBOR. -pub fn cbor_from_hex(hex_string: String) -> Vec { - hex::decode(hex_string).expect("Decoding failed") -} - -#[cfg(feature = "full")] -/// Takes a file and returns the lines as a list of strings. -pub fn text_file_strings(path: impl AsRef) -> Vec { - let file = File::open(path).expect("file not found"); - let reader = io::BufReader::new(file).lines(); - reader.into_iter().map(|a| a.unwrap()).collect() -} - -#[cfg(test)] -/// Retrieves the value of a key from a CBOR map. -pub fn get_key_from_cbor_map<'a>( - cbor_map: &'a [(Value, Value)], - key: &'a str, -) -> Option<&'a Value> { - for (cbor_key, cbor_value) in cbor_map.iter() { - if !cbor_key.is_text() { - continue; - } - - if cbor_key.as_text().expect("confirmed as text") == key { - return Some(cbor_value); - } - } - None -} - -#[cfg(test)] -/// Retrieves the value of a key from a CBOR map if it's a map itself. -pub fn cbor_inner_map_value<'a>( - document_type: &'a [(Value, Value)], - key: &'a str, -) -> Option<&'a Vec<(Value, Value)>> { - let key_value = get_key_from_cbor_map(document_type, key)?; - if let Value::Map(map_value) = key_value { - return Some(map_value); - } - None -} diff --git a/packages/rs-drive/src/config.rs b/packages/rs-drive/src/config.rs new file mode 100644 index 00000000000..3856eb0b0ac --- /dev/null +++ b/packages/rs-drive/src/config.rs @@ -0,0 +1,202 @@ +//! Drive Configuration File +//! + +use dpp::fee::epoch::DEFAULT_EPOCHS_PER_ERA; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; + +/// Boolean if GroveDB batching consistency verification is enabled by default +pub const DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED: bool = false; +/// Boolean if GroveDB has_raw in enabled by default +pub const DEFAULT_GROVE_HAS_RAW_ENABLED: bool = true; +/// Boolean if verification of GroveDB should be run on startup +pub const DEFAULT_VERIFY_GROVE_ON_STARTUP: bool = false; +/// The default default query limit +pub const DEFAULT_QUERY_LIMIT: u16 = 100; +/// The default max query limit +pub const DEFAULT_MAX_QUERY_LIMIT: u16 = 100; +/// Default maximum number of contracts in cache +pub const DEFAULT_DATA_CONTRACTS_CACHE_SIZE: u64 = 500; + +#[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +/// Drive configuration struct +pub struct DriveConfig { + /// Boolean if batching consistency verification is enabled + #[cfg_attr( + feature = "serde", + serde(default = "default_batching_consistency_verification") + )] + pub batching_consistency_verification: bool, + + /// Boolean if has_raw is enabled + #[cfg_attr(feature = "serde", serde(default = "default_has_raw_enabled"))] + pub has_raw_enabled: bool, + + /// Boolean if GroveDB verification should happen on startup + #[cfg_attr( + feature = "serde", + serde(default = "default_grove_verify_on_startup_enabled") + )] + pub grovedb_verify_on_startup: bool, + + /// The default returned count if no limit is set + #[cfg_attr( + feature = "serde", + serde( + default = "default_default_query_limit", + deserialize_with = "from_str_or_number" + ) + )] + pub default_query_limit: u16, + + /// The default returned count if no limit is set + #[cfg_attr( + feature = "serde", + serde( + default = "default_epochs_per_era", + deserialize_with = "from_str_or_number" + ) + )] + pub epochs_per_era: u16, + + /// The limit for user defined queries + #[cfg_attr( + feature = "serde", + serde( + default = "default_max_query_limit", + deserialize_with = "from_str_or_number" + ) + )] + pub max_query_limit: u16, + + /// Default genesis time + #[cfg_attr(feature = "serde", serde(default))] + pub default_genesis_time: Option, + + /// Maximum number of contracts in global cache + #[cfg_attr( + feature = "serde", + serde( + default = "default_data_contracts_cache_size", + deserialize_with = "from_str_or_number" + ) + )] + pub data_contracts_global_cache_size: u64, + + /// Maximum number of contracts in block candidate cache + #[cfg_attr( + feature = "serde", + serde( + default = "default_data_contracts_cache_size", + deserialize_with = "from_str_or_number" + ) + )] + pub data_contracts_block_cache_size: u64, + + /// GroveDB visualizer address + #[cfg(feature = "grovedbg")] + #[cfg_attr( + feature = "serde", + serde( + default = "default_grovedb_visualizer_address", + deserialize_with = "from_str_to_socket_address" + ) + )] + pub grovedb_visualizer_address: std::net::SocketAddr, + + /// Enable GroveDB visualizer + #[cfg(feature = "grovedbg")] + #[cfg_attr( + feature = "serde", + serde(default, deserialize_with = "from_str_to_bool") + )] + pub grovedb_visualizer_enabled: bool, +} + +// TODO: some weird envy behavior requries this to exist +#[cfg(all(feature = "serde", feature = "grovedbg"))] +fn from_str_to_bool<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) +} + +#[cfg(feature = "serde")] +fn from_str_or_number<'de, D, T>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de> + std::str::FromStr, + ::Err: std::fmt::Display, +{ + use serde::de::Error; + + let s = String::deserialize(deserializer)?; + s.parse::().map_err(Error::custom) +} + +#[cfg(all(feature = "serde", feature = "grovedbg"))] +fn from_str_to_socket_address<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) +} + +// Define default functions for serde +fn default_batching_consistency_verification() -> bool { + DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED +} + +fn default_has_raw_enabled() -> bool { + DEFAULT_GROVE_HAS_RAW_ENABLED +} + +fn default_grove_verify_on_startup_enabled() -> bool { + DEFAULT_VERIFY_GROVE_ON_STARTUP +} + +fn default_default_query_limit() -> u16 { + DEFAULT_QUERY_LIMIT +} + +fn default_epochs_per_era() -> u16 { + DEFAULT_EPOCHS_PER_ERA +} + +fn default_max_query_limit() -> u16 { + DEFAULT_MAX_QUERY_LIMIT +} + +fn default_data_contracts_cache_size() -> u64 { + DEFAULT_DATA_CONTRACTS_CACHE_SIZE +} + +/// The default grovedb visualizer_address +pub fn default_grovedb_visualizer_address() -> std::net::SocketAddr { + "127.0.0.1:8083".parse().unwrap() +} + +impl Default for DriveConfig { + fn default() -> Self { + DriveConfig { + batching_consistency_verification: + DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED, + has_raw_enabled: DEFAULT_GROVE_HAS_RAW_ENABLED, + grovedb_verify_on_startup: DEFAULT_VERIFY_GROVE_ON_STARTUP, + default_query_limit: DEFAULT_QUERY_LIMIT, + epochs_per_era: DEFAULT_EPOCHS_PER_ERA, + max_query_limit: DEFAULT_MAX_QUERY_LIMIT, + default_genesis_time: None, + data_contracts_global_cache_size: DEFAULT_DATA_CONTRACTS_CACHE_SIZE, + data_contracts_block_cache_size: DEFAULT_DATA_CONTRACTS_CACHE_SIZE, + #[cfg(feature = "grovedbg")] + grovedb_visualizer_address: default_grovedb_visualizer_address(), + #[cfg(feature = "grovedbg")] + grovedb_visualizer_enabled: false, + } + } +} diff --git a/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/mod.rs b/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/mod.rs index d99e1cdaf75..4465153bfad 100644 --- a/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/mod.rs +++ b/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/mod.rs @@ -5,12 +5,13 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::platform_value::Bytes36; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use grovedb::EstimatedLayerInformation; use std::collections::HashMap; @@ -28,6 +29,7 @@ impl Drive { pub fn add_asset_lock_outpoint_operations( &self, outpoint: &Bytes36, + asset_lock_value: AssetLockValue, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, @@ -41,6 +43,7 @@ impl Drive { { 0 => self.add_asset_lock_outpoint_operations_v0( outpoint, + asset_lock_value, estimated_costs_only_with_layer_info, platform_version, ), diff --git a/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/v0/mod.rs b/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/v0/mod.rs index 43dbc1f8d89..feae31346bb 100644 --- a/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/asset_lock/add_asset_lock_outpoint_operations/v0/mod.rs @@ -2,12 +2,14 @@ use crate::drive::asset_lock::asset_lock_storage_path; -use crate::drive::object_size_info::PathKeyElementInfo::PathFixedSizeKeyRefElement; use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::PathKeyElementInfo::PathFixedSizeKeyRefElement; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; use dpp::platform_value::Bytes36; +use dpp::serialization::PlatformSerializable; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::Element::Item; @@ -29,6 +31,7 @@ impl Drive { pub(super) fn add_asset_lock_outpoint_operations_v0( &self, outpoint: &Bytes36, + asset_lock_value: AssetLockValue, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, @@ -42,11 +45,19 @@ impl Drive { )?; } + let item_bytes = if asset_lock_value.remaining_credit_value() > 0 { + asset_lock_value.serialize_to_bytes()? + } else { + // If there is no credit value we don't actually put any system credits, + // This is to save space, since the information can be retrieved from the core chain. + vec![] + }; + self.batch_insert( PathFixedSizeKeyRefElement(( asset_lock_storage_path(), outpoint.as_slice(), - Item(vec![], None), + Item(item_bytes, None), )), &mut drive_operations, &platform_version.drive, diff --git a/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs b/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs index 1091507a3b7..1110b448445 100644 --- a/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs +++ b/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs @@ -44,27 +44,30 @@ impl Drive { /// - The layer might potentially have max elements. /// - Each item in this layer has a size of 36, which represents the size of an outpoint. /// - /// # Notes - /// - /// The todo comment suggests that there may be inaccuracies in the current function logic. Ensure to verify - /// the correctness of the provided logic and assumptions before relying on this function in production. pub(crate) fn add_estimation_costs_for_adding_asset_lock_v0( estimated_costs_only_with_layer_info: &mut HashMap, ) { - //todo: verify (this is wrong) + // DataContract_Documents 64 + // / \ + // Identities 32 Balances 96 + // / \ / \ + // Token_Balances 16 Pools 48 WithdrawalTransactions 80 Votes 112 + // / \ / / / \ + // NUPKH->I 8 UPKH->I 24 PreFundedSpecializedBalances 40 -> SpentAssetLockTransactions 72 <- Misc 104 Versions 120 + // we have constructed the top layer so contract/documents tree are at the top - // since balance will be on layer 2, updating will mean we will update 1 sum tree - // and 1 normal tree, hence we should give an equal weight to both + // since SpentAssetLockTransactions will be on layer 3, updating will mean we will update 1 sum tree + // and 2 normal tree, hence we should give an equal weight to both estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { is_sum_tree: false, - estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( - 1, + 12, // 32 + 1 + 1 / 3 SomeSumTrees { sum_trees_weight: 1, - non_sum_trees_weight: 1, + non_sum_trees_weight: 2, }, None, ), diff --git a/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/mod.rs b/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/mod.rs new file mode 100644 index 00000000000..529ecddd868 --- /dev/null +++ b/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/mod.rs @@ -0,0 +1,85 @@ +//! Implements in Drive functions which check if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it. + +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::platform_value::Bytes36; +use dpp::version::drive_versions::DriveVersion; + +use dpp::asset_lock::StoredAssetLockInfo; +use grovedb::TransactionArg; + +impl Drive { + /// Checks if a given `outpoint` is present as an asset lock in the transaction. + /// + /// # Arguments + /// + /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. + /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. + /// + /// # Returns + /// + /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. + pub fn fetch_asset_lock_outpoint_info( + &self, + outpoint: &Bytes36, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result { + match drive_version + .methods + .asset_lock + .fetch_asset_lock_outpoint_info + { + 0 => self.fetch_asset_lock_outpoint_info_v0(outpoint, transaction, drive_version), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_asset_lock_outpoint_info".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Checks if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it. + /// + /// # Arguments + /// + /// * `apply` - A boolean which when true applies the operations to the asset lock. + /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` to be possibly executed. + /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. + /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. + /// + /// # Returns + /// + /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. + pub(crate) fn fetch_asset_lock_outpoint_info_add_operations( + &self, + apply: bool, + drive_operations: &mut Vec, + outpoint: &Bytes36, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result { + match drive_version + .methods + .asset_lock + .fetch_asset_lock_outpoint_info + { + 0 => self.fetch_asset_lock_outpoint_info_add_operations_v0( + apply, + drive_operations, + outpoint, + transaction, + drive_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "fetch_asset_lock_outpoint_info_add_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/v0/mod.rs b/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/v0/mod.rs new file mode 100644 index 00000000000..eb929eda17f --- /dev/null +++ b/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/v0/mod.rs @@ -0,0 +1,98 @@ +//! Implements in Drive functions which check if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it (version 0). + +use crate::drive::asset_lock::asset_lock_storage_path; +use crate::util::grove_operations::DirectQueryType::{StatefulDirectQuery, StatelessDirectQuery}; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; + +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::drive_versions::DriveVersion; + +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::asset_lock::StoredAssetLockInfo; +use dpp::platform_value::Bytes36; +use dpp::serialization::PlatformDeserializable; +use grovedb::TransactionArg; + +impl Drive { + /// Checks if a given `outpoint` is present as an asset lock in the transaction. + /// + /// # Arguments + /// + /// * `&self` - A reference to the current object. + /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. + /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. + /// + /// # Returns + /// + /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. + pub(super) fn fetch_asset_lock_outpoint_info_v0( + &self, + outpoint: &Bytes36, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result { + self.fetch_asset_lock_outpoint_info_add_operations( + true, + &mut vec![], + outpoint, + transaction, + drive_version, + ) + } + + /// Checks if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it. + /// + /// # Arguments + /// + /// * `&self` - A reference to the current object. + /// * `apply` - A boolean which when true applies the operations to the asset lock. + /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` to be possibly executed. + /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. + /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. + /// + /// # Returns + /// + /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. + pub(super) fn fetch_asset_lock_outpoint_info_add_operations_v0( + &self, + apply: bool, + drive_operations: &mut Vec, + outpoint: &Bytes36, + transaction: TransactionArg, + drive_version: &DriveVersion, + ) -> Result { + let asset_lock_storage_path = asset_lock_storage_path(); + let query_type = if apply { + StatefulDirectQuery + } else { + StatelessDirectQuery { + in_tree_using_sums: false, + query_target: QueryTargetValue(36), + } + }; + + Ok(self + .grove_get_raw_optional( + (&asset_lock_storage_path).into(), + outpoint.as_slice(), + query_type, + transaction, + drive_operations, + drive_version, + )? + .map(|element| { + let item_bytes = element.as_item_bytes()?; + if item_bytes.is_empty() { + Ok::(StoredAssetLockInfo::FullyConsumed) + } else { + Ok(StoredAssetLockInfo::PartiallyConsumed( + AssetLockValue::deserialize_from_bytes(item_bytes)?, + )) + } + }) + .transpose()? + .unwrap_or(StoredAssetLockInfo::NotPresent)) + } +} diff --git a/packages/rs-drive/src/drive/asset_lock/has_asset_lock_outpoint/mod.rs b/packages/rs-drive/src/drive/asset_lock/has_asset_lock_outpoint/mod.rs deleted file mode 100644 index ad7cdbd867b..00000000000 --- a/packages/rs-drive/src/drive/asset_lock/has_asset_lock_outpoint/mod.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! Implements in Drive functions which check if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it. - -mod v0; - -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::platform_value::Bytes36; -use dpp::version::drive_versions::DriveVersion; - -use grovedb::TransactionArg; - -impl Drive { - /// Checks if a given `outpoint` is present as an asset lock in the transaction. - /// - /// # Arguments - /// - /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. - /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. - /// - /// # Returns - /// - /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. - pub fn has_asset_lock_outpoint( - &self, - outpoint: &Bytes36, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result { - match drive_version.methods.asset_lock.has_asset_lock_outpoint { - 0 => self.has_asset_lock_outpoint_v0(outpoint, transaction, drive_version), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "has_asset_lock_outpoint".to_string(), - known_versions: vec![0], - received: version, - })), - } - } - - /// Checks if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it. - /// - /// # Arguments - /// - /// * `apply` - A boolean which when true applies the operations to the asset lock. - /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` to be possibly executed. - /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. - /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. - /// - /// # Returns - /// - /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. - pub(crate) fn has_asset_lock_outpoint_add_operations( - &self, - apply: bool, - drive_operations: &mut Vec, - outpoint: &Bytes36, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result { - match drive_version.methods.asset_lock.has_asset_lock_outpoint { - 0 => self.has_asset_lock_outpoint_add_operations_v0( - apply, - drive_operations, - outpoint, - transaction, - drive_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "has_asset_lock_outpoint_add_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/asset_lock/has_asset_lock_outpoint/v0/mod.rs b/packages/rs-drive/src/drive/asset_lock/has_asset_lock_outpoint/v0/mod.rs deleted file mode 100644 index 0257abe529d..00000000000 --- a/packages/rs-drive/src/drive/asset_lock/has_asset_lock_outpoint/v0/mod.rs +++ /dev/null @@ -1,82 +0,0 @@ -//! Implements in Drive functions which check if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it (version 0). - -use crate::drive::asset_lock::asset_lock_storage_path; -use crate::drive::grove_operations::DirectQueryType::{StatefulDirectQuery, StatelessDirectQuery}; -use crate::drive::grove_operations::QueryTarget::QueryTargetValue; - -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::version::drive_versions::DriveVersion; - -use dpp::platform_value::Bytes36; -use grovedb::TransactionArg; - -impl Drive { - /// Checks if a given `outpoint` is present as an asset lock in the transaction. - /// - /// # Arguments - /// - /// * `&self` - A reference to the current object. - /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. - /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. - /// - /// # Returns - /// - /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. - pub(super) fn has_asset_lock_outpoint_v0( - &self, - outpoint: &Bytes36, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result { - self.has_asset_lock_outpoint_add_operations( - true, - &mut vec![], - outpoint, - transaction, - drive_version, - ) - } - - /// Checks if a given `outpoint` is present as an asset lock in the transaction and potentially applies operations to it. - /// - /// # Arguments - /// - /// * `&self` - A reference to the current object. - /// * `apply` - A boolean which when true applies the operations to the asset lock. - /// * `drive_operations` - A mutable reference to a vector of `LowLevelDriveOperation` to be possibly executed. - /// * `outpoint` - An `OutPoint` reference to be checked in the transaction. - /// * `transaction` - The `TransactionArg` in which to check for the `outpoint`. - /// - /// # Returns - /// - /// Returns a `Result` which is `Ok` if the outpoint exists in the transaction or an `Error` otherwise. - pub(super) fn has_asset_lock_outpoint_add_operations_v0( - &self, - apply: bool, - drive_operations: &mut Vec, - outpoint: &Bytes36, - transaction: TransactionArg, - drive_version: &DriveVersion, - ) -> Result { - let asset_lock_storage_path = asset_lock_storage_path(); - let query_type = if apply { - StatefulDirectQuery - } else { - StatelessDirectQuery { - in_tree_using_sums: false, - query_target: QueryTargetValue(36), - } - }; - - self.grove_has_raw( - (&asset_lock_storage_path).into(), - outpoint.as_slice(), - query_type, - transaction, - drive_operations, - drive_version, - ) - } -} diff --git a/packages/rs-drive/src/drive/asset_lock/mod.rs b/packages/rs-drive/src/drive/asset_lock/mod.rs index 0a27fd9bd46..1ed0a75d87b 100644 --- a/packages/rs-drive/src/drive/asset_lock/mod.rs +++ b/packages/rs-drive/src/drive/asset_lock/mod.rs @@ -4,7 +4,7 @@ use crate::drive::RootTree; mod add_asset_lock_outpoint_operations; mod estimation_costs; -mod has_asset_lock_outpoint; +mod fetch_asset_lock_outpoint_info; /// The asset lock root storage path pub(crate) fn asset_lock_storage_path() -> [&'static [u8]; 1] { diff --git a/packages/rs-drive/src/drive/balances/add_to_system_credits/v0/mod.rs b/packages/rs-drive/src/drive/balances/add_to_system_credits/v0/mod.rs index 3648c86276a..2f0e6cf6ddf 100644 --- a/packages/rs-drive/src/drive/balances/add_to_system_credits/v0/mod.rs +++ b/packages/rs-drive/src/drive/balances/add_to_system_credits/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::TransactionArg; @@ -20,6 +20,7 @@ impl Drive { /// # Returns /// /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + #[inline(always)] pub(super) fn add_to_system_credits_v0( &self, amount: u64, @@ -34,7 +35,7 @@ impl Drive { platform_version, )?; let grove_db_operations = - LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); + LowLevelDriveOperation::grovedb_operations_batch_consume(batch_operations); self.grove_apply_batch_with_add_costs( grove_db_operations, false, diff --git a/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/mod.rs b/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/mod.rs index fd1f0e9a9a4..4bb7a7a00f9 100644 --- a/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/mod.rs +++ b/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/v0/mod.rs b/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/v0/mod.rs index 20506c1653e..33b1740e104 100644 --- a/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/balances/add_to_system_credits_operations/v0/mod.rs @@ -1,14 +1,14 @@ use crate::drive::balances::TOTAL_SYSTEM_CREDITS_STORAGE_KEY; -use crate::drive::grove_operations::DirectQueryType; use crate::drive::system::{misc_path, misc_path_vec}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::DirectQueryType; use dpp::version::PlatformVersion; -use grovedb::batch::{GroveDbOp, KeyInfoPath}; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; use grovedb::Element::Item; use grovedb::{EstimatedLayerInformation, TransactionArg}; use integer_encoding::VarInt; @@ -16,6 +16,7 @@ use std::collections::HashMap; impl Drive { /// The operations to add to system credits + #[inline(always)] pub(super) fn add_to_system_credits_operations_v0( &self, amount: u64, @@ -51,7 +52,7 @@ impl Drive { "trying to add an amount that would overflow credits", )))?; let path_holding_total_credits_vec = misc_path_vec(); - let replace_op = GroveDbOp::replace_op( + let replace_op = QualifiedGroveDbOp::replace_op( path_holding_total_credits_vec, TOTAL_SYSTEM_CREDITS_STORAGE_KEY.to_vec(), Item(new_total.encode_var_vec(), None), diff --git a/packages/rs-drive/src/drive/balances/calculate_total_credits_balance/v0/mod.rs b/packages/rs-drive/src/drive/balances/calculate_total_credits_balance/v0/mod.rs index 1d6e65466de..9d7b48e342a 100644 --- a/packages/rs-drive/src/drive/balances/calculate_total_credits_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/balances/calculate_total_credits_balance/v0/mod.rs @@ -1,9 +1,9 @@ use crate::drive::balances::TOTAL_SYSTEM_CREDITS_STORAGE_KEY; -use crate::drive::grove_operations::DirectQueryType; use crate::drive::system::misc_path; use crate::drive::{Drive, RootTree}; use crate::error::drive::DriveError; use crate::error::Error; +use crate::util::grove_operations::DirectQueryType; use dpp::balances::total_credits_balance::TotalCreditsBalance; use dpp::version::drive_versions::DriveVersion; use grovedb::TransactionArg; @@ -12,6 +12,7 @@ use grovedb_path::SubtreePath; impl Drive { /// Verify that the sum tree identity credits + pool credits + refunds are equal to the /// Total credits in the system + #[inline(always)] pub(super) fn calculate_total_credits_balance_v0( &self, transaction: TransactionArg, @@ -41,6 +42,15 @@ impl Drive { drive_version, )?; + let total_specialized_balances = self.grove_get_sum_tree_total_value( + SubtreePath::empty(), + Into::<&[u8; 1]>::into(RootTree::PreFundedSpecializedBalances), + DirectQueryType::StatefulDirectQuery, + transaction, + &mut drive_operations, + drive_version, + )?; + let total_in_pools = self.grove_get_sum_tree_total_value( SubtreePath::empty(), Into::<&[u8; 1]>::into(RootTree::Pools), @@ -54,6 +64,7 @@ impl Drive { total_credits_in_platform, total_in_pools, total_identity_balances, + total_specialized_balances, }) } } diff --git a/packages/rs-drive/src/drive/balances/mod.rs b/packages/rs-drive/src/drive/balances/mod.rs index 24970fe316a..0af170831e4 100644 --- a/packages/rs-drive/src/drive/balances/mod.rs +++ b/packages/rs-drive/src/drive/balances/mod.rs @@ -2,40 +2,32 @@ //! Functions include inserting verifying balances between various trees. //! -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod add_to_system_credits; -#[cfg(feature = "full")] -pub use add_to_system_credits::*; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod add_to_system_credits_operations; -#[cfg(feature = "full")] -pub use add_to_system_credits_operations::*; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod remove_from_system_credits; -#[cfg(feature = "full")] -pub use remove_from_system_credits::*; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod remove_from_system_credits_operations; -#[cfg(feature = "full")] -pub use remove_from_system_credits_operations::*; -#[cfg(feature = "full")] +#[cfg(feature = "server")] mod calculate_total_credits_balance; -#[cfg(feature = "full")] -pub use calculate_total_credits_balance::*; -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] use crate::drive::RootTree; +use crate::query::Query; +use grovedb::{PathQuery, SizedQuery}; /// Storage fee pool key -#[cfg(feature = "full")] +#[cfg(any(feature = "server", feature = "verify"))] pub const TOTAL_SYSTEM_CREDITS_STORAGE_KEY: &[u8; 1] = b"D"; /// The path for all the credits in the system -#[cfg(feature = "full")] +#[cfg(any(feature = "server", feature = "verify"))] pub fn total_credits_path() -> [&'static [u8]; 2] { [ Into::<&[u8; 1]>::into(RootTree::Misc), @@ -43,24 +35,46 @@ pub fn total_credits_path() -> [&'static [u8]; 2] { ] } +/// The path as a vec for all the credits in the system +#[cfg(any(feature = "server", feature = "verify"))] +pub fn total_credits_path_vec() -> Vec> { + vec![ + vec![RootTree::Misc as u8], + TOTAL_SYSTEM_CREDITS_STORAGE_KEY.to_vec(), + ] +} + +/// A path query helper to get the total credits on Platform +#[cfg(any(feature = "server", feature = "verify"))] +pub fn total_credits_on_platform_path_query() -> PathQuery { + PathQuery { + path: vec![vec![RootTree::Misc as u8]], + query: SizedQuery { + query: Query::new_single_key(TOTAL_SYSTEM_CREDITS_STORAGE_KEY.to_vec()), + limit: Some(1), + offset: None, + }, + } +} + /// The path for the balances tree -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) fn balance_path() -> [&'static [u8]; 1] { [Into::<&[u8; 1]>::into(RootTree::Balances)] } /// The path for the balances tree -#[cfg(any(feature = "full", feature = "verify"))] +#[cfg(any(feature = "server", feature = "verify"))] pub(crate) fn balance_path_vec() -> Vec> { vec![Into::<&[u8; 1]>::into(RootTree::Balances).to_vec()] } -#[cfg(feature = "full")] +#[cfg(feature = "server")] #[cfg(test)] mod tests { use crate::drive::Drive; - use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; use dpp::version::PlatformVersion; #[test] diff --git a/packages/rs-drive/src/drive/balances/remove_from_system_credits/v0/mod.rs b/packages/rs-drive/src/drive/balances/remove_from_system_credits/v0/mod.rs index 3369ce798a0..58e696e007f 100644 --- a/packages/rs-drive/src/drive/balances/remove_from_system_credits/v0/mod.rs +++ b/packages/rs-drive/src/drive/balances/remove_from_system_credits/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::Drive; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::TransactionArg; @@ -8,6 +8,7 @@ use grovedb::TransactionArg; impl Drive { /// We remove from system credits when: /// - an identity withdraws some of their balance + #[inline(always)] pub(super) fn remove_from_system_credits_v0( &self, amount: u64, @@ -22,7 +23,7 @@ impl Drive { platform_version, )?; let grove_db_operations = - LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); + LowLevelDriveOperation::grovedb_operations_batch_consume(batch_operations); self.grove_apply_batch_with_add_costs( grove_db_operations, false, diff --git a/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/mod.rs b/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/mod.rs index abff38be378..4c4aa70cc92 100644 --- a/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/mod.rs +++ b/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/v0/mod.rs b/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/v0/mod.rs index 2d726879af4..8bdb989d21f 100644 --- a/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/balances/remove_from_system_credits_operations/v0/mod.rs @@ -1,14 +1,14 @@ use crate::drive::balances::TOTAL_SYSTEM_CREDITS_STORAGE_KEY; -use crate::drive::grove_operations::DirectQueryType; use crate::drive::system::{misc_path, misc_path_vec}; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use crate::fee::op::LowLevelDriveOperation::GroveOperation; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::DirectQueryType; use dpp::version::PlatformVersion; -use grovedb::batch::{GroveDbOp, KeyInfoPath}; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; use grovedb::Element::Item; use grovedb::{EstimatedLayerInformation, TransactionArg}; use integer_encoding::VarInt; @@ -17,6 +17,7 @@ use std::collections::HashMap; impl Drive { /// We remove from system credits when: /// - an identity withdraws some of their balance + #[inline(always)] pub(super) fn remove_from_system_credits_operations_v0( &self, amount: u64, @@ -49,10 +50,10 @@ impl Drive { let new_total = total_credits_in_platform .checked_sub(amount) .ok_or(Error::Drive(DriveError::CriticalCorruptedState( - "trying to remove an amount that would underflow credits", + "trying to remove an amount that would underflow total system credits", )))?; let path_holding_total_credits_vec = misc_path_vec(); - let replace_op = GroveDbOp::replace_op( + let replace_op = QualifiedGroveDbOp::replace_op( path_holding_total_credits_vec, TOTAL_SYSTEM_CREDITS_STORAGE_KEY.to_vec(), Item(new_total.encode_var_vec(), None), diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/document.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/document.rs deleted file mode 100644 index 148e47fbd82..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/document.rs +++ /dev/null @@ -1,507 +0,0 @@ -use crate::drive::batch::drive_op_batch::DriveLowLevelOperationConverter; -use crate::drive::flags::StorageFlags; -use crate::drive::object_size_info::DocumentInfo::{DocumentRefAndSerialization, DocumentRefInfo}; -use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; -use crate::drive::Drive; -use crate::error::document::DocumentError; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::block_info::BlockInfo; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::DocumentTypeRef; -use dpp::data_contract::DataContract; -use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; -use dpp::document::Document; -use dpp::prelude::Identifier; - -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - -use dpp::version::PlatformVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::borrow::{Borrow, Cow}; -use std::collections::HashMap; - -/// A wrapper for a document operation -#[derive(Clone, Debug)] -pub enum DocumentOperation<'a> { - /// An add operation - AddOperation { - /// Document info with maybe the owner id - owned_document_info: OwnedDocumentInfo<'a>, - /// Should we override the document if one already exists? - override_document: bool, - }, - /// An update operation - UpdateOperation(UpdateOperationInfo<'a>), -} - -/// Document and contract info -#[derive(Clone, Debug)] -pub struct DocumentOperationsForContractDocumentType<'a> { - /// Document info - pub operations: Vec>, - ///DataContract - pub contract: &'a DataContract, - /// Document type - pub document_type: DocumentTypeRef<'a>, -} - -/// Operations on Documents -#[derive(Clone, Debug)] -pub enum DocumentOperationType<'a> { - /// Deserializes a document and adds it to a contract. - AddSerializedDocumentForContract { - /// The serialized document - serialized_document: &'a [u8], - /// The contract - contract: &'a DataContract, - /// The name of the document type - document_type_name: &'a str, - /// The owner id, if none is specified will try to recover from serialized document - owner_id: Option<[u8; 32]>, - /// Should we override the document if one already exists? - override_document: bool, - /// Add storage flags (like epoch, owner id, etc) - storage_flags: Option>, - }, - /// Adds a document to a contract matching the desired info. - AddDocument { - /// The document and contract info, also may contain the owner_id - owned_document_info: OwnedDocumentInfo<'a>, - ///DataContract - contract_id: Identifier, - /// Document type - document_type_name: Cow<'a, String>, - /// Should we override the document if one already exists? - override_document: bool, - }, - /// Adds a withdrawal document. - AddWithdrawalDocument { - /// The document and contract info, also may contain the owner_id - owned_document_info: OwnedDocumentInfo<'a>, - }, - /// Adds a document to a contract. - AddDocumentForContract { - /// The document and contract info, also may contain the owner_id - document_and_contract_info: DocumentAndContractInfo<'a>, - /// Should we override the document if one already exists? - override_document: bool, - }, - /// Adds a document to a contract. - MultipleDocumentOperationsForSameContractDocumentType { - /// The document operations - document_operations: DocumentOperationsForContractDocumentType<'a>, - }, - /// Deletes a document and returns the associated fee. - DeleteDocumentOfNamedTypeForContractId { - /// The document id - document_id: [u8; 32], - /// The contract id - contract_id: [u8; 32], - /// The name of the document type - document_type_name: Cow<'a, String>, - }, - /// Deletes a document and returns the associated fee. - DeleteDocumentOfNamedTypeForContract { - /// The document id - document_id: [u8; 32], - /// The contract - contract: &'a DataContract, - /// The name of the document type - document_type_name: &'a str, - }, - /// Deletes a document and returns the associated fee. - DeleteDocumentForContract { - /// The document id - document_id: [u8; 32], - /// The contract - contract: &'a DataContract, - /// The name of the document type - document_type: DocumentTypeRef<'a>, - }, - /// Updates a serialized document and returns the associated fee. - UpdateSerializedDocumentForContract { - /// The serialized document - serialized_document: &'a [u8], - /// The contract - contract: &'a DataContract, - /// The name of the document type - document_type_name: &'a str, - /// The owner id, if none is specified will try to recover from serialized document - owner_id: Option<[u8; 32]>, - /// Add storage flags (like epoch, owner id, etc) - storage_flags: Option>, - }, - /// Updates a document and returns the associated fee. - UpdateDocument { - /// The document and contract info, also may contain the owner_id - owned_document_info: OwnedDocumentInfo<'a>, - /// DataContract - contract_id: Identifier, - /// Document type - document_type_name: Cow<'a, String>, - }, - /// Updates a document and returns the associated fee. - UpdateDocumentForContract { - /// The document to update - document: &'a Document, - /// The document in pre-serialized form - serialized_document: &'a [u8], - /// The contract - contract: &'a DataContract, - /// The name of the document type - document_type_name: &'a str, - /// The owner id, if none is specified will try to recover from serialized document - owner_id: Option<[u8; 32]>, - /// Add storage flags (like epoch, owner id, etc) - storage_flags: Option>, - }, -} - -impl DriveLowLevelOperationConverter for DocumentOperationType<'_> { - fn into_low_level_drive_operations( - self, - drive: &Drive, - estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match self { - DocumentOperationType::AddSerializedDocumentForContract { - serialized_document, - contract, - document_type_name, - owner_id, - override_document, - storage_flags, - } => { - let document_type = contract.document_type_for_name(document_type_name)?; - - let document = - Document::from_bytes(serialized_document, document_type, platform_version)?; - - let document_info = - DocumentRefAndSerialization((&document, serialized_document, storage_flags)); - - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info, - owner_id, - }, - contract, - document_type, - }; - drive.add_document_for_contract_operations( - document_and_contract_info, - override_document, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ) - } - DocumentOperationType::AddDocument { - owned_document_info, - contract_id, - document_type_name, - override_document, - } => { - let mut drive_operations: Vec = vec![]; - let contract_fetch_info = drive - .get_contract_with_fetch_info_and_add_to_operations( - contract_id.into_buffer(), - Some(&block_info.epoch), - true, - transaction, - &mut drive_operations, - platform_version, - )? - .ok_or(Error::Document(DocumentError::DataContractNotFound))?; - - let contract = &contract_fetch_info.contract; - - let document_type = contract.document_type_for_name(document_type_name.as_str())?; - - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info, - contract, - document_type, - }; - let mut operations = drive.add_document_for_contract_operations( - document_and_contract_info, - override_document, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - )?; - drive_operations.append(&mut operations); - Ok(drive_operations) - } - DocumentOperationType::AddWithdrawalDocument { - owned_document_info, - } => { - let contract = &drive.system_contracts.withdrawal_contract; - - let document_type = contract.document_type_for_name(withdrawal::NAME)?; - - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info, - contract, - document_type, - }; - drive.add_document_for_contract_operations( - document_and_contract_info, - false, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ) - } - DocumentOperationType::AddDocumentForContract { - document_and_contract_info, - override_document, - } => drive.add_document_for_contract_operations( - document_and_contract_info, - override_document, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - DocumentOperationType::DeleteDocumentForContract { - document_id, - contract, - document_type, - } => drive.delete_document_for_contract_operations( - document_id, - contract, - document_type, - None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - DocumentOperationType::DeleteDocumentOfNamedTypeForContractId { - document_id, - contract_id, - document_type_name, - } => drive.delete_document_for_contract_id_with_named_type_operations( - document_id, - contract_id, - document_type_name.as_str(), - &block_info.epoch, - None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - DocumentOperationType::DeleteDocumentOfNamedTypeForContract { - document_id, - contract, - document_type_name, - } => drive.delete_document_for_contract_with_named_type_operations( - document_id, - contract, - document_type_name, - None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - DocumentOperationType::UpdateSerializedDocumentForContract { - serialized_document, - contract, - document_type_name, - owner_id, - storage_flags, - } => { - let document_type = contract.document_type_for_name(document_type_name)?; - - let document = - Document::from_bytes(serialized_document, document_type, platform_version)?; - - let document_info = - DocumentRefAndSerialization((&document, serialized_document, storage_flags)); - - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info, - owner_id, - }, - contract, - document_type, - }; - drive.update_document_for_contract_operations( - document_and_contract_info, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ) - } - DocumentOperationType::UpdateDocumentForContract { - document, - serialized_document, - contract, - document_type_name, - owner_id, - storage_flags, - } => { - let document_info = - DocumentRefAndSerialization((document, serialized_document, storage_flags)); - - let document_type = contract.document_type_for_name(document_type_name)?; - - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info, - owner_id, - }, - contract, - document_type, - }; - drive.update_document_for_contract_operations( - document_and_contract_info, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ) - } - DocumentOperationType::MultipleDocumentOperationsForSameContractDocumentType { - document_operations, - } => { - let DocumentOperationsForContractDocumentType { - operations, - contract, - document_type, - } = document_operations; - - let mut drive_operations = vec![]; - for document_operation in operations { - match document_operation { - DocumentOperation::AddOperation { - owned_document_info, - override_document, - } => { - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info, - contract, - document_type, - }; - let mut operations = drive.add_document_for_contract_operations( - document_and_contract_info, - override_document, - block_info, - &mut Some(&mut drive_operations), - estimated_costs_only_with_layer_info, - transaction, - platform_version, - )?; - drive_operations.append(&mut operations); - } - DocumentOperation::UpdateOperation(update_operation) => { - let UpdateOperationInfo { - document, - serialized_document, - owner_id, - storage_flags, - } = update_operation; - - let document_info = - if let Some(serialized_document) = serialized_document { - DocumentRefAndSerialization(( - document, - serialized_document, - storage_flags, - )) - } else { - DocumentRefInfo((document, storage_flags)) - }; - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info, - owner_id, - }, - contract, - document_type, - }; - let mut operations = drive.update_document_for_contract_operations( - document_and_contract_info, - block_info, - &mut Some(&mut drive_operations), - estimated_costs_only_with_layer_info, - transaction, - platform_version, - )?; - drive_operations.append(&mut operations); - } - } - } - Ok(drive_operations) - } - DocumentOperationType::UpdateDocument { - owned_document_info, - contract_id, - document_type_name, - } => { - let mut drive_operations = vec![]; - let contract_fetch_info = drive - .get_contract_with_fetch_info_and_add_to_operations( - contract_id.into_buffer(), - Some(&block_info.epoch), - true, - transaction, - &mut drive_operations, - platform_version, - )? - .ok_or(Error::Document(DocumentError::DataContractNotFound))?; - - let contract = &contract_fetch_info.contract; - - let document_type = contract.document_type_for_name(document_type_name.as_str())?; - - let document_and_contract_info = DocumentAndContractInfo { - owned_document_info, - contract, - document_type, - }; - let mut operations = drive.update_document_for_contract_operations( - document_and_contract_info, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - )?; - drive_operations.append(&mut operations); - Ok(drive_operations) - } - } - } -} - -/// A wrapper for an update operation -#[derive(Clone, Debug)] -pub struct UpdateOperationInfo<'a> { - /// The document to update - pub document: &'a Document, - /// The document in pre-serialized form - pub serialized_document: Option<&'a [u8]>, - /// The owner id, if none is specified will try to recover from serialized document - pub owner_id: Option<[u8; 32]>, - /// Add storage flags (like epoch, owner id, etc) - pub storage_flags: Option>, -} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs deleted file mode 100644 index b4040eb7b01..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs +++ /dev/null @@ -1,63 +0,0 @@ -mod v0; - -use crate::drive::batch::DriveOperation; - -use crate::drive::Drive; -use crate::error::{drive::DriveError, Error}; - -use dpp::block::block_info::BlockInfo; - -use grovedb::TransactionArg; - -use dpp::fee::fee_result::FeeResult; - -use dpp::version::PlatformVersion; - -impl Drive { - /// Applies a list of high level DriveOperations to the drive, and calculates the fee for them. - /// - /// This method converts Drive operations to low-level operations, applies them if `apply` is true, - /// and calculates the associated fee. - /// - /// # Arguments - /// - /// * `operations` - A vector of `DriveOperation`s to apply to the drive. - /// * `apply` - A boolean flag indicating whether to apply the changes or only estimate costs. - /// * `block_info` - A reference to information about the current block. - /// * `transaction` - Transaction arguments. - /// * `drive_version` - A `DriveVersion` reference that dictates which version of the method to call. - /// - /// # Returns - /// - /// Returns a `Result` containing the `FeeResult` if the operations are successfully applied, - /// otherwise an `Error`. - /// - pub fn apply_drive_operations( - &self, - operations: Vec, - apply: bool, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .drive - .methods - .batch_operations - .apply_drive_operations - { - 0 => self.apply_drive_operations_v0( - operations, - apply, - block_info, - transaction, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "apply_drive_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs deleted file mode 100644 index c26c4a6b20a..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs +++ /dev/null @@ -1,95 +0,0 @@ -use crate::drive::batch::DriveOperation; - -use crate::drive::Drive; -use crate::error::Error; - -use dpp::block::block_info::BlockInfo; -use dpp::fee::fee_result::FeeResult; - -use grovedb::{EstimatedLayerInformation, TransactionArg}; - -use crate::drive::batch::drive_op_batch::DriveLowLevelOperationConverter; - -use dpp::version::PlatformVersion; -use grovedb::batch::KeyInfoPath; - -use crate::drive::batch::drive_op_batch::finalize_task::{ - DriveOperationFinalizationTasks, DriveOperationFinalizeTask, -}; -use std::collections::HashMap; - -impl Drive { - /// Applies a list of high level DriveOperations to the drive, and calculates the fee for them. - /// - /// # Arguments - /// - /// * `operations` - A vector of `DriveOperation`s to apply to the drive. - /// * `apply` - A boolean flag indicating whether to apply the changes or only estimate costs. - /// * `block_info` - A reference to information about the current block. - /// * `transaction` - Transaction arguments. - /// - /// # Returns - /// - /// Returns a `Result` containing the `FeeResult` if the operations are successfully applied, - /// otherwise an `Error`. - /// - /// If `apply` is set to true, it applies the low-level drive operations and updates side info accordingly. - /// If not, it only estimates the costs and updates estimated costs with layer info. - pub(super) fn apply_drive_operations_v0( - &self, - operations: Vec, - apply: bool, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - if operations.is_empty() { - return Ok(FeeResult::default()); - } - let mut low_level_operations = vec![]; - let mut estimated_costs_only_with_layer_info = if apply { - None::> - } else { - Some(HashMap::new()) - }; - - let mut finalize_tasks: Vec = Vec::new(); - - for drive_op in operations { - if let Some(tasks) = drive_op.finalization_tasks(platform_version)? { - finalize_tasks.extend(tasks); - } - - low_level_operations.append(&mut drive_op.into_low_level_drive_operations( - self, - &mut estimated_costs_only_with_layer_info, - block_info, - transaction, - platform_version, - )?); - } - - let mut cost_operations = vec![]; - - self.apply_batch_low_level_drive_operations( - estimated_costs_only_with_layer_info, - transaction, - low_level_operations, - &mut cost_operations, - &platform_version.drive, - )?; - - // Execute drive operation callbacks after updating state - for task in finalize_tasks { - task.execute(self, platform_version); - } - - Drive::calculate_fee( - None, - Some(cost_operations), - &block_info.epoch, - self.config.epochs_per_era, - platform_version, - ) - } -} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/mod.rs deleted file mode 100644 index d3346034dd1..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -mod v0; -use crate::drive::batch::{DriveOperation, GroveDbOpBatch}; -use crate::drive::Drive; -use crate::error::drive::DriveError; -use crate::error::Error; - -use dpp::block::block_info::BlockInfo; - -use dpp::version::PlatformVersion; - -use grovedb::TransactionArg; - -impl Drive { - /// Convert a batch of drive operations to a batch of grove database operations. - /// - /// This function takes drive operations and converts them into grove database operations by - /// processing each operation in the `drive_batch_operations` vector, transforming them to low-level - /// drive operations and finally, into grove database operations. The resulting operations are - /// returned as a `GroveDbOpBatch`. - /// - /// # Arguments - /// - /// * `drive_batch_operations` - A vector of high-level drive operations to be converted. - /// * `block_info` - A reference to the block information associated with these operations. - /// * `transaction` - A transaction argument to be used during processing. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of the method to call. - /// - /// # Returns - /// - /// Returns a `Result` containing a `GroveDbOpBatch` with transformed grove database operations, - /// or an error if any step in the conversion process fails. - pub fn convert_drive_operations_to_grove_operations( - &self, - drive_batch_operations: Vec, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .drive - .methods - .batch_operations - .convert_drive_operations_to_grove_operations - { - 0 => self.convert_drive_operations_to_grove_operations_v0( - drive_batch_operations, - block_info, - transaction, - platform_version, - ), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "convert_drive_operations_to_grove_operations".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/v0/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/v0/mod.rs deleted file mode 100644 index 48350a9419c..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/convert_drive_operations_to_grove_operations/v0/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::drive::batch::drive_op_batch::DriveLowLevelOperationConverter; -use crate::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; -use crate::drive::batch::{DriveOperation, GroveDbOpBatch}; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::block_info::BlockInfo; - -use dpp::version::PlatformVersion; -use grovedb::batch::GroveDbOp; -use grovedb::TransactionArg; -use itertools::Itertools; - -impl Drive { - /// Convert a batch of drive operations to a batch of grove database operations. - /// - /// This function takes drive operations and converts them into grove database operations by - /// processing each operation in the `drive_batch_operations` vector, transforming them to low-level - /// drive operations and finally, into grove database operations. The resulting operations are - /// returned as a `GroveDbOpBatch`. - /// - /// # Arguments - /// - /// * `drive_batch_operations` - A vector of high-level drive operations to be converted. - /// * `block_info` - A reference to the block information associated with these operations. - /// * `transaction` - A transaction argument to be used during processing. - /// - /// # Returns - /// - /// Returns a `Result` containing a `GroveDbOpBatch` with transformed grove database operations, - /// or an error if any step in the conversion process fails. - pub(super) fn convert_drive_operations_to_grove_operations_v0( - &self, - drive_batch_operations: Vec, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - let ops = drive_batch_operations - .into_iter() - .map(|drive_op| { - let inner_drive_operations = drive_op.into_low_level_drive_operations( - self, - &mut None, - block_info, - transaction, - platform_version, - )?; - Ok(LowLevelDriveOperation::grovedb_operations_consume( - inner_drive_operations, - )) - }) - .flatten_ok() - .collect::, Error>>()?; - Ok(GroveDbOpBatch::from_operations(ops)) - } -} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/mod.rs deleted file mode 100644 index 9f5f5f3facb..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod apply_drive_operations; -mod convert_drive_operations_to_grove_operations; - -pub use apply_drive_operations::*; -pub use convert_drive_operations_to_grove_operations::*; diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/identity.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/identity.rs deleted file mode 100644 index a05cf0940f9..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/identity.rs +++ /dev/null @@ -1,172 +0,0 @@ -use crate::drive::batch::drive_op_batch::DriveLowLevelOperationConverter; -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::block_info::BlockInfo; -use dpp::identity::{Identity, IdentityPublicKey, KeyID, TimestampMillis}; -use dpp::prelude::Revision; - -use dpp::version::PlatformVersion; -use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::collections::HashMap; - -/// Operations on Identities -#[derive(Clone, Debug)] -pub enum IdentityOperationType { - /// Inserts a new identity to the `Identities` subtree. - /// A masternode identity is an identity, but can not have unique keys. - /// It also will skip testing for unique keys when adding non unique keys, so no one will - /// take a key, then add it to a masternode - AddNewIdentity { - /// The identity we wish to insert - identity: Identity, - /// Is this identity a masternode identity - /// On Masternode identities we do not add lookup key hashes - is_masternode_identity: bool, - }, - /// Adds balance to an identity - AddToIdentityBalance { - /// The identity id of the identity - identity_id: [u8; 32], - /// The added balance - added_balance: u64, - }, - /// Removes balance from an identity - RemoveFromIdentityBalance { - /// The identity id of the identity - identity_id: [u8; 32], - /// The balance that will be removed from the identity - /// This needs to be verified in advance - balance_to_remove: u64, - }, - /// Adds an array of keys to the identity - AddNewKeysToIdentity { - /// The identity id of the identity - identity_id: [u8; 32], - /// The unique keys to be added - unique_keys_to_add: Vec, - /// The non unique keys to be added - non_unique_keys_to_add: Vec, - }, - /// Disable Identity Keys - DisableIdentityKeys { - /// The identity id of the identity - identity_id: [u8; 32], - /// The keys to be added - keys_ids: Vec, - /// The time at which they were disabled - disable_at: TimestampMillis, - }, - - /// Re-Enable Identity Keys - /// This should only be used internally in Drive (for masternode identities) - ReEnableIdentityKeys { - /// The identity id of the identity - identity_id: [u8; 32], - /// The keys to be added - keys_ids: Vec, - }, - - /// Updates an identities revision. - UpdateIdentityRevision { - /// The revision id - identity_id: [u8; 32], - /// The revision we are updating to - revision: Revision, - }, -} - -impl DriveLowLevelOperationConverter for IdentityOperationType { - fn into_low_level_drive_operations( - self, - drive: &Drive, - estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let _drive_version = &platform_version.drive; - match self { - IdentityOperationType::AddNewIdentity { - identity, - is_masternode_identity, - } => drive.add_new_identity_operations( - identity, - is_masternode_identity, - block_info, - &mut None, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - IdentityOperationType::AddToIdentityBalance { - identity_id, - added_balance, - } => drive.add_to_identity_balance_operations( - identity_id, - added_balance, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - IdentityOperationType::RemoveFromIdentityBalance { - identity_id, - balance_to_remove, - } => drive.remove_from_identity_balance_operations( - identity_id, - balance_to_remove, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - IdentityOperationType::AddNewKeysToIdentity { - identity_id, - unique_keys_to_add, - non_unique_keys_to_add, - } => drive.add_new_keys_to_identity_operations( - identity_id, - unique_keys_to_add, - non_unique_keys_to_add, - true, - &block_info.epoch, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - IdentityOperationType::DisableIdentityKeys { - identity_id, - keys_ids, - disable_at, - } => drive.disable_identity_keys_operations( - identity_id, - keys_ids, - disable_at, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - IdentityOperationType::ReEnableIdentityKeys { - identity_id, - keys_ids, - } => drive.re_enable_identity_keys_operations( - identity_id, - keys_ids, - estimated_costs_only_with_layer_info, - transaction, - platform_version, - ), - IdentityOperationType::UpdateIdentityRevision { - identity_id, - revision, - } => Ok(vec![drive.update_identity_revision_operation( - identity_id, - revision, - estimated_costs_only_with_layer_info, - platform_version, - )?]), - } - } -} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/mod.rs deleted file mode 100644 index 87331d6772b..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/mod.rs +++ /dev/null @@ -1,1097 +0,0 @@ -mod contract; -mod document; -mod drive_methods; -mod finalize_task; -mod identity; -mod system; -mod withdrawals; - -use crate::drive::batch::GroveDbOpBatch; - -use crate::drive::Drive; -use crate::error::Error; -use crate::fee::op::LowLevelDriveOperation; -use dpp::block::block_info::BlockInfo; - -pub use contract::DataContractOperationType; -pub use document::DocumentOperation; -pub use document::DocumentOperationType; -pub use document::DocumentOperationsForContractDocumentType; -pub use document::UpdateOperationInfo; -pub use identity::IdentityOperationType; -pub use system::SystemOperationType; -pub use withdrawals::WithdrawalOperationType; - -use grovedb::{EstimatedLayerInformation, TransactionArg}; - -use crate::fee::op::LowLevelDriveOperation::GroveOperation; - -use dpp::version::PlatformVersion; -use grovedb::batch::{GroveDbOp, KeyInfoPath}; - -use crate::drive::batch::drive_op_batch::finalize_task::{ - DriveOperationFinalizationTasks, DriveOperationFinalizeTask, -}; -use crate::error::drive::DriveError; -use std::collections::{BTreeMap, HashMap}; - -/// A converter that will get Drive Operations from High Level Operations -pub trait DriveLowLevelOperationConverter { - /// This will get a list of atomic drive operations from a high level operations - fn into_low_level_drive_operations( - self, - drive: &Drive, - estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error>; -} - -/// The drive operation context keeps track of changes that might affect other operations -/// Notably Identity balance changes are kept track of -pub struct DriveOperationContext { - //todo: why is this not being used? - identity_balance_changes: BTreeMap<[u8; 32], i64>, -} - -/// All types of Drive Operations -#[derive(Clone, Debug)] -pub enum DriveOperation<'a> { - /// A contract operation - DataContractOperation(DataContractOperationType<'a>), - /// A document operation - DocumentOperation(DocumentOperationType<'a>), - /// Withdrawal operation - WithdrawalOperation(WithdrawalOperationType<'a>), - /// An identity operation - IdentityOperation(IdentityOperationType), - /// A system operation - SystemOperation(SystemOperationType), - /// A single low level groveDB operation - GroveDBOperation(GroveDbOp), - /// Multiple low level groveDB operations - GroveDBOpBatch(GroveDbOpBatch), -} - -impl DriveLowLevelOperationConverter for DriveOperation<'_> { - fn into_low_level_drive_operations( - self, - drive: &Drive, - estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match self { - DriveOperation::DataContractOperation(contract_operation_type) => { - contract_operation_type.into_low_level_drive_operations( - drive, - estimated_costs_only_with_layer_info, - block_info, - transaction, - platform_version, - ) - } - DriveOperation::DocumentOperation(document_operation_type) => document_operation_type - .into_low_level_drive_operations( - drive, - estimated_costs_only_with_layer_info, - block_info, - transaction, - platform_version, - ), - DriveOperation::WithdrawalOperation(withdrawal_operation_type) => { - withdrawal_operation_type.into_low_level_drive_operations( - drive, - estimated_costs_only_with_layer_info, - block_info, - transaction, - platform_version, - ) - } - DriveOperation::IdentityOperation(identity_operation_type) => identity_operation_type - .into_low_level_drive_operations( - drive, - estimated_costs_only_with_layer_info, - block_info, - transaction, - platform_version, - ), - DriveOperation::SystemOperation(system_operation_type) => system_operation_type - .into_low_level_drive_operations( - drive, - estimated_costs_only_with_layer_info, - block_info, - transaction, - platform_version, - ), - DriveOperation::GroveDBOperation(op) => Ok(vec![GroveOperation(op)]), - DriveOperation::GroveDBOpBatch(operations) => Ok(operations - .operations - .into_iter() - .map(GroveOperation) - .collect()), - } - } -} - -impl DriveOperationFinalizationTasks for DriveOperation<'_> { - fn finalization_tasks( - &self, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - match platform_version - .drive - .methods - .state_transitions - .operations - .finalization_tasks - { - 0 => self.finalization_tasks_v0(platform_version), - version => Err(Error::Drive(DriveError::UnknownVersionMismatch { - method: "DriveOperation.finalization_tasks".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} - -impl DriveOperation<'_> { - fn finalization_tasks_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - match self { - DriveOperation::DataContractOperation(o) => o.finalization_tasks(platform_version), - _ => Ok(None), - } - } -} - -#[cfg(feature = "full")] -#[cfg(test)] -mod tests { - use grovedb::Element; - use std::borrow::Cow; - use std::option::Option::None; - - use super::*; - - use dpp::block::block_info::BlockInfo; - use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::serialization::PlatformSerializableWithPlatformVersion; - use dpp::tests::json_document::{json_document_to_contract, json_document_to_document}; - use dpp::util::cbor_serializer; - use rand::Rng; - use serde_json::json; - use tempfile::TempDir; - - use crate::common::setup_contract; - - use crate::drive::batch::drive_op_batch::document::DocumentOperation::{ - AddOperation, UpdateOperation, - }; - use crate::drive::batch::drive_op_batch::document::DocumentOperationType::MultipleDocumentOperationsForSameContractDocumentType; - use crate::drive::batch::drive_op_batch::document::{ - DocumentOperationsForContractDocumentType, UpdateOperationInfo, - }; - use crate::drive::batch::DataContractOperationType::ApplyContract; - use crate::drive::batch::DocumentOperationType::AddDocumentForContract; - use crate::drive::batch::DriveOperation::{DataContractOperation, DocumentOperation}; - use crate::drive::config::DriveConfig; - use crate::drive::contract::paths::contract_root_path; - use crate::drive::flags::StorageFlags; - use crate::drive::object_size_info::DocumentInfo::DocumentRefInfo; - use crate::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; - use crate::drive::Drive; - use crate::tests::helpers::setup::{setup_drive, setup_drive_with_initial_state_structure}; - - #[test] - fn test_add_dashpay_documents() { - let drive: Drive = setup_drive_with_initial_state_structure(); - let platform_version = PlatformVersion::latest(); - - let mut drive_operations = vec![]; - let db_transaction = drive.grove.start_transaction(); - - let contract = json_document_to_contract( - "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", - false, - platform_version, - ) - .expect("expected to get contract"); - - let _document_type = contract - .document_type_for_name("contactRequest") - .expect("expected to get document type"); - - drive_operations.push(DataContractOperation(ApplyContract { - contract: Cow::Borrowed(&contract), - storage_flags: None, - })); - - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); - - let document_type = contract - .document_type_for_name("contactRequest") - .expect("expected to get document type"); - - let dashpay_cr_document = json_document_to_document( - "tests/supporting_files/contract/dashpay/contact-request0.json", - Some(random_owner_id.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - drive_operations.push(DocumentOperation(AddDocumentForContract { - document_and_contract_info: DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &dashpay_cr_document, - StorageFlags::optional_default_as_cow(), - )), - owner_id: None, - }, - contract: &contract, - document_type, - }, - override_document: false, - })); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to insert contract and document"); - - let element = drive - .grove - .get( - &contract_root_path(&contract.id().to_buffer()), - &[0], - Some(&db_transaction), - ) - .unwrap() - .expect("expected to get contract back"); - - assert_eq!( - element, - Element::Item( - contract - .serialize_to_bytes_with_platform_version(platform_version) - .expect("expected to serialize contract"), - None - ) - ); - - let query_value = json!({ - "where": [ - ], - "limit": 100, - "orderBy": [ - ["$ownerId", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 1); - } - - #[test] - fn test_add_multiple_dashpay_documents_individually_should_succeed() { - let drive = setup_drive_with_initial_state_structure(); - - let platform_version = PlatformVersion::latest(); - - let mut drive_operations = vec![]; - let db_transaction = drive.grove.start_transaction(); - - let contract = json_document_to_contract( - "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", - false, - platform_version, - ) - .expect("expected to get contract"); - - let document_type = contract - .document_type_for_name("contactRequest") - .expect("expected to get document type"); - - drive_operations.push(DataContractOperation(ApplyContract { - contract: Cow::Borrowed(&contract), - storage_flags: None, - })); - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); - - let dashpay_cr_document = json_document_to_document( - "tests/supporting_files/contract/dashpay/contact-request0.json", - Some(random_owner_id.into()), - document_type, - platform_version, - ) - .expect("expected to get contract"); - - drive_operations.push(DocumentOperation(AddDocumentForContract { - document_and_contract_info: DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo((&dashpay_cr_document, None)), - owner_id: None, - }, - contract: &contract, - document_type: contract - .document_type_for_name("contactRequest") - .expect("expected to get document type"), - }, - override_document: false, - })); - - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); - - let dashpay_cr_1_document = json_document_to_document( - "tests/supporting_files/contract/dashpay/contact-request1.json", - Some(random_owner_id.into()), - document_type, - platform_version, - ) - .expect("expected to get contract"); - - drive_operations.push(DocumentOperation(AddDocumentForContract { - document_and_contract_info: DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo((&dashpay_cr_1_document, None)), - owner_id: None, - }, - contract: &contract, - document_type: contract - .document_type_for_name("contactRequest") - .expect("expected to get document type"), - }, - override_document: false, - })); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to be able to insert documents"); - - let query_value = json!({ - "where": [ - ], - "limit": 100, - "orderBy": [ - ["$ownerId", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 2); - } - - #[test] - fn test_add_multiple_dashpay_documents() { - let drive: Drive = setup_drive_with_initial_state_structure(); - - let platform_version = PlatformVersion::latest(); - - let mut drive_operations = vec![]; - let db_transaction = drive.grove.start_transaction(); - - let contract = json_document_to_contract( - "tests/supporting_files/contract/dashpay/dashpay-contract-all-mutable.json", - false, - platform_version, - ) - .expect("expected to get contract"); - - let document_type = contract - .document_type_for_name("contactRequest") - .expect("expected to get document type"); - - drive_operations.push(DataContractOperation(ApplyContract { - contract: Cow::Borrowed(&contract), - storage_flags: None, - })); - - let random_owner_id = rand::thread_rng().gen::<[u8; 32]>(); - - let document0 = json_document_to_document( - "tests/supporting_files/contract/dashpay/contact-request0.json", - Some(random_owner_id.into()), - document_type, - platform_version, - ) - .expect("expected to get document 0"); - - let document1 = json_document_to_document( - "tests/supporting_files/contract/dashpay/contact-request1.json", - Some(random_owner_id.into()), - document_type, - platform_version, - ) - .expect("expected to get document 1"); - - let mut operations = vec![]; - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &document0, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id), - }, - override_document: false, - }); - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &document1, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id), - }, - override_document: false, - }); - - drive_operations.push(DocumentOperation( - MultipleDocumentOperationsForSameContractDocumentType { - document_operations: DocumentOperationsForContractDocumentType { - operations, - contract: &contract, - document_type, - }, - }, - )); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to be able to insert documents"); - - let element = drive - .grove - .get( - &contract_root_path(&contract.id().to_buffer()), - &[0], - Some(&db_transaction), - ) - .unwrap() - .expect("expected to get contract back"); - - assert_eq!( - element, - Element::Item( - contract - .serialize_to_bytes_with_platform_version(platform_version) - .expect("expected to serialize contract"), - None - ) - ); - - let query_value = json!({ - "where": [ - ], - "limit": 100, - "orderBy": [ - ["$ownerId", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 2); - } - - #[test] - fn test_add_multiple_family_documents() { - let drive: Drive = setup_drive_with_initial_state_structure(); - - let platform_version = PlatformVersion::latest(); - - let mut drive_operations = vec![]; - let db_transaction = drive.grove.start_transaction(); - - let contract = setup_contract( - &drive, - "tests/supporting_files/contract/family/family-contract.json", - None, - Some(&db_transaction), - ); - - let document_type = contract - .document_type_for_name("person") - .expect("expected to get document type"); - - let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document0 = json_document_to_document( - "tests/supporting_files/contract/family/person0.json", - Some(random_owner_id0.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document1 = json_document_to_document( - "tests/supporting_files/contract/family/person3.json", - Some(random_owner_id1.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let mut operations = vec![]; - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &person_document0, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id0), - }, - override_document: false, - }); - - let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &person_document1, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id1), - }, - override_document: false, - }); - - drive_operations.push(DocumentOperation( - MultipleDocumentOperationsForSameContractDocumentType { - document_operations: DocumentOperationsForContractDocumentType { - operations, - contract: &contract, - document_type, - }, - }, - )); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to be able to insert documents"); - - let query_value = json!({ - "where": [ - ], - "limit": 100, - "orderBy": [ - ["$ownerId", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 2); - } - - #[test] - fn test_update_multiple_family_documents() { - let drive: Drive = setup_drive_with_initial_state_structure(); - - let platform_version = PlatformVersion::latest(); - - let mut drive_operations = vec![]; - let db_transaction = drive.grove.start_transaction(); - - let contract = setup_contract( - &drive, - "tests/supporting_files/contract/family/family-contract-only-age-index.json", - None, - Some(&db_transaction), - ); - - let document_type = contract - .document_type_for_name("person") - .expect("expected to get document type"); - - let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document0 = json_document_to_document( - "tests/supporting_files/contract/family/person0.json", - Some(random_owner_id0.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document1 = json_document_to_document( - "tests/supporting_files/contract/family/person3.json", - Some(random_owner_id1.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let mut operations = vec![]; - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &person_document0, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id0), - }, - override_document: false, - }); - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &person_document1, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id1), - }, - override_document: false, - }); - - drive_operations.push(DocumentOperation( - MultipleDocumentOperationsForSameContractDocumentType { - document_operations: DocumentOperationsForContractDocumentType { - operations, - contract: &contract, - document_type, - }, - }, - )); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to be able to insert documents"); - - // This was the setup now let's do the update - - drive_operations = vec![]; - - let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document0 = json_document_to_document( - "tests/supporting_files/contract/family/person0-older.json", - Some(random_owner_id0.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document1 = json_document_to_document( - "tests/supporting_files/contract/family/person3-older.json", - Some(random_owner_id1.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let mut operations = vec![]; - - operations.push(UpdateOperation(UpdateOperationInfo { - document: &person_document0, - serialized_document: None, - owner_id: Some(random_owner_id0), - storage_flags: None, - })); - - operations.push(UpdateOperation(UpdateOperationInfo { - document: &person_document1, - serialized_document: None, - owner_id: Some(random_owner_id1), - storage_flags: None, - })); - - drive_operations.push(DocumentOperation( - MultipleDocumentOperationsForSameContractDocumentType { - document_operations: DocumentOperationsForContractDocumentType { - operations, - contract: &contract, - document_type, - }, - }, - )); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to be able to update documents"); - - let query_value = json!({ - "where": [ - ], - "limit": 100, - "orderBy": [ - ["age", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 2); - - let query_value = json!({ - "where": [ - ["age", "==", 35] - ], - "limit": 100, - "orderBy": [ - ["age", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 0); - - let query_value = json!({ - "where": [ - ["age", "==", 36] - ], - "limit": 100, - "orderBy": [ - ["age", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 2); - } - - #[test] - fn test_update_multiple_family_documents_with_index_being_removed_and_added() { - let drive: Drive = setup_drive_with_initial_state_structure(); - - let platform_version = PlatformVersion::latest(); - - let mut drive_operations = vec![]; - let db_transaction = drive.grove.start_transaction(); - - let contract = setup_contract( - &drive, - "tests/supporting_files/contract/family/family-contract-only-age-index.json", - None, - Some(&db_transaction), - ); - - let document_type = contract - .document_type_for_name("person") - .expect("expected to get document type"); - - let random_owner_id0 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document0 = json_document_to_document( - "tests/supporting_files/contract/family/person0.json", - Some(random_owner_id0.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let random_owner_id1 = rand::thread_rng().gen::<[u8; 32]>(); - - let person_document1 = json_document_to_document( - "tests/supporting_files/contract/family/person3-older.json", - Some(random_owner_id1.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let mut operations = vec![]; - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &person_document0, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id0), - }, - override_document: false, - }); - - operations.push(AddOperation { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo(( - &person_document1, - StorageFlags::optional_default_as_cow(), - )), - owner_id: Some(random_owner_id1), - }, - override_document: false, - }); - - drive_operations.push(DocumentOperation( - MultipleDocumentOperationsForSameContractDocumentType { - document_operations: DocumentOperationsForContractDocumentType { - operations, - contract: &contract, - document_type, - }, - }, - )); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to be able to insert documents"); - - // This was the setup now let's do the update - - drive_operations = vec![]; - - let person_document0 = json_document_to_document( - "tests/supporting_files/contract/family/person0-older.json", - Some(random_owner_id0.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let person_document1 = json_document_to_document( - "tests/supporting_files/contract/family/person3.json", - Some(random_owner_id1.into()), - document_type, - platform_version, - ) - .expect("expected to get document"); - - let mut operations = vec![]; - - operations.push(UpdateOperation(UpdateOperationInfo { - document: &person_document0, - serialized_document: None, - owner_id: Some(random_owner_id0), - storage_flags: None, - })); - - operations.push(UpdateOperation(UpdateOperationInfo { - document: &person_document1, - serialized_document: None, - owner_id: Some(random_owner_id1), - storage_flags: None, - })); - - drive_operations.push(DocumentOperation( - MultipleDocumentOperationsForSameContractDocumentType { - document_operations: DocumentOperationsForContractDocumentType { - operations, - contract: &contract, - document_type, - }, - }, - )); - - drive - .apply_drive_operations( - drive_operations, - true, - &BlockInfo::default(), - Some(&db_transaction), - platform_version, - ) - .expect("expected to be able to update documents"); - - let query_value = json!({ - "where": [ - ["age", ">=", 5] - ], - "limit": 100, - "orderBy": [ - ["age", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 2); - - let query_value = json!({ - "where": [ - ["age", "==", 35] - ], - "limit": 100, - "orderBy": [ - ["age", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 1); - - let query_value = json!({ - "where": [ - ["age", "==", 36] - ], - "limit": 100, - "orderBy": [ - ["age", "asc"], - ] - }); - let where_cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) - .expect("expected to serialize to cbor"); - - let (docs, _, _) = drive - .query_documents_cbor_from_contract( - &contract, - document_type, - where_cbor.as_slice(), - None, - Some(&db_transaction), - Some(platform_version.protocol_version), - ) - .expect("expected to query"); - assert_eq!(docs.len(), 1); - } -} diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/withdrawals.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/withdrawals.rs deleted file mode 100644 index 9032fa60647..00000000000 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/withdrawals.rs +++ /dev/null @@ -1,158 +0,0 @@ -use std::collections::HashMap; - -use dpp::block::block_info::BlockInfo; -use dpp::version::PlatformVersion; -use grovedb::Element; -use grovedb::{batch::KeyInfoPath, EstimatedLayerInformation, TransactionArg}; - -use crate::drive::grove_operations::BatchDeleteApplyType; -use crate::drive::identity::withdrawals::paths::{ - get_withdrawal_root_path_vec, get_withdrawal_transactions_expired_ids_path, - get_withdrawal_transactions_expired_ids_path_vec, get_withdrawal_transactions_queue_path, - get_withdrawal_transactions_queue_path_vec, WITHDRAWAL_TRANSACTIONS_COUNTER_ID, -}; -use crate::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use crate::drive::object_size_info::PathKeyElementInfo; -use crate::{drive::Drive, error::Error, fee::op::LowLevelDriveOperation}; - -use super::DriveLowLevelOperationConverter; - -/// Operations for Withdrawals -#[derive(Clone, Debug)] -pub enum WithdrawalOperationType<'a> { - /// Inserts expired index into it's tree - InsertExpiredIndex { - /// index value - index: u64, - }, - /// Removes expired index from the tree - DeleteExpiredIndex { - /// index value - key: Vec, - }, - /// Update index counter - UpdateIndexCounter { - /// index counter value - index: u64, - }, - /// Insert Core Transaction into queue - InsertTransactions { - /// transaction id bytes - withdrawal_transactions: &'a [WithdrawalTransactionIdAndBytes], - }, - /// Delete withdrawal - DeleteWithdrawalTransaction { - /// withdrawal transaction tuple with id and bytes - id: Vec, - }, -} - -impl DriveLowLevelOperationConverter for WithdrawalOperationType<'_> { - fn into_low_level_drive_operations( - self, - drive: &Drive, - _estimated_costs_only_with_layer_info: &mut Option< - HashMap, - >, - _block_info: &BlockInfo, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match self { - WithdrawalOperationType::InsertExpiredIndex { index } => { - let mut drive_operations = vec![]; - - let index_bytes = index.to_be_bytes(); - - let path = get_withdrawal_transactions_expired_ids_path_vec(); - - drive.batch_insert( - PathKeyElementInfo::PathKeyElement::<'_, 1>(( - path, - index_bytes.to_vec(), - Element::Item(vec![], None), - )), - &mut drive_operations, - &platform_version.drive, - )?; - - Ok(drive_operations) - } - WithdrawalOperationType::DeleteExpiredIndex { key } => { - let mut drive_operations = vec![]; - - let path: [&[u8]; 2] = get_withdrawal_transactions_expired_ids_path(); - - drive.batch_delete( - (&path).into(), - &key, - BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), - }, - transaction, - &mut drive_operations, - &platform_version.drive, - )?; - - Ok(drive_operations) - } - WithdrawalOperationType::UpdateIndexCounter { index } => { - let mut drive_operations = vec![]; - - let path = get_withdrawal_root_path_vec(); - - drive.batch_insert( - PathKeyElementInfo::PathKeyRefElement::<'_, 1>(( - path, - &WITHDRAWAL_TRANSACTIONS_COUNTER_ID, - Element::Item(index.to_be_bytes().to_vec(), None), - )), - &mut drive_operations, - &platform_version.drive, - )?; - - Ok(drive_operations) - } - WithdrawalOperationType::InsertTransactions { - withdrawal_transactions, - } => { - let mut drive_operations = vec![]; - - let path = get_withdrawal_transactions_queue_path_vec(); - - for (id, bytes) in withdrawal_transactions { - drive.batch_insert( - PathKeyElementInfo::PathKeyElement::<'_, 1>(( - path.clone(), - id.clone(), - Element::Item(bytes.clone(), None), - )), - &mut drive_operations, - &platform_version.drive, - )?; - } - - Ok(drive_operations) - } - WithdrawalOperationType::DeleteWithdrawalTransaction { id } => { - let mut drive_operations = vec![]; - - let path = get_withdrawal_transactions_queue_path(); - - drive.batch_delete( - (&path).into(), - &id, - // we know that we are not deleting a subtree - BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), - }, - transaction, - &mut drive_operations, - &platform_version.drive, - )?; - - Ok(drive_operations) - } - } - } -} diff --git a/packages/rs-drive/src/drive/batch/grovedb_op_batch/mod.rs b/packages/rs-drive/src/drive/batch/grovedb_op_batch/mod.rs deleted file mode 100644 index 215fd9bfe7e..00000000000 --- a/packages/rs-drive/src/drive/batch/grovedb_op_batch/mod.rs +++ /dev/null @@ -1,335 +0,0 @@ -//! GroveDB Operations Batch. -//! -//! This module defines the GroveDbOpBatch struct and implements its functions. -//! - -use crate::drive::flags::StorageFlags; -use grovedb::batch::key_info::KeyInfo; -use grovedb::batch::{GroveDbOp, GroveDbOpConsistencyResults, KeyInfoPath, Op}; -use grovedb::Element; -use std::borrow::Cow; - -/// A batch of GroveDB operations as a vector. -// TODO move to GroveDB -#[derive(Debug, Default, Clone)] -pub struct GroveDbOpBatch { - /// Operations - pub(crate) operations: Vec, -} - -/// Trait defining a batch of GroveDB operations. -pub trait GroveDbOpBatchV0Methods { - /// Creates a new empty batch of GroveDB operations. - fn new() -> Self; - - /// Gets the number of operations from a list of GroveDB ops. - fn len(&self) -> usize; - - /// Checks to see if the operation batch is empty. - fn is_empty(&self) -> bool; - - /// Pushes an operation into a list of GroveDB ops. - fn push(&mut self, op: GroveDbOp); - - /// Appends operations into a list of GroveDB ops. - fn append(&mut self, other: &mut Self); - - /// Extend operations into a list of GroveDB ops. - fn extend>(&mut self, other_ops: I); - - /// Puts a list of GroveDB operations into a batch. - fn from_operations(operations: Vec) -> Self; - - /// Adds an `Insert` operation with an empty tree at the specified path and key to a list of GroveDB ops. - fn add_insert_empty_tree(&mut self, path: Vec>, key: Vec); - - /// Adds an `Insert` operation with an empty tree with storage flags to a list of GroveDB ops. - fn add_insert_empty_tree_with_flags( - &mut self, - path: Vec>, - key: Vec, - storage_flags: &Option>, - ); - - /// Adds an `Insert` operation with an empty sum tree at the specified path and key to a list of GroveDB ops. - fn add_insert_empty_sum_tree(&mut self, path: Vec>, key: Vec); - - /// Adds an `Insert` operation with an empty sum tree with storage flags to a list of GroveDB ops. - fn add_insert_empty_sum_tree_with_flags( - &mut self, - path: Vec>, - key: Vec, - storage_flags: &Option>, - ); - - /// Adds a `Delete` operation to a list of GroveDB ops. - fn add_delete(&mut self, path: Vec>, key: Vec); - - /// Adds a `Delete` tree operation to a list of GroveDB ops. - fn add_delete_tree(&mut self, path: Vec>, key: Vec, is_sum_tree: bool); - - /// Adds an `Insert` operation with an element to a list of GroveDB ops. - fn add_insert(&mut self, path: Vec>, key: Vec, element: Element); - - /// Verify consistency of operations - fn verify_consistency_of_operations(&self) -> GroveDbOpConsistencyResults; - - /// Check if the batch contains a specific path and key. - /// - /// # Arguments - /// - /// * `path` - The path to search for. - /// * `key` - The key to search for. - /// - /// # Returns - /// - /// * `Option<&Op>` - Returns a reference to the `Op` if found, or `None` otherwise. - fn contains<'c, P>(&self, path: P, key: &[u8]) -> Option<&Op> - where - P: IntoIterator, -